From abdc83c1bb27d05377bfd5d45ae1a1fbee731233 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 4 Sep 2026 14:23:11 -0700 Subject: [PATCH 01/31] feat(auth): make Sim an OAuth 2.1 provider and move the CLI onto it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sim becomes an authorization server, so other software can sign a person in and act as them with their consent. `sim login` uses it by default, replacing a permanent personal API key with a short-lived, scoped, revocable token. Built on `@better-auth/oauth-provider@1.6.27`, pinned to match the Better Auth already in the tree — no upgrade required. Tokens are opaque rather than JWTs, so revoking an app in settings or running `sim logout` takes effect on the very next request. Access tokens last an hour; refresh tokens rotate on every use and expire after thirty days. A new principal kind, `oauth_access_token`, is admitted exactly where `personal_api_key` is and nowhere else; `check:principal-kind-parity` fails the build if the two ever drift apart. Write scope is derived from the HTTP method at v2 admission rather than from an operation's `minimumRole`, because several POST routes only read — a role-derived rule let a read-only token write. The consent card refuses to render for a request Sim did not issue: an unsigned query, a repeated parameter, or a client the server declines to name. Clients are operator-created rows. Dynamic registration is off, and every one of the plugin's client CRUD endpoints is closed at the source. Off with `OAUTH_PROVIDER_ENABLED=false`, which the CLI detects and falls back to the existing pairing-code handoff. --- apps/docs/content/docs/cli/authentication.mdx | 147 +- apps/docs/content/docs/cli/commands.mdx | 9 +- apps/docs/content/docs/cli/reference.mdx | 9 +- .../docs/platform/enterprise/self-hosted.mdx | 5 +- .../platform/self-hosting/authentication.mdx | 41 + .../self-hosting/environment-variables.mdx | 6 + apps/docs/openapi-v2-billing.json | 2 +- apps/docs/openapi-v2-files-audit.json | 2 +- apps/docs/openapi-v2-knowledge.json | 2 +- apps/docs/openapi-v2-logs.json | 2 +- apps/docs/openapi-v2-resources.json | 6 +- apps/docs/openapi-v2-tables.json | 2 +- apps/docs/openapi-v2-workflows.json | 2 +- .../app/(auth)/oauth/consent/consent-view.tsx | 184 + apps/sim/app/(auth)/oauth/consent/loading.tsx | 39 + apps/sim/app/(auth)/oauth/consent/page.tsx | 76 + .../app/(auth)/oauth/consent/search-params.ts | 21 + apps/sim/app/(auth)/oauth/sign-in/route.ts | 47 + .../oauth-authorization-server/route.ts | 38 + .../app/account/settings/[section]/page.tsx | 5 +- apps/sim/app/api/auth/[...all]/route.test.ts | 44 + apps/sim/app/api/auth/[...all]/route.ts | 43 + .../app/api/auth/oauth2/authorize/route.ts | 31 +- .../api/cron/cleanup-oauth-tokens/route.ts | 36 + apps/sim/app/api/files/uploads/purposes.ts | 1 + .../me/authorized-apps/[clientId]/route.ts | 24 + .../app/api/users/me/authorized-apps/route.ts | 24 + apps/sim/app/api/v1/knowledge/utils.ts | 2 +- apps/sim/app/api/v1/middleware.ts | 7 +- apps/sim/app/api/v2/chat/route.ts | 24 +- .../documents/[documentId]/route.ts | 3 +- .../[knowledgeBaseId]/documents/route.ts | 3 +- .../uploads/[uploadId]/complete/route.ts | 3 +- apps/sim/app/api/v2/knowledge/route.ts | 3 +- apps/sim/app/api/v2/knowledge/search/route.ts | 4 + apps/sim/app/api/v2/lib/response.test.ts | 46 +- apps/sim/app/api/v2/lib/response.ts | 76 +- .../api/v2/mcp-servers/[mcpServerId]/route.ts | 3 +- apps/sim/app/api/v2/mcp-servers/route.ts | 3 +- .../api/v2/skills/[skillId]/editors/route.ts | 5 +- apps/sim/app/api/v2/skills/[skillId]/route.ts | 5 +- apps/sim/app/api/v2/skills/route.ts | 3 +- .../v2/tables/[tableId]/query/count/route.ts | 2 + .../api/v2/tables/[tableId]/query/route.ts | 2 + .../v2/tables/[tableId]/rows/search/route.ts | 2 + .../v2/workflows/[workflowId]/deploy/route.ts | 3 +- .../authorized-apps/authorized-apps.tsx | 119 + .../background/cleanup-oauth-tokens.test.ts | 72 + apps/sim/background/cleanup-oauth-tokens.ts | 82 + .../settings/account-settings-renderer.tsx | 6 + .../components/settings/navigation.test.ts | 1 + apps/sim/components/settings/navigation.ts | 21 +- .../settings/standalone-settings-shell.tsx | 5 +- apps/sim/hooks/queries/oauth-provider.ts | 96 + apps/sim/lib/api/application/operations.ts | 2 +- .../read-v2-api-capabilities.test.ts | 2 +- apps/sim/lib/api/contracts/user.ts | 38 + apps/sim/lib/api/contracts/v2/meta.ts | 4 +- apps/sim/lib/api/contracts/workspaces.ts | 2 + .../api/server/routes/v2-api-key-auth.test.ts | 135 +- .../lib/api/server/routes/v2-api-key-auth.ts | 128 +- .../server/routes/v2-credential-headers.ts | 36 + .../api/server/routes/v2-json-route.test.ts | 89 + .../lib/api/server/routes/v2-json-route.ts | 121 +- .../authorized-audit-log-use-case.ts | 18 + .../lib/audit-logs/application/operations.ts | 11 +- apps/sim/lib/auth/auth-client.ts | 7 + apps/sim/lib/auth/auth.ts | 97 + apps/sim/lib/auth/oauth-access-token.test.ts | 116 + apps/sim/lib/auth/oauth-access-token.ts | 114 + apps/sim/lib/auth/oauth-principal.test.ts | 71 + apps/sim/lib/auth/oauth-provider.test.ts | 73 + apps/sim/lib/auth/oauth-provider.ts | 99 + .../authorized-billing-read-use-case.ts | 40 +- .../billing/application/get-billing-status.ts | 5 +- .../billing/application/list-billing-logs.ts | 3 +- .../sim/lib/billing/application/operations.ts | 8 +- .../catalog/application/operations.test.ts | 1 + .../sim/lib/catalog/application/operations.ts | 10 +- .../application/operations.ts | 10 +- .../sim/lib/copilot/application/operations.ts | 2 +- apps/sim/lib/core/application/forbidden.ts | 4 + apps/sim/lib/core/application/index.ts | 3 + .../workspace-authorization.test.ts | 164 + .../application/workspace-authorization.ts | 122 + .../lib/core/config/deployment-shape.test.ts | 1 + apps/sim/lib/core/config/deployment-shape.ts | 2 + apps/sim/lib/core/config/env-flags.ts | 10 + apps/sim/lib/core/config/env.ts | 3 + .../application/operations.test.ts | 4 +- .../lib/credentials/application/operations.ts | 10 +- .../custom-tools/application/operations.ts | 10 +- .../integrations/principal-scope.server.ts | 4 +- .../lib/knowledge/application/operations.ts | 30 +- apps/sim/lib/logs/application/operations.ts | 14 +- .../lib/mcp/application/operations.test.ts | 3 +- apps/sim/lib/mcp/application/operations.ts | 12 +- .../sandboxes/application/operations.test.ts | 10 +- .../lib/sandboxes/application/operations.ts | 10 +- .../sim/lib/secrets/application/operations.ts | 2 +- apps/sim/lib/secrets/application/use-cases.ts | 2 +- .../lib/skills/application/operations.test.ts | 8 +- apps/sim/lib/skills/application/operations.ts | 14 +- apps/sim/lib/table/application/operations.ts | 24 +- .../tool-execution/application/operations.ts | 2 +- .../lib/uploads/upload-session/application.ts | 4 +- .../sim/lib/uploads/upload-session/service.ts | 37 +- .../users/application/authorized-apps.test.ts | 165 + .../lib/users/application/authorized-apps.ts | 113 + apps/sim/lib/users/application/operations.ts | 10 + .../workflows/application/operations.test.ts | 40 +- .../lib/workflows/application/operations.ts | 26 +- apps/sim/lib/workflows/deployment-outbox.ts | 8 + .../application/operations.test.ts | 10 +- .../workspace-files/application/operations.ts | 22 +- .../lib/workspaces/application/operations.ts | 6 +- apps/sim/package.json | 1 + apps/sim/proxy.test.ts | 26 + apps/sim/proxy.ts | 11 +- apps/sim/scripts/create-oauth-client.ts | 162 + bun.lock | 5 + package.json | 1 + packages/audit/src/types.ts | 4 + packages/auth/src/principal.ts | 66 +- .../db/migrations/0321_oauth_provider.sql | 106 + .../0322_oauth_consent_uniqueness.sql | 4 + .../db/migrations/meta/0321_snapshot.json | 22327 +++++++++++++++ .../db/migrations/meta/0322_snapshot.json | 22342 ++++++++++++++++ packages/db/migrations/meta/_journal.json | 14 + packages/db/schema.ts | 141 + packages/sim-cli/src/auth/oauth-flow.test.ts | 272 + packages/sim-cli/src/auth/oauth-flow.ts | 512 + packages/sim-cli/src/auth/refresh.test.ts | 91 + packages/sim-cli/src/auth/refresh.ts | 65 + packages/sim-cli/src/commands/auth.test.ts | 273 +- packages/sim-cli/src/commands/auth.ts | 454 +- .../sim-cli/src/commands/configure.test.ts | 2 +- packages/sim-cli/src/config/index.ts | 5 + packages/sim-cli/src/config/profile.test.ts | 166 +- packages/sim-cli/src/config/profile.ts | 265 +- packages/sim-cli/src/context.ts | 3 +- packages/sim-cli/src/generated/v2-api.ts | 2 +- packages/sim-cli/src/http/client.test.ts | 156 +- packages/sim-cli/src/http/client.ts | 105 +- packages/sim-cli/src/http/environment.test.ts | 14 +- packages/sim-cli/src/http/environment.ts | 6 +- packages/testing/src/mocks/env-flags.mock.ts | 3 + packages/testing/src/mocks/schema.mock.ts | 66 + scripts/check-api-validation-contracts.ts | 1 + scripts/check-principal-kind-parity.test.ts | 65 + scripts/check-principal-kind-parity.ts | 174 + 151 files changed, 51028 insertions(+), 482 deletions(-) create mode 100644 apps/sim/app/(auth)/oauth/consent/consent-view.tsx create mode 100644 apps/sim/app/(auth)/oauth/consent/loading.tsx create mode 100644 apps/sim/app/(auth)/oauth/consent/page.tsx create mode 100644 apps/sim/app/(auth)/oauth/consent/search-params.ts create mode 100644 apps/sim/app/(auth)/oauth/sign-in/route.ts create mode 100644 apps/sim/app/.well-known/oauth-authorization-server/route.ts create mode 100644 apps/sim/app/api/cron/cleanup-oauth-tokens/route.ts create mode 100644 apps/sim/app/api/users/me/authorized-apps/[clientId]/route.ts create mode 100644 apps/sim/app/api/users/me/authorized-apps/route.ts create mode 100644 apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx create mode 100644 apps/sim/background/cleanup-oauth-tokens.test.ts create mode 100644 apps/sim/background/cleanup-oauth-tokens.ts create mode 100644 apps/sim/hooks/queries/oauth-provider.ts create mode 100644 apps/sim/lib/api/server/routes/v2-credential-headers.ts create mode 100644 apps/sim/lib/auth/oauth-access-token.test.ts create mode 100644 apps/sim/lib/auth/oauth-access-token.ts create mode 100644 apps/sim/lib/auth/oauth-principal.test.ts create mode 100644 apps/sim/lib/auth/oauth-provider.test.ts create mode 100644 apps/sim/lib/auth/oauth-provider.ts create mode 100644 apps/sim/lib/users/application/authorized-apps.test.ts create mode 100644 apps/sim/lib/users/application/authorized-apps.ts create mode 100644 apps/sim/scripts/create-oauth-client.ts create mode 100644 packages/db/migrations/0321_oauth_provider.sql create mode 100644 packages/db/migrations/0322_oauth_consent_uniqueness.sql create mode 100644 packages/db/migrations/meta/0321_snapshot.json create mode 100644 packages/db/migrations/meta/0322_snapshot.json create mode 100644 packages/sim-cli/src/auth/oauth-flow.test.ts create mode 100644 packages/sim-cli/src/auth/oauth-flow.ts create mode 100644 packages/sim-cli/src/auth/refresh.test.ts create mode 100644 packages/sim-cli/src/auth/refresh.ts create mode 100644 scripts/check-principal-kind-parity.test.ts create mode 100644 scripts/check-principal-kind-parity.ts diff --git a/apps/docs/content/docs/cli/authentication.mdx b/apps/docs/content/docs/cli/authentication.mdx index 68461afd01f..7713d44acb5 100644 --- a/apps/docs/content/docs/cli/authentication.mdx +++ b/apps/docs/content/docs/cli/authentication.mdx @@ -5,8 +5,9 @@ description: Sign in from the terminal, authenticate CI with an API key, and kee import { Callout } from 'fumadocs-ui/components/callout' -The CLI authenticates with a Sim API key. `sim login` mints and stores one; in CI -you supply one through the environment instead. +`sim login` signs you in through your browser and stores a short-lived login +that renews itself and can be revoked at any time. In CI you supply an API key +through the environment instead. ## Signing in @@ -14,9 +15,60 @@ you supply one through the environment instead. sim login ``` -The terminal prints a pairing code and a URL: +The CLI opens your browser on Sim's sign-in page, then on a consent page that +names the Sim CLI and what it will be able to do. Approve, and the browser hands +control back to the terminal: ``` +Signing in to https://www.sim.ai as profile default + +https://www.sim.ai/api/auth/oauth2/authorize?client_id=sim-cli&… + +Waiting for you to approve in the browser… + +✓ Logged in. Login stored in /Users/you/.sim/credentials + Renews itself; revoke it any time in Settings → Authorized apps, or with: sim logout + No default workspace. Set one with: sim configure --set-workspace +``` + +This is OAuth 2.1 with PKCE and a loopback redirect, the same flow the AWS, Google +Cloud, and Cloudflare CLIs use. The browser only ever carries a one-time code; +the tokens are exchanged over the terminal's own connection and written to +`~/.sim/credentials` with `0600` permissions. Access tokens last an hour and are +renewed automatically from a refresh token, so you sign in once and stay signed +in until you log out, revoke the login, or go thirty days without using it — the +refresh token expires then and `sim login` starts a fresh one. + + +Only approve a consent page you reached by running `sim login` yourself. A +consent page that appears unprompted, or one you were sent a link to, is not +your login. + + +| Option | What it does | +| --- | --- | +| `--no-browser` | Print the URL instead of opening a browser | +| `--browserless` | Use the pairing-code handoff instead (see below) | +| `--read-only` | Ask only for permission to read, never to change anything | +| `--callback-port ` | Pin the local port the browser returns to, for a container or SSH session that forwards a fixed one | +| `--scope ` | Key space for the pairing-code handoff. Only `copilot` changes anything, and it forces that flow | +| `-y, --yes` | Overwrite an existing profile without prompting | + +### Over SSH or in a container + +The browser login needs your browser to reach a listener on the machine running +`sim`. When it cannot — an SSH session, a dev container, a remote box — use the +pairing-code handoff, which the CLI selects automatically in an SSH session: + +```bash +sim login --browserless +``` + +The terminal prints a pairing code and a URL you can open on any device: + +``` +Signing in to https://www.sim.ai as profile default + Pairing code: K7M2-P9XT Confirm this code matches what the browser shows before approving. @@ -27,45 +79,49 @@ Waiting for approval… Personal key, defaulting to 2f6d0b1c-8a34-4d92-b7e5-31c8a0f45d67. Override per command with --workspace. ``` -There is no loopback listener, so this works over SSH and inside containers. - Confirm the pairing code in the browser matches the one in your terminal before approving. That check is what binds the approval to your terminal. -| Option | What it does | -| --- | --- | -| `--no-browser` | Print the URL instead of opening a browser | -| `--scope ` | Key space to mint from: `platform` (default) or `copilot` | -| `-y, --yes` | Overwrite an existing profile without prompting | +The handoff issues a permanent personal API key rather than a renewing login, +so revoke it under **Settings → API keys** when you are done with that machine. +It is also the path for a deployment that predates OAuth sign-in, or one with +the provider switched off; the CLI detects that and falls back on its own. + +`--read-only` and `--callback-port` belong to the browser login and have no +meaning here, so combining either with the handoff stops the login rather than +storing a credential you did not ask for. If your SSH session forwards a port +back to your machine, pass `--callback-port ` on its own: naming the port +tells the CLI the loopback redirect does reach you, and it runs the browser +login instead of the handoff. ### Picking a workspace -You choose the workspace on the approval page. `sim login` issues a **personal** key. The workspace you pick becomes the -profile's default `workspace`; it does **not** restrict the key to that -workspace. Target another workspace the key can reach with `--workspace`: +A login carries the full authority of your account across every workspace you +belong to, so the profile's `workspace` setting only decides the default target. +Set it after signing in, or pass `--workspace` per command: ```bash +sim workspaces list +sim configure --set-workspace 2f6d0b1c-8a34-4d92-b7e5-31c8a0f45d67 sim workflows list --workspace 9b4c7e02-1d58-4f36-a0c9-6e2b85df413a ``` -`sim login --workspace ` preselects a workspace in the picker, and -re-logging into an existing profile preselects the one already configured. +With the pairing-code handoff you choose the default workspace on the approval +page instead. -To save another workspace without minting or copying another personal key, add -a workspace profile: +To target another workspace without a second login, add a workspace profile: ```bash -sim workspaces list sim profile add acme --workspace 7e2d9c14-6b83-4a55-8f01-c4d3e9a76b28 sim --profile acme whoami ``` The new profile stores `auth_profile = default` and its own workspace. Omit -`--workspace` in an interactive terminal to choose from the workspaces the -active key can access; scripts must provide the workspace ID explicitly. The -picker is capped at 1,000 entries and asks for an explicit ID above that. +`--workspace` in an interactive terminal to choose from the workspaces your +login can access; scripts must provide the workspace ID explicitly. The picker +is capped at 1,000 entries and asks for an explicit ID above that. ## Checking who you are @@ -74,9 +130,10 @@ sim whoami # resolved settings, plus a live check that they work sim whoami --no-verify # resolved settings only, no request ``` -Prints the resolved endpoint, workspace, and output format, and which source each -value came from, then reads the configured workspace to prove the key is accepted -and can reach it. +Prints the resolved endpoint, workspace, and output format, which source each +value came from, and whether the profile holds an OAuth login or an API key, +then reads the configured workspace to prove the credential is accepted and can +reach it. It exits `0` when the check passes, `1` when the credentials are wrong, and `2` when the check could not be made at all — no workspace to check against, or an @@ -86,25 +143,30 @@ logging in again. ## Signing out ```bash -sim logout # remove the stored key +sim logout # sign out of Sim and remove the stored login sim logout --all # remove the profile entirely, including its settings ``` -A workspace profile that shares authentication cannot remove the shared key. +For an OAuth login, `sim logout` revokes the login on the server first, so the +tokens stop working everywhere, then removes them from disk. You can also revoke +it from another device under **Settings → Authorized apps**, which signs that +terminal out on its next request. + +A workspace profile that shares authentication cannot remove the shared login. Remove only that local profile with `sim logout --all --profile `, or log out of the authentication profile named by the error message. Removing an authentication profile entirely is refused until its workspace profiles are removed, so it cannot leave dangling references. -`sim logout` removes the key from disk but does **not** revoke it. Revoke keys in -Sim under **Settings → API keys**. +For a login created with `--browserless`, `sim logout` removes the API key from +disk but does **not** revoke it. Revoke keys under **Settings → API keys**. ## Authenticating CI -Set the key and workspace in the environment; the CLI never reads or writes a -config file: +Set an API key and workspace in the environment; the CLI never reads or writes +a config file, and an explicit key outranks any stored login: ```bash export SIM_API_KEY="sim_…" @@ -148,7 +210,7 @@ sim workflows list --profile dev sim workflows list --profile prod ``` -Use workspace profiles when one personal key should target several workspaces: +Use workspace profiles when one login should target several workspaces: ```bash sim profile add marketing --workspace c3a70e58-9f21-4d6b-b842-05e7f19c6a3d @@ -174,21 +236,32 @@ Save it to avoid repeating the flag: sim configure --set-endpoint http://localhost:3000 --profile local ``` -## Where the key is stored +A self-hosted deployment offers OAuth sign-in by default; set +`OAUTH_PROVIDER_ENABLED=false` on the server to switch it off, in which case the +CLI uses the pairing-code handoff. + +## Where the login is stored -Keys live in `~/.sim/credentials`, written `0600`, separate from the non-secret +Logins live in `~/.sim/credentials`, written `0600`, separate from the non-secret `~/.sim/config`. Commit `config` to a dotfiles repo if you like; never `credentials`. ```ini title="~/.sim/credentials" [default] -api_key = sim_… +access_token = sim_oat_… +refresh_token = sim_ort_… +token_expires_at = 1788547200000 -[dev] +[ci-box] api_key = sim_… ``` +A profile holds one login: writing an OAuth login replaces a stored key and +vice versa. Several `sim` commands running at once share one renewal, so a +parallel shell loop cannot sign itself out. + ## Organization audit logs -`sim audit-logs` requires a **personal** API key — the kind `sim login` issues. -A workspace-scoped key cannot read organization-level audit logs. +`sim audit-logs` requires a **personal** credential — an OAuth login, or the +personal API key `sim login --browserless` issues. A workspace-scoped key cannot +read organization-level audit logs. diff --git a/apps/docs/content/docs/cli/commands.mdx b/apps/docs/content/docs/cli/commands.mdx index e8a54f5acc6..df54cee21a1 100644 --- a/apps/docs/content/docs/cli/commands.mdx +++ b/apps/docs/content/docs/cli/commands.mdx @@ -52,7 +52,7 @@ These apply to every command, and may be written before or after it. | [`sim workflows`](/cli/workflows) | Manage workflows | | [`sim workspaces`](/cli/workspaces) | Manage workspaces | -## Authorize this terminal and store an API key for the profile +## Sign in through the browser and store the login for the profile ```bash sim login [options] @@ -64,13 +64,16 @@ sim login [options] | Option | Required | Description | | --- | --- | --- | -| `--scope ` | No | Key space to mint from: platform or copilot. Defaults to `platform`. | +| `--scope ` | No | Key space for the pairing-code handoff; only "copilot" changes anything, and it forces that flow. Defaults to `platform`. | | `--no-browser` | No | Print the URL instead of opening a browser. | +| `--browserless` | No | Use the pairing-code handoff for a terminal whose browser cannot reach it (SSH, containers). | +| `--read-only` | No | Ask only for permission to read, never to change anything. | +| `--callback-port ` | No | Pin the local port the browser returns to. | | `-y, --yes` | No | Overwrite an existing profile without prompting. | -## Remove the profile's stored API key +## Sign out and remove the profile's stored login ```bash sim logout [options] diff --git a/apps/docs/content/docs/cli/reference.mdx b/apps/docs/content/docs/cli/reference.mdx index 28bab99672f..22c255fc73a 100644 --- a/apps/docs/content/docs/cli/reference.mdx +++ b/apps/docs/content/docs/cli/reference.mdx @@ -26,7 +26,7 @@ These apply to every command, and may be written before or after it. ## sim login -Authorize this terminal and store an API key for the profile +Sign in through the browser and store the login for the profile ```bash sim login [options] @@ -38,15 +38,18 @@ sim login [options] | Option | Required | Description | | --- | --- | --- | -| `--scope ` | No | Key space to mint from: platform or copilot. Defaults to `platform`. | +| `--scope ` | No | Key space for the pairing-code handoff; only "copilot" changes anything, and it forces that flow. Defaults to `platform`. | | `--no-browser` | No | Print the URL instead of opening a browser. | +| `--browserless` | No | Use the pairing-code handoff for a terminal whose browser cannot reach it (SSH, containers). | +| `--read-only` | No | Ask only for permission to read, never to change anything. | +| `--callback-port ` | No | Pin the local port the browser returns to. | | `-y, --yes` | No | Overwrite an existing profile without prompting. | ## sim logout -Remove the profile's stored API key +Sign out and remove the profile's stored login ```bash sim logout [options] diff --git a/apps/docs/content/docs/platform/enterprise/self-hosted.mdx b/apps/docs/content/docs/platform/enterprise/self-hosted.mdx index bd809138a9e..6002f351191 100644 --- a/apps/docs/content/docs/platform/enterprise/self-hosted.mdx +++ b/apps/docs/content/docs/platform/enterprise/self-hosted.mdx @@ -85,9 +85,12 @@ Persist that value as `CRON_SECRET` on the app **and** on whatever calls these e | Retention — logs | `GET /api/logs/cleanup` | Daily | **No** — schedule it yourself | | Retention — soft deletes | `GET /api/cron/cleanup-soft-deletes` | Daily | **No** — schedule it yourself | | Retention — Chat tasks | `GET /api/cron/cleanup-tasks` | Daily | **No** — schedule it yourself | +| Retention — OAuth tokens | `GET /api/cron/cleanup-oauth-tokens` | Daily | **No** — schedule it yourself | - Both shipped deployments schedule the data-drain dispatcher but **not** the three retention cleanup endpoints — neither the Helm chart nor Docker Compose's `cron` service. Setting `DATA_RETENTION_ENABLED=true` alone deletes nothing — the windows are evaluated only when one of those endpoints is called. Add them to `cronjobs.jobs` yourself, or drive them from an external scheduler. + Both shipped deployments schedule the data-drain dispatcher but **not** the retention cleanup endpoints — neither the Helm chart nor Docker Compose's `cron` service. Setting `DATA_RETENTION_ENABLED=true` alone deletes nothing — the windows are evaluated only when one of those endpoints is called. Add them to `cronjobs.jobs` yourself, or drive them from an external scheduler. + + The OAuth token sweep is the same: with Sim's OAuth provider on, every CLI login leaves a lapsed access-token row behind each hour, and nothing else removes them. It is a no-op when `OAUTH_PROVIDER_ENABLED=false`. ```bash diff --git a/apps/docs/content/docs/platform/self-hosting/authentication.mdx b/apps/docs/content/docs/platform/self-hosting/authentication.mdx index 7af562b6bc2..3a84e206a4b 100644 --- a/apps/docs/content/docs/platform/self-hosting/authentication.mdx +++ b/apps/docs/content/docs/platform/self-hosting/authentication.mdx @@ -79,6 +79,47 @@ Providers are then registered in the app under **Settings → Organization → S See the [SSO guide](/platform/enterprise/sso) for identity-provider setup and the [self-hosted enterprise guide](/platform/enterprise/self-hosted) for the organization patterns. +## Sign in with Sim + +Your deployment is also an OAuth 2.1 authorization server, so other software can +sign a person in as themselves and act with their permissions. The Sim CLI uses +it by default; see [CLI authentication](/cli/authentication). + +It is on unless you turn it off: + +```bash +OAUTH_PROVIDER_ENABLED=false +``` + +With it off, the discovery document at `/.well-known/oauth-authorization-server` +returns 404 and the CLI falls back to the pairing-code handoff on its own. + +Access tokens are opaque and last an hour; refresh tokens rotate on every use +and expire after thirty days. Nothing is cached, so revoking a grant under +**Settings → Authorized apps** stops the app on its very next request. + +### Registering an app + +Dynamic client registration is switched off, so clients are created by an +operator. The Sim CLI is seeded by the migration; register anything else with: + +```bash +DATABASE_URL=… \ +BETTER_AUTH_SECRET=… \ +OAUTH_CLIENT_ID=my-app \ +OAUTH_CLIENT_NAME="My App" \ +OAUTH_REDIRECT_URIS=https://my-app.example/callback \ +bun run apps/sim/scripts/create-oauth-client.ts +``` + +Add `OAUTH_CLIENT_PUBLIC=true` for a native or CLI app that cannot keep a +secret; it then authenticates with PKCE alone. A confidential client's secret is +printed once and cannot be read back. + +Redirect URIs must be `https`, or `http` on a loopback address, and are matched +exactly — except a loopback URI, where any port matches, because a native app +cannot know its port in advance. + ## Controlling who can sign up | Variable | Effect | diff --git a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx index 53a241d7d41..189c5a18bba 100644 --- a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx +++ b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx @@ -123,6 +123,12 @@ import { Callout } from 'fumadocs-ui/components/callout' Google, GitHub, and Microsoft sign-in, their callback URLs, and the `DISABLE_*_AUTH` switches are documented in [Authentication](/platform/self-hosting/authentication#social-login). +## Sign in with Sim + +| Variable | Description | +| --- | --- | +| `OAUTH_PROVIDER_ENABLED` | Set to `false` to switch off Sim's own OAuth 2.1 provider. On by default. With it off, the CLI signs in through the pairing-code handoff instead. See [Authentication](/platform/self-hosting/authentication#sign-in-with-sim) | + ## Integration Credentials diff --git a/apps/docs/openapi-v2-billing.json b/apps/docs/openapi-v2-billing.json index 024a60372e0..0aa63b3a5ec 100644 --- a/apps/docs/openapi-v2-billing.json +++ b/apps/docs/openapi-v2-billing.json @@ -453,7 +453,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-files-audit.json b/apps/docs/openapi-v2-files-audit.json index 2ae1f1de435..7559fa7b1f4 100644 --- a/apps/docs/openapi-v2-files-audit.json +++ b/apps/docs/openapi-v2-files-audit.json @@ -3097,7 +3097,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-knowledge.json b/apps/docs/openapi-v2-knowledge.json index 999ba3d8732..b5d081cdd0f 100644 --- a/apps/docs/openapi-v2-knowledge.json +++ b/apps/docs/openapi-v2-knowledge.json @@ -4499,7 +4499,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-logs.json b/apps/docs/openapi-v2-logs.json index 2b65611a2fb..03444b9db02 100644 --- a/apps/docs/openapi-v2-logs.json +++ b/apps/docs/openapi-v2-logs.json @@ -787,7 +787,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-resources.json b/apps/docs/openapi-v2-resources.json index d6556294305..1a3b5b62d13 100644 --- a/apps/docs/openapi-v2-resources.json +++ b/apps/docs/openapi-v2-resources.json @@ -4890,7 +4890,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." } }, "required": ["code", "message"], @@ -8290,8 +8290,8 @@ }, "keyType": { "type": "string", - "enum": ["personal", "workspace"], - "description": "Whether the calling key carries the full authority of its owner across their workspaces, or is scoped to one workspace." + "enum": ["personal", "workspace", "oauth_access_token"], + "description": "Whether the calling credential is a personal API key carrying the full authority of its owner across their workspaces, a key scoped to one workspace, or an OAuth access token acting for its user within the scopes it was granted." }, "expiresAt": { "anyOf": [ diff --git a/apps/docs/openapi-v2-tables.json b/apps/docs/openapi-v2-tables.json index bb44fceaef5..e9d62ccf32c 100644 --- a/apps/docs/openapi-v2-tables.json +++ b/apps/docs/openapi-v2-tables.json @@ -4897,7 +4897,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-workflows.json b/apps/docs/openapi-v2-workflows.json index fa265533ea7..14b85f95970 100644 --- a/apps/docs/openapi-v2-workflows.json +++ b/apps/docs/openapi-v2-workflows.json @@ -3908,7 +3908,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." } }, "required": ["code", "message"], diff --git a/apps/sim/app/(auth)/oauth/consent/consent-view.tsx b/apps/sim/app/(auth)/oauth/consent/consent-view.tsx new file mode 100644 index 00000000000..ee014f94861 --- /dev/null +++ b/apps/sim/app/(auth)/oauth/consent/consent-view.tsx @@ -0,0 +1,184 @@ +'use client' + +import { Chip, cn } from '@sim/emcn' +import { Check } from '@sim/emcn/icons' +import { getErrorMessage } from '@sim/utils/errors' +import { signOut } from '@/lib/auth/auth-client' +import { + OAUTH_SCOPE_DESCRIPTIONS, + SIM_CLI_CLIENT_ID, + visibleOAuthScopes, +} from '@/lib/auth/oauth-provider' +import { + AuthFormMessage, + AuthHeader, + AuthSubmitButton, + AuthTextLink, +} from '@/app/(auth)/components' +import { AUTH_BUTTON_CLASS } from '@/app/(auth)/components/constants' +import { OAuthConsentLoading } from '@/app/(auth)/oauth/consent/loading' +import { useOAuthConsent, useOAuthPublicClient } from '@/hooks/queries/oauth-provider' + +/** Why the page refuses to render a grant, when it does. */ +export type OAuthConsentRefusal = 'missing' | 'tampered' | 'unsigned' + +const REFUSAL_MESSAGES: Record = { + missing: 'The authorization request is missing its client identifier.', + tampered: 'This authorization request was altered on its way here.', + unsigned: 'This authorization request did not come from Sim.', +} + +interface OAuthConsentViewProps { + /** Set when the page already knows the request is not a real one. */ + refusal: OAuthConsentRefusal | null + clientId: string | null + scope: string | null + /** Where the code will be sent, shown so a lookalike app is visible as one. */ + redirectUri: string | null + /** The signed-in account the grant will belong to. */ + email: string +} + +/** + * The host the authorization code will be delivered to, or `null` when the + * request names none this page can read. + * + * A registered `client_name` is whatever the client called itself, so for a + * public client the destination is the one part of the request an impostor + * cannot borrow. A loopback address is named plainly rather than shown as an + * IP, because "this computer" is what it means to the person reading it. + */ +function describeDestination(redirectUri: string | null): string | null { + if (!redirectUri) return null + try { + const { hostname } = new URL(redirectUri) + return hostname === '127.0.0.1' || hostname === '[::1]' || hostname === '::1' + ? 'this computer' + : hostname + } catch { + return null + } +} + +/** + * The consent card: which app is asking, what it will be able to do, and as + * whom. Every decision here is a real grant, so the copy names the app and the + * account rather than a generic "an application" — the page is the only place + * a relayed or phished authorization can be caught, which is also why the + * first-party CLI never skips it. + */ +export function OAuthConsentView({ + refusal, + clientId, + scope, + redirectUri, + email, +}: OAuthConsentViewProps) { + const client = useOAuthPublicClient(clientId ?? undefined) + const consent = useOAuthConsent() + + /** + * No grant card without a client the server itself named. + * + * A failed lookup used to fall through to the fallback name and leave Allow + * enabled, so an unknown or deleted client still rendered a complete, + * clickable authorization — with everything on it read from the URL rather + * than from Sim. Naming the app is this page's whole job, so not being able + * to name it is a refusal, not a degraded heading. + */ + const reason: OAuthConsentRefusal | null = refusal ?? (clientId ? null : 'missing') + if (reason || client.isError) { + return ( +
+ + + {reason + ? REFUSAL_MESSAGES[reason] + : getErrorMessage(client.error, 'Sim could not identify the app asking for access.')} + +
+ ) + } + + if (client.isPending) return + + const isCli = clientId === SIM_CLI_CLIENT_ID + /** + * The registered name the lookup returned, never the raw client id and never + * a name asserted by the URL: the id is what an impostor controls, so a + * client the server declines to name is one this card must not vouch for. + */ + const appName = client.data?.name ?? 'this app' + const scopes = visibleOAuthScopes((scope ?? '').split(' ').filter(Boolean)) + const destination = describeDestination(redirectUri) + + const decide = (accept: boolean) => { + consent.mutate(accept, { + onSuccess: (url) => { + window.location.assign(url) + }, + }) + } + + const switchAccount = async () => { + await signOut() + window.location.assign(`/oauth/sign-in${window.location.search}`) + } + + return ( +
+ +
+ {scopes.length > 0 && ( +
    + {scopes.map((item) => ( +
  • + + {OAUTH_SCOPE_DESCRIPTIONS[item]} +
  • + ))} +
+ )} +

+ {destination ? `Sends you back to ${destination}. ` : ''}Continuing as {email}.{' '} + + Not you? + +

+ decide(true)} + > + Allow + + decide(false)} + > + Deny + + {consent.isError && ( + + {getErrorMessage(consent.error, 'Something went wrong. Please try again.')} + + )} +
+
+ ) +} diff --git a/apps/sim/app/(auth)/oauth/consent/loading.tsx b/apps/sim/app/(auth)/oauth/consent/loading.tsx new file mode 100644 index 00000000000..daaaace11f2 --- /dev/null +++ b/apps/sim/app/(auth)/oauth/consent/loading.tsx @@ -0,0 +1,39 @@ +import { Skeleton } from '@sim/emcn' +import { AuthShell } from '@/app/(auth)/components' + +/** + * Consent-card skeleton, shared by the route fallback and the card itself + * while it resolves the client's registered name. + * + * Bars mirror the card so nothing shifts when it arrives: a one-line heading, + * a description that wraps to two in the 400px column, the scope panel at its + * tallest real height, then the two `h-9` actions with the `space-y-4` gap the + * card renders. + * + * Sized for the Sim CLI, which is the client nearly every visitor arrives + * from: it asks for `offline_access api:read api:write`, and + * `visibleOAuthScopes` folds `api:read` into `api:write`, so two rows render. + * `py-3` (24) + two 20px rows + one 8px gap + 2px of border. A third-party + * client asking for more shifts the card down a little when it resolves. + */ +export function OAuthConsentLoading() { + return ( +
+ + + + + + + +
+ ) +} + +export default function OAuthConsentRouteLoading() { + return ( + + + + ) +} diff --git a/apps/sim/app/(auth)/oauth/consent/page.tsx b/apps/sim/app/(auth)/oauth/consent/page.tsx new file mode 100644 index 00000000000..3c4069dddf0 --- /dev/null +++ b/apps/sim/app/(auth)/oauth/consent/page.tsx @@ -0,0 +1,76 @@ +import type { Metadata } from 'next' +import { redirect } from 'next/navigation' +import type { SearchParams } from 'nuqs/server' +import { getSession } from '@/lib/auth' +import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' +import { AuthShell } from '@/app/(auth)/components' +import { OAuthConsentView } from '@/app/(auth)/oauth/consent/consent-view' +import { oauthConsentSearchParamsCache } from '@/app/(auth)/oauth/consent/search-params' + +export const metadata: Metadata = { + title: 'Authorize app', + robots: { index: false, follow: false }, +} + +export const dynamic = 'force-dynamic' + +/** + * The OAuth provider's `consentPage`. The plugin sends a signed-in user here with + * the signed authorization query; the view shows who is asking and for what, and + * the consent call carries that same query back so the plugin can mint a code + * for exactly the request the user saw. + * + * A signed-out visitor (a stale tab, a shared link) goes through the same + * bounce the plugin uses for its `loginPage`, which re-enters authorize after + * sign-in and lands back here with a fresh signature. + */ +export default async function OAuthConsentPage({ + searchParams, +}: { + searchParams: Promise +}) { + if (!isOAuthProviderEnabled) redirect('/') + + const [session, raw] = await Promise.all([getSession(), searchParams]) + + if (!session?.user) { + const query = new URLSearchParams() + for (const [key, value] of Object.entries(raw)) { + if (typeof value === 'string') query.set(key, value) + } + redirect(`/oauth/sign-in?${query.toString()}`) + } + + /** + * Two ways a request can reach this page without Sim having authorized it, + * both of which must refuse before anything is rendered. + * + * A repeated parameter is tampering, not a client quirk: the card names the + * app and lists what it may do, and it reads those from the URL, where + * `URLSearchParams.get` answers with the FIRST occurrence — so a link that + * prepends its own `client_id` and `scope` would show a trustworthy app and + * one harmless permission over somebody else's request. + * + * A missing `sig` means the query was never signed by the authorize + * endpoint, so the whole thing is hand-written. Consent still fails at Allow + * (the plugin refuses an unsigned `oauth_query`), but it fails with a + * generic error, after the person has already read an authorization request + * that Sim never issued. Both are caught here so the lie is never rendered. + */ + const tampered = Object.values(raw).some((value) => Array.isArray(value)) + const unsigned = typeof raw.sig !== 'string' + const refusal = tampered ? 'tampered' : unsigned ? 'unsigned' : null + const params = refusal ? null : oauthConsentSearchParamsCache.parse(raw) + + return ( + + + + ) +} diff --git a/apps/sim/app/(auth)/oauth/consent/search-params.ts b/apps/sim/app/(auth)/oauth/consent/search-params.ts new file mode 100644 index 00000000000..b250d5e6a69 --- /dev/null +++ b/apps/sim/app/(auth)/oauth/consent/search-params.ts @@ -0,0 +1,21 @@ +import { createSearchParamsCache, parseAsString } from 'nuqs/server' + +/** + * The authorize parameters the consent card renders. The rest of the signed + * query (`state`, `sig`, `exp`, …) stays untouched in `window.location.search`, + * which is what the auth client forwards verbatim on the consent call. + * + * Read-only for the life of the page, so there is no `urlKeys` companion and + * no client-side `useQueryStates` — the server component reads them and passes + * them down as props. + * + * Deliberately nullable rather than `.withDefault('')`: a missing `client_id` + * is a malformed request the card must refuse, not a value to fall back on. + */ +const oauthConsentParsers = { + client_id: parseAsString, + scope: parseAsString, + redirect_uri: parseAsString, +} as const + +export const oauthConsentSearchParamsCache = createSearchParamsCache(oauthConsentParsers) diff --git a/apps/sim/app/(auth)/oauth/sign-in/route.ts b/apps/sim/app/(auth)/oauth/sign-in/route.ts new file mode 100644 index 00000000000..a5b0a9193f0 --- /dev/null +++ b/apps/sim/app/(auth)/oauth/sign-in/route.ts @@ -0,0 +1,47 @@ +import { type NextRequest, NextResponse } from 'next/server' +import { isOAuthProviderEnabled, isRegistrationDisabled } from '@/lib/core/config/env-flags' +import { withRouteHandler } from '@/lib/core/utils/with-route-handler' +import { buildAuthCrossLink } from '@/app/(auth)/auth-redirect' + +/** + * Query parameters the OAuth plugin adds when it signs the authorize query for + * a `loginPage` redirect. Re-entering authorize starts a fresh request, which + * signs its own, so carrying the old ones forward would only widen the URL. + */ +const SIGNED_QUERY_PARAMS = new Set(['sig', 'exp', 'ba_iat', 'ba_param', 'ba_pl']) + +/** + * The OAuth provider's `loginPage`: where a signed-out user lands when a client + * starts `/api/auth/oauth2/authorize`. + * + * The plugin forwards the whole authorize query, signed. The authorize endpoint + * is stateless, so the flow resumes by simply visiting it again once a session + * exists. This route rebuilds that URL from the original parameters and hands + * it to the normal auth pages as `callbackUrl`, which is how every other + * post-login destination in Sim travels — no second login form, no plugin + * client hooks to keep in step. + * + * Signup rather than login by default, for the same reason the CLI handoff + * chooses it: this is reached from a terminal, often on a fresh install. Under + * DISABLE_REGISTRATION nobody can create an account, so login is the only hop + * that can succeed. + */ +export const GET = withRouteHandler(async (request: NextRequest) => { + // Gated like the consent page: with the provider off, the authorize URL this + // builds is a JSON 404, so bouncing someone through signup to reach it would + // land them on a raw error body having just created an account. + if (!isOAuthProviderEnabled) { + return NextResponse.redirect(new URL('/', request.nextUrl.origin), 302) + } + + const params = new URLSearchParams(request.nextUrl.search) + for (const name of SIGNED_QUERY_PARAMS) params.delete(name) + + const authorizeUrl = `/api/auth/oauth2/authorize?${params.toString()}` + const destination = buildAuthCrossLink(isRegistrationDisabled ? '/login' : '/signup', { + callbackUrl: authorizeUrl, + isInviteFlow: false, + }) + + return NextResponse.redirect(new URL(destination, request.nextUrl.origin), 302) +}) diff --git a/apps/sim/app/.well-known/oauth-authorization-server/route.ts b/apps/sim/app/.well-known/oauth-authorization-server/route.ts new file mode 100644 index 00000000000..9b1f0917343 --- /dev/null +++ b/apps/sim/app/.well-known/oauth-authorization-server/route.ts @@ -0,0 +1,38 @@ +import { NextResponse } from 'next/server' +import { auth } from '@/lib/auth' +import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' +import { withRouteHandler } from '@/lib/core/utils/with-route-handler' + +/** + * RFC 8414 authorization-server metadata at the origin root. The plugin serves + * the same document under `/api/auth/.well-known/`; this route exists so a + * client that only knows Sim's origin can discover the endpoints, and so the + * Sim CLI can probe one URL to learn whether the provider is on before + * choosing a login flow. Deliberately 404 rather than an empty document when + * it is off: "no authorization server here" is the answer. + * + * Note the issuer this document names is `/api/auth`, which is where + * Better Auth mounts the provider — so a client following RFC 8414 §3.1 to the + * letter would look under `/.well-known/oauth-authorization-server/api/auth`. + * This copy is the probe; that path is served by the plugin. + */ +/** Metadata changes only on deploy, and a client re-reads it per connection. */ +const DISCOVERY_CACHE_SECONDS = 300 + +/** + * Readable from any origin, like every other authorization-server metadata + * document. It is served from the origin root rather than under `/api/`, which + * is the only path the proxy's CORS layer covers, so the header is set here. + */ +const DISCOVERY_HEADERS = { + 'Cache-Control': `public, max-age=${DISCOVERY_CACHE_SECONDS}`, + 'Access-Control-Allow-Origin': '*', +} as const + +export const GET = withRouteHandler(async () => { + if (!isOAuthProviderEnabled) { + return NextResponse.json({ error: 'OAuth provider is not enabled' }, { status: 404 }) + } + const metadata = await auth.api.getOAuthServerConfig() + return NextResponse.json(metadata, { headers: DISCOVERY_HEADERS }) +}) diff --git a/apps/sim/app/account/settings/[section]/page.tsx b/apps/sim/app/account/settings/[section]/page.tsx index 424a05612cd..b436d948973 100644 --- a/apps/sim/app/account/settings/[section]/page.tsx +++ b/apps/sim/app/account/settings/[section]/page.tsx @@ -12,7 +12,7 @@ import { } from '@/components/settings/navigation' import { prefetchStandaloneGeneral } from '@/components/settings/prefetch-standalone-general' import { getSession } from '@/lib/auth' -import { isBillingEnabled } from '@/lib/core/config/env-flags' +import { isBillingEnabled, isOAuthProviderEnabled } from '@/lib/core/config/env-flags' import { isPlatformAdmin } from '@/lib/permissions/super-user' import { getQueryClient } from '@/app/_shell/providers/get-query-client' @@ -49,6 +49,9 @@ export default async function AccountSettingsSectionPage({ }) if (!parsed) notFound() if (parsed === 'billing' && !isBillingEnabled) redirect(getAccountSettingsHref('general')) + if (parsed === 'authorized-apps' && !isOAuthProviderEnabled) { + redirect(getAccountSettingsHref('general')) + } if (parsed === 'admin' || parsed === 'mothership') { const isSuperUser = await isPlatformAdmin(session.user.id) if (!isSuperUser) notFound() diff --git a/apps/sim/app/api/auth/[...all]/route.test.ts b/apps/sim/app/api/auth/[...all]/route.test.ts index e173e2ffee0..0a80c1c1440 100644 --- a/apps/sim/app/api/auth/[...all]/route.test.ts +++ b/apps/sim/app/api/auth/[...all]/route.test.ts @@ -297,3 +297,47 @@ describe('auth catch-all route SSO provider mutations', () => { expect(await res.json()).toEqual({ data: { url: 'https://idp.example.com' } }) }) }) + +describe('OAuth provider client endpoints', () => { + beforeEach(() => { + vi.clearAllMocks() + handlerMocks.betterAuthPOST.mockResolvedValue( + new Response(JSON.stringify({ ok: true }), { status: 200 }) + ) + }) + + /** + * The plugin gates client creation on a session alone, so without this any + * signed-in user could register a client with arbitrary redirect URIs and + * the full scope set. Nothing must reach the plugin. + */ + it.each([ + 'oauth2/create-client', + 'oauth2/update-client', + 'oauth2/delete-client', + 'oauth2/client/rotate-secret', + 'oauth2/register', + 'oauth2/anything-a-future-version-adds', + ])('refuses POST /%s without reaching Better Auth', async (path) => { + const req = createMockRequest('POST', {}, {}, `http://localhost:3000/api/auth/${path}`) + + const res = await POST(req) + + expect(res.status).toBe(404) + expect(handlerMocks.betterAuthPOST).not.toHaveBeenCalled() + }) + + it.each([ + 'oauth2/token', + 'oauth2/consent', + 'oauth2/revoke', + 'oauth2/userinfo', + 'oauth2/callback/jira', + ])('lets the protocol endpoint %s through', async (path) => { + const req = createMockRequest('POST', {}, {}, `http://localhost:3000/api/auth/${path}`) + + await POST(req) + + expect(handlerMocks.betterAuthPOST).toHaveBeenCalledTimes(1) + }) +}) diff --git a/apps/sim/app/api/auth/[...all]/route.ts b/apps/sim/app/api/auth/[...all]/route.ts index 03c3a1514ad..18819c8a8e5 100644 --- a/apps/sim/app/api/auth/[...all]/route.ts +++ b/apps/sim/app/api/auth/[...all]/route.ts @@ -25,6 +25,20 @@ const OAUTH_CALLBACK_PATH_PREFIX = 'oauth2/callback/' */ const SAML_PROTOCOL_POST_PREFIX = 'sso/saml2/' +/** + * The OAuth provider POST endpoints a client legitimately calls: the protocol + * itself, plus the consent decision the consent page submits. + */ +const OAUTH_PROVIDER_PROTOCOL_POST_PATHS = new Set([ + 'oauth2/token', + 'oauth2/consent', + 'oauth2/continue', + 'oauth2/revoke', + 'oauth2/introspect', + 'oauth2/userinfo', + 'oauth2/public-client-prelogin', +]) + function getAuthPath(request: NextRequest): string { const pathname = request.nextUrl?.pathname ?? new URL(request.url).pathname return pathname.replace('/api/auth/', '') @@ -71,6 +85,28 @@ function isBlockedSsoMutationPath(path: string): boolean { return path.startsWith('sso/') && !path.startsWith(SAML_PROTOCOL_POST_PREFIX) } +/** + * Client registration and client/consent mutation are not Sim's OAuth surface. + * + * `allowDynamicClientRegistration: false` gates only `/oauth2/register`; the + * plugin's `/oauth2/create-client`, `/update-client`, `/delete-client`, + * `/client/rotate-secret` and `/update-consent` are separate endpoints whose + * only guard is a session, so without this any signed-in user could register a + * client with arbitrary redirect URIs and the full scope set, then phish a + * token out of somebody else — or widen their own grant past what they + * consented to. Clients are operator-created rows (see + * `apps/sim/scripts/create-oauth-client.ts`), and a consent is changed by + * granting or revoking it, never by editing the row. + * + * Deny-by-default, like the SSO block above, so a future plugin version cannot + * introduce another unshadowed mutation endpoint. `oauth2/callback/` is the + * generic-OAuth *client* callback and belongs to connector linking, not here. + */ +function isBlockedOAuthProviderMutationPath(path: string): boolean { + if (!path.startsWith('oauth2/') || path.startsWith('oauth2/callback/')) return false + return !OAUTH_PROVIDER_PROTOCOL_POST_PATHS.has(path) +} + export const GET = withRouteHandler(async (request: NextRequest) => { const path = getAuthPath(request) const credentialGroupProviderId = getCredentialGroupCallbackProviderId(request, path) @@ -126,5 +162,12 @@ export const POST = withRouteHandler(async (request: NextRequest) => { ) } + if (isBlockedOAuthProviderMutationPath(path)) { + return NextResponse.json( + { error: 'OAuth client registration is not available.' }, + { status: 404 } + ) + } + return betterAuthPOST(request) }) diff --git a/apps/sim/app/api/auth/oauth2/authorize/route.ts b/apps/sim/app/api/auth/oauth2/authorize/route.ts index e15d0ad6074..a732cfc2754 100644 --- a/apps/sim/app/api/auth/oauth2/authorize/route.ts +++ b/apps/sim/app/api/auth/oauth2/authorize/route.ts @@ -1,10 +1,12 @@ import { createLogger } from '@sim/logger' +import { toNextJsHandler } from 'better-auth/next-js' import { type NextRequest, NextResponse } from 'next/server' import { authorizeOAuth2Contract } from '@/lib/api/contracts/oauth-connections' import { parseRequest } from '@/lib/api/server' import { auth, getSession } from '@/lib/auth/auth' import { ForbiddenOperationError } from '@/lib/core/application/forbidden' import { requireConfiguredOAuthClient } from '@/lib/core/config/env-capabilities.server' +import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' import { OrchestrationError } from '@/lib/core/orchestration/types' import { getBaseUrl } from '@/lib/core/utils/urls' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' @@ -18,10 +20,37 @@ const logger = createLogger('OAuth2Authorize') export const dynamic = 'force-dynamic' +const { GET: betterAuthGET } = toNextJsHandler(auth.handler) + +/** + * Whether this is a client asking Sim to sign its user in — the OAuth provider's + * authorize request — rather than a user linking an external account. + * + * This route sits on the same path Better Auth mounts the provider's authorize + * endpoint, so the catch-all never sees it. The two requests cannot be + * confused: a provider request names a `client_id`, while a connector link + * names either a `providerId` or a `draftId` — the draft leg resolves its + * provider server-side and so carries no `providerId`, which is why both are + * checked — and never a `client_id`. Whether the id is registered is not + * decided here; an unknown one is the plugin's error to return. + */ +function isOAuthProviderAuthorize(request: NextRequest): boolean { + const query = request.nextUrl.searchParams + return query.has('client_id') && !query.has('providerId') && !query.has('draftId') +} + /** - * Browser-initiated entrypoint for linking a generic OAuth2 account. + * Browser-initiated entrypoint for linking a generic OAuth2 account, and the + * OAuth provider's authorize endpoint when the request is a client's. */ export const GET = withRouteHandler(async (request: NextRequest) => { + if (isOAuthProviderAuthorize(request)) { + if (!isOAuthProviderEnabled) { + return NextResponse.json({ error: 'OAuth provider is not enabled' }, { status: 404 }) + } + return betterAuthGET(request) + } + const baseUrl = getBaseUrl() const session = await getSession() diff --git a/apps/sim/app/api/cron/cleanup-oauth-tokens/route.ts b/apps/sim/app/api/cron/cleanup-oauth-tokens/route.ts new file mode 100644 index 00000000000..4f718243ff9 --- /dev/null +++ b/apps/sim/app/api/cron/cleanup-oauth-tokens/route.ts @@ -0,0 +1,36 @@ +import { createLogger } from '@sim/logger' +import { getErrorMessage } from '@sim/utils/errors' +import { type NextRequest, NextResponse } from 'next/server' +import { verifyCronAuth } from '@/lib/auth/internal' +import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' +import { withRouteHandler } from '@/lib/core/utils/with-route-handler' +import { runCleanupOAuthTokens } from '@/background/cleanup-oauth-tokens' + +export const dynamic = 'force-dynamic' + +const logger = createLogger('CleanupOAuthTokensAPI') + +/** + * Retention sweep for lapsed OAuth token rows. A deployment with the provider + * switched off issues none, so the sweep answers immediately rather than + * scanning two empty tables on a schedule. + */ +export const GET = withRouteHandler(async (request: NextRequest) => { + const authError = verifyCronAuth(request, 'OAuth token cleanup') + if (authError) return authError + + if (!isOAuthProviderEnabled) { + return NextResponse.json({ success: true, refreshTokens: 0, accessTokens: 0 }) + } + + try { + const result = await runCleanupOAuthTokens() + return NextResponse.json({ success: true, ...result }) + } catch (error) { + logger.error('Failed to sweep expired OAuth tokens', { error }) + return NextResponse.json( + { error: getErrorMessage(error, 'Failed to sweep expired OAuth tokens') }, + { status: 500 } + ) + } +}) diff --git a/apps/sim/app/api/files/uploads/purposes.ts b/apps/sim/app/api/files/uploads/purposes.ts index 38982824cf7..4616418550a 100644 --- a/apps/sim/app/api/files/uploads/purposes.ts +++ b/apps/sim/app/api/files/uploads/purposes.ts @@ -237,6 +237,7 @@ async function principalUserId(principal: Principal, workspaceId?: string): Prom switch (principal.kind) { case 'session': case 'personal_api_key': + case 'oauth_access_token': return principal.userId case 'workspace_api_key': if (!workspaceId || principal.workspaceId !== workspaceId) { diff --git a/apps/sim/app/api/users/me/authorized-apps/[clientId]/route.ts b/apps/sim/app/api/users/me/authorized-apps/[clientId]/route.ts new file mode 100644 index 00000000000..7f7752b05cb --- /dev/null +++ b/apps/sim/app/api/users/me/authorized-apps/[clientId]/route.ts @@ -0,0 +1,24 @@ +import { revokeAuthorizedAppContract } from '@/lib/api/contracts' +import { + defineInternalJsonRoute, + internalOrchestrationErrorPolicy, + internalRateLimits, + internalSessionAuth, +} from '@/lib/api/server/routes' +import { revokeAuthorizedAppUseCase } from '@/lib/users/application/authorized-apps' +import { userAccountOperations } from '@/lib/users/application/operations' + +export const dynamic = 'force-dynamic' + +export const DELETE = defineInternalJsonRoute({ + contract: revokeAuthorizedAppContract, + auth: internalSessionAuth, + operation: userAccountOperations.revokeAuthorizedApp, + rateLimit: internalRateLimits.none({ + reason: 'Authenticated current-user settings mutation', + }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: ({ params }) => ({ clientId: params.clientId }), + useCase: revokeAuthorizedAppUseCase, + present: () => ({ success: true as const }), +}) diff --git a/apps/sim/app/api/users/me/authorized-apps/route.ts b/apps/sim/app/api/users/me/authorized-apps/route.ts new file mode 100644 index 00000000000..6feffd04c23 --- /dev/null +++ b/apps/sim/app/api/users/me/authorized-apps/route.ts @@ -0,0 +1,24 @@ +import { listAuthorizedAppsContract } from '@/lib/api/contracts' +import { + defineInternalJsonRoute, + internalOrchestrationErrorPolicy, + internalRateLimits, + internalSessionAuth, +} from '@/lib/api/server/routes' +import { listAuthorizedAppsUseCase } from '@/lib/users/application/authorized-apps' +import { userAccountOperations } from '@/lib/users/application/operations' + +export const dynamic = 'force-dynamic' + +export const GET = defineInternalJsonRoute({ + contract: listAuthorizedAppsContract, + auth: internalSessionAuth, + operation: userAccountOperations.readAuthorizedApps, + rateLimit: internalRateLimits.none({ + reason: 'Authenticated current-user settings read', + }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: () => ({}), + useCase: listAuthorizedAppsUseCase, + present: (apps) => ({ apps }), +}) diff --git a/apps/sim/app/api/v1/knowledge/utils.ts b/apps/sim/app/api/v1/knowledge/utils.ts index 95655cbe756..8d721d0ec4a 100644 --- a/apps/sim/app/api/v1/knowledge/utils.ts +++ b/apps/sim/app/api/v1/knowledge/utils.ts @@ -58,7 +58,7 @@ export async function resolveKnowledgeBase( */ export async function resolveV1KnowledgeAccessScope( userId: string, - rateLimit: { keyType?: 'personal' | 'workspace' }, + rateLimit: { keyType?: 'personal' | 'workspace' | 'oauth_access_token' }, workspaceId: string | undefined ): Promise { if (rateLimit.keyType === 'workspace') return WORKSPACE_ACCESS_SCOPE diff --git a/apps/sim/app/api/v1/middleware.ts b/apps/sim/app/api/v1/middleware.ts index dbde4f2837a..d390a2403f9 100644 --- a/apps/sim/app/api/v1/middleware.ts +++ b/apps/sim/app/api/v1/middleware.ts @@ -73,7 +73,12 @@ export interface RateLimitResult { retryAfterMs?: number userId?: string workspaceId?: string - keyType?: 'personal' | 'workspace' + /** + * `oauth_access_token` never arises on v1, which authenticates API keys only; + * it is here because the v2 builders record their rate-limit snapshot in this + * shape. + */ + keyType?: 'personal' | 'workspace' | 'oauth_access_token' principal?: PersonalApiKeyPrincipal | WorkspaceApiKeyPrincipal error?: string } diff --git a/apps/sim/app/api/v2/chat/route.ts b/apps/sim/app/api/v2/chat/route.ts index 17932605f92..d91d1f00ee5 100644 --- a/apps/sim/app/api/v2/chat/route.ts +++ b/apps/sim/app/api/v2/chat/route.ts @@ -1,3 +1,8 @@ +import { + isUserCredentialPrincipal, + type OAuthAccessTokenPrincipal, + type PersonalApiKeyPrincipal, +} from '@sim/auth/principal' import { createLogger } from '@sim/logger' import { getErrorMessage, toError } from '@sim/utils/errors' import { generateId } from '@sim/utils/id' @@ -39,7 +44,7 @@ import { normalizeSecretMountPolicy } from '@/lib/copilot/secret-mount-policy' import { forbiddenErrorDetails, PersonalApiKeysDisabledError, - requirePersonalApiKeysAllowed, + requireUserCredentialCapabilities, type WorkspaceAuthorizationContext, } from '@/lib/core/application' import { isDocSandboxEnabled } from '@/lib/core/config/env-flags' @@ -96,8 +101,8 @@ function deriveConversationTitle(message: string): string | undefined { * renders its own v2 envelope, and the detail code is read off the error so the * column refusal and the group refusal answer with one code. */ -async function personalApiKeyPolicyRefusal( - userId: string, +async function userCredentialPolicyRefusal( + principal: PersonalApiKeyPrincipal | OAuthAccessTokenPrincipal, context: WorkspaceAuthorizationContext ): Promise { const refuse = (error: PersonalApiKeysDisabledError) => @@ -106,7 +111,7 @@ async function personalApiKeyPolicyRefusal( if (!context.allowPersonalApiKeys) return refuse(new PersonalApiKeysDisabledError()) try { - await requirePersonalApiKeysAllowed(userId, context) + await requireUserCredentialCapabilities(principal, context) } catch (error) { if (error instanceof PersonalApiKeysDisabledError) return refuse(error) throw error @@ -185,8 +190,8 @@ export const POST = withRouteHandler( if (!admission.success) return admission.response const { principal } = admission.auth - if (principal.kind !== 'personal_api_key') { - return v2Error('FORBIDDEN', 'Chat requires a personal API key', { + if (!isUserCredentialPrincipal(principal)) { + return v2Error('FORBIDDEN', 'Chat requires a personal API key or an OAuth access token', { details: { code: 'PRINCIPAL_KIND_NOT_PERMITTED' }, }) } @@ -214,7 +219,8 @@ export const POST = withRouteHandler( * Both halves, because they combine with AND: the workspace column is the * coarse switch every workspace has, and the group key narrows it further * for one cohort inside an enterprise organization. Either one saying no - * is a no, and checking only `copilot.use` applied neither. + * is a no, and checking only `copilot.use` applied neither. A CLI token + * passes `cli.use` in the same call, for the same reason. * * Both run after workspace access rather than before it, unlike the * funnel, which can afford to check the column first because its caller @@ -222,12 +228,12 @@ export const POST = withRouteHandler( * it, and answering later only ever conceals more: a caller with no reach * into the workspace is refused without learning how it is configured. */ - const personalKeyRefusal = await personalApiKeyPolicyRefusal(userId, { + const credentialRefusal = await userCredentialPolicyRefusal(principal, { workspaceId, workspaceOrganizationId: workspaceAccess.workspace?.organizationId ?? null, allowPersonalApiKeys: workspaceAccess.workspace?.allowPersonalApiKeys ?? false, }) - if (personalKeyRefusal) return personalKeyRefusal + if (credentialRefusal) return credentialRefusal /** * permission-group-enforced: copilot.use — read off the operation so this diff --git a/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/[documentId]/route.ts b/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/[documentId]/route.ts index 1a9b32f4d7b..b798b626073 100644 --- a/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/[documentId]/route.ts +++ b/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/[documentId]/route.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { V2_WRITABLE_TAG_SLOTS, type V2UpdateKnowledgeDocumentBody, @@ -136,7 +137,7 @@ export const DELETE = defineV2JsonRoute({ }), useCase: deleteKnowledgeDocument, onSuccess: ({ principal, input }) => { - if (principal.kind === 'personal_api_key') { + if (isUserCredentialPrincipal(principal)) { captureServerEvent( principal.userId, 'knowledge_base_document_deleted', diff --git a/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/route.ts b/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/route.ts index 70d57103e8f..c2b141ef844 100644 --- a/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/route.ts +++ b/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/route.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { omit } from '@sim/utils/object' import { parseV2KnowledgeTagFiltersParam, @@ -243,7 +244,7 @@ export const POST = defineV2BodyLifecycleRoute({ mimeType: result.document.mimeType, fileSize: result.document.fileSize, }) - if (principal.kind === 'personal_api_key') { + if (isUserCredentialPrincipal(principal)) { captureServerEvent( principal.userId, 'knowledge_base_document_uploaded', diff --git a/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/uploads/[uploadId]/complete/route.ts b/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/uploads/[uploadId]/complete/route.ts index c95c245fcbf..65736ace100 100644 --- a/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/uploads/[uploadId]/complete/route.ts +++ b/apps/sim/app/api/v2/knowledge/[knowledgeBaseId]/documents/uploads/[uploadId]/complete/route.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { v2CompleteKnowledgeDocumentUploadContract } from '@/lib/api/contracts/v2/knowledge' import { defineV2JsonRoute, v2ApiKeyAuth, v2RateLimits } from '@/lib/api/server/routes' import { PlatformEvents } from '@/lib/core/telemetry' @@ -22,7 +23,7 @@ export const POST = defineV2JsonRoute({ }), useCase: completeKnowledgeDocumentUpload, onSuccess: ({ principal, result }) => { - if (result.value.created && principal.kind === 'personal_api_key') { + if (result.value.created && isUserCredentialPrincipal(principal)) { captureServerEvent( principal.userId, 'knowledge_base_document_uploaded', diff --git a/apps/sim/app/api/v2/knowledge/route.ts b/apps/sim/app/api/v2/knowledge/route.ts index bfa26e6ccdd..31fcbd08ccd 100644 --- a/apps/sim/app/api/v2/knowledge/route.ts +++ b/apps/sim/app/api/v2/knowledge/route.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { v2CreateKnowledgeBaseContract, v2ListKnowledgeBasesContract, @@ -105,7 +106,7 @@ export const POST = defineV2JsonRoute({ name: knowledgeBase.name, workspaceId: knowledgeBase.workspaceId ?? undefined, }) - if (principal.kind === 'personal_api_key') { + if (isUserCredentialPrincipal(principal)) { captureServerEvent( principal.userId, 'knowledge_base_created', diff --git a/apps/sim/app/api/v2/knowledge/search/route.ts b/apps/sim/app/api/v2/knowledge/search/route.ts index 4cb0bb11edb..999bb8c599e 100644 --- a/apps/sim/app/api/v2/knowledge/search/route.ts +++ b/apps/sim/app/api/v2/knowledge/search/route.ts @@ -14,6 +14,10 @@ export const V2_KNOWLEDGE_SEARCH_MAX_BODY_BYTES = 2 * 1024 * 1024 export const POST = defineV2JsonRoute({ contract: v2SearchKnowledgeContract, auth: v2ApiKeyAuth, + // A search whose filters do not fit a query string; it changes no resource. + // It does meter usage, which is a write to the usage log rather than to + // anything a read-only grant is protecting. + readOnly: true, operation: knowledgeOperations.search, rateLimit: v2RateLimits.publicApi, errorPolicy: v2KnowledgeErrorPolicies.concealKnowledgeBaseUsageAuthorization, diff --git a/apps/sim/app/api/v2/lib/response.test.ts b/apps/sim/app/api/v2/lib/response.test.ts index b45aa898340..9c363f972ab 100644 --- a/apps/sim/app/api/v2/lib/response.test.ts +++ b/apps/sim/app/api/v2/lib/response.test.ts @@ -2,8 +2,33 @@ * @vitest-environment node */ import { describe, expect, it } from 'vitest' +import { InsufficientScopeError } from '@/lib/core/application' import { HttpError } from '@/lib/core/utils/http-error' -import { v2Error, v2HttpError, v2RateLimitError } from '@/app/api/v2/lib/response' +import { + v2CaughtOrchestrationError, + v2Error, + v2HttpError, + v2RateLimitError, +} from '@/app/api/v2/lib/response' + +describe('v2 403 insufficient_scope challenge', () => { + /** + * RFC 6750 §3.1: a token that authenticated but lacks the scope gets a 403 + * whose challenge names the scope to ask for, alongside the closed detail + * code so a client can branch without parsing prose. + */ + it('names the missing scope in WWW-Authenticate and the detail code', async () => { + const response = v2CaughtOrchestrationError(new InsufficientScopeError('api:write')) + + expect(response?.status).toBe(403) + expect(response?.headers.get('WWW-Authenticate')).toBe( + 'Bearer realm="Sim API", error="insufficient_scope", scope="api:write"' + ) + await expect(response?.json()).resolves.toMatchObject({ + error: { code: 'FORBIDDEN', details: { code: 'INSUFFICIENT_SCOPE' } }, + }) + }) +}) describe('v2Error retry guidance', () => { it('sends Retry-After on 503 so a client does not retry a degraded dependency immediately', () => { @@ -62,7 +87,7 @@ describe('v2 401 authentication challenge', () => { * without a test noticing. The reachability tests below stay loose on purpose * — they pin that the header arrives down each path, not its value twice. */ - const EXPECTED_CHALLENGE = 'SimApiKey realm="Sim API", header="x-api-key"' + const EXPECTED_CHALLENGE = 'SimApiKey realm="Sim API", header="x-api-key", Bearer realm="Sim API"' const challenge = () => v2Error('UNAUTHORIZED', 'API key required').headers.get('WWW-Authenticate') @@ -74,6 +99,23 @@ describe('v2 401 authentication challenge', () => { expect(response.headers.get('WWW-Authenticate')).toBe(EXPECTED_CHALLENGE) }) + /** + * RFC 6750 §3.1: `error="invalid_token"` only when a bearer token was + * presented and refused. A caller that sent nothing is told what would work, + * and the scheme it tried leads the list. + */ + it('leads with an invalid_token bearer challenge when a bearer token was refused', () => { + const response = v2Error('UNAUTHORIZED', 'Invalid access token', { authChallenge: 'bearer' }) + + expect(response.headers.get('WWW-Authenticate')).toBe( + 'Bearer realm="Sim API", error="invalid_token", SimApiKey realm="Sim API", header="x-api-key"' + ) + }) + + it('never marks a bearer token invalid when none was presented', () => { + expect(challenge()).not.toContain('invalid_token') + }) + it('names the x-api-key header, the only channel v2 actually reads', () => { expect(challenge()).toContain('x-api-key') }) diff --git a/apps/sim/app/api/v2/lib/response.ts b/apps/sim/app/api/v2/lib/response.ts index b259db824e4..30eaa7bb044 100644 --- a/apps/sim/app/api/v2/lib/response.ts +++ b/apps/sim/app/api/v2/lib/response.ts @@ -9,7 +9,11 @@ import { REFILTERED_CURSOR_MESSAGE, UNREADABLE_CURSOR_MESSAGE } from '@/lib/api/ import { type CursorKey, INVALID_CURSOR_MESSAGE } from '@/lib/api/list-query' import { getValidationErrorMessage, serializeZodIssues } from '@/lib/api/server' import { ADMISSION_RETRY_AFTER_SECONDS } from '@/lib/core/admission/transient-failure' -import { forbiddenErrorDetails } from '@/lib/core/application' +import { + forbiddenErrorDetails, + InsufficientScopeError, + OAuthAccessTokenExpiredError, +} from '@/lib/core/application' import { asOrchestrationError, OrchestrationError, @@ -71,26 +75,54 @@ const RETRY_AFTER_SECONDS_BY_STATUS: Partial> = { } /** - * The challenge every v2 `401` carries, so a 401 is a complete one. - * - * RFC 9110 §11.6.1 makes `WWW-Authenticate` a MUST on 401 — a 401 without it is - * a refusal that never says what would have been accepted, and a generic HTTP - * client has nothing to react to. + * The API-key half of every v2 `401` challenge. * * The scheme name is deliberately Sim-specific rather than a registered one. - * v2 authenticates from the `x-api-key` header and accepts no `Authorization` - * scheme at all — `Authorization: Bearer ` is not a channel here — so - * `Bearer` and `Basic` would both be false advertising. `Basic` is worse than - * false: a browser reacts to it by opening a native credential prompt that - * cannot produce an API key. An unregistered scheme is what remains, and it is - * legal: §11.6.1's grammar requires *an* `auth-scheme` token, not a registered - * one. Every challenge implies "retry via `Authorization: …`" by - * construction, so the token is chosen to be one no client has a built-in - * handler for — the challenge surfaces to a human instead of triggering an - * automatic retry down a channel v2 does not read — and the real channel is - * named outright in the `header` parameter beside it. + * An API key travels in `x-api-key`, not in `Authorization`, so `Basic` would + * be false advertising — and worse than false: a browser reacts to it by + * opening a native credential prompt that cannot produce an API key. An + * unregistered scheme is legal (RFC 9110 §11.6.1's grammar requires *an* + * `auth-scheme` token, not a registered one) and is chosen so no client has a + * built-in handler for it: the challenge surfaces to a human, and the real + * channel is named outright in the `header` parameter beside it. + */ +const V2_API_KEY_CHALLENGE = 'SimApiKey realm="Sim API", header="x-api-key"' + +/** + * The `WWW-Authenticate` value for a v2 `401`, so a 401 is a complete one. + * + * RFC 9110 §11.6.1 makes the header a MUST on 401 — a 401 without it is a + * refusal that never says what would have been accepted. v2 reads two + * credentials, so the header lists two challenges (§11.6.1 allows a list): + * `Bearer`, which is a registered scheme because Sim's OAuth access tokens + * really do travel as `Authorization: Bearer`, and the API-key scheme above. + * + * The one the caller tried leads, and only a bearer that was presented and + * refused carries `error="invalid_token"` (RFC 6750 §3.1): a request that sent + * nothing is told what would work, not what was wrong with a token it never + * offered. */ -const V2_AUTH_CHALLENGE = 'SimApiKey realm="Sim API", header="x-api-key"' +function v2AuthChallenge(tried: 'api_key' | 'bearer' = 'api_key'): string { + const bearer = + tried === 'bearer' ? 'Bearer realm="Sim API", error="invalid_token"' : 'Bearer realm="Sim API"' + return tried === 'bearer' + ? `${bearer}, ${V2_API_KEY_CHALLENGE}` + : `${V2_API_KEY_CHALLENGE}, ${bearer}` +} + +/** + * The `403` for a bearer token that authenticated but was not granted the scope + * the request needs. The challenge names the scope to ask for (RFC 6750 §3.1) + * and the detail code lets a client branch without parsing prose. + */ +export function v2InsufficientScope(error: InsufficientScopeError): NextResponse { + return v2Error('FORBIDDEN', error.message, { + details: { code: error.detailCode }, + headers: { + 'WWW-Authenticate': `Bearer realm="Sim API", error="insufficient_scope", scope="${error.requiredScope}"`, + }, + }) +} type RateLimitHeaderSource = Pick @@ -142,6 +174,8 @@ interface V2ErrorOptions { status?: number details?: unknown headers?: Record + /** For a 401: which credential the caller presented, so its challenge leads. */ + authChallenge?: 'api_key' | 'bearer' /** * Suppresses the code's default `Retry-After` for a failure whose outcome is * *unknown* rather than *absent*. @@ -175,7 +209,7 @@ export function v2Error( status, headers: { ...PRIVATE_NO_STORE, - ...(status === 401 ? { 'WWW-Authenticate': V2_AUTH_CHALLENGE } : {}), + ...(status === 401 ? { 'WWW-Authenticate': v2AuthChallenge(options.authChallenge) } : {}), ...(retryAfterSeconds === undefined ? {} : { 'Retry-After': retryAfterSeconds.toString() }), ...options.headers, }, @@ -498,6 +532,10 @@ export function v2ErrorForOrchestration( export function v2CaughtOrchestrationError(error: unknown): NextResponse | null { const classified = asOrchestrationError(error) if (!classified) return null + if (classified instanceof InsufficientScopeError) return v2InsufficientScope(classified) + if (classified instanceof OAuthAccessTokenExpiredError) { + return v2Error('UNAUTHORIZED', classified.message, { authChallenge: 'bearer' }) + } return v2ErrorForOrchestration( classified.code, classified.message, diff --git a/apps/sim/app/api/v2/mcp-servers/[mcpServerId]/route.ts b/apps/sim/app/api/v2/mcp-servers/[mcpServerId]/route.ts index e2cb7d09c6f..d81ec057a3d 100644 --- a/apps/sim/app/api/v2/mcp-servers/[mcpServerId]/route.ts +++ b/apps/sim/app/api/v2/mcp-servers/[mcpServerId]/route.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { v2DeleteMcpServerContract, v2GetMcpServerContract, @@ -61,7 +62,7 @@ export const DELETE = defineV2JsonRoute({ }), useCase: deleteMcpServerUseCase, onSuccess: ({ principal, input, result }) => { - if (principal.kind !== 'personal_api_key') return + if (!isUserCredentialPrincipal(principal)) return captureServerEvent( principal.userId, 'mcp_server_disconnected', diff --git a/apps/sim/app/api/v2/mcp-servers/route.ts b/apps/sim/app/api/v2/mcp-servers/route.ts index 91ea160afc2..38484db7dba 100644 --- a/apps/sim/app/api/v2/mcp-servers/route.ts +++ b/apps/sim/app/api/v2/mcp-servers/route.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { v2CreateMcpServerContract, v2ListMcpServersContract, @@ -68,7 +69,7 @@ export const POST = defineV2JsonRoute({ mapInput: ({ body }) => ({ ...body, source: 'api' as const }), useCase: createMcpServerUseCase, onSuccess: ({ principal, input, result }) => { - if (principal.kind !== 'personal_api_key' || result.updated) return + if (!isUserCredentialPrincipal(principal) || result.updated) return captureServerEvent( principal.userId, 'mcp_server_connected', diff --git a/apps/sim/app/api/v2/skills/[skillId]/editors/route.ts b/apps/sim/app/api/v2/skills/[skillId]/editors/route.ts index dbd76d080b3..d5feeb07d91 100644 --- a/apps/sim/app/api/v2/skills/[skillId]/editors/route.ts +++ b/apps/sim/app/api/v2/skills/[skillId]/editors/route.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { type V2SkillEditor, v2GrantSkillEditorContract, @@ -88,7 +89,7 @@ export const POST = defineV2JsonRoute({ }), useCase: grantSkillEditorUseCase, onSuccess: ({ principal, input, result }) => { - if (!result.created || principal.kind !== 'personal_api_key') return + if (!result.created || !isUserCredentialPrincipal(principal)) return captureServerEvent( principal.userId, 'skill_shared', @@ -113,7 +114,7 @@ export const DELETE = defineV2JsonRoute({ }), useCase: revokeSkillEditorUseCase, onSuccess: ({ principal, input, result }) => { - if (principal.kind !== 'personal_api_key') return + if (!isUserCredentialPrincipal(principal)) return captureServerEvent( principal.userId, 'skill_unshared', diff --git a/apps/sim/app/api/v2/skills/[skillId]/route.ts b/apps/sim/app/api/v2/skills/[skillId]/route.ts index 6414280f4c4..7786b43d439 100644 --- a/apps/sim/app/api/v2/skills/[skillId]/route.ts +++ b/apps/sim/app/api/v2/skills/[skillId]/route.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { v2DeleteSkillContract, v2GetSkillContract, @@ -51,7 +52,7 @@ export const PATCH = defineV2JsonRoute({ }), useCase: updateSkillUseCase, onSuccess: ({ principal, input, result }) => { - if (principal.kind !== 'personal_api_key') return + if (!isUserCredentialPrincipal(principal)) return captureServerEvent( principal.userId, 'skill_updated', @@ -81,7 +82,7 @@ export const DELETE = defineV2JsonRoute({ }), useCase: deleteSkillUseCase, onSuccess: ({ principal, input, result }) => { - if (principal.kind !== 'personal_api_key') return + if (!isUserCredentialPrincipal(principal)) return captureServerEvent( principal.userId, 'skill_deleted', diff --git a/apps/sim/app/api/v2/skills/route.ts b/apps/sim/app/api/v2/skills/route.ts index 42de2765968..e0d932d4577 100644 --- a/apps/sim/app/api/v2/skills/route.ts +++ b/apps/sim/app/api/v2/skills/route.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { v2CreateSkillContract, v2ListSkillsContract } from '@/lib/api/contracts/v2/skills' import { cursorRoute, cursorScopeKey } from '@/lib/api/cursor-binding' import { @@ -69,7 +70,7 @@ export const POST = defineV2JsonRoute({ mapInput: ({ body }) => ({ ...body, source: 'api' as const }), useCase: createSkillUseCase, onSuccess: ({ principal, input, result }) => { - if (principal.kind !== 'personal_api_key') return + if (!isUserCredentialPrincipal(principal)) return captureServerEvent( principal.userId, 'skill_created', diff --git a/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts b/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts index f71712224dc..b3ae5d5c9fa 100644 --- a/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts +++ b/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts @@ -24,6 +24,8 @@ export const revalidate = 0 export const POST = defineV2JsonRoute({ contract: v2QueryRowsCountContract, operation: tableOperations.queryRows, + // A query whose filters do not fit a query string; it reads and never writes. + readOnly: true, auth: v2ApiKeyAuth, rateLimit: v2RateLimits.publicApi, errorPolicy: v2TableRowsErrorPolicy, diff --git a/apps/sim/app/api/v2/tables/[tableId]/query/route.ts b/apps/sim/app/api/v2/tables/[tableId]/query/route.ts index 79695721060..8cabae28046 100644 --- a/apps/sim/app/api/v2/tables/[tableId]/query/route.ts +++ b/apps/sim/app/api/v2/tables/[tableId]/query/route.ts @@ -27,6 +27,8 @@ function queryRowCursorScope(tableId: string): string { export const POST = defineV2JsonRoute({ contract: v2QueryRowsContract, operation: tableOperations.queryRows, + // A query whose filters do not fit a query string; it reads and never writes. + readOnly: true, auth: v2ApiKeyAuth, rateLimit: v2RateLimits.publicApi, errorPolicy: v2TableRowsErrorPolicy, diff --git a/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts b/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts index ed0ca3ea5d7..ec089a47cb0 100644 --- a/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts +++ b/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts @@ -11,6 +11,8 @@ export const revalidate = 0 export const POST = defineV2JsonRoute({ contract: v2SearchTableRowsContract, operation: tableOperations.searchRows, + // A search whose filters do not fit a query string; it reads and never writes. + readOnly: true, auth: v2ApiKeyAuth, rateLimit: v2RateLimits.publicApi, errorPolicy: v2TableRowsErrorPolicy, diff --git a/apps/sim/app/api/v2/workflows/[workflowId]/deploy/route.ts b/apps/sim/app/api/v2/workflows/[workflowId]/deploy/route.ts index 59aa0fd0e9d..6dc563160c9 100644 --- a/apps/sim/app/api/v2/workflows/[workflowId]/deploy/route.ts +++ b/apps/sim/app/api/v2/workflows/[workflowId]/deploy/route.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { v2DeployWorkflowContract, v2UndeployWorkflowContract, @@ -67,7 +68,7 @@ export const DELETE = defineV2JsonRoute({ * would report a succeeded undeploy as a 500 rather than catching anything. */ onSuccess: ({ principal, result }) => { - if (principal.kind !== 'personal_api_key') return + if (!isUserCredentialPrincipal(principal)) return captureServerEvent( principal.userId, 'workflow_undeployed', diff --git a/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx b/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx new file mode 100644 index 00000000000..f4633bc429d --- /dev/null +++ b/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx @@ -0,0 +1,119 @@ +'use client' + +import { useMemo, useState } from 'react' +import { ChipConfirmModal, toast } from '@sim/emcn' +import { getErrorMessage } from '@sim/utils/errors' +import { formatDate } from '@sim/utils/formatting' +import type { AuthorizedApp } from '@/lib/api/contracts/user' +import { summarizeOAuthAccess } from '@/lib/auth/oauth-provider' +import { RowActionsMenu } from '@/app/workspace/[workspaceId]/settings/components/row-actions-menu' +import { SettingsEmptyState } from '@/app/workspace/[workspaceId]/settings/components/settings-empty-state' +import { SettingsPanel } from '@/app/workspace/[workspaceId]/settings/components/settings-panel' +import { + RESOURCE_LIST_STACK, + SettingsResourceRow, +} from '@/app/workspace/[workspaceId]/settings/components/settings-resource-row' +import { useSettingsSearch } from '@/app/workspace/[workspaceId]/settings/components/use-settings-search' +import { useAuthorizedApps, useRevokeAuthorizedApp } from '@/hooks/queries/oauth-provider' + +const EMPTY_APPS: AuthorizedApp[] = [] + +/** + * The apps this account has authorized through Sim's OAuth provider. Revoking + * one withdraws its consent and kills every token it holds, so the next + * request it makes fails and the next sign-in asks again. + */ +export function AuthorizedApps() { + const apps = useAuthorizedApps() + const revoke = useRevokeAuthorizedApp() + const [searchTerm, setSearchTerm] = useSettingsSearch() + const [pendingRevoke, setPendingRevoke] = useState(null) + + const list = apps.data ?? EMPTY_APPS + const filtered = useMemo(() => { + const term = searchTerm.trim().toLowerCase() + if (!term) return list + return list.filter((app) => app.name.toLowerCase().includes(term)) + }, [list, searchTerm]) + + const confirmRevoke = () => { + const app = pendingRevoke + if (!app) return + revoke.mutate(app.clientId, { + onSuccess: () => toast.success(`Revoked ${app.name}`), + onError: (error) => toast.error(getErrorMessage(error, 'Failed to revoke access')), + // Closed on settle rather than on click, so the modal's own pending + // state is what the person sees while a destructive action runs. + onSettled: () => setPendingRevoke(null), + }) + } + + return ( + <> + + {apps.isError && apps.data === undefined ? ( + + {getErrorMessage(apps.error, 'Failed to load authorized apps')} + + ) : apps.isPending ? null : list.length === 0 ? ( + No apps have access to your account + ) : filtered.length === 0 ? ( + + No apps found matching "{searchTerm}" + + ) : ( +
+ {filtered.map((app) => ( + + {`authorized ${formatDate(new Date(app.authorizedAt))}`} + + } + trailing={ + setPendingRevoke(app) }, + ]} + /> + } + /> + ))} +
+ )} +
+ + { + if (!open) setPendingRevoke(null) + }} + srTitle='Revoke access' + title='Revoke access' + text={[ + 'Revoking ', + { text: pendingRevoke?.name ?? 'this app', bold: true }, + ' ', + { text: 'immediately signs it out everywhere.', error: true }, + ' You will have to authorize it again to reconnect.', + ]} + confirm={{ + label: 'Revoke', + onClick: confirmRevoke, + pending: revoke.isPending, + pendingLabel: 'Revoking...', + }} + /> + + ) +} diff --git a/apps/sim/background/cleanup-oauth-tokens.test.ts b/apps/sim/background/cleanup-oauth-tokens.test.ts new file mode 100644 index 00000000000..5c9c5c3ae59 --- /dev/null +++ b/apps/sim/background/cleanup-oauth-tokens.test.ts @@ -0,0 +1,72 @@ +/** + * @vitest-environment node + */ +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + select: vi.fn(), + delete: vi.fn(), +})) + +vi.mock('@sim/db', () => ({ db: { select: mocks.select, delete: mocks.delete } })) + +import { + OAUTH_TOKEN_RETENTION_DAYS, + runCleanupOAuthTokens, +} from '@/background/cleanup-oauth-tokens' + +/** A select chain that answers `rows` once awaited, capturing its `where`. */ +function selectChain(rows: unknown[], captured: unknown[]) { + const chain: Record = {} + chain.from = () => chain + chain.where = (clause: unknown) => { + captured.push(clause) + return chain + } + chain.limit = () => chain + chain.then = (resolve: (value: unknown) => unknown) => Promise.resolve(rows).then(resolve) + return chain +} + +describe('runCleanupOAuthTokens', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it('deletes exactly the expired rows it selected, and reports both counts', async () => { + const deletedFrom: unknown[] = [] + mocks.select + .mockReturnValueOnce(selectChain([{ id: 'r1' }, { id: 'r2' }], [])) + .mockReturnValueOnce(selectChain([{ id: 'a1' }], [])) + mocks.delete.mockImplementation((table: unknown) => ({ + where: (clause: unknown) => { + deletedFrom.push([table, clause]) + return Promise.resolve() + }, + })) + + await expect(runCleanupOAuthTokens()).resolves.toEqual({ + refreshTokens: 2, + accessTokens: 1, + }) + expect(deletedFrom).toHaveLength(2) + }) + + /** + * A sweep that issued its deletes unconditionally would send an empty `IN ()` + * to the database on every quiet run. + */ + it('issues no delete when nothing has expired', async () => { + mocks.select.mockReturnValueOnce(selectChain([], [])).mockReturnValueOnce(selectChain([], [])) + + await expect(runCleanupOAuthTokens()).resolves.toEqual({ + refreshTokens: 0, + accessTokens: 0, + }) + expect(mocks.delete).not.toHaveBeenCalled() + }) + + it('keeps a tail rather than deleting the moment a token lapses', () => { + expect(OAUTH_TOKEN_RETENTION_DAYS).toBeGreaterThan(0) + }) +}) diff --git a/apps/sim/background/cleanup-oauth-tokens.ts b/apps/sim/background/cleanup-oauth-tokens.ts new file mode 100644 index 00000000000..13dc034fee4 --- /dev/null +++ b/apps/sim/background/cleanup-oauth-tokens.ts @@ -0,0 +1,82 @@ +import { db } from '@sim/db' +import { oauthAccessToken, oauthRefreshToken } from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { inArray, lt } from 'drizzle-orm' + +const logger = createLogger('CleanupOAuthTokens') + +/** + * How long a lapsed token row is kept before the sweep removes it. + * + * Not zero: a short tail keeps the rows readable while a support question about + * a login that stopped working is still live, and it means clock skew between + * the app and the database can never delete a token that is in fact current. + */ +export const OAUTH_TOKEN_RETENTION_DAYS = 7 + +/** + * Rows removed per table per run, so one sweep cannot hold a long transaction + * over the busiest tables the provider writes. Whatever is left is collected on + * the next run. + */ +const OAUTH_TOKEN_SWEEP_LIMIT = 5_000 + +export interface CleanupOAuthTokensResult { + refreshTokens: number + accessTokens: number +} + +/** + * Removes OAuth token rows that expired long enough ago to be of no use. + * + * Nothing else deletes them. The provider rotates a refresh token by marking + * the old row revoked and inserting a new one, and issues a fresh access token + * every hour without pruning the last — so a single CLI user leaves a dead row + * behind every hour, forever. Only an explicit revoke deletes anything. + * + * Refresh tokens go first and their access tokens follow by cascade + * (`oauth_access_token.refresh_id`), so the second pass only has to catch + * access tokens whose refresh token was already gone. Both select a bounded + * page of ids off the `expires_at` indexes and delete exactly those, rather + * than issuing an unbounded predicate delete. + */ +export async function runCleanupOAuthTokens(): Promise { + const cutoff = new Date(Date.now() - OAUTH_TOKEN_RETENTION_DAYS * 24 * 60 * 60 * 1000) + + const staleRefresh = await db + .select({ id: oauthRefreshToken.id }) + .from(oauthRefreshToken) + .where(lt(oauthRefreshToken.expiresAt, cutoff)) + .limit(OAUTH_TOKEN_SWEEP_LIMIT) + + if (staleRefresh.length > 0) { + await db.delete(oauthRefreshToken).where( + inArray( + oauthRefreshToken.id, + staleRefresh.map((row) => row.id) + ) + ) + } + + const staleAccess = await db + .select({ id: oauthAccessToken.id }) + .from(oauthAccessToken) + .where(lt(oauthAccessToken.expiresAt, cutoff)) + .limit(OAUTH_TOKEN_SWEEP_LIMIT) + + if (staleAccess.length > 0) { + await db.delete(oauthAccessToken).where( + inArray( + oauthAccessToken.id, + staleAccess.map((row) => row.id) + ) + ) + } + + const result = { refreshTokens: staleRefresh.length, accessTokens: staleAccess.length } + logger.info('Swept expired OAuth tokens', { + ...result, + retentionDays: OAUTH_TOKEN_RETENTION_DAYS, + }) + return result +} diff --git a/apps/sim/components/settings/account-settings-renderer.tsx b/apps/sim/components/settings/account-settings-renderer.tsx index 7cefeba5d47..56af48a60cc 100644 --- a/apps/sim/components/settings/account-settings-renderer.tsx +++ b/apps/sim/components/settings/account-settings-renderer.tsx @@ -17,6 +17,11 @@ const ApiKeys = dynamic(() => (module) => module.ApiKeys ) ) +const AuthorizedApps = dynamic(() => + import('@/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps').then( + (module) => module.AuthorizedApps + ) +) const Admin = dynamic(() => import('@/app/workspace/[workspaceId]/settings/components/admin/admin').then( (module) => module.Admin @@ -42,6 +47,7 @@ export function AccountSettingsRenderer({ section }: AccountSettingsRendererProp if (section === 'general') return if (section === 'billing') return if (section === 'api-keys') return + if (section === 'authorized-apps') return if (section === 'admin') return return } diff --git a/apps/sim/components/settings/navigation.test.ts b/apps/sim/components/settings/navigation.test.ts index 270209f733d..0aacb72ead0 100644 --- a/apps/sim/components/settings/navigation.test.ts +++ b/apps/sim/components/settings/navigation.test.ts @@ -129,6 +129,7 @@ describe('settings navigation boundaries', () => { 'general', 'billing', 'api-keys', + 'authorized-apps', 'admin', 'mothership', ]) diff --git a/apps/sim/components/settings/navigation.ts b/apps/sim/components/settings/navigation.ts index b1f09e3054c..cb7a70e9ceb 100644 --- a/apps/sim/components/settings/navigation.ts +++ b/apps/sim/components/settings/navigation.ts @@ -3,6 +3,7 @@ import { ChartColumn, ClipboardList, Clock, + Connections, Credit, Database, Globe, @@ -33,7 +34,13 @@ import type { DeploymentFeatures, DeploymentShape } from '@/lib/api/contracts/wo export type SettingsPlane = 'account' | 'selfhost' | 'workspace' -export type AccountSettingsSection = 'general' | 'billing' | 'api-keys' | 'admin' | 'mothership' +export type AccountSettingsSection = + | 'general' + | 'billing' + | 'api-keys' + | 'authorized-apps' + | 'admin' + | 'mothership' /** * Settings a self-hoster needs from the managed service: their profile, what @@ -583,6 +590,18 @@ export const SETTINGS_SECTION_REGISTRY: readonly SettingsSectionRegistryEntry[] }, }, }, + { + label: 'Authorized apps', + icon: Connections, + planes: { + account: { + id: 'authorized-apps', + description: 'Review and revoke apps that can act on your account.', + group: 'developer', + order: 3, + }, + }, + }, { label: 'MCP servers', icon: Server, diff --git a/apps/sim/components/settings/standalone-settings-shell.tsx b/apps/sim/components/settings/standalone-settings-shell.tsx index 5a2f5ccbf68..ec74710b22b 100644 --- a/apps/sim/components/settings/standalone-settings-shell.tsx +++ b/apps/sim/components/settings/standalone-settings-shell.tsx @@ -39,11 +39,14 @@ export function StandaloneSettingsShell(props: StandaloneSettingsShellProps) { const { children, plane } = props useSettingsBeforeUnload() const pathname = usePathname() - const { hosted, billingEnabled } = useDeploymentShape() + const { hosted, billingEnabled, features } = useDeploymentShape() const isSuperUser = plane === 'account' ? (props.isSuperUser ?? false) : false const accountItems = ACCOUNT_SETTINGS_ITEMS.filter((item) => { if (item.id === 'billing' && !billingEnabled) return false + // Nothing can authorize an app on a deployment that is not an OAuth + // provider, so the section would only ever be empty. + if (item.id === 'authorized-apps' && !features.oauthProvider) return false if ((item.id === 'admin' || item.id === 'mothership') && !isSuperUser) return false return true }) diff --git a/apps/sim/hooks/queries/oauth-provider.ts b/apps/sim/hooks/queries/oauth-provider.ts new file mode 100644 index 00000000000..dc3f5e1dd01 --- /dev/null +++ b/apps/sim/hooks/queries/oauth-provider.ts @@ -0,0 +1,96 @@ +import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' +import { requestJson } from '@/lib/api/client/request' +import { + type AuthorizedApp, + listAuthorizedAppsContract, + revokeAuthorizedAppContract, +} from '@/lib/api/contracts/user' +import { client } from '@/lib/auth/auth-client' + +export const oauthProviderKeys = { + all: ['oauth-provider'] as const, + clients: () => [...oauthProviderKeys.all, 'client'] as const, + client: (clientId?: string) => [...oauthProviderKeys.clients(), clientId ?? ''] as const, + authorizedApps: () => [...oauthProviderKeys.all, 'authorized-apps'] as const, +} + +export const AUTHORIZED_APPS_STALE_TIME = 30 * 1000 + +async function fetchAuthorizedApps(signal?: AbortSignal): Promise { + const data = await requestJson(listAuthorizedAppsContract, { signal }) + return data.apps +} + +/** The apps the signed-in account has authorized, for the settings list. */ +export function useAuthorizedApps() { + return useQuery({ + queryKey: oauthProviderKeys.authorizedApps(), + queryFn: ({ signal }) => fetchAuthorizedApps(signal), + staleTime: AUTHORIZED_APPS_STALE_TIME, + }) +} + +export function useRevokeAuthorizedApp() { + const queryClient = useQueryClient() + return useMutation({ + mutationFn: (clientId: string) => + requestJson(revokeAuthorizedAppContract, { params: { clientId } }), + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: oauthProviderKeys.authorizedApps() }) + }, + }) +} + +/** A client's public registration: what the consent page names it. */ +export interface OAuthPublicClient { + clientId: string + name: string | null +} + +export const OAUTH_PUBLIC_CLIENT_STALE_TIME = 5 * 60 * 1000 + +/** + * The Better Auth endpoints below are plugin catch-all routes, typed by the + * `oauthProviderClient()` plugin rather than by a Sim contract, so they are + * called through the auth client instead of `requestJson`. + */ +async function fetchPublicClient( + clientId: string, + signal?: AbortSignal +): Promise { + const { data, error } = await client.oauth2.publicClient({ + query: { client_id: clientId }, + fetchOptions: { signal }, + }) + if (error || !data) { + throw new Error(error?.message ?? 'This app could not be found.') + } + return { clientId: data.client_id, name: data.client_name ?? null } +} + +export function useOAuthPublicClient(clientId?: string) { + return useQuery({ + queryKey: oauthProviderKeys.client(clientId), + queryFn: ({ signal }) => fetchPublicClient(clientId as string, signal), + enabled: Boolean(clientId), + staleTime: OAUTH_PUBLIC_CLIENT_STALE_TIME, + }) +} + +/** + * Records the user's decision and returns where the browser goes next: the + * client's `redirect_uri` with an authorization code, or with + * `error=access_denied` when declined. The signed authorize query travels in + * the request body automatically (see `oauthProviderClient` in `auth-client`). + */ +export function useOAuthConsent() { + return useMutation({ + mutationFn: async (accept: boolean): Promise => { + const { data, error } = await client.oauth2.consent({ accept }) + if (error || !data?.url) { + throw new Error(error?.message ?? 'The authorization could not be completed.') + } + return data.url + }, + }) +} diff --git a/apps/sim/lib/api/application/operations.ts b/apps/sim/lib/api/application/operations.ts index c524a401368..dbe48461fdf 100644 --- a/apps/sim/lib/api/application/operations.ts +++ b/apps/sim/lib/api/application/operations.ts @@ -14,6 +14,6 @@ export const v2MetaOperations = { read: defineOperation({ id: 'meta.capabilities.read', capability: 'none', - principalKinds: ['personal_api_key', 'workspace_api_key'], + principalKinds: ['personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), } as const diff --git a/apps/sim/lib/api/application/read-v2-api-capabilities.test.ts b/apps/sim/lib/api/application/read-v2-api-capabilities.test.ts index 5d707c474fa..936297487c1 100644 --- a/apps/sim/lib/api/application/read-v2-api-capabilities.test.ts +++ b/apps/sim/lib/api/application/read-v2-api-capabilities.test.ts @@ -63,7 +63,7 @@ describe('readV2ApiCapabilities', () => { it('declares its principal policy as frozen data rather than leaving it implicit', () => { expect(v2MetaOperations.read).toMatchObject({ id: 'meta.capabilities.read', - principalKinds: ['personal_api_key', 'workspace_api_key'], + principalKinds: ['personal_api_key', 'oauth_access_token', 'workspace_api_key'], }) expect(Object.isFrozen(v2MetaOperations.read)).toBe(true) expect(Object.isFrozen(v2MetaOperations.read.principalKinds)).toBe(true) diff --git a/apps/sim/lib/api/contracts/user.ts b/apps/sim/lib/api/contracts/user.ts index 9b34e9bbf5a..fabaefce163 100644 --- a/apps/sim/lib/api/contracts/user.ts +++ b/apps/sim/lib/api/contracts/user.ts @@ -14,6 +14,44 @@ export const userProfileSchema = z.object({ export type UserProfileApiUser = z.output +/** An OAuth client the account has authorized, as the "Authorized apps" settings list shows it. */ +export const authorizedAppSchema = z.object({ + clientId: z.string().min(1).max(200), + name: z.string().min(1).max(200), + scopes: z.array(z.string().min(1).max(100)).max(50), + /** + * When the user granted this app access, which is what decides whether to + * revoke it. ISO-checked because the row is rendered through `new Date(...)` + * — anything else reaches the settings list as "Invalid Date". + */ + authorizedAt: z.iso.datetime(), +}) + +export type AuthorizedApp = z.output + +export const listAuthorizedAppsContract = defineRouteContract({ + method: 'GET', + path: '/api/users/me/authorized-apps', + response: { + mode: 'json', + schema: z.object({ apps: z.array(authorizedAppSchema) }), + }, +}) + +export const authorizedAppParamsSchema = z.object({ + clientId: z.string().min(1, 'Client ID is required').max(200), +}) + +export const revokeAuthorizedAppContract = defineRouteContract({ + method: 'DELETE', + path: '/api/users/me/authorized-apps/[clientId]', + params: authorizedAppParamsSchema, + response: { + mode: 'json', + schema: z.object({ success: z.literal(true) }), + }, +}) + export const getUserProfileContract = defineRouteContract({ method: 'GET', path: '/api/users/me/profile', diff --git a/apps/sim/lib/api/contracts/v2/meta.ts b/apps/sim/lib/api/contracts/v2/meta.ts index eec1daf8461..d2b84eb7deb 100644 --- a/apps/sim/lib/api/contracts/v2/meta.ts +++ b/apps/sim/lib/api/contracts/v2/meta.ts @@ -4,9 +4,9 @@ import { defineRouteContract } from '@/lib/api/contracts/types' import { v2DataResponse, v2TimestampSchema } from '@/lib/api/contracts/v2/shared' export const v2ApiKeyTypeSchema = z - .enum(['personal', 'workspace']) + .enum(['personal', 'workspace', 'oauth_access_token']) .describe( - 'Whether the calling key carries the full authority of its owner across their workspaces, or is scoped to one workspace.' + 'Whether the calling credential is a personal API key carrying the full authority of its owner across their workspaces, a key scoped to one workspace, or an OAuth access token acting for its user within the scopes it was granted.' ) export type V2ApiKeyType = z.output diff --git a/apps/sim/lib/api/contracts/workspaces.ts b/apps/sim/lib/api/contracts/workspaces.ts index 318562ae4bf..c07147fcbc4 100644 --- a/apps/sim/lib/api/contracts/workspaces.ts +++ b/apps/sim/lib/api/contracts/workspaces.ts @@ -253,6 +253,8 @@ export const deploymentFeaturesSchema = z.object({ dataDrains: z.boolean(), dataRetention: z.boolean(), inbox: z.boolean(), + /** Sim is an OAuth 2.1 provider: a deployment toggle rather than an enterprise entitlement. */ + oauthProvider: z.boolean(), sandboxes: z.boolean(), sessionPolicies: z.boolean(), sso: z.boolean(), diff --git a/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts b/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts index 71773811294..fc45924dd50 100644 --- a/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts +++ b/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts @@ -10,8 +10,13 @@ const mocks = vi.hoisted(() => ({ getHighestPrioritySubscription: vi.fn(), })) -vi.mock('@/lib/core/config/env-flags', () => ({ isAuthDisabled: false })) +vi.mock('@/lib/core/config/env-flags', () => ({ + isAuthDisabled: false, + isOAuthProviderEnabled: true, +})) vi.mock('@/lib/api-key/crypto', () => ({ hashApiKey: (value: string) => `hash:${value}` })) +vi.mock('@/lib/auth/oauth-provider', () => ({ OAUTH_ACCESS_TOKEN_PREFIX: 'sim_oat_' })) +vi.mock('@sim/security/hash', () => ({ sha256Hex: (value: string) => `oauth-hash:${value}` })) vi.mock('@/lib/api-key/service', () => ({ updateApiKeyLastUsed: mocks.updateLastUsed })) vi.mock('@/lib/billing/core/billing-attribution', () => ({ resolveWorkspaceBillingPayer: mocks.resolveWorkspaceBillingPayer, @@ -24,6 +29,10 @@ import { authenticateV2ApiKey, V2ApiKeyUnauthenticatedError, } from '@/lib/api/server/routes/v2-api-key-auth' +import { + hasV2Credential, + readV2CredentialHeaders, +} from '@/lib/api/server/routes/v2-credential-headers' describe('v2 API key authentication', () => { beforeEach(() => { @@ -45,7 +54,7 @@ describe('v2 API key authentication', () => { }, ]) - const result = await authenticateV2ApiKey('secret') + const result = await authenticateV2ApiKey({ apiKey: 'secret', bearer: null }) expect(result).toEqual({ principal: { kind: 'personal_api_key', userId: 'user-1', keyId: 'key-1' }, @@ -76,7 +85,7 @@ describe('v2 API key authentication', () => { }, ]) - const result = await authenticateV2ApiKey('secret') + const result = await authenticateV2ApiKey({ apiKey: 'secret', bearer: null }) expect(result.keyExpiresAt).toEqual(new Date('2027-01-01T00:00:00.000Z')) }) @@ -101,7 +110,7 @@ describe('v2 API key authentication', () => { }, }) - const result = await authenticateV2ApiKey('secret') + const result = await authenticateV2ApiKey({ apiKey: 'secret', bearer: null }) expect(result).toEqual({ principal: { kind: 'workspace_api_key', workspaceId: 'workspace-1', keyId: 'key-1' }, @@ -130,13 +139,13 @@ describe('v2 API key authentication', () => { payerSubscription: null, }) - await expect(authenticateV2ApiKey('secret')).resolves.toMatchObject({ + await expect(authenticateV2ApiKey({ apiKey: 'secret', bearer: null })).resolves.toMatchObject({ principal: { kind: 'workspace_api_key', workspaceId: 'workspace-1', keyId: 'key-1' }, }) }) it('treats missing, banned, and expired credentials as unauthenticated', async () => { - await expect(authenticateV2ApiKey('missing')).rejects.toBeInstanceOf( + await expect(authenticateV2ApiKey({ apiKey: 'missing', bearer: null })).rejects.toBeInstanceOf( V2ApiKeyUnauthenticatedError ) @@ -150,7 +159,7 @@ describe('v2 API key authentication', () => { userBanned: true, }, ]) - await expect(authenticateV2ApiKey('banned')).rejects.toBeInstanceOf( + await expect(authenticateV2ApiKey({ apiKey: 'banned', bearer: null })).rejects.toBeInstanceOf( V2ApiKeyUnauthenticatedError ) @@ -164,7 +173,7 @@ describe('v2 API key authentication', () => { userBanned: false, }, ]) - await expect(authenticateV2ApiKey('expired')).rejects.toBeInstanceOf( + await expect(authenticateV2ApiKey({ apiKey: 'expired', bearer: null })).rejects.toBeInstanceOf( V2ApiKeyUnauthenticatedError ) }) @@ -173,6 +182,114 @@ describe('v2 API key authentication', () => { const failure = new Error('database unavailable') dbChainMockFns.limit.mockRejectedValueOnce(failure) - await expect(authenticateV2ApiKey('secret')).rejects.toBe(failure) + await expect(authenticateV2ApiKey({ apiKey: 'secret', bearer: null })).rejects.toBe(failure) + }) +}) + +describe('v2 bearer token authentication', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + mocks.getHighestPrioritySubscription.mockResolvedValue({ + plan: 'pro', + referenceId: 'user-1', + }) + }) + + function tokenRow(overrides: Record = {}) { + return { + id: 'token-1', + userId: 'user-1', + clientId: 'sim-cli', + scopes: ['openid', 'api:read', 'api:write'], + expiresAt: new Date('2099-01-01T00:00:00.000Z'), + clientDisabled: false, + userBanned: false, + userExists: 'user-1', + ...overrides, + } + } + + it('reads the credential headers as a pair, ignoring other Authorization schemes', () => { + expect( + readV2CredentialHeaders(new Headers({ 'x-api-key': 'k', authorization: 'Bearer t' })) + ).toEqual({ apiKey: 'k', bearer: 't' }) + expect(readV2CredentialHeaders(new Headers({ authorization: 'Basic abc' }))).toEqual({ + apiKey: null, + bearer: null, + }) + expect(hasV2Credential(new Headers({ authorization: 'Bearer sim_oat_t' }))).toBe(true) + expect(hasV2Credential(new Headers())).toBe(false) + }) + + /** + * A public deployed workflow is routinely called by a gateway that forwards + * its own `Authorization` header. Counting that as a Sim credential would + * send an execution that used to run anonymously into a 401. + */ + it("does not treat somebody else's bearer token as a Sim credential", () => { + expect(hasV2Credential(new Headers({ authorization: 'Bearer ghp_something' }))).toBe(false) + expect(hasV2Credential(new Headers({ authorization: 'Bearer sim_oat_t' }))).toBe(true) + }) + + it('authenticates an OAuth token as its user, rate-limited on the user plan', async () => { + queueTableRows(schemaMock.oauthAccessToken, [tokenRow()]) + + const result = await authenticateV2ApiKey({ apiKey: null, bearer: 'sim_oat_secret' }) + + expect(result).toEqual({ + principal: { + kind: 'oauth_access_token', + userId: 'user-1', + clientId: 'sim-cli', + tokenId: 'token-1', + scopes: ['openid', 'api:read', 'api:write'], + expiresAt: new Date('2099-01-01T00:00:00.000Z'), + }, + rateLimitSubjectIds: ['oauth-token:token-1', 'user:user-1'], + rateLimitSubscription: { plan: 'pro', referenceId: 'user-1' }, + keyType: 'oauth_access_token', + keyExpiresAt: new Date('2099-01-01T00:00:00.000Z'), + }) + expect(mocks.updateLastUsed).not.toHaveBeenCalled() + }) + + it('prefers the API key when both credentials are presented', async () => { + queueTableRows(schemaMock.apiKey, [ + { + id: 'key-1', + userId: 'user-1', + workspaceId: null, + type: 'personal', + expiresAt: null, + userBanned: false, + }, + ]) + + const result = await authenticateV2ApiKey({ apiKey: 'secret', bearer: 'sim_oat_ignored' }) + + expect(result.keyType).toBe('personal') + }) + + it('answers a refused bearer with the bearer challenge, and a missing one with the key challenge', async () => { + const refused = await authenticateV2ApiKey({ apiKey: null, bearer: 'sim_oat_unknown' }).catch( + (error) => error + ) + expect(refused).toBeInstanceOf(V2ApiKeyUnauthenticatedError) + expect(refused.challenge).toBe('bearer') + + const missing = await authenticateV2ApiKey({ apiKey: null, bearer: null }).catch( + (error) => error + ) + expect(missing).toBeInstanceOf(V2ApiKeyUnauthenticatedError) + expect(missing.challenge).toBe('api_key') + }) + + it('refuses a token whose client was disabled', async () => { + queueTableRows(schemaMock.oauthAccessToken, [tokenRow({ clientDisabled: true })]) + + await expect( + authenticateV2ApiKey({ apiKey: null, bearer: 'sim_oat_secret' }) + ).rejects.toBeInstanceOf(V2ApiKeyUnauthenticatedError) }) }) diff --git a/apps/sim/lib/api/server/routes/v2-api-key-auth.ts b/apps/sim/lib/api/server/routes/v2-api-key-auth.ts index e147c28dbab..461f579ded9 100644 --- a/apps/sim/lib/api/server/routes/v2-api-key-auth.ts +++ b/apps/sim/lib/api/server/routes/v2-api-key-auth.ts @@ -1,18 +1,39 @@ -import type { PersonalApiKeyPrincipal, WorkspaceApiKeyPrincipal } from '@sim/auth/principal' +import type { + OAuthAccessTokenPrincipal, + PersonalApiKeyPrincipal, + WorkspaceApiKeyPrincipal, +} from '@sim/auth/principal' import { db } from '@sim/db' import { apiKey, user } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { eq } from 'drizzle-orm' +import type { V2CredentialHeaders } from '@/lib/api/server/routes/v2-credential-headers' import { hashApiKey } from '@/lib/api-key/crypto' import { updateApiKeyLastUsed } from '@/lib/api-key/service' import { ANONYMOUS_USER_ID } from '@/lib/auth/constants' +import { InvalidOAuthAccessTokenError, verifyOAuthAccessToken } from '@/lib/auth/oauth-access-token' import { resolveWorkspaceBillingPayer } from '@/lib/billing/core/billing-attribution' import { getHighestPrioritySubscription } from '@/lib/billing/core/subscription' -import { isAuthDisabled } from '@/lib/core/config/env-flags' +import { isAuthDisabled, isOAuthProviderEnabled } from '@/lib/core/config/env-flags' const logger = createLogger('V2ApiKeyAuth') -export type V2ApiKeyPrincipal = PersonalApiKeyPrincipal | WorkspaceApiKeyPrincipal +/** + * The credentials v2 authenticates: an API key in `x-api-key`, or one of Sim's + * own OAuth access tokens as `Authorization: Bearer`. The module keeps its + * API-key name because the key path is unchanged and every route names its + * policy object; the bearer path is the addition. + */ +export type V2ApiKeyPrincipal = + | PersonalApiKeyPrincipal + | WorkspaceApiKeyPrincipal + | OAuthAccessTokenPrincipal + +/** Which credential the caller presented, as `/api/v2/meta` reports it. */ +export type V2CredentialType = 'personal' | 'workspace' | 'oauth_access_token' + +/** Which challenge a 401 should lead with: the scheme the caller tried, or the key when it tried nothing. */ +export type V2AuthChallenge = 'api_key' | 'bearer' interface RateLimitSubscription { plan: string @@ -23,18 +44,21 @@ export interface V2ApiKeyAuthContext { principal: V2ApiKeyPrincipal rateLimitSubjectIds: readonly [string, ...string[]] rateLimitSubscription: RateLimitSubscription | null - keyType: 'personal' | 'workspace' + keyType: V2CredentialType /** - * When the authenticated key expires, or `null` when it never does — read - * from the same row `requireValidRow` has just checked, so no surface has to - * go back to the API-key table for it. `/api/v2/meta` reports it, and the - * application layer must never query `api_key` itself to find it out. + * When the authenticated credential expires, or `null` when it never does — + * read from the same row the authenticator has just checked, so no surface + * has to go back to the credential table for it. `/api/v2/meta` reports it, + * and the application layer must never query `api_key` itself to find it out. */ keyExpiresAt: Date | null } export class V2ApiKeyUnauthenticatedError extends Error { - constructor(message = 'Invalid API key') { + constructor( + message = 'Invalid API key', + readonly challenge: V2AuthChallenge = 'api_key' + ) { super(message) this.name = 'V2ApiKeyUnauthenticatedError' } @@ -64,26 +88,12 @@ function requireValidRow(row: ApiKeyRow | undefined): ApiKeyRow { throw new Error(`API key ${row.id} has an invalid persisted type/workspace combination`) } -export async function authenticateV2ApiKey( - apiKeyHeader: string | null -): Promise { - if (isAuthDisabled) { - return { - principal: { - kind: 'personal_api_key', - userId: ANONYMOUS_USER_ID, - keyId: 'auth-disabled', - }, - rateLimitSubjectIds: [`user:${ANONYMOUS_USER_ID}`], - rateLimitSubscription: null, - keyType: 'personal', - keyExpiresAt: null, - } - } - if (!apiKeyHeader) { - throw new V2ApiKeyUnauthenticatedError('API key required') - } +async function personalSubscription(userId: string): Promise { + const subscription = await getHighestPrioritySubscription(userId, { onError: 'throw' }) + return subscription ? { plan: subscription.plan, referenceId: subscription.referenceId } : null +} +async function authenticateApiKey(apiKeyHeader: string): Promise { const [candidate] = await db .select({ id: apiKey.id, @@ -103,13 +113,10 @@ export async function authenticateV2ApiKey( logger.debug('Authenticated v2 API key', { keyId: row.id, keyType: row.type }) if (row.type === 'personal') { - const subscription = await getHighestPrioritySubscription(row.userId, { onError: 'throw' }) return { principal: { kind: 'personal_api_key', userId: row.userId, keyId: row.id }, rateLimitSubjectIds: [`api-key:${row.id}`, `user:${row.userId}`], - rateLimitSubscription: subscription - ? { plan: subscription.plan, referenceId: subscription.referenceId } - : null, + rateLimitSubscription: await personalSubscription(row.userId), keyType: 'personal', keyExpiresAt: row.expiresAt, } @@ -136,3 +143,60 @@ export async function authenticateV2ApiKey( keyExpiresAt: row.expiresAt, } } + +/** + * An OAuth token is rate-limited like the personal key it stands in for: per + * token and per user, on the user's own plan. A client that holds many tokens + * for one user still shares that user's bucket. + */ +async function authenticateBearer(token: string): Promise { + if (!isOAuthProviderEnabled) { + throw new V2ApiKeyUnauthenticatedError('Bearer tokens are not accepted', 'bearer') + } + let principal: OAuthAccessTokenPrincipal + try { + principal = await verifyOAuthAccessToken(token) + } catch (error) { + if (error instanceof InvalidOAuthAccessTokenError) { + logger.warn('Invalid OAuth access token attempted', { reason: error.reason }) + throw new V2ApiKeyUnauthenticatedError('Invalid access token', 'bearer') + } + throw error + } + return { + principal, + rateLimitSubjectIds: [`oauth-token:${principal.tokenId}`, `user:${principal.userId}`], + rateLimitSubscription: await personalSubscription(principal.userId), + keyType: 'oauth_access_token', + keyExpiresAt: principal.expiresAt, + } +} + +/** + * Authenticates a v2 request from its credential headers. + * + * `x-api-key` wins when both are present, so a client that always sends a key + * and happens to also carry an `Authorization` header keeps the behavior it + * had before bearer tokens existed. A bearer token is only consulted when no + * key is offered. + */ +export async function authenticateV2ApiKey( + credential: V2CredentialHeaders +): Promise { + if (isAuthDisabled) { + return { + principal: { + kind: 'personal_api_key', + userId: ANONYMOUS_USER_ID, + keyId: 'auth-disabled', + }, + rateLimitSubjectIds: [`user:${ANONYMOUS_USER_ID}`], + rateLimitSubscription: null, + keyType: 'personal', + keyExpiresAt: null, + } + } + if (credential.apiKey) return authenticateApiKey(credential.apiKey) + if (credential.bearer) return authenticateBearer(credential.bearer) + throw new V2ApiKeyUnauthenticatedError('API key required') +} diff --git a/apps/sim/lib/api/server/routes/v2-credential-headers.ts b/apps/sim/lib/api/server/routes/v2-credential-headers.ts new file mode 100644 index 00000000000..53f342a344e --- /dev/null +++ b/apps/sim/lib/api/server/routes/v2-credential-headers.ts @@ -0,0 +1,36 @@ +import { parseBearerToken } from '@/lib/auth/oauth-access-token' +import { OAUTH_ACCESS_TOKEN_PREFIX } from '@/lib/auth/oauth-provider' + +export interface V2CredentialHeaders { + apiKey: string | null + bearer: string | null +} + +/** + * The credentials a v2 request presents, read from its headers. + * + * Separate from the verifier because reading a header is not authentication: + * the route builders ask this before authenticating, to tell an anonymous + * request from one carrying a credential, and every route test mocks the + * verifier module to keep the database out of reach. Leaving these there made + * the pure request-shape question unavailable to any of them. + */ +export function readV2CredentialHeaders(headers: Headers): V2CredentialHeaders { + return { apiKey: headers.get('x-api-key'), bearer: parseBearerToken(headers) } +} + +/** + * Whether the request presents any credential v2 knows how to read. + * + * A bearer counts only when it carries Sim's own access-token prefix. The + * optional-auth path uses this to tell an anonymous request from an + * authenticated one, and a public deployed workflow is routinely called by a + * gateway that forwards its own unrelated `Authorization` header — treating + * that as a Sim credential would turn a working anonymous execution into a + * 401. A bearer that is not one of ours was never a v2 credential. + */ +export function hasV2Credential(headers: Headers): boolean { + const credential = readV2CredentialHeaders(headers) + if (credential.apiKey !== null) return true + return credential.bearer?.startsWith(OAUTH_ACCESS_TOKEN_PREFIX) === true +} diff --git a/apps/sim/lib/api/server/routes/v2-json-route.test.ts b/apps/sim/lib/api/server/routes/v2-json-route.test.ts index 80fec5aa912..35c8e330a46 100644 --- a/apps/sim/lib/api/server/routes/v2-json-route.test.ts +++ b/apps/sim/lib/api/server/routes/v2-json-route.test.ts @@ -797,3 +797,92 @@ describe('defineV2JsonRoute presentation', () => { ) }) }) + +describe('defineV2JsonRoute OAuth scope admission', () => { + const oauthAuth = (scopes: readonly string[]) => + ({ + principal: { + kind: 'oauth_access_token', + userId: 'user-1', + clientId: 'sim-cli', + tokenId: 'token-1', + scopes, + expiresAt: new Date('2099-01-01T00:00:00.000Z'), + }, + rateLimitSubjectIds: ['oauth-token:token-1', 'user:user-1'], + rateLimitSubscription: null, + keyType: 'oauth_access_token', + keyExpiresAt: null, + }) as unknown as V2ApiKeyAuthContext + + function bearerRequest(): NextRequest { + return new NextRequest('http://localhost/api/v2/widgets', { + method: 'POST', + headers: { 'content-type': 'application/json', authorization: 'Bearer sim_oat_x' }, + body: JSON.stringify({ value: 'ok' }), + }) + } + + beforeEach(() => { + vi.clearAllMocks() + v2RouteMocks.preauthRate.mockResolvedValue({ allowed: true, remaining: 599, resetAt }) + v2RouteMocks.operationRate.mockResolvedValue(allowedRate) + }) + + /** + * The whole point of a read-only grant. The scope is derived from the HTTP + * method rather than the operation's `minimumRole`, because several POST + * routes only read; a role-derived rule let a read-only token write. + */ + it('refuses a read-only token on an unsafe method before the use case runs', async () => { + v2RouteMocks.authenticate.mockResolvedValue(oauthAuth(['openid', 'api:read'])) + const execute = vi.fn() + + const response = await createHandler({ execute })(bearerRequest(), { params: undefined }) + + expect(response.status).toBe(403) + expect(response.headers.get('www-authenticate')).toContain('insufficient_scope') + expect(response.headers.get('www-authenticate')).toContain('api:write') + expect(execute).not.toHaveBeenCalled() + }) + + it('admits the same token once the grant carries api:write', async () => { + v2RouteMocks.authenticate.mockResolvedValue(oauthAuth(['openid', 'api:read', 'api:write'])) + + const response = await createHandler()(bearerRequest(), { params: undefined }) + + expect(response.status).toBe(201) + }) + + /** + * `readOnly` is how a POST that only reads — a search or a query whose filter + * is too large for a query string — declares itself, so a read-only token can + * still use it. + */ + it('admits a read-only token on a POST the route declares read-only', async () => { + v2RouteMocks.authenticate.mockResolvedValue(oauthAuth(['openid', 'api:read'])) + const handler = defineV2JsonRoute({ + contract, + auth: v2ApiKeyAuth, + operation, + readOnly: true, + rateLimit: v2RateLimits.publicApi, + errorPolicy: v2OrchestrationErrorPolicy, + mapInput: ({ body }) => body, + useCase: { operation, execute: async ({ input }) => input }, + present: (result) => ({ data: result }), + }) + + const response = await handler(bearerRequest(), { params: undefined }) + + expect(response.status).toBe(201) + }) + + it('leaves an API-key principal alone, which carries no scopes at all', async () => { + v2RouteMocks.authenticate.mockResolvedValue(auth) + + const response = await createHandler()(request(), { params: undefined }) + + expect(response.status).toBe(201) + }) +}) diff --git a/apps/sim/lib/api/server/routes/v2-json-route.ts b/apps/sim/lib/api/server/routes/v2-json-route.ts index b02a5537fb7..88612b645c7 100644 --- a/apps/sim/lib/api/server/routes/v2-json-route.ts +++ b/apps/sim/lib/api/server/routes/v2-json-route.ts @@ -15,13 +15,27 @@ import { authenticateV2ApiKey, type V2ApiKeyAuthContext, V2ApiKeyUnauthenticatedError, + type V2CredentialType, } from '@/lib/api/server/routes/v2-api-key-auth' +import { + hasV2Credential, + readV2CredentialHeaders, +} from '@/lib/api/server/routes/v2-credential-headers' import { type ParsedRequest, type ParseRequestOptions, parseRequest, } from '@/lib/api/server/validation' -import type { ApplicationOperation, OperationUseCase } from '@/lib/core/application' +import { + OAUTH_API_READ_SCOPE, + OAUTH_API_WRITE_SCOPE, + oauthScopeSatisfies, +} from '@/lib/auth/oauth-provider' +import { + type ApplicationOperation, + InsufficientScopeError, + type OperationUseCase, +} from '@/lib/core/application' import { getRateLimit, RateLimiter, type SubscriptionPlan } from '@/lib/core/rate-limiter' import { getClientIp } from '@/lib/core/utils/request' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' @@ -30,6 +44,7 @@ import { v2Error, v2HeadNoEffect, v2HttpError, + v2InsufficientScope, v2RateLimitError, v2ValidationError, } from '@/app/api/v2/lib/response' @@ -48,9 +63,13 @@ export class V2RouteInfrastructureError extends Error { } } +/** + * The v2 credential policy: an API key in `x-api-key`, or a Sim OAuth access + * token as `Authorization: Bearer`. + */ export const v2ApiKeyAuth = { authenticate(request: NextRequest) { - return authenticateV2ApiKey(request.headers.get('x-api-key')) + return authenticateV2ApiKey(readV2CredentialHeaders(request.headers)) }, } as const @@ -231,6 +250,34 @@ export function requireHeadAuthorizableUseCase( ) } +/** + * The safe methods (RFC 9110 §9.2.1) this runtime serves — TRACE is the fourth + * and Next routes none. Every other method is treated as state-changing, which + * is the whole point: a request that may write is one by construction, + * whatever the handler beneath it turns out to do. + */ +const SAFE_HTTP_METHODS = new Set(['GET', 'HEAD', 'OPTIONS']) + +/** + * Refuses a `readOnly` declaration on a route whose method is already safe. + * + * `readOnly` exists only to say "this unsafe method does not write", so on a + * GET it changes nothing and its presence means the author read it as + * something else. Failing at definition time keeps the flag meaning one thing. + * Nothing here can tell whether an unsafe route that claims it is telling the + * truth — that stays a review question. + */ +export function requireUnsafeMethodForReadOnly( + contract: { method: string; path: string }, + readOnly: boolean | undefined +): void { + if (!readOnly) return + if (!SAFE_HTTP_METHODS.has(contract.method.toUpperCase())) return + throw new Error( + `V2 route ${contract.method} ${contract.path} declares readOnly, which only applies to a method that is not already safe. Remove it.` + ) +} + /** * The bodiless answer a `HEAD` gets on a route whose `GET` is not safe. * @@ -300,11 +347,55 @@ async function enforceV2PreAuthIpLimit(request: NextRequest): Promise { @@ -313,11 +404,17 @@ async function admitAuthenticatedV2Request( auth = await authPolicy.authenticate(request) } catch (error) { if (error instanceof V2ApiKeyUnauthenticatedError) { - return { success: false, response: v2Error('UNAUTHORIZED', error.message) } + return { + success: false, + response: v2Error('UNAUTHORIZED', error.message, { authChallenge: error.challenge }), + } } throw new V2RouteInfrastructureError('authentication', error) } + const outOfScope = refuseOutOfScopeRequest(request, auth, scopePolicy) + if (outOfScope) return { success: false, response: outOfScope } + const limited = await rateLimitPolicy.enforce(request, auth, operation) return limited ? { success: false, response: limited } : { success: true, auth } } @@ -326,13 +423,14 @@ async function admitRateLimitedV2Request( request: NextRequest, operation: ApplicationOperation, authPolicy: typeof v2ApiKeyAuth, - rateLimitPolicy: V2RateLimitPolicy + rateLimitPolicy: V2RateLimitPolicy, + scopePolicy?: V2ScopePolicy ): Promise< { success: true; auth: V2ApiKeyAuthContext } | { success: false; response: NextResponse } > { const preAuthResponse = await enforceV2PreAuthIpLimit(request) if (preAuthResponse) return { success: false, response: preAuthResponse } - return admitAuthenticatedV2Request(request, operation, authPolicy, rateLimitPolicy) + return admitAuthenticatedV2Request(request, operation, authPolicy, rateLimitPolicy, scopePolicy) } /** Admission for a v2 route the builders do not cover, such as the resume leg. */ @@ -357,7 +455,7 @@ export async function admitOptionalV2Request( > { const preAuthResponse = await enforceV2PreAuthIpLimit(request) if (preAuthResponse) return { success: false, response: preAuthResponse } - if (!request.headers.has('x-api-key')) return { success: true } + if (!hasV2Credential(request.headers)) return { success: true } return admitAuthenticatedV2Request(request, operation, authPolicy, rateLimitPolicy) } @@ -372,12 +470,13 @@ export async function admitOptionalV2Request( * One route reads it: `GET /api/v2/meta`, whose resource *is* the calling key. */ export interface V2CredentialFacts { - readonly keyType: 'personal' | 'workspace' + readonly keyType: V2CredentialType readonly keyExpiresAt: Date | null } interface V2JsonRouteOptions - extends Omit, 'mapInput'> { + extends Omit, 'mapInput'>, + V2ScopePolicy { mapInput(input: ParsedRequest, credential: V2CredentialFacts): I auth: typeof v2ApiKeyAuth rateLimit: V2RateLimitPolicy @@ -425,6 +524,7 @@ export function defineV2JsonRoute< options.useCase.operation ) requireHeadAuthorizableUseCase(options.contract, options.headSafe, options.useCase) + requireUnsafeMethodForReadOnly(options.contract, options.readOnly) const wrapped = withRouteHandler( async (request, context) => { @@ -438,7 +538,8 @@ export function defineV2JsonRoute< request, options.operation, options.auth, - options.rateLimit + options.rateLimit, + { readOnly: options.readOnly } ) if (!admission.success) return admission.response const { auth } = admission diff --git a/apps/sim/lib/audit-logs/application/authorized-audit-log-use-case.ts b/apps/sim/lib/audit-logs/application/authorized-audit-log-use-case.ts index 142190a2612..2c0971b01c1 100644 --- a/apps/sim/lib/audit-logs/application/authorized-audit-log-use-case.ts +++ b/apps/sim/lib/audit-logs/application/authorized-audit-log-use-case.ts @@ -4,7 +4,10 @@ import { resolveDefaultAuditOrganization, resolveEnterpriseAuditAccess, } from '@/lib/audit-logs/authorization' +import { SIM_CLI_CLIENT_ID } from '@/lib/auth/oauth-provider' import { ForbiddenOperationError, type OperationUseCase } from '@/lib/core/application' +import { refuseCapability } from '@/lib/permission-groups/capabilities' +import { isCapabilityWithheldForUser } from '@/lib/permission-groups/user-scope.server' export interface AuthorizedAuditLogContext { organizationId: string @@ -72,6 +75,21 @@ export function defineAuthorizedAuditLogUseCase +export type AuditLogPrincipal = Extract< + Principal, + { kind: 'session' | 'personal_api_key' | 'oauth_access_token' } +> export interface AuditLogOperation extends ApplicationOperation { readonly authority: 'organization_admin' readonly organizationRoles: readonly ['admin', 'owner'] readonly workspaceApiKey: 'deny' - readonly principalKinds: readonly ['session', 'personal_api_key'] + readonly principalKinds: readonly ['session', 'personal_api_key', 'oauth_access_token'] } function defineAuditLogOperation( @@ -31,7 +34,7 @@ export const auditLogOperations = { authority: 'organization_admin', organizationRoles: ['admin', 'owner'], workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], }), // permission-group-exempt: same organization-admin authority as the list it expands; no group key names the audit trail readDetail: defineAuditLogOperation({ @@ -40,6 +43,6 @@ export const auditLogOperations = { authority: 'organization_admin', organizationRoles: ['admin', 'owner'], workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], }), } as const diff --git a/apps/sim/lib/auth/auth-client.ts b/apps/sim/lib/auth/auth-client.ts index 0f91980cb52..9801e513563 100644 --- a/apps/sim/lib/auth/auth-client.ts +++ b/apps/sim/lib/auth/auth-client.ts @@ -1,4 +1,5 @@ import { useContext } from 'react' +import { oauthProviderClient } from '@better-auth/oauth-provider/client' import { ssoClient } from '@better-auth/sso/client' import { stripeClient } from '@better-auth/stripe/client' import { @@ -24,6 +25,12 @@ export const client = createAuthClient({ adminClient(), emailOTPClient(), genericOAuthClient(), + /** + * Types the `/oauth2/*` endpoints and forwards the signed authorize query + * from the consent page's URL as `oauth_query` on the consent call. Inert on + * every other page, so it does not need the deployment gate. + */ + oauthProviderClient(), customSessionClient(), ...(isBillingEnabled ? [ diff --git a/apps/sim/lib/auth/auth.ts b/apps/sim/lib/auth/auth.ts index e01cc509be7..c51ea0e31d8 100644 --- a/apps/sim/lib/auth/auth.ts +++ b/apps/sim/lib/auth/auth.ts @@ -1,4 +1,5 @@ import { cache } from 'react' +import { oauthProvider } from '@better-auth/oauth-provider' import { sso } from '@better-auth/sso' import { stripe } from '@better-auth/stripe' import { db } from '@sim/db' @@ -37,6 +38,17 @@ import { getRequestedSignInProviderId, isSignInProviderAllowed, } from '@/lib/auth/constants' +import { hashOAuthToken } from '@/lib/auth/oauth-access-token' +import { + consentRequestNamesClient, + OAUTH_ACCESS_TOKEN_PREFIX, + OAUTH_ACCESS_TOKEN_TTL_SECONDS, + OAUTH_CODE_TTL_SECONDS, + OAUTH_REFRESH_TOKEN_PREFIX, + OAUTH_REFRESH_TOKEN_TTL_SECONDS, + OAUTH_SCOPES, + SIM_CLI_CLIENT_ID, +} from '@/lib/auth/oauth-provider' import { getSessionCookieCacheVersion } from '@/lib/auth/security-policy' import { clampExpiryForSession } from '@/lib/auth/session-policy' import { getActiveOrganizationId } from '@/lib/auth/session-response' @@ -91,6 +103,7 @@ import { isGoogleAuthDisabled, isHosted, isMicrosoftAuthDisabled, + isOAuthProviderEnabled, isOrganizationsEnabled, isRegistrationDisabled, isSignupMxValidationEnabled, @@ -130,6 +143,8 @@ import { import { extractSlackTeamId, fanOutSlackTokenChain } from '@/lib/oauth/slack' import { getCanonicalScopesForProvider } from '@/lib/oauth/utils' import { joinInstanceOrganization } from '@/lib/organizations/instance-org' +import { capabilityRefusal } from '@/lib/permission-groups/capability-assertions' +import { isCapabilityWithheldForUser } from '@/lib/permission-groups/user-scope.server' import { captureServerEvent, getPostHogClient } from '@/lib/posthog/server' import { disableUserResources } from '@/lib/workflows/lifecycle' import { SSO_TRUSTED_PROVIDERS } from '@/ee/sso/constants' @@ -954,6 +969,32 @@ export const auth = betterAuth({ } } + /** + * A user consenting to the Sim CLI is the one moment a human is present + * in a CLI login, so `cli.use` is checked here to refuse the grant + * outright. `requireCliAccessAllowed` checks it again on every bearer + * request, because a consent already on file lets later authorizations + * skip this endpoint entirely — neither check makes the other redundant. + * + * The client id is read from the signed authorize query the consent page + * forwards. The gate fires if `sim-cli` appears anywhere in it, which is + * strictly more conservative than the plugin's own first-value read. + * + * permission-group-enforced: cli.use — gates OAuth consent for the + * first-party CLI client, which owns no workspace resource for the + * authorization funnel to authorize. + */ + if (ctx.path === '/oauth2/consent') { + if (consentRequestNamesClient(ctx.body?.oauth_query, SIM_CLI_CLIENT_ID)) { + const session = await getSessionFromCtx(ctx) + const userId = session?.user?.id + if (userId && (await isCapabilityWithheldForUser(userId, 'cli.use'))) { + logger.warn('CLI OAuth consent blocked by permission group', { userId }) + throw new APIError('FORBIDDEN', { message: capabilityRefusal('cli.use') }) + } + } + } + if (ctx.path === '/oauth2/link' && ctx.body?.providerId === MICROSOFT_DATAVERSE_PROVIDER_ID) { try { assertMicrosoftDataverseOAuthLinkRequest( @@ -1257,6 +1298,62 @@ export const auth = betterAuth({ genericOAuth({ config: buildConnectorProviders(), }), + /** + * Sim as an OAuth 2.1 authorization server (auth-code + PKCE, refresh + * rotation). Tokens are opaque and stored hashed so a "Revoke" in settings + * or `sim logout` takes effect on the next request; `disableJwtPlugin` + * keeps the JWKS machinery out until a third-party resource server needs + * it. Clients are DB rows only (the CLI is seeded by migration, the rest + * are admin-created), so both registration paths stay closed. + */ + ...(isOAuthProviderEnabled + ? [ + oauthProvider({ + loginPage: '/oauth/sign-in', + consentPage: '/oauth/consent', + scopes: [...OAUTH_SCOPES], + grantTypes: ['authorization_code', 'refresh_token'], + allowDynamicClientRegistration: false, + allowUnauthenticatedClientRegistration: false, + /** + * No endpoint may read or change a client row. Clients are created + * by an operator running `create-oauth-client.ts`, so every one of + * the plugin's client CRUD endpoints — create, read, list, update, + * delete, rotate — is refused at the source. The route-level POST + * blocklist stays as defence in depth, but this is what closes the + * `GET` readers it cannot see, and what keeps a future plugin + * version from mounting a seventh endpoint into an open door. + * + * The consent page's client lookup is unaffected: `public-client` + * does not consult this hook. + */ + clientPrivileges: () => false, + /** + * Opaque access tokens, so revoking an app in settings or running + * `sim logout` takes effect on the very next request. A JWT would + * stay valid until it lapsed. + * + * The cost is that client secrets are stored reversibly: with no + * JWKS, the plugin signs ID tokens with the client secret and so + * has to be able to read it back. `storeClientSecret` is left at + * the plugin's default of `encrypted` for that reason — setting it + * to `hashed` here is refused at construction, which would take + * the whole app down on boot. Secrets are encrypted under + * `BETTER_AUTH_SECRET`; `create-oauth-client.ts` writes them the + * same way. + */ + disableJwtPlugin: true, + storeTokens: { hash: hashOAuthToken }, + prefix: { + opaqueAccessToken: OAUTH_ACCESS_TOKEN_PREFIX, + refreshToken: OAUTH_REFRESH_TOKEN_PREFIX, + }, + accessTokenExpiresIn: OAUTH_ACCESS_TOKEN_TTL_SECONDS, + refreshTokenExpiresIn: OAUTH_REFRESH_TOKEN_TTL_SECONDS, + codeExpiresIn: OAUTH_CODE_TTL_SECONDS, + }), + ] + : []), /** * Include SSO plugin when enabled. Resolved through `isSsoEnabled` rather * than the raw env var so the `ENTERPRISE_ENABLED` suite switch registers diff --git a/apps/sim/lib/auth/oauth-access-token.test.ts b/apps/sim/lib/auth/oauth-access-token.test.ts new file mode 100644 index 00000000000..b8983c31344 --- /dev/null +++ b/apps/sim/lib/auth/oauth-access-token.test.ts @@ -0,0 +1,116 @@ +/** + * @vitest-environment node + */ +import { dbChainMockFns, queueTableRows, resetDbChainMock, schemaMock } from '@sim/testing' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +vi.mock('@/lib/auth/oauth-provider', () => ({ OAUTH_ACCESS_TOKEN_PREFIX: 'sim_oat_' })) +vi.mock('@sim/security/hash', () => ({ sha256Hex: (value: string) => `hash:${value}` })) + +import { + InvalidOAuthAccessTokenError, + parseBearerToken, + verifyOAuthAccessToken, +} from '@/lib/auth/oauth-access-token' + +function row(overrides: Record = {}) { + return { + id: 'token-1', + userId: 'user-1', + clientId: 'sim-cli', + scopes: ['openid', 'api:read'], + expiresAt: new Date(Date.now() + 60_000), + clientDisabled: false, + userBanned: false, + userExists: 'user-1', + ...overrides, + } +} + +async function reason(token: string): Promise { + const failure = await verifyOAuthAccessToken(token).catch((error) => error) + expect(failure).toBeInstanceOf(InvalidOAuthAccessTokenError) + return failure.reason +} + +describe('parseBearerToken', () => { + it('reads exactly one bearer credential and nothing else', () => { + expect(parseBearerToken(new Headers({ authorization: 'Bearer sim_oat_abc' }))).toBe( + 'sim_oat_abc' + ) + expect(parseBearerToken(new Headers({ authorization: 'Bearer sim_oat_abc ' }))).toBe( + 'sim_oat_abc' + ) + expect(parseBearerToken(new Headers())).toBeNull() + expect(parseBearerToken(new Headers({ authorization: 'Basic abc' }))).toBeNull() + expect(parseBearerToken(new Headers({ authorization: 'Bearer ' }))).toBeNull() + expect(parseBearerToken(new Headers({ authorization: 'Bearer a b' }))).toBeNull() + }) + + /** + * RFC 7235 §2.1 defines the scheme as case-insensitive, so `bearer` is a + * real credential. Reading it as no credential would let it past the + * optional-auth path as an anonymous request instead of being refused. + */ + it('matches the scheme case-insensitively', () => { + expect(parseBearerToken(new Headers({ authorization: 'bearer sim_oat_abc' }))).toBe( + 'sim_oat_abc' + ) + expect(parseBearerToken(new Headers({ authorization: 'BEARER sim_oat_abc' }))).toBe( + 'sim_oat_abc' + ) + }) +}) + +describe('verifyOAuthAccessToken', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + }) + + it('looks the token up by its hash and returns the principal it stands for', async () => { + queueTableRows(schemaMock.oauthAccessToken, [row()]) + + const principal = await verifyOAuthAccessToken('sim_oat_secret') + + expect(principal).toEqual({ + kind: 'oauth_access_token', + userId: 'user-1', + clientId: 'sim-cli', + tokenId: 'token-1', + scopes: ['openid', 'api:read'], + expiresAt: expect.any(Date), + }) + expect(dbChainMockFns.where).toHaveBeenCalledOnce() + expect(JSON.stringify(dbChainMockFns.where.mock.calls[0])).toContain('hash:secret') + }) + + it('refuses a credential that is not one of ours without a database read', async () => { + expect(await reason('sim_abc')).toBe('malformed') + expect(await reason('sim_oat_')).toBe('malformed') + expect(dbChainMockFns.where).not.toHaveBeenCalled() + }) + + it('refuses an unknown, expired, disabled-client, orphaned, or banned token', async () => { + expect(await reason('sim_oat_unknown')).toBe('unknown') + + queueTableRows(schemaMock.oauthAccessToken, [row({ expiresAt: new Date(Date.now() - 1) })]) + expect(await reason('sim_oat_x')).toBe('expired') + + queueTableRows(schemaMock.oauthAccessToken, [row({ clientDisabled: true })]) + expect(await reason('sim_oat_x')).toBe('client_disabled') + + queueTableRows(schemaMock.oauthAccessToken, [row({ userId: null, userExists: null })]) + expect(await reason('sim_oat_x')).toBe('user_missing') + + queueTableRows(schemaMock.oauthAccessToken, [row({ userBanned: true })]) + expect(await reason('sim_oat_x')).toBe('user_banned') + }) + + it('propagates a store failure rather than reporting an invalid token', async () => { + const failure = new Error('database unavailable') + dbChainMockFns.limit.mockRejectedValueOnce(failure) + + await expect(verifyOAuthAccessToken('sim_oat_x')).rejects.toBe(failure) + }) +}) diff --git a/apps/sim/lib/auth/oauth-access-token.ts b/apps/sim/lib/auth/oauth-access-token.ts new file mode 100644 index 00000000000..9ad657bda57 --- /dev/null +++ b/apps/sim/lib/auth/oauth-access-token.ts @@ -0,0 +1,114 @@ +import type { OAuthAccessTokenPrincipal } from '@sim/auth/principal' +import { db } from '@sim/db' +import { oauthAccessToken, oauthClient, user } from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { sha256Hex } from '@sim/security/hash' +import { eq } from 'drizzle-orm' +import { OAUTH_ACCESS_TOKEN_PREFIX } from '@/lib/auth/oauth-provider' + +const logger = createLogger('OAuthAccessToken') + +const BEARER_SCHEME = /^Bearer[ ]+/i + +/** + * Hashes an issued token for storage and lookup. Handed to the plugin as + * `storeTokens.hash`, so the row the plugin writes and the row this file reads + * are computed by one function. The tokens are 32 random alphanumerics (190 + * bits), so a fast digest is the right construction — see the note on + * {@link sha256Hex}. + * + * It lives here rather than beside the other OAuth vocabulary because + * `sha256Hex` pulls in `node:crypto`: the consent card and the authorized-apps + * settings page both import that module for their scope wording, so anything + * server-only in it would follow them into the browser bundle. + */ +export function hashOAuthToken(token: string): string { + return sha256Hex(token) +} + +export type InvalidOAuthAccessTokenReason = + | 'malformed' + | 'unknown' + | 'expired' + | 'client_disabled' + | 'user_missing' + | 'user_banned' + +export class InvalidOAuthAccessTokenError extends Error { + constructor(readonly reason: InvalidOAuthAccessTokenReason) { + super('Invalid access token') + this.name = 'InvalidOAuthAccessTokenError' + } +} + +/** + * The single token in an `Authorization: Bearer` header, or `null` when the + * header is absent or carries another scheme. + * + * The scheme is matched case-insensitively because RFC 7235 §2.1 defines it + * that way — `bearer foo` is a well-formed credential, and treating it as no + * credential at all would let it through the optional-auth path as an + * anonymous request instead of refusing it. The credential itself is still + * strict: a header carrying two tokens or an empty value is refused rather + * than guessed at. + */ +export function parseBearerToken(headers: Headers): string | null { + const header = headers.get('authorization') + if (!header || !BEARER_SCHEME.test(header)) return null + const token = header.replace(BEARER_SCHEME, '').trim() + return token && !/\s/.test(token) ? token : null +} + +/** Whether a bearer credential is one of Sim's own OAuth access tokens, by its prefix. */ +function looksLikeOAuthAccessToken(token: string): boolean { + return token.startsWith(OAUTH_ACCESS_TOKEN_PREFIX) +} + +/** + * Resolves an opaque OAuth access token to the principal it stands for. + * + * One indexed read: the token is hashed the same way the provider stored it and + * joined to its client and user, so the checks the API-key path makes about a + * key row — not expired, owner still exists, owner not banned — are made here + * about the token row, plus the one that is new: the client has not been + * disabled. Nothing about the token is cached; that is what makes revoking an + * app in settings, or `sim logout`, take effect on the very next request. + */ +export async function verifyOAuthAccessToken(token: string): Promise { + if (!looksLikeOAuthAccessToken(token)) throw new InvalidOAuthAccessTokenError('malformed') + const raw = token.slice(OAUTH_ACCESS_TOKEN_PREFIX.length) + if (!raw) throw new InvalidOAuthAccessTokenError('malformed') + + const [row] = await db + .select({ + id: oauthAccessToken.id, + userId: oauthAccessToken.userId, + clientId: oauthAccessToken.clientId, + scopes: oauthAccessToken.scopes, + expiresAt: oauthAccessToken.expiresAt, + clientDisabled: oauthClient.disabled, + userBanned: user.banned, + userExists: user.id, + }) + .from(oauthAccessToken) + .innerJoin(oauthClient, eq(oauthAccessToken.clientId, oauthClient.clientId)) + .leftJoin(user, eq(oauthAccessToken.userId, user.id)) + .where(eq(oauthAccessToken.token, hashOAuthToken(raw))) + .limit(1) + + if (!row) throw new InvalidOAuthAccessTokenError('unknown') + if (row.expiresAt <= new Date()) throw new InvalidOAuthAccessTokenError('expired') + if (row.clientDisabled) throw new InvalidOAuthAccessTokenError('client_disabled') + if (!row.userId || !row.userExists) throw new InvalidOAuthAccessTokenError('user_missing') + if (row.userBanned) throw new InvalidOAuthAccessTokenError('user_banned') + + logger.debug('Authenticated OAuth access token', { tokenId: row.id, clientId: row.clientId }) + return { + kind: 'oauth_access_token', + userId: row.userId, + clientId: row.clientId, + tokenId: row.id, + scopes: row.scopes, + expiresAt: row.expiresAt, + } +} diff --git a/apps/sim/lib/auth/oauth-principal.test.ts b/apps/sim/lib/auth/oauth-principal.test.ts new file mode 100644 index 00000000000..bea72dc2b04 --- /dev/null +++ b/apps/sim/lib/auth/oauth-principal.test.ts @@ -0,0 +1,71 @@ +/** + * @vitest-environment node + */ +import { + isUserCredentialPrincipal, + type OAuthAccessTokenPrincipal, + parsePrincipal, + resolvePrincipalAttribution, + resolvePrincipalAuditAttribution, + resolvePrincipalSubject, + serializePrincipal, + toPrincipalActor, +} from '@sim/auth/principal' +import { describe, expect, it } from 'vitest' + +const principal: OAuthAccessTokenPrincipal = { + kind: 'oauth_access_token', + userId: 'user-1', + clientId: 'sim-cli', + tokenId: 'token-1', + scopes: ['openid', 'api:read'], + expiresAt: new Date('2027-01-01T00:00:00.000Z'), +} + +describe('oauth_access_token principal', () => { + it('stands for the person, like a personal API key', () => { + expect(resolvePrincipalSubject(principal)).toEqual({ kind: 'sim_user', userId: 'user-1' }) + expect(isUserCredentialPrincipal(principal)).toBe(true) + expect(resolvePrincipalAttribution(principal).attributedUserId).toBe('user-1') + expect(resolvePrincipalAuditAttribution(principal)).toEqual({ + actor: { + kind: 'oauth_access_token', + tokenId: 'token-1', + clientId: 'sim-cli', + userId: 'user-1', + }, + actorId: 'user-1', + }) + expect(toPrincipalActor(principal)).not.toHaveProperty('scopes') + }) + + it('round-trips through the execution serialization carrying only the token id', () => { + const serialized = serializePrincipal(principal) + // The exact key set, not a `toMatchObject` subset: the point of the + // assertion is that nothing beyond these six fields crosses into an + // execution payload, and a subset match would pass however many were added. + expect(Object.keys(serialized.principal as object).sort()).toEqual([ + 'clientId', + 'expiresAt', + 'kind', + 'scopes', + 'tokenId', + 'userId', + ]) + expect(serialized.principal).toMatchObject({ expiresAt: '2027-01-01T00:00:00.000Z' }) + expect(parsePrincipal(structuredClone(serialized))).toEqual(principal) + }) + + it('refuses a serialized form with extra or malformed fields', () => { + const serialized = serializePrincipal(principal) + expect(() => + parsePrincipal({ ...serialized, principal: { ...serialized.principal, accessToken: 'x' } }) + ).toThrow('unsupported field accessToken') + expect(() => + parsePrincipal({ ...serialized, principal: { ...serialized.principal, scopes: 'api:read' } }) + ).toThrow('scopes must be an array') + expect(() => + parsePrincipal({ ...serialized, principal: { ...serialized.principal, expiresAt: 'soon' } }) + ).toThrow('expiresAt must be an ISO timestamp') + }) +}) diff --git a/apps/sim/lib/auth/oauth-provider.test.ts b/apps/sim/lib/auth/oauth-provider.test.ts new file mode 100644 index 00000000000..0ff485a41e8 --- /dev/null +++ b/apps/sim/lib/auth/oauth-provider.test.ts @@ -0,0 +1,73 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { + consentRequestNamesClient, + OAUTH_API_READ_SCOPE, + OAUTH_API_WRITE_SCOPE, + oauthScopeSatisfies, + SIM_CLI_CLIENT_ID, + summarizeOAuthAccess, + visibleOAuthScopes, +} from '@/lib/auth/oauth-provider' + +describe('oauthScopeSatisfies', () => { + it('treats api:write as a superset of api:read, but never the reverse', () => { + expect(oauthScopeSatisfies([OAUTH_API_WRITE_SCOPE], OAUTH_API_READ_SCOPE)).toBe(true) + expect(oauthScopeSatisfies([OAUTH_API_READ_SCOPE], OAUTH_API_WRITE_SCOPE)).toBe(false) + expect(oauthScopeSatisfies(['openid', 'profile'], OAUTH_API_READ_SCOPE)).toBe(false) + }) +}) + +describe('visibleOAuthScopes', () => { + it('drops the read scope a granted write scope already implies', () => { + expect( + visibleOAuthScopes(['openid', OAUTH_API_READ_SCOPE, OAUTH_API_WRITE_SCOPE]) + ).not.toContain(OAUTH_API_READ_SCOPE) + }) + + it('ignores a scope the provider does not issue', () => { + expect(visibleOAuthScopes(['openid', 'admin:everything'])).toEqual(['openid']) + }) +}) + +describe('summarizeOAuthAccess', () => { + it('names the widest access the grant carries', () => { + expect(summarizeOAuthAccess([OAUTH_API_READ_SCOPE, OAUTH_API_WRITE_SCOPE])).toBe( + 'Full access to your workspaces' + ) + expect(summarizeOAuthAccess([OAUTH_API_READ_SCOPE])).toBe('Read-only access to your workspaces') + expect(summarizeOAuthAccess(['openid', 'email'])).toBe('Sign in only') + }) +}) + +describe('consentRequestNamesClient', () => { + it('matches the client the signed authorize query names', () => { + expect( + consentRequestNamesClient(`client_id=${SIM_CLI_CLIENT_ID}&scope=openid`, SIM_CLI_CLIENT_ID) + ).toBe(true) + expect(consentRequestNamesClient('client_id=partner-app', SIM_CLI_CLIENT_ID)).toBe(false) + }) + + /** + * The gate must not be escapable by putting a decoy first: `get` answers with + * the first occurrence, so a repeated parameter would otherwise let a consent + * for the CLI skip the `cli.use` check. + */ + it('matches a repeated client_id in any position', () => { + expect( + consentRequestNamesClient( + `client_id=partner-app&client_id=${SIM_CLI_CLIENT_ID}`, + SIM_CLI_CLIENT_ID + ) + ).toBe(true) + }) + + it('answers false for a body that carries no query at all', () => { + expect(consentRequestNamesClient(undefined, SIM_CLI_CLIENT_ID)).toBe(false) + expect(consentRequestNamesClient({ client_id: SIM_CLI_CLIENT_ID }, SIM_CLI_CLIENT_ID)).toBe( + false + ) + }) +}) diff --git a/apps/sim/lib/auth/oauth-provider.ts b/apps/sim/lib/auth/oauth-provider.ts new file mode 100644 index 00000000000..af89b175a3d --- /dev/null +++ b/apps/sim/lib/auth/oauth-provider.ts @@ -0,0 +1,99 @@ +/** + * Constants shared by every side of Sim's OAuth 2.1 provider: the Better Auth + * plugin configuration, the consent page, the bearer-token verifier, and the + * "Authorized apps" settings surface. + */ + +/** The first-party Sim CLI, seeded by migration `0321_oauth_provider` as a public client. */ +export const SIM_CLI_CLIENT_ID = 'sim-cli' + +/** + * Prefixes returned on issued tokens (never stored). They make a leaked token + * recognizable to secret scanners and to a human reading a log, the same way + * `sim_` marks an API key. + */ +export const OAUTH_ACCESS_TOKEN_PREFIX = 'sim_oat_' +export const OAUTH_REFRESH_TOKEN_PREFIX = 'sim_ort_' + +/** Grants the Sim API: `api:write` implies `api:read`. */ +export const OAUTH_API_READ_SCOPE = 'api:read' +export const OAUTH_API_WRITE_SCOPE = 'api:write' + +export const OAUTH_SCOPES = [ + 'openid', + 'profile', + 'email', + 'offline_access', + OAUTH_API_READ_SCOPE, + OAUTH_API_WRITE_SCOPE, +] as const + +export type OAuthScope = (typeof OAUTH_SCOPES)[number] + +/** + * Token lifetimes, in seconds, as the plugin takes them. + * + * An hour of access matches what gcloud and the AWS CLI issue, and is short + * enough that revoking an app in settings is felt within the hour even for a + * client that never refreshes. Thirty days of refresh is the plugin's own + * default and means a daily user signs in roughly monthly. + */ +export const OAUTH_ACCESS_TOKEN_TTL_SECONDS = 60 * 60 +export const OAUTH_REFRESH_TOKEN_TTL_SECONDS = 30 * 24 * 60 * 60 +/** How long an authorization code stays redeemable — the plugin's default. */ +export const OAUTH_CODE_TTL_SECONDS = 10 * 60 +export type OAuthApiScope = typeof OAUTH_API_READ_SCOPE | typeof OAUTH_API_WRITE_SCOPE + +/** One plain-English line per scope, rendered on the consent page. */ +export const OAUTH_SCOPE_DESCRIPTIONS: Record = { + openid: 'Confirm who you are', + profile: 'See your name and profile picture', + email: 'See your email address', + offline_access: 'Stay signed in without asking again', + [OAUTH_API_READ_SCOPE]: 'Read your workspaces, workflows, files, tables, and logs', + [OAUTH_API_WRITE_SCOPE]: 'Create, change, run, and delete resources in your workspaces', +} + +/** + * The scopes worth showing a person, in declaration order. + * + * `api:write` implies `api:read`, so a client that asked for both is granted + * both — and listing them together reads as two permissions when it is one. + * Dropping the implied scope keeps the consent page honest about how much it + * is actually asking for. + */ +export function visibleOAuthScopes(granted: readonly string[]): OAuthScope[] { + const implied = granted.includes(OAUTH_API_WRITE_SCOPE) ? OAUTH_API_READ_SCOPE : null + return OAUTH_SCOPES.filter((scope) => scope !== implied && granted.includes(scope)) +} + +/** What a grant lets an app reach, as one line for a settings row. */ +export function summarizeOAuthAccess(granted: readonly string[]): string { + if (granted.includes(OAUTH_API_WRITE_SCOPE)) return 'Full access to your workspaces' + if (granted.includes(OAUTH_API_READ_SCOPE)) return 'Read-only access to your workspaces' + return 'Sign in only' +} + +/** + * Whether a granted scope set satisfies a required API scope. `api:write` is a + * superset of `api:read`, so a write-capable token never has to also carry the + * read scope explicitly. + */ +export function oauthScopeSatisfies(granted: readonly string[], required: OAuthApiScope): boolean { + if (granted.includes(required)) return true + return required === OAUTH_API_READ_SCOPE && granted.includes(OAUTH_API_WRITE_SCOPE) +} + +/** + * Whether a consent request names the client given, read from the signed + * authorize query the consent page forwards. + * + * Every occurrence is checked, not just the first. The plugin reads the same + * query with `.get()`, so on a well-formed request the two always agree; on a + * query carrying `client_id` twice this answers true where `.get()` would not, + * which errs toward running the gate rather than skipping it. + */ +export function consentRequestNamesClient(oauthQuery: unknown, clientId: string): boolean { + if (typeof oauthQuery !== 'string') return false + return new URLSearchParams(oauthQuery).getAll('client_id').includes(clientId) +} diff --git a/apps/sim/lib/billing/application/authorized-billing-read-use-case.ts b/apps/sim/lib/billing/application/authorized-billing-read-use-case.ts index 5a6105d6cf1..07c036fea12 100644 --- a/apps/sim/lib/billing/application/authorized-billing-read-use-case.ts +++ b/apps/sim/lib/billing/application/authorized-billing-read-use-case.ts @@ -1,13 +1,14 @@ -import type { Principal } from '@sim/auth/principal' +import { isUserCredentialPrincipal, type Principal } from '@sim/auth/principal' import { permissionSatisfies, resolveEffectiveWorkspacePermission, } from '@sim/platform-authz/workspace' +import { SIM_CLI_CLIENT_ID } from '@/lib/auth/oauth-provider' import type { BillingReadOperation, BillingReadPrincipal, } from '@/lib/billing/application/operations' -import { type OperationUseCase, requirePersonalApiKeysAllowed } from '@/lib/core/application' +import { type OperationUseCase, requireUserCredentialCapabilities } from '@/lib/core/application' import { InsufficientWorkspacePermissionsError, NoWorkspaceAccessError, @@ -16,6 +17,7 @@ import { WorkspaceApiKeyScopeAuthorizationError, } from '@/lib/core/application/workspace-authorization' import { OrchestrationError } from '@/lib/core/orchestration/types' +import { refuseCapability } from '@/lib/permission-groups/capabilities' import { isCapabilityWithheldForUser } from '@/lib/permission-groups/user-scope.server' import { type ActiveWorkspaceApplicationContext, @@ -82,11 +84,22 @@ async function resolveBillingReadScope( * the same one the personal-API-key and CLI mint paths use. A no-op when the * caller is in no organization or no group governs them. */ - if ( - principal.kind === 'personal_api_key' && - (await isCapabilityWithheldForUser(principal.userId, 'personal_api_key.use')) - ) { - throw new PersonalApiKeysDisabledError() + if (isUserCredentialPrincipal(principal)) { + if (await isCapabilityWithheldForUser(principal.userId, 'personal_api_key.use')) { + throw new PersonalApiKeysDisabledError() + } + /** + * permission-group-enforced: cli.use — a CLI token reads the account's + * plan, balance and usage here without naming a workspace, so the + * workspace-scoped check in the funnel never sees it. + */ + if ( + principal.kind === 'oauth_access_token' && + principal.clientId === SIM_CLI_CLIENT_ID && + (await isCapabilityWithheldForUser(principal.userId, 'cli.use')) + ) { + refuseCapability('cli.use') + } } return { kind: 'account', userId: principal.userId } } @@ -98,7 +111,7 @@ async function resolveBillingReadScope( const workspace = await loadActiveWorkspaceApplicationContext(workspaceId) if (!workspace) throw new OrchestrationError('not_found', 'Workspace not found') - if (principal.kind === 'personal_api_key') { + if (isUserCredentialPrincipal(principal)) { if (!workspace.allowPersonalApiKeys) { throw new PersonalApiKeysDisabledError() } @@ -112,17 +125,18 @@ async function resolveBillingReadScope( throw new InsufficientWorkspacePermissionsError() } /** - * permission-group-enforced: personal_api_key.use — this path resolves its - * own workspace scope instead of running through - * `authorizeWorkspaceOperation`, so the funnel's personal-key refusal has to - * be repeated here or the same key the funnel refuses still reads billing. + * permission-group-enforced: personal_api_key.use, cli.use — this path + * resolves its own workspace scope instead of running through + * `authorizeWorkspaceOperation`, so the funnel's capability refusals have + * to be repeated here or the same credential the funnel refuses still + * reads billing. * * After the role check, like the funnel: it answers with a 403 naming how an * organization configured one cohort, and running it ahead of the concealed * no-access refusal would hand that to a caller with no reach into the * workspace at all. */ - await requirePersonalApiKeysAllowed(principal.userId, workspace) + await requireUserCredentialCapabilities(principal, workspace) } return { kind: 'workspace', workspace } diff --git a/apps/sim/lib/billing/application/get-billing-status.ts b/apps/sim/lib/billing/application/get-billing-status.ts index 4ff70ea0fc3..0429676f2f2 100644 --- a/apps/sim/lib/billing/application/get-billing-status.ts +++ b/apps/sim/lib/billing/application/get-billing-status.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { defineAuthorizedBillingReadUseCase } from '@/lib/billing/application/authorized-billing-read-use-case' import { type BillingReadPrincipal, billingOperations } from '@/lib/billing/application/operations' import { @@ -104,7 +105,7 @@ async function canReadPayerPool( principal: BillingReadPrincipal, workspace: WorkspaceBillingAuthorityContext ): Promise { - if (principal.kind !== 'personal_api_key') return false + if (!isUserCredentialPrincipal(principal)) return false return canUserManageWorkspaceBilling(workspace, principal.userId) } @@ -157,7 +158,7 @@ export const getBillingStatus = defineAuthorizedBillingReadUseCase({ execute: async ({ principal, scope }): Promise => { if (scope.kind === 'workspace') { const [attribution, canViewPayerPool] = await Promise.all([ - principal.kind === 'personal_api_key' + isUserCredentialPrincipal(principal) ? resolveBillingAttribution({ actorUserId: principal.userId, workspaceId: scope.workspace.workspaceId, diff --git a/apps/sim/lib/billing/application/list-billing-logs.ts b/apps/sim/lib/billing/application/list-billing-logs.ts index 63820fd49ba..f117ddd7e74 100644 --- a/apps/sim/lib/billing/application/list-billing-logs.ts +++ b/apps/sim/lib/billing/application/list-billing-logs.ts @@ -1,3 +1,4 @@ +import { isUserCredentialPrincipal } from '@sim/auth/principal' import { defineAuthorizedBillingReadUseCase } from '@/lib/billing/application/authorized-billing-read-use-case' import { billingOperations } from '@/lib/billing/application/operations' import { @@ -61,7 +62,7 @@ export const listBillingLogs = defineAuthorizedBillingReadUseCase({ cursor: input.cursor, includeSummary: false, } - if (principal.kind === 'personal_api_key') { + if (isUserCredentialPrincipal(principal)) { const workspaceId = scope.kind === 'workspace' ? scope.workspace.workspaceId : undefined const usage = await getUserUsageLogs(principal.userId, { ...query, workspaceId }) return { usage, creditsByLogId: apportionLogCredits(usage), scope: 'user' } diff --git a/apps/sim/lib/billing/application/operations.ts b/apps/sim/lib/billing/application/operations.ts index f8a116fb6cd..90fac2e5816 100644 --- a/apps/sim/lib/billing/application/operations.ts +++ b/apps/sim/lib/billing/application/operations.ts @@ -4,14 +4,14 @@ import { assertOperationCapability } from '@/lib/core/application' export type BillingReadPrincipal = Extract< Principal, - { kind: 'personal_api_key' | 'workspace_api_key' } + { kind: 'personal_api_key' | 'oauth_access_token' | 'workspace_api_key' } > export interface BillingReadOperation extends ApplicationOperation { readonly accountScope: 'personal_self' readonly workspaceMinimumRole: 'read' readonly workspaceApiKey: 'workspace_only' - readonly principalKinds: readonly ['personal_api_key', 'workspace_api_key'] + readonly principalKinds: readonly ['personal_api_key', 'oauth_access_token', 'workspace_api_key'] } function defineBillingReadOperation( @@ -33,7 +33,7 @@ export const billingOperations = { accountScope: 'personal_self', workspaceMinimumRole: 'read', workspaceApiKey: 'workspace_only', - principalKinds: ['personal_api_key', 'workspace_api_key'], + principalKinds: ['personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), // permission-group-exempt: the same personal billing account reading its own usage records; no group key names it listLogs: defineBillingReadOperation({ @@ -42,6 +42,6 @@ export const billingOperations = { accountScope: 'personal_self', workspaceMinimumRole: 'read', workspaceApiKey: 'workspace_only', - principalKinds: ['personal_api_key', 'workspace_api_key'], + principalKinds: ['personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), } as const diff --git a/apps/sim/lib/catalog/application/operations.test.ts b/apps/sim/lib/catalog/application/operations.test.ts index 7b1ce4d4421..c7e16079d30 100644 --- a/apps/sim/lib/catalog/application/operations.test.ts +++ b/apps/sim/lib/catalog/application/operations.test.ts @@ -50,6 +50,7 @@ describe('catalogOperations', () => { expect(operation.minimumRole, operation.id).toBe('read') expect(operation.workspaceApiKey, operation.id).toBe('allow') expect([...operation.principalKinds].sort(), operation.id).toEqual([ + 'oauth_access_token', 'personal_api_key', 'session', 'workspace_api_key', diff --git a/apps/sim/lib/catalog/application/operations.ts b/apps/sim/lib/catalog/application/operations.ts index 8ee9e1453d5..0be5610200d 100644 --- a/apps/sim/lib/catalog/application/operations.ts +++ b/apps/sim/lib/catalog/application/operations.ts @@ -28,7 +28,7 @@ export const catalogOperations = { minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), // permission-group-exempt: one entry of the same catalog listBlocks returns, so it cannot be governed differently readBlock: defineWorkspaceOperation({ @@ -36,7 +36,7 @@ export const catalogOperations = { minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), // permission-group-exempt: describes which tools exist; whether a member may call one is decided on that tool's own operation listTools: defineWorkspaceOperation({ @@ -44,7 +44,7 @@ export const catalogOperations = { minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), // permission-group-exempt: one entry of the same catalog listTools returns, so it cannot be governed differently readTool: defineWorkspaceOperation({ @@ -52,7 +52,7 @@ export const catalogOperations = { minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), /** * The only catalog with a capability: it enumerates knowledge-base connector @@ -64,6 +64,6 @@ export const catalogOperations = { minimumRole: 'read', workspaceApiKey: 'allow', capability: 'knowledge.use', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), } as const diff --git a/apps/sim/lib/chat-deployments/application/operations.ts b/apps/sim/lib/chat-deployments/application/operations.ts index 0ea237e3977..1466e615006 100644 --- a/apps/sim/lib/chat-deployments/application/operations.ts +++ b/apps/sim/lib/chat-deployments/application/operations.ts @@ -21,7 +21,13 @@ import { defineWorkspaceOperation } from '@/lib/core/application' * deploying rather than a chat surface the caller is configuring. */ const CHAT_DEPLOYMENT_LIST_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], } as const @@ -37,7 +43,7 @@ const CHAT_DEPLOYMENT_LIST_POLICY = { * workspace API keys, which cannot exceed the write ceiling. */ const CHAT_DEPLOYMENT_ADMIN_POLICY = { - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], } as const diff --git a/apps/sim/lib/copilot/application/operations.ts b/apps/sim/lib/copilot/application/operations.ts index 7a910261cb5..ea08bf03a7e 100644 --- a/apps/sim/lib/copilot/application/operations.ts +++ b/apps/sim/lib/copilot/application/operations.ts @@ -12,6 +12,6 @@ export const chatOperations = { minimumRole: 'read', workspaceApiKey: 'deny', capability: 'copilot.use', - principalKinds: ['personal_api_key'], + principalKinds: ['personal_api_key', 'oauth_access_token'], }), } as const diff --git a/apps/sim/lib/core/application/forbidden.ts b/apps/sim/lib/core/application/forbidden.ts index 766b0891c69..13f8f5e61d2 100644 --- a/apps/sim/lib/core/application/forbidden.ts +++ b/apps/sim/lib/core/application/forbidden.ts @@ -64,6 +64,8 @@ export const FORBIDDEN_DETAIL_CODES = [ 'PERMISSION_GROUP_CAPABILITY_BLOCKED', /** The workspace does not permit the integration the request names. */ 'INTEGRATION_NOT_ALLOWED', + /** The OAuth access token was not granted the scope this operation needs. */ + 'INSUFFICIENT_SCOPE', ] as const export type ForbiddenDetailCode = (typeof FORBIDDEN_DETAIL_CODES)[number] @@ -113,6 +115,8 @@ export const FORBIDDEN_DETAIL_CODE_DESCRIPTIONS: Record { ).toBe('user-3') }) }) + +describe('authorizeWorkspaceOperation OAuth access token policy', () => { + const readOperation = defineWorkspaceOperation({ + id: 'test.oauth-read', + minimumRole: 'read', + workspaceApiKey: 'deny', + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], + capability: 'none', + }) + const oauthWriteOperation = defineWorkspaceOperation({ + id: 'test.oauth-write', + minimumRole: 'write', + workspaceApiKey: 'deny', + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], + capability: 'none', + }) + + function token(overrides: Partial = {}): OAuthAccessTokenPrincipal { + return { + kind: 'oauth_access_token', + userId: 'user-1', + clientId: 'sim-cli', + tokenId: 'token-1', + scopes: ['openid', 'api:read', 'api:write'], + expiresAt: new Date('2099-01-01T00:00:00.000Z'), + ...overrides, + } + } + + beforeEach(() => { + vi.clearAllMocks() + mocks.resolvePermission.mockResolvedValue('admin') + resolveGroupConfigMock.mockResolvedValue(DEFAULT_PERMISSION_GROUP_CONFIG) + }) + + it('walks the personal-key sequence for a token with the right scope', async () => { + await expect( + authorizeWorkspaceOperation(token(), oauthWriteOperation, context) + ).resolves.toBeUndefined() + expect(mocks.resolvePermission).toHaveBeenCalledWith( + 'user-1', + 'workspace-1', + 'organization-1', + undefined, + { forUpdate: undefined } + ) + expect(resolveGroupConfigMock).toHaveBeenCalled() + }) + + it('refuses a token carrying neither API scope before touching the workspace', async () => { + const failure = await authorizeWorkspaceOperation( + token({ scopes: ['openid', 'profile'] }), + readOperation, + context + ).catch((error) => error) + + expect(failure).toBeInstanceOf(InsufficientScopeError) + expect(failure.requiredScope).toBe('api:read') + expect(failure.detailCode).toBe('INSUFFICIENT_SCOPE') + expect(mocks.resolvePermission).not.toHaveBeenCalled() + }) + + /** + * The funnel enforces only the read floor. Which requests count as writes is + * decided from the HTTP method at v2 admission, because `minimumRole` does + * not answer it: several POST routes only read (search, query, count), so + * deriving the scope from the role let a read-only token perform them. + */ + it('leaves the write decision to the surface, admitting a read-only token on a write operation', async () => { + await expect( + authorizeWorkspaceOperation( + token({ scopes: ['openid', 'api:read'] }), + oauthWriteOperation, + context + ) + ).resolves.toBeUndefined() + }) + + it('lets api:write satisfy a read operation', async () => { + await expect( + authorizeWorkspaceOperation( + token({ scopes: ['openid', 'api:write'] }), + readOperation, + context + ) + ).resolves.toBeUndefined() + }) + + /** + * The request-time half of the `cli.use` gate. The consent page enforces it + * when the grant is made, but a consent already on file lets every later + * authorization skip that endpoint — so withdrawing the capability has to + * stop the token already in the user's hands. + */ + it('refuses a Sim CLI token once the group withholds cli.use', async () => { + resolveGroupConfigMock.mockResolvedValue({ + ...DEFAULT_PERMISSION_GROUP_CONFIG, + disableCliAccess: true, + }) + + await expect( + authorizeWorkspaceOperation(token(), readOperation, context) + ).rejects.toBeInstanceOf(PermissionGroupCapabilityError) + }) + + it('leaves a third-party client alone, which cli.use does not govern', async () => { + resolveGroupConfigMock.mockResolvedValue({ + ...DEFAULT_PERMISSION_GROUP_CONFIG, + disableCliAccess: true, + }) + + await expect( + authorizeWorkspaceOperation(token({ clientId: 'partner-app' }), readOperation, context) + ).resolves.toBeUndefined() + }) + + it('refuses a lapsed token as unauthorized rather than forbidden', async () => { + const failure = await authorizeWorkspaceOperation( + token({ expiresAt: new Date('2000-01-01T00:00:00.000Z') }), + readOperation, + context + ).catch((error) => error) + + expect(failure).toBeInstanceOf(OAuthAccessTokenExpiredError) + expect(failure.code).toBe('unauthorized') + }) + + it('is governed by the workspace personal-key column like a personal key', async () => { + await expect( + authorizeWorkspaceOperation(token(), readOperation, { + ...context, + allowPersonalApiKeys: false, + }) + ).rejects.toBeInstanceOf(PersonalApiKeysDisabledError) + expect(mocks.resolvePermission).not.toHaveBeenCalled() + }) + + it('is governed by the group personal-key setting, after the role check', async () => { + resolveGroupConfigMock.mockResolvedValue({ + ...DEFAULT_PERMISSION_GROUP_CONFIG, + disablePersonalApiKeys: true, + }) + + await expect( + authorizeWorkspaceOperation(token(), readOperation, context) + ).rejects.toBeInstanceOf(PersonalApiKeysDisabledError) + expect(mocks.resolvePermission).toHaveBeenCalled() + }) + + it('conceals a workspace the person cannot reach', async () => { + mocks.resolvePermission.mockResolvedValue(null) + + await expect( + authorizeWorkspaceOperation(token(), readOperation, context) + ).rejects.toBeInstanceOf(NoWorkspaceAccessError) + }) + + it('names the person for capability purposes', () => { + expect(capabilityGovernedPrincipalUserId(token())).toBe('user-1') + }) +}) diff --git a/apps/sim/lib/core/application/workspace-authorization.ts b/apps/sim/lib/core/application/workspace-authorization.ts index 2b834162911..88b4f8416d1 100644 --- a/apps/sim/lib/core/application/workspace-authorization.ts +++ b/apps/sim/lib/core/application/workspace-authorization.ts @@ -1,5 +1,7 @@ import { type DelegatedPrincipal, + type OAuthAccessTokenPrincipal, + type PersonalApiKeyPrincipal, type Principal, resolvePrincipalSubject, } from '@sim/auth/principal' @@ -9,6 +11,12 @@ import { permissionSatisfies, resolveEffectiveWorkspacePermission, } from '@sim/platform-authz/workspace' +import { + OAUTH_API_READ_SCOPE, + type OAuthApiScope, + oauthScopeSatisfies, + SIM_CLI_CLIENT_ID, +} from '@/lib/auth/oauth-provider' import { ForbiddenOperationError } from '@/lib/core/application/forbidden' import type { PrincipalForOperation, @@ -41,6 +49,7 @@ export function capabilityGovernedPrincipalUserId(principal: Principal): string switch (principal.kind) { case 'session': case 'personal_api_key': + case 'oauth_access_token': return principal.userId case 'workspace_api_key': case 'system': @@ -124,6 +133,25 @@ export class DelegatedWorkspaceAuthorizationError extends OrchestrationError { } } +export class InsufficientScopeError extends ForbiddenOperationError { + constructor(readonly requiredScope: OAuthApiScope) { + super('INSUFFICIENT_SCOPE', `This operation requires the ${requiredScope} scope`) + this.name = 'InsufficientScopeError' + } +} + +/** + * Concealed as a `401` by the surface: an expired token is no credential at + * all, and the verifier already refuses it, so reaching this means the token + * lapsed between authentication and authorization. + */ +export class OAuthAccessTokenExpiredError extends OrchestrationError { + constructor() { + super('unauthorized', 'OAuth access token has expired') + this.name = 'OAuthAccessTokenExpiredError' + } +} + export class PrincipalKindAuthorizationError extends ForbiddenOperationError { constructor(principalKind: Principal['kind'], operationId: string) { super( @@ -211,6 +239,40 @@ async function requireCapability( ) } +/** + * Refuses a token the Sim CLI holds when the caller's group withholds CLI use. + * + * permission-group-enforced: cli.use — the consent page enforces it when the + * grant is first made, but a consent already on file lets every later + * authorization skip the consent endpoint, and a refresh token keeps minting + * access tokens for a month. Withdrawing the capability has to stop the + * credential in use, not only the next fresh grant, so it is asked again here, + * on the request. The group config is request-cached and the personal-key check + * that runs just before this one has already read it, so it costs no extra + * query. + * + * Three surfaces authorize themselves instead of entering through the funnel. + * Billing and audit-log reads repeat this check at their own call sites, since + * both return data a withdrawn capability is meant to cut off. `/api/v2/meta` + * does not, and should not: it answers only with facts about the credential + * the caller already holds, so there is nothing there to withhold. + */ +export async function requireCliAccessAllowed( + clientId: string, + userId: string, + context: WorkspaceAuthorizationContext +): Promise { + if (clientId !== SIM_CLI_CLIENT_ID) return + if (context.workspaceOrganizationId === null) return + + await assertWorkspaceCapability( + userId, + context.workspaceId, + 'cli.use', + context.workspaceOrganizationId + ) +} + /** * Refuses a personal API key the caller's permission group withholds. * @@ -223,6 +285,24 @@ async function requireCapability( * own workspace scope. One copy, or the same key the funnel refuses keeps * working somewhere. */ +/** + * Both capability gates a user-held credential passes, in one call. + * + * The funnel runs these as part of its sequence, but three surfaces authorize + * themselves — billing reads, audit-log reads, and `/api/v2/meta` — and each + * has to repeat them. Repeating two separate calls is how one of them ends up + * with only the first: `cli.use` was missing from all three until this existed. + */ +export async function requireUserCredentialCapabilities( + principal: PersonalApiKeyPrincipal | OAuthAccessTokenPrincipal, + context: WorkspaceAuthorizationContext +): Promise { + await requirePersonalApiKeysAllowed(principal.userId, context) + if (principal.kind === 'oauth_access_token') { + await requireCliAccessAllowed(principal.clientId, principal.userId, context) + } +} + export async function requirePersonalApiKeysAllowed( userId: string, context: WorkspaceAuthorizationContext @@ -325,6 +405,48 @@ export async function authorizeWorkspaceOperation { dataDrains: false, dataRetention: false, inbox: true, + oauthProvider: true, sandboxes: true, sessionPolicies: true, sso: true, diff --git a/apps/sim/lib/core/config/deployment-shape.ts b/apps/sim/lib/core/config/deployment-shape.ts index a00429c6fce..7ce34a9a897 100644 --- a/apps/sim/lib/core/config/deployment-shape.ts +++ b/apps/sim/lib/core/config/deployment-shape.ts @@ -13,6 +13,7 @@ import { isDataRetentionEnabled, isHosted, isInboxEnabled, + isOAuthProviderEnabled, isSandboxesEnabled, isSessionPoliciesEnabled, isSsoEnabled, @@ -93,6 +94,7 @@ export function resolveDeploymentShape(): DeploymentShape { dataDrains: isDataDrainsEnabled, dataRetention: isDataRetentionEnabled, inbox: isInboxEnabled, + oauthProvider: isOAuthProviderEnabled, sandboxes: isSandboxesEnabled, sessionPolicies: isSessionPoliciesEnabled, sso: isSsoEnabled, diff --git a/apps/sim/lib/core/config/env-flags.ts b/apps/sim/lib/core/config/env-flags.ts index 9fe590a0a8a..e814d3b9033 100644 --- a/apps/sim/lib/core/config/env-flags.ts +++ b/apps/sim/lib/core/config/env-flags.ts @@ -315,6 +315,16 @@ function enterpriseFeatureEnabled( }) } +/** + * Is Sim acting as an OAuth 2.1 authorization server: the `/oauth2/*` Better + * Auth routes, the consent page, bearer-token acceptance on `/api/v2`, and the + * "Authorized apps" settings section. On by default because the seeded Sim CLI + * client is the only thing that can use it until an admin registers more; + * `OAUTH_PROVIDER_ENABLED=false` is the kill switch. Server-only: the browser + * reads it through the deployment shape. + */ +export const isOAuthProviderEnabled = !isFalsy(env.OAUTH_PROVIDER_ENABLED) + /** * Is SSO enabled for enterprise authentication */ diff --git a/apps/sim/lib/core/config/env.ts b/apps/sim/lib/core/config/env.ts index 8a77dc285cd..a49f5991799 100644 --- a/apps/sim/lib/core/config/env.ts +++ b/apps/sim/lib/core/config/env.ts @@ -620,6 +620,9 @@ export const env = createEnv({ /** Comma-separated proxy IPs/CIDRs skipped while resolving the forwarded client chain. */ AUTH_TRUSTED_PROXIES: z.string().optional(), + // Sim as an OAuth 2.1 provider (CLI sign-in, connected apps). On unless set to false. + OAUTH_PROVIDER_ENABLED: z.boolean().optional(), + // SSO Configuration (for script-based registration) SSO_ENABLED: z.boolean().optional(), // Enable SSO functionality USAGE_MONITORING_ENABLED: z.boolean().optional(), // Enable organization usage monitoring on self-hosted (bypasses hosted requirements) diff --git a/apps/sim/lib/credentials/application/operations.test.ts b/apps/sim/lib/credentials/application/operations.test.ts index 975e3b14668..e46754913fd 100644 --- a/apps/sim/lib/credentials/application/operations.test.ts +++ b/apps/sim/lib/credentials/application/operations.test.ts @@ -15,7 +15,7 @@ describe('credential operations', () => { minimumRole: 'read', minimumCredentialRole: 'admin', workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], }) expect(Object.isFrozen(credentialOperations.delete)).toBe(true) @@ -32,7 +32,7 @@ describe('credential operations', () => { minimumRole: 'read', minimumCredentialRole: 'admin', workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], }) expect(credentialOperations.update.principalKinds).not.toContain('workspace_api_key') diff --git a/apps/sim/lib/credentials/application/operations.ts b/apps/sim/lib/credentials/application/operations.ts index df3e52834c6..c510fee77c2 100644 --- a/apps/sim/lib/credentials/application/operations.ts +++ b/apps/sim/lib/credentials/application/operations.ts @@ -26,7 +26,7 @@ export function defineCredentialOperation< } const HUMAN_AND_COPILOT_PRINCIPALS = { - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], } as const @@ -43,14 +43,14 @@ export const credentialOperations = { minimumRole: 'read', workspaceApiKey: 'allow', capability: 'integrations.manage', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), listConnections: defineWorkspaceOperation({ id: 'credentials.connections.list', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'integrations.manage', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), /** * `integrations.manage`, like every other credential operation — these three @@ -68,7 +68,7 @@ export const credentialOperations = { minimumRole: 'write', workspaceApiKey: 'deny', capability: 'integrations.manage', - principalKinds: ['session', 'personal_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], }), prepareConnection: defineWorkspaceOperation({ id: 'credentials.connections.prepare', @@ -83,7 +83,7 @@ export const credentialOperations = { minimumRole: 'write', workspaceApiKey: 'deny', capability: 'integrations.manage', - principalKinds: ['session', 'personal_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], }), read: defineCredentialOperation( defineWorkspaceOperation({ diff --git a/apps/sim/lib/custom-tools/application/operations.ts b/apps/sim/lib/custom-tools/application/operations.ts index 1de8b666ec4..12a49c37fd2 100644 --- a/apps/sim/lib/custom-tools/application/operations.ts +++ b/apps/sim/lib/custom-tools/application/operations.ts @@ -1,11 +1,17 @@ import { defineWorkspaceOperation } from '@/lib/core/application' const ALL_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], } as const const HUMAN_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], } as const diff --git a/apps/sim/lib/integrations/principal-scope.server.ts b/apps/sim/lib/integrations/principal-scope.server.ts index 3e239092b15..6762cc7783b 100644 --- a/apps/sim/lib/integrations/principal-scope.server.ts +++ b/apps/sim/lib/integrations/principal-scope.server.ts @@ -1,4 +1,4 @@ -import type { Principal } from '@sim/auth/principal' +import { isUserCredentialPrincipal, type Principal } from '@sim/auth/principal' import { getAllowedIntegrationsFromEnv } from '@/lib/core/config/env-flags' import { resolvePermissionGroupConfig } from '@/lib/permission-groups/config-scope.server' import { intersectAccessControlAllowlists } from '@/lib/permission-groups/integration-allowlist' @@ -27,7 +27,7 @@ import { intersectAccessControlAllowlists } from '@/lib/permission-groups/integr * one would apply a bystander's permission groups to every caller of that key. */ export function principalUserId(principal: Principal): string | undefined { - if (principal.kind === 'session' || principal.kind === 'personal_api_key') { + if (principal.kind === 'session' || isUserCredentialPrincipal(principal)) { return principal.userId } if (principal.kind === 'delegated') return principal.subjectUserId diff --git a/apps/sim/lib/knowledge/application/operations.ts b/apps/sim/lib/knowledge/application/operations.ts index 0228b0d2fd8..f3198156c64 100644 --- a/apps/sim/lib/knowledge/application/operations.ts +++ b/apps/sim/lib/knowledge/application/operations.ts @@ -2,7 +2,13 @@ import type { ApplicationOperation } from '@/lib/core/application' import { assertOperationCapability, defineWorkspaceOperation } from '@/lib/core/application' const ALL_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], } as const const COPILOT_PRINCIPAL_POLICY = { @@ -11,13 +17,29 @@ const COPILOT_PRINCIPAL_POLICY = { } as const const ALL_PRINCIPAL_WITH_EXECUTOR_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot', 'executor'], } as const -const HTTP_PRINCIPAL_KINDS = ['session', 'personal_api_key', 'workspace_api_key'] as const +const HTTP_PRINCIPAL_KINDS = [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', +] as const -const HUMAN_AND_DELEGATED_PRINCIPAL_KINDS = ['session', 'personal_api_key', 'delegated'] as const +const HUMAN_AND_DELEGATED_PRINCIPAL_KINDS = [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'delegated', +] as const const HUMAN_AND_COPILOT_PRINCIPAL_POLICY = { principalKinds: HUMAN_AND_DELEGATED_PRINCIPAL_KINDS, diff --git a/apps/sim/lib/logs/application/operations.ts b/apps/sim/lib/logs/application/operations.ts index e0b760eb506..5e9a802a303 100644 --- a/apps/sim/lib/logs/application/operations.ts +++ b/apps/sim/lib/logs/application/operations.ts @@ -1,8 +1,18 @@ import { defineWorkspaceOperation } from '@/lib/core/application' -const PUBLIC_API_PRINCIPAL_KINDS = ['personal_api_key', 'workspace_api_key'] as const +const PUBLIC_API_PRINCIPAL_KINDS = [ + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', +] as const const LOG_READER_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot', 'executor'], } as const diff --git a/apps/sim/lib/mcp/application/operations.test.ts b/apps/sim/lib/mcp/application/operations.test.ts index 4238e5c4b83..8ddaa4fd428 100644 --- a/apps/sim/lib/mcp/application/operations.test.ts +++ b/apps/sim/lib/mcp/application/operations.test.ts @@ -26,7 +26,7 @@ describe('MCP server operation registry', () => { it('requires a human subject for tool discovery', () => { expect(mcpServerOperations.discoverTools).toMatchObject({ workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot', 'executor'], }) }) @@ -109,6 +109,7 @@ describe('MCP server operation registry', () => { expect(operation.principalKinds, operation.id).toEqual([ 'session', 'personal_api_key', + 'oauth_access_token', 'delegated', ]) expect(operation.delegatedServices, operation.id).toEqual(['copilot']) diff --git a/apps/sim/lib/mcp/application/operations.ts b/apps/sim/lib/mcp/application/operations.ts index e9346e82078..ed47622b1eb 100644 --- a/apps/sim/lib/mcp/application/operations.ts +++ b/apps/sim/lib/mcp/application/operations.ts @@ -1,15 +1,21 @@ import { defineWorkspaceOperation } from '@/lib/core/application' const ALL_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], } as const const HUMAN_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], } as const const DISCOVERY_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot', 'executor'], } as const const EXECUTION_PRINCIPAL_POLICY = { diff --git a/apps/sim/lib/sandboxes/application/operations.test.ts b/apps/sim/lib/sandboxes/application/operations.test.ts index 45840fde188..326df943310 100644 --- a/apps/sim/lib/sandboxes/application/operations.test.ts +++ b/apps/sim/lib/sandboxes/application/operations.test.ts @@ -30,7 +30,13 @@ describe('sandbox operation registry', () => { minimumRole: 'read', workspaceApiKey: 'allow', capability: 'sandboxes.use', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], }) } @@ -52,7 +58,7 @@ describe('sandbox operation registry', () => { minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'sandboxes.use', - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], }) } diff --git a/apps/sim/lib/sandboxes/application/operations.ts b/apps/sim/lib/sandboxes/application/operations.ts index 7b871e6bab8..caedf7fb1f7 100644 --- a/apps/sim/lib/sandboxes/application/operations.ts +++ b/apps/sim/lib/sandboxes/application/operations.ts @@ -1,11 +1,17 @@ import { defineWorkspaceOperation } from '@/lib/core/application' const ALL_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], } as const const HUMAN_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], } as const diff --git a/apps/sim/lib/secrets/application/operations.ts b/apps/sim/lib/secrets/application/operations.ts index b629a1014dd..494b07288bc 100644 --- a/apps/sim/lib/secrets/application/operations.ts +++ b/apps/sim/lib/secrets/application/operations.ts @@ -1,6 +1,6 @@ import { defineWorkspaceOperation } from '@/lib/core/application' -const HUMAN_API_PRINCIPAL_KINDS = ['session', 'personal_api_key'] as const +const HUMAN_API_PRINCIPAL_KINDS = ['session', 'personal_api_key', 'oauth_access_token'] as const export const secretOperations = { list: defineWorkspaceOperation({ diff --git a/apps/sim/lib/secrets/application/use-cases.ts b/apps/sim/lib/secrets/application/use-cases.ts index f4150e16c87..9fc1ed1f7a8 100644 --- a/apps/sim/lib/secrets/application/use-cases.ts +++ b/apps/sim/lib/secrets/application/use-cases.ts @@ -44,7 +44,7 @@ async function resolveWorkspaceContext(workspaceId: string): Promise + principal: Extract ): string { return principal.userId } diff --git a/apps/sim/lib/skills/application/operations.test.ts b/apps/sim/lib/skills/application/operations.test.ts index a9152130d80..eeb390247e3 100644 --- a/apps/sim/lib/skills/application/operations.test.ts +++ b/apps/sim/lib/skills/application/operations.test.ts @@ -37,7 +37,7 @@ describe('skill operation registry', () => { expect(skillOperations.create).toMatchObject({ minimumRole: 'write', workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], }) }) @@ -77,7 +77,7 @@ describe('skill operation registry', () => { /** `read`, not `write` — the editor row is the authority, not the role. */ minimumRole: 'read', workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], }) } }) @@ -102,13 +102,13 @@ describe('skill operation registry', () => { expect(skillOperations.listEditors).toMatchObject({ minimumRole: 'read', workspaceApiKey: 'allow', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], }) for (const operation of [skillOperations.grantEditor, skillOperations.revokeEditor]) { expect(operation).toMatchObject({ minimumRole: 'read', workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], }) } }) diff --git a/apps/sim/lib/skills/application/operations.ts b/apps/sim/lib/skills/application/operations.ts index 06cb71eb7fd..70f49364de7 100644 --- a/apps/sim/lib/skills/application/operations.ts +++ b/apps/sim/lib/skills/application/operations.ts @@ -1,18 +1,24 @@ import { defineWorkspaceOperation } from '@/lib/core/application' const ALL_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], } as const const HUMAN_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], } as const const HTTP_SKILL_EDITOR_READ_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], } as const const HUMAN_HTTP_SKILL_EDITOR_POLICY = { - principalKinds: ['session', 'personal_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], } as const /** diff --git a/apps/sim/lib/table/application/operations.ts b/apps/sim/lib/table/application/operations.ts index 2f9aaa110aa..e8355131b67 100644 --- a/apps/sim/lib/table/application/operations.ts +++ b/apps/sim/lib/table/application/operations.ts @@ -2,7 +2,13 @@ import { defineWorkspaceOperation } from '@/lib/core/application' import type { OperationDeclarableCapability } from '@/lib/core/application/operation' const ALL_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], } as const const COPILOT_PRINCIPAL_POLICY = { @@ -11,12 +17,24 @@ const COPILOT_PRINCIPAL_POLICY = { } as const const ALL_TABLE_TOOL_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot', 'executor'], } as const const INTERNAL_EXECUTOR_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['executor'], } as const diff --git a/apps/sim/lib/tool-execution/application/operations.ts b/apps/sim/lib/tool-execution/application/operations.ts index e657c89abaa..c4cb144aa09 100644 --- a/apps/sim/lib/tool-execution/application/operations.ts +++ b/apps/sim/lib/tool-execution/application/operations.ts @@ -33,7 +33,7 @@ export const toolExecutionOperations = { id: 'tools.execute', minimumRole: 'write', workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], capability: 'none', }), } as const diff --git a/apps/sim/lib/uploads/upload-session/application.ts b/apps/sim/lib/uploads/upload-session/application.ts index 9fb85149417..61929b1dd77 100644 --- a/apps/sim/lib/uploads/upload-session/application.ts +++ b/apps/sim/lib/uploads/upload-session/application.ts @@ -1,4 +1,4 @@ -import type { Principal } from '@sim/auth/principal' +import { isUserCredentialPrincipal, type Principal } from '@sim/auth/principal' import type { CreateInternalFileUploadBody } from '@/lib/api/contracts/upload-sessions' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' import { OrchestrationError } from '@/lib/core/orchestration/types' @@ -384,7 +384,7 @@ export const abortWorkspaceFileUploadOperation = { } as const function principalUserId(principal: Principal): string { - if (principal.kind === 'session' || principal.kind === 'personal_api_key') { + if (principal.kind === 'session' || isUserCredentialPrincipal(principal)) { return principal.userId } throw new Error('Workspace upload attribution must be resolved from the current workspace owner') diff --git a/apps/sim/lib/uploads/upload-session/service.ts b/apps/sim/lib/uploads/upload-session/service.ts index a766af1c680..d3581103c42 100644 --- a/apps/sim/lib/uploads/upload-session/service.ts +++ b/apps/sim/lib/uploads/upload-session/service.ts @@ -1,5 +1,6 @@ import { type BoundWorkflowExecutionDelegatedPrincipal, + isUserCredentialPrincipal, type Principal, requirePrincipalSubjectUserId, } from '@sim/auth/principal' @@ -117,6 +118,7 @@ export interface UploadSessionAuthBinding { principal: | { kind: 'session'; userId: string; sessionId: string } | { kind: 'personal_api_key'; userId: string; keyId: string } + | { kind: 'oauth_access_token'; userId: string; tokenId: string } | { kind: 'workspace_api_key'; workspaceId: string; keyId: string } | { kind: 'delegated' @@ -436,6 +438,12 @@ export function createUploadSessionAuthBinding( workspaceId, principal: { kind: principal.kind, userId: principal.userId, keyId: principal.keyId }, } + case 'oauth_access_token': + return { + version: 1, + workspaceId, + principal: { kind: principal.kind, userId: principal.userId, tokenId: principal.tokenId }, + } case 'workspace_api_key': if (principal.workspaceId !== workspaceId) { throw new UploadSessionError('forbidden', 'Workspace API key cannot access this workspace') @@ -504,16 +512,20 @@ export function assertUploadSessionAuthBinding( ? principal.kind === 'personal_api_key' && bound.userId === principal.userId && bound.keyId === principal.keyId - : bound.kind === 'workspace_api_key' - ? principal.kind === 'workspace_api_key' && - bound.workspaceId === principal.workspaceId && - bound.keyId === principal.keyId - : isExecutorWorkflowExecutionPrincipal(principal) && - principal.workspaceId === session.workspaceId && - principal.subjectUserId === bound.subjectUserId && - principal.audience === bound.audience && - principal.delegationContext.workflowId === bound.workflowId && - principal.delegationContext.executionId === bound.executionId) + : bound.kind === 'oauth_access_token' + ? principal.kind === 'oauth_access_token' && + bound.userId === principal.userId && + bound.tokenId === principal.tokenId + : bound.kind === 'workspace_api_key' + ? principal.kind === 'workspace_api_key' && + bound.workspaceId === principal.workspaceId && + bound.keyId === principal.keyId + : isExecutorWorkflowExecutionPrincipal(principal) && + principal.workspaceId === session.workspaceId && + principal.subjectUserId === bound.subjectUserId && + principal.audience === bound.audience && + principal.delegationContext.workflowId === bound.workflowId && + principal.delegationContext.executionId === bound.executionId) if (!matches) throw uploadNotFound() } @@ -528,7 +540,7 @@ function assertLegacyUploadSessionOwner(session: UploadSessionRecord, principal: const matches = principal.kind === 'workspace_api_key' ? principal.workspaceId === session.workspaceId - : (principal.kind === 'session' || principal.kind === 'personal_api_key') && + : (principal.kind === 'session' || isUserCredentialPrincipal(principal)) && principal.userId === session.userId if (!matches) throw uploadNotFound() } @@ -1288,6 +1300,9 @@ function isUploadSessionAuthBinding(value: unknown): value is UploadSessionAuthB if (principal.kind === 'personal_api_key') { return typeof principal.userId === 'string' && typeof principal.keyId === 'string' } + if (principal.kind === 'oauth_access_token') { + return typeof principal.userId === 'string' && typeof principal.tokenId === 'string' + } if (principal.kind === 'delegated') { return ( principal.serviceId === 'executor' && diff --git a/apps/sim/lib/users/application/authorized-apps.test.ts b/apps/sim/lib/users/application/authorized-apps.test.ts new file mode 100644 index 00000000000..62a2c082acf --- /dev/null +++ b/apps/sim/lib/users/application/authorized-apps.test.ts @@ -0,0 +1,165 @@ +/** + * @vitest-environment node + */ +import type { PersonalApiKeyPrincipal, SessionPrincipal } from '@sim/auth/principal' +import { schemaMock } from '@sim/testing' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + recordAudit: vi.fn(), + transaction: vi.fn(), + select: vi.fn(), +})) + +vi.mock('@sim/audit', () => ({ + recordAudit: mocks.recordAudit, + AuditAction: { OAUTH_APP_REVOKED: 'oauth_app.revoked' }, + AuditResourceType: { OAUTH_CLIENT: 'oauth_client' }, +})) + +vi.mock('@sim/db/schema', () => schemaMock) + +vi.mock('@sim/db', () => ({ + db: { + transaction: mocks.transaction, + select: mocks.select, + }, +})) + +import { ForbiddenOperationError } from '@/lib/core/application' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { + listAuthorizedAppsUseCase, + revokeAuthorizedAppUseCase, +} from '@/lib/users/application/authorized-apps' + +const session: SessionPrincipal = { kind: 'session', userId: 'user-1', sessionId: 'session-1' } +const personalKey: PersonalApiKeyPrincipal = { + kind: 'personal_api_key', + userId: 'user-1', + keyId: 'key-1', +} + +/** A drizzle select chain that answers `rows` whenever it is finally awaited. */ +function selectChain(rows: unknown[]) { + const chain: Record = {} + for (const method of ['from', 'innerJoin', 'where', 'orderBy', 'limit']) { + chain[method] = vi.fn(() => chain) + } + chain.then = (resolve: (value: unknown) => unknown) => Promise.resolve(rows).then(resolve) + return chain +} + +describe('authorized apps', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it('refuses a principal that is not the account holder in session', async () => { + await expect( + listAuthorizedAppsUseCase.execute({ principal: personalKey, input: {} }) + ).rejects.toBeInstanceOf(ForbiddenOperationError) + await expect( + revokeAuthorizedAppUseCase.execute({ + principal: personalKey, + input: { clientId: 'sim-cli' }, + }) + ).rejects.toBeInstanceOf(ForbiddenOperationError) + expect(mocks.transaction).not.toHaveBeenCalled() + }) + + it('presents each grant by the client name, falling back to its id', async () => { + mocks.select.mockReturnValue( + selectChain([ + { + clientId: 'sim-cli', + name: 'Sim CLI', + scopes: ['openid', 'api:write'], + authorizedAt: new Date('2026-09-01T00:00:00.000Z'), + }, + { + clientId: 'partner-app', + name: null, + scopes: ['openid'], + authorizedAt: new Date('2026-08-01T00:00:00.000Z'), + }, + ]) + ) + + await expect( + listAuthorizedAppsUseCase.execute({ principal: session, input: {} }) + ).resolves.toEqual([ + { + clientId: 'sim-cli', + name: 'Sim CLI', + scopes: ['openid', 'api:write'], + authorizedAt: '2026-09-01T00:00:00.000Z', + }, + { + clientId: 'partner-app', + name: 'partner-app', + scopes: ['openid'], + authorizedAt: '2026-08-01T00:00:00.000Z', + }, + ]) + }) + + it('removes the consent and both token kinds in one transaction, and records the audit', async () => { + const deleted: unknown[] = [] + const updated: unknown[] = [] + const tx = { + select: () => selectChain([{ id: 'consent-1', name: 'Sim CLI' }]), + delete: (table: unknown) => ({ where: (clause: unknown) => deleted.push([table, clause]) }), + update: (table: unknown) => ({ + set: (values: unknown) => ({ + where: (clause: unknown) => updated.push([table, values, clause]), + }), + }), + } + mocks.transaction.mockImplementation(async (run: (t: unknown) => unknown) => run(tx)) + + await expect( + revokeAuthorizedAppUseCase.execute({ principal: session, input: { clientId: 'sim-cli' } }) + ).resolves.toEqual({ clientId: 'sim-cli', name: 'Sim CLI' }) + + /** + * The tables are asserted, not just the call counts: swapping the access + * and refresh token tables leaves the counts identical while deleting the + * rows whose revocation is what makes a replayed token detectable. + */ + expect(deleted.map(([table]) => table)).toEqual([ + schemaMock.oauthConsent, + schemaMock.oauthAccessToken, + ]) + expect(updated.map(([table]) => table)).toEqual([schemaMock.oauthRefreshToken]) + expect(mocks.recordAudit).toHaveBeenCalledWith( + expect.objectContaining({ + actorId: 'user-1', + action: 'oauth_app.revoked', + resourceId: 'sim-cli', + resourceName: 'Sim CLI', + }) + ) + }) + + it('reports a grant this account does not hold as not found, changing nothing', async () => { + const tx = { + select: () => selectChain([]), + delete: () => { + throw new Error('must not delete') + }, + update: () => { + throw new Error('must not update') + }, + } + mocks.transaction.mockImplementation(async (run: (t: unknown) => unknown) => run(tx)) + + const failure = await revokeAuthorizedAppUseCase + .execute({ principal: session, input: { clientId: 'someone-elses' } }) + .catch((error) => error) + + expect(failure).toBeInstanceOf(OrchestrationError) + expect(failure.code).toBe('not_found') + expect(mocks.recordAudit).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/lib/users/application/authorized-apps.ts b/apps/sim/lib/users/application/authorized-apps.ts new file mode 100644 index 00000000000..59127a515fd --- /dev/null +++ b/apps/sim/lib/users/application/authorized-apps.ts @@ -0,0 +1,113 @@ +import { AuditAction, AuditResourceType, recordAudit } from '@sim/audit' +import { db } from '@sim/db' +import { oauthAccessToken, oauthClient, oauthConsent, oauthRefreshToken } from '@sim/db/schema' +import { and, desc, eq, isNull } from 'drizzle-orm' +import type { AuthorizedApp } from '@/lib/api/contracts/user' +import type { OperationUseCase } from '@/lib/core/application' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { requireUserAccountPrincipal } from '@/lib/users/application/authorization' +import { userAccountOperations } from '@/lib/users/application/operations' + +/** + * The OAuth clients this account has consented to, newest grant first. + * + * A consent row is the grant, so it is the whole answer: it survives every + * token the client has rotated through, and its age is what a person weighs + * when deciding whether an app should still have access. + */ +export const listAuthorizedAppsUseCase: OperationUseCase< + typeof userAccountOperations.readAuthorizedApps, + Record, + AuthorizedApp[] +> = { + operation: userAccountOperations.readAuthorizedApps, + async execute({ principal }) { + requireUserAccountPrincipal(principal, userAccountOperations.readAuthorizedApps) + + const rows = await db + .select({ + clientId: oauthConsent.clientId, + name: oauthClient.name, + scopes: oauthConsent.scopes, + authorizedAt: oauthConsent.createdAt, + }) + .from(oauthConsent) + .innerJoin(oauthClient, eq(oauthConsent.clientId, oauthClient.clientId)) + .where(eq(oauthConsent.userId, principal.userId)) + .orderBy(desc(oauthConsent.createdAt)) + + return rows.map((row) => ({ + clientId: row.clientId, + name: row.name ?? row.clientId, + scopes: row.scopes, + authorizedAt: row.authorizedAt.toISOString(), + })) + }, +} + +export interface RevokeAuthorizedAppInput { + clientId: string +} + +/** + * Withdraws an app's access to the account in one transaction: the consent + * (so the next authorize asks again), every live refresh token (so the app + * cannot mint another access token), and every access token (so the ones it + * holds stop working on the next request). The plugin's own delete-consent + * endpoint removes only the first, which is why this lives here. + */ +export const revokeAuthorizedAppUseCase: OperationUseCase< + typeof userAccountOperations.revokeAuthorizedApp, + RevokeAuthorizedAppInput, + { clientId: string; name: string } +> = { + operation: userAccountOperations.revokeAuthorizedApp, + async execute({ principal, input }) { + requireUserAccountPrincipal(principal, userAccountOperations.revokeAuthorizedApp) + const userId = principal.userId + const clientId = input.clientId + + const revoked = await db.transaction(async (tx) => { + const [consent] = await tx + .select({ id: oauthConsent.id, name: oauthClient.name }) + .from(oauthConsent) + .innerJoin(oauthClient, eq(oauthConsent.clientId, oauthClient.clientId)) + .where(and(eq(oauthConsent.userId, userId), eq(oauthConsent.clientId, clientId))) + .limit(1) + if (!consent) return null + + await tx + .delete(oauthConsent) + .where(and(eq(oauthConsent.userId, userId), eq(oauthConsent.clientId, clientId))) + await tx + .update(oauthRefreshToken) + .set({ revoked: new Date() }) + .where( + and( + eq(oauthRefreshToken.userId, userId), + eq(oauthRefreshToken.clientId, clientId), + isNull(oauthRefreshToken.revoked) + ) + ) + await tx + .delete(oauthAccessToken) + .where(and(eq(oauthAccessToken.userId, userId), eq(oauthAccessToken.clientId, clientId))) + + return { clientId, name: consent.name ?? clientId } + }) + + if (!revoked) throw new OrchestrationError('not_found', 'Authorized app not found') + + recordAudit({ + workspaceId: null, + actorId: userId, + action: AuditAction.OAUTH_APP_REVOKED, + resourceType: AuditResourceType.OAUTH_CLIENT, + resourceId: revoked.clientId, + resourceName: revoked.name, + description: `Revoked ${revoked.name}'s access to the account`, + }) + + return revoked + }, +} diff --git a/apps/sim/lib/users/application/operations.ts b/apps/sim/lib/users/application/operations.ts index 9277501e969..41fe02136b6 100644 --- a/apps/sim/lib/users/application/operations.ts +++ b/apps/sim/lib/users/application/operations.ts @@ -40,4 +40,14 @@ export const userAccountOperations = { }), // permission-group-exempt: deleting your own account is not a workspace act, so no group key names it delete: defineUserAccountOperation({ id: 'users.account.delete', capability: 'none' }), + // permission-group-exempt: the apps an account has authorized belong to the account, not to any workspace a group governs + readAuthorizedApps: defineUserAccountOperation({ + id: 'users.account.authorized_apps.read', + capability: 'none', + }), + // permission-group-exempt: revoking an app's access to your own account is not a workspace act, so no group key names it + revokeAuthorizedApp: defineUserAccountOperation({ + id: 'users.account.authorized_apps.revoke', + capability: 'none', + }), } as const satisfies Record diff --git a/apps/sim/lib/workflows/application/operations.test.ts b/apps/sim/lib/workflows/application/operations.test.ts index b978a3e3bcd..a2bfeaec7a6 100644 --- a/apps/sim/lib/workflows/application/operations.test.ts +++ b/apps/sim/lib/workflows/application/operations.test.ts @@ -39,7 +39,13 @@ describe('workflow operation registry', () => { id: 'workflows.variables.apply_operations', minimumRole: 'write', workspaceApiKey: 'allow', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], }) expect(Object.isFrozen(workflowOperations.applyVariableOperations)).toBe(true) @@ -50,7 +56,13 @@ describe('workflow operation registry', () => { id: 'workflows.bulk.move', minimumRole: 'write', workspaceApiKey: 'allow', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], }) expect(Object.isFrozen(workflowOperations.moveBulk)).toBe(true) @@ -65,7 +77,7 @@ describe('workflow operation registry', () => { expect(operation).toMatchObject({ minimumRole: 'admin', workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot', 'executor'], }) } @@ -74,7 +86,13 @@ describe('workflow operation registry', () => { expect(operation).toMatchObject({ minimumRole: 'read', workspaceApiKey: 'allow', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot', 'executor'], }) } @@ -95,7 +113,7 @@ describe('workflow operation registry', () => { id: 'workflows.public_api.update', minimumRole: 'admin', workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], }) expect(workflowOperations.updatePublicApi.principalKinds).not.toContain('workspace_api_key') expect(workflowOperations.updatePublicApi.principalKinds).not.toContain('delegated') @@ -115,7 +133,7 @@ describe('workflow operation registry', () => { id: 'workflows.operations.apply', minimumRole: 'write', workspaceApiKey: 'deny', - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], }) expect(workflowOperations.applyOperations.principalKinds).not.toContain('workspace_api_key') @@ -129,7 +147,7 @@ describe('workflow operation registry', () => { expect(operation).toMatchObject({ minimumRole: 'write', workspaceApiKey: 'deny', - principalKinds: ['personal_api_key'], + principalKinds: ['personal_api_key', 'oauth_access_token'], }) expect(operation.id).toMatch(/^workflows\.manual\.execute/) } @@ -140,7 +158,13 @@ describe('workflow operation registry', () => { id: 'workflows.paused_executions.read', minimumRole: 'read', workspaceApiKey: 'allow', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], }) }) diff --git a/apps/sim/lib/workflows/application/operations.ts b/apps/sim/lib/workflows/application/operations.ts index 3d83968be1b..fdfe5c82451 100644 --- a/apps/sim/lib/workflows/application/operations.ts +++ b/apps/sim/lib/workflows/application/operations.ts @@ -1,22 +1,34 @@ import { defineWorkspaceOperation } from '@/lib/core/application' const ALL_WORKFLOW_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], } as const const WORKFLOW_READ_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot', 'executor'], } as const const HUMAN_WORKFLOW_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot'], } as const const WORKFLOW_DEPLOYMENT_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot', 'executor'], } as const @@ -335,7 +347,7 @@ export const workflowOperations = { minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'none', - principalKinds: ['session', 'personal_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], }), activateVersion: defineWorkspaceOperation({ id: 'workflows.versions.activate', @@ -414,7 +426,7 @@ export const workflowOperations = { minimumRole: 'write', workspaceApiKey: 'deny', capability: 'none', - principalKinds: ['personal_api_key'], + principalKinds: ['personal_api_key', 'oauth_access_token'], }), // permission-group-exempt: a manual run is governed by workspace role; public_api.use withholds the unauthenticated surface, which does not reach this operation executeManualFromBlock: defineWorkspaceOperation({ @@ -422,7 +434,7 @@ export const workflowOperations = { minimumRole: 'write', workspaceApiKey: 'deny', capability: 'none', - principalKinds: ['personal_api_key'], + principalKinds: ['personal_api_key', 'oauth_access_token'], }), // permission-group-exempt: execution history is governed by workspace role; logs.cost and logs.trace_spans withhold fields inside a run, not the right to read one listRuns: defineWorkspaceOperation({ diff --git a/apps/sim/lib/workflows/deployment-outbox.ts b/apps/sim/lib/workflows/deployment-outbox.ts index f3462161392..b6b4732e618 100644 --- a/apps/sim/lib/workflows/deployment-outbox.ts +++ b/apps/sim/lib/workflows/deployment-outbox.ts @@ -1442,6 +1442,14 @@ function parseOptionalPrincipalActor(value: unknown): PrincipalActor | undefined userId: parseRequiredString(record.userId, 'actor.userId'), } } + if (kind === 'oauth_access_token') { + return { + kind, + tokenId: parseRequiredString(record.tokenId, 'actor.tokenId'), + clientId: parseRequiredString(record.clientId, 'actor.clientId'), + userId: parseRequiredString(record.userId, 'actor.userId'), + } + } if (kind === 'workspace_api_key') { return { kind, diff --git a/apps/sim/lib/workspace-files/application/operations.test.ts b/apps/sim/lib/workspace-files/application/operations.test.ts index f2b8104d777..6c45f034445 100644 --- a/apps/sim/lib/workspace-files/application/operations.test.ts +++ b/apps/sim/lib/workspace-files/application/operations.test.ts @@ -65,6 +65,7 @@ describe('file operation registry', () => { expect(fileOperations.updateShare.principalKinds).toEqual([ 'session', 'personal_api_key', + 'oauth_access_token', 'delegated', ]) expect(fileOperations.updateShare.delegatedServices).toEqual(['copilot', 'executor']) @@ -77,7 +78,12 @@ describe('file operation registry', () => { fileOperations.uploadComplete, fileOperations.uploadCancel, ]) { - expect(operation.principalKinds).toEqual(['session', 'personal_api_key', 'workspace_api_key']) + expect(operation.principalKinds).toEqual([ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + ]) expect(operation.delegatedServices).toBeUndefined() } }) @@ -93,7 +99,7 @@ describe('file operation registry', () => { id: 'files.extract_archive', minimumRole: 'write', workspaceApiKey: 'allow', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], }) expect(fileOperations.extractArchive.principalKinds).not.toContain('delegated') expect(fileOperations.extractArchive.delegatedServices).toBeUndefined() diff --git a/apps/sim/lib/workspace-files/application/operations.ts b/apps/sim/lib/workspace-files/application/operations.ts index bcd73e62010..7338dda67dd 100644 --- a/apps/sim/lib/workspace-files/application/operations.ts +++ b/apps/sim/lib/workspace-files/application/operations.ts @@ -1,19 +1,31 @@ import { defineWorkspaceOperation } from '@/lib/core/application' const ALL_COPILOT_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot'], } as const const ALL_FILE_TOOL_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], + principalKinds: [ + 'session', + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', + 'delegated', + ], delegatedServices: ['copilot', 'executor'], } as const const HUMAN_FILE_TOOL_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'delegated'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'delegated'], delegatedServices: ['copilot', 'executor'], } as const const UPLOAD_PRINCIPAL_POLICY = { - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], } as const export const fileOperations = { @@ -90,7 +102,7 @@ export const fileOperations = { minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', - principalKinds: ['session', 'personal_api_key', 'workspace_api_key'], + principalKinds: ['session', 'personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), updateContent: defineWorkspaceOperation({ id: 'files.update_content', diff --git a/apps/sim/lib/workspaces/application/operations.ts b/apps/sim/lib/workspaces/application/operations.ts index b1ee6303784..df802f931ab 100644 --- a/apps/sim/lib/workspaces/application/operations.ts +++ b/apps/sim/lib/workspaces/application/operations.ts @@ -1,6 +1,10 @@ import { defineWorkspaceOperation } from '@/lib/core/application' -const PUBLIC_API_PRINCIPAL_KINDS = ['personal_api_key', 'workspace_api_key'] as const +const PUBLIC_API_PRINCIPAL_KINDS = [ + 'personal_api_key', + 'oauth_access_token', + 'workspace_api_key', +] as const export const workspaceOperations = { // permission-group-exempt: the public API's own view of the workspaces a key can reach; it answers what that credential already proves, and `disablePublicApi` governs whether the key reaches the surface at all diff --git a/apps/sim/package.json b/apps/sim/package.json index b7d20522da1..e7e0b217ab1 100644 --- a/apps/sim/package.json +++ b/apps/sim/package.json @@ -63,6 +63,7 @@ "@aws-sdk/s3-request-presigner": "3.1117.0", "@azure/communication-email": "1.1.0", "@azure/storage-blob": "12.27.0", + "@better-auth/oauth-provider": "1.6.27", "@better-auth/sso": "1.6.27", "@better-auth/stripe": "1.6.27", "@browserbasehq/stagehand": "^3.2.1", diff --git a/apps/sim/proxy.test.ts b/apps/sim/proxy.test.ts index d5ce595f8a9..c629914177e 100644 --- a/apps/sim/proxy.test.ts +++ b/apps/sim/proxy.test.ts @@ -34,6 +34,32 @@ describe('resolveApiCorsPolicy', () => { }) }) + it('serves OAuth discovery documents read-only with wildcard origin', () => { + expect( + resolveApiCorsPolicy(makeRequest('/api/auth/.well-known/oauth-authorization-server')) + ).toEqual({ + origin: '*', + credentials: false, + methods: 'GET, OPTIONS', + headers: 'Content-Type, Accept', + exposeHeaders: EXPOSED_HEADERS, + }) + }) + + /** + * `proxy()` consults this table only for `/api/` paths, so a rule matching + * the origin-root discovery document would never run. That copy sets its own + * `Access-Control-Allow-Origin` in the route handler instead; a rule here + * would read as coverage it does not have. + */ + it('leaves the origin-root discovery document to its own route handler', () => { + const rootPolicy = resolveApiCorsPolicy(makeRequest('/.well-known/oauth-authorization-server')) + const apiPolicy = resolveApiCorsPolicy( + makeRequest('/api/auth/.well-known/oauth-authorization-server') + ) + expect(rootPolicy).not.toEqual(apiPolicy) + }) + it('serves MCP copilot with DELETE in allowed methods', () => { const policy = resolveApiCorsPolicy(makeRequest('/api/mcp/copilot')) expect(policy.origin).toBe('*') diff --git a/apps/sim/proxy.ts b/apps/sim/proxy.ts index 8d4a0ecb2e3..cffe3336eb3 100644 --- a/apps/sim/proxy.ts +++ b/apps/sim/proxy.ts @@ -51,7 +51,7 @@ const DEFAULT_API_ALLOWED_HEADERS = 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-API-Key, Authorization' const WORKFLOW_EXECUTE_HEADERS = - 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-API-Key, X-Execution-Id, X-Execution-Mode, X-Execution-Timeout-Seconds' + 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-API-Key, Authorization, X-Execution-Id, X-Execution-Mode, X-Execution-Timeout-Seconds' /** v2 execute: run identity and modes use the v2 wire names while streaming negotiates its protocol. */ const WORKFLOW_EXECUTE_V2_HEADERS = @@ -86,6 +86,15 @@ const CORS_RULES: readonly CorsRule[] = [ headers: 'Content-Type, Authorization, Accept', }), }, + { + match: (p) => p.startsWith('/api/auth/.well-known/'), + policy: () => ({ + origin: '*', + credentials: false, + methods: 'GET, OPTIONS', + headers: 'Content-Type, Accept', + }), + }, { match: (p) => p === '/api/mcp/copilot', policy: () => ({ diff --git a/apps/sim/scripts/create-oauth-client.ts b/apps/sim/scripts/create-oauth-client.ts new file mode 100644 index 00000000000..f32e89f0a31 --- /dev/null +++ b/apps/sim/scripts/create-oauth-client.ts @@ -0,0 +1,162 @@ +#!/usr/bin/env bun + +/** + * Registers an OAuth client with Sim's authorization server by writing the + * `oauth_client` row directly, the way `register-sso-provider.ts` registers + * an SSO provider. Better Auth's own `adminCreateOAuthClient` endpoint needs a + * signed-in session, and dynamic registration is deliberately switched off, + * so an operator creates clients here. + * + * Usage: bun run apps/sim/scripts/create-oauth-client.ts + * + * Required environment variables: + * DATABASE_URL + * BETTER_AUTH_SECRET The deployment's auth secret; the stored secret is encrypted under it + * OAUTH_CLIENT_ID=my-app Stable identifier the app sends as client_id + * OAUTH_CLIENT_NAME="My App" Shown on the consent page + * OAUTH_REDIRECT_URIS=https://my-app.example/callback,https://… Comma-separated. Exact match, except a loopback-IP URI, which matches any port (RFC 8252 §7.3) — register it without one + * + * Optional: + * OAUTH_CLIENT_PUBLIC=true A native/CLI app that cannot keep a secret (PKCE only, no secret issued) + * OAUTH_CLIENT_URI=https://… Homepage link on the consent page + * OAUTH_CLIENT_LOGO_URI=https://… Logo on the consent page + * OAUTH_SCOPES=openid,profile,email,offline_access,api:read,api:write Scopes the client may request + * + * A confidential client's secret is generated here, encrypted the way the + * provider stores it, and printed exactly once. + * + * Encrypted rather than hashed because the provider issues opaque access + * tokens (`disableJwtPlugin`), which leaves the client secret as the key an ID + * token is signed with — so the server has to read it back. `symmetricEncrypt` + * under `BETTER_AUTH_SECRET` is exactly what the plugin's own client creation + * does; writing a hash here produced a row no client could ever authenticate + * against. + */ + +import { randomBytes } from 'node:crypto' +import { oauthClient } from '@sim/db/schema' +import { getErrorMessage } from '@sim/utils/errors' +import { generateId } from '@sim/utils/id' +import { symmetricEncrypt } from 'better-auth/crypto' +import { eq } from 'drizzle-orm' +import { drizzle } from 'drizzle-orm/postgres-js' +import postgres from 'postgres' +import { OAUTH_SCOPES } from '@/lib/auth/oauth-provider' + +/** + * Read from the provider's own list rather than copied, and every requested + * scope is checked against it: the authorize endpoint validates against the + * client's row, so a scope the provider never declared would be granted and + * then mean nothing to any check that reads it. + */ +const DEFAULT_SCOPES: readonly string[] = OAUTH_SCOPES + +function requireEnv(name: string): string { + const value = process.env[name]?.trim() + if (!value) throw new Error(`${name} is required`) + return value +} + +function parseList(value: string | undefined, fallback: string[]): string[] { + const items = (value ?? '') + .split(',') + .map((item) => item.trim()) + .filter(Boolean) + return items.length > 0 ? items : fallback +} + +function assertRedirectUri(uri: string): void { + let parsed: URL + try { + parsed = new URL(uri) + } catch { + throw new Error(`Invalid redirect URI: ${uri}`) + } + const loopback = parsed.hostname === '127.0.0.1' || parsed.hostname === '[::1]' + if (parsed.protocol !== 'https:' && !(parsed.protocol === 'http:' && loopback)) { + throw new Error(`Redirect URI must be https, or http on a loopback address: ${uri}`) + } + if (parsed.hash) throw new Error(`Redirect URI cannot carry a fragment: ${uri}`) +} + +async function main(): Promise { + const clientId = requireEnv('OAUTH_CLIENT_ID') + const name = requireEnv('OAUTH_CLIENT_NAME') + const redirectUris = parseList(process.env.OAUTH_REDIRECT_URIS, []) + if (redirectUris.length === 0) throw new Error('OAUTH_REDIRECT_URIS is required') + for (const uri of redirectUris) assertRedirectUri(uri) + + const isPublic = process.env.OAUTH_CLIENT_PUBLIC === 'true' + const scopes = parseList(process.env.OAUTH_SCOPES, [...DEFAULT_SCOPES]) + const unknownScopes = scopes.filter((scope) => !DEFAULT_SCOPES.includes(scope)) + if (unknownScopes.length > 0) { + throw new Error( + `Unknown scope(s): ${unknownScopes.join(', ')}. Sim's provider declares: ${DEFAULT_SCOPES.join(', ')}` + ) + } + const secret = isPublic ? null : randomBytes(32).toString('base64url') + const storedSecret = secret + ? await symmetricEncrypt({ key: requireEnv('BETTER_AUTH_SECRET'), data: secret }) + : null + + const postgresClient = postgres(requireEnv('DATABASE_URL'), { + prepare: false, + idle_timeout: 20, + connect_timeout: 30, + max: 2, + onnotice: () => {}, + }) + const db = drizzle(postgresClient) + + try { + const [existing] = await db + .select({ id: oauthClient.id }) + .from(oauthClient) + .where(eq(oauthClient.clientId, clientId)) + .limit(1) + if (existing) { + throw new Error( + `An OAuth client with client_id "${clientId}" already exists. Delete it first, or choose another id.` + ) + } + + const now = new Date() + await db.insert(oauthClient).values({ + id: generateId(), + clientId, + clientSecret: storedSecret, + name, + uri: process.env.OAUTH_CLIENT_URI?.trim() || null, + icon: process.env.OAUTH_CLIENT_LOGO_URI?.trim() || null, + disabled: false, + skipConsent: false, + public: isPublic, + type: isPublic ? 'native' : 'web', + tokenEndpointAuthMethod: isPublic ? 'none' : 'client_secret_post', + requirePKCE: true, + grantTypes: ['authorization_code', 'refresh_token'], + responseTypes: ['code'], + redirectUris, + scopes, + createdAt: now, + updatedAt: now, + }) + + console.log(`Created OAuth client "${name}"`) + console.log(` client_id: ${clientId}`) + console.log(` type: ${isPublic ? 'public (PKCE only)' : 'confidential'}`) + console.log(` redirect_uris: ${redirectUris.join(', ')}`) + console.log(` scopes: ${scopes.join(' ')}`) + if (secret) { + console.log(` client_secret: ${secret}`) + console.log(' The secret is shown once and cannot be read back; keep it now.') + } + } finally { + await postgresClient.end() + } +} + +main().catch((error) => { + console.error(`Failed to create OAuth client: ${getErrorMessage(error)}`) + process.exit(1) +}) diff --git a/bun.lock b/bun.lock index 3ea6e5b5251..5194bf2aa72 100644 --- a/bun.lock +++ b/bun.lock @@ -173,6 +173,7 @@ "@aws-sdk/s3-request-presigner": "3.1117.0", "@azure/communication-email": "1.1.0", "@azure/storage-blob": "12.27.0", + "@better-auth/oauth-provider": "1.6.27", "@better-auth/sso": "1.6.27", "@better-auth/stripe": "1.6.27", "@browserbasehq/stagehand": "^3.2.1", @@ -1070,6 +1071,8 @@ "@better-auth/mongo-adapter": ["@better-auth/mongo-adapter@1.6.27", "", { "peerDependencies": { "@better-auth/core": "^1.6.27", "@better-auth/utils": "0.4.2", "mongodb": "^6.0.0 || ^7.0.0" }, "optionalPeers": ["mongodb"] }, "sha512-IOYbJMIjEC//f+JpFlmIQjh6x1R/rGAfdzlojFk6HeAJqbsELuMcI+27dIoesbfHLF/icTrSpZtK986XhJrCfA=="], + "@better-auth/oauth-provider": ["@better-auth/oauth-provider@1.6.27", "", { "dependencies": { "jose": "^6.1.3", "zod": "^4.3.6" }, "peerDependencies": { "@better-auth/core": "^1.6.27", "@better-auth/utils": "0.4.2", "@better-fetch/fetch": "1.3.1", "better-auth": "^1.6.27", "better-call": "1.4.0" } }, "sha512-xUQ8GgbWUOYesO5wocrzbHdGa0Jojrxh59Vdew/1xzRRDYfXPEP/vq8Sj754BBwXjGAoKkvU/u6BaLXLBNOlYA=="], + "@better-auth/prisma-adapter": ["@better-auth/prisma-adapter@1.6.27", "", { "peerDependencies": { "@better-auth/core": "^1.6.27", "@better-auth/utils": "0.4.2", "@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0", "prisma": "^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["@prisma/client", "prisma"] }, "sha512-v7DXVyaFbkrfLoiFDtcVF7BkEZgFa/DgEGE7XjrAXmMACa5pjDvb7lm8W5X+/qgIbQP04eThhgFQ6EWOsjr8OQ=="], "@better-auth/sso": ["@better-auth/sso@1.6.27", "", { "dependencies": { "fast-xml-parser": "^5.8.0", "jose": "^6.1.3", "samlify": "^2.13.1", "tldts": "^6.1.0", "zod": "^4.3.6" }, "peerDependencies": { "@better-auth/core": "^1.6.27", "@better-auth/utils": "0.4.2", "@better-fetch/fetch": "1.3.1", "better-auth": "^1.6.27", "better-call": "1.4.0" } }, "sha512-WD9ctVNLnEogSqIea+HsDg9Y3HxSjA0IA7eR7ZdlCQMyGu3DIkNpKQHd7PztYBX7v2IoE6GIFhCNbiW6/8Wy7g=="], @@ -4772,6 +4775,8 @@ "@better-auth/core/jose": ["jose@6.2.3", "", {}, "sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw=="], + "@better-auth/oauth-provider/jose": ["jose@6.2.3", "", {}, "sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw=="], + "@better-auth/sso/jose": ["jose@6.2.3", "", {}, "sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw=="], "@better-auth/sso/tldts": ["tldts@6.1.86", "", { "dependencies": { "tldts-core": "^6.1.86" }, "bin": { "tldts": "bin/cli.js" } }, "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ=="], diff --git a/package.json b/package.json index a1ab89af429..b9dd9ca1e2a 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "check:actorless-executor-operations": "bun run scripts/check-actorless-executor-operations.ts", "check:permission-group-enforcement": "bun run scripts/check-permission-group-enforcement.ts", "check:capability-subject": "bun run scripts/check-capability-subject.ts", + "check:principal-kind-parity": "bun run scripts/check-principal-kind-parity.ts", "check:application-graph": "bun run scripts/check-application-graph.ts", "generate:block-successors": "bun run scripts/generate-block-successors.ts", "check:block-successors": "bun run scripts/generate-block-successors.ts --check", diff --git a/packages/audit/src/types.ts b/packages/audit/src/types.ts index 68569697fa8..69a545e0dcf 100644 --- a/packages/audit/src/types.ts +++ b/packages/audit/src/types.ts @@ -12,6 +12,9 @@ export const AuditAction = { PERSONAL_API_KEY_CREATED: 'personal_api_key.created', PERSONAL_API_KEY_REVOKED: 'personal_api_key.revoked', + // OAuth apps (Sim as the authorization server) + OAUTH_APP_REVOKED: 'oauth_app.revoked', + // BYOK Keys BYOK_KEY_CREATED: 'byok_key.created', BYOK_KEY_UPDATED: 'byok_key.updated', @@ -262,6 +265,7 @@ export const AuditResourceType = { KNOWLEDGE_BASE: 'knowledge_base', MCP_SERVER: 'mcp_server', OAUTH: 'oauth', + OAUTH_CLIENT: 'oauth_client', ORGANIZATION: 'organization', PASSWORD: 'password', PERMISSION_GROUP: 'permission_group', diff --git a/packages/auth/src/principal.ts b/packages/auth/src/principal.ts index d535d29f23e..0ad45cef624 100644 --- a/packages/auth/src/principal.ts +++ b/packages/auth/src/principal.ts @@ -1,6 +1,7 @@ export type Principal = | SessionPrincipal | PersonalApiKeyPrincipal + | OAuthAccessTokenPrincipal | WorkspaceApiKeyPrincipal | DelegatedPrincipal | SystemPrincipal @@ -18,6 +19,22 @@ export interface PersonalApiKeyPrincipal { keyId: string } +/** + * A person acting through an OAuth access token a registered client obtained + * with their consent. The same authorization class as a personal API key — a + * human subject, governed by their permission group and by the workspace's + * personal-key policy — narrowed by `scopes` and bounded by `expiresAt`. + */ +export interface OAuthAccessTokenPrincipal { + kind: 'oauth_access_token' + userId: string + clientId: string + /** The `oauth_access_token` row id, never the token itself. */ + tokenId: string + scopes: readonly string[] + expiresAt: Date +} + export interface WorkspaceApiKeyPrincipal { kind: 'workspace_api_key' workspaceId: string @@ -136,6 +153,18 @@ export interface CredentialGroupEnrollmentPrincipal { export type DelegatedServiceId = DelegatedPrincipal['serviceId'] +/** + * A person reaching the API through a bearer credential of their own — a + * personal API key or an OAuth access token. The two are one authorization + * class, so a surface that distinguishes "a user is here" from "a workspace + * or service is here" asks this rather than naming either kind. + */ +export function isUserCredentialPrincipal( + principal: Principal +): principal is PersonalApiKeyPrincipal | OAuthAccessTokenPrincipal { + return principal.kind === 'personal_api_key' || principal.kind === 'oauth_access_token' +} + export class PrincipalSubjectUserRequiredError extends Error { constructor(principalKind: Principal['kind']) { super(`Principal kind ${principalKind} does not represent a human subject`) @@ -184,6 +213,7 @@ export function resolvePrincipalExecutionActorUserId(principal: Principal): stri export type WorkflowExecutionPrincipal = | SessionPrincipal | PersonalApiKeyPrincipal + | OAuthAccessTokenPrincipal | WorkspaceApiKeyPrincipal | SubjectDelegatedPrincipal | SystemPrincipal @@ -191,6 +221,7 @@ export type WorkflowExecutionPrincipal = type SerializedWorkflowExecutionPrincipal = | SessionPrincipal | PersonalApiKeyPrincipal + | (Omit & { expiresAt: string }) | WorkspaceApiKeyPrincipal | SystemPrincipal | (Omit & { @@ -292,6 +323,15 @@ export function serializePrincipal(principal: WorkflowExecutionPrincipal): Seria case 'personal_api_key': case 'workspace_api_key': return { version: 1, principal: { ...principal } } + case 'oauth_access_token': + return { + version: 1, + principal: { + ...principal, + scopes: [...principal.scopes], + expiresAt: principal.expiresAt.toISOString(), + }, + } case 'system': if (principal.serviceId === 'webhook') { if (principal.subject && principal.subject.provider !== principal.provider) { @@ -341,6 +381,20 @@ export function parsePrincipal(value: unknown): WorkflowExecutionPrincipal { workspaceId: requireString(principal.workspaceId, 'workspaceId'), keyId: requireString(principal.keyId, 'keyId'), } + case 'oauth_access_token': { + requireExactKeys(principal, ['kind', 'userId', 'clientId', 'tokenId', 'scopes', 'expiresAt']) + if (!Array.isArray(principal.scopes)) { + throw new Error('Serialized principal scopes must be an array') + } + return { + kind, + userId: requireString(principal.userId, 'userId'), + clientId: requireString(principal.clientId, 'clientId'), + tokenId: requireString(principal.tokenId, 'tokenId'), + scopes: principal.scopes.map((scope, index) => requireString(scope, `scopes[${index}]`)), + expiresAt: requireDate(principal.expiresAt, 'expiresAt'), + } + } case 'system': { requireExactKeys( principal, @@ -447,6 +501,7 @@ export function parsePrincipal(value: unknown): WorkflowExecutionPrincipal { export type PrincipalActor = | { kind: 'session'; userId: string } | { kind: 'personal_api_key'; keyId: string; userId: string } + | { kind: 'oauth_access_token'; tokenId: string; clientId: string; userId: string } | { kind: 'workspace_api_key'; keyId: string; workspaceId: string } | { kind: 'system' @@ -504,6 +559,7 @@ export function resolvePrincipalSubject(principal: Principal): PrincipalSubject switch (principal.kind) { case 'session': case 'personal_api_key': + case 'oauth_access_token': return { kind: 'sim_user', userId: principal.userId } case 'delegated': if (principal.serviceId !== 'executor') { @@ -529,6 +585,13 @@ export function toPrincipalActor(principal: Principal): PrincipalActor { return { kind: principal.kind, userId: principal.userId } case 'personal_api_key': return { kind: principal.kind, keyId: principal.keyId, userId: principal.userId } + case 'oauth_access_token': + return { + kind: principal.kind, + tokenId: principal.tokenId, + clientId: principal.clientId, + userId: principal.userId, + } case 'workspace_api_key': return { kind: principal.kind, @@ -574,8 +637,8 @@ export function resolvePrincipalAuditAttribution(principal: Principal): Principa switch (actor.kind) { case 'session': - return { actor, actorId: actor.userId } case 'personal_api_key': + case 'oauth_access_token': return { actor, actorId: actor.userId } case 'delegated': return actor.subjectUserId @@ -604,6 +667,7 @@ export function resolvePrincipalAttribution( switch (actor.kind) { case 'session': case 'personal_api_key': + case 'oauth_access_token': return { actor, attributedUserId: actor.userId } case 'workspace_api_key': { const attributedUserId = context.workspaceBillingOwnerUserId diff --git a/packages/db/migrations/0321_oauth_provider.sql b/packages/db/migrations/0321_oauth_provider.sql new file mode 100644 index 00000000000..6bf9f10c72b --- /dev/null +++ b/packages/db/migrations/0321_oauth_provider.sql @@ -0,0 +1,106 @@ +CREATE TABLE "oauth_access_token" ( + "id" text PRIMARY KEY NOT NULL, + "token" text NOT NULL, + "client_id" text NOT NULL, + "session_id" text, + "user_id" text, + "reference_id" text, + "refresh_id" text, + "expires_at" timestamp NOT NULL, + "created_at" timestamp NOT NULL, + "scopes" text[] NOT NULL, + CONSTRAINT "oauth_access_token_token_unique" UNIQUE("token") +); +--> statement-breakpoint +CREATE TABLE "oauth_client" ( + "id" text PRIMARY KEY NOT NULL, + "client_id" text NOT NULL, + "client_secret" text, + "disabled" boolean DEFAULT false NOT NULL, + "skip_consent" boolean, + "enable_end_session" boolean, + "subject_type" text, + "scopes" text[], + "user_id" text, + "created_at" timestamp, + "updated_at" timestamp, + "name" text, + "uri" text, + "icon" text, + "contacts" text[], + "tos" text, + "policy" text, + "software_id" text, + "software_version" text, + "software_statement" text, + "redirect_uris" text[] NOT NULL, + "post_logout_redirect_uris" text[], + "token_endpoint_auth_method" text, + "grant_types" text[], + "response_types" text[], + "public" boolean, + "type" text, + "require_pkce" boolean, + "reference_id" text, + "metadata" jsonb, + CONSTRAINT "oauth_client_client_id_unique" UNIQUE("client_id") +); +--> statement-breakpoint +CREATE TABLE "oauth_consent" ( + "id" text PRIMARY KEY NOT NULL, + "client_id" text NOT NULL, + "user_id" text, + "reference_id" text, + "scopes" text[] NOT NULL, + "created_at" timestamp NOT NULL, + "updated_at" timestamp NOT NULL +); +--> statement-breakpoint +CREATE TABLE "oauth_refresh_token" ( + "id" text PRIMARY KEY NOT NULL, + "token" text NOT NULL, + "client_id" text NOT NULL, + "session_id" text, + "user_id" text NOT NULL, + "reference_id" text, + "expires_at" timestamp NOT NULL, + "created_at" timestamp NOT NULL, + "revoked" timestamp, + "auth_time" timestamp, + "scopes" text[] NOT NULL, + CONSTRAINT "oauth_refresh_token_token_unique" UNIQUE("token") +); +--> statement-breakpoint +ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_client_id_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."oauth_client"("client_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_session_id_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."session"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_refresh_id_oauth_refresh_token_id_fk" FOREIGN KEY ("refresh_id") REFERENCES "public"."oauth_refresh_token"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_client" ADD CONSTRAINT "oauth_client_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_consent" ADD CONSTRAINT "oauth_consent_client_id_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."oauth_client"("client_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_consent" ADD CONSTRAINT "oauth_consent_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_refresh_token" ADD CONSTRAINT "oauth_refresh_token_client_id_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."oauth_client"("client_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_refresh_token" ADD CONSTRAINT "oauth_refresh_token_session_id_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."session"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_refresh_token" ADD CONSTRAINT "oauth_refresh_token_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +CREATE INDEX "oauth_access_token_client_id_idx" ON "oauth_access_token" USING btree ("client_id");--> statement-breakpoint +CREATE INDEX "oauth_access_token_session_id_idx" ON "oauth_access_token" USING btree ("session_id");--> statement-breakpoint +CREATE INDEX "oauth_access_token_refresh_id_idx" ON "oauth_access_token" USING btree ("refresh_id");--> statement-breakpoint +CREATE INDEX "oauth_access_token_user_client_idx" ON "oauth_access_token" USING btree ("user_id","client_id");--> statement-breakpoint +CREATE INDEX "oauth_client_user_id_idx" ON "oauth_client" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX "oauth_consent_client_id_idx" ON "oauth_consent" USING btree ("client_id");--> statement-breakpoint +CREATE INDEX "oauth_consent_user_client_idx" ON "oauth_consent" USING btree ("user_id","client_id");--> statement-breakpoint +CREATE INDEX "oauth_refresh_token_client_id_idx" ON "oauth_refresh_token" USING btree ("client_id");--> statement-breakpoint +CREATE INDEX "oauth_refresh_token_session_id_idx" ON "oauth_refresh_token" USING btree ("session_id");--> statement-breakpoint +CREATE INDEX "oauth_refresh_token_user_client_idx" ON "oauth_refresh_token" USING btree ("user_id","client_id");--> statement-breakpoint +-- Seed the first-party Sim CLI as a public (PKCE-only, no secret) OAuth client. +-- Loopback redirect URIs match any port (RFC 8252 §7.3); consent is never skipped. +INSERT INTO "oauth_client" ( + "id", "client_id", "name", "disabled", "skip_consent", "public", "type", + "token_endpoint_auth_method", "require_pkce", "grant_types", "response_types", + "redirect_uris", "scopes", "created_at", "updated_at" +) VALUES ( + 'sim-cli', 'sim-cli', 'Sim CLI', false, false, true, 'native', + 'none', true, ARRAY['authorization_code', 'refresh_token'], ARRAY['code'], + ARRAY['http://127.0.0.1/callback', 'http://[::1]/callback'], + ARRAY['openid', 'profile', 'email', 'offline_access', 'api:read', 'api:write'], + now(), now() +) ON CONFLICT ("client_id") DO NOTHING; diff --git a/packages/db/migrations/0322_oauth_consent_uniqueness.sql b/packages/db/migrations/0322_oauth_consent_uniqueness.sql new file mode 100644 index 00000000000..caf6b147f89 --- /dev/null +++ b/packages/db/migrations/0322_oauth_consent_uniqueness.sql @@ -0,0 +1,4 @@ +DROP INDEX "oauth_consent_user_client_idx";--> statement-breakpoint +CREATE INDEX "oauth_access_token_expires_at_idx" ON "oauth_access_token" USING btree ("expires_at");--> statement-breakpoint +CREATE INDEX "oauth_refresh_token_expires_at_idx" ON "oauth_refresh_token" USING btree ("expires_at");--> statement-breakpoint +ALTER TABLE "oauth_consent" ADD CONSTRAINT "oauth_consent_user_client_reference_unique" UNIQUE NULLS NOT DISTINCT("user_id","client_id","reference_id"); \ No newline at end of file diff --git a/packages/db/migrations/meta/0321_snapshot.json b/packages/db/migrations/meta/0321_snapshot.json new file mode 100644 index 00000000000..6b463140bc6 --- /dev/null +++ b/packages/db/migrations/meta/0321_snapshot.json @@ -0,0 +1,22327 @@ +{ + "id": "db637a5b-308b-4095-9dae-665f049d936a", + "prevId": "5a6e3414-7fa3-4206-8e48-73d5f0ded1ce", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.academy_certificate": { + "name": "academy_certificate", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "academy_cert_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "issued_at": { + "name": "issued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "certificate_number": { + "name": "certificate_number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "academy_certificate_user_id_idx": { + "name": "academy_certificate_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "academy_certificate_course_id_idx": { + "name": "academy_certificate_course_id_idx", + "columns": [ + { + "expression": "course_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "academy_certificate_user_course_unique": { + "name": "academy_certificate_user_course_unique", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "course_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "academy_certificate_status_idx": { + "name": "academy_certificate_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "academy_certificate_user_id_user_id_fk": { + "name": "academy_certificate_user_id_user_id_fk", + "tableFrom": "academy_certificate", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "academy_certificate_certificate_number_unique": { + "name": "academy_certificate_certificate_number_unique", + "nullsNotDistinct": false, + "columns": ["certificate_number"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "account_user_id_idx": { + "name": "account_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_account_on_account_id_provider_id": { + "name": "idx_account_on_account_id_provider_id", + "columns": [ + { + "expression": "account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_key": { + "name": "api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'personal'" + }, + "last_used": { + "name": "last_used", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "api_key_workspace_type_idx": { + "name": "api_key_workspace_type_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "api_key_user_type_idx": { + "name": "api_key_user_type_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "api_key_key_hash_idx": { + "name": "api_key_key_hash_idx", + "columns": [ + { + "expression": "key_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "api_key_user_id_user_id_fk": { + "name": "api_key_user_id_user_id_fk", + "tableFrom": "api_key", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "api_key_workspace_id_workspace_id_fk": { + "name": "api_key_workspace_id_workspace_id_fk", + "tableFrom": "api_key", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "api_key_created_by_user_id_fk": { + "name": "api_key_created_by_user_id_fk", + "tableFrom": "api_key", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "api_key_key_unique": { + "name": "api_key_key_unique", + "nullsNotDistinct": false, + "columns": ["key"] + } + }, + "policies": {}, + "checkConstraints": { + "workspace_type_check": { + "name": "workspace_type_check", + "value": "(type = 'workspace' AND workspace_id IS NOT NULL) OR (type = 'personal' AND workspace_id IS NULL)" + } + }, + "isRLSEnabled": false + }, + "public.async_jobs": { + "name": "async_jobs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "run_at": { + "name": "run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "max_attempts": { + "name": "max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 3 + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "output": { + "name": "output", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "async_jobs_status_started_at_idx": { + "name": "async_jobs_status_started_at_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_status_completed_at_idx": { + "name": "async_jobs_status_completed_at_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "completed_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_schedule_pending_run_at_idx": { + "name": "async_jobs_schedule_pending_run_at_idx", + "columns": [ + { + "expression": "run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" = 'pending'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_schedule_processing_started_at_idx": { + "name": "async_jobs_schedule_processing_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" = 'processing'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_schedule_unreconciled_terminal_idx": { + "name": "async_jobs_schedule_unreconciled_terminal_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" IN ('completed', 'failed', 'cancelled') AND COALESCE(\"async_jobs\".\"metadata\" ->> 'scheduleReconciled', 'false') <> 'true'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.audit_log": { + "name": "audit_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_name": { + "name": "actor_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_email": { + "name": "actor_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "resource_name": { + "name": "resource_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "audit_log_workspace_created_idx": { + "name": "audit_log_workspace_created_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_workspace_created_at_id_idx": { + "name": "audit_log_workspace_created_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"created_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_actor_created_idx": { + "name": "audit_log_actor_created_idx", + "columns": [ + { + "expression": "actor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_resource_idx": { + "name": "audit_log_resource_idx", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_action_idx": { + "name": "audit_log_action_idx", + "columns": [ + { + "expression": "action", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "audit_log_workspace_id_workspace_id_fk": { + "name": "audit_log_workspace_id_workspace_id_fk", + "tableFrom": "audit_log", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "audit_log_actor_id_user_id_fk": { + "name": "audit_log_actor_id_user_id_fk", + "tableFrom": "audit_log", + "tableTo": "user", + "columnsFrom": ["actor_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.background_work_status": { + "name": "background_work_status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "background_work_kind", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "background_work_status_value", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "background_work_status_workspace_status_idx": { + "name": "background_work_status_workspace_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "background_work_status_workflow_status_idx": { + "name": "background_work_status_workflow_status_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "background_work_status_meta_child_ws_idx": { + "name": "background_work_status_meta_child_ws_idx", + "columns": [ + { + "expression": "(\"metadata\" ->> 'childWorkspaceId')", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "background_work_status_meta_other_ws_idx": { + "name": "background_work_status_meta_other_ws_idx", + "columns": [ + { + "expression": "(\"metadata\" ->> 'otherWorkspaceId')", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "background_work_status_workspace_id_workspace_id_fk": { + "name": "background_work_status_workspace_id_workspace_id_fk", + "tableFrom": "background_work_status", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "background_work_status_workflow_id_workflow_id_fk": { + "name": "background_work_status_workflow_id_workflow_id_fk", + "tableFrom": "background_work_status", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.chat": { + "name": "chat", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "customizations": { + "name": "customizations", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "auth_type": { + "name": "auth_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'public'" + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "allowed_emails": { + "name": "allowed_emails", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "output_configs": { + "name": "output_configs", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "include_thinking": { + "name": "include_thinking", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "include_tool_calls": { + "name": "include_tool_calls", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "identifier_idx": { + "name": "identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"chat\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "chat_archived_at_partial_idx": { + "name": "chat_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"chat\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_chat_on_workflow_id_archived_at": { + "name": "idx_chat_on_workflow_id_archived_at", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "chat_workflow_id_workflow_id_fk": { + "name": "chat_workflow_id_workflow_id_fk", + "tableFrom": "chat", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "chat_user_id_user_id_fk": { + "name": "chat_user_id_user_id_fk", + "tableFrom": "chat", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_async_tool_calls": { + "name": "copilot_async_tool_calls", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "checkpoint_id": { + "name": "checkpoint_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "tool_call_id": { + "name": "tool_call_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tool_name": { + "name": "tool_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "args": { + "name": "args", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "status": { + "name": "status", + "type": "copilot_async_tool_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "result": { + "name": "result", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "permission_decision": { + "name": "permission_decision", + "type": "copilot_tool_permission_decision", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "permission_decided_at": { + "name": "permission_decided_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "claimed_at": { + "name": "claimed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "claimed_by": { + "name": "claimed_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_async_tool_calls_run_id_idx": { + "name": "copilot_async_tool_calls_run_id_idx", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_checkpoint_id_idx": { + "name": "copilot_async_tool_calls_checkpoint_id_idx", + "columns": [ + { + "expression": "checkpoint_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_status_idx": { + "name": "copilot_async_tool_calls_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_run_status_idx": { + "name": "copilot_async_tool_calls_run_status_idx", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_tool_call_id_unique": { + "name": "copilot_async_tool_calls_tool_call_id_unique", + "columns": [ + { + "expression": "tool_call_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_async_tool_calls_run_id_copilot_runs_id_fk": { + "name": "copilot_async_tool_calls_run_id_copilot_runs_id_fk", + "tableFrom": "copilot_async_tool_calls", + "tableTo": "copilot_runs", + "columnsFrom": ["run_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_async_tool_calls_checkpoint_id_copilot_run_checkpoints_id_fk": { + "name": "copilot_async_tool_calls_checkpoint_id_copilot_run_checkpoints_id_fk", + "tableFrom": "copilot_async_tool_calls", + "tableTo": "copilot_run_checkpoints", + "columnsFrom": ["checkpoint_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_chats": { + "name": "copilot_chats", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "chat_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'copilot'" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'claude-3-7-sonnet-latest'" + }, + "conversation_id": { + "name": "conversation_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "preview_yaml": { + "name": "preview_yaml", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plan_artifact": { + "name": "plan_artifact", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "resources": { + "name": "resources", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "auto_allowed_tools": { + "name": "auto_allowed_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "pinned": { + "name": "pinned", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_chats_user_id_idx": { + "name": "copilot_chats_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_workflow_id_idx": { + "name": "copilot_chats_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_user_workflow_idx": { + "name": "copilot_chats_user_workflow_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_user_workspace_idx": { + "name": "copilot_chats_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_created_at_idx": { + "name": "copilot_chats_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_updated_at_idx": { + "name": "copilot_chats_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_workspace_created_at_id_idx": { + "name": "copilot_chats_workspace_created_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"created_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_user_workspace_deleted_partial_idx": { + "name": "copilot_chats_user_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_chats\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_chats_user_id_user_id_fk": { + "name": "copilot_chats_user_id_user_id_fk", + "tableFrom": "copilot_chats", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_chats_workflow_id_workflow_id_fk": { + "name": "copilot_chats_workflow_id_workflow_id_fk", + "tableFrom": "copilot_chats", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_chats_workspace_id_workspace_id_fk": { + "name": "copilot_chats_workspace_id_workspace_id_fk", + "tableFrom": "copilot_chats", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_feedback": { + "name": "copilot_feedback", + "schema": "", + "columns": { + "feedback_id": { + "name": "feedback_id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_query": { + "name": "user_query", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "agent_response": { + "name": "agent_response", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_positive": { + "name": "is_positive", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "feedback": { + "name": "feedback", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_yaml": { + "name": "workflow_yaml", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_feedback_user_id_idx": { + "name": "copilot_feedback_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_chat_id_idx": { + "name": "copilot_feedback_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_user_chat_idx": { + "name": "copilot_feedback_user_chat_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_is_positive_idx": { + "name": "copilot_feedback_is_positive_idx", + "columns": [ + { + "expression": "is_positive", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_created_at_idx": { + "name": "copilot_feedback_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_feedback_user_id_user_id_fk": { + "name": "copilot_feedback_user_id_user_id_fk", + "tableFrom": "copilot_feedback", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_feedback_chat_id_copilot_chats_id_fk": { + "name": "copilot_feedback_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_feedback", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_messages": { + "name": "copilot_messages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "stream_id": { + "name": "stream_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_message_id": { + "name": "parent_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tokens_in": { + "name": "tokens_in", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tokens_out": { + "name": "tokens_out", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_messages_chat_message_unique": { + "name": "copilot_messages_chat_message_unique", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_chat_created_at_idx": { + "name": "copilot_messages_chat_created_at_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_chat_seq_idx": { + "name": "copilot_messages_chat_seq_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_chat_stream_idx": { + "name": "copilot_messages_chat_stream_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stream_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"stream_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_user_created_at_idx": { + "name": "copilot_messages_user_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"role\" = 'user' AND \"copilot_messages\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_messages_chat_id_copilot_chats_id_fk": { + "name": "copilot_messages_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_messages", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_run_checkpoints": { + "name": "copilot_run_checkpoints", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "pending_tool_call_id": { + "name": "pending_tool_call_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "conversation_snapshot": { + "name": "conversation_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "agent_state": { + "name": "agent_state", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "provider_request": { + "name": "provider_request", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_run_checkpoints_run_id_idx": { + "name": "copilot_run_checkpoints_run_id_idx", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_run_checkpoints_pending_tool_call_id_idx": { + "name": "copilot_run_checkpoints_pending_tool_call_id_idx", + "columns": [ + { + "expression": "pending_tool_call_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_run_checkpoints_run_pending_tool_unique": { + "name": "copilot_run_checkpoints_run_pending_tool_unique", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "pending_tool_call_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_run_checkpoints_run_id_copilot_runs_id_fk": { + "name": "copilot_run_checkpoints_run_id_copilot_runs_id_fk", + "tableFrom": "copilot_run_checkpoints", + "tableTo": "copilot_runs", + "columnsFrom": ["run_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_runs": { + "name": "copilot_runs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_run_id": { + "name": "parent_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stream_id": { + "name": "stream_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "agent": { + "name": "agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "copilot_run_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "request_context": { + "name": "request_context", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "copilot_runs_execution_id_idx": { + "name": "copilot_runs_execution_id_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_parent_run_id_idx": { + "name": "copilot_runs_parent_run_id_idx", + "columns": [ + { + "expression": "parent_run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_chat_id_idx": { + "name": "copilot_runs_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_user_id_idx": { + "name": "copilot_runs_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_workflow_id_idx": { + "name": "copilot_runs_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_workspace_id_idx": { + "name": "copilot_runs_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_status_idx": { + "name": "copilot_runs_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_chat_execution_idx": { + "name": "copilot_runs_chat_execution_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_execution_started_at_idx": { + "name": "copilot_runs_execution_started_at_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_workspace_completed_at_id_idx": { + "name": "copilot_runs_workspace_completed_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"completed_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_stream_id_unique": { + "name": "copilot_runs_stream_id_unique", + "columns": [ + { + "expression": "stream_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_runs_chat_id_copilot_chats_id_fk": { + "name": "copilot_runs_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_runs_user_id_user_id_fk": { + "name": "copilot_runs_user_id_user_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_runs_workflow_id_workflow_id_fk": { + "name": "copilot_runs_workflow_id_workflow_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_runs_workspace_id_workspace_id_fk": { + "name": "copilot_runs_workspace_id_workspace_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_workflow_read_hashes": { + "name": "copilot_workflow_read_hashes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_workflow_read_hashes_chat_id_idx": { + "name": "copilot_workflow_read_hashes_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_workflow_read_hashes_workflow_id_idx": { + "name": "copilot_workflow_read_hashes_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_workflow_read_hashes_chat_workflow_unique": { + "name": "copilot_workflow_read_hashes_chat_workflow_unique", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_workflow_read_hashes_chat_id_copilot_chats_id_fk": { + "name": "copilot_workflow_read_hashes_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_workflow_read_hashes", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_workflow_read_hashes_workflow_id_workflow_id_fk": { + "name": "copilot_workflow_read_hashes_workflow_id_workflow_id_fk", + "tableFrom": "copilot_workflow_read_hashes", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.credential": { + "name": "credential", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "credential_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unredacted": { + "name": "unredacted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "env_key": { + "name": "env_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "env_owner_user_id": { + "name": "env_owner_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encrypted_service_account_key": { + "name": "encrypted_service_account_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorization_app_id": { + "name": "authorization_app_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_group_enrollment_id": { + "name": "credential_group_enrollment_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_group_option_id": { + "name": "credential_group_option_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mcp_server_id": { + "name": "mcp_server_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "managed_oauth_scope_version": { + "name": "managed_oauth_scope_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "provider_subject_id": { + "name": "provider_subject_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_tenant_id": { + "name": "provider_tenant_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "managed_oauth_status": { + "name": "managed_oauth_status", + "type": "managed_oauth_credential_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "granted_scopes": { + "name": "granted_scopes", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "provider_metadata": { + "name": "provider_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "encrypted_oauth_token_set": { + "name": "encrypted_oauth_token_set", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mcp_tools": { + "name": "mcp_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "mcp_tools_refreshed_at": { + "name": "mcp_tools_refreshed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "granted_at": { + "name": "granted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_refreshed_at": { + "name": "last_refreshed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_workspace_id_idx": { + "name": "credential_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_type_idx": { + "name": "credential_type_idx", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_provider_id_idx": { + "name": "credential_provider_id_idx", + "columns": [ + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_account_id_idx": { + "name": "credential_account_id_idx", + "columns": [ + { + "expression": "account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_env_owner_user_id_idx": { + "name": "credential_env_owner_user_id_idx", + "columns": [ + { + "expression": "env_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_idx": { + "name": "credential_group_enrollment_idx", + "columns": [ + { + "expression": "credential_group_enrollment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_mcp_server_idx": { + "name": "credential_mcp_server_idx", + "columns": [ + { + "expression": "mcp_server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_option_unique": { + "name": "credential_group_option_unique", + "columns": [ + { + "expression": "credential_group_enrollment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "credential_group_option_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"credential\".\"type\" = 'managed_oauth'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_managed_mcp_enrollment_server_unique": { + "name": "credential_managed_mcp_enrollment_server_unique", + "columns": [ + { + "expression": "credential_group_enrollment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "mcp_server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"credential\".\"type\" = 'managed_mcp'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_workspace_account_unique": { + "name": "credential_workspace_account_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "account_id IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_workspace_env_unique": { + "name": "credential_workspace_env_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "env_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "type = 'env_workspace'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_workspace_personal_env_unique": { + "name": "credential_workspace_personal_env_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "env_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "env_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "type = 'env_personal'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_workspace_id_workspace_id_fk": { + "name": "credential_workspace_id_workspace_id_fk", + "tableFrom": "credential", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_account_id_account_id_fk": { + "name": "credential_account_id_account_id_fk", + "tableFrom": "credential", + "tableTo": "account", + "columnsFrom": ["account_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_env_owner_user_id_user_id_fk": { + "name": "credential_env_owner_user_id_user_id_fk", + "tableFrom": "credential", + "tableTo": "user", + "columnsFrom": ["env_owner_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_credential_group_enrollment_id_credential_group_enrollment_id_fk": { + "name": "credential_credential_group_enrollment_id_credential_group_enrollment_id_fk", + "tableFrom": "credential", + "tableTo": "credential_group_enrollment", + "columnsFrom": ["credential_group_enrollment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_mcp_server_id_mcp_servers_id_fk": { + "name": "credential_mcp_server_id_mcp_servers_id_fk", + "tableFrom": "credential", + "tableTo": "mcp_servers", + "columnsFrom": ["mcp_server_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_created_by_user_id_fk": { + "name": "credential_created_by_user_id_fk", + "tableFrom": "credential", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "credential_oauth_source_check": { + "name": "credential_oauth_source_check", + "value": "(type <> 'oauth') OR (account_id IS NOT NULL AND provider_id IS NOT NULL)" + }, + "credential_managed_oauth_source_check": { + "name": "credential_managed_oauth_source_check", + "value": "(type::text <> 'managed_oauth') OR (\n account_id IS NULL\n AND provider_id IS NOT NULL\n AND authorization_app_id IS NOT NULL\n AND provider_subject_id IS NOT NULL\n AND managed_oauth_status IS NOT NULL\n AND granted_scopes IS NOT NULL\n AND cardinality(granted_scopes) > 0\n AND encrypted_oauth_token_set IS NOT NULL\n AND granted_at IS NOT NULL\n )" + }, + "credential_managed_oauth_group_binding_check": { + "name": "credential_managed_oauth_group_binding_check", + "value": "(type::text <> 'managed_oauth') OR (\n credential_group_enrollment_id IS NOT NULL\n AND credential_group_option_id IS NOT NULL\n AND managed_oauth_scope_version IS NOT NULL\n AND managed_oauth_scope_version > 0\n )" + }, + "credential_managed_mcp_source_check": { + "name": "credential_managed_mcp_source_check", + "value": "(type::text <> 'managed_mcp') OR (\n id LIKE 'mcp-cg-%'\n AND account_id IS NULL\n AND provider_id IS NULL\n AND authorization_app_id IS NULL\n AND credential_group_enrollment_id IS NOT NULL\n AND credential_group_option_id IS NULL\n AND mcp_server_id IS NOT NULL\n AND managed_oauth_status IS NOT NULL\n AND (managed_oauth_status <> 'active' OR (\n encrypted_oauth_token_set IS NOT NULL\n AND mcp_tools IS NOT NULL\n ))\n AND granted_at IS NOT NULL\n AND managed_oauth_scope_version IS NULL\n AND provider_subject_id IS NULL\n AND provider_tenant_id IS NULL\n AND granted_scopes IS NULL\n AND provider_metadata IS NULL\n AND created_by IS NULL\n AND env_key IS NULL\n AND env_owner_user_id IS NULL\n AND encrypted_service_account_key IS NULL\n AND unredacted = false\n )" + }, + "credential_creator_source_check": { + "name": "credential_creator_source_check", + "value": "(type::text = 'managed_mcp') OR created_by IS NOT NULL" + }, + "credential_workspace_env_source_check": { + "name": "credential_workspace_env_source_check", + "value": "(type <> 'env_workspace') OR (env_key IS NOT NULL AND env_owner_user_id IS NULL)" + }, + "credential_personal_env_source_check": { + "name": "credential_personal_env_source_check", + "value": "(type <> 'env_personal') OR (env_key IS NOT NULL AND env_owner_user_id IS NOT NULL)" + } + }, + "isRLSEnabled": false + }, + "public.credential_group": { + "name": "credential_group", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "public_id": { + "name": "public_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "options": { + "name": "options", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "encrypted_provider_configuration": { + "name": "encrypted_provider_configuration", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "credential_group_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_group_public_id_unique": { + "name": "credential_group_public_id_unique", + "columns": [ + { + "expression": "public_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_workspace_status_idx": { + "name": "credential_group_workspace_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_workspace_name_unique": { + "name": "credential_group_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lower(\"name\")", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_group_workspace_id_workspace_id_fk": { + "name": "credential_group_workspace_id_workspace_id_fk", + "tableFrom": "credential_group", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_group_created_by_user_id_fk": { + "name": "credential_group_created_by_user_id_fk", + "tableFrom": "credential_group", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.credential_group_enrollment": { + "name": "credential_group_enrollment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "credential_group_id": { + "name": "credential_group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "credential_group_enrollment_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'invited'" + }, + "invitation_token_hash": { + "name": "invitation_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invitation_expires_at": { + "name": "invitation_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "invited_at": { + "name": "invited_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "sent_at": { + "name": "sent_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_delivery_error": { + "name": "last_delivery_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_group_enrollment_group_email_unique": { + "name": "credential_group_enrollment_group_email_unique", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_invitation_token_hash_unique": { + "name": "credential_group_enrollment_invitation_token_hash_unique", + "columns": [ + { + "expression": "invitation_token_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_group_status_idx": { + "name": "credential_group_enrollment_group_status_idx", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_group_invited_at_id_idx": { + "name": "credential_group_enrollment_group_invited_at_id_idx", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "invited_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_group_enrollment_credential_group_id_credential_group_id_fk": { + "name": "credential_group_enrollment_credential_group_id_credential_group_id_fk", + "tableFrom": "credential_group_enrollment", + "tableTo": "credential_group", + "columnsFrom": ["credential_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_group_enrollment_created_by_user_id_fk": { + "name": "credential_group_enrollment_created_by_user_id_fk", + "tableFrom": "credential_group_enrollment", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "credential_group_enrollment_normalized_email_check": { + "name": "credential_group_enrollment_normalized_email_check", + "value": "\"credential_group_enrollment\".\"email\" = lower(btrim(\"credential_group_enrollment\".\"email\")) AND length(\"credential_group_enrollment\".\"email\") BETWEEN 3 AND 320" + }, + "credential_group_enrollment_invitation_token_hash_length_check": { + "name": "credential_group_enrollment_invitation_token_hash_length_check", + "value": "length(\"credential_group_enrollment\".\"invitation_token_hash\") = 64" + } + }, + "isRLSEnabled": false + }, + "public.credential_member": { + "name": "credential_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "credential_member_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'member'" + }, + "status": { + "name": "status", + "type": "credential_member_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "joined_at": { + "name": "joined_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "invited_by": { + "name": "invited_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_member_user_id_idx": { + "name": "credential_member_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_member_role_idx": { + "name": "credential_member_role_idx", + "columns": [ + { + "expression": "role", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_member_status_idx": { + "name": "credential_member_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_member_unique": { + "name": "credential_member_unique", + "columns": [ + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_member_credential_id_credential_id_fk": { + "name": "credential_member_credential_id_credential_id_fk", + "tableFrom": "credential_member", + "tableTo": "credential", + "columnsFrom": ["credential_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_member_user_id_user_id_fk": { + "name": "credential_member_user_id_user_id_fk", + "tableFrom": "credential_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_member_invited_by_user_id_fk": { + "name": "credential_member_invited_by_user_id_fk", + "tableFrom": "credential_member", + "tableTo": "user", + "columnsFrom": ["invited_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.custom_block": { + "name": "custom_block", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "icon_url": { + "name": "icon_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inputs": { + "name": "inputs", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "outputs": { + "name": "outputs", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "trace_child_runs": { + "name": "trace_child_runs", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "custom_block_organization_id_idx": { + "name": "custom_block_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "custom_block_workflow_id_idx": { + "name": "custom_block_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "custom_block_organization_type_unique": { + "name": "custom_block_organization_type_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "custom_block_organization_id_organization_id_fk": { + "name": "custom_block_organization_id_organization_id_fk", + "tableFrom": "custom_block", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "custom_block_workflow_id_workflow_id_fk": { + "name": "custom_block_workflow_id_workflow_id_fk", + "tableFrom": "custom_block", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "custom_block_created_by_user_id_fk": { + "name": "custom_block_created_by_user_id_fk", + "tableFrom": "custom_block", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.custom_tools": { + "name": "custom_tools", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "schema": { + "name": "schema", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "custom_tools_workspace_id_idx": { + "name": "custom_tools_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "custom_tools_workspace_title_unique": { + "name": "custom_tools_workspace_title_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "title", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "custom_tools_workspace_id_workspace_id_fk": { + "name": "custom_tools_workspace_id_workspace_id_fk", + "tableFrom": "custom_tools", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "custom_tools_user_id_user_id_fk": { + "name": "custom_tools_user_id_user_id_fk", + "tableFrom": "custom_tools", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.data_drain_runs": { + "name": "data_drain_runs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "drain_id": { + "name": "drain_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "data_drain_run_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "trigger": { + "name": "trigger", + "type": "data_drain_run_trigger", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "finished_at": { + "name": "finished_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rows_exported": { + "name": "rows_exported", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "bytes_written": { + "name": "bytes_written", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "cursor_before": { + "name": "cursor_before", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cursor_after": { + "name": "cursor_after", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "locators": { + "name": "locators", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "data_drain_runs_drain_started_idx": { + "name": "data_drain_runs_drain_started_idx", + "columns": [ + { + "expression": "drain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "data_drain_runs_drain_id_data_drains_id_fk": { + "name": "data_drain_runs_drain_id_data_drains_id_fk", + "tableFrom": "data_drain_runs", + "tableTo": "data_drains", + "columnsFrom": ["drain_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.data_drains": { + "name": "data_drains", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "data_drain_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "destination_type": { + "name": "destination_type", + "type": "data_drain_destination", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "destination_config": { + "name": "destination_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "destination_credentials": { + "name": "destination_credentials", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "schedule_cadence": { + "name": "schedule_cadence", + "type": "data_drain_cadence", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "cursor": { + "name": "cursor", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_run_at": { + "name": "last_run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_success_at": { + "name": "last_success_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "data_drains_org_idx": { + "name": "data_drains_org_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "data_drains_due_idx": { + "name": "data_drains_due_idx", + "columns": [ + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "data_drains_org_name_unique": { + "name": "data_drains_org_name_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "data_drains_organization_id_organization_id_fk": { + "name": "data_drains_organization_id_organization_id_fk", + "tableFrom": "data_drains", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "data_drains_created_by_user_id_fk": { + "name": "data_drains_created_by_user_id_fk", + "tableFrom": "data_drains", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.docs_embeddings": { + "name": "docs_embeddings", + "schema": "", + "columns": { + "chunk_id": { + "name": "chunk_id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "chunk_text": { + "name": "chunk_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_document": { + "name": "source_document", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_link": { + "name": "source_link", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header_text": { + "name": "header_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header_level": { + "name": "header_level", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "embedding": { + "name": "embedding", + "type": "vector(1536)", + "primaryKey": false, + "notNull": true + }, + "embedding_model": { + "name": "embedding_model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text-embedding-3-small'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "chunk_text_tsv": { + "name": "chunk_text_tsv", + "type": "tsvector", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "to_tsvector('english', \"docs_embeddings\".\"chunk_text\")", + "type": "stored" + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "docs_emb_source_document_idx": { + "name": "docs_emb_source_document_idx", + "columns": [ + { + "expression": "source_document", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_header_level_idx": { + "name": "docs_emb_header_level_idx", + "columns": [ + { + "expression": "header_level", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_source_header_idx": { + "name": "docs_emb_source_header_idx", + "columns": [ + { + "expression": "source_document", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "header_level", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_model_idx": { + "name": "docs_emb_model_idx", + "columns": [ + { + "expression": "embedding_model", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_created_at_idx": { + "name": "docs_emb_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_embedding_vector_hnsw_idx": { + "name": "docs_embedding_vector_hnsw_idx", + "columns": [ + { + "expression": "embedding", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "vector_cosine_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hnsw", + "with": { + "m": 16, + "ef_construction": 64 + } + }, + "docs_emb_metadata_gin_idx": { + "name": "docs_emb_metadata_gin_idx", + "columns": [ + { + "expression": "metadata", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "docs_emb_chunk_text_fts_idx": { + "name": "docs_emb_chunk_text_fts_idx", + "columns": [ + { + "expression": "chunk_text_tsv", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "docs_embedding_not_null_check": { + "name": "docs_embedding_not_null_check", + "value": "\"embedding\" IS NOT NULL" + }, + "docs_header_level_check": { + "name": "docs_header_level_check", + "value": "\"header_level\" >= 1 AND \"header_level\" <= 6" + } + }, + "isRLSEnabled": false + }, + "public.document": { + "name": "document", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "filename": { + "name": "filename", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_url": { + "name": "file_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "storage_key": { + "name": "storage_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chunk_count": { + "name": "chunk_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "character_count": { + "name": "character_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "processing_status": { + "name": "processing_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "processing_attempts": { + "name": "processing_attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "processing_queued_at": { + "name": "processing_queued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_queue_token": { + "name": "processing_queue_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "processing_started_at": { + "name": "processing_started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_deferred_until": { + "name": "processing_deferred_until", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_completed_at": { + "name": "processing_completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_error": { + "name": "processing_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "user_excluded": { + "name": "user_excluded", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "tag1": { + "name": "tag1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag2": { + "name": "tag2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag3": { + "name": "tag3", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag4": { + "name": "tag4", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag5": { + "name": "tag5", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag6": { + "name": "tag6", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag7": { + "name": "tag7", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "number1": { + "name": "number1", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number2": { + "name": "number2", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number3": { + "name": "number3", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number4": { + "name": "number4", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number5": { + "name": "number5", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "date1": { + "name": "date1", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "date2": { + "name": "date2", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "boolean1": { + "name": "boolean1", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean2": { + "name": "boolean2", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean3": { + "name": "boolean3", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_url": { + "name": "source_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "acl": { + "name": "acl", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{ws}'::text[]" + }, + "source_modified_at": { + "name": "source_modified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "doc_kb_id_idx": { + "name": "doc_kb_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_acl_gin_idx": { + "name": "doc_acl_gin_idx", + "columns": [ + { + "expression": "acl", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "array_ops" + } + ], + "isUnique": false, + "where": "\"document\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "gin", + "with": {} + }, + "doc_filename_idx": { + "name": "doc_filename_idx", + "columns": [ + { + "expression": "filename", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_processing_status_idx": { + "name": "doc_processing_status_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "processing_status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_connector_external_id_idx": { + "name": "doc_connector_external_id_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"document\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_connector_id_idx": { + "name": "doc_connector_id_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_active_kb_token_count_idx": { + "name": "doc_active_kb_token_count_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "token_count", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"user_excluded\" = false AND \"document\".\"archived_at\" IS NULL AND \"document\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_storage_key_idx": { + "name": "doc_storage_key_idx", + "columns": [ + { + "expression": "storage_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"storage_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_archived_at_partial_idx": { + "name": "doc_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_deleted_at_partial_idx": { + "name": "doc_deleted_at_partial_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag1_idx": { + "name": "doc_tag1_idx", + "columns": [ + { + "expression": "tag1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag2_idx": { + "name": "doc_tag2_idx", + "columns": [ + { + "expression": "tag2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag3_idx": { + "name": "doc_tag3_idx", + "columns": [ + { + "expression": "tag3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag4_idx": { + "name": "doc_tag4_idx", + "columns": [ + { + "expression": "tag4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag5_idx": { + "name": "doc_tag5_idx", + "columns": [ + { + "expression": "tag5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag6_idx": { + "name": "doc_tag6_idx", + "columns": [ + { + "expression": "tag6", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag7_idx": { + "name": "doc_tag7_idx", + "columns": [ + { + "expression": "tag7", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number1_idx": { + "name": "doc_number1_idx", + "columns": [ + { + "expression": "number1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number2_idx": { + "name": "doc_number2_idx", + "columns": [ + { + "expression": "number2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number3_idx": { + "name": "doc_number3_idx", + "columns": [ + { + "expression": "number3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number4_idx": { + "name": "doc_number4_idx", + "columns": [ + { + "expression": "number4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number5_idx": { + "name": "doc_number5_idx", + "columns": [ + { + "expression": "number5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_date1_idx": { + "name": "doc_date1_idx", + "columns": [ + { + "expression": "date1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_date2_idx": { + "name": "doc_date2_idx", + "columns": [ + { + "expression": "date2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_boolean1_idx": { + "name": "doc_boolean1_idx", + "columns": [ + { + "expression": "boolean1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_boolean2_idx": { + "name": "doc_boolean2_idx", + "columns": [ + { + "expression": "boolean2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_boolean3_idx": { + "name": "doc_boolean3_idx", + "columns": [ + { + "expression": "boolean3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "document_knowledge_base_id_knowledge_base_id_fk": { + "name": "document_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "document", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "document_connector_id_knowledge_connector_id_fk": { + "name": "document_connector_id_knowledge_connector_id_fk", + "tableFrom": "document", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "document_uploaded_by_user_id_fk": { + "name": "document_uploaded_by_user_id_fk", + "tableFrom": "document", + "tableTo": "user", + "columnsFrom": ["uploaded_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "doc_acl_token_shape_check": { + "name": "doc_acl_token_shape_check", + "value": "array_position(\"document\".\"acl\", NULL) IS NULL AND (cardinality(\"document\".\"acl\") = 0 OR (cardinality(\"document\".\"acl\") = array_length(string_to_array(array_to_string(\"document\".\"acl\", E'\\n'), E'\\n'), 1) AND array_to_string(\"document\".\"acl\", E'\\n') ~ '^((ws|pub|link|u:[^\\nA-Z]+@[^\\nA-Z]+|[gs]:[^\\n:]+:[^\\n:]+:[^\\n]+)(\\n(ws|pub|link|u:[^\\nA-Z]+@[^\\nA-Z]+|[gs]:[^\\n:]+:[^\\n:]+:[^\\n]+))*)$'))" + } + }, + "isRLSEnabled": false + }, + "public.document_secret_provenance": { + "name": "document_secret_provenance", + "schema": "", + "columns": { + "document_id": { + "name": "document_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "source_hash": { + "name": "source_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_secret_provenance_document_id_document_id_fk": { + "name": "document_secret_provenance_document_id_document_id_fk", + "tableFrom": "document_secret_provenance", + "tableTo": "document", + "columnsFrom": ["document_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "document_secret_provenance_status_check": { + "name": "document_secret_provenance_status_check", + "value": "\"document_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.embedding": { + "name": "embedding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chunk_index": { + "name": "chunk_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "chunk_hash": { + "name": "chunk_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content_length": { + "name": "content_length", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "embedding": { + "name": "embedding", + "type": "vector(1536)", + "primaryKey": false, + "notNull": false + }, + "embedding_model": { + "name": "embedding_model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text-embedding-3-small'" + }, + "start_offset": { + "name": "start_offset", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "end_offset": { + "name": "end_offset", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag1": { + "name": "tag1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag2": { + "name": "tag2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag3": { + "name": "tag3", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag4": { + "name": "tag4", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag5": { + "name": "tag5", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag6": { + "name": "tag6", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag7": { + "name": "tag7", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "number1": { + "name": "number1", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number2": { + "name": "number2", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number3": { + "name": "number3", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number4": { + "name": "number4", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number5": { + "name": "number5", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "date1": { + "name": "date1", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "date2": { + "name": "date2", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "boolean1": { + "name": "boolean1", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean2": { + "name": "boolean2", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean3": { + "name": "boolean3", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "content_tsv": { + "name": "content_tsv", + "type": "tsvector", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "to_tsvector('english', \"embedding\".\"content\")", + "type": "stored" + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "emb_kb_id_idx": { + "name": "emb_kb_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_doc_id_idx": { + "name": "emb_doc_id_idx", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_doc_chunk_idx": { + "name": "emb_doc_chunk_idx", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chunk_index", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_kb_model_idx": { + "name": "emb_kb_model_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "embedding_model", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_kb_enabled_idx": { + "name": "emb_kb_enabled_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_doc_enabled_idx": { + "name": "emb_doc_enabled_idx", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "embedding_vector_hnsw_idx": { + "name": "embedding_vector_hnsw_idx", + "columns": [ + { + "expression": "embedding", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "vector_cosine_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hnsw", + "with": { + "m": 16, + "ef_construction": 64 + } + }, + "emb_tag1_idx": { + "name": "emb_tag1_idx", + "columns": [ + { + "expression": "tag1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag2_idx": { + "name": "emb_tag2_idx", + "columns": [ + { + "expression": "tag2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag3_idx": { + "name": "emb_tag3_idx", + "columns": [ + { + "expression": "tag3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag4_idx": { + "name": "emb_tag4_idx", + "columns": [ + { + "expression": "tag4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag5_idx": { + "name": "emb_tag5_idx", + "columns": [ + { + "expression": "tag5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag6_idx": { + "name": "emb_tag6_idx", + "columns": [ + { + "expression": "tag6", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag7_idx": { + "name": "emb_tag7_idx", + "columns": [ + { + "expression": "tag7", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number1_idx": { + "name": "emb_number1_idx", + "columns": [ + { + "expression": "number1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number2_idx": { + "name": "emb_number2_idx", + "columns": [ + { + "expression": "number2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number3_idx": { + "name": "emb_number3_idx", + "columns": [ + { + "expression": "number3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number4_idx": { + "name": "emb_number4_idx", + "columns": [ + { + "expression": "number4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number5_idx": { + "name": "emb_number5_idx", + "columns": [ + { + "expression": "number5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_date1_idx": { + "name": "emb_date1_idx", + "columns": [ + { + "expression": "date1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_date2_idx": { + "name": "emb_date2_idx", + "columns": [ + { + "expression": "date2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_boolean1_idx": { + "name": "emb_boolean1_idx", + "columns": [ + { + "expression": "boolean1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_boolean2_idx": { + "name": "emb_boolean2_idx", + "columns": [ + { + "expression": "boolean2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_boolean3_idx": { + "name": "emb_boolean3_idx", + "columns": [ + { + "expression": "boolean3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_content_fts_idx": { + "name": "emb_content_fts_idx", + "columns": [ + { + "expression": "content_tsv", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": { + "embedding_knowledge_base_id_knowledge_base_id_fk": { + "name": "embedding_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "embedding", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "embedding_document_id_document_id_fk": { + "name": "embedding_document_id_document_id_fk", + "tableFrom": "embedding", + "tableTo": "document", + "columnsFrom": ["document_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "embedding_not_null_check": { + "name": "embedding_not_null_check", + "value": "\"embedding\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.embedding_secret_provenance": { + "name": "embedding_secret_provenance", + "schema": "", + "columns": { + "embedding_id": { + "name": "embedding_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "embedding_secret_provenance_embedding_id_embedding_id_fk": { + "name": "embedding_secret_provenance_embedding_id_embedding_id_fk", + "tableFrom": "embedding_secret_provenance", + "tableTo": "embedding", + "columnsFrom": ["embedding_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "embedding_secret_provenance_status_check": { + "name": "embedding_secret_provenance_status_check", + "value": "\"embedding_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.environment": { + "name": "environment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "variables": { + "name": "variables", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "environment_user_id_user_id_fk": { + "name": "environment_user_id_user_id_fk", + "tableFrom": "environment", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "environment_user_id_unique": { + "name": "environment_user_id_unique", + "nullsNotDistinct": false, + "columns": ["user_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_large_value_dependencies": { + "name": "execution_large_value_dependencies", + "schema": "", + "columns": { + "parent_key": { + "name": "parent_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_key": { + "name": "child_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "execution_large_value_dependencies_workspace_parent_key_idx": { + "name": "execution_large_value_dependencies_workspace_parent_key_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_value_dependencies_workspace_child_key_idx": { + "name": "execution_large_value_dependencies_workspace_child_key_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "child_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_large_value_dependencies_workspace_id_workspace_id_fk": { + "name": "execution_large_value_dependencies_workspace_id_workspace_id_fk", + "tableFrom": "execution_large_value_dependencies", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "execution_large_value_dependencies_parent_key_child_key_pk": { + "name": "execution_large_value_dependencies_parent_key_child_key_pk", + "columns": ["parent_key", "child_key"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_large_value_references": { + "name": "execution_large_value_references", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "execution_large_value_reference_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "execution_large_value_references_workspace_execution_source_idx": { + "name": "execution_large_value_references_workspace_execution_source_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_value_references_workflow_id_idx": { + "name": "execution_large_value_references_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_large_value_references_workspace_id_workspace_id_fk": { + "name": "execution_large_value_references_workspace_id_workspace_id_fk", + "tableFrom": "execution_large_value_references", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "execution_large_value_references_workflow_id_workflow_id_fk": { + "name": "execution_large_value_references_workflow_id_workflow_id_fk", + "tableFrom": "execution_large_value_references", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "execution_large_value_references_key_execution_id_source_pk": { + "name": "execution_large_value_references_key_execution_id_source_pk", + "columns": ["key", "execution_id", "source"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_large_values": { + "name": "execution_large_values", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_execution_id": { + "name": "owner_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "execution_large_values_owner_execution_id_idx": { + "name": "execution_large_values_owner_execution_id_idx", + "columns": [ + { + "expression": "owner_execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_values_cleanup_idx": { + "name": "execution_large_values_cleanup_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"execution_large_values\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_values_tombstone_cleanup_idx": { + "name": "execution_large_values_tombstone_cleanup_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"execution_large_values\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_values_workflow_id_idx": { + "name": "execution_large_values_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_large_values_workspace_id_workspace_id_fk": { + "name": "execution_large_values_workspace_id_workspace_id_fk", + "tableFrom": "execution_large_values", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "execution_large_values_workflow_id_workflow_id_fk": { + "name": "execution_large_values_workflow_id_workflow_id_fk", + "tableFrom": "execution_large_values", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.folder": { + "name": "folder", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "folder_resource_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_id": { + "name": "parent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "locked": { + "name": "locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "folder_user_idx": { + "name": "folder_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_workspace_resource_parent_idx": { + "name": "folder_workspace_resource_parent_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_parent_sort_idx": { + "name": "folder_parent_sort_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_deleted_at_idx": { + "name": "folder_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_workspace_deleted_partial_idx": { + "name": "folder_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"folder\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_workspace_resource_parent_name_active_unique": { + "name": "folder_workspace_resource_parent_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"parent_id\", '')", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"folder\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "folder_user_id_user_id_fk": { + "name": "folder_user_id_user_id_fk", + "tableFrom": "folder", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "folder_workspace_id_workspace_id_fk": { + "name": "folder_workspace_id_workspace_id_fk", + "tableFrom": "folder", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "folder_parent_id_folder_id_fk": { + "name": "folder_parent_id_folder_id_fk", + "tableFrom": "folder", + "tableTo": "folder", + "columnsFrom": ["parent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.idempotency_key": { + "name": "idempotency_key", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "result": { + "name": "result", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idempotency_key_created_at_idx": { + "name": "idempotency_key_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.invitation": { + "name": "invitation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "invitation_kind", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'organization'" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inviter_id": { + "name": "inviter_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "membership_intent": { + "name": "membership_intent", + "type": "invitation_membership_intent", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'internal'" + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "invitation_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "invitation_email_idx": { + "name": "invitation_email_idx", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_organization_id_idx": { + "name": "invitation_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_status_idx": { + "name": "invitation_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_pending_email_org_unique": { + "name": "invitation_pending_email_org_unique", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"invitation\".\"status\" = 'pending' AND \"invitation\".\"organization_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "invitation_inviter_id_user_id_fk": { + "name": "invitation_inviter_id_user_id_fk", + "tableFrom": "invitation", + "tableTo": "user", + "columnsFrom": ["inviter_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "invitation_organization_id_organization_id_fk": { + "name": "invitation_organization_id_organization_id_fk", + "tableFrom": "invitation", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "invitation_token_unique": { + "name": "invitation_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.invitation_workspace_grant": { + "name": "invitation_workspace_grant", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "invitation_id": { + "name": "invitation_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "permission_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "invitation_workspace_grant_unique": { + "name": "invitation_workspace_grant_unique", + "columns": [ + { + "expression": "invitation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_workspace_grant_workspace_id_idx": { + "name": "invitation_workspace_grant_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "invitation_workspace_grant_invitation_id_invitation_id_fk": { + "name": "invitation_workspace_grant_invitation_id_invitation_id_fk", + "tableFrom": "invitation_workspace_grant", + "tableTo": "invitation", + "columnsFrom": ["invitation_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "invitation_workspace_grant_workspace_id_workspace_id_fk": { + "name": "invitation_workspace_grant_workspace_id_workspace_id_fk", + "tableFrom": "invitation_workspace_grant", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_execution_logs": { + "name": "job_execution_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "schedule_id": { + "name": "schedule_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "level": { + "name": "level", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'running'" + }, + "trigger": { + "name": "trigger", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "total_duration_ms": { + "name": "total_duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "execution_data": { + "name": "execution_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "cost": { + "name": "cost", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "job_execution_logs_schedule_id_idx": { + "name": "job_execution_logs_schedule_id_idx", + "columns": [ + { + "expression": "schedule_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_workspace_started_at_idx": { + "name": "job_execution_logs_workspace_started_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_workspace_ended_at_id_idx": { + "name": "job_execution_logs_workspace_ended_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"ended_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_execution_id_unique": { + "name": "job_execution_logs_execution_id_unique", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_trigger_idx": { + "name": "job_execution_logs_trigger_idx", + "columns": [ + { + "expression": "trigger", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_execution_logs_schedule_id_workflow_schedule_id_fk": { + "name": "job_execution_logs_schedule_id_workflow_schedule_id_fk", + "tableFrom": "job_execution_logs", + "tableTo": "workflow_schedule", + "columnsFrom": ["schedule_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "job_execution_logs_workspace_id_workspace_id_fk": { + "name": "job_execution_logs_workspace_id_workspace_id_fk", + "tableFrom": "job_execution_logs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_base": { + "name": "knowledge_base", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "embedding_model": { + "name": "embedding_model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text-embedding-3-small'" + }, + "embedding_dimension": { + "name": "embedding_dimension", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1536 + }, + "chunking_config": { + "name": "chunking_config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{\"maxSize\": 1024, \"minSize\": 1, \"overlap\": 200}'" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "kb_user_id_idx": { + "name": "kb_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_workspace_id_idx": { + "name": "kb_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_user_workspace_idx": { + "name": "kb_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_folder_id_idx": { + "name": "kb_folder_id_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_deleted_at_idx": { + "name": "kb_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_workspace_deleted_partial_idx": { + "name": "kb_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_base\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_workspace_name_active_unique": { + "name": "kb_workspace_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"knowledge_base\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_base_user_id_user_id_fk": { + "name": "knowledge_base_user_id_user_id_fk", + "tableFrom": "knowledge_base", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_base_workspace_id_workspace_id_fk": { + "name": "knowledge_base_workspace_id_workspace_id_fk", + "tableFrom": "knowledge_base", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_base_folder_id_folder_id_fk": { + "name": "knowledge_base_folder_id_folder_id_fk", + "tableFrom": "knowledge_base", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_base_tag_definitions": { + "name": "knowledge_base_tag_definitions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_slot": { + "name": "tag_slot", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "field_type": { + "name": "field_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "kb_tag_definitions_kb_slot_idx": { + "name": "kb_tag_definitions_kb_slot_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_slot", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_tag_definitions_kb_display_name_idx": { + "name": "kb_tag_definitions_kb_display_name_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "display_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_tag_definitions_kb_id_idx": { + "name": "kb_tag_definitions_kb_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_base_tag_definitions_knowledge_base_id_knowledge_base_id_fk": { + "name": "knowledge_base_tag_definitions_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "knowledge_base_tag_definitions", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_connector": { + "name": "knowledge_connector", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "connector_type": { + "name": "connector_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_config": { + "name": "source_config", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "sync_mode": { + "name": "sync_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'full'" + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1440 + }, + "access_mode": { + "name": "access_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'workspace'" + }, + "credential_group_id": { + "name": "credential_group_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_group_option_id": { + "name": "credential_group_option_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_sync_status": { + "name": "member_sync_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'idle'" + }, + "member_sync_lock_token": { + "name": "member_sync_lock_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_sync_lock_lease_at": { + "name": "member_sync_lock_lease_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_member_sync_at": { + "name": "next_member_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_member_sync_at": { + "name": "last_member_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_member_sync_error": { + "name": "last_member_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_sync_consecutive_failures": { + "name": "member_sync_consecutive_failures", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "access_rewrite_pending": { + "name": "access_rewrite_pending", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_sync_doc_count": { + "name": "last_sync_doc_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "consecutive_failures": { + "name": "consecutive_failures", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "sync_lock_token": { + "name": "sync_lock_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sync_lock_lease_at": { + "name": "sync_lock_lease_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "kc_knowledge_base_id_idx": { + "name": "kc_knowledge_base_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_status_next_sync_idx": { + "name": "kc_status_next_sync_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "next_sync_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_archived_at_partial_idx": { + "name": "kc_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_deleted_at_partial_idx": { + "name": "kc_deleted_at_partial_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_member_sync_due_idx": { + "name": "kc_member_sync_due_idx", + "columns": [ + { + "expression": "member_sync_status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "next_member_sync_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector\".\"access_mode\" = 'members' AND \"knowledge_connector\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_knowledge_base_id_knowledge_base_id_fk": { + "name": "knowledge_connector_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "knowledge_connector", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_connector_credential_group_id_credential_group_id_fk": { + "name": "knowledge_connector_credential_group_id_credential_group_id_fk", + "tableFrom": "knowledge_connector", + "tableTo": "credential_group", + "columnsFrom": ["credential_group_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "kc_access_mode_check": { + "name": "kc_access_mode_check", + "value": "\"knowledge_connector\".\"access_mode\" IN ('workspace', 'members', 'admin')" + }, + "kc_member_sync_status_check": { + "name": "kc_member_sync_status_check", + "value": "\"knowledge_connector\".\"member_sync_status\" IN ('idle', 'pending', 'running', 'error', 'disabled')" + }, + "kc_sync_lock_exclusive_check": { + "name": "kc_sync_lock_exclusive_check", + "value": "NOT (\"knowledge_connector\".\"sync_lock_token\" IS NOT NULL AND \"knowledge_connector\".\"member_sync_lock_token\" IS NOT NULL)" + } + }, + "isRLSEnabled": false + }, + "public.knowledge_connector_member": { + "name": "knowledge_connector_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "subject_token": { + "name": "subject_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "consecutive_failures": { + "name": "consecutive_failures", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "next_attempt_at": { + "name": "next_attempt_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_started_at": { + "name": "last_started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_complete_listing_at": { + "name": "last_complete_listing_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_listed_count": { + "name": "last_listed_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_synced_through": { + "name": "member_synced_through", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "change_cursor": { + "name": "change_cursor", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "suspended_at": { + "name": "suspended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "kcm_connector_credential_unique": { + "name": "kcm_connector_credential_unique", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcm_connector_queue_idx": { + "name": "kcm_connector_queue_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "next_attempt_at", + "isExpression": false, + "asc": true, + "nulls": "first" + }, + { + "expression": "last_started_at", + "isExpression": false, + "asc": true, + "nulls": "first" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcm_credential_idx": { + "name": "kcm_credential_idx", + "columns": [ + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_member_workspace_id_workspace_id_fk": { + "name": "knowledge_connector_member_workspace_id_workspace_id_fk", + "tableFrom": "knowledge_connector_member", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_connector_member_connector_id_knowledge_connector_id_fk": { + "name": "knowledge_connector_member_connector_id_knowledge_connector_id_fk", + "tableFrom": "knowledge_connector_member", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_connector_member_credential_id_credential_id_fk": { + "name": "knowledge_connector_member_credential_id_credential_id_fk", + "tableFrom": "knowledge_connector_member", + "tableTo": "credential", + "columnsFrom": ["credential_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "kcm_status_check": { + "name": "kcm_status_check", + "value": "\"knowledge_connector_member\".\"status\" IN ('active', 'suspended', 'disabled')" + }, + "kcm_subject_token_shape_check": { + "name": "kcm_subject_token_shape_check", + "value": "\"knowledge_connector_member\".\"subject_token\" ~ '^s:[^:]+:[^:]+:.+$'" + } + }, + "isRLSEnabled": false + }, + "public.knowledge_connector_member_sync_log": { + "name": "knowledge_connector_member_sync_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "members_claimed": { + "name": "members_claimed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "members_completed": { + "name": "members_completed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "members_incomplete": { + "name": "members_incomplete", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "members_failed": { + "name": "members_failed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_listed": { + "name": "docs_listed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_added": { + "name": "docs_added", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_updated": { + "name": "docs_updated", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_unchanged": { + "name": "docs_unchanged", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_hydrated_once": { + "name": "docs_hydrated_once", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "observations_added": { + "name": "observations_added", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "observations_removed": { + "name": "observations_removed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_tombstoned": { + "name": "docs_tombstoned", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_resurrected": { + "name": "docs_resurrected", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_purged": { + "name": "docs_purged", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "credentials_audited": { + "name": "credentials_audited", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "kcmsl_connector_started_at_idx": { + "name": "kcmsl_connector_started_at_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"started_at\" DESC", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcmsl_started_at_partial_idx": { + "name": "kcmsl_started_at_partial_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector_member_sync_log\".\"status\" = 'started'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_member_sync_log_connector_id_knowledge_connector_id_fk": { + "name": "knowledge_connector_member_sync_log_connector_id_knowledge_connector_id_fk", + "tableFrom": "knowledge_connector_member_sync_log", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "kcmsl_status_check": { + "name": "kcmsl_status_check", + "value": "\"knowledge_connector_member_sync_log\".\"status\" IN ('started', 'completed', 'failed')" + } + }, + "isRLSEnabled": false + }, + "public.knowledge_connector_sync_log": { + "name": "knowledge_connector_sync_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "docs_added": { + "name": "docs_added", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_updated": { + "name": "docs_updated", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_deleted": { + "name": "docs_deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_unchanged": { + "name": "docs_unchanged", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_skipped": { + "name": "docs_skipped", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_failed": { + "name": "docs_failed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "kcsl_connector_started_at_idx": { + "name": "kcsl_connector_started_at_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"started_at\" DESC", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcsl_started_at_partial_idx": { + "name": "kcsl_started_at_partial_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector_sync_log\".\"status\" = 'started'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_sync_log_connector_id_knowledge_connector_id_fk": { + "name": "knowledge_connector_sync_log_connector_id_knowledge_connector_id_fk", + "tableFrom": "knowledge_connector_sync_log", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_document_observation": { + "name": "knowledge_document_observation", + "schema": "", + "columns": { + "document_id": { + "name": "document_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "member_id": { + "name": "member_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "run_id": { + "name": "run_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "kdo_member_idx": { + "name": "kdo_member_idx", + "columns": [ + { + "expression": "member_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_document_observation_document_id_document_id_fk": { + "name": "knowledge_document_observation_document_id_document_id_fk", + "tableFrom": "knowledge_document_observation", + "tableTo": "document", + "columnsFrom": ["document_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_document_observation_member_id_knowledge_connector_member_id_fk": { + "name": "knowledge_document_observation_member_id_knowledge_connector_member_id_fk", + "tableFrom": "knowledge_document_observation", + "tableTo": "knowledge_connector_member", + "columnsFrom": ["member_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "knowledge_document_observation_document_id_member_id_pk": { + "name": "knowledge_document_observation_document_id_member_id_pk", + "columns": ["document_id", "member_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mcp_server_oauth": { + "name": "mcp_server_oauth", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "mcp_server_id": { + "name": "mcp_server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_information": { + "name": "client_information", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tokens": { + "name": "tokens", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "code_verifier": { + "name": "code_verifier", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state_created_at": { + "name": "state_created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_refreshed_at": { + "name": "last_refreshed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "mcp_server_oauth_server_unique": { + "name": "mcp_server_oauth_server_unique", + "columns": [ + { + "expression": "mcp_server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_server_oauth_state_idx": { + "name": "mcp_server_oauth_state_idx", + "columns": [ + { + "expression": "state", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mcp_server_oauth_mcp_server_id_mcp_servers_id_fk": { + "name": "mcp_server_oauth_mcp_server_id_mcp_servers_id_fk", + "tableFrom": "mcp_server_oauth", + "tableTo": "mcp_servers", + "columnsFrom": ["mcp_server_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mcp_server_oauth_user_id_user_id_fk": { + "name": "mcp_server_oauth_user_id_user_id_fk", + "tableFrom": "mcp_server_oauth", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "mcp_server_oauth_workspace_id_workspace_id_fk": { + "name": "mcp_server_oauth_workspace_id_workspace_id_fk", + "tableFrom": "mcp_server_oauth", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mcp_servers": { + "name": "mcp_servers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_group_id": { + "name": "credential_group_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "managed_connector_id": { + "name": "managed_connector_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "transport": { + "name": "transport", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "auth_type": { + "name": "auth_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'headers'" + }, + "oauth_client_id": { + "name": "oauth_client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "oauth_client_secret": { + "name": "oauth_client_secret", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "headers": { + "name": "headers", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "timeout": { + "name": "timeout", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30000 + }, + "retries": { + "name": "retries", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "last_connected": { + "name": "last_connected", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "connection_status": { + "name": "connection_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'disconnected'" + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status_config": { + "name": "status_config", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "tool_count": { + "name": "tool_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_tools_refresh": { + "name": "last_tools_refresh", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "total_requests": { + "name": "total_requests", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_used": { + "name": "last_used", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "mcp_servers_workspace_enabled_idx": { + "name": "mcp_servers_workspace_enabled_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_servers_credential_group_idx": { + "name": "mcp_servers_credential_group_idx", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_servers_credential_group_managed_connector_unique": { + "name": "mcp_servers_credential_group_managed_connector_unique", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "managed_connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"mcp_servers\".\"credential_group_id\" IS NOT NULL AND \"mcp_servers\".\"managed_connector_id\" IS NOT NULL AND \"mcp_servers\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_servers_workspace_deleted_partial_idx": { + "name": "mcp_servers_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"mcp_servers\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mcp_servers_workspace_id_workspace_id_fk": { + "name": "mcp_servers_workspace_id_workspace_id_fk", + "tableFrom": "mcp_servers", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mcp_servers_credential_group_id_credential_group_id_fk": { + "name": "mcp_servers_credential_group_id_credential_group_id_fk", + "tableFrom": "mcp_servers", + "tableTo": "credential_group", + "columnsFrom": ["credential_group_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "mcp_servers_created_by_user_id_fk": { + "name": "mcp_servers_created_by_user_id_fk", + "tableFrom": "mcp_servers", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "mcp_servers_credential_group_managed_connector_check": { + "name": "mcp_servers_credential_group_managed_connector_check", + "value": "\"mcp_servers\".\"credential_group_id\" IS NULL OR \"mcp_servers\".\"managed_connector_id\" IS NOT NULL" + }, + "mcp_servers_managed_connector_oauth_check": { + "name": "mcp_servers_managed_connector_oauth_check", + "value": "\"mcp_servers\".\"managed_connector_id\" IS NULL OR \"mcp_servers\".\"auth_type\" = 'oauth'" + } + }, + "isRLSEnabled": false + }, + "public.member": { + "name": "member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "member_user_id_unique": { + "name": "member_user_id_unique", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "member_organization_id_idx": { + "name": "member_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "member_user_id_user_id_fk": { + "name": "member_user_id_user_id_fk", + "tableFrom": "member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "member_organization_id_organization_id_fk": { + "name": "member_organization_id_organization_id_fk", + "tableFrom": "member", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.memory": { + "name": "memory", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "memory_key_idx": { + "name": "memory_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "memory_workspace_idx": { + "name": "memory_workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "memory_workspace_key_idx": { + "name": "memory_workspace_key_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "memory_workspace_deleted_partial_idx": { + "name": "memory_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"memory\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "memory_workspace_id_workspace_id_fk": { + "name": "memory_workspace_id_workspace_id_fk", + "tableFrom": "memory", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.memory_secret_provenance": { + "name": "memory_secret_provenance", + "schema": "", + "columns": { + "memory_id": { + "name": "memory_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "memory_secret_provenance_memory_id_memory_id_fk": { + "name": "memory_secret_provenance_memory_id_memory_id_fk", + "tableFrom": "memory_secret_provenance", + "tableTo": "memory", + "columnsFrom": ["memory_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "memory_secret_provenance_status_check": { + "name": "memory_secret_provenance_status_check", + "value": "\"memory_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.mothership_inbox_allowed_sender": { + "name": "mothership_inbox_allowed_sender", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "added_by": { + "name": "added_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "inbox_sender_ws_email_idx": { + "name": "inbox_sender_ws_email_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mothership_inbox_allowed_sender_workspace_id_workspace_id_fk": { + "name": "mothership_inbox_allowed_sender_workspace_id_workspace_id_fk", + "tableFrom": "mothership_inbox_allowed_sender", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mothership_inbox_allowed_sender_added_by_user_id_fk": { + "name": "mothership_inbox_allowed_sender_added_by_user_id_fk", + "tableFrom": "mothership_inbox_allowed_sender", + "tableTo": "user", + "columnsFrom": ["added_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mothership_inbox_task": { + "name": "mothership_inbox_task", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "from_email": { + "name": "from_email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "from_name": { + "name": "from_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "subject": { + "name": "subject", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "body_preview": { + "name": "body_preview", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "body_text": { + "name": "body_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "body_html": { + "name": "body_html", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_message_id": { + "name": "email_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "in_reply_to": { + "name": "in_reply_to", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "response_message_id": { + "name": "response_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "agentmail_message_id": { + "name": "agentmail_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'received'" + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "trigger_job_id": { + "name": "trigger_job_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "result_summary": { + "name": "result_summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "has_attachments": { + "name": "has_attachments", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cc_recipients": { + "name": "cc_recipients", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "processing_started_at": { + "name": "processing_started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "inbox_task_ws_created_at_idx": { + "name": "inbox_task_ws_created_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "inbox_task_ws_status_idx": { + "name": "inbox_task_ws_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "inbox_task_response_msg_id_idx": { + "name": "inbox_task_response_msg_id_idx", + "columns": [ + { + "expression": "response_message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "inbox_task_email_msg_id_idx": { + "name": "inbox_task_email_msg_id_idx", + "columns": [ + { + "expression": "email_message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mothership_inbox_task_workspace_id_workspace_id_fk": { + "name": "mothership_inbox_task_workspace_id_workspace_id_fk", + "tableFrom": "mothership_inbox_task", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mothership_inbox_task_chat_id_copilot_chats_id_fk": { + "name": "mothership_inbox_task_chat_id_copilot_chats_id_fk", + "tableFrom": "mothership_inbox_task", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mothership_inbox_webhook": { + "name": "mothership_inbox_webhook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "webhook_id": { + "name": "webhook_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "mothership_inbox_webhook_workspace_id_workspace_id_fk": { + "name": "mothership_inbox_webhook_workspace_id_workspace_id_fk", + "tableFrom": "mothership_inbox_webhook", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "mothership_inbox_webhook_workspace_id_unique": { + "name": "mothership_inbox_webhook_workspace_id_unique", + "nullsNotDistinct": false, + "columns": ["workspace_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mothership_settings": { + "name": "mothership_settings", + "schema": "", + "columns": { + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "mcp_tool_refs": { + "name": "mcp_tool_refs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "custom_tool_refs": { + "name": "custom_tool_refs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "skill_refs": { + "name": "skill_refs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "mothership_settings_workspace_id_workspace_id_fk": { + "name": "mothership_settings_workspace_id_workspace_id_fk", + "tableFrom": "mothership_settings", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.oauth_access_token": { + "name": "oauth_access_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_id": { + "name": "refresh_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "text[]", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "oauth_access_token_client_id_idx": { + "name": "oauth_access_token_client_id_idx", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_access_token_session_id_idx": { + "name": "oauth_access_token_session_id_idx", + "columns": [ + { + "expression": "session_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_access_token_refresh_id_idx": { + "name": "oauth_access_token_refresh_id_idx", + "columns": [ + { + "expression": "refresh_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_access_token_user_client_idx": { + "name": "oauth_access_token_user_client_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "oauth_access_token_client_id_oauth_client_client_id_fk": { + "name": "oauth_access_token_client_id_oauth_client_client_id_fk", + "tableFrom": "oauth_access_token", + "tableTo": "oauth_client", + "columnsFrom": ["client_id"], + "columnsTo": ["client_id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "oauth_access_token_session_id_session_id_fk": { + "name": "oauth_access_token_session_id_session_id_fk", + "tableFrom": "oauth_access_token", + "tableTo": "session", + "columnsFrom": ["session_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "oauth_access_token_user_id_user_id_fk": { + "name": "oauth_access_token_user_id_user_id_fk", + "tableFrom": "oauth_access_token", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "oauth_access_token_refresh_id_oauth_refresh_token_id_fk": { + "name": "oauth_access_token_refresh_id_oauth_refresh_token_id_fk", + "tableFrom": "oauth_access_token", + "tableTo": "oauth_refresh_token", + "columnsFrom": ["refresh_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "oauth_access_token_token_unique": { + "name": "oauth_access_token_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.oauth_client": { + "name": "oauth_client", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_secret": { + "name": "client_secret", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "disabled": { + "name": "disabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "skip_consent": { + "name": "skip_consent", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "enable_end_session": { + "name": "enable_end_session", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "subject_type": { + "name": "subject_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scopes": { + "name": "scopes", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contacts": { + "name": "contacts", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "tos": { + "name": "tos", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "policy": { + "name": "policy", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "software_id": { + "name": "software_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "software_version": { + "name": "software_version", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "software_statement": { + "name": "software_statement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "redirect_uris": { + "name": "redirect_uris", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "post_logout_redirect_uris": { + "name": "post_logout_redirect_uris", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "token_endpoint_auth_method": { + "name": "token_endpoint_auth_method", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "grant_types": { + "name": "grant_types", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "response_types": { + "name": "response_types", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "public": { + "name": "public", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "require_pkce": { + "name": "require_pkce", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "oauth_client_user_id_idx": { + "name": "oauth_client_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "oauth_client_user_id_user_id_fk": { + "name": "oauth_client_user_id_user_id_fk", + "tableFrom": "oauth_client", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "oauth_client_client_id_unique": { + "name": "oauth_client_client_id_unique", + "nullsNotDistinct": false, + "columns": ["client_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.oauth_consent": { + "name": "oauth_consent", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scopes": { + "name": "scopes", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "oauth_consent_client_id_idx": { + "name": "oauth_consent_client_id_idx", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_consent_user_client_idx": { + "name": "oauth_consent_user_client_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "oauth_consent_client_id_oauth_client_client_id_fk": { + "name": "oauth_consent_client_id_oauth_client_client_id_fk", + "tableFrom": "oauth_consent", + "tableTo": "oauth_client", + "columnsFrom": ["client_id"], + "columnsTo": ["client_id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "oauth_consent_user_id_user_id_fk": { + "name": "oauth_consent_user_id_user_id_fk", + "tableFrom": "oauth_consent", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.oauth_refresh_token": { + "name": "oauth_refresh_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "revoked": { + "name": "revoked", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "auth_time": { + "name": "auth_time", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scopes": { + "name": "scopes", + "type": "text[]", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "oauth_refresh_token_client_id_idx": { + "name": "oauth_refresh_token_client_id_idx", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_refresh_token_session_id_idx": { + "name": "oauth_refresh_token_session_id_idx", + "columns": [ + { + "expression": "session_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_refresh_token_user_client_idx": { + "name": "oauth_refresh_token_user_client_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "oauth_refresh_token_client_id_oauth_client_client_id_fk": { + "name": "oauth_refresh_token_client_id_oauth_client_client_id_fk", + "tableFrom": "oauth_refresh_token", + "tableTo": "oauth_client", + "columnsFrom": ["client_id"], + "columnsTo": ["client_id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "oauth_refresh_token_session_id_session_id_fk": { + "name": "oauth_refresh_token_session_id_session_id_fk", + "tableFrom": "oauth_refresh_token", + "tableTo": "session", + "columnsFrom": ["session_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "oauth_refresh_token_user_id_user_id_fk": { + "name": "oauth_refresh_token_user_id_user_id_fk", + "tableFrom": "oauth_refresh_token", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "oauth_refresh_token_token_unique": { + "name": "oauth_refresh_token_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization": { + "name": "organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "session_policy_settings": { + "name": "session_policy_settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "security_policy_version": { + "name": "security_policy_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "whitelabel_settings": { + "name": "whitelabel_settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "data_retention_settings": { + "name": "data_retention_settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "org_usage_limit": { + "name": "org_usage_limit", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "storage_used_bytes": { + "name": "storage_used_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "limit_notifications": { + "name": "limit_notifications", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "departed_member_usage": { + "name": "departed_member_usage", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "credit_balance": { + "name": "credit_balance", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_byok_keys": { + "name": "organization_byok_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "organization_byok_organization_provider_idx": { + "name": "organization_byok_organization_provider_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_byok_keys_organization_id_organization_id_fk": { + "name": "organization_byok_keys_organization_id_organization_id_fk", + "tableFrom": "organization_byok_keys", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_byok_keys_created_by_user_id_fk": { + "name": "organization_byok_keys_created_by_user_id_fk", + "tableFrom": "organization_byok_keys", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_member_usage_limit": { + "name": "organization_member_usage_limit", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "usage_limit": { + "name": "usage_limit", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "set_by": { + "name": "set_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "org_member_usage_limit_org_user_unique": { + "name": "org_member_usage_limit_org_user_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "org_member_usage_limit_organization_id_idx": { + "name": "org_member_usage_limit_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_member_usage_limit_organization_id_organization_id_fk": { + "name": "organization_member_usage_limit_organization_id_organization_id_fk", + "tableFrom": "organization_member_usage_limit", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_member_usage_limit_user_id_user_id_fk": { + "name": "organization_member_usage_limit_user_id_user_id_fk", + "tableFrom": "organization_member_usage_limit", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_member_usage_limit_set_by_user_id_fk": { + "name": "organization_member_usage_limit_set_by_user_id_fk", + "tableFrom": "organization_member_usage_limit", + "tableTo": "user", + "columnsFrom": ["set_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.outbox_event": { + "name": "outbox_event", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "max_attempts": { + "name": "max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 10 + }, + "available_at": { + "name": "available_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "locked_at": { + "name": "locked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "processed_at": { + "name": "processed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "outbox_event_status_available_idx": { + "name": "outbox_event_status_available_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "available_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "outbox_event_locked_at_idx": { + "name": "outbox_event_locked_at_idx", + "columns": [ + { + "expression": "locked_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "outbox_event_type_created_idx": { + "name": "outbox_event_type_created_idx", + "columns": [ + { + "expression": "event_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.paused_executions": { + "name": "paused_executions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_snapshot": { + "name": "execution_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "pause_points": { + "name": "pause_points", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "total_pause_count": { + "name": "total_pause_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "resumed_count": { + "name": "resumed_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "automatic_resume_retry_count": { + "name": "automatic_resume_retry_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'paused'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "paused_at": { + "name": "paused_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_resume_at": { + "name": "next_resume_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "paused_executions_workflow_id_idx": { + "name": "paused_executions_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "paused_executions_status_idx": { + "name": "paused_executions_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "paused_executions_execution_id_unique": { + "name": "paused_executions_execution_id_unique", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "paused_executions_next_resume_at_idx": { + "name": "paused_executions_next_resume_at_idx", + "columns": [ + { + "expression": "next_resume_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "status = 'paused' AND next_resume_at IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "paused_executions_workflow_id_workflow_id_fk": { + "name": "paused_executions_workflow_id_workflow_id_fk", + "tableFrom": "paused_executions", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pending_credential_draft": { + "name": "pending_credential_draft", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "pending_draft_user_provider_ws": { + "name": "pending_draft_user_provider_ws", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "pending_credential_draft_user_id_user_id_fk": { + "name": "pending_credential_draft_user_id_user_id_fk", + "tableFrom": "pending_credential_draft", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pending_credential_draft_workspace_id_workspace_id_fk": { + "name": "pending_credential_draft_workspace_id_workspace_id_fk", + "tableFrom": "pending_credential_draft", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pending_credential_draft_credential_id_credential_id_fk": { + "name": "pending_credential_draft_credential_id_credential_id_fk", + "tableFrom": "pending_credential_draft", + "tableTo": "credential", + "columnsFrom": ["credential_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permission_group": { + "name": "permission_group", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "permission_group_created_by_idx": { + "name": "permission_group_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_organization_name_unique": { + "name": "permission_group_organization_name_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_organization_default_unique": { + "name": "permission_group_organization_default_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "is_default = true", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permission_group_organization_id_organization_id_fk": { + "name": "permission_group_organization_id_organization_id_fk", + "tableFrom": "permission_group", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_created_by_user_id_fk": { + "name": "permission_group_created_by_user_id_fk", + "tableFrom": "permission_group", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permission_group_member": { + "name": "permission_group_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "permission_group_id": { + "name": "permission_group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "assigned_by": { + "name": "assigned_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "assigned_at": { + "name": "assigned_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "permission_group_member_group_id_idx": { + "name": "permission_group_member_group_id_idx", + "columns": [ + { + "expression": "permission_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_member_group_user_unique": { + "name": "permission_group_member_group_user_unique", + "columns": [ + { + "expression": "permission_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_member_organization_user_idx": { + "name": "permission_group_member_organization_user_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permission_group_member_permission_group_id_permission_group_id_fk": { + "name": "permission_group_member_permission_group_id_permission_group_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "permission_group", + "columnsFrom": ["permission_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_member_organization_id_organization_id_fk": { + "name": "permission_group_member_organization_id_organization_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_member_user_id_user_id_fk": { + "name": "permission_group_member_user_id_user_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_member_assigned_by_user_id_fk": { + "name": "permission_group_member_assigned_by_user_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "user", + "columnsFrom": ["assigned_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permission_group_workspace": { + "name": "permission_group_workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "permission_group_id": { + "name": "permission_group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "permission_group_workspace_workspace_id_idx": { + "name": "permission_group_workspace_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_workspace_group_workspace_unique": { + "name": "permission_group_workspace_group_workspace_unique", + "columns": [ + { + "expression": "permission_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permission_group_workspace_permission_group_id_permission_group_id_fk": { + "name": "permission_group_workspace_permission_group_id_permission_group_id_fk", + "tableFrom": "permission_group_workspace", + "tableTo": "permission_group", + "columnsFrom": ["permission_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_workspace_workspace_id_workspace_id_fk": { + "name": "permission_group_workspace_workspace_id_workspace_id_fk", + "tableFrom": "permission_group_workspace", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_workspace_organization_id_organization_id_fk": { + "name": "permission_group_workspace_organization_id_organization_id_fk", + "tableFrom": "permission_group_workspace", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission_type": { + "name": "permission_type", + "type": "permission_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "permissions_user_id_idx": { + "name": "permissions_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_entity_idx": { + "name": "permissions_entity_idx", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_user_entity_type_idx": { + "name": "permissions_user_entity_type_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_user_entity_permission_idx": { + "name": "permissions_user_entity_permission_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "permission_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_unique_constraint": { + "name": "permissions_unique_constraint", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permissions_user_id_user_id_fk": { + "name": "permissions_user_id_user_id_fk", + "tableFrom": "permissions", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pinned_item": { + "name": "pinned_item", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pinned_at": { + "name": "pinned_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "pinned_item_user_workspace_idx": { + "name": "pinned_item_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "pinned_item_resource_idx": { + "name": "pinned_item_resource_idx", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "pinned_item_user_resource_unique": { + "name": "pinned_item_user_resource_unique", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "pinned_item_user_id_user_id_fk": { + "name": "pinned_item_user_id_user_id_fk", + "tableFrom": "pinned_item", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pinned_item_workspace_id_workspace_id_fk": { + "name": "pinned_item_workspace_id_workspace_id_fk", + "tableFrom": "pinned_item", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.public_share": { + "name": "public_share", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "auth_type": { + "name": "auth_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'public'" + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "allowed_emails": { + "name": "allowed_emails", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "public_share_token_unique": { + "name": "public_share_token_unique", + "columns": [ + { + "expression": "token", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "public_share_resource_unique": { + "name": "public_share_resource_unique", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "public_share_resource_id_idx": { + "name": "public_share_resource_id_idx", + "columns": [ + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "public_share_workspace_id_idx": { + "name": "public_share_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "public_share_workspace_id_workspace_id_fk": { + "name": "public_share_workspace_id_workspace_id_fk", + "tableFrom": "public_share", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "public_share_created_by_user_id_fk": { + "name": "public_share_created_by_user_id_fk", + "tableFrom": "public_share", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rate_limit_bucket": { + "name": "rate_limit_bucket", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "tokens": { + "name": "tokens", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "last_refill_at": { + "name": "last_refill_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_policy": { + "name": "resource_policy", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "document": { + "name": "document", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "resource_policy_resource_unique": { + "name": "resource_policy_resource_unique", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resource_policy_workspace_id_idx": { + "name": "resource_policy_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_policy_workspace_id_workspace_id_fk": { + "name": "resource_policy_workspace_id_workspace_id_fk", + "tableFrom": "resource_policy", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "resource_policy_created_by_user_id_fk": { + "name": "resource_policy_created_by_user_id_fk", + "tableFrom": "resource_policy", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "resource_policy_updated_by_user_id_fk": { + "name": "resource_policy_updated_by_user_id_fk", + "tableFrom": "resource_policy", + "tableTo": "user", + "columnsFrom": ["updated_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resume_queue": { + "name": "resume_queue", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "paused_execution_id": { + "name": "paused_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_execution_id": { + "name": "parent_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "new_execution_id": { + "name": "new_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "context_id": { + "name": "context_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resume_input": { + "name": "resume_input", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "queued_at": { + "name": "queued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "claimed_at": { + "name": "claimed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "failure_reason": { + "name": "failure_reason", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "resume_queue_parent_status_idx": { + "name": "resume_queue_parent_status_idx", + "columns": [ + { + "expression": "parent_execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "queued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resume_queue_new_execution_idx": { + "name": "resume_queue_new_execution_idx", + "columns": [ + { + "expression": "new_execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resume_queue_paused_execution_id_paused_executions_id_fk": { + "name": "resume_queue_paused_execution_id_paused_executions_id_fk", + "tableFrom": "resume_queue", + "tableTo": "paused_executions", + "columnsFrom": ["paused_execution_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sandbox_image": { + "name": "sandbox_image", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "spec_hash": { + "name": "spec_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "spec": { + "name": "spec", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "sandbox_image_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "image_ref": { + "name": "image_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_image_id": { + "name": "provider_image_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "build_id": { + "name": "build_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "materialization_generation": { + "name": "materialization_generation", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "error_code": { + "name": "error_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_detail": { + "name": "error_detail", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "sandbox_image_provider_spec_unique": { + "name": "sandbox_image_provider_spec_unique", + "columns": [ + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "spec_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sandbox_image_status_idx": { + "name": "sandbox_image_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sandbox_image_last_used_idx": { + "name": "sandbox_image_last_used_idx", + "columns": [ + { + "expression": "last_used_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.secret_usage": { + "name": "secret_usage", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret_name": { + "name": "secret_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret_scope": { + "name": "secret_scope", + "type": "secret_usage_scope", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "secret_owner_user_id": { + "name": "secret_owner_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "source": { + "name": "source", + "type": "secret_usage_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "actor_user_id": { + "name": "actor_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "usage_date": { + "name": "usage_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "use_count": { + "name": "use_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "last_execution_id": { + "name": "last_execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_trigger": { + "name": "last_trigger", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "secret_usage_bucket_unique": { + "name": "secret_usage_bucket_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_scope", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "actor_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "usage_date", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "secret_usage_secret_recent_idx": { + "name": "secret_usage_secret_recent_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_scope", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_used_at", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "secret_usage_workspace_id_workspace_id_fk": { + "name": "secret_usage_workspace_id_workspace_id_fk", + "tableFrom": "secret_usage", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "active_organization_id": { + "name": "active_organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "impersonated_by": { + "name": "impersonated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "session_user_id_idx": { + "name": "session_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "session_active_organization_id_organization_id_fk": { + "name": "session_active_organization_id_organization_id_fk", + "tableFrom": "session", + "tableTo": "organization", + "columnsFrom": ["active_organization_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.settings": { + "name": "settings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "theme": { + "name": "theme", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'system'" + }, + "auto_connect": { + "name": "auto_connect", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "telemetry_enabled": { + "name": "telemetry_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "email_preferences": { + "name": "email_preferences", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "billing_usage_notifications_enabled": { + "name": "billing_usage_notifications_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "show_training_controls": { + "name": "show_training_controls", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "super_user_mode_enabled": { + "name": "super_user_mode_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "mothership_environment": { + "name": "mothership_environment", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'default'" + }, + "error_notifications_enabled": { + "name": "error_notifications_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "snap_to_grid_size": { + "name": "snap_to_grid_size", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "show_action_bar": { + "name": "show_action_bar", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "auto_focus_on_click": { + "name": "auto_focus_on_click", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "copilot_enabled_models": { + "name": "copilot_enabled_models", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "copilot_auto_allowed_tools": { + "name": "copilot_auto_allowed_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "last_active_workspace_id": { + "name": "last_active_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "settings_user_id_user_id_fk": { + "name": "settings_user_id_user_id_fk", + "tableFrom": "settings", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "settings_user_id_unique": { + "name": "settings_user_id_unique", + "nullsNotDistinct": false, + "columns": ["user_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sim_trigger_state": { + "name": "sim_trigger_state", + "schema": "", + "columns": { + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "block_id": { + "name": "block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope_key": { + "name": "scope_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "last_fired_at": { + "name": "last_fired_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "sim_trigger_state_workflow_id_workflow_id_fk": { + "name": "sim_trigger_state_workflow_id_workflow_id_fk", + "tableFrom": "sim_trigger_state", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "sim_trigger_state_workflow_id_block_id_scope_key_pk": { + "name": "sim_trigger_state_workflow_id_block_id_scope_key_pk", + "columns": ["workflow_id", "block_id", "scope_key"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.skill": { + "name": "skill", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "skill_workspace_name_unique": { + "name": "skill_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "skill_workspace_id_workspace_id_fk": { + "name": "skill_workspace_id_workspace_id_fk", + "tableFrom": "skill", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "skill_user_id_user_id_fk": { + "name": "skill_user_id_user_id_fk", + "tableFrom": "skill", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.skill_member": { + "name": "skill_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "skill_id": { + "name": "skill_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invited_by": { + "name": "invited_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "skill_member_user_id_idx": { + "name": "skill_member_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "skill_member_unique": { + "name": "skill_member_unique", + "columns": [ + { + "expression": "skill_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "skill_member_skill_id_skill_id_fk": { + "name": "skill_member_skill_id_skill_id_fk", + "tableFrom": "skill_member", + "tableTo": "skill", + "columnsFrom": ["skill_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "skill_member_user_id_user_id_fk": { + "name": "skill_member_user_id_user_id_fk", + "tableFrom": "skill_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "skill_member_invited_by_user_id_fk": { + "name": "skill_member_invited_by_user_id_fk", + "tableFrom": "skill_member", + "tableTo": "user", + "columnsFrom": ["invited_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sso_domain": { + "name": "sso_domain", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "verification_token": { + "name": "verification_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "verified_at": { + "name": "verified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "sso_domain_organization_id_idx": { + "name": "sso_domain_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_domain_domain_idx": { + "name": "sso_domain_domain_idx", + "columns": [ + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_domain_org_domain_unique": { + "name": "sso_domain_org_domain_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_domain_verified_unique": { + "name": "sso_domain_verified_unique", + "columns": [ + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "status = 'verified'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sso_domain_organization_id_organization_id_fk": { + "name": "sso_domain_organization_id_organization_id_fk", + "tableFrom": "sso_domain", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "sso_domain_created_by_user_id_fk": { + "name": "sso_domain_created_by_user_id_fk", + "tableFrom": "sso_domain", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sso_provider": { + "name": "sso_provider", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "issuer": { + "name": "issuer", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "oidc_config": { + "name": "oidc_config", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "saml_config": { + "name": "saml_config", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "domain_verified": { + "name": "domain_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "jit_provisioning_enabled": { + "name": "jit_provisioning_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": { + "sso_provider_provider_id_unique": { + "name": "sso_provider_provider_id_unique", + "columns": [ + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_provider_domain_idx": { + "name": "sso_provider_domain_idx", + "columns": [ + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_provider_user_id_idx": { + "name": "sso_provider_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_provider_organization_id_idx": { + "name": "sso_provider_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sso_provider_user_id_user_id_fk": { + "name": "sso_provider_user_id_user_id_fk", + "tableFrom": "sso_provider", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "sso_provider_organization_id_organization_id_fk": { + "name": "sso_provider_organization_id_organization_id_fk", + "tableFrom": "sso_provider", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.subscription": { + "name": "subscription", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "plan": { + "name": "plan", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_subscription_id": { + "name": "stripe_subscription_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "period_start": { + "name": "period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "period_end": { + "name": "period_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "cancel_at_period_end": { + "name": "cancel_at_period_end", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cancel_at": { + "name": "cancel_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "canceled_at": { + "name": "canceled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "seats": { + "name": "seats", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "trial_start": { + "name": "trial_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "trial_end": { + "name": "trial_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "billing_interval": { + "name": "billing_interval", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_schedule_id": { + "name": "stripe_schedule_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "last_closed_period_start": { + "name": "last_closed_period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "subscription_reference_status_idx": { + "name": "subscription_reference_status_idx", + "columns": [ + { + "expression": "reference_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "subscription_cycle_close_lagging_idx": { + "name": "subscription_cycle_close_lagging_idx", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"subscription\".\"status\" in ('active', 'past_due') and \"subscription\".\"period_start\" is not null and (\"subscription\".\"last_closed_period_start\" is null or \"subscription\".\"last_closed_period_start\" < \"subscription\".\"period_start\")", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "check_enterprise_metadata": { + "name": "check_enterprise_metadata", + "value": "plan != 'enterprise' OR metadata IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.table_jobs": { + "name": "table_jobs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'running'" + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "rows_processed": { + "name": "rows_processed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "table_jobs_one_active_per_table": { + "name": "table_jobs_one_active_per_table", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"table_jobs\".\"status\" = 'running' AND \"table_jobs\".\"type\" <> 'export'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_jobs_watchdog_idx": { + "name": "table_jobs_watchdog_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_jobs_table_started_idx": { + "name": "table_jobs_table_started_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_jobs_table_id_user_table_definitions_id_fk": { + "name": "table_jobs_table_id_user_table_definitions_id_fk", + "tableFrom": "table_jobs", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_jobs_workspace_id_workspace_id_fk": { + "name": "table_jobs_workspace_id_workspace_id_fk", + "tableFrom": "table_jobs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_row_executions": { + "name": "table_row_executions", + "schema": "", + "columns": { + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "row_id": { + "name": "row_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "group_id": { + "name": "group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "job_id": { + "name": "job_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "running_block_ids": { + "name": "running_block_ids", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'::text[]" + }, + "block_errors": { + "name": "block_errors", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "cancelled_at": { + "name": "cancelled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "capability_governed_user_id": { + "name": "capability_governed_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enrichment_details": { + "name": "enrichment_details", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "table_row_executions_table_status_idx": { + "name": "table_row_executions_table_status_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"table_row_executions\".\"status\" IN ('queued', 'running', 'pending')", + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_row_executions_execution_id_idx": { + "name": "table_row_executions_execution_id_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"table_row_executions\".\"execution_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_row_executions_table_group_idx": { + "name": "table_row_executions_table_group_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_row_executions_table_id_user_table_definitions_id_fk": { + "name": "table_row_executions_table_id_user_table_definitions_id_fk", + "tableFrom": "table_row_executions", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_row_executions_row_id_user_table_rows_id_fk": { + "name": "table_row_executions_row_id_user_table_rows_id_fk", + "tableFrom": "table_row_executions", + "tableTo": "user_table_rows", + "columnsFrom": ["row_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_row_executions_capability_governed_user_id_user_id_fk": { + "name": "table_row_executions_capability_governed_user_id_user_id_fk", + "tableFrom": "table_row_executions", + "tableTo": "user", + "columnsFrom": ["capability_governed_user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "table_row_executions_row_id_group_id_pk": { + "name": "table_row_executions_row_id_group_id_pk", + "columns": ["row_id", "group_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_run_dispatches": { + "name": "table_run_dispatches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "request_id": { + "name": "request_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "mode": { + "name": "mode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "cursor": { + "name": "cursor", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "limit": { + "name": "limit", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "processed_count": { + "name": "processed_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "is_manual_run": { + "name": "is_manual_run", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "triggered_by_user_id": { + "name": "triggered_by_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "capability_governed_user_id": { + "name": "capability_governed_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "heartbeat_at": { + "name": "heartbeat_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "cancelled_at": { + "name": "cancelled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "table_run_dispatches_active_idx": { + "name": "table_run_dispatches_active_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_run_dispatches_watchdog_idx": { + "name": "table_run_dispatches_watchdog_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "requested_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_run_dispatches_governed_active_idx": { + "name": "table_run_dispatches_governed_active_idx", + "columns": [ + { + "expression": "capability_governed_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"table_run_dispatches\".\"status\" IN ('pending', 'dispatching')", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_run_dispatches_table_id_user_table_definitions_id_fk": { + "name": "table_run_dispatches_table_id_user_table_definitions_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_run_dispatches_workspace_id_workspace_id_fk": { + "name": "table_run_dispatches_workspace_id_workspace_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_run_dispatches_triggered_by_user_id_user_id_fk": { + "name": "table_run_dispatches_triggered_by_user_id_user_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "user", + "columnsFrom": ["triggered_by_user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "table_run_dispatches_capability_governed_user_id_user_id_fk": { + "name": "table_run_dispatches_capability_governed_user_id_user_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "user", + "columnsFrom": ["capability_governed_user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_views": { + "name": "table_views", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "table_views_table_created_idx": { + "name": "table_views_table_created_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_views_workspace_created_idx": { + "name": "table_views_workspace_created_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_views_table_default_unique": { + "name": "table_views_table_default_unique", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "is_default = true", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_views_table_id_user_table_definitions_id_fk": { + "name": "table_views_table_id_user_table_definitions_id_fk", + "tableFrom": "table_views", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_views_workspace_id_workspace_id_fk": { + "name": "table_views_workspace_id_workspace_id_fk", + "tableFrom": "table_views", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_views_created_by_user_id_fk": { + "name": "table_views_created_by_user_id_fk", + "tableFrom": "table_views", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.upload_session": { + "name": "upload_session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "purpose": { + "name": "purpose", + "type": "upload_session_purpose", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "method": { + "name": "method", + "type": "upload_session_method", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "storage_context": { + "name": "storage_context", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "final_key": { + "name": "final_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "storage_provider": { + "name": "storage_provider", + "type": "upload_session_provider", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "provider_upload_id": { + "name": "provider_upload_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_object_version": { + "name": "provider_object_version", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "part_size": { + "name": "part_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "part_count": { + "name": "part_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "upload_session_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'uploading'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "processing_lease_id": { + "name": "processing_lease_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "processing_lease_expires_at": { + "name": "processing_lease_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_file_id": { + "name": "completed_file_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "upload_session_token_hash_unique": { + "name": "upload_session_token_hash_unique", + "columns": [ + { + "expression": "token_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "upload_session_final_key_unique": { + "name": "upload_session_final_key_unique", + "columns": [ + { + "expression": "final_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "upload_session_status_expires_at_idx": { + "name": "upload_session_status_expires_at_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.usage_log": { + "name": "usage_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "category": { + "name": "category", + "type": "usage_log_category", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "usage_log_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "cost": { + "name": "cost", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "event_key": { + "name": "event_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "billing_entity_type": { + "name": "billing_entity_type", + "type": "billing_entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "billing_entity_id": { + "name": "billing_entity_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "billing_period_start": { + "name": "billing_period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "billing_period_end": { + "name": "billing_period_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "usage_log_user_created_at_idx": { + "name": "usage_log_user_created_at_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_source_idx": { + "name": "usage_log_source_idx", + "columns": [ + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_workspace_id_idx": { + "name": "usage_log_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_workflow_id_idx": { + "name": "usage_log_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_event_key_unique": { + "name": "usage_log_event_key_unique", + "columns": [ + { + "expression": "event_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"usage_log\".\"event_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_billing_entity_period_idx": { + "name": "usage_log_billing_entity_period_idx", + "columns": [ + { + "expression": "billing_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_start", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_end", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_billing_period_cost_idx": { + "name": "usage_log_billing_period_cost_idx", + "columns": [ + { + "expression": "billing_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_start", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_end", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "cost", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_billing_entity_created_at_cost_idx": { + "name": "usage_log_billing_entity_created_at_cost_idx", + "columns": [ + { + "expression": "billing_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "cost", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_workspace_created_at_idx": { + "name": "usage_log_workspace_created_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_execution_id_idx": { + "name": "usage_log_execution_id_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "usage_log_user_id_user_id_fk": { + "name": "usage_log_user_id_user_id_fk", + "tableFrom": "usage_log", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "usage_log_workspace_id_workspace_id_fk": { + "name": "usage_log_workspace_id_workspace_id_fk", + "tableFrom": "usage_log", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "usage_log_workflow_id_workflow_id_fk": { + "name": "usage_log_workflow_id_workflow_id_fk", + "tableFrom": "usage_log", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "usage_log_billing_scope_all_or_none": { + "name": "usage_log_billing_scope_all_or_none", + "value": "(\n (\"usage_log\".\"billing_entity_type\" IS NULL AND \"usage_log\".\"billing_entity_id\" IS NULL AND \"usage_log\".\"billing_period_start\" IS NULL AND \"usage_log\".\"billing_period_end\" IS NULL)\n OR\n (\"usage_log\".\"billing_entity_type\" IS NOT NULL AND \"usage_log\".\"billing_entity_id\" IS NOT NULL AND \"usage_log\".\"billing_period_start\" IS NOT NULL AND \"usage_log\".\"billing_period_end\" IS NOT NULL AND \"usage_log\".\"billing_period_start\" < \"usage_log\".\"billing_period_end\")\n )" + } + }, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "normalized_email": { + "name": "normalized_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'user'" + }, + "banned": { + "name": "banned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ban_expires": { + "name": "ban_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + }, + "user_normalized_email_unique": { + "name": "user_normalized_email_unique", + "nullsNotDistinct": false, + "columns": ["normalized_email"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_stats": { + "name": "user_stats", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "total_manual_executions": { + "name": "total_manual_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_api_calls": { + "name": "total_api_calls", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_webhook_triggers": { + "name": "total_webhook_triggers", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_scheduled_executions": { + "name": "total_scheduled_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_chat_executions": { + "name": "total_chat_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_mcp_executions": { + "name": "total_mcp_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tokens_used": { + "name": "total_tokens_used", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_cost": { + "name": "total_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "current_usage_limit": { + "name": "current_usage_limit", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'5'" + }, + "usage_limit_updated_at": { + "name": "usage_limit_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "current_period_cost": { + "name": "current_period_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "last_period_cost": { + "name": "last_period_cost", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "billed_overage_this_period": { + "name": "billed_overage_this_period", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "pro_period_cost_snapshot": { + "name": "pro_period_cost_snapshot", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "pro_period_cost_snapshot_at": { + "name": "pro_period_cost_snapshot_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "credit_balance": { + "name": "credit_balance", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "total_copilot_cost": { + "name": "total_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "current_period_copilot_cost": { + "name": "current_period_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "last_period_copilot_cost": { + "name": "last_period_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_copilot_tokens": { + "name": "total_copilot_tokens", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_copilot_calls": { + "name": "total_copilot_calls", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_mcp_copilot_calls": { + "name": "total_mcp_copilot_calls", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_mcp_copilot_cost": { + "name": "total_mcp_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "current_period_mcp_copilot_cost": { + "name": "current_period_mcp_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "storage_used_bytes": { + "name": "storage_used_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_active": { + "name": "last_active", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "billing_blocked": { + "name": "billing_blocked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "billing_blocked_reason": { + "name": "billing_blocked_reason", + "type": "billing_blocked_reason", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "limit_notifications": { + "name": "limit_notifications", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": { + "user_stats_user_id_user_id_fk": { + "name": "user_stats_user_id_user_id_fk", + "tableFrom": "user_stats", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_stats_user_id_unique": { + "name": "user_stats_user_id_unique", + "nullsNotDistinct": false, + "columns": ["user_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_table_definitions": { + "name": "user_table_definitions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "max_rows": { + "name": "max_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 10000 + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "rows_version": { + "name": "rows_version", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "schema_locked": { + "name": "schema_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "insert_locked": { + "name": "insert_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "update_locked": { + "name": "update_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "delete_locked": { + "name": "delete_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "user_table_def_workspace_id_idx": { + "name": "user_table_def_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_folder_id_idx": { + "name": "user_table_def_folder_id_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_workspace_name_unique": { + "name": "user_table_def_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"user_table_definitions\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_archived_at_idx": { + "name": "user_table_def_archived_at_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_workspace_archived_partial_idx": { + "name": "user_table_def_workspace_archived_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"user_table_definitions\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_table_definitions_workspace_id_workspace_id_fk": { + "name": "user_table_definitions_workspace_id_workspace_id_fk", + "tableFrom": "user_table_definitions", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_table_definitions_folder_id_folder_id_fk": { + "name": "user_table_definitions_folder_id_folder_id_fk", + "tableFrom": "user_table_definitions", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "user_table_definitions_created_by_user_id_fk": { + "name": "user_table_definitions_created_by_user_id_fk", + "tableFrom": "user_table_definitions", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_table_row_secret_provenance": { + "name": "user_table_row_secret_provenance", + "schema": "", + "columns": { + "row_id": { + "name": "row_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_updated_at": { + "name": "content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "user_table_row_secret_provenance_row_id_user_table_rows_id_fk": { + "name": "user_table_row_secret_provenance_row_id_user_table_rows_id_fk", + "tableFrom": "user_table_row_secret_provenance", + "tableTo": "user_table_rows", + "columnsFrom": ["row_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "user_table_row_secret_provenance_status_check": { + "name": "user_table_row_secret_provenance_status_check", + "value": "\"user_table_row_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.user_table_rows": { + "name": "user_table_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "order_key": { + "name": "order_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_table_rows_tenant_data_gin_idx": { + "name": "user_table_rows_tenant_data_gin_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"data\" jsonb_path_ops", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "user_table_rows_workspace_table_idx": { + "name": "user_table_rows_workspace_table_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_position_idx": { + "name": "user_table_rows_table_position_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "position", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_order_key_idx": { + "name": "user_table_rows_table_order_key_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "order_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_created_id_idx": { + "name": "user_table_rows_table_created_id_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_id_id_idx": { + "name": "user_table_rows_table_id_id_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_table_rows_table_id_user_table_definitions_id_fk": { + "name": "user_table_rows_table_id_user_table_definitions_id_fk", + "tableFrom": "user_table_rows", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_table_rows_workspace_id_workspace_id_fk": { + "name": "user_table_rows_workspace_id_workspace_id_fk", + "tableFrom": "user_table_rows", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_table_rows_created_by_user_id_fk": { + "name": "user_table_rows_created_by_user_id_fk", + "tableFrom": "user_table_rows", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "verification_identifier_idx": { + "name": "verification_identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "verification_expires_at_idx": { + "name": "verification_expires_at_idx", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.waitlist": { + "name": "waitlist", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "waitlist_email_unique": { + "name": "waitlist_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.webhook": { + "name": "webhook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "registration_status": { + "name": "registration_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "registration_generation": { + "name": "registration_generation", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "config_fingerprint": { + "name": "config_fingerprint", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prepared_at": { + "name": "prepared_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "block_id": { + "name": "block_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "routing_key": { + "name": "routing_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_config": { + "name": "provider_config", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "failed_count": { + "name": "failed_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_failed_at": { + "name": "last_failed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "path_deployment_unique": { + "name": "path_deployment_unique", + "columns": [ + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"webhook\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_workflow_deployment_idx": { + "name": "webhook_workflow_deployment_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_routing_key_active_idx": { + "name": "webhook_routing_key_active_idx", + "columns": [ + { + "expression": "routing_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"webhook\".\"archived_at\" IS NULL AND \"webhook\".\"routing_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_archived_at_partial_idx": { + "name": "webhook_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"webhook\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_webhook_on_provider_is_active_workflow_id_deploym_bdeed5468": { + "name": "idx_webhook_on_provider_is_active_workflow_id_deploym_bdeed5468", + "columns": [ + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_active", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_webhook_on_workflow_id_block_id_updated_at_desc": { + "name": "idx_webhook_on_workflow_id_block_id_updated_at_desc", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "updated_at", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_active_registration_unique": { + "name": "webhook_active_registration_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"webhook\".\"registration_status\" = 'active' AND \"webhook\".\"block_id\" IS NOT NULL AND \"webhook\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_candidate_registration_unique": { + "name": "webhook_candidate_registration_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"webhook\".\"registration_status\" = 'candidate' AND \"webhook\".\"block_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_registration_status_generation_idx": { + "name": "webhook_registration_status_generation_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "registration_status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "registration_generation", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "webhook_workflow_id_workflow_id_fk": { + "name": "webhook_workflow_id_workflow_id_fk", + "tableFrom": "webhook", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "webhook_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "webhook_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "webhook", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "webhook_registration_status_check": { + "name": "webhook_registration_status_check", + "value": "\"webhook\".\"registration_status\" IS NULL OR \"webhook\".\"registration_status\" IN ('active', 'candidate', 'retired', 'orphaned')" + }, + "webhook_registration_generation_check": { + "name": "webhook_registration_generation_check", + "value": "\"webhook\".\"registration_generation\" IS NULL OR \"webhook\".\"registration_generation\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.webhook_path_claim": { + "name": "webhook_path_claim", + "schema": "", + "columns": { + "path": { + "name": "path", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "generation": { + "name": "generation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "webhook_path_claim_workflow_idx": { + "name": "webhook_path_claim_workflow_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "webhook_path_claim_workflow_id_workflow_id_fk": { + "name": "webhook_path_claim_workflow_id_workflow_id_fk", + "tableFrom": "webhook_path_claim", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "webhook_path_claim_generation_check": { + "name": "webhook_path_claim_generation_check", + "value": "\"webhook_path_claim\".\"generation\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.workflow": { + "name": "workflow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_synced": { + "name": "last_synced", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "is_deployed": { + "name": "is_deployed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deployed_at": { + "name": "deployed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "is_public_api": { + "name": "is_public_api", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "locked": { + "name": "locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "fork_sync_excluded": { + "name": "fork_sync_excluded", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "run_count": { + "name": "run_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_run_at": { + "name": "last_run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "variables": { + "name": "variables", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workflow_user_id_idx": { + "name": "workflow_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_workspace_id_idx": { + "name": "workflow_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_user_workspace_idx": { + "name": "workflow_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_workspace_folder_name_active_unique": { + "name": "workflow_workspace_folder_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"folder_id\", '')", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_folder_sort_idx": { + "name": "workflow_folder_sort_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_active_workspace_sort_idx": { + "name": "workflow_active_workspace_sort_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_archived_at_idx": { + "name": "workflow_archived_at_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_workspace_archived_partial_idx": { + "name": "workflow_workspace_archived_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_user_id_user_id_fk": { + "name": "workflow_user_id_user_id_fk", + "tableFrom": "workflow", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_workspace_id_workspace_id_fk": { + "name": "workflow_workspace_id_workspace_id_fk", + "tableFrom": "workflow", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_folder_id_folder_id_fk": { + "name": "workflow_folder_id_folder_id_fk", + "tableFrom": "workflow", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_blocks": { + "name": "workflow_blocks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "position_x": { + "name": "position_x", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "position_y": { + "name": "position_y", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "horizontal_handles": { + "name": "horizontal_handles", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "is_wide": { + "name": "is_wide", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "advanced_mode": { + "name": "advanced_mode", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "trigger_mode": { + "name": "trigger_mode", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "error_enabled": { + "name": "error_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "retry": { + "name": "retry", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "locked": { + "name": "locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "height": { + "name": "height", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "sub_blocks": { + "name": "sub_blocks", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "outputs": { + "name": "outputs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_blocks_workflow_id_idx": { + "name": "workflow_blocks_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_blocks_type_idx": { + "name": "workflow_blocks_type_idx", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_blocks_workflow_id_workflow_id_fk": { + "name": "workflow_blocks_workflow_id_workflow_id_fk", + "tableFrom": "workflow_blocks", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_checkpoints": { + "name": "workflow_checkpoints", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_state": { + "name": "workflow_state", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_checkpoints_user_id_idx": { + "name": "workflow_checkpoints_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_workflow_id_idx": { + "name": "workflow_checkpoints_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_chat_id_idx": { + "name": "workflow_checkpoints_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_message_id_idx": { + "name": "workflow_checkpoints_message_id_idx", + "columns": [ + { + "expression": "message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_user_workflow_idx": { + "name": "workflow_checkpoints_user_workflow_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_workflow_chat_idx": { + "name": "workflow_checkpoints_workflow_chat_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_created_at_idx": { + "name": "workflow_checkpoints_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_chat_created_at_idx": { + "name": "workflow_checkpoints_chat_created_at_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_checkpoints_user_id_user_id_fk": { + "name": "workflow_checkpoints_user_id_user_id_fk", + "tableFrom": "workflow_checkpoints", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_checkpoints_workflow_id_workflow_id_fk": { + "name": "workflow_checkpoints_workflow_id_workflow_id_fk", + "tableFrom": "workflow_checkpoints", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_checkpoints_chat_id_copilot_chats_id_fk": { + "name": "workflow_checkpoints_chat_id_copilot_chats_id_fk", + "tableFrom": "workflow_checkpoints", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_deployment_operation": { + "name": "workflow_deployment_operation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "previous_active_version_id": { + "name": "previous_active_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "protocol_version": { + "name": "protocol_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "generation": { + "name": "generation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'preparing'" + }, + "component_readiness": { + "name": "component_readiness", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "error_code": { + "name": "error_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "idempotency_key": { + "name": "idempotency_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "request_hash": { + "name": "request_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_deployment_operation_workflow_generation_unique": { + "name": "workflow_deployment_operation_workflow_generation_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "generation", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_idempotency_unique": { + "name": "workflow_deployment_operation_workflow_idempotency_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "idempotency_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_deployment_operation\".\"idempotency_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_in_flight_unique": { + "name": "workflow_deployment_operation_workflow_in_flight_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_deployment_operation\".\"status\" IN ('preparing', 'activating')", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_status_idx": { + "name": "workflow_deployment_operation_workflow_status_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_deployment_version_idx": { + "name": "workflow_deployment_operation_deployment_version_idx", + "columns": [ + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_version_generation_idx": { + "name": "workflow_deployment_operation_workflow_version_generation_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "generation", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_deployment_operation_workflow_id_workflow_id_fk": { + "name": "workflow_deployment_operation_workflow_id_workflow_id_fk", + "tableFrom": "workflow_deployment_operation", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_deployment_operation_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_deployment_operation_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_deployment_operation", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_deployment_operation_previous_active_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_deployment_operation_previous_active_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_deployment_operation", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["previous_active_version_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "workflow_deployment_operation_action_check": { + "name": "workflow_deployment_operation_action_check", + "value": "\"workflow_deployment_operation\".\"action\" IN ('deploy', 'activate')" + }, + "workflow_deployment_operation_status_check": { + "name": "workflow_deployment_operation_status_check", + "value": "\"workflow_deployment_operation\".\"status\" IN ('preparing', 'activating', 'active', 'failed', 'superseded')" + }, + "workflow_deployment_operation_generation_check": { + "name": "workflow_deployment_operation_generation_check", + "value": "\"workflow_deployment_operation\".\"generation\" > 0" + }, + "workflow_deployment_operation_protocol_version_check": { + "name": "workflow_deployment_operation_protocol_version_check", + "value": "\"workflow_deployment_operation\".\"protocol_version\" > 0" + } + }, + "isRLSEnabled": false + }, + "public.workflow_deployment_version": { + "name": "workflow_deployment_version", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workflow_deployment_version_workflow_version_unique": { + "name": "workflow_deployment_version_workflow_version_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "version", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_version_workflow_active_idx": { + "name": "workflow_deployment_version_workflow_active_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_active", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_version_created_at_idx": { + "name": "workflow_deployment_version_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_deployment_version_workflow_id_workflow_id_fk": { + "name": "workflow_deployment_version_workflow_id_workflow_id_fk", + "tableFrom": "workflow_deployment_version", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_edges": { + "name": "workflow_edges", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_block_id": { + "name": "source_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_block_id": { + "name": "target_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_handle": { + "name": "source_handle", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "target_handle": { + "name": "target_handle", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_edges_workflow_id_idx": { + "name": "workflow_edges_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_edges_workflow_source_idx": { + "name": "workflow_edges_workflow_source_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_edges_workflow_target_idx": { + "name": "workflow_edges_workflow_target_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_edges_workflow_id_workflow_id_fk": { + "name": "workflow_edges_workflow_id_workflow_id_fk", + "tableFrom": "workflow_edges", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_edges_source_block_id_workflow_blocks_id_fk": { + "name": "workflow_edges_source_block_id_workflow_blocks_id_fk", + "tableFrom": "workflow_edges", + "tableTo": "workflow_blocks", + "columnsFrom": ["source_block_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_edges_target_block_id_workflow_blocks_id_fk": { + "name": "workflow_edges_target_block_id_workflow_blocks_id_fk", + "tableFrom": "workflow_edges", + "tableTo": "workflow_blocks", + "columnsFrom": ["target_block_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_execution_logs": { + "name": "workflow_execution_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state_snapshot_id": { + "name": "state_snapshot_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "level": { + "name": "level", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'running'" + }, + "trigger": { + "name": "trigger", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "execution_deadline_at": { + "name": "execution_deadline_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "total_duration_ms": { + "name": "total_duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "execution_data": { + "name": "execution_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "cost": { + "name": "cost", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "cost_total": { + "name": "cost_total", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "models_used": { + "name": "models_used", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "files": { + "name": "files", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_execution_logs_workflow_id_idx": { + "name": "workflow_execution_logs_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_state_snapshot_id_idx": { + "name": "workflow_execution_logs_state_snapshot_id_idx", + "columns": [ + { + "expression": "state_snapshot_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_deployment_version_id_idx": { + "name": "workflow_execution_logs_deployment_version_id_idx", + "columns": [ + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_trigger_idx": { + "name": "workflow_execution_logs_trigger_idx", + "columns": [ + { + "expression": "trigger", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_level_idx": { + "name": "workflow_execution_logs_level_idx", + "columns": [ + { + "expression": "level", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_started_at_idx": { + "name": "workflow_execution_logs_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_execution_id_unique": { + "name": "workflow_execution_logs_execution_id_unique", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workflow_started_at_idx": { + "name": "workflow_execution_logs_workflow_started_at_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workspace_started_at_idx": { + "name": "workflow_execution_logs_workspace_started_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workspace_started_at_id_desc_idx": { + "name": "workflow_execution_logs_workspace_started_at_id_desc_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"started_at\" DESC NULLS LAST", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "\"id\" DESC", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workspace_cost_total_idx": { + "name": "workflow_execution_logs_workspace_cost_total_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "cost_total", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_models_used_idx": { + "name": "workflow_execution_logs_models_used_idx", + "columns": [ + { + "expression": "models_used", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "workflow_execution_logs_workspace_ended_at_id_idx": { + "name": "workflow_execution_logs_workspace_ended_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"ended_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_running_started_at_idx": { + "name": "workflow_execution_logs_running_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "status = 'running'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_running_deadline_idx": { + "name": "workflow_execution_logs_running_deadline_idx", + "columns": [ + { + "expression": "execution_deadline_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_execution_logs\".\"status\" = 'running' AND \"workflow_execution_logs\".\"execution_deadline_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_redacting_started_at_idx": { + "name": "workflow_execution_logs_redacting_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "status = 'redacting'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_redacting_deadline_idx": { + "name": "workflow_execution_logs_redacting_deadline_idx", + "columns": [ + { + "expression": "execution_deadline_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_execution_logs\".\"status\" = 'redacting' AND \"workflow_execution_logs\".\"execution_deadline_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_completed_ended_at_idx": { + "name": "workflow_execution_logs_completed_ended_at_idx", + "columns": [ + { + "expression": "ended_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_execution_logs\".\"status\" = 'completed' AND \"workflow_execution_logs\".\"level\" = 'info' AND \"workflow_execution_logs\".\"ended_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_execution_logs_workflow_id_workflow_id_fk": { + "name": "workflow_execution_logs_workflow_id_workflow_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workflow_execution_logs_workspace_id_workspace_id_fk": { + "name": "workflow_execution_logs_workspace_id_workspace_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_execution_logs_state_snapshot_id_workflow_execution_snapshots_id_fk": { + "name": "workflow_execution_logs_state_snapshot_id_workflow_execution_snapshots_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workflow_execution_snapshots", + "columnsFrom": ["state_snapshot_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workflow_execution_logs_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_execution_logs_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_execution_snapshots": { + "name": "workflow_execution_snapshots", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state_hash": { + "name": "state_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state_data": { + "name": "state_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_snapshots_workflow_id_idx": { + "name": "workflow_snapshots_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_snapshots_hash_idx": { + "name": "workflow_snapshots_hash_idx", + "columns": [ + { + "expression": "state_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_snapshots_workflow_hash_idx": { + "name": "workflow_snapshots_workflow_hash_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "state_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_snapshots_created_at_idx": { + "name": "workflow_snapshots_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_execution_snapshots_workflow_id_workflow_id_fk": { + "name": "workflow_execution_snapshots_workflow_id_workflow_id_fk", + "tableFrom": "workflow_execution_snapshots", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_mcp_server": { + "name": "workflow_mcp_server", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_mcp_server_workspace_id_idx": { + "name": "workflow_mcp_server_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_server_created_by_idx": { + "name": "workflow_mcp_server_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_server_deleted_at_idx": { + "name": "workflow_mcp_server_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_server_workspace_deleted_partial_idx": { + "name": "workflow_mcp_server_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_mcp_server\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_mcp_server_workspace_id_workspace_id_fk": { + "name": "workflow_mcp_server_workspace_id_workspace_id_fk", + "tableFrom": "workflow_mcp_server", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_mcp_server_created_by_user_id_fk": { + "name": "workflow_mcp_server_created_by_user_id_fk", + "tableFrom": "workflow_mcp_server", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_mcp_tool": { + "name": "workflow_mcp_tool", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tool_name": { + "name": "tool_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tool_description": { + "name": "tool_description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parameter_schema": { + "name": "parameter_schema", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "parameter_description_overrides": { + "name": "parameter_description_overrides", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'::json" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_mcp_tool_server_id_idx": { + "name": "workflow_mcp_tool_server_id_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_tool_workflow_id_idx": { + "name": "workflow_mcp_tool_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_tool_server_workflow_unique": { + "name": "workflow_mcp_tool_server_workflow_unique", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_mcp_tool\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_tool_archived_at_partial_idx": { + "name": "workflow_mcp_tool_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_mcp_tool\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_mcp_tool_server_id_workflow_mcp_server_id_fk": { + "name": "workflow_mcp_tool_server_id_workflow_mcp_server_id_fk", + "tableFrom": "workflow_mcp_tool", + "tableTo": "workflow_mcp_server", + "columnsFrom": ["server_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_mcp_tool_workflow_id_workflow_id_fk": { + "name": "workflow_mcp_tool_workflow_id_workflow_id_fk", + "tableFrom": "workflow_mcp_tool", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_schedule": { + "name": "workflow_schedule", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deployment_operation_id": { + "name": "deployment_operation_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "block_id": { + "name": "block_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cron_expression": { + "name": "cron_expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "next_run_at": { + "name": "next_run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_ran_at": { + "name": "last_ran_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_queued_at": { + "name": "last_queued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "trigger_type": { + "name": "trigger_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'UTC'" + }, + "failed_count": { + "name": "failed_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "infra_retry_count": { + "name": "infra_retry_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "last_failed_at": { + "name": "last_failed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "source_type": { + "name": "source_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'workflow'" + }, + "job_title": { + "name": "job_title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prompt": { + "name": "prompt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lifecycle": { + "name": "lifecycle", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'persistent'" + }, + "success_condition": { + "name": "success_condition", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "max_runs": { + "name": "max_runs", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "run_count": { + "name": "run_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "source_chat_id": { + "name": "source_chat_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_task_name": { + "name": "source_task_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_user_id": { + "name": "source_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_workspace_id": { + "name": "source_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_scope": { + "name": "secret_scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "mounted_secrets": { + "name": "mounted_secrets", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "job_history": { + "name": "job_history", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "contexts": { + "name": "contexts", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "excluded_dates": { + "name": "excluded_dates", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "ends_at": { + "name": "ends_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_schedule_workflow_block_deployment_unique": { + "name": "workflow_schedule_workflow_block_deployment_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_schedule\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_workflow_deployment_idx": { + "name": "workflow_schedule_workflow_deployment_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_archived_at_partial_idx": { + "name": "workflow_schedule_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_schedule\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_schedule_on_source_workspace_id_source_t_c07f3bba6": { + "name": "idx_workflow_schedule_on_source_workspace_id_source_t_c07f3bba6", + "columns": [ + { + "expression": "source_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_due_workflow_idx": { + "name": "workflow_schedule_due_workflow_idx", + "columns": [ + { + "expression": "next_run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_queued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_schedule\".\"archived_at\" IS NULL AND \"workflow_schedule\".\"status\" NOT IN ('disabled', 'completed') AND (\"workflow_schedule\".\"source_type\" = 'workflow' OR \"workflow_schedule\".\"source_type\" IS NULL)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_due_job_idx": { + "name": "workflow_schedule_due_job_idx", + "columns": [ + { + "expression": "next_run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_queued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_schedule\".\"archived_at\" IS NULL AND \"workflow_schedule\".\"status\" NOT IN ('disabled', 'completed') AND \"workflow_schedule\".\"source_type\" = 'job'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_schedule_workflow_id_workflow_id_fk": { + "name": "workflow_schedule_workflow_id_workflow_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_schedule_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_schedule_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_schedule_deployment_operation_id_workflow_deployment_operation_id_fk": { + "name": "workflow_schedule_deployment_operation_id_workflow_deployment_operation_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workflow_deployment_operation", + "columnsFrom": ["deployment_operation_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workflow_schedule_source_user_id_user_id_fk": { + "name": "workflow_schedule_source_user_id_user_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "user", + "columnsFrom": ["source_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_schedule_source_workspace_id_workspace_id_fk": { + "name": "workflow_schedule_source_workspace_id_workspace_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workspace", + "columnsFrom": ["source_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_subflows": { + "name": "workflow_subflows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_subflows_workflow_id_idx": { + "name": "workflow_subflows_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_subflows_workflow_type_idx": { + "name": "workflow_subflows_workflow_type_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_subflows_workflow_id_workflow_id_fk": { + "name": "workflow_subflows_workflow_id_workflow_id_fk", + "tableFrom": "workflow_subflows", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace": { + "name": "workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'#33C482'" + }, + "logo_url": { + "name": "logo_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_mode": { + "name": "workspace_mode", + "type": "workspace_mode", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'grandfathered_shared'" + }, + "billed_account_user_id": { + "name": "billed_account_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "storage_used_bytes": { + "name": "storage_used_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "allow_personal_api_keys": { + "name": "allow_personal_api_keys", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "inbox_enabled": { + "name": "inbox_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "inbox_address": { + "name": "inbox_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inbox_provider_id": { + "name": "inbox_provider_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inbox_secret_scope": { + "name": "inbox_secret_scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "inbox_mounted_secrets": { + "name": "inbox_mounted_secrets", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "organization_assigned_at": { + "name": "organization_assigned_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forked_from_workspace_id": { + "name": "forked_from_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_owner_id_idx": { + "name": "workspace_owner_id_idx", + "columns": [ + { + "expression": "owner_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_organization_id_idx": { + "name": "workspace_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_mode_idx": { + "name": "workspace_mode_idx", + "columns": [ + { + "expression": "workspace_mode", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_forked_from_workspace_id_idx": { + "name": "workspace_forked_from_workspace_id_idx", + "columns": [ + { + "expression": "forked_from_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_inbox_provider_id_idx": { + "name": "workspace_inbox_provider_id_idx", + "columns": [ + { + "expression": "inbox_provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace\".\"inbox_provider_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_owner_id_user_id_fk": { + "name": "workspace_owner_id_user_id_fk", + "tableFrom": "workspace", + "tableTo": "user", + "columnsFrom": ["owner_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_organization_id_organization_id_fk": { + "name": "workspace_organization_id_organization_id_fk", + "tableFrom": "workspace", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_billed_account_user_id_user_id_fk": { + "name": "workspace_billed_account_user_id_user_id_fk", + "tableFrom": "workspace", + "tableTo": "user", + "columnsFrom": ["billed_account_user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workspace_forked_from_workspace_id_workspace_id_fk": { + "name": "workspace_forked_from_workspace_id_workspace_id_fk", + "tableFrom": "workspace", + "tableTo": "workspace", + "columnsFrom": ["forked_from_workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "workspace_storage_used_bytes_non_negative": { + "name": "workspace_storage_used_bytes_non_negative", + "value": "\"workspace\".\"storage_used_bytes\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.workspace_byok_keys": { + "name": "workspace_byok_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_byok_workspace_provider_idx": { + "name": "workspace_byok_workspace_provider_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_byok_keys_workspace_id_workspace_id_fk": { + "name": "workspace_byok_keys_workspace_id_workspace_id_fk", + "tableFrom": "workspace_byok_keys", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_byok_keys_created_by_user_id_fk": { + "name": "workspace_byok_keys_created_by_user_id_fk", + "tableFrom": "workspace_byok_keys", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_environment": { + "name": "workspace_environment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "variables": { + "name": "variables", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_environment_workspace_unique": { + "name": "workspace_environment_workspace_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_environment_workspace_id_workspace_id_fk": { + "name": "workspace_environment_workspace_id_workspace_id_fk", + "tableFrom": "workspace_environment", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file": { + "name": "workspace_file", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_file_workspace_id_idx": { + "name": "workspace_file_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_deleted_at_idx": { + "name": "workspace_file_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_workspace_deleted_partial_idx": { + "name": "workspace_file_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_file\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_workspace_id_workspace_id_fk": { + "name": "workspace_file_workspace_id_workspace_id_fk", + "tableFrom": "workspace_file", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_file_uploaded_by_user_id_fk": { + "name": "workspace_file_uploaded_by_user_id_fk", + "tableFrom": "workspace_file", + "tableTo": "user", + "columnsFrom": ["uploaded_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_file_key_unique": { + "name": "workspace_file_key_unique", + "nullsNotDistinct": false, + "columns": ["key"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_collab_state": { + "name": "workspace_file_collab_state", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "doc_state": { + "name": "doc_state", + "type": "bytea", + "primaryKey": false, + "notNull": true + }, + "source_hash": { + "name": "source_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_file_collab_state_file_id_workspace_files_id_fk": { + "name": "workspace_file_collab_state_file_id_workspace_files_id_fk", + "tableFrom": "workspace_file_collab_state", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_backfill": { + "name": "workspace_file_search_backfill", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "after_workspace_id": { + "name": "after_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "after_file_id": { + "name": "after_file_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_dispatch_queue": { + "name": "workspace_file_search_dispatch_queue", + "schema": "", + "columns": { + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "enqueued_at": { + "name": "enqueued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_dispatched_at": { + "name": "last_dispatched_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_file_search_dispatch_queue_schedule_idx": { + "name": "workspace_file_search_dispatch_queue_schedule_idx", + "columns": [ + { + "expression": "last_dispatched_at", + "isExpression": false, + "asc": true, + "nulls": "first" + }, + { + "expression": "enqueued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_search_queue_workspace_fk": { + "name": "workspace_file_search_queue_workspace_fk", + "tableFrom": "workspace_file_search_dispatch_queue", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_index": { + "name": "workspace_file_search_index", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_content_updated_at": { + "name": "source_content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "workspace_file_search_index_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "partial": { + "name": "partial", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "failure_reason": { + "name": "failure_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "line_count": { + "name": "line_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "indexed_bytes": { + "name": "indexed_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "dispatched_at": { + "name": "dispatched_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_file_search_index_workspace_status_idx": { + "name": "workspace_file_search_index_workspace_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_content_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_search_index_pending_dispatch_idx": { + "name": "workspace_file_search_index_pending_dispatch_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "file_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_content_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_file_search_index\".\"status\" = 'pending' AND \"workspace_file_search_index\".\"dispatched_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_search_index_active_dispatch_idx": { + "name": "workspace_file_search_index_active_dispatch_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "dispatched_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_file_search_index\".\"status\" = 'pending' AND \"workspace_file_search_index\".\"dispatched_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_search_index_file_fk": { + "name": "workspace_file_search_index_file_fk", + "tableFrom": "workspace_file_search_index", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_file_search_index_workspace_fk": { + "name": "workspace_file_search_index_workspace_fk", + "tableFrom": "workspace_file_search_index", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "workspace_file_search_index_pk": { + "name": "workspace_file_search_index_pk", + "columns": ["file_id", "source_content_updated_at"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_segment": { + "name": "workspace_file_search_segment", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_content_updated_at": { + "name": "source_content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "line_number": { + "name": "line_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "segment_number": { + "name": "segment_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "segment_start": { + "name": "segment_start", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "line_length": { + "name": "line_length", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "workspace_file_search_segment_workspace_revision_idx": { + "name": "workspace_file_search_segment_workspace_revision_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "file_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_content_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_search_segment_workspace_content_trgm_idx": { + "name": "workspace_file_search_segment_workspace_content_trgm_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "text_ops" + }, + { + "expression": "content", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "gin_trgm_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_search_segment_file_fk": { + "name": "workspace_file_search_segment_file_fk", + "tableFrom": "workspace_file_search_segment", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_file_search_segment_workspace_fk": { + "name": "workspace_file_search_segment_workspace_fk", + "tableFrom": "workspace_file_search_segment", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "workspace_file_search_segment_pk": { + "name": "workspace_file_search_segment_pk", + "columns": ["file_id", "source_content_updated_at", "line_number", "segment_number"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_secret_provenance": { + "name": "workspace_file_secret_provenance", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_updated_at": { + "name": "content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_file_secret_provenance_file_id_workspace_files_id_fk": { + "name": "workspace_file_secret_provenance_file_id_workspace_files_id_fk", + "tableFrom": "workspace_file_secret_provenance", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "workspace_file_secret_provenance_status_check": { + "name": "workspace_file_secret_provenance_status_check", + "value": "\"workspace_file_secret_provenance\".\"status\" IN ('exact', 'unknown', 'unrecorded')" + } + }, + "isRLSEnabled": false + }, + "public.workspace_files": { + "name": "workspace_files", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "context": { + "name": "context", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "original_name": { + "name": "original_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "size_bytes": { + "name": "size_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "content_updated_at": { + "name": "content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workspace_files_key_active_unique": { + "name": "workspace_files_key_active_unique", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace_files\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_workspace_folder_name_active_unique": { + "name": "workspace_files_workspace_folder_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"folder_id\", '')", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "original_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_chat_display_name_unique": { + "name": "workspace_files_chat_display_name_unique", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "display_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace_files\".\"context\" = 'mothership' AND \"workspace_files\".\"chat_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_key_idx": { + "name": "workspace_files_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_user_id_idx": { + "name": "workspace_files_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_workspace_id_idx": { + "name": "workspace_files_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_folder_id_idx": { + "name": "workspace_files_folder_id_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_context_idx": { + "name": "workspace_files_context_idx", + "columns": [ + { + "expression": "context", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_chat_id_idx": { + "name": "workspace_files_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_deleted_at_idx": { + "name": "workspace_files_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_workspace_deleted_partial_idx": { + "name": "workspace_files_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_files\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_files_user_id_user_id_fk": { + "name": "workspace_files_user_id_user_id_fk", + "tableFrom": "workspace_files", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_files_workspace_id_workspace_id_fk": { + "name": "workspace_files_workspace_id_workspace_id_fk", + "tableFrom": "workspace_files", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_files_folder_id_folder_id_fk": { + "name": "workspace_files_folder_id_folder_id_fk", + "tableFrom": "workspace_files", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_files_chat_id_copilot_chats_id_fk": { + "name": "workspace_files_chat_id_copilot_chats_id_fk", + "tableFrom": "workspace_files", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_block_map": { + "name": "workspace_fork_block_map", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_workflow_id": { + "name": "parent_workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_block_id": { + "name": "parent_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_workflow_id": { + "name": "child_workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_block_id": { + "name": "child_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_block_map_child_ws_parent_unique": { + "name": "workspace_fork_block_map_child_ws_parent_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_block_map_child_ws_child_unique": { + "name": "workspace_fork_block_map_child_ws_child_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "child_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_block_map_child_ws_parent_wf_idx": { + "name": "workspace_fork_block_map_child_ws_parent_wf_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_block_map_child_ws_child_wf_idx": { + "name": "workspace_fork_block_map_child_ws_child_wf_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "child_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_block_map_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_block_map_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_block_map", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_dependent_value": { + "name": "workspace_fork_dependent_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_workflow_id": { + "name": "target_workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_block_id": { + "name": "target_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sub_block_key": { + "name": "sub_block_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_dependent_value_child_ws_wf_idx": { + "name": "workspace_fork_dependent_value_child_ws_wf_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_dependent_value_field_unique": { + "name": "workspace_fork_dependent_value_field_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sub_block_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_dependent_value_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_dependent_value_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_dependent_value", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_promote_run": { + "name": "workspace_fork_promote_run", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_workspace_id": { + "name": "source_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_workspace_id": { + "name": "target_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "direction": { + "name": "direction", + "type": "workspace_fork_promote_direction", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "snapshot": { + "name": "snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_promote_run_child_ws_target_unique": { + "name": "workspace_fork_promote_run_child_ws_target_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_promote_run_target_ws_idx": { + "name": "workspace_fork_promote_run_target_ws_idx", + "columns": [ + { + "expression": "target_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_promote_run_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_promote_run_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_promote_run", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_fork_promote_run_created_by_user_id_fk": { + "name": "workspace_fork_promote_run_created_by_user_id_fk", + "tableFrom": "workspace_fork_promote_run", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_resource_map": { + "name": "workspace_fork_resource_map", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "workspace_fork_resource_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "parent_resource_id": { + "name": "parent_resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_resource_id": { + "name": "child_resource_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_resource_map_child_ws_idx": { + "name": "workspace_fork_resource_map_child_ws_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_resource_map_child_ws_type_idx": { + "name": "workspace_fork_resource_map_child_ws_type_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_resource_map_child_type_parent_unique": { + "name": "workspace_fork_resource_map_child_type_parent_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_resource_map_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_resource_map_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_resource_map", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_fork_resource_map_created_by_user_id_fk": { + "name": "workspace_fork_resource_map_created_by_user_id_fk", + "tableFrom": "workspace_fork_resource_map", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_sandbox": { + "name": "workspace_sandbox", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "language": { + "name": "language", + "type": "sandbox_language", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "dependencies": { + "name": "dependencies", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "cli_tools": { + "name": "cli_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "system_packages": { + "name": "system_packages", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "spec_hash": { + "name": "spec_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_sandbox_workspace_name_unique": { + "name": "workspace_sandbox_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_sandbox_workspace_idx": { + "name": "workspace_sandbox_workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_sandbox_spec_hash_idx": { + "name": "workspace_sandbox_spec_hash_idx", + "columns": [ + { + "expression": "spec_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_sandbox_workspace_id_workspace_id_fk": { + "name": "workspace_sandbox_workspace_id_workspace_id_fk", + "tableFrom": "workspace_sandbox", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_sandbox_created_by_user_id_fk": { + "name": "workspace_sandbox_created_by_user_id_fk", + "tableFrom": "workspace_sandbox", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.academy_cert_status": { + "name": "academy_cert_status", + "schema": "public", + "values": ["active", "revoked", "expired"] + }, + "public.background_work_kind": { + "name": "background_work_kind", + "schema": "public", + "values": ["deployment_side_effects", "fork_content_copy", "fork_sync", "fork_rollback"] + }, + "public.background_work_status_value": { + "name": "background_work_status_value", + "schema": "public", + "values": ["pending", "processing", "completed", "completed_with_warnings", "failed"] + }, + "public.billing_blocked_reason": { + "name": "billing_blocked_reason", + "schema": "public", + "values": ["payment_failed", "dispute"] + }, + "public.billing_entity_type": { + "name": "billing_entity_type", + "schema": "public", + "values": ["user", "organization"] + }, + "public.chat_type": { + "name": "chat_type", + "schema": "public", + "values": ["mothership", "copilot"] + }, + "public.copilot_async_tool_status": { + "name": "copilot_async_tool_status", + "schema": "public", + "values": ["pending", "running", "completed", "failed", "cancelled", "delivered"] + }, + "public.copilot_run_status": { + "name": "copilot_run_status", + "schema": "public", + "values": ["active", "paused_waiting_for_tool", "resuming", "complete", "error", "cancelled"] + }, + "public.copilot_tool_permission_decision": { + "name": "copilot_tool_permission_decision", + "schema": "public", + "values": ["allow", "allow_chat", "always_allow", "skip"] + }, + "public.credential_group_enrollment_status": { + "name": "credential_group_enrollment_status", + "schema": "public", + "values": ["invited", "delivery_failed", "in_progress", "completed", "revoked"] + }, + "public.credential_group_status": { + "name": "credential_group_status", + "schema": "public", + "values": ["active", "disabled"] + }, + "public.credential_member_role": { + "name": "credential_member_role", + "schema": "public", + "values": ["admin", "member"] + }, + "public.credential_member_status": { + "name": "credential_member_status", + "schema": "public", + "values": ["active", "pending", "revoked"] + }, + "public.credential_type": { + "name": "credential_type", + "schema": "public", + "values": [ + "oauth", + "managed_oauth", + "managed_mcp", + "env_workspace", + "env_personal", + "service_account" + ] + }, + "public.data_drain_cadence": { + "name": "data_drain_cadence", + "schema": "public", + "values": ["hourly", "daily"] + }, + "public.data_drain_destination": { + "name": "data_drain_destination", + "schema": "public", + "values": ["s3", "gcs", "azure_blob", "datadog", "bigquery", "snowflake", "webhook"] + }, + "public.data_drain_run_status": { + "name": "data_drain_run_status", + "schema": "public", + "values": ["running", "success", "failed"] + }, + "public.data_drain_run_trigger": { + "name": "data_drain_run_trigger", + "schema": "public", + "values": ["cron", "manual"] + }, + "public.data_drain_source": { + "name": "data_drain_source", + "schema": "public", + "values": ["workflow_logs", "job_logs", "audit_logs", "copilot_chats", "copilot_runs"] + }, + "public.execution_large_value_reference_source": { + "name": "execution_large_value_reference_source", + "schema": "public", + "values": ["execution_log", "paused_snapshot"] + }, + "public.folder_resource_type": { + "name": "folder_resource_type", + "schema": "public", + "values": ["workflow", "file", "knowledge_base", "table"] + }, + "public.invitation_kind": { + "name": "invitation_kind", + "schema": "public", + "values": ["organization", "workspace"] + }, + "public.invitation_membership_intent": { + "name": "invitation_membership_intent", + "schema": "public", + "values": ["internal", "external"] + }, + "public.invitation_status": { + "name": "invitation_status", + "schema": "public", + "values": ["pending", "accepted", "rejected", "cancelled", "expired"] + }, + "public.managed_oauth_credential_status": { + "name": "managed_oauth_credential_status", + "schema": "public", + "values": ["active", "needs_reauth", "revoked"] + }, + "public.permission_type": { + "name": "permission_type", + "schema": "public", + "values": ["admin", "write", "read"] + }, + "public.sandbox_image_status": { + "name": "sandbox_image_status", + "schema": "public", + "values": ["pending", "building", "ready", "failed"] + }, + "public.sandbox_language": { + "name": "sandbox_language", + "schema": "public", + "values": ["javascript", "python"] + }, + "public.secret_usage_scope": { + "name": "secret_usage_scope", + "schema": "public", + "values": ["workspace", "personal"] + }, + "public.secret_usage_source": { + "name": "secret_usage_source", + "schema": "public", + "values": ["workflow", "copilot", "mcp"] + }, + "public.upload_session_method": { + "name": "upload_session_method", + "schema": "public", + "values": ["put", "multipart"] + }, + "public.upload_session_provider": { + "name": "upload_session_provider", + "schema": "public", + "values": ["local", "s3", "blob", "gcs"] + }, + "public.upload_session_purpose": { + "name": "upload_session_purpose", + "schema": "public", + "values": [ + "workspace_file", + "table_import", + "knowledge_document", + "profile_picture", + "workspace_logo", + "mothership_attachment", + "execution_attachment" + ] + }, + "public.upload_session_status": { + "name": "upload_session_status", + "schema": "public", + "values": [ + "uploading", + "completing", + "finalizing", + "completed", + "aborting", + "aborted", + "failed", + "expired" + ] + }, + "public.usage_log_category": { + "name": "usage_log_category", + "schema": "public", + "values": ["model", "fixed", "tool", "model_unbilled"] + }, + "public.usage_log_source": { + "name": "usage_log_source", + "schema": "public", + "values": [ + "workflow", + "wand", + "copilot", + "workspace-chat", + "mcp_copilot", + "mothership_block", + "knowledge-base", + "voice-input", + "enrichment", + "voice-output", + "api-tool" + ] + }, + "public.workspace_file_search_index_status": { + "name": "workspace_file_search_index_status", + "schema": "public", + "values": ["pending", "ready", "skipped", "failed"] + }, + "public.workspace_fork_promote_direction": { + "name": "workspace_fork_promote_direction", + "schema": "public", + "values": ["push", "pull"] + }, + "public.workspace_fork_resource_type": { + "name": "workspace_fork_resource_type", + "schema": "public", + "values": [ + "workflow", + "oauth_credential", + "service_account_credential", + "env_var", + "table", + "knowledge_base", + "knowledge_document", + "file", + "file_folder", + "mcp_server", + "workflow_mcp_server", + "custom_block", + "custom_tool", + "skill" + ] + }, + "public.workspace_mode": { + "name": "workspace_mode", + "schema": "public", + "values": ["personal", "organization", "grandfathered_shared"] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/migrations/meta/0322_snapshot.json b/packages/db/migrations/meta/0322_snapshot.json new file mode 100644 index 00000000000..b47e87e3581 --- /dev/null +++ b/packages/db/migrations/meta/0322_snapshot.json @@ -0,0 +1,22342 @@ +{ + "id": "ba1c3c42-99d3-4793-96d7-14116a220308", + "prevId": "db637a5b-308b-4095-9dae-665f049d936a", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.academy_certificate": { + "name": "academy_certificate", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "academy_cert_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "issued_at": { + "name": "issued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "certificate_number": { + "name": "certificate_number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "academy_certificate_user_id_idx": { + "name": "academy_certificate_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "academy_certificate_course_id_idx": { + "name": "academy_certificate_course_id_idx", + "columns": [ + { + "expression": "course_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "academy_certificate_user_course_unique": { + "name": "academy_certificate_user_course_unique", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "course_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "academy_certificate_status_idx": { + "name": "academy_certificate_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "academy_certificate_user_id_user_id_fk": { + "name": "academy_certificate_user_id_user_id_fk", + "tableFrom": "academy_certificate", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "academy_certificate_certificate_number_unique": { + "name": "academy_certificate_certificate_number_unique", + "nullsNotDistinct": false, + "columns": ["certificate_number"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "account_user_id_idx": { + "name": "account_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_account_on_account_id_provider_id": { + "name": "idx_account_on_account_id_provider_id", + "columns": [ + { + "expression": "account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_key": { + "name": "api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'personal'" + }, + "last_used": { + "name": "last_used", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "api_key_workspace_type_idx": { + "name": "api_key_workspace_type_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "api_key_user_type_idx": { + "name": "api_key_user_type_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "api_key_key_hash_idx": { + "name": "api_key_key_hash_idx", + "columns": [ + { + "expression": "key_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "api_key_user_id_user_id_fk": { + "name": "api_key_user_id_user_id_fk", + "tableFrom": "api_key", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "api_key_workspace_id_workspace_id_fk": { + "name": "api_key_workspace_id_workspace_id_fk", + "tableFrom": "api_key", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "api_key_created_by_user_id_fk": { + "name": "api_key_created_by_user_id_fk", + "tableFrom": "api_key", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "api_key_key_unique": { + "name": "api_key_key_unique", + "nullsNotDistinct": false, + "columns": ["key"] + } + }, + "policies": {}, + "checkConstraints": { + "workspace_type_check": { + "name": "workspace_type_check", + "value": "(type = 'workspace' AND workspace_id IS NOT NULL) OR (type = 'personal' AND workspace_id IS NULL)" + } + }, + "isRLSEnabled": false + }, + "public.async_jobs": { + "name": "async_jobs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "run_at": { + "name": "run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "max_attempts": { + "name": "max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 3 + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "output": { + "name": "output", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "async_jobs_status_started_at_idx": { + "name": "async_jobs_status_started_at_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_status_completed_at_idx": { + "name": "async_jobs_status_completed_at_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "completed_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_schedule_pending_run_at_idx": { + "name": "async_jobs_schedule_pending_run_at_idx", + "columns": [ + { + "expression": "run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" = 'pending'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_schedule_processing_started_at_idx": { + "name": "async_jobs_schedule_processing_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" = 'processing'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_schedule_unreconciled_terminal_idx": { + "name": "async_jobs_schedule_unreconciled_terminal_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" IN ('completed', 'failed', 'cancelled') AND COALESCE(\"async_jobs\".\"metadata\" ->> 'scheduleReconciled', 'false') <> 'true'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.audit_log": { + "name": "audit_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_name": { + "name": "actor_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_email": { + "name": "actor_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "resource_name": { + "name": "resource_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "audit_log_workspace_created_idx": { + "name": "audit_log_workspace_created_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_workspace_created_at_id_idx": { + "name": "audit_log_workspace_created_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"created_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_actor_created_idx": { + "name": "audit_log_actor_created_idx", + "columns": [ + { + "expression": "actor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_resource_idx": { + "name": "audit_log_resource_idx", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_action_idx": { + "name": "audit_log_action_idx", + "columns": [ + { + "expression": "action", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "audit_log_workspace_id_workspace_id_fk": { + "name": "audit_log_workspace_id_workspace_id_fk", + "tableFrom": "audit_log", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "audit_log_actor_id_user_id_fk": { + "name": "audit_log_actor_id_user_id_fk", + "tableFrom": "audit_log", + "tableTo": "user", + "columnsFrom": ["actor_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.background_work_status": { + "name": "background_work_status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "background_work_kind", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "background_work_status_value", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "background_work_status_workspace_status_idx": { + "name": "background_work_status_workspace_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "background_work_status_workflow_status_idx": { + "name": "background_work_status_workflow_status_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "background_work_status_meta_child_ws_idx": { + "name": "background_work_status_meta_child_ws_idx", + "columns": [ + { + "expression": "(\"metadata\" ->> 'childWorkspaceId')", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "background_work_status_meta_other_ws_idx": { + "name": "background_work_status_meta_other_ws_idx", + "columns": [ + { + "expression": "(\"metadata\" ->> 'otherWorkspaceId')", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "background_work_status_workspace_id_workspace_id_fk": { + "name": "background_work_status_workspace_id_workspace_id_fk", + "tableFrom": "background_work_status", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "background_work_status_workflow_id_workflow_id_fk": { + "name": "background_work_status_workflow_id_workflow_id_fk", + "tableFrom": "background_work_status", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.chat": { + "name": "chat", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "customizations": { + "name": "customizations", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "auth_type": { + "name": "auth_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'public'" + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "allowed_emails": { + "name": "allowed_emails", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "output_configs": { + "name": "output_configs", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "include_thinking": { + "name": "include_thinking", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "include_tool_calls": { + "name": "include_tool_calls", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "identifier_idx": { + "name": "identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"chat\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "chat_archived_at_partial_idx": { + "name": "chat_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"chat\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_chat_on_workflow_id_archived_at": { + "name": "idx_chat_on_workflow_id_archived_at", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "chat_workflow_id_workflow_id_fk": { + "name": "chat_workflow_id_workflow_id_fk", + "tableFrom": "chat", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "chat_user_id_user_id_fk": { + "name": "chat_user_id_user_id_fk", + "tableFrom": "chat", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_async_tool_calls": { + "name": "copilot_async_tool_calls", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "checkpoint_id": { + "name": "checkpoint_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "tool_call_id": { + "name": "tool_call_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tool_name": { + "name": "tool_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "args": { + "name": "args", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "status": { + "name": "status", + "type": "copilot_async_tool_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "result": { + "name": "result", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "permission_decision": { + "name": "permission_decision", + "type": "copilot_tool_permission_decision", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "permission_decided_at": { + "name": "permission_decided_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "claimed_at": { + "name": "claimed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "claimed_by": { + "name": "claimed_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_async_tool_calls_run_id_idx": { + "name": "copilot_async_tool_calls_run_id_idx", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_checkpoint_id_idx": { + "name": "copilot_async_tool_calls_checkpoint_id_idx", + "columns": [ + { + "expression": "checkpoint_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_status_idx": { + "name": "copilot_async_tool_calls_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_run_status_idx": { + "name": "copilot_async_tool_calls_run_status_idx", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_tool_call_id_unique": { + "name": "copilot_async_tool_calls_tool_call_id_unique", + "columns": [ + { + "expression": "tool_call_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_async_tool_calls_run_id_copilot_runs_id_fk": { + "name": "copilot_async_tool_calls_run_id_copilot_runs_id_fk", + "tableFrom": "copilot_async_tool_calls", + "tableTo": "copilot_runs", + "columnsFrom": ["run_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_async_tool_calls_checkpoint_id_copilot_run_checkpoints_id_fk": { + "name": "copilot_async_tool_calls_checkpoint_id_copilot_run_checkpoints_id_fk", + "tableFrom": "copilot_async_tool_calls", + "tableTo": "copilot_run_checkpoints", + "columnsFrom": ["checkpoint_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_chats": { + "name": "copilot_chats", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "chat_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'copilot'" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'claude-3-7-sonnet-latest'" + }, + "conversation_id": { + "name": "conversation_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "preview_yaml": { + "name": "preview_yaml", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plan_artifact": { + "name": "plan_artifact", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "resources": { + "name": "resources", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "auto_allowed_tools": { + "name": "auto_allowed_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "pinned": { + "name": "pinned", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_chats_user_id_idx": { + "name": "copilot_chats_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_workflow_id_idx": { + "name": "copilot_chats_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_user_workflow_idx": { + "name": "copilot_chats_user_workflow_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_user_workspace_idx": { + "name": "copilot_chats_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_created_at_idx": { + "name": "copilot_chats_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_updated_at_idx": { + "name": "copilot_chats_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_workspace_created_at_id_idx": { + "name": "copilot_chats_workspace_created_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"created_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_user_workspace_deleted_partial_idx": { + "name": "copilot_chats_user_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_chats\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_chats_user_id_user_id_fk": { + "name": "copilot_chats_user_id_user_id_fk", + "tableFrom": "copilot_chats", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_chats_workflow_id_workflow_id_fk": { + "name": "copilot_chats_workflow_id_workflow_id_fk", + "tableFrom": "copilot_chats", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_chats_workspace_id_workspace_id_fk": { + "name": "copilot_chats_workspace_id_workspace_id_fk", + "tableFrom": "copilot_chats", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_feedback": { + "name": "copilot_feedback", + "schema": "", + "columns": { + "feedback_id": { + "name": "feedback_id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_query": { + "name": "user_query", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "agent_response": { + "name": "agent_response", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_positive": { + "name": "is_positive", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "feedback": { + "name": "feedback", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_yaml": { + "name": "workflow_yaml", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_feedback_user_id_idx": { + "name": "copilot_feedback_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_chat_id_idx": { + "name": "copilot_feedback_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_user_chat_idx": { + "name": "copilot_feedback_user_chat_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_is_positive_idx": { + "name": "copilot_feedback_is_positive_idx", + "columns": [ + { + "expression": "is_positive", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_created_at_idx": { + "name": "copilot_feedback_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_feedback_user_id_user_id_fk": { + "name": "copilot_feedback_user_id_user_id_fk", + "tableFrom": "copilot_feedback", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_feedback_chat_id_copilot_chats_id_fk": { + "name": "copilot_feedback_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_feedback", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_messages": { + "name": "copilot_messages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "stream_id": { + "name": "stream_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_message_id": { + "name": "parent_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tokens_in": { + "name": "tokens_in", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tokens_out": { + "name": "tokens_out", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_messages_chat_message_unique": { + "name": "copilot_messages_chat_message_unique", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_chat_created_at_idx": { + "name": "copilot_messages_chat_created_at_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_chat_seq_idx": { + "name": "copilot_messages_chat_seq_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_chat_stream_idx": { + "name": "copilot_messages_chat_stream_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stream_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"stream_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_user_created_at_idx": { + "name": "copilot_messages_user_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"role\" = 'user' AND \"copilot_messages\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_messages_chat_id_copilot_chats_id_fk": { + "name": "copilot_messages_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_messages", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_run_checkpoints": { + "name": "copilot_run_checkpoints", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "pending_tool_call_id": { + "name": "pending_tool_call_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "conversation_snapshot": { + "name": "conversation_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "agent_state": { + "name": "agent_state", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "provider_request": { + "name": "provider_request", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_run_checkpoints_run_id_idx": { + "name": "copilot_run_checkpoints_run_id_idx", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_run_checkpoints_pending_tool_call_id_idx": { + "name": "copilot_run_checkpoints_pending_tool_call_id_idx", + "columns": [ + { + "expression": "pending_tool_call_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_run_checkpoints_run_pending_tool_unique": { + "name": "copilot_run_checkpoints_run_pending_tool_unique", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "pending_tool_call_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_run_checkpoints_run_id_copilot_runs_id_fk": { + "name": "copilot_run_checkpoints_run_id_copilot_runs_id_fk", + "tableFrom": "copilot_run_checkpoints", + "tableTo": "copilot_runs", + "columnsFrom": ["run_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_runs": { + "name": "copilot_runs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_run_id": { + "name": "parent_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stream_id": { + "name": "stream_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "agent": { + "name": "agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "copilot_run_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "request_context": { + "name": "request_context", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "copilot_runs_execution_id_idx": { + "name": "copilot_runs_execution_id_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_parent_run_id_idx": { + "name": "copilot_runs_parent_run_id_idx", + "columns": [ + { + "expression": "parent_run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_chat_id_idx": { + "name": "copilot_runs_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_user_id_idx": { + "name": "copilot_runs_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_workflow_id_idx": { + "name": "copilot_runs_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_workspace_id_idx": { + "name": "copilot_runs_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_status_idx": { + "name": "copilot_runs_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_chat_execution_idx": { + "name": "copilot_runs_chat_execution_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_execution_started_at_idx": { + "name": "copilot_runs_execution_started_at_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_workspace_completed_at_id_idx": { + "name": "copilot_runs_workspace_completed_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"completed_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_stream_id_unique": { + "name": "copilot_runs_stream_id_unique", + "columns": [ + { + "expression": "stream_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_runs_chat_id_copilot_chats_id_fk": { + "name": "copilot_runs_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_runs_user_id_user_id_fk": { + "name": "copilot_runs_user_id_user_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_runs_workflow_id_workflow_id_fk": { + "name": "copilot_runs_workflow_id_workflow_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_runs_workspace_id_workspace_id_fk": { + "name": "copilot_runs_workspace_id_workspace_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_workflow_read_hashes": { + "name": "copilot_workflow_read_hashes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_workflow_read_hashes_chat_id_idx": { + "name": "copilot_workflow_read_hashes_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_workflow_read_hashes_workflow_id_idx": { + "name": "copilot_workflow_read_hashes_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_workflow_read_hashes_chat_workflow_unique": { + "name": "copilot_workflow_read_hashes_chat_workflow_unique", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_workflow_read_hashes_chat_id_copilot_chats_id_fk": { + "name": "copilot_workflow_read_hashes_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_workflow_read_hashes", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_workflow_read_hashes_workflow_id_workflow_id_fk": { + "name": "copilot_workflow_read_hashes_workflow_id_workflow_id_fk", + "tableFrom": "copilot_workflow_read_hashes", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.credential": { + "name": "credential", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "credential_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unredacted": { + "name": "unredacted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "env_key": { + "name": "env_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "env_owner_user_id": { + "name": "env_owner_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encrypted_service_account_key": { + "name": "encrypted_service_account_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorization_app_id": { + "name": "authorization_app_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_group_enrollment_id": { + "name": "credential_group_enrollment_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_group_option_id": { + "name": "credential_group_option_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mcp_server_id": { + "name": "mcp_server_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "managed_oauth_scope_version": { + "name": "managed_oauth_scope_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "provider_subject_id": { + "name": "provider_subject_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_tenant_id": { + "name": "provider_tenant_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "managed_oauth_status": { + "name": "managed_oauth_status", + "type": "managed_oauth_credential_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "granted_scopes": { + "name": "granted_scopes", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "provider_metadata": { + "name": "provider_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "encrypted_oauth_token_set": { + "name": "encrypted_oauth_token_set", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mcp_tools": { + "name": "mcp_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "mcp_tools_refreshed_at": { + "name": "mcp_tools_refreshed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "granted_at": { + "name": "granted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_refreshed_at": { + "name": "last_refreshed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_workspace_id_idx": { + "name": "credential_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_type_idx": { + "name": "credential_type_idx", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_provider_id_idx": { + "name": "credential_provider_id_idx", + "columns": [ + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_account_id_idx": { + "name": "credential_account_id_idx", + "columns": [ + { + "expression": "account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_env_owner_user_id_idx": { + "name": "credential_env_owner_user_id_idx", + "columns": [ + { + "expression": "env_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_idx": { + "name": "credential_group_enrollment_idx", + "columns": [ + { + "expression": "credential_group_enrollment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_mcp_server_idx": { + "name": "credential_mcp_server_idx", + "columns": [ + { + "expression": "mcp_server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_option_unique": { + "name": "credential_group_option_unique", + "columns": [ + { + "expression": "credential_group_enrollment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "credential_group_option_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"credential\".\"type\" = 'managed_oauth'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_managed_mcp_enrollment_server_unique": { + "name": "credential_managed_mcp_enrollment_server_unique", + "columns": [ + { + "expression": "credential_group_enrollment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "mcp_server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"credential\".\"type\" = 'managed_mcp'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_workspace_account_unique": { + "name": "credential_workspace_account_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "account_id IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_workspace_env_unique": { + "name": "credential_workspace_env_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "env_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "type = 'env_workspace'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_workspace_personal_env_unique": { + "name": "credential_workspace_personal_env_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "env_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "env_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "type = 'env_personal'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_workspace_id_workspace_id_fk": { + "name": "credential_workspace_id_workspace_id_fk", + "tableFrom": "credential", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_account_id_account_id_fk": { + "name": "credential_account_id_account_id_fk", + "tableFrom": "credential", + "tableTo": "account", + "columnsFrom": ["account_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_env_owner_user_id_user_id_fk": { + "name": "credential_env_owner_user_id_user_id_fk", + "tableFrom": "credential", + "tableTo": "user", + "columnsFrom": ["env_owner_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_credential_group_enrollment_id_credential_group_enrollment_id_fk": { + "name": "credential_credential_group_enrollment_id_credential_group_enrollment_id_fk", + "tableFrom": "credential", + "tableTo": "credential_group_enrollment", + "columnsFrom": ["credential_group_enrollment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_mcp_server_id_mcp_servers_id_fk": { + "name": "credential_mcp_server_id_mcp_servers_id_fk", + "tableFrom": "credential", + "tableTo": "mcp_servers", + "columnsFrom": ["mcp_server_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_created_by_user_id_fk": { + "name": "credential_created_by_user_id_fk", + "tableFrom": "credential", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "credential_oauth_source_check": { + "name": "credential_oauth_source_check", + "value": "(type <> 'oauth') OR (account_id IS NOT NULL AND provider_id IS NOT NULL)" + }, + "credential_managed_oauth_source_check": { + "name": "credential_managed_oauth_source_check", + "value": "(type::text <> 'managed_oauth') OR (\n account_id IS NULL\n AND provider_id IS NOT NULL\n AND authorization_app_id IS NOT NULL\n AND provider_subject_id IS NOT NULL\n AND managed_oauth_status IS NOT NULL\n AND granted_scopes IS NOT NULL\n AND cardinality(granted_scopes) > 0\n AND encrypted_oauth_token_set IS NOT NULL\n AND granted_at IS NOT NULL\n )" + }, + "credential_managed_oauth_group_binding_check": { + "name": "credential_managed_oauth_group_binding_check", + "value": "(type::text <> 'managed_oauth') OR (\n credential_group_enrollment_id IS NOT NULL\n AND credential_group_option_id IS NOT NULL\n AND managed_oauth_scope_version IS NOT NULL\n AND managed_oauth_scope_version > 0\n )" + }, + "credential_managed_mcp_source_check": { + "name": "credential_managed_mcp_source_check", + "value": "(type::text <> 'managed_mcp') OR (\n id LIKE 'mcp-cg-%'\n AND account_id IS NULL\n AND provider_id IS NULL\n AND authorization_app_id IS NULL\n AND credential_group_enrollment_id IS NOT NULL\n AND credential_group_option_id IS NULL\n AND mcp_server_id IS NOT NULL\n AND managed_oauth_status IS NOT NULL\n AND (managed_oauth_status <> 'active' OR (\n encrypted_oauth_token_set IS NOT NULL\n AND mcp_tools IS NOT NULL\n ))\n AND granted_at IS NOT NULL\n AND managed_oauth_scope_version IS NULL\n AND provider_subject_id IS NULL\n AND provider_tenant_id IS NULL\n AND granted_scopes IS NULL\n AND provider_metadata IS NULL\n AND created_by IS NULL\n AND env_key IS NULL\n AND env_owner_user_id IS NULL\n AND encrypted_service_account_key IS NULL\n AND unredacted = false\n )" + }, + "credential_creator_source_check": { + "name": "credential_creator_source_check", + "value": "(type::text = 'managed_mcp') OR created_by IS NOT NULL" + }, + "credential_workspace_env_source_check": { + "name": "credential_workspace_env_source_check", + "value": "(type <> 'env_workspace') OR (env_key IS NOT NULL AND env_owner_user_id IS NULL)" + }, + "credential_personal_env_source_check": { + "name": "credential_personal_env_source_check", + "value": "(type <> 'env_personal') OR (env_key IS NOT NULL AND env_owner_user_id IS NOT NULL)" + } + }, + "isRLSEnabled": false + }, + "public.credential_group": { + "name": "credential_group", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "public_id": { + "name": "public_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "options": { + "name": "options", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "encrypted_provider_configuration": { + "name": "encrypted_provider_configuration", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "credential_group_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_group_public_id_unique": { + "name": "credential_group_public_id_unique", + "columns": [ + { + "expression": "public_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_workspace_status_idx": { + "name": "credential_group_workspace_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_workspace_name_unique": { + "name": "credential_group_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lower(\"name\")", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_group_workspace_id_workspace_id_fk": { + "name": "credential_group_workspace_id_workspace_id_fk", + "tableFrom": "credential_group", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_group_created_by_user_id_fk": { + "name": "credential_group_created_by_user_id_fk", + "tableFrom": "credential_group", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.credential_group_enrollment": { + "name": "credential_group_enrollment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "credential_group_id": { + "name": "credential_group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "credential_group_enrollment_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'invited'" + }, + "invitation_token_hash": { + "name": "invitation_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invitation_expires_at": { + "name": "invitation_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "invited_at": { + "name": "invited_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "sent_at": { + "name": "sent_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_delivery_error": { + "name": "last_delivery_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_group_enrollment_group_email_unique": { + "name": "credential_group_enrollment_group_email_unique", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_invitation_token_hash_unique": { + "name": "credential_group_enrollment_invitation_token_hash_unique", + "columns": [ + { + "expression": "invitation_token_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_group_status_idx": { + "name": "credential_group_enrollment_group_status_idx", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_group_invited_at_id_idx": { + "name": "credential_group_enrollment_group_invited_at_id_idx", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "invited_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_group_enrollment_credential_group_id_credential_group_id_fk": { + "name": "credential_group_enrollment_credential_group_id_credential_group_id_fk", + "tableFrom": "credential_group_enrollment", + "tableTo": "credential_group", + "columnsFrom": ["credential_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_group_enrollment_created_by_user_id_fk": { + "name": "credential_group_enrollment_created_by_user_id_fk", + "tableFrom": "credential_group_enrollment", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "credential_group_enrollment_normalized_email_check": { + "name": "credential_group_enrollment_normalized_email_check", + "value": "\"credential_group_enrollment\".\"email\" = lower(btrim(\"credential_group_enrollment\".\"email\")) AND length(\"credential_group_enrollment\".\"email\") BETWEEN 3 AND 320" + }, + "credential_group_enrollment_invitation_token_hash_length_check": { + "name": "credential_group_enrollment_invitation_token_hash_length_check", + "value": "length(\"credential_group_enrollment\".\"invitation_token_hash\") = 64" + } + }, + "isRLSEnabled": false + }, + "public.credential_member": { + "name": "credential_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "credential_member_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'member'" + }, + "status": { + "name": "status", + "type": "credential_member_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "joined_at": { + "name": "joined_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "invited_by": { + "name": "invited_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_member_user_id_idx": { + "name": "credential_member_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_member_role_idx": { + "name": "credential_member_role_idx", + "columns": [ + { + "expression": "role", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_member_status_idx": { + "name": "credential_member_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_member_unique": { + "name": "credential_member_unique", + "columns": [ + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_member_credential_id_credential_id_fk": { + "name": "credential_member_credential_id_credential_id_fk", + "tableFrom": "credential_member", + "tableTo": "credential", + "columnsFrom": ["credential_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_member_user_id_user_id_fk": { + "name": "credential_member_user_id_user_id_fk", + "tableFrom": "credential_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_member_invited_by_user_id_fk": { + "name": "credential_member_invited_by_user_id_fk", + "tableFrom": "credential_member", + "tableTo": "user", + "columnsFrom": ["invited_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.custom_block": { + "name": "custom_block", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "icon_url": { + "name": "icon_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inputs": { + "name": "inputs", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "outputs": { + "name": "outputs", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "trace_child_runs": { + "name": "trace_child_runs", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "custom_block_organization_id_idx": { + "name": "custom_block_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "custom_block_workflow_id_idx": { + "name": "custom_block_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "custom_block_organization_type_unique": { + "name": "custom_block_organization_type_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "custom_block_organization_id_organization_id_fk": { + "name": "custom_block_organization_id_organization_id_fk", + "tableFrom": "custom_block", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "custom_block_workflow_id_workflow_id_fk": { + "name": "custom_block_workflow_id_workflow_id_fk", + "tableFrom": "custom_block", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "custom_block_created_by_user_id_fk": { + "name": "custom_block_created_by_user_id_fk", + "tableFrom": "custom_block", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.custom_tools": { + "name": "custom_tools", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "schema": { + "name": "schema", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "custom_tools_workspace_id_idx": { + "name": "custom_tools_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "custom_tools_workspace_title_unique": { + "name": "custom_tools_workspace_title_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "title", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "custom_tools_workspace_id_workspace_id_fk": { + "name": "custom_tools_workspace_id_workspace_id_fk", + "tableFrom": "custom_tools", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "custom_tools_user_id_user_id_fk": { + "name": "custom_tools_user_id_user_id_fk", + "tableFrom": "custom_tools", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.data_drain_runs": { + "name": "data_drain_runs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "drain_id": { + "name": "drain_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "data_drain_run_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "trigger": { + "name": "trigger", + "type": "data_drain_run_trigger", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "finished_at": { + "name": "finished_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rows_exported": { + "name": "rows_exported", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "bytes_written": { + "name": "bytes_written", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "cursor_before": { + "name": "cursor_before", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cursor_after": { + "name": "cursor_after", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "locators": { + "name": "locators", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "data_drain_runs_drain_started_idx": { + "name": "data_drain_runs_drain_started_idx", + "columns": [ + { + "expression": "drain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "data_drain_runs_drain_id_data_drains_id_fk": { + "name": "data_drain_runs_drain_id_data_drains_id_fk", + "tableFrom": "data_drain_runs", + "tableTo": "data_drains", + "columnsFrom": ["drain_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.data_drains": { + "name": "data_drains", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "data_drain_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "destination_type": { + "name": "destination_type", + "type": "data_drain_destination", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "destination_config": { + "name": "destination_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "destination_credentials": { + "name": "destination_credentials", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "schedule_cadence": { + "name": "schedule_cadence", + "type": "data_drain_cadence", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "cursor": { + "name": "cursor", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_run_at": { + "name": "last_run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_success_at": { + "name": "last_success_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "data_drains_org_idx": { + "name": "data_drains_org_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "data_drains_due_idx": { + "name": "data_drains_due_idx", + "columns": [ + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "data_drains_org_name_unique": { + "name": "data_drains_org_name_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "data_drains_organization_id_organization_id_fk": { + "name": "data_drains_organization_id_organization_id_fk", + "tableFrom": "data_drains", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "data_drains_created_by_user_id_fk": { + "name": "data_drains_created_by_user_id_fk", + "tableFrom": "data_drains", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.docs_embeddings": { + "name": "docs_embeddings", + "schema": "", + "columns": { + "chunk_id": { + "name": "chunk_id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "chunk_text": { + "name": "chunk_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_document": { + "name": "source_document", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_link": { + "name": "source_link", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header_text": { + "name": "header_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header_level": { + "name": "header_level", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "embedding": { + "name": "embedding", + "type": "vector(1536)", + "primaryKey": false, + "notNull": true + }, + "embedding_model": { + "name": "embedding_model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text-embedding-3-small'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "chunk_text_tsv": { + "name": "chunk_text_tsv", + "type": "tsvector", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "to_tsvector('english', \"docs_embeddings\".\"chunk_text\")", + "type": "stored" + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "docs_emb_source_document_idx": { + "name": "docs_emb_source_document_idx", + "columns": [ + { + "expression": "source_document", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_header_level_idx": { + "name": "docs_emb_header_level_idx", + "columns": [ + { + "expression": "header_level", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_source_header_idx": { + "name": "docs_emb_source_header_idx", + "columns": [ + { + "expression": "source_document", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "header_level", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_model_idx": { + "name": "docs_emb_model_idx", + "columns": [ + { + "expression": "embedding_model", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_created_at_idx": { + "name": "docs_emb_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_embedding_vector_hnsw_idx": { + "name": "docs_embedding_vector_hnsw_idx", + "columns": [ + { + "expression": "embedding", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "vector_cosine_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hnsw", + "with": { + "m": 16, + "ef_construction": 64 + } + }, + "docs_emb_metadata_gin_idx": { + "name": "docs_emb_metadata_gin_idx", + "columns": [ + { + "expression": "metadata", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "docs_emb_chunk_text_fts_idx": { + "name": "docs_emb_chunk_text_fts_idx", + "columns": [ + { + "expression": "chunk_text_tsv", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "docs_embedding_not_null_check": { + "name": "docs_embedding_not_null_check", + "value": "\"embedding\" IS NOT NULL" + }, + "docs_header_level_check": { + "name": "docs_header_level_check", + "value": "\"header_level\" >= 1 AND \"header_level\" <= 6" + } + }, + "isRLSEnabled": false + }, + "public.document": { + "name": "document", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "filename": { + "name": "filename", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_url": { + "name": "file_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "storage_key": { + "name": "storage_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chunk_count": { + "name": "chunk_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "character_count": { + "name": "character_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "processing_status": { + "name": "processing_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "processing_attempts": { + "name": "processing_attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "processing_queued_at": { + "name": "processing_queued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_queue_token": { + "name": "processing_queue_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "processing_started_at": { + "name": "processing_started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_deferred_until": { + "name": "processing_deferred_until", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_completed_at": { + "name": "processing_completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_error": { + "name": "processing_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "user_excluded": { + "name": "user_excluded", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "tag1": { + "name": "tag1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag2": { + "name": "tag2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag3": { + "name": "tag3", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag4": { + "name": "tag4", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag5": { + "name": "tag5", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag6": { + "name": "tag6", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag7": { + "name": "tag7", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "number1": { + "name": "number1", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number2": { + "name": "number2", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number3": { + "name": "number3", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number4": { + "name": "number4", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number5": { + "name": "number5", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "date1": { + "name": "date1", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "date2": { + "name": "date2", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "boolean1": { + "name": "boolean1", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean2": { + "name": "boolean2", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean3": { + "name": "boolean3", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_url": { + "name": "source_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "acl": { + "name": "acl", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{ws}'::text[]" + }, + "source_modified_at": { + "name": "source_modified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "doc_kb_id_idx": { + "name": "doc_kb_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_acl_gin_idx": { + "name": "doc_acl_gin_idx", + "columns": [ + { + "expression": "acl", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "array_ops" + } + ], + "isUnique": false, + "where": "\"document\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "gin", + "with": {} + }, + "doc_filename_idx": { + "name": "doc_filename_idx", + "columns": [ + { + "expression": "filename", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_processing_status_idx": { + "name": "doc_processing_status_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "processing_status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_connector_external_id_idx": { + "name": "doc_connector_external_id_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"document\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_connector_id_idx": { + "name": "doc_connector_id_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_active_kb_token_count_idx": { + "name": "doc_active_kb_token_count_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "token_count", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"user_excluded\" = false AND \"document\".\"archived_at\" IS NULL AND \"document\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_storage_key_idx": { + "name": "doc_storage_key_idx", + "columns": [ + { + "expression": "storage_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"storage_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_archived_at_partial_idx": { + "name": "doc_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_deleted_at_partial_idx": { + "name": "doc_deleted_at_partial_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag1_idx": { + "name": "doc_tag1_idx", + "columns": [ + { + "expression": "tag1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag2_idx": { + "name": "doc_tag2_idx", + "columns": [ + { + "expression": "tag2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag3_idx": { + "name": "doc_tag3_idx", + "columns": [ + { + "expression": "tag3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag4_idx": { + "name": "doc_tag4_idx", + "columns": [ + { + "expression": "tag4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag5_idx": { + "name": "doc_tag5_idx", + "columns": [ + { + "expression": "tag5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag6_idx": { + "name": "doc_tag6_idx", + "columns": [ + { + "expression": "tag6", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag7_idx": { + "name": "doc_tag7_idx", + "columns": [ + { + "expression": "tag7", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number1_idx": { + "name": "doc_number1_idx", + "columns": [ + { + "expression": "number1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number2_idx": { + "name": "doc_number2_idx", + "columns": [ + { + "expression": "number2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number3_idx": { + "name": "doc_number3_idx", + "columns": [ + { + "expression": "number3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number4_idx": { + "name": "doc_number4_idx", + "columns": [ + { + "expression": "number4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number5_idx": { + "name": "doc_number5_idx", + "columns": [ + { + "expression": "number5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_date1_idx": { + "name": "doc_date1_idx", + "columns": [ + { + "expression": "date1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_date2_idx": { + "name": "doc_date2_idx", + "columns": [ + { + "expression": "date2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_boolean1_idx": { + "name": "doc_boolean1_idx", + "columns": [ + { + "expression": "boolean1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_boolean2_idx": { + "name": "doc_boolean2_idx", + "columns": [ + { + "expression": "boolean2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_boolean3_idx": { + "name": "doc_boolean3_idx", + "columns": [ + { + "expression": "boolean3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "document_knowledge_base_id_knowledge_base_id_fk": { + "name": "document_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "document", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "document_connector_id_knowledge_connector_id_fk": { + "name": "document_connector_id_knowledge_connector_id_fk", + "tableFrom": "document", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "document_uploaded_by_user_id_fk": { + "name": "document_uploaded_by_user_id_fk", + "tableFrom": "document", + "tableTo": "user", + "columnsFrom": ["uploaded_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "doc_acl_token_shape_check": { + "name": "doc_acl_token_shape_check", + "value": "array_position(\"document\".\"acl\", NULL) IS NULL AND (cardinality(\"document\".\"acl\") = 0 OR (cardinality(\"document\".\"acl\") = array_length(string_to_array(array_to_string(\"document\".\"acl\", E'\\n'), E'\\n'), 1) AND array_to_string(\"document\".\"acl\", E'\\n') ~ '^((ws|pub|link|u:[^\\nA-Z]+@[^\\nA-Z]+|[gs]:[^\\n:]+:[^\\n:]+:[^\\n]+)(\\n(ws|pub|link|u:[^\\nA-Z]+@[^\\nA-Z]+|[gs]:[^\\n:]+:[^\\n:]+:[^\\n]+))*)$'))" + } + }, + "isRLSEnabled": false + }, + "public.document_secret_provenance": { + "name": "document_secret_provenance", + "schema": "", + "columns": { + "document_id": { + "name": "document_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "source_hash": { + "name": "source_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_secret_provenance_document_id_document_id_fk": { + "name": "document_secret_provenance_document_id_document_id_fk", + "tableFrom": "document_secret_provenance", + "tableTo": "document", + "columnsFrom": ["document_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "document_secret_provenance_status_check": { + "name": "document_secret_provenance_status_check", + "value": "\"document_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.embedding": { + "name": "embedding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chunk_index": { + "name": "chunk_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "chunk_hash": { + "name": "chunk_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content_length": { + "name": "content_length", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "embedding": { + "name": "embedding", + "type": "vector(1536)", + "primaryKey": false, + "notNull": false + }, + "embedding_model": { + "name": "embedding_model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text-embedding-3-small'" + }, + "start_offset": { + "name": "start_offset", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "end_offset": { + "name": "end_offset", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag1": { + "name": "tag1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag2": { + "name": "tag2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag3": { + "name": "tag3", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag4": { + "name": "tag4", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag5": { + "name": "tag5", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag6": { + "name": "tag6", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag7": { + "name": "tag7", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "number1": { + "name": "number1", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number2": { + "name": "number2", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number3": { + "name": "number3", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number4": { + "name": "number4", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number5": { + "name": "number5", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "date1": { + "name": "date1", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "date2": { + "name": "date2", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "boolean1": { + "name": "boolean1", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean2": { + "name": "boolean2", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean3": { + "name": "boolean3", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "content_tsv": { + "name": "content_tsv", + "type": "tsvector", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "to_tsvector('english', \"embedding\".\"content\")", + "type": "stored" + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "emb_kb_id_idx": { + "name": "emb_kb_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_doc_id_idx": { + "name": "emb_doc_id_idx", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_doc_chunk_idx": { + "name": "emb_doc_chunk_idx", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chunk_index", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_kb_model_idx": { + "name": "emb_kb_model_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "embedding_model", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_kb_enabled_idx": { + "name": "emb_kb_enabled_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_doc_enabled_idx": { + "name": "emb_doc_enabled_idx", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "embedding_vector_hnsw_idx": { + "name": "embedding_vector_hnsw_idx", + "columns": [ + { + "expression": "embedding", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "vector_cosine_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hnsw", + "with": { + "m": 16, + "ef_construction": 64 + } + }, + "emb_tag1_idx": { + "name": "emb_tag1_idx", + "columns": [ + { + "expression": "tag1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag2_idx": { + "name": "emb_tag2_idx", + "columns": [ + { + "expression": "tag2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag3_idx": { + "name": "emb_tag3_idx", + "columns": [ + { + "expression": "tag3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag4_idx": { + "name": "emb_tag4_idx", + "columns": [ + { + "expression": "tag4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag5_idx": { + "name": "emb_tag5_idx", + "columns": [ + { + "expression": "tag5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag6_idx": { + "name": "emb_tag6_idx", + "columns": [ + { + "expression": "tag6", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag7_idx": { + "name": "emb_tag7_idx", + "columns": [ + { + "expression": "tag7", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number1_idx": { + "name": "emb_number1_idx", + "columns": [ + { + "expression": "number1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number2_idx": { + "name": "emb_number2_idx", + "columns": [ + { + "expression": "number2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number3_idx": { + "name": "emb_number3_idx", + "columns": [ + { + "expression": "number3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number4_idx": { + "name": "emb_number4_idx", + "columns": [ + { + "expression": "number4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number5_idx": { + "name": "emb_number5_idx", + "columns": [ + { + "expression": "number5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_date1_idx": { + "name": "emb_date1_idx", + "columns": [ + { + "expression": "date1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_date2_idx": { + "name": "emb_date2_idx", + "columns": [ + { + "expression": "date2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_boolean1_idx": { + "name": "emb_boolean1_idx", + "columns": [ + { + "expression": "boolean1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_boolean2_idx": { + "name": "emb_boolean2_idx", + "columns": [ + { + "expression": "boolean2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_boolean3_idx": { + "name": "emb_boolean3_idx", + "columns": [ + { + "expression": "boolean3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_content_fts_idx": { + "name": "emb_content_fts_idx", + "columns": [ + { + "expression": "content_tsv", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": { + "embedding_knowledge_base_id_knowledge_base_id_fk": { + "name": "embedding_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "embedding", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "embedding_document_id_document_id_fk": { + "name": "embedding_document_id_document_id_fk", + "tableFrom": "embedding", + "tableTo": "document", + "columnsFrom": ["document_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "embedding_not_null_check": { + "name": "embedding_not_null_check", + "value": "\"embedding\" IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.embedding_secret_provenance": { + "name": "embedding_secret_provenance", + "schema": "", + "columns": { + "embedding_id": { + "name": "embedding_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "embedding_secret_provenance_embedding_id_embedding_id_fk": { + "name": "embedding_secret_provenance_embedding_id_embedding_id_fk", + "tableFrom": "embedding_secret_provenance", + "tableTo": "embedding", + "columnsFrom": ["embedding_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "embedding_secret_provenance_status_check": { + "name": "embedding_secret_provenance_status_check", + "value": "\"embedding_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.environment": { + "name": "environment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "variables": { + "name": "variables", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "environment_user_id_user_id_fk": { + "name": "environment_user_id_user_id_fk", + "tableFrom": "environment", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "environment_user_id_unique": { + "name": "environment_user_id_unique", + "nullsNotDistinct": false, + "columns": ["user_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_large_value_dependencies": { + "name": "execution_large_value_dependencies", + "schema": "", + "columns": { + "parent_key": { + "name": "parent_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_key": { + "name": "child_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "execution_large_value_dependencies_workspace_parent_key_idx": { + "name": "execution_large_value_dependencies_workspace_parent_key_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_value_dependencies_workspace_child_key_idx": { + "name": "execution_large_value_dependencies_workspace_child_key_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "child_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_large_value_dependencies_workspace_id_workspace_id_fk": { + "name": "execution_large_value_dependencies_workspace_id_workspace_id_fk", + "tableFrom": "execution_large_value_dependencies", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "execution_large_value_dependencies_parent_key_child_key_pk": { + "name": "execution_large_value_dependencies_parent_key_child_key_pk", + "columns": ["parent_key", "child_key"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_large_value_references": { + "name": "execution_large_value_references", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "execution_large_value_reference_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "execution_large_value_references_workspace_execution_source_idx": { + "name": "execution_large_value_references_workspace_execution_source_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_value_references_workflow_id_idx": { + "name": "execution_large_value_references_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_large_value_references_workspace_id_workspace_id_fk": { + "name": "execution_large_value_references_workspace_id_workspace_id_fk", + "tableFrom": "execution_large_value_references", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "execution_large_value_references_workflow_id_workflow_id_fk": { + "name": "execution_large_value_references_workflow_id_workflow_id_fk", + "tableFrom": "execution_large_value_references", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "execution_large_value_references_key_execution_id_source_pk": { + "name": "execution_large_value_references_key_execution_id_source_pk", + "columns": ["key", "execution_id", "source"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_large_values": { + "name": "execution_large_values", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_execution_id": { + "name": "owner_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "execution_large_values_owner_execution_id_idx": { + "name": "execution_large_values_owner_execution_id_idx", + "columns": [ + { + "expression": "owner_execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_values_cleanup_idx": { + "name": "execution_large_values_cleanup_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"execution_large_values\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_values_tombstone_cleanup_idx": { + "name": "execution_large_values_tombstone_cleanup_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"execution_large_values\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_values_workflow_id_idx": { + "name": "execution_large_values_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_large_values_workspace_id_workspace_id_fk": { + "name": "execution_large_values_workspace_id_workspace_id_fk", + "tableFrom": "execution_large_values", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "execution_large_values_workflow_id_workflow_id_fk": { + "name": "execution_large_values_workflow_id_workflow_id_fk", + "tableFrom": "execution_large_values", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.folder": { + "name": "folder", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "folder_resource_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_id": { + "name": "parent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "locked": { + "name": "locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "folder_user_idx": { + "name": "folder_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_workspace_resource_parent_idx": { + "name": "folder_workspace_resource_parent_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_parent_sort_idx": { + "name": "folder_parent_sort_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_deleted_at_idx": { + "name": "folder_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_workspace_deleted_partial_idx": { + "name": "folder_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"folder\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_workspace_resource_parent_name_active_unique": { + "name": "folder_workspace_resource_parent_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"parent_id\", '')", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"folder\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "folder_user_id_user_id_fk": { + "name": "folder_user_id_user_id_fk", + "tableFrom": "folder", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "folder_workspace_id_workspace_id_fk": { + "name": "folder_workspace_id_workspace_id_fk", + "tableFrom": "folder", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "folder_parent_id_folder_id_fk": { + "name": "folder_parent_id_folder_id_fk", + "tableFrom": "folder", + "tableTo": "folder", + "columnsFrom": ["parent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.idempotency_key": { + "name": "idempotency_key", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "result": { + "name": "result", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idempotency_key_created_at_idx": { + "name": "idempotency_key_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.invitation": { + "name": "invitation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "invitation_kind", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'organization'" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inviter_id": { + "name": "inviter_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "membership_intent": { + "name": "membership_intent", + "type": "invitation_membership_intent", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'internal'" + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "invitation_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "invitation_email_idx": { + "name": "invitation_email_idx", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_organization_id_idx": { + "name": "invitation_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_status_idx": { + "name": "invitation_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_pending_email_org_unique": { + "name": "invitation_pending_email_org_unique", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"invitation\".\"status\" = 'pending' AND \"invitation\".\"organization_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "invitation_inviter_id_user_id_fk": { + "name": "invitation_inviter_id_user_id_fk", + "tableFrom": "invitation", + "tableTo": "user", + "columnsFrom": ["inviter_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "invitation_organization_id_organization_id_fk": { + "name": "invitation_organization_id_organization_id_fk", + "tableFrom": "invitation", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "invitation_token_unique": { + "name": "invitation_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.invitation_workspace_grant": { + "name": "invitation_workspace_grant", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "invitation_id": { + "name": "invitation_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "permission_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "invitation_workspace_grant_unique": { + "name": "invitation_workspace_grant_unique", + "columns": [ + { + "expression": "invitation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_workspace_grant_workspace_id_idx": { + "name": "invitation_workspace_grant_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "invitation_workspace_grant_invitation_id_invitation_id_fk": { + "name": "invitation_workspace_grant_invitation_id_invitation_id_fk", + "tableFrom": "invitation_workspace_grant", + "tableTo": "invitation", + "columnsFrom": ["invitation_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "invitation_workspace_grant_workspace_id_workspace_id_fk": { + "name": "invitation_workspace_grant_workspace_id_workspace_id_fk", + "tableFrom": "invitation_workspace_grant", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_execution_logs": { + "name": "job_execution_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "schedule_id": { + "name": "schedule_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "level": { + "name": "level", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'running'" + }, + "trigger": { + "name": "trigger", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "total_duration_ms": { + "name": "total_duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "execution_data": { + "name": "execution_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "cost": { + "name": "cost", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "job_execution_logs_schedule_id_idx": { + "name": "job_execution_logs_schedule_id_idx", + "columns": [ + { + "expression": "schedule_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_workspace_started_at_idx": { + "name": "job_execution_logs_workspace_started_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_workspace_ended_at_id_idx": { + "name": "job_execution_logs_workspace_ended_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"ended_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_execution_id_unique": { + "name": "job_execution_logs_execution_id_unique", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_trigger_idx": { + "name": "job_execution_logs_trigger_idx", + "columns": [ + { + "expression": "trigger", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_execution_logs_schedule_id_workflow_schedule_id_fk": { + "name": "job_execution_logs_schedule_id_workflow_schedule_id_fk", + "tableFrom": "job_execution_logs", + "tableTo": "workflow_schedule", + "columnsFrom": ["schedule_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "job_execution_logs_workspace_id_workspace_id_fk": { + "name": "job_execution_logs_workspace_id_workspace_id_fk", + "tableFrom": "job_execution_logs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_base": { + "name": "knowledge_base", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "embedding_model": { + "name": "embedding_model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text-embedding-3-small'" + }, + "embedding_dimension": { + "name": "embedding_dimension", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1536 + }, + "chunking_config": { + "name": "chunking_config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{\"maxSize\": 1024, \"minSize\": 1, \"overlap\": 200}'" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "kb_user_id_idx": { + "name": "kb_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_workspace_id_idx": { + "name": "kb_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_user_workspace_idx": { + "name": "kb_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_folder_id_idx": { + "name": "kb_folder_id_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_deleted_at_idx": { + "name": "kb_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_workspace_deleted_partial_idx": { + "name": "kb_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_base\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_workspace_name_active_unique": { + "name": "kb_workspace_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"knowledge_base\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_base_user_id_user_id_fk": { + "name": "knowledge_base_user_id_user_id_fk", + "tableFrom": "knowledge_base", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_base_workspace_id_workspace_id_fk": { + "name": "knowledge_base_workspace_id_workspace_id_fk", + "tableFrom": "knowledge_base", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_base_folder_id_folder_id_fk": { + "name": "knowledge_base_folder_id_folder_id_fk", + "tableFrom": "knowledge_base", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_base_tag_definitions": { + "name": "knowledge_base_tag_definitions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_slot": { + "name": "tag_slot", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "field_type": { + "name": "field_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "kb_tag_definitions_kb_slot_idx": { + "name": "kb_tag_definitions_kb_slot_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_slot", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_tag_definitions_kb_display_name_idx": { + "name": "kb_tag_definitions_kb_display_name_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "display_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_tag_definitions_kb_id_idx": { + "name": "kb_tag_definitions_kb_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_base_tag_definitions_knowledge_base_id_knowledge_base_id_fk": { + "name": "knowledge_base_tag_definitions_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "knowledge_base_tag_definitions", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_connector": { + "name": "knowledge_connector", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "connector_type": { + "name": "connector_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_config": { + "name": "source_config", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "sync_mode": { + "name": "sync_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'full'" + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1440 + }, + "access_mode": { + "name": "access_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'workspace'" + }, + "credential_group_id": { + "name": "credential_group_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_group_option_id": { + "name": "credential_group_option_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_sync_status": { + "name": "member_sync_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'idle'" + }, + "member_sync_lock_token": { + "name": "member_sync_lock_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_sync_lock_lease_at": { + "name": "member_sync_lock_lease_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_member_sync_at": { + "name": "next_member_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_member_sync_at": { + "name": "last_member_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_member_sync_error": { + "name": "last_member_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_sync_consecutive_failures": { + "name": "member_sync_consecutive_failures", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "access_rewrite_pending": { + "name": "access_rewrite_pending", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_sync_doc_count": { + "name": "last_sync_doc_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "consecutive_failures": { + "name": "consecutive_failures", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "sync_lock_token": { + "name": "sync_lock_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sync_lock_lease_at": { + "name": "sync_lock_lease_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "kc_knowledge_base_id_idx": { + "name": "kc_knowledge_base_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_status_next_sync_idx": { + "name": "kc_status_next_sync_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "next_sync_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_archived_at_partial_idx": { + "name": "kc_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_deleted_at_partial_idx": { + "name": "kc_deleted_at_partial_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_member_sync_due_idx": { + "name": "kc_member_sync_due_idx", + "columns": [ + { + "expression": "member_sync_status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "next_member_sync_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector\".\"access_mode\" = 'members' AND \"knowledge_connector\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_knowledge_base_id_knowledge_base_id_fk": { + "name": "knowledge_connector_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "knowledge_connector", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_connector_credential_group_id_credential_group_id_fk": { + "name": "knowledge_connector_credential_group_id_credential_group_id_fk", + "tableFrom": "knowledge_connector", + "tableTo": "credential_group", + "columnsFrom": ["credential_group_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "kc_access_mode_check": { + "name": "kc_access_mode_check", + "value": "\"knowledge_connector\".\"access_mode\" IN ('workspace', 'members', 'admin')" + }, + "kc_member_sync_status_check": { + "name": "kc_member_sync_status_check", + "value": "\"knowledge_connector\".\"member_sync_status\" IN ('idle', 'pending', 'running', 'error', 'disabled')" + }, + "kc_sync_lock_exclusive_check": { + "name": "kc_sync_lock_exclusive_check", + "value": "NOT (\"knowledge_connector\".\"sync_lock_token\" IS NOT NULL AND \"knowledge_connector\".\"member_sync_lock_token\" IS NOT NULL)" + } + }, + "isRLSEnabled": false + }, + "public.knowledge_connector_member": { + "name": "knowledge_connector_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "subject_token": { + "name": "subject_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "consecutive_failures": { + "name": "consecutive_failures", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "next_attempt_at": { + "name": "next_attempt_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_started_at": { + "name": "last_started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_complete_listing_at": { + "name": "last_complete_listing_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_listed_count": { + "name": "last_listed_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_synced_through": { + "name": "member_synced_through", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "change_cursor": { + "name": "change_cursor", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "suspended_at": { + "name": "suspended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "kcm_connector_credential_unique": { + "name": "kcm_connector_credential_unique", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcm_connector_queue_idx": { + "name": "kcm_connector_queue_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "next_attempt_at", + "isExpression": false, + "asc": true, + "nulls": "first" + }, + { + "expression": "last_started_at", + "isExpression": false, + "asc": true, + "nulls": "first" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcm_credential_idx": { + "name": "kcm_credential_idx", + "columns": [ + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_member_workspace_id_workspace_id_fk": { + "name": "knowledge_connector_member_workspace_id_workspace_id_fk", + "tableFrom": "knowledge_connector_member", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_connector_member_connector_id_knowledge_connector_id_fk": { + "name": "knowledge_connector_member_connector_id_knowledge_connector_id_fk", + "tableFrom": "knowledge_connector_member", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_connector_member_credential_id_credential_id_fk": { + "name": "knowledge_connector_member_credential_id_credential_id_fk", + "tableFrom": "knowledge_connector_member", + "tableTo": "credential", + "columnsFrom": ["credential_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "kcm_status_check": { + "name": "kcm_status_check", + "value": "\"knowledge_connector_member\".\"status\" IN ('active', 'suspended', 'disabled')" + }, + "kcm_subject_token_shape_check": { + "name": "kcm_subject_token_shape_check", + "value": "\"knowledge_connector_member\".\"subject_token\" ~ '^s:[^:]+:[^:]+:.+$'" + } + }, + "isRLSEnabled": false + }, + "public.knowledge_connector_member_sync_log": { + "name": "knowledge_connector_member_sync_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "members_claimed": { + "name": "members_claimed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "members_completed": { + "name": "members_completed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "members_incomplete": { + "name": "members_incomplete", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "members_failed": { + "name": "members_failed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_listed": { + "name": "docs_listed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_added": { + "name": "docs_added", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_updated": { + "name": "docs_updated", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_unchanged": { + "name": "docs_unchanged", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_hydrated_once": { + "name": "docs_hydrated_once", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "observations_added": { + "name": "observations_added", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "observations_removed": { + "name": "observations_removed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_tombstoned": { + "name": "docs_tombstoned", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_resurrected": { + "name": "docs_resurrected", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_purged": { + "name": "docs_purged", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "credentials_audited": { + "name": "credentials_audited", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "kcmsl_connector_started_at_idx": { + "name": "kcmsl_connector_started_at_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"started_at\" DESC", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcmsl_started_at_partial_idx": { + "name": "kcmsl_started_at_partial_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector_member_sync_log\".\"status\" = 'started'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_member_sync_log_connector_id_knowledge_connector_id_fk": { + "name": "knowledge_connector_member_sync_log_connector_id_knowledge_connector_id_fk", + "tableFrom": "knowledge_connector_member_sync_log", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "kcmsl_status_check": { + "name": "kcmsl_status_check", + "value": "\"knowledge_connector_member_sync_log\".\"status\" IN ('started', 'completed', 'failed')" + } + }, + "isRLSEnabled": false + }, + "public.knowledge_connector_sync_log": { + "name": "knowledge_connector_sync_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "docs_added": { + "name": "docs_added", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_updated": { + "name": "docs_updated", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_deleted": { + "name": "docs_deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_unchanged": { + "name": "docs_unchanged", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_skipped": { + "name": "docs_skipped", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_failed": { + "name": "docs_failed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "kcsl_connector_started_at_idx": { + "name": "kcsl_connector_started_at_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"started_at\" DESC", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcsl_started_at_partial_idx": { + "name": "kcsl_started_at_partial_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector_sync_log\".\"status\" = 'started'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_sync_log_connector_id_knowledge_connector_id_fk": { + "name": "knowledge_connector_sync_log_connector_id_knowledge_connector_id_fk", + "tableFrom": "knowledge_connector_sync_log", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_document_observation": { + "name": "knowledge_document_observation", + "schema": "", + "columns": { + "document_id": { + "name": "document_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "member_id": { + "name": "member_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "run_id": { + "name": "run_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "kdo_member_idx": { + "name": "kdo_member_idx", + "columns": [ + { + "expression": "member_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_document_observation_document_id_document_id_fk": { + "name": "knowledge_document_observation_document_id_document_id_fk", + "tableFrom": "knowledge_document_observation", + "tableTo": "document", + "columnsFrom": ["document_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_document_observation_member_id_knowledge_connector_member_id_fk": { + "name": "knowledge_document_observation_member_id_knowledge_connector_member_id_fk", + "tableFrom": "knowledge_document_observation", + "tableTo": "knowledge_connector_member", + "columnsFrom": ["member_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "knowledge_document_observation_document_id_member_id_pk": { + "name": "knowledge_document_observation_document_id_member_id_pk", + "columns": ["document_id", "member_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mcp_server_oauth": { + "name": "mcp_server_oauth", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "mcp_server_id": { + "name": "mcp_server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_information": { + "name": "client_information", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tokens": { + "name": "tokens", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "code_verifier": { + "name": "code_verifier", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state_created_at": { + "name": "state_created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_refreshed_at": { + "name": "last_refreshed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "mcp_server_oauth_server_unique": { + "name": "mcp_server_oauth_server_unique", + "columns": [ + { + "expression": "mcp_server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_server_oauth_state_idx": { + "name": "mcp_server_oauth_state_idx", + "columns": [ + { + "expression": "state", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mcp_server_oauth_mcp_server_id_mcp_servers_id_fk": { + "name": "mcp_server_oauth_mcp_server_id_mcp_servers_id_fk", + "tableFrom": "mcp_server_oauth", + "tableTo": "mcp_servers", + "columnsFrom": ["mcp_server_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mcp_server_oauth_user_id_user_id_fk": { + "name": "mcp_server_oauth_user_id_user_id_fk", + "tableFrom": "mcp_server_oauth", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "mcp_server_oauth_workspace_id_workspace_id_fk": { + "name": "mcp_server_oauth_workspace_id_workspace_id_fk", + "tableFrom": "mcp_server_oauth", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mcp_servers": { + "name": "mcp_servers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_group_id": { + "name": "credential_group_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "managed_connector_id": { + "name": "managed_connector_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "transport": { + "name": "transport", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "auth_type": { + "name": "auth_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'headers'" + }, + "oauth_client_id": { + "name": "oauth_client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "oauth_client_secret": { + "name": "oauth_client_secret", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "headers": { + "name": "headers", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "timeout": { + "name": "timeout", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30000 + }, + "retries": { + "name": "retries", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "last_connected": { + "name": "last_connected", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "connection_status": { + "name": "connection_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'disconnected'" + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status_config": { + "name": "status_config", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "tool_count": { + "name": "tool_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_tools_refresh": { + "name": "last_tools_refresh", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "total_requests": { + "name": "total_requests", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_used": { + "name": "last_used", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "mcp_servers_workspace_enabled_idx": { + "name": "mcp_servers_workspace_enabled_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_servers_credential_group_idx": { + "name": "mcp_servers_credential_group_idx", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_servers_credential_group_managed_connector_unique": { + "name": "mcp_servers_credential_group_managed_connector_unique", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "managed_connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"mcp_servers\".\"credential_group_id\" IS NOT NULL AND \"mcp_servers\".\"managed_connector_id\" IS NOT NULL AND \"mcp_servers\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_servers_workspace_deleted_partial_idx": { + "name": "mcp_servers_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"mcp_servers\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mcp_servers_workspace_id_workspace_id_fk": { + "name": "mcp_servers_workspace_id_workspace_id_fk", + "tableFrom": "mcp_servers", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mcp_servers_credential_group_id_credential_group_id_fk": { + "name": "mcp_servers_credential_group_id_credential_group_id_fk", + "tableFrom": "mcp_servers", + "tableTo": "credential_group", + "columnsFrom": ["credential_group_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "mcp_servers_created_by_user_id_fk": { + "name": "mcp_servers_created_by_user_id_fk", + "tableFrom": "mcp_servers", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "mcp_servers_credential_group_managed_connector_check": { + "name": "mcp_servers_credential_group_managed_connector_check", + "value": "\"mcp_servers\".\"credential_group_id\" IS NULL OR \"mcp_servers\".\"managed_connector_id\" IS NOT NULL" + }, + "mcp_servers_managed_connector_oauth_check": { + "name": "mcp_servers_managed_connector_oauth_check", + "value": "\"mcp_servers\".\"managed_connector_id\" IS NULL OR \"mcp_servers\".\"auth_type\" = 'oauth'" + } + }, + "isRLSEnabled": false + }, + "public.member": { + "name": "member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "member_user_id_unique": { + "name": "member_user_id_unique", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "member_organization_id_idx": { + "name": "member_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "member_user_id_user_id_fk": { + "name": "member_user_id_user_id_fk", + "tableFrom": "member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "member_organization_id_organization_id_fk": { + "name": "member_organization_id_organization_id_fk", + "tableFrom": "member", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.memory": { + "name": "memory", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "memory_key_idx": { + "name": "memory_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "memory_workspace_idx": { + "name": "memory_workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "memory_workspace_key_idx": { + "name": "memory_workspace_key_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "memory_workspace_deleted_partial_idx": { + "name": "memory_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"memory\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "memory_workspace_id_workspace_id_fk": { + "name": "memory_workspace_id_workspace_id_fk", + "tableFrom": "memory", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.memory_secret_provenance": { + "name": "memory_secret_provenance", + "schema": "", + "columns": { + "memory_id": { + "name": "memory_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "memory_secret_provenance_memory_id_memory_id_fk": { + "name": "memory_secret_provenance_memory_id_memory_id_fk", + "tableFrom": "memory_secret_provenance", + "tableTo": "memory", + "columnsFrom": ["memory_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "memory_secret_provenance_status_check": { + "name": "memory_secret_provenance_status_check", + "value": "\"memory_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.mothership_inbox_allowed_sender": { + "name": "mothership_inbox_allowed_sender", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "added_by": { + "name": "added_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "inbox_sender_ws_email_idx": { + "name": "inbox_sender_ws_email_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mothership_inbox_allowed_sender_workspace_id_workspace_id_fk": { + "name": "mothership_inbox_allowed_sender_workspace_id_workspace_id_fk", + "tableFrom": "mothership_inbox_allowed_sender", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mothership_inbox_allowed_sender_added_by_user_id_fk": { + "name": "mothership_inbox_allowed_sender_added_by_user_id_fk", + "tableFrom": "mothership_inbox_allowed_sender", + "tableTo": "user", + "columnsFrom": ["added_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mothership_inbox_task": { + "name": "mothership_inbox_task", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "from_email": { + "name": "from_email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "from_name": { + "name": "from_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "subject": { + "name": "subject", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "body_preview": { + "name": "body_preview", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "body_text": { + "name": "body_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "body_html": { + "name": "body_html", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_message_id": { + "name": "email_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "in_reply_to": { + "name": "in_reply_to", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "response_message_id": { + "name": "response_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "agentmail_message_id": { + "name": "agentmail_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'received'" + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "trigger_job_id": { + "name": "trigger_job_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "result_summary": { + "name": "result_summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "has_attachments": { + "name": "has_attachments", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cc_recipients": { + "name": "cc_recipients", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "processing_started_at": { + "name": "processing_started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "inbox_task_ws_created_at_idx": { + "name": "inbox_task_ws_created_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "inbox_task_ws_status_idx": { + "name": "inbox_task_ws_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "inbox_task_response_msg_id_idx": { + "name": "inbox_task_response_msg_id_idx", + "columns": [ + { + "expression": "response_message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "inbox_task_email_msg_id_idx": { + "name": "inbox_task_email_msg_id_idx", + "columns": [ + { + "expression": "email_message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mothership_inbox_task_workspace_id_workspace_id_fk": { + "name": "mothership_inbox_task_workspace_id_workspace_id_fk", + "tableFrom": "mothership_inbox_task", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mothership_inbox_task_chat_id_copilot_chats_id_fk": { + "name": "mothership_inbox_task_chat_id_copilot_chats_id_fk", + "tableFrom": "mothership_inbox_task", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mothership_inbox_webhook": { + "name": "mothership_inbox_webhook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "webhook_id": { + "name": "webhook_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "mothership_inbox_webhook_workspace_id_workspace_id_fk": { + "name": "mothership_inbox_webhook_workspace_id_workspace_id_fk", + "tableFrom": "mothership_inbox_webhook", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "mothership_inbox_webhook_workspace_id_unique": { + "name": "mothership_inbox_webhook_workspace_id_unique", + "nullsNotDistinct": false, + "columns": ["workspace_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mothership_settings": { + "name": "mothership_settings", + "schema": "", + "columns": { + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "mcp_tool_refs": { + "name": "mcp_tool_refs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "custom_tool_refs": { + "name": "custom_tool_refs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "skill_refs": { + "name": "skill_refs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "mothership_settings_workspace_id_workspace_id_fk": { + "name": "mothership_settings_workspace_id_workspace_id_fk", + "tableFrom": "mothership_settings", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.oauth_access_token": { + "name": "oauth_access_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_id": { + "name": "refresh_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "text[]", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "oauth_access_token_client_id_idx": { + "name": "oauth_access_token_client_id_idx", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_access_token_session_id_idx": { + "name": "oauth_access_token_session_id_idx", + "columns": [ + { + "expression": "session_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_access_token_refresh_id_idx": { + "name": "oauth_access_token_refresh_id_idx", + "columns": [ + { + "expression": "refresh_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_access_token_user_client_idx": { + "name": "oauth_access_token_user_client_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_access_token_expires_at_idx": { + "name": "oauth_access_token_expires_at_idx", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "oauth_access_token_client_id_oauth_client_client_id_fk": { + "name": "oauth_access_token_client_id_oauth_client_client_id_fk", + "tableFrom": "oauth_access_token", + "tableTo": "oauth_client", + "columnsFrom": ["client_id"], + "columnsTo": ["client_id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "oauth_access_token_session_id_session_id_fk": { + "name": "oauth_access_token_session_id_session_id_fk", + "tableFrom": "oauth_access_token", + "tableTo": "session", + "columnsFrom": ["session_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "oauth_access_token_user_id_user_id_fk": { + "name": "oauth_access_token_user_id_user_id_fk", + "tableFrom": "oauth_access_token", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "oauth_access_token_refresh_id_oauth_refresh_token_id_fk": { + "name": "oauth_access_token_refresh_id_oauth_refresh_token_id_fk", + "tableFrom": "oauth_access_token", + "tableTo": "oauth_refresh_token", + "columnsFrom": ["refresh_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "oauth_access_token_token_unique": { + "name": "oauth_access_token_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.oauth_client": { + "name": "oauth_client", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_secret": { + "name": "client_secret", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "disabled": { + "name": "disabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "skip_consent": { + "name": "skip_consent", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "enable_end_session": { + "name": "enable_end_session", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "subject_type": { + "name": "subject_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scopes": { + "name": "scopes", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contacts": { + "name": "contacts", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "tos": { + "name": "tos", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "policy": { + "name": "policy", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "software_id": { + "name": "software_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "software_version": { + "name": "software_version", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "software_statement": { + "name": "software_statement", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "redirect_uris": { + "name": "redirect_uris", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "post_logout_redirect_uris": { + "name": "post_logout_redirect_uris", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "token_endpoint_auth_method": { + "name": "token_endpoint_auth_method", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "grant_types": { + "name": "grant_types", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "response_types": { + "name": "response_types", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "public": { + "name": "public", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "require_pkce": { + "name": "require_pkce", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "oauth_client_user_id_idx": { + "name": "oauth_client_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "oauth_client_user_id_user_id_fk": { + "name": "oauth_client_user_id_user_id_fk", + "tableFrom": "oauth_client", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "oauth_client_client_id_unique": { + "name": "oauth_client_client_id_unique", + "nullsNotDistinct": false, + "columns": ["client_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.oauth_consent": { + "name": "oauth_consent", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scopes": { + "name": "scopes", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "oauth_consent_client_id_idx": { + "name": "oauth_consent_client_id_idx", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "oauth_consent_client_id_oauth_client_client_id_fk": { + "name": "oauth_consent_client_id_oauth_client_client_id_fk", + "tableFrom": "oauth_consent", + "tableTo": "oauth_client", + "columnsFrom": ["client_id"], + "columnsTo": ["client_id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "oauth_consent_user_id_user_id_fk": { + "name": "oauth_consent_user_id_user_id_fk", + "tableFrom": "oauth_consent", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "oauth_consent_user_client_reference_unique": { + "name": "oauth_consent_user_client_reference_unique", + "nullsNotDistinct": true, + "columns": ["user_id", "client_id", "reference_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.oauth_refresh_token": { + "name": "oauth_refresh_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "revoked": { + "name": "revoked", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "auth_time": { + "name": "auth_time", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scopes": { + "name": "scopes", + "type": "text[]", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "oauth_refresh_token_client_id_idx": { + "name": "oauth_refresh_token_client_id_idx", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_refresh_token_session_id_idx": { + "name": "oauth_refresh_token_session_id_idx", + "columns": [ + { + "expression": "session_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_refresh_token_user_client_idx": { + "name": "oauth_refresh_token_user_client_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_refresh_token_expires_at_idx": { + "name": "oauth_refresh_token_expires_at_idx", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "oauth_refresh_token_client_id_oauth_client_client_id_fk": { + "name": "oauth_refresh_token_client_id_oauth_client_client_id_fk", + "tableFrom": "oauth_refresh_token", + "tableTo": "oauth_client", + "columnsFrom": ["client_id"], + "columnsTo": ["client_id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "oauth_refresh_token_session_id_session_id_fk": { + "name": "oauth_refresh_token_session_id_session_id_fk", + "tableFrom": "oauth_refresh_token", + "tableTo": "session", + "columnsFrom": ["session_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "oauth_refresh_token_user_id_user_id_fk": { + "name": "oauth_refresh_token_user_id_user_id_fk", + "tableFrom": "oauth_refresh_token", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "oauth_refresh_token_token_unique": { + "name": "oauth_refresh_token_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization": { + "name": "organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "session_policy_settings": { + "name": "session_policy_settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "security_policy_version": { + "name": "security_policy_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "whitelabel_settings": { + "name": "whitelabel_settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "data_retention_settings": { + "name": "data_retention_settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "org_usage_limit": { + "name": "org_usage_limit", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "storage_used_bytes": { + "name": "storage_used_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "limit_notifications": { + "name": "limit_notifications", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "departed_member_usage": { + "name": "departed_member_usage", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "credit_balance": { + "name": "credit_balance", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_byok_keys": { + "name": "organization_byok_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "organization_byok_organization_provider_idx": { + "name": "organization_byok_organization_provider_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_byok_keys_organization_id_organization_id_fk": { + "name": "organization_byok_keys_organization_id_organization_id_fk", + "tableFrom": "organization_byok_keys", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_byok_keys_created_by_user_id_fk": { + "name": "organization_byok_keys_created_by_user_id_fk", + "tableFrom": "organization_byok_keys", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_member_usage_limit": { + "name": "organization_member_usage_limit", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "usage_limit": { + "name": "usage_limit", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "set_by": { + "name": "set_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "org_member_usage_limit_org_user_unique": { + "name": "org_member_usage_limit_org_user_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "org_member_usage_limit_organization_id_idx": { + "name": "org_member_usage_limit_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_member_usage_limit_organization_id_organization_id_fk": { + "name": "organization_member_usage_limit_organization_id_organization_id_fk", + "tableFrom": "organization_member_usage_limit", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_member_usage_limit_user_id_user_id_fk": { + "name": "organization_member_usage_limit_user_id_user_id_fk", + "tableFrom": "organization_member_usage_limit", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_member_usage_limit_set_by_user_id_fk": { + "name": "organization_member_usage_limit_set_by_user_id_fk", + "tableFrom": "organization_member_usage_limit", + "tableTo": "user", + "columnsFrom": ["set_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.outbox_event": { + "name": "outbox_event", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "max_attempts": { + "name": "max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 10 + }, + "available_at": { + "name": "available_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "locked_at": { + "name": "locked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "processed_at": { + "name": "processed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "outbox_event_status_available_idx": { + "name": "outbox_event_status_available_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "available_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "outbox_event_locked_at_idx": { + "name": "outbox_event_locked_at_idx", + "columns": [ + { + "expression": "locked_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "outbox_event_type_created_idx": { + "name": "outbox_event_type_created_idx", + "columns": [ + { + "expression": "event_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.paused_executions": { + "name": "paused_executions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_snapshot": { + "name": "execution_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "pause_points": { + "name": "pause_points", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "total_pause_count": { + "name": "total_pause_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "resumed_count": { + "name": "resumed_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "automatic_resume_retry_count": { + "name": "automatic_resume_retry_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'paused'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "paused_at": { + "name": "paused_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_resume_at": { + "name": "next_resume_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "paused_executions_workflow_id_idx": { + "name": "paused_executions_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "paused_executions_status_idx": { + "name": "paused_executions_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "paused_executions_execution_id_unique": { + "name": "paused_executions_execution_id_unique", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "paused_executions_next_resume_at_idx": { + "name": "paused_executions_next_resume_at_idx", + "columns": [ + { + "expression": "next_resume_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "status = 'paused' AND next_resume_at IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "paused_executions_workflow_id_workflow_id_fk": { + "name": "paused_executions_workflow_id_workflow_id_fk", + "tableFrom": "paused_executions", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pending_credential_draft": { + "name": "pending_credential_draft", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "pending_draft_user_provider_ws": { + "name": "pending_draft_user_provider_ws", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "pending_credential_draft_user_id_user_id_fk": { + "name": "pending_credential_draft_user_id_user_id_fk", + "tableFrom": "pending_credential_draft", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pending_credential_draft_workspace_id_workspace_id_fk": { + "name": "pending_credential_draft_workspace_id_workspace_id_fk", + "tableFrom": "pending_credential_draft", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pending_credential_draft_credential_id_credential_id_fk": { + "name": "pending_credential_draft_credential_id_credential_id_fk", + "tableFrom": "pending_credential_draft", + "tableTo": "credential", + "columnsFrom": ["credential_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permission_group": { + "name": "permission_group", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "permission_group_created_by_idx": { + "name": "permission_group_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_organization_name_unique": { + "name": "permission_group_organization_name_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_organization_default_unique": { + "name": "permission_group_organization_default_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "is_default = true", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permission_group_organization_id_organization_id_fk": { + "name": "permission_group_organization_id_organization_id_fk", + "tableFrom": "permission_group", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_created_by_user_id_fk": { + "name": "permission_group_created_by_user_id_fk", + "tableFrom": "permission_group", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permission_group_member": { + "name": "permission_group_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "permission_group_id": { + "name": "permission_group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "assigned_by": { + "name": "assigned_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "assigned_at": { + "name": "assigned_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "permission_group_member_group_id_idx": { + "name": "permission_group_member_group_id_idx", + "columns": [ + { + "expression": "permission_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_member_group_user_unique": { + "name": "permission_group_member_group_user_unique", + "columns": [ + { + "expression": "permission_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_member_organization_user_idx": { + "name": "permission_group_member_organization_user_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permission_group_member_permission_group_id_permission_group_id_fk": { + "name": "permission_group_member_permission_group_id_permission_group_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "permission_group", + "columnsFrom": ["permission_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_member_organization_id_organization_id_fk": { + "name": "permission_group_member_organization_id_organization_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_member_user_id_user_id_fk": { + "name": "permission_group_member_user_id_user_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_member_assigned_by_user_id_fk": { + "name": "permission_group_member_assigned_by_user_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "user", + "columnsFrom": ["assigned_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permission_group_workspace": { + "name": "permission_group_workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "permission_group_id": { + "name": "permission_group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "permission_group_workspace_workspace_id_idx": { + "name": "permission_group_workspace_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_workspace_group_workspace_unique": { + "name": "permission_group_workspace_group_workspace_unique", + "columns": [ + { + "expression": "permission_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permission_group_workspace_permission_group_id_permission_group_id_fk": { + "name": "permission_group_workspace_permission_group_id_permission_group_id_fk", + "tableFrom": "permission_group_workspace", + "tableTo": "permission_group", + "columnsFrom": ["permission_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_workspace_workspace_id_workspace_id_fk": { + "name": "permission_group_workspace_workspace_id_workspace_id_fk", + "tableFrom": "permission_group_workspace", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_workspace_organization_id_organization_id_fk": { + "name": "permission_group_workspace_organization_id_organization_id_fk", + "tableFrom": "permission_group_workspace", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission_type": { + "name": "permission_type", + "type": "permission_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "permissions_user_id_idx": { + "name": "permissions_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_entity_idx": { + "name": "permissions_entity_idx", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_user_entity_type_idx": { + "name": "permissions_user_entity_type_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_user_entity_permission_idx": { + "name": "permissions_user_entity_permission_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "permission_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_unique_constraint": { + "name": "permissions_unique_constraint", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permissions_user_id_user_id_fk": { + "name": "permissions_user_id_user_id_fk", + "tableFrom": "permissions", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pinned_item": { + "name": "pinned_item", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pinned_at": { + "name": "pinned_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "pinned_item_user_workspace_idx": { + "name": "pinned_item_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "pinned_item_resource_idx": { + "name": "pinned_item_resource_idx", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "pinned_item_user_resource_unique": { + "name": "pinned_item_user_resource_unique", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "pinned_item_user_id_user_id_fk": { + "name": "pinned_item_user_id_user_id_fk", + "tableFrom": "pinned_item", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pinned_item_workspace_id_workspace_id_fk": { + "name": "pinned_item_workspace_id_workspace_id_fk", + "tableFrom": "pinned_item", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.public_share": { + "name": "public_share", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "auth_type": { + "name": "auth_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'public'" + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "allowed_emails": { + "name": "allowed_emails", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "public_share_token_unique": { + "name": "public_share_token_unique", + "columns": [ + { + "expression": "token", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "public_share_resource_unique": { + "name": "public_share_resource_unique", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "public_share_resource_id_idx": { + "name": "public_share_resource_id_idx", + "columns": [ + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "public_share_workspace_id_idx": { + "name": "public_share_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "public_share_workspace_id_workspace_id_fk": { + "name": "public_share_workspace_id_workspace_id_fk", + "tableFrom": "public_share", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "public_share_created_by_user_id_fk": { + "name": "public_share_created_by_user_id_fk", + "tableFrom": "public_share", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rate_limit_bucket": { + "name": "rate_limit_bucket", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "tokens": { + "name": "tokens", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "last_refill_at": { + "name": "last_refill_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_policy": { + "name": "resource_policy", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "document": { + "name": "document", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "resource_policy_resource_unique": { + "name": "resource_policy_resource_unique", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resource_policy_workspace_id_idx": { + "name": "resource_policy_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_policy_workspace_id_workspace_id_fk": { + "name": "resource_policy_workspace_id_workspace_id_fk", + "tableFrom": "resource_policy", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "resource_policy_created_by_user_id_fk": { + "name": "resource_policy_created_by_user_id_fk", + "tableFrom": "resource_policy", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "resource_policy_updated_by_user_id_fk": { + "name": "resource_policy_updated_by_user_id_fk", + "tableFrom": "resource_policy", + "tableTo": "user", + "columnsFrom": ["updated_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resume_queue": { + "name": "resume_queue", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "paused_execution_id": { + "name": "paused_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_execution_id": { + "name": "parent_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "new_execution_id": { + "name": "new_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "context_id": { + "name": "context_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resume_input": { + "name": "resume_input", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "queued_at": { + "name": "queued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "claimed_at": { + "name": "claimed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "failure_reason": { + "name": "failure_reason", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "resume_queue_parent_status_idx": { + "name": "resume_queue_parent_status_idx", + "columns": [ + { + "expression": "parent_execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "queued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resume_queue_new_execution_idx": { + "name": "resume_queue_new_execution_idx", + "columns": [ + { + "expression": "new_execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resume_queue_paused_execution_id_paused_executions_id_fk": { + "name": "resume_queue_paused_execution_id_paused_executions_id_fk", + "tableFrom": "resume_queue", + "tableTo": "paused_executions", + "columnsFrom": ["paused_execution_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sandbox_image": { + "name": "sandbox_image", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "spec_hash": { + "name": "spec_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "spec": { + "name": "spec", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "sandbox_image_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "image_ref": { + "name": "image_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_image_id": { + "name": "provider_image_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "build_id": { + "name": "build_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "materialization_generation": { + "name": "materialization_generation", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "error_code": { + "name": "error_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_detail": { + "name": "error_detail", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "sandbox_image_provider_spec_unique": { + "name": "sandbox_image_provider_spec_unique", + "columns": [ + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "spec_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sandbox_image_status_idx": { + "name": "sandbox_image_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sandbox_image_last_used_idx": { + "name": "sandbox_image_last_used_idx", + "columns": [ + { + "expression": "last_used_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.secret_usage": { + "name": "secret_usage", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret_name": { + "name": "secret_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret_scope": { + "name": "secret_scope", + "type": "secret_usage_scope", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "secret_owner_user_id": { + "name": "secret_owner_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "source": { + "name": "source", + "type": "secret_usage_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "actor_user_id": { + "name": "actor_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "usage_date": { + "name": "usage_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "use_count": { + "name": "use_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "last_execution_id": { + "name": "last_execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_trigger": { + "name": "last_trigger", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "secret_usage_bucket_unique": { + "name": "secret_usage_bucket_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_scope", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "actor_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "usage_date", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "secret_usage_secret_recent_idx": { + "name": "secret_usage_secret_recent_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_scope", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_used_at", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "secret_usage_workspace_id_workspace_id_fk": { + "name": "secret_usage_workspace_id_workspace_id_fk", + "tableFrom": "secret_usage", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "active_organization_id": { + "name": "active_organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "impersonated_by": { + "name": "impersonated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "session_user_id_idx": { + "name": "session_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "session_active_organization_id_organization_id_fk": { + "name": "session_active_organization_id_organization_id_fk", + "tableFrom": "session", + "tableTo": "organization", + "columnsFrom": ["active_organization_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.settings": { + "name": "settings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "theme": { + "name": "theme", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'system'" + }, + "auto_connect": { + "name": "auto_connect", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "telemetry_enabled": { + "name": "telemetry_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "email_preferences": { + "name": "email_preferences", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "billing_usage_notifications_enabled": { + "name": "billing_usage_notifications_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "show_training_controls": { + "name": "show_training_controls", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "super_user_mode_enabled": { + "name": "super_user_mode_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "mothership_environment": { + "name": "mothership_environment", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'default'" + }, + "error_notifications_enabled": { + "name": "error_notifications_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "snap_to_grid_size": { + "name": "snap_to_grid_size", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "show_action_bar": { + "name": "show_action_bar", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "auto_focus_on_click": { + "name": "auto_focus_on_click", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "copilot_enabled_models": { + "name": "copilot_enabled_models", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "copilot_auto_allowed_tools": { + "name": "copilot_auto_allowed_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "last_active_workspace_id": { + "name": "last_active_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "settings_user_id_user_id_fk": { + "name": "settings_user_id_user_id_fk", + "tableFrom": "settings", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "settings_user_id_unique": { + "name": "settings_user_id_unique", + "nullsNotDistinct": false, + "columns": ["user_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sim_trigger_state": { + "name": "sim_trigger_state", + "schema": "", + "columns": { + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "block_id": { + "name": "block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope_key": { + "name": "scope_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "last_fired_at": { + "name": "last_fired_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "sim_trigger_state_workflow_id_workflow_id_fk": { + "name": "sim_trigger_state_workflow_id_workflow_id_fk", + "tableFrom": "sim_trigger_state", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "sim_trigger_state_workflow_id_block_id_scope_key_pk": { + "name": "sim_trigger_state_workflow_id_block_id_scope_key_pk", + "columns": ["workflow_id", "block_id", "scope_key"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.skill": { + "name": "skill", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "skill_workspace_name_unique": { + "name": "skill_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "skill_workspace_id_workspace_id_fk": { + "name": "skill_workspace_id_workspace_id_fk", + "tableFrom": "skill", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "skill_user_id_user_id_fk": { + "name": "skill_user_id_user_id_fk", + "tableFrom": "skill", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.skill_member": { + "name": "skill_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "skill_id": { + "name": "skill_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invited_by": { + "name": "invited_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "skill_member_user_id_idx": { + "name": "skill_member_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "skill_member_unique": { + "name": "skill_member_unique", + "columns": [ + { + "expression": "skill_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "skill_member_skill_id_skill_id_fk": { + "name": "skill_member_skill_id_skill_id_fk", + "tableFrom": "skill_member", + "tableTo": "skill", + "columnsFrom": ["skill_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "skill_member_user_id_user_id_fk": { + "name": "skill_member_user_id_user_id_fk", + "tableFrom": "skill_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "skill_member_invited_by_user_id_fk": { + "name": "skill_member_invited_by_user_id_fk", + "tableFrom": "skill_member", + "tableTo": "user", + "columnsFrom": ["invited_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sso_domain": { + "name": "sso_domain", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "verification_token": { + "name": "verification_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "verified_at": { + "name": "verified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "sso_domain_organization_id_idx": { + "name": "sso_domain_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_domain_domain_idx": { + "name": "sso_domain_domain_idx", + "columns": [ + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_domain_org_domain_unique": { + "name": "sso_domain_org_domain_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_domain_verified_unique": { + "name": "sso_domain_verified_unique", + "columns": [ + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "status = 'verified'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sso_domain_organization_id_organization_id_fk": { + "name": "sso_domain_organization_id_organization_id_fk", + "tableFrom": "sso_domain", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "sso_domain_created_by_user_id_fk": { + "name": "sso_domain_created_by_user_id_fk", + "tableFrom": "sso_domain", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sso_provider": { + "name": "sso_provider", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "issuer": { + "name": "issuer", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "oidc_config": { + "name": "oidc_config", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "saml_config": { + "name": "saml_config", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "domain_verified": { + "name": "domain_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "jit_provisioning_enabled": { + "name": "jit_provisioning_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": { + "sso_provider_provider_id_unique": { + "name": "sso_provider_provider_id_unique", + "columns": [ + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_provider_domain_idx": { + "name": "sso_provider_domain_idx", + "columns": [ + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_provider_user_id_idx": { + "name": "sso_provider_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_provider_organization_id_idx": { + "name": "sso_provider_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sso_provider_user_id_user_id_fk": { + "name": "sso_provider_user_id_user_id_fk", + "tableFrom": "sso_provider", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "sso_provider_organization_id_organization_id_fk": { + "name": "sso_provider_organization_id_organization_id_fk", + "tableFrom": "sso_provider", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.subscription": { + "name": "subscription", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "plan": { + "name": "plan", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_subscription_id": { + "name": "stripe_subscription_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "period_start": { + "name": "period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "period_end": { + "name": "period_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "cancel_at_period_end": { + "name": "cancel_at_period_end", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cancel_at": { + "name": "cancel_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "canceled_at": { + "name": "canceled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "seats": { + "name": "seats", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "trial_start": { + "name": "trial_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "trial_end": { + "name": "trial_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "billing_interval": { + "name": "billing_interval", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_schedule_id": { + "name": "stripe_schedule_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "last_closed_period_start": { + "name": "last_closed_period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "subscription_reference_status_idx": { + "name": "subscription_reference_status_idx", + "columns": [ + { + "expression": "reference_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "subscription_cycle_close_lagging_idx": { + "name": "subscription_cycle_close_lagging_idx", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"subscription\".\"status\" in ('active', 'past_due') and \"subscription\".\"period_start\" is not null and (\"subscription\".\"last_closed_period_start\" is null or \"subscription\".\"last_closed_period_start\" < \"subscription\".\"period_start\")", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "check_enterprise_metadata": { + "name": "check_enterprise_metadata", + "value": "plan != 'enterprise' OR metadata IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.table_jobs": { + "name": "table_jobs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'running'" + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "rows_processed": { + "name": "rows_processed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "table_jobs_one_active_per_table": { + "name": "table_jobs_one_active_per_table", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"table_jobs\".\"status\" = 'running' AND \"table_jobs\".\"type\" <> 'export'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_jobs_watchdog_idx": { + "name": "table_jobs_watchdog_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_jobs_table_started_idx": { + "name": "table_jobs_table_started_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_jobs_table_id_user_table_definitions_id_fk": { + "name": "table_jobs_table_id_user_table_definitions_id_fk", + "tableFrom": "table_jobs", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_jobs_workspace_id_workspace_id_fk": { + "name": "table_jobs_workspace_id_workspace_id_fk", + "tableFrom": "table_jobs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_row_executions": { + "name": "table_row_executions", + "schema": "", + "columns": { + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "row_id": { + "name": "row_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "group_id": { + "name": "group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "job_id": { + "name": "job_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "running_block_ids": { + "name": "running_block_ids", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'::text[]" + }, + "block_errors": { + "name": "block_errors", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "cancelled_at": { + "name": "cancelled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "capability_governed_user_id": { + "name": "capability_governed_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enrichment_details": { + "name": "enrichment_details", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "table_row_executions_table_status_idx": { + "name": "table_row_executions_table_status_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"table_row_executions\".\"status\" IN ('queued', 'running', 'pending')", + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_row_executions_execution_id_idx": { + "name": "table_row_executions_execution_id_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"table_row_executions\".\"execution_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_row_executions_table_group_idx": { + "name": "table_row_executions_table_group_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_row_executions_table_id_user_table_definitions_id_fk": { + "name": "table_row_executions_table_id_user_table_definitions_id_fk", + "tableFrom": "table_row_executions", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_row_executions_row_id_user_table_rows_id_fk": { + "name": "table_row_executions_row_id_user_table_rows_id_fk", + "tableFrom": "table_row_executions", + "tableTo": "user_table_rows", + "columnsFrom": ["row_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_row_executions_capability_governed_user_id_user_id_fk": { + "name": "table_row_executions_capability_governed_user_id_user_id_fk", + "tableFrom": "table_row_executions", + "tableTo": "user", + "columnsFrom": ["capability_governed_user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "table_row_executions_row_id_group_id_pk": { + "name": "table_row_executions_row_id_group_id_pk", + "columns": ["row_id", "group_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_run_dispatches": { + "name": "table_run_dispatches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "request_id": { + "name": "request_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "mode": { + "name": "mode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "cursor": { + "name": "cursor", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "limit": { + "name": "limit", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "processed_count": { + "name": "processed_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "is_manual_run": { + "name": "is_manual_run", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "triggered_by_user_id": { + "name": "triggered_by_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "capability_governed_user_id": { + "name": "capability_governed_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "heartbeat_at": { + "name": "heartbeat_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "cancelled_at": { + "name": "cancelled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "table_run_dispatches_active_idx": { + "name": "table_run_dispatches_active_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_run_dispatches_watchdog_idx": { + "name": "table_run_dispatches_watchdog_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "requested_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_run_dispatches_governed_active_idx": { + "name": "table_run_dispatches_governed_active_idx", + "columns": [ + { + "expression": "capability_governed_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"table_run_dispatches\".\"status\" IN ('pending', 'dispatching')", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_run_dispatches_table_id_user_table_definitions_id_fk": { + "name": "table_run_dispatches_table_id_user_table_definitions_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_run_dispatches_workspace_id_workspace_id_fk": { + "name": "table_run_dispatches_workspace_id_workspace_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_run_dispatches_triggered_by_user_id_user_id_fk": { + "name": "table_run_dispatches_triggered_by_user_id_user_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "user", + "columnsFrom": ["triggered_by_user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "table_run_dispatches_capability_governed_user_id_user_id_fk": { + "name": "table_run_dispatches_capability_governed_user_id_user_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "user", + "columnsFrom": ["capability_governed_user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_views": { + "name": "table_views", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "table_views_table_created_idx": { + "name": "table_views_table_created_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_views_workspace_created_idx": { + "name": "table_views_workspace_created_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_views_table_default_unique": { + "name": "table_views_table_default_unique", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "is_default = true", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_views_table_id_user_table_definitions_id_fk": { + "name": "table_views_table_id_user_table_definitions_id_fk", + "tableFrom": "table_views", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_views_workspace_id_workspace_id_fk": { + "name": "table_views_workspace_id_workspace_id_fk", + "tableFrom": "table_views", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_views_created_by_user_id_fk": { + "name": "table_views_created_by_user_id_fk", + "tableFrom": "table_views", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.upload_session": { + "name": "upload_session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "purpose": { + "name": "purpose", + "type": "upload_session_purpose", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "method": { + "name": "method", + "type": "upload_session_method", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "storage_context": { + "name": "storage_context", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "final_key": { + "name": "final_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "storage_provider": { + "name": "storage_provider", + "type": "upload_session_provider", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "provider_upload_id": { + "name": "provider_upload_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_object_version": { + "name": "provider_object_version", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "part_size": { + "name": "part_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "part_count": { + "name": "part_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "upload_session_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'uploading'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "processing_lease_id": { + "name": "processing_lease_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "processing_lease_expires_at": { + "name": "processing_lease_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_file_id": { + "name": "completed_file_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "upload_session_token_hash_unique": { + "name": "upload_session_token_hash_unique", + "columns": [ + { + "expression": "token_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "upload_session_final_key_unique": { + "name": "upload_session_final_key_unique", + "columns": [ + { + "expression": "final_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "upload_session_status_expires_at_idx": { + "name": "upload_session_status_expires_at_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.usage_log": { + "name": "usage_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "category": { + "name": "category", + "type": "usage_log_category", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "usage_log_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "cost": { + "name": "cost", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "event_key": { + "name": "event_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "billing_entity_type": { + "name": "billing_entity_type", + "type": "billing_entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "billing_entity_id": { + "name": "billing_entity_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "billing_period_start": { + "name": "billing_period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "billing_period_end": { + "name": "billing_period_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "usage_log_user_created_at_idx": { + "name": "usage_log_user_created_at_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_source_idx": { + "name": "usage_log_source_idx", + "columns": [ + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_workspace_id_idx": { + "name": "usage_log_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_workflow_id_idx": { + "name": "usage_log_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_event_key_unique": { + "name": "usage_log_event_key_unique", + "columns": [ + { + "expression": "event_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"usage_log\".\"event_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_billing_entity_period_idx": { + "name": "usage_log_billing_entity_period_idx", + "columns": [ + { + "expression": "billing_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_start", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_end", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_billing_period_cost_idx": { + "name": "usage_log_billing_period_cost_idx", + "columns": [ + { + "expression": "billing_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_start", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_end", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "cost", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_billing_entity_created_at_cost_idx": { + "name": "usage_log_billing_entity_created_at_cost_idx", + "columns": [ + { + "expression": "billing_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "cost", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_workspace_created_at_idx": { + "name": "usage_log_workspace_created_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_execution_id_idx": { + "name": "usage_log_execution_id_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "usage_log_user_id_user_id_fk": { + "name": "usage_log_user_id_user_id_fk", + "tableFrom": "usage_log", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "usage_log_workspace_id_workspace_id_fk": { + "name": "usage_log_workspace_id_workspace_id_fk", + "tableFrom": "usage_log", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "usage_log_workflow_id_workflow_id_fk": { + "name": "usage_log_workflow_id_workflow_id_fk", + "tableFrom": "usage_log", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "usage_log_billing_scope_all_or_none": { + "name": "usage_log_billing_scope_all_or_none", + "value": "(\n (\"usage_log\".\"billing_entity_type\" IS NULL AND \"usage_log\".\"billing_entity_id\" IS NULL AND \"usage_log\".\"billing_period_start\" IS NULL AND \"usage_log\".\"billing_period_end\" IS NULL)\n OR\n (\"usage_log\".\"billing_entity_type\" IS NOT NULL AND \"usage_log\".\"billing_entity_id\" IS NOT NULL AND \"usage_log\".\"billing_period_start\" IS NOT NULL AND \"usage_log\".\"billing_period_end\" IS NOT NULL AND \"usage_log\".\"billing_period_start\" < \"usage_log\".\"billing_period_end\")\n )" + } + }, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "normalized_email": { + "name": "normalized_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'user'" + }, + "banned": { + "name": "banned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ban_expires": { + "name": "ban_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + }, + "user_normalized_email_unique": { + "name": "user_normalized_email_unique", + "nullsNotDistinct": false, + "columns": ["normalized_email"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_stats": { + "name": "user_stats", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "total_manual_executions": { + "name": "total_manual_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_api_calls": { + "name": "total_api_calls", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_webhook_triggers": { + "name": "total_webhook_triggers", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_scheduled_executions": { + "name": "total_scheduled_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_chat_executions": { + "name": "total_chat_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_mcp_executions": { + "name": "total_mcp_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tokens_used": { + "name": "total_tokens_used", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_cost": { + "name": "total_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "current_usage_limit": { + "name": "current_usage_limit", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'5'" + }, + "usage_limit_updated_at": { + "name": "usage_limit_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "current_period_cost": { + "name": "current_period_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "last_period_cost": { + "name": "last_period_cost", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "billed_overage_this_period": { + "name": "billed_overage_this_period", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "pro_period_cost_snapshot": { + "name": "pro_period_cost_snapshot", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "pro_period_cost_snapshot_at": { + "name": "pro_period_cost_snapshot_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "credit_balance": { + "name": "credit_balance", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "total_copilot_cost": { + "name": "total_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "current_period_copilot_cost": { + "name": "current_period_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "last_period_copilot_cost": { + "name": "last_period_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_copilot_tokens": { + "name": "total_copilot_tokens", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_copilot_calls": { + "name": "total_copilot_calls", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_mcp_copilot_calls": { + "name": "total_mcp_copilot_calls", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_mcp_copilot_cost": { + "name": "total_mcp_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "current_period_mcp_copilot_cost": { + "name": "current_period_mcp_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "storage_used_bytes": { + "name": "storage_used_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_active": { + "name": "last_active", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "billing_blocked": { + "name": "billing_blocked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "billing_blocked_reason": { + "name": "billing_blocked_reason", + "type": "billing_blocked_reason", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "limit_notifications": { + "name": "limit_notifications", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": { + "user_stats_user_id_user_id_fk": { + "name": "user_stats_user_id_user_id_fk", + "tableFrom": "user_stats", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_stats_user_id_unique": { + "name": "user_stats_user_id_unique", + "nullsNotDistinct": false, + "columns": ["user_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_table_definitions": { + "name": "user_table_definitions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "max_rows": { + "name": "max_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 10000 + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "rows_version": { + "name": "rows_version", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "schema_locked": { + "name": "schema_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "insert_locked": { + "name": "insert_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "update_locked": { + "name": "update_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "delete_locked": { + "name": "delete_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "user_table_def_workspace_id_idx": { + "name": "user_table_def_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_folder_id_idx": { + "name": "user_table_def_folder_id_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_workspace_name_unique": { + "name": "user_table_def_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"user_table_definitions\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_archived_at_idx": { + "name": "user_table_def_archived_at_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_workspace_archived_partial_idx": { + "name": "user_table_def_workspace_archived_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"user_table_definitions\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_table_definitions_workspace_id_workspace_id_fk": { + "name": "user_table_definitions_workspace_id_workspace_id_fk", + "tableFrom": "user_table_definitions", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_table_definitions_folder_id_folder_id_fk": { + "name": "user_table_definitions_folder_id_folder_id_fk", + "tableFrom": "user_table_definitions", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "user_table_definitions_created_by_user_id_fk": { + "name": "user_table_definitions_created_by_user_id_fk", + "tableFrom": "user_table_definitions", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_table_row_secret_provenance": { + "name": "user_table_row_secret_provenance", + "schema": "", + "columns": { + "row_id": { + "name": "row_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_updated_at": { + "name": "content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "user_table_row_secret_provenance_row_id_user_table_rows_id_fk": { + "name": "user_table_row_secret_provenance_row_id_user_table_rows_id_fk", + "tableFrom": "user_table_row_secret_provenance", + "tableTo": "user_table_rows", + "columnsFrom": ["row_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "user_table_row_secret_provenance_status_check": { + "name": "user_table_row_secret_provenance_status_check", + "value": "\"user_table_row_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.user_table_rows": { + "name": "user_table_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "order_key": { + "name": "order_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_table_rows_tenant_data_gin_idx": { + "name": "user_table_rows_tenant_data_gin_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"data\" jsonb_path_ops", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "user_table_rows_workspace_table_idx": { + "name": "user_table_rows_workspace_table_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_position_idx": { + "name": "user_table_rows_table_position_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "position", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_order_key_idx": { + "name": "user_table_rows_table_order_key_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "order_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_created_id_idx": { + "name": "user_table_rows_table_created_id_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_id_id_idx": { + "name": "user_table_rows_table_id_id_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_table_rows_table_id_user_table_definitions_id_fk": { + "name": "user_table_rows_table_id_user_table_definitions_id_fk", + "tableFrom": "user_table_rows", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_table_rows_workspace_id_workspace_id_fk": { + "name": "user_table_rows_workspace_id_workspace_id_fk", + "tableFrom": "user_table_rows", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_table_rows_created_by_user_id_fk": { + "name": "user_table_rows_created_by_user_id_fk", + "tableFrom": "user_table_rows", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "verification_identifier_idx": { + "name": "verification_identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "verification_expires_at_idx": { + "name": "verification_expires_at_idx", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.waitlist": { + "name": "waitlist", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "waitlist_email_unique": { + "name": "waitlist_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.webhook": { + "name": "webhook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "registration_status": { + "name": "registration_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "registration_generation": { + "name": "registration_generation", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "config_fingerprint": { + "name": "config_fingerprint", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prepared_at": { + "name": "prepared_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "block_id": { + "name": "block_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "routing_key": { + "name": "routing_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_config": { + "name": "provider_config", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "failed_count": { + "name": "failed_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_failed_at": { + "name": "last_failed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "path_deployment_unique": { + "name": "path_deployment_unique", + "columns": [ + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"webhook\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_workflow_deployment_idx": { + "name": "webhook_workflow_deployment_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_routing_key_active_idx": { + "name": "webhook_routing_key_active_idx", + "columns": [ + { + "expression": "routing_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"webhook\".\"archived_at\" IS NULL AND \"webhook\".\"routing_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_archived_at_partial_idx": { + "name": "webhook_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"webhook\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_webhook_on_provider_is_active_workflow_id_deploym_bdeed5468": { + "name": "idx_webhook_on_provider_is_active_workflow_id_deploym_bdeed5468", + "columns": [ + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_active", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_webhook_on_workflow_id_block_id_updated_at_desc": { + "name": "idx_webhook_on_workflow_id_block_id_updated_at_desc", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "updated_at", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_active_registration_unique": { + "name": "webhook_active_registration_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"webhook\".\"registration_status\" = 'active' AND \"webhook\".\"block_id\" IS NOT NULL AND \"webhook\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_candidate_registration_unique": { + "name": "webhook_candidate_registration_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"webhook\".\"registration_status\" = 'candidate' AND \"webhook\".\"block_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_registration_status_generation_idx": { + "name": "webhook_registration_status_generation_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "registration_status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "registration_generation", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "webhook_workflow_id_workflow_id_fk": { + "name": "webhook_workflow_id_workflow_id_fk", + "tableFrom": "webhook", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "webhook_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "webhook_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "webhook", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "webhook_registration_status_check": { + "name": "webhook_registration_status_check", + "value": "\"webhook\".\"registration_status\" IS NULL OR \"webhook\".\"registration_status\" IN ('active', 'candidate', 'retired', 'orphaned')" + }, + "webhook_registration_generation_check": { + "name": "webhook_registration_generation_check", + "value": "\"webhook\".\"registration_generation\" IS NULL OR \"webhook\".\"registration_generation\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.webhook_path_claim": { + "name": "webhook_path_claim", + "schema": "", + "columns": { + "path": { + "name": "path", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "generation": { + "name": "generation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "webhook_path_claim_workflow_idx": { + "name": "webhook_path_claim_workflow_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "webhook_path_claim_workflow_id_workflow_id_fk": { + "name": "webhook_path_claim_workflow_id_workflow_id_fk", + "tableFrom": "webhook_path_claim", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "webhook_path_claim_generation_check": { + "name": "webhook_path_claim_generation_check", + "value": "\"webhook_path_claim\".\"generation\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.workflow": { + "name": "workflow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_synced": { + "name": "last_synced", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "is_deployed": { + "name": "is_deployed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deployed_at": { + "name": "deployed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "is_public_api": { + "name": "is_public_api", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "locked": { + "name": "locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "fork_sync_excluded": { + "name": "fork_sync_excluded", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "run_count": { + "name": "run_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_run_at": { + "name": "last_run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "variables": { + "name": "variables", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workflow_user_id_idx": { + "name": "workflow_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_workspace_id_idx": { + "name": "workflow_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_user_workspace_idx": { + "name": "workflow_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_workspace_folder_name_active_unique": { + "name": "workflow_workspace_folder_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"folder_id\", '')", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_folder_sort_idx": { + "name": "workflow_folder_sort_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_active_workspace_sort_idx": { + "name": "workflow_active_workspace_sort_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_archived_at_idx": { + "name": "workflow_archived_at_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_workspace_archived_partial_idx": { + "name": "workflow_workspace_archived_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_user_id_user_id_fk": { + "name": "workflow_user_id_user_id_fk", + "tableFrom": "workflow", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_workspace_id_workspace_id_fk": { + "name": "workflow_workspace_id_workspace_id_fk", + "tableFrom": "workflow", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_folder_id_folder_id_fk": { + "name": "workflow_folder_id_folder_id_fk", + "tableFrom": "workflow", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_blocks": { + "name": "workflow_blocks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "position_x": { + "name": "position_x", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "position_y": { + "name": "position_y", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "horizontal_handles": { + "name": "horizontal_handles", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "is_wide": { + "name": "is_wide", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "advanced_mode": { + "name": "advanced_mode", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "trigger_mode": { + "name": "trigger_mode", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "error_enabled": { + "name": "error_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "retry": { + "name": "retry", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "locked": { + "name": "locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "height": { + "name": "height", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "sub_blocks": { + "name": "sub_blocks", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "outputs": { + "name": "outputs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_blocks_workflow_id_idx": { + "name": "workflow_blocks_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_blocks_type_idx": { + "name": "workflow_blocks_type_idx", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_blocks_workflow_id_workflow_id_fk": { + "name": "workflow_blocks_workflow_id_workflow_id_fk", + "tableFrom": "workflow_blocks", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_checkpoints": { + "name": "workflow_checkpoints", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_state": { + "name": "workflow_state", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_checkpoints_user_id_idx": { + "name": "workflow_checkpoints_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_workflow_id_idx": { + "name": "workflow_checkpoints_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_chat_id_idx": { + "name": "workflow_checkpoints_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_message_id_idx": { + "name": "workflow_checkpoints_message_id_idx", + "columns": [ + { + "expression": "message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_user_workflow_idx": { + "name": "workflow_checkpoints_user_workflow_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_workflow_chat_idx": { + "name": "workflow_checkpoints_workflow_chat_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_created_at_idx": { + "name": "workflow_checkpoints_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_chat_created_at_idx": { + "name": "workflow_checkpoints_chat_created_at_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_checkpoints_user_id_user_id_fk": { + "name": "workflow_checkpoints_user_id_user_id_fk", + "tableFrom": "workflow_checkpoints", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_checkpoints_workflow_id_workflow_id_fk": { + "name": "workflow_checkpoints_workflow_id_workflow_id_fk", + "tableFrom": "workflow_checkpoints", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_checkpoints_chat_id_copilot_chats_id_fk": { + "name": "workflow_checkpoints_chat_id_copilot_chats_id_fk", + "tableFrom": "workflow_checkpoints", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_deployment_operation": { + "name": "workflow_deployment_operation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "previous_active_version_id": { + "name": "previous_active_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "protocol_version": { + "name": "protocol_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "generation": { + "name": "generation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'preparing'" + }, + "component_readiness": { + "name": "component_readiness", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "error_code": { + "name": "error_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "idempotency_key": { + "name": "idempotency_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "request_hash": { + "name": "request_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_deployment_operation_workflow_generation_unique": { + "name": "workflow_deployment_operation_workflow_generation_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "generation", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_idempotency_unique": { + "name": "workflow_deployment_operation_workflow_idempotency_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "idempotency_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_deployment_operation\".\"idempotency_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_in_flight_unique": { + "name": "workflow_deployment_operation_workflow_in_flight_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_deployment_operation\".\"status\" IN ('preparing', 'activating')", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_status_idx": { + "name": "workflow_deployment_operation_workflow_status_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_deployment_version_idx": { + "name": "workflow_deployment_operation_deployment_version_idx", + "columns": [ + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_version_generation_idx": { + "name": "workflow_deployment_operation_workflow_version_generation_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "generation", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_deployment_operation_workflow_id_workflow_id_fk": { + "name": "workflow_deployment_operation_workflow_id_workflow_id_fk", + "tableFrom": "workflow_deployment_operation", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_deployment_operation_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_deployment_operation_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_deployment_operation", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_deployment_operation_previous_active_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_deployment_operation_previous_active_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_deployment_operation", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["previous_active_version_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "workflow_deployment_operation_action_check": { + "name": "workflow_deployment_operation_action_check", + "value": "\"workflow_deployment_operation\".\"action\" IN ('deploy', 'activate')" + }, + "workflow_deployment_operation_status_check": { + "name": "workflow_deployment_operation_status_check", + "value": "\"workflow_deployment_operation\".\"status\" IN ('preparing', 'activating', 'active', 'failed', 'superseded')" + }, + "workflow_deployment_operation_generation_check": { + "name": "workflow_deployment_operation_generation_check", + "value": "\"workflow_deployment_operation\".\"generation\" > 0" + }, + "workflow_deployment_operation_protocol_version_check": { + "name": "workflow_deployment_operation_protocol_version_check", + "value": "\"workflow_deployment_operation\".\"protocol_version\" > 0" + } + }, + "isRLSEnabled": false + }, + "public.workflow_deployment_version": { + "name": "workflow_deployment_version", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workflow_deployment_version_workflow_version_unique": { + "name": "workflow_deployment_version_workflow_version_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "version", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_version_workflow_active_idx": { + "name": "workflow_deployment_version_workflow_active_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_active", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_version_created_at_idx": { + "name": "workflow_deployment_version_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_deployment_version_workflow_id_workflow_id_fk": { + "name": "workflow_deployment_version_workflow_id_workflow_id_fk", + "tableFrom": "workflow_deployment_version", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_edges": { + "name": "workflow_edges", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_block_id": { + "name": "source_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_block_id": { + "name": "target_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_handle": { + "name": "source_handle", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "target_handle": { + "name": "target_handle", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_edges_workflow_id_idx": { + "name": "workflow_edges_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_edges_workflow_source_idx": { + "name": "workflow_edges_workflow_source_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_edges_workflow_target_idx": { + "name": "workflow_edges_workflow_target_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_edges_workflow_id_workflow_id_fk": { + "name": "workflow_edges_workflow_id_workflow_id_fk", + "tableFrom": "workflow_edges", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_edges_source_block_id_workflow_blocks_id_fk": { + "name": "workflow_edges_source_block_id_workflow_blocks_id_fk", + "tableFrom": "workflow_edges", + "tableTo": "workflow_blocks", + "columnsFrom": ["source_block_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_edges_target_block_id_workflow_blocks_id_fk": { + "name": "workflow_edges_target_block_id_workflow_blocks_id_fk", + "tableFrom": "workflow_edges", + "tableTo": "workflow_blocks", + "columnsFrom": ["target_block_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_execution_logs": { + "name": "workflow_execution_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state_snapshot_id": { + "name": "state_snapshot_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "level": { + "name": "level", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'running'" + }, + "trigger": { + "name": "trigger", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "execution_deadline_at": { + "name": "execution_deadline_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "total_duration_ms": { + "name": "total_duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "execution_data": { + "name": "execution_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "cost": { + "name": "cost", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "cost_total": { + "name": "cost_total", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "models_used": { + "name": "models_used", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "files": { + "name": "files", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_execution_logs_workflow_id_idx": { + "name": "workflow_execution_logs_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_state_snapshot_id_idx": { + "name": "workflow_execution_logs_state_snapshot_id_idx", + "columns": [ + { + "expression": "state_snapshot_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_deployment_version_id_idx": { + "name": "workflow_execution_logs_deployment_version_id_idx", + "columns": [ + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_trigger_idx": { + "name": "workflow_execution_logs_trigger_idx", + "columns": [ + { + "expression": "trigger", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_level_idx": { + "name": "workflow_execution_logs_level_idx", + "columns": [ + { + "expression": "level", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_started_at_idx": { + "name": "workflow_execution_logs_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_execution_id_unique": { + "name": "workflow_execution_logs_execution_id_unique", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workflow_started_at_idx": { + "name": "workflow_execution_logs_workflow_started_at_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workspace_started_at_idx": { + "name": "workflow_execution_logs_workspace_started_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workspace_started_at_id_desc_idx": { + "name": "workflow_execution_logs_workspace_started_at_id_desc_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"started_at\" DESC NULLS LAST", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "\"id\" DESC", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workspace_cost_total_idx": { + "name": "workflow_execution_logs_workspace_cost_total_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "cost_total", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_models_used_idx": { + "name": "workflow_execution_logs_models_used_idx", + "columns": [ + { + "expression": "models_used", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "workflow_execution_logs_workspace_ended_at_id_idx": { + "name": "workflow_execution_logs_workspace_ended_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"ended_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_running_started_at_idx": { + "name": "workflow_execution_logs_running_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "status = 'running'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_running_deadline_idx": { + "name": "workflow_execution_logs_running_deadline_idx", + "columns": [ + { + "expression": "execution_deadline_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_execution_logs\".\"status\" = 'running' AND \"workflow_execution_logs\".\"execution_deadline_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_redacting_started_at_idx": { + "name": "workflow_execution_logs_redacting_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "status = 'redacting'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_redacting_deadline_idx": { + "name": "workflow_execution_logs_redacting_deadline_idx", + "columns": [ + { + "expression": "execution_deadline_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_execution_logs\".\"status\" = 'redacting' AND \"workflow_execution_logs\".\"execution_deadline_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_completed_ended_at_idx": { + "name": "workflow_execution_logs_completed_ended_at_idx", + "columns": [ + { + "expression": "ended_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_execution_logs\".\"status\" = 'completed' AND \"workflow_execution_logs\".\"level\" = 'info' AND \"workflow_execution_logs\".\"ended_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_execution_logs_workflow_id_workflow_id_fk": { + "name": "workflow_execution_logs_workflow_id_workflow_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workflow_execution_logs_workspace_id_workspace_id_fk": { + "name": "workflow_execution_logs_workspace_id_workspace_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_execution_logs_state_snapshot_id_workflow_execution_snapshots_id_fk": { + "name": "workflow_execution_logs_state_snapshot_id_workflow_execution_snapshots_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workflow_execution_snapshots", + "columnsFrom": ["state_snapshot_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workflow_execution_logs_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_execution_logs_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_execution_snapshots": { + "name": "workflow_execution_snapshots", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state_hash": { + "name": "state_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state_data": { + "name": "state_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_snapshots_workflow_id_idx": { + "name": "workflow_snapshots_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_snapshots_hash_idx": { + "name": "workflow_snapshots_hash_idx", + "columns": [ + { + "expression": "state_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_snapshots_workflow_hash_idx": { + "name": "workflow_snapshots_workflow_hash_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "state_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_snapshots_created_at_idx": { + "name": "workflow_snapshots_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_execution_snapshots_workflow_id_workflow_id_fk": { + "name": "workflow_execution_snapshots_workflow_id_workflow_id_fk", + "tableFrom": "workflow_execution_snapshots", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_mcp_server": { + "name": "workflow_mcp_server", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_mcp_server_workspace_id_idx": { + "name": "workflow_mcp_server_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_server_created_by_idx": { + "name": "workflow_mcp_server_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_server_deleted_at_idx": { + "name": "workflow_mcp_server_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_server_workspace_deleted_partial_idx": { + "name": "workflow_mcp_server_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_mcp_server\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_mcp_server_workspace_id_workspace_id_fk": { + "name": "workflow_mcp_server_workspace_id_workspace_id_fk", + "tableFrom": "workflow_mcp_server", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_mcp_server_created_by_user_id_fk": { + "name": "workflow_mcp_server_created_by_user_id_fk", + "tableFrom": "workflow_mcp_server", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_mcp_tool": { + "name": "workflow_mcp_tool", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tool_name": { + "name": "tool_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tool_description": { + "name": "tool_description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parameter_schema": { + "name": "parameter_schema", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "parameter_description_overrides": { + "name": "parameter_description_overrides", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'::json" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_mcp_tool_server_id_idx": { + "name": "workflow_mcp_tool_server_id_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_tool_workflow_id_idx": { + "name": "workflow_mcp_tool_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_tool_server_workflow_unique": { + "name": "workflow_mcp_tool_server_workflow_unique", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_mcp_tool\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_tool_archived_at_partial_idx": { + "name": "workflow_mcp_tool_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_mcp_tool\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_mcp_tool_server_id_workflow_mcp_server_id_fk": { + "name": "workflow_mcp_tool_server_id_workflow_mcp_server_id_fk", + "tableFrom": "workflow_mcp_tool", + "tableTo": "workflow_mcp_server", + "columnsFrom": ["server_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_mcp_tool_workflow_id_workflow_id_fk": { + "name": "workflow_mcp_tool_workflow_id_workflow_id_fk", + "tableFrom": "workflow_mcp_tool", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_schedule": { + "name": "workflow_schedule", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deployment_operation_id": { + "name": "deployment_operation_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "block_id": { + "name": "block_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cron_expression": { + "name": "cron_expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "next_run_at": { + "name": "next_run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_ran_at": { + "name": "last_ran_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_queued_at": { + "name": "last_queued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "trigger_type": { + "name": "trigger_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'UTC'" + }, + "failed_count": { + "name": "failed_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "infra_retry_count": { + "name": "infra_retry_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "last_failed_at": { + "name": "last_failed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "source_type": { + "name": "source_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'workflow'" + }, + "job_title": { + "name": "job_title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prompt": { + "name": "prompt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lifecycle": { + "name": "lifecycle", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'persistent'" + }, + "success_condition": { + "name": "success_condition", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "max_runs": { + "name": "max_runs", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "run_count": { + "name": "run_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "source_chat_id": { + "name": "source_chat_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_task_name": { + "name": "source_task_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_user_id": { + "name": "source_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_workspace_id": { + "name": "source_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_scope": { + "name": "secret_scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "mounted_secrets": { + "name": "mounted_secrets", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "job_history": { + "name": "job_history", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "contexts": { + "name": "contexts", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "excluded_dates": { + "name": "excluded_dates", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "ends_at": { + "name": "ends_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_schedule_workflow_block_deployment_unique": { + "name": "workflow_schedule_workflow_block_deployment_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_schedule\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_workflow_deployment_idx": { + "name": "workflow_schedule_workflow_deployment_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_archived_at_partial_idx": { + "name": "workflow_schedule_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_schedule\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_schedule_on_source_workspace_id_source_t_c07f3bba6": { + "name": "idx_workflow_schedule_on_source_workspace_id_source_t_c07f3bba6", + "columns": [ + { + "expression": "source_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_due_workflow_idx": { + "name": "workflow_schedule_due_workflow_idx", + "columns": [ + { + "expression": "next_run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_queued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_schedule\".\"archived_at\" IS NULL AND \"workflow_schedule\".\"status\" NOT IN ('disabled', 'completed') AND (\"workflow_schedule\".\"source_type\" = 'workflow' OR \"workflow_schedule\".\"source_type\" IS NULL)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_due_job_idx": { + "name": "workflow_schedule_due_job_idx", + "columns": [ + { + "expression": "next_run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_queued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_schedule\".\"archived_at\" IS NULL AND \"workflow_schedule\".\"status\" NOT IN ('disabled', 'completed') AND \"workflow_schedule\".\"source_type\" = 'job'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_schedule_workflow_id_workflow_id_fk": { + "name": "workflow_schedule_workflow_id_workflow_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_schedule_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_schedule_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_schedule_deployment_operation_id_workflow_deployment_operation_id_fk": { + "name": "workflow_schedule_deployment_operation_id_workflow_deployment_operation_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workflow_deployment_operation", + "columnsFrom": ["deployment_operation_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workflow_schedule_source_user_id_user_id_fk": { + "name": "workflow_schedule_source_user_id_user_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "user", + "columnsFrom": ["source_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_schedule_source_workspace_id_workspace_id_fk": { + "name": "workflow_schedule_source_workspace_id_workspace_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workspace", + "columnsFrom": ["source_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_subflows": { + "name": "workflow_subflows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_subflows_workflow_id_idx": { + "name": "workflow_subflows_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_subflows_workflow_type_idx": { + "name": "workflow_subflows_workflow_type_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_subflows_workflow_id_workflow_id_fk": { + "name": "workflow_subflows_workflow_id_workflow_id_fk", + "tableFrom": "workflow_subflows", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace": { + "name": "workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'#33C482'" + }, + "logo_url": { + "name": "logo_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_mode": { + "name": "workspace_mode", + "type": "workspace_mode", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'grandfathered_shared'" + }, + "billed_account_user_id": { + "name": "billed_account_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "storage_used_bytes": { + "name": "storage_used_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "allow_personal_api_keys": { + "name": "allow_personal_api_keys", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "inbox_enabled": { + "name": "inbox_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "inbox_address": { + "name": "inbox_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inbox_provider_id": { + "name": "inbox_provider_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inbox_secret_scope": { + "name": "inbox_secret_scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "inbox_mounted_secrets": { + "name": "inbox_mounted_secrets", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "organization_assigned_at": { + "name": "organization_assigned_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forked_from_workspace_id": { + "name": "forked_from_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_owner_id_idx": { + "name": "workspace_owner_id_idx", + "columns": [ + { + "expression": "owner_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_organization_id_idx": { + "name": "workspace_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_mode_idx": { + "name": "workspace_mode_idx", + "columns": [ + { + "expression": "workspace_mode", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_forked_from_workspace_id_idx": { + "name": "workspace_forked_from_workspace_id_idx", + "columns": [ + { + "expression": "forked_from_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_inbox_provider_id_idx": { + "name": "workspace_inbox_provider_id_idx", + "columns": [ + { + "expression": "inbox_provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace\".\"inbox_provider_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_owner_id_user_id_fk": { + "name": "workspace_owner_id_user_id_fk", + "tableFrom": "workspace", + "tableTo": "user", + "columnsFrom": ["owner_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_organization_id_organization_id_fk": { + "name": "workspace_organization_id_organization_id_fk", + "tableFrom": "workspace", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_billed_account_user_id_user_id_fk": { + "name": "workspace_billed_account_user_id_user_id_fk", + "tableFrom": "workspace", + "tableTo": "user", + "columnsFrom": ["billed_account_user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workspace_forked_from_workspace_id_workspace_id_fk": { + "name": "workspace_forked_from_workspace_id_workspace_id_fk", + "tableFrom": "workspace", + "tableTo": "workspace", + "columnsFrom": ["forked_from_workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "workspace_storage_used_bytes_non_negative": { + "name": "workspace_storage_used_bytes_non_negative", + "value": "\"workspace\".\"storage_used_bytes\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.workspace_byok_keys": { + "name": "workspace_byok_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_byok_workspace_provider_idx": { + "name": "workspace_byok_workspace_provider_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_byok_keys_workspace_id_workspace_id_fk": { + "name": "workspace_byok_keys_workspace_id_workspace_id_fk", + "tableFrom": "workspace_byok_keys", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_byok_keys_created_by_user_id_fk": { + "name": "workspace_byok_keys_created_by_user_id_fk", + "tableFrom": "workspace_byok_keys", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_environment": { + "name": "workspace_environment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "variables": { + "name": "variables", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_environment_workspace_unique": { + "name": "workspace_environment_workspace_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_environment_workspace_id_workspace_id_fk": { + "name": "workspace_environment_workspace_id_workspace_id_fk", + "tableFrom": "workspace_environment", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file": { + "name": "workspace_file", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_file_workspace_id_idx": { + "name": "workspace_file_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_deleted_at_idx": { + "name": "workspace_file_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_workspace_deleted_partial_idx": { + "name": "workspace_file_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_file\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_workspace_id_workspace_id_fk": { + "name": "workspace_file_workspace_id_workspace_id_fk", + "tableFrom": "workspace_file", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_file_uploaded_by_user_id_fk": { + "name": "workspace_file_uploaded_by_user_id_fk", + "tableFrom": "workspace_file", + "tableTo": "user", + "columnsFrom": ["uploaded_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_file_key_unique": { + "name": "workspace_file_key_unique", + "nullsNotDistinct": false, + "columns": ["key"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_collab_state": { + "name": "workspace_file_collab_state", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "doc_state": { + "name": "doc_state", + "type": "bytea", + "primaryKey": false, + "notNull": true + }, + "source_hash": { + "name": "source_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_file_collab_state_file_id_workspace_files_id_fk": { + "name": "workspace_file_collab_state_file_id_workspace_files_id_fk", + "tableFrom": "workspace_file_collab_state", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_backfill": { + "name": "workspace_file_search_backfill", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "after_workspace_id": { + "name": "after_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "after_file_id": { + "name": "after_file_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_dispatch_queue": { + "name": "workspace_file_search_dispatch_queue", + "schema": "", + "columns": { + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "enqueued_at": { + "name": "enqueued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_dispatched_at": { + "name": "last_dispatched_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_file_search_dispatch_queue_schedule_idx": { + "name": "workspace_file_search_dispatch_queue_schedule_idx", + "columns": [ + { + "expression": "last_dispatched_at", + "isExpression": false, + "asc": true, + "nulls": "first" + }, + { + "expression": "enqueued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_search_queue_workspace_fk": { + "name": "workspace_file_search_queue_workspace_fk", + "tableFrom": "workspace_file_search_dispatch_queue", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_index": { + "name": "workspace_file_search_index", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_content_updated_at": { + "name": "source_content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "workspace_file_search_index_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "partial": { + "name": "partial", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "failure_reason": { + "name": "failure_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "line_count": { + "name": "line_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "indexed_bytes": { + "name": "indexed_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "dispatched_at": { + "name": "dispatched_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_file_search_index_workspace_status_idx": { + "name": "workspace_file_search_index_workspace_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_content_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_search_index_pending_dispatch_idx": { + "name": "workspace_file_search_index_pending_dispatch_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "file_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_content_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_file_search_index\".\"status\" = 'pending' AND \"workspace_file_search_index\".\"dispatched_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_search_index_active_dispatch_idx": { + "name": "workspace_file_search_index_active_dispatch_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "dispatched_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_file_search_index\".\"status\" = 'pending' AND \"workspace_file_search_index\".\"dispatched_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_search_index_file_fk": { + "name": "workspace_file_search_index_file_fk", + "tableFrom": "workspace_file_search_index", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_file_search_index_workspace_fk": { + "name": "workspace_file_search_index_workspace_fk", + "tableFrom": "workspace_file_search_index", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "workspace_file_search_index_pk": { + "name": "workspace_file_search_index_pk", + "columns": ["file_id", "source_content_updated_at"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_segment": { + "name": "workspace_file_search_segment", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_content_updated_at": { + "name": "source_content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "line_number": { + "name": "line_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "segment_number": { + "name": "segment_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "segment_start": { + "name": "segment_start", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "line_length": { + "name": "line_length", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "workspace_file_search_segment_workspace_revision_idx": { + "name": "workspace_file_search_segment_workspace_revision_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "file_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_content_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_search_segment_workspace_content_trgm_idx": { + "name": "workspace_file_search_segment_workspace_content_trgm_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "text_ops" + }, + { + "expression": "content", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "gin_trgm_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_search_segment_file_fk": { + "name": "workspace_file_search_segment_file_fk", + "tableFrom": "workspace_file_search_segment", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_file_search_segment_workspace_fk": { + "name": "workspace_file_search_segment_workspace_fk", + "tableFrom": "workspace_file_search_segment", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "workspace_file_search_segment_pk": { + "name": "workspace_file_search_segment_pk", + "columns": ["file_id", "source_content_updated_at", "line_number", "segment_number"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_secret_provenance": { + "name": "workspace_file_secret_provenance", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_updated_at": { + "name": "content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_file_secret_provenance_file_id_workspace_files_id_fk": { + "name": "workspace_file_secret_provenance_file_id_workspace_files_id_fk", + "tableFrom": "workspace_file_secret_provenance", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "workspace_file_secret_provenance_status_check": { + "name": "workspace_file_secret_provenance_status_check", + "value": "\"workspace_file_secret_provenance\".\"status\" IN ('exact', 'unknown', 'unrecorded')" + } + }, + "isRLSEnabled": false + }, + "public.workspace_files": { + "name": "workspace_files", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "context": { + "name": "context", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "original_name": { + "name": "original_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "size_bytes": { + "name": "size_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "content_updated_at": { + "name": "content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workspace_files_key_active_unique": { + "name": "workspace_files_key_active_unique", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace_files\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_workspace_folder_name_active_unique": { + "name": "workspace_files_workspace_folder_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"folder_id\", '')", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "original_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_chat_display_name_unique": { + "name": "workspace_files_chat_display_name_unique", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "display_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace_files\".\"context\" = 'mothership' AND \"workspace_files\".\"chat_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_key_idx": { + "name": "workspace_files_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_user_id_idx": { + "name": "workspace_files_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_workspace_id_idx": { + "name": "workspace_files_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_folder_id_idx": { + "name": "workspace_files_folder_id_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_context_idx": { + "name": "workspace_files_context_idx", + "columns": [ + { + "expression": "context", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_chat_id_idx": { + "name": "workspace_files_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_deleted_at_idx": { + "name": "workspace_files_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_workspace_deleted_partial_idx": { + "name": "workspace_files_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_files\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_files_user_id_user_id_fk": { + "name": "workspace_files_user_id_user_id_fk", + "tableFrom": "workspace_files", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_files_workspace_id_workspace_id_fk": { + "name": "workspace_files_workspace_id_workspace_id_fk", + "tableFrom": "workspace_files", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_files_folder_id_folder_id_fk": { + "name": "workspace_files_folder_id_folder_id_fk", + "tableFrom": "workspace_files", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_files_chat_id_copilot_chats_id_fk": { + "name": "workspace_files_chat_id_copilot_chats_id_fk", + "tableFrom": "workspace_files", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_block_map": { + "name": "workspace_fork_block_map", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_workflow_id": { + "name": "parent_workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_block_id": { + "name": "parent_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_workflow_id": { + "name": "child_workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_block_id": { + "name": "child_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_block_map_child_ws_parent_unique": { + "name": "workspace_fork_block_map_child_ws_parent_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_block_map_child_ws_child_unique": { + "name": "workspace_fork_block_map_child_ws_child_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "child_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_block_map_child_ws_parent_wf_idx": { + "name": "workspace_fork_block_map_child_ws_parent_wf_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_block_map_child_ws_child_wf_idx": { + "name": "workspace_fork_block_map_child_ws_child_wf_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "child_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_block_map_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_block_map_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_block_map", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_dependent_value": { + "name": "workspace_fork_dependent_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_workflow_id": { + "name": "target_workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_block_id": { + "name": "target_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sub_block_key": { + "name": "sub_block_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_dependent_value_child_ws_wf_idx": { + "name": "workspace_fork_dependent_value_child_ws_wf_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_dependent_value_field_unique": { + "name": "workspace_fork_dependent_value_field_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sub_block_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_dependent_value_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_dependent_value_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_dependent_value", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_promote_run": { + "name": "workspace_fork_promote_run", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_workspace_id": { + "name": "source_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_workspace_id": { + "name": "target_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "direction": { + "name": "direction", + "type": "workspace_fork_promote_direction", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "snapshot": { + "name": "snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_promote_run_child_ws_target_unique": { + "name": "workspace_fork_promote_run_child_ws_target_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_promote_run_target_ws_idx": { + "name": "workspace_fork_promote_run_target_ws_idx", + "columns": [ + { + "expression": "target_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_promote_run_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_promote_run_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_promote_run", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_fork_promote_run_created_by_user_id_fk": { + "name": "workspace_fork_promote_run_created_by_user_id_fk", + "tableFrom": "workspace_fork_promote_run", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_resource_map": { + "name": "workspace_fork_resource_map", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "workspace_fork_resource_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "parent_resource_id": { + "name": "parent_resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_resource_id": { + "name": "child_resource_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_resource_map_child_ws_idx": { + "name": "workspace_fork_resource_map_child_ws_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_resource_map_child_ws_type_idx": { + "name": "workspace_fork_resource_map_child_ws_type_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_resource_map_child_type_parent_unique": { + "name": "workspace_fork_resource_map_child_type_parent_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_resource_map_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_resource_map_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_resource_map", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_fork_resource_map_created_by_user_id_fk": { + "name": "workspace_fork_resource_map_created_by_user_id_fk", + "tableFrom": "workspace_fork_resource_map", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_sandbox": { + "name": "workspace_sandbox", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "language": { + "name": "language", + "type": "sandbox_language", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "dependencies": { + "name": "dependencies", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "cli_tools": { + "name": "cli_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "system_packages": { + "name": "system_packages", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "spec_hash": { + "name": "spec_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_sandbox_workspace_name_unique": { + "name": "workspace_sandbox_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_sandbox_workspace_idx": { + "name": "workspace_sandbox_workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_sandbox_spec_hash_idx": { + "name": "workspace_sandbox_spec_hash_idx", + "columns": [ + { + "expression": "spec_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_sandbox_workspace_id_workspace_id_fk": { + "name": "workspace_sandbox_workspace_id_workspace_id_fk", + "tableFrom": "workspace_sandbox", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_sandbox_created_by_user_id_fk": { + "name": "workspace_sandbox_created_by_user_id_fk", + "tableFrom": "workspace_sandbox", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.academy_cert_status": { + "name": "academy_cert_status", + "schema": "public", + "values": ["active", "revoked", "expired"] + }, + "public.background_work_kind": { + "name": "background_work_kind", + "schema": "public", + "values": ["deployment_side_effects", "fork_content_copy", "fork_sync", "fork_rollback"] + }, + "public.background_work_status_value": { + "name": "background_work_status_value", + "schema": "public", + "values": ["pending", "processing", "completed", "completed_with_warnings", "failed"] + }, + "public.billing_blocked_reason": { + "name": "billing_blocked_reason", + "schema": "public", + "values": ["payment_failed", "dispute"] + }, + "public.billing_entity_type": { + "name": "billing_entity_type", + "schema": "public", + "values": ["user", "organization"] + }, + "public.chat_type": { + "name": "chat_type", + "schema": "public", + "values": ["mothership", "copilot"] + }, + "public.copilot_async_tool_status": { + "name": "copilot_async_tool_status", + "schema": "public", + "values": ["pending", "running", "completed", "failed", "cancelled", "delivered"] + }, + "public.copilot_run_status": { + "name": "copilot_run_status", + "schema": "public", + "values": ["active", "paused_waiting_for_tool", "resuming", "complete", "error", "cancelled"] + }, + "public.copilot_tool_permission_decision": { + "name": "copilot_tool_permission_decision", + "schema": "public", + "values": ["allow", "allow_chat", "always_allow", "skip"] + }, + "public.credential_group_enrollment_status": { + "name": "credential_group_enrollment_status", + "schema": "public", + "values": ["invited", "delivery_failed", "in_progress", "completed", "revoked"] + }, + "public.credential_group_status": { + "name": "credential_group_status", + "schema": "public", + "values": ["active", "disabled"] + }, + "public.credential_member_role": { + "name": "credential_member_role", + "schema": "public", + "values": ["admin", "member"] + }, + "public.credential_member_status": { + "name": "credential_member_status", + "schema": "public", + "values": ["active", "pending", "revoked"] + }, + "public.credential_type": { + "name": "credential_type", + "schema": "public", + "values": [ + "oauth", + "managed_oauth", + "managed_mcp", + "env_workspace", + "env_personal", + "service_account" + ] + }, + "public.data_drain_cadence": { + "name": "data_drain_cadence", + "schema": "public", + "values": ["hourly", "daily"] + }, + "public.data_drain_destination": { + "name": "data_drain_destination", + "schema": "public", + "values": ["s3", "gcs", "azure_blob", "datadog", "bigquery", "snowflake", "webhook"] + }, + "public.data_drain_run_status": { + "name": "data_drain_run_status", + "schema": "public", + "values": ["running", "success", "failed"] + }, + "public.data_drain_run_trigger": { + "name": "data_drain_run_trigger", + "schema": "public", + "values": ["cron", "manual"] + }, + "public.data_drain_source": { + "name": "data_drain_source", + "schema": "public", + "values": ["workflow_logs", "job_logs", "audit_logs", "copilot_chats", "copilot_runs"] + }, + "public.execution_large_value_reference_source": { + "name": "execution_large_value_reference_source", + "schema": "public", + "values": ["execution_log", "paused_snapshot"] + }, + "public.folder_resource_type": { + "name": "folder_resource_type", + "schema": "public", + "values": ["workflow", "file", "knowledge_base", "table"] + }, + "public.invitation_kind": { + "name": "invitation_kind", + "schema": "public", + "values": ["organization", "workspace"] + }, + "public.invitation_membership_intent": { + "name": "invitation_membership_intent", + "schema": "public", + "values": ["internal", "external"] + }, + "public.invitation_status": { + "name": "invitation_status", + "schema": "public", + "values": ["pending", "accepted", "rejected", "cancelled", "expired"] + }, + "public.managed_oauth_credential_status": { + "name": "managed_oauth_credential_status", + "schema": "public", + "values": ["active", "needs_reauth", "revoked"] + }, + "public.permission_type": { + "name": "permission_type", + "schema": "public", + "values": ["admin", "write", "read"] + }, + "public.sandbox_image_status": { + "name": "sandbox_image_status", + "schema": "public", + "values": ["pending", "building", "ready", "failed"] + }, + "public.sandbox_language": { + "name": "sandbox_language", + "schema": "public", + "values": ["javascript", "python"] + }, + "public.secret_usage_scope": { + "name": "secret_usage_scope", + "schema": "public", + "values": ["workspace", "personal"] + }, + "public.secret_usage_source": { + "name": "secret_usage_source", + "schema": "public", + "values": ["workflow", "copilot", "mcp"] + }, + "public.upload_session_method": { + "name": "upload_session_method", + "schema": "public", + "values": ["put", "multipart"] + }, + "public.upload_session_provider": { + "name": "upload_session_provider", + "schema": "public", + "values": ["local", "s3", "blob", "gcs"] + }, + "public.upload_session_purpose": { + "name": "upload_session_purpose", + "schema": "public", + "values": [ + "workspace_file", + "table_import", + "knowledge_document", + "profile_picture", + "workspace_logo", + "mothership_attachment", + "execution_attachment" + ] + }, + "public.upload_session_status": { + "name": "upload_session_status", + "schema": "public", + "values": [ + "uploading", + "completing", + "finalizing", + "completed", + "aborting", + "aborted", + "failed", + "expired" + ] + }, + "public.usage_log_category": { + "name": "usage_log_category", + "schema": "public", + "values": ["model", "fixed", "tool", "model_unbilled"] + }, + "public.usage_log_source": { + "name": "usage_log_source", + "schema": "public", + "values": [ + "workflow", + "wand", + "copilot", + "workspace-chat", + "mcp_copilot", + "mothership_block", + "knowledge-base", + "voice-input", + "enrichment", + "voice-output", + "api-tool" + ] + }, + "public.workspace_file_search_index_status": { + "name": "workspace_file_search_index_status", + "schema": "public", + "values": ["pending", "ready", "skipped", "failed"] + }, + "public.workspace_fork_promote_direction": { + "name": "workspace_fork_promote_direction", + "schema": "public", + "values": ["push", "pull"] + }, + "public.workspace_fork_resource_type": { + "name": "workspace_fork_resource_type", + "schema": "public", + "values": [ + "workflow", + "oauth_credential", + "service_account_credential", + "env_var", + "table", + "knowledge_base", + "knowledge_document", + "file", + "file_folder", + "mcp_server", + "workflow_mcp_server", + "custom_block", + "custom_tool", + "skill" + ] + }, + "public.workspace_mode": { + "name": "workspace_mode", + "schema": "public", + "values": ["personal", "organization", "grandfathered_shared"] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 60137713f9d..92e4fc473d8 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -2241,6 +2241,20 @@ "when": 1788384579773, "tag": "0320_striped_shatterstar", "breakpoints": true + }, + { + "idx": 321, + "version": "7", + "when": 1788545944851, + "tag": "0321_oauth_provider", + "breakpoints": true + }, + { + "idx": 322, + "version": "7", + "when": 1788553150870, + "tag": "0322_oauth_consent_uniqueness", + "breakpoints": true } ] } diff --git a/packages/db/schema.ts b/packages/db/schema.ts index 1edd8fe7394..67b3ee193d6 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -19,6 +19,7 @@ import { primaryKey, text, timestamp, + unique, uniqueIndex, uuid, vector, @@ -3888,6 +3889,146 @@ export const ssoDomain = pgTable( }) ) +/** + * OAuth 2.1 provider tables (Better Auth `@better-auth/oauth-provider`). + * + * Sim is the authorization server: a registered client (the Sim CLI, or an + * admin-created third-party app) sends a user through `/api/auth/oauth2/authorize`, + * the user consents, and the client redeems a code for an opaque access token and + * a rotating refresh token. Tokens are stored hashed; the plaintext exists only in + * the client. Column keys follow the plugin's model fields so the Better Auth + * drizzle adapter maps them without a per-field `fieldName` override. + */ +export const oauthClient = pgTable( + 'oauth_client', + { + id: text('id').primaryKey(), + clientId: text('client_id').notNull().unique(), + clientSecret: text('client_secret'), + disabled: boolean('disabled').notNull().default(false), + skipConsent: boolean('skip_consent'), + enableEndSession: boolean('enable_end_session'), + subjectType: text('subject_type'), + scopes: text('scopes').array(), + userId: text('user_id').references(() => user.id, { onDelete: 'cascade' }), + createdAt: timestamp('created_at'), + updatedAt: timestamp('updated_at'), + name: text('name'), + uri: text('uri'), + icon: text('icon'), + contacts: text('contacts').array(), + tos: text('tos'), + policy: text('policy'), + softwareId: text('software_id'), + softwareVersion: text('software_version'), + softwareStatement: text('software_statement'), + redirectUris: text('redirect_uris').array().notNull(), + postLogoutRedirectUris: text('post_logout_redirect_uris').array(), + tokenEndpointAuthMethod: text('token_endpoint_auth_method'), + grantTypes: text('grant_types').array(), + responseTypes: text('response_types').array(), + public: boolean('public'), + type: text('type'), + requirePKCE: boolean('require_pkce'), + referenceId: text('reference_id'), + metadata: jsonb('metadata'), + }, + (table) => ({ + userIdIdx: index('oauth_client_user_id_idx').on(table.userId), + }) +) + +/** A rotating refresh token; `revoked` is set when it is rotated or revoked. */ +export const oauthRefreshToken = pgTable( + 'oauth_refresh_token', + { + id: text('id').primaryKey(), + token: text('token').notNull().unique(), + clientId: text('client_id') + .notNull() + .references(() => oauthClient.clientId, { onDelete: 'cascade' }), + sessionId: text('session_id').references(() => session.id, { onDelete: 'set null' }), + userId: text('user_id') + .notNull() + .references(() => user.id, { onDelete: 'cascade' }), + referenceId: text('reference_id'), + expiresAt: timestamp('expires_at').notNull(), + createdAt: timestamp('created_at').notNull(), + revoked: timestamp('revoked'), + authTime: timestamp('auth_time'), + scopes: text('scopes').array().notNull(), + }, + (table) => ({ + clientIdIdx: index('oauth_refresh_token_client_id_idx').on(table.clientId), + sessionIdIdx: index('oauth_refresh_token_session_id_idx').on(table.sessionId), + userClientIdx: index('oauth_refresh_token_user_client_idx').on(table.userId, table.clientId), + /** Drives the cleanup pass; nothing else reads tokens by expiry. */ + expiresAtIdx: index('oauth_refresh_token_expires_at_idx').on(table.expiresAt), + }) +) + +/** An opaque access token, looked up by hash on every bearer-authenticated request. */ +export const oauthAccessToken = pgTable( + 'oauth_access_token', + { + id: text('id').primaryKey(), + token: text('token').notNull().unique(), + clientId: text('client_id') + .notNull() + .references(() => oauthClient.clientId, { onDelete: 'cascade' }), + sessionId: text('session_id').references(() => session.id, { onDelete: 'set null' }), + userId: text('user_id').references(() => user.id, { onDelete: 'cascade' }), + referenceId: text('reference_id'), + refreshId: text('refresh_id').references(() => oauthRefreshToken.id, { + onDelete: 'cascade', + }), + expiresAt: timestamp('expires_at').notNull(), + createdAt: timestamp('created_at').notNull(), + scopes: text('scopes').array().notNull(), + }, + (table) => ({ + clientIdIdx: index('oauth_access_token_client_id_idx').on(table.clientId), + sessionIdIdx: index('oauth_access_token_session_id_idx').on(table.sessionId), + refreshIdIdx: index('oauth_access_token_refresh_id_idx').on(table.refreshId), + userClientIdx: index('oauth_access_token_user_client_idx').on(table.userId, table.clientId), + /** Drives the cleanup pass; nothing else reads tokens by expiry. */ + expiresAtIdx: index('oauth_access_token_expires_at_idx').on(table.expiresAt), + }) +) + +/** The scopes a user has granted a client; deleted when the user revokes the app. */ +export const oauthConsent = pgTable( + 'oauth_consent', + { + id: text('id').primaryKey(), + clientId: text('client_id') + .notNull() + .references(() => oauthClient.clientId, { onDelete: 'cascade' }), + userId: text('user_id').references(() => user.id, { onDelete: 'cascade' }), + referenceId: text('reference_id'), + scopes: text('scopes').array().notNull(), + createdAt: timestamp('created_at').notNull(), + updatedAt: timestamp('updated_at').notNull(), + }, + (table) => ({ + clientIdIdx: index('oauth_consent_client_id_idx').on(table.clientId), + /** + * One grant per (user, client, reference). The plugin records consent with + * a non-atomic read-then-create, so two concurrent authorizations for the + * same pair would otherwise write two rows — the app would appear twice in + * Authorized apps, and the narrower of the two scope sets could win the + * next lookup, re-prompting on every login. + * + * `nullsNotDistinct` because both `user_id` and `reference_id` are + * nullable, and Postgres treats NULLs as distinct by default — which would + * let exactly the duplicates this exists to prevent through. + */ + userClientUnique: unique('oauth_consent_user_client_reference_unique') + .on(table.userId, table.clientId, table.referenceId) + .nullsNotDistinct(), + }) +) + /** * Workflow MCP Servers - User-created MCP servers that expose workflows as tools. * These servers are accessible by external MCP clients via API key authentication, diff --git a/packages/sim-cli/src/auth/oauth-flow.test.ts b/packages/sim-cli/src/auth/oauth-flow.test.ts new file mode 100644 index 00000000000..9957f810f9d --- /dev/null +++ b/packages/sim-cli/src/auth/oauth-flow.test.ts @@ -0,0 +1,272 @@ +import { createHash } from 'node:crypto' +import { afterEach, describe, expect, it, vi } from 'vitest' +import { SimApiError } from '../http/client' +import { + buildAuthorizeUrl, + buildRedirectUri, + createPkce, + discoverOAuthProvider, + exchangeCode, + isLikelyRemoteSession, + loginWithBrowser, + OAUTH_CLIENT_ID, + OAuthTokenError, + refreshTokens, +} from './oauth-flow' + +const ENDPOINT = 'https://sim.test' + +function reply(status: number, body: unknown): Response { + return new Response(JSON.stringify(body), { status }) as Response +} + +const TOKENS = { + access_token: 'sim_oat_access', + refresh_token: 'sim_ort_refresh', + expires_in: 3600, + scope: 'openid api:read', + token_type: 'Bearer', +} + +afterEach(() => { + vi.restoreAllMocks() + vi.unstubAllGlobals() +}) + +describe('createPkce', () => { + it('derives an S256 challenge from a fresh 256-bit verifier', () => { + const pkce = createPkce() + expect(pkce.verifier).toMatch(/^[A-Za-z0-9_-]{43}$/) + expect(pkce.challenge).toBe( + createHash('sha256').update(pkce.verifier, 'ascii').digest('base64url') + ) + expect(pkce.state).toMatch(/^[A-Za-z0-9_-]{22}$/) + expect(createPkce().verifier).not.toBe(pkce.verifier) + }) +}) + +describe('buildAuthorizeUrl', () => { + it('names the seeded public client, S256, and a loopback IP-literal redirect', () => { + const pkce = createPkce() + const url = new URL( + buildAuthorizeUrl(ENDPOINT, { + redirectUri: buildRedirectUri(54321), + scopes: ['openid', 'api:read'], + pkce, + }) + ) + expect(url.pathname).toBe('/api/auth/oauth2/authorize') + expect(url.searchParams.get('client_id')).toBe(OAUTH_CLIENT_ID) + expect(url.searchParams.get('response_type')).toBe('code') + expect(url.searchParams.get('redirect_uri')).toBe('http://127.0.0.1:54321/callback') + expect(url.searchParams.get('scope')).toBe('openid api:read') + expect(url.searchParams.get('code_challenge')).toBe(pkce.challenge) + expect(url.searchParams.get('code_challenge_method')).toBe('S256') + expect(url.searchParams.get('state')).toBe(pkce.state) + }) +}) + +describe('discoverOAuthProvider', () => { + it('reports a server that publishes a token endpoint as available', async () => { + vi.stubGlobal('fetch', async () => + reply(200, { token_endpoint: `${ENDPOINT}/api/auth/oauth2/token` }) + ) + await expect(discoverOAuthProvider(ENDPOINT)).resolves.toBe('available') + }) + + it('treats a 404 as a server without the provider, which selects the handoff', async () => { + vi.stubGlobal('fetch', async () => reply(404, { error: 'OAuth provider is not enabled' })) + await expect(discoverOAuthProvider(ENDPOINT)).resolves.toBe('unavailable') + }) + + it('separates an unreachable endpoint from one that lacks the feature', async () => { + vi.stubGlobal('fetch', async () => { + throw new Error('ECONNREFUSED') + }) + await expect(discoverOAuthProvider(ENDPOINT)).resolves.toBe('unreachable') + }) +}) + +describe('token endpoint', () => { + it('posts the code with its verifier as a form and reads the pair back', async () => { + const fetchMock = vi.fn(async () => reply(200, TOKENS)) + vi.stubGlobal('fetch', fetchMock) + const before = Date.now() + + const tokens = await exchangeCode(ENDPOINT, { + code: 'abc', + redirectUri: 'http://127.0.0.1:1/callback', + verifier: 'v', + }) + + const [url, init] = fetchMock.mock.calls[0] as unknown as [string, RequestInit] + expect(url).toBe(`${ENDPOINT}/api/auth/oauth2/token`) + expect(init.headers).toMatchObject({ 'content-type': 'application/x-www-form-urlencoded' }) + expect(init.redirect).toBe('manual') + expect(Object.fromEntries(new URLSearchParams(String(init.body)))).toEqual({ + grant_type: 'authorization_code', + client_id: OAUTH_CLIENT_ID, + code: 'abc', + redirect_uri: 'http://127.0.0.1:1/callback', + code_verifier: 'v', + }) + expect(tokens).toMatchObject({ accessToken: 'sim_oat_access', refreshToken: 'sim_ort_refresh' }) + expect(tokens.expiresAt).toBeGreaterThanOrEqual(before + 3600 * 1000) + }) + + it('surfaces the RFC 6749 error code on a refusal', async () => { + vi.stubGlobal('fetch', async () => + reply(400, { error: 'invalid_grant', error_description: 'refresh token revoked' }) + ) + const failure = await refreshTokens(ENDPOINT, 'dead').catch((error) => error) + expect(failure).toBeInstanceOf(OAuthTokenError) + expect(failure.oauthError).toBe('invalid_grant') + expect(failure.message).toBe('refresh token revoked') + }) + + it('refuses a pair missing its refresh token rather than storing half a login', async () => { + vi.stubGlobal('fetch', async () => reply(200, { access_token: 'only', expires_in: 60 })) + await expect(refreshTokens(ENDPOINT, 'r')).rejects.toThrow('Nothing was stored') + }) + + it('does not follow a redirect that would carry the verifier elsewhere', async () => { + vi.stubGlobal( + 'fetch', + async () => new Response(null, { status: 302, headers: { location: 'https://evil.test' } }) + ) + await expect(refreshTokens(ENDPOINT, 'r')).rejects.toThrow('does not follow redirects') + }) +}) + +describe('loginWithBrowser', () => { + /** Drives the loopback listener the way a browser would, by following the authorize URL's redirect params. */ + async function completeInBrowser( + outcome: (params: URLSearchParams, state: string) => Record + ) { + const fetchMock = vi.fn(async () => reply(200, TOKENS)) + vi.stubGlobal('fetch', fetchMock) + + const login = loginWithBrowser(ENDPOINT, { + scopes: ['openid', 'api:read'], + onAuthorizeUrl: (url) => { + const authorize = new URL(url) + const redirectUri = new URL(authorize.searchParams.get('redirect_uri') as string) + const state = authorize.searchParams.get('state') as string + for (const [key, value] of Object.entries(outcome(authorize.searchParams, state))) { + redirectUri.searchParams.set(key, value) + } + // Node's real HTTP client, not the stubbed fetch, so the listener is exercised. + void import('node:http').then(({ get }) => { + get(redirectUri, (response) => response.resume()) + }) + }, + timeoutMs: 5000, + }) + return { login, fetchMock } + } + + it('listens on 127.0.0.1, verifies state, and redeems the code with the verifier', async () => { + const { login, fetchMock } = await completeInBrowser((_params, state) => ({ + code: 'the-code', + state, + })) + + const tokens = await login + expect(tokens.accessToken).toBe('sim_oat_access') + + const [, init] = fetchMock.mock.calls[0] as unknown as [string, RequestInit] + const form = Object.fromEntries(new URLSearchParams(String(init.body))) + expect(form.code).toBe('the-code') + expect(form.redirect_uri).toMatch(/^http:\/\/127\.0\.0\.1:\d+\/callback$/) + expect(form.code_verifier).toMatch(/^[A-Za-z0-9_-]{43}$/) + }) + + it('ignores a redirect whose state this terminal did not issue, and keeps waiting', async () => { + /** + * Anything on the machine can reach a loopback port, so a forged callback + * must not be able to end someone's sign-in. The forged hit is answered + * and dropped; the real browser then arrives and the login completes. + * + * The forged request is awaited to completion before the real one is sent. + * Firing both and letting them race meant a run where the real callback + * landed first passed every assertion below without the mismatch branch + * ever executing. + */ + const fetchMock = vi.fn(async () => reply(200, TOKENS)) + vi.stubGlobal('fetch', fetchMock) + + let forgedStatus: number | undefined + const login = loginWithBrowser(ENDPOINT, { + scopes: ['openid', 'api:read'], + onAuthorizeUrl: (url) => { + const authorize = new URL(url) + const redirectUri = new URL(authorize.searchParams.get('redirect_uri') as string) + const state = authorize.searchParams.get('state') as string + void (async () => { + const { get } = await import('node:http') + const forged = new URL(redirectUri) + forged.searchParams.set('code', 'forged-code') + forged.searchParams.set('state', 'forged') + forgedStatus = await new Promise((resolve) => { + get(forged, (response) => { + response.resume() + response.once('end', () => resolve(response.statusCode ?? 0)) + }) + }) + const real = new URL(redirectUri) + real.searchParams.set('code', 'the-code') + real.searchParams.set('state', state) + get(real, (response) => response.resume()) + })() + }, + timeoutMs: 5000, + }) + + const tokens = await login + expect(forgedStatus).toBe(400) + expect(tokens.accessToken).toBe('sim_oat_access') + expect(fetchMock).toHaveBeenCalledOnce() + const [, init] = fetchMock.mock.calls[0] as unknown as [string, RequestInit] + expect(Object.fromEntries(new URLSearchParams(String(init.body))).code).toBe('the-code') + }) + + it('reports a declined consent as a cancellation, not a server failure', async () => { + const { login, fetchMock } = await completeInBrowser((_params, state) => ({ + error: 'access_denied', + state, + })) + + const failure = await login.catch((error) => error) + expect(failure).toBeInstanceOf(SimApiError) + expect(failure.message).toBe('Sign-in was declined in the browser.') + expect(fetchMock).not.toHaveBeenCalled() + }) + + it('gives up after the timeout with the browserless fallback named', async () => { + vi.stubGlobal('fetch', vi.fn()) + await expect( + loginWithBrowser(ENDPOINT, { scopes: ['openid'], onAuthorizeUrl: () => {}, timeoutMs: 20 }) + ).rejects.toThrow('--browserless') + }) +}) + +describe('isLikelyRemoteSession', () => { + it('detects an SSH session from its environment', () => { + expect(isLikelyRemoteSession({ SSH_CONNECTION: '1.2.3.4 22 5.6.7.8 22' })).toBe(true) + }) + + it('treats a Linux desktop session as local', () => { + expect(isLikelyRemoteSession({ DISPLAY: ':0' }, 'linux')).toBe(false) + expect(isLikelyRemoteSession({ WAYLAND_DISPLAY: 'wayland-0' }, 'linux')).toBe(false) + }) + + /** The branch the automatic pairing-code fallback actually turns on. */ + it('treats a headless Linux box as remote', () => { + expect(isLikelyRemoteSession({}, 'linux')).toBe(true) + }) + + it('treats a desktop OS as local even with no display variables', () => { + expect(isLikelyRemoteSession({}, 'darwin')).toBe(false) + expect(isLikelyRemoteSession({}, 'win32')).toBe(false) + }) +}) diff --git a/packages/sim-cli/src/auth/oauth-flow.ts b/packages/sim-cli/src/auth/oauth-flow.ts new file mode 100644 index 00000000000..ee8df86d9a6 --- /dev/null +++ b/packages/sim-cli/src/auth/oauth-flow.ts @@ -0,0 +1,512 @@ +import { createHash, randomBytes } from 'node:crypto' +import { createServer, type Server } from 'node:http' +import type { AddressInfo } from 'node:net' +import { redact } from '../config/profile' +import { buildUrl, REDIRECT_STATUSES, SimApiError } from '../http/client' +import { USER_AGENT } from '../version' + +/** + * The OAuth half of `sim login`: authorization code + PKCE with a loopback + * redirect (RFC 8252), the flow gcloud, the AWS CLI, Wrangler and Railway use. + * + * The CLI is a public client — there is no secret to keep — so PKCE is what + * binds the code to this process: the browser carries only the SHA-256 of a + * verifier that never leaves memory, and the token endpoint refuses a code + * presented without it. `state` guards the loopback listener against a stray + * or forged redirect, and the listener binds the loopback interface only, for + * the life of one login. + * + * The result is a short-lived access token and a rotating refresh token, both + * revocable from Settings → Authorized apps, instead of the permanent API key + * the pairing-code handoff in `device-flow.ts` mints. That handoff remains the + * path for a terminal whose browser cannot reach it (SSH, containers). + */ + +/** The client id migration `0321_oauth_provider` seeds; a public client, no secret. */ +export const OAUTH_CLIENT_ID = 'sim-cli' + +/** + * Everything the CLI does, and nothing more: renew itself, and read and change + * workspace resources. + * + * The identity scopes (`openid`, `profile`, `email`) are deliberately absent. + * Sim issues opaque access tokens, and the provider returns no `id_token` at + * all to a public client with no secret — so `openid` could never be honoured + * for this client, and the CLI reads no profile or email either. Asking for + * them would put three permissions on the consent card that this app does not + * use and, for `openid`, structurally cannot. + */ +export const OAUTH_SCOPES_FULL = ['offline_access', 'api:read', 'api:write'] as const + +/** `--read-only`: a token that can inspect but never change anything. */ +export const OAUTH_SCOPES_READ_ONLY = ['offline_access', 'api:read'] as const + +const AUTHORIZE_PATH = '/api/auth/oauth2/authorize' +const TOKEN_PATH = '/api/auth/oauth2/token' +const REVOKE_PATH = '/api/auth/oauth2/revoke' +const DISCOVERY_PATH = '/.well-known/oauth-authorization-server' +const CALLBACK_PATH = '/callback' + +/** + * How long the browser leg may take. Railway and Wrangler use the same window; + * long enough to sign up and read the consent page, short enough that a + * forgotten terminal does not keep a listener open all afternoon. + */ +const LOGIN_TIMEOUT_MS = 5 * 60 * 1000 + +/** How long a discovery, revocation, or code exchange may take. */ +const REQUEST_TIMEOUT_MS = 10 * 1000 + +/** + * Refuses to run the OAuth flow over cleartext. + * + * The code, the verifier, and both tokens cross this connection. An API key + * over `http` earns a warning because the user typed the endpoint and may know + * something we do not; a login is different, because the flow itself is what + * would leak, and because a tampered discovery response silently downgrades + * `sim login` to the pairing-code handoff — which mints a permanent key. + * Loopback is exempt: it never leaves the machine. + */ +function requireSecureEndpoint(endpoint: string): void { + let url: URL + try { + url = new URL(endpoint) + } catch { + return + } + const loopback = + url.hostname === 'localhost' || url.hostname === '127.0.0.1' || url.hostname === '[::1]' + if (url.protocol === 'http:' && !loopback) { + throw new SimApiError( + `Refusing to sign in to ${url.host} over http: the sign-in would send your tokens in the clear. Use https. There is no cleartext fallback — the pairing-code handoff would send a permanent API key over the same connection.`, + 0 + ) + } +} + +export interface OAuthTokens { + accessToken: string + refreshToken: string + /** Epoch milliseconds at which `accessToken` stops working. */ + expiresAt: number + scope: string +} + +/** A refusal from the token endpoint, carrying the RFC 6749 error code. */ +export class OAuthTokenError extends SimApiError { + constructor( + readonly oauthError: string, + description: string | undefined, + status: number + ) { + super(description ?? `Authorization server refused the request (${oauthError})`, status) + this.name = 'OAuthTokenError' + } +} + +export interface Pkce { + verifier: string + challenge: string + state: string +} + +function base64url(bytes: Buffer): string { + return bytes.toString('base64url') +} + +/** A fresh verifier (43 chars, 256 bits), its S256 challenge, and a `state` nonce. */ +export function createPkce(): Pkce { + const verifier = base64url(randomBytes(32)) + return { + verifier, + challenge: createHash('sha256').update(verifier, 'ascii').digest('base64url'), + state: base64url(randomBytes(16)), + } +} + +export function buildRedirectUri(port: number): string { + return `http://127.0.0.1:${port}${CALLBACK_PATH}` +} + +export function buildAuthorizeUrl( + endpoint: string, + args: { redirectUri: string; scopes: readonly string[]; pkce: Pkce } +): string { + return buildUrl(endpoint, AUTHORIZE_PATH, { + client_id: OAUTH_CLIENT_ID, + response_type: 'code', + redirect_uri: args.redirectUri, + scope: args.scopes.join(' '), + code_challenge: args.pkce.challenge, + code_challenge_method: 'S256', + state: args.pkce.state, + }) +} + +export type OAuthProviderStatus = 'available' | 'unavailable' | 'unreachable' + +/** + * Whether the endpoint is an OAuth authorization server, from the RFC 8414 + * discovery document. A 404 is a definite "no" — an older Sim, or one with the + * provider switched off — and sends login to the pairing-code handoff; a + * transport failure is reported as such so a typo'd endpoint is not mistaken + * for a server that lacks the feature. + */ +export async function discoverOAuthProvider(endpoint: string): Promise { + let response: Response + try { + response = await fetch(buildUrl(endpoint, DISCOVERY_PATH), { + headers: { accept: 'application/json', 'user-agent': USER_AGENT }, + redirect: 'manual', + signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), + }) + } catch { + return 'unreachable' + } + /** + * Only a definite "no" counts as unavailable. A 5xx or a redirect means the + * question was not answered — a proxy mid-deploy, a captive portal — and + * calling that "no OAuth here" would quietly hand the user a permanent API + * key from the handoff on a server that does support signing in. + */ + if (response.status >= 500 || REDIRECT_STATUSES.has(response.status)) return 'unreachable' + if (!response.ok) return 'unavailable' + try { + const metadata = (await response.json()) as { token_endpoint?: unknown } + return typeof metadata.token_endpoint === 'string' ? 'available' : 'unavailable' + } catch { + return 'unavailable' + } +} + +interface TokenResponse { + access_token?: unknown + refresh_token?: unknown + expires_in?: unknown + scope?: unknown + error?: unknown + error_description?: unknown +} + +async function postToken( + endpoint: string, + path: string, + form: Record, + signal?: AbortSignal +): Promise { + let response: Response + try { + response = await fetch(buildUrl(endpoint, path), { + method: 'POST', + headers: { + 'content-type': 'application/x-www-form-urlencoded', + accept: 'application/json', + 'user-agent': USER_AGENT, + }, + body: new URLSearchParams(form).toString(), + signal, + redirect: 'manual', + }) + } catch (cause) { + throw new SimApiError(`Could not reach ${endpoint}: ${(cause as Error).message}`, 0) + } + if (REDIRECT_STATUSES.has(response.status)) { + throw new SimApiError( + `${endpoint} redirected the token request. The CLI does not follow redirects, because a redirect drops the request body and would carry the login secret to another origin. Check the endpoint.`, + response.status + ) + } + return response +} + +async function readTokens(response: Response, issuedAt: number): Promise { + const raw = await response.text() + let body: TokenResponse + try { + body = JSON.parse(raw) as TokenResponse + } catch { + throw new SimApiError( + `The authorization server answered HTTP ${response.status} with a non-JSON body.`, + response.status + ) + } + if (!response.ok || typeof body.error === 'string') { + throw new OAuthTokenError( + typeof body.error === 'string' ? body.error : 'server_error', + // The description is whatever the endpoint sent, so it goes through the + // same redaction every other quoted remote value does: a value carrying + // control characters would otherwise write its own lines to the terminal. + typeof body.error_description === 'string' ? redact(body.error_description) : undefined, + response.status + ) + } + if (typeof body.access_token !== 'string' || typeof body.refresh_token !== 'string') { + throw new SimApiError( + 'The authorization server did not return both an access token and a refresh token. Nothing was stored.', + response.status + ) + } + const expiresIn = typeof body.expires_in === 'number' ? body.expires_in : 3600 + return { + accessToken: body.access_token, + refreshToken: body.refresh_token, + expiresAt: issuedAt + expiresIn * 1000, + scope: typeof body.scope === 'string' ? body.scope : '', + } +} + +export function grantsWriteAccess(scope: string): boolean { + return scope.split(' ').includes('api:write') +} + +/** Redeems an authorization code with its PKCE verifier. */ +export async function exchangeCode( + endpoint: string, + args: { code: string; redirectUri: string; verifier: string }, + signal?: AbortSignal +): Promise { + const issuedAt = Date.now() + const response = await postToken( + endpoint, + TOKEN_PATH, + { + grant_type: 'authorization_code', + client_id: OAUTH_CLIENT_ID, + code: args.code, + redirect_uri: args.redirectUri, + code_verifier: args.verifier, + }, + signal + ) + return readTokens(response, issuedAt) +} + +/** + * Trades a refresh token for a new pair. The server rotates: the token used + * here is dead afterwards, and presenting it again invalidates every token the + * CLI holds for this account — which is why callers serialize refreshes + * through the credentials lock before reaching this. + */ +export async function refreshTokens( + endpoint: string, + refreshToken: string, + signal?: AbortSignal +): Promise { + const issuedAt = Date.now() + const response = await postToken( + endpoint, + TOKEN_PATH, + { grant_type: 'refresh_token', client_id: OAUTH_CLIENT_ID, refresh_token: refreshToken }, + signal + ) + return readTokens(response, issuedAt) +} + +/** + * Revokes a refresh token server-side, which also kills the access tokens it + * issued. RFC 7009 answers 200 for an unknown token, so this only fails when + * the server cannot be reached or refuses the client. + */ +export async function revokeToken(endpoint: string, token: string): Promise { + const response = await postToken( + endpoint, + REVOKE_PATH, + { token, token_type_hint: 'refresh_token', client_id: OAUTH_CLIENT_ID }, + AbortSignal.timeout(REQUEST_TIMEOUT_MS) + ) + if (!response.ok) { + throw new SimApiError( + `The authorization server refused to revoke the session (HTTP ${response.status}).`, + response.status + ) + } +} + +const PAGE_STYLE = + 'font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;display:flex;min-height:100vh;align-items:center;justify-content:center;margin:0;color:#111;background:#fff' + +function callbackPage(title: string, body: string): string { + return `${title}

${title}

${body}

` +} + +interface LoopbackResult { + code: string +} + +/** + * Listens on the loopback interface for one redirect and hands back its code. + * + * `127.0.0.1` rather than `localhost`, as RFC 8252 §7.3 recommends: the name + * can resolve to a non-loopback interface, and the server registers the IP + * literal. Port 0 lets the OS pick, which the server accepts for any loopback + * port; `--callback-port` pins it for a container whose port must be forwarded. + */ +function listenForCallback( + server: Server, + expectedState: string, + signal: AbortSignal | undefined, + timeoutMs: number +): Promise { + return new Promise((resolve, reject) => { + let settled = false + const finish = (outcome: { ok: true; value: LoopbackResult } | { ok: false; error: Error }) => { + if (settled) return + settled = true + clearTimeout(timer) + signal?.removeEventListener('abort', onAbort) + server.close() + // `close()` only stops accepting. The browser sends `Connection: + // keep-alive`, so without this the socket holds the event loop open for + // Node's 5s `keepAliveTimeout` and `sim login` sits there, already + // finished, after printing its success line. + server.closeAllConnections() + if (outcome.ok) resolve(outcome.value) + else reject(outcome.error) + } + const onAbort = () => finish({ ok: false, error: new SimApiError('Login cancelled.', 0) }) + const timer = setTimeout( + () => + finish({ + ok: false, + error: new SimApiError( + `Timed out after ${Math.round(timeoutMs / 60000)} minutes waiting for the browser. Run sim login again, or use --browserless if this terminal's browser cannot reach it.`, + 0 + ), + }), + timeoutMs + ) + signal?.addEventListener('abort', onAbort, { once: true }) + + server.on('request', (request, response) => { + const url = new URL(request.url ?? '/', 'http://127.0.0.1') + if (url.pathname !== CALLBACK_PATH) { + response.writeHead(404, { 'content-type': 'text/plain' }).end('Not found') + return + } + const error = url.searchParams.get('error') + const state = url.searchParams.get('state') + const code = url.searchParams.get('code') + + /** + * Anything on the machine can reach a loopback port, so a request that + * does not carry this login's `state` is answered and ignored rather + * than ending the wait — otherwise any page the user has open could + * cancel their sign-in by fetching the callback. The real browser still + * arrives with the right `state`, or the timeout fires. + */ + if (state !== expectedState) { + response + .writeHead(400, { 'content-type': 'text/html; charset=utf-8' }) + .end( + callbackPage( + 'Sign-in mismatch', + 'This response did not come from the sign-in this terminal started. Return to your terminal.' + ) + ) + return + } + if (error || !code) { + const description = url.searchParams.get('error_description') ?? undefined + response + .writeHead(200, { 'content-type': 'text/html; charset=utf-8' }) + .end( + callbackPage('Sign-in cancelled', 'You can close this tab and return to your terminal.') + ) + finish({ + ok: false, + error: + error === 'access_denied' + ? new SimApiError('Sign-in was declined in the browser.', 0) + : new SimApiError( + description ?? `Sign-in failed (${error ?? 'no code returned'}).`, + 0 + ), + }) + return + } + response + .writeHead(200, { 'content-type': 'text/html; charset=utf-8' }) + .end( + callbackPage( + "You're signed in to Sim", + 'You can close this tab and return to your terminal.' + ) + ) + finish({ ok: true, value: { code } }) + }) + }) +} + +export interface BrowserLoginOptions { + scopes: readonly string[] + /** Pin the loopback port, for a container that forwards a fixed one. */ + callbackPort?: number + /** Called with the authorize URL once the listener is up, before waiting. */ + onAuthorizeUrl: (url: string) => void + signal?: AbortSignal + timeoutMs?: number +} + +/** + * Runs the whole browser login: listener, authorize URL, callback, exchange. + * Resolves with tokens only after the code has been redeemed, so a caller that + * gets a result holds a working credential. + */ +export async function loginWithBrowser( + endpoint: string, + options: BrowserLoginOptions +): Promise { + requireSecureEndpoint(endpoint) + + const pkce = createPkce() + const server = createServer() + + await new Promise((resolve, reject) => { + server.once('error', (cause) => { + // The ordinary outcome of `--callback-port` naming a port that is taken + // or privileged, so it is explained rather than thrown as a stack trace. + reject( + new SimApiError( + `Could not listen on the sign-in callback port: ${cause.message}. Pick another --callback-port.`, + 0 + ) + ) + }) + server.listen(options.callbackPort ?? 0, '127.0.0.1', () => { + server.removeAllListeners('error') + resolve() + }) + }) + + const port = (server.address() as AddressInfo).port + const redirectUri = buildRedirectUri(port) + const pending = listenForCallback( + server, + pkce.state, + options.signal, + options.timeoutMs ?? LOGIN_TIMEOUT_MS + ) + + options.onAuthorizeUrl(buildAuthorizeUrl(endpoint, { redirectUri, scopes: options.scopes, pkce })) + + const { code } = await pending + return exchangeCode( + endpoint, + { code, redirectUri, verifier: pkce.verifier }, + options.signal ?? AbortSignal.timeout(REQUEST_TIMEOUT_MS) + ) +} + +/** + * Whether this terminal's browser is unlikely to reach a loopback listener on + * this machine: an SSH session, or a Linux box with no display. The signals + * Railway and Stripe use to auto-select their pairing flows; `--browserless` + * forces it and `--callback-port` overrides the guess. + */ +export function isLikelyRemoteSession( + env: NodeJS.ProcessEnv = process.env, + platform: NodeJS.Platform = process.platform +): boolean { + if (env.SSH_CONNECTION || env.SSH_TTY || env.SSH_CLIENT) return true + return platform === 'linux' && !env.DISPLAY && !env.WAYLAND_DISPLAY +} diff --git a/packages/sim-cli/src/auth/refresh.test.ts b/packages/sim-cli/src/auth/refresh.test.ts new file mode 100644 index 00000000000..de67b7265cd --- /dev/null +++ b/packages/sim-cli/src/auth/refresh.test.ts @@ -0,0 +1,91 @@ +import { mkdtempSync, rmSync } from 'node:fs' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { readStoredCredential, writeCredentialsProfile } from '../config/profile' +import { refreshStoredOAuth } from './refresh' + +const PROFILE = { name: 'default', endpoint: 'https://sim.test', authProfile: 'default' } + +function reply(status: number, body: unknown): Response { + return new Response(JSON.stringify(body), { status }) as Response +} + +let dir: string + +beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'sim-cli-refresh-')) + vi.stubEnv('SIM_CONFIG_DIR', dir) +}) + +afterEach(() => { + vi.unstubAllGlobals() + vi.unstubAllEnvs() + rmSync(dir, { recursive: true, force: true }) +}) + +describe('refreshStoredOAuth', () => { + it('rotates the pair on the server and persists what came back', async () => { + writeCredentialsProfile('default', { + kind: 'oauth', + oauth: { accessToken: 'old-access', refreshToken: 'old-refresh', expiresAt: 1 }, + }) + const fetchMock = vi.fn(async () => + reply(200, { access_token: 'new-access', refresh_token: 'new-refresh', expires_in: 3600 }) + ) + vi.stubGlobal('fetch', fetchMock) + + const next = await refreshStoredOAuth(PROFILE, { + accessToken: 'old-access', + refreshToken: 'old-refresh', + expiresAt: 1, + }) + + expect(next.refreshToken).toBe('new-refresh') + const [, init] = fetchMock.mock.calls[0] as unknown as [string, RequestInit] + expect(Object.fromEntries(new URLSearchParams(String(init.body)))).toMatchObject({ + grant_type: 'refresh_token', + refresh_token: 'old-refresh', + }) + expect(readStoredCredential('default')).toEqual({ + kind: 'oauth', + oauth: { accessToken: 'new-access', refreshToken: 'new-refresh', expiresAt: next.expiresAt }, + }) + }) + + /** + * The rotation race: a refresh token presented twice revokes the whole + * session server-side. A process that took the lock second must find the + * winner's tokens on disk and use them instead of presenting the dead one. + */ + it('adopts a rotation another process already wrote instead of presenting the dead token', async () => { + writeCredentialsProfile('default', { + kind: 'oauth', + oauth: { accessToken: 'winner-access', refreshToken: 'winner-refresh', expiresAt: 99 }, + }) + const fetchMock = vi.fn() + vi.stubGlobal('fetch', fetchMock) + + const next = await refreshStoredOAuth(PROFILE, { + accessToken: 'stale-access', + refreshToken: 'stale-refresh', + expiresAt: 1, + }) + + expect(next.refreshToken).toBe('winner-refresh') + expect(fetchMock).not.toHaveBeenCalled() + }) + + it('names the remedy when the server no longer honours the refresh token', async () => { + writeCredentialsProfile('default', { + kind: 'oauth', + oauth: { accessToken: 'a', refreshToken: 'r', expiresAt: 1 }, + }) + vi.stubGlobal('fetch', async () => reply(400, { error: 'invalid_grant' })) + + await expect( + refreshStoredOAuth(PROFILE, { accessToken: 'a', refreshToken: 'r', expiresAt: 1 }) + ).rejects.toThrow('Run: sim login --profile default') + expect(readStoredCredential('default')).toMatchObject({ kind: 'oauth' }) + }) +}) diff --git a/packages/sim-cli/src/auth/refresh.ts b/packages/sim-cli/src/auth/refresh.ts new file mode 100644 index 00000000000..e054357eded --- /dev/null +++ b/packages/sim-cli/src/auth/refresh.ts @@ -0,0 +1,65 @@ +import { + type ResolvedProfile, + readCredentialsProfile, + readStoredOAuth, + type StoredOAuthCredential, + withCredentialsLock, + writeCredentialsProfile, +} from '../config/index' +import { SimApiError } from '../http/client' +import { OAuthTokenError, refreshTokens } from './oauth-flow' + +/** + * Bounded well under the credentials lock's stale window: a hung authorization + * server must not hold the lock long enough for another process to reclaim it + * and refresh in parallel, which is what reuse detection would kill the whole + * session for. + */ +const REFRESH_TIMEOUT_MS = 10 * 1000 + +/** + * Renews a stored OAuth login and persists the rotated pair. + * + * Under the credentials lock, because the refresh token is single-use and a + * parallel `sim` that presented it second would get the whole session revoked. + * After taking the lock the file is read again: if another process already + * rotated the token, its result is adopted and no request is made. + * + * `invalid_grant` means the server no longer honours the refresh token — it + * was revoked from Settings → Authorized apps, expired, or was already rotated + * by a process this one could not see — and the only remedy is a new login. + */ +export async function refreshStoredOAuth( + profile: Pick, + current: StoredOAuthCredential +): Promise { + return withCredentialsLock(async () => { + const stored = readStoredOAuth(readCredentialsProfile(profile.authProfile)) + if (stored && stored.refreshToken !== current.refreshToken) return stored + + let tokens: StoredOAuthCredential + try { + const refreshed = await refreshTokens( + profile.endpoint, + current.refreshToken, + AbortSignal.timeout(REFRESH_TIMEOUT_MS) + ) + tokens = { + accessToken: refreshed.accessToken, + refreshToken: refreshed.refreshToken, + expiresAt: refreshed.expiresAt, + } + } catch (error) { + if (error instanceof OAuthTokenError && error.oauthError === 'invalid_grant') { + throw new SimApiError( + `Your Sim login has expired or was revoked. Run: sim login --profile ${profile.authProfile}`, + 401 + ) + } + throw error + } + + writeCredentialsProfile(profile.authProfile, { kind: 'oauth', oauth: tokens }) + return tokens + }) +} diff --git a/packages/sim-cli/src/commands/auth.test.ts b/packages/sim-cli/src/commands/auth.test.ts index 920ba55b3c7..f9842f6861f 100644 --- a/packages/sim-cli/src/commands/auth.test.ts +++ b/packages/sim-cli/src/commands/auth.test.ts @@ -10,10 +10,22 @@ const mocks = vi.hoisted(() => ({ listProfiles: vi.fn<() => string[]>(() => []), request: vi.fn(), readCredentialsProfile: vi.fn<() => Record>(() => ({})), + discoverOAuthProvider: vi.fn( + async () => 'unavailable' as 'available' | 'unavailable' | 'unreachable' + ), + isLikelyRemoteSession: vi.fn(() => false), + loginWithBrowser: vi.fn(async () => ({ + accessToken: 'sim_oat_access', + refreshToken: 'sim_ort_refresh', + expiresAt: 1_800_000_000_000, + scope: 'openid profile email offline_access api:read api:write', + })), + revokeToken: vi.fn(async () => undefined), + grantsWriteAccess: vi.fn((scope: string) => scope.split(' ').includes('api:write')), resolveAuthenticationProfileName: vi.fn((profile: string) => profile), pollForKey: vi.fn(async () => ({ apiKey: 'sim-key', - scope: 'platform' as const, + scope: 'platform' as 'platform' | 'copilot', workspaceBound: false, workspaceId: 'ws_1' as string | undefined, })), @@ -25,7 +37,7 @@ const mocks = vi.hoisted(() => ({ output: 'table', sources: { endpoint: 'default', - apiKey: 'unset', + credential: 'unset', workspaceId: 'unset', output: 'default', }, @@ -40,6 +52,20 @@ vi.mock('../auth/device-flow', () => ({ createAuthRequest: mocks.createAuthRequest, pollForKey: mocks.pollForKey, })) +/** + * Discovery answers "unavailable" unless a test says otherwise, so the suite + * below keeps exercising the pairing-code handoff it was written against; the + * OAuth-path tests flip it to "available". + */ +vi.mock('../auth/oauth-flow', () => ({ + discoverOAuthProvider: mocks.discoverOAuthProvider, + isLikelyRemoteSession: mocks.isLikelyRemoteSession, + loginWithBrowser: mocks.loginWithBrowser, + revokeToken: mocks.revokeToken, + grantsWriteAccess: mocks.grantsWriteAccess, + OAUTH_SCOPES_FULL: ['openid', 'profile', 'email', 'offline_access', 'api:read', 'api:write'], + OAUTH_SCOPES_READ_ONLY: ['openid', 'profile', 'email', 'offline_access', 'api:read'], +})) /** * The validators and the format list come from the real module rather than a * copy: a duplicated pattern here would keep passing if the shipped one were @@ -69,9 +95,30 @@ vi.mock('../config/index', async () => ({ listAuthenticationDependents: mocks.listAuthenticationDependents, listProfiles: mocks.listProfiles, readCredentialsProfile: mocks.readCredentialsProfile, + /** + * Derived from the section mock so a test that seeds `{ api_key }` or the + * OAuth keys sees the same credential the shipped reader would. + */ + readStoredCredential: () => { + const section = mocks.readCredentialsProfile() + if (section.access_token && section.refresh_token) { + return { + kind: 'oauth', + oauth: { + accessToken: section.access_token, + refreshToken: section.refresh_token, + expiresAt: Number(section.token_expires_at ?? 0), + }, + } + } + return section.api_key ? { kind: 'api_key', apiKey: section.api_key } : null + }, resolveAuthenticationProfileName: mocks.resolveAuthenticationProfileName, writeConfigProfile: mocks.writeConfigProfile, writeCredentialsProfile: mocks.writeCredentialsProfile, + // Pass-through: the real lock is exercised in profile.test.ts; here it only + // has to not swallow the writes these tests assert on. + withCredentialsLock: (work: () => Promise) => work(), })) vi.mock('../context', () => ({ globalsOf: (command: Command) => command.optsWithGlobals(), @@ -130,7 +177,7 @@ describe('login command', () => { output: 'table', sources: { endpoint: 'default', - apiKey: 'unset', + credential: 'unset', workspaceId: 'unset', output: 'default', }, @@ -184,7 +231,7 @@ describe('login command', () => { output: 'table', sources: { endpoint: 'config', - apiKey: 'credentials', + credential: 'credentials', workspaceId: 'config', output: 'default', }, @@ -220,7 +267,7 @@ describe('login command', () => { await login() expect(question).toHaveBeenCalledWith( - 'Profile "default" already exists. Replace its API key and login defaults? (y/N) ' + 'Profile "default" already exists. Replace its login and defaults? (y/N) ' ) expect(close).toHaveBeenCalledOnce() expect(mocks.createAuthRequest).toHaveBeenCalledOnce() @@ -293,7 +340,7 @@ describe('login command', () => { workspaceId: 'ws_1', }) - await expect(login()).rejects.toThrow('malformed API key') + await expect(login()).rejects.toThrow('malformed credential') expect(mocks.writeConfigProfile).not.toHaveBeenCalled() expect(mocks.writeCredentialsProfile).not.toHaveBeenCalled() @@ -316,7 +363,7 @@ describe('login command', () => { workspaceId: 'ws_1', }) - await expect(login()).rejects.toThrow('malformed API key') + await expect(login()).rejects.toThrow('malformed credential') expect(mocks.writeConfigProfile).not.toHaveBeenCalled() expect(mocks.writeCredentialsProfile).not.toHaveBeenCalled() @@ -332,7 +379,7 @@ describe('login command', () => { output: 'table', sources: { endpoint: 'default', - apiKey: 'unset', + credential: 'unset', workspaceId: 'config', output: 'default', }, @@ -363,7 +410,7 @@ describe('login command', () => { output: 'table', sources: { endpoint: 'default', - apiKey: 'unset', + credential: 'unset', workspaceId: 'config', output: 'default', }, @@ -396,7 +443,7 @@ describe('profiles command', () => { output: 'table', sources: { endpoint: 'config', - apiKey: 'credentials', + credential: 'credentials', workspaceId: 'config', output: 'default', }, @@ -457,7 +504,7 @@ describe('profiles command', () => { output: 'table', sources: { endpoint: 'config', - apiKey: 'credentials', + credential: 'credentials', workspaceId: 'config', output: 'default', }, @@ -481,14 +528,14 @@ describe('profiles command', () => { output: 'table', sources: { endpoint: 'default', - apiKey: 'env', + credential: 'env', workspaceId: 'unset', output: 'default', }, }) await expect(profiles('add', 'acme', '--workspace', 'ws_acme')).rejects.toThrow( - 'the active API key is not stored' + 'the active login is not stored' ) expect(mocks.request).not.toHaveBeenCalled() expect(mocks.writeConfigProfile).not.toHaveBeenCalled() @@ -503,7 +550,7 @@ describe('profiles command', () => { output: 'table', sources: { endpoint: 'env', - apiKey: 'credentials', + credential: 'credentials', workspaceId: 'unset', output: 'default', }, @@ -630,7 +677,7 @@ describe('profiles command', () => { output: 'json', sources: { endpoint: 'config', - apiKey: 'credentials', + credential: 'credentials', workspaceId: 'config', output: 'config', }, @@ -655,7 +702,7 @@ describe('profiles command', () => { output: 'json', sources: { endpoint: 'default', - apiKey: 'unset', + credential: 'unset', workspaceId: 'unset', output: 'config', }, @@ -771,7 +818,7 @@ describe('logout command', () => { output: 'table', sources: { endpoint: 'config', - apiKey: 'credentials', + credential: 'credentials', workspaceId: 'config', output: 'default', }, @@ -820,7 +867,7 @@ describe('whoami command', () => { output: 'text', sources: { endpoint: 'default', - apiKey: 'credentials', + credential: 'credentials', workspaceId: 'config', output: 'flag', }, @@ -853,7 +900,7 @@ describe('whoami command', () => { await whoami() const output = vi.mocked(console.log).mock.calls.flat().join('\n') - expect(output).toContain('API key\tconfigured (credentials)') + expect(output).toContain('Login\tAPI key (credentials)') expect(output).not.toContain('sim_super_secret_value') expect(output).not.toContain('secret') }) @@ -963,7 +1010,7 @@ describe('whoami command', () => { it('exits 1 when no key is configured', async () => { mocks.profileFrom.mockReturnValue( - configured({ apiKey: null, sources: { ...configured().sources, apiKey: 'unset' } }) + configured({ apiKey: null, sources: { ...configured().sources, credential: 'unset' } }) ) await whoami() @@ -1023,3 +1070,189 @@ describe('whoami command', () => { expect(process.exitCode).toBeUndefined() }) }) + +describe('login command — OAuth', () => { + beforeEach(() => { + vi.clearAllMocks() + mocks.listProfiles.mockReturnValue([]) + mocks.readCredentialsProfile.mockReturnValue({}) + mocks.resolveAuthenticationProfileName.mockImplementation((profile) => profile) + mocks.discoverOAuthProvider.mockResolvedValue('available') + mocks.isLikelyRemoteSession.mockReturnValue(false) + mocks.pollForKey.mockResolvedValue({ + apiKey: 'sim-key', + scope: 'platform', + workspaceBound: false, + workspaceId: 'ws_1', + }) + mocks.profileFrom.mockReturnValue({ + name: 'default', + endpoint: 'https://sim.ai', + apiKey: null, + workspaceId: null, + output: 'table', + sources: { + endpoint: 'default', + credential: 'unset', + workspaceId: 'unset', + output: 'default', + }, + }) + vi.spyOn(console, 'log').mockImplementation(() => {}) + }) + + afterEach(() => { + if (originalIsTTY) Object.defineProperty(process.stdin, 'isTTY', originalIsTTY) + else Reflect.deleteProperty(process.stdin, 'isTTY') + }) + + it('signs in through the browser by default and stores the login, not a key', async () => { + setInteractive(false) + await login() + + expect(mocks.loginWithBrowser).toHaveBeenCalledWith( + 'https://sim.ai', + expect.objectContaining({ + scopes: ['openid', 'profile', 'email', 'offline_access', 'api:read', 'api:write'], + }) + ) + expect(mocks.createAuthRequest).not.toHaveBeenCalled() + expect(mocks.writeConfigProfile).toHaveBeenCalledWith('default', { + endpoint: 'https://sim.ai', + }) + expect(mocks.writeCredentialsProfile).toHaveBeenCalledWith('default', { + kind: 'oauth', + oauth: { + accessToken: 'sim_oat_access', + refreshToken: 'sim_ort_refresh', + expiresAt: 1_800_000_000_000, + }, + }) + }) + + it('asks only for the read scope under --read-only', async () => { + setInteractive(false) + await login('--read-only') + + expect(mocks.loginWithBrowser).toHaveBeenCalledWith( + 'https://sim.ai', + expect.objectContaining({ + scopes: ['openid', 'profile', 'email', 'offline_access', 'api:read'], + }) + ) + }) + + it('pins the loopback port when asked, and refuses an unusable one', async () => { + setInteractive(false) + await login('--callback-port', '8976') + expect(mocks.loginWithBrowser).toHaveBeenCalledWith( + 'https://sim.ai', + expect.objectContaining({ callbackPort: 8976 }) + ) + + await expect(login('--callback-port', '70000')).rejects.toThrow('Invalid --callback-port') + }) + + it('falls back to the pairing code under --browserless', async () => { + setInteractive(false) + await login('--browserless') + + expect(mocks.loginWithBrowser).not.toHaveBeenCalled() + expect(mocks.pollForKey).toHaveBeenCalledOnce() + }) + + it('falls back to the pairing code in a remote session', async () => { + setInteractive(false) + mocks.isLikelyRemoteSession.mockReturnValue(true) + await login() + + expect(mocks.loginWithBrowser).not.toHaveBeenCalled() + expect(mocks.pollForKey).toHaveBeenCalledOnce() + }) + + it('uses the pairing code for a copilot-scope key, which only the handoff mints', async () => { + setInteractive(false) + mocks.pollForKey.mockResolvedValue({ + apiKey: 'sim-key', + scope: 'copilot', + workspaceBound: false, + workspaceId: undefined, + }) + await login('--scope', 'copilot') + + expect(mocks.loginWithBrowser).not.toHaveBeenCalled() + expect(mocks.discoverOAuthProvider).not.toHaveBeenCalled() + }) + + it('refuses an unreachable endpoint rather than guessing it lacks the provider', async () => { + setInteractive(false) + mocks.discoverOAuthProvider.mockResolvedValue('unreachable') + + await expect(login()).rejects.toThrow('Could not reach https://sim.ai') + expect(mocks.pollForKey).not.toHaveBeenCalled() + }) + + it('prompts before replacing a stored OAuth login', async () => { + setInteractive(false) + mocks.readCredentialsProfile.mockReturnValue({ + access_token: 'a', + refresh_token: 'r', + token_expires_at: '1', + }) + + await expect(login()).rejects.toThrow('Re-run with --yes') + }) +}) + +describe('logout command — OAuth', () => { + beforeEach(() => { + vi.clearAllMocks() + mocks.listAuthenticationDependents.mockReturnValue([]) + mocks.resolveAuthenticationProfileName.mockImplementation((profile) => profile) + mocks.readCredentialsProfile.mockReturnValue({ + access_token: 'sim_oat_a', + refresh_token: 'sim_ort_r', + token_expires_at: '1', + }) + mocks.profileFrom.mockReturnValue({ + name: 'acme', + endpoint: 'https://sim.ai', + apiKey: null, + workspaceId: 'ws_acme', + output: 'table', + sources: { + endpoint: 'config', + credential: 'credentials', + workspaceId: 'config', + output: 'default', + }, + }) + vi.spyOn(console, 'log').mockImplementation(() => {}) + }) + + it('revokes the refresh token on the server before forgetting it', async () => { + const order: string[] = [] + mocks.revokeToken.mockImplementation(async () => { + order.push('revoke') + }) + mocks.writeCredentialsProfile.mockImplementation(() => { + order.push('clear') + }) + + await logout('--profile', 'acme') + + expect(mocks.revokeToken).toHaveBeenCalledWith('https://sim.ai', 'sim_ort_r') + expect(order).toEqual(['revoke', 'clear']) + expect(mocks.writeCredentialsProfile).toHaveBeenCalledWith('acme', null) + }) + + it('still clears the machine when the server cannot be reached, and says so', async () => { + mocks.revokeToken.mockRejectedValue(new Error('ECONNREFUSED')) + + await logout('--profile', 'acme') + + expect(mocks.writeCredentialsProfile).toHaveBeenCalledWith('acme', null) + const output = vi.mocked(console.log).mock.calls.flat().join('\n') + expect(output).toContain('Could not revoke the login') + }) +}) diff --git a/packages/sim-cli/src/commands/auth.ts b/packages/sim-cli/src/commands/auth.ts index 1316dd7c027..769bd961f88 100644 --- a/packages/sim-cli/src/commands/auth.ts +++ b/packages/sim-cli/src/commands/auth.ts @@ -1,5 +1,6 @@ import { spawn } from 'node:child_process' import { createInterface } from 'node:readline/promises' +import { getErrorMessage } from '@sim/utils/errors' import chalk from 'chalk' import { Command } from 'commander' import { @@ -8,6 +9,15 @@ import { createAuthRequest, pollForKey, } from '../auth/device-flow' +import { + discoverOAuthProvider, + grantsWriteAccess, + isLikelyRemoteSession, + loginWithBrowser, + OAUTH_SCOPES_FULL, + OAUTH_SCOPES_READ_ONLY, + revokeToken, +} from '../auth/oauth-flow' import { configPath, credentialsPath, @@ -21,10 +31,11 @@ import { type OutputFormat, ProfileConfigError, type ResolvedProfile, - readCredentialsProfile, + readStoredCredential, resolveAuthenticationProfileName, type SettingSource, validateProfileName, + withCredentialsLock, writeConfigProfile, writeCredentialsProfile, } from '../config/index' @@ -85,7 +96,7 @@ function presentAuthentication(source: SettingSource): { return { authenticated: false, source: 'unset' } case 'config': case 'default': - throw new SimApiError(`Unexpected API key source "${source}".`, 0) + throw new SimApiError(`Unexpected credential source "${source}".`, 0) } } @@ -100,7 +111,7 @@ async function confirmProfileOverwrite(profileName: string): Promise { const prompt = createInterface({ input: process.stdin, output: process.stderr }) try { const answer = await prompt.question( - `Profile "${redact(profileName)}" already exists. Replace its API key and login defaults? (y/N) ` + `Profile "${redact(profileName)}" already exists. Replace its login and defaults? (y/N) ` ) return answer.trim().toLowerCase() === 'y' || answer.trim().toLowerCase() === 'yes' } finally { @@ -125,10 +136,10 @@ function validateNewProfileName(profileName: string): void { } /** - * Refuses a minted key the credentials file could not represent. + * Refuses a minted credential the credentials file could not represent. * - * The poll response is remote input, and the deployment answering it is - * whatever the endpoint names. A key carrying a line break would be written + * The response is remote input, and the deployment answering it is + * whatever the endpoint names. A value carrying a line break would be written * verbatim into an escape-less format, so the writer refuses it — this refuses * it one step earlier, before anything is on disk, and says which side is wrong. * @@ -142,15 +153,15 @@ function validateNewProfileName(profileName: string): void { * padding from the credential. Trimming would store a value the server never * issued and turn a loud, explained failure into a 401 on every later command. */ -function requireStorableKey(apiKey: unknown): void { +function requireStorableCredential(value: unknown): void { if ( - typeof apiKey !== 'string' || - !apiKey || - apiKey !== apiKey.trim() || - FORBIDDEN_IN_VALUE.test(apiKey) + typeof value !== 'string' || + !value || + value !== value.trim() || + FORBIDDEN_IN_VALUE.test(value) ) { throw new SimApiError( - 'The server returned a malformed API key. Nothing was stored; check the endpoint.', + 'The server returned a malformed credential. Nothing was stored; check the endpoint.', 0 ) } @@ -158,10 +169,9 @@ function requireStorableKey(apiKey: unknown): void { function requireStoredAuthentication(profile: ResolvedProfile): string { const authProfile = resolveAuthenticationProfileName(profile.name) - const storedKey = readCredentialsProfile(authProfile).api_key - if (profile.sources.apiKey !== 'credentials' || !storedKey) { + if (profile.sources.credential !== 'credentials' || !readStoredCredential(authProfile)) { throw new SimApiError( - `Cannot create a shared profile from "${redact(profile.name)}": the active API key is not stored. Run: sim login --profile ${redact(authProfile)}`, + `Cannot create a shared profile from "${redact(profile.name)}": the active login is not stored. Run: sim login --profile ${redact(authProfile)}`, 0 ) } @@ -263,125 +273,308 @@ function addProfileCommand(): Command { }) } +interface LoginOptions { + scope: string + browser: boolean + browserless?: boolean + readOnly?: boolean + callbackPort?: string + yes?: boolean +} + +/** + * Which login to run. + * + * OAuth is the default: it leaves a short-lived, revocable login instead of a + * permanent key. The pairing-code handoff remains for the cases OAuth's + * loopback redirect cannot serve — a terminal whose browser is on another + * machine (`--browserless`, or an SSH session detected), a copilot-scope key + * (which only the handoff mints), and a server without the provider (an older + * Sim, or one with it switched off), which discovery reports before the browser + * opens. An unreachable server is an error, not a fallback: a typo'd endpoint + * must not be mistaken for one that lacks the feature. + * + * `--callback-port` overrides the remote-session guess, because naming the port + * is how someone with an SSH tunnel says the loopback redirect does reach them. + */ +async function chooseLoginFlow( + profile: ResolvedProfile, + options: LoginOptions, + scope: CliAuthScope +): Promise<'oauth' | 'handoff'> { + if (options.browserless || scope === 'copilot') return 'handoff' + if (isLikelyRemoteSession() && options.callbackPort === undefined) { + console.log( + chalk.dim( + 'This looks like a remote session, so the browser on this machine cannot finish an OAuth login; using the pairing code instead. Forward a port and pass --callback-port to sign in through the browser anyway.\n' + ) + ) + return 'handoff' + } + const status = await discoverOAuthProvider(profile.endpoint) + if (status === 'unreachable') { + throw new SimApiError(`Could not reach ${profile.endpoint}. Check the endpoint.`, 0) + } + if (status === 'unavailable') { + console.log( + chalk.dim( + `${profile.endpoint} does not offer OAuth sign-in; using the pairing code instead.\n` + ) + ) + return 'handoff' + } + return 'oauth' +} + +function parseCallbackPort(value: string | undefined): number | undefined { + if (value === undefined) return undefined + const port = Number(value) + if (!Number.isInteger(port) || port < 1 || port > 65535) { + throw new SimApiError( + `Invalid --callback-port "${redact(value)}". Use a port from 1 to 65535.`, + 0 + ) + } + return port +} + +/** + * Authorization code + PKCE through the browser; see `oauth-flow.ts`. The + * profile's workspace default is left as it was: the consent page has no + * workspace picker, and `sim configure --set-workspace` is one command away. + */ +async function loginWithOAuth( + profile: ResolvedProfile, + options: LoginOptions, + callbackPort: number | undefined +): Promise { + console.log( + `Signing in to ${chalk.bold(profile.endpoint)} as profile ${chalk.bold(safeOneLine(profile.name))}` + ) + + const tokens = await loginWithBrowser(profile.endpoint, { + scopes: options.readOnly ? OAUTH_SCOPES_READ_ONLY : OAUTH_SCOPES_FULL, + callbackPort, + onAuthorizeUrl: (url) => { + console.log(`\n${url}`) + if (options.browser) openBrowser(url) + console.log(chalk.dim('\nWaiting for you to approve in the browser…')) + }, + }) + + requireStorableCredential(tokens.accessToken) + requireStorableCredential(tokens.refreshToken) + + await withCredentialsLock(async () => { + writeConfigProfile(profile.name, { endpoint: profile.endpoint }) + writeCredentialsProfile(profile.name, { + kind: 'oauth', + oauth: { + accessToken: tokens.accessToken, + refreshToken: tokens.refreshToken, + expiresAt: tokens.expiresAt, + }, + }) + }) + + console.log(chalk.green(`\n✓ Logged in. Login stored in ${credentialsPath()}`)) + /** + * Read back from the granted scope rather than the requested flag. The + * authorization server decides what it issued, and a person can narrow the + * grant on the consent page, so `--read-only` is a request and this is the + * answer. + */ + console.log( + chalk.dim( + grantsWriteAccess(tokens.scope) + ? ' Renews itself; revoke it any time in Settings → Authorized apps, or with: sim logout' + : ' Read-only login — commands that change anything will be refused.' + ) + ) + if (!profile.workspaceId) { + console.log( + chalk.dim(' No default workspace. Set one with: sim configure --set-workspace ') + ) + } +} + export function loginCommand(): Command { return new Command('login') - .description('Authorize this terminal and store an API key for the profile') - .option('--scope ', 'Key space to mint from: platform or copilot', 'platform') + .description('Sign in through the browser and store the login for the profile') + .option( + '--scope ', + 'Key space for the pairing-code handoff; only "copilot" changes anything, and it forces that flow', + 'platform' + ) .option('--no-browser', 'Print the URL instead of opening a browser') + .option( + '--browserless', + 'Use the pairing-code handoff for a terminal whose browser cannot reach it (SSH, containers)' + ) + .option('--read-only', 'Ask only for permission to read, never to change anything') + .option('--callback-port ', 'Pin the local port the browser returns to') .option('-y, --yes', 'Overwrite an existing profile without prompting') - .action( - async (options: { scope: string; browser: boolean; yes?: boolean }, command: Command) => { - // `login --profile x` is how a profile comes into existence, so the name - // is allowed to be one resolution would otherwise reject as unknown. - const profile = profileFrom(command, { allowUnknownProfile: true }) - const authProfile = resolveAuthenticationProfileName(profile.name) - - if (authProfile !== profile.name) { - throw new SimApiError( - `Profile "${redact(profile.name)}" shares authentication with "${redact(authProfile)}". Run: sim login --profile ${redact(authProfile)}`, - 0 - ) - } + .action(async (options: LoginOptions, command: Command) => { + // `login --profile x` is how a profile comes into existence, so the name + // is allowed to be one resolution would otherwise reject as unknown. + const profile = profileFrom(command, { allowUnknownProfile: true }) + const authProfile = resolveAuthenticationProfileName(profile.name) - if (options.scope !== 'platform' && options.scope !== 'copilot') { - throw new SimApiError(`Unknown scope "${options.scope}". Use platform or copilot.`, 0) - } - const scope = options.scope as CliAuthScope + if (authProfile !== profile.name) { + throw new SimApiError( + `Profile "${redact(profile.name)}" shares authentication with "${redact(authProfile)}". Run: sim login --profile ${redact(authProfile)}`, + 0 + ) + } - if (readCredentialsProfile(profile.name).api_key && !options.yes) { - const confirmed = await confirmProfileOverwrite(profile.name) - if (!confirmed) { - console.log(chalk.dim('Login cancelled; the existing profile was not changed.')) - return - } + if (options.scope !== 'platform' && options.scope !== 'copilot') { + throw new SimApiError(`Unknown scope "${options.scope}". Use platform or copilot.`, 0) + } + const scope = options.scope as CliAuthScope + + if (readStoredCredential(profile.name) && !options.yes) { + const confirmed = await confirmProfileOverwrite(profile.name) + if (!confirmed) { + console.log(chalk.dim('Login cancelled; the existing profile was not changed.')) + return } + } - const auth = createAuthRequest() - const url = buildApprovalUrl( - profile.endpoint, - auth, - scope, - profile.workspaceId ?? undefined - ) + // Parsed before either flow runs, so a malformed port is reported as + // itself rather than after a browser has already opened. + const callbackPort = parseCallbackPort(options.callbackPort) - console.log( - `Signing in to ${chalk.bold(profile.endpoint)} as profile ${chalk.bold(safeOneLine(profile.name))}` + if ((await chooseLoginFlow(profile, options, scope)) === 'oauth') { + await loginWithOAuth(profile, options, callbackPort) + return + } + /** + * Neither flag has a meaning in the handoff: it mints a permanent, + * full-power API key on the server and never opens a local listener. + * Honouring `--read-only` by ignoring it would hand back the opposite of + * what was asked for, so the whole login stops here rather than storing a + * credential the person did not agree to. + */ + if (options.readOnly) { + throw new SimApiError( + 'The pairing-code handoff cannot issue a read-only login; it mints a full API key. Drop --read-only, or sign in through the browser.', + 0 ) - console.log(`\nPairing code: ${chalk.bold(auth.pairing)}`) - console.log( - chalk.dim('Confirm this code matches what the browser shows before approving.\n') + } + if (callbackPort !== undefined) { + throw new SimApiError( + 'The pairing-code handoff has no local callback, so --callback-port does not apply. Drop it, or sign in through the browser.', + 0 ) - console.log(url) + } + await loginWithHandoff(profile, options, scope) + }) +} - if (options.browser) openBrowser(url) - console.log(chalk.dim('\nWaiting for approval…')) +/** The pairing-code handoff, which mints a permanent API key; see `device-flow.ts`. */ +async function loginWithHandoff( + profile: ResolvedProfile, + options: LoginOptions, + scope: CliAuthScope +): Promise { + const auth = createAuthRequest() + const url = buildApprovalUrl(profile.endpoint, auth, scope, profile.workspaceId ?? undefined) + + console.log( + `Signing in to ${chalk.bold(profile.endpoint)} as profile ${chalk.bold(safeOneLine(profile.name))}` + ) + console.log(`\nPairing code: ${chalk.bold(auth.pairing)}`) + console.log(chalk.dim('Confirm this code matches what the browser shows before approving.\n')) + console.log(url) - const key = await pollForKey(profile.endpoint, auth) + if (options.browser) openBrowser(url) + console.log(chalk.dim('\nWaiting for approval…')) - if (key.scope !== scope) { - // The approval, not the request, decides the scope. Storing a copilot - // key where a platform key belongs would fail every later call with an - // unexplained 401, so refuse now with the reason. - throw new SimApiError( - `Server issued a ${key.scope} key but this profile needs a ${scope} key. Update the Sim deployment, or run: sim login --scope ${key.scope}`, - 0 - ) - } + const key = await pollForKey(profile.endpoint, auth) - // The workspace picked in the browser becomes the profile's default, - // whether or not the key is scoped to it. The user chose it by name — - // making them look up its id afterwards would waste the one moment the - // answer was already on screen. It arrives off the wire, so it is - // checked before either file is touched. - // - // Absence is the whole of "no workspace" here, and it is a legitimate - // outcome — a personal key with nothing selected in the browser. A - // *present* value is a workspace id, so every one of them goes to - // `normalizeWorkspaceId` to be accepted or refused by name. Testing - // truthiness instead let an empty string through the absent branch, so - // a malformed response was quietly stored as "no workspace" rather than - // reported. - const settings: Record = { - endpoint: profile.endpoint, - workspace: - key.workspaceId == null - ? null - : normalizeWorkspaceId(key.workspaceId, 'the login response'), - } - requireStorableKey(key.apiKey) - - // Config before credentials: the endpoint decides where the key is sent - // later. Storing the key first and then failing on the settings left a - // key on disk with no endpoint beside it, so the next command fell back - // to the default host — sending a self-hosted key somewhere else. - writeConfigProfile(profile.name, settings) - writeCredentialsProfile(profile.name, key.apiKey) - - console.log(chalk.green(`\n✓ Logged in. Key stored in ${credentialsPath()}`)) - if (key.workspaceBound && key.workspaceId) { - console.log(chalk.dim(` Workspace-scoped key — it can only reach ${key.workspaceId}.`)) - } else if (key.workspaceId) { - console.log( - chalk.dim( - ` Personal key, defaulting to ${key.workspaceId}. Override per command with --workspace.` - ) - ) - } else { - console.log( - chalk.dim( - ' Personal key with no default workspace. Set one with: sim configure --set-workspace ' - ) - ) - } - } + if (key.scope !== scope) { + // The approval, not the request, decides the scope. Storing a copilot + // key where a platform key belongs would fail every later call with an + // unexplained 401, so refuse now with the reason. + throw new SimApiError( + `Server issued a ${key.scope} key but this profile needs a ${scope} key. Update the Sim deployment, or run: sim login --scope ${key.scope}`, + 0 + ) + } + + // The workspace picked in the browser becomes the profile's default, + // whether or not the key is scoped to it. The user chose it by name — + // making them look up its id afterwards would waste the one moment the + // answer was already on screen. It arrives off the wire, so it is + // checked before either file is touched. + // + // Absence is the whole of "no workspace" here, and it is a legitimate + // outcome — a personal key with nothing selected in the browser. A + // *present* value is a workspace id, so every one of them goes to + // `normalizeWorkspaceId` to be accepted or refused by name. Testing + // truthiness instead let an empty string through the absent branch, so + // a malformed response was quietly stored as "no workspace" rather than + // reported. + const settings: Record = { + endpoint: profile.endpoint, + workspace: + key.workspaceId == null ? null : normalizeWorkspaceId(key.workspaceId, 'the login response'), + } + requireStorableCredential(key.apiKey) + + // Config before credentials: the endpoint decides where the key is sent + // later. Storing the key first and then failing on the settings left a + // key on disk with no endpoint beside it, so the next command fell back + // to the default host — sending a self-hosted key somewhere else. + await withCredentialsLock(async () => { + writeConfigProfile(profile.name, settings) + writeCredentialsProfile(profile.name, { kind: 'api_key', apiKey: key.apiKey }) + }) + + console.log(chalk.green(`\n✓ Logged in. Key stored in ${credentialsPath()}`)) + if (key.workspaceBound && key.workspaceId) { + console.log(chalk.dim(` Workspace-scoped key — it can only reach ${key.workspaceId}.`)) + } else if (key.workspaceId) { + console.log( + chalk.dim( + ` Personal key, defaulting to ${key.workspaceId}. Override per command with --workspace.` + ) + ) + } else { + console.log( + chalk.dim( + ' Personal key with no default workspace. Set one with: sim configure --set-workspace ' + ) ) + } +} + +/** + * Ends an OAuth login server-side before forgetting it locally, so the + * tokens on disk are dead even if a copy of the file survives. Best effort: + * an unreachable server must not stop a user from clearing their own machine, + * but it is said out loud so nobody assumes the session was revoked. + */ +async function revokeStoredOAuth(profileName: string, endpoint: string): Promise { + const credential = readStoredCredential(profileName) + if (credential?.kind !== 'oauth') return + try { + await revokeToken(endpoint, credential.oauth.refreshToken) + console.log(chalk.dim(' Signed out of Sim; the login can no longer be renewed.')) + } catch (error) { + console.log( + chalk.yellow( + ` Could not revoke the login on ${endpoint} (${safeOneLine(getErrorMessage(error))}). Revoke it in Settings → Authorized apps.` + ) + ) + } } export function logoutCommand(): Command { return new Command('logout') - .description("Remove the profile's stored API key") + .description("Sign out and remove the profile's stored login") .option('--all', 'Remove the profile entirely, including its settings') - .action((options: { all?: boolean }, command: Command) => { + .action(async (options: { all?: boolean }, command: Command) => { if (options.all) { const profileName = selectedProfileName(command) const dependents = listAuthenticationDependents(profileName) @@ -391,7 +584,8 @@ export function logoutCommand(): Command { 0 ) } - const removed = deleteProfile(profileName) + await revokeStoredOAuth(profileName, profileFrom(command).endpoint) + const removed = await withCredentialsLock(async () => deleteProfile(profileName)) if (!removed.config && !removed.credentials) { console.log(chalk.dim(`Nothing stored for profile "${safeOneLine(profileName)}".`)) return @@ -409,18 +603,24 @@ export function logoutCommand(): Command { ) } - if (!readCredentialsProfile(profile.name).api_key) { - console.log(chalk.dim(`No stored key for profile "${safeOneLine(profile.name)}".`)) + const credential = readStoredCredential(profile.name) + if (!credential) { + console.log(chalk.dim(`No stored login for profile "${safeOneLine(profile.name)}".`)) return } - writeCredentialsProfile(profile.name, null) + await revokeStoredOAuth(profile.name, profile.endpoint) + await withCredentialsLock(async () => writeCredentialsProfile(profile.name, null)) console.log( - chalk.green(`✓ Removed the stored key for profile "${safeOneLine(profile.name)}".`) + chalk.green(`✓ Removed the stored login for profile "${safeOneLine(profile.name)}".`) ) - // The key still exists server-side; leaving that unsaid invites the - // assumption that logging out revoked it. - console.log(chalk.dim(' The key itself is still active — revoke it in Settings → API keys.')) + if (credential.kind === 'api_key') { + // The key still exists server-side; leaving that unsaid invites the + // assumption that logging out revoked it. + console.log( + chalk.dim(' The key itself is still active — revoke it in Settings → API keys.') + ) + } }) } @@ -520,12 +720,12 @@ async function verifyProfile( client: Pick, profile: ResolvedProfile ): Promise { - if (!profile.apiKey) { + if (!profile.apiKey && !profile.oauth) { return { status: 'unauthenticated', workspace: null, keyType: null, - detail: `no API key — run: sim login --profile ${safeOneLine(profile.name)}`, + detail: `not logged in — run: sim login --profile ${safeOneLine(profile.name)}`, } } @@ -592,7 +792,7 @@ export function whoamiCommand(): Command { .action(async (options: { verify: boolean }, command: Command) => { const { client, profile } = clientFrom(command) const { sources } = profile - const authentication = presentAuthentication(sources.apiKey) + const authentication = presentAuthentication(sources.credential) const verification: Verification = options.verify ? await verifyProfile(client, profile) @@ -612,9 +812,9 @@ export function whoamiCommand(): Command { ['Profile', profile.name], ['Endpoint', annotate(profile.endpoint, sources.endpoint)], [ - 'API key', + 'Login', authentication.authenticated - ? annotate('configured', authentication.source) + ? annotate(profile.oauth ? 'OAuth' : 'API key', authentication.source) : chalk.yellow('not logged in'), ], [ @@ -683,7 +883,7 @@ function buildProfileRow(name: string, active: boolean): ProfileRow { return { name, active, - hasKey: Boolean(readCredentialsProfile(authProfile).api_key), + hasKey: readStoredCredential(authProfile) !== null, authProfile, error: null, } diff --git a/packages/sim-cli/src/commands/configure.test.ts b/packages/sim-cli/src/commands/configure.test.ts index 05bb5187098..7daf87ff842 100644 --- a/packages/sim-cli/src/commands/configure.test.ts +++ b/packages/sim-cli/src/commands/configure.test.ts @@ -81,7 +81,7 @@ describe('configure --set-endpoint', () => { it('refuses to set an endpoint locally on a shared workspace profile', async () => { writeConfigProfile('default', { endpoint: 'https://sim.example' }) - writeCredentialsProfile('default', 'stored-key') + writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'stored-key' }) writeConfigProfile('acme', { auth_profile: 'default', workspace: 'ws_acme' }) mocks.profileName = 'acme' diff --git a/packages/sim-cli/src/config/index.ts b/packages/sim-cli/src/config/index.ts index 414ea6abfee..4ff0d8d6a1f 100644 --- a/packages/sim-cli/src/config/index.ts +++ b/packages/sim-cli/src/config/index.ts @@ -16,10 +16,15 @@ export { type ResolvedProfile, readConfigProfile, readCredentialsProfile, + readStoredCredential, + readStoredOAuth, resolveAuthenticationProfileName, resolveProfile, type SettingSource, + type StoredCredential, + type StoredOAuthCredential, validateProfileName, + withCredentialsLock, writeConfigProfile, writeCredentialsProfile, } from './profile' diff --git a/packages/sim-cli/src/config/profile.test.ts b/packages/sim-cli/src/config/profile.test.ts index 26974605938..562228a7ca2 100644 --- a/packages/sim-cli/src/config/profile.test.ts +++ b/packages/sim-cli/src/config/profile.test.ts @@ -1,7 +1,16 @@ -import { existsSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs' +import { + existsSync, + mkdtempSync, + readFileSync, + rmSync, + statSync, + utimesSync, + writeFileSync, +} from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, beforeEach, describe, expect, it } from 'vitest' +import { sleep } from '../helpers' import { configPath, credentialsPath } from './paths' import { DEFAULT_ENDPOINT, @@ -11,9 +20,11 @@ import { listProfiles, OUTPUT_FORMATS, ProfileOverrideError, + readStoredCredential, resolveAuthenticationProfileName, resolveProfile, validateProfileName, + withCredentialsLock, writeConfigProfile, writeCredentialsProfile, } from './profile' @@ -40,23 +51,23 @@ describe('profile resolution', () => { expect(profile.endpoint).toBe('https://www.sim.ai') expect(profile.apiKey).toBeNull() expect(profile.output).toBe('table') - expect(profile.sources.apiKey).toBe('unset') + expect(profile.sources.credential).toBe('unset') }) it('reads settings and credentials for the default profile', () => { writeConfigProfile('default', { endpoint: 'https://a.example', workspace: 'ws_1' }) - writeCredentialsProfile('default', 'sim_key') + writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'sim_key' }) const profile = resolveProfile() expect(profile.endpoint).toBe('https://a.example') expect(profile.workspaceId).toBe('ws_1') expect(profile.apiKey).toBe('sim_key') - expect(profile.sources).toMatchObject({ endpoint: 'config', apiKey: 'credentials' }) + expect(profile.sources).toMatchObject({ endpoint: 'config', credential: 'credentials' }) }) it('namespaces a non-default profile as [profile x] in config but [x] in credentials', () => { writeConfigProfile('dev', { endpoint: 'http://localhost:3000' }) - writeCredentialsProfile('dev', 'sim_dev') + writeCredentialsProfile('dev', { kind: 'api_key', apiKey: 'sim_dev' }) expect(readFileSync(configPath(), 'utf8')).toContain('[profile dev]') expect(readFileSync(credentialsPath(), 'utf8')).toContain('[dev]') @@ -65,9 +76,9 @@ describe('profile resolution', () => { it('keeps profiles isolated from one another', () => { writeConfigProfile('default', { endpoint: 'https://a.example', workspace: 'ws_a' }) - writeCredentialsProfile('default', 'key_a') + writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'key_a' }) writeConfigProfile('dev', { endpoint: 'http://localhost:3000', workspace: 'ws_b' }) - writeCredentialsProfile('dev', 'key_b') + writeCredentialsProfile('dev', { kind: 'api_key', apiKey: 'key_b' }) expect(resolveProfile()).toMatchObject({ workspaceId: 'ws_a', apiKey: 'key_a' }) expect(resolveProfile({ profile: 'dev' })).toMatchObject({ @@ -78,7 +89,7 @@ describe('profile resolution', () => { it('keeps existing profiles self-authenticating when auth_profile is absent', () => { writeConfigProfile('dev', { endpoint: 'https://dev.example', workspace: 'ws_dev' }) - writeCredentialsProfile('dev', 'key_dev') + writeCredentialsProfile('dev', { kind: 'api_key', apiKey: 'key_dev' }) expect(resolveAuthenticationProfileName('dev')).toBe('dev') expect(resolveProfile({ profile: 'dev' })).toMatchObject({ @@ -94,7 +105,7 @@ describe('profile resolution', () => { workspace: 'ws_default', output: 'yaml', }) - writeCredentialsProfile('default', 'key_default') + writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'key_default' }) writeConfigProfile('acme', { auth_profile: 'default', workspace: 'ws_acme', @@ -112,7 +123,7 @@ describe('profile resolution', () => { endpoint: 'config', workspaceId: 'config', output: 'config', - apiKey: 'credentials', + credential: 'credentials', }, }) }) @@ -136,7 +147,7 @@ describe('profile resolution', () => { ) writeConfigProfile('base', { auth_profile: 'root' }) - writeCredentialsProfile('root', 'key_root') + writeCredentialsProfile('root', { kind: 'api_key', apiKey: 'key_root' }) writeConfigProfile('chained', { auth_profile: 'base' }) expect(() => resolveProfile({ profile: 'chained' })).toThrow( 'Profile "chained" references auth_profile "base", which also has auth_profile set.' @@ -144,7 +155,7 @@ describe('profile resolution', () => { }) it('rejects ambiguous local authentication settings on a shared profile', () => { - writeCredentialsProfile('default', 'key_default') + writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'key_default' }) writeConfigProfile('endpoint-alias', { auth_profile: 'default', endpoint: 'https://other.example', @@ -154,9 +165,9 @@ describe('profile resolution', () => { ) writeConfigProfile('key-alias', { auth_profile: 'default' }) - writeCredentialsProfile('key-alias', 'key_alias') + writeCredentialsProfile('key-alias', { kind: 'api_key', apiKey: 'key_alias' }) expect(() => resolveProfile({ profile: 'key-alias' })).toThrow( - 'Profile "key-alias" cannot set both auth_profile and its own API key.' + 'Profile "key-alias" cannot set both auth_profile and its own login. Remove one of them.' ) }) @@ -176,7 +187,7 @@ describe('profile resolution', () => { }) it('selects the profile from SIM_PROFILE when no flag is given', () => { - writeCredentialsProfile('dev', 'key_dev') + writeCredentialsProfile('dev', { kind: 'api_key', apiKey: 'key_dev' }) process.env.SIM_PROFILE = 'dev' expect(resolveProfile()).toMatchObject({ name: 'dev', apiKey: 'key_dev' }) expect(resolveProfile({ profile: 'default' }).name).toBe('default') @@ -186,7 +197,7 @@ describe('profile resolution', () => { // A typo used to fall through to the built-in defaults, so `--profile // stagng` talked to https://www.sim.ai and handed it whatever key resolved. writeConfigProfile('staging', { endpoint: 'https://staging.example' }) - writeCredentialsProfile('staging', 'key_staging') + writeCredentialsProfile('staging', { kind: 'api_key', apiKey: 'key_staging' }) expect(() => resolveProfile({ profile: 'stagng' })).toThrow( 'Unknown profile "stagng". Did you mean "staging"? Configured profiles: staging.' @@ -223,7 +234,7 @@ describe('profile resolution', () => { }) it('accepts a profile that exists in only one of the two files', () => { - writeCredentialsProfile('creds-only', 'key') + writeCredentialsProfile('creds-only', { kind: 'api_key', apiKey: 'key' }) writeConfigProfile('config-only', { workspace: 'ws_1' }) expect(resolveProfile({ profile: 'creds-only' }).apiKey).toBe('key') @@ -361,21 +372,21 @@ describe('profile resolution', () => { it('writes credentials 0600 even when the file already existed world-readable', () => { writeFileSync(credentialsPath(), '', { mode: 0o644 }) - writeCredentialsProfile('default', 'sim_key') + writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'sim_key' }) expect(statSync(credentialsPath()).mode & 0o777).toBe(0o600) }) it('lists profiles from both files without duplicating', () => { writeConfigProfile('default', { endpoint: 'https://a.example' }) writeConfigProfile('dev', { endpoint: 'http://localhost:3000' }) - writeCredentialsProfile('dev', 'key') - writeCredentialsProfile('ci', 'key') + writeCredentialsProfile('dev', { kind: 'api_key', apiKey: 'key' }) + writeCredentialsProfile('ci', { kind: 'api_key', apiKey: 'key' }) expect(listProfiles()).toEqual(['ci', 'default', 'dev']) }) it('lists direct authentication dependents without treating a bad self-reference as one', () => { - writeCredentialsProfile('default', 'key') + writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'key' }) writeConfigProfile('acme', { auth_profile: 'default', workspace: 'ws_acme' }) writeConfigProfile('beta', { auth_profile: 'default', workspace: 'ws_beta' }) writeConfigProfile('broken', { auth_profile: 'broken' }) @@ -386,7 +397,7 @@ describe('profile resolution', () => { it('deletes a profile from both files', () => { writeConfigProfile('dev', { endpoint: 'http://localhost:3000' }) - writeCredentialsProfile('dev', 'key') + writeCredentialsProfile('dev', { kind: 'api_key', apiKey: 'key' }) expect(deleteProfile('dev')).toEqual({ config: true, credentials: true }) expect(listProfiles()).toEqual([]) @@ -395,7 +406,7 @@ describe('profile resolution', () => { it('clears just the key when the credential is removed', () => { writeConfigProfile('dev', { endpoint: 'http://localhost:3000' }) - writeCredentialsProfile('dev', 'key') + writeCredentialsProfile('dev', { kind: 'api_key', apiKey: 'key' }) writeCredentialsProfile('dev', null) expect(resolveProfile({ profile: 'dev' })).toMatchObject({ @@ -475,18 +486,18 @@ describe('config file injection', () => { it('refuses the same through the credentials file', () => { // The credentials reader merges duplicate sections too, so a forged // `[victim]` block there would be read as a real key. - expect(() => writeCredentialsProfile(FORGED_SECTION, 'key_evil')).toThrow( - /Refusing to write a section/ - ) - expect(() => writeCredentialsProfile('default', 'key\napi_key = other')).toThrow( - /Refusing to write a value/ - ) + expect(() => + writeCredentialsProfile(FORGED_SECTION, { kind: 'api_key', apiKey: 'key_evil' }) + ).toThrow(/Refusing to write a section/) + expect(() => + writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'key\napi_key = other' }) + ).toThrow(/Refusing to write a value/) expect(existsSync(credentialsPath())).toBe(false) }) it('leaves an ordinary profile name and value writable', () => { writeConfigProfile('staging-1.eu', { endpoint: 'https://staging.example' }) - writeCredentialsProfile('staging-1.eu', 'sim_key') + writeCredentialsProfile('staging-1.eu', { kind: 'api_key', apiKey: 'sim_key' }) expect(resolveProfile({ profile: 'staging-1.eu' })).toMatchObject({ endpoint: 'https://staging.example', @@ -635,3 +646,98 @@ describe('redaction of rejected values', () => { expect(message).not.toMatch(FORBIDDEN_IN_VALUE) }) }) + +describe('OAuth logins in the credentials file', () => { + const OAUTH = { + accessToken: 'sim_oat_a', + refreshToken: 'sim_ort_r', + expiresAt: 1_800_000_000_000, + } + + it('stores and resolves an OAuth login, with the file kept private', () => { + writeCredentialsProfile('default', { kind: 'oauth', oauth: OAUTH }) + + const profile = resolveProfile() + expect(profile.oauth).toEqual(OAUTH) + expect(profile.apiKey).toBeNull() + expect(profile.sources.credential).toBe('credentials') + expect(readStoredCredential('default')).toEqual({ kind: 'oauth', oauth: OAUTH }) + expect(statSync(credentialsPath()).mode & 0o777).toBe(0o600) + }) + + it('replaces a stored key when an OAuth login is written, and vice versa', () => { + writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'sim_key' }) + writeCredentialsProfile('default', { kind: 'oauth', oauth: OAUTH }) + expect(readFileSync(credentialsPath(), 'utf8')).not.toContain('api_key') + + writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'sim_key_2' }) + const file = readFileSync(credentialsPath(), 'utf8') + expect(file).not.toContain('access_token') + expect(file).not.toContain('refresh_token') + expect(resolveProfile().apiKey).toBe('sim_key_2') + }) + + it('lets an explicit SIM_API_KEY outrank the stored login', () => { + writeCredentialsProfile('default', { kind: 'oauth', oauth: OAUTH }) + process.env.SIM_API_KEY = 'ci_key' + + const profile = resolveProfile() + expect(profile.apiKey).toBe('ci_key') + expect(profile.oauth).toBeNull() + expect(profile.sources.credential).toBe('env') + }) + + it('treats a hand-edited section missing its refresh token as logged out', () => { + writeCredentialsProfile('default', { kind: 'oauth', oauth: OAUTH }) + const file = readFileSync(credentialsPath(), 'utf8').replace(/refresh_token = .*\n/, '') + writeFileSync(credentialsPath(), file) + + expect(readStoredCredential('default')).toBeNull() + expect(resolveProfile().oauth).toBeNull() + }) + + it('serializes credential rewrites through the lock and releases it afterwards', async () => { + const order: string[] = [] + await Promise.all([ + withCredentialsLock(async () => { + order.push('a-start') + await sleep(30) + order.push('a-end') + }), + withCredentialsLock(async () => { + order.push('b-start') + order.push('b-end') + }), + ]) + expect(order).toEqual(['a-start', 'a-end', 'b-start', 'b-end']) + expect(existsSync(`${credentialsPath()}.lock`)).toBe(false) + }) + + it('reclaims a lock left behind by a process that died holding it', async () => { + const lockPath = `${credentialsPath()}.lock` + writeFileSync(lockPath, '999.deadbeef', { mode: 0o600 }) + // Older than the 30s stale window, so the holder is presumed gone. + const dead = new Date(Date.now() - 60_000) + utimesSync(lockPath, dead, dead) + + await expect(withCredentialsLock(async () => 'ran')).resolves.toBe('ran') + expect(existsSync(lockPath)).toBe(false) + }) + + /** + * A hold that outran the stale window has already been reclaimed, and the + * file now belongs to whoever took it. Removing it on the way out would + * strand that holder — and two unlocked refreshes are what make the server + * treat the rotated token as theft and revoke the whole session. + */ + it('does not drop a lock that was reclaimed out from under it', async () => { + const lockPath = `${credentialsPath()}.lock` + + await withCredentialsLock(async () => { + writeFileSync(lockPath, 'a-later-holder', { mode: 0o600 }) + }) + + expect(existsSync(lockPath)).toBe(true) + expect(readFileSync(lockPath, 'utf8')).toBe('a-later-holder') + }) +}) diff --git a/packages/sim-cli/src/config/profile.ts b/packages/sim-cli/src/config/profile.ts index 7cbcaeb46d6..c7db0f69bb0 100644 --- a/packages/sim-cli/src/config/profile.ts +++ b/packages/sim-cli/src/config/profile.ts @@ -1,5 +1,17 @@ -import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs' +import { AsyncLocalStorage } from 'node:async_hooks' +import { randomBytes } from 'node:crypto' +import { + chmodSync, + existsSync, + mkdirSync, + readFileSync, + renameSync, + rmSync, + statSync, + writeFileSync, +} from 'node:fs' import { dirname } from 'node:path' +import { sleep } from '../helpers' import { FORBIDDEN_IN_VALUE, getSection, @@ -101,17 +113,43 @@ export function validateProfileName(name: string): void { } } +/** + * An OAuth login stored in the credentials file: the short-lived access token + * the API reads, the rotating refresh token that renews it, and when the + * access token lapses (epoch milliseconds). + */ +export interface StoredOAuthCredential { + accessToken: string + refreshToken: string + expiresAt: number +} + +/** What a credentials section holds for a profile, or `null` when it is logged out. */ +export type StoredCredential = + | { kind: 'api_key'; apiKey: string } + | { kind: 'oauth'; oauth: StoredOAuthCredential } + /** Everything a command needs to make a call, after the resolution chain runs. */ export interface ResolvedProfile { name: string endpoint: string + /** The profile whose credentials section authenticates this one (itself, or its `auth_profile`). */ + authProfile: string + /** + * An API key, from a flag, the environment, or the credentials file. Null + * when the profile authenticates through {@link oauth} instead — the two are + * exclusive: a stored OAuth login wins over a stored key, and an explicit + * `--api-key`/`SIM_API_KEY` wins over both. + */ apiKey: string | null + oauth: StoredOAuthCredential | null workspaceId: string | null output: OutputFormat /** Where each value came from, for `sim whoami` to explain surprising results. */ sources: { endpoint: SettingSource - apiKey: SettingSource + /** Where the profile's credential came from, whichever kind it is. */ + credential: SettingSource workspaceId: SettingSource output: SettingSource } @@ -150,11 +188,28 @@ function readIni(path: string): IniDocument { function writeIni(path: string, doc: IniDocument, secret: boolean): void { mkdirSync(dirname(path), { recursive: true, mode: 0o700 }) - writeFileSync(path, serializeIni(doc), { mode: secret ? 0o600 : 0o644 }) - // `writeFileSync`'s mode only applies when it creates the file, so an existing - // credentials file written before this ran (or created by a hand `touch`) - // keeps its old, possibly world-readable, permissions without this. - if (secret) chmodSync(path, 0o600) + if (!secret) { + writeFileSync(path, serializeIni(doc), { mode: 0o644 }) + return + } + + /** + * Written to a fresh 0600 file and renamed into place, so a credential never + * exists at a wider mode even for an instant: `writeFileSync`'s `mode` only + * applies when it creates the file, so writing over an existing 0644 file + * (one made by a hand `touch`, or by a version of this that predates the + * mode) left the tokens readable until the `chmod` landed. The rename is + * atomic, so a reader also never sees a half-written file. + */ + const temporary = `${path}.${process.pid}.tmp` + try { + writeFileSync(temporary, serializeIni(doc), { mode: 0o600 }) + chmodSync(temporary, 0o600) + renameSync(temporary, path) + } catch (error) { + rmSync(temporary, { force: true }) + throw error + } } export function readConfigProfile(profile: string): Record { @@ -191,9 +246,9 @@ export function resolveAuthenticationProfileName(profile: string): string { `Profile "${redact(profile)}" cannot set both auth_profile and endpoint. Set the endpoint on authentication profile "${redact(authProfile)}".` ) } - if (readCredentialsProfile(profile).api_key) { + if (readStoredCredential(profile)) { throw new ProfileConfigError( - `Profile "${redact(profile)}" cannot set both auth_profile and its own API key. Remove one of them.` + `Profile "${redact(profile)}" cannot set both auth_profile and its own login. Remove one of them.` ) } @@ -318,12 +373,189 @@ export function writeConfigProfile(profile: string, values: Record = Object.fromEntries( + CREDENTIAL_KEYS.map((key) => [key, null]) + ) + if (credential?.kind === 'api_key') { + values.api_key = credential.apiKey + } else if (credential?.kind === 'oauth') { + values.access_token = credential.oauth.accessToken + values.refresh_token = credential.oauth.refreshToken + values.token_expires_at = String(credential.oauth.expiresAt) + } + setSectionValues(doc, profile, values) writeIni(credentialsPath(), doc, true) } +/** + * The OAuth login a credentials section holds, or `null` when it holds none or + * only part of one. A hand-edited section missing its refresh token is treated + * as logged out rather than as a login that will fail on its first refresh. + */ +export function readStoredOAuth(credentials: Record): StoredOAuthCredential | null { + const { + access_token: accessToken, + refresh_token: refreshToken, + token_expires_at: expires, + } = credentials + if (!accessToken || !refreshToken) return null + const expiresAt = Number(expires) + return { accessToken, refreshToken, expiresAt: Number.isFinite(expiresAt) ? expiresAt : 0 } +} + +/** What the named profile's own credentials section holds. */ +export function readStoredCredential(profile: string): StoredCredential | null { + const credentials = readCredentialsProfile(profile) + const oauth = readStoredOAuth(credentials) + if (oauth) return { kind: 'oauth', oauth } + if (credentials.api_key) return { kind: 'api_key', apiKey: credentials.api_key } + return null +} + +const CREDENTIALS_LOCK_STALE_MS = 30_000 +/** + * Long enough to outlast the slowest legitimate hold. + * + * The holder is refreshing tokens, which is bounded by the refresh request's + * own 10s timeout plus the write. Waiting less than that made an ordinary slow + * token endpoint — a cold start, a deploy cutover — fail every *other* `sim` + * process outright while the first one was still doing exactly what it should. + * It stays under {@link CREDENTIALS_LOCK_STALE_MS} so a genuinely dead holder + * is still reclaimed rather than waited out. + */ +const CREDENTIALS_LOCK_WAIT_MS = 20_000 +const CREDENTIALS_LOCK_POLL_MS = 50 + +/** + * Serializes credential rewrites across `sim` processes. + * + * A refresh token is single-use: the server rotates it and treats a second + * presentation as theft, revoking every token the CLI holds. Two commands run + * in parallel — a shell loop, a CI matrix, an editor plugin — would each see + * the same expiring token and both try to refresh it, and the loser logs the + * user out everywhere. The lock is an `O_EXCL` file beside the credentials, so + * exactly one process refreshes and the rest re-read what it wrote. A lock + * older than {@link CREDENTIALS_LOCK_STALE_MS} belonged to a process that + * died holding it and is reclaimed. + */ +/** + * Whether the current async context already holds the lock. + * + * Re-entrancy has to follow the *call chain*, not the process: a nested write + * inside a refresh must not deadlock on a lock its own caller is holding, while + * two unrelated `withCredentialsLock` calls running concurrently in the same + * process must still serialize. A module-level flag cannot tell those apart — + * `AsyncLocalStorage` can, because only work started inside the holder sees the + * store. + */ +const heldLock = new AsyncLocalStorage() + +export async function withCredentialsLock(work: () => Promise): Promise { + if (heldLock.getStore()) return work() + + const lockPath = `${credentialsPath()}.lock` + mkdirSync(dirname(lockPath), { recursive: true, mode: 0o700 }) + const deadline = Date.now() + CREDENTIALS_LOCK_WAIT_MS + const owner = `${process.pid}.${randomBytes(8).toString('hex')}` + + for (;;) { + try { + writeFileSync(lockPath, owner, { flag: 'wx', mode: 0o600 }) + break + } catch (error) { + if ((error as NodeJS.ErrnoException).code !== 'EEXIST') throw error + let observed: { owner: string; age: number } + try { + observed = { + owner: readFileSync(lockPath, 'utf8'), + age: Date.now() - statSync(lockPath).mtimeMs, + } + } catch { + continue + } + if (observed.age > CREDENTIALS_LOCK_STALE_MS) { + reclaimStaleCredentialsLock(lockPath, observed.owner) + continue + } + if (Date.now() > deadline) { + throw new ProfileConfigError( + `Another sim process has been refreshing the login for ${Math.round(observed.age / 1000)}s. Wait for it to finish and retry.` + ) + } + await sleep(CREDENTIALS_LOCK_POLL_MS) + } + } + + try { + return await heldLock.run(true, work) + } finally { + releaseCredentialsLock(lockPath, owner) + } +} + +/** + * Removes a lock only if it still holds the token the caller saw. + * + * Staleness is observed and acted on in two steps, so a waiter can be + * preempted between them and come back to a lock that a third process has + * since taken. Deleting on age alone would then drop a *live* lock and let two + * refreshes run, which is the one outcome this file exists to prevent — the + * server treats the second presentation of a rotated refresh token as theft + * and revokes the whole session. Re-reading the token immediately before + * removing closes that: if it changed, the lock is not the one that looked + * dead, and the caller simply retries. + * + * Not airtight on its own — the read and the unlink are themselves two steps — + * so the removal goes through a rename to a private name first. Between them a + * competing reclaimer either loses the rename or sees a token that no longer + * matches, and only one can do both. + */ +function reclaimStaleCredentialsLock(lockPath: string, observedOwner: string): void { + const scratch = `${lockPath}.${process.pid}.${randomBytes(4).toString('hex')}.stale` + try { + renameSync(lockPath, scratch) + } catch { + return + } + try { + if (readFileSync(scratch, 'utf8') !== observedOwner) { + // Someone else's live lock: put it back rather than destroying it. + renameSync(scratch, lockPath) + return + } + } catch {} + rmSync(scratch, { force: true }) +} + +/** + * Drops the lock only if this process still owns it. + * + * A hold that ran past the stale window has already been reclaimed by someone + * else, and the file now belongs to them; removing it on the way out would + * strand that holder without a lock. + */ +function releaseCredentialsLock(lockPath: string, owner: string): void { + try { + if (readFileSync(lockPath, 'utf8') !== owner) return + } catch { + return + } + rmSync(lockPath, { force: true }) +} + /** Drops the profile from both files. Returns whether anything was removed. */ export function deleteProfile(profile: string): { config: boolean; credentials: boolean } { const configDoc = readIni(configPath()) @@ -498,15 +730,20 @@ export function resolveProfile(overrides: ProfileOverrides = {}): ResolvedProfil 'default' ) + const storedOAuth = readStoredOAuth(credentials) const apiKey = resolve( [ ['flag', overrides.apiKey], ['env', process.env.SIM_API_KEY], - ['credentials', credentials.api_key], + // A stored OAuth login outranks a stored key — a write of either clears + // the other, so both present means a hand-edited file, and the login is + // the one `sim login` would have left. + ['credentials', storedOAuth ? null : credentials.api_key], ], null, 'unset' ) + const oauth = apiKey.value === null ? storedOAuth : null const workspaceId = resolve( [ @@ -536,12 +773,14 @@ export function resolveProfile(overrides: ProfileOverrides = {}): ResolvedProfil return { name, endpoint: normalizeEndpoint(endpoint.value as string, endpoint.source), + authProfile, apiKey: apiKey.value, + oauth, workspaceId: workspaceId.value, output: output.value as OutputFormat, sources: { endpoint: endpoint.source, - apiKey: apiKey.source, + credential: oauth ? 'credentials' : apiKey.source, workspaceId: workspaceId.source, output: output.source, }, diff --git a/packages/sim-cli/src/context.ts b/packages/sim-cli/src/context.ts index 61cc307a2b4..ef9c9e16447 100644 --- a/packages/sim-cli/src/context.ts +++ b/packages/sim-cli/src/context.ts @@ -1,4 +1,5 @@ import type { Command } from 'commander' +import { refreshStoredOAuth } from './auth/refresh' import { type OutputFormat, type ProfileOverrides, @@ -37,5 +38,5 @@ export function profileFrom(command: Command, extra: ProfileOverrides = {}): Res export function clientFrom(command: Command): { client: SimClient; profile: ResolvedProfile } { const profile = profileFrom(command) - return { client: new SimClient(profile), profile } + return { client: new SimClient(profile, { refreshOAuth: refreshStoredOAuth }), profile } } diff --git a/packages/sim-cli/src/generated/v2-api.ts b/packages/sim-cli/src/generated/v2-api.ts index 5e93eedf761..a17e7570b65 100644 --- a/packages/sim-cli/src/generated/v2-api.ts +++ b/packages/sim-cli/src/generated/v2-api.ts @@ -4357,7 +4357,7 @@ export type GetMetaQuery = Record type GetMetaResponseRef0 = { v2Enabled: boolean - keyType: 'personal' | 'workspace' + keyType: 'personal' | 'workspace' | 'oauth_access_token' expiresAt: string | null } diff --git a/packages/sim-cli/src/http/client.test.ts b/packages/sim-cli/src/http/client.test.ts index a40341e5bd1..47e6480b7aa 100644 --- a/packages/sim-cli/src/http/client.test.ts +++ b/packages/sim-cli/src/http/client.test.ts @@ -23,12 +23,14 @@ function client(options: { apiKey?: string } = { apiKey: 'key' }): SimClient { return new SimClient({ name: 'default', endpoint: 'https://sim.example', + authProfile: 'default', apiKey: options.apiKey ?? null, + oauth: null, workspaceId: 'ws_1', output: 'json', sources: { endpoint: 'default', - apiKey: 'env', + credential: 'env', workspaceId: 'env', output: 'default', }, @@ -598,12 +600,14 @@ describe('API errors', () => { const client = new SimClient({ name: 'default', endpoint: 'https://sim.example', + authProfile: 'default', apiKey: 'key', + oauth: null, workspaceId: 'ws_1', output: 'json', sources: { endpoint: 'default', - apiKey: 'env', + credential: 'env', workspaceId: 'env', output: 'default', }, @@ -1111,3 +1115,151 @@ describe('destructive operations are gated', () => { } }) }) + +describe('OAuth bearer credentials', () => { + const NOW = 1_700_000_000_000 + + function oauthClient(expiresAt: number, refreshOAuth = vi.fn()) { + const client = new SimClient( + { + name: 'default', + endpoint: 'https://sim.example', + authProfile: 'default', + apiKey: null, + oauth: { accessToken: 'sim_oat_live', refreshToken: 'sim_ort_live', expiresAt }, + workspaceId: 'ws_1', + output: 'json', + sources: { + endpoint: 'default', + credential: 'credentials', + workspaceId: 'env', + output: 'default', + }, + }, + { refreshOAuth } + ) + return { client, refreshOAuth } + } + + function jsonReply(status: number, body: unknown, headers: Record = {}) { + return new Response(JSON.stringify(body), { + status, + headers: { 'content-type': 'application/json', ...headers }, + }) + } + + afterEach(() => { + vi.useRealTimers() + }) + + it('sends a stored login as a bearer token and never as x-api-key', async () => { + vi.useFakeTimers({ now: NOW }) + const fetchMock = vi.fn(async () => jsonReply(200, { data: {} })) + vi.stubGlobal('fetch', fetchMock) + const { client, refreshOAuth } = oauthClient(NOW + 60 * 60 * 1000) + + await client.request('/api/v2/meta') + + const [, init] = fetchMock.mock.calls[0] as unknown as [string, RequestInit] + expect(init.headers).toMatchObject({ authorization: 'Bearer sim_oat_live' }) + expect(init.headers).not.toHaveProperty('x-api-key') + expect(refreshOAuth).not.toHaveBeenCalled() + }) + + it('renews a login that is about to lapse before using it', async () => { + vi.useFakeTimers({ now: NOW }) + const fetchMock = vi.fn(async () => jsonReply(200, { data: {} })) + vi.stubGlobal('fetch', fetchMock) + const refresh = vi.fn(async () => ({ + accessToken: 'sim_oat_fresh', + refreshToken: 'sim_ort_fresh', + expiresAt: NOW + 60 * 60 * 1000, + })) + const { client } = oauthClient(NOW + 60 * 1000, refresh) + + await client.request('/api/v2/meta') + await client.request('/api/v2/meta') + + expect(refresh).toHaveBeenCalledTimes(1) + for (const call of fetchMock.mock.calls) { + const [, init] = call as unknown as [string, RequestInit] + expect(init.headers).toMatchObject({ authorization: 'Bearer sim_oat_fresh' }) + } + }) + + it('retries exactly once after a 401 that names the token invalid', async () => { + vi.useFakeTimers({ now: NOW }) + const fetchMock = vi + .fn() + .mockResolvedValueOnce( + jsonReply( + 401, + { error: { code: 'UNAUTHORIZED', message: 'Invalid access token' } }, + { 'www-authenticate': 'Bearer realm="Sim API", error="invalid_token"' } + ) + ) + .mockResolvedValueOnce(jsonReply(200, { data: { ok: true } })) + vi.stubGlobal('fetch', fetchMock) + const refresh = vi.fn(async () => ({ + accessToken: 'sim_oat_fresh', + refreshToken: 'sim_ort_fresh', + expiresAt: NOW + 60 * 60 * 1000, + })) + const { client } = oauthClient(NOW + 60 * 60 * 1000, refresh) + + await expect(client.request('/api/v2/meta')).resolves.toEqual({ data: { ok: true } }) + expect(refresh).toHaveBeenCalledTimes(1) + expect(fetchMock).toHaveBeenCalledTimes(2) + }) + + it('does not refresh on a 401 that is not about the token', async () => { + vi.useFakeTimers({ now: NOW }) + vi.stubGlobal( + 'fetch', + vi.fn(async () => + jsonReply( + 401, + { error: { code: 'UNAUTHORIZED', message: 'Bearer tokens are not accepted' } }, + { + 'www-authenticate': + 'SimApiKey realm="Sim API", header="x-api-key", Bearer realm="Sim API"', + } + ) + ) + ) + const refresh = vi.fn() + const { client } = oauthClient(NOW + 60 * 60 * 1000, refresh) + + await expect(client.request('/api/v2/meta')).rejects.toThrow('run: sim login') + expect(refresh).not.toHaveBeenCalled() + }) + + it('prefers an explicit API key over the stored login', async () => { + vi.useFakeTimers({ now: NOW }) + const fetchMock = vi.fn(async () => jsonReply(200, { data: {} })) + vi.stubGlobal('fetch', fetchMock) + const client = new SimClient({ + name: 'default', + endpoint: 'https://sim.example', + authProfile: 'default', + apiKey: 'sim_from_env', + // A live stored login sits alongside it, which is the whole point: with + // `oauth: null` there is nothing for the key to be preferred over and the + // assertion passes no matter which branch the client takes. + oauth: { + accessToken: 'sim_oat_live', + refreshToken: 'sim_ort_live', + expiresAt: NOW + 60 * 60 * 1000, + }, + workspaceId: 'ws_1', + output: 'json', + sources: { endpoint: 'default', credential: 'env', workspaceId: 'env', output: 'default' }, + }) + + await client.request('/api/v2/meta') + + const [, init] = fetchMock.mock.calls[0] as unknown as [string, RequestInit] + expect(init.headers).toMatchObject({ 'x-api-key': 'sim_from_env' }) + expect(init.headers).not.toHaveProperty('authorization') + }) +}) diff --git a/packages/sim-cli/src/http/client.ts b/packages/sim-cli/src/http/client.ts index 1cbd55885fc..42ce110e7fe 100644 --- a/packages/sim-cli/src/http/client.ts +++ b/packages/sim-cli/src/http/client.ts @@ -1,7 +1,7 @@ import chalk from 'chalk' -import type { ResolvedProfile } from '../config/index' +import type { ResolvedProfile, StoredCredential, StoredOAuthCredential } from '../config/index' import { USER_AGENT } from '../version' -import { warnIfKeyOverCleartext, warnIfProxyIgnored } from './environment' +import { warnIfCredentialOverCleartext, warnIfProxyIgnored } from './environment' /** * A failure the CLI can explain. Anything thrown as a `SimApiError` is printed @@ -424,18 +424,68 @@ export function formatApiErrorDetails(details: unknown): string[] { return lines } +/** + * Renews an OAuth login and returns the new pair; injected so the HTTP client + * does not import the OAuth flow, which imports the client. + */ +export type OAuthRefresher = ( + profile: ResolvedProfile, + current: StoredOAuthCredential +) => Promise + +export interface SimClientOptions { + refreshOAuth?: OAuthRefresher +} + +/** + * Renew this long before the access token lapses. A request that starts with + * a few seconds left can still land after expiry; five minutes is the margin + * the AWS CLI and WorkOS's guidance settle on, and well inside the hour a Sim + * access token lives. + */ +const REFRESH_AHEAD_MS = 5 * 60 * 1000 + export class SimClient { - constructor(private readonly profile: ResolvedProfile) {} + private oauth: StoredOAuthCredential | null + private refreshing: Promise | null = null + + constructor( + private readonly profile: ResolvedProfile, + private readonly options: SimClientOptions = {} + ) { + this.oauth = profile.oauth ?? null + } - private resolveApiKey(auth: AuthRequirement = 'required'): string | undefined { - if (!this.profile.apiKey) { - if (auth === 'optional') return undefined + private resolveCredential(auth: AuthRequirement = 'required'): StoredCredential | undefined { + if (this.profile.apiKey) return { kind: 'api_key', apiKey: this.profile.apiKey } + if (this.oauth) return { kind: 'oauth', oauth: this.oauth } + if (auth === 'optional') return undefined + throw new SimApiError( + `Not logged in on profile "${this.profile.name}". Run: sim login --profile ${this.profile.name}`, + 0 + ) + } + + /** + * One refresh at a time per process, shared by every request that finds the + * token expiring; the cross-process half lives behind the refresher. + */ + private async refreshOAuth(current: StoredOAuthCredential): Promise { + const refresh = this.options.refreshOAuth + if (!refresh) { throw new SimApiError( - `Not logged in on profile "${this.profile.name}". Run: sim login --profile ${this.profile.name}`, - 0 + `Your Sim login has expired. Run: sim login --profile ${this.profile.name}`, + 401 ) } - return this.profile.apiKey + if (!this.refreshing) { + this.refreshing = refresh(this.profile, current).finally(() => { + this.refreshing = null + }) + } + const next = await this.refreshing + this.oauth = next + return next } /** @@ -447,7 +497,7 @@ export class SimClient { * is logging in. Auth-disabled self-hosted protocols opt out explicitly. */ requireWorkspace(explicit?: string, options: WorkspaceOptions = {}): string { - this.resolveApiKey(options.auth) + this.resolveCredential(options.auth) const workspaceId = explicit ?? this.profile.workspaceId if (!workspaceId) { throw new SimApiError( @@ -484,16 +534,23 @@ export class SimClient { private async send( path: string, - options: RequestOptions + options: RequestOptions, + retriedAfterRefresh = false ): Promise<{ response: Response; url: string }> { - const apiKey = this.resolveApiKey(options.auth) + let credential = this.resolveCredential(options.auth) + if ( + credential?.kind === 'oauth' && + credential.oauth.expiresAt - Date.now() < REFRESH_AHEAD_MS + ) { + credential = { kind: 'oauth', oauth: await this.refreshOAuth(credential.oauth) } + } const url = buildUrl(this.profile.endpoint, path, options.query) const hasBody = options.body !== undefined const method = options.method ?? 'GET' warnIfProxyIgnored() - warnIfKeyOverCleartext(this.profile.endpoint, Boolean(apiKey)) + warnIfCredentialOverCleartext(this.profile.endpoint, Boolean(credential)) // The caller's signal still cancels; the timeout only adds a second reason // to abort, so neither can mask the other. @@ -509,7 +566,10 @@ export class SimClient { response = await fetch(url, { method, headers: { - ...(apiKey ? { 'x-api-key': apiKey } : {}), + ...(credential?.kind === 'api_key' ? { 'x-api-key': credential.apiKey } : {}), + ...(credential?.kind === 'oauth' + ? { authorization: `Bearer ${credential.oauth.accessToken}` } + : {}), accept: 'application/json', 'user-agent': USER_AGENT, ...(hasBody ? { 'content-type': 'application/json' } : {}), @@ -540,6 +600,23 @@ export class SimClient { if (REDIRECT_STATUSES.has(response.status)) throw this.toRedirectError(url, path, response) + /** + * A token the server no longer accepts — revoked, or expired on a clock + * this process disagrees with — is renewed once and the request repeated. + * Only for `invalid_token` (RFC 6750 §3.1): any other 401 means the + * refresh would not change the answer. + */ + if ( + response.status === 401 && + credential?.kind === 'oauth' && + !retriedAfterRefresh && + /\binvalid_token\b/.test(response.headers.get('www-authenticate') ?? '') + ) { + await response.body?.cancel() + await this.refreshOAuth(credential.oauth) + return this.send(path, options, true) + } + if (!response.ok) { const raw = await response.text() const error = toApiError(url, response.status, response.headers.get('content-type'), raw) diff --git a/packages/sim-cli/src/http/environment.test.ts b/packages/sim-cli/src/http/environment.test.ts index 4b4c2006f56..000140805d3 100644 --- a/packages/sim-cli/src/http/environment.test.ts +++ b/packages/sim-cli/src/http/environment.test.ts @@ -2,7 +2,11 @@ * @vitest-environment node */ import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { resetEnvironmentNotices, warnIfKeyOverCleartext, warnIfProxyIgnored } from './environment' +import { + resetEnvironmentNotices, + warnIfCredentialOverCleartext, + warnIfProxyIgnored, +} from './environment' let writes: string[] let originalWrite: typeof process.stderr.write @@ -70,7 +74,7 @@ describe('a proxy the request will not go through', () => { describe('an API key crossing the network in the clear', () => { it('reports a key sent to a remote host over http', () => { - warnIfKeyOverCleartext('http://sim.internal.example', true) + warnIfCredentialOverCleartext('http://sim.internal.example', true) expect(writes.join('')).toContain('sim.internal.example') expect(writes.join('')).toContain('over http') }) @@ -78,14 +82,14 @@ describe('an API key crossing the network in the clear', () => { it('stays silent for the documented local development case', () => { // `http://localhost:3000` is what the README and the login example use. for (const host of ['http://localhost:3000', 'http://127.0.0.1:3000', 'http://api.localhost']) { - warnIfKeyOverCleartext(host, true) + warnIfCredentialOverCleartext(host, true) } expect(writes).toEqual([]) }) it('stays silent over https, and when there is no key to leak', () => { - warnIfKeyOverCleartext('https://sim.example', true) - warnIfKeyOverCleartext('http://sim.internal.example', false) + warnIfCredentialOverCleartext('https://sim.example', true) + warnIfCredentialOverCleartext('http://sim.internal.example', false) expect(writes).toEqual([]) }) }) diff --git a/packages/sim-cli/src/http/environment.ts b/packages/sim-cli/src/http/environment.ts index f8c30b05cff..421a9d39d34 100644 --- a/packages/sim-cli/src/http/environment.ts +++ b/packages/sim-cli/src/http/environment.ts @@ -91,8 +91,8 @@ function isLoopback(hostname: string): boolean { * the documented case; anything else means the key is on the wire in the clear, * which is worth one line. */ -export function warnIfKeyOverCleartext(endpoint: string, hasApiKey: boolean): void { - if (!hasApiKey) return +export function warnIfCredentialOverCleartext(endpoint: string, hasCredential: boolean): void { + if (!hasCredential) return let url: URL try { @@ -104,6 +104,6 @@ export function warnIfKeyOverCleartext(endpoint: string, hasApiKey: boolean): vo once( 'cleartext', - `sending your API key to ${url.host} over http. Anything on the path can read it — use https unless this network is trusted.` + `sending your Sim credentials to ${url.host} over http. Anything on the path can read them — use https unless this network is trusted.` ) } diff --git a/packages/testing/src/mocks/env-flags.mock.ts b/packages/testing/src/mocks/env-flags.mock.ts index 471798c780c..fc61cfc4420 100644 --- a/packages/testing/src/mocks/env-flags.mock.ts +++ b/packages/testing/src/mocks/env-flags.mock.ts @@ -29,6 +29,7 @@ export interface EnvFlagsMockState { isTriggerDevEnabled: boolean isEnterpriseEnabled: boolean isSsoEnabled: boolean + isOAuthProviderEnabled: boolean isUsageMonitoringEnabled: boolean isAccessControlEnabled: boolean isOrganizationsEnabled: boolean @@ -80,6 +81,8 @@ const defaultEnvFlagsState: EnvFlagsMockState = { isTriggerDevEnabled: false, isEnterpriseEnabled: false, isSsoEnabled: false, + // An opt-out flag, like `isChatEnabled`: on unless OAUTH_PROVIDER_ENABLED is falsy. + isOAuthProviderEnabled: true, isUsageMonitoringEnabled: false, isAccessControlEnabled: false, isOrganizationsEnabled: false, diff --git a/packages/testing/src/mocks/schema.mock.ts b/packages/testing/src/mocks/schema.mock.ts index 10d142de09a..34b3c499d09 100644 --- a/packages/testing/src/mocks/schema.mock.ts +++ b/packages/testing/src/mocks/schema.mock.ts @@ -1146,6 +1146,72 @@ export const schemaMock = { domainVerified: 'ssoProvider.domainVerified', jitProvisioningEnabled: 'ssoProvider.jitProvisioningEnabled', }, + oauthClient: { + id: 'oauthClient.id', + clientId: 'oauthClient.clientId', + clientSecret: 'oauthClient.clientSecret', + disabled: 'oauthClient.disabled', + skipConsent: 'oauthClient.skipConsent', + enableEndSession: 'oauthClient.enableEndSession', + subjectType: 'oauthClient.subjectType', + scopes: 'oauthClient.scopes', + userId: 'oauthClient.userId', + createdAt: 'oauthClient.createdAt', + updatedAt: 'oauthClient.updatedAt', + name: 'oauthClient.name', + uri: 'oauthClient.uri', + icon: 'oauthClient.icon', + contacts: 'oauthClient.contacts', + tos: 'oauthClient.tos', + policy: 'oauthClient.policy', + softwareId: 'oauthClient.softwareId', + softwareVersion: 'oauthClient.softwareVersion', + softwareStatement: 'oauthClient.softwareStatement', + redirectUris: 'oauthClient.redirectUris', + postLogoutRedirectUris: 'oauthClient.postLogoutRedirectUris', + tokenEndpointAuthMethod: 'oauthClient.tokenEndpointAuthMethod', + grantTypes: 'oauthClient.grantTypes', + responseTypes: 'oauthClient.responseTypes', + public: 'oauthClient.public', + type: 'oauthClient.type', + requirePKCE: 'oauthClient.requirePKCE', + referenceId: 'oauthClient.referenceId', + metadata: 'oauthClient.metadata', + }, + oauthRefreshToken: { + id: 'oauthRefreshToken.id', + token: 'oauthRefreshToken.token', + clientId: 'oauthRefreshToken.clientId', + sessionId: 'oauthRefreshToken.sessionId', + userId: 'oauthRefreshToken.userId', + referenceId: 'oauthRefreshToken.referenceId', + expiresAt: 'oauthRefreshToken.expiresAt', + createdAt: 'oauthRefreshToken.createdAt', + revoked: 'oauthRefreshToken.revoked', + authTime: 'oauthRefreshToken.authTime', + scopes: 'oauthRefreshToken.scopes', + }, + oauthAccessToken: { + id: 'oauthAccessToken.id', + token: 'oauthAccessToken.token', + clientId: 'oauthAccessToken.clientId', + sessionId: 'oauthAccessToken.sessionId', + userId: 'oauthAccessToken.userId', + referenceId: 'oauthAccessToken.referenceId', + refreshId: 'oauthAccessToken.refreshId', + expiresAt: 'oauthAccessToken.expiresAt', + createdAt: 'oauthAccessToken.createdAt', + scopes: 'oauthAccessToken.scopes', + }, + oauthConsent: { + id: 'oauthConsent.id', + clientId: 'oauthConsent.clientId', + userId: 'oauthConsent.userId', + referenceId: 'oauthConsent.referenceId', + scopes: 'oauthConsent.scopes', + createdAt: 'oauthConsent.createdAt', + updatedAt: 'oauthConsent.updatedAt', + }, ssoDomain: { id: 'ssoDomain.id', organizationId: 'ssoDomain.organizationId', diff --git a/scripts/check-api-validation-contracts.ts b/scripts/check-api-validation-contracts.ts index 378d7ce4aa6..64791407666 100644 --- a/scripts/check-api-validation-contracts.ts +++ b/scripts/check-api-validation-contracts.ts @@ -89,6 +89,7 @@ const INDIRECT_ZOD_ROUTES = new Set([ 'apps/sim/app/api/cron/cleanup-table-row-ttl/route.ts', 'apps/sim/app/api/cron/cleanup-stale-executions/route.ts', 'apps/sim/app/api/cron/cleanup-sandbox-images/route.ts', + 'apps/sim/app/api/cron/cleanup-oauth-tokens/route.ts', 'apps/sim/app/api/cron/renew-subscriptions/route.ts', 'apps/sim/app/api/cron/billing-cycle-close/route.ts', 'apps/sim/app/api/cron/reconcile-billing-seats/route.ts', diff --git a/scripts/check-principal-kind-parity.test.ts b/scripts/check-principal-kind-parity.test.ts new file mode 100644 index 00000000000..226d8bb7f93 --- /dev/null +++ b/scripts/check-principal-kind-parity.test.ts @@ -0,0 +1,65 @@ +import { describe, expect, it } from 'vitest' +import { auditSource, parsePrincipalKindLiterals } from './check-principal-kind-parity' + +const FILE = 'apps/sim/lib/things/application/operations.ts' + +describe('principalKinds literal parsing', () => { + it('reads single-line and multi-line literals, including type-level ones', () => { + const literals = parsePrincipalKindLiterals(` + readonly principalKinds: readonly ['session', 'personal_api_key', 'oauth_access_token'] + const A = defineWorkspaceOperation({ + principalKinds: [ + 'session', + 'delegated', + ], + }) + principalKinds?: readonly ['session'] + `) + + expect(literals.map((literal) => literal.kinds)).toEqual([ + ['session', 'personal_api_key', 'oauth_access_token'], + ['session', 'delegated'], + ['session'], + ]) + }) +}) + +describe('assertion A — the two user-credential kinds travel together', () => { + it('accepts a policy that names both, and one that names neither', () => { + const { findings, pairs } = auditSource( + FILE, + ` + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], + principalKinds: ['session', 'delegated'], + ` + ) + + expect(findings).toEqual([]) + expect(pairs).toBe(1) + }) + + it('reports a policy that admits the key but not the token', () => { + const { findings } = auditSource(FILE, "principalKinds: ['session', 'personal_api_key'],") + + expect(findings).toHaveLength(1) + expect(findings[0]).toMatchObject({ file: FILE, line: 1 }) + expect(findings[0].message).toContain("without 'oauth_access_token'") + }) + + it('reports a policy that admits the token but not the key', () => { + const { findings } = auditSource(FILE, "principalKinds: ['oauth_access_token'],") + + expect(findings).toHaveLength(1) + expect(findings[0].message).toContain("without 'personal_api_key'") + }) + + it('does not count a spread constant as naming a bare kind', () => { + const { findings, pairs } = auditSource( + FILE, + "principalKinds: ['session', ...USER_CREDENTIAL_PRINCIPAL_KINDS]," + ) + + expect(findings).toEqual([]) + expect(pairs).toBe(0) + }) +}) diff --git a/scripts/check-principal-kind-parity.ts b/scripts/check-principal-kind-parity.ts new file mode 100644 index 00000000000..537a6afe097 --- /dev/null +++ b/scripts/check-principal-kind-parity.ts @@ -0,0 +1,174 @@ +#!/usr/bin/env bun +/** + * Keeps `personal_api_key` and `oauth_access_token` admitted together in every + * operation policy. + * + * The two kinds are one authorization class: a person reaching the API through + * a bearer credential of their own. An OAuth access token is the personal key + * narrowed by scope and bounded by expiry, and `authorizeWorkspaceOperation` + * walks the same sequence for both. A policy that names one without the other + * is therefore never a decision — it is an operation written before the second + * kind existed, or a copy of one, and the token is refused (or admitted) by + * accident for a reason no reviewer chose. + * + * It asserts, over every `application/operations.ts` under `apps/sim/lib`: + * + * A every `principalKinds` array literal that names one of the pair names + * both. + * B at least one policy naming the pair was found. The assertions are + * source-text matches, so a refactor into a form this cannot read would + * otherwise be indistinguishable from a clean tree. + * + * ## What this audit does not cover + * + * Read this before trusting the gate: it covers less than it looks like it does. + * + * - Only array literals written directly after `principalKinds:` are read. A + * policy assembled from a named constant (`principalKinds: HUMAN_KINDS`) is + * invisible to assertion A. + * - Only `operations.ts` files under `apps/sim/lib` are scanned. Anything + * declared elsewhere is out of reach. + * - Nothing here sees a `switch (principal.kind)` or a + * `principal.kind === '...'` comparison, which is the class of site that + * actually mis-admits a principal silently, and the class this pair had to + * be threaded through by hand. + * - Assertion B proves only that *some* policy names both kinds, not that any + * particular domain does. One paired policy anywhere keeps it green. + * + * Type-level `readonly principalKinds: readonly [...]` declarations do match + * the same pattern, so a domain's operation interface is held to the rule. + */ +import { readdirSync, readFileSync, statSync } from 'node:fs' +import { dirname, join, relative, resolve } from 'node:path' +import { fileURLToPath } from 'node:url' + +const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..') +const SCAN_ROOT = 'apps/sim/lib' +const OPERATIONS_FILE = 'operations.ts' + +/** The pair that must travel together. */ +export const USER_CREDENTIAL_PRINCIPAL_KINDS = ['personal_api_key', 'oauth_access_token'] as const + +interface Finding { + file: string + line: number + message: string +} + +function walk(directory: string, into: string[]): string[] { + for (const entry of readdirSync(directory)) { + if (entry === 'node_modules' || entry === '.next') continue + const full = join(directory, entry) + if (statSync(full).isDirectory()) walk(full, into) + else if (entry === OPERATIONS_FILE) into.push(full) + } + return into +} + +function lineOf(source: string, index: number): number { + return source.slice(0, index).split('\n').length +} + +/** + * Every `principalKinds` array literal in one file, with the kinds it names. + * Multi-line literals are read to their closing bracket; a literal spread from + * a constant contributes the spread's text, which never names a bare kind and + * so never trips assertion A on its own. + */ +export function parsePrincipalKindLiterals( + source: string +): Array<{ line: number; kinds: string[] }> { + const literals: Array<{ line: number; kinds: string[] }> = [] + for (const match of source.matchAll(/principalKinds\??:\s*(?:readonly\s+)?\[/g)) { + const open = match.index + match[0].length - 1 + let depth = 0 + let close = -1 + for (let index = open; index < source.length; index++) { + const char = source[index] + if (char === '[') depth++ + else if (char === ']') { + depth-- + if (depth === 0) { + close = index + break + } + } + } + if (close === -1) continue + const body = source.slice(open + 1, close) + const kinds = [...body.matchAll(/'([a-z_]+)'/g)].map((kind) => kind[1]) + literals.push({ line: lineOf(source, match.index), kinds }) + } + return literals +} + +/** One operations file's findings, so the assertion is testable without a tree on disk. */ +export function auditSource(file: string, source: string): { findings: Finding[]; pairs: number } { + const findings: Finding[] = [] + let pairs = 0 + const [personal, oauth] = USER_CREDENTIAL_PRINCIPAL_KINDS + + for (const literal of parsePrincipalKindLiterals(source)) { + const hasPersonal = literal.kinds.includes(personal) + const hasOauth = literal.kinds.includes(oauth) + if (hasPersonal && hasOauth) { + pairs++ + continue + } + if (!hasPersonal && !hasOauth) continue + const named = hasPersonal ? personal : oauth + const missing = hasPersonal ? oauth : personal + findings.push({ + file, + line: literal.line, + message: + `principalKinds names '${named}' without '${missing}'. A personal API key and an OAuth ` + + 'access token are the same authorization class — a person acting through their own ' + + 'bearer credential — so an operation admits both or neither. Add the missing kind.', + }) + } + + return { findings, pairs } +} + +function main(): void { + const files = walk(join(ROOT, SCAN_ROOT), []) + .map((file) => relative(ROOT, file)) + .sort() + + const findings: Finding[] = [] + let pairs = 0 + for (const file of files) { + const result = auditSource(file, readFileSync(join(ROOT, file), 'utf8')) + findings.push(...result.findings) + pairs += result.pairs + } + + if (pairs === 0 && findings.length === 0) { + findings.push({ + file: SCAN_ROOT, + line: 1, + message: + `no principalKinds literal naming both ${USER_CREDENTIAL_PRINCIPAL_KINDS.join(' and ')} ` + + `was found under ${SCAN_ROOT}. Either no operation admits user credentials any more, or ` + + 'policies are now written in a form this audit cannot read — both mean it is passing ' + + 'without checking anything.', + }) + } + + if (findings.length > 0) { + console.error( + `check:principal-kind-parity — ${findings.length} finding${findings.length === 1 ? '' : 's'}:\n` + ) + for (const finding of findings) { + console.error(` ${finding.file}:${finding.line}\n ${finding.message}\n`) + } + process.exit(1) + } + + console.log( + `check:principal-kind-parity — ${files.length} operations files, ${pairs} policies admit both user-credential kinds.` + ) +} + +if (import.meta.main) main() From 71943ae08e5a657327f12c87945d02f07a4213c7 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 4 Sep 2026 15:44:32 -0700 Subject: [PATCH 02/31] test: sync OAuth audit mock --- packages/testing/src/mocks/audit.mock.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/testing/src/mocks/audit.mock.ts b/packages/testing/src/mocks/audit.mock.ts index f2c6362efb0..1c7b2994b0f 100644 --- a/packages/testing/src/mocks/audit.mock.ts +++ b/packages/testing/src/mocks/audit.mock.ts @@ -110,6 +110,7 @@ export const auditMock = { MEMBER_REMOVED: 'member.removed', MEMBER_ROLE_CHANGED: 'member.role_changed', OAUTH_DISCONNECTED: 'oauth.disconnected', + OAUTH_APP_REVOKED: 'oauth_app.revoked', PASSWORD_RESET: 'password.reset', PASSWORD_RESET_REQUESTED: 'password.reset_requested', ORGANIZATION_CREATED: 'organization.created', @@ -216,6 +217,7 @@ export const auditMock = { KNOWLEDGE_BASE: 'knowledge_base', MCP_SERVER: 'mcp_server', OAUTH: 'oauth', + OAUTH_CLIENT: 'oauth_client', ORGANIZATION: 'organization', PASSWORD: 'password', PERMISSION_GROUP: 'permission_group', From 1d33c6a09b940c943447dbbaccf13a43c3f941ff Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 4 Sep 2026 15:45:11 -0700 Subject: [PATCH 03/31] docs: clarify OAuth logout guarantees --- apps/sim/lib/auth/auth.ts | 14 +++++++++----- apps/sim/lib/auth/oauth-provider.ts | 8 ++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/apps/sim/lib/auth/auth.ts b/apps/sim/lib/auth/auth.ts index c1d2fbd5a21..24df76b6ed4 100644 --- a/apps/sim/lib/auth/auth.ts +++ b/apps/sim/lib/auth/auth.ts @@ -1300,8 +1300,10 @@ export const auth = betterAuth({ }), /** * Sim as an OAuth 2.1 authorization server (auth-code + PKCE, refresh - * rotation). Tokens are opaque and stored hashed so a "Revoke" in settings - * or `sim logout` takes effect on the next request; `disableJwtPlugin` + * rotation). Tokens are opaque and stored hashed, so revoking an app in + * settings takes effect on the next request. `sim logout` revokes the + * current refresh/access pair; access tokens issued before an earlier + * rotation remain valid until their one-hour expiry. `disableJwtPlugin` * keeps the JWKS machinery out until a third-party resource server needs * it. Clients are DB rows only (the CLI is seeded by migration, the rest * are admin-created), so both registration paths stay closed. @@ -1337,9 +1339,11 @@ export const auth = betterAuth({ */ clientPrivileges: () => false, /** - * Opaque access tokens, so revoking an app in settings or running - * `sim logout` takes effect on the very next request. A JWT would - * stay valid until it lapsed. + * Opaque access tokens let Settings revoke every token for an app + * on the next request. `sim logout` revokes only the access token + * paired with the current refresh token; an access token from an + * earlier rotation can remain valid until it expires. A JWT would + * stay valid until it lapsed regardless of either database delete. * * The cost is that client secrets are stored reversibly: with no * JWKS, the plugin signs ID tokens with the client secret and so diff --git a/apps/sim/lib/auth/oauth-provider.ts b/apps/sim/lib/auth/oauth-provider.ts index 3a770cfa665..1f7f97844f9 100644 --- a/apps/sim/lib/auth/oauth-provider.ts +++ b/apps/sim/lib/auth/oauth-provider.ts @@ -40,10 +40,10 @@ export type OAuthScope = (typeof OAUTH_SCOPES)[number] /** * Token lifetimes, in seconds, as the plugin takes them. * - * An hour of access matches what gcloud and the AWS CLI issue, and is short - * enough that revoking an app in settings is felt within the hour even for a - * client that never refreshes. Thirty days of refresh is the plugin's own - * default and means a daily user signs in roughly monthly. + * An hour of access matches what gcloud and the AWS CLI issue and limits the + * lifetime of a copied token that is not otherwise revoked. Thirty days of + * refresh is the plugin's own default and means a daily user signs in roughly + * monthly. */ export const OAUTH_ACCESS_TOKEN_TTL_SECONDS = 60 * 60 export const OAUTH_REFRESH_TOKEN_TTL_SECONDS = 30 * 24 * 60 * 60 From d51d646d5411d6e88d8c77714491ae5117b8cf68 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 4 Sep 2026 15:46:10 -0700 Subject: [PATCH 04/31] docs: scope OAuth refresh lock guarantee --- packages/sim-cli/src/auth/refresh.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/sim-cli/src/auth/refresh.ts b/packages/sim-cli/src/auth/refresh.ts index d36587c6a70..8ae4758214b 100644 --- a/packages/sim-cli/src/auth/refresh.ts +++ b/packages/sim-cli/src/auth/refresh.ts @@ -12,22 +12,23 @@ import { OAuthTokenError, refreshTokens } from './oauth-flow' /** * Bounded well under the credentials lock's stale window: a hung authorization * server must not hold the lock long enough for another process to reclaim it - * and refresh in parallel, which is what reuse detection would kill the whole - * session for. + * and race the same single-use refresh token. */ const REFRESH_TIMEOUT_MS = 10 * 1000 /** * Renews a stored OAuth login and persists the rotated pair. * - * Under the credentials lock, because the refresh token is single-use and a - * parallel `sim` that presented it second would get the whole session revoked. - * After taking the lock the file is read again: if another process already - * rotated the token, its result is adopted and no request is made. + * Under the credentials lock because the refresh token is single-use and two + * local processes must not race it. After taking the lock the file is read + * again: if another process already rotated the token, its result is adopted + * and no request is made. This coordinates trusted local processes; detecting + * and containing a copied token remains the authorization server's job. * * `invalid_grant` means the server no longer honours the refresh token — it * was revoked from Settings → Authorized apps, expired, or was already rotated - * by a process this one could not see — and the only remedy is a new login. + * by a process this one could not see — and the remedy is logout followed by a + * new login. */ export async function refreshStoredOAuth( profile: Pick, From 38e2516326ed0eecbb91fabe7933c355fe389008 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 4 Sep 2026 18:30:52 -0700 Subject: [PATCH 05/31] fix(auth): harden OAuth provider and API DX --- apps/docs/content/docs/cli/audit-logs.mdx | 10 +- apps/docs/content/docs/cli/authentication.mdx | 47 +- apps/docs/content/docs/cli/billing.mdx | 8 +- apps/docs/content/docs/cli/credentials.mdx | 10 +- apps/docs/content/docs/cli/files.mdx | 2 +- apps/docs/content/docs/cli/knowledge.mdx | 48 +- apps/docs/content/docs/cli/logs.mdx | 4 +- apps/docs/content/docs/cli/mcp-servers.mdx | 2 +- apps/docs/content/docs/cli/reference.mdx | 146 ++--- apps/docs/content/docs/cli/sandboxes.mdx | 6 +- apps/docs/content/docs/cli/secrets.mdx | 6 +- apps/docs/content/docs/cli/skills.mdx | 10 +- apps/docs/content/docs/cli/tools.mdx | 2 +- .../content/docs/cli/workflow-mcp-servers.mdx | 16 +- apps/docs/content/docs/cli/workflows.mdx | 22 +- .../platform/self-hosting/authentication.mdx | 25 +- .../self-hosting/environment-variables.mdx | 2 +- apps/docs/openapi-v2-billing.json | 58 +- apps/docs/openapi-v2-files-audit.json | 68 ++- apps/docs/openapi-v2-knowledge.json | 76 ++- apps/docs/openapi-v2-logs.json | 68 ++- apps/docs/openapi-v2-resources.json | 72 ++- apps/docs/openapi-v2-tables.json | 70 ++- apps/docs/openapi-v2-workflows.json | 92 ++- apps/sim/.env.example | 2 +- .../app/(auth)/oauth/sign-in/route.test.ts | 72 +++ apps/sim/app/(auth)/oauth/sign-in/route.ts | 26 +- apps/sim/app/api/auth/[...all]/route.test.ts | 23 +- apps/sim/app/api/auth/[...all]/route.ts | 19 +- .../api/auth/oauth2/authorize/route.test.ts | 134 ++++- .../app/api/auth/oauth2/authorize/route.ts | 86 ++- .../app/api/auth/oauth2/revoke/route.test.ts | 77 +++ apps/sim/app/api/auth/oauth2/revoke/route.ts | 67 +++ .../auth/oauth2/token/route.postgres.test.ts | 346 ++++++++++++ .../app/api/auth/oauth2/token/route.test.ts | 358 ++++++++++++ apps/sim/app/api/auth/oauth2/token/route.ts | 123 ++++ apps/sim/app/api/v2/chat/route.test.ts | 6 +- apps/sim/app/api/v2/chat/route.ts | 14 +- .../api/v2/files/[fileId]/share/route.test.ts | 2 +- apps/sim/app/api/v2/knowledge/search/route.ts | 4 +- apps/sim/app/api/v2/lib/response.test.ts | 4 +- apps/sim/app/api/v2/meta/route.test.ts | 2 +- .../v2/tables/[tableId]/query/count/route.ts | 2 +- .../api/v2/tables/[tableId]/query/route.ts | 2 +- .../v2/tables/[tableId]/rows/search/route.ts | 2 +- .../[workflowId]/execute/route.test.ts | 36 +- .../workflows/[workflowId]/execute/route.ts | 7 +- .../[workflowId]/runs/[runId]/route.test.ts | 2 +- .../authorized-apps/authorized-apps.tsx | 3 +- .../background/cleanup-oauth-tokens.test.ts | 52 +- apps/sim/background/cleanup-oauth-tokens.ts | 141 +++-- apps/sim/lib/api/contracts/tables.ts | 14 +- .../v2/__tests__/cross-cutting.test.ts | 16 +- .../transport-neutral-descriptions.test.ts | 4 - apps/sim/lib/api/contracts/v2/billing.ts | 10 +- apps/sim/lib/api/contracts/v2/knowledge.ts | 2 +- apps/sim/lib/api/contracts/v2/logs-stats.ts | 2 +- apps/sim/lib/api/contracts/v2/logs.ts | 4 +- .../api/contracts/v2/openapi/files-audit.ts | 12 +- .../contracts/v2/openapi/knowledge-chunks.ts | 13 +- .../contracts/v2/openapi/knowledge-tags.ts | 11 +- .../lib/api/contracts/v2/openapi/knowledge.ts | 2 +- apps/sim/lib/api/contracts/v2/openapi/logs.ts | 6 +- .../lib/api/contracts/v2/openapi/resources.ts | 32 +- .../lib/api/contracts/v2/openapi/shared.ts | 6 +- .../lib/api/contracts/v2/openapi/tables.ts | 10 +- .../lib/api/contracts/v2/openapi/workflows.ts | 30 +- apps/sim/lib/api/contracts/v2/shared.ts | 32 +- apps/sim/lib/api/contracts/v2/uploads.ts | 4 +- apps/sim/lib/api/contracts/v2/workflows.ts | 31 +- apps/sim/lib/api/contracts/workspaces.ts | 2 +- .../api/server/routes/v2-api-key-auth.test.ts | 1 + .../lib/api/server/routes/v2-api-key-auth.ts | 2 +- .../api/server/routes/v2-json-route.test.ts | 4 +- apps/sim/lib/auth/auth.ts | 62 +- apps/sim/lib/auth/oauth-access-token.test.ts | 10 +- apps/sim/lib/auth/oauth-access-token.ts | 6 +- .../auth/oauth-authorization-error.test.ts | 154 +++++ .../sim/lib/auth/oauth-authorization-error.ts | 92 +++ apps/sim/lib/auth/oauth-principal.test.ts | 6 +- .../lib/auth/oauth-protocol-request.test.ts | 160 ++++++ apps/sim/lib/auth/oauth-protocol-request.ts | 364 ++++++++++++ .../auth/oauth-provider-adapter-guard.test.ts | 120 ++++ .../lib/auth/oauth-provider-adapter-guard.ts | 131 +++++ .../lib/auth/oauth-provider-metadata.test.ts | 8 + apps/sim/lib/auth/oauth-provider-metadata.ts | 7 +- apps/sim/lib/auth/oauth-provider.test.ts | 18 +- apps/sim/lib/auth/oauth-provider.ts | 25 +- .../auth/oauth-token-family.postgres.test.ts | 215 +++++++ apps/sim/lib/auth/oauth-token-family.ts | 532 ++++++++++++++++++ apps/sim/lib/auth/sim-auth-adapter.ts | 37 ++ .../billing/application/list-billing-logs.ts | 10 +- apps/sim/lib/core/application/forbidden.ts | 54 +- apps/sim/lib/core/application/index.ts | 1 - .../workspace-authorization.test.ts | 8 +- apps/sim/lib/core/config/env-flags.ts | 12 +- apps/sim/lib/core/config/env.ts | 2 +- .../sim/lib/permission-groups/capabilities.ts | 5 +- .../users/application/authorized-apps.test.ts | 1 - .../lib/users/application/authorized-apps.ts | 5 +- apps/sim/scripts/create-oauth-client.ts | 24 +- .../db/migrations/0322_oauth_provider.sql | 128 +++-- .../db/migrations/meta/0322_snapshot.json | 227 +++++++- packages/db/migrations/meta/_journal.json | 2 +- packages/db/schema.ts | 104 ++-- packages/sim-cli/src/auth/oauth-flow.test.ts | 2 +- packages/sim-cli/src/auth/oauth-flow.ts | 36 +- packages/sim-cli/src/auth/refresh.ts | 2 +- packages/sim-cli/src/commands/auth.test.ts | 289 +++++++++- packages/sim-cli/src/commands/auth.ts | 385 +++++++++---- .../sim-cli/src/commands/configure.test.ts | 42 ++ packages/sim-cli/src/commands/configure.ts | 78 ++- packages/sim-cli/src/config/index.ts | 1 + packages/sim-cli/src/config/profile.test.ts | 19 +- packages/sim-cli/src/config/profile.ts | 68 ++- .../sim-cli/src/contract/commands.test.ts | 8 +- packages/sim-cli/src/contract/commands.ts | 12 +- packages/sim-cli/src/contract/types.ts | 6 +- packages/sim-cli/src/generated/v2-api.ts | 151 +++-- packages/sim-cli/src/http/client.test.ts | 56 +- packages/sim-cli/src/http/client.ts | 17 +- packages/sim-cli/src/runtime/build.test.ts | 18 +- packages/sim-cli/src/runtime/build.ts | 6 +- packages/sim-cli/src/runtime/options.ts | 2 +- packages/sim-cli/src/runtime/types.ts | 4 +- packages/testing/src/mocks/env-flags.mock.ts | 2 +- packages/testing/src/mocks/schema.mock.ts | 13 + scripts/check-api-validation-contracts.ts | 6 +- scripts/generate-v2-cli-api.test.ts | 14 +- scripts/generate-v2-cli-api.ts | 20 +- scripts/openapi/documents.test.ts | 30 + 131 files changed, 5480 insertions(+), 1069 deletions(-) create mode 100644 apps/sim/app/(auth)/oauth/sign-in/route.test.ts create mode 100644 apps/sim/app/api/auth/oauth2/revoke/route.test.ts create mode 100644 apps/sim/app/api/auth/oauth2/revoke/route.ts create mode 100644 apps/sim/app/api/auth/oauth2/token/route.postgres.test.ts create mode 100644 apps/sim/app/api/auth/oauth2/token/route.test.ts create mode 100644 apps/sim/app/api/auth/oauth2/token/route.ts create mode 100644 apps/sim/lib/auth/oauth-authorization-error.test.ts create mode 100644 apps/sim/lib/auth/oauth-authorization-error.ts create mode 100644 apps/sim/lib/auth/oauth-protocol-request.test.ts create mode 100644 apps/sim/lib/auth/oauth-protocol-request.ts create mode 100644 apps/sim/lib/auth/oauth-provider-adapter-guard.test.ts create mode 100644 apps/sim/lib/auth/oauth-provider-adapter-guard.ts create mode 100644 apps/sim/lib/auth/oauth-token-family.postgres.test.ts create mode 100644 apps/sim/lib/auth/oauth-token-family.ts create mode 100644 apps/sim/lib/auth/sim-auth-adapter.ts diff --git a/apps/docs/content/docs/cli/audit-logs.mdx b/apps/docs/content/docs/cli/audit-logs.mdx index 1c06a2785ee..05d0e9e3acc 100644 --- a/apps/docs/content/docs/cli/audit-logs.mdx +++ b/apps/docs/content/docs/cli/audit-logs.mdx @@ -15,7 +15,7 @@ Every command below also accepts the [global options](/cli/commands#global-optio sim audit-logs get [options] ``` -Get Audit Log (personal API key required) +Get Audit Log (OAuth login or personal API key required) **Arguments** @@ -33,7 +33,7 @@ Get Audit Log (personal API key required) | Option | Required | Description | | --- | --- | --- | -| `--organization ` | No | Organization ID; defaults to your only organization, and is required when your account belongs to more than one (personal API key required). | +| `--organization ` | No | Organization ID; defaults to your only organization, and is required when your account belongs to more than one (OAuth login or personal API key required). | @@ -43,7 +43,7 @@ Get Audit Log (personal API key required) sim audit-logs list [options] ``` -List Audit Logs (personal API key required) +List Audit Logs (OAuth login or personal API key required) **Options** @@ -59,8 +59,8 @@ List Audit Logs (personal API key required) | `--include-departed` | No | Include actions by users who have left the organization. | | `--no-include-departed` | No | Send --include-departed as false. | | `--limit ` | No | Maximum items to return (0 for everything). Defaults to `100`. | -| `--organization ` | No | Organization ID; defaults to your only organization, and is required when your account belongs to more than one (personal API key required). | +| `--organization ` | No | Organization ID; defaults to your only organization, and is required when your account belongs to more than one (OAuth login or personal API key required). | | `--actor-email ` | No | Filter by actor email address. | -| `--all-workspaces` | No | Do not filter to the configured workspace (personal API key required for account-wide access). | +| `--all-workspaces` | No | Do not filter to the configured workspace (OAuth login or personal API key required for account-wide access). | diff --git a/apps/docs/content/docs/cli/authentication.mdx b/apps/docs/content/docs/cli/authentication.mdx index d3bebdb10ab..3c9ec9e4e6c 100644 --- a/apps/docs/content/docs/cli/authentication.mdx +++ b/apps/docs/content/docs/cli/authentication.mdx @@ -31,13 +31,12 @@ Waiting for you to approve in the browser… No default workspace. Set one with: sim configure --set-workspace ``` -This is OAuth 2.1 with PKCE and a loopback redirect, the same flow the AWS, Google -Cloud, and Cloudflare CLIs use. The browser only ever carries a one-time code; +This is the OAuth 2.0 authorization-code flow with PKCE and a loopback redirect, +aligned with current OAuth security guidance. The browser only ever carries a one-time code; the tokens are exchanged over the terminal's own connection and written to `~/.sim/credentials` with `0600` permissions. Access tokens last an hour and are -renewed automatically from a refresh token, so you sign in once and stay signed -in until you log out, revoke the login, or go thirty days without using it. If -it expires, run `sim logout` before signing in again. +renewed automatically from a refresh token. The complete login has a fixed +30-day lifetime; after it expires, run `sim logout`, then sign in again. Only approve a consent page you reached by running `sim login` yourself. A @@ -50,7 +49,7 @@ your login. | `--no-browser` | Print the URL instead of opening a browser | | `--browserless` | Use the pairing-code handoff instead (see below) | | `--read-only` | Ask only for permission to read, never to change anything | -| `--callback-port ` | Pin the local port the browser returns to, for a container or SSH session that forwards a fixed one | +| `--callback-port ` | Pin the loopback callback port, primarily for an SSH session that forwards the same fixed port | | `--scope ` | Key space for the pairing-code handoff. Only `copilot` changes anything, and it forces that flow | | `-y, --yes` | Overwrite an existing API-key profile without prompting | @@ -92,14 +91,15 @@ the provider switched off; the CLI detects that and falls back on its own. `--read-only` and `--callback-port` belong to the browser login and have no meaning here, so combining either with the handoff stops the login rather than storing a credential you did not ask for. If your SSH session forwards a port -back to your machine, pass `--callback-port ` on its own: naming the port -tells the CLI the loopback redirect does reach you, and it runs the browser -login instead of the handoff. +from the remote loopback interface to the browser's machine, pass that same +`--callback-port ` on its own. An ordinary container port publication +cannot reach a listener bound to the container's own loopback interface; use +`--browserless` there. ### Picking a workspace -A login carries the full authority of your account across every workspace you -belong to, so the profile's `workspace` setting only decides the default target. +A normal login can act across every workspace you belong to; `--read-only` +limits it to read operations. The profile's `workspace` setting only decides the default target. Set it after signing in, or pass `--workspace` per command: ```bash @@ -147,12 +147,11 @@ sim logout # sign out of Sim and remove the stored login sim logout --all # remove the profile entirely, including its settings ``` -For an OAuth login, `sim logout` revokes the current refresh token and its paired -access token before removing them from disk, so the login cannot renew. An -access token copied before an earlier rotation can remain valid until its -one-hour expiry. For an immediate whole-app cutoff, revoke the grant under -**Settings → Authorized apps**; that removes every access and refresh token for -the app. +For an OAuth login, `sim logout` revokes that login's complete token family +before removing it from disk, including access tokens issued before earlier +rotations. Other machines that ran their own `sim login` remain signed in. To +cut off every independent login for the client, revoke the grant under +**Settings → Authorized apps**. A workspace profile that shares authentication cannot remove the shared login. Remove only that local profile with `sim logout --all --profile `, or log @@ -238,10 +237,9 @@ Save it to avoid repeating the flag: sim configure --set-endpoint http://localhost:3000 --profile local ``` -A self-hosted deployment offers OAuth sign-in by default when authentication is -enabled. Set `OAUTH_PROVIDER_ENABLED=false` on the server to switch it off; -`DISABLE_AUTH=true` also forces it off. In either case the CLI uses the -pairing-code handoff. +A self-hosted deployment offers OAuth sign-in when +`OAUTH_PROVIDER_ENABLED=true` and authentication is enabled. Leave it unset to +use the pairing-code handoff; `DISABLE_AUTH=true` also forces OAuth off. ## Where the login is stored @@ -267,6 +265,13 @@ or with `--yes`; a live OAuth login must be revoked with `sim logout` before signing in again. Several `sim` commands running at once share one renewal, so a parallel shell loop cannot sign itself out. +Run `sim login` separately on each machine. Copying `~/.sim/credentials` copies +one single-use refresh-token family; simultaneous use from both copies is +treated as token replay and revokes that login. If a refresh response is lost +because the process or connection stops, the CLI does not retry the consumed +token: run `sim logout`, then `sim login` again. This fail-closed behavior keeps +a copied token from surviving an ambiguous refresh. + ## Organization audit logs `sim audit-logs` requires a **personal** credential — an OAuth login, or the diff --git a/apps/docs/content/docs/cli/billing.mdx b/apps/docs/content/docs/cli/billing.mdx index 2df8ad9d9dc..7460d6e630b 100644 --- a/apps/docs/content/docs/cli/billing.mdx +++ b/apps/docs/content/docs/cli/billing.mdx @@ -13,7 +13,7 @@ Every command below also accepts the [global options](/cli/commands#global-optio sim billing status [options] ``` -Show billing status and current-period credit usage (credits and storage require a personal API key) +Show billing status and current-period credit usage (credits and storage require an OAuth login or personal API key) **Options** @@ -21,7 +21,7 @@ Show billing status and current-period credit usage (credits and storage require | Option | Required | Description | | --- | --- | --- | -| `--all-workspaces` | No | Do not filter to the configured workspace (personal API key required for account-wide access). | +| `--all-workspaces` | No | Do not filter to the configured workspace (OAuth login or personal API key required for account-wide access). | @@ -31,7 +31,7 @@ Show billing status and current-period credit usage (credits and storage require sim billing logs [options] ``` -List credit usage events (a personal API key reports only your own events; a workspace API key reports every member's in aggregate, unattributed) +List credit usage events (an OAuth login or personal API key reports only your events; a workspace API key reports every member's in aggregate, unattributed) **Options** @@ -44,6 +44,6 @@ List credit usage events (a personal API key reports only your own events; a wor | `--start-date ` | No | Custom period start (ISO 8601). | | `--end-date ` | No | Custom period end (ISO 8601). | | `--limit ` | No | Maximum items to return (0 for everything). Defaults to `100`. | -| `--all-workspaces` | No | Do not filter to the configured workspace (personal API key required for account-wide access). | +| `--all-workspaces` | No | Do not filter to the configured workspace (OAuth login or personal API key required for account-wide access). | diff --git a/apps/docs/content/docs/cli/credentials.mdx b/apps/docs/content/docs/cli/credentials.mdx index aec2144c459..cbab5289619 100644 --- a/apps/docs/content/docs/cli/credentials.mdx +++ b/apps/docs/content/docs/cli/credentials.mdx @@ -15,7 +15,7 @@ Every command below also accepts the [global options](/cli/commands#global-optio sim credentials delete [options] ``` -Disconnect Credential (personal API key required) +Disconnect Credential (OAuth login or personal API key required) **Arguments** @@ -80,7 +80,7 @@ sim credentials list [options] sim credentials update [options] ``` -Update Credential (personal API key required) +Update Credential (OAuth login or personal API key required) **Arguments** @@ -123,7 +123,7 @@ Update Credential (personal API key required) sim credentials create [options] ``` -Create a service-account credential using its discovered provider schema (personal API key required) +Create a service-account credential using its discovered provider schema (OAuth login or personal API key required) **Arguments** @@ -154,7 +154,7 @@ Create a service-account credential using its discovered provider schema (person sim credentials connect [options] ``` -Create a short-lived link for connecting an OAuth provider (personal API key required) +Create a short-lived link for connecting an OAuth provider (OAuth login or personal API key required) **Arguments** @@ -182,7 +182,7 @@ Create a short-lived link for connecting an OAuth provider (personal API key req sim credentials reconnect ``` -Create a short-lived link for reconnecting an OAuth credential (personal API key required) +Create a short-lived link for reconnecting an OAuth credential (OAuth login or personal API key required) **Arguments** diff --git a/apps/docs/content/docs/cli/files.mdx b/apps/docs/content/docs/cli/files.mdx index be9e2330c84..89d5db8aadc 100644 --- a/apps/docs/content/docs/cli/files.mdx +++ b/apps/docs/content/docs/cli/files.mdx @@ -248,7 +248,7 @@ sim files share get sim files share set [options] ``` -Enable or disable sharing for a file (personal API key required) +Enable or disable sharing for a file (OAuth login or personal API key required) **Arguments** diff --git a/apps/docs/content/docs/cli/knowledge.mdx b/apps/docs/content/docs/cli/knowledge.mdx index 5d697bb22b1..8ffe1dd8613 100644 --- a/apps/docs/content/docs/cli/knowledge.mdx +++ b/apps/docs/content/docs/cli/knowledge.mdx @@ -15,7 +15,7 @@ Every command below also accepts the [global options](/cli/commands#global-optio sim knowledge from-workspace-files create [options] ``` -Index files the workspace already stores (personal API key required) +Index files the workspace already stores (OAuth login or personal API key required) **Arguments** @@ -43,7 +43,7 @@ Index files the workspace already stores (personal API key required) sim knowledge tags save [options] ``` -Declare the tag definitions a knowledge base needs (personal API key required) +Declare the tag definitions a knowledge base needs (OAuth login or personal API key required) **Arguments** @@ -71,7 +71,7 @@ Declare the tag definitions a knowledge base needs (personal API key required) sim knowledge tags create [options] ``` -Create Tag (personal API key required) +Create Tag (OAuth login or personal API key required) **Arguments** @@ -101,7 +101,7 @@ Create Tag (personal API key required) sim knowledge tags delete [options] ``` -Delete Tag (personal API key required) +Delete Tag (OAuth login or personal API key required) **Arguments** @@ -130,7 +130,7 @@ Delete Tag (personal API key required) sim knowledge tags cleanup [options] ``` -Remove tag definitions no document still uses (personal API key required) +Remove tag definitions no document still uses (OAuth login or personal API key required) **Arguments** @@ -160,7 +160,7 @@ Remove tag definitions no document still uses (personal API key required) sim knowledge tags next-slot [options] ``` -Show which tag slot a create would take for a field type (personal API key required) +Show which tag slot a create would take for a field type (OAuth login or personal API key required) **Arguments** @@ -204,7 +204,7 @@ sim knowledge tags list sim knowledge tags usage ``` -Show how many documents and chunks carry each tag (personal API key required) +Show how many documents and chunks carry each tag (OAuth login or personal API key required) **Arguments** @@ -222,7 +222,7 @@ Show how many documents and chunks carry each tag (personal API key required) sim knowledge tags update [options] ``` -Update Tag (personal API key required) +Update Tag (OAuth login or personal API key required) **Arguments** @@ -252,7 +252,7 @@ Update Tag (personal API key required) sim knowledge chunks batch-update [options] ``` -Enable, disable, or delete many chunks at once (personal API key required) +Enable, disable, or delete many chunks at once (OAuth login or personal API key required) **Arguments** @@ -283,7 +283,7 @@ Enable, disable, or delete many chunks at once (personal API key required) sim knowledge chunks create [options] ``` -Create Chunk (personal API key required) +Create Chunk (OAuth login or personal API key required) **Arguments** @@ -314,7 +314,7 @@ Create Chunk (personal API key required) sim knowledge chunks delete [options] ``` -Delete Chunk (personal API key required) +Delete Chunk (OAuth login or personal API key required) **Arguments** @@ -344,7 +344,7 @@ Delete Chunk (personal API key required) sim knowledge chunks get ``` -Get Chunk (personal API key required) +Get Chunk (OAuth login or personal API key required) **Arguments** @@ -364,7 +364,7 @@ Get Chunk (personal API key required) sim knowledge chunks list [options] ``` -List Chunks (personal API key required) +List Chunks (OAuth login or personal API key required) **Arguments** @@ -397,7 +397,7 @@ List Chunks (personal API key required) sim knowledge chunks update [options] ``` -Update Chunk (personal API key required) +Update Chunk (OAuth login or personal API key required) **Arguments** @@ -429,7 +429,7 @@ Update Chunk (personal API key required) sim knowledge documents batch-update [options] ``` -Enable or disable every matching document (personal API key required) +Enable or disable every matching document (OAuth login or personal API key required) **Arguments** @@ -535,7 +535,7 @@ sim knowledge documents list [options] sim knowledge documents update [options] ``` -Update Document (personal API key required) +Update Document (OAuth login or personal API key required) **Arguments** @@ -636,7 +636,7 @@ sim knowledge create [options] sim knowledge connectors create [options] ``` -Create Knowledge Connector (personal API key required) +Create Knowledge Connector (OAuth login or personal API key required) **Arguments** @@ -668,7 +668,7 @@ Create Knowledge Connector (personal API key required) sim knowledge connectors delete [options] ``` -Delete Knowledge Connector (personal API key required) +Delete Knowledge Connector (OAuth login or personal API key required) **Arguments** @@ -699,7 +699,7 @@ Delete Knowledge Connector (personal API key required) sim knowledge connectors get ``` -Get Knowledge Connector (personal API key required) +Get Knowledge Connector (OAuth login or personal API key required) **Arguments** @@ -718,7 +718,7 @@ Get Knowledge Connector (personal API key required) sim knowledge connectors documents list [options] ``` -List Knowledge Connector Documents (personal API key required) +List Knowledge Connector Documents (OAuth login or personal API key required) **Arguments** @@ -749,7 +749,7 @@ List Knowledge Connector Documents (personal API key required) sim knowledge connectors documents update [options] ``` -Update Knowledge Connector Documents (personal API key required) +Update Knowledge Connector Documents (OAuth login or personal API key required) **Arguments** @@ -779,7 +779,7 @@ Update Knowledge Connector Documents (personal API key required) sim knowledge connectors list [options] ``` -List Knowledge Connectors (personal API key required) +List Knowledge Connectors (OAuth login or personal API key required) **Arguments** @@ -809,7 +809,7 @@ List Knowledge Connectors (personal API key required) sim knowledge connectors sync [options] ``` -Queue a knowledge connector synchronization (personal API key required) +Queue a knowledge connector synchronization (OAuth login or personal API key required) **Arguments** @@ -839,7 +839,7 @@ Queue a knowledge connector synchronization (personal API key required) sim knowledge connectors update [options] ``` -Update Knowledge Connector (personal API key required) +Update Knowledge Connector (OAuth login or personal API key required) **Arguments** diff --git a/apps/docs/content/docs/cli/logs.mdx b/apps/docs/content/docs/cli/logs.mdx index df85aaa0bf1..186a39255de 100644 --- a/apps/docs/content/docs/cli/logs.mdx +++ b/apps/docs/content/docs/cli/logs.mdx @@ -70,7 +70,7 @@ sim logs list [options] | Option | Required | Description | | --- | --- | --- | | `--workflow ` | No | Comma-separated workflow identifiers to include. An empty entry is rejected. At most 200 entries. (space-separated, or @path / @- with one value per line; @@value for a literal leading @). | -| `--trigger ` | No | Comma-separated trigger types to include. An empty entry is rejected. Values are matched exactly and are case-sensitive — every recorded trigger is lowercase, so `API` matches nothing while `api` matches. The vocabulary is open: it covers the core trigger types (`manual`, `api`, `schedule`, `chat`, `webhook`, `mcp`, `copilot`, `workflow`, `custom_block`) and the provider id of any webhook trigger (`slack`, `gmail`, `github`, …), so an unrecognized member is not rejected — it selects no runs. The literal value `all` is a sentinel that disables this filter entirely, so a list containing it returns runs of every trigger type; no real trigger type is named `all`. At most 100 entries. (space-separated, or @path / @- with one value per line; @@value for a literal leading @). | +| `--trigger ` | No | Comma-separated, lowercase trigger types or webhook provider IDs. Matching is exact and case-sensitive; unknown values select no runs. An empty entry is rejected. The sentinel `all` disables this filter, even when listed with other values. At most 100 entries. (space-separated, or @path / @- with one value per line; @@value for a literal leading @). | | `--level ` | No | Severity level to include. Accepted values: `info`, `error`. | | `--start-date ` | No | Only include runs started at or after this UTC ISO 8601 timestamp, e.g. `2026-08-06T00:00:00Z`. A date without a time, or a timestamp carrying a UTC offset instead of `Z`, is rejected, as is year `0000`, which names no storable instant. | | `--end-date ` | No | Only include runs started at or before this UTC ISO 8601 timestamp, e.g. `2026-08-06T00:00:00Z`. A date without a time, or a timestamp carrying a UTC offset instead of `Z`, is rejected, as is year `0000`, which names no storable instant. | @@ -85,7 +85,7 @@ sim logs list [options] | `--limit ` | No | Maximum items to return (0 for everything). Defaults to `100`. | | `--status ` | No | Comma-separated execution statuses to include, from `pending` \| `running` \| `paused` \| `redacting` \| `completed` \| `failed` \| `cancelled`. An empty entry is rejected. ANDed with `level`, which reports severity rather than lifecycle. | | `--workflow-name ` | No | Case-insensitive substring match against the run's workflow name. Runs whose workflow has been deleted match nothing, because the name is no longer joinable. | -| `--include-job-runs` | No | Whether Chat and Sim-agent job runs join the sequence alongside workflow runs. Job runs report `kind: "job"`, carry no `workflow` summary, and never carry a cost ledger. They are dropped entirely — not partially matched — whenever a filter they cannot answer is set: by workflow, workflow name, folder, model, or status. A filter therefore never means two different things across the union. Accepted only when sorting by `startedAt`: job runs record cost as a document and no comparable status, so they cannot participate in the other orderings. | +| `--include-job-runs` | No | Include Chat and Sim-agent jobs alongside workflow runs. Jobs use `kind: "job"` and have no workflow or cost ledger. Workflow, folder, model, or status filters exclude jobs. This option is valid only when sorting by `startedAt`. | | `--no-include-job-runs` | No | Send --include-job-runs as false. | | `--run-id ` | No | Exact run identifier to match. | | `--sort-by ` | No | Field used to sort the result. `durationMs` and `cost` are null until a run settles; those runs order as though the value were below every recorded one, so they trail an ascending page and lead a descending one. Only `startedAt` can order Chat and Sim-agent job runs, so any other value is rejected when job runs are included. Accepted values: `startedAt`, `durationMs`, `cost`, `status`. | diff --git a/apps/docs/content/docs/cli/mcp-servers.mdx b/apps/docs/content/docs/cli/mcp-servers.mdx index db0f65a115a..ca1607cc7f9 100644 --- a/apps/docs/content/docs/cli/mcp-servers.mdx +++ b/apps/docs/content/docs/cli/mcp-servers.mdx @@ -103,7 +103,7 @@ sim mcp-servers list [options] sim mcp-servers tools list [options] ``` -List MCP Server Tools (personal API key required) +List MCP Server Tools (OAuth login or personal API key required) **Arguments** diff --git a/apps/docs/content/docs/cli/reference.mdx b/apps/docs/content/docs/cli/reference.mdx index 99ad6ec88ce..792ec073437 100644 --- a/apps/docs/content/docs/cli/reference.mdx +++ b/apps/docs/content/docs/cli/reference.mdx @@ -178,7 +178,7 @@ Also spelled `sim audit-log`. ### sim audit-logs get -Get Audit Log (personal API key required) +Get Audit Log (OAuth login or personal API key required) ```bash sim audit-logs get [options] @@ -200,13 +200,13 @@ sim audit-logs get [options] | Option | Required | Description | | --- | --- | --- | -| `--organization ` | No | Organization ID; defaults to your only organization, and is required when your account belongs to more than one (personal API key required). | +| `--organization ` | No | Organization ID; defaults to your only organization, and is required when your account belongs to more than one (OAuth login or personal API key required). | ### sim audit-logs list -List Audit Logs (personal API key required) +List Audit Logs (OAuth login or personal API key required) ```bash sim audit-logs list [options] @@ -226,9 +226,9 @@ sim audit-logs list [options] | `--include-departed` | No | Include actions by users who have left the organization. | | `--no-include-departed` | No | Send --include-departed as false. | | `--limit ` | No | Maximum items to return (0 for everything). Defaults to `100`. | -| `--organization ` | No | Organization ID; defaults to your only organization, and is required when your account belongs to more than one (personal API key required). | +| `--organization ` | No | Organization ID; defaults to your only organization, and is required when your account belongs to more than one (OAuth login or personal API key required). | | `--actor-email ` | No | Filter by actor email address. | -| `--all-workspaces` | No | Do not filter to the configured workspace (personal API key required for account-wide access). | +| `--all-workspaces` | No | Do not filter to the configured workspace (OAuth login or personal API key required for account-wide access). | @@ -236,7 +236,7 @@ sim audit-logs list [options] ### sim billing status -Show billing status and current-period credit usage (credits and storage require a personal API key) +Show billing status and current-period credit usage (credits and storage require an OAuth login or personal API key) ```bash sim billing status [options] @@ -248,13 +248,13 @@ sim billing status [options] | Option | Required | Description | | --- | --- | --- | -| `--all-workspaces` | No | Do not filter to the configured workspace (personal API key required for account-wide access). | +| `--all-workspaces` | No | Do not filter to the configured workspace (OAuth login or personal API key required for account-wide access). | ### sim billing logs -List credit usage events (a personal API key reports only your own events; a workspace API key reports every member's in aggregate, unattributed) +List credit usage events (an OAuth login or personal API key reports only your events; a workspace API key reports every member's in aggregate, unattributed) ```bash sim billing logs [options] @@ -271,7 +271,7 @@ sim billing logs [options] | `--start-date ` | No | Custom period start (ISO 8601). | | `--end-date ` | No | Custom period end (ISO 8601). | | `--limit ` | No | Maximum items to return (0 for everything). Defaults to `100`. | -| `--all-workspaces` | No | Do not filter to the configured workspace (personal API key required for account-wide access). | +| `--all-workspaces` | No | Do not filter to the configured workspace (OAuth login or personal API key required for account-wide access). | @@ -370,7 +370,7 @@ Also spelled `sim credential`. ### sim credentials delete -Disconnect Credential (personal API key required) +Disconnect Credential (OAuth login or personal API key required) ```bash sim credentials delete [options] @@ -439,7 +439,7 @@ sim credentials list [options] ### sim credentials update -Update Credential (personal API key required) +Update Credential (OAuth login or personal API key required) ```bash sim credentials update [options] @@ -482,7 +482,7 @@ sim credentials update [options] ### sim credentials create -Create a service-account credential using its discovered provider schema (personal API key required) +Create a service-account credential using its discovered provider schema (OAuth login or personal API key required) ```bash sim credentials create [options] @@ -513,7 +513,7 @@ sim credentials create [options] ### sim credentials connect -Create a short-lived link for connecting an OAuth provider (personal API key required) +Create a short-lived link for connecting an OAuth provider (OAuth login or personal API key required) ```bash sim credentials connect [options] @@ -541,7 +541,7 @@ sim credentials connect [options] ### sim credentials reconnect -Create a short-lived link for reconnecting an OAuth credential (personal API key required) +Create a short-lived link for reconnecting an OAuth credential (OAuth login or personal API key required) ```bash sim credentials reconnect @@ -939,7 +939,7 @@ sim files share get ### sim files share set -Enable or disable sharing for a file (personal API key required) +Enable or disable sharing for a file (OAuth login or personal API key required) ```bash sim files share set [options] @@ -1281,7 +1281,7 @@ Also spelled `sim kb`. ### sim knowledge from-workspace-files create -Index files the workspace already stores (personal API key required) +Index files the workspace already stores (OAuth login or personal API key required) ```bash sim knowledge from-workspace-files create [options] @@ -1309,7 +1309,7 @@ sim knowledge from-workspace-files create [options] ### sim knowledge tags save -Declare the tag definitions a knowledge base needs (personal API key required) +Declare the tag definitions a knowledge base needs (OAuth login or personal API key required) ```bash sim knowledge tags save [options] @@ -1337,7 +1337,7 @@ sim knowledge tags save [options] ### sim knowledge tags create -Create Tag (personal API key required) +Create Tag (OAuth login or personal API key required) ```bash sim knowledge tags create [options] @@ -1367,7 +1367,7 @@ sim knowledge tags create [options] ### sim knowledge tags delete -Delete Tag (personal API key required) +Delete Tag (OAuth login or personal API key required) ```bash sim knowledge tags delete [options] @@ -1396,7 +1396,7 @@ sim knowledge tags delete [options] ### sim knowledge tags cleanup -Remove tag definitions no document still uses (personal API key required) +Remove tag definitions no document still uses (OAuth login or personal API key required) ```bash sim knowledge tags cleanup [options] @@ -1426,7 +1426,7 @@ sim knowledge tags cleanup [options] ### sim knowledge tags next-slot -Show which tag slot a create would take for a field type (personal API key required) +Show which tag slot a create would take for a field type (OAuth login or personal API key required) ```bash sim knowledge tags next-slot [options] @@ -1472,7 +1472,7 @@ sim knowledge tags list ### sim knowledge tags usage -Show how many documents and chunks carry each tag (personal API key required) +Show how many documents and chunks carry each tag (OAuth login or personal API key required) ```bash sim knowledge tags usage @@ -1490,7 +1490,7 @@ sim knowledge tags usage ### sim knowledge tags update -Update Tag (personal API key required) +Update Tag (OAuth login or personal API key required) ```bash sim knowledge tags update [options] @@ -1520,7 +1520,7 @@ sim knowledge tags update [options] ### sim knowledge chunks batch-update -Enable, disable, or delete many chunks at once (personal API key required) +Enable, disable, or delete many chunks at once (OAuth login or personal API key required) ```bash sim knowledge chunks batch-update [options] @@ -1551,7 +1551,7 @@ sim knowledge chunks batch-update [options] ### sim knowledge chunks create -Create Chunk (personal API key required) +Create Chunk (OAuth login or personal API key required) ```bash sim knowledge chunks create [options] @@ -1582,7 +1582,7 @@ sim knowledge chunks create [options] ### sim knowledge chunks delete -Delete Chunk (personal API key required) +Delete Chunk (OAuth login or personal API key required) ```bash sim knowledge chunks delete [options] @@ -1612,7 +1612,7 @@ sim knowledge chunks delete [options] ### sim knowledge chunks get -Get Chunk (personal API key required) +Get Chunk (OAuth login or personal API key required) ```bash sim knowledge chunks get @@ -1632,7 +1632,7 @@ sim knowledge chunks get ### sim knowledge chunks list -List Chunks (personal API key required) +List Chunks (OAuth login or personal API key required) ```bash sim knowledge chunks list [options] @@ -1665,7 +1665,7 @@ sim knowledge chunks list [options] ### sim knowledge chunks update -Update Chunk (personal API key required) +Update Chunk (OAuth login or personal API key required) ```bash sim knowledge chunks update [options] @@ -1697,7 +1697,7 @@ sim knowledge chunks update [options] ### sim knowledge documents batch-update -Enable or disable every matching document (personal API key required) +Enable or disable every matching document (OAuth login or personal API key required) ```bash sim knowledge documents batch-update [options] @@ -1809,7 +1809,7 @@ sim knowledge documents list [options] ### sim knowledge documents update -Update Document (personal API key required) +Update Document (OAuth login or personal API key required) ```bash sim knowledge documents update [options] @@ -1914,7 +1914,7 @@ sim knowledge create [options] ### sim knowledge connectors create -Create Knowledge Connector (personal API key required) +Create Knowledge Connector (OAuth login or personal API key required) ```bash sim knowledge connectors create [options] @@ -1946,7 +1946,7 @@ sim knowledge connectors create [options] ### sim knowledge connectors delete -Delete Knowledge Connector (personal API key required) +Delete Knowledge Connector (OAuth login or personal API key required) ```bash sim knowledge connectors delete [options] @@ -1977,7 +1977,7 @@ sim knowledge connectors delete [options] ### sim knowledge connectors get -Get Knowledge Connector (personal API key required) +Get Knowledge Connector (OAuth login or personal API key required) ```bash sim knowledge connectors get @@ -1996,7 +1996,7 @@ sim knowledge connectors get ### sim knowledge connectors documents list -List Knowledge Connector Documents (personal API key required) +List Knowledge Connector Documents (OAuth login or personal API key required) ```bash sim knowledge connectors documents list [options] @@ -2027,7 +2027,7 @@ sim knowledge connectors documents list [options ### sim knowledge connectors documents update -Update Knowledge Connector Documents (personal API key required) +Update Knowledge Connector Documents (OAuth login or personal API key required) ```bash sim knowledge connectors documents update [options] @@ -2057,7 +2057,7 @@ sim knowledge connectors documents update [optio ### sim knowledge connectors list -List Knowledge Connectors (personal API key required) +List Knowledge Connectors (OAuth login or personal API key required) ```bash sim knowledge connectors list [options] @@ -2087,7 +2087,7 @@ sim knowledge connectors list [options] ### sim knowledge connectors sync -Queue a knowledge connector synchronization (personal API key required) +Queue a knowledge connector synchronization (OAuth login or personal API key required) ```bash sim knowledge connectors sync [options] @@ -2117,7 +2117,7 @@ sim knowledge connectors sync [options] ### sim knowledge connectors update -Update Knowledge Connector (personal API key required) +Update Knowledge Connector (OAuth login or personal API key required) ```bash sim knowledge connectors update [options] @@ -2518,7 +2518,7 @@ sim logs list [options] | Option | Required | Description | | --- | --- | --- | | `--workflow ` | No | Comma-separated workflow identifiers to include. An empty entry is rejected. At most 200 entries. (space-separated, or @path / @- with one value per line; @@value for a literal leading @). | -| `--trigger ` | No | Comma-separated trigger types to include. An empty entry is rejected. Values are matched exactly and are case-sensitive — every recorded trigger is lowercase, so `API` matches nothing while `api` matches. The vocabulary is open: it covers the core trigger types (`manual`, `api`, `schedule`, `chat`, `webhook`, `mcp`, `copilot`, `workflow`, `custom_block`) and the provider id of any webhook trigger (`slack`, `gmail`, `github`, …), so an unrecognized member is not rejected — it selects no runs. The literal value `all` is a sentinel that disables this filter entirely, so a list containing it returns runs of every trigger type; no real trigger type is named `all`. At most 100 entries. (space-separated, or @path / @- with one value per line; @@value for a literal leading @). | +| `--trigger ` | No | Comma-separated, lowercase trigger types or webhook provider IDs. Matching is exact and case-sensitive; unknown values select no runs. An empty entry is rejected. The sentinel `all` disables this filter, even when listed with other values. At most 100 entries. (space-separated, or @path / @- with one value per line; @@value for a literal leading @). | | `--level ` | No | Severity level to include. Accepted values: `info`, `error`. | | `--start-date ` | No | Only include runs started at or after this UTC ISO 8601 timestamp, e.g. `2026-08-06T00:00:00Z`. A date without a time, or a timestamp carrying a UTC offset instead of `Z`, is rejected, as is year `0000`, which names no storable instant. | | `--end-date ` | No | Only include runs started at or before this UTC ISO 8601 timestamp, e.g. `2026-08-06T00:00:00Z`. A date without a time, or a timestamp carrying a UTC offset instead of `Z`, is rejected, as is year `0000`, which names no storable instant. | @@ -2533,7 +2533,7 @@ sim logs list [options] | `--limit ` | No | Maximum items to return (0 for everything). Defaults to `100`. | | `--status ` | No | Comma-separated execution statuses to include, from `pending` \| `running` \| `paused` \| `redacting` \| `completed` \| `failed` \| `cancelled`. An empty entry is rejected. ANDed with `level`, which reports severity rather than lifecycle. | | `--workflow-name ` | No | Case-insensitive substring match against the run's workflow name. Runs whose workflow has been deleted match nothing, because the name is no longer joinable. | -| `--include-job-runs` | No | Whether Chat and Sim-agent job runs join the sequence alongside workflow runs. Job runs report `kind: "job"`, carry no `workflow` summary, and never carry a cost ledger. They are dropped entirely — not partially matched — whenever a filter they cannot answer is set: by workflow, workflow name, folder, model, or status. A filter therefore never means two different things across the union. Accepted only when sorting by `startedAt`: job runs record cost as a document and no comparable status, so they cannot participate in the other orderings. | +| `--include-job-runs` | No | Include Chat and Sim-agent jobs alongside workflow runs. Jobs use `kind: "job"` and have no workflow or cost ledger. Workflow, folder, model, or status filters exclude jobs. This option is valid only when sorting by `startedAt`. | | `--no-include-job-runs` | No | Send --include-job-runs as false. | | `--run-id ` | No | Exact run identifier to match. | | `--sort-by ` | No | Field used to sort the result. `durationMs` and `cost` are null until a run settles; those runs order as though the value were below every recorded one, so they trail an ascending page and lead a descending one. Only `startedAt` can order Chat and Sim-agent job runs, so any other value is rejected when job runs are included. Accepted values: `startedAt`, `durationMs`, `cost`, `status`. | @@ -2668,7 +2668,7 @@ sim mcp-servers list [options] ### sim mcp-servers tools list -List MCP Server Tools (personal API key required) +List MCP Server Tools (OAuth login or personal API key required) ```bash sim mcp-servers tools list [options] @@ -2750,7 +2750,7 @@ Also spelled `sim sandbox`. ### sim sandboxes create -Create Sandbox (personal API key required) +Create Sandbox (OAuth login or personal API key required) ```bash sim sandboxes create [options] @@ -2772,7 +2772,7 @@ sim sandboxes create [options] ### sim sandboxes delete -Delete Sandbox (personal API key required) +Delete Sandbox (OAuth login or personal API key required) ```bash sim sandboxes delete [options] @@ -2839,7 +2839,7 @@ sim sandboxes list [options] ### sim sandboxes update -Update Sandbox (personal API key required) +Update Sandbox (OAuth login or personal API key required) ```bash sim sandboxes update [options] @@ -2875,7 +2875,7 @@ Also spelled `sim secret`. ### sim secrets delete -Delete Secret (personal API key required) +Delete Secret (OAuth login or personal API key required) ```bash sim secrets delete [options] @@ -2904,7 +2904,7 @@ sim secrets delete [options] ### sim secrets list -List Secrets (personal API key required) +List Secrets (OAuth login or personal API key required) ```bash sim secrets list [options] @@ -2926,7 +2926,7 @@ sim secrets list [options] ### sim secrets set -Create or replace a named secret (personal API key required) +Create or replace a named secret (OAuth login or personal API key required) ```bash sim secrets set [options] @@ -2962,7 +2962,7 @@ Also spelled `sim skill`. ### sim skills create -Create Skill (personal API key required) +Create Skill (OAuth login or personal API key required) ```bash sim skills create [options] @@ -2982,7 +2982,7 @@ sim skills create [options] ### sim skills delete -Delete Skill (personal API key required) +Delete Skill (OAuth login or personal API key required) ```bash sim skills delete [options] @@ -3028,7 +3028,7 @@ sim skills get ### sim skills editors create -Grant Skill Editor (personal API key required) +Grant Skill Editor (OAuth login or personal API key required) ```bash sim skills editors create [options] @@ -3086,7 +3086,7 @@ sim skills editors list [options] ### sim skills editors delete -Revoke Skill Editor (personal API key required) +Revoke Skill Editor (OAuth login or personal API key required) ```bash sim skills editors delete [options] @@ -3136,7 +3136,7 @@ sim skills list [options] ### sim skills update -Update Skill (personal API key required) +Update Skill (OAuth login or personal API key required) ```bash sim skills update [options] @@ -4551,7 +4551,7 @@ sim tables mkdir ### sim tools execute -Run one built-in tool and print what it produced (personal API key required) +Run one built-in tool and print what it produced (OAuth login or personal API key required) ```bash sim tools execute [options] @@ -4624,7 +4624,7 @@ sim tools list [options] ### sim workflow-mcp-servers create -Create Workflow MCP Server (personal API key required) +Create Workflow MCP Server (OAuth login or personal API key required) ```bash sim workflow-mcp-servers create [options] @@ -4646,7 +4646,7 @@ sim workflow-mcp-servers create [options] ### sim workflow-mcp-servers delete -Delete Workflow MCP Server (personal API key required) +Delete Workflow MCP Server (OAuth login or personal API key required) ```bash sim workflow-mcp-servers delete [options] @@ -4674,7 +4674,7 @@ sim workflow-mcp-servers delete [options] ### sim workflow-mcp-servers tools create -Publish Workflow As MCP Tool (personal API key required) +Publish Workflow As MCP Tool (OAuth login or personal API key required) ```bash sim workflow-mcp-servers tools create [options] @@ -4705,7 +4705,7 @@ sim workflow-mcp-servers tools create [options] ### sim workflow-mcp-servers tools list -List Workflow MCP Tools (personal API key required) +List Workflow MCP Tools (OAuth login or personal API key required) ```bash sim workflow-mcp-servers tools list @@ -4723,7 +4723,7 @@ sim workflow-mcp-servers tools list ### sim workflow-mcp-servers tools delete -Unpublish Workflow MCP Tool (personal API key required) +Unpublish Workflow MCP Tool (OAuth login or personal API key required) ```bash sim workflow-mcp-servers tools delete [options] @@ -4752,7 +4752,7 @@ sim workflow-mcp-servers tools delete [options] ### sim workflow-mcp-servers get -Get Workflow MCP Server (personal API key required) +Get Workflow MCP Server (OAuth login or personal API key required) ```bash sim workflow-mcp-servers get @@ -4770,7 +4770,7 @@ sim workflow-mcp-servers get ### sim workflow-mcp-servers list -List Workflow MCP Servers (personal API key required) +List Workflow MCP Servers (OAuth login or personal API key required) ```bash sim workflow-mcp-servers list [options] @@ -4790,7 +4790,7 @@ sim workflow-mcp-servers list [options] ### sim workflow-mcp-servers update -Update Workflow MCP Server (personal API key required) +Update Workflow MCP Server (OAuth login or personal API key required) ```bash sim workflow-mcp-servers update [options] @@ -4825,7 +4825,7 @@ Also spelled `sim workflow`. ### sim workflows activate create -Activate Workflow Version (personal API key required) +Activate Workflow Version (OAuth login or personal API key required) ```bash sim workflows activate create [options] @@ -4854,7 +4854,7 @@ sim workflows activate create [options] ### sim workflows operations apply -Apply Workflow Operations (personal API key required) +Apply Workflow Operations ```bash sim workflows operations apply [options] @@ -5201,7 +5201,7 @@ sim workflows delete [options] ### sim workflows chat unpublish -Take a workflow’s chat deployment offline (personal API key required) +Take a workflow’s chat deployment offline (OAuth login or personal API key required) ```bash sim workflows chat unpublish [options] @@ -5229,7 +5229,7 @@ sim workflows chat unpublish [options] ### sim workflows chat status -Show a workflow’s chat deployment (personal API key required) +Show a workflow’s chat deployment (OAuth login or personal API key required) ```bash sim workflows chat status @@ -5247,7 +5247,7 @@ sim workflows chat status ### sim workflows chat publish -Publish or replace a workflow’s chat deployment (personal API key required) +Publish or replace a workflow’s chat deployment ```bash sim workflows chat publish [options] @@ -5287,7 +5287,7 @@ sim workflows chat publish [options] ### sim workflows deploy -Deploy Workflow (personal API key required) +Deploy Workflow (OAuth login or personal API key required) ```bash sim workflows deploy [options] @@ -5442,7 +5442,7 @@ sim workflows deployment status ### sim workflows deployment update -Update Workflow Public API Access (personal API key required) +Update Workflow Public API Access (OAuth login or personal API key required) ```bash sim workflows deployment update [options] @@ -5488,7 +5488,7 @@ sim workflows state get ### sim workflows state replace -Replace Workflow State (personal API key required) +Replace Workflow State ```bash sim workflows state replace [options] @@ -5683,7 +5683,7 @@ sim workflows restore ### sim workflows revert create -Revert Workflow To Version (personal API key required) +Revert Workflow To Version (OAuth login or personal API key required) ```bash sim workflows revert create [options] @@ -5712,7 +5712,7 @@ sim workflows revert create [options] ### sim workflows rollback -Rollback Workflow (personal API key required) +Rollback Workflow (OAuth login or personal API key required) ```bash sim workflows rollback [options] @@ -5741,7 +5741,7 @@ sim workflows rollback [options] ### sim workflows undeploy -Take a workflow out of deployment (personal API key required) +Take a workflow out of deployment (OAuth login or personal API key required) ```bash sim workflows undeploy [options] diff --git a/apps/docs/content/docs/cli/sandboxes.mdx b/apps/docs/content/docs/cli/sandboxes.mdx index 9a73cc47dae..fc2a3c125a3 100644 --- a/apps/docs/content/docs/cli/sandboxes.mdx +++ b/apps/docs/content/docs/cli/sandboxes.mdx @@ -15,7 +15,7 @@ Every command below also accepts the [global options](/cli/commands#global-optio sim sandboxes create [options] ``` -Create Sandbox (personal API key required) +Create Sandbox (OAuth login or personal API key required) **Options** @@ -37,7 +37,7 @@ Create Sandbox (personal API key required) sim sandboxes delete [options] ``` -Delete Sandbox (personal API key required) +Delete Sandbox (OAuth login or personal API key required) **Arguments** @@ -100,7 +100,7 @@ sim sandboxes list [options] sim sandboxes update [options] ``` -Update Sandbox (personal API key required) +Update Sandbox (OAuth login or personal API key required) **Arguments** diff --git a/apps/docs/content/docs/cli/secrets.mdx b/apps/docs/content/docs/cli/secrets.mdx index f9bbbdb2cdb..6cd7d80aa29 100644 --- a/apps/docs/content/docs/cli/secrets.mdx +++ b/apps/docs/content/docs/cli/secrets.mdx @@ -15,7 +15,7 @@ Every command below also accepts the [global options](/cli/commands#global-optio sim secrets delete [options] ``` -Delete Secret (personal API key required) +Delete Secret (OAuth login or personal API key required) **Arguments** @@ -44,7 +44,7 @@ Delete Secret (personal API key required) sim secrets list [options] ``` -List Secrets (personal API key required) +List Secrets (OAuth login or personal API key required) **Options** @@ -66,7 +66,7 @@ List Secrets (personal API key required) sim secrets set [options] ``` -Create or replace a named secret (personal API key required) +Create or replace a named secret (OAuth login or personal API key required) **Arguments** diff --git a/apps/docs/content/docs/cli/skills.mdx b/apps/docs/content/docs/cli/skills.mdx index 77d928a5ead..b11c57d4030 100644 --- a/apps/docs/content/docs/cli/skills.mdx +++ b/apps/docs/content/docs/cli/skills.mdx @@ -15,7 +15,7 @@ Every command below also accepts the [global options](/cli/commands#global-optio sim skills create [options] ``` -Create Skill (personal API key required) +Create Skill (OAuth login or personal API key required) **Options** @@ -35,7 +35,7 @@ Create Skill (personal API key required) sim skills delete [options] ``` -Delete Skill (personal API key required) +Delete Skill (OAuth login or personal API key required) **Arguments** @@ -79,7 +79,7 @@ sim skills get sim skills editors create [options] ``` -Grant Skill Editor (personal API key required) +Grant Skill Editor (OAuth login or personal API key required) **Arguments** @@ -135,7 +135,7 @@ sim skills editors list [options] sim skills editors delete [options] ``` -Revoke Skill Editor (personal API key required) +Revoke Skill Editor (OAuth login or personal API key required) **Arguments** @@ -183,7 +183,7 @@ sim skills list [options] sim skills update [options] ``` -Update Skill (personal API key required) +Update Skill (OAuth login or personal API key required) **Arguments** diff --git a/apps/docs/content/docs/cli/tools.mdx b/apps/docs/content/docs/cli/tools.mdx index 83bdb04bbc5..2248ec6c063 100644 --- a/apps/docs/content/docs/cli/tools.mdx +++ b/apps/docs/content/docs/cli/tools.mdx @@ -13,7 +13,7 @@ Every command below also accepts the [global options](/cli/commands#global-optio sim tools execute [options] ``` -Run one built-in tool and print what it produced (personal API key required) +Run one built-in tool and print what it produced (OAuth login or personal API key required) **Arguments** diff --git a/apps/docs/content/docs/cli/workflow-mcp-servers.mdx b/apps/docs/content/docs/cli/workflow-mcp-servers.mdx index ca7ca03a730..56fdb984f24 100644 --- a/apps/docs/content/docs/cli/workflow-mcp-servers.mdx +++ b/apps/docs/content/docs/cli/workflow-mcp-servers.mdx @@ -13,7 +13,7 @@ Every command below also accepts the [global options](/cli/commands#global-optio sim workflow-mcp-servers create [options] ``` -Create Workflow MCP Server (personal API key required) +Create Workflow MCP Server (OAuth login or personal API key required) **Options** @@ -35,7 +35,7 @@ Create Workflow MCP Server (personal API key required) sim workflow-mcp-servers delete [options] ``` -Delete Workflow MCP Server (personal API key required) +Delete Workflow MCP Server (OAuth login or personal API key required) **Arguments** @@ -63,7 +63,7 @@ Delete Workflow MCP Server (personal API key required) sim workflow-mcp-servers tools create [options] ``` -Publish Workflow As MCP Tool (personal API key required) +Publish Workflow As MCP Tool (OAuth login or personal API key required) **Arguments** @@ -94,7 +94,7 @@ Publish Workflow As MCP Tool (personal API key required) sim workflow-mcp-servers tools list ``` -List Workflow MCP Tools (personal API key required) +List Workflow MCP Tools (OAuth login or personal API key required) **Arguments** @@ -112,7 +112,7 @@ List Workflow MCP Tools (personal API key required) sim workflow-mcp-servers tools delete [options] ``` -Unpublish Workflow MCP Tool (personal API key required) +Unpublish Workflow MCP Tool (OAuth login or personal API key required) **Arguments** @@ -141,7 +141,7 @@ Unpublish Workflow MCP Tool (personal API key required) sim workflow-mcp-servers get ``` -Get Workflow MCP Server (personal API key required) +Get Workflow MCP Server (OAuth login or personal API key required) **Arguments** @@ -159,7 +159,7 @@ Get Workflow MCP Server (personal API key required) sim workflow-mcp-servers list [options] ``` -List Workflow MCP Servers (personal API key required) +List Workflow MCP Servers (OAuth login or personal API key required) **Options** @@ -179,7 +179,7 @@ List Workflow MCP Servers (personal API key required) sim workflow-mcp-servers update [options] ``` -Update Workflow MCP Server (personal API key required) +Update Workflow MCP Server (OAuth login or personal API key required) **Arguments** diff --git a/apps/docs/content/docs/cli/workflows.mdx b/apps/docs/content/docs/cli/workflows.mdx index 7169b5b2d58..eb434be0dcb 100644 --- a/apps/docs/content/docs/cli/workflows.mdx +++ b/apps/docs/content/docs/cli/workflows.mdx @@ -15,7 +15,7 @@ Every command below also accepts the [global options](/cli/commands#global-optio sim workflows activate create [options] ``` -Activate Workflow Version (personal API key required) +Activate Workflow Version (OAuth login or personal API key required) **Arguments** @@ -44,8 +44,6 @@ Activate Workflow Version (personal API key required) sim workflows operations apply [options] ``` -Apply Workflow Operations (personal API key required) - **Arguments** @@ -371,7 +369,7 @@ sim workflows delete [options] sim workflows chat unpublish [options] ``` -Take a workflow’s chat deployment offline (personal API key required) +Take a workflow’s chat deployment offline (OAuth login or personal API key required) **Arguments** @@ -399,7 +397,7 @@ Take a workflow’s chat deployment offline (personal API key required) sim workflows chat status ``` -Show a workflow’s chat deployment (personal API key required) +Show a workflow’s chat deployment (OAuth login or personal API key required) **Arguments** @@ -417,8 +415,6 @@ Show a workflow’s chat deployment (personal API key required) sim workflows chat publish [options] ``` -Publish or replace a workflow’s chat deployment (personal API key required) - **Arguments** @@ -457,7 +453,7 @@ Publish or replace a workflow’s chat deployment (personal API key required) sim workflows deploy [options] ``` -Deploy Workflow (personal API key required) +Deploy Workflow (OAuth login or personal API key required) **Arguments** @@ -602,7 +598,7 @@ sim workflows deployment status sim workflows deployment update [options] ``` -Update Workflow Public API Access (personal API key required) +Update Workflow Public API Access (OAuth login or personal API key required) **Arguments** @@ -646,8 +642,6 @@ sim workflows state get sim workflows state replace [options] ``` -Replace Workflow State (personal API key required) - **Arguments** @@ -827,7 +821,7 @@ sim workflows restore sim workflows revert create [options] ``` -Revert Workflow To Version (personal API key required) +Revert Workflow To Version (OAuth login or personal API key required) **Arguments** @@ -856,7 +850,7 @@ Revert Workflow To Version (personal API key required) sim workflows rollback [options] ``` -Rollback Workflow (personal API key required) +Rollback Workflow (OAuth login or personal API key required) **Arguments** @@ -885,7 +879,7 @@ Rollback Workflow (personal API key required) sim workflows undeploy [options] ``` -Take a workflow out of deployment (personal API key required) +Take a workflow out of deployment (OAuth login or personal API key required) **Arguments** diff --git a/apps/docs/content/docs/platform/self-hosting/authentication.mdx b/apps/docs/content/docs/platform/self-hosting/authentication.mdx index c42a44d4558..f877776eaac 100644 --- a/apps/docs/content/docs/platform/self-hosting/authentication.mdx +++ b/apps/docs/content/docs/platform/self-hosting/authentication.mdx @@ -81,17 +81,19 @@ See the [SSO guide](/platform/enterprise/sso) for identity-provider setup and th ## Sign in with Sim -Your deployment is also an OAuth 2.1 authorization server, so other software can -sign a person in as themselves and act with their permissions. The Sim CLI uses -it by default; see [CLI authentication](/cli/authentication). +Your deployment can act as an OAuth 2.0 authorization server using authorization +code with PKCE and current OAuth security guidance. The Sim CLI uses it when +enabled; see [CLI authentication](/cli/authentication). -It is on unless you turn it off: +Use a two-phase rollout: apply the database migration while this flag is unset, +deploy and drain every older app instance, then enable it in a separate config +rollout: ```bash -OAUTH_PROVIDER_ENABLED=false +OAUTH_PROVIDER_ENABLED=true ``` -With it off, the discovery document at `/.well-known/oauth-authorization-server` +With it unset or false, the discovery document at `/.well-known/oauth-authorization-server` returns 404 and the CLI falls back to the pairing-code handoff on its own. `DISABLE_AUTH=true` also forces the provider off because the authorization flow requires a real Better Auth user session. @@ -116,11 +118,12 @@ bun run apps/sim/scripts/create-oauth-client.ts ``` Add `OAUTH_CLIENT_PUBLIC=true` for a native or CLI app that cannot keep a -secret; it then authenticates with PKCE alone. Public clients are API clients in -this configuration and may request `offline_access`, `api:read`, and -`api:write`, but not the OpenID identity scopes because public clients cannot -receive an ID token while JWT signing is disabled. A confidential client's -secret is printed once and cannot be read back. +secret; it then authenticates with PKCE alone. The provider exposes +`offline_access`, `api:read`, and `api:write` for API authorization; it does not +expose OpenID Connect identity scopes or issue ID tokens. A confidential +client's secret is printed once and cannot be read back. Confidential clients +use `client_secret_basic`; the registration command prints the token +authentication method alongside the client ID. Redirect URIs must be `https`, or `http` on a loopback address, and are matched exactly — except a loopback URI, where any port matches, because a native app diff --git a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx index e5f5e8a3629..3530eac0a93 100644 --- a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx +++ b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx @@ -127,7 +127,7 @@ Google, GitHub, and Microsoft sign-in, their callback URLs, and the `DISABLE_*_A | Variable | Description | | --- | --- | -| `OAUTH_PROVIDER_ENABLED` | Set to `false` to switch off Sim's own OAuth 2.1 provider. On by default when authentication is enabled. `DISABLE_AUTH=true` also forces it off. With it off, the CLI signs in through the pairing-code handoff instead. See [Authentication](/platform/self-hosting/authentication#sign-in-with-sim) | +| `OAUTH_PROVIDER_ENABLED` | Set to `true` in a second rollout after the migration is applied and every older app instance is drained. Unset/false uses the CLI pairing-code handoff. `DISABLE_AUTH=true` always forces it off. See [Authentication](/platform/self-hosting/authentication#sign-in-with-sim) | ## Integration Credentials diff --git a/apps/docs/openapi-v2-billing.json b/apps/docs/openapi-v2-billing.json index ac67bf29ae6..c9c9dd1262c 100644 --- a/apps/docs/openapi-v2-billing.json +++ b/apps/docs/openapi-v2-billing.json @@ -134,9 +134,9 @@ "name": "workspaceId", "in": "query", "required": false, - "description": "Narrow the ledger to usage events attributed to one workspace. It does not change whose events are reported — a personal API key always reports the usage of the person holding it, and a workspace API key always reports its own workspace's complete ledger across every member. The response `scope` field says which of the two you received. A workspace API key is pinned to its own workspace: any other id answers `404 Workspace not found`, which is also what an id that does not exist answers.", + "description": "Narrow the ledger to one workspace. An OAuth token or personal API key reports only its user's events; a workspace API key reports every member's events in its bound workspace. The response `scope` identifies which view was returned. A workspace key asking for another workspace receives the same `404 Workspace not found` as an unknown id.", "schema": { - "description": "Narrow the ledger to usage events attributed to one workspace. It does not change whose events are reported — a personal API key always reports the usage of the person holding it, and a workspace API key always reports its own workspace's complete ledger across every member. The response `scope` field says which of the two you received. A workspace API key is pinned to its own workspace: any other id answers `404 Workspace not found`, which is also what an id that does not exist answers.", + "description": "Narrow the ledger to one workspace. An OAuth token or personal API key reports only its user's events; a workspace API key reports every member's events in its bound workspace. The response `scope` identifies which view was returned. A workspace key asking for another workspace receives the same `404 Workspace not found` as an unknown id.", "type": "string", "minLength": 1, "maxLength": 128 @@ -447,6 +447,48 @@ } }, "schemas": { + "V2ActionableForbiddenDetails": { + "type": "object", + "properties": { + "code": { + "$ref": "#/components/schemas/V2ForbiddenDetailCode" + } + }, + "required": ["code"], + "additionalProperties": { + "description": "Additional context for this refusal." + }, + "title": "Actionable forbidden details", + "description": "Machine-readable cause and optional context for an actionable `403` response." + }, + "V2ForbiddenDetailCode": { + "type": "string", + "enum": [ + "INSUFFICIENT_WORKSPACE_ROLE", + "PERSONAL_API_KEYS_DISABLED", + "WORKSPACE_KEY_OPERATION_NOT_PERMITTED", + "PRINCIPAL_KIND_NOT_PERMITTED", + "ORGANIZATION_MEMBERSHIP_REQUIRED", + "ORGANIZATION_ADMIN_REQUIRED", + "ENTERPRISE_PLAN_REQUIRED", + "ORGANIZATION_PLAN_REQUIRED", + "AUDIT_LOGS_DISABLED", + "SKILL_EDITOR_ACCESS_REQUIRED", + "SECRET_ADMIN_ACCESS_REQUIRED", + "WORKSPACE_RESOURCE_LIMIT_REACHED", + "PUBLIC_SHARING_NOT_ALLOWED", + "CREDENTIAL_ADMIN_ACCESS_REQUIRED", + "MCP_SERVER_URL_NOT_ALLOWED", + "WORKSPACE_PLAN_CAPABILITY_REQUIRED", + "CHAT_AUTH_MODE_NOT_PERMITTED", + "CONNECTOR_MANAGED_RESOURCE_READ_ONLY", + "PERMISSION_GROUP_CAPABILITY_BLOCKED", + "INTEGRATION_NOT_ALLOWED", + "INSUFFICIENT_SCOPE" + ], + "title": "Forbidden detail code", + "description": "Stable cause code for an actionable `403` response." + }, "V2Error": { "type": "object", "properties": { @@ -462,7 +504,15 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." + "description": "Structured error context whose keys depend on the error. Actionable `403` responses use the `V2ActionableForbiddenDetails` shape; validation failures may return issue arrays instead.", + "anyOf": [ + { + "$ref": "#/components/schemas/V2ActionableForbiddenDetails" + }, + { + "description": "Other structured context defined by the specific error." + } + ] } }, "required": ["code", "message"], @@ -737,7 +787,7 @@ "scope": { "type": "string", "enum": ["user", "workspace"], - "description": "Whose usage this page reports. `user` — the events of the person whose personal API key made the request, narrowed by `workspaceId` when one was given; this omits other members' usage. `workspace` — every member's events for the workspace a workspace API key is pinned to." + "description": "Whose usage this page reports. `user` contains only the OAuth or personal-key user's events, optionally narrowed by `workspaceId`; it omits other members. `workspace` contains every member's events for the workspace API key's bound workspace." } }, "required": ["data", "nextCursor", "scope"], diff --git a/apps/docs/openapi-v2-files-audit.json b/apps/docs/openapi-v2-files-audit.json index 5097055b3f3..38439ca50e9 100644 --- a/apps/docs/openapi-v2-files-audit.json +++ b/apps/docs/openapi-v2-files-audit.json @@ -731,7 +731,7 @@ "get": { "operationId": "readFileText", "summary": "Read File Text", - "description": "Return a file's text content, parsed out of the stored bytes. This reads the file; it writes nothing — `POST /api/v2/files/{fileId}/unzip` is the endpoint that unzips an archive into the workspace. Answers `400` for a type no parser supports, naming the raw-bytes download as the escape hatch, and `413` for a file above the extraction ceiling. A generated document is extracted from its compiled artifact rather than its generation source, so one still compiling answers `409` and is worth retrying. **`degraded: true` means text extraction did not fully succeed and the returned text may be incomplete or synthesized from the file's raw bytes. Do not treat it as authoritative content.** The legacy `.doc` and `.ppt` parsers deliberately return best-effort content rather than failing, so this flag — not an error status — is how a partial extraction is reported. `truncated` separately reports that a parser limit stopped extraction early.", + "description": "Extract text from stored file bytes without modifying the file; use `POST /api/v2/files/{fileId}/unzip` to unpack archives. Unsupported types return `400` and point to raw-byte download; generated documents still compiling return `409`, and files above the extraction ceiling return `413`. `degraded: true` means extraction was incomplete or synthesized from raw bytes and is not authoritative; legacy `.doc` and `.ppt` extraction may return this best-effort result. `truncated` means a parser limit stopped extraction.", "tags": ["Files"], "parameters": [ { @@ -852,7 +852,7 @@ "get": { "operationId": "bulkDownloadFiles", "summary": "Bulk Download Files", - "description": "Stream a selection of workspace files as one zip. Select files by id and folders by path, each as one comma-separated parameter; a folder expands to all its descendants, and a path matching no folder is rejected rather than ignored. Each parameter accepts at most 100 entries — the same ceiling the resolved selection is held to — and the resolved file count and total bytes are checked again, so an over-broad selection answers `400` rather than streaming indefinitely. Downloading records an audit event, so it is not a safe read. A `HEAD` skips the effect but is authorized exactly as the `GET` is, so it answers `400`, `401`, `403`, or `404` wherever the `GET` would and an empty `200` otherwise. Skipping the effect means skipping the read that produces the payload, so that `200` carries none of the response headers documented below — it answers whether the `GET` would be allowed, not what the `GET` would return. In particular a `HEAD` does not report `Content-Length`, so it cannot be used to size a download in advance; read the size from the file resource instead.", + "description": "Stream files as a zip. Provide comma-separated file IDs and folder paths; folders expand recursively, and unmatched paths are rejected. Each parameter and the resolved selection allow at most 100 entries, with bytes bounded. Oversized selections return `400`; downloads record an audit event. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only. `HEAD` omits `Content-Length`; use file metadata to size downloads.", "tags": ["Files"], "parameters": [ { @@ -948,7 +948,7 @@ "post": { "operationId": "unzipFile", "summary": "Unzip File", - "description": "Unzip a `.zip` archive into a new folder beside it and answer counts plus the destination path. This writes new workspace files; it does not read anything out of the archive into the response — `GET /api/v2/files/{fileId}/text` is the endpoint that returns a file's text. The unpacked files are deliberately not returned — a large archive would materialize thousands of objects into one response — so page `GET /api/v2/files?folderPath=...` for the contents. Unzipping is slow: an archive near the size ceiling can run for minutes. Only one unzip of a given archive runs at a time; a concurrent attempt answers `409`. Archives past the size ceiling, and runs that outrun their time budget, answer `413`.", + "description": "Unzip a `.zip` archive into a new sibling folder, creating workspace files and returning only counts and the destination path. Use `GET /api/v2/files/{fileId}/text` to read text; page `GET /api/v2/files?folderPath=...` to inspect unpacked files. Large archives can take minutes. Only one unzip per archive may run; concurrent attempts return `409`. Archives above the size ceiling or operations exceeding their time budget return `413`.", "tags": ["Files"], "parameters": [ { @@ -1035,7 +1035,7 @@ "get": { "operationId": "downloadFile", "summary": "Download File", - "description": "Download the current file bytes from a workspace. A generated document is served as its compiled artifact, so it answers `409` while that artifact is still compiling and `413` if it renders past the size ceiling. Downloading records an audit event, so it is not a safe read. A `HEAD` skips the effect but is authorized exactly as the `GET` is, so it answers `400`, `401`, `403`, or `404` wherever the `GET` would and an empty `200` otherwise. Skipping the effect means skipping the read that produces the payload, so that `200` carries none of the response headers documented below — it answers whether the `GET` would be allowed, not what the `GET` would return. In particular a `HEAD` does not report `Content-Length`, so it cannot be used to size a download in advance; read the size from the file resource instead.", + "description": "Download current file bytes. Generated documents use compiled artifacts, returning `409` while compiling and `413` above the rendered-size ceiling. Downloading records an audit event. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only. `HEAD` omits `Content-Length`; use file metadata to size downloads.", "tags": ["Files"], "parameters": [ { @@ -1953,7 +1953,7 @@ "patch": { "operationId": "editFileContent", "summary": "Edit File Content", - "description": "Change part of a text file in place, leaving the rest untouched. `PUT` on this path replaces the whole file; this is the partial counterpart. `search_replace` matches exact text and requires one match unless `replaceAll` is true. `replace_between`, `insert_after`, and `delete_between` match complete lines after trimming surrounding whitespace, so edits remain stable when unrelated changes move the target to another line. Anchored replacement preserves both boundary lines; insertion preserves its anchor; deletion removes the start anchor and preserves the end anchor. Use `occurrence` when an anchor line repeats. Only files whose stored bytes are UTF-8 text can be edited: a PDF or DOCX answers `400`. A concurrent write answers `409`, and retrying means re-reading first.", + "description": "Modify part of a text file; `PUT` on this path replaces the whole file. `search_replace` requires one exact match unless `replaceAll` is true. The anchored modes match trimmed complete lines: replacement preserves both boundaries, insertion preserves its anchor, and deletion removes the start but preserves the end. Use `occurrence` for repeated anchors. Non-UTF-8 files return `400`. Concurrent writes return `409`; re-read before retrying.", "tags": ["Files"], "parameters": [ { @@ -2125,7 +2125,7 @@ "get": { "operationId": "searchFileContent", "summary": "Search File Content", - "description": "Search the indexed text of active workspace files and return each matching line with its file id and line number. `folderPaths` confines the search to one or more folder trees, which also narrows the reported coverage, so `complete` and `indexStatus` describe the folders searched rather than the whole workspace. Coverage matters: the index is built asynchronously, so when `complete` is `false` a term that was not found is **unknown rather than absent**, and acting on the absence risks creating a duplicate of something already stored. `truncated` separately reports that more matches exist beyond `maxResults`.", + "description": "Search indexed text in active workspace files and return matching lines with file IDs and line numbers. `folderPaths` limits both results and the coverage reported by `complete` and `indexStatus`. Because indexing is asynchronous, a missing term is unknown rather than absent when `complete` is false. `truncated` means additional matches exist beyond `maxResults`.", "tags": ["Files"], "parameters": [ { @@ -3091,6 +3091,48 @@ } }, "schemas": { + "V2ActionableForbiddenDetails": { + "type": "object", + "properties": { + "code": { + "$ref": "#/components/schemas/V2ForbiddenDetailCode" + } + }, + "required": ["code"], + "additionalProperties": { + "description": "Additional context for this refusal." + }, + "title": "Actionable forbidden details", + "description": "Machine-readable cause and optional context for an actionable `403` response." + }, + "V2ForbiddenDetailCode": { + "type": "string", + "enum": [ + "INSUFFICIENT_WORKSPACE_ROLE", + "PERSONAL_API_KEYS_DISABLED", + "WORKSPACE_KEY_OPERATION_NOT_PERMITTED", + "PRINCIPAL_KIND_NOT_PERMITTED", + "ORGANIZATION_MEMBERSHIP_REQUIRED", + "ORGANIZATION_ADMIN_REQUIRED", + "ENTERPRISE_PLAN_REQUIRED", + "ORGANIZATION_PLAN_REQUIRED", + "AUDIT_LOGS_DISABLED", + "SKILL_EDITOR_ACCESS_REQUIRED", + "SECRET_ADMIN_ACCESS_REQUIRED", + "WORKSPACE_RESOURCE_LIMIT_REACHED", + "PUBLIC_SHARING_NOT_ALLOWED", + "CREDENTIAL_ADMIN_ACCESS_REQUIRED", + "MCP_SERVER_URL_NOT_ALLOWED", + "WORKSPACE_PLAN_CAPABILITY_REQUIRED", + "CHAT_AUTH_MODE_NOT_PERMITTED", + "CONNECTOR_MANAGED_RESOURCE_READ_ONLY", + "PERMISSION_GROUP_CAPABILITY_BLOCKED", + "INTEGRATION_NOT_ALLOWED", + "INSUFFICIENT_SCOPE" + ], + "title": "Forbidden detail code", + "description": "Stable cause code for an actionable `403` response." + }, "V2Error": { "type": "object", "properties": { @@ -3106,7 +3148,15 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." + "description": "Structured error context whose keys depend on the error. Actionable `403` responses use the `V2ActionableForbiddenDetails` shape; validation failures may return issue arrays instead.", + "anyOf": [ + { + "$ref": "#/components/schemas/V2ActionableForbiddenDetails" + }, + { + "description": "Other structured context defined by the specific error." + } + ] } }, "required": ["code", "message"], @@ -3423,7 +3473,7 @@ "url": { "type": "string", "format": "uri", - "description": "Signed URL to which the file bytes are uploaded. Send the bytes with `PUT` to this URL, including exactly the headers in `headers` and nothing that alters the body. The URL is signed and self-describing — construct it from this field only, never by hand.\n\n**Where this URL points depends on the deployment, and so does what answers you.** When Sim stores objects itself the URL is Sim's own data plane: success is `204` with an empty body, and a failure is the same `{ \"error\": { \"code\", \"message\" } }` envelope as every other v2 response — `400` when the body does not match the size or content type the session was created for, `403` when the token is invalid, expired, or belongs to another session, and `409` when the session is no longer accepting bytes. When object storage is configured — S3, Google Cloud Storage, or Azure Blob — the URL is that provider's own presigned URL, and the provider answers directly: treat **any `2xx` as success** (S3 and GCS answer `200`, Azure `201`), and on failure expect the provider's error document, typically XML, not the v2 envelope. Do not branch on `204` and do not parse a failure as JSON." + "description": "Signed URL to which the file bytes are uploaded. Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML." }, "headers": { "type": "object", @@ -3577,7 +3627,7 @@ "url": { "type": "string", "format": "uri", - "description": "Signed URL for this upload part. Send the bytes with `PUT` to this URL, including exactly the headers in `headers` and nothing that alters the body. The URL is signed and self-describing — construct it from this field only, never by hand.\n\n**Where this URL points depends on the deployment, and so does what answers you.** When Sim stores objects itself the URL is Sim's own data plane: success is `204` with an empty body, and a failure is the same `{ \"error\": { \"code\", \"message\" } }` envelope as every other v2 response — `400` when the body does not match the size or content type the session was created for, `403` when the token is invalid, expired, or belongs to another session, and `409` when the session is no longer accepting bytes. When object storage is configured — S3, Google Cloud Storage, or Azure Blob — the URL is that provider's own presigned URL, and the provider answers directly: treat **any `2xx` as success** (S3 and GCS answer `200`, Azure `201`), and on failure expect the provider's error document, typically XML, not the v2 envelope. Do not branch on `204` and do not parse a failure as JSON.\n\nYou do not need to retain the `ETag` each part upload returns. Unlike a raw S3 multipart flow, completion takes no request body: Sim lists the uploaded parts from the provider itself and reads their entity tags there, so `POST .../complete` only has to happen after every part has been sent." + "description": "Signed URL for this upload part. Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML. Do not retain part `ETag` values; after every part succeeds, call the completion endpoint without a request body." }, "headers": { "type": "object", diff --git a/apps/docs/openapi-v2-knowledge.json b/apps/docs/openapi-v2-knowledge.json index fa3e6689e5b..2776ed95db9 100644 --- a/apps/docs/openapi-v2-knowledge.json +++ b/apps/docs/openapi-v2-knowledge.json @@ -1437,7 +1437,7 @@ "post": { "operationId": "createKnowledgeTag", "summary": "Create Tag", - "description": "Define one tag on a knowledge base; use `PUT` on this path to declare several at once. Define a tag here, write its `tagSlot` on a document with `PATCH /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}`, then filter by its `displayName` on the document list or on search. Omit `tagSlot` to take the next free slot for the field type; a field type with no free slot left is a `400` naming it, since the remedy is a different type or a deleted definition rather than a retry. A `tagSlot` already taken, or a `displayName` already defined on this knowledge base, is a `409` naming which of the two to change. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Define one tag; use `PUT` on this path for several. Write its `tagSlot` on documents, then filter by `displayName`. Omitting `tagSlot` selects the next free slot; exhaustion returns `400`. An occupied slot or duplicate display name returns `409` naming the conflict. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1520,7 +1520,7 @@ "put": { "operationId": "bulkSaveKnowledgeTagDefinitions", "summary": "Bulk Save Tag Definitions", - "description": "Declare, in one request, several of the knowledge base's tag definitions. `POST` on this path defines exactly one tag; this is the same write over a list, and every slot the body names is written to the declaration it carries while slots it does not name are left alone. Updating an existing definition requires naming its current name in `originalDisplayName`; that is the only form that edits one in place. Without it the entry is a create, and a requested `tagSlot` another name already holds is refused in `errors` — it is neither overwritten nor relocated to a different slot, so an explicitly requested slot always means that slot or an error. A create whose `displayName` already exists is refused in `errors`. Per-definition failures are reported in `errors` and still answer `200`. This writes the vocabulary, not one document's tag values — set those with `PATCH /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Declare multiple tag definitions while leaving unspecified slots unchanged. Updating requires the current name in `originalDisplayName`; otherwise the entry creates a tag. Occupied explicit slots and duplicate display names appear in per-definition `errors`, never overwrite or relocate data, and still return `200`. This writes the vocabulary, not document tag values; set those through the document update endpoint. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1600,7 +1600,7 @@ "delete": { "operationId": "deleteKnowledgeTagDefinitions", "summary": "Delete Tag Definitions", - "description": "Remove tag definitions from the knowledge base. `unused` defaults to `true`, which removes only the definitions no document still carries a value for — the recoverable half, since a definition with nothing behind it can simply be redefined. Pass `unused=false` to delete every definition on the knowledge base, which also clears its slot on every document and chunk and is not recoverable. Delete one definition at a time with `DELETE /api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Remove tag definitions. `unused` defaults to `true`, deleting only definitions with no document values, which can be recreated safely. `unused=false` deletes every definition and irreversibly clears its slot from all documents and chunks. Use `DELETE /api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}` to delete one definition. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3147,7 +3147,7 @@ "post": { "operationId": "addWorkspaceFilesToKnowledgeBase", "summary": "Index Workspace Files", - "description": "Index files the workspace already stores, without re-uploading their bytes. Each reference is authorized against the file it names, so a reference the caller cannot read, one over the 100 MB document limit, or one whose type is not supported is reported in `failed` while the rest are queued — a partial outcome is a `200`, not a multi-status. A queued document starts in the `pending` processing state; the entries returned here carry only its identity, so read `GET /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}` for its current state. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Index stored workspace files without re-uploading bytes. Each reference is authorized independently; unreadable, unsupported, or over-100 MB files appear in `failed` while valid files are queued. This partial outcome returns `200`, not multi-status. Queued documents begin as `pending`; the response carries identities only, so read each document endpoint for current processing state. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3393,7 +3393,7 @@ "post": { "operationId": "createKnowledgeChunk", "summary": "Create Chunk", - "description": "Append a chunk to a document. The text is embedded before the response returns, so the chunk is searchable immediately, and it inherits the document's tag values and the next `chunkIndex`. Chunks of a connector-synced document are read-only and a write answers `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"` — change the content at the source and re-sync, or exclude the document from the connector. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Append a chunk, embedding it before the response so it is immediately searchable. It inherits the document's tags and next `chunkIndex`. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3484,7 +3484,7 @@ "patch": { "operationId": "bulkUpdateKnowledgeChunks", "summary": "Bulk Update Chunks", - "description": "Enable, disable, or delete many chunks of one document in a single request. Best-effort: an identifier naming no chunk in the document is reported in `errors` rather than failing the request. `processed` counts the chunks the operation matched, not the chunks it changed. Chunks of a connector-synced document are read-only and a write answers `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"` — change the content at the source and re-sync, or exclude the document from the connector. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Enable, disable, or delete multiple chunks in one best-effort request. Unknown chunk IDs appear in `errors` without failing the request; `processed` counts matched chunks, not changes. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3677,7 +3677,7 @@ "patch": { "operationId": "updateKnowledgeChunk", "summary": "Update Chunk", - "description": "Correct a chunk's text or take it out of search. Changing `content` re-embeds the chunk and re-derives the document's token and character counts, so the correction reaches search immediately; disabling keeps the chunk indexed. Chunks of a connector-synced document are read-only and a write answers `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"` — change the content at the source and re-sync, or exclude the document from the connector. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Correct chunk text or disable it from search. Changing `content` re-embeds immediately and recalculates document token and character counts; disabling retains the index. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3782,7 +3782,7 @@ "delete": { "operationId": "deleteKnowledgeChunk", "summary": "Delete Chunk", - "description": "Permanently remove one chunk and subtract it from the document's counts. Deleting does not renumber the remaining chunks, so `chunkIndex` values stay stable but become non-contiguous. Chunks of a connector-synced document are read-only and a write answers `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"` — change the content at the source and re-sync, or exclude the document from the connector. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Permanently remove one chunk and subtract it from document counts. Remaining `chunkIndex` values stay stable and may become non-contiguous. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3884,7 +3884,7 @@ "patch": { "operationId": "updateKnowledgeTag", "summary": "Update Tag", - "description": "Rename a tag, or change the value type stored in its slot. Renaming changes the name filters and document reads use; the slot, and every value in it, is untouched. A tag's slot is fixed for its lifetime and each slot holds one kind of value, so `fieldType` can only change to another type valid for the slot the tag already occupies — anything else is a `400`, and the way to get a tag of that type is to create one. A name another tag on this knowledge base already holds is a `409`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Rename a tag or change its slot-compatible `fieldType`. Renaming changes read and filter names without moving the slot or its values. Slots are fixed for a tag's lifetime; an incompatible type returns `400` and requires creating a new tag. A duplicate display name returns `409`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Knowledge Bases"], "parameters": [ { @@ -4493,6 +4493,48 @@ } }, "schemas": { + "V2ActionableForbiddenDetails": { + "type": "object", + "properties": { + "code": { + "$ref": "#/components/schemas/V2ForbiddenDetailCode" + } + }, + "required": ["code"], + "additionalProperties": { + "description": "Additional context for this refusal." + }, + "title": "Actionable forbidden details", + "description": "Machine-readable cause and optional context for an actionable `403` response." + }, + "V2ForbiddenDetailCode": { + "type": "string", + "enum": [ + "INSUFFICIENT_WORKSPACE_ROLE", + "PERSONAL_API_KEYS_DISABLED", + "WORKSPACE_KEY_OPERATION_NOT_PERMITTED", + "PRINCIPAL_KIND_NOT_PERMITTED", + "ORGANIZATION_MEMBERSHIP_REQUIRED", + "ORGANIZATION_ADMIN_REQUIRED", + "ENTERPRISE_PLAN_REQUIRED", + "ORGANIZATION_PLAN_REQUIRED", + "AUDIT_LOGS_DISABLED", + "SKILL_EDITOR_ACCESS_REQUIRED", + "SECRET_ADMIN_ACCESS_REQUIRED", + "WORKSPACE_RESOURCE_LIMIT_REACHED", + "PUBLIC_SHARING_NOT_ALLOWED", + "CREDENTIAL_ADMIN_ACCESS_REQUIRED", + "MCP_SERVER_URL_NOT_ALLOWED", + "WORKSPACE_PLAN_CAPABILITY_REQUIRED", + "CHAT_AUTH_MODE_NOT_PERMITTED", + "CONNECTOR_MANAGED_RESOURCE_READ_ONLY", + "PERMISSION_GROUP_CAPABILITY_BLOCKED", + "INTEGRATION_NOT_ALLOWED", + "INSUFFICIENT_SCOPE" + ], + "title": "Forbidden detail code", + "description": "Stable cause code for an actionable `403` response." + }, "V2Error": { "type": "object", "properties": { @@ -4508,7 +4550,15 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." + "description": "Structured error context whose keys depend on the error. Actionable `403` responses use the `V2ActionableForbiddenDetails` shape; validation failures may return issue arrays instead.", + "anyOf": [ + { + "$ref": "#/components/schemas/V2ActionableForbiddenDetails" + }, + { + "description": "Other structured context defined by the specific error." + } + ] } }, "required": ["code", "message"], @@ -6144,7 +6194,7 @@ "maximum": 100 }, "tagFilters": { - "description": "Structured tag filters, at most 10 of them. Every filter must hold, including two that name the same tag: repeating one tag narrows the result rather than widening it, matching `GET /api/v2/knowledge/{knowledgeBaseId}/documents`. To match either of two values for one tag, issue a search per value. Each filtered tag must resolve to the same slot and field type in every knowledge base selected; one missing from any of them, or defined inconsistently across them, is rejected rather than ignored, and those knowledge bases must be searched separately. List the available names with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`.", + "description": "Up to 10 filters combined with AND; repeating a tag narrows results. To express OR, run separate searches. Every tag must exist with the same slot and field type in each selected knowledge base or the request is rejected. List valid names with the knowledge-base tag-list operation.", "maxItems": 10, "type": "array", "items": { @@ -6693,7 +6743,7 @@ "url": { "type": "string", "format": "uri", - "description": "Signed URL to which the file bytes are uploaded. Send the bytes with `PUT` to this URL, including exactly the headers in `headers` and nothing that alters the body. The URL is signed and self-describing — construct it from this field only, never by hand.\n\n**Where this URL points depends on the deployment, and so does what answers you.** When Sim stores objects itself the URL is Sim's own data plane: success is `204` with an empty body, and a failure is the same `{ \"error\": { \"code\", \"message\" } }` envelope as every other v2 response — `400` when the body does not match the size or content type the session was created for, `403` when the token is invalid, expired, or belongs to another session, and `409` when the session is no longer accepting bytes. When object storage is configured — S3, Google Cloud Storage, or Azure Blob — the URL is that provider's own presigned URL, and the provider answers directly: treat **any `2xx` as success** (S3 and GCS answer `200`, Azure `201`), and on failure expect the provider's error document, typically XML, not the v2 envelope. Do not branch on `204` and do not parse a failure as JSON." + "description": "Signed URL to which the file bytes are uploaded. Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML." }, "headers": { "type": "object", @@ -6898,7 +6948,7 @@ "url": { "type": "string", "format": "uri", - "description": "Signed URL for this upload part. Send the bytes with `PUT` to this URL, including exactly the headers in `headers` and nothing that alters the body. The URL is signed and self-describing — construct it from this field only, never by hand.\n\n**Where this URL points depends on the deployment, and so does what answers you.** When Sim stores objects itself the URL is Sim's own data plane: success is `204` with an empty body, and a failure is the same `{ \"error\": { \"code\", \"message\" } }` envelope as every other v2 response — `400` when the body does not match the size or content type the session was created for, `403` when the token is invalid, expired, or belongs to another session, and `409` when the session is no longer accepting bytes. When object storage is configured — S3, Google Cloud Storage, or Azure Blob — the URL is that provider's own presigned URL, and the provider answers directly: treat **any `2xx` as success** (S3 and GCS answer `200`, Azure `201`), and on failure expect the provider's error document, typically XML, not the v2 envelope. Do not branch on `204` and do not parse a failure as JSON.\n\nYou do not need to retain the `ETag` each part upload returns. Unlike a raw S3 multipart flow, completion takes no request body: Sim lists the uploaded parts from the provider itself and reads their entity tags there, so `POST .../complete` only has to happen after every part has been sent." + "description": "Signed URL for this upload part. Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML. Do not retain part `ETag` values; after every part succeeds, call the completion endpoint without a request body." }, "headers": { "type": "object", diff --git a/apps/docs/openapi-v2-logs.json b/apps/docs/openapi-v2-logs.json index 0cd665c2577..33eba6fe8fc 100644 --- a/apps/docs/openapi-v2-logs.json +++ b/apps/docs/openapi-v2-logs.json @@ -39,7 +39,7 @@ "get": { "operationId": "listLogs", "summary": "List Logs", - "description": "List workflow execution logs for a workspace with filters, selectable detail, sorting by start time, duration, cost, or status, and opaque cursor pagination. Chat and Sim-agent job runs join the sequence with `includeJobRuns=true`, which is accepted only under `sortBy=startedAt` — their cost is stored as a document and their status is not comparable, so they cannot participate in the other orderings. Each item's `files` lists only the files the run itself produced, addressed by `downloadPath`; input attachments a caller supplied are read through the files API instead. Runs are hard-deleted once they pass the payer's log retention window, so an older run is simply absent rather than reported as removed. The window is 30 days from run start on the free plan, unbounded on Pro and Team, and set per organization on Enterprise with an optional per-workspace override. A workspace folder tree over 10,000 folders is a `413`.", + "description": "List logs with filters, selectable detail, sorting, and cursor pagination. `includeJobRuns=true` includes chat and Sim-agent jobs only with `sortBy=startedAt`, because other orderings are unsupported. `files` contains only run-produced files; use the files API for input attachments. Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. A workspace folder tree over 10,000 folders is a `413`.", "tags": ["Logs"], "parameters": [ { @@ -68,10 +68,10 @@ "name": "triggers", "in": "query", "required": false, - "description": "Comma-separated trigger types to include. An empty entry is rejected. Values are matched exactly and are case-sensitive — every recorded trigger is lowercase, so `API` matches nothing while `api` matches. The vocabulary is open: it covers the core trigger types (`manual`, `api`, `schedule`, `chat`, `webhook`, `mcp`, `copilot`, `workflow`, `custom_block`) and the provider id of any webhook trigger (`slack`, `gmail`, `github`, …), so an unrecognized member is not rejected — it selects no runs. The literal value `all` is a sentinel that disables this filter entirely, so a list containing it returns runs of every trigger type; no real trigger type is named `all`. At most 100 entries.", + "description": "Comma-separated, lowercase trigger types or webhook provider IDs. Matching is exact and case-sensitive; unknown values select no runs. An empty entry is rejected. The sentinel `all` disables this filter, even when listed with other values. At most 100 entries.", "schema": { "type": "string", - "description": "Comma-separated trigger types to include. An empty entry is rejected. Values are matched exactly and are case-sensitive — every recorded trigger is lowercase, so `API` matches nothing while `api` matches. The vocabulary is open: it covers the core trigger types (`manual`, `api`, `schedule`, `chat`, `webhook`, `mcp`, `copilot`, `workflow`, `custom_block`) and the provider id of any webhook trigger (`slack`, `gmail`, `github`, …), so an unrecognized member is not rejected — it selects no runs. The literal value `all` is a sentinel that disables this filter entirely, so a list containing it returns runs of every trigger type; no real trigger type is named `all`. At most 100 entries." + "description": "Comma-separated, lowercase trigger types or webhook provider IDs. Matching is exact and case-sensitive; unknown values select no runs. An empty entry is rejected. The sentinel `all` disables this filter, even when listed with other values. At most 100 entries." } }, { @@ -247,9 +247,9 @@ "name": "includeJobRuns", "in": "query", "required": false, - "description": "Whether Chat and Sim-agent job runs join the sequence alongside workflow runs. Job runs report `kind: \"job\"`, carry no `workflow` summary, and never carry a cost ledger. They are dropped entirely — not partially matched — whenever a filter they cannot answer is set: by workflow, workflow name, folder, model, or status. A filter therefore never means two different things across the union. Accepted only when sorting by `startedAt`: job runs record cost as a document and no comparable status, so they cannot participate in the other orderings.", + "description": "Include Chat and Sim-agent jobs alongside workflow runs. Jobs use `kind: \"job\"` and have no workflow or cost ledger. Workflow, folder, model, or status filters exclude jobs. This option is valid only when sorting by `startedAt`.", "schema": { - "description": "Whether Chat and Sim-agent job runs join the sequence alongside workflow runs. Job runs report `kind: \"job\"`, carry no `workflow` summary, and never carry a cost ledger. They are dropped entirely — not partially matched — whenever a filter they cannot answer is set: by workflow, workflow name, folder, model, or status. A filter therefore never means two different things across the union. Accepted only when sorting by `startedAt`: job runs record cost as a document and no comparable status, so they cannot participate in the other orderings.", + "description": "Include Chat and Sim-agent jobs alongside workflow runs. Jobs use `kind: \"job\"` and have no workflow or cost ledger. Workflow, folder, model, or status filters exclude jobs. This option is valid only when sorting by `startedAt`.", "type": "boolean" } }, @@ -354,7 +354,7 @@ "get": { "operationId": "getLog", "summary": "Get Log", - "description": "Retrieve the diagnostic representation of a run, including its workflow snapshot, trace spans, final output, and cost. Trace spans are pruned on their own retention schedule, so an empty `traceSpans` array does not mean the run recorded none. A workspace folder tree over 10,000 folders is a `413`. Runs are hard-deleted once they pass the payer's log retention window, so an older run is simply absent rather than reported as removed. The window is 30 days from run start on the free plan, unbounded on Pro and Team, and set per organization on Enterprise with an optional per-workspace override.", + "description": "Retrieve a run's workflow snapshot, trace spans, final output, and cost. Trace spans have separate retention, so an empty `traceSpans` array does not prove none were recorded. Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. A workspace folder tree over 10,000 folders is a `413`.", "tags": ["Logs"], "parameters": [ { @@ -424,7 +424,7 @@ "get": { "operationId": "getLogStats", "summary": "Get Log Statistics", - "description": "Bucketed run counts, success rate, error count, and mean latency for a workspace and for each of its workflows — the aggregate a caller would otherwise have to page every run to compute. The window spans `startDate` through `endDate` when both are supplied; an omitted edge falls back to the oldest matching run on the left and to the later of the newest matching run and now on the right. With no matching runs the right edge falls back to now and the left to 24 hours before that right edge — the trailing 24 hours when neither edge was supplied, and the 24 hours preceding `endDate` when only `endDate` was supplied. A supplied `startDate` is still used verbatim, so a `startDate` without an `endDate` yields `[startDate, now]`, which can be any width. The window is divided into exactly `segmentCount` equal buckets whose width is `max(60000, floor(windowMs / segmentCount))` milliseconds. The one-minute floor is a floor on bucket width, not on the window: when it applies, the series runs past `timeBounds.end` and the trailing buckets are empty rather than the window being compressed. A folder path covers its whole subtree. Per-workflow series are capped and `workflowsTruncated` reports whether the cap applied; the workspace totals are always computed from every workflow. Runs are hard-deleted once they pass the payer's log retention window, so an older run is simply absent rather than reported as removed. The window is 30 days from run start on the free plan, unbounded on Pro and Team, and set per organization on Enterprise with an optional per-workspace override. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Return workspace/workflow counts, success, errors, and latency. Defaults span runs, or 24 hours if empty; supplied bounds stay exact. Buckets are one-minute minimum and may pass the end. Folders include descendants; `workflowsTruncated` marks capped series, totals include all. Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. A workspace folder tree over 10,000 folders is a `413`.", "tags": ["Logs"], "parameters": [ { @@ -781,6 +781,48 @@ } }, "schemas": { + "V2ActionableForbiddenDetails": { + "type": "object", + "properties": { + "code": { + "$ref": "#/components/schemas/V2ForbiddenDetailCode" + } + }, + "required": ["code"], + "additionalProperties": { + "description": "Additional context for this refusal." + }, + "title": "Actionable forbidden details", + "description": "Machine-readable cause and optional context for an actionable `403` response." + }, + "V2ForbiddenDetailCode": { + "type": "string", + "enum": [ + "INSUFFICIENT_WORKSPACE_ROLE", + "PERSONAL_API_KEYS_DISABLED", + "WORKSPACE_KEY_OPERATION_NOT_PERMITTED", + "PRINCIPAL_KIND_NOT_PERMITTED", + "ORGANIZATION_MEMBERSHIP_REQUIRED", + "ORGANIZATION_ADMIN_REQUIRED", + "ENTERPRISE_PLAN_REQUIRED", + "ORGANIZATION_PLAN_REQUIRED", + "AUDIT_LOGS_DISABLED", + "SKILL_EDITOR_ACCESS_REQUIRED", + "SECRET_ADMIN_ACCESS_REQUIRED", + "WORKSPACE_RESOURCE_LIMIT_REACHED", + "PUBLIC_SHARING_NOT_ALLOWED", + "CREDENTIAL_ADMIN_ACCESS_REQUIRED", + "MCP_SERVER_URL_NOT_ALLOWED", + "WORKSPACE_PLAN_CAPABILITY_REQUIRED", + "CHAT_AUTH_MODE_NOT_PERMITTED", + "CONNECTOR_MANAGED_RESOURCE_READ_ONLY", + "PERMISSION_GROUP_CAPABILITY_BLOCKED", + "INTEGRATION_NOT_ALLOWED", + "INSUFFICIENT_SCOPE" + ], + "title": "Forbidden detail code", + "description": "Stable cause code for an actionable `403` response." + }, "V2Error": { "type": "object", "properties": { @@ -796,7 +838,15 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." + "description": "Structured error context whose keys depend on the error. Actionable `403` responses use the `V2ActionableForbiddenDetails` shape; validation failures may return issue arrays instead.", + "anyOf": [ + { + "$ref": "#/components/schemas/V2ActionableForbiddenDetails" + }, + { + "description": "Other structured context defined by the specific error." + } + ] } }, "required": ["code", "message"], @@ -1804,7 +1854,7 @@ }, "required": ["start", "end"], "additionalProperties": false, - "description": "The window the buckets span. `startDate` and `endDate` are used verbatim when supplied; an omitted edge falls back to the oldest matching run on the left and to the later of the newest matching run and now on the right. With no matching runs the right edge falls back to now and the left to 24 hours before that right edge — the trailing 24 hours when neither edge was supplied, and the 24 hours preceding `endDate` when only `endDate` was supplied. A supplied `startDate` is still used verbatim, so a `startDate` without an `endDate` yields `[startDate, now]`, which can be any width." + "description": "Actual bucket window. Supplied bounds are exact. Without `startDate`, the left edge is the oldest match, or 24 hours before the right edge when no run matches. Without `endDate`, the right edge is at least now. `startDate` alone spans through now." }, "segmentMs": { "type": "number", diff --git a/apps/docs/openapi-v2-resources.json b/apps/docs/openapi-v2-resources.json index b89584550cc..0ba84c82c07 100644 --- a/apps/docs/openapi-v2-resources.json +++ b/apps/docs/openapi-v2-resources.json @@ -757,7 +757,7 @@ "get": { "operationId": "listMcpServerTools", "summary": "List MCP Server Tools", - "description": "Connect to a registered MCP server and return the tools it exposes. This read has side effects: it opens a live connection to the third-party server and writes `connectionStatus`, `toolCount`, `lastError`, and `lastToolsRefresh`. A `HEAD` skips the effect but is authorized exactly as the `GET` is, so it answers `400`, `401`, `403`, or `404` wherever the `GET` would and an empty `200` otherwise. Skipping the effect means skipping the read that produces the payload, so that `200` carries none of the response headers documented below — it answers whether the `GET` would be allowed, not what the `GET` would return. Discovery is bounded at 1,000 tools and 5 MB of tool payload per server. The bounded set is returned in one page; `nextCursor` is always null. An unreachable, slow, or cooling-down server is a `503`; a stored OAuth grant that no longer works is a `409` with `error.details.code` `MCP_SERVER_REAUTHORIZATION_REQUIRED`, which only a human reauthorizing in Sim can clear. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Return up to 1,000 tools and 5 MB with `nextCursor: null`, opening a connection and updating connection metadata. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only. Unavailable servers return `503`; invalid OAuth returns `409` with `error.details.code: MCP_SERVER_REAUTHORIZATION_REQUIRED` and requires human reauthorization. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["MCP Servers"], "parameters": [ { @@ -2146,7 +2146,7 @@ "post": { "operationId": "createSandbox", "summary": "Create Sandbox", - "description": "Create a sandbox. The name must be unique within the workspace. Where the deployment prebuilds dependency images, the build is scheduled and reported through `buildStatus`; a deployment that installs at run time, or a sandbox with nothing to install, has no build and reports `buildStatus: null`. A dependency or system-package entry the builder cannot accept is a `400` whose `error.details` names the field and the offending entries. Requires a workspace admin on a Max or Enterprise plan; a lower plan is refused with `403` and `error.details.code` `WORKSPACE_PLAN_CAPABILITY_REQUIRED`. Creates and updates in a workspace share one write budget, whatever the install strategy, and a burst is refused with `429` and a `Retry-After` header. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Create a uniquely named sandbox. Prebuild deployments schedule an image build reported by `buildStatus`; runtime-install deployments or empty specs report `buildStatus: null`. Invalid dependency or system-package entries return `400` with field details. Requires a workspace admin on Max or Enterprise; lower plans return `403` with `error.details.code: WORKSPACE_PLAN_CAPABILITY_REQUIRED`. Creates and updates share a write budget; bursts return `429` with `Retry-After`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Sandboxes"], "requestBody": { "required": true, @@ -2293,7 +2293,7 @@ "patch": { "operationId": "updateSandbox", "summary": "Update Sandbox", - "description": "Update the supplied sandbox fields. Omitted fields retain their stored values; a supplied list replaces the whole list; names must remain unique within the workspace. Where the deployment prebuilds dependency images, a changed spec is rebuilt and re-sending an unchanged spec after a failed build retries it; a deployment that installs at run time, or a spec with nothing to install, has no build and reports `buildStatus: null`. Requires a workspace admin on a Max or Enterprise plan; a lower plan is refused with `403` and `error.details.code` `WORKSPACE_PLAN_CAPABILITY_REQUIRED`. Creates and updates in a workspace share one write budget, whatever the install strategy, and a burst is refused with `429` and a `Retry-After` header. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Update supplied fields; omissions preserve values, lists replace whole lists, and names remain unique. Prebuild deployments rebuild changed specs, while resending an unchanged failed spec retries it; runtime-install or empty specs report `buildStatus: null`. Requires a workspace admin on Max or Enterprise; lower plans return `403` with `error.details.code: WORKSPACE_PLAN_CAPABILITY_REQUIRED`. Creates and updates share a write budget; bursts return `429` with `Retry-After`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Sandboxes"], "parameters": [ { @@ -2376,7 +2376,7 @@ "delete": { "operationId": "deleteSandbox", "summary": "Delete Sandbox", - "description": "Delete a sandbox. Function blocks that still select it fail closed at run time until they are re-pointed. Where the deployment prebuilds dependency images, the sandbox's image is released once nothing else shares it; a runtime-install deployment, or a spec with nothing to install, had no image and nothing is released. Requires a workspace admin on a Max or Enterprise plan; a lower plan is refused with `403` and `error.details.code` `WORKSPACE_PLAN_CAPABILITY_REQUIRED`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Delete a sandbox. Function blocks still selecting it fail closed until reconfigured. A prebuilt image is released when no sandbox shares it; runtime-install and empty specs have no image to release. Requires a workspace admin on Max or Enterprise; lower plans return `403` with `error.details.code: WORKSPACE_PLAN_CAPABILITY_REQUIRED`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Sandboxes"], "parameters": [ { @@ -2770,7 +2770,7 @@ "post": { "operationId": "createCredentialConnection", "summary": "Create Credential Connection", - "description": "Create a short-lived browser URL for connecting an OAuth provider or reconnecting an existing OAuth credential. Open the URL in a browser, sign in as the personal API-key owner, complete provider authorization, then refresh the credentials list. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Create a short-lived browser URL for connecting an OAuth provider or reconnecting an existing OAuth credential. Open the URL, sign in as the authenticated user, complete provider authorization, then refresh the credentials list. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Credentials"], "requestBody": { "required": true, @@ -2918,7 +2918,7 @@ "patch": { "operationId": "updateCredential", "summary": "Update Credential", - "description": "Rotate a service-account credential's secret material, or rename it. Send only the fields to change: an omitted field is left unchanged, and `description: null` clears the stored description. Secret fields are write-only and are never returned, and only a service-account credential has any: sending one for a credential of another type answers `400` rather than dropping it. The provider re-verifies replacement secret material before it replaces the stored secret, so a rejected secret leaves the stored one untouched and answers `400` with the provider's code in `error.details.providerErrorCode`; a provider that cannot be reached answers `503`. The credential ID is preserved, so every workflow, deployment, paused run, knowledge connector, and webhook that references it keeps working — which disconnecting and re-creating does not. Credential admin access is required. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Rename a service-account credential or rotate its write-only secret fields. Omissions preserve values; `description: null` clears the description. Secret fields sent for another credential type return `400`. The provider verifies replacements before storage: rejection leaves the old secret intact and returns `400` with `providerErrorCode`; provider outages return `503`. The preserved credential ID keeps all references working. Credential admin access is required. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Credentials"], "parameters": [ { @@ -3153,7 +3153,7 @@ "put": { "operationId": "setSecret", "summary": "Set Secret", - "description": "Create or replace a workspace or caller-owned personal secret. The value is encrypted at rest, is write-only, and is never included in the response. Omit `value` on a workspace secret to update `description` and `unredacted` alone: the stored value is left untouched and is never re-encrypted, and because a metadata-only write cannot create a secret it answers `404` when the named secret does not exist. A personal secret always requires `value`, having no other writable field. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Create or replace a workspace or personal secret. Values are encrypted at rest, write-only, and never returned. For an existing workspace secret, omit `value` to update only `description` or `unredacted`; the value remains untouched. This metadata-only form cannot create a secret and returns `404` when absent. Personal secrets always require `value`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Secrets"], "parameters": [ { @@ -3392,7 +3392,7 @@ "get": { "operationId": "listWorkflowMcpServers", "summary": "List Workflow MCP Servers", - "description": "List the MCP servers a workspace *publishes*. These serve deployed workflows as tools to outside MCP clients, which is the opposite direction from `GET /api/v2/mcp-servers` — that lists external servers Sim calls. Each entry carries the endpoint clients connect to and the tool names it exposes; those names are gathered under a 2,000-tool budget shared across the page, so on a page of unusually large servers the trailing entries can list fewer names than they publish. Read one server's full inventory with `GET /api/v2/workflow-mcp-servers/{serverId}/tools`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "List servers that publish deployed workflows to outside MCP clients; `GET /api/v2/mcp-servers` instead lists external servers Sim calls. Entries include client endpoints and tool names. A page shares a 2,000-name budget, so trailing servers may show partial inventories; read a server's tools endpoint for its full set. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["MCP Servers"], "parameters": [ { @@ -4481,7 +4481,7 @@ "post": { "operationId": "executeTool", "summary": "Run Tool", - "description": "Run one built-in tool and return what it produced. Supply `input` using the parameter ids `GET /api/v2/tools/{toolId}` publishes; Sim resolves the credential named by `credentialId`, injects a hosted API key for the tools it supplies one for, and substitutes environment-variable references, so the request carries arguments rather than secrets. A parameter the tool marks `user-only` also accepts `{{VAR_NAME}}` as its whole value, resolved server-side against the workspace environment; every other value is sent verbatim, so a literal secret passes through untouched. A tool that runs and refuses is a `200` carrying `status: \"failed\"` and the reason — the error envelope is reserved for failures of this API, not of the third party. A tool the workspace's visible blocks do not expose answers `404` identically to one that does not exist; one whose integration the workspace does not permit answers `403` with `error.details.code` `INTEGRATION_NOT_ALLOWED`. Hosted-key spend this call incurs is billed to the workspace. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Run a built-in tool using published parameter IDs. Sim resolves `credentialId`, hosted keys, and whole-value `{{VAR_NAME}}` references for `user-only` parameters; other values pass through verbatim. Third-party refusal returns `200` with `status: \"failed\"`; the error envelope covers API failures. Hidden or missing tools return `404`; disallowed integrations return `403` with `error.details.code: INTEGRATION_NOT_ALLOWED`. Hosted-key use is billed to the workspace. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Catalog"], "parameters": [ { @@ -4564,7 +4564,7 @@ "get": { "operationId": "listConnectorTypes", "summary": "List Connector Types", - "description": "List every knowledge-base connector type and the source configuration each accepts. Two properties of a config field decide how its value is sent and are not inferable from the rest: a field with `multi: true` stores a `string[]` rather than a `string`, and a `canonicalParamId` links a picker field to a manual-entry field that write the SAME configuration key — send exactly one of the pair, keyed by `canonicalParamId` rather than by the field's own `id`. The bounded set is returned in one page; `nextCursor` is always null.", + "description": "List connector types and accepted source configuration. A field with `multi: true` stores `string[]`. `canonicalParamId` links picker and manual fields that write the same key; send exactly one, keyed by `canonicalParamId` rather than its own `id`. The bounded set is returned in one page; `nextCursor` is always null.", "tags": ["Catalog"], "parameters": [ { @@ -4884,6 +4884,48 @@ } }, "schemas": { + "V2ActionableForbiddenDetails": { + "type": "object", + "properties": { + "code": { + "$ref": "#/components/schemas/V2ForbiddenDetailCode" + } + }, + "required": ["code"], + "additionalProperties": { + "description": "Additional context for this refusal." + }, + "title": "Actionable forbidden details", + "description": "Machine-readable cause and optional context for an actionable `403` response." + }, + "V2ForbiddenDetailCode": { + "type": "string", + "enum": [ + "INSUFFICIENT_WORKSPACE_ROLE", + "PERSONAL_API_KEYS_DISABLED", + "WORKSPACE_KEY_OPERATION_NOT_PERMITTED", + "PRINCIPAL_KIND_NOT_PERMITTED", + "ORGANIZATION_MEMBERSHIP_REQUIRED", + "ORGANIZATION_ADMIN_REQUIRED", + "ENTERPRISE_PLAN_REQUIRED", + "ORGANIZATION_PLAN_REQUIRED", + "AUDIT_LOGS_DISABLED", + "SKILL_EDITOR_ACCESS_REQUIRED", + "SECRET_ADMIN_ACCESS_REQUIRED", + "WORKSPACE_RESOURCE_LIMIT_REACHED", + "PUBLIC_SHARING_NOT_ALLOWED", + "CREDENTIAL_ADMIN_ACCESS_REQUIRED", + "MCP_SERVER_URL_NOT_ALLOWED", + "WORKSPACE_PLAN_CAPABILITY_REQUIRED", + "CHAT_AUTH_MODE_NOT_PERMITTED", + "CONNECTOR_MANAGED_RESOURCE_READ_ONLY", + "PERMISSION_GROUP_CAPABILITY_BLOCKED", + "INTEGRATION_NOT_ALLOWED", + "INSUFFICIENT_SCOPE" + ], + "title": "Forbidden detail code", + "description": "Stable cause code for an actionable `403` response." + }, "V2Error": { "type": "object", "properties": { @@ -4899,7 +4941,15 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." + "description": "Structured error context whose keys depend on the error. Actionable `403` responses use the `V2ActionableForbiddenDetails` shape; validation failures may return issue arrays instead.", + "anyOf": [ + { + "$ref": "#/components/schemas/V2ActionableForbiddenDetails" + }, + { + "description": "Other structured context defined by the specific error." + } + ] } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-tables.json b/apps/docs/openapi-v2-tables.json index d3e0f0e2c85..42b4fea7be9 100644 --- a/apps/docs/openapi-v2-tables.json +++ b/apps/docs/openapi-v2-tables.json @@ -412,7 +412,7 @@ "patch": { "operationId": "updateTable", "summary": "Update Table", - "description": "Rename a table, edit its description, or move it to a canonical folder. At least one mutable field is required; lock flags remain read-only.\n\nNOT atomic: name, description, and folder are written independently, so a 4xx does not mean nothing changed. When at least one field landed before the failure the error body carries `details.applied` naming those fields — retry with only the ones missing from it. Its absence means nothing was applied.\n\nA workspace folder tree over 10,000 folders is a `413`.", + "description": "Rename a table, edit its description, or move it to a canonical folder. At least one mutable field is required; lock flags are read-only.\n\nNOT atomic: fields are written independently, so a 4xx may follow a partial update. When fields were applied, `details.applied` names them; retry only the missing fields. If it is absent, nothing changed.\n\nA workspace folder tree over 10,000 folders is a `413`.", "tags": ["Tables"], "parameters": [ { @@ -1472,7 +1472,7 @@ "post": { "operationId": "queryTableRows", "summary": "Query Rows", - "description": "Query rows with an optional typed predicate, ordered sort specification, and opaque cursor pagination. A predicate may be one condition or an `all`/`any` group; omit it to match every row. Bounded pages are capped at 5MB by default and may contain fewer rows than the requested limit; continue until nextCursor is null. A predicate larger than the request-body ceiling is a `413`. Set `includeRunState: true` to attach each row's per-workflow-group run outcomes; the row limit is capped when it is set. Row totals live on the companion `POST /api/v2/tables/{tableId}/query/count`, which is a separate snapshot — a caller needing a consistent pair should take the count first and treat it as a floor.", + "description": "Query rows using an optional typed condition or `all`/`any` group, ordered sorting, and opaque cursor pagination. Omit the predicate to match all rows. Pages default to a 5 MB cap and may return fewer rows than requested; continue until `nextCursor` is null. Oversized predicates return `413`. `includeRunState` adds per-group outcomes and lowers the row cap. Counts come from a separate snapshot at `POST /query/count`; take the count first and treat it as a floor.", "tags": ["Tables"], "parameters": [ { @@ -2739,7 +2739,7 @@ "post": { "operationId": "searchTableRows", "summary": "Search Rows", - "description": "Text-search every cell case-insensitively for the substring `q`, optionally within a predicate-filtered and sorted view. This is TEXT search, not the structured predicate read: `POST /api/v2/tables/{tableId}/query` is that one, and on this surface `query` always means a structured predicate while `search` always means text.\n\nIt returns cell COORDINATES — `{ ordinal, rowId, column }` — and never row data. `ordinal` is the row's zero-based index in the same filtered, sorted view `POST /query` pages, so read the rows themselves through that. The result is uncursored and capped: at most 1000 matches come back and `truncated` is `true` when more matched than were returned. There is no cursor to page with — narrow `q` or the predicate instead.", + "description": "Search every cell case-insensitively for substring `q`, optionally within a predicate-filtered, sorted view. This is text search; `POST /query` performs structured predicate reads. Results are cell coordinates `{ ordinal, rowId, column }`, never row data; `ordinal` indexes the same view paged by `POST /query`. Results are uncursored and capped at 1000; `truncated` signals more matches. Narrow `q` or the predicate instead of paging.", "tags": ["Tables"], "parameters": [ { @@ -4073,7 +4073,7 @@ "post": { "operationId": "restoreTablesFolder", "summary": "Restore Folder", - "description": "Un-archive a table folder a recursive `DELETE` archived, along with every subfolder and table archived with it. Address it by the path it held when it was deleted. The restore may legally land it elsewhere: a folder whose parent is still archived is re-rooted to `/`, and a name an active sibling has taken meanwhile is deduplicated — so read the returned folder's `path` rather than assuming the requested one. A path that is not archived answers `404`. `DELETE /api/v2/tables/folders` returns the path it archived, which is the value to keep and send here; unlike the files surface, `GET /api/v2/tables/folders` does not yet list archived folders, so a caller that discards that path cannot recover it over the API.", + "description": "Restore a recursively archived table folder with its subfolders and tables, addressed by its former path. If its parent remains archived, it is re-rooted to `/`; active-name conflicts are deduplicated, so use the returned `path`. Non-archived paths return `404`. Preserve the path returned by `DELETE /api/v2/tables/folders`: unlike the files API, the table-folder list cannot discover archived paths.", "tags": ["Tables"], "requestBody": { "required": true, @@ -4489,7 +4489,7 @@ "post": { "operationId": "moveTables", "summary": "Move Tables and Folders", - "description": "Move up to 100 tables and table folders into one destination folder in a single authorized request. Folders are named by canonical path, and `null` or `/` moves to the workspace root. Best-effort per item: a table filed inside a selected folder is reported in `skipped` because the folder already carries it, an entry that resolves to nothing lands in `notFound`, and an item refused by a lock or a folder cycle lands in `failed` with a reason. An invalid destination fails the whole request before anything moves.", + "description": "Move up to 100 tables and canonical-path folders to one destination; `null` or `/` means the workspace root. Processing is best-effort per item: tables already carried by selected folders are `skipped`, missing items are `notFound`, and lock or cycle refusals are `failed` with reasons. An invalid destination rejects the entire request before any move.", "tags": ["Tables"], "requestBody": { "required": true, @@ -4891,6 +4891,48 @@ } }, "schemas": { + "V2ActionableForbiddenDetails": { + "type": "object", + "properties": { + "code": { + "$ref": "#/components/schemas/V2ForbiddenDetailCode" + } + }, + "required": ["code"], + "additionalProperties": { + "description": "Additional context for this refusal." + }, + "title": "Actionable forbidden details", + "description": "Machine-readable cause and optional context for an actionable `403` response." + }, + "V2ForbiddenDetailCode": { + "type": "string", + "enum": [ + "INSUFFICIENT_WORKSPACE_ROLE", + "PERSONAL_API_KEYS_DISABLED", + "WORKSPACE_KEY_OPERATION_NOT_PERMITTED", + "PRINCIPAL_KIND_NOT_PERMITTED", + "ORGANIZATION_MEMBERSHIP_REQUIRED", + "ORGANIZATION_ADMIN_REQUIRED", + "ENTERPRISE_PLAN_REQUIRED", + "ORGANIZATION_PLAN_REQUIRED", + "AUDIT_LOGS_DISABLED", + "SKILL_EDITOR_ACCESS_REQUIRED", + "SECRET_ADMIN_ACCESS_REQUIRED", + "WORKSPACE_RESOURCE_LIMIT_REACHED", + "PUBLIC_SHARING_NOT_ALLOWED", + "CREDENTIAL_ADMIN_ACCESS_REQUIRED", + "MCP_SERVER_URL_NOT_ALLOWED", + "WORKSPACE_PLAN_CAPABILITY_REQUIRED", + "CHAT_AUTH_MODE_NOT_PERMITTED", + "CONNECTOR_MANAGED_RESOURCE_READ_ONLY", + "PERMISSION_GROUP_CAPABILITY_BLOCKED", + "INTEGRATION_NOT_ALLOWED", + "INSUFFICIENT_SCOPE" + ], + "title": "Forbidden detail code", + "description": "Stable cause code for an actionable `403` response." + }, "V2Error": { "type": "object", "properties": { @@ -4906,7 +4948,15 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." + "description": "Structured error context whose keys depend on the error. Actionable `403` responses use the `V2ActionableForbiddenDetails` shape; validation failures may return issue arrays instead.", + "anyOf": [ + { + "$ref": "#/components/schemas/V2ActionableForbiddenDetails" + }, + { + "description": "Other structured context defined by the specific error." + } + ] } }, "required": ["code", "message"], @@ -6048,7 +6098,7 @@ }, "TablePredicate": { "title": "Table predicate", - "description": "Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so \"not X\" is not the complement of \"X\" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: \"Hi*\"`, not `like: \"Hi%\"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.", + "description": "Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.", "type": "object", "oneOf": [ { @@ -6462,7 +6512,7 @@ }, "TablePredicateInput": { "title": "Table predicate input", - "description": "A single `{ field, op, value }` condition or a recursive `all`/`any` group; either form is normalized to a grouped predicate after validation. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so \"not X\" is not the complement of \"X\" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: \"Hi*\"`, not `like: \"Hi%\"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.", + "description": "One condition or a recursive `all`/`any` group, normalized to a grouped predicate. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.", "oneOf": [ { "type": "object", @@ -8460,7 +8510,7 @@ "url": { "type": "string", "format": "uri", - "description": "Signed URL to which the file bytes are uploaded. Send the bytes with `PUT` to this URL, including exactly the headers in `headers` and nothing that alters the body. The URL is signed and self-describing — construct it from this field only, never by hand.\n\n**Where this URL points depends on the deployment, and so does what answers you.** When Sim stores objects itself the URL is Sim's own data plane: success is `204` with an empty body, and a failure is the same `{ \"error\": { \"code\", \"message\" } }` envelope as every other v2 response — `400` when the body does not match the size or content type the session was created for, `403` when the token is invalid, expired, or belongs to another session, and `409` when the session is no longer accepting bytes. When object storage is configured — S3, Google Cloud Storage, or Azure Blob — the URL is that provider's own presigned URL, and the provider answers directly: treat **any `2xx` as success** (S3 and GCS answer `200`, Azure `201`), and on failure expect the provider's error document, typically XML, not the v2 envelope. Do not branch on `204` and do not parse a failure as JSON." + "description": "Signed URL to which the file bytes are uploaded. Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML." }, "headers": { "type": "object", @@ -9073,7 +9123,7 @@ "url": { "type": "string", "format": "uri", - "description": "Signed URL for this upload part. Send the bytes with `PUT` to this URL, including exactly the headers in `headers` and nothing that alters the body. The URL is signed and self-describing — construct it from this field only, never by hand.\n\n**Where this URL points depends on the deployment, and so does what answers you.** When Sim stores objects itself the URL is Sim's own data plane: success is `204` with an empty body, and a failure is the same `{ \"error\": { \"code\", \"message\" } }` envelope as every other v2 response — `400` when the body does not match the size or content type the session was created for, `403` when the token is invalid, expired, or belongs to another session, and `409` when the session is no longer accepting bytes. When object storage is configured — S3, Google Cloud Storage, or Azure Blob — the URL is that provider's own presigned URL, and the provider answers directly: treat **any `2xx` as success** (S3 and GCS answer `200`, Azure `201`), and on failure expect the provider's error document, typically XML, not the v2 envelope. Do not branch on `204` and do not parse a failure as JSON.\n\nYou do not need to retain the `ETag` each part upload returns. Unlike a raw S3 multipart flow, completion takes no request body: Sim lists the uploaded parts from the provider itself and reads their entity tags there, so `POST .../complete` only has to happen after every part has been sent." + "description": "Signed URL for this upload part. Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML. Do not retain part `ETag` values; after every part succeeds, call the completion endpoint without a request body." }, "headers": { "type": "object", diff --git a/apps/docs/openapi-v2-workflows.json b/apps/docs/openapi-v2-workflows.json index 88f793deda5..c1f23f03188 100644 --- a/apps/docs/openapi-v2-workflows.json +++ b/apps/docs/openapi-v2-workflows.json @@ -277,7 +277,7 @@ "get": { "operationId": "getWorkflowState", "summary": "Get Workflow State", - "description": "Get the editable draft graph of a workflow: blocks, edges, the loop and parallel containers derived from them, and variables. This is the pollable read — it records no audit event, and `HEAD` mirrors `GET`. The payload is **unsanitized**: it carries workspace-scoped `credentialId`, `knowledgeBaseId`, and `tableId` values verbatim, so it is not portable to another workspace. Use `GET /workflows/{workflowId}/export` for a portable, sanitized copy — and note that export is not a read-modify-write source, because sanitizing it drops every credential binding. Unknown members are stripped, so what this returns is exactly the set of keys `PUT /workflows/{workflowId}/state` accepts.", + "description": "Get the editable draft graph: blocks, edges, derived loop and parallel containers, and variables. This pollable read records no audit event, and `HEAD` mirrors `GET`. The unsanitized payload includes workspace-scoped credential, knowledge-base, and table ids, so it is not portable. Use `export` for a sanitized copy, but not for read-modify-write because credential bindings are removed. Returned keys exactly match what `PUT /workflows/{workflowId}/state` accepts.", "tags": ["Workflows"], "parameters": [ { @@ -341,7 +341,7 @@ "put": { "operationId": "replaceWorkflowState", "summary": "Replace Workflow State", - "description": "Replace a workflow’s editable draft graph wholesale. `loops` and `parallels` are accepted but ignored — both are recomputed from `blocks`. Omitting `variables` leaves the stored variables untouched.\n\nLast write wins: concurrent writers are serialized by a row lock, so each lands a complete self-consistent graph and the later one replaces the earlier entirely. There is no partially-written state. Ids are the one conflict that is detected: block, edge, and subflow ids are globally unique, so a body carrying an id another workflow already owns is refused with `409` rather than written.\n\nThis does not change what the deployed endpoint serves. Deployments are immutable versioned snapshots, and no schedule or webhook registration is touched. The only visible consequence is that `needsRedeployment` becomes true; `POST /workflows/{workflowId}/deploy` publishes the draft.\n\n`lint` is advisory and never blocks the write. `lint.fieldIssues` is the most actionable part for a headless builder — it names blocks missing a required field, which fail at run time — and `lint.unresolvedReferences` names credential, resource, tool, and skill values that do not resolve. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.\n\nSet `?dryRun=true` to validate and lint without persisting: nothing is written, no audit entry is recorded, and collaborators are not notified. The response carries the same shape and the same validation and `lint` findings the committed write would, with `dryRun: true` — including the warnings the write’s own preparation step raises, and the same `409` when an id is already owned by another workflow. Only `needsRedeployment` differs: it describes the state before the write.", + "description": "Atomically replace the editable draft graph. Concurrent writes are row-locked and last-write-wins; no partial state is stored. `loops` and `parallels` are recomputed from `blocks`; omitted `variables` remain unchanged. Foreign ids return `409`. This leaves deployment unchanged and marks the draft for redeployment; lint is advisory. `dryRun=true` runs the same validation, lint, and conflict checks without persistence, audit, or notification; `needsRedeployment` reflects pre-write state. Workspace keys are rejected; use personal keys or OAuth.", "tags": ["Workflows"], "parameters": [ { @@ -440,7 +440,7 @@ "post": { "operationId": "applyWorkflowOperations", "summary": "Apply Workflow Operations", - "description": "Apply a batch of semantic edits — add, edit, delete, and subflow membership changes — to a workflow graph, plus an optional set of block enable/disable changes.\n\nBest-effort per operation, atomic per write. The engine applies what it can to an in-memory graph and reports the rest in `skipped`, each with a machine-readable `type`; exactly one write of the fully-resolved graph then happens, so there is never a partially-applied graph. `deferred` is **not** a failure list: a forward-referencing edge is wired automatically once its target block exists, in this batch or a later one, so re-issuing a deferred edge is wrong.\n\nSet `atomic` to fail closed: any genuine skipped item, or any block input that would be dropped rather than persisted, then aborts before the write and answers `409` with `error.details.code: \"OPERATIONS_NOT_APPLIED\"`, the same `skipped` array, and a `droppedInputs` array, having persisted nothing.\n\nA `block_id` you supply on an `add` or `insert_into_subflow` is only a label unless it is already a UUID: the engine mints one and returns the pairing in `mintedBlockIds`. References between operations in the same batch are remapped for you, so `triage` can be wired up in the same call it is created in — but a later request must use the minted id. Send your own UUIDs when you want an id you chose to survive across requests.\n\nOperation `params` is an open object because the accepted inputs come from the block registry, not from this contract — see the per-operation schemas for the envelope: `inputs` keyed by sub-block id, with `retry`, `triggerMode` and `advancedMode` beside it rather than inside it, and `connections` keyed by source handle. `GET /blocks/{blockId}` publishes the inputs a given block type accepts. The Agent block’s `inputs.tools` value is the important exception to that open catalog shape: it is published here as the named `AgentToolInput` union, covering catalog integrations, workspace custom tools, and MCP tools.\n\n`lint` is advisory and never blocks the write. `lint.fieldIssues` is the most actionable part for a headless builder — it names blocks missing a required field, which fail at run time — and `lint.unresolvedReferences` names credential, resource, tool, and skill values that do not resolve. Those values stay persisted; only `inputValidationErrors` lists inputs that were actually dropped.\n\nAs with `PUT /workflows/{workflowId}/state`, this changes only the draft; deploy to publish it. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.\n\nSet `?dryRun=true` to validate and lint without persisting: nothing is written, no audit entry is recorded, and collaborators are not notified. The response carries the same shape and the same validation and `lint` findings the committed write would, with `dryRun: true` — including the warnings the write’s own preparation step raises, and the same `409` when an id is already owned by another workflow. Only `needsRedeployment` differs: it describes the state before the write.", + "description": "Apply graph edits and optional block enablement in one atomic write. Failed operations appear in `skipped`; `deferred` edges resolve when targets exist and must not be retried. With `atomic`, any skip or dropped input returns `409` with `OPERATIONS_NOT_APPLIED` and persists nothing. Non-UUID labels are minted and same-batch references remapped in `mintedBlockIds`. Lint is advisory. `dryRun=true` runs the same checks without persistence, audit, or notification. This changes only the draft. Workspace keys are rejected; use personal keys or OAuth.", "tags": ["Workflows"], "parameters": [ { @@ -1446,7 +1446,7 @@ "post": { "operationId": "revertWorkflowVersion", "summary": "Revert Workflow To Version", - "description": "Overwrite the editable draft with the graph pinned by a deployment version, discarding every unsaved edit. This is the most destructive operation in the deployment family and it does **not** change what is live — to move production, use `activate` or `rollback`, both of which leave the draft alone. Pass `active` as the version to discard draft edits and return to the live graph. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Overwrite the editable draft with a deployment version, irreversibly discarding unsaved edits. This does not change the live version; use `activate` or `rollback` for production, both of which leave the draft unchanged. Pass `active` to reset the draft to the live graph. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Workflows"], "parameters": [ { @@ -1555,7 +1555,7 @@ "get": { "operationId": "getWorkflowDeployment", "summary": "Get Workflow Deployment", - "description": "Read the current deployment state of a workflow: whether a version is live, when it went live, the most recent deployment attempt with its readiness and failure payload, and whether the editable draft has since diverged from the live version. This is the only operation that publishes `needsRedeployment` and `isPublicApi`.\n\n`isPublicApi` is the security-relevant one: while it is `true` the deployed workflow executes without an API key, so anyone holding the execution URL can run it — and consume the workspace’s billed usage — anonymously. It is set through `PATCH /workflows/{workflowId}/deployment`, and this read is the only way to audit whether it is on.\n\nNot to be confused with `/workflows/{workflowId}/deployments/chat`, which is the hosted chat the workflow is published as. This path governs whether the workflow is executable at all; that one governs one surface it is served on. A workflow can be deployed with no chat, and removing its chat leaves it deployed and executable.", + "description": "Read the live version, latest deployment attempt and readiness, draft drift (`needsRedeployment`), and `isPublicApi`. When `isPublicApi` is true, anyone with the execution URL can run and consume billed usage without an API key; change it with `PATCH /workflows/{workflowId}/deployment`. `/workflows/{workflowId}/deployment` controls overall API executability; `/deployments/chat` controls only the hosted-chat surface. A workflow can remain deployed without a chat.", "tags": ["Workflows"], "parameters": [ { @@ -1619,7 +1619,7 @@ "patch": { "operationId": "updateWorkflowPublicApi", "summary": "Update Workflow Public API Access", - "description": "Enable or disable unauthenticated public execution of the deployed workflow. While enabled, anyone holding the execution URL can run the workflow without an API key. An organization that forbids public sharing refuses this with `403` and `PUBLIC_SHARING_NOT_ALLOWED`. Not to be confused with `/workflows/{workflowId}/deployments/chat`, which is the hosted chat the workflow is published as. This path governs whether the workflow is executable at all; that one governs one surface it is served on. A workflow can be deployed with no chat, and removing its chat leaves it deployed and executable. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Enable or disable unauthenticated public execution of the deployed workflow. While enabled, anyone holding the execution URL can run the workflow without an API key. An organization that forbids public sharing refuses this with `403` and `PUBLIC_SHARING_NOT_ALLOWED`. `/workflows/{workflowId}/deployment` controls overall API executability; `/deployments/chat` controls only the hosted-chat surface. A workflow can remain deployed without a chat. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Workflows"], "parameters": [ { @@ -1950,7 +1950,7 @@ "get": { "operationId": "exportWorkflow", "summary": "Export Workflow", - "description": "Export a portable, secret-sanitized workflow. Workspace-scoped bindings must be selected again after import. Exporting records an audit event, so it is not a safe read. A `HEAD` skips the effect but is authorized exactly as the `GET` is, so it answers `400`, `401`, `403`, or `404` wherever the `GET` would and an empty `200` otherwise. Skipping the effect means skipping the read that produces the payload, so that `200` carries none of the response headers documented below — it answers whether the `GET` would be allowed, not what the `GET` would return. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Export a portable, secret-sanitized workflow; workspace-scoped bindings must be selected again after import. Exporting records an audit event. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only. A workspace folder tree over 10,000 folders is a `413`.", "tags": ["Workflows"], "parameters": [ { @@ -2094,7 +2094,7 @@ "get": { "operationId": "listChatDeployments", "summary": "List Chat Deployments", - "description": "List the workflows a workspace has published as hosted chats. Each entry carries the public `url` a visitor uses — there is no chat subdomain, the identifier is a path segment.\n\nThis is the only chat path not addressed under a workflow, and deliberately so: every chat is a singleton of the workflow it publishes, but \"what does this workspace serve\" is a question no per-workflow path can answer. Filter by `workflowId` to resolve one workflow's chat without holding its id.\n\nEntries are deliberately narrower than the singleton read: `allowedEmails`, `hasPassword`, and `customizations` are available only from `GET /api/v2/workflows/{workflowId}/deployments/chat`, which requires workspace `admin`. That is what keeps this list callable at workspace `read` and by a workspace API key. A stored password is never returned by either.", + "description": "List hosted chats in a workspace with opaque cursor pagination. Filter by `workflowId` to resolve one workflow’s singleton chat. Each item includes its public URL, whose identifier is a path segment, but omits `allowedEmails`, `hasPassword`, and `customizations`; read those through the admin-only singleton endpoint. This list requires workspace read access and accepts workspace API keys. Stored passwords are never returned.", "tags": ["Workflows"], "parameters": [ { @@ -2229,7 +2229,7 @@ "get": { "operationId": "getWorkflowChatDeployment", "summary": "Get Workflow Chat Deployment", - "description": "Read the hosted chat a workflow is published as. Answers `404` when the workflow publishes no chat. Not to be confused with `/workflows/{workflowId}/deployment` (singular), which is the workflow's own API deployment — its live version and whether the draft has drifted. That path governs whether the workflow is executable at all; this one governs the hosted chat it is served on. The chat is a singleton of its workflow, so it has no id of its own in any path and no separate create verb: `PUT` is create-or-replace and is the only write. The stored password is never returned — `hasPassword` reports only whether one is set. This carries the visitor gate — `authType`, `hasPassword`, and the `allowedEmails` allow-list — so it requires workspace `admin`, unlike the workspace-wide list. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Read a workflow’s singleton hosted chat, or return `404` when none exists. `/workflows/{workflowId}/deployment` controls API execution; this singleton path controls hosted chat. `PUT` creates or replaces it without a chat-id path. The password is never returned; `hasPassword` reports its presence. Visitor-gate fields (`authType`, `hasPassword`, and `allowedEmails`) require workspace admin access. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", "tags": ["Workflows"], "parameters": [ { @@ -2293,7 +2293,7 @@ "put": { "operationId": "replaceWorkflowChatDeployment", "summary": "Create or Replace Workflow Chat Deployment", - "description": "Publish a workflow as a hosted chat, or replace the chat it already publishes. Not to be confused with `/workflows/{workflowId}/deployment` (singular), which is the workflow's own API deployment — its live version and whether the draft has drifted. That path governs whether the workflow is executable at all; this one governs the hosted chat it is served on. The chat is a singleton of its workflow, so it has no id of its own in any path and no separate create verb: `PUT` is create-or-replace and is the only write.\n\n**Replace, not merge.** The chat ends up as exactly what the body describes: an omitted optional field takes its platform default rather than whatever the previous chat carried, so sending the same body twice leaves the same result. `password` is therefore required whenever `authType` is `\"password\"` and rejected otherwise — it is write-only and never readable back, so carrying one over implicitly is the one place a replace would quietly stop meaning replace. `allowedEmails` follows the same rule: required and non-empty for `\"email\"` and `\"sso\"`, rejected for the modes that admit no allow-list. `customizations` is the one documented exception: it merges per field, so an omitted `imageUrl` keeps the stored one rather than clearing it, and customization keys this surface does not declare do not survive the write. That behaviour is shared with the in-app editor and the Copilot deploy tool, which both send partial objects.\n\nThis also deploys the workflow, because a chat serves the live version: a draft that has drifted is republished as part of the call. Two conditions answer `409` — an `identifier` another live chat already holds, and a workflow deployment attempt still preparing, which the caller can retry once it becomes active. `authType: \"public\"` leaves the chat open to anyone holding the URL. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Create or replace hosted chat. Omitted fields reset to defaults except per-field `customizations`. `password` is write-only and required for password auth; `allowedEmails` is required and non-empty for email or SSO. This also deploys the draft. A duplicate identifier or pending deployment returns `409`; public auth exposes the URL. `/workflows/{workflowId}/deployment` controls API execution; this singleton path controls hosted chat. `PUT` creates or replaces it without a chat-id path. Workspace keys are rejected; use personal keys or OAuth.", "tags": ["Workflows"], "parameters": [ { @@ -2446,7 +2446,7 @@ "post": { "operationId": "executeWorkflowV2", "summary": "Execute Workflow", - "description": "Execute the active deployment by default, or select manual execution of the current saved workflow state with `run.source: \"manual\"`. Manual runs require a personal API key or OAuth token with current write access and support synchronous or Server-Sent Event execution only; workspace keys, anonymous public access, and async manual runs are rejected. A manual run can enter through one runnable trigger (including external integration/webhook triggers) or resume at a named block from the exact same-workflow run identified by `sourceRunId`; the server loads that run's persisted snapshot, which is never accepted from the request. Omit a trigger block id only when the saved workflow has exactly one runnable trigger. Public deployed workflows permit anonymous synchronous and streaming execution, while asynchronous deployed execution requires an API credential. A synchronous run that exceeds its execution timeout returns HTTP 200 with `status: \"failed\"` and `error.code: \"TIMEOUT\"` rather than an HTTP error, so branch on `status`. Each option carries the modes it requires and the modes that reject it; a violated combination is a 400.", + "description": "Execute the deployment, or use `run.source: \"manual\"` for draft state. Manual runs require a personal key or OAuth write access; workspace keys, anonymous callers, and async mode are rejected. Start at a runnable trigger, or resume from `sourceRunId` using the same-workflow snapshot. Public deployments allow anonymous sync or streaming; async requires credentials. Sync timeouts return `200` with failed status and `TIMEOUT`. Each option carries the modes it requires and the modes that reject it; a violated combination is a 400.", "tags": ["Workflows"], "security": [ { @@ -2603,7 +2603,7 @@ "get": { "operationId": "listWorkflowRunsV2", "summary": "List Workflow Runs", - "description": "List recorded runs of a workflow with filtering and opaque cursor pagination. Runs are hard-deleted once they pass the payer's log retention window, so an older run is simply absent rather than reported as removed. The window is 30 days from run start on the free plan, unbounded on Pro and Team, and set per organization on Enterprise with an optional per-workspace override.", + "description": "List recorded runs of a workflow with filtering and opaque cursor pagination. Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override.", "tags": ["Workflow Runs"], "parameters": [ { @@ -2751,7 +2751,7 @@ "get": { "operationId": "getWorkflowRunV2", "summary": "Get Workflow Run", - "description": "Get current workflow run state, optionally including final and block outputs. With `includeOutput`, `files` lists the files the run produced, each with a `downloadPath`; add `includeFileBase64` to inline their bytes, which answers `413` naming the download path when a single file, or the run's inlined total, exceeds the 16 MiB ceiling. Because inlining reads object storage, this `GET` is not a safe read. A `HEAD` skips the effect but is authorized exactly as the `GET` is, so it answers `400`, `401`, `403`, or `404` wherever the `GET` would and an empty `200` otherwise. Skipping the effect means skipping the read that produces the payload, so that `200` carries none of the response headers documented below — it answers whether the `GET` would be allowed, not what the `GET` would return.", + "description": "Get current run state with optional final and block outputs. With `includeOutput`, `files` includes download paths; `includeFileBase64` reads object storage to inline bytes and returns `413` with the download path when one file or the total exceeds 16 MiB. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only.", "tags": ["Workflow Runs"], "parameters": [ { @@ -2878,7 +2878,7 @@ "get": { "operationId": "downloadWorkflowRunFileV2", "summary": "Download Workflow Run File", - "description": "Download one file a run produced. The run resource reports the files a run emitted; address one of them by its `id` here. Run output carries `/api/files/serve/...` URLs that reject API keys, so this is the byte path out of a run for an API-key caller. Execution objects are not retained indefinitely, so a `404` for a file an older run produced is expected rather than a fault. Runs are hard-deleted once they pass the payer's log retention window, so an older run is simply absent rather than reported as removed. The window is 30 days from run start on the free plan, unbounded on Pro and Team, and set per organization on Enterprise with an optional per-workspace override. Downloading records an audit event, so it is not a safe read. A `HEAD` skips the effect but is authorized exactly as the `GET` is, so it answers `400`, `401`, `403`, or `404` wherever the `GET` would and an empty `200` otherwise. Skipping the effect means skipping the read that produces the payload, so that `200` carries none of the response headers documented below — it answers whether the `GET` would be allowed, not what the `GET` would return. In particular a `HEAD` does not report `Content-Length`, so it cannot be used to size a download in advance; read the size from the file resource instead.", + "description": "Download one run-produced file by id. Downloads record an audit event. Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only. `HEAD` omits `Content-Length`; use file metadata to size downloads.", "tags": ["Workflow Runs"], "parameters": [ { @@ -3905,6 +3905,48 @@ } }, "schemas": { + "V2ActionableForbiddenDetails": { + "type": "object", + "properties": { + "code": { + "$ref": "#/components/schemas/V2ForbiddenDetailCode" + } + }, + "required": ["code"], + "additionalProperties": { + "description": "Additional context for this refusal." + }, + "title": "Actionable forbidden details", + "description": "Machine-readable cause and optional context for an actionable `403` response." + }, + "V2ForbiddenDetailCode": { + "type": "string", + "enum": [ + "INSUFFICIENT_WORKSPACE_ROLE", + "PERSONAL_API_KEYS_DISABLED", + "WORKSPACE_KEY_OPERATION_NOT_PERMITTED", + "PRINCIPAL_KIND_NOT_PERMITTED", + "ORGANIZATION_MEMBERSHIP_REQUIRED", + "ORGANIZATION_ADMIN_REQUIRED", + "ENTERPRISE_PLAN_REQUIRED", + "ORGANIZATION_PLAN_REQUIRED", + "AUDIT_LOGS_DISABLED", + "SKILL_EDITOR_ACCESS_REQUIRED", + "SECRET_ADMIN_ACCESS_REQUIRED", + "WORKSPACE_RESOURCE_LIMIT_REACHED", + "PUBLIC_SHARING_NOT_ALLOWED", + "CREDENTIAL_ADMIN_ACCESS_REQUIRED", + "MCP_SERVER_URL_NOT_ALLOWED", + "WORKSPACE_PLAN_CAPABILITY_REQUIRED", + "CHAT_AUTH_MODE_NOT_PERMITTED", + "CONNECTOR_MANAGED_RESOURCE_READ_ONLY", + "PERMISSION_GROUP_CAPABILITY_BLOCKED", + "INTEGRATION_NOT_ALLOWED", + "INSUFFICIENT_SCOPE" + ], + "title": "Forbidden detail code", + "description": "Stable cause code for an actionable `403` response." + }, "V2Error": { "type": "object", "properties": { @@ -3920,7 +3962,15 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `INSUFFICIENT_SCOPE` — The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it." + "description": "Structured error context whose keys depend on the error. Actionable `403` responses use the `V2ActionableForbiddenDetails` shape; validation failures may return issue arrays instead.", + "anyOf": [ + { + "$ref": "#/components/schemas/V2ActionableForbiddenDetails" + }, + { + "description": "Other structured context defined by the specific error." + } + ] } }, "required": ["code", "message"], @@ -5882,7 +5932,7 @@ "type": "string", "description": "The id the block was actually given." }, - "description": "The id each newly created block was actually given, keyed by the `block_id` you asked for, and present only for the ones that differ. A `block_id` on an `add` or `insert_into_subflow` that is not already a UUID is replaced with a minted one, so this is how you learn what to reference afterwards. Within a single batch you can keep using your own ids — references between operations are remapped for you — but a later request must use the minted id, so send your own UUIDs when you want an id you chose to survive." + "description": "Minted block ids keyed by requested `block_id`, present only when they differ. References within this batch are remapped automatically; later requests must use the minted id. Supply a UUID when the requested id must survive unchanged." }, "lint": { "$ref": "#/components/schemas/WorkflowLintReport" @@ -6016,7 +6066,7 @@ "additionalProperties": { "description": "One block-specific input or connection descriptor." }, - "description": "Block type and name, plus any block-specific configuration. Beyond `type` and `name` the accepted keys are `inputs`, `connections`, `retry`, `triggerMode`, and `advancedMode`. `inputs` carries the block's own configuration keyed by sub-block id, for example `inputs: { model: \"gpt-4o\", systemPrompt: \"...\" }` — never wrapped in `subBlocks`. Block-level settings sit beside `inputs`, never inside it: `retry`, `triggerMode`, `advancedMode`. `connections` is keyed by source handle and each value is a target block id, `{ block, handle }`, or an array of either; `success` is accepted as an alias for the `source` handle." + "description": "Block `type`, `name`, and optional `inputs`, `connections`, `retry`, `triggerMode`, or `advancedMode`. `inputs` maps sub-block ids directly to values, never through `subBlocks`. Keep `retry`, `triggerMode`, and `advancedMode` beside `inputs`. `connections` maps source handles to target ids, `{ block, handle }`, or arrays; `success` aliases `source`." } }, "required": ["operation_type", "block_id", "params"], @@ -6081,7 +6131,7 @@ } } ], - "description": "Fields to change on the target block. Send only what changes. Accepted keys: `inputs`, `name`, `connections`, `removeEdges`, `nestedNodes`, `retry`, `triggerMode`, `advancedMode`. `inputs` carries the block's own configuration keyed by sub-block id, for example `inputs: { model: \"gpt-4o\", systemPrompt: \"...\" }` — never wrapped in `subBlocks`. Block-level settings sit beside `inputs`, never inside it: `retry`, `triggerMode`, `advancedMode`. `connections` is keyed by source handle and each value is a target block id, `{ block, handle }`, or an array of either; `success` is accepted as an alias for the `source` handle. Re-sending `connections` replaces that block's outgoing edges, so use `removeEdges` — `[{ targetBlockId, sourceHandle? }]`, `sourceHandle` defaulting to `source` — to drop one edge without restating the rest." + "description": "Patch only supplied fields: `inputs`, `name`, `connections`, `removeEdges`, `nestedNodes`, `retry`, `triggerMode`, and `advancedMode`. `inputs` maps sub-block ids directly to values, never through `subBlocks`. Keep `retry`, `triggerMode`, and `advancedMode` beside `inputs`. `connections` maps source handles to target ids, `{ block, handle }`, or arrays; `success` aliases `source`. Re-sending `connections` replaces outgoing edges; use `removeEdges` to delete selected edges." } }, "required": ["operation_type", "block_id", "params"], @@ -6166,7 +6216,7 @@ "additionalProperties": { "description": "One block-specific input or connection descriptor." }, - "description": "Container, block type and name, plus any block-specific configuration. Takes the same keys as an `add`: `inputs`, `connections`, `retry`, `triggerMode`, `advancedMode`. `inputs` carries the block's own configuration keyed by sub-block id, for example `inputs: { model: \"gpt-4o\", systemPrompt: \"...\" }` — never wrapped in `subBlocks`. Block-level settings sit beside `inputs`, never inside it: `retry`, `triggerMode`, `advancedMode`. `connections` is keyed by source handle and each value is a target block id, `{ block, handle }`, or an array of either; `success` is accepted as an alias for the `source` handle." + "description": "Container, block `type`, `name`, and the same optional fields as `add`. `inputs` maps sub-block ids directly to values, never through `subBlocks`. Keep `retry`, `triggerMode`, and `advancedMode` beside `inputs`. `connections` maps source handles to target ids, `{ block, handle }`, or arrays; `success` aliases `source`." } }, "required": ["operation_type", "block_id", "params"], @@ -9280,7 +9330,7 @@ } }, "run": { - "description": "Workflow state and entry point to execute. Omit for the active deployment. Manual execution requires a personal API key with write access and supports synchronous or streamed runs only.", + "description": "Workflow state and entry point to execute. Omit for the active deployment. Manual execution requires OAuth or personal-key write access and supports synchronous or streamed runs only.", "oneOf": [ { "type": "object", @@ -9358,7 +9408,7 @@ }, "async": { "default": false, - "description": "Queue the run and return a 202 receipt when true. Requires an API key, cannot be combined with `stream`, and rejects all streaming and output-shaping options (`selectedOutputs`, `includeThinking`, `includeToolCalls`, `includeFileBase64`, `base64MaxBytes`).", + "description": "Queue the run and return a 202 receipt when true. Requires an OAuth access token or API key, cannot be combined with `stream`, and rejects all streaming and output-shaping options (`selectedOutputs`, `includeThinking`, `includeToolCalls`, `includeFileBase64`, `base64MaxBytes`).", "type": "boolean" }, "executionTimeoutSeconds": { diff --git a/apps/sim/.env.example b/apps/sim/.env.example index 766ab33926f..cff17292594 100644 --- a/apps/sim/.env.example +++ b/apps/sim/.env.example @@ -11,7 +11,7 @@ BETTER_AUTH_URL=http://localhost:3000 # Authentication Bypass (Optional - for self-hosted deployments behind private networks) # DISABLE_AUTH=true # Uncomment to bypass authentication entirely. Creates an anonymous session for all requests. -# OAUTH_PROVIDER_ENABLED=false # Disable Sim's OAuth authorization server. DISABLE_AUTH=true also forces it off. +# OAUTH_PROVIDER_ENABLED=true # Enable Sim's OAuth authorization server after every app instance runs the matching migration/code. DISABLE_AUTH=true forces it off. # Private-network egress allowlist (Optional - self-hosted only; ignored on Sim Cloud) # EGRESS_ALLOWED_HOSTS=host.docker.internal,*.svc.cluster.local # Uncomment to let outbound requests reach these hosts on a private network. Widens the SSRF boundary; only use on a trusted private network. diff --git a/apps/sim/app/(auth)/oauth/sign-in/route.test.ts b/apps/sim/app/(auth)/oauth/sign-in/route.test.ts new file mode 100644 index 00000000000..b72250bb1c5 --- /dev/null +++ b/apps/sim/app/(auth)/oauth/sign-in/route.test.ts @@ -0,0 +1,72 @@ +/** + * @vitest-environment node + */ +import { NextRequest } from 'next/server' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const flags = vi.hoisted(() => ({ enabled: true, registrationDisabled: false })) + +vi.mock('@/lib/core/config/env-flags', () => ({ + get isOAuthProviderEnabled() { + return flags.enabled + }, + get isRegistrationDisabled() { + return flags.registrationDisabled + }, +})) + +import { GET } from '@/app/(auth)/oauth/sign-in/route' + +function request(query: string): NextRequest { + return new NextRequest(`https://sim.test/oauth/sign-in?${query}`) +} + +function redirectParts(response: Response): { destination: URL; callback: URL } { + const destination = new URL(response.headers.get('location') as string) + const callbackUrl = destination.searchParams.get('callbackUrl') + if (!callbackUrl) throw new Error('redirect did not carry a callbackUrl') + return { destination, callback: new URL(callbackUrl, destination.origin) } +} + +describe('OAuth login bridge', () => { + beforeEach(() => { + flags.enabled = true + flags.registrationDisabled = false + }) + + it('consumes prompt=login and preserves a later consent prompt', async () => { + const response = await GET( + request( + 'client_id=sim-cli&redirect_uri=http%3A%2F%2F127.0.0.1%2Fcallback&prompt=login%20consent&sig=signed&ba_iat=1' + ) + ) + const { destination, callback } = redirectParts(response) + + expect(response.status).toBe(302) + expect(destination.pathname).toBe('/login') + expect(callback.pathname).toBe('/api/auth/oauth2/authorize') + expect(callback.searchParams.get('prompt')).toBe('consent') + expect(callback.searchParams.get('client_id')).toBe('sim-cli') + expect(callback.searchParams.has('sig')).toBe(false) + expect(callback.searchParams.has('ba_iat')).toBe(false) + }) + + it('consumes prompt=create after directing the user through signup', async () => { + const response = await GET(request('client_id=sim-cli&prompt=create')) + const { destination, callback } = redirectParts(response) + + expect(destination.pathname).toBe('/signup') + expect(callback.searchParams.has('prompt')).toBe(false) + }) + + it('uses login when registration is disabled and hides a disabled provider', async () => { + flags.registrationDisabled = true + const enabled = await GET(request('client_id=sim-cli')) + expect(redirectParts(enabled).destination.pathname).toBe('/login') + + flags.enabled = false + const disabled = await GET(request('client_id=sim-cli')) + expect(disabled.status).toBe(302) + expect(new URL(disabled.headers.get('location') as string).pathname).toBe('/') + }) +}) diff --git a/apps/sim/app/(auth)/oauth/sign-in/route.ts b/apps/sim/app/(auth)/oauth/sign-in/route.ts index a5b0a9193f0..35430c1524d 100644 --- a/apps/sim/app/(auth)/oauth/sign-in/route.ts +++ b/apps/sim/app/(auth)/oauth/sign-in/route.ts @@ -10,6 +10,16 @@ import { buildAuthCrossLink } from '@/app/(auth)/auth-redirect' */ const SIGNED_QUERY_PARAMS = new Set(['sig', 'exp', 'ba_iat', 'ba_param', 'ba_pl']) +/** Removes prompts completed by the login/signup hop while preserving later consent prompts. */ +function consumeInteractivePrompt(params: URLSearchParams): boolean { + const prompts = (params.get('prompt') ?? '').split(/\s+/).filter(Boolean) + const requiresLogin = prompts.includes('login') + const remaining = prompts.filter((prompt) => prompt !== 'login' && prompt !== 'create') + if (remaining.length > 0) params.set('prompt', remaining.join(' ')) + else params.delete('prompt') + return requiresLogin +} + /** * The OAuth provider's `loginPage`: where a signed-out user lands when a client * starts `/api/auth/oauth2/authorize`. @@ -27,21 +37,23 @@ const SIGNED_QUERY_PARAMS = new Set(['sig', 'exp', 'ba_iat', 'ba_param', 'ba_pl' * that can succeed. */ export const GET = withRouteHandler(async (request: NextRequest) => { - // Gated like the consent page: with the provider off, the authorize URL this - // builds is a JSON 404, so bouncing someone through signup to reach it would - // land them on a raw error body having just created an account. + /** Avoid sending a newly signed-in user to a disabled provider's JSON 404. */ if (!isOAuthProviderEnabled) { return NextResponse.redirect(new URL('/', request.nextUrl.origin), 302) } const params = new URLSearchParams(request.nextUrl.search) for (const name of SIGNED_QUERY_PARAMS) params.delete(name) + const requiresLogin = consumeInteractivePrompt(params) const authorizeUrl = `/api/auth/oauth2/authorize?${params.toString()}` - const destination = buildAuthCrossLink(isRegistrationDisabled ? '/login' : '/signup', { - callbackUrl: authorizeUrl, - isInviteFlow: false, - }) + const destination = buildAuthCrossLink( + isRegistrationDisabled || requiresLogin ? '/login' : '/signup', + { + callbackUrl: authorizeUrl, + isInviteFlow: false, + } + ) return NextResponse.redirect(new URL(destination, request.nextUrl.origin), 302) }) diff --git a/apps/sim/app/api/auth/[...all]/route.test.ts b/apps/sim/app/api/auth/[...all]/route.test.ts index bf1c298b030..442366fc375 100644 --- a/apps/sim/app/api/auth/[...all]/route.test.ts +++ b/apps/sim/app/api/auth/[...all]/route.test.ts @@ -307,6 +307,24 @@ describe('OAuth provider client endpoints', () => { ) }) + it.each(['.well-known/openid-configuration', 'oauth2/end-session', 'oauth2/userinfo'])( + 'does not expose the OIDC-only %s endpoint', + async (path) => { + const getResponse = await GET( + createMockRequest('GET', undefined, {}, `http://localhost:3000/api/auth/${path}`) + ) + const postResponse = await POST( + createMockRequest('POST', {}, {}, `http://localhost:3000/api/auth/${path}`) + ) + + expect(getResponse.status).toBe(404) + expect(postResponse.status).toBe(404) + expect(getResponse.headers.get('cache-control')).toBe('no-store') + expect(handlerMocks.betterAuthGET).not.toHaveBeenCalled() + expect(handlerMocks.betterAuthPOST).not.toHaveBeenCalled() + } + ) + /** * The plugin gates client creation on a session alone, so without this any * signed-in user could register a client with arbitrary redirect URIs and @@ -318,6 +336,7 @@ describe('OAuth provider client endpoints', () => { 'oauth2/delete-client', 'oauth2/client/rotate-secret', 'oauth2/register', + 'oauth2/introspect', 'oauth2/anything-a-future-version-adds', ])('refuses POST /%s without reaching Better Auth', async (path) => { const req = createMockRequest('POST', {}, {}, `http://localhost:3000/api/auth/${path}`) @@ -333,9 +352,7 @@ describe('OAuth provider client endpoints', () => { 'oauth2/consent', 'oauth2/continue', 'oauth2/revoke', - 'oauth2/introspect', 'oauth2/public-client-prelogin', - 'oauth2/userinfo', 'oauth2/callback/jira', ])('lets the protocol endpoint %s through', async (path) => { const req = createMockRequest('POST', {}, {}, `http://localhost:3000/api/auth/${path}`) @@ -345,7 +362,7 @@ describe('OAuth provider client endpoints', () => { expect(handlerMocks.betterAuthPOST).toHaveBeenCalledTimes(1) }) - it.each(['oauth2/token', 'oauth2/revoke', 'oauth2/introspect'])( + it.each(['oauth2/token', 'oauth2/revoke'])( 'rejects repeated form parameters on %s', async (path) => { const req = new NextRequest(`http://localhost:3000/api/auth/${path}`, { diff --git a/apps/sim/app/api/auth/[...all]/route.ts b/apps/sim/app/api/auth/[...all]/route.ts index 90f724e60ff..5c80def3a2a 100644 --- a/apps/sim/app/api/auth/[...all]/route.ts +++ b/apps/sim/app/api/auth/[...all]/route.ts @@ -16,6 +16,11 @@ export const dynamic = 'force-dynamic' const { GET: betterAuthGET, POST: betterAuthPOST } = toNextJsHandler(auth.handler) const SAFE_ORGANIZATION_POST_PATHS = new Set(['organization/check-slug', 'organization/set-active']) const OAUTH_CALLBACK_PATH_PREFIX = 'oauth2/callback/' +const UNSUPPORTED_OIDC_PATHS = new Set([ + '.well-known/openid-configuration', + 'oauth2/end-session', + 'oauth2/userinfo', +]) /** * SAML protocol endpoints the IdP posts to (`saml2/callback/:id`, @@ -34,12 +39,10 @@ const OAUTH_PROVIDER_PROTOCOL_POST_PATHS = new Set([ 'oauth2/consent', 'oauth2/continue', 'oauth2/revoke', - 'oauth2/introspect', - 'oauth2/userinfo', 'oauth2/public-client-prelogin', ]) -const OAUTH_FORM_POST_PATHS = new Set(['oauth2/token', 'oauth2/revoke', 'oauth2/introspect']) +const OAUTH_FORM_POST_PATHS = new Set(['oauth2/token', 'oauth2/revoke']) /** * Rejects ambiguous OAuth form requests before Better Auth parses them. @@ -158,8 +161,17 @@ function isBlockedOAuthProviderMutationPath(path: string): boolean { return !OAUTH_PROVIDER_PROTOCOL_POST_PATHS.has(path) } +/** Sim exposes OAuth API authorization, not an OpenID Connect identity provider. */ +function unsupportedOidcResponse(): NextResponse { + return NextResponse.json( + { error: 'OpenID Connect is not available.' }, + { status: 404, headers: { 'Cache-Control': 'no-store' } } + ) +} + export const GET = withRouteHandler(async (request: NextRequest) => { const path = getAuthPath(request) + if (UNSUPPORTED_OIDC_PATHS.has(path)) return unsupportedOidcResponse() const credentialGroupProviderId = getCredentialGroupCallbackProviderId(request, path) if (credentialGroupProviderId) { @@ -198,6 +210,7 @@ export const GET = withRouteHandler(async (request: NextRequest) => { export const POST = withRouteHandler(async (request: NextRequest) => { const path = getAuthPath(request) + if (UNSUPPORTED_OIDC_PATHS.has(path)) return unsupportedOidcResponse() const ambiguousOAuthForm = await rejectAmbiguousOAuthForm(request, path) if (ambiguousOAuthForm) return ambiguousOAuthForm diff --git a/apps/sim/app/api/auth/oauth2/authorize/route.test.ts b/apps/sim/app/api/auth/oauth2/authorize/route.test.ts index 18c3efc4dd3..801f0767dac 100644 --- a/apps/sim/app/api/auth/oauth2/authorize/route.test.ts +++ b/apps/sim/app/api/auth/oauth2/authorize/route.test.ts @@ -1,7 +1,14 @@ /** * @vitest-environment node */ -import { createMockRequest, resetEnvFlagsMock, setEnvFlags } from '@sim/testing' +import { + createMockRequest, + queueTableRows, + resetDbChainMock, + resetEnvFlagsMock, + schemaMock, + setEnvFlags, +} from '@sim/testing' import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' import { ForbiddenOperationError } from '@/lib/core/application/forbidden' import { InsufficientWorkspacePermissionsError } from '@/lib/core/application/workspace-authorization' @@ -79,6 +86,7 @@ function linkResponse(url = 'https://provider.example/authorize') { describe('OAuth2 authorize route', () => { beforeEach(() => { vi.clearAllMocks() + resetDbChainMock() setEnvFlags({ isOAuthProviderEnabled: true }) mocks.getBaseUrl.mockReturnValue(BASE_URL) mocks.getSession.mockResolvedValue({ @@ -108,6 +116,8 @@ describe('OAuth2 authorize route', () => { it('forwards a provider request without entering the connector flow', async () => { const providerRequest = request({ client_id: 'client-1', + response_type: 'code', + redirect_uri: 'https://client.example/callback', providerId: 'google-email', draftId: 'draft-1', }) @@ -130,6 +140,36 @@ describe('OAuth2 authorize route', () => { expect(mocks.betterAuthGET).not.toHaveBeenCalled() }) + it('keeps an OAuth request missing client_id out of the connector flow', async () => { + const response = await GET( + request({ response_type: 'code', redirect_uri: 'https://client.example/callback' }) + ) + + expect(response.status).toBe(400) + await expect(response.json()).resolves.toMatchObject({ error: 'invalid_request' }) + expect(mocks.getSession).not.toHaveBeenCalled() + expect(mocks.betterAuthGET).not.toHaveBeenCalled() + }) + + it.each(['scope', 'state', 'nonce', 'prompt'])( + 'does not let an isolated %s parameter enter the connector flow', + async (parameter) => { + const response = await GET( + request({ + providerId: 'google-email', + workspaceId: WORKSPACE_ID, + [parameter]: 'value', + }) + ) + + expect(response.status).toBe(400) + await expect(response.json()).resolves.toMatchObject({ error: 'invalid_request' }) + expect(mocks.getSession).not.toHaveBeenCalled() + expect(mocks.createConnection).not.toHaveBeenCalled() + expect(mocks.betterAuthGET).not.toHaveBeenCalled() + } + ) + it.each([ 'response_type', 'client_id', @@ -141,6 +181,7 @@ describe('OAuth2 authorize route', () => { 'code_challenge_method', 'nonce', 'prompt', + 'resource', ])('rejects a repeated OAuth provider %s before Better Auth', async (parameter) => { const url = new URL('/api/auth/oauth2/authorize', BASE_URL) url.searchParams.set('client_id', 'sim-cli') @@ -154,6 +195,97 @@ describe('OAuth2 authorize route', () => { expect(mocks.betterAuthGET).not.toHaveBeenCalled() }) + it.each([ + [{ code_challenge: 'a'.repeat(43) }, 'unpaired challenge'], + [{ code_challenge_method: 'S256' }, 'unpaired method'], + [{ code_challenge: 'a'.repeat(42), code_challenge_method: 'S256' }, 'malformed challenge'], + [{ code_challenge: 'a'.repeat(43), code_challenge_method: 'plain' }, 'unsupported method'], + ])('rejects %s PKCE parameters before Better Auth', async (parameters) => { + const response = await GET( + request({ + client_id: 'sim-cli', + response_type: 'code', + redirect_uri: 'https://client.example/callback', + ...parameters, + }) + ) + + expect(response.status).toBe(400) + await expect(response.json()).resolves.toMatchObject({ error: 'invalid_request' }) + expect(mocks.betterAuthGET).not.toHaveBeenCalled() + }) + + it('accepts a canonical S256 challenge and rejects unsupported resource audiences', async () => { + const acceptedRequest = request({ + client_id: 'sim-cli', + response_type: 'code', + redirect_uri: 'https://client.example/callback', + code_challenge: 'a'.repeat(43), + code_challenge_method: 'S256', + }) + const accepted = await GET(acceptedRequest) + const resource = await GET( + request({ + client_id: 'sim-cli', + response_type: 'code', + redirect_uri: 'https://client.example/callback', + resource: 'https://api.example.test', + }) + ) + + expect(accepted.status).toBe(302) + expect(mocks.betterAuthGET).toHaveBeenCalledWith(acceptedRequest) + expect(resource.status).toBe(400) + await expect(resource.json()).resolves.toMatchObject({ error: 'invalid_request' }) + }) + + it('redirects a malformed request only to its registered callback with state and issuer', async () => { + queueTableRows(schemaMock.oauthClient, [ + { disabled: false, redirectUris: ['http://127.0.0.1/callback'] }, + ]) + + const response = await GET( + request({ + client_id: 'sim-cli', + response_type: 'code', + redirect_uri: 'http://127.0.0.1:43123/callback', + state: 'state-1', + code_challenge: 'too-short', + code_challenge_method: 'S256', + }) + ) + const location = new URL(response.headers.get('location') ?? '') + + expect(response.status).toBe(302) + expect(response.headers.get('cache-control')).toBe('no-store') + expect(location.origin).toBe('http://127.0.0.1:43123') + expect(location.searchParams.get('error')).toBe('invalid_request') + expect(location.searchParams.get('state')).toBe('state-1') + expect(location.searchParams.get('iss')).toBe(`${BASE_URL}/api/auth`) + expect(mocks.betterAuthGET).not.toHaveBeenCalled() + }) + + it('returns the authorization-specific error code to a registered callback', async () => { + queueTableRows(schemaMock.oauthClient, [ + { disabled: false, redirectUris: ['https://client.example/callback'] }, + ]) + + const response = await GET( + request({ + client_id: 'client-1', + response_type: 'token', + redirect_uri: 'https://client.example/callback', + state: 'state-1', + }) + ) + const location = new URL(response.headers.get('location') ?? '') + + expect(response.status).toBe(302) + expect(location.searchParams.get('error')).toBe('unsupported_response_type') + expect(location.searchParams.get('state')).toBe('state-1') + expect(mocks.betterAuthGET).not.toHaveBeenCalled() + }) + it('creates a canonical application draft for a legacy connect URL', async () => { const response = await GET(request({ providerId: 'google-email', workspaceId: WORKSPACE_ID })) diff --git a/apps/sim/app/api/auth/oauth2/authorize/route.ts b/apps/sim/app/api/auth/oauth2/authorize/route.ts index 2b7b56fda60..b479db0c044 100644 --- a/apps/sim/app/api/auth/oauth2/authorize/route.ts +++ b/apps/sim/app/api/auth/oauth2/authorize/route.ts @@ -4,6 +4,8 @@ import { type NextRequest, NextResponse } from 'next/server' import { authorizeOAuth2Contract } from '@/lib/api/contracts/oauth-connections' import { parseRequest } from '@/lib/api/server' import { auth, getSession } from '@/lib/auth/auth' +import { oauthAuthorizationErrorResponse } from '@/lib/auth/oauth-authorization-error' +import { validateOAuthPkceAuthorizationRequest } from '@/lib/auth/oauth-protocol-request' import { ForbiddenOperationError } from '@/lib/core/application/forbidden' import { requireConfiguredOAuthClient } from '@/lib/core/config/env-capabilities.server' import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' @@ -33,19 +35,14 @@ const OAUTH_AUTHORIZE_PARAMETERS = new Set([ 'code_challenge_method', 'nonce', 'prompt', + 'resource', ]) -/** OAuth authorization parameters are single-valued. */ -function rejectRepeatedOAuthAuthorizeParameter(request: NextRequest): NextResponse | null { +/** Returns the first ambiguous OAuth authorization parameter. */ +function repeatedOAuthAuthorizeParameter(request: NextRequest): string | null { for (const name of OAUTH_AUTHORIZE_PARAMETERS) { if (request.nextUrl.searchParams.getAll(name).length <= 1) continue - return NextResponse.json( - { - error: 'invalid_request', - error_description: `OAuth parameter ${name} appears more than once.`, - }, - { status: 400, headers: { 'Cache-Control': 'no-store' } } - ) + return name } return null } @@ -55,14 +52,15 @@ function rejectRepeatedOAuthAuthorizeParameter(request: NextRequest): NextRespon * authorize request — rather than a user linking an external account. * * This route sits on the same path Better Auth mounts the provider's authorize - * endpoint, so the catch-all never sees it. A `client_id` is the unambiguous - * provider discriminator: connector links never send it, and extra connector - * parameters on a provider request must not reroute signed-in users into the - * credential-linking flow. Whether the id is registered is the plugin's - * decision. + * endpoint, so the catch-all never sees it. Connector links use only the + * contract's draft/provider/workspace fields; any provider-specific parameter + * keeps even a malformed OAuth request out of the credential-linking flow. */ function isOAuthProviderAuthorize(request: NextRequest): boolean { - return request.nextUrl.searchParams.has('client_id') + for (const name of OAUTH_AUTHORIZE_PARAMETERS) { + if (request.nextUrl.searchParams.has(name)) return true + } + return false } /** @@ -74,8 +72,62 @@ export const GET = withRouteHandler(async (request: NextRequest) => { if (!isOAuthProviderEnabled) { return NextResponse.json({ error: 'OAuth provider is not enabled' }, { status: 404 }) } - const repeatedParameter = rejectRepeatedOAuthAuthorizeParameter(request) - if (repeatedParameter) return repeatedParameter + const repeatedParameter = repeatedOAuthAuthorizeParameter(request) + if (repeatedParameter) { + return oauthAuthorizationErrorResponse( + request, + 'invalid_request', + `OAuth parameter ${repeatedParameter} appears more than once.` + ) + } + const params = request.nextUrl.searchParams + if (!params.has('client_id')) { + return oauthAuthorizationErrorResponse( + request, + 'invalid_request', + 'The client_id parameter is required.' + ) + } + if (!params.has('redirect_uri')) { + return oauthAuthorizationErrorResponse( + request, + 'invalid_request', + 'The redirect_uri parameter is required.' + ) + } + if (params.has('resource')) { + return oauthAuthorizationErrorResponse( + request, + 'invalid_request', + 'The resource parameter is not supported.' + ) + } + if (params.has('request_uri')) { + return oauthAuthorizationErrorResponse( + request, + 'invalid_request', + 'The request_uri parameter is not supported.' + ) + } + const responseType = params.get('response_type') + if (!responseType) { + return oauthAuthorizationErrorResponse( + request, + 'invalid_request', + 'The response_type parameter is required.' + ) + } + if (responseType !== 'code') { + return oauthAuthorizationErrorResponse( + request, + 'unsupported_response_type', + 'Only the code response type is supported.' + ) + } + const pkceError = validateOAuthPkceAuthorizationRequest(params) + if (pkceError) { + return oauthAuthorizationErrorResponse(request, 'invalid_request', pkceError) + } return betterAuthGET(request) } diff --git a/apps/sim/app/api/auth/oauth2/revoke/route.test.ts b/apps/sim/app/api/auth/oauth2/revoke/route.test.ts new file mode 100644 index 00000000000..ba8ffeee203 --- /dev/null +++ b/apps/sim/app/api/auth/oauth2/revoke/route.test.ts @@ -0,0 +1,77 @@ +/** + * @vitest-environment node + */ +import { NextRequest } from 'next/server' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + enabled: true, + rateLimit: vi.fn(async () => null), + revoke: vi.fn(), +})) + +vi.mock('@/lib/core/config/env-flags', () => ({ + get isOAuthProviderEnabled() { + return mocks.enabled + }, +})) +vi.mock('@/lib/core/rate-limiter', () => ({ enforceIpRateLimit: mocks.rateLimit })) +vi.mock('@/lib/auth/oauth-token-family', () => ({ revokeOAuthToken: mocks.revoke })) + +import { POST } from '@/app/api/auth/oauth2/revoke/route' + +function revokeRequest(body: string) { + return new NextRequest('http://localhost/api/auth/oauth2/revoke', { + method: 'POST', + body, + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + }) +} + +describe('OAuth revocation route', () => { + beforeEach(() => { + vi.clearAllMocks() + mocks.enabled = true + mocks.revoke.mockResolvedValue({ success: true, value: undefined }) + }) + + it('returns the empty RFC 7009 success response for known or unknown tokens', async () => { + const response = await POST( + revokeRequest('client_id=sim-cli&token=sim_ort_current&token_type_hint=not-a-real-hint') + ) + expect(response.status).toBe(200) + await expect(response.text()).resolves.toBe('') + expect(mocks.revoke).toHaveBeenCalledWith({ + credentials: { clientId: 'sim-cli', method: 'none' }, + token: 'sim_ort_current', + }) + }) + + it('returns a Basic challenge for Basic client-authentication failure', async () => { + mocks.revoke.mockResolvedValue({ + success: false, + error: 'invalid_client', + description: 'Client authentication failed.', + }) + const basic = Buffer.from('client:wrong').toString('base64') + const request = revokeRequest('token=sim_ort_current') + request.headers.set('authorization', `Basic ${basic}`) + const response = await POST(request) + expect(response.status).toBe(401) + expect(response.headers.get('www-authenticate')).toContain('Basic') + }) + + it('normalizes an unexpected revocation failure', async () => { + mocks.revoke.mockRejectedValueOnce(new Error('database details')) + + const response = await POST(revokeRequest('client_id=sim-cli&token=sim_ort_current')) + + expect(response.status).toBe(500) + expect(response.headers.get('cache-control')).toBe('no-store') + expect(response.headers.get('pragma')).toBe('no-cache') + await expect(response.json()).resolves.toEqual({ + error: 'server_error', + error_description: 'Revocation endpoint failed.', + }) + }) +}) diff --git a/apps/sim/app/api/auth/oauth2/revoke/route.ts b/apps/sim/app/api/auth/oauth2/revoke/route.ts new file mode 100644 index 00000000000..ab79ffcd72c --- /dev/null +++ b/apps/sim/app/api/auth/oauth2/revoke/route.ts @@ -0,0 +1,67 @@ +import { createLogger } from '@sim/logger' +import { toError } from '@sim/utils/errors' +import { type NextRequest, NextResponse } from 'next/server' +import { + oauthErrorResponse, + oauthProtocolErrorResponse, + oauthRevocationSuccessResponse, + parseOAuthFormRequest, +} from '@/lib/auth/oauth-protocol-request' +import { revokeOAuthToken } from '@/lib/auth/oauth-token-family' +import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' +import { enforceIpRateLimit, type TokenBucketConfig } from '@/lib/core/rate-limiter' +import { withRouteHandler } from '@/lib/core/utils/with-route-handler' + +export const dynamic = 'force-dynamic' + +const logger = createLogger('OAuthRevocationEndpoint') + +const REVOKE_RATE_LIMIT: TokenBucketConfig = { + maxTokens: 30, + refillRate: 30, + refillIntervalMs: 60_000, +} + +/** Revokes one opaque access token or the complete family named by a refresh token. */ +export const POST = withRouteHandler(async (request: NextRequest) => { + if (!isOAuthProviderEnabled) { + return NextResponse.json( + { error: 'OAuth provider is not enabled' }, + { status: 404, headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' } } + ) + } + + try { + const rateLimited = await enforceIpRateLimit( + 'oauth-provider-revoke', + request, + REVOKE_RATE_LIMIT + ) + if (rateLimited) { + rateLimited.headers.set('Cache-Control', 'no-store') + rateLimited.headers.set('Pragma', 'no-cache') + return rateLimited + } + const parsed = await parseOAuthFormRequest(request) + if (!parsed.success) return parsed.response + + if (!parsed.value.credentials) { + return oauthErrorResponse('invalid_client', 'Client authentication is required.') + } + const token = parsed.value.form.get('token') + if (!token) return oauthErrorResponse('invalid_request', 'Token is required.') + + const result = await revokeOAuthToken({ credentials: parsed.value.credentials, token }) + if (!result.success) { + return oauthProtocolErrorResponse( + result.error, + result.description, + parsed.value.credentials.method + ) + } + return oauthRevocationSuccessResponse() + } catch (error) { + logger.error('OAuth revocation endpoint failed', { error: toError(error) }) + return oauthErrorResponse('server_error', 'Revocation endpoint failed.', 500) + } +}) diff --git a/apps/sim/app/api/auth/oauth2/token/route.postgres.test.ts b/apps/sim/app/api/auth/oauth2/token/route.postgres.test.ts new file mode 100644 index 00000000000..193e7d79920 --- /dev/null +++ b/apps/sim/app/api/auth/oauth2/token/route.postgres.test.ts @@ -0,0 +1,346 @@ +/** + * @vitest-environment node + */ +import { randomBytes } from 'node:crypto' +import { NextRequest } from 'next/server' +import { describe, expect, it, vi } from 'vitest' + +vi.unmock('@sim/db') +vi.unmock('@sim/db/schema') +vi.unmock('drizzle-orm') +vi.unmock('@/lib/auth') + +const databaseUrl = process.env.OAUTH_TOKEN_FAMILY_TEST_DATABASE_URL + +interface TokenResponseBody { + access_token: string + refresh_token: string + scope: string +} + +describe.skipIf(!databaseUrl)('OAuth token route in PostgreSQL', () => { + it('issues, rotates, contains replay, and revokes a real Better Auth PKCE grant', async () => { + process.env.DATABASE_URL = databaseUrl + const authSecret = 'test-secret-that-is-at-least-32-chars-long' + process.env.BETTER_AUTH_SECRET = authSecret + + const [ + { db }, + schema, + { eq, inArray, like }, + { makeSignature }, + { auth }, + { POST: exchangeToken }, + { POST: revokeToken }, + tokenStore, + provider, + { requestUtilsMockFns }, + ] = await Promise.all([ + import('@sim/db'), + import('@sim/db/schema'), + import('drizzle-orm'), + import('better-auth/crypto'), + import('@/lib/auth'), + import('@/app/api/auth/oauth2/token/route'), + import('@/app/api/auth/oauth2/revoke/route'), + import('@/lib/auth/oauth-access-token'), + import('@/lib/auth/oauth-provider'), + import('@sim/testing/mocks/request.mock'), + ]) + + const testId = randomBytes(8).toString('hex') + const userId = `oauth-route-test-user-${testId}` + const sessionId = `oauth-route-test-session-${testId}` + const sessionToken = `oauth-route-test-session-token-${testId}` + const consentId = `oauth-route-test-consent-${testId}` + const email = `oauth-route-${testId}@example.com` + const clientIp = `192.0.2.${Number.parseInt(testId.slice(0, 2), 16) || 1}` + const baseUrl = 'https://test.sim.ai' + const redirectUri = `http://127.0.0.1:${40_000 + (Number.parseInt(testId.slice(0, 4), 16) % 20_000)}/callback` + const grantedScopes = ['offline_access', 'api:read', 'api:write'] + const issuedCodeHashes: string[] = [] + + const signature = await makeSignature(sessionToken, authSecret) + const sessionCookie = `__Secure-better-auth.session_token=${encodeURIComponent(`${sessionToken}.${signature}`)}` + + const createFormRequest = (path: string, form: URLSearchParams) => + new NextRequest(`${baseUrl}${path}`, { + method: 'POST', + body: form.toString(), + headers: { + 'content-type': 'application/x-www-form-urlencoded', + 'x-forwarded-for': clientIp, + }, + }) + + const issueAuthorizationCode = async (verifier: string): Promise => { + const challenge = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier)) + const authorizeUrl = new URL('/api/auth/oauth2/authorize', baseUrl) + authorizeUrl.searchParams.set('client_id', provider.SIM_CLI_CLIENT_ID) + authorizeUrl.searchParams.set('response_type', 'code') + authorizeUrl.searchParams.set('redirect_uri', redirectUri) + authorizeUrl.searchParams.set('scope', grantedScopes.join(' ')) + authorizeUrl.searchParams.set('code_challenge', Buffer.from(challenge).toString('base64url')) + authorizeUrl.searchParams.set('code_challenge_method', 'S256') + authorizeUrl.searchParams.set('state', `state-${testId}`) + + const response = await auth.handler( + new Request(authorizeUrl, { headers: { cookie: sessionCookie } }) + ) + expect(response.status).toBe(302) + const location = response.headers.get('location') + expect(location).toBeTruthy() + const code = new URL(location as string, baseUrl).searchParams.get('code') + expect(code, `Expected authorization code redirect, received ${location}`).toBeTruthy() + issuedCodeHashes.push(tokenStore.hashOAuthToken(code as string)) + const authorizationCodes = await db + .select({ identifier: schema.verification.identifier }) + .from(schema.verification) + .where(like(schema.verification.value, `%${userId}%`)) + expect(authorizationCodes).toHaveLength(1) + return code as string + } + + const exchangeAuthorizationCode = async (code: string, verifier: string) => { + const response = await exchangeToken( + createFormRequest( + '/api/auth/oauth2/token', + new URLSearchParams({ + grant_type: 'authorization_code', + client_id: provider.SIM_CLI_CLIENT_ID, + code, + code_verifier: verifier, + redirect_uri: redirectUri, + }) + ) + ) + expect(response.status).toBe(200) + return (await response.json()) as TokenResponseBody + } + + requestUtilsMockFns.mockGetClientIp.mockReturnValue(clientIp) + const now = new Date() + await db.insert(schema.user).values({ + id: userId, + name: 'OAuth route integration test', + email, + emailVerified: true, + createdAt: now, + updatedAt: now, + }) + const sessionExpiresAt = new Date(now.getTime() + 86_400_000) + await db.insert(schema.session).values({ + id: sessionId, + token: sessionToken, + userId, + expiresAt: sessionExpiresAt, + createdAt: now, + updatedAt: now, + }) + await db.insert(schema.oauthConsent).values({ + id: consentId, + clientId: provider.SIM_CLI_CLIENT_ID, + userId, + referenceId: null, + scopes: grantedScopes, + createdAt: now, + updatedAt: now, + }) + + try { + const firstVerifier = `${testId}-first-verifier-with-more-than-forty-three-characters` + const firstTokens = await exchangeAuthorizationCode( + await issueAuthorizationCode(firstVerifier), + firstVerifier + ) + const [sessionAfterAuthorization] = await db + .select({ expiresAt: schema.session.expiresAt }) + .from(schema.session) + .where(eq(schema.session.id, sessionId)) + expect(sessionAfterAuthorization?.expiresAt).toEqual(sessionExpiresAt) + expect( + await db + .select({ id: schema.verification.id }) + .from(schema.verification) + .where(like(schema.verification.value, `%${userId}%`)) + ).toHaveLength(0) + + expect(firstTokens.access_token).toMatch(/^sim_oat_/) + expect(firstTokens.refresh_token).toMatch(/^sim_ort_/) + expect(firstTokens.scope).toBe(grantedScopes.join(' ')) + + const firstAccessHash = tokenStore.hashOAuthToken( + firstTokens.access_token.slice(provider.OAUTH_ACCESS_TOKEN_PREFIX.length) + ) + const firstRefreshHash = tokenStore.hashOAuthToken( + firstTokens.refresh_token.slice(provider.OAUTH_REFRESH_TOKEN_PREFIX.length) + ) + const [firstRefresh] = await db + .select({ + id: schema.oauthRefreshToken.id, + token: schema.oauthRefreshToken.token, + familyId: schema.oauthRefreshToken.familyId, + generation: schema.oauthRefreshToken.generation, + scopes: schema.oauthRefreshToken.scopes, + }) + .from(schema.oauthRefreshToken) + .where(eq(schema.oauthRefreshToken.token, firstRefreshHash)) + const [firstAccess] = await db + .select({ + token: schema.oauthAccessToken.token, + refreshId: schema.oauthAccessToken.refreshId, + scopes: schema.oauthAccessToken.scopes, + }) + .from(schema.oauthAccessToken) + .where(eq(schema.oauthAccessToken.token, firstAccessHash)) + const [firstFamily] = await db + .select({ + id: schema.oauthTokenFamily.id, + consentId: schema.oauthTokenFamily.consentId, + currentGeneration: schema.oauthTokenFamily.currentGeneration, + }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, firstRefresh?.familyId ?? 'missing')) + + expect(firstRefresh).toMatchObject({ + token: firstRefreshHash, + generation: 0, + scopes: grantedScopes, + }) + expect(firstRefresh?.token).not.toBe(firstTokens.refresh_token) + expect(firstAccess).toEqual({ + token: firstAccessHash, + refreshId: firstRefresh?.id, + scopes: grantedScopes, + }) + expect(firstAccess?.token).not.toBe(firstTokens.access_token) + expect(firstFamily).toEqual({ + id: firstRefresh?.id, + consentId, + currentGeneration: 0, + }) + + const narrowedRefresh = await exchangeToken( + createFormRequest( + '/api/auth/oauth2/token', + new URLSearchParams({ + grant_type: 'refresh_token', + client_id: provider.SIM_CLI_CLIENT_ID, + refresh_token: firstTokens.refresh_token, + scope: 'offline_access api:read', + }) + ) + ) + expect(narrowedRefresh.status).toBe(200) + const narrowedTokens = (await narrowedRefresh.json()) as TokenResponseBody + expect(narrowedTokens.scope).toBe('offline_access api:read') + + const nextRefreshHash = tokenStore.hashOAuthToken( + narrowedTokens.refresh_token.slice(provider.OAUTH_REFRESH_TOKEN_PREFIX.length) + ) + const nextAccessHash = tokenStore.hashOAuthToken( + narrowedTokens.access_token.slice(provider.OAUTH_ACCESS_TOKEN_PREFIX.length) + ) + const [nextRefresh] = await db + .select({ + id: schema.oauthRefreshToken.id, + familyId: schema.oauthRefreshToken.familyId, + generation: schema.oauthRefreshToken.generation, + scopes: schema.oauthRefreshToken.scopes, + }) + .from(schema.oauthRefreshToken) + .where(eq(schema.oauthRefreshToken.token, nextRefreshHash)) + const [nextAccess] = await db + .select({ + refreshId: schema.oauthAccessToken.refreshId, + scopes: schema.oauthAccessToken.scopes, + }) + .from(schema.oauthAccessToken) + .where(eq(schema.oauthAccessToken.token, nextAccessHash)) + + expect(nextRefresh).toMatchObject({ + familyId: firstRefresh?.id, + generation: 1, + scopes: grantedScopes, + }) + expect(nextAccess).toEqual({ + refreshId: nextRefresh?.id, + scopes: ['offline_access', 'api:read'], + }) + + const replay = await exchangeToken( + createFormRequest( + '/api/auth/oauth2/token', + new URLSearchParams({ + grant_type: 'refresh_token', + client_id: provider.SIM_CLI_CLIENT_ID, + refresh_token: firstTokens.refresh_token, + }) + ) + ) + expect(replay.status).toBe(400) + await expect(replay.json()).resolves.toMatchObject({ error: 'invalid_grant' }) + expect( + await db + .select({ id: schema.oauthTokenFamily.id }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, firstRefresh?.id ?? 'missing')) + ).toHaveLength(0) + + const secondVerifier = `${testId}-second-verifier-with-more-than-forty-three-characters` + const secondTokens = await exchangeAuthorizationCode( + await issueAuthorizationCode(secondVerifier), + secondVerifier + ) + expect( + await db + .select({ id: schema.verification.id }) + .from(schema.verification) + .where(like(schema.verification.value, `%${userId}%`)) + ).toHaveLength(0) + const secondRefreshHash = tokenStore.hashOAuthToken( + secondTokens.refresh_token.slice(provider.OAUTH_REFRESH_TOKEN_PREFIX.length) + ) + const [secondRefresh] = await db + .select({ familyId: schema.oauthRefreshToken.familyId }) + .from(schema.oauthRefreshToken) + .where(eq(schema.oauthRefreshToken.token, secondRefreshHash)) + + const revoked = await revokeToken( + createFormRequest( + '/api/auth/oauth2/revoke', + new URLSearchParams({ + client_id: provider.SIM_CLI_CLIENT_ID, + token: secondTokens.refresh_token, + }) + ) + ) + expect(revoked.status).toBe(200) + expect(await revoked.text()).toBe('') + expect( + await db + .select({ id: schema.oauthTokenFamily.id }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, secondRefresh?.familyId ?? 'missing')) + ).toHaveLength(0) + } finally { + if (issuedCodeHashes.length) { + await db + .delete(schema.verification) + .where(inArray(schema.verification.identifier, issuedCodeHashes)) + } + await db.delete(schema.verification).where(like(schema.verification.value, `%${userId}%`)) + await db.delete(schema.user).where(eq(schema.user.id, userId)) + await db + .delete(schema.rateLimitBucket) + .where( + inArray(schema.rateLimitBucket.key, [ + `route:oauth-provider-token:ip:${clientIp}`, + `route:oauth-provider-revoke:ip:${clientIp}`, + ]) + ) + requestUtilsMockFns.mockGetClientIp.mockReset() + requestUtilsMockFns.mockGetClientIp.mockReturnValue('127.0.0.1') + } + }, 60_000) +}) diff --git a/apps/sim/app/api/auth/oauth2/token/route.test.ts b/apps/sim/app/api/auth/oauth2/token/route.test.ts new file mode 100644 index 00000000000..f770be7b8a2 --- /dev/null +++ b/apps/sim/app/api/auth/oauth2/token/route.test.ts @@ -0,0 +1,358 @@ +/** + * @vitest-environment node + */ +import { NextRequest } from 'next/server' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + betterAuthPost: vi.fn(async () => new Response('delegated', { status: 201 })), + enabled: true, + rateLimit: vi.fn(async () => null), + rotate: vi.fn(), + validateClient: vi.fn(), +})) + +vi.mock('better-auth/next-js', () => ({ + toNextJsHandler: () => ({ POST: mocks.betterAuthPost }), +})) +vi.mock('@/lib/auth', () => ({ auth: { handler: vi.fn() } })) +vi.mock('@/lib/auth/oauth-provider-adapter-guard', () => ({ + withOAuthProviderIssuanceCompensation: (work: () => Promise) => work(), +})) +vi.mock('@/lib/core/config/env-flags', () => ({ + get isOAuthProviderEnabled() { + return mocks.enabled + }, +})) +vi.mock('@/lib/core/rate-limiter', () => ({ enforceIpRateLimit: mocks.rateLimit })) +vi.mock('@/lib/auth/oauth-token-family', () => ({ + rotateOAuthRefreshToken: mocks.rotate, + validateOAuthClientCredentials: mocks.validateClient, +})) + +import { POST } from '@/app/api/auth/oauth2/token/route' + +function tokenRequest(body: string) { + return new NextRequest('http://localhost/api/auth/oauth2/token', { + method: 'POST', + body, + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + }) +} + +describe('OAuth token route', () => { + beforeEach(() => { + vi.clearAllMocks() + mocks.enabled = true + mocks.rotate.mockResolvedValue({ + success: true, + value: { + accessToken: 'sim_oat_next', + refreshToken: 'sim_ort_next', + expiresIn: 3600, + expiresAt: 2_000_000_000, + scope: 'offline_access api:read', + }, + }) + mocks.validateClient.mockResolvedValue({ success: true, value: undefined }) + }) + + it('delegates authorization-code exchange through an equivalent rebuilt request', async () => { + const response = await POST( + tokenRequest('grant_type=authorization_code&client_id=sim-cli&code=code') + ) + expect(response.status).toBe(201) + expect(mocks.betterAuthPost).toHaveBeenCalledOnce() + expect(mocks.validateClient).toHaveBeenCalledWith({ clientId: 'sim-cli', method: 'none' }) + const delegated = mocks.betterAuthPost.mock.calls[0]?.[0] + await expect(delegated.text()).resolves.toContain('grant_type=authorization_code') + expect(mocks.rateLimit).toHaveBeenCalledOnce() + }) + + it('rejects an authorization-code client using the wrong registered auth method', async () => { + mocks.validateClient.mockResolvedValue({ + success: false, + error: 'invalid_client', + description: 'Client authentication method does not match registration.', + }) + const basic = Buffer.from('client:secret').toString('base64') + const request = tokenRequest('grant_type=authorization_code&code=code') + request.headers.set('authorization', `Basic ${basic}`) + + const response = await POST(request) + + expect(response.status).toBe(401) + expect(response.headers.get('www-authenticate')).toContain('Basic') + expect(mocks.betterAuthPost).not.toHaveBeenCalled() + }) + + it('passes decoded Basic credentials through Better Auth body authentication', async () => { + const request = tokenRequest('grant_type=authorization_code&code=code') + request.headers.set('authorization', `basic ${Buffer.from('client:secret').toString('base64')}`) + + await POST(request) + + const delegated = mocks.betterAuthPost.mock.calls[0]?.[0] + expect(delegated.headers.has('authorization')).toBe(false) + const delegatedForm = new URLSearchParams(await delegated.text()) + expect(delegatedForm.get('client_id')).toBe('client') + expect(delegatedForm.get('client_secret')).toBe('secret') + }) + + it('normalizes delegated invalid-code and PKCE failures', async () => { + mocks.betterAuthPost.mockResolvedValueOnce( + Response.json({ error: 'invalid_grant', error_description: 'invalid code' }, { status: 401 }) + ) + const invalidCode = await POST( + tokenRequest('grant_type=authorization_code&client_id=sim-cli&code=bad') + ) + expect(invalidCode.status).toBe(400) + expect(invalidCode.headers.get('cache-control')).toBe('no-store') + expect(invalidCode.headers.get('pragma')).toBe('no-cache') + + mocks.betterAuthPost.mockResolvedValueOnce( + Response.json( + { error: 'invalid_request', error_description: 'code verification failed' }, + { status: 401 } + ) + ) + const invalidVerifier = await POST( + tokenRequest('grant_type=authorization_code&client_id=sim-cli&code=bad') + ) + expect(invalidVerifier.status).toBe(400) + await expect(invalidVerifier.json()).resolves.toMatchObject({ error: 'invalid_grant' }) + }) + + it.each([ + ['invalid_request', 'Either code_verifier or client_secret is required'], + ['invalid_request', 'PKCE is required for this client'], + ['invalid_request', 'redirect_uri mismatch'], + ['invalid_user', 'missing user, user may have been deleted'], + ['invalid_user', 'session no longer exists'], + ])('normalizes a consumed code failure from %s to invalid_grant', async (error, description) => { + mocks.betterAuthPost.mockResolvedValueOnce( + Response.json({ error, error_description: description }, { status: 401 }) + ) + + const response = await POST( + tokenRequest('grant_type=authorization_code&client_id=sim-cli&code=code') + ) + + expect(response.status).toBe(400) + expect(response.headers.has('www-authenticate')).toBe(false) + await expect(response.json()).resolves.toEqual({ + error: 'invalid_grant', + error_description: description, + }) + }) + + it.each(['short', `${'a'.repeat(42)}=`, 'a'.repeat(129)])( + 'rejects a malformed PKCE verifier before a code can be consumed', + async (codeVerifier) => { + const response = await POST( + tokenRequest( + `grant_type=authorization_code&client_id=sim-cli&code=code&code_verifier=${encodeURIComponent(codeVerifier)}` + ) + ) + + expect(response.status).toBe(400) + expect(response.headers.get('cache-control')).toBe('no-store') + await expect(response.json()).resolves.toEqual({ + error: 'invalid_grant', + error_description: 'Code verifier is invalid.', + }) + expect(mocks.validateClient).not.toHaveBeenCalled() + expect(mocks.betterAuthPost).not.toHaveBeenCalled() + } + ) + + it('does not challenge an authenticated client for a code bound to another client', async () => { + mocks.betterAuthPost.mockResolvedValueOnce( + Response.json( + { error: 'invalid_client', error_description: 'invalid client_id' }, + { status: 401, headers: { 'WWW-Authenticate': 'Basic realm="oauth2"' } } + ) + ) + const request = tokenRequest('grant_type=authorization_code&code=code') + request.headers.set('authorization', `Basic ${Buffer.from('client:secret').toString('base64')}`) + + const response = await POST(request) + + expect(response.status).toBe(400) + expect(response.headers.has('www-authenticate')).toBe(false) + await expect(response.json()).resolves.toMatchObject({ error: 'invalid_grant' }) + }) + + it('returns a bounded OAuth error when delegated issuance fails without JSON', async () => { + mocks.betterAuthPost.mockResolvedValueOnce(new Response(null, { status: 500 })) + + const response = await POST( + tokenRequest('grant_type=authorization_code&client_id=sim-cli&code=code') + ) + + expect(response.status).toBe(500) + await expect(response.json()).resolves.toEqual({ + error: 'server_error', + error_description: 'Token exchange failed.', + }) + }) + + it('normalizes Better Auth validation errors without exposing its internal shape', async () => { + mocks.betterAuthPost.mockResolvedValueOnce( + Response.json( + { + message: '[body.redirect_uri] Invalid URL; received not-a-url', + code: 'VALIDATION_ERROR', + }, + { status: 400 } + ) + ) + + const response = await POST( + tokenRequest( + 'grant_type=authorization_code&client_id=sim-cli&code=code&redirect_uri=not-a-url' + ) + ) + + expect(response.status).toBe(400) + await expect(response.json()).resolves.toEqual({ + error: 'invalid_request', + error_description: 'Token request is invalid.', + }) + }) + + it('redacts delegated JSON server failures to a bounded OAuth error', async () => { + mocks.betterAuthPost.mockResolvedValueOnce( + Response.json( + { message: 'internal database details', stack: 'secret stack' }, + { status: 503 } + ) + ) + + const response = await POST( + tokenRequest('grant_type=authorization_code&client_id=sim-cli&code=code') + ) + + expect(response.status).toBe(503) + await expect(response.json()).resolves.toEqual({ + error: 'server_error', + error_description: 'Token exchange failed.', + }) + }) + + it('rotates refresh tokens and preserves the Better Auth response shape', async () => { + const response = await POST( + tokenRequest( + 'grant_type=refresh_token&client_id=sim-cli&refresh_token=sim_ort_current&scope=api%3Aread' + ) + ) + expect(response.status).toBe(200) + expect(response.headers.get('cache-control')).toBe('no-store') + await expect(response.json()).resolves.toEqual({ + access_token: 'sim_oat_next', + expires_in: 3600, + expires_at: 2_000_000_000, + token_type: 'Bearer', + refresh_token: 'sim_ort_next', + scope: 'offline_access api:read', + }) + expect(mocks.rotate).toHaveBeenCalledWith({ + credentials: { clientId: 'sim-cli', method: 'none' }, + refreshToken: 'sim_ort_current', + requestedScopes: ['api:read'], + }) + }) + + it('renders protocol failures only after the rotation service returns', async () => { + mocks.rotate.mockResolvedValue({ + success: false, + error: 'invalid_grant', + description: 'Refresh token is invalid or has already been used.', + }) + const response = await POST( + tokenRequest('grant_type=refresh_token&client_id=sim-cli&refresh_token=sim_ort_old') + ) + expect(response.status).toBe(400) + await expect(response.json()).resolves.toMatchObject({ error: 'invalid_grant' }) + }) + + it('distinguishes a missing grant type from an unsupported grant type', async () => { + const missing = await POST(tokenRequest('client_id=sim-cli')) + expect(missing.status).toBe(400) + await expect(missing.json()).resolves.toMatchObject({ error: 'invalid_request' }) + + const unsupported = await POST(tokenRequest('grant_type=client_credentials&client_id=sim-cli')) + expect(unsupported.status).toBe(400) + await expect(unsupported.json()).resolves.toMatchObject({ error: 'unsupported_grant_type' }) + expect(mocks.betterAuthPost).not.toHaveBeenCalled() + expect(mocks.rotate).not.toHaveBeenCalled() + }) + + it('reports a missing refresh token as an invalid request', async () => { + const response = await POST(tokenRequest('grant_type=refresh_token&client_id=sim-cli')) + expect(response.status).toBe(400) + await expect(response.json()).resolves.toMatchObject({ error: 'invalid_request' }) + expect(mocks.rotate).not.toHaveBeenCalled() + }) + + it.each(['authorization_code', 'refresh_token'])( + 'rejects an unenforceable resource audience for %s grants', + async (grantType) => { + const response = await POST( + tokenRequest( + `grant_type=${grantType}&client_id=sim-cli&code=code&refresh_token=sim_ort_current&resource=https%3A%2F%2Fapi.example` + ) + ) + + expect(response.status).toBe(400) + await expect(response.json()).resolves.toMatchObject({ error: 'invalid_request' }) + expect(mocks.betterAuthPost).not.toHaveBeenCalled() + expect(mocks.rotate).not.toHaveBeenCalled() + } + ) + + it('applies rate admission before parsing and prevents caching a refusal', async () => { + mocks.rateLimit.mockResolvedValueOnce(new Response('limited', { status: 429 })) + const request = new NextRequest('http://localhost/api/auth/oauth2/token', { + method: 'POST', + body: '{}', + headers: { 'content-type': 'application/json' }, + }) + + const response = await POST(request) + + expect(response.status).toBe(429) + expect(response.headers.get('cache-control')).toBe('no-store') + expect(response.headers.get('pragma')).toBe('no-cache') + }) + + it.each([ + ['authorization code exchange', () => mocks.betterAuthPost.mockRejectedValueOnce(new Error())], + ['refresh rotation', () => mocks.rotate.mockRejectedValueOnce(new Error())], + ])('normalizes an unexpected %s failure', async (grant, fail) => { + fail() + const body = + grant === 'authorization code exchange' + ? 'grant_type=authorization_code&client_id=sim-cli&code=code' + : 'grant_type=refresh_token&client_id=sim-cli&refresh_token=sim_ort_current' + + const response = await POST(tokenRequest(body)) + + expect(response.status).toBe(500) + expect(response.headers.get('cache-control')).toBe('no-store') + expect(response.headers.get('pragma')).toBe('no-cache') + await expect(response.json()).resolves.toEqual({ + error: 'server_error', + error_description: 'Token endpoint failed.', + }) + }) + + it('does not expose the custom endpoint while the provider is disabled', async () => { + mocks.enabled = false + const response = await POST( + tokenRequest('grant_type=refresh_token&client_id=sim-cli&refresh_token=sim_ort_old') + ) + expect(response.status).toBe(404) + expect(mocks.rotate).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/app/api/auth/oauth2/token/route.ts b/apps/sim/app/api/auth/oauth2/token/route.ts new file mode 100644 index 00000000000..03557898766 --- /dev/null +++ b/apps/sim/app/api/auth/oauth2/token/route.ts @@ -0,0 +1,123 @@ +import { createLogger } from '@sim/logger' +import { toError } from '@sim/utils/errors' +import { toNextJsHandler } from 'better-auth/next-js' +import { type NextRequest, NextResponse } from 'next/server' +import { auth } from '@/lib/auth' +import { + buildDelegatedOAuthRequest, + isValidOAuthCodeVerifier, + missingOAuthParameterResponse, + normalizeDelegatedOAuthTokenResponse, + oauthErrorResponse, + oauthProtocolErrorResponse, + parseOAuthFormRequest, + parseRequestedScopes, + unsupportedGrantResponse, +} from '@/lib/auth/oauth-protocol-request' +import { withOAuthProviderIssuanceCompensation } from '@/lib/auth/oauth-provider-adapter-guard' +import { + rotateOAuthRefreshToken, + validateOAuthClientCredentials, +} from '@/lib/auth/oauth-token-family' +import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' +import { enforceIpRateLimit, type TokenBucketConfig } from '@/lib/core/rate-limiter' +import { withRouteHandler } from '@/lib/core/utils/with-route-handler' + +export const dynamic = 'force-dynamic' + +const logger = createLogger('OAuthTokenEndpoint') +const { POST: betterAuthPOST } = toNextJsHandler(auth.handler) + +const TOKEN_RATE_LIMIT: TokenBucketConfig = { + maxTokens: 20, + refillRate: 20, + refillIntervalMs: 60_000, +} + +/** + * Delegates authorization-code exchange to Better Auth and owns refresh + * rotation, whose per-login replay containment requires one PostgreSQL + * transaction that the provider does not expose as a configuration hook. + */ +export const POST = withRouteHandler(async (request: NextRequest) => { + if (!isOAuthProviderEnabled) { + return NextResponse.json( + { error: 'OAuth provider is not enabled' }, + { status: 404, headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' } } + ) + } + + try { + const rateLimited = await enforceIpRateLimit('oauth-provider-token', request, TOKEN_RATE_LIMIT) + if (rateLimited) { + rateLimited.headers.set('Cache-Control', 'no-store') + rateLimited.headers.set('Pragma', 'no-cache') + return rateLimited + } + const parsed = await parseOAuthFormRequest(request) + if (!parsed.success) return parsed.response + const grantType = parsed.value.form.get('grant_type') + if (!grantType) return missingOAuthParameterResponse('grant_type') + if (grantType !== 'authorization_code' && grantType !== 'refresh_token') { + return unsupportedGrantResponse(grantType) + } + if (parsed.value.form.has('resource')) { + return oauthErrorResponse('invalid_request', 'The resource parameter is not supported.') + } + if (grantType === 'authorization_code') { + const codeVerifier = parsed.value.form.get('code_verifier') + if (codeVerifier !== null && !isValidOAuthCodeVerifier(codeVerifier)) { + return oauthErrorResponse('invalid_grant', 'Code verifier is invalid.') + } + if (!parsed.value.credentials) { + return oauthErrorResponse('invalid_client', 'Client authentication is required.') + } + const authenticated = await validateOAuthClientCredentials(parsed.value.credentials) + if (!authenticated.success) { + return oauthProtocolErrorResponse( + authenticated.error, + authenticated.description, + parsed.value.credentials.method + ) + } + const response = await withOAuthProviderIssuanceCompensation(() => + betterAuthPOST(buildDelegatedOAuthRequest(request, parsed.value)) + ) + return normalizeDelegatedOAuthTokenResponse(response, parsed.value.credentials.method) + } + + if (!parsed.value.credentials) { + return oauthErrorResponse('invalid_client', 'Client authentication is required.') + } + const refreshToken = parsed.value.form.get('refresh_token') + if (!refreshToken) return missingOAuthParameterResponse('refresh_token') + + const result = await rotateOAuthRefreshToken({ + credentials: parsed.value.credentials, + refreshToken, + requestedScopes: parseRequestedScopes(parsed.value.form), + }) + if (!result.success) { + return oauthProtocolErrorResponse( + result.error, + result.description, + parsed.value.credentials.method + ) + } + + return NextResponse.json( + { + access_token: result.value.accessToken, + expires_in: result.value.expiresIn, + expires_at: result.value.expiresAt, + token_type: 'Bearer', + refresh_token: result.value.refreshToken, + scope: result.value.scope, + }, + { headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' } } + ) + } catch (error) { + logger.error('OAuth token endpoint failed', { error: toError(error) }) + return oauthErrorResponse('server_error', 'Token endpoint failed.', 500) + } +}) diff --git a/apps/sim/app/api/v2/chat/route.test.ts b/apps/sim/app/api/v2/chat/route.test.ts index af7f28a3930..0e724a2d61d 100644 --- a/apps/sim/app/api/v2/chat/route.test.ts +++ b/apps/sim/app/api/v2/chat/route.test.ts @@ -273,7 +273,7 @@ describe('POST /api/v2/chat', () => { it('rejects a missing or invalid API key', async () => { mockAuthenticateV2ApiKey.mockRejectedValue( - new MockV2ApiKeyUnauthenticatedError('API key required') + new MockV2ApiKeyUnauthenticatedError('API key or OAuth access token required') ) const response = await callChat({ workspaceId: 'workspace-1', message: 'hi' }) @@ -337,8 +337,8 @@ describe('POST /api/v2/chat', () => { }) /** - * The route only ever runs for a personal API key, and `admitV2Request` never - * authorizes, so both halves of the funnel's personal-key policy have to be + * The route only runs for a user-held credential, and `admitV2Request` never + * authorizes, so both halves of the funnel's credential policy have to be * repeated here. The workspace column is the first half. */ it('answers 403 when the workspace has switched personal API keys off', async () => { diff --git a/apps/sim/app/api/v2/chat/route.ts b/apps/sim/app/api/v2/chat/route.ts index 35a5296ff60..f4f09bbaaaa 100644 --- a/apps/sim/app/api/v2/chat/route.ts +++ b/apps/sim/app/api/v2/chat/route.ts @@ -171,8 +171,8 @@ function buildChatResultPayload( * POST /api/v2/chat * * One conversational turn against the same headless execution path as the Sim - * Chat block (`/api/mothership/execute`), authenticated with a personal API key - * instead of the executor's internal JWT. JSON callers get one final response; + * Chat block (`/api/mothership/execute`), authenticated with an OAuth access + * token or personal API key instead of the executor's internal JWT. JSON callers get one final response; * NDJSON callers (`Accept: application/x-ndjson`) get heartbeats and incremental * `chunk` events followed by a `final` event, so long-running turns do not look * idle to intermediaries. @@ -212,11 +212,11 @@ export const POST = withRouteHandler( const userPermission = workspaceAccess.permission /** - * permission-group-enforced: personal_api_key.use — this route only ever - * runs for a personal API key, and `admitV2Request` authenticates one - * without authorizing it, so the funnel's personal-key policy has to be - * repeated here or the same key `authorizeWorkspaceOperation` refuses - * still starts a chat turn. + * permission-group-enforced: personal_api_key.use — this route runs for a + * user-held credential, and `admitV2Request` authenticates one without + * authorizing it, so the funnel's user-credential policy has to be repeated + * here or the same principal `authorizeWorkspaceOperation` refuses still + * starts a chat turn. * * Both halves, because they combine with AND: the workspace column is the * coarse switch every workspace has, and the group key narrows it further diff --git a/apps/sim/app/api/v2/files/[fileId]/share/route.test.ts b/apps/sim/app/api/v2/files/[fileId]/share/route.test.ts index 68a57cab85b..f7023b562a6 100644 --- a/apps/sim/app/api/v2/files/[fileId]/share/route.test.ts +++ b/apps/sim/app/api/v2/files/[fileId]/share/route.test.ts @@ -104,7 +104,7 @@ describe('GET /api/v2/files/[fileId]/share', () => { it('authenticates and rate-limits before parsing or executing', async () => { v2RouteMocks.authenticate.mockRejectedValueOnce( - new MockV2ApiKeyUnauthenticatedError('API key required') + new MockV2ApiKeyUnauthenticatedError('API key or OAuth access token required') ) const response = await callGet() diff --git a/apps/sim/app/api/v2/knowledge/search/route.ts b/apps/sim/app/api/v2/knowledge/search/route.ts index 999bb8c599e..2e666f359df 100644 --- a/apps/sim/app/api/v2/knowledge/search/route.ts +++ b/apps/sim/app/api/v2/knowledge/search/route.ts @@ -14,9 +14,7 @@ export const V2_KNOWLEDGE_SEARCH_MAX_BODY_BYTES = 2 * 1024 * 1024 export const POST = defineV2JsonRoute({ contract: v2SearchKnowledgeContract, auth: v2ApiKeyAuth, - // A search whose filters do not fit a query string; it changes no resource. - // It does meter usage, which is a write to the usage log rather than to - // anything a read-only grant is protecting. + /** Search is resource-read-only even though metering writes a usage record. */ readOnly: true, operation: knowledgeOperations.search, rateLimit: v2RateLimits.publicApi, diff --git a/apps/sim/app/api/v2/lib/response.test.ts b/apps/sim/app/api/v2/lib/response.test.ts index 9c363f972ab..ad892f4974e 100644 --- a/apps/sim/app/api/v2/lib/response.test.ts +++ b/apps/sim/app/api/v2/lib/response.test.ts @@ -90,7 +90,9 @@ describe('v2 401 authentication challenge', () => { const EXPECTED_CHALLENGE = 'SimApiKey realm="Sim API", header="x-api-key", Bearer realm="Sim API"' const challenge = () => - v2Error('UNAUTHORIZED', 'API key required').headers.get('WWW-Authenticate') + v2Error('UNAUTHORIZED', 'API key or OAuth access token required').headers.get( + 'WWW-Authenticate' + ) it('sends a challenge on 401', () => { const response = v2Error('UNAUTHORIZED', 'Invalid API key') diff --git a/apps/sim/app/api/v2/meta/route.test.ts b/apps/sim/app/api/v2/meta/route.test.ts index 56ce546cdbf..aa6b7f2f353 100644 --- a/apps/sim/app/api/v2/meta/route.test.ts +++ b/apps/sim/app/api/v2/meta/route.test.ts @@ -81,7 +81,7 @@ describe('GET /api/v2/meta', () => { it('requires authentication', async () => { v2RouteMocks.authenticate.mockRejectedValue( - new MockV2ApiKeyUnauthenticatedError('API key required') + new MockV2ApiKeyUnauthenticatedError('API key or OAuth access token required') ) const response = await GET(new NextRequest('http://localhost:3000/api/v2/meta')) diff --git a/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts b/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts index b3ae5d5c9fa..bcc25c9c561 100644 --- a/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts +++ b/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts @@ -24,7 +24,7 @@ export const revalidate = 0 export const POST = defineV2JsonRoute({ contract: v2QueryRowsCountContract, operation: tableOperations.queryRows, - // A query whose filters do not fit a query string; it reads and never writes. + /** POST carries structured filters but performs a read-only query. */ readOnly: true, auth: v2ApiKeyAuth, rateLimit: v2RateLimits.publicApi, diff --git a/apps/sim/app/api/v2/tables/[tableId]/query/route.ts b/apps/sim/app/api/v2/tables/[tableId]/query/route.ts index 8cabae28046..28790d23d2a 100644 --- a/apps/sim/app/api/v2/tables/[tableId]/query/route.ts +++ b/apps/sim/app/api/v2/tables/[tableId]/query/route.ts @@ -27,7 +27,7 @@ function queryRowCursorScope(tableId: string): string { export const POST = defineV2JsonRoute({ contract: v2QueryRowsContract, operation: tableOperations.queryRows, - // A query whose filters do not fit a query string; it reads and never writes. + /** POST carries structured filters but performs a read-only query. */ readOnly: true, auth: v2ApiKeyAuth, rateLimit: v2RateLimits.publicApi, diff --git a/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts b/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts index ec089a47cb0..a44e4a8e10c 100644 --- a/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts +++ b/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts @@ -11,7 +11,7 @@ export const revalidate = 0 export const POST = defineV2JsonRoute({ contract: v2SearchTableRowsContract, operation: tableOperations.searchRows, - // A search whose filters do not fit a query string; it reads and never writes. + /** POST carries structured filters but performs a read-only search. */ readOnly: true, auth: v2ApiKeyAuth, rateLimit: v2RateLimits.publicApi, diff --git a/apps/sim/app/api/v2/workflows/[workflowId]/execute/route.test.ts b/apps/sim/app/api/v2/workflows/[workflowId]/execute/route.test.ts index 6449e170f57..e1890d05097 100644 --- a/apps/sim/app/api/v2/workflows/[workflowId]/execute/route.test.ts +++ b/apps/sim/app/api/v2/workflows/[workflowId]/execute/route.test.ts @@ -218,6 +218,14 @@ function callPublicExecute(body: Record, headers: Record) { + const req = createMockRequest('POST', body, { + 'Content-Type': 'application/json', + Authorization: 'Bearer sim_oat_token', + }) + return POST(req, { params: Promise.resolve({ workflowId: 'workflow-1' }) }) +} + /** * Queues the two reads the anonymous public path makes, in order: the workflow's * public-API eligibility, then the workspace billing account it runs as. Keeping @@ -468,6 +476,32 @@ describe('POST /api/v2/workflows/[workflowId]/execute', () => { expect(mockExecuteWorkflowCore).not.toHaveBeenCalled() }) + it('dispatches an OAuth manual trigger run through the same manual operation', async () => { + mockAuthenticateV2ApiKey.mockResolvedValue({ + principal: { + kind: 'oauth_access_token', + userId: 'actor-1', + clientId: 'sim-cli', + tokenId: 'token-1', + scopes: ['api:write'], + expiresAt: new Date('2099-01-01T00:00:00.000Z'), + }, + rateLimitSubjectIds: ['oauth-token:token-1', 'user:actor-1'], + rateLimitSubscription: null, + keyType: 'oauth_access_token', + keyExpiresAt: new Date('2099-01-01T00:00:00.000Z'), + }) + + const response = await callOAuthExecute({ run: { source: 'manual' } }) + + expect(response.status).toBe(200) + expect(mockExecuteManualTrigger).toHaveBeenCalledWith( + expect.objectContaining({ + principal: expect.objectContaining({ kind: 'oauth_access_token', clientId: 'sim-cli' }), + }) + ) + }) + it('returns the typed workspace-key denial for manual execution', async () => { mockExecuteManualTrigger.mockRejectedValueOnce(new WorkspaceApiKeyAuthorizationError()) @@ -826,7 +860,7 @@ describe('POST /api/v2/workflows/[workflowId]/execute', () => { expect(response.status).toBe(401) expect((await response.json()).error.message).toBe( - 'Manual execution requires a personal API key' + 'Manual execution requires an OAuth access token or personal API key' ) expect(mockExecuteManualTrigger).not.toHaveBeenCalled() }) diff --git a/apps/sim/app/api/v2/workflows/[workflowId]/execute/route.ts b/apps/sim/app/api/v2/workflows/[workflowId]/execute/route.ts index b3271d894a1..ad737bbe6dc 100644 --- a/apps/sim/app/api/v2/workflows/[workflowId]/execute/route.ts +++ b/apps/sim/app/api/v2/workflows/[workflowId]/execute/route.ts @@ -230,7 +230,10 @@ export const POST = withRouteHandler( const manualRun = body.run?.source === 'manual' ? body.run : undefined if (manualRun && !apiKeyPrincipal) { - return v2Error('UNAUTHORIZED', 'Manual execution requires a personal API key') + return v2Error( + 'UNAUTHORIZED', + 'Manual execution requires an OAuth access token or personal API key' + ) } if (manualRun && body.async) { return v2Error('BAD_REQUEST', 'Manual execution does not support async mode') @@ -244,7 +247,7 @@ export const POST = withRouteHandler( } if (body.async && isPublicApiAccess) { - return v2Error('BAD_REQUEST', 'Async execution requires an API key') + return v2Error('BAD_REQUEST', 'Async execution requires an OAuth access token or API key') } if (body.async && body.stream) { return v2Error('BAD_REQUEST', 'async and stream cannot be combined') diff --git a/apps/sim/app/api/v2/workflows/[workflowId]/runs/[runId]/route.test.ts b/apps/sim/app/api/v2/workflows/[workflowId]/runs/[runId]/route.test.ts index c7c0db44799..bfd3758957a 100644 --- a/apps/sim/app/api/v2/workflows/[workflowId]/runs/[runId]/route.test.ts +++ b/apps/sim/app/api/v2/workflows/[workflowId]/runs/[runId]/route.test.ts @@ -336,7 +336,7 @@ describe('v2 run detail and cancel adapters', () => { it('rejects missing API keys before reading the run', async () => { v2RouteMocks.authenticate.mockRejectedValueOnce( - new MockV2ApiKeyUnauthenticatedError('API key required') + new MockV2ApiKeyUnauthenticatedError('API key or OAuth access token required') ) const response = await callStatus() diff --git a/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx b/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx index f4633bc429d..3d58a741dad 100644 --- a/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx +++ b/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx @@ -42,8 +42,7 @@ export function AuthorizedApps() { revoke.mutate(app.clientId, { onSuccess: () => toast.success(`Revoked ${app.name}`), onError: (error) => toast.error(getErrorMessage(error, 'Failed to revoke access')), - // Closed on settle rather than on click, so the modal's own pending - // state is what the person sees while a destructive action runs. + /** Keep the modal open so its pending state remains visible through the mutation. */ onSettled: () => setPendingRevoke(null), }) } diff --git a/apps/sim/background/cleanup-oauth-tokens.test.ts b/apps/sim/background/cleanup-oauth-tokens.test.ts index a476d3020ac..309c9b21d5a 100644 --- a/apps/sim/background/cleanup-oauth-tokens.test.ts +++ b/apps/sim/background/cleanup-oauth-tokens.test.ts @@ -6,9 +6,18 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' const mocks = vi.hoisted(() => ({ select: vi.fn(), delete: vi.fn(), + transaction: vi.fn(), + txSelect: vi.fn(), + txDelete: vi.fn(), })) -vi.mock('@sim/db', () => ({ db: { select: mocks.select, delete: mocks.delete } })) +vi.mock('@sim/db', () => ({ + db: { + select: mocks.select, + delete: mocks.delete, + transaction: mocks.transaction, + }, +})) import { OAUTH_TOKEN_RETENTION_DAYS, @@ -25,6 +34,7 @@ function selectChain(rows: unknown[], captured: unknown[]) { } chain.orderBy = () => chain chain.limit = () => chain + chain.for = () => chain chain.then = (resolve: (value: unknown) => unknown) => Promise.resolve(rows).then(resolve) return chain } @@ -32,26 +42,56 @@ function selectChain(rows: unknown[], captured: unknown[]) { describe('runCleanupOAuthTokens', () => { beforeEach(() => { vi.clearAllMocks() + mocks.transaction.mockImplementation((work) => + work({ select: mocks.txSelect, delete: mocks.txDelete }) + ) + mocks.txSelect.mockImplementation(() => selectChain([], [])) }) it('deletes exactly the expired rows it selected, and reports both counts', async () => { const deletedFrom: unknown[] = [] mocks.select - .mockReturnValueOnce(selectChain([{ id: 'r1' }, { id: 'r2' }], [])) + .mockReturnValueOnce( + selectChain( + [ + { + id: 'r1', + clientId: 'client-1', + sessionId: null, + userId: 'user-1', + consentId: null, + }, + { + id: 'r2', + clientId: 'client-1', + sessionId: null, + userId: 'user-1', + consentId: null, + }, + ], + [] + ) + ) .mockReturnValueOnce(selectChain([{ id: 'a1' }], [])) - const returned = [[{ id: 'r1' }, { id: 'r2' }], [{ id: 'a1' }]] + mocks.txDelete.mockImplementation((table: unknown) => ({ + where: (clause: unknown) => { + deletedFrom.push([table, clause]) + return { returning: () => Promise.resolve([{ id: 'r1' }, { id: 'r2' }]) } + }, + })) mocks.delete.mockImplementation((table: unknown) => ({ where: (clause: unknown) => { deletedFrom.push([table, clause]) - return { returning: () => Promise.resolve(returned.shift() ?? []) } + return { returning: () => Promise.resolve([{ id: 'a1' }]) } }, })) await expect(runCleanupOAuthTokens()).resolves.toEqual({ - refreshTokens: 2, + tokenFamilies: 2, accessTokens: 1, }) expect(deletedFrom).toHaveLength(2) + expect(mocks.transaction).toHaveBeenCalledOnce() }) /** @@ -62,7 +102,7 @@ describe('runCleanupOAuthTokens', () => { mocks.select.mockReturnValueOnce(selectChain([], [])).mockReturnValueOnce(selectChain([], [])) await expect(runCleanupOAuthTokens()).resolves.toEqual({ - refreshTokens: 0, + tokenFamilies: 0, accessTokens: 0, }) expect(mocks.delete).not.toHaveBeenCalled() diff --git a/apps/sim/background/cleanup-oauth-tokens.ts b/apps/sim/background/cleanup-oauth-tokens.ts index 8d78b02a105..558233e5607 100644 --- a/apps/sim/background/cleanup-oauth-tokens.ts +++ b/apps/sim/background/cleanup-oauth-tokens.ts @@ -1,7 +1,14 @@ import { db } from '@sim/db' -import { oauthAccessToken, oauthRefreshToken } from '@sim/db/schema' +import { + oauthAccessToken, + oauthClient, + oauthConsent, + oauthTokenFamily, + session, + user, +} from '@sim/db/schema' import { createLogger } from '@sim/logger' -import { asc, inArray, lt } from 'drizzle-orm' +import { and, asc, inArray, lt } from 'drizzle-orm' const logger = createLogger('CleanupOAuthTokens') @@ -23,49 +30,119 @@ const OAUTH_TOKEN_SWEEP_LIMIT = 5_000 const OAUTH_TOKEN_SWEEP_MAX_PAGES = 10 export interface CleanupOAuthTokensResult { - refreshTokens: number + tokenFamilies: number accessTokens: number } +interface StaleFamilyCandidate { + id: string + clientId: string + sessionId: string | null + userId: string + consentId: string | null +} + +/** Locks a bounded batch in the same parent-to-child order used by refresh and revocation. */ +async function deleteExpiredFamilyBatch( + staleFamilies: StaleFamilyCandidate[], + cutoff: Date +): Promise { + return db.transaction(async (tx) => { + const userIds = [...new Set(staleFamilies.map((family) => family.userId))] + const sessionIds = [ + ...new Set( + staleFamilies + .map((family) => family.sessionId) + .filter((sessionId): sessionId is string => sessionId !== null) + ), + ] + const clientIds = [...new Set(staleFamilies.map((family) => family.clientId))] + const consentIds = [ + ...new Set( + staleFamilies + .map((family) => family.consentId) + .filter((consentId): consentId is string => consentId !== null) + ), + ] + + await tx + .select({ id: user.id }) + .from(user) + .where(inArray(user.id, userIds)) + .orderBy(asc(user.id)) + .for('share') + if (sessionIds.length > 0) { + await tx + .select({ id: session.id }) + .from(session) + .where(inArray(session.id, sessionIds)) + .orderBy(asc(session.id)) + .for('share') + } + await tx + .select({ clientId: oauthClient.clientId }) + .from(oauthClient) + .where(inArray(oauthClient.clientId, clientIds)) + .orderBy(asc(oauthClient.clientId)) + .for('share') + if (consentIds.length > 0) { + await tx + .select({ id: oauthConsent.id }) + .from(oauthConsent) + .where(inArray(oauthConsent.id, consentIds)) + .orderBy(asc(oauthConsent.id)) + .for('share') + } + + const familyIds = staleFamilies.map((family) => family.id) + await tx + .select({ id: oauthTokenFamily.id }) + .from(oauthTokenFamily) + .where(and(inArray(oauthTokenFamily.id, familyIds), lt(oauthTokenFamily.expiresAt, cutoff))) + .orderBy(asc(oauthTokenFamily.id)) + .for('update') + const deleted = await tx + .delete(oauthTokenFamily) + .where(and(inArray(oauthTokenFamily.id, familyIds), lt(oauthTokenFamily.expiresAt, cutoff))) + .returning({ id: oauthTokenFamily.id }) + return deleted.length + }) +} + /** - * Removes OAuth token rows that expired long enough ago to be of no use. + * Removes OAuth login families that expired long enough ago to be of no use. * - * Nothing else deletes them. The provider rotates a refresh token by marking - * the old row revoked and inserting a new one, and issues a fresh access token - * every hour without pruning the last — so a single CLI user leaves a dead row - * behind every hour, forever. Only an explicit revoke deletes anything. + * Rotated refresh rows are replay evidence and remain for the lifetime of the + * bounded family. Removing an old generation by its own expiry would let its + * later reuse go unnoticed while descendants remained active. The family row + * therefore owns retention and cascades every generation when it expires. * - * Refresh tokens go first and their access tokens follow by cascade - * (`oauth_access_token.refresh_id`), so the second pass only has to catch - * access tokens whose refresh token was already gone. Both select a bounded - * page of ids off the `expires_at` indexes and delete exactly those, rather - * than issuing an unbounded predicate delete. + * Families go first and their refresh/access tokens follow by cascade. The + * second pass catches expired access tokens for still-live families and access + * tokens issued without a refresh grant. Both passes use bounded indexed pages. */ export async function runCleanupOAuthTokens(): Promise { const cutoff = new Date(Date.now() - OAUTH_TOKEN_RETENTION_DAYS * 24 * 60 * 60 * 1000) - let refreshTokens = 0 + let tokenFamilies = 0 let accessTokens = 0 for (let page = 0; page < OAUTH_TOKEN_SWEEP_MAX_PAGES; page += 1) { - const staleRefresh = await db - .select({ id: oauthRefreshToken.id }) - .from(oauthRefreshToken) - .where(lt(oauthRefreshToken.expiresAt, cutoff)) - .orderBy(asc(oauthRefreshToken.expiresAt), asc(oauthRefreshToken.id)) + const staleFamilies = await db + .select({ + id: oauthTokenFamily.id, + clientId: oauthTokenFamily.clientId, + sessionId: oauthTokenFamily.sessionId, + userId: oauthTokenFamily.userId, + consentId: oauthTokenFamily.consentId, + }) + .from(oauthTokenFamily) + .where(lt(oauthTokenFamily.expiresAt, cutoff)) + .orderBy(asc(oauthTokenFamily.expiresAt), asc(oauthTokenFamily.id)) .limit(OAUTH_TOKEN_SWEEP_LIMIT) - if (staleRefresh.length === 0) break + if (staleFamilies.length === 0) break - const deleted = await db - .delete(oauthRefreshToken) - .where( - inArray( - oauthRefreshToken.id, - staleRefresh.map((row) => row.id) - ) - ) - .returning({ id: oauthRefreshToken.id }) - refreshTokens += deleted.length - if (staleRefresh.length < OAUTH_TOKEN_SWEEP_LIMIT) break + tokenFamilies += await deleteExpiredFamilyBatch(staleFamilies, cutoff) + if (staleFamilies.length < OAUTH_TOKEN_SWEEP_LIMIT) break } for (let page = 0; page < OAUTH_TOKEN_SWEEP_MAX_PAGES; page += 1) { @@ -90,7 +167,7 @@ export async function runCleanupOAuthTokens(): Promise if (staleAccess.length < OAUTH_TOKEN_SWEEP_LIMIT) break } - const result = { refreshTokens, accessTokens } + const result = { tokenFamilies, accessTokens } logger.info('Swept expired OAuth tokens', { ...result, retentionDays: OAUTH_TOKEN_RETENTION_DAYS, diff --git a/apps/sim/lib/api/contracts/tables.ts b/apps/sim/lib/api/contracts/tables.ts index 30dd03797e3..b52947711d5 100644 --- a/apps/sim/lib/api/contracts/tables.ts +++ b/apps/sim/lib/api/contracts/tables.ts @@ -671,17 +671,9 @@ const predicateGroupsJsonSchema = (selfRef: string) => */ const PREDICATE_LIMITS_DESCRIPTION = `At most ${MAX_PREDICATE_GROUP_SIZE} members per group, ${MAX_PREDICATE_DEPTH} levels of nesting, and ${MAX_PREDICATE_NODES} nodes in total.` const PREDICATE_NEGATION_DESCRIPTION = - 'The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`.' -const PREDICATE_TREE_DESCRIPTION = [ - `Recursive predicate tree. Each group node is exactly one non-empty \`all\` or \`any\` array whose members are further groups or \`{ field, op, value }\` conditions; the root must be a group, not a bare condition. ${PREDICATE_LIMITS_DESCRIPTION}`, - PREDICATE_NEGATION_DESCRIPTION, - PREDICATE_OPERATOR_GRAMMAR, -].join(' ') -const PREDICATE_INPUT_DESCRIPTION = [ - `A single \`{ field, op, value }\` condition or a recursive \`all\`/\`any\` group; either form is normalized to a grouped predicate after validation. ${PREDICATE_LIMITS_DESCRIPTION}`, - PREDICATE_NEGATION_DESCRIPTION, - PREDICATE_OPERATOR_GRAMMAR, -].join(' ') + 'Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.' +const PREDICATE_TREE_DESCRIPTION = `Recursive non-empty \`all\`/\`any\` groups containing groups or conditions; the root cannot be a condition. ${PREDICATE_LIMITS_DESCRIPTION} ${PREDICATE_NEGATION_DESCRIPTION}` +const PREDICATE_INPUT_DESCRIPTION = `One condition or a recursive \`all\`/\`any\` group, normalized to a grouped predicate. ${PREDICATE_LIMITS_DESCRIPTION} ${PREDICATE_NEGATION_DESCRIPTION}` /** * The canonical grouped predicate schema for dual-grammar boundaries. Keeping diff --git a/apps/sim/lib/api/contracts/v2/__tests__/cross-cutting.test.ts b/apps/sim/lib/api/contracts/v2/__tests__/cross-cutting.test.ts index 4a7ed2f910f..25149ed980f 100644 --- a/apps/sim/lib/api/contracts/v2/__tests__/cross-cutting.test.ts +++ b/apps/sim/lib/api/contracts/v2/__tests__/cross-cutting.test.ts @@ -8,26 +8,18 @@ import { v2ListAuditLogsContract } from '@/lib/api/contracts/v2/audit-logs' import { filesAuditOpenApiDocument } from '@/lib/api/contracts/v2/openapi/files-audit' import { knowledgeOpenApiDocument } from '@/lib/api/contracts/v2/openapi/knowledge' import { ERROR_RESPONSES } from '@/lib/api/contracts/v2/openapi/shared' -import { v2ErrorResponseSchema } from '@/lib/api/contracts/v2/shared' +import { v2ForbiddenDetailCodeSchema } from '@/lib/api/contracts/v2/shared' import { v2CreateTableViewContract, v2QueryRowsBodySchema } from '@/lib/api/contracts/v2/tables' import { v2GetWorkflowRunContract } from '@/lib/api/contracts/v2/workflows' -import { - FORBIDDEN_DETAIL_CODE_DESCRIPTIONS, - FORBIDDEN_DETAIL_CODES, -} from '@/lib/core/application/forbidden' +import { FORBIDDEN_DETAIL_CODES } from '@/lib/core/application/forbidden' /** * The cross-cutting promises that no single resource family owns, and that * therefore have nowhere else to be asserted. */ describe('v2 403 cause codes', () => { - it("publishes every code on the error envelope's details field", () => { - const details = v2ErrorResponseSchema.shape.error.shape.details - const published = details.description ?? '' - for (const code of FORBIDDEN_DETAIL_CODES) { - expect(published).toContain(code) - expect(published).toContain(FORBIDDEN_DETAIL_CODE_DESCRIPTIONS[code]) - } + it('publishes every actionable code as a structural enum', () => { + expect(v2ForbiddenDetailCodeSchema.options).toEqual([...FORBIDDEN_DETAIL_CODES]) }) it('tells a client the codes live on error.details.code', () => { diff --git a/apps/sim/lib/api/contracts/v2/__tests__/transport-neutral-descriptions.test.ts b/apps/sim/lib/api/contracts/v2/__tests__/transport-neutral-descriptions.test.ts index 10a3125753d..66870ec7ec5 100644 --- a/apps/sim/lib/api/contracts/v2/__tests__/transport-neutral-descriptions.test.ts +++ b/apps/sim/lib/api/contracts/v2/__tests__/transport-neutral-descriptions.test.ts @@ -53,10 +53,6 @@ const ALLOWED = new Map([ 'Which lifecycle set to list: `active` (default) for live knowledge bases, `archived` for knowledge bases a `DELETE` archived and `POST /knowledge/{knowledgeBaseId}/restore` can bring back. `folderPath` resolves against active folders only, so pairing it with `scope=archived` returns an empty page when the containing folder was archived too.', 'not touched here: lives in v2/knowledge.ts', ], - [ - 'Structured tag filters, at most 10 of them. Every filter must hold, including two that name the same tag: repeating one tag narrows the result rather than widening it, matching `GET /api/v2/knowledge/{knowledgeBaseId}/documents`. To match either of two values for one tag, issue a search per value. Each filtered tag must resolve to the same slot and field type in every knowledge base selected; one missing from any of them, or defined inconsistently across them, is rejected rather than ignored, and those knowledge bases must be searched separately. List the available names with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`.', - 'not touched here: lives in v2/knowledge.ts', - ], [ 'Runs that finished successfully. Failed, cancelled, and paused runs are not counted, and the counter is never reduced when a run ages out of log retention — so it does not match the size of `GET /api/v2/workflows/{workflowId}/runs`, in either direction.', 'not touched here: lives in v2/workflows.ts', diff --git a/apps/sim/lib/api/contracts/v2/billing.ts b/apps/sim/lib/api/contracts/v2/billing.ts index d55e3333f25..6cdca3c89c3 100644 --- a/apps/sim/lib/api/contracts/v2/billing.ts +++ b/apps/sim/lib/api/contracts/v2/billing.ts @@ -26,8 +26,8 @@ import { * demotes a workspace-scoped question to account scope and answers 200 about a * different payer than the caller asked about. It is a wrong answer, not a cross-tenant * read: `resolveBillingReadScope` still pins a workspace API key to its own workspace - * whatever the query says, so the reachable case is a personal key being told about its - * own account when it asked about a workspace. Rejecting the unknown key turns that + * whatever the query says, so the reachable case is a user-held credential being told + * about its own account when it asked about a workspace. Rejecting the unknown key turns that * wrong answer about money into a 400. */ export const v2BillingStatusQuerySchema = z @@ -172,7 +172,7 @@ export const v2BillingLogsQuerySchema = z workspaceId: workspaceIdSchema .optional() .describe( - "Narrow the ledger to usage events attributed to one workspace. It does not change whose events are reported — a personal API key always reports the usage of the person holding it, and a workspace API key always reports its own workspace's complete ledger across every member. The response `scope` field says which of the two you received. A workspace API key is pinned to its own workspace: any other id answers `404 Workspace not found`, which is also what an id that does not exist answers." + "Narrow the ledger to one workspace. An OAuth token or personal API key reports only its user's events; a workspace API key reports every member's events in its bound workspace. The response `scope` identifies which view was returned. A workspace key asking for another workspace receives the same `404 Workspace not found` as an unknown id." ), period: usageLogPeriodSchema .optional() @@ -287,12 +287,12 @@ export type V2BillingLogEntry = z.output * indistinguishable on the wire. The same workspace, window, and filters return * a strict subset of the rows on `user` scope that they return on `workspace` * scope, and nothing else in the response says which set arrived — a caller - * auditing a workspace's spend with a personal key would silently undercount. + * auditing a workspace's spend with a user-held credential would silently undercount. */ export const v2BillingLogsScopeSchema = z .enum(['user', 'workspace']) .describe( - "Whose usage this page reports. `user` — the events of the person whose personal API key made the request, narrowed by `workspaceId` when one was given; this omits other members' usage. `workspace` — every member's events for the workspace a workspace API key is pinned to." + "Whose usage this page reports. `user` contains only the OAuth or personal-key user's events, optionally narrowed by `workspaceId`; it omits other members. `workspace` contains every member's events for the workspace API key's bound workspace." ) export const v2ListBillingLogsContract = defineRouteContract({ diff --git a/apps/sim/lib/api/contracts/v2/knowledge.ts b/apps/sim/lib/api/contracts/v2/knowledge.ts index a30fc2bd912..6bd8473a3c4 100644 --- a/apps/sim/lib/api/contracts/v2/knowledge.ts +++ b/apps/sim/lib/api/contracts/v2/knowledge.ts @@ -946,7 +946,7 @@ export const v2KnowledgeSearchBodySchema = z ) .optional() .describe( - `Structured tag filters, at most ${MAX_V2_KNOWLEDGE_DOCUMENT_TAG_FILTERS} of them. Every filter must hold, including two that name the same tag: repeating one tag narrows the result rather than widening it, matching \`GET /api/v2/knowledge/{knowledgeBaseId}/documents\`. To match either of two values for one tag, issue a search per value. Each filtered tag must resolve to the same slot and field type in every knowledge base selected; one missing from any of them, or defined inconsistently across them, is rejected rather than ignored, and those knowledge bases must be searched separately. List the available names with \`GET /api/v2/knowledge/{knowledgeBaseId}/tags\`.` + `Up to ${MAX_V2_KNOWLEDGE_DOCUMENT_TAG_FILTERS} filters combined with AND; repeating a tag narrows results. To express OR, run separate searches. Every tag must exist with the same slot and field type in each selected knowledge base or the request is rejected. List valid names with the knowledge-base tag-list operation.` ), searchMode: v1KnowledgeSearchBodySchema.shape.searchMode.describe( 'Retrieval strategy: vector is semantic-only, while hybrid also runs full-text search.' diff --git a/apps/sim/lib/api/contracts/v2/logs-stats.ts b/apps/sim/lib/api/contracts/v2/logs-stats.ts index 163150c2443..64a449982ef 100644 --- a/apps/sim/lib/api/contracts/v2/logs-stats.ts +++ b/apps/sim/lib/api/contracts/v2/logs-stats.ts @@ -105,7 +105,7 @@ export const v2LogStatsSchema = z end: v2TimestampSchema.describe('ISO 8601 end of the window.'), }) .describe( - 'The window the buckets span. `startDate` and `endDate` are used verbatim when supplied; an omitted edge falls back to the oldest matching run on the left and to the later of the newest matching run and now on the right. With no matching runs the right edge falls back to now and the left to 24 hours before that right edge — the trailing 24 hours when neither edge was supplied, and the 24 hours preceding `endDate` when only `endDate` was supplied. A supplied `startDate` is still used verbatim, so a `startDate` without an `endDate` yields `[startDate, now]`, which can be any width.' + 'Actual bucket window. Supplied bounds are exact. Without `startDate`, the left edge is the oldest match, or 24 hours before the right edge when no run matches. Without `endDate`, the right edge is at least now. `startDate` alone spans through now.' ), segmentMs: z.number().describe('Width of one bucket in milliseconds.'), }) diff --git a/apps/sim/lib/api/contracts/v2/logs.ts b/apps/sim/lib/api/contracts/v2/logs.ts index 04c69efc40f..8c3af5a7f23 100644 --- a/apps/sim/lib/api/contracts/v2/logs.ts +++ b/apps/sim/lib/api/contracts/v2/logs.ts @@ -542,7 +542,7 @@ export const v2ListLogsQuerySchema = v1ListLogsQuerySchema */ triggers: v2CommaListSchema( 'triggers', - 'Comma-separated trigger types to include. An empty entry is rejected. Values are matched exactly and are case-sensitive — every recorded trigger is lowercase, so `API` matches nothing while `api` matches. The vocabulary is open: it covers the core trigger types (`manual`, `api`, `schedule`, `chat`, `webhook`, `mcp`, `copilot`, `workflow`, `custom_block`) and the provider id of any webhook trigger (`slack`, `gmail`, `github`, …), so an unrecognized member is not rejected — it selects no runs. The literal value `all` is a sentinel that disables this filter entirely, so a list containing it returns runs of every trigger type; no real trigger type is named `all`.', + 'Comma-separated, lowercase trigger types or webhook provider IDs. Matching is exact and case-sensitive; unknown values select no runs. An empty entry is rejected. The sentinel `all` disables this filter, even when listed with other values.', V2_LOG_TRIGGERS_MAX ).optional(), level: z.enum(['info', 'error']).describe('Severity level to include.').optional(), @@ -550,7 +550,7 @@ export const v2ListLogsQuerySchema = v1ListLogsQuerySchema workflowName: v2WorkflowNameFilterSchema.optional(), includeJobRuns: booleanQueryFlagSchema .describe( - 'Whether Chat and Sim-agent job runs join the sequence alongside workflow runs. Job runs report `kind: "job"`, carry no `workflow` summary, and never carry a cost ledger. They are dropped entirely — not partially matched — whenever a filter they cannot answer is set: by workflow, workflow name, folder, model, or status. A filter therefore never means two different things across the union. Accepted only when sorting by `startedAt`: job runs record cost as a document and no comparable status, so they cannot participate in the other orderings.' + 'Include Chat and Sim-agent jobs alongside workflow runs. Jobs use `kind: "job"` and have no workflow or cost ledger. Workflow, folder, model, or status filters exclude jobs. This option is valid only when sorting by `startedAt`.' ) .optional() .default(false), diff --git a/apps/sim/lib/api/contracts/v2/openapi/files-audit.ts b/apps/sim/lib/api/contracts/v2/openapi/files-audit.ts index d27f3abf5e9..8e4f3959279 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/files-audit.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/files-audit.ts @@ -380,7 +380,7 @@ const declaredRoutes = [ filesOperation({ operationId: 'readFileText', summary: 'Read File Text', - description: `Return a file's text content, parsed out of the stored bytes. This reads the file; it writes nothing — \`POST /api/v2/files/{fileId}/unzip\` is the endpoint that unzips an archive into the workspace. Answers \`400\` for a type no parser supports, naming the raw-bytes download as the escape hatch, and \`413\` for a file above the extraction ceiling. A generated document is extracted from its compiled artifact rather than its generation source, so one still compiling answers \`409\` and is worth retrying. **\`degraded: true\` means text extraction did not fully succeed and the returned text may be incomplete or synthesized from the file's raw bytes. Do not treat it as authoritative content.** The legacy \`.doc\` and \`.ppt\` parsers deliberately return best-effort content rather than failing, so this flag — not an error status — is how a partial extraction is reported. \`truncated\` separately reports that a parser limit stopped extraction early.`, + description: `Extract text from stored file bytes without modifying the file; use \`POST /api/v2/files/{fileId}/unzip\` to unpack archives. Unsupported types return \`400\` and point to raw-byte download; generated documents still compiling return \`409\`, and files above the extraction ceiling return \`413\`. \`degraded: true\` means extraction was incomplete or synthesized from raw bytes and is not authoritative; legacy \`.doc\` and \`.ppt\` extraction may return this best-effort result. \`truncated\` means a parser limit stopped extraction.`, errors: [...RESOURCE_CONFLICT_ERRORS, 'PayloadTooLarge'], success: { description: 'The extracted text and its extraction-quality flags.' }, }), @@ -410,7 +410,7 @@ const declaredRoutes = [ filesOperation({ operationId: 'bulkDownloadFiles', summary: 'Bulk Download Files', - description: `Stream a selection of workspace files as one zip. Select files by id and folders by path, each as one comma-separated parameter; a folder expands to all its descendants, and a path matching no folder is rejected rather than ignored. Each parameter accepts at most ${MAX_ZIP_DOWNLOAD_FILES} entries — the same ceiling the resolved selection is held to — and the resolved file count and total bytes are checked again, so an over-broad selection answers \`400\` rather than streaming indefinitely. Downloading records an audit event, so it is not a safe read. ${HEAD_MIRRORS_GET} ${HEAD_OMITS_PAYLOAD_HEADERS}`, + description: `Stream files as a zip. Provide comma-separated file IDs and folder paths; folders expand recursively, and unmatched paths are rejected. Each parameter and the resolved selection allow at most ${MAX_ZIP_DOWNLOAD_FILES} entries, with bytes bounded. Oversized selections return \`400\`; downloads record an audit event. ${HEAD_MIRRORS_GET} ${HEAD_OMITS_PAYLOAD_HEADERS}`, errors: RESOURCE_CONFLICT_ERRORS, success: { description: 'The selected files as a zip archive.', @@ -433,7 +433,7 @@ const declaredRoutes = [ operationId: 'unzipFile', summary: 'Unzip File', description: - "Unzip a `.zip` archive into a new folder beside it and answer counts plus the destination path. This writes new workspace files; it does not read anything out of the archive into the response — `GET /api/v2/files/{fileId}/text` is the endpoint that returns a file's text. The unpacked files are deliberately not returned — a large archive would materialize thousands of objects into one response — so page `GET /api/v2/files?folderPath=...` for the contents. Unzipping is slow: an archive near the size ceiling can run for minutes. Only one unzip of a given archive runs at a time; a concurrent attempt answers `409`. Archives past the size ceiling, and runs that outrun their time budget, answer `413`.", + 'Unzip a `.zip` archive into a new sibling folder, creating workspace files and returning only counts and the destination path. Use `GET /api/v2/files/{fileId}/text` to read text; page `GET /api/v2/files?folderPath=...` to inspect unpacked files. Large archives can take minutes. Only one unzip per archive may run; concurrent attempts return `409`. Archives above the size ceiling or operations exceeding their time budget return `413`.', errors: [...RESOURCE_CONFLICT_ERRORS, 'PayloadTooLarge'], success: { description: 'Counts and destination folder for the unpacked archive.' }, }), @@ -464,7 +464,7 @@ const declaredRoutes = [ filesOperation({ operationId: 'downloadFile', summary: 'Download File', - description: `Download the current file bytes from a workspace. A generated document is served as its compiled artifact, so it answers \`409\` while that artifact is still compiling and \`413\` if it renders past the size ceiling. Downloading records an audit event, so it is not a safe read. ${HEAD_MIRRORS_GET} ${HEAD_OMITS_PAYLOAD_HEADERS}`, + description: `Download current file bytes. Generated documents use compiled artifacts, returning \`409\` while compiling and \`413\` above the rendered-size ceiling. Downloading records an audit event. ${HEAD_MIRRORS_GET} ${HEAD_OMITS_PAYLOAD_HEADERS}`, errors: [...RESOURCE_CONFLICT_ERRORS, 'PayloadTooLarge'], success: { description: 'The file bytes.', @@ -793,7 +793,7 @@ const declaredRoutes = [ filesOperation({ operationId: 'editFileContent', summary: 'Edit File Content', - description: `Change part of a text file in place, leaving the rest untouched. \`PUT\` on this path replaces the whole file; this is the partial counterpart. \`search_replace\` matches exact text and requires one match unless \`replaceAll\` is true. \`replace_between\`, \`insert_after\`, and \`delete_between\` match complete lines after trimming surrounding whitespace, so edits remain stable when unrelated changes move the target to another line. Anchored replacement preserves both boundary lines; insertion preserves its anchor; deletion removes the start anchor and preserves the end anchor. Use \`occurrence\` when an anchor line repeats. Only files whose stored bytes are UTF-8 text can be edited: a PDF or DOCX answers \`400\`. A concurrent write answers \`409\`, and retrying means re-reading first.`, + description: `Modify part of a text file; \`PUT\` on this path replaces the whole file. \`search_replace\` requires one exact match unless \`replaceAll\` is true. The anchored modes match trimmed complete lines: replacement preserves both boundaries, insertion preserves its anchor, and deletion removes the start but preserves the end. Use \`occurrence\` for repeated anchors. Non-UTF-8 files return \`400\`. Concurrent writes return \`409\`; re-read before retrying.`, errors: [...RESOURCE_CONFLICT_ERRORS, 'PayloadTooLarge', 'Locked'], success: { description: 'The edited file and its new line count.' }, }), @@ -843,7 +843,7 @@ const declaredRoutes = [ filesOperation({ operationId: 'searchFileContent', summary: 'Search File Content', - description: `Search the indexed text of active workspace files and return each matching line with its file id and line number. \`folderPaths\` confines the search to one or more folder trees, which also narrows the reported coverage, so \`complete\` and \`indexStatus\` describe the folders searched rather than the whole workspace. Coverage matters: the index is built asynchronously, so when \`complete\` is \`false\` a term that was not found is **unknown rather than absent**, and acting on the absence risks creating a duplicate of something already stored. \`truncated\` separately reports that more matches exist beyond \`maxResults\`.`, + description: `Search indexed text in active workspace files and return matching lines with file IDs and line numbers. \`folderPaths\` limits both results and the coverage reported by \`complete\` and \`indexStatus\`. Because indexing is asynchronous, a missing term is unknown rather than absent when \`complete\` is false. \`truncated\` means additional matches exist beyond \`maxResults\`.`, errors: [...WORKSPACE_ERRORS, 'NotFound', 'Locked'], success: { description: 'Matching lines and the index coverage they were drawn from.' }, }), diff --git a/apps/sim/lib/api/contracts/v2/openapi/knowledge-chunks.ts b/apps/sim/lib/api/contracts/v2/openapi/knowledge-chunks.ts index 9f8e603b254..1dc5c6f7baa 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/knowledge-chunks.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/knowledge-chunks.ts @@ -27,11 +27,10 @@ import { defineOpenApiRoute } from '@/lib/api/openapi/types' * on the request itself. */ -const CONNECTOR_MANAGED = - 'Chunks of a connector-synced document are read-only and a write answers `403` with `error.details.code: "CONNECTOR_MANAGED_RESOURCE_READ_ONLY"` — change the content at the source and re-sync, or exclude the document from the connector.' - const DOCUMENT_NOT_READY = 'A document that has not finished processing answers `409`; the message names the status it is in.' +const CONNECTOR_MANAGED = + 'Connector-synced chunks are read-only and return `403` with `error.details.code: "CONNECTOR_MANAGED_RESOURCE_READ_ONLY"`; change the source and re-sync, or exclude the document.' export const knowledgeChunkOpenApiRoutes = [ defineOpenApiRoute( @@ -69,7 +68,7 @@ export const knowledgeChunkOpenApiRoutes = [ knowledgeOperation({ operationId: 'createKnowledgeChunk', summary: 'Create Chunk', - description: `Append a chunk to a document. The text is embedded before the response returns, so the chunk is searchable immediately, and it inherits the document's tag values and the next \`chunkIndex\`. ${CONNECTOR_MANAGED} ${WORKSPACE_API_KEY_DENIED}`, + description: `Append a chunk, embedding it before the response so it is immediately searchable. It inherits the document's tags and next \`chunkIndex\`. ${CONNECTOR_MANAGED} ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_ERRORS, success: { description: 'The created chunk.' }, }), @@ -106,7 +105,7 @@ export const knowledgeChunkOpenApiRoutes = [ knowledgeOperation({ operationId: 'bulkUpdateKnowledgeChunks', summary: 'Bulk Update Chunks', - description: `Enable, disable, or delete many chunks of one document in a single request. Best-effort: an identifier naming no chunk in the document is reported in \`errors\` rather than failing the request. \`processed\` counts the chunks the operation matched, not the chunks it changed. ${CONNECTOR_MANAGED} ${WORKSPACE_API_KEY_DENIED}`, + description: `Enable, disable, or delete multiple chunks in one best-effort request. Unknown chunk IDs appear in \`errors\` without failing the request; \`processed\` counts matched chunks, not changes. ${CONNECTOR_MANAGED} ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_ERRORS, success: { description: 'Outcome of the bulk chunk operation.' }, }), @@ -174,7 +173,7 @@ export const knowledgeChunkOpenApiRoutes = [ knowledgeOperation({ operationId: 'updateKnowledgeChunk', summary: 'Update Chunk', - description: `Correct a chunk's text or take it out of search. Changing \`content\` re-embeds the chunk and re-derives the document's token and character counts, so the correction reaches search immediately; disabling keeps the chunk indexed. ${CONNECTOR_MANAGED} ${DOCUMENT_NOT_READY} ${WORKSPACE_API_KEY_DENIED}`, + description: `Correct chunk text or disable it from search. Changing \`content\` re-embeds immediately and recalculates document token and character counts; disabling retains the index. ${CONNECTOR_MANAGED} ${DOCUMENT_NOT_READY} ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_CONFLICT_ERRORS, success: { description: 'The updated chunk.' }, }), @@ -206,7 +205,7 @@ export const knowledgeChunkOpenApiRoutes = [ knowledgeOperation({ operationId: 'deleteKnowledgeChunk', summary: 'Delete Chunk', - description: `Permanently remove one chunk and subtract it from the document's counts. Deleting does not renumber the remaining chunks, so \`chunkIndex\` values stay stable but become non-contiguous. ${CONNECTOR_MANAGED} ${DOCUMENT_NOT_READY} ${WORKSPACE_API_KEY_DENIED}`, + description: `Permanently remove one chunk and subtract it from document counts. Remaining \`chunkIndex\` values stay stable and may become non-contiguous. ${CONNECTOR_MANAGED} ${DOCUMENT_NOT_READY} ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_CONFLICT_ERRORS, success: { description: 'Chunk deletion acknowledgement.' }, }), diff --git a/apps/sim/lib/api/contracts/v2/openapi/knowledge-tags.ts b/apps/sim/lib/api/contracts/v2/openapi/knowledge-tags.ts index e5425bc1ccf..a3d6c69d6df 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/knowledge-tags.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/knowledge-tags.ts @@ -29,16 +29,13 @@ import { defineOpenApiRoute } from '@/lib/api/openapi/types' * first place. */ -const TAG_LOOP = - 'Define a tag here, write its `tagSlot` on a document with `PATCH /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}`, then filter by its `displayName` on the document list or on search.' - export const knowledgeTagOpenApiRoutes = [ defineOpenApiRoute( v2CreateKnowledgeTagContract, knowledgeOperation({ operationId: 'createKnowledgeTag', summary: 'Create Tag', - description: `Define one tag on a knowledge base; use \`PUT\` on this path to declare several at once. ${TAG_LOOP} Omit \`tagSlot\` to take the next free slot for the field type; a field type with no free slot left is a \`400\` naming it, since the remedy is a different type or a deleted definition rather than a retry. A \`tagSlot\` already taken, or a \`displayName\` already defined on this knowledge base, is a \`409\` naming which of the two to change. ${WORKSPACE_API_KEY_DENIED}`, + description: `Define one tag; use \`PUT\` on this path for several. Write its \`tagSlot\` on documents, then filter by \`displayName\`. Omitting \`tagSlot\` selects the next free slot; exhaustion returns \`400\`. An occupied slot or duplicate display name returns \`409\` naming the conflict. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_CONFLICT_ERRORS, success: { description: 'The created tag definition.' }, }), @@ -70,7 +67,7 @@ export const knowledgeTagOpenApiRoutes = [ knowledgeOperation({ operationId: 'updateKnowledgeTag', summary: 'Update Tag', - description: `Rename a tag, or change the value type stored in its slot. Renaming changes the name filters and document reads use; the slot, and every value in it, is untouched. A tag's slot is fixed for its lifetime and each slot holds one kind of value, so \`fieldType\` can only change to another type valid for the slot the tag already occupies — anything else is a \`400\`, and the way to get a tag of that type is to create one. A name another tag on this knowledge base already holds is a \`409\`. ${WORKSPACE_API_KEY_DENIED}`, + description: `Rename a tag or change its slot-compatible \`fieldType\`. Renaming changes read and filter names without moving the slot or its values. Slots are fixed for a tag's lifetime; an incompatible type returns \`400\` and requires creating a new tag. A duplicate display name returns \`409\`. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_CONFLICT_ERRORS, success: { description: 'The updated tag definition.' }, }), @@ -192,7 +189,7 @@ export const knowledgeTagOpenApiRoutes = [ knowledgeOperation({ operationId: 'bulkSaveKnowledgeTagDefinitions', summary: 'Bulk Save Tag Definitions', - description: `Declare, in one request, several of the knowledge base's tag definitions. \`POST\` on this path defines exactly one tag; this is the same write over a list, and every slot the body names is written to the declaration it carries while slots it does not name are left alone. Updating an existing definition requires naming its current name in \`originalDisplayName\`; that is the only form that edits one in place. Without it the entry is a create, and a requested \`tagSlot\` another name already holds is refused in \`errors\` — it is neither overwritten nor relocated to a different slot, so an explicitly requested slot always means that slot or an error. A create whose \`displayName\` already exists is refused in \`errors\`. Per-definition failures are reported in \`errors\` and still answer \`200\`. This writes the vocabulary, not one document's tag values — set those with \`PATCH /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}\`. ${WORKSPACE_API_KEY_DENIED}`, + description: `Declare multiple tag definitions while leaving unspecified slots unchanged. Updating requires the current name in \`originalDisplayName\`; otherwise the entry creates a tag. Occupied explicit slots and duplicate display names appear in per-definition \`errors\`, never overwrite or relocate data, and still return \`200\`. This writes the vocabulary, not document tag values; set those through the document update endpoint. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_ERRORS, success: { description: 'Definitions created and updated by the save.' }, }), @@ -229,7 +226,7 @@ export const knowledgeTagOpenApiRoutes = [ knowledgeOperation({ operationId: 'deleteKnowledgeTagDefinitions', summary: 'Delete Tag Definitions', - description: `Remove tag definitions from the knowledge base. \`unused\` defaults to \`true\`, which removes only the definitions no document still carries a value for — the recoverable half, since a definition with nothing behind it can simply be redefined. Pass \`unused=false\` to delete every definition on the knowledge base, which also clears its slot on every document and chunk and is not recoverable. Delete one definition at a time with \`DELETE /api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}\`. ${WORKSPACE_API_KEY_DENIED}`, + description: `Remove tag definitions. \`unused\` defaults to \`true\`, deleting only definitions with no document values, which can be recreated safely. \`unused=false\` deletes every definition and irreversibly clears its slot from all documents and chunks. Use \`DELETE /api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}\` to delete one definition. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_ERRORS, success: { description: 'Number of tag definitions removed.' }, }), diff --git a/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts b/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts index 16389d359e0..b6dc9b31750 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts @@ -1139,7 +1139,7 @@ const declaredRoutes = [ operationId: 'addWorkspaceFilesToKnowledgeBase', summary: 'Index Workspace Files', description: - 'Index files the workspace already stores, without re-uploading their bytes. Each reference is authorized against the file it names, so a reference the caller cannot read, one over the 100 MB document limit, or one whose type is not supported is reported in `failed` while the rest are queued — a partial outcome is a `200`, not a multi-status. A queued document starts in the `pending` processing state; the entries returned here carry only its identity, so read `GET /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}` for its current state. ' + + 'Index stored workspace files without re-uploading bytes. Each reference is authorized independently; unreadable, unsupported, or over-100 MB files appear in `failed` while valid files are queued. This partial outcome returns `200`, not multi-status. Queued documents begin as `pending`; the response carries identities only, so read each document endpoint for current processing state. ' + WORKSPACE_API_KEY_DENIED, errors: [...RESOURCE_ERRORS, 'UsageLimitExceeded'], success: { diff --git a/apps/sim/lib/api/contracts/v2/openapi/logs.ts b/apps/sim/lib/api/contracts/v2/openapi/logs.ts index 06edcc996af..60b50f191ba 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/logs.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/logs.ts @@ -163,7 +163,7 @@ const declaredRoutes = [ logsOperation({ operationId: 'listLogs', summary: 'List Logs', - description: `List workflow execution logs for a workspace with filters, selectable detail, sorting by start time, duration, cost, or status, and opaque cursor pagination. Chat and Sim-agent job runs join the sequence with \`includeJobRuns=true\`, which is accepted only under \`sortBy=startedAt\` — their cost is stored as a document and their status is not comparable, so they cannot participate in the other orderings. Each item's \`files\` lists only the files the run itself produced, addressed by \`downloadPath\`; input attachments a caller supplied are read through the files API instead. ${RUN_RETENTION} ${FOLDER_TREE_TOO_LARGE}`, + description: `List logs with filters, selectable detail, sorting, and cursor pagination. \`includeJobRuns=true\` includes chat and Sim-agent jobs only with \`sortBy=startedAt\`, because other orderings are unsupported. \`files\` contains only run-produced files; use the files API for input attachments. ${RUN_RETENTION} ${FOLDER_TREE_TOO_LARGE}`, errors: [...RESOURCE_ERRORS, 'PayloadTooLarge'], success: { description: 'A page of execution logs matching the filters.' }, }), @@ -188,7 +188,7 @@ const declaredRoutes = [ logsOperation({ operationId: 'getLog', summary: 'Get Log', - description: `Retrieve the diagnostic representation of a run, including its workflow snapshot, trace spans, final output, and cost. Trace spans are pruned on their own retention schedule, so an empty \`traceSpans\` array does not mean the run recorded none. ${FOLDER_TREE_TOO_LARGE} ${RUN_RETENTION}`, + description: `Retrieve a run's workflow snapshot, trace spans, final output, and cost. Trace spans have separate retention, so an empty \`traceSpans\` array does not prove none were recorded. ${RUN_RETENTION} ${FOLDER_TREE_TOO_LARGE}`, errors: [...RESOURCE_ERRORS, 'PayloadTooLarge'], success: { description: 'The requested diagnostic log representation.' }, }), @@ -214,7 +214,7 @@ const declaredRoutes = [ logsOperation({ operationId: 'getLogStats', summary: 'Get Log Statistics', - description: `Bucketed run counts, success rate, error count, and mean latency for a workspace and for each of its workflows — the aggregate a caller would otherwise have to page every run to compute. The window spans \`startDate\` through \`endDate\` when both are supplied; an omitted edge falls back to the oldest matching run on the left and to the later of the newest matching run and now on the right. With no matching runs the right edge falls back to now and the left to 24 hours before that right edge — the trailing 24 hours when neither edge was supplied, and the 24 hours preceding \`endDate\` when only \`endDate\` was supplied. A supplied \`startDate\` is still used verbatim, so a \`startDate\` without an \`endDate\` yields \`[startDate, now]\`, which can be any width. The window is divided into exactly \`segmentCount\` equal buckets whose width is \`max(60000, floor(windowMs / segmentCount))\` milliseconds. The one-minute floor is a floor on bucket width, not on the window: when it applies, the series runs past \`timeBounds.end\` and the trailing buckets are empty rather than the window being compressed. A folder path covers its whole subtree. Per-workflow series are capped and \`workflowsTruncated\` reports whether the cap applied; the workspace totals are always computed from every workflow. ${RUN_RETENTION} ${FOLDER_TREE_TOO_LARGE}`, + description: `Return workspace/workflow counts, success, errors, and latency. Defaults span runs, or 24 hours if empty; supplied bounds stay exact. Buckets are one-minute minimum and may pass the end. Folders include descendants; \`workflowsTruncated\` marks capped series, totals include all. ${RUN_RETENTION} ${FOLDER_TREE_TOO_LARGE}`, errors: [...RESOURCE_ERRORS, 'PayloadTooLarge'], success: { description: 'Bucketed execution statistics for the workspace.' }, }), diff --git a/apps/sim/lib/api/contracts/v2/openapi/resources.ts b/apps/sim/lib/api/contracts/v2/openapi/resources.ts index 2ca558dcbee..ca0d560de88 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/resources.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/resources.ts @@ -224,6 +224,11 @@ const TOOL_EXECUTION_EXAMPLE = { error: null, } as const +const SANDBOX_ADMIN_PLAN_NOTE = + 'Requires a workspace admin on Max or Enterprise; lower plans return `403` with `error.details.code: WORKSPACE_PLAN_CAPABILITY_REQUIRED`.' +const SANDBOX_BUILD_BUDGET_NOTE = + 'Creates and updates share a write budget; bursts return `429` with `Retry-After`.' + const TOOL_DETAIL_EXAMPLE = { ...TOOL_SUMMARY_EXAMPLE, params: { @@ -396,13 +401,6 @@ const SANDBOX_EXAMPLE = { updatedAt: '2026-06-20T14:02:11.000Z', } as const -const SANDBOX_ADMIN_PLAN_NOTE = - 'Requires a workspace admin on a Max or Enterprise plan; a lower plan is refused with `403` and `error.details.code` `WORKSPACE_PLAN_CAPABILITY_REQUIRED`.' - -/** Creates and updates only: deleting builds nothing and is never refused on budget. */ -const SANDBOX_BUILD_BUDGET_NOTE = - 'Creates and updates in a workspace share one write budget, whatever the install strategy, and a burst is refused with `429` and a `Retry-After` header.' - const CREDENTIAL_EXAMPLE = { id: '7c9e6679-7425-40de-944b-e07fc1f90ae7', type: 'service_account', @@ -787,7 +785,7 @@ const declaredRoutes = [ resourceOperation('MCP Servers', { operationId: 'listMcpServerTools', summary: 'List MCP Server Tools', - description: `Connect to a registered MCP server and return the tools it exposes. This read has side effects: it opens a live connection to the third-party server and writes \`connectionStatus\`, \`toolCount\`, \`lastError\`, and \`lastToolsRefresh\`. ${HEAD_MIRRORS_GET} Discovery is bounded at 1,000 tools and 5 MB of tool payload per server. ${FULL_SET_LIST} An unreachable, slow, or cooling-down server is a \`503\`; a stored OAuth grant that no longer works is a \`409\` with \`error.details.code\` \`MCP_SERVER_REAUTHORIZATION_REQUIRED\`, which only a human reauthorizing in Sim can clear. ${WORKSPACE_API_KEY_DENIED}`, + description: `Return up to 1,000 tools and 5 MB with \`nextCursor: null\`, opening a connection and updating connection metadata. ${HEAD_MIRRORS_GET} Unavailable servers return \`503\`; invalid OAuth returns \`409\` with \`error.details.code: MCP_SERVER_REAUTHORIZATION_REQUIRED\` and requires human reauthorization. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_CONFLICT_ERRORS, success: { description: 'Tools exposed by the MCP server.' }, }), @@ -1259,7 +1257,7 @@ const declaredRoutes = [ resourceOperation('Sandboxes', { operationId: 'createSandbox', summary: 'Create Sandbox', - description: `Create a sandbox. The name must be unique within the workspace. Where the deployment prebuilds dependency images, the build is scheduled and reported through \`buildStatus\`; a deployment that installs at run time, or a sandbox with nothing to install, has no build and reports \`buildStatus: null\`. A dependency or system-package entry the builder cannot accept is a \`400\` whose \`error.details\` names the field and the offending entries. ${SANDBOX_ADMIN_PLAN_NOTE} ${SANDBOX_BUILD_BUDGET_NOTE} ${WORKSPACE_API_KEY_DENIED}`, + description: `Create a uniquely named sandbox. Prebuild deployments schedule an image build reported by \`buildStatus\`; runtime-install deployments or empty specs report \`buildStatus: null\`. Invalid dependency or system-package entries return \`400\` with field details. ${SANDBOX_ADMIN_PLAN_NOTE} ${SANDBOX_BUILD_BUDGET_NOTE} ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_CONFLICT_ERRORS, success: { description: @@ -1329,7 +1327,7 @@ const declaredRoutes = [ resourceOperation('Sandboxes', { operationId: 'updateSandbox', summary: 'Update Sandbox', - description: `Update the supplied sandbox fields. Omitted fields retain their stored values; a supplied list replaces the whole list; names must remain unique within the workspace. Where the deployment prebuilds dependency images, a changed spec is rebuilt and re-sending an unchanged spec after a failed build retries it; a deployment that installs at run time, or a spec with nothing to install, has no build and reports \`buildStatus: null\`. ${SANDBOX_ADMIN_PLAN_NOTE} ${SANDBOX_BUILD_BUDGET_NOTE} ${WORKSPACE_API_KEY_DENIED}`, + description: `Update supplied fields; omissions preserve values, lists replace whole lists, and names remain unique. Prebuild deployments rebuild changed specs, while resending an unchanged failed spec retries it; runtime-install or empty specs report \`buildStatus: null\`. ${SANDBOX_ADMIN_PLAN_NOTE} ${SANDBOX_BUILD_BUDGET_NOTE} ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_CONFLICT_ERRORS, success: { description: 'The updated sandbox.' }, }), @@ -1371,7 +1369,7 @@ const declaredRoutes = [ resourceOperation('Sandboxes', { operationId: 'deleteSandbox', summary: 'Delete Sandbox', - description: `Delete a sandbox. Function blocks that still select it fail closed at run time until they are re-pointed. Where the deployment prebuilds dependency images, the sandbox's image is released once nothing else shares it; a runtime-install deployment, or a spec with nothing to install, had no image and nothing is released. ${SANDBOX_ADMIN_PLAN_NOTE} ${WORKSPACE_API_KEY_DENIED}`, + description: `Delete a sandbox. Function blocks still selecting it fail closed until reconfigured. A prebuilt image is released when no sandbox shares it; runtime-install and empty specs have no image to release. ${SANDBOX_ADMIN_PLAN_NOTE} ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_ERRORS, success: { description: 'The sandbox was deleted.' }, }), @@ -1499,7 +1497,7 @@ const declaredRoutes = [ resourceOperation('Credentials', { operationId: 'createCredentialConnection', summary: 'Create Credential Connection', - description: `Create a short-lived browser URL for connecting an OAuth provider or reconnecting an existing OAuth credential. Open the URL in a browser, sign in as the personal API-key owner, complete provider authorization, then refresh the credentials list. ${WORKSPACE_API_KEY_DENIED}`, + description: `Create a short-lived browser URL for connecting an OAuth provider or reconnecting an existing OAuth credential. Open the URL, sign in as the authenticated user, complete provider authorization, then refresh the credentials list. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_CONFLICT_ERRORS, success: { description: 'A short-lived browser authorization URL.' }, }), @@ -1581,7 +1579,7 @@ const declaredRoutes = [ resourceOperation('Secrets', { operationId: 'setSecret', summary: 'Set Secret', - description: `Create or replace a workspace or caller-owned personal secret. The value is encrypted at rest, is write-only, and is never included in the response. Omit \`value\` on a workspace secret to update \`description\` and \`unredacted\` alone: the stored value is left untouched and is never re-encrypted, and because a metadata-only write cannot create a secret it answers \`404\` when the named secret does not exist. A personal secret always requires \`value\`, having no other writable field. ${WORKSPACE_API_KEY_DENIED}`, + description: `Create or replace a workspace or personal secret. Values are encrypted at rest, write-only, and never returned. For an existing workspace secret, omit \`value\` to update only \`description\` or \`unredacted\`; the value remains untouched. This metadata-only form cannot create a secret and returns \`404\` when absent. Personal secrets always require \`value\`. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_ERRORS, success: { byStatus: { @@ -1693,7 +1691,7 @@ const declaredRoutes = [ resourceOperation('MCP Servers', { operationId: 'listWorkflowMcpServers', summary: 'List Workflow MCP Servers', - description: `List the MCP servers a workspace *publishes*. These serve deployed workflows as tools to outside MCP clients, which is the opposite direction from \`GET /api/v2/mcp-servers\` — that lists external servers Sim calls. Each entry carries the endpoint clients connect to and the tool names it exposes; those names are gathered under a 2,000-tool budget shared across the page, so on a page of unusually large servers the trailing entries can list fewer names than they publish. Read one server's full inventory with \`GET /api/v2/workflow-mcp-servers/{serverId}/tools\`. ${WORKSPACE_API_KEY_DENIED}`, + description: `List servers that publish deployed workflows to outside MCP clients; \`GET /api/v2/mcp-servers\` instead lists external servers Sim calls. Entries include client endpoints and tool names. A page shares a 2,000-name budget, so trailing servers may show partial inventories; read a server's tools endpoint for its full set. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_ERRORS, success: { description: 'A page of published MCP servers.' }, }), @@ -1877,7 +1875,7 @@ const declaredRoutes = [ resourceOperation('Credentials', { operationId: 'updateCredential', summary: 'Update Credential', - description: `Rotate a service-account credential's secret material, or rename it. Send only the fields to change: an omitted field is left unchanged, and \`description: null\` clears the stored description. Secret fields are write-only and are never returned, and only a service-account credential has any: sending one for a credential of another type answers \`400\` rather than dropping it. The provider re-verifies replacement secret material before it replaces the stored secret, so a rejected secret leaves the stored one untouched and answers \`400\` with the provider's code in \`error.details.providerErrorCode\`; a provider that cannot be reached answers \`503\`. The credential ID is preserved, so every workflow, deployment, paused run, knowledge connector, and webhook that references it keeps working — which disconnecting and re-creating does not. Credential admin access is required. ${WORKSPACE_API_KEY_DENIED}`, + description: `Rename a service-account credential or rotate its write-only secret fields. Omissions preserve values; \`description: null\` clears the description. Secret fields sent for another credential type return \`400\`. The provider verifies replacements before storage: rejection leaves the old secret intact and returns \`400\` with \`providerErrorCode\`; provider outages return \`503\`. The preserved credential ID keeps all references working. Credential admin access is required. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_CONFLICT_ERRORS, success: { description: 'The updated credential without secret material.' }, }), @@ -2031,7 +2029,7 @@ const declaredRoutes = [ resourceOperation('Catalog', { operationId: 'executeTool', summary: 'Run Tool', - description: `Run one built-in tool and return what it produced. Supply \`input\` using the parameter ids \`GET /api/v2/tools/{toolId}\` publishes; Sim resolves the credential named by \`credentialId\`, injects a hosted API key for the tools it supplies one for, and substitutes environment-variable references, so the request carries arguments rather than secrets. A parameter the tool marks \`user-only\` also accepts \`{{VAR_NAME}}\` as its whole value, resolved server-side against the workspace environment; every other value is sent verbatim, so a literal secret passes through untouched. A tool that runs and refuses is a \`200\` carrying \`status: "failed"\` and the reason — the error envelope is reserved for failures of this API, not of the third party. A tool the workspace's visible blocks do not expose answers \`404\` identically to one that does not exist; one whose integration the workspace does not permit answers \`403\` with \`error.details.code\` \`INTEGRATION_NOT_ALLOWED\`. Hosted-key spend this call incurs is billed to the workspace. ${WORKSPACE_API_KEY_DENIED}`, + description: `Run a built-in tool using published parameter IDs. Sim resolves \`credentialId\`, hosted keys, and whole-value \`{{VAR_NAME}}\` references for \`user-only\` parameters; other values pass through verbatim. Third-party refusal returns \`200\` with \`status: "failed"\`; the error envelope covers API failures. Hidden or missing tools return \`404\`; disallowed integrations return \`403\` with \`error.details.code: INTEGRATION_NOT_ALLOWED\`. Hosted-key use is billed to the workspace. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_ERRORS, success: { description: 'The outcome of the tool call.' }, }), @@ -2070,7 +2068,7 @@ const declaredRoutes = [ resourceOperation('Catalog', { operationId: 'listConnectorTypes', summary: 'List Connector Types', - description: `List every knowledge-base connector type and the source configuration each accepts. Two properties of a config field decide how its value is sent and are not inferable from the rest: a field with \`multi: true\` stores a \`string[]\` rather than a \`string\`, and a \`canonicalParamId\` links a picker field to a manual-entry field that write the SAME configuration key — send exactly one of the pair, keyed by \`canonicalParamId\` rather than by the field's own \`id\`. ${FULL_SET_LIST}`, + description: `List connector types and accepted source configuration. A field with \`multi: true\` stores \`string[]\`. \`canonicalParamId\` links picker and manual fields that write the same key; send exactly one, keyed by \`canonicalParamId\` rather than its own \`id\`. ${FULL_SET_LIST}`, errors: RESOURCE_ERRORS, success: { description: 'The connector-type catalog.' }, }), diff --git a/apps/sim/lib/api/contracts/v2/openapi/shared.ts b/apps/sim/lib/api/contracts/v2/openapi/shared.ts index 2612de176b0..81d6726b3e3 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/shared.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/shared.ts @@ -366,7 +366,7 @@ export const FULL_SET_LIST = 'The bounded set is returned in one page; `nextCurs * Pinned by `contracts/v2/openapi/head-not-safe.test.ts`. */ export const HEAD_MIRRORS_GET = - 'A `HEAD` skips the effect but is authorized exactly as the `GET` is, so it answers `400`, `401`, `403`, or `404` wherever the `GET` would and an empty `200` otherwise. Skipping the effect means skipping the read that produces the payload, so that `200` carries none of the response headers documented below — it answers whether the `GET` would be allowed, not what the `GET` would return.' + '`HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only.' /** * Appended where the skipped payload headers are the ones a caller is most @@ -378,7 +378,7 @@ export const HEAD_MIRRORS_GET = * `headSafe: false` exists to skip. */ export const HEAD_OMITS_PAYLOAD_HEADERS = - 'In particular a `HEAD` does not report `Content-Length`, so it cannot be used to size a download in advance; read the size from the file resource instead.' + '`HEAD` omits `Content-Length`; use file metadata to size downloads.' /** * Appended to an operation whose semantic operation sets `workspaceApiKey: 'deny'`. @@ -424,7 +424,7 @@ export const WORKSPACE_API_KEY_DENIED_AS_NOT_FOUND = * cannot drift into two paraphrases of one window. */ export const RUN_RETENTION = - "Runs are hard-deleted once they pass the payer's log retention window, so an older run is simply absent rather than reported as removed. The window is 30 days from run start on the free plan, unbounded on Pro and Team, and set per organization on Enterprise with an optional per-workspace override." + 'Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override.' /** * Response headers a binary download declares on top of the common set. Shared diff --git a/apps/sim/lib/api/contracts/v2/openapi/tables.ts b/apps/sim/lib/api/contracts/v2/openapi/tables.ts index 428cb576c2f..8fe5aeb0896 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/tables.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/tables.ts @@ -262,7 +262,7 @@ const declaredRoutes = [ tableOperation({ operationId: 'updateTable', summary: 'Update Table', - description: `Rename a table, edit its description, or move it to a canonical folder. At least one mutable field is required; lock flags remain read-only.\n\nNOT atomic: name, description, and folder are written independently, so a 4xx does not mean nothing changed. When at least one field landed before the failure the error body carries \`details.applied\` naming those fields — retry with only the ones missing from it. Its absence means nothing was applied.\n\n${FOLDER_TREE_TOO_LARGE}`, + description: `Rename a table, edit its description, or move it to a canonical folder. At least one mutable field is required; lock flags are read-only.\n\nNOT atomic: fields are written independently, so a 4xx may follow a partial update. When fields were applied, \`details.applied\` names them; retry only the missing fields. If it is absent, nothing changed.\n\n${FOLDER_TREE_TOO_LARGE}`, errors: [...RESOURCE_CONFLICT_ERRORS, 'PayloadTooLarge'], success: { description: 'The updated table.' }, }), @@ -658,7 +658,7 @@ const declaredRoutes = [ operationId: 'queryTableRows', summary: 'Query Rows', description: - "Query rows with an optional typed predicate, ordered sort specification, and opaque cursor pagination. A predicate may be one condition or an `all`/`any` group; omit it to match every row. Bounded pages are capped at 5MB by default and may contain fewer rows than the requested limit; continue until nextCursor is null. A predicate larger than the request-body ceiling is a `413`. Set `includeRunState: true` to attach each row's per-workflow-group run outcomes; the row limit is capped when it is set. Row totals live on the companion `POST /api/v2/tables/{tableId}/query/count`, which is a separate snapshot — a caller needing a consistent pair should take the count first and treat it as a floor.", + 'Query rows using an optional typed condition or `all`/`any` group, ordered sorting, and opaque cursor pagination. Omit the predicate to match all rows. Pages default to a 5 MB cap and may return fewer rows than requested; continue until `nextCursor` is null. Oversized predicates return `413`. `includeRunState` adds per-group outcomes and lowers the row cap. Counts come from a separate snapshot at `POST /query/count`; take the count first and treat it as a floor.', errors: TABLE_QUERY_ERRORS, success: { description: 'A page of matching table rows.' }, }), @@ -1117,7 +1117,7 @@ const declaredRoutes = [ tableOperation({ operationId: 'searchTableRows', summary: 'Search Rows', - description: `Text-search every cell case-insensitively for the substring \`q\`, optionally within a predicate-filtered and sorted view. This is TEXT search, not the structured predicate read: \`POST /api/v2/tables/{tableId}/query\` is that one, and on this surface \`query\` always means a structured predicate while \`search\` always means text.\n\nIt returns cell COORDINATES — \`{ ordinal, rowId, column }\` — and never row data. \`ordinal\` is the row's zero-based index in the same filtered, sorted view \`POST /query\` pages, so read the rows themselves through that. The result is uncursored and capped: at most ${TABLE_LIMITS.MAX_FIND_MATCHES} matches come back and \`truncated\` is \`true\` when more matched than were returned. There is no cursor to page with — narrow \`q\` or the predicate instead.`, + description: `Search every cell case-insensitively for substring \`q\`, optionally within a predicate-filtered, sorted view. This is text search; \`POST /query\` performs structured predicate reads. Results are cell coordinates \`{ ordinal, rowId, column }\`, never row data; \`ordinal\` indexes the same view paged by \`POST /query\`. Results are uncursored and capped at ${TABLE_LIMITS.MAX_FIND_MATCHES}; \`truncated\` signals more matches. Narrow \`q\` or the predicate instead of paging.`, errors: RESOURCE_ERRORS, success: { description: 'The matching table cells.' }, }), @@ -1611,7 +1611,7 @@ const declaredRoutes = [ operationId: 'restoreTablesFolder', summary: 'Restore Folder', description: - "Un-archive a table folder a recursive `DELETE` archived, along with every subfolder and table archived with it. Address it by the path it held when it was deleted. The restore may legally land it elsewhere: a folder whose parent is still archived is re-rooted to `/`, and a name an active sibling has taken meanwhile is deduplicated — so read the returned folder's `path` rather than assuming the requested one. A path that is not archived answers `404`. `DELETE /api/v2/tables/folders` returns the path it archived, which is the value to keep and send here; unlike the files surface, `GET /api/v2/tables/folders` does not yet list archived folders, so a caller that discards that path cannot recover it over the API.", + 'Restore a recursively archived table folder with its subfolders and tables, addressed by its former path. If its parent remains archived, it is re-rooted to `/`; active-name conflicts are deduplicated, so use the returned `path`. Non-archived paths return `404`. Preserve the path returned by `DELETE /api/v2/tables/folders`: unlike the files API, the table-folder list cannot discover archived paths.', errors: [...RESOURCE_CONFLICT_ERRORS, 'PayloadTooLarge'], success: { description: 'The restored table folder and what it brought back.' }, }), @@ -1836,7 +1836,7 @@ const declaredRoutes = [ operationId: 'moveTables', summary: 'Move Tables and Folders', description: - 'Move up to 100 tables and table folders into one destination folder in a single authorized request. Folders are named by canonical path, and `null` or `/` moves to the workspace root. Best-effort per item: a table filed inside a selected folder is reported in `skipped` because the folder already carries it, an entry that resolves to nothing lands in `notFound`, and an item refused by a lock or a folder cycle lands in `failed` with a reason. An invalid destination fails the whole request before anything moves.', + 'Move up to 100 tables and canonical-path folders to one destination; `null` or `/` means the workspace root. Processing is best-effort per item: tables already carried by selected folders are `skipped`, missing items are `notFound`, and lock or cycle refusals are `failed` with reasons. An invalid destination rejects the entire request before any move.', errors: [...RESOURCE_ERRORS, 'PayloadTooLarge'], success: { description: 'Per-item outcome of the bulk move.' }, }), diff --git a/apps/sim/lib/api/contracts/v2/openapi/workflows.ts b/apps/sim/lib/api/contracts/v2/openapi/workflows.ts index 3b9804e915a..1b67ab23860 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/workflows.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/workflows.ts @@ -133,10 +133,10 @@ const WORKFLOW_VERSION_EXAMPLE = { * caller happens to open first. */ const WORKFLOW_DEPLOYMENT_VS_CHAT = - 'Not to be confused with `/workflows/{workflowId}/deployments/chat`, which is the hosted chat the workflow is published as. This path governs whether the workflow is executable at all; that one governs one surface it is served on. A workflow can be deployed with no chat, and removing its chat leaves it deployed and executable.' + '`/workflows/{workflowId}/deployment` controls overall API executability; `/deployments/chat` controls only the hosted-chat surface. A workflow can remain deployed without a chat.' const CHAT_VS_WORKFLOW_DEPLOYMENT = - "Not to be confused with `/workflows/{workflowId}/deployment` (singular), which is the workflow's own API deployment — its live version and whether the draft has drifted. That path governs whether the workflow is executable at all; this one governs the hosted chat it is served on. The chat is a singleton of its workflow, so it has no id of its own in any path and no separate create verb: `PUT` is create-or-replace and is the only write." + '`/workflows/{workflowId}/deployment` controls API execution; this singleton path controls hosted chat. `PUT` creates or replaces it without a chat-id path.' const CHAT_DEPLOYMENT_EXAMPLE = { id: 'chat_01J8ZK3QW4M6X2R9T7B5C0V2', @@ -300,7 +300,7 @@ const declaredRoutes = [ operationId: 'getWorkflowState', summary: 'Get Workflow State', description: - 'Get the editable draft graph of a workflow: blocks, edges, the loop and parallel containers derived from them, and variables. This is the pollable read — it records no audit event, and `HEAD` mirrors `GET`. The payload is **unsanitized**: it carries workspace-scoped `credentialId`, `knowledgeBaseId`, and `tableId` values verbatim, so it is not portable to another workspace. Use `GET /workflows/{workflowId}/export` for a portable, sanitized copy — and note that export is not a read-modify-write source, because sanitizing it drops every credential binding. Unknown members are stripped, so what this returns is exactly the set of keys `PUT /workflows/{workflowId}/state` accepts.', + 'Get the editable draft graph: blocks, edges, derived loop and parallel containers, and variables. This pollable read records no audit event, and `HEAD` mirrors `GET`. The unsanitized payload includes workspace-scoped credential, knowledge-base, and table ids, so it is not portable. Use `export` for a sanitized copy, but not for read-modify-write because credential bindings are removed. Returned keys exactly match what `PUT /workflows/{workflowId}/state` accepts.', /** * No `413`: unlike the workflow reads beside it this one resolves no * folder path, so it never materializes the workspace's folder tree, and @@ -327,7 +327,8 @@ const declaredRoutes = [ workflowOperation({ operationId: 'replaceWorkflowState', summary: 'Replace Workflow State', - description: `Replace a workflow\u2019s editable draft graph wholesale. \`loops\` and \`parallels\` are accepted but ignored — both are recomputed from \`blocks\`. Omitting \`variables\` leaves the stored variables untouched.\n\nLast write wins: concurrent writers are serialized by a row lock, so each lands a complete self-consistent graph and the later one replaces the earlier entirely. There is no partially-written state. Ids are the one conflict that is detected: block, edge, and subflow ids are globally unique, so a body carrying an id another workflow already owns is refused with \`409\` rather than written.\n\nThis does not change what the deployed endpoint serves. Deployments are immutable versioned snapshots, and no schedule or webhook registration is touched. The only visible consequence is that \`needsRedeployment\` becomes true; \`POST /workflows/{workflowId}/deploy\` publishes the draft.\n\n\`lint\` is advisory and never blocks the write. \`lint.fieldIssues\` is the most actionable part for a headless builder — it names blocks missing a required field, which fail at run time — and \`lint.unresolvedReferences\` names credential, resource, tool, and skill values that do not resolve. ${WORKSPACE_API_KEY_DENIED}\n\nSet \`?dryRun=true\` to validate and lint without persisting: nothing is written, no audit entry is recorded, and collaborators are not notified. The response carries the same shape and the same validation and \`lint\` findings the committed write would, with \`dryRun: true\` — including the warnings the write\u2019s own preparation step raises, and the same \`409\` when an id is already owned by another workflow. Only \`needsRedeployment\` differs: it describes the state before the write.`, + description: + 'Atomically replace the editable draft graph. Concurrent writes are row-locked and last-write-wins; no partial state is stored. `loops` and `parallels` are recomputed from `blocks`; omitted `variables` remain unchanged. Foreign ids return `409`. This leaves deployment unchanged and marks the draft for redeployment; lint is advisory. `dryRun=true` runs the same validation, lint, and conflict checks without persistence, audit, or notification; `needsRedeployment` reflects pre-write state. Workspace keys are rejected; use personal keys or OAuth.', errors: RESOURCE_MUTATION_ERRORS, success: jsonSuccess('The draft graph was replaced.'), }), @@ -364,7 +365,8 @@ const declaredRoutes = [ workflowOperation({ operationId: 'applyWorkflowOperations', summary: 'Apply Workflow Operations', - description: `Apply a batch of semantic edits — add, edit, delete, and subflow membership changes — to a workflow graph, plus an optional set of block enable/disable changes.\n\nBest-effort per operation, atomic per write. The engine applies what it can to an in-memory graph and reports the rest in \`skipped\`, each with a machine-readable \`type\`; exactly one write of the fully-resolved graph then happens, so there is never a partially-applied graph. \`deferred\` is **not** a failure list: a forward-referencing edge is wired automatically once its target block exists, in this batch or a later one, so re-issuing a deferred edge is wrong.\n\nSet \`atomic\` to fail closed: any genuine skipped item, or any block input that would be dropped rather than persisted, then aborts before the write and answers \`409\` with \`error.details.code: "OPERATIONS_NOT_APPLIED"\`, the same \`skipped\` array, and a \`droppedInputs\` array, having persisted nothing.\n\nA \`block_id\` you supply on an \`add\` or \`insert_into_subflow\` is only a label unless it is already a UUID: the engine mints one and returns the pairing in \`mintedBlockIds\`. References between operations in the same batch are remapped for you, so \`triage\` can be wired up in the same call it is created in — but a later request must use the minted id. Send your own UUIDs when you want an id you chose to survive across requests.\n\nOperation \`params\` is an open object because the accepted inputs come from the block registry, not from this contract — see the per-operation schemas for the envelope: \`inputs\` keyed by sub-block id, with \`retry\`, \`triggerMode\` and \`advancedMode\` beside it rather than inside it, and \`connections\` keyed by source handle. \`GET /blocks/{blockId}\` publishes the inputs a given block type accepts. The Agent block’s \`inputs.tools\` value is the important exception to that open catalog shape: it is published here as the named \`AgentToolInput\` union, covering catalog integrations, workspace custom tools, and MCP tools.\n\n\`lint\` is advisory and never blocks the write. \`lint.fieldIssues\` is the most actionable part for a headless builder — it names blocks missing a required field, which fail at run time — and \`lint.unresolvedReferences\` names credential, resource, tool, and skill values that do not resolve. Those values stay persisted; only \`inputValidationErrors\` lists inputs that were actually dropped.\n\nAs with \`PUT /workflows/{workflowId}/state\`, this changes only the draft; deploy to publish it. ${WORKSPACE_API_KEY_DENIED}\n\nSet \`?dryRun=true\` to validate and lint without persisting: nothing is written, no audit entry is recorded, and collaborators are not notified. The response carries the same shape and the same validation and \`lint\` findings the committed write would, with \`dryRun: true\` — including the warnings the write\u2019s own preparation step raises, and the same \`409\` when an id is already owned by another workflow. Only \`needsRedeployment\` differs: it describes the state before the write.`, + description: + 'Apply graph edits and optional block enablement in one atomic write. Failed operations appear in `skipped`; `deferred` edges resolve when targets exist and must not be retried. With `atomic`, any skip or dropped input returns `409` with `OPERATIONS_NOT_APPLIED` and persists nothing. Non-UUID labels are minted and same-batch references remapped in `mintedBlockIds`. Lint is advisory. `dryRun=true` runs the same checks without persistence, audit, or notification. This changes only the draft. Workspace keys are rejected; use personal keys or OAuth.', errors: RESOURCE_MUTATION_ERRORS, success: jsonSuccess('The batch was applied.'), }), @@ -717,7 +719,7 @@ const declaredRoutes = [ workflowOperation({ operationId: 'revertWorkflowVersion', summary: 'Revert Workflow To Version', - description: `Overwrite the editable draft with the graph pinned by a deployment version, discarding every unsaved edit. This is the most destructive operation in the deployment family and it does **not** change what is live — to move production, use \`activate\` or \`rollback\`, both of which leave the draft alone. Pass \`active\` as the version to discard draft edits and return to the live graph. ${WORKSPACE_API_KEY_DENIED}`, + description: `Overwrite the editable draft with a deployment version, irreversibly discarding unsaved edits. This does not change the live version; use \`activate\` or \`rollback\` for production, both of which leave the draft unchanged. Pass \`active\` to reset the draft to the live graph. ${WORKSPACE_API_KEY_DENIED}`, errors: [...RESOURCE_ERRORS, 'Conflict', 'PayloadTooLarge', 'Locked'], success: jsonSuccess('The draft after it was overwritten.'), }), @@ -739,7 +741,7 @@ const declaredRoutes = [ workflowOperation({ operationId: 'getWorkflowDeployment', summary: 'Get Workflow Deployment', - description: `Read the current deployment state of a workflow: whether a version is live, when it went live, the most recent deployment attempt with its readiness and failure payload, and whether the editable draft has since diverged from the live version. This is the only operation that publishes \`needsRedeployment\` and \`isPublicApi\`.\n\n\`isPublicApi\` is the security-relevant one: while it is \`true\` the deployed workflow executes without an API key, so anyone holding the execution URL can run it — and consume the workspace’s billed usage — anonymously. It is set through \`PATCH /workflows/{workflowId}/deployment\`, and this read is the only way to audit whether it is on.\n\n${WORKFLOW_DEPLOYMENT_VS_CHAT}`, + description: `Read the live version, latest deployment attempt and readiness, draft drift (\`needsRedeployment\`), and \`isPublicApi\`. When \`isPublicApi\` is true, anyone with the execution URL can run and consume billed usage without an API key; change it with \`PATCH /workflows/{workflowId}/deployment\`. ${WORKFLOW_DEPLOYMENT_VS_CHAT}`, errors: RESOURCE_ERRORS, success: jsonSuccess('The current deployment state.'), }), @@ -932,7 +934,7 @@ const declaredRoutes = [ workflowOperation({ operationId: 'exportWorkflow', summary: 'Export Workflow', - description: `Export a portable, secret-sanitized workflow. Workspace-scoped bindings must be selected again after import. Exporting records an audit event, so it is not a safe read. ${HEAD_MIRRORS_GET} ${FOLDER_TREE_TOO_LARGE}`, + description: `Export a portable, secret-sanitized workflow; workspace-scoped bindings must be selected again after import. Exporting records an audit event. ${HEAD_MIRRORS_GET} ${FOLDER_TREE_TOO_LARGE}`, errors: [...RESOURCE_ERRORS, 'PayloadTooLarge'], success: jsonSuccess('The workflow export payload.'), }), @@ -1002,7 +1004,7 @@ const declaredRoutes = [ operationId: 'listChatDeployments', summary: 'List Chat Deployments', description: - 'List the workflows a workspace has published as hosted chats. Each entry carries the public `url` a visitor uses — there is no chat subdomain, the identifier is a path segment.\n\nThis is the only chat path not addressed under a workflow, and deliberately so: every chat is a singleton of the workflow it publishes, but "what does this workspace serve" is a question no per-workflow path can answer. Filter by `workflowId` to resolve one workflow\'s chat without holding its id.\n\nEntries are deliberately narrower than the singleton read: `allowedEmails`, `hasPassword`, and `customizations` are available only from `GET /api/v2/workflows/{workflowId}/deployments/chat`, which requires workspace `admin`. That is what keeps this list callable at workspace `read` and by a workspace API key. A stored password is never returned by either.', + 'List hosted chats in a workspace with opaque cursor pagination. Filter by `workflowId` to resolve one workflow’s singleton chat. Each item includes its public URL, whose identifier is a path segment, but omits `allowedEmails`, `hasPassword`, and `customizations`; read those through the admin-only singleton endpoint. This list requires workspace read access and accepts workspace API keys. Stored passwords are never returned.', errors: RESOURCE_ERRORS, success: jsonSuccess('A page of chat deployments.'), }), @@ -1022,7 +1024,7 @@ const declaredRoutes = [ workflowOperation({ operationId: 'getWorkflowChatDeployment', summary: 'Get Workflow Chat Deployment', - description: `Read the hosted chat a workflow is published as. Answers \`404\` when the workflow publishes no chat. ${CHAT_VS_WORKFLOW_DEPLOYMENT} The stored password is never returned — \`hasPassword\` reports only whether one is set. This carries the visitor gate — \`authType\`, \`hasPassword\`, and the \`allowedEmails\` allow-list — so it requires workspace \`admin\`, unlike the workspace-wide list. ${WORKSPACE_API_KEY_DENIED}`, + description: `Read a workflow’s singleton hosted chat, or return \`404\` when none exists. ${CHAT_VS_WORKFLOW_DEPLOYMENT} The password is never returned; \`hasPassword\` reports its presence. Visitor-gate fields (\`authType\`, \`hasPassword\`, and \`allowedEmails\`) require workspace admin access. ${WORKSPACE_API_KEY_DENIED}`, errors: RESOURCE_ERRORS, success: jsonSuccess("The workflow's chat deployment."), }), @@ -1043,7 +1045,7 @@ const declaredRoutes = [ workflowOperation({ operationId: 'replaceWorkflowChatDeployment', summary: 'Create or Replace Workflow Chat Deployment', - description: `Publish a workflow as a hosted chat, or replace the chat it already publishes. ${CHAT_VS_WORKFLOW_DEPLOYMENT}\n\n**Replace, not merge.** The chat ends up as exactly what the body describes: an omitted optional field takes its platform default rather than whatever the previous chat carried, so sending the same body twice leaves the same result. \`password\` is therefore required whenever \`authType\` is \`"password"\` and rejected otherwise — it is write-only and never readable back, so carrying one over implicitly is the one place a replace would quietly stop meaning replace. \`allowedEmails\` follows the same rule: required and non-empty for \`"email"\` and \`"sso"\`, rejected for the modes that admit no allow-list. \`customizations\` is the one documented exception: it merges per field, so an omitted \`imageUrl\` keeps the stored one rather than clearing it, and customization keys this surface does not declare do not survive the write. That behaviour is shared with the in-app editor and the Copilot deploy tool, which both send partial objects.\n\nThis also deploys the workflow, because a chat serves the live version: a draft that has drifted is republished as part of the call. Two conditions answer \`409\` — an \`identifier\` another live chat already holds, and a workflow deployment attempt still preparing, which the caller can retry once it becomes active. \`authType: "public"\` leaves the chat open to anyone holding the URL. ${WORKSPACE_API_KEY_DENIED}`, + description: `Create or replace hosted chat. Omitted fields reset to defaults except per-field \`customizations\`. \`password\` is write-only and required for password auth; \`allowedEmails\` is required and non-empty for email or SSO. This also deploys the draft. A duplicate identifier or pending deployment returns \`409\`; public auth exposes the URL. ${CHAT_VS_WORKFLOW_DEPLOYMENT} Workspace keys are rejected; use personal keys or OAuth.`, errors: [...RESOURCE_ERRORS, 'Conflict', 'PayloadTooLarge', 'Locked'], success: jsonSuccess('The published chat deployment.'), }), @@ -1086,7 +1088,7 @@ const declaredRoutes = [ workflowOperation({ operationId: 'executeWorkflowV2', summary: 'Execute Workflow', - description: `Execute the active deployment by default, or select manual execution of the current saved workflow state with \`run.source: "manual"\`. Manual runs require a personal API key or OAuth token with current write access and support synchronous or Server-Sent Event execution only; workspace keys, anonymous public access, and async manual runs are rejected. A manual run can enter through one runnable trigger (including external integration/webhook triggers) or resume at a named block from the exact same-workflow run identified by \`sourceRunId\`; the server loads that run's persisted snapshot, which is never accepted from the request. Omit a trigger block id only when the saved workflow has exactly one runnable trigger. Public deployed workflows permit anonymous synchronous and streaming execution, while asynchronous deployed execution requires an API credential. A synchronous run that exceeds its execution timeout returns HTTP 200 with \`status: "failed"\` and \`error.code: "TIMEOUT"\` rather than an HTTP error, so branch on \`status\`. ${EXECUTE_OPTION_CONSTRAINTS}`, + description: `Execute the deployment, or use \`run.source: "manual"\` for draft state. Manual runs require a personal key or OAuth write access; workspace keys, anonymous callers, and async mode are rejected. Start at a runnable trigger, or resume from \`sourceRunId\` using the same-workflow snapshot. Public deployments allow anonymous sync or streaming; async requires credentials. Sync timeouts return \`200\` with failed status and \`TIMEOUT\`. ${EXECUTE_OPTION_CONSTRAINTS}`, errors: [ 'BadRequest', 'Unauthorized', @@ -1166,7 +1168,7 @@ const declaredRoutes = [ workflowRunOperation({ operationId: 'getWorkflowRunV2', summary: 'Get Workflow Run', - description: `Get current workflow run state, optionally including final and block outputs. With \`includeOutput\`, \`files\` lists the files the run produced, each with a \`downloadPath\`; add \`includeFileBase64\` to inline their bytes, which answers \`413\` naming the download path when a single file, or the run's inlined total, exceeds the 16 MiB ceiling. Because inlining reads object storage, this \`GET\` is not a safe read. ${HEAD_MIRRORS_GET}`, + description: `Get current run state with optional final and block outputs. With \`includeOutput\`, \`files\` includes download paths; \`includeFileBase64\` reads object storage to inline bytes and returns \`413\` with the download path when one file or the total exceeds 16 MiB. ${HEAD_MIRRORS_GET}`, errors: [...RESOURCE_CONFLICT_ERRORS, 'PayloadTooLarge'], success: jsonSuccess('The workflow run status.'), }), @@ -1214,7 +1216,7 @@ const declaredRoutes = [ workflowRunOperation({ operationId: 'downloadWorkflowRunFileV2', summary: 'Download Workflow Run File', - description: `Download one file a run produced. The run resource reports the files a run emitted; address one of them by its \`id\` here. Run output carries \`/api/files/serve/...\` URLs that reject API keys, so this is the byte path out of a run for an API-key caller. Execution objects are not retained indefinitely, so a \`404\` for a file an older run produced is expected rather than a fault. ${RUN_RETENTION} Downloading records an audit event, so it is not a safe read. ${HEAD_MIRRORS_GET} ${HEAD_OMITS_PAYLOAD_HEADERS}`, + description: `Download one run-produced file by id. Downloads record an audit event. ${RUN_RETENTION} ${HEAD_MIRRORS_GET} ${HEAD_OMITS_PAYLOAD_HEADERS}`, errors: [...RESOURCE_CONFLICT_ERRORS], success: { description: 'The run file bytes.', diff --git a/apps/sim/lib/api/contracts/v2/shared.ts b/apps/sim/lib/api/contracts/v2/shared.ts index fd594f14f90..a113a094958 100644 --- a/apps/sim/lib/api/contracts/v2/shared.ts +++ b/apps/sim/lib/api/contracts/v2/shared.ts @@ -1,10 +1,7 @@ import { z } from 'zod' import { workspaceIdSchema } from '@/lib/api/contracts/primitives' import { LIST_SORT_ORDERS, type ListSortOrder } from '@/lib/api/list-query' -import { - FORBIDDEN_DETAIL_CODE_DESCRIPTIONS, - FORBIDDEN_DETAIL_CODES, -} from '@/lib/core/application/forbidden' +import { FORBIDDEN_DETAIL_CODES } from '@/lib/core/application/forbidden' import { FolderPathError, MAX_FOLDER_PATH_BYTES, @@ -186,6 +183,21 @@ export const v2ResourceWebUrlSchema = z .url() .describe('Canonical absolute URL for opening this resource in the Sim web application.') +export const v2ForbiddenDetailCodeSchema = z.enum(FORBIDDEN_DETAIL_CODES).meta({ + id: 'V2ForbiddenDetailCode', + title: 'Forbidden detail code', + description: 'Stable cause code for an actionable `403` response.', +}) + +const v2ActionableForbiddenDetailsSchema = z + .object({ code: v2ForbiddenDetailCodeSchema }) + .catchall(z.unknown().describe('Additional context for this refusal.')) + .meta({ + id: 'V2ActionableForbiddenDetails', + title: 'Actionable forbidden details', + description: 'Machine-readable cause and optional context for an actionable `403` response.', + }) + /** Canonical v2 error envelope. */ export const v2ErrorResponseSchema = z.object({ error: z @@ -193,15 +205,13 @@ export const v2ErrorResponseSchema = z.object({ code: z.string().describe('Stable machine-readable error code.'), message: z.string().describe('Human-readable explanation of the error.'), details: z - .unknown() + .union([ + v2ActionableForbiddenDetailsSchema, + z.unknown().describe('Other structured context defined by the specific error.'), + ]) .optional() .describe( - [ - 'Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:', - ...FORBIDDEN_DETAIL_CODES.map( - (code) => `- \`${code}\` — ${FORBIDDEN_DETAIL_CODE_DESCRIPTIONS[code]}` - ), - ].join('\n') + 'Structured error context whose keys depend on the error. Actionable `403` responses use the `V2ActionableForbiddenDetails` shape; validation failures may return issue arrays instead.' ), }) .describe('Canonical error details.'), diff --git a/apps/sim/lib/api/contracts/v2/uploads.ts b/apps/sim/lib/api/contracts/v2/uploads.ts index 4cc7ad15961..c9d8b506f66 100644 --- a/apps/sim/lib/api/contracts/v2/uploads.ts +++ b/apps/sim/lib/api/contracts/v2/uploads.ts @@ -38,7 +38,7 @@ export const v2OptionalUploadTokenHeadersSchema = z.object({ * contract. */ const TRANSFER_STEP_CONTRACT = - 'Send the bytes with `PUT` to this URL, including exactly the headers in `headers` and nothing that alters the body. The URL is signed and self-describing — construct it from this field only, never by hand.\n\n**Where this URL points depends on the deployment, and so does what answers you.** When Sim stores objects itself the URL is Sim\'s own data plane: success is `204` with an empty body, and a failure is the same `{ "error": { "code", "message" } }` envelope as every other v2 response — `400` when the body does not match the size or content type the session was created for, `403` when the token is invalid, expired, or belongs to another session, and `409` when the session is no longer accepting bytes. When object storage is configured — S3, Google Cloud Storage, or Azure Blob — the URL is that provider\'s own presigned URL, and the provider answers directly: treat **any `2xx` as success** (S3 and GCS answer `200`, Azure `201`), and on failure expect the provider\'s error document, typically XML, not the v2 envelope. Do not branch on `204` and do not parse a failure as JSON.' + 'Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML.' export const v2PutUploadTransferSchema = z .object({ @@ -104,7 +104,7 @@ export const v2UploadPartUrlSchema = z .string() .url() .describe( - `Signed URL for this upload part. ${TRANSFER_STEP_CONTRACT}\n\nYou do not need to retain the \`ETag\` each part upload returns. Unlike a raw S3 multipart flow, completion takes no request body: Sim lists the uploaded parts from the provider itself and reads their entity tags there, so \`POST .../complete\` only has to happen after every part has been sent.` + `Signed URL for this upload part. ${TRANSFER_STEP_CONTRACT} Do not retain part \`ETag\` values; after every part succeeds, call the completion endpoint without a request body.` ), headers: z .record(z.string(), z.string()) diff --git a/apps/sim/lib/api/contracts/v2/workflows.ts b/apps/sim/lib/api/contracts/v2/workflows.ts index 2a2e828361b..e19bd0d0990 100644 --- a/apps/sim/lib/api/contracts/v2/workflows.ts +++ b/apps/sim/lib/api/contracts/v2/workflows.ts @@ -1257,14 +1257,14 @@ export const v2ExecuteWorkflowBodySchema = z run: v2WorkflowRunSelectionSchema .optional() .describe( - 'Workflow state and entry point to execute. Omit for the active deployment. Manual execution requires a personal API key with write access and supports synchronous or streamed runs only.' + 'Workflow state and entry point to execute. Omit for the active deployment. Manual execution requires OAuth or personal-key write access and supports synchronous or streamed runs only.' ), async: z .boolean() .optional() .default(false) .describe( - 'Queue the run and return a 202 receipt when true. Requires an API key, cannot be combined with `stream`, and rejects all streaming and output-shaping options (`selectedOutputs`, `includeThinking`, `includeToolCalls`, `includeFileBase64`, `base64MaxBytes`).' + 'Queue the run and return a 202 receipt when true. Requires an OAuth access token or API key, cannot be combined with `stream`, and rejects all streaming and output-shaping options (`selectedOutputs`, `includeThinking`, `includeToolCalls`, `includeFileBase64`, `base64MaxBytes`).' ), /** * An upper bound on the request, not the effective timeout: the server @@ -2631,12 +2631,9 @@ export type V2WorkflowSkippedItem = z.output * not describe it differently. */ const WORKFLOW_OPERATION_PARAM_ENVELOPE = - "`inputs` carries the block's own configuration keyed by sub-block id, for example " + - '`inputs: { model: "gpt-4o", systemPrompt: "..." }` — never wrapped in `subBlocks`. ' + - 'Block-level settings sit beside `inputs`, never inside it: `retry`, `triggerMode`, ' + - '`advancedMode`. `connections` is keyed by source handle and each value is a target ' + - 'block id, `{ block, handle }`, or an array of either; `success` is accepted as an ' + - 'alias for the `source` handle.' + '`inputs` maps sub-block ids directly to values, never through `subBlocks`. Keep `retry`, ' + + '`triggerMode`, and `advancedMode` beside `inputs`. `connections` maps source handles to ' + + 'target ids, `{ block, handle }`, or arrays; `success` aliases `source`.' const v2AgentToolUsageControlSchema = z .enum(['auto', 'force', 'none']) @@ -2934,12 +2931,9 @@ const v2WorkflowOperationParamsSchema = z ) ) .describe( - 'Fields to change on the target block. Send only what changes. Accepted keys: `inputs`, ' + - '`name`, `connections`, `removeEdges`, `nestedNodes`, `retry`, `triggerMode`, ' + - `\`advancedMode\`. ${WORKFLOW_OPERATION_PARAM_ENVELOPE} Re-sending \`connections\` ` + - "replaces that block's outgoing edges, so use `removeEdges` — " + - '`[{ targetBlockId, sourceHandle? }]`, `sourceHandle` defaulting to `source` — to drop ' + - 'one edge without restating the rest.' + 'Patch only supplied fields: `inputs`, `name`, `connections`, `removeEdges`, `nestedNodes`, ' + + `\`retry\`, \`triggerMode\`, and \`advancedMode\`. ${WORKFLOW_OPERATION_PARAM_ENVELOPE} ` + + 'Re-sending `connections` replaces outgoing edges; use `removeEdges` to delete selected edges.' ) const v2AddWorkflowBlockParamsSchema = z @@ -2956,8 +2950,8 @@ const v2AddWorkflowBlockParamsSchema = z }) .catchall(z.unknown().describe('One block-specific input or connection descriptor.')) .describe( - 'Block type and name, plus any block-specific configuration. Beyond `type` and `name` the ' + - 'accepted keys are `inputs`, `connections`, `retry`, `triggerMode`, and `advancedMode`. ' + + 'Block `type`, `name`, and optional `inputs`, `connections`, `retry`, `triggerMode`, or ' + + '`advancedMode`. ' + WORKFLOW_OPERATION_PARAM_ENVELOPE ) @@ -2989,8 +2983,7 @@ const v2InsertIntoSubflowParamsSchema = z }) .catchall(z.unknown().describe('One block-specific input or connection descriptor.')) .describe( - 'Container, block type and name, plus any block-specific configuration. Takes the same ' + - 'keys as an `add`: `inputs`, `connections`, `retry`, `triggerMode`, `advancedMode`. ' + + 'Container, block `type`, `name`, and the same optional fields as `add`. ' + WORKFLOW_OPERATION_PARAM_ENVELOPE ) @@ -3163,7 +3156,7 @@ export const v2ApplyWorkflowOperationsDataSchema = v2WorkflowGraphWriteResultSch mintedBlockIds: z .record(z.string(), z.string().describe('The id the block was actually given.')) .describe( - 'The id each newly created block was actually given, keyed by the `block_id` you asked for, and present only for the ones that differ. A `block_id` on an `add` or `insert_into_subflow` that is not already a UUID is replaced with a minted one, so this is how you learn what to reference afterwards. Within a single batch you can keep using your own ids — references between operations are remapped for you — but a later request must use the minted id, so send your own UUIDs when you want an id you chose to survive.' + 'Minted block ids keyed by requested `block_id`, present only when they differ. References within this batch are remapped automatically; later requests must use the minted id. Supply a UUID when the requested id must survive unchanged.' ), lint: v2WorkflowLintSchema, dryRun: z diff --git a/apps/sim/lib/api/contracts/workspaces.ts b/apps/sim/lib/api/contracts/workspaces.ts index c07147fcbc4..ff4e201de94 100644 --- a/apps/sim/lib/api/contracts/workspaces.ts +++ b/apps/sim/lib/api/contracts/workspaces.ts @@ -253,7 +253,7 @@ export const deploymentFeaturesSchema = z.object({ dataDrains: z.boolean(), dataRetention: z.boolean(), inbox: z.boolean(), - /** Sim is an OAuth 2.1 provider: a deployment toggle rather than an enterprise entitlement. */ + /** Sim's OAuth provider is a deployment toggle rather than an enterprise entitlement. */ oauthProvider: z.boolean(), sandboxes: z.boolean(), sessionPolicies: z.boolean(), diff --git a/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts b/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts index 0ea05e11b35..457e952db5c 100644 --- a/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts +++ b/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts @@ -296,6 +296,7 @@ describe('v2 bearer token authentication', () => { ) expect(missing).toBeInstanceOf(V2ApiKeyUnauthenticatedError) expect(missing.challenge).toBe('api_key') + expect(missing.message).toBe('API key or OAuth access token required') }) it('refuses a token whose client was disabled', async () => { diff --git a/apps/sim/lib/api/server/routes/v2-api-key-auth.ts b/apps/sim/lib/api/server/routes/v2-api-key-auth.ts index dbb3a9f439b..2c6c72e4104 100644 --- a/apps/sim/lib/api/server/routes/v2-api-key-auth.ts +++ b/apps/sim/lib/api/server/routes/v2-api-key-auth.ts @@ -201,5 +201,5 @@ export async function authenticateV2ApiKey( if (credential.malformedOAuthBearer) { throw new V2ApiKeyUnauthenticatedError('Invalid access token', 'bearer') } - throw new V2ApiKeyUnauthenticatedError('API key required') + throw new V2ApiKeyUnauthenticatedError('API key or OAuth access token required') } diff --git a/apps/sim/lib/api/server/routes/v2-json-route.test.ts b/apps/sim/lib/api/server/routes/v2-json-route.test.ts index f1fd1f7c48a..0f797c5082d 100644 --- a/apps/sim/lib/api/server/routes/v2-json-route.test.ts +++ b/apps/sim/lib/api/server/routes/v2-json-route.test.ts @@ -232,14 +232,14 @@ describe('defineV2JsonRoute', () => { it('renders invalid credentials as 401 without continuing admission', async () => { v2RouteMocks.authenticate.mockRejectedValueOnce( - new MockV2ApiKeyUnauthenticatedError('API key required') + new MockV2ApiKeyUnauthenticatedError('API key or OAuth access token required') ) const response = await createHandler()(request()) expect(response.status).toBe(401) await expect(response.json()).resolves.toEqual({ - error: { code: 'UNAUTHORIZED', message: 'API key required' }, + error: { code: 'UNAUTHORIZED', message: 'API key or OAuth access token required' }, }) expect(v2RouteMocks.operationRate).not.toHaveBeenCalled() }) diff --git a/apps/sim/lib/auth/auth.ts b/apps/sim/lib/auth/auth.ts index 24df76b6ed4..97af0db6a49 100644 --- a/apps/sim/lib/auth/auth.ts +++ b/apps/sim/lib/auth/auth.ts @@ -7,8 +7,13 @@ import * as schema from '@sim/db/schema' import { createLogger } from '@sim/logger' import { getErrorMessage, toError } from '@sim/utils/errors' import { type BetterAuthOptions, betterAuth, type User } from 'better-auth' -import { drizzleAdapter } from 'better-auth/adapters/drizzle' -import { APIError, createAuthMiddleware, getOAuthState, getSessionFromCtx } from 'better-auth/api' +import { + APIError, + createAuthMiddleware, + getOAuthState, + getSessionFromCtx, + setShouldSkipSessionRefresh, +} from 'better-auth/api' import { deleteSessionCookie, setSessionCookie } from 'better-auth/cookies' import { nextCookies } from 'better-auth/next-js' import { @@ -52,9 +57,9 @@ import { import { getSessionCookieCacheVersion } from '@/lib/auth/security-policy' import { clampExpiryForSession } from '@/lib/auth/session-policy' import { getActiveOrganizationId } from '@/lib/auth/session-response' +import { createSimAuthAdapter } from '@/lib/auth/sim-auth-adapter' import { admitSsoUser } from '@/lib/auth/sso/application/admit-sso-user' import { resolveSsoCallbackProviderId } from '@/lib/auth/sso/callback-provider' -import { guardSubscriptionPlanWrites } from '@/lib/auth/stripe-adapter-guard' import { sendPlanWelcomeEmail } from '@/lib/billing' import { assertPersonalCheckoutAllowed, @@ -242,13 +247,7 @@ export const auth = betterAuth({ ...(env.NEXT_PUBLIC_SOCKET_URL ? [env.NEXT_PUBLIC_SOCKET_URL] : []), ...additionalTrustedOrigins, ].filter(Boolean), - database: (options: BetterAuthOptions) => - guardSubscriptionPlanWrites( - drizzleAdapter(db, { - provider: 'pg', - schema, - })(options) - ), + database: (options: BetterAuthOptions) => createSimAuthAdapter(options), session: { cookieCache: { enabled: true, @@ -950,6 +949,14 @@ export const auth = betterAuth({ }, hooks: { before: createAuthMiddleware(async (ctx) => { + /** + * Better Auth 1.6.27 re-enters OAuth authorization when its own session + * refresh sets a cookie, issuing a second code that is never returned. + * Suppressing sliding renewal only for this request prevents the orphan; + * the next ordinary session request can still renew the same session. + */ + if (ctx.path === '/oauth2/authorize') await setShouldSkipSessionRefresh(true) + /** * Restrict the unauthenticated sign-in endpoints to first-party login * providers. Better Auth registers every generic-OAuth integration @@ -1299,14 +1306,15 @@ export const auth = betterAuth({ config: buildConnectorProviders(), }), /** - * Sim as an OAuth 2.1 authorization server (auth-code + PKCE, refresh + * Sim as an OAuth 2.0 authorization server (auth-code + PKCE, refresh * rotation). Tokens are opaque and stored hashed, so revoking an app in - * settings takes effect on the next request. `sim logout` revokes the - * current refresh/access pair; access tokens issued before an earlier - * rotation remain valid until their one-hour expiry. `disableJwtPlugin` - * keeps the JWKS machinery out until a third-party resource server needs - * it. Clients are DB rows only (the CLI is seeded by migration, the rest - * are admin-created), so both registration paths stay closed. + * settings takes effect on the next request. `sim logout` deletes the + * stable family for that login, including access tokens issued before an + * earlier rotation. This is an OAuth API-authorization surface, not an + * OpenID Connect identity provider; `disableJwtPlugin` keeps JWT/JWKS and + * ID-token semantics out of the advertised protocol. Clients are DB rows + * only (the CLI is seeded by migration, the rest are admin-created), so + * both registration paths stay closed. */ ...(isOAuthProviderEnabled ? [ @@ -1340,19 +1348,15 @@ export const auth = betterAuth({ clientPrivileges: () => false, /** * Opaque access tokens let Settings revoke every token for an app - * on the next request. `sim logout` revokes only the access token - * paired with the current refresh token; an access token from an - * earlier rotation can remain valid until it expires. A JWT would - * stay valid until it lapsed regardless of either database delete. + * on the next request and let `sim logout` revoke one independent + * login family, including access tokens from earlier rotations. A + * JWT would remain valid until it lapsed regardless of the delete. * - * The cost is that client secrets are stored reversibly: with no - * JWKS, the plugin signs ID tokens with the client secret and so - * has to be able to read it back. `storeClientSecret` is left at - * the plugin's default of `encrypted` for that reason — setting it - * to `hashed` here is refused at construction, which would take - * the whole app down on boot. Secrets are encrypted under - * `BETTER_AUTH_SECRET`; `create-oauth-client.ts` writes them the - * same way. + * Better Auth requires reversibly encrypted client secrets in its + * disabled-JWT mode; selecting `hashed` is refused at provider + * construction. `storeClientSecret` therefore stays at the + * plugin's `encrypted` default, under `BETTER_AUTH_SECRET`, and + * `create-oauth-client.ts` writes secrets the same way. */ disableJwtPlugin: true, storeTokens: { hash: hashOAuthToken }, diff --git a/apps/sim/lib/auth/oauth-access-token.test.ts b/apps/sim/lib/auth/oauth-access-token.test.ts index b8983c31344..9f51b181be0 100644 --- a/apps/sim/lib/auth/oauth-access-token.test.ts +++ b/apps/sim/lib/auth/oauth-access-token.test.ts @@ -18,10 +18,11 @@ function row(overrides: Record = {}) { id: 'token-1', userId: 'user-1', clientId: 'sim-cli', - scopes: ['openid', 'api:read'], + scopes: ['offline_access', 'api:read'], expiresAt: new Date(Date.now() + 60_000), clientDisabled: false, userBanned: false, + userBanExpires: null, userExists: 'user-1', ...overrides, } @@ -78,7 +79,7 @@ describe('verifyOAuthAccessToken', () => { userId: 'user-1', clientId: 'sim-cli', tokenId: 'token-1', - scopes: ['openid', 'api:read'], + scopes: ['offline_access', 'api:read'], expiresAt: expect.any(Date), }) expect(dbChainMockFns.where).toHaveBeenCalledOnce() @@ -105,6 +106,11 @@ describe('verifyOAuthAccessToken', () => { queueTableRows(schemaMock.oauthAccessToken, [row({ userBanned: true })]) expect(await reason('sim_oat_x')).toBe('user_banned') + + queueTableRows(schemaMock.oauthAccessToken, [ + row({ userBanned: true, userBanExpires: new Date(Date.now() - 1) }), + ]) + await expect(verifyOAuthAccessToken('sim_oat_x')).resolves.toMatchObject({ userId: 'user-1' }) }) it('propagates a store failure rather than reporting an invalid token', async () => { diff --git a/apps/sim/lib/auth/oauth-access-token.ts b/apps/sim/lib/auth/oauth-access-token.ts index 9ad657bda57..f38e3881e6a 100644 --- a/apps/sim/lib/auth/oauth-access-token.ts +++ b/apps/sim/lib/auth/oauth-access-token.ts @@ -4,6 +4,7 @@ import { oauthAccessToken, oauthClient, user } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { sha256Hex } from '@sim/security/hash' import { eq } from 'drizzle-orm' +import { isBanActive } from '@/lib/auth/ban' import { OAUTH_ACCESS_TOKEN_PREFIX } from '@/lib/auth/oauth-provider' const logger = createLogger('OAuthAccessToken') @@ -88,6 +89,7 @@ export async function verifyOAuthAccessToken(token: string): Promise { + it('matches exact callbacks and permits only loopback port variance', () => { + expect(oauthRedirectUriMatches('https://app.test/callback', 'https://app.test/callback')).toBe( + true + ) + expect( + oauthRedirectUriMatches('http://127.0.0.1/callback', 'http://127.0.0.1:43123/callback') + ).toBe(true) + expect( + oauthRedirectUriMatches('http://127.2.3.4/callback', 'http://127.2.3.4:43123/callback') + ).toBe(true) + expect(oauthRedirectUriMatches('http://[::1]/callback', 'http://[::1]:43123/callback')).toBe( + true + ) + expect(oauthRedirectUriMatches('https://app.test/callback', 'https://evil.test/callback')).toBe( + false + ) + expect( + oauthRedirectUriMatches( + 'https://127.attacker.example/callback', + 'https://127.attacker.example:43123/callback' + ) + ).toBe(false) + expect(oauthRedirectUriMatches('http://127.0.0.1/callback', 'http://127.0.0.1/other')).toBe( + false + ) + }) +}) + +describe('oauthAuthorizationErrorResponse', () => { + beforeEach(resetDbChainMock) + + it('redirects a registered callback with the original state', async () => { + queueTableRows(schemaMock.oauthClient, [ + { disabled: false, redirectUris: ['http://127.0.0.1/callback'] }, + ]) + + const response = await oauthAuthorizationErrorResponse( + request([ + ['client_id', 'sim-cli'], + ['redirect_uri', 'http://127.0.0.1:43123/callback'], + ['state', 'state-1'], + ]), + 'invalid_request', + 'Code challenge is invalid.' + ) + const location = new URL(response.headers.get('location') ?? '') + + expect(response.status).toBe(302) + expect(response.headers.get('cache-control')).toBe('no-store') + expect(location.origin).toBe('http://127.0.0.1:43123') + expect(location.searchParams.get('error')).toBe('invalid_request') + expect(location.searchParams.get('error_description')).toBe('Code challenge is invalid.') + expect(location.searchParams.get('state')).toBe('state-1') + expect(location.searchParams.get('iss')).toMatch(/\/api\/auth$/) + }) + + it.each([ + ['missing client', undefined], + ['disabled client', { disabled: true, redirectUris: ['https://app.test/callback'] }], + ['unregistered callback', { disabled: false, redirectUris: ['https://app.test/other'] }], + ])('does not redirect a %s', async (_case, client) => { + if (client) queueTableRows(schemaMock.oauthClient, [client]) + + const response = await oauthAuthorizationErrorResponse( + request([ + ['client_id', 'client-1'], + ['redirect_uri', 'https://app.test/callback'], + ['state', 'state-1'], + ]), + 'invalid_request', + 'Request is invalid.' + ) + + expect(response.status).toBe(400) + expect(response.headers.has('location')).toBe(false) + }) + + it.each(['client_id', 'redirect_uri'])( + 'does not choose between repeated %s values', + async (repeated) => { + const entries: [string, string][] = [ + ['client_id', 'client-1'], + ['redirect_uri', 'https://app.test/callback'], + ] + entries.push([repeated, repeated === 'client_id' ? 'client-2' : 'https://evil.test/callback']) + + const response = await oauthAuthorizationErrorResponse( + request(entries), + 'invalid_request', + 'Request is invalid.' + ) + + expect(response.status).toBe(400) + expect(response.headers.has('location')).toBe(false) + } + ) + + it('omits an ambiguous repeated state from an otherwise safe redirect', async () => { + queueTableRows(schemaMock.oauthClient, [ + { disabled: false, redirectUris: ['https://app.test/callback'] }, + ]) + + const response = await oauthAuthorizationErrorResponse( + request([ + ['client_id', 'client-1'], + ['redirect_uri', 'https://app.test/callback'], + ['state', 'one'], + ['state', 'two'], + ]), + 'invalid_request', + 'OAuth parameter state appears more than once.' + ) + + expect(new URL(response.headers.get('location') ?? '').searchParams.has('state')).toBe(false) + }) + + it('returns a sanitized protocol error when callback validation fails', async () => { + dbChainMockFns.limit.mockRejectedValueOnce(new Error('database unavailable')) + + const response = await oauthAuthorizationErrorResponse( + request([ + ['client_id', 'client-1'], + ['redirect_uri', 'https://app.test/callback'], + ]), + 'invalid_request', + 'Request is invalid.' + ) + + expect(response.status).toBe(500) + expect(response.headers.has('location')).toBe(false) + await expect(response.json()).resolves.toEqual({ + error: 'server_error', + error_description: 'Authorization request failed.', + }) + }) +}) diff --git a/apps/sim/lib/auth/oauth-authorization-error.ts b/apps/sim/lib/auth/oauth-authorization-error.ts new file mode 100644 index 00000000000..22697374532 --- /dev/null +++ b/apps/sim/lib/auth/oauth-authorization-error.ts @@ -0,0 +1,92 @@ +import { isIP } from 'node:net' +import { db } from '@sim/db' +import { oauthClient } from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { toError } from '@sim/utils/errors' +import { eq } from 'drizzle-orm' +import { type NextRequest, NextResponse } from 'next/server' +import { oauthErrorResponse } from '@/lib/auth/oauth-protocol-request' +import { getBaseUrl } from '@/lib/core/utils/urls' + +const logger = createLogger('OAuthAuthorizationError') + +export type OAuthAuthorizationErrorCode = 'invalid_request' | 'unsupported_response_type' + +function isLoopbackIp(hostname: string): boolean { + const address = hostname.startsWith('[') ? hostname.slice(1, -1) : hostname + return (isIP(address) === 4 && address.startsWith('127.')) || address === '::1' +} + +/** Matches Better Auth's exact redirect rule, including RFC 8252 loopback port variance. */ +export function oauthRedirectUriMatches(registeredUri: string, requestedUri: string): boolean { + if (registeredUri === requestedUri) return true + + try { + const registered = new URL(registeredUri) + const requested = new URL(requestedUri) + return ( + isLoopbackIp(registered.hostname) && + registered.hostname === requested.hostname && + registered.protocol === requested.protocol && + registered.pathname === requested.pathname && + registered.search === requested.search + ) + } catch { + return false + } +} + +/** + * Redirects an authorization error only after proving the callback belongs to + * the single registered, enabled client named by the request. + */ +export async function oauthAuthorizationErrorResponse( + request: NextRequest, + error: OAuthAuthorizationErrorCode, + description: string +): Promise { + const params = request.nextUrl.searchParams + const clientIds = params.getAll('client_id') + const redirectUris = params.getAll('redirect_uri') + if (clientIds.length !== 1 || redirectUris.length !== 1) { + return oauthErrorResponse(error, description) + } + + const clientId = clientIds[0] + const redirectUri = redirectUris[0] + let client: { disabled: boolean; redirectUris: string[] } | undefined + let issuer: string + try { + const clients = await db + .select({ disabled: oauthClient.disabled, redirectUris: oauthClient.redirectUris }) + .from(oauthClient) + .where(eq(oauthClient.clientId, clientId)) + .limit(1) + client = clients[0] + issuer = `${getBaseUrl()}/api/auth` + } catch (caught) { + logger.error('Failed to validate an OAuth authorization error redirect', { + error: toError(caught), + }) + return oauthErrorResponse('server_error', 'Authorization request failed.', 500) + } + + if ( + !client || + client.disabled || + !client.redirectUris.some((registered) => oauthRedirectUriMatches(registered, redirectUri)) + ) { + return oauthErrorResponse(error, description) + } + + const location = new URL(redirectUri) + location.searchParams.set('error', error) + location.searchParams.set('error_description', description) + const states = params.getAll('state') + if (states.length === 1) location.searchParams.set('state', states[0]) + location.searchParams.set('iss', issuer) + return NextResponse.redirect(location, { + status: 302, + headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' }, + }) +} diff --git a/apps/sim/lib/auth/oauth-principal.test.ts b/apps/sim/lib/auth/oauth-principal.test.ts index bea72dc2b04..de3ef929e68 100644 --- a/apps/sim/lib/auth/oauth-principal.test.ts +++ b/apps/sim/lib/auth/oauth-principal.test.ts @@ -18,7 +18,7 @@ const principal: OAuthAccessTokenPrincipal = { userId: 'user-1', clientId: 'sim-cli', tokenId: 'token-1', - scopes: ['openid', 'api:read'], + scopes: ['offline_access', 'api:read'], expiresAt: new Date('2027-01-01T00:00:00.000Z'), } @@ -41,9 +41,7 @@ describe('oauth_access_token principal', () => { it('round-trips through the execution serialization carrying only the token id', () => { const serialized = serializePrincipal(principal) - // The exact key set, not a `toMatchObject` subset: the point of the - // assertion is that nothing beyond these six fields crosses into an - // execution payload, and a subset match would pass however many were added. + /** Exact keys ensure no additional principal state crosses the execution boundary. */ expect(Object.keys(serialized.principal as object).sort()).toEqual([ 'clientId', 'expiresAt', diff --git a/apps/sim/lib/auth/oauth-protocol-request.test.ts b/apps/sim/lib/auth/oauth-protocol-request.test.ts new file mode 100644 index 00000000000..95d14e3b255 --- /dev/null +++ b/apps/sim/lib/auth/oauth-protocol-request.test.ts @@ -0,0 +1,160 @@ +/** + * @vitest-environment node + */ +import { NextRequest } from 'next/server' +import { describe, expect, it } from 'vitest' +import { + buildDelegatedOAuthRequest, + isValidOAuthCodeVerifier, + parseOAuthFormRequest, + validateOAuthPkceAuthorizationRequest, +} from '@/lib/auth/oauth-protocol-request' + +function request(body: string, headers: HeadersInit = {}): NextRequest { + return new NextRequest('https://sim.test/api/auth/oauth2/token', { + method: 'POST', + body, + headers: { 'content-type': 'application/x-www-form-urlencoded', ...headers }, + }) +} + +describe('parseOAuthFormRequest', () => { + it('parses public and client-secret-post credentials', async () => { + const publicResult = await parseOAuthFormRequest(request('client_id=sim-cli')) + expect(publicResult.success && publicResult.value.credentials).toEqual({ + clientId: 'sim-cli', + method: 'none', + }) + + const confidentialResult = await parseOAuthFormRequest( + request('client_id=web&client_secret=secret') + ) + expect(confidentialResult.success && confidentialResult.value.credentials).toEqual({ + clientId: 'web', + clientSecret: 'secret', + method: 'client_secret_post', + }) + }) + + it('accepts a case-insensitive Basic scheme and decodes form-escaped credentials', async () => { + const encoded = Buffer.from('client%2Bid:s%3Aecret').toString('base64') + const result = await parseOAuthFormRequest( + request('grant_type=refresh_token', { authorization: `basic ${encoded}` }) + ) + expect(result.success && result.value.credentials).toEqual({ + clientId: 'client+id', + clientSecret: 's:ecret', + method: 'client_secret_basic', + }) + }) + + it('adapts decoded Basic credentials to Better Auth without changing grant fields', async () => { + const encoded = Buffer.from('client%2Bid:s%3Aecret').toString('base64') + const original = request('grant_type=authorization_code&code=code', { + authorization: `basic ${encoded}`, + }) + const parsed = await parseOAuthFormRequest(original) + if (!parsed.success) throw new Error('request should parse') + const delegated = buildDelegatedOAuthRequest(original, parsed.value) + const delegatedForm = new URLSearchParams(await delegated.text()) + + expect(delegated.headers.has('authorization')).toBe(false) + expect(delegatedForm.get('grant_type')).toBe('authorization_code') + expect(delegatedForm.get('code')).toBe('code') + expect(delegatedForm.get('client_id')).toBe('client+id') + expect(delegatedForm.get('client_secret')).toBe('s:ecret') + }) + + it('rejects repeated fields and mixed client authentication', async () => { + const repeated = await parseOAuthFormRequest(request('client_id=a&client_id=b')) + expect(repeated.success).toBe(false) + if (!repeated.success) expect(repeated.response.status).toBe(400) + + const encoded = Buffer.from('client:secret').toString('base64') + const mixed = await parseOAuthFormRequest( + request('client_secret=other', { authorization: `Basic ${encoded}` }) + ) + expect(mixed.success).toBe(false) + if (!mixed.success) { + await expect(mixed.response.json()).resolves.toMatchObject({ error: 'invalid_request' }) + } + }) + + it('rejects malformed authorization, content types, and oversized bodies', async () => { + const malformed = await parseOAuthFormRequest( + request('client_id=a', { authorization: 'Basic not base64!' }) + ) + expect(malformed.success).toBe(false) + if (!malformed.success) { + expect(malformed.response.status).toBe(401) + expect(malformed.response.headers.get('www-authenticate')).toContain('Basic') + } + + const json = await parseOAuthFormRequest( + new NextRequest('https://sim.test/api/auth/oauth2/token', { + method: 'POST', + body: '{}', + headers: { 'content-type': 'application/json' }, + }) + ) + expect(json.success).toBe(false) + + const misleadingContentType = await parseOAuthFormRequest( + request('client_id=a', { 'content-type': 'application/x-www-form-urlencoded-json' }) + ) + expect(misleadingContentType.success).toBe(false) + + const oversized = await parseOAuthFormRequest(request(`scope=${'a'.repeat(16_385)}`)) + expect(oversized.success).toBe(false) + + const oversizedMultibyte = await parseOAuthFormRequest(request(`scope=${'é'.repeat(8_193)}`)) + expect(oversizedMultibyte.success).toBe(false) + }) + + it('reports invalid UTF-8 separately from an oversized body', async () => { + const invalidUtf8 = await parseOAuthFormRequest( + new NextRequest('https://sim.test/api/auth/oauth2/token', { + method: 'POST', + body: new Uint8Array([0xc3, 0x28]), + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + }) + ) + expect(invalidUtf8.success).toBe(false) + if (!invalidUtf8.success) { + await expect(invalidUtf8.response.json()).resolves.toMatchObject({ + error: 'invalid_request', + error_description: 'OAuth request body must be valid UTF-8.', + }) + } + }) +}) + +describe('OAuth PKCE validation', () => { + it('accepts the RFC 7636 verifier alphabet and length bounds', () => { + expect(isValidOAuthCodeVerifier('a'.repeat(43))).toBe(true) + expect(isValidOAuthCodeVerifier(`${'a'.repeat(124)}._~-`)).toBe(true) + expect(isValidOAuthCodeVerifier('a'.repeat(42))).toBe(false) + expect(isValidOAuthCodeVerifier('a'.repeat(129))).toBe(false) + expect(isValidOAuthCodeVerifier(`${'a'.repeat(42)}=`)).toBe(false) + }) + + it('accepts only paired, canonical S256 authorization parameters', async () => { + expect( + validateOAuthPkceAuthorizationRequest( + new URLSearchParams({ + code_challenge: 'a'.repeat(43), + code_challenge_method: 'S256', + }) + ) + ).toBeNull() + + for (const params of [ + new URLSearchParams({ code_challenge: 'a'.repeat(43) }), + new URLSearchParams({ code_challenge_method: 'S256' }), + new URLSearchParams({ code_challenge: 'a'.repeat(42), code_challenge_method: 'S256' }), + new URLSearchParams({ code_challenge: 'a'.repeat(43), code_challenge_method: 'plain' }), + ]) { + expect(validateOAuthPkceAuthorizationRequest(params)).toEqual(expect.any(String)) + } + }) +}) diff --git a/apps/sim/lib/auth/oauth-protocol-request.ts b/apps/sim/lib/auth/oauth-protocol-request.ts new file mode 100644 index 00000000000..4c517a73d2c --- /dev/null +++ b/apps/sim/lib/auth/oauth-protocol-request.ts @@ -0,0 +1,364 @@ +import { truncate } from '@sim/utils/string' +import { NextRequest, NextResponse } from 'next/server' +import type { OAuthClientCredentials, OAuthProtocolErrorCode } from '@/lib/auth/oauth-token-family' + +export interface ParsedOAuthForm { + form: URLSearchParams + credentials: OAuthClientCredentials | null + rawBody: string +} + +const MAX_OAUTH_FORM_BYTES = 16_384 +const PKCE_CODE_VERIFIER_PATTERN = /^[A-Za-z0-9._~-]{43,128}$/ +const PKCE_S256_CODE_CHALLENGE_PATTERN = /^[A-Za-z0-9_-]{43}$/ + +export type OAuthFormParseResult = + | { success: true; value: ParsedOAuthForm } + | { success: false; response: NextResponse } + +export function oauthErrorResponse( + error: + | OAuthProtocolErrorCode + | 'invalid_request' + | 'invalid_token' + | 'insufficient_scope' + | 'server_error' + | 'unsupported_grant_type' + | 'unsupported_response_type', + description: string, + status = 400, + challenge = false +): NextResponse { + return NextResponse.json( + { error, error_description: description }, + { + status, + headers: { + 'Cache-Control': 'no-store', + Pragma: 'no-cache', + ...(challenge && { 'WWW-Authenticate': 'Basic realm="oauth2"' }), + }, + } + ) +} + +/** Formats an OAuth protocol error without exposing credentials or token lookup details. */ +export function oauthProtocolErrorResponse( + error: OAuthProtocolErrorCode, + description: string, + method: OAuthClientCredentials['method'] +): NextResponse { + const basicFailure = error === 'invalid_client' && method === 'client_secret_basic' + return oauthErrorResponse(error, description, basicFailure ? 401 : 400, basicFailure) +} + +const DELEGATED_INVALID_GRANT_DESCRIPTIONS = new Set([ + 'PKCE is required for this client', + 'code_verifier required because PKCE was used in authorization', + 'code_verifier provided but PKCE was not used in authorization', + 'code verification failed', + 'Either code_verifier or client_secret is required', + 'invalid client_id', + 'redirect_uri mismatch', + 'missing user, user may have been deleted', + 'session no longer exists', +]) + +/** Enforces RFC 7636 syntax before Better Auth stores an authorization request. */ +export function validateOAuthPkceAuthorizationRequest( + searchParams: URLSearchParams +): string | null { + const hasChallenge = searchParams.has('code_challenge') + const hasMethod = searchParams.has('code_challenge_method') + if (hasChallenge !== hasMethod) { + return 'code_challenge and code_challenge_method must both be provided.' + } + if (!hasChallenge) return null + + if (searchParams.get('code_challenge_method') !== 'S256') { + return 'Only the S256 code challenge method is supported.' + } + const challenge = searchParams.get('code_challenge') ?? '' + if (!PKCE_S256_CODE_CHALLENGE_PATTERN.test(challenge)) { + return 'Code challenge is invalid.' + } + return null +} + +/** Whether a token request carries an RFC 7636 code verifier. */ +export function isValidOAuthCodeVerifier(value: string): boolean { + return PKCE_CODE_VERIFIER_PATTERN.test(value) +} + +const DELEGATED_OAUTH_ERROR_CODES = new Set([ + 'invalid_client', + 'invalid_grant', + 'invalid_request', + 'invalid_scope', + 'unauthorized_client', + 'unsupported_grant_type', +]) + +/** Normalizes Better Auth 1.6 token errors to RFC 6749 and RFC 7636 semantics. */ +export async function normalizeDelegatedOAuthTokenResponse( + response: Response, + method: OAuthClientCredentials['method'] +): Promise { + const headers = new Headers(response.headers) + headers.set('Cache-Control', 'no-store') + headers.set('Pragma', 'no-cache') + headers.delete('content-length') + if (response.ok) { + return new NextResponse(response.body, { status: response.status, headers }) + } + + if (response.status >= 500) { + headers.set('content-type', 'application/json') + return new NextResponse( + JSON.stringify({ + error: 'server_error', + error_description: 'Token exchange failed.', + }), + { status: response.status, headers } + ) + } + + let payload: Record | null = null + try { + const parsed = JSON.parse(await response.text()) as unknown + if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) { + payload = parsed as Record + } + } catch {} + + const delegatedDescription = payload?.error_description + const error = + typeof delegatedDescription === 'string' && + DELEGATED_INVALID_GRANT_DESCRIPTIONS.has(delegatedDescription) + ? 'invalid_grant' + : typeof payload?.error === 'string' && DELEGATED_OAUTH_ERROR_CODES.has(payload.error) + ? payload.error + : 'invalid_request' + const errorDescription = + typeof payload?.error_description === 'string' + ? truncate(payload.error_description, 512) + : 'Token request is invalid.' + const status = error === 'invalid_client' && method === 'client_secret_basic' ? 401 : 400 + if (status === 401) headers.set('WWW-Authenticate', 'Basic realm="oauth2"') + else headers.delete('www-authenticate') + headers.set('content-type', 'application/json') + + return new NextResponse(JSON.stringify({ error, error_description: errorDescription }), { + status, + headers, + }) +} + +/** A successful RFC 7009 response intentionally has no body. */ +export function oauthRevocationSuccessResponse(): NextResponse { + return new NextResponse(null, { + status: 200, + headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' }, + }) +} + +function parseBasicCredentials(authorization: string): OAuthClientCredentials | null { + const match = /^Basic[ ]+([A-Za-z0-9+/]+={0,2})$/i.exec(authorization) + if (!match?.[1]) return null + + let decoded: string + try { + const encoded = match[1] + const bytes = Buffer.from(encoded, 'base64') + const canonicalInput = encoded.replace(/=+$/, '') + const canonicalDecoded = bytes.toString('base64').replace(/=+$/, '') + if (canonicalInput !== canonicalDecoded) return null + decoded = new TextDecoder('utf-8', { fatal: true }).decode(bytes) + } catch { + return null + } + const separator = decoded.indexOf(':') + if (separator < 1 || separator === decoded.length - 1) return null + + try { + const clientId = decodeURIComponent(decoded.slice(0, separator).replace(/\+/g, ' ')) + const clientSecret = decodeURIComponent(decoded.slice(separator + 1).replace(/\+/g, ' ')) + if (!clientId || !clientSecret) return null + return { clientId, clientSecret, method: 'client_secret_basic' } + } catch { + return null + } +} + +type OAuthBodyReadResult = + | { success: true; body: string } + | { success: false; reason: 'invalid_encoding' | 'too_large' } + +async function readBoundedOAuthBody(request: Request): Promise { + if (!request.body) return { success: true, body: '' } + + const reader = request.body.getReader() + const chunks: Uint8Array[] = [] + let byteLength = 0 + try { + while (true) { + const { done, value } = await reader.read() + if (done) break + byteLength += value.byteLength + if (byteLength > MAX_OAUTH_FORM_BYTES) { + await reader.cancel() + return { success: false, reason: 'too_large' } + } + chunks.push(value) + } + } finally { + reader.releaseLock() + } + + const body = new Uint8Array(byteLength) + let offset = 0 + for (const chunk of chunks) { + body.set(chunk, offset) + offset += chunk.byteLength + } + try { + return { success: true, body: new TextDecoder('utf-8', { fatal: true }).decode(body) } + } catch { + return { success: false, reason: 'invalid_encoding' } + } +} + +/** + * Rebuilds the consumed request for Better Auth 1.6. + * Its Basic parser omits RFC 6749 form-decoding, so already-authenticated Basic + * credentials are passed through its body path using their decoded values. + */ +export function buildDelegatedOAuthRequest( + request: NextRequest, + parsed: ParsedOAuthForm +): NextRequest { + const headers = new Headers(request.headers) + let body = parsed.rawBody + if (parsed.credentials?.method === 'client_secret_basic') { + const form = new URLSearchParams(parsed.rawBody) + form.set('client_id', parsed.credentials.clientId) + form.set('client_secret', parsed.credentials.clientSecret ?? '') + body = form.toString() + headers.delete('authorization') + } + headers.delete('content-length') + return new NextRequest(request.url, { + method: request.method, + headers, + body, + signal: request.signal, + }) +} + +/** + * Parses a form-encoded OAuth request once and rejects parameter ambiguity. + * The bounded raw body is retained so delegated Better Auth grants can receive + * an equivalent request after this function consumes the original stream. + */ +export async function parseOAuthFormRequest(request: NextRequest): Promise { + const mediaType = request.headers.get('content-type')?.split(';', 1)[0]?.trim().toLowerCase() + if (mediaType !== 'application/x-www-form-urlencoded') { + return { + success: false, + response: oauthErrorResponse( + 'invalid_request', + 'Content-Type must be application/x-www-form-urlencoded.' + ), + } + } + + const declaredLength = Number(request.headers.get('content-length') ?? 0) + if (Number.isFinite(declaredLength) && declaredLength > MAX_OAUTH_FORM_BYTES) { + return { + success: false, + response: oauthErrorResponse('invalid_request', 'OAuth request body is too large.'), + } + } + const bodyResult = await readBoundedOAuthBody(request) + if (!bodyResult.success) { + return { + success: false, + response: oauthErrorResponse( + 'invalid_request', + bodyResult.reason === 'too_large' + ? 'OAuth request body is too large.' + : 'OAuth request body must be valid UTF-8.' + ), + } + } + const body = bodyResult.body + const form = new URLSearchParams(body) + const seen = new Set() + for (const [name] of form) { + if (seen.has(name)) { + return { + success: false, + response: oauthErrorResponse( + 'invalid_request', + `OAuth parameter ${name} appears more than once.` + ), + } + } + seen.add(name) + } + + const authorization = request.headers.get('authorization') + if (authorization) { + const basic = parseBasicCredentials(authorization) + if (!basic) { + return { + success: false, + response: oauthErrorResponse( + 'invalid_client', + 'Authorization header is invalid.', + 401, + true + ), + } + } + if (form.has('client_secret')) { + return { + success: false, + response: oauthErrorResponse( + 'invalid_request', + 'Use exactly one client authentication method.' + ), + } + } + return { success: true, value: { form, credentials: basic, rawBody: body } } + } + + const clientId = form.get('client_id') + if (!clientId) return { success: true, value: { form, credentials: null, rawBody: body } } + const clientSecret = form.get('client_secret') + return { + success: true, + value: { + form, + rawBody: body, + credentials: clientSecret + ? { clientId, clientSecret, method: 'client_secret_post' } + : { clientId, method: 'none' }, + }, + } +} + +/** Reads an optional OAuth scope parameter as a de-duplicated ordered list. */ +export function parseRequestedScopes(form: URLSearchParams): string[] | undefined { + const scope = form.get('scope')?.trim() + if (!scope) return undefined + return [...new Set(scope.split(/\s+/))] +} + +export function missingOAuthParameterResponse(name: string): NextResponse { + return oauthErrorResponse('invalid_request', `Missing required OAuth parameter ${name}.`) +} + +export function unsupportedGrantResponse(grantType: string): NextResponse { + return oauthErrorResponse('unsupported_grant_type', `Unsupported grant type ${grantType}.`) +} diff --git a/apps/sim/lib/auth/oauth-provider-adapter-guard.test.ts b/apps/sim/lib/auth/oauth-provider-adapter-guard.test.ts new file mode 100644 index 00000000000..445d43faa7e --- /dev/null +++ b/apps/sim/lib/auth/oauth-provider-adapter-guard.test.ts @@ -0,0 +1,120 @@ +/** + * @vitest-environment node + */ +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + delete: vi.fn(), + insert: vi.fn(), +})) + +vi.mock('@sim/db', () => ({ db: { delete: mocks.delete, insert: mocks.insert } })) + +import { + guardOAuthProviderWrites, + withOAuthProviderIssuanceCompensation, +} from '@/lib/auth/oauth-provider-adapter-guard' + +function adapter() { + return { + create: vi.fn(async () => ({ id: 'delegated' })), + } as Parameters[0] +} + +function consentData() { + return { + clientId: 'sim-cli', + userId: null, + referenceId: null, + scopes: ['api:read'], + createdAt: new Date('2026-09-04T00:00:00Z'), + updatedAt: new Date('2026-09-04T00:00:00Z'), + } +} + +function mockUpsert(rows: Record[]) { + const returning = vi.fn(async () => rows) + const onConflictDoUpdate = vi.fn(() => ({ returning })) + const values = vi.fn(() => ({ onConflictDoUpdate })) + mocks.insert.mockReturnValue({ values }) + return { values, onConflictDoUpdate } +} + +describe('guardOAuthProviderWrites', () => { + beforeEach(() => { + vi.clearAllMocks() + mocks.delete.mockReturnValue({ where: vi.fn(async () => undefined) }) + }) + + it('atomically upserts consent with a generated id and the nullable natural key', async () => { + const persisted = { id: 'persisted', ...consentData() } + const chain = mockUpsert([persisted]) + const guarded = guardOAuthProviderWrites(adapter()) + + await expect(guarded.create({ model: 'oauthConsent', data: consentData() })).resolves.toEqual( + persisted + ) + + expect(chain.values).toHaveBeenCalledWith( + expect.objectContaining({ + id: expect.any(String), + clientId: 'sim-cli', + userId: null, + referenceId: null, + }) + ) + expect(chain.onConflictDoUpdate).toHaveBeenCalledWith( + expect.objectContaining({ + target: ['oauthConsent.userId', 'oauthConsent.clientId', 'oauthConsent.referenceId'], + set: { scopes: ['api:read'], updatedAt: consentData().updatedAt }, + }) + ) + }) + + it('preserves requested projection and refuses an empty RETURNING result', async () => { + mockUpsert([{ id: 'persisted', ...consentData() }]) + const guarded = guardOAuthProviderWrites(adapter()) + await expect( + guarded.create({ model: 'oauthConsent', data: consentData(), select: ['id', 'scopes'] }) + ).resolves.toEqual({ id: 'persisted', scopes: ['api:read'] }) + + mockUpsert([]) + await expect(guarded.create({ model: 'oauthConsent', data: consentData() })).rejects.toThrow( + 'upsert returned no row' + ) + }) + + it('passes every non-consent model through unchanged', async () => { + const base = adapter() + const guarded = guardOAuthProviderWrites(base) + await expect(guarded.create({ model: 'user', data: { name: 'Ada' } })).resolves.toEqual({ + id: 'delegated', + }) + expect(base.create).toHaveBeenCalledOnce() + expect(mocks.insert).not.toHaveBeenCalled() + }) + + it('deletes a refresh family when delegated token issuance fails', async () => { + const base = adapter() + const guarded = guardOAuthProviderWrites(base) + + const response = await withOAuthProviderIssuanceCompensation(async () => { + await guarded.create({ model: 'oauthRefreshToken', data: { token: 'hashed' } }) + return new Response('failed', { status: 500 }) + }) + + expect(response.status).toBe(500) + expect(mocks.delete).toHaveBeenCalledOnce() + }) + + it('retains a refresh family after successful delegated token issuance', async () => { + const guarded = guardOAuthProviderWrites(adapter()) + + await withOAuthProviderIssuanceCompensation(async () => { + await guarded.create({ model: 'oauthRefreshToken', data: { token: 'hashed' } }) + return new Response(null, { status: 200 }) + }) + + expect(mocks.delete).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/lib/auth/oauth-provider-adapter-guard.ts b/apps/sim/lib/auth/oauth-provider-adapter-guard.ts new file mode 100644 index 00000000000..32fcf16663d --- /dev/null +++ b/apps/sim/lib/auth/oauth-provider-adapter-guard.ts @@ -0,0 +1,131 @@ +import { AsyncLocalStorage } from 'node:async_hooks' +import { db } from '@sim/db' +import { oauthConsent, oauthTokenFamily } from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import type { drizzleAdapter } from 'better-auth/adapters/drizzle' +import { inArray } from 'drizzle-orm' + +type BetterAuthAdapter = ReturnType> +export type AuthDatabase = typeof db | Parameters[0]>[0] +const issuedFamilyIds = new AsyncLocalStorage>() + +interface OAuthConsentInsert { + id?: string + clientId: string + userId: string | null + referenceId: string | null + scopes: string[] + createdAt: Date + updatedAt: Date +} + +async function deleteTrackedFamilies( + database: AuthDatabase, + familyIds: Set +): Promise { + if (familyIds.size === 0) return + await database.delete(oauthTokenFamily).where(inArray(oauthTokenFamily.id, [...familyIds])) +} + +/** + * Compensates for Better Auth 1.6's non-transactional authorization-code token issuance. + * A failed response cannot expose the refresh secret, so its newly inserted family is deleted. + */ +export async function withOAuthProviderIssuanceCompensation( + work: () => Promise, + database: AuthDatabase = db +): Promise { + const familyIds = new Set() + try { + const response = await issuedFamilyIds.run(familyIds, work) + if (!response.ok) await deleteTrackedFamilies(database, familyIds) + return response + } catch (error) { + await deleteTrackedFamilies(database, familyIds) + throw error + } +} + +function requireConsentInsert(data: Record): OAuthConsentInsert { + if ( + typeof data.clientId !== 'string' || + !Array.isArray(data.scopes) || + !data.scopes.every((scope) => typeof scope === 'string') || + !(data.createdAt instanceof Date) || + !(data.updatedAt instanceof Date) || + (data.id !== undefined && typeof data.id !== 'string') || + (data.userId !== undefined && data.userId !== null && typeof data.userId !== 'string') || + (data.referenceId !== undefined && + data.referenceId !== null && + typeof data.referenceId !== 'string') + ) { + throw new Error('Better Auth supplied an invalid OAuth consent record') + } + return { + id: data.id, + clientId: data.clientId, + userId: typeof data.userId === 'string' ? data.userId : null, + referenceId: typeof data.referenceId === 'string' ? data.referenceId : null, + scopes: data.scopes, + createdAt: data.createdAt, + updatedAt: data.updatedAt, + } +} + +/** + * Makes the provider's read-then-create consent path atomic. + * + * Better Auth 1.6.27 first looks for a grant and then inserts one. Two consent + * submissions can therefore race. The database uniqueness constraint is the + * integrity backstop; this adapter seam turns the losing insert into the same + * scope update the provider would have made had its preceding read seen the + * row, and returns the real persisted record expected by the adapter contract. + */ +export function guardOAuthProviderWrites( + adapter: BetterAuthAdapter, + database: AuthDatabase = db +): BetterAuthAdapter { + return { + ...adapter, + create: async (input) => { + if (input.model !== 'oauthConsent') { + const created = await adapter.create(input) + if (input.model === 'oauthRefreshToken') { + const id = (created as { id?: unknown }).id + if (typeof id !== 'string' || !id) { + throw new Error('OAuth refresh-token insert returned no family id') + } + issuedFamilyIds.getStore()?.add(id) + } + return created as never + } + + const values = requireConsentInsert(input.data) + const [consent] = await database + .insert(oauthConsent) + .values({ + id: input.forceAllowId && values.id ? values.id : generateId(), + clientId: values.clientId, + userId: values.userId ?? null, + referenceId: values.referenceId ?? null, + scopes: values.scopes, + createdAt: values.createdAt, + updatedAt: values.updatedAt, + }) + .onConflictDoUpdate({ + target: [oauthConsent.userId, oauthConsent.clientId, oauthConsent.referenceId], + set: { + scopes: values.scopes, + updatedAt: values.updatedAt, + }, + }) + .returning() + + if (!consent) throw new Error('OAuth consent upsert returned no row') + if (!input.select?.length) return consent as never + return Object.fromEntries( + input.select.map((field) => [field, consent[field as keyof typeof consent]]) + ) as never + }, + } +} diff --git a/apps/sim/lib/auth/oauth-provider-metadata.test.ts b/apps/sim/lib/auth/oauth-provider-metadata.test.ts index e9279abe908..80ec6cea602 100644 --- a/apps/sim/lib/auth/oauth-provider-metadata.test.ts +++ b/apps/sim/lib/auth/oauth-provider-metadata.test.ts @@ -46,8 +46,11 @@ describe('OAuth provider metadata', () => { authorization_endpoint: 'https://sim.test/api/auth/oauth2/authorize', token_endpoint: 'https://sim.test/api/auth/oauth2/token', revocation_endpoint: 'https://sim.test/api/auth/oauth2/revoke', + introspection_endpoint: 'https://sim.test/api/auth/oauth2/introspect', + introspection_endpoint_auth_methods_supported: ['client_secret_post'], token_endpoint_auth_methods_supported: ['client_secret_post'], revocation_endpoint_auth_methods_supported: ['none', 'client_secret_post'], + scopes_supported: ['offline_access', 'api:read', 'api:write'], }) }) @@ -71,6 +74,11 @@ describe('OAuth provider metadata', () => { 'none', 'client_secret_post', ]) + expect(metadata.introspection_endpoint).toBeUndefined() + expect(metadata.introspection_endpoint_auth_methods_supported).toBeUndefined() + expect(metadata.scopes_supported).toEqual(['offline_access', 'api:read', 'api:write']) + expect(metadata.userinfo_endpoint).toBeUndefined() + expect(metadata.jwks_uri).toBeUndefined() }) it.each(routes)( diff --git a/apps/sim/lib/auth/oauth-provider-metadata.ts b/apps/sim/lib/auth/oauth-provider-metadata.ts index cc24911cde6..ea33e797fe0 100644 --- a/apps/sim/lib/auth/oauth-provider-metadata.ts +++ b/apps/sim/lib/auth/oauth-provider-metadata.ts @@ -20,11 +20,16 @@ const DISCOVERY_HEADERS = { */ export async function getOAuthProviderMetadata() { const metadata = await auth.api.getOAuthServerConfig() + const { + introspection_endpoint: _introspectionEndpoint, + introspection_endpoint_auth_methods_supported: _introspectionAuthMethods, + ...supportedMetadata + } = metadata const publicClientAuthMethods = (methods: string[] | undefined) => [ ...new Set([...(methods ?? []), 'none']), ] return { - ...metadata, + ...supportedMetadata, token_endpoint_auth_methods_supported: publicClientAuthMethods( metadata.token_endpoint_auth_methods_supported ), diff --git a/apps/sim/lib/auth/oauth-provider.test.ts b/apps/sim/lib/auth/oauth-provider.test.ts index 0ff485a41e8..cd1f21efa1b 100644 --- a/apps/sim/lib/auth/oauth-provider.test.ts +++ b/apps/sim/lib/auth/oauth-provider.test.ts @@ -6,29 +6,34 @@ import { consentRequestNamesClient, OAUTH_API_READ_SCOPE, OAUTH_API_WRITE_SCOPE, + OAUTH_SCOPES, oauthScopeSatisfies, SIM_CLI_CLIENT_ID, summarizeOAuthAccess, visibleOAuthScopes, } from '@/lib/auth/oauth-provider' +it('exposes only OAuth API authorization scopes', () => { + expect(OAUTH_SCOPES).toEqual(['offline_access', 'api:read', 'api:write']) +}) + describe('oauthScopeSatisfies', () => { it('treats api:write as a superset of api:read, but never the reverse', () => { expect(oauthScopeSatisfies([OAUTH_API_WRITE_SCOPE], OAUTH_API_READ_SCOPE)).toBe(true) expect(oauthScopeSatisfies([OAUTH_API_READ_SCOPE], OAUTH_API_WRITE_SCOPE)).toBe(false) - expect(oauthScopeSatisfies(['openid', 'profile'], OAUTH_API_READ_SCOPE)).toBe(false) + expect(oauthScopeSatisfies(['offline_access'], OAUTH_API_READ_SCOPE)).toBe(false) }) }) describe('visibleOAuthScopes', () => { it('drops the read scope a granted write scope already implies', () => { expect( - visibleOAuthScopes(['openid', OAUTH_API_READ_SCOPE, OAUTH_API_WRITE_SCOPE]) + visibleOAuthScopes(['offline_access', OAUTH_API_READ_SCOPE, OAUTH_API_WRITE_SCOPE]) ).not.toContain(OAUTH_API_READ_SCOPE) }) it('ignores a scope the provider does not issue', () => { - expect(visibleOAuthScopes(['openid', 'admin:everything'])).toEqual(['openid']) + expect(visibleOAuthScopes(['offline_access', 'admin:everything'])).toEqual(['offline_access']) }) }) @@ -38,14 +43,17 @@ describe('summarizeOAuthAccess', () => { 'Full access to your workspaces' ) expect(summarizeOAuthAccess([OAUTH_API_READ_SCOPE])).toBe('Read-only access to your workspaces') - expect(summarizeOAuthAccess(['openid', 'email'])).toBe('Sign in only') + expect(summarizeOAuthAccess(['offline_access'])).toBe('No API access') }) }) describe('consentRequestNamesClient', () => { it('matches the client the signed authorize query names', () => { expect( - consentRequestNamesClient(`client_id=${SIM_CLI_CLIENT_ID}&scope=openid`, SIM_CLI_CLIENT_ID) + consentRequestNamesClient( + `client_id=${SIM_CLI_CLIENT_ID}&scope=offline_access`, + SIM_CLI_CLIENT_ID + ) ).toBe(true) expect(consentRequestNamesClient('client_id=partner-app', SIM_CLI_CLIENT_ID)).toBe(false) }) diff --git a/apps/sim/lib/auth/oauth-provider.ts b/apps/sim/lib/auth/oauth-provider.ts index 1f7f97844f9..1783dc1b1e1 100644 --- a/apps/sim/lib/auth/oauth-provider.ts +++ b/apps/sim/lib/auth/oauth-provider.ts @@ -1,5 +1,5 @@ /** - * Constants shared by every side of Sim's OAuth 2.1 provider: the Better Auth + * Constants shared by every side of Sim's OAuth 2.0 provider: the Better Auth * plugin configuration, the consent page, the bearer-token verifier, and the * "Authorized apps" settings surface. */ @@ -19,21 +19,7 @@ export const OAUTH_REFRESH_TOKEN_PREFIX = 'sim_ort_' export const OAUTH_API_READ_SCOPE = 'api:read' export const OAUTH_API_WRITE_SCOPE = 'api:write' -export const OAUTH_SCOPES = [ - 'openid', - 'profile', - 'email', - 'offline_access', - OAUTH_API_READ_SCOPE, - OAUTH_API_WRITE_SCOPE, -] as const - -/** Public clients can call Sim's API but cannot receive an ID token without JWT signing. */ -export const OAUTH_PUBLIC_CLIENT_SCOPES = [ - 'offline_access', - OAUTH_API_READ_SCOPE, - OAUTH_API_WRITE_SCOPE, -] as const +export const OAUTH_SCOPES = ['offline_access', OAUTH_API_READ_SCOPE, OAUTH_API_WRITE_SCOPE] as const export type OAuthScope = (typeof OAUTH_SCOPES)[number] @@ -47,15 +33,14 @@ export type OAuthScope = (typeof OAUTH_SCOPES)[number] */ export const OAUTH_ACCESS_TOKEN_TTL_SECONDS = 60 * 60 export const OAUTH_REFRESH_TOKEN_TTL_SECONDS = 30 * 24 * 60 * 60 +/** Bounds replay evidence for one login even if a client refreshes excessively. */ +export const OAUTH_TOKEN_FAMILY_MAX_GENERATION = 1_000 /** How long an authorization code stays redeemable — the plugin's default. */ export const OAUTH_CODE_TTL_SECONDS = 10 * 60 export type OAuthApiScope = typeof OAUTH_API_READ_SCOPE | typeof OAUTH_API_WRITE_SCOPE /** One plain-English line per scope, rendered on the consent page. */ export const OAUTH_SCOPE_DESCRIPTIONS: Record = { - openid: 'Confirm who you are', - profile: 'See your name and profile picture', - email: 'See your email address', offline_access: 'Stay signed in without asking again', [OAUTH_API_READ_SCOPE]: 'Read your workspaces, workflows, files, tables, and logs', [OAUTH_API_WRITE_SCOPE]: 'Read, create, change, run, and delete resources in your workspaces', @@ -78,7 +63,7 @@ export function visibleOAuthScopes(granted: readonly string[]): OAuthScope[] { export function summarizeOAuthAccess(granted: readonly string[]): string { if (granted.includes(OAUTH_API_WRITE_SCOPE)) return 'Full access to your workspaces' if (granted.includes(OAUTH_API_READ_SCOPE)) return 'Read-only access to your workspaces' - return 'Sign in only' + return 'No API access' } /** diff --git a/apps/sim/lib/auth/oauth-token-family.postgres.test.ts b/apps/sim/lib/auth/oauth-token-family.postgres.test.ts new file mode 100644 index 00000000000..fd4735a90ae --- /dev/null +++ b/apps/sim/lib/auth/oauth-token-family.postgres.test.ts @@ -0,0 +1,215 @@ +/** + * @vitest-environment node + */ +import { randomBytes } from 'node:crypto' +import { describe, expect, it, vi } from 'vitest' + +vi.unmock('@sim/db') +vi.unmock('@sim/db/schema') +vi.unmock('drizzle-orm') +vi.unmock('@/lib/core/config/env') + +const databaseUrl = process.env.OAUTH_TOKEN_FAMILY_TEST_DATABASE_URL + +describe.skipIf(!databaseUrl)('OAuth token families in PostgreSQL', () => { + it('rotates, contains replay, revokes one login, and follows consent changes', async () => { + process.env.DATABASE_URL = databaseUrl + process.env.BETTER_AUTH_SECRET ||= 'oauth-token-family-integration-test-secret' + + const [{ db }, schema, { eq, sql }, provider, tokenStore] = await Promise.all([ + import('@sim/db'), + import('@sim/db/schema'), + import('drizzle-orm'), + import('@/lib/auth/oauth-provider'), + import('@/lib/auth/oauth-access-token'), + ]) + const { revokeOAuthToken, rotateOAuthRefreshToken } = await import( + '@/lib/auth/oauth-token-family' + ) + const testId = randomBytes(8).toString('hex') + const userId = `oauth-family-test-user-${testId}` + const sessionId = `oauth-family-test-session-${testId}` + const consentId = `oauth-family-test-consent-${testId}` + const email = `oauth-family-${testId}@example.com` + const fullScopes = ['offline_access', 'api:read', 'api:write'] + const credentials = { clientId: 'sim-cli', method: 'none' as const } + + const createInitialFamily = async (label: string): Promise => { + const refreshId = `oauth-family-test-refresh-${testId}-${label}` + const tokenBody = randomBytes(32).toString('base64url') + await db.execute(sql` + INSERT INTO "oauth_refresh_token" ( + "id", "token", "client_id", "session_id", "user_id", "reference_id", + "expires_at", "created_at", "revoked", "auth_time", "scopes", + "family_id", "generation" + ) VALUES ( + ${refreshId}, ${tokenStore.hashOAuthToken(tokenBody)}, 'sim-cli', ${sessionId}, + ${userId}, NULL, now() + interval '30 days', now(), NULL, now(), + ARRAY['offline_access', 'api:read', 'api:write']::text[], NULL, NULL + ) + `) + return `${provider.OAUTH_REFRESH_TOKEN_PREFIX}${tokenBody}` + } + + await db.insert(schema.user).values({ + id: userId, + name: 'OAuth family integration test', + email, + emailVerified: true, + createdAt: new Date(), + updatedAt: new Date(), + }) + await db.insert(schema.session).values({ + id: sessionId, + token: `oauth-family-test-session-token-${testId}`, + userId, + expiresAt: new Date(Date.now() + 86_400_000), + createdAt: new Date(), + updatedAt: new Date(), + }) + await db.insert(schema.oauthConsent).values({ + id: consentId, + clientId: 'sim-cli', + userId, + referenceId: null, + scopes: fullScopes, + createdAt: new Date(), + updatedAt: new Date(), + }) + + try { + const familyAToken = await createInitialFamily('a') + const familyAId = `oauth-family-test-refresh-${testId}-a` + const [familyABefore] = await db + .select({ expiresAt: schema.oauthTokenFamily.expiresAt }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, familyAId)) + const rotatedA = await rotateOAuthRefreshToken({ + credentials, + refreshToken: familyAToken, + requestedScopes: ['offline_access', 'api:read'], + }) + expect(rotatedA.success).toBe(true) + if (!rotatedA.success) throw new Error(rotatedA.description) + expect(rotatedA.value.scope).toBe('offline_access api:read') + + const familyARows = await db + .select({ + generation: schema.oauthRefreshToken.generation, + scopes: schema.oauthRefreshToken.scopes, + }) + .from(schema.oauthRefreshToken) + .where(eq(schema.oauthRefreshToken.familyId, familyAId)) + .orderBy(schema.oauthRefreshToken.generation) + expect(familyARows).toEqual([ + { generation: 0, scopes: fullScopes }, + { generation: 1, scopes: fullScopes }, + ]) + const [familyAAfter] = await db + .select({ expiresAt: schema.oauthTokenFamily.expiresAt }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, familyAId)) + expect(familyAAfter?.expiresAt).toEqual(familyABefore?.expiresAt) + + const familyBToken = await createInitialFamily('b') + const familyBId = `oauth-family-test-refresh-${testId}-b` + const replayA = await rotateOAuthRefreshToken({ + credentials, + refreshToken: familyAToken, + }) + expect(replayA).toMatchObject({ success: false, error: 'invalid_grant' }) + expect( + await db + .select({ id: schema.oauthTokenFamily.id }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, familyAId)) + ).toHaveLength(0) + expect( + await db + .select({ id: schema.oauthTokenFamily.id }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, familyBId)) + ).toHaveLength(1) + + const concurrent = await Promise.all([ + rotateOAuthRefreshToken({ credentials, refreshToken: familyBToken }), + rotateOAuthRefreshToken({ credentials, refreshToken: familyBToken }), + ]) + expect(concurrent.filter((result) => result.success)).toHaveLength(1) + expect(concurrent.filter((result) => !result.success)).toHaveLength(1) + expect( + await db + .select({ id: schema.oauthTokenFamily.id }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, familyBId)) + ).toHaveLength(0) + + const familyCToken = await createInitialFamily('c') + const familyCId = `oauth-family-test-refresh-${testId}-c` + const rotatedC = await rotateOAuthRefreshToken({ credentials, refreshToken: familyCToken }) + expect(rotatedC.success).toBe(true) + if (!rotatedC.success) throw new Error(rotatedC.description) + expect(await revokeOAuthToken({ credentials, token: rotatedC.value.refreshToken })).toEqual({ + success: true, + value: undefined, + }) + expect( + await db + .select({ id: schema.oauthTokenFamily.id }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, familyCId)) + ).toHaveLength(0) + + const familyDToken = await createInitialFamily('d') + const familyDId = `oauth-family-test-refresh-${testId}-d` + expect( + await revokeOAuthToken({ + credentials, + token: `${provider.OAUTH_REFRESH_TOKEN_PREFIX}unknown-token`, + }) + ).toEqual({ success: true, value: undefined }) + expect( + await db + .select({ id: schema.oauthTokenFamily.id }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, familyDId)) + ).toHaveLength(1) + + await db + .update(schema.oauthConsent) + .set({ scopes: ['offline_access', 'api:read'], updatedAt: new Date() }) + .where(eq(schema.oauthConsent.id, consentId)) + expect( + await db + .select({ id: schema.oauthTokenFamily.id }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, familyDId)) + ).toHaveLength(0) + expect(familyDToken).toMatch(/^sim_ort_/) + + await db + .update(schema.oauthConsent) + .set({ scopes: fullScopes, updatedAt: new Date() }) + .where(eq(schema.oauthConsent.id, consentId)) + await db + .update(schema.user) + .set({ banned: true, banExpires: new Date(Date.now() - 1_000) }) + .where(eq(schema.user.id, userId)) + const familyEToken = await createInitialFamily('e') + await expect( + rotateOAuthRefreshToken({ credentials, refreshToken: familyEToken }) + ).resolves.toMatchObject({ success: true }) + + await db + .update(schema.user) + .set({ banned: true, banExpires: new Date(Date.now() + 60_000) }) + .where(eq(schema.user.id, userId)) + const familyFToken = await createInitialFamily('f') + await expect( + rotateOAuthRefreshToken({ credentials, refreshToken: familyFToken }) + ).resolves.toMatchObject({ success: false, error: 'invalid_grant' }) + } finally { + await db.delete(schema.user).where(eq(schema.user.id, userId)) + } + }, 30_000) +}) diff --git a/apps/sim/lib/auth/oauth-token-family.ts b/apps/sim/lib/auth/oauth-token-family.ts new file mode 100644 index 00000000000..6a6aa452894 --- /dev/null +++ b/apps/sim/lib/auth/oauth-token-family.ts @@ -0,0 +1,532 @@ +import { db } from '@sim/db' +import { + oauthAccessToken, + oauthClient, + oauthConsent, + oauthRefreshToken, + oauthTokenFamily, + session, + user, +} from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { safeCompare } from '@sim/security/compare' +import { generateSecureToken } from '@sim/security/tokens' +import { generateId } from '@sim/utils/id' +import { symmetricDecrypt } from 'better-auth/crypto' +import { and, eq, isNull } from 'drizzle-orm' +import { isBanActive } from '@/lib/auth/ban' +import { hashOAuthToken } from '@/lib/auth/oauth-access-token' +import { + OAUTH_ACCESS_TOKEN_PREFIX, + OAUTH_ACCESS_TOKEN_TTL_SECONDS, + OAUTH_REFRESH_TOKEN_PREFIX, + OAUTH_TOKEN_FAMILY_MAX_GENERATION, +} from '@/lib/auth/oauth-provider' +import { env } from '@/lib/core/config/env' + +const logger = createLogger('OAuthTokenFamily') + +type OAuthDatabase = typeof db +type OAuthReadDatabase = OAuthDatabase | Parameters[0]>[0] +type OAuthClientAuthenticationMethod = 'none' | 'client_secret_basic' | 'client_secret_post' + +export interface OAuthClientCredentials { + clientId: string + clientSecret?: string + method: OAuthClientAuthenticationMethod +} + +export interface RotateOAuthRefreshTokenInput { + credentials: OAuthClientCredentials + refreshToken: string + requestedScopes?: string[] +} + +export type OAuthProtocolErrorCode = + | 'invalid_client' + | 'invalid_grant' + | 'invalid_scope' + | 'unauthorized_client' + +export type OAuthProtocolResult = + | { success: true; value: T } + | { success: false; error: OAuthProtocolErrorCode; description: string } + +export interface OAuthTokenPair { + accessToken: string + refreshToken: string + expiresIn: number + expiresAt: number + scope: string +} + +interface OAuthClientRow { + clientId: string + clientSecret: string | null + disabled: boolean + public: boolean | null + tokenEndpointAuthMethod: string | null + grantTypes: string[] | null + scopes: string[] | null + skipConsent: boolean | null +} + +interface RefreshTokenRow { + id: string + clientId: string + sessionId: string | null + userId: string + referenceId: string | null + expiresAt: Date + revoked: Date | null + authTime: Date | null + scopes: string[] + familyId: string + familyConsentId: string | null + generation: number +} + +function protocolError( + error: OAuthProtocolErrorCode, + description: string +): OAuthProtocolResult { + return { success: false, error, description } +} + +function stripTokenPrefix(token: string, prefix: string): string | null { + if (!token.startsWith(prefix)) return null + const raw = token.slice(prefix.length) + return raw || null +} + +function clientAllowsRefresh(client: OAuthClientRow): boolean { + const grants = client.grantTypes?.length ? client.grantTypes : ['authorization_code'] + return grants.includes('refresh_token') || grants.includes('authorization_code') +} + +async function authenticateClient( + client: OAuthClientRow | undefined, + credentials: OAuthClientCredentials +): Promise> { + if (!client || client.disabled) { + return protocolError('invalid_client', 'Client authentication failed.') + } + + const registeredMethod = client.tokenEndpointAuthMethod ?? 'client_secret_basic' + if ( + registeredMethod !== 'none' && + registeredMethod !== 'client_secret_basic' && + registeredMethod !== 'client_secret_post' + ) { + logger.error('OAuth client has an unsupported token authentication method', { + clientId: client.clientId, + registeredMethod, + }) + return protocolError('invalid_client', 'Client authentication failed.') + } + if (credentials.method !== registeredMethod) { + return protocolError( + 'invalid_client', + 'Client authentication method does not match registration.' + ) + } + + if (registeredMethod === 'none') { + if (!client.public || credentials.clientSecret) { + return protocolError('invalid_client', 'Client authentication failed.') + } + return { success: true, value: client } + } + + if (client.public || !client.clientSecret || !credentials.clientSecret) { + return protocolError('invalid_client', 'Client authentication failed.') + } + + try { + const expected = await symmetricDecrypt({ + key: env.BETTER_AUTH_SECRET, + data: client.clientSecret, + }) + if (!safeCompare(expected, credentials.clientSecret)) { + return protocolError('invalid_client', 'Client authentication failed.') + } + } catch (error) { + logger.error('Failed to decrypt an OAuth client secret', { clientId: client.clientId, error }) + return protocolError('invalid_client', 'Client authentication failed.') + } + + return { success: true, value: client } +} + +async function readClient( + database: OAuthDatabase, + clientId: string +): Promise { + const [client] = await database + .select({ + clientId: oauthClient.clientId, + clientSecret: oauthClient.clientSecret, + disabled: oauthClient.disabled, + public: oauthClient.public, + tokenEndpointAuthMethod: oauthClient.tokenEndpointAuthMethod, + grantTypes: oauthClient.grantTypes, + scopes: oauthClient.scopes, + skipConsent: oauthClient.skipConsent, + }) + .from(oauthClient) + .where(eq(oauthClient.clientId, clientId)) + .limit(1) + return client +} + +/** Validates one token-endpoint client authentication attempt against its registered method. */ +export async function validateOAuthClientCredentials( + credentials: OAuthClientCredentials, + database: OAuthDatabase = db +): Promise> { + const authenticated = await authenticateClient( + await readClient(database, credentials.clientId), + credentials + ) + return authenticated.success + ? { success: true, value: undefined } + : protocolError(authenticated.error, authenticated.description) +} + +async function readRefreshToken( + database: OAuthReadDatabase, + tokenHash: string +): Promise { + const [token] = await database + .select({ + id: oauthRefreshToken.id, + clientId: oauthRefreshToken.clientId, + sessionId: oauthRefreshToken.sessionId, + userId: oauthRefreshToken.userId, + referenceId: oauthRefreshToken.referenceId, + expiresAt: oauthRefreshToken.expiresAt, + revoked: oauthRefreshToken.revoked, + authTime: oauthRefreshToken.authTime, + scopes: oauthRefreshToken.scopes, + familyId: oauthRefreshToken.familyId, + familyConsentId: oauthTokenFamily.consentId, + generation: oauthRefreshToken.generation, + }) + .from(oauthRefreshToken) + .innerJoin(oauthTokenFamily, eq(oauthRefreshToken.familyId, oauthTokenFamily.id)) + .where(eq(oauthRefreshToken.token, tokenHash)) + .limit(1) + return token +} + +function validateScopes( + tokenScopes: string[], + clientScopes: string[] | null, + requestedScopes?: string[] +): OAuthProtocolResult { + const scopes = requestedScopes ?? tokenScopes + const tokenScopeSet = new Set(tokenScopes) + const clientScopeSet = clientScopes ? new Set(clientScopes) : null + for (const scope of scopes) { + if (!tokenScopeSet.has(scope) || (clientScopeSet && !clientScopeSet.has(scope))) { + return protocolError('invalid_scope', `The client cannot refresh scope ${scope}.`) + } + } + return { success: true, value: scopes } +} + +/** + * Rotates one refresh token under the stable family lock. + * + * Replay is intentionally fail-closed: after the first rotation commits, a + * second presentation of any consumed generation deletes the family parent. + * Cascades remove every refresh token and every access token issued by this + * login while independent logins for the same user and client remain intact. + */ +export async function rotateOAuthRefreshToken( + input: RotateOAuthRefreshTokenInput, + database: OAuthDatabase = db +): Promise> { + const rawRefreshToken = stripTokenPrefix(input.refreshToken, OAUTH_REFRESH_TOKEN_PREFIX) + if (!rawRefreshToken) return protocolError('invalid_grant', 'Refresh token is invalid.') + + const clientAuthentication = await authenticateClient( + await readClient(database, input.credentials.clientId), + input.credentials + ) + if (!clientAuthentication.success) return clientAuthentication + if (!clientAllowsRefresh(clientAuthentication.value)) { + return protocolError('unauthorized_client', 'Client is not allowed to use refresh tokens.') + } + + const tokenHash = hashOAuthToken(rawRefreshToken) + const provisionalToken = await readRefreshToken(database, tokenHash) + if (!provisionalToken) return protocolError('invalid_grant', 'Refresh token is invalid.') + if (provisionalToken.clientId !== input.credentials.clientId) { + return protocolError('invalid_grant', 'Refresh token is invalid.') + } + + const nextRefreshBody = generateSecureToken(32) + const nextAccessBody = generateSecureToken(32) + const nextRefreshId = generateId() + const nextAccessId = generateId() + + return database.transaction(async (tx) => { + const [activeUser] = await tx + .select({ id: user.id, banned: user.banned, banExpires: user.banExpires }) + .from(user) + .where(eq(user.id, provisionalToken.userId)) + .for('share') + .limit(1) + if (!activeUser || isBanActive(activeUser)) { + return protocolError('invalid_grant', 'Refresh token is invalid.') + } + + if (provisionalToken.sessionId) { + const [activeSession] = await tx + .select({ id: session.id }) + .from(session) + .where(eq(session.id, provisionalToken.sessionId)) + .for('share') + .limit(1) + if (!activeSession) return protocolError('invalid_grant', 'Refresh token is invalid.') + } + + const [lockedClient] = await tx + .select({ + clientId: oauthClient.clientId, + clientSecret: oauthClient.clientSecret, + disabled: oauthClient.disabled, + public: oauthClient.public, + tokenEndpointAuthMethod: oauthClient.tokenEndpointAuthMethod, + grantTypes: oauthClient.grantTypes, + scopes: oauthClient.scopes, + skipConsent: oauthClient.skipConsent, + }) + .from(oauthClient) + .where(eq(oauthClient.clientId, input.credentials.clientId)) + .for('share') + .limit(1) + const lockedAuthentication = await authenticateClient(lockedClient, input.credentials) + if (!lockedAuthentication.success) return lockedAuthentication + if (!clientAllowsRefresh(lockedAuthentication.value)) { + return protocolError('unauthorized_client', 'Client is not allowed to use refresh tokens.') + } + + let consentScopes: string[] | null = null + if (!lockedClient?.skipConsent) { + if (!provisionalToken.familyConsentId) { + return protocolError('invalid_grant', 'Refresh token is invalid.') + } + const [consent] = await tx + .select({ id: oauthConsent.id, scopes: oauthConsent.scopes }) + .from(oauthConsent) + .where(eq(oauthConsent.id, provisionalToken.familyConsentId)) + .for('share') + .limit(1) + if (!consent) return protocolError('invalid_grant', 'Refresh token is invalid.') + consentScopes = consent.scopes + } + + const [family] = await tx + .select({ + id: oauthTokenFamily.id, + clientId: oauthTokenFamily.clientId, + userId: oauthTokenFamily.userId, + sessionId: oauthTokenFamily.sessionId, + referenceId: oauthTokenFamily.referenceId, + currentGeneration: oauthTokenFamily.currentGeneration, + expiresAt: oauthTokenFamily.expiresAt, + }) + .from(oauthTokenFamily) + .where(eq(oauthTokenFamily.id, provisionalToken.familyId)) + .for('update') + .limit(1) + if (!family) return protocolError('invalid_grant', 'Refresh token is invalid.') + + const rotationTime = new Date() + const currentToken = await readRefreshToken(tx, tokenHash) + if ( + !currentToken || + currentToken.familyId !== family.id || + currentToken.clientId !== family.clientId || + currentToken.userId !== family.userId || + currentToken.sessionId !== family.sessionId || + currentToken.referenceId !== family.referenceId || + currentToken.revoked || + currentToken.expiresAt <= rotationTime || + family.expiresAt <= rotationTime || + currentToken.generation !== family.currentGeneration + ) { + await tx.delete(oauthTokenFamily).where(eq(oauthTokenFamily.id, family.id)) + return protocolError('invalid_grant', 'Refresh token is invalid or has already been used.') + } + + const originalScopesAllowedByClient = + !lockedClient.scopes || + currentToken.scopes.every((scope) => lockedClient.scopes?.includes(scope)) + const originalScopesStillConsented = + lockedClient.skipConsent || + (consentScopes !== null && + currentToken.scopes.every((scope) => consentScopes.includes(scope))) + if (!originalScopesAllowedByClient || !originalScopesStillConsented) { + await tx.delete(oauthTokenFamily).where(eq(oauthTokenFamily.id, family.id)) + return protocolError('invalid_grant', 'Refresh token grant is no longer active.') + } + if (family.currentGeneration >= OAUTH_TOKEN_FAMILY_MAX_GENERATION) { + await tx.delete(oauthTokenFamily).where(eq(oauthTokenFamily.id, family.id)) + return protocolError('invalid_grant', 'Refresh token grant reached its rotation limit.') + } + + const scopes = validateScopes(currentToken.scopes, lockedClient.scopes, input.requestedScopes) + if (!scopes.success) return scopes + + const [consumed] = await tx + .update(oauthRefreshToken) + .set({ revoked: rotationTime }) + .where(and(eq(oauthRefreshToken.id, currentToken.id), isNull(oauthRefreshToken.revoked))) + .returning({ id: oauthRefreshToken.id }) + if (!consumed) { + await tx.delete(oauthTokenFamily).where(eq(oauthTokenFamily.id, family.id)) + return protocolError('invalid_grant', 'Refresh token is invalid or has already been used.') + } + + const nextGeneration = family.currentGeneration + 1 + await tx + .update(oauthTokenFamily) + .set({ currentGeneration: nextGeneration }) + .where(eq(oauthTokenFamily.id, family.id)) + + const accessExpiresAt = new Date(rotationTime.getTime() + OAUTH_ACCESS_TOKEN_TTL_SECONDS * 1000) + + await tx.insert(oauthRefreshToken).values({ + id: nextRefreshId, + token: hashOAuthToken(nextRefreshBody), + clientId: currentToken.clientId, + sessionId: currentToken.sessionId, + userId: currentToken.userId, + referenceId: currentToken.referenceId, + expiresAt: family.expiresAt, + createdAt: rotationTime, + revoked: null, + authTime: currentToken.authTime, + scopes: currentToken.scopes, + familyId: family.id, + generation: nextGeneration, + }) + await tx.insert(oauthAccessToken).values({ + id: nextAccessId, + token: hashOAuthToken(nextAccessBody), + clientId: currentToken.clientId, + sessionId: currentToken.sessionId, + userId: currentToken.userId, + referenceId: currentToken.referenceId, + refreshId: nextRefreshId, + expiresAt: accessExpiresAt, + createdAt: rotationTime, + scopes: scopes.value, + }) + + return { + success: true, + value: { + accessToken: `${OAUTH_ACCESS_TOKEN_PREFIX}${nextAccessBody}`, + refreshToken: `${OAUTH_REFRESH_TOKEN_PREFIX}${nextRefreshBody}`, + expiresIn: OAUTH_ACCESS_TOKEN_TTL_SECONDS, + expiresAt: Math.floor(accessExpiresAt.getTime() / 1000), + scope: scopes.value.join(' '), + }, + } + }) +} + +/** Revokes one refresh family or one opaque access token. Unknown tokens are a successful no-op. */ +export async function revokeOAuthToken( + input: { credentials: OAuthClientCredentials; token: string }, + database: OAuthDatabase = db +): Promise> { + const clientAuthentication = await authenticateClient( + await readClient(database, input.credentials.clientId), + input.credentials + ) + if (!clientAuthentication.success) return clientAuthentication + + const rawRefreshToken = stripTokenPrefix(input.token, OAUTH_REFRESH_TOKEN_PREFIX) + if (rawRefreshToken) { + const provisionalToken = await readRefreshToken(database, hashOAuthToken(rawRefreshToken)) + if (!provisionalToken || provisionalToken.clientId !== input.credentials.clientId) { + return { success: true, value: undefined } + } + + return database.transaction(async (tx) => { + await tx + .select({ id: user.id }) + .from(user) + .where(eq(user.id, provisionalToken.userId)) + .for('share') + .limit(1) + if (provisionalToken.sessionId) { + await tx + .select({ id: session.id }) + .from(session) + .where(eq(session.id, provisionalToken.sessionId)) + .for('share') + .limit(1) + } + const [lockedClient] = await tx + .select({ + clientId: oauthClient.clientId, + clientSecret: oauthClient.clientSecret, + disabled: oauthClient.disabled, + public: oauthClient.public, + tokenEndpointAuthMethod: oauthClient.tokenEndpointAuthMethod, + grantTypes: oauthClient.grantTypes, + scopes: oauthClient.scopes, + skipConsent: oauthClient.skipConsent, + }) + .from(oauthClient) + .where(eq(oauthClient.clientId, input.credentials.clientId)) + .for('share') + .limit(1) + const lockedAuthentication = await authenticateClient(lockedClient, input.credentials) + if (!lockedAuthentication.success) return lockedAuthentication + + const [family] = await tx + .select({ id: oauthTokenFamily.id, consentId: oauthTokenFamily.consentId }) + .from(oauthTokenFamily) + .where(eq(oauthTokenFamily.id, provisionalToken.familyId)) + .limit(1) + if (!family) return { success: true, value: undefined } + + if (family.consentId) { + await tx + .select({ id: oauthConsent.id }) + .from(oauthConsent) + .where(eq(oauthConsent.id, family.consentId)) + .for('share') + .limit(1) + } + await tx + .select({ id: oauthTokenFamily.id }) + .from(oauthTokenFamily) + .where(eq(oauthTokenFamily.id, family.id)) + .for('update') + .limit(1) + await tx.delete(oauthTokenFamily).where(eq(oauthTokenFamily.id, family.id)) + return { success: true, value: undefined } + }) + } + + const rawAccessToken = stripTokenPrefix(input.token, OAUTH_ACCESS_TOKEN_PREFIX) + if (rawAccessToken) { + await database + .delete(oauthAccessToken) + .where( + and( + eq(oauthAccessToken.token, hashOAuthToken(rawAccessToken)), + eq(oauthAccessToken.clientId, input.credentials.clientId) + ) + ) + } + return { success: true, value: undefined } +} diff --git a/apps/sim/lib/auth/sim-auth-adapter.ts b/apps/sim/lib/auth/sim-auth-adapter.ts new file mode 100644 index 00000000000..ece76dfa152 --- /dev/null +++ b/apps/sim/lib/auth/sim-auth-adapter.ts @@ -0,0 +1,37 @@ +import { db } from '@sim/db' +import * as schema from '@sim/db/schema' +import type { BetterAuthOptions } from 'better-auth' +import { drizzleAdapter } from 'better-auth/adapters/drizzle' +import { + type AuthDatabase, + guardOAuthProviderWrites, +} from '@/lib/auth/oauth-provider-adapter-guard' +import { guardSubscriptionPlanWrites } from '@/lib/auth/stripe-adapter-guard' + +type BetterAuthAdapter = ReturnType> + +/** + * Builds every Better Auth adapter surface, including transactional callbacks, + * with Sim's write invariants applied to the actual Drizzle connection in use. + */ +export function createSimAuthAdapter( + options: BetterAuthOptions, + database: AuthDatabase = db, + inTransaction = false +): BetterAuthAdapter { + const base = drizzleAdapter(database, { + provider: 'pg', + schema, + transaction: false, + })(options) + const guarded = guardSubscriptionPlanWrites(guardOAuthProviderWrites(base, database)) + if (inTransaction) return guarded + + guarded.transaction = (callback) => + database.transaction(async (tx) => { + const transactionAdapter = createSimAuthAdapter(options, tx, true) + const { transaction: _transaction, ...surface } = transactionAdapter + return callback(surface) + }) + return guarded +} diff --git a/apps/sim/lib/billing/application/list-billing-logs.ts b/apps/sim/lib/billing/application/list-billing-logs.ts index f117ddd7e74..fa6ca6eb2ff 100644 --- a/apps/sim/lib/billing/application/list-billing-logs.ts +++ b/apps/sim/lib/billing/application/list-billing-logs.ts @@ -39,14 +39,14 @@ function apportionLogCredits(usage: ListBillingLogsResult['usage']): Record = { - INSUFFICIENT_WORKSPACE_ROLE: - 'The caller has access to the workspace but its role is below the one this operation requires.', - PERSONAL_API_KEYS_DISABLED: - "The workspace's organization does not allow personal API keys. Use a workspace API key.", - WORKSPACE_KEY_OPERATION_NOT_PERMITTED: - 'This operation is not available to a workspace-scoped API key. Use a personal API key.', - PRINCIPAL_KIND_NOT_PERMITTED: 'This operation does not accept the caller’s kind of API key.', - ORGANIZATION_MEMBERSHIP_REQUIRED: 'The caller is not a member of the organization it named.', - ORGANIZATION_ADMIN_REQUIRED: - 'The caller is a member of the organization but not an admin or owner.', - ENTERPRISE_PLAN_REQUIRED: 'The organization has no active enterprise subscription.', - ORGANIZATION_PLAN_REQUIRED: - 'The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).', - AUDIT_LOGS_DISABLED: 'Audit logging is not enabled for this deployment.', - SKILL_EDITOR_ACCESS_REQUIRED: - 'The caller can write in the workspace but is not an editor of this skill.', - SECRET_ADMIN_ACCESS_REQUIRED: - 'The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.', - WORKSPACE_RESOURCE_LIMIT_REACHED: - 'The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.', - PUBLIC_SHARING_NOT_ALLOWED: - "The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.", - CREDENTIAL_ADMIN_ACCESS_REQUIRED: - 'The caller can reach the workspace but cannot administer this credential.', - MCP_SERVER_URL_NOT_ALLOWED: - 'The supplied MCP server URL is outside the allowed domains or resolves to an internal address.', - WORKSPACE_PLAN_CAPABILITY_REQUIRED: - "The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.", - CHAT_AUTH_MODE_NOT_PERMITTED: - "The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.", - CONNECTOR_MANAGED_RESOURCE_READ_ONLY: - 'This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.', - PERMISSION_GROUP_CAPABILITY_BLOCKED: - "The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.", - INTEGRATION_NOT_ALLOWED: - "The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.", - INSUFFICIENT_SCOPE: - 'The OAuth access token was not granted the scope this operation needs. The `WWW-Authenticate` header names the scope; authorize the app again requesting it.', -} - /** * A `forbidden` orchestration failure that names its cause. * diff --git a/apps/sim/lib/core/application/index.ts b/apps/sim/lib/core/application/index.ts index 25a4155d9b4..7572070dfc9 100644 --- a/apps/sim/lib/core/application/index.ts +++ b/apps/sim/lib/core/application/index.ts @@ -9,7 +9,6 @@ export { type WorkspaceUseCaseAuditEntry, } from '@/lib/core/application/authorized-workspace-use-case' export { - FORBIDDEN_DETAIL_CODE_DESCRIPTIONS, FORBIDDEN_DETAIL_CODES, type ForbiddenDetailCode, ForbiddenOperationError, diff --git a/apps/sim/lib/core/application/workspace-authorization.test.ts b/apps/sim/lib/core/application/workspace-authorization.test.ts index df385d1377f..741c90cfff0 100644 --- a/apps/sim/lib/core/application/workspace-authorization.test.ts +++ b/apps/sim/lib/core/application/workspace-authorization.test.ts @@ -651,7 +651,7 @@ describe('authorizeWorkspaceOperation OAuth access token policy', () => { userId: 'user-1', clientId: 'sim-cli', tokenId: 'token-1', - scopes: ['openid', 'api:read', 'api:write'], + scopes: ['offline_access', 'api:read', 'api:write'], expiresAt: new Date('2099-01-01T00:00:00.000Z'), ...overrides, } @@ -679,7 +679,7 @@ describe('authorizeWorkspaceOperation OAuth access token policy', () => { it('refuses a token carrying neither API scope before touching the workspace', async () => { const failure = await authorizeWorkspaceOperation( - token({ scopes: ['openid', 'profile'] }), + token({ scopes: ['offline_access'] }), readOperation, context ).catch((error) => error) @@ -699,7 +699,7 @@ describe('authorizeWorkspaceOperation OAuth access token policy', () => { it('leaves the write decision to the surface, admitting a read-only token on a write operation', async () => { await expect( authorizeWorkspaceOperation( - token({ scopes: ['openid', 'api:read'] }), + token({ scopes: ['offline_access', 'api:read'] }), oauthWriteOperation, context ) @@ -709,7 +709,7 @@ describe('authorizeWorkspaceOperation OAuth access token policy', () => { it('lets api:write satisfy a read operation', async () => { await expect( authorizeWorkspaceOperation( - token({ scopes: ['openid', 'api:write'] }), + token({ scopes: ['offline_access', 'api:write'] }), readOperation, context ) diff --git a/apps/sim/lib/core/config/env-flags.ts b/apps/sim/lib/core/config/env-flags.ts index cb8235aa20b..de933a695b8 100644 --- a/apps/sim/lib/core/config/env-flags.ts +++ b/apps/sim/lib/core/config/env-flags.ts @@ -316,16 +316,16 @@ function enterpriseFeatureEnabled( } /** - * Is Sim acting as an OAuth 2.1 authorization server: the `/oauth2/*` Better - * Auth routes, the consent page, and bearer-token acceptance on `/api/v2`. On - * by default because the seeded Sim CLI client is the only thing that can use - * it until an admin registers more; `OAUTH_PROVIDER_ENABLED=false` is the kill - * switch. Auth-disabled deployments cannot complete Better Auth's + * Is Sim acting as an OAuth 2.0 authorization server: the `/oauth2/*` Better + * Auth routes, the consent page, and bearer-token acceptance on `/api/v2`. + * Explicit opt-in keeps a rolling deployment from issuing a family token on a + * new instance and refreshing it through an old instance that lacks the + * transactional family implementation. Auth-disabled deployments cannot complete Better Auth's * session-bound authorization flow, so they use the CLI's pairing handoff * instead. Authorized-app history remains visible while issuance is off so * historical grants can still be revoked. */ -export const isOAuthProviderEnabled = !isAuthDisabled && !isFalsy(env.OAUTH_PROVIDER_ENABLED) +export const isOAuthProviderEnabled = !isAuthDisabled && isTruthy(env.OAUTH_PROVIDER_ENABLED) /** * Is SSO enabled for enterprise authentication diff --git a/apps/sim/lib/core/config/env.ts b/apps/sim/lib/core/config/env.ts index 6f27fa0ed67..82db943e5ab 100644 --- a/apps/sim/lib/core/config/env.ts +++ b/apps/sim/lib/core/config/env.ts @@ -621,7 +621,7 @@ export const env = createEnv({ /** Comma-separated proxy IPs/CIDRs skipped while resolving the forwarded client chain. */ AUTH_TRUSTED_PROXIES: z.string().optional(), - // Sim as an OAuth 2.1 provider (CLI sign-in, connected apps). On unless set to false. + /** Sim's OAuth provider remains an explicit opt-in for rollout safety. */ OAUTH_PROVIDER_ENABLED: z.boolean().optional(), // SSO Configuration (for script-based registration) diff --git a/apps/sim/lib/permission-groups/capabilities.ts b/apps/sim/lib/permission-groups/capabilities.ts index df0d117c819..f6060c6590c 100644 --- a/apps/sim/lib/permission-groups/capabilities.ts +++ b/apps/sim/lib/permission-groups/capabilities.ts @@ -130,9 +130,8 @@ function allowlistDenies(allowed: readonly string[] | null, member: string): boo * What each capability means in terms of the stored config. * * `satisfies` rather than an annotation, so adding a capability still fails to - * compile until it is given a rule — the same completeness gate - * `FORBIDDEN_DETAIL_CODE_DESCRIPTIONS` uses — while each entry keeps its own - * `kind`. Annotating would widen every entry to `CapabilityRule`, and + * compile until it is given a rule while each entry keeps its own `kind`. + * Annotating would widen every entry to `CapabilityRule`, and * {@link StaticPermissionGroupCapability} would then resolve to `never`, * silently rejecting every capability an operation tried to declare. */ diff --git a/apps/sim/lib/users/application/authorized-apps.test.ts b/apps/sim/lib/users/application/authorized-apps.test.ts index 5e05d9ea62e..27a655d4828 100644 --- a/apps/sim/lib/users/application/authorized-apps.test.ts +++ b/apps/sim/lib/users/application/authorized-apps.test.ts @@ -123,7 +123,6 @@ describe('authorized apps', () => { */ expect(deleted.map(([table]) => table)).toEqual([ schemaMock.oauthConsent, - schemaMock.oauthRefreshToken, schemaMock.oauthAccessToken, ]) expect(mocks.recordAudit).toHaveBeenCalledWith( diff --git a/apps/sim/lib/users/application/authorized-apps.ts b/apps/sim/lib/users/application/authorized-apps.ts index 6882c02f7a1..2fea72e0caa 100644 --- a/apps/sim/lib/users/application/authorized-apps.ts +++ b/apps/sim/lib/users/application/authorized-apps.ts @@ -1,6 +1,6 @@ import { AuditAction, AuditResourceType, recordAudit } from '@sim/audit' import { db } from '@sim/db' -import { oauthAccessToken, oauthClient, oauthConsent, oauthRefreshToken } from '@sim/db/schema' +import { oauthAccessToken, oauthClient, oauthConsent } from '@sim/db/schema' import { and, desc, eq } from 'drizzle-orm' import type { AuthorizedApp } from '@/lib/api/contracts/user' import type { OperationUseCase } from '@/lib/core/application' @@ -79,9 +79,6 @@ export const revokeAuthorizedAppUseCase: OperationUseCase< await tx .delete(oauthConsent) .where(and(eq(oauthConsent.userId, userId), eq(oauthConsent.clientId, clientId))) - await tx - .delete(oauthRefreshToken) - .where(and(eq(oauthRefreshToken.userId, userId), eq(oauthRefreshToken.clientId, clientId))) await tx .delete(oauthAccessToken) .where(and(eq(oauthAccessToken.userId, userId), eq(oauthAccessToken.clientId, clientId))) diff --git a/apps/sim/scripts/create-oauth-client.ts b/apps/sim/scripts/create-oauth-client.ts index dfe6d87cd9f..0ae26f6a916 100644 --- a/apps/sim/scripts/create-oauth-client.ts +++ b/apps/sim/scripts/create-oauth-client.ts @@ -27,12 +27,10 @@ * A confidential client's secret is generated here, encrypted the way the * provider stores it, and printed exactly once. * - * Encrypted rather than hashed because the provider issues opaque access - * tokens (`disableJwtPlugin`), which leaves the client secret as the key an ID - * token is signed with — so the server has to read it back. `symmetricEncrypt` - * under `BETTER_AUTH_SECRET` is exactly what the plugin's own client creation - * does; writing a hash here produced a row no client could ever authenticate - * against. + * Better Auth requires reversibly encrypted client secrets whenever its JWT + * plugin is disabled. `symmetricEncrypt` under `BETTER_AUTH_SECRET` matches + * the provider's own client creation path, so token-endpoint authentication + * can read and compare the secret. */ import { randomBytes } from 'node:crypto' @@ -43,7 +41,7 @@ import { symmetricEncrypt } from 'better-auth/crypto' import { eq } from 'drizzle-orm' import { drizzle } from 'drizzle-orm/postgres-js' import postgres from 'postgres' -import { OAUTH_PUBLIC_CLIENT_SCOPES, OAUTH_SCOPES } from '@/lib/auth/oauth-provider' +import { OAUTH_SCOPES } from '@/lib/auth/oauth-provider' /** * Read from the provider's own list rather than copied, and every requested @@ -115,14 +113,6 @@ export async function main(): Promise { `Unknown scope(s): ${unknownScopes.join(', ')}. Sim's provider declares: ${DEFAULT_SCOPES.join(', ')}` ) } - const unsupportedPublicScopes = scopes.filter( - (scope) => !(OAUTH_PUBLIC_CLIENT_SCOPES as readonly string[]).includes(scope) - ) - if (isPublic && unsupportedPublicScopes.length > 0) { - throw new Error( - `Public clients cannot request identity scope(s) ${unsupportedPublicScopes.join(', ')} while JWT signing is disabled. Use a confidential client, or request only: ${OAUTH_PUBLIC_CLIENT_SCOPES.join(', ')}` - ) - } const secret = isPublic ? null : randomBytes(32).toString('base64url') const storedSecret = secret ? await symmetricEncrypt({ key: requireEnv('BETTER_AUTH_SECRET'), data: secret }) @@ -150,6 +140,7 @@ export async function main(): Promise { } const now = new Date() + const tokenEndpointAuthMethod = isPublic ? 'none' : 'client_secret_basic' const clientUri = process.env.OAUTH_CLIENT_URI?.trim() || null const logoUri = process.env.OAUTH_CLIENT_LOGO_URI?.trim() || null if (clientUri) assertTerminalSafe('OAUTH_CLIENT_URI', clientUri) @@ -166,7 +157,7 @@ export async function main(): Promise { skipConsent: false, public: isPublic, type: isPublic ? 'native' : 'web', - tokenEndpointAuthMethod: isPublic ? 'none' : 'client_secret_post', + tokenEndpointAuthMethod, requirePKCE: true, grantTypes: ['authorization_code', 'refresh_token'], responseTypes: ['code'], @@ -180,6 +171,7 @@ export async function main(): Promise { `Created OAuth client "${name}"`, ` client_id: ${clientId}`, ` type: ${isPublic ? 'public (PKCE only)' : 'confidential'}`, + ` token_auth: ${tokenEndpointAuthMethod}`, ` redirect_uris: ${redirectUris.join(', ')}`, ` scopes: ${scopes.join(' ')}`, ] diff --git a/packages/db/migrations/0322_oauth_provider.sql b/packages/db/migrations/0322_oauth_provider.sql index 4c7b0a06f26..cc631a1760d 100644 --- a/packages/db/migrations/0322_oauth_provider.sql +++ b/packages/db/migrations/0322_oauth_provider.sql @@ -1,3 +1,8 @@ +-- migration-safe: New OAuth tables, constraints, triggers, and seed data only; no existing rows or serving queries are rewritten. +-- Migration 0321 deliberately commits the runner's batch transaction before concurrent index builds. +-- Re-open one here so every OAuth object and Drizzle's journal row commit or roll back together. +-- On upgrades where 0322 is the only pending file, PostgreSQL treats this as a harmless nested-BEGIN warning. +BEGIN;--> statement-breakpoint CREATE TABLE "oauth_access_token" ( "id" text PRIMARY KEY NOT NULL, "token" text NOT NULL, @@ -69,19 +74,41 @@ CREATE TABLE "oauth_refresh_token" ( "revoked" timestamp, "auth_time" timestamp, "scopes" text[] NOT NULL, - CONSTRAINT "oauth_refresh_token_token_unique" UNIQUE("token") + "family_id" text NOT NULL, + "generation" integer NOT NULL, + CONSTRAINT "oauth_refresh_token_token_unique" UNIQUE("token"), + CONSTRAINT "oauth_refresh_token_family_generation_unique" UNIQUE("family_id","generation"), + CONSTRAINT "oauth_refresh_token_generation_check" CHECK ("oauth_refresh_token"."generation" BETWEEN 0 AND 1000) +); +--> statement-breakpoint +CREATE TABLE "oauth_token_family" ( + "id" text PRIMARY KEY NOT NULL, + "client_id" text NOT NULL, + "session_id" text, + "user_id" text NOT NULL, + "reference_id" text, + "consent_id" text, + "current_generation" integer DEFAULT 0 NOT NULL, + "created_at" timestamp NOT NULL, + "expires_at" timestamp NOT NULL, + CONSTRAINT "oauth_token_family_generation_check" CHECK ("oauth_token_family"."current_generation" BETWEEN 0 AND 1000) ); --> statement-breakpoint -ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_client_id_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."oauth_client"("client_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_session_id_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."session"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_refresh_id_oauth_refresh_token_id_fk" FOREIGN KEY ("refresh_id") REFERENCES "public"."oauth_refresh_token"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "oauth_client" ADD CONSTRAINT "oauth_client_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "oauth_consent" ADD CONSTRAINT "oauth_consent_client_id_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."oauth_client"("client_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "oauth_consent" ADD CONSTRAINT "oauth_consent_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_token_family" ADD CONSTRAINT "oauth_token_family_client_id_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."oauth_client"("client_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_token_family" ADD CONSTRAINT "oauth_token_family_session_id_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."session"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_token_family" ADD CONSTRAINT "oauth_token_family_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_token_family" ADD CONSTRAINT "oauth_token_family_consent_id_oauth_consent_id_fk" FOREIGN KEY ("consent_id") REFERENCES "public"."oauth_consent"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "oauth_refresh_token" ADD CONSTRAINT "oauth_refresh_token_client_id_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."oauth_client"("client_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "oauth_refresh_token" ADD CONSTRAINT "oauth_refresh_token_session_id_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."session"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint ALTER TABLE "oauth_refresh_token" ADD CONSTRAINT "oauth_refresh_token_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_refresh_token" ADD CONSTRAINT "oauth_refresh_token_family_id_oauth_token_family_id_fk" FOREIGN KEY ("family_id") REFERENCES "public"."oauth_token_family"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_client_id_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."oauth_client"("client_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_session_id_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."session"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "oauth_access_token" ADD CONSTRAINT "oauth_access_token_refresh_id_oauth_refresh_token_id_fk" FOREIGN KEY ("refresh_id") REFERENCES "public"."oauth_refresh_token"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint CREATE INDEX "oauth_access_token_client_id_idx" ON "oauth_access_token" USING btree ("client_id");--> statement-breakpoint CREATE INDEX "oauth_access_token_session_id_idx" ON "oauth_access_token" USING btree ("session_id");--> statement-breakpoint CREATE INDEX "oauth_access_token_refresh_id_idx" ON "oauth_access_token" USING btree ("refresh_id");--> statement-breakpoint @@ -93,36 +120,55 @@ CREATE INDEX "oauth_refresh_token_client_id_idx" ON "oauth_refresh_token" USING CREATE INDEX "oauth_refresh_token_session_id_idx" ON "oauth_refresh_token" USING btree ("session_id");--> statement-breakpoint CREATE INDEX "oauth_refresh_token_user_client_idx" ON "oauth_refresh_token" USING btree ("user_id","client_id");--> statement-breakpoint CREATE INDEX "oauth_refresh_token_expires_at_idx" ON "oauth_refresh_token" USING btree ("expires_at");--> statement-breakpoint -CREATE FUNCTION "oauth_consent_upsert"() RETURNS trigger AS $$ +CREATE INDEX "oauth_token_family_client_id_idx" ON "oauth_token_family" USING btree ("client_id");--> statement-breakpoint +CREATE INDEX "oauth_token_family_session_id_idx" ON "oauth_token_family" USING btree ("session_id");--> statement-breakpoint +CREATE INDEX "oauth_token_family_user_client_idx" ON "oauth_token_family" USING btree ("user_id","client_id");--> statement-breakpoint +CREATE INDEX "oauth_token_family_consent_id_idx" ON "oauth_token_family" USING btree ("consent_id");--> statement-breakpoint +CREATE INDEX "oauth_token_family_expires_at_idx" ON "oauth_token_family" USING btree ("expires_at");--> statement-breakpoint +CREATE FUNCTION "oauth_refresh_token_prepare_family"() RETURNS trigger AS $$ DECLARE - existing_id text; + resolved_consent_id text; BEGIN - PERFORM pg_advisory_xact_lock( - hashtextextended( - concat_ws(E'\x1f', NEW."client_id", NEW."user_id", NEW."reference_id"), - 0 - ) - ); + IF NEW."family_id" IS NULL THEN + SELECT "id" INTO resolved_consent_id + FROM "oauth_consent" + WHERE "client_id" = NEW."client_id" + AND "user_id" IS NOT DISTINCT FROM NEW."user_id" + AND "reference_id" IS NOT DISTINCT FROM NEW."reference_id" + FOR KEY SHARE; - SELECT "id" INTO existing_id - FROM "oauth_consent" - WHERE "client_id" = NEW."client_id" - AND "user_id" IS NOT DISTINCT FROM NEW."user_id" - AND "reference_id" IS NOT DISTINCT FROM NEW."reference_id"; + NEW."family_id" := NEW."id"; + NEW."generation" := 0; + INSERT INTO "oauth_token_family" ( + "id", "client_id", "session_id", "user_id", "reference_id", + "consent_id", "current_generation", "created_at", "expires_at" + ) VALUES ( + NEW."id", NEW."client_id", NEW."session_id", NEW."user_id", NEW."reference_id", + resolved_consent_id, 0, NEW."created_at", NEW."expires_at" + ); + ELSE + PERFORM 1 + FROM "oauth_token_family" AS family + WHERE family."id" = NEW."family_id" + AND family."client_id" = NEW."client_id" + AND family."user_id" = NEW."user_id" + AND family."session_id" IS NOT DISTINCT FROM NEW."session_id" + AND family."reference_id" IS NOT DISTINCT FROM NEW."reference_id" + AND family."current_generation" = NEW."generation" + AND NEW."expires_at" <= family."expires_at"; - IF existing_id IS NOT NULL THEN - UPDATE "oauth_consent" - SET "scopes" = NEW."scopes", "updated_at" = NEW."updated_at" - WHERE "id" = existing_id; - RETURN NULL; + IF NOT FOUND THEN + RAISE EXCEPTION 'OAuth refresh token does not match its current family generation' + USING ERRCODE = 'foreign_key_violation'; + END IF; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql;--> statement-breakpoint -CREATE TRIGGER "oauth_consent_upsert" - BEFORE INSERT ON "oauth_consent" +CREATE TRIGGER "oauth_refresh_token_10_prepare_family" + BEFORE INSERT ON "oauth_refresh_token" FOR EACH ROW - EXECUTE FUNCTION "oauth_consent_upsert"();--> statement-breakpoint + EXECUTE FUNCTION "oauth_refresh_token_prepare_family"();--> statement-breakpoint CREATE FUNCTION "oauth_token_require_active_consent"() RETURNS trigger AS $$ BEGIN PERFORM 1 @@ -153,7 +199,7 @@ CREATE TRIGGER "oauth_access_token_require_active_consent" BEFORE INSERT ON "oauth_access_token" FOR EACH ROW EXECUTE FUNCTION "oauth_token_require_active_consent"();--> statement-breakpoint -CREATE TRIGGER "oauth_refresh_token_require_active_consent" +CREATE TRIGGER "oauth_refresh_token_20_require_active_consent" BEFORE INSERT ON "oauth_refresh_token" FOR EACH ROW EXECUTE FUNCTION "oauth_token_require_active_consent"();--> statement-breakpoint @@ -163,11 +209,15 @@ BEGIN RETURN NEW; END IF; - DELETE FROM "oauth_refresh_token" - WHERE "client_id" = NEW."client_id" - AND "user_id" IS NOT DISTINCT FROM NEW."user_id" - AND "reference_id" IS NOT DISTINCT FROM NEW."reference_id" - AND NOT ("scopes" <@ NEW."scopes"); + DELETE FROM "oauth_token_family" AS family + WHERE family."consent_id" = NEW."id" + AND EXISTS ( + SELECT 1 + FROM "oauth_refresh_token" AS refresh + WHERE refresh."family_id" = family."id" + AND refresh."generation" = family."current_generation" + AND NOT (refresh."scopes" <@ NEW."scopes") + ); DELETE FROM "oauth_access_token" WHERE "client_id" = NEW."client_id" @@ -181,13 +231,8 @@ CREATE TRIGGER "oauth_consent_narrow_tokens" AFTER UPDATE OF "scopes" ON "oauth_consent" FOR EACH ROW EXECUTE FUNCTION "oauth_consent_narrow_tokens"();--> statement-breakpoint -CREATE FUNCTION "oauth_consent_delete_tokens"() RETURNS trigger AS $$ +CREATE FUNCTION "oauth_consent_delete_unlinked_access_tokens"() RETURNS trigger AS $$ BEGIN - DELETE FROM "oauth_refresh_token" - WHERE "client_id" = OLD."client_id" - AND "user_id" IS NOT DISTINCT FROM OLD."user_id" - AND "reference_id" IS NOT DISTINCT FROM OLD."reference_id"; - DELETE FROM "oauth_access_token" WHERE "client_id" = OLD."client_id" AND "user_id" IS NOT DISTINCT FROM OLD."user_id" @@ -195,12 +240,11 @@ BEGIN RETURN OLD; END; $$ LANGUAGE plpgsql;--> statement-breakpoint -CREATE TRIGGER "oauth_consent_delete_tokens" +CREATE TRIGGER "oauth_consent_delete_unlinked_access_tokens" AFTER DELETE ON "oauth_consent" FOR EACH ROW - EXECUTE FUNCTION "oauth_consent_delete_tokens"();--> statement-breakpoint --- Seed the first-party Sim CLI as a public (PKCE-only, no secret) OAuth client. --- Loopback redirect URIs match any port (RFC 8252 §7.3); consent is never skipped. + EXECUTE FUNCTION "oauth_consent_delete_unlinked_access_tokens"();--> statement-breakpoint +-- Seed the first-party Sim CLI as a public PKCE client. Loopback URIs match any port per RFC 8252. INSERT INTO "oauth_client" ( "id", "client_id", "name", "disabled", "skip_consent", "public", "type", "token_endpoint_auth_method", "require_pkce", "grant_types", "response_types", diff --git a/packages/db/migrations/meta/0322_snapshot.json b/packages/db/migrations/meta/0322_snapshot.json index 57bb4fb1a7c..43f46c0ef38 100644 --- a/packages/db/migrations/meta/0322_snapshot.json +++ b/packages/db/migrations/meta/0322_snapshot.json @@ -1,5 +1,5 @@ { - "id": "fe125f60-bf7f-41e4-934b-22b28e2443fd", + "id": "da36288c-6d30-4956-bc1d-5157d2131d85", "prevId": "db628744-c7d5-4412-b5d0-44cb6ed4368f", "version": "7", "dialect": "postgresql", @@ -10785,6 +10785,18 @@ "type": "text[]", "primaryKey": false, "notNull": true + }, + "family_id": { + "name": "family_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "generation": { + "name": "generation", + "type": "integer", + "primaryKey": false, + "notNull": true } }, "indexes": { @@ -10882,6 +10894,15 @@ "columnsTo": ["id"], "onDelete": "cascade", "onUpdate": "no action" + }, + "oauth_refresh_token_family_id_oauth_token_family_id_fk": { + "name": "oauth_refresh_token_family_id_oauth_token_family_id_fk", + "tableFrom": "oauth_refresh_token", + "tableTo": "oauth_token_family", + "columnsFrom": ["family_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -10890,10 +10911,212 @@ "name": "oauth_refresh_token_token_unique", "nullsNotDistinct": false, "columns": ["token"] + }, + "oauth_refresh_token_family_generation_unique": { + "name": "oauth_refresh_token_family_generation_unique", + "nullsNotDistinct": false, + "columns": ["family_id", "generation"] } }, "policies": {}, - "checkConstraints": {}, + "checkConstraints": { + "oauth_refresh_token_generation_check": { + "name": "oauth_refresh_token_generation_check", + "value": "\"oauth_refresh_token\".\"generation\" BETWEEN 0 AND 1000" + } + }, + "isRLSEnabled": false + }, + "public.oauth_token_family": { + "name": "oauth_token_family", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "consent_id": { + "name": "consent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "current_generation": { + "name": "current_generation", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "oauth_token_family_client_id_idx": { + "name": "oauth_token_family_client_id_idx", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_token_family_session_id_idx": { + "name": "oauth_token_family_session_id_idx", + "columns": [ + { + "expression": "session_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_token_family_user_client_idx": { + "name": "oauth_token_family_user_client_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_token_family_consent_id_idx": { + "name": "oauth_token_family_consent_id_idx", + "columns": [ + { + "expression": "consent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oauth_token_family_expires_at_idx": { + "name": "oauth_token_family_expires_at_idx", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "oauth_token_family_client_id_oauth_client_client_id_fk": { + "name": "oauth_token_family_client_id_oauth_client_client_id_fk", + "tableFrom": "oauth_token_family", + "tableTo": "oauth_client", + "columnsFrom": ["client_id"], + "columnsTo": ["client_id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "oauth_token_family_session_id_session_id_fk": { + "name": "oauth_token_family_session_id_session_id_fk", + "tableFrom": "oauth_token_family", + "tableTo": "session", + "columnsFrom": ["session_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "oauth_token_family_user_id_user_id_fk": { + "name": "oauth_token_family_user_id_user_id_fk", + "tableFrom": "oauth_token_family", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "oauth_token_family_consent_id_oauth_consent_id_fk": { + "name": "oauth_token_family_consent_id_oauth_consent_id_fk", + "tableFrom": "oauth_token_family", + "tableTo": "oauth_consent", + "columnsFrom": ["consent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "oauth_token_family_generation_check": { + "name": "oauth_token_family_generation_check", + "value": "\"oauth_token_family\".\"current_generation\" BETWEEN 0 AND 1000" + } + }, "isRLSEnabled": false }, "public.organization": { diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 1d92da1737f..9ba042f9ca8 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -2252,7 +2252,7 @@ { "idx": 322, "version": "7", - "when": 1788557786135, + "when": 1788562996397, "tag": "0322_oauth_provider", "breakpoints": true } diff --git a/packages/db/schema.ts b/packages/db/schema.ts index 4f5a3bd1a03..ce3da80900c 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -3953,7 +3953,7 @@ export const ssoDomain = pgTable( ) /** - * OAuth 2.1 provider tables (Better Auth `@better-auth/oauth-provider`). + * OAuth 2.0 provider tables (Better Auth `@better-auth/oauth-provider`). * * Sim is the authorization server: a registered client (the Sim CLI, or an * admin-created third-party app) sends a user through `/api/auth/oauth2/authorize`, @@ -4001,7 +4001,64 @@ export const oauthClient = pgTable( }) ) -/** A rotating refresh token; `revoked` is set when it is rotated or revoked. */ +/** The scopes a user has granted a client; deleted when the user revokes the app. */ +export const oauthConsent = pgTable( + 'oauth_consent', + { + id: text('id').primaryKey(), + clientId: text('client_id') + .notNull() + .references(() => oauthClient.clientId, { onDelete: 'cascade' }), + userId: text('user_id').references(() => user.id, { onDelete: 'cascade' }), + referenceId: text('reference_id'), + scopes: text('scopes').array().notNull(), + createdAt: timestamp('created_at').notNull(), + updatedAt: timestamp('updated_at').notNull(), + }, + (table) => ({ + clientIdIdx: index('oauth_consent_client_id_idx').on(table.clientId), + /** One grant per user, client, and reference, including nullable dimensions. */ + userClientUnique: unique('oauth_consent_user_client_reference_unique') + .on(table.userId, table.clientId, table.referenceId) + .nullsNotDistinct(), + }) +) + +/** + * One independently revocable login. Every rotating refresh token belongs to + * a stable family so replay and logout can atomically remove all descendants. + */ +export const oauthTokenFamily = pgTable( + 'oauth_token_family', + { + id: text('id').primaryKey(), + clientId: text('client_id') + .notNull() + .references(() => oauthClient.clientId, { onDelete: 'cascade' }), + sessionId: text('session_id').references(() => session.id, { onDelete: 'set null' }), + userId: text('user_id') + .notNull() + .references(() => user.id, { onDelete: 'cascade' }), + referenceId: text('reference_id'), + consentId: text('consent_id').references(() => oauthConsent.id, { onDelete: 'cascade' }), + currentGeneration: integer('current_generation').notNull().default(0), + createdAt: timestamp('created_at').notNull(), + expiresAt: timestamp('expires_at').notNull(), + }, + (table) => ({ + clientIdIdx: index('oauth_token_family_client_id_idx').on(table.clientId), + sessionIdIdx: index('oauth_token_family_session_id_idx').on(table.sessionId), + userClientIdx: index('oauth_token_family_user_client_idx').on(table.userId, table.clientId), + consentIdIdx: index('oauth_token_family_consent_id_idx').on(table.consentId), + expiresAtIdx: index('oauth_token_family_expires_at_idx').on(table.expiresAt), + generationCheck: check( + 'oauth_token_family_generation_check', + sql`${table.currentGeneration} BETWEEN 0 AND 1000` + ), + }) +) + +/** A member of a rotating refresh-token family. */ export const oauthRefreshToken = pgTable( 'oauth_refresh_token', { @@ -4020,6 +4077,10 @@ export const oauthRefreshToken = pgTable( revoked: timestamp('revoked'), authTime: timestamp('auth_time'), scopes: text('scopes').array().notNull(), + familyId: text('family_id') + .notNull() + .references(() => oauthTokenFamily.id, { onDelete: 'cascade' }), + generation: integer('generation').notNull(), }, (table) => ({ clientIdIdx: index('oauth_refresh_token_client_id_idx').on(table.clientId), @@ -4027,6 +4088,14 @@ export const oauthRefreshToken = pgTable( userClientIdx: index('oauth_refresh_token_user_client_idx').on(table.userId, table.clientId), /** Drives the cleanup pass; nothing else reads tokens by expiry. */ expiresAtIdx: index('oauth_refresh_token_expires_at_idx').on(table.expiresAt), + familyGenerationUnique: unique('oauth_refresh_token_family_generation_unique').on( + table.familyId, + table.generation + ), + generationCheck: check( + 'oauth_refresh_token_generation_check', + sql`${table.generation} BETWEEN 0 AND 1000` + ), }) ) @@ -4059,37 +4128,6 @@ export const oauthAccessToken = pgTable( }) ) -/** The scopes a user has granted a client; deleted when the user revokes the app. */ -export const oauthConsent = pgTable( - 'oauth_consent', - { - id: text('id').primaryKey(), - clientId: text('client_id') - .notNull() - .references(() => oauthClient.clientId, { onDelete: 'cascade' }), - userId: text('user_id').references(() => user.id, { onDelete: 'cascade' }), - referenceId: text('reference_id'), - scopes: text('scopes').array().notNull(), - createdAt: timestamp('created_at').notNull(), - updatedAt: timestamp('updated_at').notNull(), - }, - (table) => ({ - clientIdIdx: index('oauth_consent_client_id_idx').on(table.clientId), - /** - * One grant per (user, client, reference). The migration's insert trigger - * serializes and converts the plugin's non-atomic read-then-create into an - * upsert; this constraint remains the final integrity backstop. - * - * `nullsNotDistinct` because both `user_id` and `reference_id` are - * nullable, and Postgres treats NULLs as distinct by default — which would - * let exactly the duplicates this exists to prevent through. - */ - userClientUnique: unique('oauth_consent_user_client_reference_unique') - .on(table.userId, table.clientId, table.referenceId) - .nullsNotDistinct(), - }) -) - /** * Workflow MCP Servers - User-created MCP servers that expose workflows as tools. * These servers are accessible by external MCP clients via API key authentication, diff --git a/packages/sim-cli/src/auth/oauth-flow.test.ts b/packages/sim-cli/src/auth/oauth-flow.test.ts index 4beddd8ff62..2fd325a7146 100644 --- a/packages/sim-cli/src/auth/oauth-flow.test.ts +++ b/packages/sim-cli/src/auth/oauth-flow.test.ts @@ -159,7 +159,7 @@ describe('loginWithBrowser', () => { for (const [key, value] of Object.entries(outcome(authorize.searchParams, state))) { redirectUri.searchParams.set(key, value) } - // Node's real HTTP client, not the stubbed fetch, so the listener is exercised. + /** Node's real HTTP client, not the stubbed fetch, exercises the listener. */ void import('node:http').then(({ get }) => { get(redirectUri, (response) => response.resume()) }) diff --git a/packages/sim-cli/src/auth/oauth-flow.ts b/packages/sim-cli/src/auth/oauth-flow.ts index d24a396d82d..ac16f5346ba 100644 --- a/packages/sim-cli/src/auth/oauth-flow.ts +++ b/packages/sim-cli/src/auth/oauth-flow.ts @@ -29,12 +29,8 @@ export const OAUTH_CLIENT_ID = 'sim-cli' * Everything the CLI does, and nothing more: renew itself, and read and change * workspace resources. * - * The identity scopes (`openid`, `profile`, `email`) are deliberately absent. - * Sim issues opaque access tokens, and the provider returns no `id_token` at - * all to a public client with no secret — so `openid` could never be honoured - * for this client, and the CLI reads no profile or email either. Asking for - * them would put three permissions on the consent card that this app does not - * use and, for `openid`, structurally cannot. + * Sim's provider deliberately exposes OAuth API authorization rather than an + * OpenID Connect identity surface, so the CLI requests no identity claims. */ export const OAUTH_SCOPES_FULL = ['offline_access', 'api:read', 'api:write'] as const @@ -242,9 +238,7 @@ async function readTokens( if (!response.ok || typeof body.error === 'string') { throw new OAuthTokenError( typeof body.error === 'string' ? body.error : 'server_error', - // The description is whatever the endpoint sent, so it goes through the - // same redaction every other quoted remote value does: a value carrying - // control characters would otherwise write its own lines to the terminal. + /** Remote descriptions are redacted before they reach the terminal. */ typeof body.error_description === 'string' ? redact(body.error_description) : undefined, response.status ) @@ -324,9 +318,10 @@ export async function exchangeCode( /** * Trades a refresh token for a new pair. The server rotates: the token used - * here is dead afterwards, and presenting it again invalidates every token the - * CLI holds for this account — which is why callers serialize refreshes - * through the credentials lock before reaching this. + * here is dead afterwards, and presenting it again invalidates every access + * and refresh token from this login. Other independently authorized CLI + * logins remain active. Callers serialize local refreshes through the + * credentials lock before reaching this. */ export async function refreshTokens( endpoint: string, @@ -345,9 +340,10 @@ export async function refreshTokens( } /** - * Revokes a refresh token server-side, which also kills the access tokens it - * issued. RFC 7009 answers 200 for an unknown token, so this only fails when - * the server cannot be reached or refuses the client. + * Revokes a refresh token server-side, which also kills every access and + * refresh token in that login family. RFC 7009 answers 200 for an unknown + * token, so this only fails when the server cannot be reached or refuses the + * client. */ export async function revokeToken(endpoint: string, token: string): Promise { const response = await postToken( @@ -381,7 +377,7 @@ interface LoopbackResult { * `127.0.0.1` rather than `localhost`, as RFC 8252 §7.3 recommends: the name * can resolve to a non-loopback interface, and the server registers the IP * literal. Port 0 lets the OS pick, which the server accepts for any loopback - * port; `--callback-port` pins it for a container whose port must be forwarded. + * port; `--callback-port` pins it when an SSH tunnel forwards that same port. */ function listenForCallback( server: Server, @@ -397,10 +393,7 @@ function listenForCallback( clearTimeout(timer) signal?.removeEventListener('abort', onAbort) server.close() - // `close()` only stops accepting. The browser sends `Connection: - // keep-alive`, so without this the socket holds the event loop open for - // Node's 5s `keepAliveTimeout` and `sim login` sits there, already - // finished, after printing its success line. + /** Close keep-alive sockets so a finished login does not wait for Node's timeout. */ server.closeAllConnections() if (outcome.ok) resolve(outcome.value) else reject(outcome.error) @@ -507,8 +500,7 @@ export async function loginWithBrowser( await new Promise((resolve, reject) => { server.once('error', (cause) => { - // The ordinary outcome of `--callback-port` naming a port that is taken - // or privileged, so it is explained rather than thrown as a stack trace. + /** A pinned port may already be occupied or privileged, so report an actionable error. */ reject( new SimApiError( `Could not listen on the sign-in callback port: ${cause.message}. Pick another --callback-port.`, diff --git a/packages/sim-cli/src/auth/refresh.ts b/packages/sim-cli/src/auth/refresh.ts index 8ae4758214b..f0e2d30864b 100644 --- a/packages/sim-cli/src/auth/refresh.ts +++ b/packages/sim-cli/src/auth/refresh.ts @@ -63,7 +63,7 @@ export async function refreshStoredOAuth( } catch (error) { if (error instanceof OAuthTokenError && error.oauthError === 'invalid_grant') { throw new SimApiError( - `Your Sim login has expired or was revoked. Run sim logout --profile ${profile.authProfile}, then sim login --profile ${profile.authProfile}.`, + `Your Sim login expired, was revoked, or detected refresh-token reuse. Run sim logout --profile ${profile.authProfile}, then sim login --profile ${profile.authProfile}.`, 401 ) } diff --git a/packages/sim-cli/src/commands/auth.test.ts b/packages/sim-cli/src/commands/auth.test.ts index 3eb80ea043b..8da68b7054d 100644 --- a/packages/sim-cli/src/commands/auth.test.ts +++ b/packages/sim-cli/src/commands/auth.test.ts @@ -9,6 +9,7 @@ const mocks = vi.hoisted(() => ({ listAuthenticationDependents: vi.fn<() => string[]>(() => []), listProfiles: vi.fn<() => string[]>(() => []), request: vi.fn(), + readConfigProfile: vi.fn<() => Record>(() => ({})), readCredentialsProfile: vi.fn<() => Record>(() => ({})), discoverOAuthProvider: vi.fn( async () => 'unavailable' as 'available' | 'unavailable' | 'unreachable' @@ -24,11 +25,21 @@ const mocks = vi.hoisted(() => ({ revokeToken: vi.fn(async () => undefined), grantsWriteAccess: vi.fn((scope: string) => scope.split(' ').includes('api:write')), resolveAuthenticationProfileName: vi.fn((profile: string) => profile), - pollForKey: vi.fn(async () => ({ + withCredentialsLock: vi.fn((work: () => Promise) => work()), + pollForKey: vi.fn< + () => Promise<{ + id?: string + apiKey: string + scope: 'platform' | 'copilot' + workspaceBound?: boolean + workspaceId?: string + }> + >(async () => ({ + id: 'key-id', apiKey: 'sim-key', - scope: 'platform' as 'platform' | 'copilot', + scope: 'platform', workspaceBound: false, - workspaceId: 'ws_1' as string | undefined, + workspaceId: 'ws_1', })), profileFrom: vi.fn(() => ({ name: 'default', @@ -97,6 +108,7 @@ vi.mock('../config/index', async () => ({ listAuthenticationDependents: mocks.listAuthenticationDependents, listProfiles: mocks.listProfiles, readCredentialsProfile: mocks.readCredentialsProfile, + readConfigProfile: mocks.readConfigProfile, oauthIssuerForEndpoint: (endpoint: string) => `${endpoint}/api/auth`, /** * Derived from the section mock so a test that seeds `{ api_key }` or the @@ -122,9 +134,9 @@ vi.mock('../config/index', async () => ({ resolveAuthenticationProfileName: mocks.resolveAuthenticationProfileName, writeConfigProfile: mocks.writeConfigProfile, writeCredentialsProfile: mocks.writeCredentialsProfile, - // Pass-through: the real lock is exercised in profile.test.ts; here it only - // has to not swallow the writes these tests assert on. - withCredentialsLock: (work: () => Promise) => work(), + /** The real lock is exercised in profile.test.ts; command tests preserve observable writes. */ + withCredentialsLock: mocks.withCredentialsLock, + withProfileLoginLease: (_profile: string, work: () => Promise) => work(), })) vi.mock('../context', () => ({ globalsOf: (command: Command) => command.optsWithGlobals(), @@ -169,10 +181,15 @@ async function logout(...args: string[]): Promise { await root.parseAsync(['node', 'sim', 'logout', ...args]) } +beforeEach(() => { + mocks.withCredentialsLock.mockImplementation((work) => work()) +}) + describe('login command', () => { beforeEach(() => { vi.clearAllMocks() mocks.listProfiles.mockReturnValue([]) + mocks.readConfigProfile.mockReturnValue({}) mocks.readCredentialsProfile.mockReturnValue({}) mocks.resolveAuthenticationProfileName.mockImplementation((profile) => profile) mocks.profileFrom.mockReturnValue({ @@ -189,6 +206,7 @@ describe('login command', () => { }, }) mocks.pollForKey.mockResolvedValue({ + id: 'key-id', apiKey: 'sim-key', scope: 'platform', workspaceBound: false, @@ -305,9 +323,7 @@ describe('login command', () => { expect(mocks.createAuthRequest).toHaveBeenCalledOnce() }) - it('writes the endpoint before the key, so a failed write cannot strand one', async () => { - // A key on disk with no endpoint beside it falls back to the default host - // on the next command, which would send a self-hosted key elsewhere. + it('clears the previous key before changing its endpoint', async () => { setInteractive(false) const order: string[] = [] mocks.writeConfigProfile.mockImplementation(() => { @@ -319,7 +335,31 @@ describe('login command', () => { await login() - expect(order).toEqual(['config', 'credentials']) + expect(order).toEqual(['credentials', 'config', 'credentials']) + }) + + it('restores settings and reports a minted handoff key when credential storage fails', async () => { + setInteractive(false) + mocks.writeCredentialsProfile + .mockImplementationOnce(() => undefined) + .mockImplementationOnce(() => { + throw new Error('credentials disk full') + }) + + await expect(login()).rejects.toThrow('credentials disk full') + + expect(mocks.writeConfigProfile).toHaveBeenNthCalledWith(1, 'default', { + endpoint: 'https://sim.ai', + workspace: 'ws_1', + }) + expect(mocks.writeConfigProfile).toHaveBeenNthCalledWith(2, 'default', { + endpoint: null, + workspace: null, + }) + expect(mocks.writeCredentialsProfile).toHaveBeenLastCalledWith('default', null) + expect(vi.mocked(console.log).mock.calls.flat().join('\n')).toContain( + 'API key key-id was created but could not be stored safely' + ) }) it('stores nothing when the server answers with an unstorable workspace id', async () => { @@ -492,6 +532,61 @@ describe('profiles command', () => { expect(mocks.writeCredentialsProfile).not.toHaveBeenCalled() }) + it('refuses to create a dangling alias when logout wins the credential lock', async () => { + mocks.withCredentialsLock.mockImplementationOnce(async (work) => { + mocks.readCredentialsProfile.mockReturnValue({}) + return work() + }) + + await expect(profiles('add', 'acme', '--workspace', 'ws_acme')).rejects.toThrow( + 'the active login is not stored' + ) + + expect(mocks.writeConfigProfile).not.toHaveBeenCalled() + }) + + it('refuses to bind a workspace selected with a credential replaced before commit', async () => { + mocks.withCredentialsLock.mockImplementationOnce(async (work) => { + mocks.readCredentialsProfile.mockReturnValue({ api_key: 'replacement-key' }) + return work() + }) + + await expect(profiles('add', 'acme', '--workspace', 'ws_acme')).rejects.toThrow( + 'changed while the workspace was being selected' + ) + + expect(mocks.writeConfigProfile).not.toHaveBeenCalled() + }) + + it('accepts a normal OAuth refresh while selecting the workspace', async () => { + const initial = { + access_token: 'sim_oat_initial', + refresh_token: 'sim_ort_initial', + token_expires_at: '1800000000000', + oauth_issuer: 'https://sim.ai/api/auth', + oauth_login_id: 'stable-login', + oauth_scope: 'offline_access api:read api:write', + } + const refreshed = { + ...initial, + access_token: 'sim_oat_refreshed', + refresh_token: 'sim_ort_refreshed', + token_expires_at: '1800003600000', + } + mocks.readCredentialsProfile.mockReturnValue(initial) + mocks.request.mockImplementationOnce(async () => { + mocks.readCredentialsProfile.mockReturnValue(refreshed) + return { data: { id: 'ws_acme', name: 'Acme', memberCount: 3 } } + }) + + await profiles('add', 'acme', '--workspace', 'ws_acme') + + expect(mocks.writeConfigProfile).toHaveBeenCalledWith('acme', { + auth_profile: 'default', + workspace: 'ws_acme', + }) + }) + it('does not write a profile when the active key cannot reach the workspace', async () => { mocks.request.mockRejectedValue(new SimApiError('Workspace not found', 404)) @@ -835,7 +930,7 @@ describe('logout command', () => { it('does not remove a key through a shared workspace profile', async () => { mocks.resolveAuthenticationProfileName.mockReturnValue('default') - await expect(logout()).rejects.toThrow( + await expect(logout('--profile', 'acme')).rejects.toThrow( 'Log out of the authentication profile instead: sim logout --profile default' ) expect(mocks.writeCredentialsProfile).not.toHaveBeenCalled() @@ -859,6 +954,19 @@ describe('logout command', () => { ) expect(mocks.deleteProfile).not.toHaveBeenCalled() }) + + it('rechecks dependents after taking the lock before removing an authentication profile', async () => { + mocks.withCredentialsLock.mockImplementationOnce(async (work) => { + mocks.listAuthenticationDependents.mockReturnValue(['acme']) + return work() + }) + + await expect(logout('--all', '--profile', 'default')).rejects.toThrow( + 'Cannot remove authentication profile "default" because it is used by: acme.' + ) + + expect(mocks.deleteProfile).not.toHaveBeenCalled() + }) }) describe('whoami command', () => { @@ -1081,11 +1189,13 @@ describe('login command — OAuth', () => { beforeEach(() => { vi.clearAllMocks() mocks.listProfiles.mockReturnValue([]) + mocks.readConfigProfile.mockReturnValue({}) mocks.readCredentialsProfile.mockReturnValue({}) mocks.resolveAuthenticationProfileName.mockImplementation((profile) => profile) mocks.discoverOAuthProvider.mockResolvedValue('available') mocks.isLikelyRemoteSession.mockReturnValue(false) mocks.pollForKey.mockResolvedValue({ + id: 'key-id', apiKey: 'sim-key', scope: 'platform', workspaceBound: false, @@ -1139,6 +1249,109 @@ describe('login command — OAuth', () => { }) }) + it('keeps a concurrently stored login and revokes the family it could not commit', async () => { + setInteractive(false) + mocks.readCredentialsProfile + .mockReturnValueOnce({}) + .mockReturnValueOnce({}) + .mockReturnValueOnce({ + access_token: 'sim_oat_newer', + refresh_token: 'sim_ort_newer', + token_expires_at: '1800000000001', + oauth_issuer: 'https://sim.ai/api/auth', + oauth_login_id: 'newer-login', + oauth_scope: 'offline_access api:read', + }) + + await expect(login()).rejects.toThrow('changed while sign-in was open') + expect(mocks.writeCredentialsProfile).not.toHaveBeenCalled() + expect(mocks.revokeToken).toHaveBeenCalledWith('https://sim.ai', 'sim_ort_refresh') + }) + + it('keeps a concurrently added authentication-profile link', async () => { + setInteractive(false) + mocks.readConfigProfile + .mockReturnValueOnce({}) + .mockReturnValueOnce({}) + .mockReturnValueOnce({ auth_profile: 'default' }) + + await expect(login()).rejects.toThrow('changed while sign-in was open') + + expect(mocks.writeCredentialsProfile).not.toHaveBeenCalled() + expect(mocks.writeConfigProfile).not.toHaveBeenCalled() + expect(mocks.revokeToken).toHaveBeenCalledWith('https://sim.ai', 'sim_ort_refresh') + }) + + it('best-effort revokes a newly issued family when local persistence fails', async () => { + setInteractive(false) + mocks.writeCredentialsProfile.mockImplementationOnce(() => { + throw new Error('disk full') + }) + + await expect(login()).rejects.toThrow('disk full') + expect(mocks.revokeToken).toHaveBeenCalledWith('https://sim.ai', 'sim_ort_refresh') + expect(mocks.writeConfigProfile).not.toHaveBeenCalled() + }) + + it('clears the previous credential before changing its endpoint', async () => { + setInteractive(false) + mocks.readCredentialsProfile.mockReturnValue({ api_key: 'previous-key' }) + const order: string[] = [] + mocks.writeConfigProfile.mockImplementation(() => { + order.push('config') + }) + mocks.writeCredentialsProfile.mockImplementation((_profile, credential) => { + order.push(credential ? 'credential' : 'clear') + }) + + await login('--yes') + + expect(order).toEqual(['clear', 'config', 'credential']) + }) + + it('restores the previous credential when endpoint persistence fails', async () => { + setInteractive(false) + mocks.readCredentialsProfile.mockReturnValue({ api_key: 'previous-key' }) + mocks.writeConfigProfile.mockImplementationOnce(() => { + throw new Error('config disk full') + }) + + await expect(login('--yes')).rejects.toThrow('config disk full') + + expect(mocks.writeCredentialsProfile).toHaveBeenNthCalledWith(1, 'default', null) + expect(mocks.writeCredentialsProfile).toHaveBeenNthCalledWith(2, 'default', { + kind: 'api_key', + apiKey: 'previous-key', + }) + expect(mocks.writeConfigProfile).toHaveBeenNthCalledWith(2, 'default', { endpoint: null }) + expect(mocks.revokeToken).toHaveBeenCalledWith('https://sim.ai', 'sim_ort_refresh') + }) + + it('restores the previous endpoint and credential when OAuth storage fails', async () => { + setInteractive(false) + mocks.readConfigProfile.mockReturnValue({ endpoint: 'https://old.example' }) + mocks.readCredentialsProfile.mockReturnValue({ api_key: 'previous-key' }) + mocks.writeCredentialsProfile + .mockImplementationOnce(() => undefined) + .mockImplementationOnce(() => { + throw new Error('credentials disk full') + }) + + await expect(login('--yes')).rejects.toThrow('credentials disk full') + + expect(mocks.writeConfigProfile).toHaveBeenNthCalledWith(1, 'default', { + endpoint: 'https://sim.ai', + }) + expect(mocks.writeConfigProfile).toHaveBeenNthCalledWith(2, 'default', { + endpoint: 'https://old.example', + }) + expect(mocks.writeCredentialsProfile).toHaveBeenLastCalledWith('default', { + kind: 'api_key', + apiKey: 'previous-key', + }) + expect(mocks.revokeToken).toHaveBeenCalledWith('https://sim.ai', 'sim_ort_refresh') + }) + it('asks only for the read scope under --read-only', async () => { setInteractive(false) await login('--read-only') @@ -1267,4 +1480,58 @@ describe('logout command — OAuth', () => { const output = vi.mocked(console.log).mock.calls.flat().join('\n') expect(output).toContain('Could not revoke the login') }) + + it('revokes against the stored issuer even when the configured endpoint changed', async () => { + mocks.readCredentialsProfile.mockReturnValue({ + access_token: 'sim_oat_a', + refresh_token: 'sim_ort_r', + token_expires_at: '1', + oauth_issuer: 'https://original.example/api/auth', + oauth_login_id: 'login-1', + oauth_scope: 'offline_access api:read', + }) + mocks.profileFrom.mockImplementation(() => { + throw new ProfileConfigError('issuer mismatch') + }) + + await logout('--profile', 'acme') + + expect(mocks.profileFrom).not.toHaveBeenCalled() + expect(mocks.revokeToken).toHaveBeenCalledWith('https://original.example', 'sim_ort_r') + expect(mocks.writeCredentialsProfile).toHaveBeenCalledWith('acme', null) + }) + + it('does not contact or print credentials embedded in a hand-edited issuer', async () => { + mocks.readCredentialsProfile.mockReturnValue({ + access_token: 'sim_oat_a', + refresh_token: 'sim_ort_r', + token_expires_at: '1', + oauth_issuer: 'https://user:password@example.com/api/auth', + oauth_login_id: 'login-1', + oauth_scope: 'offline_access api:read', + }) + + await logout('--profile', 'acme') + + expect(mocks.revokeToken).not.toHaveBeenCalled() + const output = vi.mocked(console.log).mock.calls.flat().join('\n') + expect(output).not.toContain('user') + expect(output).not.toContain('password') + expect(output).toContain('https://example.com/api/auth') + }) + + it('removes terminal controls from an invalid stored issuer error', async () => { + mocks.readCredentialsProfile.mockReturnValue({ + access_token: 'sim_oat_a', + refresh_token: 'sim_ort_r', + token_expires_at: '1', + oauth_issuer: 'bad\u001b[31m-issuer', + oauth_login_id: 'login-1', + oauth_scope: 'offline_access api:read', + }) + + await logout('--profile', 'acme') + + expect(vi.mocked(console.log).mock.calls.flat().join('\n')).not.toContain('\u001b') + }) }) diff --git a/packages/sim-cli/src/commands/auth.ts b/packages/sim-cli/src/commands/auth.ts index 3b0fcd9455a..103dd7c0fc8 100644 --- a/packages/sim-cli/src/commands/auth.ts +++ b/packages/sim-cli/src/commands/auth.ts @@ -34,12 +34,15 @@ import { oauthIssuerForEndpoint, ProfileConfigError, type ResolvedProfile, + readConfigProfile, readStoredCredential, resolveAuthenticationProfileName, type SettingSource, + type StoredCredential, type StoredOAuthCredential, validateProfileName, withCredentialsLock, + withProfileLoginLease, writeConfigProfile, writeCredentialsProfile, } from '../config/index' @@ -171,6 +174,79 @@ function requireStorableCredential(value: unknown): void { } } +/** Compares the credential snapshot taken before an interactive login began. */ +function sameStoredCredential( + current: StoredCredential | null, + expected: StoredCredential | null +): boolean { + if (!current || !expected) return current === expected + if (current.kind !== expected.kind) return false + if (current.kind === 'api_key' && expected.kind === 'api_key') { + return current.apiKey === expected.apiKey + } + if (current.kind !== 'oauth' || expected.kind !== 'oauth') return false + return ( + current.oauth.accessToken === expected.oauth.accessToken && + current.oauth.refreshToken === expected.oauth.refreshToken && + current.oauth.expiresAt === expected.oauth.expiresAt && + current.oauth.issuer === expected.oauth.issuer && + current.oauth.loginId === expected.oauth.loginId && + current.oauth.scope === expected.oauth.scope + ) +} + +/** Whether two snapshots identify the same stored login across a normal OAuth refresh. */ +function sameStoredAuthentication( + current: StoredCredential | null, + expected: StoredCredential | null +): boolean { + if (current?.kind === 'oauth' && expected?.kind === 'oauth') { + return ( + current.oauth.loginId === expected.oauth.loginId && + current.oauth.issuer === expected.oauth.issuer + ) + } + return sameStoredCredential(current, expected) +} + +interface LoginProfileSnapshot { + credential: StoredCredential | null + authProfile: string | null + endpoint: string | null + workspace: string | null +} + +function readLoginProfileSnapshot(profileName: string): LoginProfileSnapshot { + const config = readConfigProfile(profileName) + return { + credential: readStoredCredential(profileName), + authProfile: config.auth_profile ?? null, + endpoint: config.endpoint ?? null, + workspace: config.workspace ?? null, + } +} + +function sameLoginProfileSnapshot( + current: LoginProfileSnapshot, + expected: LoginProfileSnapshot +): boolean { + return ( + sameStoredCredential(current.credential, expected.credential) && + current.authProfile === expected.authProfile && + current.endpoint === expected.endpoint && + current.workspace === expected.workspace + ) +} + +function assertLoginProfileUnchanged(profileName: string, expected: LoginProfileSnapshot): void { + if (!sameLoginProfileSnapshot(readLoginProfileSnapshot(profileName), expected)) { + throw new SimApiError( + `Profile "${redact(profileName)}" changed while sign-in was open. Its newer settings and login were kept.`, + 0 + ) + } +} + function requireStoredAuthentication(profile: ResolvedProfile): string { const authProfile = resolveAuthenticationProfileName(profile.name) if (profile.sources.credential !== 'credentials' || !readStoredCredential(authProfile)) { @@ -256,18 +332,31 @@ function addProfileCommand(): Command { const { client, profile } = clientFrom(command) const authProfile = requireStoredAuthentication(profile) + const credential = readStoredCredential(authProfile) const workspaceId = globalsOf(command).workspace const workspace = workspaceId ? await getWorkspaceById(client, workspaceId) : await chooseWorkspace(client) - - writeConfigProfile(profileName, { - auth_profile: authProfile, - // Server-supplied, exactly like the login response's workspace id, so it - // is checked the same way: the writer would refuse an unstorable one - // anyway, but with a message about the file format rather than the - // response that produced it. - workspace: normalizeWorkspaceId(workspace.id, 'the workspace response'), + const normalizedWorkspaceId = normalizeWorkspaceId(workspace.id, 'the workspace response') + + await withCredentialsLock(async () => { + validateNewProfileName(profileName) + const currentProfile = profileFrom(command) + const currentAuthProfile = requireStoredAuthentication(currentProfile) + if ( + currentAuthProfile !== authProfile || + currentProfile.endpoint !== profile.endpoint || + !sameStoredAuthentication(readStoredCredential(currentAuthProfile), credential) + ) { + throw new SimApiError( + `Profile "${redact(profile.name)}" changed while the workspace was being selected. Its newer settings and login were kept.`, + 0 + ) + } + writeConfigProfile(profileName, { + auth_profile: authProfile, + workspace: normalizedWorkspaceId, + }) }) console.log(chalk.green(`✓ Added profile "${safeOneLine(profileName)}" in ${configPath()}`)) @@ -351,7 +440,8 @@ function parseCallbackPort(value: string | undefined): number | undefined { async function loginWithOAuth( profile: ResolvedProfile, options: LoginOptions, - callbackPort: number | undefined + callbackPort: number | undefined, + expected: LoginProfileSnapshot ): Promise { console.log( `Signing in to ${chalk.bold(profile.endpoint)} as profile ${chalk.bold(safeOneLine(profile.name))}` @@ -367,23 +457,56 @@ async function loginWithOAuth( }, }) - requireStorableCredential(tokens.accessToken) - requireStorableCredential(tokens.refreshToken) - - await withCredentialsLock(async () => { - writeConfigProfile(profile.name, { endpoint: profile.endpoint }) - writeCredentialsProfile(profile.name, { - kind: 'oauth', - oauth: { - accessToken: tokens.accessToken, - refreshToken: tokens.refreshToken, - expiresAt: tokens.expiresAt, - issuer: oauthIssuerForEndpoint(profile.endpoint), - loginId: randomBytes(16).toString('base64url'), - scope: tokens.scope, - }, + try { + requireStorableCredential(tokens.accessToken) + requireStorableCredential(tokens.refreshToken) + + await withCredentialsLock(async () => { + assertLoginProfileUnchanged(profile.name, expected) + const credential: StoredCredential = { + kind: 'oauth', + oauth: { + accessToken: tokens.accessToken, + refreshToken: tokens.refreshToken, + expiresAt: tokens.expiresAt, + issuer: oauthIssuerForEndpoint(profile.endpoint), + loginId: randomBytes(16).toString('base64url'), + scope: tokens.scope, + }, + } + writeCredentialsProfile(profile.name, null) + try { + writeConfigProfile(profile.name, { endpoint: profile.endpoint }) + writeCredentialsProfile(profile.name, credential) + } catch (error) { + try { + writeConfigProfile(profile.name, { endpoint: expected.endpoint }) + writeCredentialsProfile(profile.name, expected.credential) + } catch (rollbackError) { + try { + writeCredentialsProfile(profile.name, null) + } catch {} + console.log( + chalk.yellow( + `Could not restore the previous profile safely (${safeOneLine(getErrorMessage(rollbackError))}). Its local login was cleared to avoid using it against the wrong endpoint. The new server login will still be revoked.` + ) + ) + } + throw error + } }) - }) + } catch (error) { + try { + await revokeToken(profile.endpoint, tokens.refreshToken) + } catch (revocationError) { + console.log( + chalk.yellow( + `Could not revoke the uncommitted login (${safeOneLine(getErrorMessage(revocationError))}). Revoke Sim CLI in Settings → Authorized apps.` + ) + ) + } + throw error + } console.log(chalk.green(`\n✓ Logged in. Login stored in ${credentialsPath()}`)) /** @@ -423,8 +546,7 @@ export function loginCommand(): Command { .option('--callback-port ', 'Pin the local port the browser returns to') .option('-y, --yes', 'Overwrite an existing API-key profile without prompting') .action(async (options: LoginOptions, command: Command) => { - // `login --profile x` is how a profile comes into existence, so the name - // is allowed to be one resolution would otherwise reject as unknown. + /** Login may name the profile it is about to create. */ const profile = profileFrom(command, { allowUnknownProfile: true }) const authProfile = resolveAuthenticationProfileName(profile.name) @@ -440,7 +562,8 @@ export function loginCommand(): Command { } const scope = options.scope as CliAuthScope - const storedCredential = readStoredCredential(profile.name) + const snapshot = readLoginProfileSnapshot(profile.name) + const storedCredential = snapshot.credential if (storedCredential?.kind === 'oauth') { throw new SimApiError( `Profile "${redact(profile.name)}" already has an OAuth login. Run sim logout --profile ${redact(profile.name)} before signing in again.`, @@ -455,14 +578,10 @@ export function loginCommand(): Command { } } - // Parsed before either flow runs, so a malformed port is reported as - // itself rather than after a browser has already opened. + /** Validate a pinned port before opening a browser or starting either flow. */ const callbackPort = parseCallbackPort(options.callbackPort) - if ((await chooseLoginFlow(profile, options, scope)) === 'oauth') { - await loginWithOAuth(profile, options, callbackPort) - return - } + const loginFlow = await chooseLoginFlow(profile, options, scope) /** * Neither flag has a meaning in the handoff: it mints a permanent, * full-power API key on the server and never opens a local listener. @@ -470,19 +589,28 @@ export function loginCommand(): Command { * what was asked for, so the whole login stops here rather than storing a * credential the person did not agree to. */ - if (options.readOnly) { - throw new SimApiError( - 'The pairing-code handoff cannot issue a read-only login; it mints a full API key. Drop --read-only, or sign in through the browser.', - 0 - ) - } - if (callbackPort !== undefined) { - throw new SimApiError( - 'The pairing-code handoff has no local callback, so --callback-port does not apply. Drop it, or sign in through the browser.', - 0 - ) + if (loginFlow === 'handoff') { + if (options.readOnly) { + throw new SimApiError( + 'The pairing-code handoff cannot issue a read-only login; it mints a full API key. Drop --read-only, or sign in through the browser.', + 0 + ) + } + if (callbackPort !== undefined) { + throw new SimApiError( + 'The pairing-code handoff has no local callback, so --callback-port does not apply. Drop it, or sign in through the browser.', + 0 + ) + } } - await loginWithHandoff(profile, options, scope) + await withProfileLoginLease(profile.name, async () => { + assertLoginProfileUnchanged(profile.name, snapshot) + if (loginFlow === 'oauth') { + await loginWithOAuth(profile, options, callbackPort, snapshot) + return + } + await loginWithHandoff(profile, options, scope, snapshot) + }) }) } @@ -490,7 +618,8 @@ export function loginCommand(): Command { async function loginWithHandoff( profile: ResolvedProfile, options: LoginOptions, - scope: CliAuthScope + scope: CliAuthScope, + expected: LoginProfileSnapshot ): Promise { const auth = createAuthRequest() const url = buildApprovalUrl(profile.endpoint, auth, scope, profile.workspaceId ?? undefined) @@ -506,46 +635,59 @@ async function loginWithHandoff( console.log(chalk.dim('\nWaiting for approval…')) const key = await pollForKey(profile.endpoint, auth) + try { + if (key.scope !== scope) { + throw new SimApiError( + `Server issued a ${key.scope} key but this profile needs a ${scope} key. Update the Sim deployment, or run: sim login --scope ${key.scope}`, + 0 + ) + } - if (key.scope !== scope) { - // The approval, not the request, decides the scope. Storing a copilot - // key where a platform key belongs would fail every later call with an - // unexplained 401, so refuse now with the reason. - throw new SimApiError( - `Server issued a ${key.scope} key but this profile needs a ${scope} key. Update the Sim deployment, or run: sim login --scope ${key.scope}`, - 0 + const settings: Record = { + endpoint: profile.endpoint, + workspace: + key.workspaceId == null + ? null + : normalizeWorkspaceId(key.workspaceId, 'the login response'), + } + requireStorableCredential(key.apiKey) + + await withCredentialsLock(async () => { + assertLoginProfileUnchanged(profile.name, expected) + writeCredentialsProfile(profile.name, null) + try { + writeConfigProfile(profile.name, settings) + writeCredentialsProfile(profile.name, { kind: 'api_key', apiKey: key.apiKey }) + } catch (error) { + try { + writeConfigProfile(profile.name, { + endpoint: expected.endpoint, + workspace: expected.workspace, + }) + writeCredentialsProfile(profile.name, expected.credential) + } catch (rollbackError) { + try { + writeCredentialsProfile(profile.name, null) + } catch {} + console.log( + chalk.yellow( + `Could not restore the previous profile safely (${safeOneLine(getErrorMessage(rollbackError))}). Its local login was cleared to avoid using it against the wrong endpoint.` + ) + ) + } + throw error + } + }) + } catch (error) { + const keyId = typeof key.id === 'string' && key.id ? safeOneLine(key.id) : 'unknown' + console.log( + chalk.yellow( + `API key ${keyId} was created but could not be stored safely. Revoke it in Settings → API keys.` + ) ) + throw error } - // The workspace picked in the browser becomes the profile's default, - // whether or not the key is scoped to it. The user chose it by name — - // making them look up its id afterwards would waste the one moment the - // answer was already on screen. It arrives off the wire, so it is - // checked before either file is touched. - // - // Absence is the whole of "no workspace" here, and it is a legitimate - // outcome — a personal key with nothing selected in the browser. A - // *present* value is a workspace id, so every one of them goes to - // `normalizeWorkspaceId` to be accepted or refused by name. Testing - // truthiness instead let an empty string through the absent branch, so - // a malformed response was quietly stored as "no workspace" rather than - // reported. - const settings: Record = { - endpoint: profile.endpoint, - workspace: - key.workspaceId == null ? null : normalizeWorkspaceId(key.workspaceId, 'the login response'), - } - requireStorableCredential(key.apiKey) - - // Config before credentials: the endpoint decides where the key is sent - // later. Storing the key first and then failing on the settings left a - // key on disk with no endpoint beside it, so the next command fell back - // to the default host — sending a self-hosted key somewhere else. - await withCredentialsLock(async () => { - writeConfigProfile(profile.name, settings) - writeCredentialsProfile(profile.name, { kind: 'api_key', apiKey: key.apiKey }) - }) - console.log(chalk.green(`\n✓ Logged in. Key stored in ${credentialsPath()}`)) if (key.workspaceBound && key.workspaceId) { console.log(chalk.dim(` Workspace-scoped key — it can only reach ${key.workspaceId}.`)) @@ -565,24 +707,39 @@ async function loginWithHandoff( } /** - * Ends an OAuth login's ability to renew before forgetting it locally. Better - * Auth also removes the access token paired with this refresh token; an access - * token copied before an earlier rotation can remain valid until its one-hour - * expiry, so Settings → Authorized apps remains the immediate whole-app kill - * switch. An unreachable server must not stop someone clearing their machine, - * but it is said out loud so nobody assumes revocation succeeded. + * Revokes the complete server-side token family before forgetting it locally. + * Settings → Authorized apps is broader: it revokes every independent login + * for the client. An unreachable server must not stop someone clearing their + * machine, but it is said out loud so nobody assumes revocation succeeded. */ -async function revokeStoredOAuth( - endpoint: string, - credential: StoredOAuthCredential -): Promise { +async function revokeStoredOAuth(credential: StoredOAuthCredential): Promise { + let displayEndpoint = safeOneLine(redact(credential.issuer)) try { + const issuer = new URL(credential.issuer) + const displayIssuer = new URL(issuer) + displayIssuer.username = '' + displayIssuer.password = '' + displayEndpoint = safeOneLine(displayIssuer.toString()) + if ( + FORBIDDEN_IN_VALUE.test(credential.issuer) || + (issuer.protocol !== 'http:' && issuer.protocol !== 'https:') || + issuer.username || + issuer.password || + issuer.search || + issuer.hash || + !issuer.pathname.endsWith('/api/auth') + ) { + throw new Error('stored issuer is invalid') + } + issuer.pathname = issuer.pathname.slice(0, -'/api/auth'.length) || '/' + const endpoint = issuer.toString().replace(/\/$/, '') + displayEndpoint = safeOneLine(endpoint) await revokeToken(endpoint, credential.refreshToken) - console.log(chalk.dim(' Signed out of Sim; the login can no longer be renewed.')) + console.log(chalk.dim(' Signed out of Sim; every token from this login was revoked.')) } catch (error) { console.log( chalk.yellow( - ` Could not revoke the login on ${endpoint} (${safeOneLine(getErrorMessage(error))}). Revoke it in Settings → Authorized apps.` + ` Could not revoke the login on ${displayEndpoint} (${safeOneLine(getErrorMessage(error))}). Revoke it in Settings → Authorized apps.` ) ) } @@ -595,18 +752,17 @@ export function logoutCommand(): Command { .action(async (options: { all?: boolean }, command: Command) => { if (options.all) { const profileName = selectedProfileName(command) - const dependents = listAuthenticationDependents(profileName) - if (dependents.length > 0) { - throw new SimApiError( - `Cannot remove authentication profile "${redact(profileName)}" because it is used by: ${dependents.map(redact).join(', ')}. Remove those profiles first.`, - 0 - ) - } - const endpoint = profileFrom(command).endpoint const { removed, credential } = await withCredentialsLock(async () => { + const dependents = listAuthenticationDependents(profileName) + if (dependents.length > 0) { + throw new SimApiError( + `Cannot remove authentication profile "${redact(profileName)}" because it is used by: ${dependents.map(redact).join(', ')}. Remove those profiles first.`, + 0 + ) + } const credential = readStoredCredential(profileName) if (credential?.kind === 'oauth') { - await revokeStoredOAuth(endpoint, credential.oauth) + await revokeStoredOAuth(credential.oauth) } return { removed: deleteProfile(profileName), credential } }) @@ -623,35 +779,34 @@ export function logoutCommand(): Command { return } - const profile = profileFrom(command) - const authProfile = resolveAuthenticationProfileName(profile.name) - if (authProfile !== profile.name) { + const profileName = selectedProfileName(command) + const authProfile = resolveAuthenticationProfileName(profileName) + if (authProfile !== profileName) { throw new SimApiError( - `Profile "${redact(profile.name)}" shares authentication with "${redact(authProfile)}". Log out of the authentication profile instead: sim logout --profile ${redact(authProfile)}`, + `Profile "${redact(profileName)}" shares authentication with "${redact(authProfile)}". Log out of the authentication profile instead: sim logout --profile ${redact(authProfile)}`, 0 ) } const credential = await withCredentialsLock(async () => { - const credential = readStoredCredential(profile.name) + const credential = readStoredCredential(profileName) if (!credential) return null if (credential.kind === 'oauth') { - await revokeStoredOAuth(profile.endpoint, credential.oauth) + await revokeStoredOAuth(credential.oauth) } - writeCredentialsProfile(profile.name, null) + writeCredentialsProfile(profileName, null) return credential }) if (!credential) { - console.log(chalk.dim(`No stored login for profile "${safeOneLine(profile.name)}".`)) + console.log(chalk.dim(`No stored login for profile "${safeOneLine(profileName)}".`)) return } console.log( - chalk.green(`✓ Removed the stored login for profile "${safeOneLine(profile.name)}".`) + chalk.green(`✓ Removed the stored login for profile "${safeOneLine(profileName)}".`) ) if (credential.kind === 'api_key') { - // The key still exists server-side; leaving that unsaid invites the - // assumption that logging out revoked it. + /** Local API-key removal cannot revoke the server-side key. */ console.log( chalk.dim(' The key itself is still active — revoke it in Settings → API keys.') ) diff --git a/packages/sim-cli/src/commands/configure.test.ts b/packages/sim-cli/src/commands/configure.test.ts index 7daf87ff842..629c74cd554 100644 --- a/packages/sim-cli/src/commands/configure.test.ts +++ b/packages/sim-cli/src/commands/configure.test.ts @@ -6,6 +6,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { listProfiles, readConfigProfile, + withCredentialsLock, writeConfigProfile, writeCredentialsProfile, } from '../config/index' @@ -79,6 +80,47 @@ describe('configure --set-endpoint', () => { expect(readConfigProfile('default')).toMatchObject({ endpoint: 'http://localhost:3000' }) }) + it('rechecks an OAuth binding after taking the credential lock', async () => { + mocks.profileFrom.mockReturnValue({ + name: 'default', + endpoint: 'https://sim.example', + }) + writeConfigProfile('default', { endpoint: 'https://sim.example' }) + + let releaseHolder: (() => void) | undefined + let holderAcquired: (() => void) | undefined + const acquired = new Promise((resolve) => { + holderAcquired = resolve + }) + const release = new Promise((resolve) => { + releaseHolder = resolve + }) + const holder = withCredentialsLock(async () => { + holderAcquired?.() + await release + }) + await acquired + + const configure = run('--set-endpoint', 'https://other.example') + await new Promise((resolve) => setImmediate(resolve)) + writeCredentialsProfile('default', { + kind: 'oauth', + oauth: { + accessToken: 'sim_oat_access', + refreshToken: 'sim_ort_refresh', + expiresAt: Date.now() + 3_600_000, + issuer: 'https://sim.example/api/auth', + loginId: 'login-1', + scope: 'offline_access api:read api:write', + }, + }) + releaseHolder?.() + await holder + + await expect(configure).rejects.toThrow('has an OAuth login bound to') + expect(readConfigProfile('default')).toEqual({ endpoint: 'https://sim.example' }) + }) + it('refuses to set an endpoint locally on a shared workspace profile', async () => { writeConfigProfile('default', { endpoint: 'https://sim.example' }) writeCredentialsProfile('default', { kind: 'api_key', apiKey: 'stored-key' }) diff --git a/packages/sim-cli/src/commands/configure.ts b/packages/sim-cli/src/commands/configure.ts index 7362523913d..45b6c85c7b0 100644 --- a/packages/sim-cli/src/commands/configure.ts +++ b/packages/sim-cli/src/commands/configure.ts @@ -3,9 +3,11 @@ import { Command } from 'commander' import { configPath, OUTPUT_FORMATS, + oauthIssuerForEndpoint, readConfigProfile, readStoredCredential, resolveAuthenticationProfileName, + withCredentialsLock, writeConfigProfile, } from '../config/index' import { @@ -81,7 +83,7 @@ export function configureCommand(): Command { .option('--set-output ', `Default output format (${OUTPUT_FORMATS.join(' | ')})`) .option('--unset ', 'Remove settings (endpoint, workspace, output)') .action( - ( + async ( options: { setEndpoint?: string setWorkspace?: string @@ -107,7 +109,6 @@ export function configureCommand(): Command { // `configure --profile x --set-…` is a documented way to create a // profile, so the name is allowed to be one that does not exist yet. const profile = profileFrom(command, { allowUnknownProfile: true }) - const authProfile = resolveAuthenticationProfileName(profile.name) const updates: Record = {} requireValue(options.setEndpoint, '--set-endpoint', 'endpoint') @@ -115,23 +116,7 @@ export function configureCommand(): Command { requireValue(options.setOutput, '--set-output', 'output') if (options.setEndpoint) { - if (authProfile !== profile.name) { - throw new SimApiError( - `Profile "${redact(profile.name)}" shares its endpoint with authentication profile "${redact(authProfile)}". Run: sim configure --profile ${quoteProfileArgument(authProfile)} --set-endpoint ${redact(options.setEndpoint)}`, - 0 - ) - } - const nextEndpoint = normalizeEndpoint(options.setEndpoint, '--set-endpoint') - if ( - readStoredCredential(authProfile)?.kind === 'oauth' && - nextEndpoint !== profile.endpoint - ) { - throw new SimApiError( - `Profile "${redact(profile.name)}" has an OAuth login bound to ${redact(profile.endpoint)}. Run sim logout before changing its endpoint.`, - 0 - ) - } - updates.endpoint = nextEndpoint + updates.endpoint = normalizeEndpoint(options.setEndpoint, '--set-endpoint') } if (options.setWorkspace) { updates.workspace = normalizeWorkspaceId(options.setWorkspace, '--set-workspace') @@ -153,22 +138,6 @@ export function configureCommand(): Command { 0 ) } - if (key === 'endpoint' && authProfile !== profile.name) { - throw new SimApiError( - `Profile "${redact(profile.name)}" shares its endpoint with authentication profile "${redact(authProfile)}". Run: sim configure --profile ${quoteProfileArgument(authProfile)} --unset endpoint`, - 0 - ) - } - if ( - key === 'endpoint' && - readStoredCredential(authProfile)?.kind === 'oauth' && - Object.hasOwn(readConfigProfile(authProfile), 'endpoint') - ) { - throw new SimApiError( - `Profile "${redact(profile.name)}" has an OAuth login bound to ${redact(profile.endpoint)}. Run sim logout before removing its endpoint.`, - 0 - ) - } updates[key] = null } @@ -184,16 +153,43 @@ export function configureCommand(): Command { return } - // An unset against a profile with nothing stored writes nothing — the - // file layer refuses to conjure a section for a removal — so reporting - // an update would claim a change that did not happen. const removalOnly = Object.values(updates).every((value) => value === null) - if (removalOnly && Object.keys(readConfigProfile(profile.name)).length === 0) { + const changed = await withCredentialsLock(async () => { + const authProfile = resolveAuthenticationProfileName(profile.name) + const credential = readStoredCredential(authProfile) + + if (Object.hasOwn(updates, 'endpoint')) { + const endpoint = updates.endpoint + if (authProfile !== profile.name) { + const action = endpoint ? `--set-endpoint ${redact(endpoint)}` : '--unset endpoint' + throw new SimApiError( + `Profile "${redact(profile.name)}" shares its endpoint with authentication profile "${redact(authProfile)}". Run: sim configure --profile ${quoteProfileArgument(authProfile)} ${action}`, + 0 + ) + } + if ( + credential?.kind === 'oauth' && + ((endpoint && oauthIssuerForEndpoint(endpoint) !== credential.oauth.issuer) || + (!endpoint && Object.hasOwn(readConfigProfile(authProfile), 'endpoint'))) + ) { + throw new SimApiError( + `Profile "${redact(profile.name)}" has an OAuth login bound to ${redact(credential.oauth.issuer)}. Run sim logout before ${endpoint ? 'changing' : 'removing'} its endpoint.`, + 0 + ) + } + } + + if (removalOnly && Object.keys(readConfigProfile(profile.name)).length === 0) { + return false + } + writeConfigProfile(profile.name, updates) + return true + }) + + if (!changed) { console.log(chalk.dim(`No settings stored for profile "${profile.name}".`)) return } - - writeConfigProfile(profile.name, updates) console.log(chalk.green(`✓ Updated profile "${profile.name}" in ${configPath()}`)) } ) diff --git a/packages/sim-cli/src/config/index.ts b/packages/sim-cli/src/config/index.ts index 905bf09fdf5..e7256a7ae77 100644 --- a/packages/sim-cli/src/config/index.ts +++ b/packages/sim-cli/src/config/index.ts @@ -26,6 +26,7 @@ export { type StoredOAuthCredential, validateProfileName, withCredentialsLock, + withProfileLoginLease, writeConfigProfile, writeCredentialsProfile, } from './profile' diff --git a/packages/sim-cli/src/config/profile.test.ts b/packages/sim-cli/src/config/profile.test.ts index 61ba693a7e9..f16b9d41db1 100644 --- a/packages/sim-cli/src/config/profile.test.ts +++ b/packages/sim-cli/src/config/profile.test.ts @@ -26,6 +26,7 @@ import { resolveProfile, validateProfileName, withCredentialsLock, + withProfileLoginLease, writeConfigProfile, writeCredentialsProfile, } from './profile' @@ -720,11 +721,27 @@ describe('OAuth logins in the credentials file', () => { it('reclaims a lock left behind by a process that died holding it', async () => { const lockPath = `${credentialsPath()}.lock` mkdirSync(lockPath, { mode: 0o700 }) - // Older than the 30s stale window, so the holder is presumed gone. + /** Older than the 30-second stale window, so the holder is presumed gone. */ const dead = new Date(Date.now() - 60_000) utimesSync(lockPath, dead, dead) await expect(withCredentialsLock(async () => 'ran')).resolves.toBe('ran') expect(existsSync(lockPath)).toBe(false) }) + + it('refuses a second interactive login lease for the same profile', async () => { + let releaseFirst!: () => void + const first = withProfileLoginLease( + 'default', + () => new Promise((resolve) => (releaseFirst = resolve)) + ) + await sleep(10) + + await expect(withProfileLoginLease('default', async () => undefined)).rejects.toThrow( + 'Another sim login is already in progress for profile "default".' + ) + + releaseFirst() + await first + }) }) diff --git a/packages/sim-cli/src/config/profile.ts b/packages/sim-cli/src/config/profile.ts index 9ff267facb1..14f86a60c90 100644 --- a/packages/sim-cli/src/config/profile.ts +++ b/packages/sim-cli/src/config/profile.ts @@ -1,4 +1,5 @@ import { AsyncLocalStorage } from 'node:async_hooks' +import { createHash } from 'node:crypto' import { chmodSync, existsSync, @@ -192,23 +193,15 @@ function readIni(path: string): IniDocument { function writeIni(path: string, doc: IniDocument, secret: boolean): void { mkdirSync(dirname(path), { recursive: true, mode: 0o700 }) - if (!secret) { - writeFileSync(path, serializeIni(doc), { mode: 0o644 }) - return - } - /** - * Written to a fresh 0600 file and renamed into place, so a credential never - * exists at a wider mode even for an instant: `writeFileSync`'s `mode` only - * applies when it creates the file, so writing over an existing 0644 file - * (one made by a hand `touch`, or by a version of this that predates the - * mode) left the tokens readable until the `chmod` landed. The rename is - * atomic, so a reader also never sees a half-written file. + * Written to a fresh file and renamed into place, so readers never observe a + * partial profile. Credentials are additionally forced to 0600 before the + * rename, including when a hand-created temporary path had wider permissions. */ - const temporary = `${path}.${process.pid}.tmp` + const temporary = `${path}.${process.pid}.${temporaryFileSequence++}.tmp` try { - writeFileSync(temporary, serializeIni(doc), { mode: 0o600 }) - chmodSync(temporary, 0o600) + writeFileSync(temporary, serializeIni(doc), { mode: secret ? 0o600 : 0o644 }) + if (secret) chmodSync(temporary, 0o600) renameSync(temporary, path) } catch (error) { rmSync(temporary, { force: true }) @@ -216,6 +209,8 @@ function writeIni(path: string, doc: IniDocument, secret: boolean): void { } } +let temporaryFileSequence = 0 + export function readConfigProfile(profile: string): Record { return getSection(readIni(configPath()), configSectionName(profile)) ?? {} } @@ -493,6 +488,39 @@ const CREDENTIALS_LOCK_POLL_MS = 50 */ const heldLock = new AsyncLocalStorage() +/** Prevents two interactive sign-ins from minting credentials for one profile concurrently. */ +export async function withProfileLoginLease( + profile: string, + work: () => Promise +): Promise { + const digest = createHash('sha256').update(profile, 'utf8').digest('hex') + const path = `${credentialsPath()}.login-${digest}` + mkdirSync(dirname(path), { recursive: true, mode: 0o700 }) + + let release: (() => Promise) | undefined + try { + release = await lock(path, { + realpath: false, + stale: CREDENTIALS_LOCK_STALE_MS, + update: CREDENTIALS_LOCK_STALE_MS / 3, + retries: 0, + }) + } catch (error) { + if ((error as NodeJS.ErrnoException).code === 'ELOCKED') { + throw new ProfileConfigError( + `Another sim login is already in progress for profile "${redact(profile)}".` + ) + } + throw error + } + + try { + return await work() + } finally { + await release() + } +} + export async function withCredentialsLock(work: () => Promise): Promise { if (heldLock.getStore()) return work() @@ -530,14 +558,14 @@ export async function withCredentialsLock(work: () => Promise): Promise /** Drops the profile from both files. Returns whether anything was removed. */ export function deleteProfile(profile: string): { config: boolean; credentials: boolean } { - const configDoc = readIni(configPath()) - const config = removeSection(configDoc, configSectionName(profile)) - if (config) writeIni(configPath(), configDoc, false) - const credentialsDoc = readIni(credentialsPath()) const credentials = removeSection(credentialsDoc, profile) if (credentials) writeIni(credentialsPath(), credentialsDoc, true) + const configDoc = readIni(configPath()) + const config = removeSection(configDoc, configSectionName(profile)) + if (config) writeIni(configPath(), configDoc, false) + return { config, credentials } } @@ -708,9 +736,7 @@ export function resolveProfile(overrides: ProfileOverrides = {}): ResolvedProfil [ ['flag', overrides.apiKey], ['env', process.env.SIM_API_KEY], - // A stored OAuth login outranks a stored key — a write of either clears - // the other, so both present means a hand-edited file, and the login is - // the one `sim login` would have left. + /** Prefer the OAuth login if a hand-edited section contains both credential kinds. */ ['credentials', storedOAuth ? null : credentials.api_key], ], null, diff --git a/packages/sim-cli/src/contract/commands.test.ts b/packages/sim-cli/src/contract/commands.test.ts index cc3c41b692d..a76f0df294f 100644 --- a/packages/sim-cli/src/contract/commands.test.ts +++ b/packages/sim-cli/src/contract/commands.test.ts @@ -380,17 +380,17 @@ describe('records show what the API actually returns', () => { expect(paths).toContain('storage.percentUsed') // Credits and storage are both null for a workspace API key, so the record // has to say why it is showing em-dashes. - expect(spec?.describe).toContain('personal API key') + expect(spec?.describe).toContain('OAuth login or personal API key') }) it('says which ledger a billing-logs page answers', () => { // The same workspace, window and flags return a strict subset of rows on a - // personal key, which reads as a bug beside `billing status`. Read off the + // user credential, which reads as a bug beside `billing status`. Read off the // help the terminal prints, since a describe that never reached a command // would answer nobody. const help = flatHelp('billing', 'logs') - expect(help).toContain('personal API key reports only your own events') + expect(help).toContain('OAuth login or personal API key reports only your events') expect(help).toMatch(/workspace API key reports every member/) }) @@ -612,7 +612,7 @@ describe('help and gates state what is actually true', () => { expect(help).toContain('--organization') expect(help).toContain('defaults to your only organization') - expect(help).toContain('personal API key required') + expect(help).toContain('OAuth login or personal API key required') } }) diff --git a/packages/sim-cli/src/contract/commands.ts b/packages/sim-cli/src/contract/commands.ts index b3ddd963511..f6a75695e53 100644 --- a/packages/sim-cli/src/contract/commands.ts +++ b/packages/sim-cli/src/contract/commands.ts @@ -133,7 +133,7 @@ export const CLI_CONTRACT: CliContract = { // fields otherwise render as an unexplained em-dash for exactly the key // most people run the CLI with. describe: - 'Show billing status and current-period credit usage (credits and storage require a personal API key)', + 'Show billing status and current-period credit usage (credits and storage require an OAuth login or personal API key)', fields: [ { header: 'plan' }, { header: 'status' }, @@ -153,19 +153,19 @@ export const CLI_CONTRACT: CliContract = { listBillingLogs: { command: 'billing logs', allWorkspaces: true, - // Which ledger answered depends on the key, and the counts otherwise read + // Which ledger answered depends on the credential, and the counts otherwise read // as a bug next to `billing status`. Said in the describe for the reason // `billing status` says its own caveat. The trailing parenthetical is what // keeps the generated docs heading unchanged. describe: - "List credit usage events (a personal API key reports only your own events; a workspace API key reports every member's in aggregate, unattributed)", + "List credit usage events (an OAuth login or personal API key reports only your events; a workspace API key reports every member's in aggregate, unattributed)", flags: { source: { describe: 'Filter by usage source; sim-chat combines Copilot and workspace chat' }, period: { describe: 'Billing period' }, startDate: { describe: 'Custom period start (ISO 8601)' }, endDate: { describe: 'Custom period end (ISO 8601)' }, }, - // Which ledger answered: a personal key reports only the calling user's + // Which ledger answered: a user credential reports only the calling user's // events, a workspace key the whole workspace. The difference was silent — // same workspace, same window, same flags, a strictly smaller result. pageNote: { path: 'scope', label: 'scope' }, @@ -981,7 +981,7 @@ export const CLI_CONTRACT: CliContract = { organizationId: { name: 'organization', describe: - 'Organization ID; defaults to your only organization, and is required when your account belongs to more than one (personal API key required)', + 'Organization ID; defaults to your only organization, and is required when your account belongs to more than one (OAuth login or personal API key required)', }, }, columns: [ @@ -1000,7 +1000,7 @@ export const CLI_CONTRACT: CliContract = { organizationId: { name: 'organization', describe: - 'Organization ID; defaults to your only organization, and is required when your account belongs to more than one (personal API key required)', + 'Organization ID; defaults to your only organization, and is required when your account belongs to more than one (OAuth login or personal API key required)', }, }, }, diff --git a/packages/sim-cli/src/contract/types.ts b/packages/sim-cli/src/contract/types.ts index 9ce3f14bf0d..d766c6a8a5a 100644 --- a/packages/sim-cli/src/contract/types.ts +++ b/packages/sim-cli/src/contract/types.ts @@ -275,9 +275,9 @@ export interface CommandSpec { * A page-envelope field that qualifies the whole list, stated once for the * human formats. * - * `billing logs` answers a different question depending on the kind of API - * key that asked — a personal key sees the caller's own events, a workspace - * key the whole workspace ledger — and the response says which. The value + * `billing logs` answers a different question depending on the credential — + * an OAuth login or personal key sees the caller's own events, while a + * workspace key sees the whole workspace ledger. The response says which. The value * belongs to the query rather than to any row, so it is not a column; it goes * to stderr so that a `--output text` consumer cutting tab-separated fields * still reads only rows. `json` and `yaml` print the unwrapped `data` array diff --git a/packages/sim-cli/src/generated/v2-api.ts b/packages/sim-cli/src/generated/v2-api.ts index a17e7570b65..992e24b672a 100644 --- a/packages/sim-cli/src/generated/v2-api.ts +++ b/packages/sim-cli/src/generated/v2-api.ts @@ -9409,7 +9409,7 @@ export type UpsertTableRowResponse = { * `summary` is the operation's one-line description, lifted from the OpenAPI * specs so `--help` reuses prose that is already written and already checked. * - * `personalKeyOnly` marks an operation whose spec description says a workspace + * `workspaceKeyUnsupported` marks an operation whose spec says a workspace * API key is rejected, so `--help` can say so before the request is sent. */ export const V2_OPERATIONS = { @@ -9470,7 +9470,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Activate Workflow Version', - personalKeyOnly: true, + workspaceKeyUnsupported: true, }, addTableColumn: { method: 'POST', @@ -9517,7 +9517,7 @@ export const V2_OPERATIONS = { pathParamDocs: { knowledgeBaseId: 'Unique knowledge base identifier.' }, responseMode: 'json', summary: 'Index Workspace Files', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -9539,7 +9539,6 @@ export const V2_OPERATIONS = { pathParamDocs: { workflowId: 'Unique workflow identifier.' }, responseMode: 'json', summary: 'Apply Workflow Operations', - personalKeyOnly: true, query: { dryRun: { kind: 'boolean', @@ -9645,7 +9644,7 @@ export const V2_OPERATIONS = { pathParamDocs: { knowledgeBaseId: 'Unique knowledge base identifier.' }, responseMode: 'json', summary: 'Bulk Save Tag Definitions', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -9669,7 +9668,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Bulk Update Chunks', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -9697,7 +9696,7 @@ export const V2_OPERATIONS = { pathParamDocs: { knowledgeBaseId: 'Unique knowledge base identifier.' }, responseMode: 'json', summary: 'Bulk Enable or Disable Documents', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -9815,7 +9814,7 @@ export const V2_OPERATIONS = { filter: { kind: 'unknown', describe: - 'Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.', + 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', }, excludeRowIds: { kind: 'array', describe: 'Rows excluded from an all-scope cancellation.' }, }, @@ -9924,7 +9923,7 @@ export const V2_OPERATIONS = { pathParams: [] as const, responseMode: 'json', summary: 'Create Credential Connection', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -10102,7 +10101,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Create Chunk', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -10128,7 +10127,7 @@ export const V2_OPERATIONS = { pathParamDocs: { knowledgeBaseId: 'Unique knowledge base identifier.' }, responseMode: 'json', summary: 'Create Knowledge Connector', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -10244,7 +10243,7 @@ export const V2_OPERATIONS = { pathParamDocs: { knowledgeBaseId: 'Unique knowledge base identifier.' }, responseMode: 'json', summary: 'Create Tag', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -10362,7 +10361,7 @@ export const V2_OPERATIONS = { pathParams: [] as const, responseMode: 'json', summary: 'Create Sandbox', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -10403,7 +10402,7 @@ export const V2_OPERATIONS = { pathParams: [] as const, responseMode: 'json', summary: 'Create Service-Account Credential', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -10443,7 +10442,7 @@ export const V2_OPERATIONS = { pathParams: [] as const, responseMode: 'json', summary: 'Create Skill', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -10506,7 +10505,7 @@ export const V2_OPERATIONS = { filter: { kind: 'unknown', describe: - 'Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.', + 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', }, excludeRowIds: { kind: 'array', describe: 'Rows excluded from a select-all run scope.' }, limit: { kind: 'object', describe: 'Optional cap on eligible rows to run.' }, @@ -10662,7 +10661,7 @@ export const V2_OPERATIONS = { pathParams: [] as const, responseMode: 'json', summary: 'Create Workflow MCP Server', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -10694,7 +10693,7 @@ export const V2_OPERATIONS = { pathParamDocs: { credentialId: 'Credential to disconnect.' }, responseMode: 'json', summary: 'Disconnect Credential', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -10786,7 +10785,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Delete Chunk', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -10805,7 +10804,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Delete Knowledge Connector', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -10877,7 +10876,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Delete Tag', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -10893,7 +10892,7 @@ export const V2_OPERATIONS = { pathParamDocs: { knowledgeBaseId: 'Unique knowledge base identifier.' }, responseMode: 'json', summary: 'Delete Tag Definitions', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -10929,7 +10928,7 @@ export const V2_OPERATIONS = { pathParamDocs: { sandboxId: 'Unique sandbox identifier.' }, responseMode: 'json', summary: 'Delete Sandbox', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', required: true, describe: 'Workspace that owns the sandbox.' }, }, @@ -10941,7 +10940,7 @@ export const V2_OPERATIONS = { pathParamDocs: { name: 'Secret to delete.' }, responseMode: 'json', summary: 'Delete Secret', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -10968,7 +10967,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Delete Skill', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', required: true, describe: 'Workspace that owns the skill.' }, }, @@ -11050,7 +11049,7 @@ export const V2_OPERATIONS = { filter: { kind: 'unknown', describe: - 'Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.', + 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', }, limit: { kind: 'integer', describe: 'Maximum matching rows to delete.' }, rowIds: { kind: 'array', describe: 'Explicit row identifiers to delete.' }, @@ -11082,7 +11081,7 @@ export const V2_OPERATIONS = { pathParamDocs: { workflowId: 'Unique workflow identifier.' }, responseMode: 'json', summary: 'Delete Workflow Chat Deployment', - personalKeyOnly: true, + workspaceKeyUnsupported: true, }, deleteWorkflowFolder: { method: 'DELETE', @@ -11134,7 +11133,7 @@ export const V2_OPERATIONS = { pathParamDocs: { serverId: 'Unique workflow-MCP server identifier.' }, responseMode: 'json', summary: 'Delete Workflow MCP Server', - personalKeyOnly: true, + workspaceKeyUnsupported: true, }, deployWorkflow: { method: 'POST', @@ -11143,7 +11142,7 @@ export const V2_OPERATIONS = { pathParamDocs: { workflowId: 'Unique workflow identifier.' }, responseMode: 'json', summary: 'Deploy Workflow', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { name: { kind: 'string', describe: 'Optional label for the deployment version.' }, description: { @@ -11159,7 +11158,7 @@ export const V2_OPERATIONS = { pathParamDocs: { serverId: 'Unique workflow-MCP server identifier.' }, responseMode: 'json', summary: 'Publish Workflow As MCP Tool', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workflowId: { kind: 'string', @@ -11250,7 +11249,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Run Tool', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -11290,13 +11289,13 @@ export const V2_OPERATIONS = { run: { kind: 'unknown', describe: - 'Workflow state and entry point to execute. Omit for the active deployment. Manual execution requires a personal API key with write access and supports synchronous or streamed runs only.', + 'Workflow state and entry point to execute. Omit for the active deployment. Manual execution requires OAuth or personal-key write access and supports synchronous or streamed runs only.', }, async: { kind: 'boolean', default: false, describe: - 'Queue the run and return a 202 receipt when true. Requires an API key, cannot be combined with `stream`, and rejects all streaming and output-shaping options (`selectedOutputs`, `includeThinking`, `includeToolCalls`, `includeFileBase64`, `base64MaxBytes`).', + 'Queue the run and return a 202 receipt when true. Requires an OAuth access token or API key, cannot be combined with `stream`, and rejects all streaming and output-shaping options (`selectedOutputs`, `includeThinking`, `includeToolCalls`, `includeFileBase64`, `base64MaxBytes`).', }, executionTimeoutSeconds: { kind: 'integer', @@ -11364,7 +11363,7 @@ export const V2_OPERATIONS = { pathParamDocs: { auditLogId: 'Audit-log entry identifier.' }, responseMode: 'json', summary: 'Get Audit Log', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { organizationId: { kind: 'string', @@ -11498,7 +11497,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Get Chunk', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -11517,7 +11516,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Get Knowledge Connector', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -11631,7 +11630,7 @@ export const V2_OPERATIONS = { pathParamDocs: { knowledgeBaseId: 'Unique knowledge base identifier.' }, responseMode: 'json', summary: 'Get Next Tag Slot', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -11815,7 +11814,7 @@ export const V2_OPERATIONS = { pathParamDocs: { workflowId: 'Unique workflow identifier.' }, responseMode: 'json', summary: 'Get Workflow Chat Deployment', - personalKeyOnly: true, + workspaceKeyUnsupported: true, }, getWorkflowDeployment: { method: 'GET', @@ -11832,7 +11831,7 @@ export const V2_OPERATIONS = { pathParamDocs: { serverId: 'Unique workflow-MCP server identifier.' }, responseMode: 'json', summary: 'Get Workflow MCP Server', - personalKeyOnly: true, + workspaceKeyUnsupported: true, }, getWorkflowRun: { method: 'GET', @@ -11903,7 +11902,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Grant Skill Editor', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', required: true, describe: 'Workspace that owns the skill.' }, email: { @@ -11945,7 +11944,7 @@ export const V2_OPERATIONS = { pathParams: [] as const, responseMode: 'json', summary: 'List Audit Logs', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { action: { kind: 'string', describe: 'Filter by exact action name.' }, resourceType: { @@ -12014,7 +12013,7 @@ export const V2_OPERATIONS = { workspaceId: { kind: 'string', describe: - "Narrow the ledger to usage events attributed to one workspace. It does not change whose events are reported — a personal API key always reports the usage of the person holding it, and a workspace API key always reports its own workspace's complete ledger across every member. The response `scope` field says which of the two you received. A workspace API key is pinned to its own workspace: any other id answers `404 Workspace not found`, which is also what an id that does not exist answers.", + "Narrow the ledger to one workspace. An OAuth token or personal API key reports only its user's events; a workspace API key reports every member's events in its bound workspace. The response `scope` identifies which view was returned. A workspace key asking for another workspace receives the same `404 Workspace not found` as an unknown id.", }, period: { kind: 'enum', @@ -12475,7 +12474,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'List Chunks', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -12527,7 +12526,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'List Knowledge Connector Documents', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -12558,7 +12557,7 @@ export const V2_OPERATIONS = { pathParamDocs: { knowledgeBaseId: 'Unique knowledge base identifier.' }, responseMode: 'json', summary: 'List Knowledge Connectors', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -12710,7 +12709,7 @@ export const V2_OPERATIONS = { pathParamDocs: { knowledgeBaseId: 'Unique knowledge base identifier.' }, responseMode: 'json', summary: 'List Tag Usage', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -12739,7 +12738,7 @@ export const V2_OPERATIONS = { triggers: { kind: 'string', describe: - 'Comma-separated trigger types to include. An empty entry is rejected. Values are matched exactly and are case-sensitive — every recorded trigger is lowercase, so `API` matches nothing while `api` matches. The vocabulary is open: it covers the core trigger types (`manual`, `api`, `schedule`, `chat`, `webhook`, `mcp`, `copilot`, `workflow`, `custom_block`) and the provider id of any webhook trigger (`slack`, `gmail`, `github`, …), so an unrecognized member is not rejected — it selects no runs. The literal value `all` is a sentinel that disables this filter entirely, so a list containing it returns runs of every trigger type; no real trigger type is named `all`. At most 100 entries.', + 'Comma-separated, lowercase trigger types or webhook provider IDs. Matching is exact and case-sensitive; unknown values select no runs. An empty entry is rejected. The sentinel `all` disables this filter, even when listed with other values. At most 100 entries.', }, level: { kind: 'enum', @@ -12818,7 +12817,7 @@ export const V2_OPERATIONS = { includeJobRuns: { kind: 'boolean', describe: - 'Whether Chat and Sim-agent job runs join the sequence alongside workflow runs. Job runs report `kind: "job"`, carry no `workflow` summary, and never carry a cost ledger. They are dropped entirely — not partially matched — whenever a filter they cannot answer is set: by workflow, workflow name, folder, model, or status. A filter therefore never means two different things across the union. Accepted only when sorting by `startedAt`: job runs record cost as a document and no comparable status, so they cannot participate in the other orderings.', + 'Include Chat and Sim-agent jobs alongside workflow runs. Jobs use `kind: "job"` and have no workflow or cost ledger. Workflow, folder, model, or status filters exclude jobs. This option is valid only when sorting by `startedAt`.', }, runId: { kind: 'string', describe: 'Exact run identifier to match.' }, sortBy: { @@ -12890,7 +12889,7 @@ export const V2_OPERATIONS = { pathParamDocs: { mcpServerId: 'Unique MCP server identifier.' }, responseMode: 'json', summary: 'List MCP Server Tools', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -12948,7 +12947,7 @@ export const V2_OPERATIONS = { pathParams: [] as const, responseMode: 'json', summary: 'List Secrets', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -13310,7 +13309,7 @@ export const V2_OPERATIONS = { pathParams: [] as const, responseMode: 'json', summary: 'List Workflow MCP Servers', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -13350,7 +13349,7 @@ export const V2_OPERATIONS = { pathParamDocs: { serverId: 'Unique workflow-MCP server identifier.' }, responseMode: 'json', summary: 'List Workflow MCP Tools', - personalKeyOnly: true, + workspaceKeyUnsupported: true, }, listWorkflowRuns: { method: 'GET', @@ -13600,7 +13599,7 @@ export const V2_OPERATIONS = { predicate: { kind: 'unknown', describe: - 'A single `{ field, op, value }` condition or a recursive `all`/`any` group; either form is normalized to a grouped predicate after validation. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.', + 'One condition or a recursive `all`/`any` group, normalized to a grouped predicate. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', }, sort: { kind: 'array', describe: 'Ordered table-row sort specification.' }, limit: { @@ -13628,7 +13627,7 @@ export const V2_OPERATIONS = { predicate: { kind: 'unknown', describe: - 'A single `{ field, op, value }` condition or a recursive `all`/`any` group; either form is normalized to a grouped predicate after validation. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.', + 'One condition or a recursive `all`/`any` group, normalized to a grouped predicate. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', }, }, }, @@ -13739,7 +13738,6 @@ export const V2_OPERATIONS = { pathParamDocs: { workflowId: 'Unique workflow identifier.' }, responseMode: 'json', summary: 'Create or Replace Workflow Chat Deployment', - personalKeyOnly: true, body: { identifier: { kind: 'string', @@ -13795,7 +13793,6 @@ export const V2_OPERATIONS = { pathParamDocs: { workflowId: 'Unique workflow identifier.' }, responseMode: 'json', summary: 'Replace Workflow State', - personalKeyOnly: true, query: { dryRun: { kind: 'boolean', @@ -13937,7 +13934,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Revert Workflow To Version', - personalKeyOnly: true, + workspaceKeyUnsupported: true, }, revokeSkillEditor: { method: 'DELETE', @@ -13949,7 +13946,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Revoke Skill Editor', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', required: true, describe: 'Workspace that owns the skill.' }, email: { @@ -13966,7 +13963,7 @@ export const V2_OPERATIONS = { pathParamDocs: { workflowId: 'Unique workflow identifier.' }, responseMode: 'json', summary: 'Rollback Workflow', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { version: { kind: 'integer', @@ -14066,7 +14063,7 @@ export const V2_OPERATIONS = { tagFilters: { kind: 'array', describe: - 'Structured tag filters, at most 10 of them. Every filter must hold, including two that name the same tag: repeating one tag narrows the result rather than widening it, matching `GET /api/v2/knowledge/{knowledgeBaseId}/documents`. To match either of two values for one tag, issue a search per value. Each filtered tag must resolve to the same slot and field type in every knowledge base selected; one missing from any of them, or defined inconsistently across them, is rejected rather than ignored, and those knowledge bases must be searched separately. List the available names with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`.', + 'Up to 10 filters combined with AND; repeating a tag narrows results. To express OR, run separate searches. Every tag must exist with the same slot and field type in each selected knowledge base or the request is rejected. List valid names with the knowledge-base tag-list operation.', }, searchMode: { kind: 'enum', @@ -14105,7 +14102,7 @@ export const V2_OPERATIONS = { predicate: { kind: 'unknown', describe: - 'Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.', + 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', }, sort: { kind: 'array', describe: 'Ordered table-row sort specification.' }, }, @@ -14117,7 +14114,7 @@ export const V2_OPERATIONS = { pathParamDocs: { name: 'Secret to create or replace.' }, responseMode: 'json', summary: 'Set Secret', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -14159,7 +14156,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Sync Knowledge Connector', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -14198,7 +14195,7 @@ export const V2_OPERATIONS = { pathParamDocs: { workflowId: 'Unique workflow identifier.' }, responseMode: 'json', summary: 'Undeploy Workflow', - personalKeyOnly: true, + workspaceKeyUnsupported: true, }, undeployWorkflowMcpTool: { method: 'DELETE', @@ -14210,7 +14207,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Unpublish Workflow MCP Tool', - personalKeyOnly: true, + workspaceKeyUnsupported: true, }, unzipFile: { method: 'POST', @@ -14230,7 +14227,7 @@ export const V2_OPERATIONS = { pathParamDocs: { credentialId: 'Credential to update.' }, responseMode: 'json', summary: 'Update Credential', - personalKeyOnly: true, + workspaceKeyUnsupported: true, query: { workspaceId: { kind: 'string', @@ -14333,7 +14330,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Update Chunk', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -14361,7 +14358,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Update Knowledge Connector', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -14394,7 +14391,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Update Knowledge Connector Documents', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -14424,7 +14421,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Update Document', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -14470,7 +14467,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Update Tag', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', @@ -14565,7 +14562,7 @@ export const V2_OPERATIONS = { kind: 'unknown', required: true, describe: - 'Recursive predicate tree. Each group node is exactly one non-empty `all` or `any` array whose members are further groups or `{ field, op, value }` conditions; the root must be a group, not a bare condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls: `ne`, `nin`, `ncontains`, `nlike`, and `nilike` match rows whose column is null or absent, so "not X" is not the complement of "X" over a nullable column. That holds for every column type, multi-select included. To exclude nulls, `all`-combine the negation with `isNotEmpty` (multi-select) or `isNotNull`. Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. Membership: `in`, `nin` (array operand). Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand). Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`. Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`. A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.', + 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', }, data: { kind: 'object', @@ -14582,7 +14579,7 @@ export const V2_OPERATIONS = { pathParamDocs: { sandboxId: 'Unique sandbox identifier.' }, responseMode: 'json', summary: 'Update Sandbox', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', required: true, describe: 'Workspace that owns the sandbox.' }, name: { @@ -14619,7 +14616,7 @@ export const V2_OPERATIONS = { }, responseMode: 'json', summary: 'Update Skill', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', required: true, describe: 'Workspace that owns the skill.' }, name: { kind: 'string', describe: 'New kebab-case skill name.' }, @@ -14759,7 +14756,7 @@ export const V2_OPERATIONS = { pathParamDocs: { serverId: 'Unique workflow-MCP server identifier.' }, responseMode: 'json', summary: 'Update Workflow MCP Server', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { name: { kind: 'string', describe: 'Server display name, shown to connecting MCP clients.' }, description: { kind: 'string', describe: 'New server description, or null to clear it.' }, @@ -14776,7 +14773,7 @@ export const V2_OPERATIONS = { pathParamDocs: { workflowId: 'Unique workflow identifier.' }, responseMode: 'json', summary: 'Update Workflow Public API Access', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { isPublicApi: { kind: 'boolean', @@ -14826,7 +14823,7 @@ export const V2_OPERATIONS = { pathParamDocs: { fileId: 'File identifier.' }, responseMode: 'json', summary: 'Enable or Disable File Share', - personalKeyOnly: true, + workspaceKeyUnsupported: true, body: { workspaceId: { kind: 'string', required: true, describe: 'Workspace that owns the file.' }, isActive: { diff --git a/packages/sim-cli/src/http/client.test.ts b/packages/sim-cli/src/http/client.test.ts index 0082d4ff4e0..ace92c62804 100644 --- a/packages/sim-cli/src/http/client.test.ts +++ b/packages/sim-cli/src/http/client.test.ts @@ -505,7 +505,7 @@ describe('request identity', () => { }) }) -describe('personal-key-only operations', () => { +describe('workspace-key refusals', () => { it('appends the remedy, keyed off the code the API actually nests', async () => { // The envelope this asserts is the one staging returns: `error.code` is the // status class, and the actionable code rides in `error.details.code`. @@ -528,7 +528,7 @@ describe('personal-key-only operations', () => { await expect(client().request('/api/v2/secrets')).rejects.toMatchObject({ message: - 'Workspace API key cannot perform this operation — this operation needs a personal API key: sim login --profile default', + 'Workspace API key cannot perform this operation — this operation does not support workspace API keys; use an OAuth login or personal API key: sim login --profile default', code: 'FORBIDDEN', }) }) @@ -557,7 +557,7 @@ describe('personal-key-only operations', () => { await expect(client().request('/api/v2/audit-logs')).rejects.toMatchObject({ message: - 'Principal kind workspace_api_key cannot perform operation audit_logs.list — this operation needs a personal API key: sim login --profile default', + 'Principal kind workspace_api_key cannot perform operation audit_logs.list — this operation does not support workspace API keys; use an OAuth login or personal API key: sim login --profile default', }) }) @@ -1119,12 +1119,16 @@ describe('destructive operations are gated', () => { describe('OAuth bearer credentials', () => { const NOW = 1_700_000_000_000 - function oauthClient(expiresAt: number, refreshOAuth = vi.fn()) { + function oauthClient( + expiresAt: number, + refreshOAuth = vi.fn(), + names = { name: 'default', authProfile: 'default' } + ) { const client = new SimClient( { - name: 'default', + name: names.name, endpoint: 'https://sim.example', - authProfile: 'default', + authProfile: names.authProfile, apiKey: null, oauth: { accessToken: 'sim_oat_live', @@ -1241,6 +1245,42 @@ describe('OAuth bearer credentials', () => { expect(refresh).not.toHaveBeenCalled() }) + it('does not refresh when invalid_token appears only in the challenge description', async () => { + vi.useFakeTimers({ now: NOW }) + vi.stubGlobal( + 'fetch', + vi.fn(async () => + jsonReply( + 401, + { error: { code: 'FORBIDDEN', message: 'Scope refused' } }, + { + 'www-authenticate': + 'Bearer realm="Sim API", error="insufficient_scope", error_description="not an invalid_token failure"', + } + ) + ) + ) + const refresh = vi.fn() + const { client } = oauthClient(NOW + 60 * 60 * 1000, refresh) + + await expect(client.request('/api/v2/meta')).rejects.toThrow('Scope refused') + expect(refresh).not.toHaveBeenCalled() + }) + + it('directs a workspace alias to its authentication profile after a 401', async () => { + vi.useFakeTimers({ now: NOW }) + vi.stubGlobal( + 'fetch', + vi.fn(async () => jsonReply(401, { error: { message: 'Login rejected' } })) + ) + const { client } = oauthClient(NOW + 60 * 60 * 1000, vi.fn(), { + name: 'workspace-alias', + authProfile: 'default', + }) + + await expect(client.request('/api/v2/meta')).rejects.toThrow('sim login --profile default') + }) + it('prefers an explicit API key over the stored login', async () => { vi.useFakeTimers({ now: NOW }) const fetchMock = vi.fn(async () => jsonReply(200, { data: {} })) @@ -1250,9 +1290,7 @@ describe('OAuth bearer credentials', () => { endpoint: 'https://sim.example', authProfile: 'default', apiKey: 'sim_from_env', - // A live stored login sits alongside it, which is the whole point: with - // `oauth: null` there is nothing for the key to be preferred over and the - // assertion passes no matter which branch the client takes. + /** Keep a live stored login present so the explicit-key precedence is observable. */ oauth: { accessToken: 'sim_oat_live', refreshToken: 'sim_ort_live', diff --git a/packages/sim-cli/src/http/client.ts b/packages/sim-cli/src/http/client.ts index b99e1c82807..509405c0349 100644 --- a/packages/sim-cli/src/http/client.ts +++ b/packages/sim-cli/src/http/client.ts @@ -445,6 +445,15 @@ export interface SimClientOptions { */ const REFRESH_AHEAD_MS = 5 * 60 * 1000 +/** Reads the OAuth error parameter from Sim's Bearer challenge. */ +function bearerChallengeError(header: string | null): string | null { + if (!header?.trimStart().toLowerCase().startsWith('bearer')) return null + const match = /(?:^|,)\s*error\s*=\s*(?:"([^"]*)"|([^,\s]+))/i.exec( + header.replace(/^\s*Bearer\s*/i, '') + ) + return match?.[1] ?? match?.[2] ?? null +} + export class SimClient { private oauth: StoredOAuthCredential | null private refreshing: Promise | null = null @@ -461,7 +470,7 @@ export class SimClient { if (this.oauth) return { kind: 'oauth', oauth: this.oauth } if (auth === 'optional') return undefined throw new SimApiError( - `Not logged in on profile "${this.profile.name}". Run: sim login --profile ${this.profile.name}`, + `Not logged in on profile "${this.profile.name}". Run: sim login --profile ${this.profile.authProfile}`, 0 ) } @@ -610,7 +619,7 @@ export class SimClient { response.status === 401 && credential?.kind === 'oauth' && !retriedAfterRefresh && - /\binvalid_token\b/.test(response.headers.get('www-authenticate') ?? '') + bearerChallengeError(response.headers.get('www-authenticate')) === 'invalid_token' ) { await response.body?.cancel() await this.refreshOAuth(credential.oauth) @@ -621,10 +630,10 @@ export class SimClient { const raw = await response.text() const error = toApiError(url, response.status, response.headers.get('content-type'), raw) if (response.status === 401) { - error.message = `${error.message} — run: sim login --profile ${this.profile.name}` + error.message = `${error.message} — run: sim login --profile ${this.profile.authProfile}` } if (namesKeyScopeRefusal(error)) { - error.message = `${error.message} — this operation needs a personal API key: sim login --profile ${this.profile.name}` + error.message = `${error.message} — this operation does not support workspace API keys; use an OAuth login or personal API key: sim login --profile ${this.profile.authProfile}` } throw error } diff --git a/packages/sim-cli/src/runtime/build.test.ts b/packages/sim-cli/src/runtime/build.test.ts index 82c992b7ec4..a4517f56845 100644 --- a/packages/sim-cli/src/runtime/build.test.ts +++ b/packages/sim-cli/src/runtime/build.test.ts @@ -224,10 +224,10 @@ describe('commands parsed through commander', () => { describe('a command whose operation refuses a workspace API key', () => { it('says so in the help line it falls back to from the spec summary', () => { expect(commandAt('secrets', 'list').helpInformation()).toContain( - '(personal API key required)' + '(OAuth login or personal API key required)' ) expect(commandAt('mcp-servers', 'tools', 'list').description()).toContain( - '(personal API key required)' + '(OAuth login or personal API key required)' ) }) @@ -238,7 +238,7 @@ describe('commands parsed through commander', () => { */ it('says so on a command carrying a hand-written describe', () => { expect(commandAt('workflows', 'undeploy').description()).toBe( - 'Take a workflow out of deployment (personal API key required)' + 'Take a workflow out of deployment (OAuth login or personal API key required)' ) }) @@ -261,7 +261,7 @@ describe('commands parsed through commander', () => { ['credentials', 'reconnect'], ]) { expect(`${path.join(' ')}: ${builtCommandAt(...path).description()}`).toContain( - '(personal API key required)' + '(OAuth login or personal API key required)' ) } }) @@ -290,7 +290,7 @@ describe('commands parsed through commander', () => { const text = readFileSync(source, 'utf8') for (const [, operation] of text.matchAll(/V2_OPERATIONS\.([A-Za-z]+)/g)) { const spec = (V2_OPERATIONS as Record)[operation] - if (!spec?.personalKeyOnly) continue + if (!spec?.workspaceKeyUnsupported) continue const suffixed = new RegExp(`describeOperation\\(\\s*V2_OPERATIONS\\.${operation}\\b`) if (suffixed.test(text)) continue unsuffixed.push(`${source.slice(root.length + 1)} calls ${operation}`) @@ -959,7 +959,9 @@ describe('commands parsed through commander', () => { it('supports organization-wide audit listing explicitly', async () => { const help = commandAt('audit-logs', 'list').helpInformation() - expect(help).toMatch(/--organization .*personal API key required.*required/s) + expect(help).toMatch( + /--organization .*OAuth login or personal API key required.*required/s + ) expect(help).toContain('--all-workspaces') expect(help).toContain('--actor-email') expect(help).not.toContain('--actor-id') @@ -2161,8 +2163,8 @@ describe('flags the root program already owns', () => { describe('the billing ledger a key can see', () => { /** - * The defect was silence, not the scoping: a personal key reports the calling - * user's own events and a workspace key the whole workspace ledger, and the + * The defect was silence, not the scoping: a user credential reports the + * caller's own events and a workspace key the whole workspace ledger, and the * two answers were indistinguishable — same workspace, same window, same * flags, a strictly smaller result and nothing saying why. */ diff --git a/packages/sim-cli/src/runtime/build.ts b/packages/sim-cli/src/runtime/build.ts index 92f7e961bdb..b4f91523487 100644 --- a/packages/sim-cli/src/runtime/build.ts +++ b/packages/sim-cli/src/runtime/build.ts @@ -33,7 +33,7 @@ const GROUP_ALIASES: Readonly> = { } /** - * States the personal-key restriction the way every generated command states it. + * States the workspace-key restriction the way every generated command states it. * * The suffix lives here, once, because a fully hand-written command renders its * own `.description()` and never reaches the generated path — three commands @@ -43,7 +43,9 @@ const GROUP_ALIASES: Readonly> = { * caller has to name the operation it actually calls, so the two cannot drift. */ export function describeOperation(operationSpec: OperationSpec, described: string): string { - return operationSpec.personalKeyOnly ? `${described} (personal API key required)` : described + return operationSpec.workspaceKeyUnsupported + ? `${described} (OAuth login or personal API key required)` + : described } function argumentSyntax(command: Command): string { diff --git a/packages/sim-cli/src/runtime/options.ts b/packages/sim-cli/src/runtime/options.ts index c05b9d8bfa0..831adf47b4f 100644 --- a/packages/sim-cli/src/runtime/options.ts +++ b/packages/sim-cli/src/runtime/options.ts @@ -233,7 +233,7 @@ export function addOperationOptions( if (commandSpec.allWorkspaces) { command.option( '--all-workspaces', - 'Do not filter to the configured workspace (personal API key required for account-wide access)' + 'Do not filter to the configured workspace (OAuth login or personal API key required for account-wide access)' ) } diff --git a/packages/sim-cli/src/runtime/types.ts b/packages/sim-cli/src/runtime/types.ts index 9bd155d1584..51ea1cd7744 100644 --- a/packages/sim-cli/src/runtime/types.ts +++ b/packages/sim-cli/src/runtime/types.ts @@ -14,11 +14,11 @@ export interface OperationSpec { opaqueBody?: boolean summary?: string /** - * The operation rejects a workspace API key; only a personal one works. + * The operation rejects a workspace API key; an OAuth login or personal key works. * * Emitted by `scripts/generate-v2-cli-api.ts` from the OpenAPI description so * `--help` states the restriction the caller would otherwise meet as a `403`. */ - personalKeyOnly?: true + workspaceKeyUnsupported?: true responseMode?: 'json' | 'binary' | 'stream' } diff --git a/packages/testing/src/mocks/env-flags.mock.ts b/packages/testing/src/mocks/env-flags.mock.ts index fc61cfc4420..8216632014b 100644 --- a/packages/testing/src/mocks/env-flags.mock.ts +++ b/packages/testing/src/mocks/env-flags.mock.ts @@ -81,7 +81,7 @@ const defaultEnvFlagsState: EnvFlagsMockState = { isTriggerDevEnabled: false, isEnterpriseEnabled: false, isSsoEnabled: false, - // An opt-out flag, like `isChatEnabled`: on unless OAUTH_PROVIDER_ENABLED is falsy. + /** OAuth-aware route behavior is available unless a suite overrides it. */ isOAuthProviderEnabled: true, isUsageMonitoringEnabled: false, isAccessControlEnabled: false, diff --git a/packages/testing/src/mocks/schema.mock.ts b/packages/testing/src/mocks/schema.mock.ts index 2ca1e4d73e9..545c1c35045 100644 --- a/packages/testing/src/mocks/schema.mock.ts +++ b/packages/testing/src/mocks/schema.mock.ts @@ -1194,6 +1194,19 @@ export const schemaMock = { revoked: 'oauthRefreshToken.revoked', authTime: 'oauthRefreshToken.authTime', scopes: 'oauthRefreshToken.scopes', + familyId: 'oauthRefreshToken.familyId', + generation: 'oauthRefreshToken.generation', + }, + oauthTokenFamily: { + id: 'oauthTokenFamily.id', + clientId: 'oauthTokenFamily.clientId', + sessionId: 'oauthTokenFamily.sessionId', + userId: 'oauthTokenFamily.userId', + referenceId: 'oauthTokenFamily.referenceId', + consentId: 'oauthTokenFamily.consentId', + currentGeneration: 'oauthTokenFamily.currentGeneration', + createdAt: 'oauthTokenFamily.createdAt', + expiresAt: 'oauthTokenFamily.expiresAt', }, oauthAccessToken: { id: 'oauthAccessToken.id', diff --git a/scripts/check-api-validation-contracts.ts b/scripts/check-api-validation-contracts.ts index 4f9f647f26a..b4ed445bb1d 100644 --- a/scripts/check-api-validation-contracts.ts +++ b/scripts/check-api-validation-contracts.ts @@ -61,8 +61,10 @@ const INDIRECT_ZOD_ROUTES = new Set([ 'apps/sim/app/api/tools/docusign/route.ts', // Better Auth handles its own validation for the catch-all route below. 'apps/sim/app/api/auth/[...all]/route.ts', - // Input-less RFC 8414 metadata alias. Better Auth produces the provider - // document; the route only adds the public-client auth method and headers. + /** OAuth protocol routes use bounded form or bearer parsing instead of JSON contracts. */ + 'apps/sim/app/api/auth/oauth2/revoke/route.ts', + 'apps/sim/app/api/auth/oauth2/token/route.ts', + /** Input-less RFC 8414 aliases return Better Auth metadata with Sim's supported surface. */ 'apps/sim/app/api/auth/.well-known/oauth-authorization-server/route.ts', // Better Auth handles validation for the Stripe webhook handler. 'apps/sim/app/api/auth/webhook/stripe/route.ts', diff --git a/scripts/generate-v2-cli-api.test.ts b/scripts/generate-v2-cli-api.test.ts index 84fcfaabfbc..ee075d37002 100644 --- a/scripts/generate-v2-cli-api.test.ts +++ b/scripts/generate-v2-cli-api.test.ts @@ -66,7 +66,7 @@ describe('request headers reaching the CLI as flags', () => { * and this recomputes the expected set, so a generator holding a stale copy of * it goes red instead of silently unmarking a family. */ -function personalKeyMarkers(): string[] { +function workspaceKeyDenialMarkers(): string[] { const source = readFileSync( path.join(ROOT, 'apps/sim/lib/api/contracts/v2/openapi/shared.ts'), 'utf8' @@ -96,20 +96,22 @@ describe('operations that refuse a workspace API key', () => { * pinned pair stayed green. */ it('emits the marker for every operation the specs say refuses one', () => { - const marked = [...loadSummaries(personalKeyMarkers()).values()].filter( - (doc) => doc.personalKeyOnly + const marked = [...loadSummaries(workspaceKeyDenialMarkers()).values()].filter( + (doc) => doc.workspaceKeyUnsupported ) expect(marked.length).toBeGreaterThan(0) - expect(generatedSource().match(/personalKeyOnly: true/g)?.length ?? 0).toBe(marked.length) + expect(generatedSource().match(/workspaceKeyUnsupported: true/g)?.length ?? 0).toBe( + marked.length + ) }) it('marks restricted operations and leaves workspace-key-capable siblings alone', () => { const source = generatedSource() for (const name of ['listMcpServerTools', 'listSecrets', 'undeployWorkflow']) { - expect(generatedEntry(source, name)).toContain('personalKeyOnly: true') + expect(generatedEntry(source, name)).toContain('workspaceKeyUnsupported: true') } for (const name of ['listMcpServers', 'getMcpServer', 'listWorkflows']) { - expect(generatedEntry(source, name)).not.toContain('personalKeyOnly') + expect(generatedEntry(source, name)).not.toContain('workspaceKeyUnsupported') } }) }) diff --git a/scripts/generate-v2-cli-api.ts b/scripts/generate-v2-cli-api.ts index d8edc0e1f36..a1b2378e4e9 100644 --- a/scripts/generate-v2-cli-api.ts +++ b/scripts/generate-v2-cli-api.ts @@ -72,7 +72,7 @@ export interface OperationDoc { * Carried so `--help` can say so before the request goes out; without it the * caller learns the restriction from a `403` after the fact. */ - personalKeyOnly?: true + workspaceKeyUnsupported?: true } /** @@ -84,7 +84,7 @@ export interface OperationDoc { * resolves through the `@/` alias, which exists under `bun` but not under the * root `vitest` that imports this file's pure helpers. */ -export async function loadPersonalKeyMarkers(): Promise { +export async function loadWorkspaceKeyDenialMarkers(): Promise { const shared: Record = await import( path.join(ROOT, 'apps/sim/lib/api/contracts/v2/openapi/shared.ts') ) @@ -108,7 +108,9 @@ export async function loadPersonalKeyMarkers(): Promise { * `description` is read for the same reason — it is where the workspace-key * denial is already stated. */ -export function loadSummaries(personalKeyMarkers: readonly string[]): Map { +export function loadSummaries( + workspaceKeyDenialMarkers: readonly string[] +): Map { const docs = new Map() for (const file of specFiles()) { @@ -128,11 +130,11 @@ export function loadSummaries(personalKeyMarkers: readonly string[]): Map description.includes(marker)) + workspaceKeyDenialMarkers.some((marker) => description.includes(marker)) ) { - doc.personalKeyOnly = true + doc.workspaceKeyUnsupported = true } - if (doc.summary || doc.personalKeyOnly) { + if (doc.summary || doc.workspaceKeyUnsupported) { docs.set(`${method.toUpperCase()} ${specPath}`, doc) } } @@ -571,7 +573,7 @@ function render(operations: Operation[], docs: Map): strin out.push(" * `summary` is the operation's one-line description, lifted from the OpenAPI") out.push(' * specs so `--help` reuses prose that is already written and already checked.') out.push(' *') - out.push(' * `personalKeyOnly` marks an operation whose spec description says a workspace') + out.push(' * `workspaceKeyUnsupported` marks an operation whose spec says a workspace') out.push(' * API key is rejected, so `--help` can say so before the request is sent.') out.push(' */') out.push('export const V2_OPERATIONS = {') @@ -595,7 +597,7 @@ function render(operations: Operation[], docs: Map): strin `${op.contract.method} ${op.contract.path.replace(/\[([^\]]+)\]/g, '{$1}')}` ) if (doc?.summary) out.push(` summary: ${JSON.stringify(doc.summary)},`) - if (doc?.personalKeyOnly) out.push(` personalKeyOnly: true,`) + if (doc?.workspaceKeyUnsupported) out.push(` workspaceKeyUnsupported: true,`) for (const slot of ['query', 'body'] as const) { const map = renderSlotMap(op.contract[slot], ' ') if (map) out.push(` ${slot}: ${map},`) @@ -656,7 +658,7 @@ async function main() { const args = new Set(process.argv.slice(2)) const operations = await collectOperations() - const generated = format(render(operations, loadSummaries(await loadPersonalKeyMarkers()))) + const generated = format(render(operations, loadSummaries(await loadWorkspaceKeyDenialMarkers()))) if (args.has('--check')) { let current = '' diff --git a/scripts/openapi/documents.test.ts b/scripts/openapi/documents.test.ts index 4698b5f084e..242d70d9ca2 100644 --- a/scripts/openapi/documents.test.ts +++ b/scripts/openapi/documents.test.ts @@ -22,6 +22,7 @@ import { generateOpenApiDocument, serializeOpenApiDocument } from './generator' type JsonObject = Record const HTTP_METHODS = new Set(['get', 'post', 'put', 'patch', 'delete']) +const MAX_DESCRIPTION_WORDS = 80 const DOCUMENTS = [ workflowsOpenApiDocument, @@ -69,6 +70,26 @@ function operations(spec: JsonObject): JsonObject[] { return result } +function oversizedDescriptions(value: unknown, location: string, out: string[]): void { + if (!value || typeof value !== 'object') return + if (Array.isArray(value)) { + value.forEach((item, index) => oversizedDescriptions(item, `${location}[${index}]`, out)) + return + } + + for (const [key, nested] of Object.entries(value as JsonObject)) { + const nestedLocation = `${location}.${key}` + if (key === 'description' && typeof nested === 'string') { + const wordCount = nested.trim() ? nested.trim().split(/\s+/).length : 0 + if (wordCount > MAX_DESCRIPTION_WORDS) { + out.push(`${nestedLocation} (${wordCount} words)`) + } + continue + } + oversizedDescriptions(nested, nestedLocation, out) + } +} + function isStructuredObject(schema: JsonObject): boolean { return schema.type === 'object' || schema.properties !== undefined } @@ -152,6 +173,15 @@ function anonymousTopLevelResponseObjects(spec: JsonObject): string[] { } describe('generated OpenAPI documents', () => { + it('keeps every description concise without padding simple fields', () => { + const outliers: string[] = [] + for (const document of DOCUMENTS) { + oversizedDescriptions(generatedDocument(document), document.output, outliers) + } + + expect(outliers).toEqual([]) + }) + it('covers the complete public v2 operation surface with canonical errors', () => { const outputs = DOCUMENTS.map((document) => document.output) expect(new Set(outputs).size).toBe(DOCUMENTS.length) From 2c4bf1cf2bb6312165f1fe0f05c1c364eb7fa599 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 4 Sep 2026 18:42:55 -0700 Subject: [PATCH 06/31] fix(ui): refine OAuth consent and app revocation DX --- .../app/(auth)/oauth/consent/consent-view.tsx | 22 +++---------- apps/sim/app/(auth)/oauth/consent/page.tsx | 16 ++-------- .../authorized-apps/authorized-apps.tsx | 32 ++++++++++--------- apps/sim/hooks/queries/oauth-provider.ts | 1 - 4 files changed, 24 insertions(+), 47 deletions(-) diff --git a/apps/sim/app/(auth)/oauth/consent/consent-view.tsx b/apps/sim/app/(auth)/oauth/consent/consent-view.tsx index 88935021e90..1f3e10d18e8 100644 --- a/apps/sim/app/(auth)/oauth/consent/consent-view.tsx +++ b/apps/sim/app/(auth)/oauth/consent/consent-view.tsx @@ -1,6 +1,6 @@ 'use client' -import { Chip, cn } from '@sim/emcn' +import { Chip } from '@sim/emcn' import { Check } from '@sim/emcn/icons' import { getErrorMessage } from '@sim/utils/errors' import { signOut } from '@/lib/auth/auth-client' @@ -19,7 +19,6 @@ import { AUTH_BUTTON_CLASS } from '@/app/(auth)/components/constants' import { OAuthConsentLoading } from '@/app/(auth)/oauth/consent/loading' import { useOAuthConsent, useOAuthPublicClient } from '@/hooks/queries/oauth-provider' -/** Why the page refuses to render a grant, when it does. */ export type OAuthConsentRefusal = 'expired' | 'missing' | 'tampered' | 'unsigned' const REFUSAL_MESSAGES: Record = { @@ -81,15 +80,7 @@ export function OAuthConsentView({ const client = useOAuthPublicClient(clientId ?? undefined, authorizationRequestKey ?? undefined) const consent = useOAuthConsent() - /** - * No grant card without a client the server itself named. - * - * A failed lookup used to fall through to the fallback name and leave Allow - * enabled, so an unknown or deleted client still rendered a complete, - * clickable authorization — with everything on it read from the URL rather - * than from Sim. Naming the app is this page's whole job, so not being able - * to name it is a refusal, not a degraded heading. - */ + /** Refuses clients Sim cannot name because URL metadata alone is untrusted. */ const reason: OAuthConsentRefusal | null = refusal ?? (clientId ? null : 'missing') if (reason || client.isError) { return ( @@ -110,11 +101,7 @@ export function OAuthConsentView({ if (client.isPending) return const isCli = clientId === SIM_CLI_CLIENT_ID - /** - * The registered name the lookup returned, never the raw client id and never - * a name asserted by the URL: the id is what an impostor controls, so a - * client the server declines to name is one this card must not vouch for. - */ + /** Uses only the server-registered name; the client ID comes from the URL. */ const appName = client.data?.name?.trim() if (!appName) { return ( @@ -183,9 +170,10 @@ export function OAuthConsentView({ decide(false)} > Deny diff --git a/apps/sim/app/(auth)/oauth/consent/page.tsx b/apps/sim/app/(auth)/oauth/consent/page.tsx index f5df2298baa..f9bf5497a61 100644 --- a/apps/sim/app/(auth)/oauth/consent/page.tsx +++ b/apps/sim/app/(auth)/oauth/consent/page.tsx @@ -42,20 +42,8 @@ export default async function OAuthConsentPage({ } /** - * Two ways a request can reach this page without Sim having authorized it, - * both of which must refuse before anything is rendered. - * - * A repeated parameter is tampering, not a client quirk: the card names the - * app and lists what it may do, and it reads those from the URL, where - * `URLSearchParams.get` answers with the FIRST occurrence — so a link that - * prepends its own `client_id` and `scope` would show a trustworthy app and - * one harmless permission over somebody else's request. - * - * A missing `sig` means the query was never signed by the authorize - * endpoint, so the whole thing is hand-written. Consent still fails at Allow - * (the plugin refuses an unsigned `oauth_query`), but it fails with a - * generic error, after the person has already read an authorization request - * that Sim never issued. Both are caught here so the lie is never rendered. + * Repeated fields can make displayed consent diverge from the signed request; + * unsigned requests never passed through the authorization endpoint. */ const tampered = Object.entries(raw).some( ([key, value]) => key !== 'ba_param' && Array.isArray(value) diff --git a/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx b/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx index 3d58a741dad..8ab5da8c515 100644 --- a/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx +++ b/apps/sim/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps.tsx @@ -1,6 +1,6 @@ 'use client' -import { useMemo, useState } from 'react' +import { useState } from 'react' import { ChipConfirmModal, toast } from '@sim/emcn' import { getErrorMessage } from '@sim/utils/errors' import { formatDate } from '@sim/utils/formatting' @@ -27,23 +27,21 @@ export function AuthorizedApps() { const apps = useAuthorizedApps() const revoke = useRevokeAuthorizedApp() const [searchTerm, setSearchTerm] = useSettingsSearch() - const [pendingRevoke, setPendingRevoke] = useState(null) + const [pendingRevokeClientId, setPendingRevokeClientId] = useState(null) const list = apps.data ?? EMPTY_APPS - const filtered = useMemo(() => { - const term = searchTerm.trim().toLowerCase() - if (!term) return list - return list.filter((app) => app.name.toLowerCase().includes(term)) - }, [list, searchTerm]) + const pendingRevoke = list.find((app) => app.clientId === pendingRevokeClientId) ?? null + const term = searchTerm.trim().toLowerCase() + const filtered = term ? list.filter((app) => app.name.toLowerCase().includes(term)) : list const confirmRevoke = () => { - const app = pendingRevoke - if (!app) return - revoke.mutate(app.clientId, { - onSuccess: () => toast.success(`Revoked ${app.name}`), + if (!pendingRevokeClientId) return + const appName = pendingRevoke?.name ?? 'app' + revoke.mutate(pendingRevokeClientId, { + onSuccess: () => toast.success(`Revoked ${appName}`), onError: (error) => toast.error(getErrorMessage(error, 'Failed to revoke access')), /** Keep the modal open so its pending state remains visible through the mutation. */ - onSettled: () => setPendingRevoke(null), + onSettled: () => setPendingRevokeClientId(null), }) } @@ -82,7 +80,11 @@ export function AuthorizedApps() { setPendingRevoke(app) }, + { + label: 'Revoke', + destructive: true, + onSelect: () => setPendingRevokeClientId(app.clientId), + }, ]} /> } @@ -93,9 +95,9 @@ export function AuthorizedApps() { { - if (!open) setPendingRevoke(null) + if (!open) setPendingRevokeClientId(null) }} srTitle='Revoke access' title='Revoke access' diff --git a/apps/sim/hooks/queries/oauth-provider.ts b/apps/sim/hooks/queries/oauth-provider.ts index 184604b3d9c..f109950b33b 100644 --- a/apps/sim/hooks/queries/oauth-provider.ts +++ b/apps/sim/hooks/queries/oauth-provider.ts @@ -22,7 +22,6 @@ async function fetchAuthorizedApps(signal?: AbortSignal): Promise Date: Fri, 4 Sep 2026 18:45:39 -0700 Subject: [PATCH 07/31] fix(helm): bump chart for OAuth cleanup job --- helm/sim/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/sim/Chart.yaml b/helm/sim/Chart.yaml index b3d1464925c..80914ca33f9 100644 --- a/helm/sim/Chart.yaml +++ b/helm/sim/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: sim description: A Helm chart for Sim - the open-source AI workspace where teams build, deploy, and manage AI agents type: application -version: 1.9.0 +version: 1.9.1 appVersion: "v0.8.18" kubeVersion: ">=1.25.0-0" home: https://sim.ai From eda5e2180ad2242aecd420754d5105bd33e0c4bc Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 4 Sep 2026 18:50:48 -0700 Subject: [PATCH 08/31] fix(api): preserve concise table predicate guidance --- apps/sim/lib/api/contracts/tables.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/sim/lib/api/contracts/tables.ts b/apps/sim/lib/api/contracts/tables.ts index b52947711d5..7df259c36f4 100644 --- a/apps/sim/lib/api/contracts/tables.ts +++ b/apps/sim/lib/api/contracts/tables.ts @@ -504,12 +504,10 @@ const MAX_SORT_KEYS = 16 * it reaches the OpenAPI description of every endpoint taking a predicate. */ const PREDICATE_OPERATOR_GRAMMAR = [ - 'Comparison: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`.', - 'Membership: `in`, `nin` (array operand).', - 'Emptiness: `isEmpty`, `isNotEmpty`, `isNull`, `isNotNull` (no operand).', - 'Substring, always case-insensitive, operand matched literally: `contains`, `ncontains`, `startsWith`, `endsWith`.', - 'Pattern: `like`/`nlike` (case-sensitive), `ilike`/`nilike` (case-insensitive). **`*` is the only wildcard** and stands for any run of characters; `%`, `_`, and backslash match themselves. Use `like: "Hi*"`, not `like: "Hi%"`.', - 'A `select` column compares by option id and restricts its operators: single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names are accepted as operands and resolved to ids.', + 'Operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`; `in`/`nin` take arrays; `isEmpty`, `isNotEmpty`, `isNull`, and `isNotNull` take no operand.', + 'Text operators are `contains`, `ncontains`, `startsWith`, `endsWith`, `like`, `nlike`, `ilike`, and `nilike`. Contains variants are case-insensitive and literal; `like`/`nlike` are case-sensitive, while `ilike`/`nilike` are case-insensitive.', + '`*` is the only wildcard; `%`, `_`, and backslash are literal.', + 'For `select` columns, single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names resolve to IDs.', ].join(' ') /** @@ -611,8 +609,7 @@ const PREDICATE_LEAF_JSON_SCHEMA = { op: { type: 'string', enum: [...FILTER_OPS], - description: - 'Comparison operator. The `TablePredicate` schema description carries the grammar for all of them.', + description: PREDICATE_OPERATOR_GRAMMAR, }, value: { description: @@ -671,7 +668,7 @@ const predicateGroupsJsonSchema = (selfRef: string) => */ const PREDICATE_LIMITS_DESCRIPTION = `At most ${MAX_PREDICATE_GROUP_SIZE} members per group, ${MAX_PREDICATE_DEPTH} levels of nesting, and ${MAX_PREDICATE_NODES} nodes in total.` const PREDICATE_NEGATION_DESCRIPTION = - 'Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.' + 'The negating operators include nulls and absent cells, multi-select included. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.' const PREDICATE_TREE_DESCRIPTION = `Recursive non-empty \`all\`/\`any\` groups containing groups or conditions; the root cannot be a condition. ${PREDICATE_LIMITS_DESCRIPTION} ${PREDICATE_NEGATION_DESCRIPTION}` const PREDICATE_INPUT_DESCRIPTION = `One condition or a recursive \`all\`/\`any\` group, normalized to a grouped predicate. ${PREDICATE_LIMITS_DESCRIPTION} ${PREDICATE_NEGATION_DESCRIPTION}` From 11a93f12fad99412b82989430ce153b80040815e Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 4 Sep 2026 18:51:09 -0700 Subject: [PATCH 09/31] docs(api): regenerate table predicate specification --- apps/docs/openapi-v2-tables.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/docs/openapi-v2-tables.json b/apps/docs/openapi-v2-tables.json index 42b4fea7be9..79f25b677a6 100644 --- a/apps/docs/openapi-v2-tables.json +++ b/apps/docs/openapi-v2-tables.json @@ -6098,7 +6098,7 @@ }, "TablePredicate": { "title": "Table predicate", - "description": "Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.", + "description": "Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls and absent cells, multi-select included. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.", "type": "object", "oneOf": [ { @@ -6151,7 +6151,7 @@ "isNull", "isNotNull" ], - "description": "Comparison operator. The `TablePredicate` schema description carries the grammar for all of them." + "description": "Operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`; `in`/`nin` take arrays; `isEmpty`, `isNotEmpty`, `isNull`, and `isNotNull` take no operand. Text operators are `contains`, `ncontains`, `startsWith`, `endsWith`, `like`, `nlike`, `ilike`, and `nilike`. Contains variants are case-insensitive and literal; `like`/`nlike` are case-sensitive, while `ilike`/`nilike` are case-insensitive. `*` is the only wildcard; `%`, `_`, and backslash are literal. For `select` columns, single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names resolve to IDs." }, "value": { "description": "Operand. A scalar for the comparison operators, an array of at most 1000 entries for `in`/`nin`, a pattern for the matching operators, and omitted for `isEmpty`/`isNotEmpty`/`isNull`/`isNotNull`." @@ -6217,7 +6217,7 @@ "isNull", "isNotNull" ], - "description": "Comparison operator. The `TablePredicate` schema description carries the grammar for all of them." + "description": "Operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`; `in`/`nin` take arrays; `isEmpty`, `isNotEmpty`, `isNull`, and `isNotNull` take no operand. Text operators are `contains`, `ncontains`, `startsWith`, `endsWith`, `like`, `nlike`, `ilike`, and `nilike`. Contains variants are case-insensitive and literal; `like`/`nlike` are case-sensitive, while `ilike`/`nilike` are case-insensitive. `*` is the only wildcard; `%`, `_`, and backslash are literal. For `select` columns, single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names resolve to IDs." }, "value": { "description": "Operand. A scalar for the comparison operators, an array of at most 1000 entries for `in`/`nin`, a pattern for the matching operators, and omitted for `isEmpty`/`isNotEmpty`/`isNull`/`isNotNull`." @@ -6512,7 +6512,7 @@ }, "TablePredicateInput": { "title": "Table predicate input", - "description": "One condition or a recursive `all`/`any` group, normalized to a grouped predicate. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.", + "description": "One condition or a recursive `all`/`any` group, normalized to a grouped predicate. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls and absent cells, multi-select included. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.", "oneOf": [ { "type": "object", @@ -6564,7 +6564,7 @@ "isNull", "isNotNull" ], - "description": "Comparison operator. The `TablePredicate` schema description carries the grammar for all of them." + "description": "Operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`; `in`/`nin` take arrays; `isEmpty`, `isNotEmpty`, `isNull`, and `isNotNull` take no operand. Text operators are `contains`, `ncontains`, `startsWith`, `endsWith`, `like`, `nlike`, `ilike`, and `nilike`. Contains variants are case-insensitive and literal; `like`/`nlike` are case-sensitive, while `ilike`/`nilike` are case-insensitive. `*` is the only wildcard; `%`, `_`, and backslash are literal. For `select` columns, single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names resolve to IDs." }, "value": { "description": "Operand. A scalar for the comparison operators, an array of at most 1000 entries for `in`/`nin`, a pattern for the matching operators, and omitted for `isEmpty`/`isNotEmpty`/`isNull`/`isNotNull`." @@ -6630,7 +6630,7 @@ "isNull", "isNotNull" ], - "description": "Comparison operator. The `TablePredicate` schema description carries the grammar for all of them." + "description": "Operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`; `in`/`nin` take arrays; `isEmpty`, `isNotEmpty`, `isNull`, and `isNotNull` take no operand. Text operators are `contains`, `ncontains`, `startsWith`, `endsWith`, `like`, `nlike`, `ilike`, and `nilike`. Contains variants are case-insensitive and literal; `like`/`nlike` are case-sensitive, while `ilike`/`nilike` are case-insensitive. `*` is the only wildcard; `%`, `_`, and backslash are literal. For `select` columns, single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names resolve to IDs." }, "value": { "description": "Operand. A scalar for the comparison operators, an array of at most 1000 entries for `in`/`nin`, a pattern for the matching operators, and omitted for `isEmpty`/`isNotEmpty`/`isNull`/`isNotNull`." @@ -6681,7 +6681,7 @@ "isNull", "isNotNull" ], - "description": "Comparison operator. The `TablePredicate` schema description carries the grammar for all of them." + "description": "Operators: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`; `in`/`nin` take arrays; `isEmpty`, `isNotEmpty`, `isNull`, and `isNotNull` take no operand. Text operators are `contains`, `ncontains`, `startsWith`, `endsWith`, `like`, `nlike`, `ilike`, and `nilike`. Contains variants are case-insensitive and literal; `like`/`nlike` are case-sensitive, while `ilike`/`nilike` are case-insensitive. `*` is the only wildcard; `%`, `_`, and backslash are literal. For `select` columns, single-select accepts `eq`, `ne`, `in`, `nin`; multi-select accepts `contains`, `ncontains`. Option names resolve to IDs." }, "value": { "description": "Operand. A scalar for the comparison operators, an array of at most 1000 entries for `in`/`nin`, a pattern for the matching operators, and omitted for `isEmpty`/`isNotEmpty`/`isNull`/`isNotNull`." From e9ed221cafb996758676e59739b6cb12ca98dedf Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 4 Sep 2026 18:53:47 -0700 Subject: [PATCH 10/31] fix(api): retain predicate DX across clients --- apps/docs/openapi-v2-tables.json | 4 ++-- apps/sim/lib/api/contracts/tables.ts | 10 ++++++---- packages/sim-cli/src/generated/v2-api.ts | 14 +++++++------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/apps/docs/openapi-v2-tables.json b/apps/docs/openapi-v2-tables.json index 79f25b677a6..d32fc5f75d8 100644 --- a/apps/docs/openapi-v2-tables.json +++ b/apps/docs/openapi-v2-tables.json @@ -6098,7 +6098,7 @@ }, "TablePredicate": { "title": "Table predicate", - "description": "Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls and absent cells, multi-select included. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.", + "description": "Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. Limits: 100 members per group, 10 levels, and 500 nodes. The negating operators include nulls and absent cells, multi-select included; combine with `isNotNull` or `isNotEmpty` to exclude them. Pattern operators use `*` as the only wildcard; `%`, `_`, and backslash are literal. Select operators: single-select uses `eq`/`ne`/`in`/`nin`; multi-select uses `contains`/`ncontains`; option names resolve to IDs. Full operand rules are documented on `op`.", "type": "object", "oneOf": [ { @@ -6512,7 +6512,7 @@ }, "TablePredicateInput": { "title": "Table predicate input", - "description": "One condition or a recursive `all`/`any` group, normalized to a grouped predicate. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. The negating operators include nulls and absent cells, multi-select included. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.", + "description": "One condition or a recursive `all`/`any` group, normalized to a grouped predicate. Limits: 100 members per group, 10 levels, and 500 nodes. The negating operators include nulls and absent cells, multi-select included; combine with `isNotNull` or `isNotEmpty` to exclude them. Pattern operators use `*` as the only wildcard; `%`, `_`, and backslash are literal. Select operators: single-select uses `eq`/`ne`/`in`/`nin`; multi-select uses `contains`/`ncontains`; option names resolve to IDs. Full operand rules are documented on `op`.", "oneOf": [ { "type": "object", diff --git a/apps/sim/lib/api/contracts/tables.ts b/apps/sim/lib/api/contracts/tables.ts index 7df259c36f4..91b0409c2b2 100644 --- a/apps/sim/lib/api/contracts/tables.ts +++ b/apps/sim/lib/api/contracts/tables.ts @@ -666,11 +666,13 @@ const predicateGroupsJsonSchema = (selfRef: string) => * false and the negation true — the same include-nulls behaviour as every other * negation. Pinned by `__tests__/sql.test.ts`. */ -const PREDICATE_LIMITS_DESCRIPTION = `At most ${MAX_PREDICATE_GROUP_SIZE} members per group, ${MAX_PREDICATE_DEPTH} levels of nesting, and ${MAX_PREDICATE_NODES} nodes in total.` +const PREDICATE_LIMITS_DESCRIPTION = `Limits: ${MAX_PREDICATE_GROUP_SIZE} members per group, ${MAX_PREDICATE_DEPTH} levels, and ${MAX_PREDICATE_NODES} nodes.` const PREDICATE_NEGATION_DESCRIPTION = - 'The negating operators include nulls and absent cells, multi-select included. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.' -const PREDICATE_TREE_DESCRIPTION = `Recursive non-empty \`all\`/\`any\` groups containing groups or conditions; the root cannot be a condition. ${PREDICATE_LIMITS_DESCRIPTION} ${PREDICATE_NEGATION_DESCRIPTION}` -const PREDICATE_INPUT_DESCRIPTION = `One condition or a recursive \`all\`/\`any\` group, normalized to a grouped predicate. ${PREDICATE_LIMITS_DESCRIPTION} ${PREDICATE_NEGATION_DESCRIPTION}` + 'The negating operators include nulls and absent cells, multi-select included; combine with `isNotNull` or `isNotEmpty` to exclude them.' +const PREDICATE_OPERATOR_SUMMARY = + 'Pattern operators use `*` as the only wildcard; `%`, `_`, and backslash are literal. Select operators: single-select uses `eq`/`ne`/`in`/`nin`; multi-select uses `contains`/`ncontains`; option names resolve to IDs. Full operand rules are documented on `op`.' +const PREDICATE_TREE_DESCRIPTION = `Recursive non-empty \`all\`/\`any\` groups containing groups or conditions; the root cannot be a condition. ${PREDICATE_LIMITS_DESCRIPTION} ${PREDICATE_NEGATION_DESCRIPTION} ${PREDICATE_OPERATOR_SUMMARY}` +const PREDICATE_INPUT_DESCRIPTION = `One condition or a recursive \`all\`/\`any\` group, normalized to a grouped predicate. ${PREDICATE_LIMITS_DESCRIPTION} ${PREDICATE_NEGATION_DESCRIPTION} ${PREDICATE_OPERATOR_SUMMARY}` /** * The canonical grouped predicate schema for dual-grammar boundaries. Keeping diff --git a/packages/sim-cli/src/generated/v2-api.ts b/packages/sim-cli/src/generated/v2-api.ts index 992e24b672a..4df6055d02b 100644 --- a/packages/sim-cli/src/generated/v2-api.ts +++ b/packages/sim-cli/src/generated/v2-api.ts @@ -9814,7 +9814,7 @@ export const V2_OPERATIONS = { filter: { kind: 'unknown', describe: - 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', + 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. Limits: 100 members per group, 10 levels, and 500 nodes. The negating operators include nulls and absent cells, multi-select included; combine with `isNotNull` or `isNotEmpty` to exclude them. Pattern operators use `*` as the only wildcard; `%`, `_`, and backslash are literal. Select operators: single-select uses `eq`/`ne`/`in`/`nin`; multi-select uses `contains`/`ncontains`; option names resolve to IDs. Full operand rules are documented on `op`.', }, excludeRowIds: { kind: 'array', describe: 'Rows excluded from an all-scope cancellation.' }, }, @@ -10505,7 +10505,7 @@ export const V2_OPERATIONS = { filter: { kind: 'unknown', describe: - 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', + 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. Limits: 100 members per group, 10 levels, and 500 nodes. The negating operators include nulls and absent cells, multi-select included; combine with `isNotNull` or `isNotEmpty` to exclude them. Pattern operators use `*` as the only wildcard; `%`, `_`, and backslash are literal. Select operators: single-select uses `eq`/`ne`/`in`/`nin`; multi-select uses `contains`/`ncontains`; option names resolve to IDs. Full operand rules are documented on `op`.', }, excludeRowIds: { kind: 'array', describe: 'Rows excluded from a select-all run scope.' }, limit: { kind: 'object', describe: 'Optional cap on eligible rows to run.' }, @@ -11049,7 +11049,7 @@ export const V2_OPERATIONS = { filter: { kind: 'unknown', describe: - 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', + 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. Limits: 100 members per group, 10 levels, and 500 nodes. The negating operators include nulls and absent cells, multi-select included; combine with `isNotNull` or `isNotEmpty` to exclude them. Pattern operators use `*` as the only wildcard; `%`, `_`, and backslash are literal. Select operators: single-select uses `eq`/`ne`/`in`/`nin`; multi-select uses `contains`/`ncontains`; option names resolve to IDs. Full operand rules are documented on `op`.', }, limit: { kind: 'integer', describe: 'Maximum matching rows to delete.' }, rowIds: { kind: 'array', describe: 'Explicit row identifiers to delete.' }, @@ -13599,7 +13599,7 @@ export const V2_OPERATIONS = { predicate: { kind: 'unknown', describe: - 'One condition or a recursive `all`/`any` group, normalized to a grouped predicate. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', + 'One condition or a recursive `all`/`any` group, normalized to a grouped predicate. Limits: 100 members per group, 10 levels, and 500 nodes. The negating operators include nulls and absent cells, multi-select included; combine with `isNotNull` or `isNotEmpty` to exclude them. Pattern operators use `*` as the only wildcard; `%`, `_`, and backslash are literal. Select operators: single-select uses `eq`/`ne`/`in`/`nin`; multi-select uses `contains`/`ncontains`; option names resolve to IDs. Full operand rules are documented on `op`.', }, sort: { kind: 'array', describe: 'Ordered table-row sort specification.' }, limit: { @@ -13627,7 +13627,7 @@ export const V2_OPERATIONS = { predicate: { kind: 'unknown', describe: - 'One condition or a recursive `all`/`any` group, normalized to a grouped predicate. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', + 'One condition or a recursive `all`/`any` group, normalized to a grouped predicate. Limits: 100 members per group, 10 levels, and 500 nodes. The negating operators include nulls and absent cells, multi-select included; combine with `isNotNull` or `isNotEmpty` to exclude them. Pattern operators use `*` as the only wildcard; `%`, `_`, and backslash are literal. Select operators: single-select uses `eq`/`ne`/`in`/`nin`; multi-select uses `contains`/`ncontains`; option names resolve to IDs. Full operand rules are documented on `op`.', }, }, }, @@ -14102,7 +14102,7 @@ export const V2_OPERATIONS = { predicate: { kind: 'unknown', describe: - 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', + 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. Limits: 100 members per group, 10 levels, and 500 nodes. The negating operators include nulls and absent cells, multi-select included; combine with `isNotNull` or `isNotEmpty` to exclude them. Pattern operators use `*` as the only wildcard; `%`, `_`, and backslash are literal. Select operators: single-select uses `eq`/`ne`/`in`/`nin`; multi-select uses `contains`/`ncontains`; option names resolve to IDs. Full operand rules are documented on `op`.', }, sort: { kind: 'array', describe: 'Ordered table-row sort specification.' }, }, @@ -14562,7 +14562,7 @@ export const V2_OPERATIONS = { kind: 'unknown', required: true, describe: - 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. At most 100 members per group, 10 levels of nesting, and 500 nodes in total. Negating operators include null or absent cells. Combine them with `isNotNull`, or `isNotEmpty` for multi-select, to exclude nulls. Operator-specific operands and wildcard rules are documented on `op`.', + 'Recursive non-empty `all`/`any` groups containing groups or conditions; the root cannot be a condition. Limits: 100 members per group, 10 levels, and 500 nodes. The negating operators include nulls and absent cells, multi-select included; combine with `isNotNull` or `isNotEmpty` to exclude them. Pattern operators use `*` as the only wildcard; `%`, `_`, and backslash are literal. Select operators: single-select uses `eq`/`ne`/`in`/`nin`; multi-select uses `contains`/`ncontains`; option names resolve to IDs. Full operand rules are documented on `op`.', }, data: { kind: 'object', From 93fd43ba258d7e13b61d65ceea1d0dec0ebc20b3 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 13:07:20 -0700 Subject: [PATCH 11/31] feat(scim): SCIM 2.0 directory provisioning with group-to-access projection Adds a SCIM 2.0 service provider so an organization's identity provider (Okta, Microsoft Entra ID, OneLogin, JumpCloud) can create, update, deactivate, and remove members, and map pushed groups onto permission groups, workspace access, and the organization admin role. Protocol surface (`/api/scim/v2`) - Users and Groups: list with `eq`/`and` filters and paging, get, create, replace, patch, delete; discovery documents for ServiceProviderConfig, ResourceTypes, and Schemas. - A dedicated `defineScimRoute` builder: bearer authentication to a new `scim_connection` principal, per-connection rate limit, RFC 7644 error envelope, `application/scim+json`, 415 on wrong media type. - Tolerances for what providers actually send: Entra's capitalized ops and string booleans, one-element arrays, path-less dotted-key replaces, and filtered email paths that create their target; Okta's path-less `replace {active:false}` and filtered member removal. Identity and safety - Never links by unverified email: resolution is tombstone by externalId, then verified-domain email within this organization, then create. - Every create and email change is refused outside the organization's verified domains, closing the SCIM account-takeover shape. - Deactivation is a new reversible `user.suspendedAt` state, enforced at session creation and both API-key auth paths. It is deliberately not `banned`, which archives owned workspaces and cannot be undone. - The organization owner cannot be deprovisioned; seats are validated with the same policy as SSO admission. Projection - Every grant SCIM makes is recorded, so withdrawing group access touches only what the directory granted and never a manual grant. - Permission groups gain `membershipMode: 'explicit'` so a directory-managed group governs nobody when empty instead of widening to everyone. - An hourly reconcile sweep re-applies mappings idempotently. Shared primitives extracted from routes so UI and SCIM share one implementation: per-user session revocation (with security-version bump), personal API-key revocation, suspend/unsuspend, member role change, workspace access grant/revoke, permission-group add/remove member. The member role route now uses the role-change primitive under the org lock. Admin surface under `/api/organizations/[id]/scim`: connection settings, credential issue/revoke (two active for rotation, digest-only storage), group mappings, activity log, on-demand reconcile. Migration 0323 is expand-only: nine new tables plus nullable/defaulted columns on `user` and `permission_group`. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01JVf3fLVj7iWzED7L2wQvhG --- .../docs/platform/enterprise/meta.json | 1 + .../content/docs/platform/enterprise/scim.mdx | 184 + .../content/docs/platform/enterprise/sso.mdx | 4 +- apps/docs/openapi-v2-billing.json | 2 +- apps/docs/openapi-v2-files-audit.json | 2 +- apps/docs/openapi-v2-knowledge.json | 2 +- apps/docs/openapi-v2-logs.json | 2 +- apps/docs/openapi-v2-resources.json | 2 +- apps/docs/openapi-v2-tables.json | 2 +- apps/docs/openapi-v2-workflows.json | 2 +- apps/sim/app/api/cron/scim-reconcile/route.ts | 31 + apps/sim/app/api/files/uploads/purposes.ts | 5 + .../[id]/members/[memberId]/route.ts | 53 +- .../organizations/[id]/scim/activity/route.ts | 24 + .../scim/credentials/[credentialId]/route.ts | 21 + .../[id]/scim/credentials/route.ts | 26 + .../[id]/scim/mappings/[mappingId]/route.ts | 18 + .../organizations/[id]/scim/mappings/route.ts | 38 + .../[id]/scim/reconcile/route.ts | 27 + .../app/api/organizations/[id]/scim/route.ts | 48 + apps/sim/app/api/scim/v2/Groups/[id]/route.ts | 58 + apps/sim/app/api/scim/v2/Groups/route.ts | 34 + .../api/scim/v2/ResourceTypes/[id]/route.ts | 12 + .../app/api/scim/v2/ResourceTypes/route.ts | 4 + .../sim/app/api/scim/v2/Schemas/[id]/route.ts | 12 + apps/sim/app/api/scim/v2/Schemas/route.ts | 4 + .../scim/v2/ServiceProviderConfig/route.ts | 5 + apps/sim/app/api/scim/v2/Users/[id]/route.ts | 55 + apps/sim/app/api/scim/v2/Users/route.ts | 41 + apps/sim/lib/api-key/service.ts | 9 + .../lib/api/contracts/organization-scim.ts | 207 + apps/sim/lib/api/contracts/scim.ts | 310 + apps/sim/lib/api/contracts/workspaces.ts | 1 + apps/sim/lib/api/server/routes/scim-route.ts | 311 + .../lib/api/server/routes/v2-api-key-auth.ts | 7 + apps/sim/lib/auth/auth.ts | 33 +- apps/sim/lib/compare/data/sim.ts | 9 +- apps/sim/lib/core/application/forbidden.ts | 4 + apps/sim/lib/core/application/operation.ts | 12 +- .../application/workspace-authorization.ts | 1 + apps/sim/lib/core/config/deployment-shape.ts | 2 + .../core/config/enterprise-entitlements.ts | 2 + apps/sim/lib/core/config/env-flags.ts | 13 + apps/sim/lib/core/config/env.ts | 3 + .../lib/execution/sandbox/bundles/docx.cjs | 38 +- .../execution/sandbox/bundles/pptxgenjs.cjs | 34 +- .../lib/invitations/workspace-invitations.ts | 14 +- .../lib/organizations/members/lifecycle.ts | 207 + .../application/group-membership.ts | 257 + .../lib/permission-groups/resolve.server.ts | 15 +- apps/sim/lib/posthog/events.ts | 6 + .../application/admin/manage-connection.ts | 751 + .../authorized-scim-admin-use-case.ts | 96 + .../application/authorized-scim-use-case.ts | 187 + .../scim/application/groups/manage-groups.ts | 405 + apps/sim/lib/scim/application/operations.ts | 216 + .../application/users/deprovision-user.ts | 154 + .../scim/application/users/provision-user.ts | 246 + .../lib/scim/application/users/read-users.ts | 105 + .../lib/scim/application/users/update-user.ts | 258 + apps/sim/lib/scim/authenticate.ts | 183 + apps/sim/lib/scim/identity/resolve-user.ts | 182 + apps/sim/lib/scim/managed-membership.ts | 111 + .../sim/lib/scim/projection/reconcile-user.ts | 420 + apps/sim/lib/scim/protocol/canonical.test.ts | 130 + apps/sim/lib/scim/protocol/canonical.ts | 196 + apps/sim/lib/scim/protocol/constants.ts | 56 + apps/sim/lib/scim/protocol/discovery.ts | 175 + apps/sim/lib/scim/protocol/errors.ts | 145 + apps/sim/lib/scim/protocol/filter.test.ts | 96 + apps/sim/lib/scim/protocol/filter.ts | 204 + .../sim/lib/scim/protocol/group-patch.test.ts | 102 + apps/sim/lib/scim/protocol/group-patch.ts | 155 + apps/sim/lib/scim/protocol/normalize.ts | 106 + apps/sim/lib/scim/protocol/resources.test.ts | 119 + apps/sim/lib/scim/protocol/resources.ts | 263 + apps/sim/lib/scim/protocol/user-patch.test.ts | 196 + apps/sim/lib/scim/protocol/user-patch.ts | 308 + apps/sim/lib/scim/reconcile/job.ts | 182 + apps/sim/lib/scim/repository/groups.ts | 221 + apps/sim/lib/scim/repository/users.ts | 254 + apps/sim/lib/scim/request-log.ts | 57 + apps/sim/lib/scim/route.ts | 18 + .../sim/lib/uploads/upload-session/service.ts | 5 + .../application/run-workflow-from-copilot.ts | 1 + .../lib/workspaces/access/workspace-access.ts | 137 + docker/crontab | 3 + helm/sim/values.yaml | 12 + packages/audit/src/types.ts | 22 + packages/auth/src/principal.ts | 38 + .../db/migrations/0323_scim_provisioning.sql | 153 + .../db/migrations/meta/0323_snapshot.json | 22964 ++++++++++++++++ packages/db/migrations/meta/_journal.json | 7 + packages/db/schema.ts | 423 + packages/testing/src/mocks/env-flags.mock.ts | 2 + packages/testing/src/mocks/schema.mock.ts | 99 + scripts/check-api-validation-contracts.ts | 15 +- scripts/check-route-verbs.ts | 1 + 98 files changed, 32321 insertions(+), 72 deletions(-) create mode 100644 apps/docs/content/docs/platform/enterprise/scim.mdx create mode 100644 apps/sim/app/api/cron/scim-reconcile/route.ts create mode 100644 apps/sim/app/api/organizations/[id]/scim/activity/route.ts create mode 100644 apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts create mode 100644 apps/sim/app/api/organizations/[id]/scim/credentials/route.ts create mode 100644 apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts create mode 100644 apps/sim/app/api/organizations/[id]/scim/mappings/route.ts create mode 100644 apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts create mode 100644 apps/sim/app/api/organizations/[id]/scim/route.ts create mode 100644 apps/sim/app/api/scim/v2/Groups/[id]/route.ts create mode 100644 apps/sim/app/api/scim/v2/Groups/route.ts create mode 100644 apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts create mode 100644 apps/sim/app/api/scim/v2/ResourceTypes/route.ts create mode 100644 apps/sim/app/api/scim/v2/Schemas/[id]/route.ts create mode 100644 apps/sim/app/api/scim/v2/Schemas/route.ts create mode 100644 apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts create mode 100644 apps/sim/app/api/scim/v2/Users/[id]/route.ts create mode 100644 apps/sim/app/api/scim/v2/Users/route.ts create mode 100644 apps/sim/lib/api/contracts/organization-scim.ts create mode 100644 apps/sim/lib/api/contracts/scim.ts create mode 100644 apps/sim/lib/api/server/routes/scim-route.ts create mode 100644 apps/sim/lib/organizations/members/lifecycle.ts create mode 100644 apps/sim/lib/permission-groups/application/group-membership.ts create mode 100644 apps/sim/lib/scim/application/admin/manage-connection.ts create mode 100644 apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts create mode 100644 apps/sim/lib/scim/application/authorized-scim-use-case.ts create mode 100644 apps/sim/lib/scim/application/groups/manage-groups.ts create mode 100644 apps/sim/lib/scim/application/operations.ts create mode 100644 apps/sim/lib/scim/application/users/deprovision-user.ts create mode 100644 apps/sim/lib/scim/application/users/provision-user.ts create mode 100644 apps/sim/lib/scim/application/users/read-users.ts create mode 100644 apps/sim/lib/scim/application/users/update-user.ts create mode 100644 apps/sim/lib/scim/authenticate.ts create mode 100644 apps/sim/lib/scim/identity/resolve-user.ts create mode 100644 apps/sim/lib/scim/managed-membership.ts create mode 100644 apps/sim/lib/scim/projection/reconcile-user.ts create mode 100644 apps/sim/lib/scim/protocol/canonical.test.ts create mode 100644 apps/sim/lib/scim/protocol/canonical.ts create mode 100644 apps/sim/lib/scim/protocol/constants.ts create mode 100644 apps/sim/lib/scim/protocol/discovery.ts create mode 100644 apps/sim/lib/scim/protocol/errors.ts create mode 100644 apps/sim/lib/scim/protocol/filter.test.ts create mode 100644 apps/sim/lib/scim/protocol/filter.ts create mode 100644 apps/sim/lib/scim/protocol/group-patch.test.ts create mode 100644 apps/sim/lib/scim/protocol/group-patch.ts create mode 100644 apps/sim/lib/scim/protocol/normalize.ts create mode 100644 apps/sim/lib/scim/protocol/resources.test.ts create mode 100644 apps/sim/lib/scim/protocol/resources.ts create mode 100644 apps/sim/lib/scim/protocol/user-patch.test.ts create mode 100644 apps/sim/lib/scim/protocol/user-patch.ts create mode 100644 apps/sim/lib/scim/reconcile/job.ts create mode 100644 apps/sim/lib/scim/repository/groups.ts create mode 100644 apps/sim/lib/scim/repository/users.ts create mode 100644 apps/sim/lib/scim/request-log.ts create mode 100644 apps/sim/lib/scim/route.ts create mode 100644 apps/sim/lib/workspaces/access/workspace-access.ts create mode 100644 packages/db/migrations/0323_scim_provisioning.sql create mode 100644 packages/db/migrations/meta/0323_snapshot.json diff --git a/apps/docs/content/docs/platform/enterprise/meta.json b/apps/docs/content/docs/platform/enterprise/meta.json index 48e14db8d21..8b095acff3a 100644 --- a/apps/docs/content/docs/platform/enterprise/meta.json +++ b/apps/docs/content/docs/platform/enterprise/meta.json @@ -4,6 +4,7 @@ "index", "self-hosted", "sso", + "scim", "verified-domains", "session-policies", "access-control", diff --git a/apps/docs/content/docs/platform/enterprise/scim.mdx b/apps/docs/content/docs/platform/enterprise/scim.mdx new file mode 100644 index 00000000000..bc8c16779e6 --- /dev/null +++ b/apps/docs/content/docs/platform/enterprise/scim.mdx @@ -0,0 +1,184 @@ +--- +title: Directory provisioning (SCIM) +description: Create, update, and deactivate Sim members automatically from your identity provider +--- + +import { Callout } from 'fumadocs-ui/components/callout' +import { Step, Steps } from 'fumadocs-ui/components/steps' +import { Tab, Tabs } from 'fumadocs-ui/components/tabs' + +Directory provisioning connects your identity provider to Sim over SCIM 2.0. Your provider creates members when someone joins, updates them when their details change, and deactivates them the moment they leave — without anyone touching Sim. + +It pairs with [SSO](/platform/enterprise/sso). SSO proves who someone is when they sign in. Directory provisioning decides who exists and what they can reach, before and after that. + + + Enterprise plans. Requires at least one [verified domain](/platform/enterprise/verified-domains) for your organization. + + +## What it does + +| Your provider does this | Sim does this | +| --- | --- | +| Assigns a person to the Sim app | Creates their account and adds them to your organization as a Member | +| Updates their name or email | Updates the Sim account, and ends their sessions if the address changed | +| Deactivates them | Blocks sign-in, stops their API keys, and withdraws directory-granted access. Everything they own is left untouched | +| Reactivates them | Restores access exactly as it was | +| Removes them from the app | Removes their organization membership and reassigns what they owned | +| Adds them to a group | Grants whatever that group maps to | + +Deactivation is reversible and never destructive. Someone on leave keeps their workflows, their credentials, and their workspace history; they simply cannot sign in. + +## Turn it on + + + + +### Verify your domain + +Sim only provisions people whose email is in a domain your organization has verified. See [Verified domains](/platform/enterprise/verified-domains). + +This is what stops another tenant's directory from claiming an address it does not own. + + + +### Enable directory provisioning + +In **Settings → SSO → Directory provisioning**, turn it on. Sim shows your SCIM base URL: + +``` +https:///api/scim/v2 +``` + + + +### Issue a credential + +Select **Issue credential**. The token appears once — copy it straight into your provider. + +Two credentials can be active at a time, so you can rotate without downtime: issue the new one, update your provider, confirm a sync succeeds, then revoke the old one. + + + +### Configure your provider + + + + +In your Okta app, open **Provisioning → Integration** and select **Configure API Integration**. + +- **SCIM connector base URL**: `https:///api/scim/v2` +- **Unique identifier field for users**: `userName` +- **Supported provisioning actions**: Push New Users, Push Profile Updates, Push Groups +- **Authentication Mode**: HTTP Header, with your Sim credential as the token + +Select **Test API Credentials**, then save. Under **Provisioning → To App**, enable Create Users, Update User Attributes, and Deactivate Users. + +Okta never deletes users over SCIM. Unassigning someone, or deactivating them in Okta, sends a deactivation — which Sim applies as a suspension. + + + + +In your enterprise application, open **Provisioning** and set Provisioning Mode to **Automatic**. + +- **Tenant URL**: `https:///api/scim/v2` +- **Secret Token**: your Sim credential + +Select **Test Connection**, then save and start provisioning. + +Entra runs an initial cycle over everyone in scope, then incremental cycles roughly every 40 minutes. Removing someone from the app sends a deactivation; a permanent delete in Entra sends a removal about 30 days later. + + + + +Add a **SCIM Provisioner with SAML** app. + +- **SCIM Base URL**: `https:///api/scim/v2` +- **SCIM Bearer Token**: your Sim credential + +Enable provisioning and choose what happens when a user is removed. Suspend maps to a Sim suspension; Delete removes their membership. + + + + +Add a **Custom SCIM** identity management integration. + +- **Base URL**: `https:///api/scim/v2` +- **Token Key**: your Sim credential + +Enable group sync if you plan to map groups. + + + + + + +### Map your groups + +Groups mean nothing to Sim until you say what they stand for. In **Settings → SSO → Directory provisioning → Group mappings**, point each pushed group at one or more of: + +- a **permission group**, which governs models, integrations, and capabilities +- a **workspace**, at Read, Write, or Admin +- the **organization admin role** + +A group can carry several mappings. When two groups grant the same workspace at different levels, the stronger one wins. + + + + + +## How access is withdrawn + +Sim records every grant it makes on your behalf. When someone leaves a group, only what the directory granted is taken back — access a workspace administrator granted by hand stays. + +The one exception is **managed membership locking**, which is on by default. With it on, the directory is the source of truth: Sim refuses invitations, role changes, and manual grants for provisioned members, because the next sync would revert them anyway. Turn it off if you want to layer manual access on top of directory access. + +## Provisioning and SSO together + +A member the directory created can sign in with SSO immediately; the two resolve to the same account through your verified domain. + +If you want the directory to be the only way in, enable **Disable just-in-time provisioning** in the connection settings. Sim then refuses to create membership for someone signing in who was never provisioned. + +## Watching a sync + +**Settings → SSO → Directory provisioning → Activity** lists recent requests with their status and, for a failure, what was wrong. Providers report a failed cycle without saying what they sent, so this is usually the fastest way to see the cause. + +Sim also re-applies every group mapping on a schedule, so drift cannot persist. You can run it on demand with **Reconcile now**. + +## Reference + +- Base URL: `https:///api/scim/v2` +- Authentication: `Authorization: Bearer ` +- Resources: `/Users`, `/Groups`, plus `/ServiceProviderConfig`, `/ResourceTypes`, and `/Schemas` +- Filters: `eq`, joined with `and`, on `userName`, `externalId`, `emails.value`, and `displayName` +- Page size: up to 100 per request + + diff --git a/apps/docs/content/docs/platform/enterprise/sso.mdx b/apps/docs/content/docs/platform/enterprise/sso.mdx index e520282b8a9..79b4e87851e 100644 --- a/apps/docs/content/docs/platform/enterprise/sso.mdx +++ b/apps/docs/content/docs/platform/enterprise/sso.mdx @@ -278,7 +278,7 @@ With **Automatic** provisioning, no invitation is required for organization memb Sign-in must start from Sim. Launching from your identity provider's app portal (Microsoft's **My Apps**, Okta's dashboard tile) sends an unsolicited assertion, which Sim rejects. This is deliberate — accepting them would let anyone replay an assertion into your tenant — but it means an IdP-initiated test fails even when the configuration is correct. -SSO provisioning creates internal organization members but does not grant workspace access. External workspace members are different: they are invited to a specific workspace without joining your organization or consuming one of your seats. Existing invitations and external access take precedence over automatic provisioning so their intended role and workspace grants are preserved. +SSO provisioning creates internal organization members but does not grant workspace access. To grant workspace access from your identity provider, use [directory provisioning](/platform/enterprise/scim) and map a pushed group to a workspace. External workspace members are different: they are invited to a specific workspace without joining your organization or consuming one of your seats. Existing invitations and external access take precedence over automatic provisioning so their intended role and workspace grants are preserved. Password-based login remains available. Forcing all organization members to use SSO exclusively is not yet supported. @@ -305,7 +305,7 @@ SSO provisioning creates internal organization members but does not grant worksp }, { question: "Does disabling someone in the identity provider remove their Sim access?", - answer: "No. Disabling the IdP account blocks future SSO authentication, but Sim does not currently receive SCIM deprovisioning or IdP logout events to remove membership or revoke active Sim sessions. Remove or suspend the user in Sim as part of offboarding." + answer: "With [directory provisioning](/platform/enterprise/scim) connected, yes: your identity provider sends the deactivation, and Sim blocks sign-in, stops their API keys, and withdraws directory-granted access while leaving everything they own intact. With SSO alone, disabling the IdP account only blocks future SSO authentication — remove or suspend the user in Sim as part of offboarding." }, { question: "Can I still use email/password login after enabling SSO?", diff --git a/apps/docs/openapi-v2-billing.json b/apps/docs/openapi-v2-billing.json index 024a60372e0..cd896b439e2 100644 --- a/apps/docs/openapi-v2-billing.json +++ b/apps/docs/openapi-v2-billing.json @@ -453,7 +453,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `SCIM_MANAGED_MEMBERSHIP` — This member is provisioned by the organization's identity provider, which the organization has made the source of truth for membership. Make the change in the identity provider, or turn off managed-membership locking in the organization's SCIM settings." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-files-audit.json b/apps/docs/openapi-v2-files-audit.json index 2ae1f1de435..0d7fd0ff00f 100644 --- a/apps/docs/openapi-v2-files-audit.json +++ b/apps/docs/openapi-v2-files-audit.json @@ -3097,7 +3097,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `SCIM_MANAGED_MEMBERSHIP` — This member is provisioned by the organization's identity provider, which the organization has made the source of truth for membership. Make the change in the identity provider, or turn off managed-membership locking in the organization's SCIM settings." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-knowledge.json b/apps/docs/openapi-v2-knowledge.json index 999ba3d8732..967407ce609 100644 --- a/apps/docs/openapi-v2-knowledge.json +++ b/apps/docs/openapi-v2-knowledge.json @@ -4499,7 +4499,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `SCIM_MANAGED_MEMBERSHIP` — This member is provisioned by the organization's identity provider, which the organization has made the source of truth for membership. Make the change in the identity provider, or turn off managed-membership locking in the organization's SCIM settings." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-logs.json b/apps/docs/openapi-v2-logs.json index 2b65611a2fb..eb4d443ef12 100644 --- a/apps/docs/openapi-v2-logs.json +++ b/apps/docs/openapi-v2-logs.json @@ -787,7 +787,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `SCIM_MANAGED_MEMBERSHIP` — This member is provisioned by the organization's identity provider, which the organization has made the source of truth for membership. Make the change in the identity provider, or turn off managed-membership locking in the organization's SCIM settings." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-resources.json b/apps/docs/openapi-v2-resources.json index c2ff564af75..06497537e97 100644 --- a/apps/docs/openapi-v2-resources.json +++ b/apps/docs/openapi-v2-resources.json @@ -4890,7 +4890,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `SCIM_MANAGED_MEMBERSHIP` — This member is provisioned by the organization's identity provider, which the organization has made the source of truth for membership. Make the change in the identity provider, or turn off managed-membership locking in the organization's SCIM settings." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-tables.json b/apps/docs/openapi-v2-tables.json index bb44fceaef5..37b3e661b32 100644 --- a/apps/docs/openapi-v2-tables.json +++ b/apps/docs/openapi-v2-tables.json @@ -4897,7 +4897,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `SCIM_MANAGED_MEMBERSHIP` — This member is provisioned by the organization's identity provider, which the organization has made the source of truth for membership. Make the change in the identity provider, or turn off managed-membership locking in the organization's SCIM settings." } }, "required": ["code", "message"], diff --git a/apps/docs/openapi-v2-workflows.json b/apps/docs/openapi-v2-workflows.json index fa265533ea7..54ab9310088 100644 --- a/apps/docs/openapi-v2-workflows.json +++ b/apps/docs/openapi-v2-workflows.json @@ -3908,7 +3908,7 @@ "description": "Human-readable explanation of the error." }, "details": { - "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS." + "description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `ORGANIZATION_PLAN_REQUIRED` — The organization has no active organization subscription (Pro for Teams, Max for Teams, or Enterprise).\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address.\n- `WORKSPACE_PLAN_CAPABILITY_REQUIRED` — The workspace's plan does not include a capability this request depends on. The message names the capability; upgrading the workspace's plan is the remedy.\n- `CHAT_AUTH_MODE_NOT_PERMITTED` — The workspace's permission group does not allow the chat authentication mode the request selected. A mode already saved on the deployment may still be re-saved; changing to a disallowed one cannot.\n- `CONNECTOR_MANAGED_RESOURCE_READ_ONLY` — This resource is managed by a knowledge base connector and cannot be edited directly. Change it at the source and re-sync, or exclude the document from the connector.\n- `PERMISSION_GROUP_CAPABILITY_BLOCKED` — The caller's permission group does not allow this capability. The message names it; an organization admin controls the group.\n- `INTEGRATION_NOT_ALLOWED` — The integration this request names is outside the workspace's allowed set. An organization admin controls the permission group's integration allowlist, and a self-hosted deployment can narrow it further with ALLOWED_INTEGRATIONS.\n- `SCIM_MANAGED_MEMBERSHIP` — This member is provisioned by the organization's identity provider, which the organization has made the source of truth for membership. Make the change in the identity provider, or turn off managed-membership locking in the organization's SCIM settings." } }, "required": ["code", "message"], diff --git a/apps/sim/app/api/cron/scim-reconcile/route.ts b/apps/sim/app/api/cron/scim-reconcile/route.ts new file mode 100644 index 00000000000..b35e68b1dbc --- /dev/null +++ b/apps/sim/app/api/cron/scim-reconcile/route.ts @@ -0,0 +1,31 @@ +import { createLogger } from '@sim/logger' +import { toError } from '@sim/utils/errors' +import { type NextRequest, NextResponse } from 'next/server' +import { verifyCronAuth } from '@/lib/auth/internal' +import { isBillingEnabled, isScimEnabled } from '@/lib/core/config/env-flags' +import { withRouteHandler } from '@/lib/core/utils/with-route-handler' +import { runScimReconcileSweep } from '@/lib/scim/reconcile/job' + +const logger = createLogger('CronScimReconcile') + +/** + * Sweeps directory connections for drift between what their group mappings say + * a member should have and what SCIM actually granted them. + */ +export const GET = withRouteHandler(async (request: NextRequest) => { + const authError = verifyCronAuth(request, 'SCIM reconciliation') + if (authError) return authError + + if (!isBillingEnabled && !isScimEnabled) { + return NextResponse.json({ success: true, connections: 0, skipped: 'disabled' }) + } + + try { + const sweep = await runScimReconcileSweep() + logger.info('SCIM reconciliation sweep complete', sweep) + return NextResponse.json({ success: true, ...sweep }) + } catch (error) { + logger.error('SCIM reconciliation sweep failed', { error: toError(error).message }) + return NextResponse.json({ error: 'Internal server error' }, { status: 500 }) + } +}) diff --git a/apps/sim/app/api/files/uploads/purposes.ts b/apps/sim/app/api/files/uploads/purposes.ts index 38982824cf7..a92aa01e174 100644 --- a/apps/sim/app/api/files/uploads/purposes.ts +++ b/apps/sim/app/api/files/uploads/purposes.ts @@ -258,6 +258,11 @@ async function principalUserId(principal: Principal, workspaceId?: string): Prom 'forbidden', 'Credential Group enrollment principals cannot create uploads' ) + case 'scim_connection': + throw new UploadSessionError( + 'forbidden', + 'Directory provisioning credentials cannot create uploads' + ) } } diff --git a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts index 1afe2fb1731..3ab5b9f3420 100644 --- a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts @@ -16,8 +16,11 @@ import { WORKSPACE_BILLING_ACCOUNT_REMOVAL_ERROR, } from '@/lib/billing/organizations/membership' import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' +import { ForbiddenOperationError } from '@/lib/core/application' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' +import { changeMemberRoleTx } from '@/lib/organizations/members/lifecycle' import { captureServerEvent } from '@/lib/posthog/server' +import { assertMembershipNotScimManaged } from '@/lib/scim/managed-membership' const logger = createLogger('OrganizationMemberAPI') @@ -208,14 +211,37 @@ export const PUT = withRouteHandler( ) } - const updatedMember = await db - .update(member) - .set({ role }) - .where(and(eq(member.organizationId, organizationId), eq(member.userId, memberId))) - .returning() + /** + * When the organization has made its identity provider the source of + * truth for membership, a role set here is reverted by the next sync. + * Refusing says so instead of letting the change quietly disappear. + */ + await assertMembershipNotScimManaged({ + organizationId, + userId: memberId, + action: 'change-role', + }) + + /** + * The shared primitive re-reads the member under the organization's + * mutation lock, so a concurrent promotion to owner cannot slip between + * the check above and the write. + */ + const roleChange = await db.transaction((tx) => + changeMemberRoleTx(tx, { organizationId, userId: memberId, role }) + ) - if (updatedMember.length === 0) { - return NextResponse.json({ error: 'Failed to update member role' }, { status: 500 }) + if (!roleChange.changed) { + return NextResponse.json({ + success: true, + message: 'Member role updated successfully', + data: { + id: targetMember[0].id, + userId: targetMember[0].userId, + role: roleChange.role, + updatedBy: session.user.id, + }, + }) } logger.info('Organization member role updated', { @@ -254,13 +280,20 @@ export const PUT = withRouteHandler( success: true, message: 'Member role updated successfully', data: { - id: updatedMember[0].id, - userId: updatedMember[0].userId, - role: updatedMember[0].role, + id: targetMember[0].id, + userId: targetMember[0].userId, + role: roleChange.to, updatedBy: session.user.id, }, }) } catch (error) { + if (error instanceof ForbiddenOperationError) { + return NextResponse.json( + { error: error.message, details: { code: error.detailCode } }, + { status: 403 } + ) + } + logger.error('Failed to update organization member role', { organizationId: (await context.params).id, memberId: (await context.params).memberId, diff --git a/apps/sim/app/api/organizations/[id]/scim/activity/route.ts b/apps/sim/app/api/organizations/[id]/scim/activity/route.ts new file mode 100644 index 00000000000..c23d444aadd --- /dev/null +++ b/apps/sim/app/api/organizations/[id]/scim/activity/route.ts @@ -0,0 +1,24 @@ +import { listScimActivityContract } from '@/lib/api/contracts/organization-scim' +import { + defineInternalJsonRoute, + internalOrchestrationErrorPolicy, + internalRateLimits, + internalSessionAuth, +} from '@/lib/api/server/routes' +import { listScimActivity } from '@/lib/scim/application/admin/manage-connection' + +/** Recent provisioning requests, so a failing sync can be diagnosed from Sim. */ +export const GET = defineInternalJsonRoute({ + contract: listScimActivityContract, + auth: internalSessionAuth, + operation: listScimActivity.operation, + rateLimit: internalRateLimits.none({ + reason: 'Authenticated organization settings read, admission unchanged from its siblings.', + }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: ({ params, query }) => ({ + organizationId: params.id, + ...(query.limit !== undefined ? { limit: query.limit } : {}), + }), + useCase: listScimActivity, +}) diff --git a/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts b/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts new file mode 100644 index 00000000000..93d9675fa9c --- /dev/null +++ b/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts @@ -0,0 +1,21 @@ +import { revokeScimCredentialContract } from '@/lib/api/contracts/organization-scim' +import { + defineInternalJsonRoute, + internalOrchestrationErrorPolicy, + internalRateLimits, + internalSessionAuth, +} from '@/lib/api/server/routes' +import { revokeScimCredential } from '@/lib/scim/application/admin/manage-connection' + +export const DELETE = defineInternalJsonRoute({ + contract: revokeScimCredentialContract, + auth: internalSessionAuth, + operation: revokeScimCredential.operation, + rateLimit: internalRateLimits.user({ bucketName: 'scim-credential-revoke' }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: ({ params }) => ({ + organizationId: params.id, + credentialId: params.credentialId, + }), + useCase: revokeScimCredential, +}) diff --git a/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts b/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts new file mode 100644 index 00000000000..cbc7af6c96b --- /dev/null +++ b/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts @@ -0,0 +1,26 @@ +import { issueScimCredentialContract } from '@/lib/api/contracts/organization-scim' +import { + defineInternalJsonRoute, + internalOrchestrationErrorPolicy, + internalRateLimits, + internalSessionAuth, +} from '@/lib/api/server/routes' +import { issueScimCredential } from '@/lib/scim/application/admin/manage-connection' + +/** Issues a bearer credential. The secret is returned once and never stored. */ +export const POST = defineInternalJsonRoute({ + contract: issueScimCredentialContract, + auth: internalSessionAuth, + operation: issueScimCredential.operation, + rateLimit: internalRateLimits.user({ + bucketName: 'scim-credential-issue', + config: { maxTokens: 10, refillRate: 5, refillIntervalMs: 60_000 }, + }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: ({ params, body }) => ({ + organizationId: params.id, + ...(body.scopes ? { scopes: body.scopes } : {}), + ...(body.expiresInDays !== undefined ? { expiresInDays: body.expiresInDays } : {}), + }), + useCase: issueScimCredential, +}) diff --git a/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts b/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts new file mode 100644 index 00000000000..653b999a826 --- /dev/null +++ b/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts @@ -0,0 +1,18 @@ +import { deleteScimGroupMappingContract } from '@/lib/api/contracts/organization-scim' +import { + defineInternalJsonRoute, + internalOrchestrationErrorPolicy, + internalRateLimits, + internalSessionAuth, +} from '@/lib/api/server/routes' +import { deleteScimGroupMapping } from '@/lib/scim/application/admin/manage-connection' + +export const DELETE = defineInternalJsonRoute({ + contract: deleteScimGroupMappingContract, + auth: internalSessionAuth, + operation: deleteScimGroupMapping.operation, + rateLimit: internalRateLimits.user({ bucketName: 'scim-mapping-delete' }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: ({ params }) => ({ organizationId: params.id, mappingId: params.mappingId }), + useCase: deleteScimGroupMapping, +}) diff --git a/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts b/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts new file mode 100644 index 00000000000..41a9bf47f01 --- /dev/null +++ b/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts @@ -0,0 +1,38 @@ +import { + listScimGroupMappingsContract, + upsertScimGroupMappingContract, +} from '@/lib/api/contracts/organization-scim' +import { + defineInternalJsonRoute, + internalOrchestrationErrorPolicy, + internalRateLimits, + internalSessionAuth, +} from '@/lib/api/server/routes' +import { + listScimGroupMappings, + upsertScimGroupMapping, +} from '@/lib/scim/application/admin/manage-connection' + +/** What each directory group means inside Sim. */ + +export const GET = defineInternalJsonRoute({ + contract: listScimGroupMappingsContract, + auth: internalSessionAuth, + operation: listScimGroupMappings.operation, + rateLimit: internalRateLimits.none({ + reason: 'Authenticated organization settings read, admission unchanged from its siblings.', + }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: ({ params }) => ({ organizationId: params.id }), + useCase: listScimGroupMappings, +}) + +export const POST = defineInternalJsonRoute({ + contract: upsertScimGroupMappingContract, + auth: internalSessionAuth, + operation: upsertScimGroupMapping.operation, + rateLimit: internalRateLimits.user({ bucketName: 'scim-mapping-upsert' }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: ({ params, body }) => ({ organizationId: params.id, ...body }), + useCase: upsertScimGroupMapping, +}) diff --git a/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts b/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts new file mode 100644 index 00000000000..ff3f8e46bcd --- /dev/null +++ b/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts @@ -0,0 +1,27 @@ +import { reconcileScimConnectionContract } from '@/lib/api/contracts/organization-scim' +import { + defineInternalJsonRoute, + internalOrchestrationErrorPolicy, + internalRateLimits, + internalSessionAuth, +} from '@/lib/api/server/routes' +import { reconcileScimConnection } from '@/lib/scim/application/admin/manage-connection' + +/** + * Re-applies every group mapping to every provisioned user. + * + * Idempotent, so an administrator can run it after changing mappings without + * waiting for the scheduled pass. + */ +export const POST = defineInternalJsonRoute({ + contract: reconcileScimConnectionContract, + auth: internalSessionAuth, + operation: reconcileScimConnection.operation, + rateLimit: internalRateLimits.user({ + bucketName: 'scim-reconcile', + config: { maxTokens: 5, refillRate: 2, refillIntervalMs: 60_000 }, + }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: ({ params }) => ({ organizationId: params.id }), + useCase: reconcileScimConnection, +}) diff --git a/apps/sim/app/api/organizations/[id]/scim/route.ts b/apps/sim/app/api/organizations/[id]/scim/route.ts new file mode 100644 index 00000000000..3272e66b7d0 --- /dev/null +++ b/apps/sim/app/api/organizations/[id]/scim/route.ts @@ -0,0 +1,48 @@ +import { + configureScimConnectionContract, + getScimConnectionContract, +} from '@/lib/api/contracts/organization-scim' +import { + defineInternalJsonRoute, + internalOrchestrationErrorPolicy, + internalRateLimits, + internalSessionAuth, +} from '@/lib/api/server/routes' +import { + configureScimConnection, + getScimConnection, +} from '@/lib/scim/application/admin/manage-connection' + +/** + * The organization's directory-provisioning connection. + * + * Session-authenticated settings surface, distinct from the SCIM protocol + * endpoints under `/api/scim/v2` that the identity provider itself calls. + */ + +export const GET = defineInternalJsonRoute({ + contract: getScimConnectionContract, + auth: internalSessionAuth, + operation: getScimConnection.operation, + rateLimit: internalRateLimits.none({ + reason: 'Authenticated organization settings read, admission unchanged from its siblings.', + }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: ({ params }) => ({ organizationId: params.id }), + useCase: getScimConnection, +}) + +export const PUT = defineInternalJsonRoute({ + contract: configureScimConnectionContract, + auth: internalSessionAuth, + operation: configureScimConnection.operation, + rateLimit: internalRateLimits.user({ bucketName: 'scim-configure' }), + errorPolicy: internalOrchestrationErrorPolicy, + mapInput: ({ params, body }) => ({ + organizationId: params.id, + ...(body.status !== undefined ? { status: body.status } : {}), + ...(body.settings !== undefined ? { settings: body.settings } : {}), + ...(body.ssoProviderId !== undefined ? { ssoProviderId: body.ssoProviderId } : {}), + }), + useCase: configureScimConnection, +}) diff --git a/apps/sim/app/api/scim/v2/Groups/[id]/route.ts b/apps/sim/app/api/scim/v2/Groups/[id]/route.ts new file mode 100644 index 00000000000..d43b9d45c82 --- /dev/null +++ b/apps/sim/app/api/scim/v2/Groups/[id]/route.ts @@ -0,0 +1,58 @@ +import { + deleteScimGroupContract, + getScimGroupContract, + patchScimGroupContract, + replaceScimGroupContract, +} from '@/lib/api/contracts/scim' +import { + deleteScimGroupUseCase, + getScimGroup, + patchScimGroup, + replaceScimGroup, +} from '@/lib/scim/application/groups/manage-groups' +import { assertGroupSchemas, toCanonicalGroup } from '@/lib/scim/protocol/canonical' +import { parseAttributeProjection } from '@/lib/scim/protocol/resources' +import { defineScimRoute } from '@/lib/scim/route' + +/** One Group resource. */ + +export const GET = defineScimRoute({ + contract: getScimGroupContract, + scope: 'groups:read', + operation: getScimGroup.operation, + useCase: getScimGroup, + mapInput: ({ params, query }) => ({ + groupId: params.id, + projection: parseAttributeProjection(query), + }), + present: (resource) => resource, +}) + +export const PUT = defineScimRoute({ + contract: replaceScimGroupContract, + scope: 'groups:write', + operation: replaceScimGroup.operation, + useCase: replaceScimGroup, + mapInput: ({ params, body }) => { + assertGroupSchemas(body.schemas) + return { groupId: params.id, group: toCanonicalGroup(body) } + }, + present: (result) => result.resource, +}) + +/** Answers 204: Microsoft asks that a group patch not echo the member list. */ +export const PATCH = defineScimRoute({ + contract: patchScimGroupContract, + scope: 'groups:write', + operation: patchScimGroup.operation, + useCase: patchScimGroup, + mapInput: ({ params, body }) => ({ groupId: params.id, operations: body.Operations }), +}) + +export const DELETE = defineScimRoute({ + contract: deleteScimGroupContract, + scope: 'groups:write', + operation: deleteScimGroupUseCase.operation, + useCase: deleteScimGroupUseCase, + mapInput: ({ params }) => ({ groupId: params.id }), +}) diff --git a/apps/sim/app/api/scim/v2/Groups/route.ts b/apps/sim/app/api/scim/v2/Groups/route.ts new file mode 100644 index 00000000000..01e636bd1c5 --- /dev/null +++ b/apps/sim/app/api/scim/v2/Groups/route.ts @@ -0,0 +1,34 @@ +import { createScimGroupContract, listScimGroupsContract } from '@/lib/api/contracts/scim' +import { createScimGroup, listScimGroups } from '@/lib/scim/application/groups/manage-groups' +import { assertGroupSchemas, toCanonicalGroup } from '@/lib/scim/protocol/canonical' +import { parseAttributeProjection, toListResponse } from '@/lib/scim/protocol/resources' +import { defineScimRoute } from '@/lib/scim/route' + +/** The Group collection. */ + +export const GET = defineScimRoute({ + contract: listScimGroupsContract, + scope: 'groups:read', + operation: listScimGroups.operation, + useCase: listScimGroups, + mapInput: ({ query }) => ({ + filter: query.filter, + startIndex: query.startIndex, + count: query.count, + projection: parseAttributeProjection(query), + }), + present: (result) => toListResponse(result.resources, result.totalResults, result.startIndex), +}) + +export const POST = defineScimRoute({ + contract: createScimGroupContract, + scope: 'groups:write', + operation: createScimGroup.operation, + useCase: createScimGroup, + mapInput: ({ body }) => { + assertGroupSchemas(body.schemas) + return { group: toCanonicalGroup(body) } + }, + present: (result) => result.resource, + headers: (result, { baseUrl }) => ({ Location: `${baseUrl}/Groups/${result.groupId}` }), +}) diff --git a/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts b/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts new file mode 100644 index 00000000000..5e850070d25 --- /dev/null +++ b/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts @@ -0,0 +1,12 @@ +import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' +import { resourceTypes } from '@/lib/scim/protocol/discovery' +import { notFound } from '@/lib/scim/protocol/errors' + +export const GET = defineScimDiscoveryRoute((baseUrl, params) => { + const id = typeof params.id === 'string' ? params.id : '' + const match = resourceTypes(baseUrl).find( + (resource) => resource.id.toLowerCase() === id.toLowerCase() + ) + if (!match) throw notFound(`Resource type ${id} not found`) + return match +}) diff --git a/apps/sim/app/api/scim/v2/ResourceTypes/route.ts b/apps/sim/app/api/scim/v2/ResourceTypes/route.ts new file mode 100644 index 00000000000..84369557f30 --- /dev/null +++ b/apps/sim/app/api/scim/v2/ResourceTypes/route.ts @@ -0,0 +1,4 @@ +import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' +import { discoveryList, resourceTypes } from '@/lib/scim/protocol/discovery' + +export const GET = defineScimDiscoveryRoute((baseUrl) => discoveryList(resourceTypes(baseUrl))) diff --git a/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts b/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts new file mode 100644 index 00000000000..5798a16d512 --- /dev/null +++ b/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts @@ -0,0 +1,12 @@ +import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' +import { schemaDefinitions } from '@/lib/scim/protocol/discovery' +import { notFound } from '@/lib/scim/protocol/errors' + +export const GET = defineScimDiscoveryRoute((baseUrl, params) => { + const id = typeof params.id === 'string' ? decodeURIComponent(params.id) : '' + const match = schemaDefinitions(baseUrl).find( + (schema) => schema.id.toLowerCase() === id.toLowerCase() + ) + if (!match) throw notFound(`Schema ${id} not found`) + return match +}) diff --git a/apps/sim/app/api/scim/v2/Schemas/route.ts b/apps/sim/app/api/scim/v2/Schemas/route.ts new file mode 100644 index 00000000000..c7206040187 --- /dev/null +++ b/apps/sim/app/api/scim/v2/Schemas/route.ts @@ -0,0 +1,4 @@ +import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' +import { discoveryList, schemaDefinitions } from '@/lib/scim/protocol/discovery' + +export const GET = defineScimDiscoveryRoute((baseUrl) => discoveryList(schemaDefinitions(baseUrl))) diff --git a/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts b/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts new file mode 100644 index 00000000000..c1e565837d9 --- /dev/null +++ b/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts @@ -0,0 +1,5 @@ +import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' +import { serviceProviderConfig } from '@/lib/scim/protocol/discovery' + +/** Unauthenticated by design: a provider negotiates before it holds a credential. */ +export const GET = defineScimDiscoveryRoute((baseUrl) => serviceProviderConfig(baseUrl)) diff --git a/apps/sim/app/api/scim/v2/Users/[id]/route.ts b/apps/sim/app/api/scim/v2/Users/[id]/route.ts new file mode 100644 index 00000000000..5a347246643 --- /dev/null +++ b/apps/sim/app/api/scim/v2/Users/[id]/route.ts @@ -0,0 +1,55 @@ +import { + deleteScimUserContract, + getScimUserContract, + patchScimUserContract, + replaceScimUserContract, +} from '@/lib/api/contracts/scim' +import { deprovisionScimUser } from '@/lib/scim/application/users/deprovision-user' +import { getScimUser } from '@/lib/scim/application/users/read-users' +import { patchScimUser, replaceScimUser } from '@/lib/scim/application/users/update-user' +import { assertUserSchemas, toCanonicalUser } from '@/lib/scim/protocol/canonical' +import { parseAttributeProjection } from '@/lib/scim/protocol/resources' +import { defineScimRoute } from '@/lib/scim/route' + +/** One User resource. */ + +export const GET = defineScimRoute({ + contract: getScimUserContract, + scope: 'users:read', + operation: getScimUser.operation, + useCase: getScimUser, + mapInput: ({ params, query }) => ({ + scimUserId: params.id, + projection: parseAttributeProjection(query), + }), + present: (resource) => resource, +}) + +export const PUT = defineScimRoute({ + contract: replaceScimUserContract, + scope: 'users:write', + operation: replaceScimUser.operation, + useCase: replaceScimUser, + mapInput: ({ params, body }) => { + assertUserSchemas(body.schemas) + return { scimUserId: params.id, attributes: toCanonicalUser(body) } + }, + present: (result) => result.resource, +}) + +export const PATCH = defineScimRoute({ + contract: patchScimUserContract, + scope: 'users:write', + operation: patchScimUser.operation, + useCase: patchScimUser, + mapInput: ({ params, body }) => ({ scimUserId: params.id, operations: body.Operations }), + present: (result) => result.resource, +}) + +export const DELETE = defineScimRoute({ + contract: deleteScimUserContract, + scope: 'users:write', + operation: deprovisionScimUser.operation, + useCase: deprovisionScimUser, + mapInput: ({ params }) => ({ scimUserId: params.id }), +}) diff --git a/apps/sim/app/api/scim/v2/Users/route.ts b/apps/sim/app/api/scim/v2/Users/route.ts new file mode 100644 index 00000000000..a14ad88c155 --- /dev/null +++ b/apps/sim/app/api/scim/v2/Users/route.ts @@ -0,0 +1,41 @@ +import { createScimUserContract, listScimUsersContract } from '@/lib/api/contracts/scim' +import { provisionScimUser } from '@/lib/scim/application/users/provision-user' +import { listScimUsers } from '@/lib/scim/application/users/read-users' +import { assertUserSchemas, toCanonicalUser } from '@/lib/scim/protocol/canonical' +import { parseAttributeProjection, toListResponse } from '@/lib/scim/protocol/resources' +import { defineScimRoute } from '@/lib/scim/route' + +/** + * The User collection. + * + * Adapters only: authentication, rate policy, contract parsing, and rendering + * live in the route builder, and every decision about identity, membership, and + * access lives in `lib/scim/application`. + */ + +export const GET = defineScimRoute({ + contract: listScimUsersContract, + scope: 'users:read', + operation: listScimUsers.operation, + useCase: listScimUsers, + mapInput: ({ query }) => ({ + filter: query.filter, + startIndex: query.startIndex, + count: query.count, + projection: parseAttributeProjection(query), + }), + present: (result) => toListResponse(result.resources, result.totalResults, result.startIndex), +}) + +export const POST = defineScimRoute({ + contract: createScimUserContract, + scope: 'users:write', + operation: provisionScimUser.operation, + useCase: provisionScimUser, + mapInput: ({ body }) => { + assertUserSchemas(body.schemas) + return { attributes: toCanonicalUser(body) } + }, + present: (result) => result.resource, + headers: (result, { baseUrl }) => ({ Location: `${baseUrl}/Users/${result.scimUserId}` }), +}) diff --git a/apps/sim/lib/api-key/service.ts b/apps/sim/lib/api-key/service.ts index 4520b92f22a..ef90a17da78 100644 --- a/apps/sim/lib/api-key/service.ts +++ b/apps/sim/lib/api-key/service.ts @@ -48,6 +48,7 @@ interface HashCandidate { type: string expiresAt: Date | null userBanned: boolean | null + userSuspendedAt: Date | null } /** @@ -84,6 +85,7 @@ export async function authenticateApiKeyFromHeader( type: apiKeyTable.type, expiresAt: apiKeyTable.expiresAt, userBanned: userTable.banned, + userSuspendedAt: userTable.suspendedAt, }) .from(apiKeyTable) .leftJoin(userTable, eq(apiKeyTable.userId, userTable.id)) @@ -97,6 +99,13 @@ export async function authenticateApiKeyFromHeader( // Defense in depth: banning deletes a user's keys, but reject any survivor too. if (record.userBanned) return INVALID + /** + * A suspension deliberately leaves the account's resources intact, so unlike + * a ban it does not delete the keys. Refusing them here is what actually + * ends machine access for a deactivated member. + */ + if (record.userSuspendedAt) return INVALID + if (options.userId && record.userId !== options.userId) return INVALID if (options.keyTypes?.length && !options.keyTypes.includes(keyType)) return INVALID if (record.expiresAt && record.expiresAt < new Date()) return INVALID diff --git a/apps/sim/lib/api/contracts/organization-scim.ts b/apps/sim/lib/api/contracts/organization-scim.ts new file mode 100644 index 00000000000..23ecdfa0761 --- /dev/null +++ b/apps/sim/lib/api/contracts/organization-scim.ts @@ -0,0 +1,207 @@ +import { z } from 'zod' +import { organizationIdSchema } from '@/lib/api/contracts/primitives' +import { defineRouteContract } from '@/lib/api/contracts/types' + +/** + * The settings surface an organization administrator uses to configure directory + * provisioning. Ordinary session-authenticated internal routes; the SCIM + * protocol surface is separate and lives in `contracts/scim.ts`. + */ + +const organizationParamsSchema = z.object({ id: organizationIdSchema }) + +const scimScopeSchema = z.enum(['users:read', 'users:write', 'groups:read', 'groups:write']) + +const workspaceGrantSchema = z.object({ + workspaceId: z.string().min(1).max(128), + permission: z.enum(['admin', 'write', 'read']), +}) + +export const scimConnectionSettingsSchema = z.object({ + lockManualMembership: z.boolean().optional(), + disableJit: z.boolean().optional(), + autoMapPermissionGroupsByName: z.boolean().optional(), + defaultWorkspaceGrants: z.array(workspaceGrantSchema).max(50).optional(), +}) +export type ScimConnectionSettingsInput = z.input + +const scimCredentialSchema = z.object({ + id: z.string(), + tokenPrefix: z.string(), + scopes: z.array(scimScopeSchema), + expiresAt: z.string().nullable(), + lastUsedAt: z.string().nullable(), + createdAt: z.string(), +}) + +const scimConnectionSchema = z.object({ + id: z.string(), + status: z.enum(['active', 'disabled']), + baseUrl: z.string(), + settings: scimConnectionSettingsSchema, + ssoProviderId: z.string().nullable(), + lastRequestAt: z.string().nullable(), + reconciledAt: z.string().nullable(), + createdAt: z.string(), + credentials: z.array(scimCredentialSchema), + userCount: z.number().int(), + groupCount: z.number().int(), +}) + +export const getScimConnectionContract = defineRouteContract({ + method: 'GET', + path: '/api/organizations/[id]/scim', + params: organizationParamsSchema, + response: { + mode: 'json', + schema: z.object({ connection: scimConnectionSchema.nullable(), baseUrl: z.string() }), + }, +}) + +export const configureScimConnectionContract = defineRouteContract({ + method: 'PUT', + path: '/api/organizations/[id]/scim', + params: organizationParamsSchema, + body: z.object({ + status: z.enum(['active', 'disabled']).optional(), + settings: scimConnectionSettingsSchema.optional(), + ssoProviderId: z.string().max(128).nullable().optional(), + }), + response: { mode: 'json', schema: z.object({ connection: scimConnectionSchema }) }, +}) + +export const issueScimCredentialContract = defineRouteContract({ + method: 'POST', + path: '/api/organizations/[id]/scim/credentials', + params: organizationParamsSchema, + body: z.object({ + scopes: z.array(scimScopeSchema).min(1).optional(), + /** Days until the credential stops working. Omitted means it does not expire. */ + expiresInDays: z.number().int().min(1).max(3650).optional(), + }), + response: { + mode: 'json', + /** `secret` appears here and nowhere else; only its digest is stored. */ + schema: z.object({ secret: z.string(), credential: scimCredentialSchema }), + status: 201, + }, +}) + +export const revokeScimCredentialContract = defineRouteContract({ + method: 'DELETE', + path: '/api/organizations/[id]/scim/credentials/[credentialId]', + params: organizationParamsSchema.extend({ credentialId: z.string().min(1).max(128) }), + response: { mode: 'json', schema: z.object({ success: z.literal(true) }) }, +}) + +const groupMappingSchema = z.object({ + id: z.string(), + groupId: z.string(), + groupDisplayName: z.string(), + targetKind: z.enum(['permission_group', 'workspace', 'org_role']), + permissionGroupId: z.string().nullable(), + workspaceId: z.string().nullable(), + permissionType: z.enum(['admin', 'write', 'read']).nullable(), + role: z.string().nullable(), +}) + +export const listScimGroupMappingsContract = defineRouteContract({ + method: 'GET', + path: '/api/organizations/[id]/scim/mappings', + params: organizationParamsSchema, + response: { + mode: 'json', + schema: z.object({ + groups: z.array( + z.object({ + id: z.string(), + displayName: z.string(), + memberCount: z.number().int(), + mappings: z.array(groupMappingSchema), + }) + ), + }), + }, +}) + +export const upsertScimGroupMappingContract = defineRouteContract({ + method: 'POST', + path: '/api/organizations/[id]/scim/mappings', + params: organizationParamsSchema, + body: z.discriminatedUnion('targetKind', [ + z.object({ + groupId: z.string().min(1).max(128), + targetKind: z.literal('permission_group'), + permissionGroupId: z.string().min(1).max(128), + }), + z.object({ + groupId: z.string().min(1).max(128), + targetKind: z.literal('workspace'), + workspaceId: z.string().min(1).max(128), + permissionType: z.enum(['admin', 'write', 'read']), + }), + z.object({ + groupId: z.string().min(1).max(128), + targetKind: z.literal('org_role'), + role: z.literal('admin'), + }), + ]), + response: { + mode: 'json', + schema: z.object({ mapping: groupMappingSchema, reconciledUsers: z.number().int() }), + status: 201, + }, +}) + +export const deleteScimGroupMappingContract = defineRouteContract({ + method: 'DELETE', + path: '/api/organizations/[id]/scim/mappings/[mappingId]', + params: organizationParamsSchema.extend({ mappingId: z.string().min(1).max(128) }), + response: { + mode: 'json', + schema: z.object({ success: z.literal(true), reconciledUsers: z.number().int() }), + }, +}) + +export const listScimActivityContract = defineRouteContract({ + method: 'GET', + path: '/api/organizations/[id]/scim/activity', + params: organizationParamsSchema, + query: z.object({ limit: z.coerce.number().int().min(1).max(200).optional() }), + response: { + mode: 'json', + schema: z.object({ + entries: z.array( + z.object({ + id: z.string(), + method: z.string(), + path: z.string(), + status: z.number().int(), + scimType: z.string().nullable(), + detail: z.string().nullable(), + userAgent: z.string().nullable(), + durationMs: z.number().int(), + createdAt: z.string(), + }) + ), + }), + }, +}) + +export const reconcileScimConnectionContract = defineRouteContract({ + method: 'POST', + path: '/api/organizations/[id]/scim/reconcile', + params: organizationParamsSchema, + response: { + mode: 'json', + schema: z.object({ + reconciledUsers: z.number().int(), + grantsAdded: z.number().int(), + grantsRemoved: z.number().int(), + }), + }, +}) + +export type ScimConnectionView = z.output +export type ScimCredentialView = z.output +export type ScimGroupMappingView = z.output diff --git a/apps/sim/lib/api/contracts/scim.ts b/apps/sim/lib/api/contracts/scim.ts new file mode 100644 index 00000000000..dc2ba60fb52 --- /dev/null +++ b/apps/sim/lib/api/contracts/scim.ts @@ -0,0 +1,310 @@ +import { z } from 'zod' +import { defineRouteContract } from '@/lib/api/contracts/types' +import { + SCIM_ENTERPRISE_USER_SCHEMA, + SCIM_ERROR_SCHEMA, + SCIM_GROUP_SCHEMA, + SCIM_LIST_RESPONSE_SCHEMA, + SCIM_MAX_GROUP_MEMBERS, + SCIM_MAX_PATCH_OPERATIONS, + SCIM_PATCH_OP_SCHEMA, + SCIM_USER_SCHEMA, +} from '@/lib/scim/protocol/constants' +import { normalizeScimBoolean, unwrapSingleElement } from '@/lib/scim/protocol/normalize' + +/** + * Wire schemas for the SCIM 2.0 surface. + * + * Inbound shapes are deliberately tolerant. RFC 7643 defines far more than Sim + * models, and a provider that sends an attribute this server does not store must + * still get its write accepted — so object schemas pass unknown keys through + * rather than stripping or rejecting them, and the canonicalizer decides what is + * kept. Outbound shapes are strict and drive the route builder's response + * validation. + */ + +/** Accepts the string booleans Microsoft Entra's classic provisioning job sends. */ +const scimBoolean = z.preprocess( + (value) => normalizeScimBoolean(unwrapSingleElement(value)), + z.boolean() +) + +const scimEmailSchema = z.looseObject({ + value: z.string().trim().min(1, 'An email entry requires a value').max(320), + type: z.string().max(64).optional(), + primary: scimBoolean.optional(), +}) + +const scimNameSchema = z.looseObject({ + formatted: z.string().max(256).optional(), + givenName: z.string().max(128).optional(), + familyName: z.string().max(128).optional(), +}) + +const scimEnterpriseSchema = z.looseObject({ + department: z.string().max(256).optional(), + employeeNumber: z.string().max(128).optional(), + costCenter: z.string().max(128).optional(), + division: z.string().max(128).optional(), + organization: z.string().max(256).optional(), + manager: z + .union([ + z.string().max(256), + z.looseObject({ + value: z.string().max(256).optional(), + displayName: z.string().max(256).optional(), + }), + ]) + .optional(), +}) + +/** + * An inbound User. + * + * `password` is absent on purpose. Okta sends one on every create even when + * password sync is off; naming it here would put a credential into the parsed + * request object and from there into logs and error details. + */ +export const scimUserWriteSchema = z.looseObject({ + schemas: z.array(z.string().max(256)).min(1, 'schemas must name at least one URN').max(10), + userName: z.string().trim().min(1, 'userName must not be empty').max(320), + externalId: z.string().trim().max(256).optional(), + active: scimBoolean.optional(), + displayName: z.string().max(256).optional(), + name: scimNameSchema.optional(), + emails: z.array(scimEmailSchema).max(20).optional(), + [SCIM_ENTERPRISE_USER_SCHEMA]: scimEnterpriseSchema.optional(), +}) +/** What a client may send. */ +export type ScimUserWrite = z.input +/** What the route receives after parsing, which is what the canonicalizer reads. */ +export type ScimUserWriteParsed = z.output + +const scimGroupMemberSchema = z.looseObject({ + value: z.string().trim().min(1, 'A group member requires a value').max(256), + display: z.string().max(256).optional(), + type: z.string().max(64).optional(), +}) + +export const scimGroupWriteSchema = z.looseObject({ + schemas: z.array(z.string().max(256)).min(1, 'schemas must name at least one URN').max(10), + displayName: z.string().trim().min(1, 'displayName must not be empty').max(256), + externalId: z.string().trim().max(256).optional(), + members: z.array(scimGroupMemberSchema).max(SCIM_MAX_GROUP_MEMBERS).optional(), +}) +export type ScimGroupWrite = z.input +export type ScimGroupWriteParsed = z.output + +/** + * A PATCH request body. + * + * `op` is lower-cased before validation because Entra capitalizes it, and + * defaults to `replace` because Okta omits it on the deactivation call that is + * the single most important request this server handles. + */ +export const scimPatchBodySchema = z.object({ + schemas: z + .array(z.string().max(256)) + .refine( + (schemas) => schemas.includes(SCIM_PATCH_OP_SCHEMA), + `schemas must include ${SCIM_PATCH_OP_SCHEMA}` + ), + Operations: z + .array( + z.object({ + op: z + .string() + .default('replace') + .transform((value) => value.trim().toLowerCase()) + .pipe(z.enum(['add', 'replace', 'remove'])), + path: z.string().max(512).optional(), + value: z.unknown().optional(), + }) + ) + .min(1, 'Operations must contain at least one operation') + .max(SCIM_MAX_PATCH_OPERATIONS), +}) +export type ScimPatchBody = z.output +export type ScimPatchOperation = ScimPatchBody['Operations'][number] + +export const scimAttributesQuerySchema = z.object({ + attributes: z.string().max(1024).optional(), + excludedAttributes: z.string().max(1024).optional(), +}) + +export const scimListQuerySchema = scimAttributesQuerySchema.extend({ + filter: z.string().max(2048).optional(), + startIndex: z.coerce.number().int().optional(), + count: z.coerce.number().int().optional(), +}) + +export const scimResourceParamsSchema = z.object({ id: z.string().min(1).max(256) }) + +const scimMetaSchema = z.object({ + resourceType: z.enum(['User', 'Group']), + created: z.string(), + lastModified: z.string(), + location: z.string(), + version: z.string(), +}) + +export const scimUserResourceSchema = z.looseObject({ + schemas: z.array(z.string()), + id: z.string(), + externalId: z.string().optional(), + userName: z.string(), + active: z.boolean(), + displayName: z.string(), + name: z.looseObject({ + formatted: z.string(), + givenName: z.string().optional(), + familyName: z.string().optional(), + }), + emails: z.array( + z.object({ value: z.string(), type: z.string().optional(), primary: z.boolean() }) + ), + groups: z.array(z.object({ value: z.string(), display: z.string(), $ref: z.string() })), + meta: scimMetaSchema, +}) + +export const scimGroupResourceSchema = z.looseObject({ + schemas: z.array(z.string()), + id: z.string(), + externalId: z.string().optional(), + displayName: z.string(), + members: z + .array( + z.object({ + value: z.string(), + display: z.string().optional(), + $ref: z.string(), + type: z.literal('User'), + }) + ) + .optional(), + meta: scimMetaSchema, +}) + +function listResponseSchema(item: Item) { + return z.object({ + schemas: z.tuple([z.literal(SCIM_LIST_RESPONSE_SCHEMA)]), + totalResults: z.number().int(), + startIndex: z.number().int(), + itemsPerPage: z.number().int(), + Resources: z.array(item), + }) +} + +export const scimErrorResponseSchema = z.object({ + schemas: z.tuple([z.literal(SCIM_ERROR_SCHEMA)]), + status: z.string(), + scimType: z.string().optional(), + detail: z.string(), +}) + +export const listScimUsersContract = defineRouteContract({ + method: 'GET', + path: '/api/scim/v2/Users', + query: scimListQuerySchema, + response: { mode: 'json', schema: listResponseSchema(scimUserResourceSchema) }, +}) + +export const createScimUserContract = defineRouteContract({ + method: 'POST', + path: '/api/scim/v2/Users', + body: scimUserWriteSchema, + response: { mode: 'json', schema: scimUserResourceSchema, status: 201 }, +}) + +export const getScimUserContract = defineRouteContract({ + method: 'GET', + path: '/api/scim/v2/Users/[id]', + params: scimResourceParamsSchema, + query: scimAttributesQuerySchema, + response: { mode: 'json', schema: scimUserResourceSchema }, +}) + +export const replaceScimUserContract = defineRouteContract({ + method: 'PUT', + path: '/api/scim/v2/Users/[id]', + params: scimResourceParamsSchema, + body: scimUserWriteSchema, + response: { mode: 'json', schema: scimUserResourceSchema }, +}) + +/** + * Returns the updated resource rather than `204`. Okta documents both as + * acceptable and Microsoft's own examples show a body, so the shape that + * satisfies both providers is the one that carries the resource. + */ +export const patchScimUserContract = defineRouteContract({ + method: 'PATCH', + path: '/api/scim/v2/Users/[id]', + params: scimResourceParamsSchema, + body: scimPatchBodySchema, + response: { mode: 'json', schema: scimUserResourceSchema }, +}) + +export const deleteScimUserContract = defineRouteContract({ + method: 'DELETE', + path: '/api/scim/v2/Users/[id]', + params: scimResourceParamsSchema, + response: { mode: 'empty', status: 204 }, +}) + +export const listScimGroupsContract = defineRouteContract({ + method: 'GET', + path: '/api/scim/v2/Groups', + query: scimListQuerySchema, + response: { mode: 'json', schema: listResponseSchema(scimGroupResourceSchema) }, +}) + +export const createScimGroupContract = defineRouteContract({ + method: 'POST', + path: '/api/scim/v2/Groups', + body: scimGroupWriteSchema, + response: { mode: 'json', schema: scimGroupResourceSchema, status: 201 }, +}) + +export const getScimGroupContract = defineRouteContract({ + method: 'GET', + path: '/api/scim/v2/Groups/[id]', + params: scimResourceParamsSchema, + query: scimAttributesQuerySchema, + response: { mode: 'json', schema: scimGroupResourceSchema }, +}) + +export const replaceScimGroupContract = defineRouteContract({ + method: 'PUT', + path: '/api/scim/v2/Groups/[id]', + params: scimResourceParamsSchema, + body: scimGroupWriteSchema, + response: { mode: 'json', schema: scimGroupResourceSchema }, +}) + +/** + * Returns `204`. Microsoft states a group PATCH "should yield an HTTP 204 No + * Content" and warns against returning the member list, which for a large + * group is the difference between a small response and a thousand-entry one on + * every incremental sync. + */ +export const patchScimGroupContract = defineRouteContract({ + method: 'PATCH', + path: '/api/scim/v2/Groups/[id]', + params: scimResourceParamsSchema, + body: scimPatchBodySchema, + response: { mode: 'empty', status: 204 }, +}) + +export const deleteScimGroupContract = defineRouteContract({ + method: 'DELETE', + path: '/api/scim/v2/Groups/[id]', + params: scimResourceParamsSchema, + response: { mode: 'empty', status: 204 }, +}) + +export const SCIM_SUPPORTED_SCHEMA_URNS = [ + SCIM_USER_SCHEMA, + SCIM_ENTERPRISE_USER_SCHEMA, + SCIM_GROUP_SCHEMA, +] as const diff --git a/apps/sim/lib/api/contracts/workspaces.ts b/apps/sim/lib/api/contracts/workspaces.ts index 318562ae4bf..242158ab1e9 100644 --- a/apps/sim/lib/api/contracts/workspaces.ts +++ b/apps/sim/lib/api/contracts/workspaces.ts @@ -254,6 +254,7 @@ export const deploymentFeaturesSchema = z.object({ dataRetention: z.boolean(), inbox: z.boolean(), sandboxes: z.boolean(), + scim: z.boolean(), sessionPolicies: z.boolean(), sso: z.boolean(), usageMonitoring: z.boolean(), diff --git a/apps/sim/lib/api/server/routes/scim-route.ts b/apps/sim/lib/api/server/routes/scim-route.ts new file mode 100644 index 00000000000..9fd486256fc --- /dev/null +++ b/apps/sim/lib/api/server/routes/scim-route.ts @@ -0,0 +1,311 @@ +import type { Principal, ScimConnectionPrincipal } from '@sim/auth/principal' +import { createLogger } from '@sim/logger' +import { type NextRequest, NextResponse } from 'next/server' +import type { AnyApiRouteContract, ContractJsonResponse } from '@/lib/api/contracts/types' +import { type ParsedRequest, parseRequest } from '@/lib/api/server/validation' +import type { ApplicationOperation, OperationUseCase } from '@/lib/core/application/operation' +import { RateLimiter } from '@/lib/core/rate-limiter' +import { getBaseUrl } from '@/lib/core/utils/urls' +import { withRouteHandler } from '@/lib/core/utils/with-route-handler' +import type { ScimConnectionAuthenticator } from '@/lib/scim/authenticate' +import { + SCIM_ACCEPTED_MEDIA_TYPES, + SCIM_BASE_PATH, + SCIM_MAX_BODY_BYTES, + SCIM_MEDIA_TYPE, + SCIM_RATE_LIMIT, +} from '@/lib/scim/protocol/constants' +import { ScimError, type ScimType, scimErrorBody, toScimError } from '@/lib/scim/protocol/errors' + +const logger = createLogger('ScimRoute') +const rateLimiter = new RateLimiter() + +/** + * The route builder for the SCIM 2.0 surface. + * + * SCIM cannot use `defineInternalJsonRoute`, and the differences are all + * protocol rather than preference: the caller is a bearer credential with no + * user and no workspace, the error envelope is RFC 7644's rather than Sim's + * `{ error }`, responses must carry `application/scim+json`, `DELETE` and group + * `PATCH` answer `204` with no body, and a wrong media type is a `415` before + * anything is parsed. This is the documented protocol exception the API rules + * allow, and it applies `withRouteHandler` exactly as the internal builder does + * so request ids, logging, and abort handling stay identical. + */ + +/** Which credential scope a route requires, derived from its contract. */ +export type ScimRouteScope = 'users:read' | 'users:write' | 'groups:read' | 'groups:write' + +export interface ScimPresenterContext { + principal: ScimConnectionPrincipal + baseUrl: string +} + +interface ScimRouteOptions { + contract: C + scope: ScimRouteScope + operation: O + useCase: OperationUseCase, I, R> + mapInput( + parsed: ParsedRequest, + context: { principal: ScimConnectionPrincipal; request: NextRequest } + ): I + /** Omitted for `204` routes, which have no body to render. */ + present?(result: NoInfer, context: ScimPresenterContext): ContractJsonResponse + /** Extra response headers, such as `Location` on a create. */ + headers?(result: NoInfer, context: ScimPresenterContext): Record +} + +export interface ScimRouteContext { + params?: Promise> +} + +export type ScimNextRouteHandler = ( + request: NextRequest, + context: ScimRouteContext | undefined +) => Promise | NextResponse | Response + +/** Dependencies the builder needs, injected so the module stays testable. */ +export interface ScimRouteDependencies { + authenticate: ScimConnectionAuthenticator + baseUrl(): string + recordRequest(entry: ScimRequestLogEntry): void +} + +export interface ScimRequestLogEntry { + principal: ScimConnectionPrincipal + method: string + path: string + status: number + scimType?: ScimType + detail?: string + userAgent: string | null + durationMs: number +} + +function scimResponse(body: unknown, status: number, headers?: Record): Response { + return NextResponse.json(body, { + status, + headers: { 'content-type': SCIM_MEDIA_TYPE, 'cache-control': 'no-store', ...headers }, + }) +} + +function scimErrorResponse(error: ScimError): Response { + return scimResponse(error.body, error.status, error.headers) +} + +const MUTATING_METHODS = new Set(['POST', 'PUT', 'PATCH']) + +/** + * Requires a SCIM or JSON content type on a body-bearing request. + * + * `DELETE` is excluded because Okta sends it with no body and no content type, + * and Entra sends one with `text/plain`. + */ +function assertAcceptableMediaType(request: NextRequest): void { + if (!MUTATING_METHODS.has(request.method)) return + const header = request.headers.get('content-type') + if (!header) throw new ScimError(415, undefined, 'A content type is required') + const mediaType = header.split(';')[0]?.trim().toLowerCase() + if (!SCIM_ACCEPTED_MEDIA_TYPES.some((accepted) => accepted === mediaType)) { + throw new ScimError( + 415, + undefined, + `SCIM requests must use ${SCIM_MEDIA_TYPE} or application/json` + ) + } +} + +/** + * Consumes one token from the connection's bucket. + * + * Keyed by connection rather than by credential, so rotating a token cannot be + * used to double the allowance, and never by IP: a provisioning service calls + * from a large shared range, where an IP bucket would either be useless or would + * throttle unrelated tenants together. + */ +async function enforceConnectionRateLimit(principal: ScimConnectionPrincipal): Promise { + const { allowed, resetAt } = await rateLimiter.checkRateLimitDirect( + `route:scim:connection:${principal.connectionId}`, + SCIM_RATE_LIMIT + ) + if (allowed) return + const retryAfter = Math.max(1, Math.ceil((resetAt.getTime() - Date.now()) / 1000)) + throw new ScimError(429, undefined, 'Rate limit exceeded', { + 'Retry-After': String(retryAfter), + 'X-RateLimit-Reset': resetAt.toISOString(), + }) +} + +export function createScimRouteBuilder(dependencies: ScimRouteDependencies) { + return function defineScimRoute< + C extends AnyApiRouteContract, + O extends ApplicationOperation, + I, + R, + >(options: ScimRouteOptions): ScimNextRouteHandler { + if (options.operation.id !== options.useCase.operation.id) { + throw new Error( + `Route operation ${options.operation.id} does not match use case ${options.useCase.operation.id}` + ) + } + const isEmptyResponse = options.contract.response.mode === 'empty' + if (!isEmptyResponse && !options.present) { + throw new Error(`${options.contract.method} ${options.contract.path} requires a presenter`) + } + const successStatus = (() => { + const declared = options.contract.response.status + if (declared === undefined) return 200 + return Array.isArray(declared) ? declared[0] : (declared as number) + })() + + return withRouteHandler( + async (request, context) => { + const startedAt = Date.now() + let principal: ScimConnectionPrincipal | undefined + let status = 500 + let scimType: ScimType | undefined + let detail: string | undefined + + try { + if (request.method !== options.contract.method) { + throw new ScimError(405, undefined, `${request.method} is not supported here`) + } + assertAcceptableMediaType(request) + + principal = await dependencies.authenticate(request) + if (!principal.scopes.includes(options.scope)) { + throw new ScimError( + 403, + undefined, + `The credential does not carry the ${options.scope} scope` + ) + } + await enforceConnectionRateLimit(principal) + + const parsed = await parseRequest(options.contract, request, context ?? {}, { + maxBodyBytes: SCIM_MAX_BODY_BYTES, + validationErrorResponse: (error) => + NextResponse.json( + scimErrorBody(400, 'invalidValue', error.issues[0]?.message ?? 'Invalid request'), + { status: 400 } + ), + invalidJsonResponse: () => + NextResponse.json( + scimErrorBody(400, 'invalidSyntax', 'Request body is not valid JSON'), + { status: 400 } + ), + payloadTooLargeResponse: () => + NextResponse.json(scimErrorBody(413, undefined, 'Request body is too large'), { + status: 413, + }), + /** + * Entra sends `excludedAttributes=` with an empty value on some list + * calls; treating that as a client error would fail an ordinary sync. + */ + rejectBlankQueryValues: false, + }) + if (!parsed.success) { + status = parsed.response.status + return scimResponse(await parsed.response.json(), status) + } + + const baseUrl = dependencies.baseUrl() + const input = options.mapInput(parsed.data, { principal, request }) + const result = await options.useCase.execute({ principal, input, request }) + + if (isEmptyResponse) { + status = successStatus + return new Response(null, { + status, + headers: { 'cache-control': 'no-store' }, + }) + } + + const presented = options.present!(result, { principal, baseUrl }) + const validated = + options.contract.response.mode === 'json' + ? options.contract.response.schema.parse(presented) + : presented + status = successStatus + return scimResponse(validated, status, options.headers?.(result, { principal, baseUrl })) + } catch (error) { + const scim = toScimError(error) + status = scim.status + scimType = scim.scimType + detail = scim.message + if (scim.status >= 500) { + logger.error('SCIM request failed', { + connectionId: principal?.connectionId, + path: options.contract.path, + error, + }) + } + return scimErrorResponse(scim) + } finally { + if (principal) { + dependencies.recordRequest({ + principal, + method: request.method, + path: options.contract.path, + status, + ...(scimType ? { scimType } : {}), + ...(detail ? { detail } : {}), + userAgent: request.headers.get('user-agent'), + durationMs: Date.now() - startedAt, + }) + } + } + }, + { + /** + * The terminal envelopes have to speak SCIM too. A provider that receives + * Sim's `{ error }` shape on an unhandled fault logs an unparsable + * response, which is materially harder to diagnose than a typed one. + */ + typedErrorResponse: ({ error, status }) => + scimResponse(scimErrorBody(status, undefined, error.message), status), + unhandledErrorResponse: () => + scimResponse(scimErrorBody(500, undefined, 'Internal server error'), 500), + clientAbortResponse: () => new Response(null, { status: 499 }), + } + ) + } +} + +/** + * A discovery route: unauthenticated, static, and identical for every tenant. + * + * RFC 7644 requires these to be reachable so a provider can negotiate before it + * holds a credential, and they disclose only what this server implements. + */ +export function defineScimDiscoveryRoute( + build: (baseUrl: string, params: Record) => unknown +): ScimNextRouteHandler { + return withRouteHandler( + async (request, context) => { + try { + if (request.method !== 'GET') { + throw new ScimError(405, undefined, `${request.method} is not supported here`) + } + const params = context?.params ? await context.params : {} + return scimResponse(build(`${getBaseUrl()}${SCIM_BASE_PATH}`, params), 200) + } catch (error) { + return scimErrorResponse(toScimError(error)) + } + }, + { + typedErrorResponse: ({ error, status }) => + scimResponse(scimErrorBody(status, undefined, error.message), status), + unhandledErrorResponse: () => + scimResponse(scimErrorBody(500, undefined, 'Internal server error'), 500), + } + ) +} + +/** Narrows an arbitrary principal to a SCIM connection, for use-case entry points. */ +export function isScimConnectionPrincipal( + principal: Principal +): principal is ScimConnectionPrincipal { + return principal.kind === 'scim_connection' +} diff --git a/apps/sim/lib/api/server/routes/v2-api-key-auth.ts b/apps/sim/lib/api/server/routes/v2-api-key-auth.ts index e147c28dbab..b14598629d7 100644 --- a/apps/sim/lib/api/server/routes/v2-api-key-auth.ts +++ b/apps/sim/lib/api/server/routes/v2-api-key-auth.ts @@ -47,6 +47,7 @@ interface ApiKeyRow { type: string expiresAt: Date | null userBanned: boolean | null + userSuspendedAt: Date | null } function requireValidRow(row: ApiKeyRow | undefined): ApiKeyRow { @@ -58,6 +59,11 @@ function requireValidRow(row: ApiKeyRow | undefined): ApiKeyRow { throw new Error(`Personal API key ${row.id} is missing its credential owner`) } if (row.userBanned) throw new V2ApiKeyUnauthenticatedError() + /** + * A suspension keeps the account's resources — and therefore its keys — + * intact, so refusing the key here is what ends its machine access. + */ + if (row.userSuspendedAt) throw new V2ApiKeyUnauthenticatedError() return row } if (row.type === 'workspace' && row.workspaceId) return row @@ -92,6 +98,7 @@ export async function authenticateV2ApiKey( type: apiKey.type, expiresAt: apiKey.expiresAt, userBanned: user.banned, + userSuspendedAt: user.suspendedAt, }) .from(apiKey) .leftJoin(user, eq(apiKey.userId, user.id)) diff --git a/apps/sim/lib/auth/auth.ts b/apps/sim/lib/auth/auth.ts index e01cc509be7..d917b355c88 100644 --- a/apps/sim/lib/auth/auth.ts +++ b/apps/sim/lib/auth/auth.ts @@ -643,19 +643,36 @@ export const auth = betterAuth({ session: { create: { before: async (session) => { - // Blocked emails/domains must not establish sessions, regardless of - // provider (email/password, OAuth, SSO). Deliberately outside the - // try below — a thrown APIError must propagate, not be swallowed. + // Blocked emails/domains and suspended accounts must not establish + // sessions, regardless of provider (email/password, OAuth, SSO). + // Deliberately outside the try below — a thrown APIError must + // propagate, not be swallowed. const accessControl = await getAccessControlConfig() + const [sessionUser] = await db + .select({ email: schema.user.email, suspendedAt: schema.user.suspendedAt }) + .from(schema.user) + .where(eq(schema.user.id, session.userId)) + .limit(1) + + /** + * A suspension leaves the account's resources intact, so nothing else + * in the sign-in path refuses it. This is the gate that makes a + * directory deactivation take effect on the next sign-in attempt; + * existing sessions are deleted when the suspension is applied. + */ + if (sessionUser?.suspendedAt) { + logger.warn('Blocking session creation for suspended account', { + userId: session.userId, + }) + throw new APIError('FORBIDDEN', { + message: 'This account is suspended. Please contact your administrator.', + }) + } + if ( accessControl.blockedSignupDomains.length > 0 || accessControl.blockedEmails.length > 0 ) { - const [sessionUser] = await db - .select({ email: schema.user.email }) - .from(schema.user) - .where(eq(schema.user.id, session.userId)) - .limit(1) if (isEmailBlockedByAccessControl(sessionUser?.email, accessControl)) { logger.warn('Blocking session creation for blocked account', { userId: session.userId, diff --git a/apps/sim/lib/compare/data/sim.ts b/apps/sim/lib/compare/data/sim.ts index 8bf43d4c589..ec777532b99 100644 --- a/apps/sim/lib/compare/data/sim.ts +++ b/apps/sim/lib/compare/data/sim.ts @@ -1008,8 +1008,8 @@ export const simProfile: CompetitorProfile = { }, sso: { value: - 'Yes: SAML 2.0 and OIDC single sign-on, with users routed to SSO by their email domain and automatically provisioned into the organization on first sign-in', - shortValue: 'SAML 2.0 and OIDC SSO with auto-provisioning', + 'Yes: SAML 2.0 and OIDC single sign-on, with users routed to SSO by their email domain, plus SCIM 2.0 directory provisioning for Okta, Microsoft Entra ID, OneLogin, and JumpCloud that creates, updates, deactivates, and removes members and maps pushed groups to permission groups, workspace access, and the organization admin role', + shortValue: 'SAML 2.0 and OIDC SSO with SCIM 2.0 provisioning', confidence: 'verified', sources: [ { @@ -1017,6 +1017,11 @@ export const simProfile: CompetitorProfile = { label: 'Sim Docs: Single Sign-On (SSO)', asOf: '2026-07-02', }, + { + url: 'https://docs.sim.ai/platform/enterprise/scim', + label: 'Sim Docs: Directory provisioning (SCIM)', + asOf: '2026-09-07', + }, ], }, sessionPolicy: { diff --git a/apps/sim/lib/core/application/forbidden.ts b/apps/sim/lib/core/application/forbidden.ts index 766b0891c69..f34c4ce25b5 100644 --- a/apps/sim/lib/core/application/forbidden.ts +++ b/apps/sim/lib/core/application/forbidden.ts @@ -64,6 +64,8 @@ export const FORBIDDEN_DETAIL_CODES = [ 'PERMISSION_GROUP_CAPABILITY_BLOCKED', /** The workspace does not permit the integration the request names. */ 'INTEGRATION_NOT_ALLOWED', + /** The organization's identity provider owns this membership, so Sim will not change it. */ + 'SCIM_MANAGED_MEMBERSHIP', ] as const export type ForbiddenDetailCode = (typeof FORBIDDEN_DETAIL_CODES)[number] @@ -113,6 +115,8 @@ export const FORBIDDEN_DETAIL_CODE_DESCRIPTIONS: Record { * Every principal kind an operation can name. `credential_group_enrollment` * authenticates one enrollment flow, while `system` is an infrastructure-owned * workflow execution identity; neither performs a semantic resource operation. + * + * `scim_connection` is excluded for a different reason: it is an organization's + * identity provider, which provisions membership and never reads or writes a + * workspace resource. Leaving it out makes that a compile-time fact — a + * workspace operation cannot name it even by accident — and SCIM declares its + * own operation type in `lib/scim/application/operations.ts`, the way + * organization BYOK does. */ -export type PrincipalKind = Exclude +export type PrincipalKind = Exclude< + Principal['kind'], + 'credential_group_enrollment' | 'system' | 'scim_connection' +> /** * A principal kind a non-workspace operation may name. `delegated` is excluded diff --git a/apps/sim/lib/core/application/workspace-authorization.ts b/apps/sim/lib/core/application/workspace-authorization.ts index 2b834162911..4d5d3f04bc3 100644 --- a/apps/sim/lib/core/application/workspace-authorization.ts +++ b/apps/sim/lib/core/application/workspace-authorization.ts @@ -45,6 +45,7 @@ export function capabilityGovernedPrincipalUserId(principal: Principal): string case 'workspace_api_key': case 'system': case 'credential_group_enrollment': + case 'scim_connection': return null case 'delegated': { if (principal.serviceId === 'executor') return null diff --git a/apps/sim/lib/core/config/deployment-shape.ts b/apps/sim/lib/core/config/deployment-shape.ts index a00429c6fce..299610a5ff6 100644 --- a/apps/sim/lib/core/config/deployment-shape.ts +++ b/apps/sim/lib/core/config/deployment-shape.ts @@ -14,6 +14,7 @@ import { isHosted, isInboxEnabled, isSandboxesEnabled, + isScimEnabled, isSessionPoliciesEnabled, isSsoEnabled, isUsageMonitoringEnabled, @@ -94,6 +95,7 @@ export function resolveDeploymentShape(): DeploymentShape { dataRetention: isDataRetentionEnabled, inbox: isInboxEnabled, sandboxes: isSandboxesEnabled, + scim: isScimEnabled, sessionPolicies: isSessionPoliciesEnabled, sso: isSsoEnabled, usageMonitoring: isUsageMonitoringEnabled, diff --git a/apps/sim/lib/core/config/enterprise-entitlements.ts b/apps/sim/lib/core/config/enterprise-entitlements.ts index f48fd8ca9a0..55635084fc7 100644 --- a/apps/sim/lib/core/config/enterprise-entitlements.ts +++ b/apps/sim/lib/core/config/enterprise-entitlements.ts @@ -35,6 +35,7 @@ export type EnterpriseFeature = | 'inbox' | 'organizations' | 'sandboxes' + | 'scim' | 'sessionPolicies' | 'sso' | 'usageMonitoring' @@ -82,6 +83,7 @@ export const ENTERPRISE_FEATURE_LEGACY_DEFAULTS: Readonly{var R5=Object.create;var{getPrototypeOf:L5,defineProperty:r1,getOwnPropertyNames:I5}=Object;var O5=Object.prototype.hasOwnProperty;function H5(B){return this[B]}var F5,W5,P5=(B,U,G)=>{var Y=B!=null&&typeof B==="object";if(Y){var Q=U?F5??=new WeakMap:W5??=new WeakMap,K=Q.get(B);if(K)return K}G=B!=null?R5(L5(B)):{};let Z=U||!B||!B.__esModule?r1(G,"default",{value:B,enumerable:!0}):G;for(let J of I5(B))if(!O5.call(Z,J))r1(Z,J,{get:H5.bind(B,J),enumerable:!0});if(Y)Q.set(B,Z);return Z};var A5=(B,U)=>()=>(U||B((U={exports:{}}).exports,U),U.exports);var j5=(B)=>B;function N5(B,U){this[B]=j5.bind(null,U)}var w5=(B,U)=>{for(var G in U)r1(B,G,{get:U[G],enumerable:!0,configurable:!0,set:N5.bind(U,G)})};var h6=A5((L7,_6)=>{var z0=_6.exports={},p0,r0;function Z8(){throw Error("setTimeout has not been defined")}function Q8(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")p0=setTimeout;else p0=Z8}catch(B){p0=Z8}try{if(typeof clearTimeout==="function")r0=clearTimeout;else r0=Q8}catch(B){r0=Q8}})();function g6(B){if(p0===setTimeout)return setTimeout(B,0);if((p0===Z8||!p0)&&setTimeout)return p0=setTimeout,setTimeout(B,0);try{return p0(B,0)}catch(U){try{return p0.call(null,B,0)}catch(G){return p0.call(this,B,0)}}}function UU(B){if(r0===clearTimeout)return clearTimeout(B);if((r0===Q8||!r0)&&clearTimeout)return r0=clearTimeout,clearTimeout(B);try{return r0(B)}catch(U){try{return r0.call(null,B)}catch(G){return r0.call(this,B)}}}var Q2=[],b2=!1,z2,w1=-1;function GU(){if(!b2||!z2)return;if(b2=!1,z2.length)Q2=z2.concat(Q2);else w1=-1;if(Q2.length)f6()}function f6(){if(b2)return;var B=g6(GU);b2=!0;var U=Q2.length;while(U){z2=Q2,Q2=[];while(++w11)for(var G=1;G"u")A1.global=globalThis;if(typeof A1.__require>"u")A1.__require=(B)=>{throw Error(`Dynamic require of "${B}" is not supported in the sandbox`)};var l0=[],h0=[],i1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(N2=0,H6=i1.length;N20)throw Error("Invalid string. Length must be a multiple of 4");var G=B.indexOf("=");if(G===-1)G=U;var Y=G===U?0:4-G%4;return[G,Y]}function E5(B,U){return(B+U)*3/4-U}function D5(B){var U,G=z5(B),Y=G[0],Q=G[1],K=new Uint8Array(E5(Y,Q)),Z=0,J=Q>0?Y-4:Y,q;for(q=0;q>16&255,K[Z++]=U>>8&255,K[Z++]=U&255;if(Q===2)U=h0[B.charCodeAt(q)]<<2|h0[B.charCodeAt(q+1)]>>4,K[Z++]=U&255;if(Q===1)U=h0[B.charCodeAt(q)]<<10|h0[B.charCodeAt(q+1)]<<4|h0[B.charCodeAt(q+2)]>>2,K[Z++]=U>>8&255,K[Z++]=U&255;return K}function T5(B){return l0[B>>18&63]+l0[B>>12&63]+l0[B>>6&63]+l0[B&63]}function C5(B,U,G){var Y,Q=[];for(var K=U;KJ?J:Z+K));if(Y===1)U=B[G-1],Q.push(l0[U>>2]+l0[U<<4&63]+"==");else if(Y===2)U=(B[G-2]<<8)+B[G-1],Q.push(l0[U>>10]+l0[U>>4&63]+l0[U<<2&63]+"=");return Q.join("")}function j1(B,U,G,Y,Q){var K,Z,J=Q*8-Y-1,q=(1<>1,I=-7,H=G?Q-1:0,T=G?-1:1,A=B[U+H];H+=T,K=A&(1<<-I)-1,A>>=-I,I+=J;for(;I>0;K=K*256+B[U+H],H+=T,I-=8);Z=K&(1<<-I)-1,K>>=-I,I+=Y;for(;I>0;Z=Z*256+B[U+H],H+=T,I-=8);if(K===0)K=1-W;else if(K===q)return Z?NaN:(A?-1:1)*(1/0);else Z=Z+Math.pow(2,Y),K=K-W;return(A?-1:1)*Z*Math.pow(2,K-Y)}function N6(B,U,G,Y,Q,K){var Z,J,q,W=K*8-Q-1,I=(1<>1,T=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=Y?0:K-1,P=Y?1:-1,j=U<0||U===0&&1/U<0?1:0;if(U=Math.abs(U),isNaN(U)||U===1/0)J=isNaN(U)?1:0,Z=I;else{if(Z=Math.floor(Math.log(U)/Math.LN2),U*(q=Math.pow(2,-Z))<1)Z--,q*=2;if(Z+H>=1)U+=T/q;else U+=T*Math.pow(2,1-H);if(U*q>=2)Z++,q/=2;if(Z+H>=I)J=0,Z=I;else if(Z+H>=1)J=(U*q-1)*Math.pow(2,Q),Z=Z+H;else J=U*Math.pow(2,H-1)*Math.pow(2,Q),Z=0}for(;Q>=8;B[G+A]=J&255,A+=P,J/=256,Q-=8);Z=Z<0;B[G+A]=Z&255,A+=P,Z/=256,W-=8);B[G+A-P]|=j*128}var W6=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,k5=50,n1=2147483647;var{btoa:Z7,atob:Q7,File:J7,Blob:K7}=globalThis;function Z2(B){if(B>n1)throw RangeError('The value "'+B+'" is invalid for option "size"');let U=new Uint8Array(B);return Object.setPrototypeOf(U,J0.prototype),U}function B8(B,U,G){return class extends G{constructor(){super();Object.defineProperty(this,"message",{value:U.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}var $5=B8("ERR_BUFFER_OUT_OF_BOUNDS",function(B){if(B)return`${B} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),S5=B8("ERR_INVALID_ARG_TYPE",function(B,U){return`The "${B}" argument must be of type number. Received type ${typeof U}`},TypeError),s1=B8("ERR_OUT_OF_RANGE",function(B,U,G){let Y=`The value of "${B}" is out of range.`,Q=G;if(Number.isInteger(G)&&Math.abs(G)>4294967296)Q=j6(String(G));else if(typeof G==="bigint"){if(Q=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))Q=j6(Q);Q+="n"}return Y+=` It must be ${U}. Received ${Q}`,Y},RangeError);function J0(B,U,G){if(typeof B==="number"){if(typeof U==="string")throw TypeError('The "string" argument must be of type string. Received type number');return U8(B)}return w6(B,U,G)}Object.defineProperty(J0.prototype,"parent",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.buffer}});Object.defineProperty(J0.prototype,"offset",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.byteOffset}});J0.poolSize=8192;function w6(B,U,G){if(typeof B==="string")return v5(B,U);if(ArrayBuffer.isView(B))return y5(B);if(B==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(a0(B,ArrayBuffer)||B&&a0(B.buffer,ArrayBuffer))return t1(B,U,G);if(typeof SharedArrayBuffer<"u"&&(a0(B,SharedArrayBuffer)||B&&a0(B.buffer,SharedArrayBuffer)))return t1(B,U,G);if(typeof B==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Y=B.valueOf&&B.valueOf();if(Y!=null&&Y!==B)return J0.from(Y,U,G);let Q=g5(B);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]==="function")return J0.from(B[Symbol.toPrimitive]("string"),U,G);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}J0.from=function(B,U,G){return w6(B,U,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);function z6(B){if(typeof B!=="number")throw TypeError('"size" argument must be of type number');else if(B<0)throw RangeError('The value "'+B+'" is invalid for option "size"')}function b5(B,U,G){if(z6(B),B<=0)return Z2(B);if(U!==void 0)return typeof G==="string"?Z2(B).fill(U,G):Z2(B).fill(U);return Z2(B)}J0.alloc=function(B,U,G){return b5(B,U,G)};function U8(B){return z6(B),Z2(B<0?0:G8(B)|0)}J0.allocUnsafe=function(B){return U8(B)};J0.allocUnsafeSlow=function(B){return U8(B)};function v5(B,U){if(typeof U!=="string"||U==="")U="utf8";if(!J0.isEncoding(U))throw TypeError("Unknown encoding: "+U);let G=E6(B,U)|0,Y=Z2(G),Q=Y.write(B,U);if(Q!==G)Y=Y.slice(0,Q);return Y}function o1(B){let U=B.length<0?0:G8(B.length)|0,G=Z2(U);for(let Y=0;Y=n1)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n1.toString(16)+" bytes");return B|0}J0.isBuffer=function(B){return B!=null&&B._isBuffer===!0&&B!==J0.prototype};J0.compare=function(B,U){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(a0(U,Uint8Array))U=J0.from(U,U.offset,U.byteLength);if(!J0.isBuffer(B)||!J0.isBuffer(U))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(B===U)return 0;let G=B.length,Y=U.length;for(let Q=0,K=Math.min(G,Y);QY.length){if(!J0.isBuffer(K))K=J0.from(K);K.copy(Y,Q)}else Uint8Array.prototype.set.call(Y,K,Q);else if(!J0.isBuffer(K))throw TypeError('"list" argument must be an Array of Buffers');else K.copy(Y,Q);Q+=K.length}return Y};function E6(B,U){if(J0.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||a0(B,ArrayBuffer))return B.byteLength;if(typeof B!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);let G=B.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&G===0)return 0;let Q=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return e1(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return y6(B).length;default:if(Q)return Y?-1:e1(B).length;U=(""+U).toLowerCase(),Q=!0}}J0.byteLength=E6;function f5(B,U,G){let Y=!1;if(U===void 0||U<0)U=0;if(U>this.length)return"";if(G===void 0||G>this.length)G=this.length;if(G<=0)return"";if(G>>>=0,U>>>=0,G<=U)return"";if(!B)B="utf8";while(!0)switch(B){case"hex":return p5(this,U,G);case"utf8":case"utf-8":return T6(this,U,G);case"ascii":return l5(this,U,G);case"latin1":case"binary":return a5(this,U,G);case"base64":return c5(this,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r5(this,U,G);default:if(Y)throw TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),Y=!0}}J0.prototype._isBuffer=!0;function w2(B,U,G){let Y=B[U];B[U]=B[G],B[G]=Y}J0.prototype.swap16=function(){let B=this.length;if(B%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let U=0;UU)B+=" ... ";return""};if(W6)J0.prototype[W6]=J0.prototype.inspect;J0.prototype.compare=function(B,U,G,Y,Q){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(!J0.isBuffer(B))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof B);if(U===void 0)U=0;if(G===void 0)G=B?B.length:0;if(Y===void 0)Y=0;if(Q===void 0)Q=this.length;if(U<0||G>B.length||Y<0||Q>this.length)throw RangeError("out of range index");if(Y>=Q&&U>=G)return 0;if(Y>=Q)return-1;if(U>=G)return 1;if(U>>>=0,G>>>=0,Y>>>=0,Q>>>=0,this===B)return 0;let K=Q-Y,Z=G-U,J=Math.min(K,Z),q=this.slice(Y,Q),W=B.slice(U,G);for(let I=0;I2147483647)G=2147483647;else if(G<-2147483648)G=-2147483648;if(G=+G,Number.isNaN(G))G=Q?0:B.length-1;if(G<0)G=B.length+G;if(G>=B.length)if(Q)return-1;else G=B.length-1;else if(G<0)if(Q)G=0;else return-1;if(typeof U==="string")U=J0.from(U,Y);if(J0.isBuffer(U)){if(U.length===0)return-1;return P6(B,U,G,Y,Q)}else if(typeof U==="number"){if(U=U&255,typeof Uint8Array.prototype.indexOf==="function")if(Q)return Uint8Array.prototype.indexOf.call(B,U,G);else return Uint8Array.prototype.lastIndexOf.call(B,U,G);return P6(B,[U],G,Y,Q)}throw TypeError("val must be string, number or Buffer")}function P6(B,U,G,Y,Q){let K=1,Z=B.length,J=U.length;if(Y!==void 0){if(Y=String(Y).toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le"){if(B.length<2||U.length<2)return-1;K=2,Z/=2,J/=2,G/=2}}function q(I,H){if(K===1)return I[H];else return I.readUInt16BE(H*K)}let W;if(Q){let I=-1;for(W=G;WZ)G=Z-J;for(W=G;W>=0;W--){let I=!0;for(let H=0;HQ)Y=Q;let K=U.length;if(Y>K/2)Y=K/2;let Z;for(Z=0;Z>>0,isFinite(G)){if(G=G>>>0,Y===void 0)Y="utf8"}else Y=G,G=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-U;if(G===void 0||G>Q)G=Q;if(B.length>0&&(G<0||U<0)||U>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!Y)Y="utf8";let K=!1;for(;;)switch(Y){case"hex":return x5(this,B,U,G);case"utf8":case"utf-8":return _5(this,B,U,G);case"ascii":case"latin1":case"binary":return h5(this,B,U,G);case"base64":return u5(this,B,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d5(this,B,U,G);default:if(K)throw TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),K=!0}};J0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c5(B,U,G){if(U===0&&G===B.length)return F6(B);else return F6(B.slice(U,G))}function T6(B,U,G){G=Math.min(B.length,G);let Y=[],Q=U;while(Q239?4:K>223?3:K>191?2:1;if(Q+J<=G){let q,W,I,H;switch(J){case 1:if(K<128)Z=K;break;case 2:if(q=B[Q+1],(q&192)===128){if(H=(K&31)<<6|q&63,H>127)Z=H}break;case 3:if(q=B[Q+1],W=B[Q+2],(q&192)===128&&(W&192)===128){if(H=(K&15)<<12|(q&63)<<6|W&63,H>2047&&(H<55296||H>57343))Z=H}break;case 4:if(q=B[Q+1],W=B[Q+2],I=B[Q+3],(q&192)===128&&(W&192)===128&&(I&192)===128){if(H=(K&15)<<18|(q&63)<<12|(W&63)<<6|I&63,H>65535&&H<1114112)Z=H}}}if(Z===null)Z=65533,J=1;else if(Z>65535)Z-=65536,Y.push(Z>>>10&1023|55296),Z=56320|Z&1023;Y.push(Z),Q+=J}return m5(Y)}var A6=4096;function m5(B){let U=B.length;if(U<=A6)return String.fromCharCode.apply(String,B);let G="",Y=0;while(YY)G=Y;let Q="";for(let K=U;KG)B=G;if(U<0){if(U+=G,U<0)U=0}else if(U>G)U=G;if(UG)throw RangeError("Trying to access beyond buffer length")}J0.prototype.readUintLE=J0.prototype.readUIntLE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B+--U],Q=1;while(U>0&&(Q*=256))Y+=this[B+--U]*Q;return Y};J0.prototype.readUint8=J0.prototype.readUInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);return this[B]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]|this[B+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]<<8|this[B+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return(this[B]|this[B+1]<<8|this[B+2]<<16)+this[B+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]*16777216+(this[B+1]<<16|this[B+2]<<8|this[B+3])};J0.prototype.readBigUInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U+this[++B]*256+this[++B]*65536+this[++B]*16777216,Q=this[++B]+this[++B]*256+this[++B]*65536+G*16777216;return BigInt(Y)+(BigInt(Q)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U*16777216+this[++B]*65536+this[++B]*256+this[++B],Q=this[++B]*16777216+this[++B]*65536+this[++B]*256+G;return(BigInt(Y)<>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K=Q)Y-=Math.pow(2,8*U);return Y};J0.prototype.readIntBE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=U,Q=1,K=this[B+--Y];while(Y>0&&(Q*=256))K+=this[B+--Y]*Q;if(Q*=128,K>=Q)K-=Math.pow(2,8*U);return K};J0.prototype.readInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);if(!(this[B]&128))return this[B];return(255-this[B]+1)*-1};J0.prototype.readInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B]|this[B+1]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B+1]|this[B]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]|this[B+1]<<8|this[B+2]<<16|this[B+3]<<24};J0.prototype.readInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]<<24|this[B+1]<<16|this[B+2]<<8|this[B+3]};J0.prototype.readBigInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=this[B+4]+this[B+5]*256+this[B+6]*65536+(G<<24);return(BigInt(Y)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=(U<<24)+this[++B]*65536+this[++B]*256+this[++B];return(BigInt(Y)<>>0,!U)$0(B,4,this.length);return j1(this,B,!0,23,4)};J0.prototype.readFloatBE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return j1(this,B,!1,23,4)};J0.prototype.readDoubleLE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!0,52,8)};J0.prototype.readDoubleBE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!1,52,8)};function g0(B,U,G,Y,Q,K){if(!J0.isBuffer(B))throw TypeError('"buffer" argument must be a Buffer instance');if(U>Q||UB.length)throw RangeError("Index out of range")}J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=1,K=0;this[U]=B&255;while(++K>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=G-1,K=1;this[U+Q]=B&255;while(--Q>=0&&(K*=256))this[U+Q]=B/K&255;return U+G};J0.prototype.writeUint8=J0.prototype.writeUInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,255,0);return this[U]=B&255,U+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U+3]=B>>>24,this[U+2]=B>>>16,this[U+1]=B>>>8,this[U]=B&255,U+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};function C6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,G}function k6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G+7]=K,K=K>>8,B[G+6]=K,K=K>>8,B[G+5]=K,K=K>>8,B[G+4]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G+3]=Z,Z=Z>>8,B[G+2]=Z,Z=Z>>8,B[G+1]=Z,Z=Z>>8,B[G]=Z,G+8}J0.prototype.writeBigUInt64LE=I2(function(B,U=0){return C6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=I2(function(B,U=0){return k6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=0,K=1,Z=0;this[U]=B&255;while(++Q>0)-Z&255}return U+G};J0.prototype.writeIntBE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=G-1,K=1,Z=0;this[U+Q]=B&255;while(--Q>=0&&(K*=256)){if(B<0&&Z===0&&this[U+Q+1]!==0)Z=1;this[U+Q]=(B/K>>0)-Z&255}return U+G};J0.prototype.writeInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,127,-128);if(B<0)B=255+B+1;return this[U]=B&255,U+1};J0.prototype.writeInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);return this[U]=B&255,this[U+1]=B>>>8,this[U+2]=B>>>16,this[U+3]=B>>>24,U+4};J0.prototype.writeInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);if(B<0)B=4294967295+B+1;return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};J0.prototype.writeBigInt64LE=I2(function(B,U=0){return C6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=I2(function(B,U=0){return k6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $6(B,U,G,Y,Q,K){if(G+Y>B.length)throw RangeError("Index out of range");if(G<0)throw RangeError("Index out of range")}function S6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return N6(B,U,G,Y,23,4),G+4}J0.prototype.writeFloatLE=function(B,U,G){return S6(this,B,U,!0,G)};J0.prototype.writeFloatBE=function(B,U,G){return S6(this,B,U,!1,G)};function b6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return N6(B,U,G,Y,52,8),G+8}J0.prototype.writeDoubleLE=function(B,U,G){return b6(this,B,U,!0,G)};J0.prototype.writeDoubleBE=function(B,U,G){return b6(this,B,U,!1,G)};J0.prototype.copy=function(B,U,G,Y){if(!J0.isBuffer(B))throw TypeError("argument should be a Buffer");if(!G)G=0;if(!Y&&Y!==0)Y=this.length;if(U>=B.length)U=B.length;if(!U)U=0;if(Y>0&&Y=this.length)throw RangeError("Index out of range");if(Y<0)throw RangeError("sourceEnd out of bounds");if(Y>this.length)Y=this.length;if(B.length-U>>0,G=G===void 0?this.length:G>>>0,!B)B=0;let Q;if(typeof B==="number")for(Q=U;Q=Y+4;G-=3)U=`_${B.slice(G-3,G)}${U}`;return`${B.slice(0,G)}${U}`}function i5(B,U,G){if(S2(U,"offset"),B[U]===void 0||B[U+G]===void 0)n2(U,B.length-(G+1))}function v6(B,U,G,Y,Q,K){if(B>G||B3)if(U===0||U===BigInt(0))J=`>= 0${Z} and < 2${Z} ** ${(K+1)*8}${Z}`;else J=`>= -(2${Z} ** ${(K+1)*8-1}${Z}) and < 2 ** ${(K+1)*8-1}${Z}`;else J=`>= ${U}${Z} and <= ${G}${Z}`;throw new s1("value",J,B)}i5(Y,Q,K)}function S2(B,U){if(typeof B!=="number")throw new S5(U,"number",B)}function n2(B,U,G){if(Math.floor(B)!==B)throw S2(B,G),new s1(G||"offset","an integer",B);if(U<0)throw new $5;throw new s1(G||"offset",`>= ${G?1:0} and <= ${U}`,B)}var n5=/[^+/0-9A-Za-z-_]/g;function s5(B){if(B=B.split("=")[0],B=B.trim().replace(n5,""),B.length<2)return"";while(B.length%4!==0)B=B+"=";return B}function e1(B,U){U=U||1/0;let G,Y=B.length,Q=null,K=[];for(let Z=0;Z55295&&G<57344){if(!Q){if(G>56319){if((U-=3)>-1)K.push(239,191,189);continue}else if(Z+1===Y){if((U-=3)>-1)K.push(239,191,189);continue}Q=G;continue}if(G<56320){if((U-=3)>-1)K.push(239,191,189);Q=G;continue}G=(Q-55296<<10|G-56320)+65536}else if(Q){if((U-=3)>-1)K.push(239,191,189)}if(Q=null,G<128){if((U-=1)<0)break;K.push(G)}else if(G<2048){if((U-=2)<0)break;K.push(G>>6|192,G&63|128)}else if(G<65536){if((U-=3)<0)break;K.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((U-=4)<0)break;K.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw Error("Invalid code point")}return K}function o5(B){let U=[];for(let G=0;G>8,Q=G%256,K.push(Q),K.push(Y)}return K}function y6(B){return D5(s5(B))}function N1(B,U,G,Y){let Q;for(Q=0;Q=U.length||Q>=B.length)break;U[Q+G]=B[Q]}return Q}function a0(B,U){return B instanceof U||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===U.name}var e5=function(){let B=Array(256);for(let U=0;U<16;++U){let G=U*16;for(let Y=0;Y<16;++Y)B[G+Y]="0123456789abcdef"[U]+"0123456789abcdef"[Y]}return B}();function I2(B){return typeof BigInt>"u"?BU:B}function BU(){throw Error("BigInt not supported")}function Y8(B){return()=>{throw Error(B+" is not implemented for node:buffer browser polyfill")}}var V7=Y8("resolveObjectURL"),X7=Y8("isUtf8");var q7=Y8("transcode");var G7=P5(h6(),1);var L6={};w5(L6,{unsignedDecimalNumber:()=>X1,universalMeasureValue:()=>q1,uniqueUuid:()=>eB,uniqueNumericIdCreator:()=>I1,uniqueId:()=>O1,uCharHexNumber:()=>W8,twipsMeasureValue:()=>E0,standardizeData:()=>j4,signedTwipsMeasureValue:()=>t0,signedHpsMeasureValue:()=>VG,shortHexNumber:()=>SB,sectionPageSizeDefaults:()=>$1,sectionMarginDefaults:()=>H2,positiveUniversalMeasureValue:()=>d8,pointMeasureValue:()=>gB,percentageValue:()=>vB,patchDocument:()=>tK,patchDetector:()=>B7,measurementOrPercentValue:()=>c8,longHexNumber:()=>KG,hpsMeasureValue:()=>bB,hexColorValue:()=>C2,hashedId:()=>P8,encodeUtf8:()=>U1,eighthPointMeasureValue:()=>yB,docPropertiesUniqueNumericIdGen:()=>oB,decimalNumber:()=>T0,dateTimeValue:()=>fB,createWrapTopAndBottom:()=>H4,createWrapTight:()=>O4,createWrapSquare:()=>I4,createWrapNone:()=>j8,createVerticalPosition:()=>J4,createVerticalAlign:()=>U6,createUnderline:()=>cB,createTransformation:()=>n8,createTableWidthElement:()=>J1,createTableRowHeight:()=>W9,createTableLook:()=>F9,createTableLayout:()=>O9,createTableFloatProperties:()=>I9,createTabStopItem:()=>b4,createTabStop:()=>v4,createStringElement:()=>f2,createSpacing:()=>S4,createSimplePos:()=>G4,createShading:()=>M1,createSectionType:()=>C9,createRunFonts:()=>T1,createParagraphStyle:()=>x2,createPageSize:()=>D9,createPageNumberType:()=>E9,createPageMargin:()=>z9,createOutlineLevel:()=>_4,createMathSuperScriptProperties:()=>p4,createMathSuperScriptElement:()=>a2,createMathSubSuperScriptProperties:()=>i4,createMathSubScriptProperties:()=>r4,createMathSubScriptElement:()=>l2,createMathPreSubSuperScriptProperties:()=>n4,createMathNAryProperties:()=>e8,createMathLimitLocation:()=>a4,createMathBase:()=>y0,createMathAccentCharacter:()=>l4,createLineNumberType:()=>N9,createIndent:()=>hB,createHorizontalPosition:()=>Q4,createHeaderFooterReference:()=>k1,createFrameProperties:()=>u4,createEmphasisMark:()=>r8,createDotEmphasisMark:()=>AG,createDocumentGrid:()=>j9,createColumns:()=>A9,createBorderElement:()=>j0,createBodyProperties:()=>K4,createAlignment:()=>m8,convertToXmlComponent:()=>u1,convertMillimetersToTwip:()=>dG,convertInchesToTwip:()=>u0,concreteNumUniqueNumericIdGen:()=>sB,commentIdToParaId:()=>w4,bookmarkUniqueNumericIdGen:()=>tB,abstractNumUniqueNumericIdGen:()=>nB,YearShort:()=>oY,YearLong:()=>BZ,XmlComponent:()=>t,XmlAttributeComponent:()=>H0,WpsShapeRun:()=>SY,WpgGroupRun:()=>bY,WidthType:()=>v1,WORKAROUND4:()=>oZ,WORKAROUND3:()=>JG,WORKAROUND2:()=>NJ,VerticalPositionRelativeFrom:()=>U4,VerticalPositionAlign:()=>MG,VerticalMergeType:()=>G6,VerticalMergeRevisionType:()=>FQ,VerticalMerge:()=>z8,VerticalAnchor:()=>cG,VerticalAlignTable:()=>K9,VerticalAlignSection:()=>V9,VerticalAlign:()=>WQ,UnderlineType:()=>i8,ThematicBreak:()=>_B,Textbox:()=>TK,TextWrappingType:()=>e2,TextWrappingSide:()=>L4,TextRun:()=>Q1,TextEffect:()=>CG,TextDirection:()=>wQ,TableRowPropertiesChange:()=>P9,TableRowProperties:()=>J6,TableRow:()=>fQ,TableProperties:()=>Q6,TableOfContents:()=>RK,TableLayoutType:()=>SQ,TableCellBorders:()=>q9,TableCell:()=>Y6,TableBorders:()=>Z6,TableAnchorType:()=>DQ,Table:()=>yQ,TabStopType:()=>w8,TabStopPosition:()=>FZ,Tab:()=>T4,TDirection:()=>R9,SymbolRun:()=>aB,Styles:()=>S1,StyleLevel:()=>LK,StyleForParagraph:()=>p2,StyleForCharacter:()=>$2,StringValueElement:()=>q2,StringEnumValueElement:()=>XG,StringContainer:()=>O2,SpaceType:()=>x0,SoftHyphen:()=>iY,SimpleMailMergeField:()=>fY,SimpleField:()=>s8,ShadingType:()=>FG,SequentialIdentifier:()=>yY,Separator:()=>YZ,SectionType:()=>GJ,SectionPropertiesChange:()=>k9,SectionProperties:()=>K6,RunPropertiesDefaults:()=>a9,RunPropertiesChange:()=>lB,RunProperties:()=>U2,Run:()=>D0,RelativeVerticalPosition:()=>CQ,RelativeHorizontalPosition:()=>TQ,PrettifyType:()=>G5,PositionalTabRelativeTo:()=>XZ,PositionalTabLeader:()=>qZ,PositionalTabAlignment:()=>VZ,PositionalTab:()=>RZ,PatchType:()=>C8,ParagraphRunProperties:()=>mB,ParagraphPropertiesDefaults:()=>l9,ParagraphPropertiesChange:()=>d4,ParagraphProperties:()=>M2,Paragraph:()=>d0,PageTextDirectionType:()=>BJ,PageTextDirection:()=>T9,PageReference:()=>CZ,PageOrientation:()=>g1,PageNumberSeparator:()=>eQ,PageNumberElement:()=>QZ,PageNumber:()=>F2,PageBreakBefore:()=>$4,PageBreak:()=>LZ,PageBorders:()=>w9,PageBorderZOrder:()=>tQ,PageBorderOffsetFrom:()=>oQ,PageBorderDisplay:()=>sQ,Packer:()=>Y5,OverlapType:()=>kQ,OnOffElement:()=>q0,Numbering:()=>d9,NumberedItemReferenceFormat:()=>zZ,NumberedItemReference:()=>DZ,NumberValueElement:()=>_2,NumberProperties:()=>C1,NumberFormat:()=>RG,NoBreakHyphen:()=>rY,NextAttributeComponent:()=>$8,MonthShort:()=>sY,MonthLong:()=>eY,Media:()=>V6,MathSuperScript:()=>rZ,MathSum:()=>mZ,MathSubSuperScript:()=>nZ,MathSubScript:()=>iZ,MathSquareBrackets:()=>QQ,MathRun:()=>hZ,MathRoundBrackets:()=>ZQ,MathRadicalProperties:()=>o4,MathRadical:()=>BQ,MathPreSubSuperScript:()=>sZ,MathNumerator:()=>m4,MathLimitUpper:()=>aZ,MathLimitLower:()=>pZ,MathLimit:()=>B6,MathIntegral:()=>lZ,MathFunctionProperties:()=>e4,MathFunctionName:()=>t4,MathFunction:()=>UQ,MathFraction:()=>uZ,MathDenominator:()=>c4,MathDegree:()=>s4,MathCurlyBrackets:()=>JQ,MathAngledBrackets:()=>KQ,Math:()=>xZ,LineRuleType:()=>k2,LineNumberRestartFormat:()=>nQ,LevelSuffix:()=>TJ,LevelOverride:()=>u9,LevelFormat:()=>i0,LevelForOverride:()=>$J,LevelBase:()=>X6,Level:()=>h9,LeaderType:()=>HZ,LastRenderedPageBreak:()=>KZ,InternalHyperlink:()=>y4,InsertedTextRun:()=>MQ,InsertedTableRow:()=>U9,InsertedTableCell:()=>Y9,InitializableXmlComponent:()=>u8,ImportedXmlComponent:()=>kB,ImportedRootElementAttributes:()=>$B,ImageRun:()=>$Y,IgnoreIfEmptyXmlComponent:()=>R2,HyperlinkType:()=>jZ,HpsMeasureElement:()=>D1,HorizontalPositionRelativeFrom:()=>B4,HorizontalPositionAlign:()=>qG,HighlightColor:()=>kG,HeightRule:()=>gQ,HeadingLevel:()=>OZ,HeaderWrapper:()=>_9,HeaderFooterType:()=>E8,HeaderFooterReferenceType:()=>T2,Header:()=>IK,GridSpan:()=>M9,FrameWrap:()=>fZ,FrameAnchorType:()=>gZ,FootnoteReferenceRun:()=>HK,FootnoteReferenceElement:()=>GZ,FootnoteReference:()=>o9,FooterWrapper:()=>f9,Footer:()=>OK,FootNotes:()=>x9,FootNoteReferenceRunAttributes:()=>s9,FileChild:()=>H1,File:()=>VK,ExternalHyperlink:()=>t8,Endnotes:()=>g9,EndnoteReferenceRunAttributes:()=>t9,EndnoteReferenceRun:()=>FK,EndnoteReference:()=>D4,EndnoteIdReference:()=>e9,EmptyElement:()=>S0,EmphasisMarkType:()=>p8,EMPTY_OBJECT:()=>KB,DropCapType:()=>yZ,Drawing:()=>m1,DocumentGridType:()=>iQ,DocumentDefaults:()=>p9,DocumentBackgroundAttributes:()=>S9,DocumentBackground:()=>b9,DocumentAttributes:()=>F1,DocumentAttributeNamespaces:()=>y1,Document:()=>VK,DeletedTextRun:()=>OQ,DeletedTableRow:()=>G9,DeletedTableCell:()=>Z9,DayShort:()=>nY,DayLong:()=>tY,ContinuationSeparator:()=>ZZ,ConcreteNumbering:()=>T8,ConcreteHyperlink:()=>m2,CommentsExtended:()=>E4,Comments:()=>z4,CommentReference:()=>mY,CommentRangeStart:()=>dY,CommentRangeEnd:()=>cY,Comment:()=>N8,ColumnBreak:()=>IZ,Column:()=>ZJ,CheckBoxUtil:()=>B5,CheckBoxSymbolElement:()=>b1,CheckBox:()=>WK,CharacterSet:()=>kZ,CellMergeAttributes:()=>Q9,CellMerge:()=>J9,CarriageReturn:()=>JZ,BuilderElement:()=>M0,BorderStyle:()=>c1,Border:()=>xB,BookmarkStart:()=>f4,BookmarkEnd:()=>x4,Bookmark:()=>g4,Body:()=>$9,BaseXmlComponent:()=>Y1,Attributes:()=>C0,AnnotationReference:()=>UZ,AlignmentType:()=>c0,AbstractNumbering:()=>D8});var{create:YU,defineProperty:QB,getOwnPropertyDescriptor:ZU,getOwnPropertyNames:QU,getPrototypeOf:JU}=Object,KU=Object.prototype.hasOwnProperty,JB=(B,U)=>()=>(B&&(U=B(B=0)),U),R0=(B,U)=>()=>(U||(B((U={exports:{}}).exports,U),B=null),U.exports),VU=(B,U,G,Y)=>{if(U&&typeof U==="object"||typeof U==="function"){for(var Q=QU(U),K=0,Z=Q.length,J;KU[q]).bind(null,J),enumerable:!(Y=ZU(U,J))||Y.enumerable})}return B},k8=(B,U,G)=>(G=B!=null?YU(JU(B)):{},VU(U||!B||!B.__esModule?QB(G,"default",{value:B,enumerable:!0}):G,B)),z1=((B)=>__require)(function(B){return __require.apply(this,arguments)});function G1(B){return G1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},G1(B)}function XU(B,U){if(G1(B)!="object"||!B)return B;var G=B[Symbol.toPrimitive];if(G!==void 0){var Y=G.call(B,U||"default");if(G1(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return(U==="string"?String:Number)(B)}function qU(B){var U=XU(B,"string");return G1(U)=="symbol"?U:U+""}function e(B,U,G){return(U=qU(U))in B?Object.defineProperty(B,U,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[U]=G,B}var Y1=class{constructor(B){e(this,"rootKey",void 0),this.rootKey=B}},KB=Object.seal({}),t=class extends Y1{constructor(B){super(B);e(this,"root",void 0),this.root=[]}prepForXml(B){var U;B.stack.push(this);let G=this.root.map((Y)=>{if(Y instanceof Y1)return Y.prepForXml(B);return Y}).filter((Y)=>Y!==void 0);return B.stack.pop(),{[this.rootKey]:G.length?G.length===1&&((U=G[0])===null||U===void 0?void 0:U._attr)?G[0]:G:KB}}addChildElement(B){return this.root.push(B),this}},R2=class extends t{constructor(B,U){super(B);e(this,"includeIfEmpty",void 0),this.includeIfEmpty=U}prepForXml(B){let U=super.prepForXml(B);if(this.includeIfEmpty)return U;if(U&&(typeof U[this.rootKey]!=="object"||Object.keys(U[this.rootKey]).length))return U}};function u6(B,U){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);U&&(Y=Y.filter(function(Q){return Object.getOwnPropertyDescriptor(B,Q).enumerable})),G.push.apply(G,Y)}return G}function L0(B){for(var U=1;U{if(Y!==void 0){let Q=this.xmlKeys&&this.xmlKeys[G]||G;U[Q]=Y}}),{_attr:U}}},$8=class extends Y1{constructor(B){super("_attr");e(this,"root",void 0),this.root=B}prepForXml(B){return{_attr:Object.values(this.root).filter(({value:U})=>U!==void 0).reduce((U,{key:G,value:Y})=>L0(L0({},U),{},{[G]:Y}),{})}}},C0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}},S8=R0((B,U)=>{var G=typeof Reflect==="object"?Reflect:null,Y=G&&typeof G.apply==="function"?G.apply:function($,x,w){return Function.prototype.apply.call($,x,w)},Q;if(G&&typeof G.ownKeys==="function")Q=G.ownKeys;else if(Object.getOwnPropertySymbols)Q=function($){return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($))};else Q=function($){return Object.getOwnPropertyNames($)};function K(M){if(console&&console.warn)console.warn(M)}var Z=Number.isNaN||function($){return $!==$};function J(){J.init.call(this)}U.exports=J,U.exports.once=v,J.EventEmitter=J,J.prototype._events=void 0,J.prototype._eventsCount=0,J.prototype._maxListeners=void 0;var q=10;function W(M){if(typeof M!=="function")throw TypeError('The "listener" argument must be of type Function. Received type '+typeof M)}Object.defineProperty(J,"defaultMaxListeners",{enumerable:!0,get:function(){return q},set:function(M){if(typeof M!=="number"||M<0||Z(M))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+M+".");q=M}}),J.init=function(){if(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)this._events=Object.create(null),this._eventsCount=0;this._maxListeners=this._maxListeners||void 0},J.prototype.setMaxListeners=function($){if(typeof $!=="number"||$<0||Z($))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+$+".");return this._maxListeners=$,this};function I(M){if(M._maxListeners===void 0)return J.defaultMaxListeners;return M._maxListeners}J.prototype.getMaxListeners=function(){return I(this)},J.prototype.emit=function($){var x=[];for(var w=1;w0)b=x[0];if(b instanceof Error)throw b;var c=Error("Unhandled error."+(b?" ("+b.message+")":""));throw c.context=b,c}var D=U0[$];if(D===void 0)return!1;if(typeof D==="function")Y(D,this,x);else{var m=D.length,B0=E(D,m);for(var w=0;w0&&b.length>a&&!b.warned){b.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+b.length+" "+String($)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=M,c.type=$,c.count=b.length,K(c)}}return M}J.prototype.addListener=function($,x){return H(this,$,x,!1)},J.prototype.on=J.prototype.addListener,J.prototype.prependListener=function($,x){return H(this,$,x,!0)};function T(){if(!this.fired){if(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0)return this.listener.call(this.target);return this.listener.apply(this.target,arguments)}}function A(M,$,x){var w={fired:!1,wrapFn:void 0,target:M,type:$,listener:x},a=T.bind(w);return a.listener=x,w.wrapFn=a,a}J.prototype.once=function($,x){return W(x),this.on($,A(this,$,x)),this},J.prototype.prependOnceListener=function($,x){return W(x),this.prependListener($,A(this,$,x)),this},J.prototype.removeListener=function($,x){var w,a,U0,b,c;if(W(x),a=this._events,a===void 0)return this;if(w=a[$],w===void 0)return this;if(w===x||w.listener===x){if(--this._eventsCount===0)this._events=Object.create(null);else if(delete a[$],a.removeListener)this.emit("removeListener",$,w.listener||x)}else if(typeof w!=="function"){U0=-1;for(b=w.length-1;b>=0;b--)if(w[b]===x||w[b].listener===x){c=w[b].listener,U0=b;break}if(U0<0)return this;if(U0===0)w.shift();else C(w,U0);if(w.length===1)a[$]=w[0];if(a.removeListener!==void 0)this.emit("removeListener",$,c||x)}return this},J.prototype.off=J.prototype.removeListener,J.prototype.removeAllListeners=function($){var x,w=this._events,a;if(w===void 0)return this;if(w.removeListener===void 0){if(arguments.length===0)this._events=Object.create(null),this._eventsCount=0;else if(w[$]!==void 0)if(--this._eventsCount===0)this._events=Object.create(null);else delete w[$];return this}if(arguments.length===0){var U0=Object.keys(w),b;for(a=0;a=0;a--)this.removeListener($,x[a]);return this};function P(M,$,x){var w=M._events;if(w===void 0)return[];var a=w[$];if(a===void 0)return[];if(typeof a==="function")return x?[a.listener||a]:[a];return x?N(a):E(a,a.length)}J.prototype.listeners=function($){return P(this,$,!0)},J.prototype.rawListeners=function($){return P(this,$,!1)},J.listenerCount=function(M,$){if(typeof M.listenerCount==="function")return M.listenerCount($);else return j.call(M,$)},J.prototype.listenerCount=j;function j(M){var $=this._events;if($!==void 0){var x=$[M];if(typeof x==="function")return 1;else if(x!==void 0)return x.length}return 0}J.prototype.eventNames=function(){return this._eventsCount>0?Q(this._events):[]};function E(M,$){var x=Array($);for(var w=0;w<$;++w)x[w]=M[w];return x}function C(M,$){for(;$+1{if(typeof Object.create==="function")U.exports=function(Y,Q){if(Q)Y.super_=Q,Y.prototype=Object.create(Q.prototype,{constructor:{value:Y,enumerable:!1,writable:!0,configurable:!0}})};else U.exports=function(Y,Q){if(Q){Y.super_=Q;var K=function(){};K.prototype=Q.prototype,Y.prototype=new K,Y.prototype.constructor=Y}}}),v0,d2=JB(()=>{v0=globalThis||self});function MU(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function O8(){throw Error("setTimeout has not been defined")}function H8(){throw Error("clearTimeout has not been defined")}function VB(B){if(n0===setTimeout)return setTimeout(B,0);if((n0===O8||!n0)&&setTimeout)return n0=setTimeout,setTimeout(B,0);try{return n0(B,0)}catch(U){try{return n0.call(null,B,0)}catch(G){return n0.call(this,B,0)}}}function RU(B){if(s0===clearTimeout)return clearTimeout(B);if((s0===H8||!s0)&&clearTimeout)return s0=clearTimeout,clearTimeout(B);try{return s0(B)}catch(U){try{return s0.call(null,B)}catch(G){return s0.call(this,B)}}}function LU(){if(!D2||!E2)return;if(D2=!1,E2.length)o0=E2.concat(o0);else B1=-1;if(o0.length)XB()}function XB(){if(D2)return;var B=VB(LU);D2=!0;var U=o0.length;while(U){E2=o0,o0=[];while(++B1{J8={exports:{}},N0=J8.exports={},function(){try{if(typeof setTimeout==="function")n0=setTimeout;else n0=O8}catch(B){n0=O8}try{if(typeof clearTimeout==="function")s0=clearTimeout;else s0=H8}catch(B){s0=H8}}(),o0=[],D2=!1,B1=-1,N0.nextTick=function(B){var U=Array(arguments.length-1);if(arguments.length>1)for(var G=1;G{U.exports=S8().EventEmitter}),IU=R0((B)=>{B.byteLength=q,B.toByteArray=I,B.fromByteArray=A;var U=[],G=[],Y=typeof Uint8Array<"u"?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var K=0,Z=Q.length;K0)throw Error("Invalid string. Length must be a multiple of 4");var E=P.indexOf("=");if(E===-1)E=j;var C=E===j?0:4-E%4;return[E,C]}function q(P){var j=J(P),E=j[0],C=j[1];return(E+C)*3/4-C}function W(P,j,E){return(j+E)*3/4-E}function I(P){var j,E=J(P),C=E[0],N=E[1],v=new Y(W(P,C,N)),S=0,F=N>0?C-4:C,M;for(M=0;M>16&255,v[S++]=j>>8&255,v[S++]=j&255;if(N===2)j=G[P.charCodeAt(M)]<<2|G[P.charCodeAt(M+1)]>>4,v[S++]=j&255;if(N===1)j=G[P.charCodeAt(M)]<<10|G[P.charCodeAt(M+1)]<<4|G[P.charCodeAt(M+2)]>>2,v[S++]=j>>8&255,v[S++]=j&255;return v}function H(P){return U[P>>18&63]+U[P>>12&63]+U[P>>6&63]+U[P&63]}function T(P,j,E){var C,N=[];for(var v=j;vF?F:S+v));if(C===1)j=P[E-1],N.push(U[j>>2]+U[j<<4&63]+"==");else if(C===2)j=(P[E-2]<<8)+P[E-1],N.push(U[j>>10]+U[j>>4&63]+U[j<<2&63]+"=");return N.join("")}}),OU=R0((B)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */B.read=function(U,G,Y,Q,K){var Z,J,q=K*8-Q-1,W=(1<>1,H=-7,T=Y?K-1:0,A=Y?-1:1,P=U[G+T];T+=A,Z=P&(1<<-H)-1,P>>=-H,H+=q;for(;H>0;Z=Z*256+U[G+T],T+=A,H-=8);J=Z&(1<<-H)-1,Z>>=-H,H+=Q;for(;H>0;J=J*256+U[G+T],T+=A,H-=8);if(Z===0)Z=1-I;else if(Z===W)return J?NaN:(P?-1:1)*(1/0);else J=J+Math.pow(2,Q),Z=Z-I;return(P?-1:1)*J*Math.pow(2,Z-Q)},B.write=function(U,G,Y,Q,K,Z){var J,q,W,I=Z*8-K-1,H=(1<>1,A=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=Q?0:Z-1,j=Q?1:-1,E=G<0||G===0&&1/G<0?1:0;if(G=Math.abs(G),isNaN(G)||G===1/0)q=isNaN(G)?1:0,J=H;else{if(J=Math.floor(Math.log(G)/Math.LN2),G*(W=Math.pow(2,-J))<1)J--,W*=2;if(J+T>=1)G+=A/W;else G+=A*Math.pow(2,1-T);if(G*W>=2)J++,W/=2;if(J+T>=H)q=0,J=H;else if(J+T>=1)q=(G*W-1)*Math.pow(2,K),J=J+T;else q=G*Math.pow(2,T-1)*Math.pow(2,K),J=0}for(;K>=8;U[Y+P]=q&255,P+=j,q/=256,K-=8);J=J<0;U[Y+P]=J&255,P+=j,J/=256,I-=8);U[Y+P-j]|=E*128}});/*! +(()=>{var R5=Object.create;var{getPrototypeOf:L5,defineProperty:r1,getOwnPropertyNames:I5}=Object;var O5=Object.prototype.hasOwnProperty;function H5(B){return this[B]}var F5,W5,P5=(B,U,G)=>{var Y=B!=null&&typeof B==="object";if(Y){var Q=U?F5??=new WeakMap:W5??=new WeakMap,K=Q.get(B);if(K)return K}G=B!=null?R5(L5(B)):{};let Z=U||!B||!B.__esModule?r1(G,"default",{value:B,enumerable:!0}):G;for(let J of I5(B))if(!O5.call(Z,J))r1(Z,J,{get:H5.bind(B,J),enumerable:!0});if(Y)Q.set(B,Z);return Z};var A5=(B,U)=>()=>(U||B((U={exports:{}}).exports,U),U.exports);var j5=(B)=>B;function N5(B,U){this[B]=j5.bind(null,U)}var z5=(B,U)=>{for(var G in U)r1(B,G,{get:U[G],enumerable:!0,configurable:!0,set:N5.bind(U,G)})};var h6=A5((L7,_6)=>{var w0=_6.exports={},p0,r0;function Z8(){throw Error("setTimeout has not been defined")}function Q8(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")p0=setTimeout;else p0=Z8}catch(B){p0=Z8}try{if(typeof clearTimeout==="function")r0=clearTimeout;else r0=Q8}catch(B){r0=Q8}})();function g6(B){if(p0===setTimeout)return setTimeout(B,0);if((p0===Z8||!p0)&&setTimeout)return p0=setTimeout,setTimeout(B,0);try{return p0(B,0)}catch(U){try{return p0.call(null,B,0)}catch(G){return p0.call(this,B,0)}}}function UU(B){if(r0===clearTimeout)return clearTimeout(B);if((r0===Q8||!r0)&&clearTimeout)return r0=clearTimeout,clearTimeout(B);try{return r0(B)}catch(U){try{return r0.call(null,B)}catch(G){return r0.call(this,B)}}}var Q2=[],b2=!1,w2,z1=-1;function GU(){if(!b2||!w2)return;if(b2=!1,w2.length)Q2=w2.concat(Q2);else z1=-1;if(Q2.length)f6()}function f6(){if(b2)return;var B=g6(GU);b2=!0;var U=Q2.length;while(U){w2=Q2,Q2=[];while(++z11)for(var G=1;G"u")A1.global=globalThis;if(typeof A1.__require>"u")A1.__require=(B)=>{throw Error(`Dynamic require of "${B}" is not supported in the sandbox`)};var l0=[],h0=[],i1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(N2=0,H6=i1.length;N20)throw Error("Invalid string. Length must be a multiple of 4");var G=B.indexOf("=");if(G===-1)G=U;var Y=G===U?0:4-G%4;return[G,Y]}function E5(B,U){return(B+U)*3/4-U}function D5(B){var U,G=w5(B),Y=G[0],Q=G[1],K=new Uint8Array(E5(Y,Q)),Z=0,J=Q>0?Y-4:Y,q;for(q=0;q>16&255,K[Z++]=U>>8&255,K[Z++]=U&255;if(Q===2)U=h0[B.charCodeAt(q)]<<2|h0[B.charCodeAt(q+1)]>>4,K[Z++]=U&255;if(Q===1)U=h0[B.charCodeAt(q)]<<10|h0[B.charCodeAt(q+1)]<<4|h0[B.charCodeAt(q+2)]>>2,K[Z++]=U>>8&255,K[Z++]=U&255;return K}function T5(B){return l0[B>>18&63]+l0[B>>12&63]+l0[B>>6&63]+l0[B&63]}function C5(B,U,G){var Y,Q=[];for(var K=U;KJ?J:Z+K));if(Y===1)U=B[G-1],Q.push(l0[U>>2]+l0[U<<4&63]+"==");else if(Y===2)U=(B[G-2]<<8)+B[G-1],Q.push(l0[U>>10]+l0[U>>4&63]+l0[U<<2&63]+"=");return Q.join("")}function j1(B,U,G,Y,Q){var K,Z,J=Q*8-Y-1,q=(1<>1,I=-7,H=G?Q-1:0,T=G?-1:1,A=B[U+H];H+=T,K=A&(1<<-I)-1,A>>=-I,I+=J;for(;I>0;K=K*256+B[U+H],H+=T,I-=8);Z=K&(1<<-I)-1,K>>=-I,I+=Y;for(;I>0;Z=Z*256+B[U+H],H+=T,I-=8);if(K===0)K=1-W;else if(K===q)return Z?NaN:(A?-1:1)*(1/0);else Z=Z+Math.pow(2,Y),K=K-W;return(A?-1:1)*Z*Math.pow(2,K-Y)}function N6(B,U,G,Y,Q,K){var Z,J,q,W=K*8-Q-1,I=(1<>1,T=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=Y?0:K-1,P=Y?1:-1,j=U<0||U===0&&1/U<0?1:0;if(U=Math.abs(U),isNaN(U)||U===1/0)J=isNaN(U)?1:0,Z=I;else{if(Z=Math.floor(Math.log(U)/Math.LN2),U*(q=Math.pow(2,-Z))<1)Z--,q*=2;if(Z+H>=1)U+=T/q;else U+=T*Math.pow(2,1-H);if(U*q>=2)Z++,q/=2;if(Z+H>=I)J=0,Z=I;else if(Z+H>=1)J=(U*q-1)*Math.pow(2,Q),Z=Z+H;else J=U*Math.pow(2,H-1)*Math.pow(2,Q),Z=0}for(;Q>=8;B[G+A]=J&255,A+=P,J/=256,Q-=8);Z=Z<0;B[G+A]=Z&255,A+=P,Z/=256,W-=8);B[G+A-P]|=j*128}var W6=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,k5=50,n1=2147483647;var{btoa:Z7,atob:Q7,File:J7,Blob:K7}=globalThis;function Z2(B){if(B>n1)throw RangeError('The value "'+B+'" is invalid for option "size"');let U=new Uint8Array(B);return Object.setPrototypeOf(U,J0.prototype),U}function B8(B,U,G){return class extends G{constructor(){super();Object.defineProperty(this,"message",{value:U.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}var $5=B8("ERR_BUFFER_OUT_OF_BOUNDS",function(B){if(B)return`${B} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),S5=B8("ERR_INVALID_ARG_TYPE",function(B,U){return`The "${B}" argument must be of type number. Received type ${typeof U}`},TypeError),s1=B8("ERR_OUT_OF_RANGE",function(B,U,G){let Y=`The value of "${B}" is out of range.`,Q=G;if(Number.isInteger(G)&&Math.abs(G)>4294967296)Q=j6(String(G));else if(typeof G==="bigint"){if(Q=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))Q=j6(Q);Q+="n"}return Y+=` It must be ${U}. Received ${Q}`,Y},RangeError);function J0(B,U,G){if(typeof B==="number"){if(typeof U==="string")throw TypeError('The "string" argument must be of type string. Received type number');return U8(B)}return z6(B,U,G)}Object.defineProperty(J0.prototype,"parent",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.buffer}});Object.defineProperty(J0.prototype,"offset",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.byteOffset}});J0.poolSize=8192;function z6(B,U,G){if(typeof B==="string")return v5(B,U);if(ArrayBuffer.isView(B))return y5(B);if(B==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(a0(B,ArrayBuffer)||B&&a0(B.buffer,ArrayBuffer))return t1(B,U,G);if(typeof SharedArrayBuffer<"u"&&(a0(B,SharedArrayBuffer)||B&&a0(B.buffer,SharedArrayBuffer)))return t1(B,U,G);if(typeof B==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Y=B.valueOf&&B.valueOf();if(Y!=null&&Y!==B)return J0.from(Y,U,G);let Q=g5(B);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]==="function")return J0.from(B[Symbol.toPrimitive]("string"),U,G);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}J0.from=function(B,U,G){return z6(B,U,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);function w6(B){if(typeof B!=="number")throw TypeError('"size" argument must be of type number');else if(B<0)throw RangeError('The value "'+B+'" is invalid for option "size"')}function b5(B,U,G){if(w6(B),B<=0)return Z2(B);if(U!==void 0)return typeof G==="string"?Z2(B).fill(U,G):Z2(B).fill(U);return Z2(B)}J0.alloc=function(B,U,G){return b5(B,U,G)};function U8(B){return w6(B),Z2(B<0?0:G8(B)|0)}J0.allocUnsafe=function(B){return U8(B)};J0.allocUnsafeSlow=function(B){return U8(B)};function v5(B,U){if(typeof U!=="string"||U==="")U="utf8";if(!J0.isEncoding(U))throw TypeError("Unknown encoding: "+U);let G=E6(B,U)|0,Y=Z2(G),Q=Y.write(B,U);if(Q!==G)Y=Y.slice(0,Q);return Y}function o1(B){let U=B.length<0?0:G8(B.length)|0,G=Z2(U);for(let Y=0;Y=n1)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n1.toString(16)+" bytes");return B|0}J0.isBuffer=function(B){return B!=null&&B._isBuffer===!0&&B!==J0.prototype};J0.compare=function(B,U){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(a0(U,Uint8Array))U=J0.from(U,U.offset,U.byteLength);if(!J0.isBuffer(B)||!J0.isBuffer(U))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(B===U)return 0;let G=B.length,Y=U.length;for(let Q=0,K=Math.min(G,Y);QY.length){if(!J0.isBuffer(K))K=J0.from(K);K.copy(Y,Q)}else Uint8Array.prototype.set.call(Y,K,Q);else if(!J0.isBuffer(K))throw TypeError('"list" argument must be an Array of Buffers');else K.copy(Y,Q);Q+=K.length}return Y};function E6(B,U){if(J0.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||a0(B,ArrayBuffer))return B.byteLength;if(typeof B!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);let G=B.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&G===0)return 0;let Q=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return e1(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return y6(B).length;default:if(Q)return Y?-1:e1(B).length;U=(""+U).toLowerCase(),Q=!0}}J0.byteLength=E6;function f5(B,U,G){let Y=!1;if(U===void 0||U<0)U=0;if(U>this.length)return"";if(G===void 0||G>this.length)G=this.length;if(G<=0)return"";if(G>>>=0,U>>>=0,G<=U)return"";if(!B)B="utf8";while(!0)switch(B){case"hex":return p5(this,U,G);case"utf8":case"utf-8":return T6(this,U,G);case"ascii":return l5(this,U,G);case"latin1":case"binary":return a5(this,U,G);case"base64":return c5(this,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r5(this,U,G);default:if(Y)throw TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),Y=!0}}J0.prototype._isBuffer=!0;function z2(B,U,G){let Y=B[U];B[U]=B[G],B[G]=Y}J0.prototype.swap16=function(){let B=this.length;if(B%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let U=0;UU)B+=" ... ";return""};if(W6)J0.prototype[W6]=J0.prototype.inspect;J0.prototype.compare=function(B,U,G,Y,Q){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(!J0.isBuffer(B))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof B);if(U===void 0)U=0;if(G===void 0)G=B?B.length:0;if(Y===void 0)Y=0;if(Q===void 0)Q=this.length;if(U<0||G>B.length||Y<0||Q>this.length)throw RangeError("out of range index");if(Y>=Q&&U>=G)return 0;if(Y>=Q)return-1;if(U>=G)return 1;if(U>>>=0,G>>>=0,Y>>>=0,Q>>>=0,this===B)return 0;let K=Q-Y,Z=G-U,J=Math.min(K,Z),q=this.slice(Y,Q),W=B.slice(U,G);for(let I=0;I2147483647)G=2147483647;else if(G<-2147483648)G=-2147483648;if(G=+G,Number.isNaN(G))G=Q?0:B.length-1;if(G<0)G=B.length+G;if(G>=B.length)if(Q)return-1;else G=B.length-1;else if(G<0)if(Q)G=0;else return-1;if(typeof U==="string")U=J0.from(U,Y);if(J0.isBuffer(U)){if(U.length===0)return-1;return P6(B,U,G,Y,Q)}else if(typeof U==="number"){if(U=U&255,typeof Uint8Array.prototype.indexOf==="function")if(Q)return Uint8Array.prototype.indexOf.call(B,U,G);else return Uint8Array.prototype.lastIndexOf.call(B,U,G);return P6(B,[U],G,Y,Q)}throw TypeError("val must be string, number or Buffer")}function P6(B,U,G,Y,Q){let K=1,Z=B.length,J=U.length;if(Y!==void 0){if(Y=String(Y).toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le"){if(B.length<2||U.length<2)return-1;K=2,Z/=2,J/=2,G/=2}}function q(I,H){if(K===1)return I[H];else return I.readUInt16BE(H*K)}let W;if(Q){let I=-1;for(W=G;WZ)G=Z-J;for(W=G;W>=0;W--){let I=!0;for(let H=0;HQ)Y=Q;let K=U.length;if(Y>K/2)Y=K/2;let Z;for(Z=0;Z>>0,isFinite(G)){if(G=G>>>0,Y===void 0)Y="utf8"}else Y=G,G=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-U;if(G===void 0||G>Q)G=Q;if(B.length>0&&(G<0||U<0)||U>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!Y)Y="utf8";let K=!1;for(;;)switch(Y){case"hex":return x5(this,B,U,G);case"utf8":case"utf-8":return _5(this,B,U,G);case"ascii":case"latin1":case"binary":return h5(this,B,U,G);case"base64":return u5(this,B,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d5(this,B,U,G);default:if(K)throw TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),K=!0}};J0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c5(B,U,G){if(U===0&&G===B.length)return F6(B);else return F6(B.slice(U,G))}function T6(B,U,G){G=Math.min(B.length,G);let Y=[],Q=U;while(Q239?4:K>223?3:K>191?2:1;if(Q+J<=G){let q,W,I,H;switch(J){case 1:if(K<128)Z=K;break;case 2:if(q=B[Q+1],(q&192)===128){if(H=(K&31)<<6|q&63,H>127)Z=H}break;case 3:if(q=B[Q+1],W=B[Q+2],(q&192)===128&&(W&192)===128){if(H=(K&15)<<12|(q&63)<<6|W&63,H>2047&&(H<55296||H>57343))Z=H}break;case 4:if(q=B[Q+1],W=B[Q+2],I=B[Q+3],(q&192)===128&&(W&192)===128&&(I&192)===128){if(H=(K&15)<<18|(q&63)<<12|(W&63)<<6|I&63,H>65535&&H<1114112)Z=H}}}if(Z===null)Z=65533,J=1;else if(Z>65535)Z-=65536,Y.push(Z>>>10&1023|55296),Z=56320|Z&1023;Y.push(Z),Q+=J}return m5(Y)}var A6=4096;function m5(B){let U=B.length;if(U<=A6)return String.fromCharCode.apply(String,B);let G="",Y=0;while(YY)G=Y;let Q="";for(let K=U;KG)B=G;if(U<0){if(U+=G,U<0)U=0}else if(U>G)U=G;if(UG)throw RangeError("Trying to access beyond buffer length")}J0.prototype.readUintLE=J0.prototype.readUIntLE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B+--U],Q=1;while(U>0&&(Q*=256))Y+=this[B+--U]*Q;return Y};J0.prototype.readUint8=J0.prototype.readUInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);return this[B]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]|this[B+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]<<8|this[B+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return(this[B]|this[B+1]<<8|this[B+2]<<16)+this[B+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]*16777216+(this[B+1]<<16|this[B+2]<<8|this[B+3])};J0.prototype.readBigUInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U+this[++B]*256+this[++B]*65536+this[++B]*16777216,Q=this[++B]+this[++B]*256+this[++B]*65536+G*16777216;return BigInt(Y)+(BigInt(Q)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U*16777216+this[++B]*65536+this[++B]*256+this[++B],Q=this[++B]*16777216+this[++B]*65536+this[++B]*256+G;return(BigInt(Y)<>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K=Q)Y-=Math.pow(2,8*U);return Y};J0.prototype.readIntBE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=U,Q=1,K=this[B+--Y];while(Y>0&&(Q*=256))K+=this[B+--Y]*Q;if(Q*=128,K>=Q)K-=Math.pow(2,8*U);return K};J0.prototype.readInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);if(!(this[B]&128))return this[B];return(255-this[B]+1)*-1};J0.prototype.readInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B]|this[B+1]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B+1]|this[B]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]|this[B+1]<<8|this[B+2]<<16|this[B+3]<<24};J0.prototype.readInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]<<24|this[B+1]<<16|this[B+2]<<8|this[B+3]};J0.prototype.readBigInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=this[B+4]+this[B+5]*256+this[B+6]*65536+(G<<24);return(BigInt(Y)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=(U<<24)+this[++B]*65536+this[++B]*256+this[++B];return(BigInt(Y)<>>0,!U)$0(B,4,this.length);return j1(this,B,!0,23,4)};J0.prototype.readFloatBE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return j1(this,B,!1,23,4)};J0.prototype.readDoubleLE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!0,52,8)};J0.prototype.readDoubleBE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!1,52,8)};function g0(B,U,G,Y,Q,K){if(!J0.isBuffer(B))throw TypeError('"buffer" argument must be a Buffer instance');if(U>Q||UB.length)throw RangeError("Index out of range")}J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=1,K=0;this[U]=B&255;while(++K>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=G-1,K=1;this[U+Q]=B&255;while(--Q>=0&&(K*=256))this[U+Q]=B/K&255;return U+G};J0.prototype.writeUint8=J0.prototype.writeUInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,255,0);return this[U]=B&255,U+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U+3]=B>>>24,this[U+2]=B>>>16,this[U+1]=B>>>8,this[U]=B&255,U+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};function C6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,G}function k6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G+7]=K,K=K>>8,B[G+6]=K,K=K>>8,B[G+5]=K,K=K>>8,B[G+4]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G+3]=Z,Z=Z>>8,B[G+2]=Z,Z=Z>>8,B[G+1]=Z,Z=Z>>8,B[G]=Z,G+8}J0.prototype.writeBigUInt64LE=I2(function(B,U=0){return C6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=I2(function(B,U=0){return k6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=0,K=1,Z=0;this[U]=B&255;while(++Q>0)-Z&255}return U+G};J0.prototype.writeIntBE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=G-1,K=1,Z=0;this[U+Q]=B&255;while(--Q>=0&&(K*=256)){if(B<0&&Z===0&&this[U+Q+1]!==0)Z=1;this[U+Q]=(B/K>>0)-Z&255}return U+G};J0.prototype.writeInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,127,-128);if(B<0)B=255+B+1;return this[U]=B&255,U+1};J0.prototype.writeInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);return this[U]=B&255,this[U+1]=B>>>8,this[U+2]=B>>>16,this[U+3]=B>>>24,U+4};J0.prototype.writeInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);if(B<0)B=4294967295+B+1;return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};J0.prototype.writeBigInt64LE=I2(function(B,U=0){return C6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=I2(function(B,U=0){return k6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $6(B,U,G,Y,Q,K){if(G+Y>B.length)throw RangeError("Index out of range");if(G<0)throw RangeError("Index out of range")}function S6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return N6(B,U,G,Y,23,4),G+4}J0.prototype.writeFloatLE=function(B,U,G){return S6(this,B,U,!0,G)};J0.prototype.writeFloatBE=function(B,U,G){return S6(this,B,U,!1,G)};function b6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return N6(B,U,G,Y,52,8),G+8}J0.prototype.writeDoubleLE=function(B,U,G){return b6(this,B,U,!0,G)};J0.prototype.writeDoubleBE=function(B,U,G){return b6(this,B,U,!1,G)};J0.prototype.copy=function(B,U,G,Y){if(!J0.isBuffer(B))throw TypeError("argument should be a Buffer");if(!G)G=0;if(!Y&&Y!==0)Y=this.length;if(U>=B.length)U=B.length;if(!U)U=0;if(Y>0&&Y=this.length)throw RangeError("Index out of range");if(Y<0)throw RangeError("sourceEnd out of bounds");if(Y>this.length)Y=this.length;if(B.length-U>>0,G=G===void 0?this.length:G>>>0,!B)B=0;let Q;if(typeof B==="number")for(Q=U;Q=Y+4;G-=3)U=`_${B.slice(G-3,G)}${U}`;return`${B.slice(0,G)}${U}`}function i5(B,U,G){if(S2(U,"offset"),B[U]===void 0||B[U+G]===void 0)n2(U,B.length-(G+1))}function v6(B,U,G,Y,Q,K){if(B>G||B3)if(U===0||U===BigInt(0))J=`>= 0${Z} and < 2${Z} ** ${(K+1)*8}${Z}`;else J=`>= -(2${Z} ** ${(K+1)*8-1}${Z}) and < 2 ** ${(K+1)*8-1}${Z}`;else J=`>= ${U}${Z} and <= ${G}${Z}`;throw new s1("value",J,B)}i5(Y,Q,K)}function S2(B,U){if(typeof B!=="number")throw new S5(U,"number",B)}function n2(B,U,G){if(Math.floor(B)!==B)throw S2(B,G),new s1(G||"offset","an integer",B);if(U<0)throw new $5;throw new s1(G||"offset",`>= ${G?1:0} and <= ${U}`,B)}var n5=/[^+/0-9A-Za-z-_]/g;function s5(B){if(B=B.split("=")[0],B=B.trim().replace(n5,""),B.length<2)return"";while(B.length%4!==0)B=B+"=";return B}function e1(B,U){U=U||1/0;let G,Y=B.length,Q=null,K=[];for(let Z=0;Z55295&&G<57344){if(!Q){if(G>56319){if((U-=3)>-1)K.push(239,191,189);continue}else if(Z+1===Y){if((U-=3)>-1)K.push(239,191,189);continue}Q=G;continue}if(G<56320){if((U-=3)>-1)K.push(239,191,189);Q=G;continue}G=(Q-55296<<10|G-56320)+65536}else if(Q){if((U-=3)>-1)K.push(239,191,189)}if(Q=null,G<128){if((U-=1)<0)break;K.push(G)}else if(G<2048){if((U-=2)<0)break;K.push(G>>6|192,G&63|128)}else if(G<65536){if((U-=3)<0)break;K.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((U-=4)<0)break;K.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw Error("Invalid code point")}return K}function o5(B){let U=[];for(let G=0;G>8,Q=G%256,K.push(Q),K.push(Y)}return K}function y6(B){return D5(s5(B))}function N1(B,U,G,Y){let Q;for(Q=0;Q=U.length||Q>=B.length)break;U[Q+G]=B[Q]}return Q}function a0(B,U){return B instanceof U||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===U.name}var e5=function(){let B=Array(256);for(let U=0;U<16;++U){let G=U*16;for(let Y=0;Y<16;++Y)B[G+Y]="0123456789abcdef"[U]+"0123456789abcdef"[Y]}return B}();function I2(B){return typeof BigInt>"u"?BU:B}function BU(){throw Error("BigInt not supported")}function Y8(B){return()=>{throw Error(B+" is not implemented for node:buffer browser polyfill")}}var V7=Y8("resolveObjectURL"),X7=Y8("isUtf8");var q7=Y8("transcode");var G7=P5(h6(),1);var L6={};z5(L6,{unsignedDecimalNumber:()=>X1,universalMeasureValue:()=>q1,uniqueUuid:()=>eB,uniqueNumericIdCreator:()=>I1,uniqueId:()=>O1,uCharHexNumber:()=>W8,twipsMeasureValue:()=>E0,standardizeData:()=>j4,signedTwipsMeasureValue:()=>t0,signedHpsMeasureValue:()=>VG,shortHexNumber:()=>SB,sectionPageSizeDefaults:()=>$1,sectionMarginDefaults:()=>H2,positiveUniversalMeasureValue:()=>d8,pointMeasureValue:()=>gB,percentageValue:()=>vB,patchDocument:()=>tK,patchDetector:()=>B7,measurementOrPercentValue:()=>c8,longHexNumber:()=>KG,hpsMeasureValue:()=>bB,hexColorValue:()=>C2,hashedId:()=>P8,encodeUtf8:()=>U1,eighthPointMeasureValue:()=>yB,docPropertiesUniqueNumericIdGen:()=>oB,decimalNumber:()=>T0,dateTimeValue:()=>fB,createWrapTopAndBottom:()=>H4,createWrapTight:()=>O4,createWrapSquare:()=>I4,createWrapNone:()=>j8,createVerticalPosition:()=>J4,createVerticalAlign:()=>U6,createUnderline:()=>cB,createTransformation:()=>n8,createTableWidthElement:()=>J1,createTableRowHeight:()=>W9,createTableLook:()=>F9,createTableLayout:()=>O9,createTableFloatProperties:()=>I9,createTabStopItem:()=>b4,createTabStop:()=>v4,createStringElement:()=>f2,createSpacing:()=>S4,createSimplePos:()=>G4,createShading:()=>M1,createSectionType:()=>C9,createRunFonts:()=>T1,createParagraphStyle:()=>x2,createPageSize:()=>D9,createPageNumberType:()=>E9,createPageMargin:()=>w9,createOutlineLevel:()=>_4,createMathSuperScriptProperties:()=>p4,createMathSuperScriptElement:()=>a2,createMathSubSuperScriptProperties:()=>i4,createMathSubScriptProperties:()=>r4,createMathSubScriptElement:()=>l2,createMathPreSubSuperScriptProperties:()=>n4,createMathNAryProperties:()=>e8,createMathLimitLocation:()=>a4,createMathBase:()=>y0,createMathAccentCharacter:()=>l4,createLineNumberType:()=>N9,createIndent:()=>hB,createHorizontalPosition:()=>Q4,createHeaderFooterReference:()=>k1,createFrameProperties:()=>u4,createEmphasisMark:()=>r8,createDotEmphasisMark:()=>AG,createDocumentGrid:()=>j9,createColumns:()=>A9,createBorderElement:()=>j0,createBodyProperties:()=>K4,createAlignment:()=>m8,convertToXmlComponent:()=>u1,convertMillimetersToTwip:()=>dG,convertInchesToTwip:()=>u0,concreteNumUniqueNumericIdGen:()=>sB,commentIdToParaId:()=>z4,bookmarkUniqueNumericIdGen:()=>tB,abstractNumUniqueNumericIdGen:()=>nB,YearShort:()=>oY,YearLong:()=>BZ,XmlComponent:()=>t,XmlAttributeComponent:()=>H0,WpsShapeRun:()=>SY,WpgGroupRun:()=>bY,WidthType:()=>v1,WORKAROUND4:()=>oZ,WORKAROUND3:()=>JG,WORKAROUND2:()=>NJ,VerticalPositionRelativeFrom:()=>U4,VerticalPositionAlign:()=>MG,VerticalMergeType:()=>G6,VerticalMergeRevisionType:()=>FQ,VerticalMerge:()=>w8,VerticalAnchor:()=>cG,VerticalAlignTable:()=>K9,VerticalAlignSection:()=>V9,VerticalAlign:()=>WQ,UnderlineType:()=>i8,ThematicBreak:()=>_B,Textbox:()=>TK,TextWrappingType:()=>e2,TextWrappingSide:()=>L4,TextRun:()=>Q1,TextEffect:()=>CG,TextDirection:()=>zQ,TableRowPropertiesChange:()=>P9,TableRowProperties:()=>J6,TableRow:()=>fQ,TableProperties:()=>Q6,TableOfContents:()=>RK,TableLayoutType:()=>SQ,TableCellBorders:()=>q9,TableCell:()=>Y6,TableBorders:()=>Z6,TableAnchorType:()=>DQ,Table:()=>yQ,TabStopType:()=>z8,TabStopPosition:()=>FZ,Tab:()=>T4,TDirection:()=>R9,SymbolRun:()=>aB,Styles:()=>S1,StyleLevel:()=>LK,StyleForParagraph:()=>p2,StyleForCharacter:()=>$2,StringValueElement:()=>q2,StringEnumValueElement:()=>XG,StringContainer:()=>O2,SpaceType:()=>x0,SoftHyphen:()=>iY,SimpleMailMergeField:()=>fY,SimpleField:()=>s8,ShadingType:()=>FG,SequentialIdentifier:()=>yY,Separator:()=>YZ,SectionType:()=>GJ,SectionPropertiesChange:()=>k9,SectionProperties:()=>K6,RunPropertiesDefaults:()=>a9,RunPropertiesChange:()=>lB,RunProperties:()=>U2,Run:()=>D0,RelativeVerticalPosition:()=>CQ,RelativeHorizontalPosition:()=>TQ,PrettifyType:()=>G5,PositionalTabRelativeTo:()=>XZ,PositionalTabLeader:()=>qZ,PositionalTabAlignment:()=>VZ,PositionalTab:()=>RZ,PatchType:()=>C8,ParagraphRunProperties:()=>mB,ParagraphPropertiesDefaults:()=>l9,ParagraphPropertiesChange:()=>d4,ParagraphProperties:()=>M2,Paragraph:()=>d0,PageTextDirectionType:()=>BJ,PageTextDirection:()=>T9,PageReference:()=>CZ,PageOrientation:()=>g1,PageNumberSeparator:()=>eQ,PageNumberElement:()=>QZ,PageNumber:()=>F2,PageBreakBefore:()=>$4,PageBreak:()=>LZ,PageBorders:()=>z9,PageBorderZOrder:()=>tQ,PageBorderOffsetFrom:()=>oQ,PageBorderDisplay:()=>sQ,Packer:()=>Y5,OverlapType:()=>kQ,OnOffElement:()=>q0,Numbering:()=>d9,NumberedItemReferenceFormat:()=>wZ,NumberedItemReference:()=>DZ,NumberValueElement:()=>_2,NumberProperties:()=>C1,NumberFormat:()=>RG,NoBreakHyphen:()=>rY,NextAttributeComponent:()=>$8,MonthShort:()=>sY,MonthLong:()=>eY,Media:()=>V6,MathSuperScript:()=>rZ,MathSum:()=>mZ,MathSubSuperScript:()=>nZ,MathSubScript:()=>iZ,MathSquareBrackets:()=>QQ,MathRun:()=>hZ,MathRoundBrackets:()=>ZQ,MathRadicalProperties:()=>o4,MathRadical:()=>BQ,MathPreSubSuperScript:()=>sZ,MathNumerator:()=>m4,MathLimitUpper:()=>aZ,MathLimitLower:()=>pZ,MathLimit:()=>B6,MathIntegral:()=>lZ,MathFunctionProperties:()=>e4,MathFunctionName:()=>t4,MathFunction:()=>UQ,MathFraction:()=>uZ,MathDenominator:()=>c4,MathDegree:()=>s4,MathCurlyBrackets:()=>JQ,MathAngledBrackets:()=>KQ,Math:()=>xZ,LineRuleType:()=>k2,LineNumberRestartFormat:()=>nQ,LevelSuffix:()=>TJ,LevelOverride:()=>u9,LevelFormat:()=>i0,LevelForOverride:()=>$J,LevelBase:()=>X6,Level:()=>h9,LeaderType:()=>HZ,LastRenderedPageBreak:()=>KZ,InternalHyperlink:()=>y4,InsertedTextRun:()=>MQ,InsertedTableRow:()=>U9,InsertedTableCell:()=>Y9,InitializableXmlComponent:()=>u8,ImportedXmlComponent:()=>kB,ImportedRootElementAttributes:()=>$B,ImageRun:()=>$Y,IgnoreIfEmptyXmlComponent:()=>R2,HyperlinkType:()=>jZ,HpsMeasureElement:()=>D1,HorizontalPositionRelativeFrom:()=>B4,HorizontalPositionAlign:()=>qG,HighlightColor:()=>kG,HeightRule:()=>gQ,HeadingLevel:()=>OZ,HeaderWrapper:()=>_9,HeaderFooterType:()=>E8,HeaderFooterReferenceType:()=>T2,Header:()=>IK,GridSpan:()=>M9,FrameWrap:()=>fZ,FrameAnchorType:()=>gZ,FootnoteReferenceRun:()=>HK,FootnoteReferenceElement:()=>GZ,FootnoteReference:()=>o9,FooterWrapper:()=>f9,Footer:()=>OK,FootNotes:()=>x9,FootNoteReferenceRunAttributes:()=>s9,FileChild:()=>H1,File:()=>VK,ExternalHyperlink:()=>t8,Endnotes:()=>g9,EndnoteReferenceRunAttributes:()=>t9,EndnoteReferenceRun:()=>FK,EndnoteReference:()=>D4,EndnoteIdReference:()=>e9,EmptyElement:()=>S0,EmphasisMarkType:()=>p8,EMPTY_OBJECT:()=>KB,DropCapType:()=>yZ,Drawing:()=>m1,DocumentGridType:()=>iQ,DocumentDefaults:()=>p9,DocumentBackgroundAttributes:()=>S9,DocumentBackground:()=>b9,DocumentAttributes:()=>F1,DocumentAttributeNamespaces:()=>y1,Document:()=>VK,DeletedTextRun:()=>OQ,DeletedTableRow:()=>G9,DeletedTableCell:()=>Z9,DayShort:()=>nY,DayLong:()=>tY,ContinuationSeparator:()=>ZZ,ConcreteNumbering:()=>T8,ConcreteHyperlink:()=>m2,CommentsExtended:()=>E4,Comments:()=>w4,CommentReference:()=>mY,CommentRangeStart:()=>dY,CommentRangeEnd:()=>cY,Comment:()=>N8,ColumnBreak:()=>IZ,Column:()=>ZJ,CheckBoxUtil:()=>B5,CheckBoxSymbolElement:()=>b1,CheckBox:()=>WK,CharacterSet:()=>kZ,CellMergeAttributes:()=>Q9,CellMerge:()=>J9,CarriageReturn:()=>JZ,BuilderElement:()=>M0,BorderStyle:()=>c1,Border:()=>xB,BookmarkStart:()=>f4,BookmarkEnd:()=>x4,Bookmark:()=>g4,Body:()=>$9,BaseXmlComponent:()=>Y1,Attributes:()=>C0,AnnotationReference:()=>UZ,AlignmentType:()=>c0,AbstractNumbering:()=>D8});var{create:YU,defineProperty:QB,getOwnPropertyDescriptor:ZU,getOwnPropertyNames:QU,getPrototypeOf:JU}=Object,KU=Object.prototype.hasOwnProperty,JB=(B,U)=>()=>(B&&(U=B(B=0)),U),R0=(B,U)=>()=>(U||(B((U={exports:{}}).exports,U),B=null),U.exports),VU=(B,U,G,Y)=>{if(U&&typeof U==="object"||typeof U==="function"){for(var Q=QU(U),K=0,Z=Q.length,J;KU[q]).bind(null,J),enumerable:!(Y=ZU(U,J))||Y.enumerable})}return B},k8=(B,U,G)=>(G=B!=null?YU(JU(B)):{},VU(U||!B||!B.__esModule?QB(G,"default",{value:B,enumerable:!0}):G,B)),w1=((B)=>__require)(function(B){return __require.apply(this,arguments)});function G1(B){return G1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},G1(B)}function XU(B,U){if(G1(B)!="object"||!B)return B;var G=B[Symbol.toPrimitive];if(G!==void 0){var Y=G.call(B,U||"default");if(G1(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return(U==="string"?String:Number)(B)}function qU(B){var U=XU(B,"string");return G1(U)=="symbol"?U:U+""}function e(B,U,G){return(U=qU(U))in B?Object.defineProperty(B,U,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[U]=G,B}var Y1=class{constructor(B){e(this,"rootKey",void 0),this.rootKey=B}},KB=Object.seal({}),t=class extends Y1{constructor(B){super(B);e(this,"root",void 0),this.root=[]}prepForXml(B){var U;B.stack.push(this);let G=this.root.map((Y)=>{if(Y instanceof Y1)return Y.prepForXml(B);return Y}).filter((Y)=>Y!==void 0);return B.stack.pop(),{[this.rootKey]:G.length?G.length===1&&((U=G[0])===null||U===void 0?void 0:U._attr)?G[0]:G:KB}}addChildElement(B){return this.root.push(B),this}},R2=class extends t{constructor(B,U){super(B);e(this,"includeIfEmpty",void 0),this.includeIfEmpty=U}prepForXml(B){let U=super.prepForXml(B);if(this.includeIfEmpty)return U;if(U&&(typeof U[this.rootKey]!=="object"||Object.keys(U[this.rootKey]).length))return U}};function u6(B,U){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);U&&(Y=Y.filter(function(Q){return Object.getOwnPropertyDescriptor(B,Q).enumerable})),G.push.apply(G,Y)}return G}function L0(B){for(var U=1;U{if(Y!==void 0){let Q=this.xmlKeys&&this.xmlKeys[G]||G;U[Q]=Y}}),{_attr:U}}},$8=class extends Y1{constructor(B){super("_attr");e(this,"root",void 0),this.root=B}prepForXml(B){return{_attr:Object.values(this.root).filter(({value:U})=>U!==void 0).reduce((U,{key:G,value:Y})=>L0(L0({},U),{},{[G]:Y}),{})}}},C0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}},S8=R0((B,U)=>{var G=typeof Reflect==="object"?Reflect:null,Y=G&&typeof G.apply==="function"?G.apply:function($,x,z){return Function.prototype.apply.call($,x,z)},Q;if(G&&typeof G.ownKeys==="function")Q=G.ownKeys;else if(Object.getOwnPropertySymbols)Q=function($){return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($))};else Q=function($){return Object.getOwnPropertyNames($)};function K(M){if(console&&console.warn)console.warn(M)}var Z=Number.isNaN||function($){return $!==$};function J(){J.init.call(this)}U.exports=J,U.exports.once=v,J.EventEmitter=J,J.prototype._events=void 0,J.prototype._eventsCount=0,J.prototype._maxListeners=void 0;var q=10;function W(M){if(typeof M!=="function")throw TypeError('The "listener" argument must be of type Function. Received type '+typeof M)}Object.defineProperty(J,"defaultMaxListeners",{enumerable:!0,get:function(){return q},set:function(M){if(typeof M!=="number"||M<0||Z(M))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+M+".");q=M}}),J.init=function(){if(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)this._events=Object.create(null),this._eventsCount=0;this._maxListeners=this._maxListeners||void 0},J.prototype.setMaxListeners=function($){if(typeof $!=="number"||$<0||Z($))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+$+".");return this._maxListeners=$,this};function I(M){if(M._maxListeners===void 0)return J.defaultMaxListeners;return M._maxListeners}J.prototype.getMaxListeners=function(){return I(this)},J.prototype.emit=function($){var x=[];for(var z=1;z0)b=x[0];if(b instanceof Error)throw b;var c=Error("Unhandled error."+(b?" ("+b.message+")":""));throw c.context=b,c}var D=U0[$];if(D===void 0)return!1;if(typeof D==="function")Y(D,this,x);else{var m=D.length,B0=E(D,m);for(var z=0;z0&&b.length>a&&!b.warned){b.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+b.length+" "+String($)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=M,c.type=$,c.count=b.length,K(c)}}return M}J.prototype.addListener=function($,x){return H(this,$,x,!1)},J.prototype.on=J.prototype.addListener,J.prototype.prependListener=function($,x){return H(this,$,x,!0)};function T(){if(!this.fired){if(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0)return this.listener.call(this.target);return this.listener.apply(this.target,arguments)}}function A(M,$,x){var z={fired:!1,wrapFn:void 0,target:M,type:$,listener:x},a=T.bind(z);return a.listener=x,z.wrapFn=a,a}J.prototype.once=function($,x){return W(x),this.on($,A(this,$,x)),this},J.prototype.prependOnceListener=function($,x){return W(x),this.prependListener($,A(this,$,x)),this},J.prototype.removeListener=function($,x){var z,a,U0,b,c;if(W(x),a=this._events,a===void 0)return this;if(z=a[$],z===void 0)return this;if(z===x||z.listener===x){if(--this._eventsCount===0)this._events=Object.create(null);else if(delete a[$],a.removeListener)this.emit("removeListener",$,z.listener||x)}else if(typeof z!=="function"){U0=-1;for(b=z.length-1;b>=0;b--)if(z[b]===x||z[b].listener===x){c=z[b].listener,U0=b;break}if(U0<0)return this;if(U0===0)z.shift();else C(z,U0);if(z.length===1)a[$]=z[0];if(a.removeListener!==void 0)this.emit("removeListener",$,c||x)}return this},J.prototype.off=J.prototype.removeListener,J.prototype.removeAllListeners=function($){var x,z=this._events,a;if(z===void 0)return this;if(z.removeListener===void 0){if(arguments.length===0)this._events=Object.create(null),this._eventsCount=0;else if(z[$]!==void 0)if(--this._eventsCount===0)this._events=Object.create(null);else delete z[$];return this}if(arguments.length===0){var U0=Object.keys(z),b;for(a=0;a=0;a--)this.removeListener($,x[a]);return this};function P(M,$,x){var z=M._events;if(z===void 0)return[];var a=z[$];if(a===void 0)return[];if(typeof a==="function")return x?[a.listener||a]:[a];return x?N(a):E(a,a.length)}J.prototype.listeners=function($){return P(this,$,!0)},J.prototype.rawListeners=function($){return P(this,$,!1)},J.listenerCount=function(M,$){if(typeof M.listenerCount==="function")return M.listenerCount($);else return j.call(M,$)},J.prototype.listenerCount=j;function j(M){var $=this._events;if($!==void 0){var x=$[M];if(typeof x==="function")return 1;else if(x!==void 0)return x.length}return 0}J.prototype.eventNames=function(){return this._eventsCount>0?Q(this._events):[]};function E(M,$){var x=Array($);for(var z=0;z<$;++z)x[z]=M[z];return x}function C(M,$){for(;$+1{if(typeof Object.create==="function")U.exports=function(Y,Q){if(Q)Y.super_=Q,Y.prototype=Object.create(Q.prototype,{constructor:{value:Y,enumerable:!1,writable:!0,configurable:!0}})};else U.exports=function(Y,Q){if(Q){Y.super_=Q;var K=function(){};K.prototype=Q.prototype,Y.prototype=new K,Y.prototype.constructor=Y}}}),v0,d2=JB(()=>{v0=globalThis||self});function MU(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function O8(){throw Error("setTimeout has not been defined")}function H8(){throw Error("clearTimeout has not been defined")}function VB(B){if(n0===setTimeout)return setTimeout(B,0);if((n0===O8||!n0)&&setTimeout)return n0=setTimeout,setTimeout(B,0);try{return n0(B,0)}catch(U){try{return n0.call(null,B,0)}catch(G){return n0.call(this,B,0)}}}function RU(B){if(s0===clearTimeout)return clearTimeout(B);if((s0===H8||!s0)&&clearTimeout)return s0=clearTimeout,clearTimeout(B);try{return s0(B)}catch(U){try{return s0.call(null,B)}catch(G){return s0.call(this,B)}}}function LU(){if(!D2||!E2)return;if(D2=!1,E2.length)o0=E2.concat(o0);else B1=-1;if(o0.length)XB()}function XB(){if(D2)return;var B=VB(LU);D2=!0;var U=o0.length;while(U){E2=o0,o0=[];while(++B1{J8={exports:{}},N0=J8.exports={},function(){try{if(typeof setTimeout==="function")n0=setTimeout;else n0=O8}catch(B){n0=O8}try{if(typeof clearTimeout==="function")s0=clearTimeout;else s0=H8}catch(B){s0=H8}}(),o0=[],D2=!1,B1=-1,N0.nextTick=function(B){var U=Array(arguments.length-1);if(arguments.length>1)for(var G=1;G{U.exports=S8().EventEmitter}),IU=R0((B)=>{B.byteLength=q,B.toByteArray=I,B.fromByteArray=A;var U=[],G=[],Y=typeof Uint8Array<"u"?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var K=0,Z=Q.length;K0)throw Error("Invalid string. Length must be a multiple of 4");var E=P.indexOf("=");if(E===-1)E=j;var C=E===j?0:4-E%4;return[E,C]}function q(P){var j=J(P),E=j[0],C=j[1];return(E+C)*3/4-C}function W(P,j,E){return(j+E)*3/4-E}function I(P){var j,E=J(P),C=E[0],N=E[1],v=new Y(W(P,C,N)),S=0,F=N>0?C-4:C,M;for(M=0;M>16&255,v[S++]=j>>8&255,v[S++]=j&255;if(N===2)j=G[P.charCodeAt(M)]<<2|G[P.charCodeAt(M+1)]>>4,v[S++]=j&255;if(N===1)j=G[P.charCodeAt(M)]<<10|G[P.charCodeAt(M+1)]<<4|G[P.charCodeAt(M+2)]>>2,v[S++]=j>>8&255,v[S++]=j&255;return v}function H(P){return U[P>>18&63]+U[P>>12&63]+U[P>>6&63]+U[P&63]}function T(P,j,E){var C,N=[];for(var v=j;vF?F:S+v));if(C===1)j=P[E-1],N.push(U[j>>2]+U[j<<4&63]+"==");else if(C===2)j=(P[E-2]<<8)+P[E-1],N.push(U[j>>10]+U[j>>4&63]+U[j<<2&63]+"=");return N.join("")}}),OU=R0((B)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */B.read=function(U,G,Y,Q,K){var Z,J,q=K*8-Q-1,W=(1<>1,H=-7,T=Y?K-1:0,A=Y?-1:1,P=U[G+T];T+=A,Z=P&(1<<-H)-1,P>>=-H,H+=q;for(;H>0;Z=Z*256+U[G+T],T+=A,H-=8);J=Z&(1<<-H)-1,Z>>=-H,H+=Q;for(;H>0;J=J*256+U[G+T],T+=A,H-=8);if(Z===0)Z=1-I;else if(Z===W)return J?NaN:(P?-1:1)*(1/0);else J=J+Math.pow(2,Q),Z=Z-I;return(P?-1:1)*J*Math.pow(2,Z-Q)},B.write=function(U,G,Y,Q,K,Z){var J,q,W,I=Z*8-K-1,H=(1<>1,A=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=Q?0:Z-1,j=Q?1:-1,E=G<0||G===0&&1/G<0?1:0;if(G=Math.abs(G),isNaN(G)||G===1/0)q=isNaN(G)?1:0,J=H;else{if(J=Math.floor(Math.log(G)/Math.LN2),G*(W=Math.pow(2,-J))<1)J--,W*=2;if(J+T>=1)G+=A/W;else G+=A*Math.pow(2,1-T);if(G*W>=2)J++,W/=2;if(J+T>=H)q=0,J=H;else if(J+T>=1)q=(G*W-1)*Math.pow(2,K),J=J+T;else q=G*Math.pow(2,T-1)*Math.pow(2,K),J=0}for(;K>=8;U[Y+P]=q&255,P+=j,q/=256,K-=8);J=J<0;U[Y+P]=J&255,P+=j,J/=256,I-=8);U[Y+P-j]|=E*128}});/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT -*/var f1=R0((B)=>{var U=IU(),G=OU(),Y=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=J,B.SlowBuffer=N,B.INSPECT_MAX_BYTES=50;var Q=2147483647;if(B.kMaxLength=Q,J.TYPED_ARRAY_SUPPORT=K(),!J.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error==="function")console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function K(){try{var k=new Uint8Array(1),V={foo:function(){return 42}};return Object.setPrototypeOf(V,Uint8Array.prototype),Object.setPrototypeOf(k,V),k.foo()===42}catch(X){return!1}}Object.defineProperty(J.prototype,"parent",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.buffer}}),Object.defineProperty(J.prototype,"offset",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.byteOffset}});function Z(k){if(k>Q)throw RangeError('The value "'+k+'" is invalid for option "size"');var V=new Uint8Array(k);return Object.setPrototypeOf(V,J.prototype),V}function J(k,V,X){if(typeof k==="number"){if(typeof V==="string")throw TypeError('The "string" argument must be of type string. Received type number');return H(k)}return q(k,V,X)}J.poolSize=8192;function q(k,V,X){if(typeof k==="string")return T(k,V);if(ArrayBuffer.isView(k))return P(k);if(k==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(f(k,ArrayBuffer)||k&&f(k.buffer,ArrayBuffer))return j(k,V,X);if(typeof SharedArrayBuffer<"u"&&(f(k,SharedArrayBuffer)||k&&f(k.buffer,SharedArrayBuffer)))return j(k,V,X);if(typeof k==="number")throw TypeError('The "value" argument must not be of type number. Received type number');var O=k.valueOf&&k.valueOf();if(O!=null&&O!==k)return J.from(O,V,X);var _=E(k);if(_)return _;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]==="function")return J.from(k[Symbol.toPrimitive]("string"),V,X);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}J.from=function(k,V,X){return q(k,V,X)},Object.setPrototypeOf(J.prototype,Uint8Array.prototype),Object.setPrototypeOf(J,Uint8Array);function W(k){if(typeof k!=="number")throw TypeError('"size" argument must be of type number');else if(k<0)throw RangeError('The value "'+k+'" is invalid for option "size"')}function I(k,V,X){if(W(k),k<=0)return Z(k);if(V!==void 0)return typeof X==="string"?Z(k).fill(V,X):Z(k).fill(V);return Z(k)}J.alloc=function(k,V,X){return I(k,V,X)};function H(k){return W(k),Z(k<0?0:C(k)|0)}J.allocUnsafe=function(k){return H(k)},J.allocUnsafeSlow=function(k){return H(k)};function T(k,V){if(typeof V!=="string"||V==="")V="utf8";if(!J.isEncoding(V))throw TypeError("Unknown encoding: "+V);var X=v(k,V)|0,O=Z(X),_=O.write(k,V);if(_!==X)O=O.slice(0,_);return O}function A(k){var V=k.length<0?0:C(k.length)|0,X=Z(V);for(var O=0;O=Q)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return k|0}function N(k){if(+k!=k)k=0;return J.alloc(+k)}J.isBuffer=function(V){return V!=null&&V._isBuffer===!0&&V!==J.prototype},J.compare=function(V,X){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(f(X,Uint8Array))X=J.from(X,X.offset,X.byteLength);if(!J.isBuffer(V)||!J.isBuffer(X))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(V===X)return 0;var O=V.length,_=X.length;for(var l=0,d=Math.min(O,_);l_.length)J.from(d).copy(_,l);else Uint8Array.prototype.set.call(_,d,l);else if(!J.isBuffer(d))throw TypeError('"list" argument must be an Array of Buffers');else d.copy(_,l);l+=d.length}return _};function v(k,V){if(J.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||f(k,ArrayBuffer))return k.byteLength;if(typeof k!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);var X=k.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&X===0)return 0;var _=!1;for(;;)switch(V){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return L(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return Z0(k).length;default:if(_)return O?-1:L(k).length;V=(""+V).toLowerCase(),_=!0}}J.byteLength=v;function S(k,V,X){var O=!1;if(V===void 0||V<0)V=0;if(V>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,V>>>=0,X<=V)return"";if(!k)k="utf8";while(!0)switch(k){case"hex":return s(this,V,X);case"utf8":case"utf-8":return D(this,V,X);case"ascii":return i(this,V,X);case"latin1":case"binary":return V0(this,V,X);case"base64":return c(this,V,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G0(this,V,X);default:if(O)throw TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),O=!0}}J.prototype._isBuffer=!0;function F(k,V,X){var O=k[V];k[V]=k[X],k[X]=O}if(J.prototype.swap16=function(){var V=this.length;if(V%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var X=0;XX)V+=" ... ";return""},Y)J.prototype[Y]=J.prototype.inspect;J.prototype.compare=function(V,X,O,_,l){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(!J.isBuffer(V))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof V);if(X===void 0)X=0;if(O===void 0)O=V?V.length:0;if(_===void 0)_=0;if(l===void 0)l=this.length;if(X<0||O>V.length||_<0||l>this.length)throw RangeError("out of range index");if(_>=l&&X>=O)return 0;if(_>=l)return-1;if(X>=O)return 1;if(X>>>=0,O>>>=0,_>>>=0,l>>>=0,this===V)return 0;var d=l-_,Q0=O-X,X0=Math.min(d,Q0),K0=this.slice(_,l),I0=V.slice(X,O);for(var F0=0;F02147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,R(X))X=_?0:k.length-1;if(X<0)X=k.length+X;if(X>=k.length)if(_)return-1;else X=k.length-1;else if(X<0)if(_)X=0;else return-1;if(typeof V==="string")V=J.from(V,O);if(J.isBuffer(V)){if(V.length===0)return-1;return $(k,V,X,O,_)}else if(typeof V==="number"){if(V=V&255,typeof Uint8Array.prototype.indexOf==="function")if(_)return Uint8Array.prototype.indexOf.call(k,V,X);else return Uint8Array.prototype.lastIndexOf.call(k,V,X);return $(k,[V],X,O,_)}throw TypeError("val must be string, number or Buffer")}function $(k,V,X,O,_){var l=1,d=k.length,Q0=V.length;if(O!==void 0){if(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le"){if(k.length<2||V.length<2)return-1;l=2,d/=2,Q0/=2,X/=2}}function X0(k0,L2){if(l===1)return k0[L2];else return k0.readUInt16BE(L2*l)}var K0;if(_){var I0=-1;for(K0=X;K0d)X=d-Q0;for(K0=X;K0>=0;K0--){var F0=!0;for(var W0=0;W0_)O=_;var l=V.length;if(O>l/2)O=l/2;for(var d=0;d>>0,isFinite(O)){if(O=O>>>0,_===void 0)_="utf8"}else _=O,O=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-X;if(O===void 0||O>l)O=l;if(V.length>0&&(O<0||X<0)||X>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!_)_="utf8";var d=!1;for(;;)switch(_){case"hex":return x(this,V,X,O);case"utf8":case"utf-8":return w(this,V,X,O);case"ascii":case"latin1":case"binary":return a(this,V,X,O);case"base64":return U0(this,V,X,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,V,X,O);default:if(d)throw TypeError("Unknown encoding: "+_);_=(""+_).toLowerCase(),d=!0}},J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c(k,V,X){if(V===0&&X===k.length)return U.fromByteArray(k);else return U.fromByteArray(k.slice(V,X))}function D(k,V,X){X=Math.min(k.length,X);var O=[],_=V;while(_239?4:l>223?3:l>191?2:1;if(_+Q0<=X){var X0,K0,I0,F0;switch(Q0){case 1:if(l<128)d=l;break;case 2:if(X0=k[_+1],(X0&192)===128){if(F0=(l&31)<<6|X0&63,F0>127)d=F0}break;case 3:if(X0=k[_+1],K0=k[_+2],(X0&192)===128&&(K0&192)===128){if(F0=(l&15)<<12|(X0&63)<<6|K0&63,F0>2047&&(F0<55296||F0>57343))d=F0}break;case 4:if(X0=k[_+1],K0=k[_+2],I0=k[_+3],(X0&192)===128&&(K0&192)===128&&(I0&192)===128){if(F0=(l&15)<<18|(X0&63)<<12|(K0&63)<<6|I0&63,F0>65535&&F0<1114112)d=F0}}}if(d===null)d=65533,Q0=1;else if(d>65535)d-=65536,O.push(d>>>10&1023|55296),d=56320|d&1023;O.push(d),_+=Q0}return B0(O)}var m=4096;function B0(k){var V=k.length;if(V<=m)return String.fromCharCode.apply(String,k);var X="",O=0;while(OO)X=O;var _="";for(var l=V;lO)V=O;if(X<0){if(X+=O,X<0)X=0}else if(X>O)X=O;if(XX)throw RangeError("Trying to access beyond buffer length")}J.prototype.readUintLE=J.prototype.readUIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V+--X],l=1;while(X>0&&(l*=256))_+=this[V+--X]*l;return _},J.prototype.readUint8=J.prototype.readUInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);return this[V]},J.prototype.readUint16LE=J.prototype.readUInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]|this[V+1]<<8},J.prototype.readUint16BE=J.prototype.readUInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]<<8|this[V+1]},J.prototype.readUint32LE=J.prototype.readUInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return(this[V]|this[V+1]<<8|this[V+2]<<16)+this[V+3]*16777216},J.prototype.readUint32BE=J.prototype.readUInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]*16777216+(this[V+1]<<16|this[V+2]<<8|this[V+3])},J.prototype.readIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d=l)_-=Math.pow(2,8*X);return _},J.prototype.readIntBE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=X,l=1,d=this[V+--_];while(_>0&&(l*=256))d+=this[V+--_]*l;if(l*=128,d>=l)d-=Math.pow(2,8*X);return d},J.prototype.readInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);if(!(this[V]&128))return this[V];return(255-this[V]+1)*-1},J.prototype.readInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V]|this[V+1]<<8;return O&32768?O|4294901760:O},J.prototype.readInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V+1]|this[V]<<8;return O&32768?O|4294901760:O},J.prototype.readInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]|this[V+1]<<8|this[V+2]<<16|this[V+3]<<24},J.prototype.readInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]<<24|this[V+1]<<16|this[V+2]<<8|this[V+3]},J.prototype.readFloatLE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!0,23,4)},J.prototype.readFloatBE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!1,23,4)},J.prototype.readDoubleLE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!0,52,8)},J.prototype.readDoubleBE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!1,52,8)};function y(k,V,X,O,_,l){if(!J.isBuffer(k))throw TypeError('"buffer" argument must be a Buffer instance');if(V>_||Vk.length)throw RangeError("Index out of range")}J.prototype.writeUintLE=J.prototype.writeUIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=1,Q0=0;this[X]=V&255;while(++Q0>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=O-1,Q0=1;this[X+d]=V&255;while(--d>=0&&(Q0*=256))this[X+d]=V/Q0&255;return X+O},J.prototype.writeUint8=J.prototype.writeUInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,255,0);return this[X]=V&255,X+1},J.prototype.writeUint16LE=J.prototype.writeUInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeUint16BE=J.prototype.writeUInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeUint32LE=J.prototype.writeUInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X+3]=V>>>24,this[X+2]=V>>>16,this[X+1]=V>>>8,this[X]=V&255,X+4},J.prototype.writeUint32BE=J.prototype.writeUInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4},J.prototype.writeIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=0,Q0=1,X0=0;this[X]=V&255;while(++d>0)-X0&255}return X+O},J.prototype.writeIntBE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=O-1,Q0=1,X0=0;this[X+d]=V&255;while(--d>=0&&(Q0*=256)){if(V<0&&X0===0&&this[X+d+1]!==0)X0=1;this[X+d]=(V/Q0>>0)-X0&255}return X+O},J.prototype.writeInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,127,-128);if(V<0)V=255+V+1;return this[X]=V&255,X+1},J.prototype.writeInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);return this[X]=V&255,this[X+1]=V>>>8,this[X+2]=V>>>16,this[X+3]=V>>>24,X+4},J.prototype.writeInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);if(V<0)V=4294967295+V+1;return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4};function n(k,V,X,O,_,l){if(X+O>k.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function o(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return G.write(k,V,X,O,23,4),X+4}J.prototype.writeFloatLE=function(V,X,O){return o(this,V,X,!0,O)},J.prototype.writeFloatBE=function(V,X,O){return o(this,V,X,!1,O)};function Y0(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return G.write(k,V,X,O,52,8),X+8}J.prototype.writeDoubleLE=function(V,X,O){return Y0(this,V,X,!0,O)},J.prototype.writeDoubleBE=function(V,X,O){return Y0(this,V,X,!1,O)},J.prototype.copy=function(V,X,O,_){if(!J.isBuffer(V))throw TypeError("argument should be a Buffer");if(!O)O=0;if(!_&&_!==0)_=this.length;if(X>=V.length)X=V.length;if(!X)X=0;if(_>0&&_=this.length)throw RangeError("Index out of range");if(_<0)throw RangeError("sourceEnd out of bounds");if(_>this.length)_=this.length;if(V.length-X<_-O)_=V.length-X+O;var l=_-O;if(this===V&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(X,O,_);else Uint8Array.prototype.set.call(V,this.subarray(O,_),X);return l},J.prototype.fill=function(V,X,O,_){if(typeof V==="string"){if(typeof X==="string")_=X,X=0,O=this.length;else if(typeof O==="string")_=O,O=this.length;if(_!==void 0&&typeof _!=="string")throw TypeError("encoding must be a string");if(typeof _==="string"&&!J.isEncoding(_))throw TypeError("Unknown encoding: "+_);if(V.length===1){var l=V.charCodeAt(0);if(_==="utf8"&&l<128||_==="latin1")V=l}}else if(typeof V==="number")V=V&255;else if(typeof V==="boolean")V=Number(V);if(X<0||this.length>>0,O=O===void 0?this.length:O>>>0,!V)V=0;var d;if(typeof V==="number")for(d=X;d55295&&X<57344){if(!_){if(X>56319){if((V-=3)>-1)l.push(239,191,189);continue}else if(d+1===O){if((V-=3)>-1)l.push(239,191,189);continue}_=X;continue}if(X<56320){if((V-=3)>-1)l.push(239,191,189);_=X;continue}X=(_-55296<<10|X-56320)+65536}else if(_){if((V-=3)>-1)l.push(239,191,189)}if(_=null,X<128){if((V-=1)<0)break;l.push(X)}else if(X<2048){if((V-=2)<0)break;l.push(X>>6|192,X&63|128)}else if(X<65536){if((V-=3)<0)break;l.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((V-=4)<0)break;l.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw Error("Invalid code point")}return l}function u(k){var V=[];for(var X=0;X>8,_=X%256,l.push(_),l.push(O)}return l}function Z0(k){return U.toByteArray(z(k))}function g(k,V,X,O){for(var _=0;_=V.length||_>=k.length)break;V[_+X]=k[_]}return _}function f(k,V){return k instanceof V||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===V.name}function R(k){return k!==k}var p=function(){var k="0123456789abcdef",V=Array(256);for(var X=0;X<16;++X){var O=X*16;for(var _=0;_<16;++_)V[O+_]=k[X]+k[_]}return V}()}),MB=R0((B,U)=>{U.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var Y={},Q=Symbol("test"),K=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var Z=42;Y[Q]=Z;for(var J in Y)return!1;if(typeof Object.keys==="function"&&Object.keys(Y).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(Y).length!==0)return!1;var q=Object.getOwnPropertySymbols(Y);if(q.length!==1||q[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(Y,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var W=Object.getOwnPropertyDescriptor(Y,Q);if(W.value!==Z||W.enumerable!==!0)return!1}return!0}}),b8=R0((B,U)=>{var G=MB();U.exports=function(){return G()&&!!Symbol.toStringTag}}),RB=R0((B,U)=>{U.exports=Object}),HU=R0((B,U)=>{U.exports=Error}),FU=R0((B,U)=>{U.exports=EvalError}),WU=R0((B,U)=>{U.exports=RangeError}),PU=R0((B,U)=>{U.exports=ReferenceError}),LB=R0((B,U)=>{U.exports=SyntaxError}),x1=R0((B,U)=>{U.exports=TypeError}),AU=R0((B,U)=>{U.exports=URIError}),jU=R0((B,U)=>{U.exports=Math.abs}),NU=R0((B,U)=>{U.exports=Math.floor}),wU=R0((B,U)=>{U.exports=Math.max}),zU=R0((B,U)=>{U.exports=Math.min}),EU=R0((B,U)=>{U.exports=Math.pow}),DU=R0((B,U)=>{U.exports=Math.round}),TU=R0((B,U)=>{U.exports=Number.isNaN||function(Y){return Y!==Y}}),CU=R0((B,U)=>{var G=TU();U.exports=function(Q){if(G(Q)||Q===0)return Q;return Q<0?-1:1}}),kU=R0((B,U)=>{U.exports=Object.getOwnPropertyDescriptor}),K1=R0((B,U)=>{var G=kU();if(G)try{G([],"length")}catch(Y){G=null}U.exports=G}),_1=R0((B,U)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(Y){G=!1}U.exports=G}),$U=R0((B,U)=>{var G=typeof Symbol<"u"&&Symbol,Y=MB();U.exports=function(){if(typeof G!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof G("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return Y()}}),IB=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),OB=R0((B,U)=>{U.exports=RB().getPrototypeOf||null}),SU=R0((B,U)=>{var G="Function.prototype.bind called on incompatible ",Y=Object.prototype.toString,Q=Math.max,K="[object Function]",Z=function(I,H){var T=[];for(var A=0;A{var G=SU();U.exports=Function.prototype.bind||G}),v8=R0((B,U)=>{U.exports=Function.prototype.call}),y8=R0((B,U)=>{U.exports=Function.prototype.apply}),bU=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),HB=R0((B,U)=>{var G=V1(),Y=y8(),Q=v8();U.exports=bU()||G.call(Q,Y)}),g8=R0((B,U)=>{var G=V1(),Y=x1(),Q=v8(),K=HB();U.exports=function(J){if(J.length<1||typeof J[0]!=="function")throw new Y("a function is required");return K(G,Q,J)}}),vU=R0((B,U)=>{var G=g8(),Y=K1(),Q;try{Q=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var K=!!Q&&Y&&Y(Object.prototype,"__proto__"),Z=Object,J=Z.getPrototypeOf;U.exports=K&&typeof K.get==="function"?G([K.get]):typeof J==="function"?function(W){return J(W==null?W:Z(W))}:!1}),FB=R0((B,U)=>{var G=IB(),Y=OB(),Q=vU();U.exports=G?function(Z){return G(Z)}:Y?function(Z){if(!Z||typeof Z!=="object"&&typeof Z!=="function")throw TypeError("getProto: not an object");return Y(Z)}:Q?function(Z){return Q(Z)}:null}),yU=R0((B,U)=>{var G=Function.prototype.call,Y=Object.prototype.hasOwnProperty;U.exports=V1().call(G,Y)}),WB=R0((B,U)=>{var G,Y=RB(),Q=HU(),K=FU(),Z=WU(),J=PU(),q=LB(),W=x1(),I=AU(),H=jU(),T=NU(),A=wU(),P=zU(),j=EU(),E=DU(),C=CU(),N=Function,v=function(h){try{return N('"use strict"; return ('+h+").constructor;")()}catch(Z0){}},S=K1(),F=_1(),M=function(){throw new W},$=S?function(){try{return arguments.callee,M}catch(h){try{return S(arguments,"callee").get}catch(Z0){return M}}}():M,x=$U()(),w=FB(),a=OB(),U0=IB(),b=y8(),c=v8(),D={},m=typeof Uint8Array>"u"||!w?G:w(Uint8Array),B0={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":x&&w?w([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":D,"%AsyncGenerator%":D,"%AsyncGeneratorFunction%":D,"%AsyncIteratorPrototype%":D,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q,"%eval%":eval,"%EvalError%":K,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":N,"%GeneratorFunction%":D,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":x&&w?w(w([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!x||!w?G:w(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Y,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Z,"%ReferenceError%":J,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!x||!w?G:w(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":x&&w?w(""[Symbol.iterator]()):G,"%Symbol%":x?Symbol:G,"%SyntaxError%":q,"%ThrowTypeError%":$,"%TypedArray%":m,"%TypeError%":W,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":I,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":c,"%Function.prototype.apply%":b,"%Object.defineProperty%":F,"%Object.getPrototypeOf%":a,"%Math.abs%":H,"%Math.floor%":T,"%Math.max%":A,"%Math.min%":P,"%Math.pow%":j,"%Math.round%":E,"%Math.sign%":C,"%Reflect.getPrototypeOf%":U0};if(w)try{null.error}catch(h){B0["%Error.prototype%"]=w(w(h))}var i=function h(Z0){var g;if(Z0==="%AsyncFunction%")g=v("async function () {}");else if(Z0==="%GeneratorFunction%")g=v("function* () {}");else if(Z0==="%AsyncGeneratorFunction%")g=v("async function* () {}");else if(Z0==="%AsyncGenerator%"){var f=h("%AsyncGeneratorFunction%");if(f)g=f.prototype}else if(Z0==="%AsyncIteratorPrototype%"){var R=h("%AsyncGenerator%");if(R&&w)g=w(R.prototype)}return B0[Z0]=g,g},V0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},s=V1(),G0=yU(),r=s.call(c,Array.prototype.concat),y=s.call(b,Array.prototype.splice),n=s.call(c,String.prototype.replace),o=s.call(c,String.prototype.slice),Y0=s.call(c,RegExp.prototype.exec),O0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,z=/\\(\\)?/g,L=function(Z0){var g=o(Z0,0,1),f=o(Z0,-1);if(g==="%"&&f!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(f==="%"&&g!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var R=[];return n(Z0,O0,function(p,k,V,X){R[R.length]=V?n(X,z,"$1"):k||p}),R},u=function(Z0,g){var f=Z0,R;if(G0(V0,f))R=V0[f],f="%"+R[0]+"%";if(G0(B0,f)){var p=B0[f];if(p===D)p=i(f);if(typeof p>"u"&&!g)throw new W("intrinsic "+Z0+" exists, but is not available. Please file an issue!");return{alias:R,name:f,value:p}}throw new q("intrinsic "+Z0+" does not exist!")};U.exports=function(Z0,g){if(typeof Z0!=="string"||Z0.length===0)throw new W("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof g!=="boolean")throw new W('"allowMissing" argument must be a boolean');if(Y0(/^%?[^%]*%?$/,Z0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=L(Z0),R=f.length>0?f[0]:"",p=u("%"+R+"%",g),k=p.name,V=p.value,X=!1,O=p.alias;if(O)R=O[0],y(f,r([0,1],O));for(var _=1,l=!0;_=f.length){var K0=S(V,d);if(l=!!K0,l&&"get"in K0&&!("originalValue"in K0.get))V=K0.get;else V=V[d]}else l=G0(V,d),V=V[d];if(l&&!X)B0[k]=V}}return V}}),PB=R0((B,U)=>{var G=WB(),Y=g8(),Q=Y([G("%String.prototype.indexOf%")]);U.exports=function(Z,J){var q=G(Z,!!J);if(typeof q==="function"&&Q(Z,".prototype.")>-1)return Y([q]);return q}}),gU=R0((B,U)=>{var G=b8()(),Y=PB()("Object.prototype.toString"),Q=function(q){if(G&&q&&typeof q==="object"&&Symbol.toStringTag in q)return!1;return Y(q)==="[object Arguments]"},K=function(q){if(Q(q))return!0;return q!==null&&typeof q==="object"&&"length"in q&&typeof q.length==="number"&&q.length>=0&&Y(q)!=="[object Array]"&&"callee"in q&&Y(q.callee)==="[object Function]"},Z=function(){return Q(arguments)}();Q.isLegacyArguments=K,U.exports=Z?Q:K}),fU=R0((B,U)=>{var G=Object.prototype.toString,Y=Function.prototype.toString,Q=/^\s*(?:function)?\*/,K=b8()(),Z=Object.getPrototypeOf,J=function(){if(!K)return!1;try{return Function("return function*() {}")()}catch(W){}},q;U.exports=function(I){if(typeof I!=="function")return!1;if(Q.test(Y.call(I)))return!0;if(!K)return G.call(I)==="[object GeneratorFunction]";if(!Z)return!1;if(typeof q>"u"){var H=J();q=H?Z(H):!1}return Z(I)===q}}),xU=R0((B,U)=>{var G=Function.prototype.toString,Y=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,Q,K;if(typeof Y==="function"&&typeof Object.defineProperty==="function")try{Q=Object.defineProperty({},"length",{get:function(){throw K}}),K={},Y(function(){throw 42},null,Q)}catch(S){if(S!==K)Y=null}else Y=null;var Z=/^\s*class\b/,J=function(F){try{var M=G.call(F);return Z.test(M)}catch($){return!1}},q=function(F){try{if(J(F))return!1;return G.call(F),!0}catch(M){return!1}},W=Object.prototype.toString,I="[object Object]",H="[object Function]",T="[object GeneratorFunction]",A="[object HTMLAllCollection]",P="[object HTML document.all class]",j="[object HTMLCollection]",E=typeof Symbol==="function"&&!!Symbol.toStringTag,C=!(0 in[,]),N=function(){return!1};if(typeof document==="object"){var v=document.all;if(W.call(v)===W.call(document.all))N=function(F){if((C||!F)&&(typeof F>"u"||typeof F==="object"))try{var M=W.call(F);return(M===A||M===P||M===j||M===I)&&F("")==null}catch($){}return!1}}U.exports=Y?function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;try{Y(F,null,Q)}catch(M){if(M!==K)return!1}return!J(F)&&q(F)}:function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;if(E)return q(F);if(J(F))return!1;var M=W.call(F);if(M!==H&&M!==T&&!/^\[object HTML/.test(M))return!1;return q(F)}}),_U=R0((B,U)=>{var G=xU(),Y=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,K=function(I,H,T){for(var A=0,P=I.length;A=3)A=T;if(q(I))K(I,H,A);else if(typeof I==="string")Z(I,H,A);else J(I,H,A)}}),hU=R0((B,U)=>{U.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),uU=R0((B,U)=>{d2();var G=hU(),Y=typeof globalThis>"u"?v0:globalThis;U.exports=function(){var K=[];for(var Z=0;Z{var G=_1(),Y=LB(),Q=x1(),K=K1();U.exports=function(J,q,W){if(!J||typeof J!=="object"&&typeof J!=="function")throw new Q("`obj` must be an object or a function`");if(typeof q!=="string"&&typeof q!=="symbol")throw new Q("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new Q("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new Q("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new Q("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new Q("`loose`, if provided, must be a boolean");var I=arguments.length>3?arguments[3]:null,H=arguments.length>4?arguments[4]:null,T=arguments.length>5?arguments[5]:null,A=arguments.length>6?arguments[6]:!1,P=!!K&&K(J,q);if(G)G(J,q,{configurable:T===null&&P?P.configurable:!T,enumerable:I===null&&P?P.enumerable:!I,value:W,writable:H===null&&P?P.writable:!H});else if(A||!I&&!H&&!T)J[q]=W;else throw new Y("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),cU=R0((B,U)=>{var G=_1(),Y=function(){return!!G};Y.hasArrayLengthDefineBug=function(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(K){return!0}},U.exports=Y}),mU=R0((B,U)=>{var G=WB(),Y=dU(),Q=cU()(),K=K1(),Z=x1(),J=G("%Math.floor%");U.exports=function(W,I){if(typeof W!=="function")throw new Z("`fn` is not a function");if(typeof I!=="number"||I<0||I>4294967295||J(I)!==I)throw new Z("`length` must be a positive 32-bit integer");var H=arguments.length>2&&!!arguments[2],T=!0,A=!0;if("length"in W&&K){var P=K(W,"length");if(P&&!P.configurable)T=!1;if(P&&!P.writable)A=!1}if(T||A||!H)if(Q)Y(W,"length",I,!0,!0);else Y(W,"length",I);return W}}),lU=R0((B,U)=>{var G=V1(),Y=y8(),Q=HB();U.exports=function(){return Q(G,Y,arguments)}}),aU=R0((B,U)=>{var G=mU(),Y=_1(),Q=g8(),K=lU();if(U.exports=function(J){var q=Q(arguments),W=J.length-(arguments.length-1);return G(q,1+(W>0?W:0),!0)},Y)Y(U.exports,"apply",{value:K});else U.exports.apply=K}),AB=R0((B,U)=>{d2();var G=_U(),Y=uU(),Q=aU(),K=PB(),Z=K1(),J=FB(),q=K("Object.prototype.toString"),W=b8()(),I=typeof globalThis>"u"?v0:globalThis,H=Y(),T=K("String.prototype.slice"),A=K("Array.prototype.indexOf",!0)||function(N,v){for(var S=0;S-1)return v;if(v!=="Object")return!1;return E(N)}if(!Z)return null;return j(N)}}),pU=R0((B,U)=>{var G=AB();U.exports=function(Q){return!!G(Q)}}),rU=R0((B)=>{var U=gU(),G=fU(),Y=AB(),Q=pU();function K(O){return O.call.bind(O)}var Z=typeof BigInt<"u",J=typeof Symbol<"u",q=K(Object.prototype.toString),W=K(Number.prototype.valueOf),I=K(String.prototype.valueOf),H=K(Boolean.prototype.valueOf);if(Z)var T=K(BigInt.prototype.valueOf);if(J)var A=K(Symbol.prototype.valueOf);function P(O,_){if(typeof O!=="object")return!1;try{return _(O),!0}catch(l){return!1}}B.isArgumentsObject=U,B.isGeneratorFunction=G,B.isTypedArray=Q;function j(O){return typeof Promise<"u"&&O instanceof Promise||O!==null&&typeof O==="object"&&typeof O.then==="function"&&typeof O.catch==="function"}B.isPromise=j;function E(O){if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)return ArrayBuffer.isView(O);return Q(O)||n(O)}B.isArrayBufferView=E;function C(O){return Y(O)==="Uint8Array"}B.isUint8Array=C;function N(O){return Y(O)==="Uint8ClampedArray"}B.isUint8ClampedArray=N;function v(O){return Y(O)==="Uint16Array"}B.isUint16Array=v;function S(O){return Y(O)==="Uint32Array"}B.isUint32Array=S;function F(O){return Y(O)==="Int8Array"}B.isInt8Array=F;function M(O){return Y(O)==="Int16Array"}B.isInt16Array=M;function $(O){return Y(O)==="Int32Array"}B.isInt32Array=$;function x(O){return Y(O)==="Float32Array"}B.isFloat32Array=x;function w(O){return Y(O)==="Float64Array"}B.isFloat64Array=w;function a(O){return Y(O)==="BigInt64Array"}B.isBigInt64Array=a;function U0(O){return Y(O)==="BigUint64Array"}B.isBigUint64Array=U0;function b(O){return q(O)==="[object Map]"}b.working=typeof Map<"u"&&b(new Map);function c(O){if(typeof Map>"u")return!1;return b.working?b(O):O instanceof Map}B.isMap=c;function D(O){return q(O)==="[object Set]"}D.working=typeof Set<"u"&&D(new Set);function m(O){if(typeof Set>"u")return!1;return D.working?D(O):O instanceof Set}B.isSet=m;function B0(O){return q(O)==="[object WeakMap]"}B0.working=typeof WeakMap<"u"&&B0(new WeakMap);function i(O){if(typeof WeakMap>"u")return!1;return B0.working?B0(O):O instanceof WeakMap}B.isWeakMap=i;function V0(O){return q(O)==="[object WeakSet]"}V0.working=typeof WeakSet<"u"&&V0(new WeakSet);function s(O){return V0(O)}B.isWeakSet=s;function G0(O){return q(O)==="[object ArrayBuffer]"}G0.working=typeof ArrayBuffer<"u"&&G0(new ArrayBuffer);function r(O){if(typeof ArrayBuffer>"u")return!1;return G0.working?G0(O):O instanceof ArrayBuffer}B.isArrayBuffer=r;function y(O){return q(O)==="[object DataView]"}y.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&y(new DataView(new ArrayBuffer(1),0,1));function n(O){if(typeof DataView>"u")return!1;return y.working?y(O):O instanceof DataView}B.isDataView=n;var o=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Y0(O){return q(O)==="[object SharedArrayBuffer]"}function O0(O){if(typeof o>"u")return!1;if(typeof Y0.working>"u")Y0.working=Y0(new o);return Y0.working?Y0(O):O instanceof o}B.isSharedArrayBuffer=O0;function z(O){return q(O)==="[object AsyncFunction]"}B.isAsyncFunction=z;function L(O){return q(O)==="[object Map Iterator]"}B.isMapIterator=L;function u(O){return q(O)==="[object Set Iterator]"}B.isSetIterator=u;function h(O){return q(O)==="[object Generator]"}B.isGeneratorObject=h;function Z0(O){return q(O)==="[object WebAssembly.Module]"}B.isWebAssemblyCompiledModule=Z0;function g(O){return P(O,W)}B.isNumberObject=g;function f(O){return P(O,I)}B.isStringObject=f;function R(O){return P(O,H)}B.isBooleanObject=R;function p(O){return Z&&P(O,T)}B.isBigIntObject=p;function k(O){return J&&P(O,A)}B.isSymbolObject=k;function V(O){return g(O)||f(O)||R(O)||p(O)||k(O)}B.isBoxedPrimitive=V;function X(O){return typeof Uint8Array<"u"&&(r(O)||O0(O))}B.isAnyArrayBuffer=X,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(O){Object.defineProperty(B,O,{enumerable:!1,value:function(){throw Error(O+" is not supported in userland")}})})}),iU=R0((B,U)=>{U.exports=function(Y){return Y&&typeof Y==="object"&&typeof Y.copy==="function"&&typeof Y.fill==="function"&&typeof Y.readUInt8==="function"}}),jB=R0((B)=>{P2();var U=Object.getOwnPropertyDescriptors||function(n){var o=Object.keys(n),Y0={};for(var O0=0;O0=O0)return u;switch(u){case"%s":return String(Y0[o++]);case"%d":return Number(Y0[o++]);case"%j":try{return JSON.stringify(Y0[o++])}catch(h){return"[Circular]"}default:return u}});for(var L=Y0[o];o"u")return function(){return B.deprecate(y,n).apply(this,arguments)};var o=!1;function Y0(){if(!o){if(P0.throwDeprecation)throw Error(n);else if(P0.traceDeprecation)console.trace(n);else console.error(n);o=!0}return y.apply(this,arguments)}return Y0};var Y={},Q=/^$/;if(P0.env.NODE_DEBUG){var K=P0.env.NODE_DEBUG;K=K.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Q=new RegExp("^"+K+"$","i")}B.debuglog=function(y){if(y=y.toUpperCase(),!Y[y])if(Q.test(y)){var n=P0.pid;Y[y]=function(){var o=B.format.apply(B,arguments);console.error("%s %d: %s",y,n,o)}}else Y[y]=function(){};return Y[y]};function Z(y,n){var o={seen:[],stylize:q};if(arguments.length>=3)o.depth=arguments[2];if(arguments.length>=4)o.colors=arguments[3];if(C(n))o.showHidden=n;else if(n)B._extend(o,n);if($(o.showHidden))o.showHidden=!1;if($(o.depth))o.depth=2;if($(o.colors))o.colors=!1;if($(o.customInspect))o.customInspect=!0;if(o.colors)o.stylize=J;return I(o,y,o.depth)}B.inspect=Z,Z.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Z.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function J(y,n){var o=Z.styles[n];if(o)return"\x1B["+Z.colors[o][0]+"m"+y+"\x1B["+Z.colors[o][1]+"m";else return y}function q(y,n){return y}function W(y){var n={};return y.forEach(function(o,Y0){n[o]=!0}),n}function I(y,n,o){if(y.customInspect&&n&&b(n.inspect)&&n.inspect!==B.inspect&&!(n.constructor&&n.constructor.prototype===n)){var Y0=n.inspect(o,y);if(!F(Y0))Y0=I(y,Y0,o);return Y0}var O0=H(y,n);if(O0)return O0;var z=Object.keys(n),L=W(z);if(y.showHidden)z=Object.getOwnPropertyNames(n);if(U0(n)&&(z.indexOf("message")>=0||z.indexOf("description")>=0))return T(n);if(z.length===0){if(b(n)){var u=n.name?": "+n.name:"";return y.stylize("[Function"+u+"]","special")}if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");if(a(n))return y.stylize(Date.prototype.toString.call(n),"date");if(U0(n))return T(n)}var h="",Z0=!1,g=["{","}"];if(E(n))Z0=!0,g=["[","]"];if(b(n))h=" [Function"+(n.name?": "+n.name:"")+"]";if(x(n))h=" "+RegExp.prototype.toString.call(n);if(a(n))h=" "+Date.prototype.toUTCString.call(n);if(U0(n))h=" "+T(n);if(z.length===0&&(!Z0||n.length==0))return g[0]+h+g[1];if(o<0)if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");else return y.stylize("[Object]","special");y.seen.push(n);var f;if(Z0)f=A(y,n,o,L,z);else f=z.map(function(R){return P(y,n,o,L,R,Z0)});return y.seen.pop(),j(f,h,g)}function H(y,n){if($(n))return y.stylize("undefined","undefined");if(F(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return y.stylize(o,"string")}if(S(n))return y.stylize(""+n,"number");if(C(n))return y.stylize(""+n,"boolean");if(N(n))return y.stylize("null","null")}function T(y){return"["+Error.prototype.toString.call(y)+"]"}function A(y,n,o,Y0,O0){var z=[];for(var L=0,u=n.length;L-1)if(z)u=u.split(` +*/var f1=R0((B)=>{var U=IU(),G=OU(),Y=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=J,B.SlowBuffer=N,B.INSPECT_MAX_BYTES=50;var Q=2147483647;if(B.kMaxLength=Q,J.TYPED_ARRAY_SUPPORT=K(),!J.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error==="function")console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function K(){try{var k=new Uint8Array(1),V={foo:function(){return 42}};return Object.setPrototypeOf(V,Uint8Array.prototype),Object.setPrototypeOf(k,V),k.foo()===42}catch(X){return!1}}Object.defineProperty(J.prototype,"parent",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.buffer}}),Object.defineProperty(J.prototype,"offset",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.byteOffset}});function Z(k){if(k>Q)throw RangeError('The value "'+k+'" is invalid for option "size"');var V=new Uint8Array(k);return Object.setPrototypeOf(V,J.prototype),V}function J(k,V,X){if(typeof k==="number"){if(typeof V==="string")throw TypeError('The "string" argument must be of type string. Received type number');return H(k)}return q(k,V,X)}J.poolSize=8192;function q(k,V,X){if(typeof k==="string")return T(k,V);if(ArrayBuffer.isView(k))return P(k);if(k==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(f(k,ArrayBuffer)||k&&f(k.buffer,ArrayBuffer))return j(k,V,X);if(typeof SharedArrayBuffer<"u"&&(f(k,SharedArrayBuffer)||k&&f(k.buffer,SharedArrayBuffer)))return j(k,V,X);if(typeof k==="number")throw TypeError('The "value" argument must not be of type number. Received type number');var O=k.valueOf&&k.valueOf();if(O!=null&&O!==k)return J.from(O,V,X);var _=E(k);if(_)return _;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]==="function")return J.from(k[Symbol.toPrimitive]("string"),V,X);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}J.from=function(k,V,X){return q(k,V,X)},Object.setPrototypeOf(J.prototype,Uint8Array.prototype),Object.setPrototypeOf(J,Uint8Array);function W(k){if(typeof k!=="number")throw TypeError('"size" argument must be of type number');else if(k<0)throw RangeError('The value "'+k+'" is invalid for option "size"')}function I(k,V,X){if(W(k),k<=0)return Z(k);if(V!==void 0)return typeof X==="string"?Z(k).fill(V,X):Z(k).fill(V);return Z(k)}J.alloc=function(k,V,X){return I(k,V,X)};function H(k){return W(k),Z(k<0?0:C(k)|0)}J.allocUnsafe=function(k){return H(k)},J.allocUnsafeSlow=function(k){return H(k)};function T(k,V){if(typeof V!=="string"||V==="")V="utf8";if(!J.isEncoding(V))throw TypeError("Unknown encoding: "+V);var X=v(k,V)|0,O=Z(X),_=O.write(k,V);if(_!==X)O=O.slice(0,_);return O}function A(k){var V=k.length<0?0:C(k.length)|0,X=Z(V);for(var O=0;O=Q)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return k|0}function N(k){if(+k!=k)k=0;return J.alloc(+k)}J.isBuffer=function(V){return V!=null&&V._isBuffer===!0&&V!==J.prototype},J.compare=function(V,X){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(f(X,Uint8Array))X=J.from(X,X.offset,X.byteLength);if(!J.isBuffer(V)||!J.isBuffer(X))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(V===X)return 0;var O=V.length,_=X.length;for(var l=0,d=Math.min(O,_);l_.length)J.from(d).copy(_,l);else Uint8Array.prototype.set.call(_,d,l);else if(!J.isBuffer(d))throw TypeError('"list" argument must be an Array of Buffers');else d.copy(_,l);l+=d.length}return _};function v(k,V){if(J.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||f(k,ArrayBuffer))return k.byteLength;if(typeof k!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);var X=k.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&X===0)return 0;var _=!1;for(;;)switch(V){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return L(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return Z0(k).length;default:if(_)return O?-1:L(k).length;V=(""+V).toLowerCase(),_=!0}}J.byteLength=v;function S(k,V,X){var O=!1;if(V===void 0||V<0)V=0;if(V>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,V>>>=0,X<=V)return"";if(!k)k="utf8";while(!0)switch(k){case"hex":return s(this,V,X);case"utf8":case"utf-8":return D(this,V,X);case"ascii":return i(this,V,X);case"latin1":case"binary":return V0(this,V,X);case"base64":return c(this,V,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G0(this,V,X);default:if(O)throw TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),O=!0}}J.prototype._isBuffer=!0;function F(k,V,X){var O=k[V];k[V]=k[X],k[X]=O}if(J.prototype.swap16=function(){var V=this.length;if(V%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var X=0;XX)V+=" ... ";return""},Y)J.prototype[Y]=J.prototype.inspect;J.prototype.compare=function(V,X,O,_,l){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(!J.isBuffer(V))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof V);if(X===void 0)X=0;if(O===void 0)O=V?V.length:0;if(_===void 0)_=0;if(l===void 0)l=this.length;if(X<0||O>V.length||_<0||l>this.length)throw RangeError("out of range index");if(_>=l&&X>=O)return 0;if(_>=l)return-1;if(X>=O)return 1;if(X>>>=0,O>>>=0,_>>>=0,l>>>=0,this===V)return 0;var d=l-_,Q0=O-X,X0=Math.min(d,Q0),K0=this.slice(_,l),I0=V.slice(X,O);for(var F0=0;F02147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,R(X))X=_?0:k.length-1;if(X<0)X=k.length+X;if(X>=k.length)if(_)return-1;else X=k.length-1;else if(X<0)if(_)X=0;else return-1;if(typeof V==="string")V=J.from(V,O);if(J.isBuffer(V)){if(V.length===0)return-1;return $(k,V,X,O,_)}else if(typeof V==="number"){if(V=V&255,typeof Uint8Array.prototype.indexOf==="function")if(_)return Uint8Array.prototype.indexOf.call(k,V,X);else return Uint8Array.prototype.lastIndexOf.call(k,V,X);return $(k,[V],X,O,_)}throw TypeError("val must be string, number or Buffer")}function $(k,V,X,O,_){var l=1,d=k.length,Q0=V.length;if(O!==void 0){if(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le"){if(k.length<2||V.length<2)return-1;l=2,d/=2,Q0/=2,X/=2}}function X0(k0,L2){if(l===1)return k0[L2];else return k0.readUInt16BE(L2*l)}var K0;if(_){var I0=-1;for(K0=X;K0d)X=d-Q0;for(K0=X;K0>=0;K0--){var F0=!0;for(var W0=0;W0_)O=_;var l=V.length;if(O>l/2)O=l/2;for(var d=0;d>>0,isFinite(O)){if(O=O>>>0,_===void 0)_="utf8"}else _=O,O=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-X;if(O===void 0||O>l)O=l;if(V.length>0&&(O<0||X<0)||X>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!_)_="utf8";var d=!1;for(;;)switch(_){case"hex":return x(this,V,X,O);case"utf8":case"utf-8":return z(this,V,X,O);case"ascii":case"latin1":case"binary":return a(this,V,X,O);case"base64":return U0(this,V,X,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,V,X,O);default:if(d)throw TypeError("Unknown encoding: "+_);_=(""+_).toLowerCase(),d=!0}},J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c(k,V,X){if(V===0&&X===k.length)return U.fromByteArray(k);else return U.fromByteArray(k.slice(V,X))}function D(k,V,X){X=Math.min(k.length,X);var O=[],_=V;while(_239?4:l>223?3:l>191?2:1;if(_+Q0<=X){var X0,K0,I0,F0;switch(Q0){case 1:if(l<128)d=l;break;case 2:if(X0=k[_+1],(X0&192)===128){if(F0=(l&31)<<6|X0&63,F0>127)d=F0}break;case 3:if(X0=k[_+1],K0=k[_+2],(X0&192)===128&&(K0&192)===128){if(F0=(l&15)<<12|(X0&63)<<6|K0&63,F0>2047&&(F0<55296||F0>57343))d=F0}break;case 4:if(X0=k[_+1],K0=k[_+2],I0=k[_+3],(X0&192)===128&&(K0&192)===128&&(I0&192)===128){if(F0=(l&15)<<18|(X0&63)<<12|(K0&63)<<6|I0&63,F0>65535&&F0<1114112)d=F0}}}if(d===null)d=65533,Q0=1;else if(d>65535)d-=65536,O.push(d>>>10&1023|55296),d=56320|d&1023;O.push(d),_+=Q0}return B0(O)}var m=4096;function B0(k){var V=k.length;if(V<=m)return String.fromCharCode.apply(String,k);var X="",O=0;while(OO)X=O;var _="";for(var l=V;lO)V=O;if(X<0){if(X+=O,X<0)X=0}else if(X>O)X=O;if(XX)throw RangeError("Trying to access beyond buffer length")}J.prototype.readUintLE=J.prototype.readUIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V+--X],l=1;while(X>0&&(l*=256))_+=this[V+--X]*l;return _},J.prototype.readUint8=J.prototype.readUInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);return this[V]},J.prototype.readUint16LE=J.prototype.readUInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]|this[V+1]<<8},J.prototype.readUint16BE=J.prototype.readUInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]<<8|this[V+1]},J.prototype.readUint32LE=J.prototype.readUInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return(this[V]|this[V+1]<<8|this[V+2]<<16)+this[V+3]*16777216},J.prototype.readUint32BE=J.prototype.readUInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]*16777216+(this[V+1]<<16|this[V+2]<<8|this[V+3])},J.prototype.readIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d=l)_-=Math.pow(2,8*X);return _},J.prototype.readIntBE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=X,l=1,d=this[V+--_];while(_>0&&(l*=256))d+=this[V+--_]*l;if(l*=128,d>=l)d-=Math.pow(2,8*X);return d},J.prototype.readInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);if(!(this[V]&128))return this[V];return(255-this[V]+1)*-1},J.prototype.readInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V]|this[V+1]<<8;return O&32768?O|4294901760:O},J.prototype.readInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V+1]|this[V]<<8;return O&32768?O|4294901760:O},J.prototype.readInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]|this[V+1]<<8|this[V+2]<<16|this[V+3]<<24},J.prototype.readInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]<<24|this[V+1]<<16|this[V+2]<<8|this[V+3]},J.prototype.readFloatLE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!0,23,4)},J.prototype.readFloatBE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!1,23,4)},J.prototype.readDoubleLE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!0,52,8)},J.prototype.readDoubleBE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!1,52,8)};function y(k,V,X,O,_,l){if(!J.isBuffer(k))throw TypeError('"buffer" argument must be a Buffer instance');if(V>_||Vk.length)throw RangeError("Index out of range")}J.prototype.writeUintLE=J.prototype.writeUIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=1,Q0=0;this[X]=V&255;while(++Q0>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=O-1,Q0=1;this[X+d]=V&255;while(--d>=0&&(Q0*=256))this[X+d]=V/Q0&255;return X+O},J.prototype.writeUint8=J.prototype.writeUInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,255,0);return this[X]=V&255,X+1},J.prototype.writeUint16LE=J.prototype.writeUInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeUint16BE=J.prototype.writeUInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeUint32LE=J.prototype.writeUInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X+3]=V>>>24,this[X+2]=V>>>16,this[X+1]=V>>>8,this[X]=V&255,X+4},J.prototype.writeUint32BE=J.prototype.writeUInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4},J.prototype.writeIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=0,Q0=1,X0=0;this[X]=V&255;while(++d>0)-X0&255}return X+O},J.prototype.writeIntBE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=O-1,Q0=1,X0=0;this[X+d]=V&255;while(--d>=0&&(Q0*=256)){if(V<0&&X0===0&&this[X+d+1]!==0)X0=1;this[X+d]=(V/Q0>>0)-X0&255}return X+O},J.prototype.writeInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,127,-128);if(V<0)V=255+V+1;return this[X]=V&255,X+1},J.prototype.writeInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);return this[X]=V&255,this[X+1]=V>>>8,this[X+2]=V>>>16,this[X+3]=V>>>24,X+4},J.prototype.writeInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);if(V<0)V=4294967295+V+1;return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4};function n(k,V,X,O,_,l){if(X+O>k.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function o(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return G.write(k,V,X,O,23,4),X+4}J.prototype.writeFloatLE=function(V,X,O){return o(this,V,X,!0,O)},J.prototype.writeFloatBE=function(V,X,O){return o(this,V,X,!1,O)};function Y0(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return G.write(k,V,X,O,52,8),X+8}J.prototype.writeDoubleLE=function(V,X,O){return Y0(this,V,X,!0,O)},J.prototype.writeDoubleBE=function(V,X,O){return Y0(this,V,X,!1,O)},J.prototype.copy=function(V,X,O,_){if(!J.isBuffer(V))throw TypeError("argument should be a Buffer");if(!O)O=0;if(!_&&_!==0)_=this.length;if(X>=V.length)X=V.length;if(!X)X=0;if(_>0&&_=this.length)throw RangeError("Index out of range");if(_<0)throw RangeError("sourceEnd out of bounds");if(_>this.length)_=this.length;if(V.length-X<_-O)_=V.length-X+O;var l=_-O;if(this===V&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(X,O,_);else Uint8Array.prototype.set.call(V,this.subarray(O,_),X);return l},J.prototype.fill=function(V,X,O,_){if(typeof V==="string"){if(typeof X==="string")_=X,X=0,O=this.length;else if(typeof O==="string")_=O,O=this.length;if(_!==void 0&&typeof _!=="string")throw TypeError("encoding must be a string");if(typeof _==="string"&&!J.isEncoding(_))throw TypeError("Unknown encoding: "+_);if(V.length===1){var l=V.charCodeAt(0);if(_==="utf8"&&l<128||_==="latin1")V=l}}else if(typeof V==="number")V=V&255;else if(typeof V==="boolean")V=Number(V);if(X<0||this.length>>0,O=O===void 0?this.length:O>>>0,!V)V=0;var d;if(typeof V==="number")for(d=X;d55295&&X<57344){if(!_){if(X>56319){if((V-=3)>-1)l.push(239,191,189);continue}else if(d+1===O){if((V-=3)>-1)l.push(239,191,189);continue}_=X;continue}if(X<56320){if((V-=3)>-1)l.push(239,191,189);_=X;continue}X=(_-55296<<10|X-56320)+65536}else if(_){if((V-=3)>-1)l.push(239,191,189)}if(_=null,X<128){if((V-=1)<0)break;l.push(X)}else if(X<2048){if((V-=2)<0)break;l.push(X>>6|192,X&63|128)}else if(X<65536){if((V-=3)<0)break;l.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((V-=4)<0)break;l.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw Error("Invalid code point")}return l}function u(k){var V=[];for(var X=0;X>8,_=X%256,l.push(_),l.push(O)}return l}function Z0(k){return U.toByteArray(w(k))}function g(k,V,X,O){for(var _=0;_=V.length||_>=k.length)break;V[_+X]=k[_]}return _}function f(k,V){return k instanceof V||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===V.name}function R(k){return k!==k}var p=function(){var k="0123456789abcdef",V=Array(256);for(var X=0;X<16;++X){var O=X*16;for(var _=0;_<16;++_)V[O+_]=k[X]+k[_]}return V}()}),MB=R0((B,U)=>{U.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var Y={},Q=Symbol("test"),K=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var Z=42;Y[Q]=Z;for(var J in Y)return!1;if(typeof Object.keys==="function"&&Object.keys(Y).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(Y).length!==0)return!1;var q=Object.getOwnPropertySymbols(Y);if(q.length!==1||q[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(Y,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var W=Object.getOwnPropertyDescriptor(Y,Q);if(W.value!==Z||W.enumerable!==!0)return!1}return!0}}),b8=R0((B,U)=>{var G=MB();U.exports=function(){return G()&&!!Symbol.toStringTag}}),RB=R0((B,U)=>{U.exports=Object}),HU=R0((B,U)=>{U.exports=Error}),FU=R0((B,U)=>{U.exports=EvalError}),WU=R0((B,U)=>{U.exports=RangeError}),PU=R0((B,U)=>{U.exports=ReferenceError}),LB=R0((B,U)=>{U.exports=SyntaxError}),x1=R0((B,U)=>{U.exports=TypeError}),AU=R0((B,U)=>{U.exports=URIError}),jU=R0((B,U)=>{U.exports=Math.abs}),NU=R0((B,U)=>{U.exports=Math.floor}),zU=R0((B,U)=>{U.exports=Math.max}),wU=R0((B,U)=>{U.exports=Math.min}),EU=R0((B,U)=>{U.exports=Math.pow}),DU=R0((B,U)=>{U.exports=Math.round}),TU=R0((B,U)=>{U.exports=Number.isNaN||function(Y){return Y!==Y}}),CU=R0((B,U)=>{var G=TU();U.exports=function(Q){if(G(Q)||Q===0)return Q;return Q<0?-1:1}}),kU=R0((B,U)=>{U.exports=Object.getOwnPropertyDescriptor}),K1=R0((B,U)=>{var G=kU();if(G)try{G([],"length")}catch(Y){G=null}U.exports=G}),_1=R0((B,U)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(Y){G=!1}U.exports=G}),$U=R0((B,U)=>{var G=typeof Symbol<"u"&&Symbol,Y=MB();U.exports=function(){if(typeof G!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof G("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return Y()}}),IB=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),OB=R0((B,U)=>{U.exports=RB().getPrototypeOf||null}),SU=R0((B,U)=>{var G="Function.prototype.bind called on incompatible ",Y=Object.prototype.toString,Q=Math.max,K="[object Function]",Z=function(I,H){var T=[];for(var A=0;A{var G=SU();U.exports=Function.prototype.bind||G}),v8=R0((B,U)=>{U.exports=Function.prototype.call}),y8=R0((B,U)=>{U.exports=Function.prototype.apply}),bU=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),HB=R0((B,U)=>{var G=V1(),Y=y8(),Q=v8();U.exports=bU()||G.call(Q,Y)}),g8=R0((B,U)=>{var G=V1(),Y=x1(),Q=v8(),K=HB();U.exports=function(J){if(J.length<1||typeof J[0]!=="function")throw new Y("a function is required");return K(G,Q,J)}}),vU=R0((B,U)=>{var G=g8(),Y=K1(),Q;try{Q=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var K=!!Q&&Y&&Y(Object.prototype,"__proto__"),Z=Object,J=Z.getPrototypeOf;U.exports=K&&typeof K.get==="function"?G([K.get]):typeof J==="function"?function(W){return J(W==null?W:Z(W))}:!1}),FB=R0((B,U)=>{var G=IB(),Y=OB(),Q=vU();U.exports=G?function(Z){return G(Z)}:Y?function(Z){if(!Z||typeof Z!=="object"&&typeof Z!=="function")throw TypeError("getProto: not an object");return Y(Z)}:Q?function(Z){return Q(Z)}:null}),yU=R0((B,U)=>{var G=Function.prototype.call,Y=Object.prototype.hasOwnProperty;U.exports=V1().call(G,Y)}),WB=R0((B,U)=>{var G,Y=RB(),Q=HU(),K=FU(),Z=WU(),J=PU(),q=LB(),W=x1(),I=AU(),H=jU(),T=NU(),A=zU(),P=wU(),j=EU(),E=DU(),C=CU(),N=Function,v=function(h){try{return N('"use strict"; return ('+h+").constructor;")()}catch(Z0){}},S=K1(),F=_1(),M=function(){throw new W},$=S?function(){try{return arguments.callee,M}catch(h){try{return S(arguments,"callee").get}catch(Z0){return M}}}():M,x=$U()(),z=FB(),a=OB(),U0=IB(),b=y8(),c=v8(),D={},m=typeof Uint8Array>"u"||!z?G:z(Uint8Array),B0={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":x&&z?z([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":D,"%AsyncGenerator%":D,"%AsyncGeneratorFunction%":D,"%AsyncIteratorPrototype%":D,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q,"%eval%":eval,"%EvalError%":K,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":N,"%GeneratorFunction%":D,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":x&&z?z(z([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!x||!z?G:z(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Y,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Z,"%ReferenceError%":J,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!x||!z?G:z(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":x&&z?z(""[Symbol.iterator]()):G,"%Symbol%":x?Symbol:G,"%SyntaxError%":q,"%ThrowTypeError%":$,"%TypedArray%":m,"%TypeError%":W,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":I,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":c,"%Function.prototype.apply%":b,"%Object.defineProperty%":F,"%Object.getPrototypeOf%":a,"%Math.abs%":H,"%Math.floor%":T,"%Math.max%":A,"%Math.min%":P,"%Math.pow%":j,"%Math.round%":E,"%Math.sign%":C,"%Reflect.getPrototypeOf%":U0};if(z)try{null.error}catch(h){B0["%Error.prototype%"]=z(z(h))}var i=function h(Z0){var g;if(Z0==="%AsyncFunction%")g=v("async function () {}");else if(Z0==="%GeneratorFunction%")g=v("function* () {}");else if(Z0==="%AsyncGeneratorFunction%")g=v("async function* () {}");else if(Z0==="%AsyncGenerator%"){var f=h("%AsyncGeneratorFunction%");if(f)g=f.prototype}else if(Z0==="%AsyncIteratorPrototype%"){var R=h("%AsyncGenerator%");if(R&&z)g=z(R.prototype)}return B0[Z0]=g,g},V0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},s=V1(),G0=yU(),r=s.call(c,Array.prototype.concat),y=s.call(b,Array.prototype.splice),n=s.call(c,String.prototype.replace),o=s.call(c,String.prototype.slice),Y0=s.call(c,RegExp.prototype.exec),O0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,L=function(Z0){var g=o(Z0,0,1),f=o(Z0,-1);if(g==="%"&&f!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(f==="%"&&g!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var R=[];return n(Z0,O0,function(p,k,V,X){R[R.length]=V?n(X,w,"$1"):k||p}),R},u=function(Z0,g){var f=Z0,R;if(G0(V0,f))R=V0[f],f="%"+R[0]+"%";if(G0(B0,f)){var p=B0[f];if(p===D)p=i(f);if(typeof p>"u"&&!g)throw new W("intrinsic "+Z0+" exists, but is not available. Please file an issue!");return{alias:R,name:f,value:p}}throw new q("intrinsic "+Z0+" does not exist!")};U.exports=function(Z0,g){if(typeof Z0!=="string"||Z0.length===0)throw new W("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof g!=="boolean")throw new W('"allowMissing" argument must be a boolean');if(Y0(/^%?[^%]*%?$/,Z0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=L(Z0),R=f.length>0?f[0]:"",p=u("%"+R+"%",g),k=p.name,V=p.value,X=!1,O=p.alias;if(O)R=O[0],y(f,r([0,1],O));for(var _=1,l=!0;_=f.length){var K0=S(V,d);if(l=!!K0,l&&"get"in K0&&!("originalValue"in K0.get))V=K0.get;else V=V[d]}else l=G0(V,d),V=V[d];if(l&&!X)B0[k]=V}}return V}}),PB=R0((B,U)=>{var G=WB(),Y=g8(),Q=Y([G("%String.prototype.indexOf%")]);U.exports=function(Z,J){var q=G(Z,!!J);if(typeof q==="function"&&Q(Z,".prototype.")>-1)return Y([q]);return q}}),gU=R0((B,U)=>{var G=b8()(),Y=PB()("Object.prototype.toString"),Q=function(q){if(G&&q&&typeof q==="object"&&Symbol.toStringTag in q)return!1;return Y(q)==="[object Arguments]"},K=function(q){if(Q(q))return!0;return q!==null&&typeof q==="object"&&"length"in q&&typeof q.length==="number"&&q.length>=0&&Y(q)!=="[object Array]"&&"callee"in q&&Y(q.callee)==="[object Function]"},Z=function(){return Q(arguments)}();Q.isLegacyArguments=K,U.exports=Z?Q:K}),fU=R0((B,U)=>{var G=Object.prototype.toString,Y=Function.prototype.toString,Q=/^\s*(?:function)?\*/,K=b8()(),Z=Object.getPrototypeOf,J=function(){if(!K)return!1;try{return Function("return function*() {}")()}catch(W){}},q;U.exports=function(I){if(typeof I!=="function")return!1;if(Q.test(Y.call(I)))return!0;if(!K)return G.call(I)==="[object GeneratorFunction]";if(!Z)return!1;if(typeof q>"u"){var H=J();q=H?Z(H):!1}return Z(I)===q}}),xU=R0((B,U)=>{var G=Function.prototype.toString,Y=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,Q,K;if(typeof Y==="function"&&typeof Object.defineProperty==="function")try{Q=Object.defineProperty({},"length",{get:function(){throw K}}),K={},Y(function(){throw 42},null,Q)}catch(S){if(S!==K)Y=null}else Y=null;var Z=/^\s*class\b/,J=function(F){try{var M=G.call(F);return Z.test(M)}catch($){return!1}},q=function(F){try{if(J(F))return!1;return G.call(F),!0}catch(M){return!1}},W=Object.prototype.toString,I="[object Object]",H="[object Function]",T="[object GeneratorFunction]",A="[object HTMLAllCollection]",P="[object HTML document.all class]",j="[object HTMLCollection]",E=typeof Symbol==="function"&&!!Symbol.toStringTag,C=!(0 in[,]),N=function(){return!1};if(typeof document==="object"){var v=document.all;if(W.call(v)===W.call(document.all))N=function(F){if((C||!F)&&(typeof F>"u"||typeof F==="object"))try{var M=W.call(F);return(M===A||M===P||M===j||M===I)&&F("")==null}catch($){}return!1}}U.exports=Y?function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;try{Y(F,null,Q)}catch(M){if(M!==K)return!1}return!J(F)&&q(F)}:function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;if(E)return q(F);if(J(F))return!1;var M=W.call(F);if(M!==H&&M!==T&&!/^\[object HTML/.test(M))return!1;return q(F)}}),_U=R0((B,U)=>{var G=xU(),Y=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,K=function(I,H,T){for(var A=0,P=I.length;A=3)A=T;if(q(I))K(I,H,A);else if(typeof I==="string")Z(I,H,A);else J(I,H,A)}}),hU=R0((B,U)=>{U.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),uU=R0((B,U)=>{d2();var G=hU(),Y=typeof globalThis>"u"?v0:globalThis;U.exports=function(){var K=[];for(var Z=0;Z{var G=_1(),Y=LB(),Q=x1(),K=K1();U.exports=function(J,q,W){if(!J||typeof J!=="object"&&typeof J!=="function")throw new Q("`obj` must be an object or a function`");if(typeof q!=="string"&&typeof q!=="symbol")throw new Q("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new Q("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new Q("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new Q("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new Q("`loose`, if provided, must be a boolean");var I=arguments.length>3?arguments[3]:null,H=arguments.length>4?arguments[4]:null,T=arguments.length>5?arguments[5]:null,A=arguments.length>6?arguments[6]:!1,P=!!K&&K(J,q);if(G)G(J,q,{configurable:T===null&&P?P.configurable:!T,enumerable:I===null&&P?P.enumerable:!I,value:W,writable:H===null&&P?P.writable:!H});else if(A||!I&&!H&&!T)J[q]=W;else throw new Y("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),cU=R0((B,U)=>{var G=_1(),Y=function(){return!!G};Y.hasArrayLengthDefineBug=function(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(K){return!0}},U.exports=Y}),mU=R0((B,U)=>{var G=WB(),Y=dU(),Q=cU()(),K=K1(),Z=x1(),J=G("%Math.floor%");U.exports=function(W,I){if(typeof W!=="function")throw new Z("`fn` is not a function");if(typeof I!=="number"||I<0||I>4294967295||J(I)!==I)throw new Z("`length` must be a positive 32-bit integer");var H=arguments.length>2&&!!arguments[2],T=!0,A=!0;if("length"in W&&K){var P=K(W,"length");if(P&&!P.configurable)T=!1;if(P&&!P.writable)A=!1}if(T||A||!H)if(Q)Y(W,"length",I,!0,!0);else Y(W,"length",I);return W}}),lU=R0((B,U)=>{var G=V1(),Y=y8(),Q=HB();U.exports=function(){return Q(G,Y,arguments)}}),aU=R0((B,U)=>{var G=mU(),Y=_1(),Q=g8(),K=lU();if(U.exports=function(J){var q=Q(arguments),W=J.length-(arguments.length-1);return G(q,1+(W>0?W:0),!0)},Y)Y(U.exports,"apply",{value:K});else U.exports.apply=K}),AB=R0((B,U)=>{d2();var G=_U(),Y=uU(),Q=aU(),K=PB(),Z=K1(),J=FB(),q=K("Object.prototype.toString"),W=b8()(),I=typeof globalThis>"u"?v0:globalThis,H=Y(),T=K("String.prototype.slice"),A=K("Array.prototype.indexOf",!0)||function(N,v){for(var S=0;S-1)return v;if(v!=="Object")return!1;return E(N)}if(!Z)return null;return j(N)}}),pU=R0((B,U)=>{var G=AB();U.exports=function(Q){return!!G(Q)}}),rU=R0((B)=>{var U=gU(),G=fU(),Y=AB(),Q=pU();function K(O){return O.call.bind(O)}var Z=typeof BigInt<"u",J=typeof Symbol<"u",q=K(Object.prototype.toString),W=K(Number.prototype.valueOf),I=K(String.prototype.valueOf),H=K(Boolean.prototype.valueOf);if(Z)var T=K(BigInt.prototype.valueOf);if(J)var A=K(Symbol.prototype.valueOf);function P(O,_){if(typeof O!=="object")return!1;try{return _(O),!0}catch(l){return!1}}B.isArgumentsObject=U,B.isGeneratorFunction=G,B.isTypedArray=Q;function j(O){return typeof Promise<"u"&&O instanceof Promise||O!==null&&typeof O==="object"&&typeof O.then==="function"&&typeof O.catch==="function"}B.isPromise=j;function E(O){if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)return ArrayBuffer.isView(O);return Q(O)||n(O)}B.isArrayBufferView=E;function C(O){return Y(O)==="Uint8Array"}B.isUint8Array=C;function N(O){return Y(O)==="Uint8ClampedArray"}B.isUint8ClampedArray=N;function v(O){return Y(O)==="Uint16Array"}B.isUint16Array=v;function S(O){return Y(O)==="Uint32Array"}B.isUint32Array=S;function F(O){return Y(O)==="Int8Array"}B.isInt8Array=F;function M(O){return Y(O)==="Int16Array"}B.isInt16Array=M;function $(O){return Y(O)==="Int32Array"}B.isInt32Array=$;function x(O){return Y(O)==="Float32Array"}B.isFloat32Array=x;function z(O){return Y(O)==="Float64Array"}B.isFloat64Array=z;function a(O){return Y(O)==="BigInt64Array"}B.isBigInt64Array=a;function U0(O){return Y(O)==="BigUint64Array"}B.isBigUint64Array=U0;function b(O){return q(O)==="[object Map]"}b.working=typeof Map<"u"&&b(new Map);function c(O){if(typeof Map>"u")return!1;return b.working?b(O):O instanceof Map}B.isMap=c;function D(O){return q(O)==="[object Set]"}D.working=typeof Set<"u"&&D(new Set);function m(O){if(typeof Set>"u")return!1;return D.working?D(O):O instanceof Set}B.isSet=m;function B0(O){return q(O)==="[object WeakMap]"}B0.working=typeof WeakMap<"u"&&B0(new WeakMap);function i(O){if(typeof WeakMap>"u")return!1;return B0.working?B0(O):O instanceof WeakMap}B.isWeakMap=i;function V0(O){return q(O)==="[object WeakSet]"}V0.working=typeof WeakSet<"u"&&V0(new WeakSet);function s(O){return V0(O)}B.isWeakSet=s;function G0(O){return q(O)==="[object ArrayBuffer]"}G0.working=typeof ArrayBuffer<"u"&&G0(new ArrayBuffer);function r(O){if(typeof ArrayBuffer>"u")return!1;return G0.working?G0(O):O instanceof ArrayBuffer}B.isArrayBuffer=r;function y(O){return q(O)==="[object DataView]"}y.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&y(new DataView(new ArrayBuffer(1),0,1));function n(O){if(typeof DataView>"u")return!1;return y.working?y(O):O instanceof DataView}B.isDataView=n;var o=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Y0(O){return q(O)==="[object SharedArrayBuffer]"}function O0(O){if(typeof o>"u")return!1;if(typeof Y0.working>"u")Y0.working=Y0(new o);return Y0.working?Y0(O):O instanceof o}B.isSharedArrayBuffer=O0;function w(O){return q(O)==="[object AsyncFunction]"}B.isAsyncFunction=w;function L(O){return q(O)==="[object Map Iterator]"}B.isMapIterator=L;function u(O){return q(O)==="[object Set Iterator]"}B.isSetIterator=u;function h(O){return q(O)==="[object Generator]"}B.isGeneratorObject=h;function Z0(O){return q(O)==="[object WebAssembly.Module]"}B.isWebAssemblyCompiledModule=Z0;function g(O){return P(O,W)}B.isNumberObject=g;function f(O){return P(O,I)}B.isStringObject=f;function R(O){return P(O,H)}B.isBooleanObject=R;function p(O){return Z&&P(O,T)}B.isBigIntObject=p;function k(O){return J&&P(O,A)}B.isSymbolObject=k;function V(O){return g(O)||f(O)||R(O)||p(O)||k(O)}B.isBoxedPrimitive=V;function X(O){return typeof Uint8Array<"u"&&(r(O)||O0(O))}B.isAnyArrayBuffer=X,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(O){Object.defineProperty(B,O,{enumerable:!1,value:function(){throw Error(O+" is not supported in userland")}})})}),iU=R0((B,U)=>{U.exports=function(Y){return Y&&typeof Y==="object"&&typeof Y.copy==="function"&&typeof Y.fill==="function"&&typeof Y.readUInt8==="function"}}),jB=R0((B)=>{P2();var U=Object.getOwnPropertyDescriptors||function(n){var o=Object.keys(n),Y0={};for(var O0=0;O0=O0)return u;switch(u){case"%s":return String(Y0[o++]);case"%d":return Number(Y0[o++]);case"%j":try{return JSON.stringify(Y0[o++])}catch(h){return"[Circular]"}default:return u}});for(var L=Y0[o];o"u")return function(){return B.deprecate(y,n).apply(this,arguments)};var o=!1;function Y0(){if(!o){if(P0.throwDeprecation)throw Error(n);else if(P0.traceDeprecation)console.trace(n);else console.error(n);o=!0}return y.apply(this,arguments)}return Y0};var Y={},Q=/^$/;if(P0.env.NODE_DEBUG){var K=P0.env.NODE_DEBUG;K=K.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Q=new RegExp("^"+K+"$","i")}B.debuglog=function(y){if(y=y.toUpperCase(),!Y[y])if(Q.test(y)){var n=P0.pid;Y[y]=function(){var o=B.format.apply(B,arguments);console.error("%s %d: %s",y,n,o)}}else Y[y]=function(){};return Y[y]};function Z(y,n){var o={seen:[],stylize:q};if(arguments.length>=3)o.depth=arguments[2];if(arguments.length>=4)o.colors=arguments[3];if(C(n))o.showHidden=n;else if(n)B._extend(o,n);if($(o.showHidden))o.showHidden=!1;if($(o.depth))o.depth=2;if($(o.colors))o.colors=!1;if($(o.customInspect))o.customInspect=!0;if(o.colors)o.stylize=J;return I(o,y,o.depth)}B.inspect=Z,Z.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Z.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function J(y,n){var o=Z.styles[n];if(o)return"\x1B["+Z.colors[o][0]+"m"+y+"\x1B["+Z.colors[o][1]+"m";else return y}function q(y,n){return y}function W(y){var n={};return y.forEach(function(o,Y0){n[o]=!0}),n}function I(y,n,o){if(y.customInspect&&n&&b(n.inspect)&&n.inspect!==B.inspect&&!(n.constructor&&n.constructor.prototype===n)){var Y0=n.inspect(o,y);if(!F(Y0))Y0=I(y,Y0,o);return Y0}var O0=H(y,n);if(O0)return O0;var w=Object.keys(n),L=W(w);if(y.showHidden)w=Object.getOwnPropertyNames(n);if(U0(n)&&(w.indexOf("message")>=0||w.indexOf("description")>=0))return T(n);if(w.length===0){if(b(n)){var u=n.name?": "+n.name:"";return y.stylize("[Function"+u+"]","special")}if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");if(a(n))return y.stylize(Date.prototype.toString.call(n),"date");if(U0(n))return T(n)}var h="",Z0=!1,g=["{","}"];if(E(n))Z0=!0,g=["[","]"];if(b(n))h=" [Function"+(n.name?": "+n.name:"")+"]";if(x(n))h=" "+RegExp.prototype.toString.call(n);if(a(n))h=" "+Date.prototype.toUTCString.call(n);if(U0(n))h=" "+T(n);if(w.length===0&&(!Z0||n.length==0))return g[0]+h+g[1];if(o<0)if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");else return y.stylize("[Object]","special");y.seen.push(n);var f;if(Z0)f=A(y,n,o,L,w);else f=w.map(function(R){return P(y,n,o,L,R,Z0)});return y.seen.pop(),j(f,h,g)}function H(y,n){if($(n))return y.stylize("undefined","undefined");if(F(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return y.stylize(o,"string")}if(S(n))return y.stylize(""+n,"number");if(C(n))return y.stylize(""+n,"boolean");if(N(n))return y.stylize("null","null")}function T(y){return"["+Error.prototype.toString.call(y)+"]"}function A(y,n,o,Y0,O0){var w=[];for(var L=0,u=n.length;L-1)if(w)u=u.split(` `).map(function(Z0){return" "+Z0}).join(` `).slice(2);else u=` `+u.split(` `).map(function(Z0){return" "+Z0}).join(` -`)}else u=y.stylize("[Circular]","special");if($(L)){if(z&&O0.match(/^\d+$/))return u;if(L=JSON.stringify(""+O0),L.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))L=L.slice(1,-1),L=y.stylize(L,"name");else L=L.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),L=y.stylize(L,"string")}return L+": "+u}function j(y,n,o){var Y0=0;if(y.reduce(function(O0,z){if(Y0++,z.indexOf(` -`)>=0)Y0++;return O0+z.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return o[0]+(n===""?"":n+` +`)}else u=y.stylize("[Circular]","special");if($(L)){if(w&&O0.match(/^\d+$/))return u;if(L=JSON.stringify(""+O0),L.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))L=L.slice(1,-1),L=y.stylize(L,"name");else L=L.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),L=y.stylize(L,"string")}return L+": "+u}function j(y,n,o){var Y0=0;if(y.reduce(function(O0,w){if(Y0++,w.indexOf(` +`)>=0)Y0++;return O0+w.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return o[0]+(n===""?"":n+` `)+" "+y.join(`, - `)+" "+o[1];return o[0]+n+" "+y.join(", ")+" "+o[1]}B.types=rU();function E(y){return Array.isArray(y)}B.isArray=E;function C(y){return typeof y==="boolean"}B.isBoolean=C;function N(y){return y===null}B.isNull=N;function v(y){return y==null}B.isNullOrUndefined=v;function S(y){return typeof y==="number"}B.isNumber=S;function F(y){return typeof y==="string"}B.isString=F;function M(y){return typeof y==="symbol"}B.isSymbol=M;function $(y){return y===void 0}B.isUndefined=$;function x(y){return w(y)&&D(y)==="[object RegExp]"}B.isRegExp=x,B.types.isRegExp=x;function w(y){return typeof y==="object"&&y!==null}B.isObject=w;function a(y){return w(y)&&D(y)==="[object Date]"}B.isDate=a,B.types.isDate=a;function U0(y){return w(y)&&(D(y)==="[object Error]"||y instanceof Error)}B.isError=U0,B.types.isNativeError=U0;function b(y){return typeof y==="function"}B.isFunction=b;function c(y){return y===null||typeof y==="boolean"||typeof y==="number"||typeof y==="string"||typeof y==="symbol"||typeof y>"u"}B.isPrimitive=c,B.isBuffer=iU();function D(y){return Object.prototype.toString.call(y)}function m(y){return y<10?"0"+y.toString(10):y.toString(10)}var B0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function i(){var y=new Date,n=[m(y.getHours()),m(y.getMinutes()),m(y.getSeconds())].join(":");return[y.getDate(),B0[y.getMonth()],n].join(" ")}B.log=function(){console.log("%s - %s",i(),B.format.apply(B,arguments))},B.inherits=W2(),B._extend=function(y,n){if(!n||!w(n))return y;var o=Object.keys(n),Y0=o.length;while(Y0--)y[o[Y0]]=n[o[Y0]];return y};function V0(y,n){return Object.prototype.hasOwnProperty.call(y,n)}var s=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;B.promisify=function(n){if(typeof n!=="function")throw TypeError('The "original" argument must be of type Function');if(s&&n[s]){var o=n[s];if(typeof o!=="function")throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(o,s,{value:o,enumerable:!1,writable:!1,configurable:!0}),o}function o(){var Y0,O0,z=new Promise(function(h,Z0){Y0=h,O0=Z0}),L=[];for(var u=0;u{function G(P,j){var E=Object.keys(P);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(P);j&&(C=C.filter(function(N){return Object.getOwnPropertyDescriptor(P,N).enumerable})),E.push.apply(E,C)}return E}function Y(P){for(var j=1;j0)this.tail.next=C;else this.head=C;this.tail=C,++this.length}},{key:"unshift",value:function(E){var C={data:E,next:this.head};if(this.length===0)this.tail=C;this.head=C,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var E=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,E}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";var C=this.head,N=""+C.data;while(C=C.next)N+=E+C.data;return N}},{key:"concat",value:function(E){if(this.length===0)return I.alloc(0);var C=I.allocUnsafe(E>>>0),N=this.head,v=0;while(N)A(N.data,C,v),v+=N.data.length,N=N.next;return C}},{key:"consume",value:function(E,C){var N;if(ES.length?S.length:E;if(F===S.length)v+=S;else v+=S.slice(0,E);if(E-=F,E===0){if(F===S.length)if(++N,C.next)this.head=C.next;else this.head=this.tail=null;else this.head=C,C.data=S.slice(F);break}++N}return this.length-=N,v}},{key:"_getBuffer",value:function(E){var C=I.allocUnsafe(E),N=this.head,v=1;N.data.copy(C),E-=N.data.length;while(N=N.next){var S=N.data,F=E>S.length?S.length:E;if(S.copy(C,C.length-E,0,F),E-=F,E===0){if(F===S.length)if(++v,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=S.slice(F);break}++v}return this.length-=v,C}},{key:T,value:function(E,C){return H(this,Y(Y({},C),{},{depth:0,customInspect:!1}))}}]),P}()}),NB=R0((B,U)=>{P2();function G(q,W){var I=this,H=this._readableState&&this._readableState.destroyed,T=this._writableState&&this._writableState.destroyed;if(H||T){if(W)W(q);else if(q){if(!this._writableState)P0.nextTick(Z,this,q);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,P0.nextTick(Z,this,q)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(q||null,function(A){if(!W&&A)if(!I._writableState)P0.nextTick(Y,I,A);else if(!I._writableState.errorEmitted)I._writableState.errorEmitted=!0,P0.nextTick(Y,I,A);else P0.nextTick(Q,I);else if(W)P0.nextTick(Q,I),W(A);else P0.nextTick(Q,I)}),this}function Y(q,W){Z(q,W),Q(q)}function Q(q){if(q._writableState&&!q._writableState.emitClose)return;if(q._readableState&&!q._readableState.emitClose)return;q.emit("close")}function K(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function Z(q,W){q.emit("error",W)}function J(q,W){var{_readableState:I,_writableState:H}=q;if(I&&I.autoDestroy||H&&H.autoDestroy)q.destroy(W);else q.emit("error",W)}U.exports={destroy:G,undestroy:K,errorOrDestroy:J}}),c2=R0((B,U)=>{function G(W,I){W.prototype=Object.create(I.prototype),W.prototype.constructor=W,W.__proto__=I}var Y={};function Q(W,I,H){if(!H)H=Error;function T(P,j,E){if(typeof I==="string")return I;else return I(P,j,E)}var A=function(P){G(j,P);function j(E,C,N){return P.call(this,T(E,C,N))||this}return j}(H);A.prototype.name=H.name,A.prototype.code=W,Y[W]=A}function K(W,I){if(Array.isArray(W)){var H=W.length;if(W=W.map(function(T){return String(T)}),H>2)return"one of ".concat(I," ").concat(W.slice(0,H-1).join(", "),", or ")+W[H-1];else if(H===2)return"one of ".concat(I," ").concat(W[0]," or ").concat(W[1]);else return"of ".concat(I," ").concat(W[0])}else return"of ".concat(I," ").concat(String(W))}function Z(W,I,H){return W.substr(!H||H<0?0:+H,I.length)===I}function J(W,I,H){if(H===void 0||H>W.length)H=W.length;return W.substring(H-I.length,H)===I}function q(W,I,H){if(typeof H!=="number")H=0;if(H+I.length>W.length)return!1;else return W.indexOf(I,H)!==-1}Q("ERR_INVALID_OPT_VALUE",function(W,I){return'The value "'+I+'" is invalid for option "'+W+'"'},TypeError),Q("ERR_INVALID_ARG_TYPE",function(W,I,H){var T;if(typeof I==="string"&&Z(I,"not "))T="must not be",I=I.replace(/^not /,"");else T="must be";var A;if(J(W," argument"))A="The ".concat(W," ").concat(T," ").concat(K(I,"type"));else{var P=q(W,".")?"property":"argument";A='The "'.concat(W,'" ').concat(P," ").concat(T," ").concat(K(I,"type"))}return A+=". Received type ".concat(typeof H),A},TypeError),Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Q("ERR_METHOD_NOT_IMPLEMENTED",function(W){return"The "+W+" method is not implemented"}),Q("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Q("ERR_STREAM_DESTROYED",function(W){return"Cannot call "+W+" after a stream was destroyed"}),Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Q("ERR_STREAM_WRITE_AFTER_END","write after end"),Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Q("ERR_UNKNOWN_ENCODING",function(W){return"Unknown encoding: "+W},TypeError),Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),U.exports.codes=Y}),wB=R0((B,U)=>{var G=c2().codes.ERR_INVALID_OPT_VALUE;function Y(K,Z,J){return K.highWaterMark!=null?K.highWaterMark:Z?K[J]:null}function Q(K,Z,J,q){var W=Y(Z,q,J);if(W!=null){if(!(isFinite(W)&&Math.floor(W)===W)||W<0)throw new G(q?J:"highWaterMark",W);return Math.floor(W)}return K.objectMode?16:16384}U.exports={getHighWaterMark:Q}}),sU=R0((B,U)=>{d2(),U.exports=G;function G(Q,K){if(Y("noDeprecation"))return Q;var Z=!1;function J(){if(!Z){if(Y("throwDeprecation"))throw Error(K);else if(Y("traceDeprecation"))console.trace(K);else console.warn(K);Z=!0}return Q.apply(this,arguments)}return J}function Y(Q){try{if(!v0.localStorage)return!1}catch(Z){return!1}var K=v0.localStorage[Q];if(K==null)return!1;return String(K).toLowerCase()==="true"}}),zB=R0((B,U)=>{d2(),P2(),U.exports=w;function G(z){var L=this;this.next=null,this.entry=null,this.finish=function(){O0(L,z)}}var Y;w.WritableState=$;var Q={deprecate:sU()},K=qB(),Z=f1().Buffer,J=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function q(z){return Z.from(z)}function W(z){return Z.isBuffer(z)||z instanceof J}var I=NB(),H=wB().getHighWaterMark,T=c2().codes,A=T.ERR_INVALID_ARG_TYPE,P=T.ERR_METHOD_NOT_IMPLEMENTED,j=T.ERR_MULTIPLE_CALLBACK,E=T.ERR_STREAM_CANNOT_PIPE,C=T.ERR_STREAM_DESTROYED,N=T.ERR_STREAM_NULL_VALUES,v=T.ERR_STREAM_WRITE_AFTER_END,S=T.ERR_UNKNOWN_ENCODING,F=I.errorOrDestroy;W2()(w,K);function M(){}function $(z,L,u){if(Y=Y||u2(),z=z||{},typeof u!=="boolean")u=L instanceof Y;if(this.objectMode=!!z.objectMode,u)this.objectMode=this.objectMode||!!z.writableObjectMode;this.highWaterMark=H(this,z,"writableHighWaterMark",u),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=z.decodeStrings===!1;this.decodeStrings=!h,this.defaultEncoding=z.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z0){i(L,Z0)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=z.emitClose!==!1,this.autoDestroy=!!z.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new G(this)}$.prototype.getBuffer=function(){var L=this.bufferedRequest,u=[];while(L)u.push(L),L=L.next;return u},function(){try{Object.defineProperty($.prototype,"buffer",{get:Q.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(z){}}();var x;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")x=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(L){if(x.call(this,L))return!0;if(this!==w)return!1;return L&&L._writableState instanceof $}});else x=function(L){return L instanceof this};function w(z){Y=Y||u2();var L=this instanceof Y;if(!L&&!x.call(w,this))return new w(z);if(this._writableState=new $(z,this,L),this.writable=!0,z){if(typeof z.write==="function")this._write=z.write;if(typeof z.writev==="function")this._writev=z.writev;if(typeof z.destroy==="function")this._destroy=z.destroy;if(typeof z.final==="function")this._final=z.final}K.call(this)}w.prototype.pipe=function(){F(this,new E)};function a(z,L){var u=new v;F(z,u),P0.nextTick(L,u)}function U0(z,L,u,h){var Z0;if(u===null)Z0=new N;else if(typeof u!=="string"&&!L.objectMode)Z0=new A("chunk",["string","Buffer"],u);if(Z0)return F(z,Z0),P0.nextTick(h,Z0),!1;return!0}w.prototype.write=function(z,L,u){var h=this._writableState,Z0=!1,g=!h.objectMode&&W(z);if(g&&!Z.isBuffer(z))z=q(z);if(typeof L==="function")u=L,L=null;if(g)L="buffer";else if(!L)L=h.defaultEncoding;if(typeof u!=="function")u=M;if(h.ending)a(this,u);else if(g||U0(this,h,z,u))h.pendingcb++,Z0=c(this,h,g,z,L,u);return Z0},w.prototype.cork=function(){this._writableState.corked++},w.prototype.uncork=function(){var z=this._writableState;if(z.corked){if(z.corked--,!z.writing&&!z.corked&&!z.bufferProcessing&&z.bufferedRequest)G0(this,z)}},w.prototype.setDefaultEncoding=function(L){if(typeof L==="string")L=L.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((L+"").toLowerCase())>-1))throw new S(L);return this._writableState.defaultEncoding=L,this},Object.defineProperty(w.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function b(z,L,u){if(!z.objectMode&&z.decodeStrings!==!1&&typeof L==="string")L=Z.from(L,u);return L}Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function c(z,L,u,h,Z0,g){if(!u){var f=b(L,h,Z0);if(h!==f)u=!0,Z0="buffer",h=f}var R=L.objectMode?1:h.length;L.length+=R;var p=L.length{P2();var G=Object.keys||function(H){var T=[];for(var A in H)T.push(A);return T};U.exports=q;var Y=EB(),Q=zB();W2()(q,Y);var K=G(Q.prototype);for(var Z=0;Z{var G=f1(),Y=G.Buffer;function Q(Z,J){for(var q in Z)J[q]=Z[q]}if(Y.from&&Y.alloc&&Y.allocUnsafe&&Y.allocUnsafeSlow)U.exports=G;else Q(G,B),B.Buffer=K;function K(Z,J,q){return Y(Z,J,q)}Q(Y,K),K.from=function(Z,J,q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return Y(Z,J,q)},K.alloc=function(Z,J,q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var W=Y(Z);if(J!==void 0)if(typeof q==="string")W.fill(J,q);else W.fill(J);else W.fill(0);return W},K.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return Y(Z)},K.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),F8=R0((B)=>{var U=oU().Buffer,G=U.isEncoding||function(N){switch(N=""+N,N&&N.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Y(N){if(!N)return"utf8";var v;while(!0)switch(N){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return N;default:if(v)return;N=(""+N).toLowerCase(),v=!0}}function Q(N){var v=Y(N);if(typeof v!=="string"&&(U.isEncoding===G||!G(N)))throw Error("Unknown encoding: "+N);return v||N}B.StringDecoder=K;function K(N){this.encoding=Q(N);var v;switch(this.encoding){case"utf16le":this.text=T,this.end=A,v=4;break;case"utf8":this.fillLast=W,v=4;break;case"base64":this.text=P,this.end=j,v=3;break;default:this.write=E,this.end=C;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=U.allocUnsafe(v)}K.prototype.write=function(N){if(N.length===0)return"";var v,S;if(this.lastNeed){if(v=this.fillLast(N),v===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;if(S>5===6)return 2;else if(N>>4===14)return 3;else if(N>>3===30)return 4;return N>>6===2?-1:-2}function J(N,v,S){var F=v.length-1;if(F=0){if(M>0)N.lastNeed=M-1;return M}if(--F=0){if(M>0)N.lastNeed=M-2;return M}if(--F=0){if(M>0)if(M===2)M=0;else N.lastNeed=M-3;return M}return 0}function q(N,v,S){if((v[0]&192)!==128)return N.lastNeed=0,"�";if(N.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return N.lastNeed=1,"�";if(N.lastNeed>2&&v.length>2){if((v[2]&192)!==128)return N.lastNeed=2,"�"}}}function W(N){var v=this.lastTotal-this.lastNeed,S=q(this,N,v);if(S!==void 0)return S;if(this.lastNeed<=N.length)return N.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);N.copy(this.lastChar,v,0,N.length),this.lastNeed-=N.length}function I(N,v){var S=J(this,N,v);if(!this.lastNeed)return N.toString("utf8",v);this.lastTotal=S;var F=N.length-(S-this.lastNeed);return N.copy(this.lastChar,0,F),N.toString("utf8",v,F)}function H(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+"�";return v}function T(N,v){if((N.length-v)%2===0){var S=N.toString("utf16le",v);if(S){var F=S.charCodeAt(S.length-1);if(F>=55296&&F<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=N[N.length-1],N.toString("utf16le",v,N.length-1)}function A(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,S)}return v}function P(N,v){var S=(N.length-v)%3;if(S===0)return N.toString("base64",v);if(this.lastNeed=3-S,this.lastTotal=3,S===1)this.lastChar[0]=N[N.length-1];else this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1];return N.toString("base64",v,N.length-S)}function j(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+this.lastChar.toString("base64",0,3-this.lastNeed);return v}function E(N){return N.toString(this.encoding)}function C(N){return N&&N.length?this.write(N):""}}),f8=R0((B,U)=>{var G=c2().codes.ERR_STREAM_PREMATURE_CLOSE;function Y(J){var q=!1;return function(){if(q)return;q=!0;for(var W=arguments.length,I=Array(W),H=0;H{P2();var G;function Y(S,F,M){if(F=Q(F),F in S)Object.defineProperty(S,F,{value:M,enumerable:!0,configurable:!0,writable:!0});else S[F]=M;return S}function Q(S){var F=K(S,"string");return typeof F==="symbol"?F:String(F)}function K(S,F){if(typeof S!=="object"||S===null)return S;var M=S[Symbol.toPrimitive];if(M!==void 0){var $=M.call(S,F||"default");if(typeof $!=="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(F==="string"?String:Number)(S)}var Z=f8(),J=Symbol("lastResolve"),q=Symbol("lastReject"),W=Symbol("error"),I=Symbol("ended"),H=Symbol("lastPromise"),T=Symbol("handlePromise"),A=Symbol("stream");function P(S,F){return{value:S,done:F}}function j(S){var F=S[J];if(F!==null){var M=S[A].read();if(M!==null)S[H]=null,S[J]=null,S[q]=null,F(P(M,!1))}}function E(S){P0.nextTick(j,S)}function C(S,F){return function(M,$){S.then(function(){if(F[I]){M(P(void 0,!0));return}F[T](M,$)},$)}}var N=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((G={get stream(){return this[A]},next:function(){var F=this,M=this[W];if(M!==null)return Promise.reject(M);if(this[I])return Promise.resolve(P(void 0,!0));if(this[A].destroyed)return new Promise(function(a,U0){P0.nextTick(function(){if(F[W])U0(F[W]);else a(P(void 0,!0))})});var $=this[H],x;if($)x=new Promise(C($,this));else{var w=this[A].read();if(w!==null)return Promise.resolve(P(w,!1));x=new Promise(this[T])}return this[H]=x,x}},Y(G,Symbol.asyncIterator,function(){return this}),Y(G,"return",function(){var F=this;return new Promise(function(M,$){F[A].destroy(null,function(x){if(x){$(x);return}M(P(void 0,!0))})})}),G),N);U.exports=function(F){var M,$=Object.create(v,(M={},Y(M,A,{value:F,writable:!0}),Y(M,J,{value:null,writable:!0}),Y(M,q,{value:null,writable:!0}),Y(M,W,{value:null,writable:!0}),Y(M,I,{value:F._readableState.endEmitted,writable:!0}),Y(M,T,{value:function(w,a){var U0=$[A].read();if(U0)$[H]=null,$[J]=null,$[q]=null,w(P(U0,!1));else $[J]=w,$[q]=a},writable:!0}),M));return $[H]=null,Z(F,function(x){if(x&&x.code!=="ERR_STREAM_PREMATURE_CLOSE"){var w=$[q];if(w!==null)$[H]=null,$[J]=null,$[q]=null,w(x);$[W]=x;return}var a=$[J];if(a!==null)$[H]=null,$[J]=null,$[q]=null,a(P(void 0,!0));$[I]=!0}),F.on("readable",E.bind(null,$)),$}}),eU=R0((B,U)=>{U.exports=function(){throw Error("Readable.from is not available in the browser")}}),EB=R0((B,U)=>{d2(),P2(),U.exports=a;var G;a.ReadableState=w,S8().EventEmitter;var Y=function(f,R){return f.listeners(R).length},Q=qB(),K=f1().Buffer,Z=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function J(g){return K.from(g)}function q(g){return K.isBuffer(g)||g instanceof Z}var W=jB(),I;if(W&&W.debuglog)I=W.debuglog("stream");else I=function(){};var H=nU(),T=NB(),A=wB().getHighWaterMark,P=c2().codes,j=P.ERR_INVALID_ARG_TYPE,E=P.ERR_STREAM_PUSH_AFTER_EOF,C=P.ERR_METHOD_NOT_IMPLEMENTED,N=P.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,S,F;W2()(a,Q);var M=T.errorOrDestroy,$=["error","close","destroy","pause","resume"];function x(g,f,R){if(typeof g.prependListener==="function")return g.prependListener(f,R);if(!g._events||!g._events[f])g.on(f,R);else if(Array.isArray(g._events[f]))g._events[f].unshift(R);else g._events[f]=[R,g._events[f]]}function w(g,f,R){if(G=G||u2(),g=g||{},typeof R!=="boolean")R=f instanceof G;if(this.objectMode=!!g.objectMode,R)this.objectMode=this.objectMode||!!g.readableObjectMode;if(this.highWaterMark=A(this,g,"readableHighWaterMark",R),this.buffer=new H,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=g.emitClose!==!1,this.autoDestroy=!!g.autoDestroy,this.destroyed=!1,this.defaultEncoding=g.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,g.encoding){if(!v)v=F8().StringDecoder;this.decoder=new v(g.encoding),this.encoding=g.encoding}}function a(g){if(G=G||u2(),!(this instanceof a))return new a(g);var f=this instanceof G;if(this._readableState=new w(g,this,f),this.readable=!0,g){if(typeof g.read==="function")this._read=g.read;if(typeof g.destroy==="function")this._destroy=g.destroy}Q.call(this)}Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(f){if(!this._readableState)return;this._readableState.destroyed=f}}),a.prototype.destroy=T.destroy,a.prototype._undestroy=T.undestroy,a.prototype._destroy=function(g,f){f(g)},a.prototype.push=function(g,f){var R=this._readableState,p;if(!R.objectMode){if(typeof g==="string"){if(f=f||R.defaultEncoding,f!==R.encoding)g=K.from(g,f),f="";p=!0}}else p=!0;return U0(this,g,f,!1,p)},a.prototype.unshift=function(g){return U0(this,g,null,!0,!1)};function U0(g,f,R,p,k){I("readableAddChunk",f);var V=g._readableState;if(f===null)V.reading=!1,i(g,V);else{var X;if(!k)X=c(V,f);if(X)M(g,X);else if(V.objectMode||f&&f.length>0){if(typeof f!=="string"&&!V.objectMode&&Object.getPrototypeOf(f)!==K.prototype)f=J(f);if(p)if(V.endEmitted)M(g,new N);else b(g,V,f,!0);else if(V.ended)M(g,new E);else if(V.destroyed)return!1;else if(V.reading=!1,V.decoder&&!R)if(f=V.decoder.write(f),V.objectMode||f.length!==0)b(g,V,f,!1);else G0(g,V);else b(g,V,f,!1)}else if(!p)V.reading=!1,G0(g,V)}return!V.ended&&(V.length=D)g=D;else g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++;return g}function B0(g,f){if(g<=0||f.length===0&&f.ended)return 0;if(f.objectMode)return 1;if(g!==g)if(f.flowing&&f.length)return f.buffer.head.data.length;else return f.length;if(g>f.highWaterMark)f.highWaterMark=m(g);if(g<=f.length)return g;if(!f.ended)return f.needReadable=!0,0;return f.length}a.prototype.read=function(g){I("read",g),g=parseInt(g,10);var f=this._readableState,R=g;if(g!==0)f.emittedReadable=!1;if(g===0&&f.needReadable&&((f.highWaterMark!==0?f.length>=f.highWaterMark:f.length>0)||f.ended)){if(I("read: emitReadable",f.length,f.ended),f.length===0&&f.ended)u(this);else V0(this);return null}if(g=B0(g,f),g===0&&f.ended){if(f.length===0)u(this);return null}var p=f.needReadable;if(I("need readable",p),f.length===0||f.length-g0)k=L(g,f);else k=null;if(k===null)f.needReadable=f.length<=f.highWaterMark,g=0;else f.length-=g,f.awaitDrain=0;if(f.length===0){if(!f.ended)f.needReadable=!0;if(R!==g&&f.ended)u(this)}if(k!==null)this.emit("data",k);return k};function i(g,f){if(I("onEofChunk"),f.ended)return;if(f.decoder){var R=f.decoder.end();if(R&&R.length)f.buffer.push(R),f.length+=f.objectMode?1:R.length}if(f.ended=!0,f.sync)V0(g);else if(f.needReadable=!1,!f.emittedReadable)f.emittedReadable=!0,s(g)}function V0(g){var f=g._readableState;if(I("emitReadable",f.needReadable,f.emittedReadable),f.needReadable=!1,!f.emittedReadable)I("emitReadable",f.flowing),f.emittedReadable=!0,P0.nextTick(s,g)}function s(g){var f=g._readableState;if(I("emitReadable_",f.destroyed,f.length,f.ended),!f.destroyed&&(f.length||f.ended))g.emit("readable"),f.emittedReadable=!1;f.needReadable=!f.flowing&&!f.ended&&f.length<=f.highWaterMark,z(g)}function G0(g,f){if(!f.readingMore)f.readingMore=!0,P0.nextTick(r,g,f)}function r(g,f){while(!f.reading&&!f.ended&&(f.length1&&Z0(p.pipes,g)!==-1)&&!_)I("false write response, pause",p.awaitDrain),p.awaitDrain++;R.pause()}}function Q0(F0){if(I("onerror",F0),I0(),g.removeListener("error",Q0),Y(g,"error")===0)M(g,F0)}x(g,"error",Q0);function X0(){g.removeListener("finish",K0),I0()}g.once("close",X0);function K0(){I("onfinish"),g.removeListener("close",X0),I0()}g.once("finish",K0);function I0(){I("unpipe"),R.unpipe(g)}if(g.emit("pipe",R),!p.flowing)I("pipe resume"),R.resume();return g};function y(g){return function(){var R=g._readableState;if(I("pipeOnDrain",R.awaitDrain),R.awaitDrain)R.awaitDrain--;if(R.awaitDrain===0&&Y(g,"data"))R.flowing=!0,z(g)}}a.prototype.unpipe=function(g){var f=this._readableState,R={hasUnpiped:!1};if(f.pipesCount===0)return this;if(f.pipesCount===1){if(g&&g!==f.pipes)return this;if(!g)g=f.pipes;if(f.pipes=null,f.pipesCount=0,f.flowing=!1,g)g.emit("unpipe",this,R);return this}if(!g){var{pipes:p,pipesCount:k}=f;f.pipes=null,f.pipesCount=0,f.flowing=!1;for(var V=0;V0,p.flowing!==!1)this.resume()}else if(g==="readable"){if(!p.endEmitted&&!p.readableListening){if(p.readableListening=p.needReadable=!0,p.flowing=!1,p.emittedReadable=!1,I("on readable",p.length,p.reading),p.length)V0(this);else if(!p.reading)P0.nextTick(o,this)}}return R},a.prototype.addListener=a.prototype.on,a.prototype.removeListener=function(g,f){var R=Q.prototype.removeListener.call(this,g,f);if(g==="readable")P0.nextTick(n,this);return R},a.prototype.removeAllListeners=function(g){var f=Q.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)P0.nextTick(n,this);return f};function n(g){var f=g._readableState;if(f.readableListening=g.listenerCount("readable")>0,f.resumeScheduled&&!f.paused)f.flowing=!0;else if(g.listenerCount("data")>0)g.resume()}function o(g){I("readable nexttick read 0"),g.read(0)}a.prototype.resume=function(){var g=this._readableState;if(!g.flowing)I("resume"),g.flowing=!g.readableListening,Y0(this,g);return g.paused=!1,this};function Y0(g,f){if(!f.resumeScheduled)f.resumeScheduled=!0,P0.nextTick(O0,g,f)}function O0(g,f){if(I("resume",f.reading),!f.reading)g.read(0);if(f.resumeScheduled=!1,g.emit("resume"),z(g),f.flowing&&!f.reading)g.read(0)}a.prototype.pause=function(){if(I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)I("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function z(g){var f=g._readableState;I("flow",f.flowing);while(f.flowing&&g.read()!==null);}if(a.prototype.wrap=function(g){var f=this,R=this._readableState,p=!1;g.on("end",function(){if(I("wrapped end"),R.decoder&&!R.ended){var X=R.decoder.end();if(X&&X.length)f.push(X)}f.push(null)}),g.on("data",function(X){if(I("wrapped data"),R.decoder)X=R.decoder.write(X);if(R.objectMode&&(X===null||X===void 0))return;else if(!R.objectMode&&(!X||!X.length))return;if(!f.push(X))p=!0,g.pause()});for(var k in g)if(this[k]===void 0&&typeof g[k]==="function")this[k]=function(O){return function(){return g[O].apply(g,arguments)}}(k);for(var V=0;V<$.length;V++)g.on($[V],this.emit.bind(this,$[V]));return this._read=function(X){if(I("wrapped _read",X),p)p=!1,g.resume()},this},typeof Symbol==="function")a.prototype[Symbol.asyncIterator]=function(){if(S===void 0)S=tU();return S(this)};Object.defineProperty(a.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(a.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(a.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(f){if(this._readableState)this._readableState.flowing=f}}),a._fromList=L,Object.defineProperty(a.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function L(g,f){if(f.length===0)return null;var R;if(f.objectMode)R=f.buffer.shift();else if(!g||g>=f.length){if(f.decoder)R=f.buffer.join("");else if(f.buffer.length===1)R=f.buffer.first();else R=f.buffer.concat(f.length);f.buffer.clear()}else R=f.buffer.consume(g,f.decoder);return R}function u(g){var f=g._readableState;if(I("endReadable",f.endEmitted),!f.endEmitted)f.ended=!0,P0.nextTick(h,f,g)}function h(g,f){if(I("endReadableNT",g.endEmitted,g.length),!g.endEmitted&&g.length===0){if(g.endEmitted=!0,f.readable=!1,f.emit("end"),g.autoDestroy){var R=f._writableState;if(!R||R.autoDestroy&&R.finished)f.destroy()}}}if(typeof Symbol==="function")a.from=function(g,f){if(F===void 0)F=eU();return F(a,g,f)};function Z0(g,f){for(var R=0,p=g.length;R{U.exports=W;var G=c2().codes,Y=G.ERR_METHOD_NOT_IMPLEMENTED,Q=G.ERR_MULTIPLE_CALLBACK,K=G.ERR_TRANSFORM_ALREADY_TRANSFORMING,Z=G.ERR_TRANSFORM_WITH_LENGTH_0,J=u2();W2()(W,J);function q(T,A){var P=this._transformState;P.transforming=!1;var j=P.writecb;if(j===null)return this.emit("error",new Q);if(P.writechunk=null,P.writecb=null,A!=null)this.push(A);j(T);var E=this._readableState;if(E.reading=!1,E.needReadable||E.length{U.exports=Y;var G=DB();W2()(Y,G);function Y(Q){if(!(this instanceof Y))return new Y(Q);G.call(this,Q)}Y.prototype._transform=function(Q,K,Z){Z(null,Q)}}),UG=R0((B,U)=>{var G;function Y(P){var j=!1;return function(){if(j)return;j=!0,P.apply(void 0,arguments)}}var Q=c2().codes,K=Q.ERR_MISSING_ARGS,Z=Q.ERR_STREAM_DESTROYED;function J(P){if(P)throw P}function q(P){return P.setHeader&&typeof P.abort==="function"}function W(P,j,E,C){C=Y(C);var N=!1;if(P.on("close",function(){N=!0}),G===void 0)G=f8();G(P,{readable:j,writable:E},function(S){if(S)return C(S);N=!0,C()});var v=!1;return function(S){if(N)return;if(v)return;if(v=!0,q(P))return P.abort();if(typeof P.destroy==="function")return P.destroy();C(S||new Z("pipe"))}}function I(P){P()}function H(P,j){return P.pipe(j)}function T(P){if(!P.length)return J;if(typeof P[P.length-1]!=="function")return J;return P.pop()}function A(){for(var P=arguments.length,j=Array(P),E=0;E0,function($){if(!N)N=$;if($)v.forEach(I);if(M)return;v.forEach(I),C(N)})});return j.reduce(H)}U.exports=A}),x8=R0((B,U)=>{U.exports=Y;var G=S8().EventEmitter;W2()(Y,G),Y.Readable=EB(),Y.Writable=zB(),Y.Duplex=u2(),Y.Transform=DB(),Y.PassThrough=BG(),Y.finished=f8(),Y.pipeline=UG(),Y.Stream=Y;function Y(){G.call(this)}Y.prototype.pipe=function(Q,K){var Z=this;function J(P){if(Q.writable){if(Q.write(P)===!1&&Z.pause)Z.pause()}}Z.on("data",J);function q(){if(Z.readable&&Z.resume)Z.resume()}if(Q.on("drain",q),!Q._isStdio&&(!K||K.end!==!1))Z.on("end",I),Z.on("close",H);var W=!1;function I(){if(W)return;W=!0,Q.end()}function H(){if(W)return;if(W=!0,typeof Q.destroy==="function")Q.destroy()}function T(P){if(A(),G.listenerCount(this,"error")===0)throw P}Z.on("error",T),Q.on("error",T);function A(){Z.removeListener("data",J),Q.removeListener("drain",q),Z.removeListener("end",I),Z.removeListener("close",H),Z.removeListener("error",T),Q.removeListener("error",T),Z.removeListener("end",A),Z.removeListener("close",A),Q.removeListener("close",A)}return Z.on("end",A),Z.on("close",A),Q.on("close",A),Q.emit("pipe",Z),Q}}),GG=R0((B)=>{(function(U){U.parser=function(z,L){return new Y(z,L)},U.SAXParser=Y,U.SAXStream=I,U.createStream=W,U.MAX_BUFFER_LENGTH=65536;var G=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];U.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Y(z,L){if(!(this instanceof Y))return new Y(z,L);var u=this;if(K(u),u.q=u.c="",u.bufferCheckPosition=U.MAX_BUFFER_LENGTH,u.opt=L||{},u.opt.lowercase=u.opt.lowercase||u.opt.lowercasetags,u.looseCase=u.opt.lowercase?"toLowerCase":"toUpperCase",u.tags=[],u.closed=u.closedRoot=u.sawRoot=!1,u.tag=u.error=null,u.strict=!!z,u.noscript=!!(z||u.opt.noscript),u.state=w.BEGIN,u.strictEntities=u.opt.strictEntities,u.ENTITIES=u.strictEntities?Object.create(U.XML_ENTITIES):Object.create(U.ENTITIES),u.attribList=[],u.opt.xmlns)u.ns=Object.create(j);if(u.trackPosition=u.opt.position!==!1,u.trackPosition)u.position=u.line=u.column=0;U0(u,"onready")}if(!Object.create)Object.create=function(z){function L(){}return L.prototype=z,new L};if(!Object.keys)Object.keys=function(z){var L=[];for(var u in z)if(z.hasOwnProperty(u))L.push(u);return L};function Q(z){var L=Math.max(U.MAX_BUFFER_LENGTH,10),u=0;for(var h=0,Z0=G.length;hL)switch(G[h]){case"textNode":c(z);break;case"cdata":b(z,"oncdata",z.cdata),z.cdata="";break;case"script":b(z,"onscript",z.script),z.script="";break;default:m(z,"Max buffer length exceeded: "+G[h])}u=Math.max(u,g)}z.bufferCheckPosition=U.MAX_BUFFER_LENGTH-u+z.position}function K(z){for(var L=0,u=G.length;L"||S(z)}function $(z,L){return z.test(L)}function x(z,L){return!$(z,L)}var w=0;U.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},U.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},U.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(U.ENTITIES).forEach(function(z){var L=U.ENTITIES[z],u=typeof L==="number"?String.fromCharCode(L):L;U.ENTITIES[z]=u});for(var a in U.STATE)U.STATE[U.STATE[a]]=a;w=U.STATE;function U0(z,L,u){z[L]&&z[L](u)}function b(z,L,u){if(z.textNode)c(z);U0(z,L,u)}function c(z){if(z.textNode=D(z.opt,z.textNode),z.textNode)U0(z,"ontext",z.textNode);z.textNode=""}function D(z,L){if(z.trim)L=L.trim();if(z.normalize)L=L.replace(/\s+/g," ");return L}function m(z,L){if(c(z),z.trackPosition)L+=` -Line: `+z.line+` -Column: `+z.column+` -Char: `+z.c;return L=Error(L),z.error=L,U0(z,"onerror",L),z}function B0(z){if(z.sawRoot&&!z.closedRoot)i(z,"Unclosed root tag");if(z.state!==w.BEGIN&&z.state!==w.BEGIN_WHITESPACE&&z.state!==w.TEXT)m(z,"Unexpected end");return c(z),z.c="",z.closed=!0,U0(z,"onend"),Y.call(z,z.strict,z.opt),z}function i(z,L){if(typeof z!=="object"||!(z instanceof Y))throw Error("bad call to strictFail");if(z.strict)m(z,L)}function V0(z){if(!z.strict)z.tagName=z.tagName[z.looseCase]();var L=z.tags[z.tags.length-1]||z,u=z.tag={name:z.tagName,attributes:{}};if(z.opt.xmlns)u.ns=L.ns;z.attribList.length=0,b(z,"onopentagstart",u)}function s(z,L){var u=z.indexOf(":")<0?["",z]:z.split(":"),h=u[0],Z0=u[1];if(L&&z==="xmlns")h="xmlns",Z0="";return{prefix:h,local:Z0}}function G0(z){if(!z.strict)z.attribName=z.attribName[z.looseCase]();if(z.attribList.indexOf(z.attribName)!==-1||z.tag.attributes.hasOwnProperty(z.attribName)){z.attribName=z.attribValue="";return}if(z.opt.xmlns){var L=s(z.attribName,!0),u=L.prefix,h=L.local;if(u==="xmlns")if(h==="xml"&&z.attribValue!==A)i(z,"xml: prefix must be bound to "+A+` -Actual: `+z.attribValue);else if(h==="xmlns"&&z.attribValue!==P)i(z,"xmlns: prefix must be bound to "+P+` -Actual: `+z.attribValue);else{var Z0=z.tag,g=z.tags[z.tags.length-1]||z;if(Z0.ns===g.ns)Z0.ns=Object.create(g.ns);Z0.ns[h]=z.attribValue}z.attribList.push([z.attribName,z.attribValue])}else z.tag.attributes[z.attribName]=z.attribValue,b(z,"onattribute",{name:z.attribName,value:z.attribValue});z.attribName=z.attribValue=""}function r(z,L){if(z.opt.xmlns){var u=z.tag,h=s(z.tagName);if(u.prefix=h.prefix,u.local=h.local,u.uri=u.ns[h.prefix]||"",u.prefix&&!u.uri)i(z,"Unbound namespace prefix: "+JSON.stringify(z.tagName)),u.uri=h.prefix;var Z0=z.tags[z.tags.length-1]||z;if(u.ns&&Z0.ns!==u.ns)Object.keys(u.ns).forEach(function(d){b(z,"onopennamespace",{prefix:d,uri:u.ns[d]})});for(var g=0,f=z.attribList.length;g",z.tagName="",z.state=w.SCRIPT;return}b(z,"onscript",z.script),z.script=""}var L=z.tags.length,u=z.tagName;if(!z.strict)u=u[z.looseCase]();var h=u;while(L--)if(z.tags[L].name!==h)i(z,"Unexpected close tag");else break;if(L<0){i(z,"Unmatched closing tag: "+z.tagName),z.textNode+="",z.state=w.TEXT;return}z.tagName=u;var Z0=z.tags.length;while(Z0-- >L){var g=z.tag=z.tags.pop();z.tagName=z.tag.name,b(z,"onclosetag",z.tagName);var f={};for(var R in g.ns)f[R]=g.ns[R];var p=z.tags[z.tags.length-1]||z;if(z.opt.xmlns&&g.ns!==p.ns)Object.keys(g.ns).forEach(function(k){var V=g.ns[k];b(z,"onclosenamespace",{prefix:k,uri:V})})}if(L===0)z.closedRoot=!0;z.tagName=z.attribValue=z.attribName="",z.attribList.length=0,z.state=w.TEXT}function n(z){var L=z.entity,u=L.toLowerCase(),h,Z0="";if(z.ENTITIES[L])return z.ENTITIES[L];if(z.ENTITIES[u])return z.ENTITIES[u];if(L=u,L.charAt(0)==="#")if(L.charAt(1)==="x")L=L.slice(2),h=parseInt(L,16),Z0=h.toString(16);else L=L.slice(1),h=parseInt(L,10),Z0=h.toString(10);if(L=L.replace(/^0+/,""),isNaN(h)||Z0.toLowerCase()!==L)return i(z,"Invalid character entity"),"&"+z.entity+";";return String.fromCodePoint(h)}function o(z,L){if(L==="<")z.state=w.OPEN_WAKA,z.startTagPosition=z.position;else if(!S(L))i(z,"Non-whitespace before first tag."),z.textNode=L,z.state=w.TEXT}function Y0(z,L){var u="";if(L")b(L,"onsgmldeclaration",L.sgmlDecl),L.sgmlDecl="",L.state=w.TEXT;else if(F(h))L.state=w.SGML_DECL_QUOTED,L.sgmlDecl+=h;else L.sgmlDecl+=h;continue;case w.SGML_DECL_QUOTED:if(h===L.q)L.state=w.SGML_DECL,L.q="";L.sgmlDecl+=h;continue;case w.DOCTYPE:if(h===">")L.state=w.TEXT,b(L,"ondoctype",L.doctype),L.doctype=!0;else if(L.doctype+=h,h==="[")L.state=w.DOCTYPE_DTD;else if(F(h))L.state=w.DOCTYPE_QUOTED,L.q=h;continue;case w.DOCTYPE_QUOTED:if(L.doctype+=h,h===L.q)L.q="",L.state=w.DOCTYPE;continue;case w.DOCTYPE_DTD:if(L.doctype+=h,h==="]")L.state=w.DOCTYPE;else if(F(h))L.state=w.DOCTYPE_DTD_QUOTED,L.q=h;continue;case w.DOCTYPE_DTD_QUOTED:if(L.doctype+=h,h===L.q)L.state=w.DOCTYPE_DTD,L.q="";continue;case w.COMMENT:if(h==="-")L.state=w.COMMENT_ENDING;else L.comment+=h;continue;case w.COMMENT_ENDING:if(h==="-"){if(L.state=w.COMMENT_ENDED,L.comment=D(L.opt,L.comment),L.comment)b(L,"oncomment",L.comment);L.comment=""}else L.comment+="-"+h,L.state=w.COMMENT;continue;case w.COMMENT_ENDED:if(h!==">")i(L,"Malformed comment"),L.comment+="--"+h,L.state=w.COMMENT;else L.state=w.TEXT;continue;case w.CDATA:if(h==="]")L.state=w.CDATA_ENDING;else L.cdata+=h;continue;case w.CDATA_ENDING:if(h==="]")L.state=w.CDATA_ENDING_2;else L.cdata+="]"+h,L.state=w.CDATA;continue;case w.CDATA_ENDING_2:if(h===">"){if(L.cdata)b(L,"oncdata",L.cdata);b(L,"onclosecdata"),L.cdata="",L.state=w.TEXT}else if(h==="]")L.cdata+="]";else L.cdata+="]]"+h,L.state=w.CDATA;continue;case w.PROC_INST:if(h==="?")L.state=w.PROC_INST_ENDING;else if(S(h))L.state=w.PROC_INST_BODY;else L.procInstName+=h;continue;case w.PROC_INST_BODY:if(!L.procInstBody&&S(h))continue;else if(h==="?")L.state=w.PROC_INST_ENDING;else L.procInstBody+=h;continue;case w.PROC_INST_ENDING:if(h===">")b(L,"onprocessinginstruction",{name:L.procInstName,body:L.procInstBody}),L.procInstName=L.procInstBody="",L.state=w.TEXT;else L.procInstBody+="?"+h,L.state=w.PROC_INST_BODY;continue;case w.OPEN_TAG:if($(C,h))L.tagName+=h;else if(V0(L),h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else{if(!S(h))i(L,"Invalid character in tag name");L.state=w.ATTRIB}continue;case w.OPEN_TAG_SLASH:if(h===">")r(L,!0),y(L);else i(L,"Forward-slash in opening tag not followed by >"),L.state=w.ATTRIB;continue;case w.ATTRIB:if(S(h))continue;else if(h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else if($(E,h))L.attribName=h,L.attribValue="",L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case w.ATTRIB_NAME:if(h==="=")L.state=w.ATTRIB_VALUE;else if(h===">")i(L,"Attribute without value"),L.attribValue=L.attribName,G0(L),r(L);else if(S(h))L.state=w.ATTRIB_NAME_SAW_WHITE;else if($(C,h))L.attribName+=h;else i(L,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if(h==="=")L.state=w.ATTRIB_VALUE;else if(S(h))continue;else if(i(L,"Attribute without value"),L.tag.attributes[L.attribName]="",L.attribValue="",b(L,"onattribute",{name:L.attribName,value:""}),L.attribName="",h===">")r(L);else if($(E,h))L.attribName=h,L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name"),L.state=w.ATTRIB;continue;case w.ATTRIB_VALUE:if(S(h))continue;else if(F(h))L.q=h,L.state=w.ATTRIB_VALUE_QUOTED;else i(L,"Unquoted attribute value"),L.state=w.ATTRIB_VALUE_UNQUOTED,L.attribValue=h;continue;case w.ATTRIB_VALUE_QUOTED:if(h!==L.q){if(h==="&")L.state=w.ATTRIB_VALUE_ENTITY_Q;else L.attribValue+=h;continue}G0(L),L.q="",L.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:if(S(h))L.state=w.ATTRIB;else if(h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else if($(E,h))i(L,"No whitespace between attributes"),L.attribName=h,L.attribValue="",L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!M(h)){if(h==="&")L.state=w.ATTRIB_VALUE_ENTITY_U;else L.attribValue+=h;continue}if(G0(L),h===">")r(L);else L.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(!L.tagName)if(S(h))continue;else if(x(E,h))if(L.script)L.script+="")y(L);else if($(C,h))L.tagName+=h;else if(L.script)L.script+="")y(L);else i(L,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var f,R;switch(L.state){case w.TEXT_ENTITY:f=w.TEXT,R="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:f=w.ATTRIB_VALUE_QUOTED,R="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:f=w.ATTRIB_VALUE_UNQUOTED,R="attribValue";break}if(h===";")L[R]+=n(L),L.entity="",L.state=f;else if($(L.entity.length?v:N,h))L.entity+=h;else i(L,"Invalid character in entity name"),L[R]+="&"+L.entity+h,L.entity="",L.state=f;continue;default:throw Error(L,"Unknown state: "+L.state)}}if(L.position>=L.bufferCheckPosition)Q(L);return L}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint)(function(){var z=String.fromCharCode,L=Math.floor,u=function(){var h=16384,Z0=[],g,f,R=-1,p=arguments.length;if(!p)return"";var k="";while(++R1114111||L(V)!==V)throw RangeError("Invalid code point: "+V);if(V<=65535)Z0.push(V);else V-=65536,g=(V>>10)+55296,f=V%1024+56320,Z0.push(g,f);if(R+1===p||Z0.length>h)k+=z.apply(null,Z0),Z0.length=0}return k};if(Object.defineProperty)Object.defineProperty(String,"fromCodePoint",{value:u,configurable:!0,writable:!0});else String.fromCodePoint=u})()})(typeof B>"u"?B.sax={}:B)}),_8=R0((B,U)=>{U.exports={isArray:function(G){if(Array.isArray)return Array.isArray(G);return Object.prototype.toString.call(G)==="[object Array]"}}}),h8=R0((B,U)=>{var G=_8().isArray;U.exports={copyOptions:function(Y){var Q,K={};for(Q in Y)if(Y.hasOwnProperty(Q))K[Q]=Y[Q];return K},ensureFlagExists:function(Y,Q){if(!(Y in Q)||typeof Q[Y]!=="boolean")Q[Y]=!1},ensureSpacesExists:function(Y){if(!("spaces"in Y)||typeof Y.spaces!=="number"&&typeof Y.spaces!=="string")Y.spaces=0},ensureAlwaysArrayExists:function(Y){if(!("alwaysArray"in Y)||typeof Y.alwaysArray!=="boolean"&&!G(Y.alwaysArray))Y.alwaysArray=!1},ensureKeyExists:function(Y,Q){if(!(Y+"Key"in Q)||typeof Q[Y+"Key"]!=="string")Q[Y+"Key"]=Q.compact?"_"+Y:Y},checkFnExists:function(Y,Q){return Y+"Fn"in Q}}}),TB=R0((B,U)=>{var G=GG(),Y={on:function(){},parse:function(){}},Q=h8(),K=_8().isArray,Z,J=!0,q;function W(F){return Z=Q.copyOptions(F),Q.ensureFlagExists("ignoreDeclaration",Z),Q.ensureFlagExists("ignoreInstruction",Z),Q.ensureFlagExists("ignoreAttributes",Z),Q.ensureFlagExists("ignoreText",Z),Q.ensureFlagExists("ignoreComment",Z),Q.ensureFlagExists("ignoreCdata",Z),Q.ensureFlagExists("ignoreDoctype",Z),Q.ensureFlagExists("compact",Z),Q.ensureFlagExists("alwaysChildren",Z),Q.ensureFlagExists("addParent",Z),Q.ensureFlagExists("trim",Z),Q.ensureFlagExists("nativeType",Z),Q.ensureFlagExists("nativeTypeAttributes",Z),Q.ensureFlagExists("sanitize",Z),Q.ensureFlagExists("instructionHasAttributes",Z),Q.ensureFlagExists("captureSpacesBetweenElements",Z),Q.ensureAlwaysArrayExists(Z),Q.ensureKeyExists("declaration",Z),Q.ensureKeyExists("instruction",Z),Q.ensureKeyExists("attributes",Z),Q.ensureKeyExists("text",Z),Q.ensureKeyExists("comment",Z),Q.ensureKeyExists("cdata",Z),Q.ensureKeyExists("doctype",Z),Q.ensureKeyExists("type",Z),Q.ensureKeyExists("name",Z),Q.ensureKeyExists("elements",Z),Q.ensureKeyExists("parent",Z),Q.checkFnExists("doctype",Z),Q.checkFnExists("instruction",Z),Q.checkFnExists("cdata",Z),Q.checkFnExists("comment",Z),Q.checkFnExists("text",Z),Q.checkFnExists("instructionName",Z),Q.checkFnExists("elementName",Z),Q.checkFnExists("attributeName",Z),Q.checkFnExists("attributeValue",Z),Q.checkFnExists("attributes",Z),Z}function I(F){var M=Number(F);if(!isNaN(M))return M;var $=F.toLowerCase();if($==="true")return!0;else if($==="false")return!1;return F}function H(F,M){var $;if(Z.compact){if(!q[Z[F+"Key"]]&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(Z[F+"Key"])!==-1:Z.alwaysArray))q[Z[F+"Key"]]=[];if(q[Z[F+"Key"]]&&!K(q[Z[F+"Key"]]))q[Z[F+"Key"]]=[q[Z[F+"Key"]]];if(F+"Fn"in Z&&typeof M==="string")M=Z[F+"Fn"](M,q);if(F==="instruction"&&(("instructionFn"in Z)||("instructionNameFn"in Z))){for($ in M)if(M.hasOwnProperty($))if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);else{var x=M[$];delete M[$],M[Z.instructionNameFn($,x,q)]=x}}if(K(q[Z[F+"Key"]]))q[Z[F+"Key"]].push(M);else q[Z[F+"Key"]]=M}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];var w={};if(w[Z.typeKey]=F,F==="instruction"){for($ in M)if(M.hasOwnProperty($))break;if(w[Z.nameKey]="instructionNameFn"in Z?Z.instructionNameFn($,M,q):$,Z.instructionHasAttributes){if(w[Z.attributesKey]=M[$][Z.attributesKey],"instructionFn"in Z)w[Z.attributesKey]=Z.instructionFn(w[Z.attributesKey],$,q)}else{if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);w[Z.instructionKey]=M[$]}}else{if(F+"Fn"in Z)M=Z[F+"Fn"](M,q);w[Z[F+"Key"]]=M}if(Z.addParent)w[Z.parentKey]=q;q[Z.elementsKey].push(w)}}function T(F){if("attributesFn"in Z&&F)F=Z.attributesFn(F,q);if((Z.trim||("attributeValueFn"in Z)||("attributeNameFn"in Z)||Z.nativeTypeAttributes)&&F){var M;for(M in F)if(F.hasOwnProperty(M)){if(Z.trim)F[M]=F[M].trim();if(Z.nativeTypeAttributes)F[M]=I(F[M]);if("attributeValueFn"in Z)F[M]=Z.attributeValueFn(F[M],M,q);if("attributeNameFn"in Z){var $=F[M];delete F[M],F[Z.attributeNameFn(M,F[M],q)]=$}}}return F}function A(F){var M={};if(F.body&&(F.name.toLowerCase()==="xml"||Z.instructionHasAttributes)){var $=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,x;while((x=$.exec(F.body))!==null)M[x[1]]=x[2]||x[3]||x[4];M=T(M)}if(F.name.toLowerCase()==="xml"){if(Z.ignoreDeclaration)return;if(q[Z.declarationKey]={},Object.keys(M).length)q[Z.declarationKey][Z.attributesKey]=M;if(Z.addParent)q[Z.declarationKey][Z.parentKey]=q}else{if(Z.ignoreInstruction)return;if(Z.trim)F.body=F.body.trim();var w={};if(Z.instructionHasAttributes&&Object.keys(M).length)w[F.name]={},w[F.name][Z.attributesKey]=M;else w[F.name]=F.body;H("instruction",w)}}function P(F,M){var $;if(typeof F==="object")M=F.attributes,F=F.name;if(M=T(M),"elementNameFn"in Z)F=Z.elementNameFn(F,q);if(Z.compact){if($={},!Z.ignoreAttributes&&M&&Object.keys(M).length){$[Z.attributesKey]={};var x;for(x in M)if(M.hasOwnProperty(x))$[Z.attributesKey][x]=M[x]}if(!(F in q)&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(F)!==-1:Z.alwaysArray))q[F]=[];if(q[F]&&!K(q[F]))q[F]=[q[F]];if(K(q[F]))q[F].push($);else q[F]=$}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];if($={},$[Z.typeKey]="element",$[Z.nameKey]=F,!Z.ignoreAttributes&&M&&Object.keys(M).length)$[Z.attributesKey]=M;if(Z.alwaysChildren)$[Z.elementsKey]=[];q[Z.elementsKey].push($)}$[Z.parentKey]=q,q=$}function j(F){if(Z.ignoreText)return;if(!F.trim()&&!Z.captureSpacesBetweenElements)return;if(Z.trim)F=F.trim();if(Z.nativeType)F=I(F);if(Z.sanitize)F=F.replace(/&/g,"&").replace(//g,">");H("text",F)}function E(F){if(Z.ignoreComment)return;if(Z.trim)F=F.trim();H("comment",F)}function C(F){var M=q[Z.parentKey];if(!Z.addParent)delete q[Z.parentKey];q=M}function N(F){if(Z.ignoreCdata)return;if(Z.trim)F=F.trim();H("cdata",F)}function v(F){if(Z.ignoreDoctype)return;if(F=F.replace(/^ /,""),Z.trim)F=F.trim();H("doctype",F)}function S(F){F.note=F}U.exports=function(F,M){var $=J?G.parser(!0,{}):$=new Y.Parser("UTF-8"),x={};if(q=x,Z=W(M),J)$.opt={strictEntities:!0},$.onopentag=P,$.ontext=j,$.oncomment=E,$.onclosetag=C,$.onerror=S,$.oncdata=N,$.ondoctype=v,$.onprocessinginstruction=A;else $.on("startElement",P),$.on("text",j),$.on("comment",E),$.on("endElement",C),$.on("error",S);if(J)$.write(F).close();else if(!$.parse(F))throw Error("XML parsing error: "+$.getError());if(x[Z.elementsKey]){var w=x[Z.elementsKey];delete x[Z.elementsKey],x[Z.elementsKey]=w,delete x.text}return x}}),YG=R0((B,U)=>{var G=h8(),Y=TB();function Q(K){var Z=G.copyOptions(K);return G.ensureSpacesExists(Z),Z}U.exports=function(K,Z){var J=Q(Z),q=Y(K,J),W,I="compact"in J&&J.compact?"_parent":"parent";if("addParent"in J&&J.addParent)W=JSON.stringify(q,function(H,T){return H===I?"_":T},J.spaces);else W=JSON.stringify(q,null,J.spaces);return W.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}}),CB=R0((B,U)=>{var G=h8(),Y=_8().isArray,Q,K;function Z(F){var M=G.copyOptions(F);if(G.ensureFlagExists("ignoreDeclaration",M),G.ensureFlagExists("ignoreInstruction",M),G.ensureFlagExists("ignoreAttributes",M),G.ensureFlagExists("ignoreText",M),G.ensureFlagExists("ignoreComment",M),G.ensureFlagExists("ignoreCdata",M),G.ensureFlagExists("ignoreDoctype",M),G.ensureFlagExists("compact",M),G.ensureFlagExists("indentText",M),G.ensureFlagExists("indentCdata",M),G.ensureFlagExists("indentAttributes",M),G.ensureFlagExists("indentInstruction",M),G.ensureFlagExists("fullTagEmptyElement",M),G.ensureFlagExists("noQuotesForNativeAttributes",M),G.ensureSpacesExists(M),typeof M.spaces==="number")M.spaces=Array(M.spaces+1).join(" ");return G.ensureKeyExists("declaration",M),G.ensureKeyExists("instruction",M),G.ensureKeyExists("attributes",M),G.ensureKeyExists("text",M),G.ensureKeyExists("comment",M),G.ensureKeyExists("cdata",M),G.ensureKeyExists("doctype",M),G.ensureKeyExists("type",M),G.ensureKeyExists("name",M),G.ensureKeyExists("elements",M),G.checkFnExists("doctype",M),G.checkFnExists("instruction",M),G.checkFnExists("cdata",M),G.checkFnExists("comment",M),G.checkFnExists("text",M),G.checkFnExists("instructionName",M),G.checkFnExists("elementName",M),G.checkFnExists("attributeName",M),G.checkFnExists("attributeValue",M),G.checkFnExists("attributes",M),G.checkFnExists("fullTagEmptyElement",M),M}function J(F,M,$){return(!$&&F.spaces?` -`:"")+Array(M+1).join(F.spaces)}function q(F,M,$){if(M.ignoreAttributes)return"";if("attributesFn"in M)F=M.attributesFn(F,K,Q);var x,w,a,U0,b=[];for(x in F)if(F.hasOwnProperty(x)&&F[x]!==null&&F[x]!==void 0)U0=M.noQuotesForNativeAttributes&&typeof F[x]!=="string"?"":'"',w=""+F[x],w=w.replace(/"/g,"""),a="attributeNameFn"in M?M.attributeNameFn(x,w,K,Q):x,b.push(M.spaces&&M.indentAttributes?J(M,$+1,!1):" "),b.push(a+"="+U0+("attributeValueFn"in M?M.attributeValueFn(w,x,K,Q):w)+U0);if(F&&Object.keys(F).length&&M.spaces&&M.indentAttributes)b.push(J(M,$,!1));return b.join("")}function W(F,M,$){return Q=F,K="xml",M.ignoreDeclaration?"":""}function I(F,M,$){if(M.ignoreInstruction)return"";var x;for(x in F)if(F.hasOwnProperty(x))break;var w="instructionNameFn"in M?M.instructionNameFn(x,F[x],K,Q):x;if(typeof F[x]==="object")return Q=F,K=w,"";else{var a=F[x]?F[x]:"";if("instructionFn"in M)a=M.instructionFn(a,x,K,Q);return""}}function H(F,M){return M.ignoreComment?"":""}function T(F,M){return M.ignoreCdata?"":"","]]]]>"))+"]]>"}function A(F,M){return M.ignoreDoctype?"":""}function P(F,M){if(M.ignoreText)return"";return F=""+F,F=F.replace(/&/g,"&"),F=F.replace(/&/g,"&").replace(//g,">"),"textFn"in M?M.textFn(F,K,Q):F}function j(F,M){var $;if(F.elements&&F.elements.length)for($=0;$"),F[M.elementsKey]&&F[M.elementsKey].length)x.push(C(F[M.elementsKey],M,$+1)),Q=F,K=F.name;x.push(M.spaces&&j(F,M)?` -`+Array($+1).join(M.spaces):""),x.push("")}else x.push("/>");return x.join("")}function C(F,M,$,x){return F.reduce(function(w,a){var U0=J(M,$,x&&!w);switch(a.type){case"element":return w+U0+E(a,M,$);case"comment":return w+U0+H(a[M.commentKey],M);case"doctype":return w+U0+A(a[M.doctypeKey],M);case"cdata":return w+(M.indentCdata?U0:"")+T(a[M.cdataKey],M);case"text":return w+(M.indentText?U0:"")+P(a[M.textKey],M);case"instruction":var b={};return b[a[M.nameKey]]=a[M.attributesKey]?a:a[M.instructionKey],w+(M.indentInstruction?U0:"")+I(b,M,$)}},"")}function N(F,M,$){var x;for(x in F)if(F.hasOwnProperty(x))switch(x){case M.parentKey:case M.attributesKey:break;case M.textKey:if(M.indentText||$)return!0;break;case M.cdataKey:if(M.indentCdata||$)return!0;break;case M.instructionKey:if(M.indentInstruction||$)return!0;break;case M.doctypeKey:case M.commentKey:return!0;default:return!0}return!1}function v(F,M,$,x,w){Q=F,K=M;var a="elementNameFn"in $?$.elementNameFn(M,F):M;if(typeof F>"u"||F===null||F==="")return"fullTagEmptyElementFn"in $&&$.fullTagEmptyElementFn(M,F)||$.fullTagEmptyElement?"<"+a+">":"<"+a+"/>";var U0=[];if(M){if(U0.push("<"+a),typeof F!=="object")return U0.push(">"+P(F,$)+""),U0.join("");if(F[$.attributesKey])U0.push(q(F[$.attributesKey],$,x));var b=N(F,$,!0)||F[$.attributesKey]&&F[$.attributesKey]["xml:space"]==="preserve";if(!b)if("fullTagEmptyElementFn"in $)b=$.fullTagEmptyElementFn(M,F);else b=$.fullTagEmptyElement;if(b)U0.push(">");else return U0.push("/>"),U0.join("")}if(U0.push(S(F,$,x+1,!1)),Q=F,K=M,M)U0.push((w?J($,x,!1):"")+"");return U0.join("")}function S(F,M,$,x){var w,a,U0,b=[];for(a in F)if(F.hasOwnProperty(a)){U0=Y(F[a])?F[a]:[F[a]];for(w=0;w{var G=CB();U.exports=function(Y,Q){if(Y instanceof Buffer)Y=Y.toString();var K=null;if(typeof Y==="string")try{K=JSON.parse(Y)}catch(Z){throw Error("The JSON structure is invalid")}else K=Y;return G(K,Q)}}),h1=R0((B,U)=>{U.exports={xml2js:TB(),xml2json:YG(),js2xml:CB(),json2xml:ZG()}})(),u1=(B)=>{switch(B.type){case void 0:case"element":let U=new kB(B.name,B.attributes),G=B.elements||[];for(let Y of G){let Q=u1(Y);if(Q!==void 0)U.push(Q)}return U;case"text":return B.text;default:return}},QG=class extends H0{},kB=class extends t{static fromXmlString(B){return u1((0,h1.xml2js)(B,{compact:!1}))}constructor(B,U){super(B);if(U)this.root.push(new QG(U))}push(B){this.root.push(B)}},$B=class extends t{constructor(B){super("");e(this,"_attr",void 0),this._attr=B}prepForXml(B){return{_attr:this._attr}}},JG="",u8=class extends t{constructor(B,U){super(B);if(U)this.root=U.root}},T0=(B)=>{if(isNaN(B))throw Error(`Invalid value '${B}' specified. Must be an integer.`);return Math.floor(B)},X1=(B)=>{let U=T0(B);if(U<0)throw Error(`Invalid value '${B}' specified. Must be a positive integer.`);return U},d1=(B,U)=>{let G=U*2;if(B.length!==G||isNaN(Number(`0x${B}`)))throw Error(`Invalid hex value '${B}'. Expected ${G} digit hex value`);return B},KG=(B)=>d1(B,4),SB=(B)=>d1(B,2),W8=(B)=>d1(B,1),q1=(B)=>{let U=B.slice(-2),G=B.substring(0,B.length-2);return`${Number(G)}${U}`},d8=(B)=>{let U=q1(B);if(parseFloat(U)<0)throw Error(`Invalid value '${U}' specified. Expected a positive number.`);return U},C2=(B)=>{if(B==="auto")return B;return d1(B.charAt(0)==="#"?B.substring(1):B,3)},t0=(B)=>typeof B==="string"?q1(B):T0(B),bB=(B)=>typeof B==="string"?d8(B):X1(B),VG=(B)=>typeof B==="string"?q1(B):T0(B),E0=(B)=>typeof B==="string"?d8(B):X1(B),vB=(B)=>{let U=B.substring(0,B.length-1);return`${Number(U)}%`},c8=(B)=>{if(typeof B==="number")return T0(B);if(B.slice(-1)==="%")return vB(B);return q1(B)},yB=X1,gB=X1,fB=(B)=>B.toISOString(),q0=class extends t{constructor(B,U=!0){super(B);if(U!==!0)this.root.push(new C0({val:U}))}},D1=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:bB(U)}))}},S0=class extends t{},q2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},f2=(B,U)=>new M0({name:B,attributes:{value:{key:"w:val",value:U}}}),_2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},XG=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},O2=class extends t{constructor(B,U){super(B);this.root.push(U)}},M0=class extends t{constructor({name:B,attributes:U,children:G}){super(B);if(U)this.root.push(new $8(U));if(G)this.root.push(...G)}},c0={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},m8=(B)=>new M0({name:"w:jc",attributes:{val:{key:"w:val",value:B}}}),j0=(B,{color:U,size:G,space:Y,style:Q})=>new M0({name:B,attributes:{style:{key:"w:val",value:Q},color:{key:"w:color",value:U===void 0?void 0:C2(U)},size:{key:"w:sz",value:G===void 0?void 0:yB(G)},space:{key:"w:space",value:Y===void 0?void 0:gB(Y)}}}),c1={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},xB=class extends R2{constructor(B){super("w:pBdr");if(B.top)this.root.push(j0("w:top",B.top));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.left)this.root.push(j0("w:left",B.left));if(B.right)this.root.push(j0("w:right",B.right));if(B.between)this.root.push(j0("w:between",B.between))}},_B=class extends t{constructor(){super("w:pBdr");let B=j0("w:bottom",{color:"auto",space:1,style:c1.SINGLE,size:6});this.root.push(B)}},hB=({start:B,end:U,left:G,right:Y,hanging:Q,firstLine:K,firstLineChars:Z})=>new M0({name:"w:ind",attributes:{start:{key:"w:start",value:B===void 0?void 0:t0(B)},end:{key:"w:end",value:U===void 0?void 0:t0(U)},left:{key:"w:left",value:G===void 0?void 0:t0(G)},right:{key:"w:right",value:Y===void 0?void 0:t0(Y)},hanging:{key:"w:hanging",value:Q===void 0?void 0:E0(Q)},firstLine:{key:"w:firstLine",value:K===void 0?void 0:E0(K)},firstLineChars:{key:"w:firstLineChars",value:Z===void 0?void 0:T0(Z)}}}),uB=()=>new M0({name:"w:br"}),l8={BEGIN:"begin",END:"end",SEPARATE:"separate"},a8=(B,U)=>new M0({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:B},dirty:{key:"w:dirty",value:U}}}),e0=(B)=>a8(l8.BEGIN,B),X2=(B)=>a8(l8.SEPARATE,B),B2=(B)=>a8(l8.END,B),qG={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},MG={BOTTOM:"bottom",CENTER:"center",INSIDE:"inside",OUTSIDE:"outside",TOP:"top"},RG={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},x0={DEFAULT:"default",PRESERVE:"preserve"},_0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{space:"xml:space"})}},LG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},IG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},OG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},HG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTION")}},M1=({fill:B,color:U,type:G})=>new M0({name:"w:shd",attributes:{fill:{key:"w:fill",value:B===void 0?void 0:C2(B)},color:{key:"w:color",value:U===void 0?void 0:C2(U)},type:{key:"w:val",value:G}}}),FG={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},b0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},WG=class extends t{constructor(B){super("w:del");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},PG=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},p8={DOT:"dot"},r8=(B=p8.DOT)=>new M0({name:"w:em",attributes:{val:{key:"w:val",value:B}}}),AG=()=>r8(p8.DOT),jG=class extends t{constructor(B){super("w:spacing");this.root.push(new C0({val:t0(B)}))}},NG=class extends t{constructor(B){super("w:color");this.root.push(new C0({val:C2(B)}))}},wG=class extends t{constructor(B){super("w:highlight");this.root.push(new C0({val:B}))}},zG=class extends t{constructor(B){super("w:highlightCs");this.root.push(new C0({val:B}))}},EG=(B)=>new M0({name:"w:lang",attributes:{value:{key:"w:val",value:B.value},eastAsia:{key:"w:eastAsia",value:B.eastAsia},bidirectional:{key:"w:bidi",value:B.bidirectional}}}),T1=(B,U)=>{if(typeof B==="string"){let Y=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:Y},cs:{key:"w:cs",value:Y},eastAsia:{key:"w:eastAsia",value:Y},hAnsi:{key:"w:hAnsi",value:Y},hint:{key:"w:hint",value:U}}})}let G=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:G.ascii},cs:{key:"w:cs",value:G.cs},eastAsia:{key:"w:eastAsia",value:G.eastAsia},hAnsi:{key:"w:hAnsi",value:G.hAnsi},hint:{key:"w:hint",value:G.hint}}})},dB=(B)=>new M0({name:"w:vertAlign",attributes:{val:{key:"w:val",value:B}}}),DG=()=>dB("superscript"),TG=()=>dB("subscript"),i8={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},cB=(B=i8.SINGLE,U)=>new M0({name:"w:u",attributes:{val:{key:"w:val",value:B},color:{key:"w:color",value:U===void 0?void 0:C2(U)}}}),CG={BLINK_BACKGROUND:"blinkBackground",LIGHTS:"lights",ANTS_BLACK:"antsBlack",ANTS_RED:"antsRed",SHIMMER:"shimmer",SPARKLE:"sparkle",NONE:"none"},kG={BLACK:"black",BLUE:"blue",CYAN:"cyan",DARK_BLUE:"darkBlue",DARK_CYAN:"darkCyan",DARK_GRAY:"darkGray",DARK_GREEN:"darkGreen",DARK_MAGENTA:"darkMagenta",DARK_RED:"darkRed",DARK_YELLOW:"darkYellow",GREEN:"green",LIGHT_GRAY:"lightGray",MAGENTA:"magenta",NONE:"none",RED:"red",WHITE:"white",YELLOW:"yellow"},U2=class extends R2{constructor(B){super("w:rPr");if(!B)return;if(B.style)this.push(new q2("w:rStyle",B.style));if(B.font)if(typeof B.font==="string")this.push(T1(B.font));else if("name"in B.font)this.push(T1(B.font.name,B.font.hint));else this.push(T1(B.font));if(B.bold!==void 0)this.push(new q0("w:b",B.bold));if(B.boldComplexScript===void 0&&B.bold!==void 0||B.boldComplexScript){var U;this.push(new q0("w:bCs",(U=B.boldComplexScript)!==null&&U!==void 0?U:B.bold))}if(B.italics!==void 0)this.push(new q0("w:i",B.italics));if(B.italicsComplexScript===void 0&&B.italics!==void 0||B.italicsComplexScript){var G;this.push(new q0("w:iCs",(G=B.italicsComplexScript)!==null&&G!==void 0?G:B.italics))}if(B.smallCaps!==void 0)this.push(new q0("w:smallCaps",B.smallCaps));else if(B.allCaps!==void 0)this.push(new q0("w:caps",B.allCaps));if(B.strike!==void 0)this.push(new q0("w:strike",B.strike));if(B.doubleStrike!==void 0)this.push(new q0("w:dstrike",B.doubleStrike));if(B.emboss!==void 0)this.push(new q0("w:emboss",B.emboss));if(B.imprint!==void 0)this.push(new q0("w:imprint",B.imprint));if(B.noProof!==void 0)this.push(new q0("w:noProof",B.noProof));if(B.snapToGrid!==void 0)this.push(new q0("w:snapToGrid",B.snapToGrid));if(B.vanish)this.push(new q0("w:vanish",B.vanish));if(B.color)this.push(new NG(B.color));if(B.characterSpacing)this.push(new jG(B.characterSpacing));if(B.scale!==void 0)this.push(new _2("w:w",B.scale));if(B.kern)this.push(new D1("w:kern",B.kern));if(B.position)this.push(new q2("w:position",B.position));if(B.size!==void 0)this.push(new D1("w:sz",B.size));let Y=B.sizeComplexScript===void 0||B.sizeComplexScript===!0?B.size:B.sizeComplexScript;if(Y)this.push(new D1("w:szCs",Y));if(B.highlight)this.push(new wG(B.highlight));let Q=B.highlightComplexScript===void 0||B.highlightComplexScript===!0?B.highlight:B.highlightComplexScript;if(Q)this.push(new zG(Q));if(B.underline)this.push(cB(B.underline.type,B.underline.color));if(B.effect)this.push(new q2("w:effect",B.effect));if(B.border)this.push(j0("w:bdr",B.border));if(B.shading)this.push(M1(B.shading));if(B.subScript)this.push(TG());if(B.superScript)this.push(DG());if(B.rightToLeft!==void 0)this.push(new q0("w:rtl",B.rightToLeft));if(B.emphasisMark)this.push(r8(B.emphasisMark.type));if(B.language)this.push(EG(B.language));if(B.specVanish)this.push(new q0("w:specVanish",B.vanish));if(B.math)this.push(new q0("w:oMath",B.math));if(B.revision)this.push(new lB(B.revision))}push(B){this.root.push(B)}},mB=class extends U2{constructor(B){super(B);if(B===null||B===void 0?void 0:B.insertion)this.push(new PG(B.insertion));if(B===null||B===void 0?void 0:B.deletion)this.push(new WG(B.deletion))}},lB=class extends t{constructor(B){super("w:rPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new U2(B))}},Z1=class extends t{constructor(B){super("w:t");if(typeof B==="string")this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B);else{var U;this.root.push(new _0({space:(U=B.space)!==null&&U!==void 0?U:x0.DEFAULT})),this.root.push(B.text)}}},F2={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},D0=class extends t{constructor(B){super("w:r");if(e(this,"properties",void 0),this.properties=new U2(B),this.root.push(this.properties),B.break)for(let U=0;U{U.exports=G;function G(Y,Q){if(!Y)throw Error(Q||"Assertion failed")}G.equal=function(Q,K,Z){if(Q!=K)throw Error(Z||"Assertion failed: "+Q+" != "+K)}}),G2=R0((B)=>{var U=R1();B.inherits=W2();function G(b,c){if((b.charCodeAt(c)&64512)!==55296)return!1;if(c<0||c+1>=b.length)return!1;return(b.charCodeAt(c+1)&64512)===56320}function Y(b,c){if(Array.isArray(b))return b.slice();if(!b)return[];var D=[];if(typeof b==="string"){if(!c){var m=0;for(var B0=0;B0>6|192,D[m++]=i&63|128;else if(G(b,B0))i=65536+((i&1023)<<10)+(b.charCodeAt(++B0)&1023),D[m++]=i>>18|240,D[m++]=i>>12&63|128,D[m++]=i>>6&63|128,D[m++]=i&63|128;else D[m++]=i>>12|224,D[m++]=i>>6&63|128,D[m++]=i&63|128}}else if(c==="hex"){if(b=b.replace(/[^a-z0-9]+/gi,""),b.length%2!==0)b="0"+b;for(B0=0;B0>>24|b>>>8&65280|b<<8&16711680|(b&255)<<24)>>>0}B.htonl=K;function Z(b,c){var D="";for(var m=0;m>>0}return i}B.join32=W;function I(b,c){var D=Array(b.length*4);for(var m=0,B0=0;m>>24,D[B0+1]=i>>>16&255,D[B0+2]=i>>>8&255,D[B0+3]=i&255;else D[B0+3]=i>>>24,D[B0+2]=i>>>16&255,D[B0+1]=i>>>8&255,D[B0]=i&255}return D}B.split32=I;function H(b,c){return b>>>c|b<<32-c}B.rotr32=H;function T(b,c){return b<>>32-c}B.rotl32=T;function A(b,c){return b+c>>>0}B.sum32=A;function P(b,c,D){return b+c+D>>>0}B.sum32_3=P;function j(b,c,D,m){return b+c+D+m>>>0}B.sum32_4=j;function E(b,c,D,m,B0){return b+c+D+m+B0>>>0}B.sum32_5=E;function C(b,c,D,m){var B0=b[c],i=m+b[c+1]>>>0;b[c]=(i>>0,b[c+1]=i}B.sum64=C;function N(b,c,D,m){return(c+m>>>0>>0}B.sum64_hi=N;function v(b,c,D,m){return c+m>>>0}B.sum64_lo=v;function S(b,c,D,m,B0,i,V0,s){var G0=0,r=c;return r=r+m>>>0,G0+=r>>0,G0+=r>>0,G0+=r>>0}B.sum64_4_hi=S;function F(b,c,D,m,B0,i,V0,s){return c+m+i+s>>>0}B.sum64_4_lo=F;function M(b,c,D,m,B0,i,V0,s,G0,r){var y=0,n=c;return n=n+m>>>0,y+=n>>0,y+=n>>0,y+=n>>0,y+=n>>0}B.sum64_5_hi=M;function $(b,c,D,m,B0,i,V0,s,G0,r){return c+m+i+s+r>>>0}B.sum64_5_lo=$;function x(b,c,D){return(c<<32-D|b>>>D)>>>0}B.rotr64_hi=x;function w(b,c,D){return(b<<32-D|c>>>D)>>>0}B.rotr64_lo=w;function a(b,c,D){return b>>>D}B.shr64_hi=a;function U0(b,c,D){return(b<<32-D|c>>>D)>>>0}B.shr64_lo=U0}),L1=R0((B)=>{var U=G2(),G=R1();function Y(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}B.BlockHash=Y,Y.prototype.update=function(K,Z){if(K=U.toArray(K,Z),!this.pending)this.pending=K;else this.pending=this.pending.concat(K);if(this.pendingTotal+=K.length,this.pending.length>=this._delta8){K=this.pending;var J=K.length%this._delta8;if(this.pending=K.slice(K.length-J,K.length),this.pending.length===0)this.pending=null;K=U.join32(K,0,K.length-J,this.endian);for(var q=0;q>>24&255,q[W++]=K>>>16&255,q[W++]=K>>>8&255,q[W++]=K&255}else{q[W++]=K&255,q[W++]=K>>>8&255,q[W++]=K>>>16&255,q[W++]=K>>>24&255,q[W++]=0,q[W++]=0,q[W++]=0,q[W++]=0;for(I=8;I{var U=G2().rotr32;function G(I,H,T,A){if(I===0)return Y(H,T,A);if(I===1||I===3)return K(H,T,A);if(I===2)return Q(H,T,A)}B.ft_1=G;function Y(I,H,T){return I&H^~I&T}B.ch32=Y;function Q(I,H,T){return I&H^I&T^H&T}B.maj32=Q;function K(I,H,T){return I^H^T}B.p32=K;function Z(I){return U(I,2)^U(I,13)^U(I,22)}B.s0_256=Z;function J(I){return U(I,6)^U(I,11)^U(I,25)}B.s1_256=J;function q(I){return U(I,7)^U(I,18)^I>>>3}B.g0_256=q;function W(I){return U(I,17)^U(I,19)^I>>>10}B.g1_256=W}),SG=R0((B,U)=>{var G=G2(),Y=L1(),Q=pB(),K=G.rotl32,Z=G.sum32,J=G.sum32_5,q=Q.ft_1,W=Y.BlockHash,I=[1518500249,1859775393,2400959708,3395469782];function H(){if(!(this instanceof H))return new H;W.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}G.inherits(H,W),U.exports=H,H.blockSize=512,H.outSize=160,H.hmacStrength=80,H.padLength=64,H.prototype._update=function(A,P){var j=this.W;for(var E=0;E<16;E++)j[E]=A[P+E];for(;E{var G=G2(),Y=L1(),Q=pB(),K=R1(),Z=G.sum32,J=G.sum32_4,q=G.sum32_5,W=Q.ch32,I=Q.maj32,H=Q.s0_256,T=Q.s1_256,A=Q.g0_256,P=Q.g1_256,j=Y.BlockHash,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function C(){if(!(this instanceof C))return new C;j.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=Array(64)}G.inherits(C,j),U.exports=C,C.blockSize=512,C.outSize=256,C.hmacStrength=192,C.padLength=64,C.prototype._update=function(v,S){var F=this.W;for(var M=0;M<16;M++)F[M]=v[S+M];for(;M{var G=G2(),Y=rB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=512,Q.outSize=224,Q.hmacStrength=192,Q.padLength=64,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),iB=R0((B,U)=>{var G=G2(),Y=L1(),Q=R1(),K=G.rotr64_hi,Z=G.rotr64_lo,J=G.shr64_hi,q=G.shr64_lo,W=G.sum64,I=G.sum64_hi,H=G.sum64_lo,T=G.sum64_4_hi,A=G.sum64_4_lo,P=G.sum64_5_hi,j=G.sum64_5_lo,E=Y.BlockHash,C=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function N(){if(!(this instanceof N))return new N;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=C,this.W=Array(160)}G.inherits(N,E),U.exports=N,N.blockSize=1024,N.outSize=512,N.hmacStrength=192,N.padLength=128,N.prototype._prepareBlock=function(B0,i){var V0=this.W;for(var s=0;s<32;s++)V0[s]=B0[i+s];for(;s{var G=G2(),Y=iB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=1024,Q.outSize=384,Q.hmacStrength=192,Q.padLength=128,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),yG=R0((B)=>{B.sha1=SG(),B.sha224=bG(),B.sha256=rB(),B.sha384=vG(),B.sha512=iB()}),gG=R0((B)=>{var U=G2(),G=L1(),Y=U.rotl32,Q=U.sum32,K=U.sum32_3,Z=U.sum32_4,J=G.BlockHash;function q(){if(!(this instanceof q))return new q;J.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}U.inherits(q,J),B.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(C,N){var v=this.h[0],S=this.h[1],F=this.h[2],M=this.h[3],$=this.h[4],x=v,w=S,a=F,U0=M,b=$;for(var c=0;c<80;c++){var D=Q(Y(Z(v,W(c,S,F,M),C[T[c]+N],I(c)),P[c]),$);v=$,$=M,M=Y(F,10),F=S,S=D,D=Q(Y(Z(x,W(79-c,w,a,U0),C[A[c]+N],H(c)),j[c]),b),x=b,b=U0,U0=Y(a,10),a=w,w=D}D=K(this.h[1],F,U0),this.h[1]=K(this.h[2],M,b),this.h[2]=K(this.h[3],$,x),this.h[3]=K(this.h[4],v,w),this.h[4]=K(this.h[0],S,a),this.h[0]=D},q.prototype._digest=function(C){if(C==="hex")return U.toHex32(this.h,"little");else return U.split32(this.h,"little")};function W(E,C,N,v){if(E<=15)return C^N^v;else if(E<=31)return C&N|~C&v;else if(E<=47)return(C|~N)^v;else if(E<=63)return C&v|N&~v;else return C^(N|~v)}function I(E){if(E<=15)return 0;else if(E<=31)return 1518500249;else if(E<=47)return 1859775393;else if(E<=63)return 2400959708;else return 2840853838}function H(E){if(E<=15)return 1352829926;else if(E<=31)return 1548603684;else if(E<=47)return 1836072691;else if(E<=63)return 2053994217;else return 0}var T=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],A=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],P=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],j=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),fG=R0((B,U)=>{var G=G2(),Y=R1();function Q(K,Z,J){if(!(this instanceof Q))return new Q(K,Z,J);this.Hash=K,this.blockSize=K.blockSize/8,this.outSize=K.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(Z,J))}U.exports=Q,Q.prototype._init=function(Z){if(Z.length>this.blockSize)Z=new this.Hash().update(Z).digest();Y(Z.length<=this.blockSize);for(var J=Z.length;J{var U=B;U.utils=G2(),U.common=L1(),U.sha=yG(),U.ripemd=gG(),U.hmac=fG(),U.sha1=U.sha.sha1,U.sha256=U.sha.sha256,U.sha224=U.sha.sha224,U.sha384=U.sha.sha384,U.sha512=U.sha.sha512,U.ripemd160=U.ripemd.ripemd160})(),1),_G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",hG=(B,U=21)=>{return(G=U)=>{let Y="",Q=G|0;while(Q--)Y+=B[Math.random()*B.length|0];return Y}},uG=(B=21)=>{let U="",G=B|0;while(G--)U+=_G[Math.random()*64|0];return U},dG=(B)=>Math.floor(B/25.4*72*20),u0=(B)=>Math.floor(B*72*20),I1=(B=0)=>{let U=B;return()=>++U},nB=()=>I1(),sB=()=>I1(1),oB=()=>I1(),tB=()=>I1(),O1=()=>uG().toLowerCase(),P8=(B)=>xG.default.sha1().update(B instanceof ArrayBuffer?new Uint8Array(B):B).digest("hex"),s2=(B)=>hG("1234567890abcdef",B)(),eB=()=>`${s2(8)}-${s2(4)}-${s2(4)}-${s2(4)}-${s2(12)}`,U1=(B)=>new Uint8Array(new TextEncoder().encode(B)),B4={CHARACTER:"character",COLUMN:"column",INSIDE_MARGIN:"insideMargin",LEFT_MARGIN:"leftMargin",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",RIGHT_MARGIN:"rightMargin"},U4={BOTTOM_MARGIN:"bottomMargin",INSIDE_MARGIN:"insideMargin",LINE:"line",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",PARAGRAPH:"paragraph",TOP_MARGIN:"topMargin"},G4=()=>new M0({name:"wp:simplePos",attributes:{x:{key:"x",value:0},y:{key:"y",value:0}}}),Y4=(B)=>new M0({name:"wp:align",children:[B]}),Z4=(B)=>new M0({name:"wp:posOffset",children:[B.toString()]}),Q4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionH",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:B4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),J4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionV",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:U4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),cG=function(B){return B.CENTER="ctr",B.TOP="t",B.BOTTOM="b",B}({}),K4=(B={})=>{var U,G,Y,Q;return new M0({name:"wps:bodyPr",attributes:{lIns:{key:"lIns",value:(U=B.margins)===null||U===void 0?void 0:U.left},rIns:{key:"rIns",value:(G=B.margins)===null||G===void 0?void 0:G.right},tIns:{key:"tIns",value:(Y=B.margins)===null||Y===void 0?void 0:Y.top},bIns:{key:"bIns",value:(Q=B.margins)===null||Q===void 0?void 0:Q.bottom},anchor:{key:"anchor",value:B.verticalAnchor}},children:[...B.noAutoFit?[new q0("a:noAutofit",B.noAutoFit)]:[]]})},mG=(B={txBox:"1"})=>new M0({name:"wps:cNvSpPr",attributes:{txBox:{key:"txBox",value:B.txBox}}}),lG=(B)=>new M0({name:"w:txbxContent",children:[...B]}),aG=(B)=>new M0({name:"wps:txbx",children:[lG(B)]}),pG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{cx:"cx",cy:"cy"})}},rG=class extends t{constructor(B,U){super("a:ext");e(this,"attributes",void 0),this.attributes=new pG({cx:B,cy:U}),this.root.push(this.attributes)}},iG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{x:"x",y:"y"})}},nG=class extends t{constructor(B,U){super("a:off");this.root.push(new iG({x:B!==null&&B!==void 0?B:0,y:U!==null&&U!==void 0?U:0}))}},sG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{flipVertical:"flipV",flipHorizontal:"flipH",rotation:"rot"})}},V4=class extends t{constructor(B){var U,G,Y,Q;super("a:xfrm");e(this,"extents",void 0),e(this,"offset",void 0),this.root.push(new sG({flipVertical:(U=B.flip)===null||U===void 0?void 0:U.vertical,flipHorizontal:(G=B.flip)===null||G===void 0?void 0:G.horizontal,rotation:B.rotation})),this.offset=new nG((Y=B.offset)===null||Y===void 0||(Y=Y.emus)===null||Y===void 0?void 0:Y.x,(Q=B.offset)===null||Q===void 0||(Q=Q.emus)===null||Q===void 0?void 0:Q.y),this.extents=new rG(B.emus.x,B.emus.y),this.root.push(this.offset),this.root.push(this.extents)}},X4=()=>new M0({name:"a:noFill"}),oG=(B)=>new M0({name:"a:srgbClr",attributes:{value:{key:"val",value:B.value}}}),tG=(B)=>new M0({name:"a:schemeClr",attributes:{value:{key:"val",value:B.value}}}),A8=(B)=>new M0({name:"a:solidFill",children:[B.type==="rgb"?oG(B):tG(B)]}),eG=(B)=>new M0({name:"a:ln",attributes:{width:{key:"w",value:B.width},cap:{key:"cap",value:B.cap},compoundLine:{key:"cmpd",value:B.compoundLine},align:{key:"algn",value:B.align}},children:[B.type==="noFill"?X4():B.solidFillType==="rgb"?A8({type:"rgb",value:B.value}):A8({type:"scheme",value:B.value})]}),BY=class extends t{constructor(){super("a:avLst")}},UY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{prst:"prst"})}},GY=class extends t{constructor(){super("a:prstGeom");this.root.push(new UY({prst:"rect"})),this.root.push(new BY)}},YY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{bwMode:"bwMode"})}},q4=class extends t{constructor({element:B,outline:U,solidFill:G,transform:Y}){super(`${B}:spPr`);if(e(this,"form",void 0),this.root.push(new YY({bwMode:"auto"})),this.form=new V4(Y),this.root.push(this.form),this.root.push(new GY),U)this.root.push(X4()),this.root.push(eG(U));if(G)this.root.push(A8(G))}},l6=(B)=>new M0({name:"wps:wsp",children:[mG(B.nonVisualProperties),new q4({element:"wps",transform:B.transformation,outline:B.outline,solidFill:B.solidFill}),aG(B.children),K4(B.bodyProperties)]}),K8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{uri:"uri"})}},ZY=(B)=>new M0({name:"asvg:svgBlip",attributes:{asvg:{key:"xmlns:asvg",value:"http://schemas.microsoft.com/office/drawing/2016/SVG/main"},embed:{key:"r:embed",value:`rId{${B.fileName}}`}}}),QY=(B)=>new M0({name:"a:ext",attributes:{uri:{key:"uri",value:"{96DAC541-7B7A-43D3-8B79-37D633B846F1}"}},children:[ZY(B)]}),JY=(B)=>new M0({name:"a:extLst",children:[QY(B)]}),KY=(B)=>new M0({name:"a:blip",attributes:{embed:{key:"r:embed",value:`rId{${B.type==="svg"?B.fallback.fileName:B.fileName}}`},cstate:{key:"cstate",value:"none"}},children:B.type==="svg"?[JY(B)]:[]}),VY=class extends t{constructor(){super("a:srcRect")}},XY=class extends t{constructor(){super("a:fillRect")}},qY=class extends t{constructor(){super("a:stretch");this.root.push(new XY)}},MY=class extends t{constructor(B){super("pic:blipFill");this.root.push(KY(B)),this.root.push(new VY),this.root.push(new qY)}},RY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{noChangeAspect:"noChangeAspect",noChangeArrowheads:"noChangeArrowheads"})}},LY=class extends t{constructor(){super("a:picLocks");this.root.push(new RY({noChangeAspect:1,noChangeArrowheads:1}))}},IY=class extends t{constructor(){super("pic:cNvPicPr");this.root.push(new LY)}},M4=(B,U)=>new M0({name:"a:hlinkClick",attributes:L0(L0({},U?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${B}`}})}),OY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"id",name:"name",descr:"descr"})}},HY=class extends t{constructor(){super("pic:cNvPr");this.root.push(new OY({id:0,name:"",descr:""}))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!1));break}return super.prepForXml(B)}},FY=class extends t{constructor(){super("pic:nvPicPr");this.root.push(new HY),this.root.push(new IY)}},WY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:pic"})}},a6=class extends t{constructor({mediaData:B,transform:U,outline:G}){super("pic:pic");this.root.push(new WY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/picture"})),this.root.push(new FY),this.root.push(new MY(B)),this.root.push(new q4({element:"pic",transform:U,outline:G}))}},PY=(B)=>new M0({name:"wpg:grpSpPr",children:[new V4(B)]}),AY=()=>new M0({name:"wpg:cNvGrpSpPr"}),jY=(B)=>new M0({name:"wpg:wgp",children:[AY(),PY(B.transformation),...B.children]}),NY=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphicData");if(B.type==="wps"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));let Q=l6(L0(L0({},B.data),{},{transformation:U,outline:G,solidFill:Y}));this.root.push(Q)}else if(B.type==="wpg"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"}));let Q=jY({children:B.children.map((K)=>{if(K.type==="wps")return l6(L0(L0({},K.data),{},{transformation:K.transformation,outline:K.outline,solidFill:K.solidFill}));else return new a6({mediaData:K,transform:K.transformation,outline:K.outline})}),transformation:U});this.root.push(Q)}else{this.root.push(new K8({uri:"http://schemas.openxmlformats.org/drawingml/2006/picture"}));let Q=new a6({mediaData:B,transform:U,outline:G});this.root.push(Q)}}},wY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{a:"xmlns:a"})}},R4=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphic");e(this,"data",void 0),this.root.push(new wY({a:"http://schemas.openxmlformats.org/drawingml/2006/main"})),this.data=new NY({mediaData:B,transform:U,outline:G,solidFill:Y}),this.root.push(this.data)}},e2={NONE:0,SQUARE:1,TIGHT:2,TOP_AND_BOTTOM:3},L4={BOTH_SIDES:"bothSides",LEFT:"left",RIGHT:"right",LARGEST:"largest"},j8=()=>new M0({name:"wp:wrapNone"}),I4=(B,U={top:0,bottom:0,left:0,right:0})=>new M0({name:"wp:wrapSquare",attributes:{wrapText:{key:"wrapText",value:B.side||L4.BOTH_SIDES},distT:{key:"distT",value:U.top},distB:{key:"distB",value:U.bottom},distL:{key:"distL",value:U.left},distR:{key:"distR",value:U.right}}}),O4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTight",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),H4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTopAndBottom",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),F4=class extends t{constructor({name:B,description:U,title:G,id:Y}={name:"",description:"",title:""}){super("wp:docPr");e(this,"docPropertiesUniqueNumericId",oB());let Q={id:{key:"id",value:Y!==null&&Y!==void 0?Y:this.docPropertiesUniqueNumericId()},name:{key:"name",value:B}};if(U!==null&&U!==void 0)Q.description={key:"descr",value:U};if(G!==null&&G!==void 0)Q.title={key:"title",value:G};this.root.push(new $8(Q))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!0));break}return super.prepForXml(B)}},W4=({top:B,right:U,bottom:G,left:Y})=>new M0({name:"wp:effectExtent",attributes:{top:{key:"t",value:B},right:{key:"r",value:U},bottom:{key:"b",value:G},left:{key:"l",value:Y}}}),P4=({x:B,y:U})=>new M0({name:"wp:extent",attributes:{x:{key:"cx",value:B},y:{key:"cy",value:U}}}),zY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:a",noChangeAspect:"noChangeAspect"})}},EY=class extends t{constructor(){super("a:graphicFrameLocks");this.root.push(new zY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/main",noChangeAspect:1}))}},A4=()=>new M0({name:"wp:cNvGraphicFramePr",children:[new EY]}),DY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{distT:"distT",distB:"distB",distL:"distL",distR:"distR",allowOverlap:"allowOverlap",behindDoc:"behindDoc",layoutInCell:"layoutInCell",locked:"locked",relativeHeight:"relativeHeight",simplePos:"simplePos"})}},TY=class extends t{constructor({mediaData:B,transform:U,drawingOptions:G}){super("wp:anchor");let Y=L0({allowOverlap:!0,behindDocument:!1,lockAnchor:!1,layoutInCell:!0,verticalPosition:{},horizontalPosition:{}},G.floating);if(this.root.push(new DY({distT:Y.margins?Y.margins.top||0:0,distB:Y.margins?Y.margins.bottom||0:0,distL:Y.margins?Y.margins.left||0:0,distR:Y.margins?Y.margins.right||0:0,simplePos:"0",allowOverlap:Y.allowOverlap===!0?"1":"0",behindDoc:Y.behindDocument===!0?"1":"0",locked:Y.lockAnchor===!0?"1":"0",layoutInCell:Y.layoutInCell===!0?"1":"0",relativeHeight:Y.zIndex?Y.zIndex:U.emus.y})),this.root.push(G4()),this.root.push(Q4(Y.horizontalPosition)),this.root.push(J4(Y.verticalPosition)),this.root.push(P4({x:U.emus.x,y:U.emus.y})),this.root.push(W4({top:0,right:0,bottom:0,left:0})),G.floating!==void 0&&G.floating.wrap!==void 0)switch(G.floating.wrap.type){case e2.SQUARE:this.root.push(I4(G.floating.wrap,G.floating.margins));break;case e2.TIGHT:this.root.push(O4(G.floating.margins));break;case e2.TOP_AND_BOTTOM:this.root.push(H4(G.floating.margins));break;case e2.NONE:default:this.root.push(j8())}else this.root.push(j8());this.root.push(new F4(G.docProperties)),this.root.push(A4()),this.root.push(new R4({mediaData:B,transform:U,outline:G.outline,solidFill:G.solidFill}))}},CY=({mediaData:B,transform:U,docProperties:G,outline:Y,solidFill:Q})=>{var K,Z,J,q;return new M0({name:"wp:inline",attributes:{distanceTop:{key:"distT",value:0},distanceBottom:{key:"distB",value:0},distanceLeft:{key:"distL",value:0},distanceRight:{key:"distR",value:0}},children:[P4({x:U.emus.x,y:U.emus.y}),W4(Y?{top:((K=Y.width)!==null&&K!==void 0?K:9525)*2,right:((Z=Y.width)!==null&&Z!==void 0?Z:9525)*2,bottom:((J=Y.width)!==null&&J!==void 0?J:9525)*2,left:((q=Y.width)!==null&&q!==void 0?q:9525)*2}:{top:0,right:0,bottom:0,left:0}),new F4(G),A4(),new R4({mediaData:B,transform:U,outline:Y,solidFill:Q})]})},m1=class extends t{constructor(B,U={}){super("w:drawing");if(!U.floating)this.root.push(CY({mediaData:B,transform:B.transformation,docProperties:U.docProperties,outline:U.outline,solidFill:U.solidFill}));else this.root.push(new TY({mediaData:B,transform:B.transformation,drawingOptions:U}))}},kY=(B)=>{let U=B.indexOf(";base64,"),G=U===-1?0:U+8;return new Uint8Array(atob(B.substring(G)).split("").map((Y)=>Y.charCodeAt(0)))},j4=(B)=>typeof B==="string"?kY(B):B,V8=(B,U)=>({data:j4(B.data),fileName:U,transformation:{pixels:{x:Math.round(B.transformation.width),y:Math.round(B.transformation.height)},emus:{x:Math.round(B.transformation.width*9525),y:Math.round(B.transformation.height*9525)},flip:B.transformation.flip,rotation:B.transformation.rotation?B.transformation.rotation*60000:void 0}}),$Y=class extends t{constructor(B){var U=(...Z)=>(super(...Z),e(this,"imageData",void 0),this);let G=`${P8(B.data)}.${B.type}`,Y=B.type==="svg"?L0(L0({type:B.type},V8(B,G)),{},{fallback:L0({type:B.fallback.type},V8(L0(L0({},B.fallback),{},{transformation:B.transformation}),`${P8(B.fallback.data)}.${B.fallback.type}`))}):L0({type:B.type},V8(B,G)),Q=new m1(Y,{floating:B.floating,docProperties:B.altText,outline:B.outline}),K=new D0({children:[Q]});if(B.insertion)U("w:ins"),this.root.push(new b0({id:B.insertion.id,author:B.insertion.author,date:B.insertion.date})),this.addChildElement(K);else if(B.deletion)U("w:del"),this.root.push(new b0({id:B.deletion.id,author:B.deletion.author,date:B.deletion.date})),this.addChildElement(K);else U("w:r"),this.root.push(new U2({})),this.root.push(Q);this.imageData=Y}prepForXml(B){if(B.file.Media.addImage(this.imageData.fileName,this.imageData),this.imageData.type==="svg")B.file.Media.addImage(this.imageData.fallback.fileName,this.imageData.fallback);return super.prepForXml(B)}},n8=(B)=>{var U,G,Y,Q,K,Z,J,q;return{offset:{pixels:{x:Math.round((U=(G=B.offset)===null||G===void 0?void 0:G.left)!==null&&U!==void 0?U:0),y:Math.round((Y=(Q=B.offset)===null||Q===void 0?void 0:Q.top)!==null&&Y!==void 0?Y:0)},emus:{x:Math.round(((K=(Z=B.offset)===null||Z===void 0?void 0:Z.left)!==null&&K!==void 0?K:0)*9525),y:Math.round(((J=(q=B.offset)===null||q===void 0?void 0:q.top)!==null&&J!==void 0?J:0)*9525)}},pixels:{x:Math.round(B.width),y:Math.round(B.height)},emus:{x:Math.round(B.width*9525),y:Math.round(B.height*9525)},flip:B.flip,rotation:B.rotation?B.rotation*60000:void 0}},SY=class extends D0{constructor(B){super({});e(this,"wpsShapeData",void 0),this.wpsShapeData={type:B.type,transformation:n8(B.transformation),data:L0({},B)};let U=new m1(this.wpsShapeData,{floating:B.floating,docProperties:B.altText,outline:B.outline,solidFill:B.solidFill});this.root.push(U)}},bY=class extends D0{constructor(B){super({});e(this,"wpgGroupData",void 0),e(this,"mediaDatas",void 0),this.wpgGroupData={type:B.type,transformation:n8(B.transformation),children:B.children};let U=new m1(this.wpgGroupData,{floating:B.floating,docProperties:B.altText});this.mediaDatas=B.children.filter((G)=>G.type!=="wps").map((G)=>G),this.root.push(U)}prepForXml(B){return this.mediaDatas.forEach((U)=>{if(B.file.Media.addImage(U.fileName,U),U.type==="svg")B.file.Media.addImage(U.fallback.fileName,U.fallback)}),super.prepForXml(B)}},vY=class extends t{constructor(B){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(`SEQ ${B}`)}},yY=class extends D0{constructor(B){super({});this.root.push(e0(!0)),this.root.push(new vY(B)),this.root.push(X2()),this.root.push(B2())}},gY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{instr:"w:instr"})}},s8=class extends t{constructor(B,U){super("w:fldSimple");if(this.root.push(new gY({instr:B})),U!==void 0)this.root.push(new Q1(U))}},fY=class extends s8{constructor(B){super(` MERGEFIELD ${B} `,`«${B}»`)}},xY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},N4={EXTERNAL:"External"},_Y=(B,U,G,Y)=>new M0({name:"Relationship",attributes:{id:{key:"Id",value:B},type:{key:"Type",value:U},target:{key:"Target",value:G},targetMode:{key:"TargetMode",value:Y}}}),A2=class extends t{constructor(){super("Relationships");this.root.push(new xY({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(B,U,G,Y){this.root.push(_Y(`rId${B}`,U,G,Y))}get RelationshipCount(){return this.root.length-1}},hY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},o8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},uY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}},dY=class extends t{constructor(B){super("w:commentRangeStart");this.root.push(new o8({id:B}))}},cY=class extends t{constructor(B){super("w:commentRangeEnd");this.root.push(new o8({id:B}))}},mY=class extends t{constructor(B){super("w:commentReference");this.root.push(new o8({id:B}))}},N8=class extends t{constructor({id:B,initials:U,author:G,date:Y=new Date,children:Q},K){super("w:comment");e(this,"paraId",void 0),this.paraId=K,this.root.push(new hY({id:B,initials:U,author:G,date:Y.toISOString()}));for(let Z of Q)this.root.push(Z)}prepForXml(B){let U=super.prepForXml(B);if(!U||!this.paraId)return U;let G=U["w:comment"];if(!Array.isArray(G))return U;for(let Y=G.length-1;Y>=0;Y--){let Q=G[Y];if(Q&&typeof Q==="object"&&"w:p"in Q){let K=Q["w:p"];if(Array.isArray(K))K.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return U}},w4=(B)=>(B+1).toString(16).toUpperCase().padStart(8,"0"),z4=class extends t{constructor({children:B}){super("w:comments");if(e(this,"relationships",void 0),e(this,"threadData",void 0),this.root.push(new uY({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"})),B.some((U)=>U.parentId!==void 0)){let U=new Map(B.map((G)=>[G.id,w4(G.id)]));for(let G of B)this.root.push(new N8(G,U.get(G.id)));this.threadData=B.map((G)=>({paraId:U.get(G.id),parentParaId:G.parentId!==void 0?U.get(G.parentId):void 0,done:G.resolved}))}else for(let U of B)this.root.push(new N8(U));this.relationships=new A2}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}},lY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},aY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},pY=class extends t{constructor(B){super("w15:commentEx");this.root.push(new aY({paraId:B.paraId,paraIdParent:B.parentParaId,done:B.done!==void 0?B.done?"1":"0":void 0}))}},E4=class extends t{constructor(B){super("w15:commentsEx");this.root.push(new lY({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let U of B)this.root.push(new pY(U))}},rY=class extends S0{constructor(){super("w:noBreakHyphen")}},iY=class extends S0{constructor(){super("w:softHyphen")}},nY=class extends S0{constructor(){super("w:dayShort")}},sY=class extends S0{constructor(){super("w:monthShort")}},oY=class extends S0{constructor(){super("w:yearShort")}},tY=class extends S0{constructor(){super("w:dayLong")}},eY=class extends S0{constructor(){super("w:monthLong")}},BZ=class extends S0{constructor(){super("w:yearLong")}},UZ=class extends S0{constructor(){super("w:annotationRef")}},GZ=class extends S0{constructor(){super("w:footnoteRef")}},D4=class extends S0{constructor(){super("w:endnoteRef")}},YZ=class extends S0{constructor(){super("w:separator")}},ZZ=class extends S0{constructor(){super("w:continuationSeparator")}},QZ=class extends S0{constructor(){super("w:pgNum")}},JZ=class extends S0{constructor(){super("w:cr")}},T4=class extends S0{constructor(){super("w:tab")}},KZ=class extends S0{constructor(){super("w:lastRenderedPageBreak")}},VZ={LEFT:"left",CENTER:"center",RIGHT:"right"},XZ={MARGIN:"margin",INDENT:"indent"},qZ={NONE:"none",DOT:"dot",HYPHEN:"hyphen",UNDERSCORE:"underscore",MIDDLE_DOT:"middleDot"},MZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{alignment:"w:alignment",relativeTo:"w:relativeTo",leader:"w:leader"})}},RZ=class extends t{constructor(B){super("w:ptab");this.root.push(new MZ({alignment:B.alignment,relativeTo:B.relativeTo,leader:B.leader}))}},C4={COLUMN:"column",PAGE:"page"},k4=class extends t{constructor(B){super("w:br");this.root.push(new C0({type:B}))}},LZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.PAGE))}},IZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.COLUMN))}},$4=class extends t{constructor(){super("w:pageBreakBefore")}},k2={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},S4=({after:B,before:U,line:G,lineRule:Y,beforeAutoSpacing:Q,afterAutoSpacing:K})=>new M0({name:"w:spacing",attributes:{after:{key:"w:after",value:B},before:{key:"w:before",value:U},line:{key:"w:line",value:G},lineRule:{key:"w:lineRule",value:Y},beforeAutoSpacing:{key:"w:beforeAutospacing",value:Q},afterAutoSpacing:{key:"w:afterAutospacing",value:K}}}),OZ={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},x2=(B)=>new M0({name:"w:pStyle",attributes:{val:{key:"w:val",value:B}}}),w8={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},HZ={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},FZ={MAX:9026},b4=({type:B,position:U,leader:G})=>new M0({name:"w:tab",attributes:{val:{key:"w:val",value:B},pos:{key:"w:pos",value:U},leader:{key:"w:leader",value:G}}}),v4=(B)=>new M0({name:"w:tabs",children:B.map((U)=>b4(U))}),C1=class extends t{constructor(B,U){super("w:numPr");this.root.push(new WZ(U)),this.root.push(new PZ(B))}},WZ=class extends t{constructor(B){super("w:ilvl");if(B>9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new C0({val:B}))}},PZ=class extends t{constructor(B){super("w:numId");this.root.push(new C0({val:typeof B==="string"?`{${B}}`:B}))}},H1=class extends t{constructor(...B){super(...B);e(this,"fileChild",Symbol())}},AZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},jZ={INTERNAL:"INTERNAL",EXTERNAL:"EXTERNAL"},m2=class extends t{constructor(B,U,G){super("w:hyperlink");e(this,"linkId",void 0),this.linkId=U;let Y=new AZ({history:1,anchor:G?G:void 0,id:!G?`rId${this.linkId}`:void 0});this.root.push(Y),B.forEach((Q)=>{this.root.push(Q)})}},y4=class extends m2{constructor(B){super(B.children,O1(),B.anchor)}},t8=class extends t{constructor(B){super("w:externalHyperlink");e(this,"options",void 0),this.options=B}},NZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",name:"w:name"})}},wZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},g4=class{constructor(B){e(this,"bookmarkUniqueNumericId",tB()),e(this,"start",void 0),e(this,"children",void 0),e(this,"end",void 0);let U=this.bookmarkUniqueNumericId();this.start=new f4(B.id,U),this.children=B.children,this.end=new x4(U)}},f4=class extends t{constructor(B,U){super("w:bookmarkStart");let G=new NZ({name:B,id:U});this.root.push(G)}},x4=class extends t{constructor(B){super("w:bookmarkEnd");let U=new wZ({id:B});this.root.push(U)}},zZ=function(B){return B.NONE="none",B.RELATIVE="relative",B.NO_CONTEXT="no_context",B.FULL_CONTEXT="full_context",B}({}),EZ={["relative"]:"\\r",["no_context"]:"\\n",["full_context"]:"\\w",["none"]:void 0},DZ=class extends s8{constructor(B,U,G={}){let{hyperlink:Y=!0,referenceFormat:Q="full_context"}=G,K=`${`REF ${B}`} ${[...Y?["\\h"]:[],...[EZ[Q]].filter((Z)=>!!Z)].join(" ")}`;super(K,U)}},_4=(B)=>new M0({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:B}}}),TZ=class extends t{constructor(B,U={}){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE}));let G=`PAGEREF ${B}`;if(U.hyperlink)G=`${G} \\h`;if(U.useRelativePosition)G=`${G} \\p`;this.root.push(G)}},CZ=class extends D0{constructor(B,U={}){super({children:[e0(!0),new TZ(B,U),B2()]})}},kZ={ANSI:"00",DEFAULT:"01",SYMBOL:"02",MAC:"4D",JIS:"80",HANGUL:"81",JOHAB:"82",GB_2312:"86",CHINESEBIG5:"88",GREEK:"A1",TURKISH:"A2",VIETNAMESE:"A3",HEBREW:"B1",ARABIC:"B2",BALTIC:"BA",RUSSIAN:"CC",THAI:"DE",EASTEUROPE:"EE",OEM:"FF"},E1=({id:B,fontKey:U,subsetted:G},Y)=>new M0({name:Y,attributes:L0({id:{key:"r:id",value:B}},U?{fontKey:{key:"w:fontKey",value:`{${U}}`}}:{}),children:[...G?[new q0("w:subsetted",G)]:[]]}),$Z=({name:B,altName:U,panose1:G,charset:Y,family:Q,notTrueType:K,pitch:Z,sig:J,embedRegular:q,embedBold:W,embedItalic:I,embedBoldItalic:H})=>new M0({name:"w:font",attributes:{name:{key:"w:name",value:B}},children:[...U?[f2("w:altName",U)]:[],...G?[f2("w:panose1",G)]:[],...Y?[f2("w:charset",Y)]:[],...Q?[f2("w:family",Q)]:[],...K?[new q0("w:notTrueType",K)]:[],...Z?[f2("w:pitch",Z)]:[],...J?[new M0({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:J.usb0},usb1:{key:"w:usb1",value:J.usb1},usb2:{key:"w:usb2",value:J.usb2},usb3:{key:"w:usb3",value:J.usb3},csb0:{key:"w:csb0",value:J.csb0},csb1:{key:"w:csb1",value:J.csb1}}})]:[],...q?[E1(q,"w:embedRegular")]:[],...W?[E1(W,"w:embedBold")]:[],...I?[E1(I,"w:embedItalic")]:[],...H?[E1(H,"w:embedBoldItalic")]:[]]}),SZ=({name:B,index:U,fontKey:G,characterSet:Y})=>$Z({name:B,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:Y,family:"auto",pitch:"variable",embedRegular:{fontKey:G,id:`rId${U}`}}),bZ=(B)=>new M0({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:B.map((U,G)=>SZ({name:U.name,index:G+1,fontKey:U.fontKey,characterSet:U.characterSet}))}),h4=class{constructor(B){e(this,"options",void 0),e(this,"fontTable",void 0),e(this,"relationships",void 0),e(this,"fontOptionsWithKey",[]),this.options=B,this.fontOptionsWithKey=B.map((U)=>L0(L0({},U),{},{fontKey:eB()})),this.fontTable=bZ(this.fontOptionsWithKey),this.relationships=new A2;for(let U=0;Unew M0({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),yZ={NONE:"none",DROP:"drop",MARGIN:"margin"},gZ={MARGIN:"margin",PAGE:"page",TEXT:"text"},fZ={AROUND:"around",AUTO:"auto",NONE:"none",NOT_BESIDE:"notBeside",THROUGH:"through",TIGHT:"tight"},u4=(B)=>{var U,G;return new M0({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:B.anchorLock},dropCap:{key:"w:dropCap",value:B.dropCap},width:{key:"w:w",value:B.width},height:{key:"w:h",value:B.height},x:{key:"w:x",value:B.position?B.position.x:void 0},y:{key:"w:y",value:B.position?B.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:B.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:B.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(U=B.space)===null||U===void 0?void 0:U.horizontal},spaceVertical:{key:"w:vSpace",value:(G=B.space)===null||G===void 0?void 0:G.vertical},rule:{key:"w:hRule",value:B.rule},alignmentX:{key:"w:xAlign",value:B.alignment?B.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:B.alignment?B.alignment.y:void 0},lines:{key:"w:lines",value:B.lines},wrap:{key:"w:wrap",value:B.wrap}}})},M2=class extends R2{constructor(B){super("w:pPr",B===null||B===void 0?void 0:B.includeIfEmpty);if(e(this,"numberingReferences",[]),!B)return this;if(B.heading)this.push(x2(B.heading));if(B.bullet)this.push(x2("ListParagraph"));if(B.numbering){if(!B.style&&!B.heading){if(!B.numbering.custom)this.push(x2("ListParagraph"))}}if(B.style)this.push(x2(B.style));if(B.keepNext!==void 0)this.push(new q0("w:keepNext",B.keepNext));if(B.keepLines!==void 0)this.push(new q0("w:keepLines",B.keepLines));if(B.pageBreakBefore)this.push(new $4);if(B.frame)this.push(u4(B.frame));if(B.widowControl!==void 0)this.push(new q0("w:widowControl",B.widowControl));if(B.bullet)this.push(new C1(1,B.bullet.level));if(B.numbering){var U,G;this.numberingReferences.push({reference:B.numbering.reference,instance:(U=B.numbering.instance)!==null&&U!==void 0?U:0}),this.push(new C1(`${B.numbering.reference}-${(G=B.numbering.instance)!==null&&G!==void 0?G:0}`,B.numbering.level))}else if(B.numbering===!1)this.push(new C1(0,0));if(B.border)this.push(new xB(B.border));if(B.thematicBreak)this.push(new _B);if(B.shading)this.push(M1(B.shading));if(B.wordWrap)this.push(vZ());if(B.overflowPunctuation)this.push(new q0("w:overflowPunct",B.overflowPunctuation));let Y=[...B.rightTabStop!==void 0?[{type:w8.RIGHT,position:B.rightTabStop}]:[],...B.tabStops?B.tabStops:[],...B.leftTabStop!==void 0?[{type:w8.LEFT,position:B.leftTabStop}]:[]];if(Y.length>0)this.push(v4(Y));if(B.bidirectional!==void 0)this.push(new q0("w:bidi",B.bidirectional));if(B.spacing)this.push(S4(B.spacing));if(B.indent)this.push(hB(B.indent));if(B.contextualSpacing!==void 0)this.push(new q0("w:contextualSpacing",B.contextualSpacing));if(B.alignment)this.push(m8(B.alignment));if(B.outlineLevel!==void 0)this.push(_4(B.outlineLevel));if(B.suppressLineNumbers!==void 0)this.push(new q0("w:suppressLineNumbers",B.suppressLineNumbers));if(B.autoSpaceEastAsianText!==void 0)this.push(new q0("w:autoSpaceDN",B.autoSpaceEastAsianText));if(B.run)this.push(new mB(B.run));if(B.revision)this.push(new d4(B.revision))}push(B){this.root.push(B)}prepForXml(B){if(!(B.viewWrapper instanceof h4))for(let U of this.numberingReferences)B.file.Numbering.createConcreteNumberingInstance(U.reference,U.instance);return super.prepForXml(B)}},d4=class extends t{constructor(B){super("w:pPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new M2(L0(L0({},B),{},{includeIfEmpty:!0})))}},d0=class extends H1{constructor(B){super("w:p");if(e(this,"properties",void 0),typeof B==="string")return this.properties=new M2({}),this.root.push(this.properties),this.root.push(new Q1(B)),this;if(this.properties=new M2(B),this.root.push(this.properties),B.text)this.root.push(new Q1(B.text));if(B.children)for(let U of B.children){if(U instanceof g4){this.root.push(U.start);for(let G of U.children)this.root.push(G);this.root.push(U.end);continue}this.root.push(U)}}prepForXml(B){for(let U of this.root)if(U instanceof t8){let G=this.root.indexOf(U),Y=new m2(U.options.children,O1());B.viewWrapper.Relationships.addRelationship(Y.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",U.options.link,N4.EXTERNAL),this.root[G]=Y}return super.prepForXml(B)}addRunToFront(B){return this.root.splice(1,0,B),this}},xZ=class extends t{constructor(B){super("m:oMath");for(let U of B.children)this.root.push(U)}},_Z=class extends t{constructor(B){super("m:t");this.root.push(B)}},hZ=class extends t{constructor(B){super("m:r");this.root.push(new _Z(B))}},c4=class extends t{constructor(B){super("m:den");for(let U of B)this.root.push(U)}},m4=class extends t{constructor(B){super("m:num");for(let U of B)this.root.push(U)}},uZ=class extends t{constructor(B){super("m:f");this.root.push(new m4(B.numerator)),this.root.push(new c4(B.denominator))}},l4=({accent:B})=>new M0({name:"m:chr",attributes:{accent:{key:"m:val",value:B}}}),y0=({children:B})=>new M0({name:"m:e",children:B}),a4=({value:B})=>new M0({name:"m:limLoc",attributes:{value:{key:"m:val",value:B||"undOvr"}}}),dZ=()=>new M0({name:"m:subHide",attributes:{hide:{key:"m:val",value:1}}}),cZ=()=>new M0({name:"m:supHide",attributes:{hide:{key:"m:val",value:1}}}),e8=({accent:B,hasSuperScript:U,hasSubScript:G,limitLocationVal:Y})=>new M0({name:"m:naryPr",children:[...B?[l4({accent:B})]:[],a4({value:Y}),...!U?[cZ()]:[],...!G?[dZ()]:[]]}),l2=({children:B})=>new M0({name:"m:sub",children:B}),a2=({children:B})=>new M0({name:"m:sup",children:B}),mZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"∑",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},lZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript,limitLocationVal:"subSup"})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},B6=class extends t{constructor(B){super("m:lim");for(let U of B)this.root.push(U)}},aZ=class extends t{constructor(B){super("m:limUpp");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},pZ=class extends t{constructor(B){super("m:limLow");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},p4=()=>new M0({name:"m:sSupPr"}),rZ=class extends t{constructor(B){super("m:sSup");this.root.push(p4()),this.root.push(y0({children:B.children})),this.root.push(a2({children:B.superScript}))}},r4=()=>new M0({name:"m:sSubPr"}),iZ=class extends t{constructor(B){super("m:sSub");this.root.push(r4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript}))}},i4=()=>new M0({name:"m:sSubSupPr"}),nZ=class extends t{constructor(B){super("m:sSubSup");this.root.push(i4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript})),this.root.push(a2({children:B.superScript}))}},n4=()=>new M0({name:"m:sPrePr"}),sZ=class extends M0{constructor({children:B,subScript:U,superScript:G}){super({name:"m:sPre",children:[n4(),y0({children:B}),l2({children:U}),a2({children:G})]})}},oZ="",s4=class extends t{constructor(B){super("m:deg");if(B)for(let U of B)this.root.push(U)}},tZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{hide:"m:val"})}},eZ=class extends t{constructor(){super("m:degHide");this.root.push(new tZ({hide:1}))}},o4=class extends t{constructor(B){super("m:radPr");if(!B)this.root.push(new eZ)}},BQ=class extends t{constructor(B){super("m:rad");this.root.push(new o4(!!B.degree)),this.root.push(new s4(B.degree)),this.root.push(y0({children:B.children}))}},t4=class extends t{constructor(B){super("m:fName");for(let U of B)this.root.push(U)}},e4=class extends t{constructor(){super("m:funcPr")}},UQ=class extends t{constructor(B){super("m:func");this.root.push(new e4),this.root.push(new t4(B.name)),this.root.push(y0({children:B.children}))}},GQ=({character:B})=>new M0({name:"m:begChr",attributes:{character:{key:"m:val",value:B}}}),YQ=({character:B})=>new M0({name:"m:endChr",attributes:{character:{key:"m:val",value:B}}}),l1=({characters:B})=>new M0({name:"m:dPr",children:B?[GQ({character:B.beginningCharacter}),YQ({character:B.endingCharacter})]:[]}),ZQ=class extends t{constructor(B){super("m:d");this.root.push(l1({})),this.root.push(y0({children:B.children}))}},QQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"[",endingCharacter:"]"}})),this.root.push(y0({children:B.children}))}},JQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"{",endingCharacter:"}"}})),this.root.push(y0({children:B.children}))}},KQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"〈",endingCharacter:"〉"}})),this.root.push(y0({children:B.children}))}},VQ=(B)=>new M0({name:"w:gridCol",attributes:B!==void 0?{width:{key:"w:w",value:E0(B)}}:void 0}),B9=class extends t{constructor(B,U){super("w:tblGrid");for(let G of B)this.root.push(VQ(G));if(U)this.root.push(new qQ(U))}},XQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},qQ=class extends t{constructor(B){super("w:tblGridChange");this.root.push(new XQ({id:B.id})),this.root.push(new B9(B.columnWidths))}},MQ=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new Q1(B))}},RQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},LQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},IQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},p6=class extends t{constructor(B){super("w:delText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B)}},OQ=class extends t{constructor(B){super("w:del");e(this,"deletedTextRunWrapper",void 0),this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.deletedTextRunWrapper=new HQ(B),this.addChildElement(this.deletedTextRunWrapper)}},HQ=class extends t{constructor(B){super("w:r");if(this.root.push(new U2(B)),B.children)for(let U of B.children){if(typeof U==="string"){switch(U){case F2.CURRENT:this.root.push(e0()),this.root.push(new RQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES:this.root.push(e0()),this.root.push(new LQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES_IN_SECTION:this.root.push(e0()),this.root.push(new IQ),this.root.push(X2()),this.root.push(B2());break;default:this.root.push(new p6(U));break}continue}this.root.push(U)}else if(B.text)this.root.push(new p6(B.text));if(B.break)for(let U=0;Unew M0({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:B}}}),X9=({marginUnitType:B=v1.DXA,top:U,left:G,bottom:Y,right:Q})=>[{name:"w:top",size:U},{name:"w:left",size:G},{name:"w:bottom",size:Y},{name:"w:right",size:Q}].filter((K)=>K.size!==void 0).map(({name:K,size:Z})=>J1(K,{type:B,size:Z})),PQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tblCellMar",children:U})},AQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tcMar",children:U})},v1={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},J1=(B,{type:U=v1.AUTO,size:G})=>{let Y=G;if(U===v1.PERCENTAGE&&typeof G==="number")Y=`${G}%`;return new M0({name:B,attributes:{type:{key:"w:type",value:U},size:{key:"w:w",value:c8(Y)}}})},q9=class extends R2{constructor(B){super("w:tcBorders");if(B.top)this.root.push(j0("w:top",B.top));if(B.start)this.root.push(j0("w:start",B.start));if(B.left)this.root.push(j0("w:left",B.left));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.end)this.root.push(j0("w:end",B.end));if(B.right)this.root.push(j0("w:right",B.right))}},jQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},M9=class extends t{constructor(B){super("w:gridSpan");this.root.push(new jQ({val:T0(B)}))}},G6={CONTINUE:"continue",RESTART:"restart"},NQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},z8=class extends t{constructor(B){super("w:vMerge");this.root.push(new NQ({val:B}))}},wQ={BOTTOM_TO_TOP_LEFT_TO_RIGHT:"btLr",LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},zQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},R9=class extends t{constructor(B){super("w:textDirection");this.root.push(new zQ({val:B}))}},L9=class extends R2{constructor(B){super("w:tcPr",B.includeIfEmpty);if(B.width)this.root.push(J1("w:tcW",B.width));if(B.columnSpan)this.root.push(new M9(B.columnSpan));if(B.verticalMerge)this.root.push(new z8(B.verticalMerge));else if(B.rowSpan&&B.rowSpan>1)this.root.push(new z8(G6.RESTART));if(B.borders)this.root.push(new q9(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.margins){let U=AQ(B.margins);if(U)this.root.push(U)}if(B.textDirection)this.root.push(new R9(B.textDirection));if(B.verticalAlign)this.root.push(U6(B.verticalAlign));if(B.insertion)this.root.push(new Y9(B.insertion));if(B.deletion)this.root.push(new Z9(B.deletion));if(B.revision)this.root.push(new EQ(B.revision));if(B.cellMerge)this.root.push(new J9(B.cellMerge))}},EQ=class extends t{constructor(B){super("w:tcPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new L9(L0(L0({},B),{},{includeIfEmpty:!0})))}},Y6=class extends t{constructor(B){super("w:tc");e(this,"options",void 0),this.options=B,this.root.push(new L9(B));for(let U of B.children)this.root.push(U)}prepForXml(B){if(!(this.root[this.root.length-1]instanceof d0))this.root.push(new d0({}));return super.prepForXml(B)}},v2={style:c1.NONE,size:0,color:"auto"},y2={style:c1.SINGLE,size:4,color:"auto"},Z6=class extends t{constructor(B){var U,G,Y,Q,K,Z;super("w:tblBorders");this.root.push(j0("w:top",(U=B.top)!==null&&U!==void 0?U:y2)),this.root.push(j0("w:left",(G=B.left)!==null&&G!==void 0?G:y2)),this.root.push(j0("w:bottom",(Y=B.bottom)!==null&&Y!==void 0?Y:y2)),this.root.push(j0("w:right",(Q=B.right)!==null&&Q!==void 0?Q:y2)),this.root.push(j0("w:insideH",(K=B.insideHorizontal)!==null&&K!==void 0?K:y2)),this.root.push(j0("w:insideV",(Z=B.insideVertical)!==null&&Z!==void 0?Z:y2))}};e(Z6,"NONE",{top:v2,bottom:v2,left:v2,right:v2,insideHorizontal:v2,insideVertical:v2});var DQ={MARGIN:"margin",PAGE:"page",TEXT:"text"},TQ={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},CQ={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},kQ={NEVER:"never",OVERLAP:"overlap"},$Q=(B)=>new M0({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:B}}}),I9=({horizontalAnchor:B,verticalAnchor:U,absoluteHorizontalPosition:G,relativeHorizontalPosition:Y,absoluteVerticalPosition:Q,relativeVerticalPosition:K,bottomFromText:Z,topFromText:J,leftFromText:q,rightFromText:W,overlap:I})=>new M0({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:q===void 0?void 0:E0(q)},rightFromText:{key:"w:rightFromText",value:W===void 0?void 0:E0(W)},topFromText:{key:"w:topFromText",value:J===void 0?void 0:E0(J)},bottomFromText:{key:"w:bottomFromText",value:Z===void 0?void 0:E0(Z)},absoluteHorizontalPosition:{key:"w:tblpX",value:G===void 0?void 0:t0(G)},absoluteVerticalPosition:{key:"w:tblpY",value:Q===void 0?void 0:t0(Q)},horizontalAnchor:{key:"w:horzAnchor",value:B},relativeHorizontalPosition:{key:"w:tblpXSpec",value:Y},relativeVerticalPosition:{key:"w:tblpYSpec",value:K},verticalAnchor:{key:"w:vertAnchor",value:U}},children:I?[$Q(I)]:void 0}),SQ={AUTOFIT:"autofit",FIXED:"fixed"},O9=(B)=>new M0({name:"w:tblLayout",attributes:{type:{key:"w:type",value:B}}}),bQ={DXA:"dxa",NIL:"nil"},H9=({type:B=bQ.DXA,value:U})=>new M0({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:B},value:{key:"w:w",value:c8(U)}}}),F9=({firstRow:B,lastRow:U,firstColumn:G,lastColumn:Y,noHBand:Q,noVBand:K})=>new M0({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:B},lastRow:{key:"w:lastRow",value:U},firstColumn:{key:"w:firstColumn",value:G},lastColumn:{key:"w:lastColumn",value:Y},noHBand:{key:"w:noHBand",value:Q},noVBand:{key:"w:noVBand",value:K}}}),Q6=class extends R2{constructor(B){super("w:tblPr",B.includeIfEmpty);if(B.style)this.root.push(new q2("w:tblStyle",B.style));if(B.float)this.root.push(I9(B.float));if(B.visuallyRightToLeft!==void 0)this.root.push(new q0("w:bidiVisual",B.visuallyRightToLeft));if(B.width)this.root.push(J1("w:tblW",B.width));if(B.alignment)this.root.push(m8(B.alignment));if(B.indent)this.root.push(J1("w:tblInd",B.indent));if(B.borders)this.root.push(new Z6(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.layout)this.root.push(O9(B.layout));if(B.cellMargin){let U=PQ(B.cellMargin);if(U)this.root.push(U)}if(B.tableLook)this.root.push(F9(B.tableLook));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.revision)this.root.push(new vQ(B.revision))}},vQ=class extends t{constructor(B){super("w:tblPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new Q6(L0(L0({},B),{},{includeIfEmpty:!0})))}},yQ=class extends H1{constructor({rows:B,width:U,columnWidths:G=Array(Math.max(...B.map((j)=>j.CellCount))).fill(100),columnWidthsRevision:Y,margins:Q,indent:K,float:Z,layout:J,style:q,borders:W,alignment:I,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P}){super("w:tbl");this.root.push(new Q6({borders:W!==null&&W!==void 0?W:{},width:U!==null&&U!==void 0?U:{size:100},indent:K,float:Z,layout:J,style:q,alignment:I,cellMargin:Q,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P})),this.root.push(new B9(G,Y));for(let j of B)this.root.push(j);B.forEach((j,E)=>{if(E===B.length-1)return;let C=0;j.cells.forEach((N)=>{if(N.options.rowSpan&&N.options.rowSpan>1){let v=new Y6({rowSpan:N.options.rowSpan-1,columnSpan:N.options.columnSpan,borders:N.options.borders,children:[],verticalMerge:G6.CONTINUE});B[E+1].addCellToColumnIndex(v,C)}C+=N.options.columnSpan||1})})}},gQ={AUTO:"auto",ATLEAST:"atLeast",EXACT:"exact"},W9=(B,U)=>new M0({name:"w:trHeight",attributes:{value:{key:"w:val",value:E0(B)},rule:{key:"w:hRule",value:U}}}),J6=class extends R2{constructor(B){super("w:trPr",B.includeIfEmpty);if(B.cantSplit!==void 0)this.root.push(new q0("w:cantSplit",B.cantSplit));if(B.tableHeader!==void 0)this.root.push(new q0("w:tblHeader",B.tableHeader));if(B.height)this.root.push(W9(B.height.value,B.height.rule));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.insertion)this.root.push(new U9(B.insertion));if(B.deletion)this.root.push(new G9(B.deletion));if(B.revision)this.root.push(new P9(B.revision))}},P9=class extends t{constructor(B){super("w:trPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new J6(L0(L0({},B),{},{includeIfEmpty:!0})))}},fQ=class extends t{constructor(B){super("w:tr");e(this,"options",void 0),this.options=B,this.root.push(new J6(B));for(let U of B.children)this.root.push(U)}get CellCount(){return this.options.children.length}get cells(){return this.root.filter((B)=>B instanceof Y6)}addCellToIndex(B,U){this.root.splice(U+1,0,B)}addCellToColumnIndex(B,U){let G=this.columnIndexToRootIndex(U,!0);this.addCellToIndex(B,G-1)}rootIndexToColumnIndex(B){if(B<1||B>=this.root.length)throw Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let U=0;for(let G=1;G=this.root.length)if(U)return this.root.length;else throw Error(`cell 'columnIndex' should not great than ${G-1}`);let Q=this.root[Y];Y+=1,G+=Q&&Q.options.columnSpan||1}return Y-1}},xQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},_Q=class extends t{constructor(){super("Properties");this.root.push(new xQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},hQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},V2=(B,U)=>new M0({name:"Default",attributes:{contentType:{key:"ContentType",value:B},extension:{key:"Extension",value:U}}}),f0=(B,U)=>new M0({name:"Override",attributes:{contentType:{key:"ContentType",value:B},partName:{key:"PartName",value:U}}}),uQ=class extends t{constructor(){super("Types");this.root.push(new hQ({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(V2("image/png","png")),this.root.push(V2("image/jpeg","jpeg")),this.root.push(V2("image/jpeg","jpg")),this.root.push(V2("image/bmp","bmp")),this.root.push(V2("image/gif","gif")),this.root.push(V2("image/svg+xml","svg")),this.root.push(V2("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(V2("application/xml","xml")),this.root.push(V2("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(f0("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addCommentsExtended(){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addFooter(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${B}.xml`))}addHeader(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${B}.xml`))}},y1={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},F1=class extends H0{constructor(B,U){super(L0({Ignorable:U},Object.fromEntries(B.map((G)=>[G,y1[G]]))));e(this,"xmlKeys",L0({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(y1).map((G)=>[G,`xmlns:${G}`]))))}},dQ=class extends t{constructor(B){super("cp:coreProperties");if(this.root.push(new F1(["cp","dc","dcterms","dcmitype","xsi"])),B.title)this.root.push(new O2("dc:title",B.title));if(B.subject)this.root.push(new O2("dc:subject",B.subject));if(B.creator)this.root.push(new O2("dc:creator",B.creator));if(B.keywords)this.root.push(new O2("cp:keywords",B.keywords));if(B.description)this.root.push(new O2("dc:description",B.description));if(B.lastModifiedBy)this.root.push(new O2("cp:lastModifiedBy",B.lastModifiedBy));if(B.revision)this.root.push(new O2("cp:revision",String(B.revision)));this.root.push(new r6("dcterms:created")),this.root.push(new r6("dcterms:modified"))}},cQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"xsi:type"})}},r6=class extends t{constructor(B){super(B);this.root.push(new cQ({type:"dcterms:W3CDTF"})),this.root.push(fB(new Date))}},mQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},lQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},aQ=class extends t{constructor(B,U){super("property");this.root.push(new lQ({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:B.toString(),name:U.name})),this.root.push(new pQ(U.value))}},pQ=class extends t{constructor(B){super("vt:lpwstr");this.root.push(B)}},rQ=class extends t{constructor(B){super("Properties");e(this,"nextId",void 0),e(this,"properties",[]),this.root.push(new mQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let U of B)this.addCustomProperty(U)}prepForXml(B){return this.properties.forEach((U)=>this.root.push(U)),super.prepForXml(B)}addCustomProperty(B){this.properties.push(new aQ(this.nextId++,B))}},A9=({space:B,count:U,separate:G,equalWidth:Y,children:Q})=>new M0({name:"w:cols",attributes:{space:{key:"w:space",value:B===void 0?void 0:E0(B)},count:{key:"w:num",value:U===void 0?void 0:T0(U)},separate:{key:"w:sep",value:G},equalWidth:{key:"w:equalWidth",value:Y}},children:!Y&&Q?Q:void 0}),iQ={DEFAULT:"default",LINES:"lines",LINES_AND_CHARS:"linesAndChars",SNAP_TO_CHARS:"snapToChars"},j9=({type:B,linePitch:U,charSpace:G})=>new M0({name:"w:docGrid",attributes:{type:{key:"w:type",value:B},linePitch:{key:"w:linePitch",value:T0(U)},charSpace:{key:"w:charSpace",value:G?T0(G):void 0}}}),T2={DEFAULT:"default",FIRST:"first",EVEN:"even"},E8={HEADER:"w:headerReference",FOOTER:"w:footerReference"},k1=(B,U)=>new M0({name:B,attributes:{type:{key:"w:type",value:U.type||T2.DEFAULT},id:{key:"r:id",value:`rId${U.id}`}}}),nQ={NEW_PAGE:"newPage",NEW_SECTION:"newSection",CONTINUOUS:"continuous"},N9=({countBy:B,start:U,restart:G,distance:Y})=>new M0({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:B===void 0?void 0:T0(B)},start:{key:"w:start",value:U===void 0?void 0:T0(U)},restart:{key:"w:restart",value:G},distance:{key:"w:distance",value:Y===void 0?void 0:E0(Y)}}}),sQ={ALL_PAGES:"allPages",FIRST_PAGE:"firstPage",NOT_FIRST_PAGE:"notFirstPage"},oQ={PAGE:"page",TEXT:"text"},tQ={BACK:"back",FRONT:"front"},i6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},w9=class extends R2{constructor(B){super("w:pgBorders");if(!B)return this;if(B.pageBorders)this.root.push(new i6({display:B.pageBorders.display,offsetFrom:B.pageBorders.offsetFrom,zOrder:B.pageBorders.zOrder}));else this.root.push(new i6({}));if(B.pageBorderTop)this.root.push(j0("w:top",B.pageBorderTop));if(B.pageBorderLeft)this.root.push(j0("w:left",B.pageBorderLeft));if(B.pageBorderBottom)this.root.push(j0("w:bottom",B.pageBorderBottom));if(B.pageBorderRight)this.root.push(j0("w:right",B.pageBorderRight))}},z9=(B,U,G,Y,Q,K,Z)=>new M0({name:"w:pgMar",attributes:{top:{key:"w:top",value:t0(B)},right:{key:"w:right",value:E0(U)},bottom:{key:"w:bottom",value:t0(G)},left:{key:"w:left",value:E0(Y)},header:{key:"w:header",value:E0(Q)},footer:{key:"w:footer",value:E0(K)},gutter:{key:"w:gutter",value:E0(Z)}}}),eQ={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},E9=({start:B,formatType:U,separator:G})=>new M0({name:"w:pgNumType",attributes:{start:{key:"w:start",value:B===void 0?void 0:T0(B)},formatType:{key:"w:fmt",value:U},separator:{key:"w:chapSep",value:G}}}),g1={PORTRAIT:"portrait",LANDSCAPE:"landscape"},D9=({width:B,height:U,orientation:G,code:Y})=>{let Q=E0(B),K=E0(U);return new M0({name:"w:pgSz",attributes:{width:{key:"w:w",value:G===g1.LANDSCAPE?K:Q},height:{key:"w:h",value:G===g1.LANDSCAPE?Q:K},orientation:{key:"w:orient",value:G},code:{key:"w:code",value:Y}}})},BJ={LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},UJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},T9=class extends t{constructor(B){super("w:textDirection");this.root.push(new UJ({val:B}))}},GJ={NEXT_PAGE:"nextPage",NEXT_COLUMN:"nextColumn",CONTINUOUS:"continuous",EVEN_PAGE:"evenPage",ODD_PAGE:"oddPage"},C9=(B)=>new M0({name:"w:type",attributes:{val:{key:"w:val",value:B}}}),H2={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},$1={WIDTH:11906,HEIGHT:16838,ORIENTATION:g1.PORTRAIT},K6=class extends t{constructor({page:{size:{width:B=$1.WIDTH,height:U=$1.HEIGHT,orientation:G=$1.ORIENTATION,code:Y}={},margin:{top:Q=H2.TOP,right:K=H2.RIGHT,bottom:Z=H2.BOTTOM,left:J=H2.LEFT,header:q=H2.HEADER,footer:W=H2.FOOTER,gutter:I=H2.GUTTER}={},pageNumbers:H={},borders:T,textDirection:A}={},grid:{linePitch:P=360,charSpace:j,type:E}={},headerWrapperGroup:C={},footerWrapperGroup:N={},lineNumbers:v,titlePage:S,verticalAlign:F,column:M,type:$,revision:x}={}){super("w:sectPr");if(this.addHeaderFooterGroup(E8.HEADER,C),this.addHeaderFooterGroup(E8.FOOTER,N),$)this.root.push(C9($));if(this.root.push(D9({width:B,height:U,orientation:G,code:Y})),this.root.push(z9(Q,K,Z,J,q,W,I)),T)this.root.push(new w9(T));if(v)this.root.push(N9(v));if(this.root.push(E9(H)),M)this.root.push(A9(M));if(F)this.root.push(U6(F));if(S!==void 0)this.root.push(new q0("w:titlePg",S));if(A)this.root.push(new T9(A));if(x)this.root.push(new k9(x));this.root.push(j9({linePitch:P,charSpace:j,type:E}))}addHeaderFooterGroup(B,U){if(U.default)this.root.push(k1(B,{type:T2.DEFAULT,id:U.default.View.ReferenceId}));if(U.first)this.root.push(k1(B,{type:T2.FIRST,id:U.first.View.ReferenceId}));if(U.even)this.root.push(k1(B,{type:T2.EVEN,id:U.even.View.ReferenceId}))}},k9=class extends t{constructor(B){super("w:sectPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new K6(B))}},YJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{width:"w:w",space:"w:space"})}},ZJ=class extends t{constructor(B){super("w:col");this.root.push(new YJ({width:E0(B.width),space:B.space===void 0?void 0:E0(B.space)}))}},$9=class extends t{constructor(){super("w:body");e(this,"sections",[])}addSection(B){let U=this.sections.pop();this.root.push(this.createSectionParagraph(U)),this.sections.push(new K6(B))}prepForXml(B){if(this.sections.length===1)this.root.splice(0,1),this.root.push(this.sections.pop());return super.prepForXml(B)}push(B){this.root.push(B)}createSectionParagraph(B){let U=new d0({}),G=new M2({});return G.push(B),U.addChildElement(G),U}},S9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}},b9=class extends t{constructor(B){super("w:background");this.root.push(new S9({color:B.color===void 0?void 0:C2(B.color),themeColor:B.themeColor,themeShade:B.themeShade===void 0?void 0:W8(B.themeShade),themeTint:B.themeTint===void 0?void 0:W8(B.themeTint)}))}},QJ=class extends t{constructor(B){super("w:document");if(e(this,"body",void 0),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new $9,B.background)this.root.push(new b9(B.background));this.root.push(this.body)}add(B){return this.body.push(B),this}get Body(){return this.body}},JJ=class{constructor(B){e(this,"document",void 0),e(this,"relationships",void 0),this.document=new QJ(B),this.relationships=new A2}get View(){return this.document}get Relationships(){return this.relationships}},KJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},VJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",id:"w:id"})}},XJ=class extends D0{constructor(){super({style:"EndnoteReference"});this.root.push(new D4)}},n6={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},X8=class extends t{constructor(B){super("w:endnote");this.root.push(new VJ({type:B.type,id:B.id}));for(let U=0;U9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new wJ({ilvl:T0(B),tentative:1}))}},h9=class extends X6{},$J=class extends X6{},SJ=class extends t{constructor(B){super("w:multiLevelType");this.root.push(new C0({val:B}))}},bJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},D8=class extends t{constructor(B,U){super("w:abstractNum");e(this,"id",void 0),this.root.push(new bJ({abstractNumId:T0(B),restartNumberingAfterBreak:0})),this.root.push(new SJ("hybridMultilevel")),this.id=B;for(let G of U)this.root.push(new h9(G))}},vJ=class extends t{constructor(B){super("w:abstractNumId");this.root.push(new C0({val:B}))}},yJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{numId:"w:numId"})}},T8=class extends t{constructor(B){super("w:num");if(e(this,"numId",void 0),e(this,"reference",void 0),e(this,"instance",void 0),this.numId=B.numId,this.reference=B.reference,this.instance=B.instance,this.root.push(new yJ({numId:T0(B.numId)})),this.root.push(new vJ(T0(B.abstractNumId))),B.overrideLevels&&B.overrideLevels.length)for(let U of B.overrideLevels)this.root.push(new u9(U.num,U.start))}},gJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{ilvl:"w:ilvl"})}},u9=class extends t{constructor(B,U){super("w:lvlOverride");if(this.root.push(new gJ({ilvl:B})),U!==void 0)this.root.push(new xJ(U))}},fJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},xJ=class extends t{constructor(B){super("w:startOverride");this.root.push(new fJ({val:B}))}},d9=class extends t{constructor(B){super("w:numbering");e(this,"abstractNumberingMap",new Map),e(this,"concreteNumberingMap",new Map),e(this,"referenceConfigMap",new Map),e(this,"abstractNumUniqueNumericId",nB()),e(this,"concreteNumUniqueNumericId",sB()),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let U=new D8(this.abstractNumUniqueNumericId(),[{level:0,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(0.5),hanging:u0(0.25)}}}},{level:1,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(1),hanging:u0(0.25)}}}},{level:2,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:2160,hanging:u0(0.25)}}}},{level:3,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:2880,hanging:u0(0.25)}}}},{level:4,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:3600,hanging:u0(0.25)}}}},{level:5,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:4320,hanging:u0(0.25)}}}},{level:6,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5040,hanging:u0(0.25)}}}},{level:7,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5760,hanging:u0(0.25)}}}},{level:8,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:6480,hanging:u0(0.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new T8({numId:1,abstractNumId:U.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",U);for(let G of B.config)this.abstractNumberingMap.set(G.reference,new D8(this.abstractNumUniqueNumericId(),G.levels)),this.referenceConfigMap.set(G.reference,G.levels)}prepForXml(B){for(let U of this.abstractNumberingMap.values())this.root.push(U);for(let U of this.concreteNumberingMap.values())this.root.push(U);return super.prepForXml(B)}createConcreteNumberingInstance(B,U){let G=this.abstractNumberingMap.get(B);if(!G)return;let Y=`${B}-${U}`;if(this.concreteNumberingMap.has(Y))return;let Q=this.referenceConfigMap.get(B),K=Q&&Q[0].start,Z={numId:this.concreteNumUniqueNumericId(),abstractNumId:G.id,reference:B,instance:U,overrideLevels:[typeof K==="number"&&Number.isInteger(K)?{num:0,start:K}:{num:0,start:1}]};this.concreteNumberingMap.set(Y,new T8(Z))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},_J=(B)=>new M0({name:"w:compatSetting",attributes:{version:{key:"w:val",value:B},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),hJ=class extends t{constructor(B){super("w:compat");if(B.version)this.root.push(_J(B.version));if(B.useSingleBorderforContiguousCells)this.root.push(new q0("w:useSingleBorderforContiguousCells",B.useSingleBorderforContiguousCells));if(B.wordPerfectJustification)this.root.push(new q0("w:wpJustification",B.wordPerfectJustification));if(B.noTabStopForHangingIndent)this.root.push(new q0("w:noTabHangInd",B.noTabStopForHangingIndent));if(B.noLeading)this.root.push(new q0("w:noLeading",B.noLeading));if(B.spaceForUnderline)this.root.push(new q0("w:spaceForUL",B.spaceForUnderline));if(B.noColumnBalance)this.root.push(new q0("w:noColumnBalance",B.noColumnBalance));if(B.balanceSingleByteDoubleByteWidth)this.root.push(new q0("w:balanceSingleByteDoubleByteWidth",B.balanceSingleByteDoubleByteWidth));if(B.noExtraLineSpacing)this.root.push(new q0("w:noExtraLineSpacing",B.noExtraLineSpacing));if(B.doNotLeaveBackslashAlone)this.root.push(new q0("w:doNotLeaveBackslashAlone",B.doNotLeaveBackslashAlone));if(B.underlineTrailingSpaces)this.root.push(new q0("w:ulTrailSpace",B.underlineTrailingSpaces));if(B.doNotExpandShiftReturn)this.root.push(new q0("w:doNotExpandShiftReturn",B.doNotExpandShiftReturn));if(B.spacingInWholePoints)this.root.push(new q0("w:spacingInWholePoints",B.spacingInWholePoints));if(B.lineWrapLikeWord6)this.root.push(new q0("w:lineWrapLikeWord6",B.lineWrapLikeWord6));if(B.printBodyTextBeforeHeader)this.root.push(new q0("w:printBodyTextBeforeHeader",B.printBodyTextBeforeHeader));if(B.printColorsBlack)this.root.push(new q0("w:printColBlack",B.printColorsBlack));if(B.spaceWidth)this.root.push(new q0("w:wpSpaceWidth",B.spaceWidth));if(B.showBreaksInFrames)this.root.push(new q0("w:showBreaksInFrames",B.showBreaksInFrames));if(B.subFontBySize)this.root.push(new q0("w:subFontBySize",B.subFontBySize));if(B.suppressBottomSpacing)this.root.push(new q0("w:suppressBottomSpacing",B.suppressBottomSpacing));if(B.suppressTopSpacing)this.root.push(new q0("w:suppressTopSpacing",B.suppressTopSpacing));if(B.suppressSpacingAtTopOfPage)this.root.push(new q0("w:suppressSpacingAtTopOfPage",B.suppressSpacingAtTopOfPage));if(B.suppressTopSpacingWP)this.root.push(new q0("w:suppressTopSpacingWP",B.suppressTopSpacingWP));if(B.suppressSpBfAfterPgBrk)this.root.push(new q0("w:suppressSpBfAfterPgBrk",B.suppressSpBfAfterPgBrk));if(B.swapBordersFacingPages)this.root.push(new q0("w:swapBordersFacingPages",B.swapBordersFacingPages));if(B.convertMailMergeEsc)this.root.push(new q0("w:convMailMergeEsc",B.convertMailMergeEsc));if(B.truncateFontHeightsLikeWP6)this.root.push(new q0("w:truncateFontHeightsLikeWP6",B.truncateFontHeightsLikeWP6));if(B.macWordSmallCaps)this.root.push(new q0("w:mwSmallCaps",B.macWordSmallCaps));if(B.usePrinterMetrics)this.root.push(new q0("w:usePrinterMetrics",B.usePrinterMetrics));if(B.doNotSuppressParagraphBorders)this.root.push(new q0("w:doNotSuppressParagraphBorders",B.doNotSuppressParagraphBorders));if(B.wrapTrailSpaces)this.root.push(new q0("w:wrapTrailSpaces",B.wrapTrailSpaces));if(B.footnoteLayoutLikeWW8)this.root.push(new q0("w:footnoteLayoutLikeWW8",B.footnoteLayoutLikeWW8));if(B.shapeLayoutLikeWW8)this.root.push(new q0("w:shapeLayoutLikeWW8",B.shapeLayoutLikeWW8));if(B.alignTablesRowByRow)this.root.push(new q0("w:alignTablesRowByRow",B.alignTablesRowByRow));if(B.forgetLastTabAlignment)this.root.push(new q0("w:forgetLastTabAlignment",B.forgetLastTabAlignment));if(B.adjustLineHeightInTable)this.root.push(new q0("w:adjustLineHeightInTable",B.adjustLineHeightInTable));if(B.autoSpaceLikeWord95)this.root.push(new q0("w:autoSpaceLikeWord95",B.autoSpaceLikeWord95));if(B.noSpaceRaiseLower)this.root.push(new q0("w:noSpaceRaiseLower",B.noSpaceRaiseLower));if(B.doNotUseHTMLParagraphAutoSpacing)this.root.push(new q0("w:doNotUseHTMLParagraphAutoSpacing",B.doNotUseHTMLParagraphAutoSpacing));if(B.layoutRawTableWidth)this.root.push(new q0("w:layoutRawTableWidth",B.layoutRawTableWidth));if(B.layoutTableRowsApart)this.root.push(new q0("w:layoutTableRowsApart",B.layoutTableRowsApart));if(B.useWord97LineBreakRules)this.root.push(new q0("w:useWord97LineBreakRules",B.useWord97LineBreakRules));if(B.doNotBreakWrappedTables)this.root.push(new q0("w:doNotBreakWrappedTables",B.doNotBreakWrappedTables));if(B.doNotSnapToGridInCell)this.root.push(new q0("w:doNotSnapToGridInCell",B.doNotSnapToGridInCell));if(B.selectFieldWithFirstOrLastCharacter)this.root.push(new q0("w:selectFldWithFirstOrLastChar",B.selectFieldWithFirstOrLastCharacter));if(B.applyBreakingRules)this.root.push(new q0("w:applyBreakingRules",B.applyBreakingRules));if(B.doNotWrapTextWithPunctuation)this.root.push(new q0("w:doNotWrapTextWithPunct",B.doNotWrapTextWithPunctuation));if(B.doNotUseEastAsianBreakRules)this.root.push(new q0("w:doNotUseEastAsianBreakRules",B.doNotUseEastAsianBreakRules));if(B.useWord2002TableStyleRules)this.root.push(new q0("w:useWord2002TableStyleRules",B.useWord2002TableStyleRules));if(B.growAutofit)this.root.push(new q0("w:growAutofit",B.growAutofit));if(B.useFELayout)this.root.push(new q0("w:useFELayout",B.useFELayout));if(B.useNormalStyleForList)this.root.push(new q0("w:useNormalStyleForList",B.useNormalStyleForList));if(B.doNotUseIndentAsNumberingTabStop)this.root.push(new q0("w:doNotUseIndentAsNumberingTabStop",B.doNotUseIndentAsNumberingTabStop));if(B.useAlternateEastAsianLineBreakRules)this.root.push(new q0("w:useAltKinsokuLineBreakRules",B.useAlternateEastAsianLineBreakRules));if(B.allowSpaceOfSameStyleInTable)this.root.push(new q0("w:allowSpaceOfSameStyleInTable",B.allowSpaceOfSameStyleInTable));if(B.doNotSuppressIndentation)this.root.push(new q0("w:doNotSuppressIndentation",B.doNotSuppressIndentation));if(B.doNotAutofitConstrainedTables)this.root.push(new q0("w:doNotAutofitConstrainedTables",B.doNotAutofitConstrainedTables));if(B.autofitToFirstFixedWidthCell)this.root.push(new q0("w:autofitToFirstFixedWidthCell",B.autofitToFirstFixedWidthCell));if(B.underlineTabInNumberingList)this.root.push(new q0("w:underlineTabInNumList",B.underlineTabInNumberingList));if(B.displayHangulFixedWidth)this.root.push(new q0("w:displayHangulFixedWidth",B.displayHangulFixedWidth));if(B.splitPgBreakAndParaMark)this.root.push(new q0("w:splitPgBreakAndParaMark",B.splitPgBreakAndParaMark));if(B.doNotVerticallyAlignCellWithSp)this.root.push(new q0("w:doNotVertAlignCellWithSp",B.doNotVerticallyAlignCellWithSp));if(B.doNotBreakConstrainedForcedTable)this.root.push(new q0("w:doNotBreakConstrainedForcedTable",B.doNotBreakConstrainedForcedTable));if(B.ignoreVerticalAlignmentInTextboxes)this.root.push(new q0("w:doNotVertAlignInTxbx",B.ignoreVerticalAlignmentInTextboxes));if(B.useAnsiKerningPairs)this.root.push(new q0("w:useAnsiKerningPairs",B.useAnsiKerningPairs));if(B.cachedColumnBalance)this.root.push(new q0("w:cachedColBalance",B.cachedColumnBalance))}},uJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},dJ=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w:settings");if(this.root.push(new uJ({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new q0("w:displayBackgroundShape",!0)),B.trackRevisions!==void 0)this.root.push(new q0("w:trackRevisions",B.trackRevisions));if(B.evenAndOddHeaders!==void 0)this.root.push(new q0("w:evenAndOddHeaders",B.evenAndOddHeaders));if(B.updateFields!==void 0)this.root.push(new q0("w:updateFields",B.updateFields));if(B.defaultTabStop!==void 0)this.root.push(new _2("w:defaultTabStop",B.defaultTabStop));if(((U=B.hyphenation)===null||U===void 0?void 0:U.autoHyphenation)!==void 0)this.root.push(new q0("w:autoHyphenation",B.hyphenation.autoHyphenation));if(((G=B.hyphenation)===null||G===void 0?void 0:G.hyphenationZone)!==void 0)this.root.push(new _2("w:hyphenationZone",B.hyphenation.hyphenationZone));if(((Y=B.hyphenation)===null||Y===void 0?void 0:Y.consecutiveHyphenLimit)!==void 0)this.root.push(new _2("w:consecutiveHyphenLimit",B.hyphenation.consecutiveHyphenLimit));if(((Q=B.hyphenation)===null||Q===void 0?void 0:Q.doNotHyphenateCaps)!==void 0)this.root.push(new q0("w:doNotHyphenateCaps",B.hyphenation.doNotHyphenateCaps));this.root.push(new hJ(L0(L0({},(K=B.compatibility)!==null&&K!==void 0?K:{}),{},{version:(Z=(J=(q=B.compatibility)===null||q===void 0?void 0:q.version)!==null&&J!==void 0?J:B.compatibilityModeVersion)!==null&&Z!==void 0?Z:15})))}},c9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},cJ=class extends t{constructor(B){super("w:name");this.root.push(new c9({val:B}))}},mJ=class extends t{constructor(B){super("w:uiPriority");this.root.push(new c9({val:T0(B)}))}},lJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},m9=class extends t{constructor(B,U){super("w:style");if(this.root.push(new lJ(B)),U.name)this.root.push(new cJ(U.name));if(U.basedOn)this.root.push(new q2("w:basedOn",U.basedOn));if(U.next)this.root.push(new q2("w:next",U.next));if(U.link)this.root.push(new q2("w:link",U.link));if(U.uiPriority!==void 0)this.root.push(new mJ(U.uiPriority));if(U.semiHidden!==void 0)this.root.push(new q0("w:semiHidden",U.semiHidden));if(U.unhideWhenUsed!==void 0)this.root.push(new q0("w:unhideWhenUsed",U.unhideWhenUsed));if(U.quickFormat!==void 0)this.root.push(new q0("w:qFormat",U.quickFormat))}},p2=class extends m9{constructor(B){super({type:"paragraph",styleId:B.id},B);e(this,"paragraphProperties",void 0),e(this,"runProperties",void 0),this.paragraphProperties=new M2(B.paragraph),this.runProperties=new U2(B.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},$2=class extends m9{constructor(B){super({type:"character",styleId:B.id},L0({uiPriority:99,unhideWhenUsed:!0},B));e(this,"runProperties",void 0),this.runProperties=new U2(B.run),this.root.push(this.runProperties)}},j2=class extends p2{constructor(B){super(L0({basedOn:"Normal",next:"Normal",quickFormat:!0},B))}},aJ=class extends j2{constructor(B){super(L0({id:"Title",name:"Title"},B))}},pJ=class extends j2{constructor(B){super(L0({id:"Heading1",name:"Heading 1"},B))}},rJ=class extends j2{constructor(B){super(L0({id:"Heading2",name:"Heading 2"},B))}},iJ=class extends j2{constructor(B){super(L0({id:"Heading3",name:"Heading 3"},B))}},nJ=class extends j2{constructor(B){super(L0({id:"Heading4",name:"Heading 4"},B))}},sJ=class extends j2{constructor(B){super(L0({id:"Heading5",name:"Heading 5"},B))}},oJ=class extends j2{constructor(B){super(L0({id:"Heading6",name:"Heading 6"},B))}},tJ=class extends j2{constructor(B){super(L0({id:"Strong",name:"Strong"},B))}},eJ=class extends p2{constructor(B){super(L0({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},B))}},BK=class extends p2{constructor(B){super(L0({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},UK=class extends $2{constructor(B){super(L0({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},GK=class extends $2{constructor(B){super(L0({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},B))}},YK=class extends p2{constructor(B){super(L0({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},ZK=class extends $2{constructor(B){super(L0({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},QK=class extends $2{constructor(B){super(L0({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},B))}},JK=class extends $2{constructor(B){super(L0({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:i8.SINGLE}}},B))}},S1=class extends t{constructor(B){super("w:styles");if(B.initialStyles)this.root.push(B.initialStyles);if(B.importedStyles)for(let U of B.importedStyles)this.root.push(U);if(B.paragraphStyles)for(let U of B.paragraphStyles)this.root.push(new p2(U));if(B.characterStyles)for(let U of B.characterStyles)this.root.push(new $2(U))}},l9=class extends t{constructor(B){super("w:pPrDefault");this.root.push(new M2(B))}},a9=class extends t{constructor(B){super("w:rPrDefault");this.root.push(new U2(B))}},p9=class extends t{constructor(B){super("w:docDefaults");e(this,"runPropertiesDefaults",void 0),e(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new a9(B.run),this.paragraphPropertiesDefaults=new l9(B.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},KK=class{newInstance(B){let U=(0,h1.xml2js)(B,{compact:!1}),G;for(let Q of U.elements||[])if(Q.name==="w:styles")G=Q;if(G===void 0)throw Error("can not find styles element");let Y=G.elements||[];return{initialStyles:new $B(G.attributes),importedStyles:Y.map((Q)=>u1(Q))}}},M8=class{newInstance(B={}){var U;return{initialStyles:new F1(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new p9((U=B.document)!==null&&U!==void 0?U:{}),new aJ(L0({run:{size:56}},B.title)),new pJ(L0({run:{color:"2E74B5",size:32}},B.heading1)),new rJ(L0({run:{color:"2E74B5",size:26}},B.heading2)),new iJ(L0({run:{color:"1F4D78",size:24}},B.heading3)),new nJ(L0({run:{color:"2E74B5",italics:!0}},B.heading4)),new sJ(L0({run:{color:"2E74B5"}},B.heading5)),new oJ(L0({run:{color:"1F4D78"}},B.heading6)),new tJ(L0({run:{bold:!0}},B.strong)),new eJ(B.listParagraph||{}),new JK(B.hyperlink||{}),new UK(B.footnoteReference||{}),new BK(B.footnoteText||{}),new GK(B.footnoteTextChar||{}),new ZK(B.endnoteReference||{}),new YK(B.endnoteText||{}),new QK(B.endnoteTextChar||{})]}}},VK=class{constructor(B){var U,G,Y,Q,K,Z,J,q,W,I,H,T;if(e(this,"currentRelationshipId",1),e(this,"documentWrapper",void 0),e(this,"headers",[]),e(this,"footers",[]),e(this,"coreProperties",void 0),e(this,"numbering",void 0),e(this,"media",void 0),e(this,"fileRelationships",void 0),e(this,"footnotesWrapper",void 0),e(this,"endnotesWrapper",void 0),e(this,"settings",void 0),e(this,"contentTypes",void 0),e(this,"customProperties",void 0),e(this,"appProperties",void 0),e(this,"styles",void 0),e(this,"comments",void 0),e(this,"commentsExtended",void 0),e(this,"fontWrapper",void 0),this.coreProperties=new dQ(L0(L0({},B),{},{creator:(U=B.creator)!==null&&U!==void 0?U:"Un-named",revision:(G=B.revision)!==null&&G!==void 0?G:1,lastModifiedBy:(Y=B.lastModifiedBy)!==null&&Y!==void 0?Y:"Un-named"})),this.numbering=new d9(B.numbering?B.numbering:{config:[]}),this.comments=new z4((Q=B.comments)!==null&&Q!==void 0?Q:{children:[]}),this.comments.ThreadData)this.commentsExtended=new E4(this.comments.ThreadData);if(this.fileRelationships=new A2,this.customProperties=new rQ((K=B.customProperties)!==null&&K!==void 0?K:[]),this.appProperties=new _Q,this.footnotesWrapper=new PJ,this.endnotesWrapper=new RJ,this.contentTypes=new uQ,this.documentWrapper=new JJ({background:B.background}),this.settings=new dJ({compatibilityModeVersion:B.compatabilityModeVersion,compatibility:B.compatibility,evenAndOddHeaders:B.evenAndOddHeaderAndFooters?!0:!1,trackRevisions:(Z=B.features)===null||Z===void 0?void 0:Z.trackRevisions,updateFields:(J=B.features)===null||J===void 0?void 0:J.updateFields,defaultTabStop:B.defaultTabStop,hyphenation:{autoHyphenation:(q=B.hyphenation)===null||q===void 0?void 0:q.autoHyphenation,hyphenationZone:(W=B.hyphenation)===null||W===void 0?void 0:W.hyphenationZone,consecutiveHyphenLimit:(I=B.hyphenation)===null||I===void 0?void 0:I.consecutiveHyphenLimit,doNotHyphenateCaps:(H=B.hyphenation)===null||H===void 0?void 0:H.doNotHyphenateCaps}}),this.media=new V6,B.externalStyles!==void 0){var A;let P=new M8().newInstance((A=B.styles)===null||A===void 0?void 0:A.default),j=new KK().newInstance(B.externalStyles);this.styles=new S1(L0(L0({},j),{},{importedStyles:[...P.importedStyles,...j.importedStyles]}))}else if(B.styles){let P=new M8().newInstance(B.styles.default);this.styles=new S1(L0(L0({},P),B.styles))}else{let P=new M8;this.styles=new S1(P.newInstance())}this.addDefaultRelationships();for(let P of B.sections)this.addSection(P);if(B.footnotes)for(let P in B.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(P),B.footnotes[P].children);if(B.endnotes)for(let P in B.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(P),B.endnotes[P].children);this.fontWrapper=new h4((T=B.fonts)!==null&&T!==void 0?T:[])}addSection({headers:B={},footers:U={},children:G,properties:Y}){this.documentWrapper.View.Body.addSection(L0(L0({},Y),{},{headerWrapperGroup:{default:B.default?this.createHeader(B.default):void 0,first:B.first?this.createHeader(B.first):void 0,even:B.even?this.createHeader(B.even):void 0},footerWrapperGroup:{default:U.default?this.createFooter(U.default):void 0,first:U.first?this.createFooter(U.first):void 0,even:U.even?this.createFooter(U.even):void 0}}));for(let Q of G)this.documentWrapper.View.add(Q)}createHeader(B){let U=new _9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addHeaderToDocument(U),U}createFooter(B){let U=new f9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addFooterToDocument(U),U}addHeaderToDocument(B,U=T2.DEFAULT){this.headers.push({header:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(B,U=T2.DEFAULT){this.footers.push({footer:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){if(this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.commentsExtended)this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map((B)=>B.header)}get Footers(){return this.footers.map((B)=>B.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get FontTable(){return this.fontWrapper}},XK=class extends t{constructor(B={}){super("w:instrText");e(this,"properties",void 0),this.properties=B,this.root.push(new _0({space:x0.PRESERVE}));let U="TOC";if(this.properties.captionLabel)U=`${U} \\a "${this.properties.captionLabel}"`;if(this.properties.entriesFromBookmark)U=`${U} \\b "${this.properties.entriesFromBookmark}"`;if(this.properties.captionLabelIncludingNumbers)U=`${U} \\c "${this.properties.captionLabelIncludingNumbers}"`;if(this.properties.sequenceAndPageNumbersSeparator)U=`${U} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`;if(this.properties.tcFieldIdentifier)U=`${U} \\f "${this.properties.tcFieldIdentifier}"`;if(this.properties.hyperlink)U=`${U} \\h`;if(this.properties.tcFieldLevelRange)U=`${U} \\l "${this.properties.tcFieldLevelRange}"`;if(this.properties.pageNumbersEntryLevelsRange)U=`${U} \\n "${this.properties.pageNumbersEntryLevelsRange}"`;if(this.properties.headingStyleRange)U=`${U} \\o "${this.properties.headingStyleRange}"`;if(this.properties.entryAndPageNumberSeparator)U=`${U} \\p "${this.properties.entryAndPageNumberSeparator}"`;if(this.properties.seqFieldIdentifierForPrefix)U=`${U} \\s "${this.properties.seqFieldIdentifierForPrefix}"`;if(this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let G=this.properties.stylesWithLevels.map((Y)=>`${Y.styleName},${Y.level}`).join(",");U=`${U} \\t "${G}"`}if(this.properties.useAppliedParagraphOutlineLevel)U=`${U} \\u`;if(this.properties.preserveTabInEntries)U=`${U} \\w`;if(this.properties.preserveNewLineInEntries)U=`${U} \\x`;if(this.properties.hideTabAndPageNumbersInWebView)U=`${U} \\z`;this.root.push(U)}},r9=class extends t{constructor(){super("w:sdtContent")}},i9=class extends t{constructor(B){super("w:sdtPr");if(B)this.root.push(new q2("w:alias",B))}};function qK(B,U){if(B==null)return{};var G={};for(var Y in B)if({}.hasOwnProperty.call(B,Y)){if(U.includes(Y))continue;G[Y]=B[Y]}return G}function n9(B,U){if(B==null)return{};var G,Y,Q=qK(B,U);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(B);for(Y=0;Y0){let{stylesWithLevels:W}=K,I=Y.map((T,A)=>{var P,j;let E=this.buildCachedContentParagraphChild(T,K),C=(P=W===null||W===void 0||(j=W.find((v)=>v.level===T.level))===null||j===void 0?void 0:j.styleName)!==null&&P!==void 0?P:`TOC${T.level}`,N=A===0?[...J,E]:A===Y.length-1?[E,...q]:[E];return new d0({style:C,tabStops:this.getTabStopsForLevel(T.level),children:N})}),H=I;if(Y.length<=1)H=[...I,new d0({children:q})];for(let T of H)Z.addChildElement(T)}else{let W=new d0({children:J});Z.addChildElement(W);for(let H of G)Z.addChildElement(H);let I=new d0({children:q});Z.addChildElement(I)}this.root.push(Z)}getTabStopsForLevel(B,U=9025){return[{type:"clear",position:U+1-(B-1)*240},{type:"right",position:U,leader:"dot"}]}buildCachedContentRun(B,U){var G,Y;return new D0({style:(U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0?"IndexLink":void 0,children:[new Z1({text:B.title}),new T4,new Z1({text:(G=(Y=B.page)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:""})]})}buildCachedContentParagraphChild(B,U){let G=this.buildCachedContentRun(B,U);if((U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0)return new y4({anchor:B.href,children:[G]});return G}},LK=class{constructor(B,U){e(this,"styleName",void 0),e(this,"level",void 0),this.styleName=B,this.level=U}},IK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},OK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},s9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},o9=class extends t{constructor(B){super("w:footnoteReference");this.root.push(new s9({id:B}))}},HK=class extends D0{constructor(B){super({style:"FootnoteReference"});this.root.push(new o9(B))}},t9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},e9=class extends t{constructor(B){super("w:endnoteReference");this.root.push(new t9({id:B}))}},FK=class extends D0{constructor(B){super({style:"EndnoteReference"});this.root.push(new e9(B))}},o6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w14:val",symbolfont:"w14:font"})}},b1=class extends t{constructor(B,U,G){super(B);if(G)this.root.push(new o6({val:SB(U),symbolfont:G}));else this.root.push(new o6({val:U}))}},B5=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w14:checkbox");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let W=(B===null||B===void 0?void 0:B.checked)?"1":"0",I,H;this.root.push(new b1("w14:checked",W)),I=(B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.value)?B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value:this.DEFAULT_CHECKED_SYMBOL,H=(B===null||B===void 0||(Y=B.checkedState)===null||Y===void 0?void 0:Y.font)?B===null||B===void 0||(Q=B.checkedState)===null||Q===void 0?void 0:Q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:checkedState",I,H)),I=(B===null||B===void 0||(K=B.uncheckedState)===null||K===void 0?void 0:K.value)?B===null||B===void 0||(Z=B.uncheckedState)===null||Z===void 0?void 0:Z.value:this.DEFAULT_UNCHECKED_SYMBOL,H=(B===null||B===void 0||(J=B.uncheckedState)===null||J===void 0?void 0:J.font)?B===null||B===void 0||(q=B.uncheckedState)===null||q===void 0?void 0:q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:uncheckedState",I,H))}},WK=class extends t{constructor(B){var U,G,Y,Q;super("w:sdt");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let K=new i9(B===null||B===void 0?void 0:B.alias);K.addChildElement(new B5(B)),this.root.push(K);let Z=new r9,J=B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.font,q=B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value,W=B===null||B===void 0||(Y=B.uncheckedState)===null||Y===void 0?void 0:Y.font,I=B===null||B===void 0||(Q=B.uncheckedState)===null||Q===void 0?void 0:Q.value,H,T;if(B===null||B===void 0?void 0:B.checked)H=J?J:this.DEFAULT_FONT,T=q?q:this.DEFAULT_CHECKED_SYMBOL;else H=W?W:this.DEFAULT_FONT,T=I?I:this.DEFAULT_UNCHECKED_SYMBOL;let A=new aB({char:T,symbolfont:H});Z.addChildElement(A),this.root.push(Z)}},PK=({shape:B})=>new M0({name:"w:pict",children:[B]}),AK=({children:B=[]})=>new M0({name:"w:txbxContent",children:B}),jK=({style:B,children:U,inset:G})=>new M0({name:"v:textbox",attributes:{style:{key:"style",value:B},insetMode:{key:"insetmode",value:G?"custom":"auto"},inset:{key:"inset",value:G?`${G.left}, ${G.top}, ${G.right}, ${G.bottom}`:void 0}},children:[AK({children:U})]}),NK="#_x0000_t202",wK={flip:"flip",height:"height",left:"left",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",positionHorizontal:"mso-position-horizontal",positionHorizontalRelative:"mso-position-horizontal-relative",positionVertical:"mso-position-vertical",positionVerticalRelative:"mso-position-vertical-relative",wrapDistanceBottom:"mso-wrap-distance-bottom",wrapDistanceLeft:"mso-wrap-distance-left",wrapDistanceRight:"mso-wrap-distance-right",wrapDistanceTop:"mso-wrap-distance-top",wrapEdited:"mso-wrap-edited",wrapStyle:"mso-wrap-style",position:"position",rotation:"rotation",top:"top",visibility:"visibility",width:"width",zIndex:"z-index"},zK=(B)=>B?Object.entries(B).map(([U,G])=>`${wK[U]}:${G}`).join(";"):void 0,EK=({id:B,children:U,type:G=NK,style:Y})=>new M0({name:"v:shape",attributes:{id:{key:"id",value:B},type:{key:"type",value:G},style:{key:"style",value:zK(Y)}},children:[jK({style:"mso-fit-shape-to-text:t;",children:U})]}),DK=["style","children"],TK=class extends H1{constructor(B){let{style:U,children:G}=B,Y=n9(B,DK);super("w:p");this.root.push(new M2(Y)),this.root.push(PK({shape:EK({children:G,id:O1(),style:U})}))}},CK=R0((B,U)=>{d2(),P2();/*! + `)+" "+o[1];return o[0]+n+" "+y.join(", ")+" "+o[1]}B.types=rU();function E(y){return Array.isArray(y)}B.isArray=E;function C(y){return typeof y==="boolean"}B.isBoolean=C;function N(y){return y===null}B.isNull=N;function v(y){return y==null}B.isNullOrUndefined=v;function S(y){return typeof y==="number"}B.isNumber=S;function F(y){return typeof y==="string"}B.isString=F;function M(y){return typeof y==="symbol"}B.isSymbol=M;function $(y){return y===void 0}B.isUndefined=$;function x(y){return z(y)&&D(y)==="[object RegExp]"}B.isRegExp=x,B.types.isRegExp=x;function z(y){return typeof y==="object"&&y!==null}B.isObject=z;function a(y){return z(y)&&D(y)==="[object Date]"}B.isDate=a,B.types.isDate=a;function U0(y){return z(y)&&(D(y)==="[object Error]"||y instanceof Error)}B.isError=U0,B.types.isNativeError=U0;function b(y){return typeof y==="function"}B.isFunction=b;function c(y){return y===null||typeof y==="boolean"||typeof y==="number"||typeof y==="string"||typeof y==="symbol"||typeof y>"u"}B.isPrimitive=c,B.isBuffer=iU();function D(y){return Object.prototype.toString.call(y)}function m(y){return y<10?"0"+y.toString(10):y.toString(10)}var B0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function i(){var y=new Date,n=[m(y.getHours()),m(y.getMinutes()),m(y.getSeconds())].join(":");return[y.getDate(),B0[y.getMonth()],n].join(" ")}B.log=function(){console.log("%s - %s",i(),B.format.apply(B,arguments))},B.inherits=W2(),B._extend=function(y,n){if(!n||!z(n))return y;var o=Object.keys(n),Y0=o.length;while(Y0--)y[o[Y0]]=n[o[Y0]];return y};function V0(y,n){return Object.prototype.hasOwnProperty.call(y,n)}var s=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;B.promisify=function(n){if(typeof n!=="function")throw TypeError('The "original" argument must be of type Function');if(s&&n[s]){var o=n[s];if(typeof o!=="function")throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(o,s,{value:o,enumerable:!1,writable:!1,configurable:!0}),o}function o(){var Y0,O0,w=new Promise(function(h,Z0){Y0=h,O0=Z0}),L=[];for(var u=0;u{function G(P,j){var E=Object.keys(P);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(P);j&&(C=C.filter(function(N){return Object.getOwnPropertyDescriptor(P,N).enumerable})),E.push.apply(E,C)}return E}function Y(P){for(var j=1;j0)this.tail.next=C;else this.head=C;this.tail=C,++this.length}},{key:"unshift",value:function(E){var C={data:E,next:this.head};if(this.length===0)this.tail=C;this.head=C,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var E=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,E}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";var C=this.head,N=""+C.data;while(C=C.next)N+=E+C.data;return N}},{key:"concat",value:function(E){if(this.length===0)return I.alloc(0);var C=I.allocUnsafe(E>>>0),N=this.head,v=0;while(N)A(N.data,C,v),v+=N.data.length,N=N.next;return C}},{key:"consume",value:function(E,C){var N;if(ES.length?S.length:E;if(F===S.length)v+=S;else v+=S.slice(0,E);if(E-=F,E===0){if(F===S.length)if(++N,C.next)this.head=C.next;else this.head=this.tail=null;else this.head=C,C.data=S.slice(F);break}++N}return this.length-=N,v}},{key:"_getBuffer",value:function(E){var C=I.allocUnsafe(E),N=this.head,v=1;N.data.copy(C),E-=N.data.length;while(N=N.next){var S=N.data,F=E>S.length?S.length:E;if(S.copy(C,C.length-E,0,F),E-=F,E===0){if(F===S.length)if(++v,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=S.slice(F);break}++v}return this.length-=v,C}},{key:T,value:function(E,C){return H(this,Y(Y({},C),{},{depth:0,customInspect:!1}))}}]),P}()}),NB=R0((B,U)=>{P2();function G(q,W){var I=this,H=this._readableState&&this._readableState.destroyed,T=this._writableState&&this._writableState.destroyed;if(H||T){if(W)W(q);else if(q){if(!this._writableState)P0.nextTick(Z,this,q);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,P0.nextTick(Z,this,q)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(q||null,function(A){if(!W&&A)if(!I._writableState)P0.nextTick(Y,I,A);else if(!I._writableState.errorEmitted)I._writableState.errorEmitted=!0,P0.nextTick(Y,I,A);else P0.nextTick(Q,I);else if(W)P0.nextTick(Q,I),W(A);else P0.nextTick(Q,I)}),this}function Y(q,W){Z(q,W),Q(q)}function Q(q){if(q._writableState&&!q._writableState.emitClose)return;if(q._readableState&&!q._readableState.emitClose)return;q.emit("close")}function K(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function Z(q,W){q.emit("error",W)}function J(q,W){var{_readableState:I,_writableState:H}=q;if(I&&I.autoDestroy||H&&H.autoDestroy)q.destroy(W);else q.emit("error",W)}U.exports={destroy:G,undestroy:K,errorOrDestroy:J}}),c2=R0((B,U)=>{function G(W,I){W.prototype=Object.create(I.prototype),W.prototype.constructor=W,W.__proto__=I}var Y={};function Q(W,I,H){if(!H)H=Error;function T(P,j,E){if(typeof I==="string")return I;else return I(P,j,E)}var A=function(P){G(j,P);function j(E,C,N){return P.call(this,T(E,C,N))||this}return j}(H);A.prototype.name=H.name,A.prototype.code=W,Y[W]=A}function K(W,I){if(Array.isArray(W)){var H=W.length;if(W=W.map(function(T){return String(T)}),H>2)return"one of ".concat(I," ").concat(W.slice(0,H-1).join(", "),", or ")+W[H-1];else if(H===2)return"one of ".concat(I," ").concat(W[0]," or ").concat(W[1]);else return"of ".concat(I," ").concat(W[0])}else return"of ".concat(I," ").concat(String(W))}function Z(W,I,H){return W.substr(!H||H<0?0:+H,I.length)===I}function J(W,I,H){if(H===void 0||H>W.length)H=W.length;return W.substring(H-I.length,H)===I}function q(W,I,H){if(typeof H!=="number")H=0;if(H+I.length>W.length)return!1;else return W.indexOf(I,H)!==-1}Q("ERR_INVALID_OPT_VALUE",function(W,I){return'The value "'+I+'" is invalid for option "'+W+'"'},TypeError),Q("ERR_INVALID_ARG_TYPE",function(W,I,H){var T;if(typeof I==="string"&&Z(I,"not "))T="must not be",I=I.replace(/^not /,"");else T="must be";var A;if(J(W," argument"))A="The ".concat(W," ").concat(T," ").concat(K(I,"type"));else{var P=q(W,".")?"property":"argument";A='The "'.concat(W,'" ').concat(P," ").concat(T," ").concat(K(I,"type"))}return A+=". Received type ".concat(typeof H),A},TypeError),Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Q("ERR_METHOD_NOT_IMPLEMENTED",function(W){return"The "+W+" method is not implemented"}),Q("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Q("ERR_STREAM_DESTROYED",function(W){return"Cannot call "+W+" after a stream was destroyed"}),Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Q("ERR_STREAM_WRITE_AFTER_END","write after end"),Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Q("ERR_UNKNOWN_ENCODING",function(W){return"Unknown encoding: "+W},TypeError),Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),U.exports.codes=Y}),zB=R0((B,U)=>{var G=c2().codes.ERR_INVALID_OPT_VALUE;function Y(K,Z,J){return K.highWaterMark!=null?K.highWaterMark:Z?K[J]:null}function Q(K,Z,J,q){var W=Y(Z,q,J);if(W!=null){if(!(isFinite(W)&&Math.floor(W)===W)||W<0)throw new G(q?J:"highWaterMark",W);return Math.floor(W)}return K.objectMode?16:16384}U.exports={getHighWaterMark:Q}}),sU=R0((B,U)=>{d2(),U.exports=G;function G(Q,K){if(Y("noDeprecation"))return Q;var Z=!1;function J(){if(!Z){if(Y("throwDeprecation"))throw Error(K);else if(Y("traceDeprecation"))console.trace(K);else console.warn(K);Z=!0}return Q.apply(this,arguments)}return J}function Y(Q){try{if(!v0.localStorage)return!1}catch(Z){return!1}var K=v0.localStorage[Q];if(K==null)return!1;return String(K).toLowerCase()==="true"}}),wB=R0((B,U)=>{d2(),P2(),U.exports=z;function G(w){var L=this;this.next=null,this.entry=null,this.finish=function(){O0(L,w)}}var Y;z.WritableState=$;var Q={deprecate:sU()},K=qB(),Z=f1().Buffer,J=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function q(w){return Z.from(w)}function W(w){return Z.isBuffer(w)||w instanceof J}var I=NB(),H=zB().getHighWaterMark,T=c2().codes,A=T.ERR_INVALID_ARG_TYPE,P=T.ERR_METHOD_NOT_IMPLEMENTED,j=T.ERR_MULTIPLE_CALLBACK,E=T.ERR_STREAM_CANNOT_PIPE,C=T.ERR_STREAM_DESTROYED,N=T.ERR_STREAM_NULL_VALUES,v=T.ERR_STREAM_WRITE_AFTER_END,S=T.ERR_UNKNOWN_ENCODING,F=I.errorOrDestroy;W2()(z,K);function M(){}function $(w,L,u){if(Y=Y||u2(),w=w||{},typeof u!=="boolean")u=L instanceof Y;if(this.objectMode=!!w.objectMode,u)this.objectMode=this.objectMode||!!w.writableObjectMode;this.highWaterMark=H(this,w,"writableHighWaterMark",u),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=w.decodeStrings===!1;this.decodeStrings=!h,this.defaultEncoding=w.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z0){i(L,Z0)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=w.emitClose!==!1,this.autoDestroy=!!w.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new G(this)}$.prototype.getBuffer=function(){var L=this.bufferedRequest,u=[];while(L)u.push(L),L=L.next;return u},function(){try{Object.defineProperty($.prototype,"buffer",{get:Q.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(w){}}();var x;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")x=Function.prototype[Symbol.hasInstance],Object.defineProperty(z,Symbol.hasInstance,{value:function(L){if(x.call(this,L))return!0;if(this!==z)return!1;return L&&L._writableState instanceof $}});else x=function(L){return L instanceof this};function z(w){Y=Y||u2();var L=this instanceof Y;if(!L&&!x.call(z,this))return new z(w);if(this._writableState=new $(w,this,L),this.writable=!0,w){if(typeof w.write==="function")this._write=w.write;if(typeof w.writev==="function")this._writev=w.writev;if(typeof w.destroy==="function")this._destroy=w.destroy;if(typeof w.final==="function")this._final=w.final}K.call(this)}z.prototype.pipe=function(){F(this,new E)};function a(w,L){var u=new v;F(w,u),P0.nextTick(L,u)}function U0(w,L,u,h){var Z0;if(u===null)Z0=new N;else if(typeof u!=="string"&&!L.objectMode)Z0=new A("chunk",["string","Buffer"],u);if(Z0)return F(w,Z0),P0.nextTick(h,Z0),!1;return!0}z.prototype.write=function(w,L,u){var h=this._writableState,Z0=!1,g=!h.objectMode&&W(w);if(g&&!Z.isBuffer(w))w=q(w);if(typeof L==="function")u=L,L=null;if(g)L="buffer";else if(!L)L=h.defaultEncoding;if(typeof u!=="function")u=M;if(h.ending)a(this,u);else if(g||U0(this,h,w,u))h.pendingcb++,Z0=c(this,h,g,w,L,u);return Z0},z.prototype.cork=function(){this._writableState.corked++},z.prototype.uncork=function(){var w=this._writableState;if(w.corked){if(w.corked--,!w.writing&&!w.corked&&!w.bufferProcessing&&w.bufferedRequest)G0(this,w)}},z.prototype.setDefaultEncoding=function(L){if(typeof L==="string")L=L.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((L+"").toLowerCase())>-1))throw new S(L);return this._writableState.defaultEncoding=L,this},Object.defineProperty(z.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function b(w,L,u){if(!w.objectMode&&w.decodeStrings!==!1&&typeof L==="string")L=Z.from(L,u);return L}Object.defineProperty(z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function c(w,L,u,h,Z0,g){if(!u){var f=b(L,h,Z0);if(h!==f)u=!0,Z0="buffer",h=f}var R=L.objectMode?1:h.length;L.length+=R;var p=L.length{P2();var G=Object.keys||function(H){var T=[];for(var A in H)T.push(A);return T};U.exports=q;var Y=EB(),Q=wB();W2()(q,Y);var K=G(Q.prototype);for(var Z=0;Z{var G=f1(),Y=G.Buffer;function Q(Z,J){for(var q in Z)J[q]=Z[q]}if(Y.from&&Y.alloc&&Y.allocUnsafe&&Y.allocUnsafeSlow)U.exports=G;else Q(G,B),B.Buffer=K;function K(Z,J,q){return Y(Z,J,q)}Q(Y,K),K.from=function(Z,J,q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return Y(Z,J,q)},K.alloc=function(Z,J,q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var W=Y(Z);if(J!==void 0)if(typeof q==="string")W.fill(J,q);else W.fill(J);else W.fill(0);return W},K.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return Y(Z)},K.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),F8=R0((B)=>{var U=oU().Buffer,G=U.isEncoding||function(N){switch(N=""+N,N&&N.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Y(N){if(!N)return"utf8";var v;while(!0)switch(N){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return N;default:if(v)return;N=(""+N).toLowerCase(),v=!0}}function Q(N){var v=Y(N);if(typeof v!=="string"&&(U.isEncoding===G||!G(N)))throw Error("Unknown encoding: "+N);return v||N}B.StringDecoder=K;function K(N){this.encoding=Q(N);var v;switch(this.encoding){case"utf16le":this.text=T,this.end=A,v=4;break;case"utf8":this.fillLast=W,v=4;break;case"base64":this.text=P,this.end=j,v=3;break;default:this.write=E,this.end=C;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=U.allocUnsafe(v)}K.prototype.write=function(N){if(N.length===0)return"";var v,S;if(this.lastNeed){if(v=this.fillLast(N),v===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;if(S>5===6)return 2;else if(N>>4===14)return 3;else if(N>>3===30)return 4;return N>>6===2?-1:-2}function J(N,v,S){var F=v.length-1;if(F=0){if(M>0)N.lastNeed=M-1;return M}if(--F=0){if(M>0)N.lastNeed=M-2;return M}if(--F=0){if(M>0)if(M===2)M=0;else N.lastNeed=M-3;return M}return 0}function q(N,v,S){if((v[0]&192)!==128)return N.lastNeed=0,"�";if(N.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return N.lastNeed=1,"�";if(N.lastNeed>2&&v.length>2){if((v[2]&192)!==128)return N.lastNeed=2,"�"}}}function W(N){var v=this.lastTotal-this.lastNeed,S=q(this,N,v);if(S!==void 0)return S;if(this.lastNeed<=N.length)return N.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);N.copy(this.lastChar,v,0,N.length),this.lastNeed-=N.length}function I(N,v){var S=J(this,N,v);if(!this.lastNeed)return N.toString("utf8",v);this.lastTotal=S;var F=N.length-(S-this.lastNeed);return N.copy(this.lastChar,0,F),N.toString("utf8",v,F)}function H(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+"�";return v}function T(N,v){if((N.length-v)%2===0){var S=N.toString("utf16le",v);if(S){var F=S.charCodeAt(S.length-1);if(F>=55296&&F<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=N[N.length-1],N.toString("utf16le",v,N.length-1)}function A(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,S)}return v}function P(N,v){var S=(N.length-v)%3;if(S===0)return N.toString("base64",v);if(this.lastNeed=3-S,this.lastTotal=3,S===1)this.lastChar[0]=N[N.length-1];else this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1];return N.toString("base64",v,N.length-S)}function j(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+this.lastChar.toString("base64",0,3-this.lastNeed);return v}function E(N){return N.toString(this.encoding)}function C(N){return N&&N.length?this.write(N):""}}),f8=R0((B,U)=>{var G=c2().codes.ERR_STREAM_PREMATURE_CLOSE;function Y(J){var q=!1;return function(){if(q)return;q=!0;for(var W=arguments.length,I=Array(W),H=0;H{P2();var G;function Y(S,F,M){if(F=Q(F),F in S)Object.defineProperty(S,F,{value:M,enumerable:!0,configurable:!0,writable:!0});else S[F]=M;return S}function Q(S){var F=K(S,"string");return typeof F==="symbol"?F:String(F)}function K(S,F){if(typeof S!=="object"||S===null)return S;var M=S[Symbol.toPrimitive];if(M!==void 0){var $=M.call(S,F||"default");if(typeof $!=="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(F==="string"?String:Number)(S)}var Z=f8(),J=Symbol("lastResolve"),q=Symbol("lastReject"),W=Symbol("error"),I=Symbol("ended"),H=Symbol("lastPromise"),T=Symbol("handlePromise"),A=Symbol("stream");function P(S,F){return{value:S,done:F}}function j(S){var F=S[J];if(F!==null){var M=S[A].read();if(M!==null)S[H]=null,S[J]=null,S[q]=null,F(P(M,!1))}}function E(S){P0.nextTick(j,S)}function C(S,F){return function(M,$){S.then(function(){if(F[I]){M(P(void 0,!0));return}F[T](M,$)},$)}}var N=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((G={get stream(){return this[A]},next:function(){var F=this,M=this[W];if(M!==null)return Promise.reject(M);if(this[I])return Promise.resolve(P(void 0,!0));if(this[A].destroyed)return new Promise(function(a,U0){P0.nextTick(function(){if(F[W])U0(F[W]);else a(P(void 0,!0))})});var $=this[H],x;if($)x=new Promise(C($,this));else{var z=this[A].read();if(z!==null)return Promise.resolve(P(z,!1));x=new Promise(this[T])}return this[H]=x,x}},Y(G,Symbol.asyncIterator,function(){return this}),Y(G,"return",function(){var F=this;return new Promise(function(M,$){F[A].destroy(null,function(x){if(x){$(x);return}M(P(void 0,!0))})})}),G),N);U.exports=function(F){var M,$=Object.create(v,(M={},Y(M,A,{value:F,writable:!0}),Y(M,J,{value:null,writable:!0}),Y(M,q,{value:null,writable:!0}),Y(M,W,{value:null,writable:!0}),Y(M,I,{value:F._readableState.endEmitted,writable:!0}),Y(M,T,{value:function(z,a){var U0=$[A].read();if(U0)$[H]=null,$[J]=null,$[q]=null,z(P(U0,!1));else $[J]=z,$[q]=a},writable:!0}),M));return $[H]=null,Z(F,function(x){if(x&&x.code!=="ERR_STREAM_PREMATURE_CLOSE"){var z=$[q];if(z!==null)$[H]=null,$[J]=null,$[q]=null,z(x);$[W]=x;return}var a=$[J];if(a!==null)$[H]=null,$[J]=null,$[q]=null,a(P(void 0,!0));$[I]=!0}),F.on("readable",E.bind(null,$)),$}}),eU=R0((B,U)=>{U.exports=function(){throw Error("Readable.from is not available in the browser")}}),EB=R0((B,U)=>{d2(),P2(),U.exports=a;var G;a.ReadableState=z,S8().EventEmitter;var Y=function(f,R){return f.listeners(R).length},Q=qB(),K=f1().Buffer,Z=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function J(g){return K.from(g)}function q(g){return K.isBuffer(g)||g instanceof Z}var W=jB(),I;if(W&&W.debuglog)I=W.debuglog("stream");else I=function(){};var H=nU(),T=NB(),A=zB().getHighWaterMark,P=c2().codes,j=P.ERR_INVALID_ARG_TYPE,E=P.ERR_STREAM_PUSH_AFTER_EOF,C=P.ERR_METHOD_NOT_IMPLEMENTED,N=P.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,S,F;W2()(a,Q);var M=T.errorOrDestroy,$=["error","close","destroy","pause","resume"];function x(g,f,R){if(typeof g.prependListener==="function")return g.prependListener(f,R);if(!g._events||!g._events[f])g.on(f,R);else if(Array.isArray(g._events[f]))g._events[f].unshift(R);else g._events[f]=[R,g._events[f]]}function z(g,f,R){if(G=G||u2(),g=g||{},typeof R!=="boolean")R=f instanceof G;if(this.objectMode=!!g.objectMode,R)this.objectMode=this.objectMode||!!g.readableObjectMode;if(this.highWaterMark=A(this,g,"readableHighWaterMark",R),this.buffer=new H,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=g.emitClose!==!1,this.autoDestroy=!!g.autoDestroy,this.destroyed=!1,this.defaultEncoding=g.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,g.encoding){if(!v)v=F8().StringDecoder;this.decoder=new v(g.encoding),this.encoding=g.encoding}}function a(g){if(G=G||u2(),!(this instanceof a))return new a(g);var f=this instanceof G;if(this._readableState=new z(g,this,f),this.readable=!0,g){if(typeof g.read==="function")this._read=g.read;if(typeof g.destroy==="function")this._destroy=g.destroy}Q.call(this)}Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(f){if(!this._readableState)return;this._readableState.destroyed=f}}),a.prototype.destroy=T.destroy,a.prototype._undestroy=T.undestroy,a.prototype._destroy=function(g,f){f(g)},a.prototype.push=function(g,f){var R=this._readableState,p;if(!R.objectMode){if(typeof g==="string"){if(f=f||R.defaultEncoding,f!==R.encoding)g=K.from(g,f),f="";p=!0}}else p=!0;return U0(this,g,f,!1,p)},a.prototype.unshift=function(g){return U0(this,g,null,!0,!1)};function U0(g,f,R,p,k){I("readableAddChunk",f);var V=g._readableState;if(f===null)V.reading=!1,i(g,V);else{var X;if(!k)X=c(V,f);if(X)M(g,X);else if(V.objectMode||f&&f.length>0){if(typeof f!=="string"&&!V.objectMode&&Object.getPrototypeOf(f)!==K.prototype)f=J(f);if(p)if(V.endEmitted)M(g,new N);else b(g,V,f,!0);else if(V.ended)M(g,new E);else if(V.destroyed)return!1;else if(V.reading=!1,V.decoder&&!R)if(f=V.decoder.write(f),V.objectMode||f.length!==0)b(g,V,f,!1);else G0(g,V);else b(g,V,f,!1)}else if(!p)V.reading=!1,G0(g,V)}return!V.ended&&(V.length=D)g=D;else g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++;return g}function B0(g,f){if(g<=0||f.length===0&&f.ended)return 0;if(f.objectMode)return 1;if(g!==g)if(f.flowing&&f.length)return f.buffer.head.data.length;else return f.length;if(g>f.highWaterMark)f.highWaterMark=m(g);if(g<=f.length)return g;if(!f.ended)return f.needReadable=!0,0;return f.length}a.prototype.read=function(g){I("read",g),g=parseInt(g,10);var f=this._readableState,R=g;if(g!==0)f.emittedReadable=!1;if(g===0&&f.needReadable&&((f.highWaterMark!==0?f.length>=f.highWaterMark:f.length>0)||f.ended)){if(I("read: emitReadable",f.length,f.ended),f.length===0&&f.ended)u(this);else V0(this);return null}if(g=B0(g,f),g===0&&f.ended){if(f.length===0)u(this);return null}var p=f.needReadable;if(I("need readable",p),f.length===0||f.length-g0)k=L(g,f);else k=null;if(k===null)f.needReadable=f.length<=f.highWaterMark,g=0;else f.length-=g,f.awaitDrain=0;if(f.length===0){if(!f.ended)f.needReadable=!0;if(R!==g&&f.ended)u(this)}if(k!==null)this.emit("data",k);return k};function i(g,f){if(I("onEofChunk"),f.ended)return;if(f.decoder){var R=f.decoder.end();if(R&&R.length)f.buffer.push(R),f.length+=f.objectMode?1:R.length}if(f.ended=!0,f.sync)V0(g);else if(f.needReadable=!1,!f.emittedReadable)f.emittedReadable=!0,s(g)}function V0(g){var f=g._readableState;if(I("emitReadable",f.needReadable,f.emittedReadable),f.needReadable=!1,!f.emittedReadable)I("emitReadable",f.flowing),f.emittedReadable=!0,P0.nextTick(s,g)}function s(g){var f=g._readableState;if(I("emitReadable_",f.destroyed,f.length,f.ended),!f.destroyed&&(f.length||f.ended))g.emit("readable"),f.emittedReadable=!1;f.needReadable=!f.flowing&&!f.ended&&f.length<=f.highWaterMark,w(g)}function G0(g,f){if(!f.readingMore)f.readingMore=!0,P0.nextTick(r,g,f)}function r(g,f){while(!f.reading&&!f.ended&&(f.length1&&Z0(p.pipes,g)!==-1)&&!_)I("false write response, pause",p.awaitDrain),p.awaitDrain++;R.pause()}}function Q0(F0){if(I("onerror",F0),I0(),g.removeListener("error",Q0),Y(g,"error")===0)M(g,F0)}x(g,"error",Q0);function X0(){g.removeListener("finish",K0),I0()}g.once("close",X0);function K0(){I("onfinish"),g.removeListener("close",X0),I0()}g.once("finish",K0);function I0(){I("unpipe"),R.unpipe(g)}if(g.emit("pipe",R),!p.flowing)I("pipe resume"),R.resume();return g};function y(g){return function(){var R=g._readableState;if(I("pipeOnDrain",R.awaitDrain),R.awaitDrain)R.awaitDrain--;if(R.awaitDrain===0&&Y(g,"data"))R.flowing=!0,w(g)}}a.prototype.unpipe=function(g){var f=this._readableState,R={hasUnpiped:!1};if(f.pipesCount===0)return this;if(f.pipesCount===1){if(g&&g!==f.pipes)return this;if(!g)g=f.pipes;if(f.pipes=null,f.pipesCount=0,f.flowing=!1,g)g.emit("unpipe",this,R);return this}if(!g){var{pipes:p,pipesCount:k}=f;f.pipes=null,f.pipesCount=0,f.flowing=!1;for(var V=0;V0,p.flowing!==!1)this.resume()}else if(g==="readable"){if(!p.endEmitted&&!p.readableListening){if(p.readableListening=p.needReadable=!0,p.flowing=!1,p.emittedReadable=!1,I("on readable",p.length,p.reading),p.length)V0(this);else if(!p.reading)P0.nextTick(o,this)}}return R},a.prototype.addListener=a.prototype.on,a.prototype.removeListener=function(g,f){var R=Q.prototype.removeListener.call(this,g,f);if(g==="readable")P0.nextTick(n,this);return R},a.prototype.removeAllListeners=function(g){var f=Q.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)P0.nextTick(n,this);return f};function n(g){var f=g._readableState;if(f.readableListening=g.listenerCount("readable")>0,f.resumeScheduled&&!f.paused)f.flowing=!0;else if(g.listenerCount("data")>0)g.resume()}function o(g){I("readable nexttick read 0"),g.read(0)}a.prototype.resume=function(){var g=this._readableState;if(!g.flowing)I("resume"),g.flowing=!g.readableListening,Y0(this,g);return g.paused=!1,this};function Y0(g,f){if(!f.resumeScheduled)f.resumeScheduled=!0,P0.nextTick(O0,g,f)}function O0(g,f){if(I("resume",f.reading),!f.reading)g.read(0);if(f.resumeScheduled=!1,g.emit("resume"),w(g),f.flowing&&!f.reading)g.read(0)}a.prototype.pause=function(){if(I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)I("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function w(g){var f=g._readableState;I("flow",f.flowing);while(f.flowing&&g.read()!==null);}if(a.prototype.wrap=function(g){var f=this,R=this._readableState,p=!1;g.on("end",function(){if(I("wrapped end"),R.decoder&&!R.ended){var X=R.decoder.end();if(X&&X.length)f.push(X)}f.push(null)}),g.on("data",function(X){if(I("wrapped data"),R.decoder)X=R.decoder.write(X);if(R.objectMode&&(X===null||X===void 0))return;else if(!R.objectMode&&(!X||!X.length))return;if(!f.push(X))p=!0,g.pause()});for(var k in g)if(this[k]===void 0&&typeof g[k]==="function")this[k]=function(O){return function(){return g[O].apply(g,arguments)}}(k);for(var V=0;V<$.length;V++)g.on($[V],this.emit.bind(this,$[V]));return this._read=function(X){if(I("wrapped _read",X),p)p=!1,g.resume()},this},typeof Symbol==="function")a.prototype[Symbol.asyncIterator]=function(){if(S===void 0)S=tU();return S(this)};Object.defineProperty(a.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(a.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(a.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(f){if(this._readableState)this._readableState.flowing=f}}),a._fromList=L,Object.defineProperty(a.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function L(g,f){if(f.length===0)return null;var R;if(f.objectMode)R=f.buffer.shift();else if(!g||g>=f.length){if(f.decoder)R=f.buffer.join("");else if(f.buffer.length===1)R=f.buffer.first();else R=f.buffer.concat(f.length);f.buffer.clear()}else R=f.buffer.consume(g,f.decoder);return R}function u(g){var f=g._readableState;if(I("endReadable",f.endEmitted),!f.endEmitted)f.ended=!0,P0.nextTick(h,f,g)}function h(g,f){if(I("endReadableNT",g.endEmitted,g.length),!g.endEmitted&&g.length===0){if(g.endEmitted=!0,f.readable=!1,f.emit("end"),g.autoDestroy){var R=f._writableState;if(!R||R.autoDestroy&&R.finished)f.destroy()}}}if(typeof Symbol==="function")a.from=function(g,f){if(F===void 0)F=eU();return F(a,g,f)};function Z0(g,f){for(var R=0,p=g.length;R{U.exports=W;var G=c2().codes,Y=G.ERR_METHOD_NOT_IMPLEMENTED,Q=G.ERR_MULTIPLE_CALLBACK,K=G.ERR_TRANSFORM_ALREADY_TRANSFORMING,Z=G.ERR_TRANSFORM_WITH_LENGTH_0,J=u2();W2()(W,J);function q(T,A){var P=this._transformState;P.transforming=!1;var j=P.writecb;if(j===null)return this.emit("error",new Q);if(P.writechunk=null,P.writecb=null,A!=null)this.push(A);j(T);var E=this._readableState;if(E.reading=!1,E.needReadable||E.length{U.exports=Y;var G=DB();W2()(Y,G);function Y(Q){if(!(this instanceof Y))return new Y(Q);G.call(this,Q)}Y.prototype._transform=function(Q,K,Z){Z(null,Q)}}),UG=R0((B,U)=>{var G;function Y(P){var j=!1;return function(){if(j)return;j=!0,P.apply(void 0,arguments)}}var Q=c2().codes,K=Q.ERR_MISSING_ARGS,Z=Q.ERR_STREAM_DESTROYED;function J(P){if(P)throw P}function q(P){return P.setHeader&&typeof P.abort==="function"}function W(P,j,E,C){C=Y(C);var N=!1;if(P.on("close",function(){N=!0}),G===void 0)G=f8();G(P,{readable:j,writable:E},function(S){if(S)return C(S);N=!0,C()});var v=!1;return function(S){if(N)return;if(v)return;if(v=!0,q(P))return P.abort();if(typeof P.destroy==="function")return P.destroy();C(S||new Z("pipe"))}}function I(P){P()}function H(P,j){return P.pipe(j)}function T(P){if(!P.length)return J;if(typeof P[P.length-1]!=="function")return J;return P.pop()}function A(){for(var P=arguments.length,j=Array(P),E=0;E0,function($){if(!N)N=$;if($)v.forEach(I);if(M)return;v.forEach(I),C(N)})});return j.reduce(H)}U.exports=A}),x8=R0((B,U)=>{U.exports=Y;var G=S8().EventEmitter;W2()(Y,G),Y.Readable=EB(),Y.Writable=wB(),Y.Duplex=u2(),Y.Transform=DB(),Y.PassThrough=BG(),Y.finished=f8(),Y.pipeline=UG(),Y.Stream=Y;function Y(){G.call(this)}Y.prototype.pipe=function(Q,K){var Z=this;function J(P){if(Q.writable){if(Q.write(P)===!1&&Z.pause)Z.pause()}}Z.on("data",J);function q(){if(Z.readable&&Z.resume)Z.resume()}if(Q.on("drain",q),!Q._isStdio&&(!K||K.end!==!1))Z.on("end",I),Z.on("close",H);var W=!1;function I(){if(W)return;W=!0,Q.end()}function H(){if(W)return;if(W=!0,typeof Q.destroy==="function")Q.destroy()}function T(P){if(A(),G.listenerCount(this,"error")===0)throw P}Z.on("error",T),Q.on("error",T);function A(){Z.removeListener("data",J),Q.removeListener("drain",q),Z.removeListener("end",I),Z.removeListener("close",H),Z.removeListener("error",T),Q.removeListener("error",T),Z.removeListener("end",A),Z.removeListener("close",A),Q.removeListener("close",A)}return Z.on("end",A),Z.on("close",A),Q.on("close",A),Q.emit("pipe",Z),Q}}),GG=R0((B)=>{(function(U){U.parser=function(w,L){return new Y(w,L)},U.SAXParser=Y,U.SAXStream=I,U.createStream=W,U.MAX_BUFFER_LENGTH=65536;var G=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];U.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Y(w,L){if(!(this instanceof Y))return new Y(w,L);var u=this;if(K(u),u.q=u.c="",u.bufferCheckPosition=U.MAX_BUFFER_LENGTH,u.opt=L||{},u.opt.lowercase=u.opt.lowercase||u.opt.lowercasetags,u.looseCase=u.opt.lowercase?"toLowerCase":"toUpperCase",u.tags=[],u.closed=u.closedRoot=u.sawRoot=!1,u.tag=u.error=null,u.strict=!!w,u.noscript=!!(w||u.opt.noscript),u.state=z.BEGIN,u.strictEntities=u.opt.strictEntities,u.ENTITIES=u.strictEntities?Object.create(U.XML_ENTITIES):Object.create(U.ENTITIES),u.attribList=[],u.opt.xmlns)u.ns=Object.create(j);if(u.trackPosition=u.opt.position!==!1,u.trackPosition)u.position=u.line=u.column=0;U0(u,"onready")}if(!Object.create)Object.create=function(w){function L(){}return L.prototype=w,new L};if(!Object.keys)Object.keys=function(w){var L=[];for(var u in w)if(w.hasOwnProperty(u))L.push(u);return L};function Q(w){var L=Math.max(U.MAX_BUFFER_LENGTH,10),u=0;for(var h=0,Z0=G.length;hL)switch(G[h]){case"textNode":c(w);break;case"cdata":b(w,"oncdata",w.cdata),w.cdata="";break;case"script":b(w,"onscript",w.script),w.script="";break;default:m(w,"Max buffer length exceeded: "+G[h])}u=Math.max(u,g)}w.bufferCheckPosition=U.MAX_BUFFER_LENGTH-u+w.position}function K(w){for(var L=0,u=G.length;L"||S(w)}function $(w,L){return w.test(L)}function x(w,L){return!$(w,L)}var z=0;U.STATE={BEGIN:z++,BEGIN_WHITESPACE:z++,TEXT:z++,TEXT_ENTITY:z++,OPEN_WAKA:z++,SGML_DECL:z++,SGML_DECL_QUOTED:z++,DOCTYPE:z++,DOCTYPE_QUOTED:z++,DOCTYPE_DTD:z++,DOCTYPE_DTD_QUOTED:z++,COMMENT_STARTING:z++,COMMENT:z++,COMMENT_ENDING:z++,COMMENT_ENDED:z++,CDATA:z++,CDATA_ENDING:z++,CDATA_ENDING_2:z++,PROC_INST:z++,PROC_INST_BODY:z++,PROC_INST_ENDING:z++,OPEN_TAG:z++,OPEN_TAG_SLASH:z++,ATTRIB:z++,ATTRIB_NAME:z++,ATTRIB_NAME_SAW_WHITE:z++,ATTRIB_VALUE:z++,ATTRIB_VALUE_QUOTED:z++,ATTRIB_VALUE_CLOSED:z++,ATTRIB_VALUE_UNQUOTED:z++,ATTRIB_VALUE_ENTITY_Q:z++,ATTRIB_VALUE_ENTITY_U:z++,CLOSE_TAG:z++,CLOSE_TAG_SAW_WHITE:z++,SCRIPT:z++,SCRIPT_ENDING:z++},U.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},U.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(U.ENTITIES).forEach(function(w){var L=U.ENTITIES[w],u=typeof L==="number"?String.fromCharCode(L):L;U.ENTITIES[w]=u});for(var a in U.STATE)U.STATE[U.STATE[a]]=a;z=U.STATE;function U0(w,L,u){w[L]&&w[L](u)}function b(w,L,u){if(w.textNode)c(w);U0(w,L,u)}function c(w){if(w.textNode=D(w.opt,w.textNode),w.textNode)U0(w,"ontext",w.textNode);w.textNode=""}function D(w,L){if(w.trim)L=L.trim();if(w.normalize)L=L.replace(/\s+/g," ");return L}function m(w,L){if(c(w),w.trackPosition)L+=` +Line: `+w.line+` +Column: `+w.column+` +Char: `+w.c;return L=Error(L),w.error=L,U0(w,"onerror",L),w}function B0(w){if(w.sawRoot&&!w.closedRoot)i(w,"Unclosed root tag");if(w.state!==z.BEGIN&&w.state!==z.BEGIN_WHITESPACE&&w.state!==z.TEXT)m(w,"Unexpected end");return c(w),w.c="",w.closed=!0,U0(w,"onend"),Y.call(w,w.strict,w.opt),w}function i(w,L){if(typeof w!=="object"||!(w instanceof Y))throw Error("bad call to strictFail");if(w.strict)m(w,L)}function V0(w){if(!w.strict)w.tagName=w.tagName[w.looseCase]();var L=w.tags[w.tags.length-1]||w,u=w.tag={name:w.tagName,attributes:{}};if(w.opt.xmlns)u.ns=L.ns;w.attribList.length=0,b(w,"onopentagstart",u)}function s(w,L){var u=w.indexOf(":")<0?["",w]:w.split(":"),h=u[0],Z0=u[1];if(L&&w==="xmlns")h="xmlns",Z0="";return{prefix:h,local:Z0}}function G0(w){if(!w.strict)w.attribName=w.attribName[w.looseCase]();if(w.attribList.indexOf(w.attribName)!==-1||w.tag.attributes.hasOwnProperty(w.attribName)){w.attribName=w.attribValue="";return}if(w.opt.xmlns){var L=s(w.attribName,!0),u=L.prefix,h=L.local;if(u==="xmlns")if(h==="xml"&&w.attribValue!==A)i(w,"xml: prefix must be bound to "+A+` +Actual: `+w.attribValue);else if(h==="xmlns"&&w.attribValue!==P)i(w,"xmlns: prefix must be bound to "+P+` +Actual: `+w.attribValue);else{var Z0=w.tag,g=w.tags[w.tags.length-1]||w;if(Z0.ns===g.ns)Z0.ns=Object.create(g.ns);Z0.ns[h]=w.attribValue}w.attribList.push([w.attribName,w.attribValue])}else w.tag.attributes[w.attribName]=w.attribValue,b(w,"onattribute",{name:w.attribName,value:w.attribValue});w.attribName=w.attribValue=""}function r(w,L){if(w.opt.xmlns){var u=w.tag,h=s(w.tagName);if(u.prefix=h.prefix,u.local=h.local,u.uri=u.ns[h.prefix]||"",u.prefix&&!u.uri)i(w,"Unbound namespace prefix: "+JSON.stringify(w.tagName)),u.uri=h.prefix;var Z0=w.tags[w.tags.length-1]||w;if(u.ns&&Z0.ns!==u.ns)Object.keys(u.ns).forEach(function(d){b(w,"onopennamespace",{prefix:d,uri:u.ns[d]})});for(var g=0,f=w.attribList.length;g",w.tagName="",w.state=z.SCRIPT;return}b(w,"onscript",w.script),w.script=""}var L=w.tags.length,u=w.tagName;if(!w.strict)u=u[w.looseCase]();var h=u;while(L--)if(w.tags[L].name!==h)i(w,"Unexpected close tag");else break;if(L<0){i(w,"Unmatched closing tag: "+w.tagName),w.textNode+="",w.state=z.TEXT;return}w.tagName=u;var Z0=w.tags.length;while(Z0-- >L){var g=w.tag=w.tags.pop();w.tagName=w.tag.name,b(w,"onclosetag",w.tagName);var f={};for(var R in g.ns)f[R]=g.ns[R];var p=w.tags[w.tags.length-1]||w;if(w.opt.xmlns&&g.ns!==p.ns)Object.keys(g.ns).forEach(function(k){var V=g.ns[k];b(w,"onclosenamespace",{prefix:k,uri:V})})}if(L===0)w.closedRoot=!0;w.tagName=w.attribValue=w.attribName="",w.attribList.length=0,w.state=z.TEXT}function n(w){var L=w.entity,u=L.toLowerCase(),h,Z0="";if(w.ENTITIES[L])return w.ENTITIES[L];if(w.ENTITIES[u])return w.ENTITIES[u];if(L=u,L.charAt(0)==="#")if(L.charAt(1)==="x")L=L.slice(2),h=parseInt(L,16),Z0=h.toString(16);else L=L.slice(1),h=parseInt(L,10),Z0=h.toString(10);if(L=L.replace(/^0+/,""),isNaN(h)||Z0.toLowerCase()!==L)return i(w,"Invalid character entity"),"&"+w.entity+";";return String.fromCodePoint(h)}function o(w,L){if(L==="<")w.state=z.OPEN_WAKA,w.startTagPosition=w.position;else if(!S(L))i(w,"Non-whitespace before first tag."),w.textNode=L,w.state=z.TEXT}function Y0(w,L){var u="";if(L")b(L,"onsgmldeclaration",L.sgmlDecl),L.sgmlDecl="",L.state=z.TEXT;else if(F(h))L.state=z.SGML_DECL_QUOTED,L.sgmlDecl+=h;else L.sgmlDecl+=h;continue;case z.SGML_DECL_QUOTED:if(h===L.q)L.state=z.SGML_DECL,L.q="";L.sgmlDecl+=h;continue;case z.DOCTYPE:if(h===">")L.state=z.TEXT,b(L,"ondoctype",L.doctype),L.doctype=!0;else if(L.doctype+=h,h==="[")L.state=z.DOCTYPE_DTD;else if(F(h))L.state=z.DOCTYPE_QUOTED,L.q=h;continue;case z.DOCTYPE_QUOTED:if(L.doctype+=h,h===L.q)L.q="",L.state=z.DOCTYPE;continue;case z.DOCTYPE_DTD:if(L.doctype+=h,h==="]")L.state=z.DOCTYPE;else if(F(h))L.state=z.DOCTYPE_DTD_QUOTED,L.q=h;continue;case z.DOCTYPE_DTD_QUOTED:if(L.doctype+=h,h===L.q)L.state=z.DOCTYPE_DTD,L.q="";continue;case z.COMMENT:if(h==="-")L.state=z.COMMENT_ENDING;else L.comment+=h;continue;case z.COMMENT_ENDING:if(h==="-"){if(L.state=z.COMMENT_ENDED,L.comment=D(L.opt,L.comment),L.comment)b(L,"oncomment",L.comment);L.comment=""}else L.comment+="-"+h,L.state=z.COMMENT;continue;case z.COMMENT_ENDED:if(h!==">")i(L,"Malformed comment"),L.comment+="--"+h,L.state=z.COMMENT;else L.state=z.TEXT;continue;case z.CDATA:if(h==="]")L.state=z.CDATA_ENDING;else L.cdata+=h;continue;case z.CDATA_ENDING:if(h==="]")L.state=z.CDATA_ENDING_2;else L.cdata+="]"+h,L.state=z.CDATA;continue;case z.CDATA_ENDING_2:if(h===">"){if(L.cdata)b(L,"oncdata",L.cdata);b(L,"onclosecdata"),L.cdata="",L.state=z.TEXT}else if(h==="]")L.cdata+="]";else L.cdata+="]]"+h,L.state=z.CDATA;continue;case z.PROC_INST:if(h==="?")L.state=z.PROC_INST_ENDING;else if(S(h))L.state=z.PROC_INST_BODY;else L.procInstName+=h;continue;case z.PROC_INST_BODY:if(!L.procInstBody&&S(h))continue;else if(h==="?")L.state=z.PROC_INST_ENDING;else L.procInstBody+=h;continue;case z.PROC_INST_ENDING:if(h===">")b(L,"onprocessinginstruction",{name:L.procInstName,body:L.procInstBody}),L.procInstName=L.procInstBody="",L.state=z.TEXT;else L.procInstBody+="?"+h,L.state=z.PROC_INST_BODY;continue;case z.OPEN_TAG:if($(C,h))L.tagName+=h;else if(V0(L),h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else{if(!S(h))i(L,"Invalid character in tag name");L.state=z.ATTRIB}continue;case z.OPEN_TAG_SLASH:if(h===">")r(L,!0),y(L);else i(L,"Forward-slash in opening tag not followed by >"),L.state=z.ATTRIB;continue;case z.ATTRIB:if(S(h))continue;else if(h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else if($(E,h))L.attribName=h,L.attribValue="",L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case z.ATTRIB_NAME:if(h==="=")L.state=z.ATTRIB_VALUE;else if(h===">")i(L,"Attribute without value"),L.attribValue=L.attribName,G0(L),r(L);else if(S(h))L.state=z.ATTRIB_NAME_SAW_WHITE;else if($(C,h))L.attribName+=h;else i(L,"Invalid attribute name");continue;case z.ATTRIB_NAME_SAW_WHITE:if(h==="=")L.state=z.ATTRIB_VALUE;else if(S(h))continue;else if(i(L,"Attribute without value"),L.tag.attributes[L.attribName]="",L.attribValue="",b(L,"onattribute",{name:L.attribName,value:""}),L.attribName="",h===">")r(L);else if($(E,h))L.attribName=h,L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name"),L.state=z.ATTRIB;continue;case z.ATTRIB_VALUE:if(S(h))continue;else if(F(h))L.q=h,L.state=z.ATTRIB_VALUE_QUOTED;else i(L,"Unquoted attribute value"),L.state=z.ATTRIB_VALUE_UNQUOTED,L.attribValue=h;continue;case z.ATTRIB_VALUE_QUOTED:if(h!==L.q){if(h==="&")L.state=z.ATTRIB_VALUE_ENTITY_Q;else L.attribValue+=h;continue}G0(L),L.q="",L.state=z.ATTRIB_VALUE_CLOSED;continue;case z.ATTRIB_VALUE_CLOSED:if(S(h))L.state=z.ATTRIB;else if(h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else if($(E,h))i(L,"No whitespace between attributes"),L.attribName=h,L.attribValue="",L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case z.ATTRIB_VALUE_UNQUOTED:if(!M(h)){if(h==="&")L.state=z.ATTRIB_VALUE_ENTITY_U;else L.attribValue+=h;continue}if(G0(L),h===">")r(L);else L.state=z.ATTRIB;continue;case z.CLOSE_TAG:if(!L.tagName)if(S(h))continue;else if(x(E,h))if(L.script)L.script+="")y(L);else if($(C,h))L.tagName+=h;else if(L.script)L.script+="")y(L);else i(L,"Invalid characters in closing tag");continue;case z.TEXT_ENTITY:case z.ATTRIB_VALUE_ENTITY_Q:case z.ATTRIB_VALUE_ENTITY_U:var f,R;switch(L.state){case z.TEXT_ENTITY:f=z.TEXT,R="textNode";break;case z.ATTRIB_VALUE_ENTITY_Q:f=z.ATTRIB_VALUE_QUOTED,R="attribValue";break;case z.ATTRIB_VALUE_ENTITY_U:f=z.ATTRIB_VALUE_UNQUOTED,R="attribValue";break}if(h===";")L[R]+=n(L),L.entity="",L.state=f;else if($(L.entity.length?v:N,h))L.entity+=h;else i(L,"Invalid character in entity name"),L[R]+="&"+L.entity+h,L.entity="",L.state=f;continue;default:throw Error(L,"Unknown state: "+L.state)}}if(L.position>=L.bufferCheckPosition)Q(L);return L}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint)(function(){var w=String.fromCharCode,L=Math.floor,u=function(){var h=16384,Z0=[],g,f,R=-1,p=arguments.length;if(!p)return"";var k="";while(++R1114111||L(V)!==V)throw RangeError("Invalid code point: "+V);if(V<=65535)Z0.push(V);else V-=65536,g=(V>>10)+55296,f=V%1024+56320,Z0.push(g,f);if(R+1===p||Z0.length>h)k+=w.apply(null,Z0),Z0.length=0}return k};if(Object.defineProperty)Object.defineProperty(String,"fromCodePoint",{value:u,configurable:!0,writable:!0});else String.fromCodePoint=u})()})(typeof B>"u"?B.sax={}:B)}),_8=R0((B,U)=>{U.exports={isArray:function(G){if(Array.isArray)return Array.isArray(G);return Object.prototype.toString.call(G)==="[object Array]"}}}),h8=R0((B,U)=>{var G=_8().isArray;U.exports={copyOptions:function(Y){var Q,K={};for(Q in Y)if(Y.hasOwnProperty(Q))K[Q]=Y[Q];return K},ensureFlagExists:function(Y,Q){if(!(Y in Q)||typeof Q[Y]!=="boolean")Q[Y]=!1},ensureSpacesExists:function(Y){if(!("spaces"in Y)||typeof Y.spaces!=="number"&&typeof Y.spaces!=="string")Y.spaces=0},ensureAlwaysArrayExists:function(Y){if(!("alwaysArray"in Y)||typeof Y.alwaysArray!=="boolean"&&!G(Y.alwaysArray))Y.alwaysArray=!1},ensureKeyExists:function(Y,Q){if(!(Y+"Key"in Q)||typeof Q[Y+"Key"]!=="string")Q[Y+"Key"]=Q.compact?"_"+Y:Y},checkFnExists:function(Y,Q){return Y+"Fn"in Q}}}),TB=R0((B,U)=>{var G=GG(),Y={on:function(){},parse:function(){}},Q=h8(),K=_8().isArray,Z,J=!0,q;function W(F){return Z=Q.copyOptions(F),Q.ensureFlagExists("ignoreDeclaration",Z),Q.ensureFlagExists("ignoreInstruction",Z),Q.ensureFlagExists("ignoreAttributes",Z),Q.ensureFlagExists("ignoreText",Z),Q.ensureFlagExists("ignoreComment",Z),Q.ensureFlagExists("ignoreCdata",Z),Q.ensureFlagExists("ignoreDoctype",Z),Q.ensureFlagExists("compact",Z),Q.ensureFlagExists("alwaysChildren",Z),Q.ensureFlagExists("addParent",Z),Q.ensureFlagExists("trim",Z),Q.ensureFlagExists("nativeType",Z),Q.ensureFlagExists("nativeTypeAttributes",Z),Q.ensureFlagExists("sanitize",Z),Q.ensureFlagExists("instructionHasAttributes",Z),Q.ensureFlagExists("captureSpacesBetweenElements",Z),Q.ensureAlwaysArrayExists(Z),Q.ensureKeyExists("declaration",Z),Q.ensureKeyExists("instruction",Z),Q.ensureKeyExists("attributes",Z),Q.ensureKeyExists("text",Z),Q.ensureKeyExists("comment",Z),Q.ensureKeyExists("cdata",Z),Q.ensureKeyExists("doctype",Z),Q.ensureKeyExists("type",Z),Q.ensureKeyExists("name",Z),Q.ensureKeyExists("elements",Z),Q.ensureKeyExists("parent",Z),Q.checkFnExists("doctype",Z),Q.checkFnExists("instruction",Z),Q.checkFnExists("cdata",Z),Q.checkFnExists("comment",Z),Q.checkFnExists("text",Z),Q.checkFnExists("instructionName",Z),Q.checkFnExists("elementName",Z),Q.checkFnExists("attributeName",Z),Q.checkFnExists("attributeValue",Z),Q.checkFnExists("attributes",Z),Z}function I(F){var M=Number(F);if(!isNaN(M))return M;var $=F.toLowerCase();if($==="true")return!0;else if($==="false")return!1;return F}function H(F,M){var $;if(Z.compact){if(!q[Z[F+"Key"]]&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(Z[F+"Key"])!==-1:Z.alwaysArray))q[Z[F+"Key"]]=[];if(q[Z[F+"Key"]]&&!K(q[Z[F+"Key"]]))q[Z[F+"Key"]]=[q[Z[F+"Key"]]];if(F+"Fn"in Z&&typeof M==="string")M=Z[F+"Fn"](M,q);if(F==="instruction"&&(("instructionFn"in Z)||("instructionNameFn"in Z))){for($ in M)if(M.hasOwnProperty($))if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);else{var x=M[$];delete M[$],M[Z.instructionNameFn($,x,q)]=x}}if(K(q[Z[F+"Key"]]))q[Z[F+"Key"]].push(M);else q[Z[F+"Key"]]=M}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];var z={};if(z[Z.typeKey]=F,F==="instruction"){for($ in M)if(M.hasOwnProperty($))break;if(z[Z.nameKey]="instructionNameFn"in Z?Z.instructionNameFn($,M,q):$,Z.instructionHasAttributes){if(z[Z.attributesKey]=M[$][Z.attributesKey],"instructionFn"in Z)z[Z.attributesKey]=Z.instructionFn(z[Z.attributesKey],$,q)}else{if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);z[Z.instructionKey]=M[$]}}else{if(F+"Fn"in Z)M=Z[F+"Fn"](M,q);z[Z[F+"Key"]]=M}if(Z.addParent)z[Z.parentKey]=q;q[Z.elementsKey].push(z)}}function T(F){if("attributesFn"in Z&&F)F=Z.attributesFn(F,q);if((Z.trim||("attributeValueFn"in Z)||("attributeNameFn"in Z)||Z.nativeTypeAttributes)&&F){var M;for(M in F)if(F.hasOwnProperty(M)){if(Z.trim)F[M]=F[M].trim();if(Z.nativeTypeAttributes)F[M]=I(F[M]);if("attributeValueFn"in Z)F[M]=Z.attributeValueFn(F[M],M,q);if("attributeNameFn"in Z){var $=F[M];delete F[M],F[Z.attributeNameFn(M,F[M],q)]=$}}}return F}function A(F){var M={};if(F.body&&(F.name.toLowerCase()==="xml"||Z.instructionHasAttributes)){var $=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,x;while((x=$.exec(F.body))!==null)M[x[1]]=x[2]||x[3]||x[4];M=T(M)}if(F.name.toLowerCase()==="xml"){if(Z.ignoreDeclaration)return;if(q[Z.declarationKey]={},Object.keys(M).length)q[Z.declarationKey][Z.attributesKey]=M;if(Z.addParent)q[Z.declarationKey][Z.parentKey]=q}else{if(Z.ignoreInstruction)return;if(Z.trim)F.body=F.body.trim();var z={};if(Z.instructionHasAttributes&&Object.keys(M).length)z[F.name]={},z[F.name][Z.attributesKey]=M;else z[F.name]=F.body;H("instruction",z)}}function P(F,M){var $;if(typeof F==="object")M=F.attributes,F=F.name;if(M=T(M),"elementNameFn"in Z)F=Z.elementNameFn(F,q);if(Z.compact){if($={},!Z.ignoreAttributes&&M&&Object.keys(M).length){$[Z.attributesKey]={};var x;for(x in M)if(M.hasOwnProperty(x))$[Z.attributesKey][x]=M[x]}if(!(F in q)&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(F)!==-1:Z.alwaysArray))q[F]=[];if(q[F]&&!K(q[F]))q[F]=[q[F]];if(K(q[F]))q[F].push($);else q[F]=$}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];if($={},$[Z.typeKey]="element",$[Z.nameKey]=F,!Z.ignoreAttributes&&M&&Object.keys(M).length)$[Z.attributesKey]=M;if(Z.alwaysChildren)$[Z.elementsKey]=[];q[Z.elementsKey].push($)}$[Z.parentKey]=q,q=$}function j(F){if(Z.ignoreText)return;if(!F.trim()&&!Z.captureSpacesBetweenElements)return;if(Z.trim)F=F.trim();if(Z.nativeType)F=I(F);if(Z.sanitize)F=F.replace(/&/g,"&").replace(//g,">");H("text",F)}function E(F){if(Z.ignoreComment)return;if(Z.trim)F=F.trim();H("comment",F)}function C(F){var M=q[Z.parentKey];if(!Z.addParent)delete q[Z.parentKey];q=M}function N(F){if(Z.ignoreCdata)return;if(Z.trim)F=F.trim();H("cdata",F)}function v(F){if(Z.ignoreDoctype)return;if(F=F.replace(/^ /,""),Z.trim)F=F.trim();H("doctype",F)}function S(F){F.note=F}U.exports=function(F,M){var $=J?G.parser(!0,{}):$=new Y.Parser("UTF-8"),x={};if(q=x,Z=W(M),J)$.opt={strictEntities:!0},$.onopentag=P,$.ontext=j,$.oncomment=E,$.onclosetag=C,$.onerror=S,$.oncdata=N,$.ondoctype=v,$.onprocessinginstruction=A;else $.on("startElement",P),$.on("text",j),$.on("comment",E),$.on("endElement",C),$.on("error",S);if(J)$.write(F).close();else if(!$.parse(F))throw Error("XML parsing error: "+$.getError());if(x[Z.elementsKey]){var z=x[Z.elementsKey];delete x[Z.elementsKey],x[Z.elementsKey]=z,delete x.text}return x}}),YG=R0((B,U)=>{var G=h8(),Y=TB();function Q(K){var Z=G.copyOptions(K);return G.ensureSpacesExists(Z),Z}U.exports=function(K,Z){var J=Q(Z),q=Y(K,J),W,I="compact"in J&&J.compact?"_parent":"parent";if("addParent"in J&&J.addParent)W=JSON.stringify(q,function(H,T){return H===I?"_":T},J.spaces);else W=JSON.stringify(q,null,J.spaces);return W.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}}),CB=R0((B,U)=>{var G=h8(),Y=_8().isArray,Q,K;function Z(F){var M=G.copyOptions(F);if(G.ensureFlagExists("ignoreDeclaration",M),G.ensureFlagExists("ignoreInstruction",M),G.ensureFlagExists("ignoreAttributes",M),G.ensureFlagExists("ignoreText",M),G.ensureFlagExists("ignoreComment",M),G.ensureFlagExists("ignoreCdata",M),G.ensureFlagExists("ignoreDoctype",M),G.ensureFlagExists("compact",M),G.ensureFlagExists("indentText",M),G.ensureFlagExists("indentCdata",M),G.ensureFlagExists("indentAttributes",M),G.ensureFlagExists("indentInstruction",M),G.ensureFlagExists("fullTagEmptyElement",M),G.ensureFlagExists("noQuotesForNativeAttributes",M),G.ensureSpacesExists(M),typeof M.spaces==="number")M.spaces=Array(M.spaces+1).join(" ");return G.ensureKeyExists("declaration",M),G.ensureKeyExists("instruction",M),G.ensureKeyExists("attributes",M),G.ensureKeyExists("text",M),G.ensureKeyExists("comment",M),G.ensureKeyExists("cdata",M),G.ensureKeyExists("doctype",M),G.ensureKeyExists("type",M),G.ensureKeyExists("name",M),G.ensureKeyExists("elements",M),G.checkFnExists("doctype",M),G.checkFnExists("instruction",M),G.checkFnExists("cdata",M),G.checkFnExists("comment",M),G.checkFnExists("text",M),G.checkFnExists("instructionName",M),G.checkFnExists("elementName",M),G.checkFnExists("attributeName",M),G.checkFnExists("attributeValue",M),G.checkFnExists("attributes",M),G.checkFnExists("fullTagEmptyElement",M),M}function J(F,M,$){return(!$&&F.spaces?` +`:"")+Array(M+1).join(F.spaces)}function q(F,M,$){if(M.ignoreAttributes)return"";if("attributesFn"in M)F=M.attributesFn(F,K,Q);var x,z,a,U0,b=[];for(x in F)if(F.hasOwnProperty(x)&&F[x]!==null&&F[x]!==void 0)U0=M.noQuotesForNativeAttributes&&typeof F[x]!=="string"?"":'"',z=""+F[x],z=z.replace(/"/g,"""),a="attributeNameFn"in M?M.attributeNameFn(x,z,K,Q):x,b.push(M.spaces&&M.indentAttributes?J(M,$+1,!1):" "),b.push(a+"="+U0+("attributeValueFn"in M?M.attributeValueFn(z,x,K,Q):z)+U0);if(F&&Object.keys(F).length&&M.spaces&&M.indentAttributes)b.push(J(M,$,!1));return b.join("")}function W(F,M,$){return Q=F,K="xml",M.ignoreDeclaration?"":""}function I(F,M,$){if(M.ignoreInstruction)return"";var x;for(x in F)if(F.hasOwnProperty(x))break;var z="instructionNameFn"in M?M.instructionNameFn(x,F[x],K,Q):x;if(typeof F[x]==="object")return Q=F,K=z,"";else{var a=F[x]?F[x]:"";if("instructionFn"in M)a=M.instructionFn(a,x,K,Q);return""}}function H(F,M){return M.ignoreComment?"":""}function T(F,M){return M.ignoreCdata?"":"","]]]]>"))+"]]>"}function A(F,M){return M.ignoreDoctype?"":""}function P(F,M){if(M.ignoreText)return"";return F=""+F,F=F.replace(/&/g,"&"),F=F.replace(/&/g,"&").replace(//g,">"),"textFn"in M?M.textFn(F,K,Q):F}function j(F,M){var $;if(F.elements&&F.elements.length)for($=0;$"),F[M.elementsKey]&&F[M.elementsKey].length)x.push(C(F[M.elementsKey],M,$+1)),Q=F,K=F.name;x.push(M.spaces&&j(F,M)?` +`+Array($+1).join(M.spaces):""),x.push("")}else x.push("/>");return x.join("")}function C(F,M,$,x){return F.reduce(function(z,a){var U0=J(M,$,x&&!z);switch(a.type){case"element":return z+U0+E(a,M,$);case"comment":return z+U0+H(a[M.commentKey],M);case"doctype":return z+U0+A(a[M.doctypeKey],M);case"cdata":return z+(M.indentCdata?U0:"")+T(a[M.cdataKey],M);case"text":return z+(M.indentText?U0:"")+P(a[M.textKey],M);case"instruction":var b={};return b[a[M.nameKey]]=a[M.attributesKey]?a:a[M.instructionKey],z+(M.indentInstruction?U0:"")+I(b,M,$)}},"")}function N(F,M,$){var x;for(x in F)if(F.hasOwnProperty(x))switch(x){case M.parentKey:case M.attributesKey:break;case M.textKey:if(M.indentText||$)return!0;break;case M.cdataKey:if(M.indentCdata||$)return!0;break;case M.instructionKey:if(M.indentInstruction||$)return!0;break;case M.doctypeKey:case M.commentKey:return!0;default:return!0}return!1}function v(F,M,$,x,z){Q=F,K=M;var a="elementNameFn"in $?$.elementNameFn(M,F):M;if(typeof F>"u"||F===null||F==="")return"fullTagEmptyElementFn"in $&&$.fullTagEmptyElementFn(M,F)||$.fullTagEmptyElement?"<"+a+">":"<"+a+"/>";var U0=[];if(M){if(U0.push("<"+a),typeof F!=="object")return U0.push(">"+P(F,$)+""),U0.join("");if(F[$.attributesKey])U0.push(q(F[$.attributesKey],$,x));var b=N(F,$,!0)||F[$.attributesKey]&&F[$.attributesKey]["xml:space"]==="preserve";if(!b)if("fullTagEmptyElementFn"in $)b=$.fullTagEmptyElementFn(M,F);else b=$.fullTagEmptyElement;if(b)U0.push(">");else return U0.push("/>"),U0.join("")}if(U0.push(S(F,$,x+1,!1)),Q=F,K=M,M)U0.push((z?J($,x,!1):"")+"");return U0.join("")}function S(F,M,$,x){var z,a,U0,b=[];for(a in F)if(F.hasOwnProperty(a)){U0=Y(F[a])?F[a]:[F[a]];for(z=0;z{var G=CB();U.exports=function(Y,Q){if(Y instanceof Buffer)Y=Y.toString();var K=null;if(typeof Y==="string")try{K=JSON.parse(Y)}catch(Z){throw Error("The JSON structure is invalid")}else K=Y;return G(K,Q)}}),h1=R0((B,U)=>{U.exports={xml2js:TB(),xml2json:YG(),js2xml:CB(),json2xml:ZG()}})(),u1=(B)=>{switch(B.type){case void 0:case"element":let U=new kB(B.name,B.attributes),G=B.elements||[];for(let Y of G){let Q=u1(Y);if(Q!==void 0)U.push(Q)}return U;case"text":return B.text;default:return}},QG=class extends H0{},kB=class extends t{static fromXmlString(B){return u1((0,h1.xml2js)(B,{compact:!1}))}constructor(B,U){super(B);if(U)this.root.push(new QG(U))}push(B){this.root.push(B)}},$B=class extends t{constructor(B){super("");e(this,"_attr",void 0),this._attr=B}prepForXml(B){return{_attr:this._attr}}},JG="",u8=class extends t{constructor(B,U){super(B);if(U)this.root=U.root}},T0=(B)=>{if(isNaN(B))throw Error(`Invalid value '${B}' specified. Must be an integer.`);return Math.floor(B)},X1=(B)=>{let U=T0(B);if(U<0)throw Error(`Invalid value '${B}' specified. Must be a positive integer.`);return U},d1=(B,U)=>{let G=U*2;if(B.length!==G||isNaN(Number(`0x${B}`)))throw Error(`Invalid hex value '${B}'. Expected ${G} digit hex value`);return B},KG=(B)=>d1(B,4),SB=(B)=>d1(B,2),W8=(B)=>d1(B,1),q1=(B)=>{let U=B.slice(-2),G=B.substring(0,B.length-2);return`${Number(G)}${U}`},d8=(B)=>{let U=q1(B);if(parseFloat(U)<0)throw Error(`Invalid value '${U}' specified. Expected a positive number.`);return U},C2=(B)=>{if(B==="auto")return B;return d1(B.charAt(0)==="#"?B.substring(1):B,3)},t0=(B)=>typeof B==="string"?q1(B):T0(B),bB=(B)=>typeof B==="string"?d8(B):X1(B),VG=(B)=>typeof B==="string"?q1(B):T0(B),E0=(B)=>typeof B==="string"?d8(B):X1(B),vB=(B)=>{let U=B.substring(0,B.length-1);return`${Number(U)}%`},c8=(B)=>{if(typeof B==="number")return T0(B);if(B.slice(-1)==="%")return vB(B);return q1(B)},yB=X1,gB=X1,fB=(B)=>B.toISOString(),q0=class extends t{constructor(B,U=!0){super(B);if(U!==!0)this.root.push(new C0({val:U}))}},D1=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:bB(U)}))}},S0=class extends t{},q2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},f2=(B,U)=>new M0({name:B,attributes:{value:{key:"w:val",value:U}}}),_2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},XG=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},O2=class extends t{constructor(B,U){super(B);this.root.push(U)}},M0=class extends t{constructor({name:B,attributes:U,children:G}){super(B);if(U)this.root.push(new $8(U));if(G)this.root.push(...G)}},c0={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},m8=(B)=>new M0({name:"w:jc",attributes:{val:{key:"w:val",value:B}}}),j0=(B,{color:U,size:G,space:Y,style:Q})=>new M0({name:B,attributes:{style:{key:"w:val",value:Q},color:{key:"w:color",value:U===void 0?void 0:C2(U)},size:{key:"w:sz",value:G===void 0?void 0:yB(G)},space:{key:"w:space",value:Y===void 0?void 0:gB(Y)}}}),c1={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},xB=class extends R2{constructor(B){super("w:pBdr");if(B.top)this.root.push(j0("w:top",B.top));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.left)this.root.push(j0("w:left",B.left));if(B.right)this.root.push(j0("w:right",B.right));if(B.between)this.root.push(j0("w:between",B.between))}},_B=class extends t{constructor(){super("w:pBdr");let B=j0("w:bottom",{color:"auto",space:1,style:c1.SINGLE,size:6});this.root.push(B)}},hB=({start:B,end:U,left:G,right:Y,hanging:Q,firstLine:K,firstLineChars:Z})=>new M0({name:"w:ind",attributes:{start:{key:"w:start",value:B===void 0?void 0:t0(B)},end:{key:"w:end",value:U===void 0?void 0:t0(U)},left:{key:"w:left",value:G===void 0?void 0:t0(G)},right:{key:"w:right",value:Y===void 0?void 0:t0(Y)},hanging:{key:"w:hanging",value:Q===void 0?void 0:E0(Q)},firstLine:{key:"w:firstLine",value:K===void 0?void 0:E0(K)},firstLineChars:{key:"w:firstLineChars",value:Z===void 0?void 0:T0(Z)}}}),uB=()=>new M0({name:"w:br"}),l8={BEGIN:"begin",END:"end",SEPARATE:"separate"},a8=(B,U)=>new M0({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:B},dirty:{key:"w:dirty",value:U}}}),e0=(B)=>a8(l8.BEGIN,B),X2=(B)=>a8(l8.SEPARATE,B),B2=(B)=>a8(l8.END,B),qG={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},MG={BOTTOM:"bottom",CENTER:"center",INSIDE:"inside",OUTSIDE:"outside",TOP:"top"},RG={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},x0={DEFAULT:"default",PRESERVE:"preserve"},_0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{space:"xml:space"})}},LG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},IG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},OG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},HG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTION")}},M1=({fill:B,color:U,type:G})=>new M0({name:"w:shd",attributes:{fill:{key:"w:fill",value:B===void 0?void 0:C2(B)},color:{key:"w:color",value:U===void 0?void 0:C2(U)},type:{key:"w:val",value:G}}}),FG={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},b0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},WG=class extends t{constructor(B){super("w:del");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},PG=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},p8={DOT:"dot"},r8=(B=p8.DOT)=>new M0({name:"w:em",attributes:{val:{key:"w:val",value:B}}}),AG=()=>r8(p8.DOT),jG=class extends t{constructor(B){super("w:spacing");this.root.push(new C0({val:t0(B)}))}},NG=class extends t{constructor(B){super("w:color");this.root.push(new C0({val:C2(B)}))}},zG=class extends t{constructor(B){super("w:highlight");this.root.push(new C0({val:B}))}},wG=class extends t{constructor(B){super("w:highlightCs");this.root.push(new C0({val:B}))}},EG=(B)=>new M0({name:"w:lang",attributes:{value:{key:"w:val",value:B.value},eastAsia:{key:"w:eastAsia",value:B.eastAsia},bidirectional:{key:"w:bidi",value:B.bidirectional}}}),T1=(B,U)=>{if(typeof B==="string"){let Y=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:Y},cs:{key:"w:cs",value:Y},eastAsia:{key:"w:eastAsia",value:Y},hAnsi:{key:"w:hAnsi",value:Y},hint:{key:"w:hint",value:U}}})}let G=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:G.ascii},cs:{key:"w:cs",value:G.cs},eastAsia:{key:"w:eastAsia",value:G.eastAsia},hAnsi:{key:"w:hAnsi",value:G.hAnsi},hint:{key:"w:hint",value:G.hint}}})},dB=(B)=>new M0({name:"w:vertAlign",attributes:{val:{key:"w:val",value:B}}}),DG=()=>dB("superscript"),TG=()=>dB("subscript"),i8={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},cB=(B=i8.SINGLE,U)=>new M0({name:"w:u",attributes:{val:{key:"w:val",value:B},color:{key:"w:color",value:U===void 0?void 0:C2(U)}}}),CG={BLINK_BACKGROUND:"blinkBackground",LIGHTS:"lights",ANTS_BLACK:"antsBlack",ANTS_RED:"antsRed",SHIMMER:"shimmer",SPARKLE:"sparkle",NONE:"none"},kG={BLACK:"black",BLUE:"blue",CYAN:"cyan",DARK_BLUE:"darkBlue",DARK_CYAN:"darkCyan",DARK_GRAY:"darkGray",DARK_GREEN:"darkGreen",DARK_MAGENTA:"darkMagenta",DARK_RED:"darkRed",DARK_YELLOW:"darkYellow",GREEN:"green",LIGHT_GRAY:"lightGray",MAGENTA:"magenta",NONE:"none",RED:"red",WHITE:"white",YELLOW:"yellow"},U2=class extends R2{constructor(B){super("w:rPr");if(!B)return;if(B.style)this.push(new q2("w:rStyle",B.style));if(B.font)if(typeof B.font==="string")this.push(T1(B.font));else if("name"in B.font)this.push(T1(B.font.name,B.font.hint));else this.push(T1(B.font));if(B.bold!==void 0)this.push(new q0("w:b",B.bold));if(B.boldComplexScript===void 0&&B.bold!==void 0||B.boldComplexScript){var U;this.push(new q0("w:bCs",(U=B.boldComplexScript)!==null&&U!==void 0?U:B.bold))}if(B.italics!==void 0)this.push(new q0("w:i",B.italics));if(B.italicsComplexScript===void 0&&B.italics!==void 0||B.italicsComplexScript){var G;this.push(new q0("w:iCs",(G=B.italicsComplexScript)!==null&&G!==void 0?G:B.italics))}if(B.smallCaps!==void 0)this.push(new q0("w:smallCaps",B.smallCaps));else if(B.allCaps!==void 0)this.push(new q0("w:caps",B.allCaps));if(B.strike!==void 0)this.push(new q0("w:strike",B.strike));if(B.doubleStrike!==void 0)this.push(new q0("w:dstrike",B.doubleStrike));if(B.emboss!==void 0)this.push(new q0("w:emboss",B.emboss));if(B.imprint!==void 0)this.push(new q0("w:imprint",B.imprint));if(B.noProof!==void 0)this.push(new q0("w:noProof",B.noProof));if(B.snapToGrid!==void 0)this.push(new q0("w:snapToGrid",B.snapToGrid));if(B.vanish)this.push(new q0("w:vanish",B.vanish));if(B.color)this.push(new NG(B.color));if(B.characterSpacing)this.push(new jG(B.characterSpacing));if(B.scale!==void 0)this.push(new _2("w:w",B.scale));if(B.kern)this.push(new D1("w:kern",B.kern));if(B.position)this.push(new q2("w:position",B.position));if(B.size!==void 0)this.push(new D1("w:sz",B.size));let Y=B.sizeComplexScript===void 0||B.sizeComplexScript===!0?B.size:B.sizeComplexScript;if(Y)this.push(new D1("w:szCs",Y));if(B.highlight)this.push(new zG(B.highlight));let Q=B.highlightComplexScript===void 0||B.highlightComplexScript===!0?B.highlight:B.highlightComplexScript;if(Q)this.push(new wG(Q));if(B.underline)this.push(cB(B.underline.type,B.underline.color));if(B.effect)this.push(new q2("w:effect",B.effect));if(B.border)this.push(j0("w:bdr",B.border));if(B.shading)this.push(M1(B.shading));if(B.subScript)this.push(TG());if(B.superScript)this.push(DG());if(B.rightToLeft!==void 0)this.push(new q0("w:rtl",B.rightToLeft));if(B.emphasisMark)this.push(r8(B.emphasisMark.type));if(B.language)this.push(EG(B.language));if(B.specVanish)this.push(new q0("w:specVanish",B.vanish));if(B.math)this.push(new q0("w:oMath",B.math));if(B.revision)this.push(new lB(B.revision))}push(B){this.root.push(B)}},mB=class extends U2{constructor(B){super(B);if(B===null||B===void 0?void 0:B.insertion)this.push(new PG(B.insertion));if(B===null||B===void 0?void 0:B.deletion)this.push(new WG(B.deletion))}},lB=class extends t{constructor(B){super("w:rPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new U2(B))}},Z1=class extends t{constructor(B){super("w:t");if(typeof B==="string")this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B);else{var U;this.root.push(new _0({space:(U=B.space)!==null&&U!==void 0?U:x0.DEFAULT})),this.root.push(B.text)}}},F2={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},D0=class extends t{constructor(B){super("w:r");if(e(this,"properties",void 0),this.properties=new U2(B),this.root.push(this.properties),B.break)for(let U=0;U{U.exports=G;function G(Y,Q){if(!Y)throw Error(Q||"Assertion failed")}G.equal=function(Q,K,Z){if(Q!=K)throw Error(Z||"Assertion failed: "+Q+" != "+K)}}),G2=R0((B)=>{var U=R1();B.inherits=W2();function G(b,c){if((b.charCodeAt(c)&64512)!==55296)return!1;if(c<0||c+1>=b.length)return!1;return(b.charCodeAt(c+1)&64512)===56320}function Y(b,c){if(Array.isArray(b))return b.slice();if(!b)return[];var D=[];if(typeof b==="string"){if(!c){var m=0;for(var B0=0;B0>6|192,D[m++]=i&63|128;else if(G(b,B0))i=65536+((i&1023)<<10)+(b.charCodeAt(++B0)&1023),D[m++]=i>>18|240,D[m++]=i>>12&63|128,D[m++]=i>>6&63|128,D[m++]=i&63|128;else D[m++]=i>>12|224,D[m++]=i>>6&63|128,D[m++]=i&63|128}}else if(c==="hex"){if(b=b.replace(/[^a-z0-9]+/gi,""),b.length%2!==0)b="0"+b;for(B0=0;B0>>24|b>>>8&65280|b<<8&16711680|(b&255)<<24)>>>0}B.htonl=K;function Z(b,c){var D="";for(var m=0;m>>0}return i}B.join32=W;function I(b,c){var D=Array(b.length*4);for(var m=0,B0=0;m>>24,D[B0+1]=i>>>16&255,D[B0+2]=i>>>8&255,D[B0+3]=i&255;else D[B0+3]=i>>>24,D[B0+2]=i>>>16&255,D[B0+1]=i>>>8&255,D[B0]=i&255}return D}B.split32=I;function H(b,c){return b>>>c|b<<32-c}B.rotr32=H;function T(b,c){return b<>>32-c}B.rotl32=T;function A(b,c){return b+c>>>0}B.sum32=A;function P(b,c,D){return b+c+D>>>0}B.sum32_3=P;function j(b,c,D,m){return b+c+D+m>>>0}B.sum32_4=j;function E(b,c,D,m,B0){return b+c+D+m+B0>>>0}B.sum32_5=E;function C(b,c,D,m){var B0=b[c],i=m+b[c+1]>>>0;b[c]=(i>>0,b[c+1]=i}B.sum64=C;function N(b,c,D,m){return(c+m>>>0>>0}B.sum64_hi=N;function v(b,c,D,m){return c+m>>>0}B.sum64_lo=v;function S(b,c,D,m,B0,i,V0,s){var G0=0,r=c;return r=r+m>>>0,G0+=r>>0,G0+=r>>0,G0+=r>>0}B.sum64_4_hi=S;function F(b,c,D,m,B0,i,V0,s){return c+m+i+s>>>0}B.sum64_4_lo=F;function M(b,c,D,m,B0,i,V0,s,G0,r){var y=0,n=c;return n=n+m>>>0,y+=n>>0,y+=n>>0,y+=n>>0,y+=n>>0}B.sum64_5_hi=M;function $(b,c,D,m,B0,i,V0,s,G0,r){return c+m+i+s+r>>>0}B.sum64_5_lo=$;function x(b,c,D){return(c<<32-D|b>>>D)>>>0}B.rotr64_hi=x;function z(b,c,D){return(b<<32-D|c>>>D)>>>0}B.rotr64_lo=z;function a(b,c,D){return b>>>D}B.shr64_hi=a;function U0(b,c,D){return(b<<32-D|c>>>D)>>>0}B.shr64_lo=U0}),L1=R0((B)=>{var U=G2(),G=R1();function Y(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}B.BlockHash=Y,Y.prototype.update=function(K,Z){if(K=U.toArray(K,Z),!this.pending)this.pending=K;else this.pending=this.pending.concat(K);if(this.pendingTotal+=K.length,this.pending.length>=this._delta8){K=this.pending;var J=K.length%this._delta8;if(this.pending=K.slice(K.length-J,K.length),this.pending.length===0)this.pending=null;K=U.join32(K,0,K.length-J,this.endian);for(var q=0;q>>24&255,q[W++]=K>>>16&255,q[W++]=K>>>8&255,q[W++]=K&255}else{q[W++]=K&255,q[W++]=K>>>8&255,q[W++]=K>>>16&255,q[W++]=K>>>24&255,q[W++]=0,q[W++]=0,q[W++]=0,q[W++]=0;for(I=8;I{var U=G2().rotr32;function G(I,H,T,A){if(I===0)return Y(H,T,A);if(I===1||I===3)return K(H,T,A);if(I===2)return Q(H,T,A)}B.ft_1=G;function Y(I,H,T){return I&H^~I&T}B.ch32=Y;function Q(I,H,T){return I&H^I&T^H&T}B.maj32=Q;function K(I,H,T){return I^H^T}B.p32=K;function Z(I){return U(I,2)^U(I,13)^U(I,22)}B.s0_256=Z;function J(I){return U(I,6)^U(I,11)^U(I,25)}B.s1_256=J;function q(I){return U(I,7)^U(I,18)^I>>>3}B.g0_256=q;function W(I){return U(I,17)^U(I,19)^I>>>10}B.g1_256=W}),SG=R0((B,U)=>{var G=G2(),Y=L1(),Q=pB(),K=G.rotl32,Z=G.sum32,J=G.sum32_5,q=Q.ft_1,W=Y.BlockHash,I=[1518500249,1859775393,2400959708,3395469782];function H(){if(!(this instanceof H))return new H;W.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}G.inherits(H,W),U.exports=H,H.blockSize=512,H.outSize=160,H.hmacStrength=80,H.padLength=64,H.prototype._update=function(A,P){var j=this.W;for(var E=0;E<16;E++)j[E]=A[P+E];for(;E{var G=G2(),Y=L1(),Q=pB(),K=R1(),Z=G.sum32,J=G.sum32_4,q=G.sum32_5,W=Q.ch32,I=Q.maj32,H=Q.s0_256,T=Q.s1_256,A=Q.g0_256,P=Q.g1_256,j=Y.BlockHash,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function C(){if(!(this instanceof C))return new C;j.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=Array(64)}G.inherits(C,j),U.exports=C,C.blockSize=512,C.outSize=256,C.hmacStrength=192,C.padLength=64,C.prototype._update=function(v,S){var F=this.W;for(var M=0;M<16;M++)F[M]=v[S+M];for(;M{var G=G2(),Y=rB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=512,Q.outSize=224,Q.hmacStrength=192,Q.padLength=64,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),iB=R0((B,U)=>{var G=G2(),Y=L1(),Q=R1(),K=G.rotr64_hi,Z=G.rotr64_lo,J=G.shr64_hi,q=G.shr64_lo,W=G.sum64,I=G.sum64_hi,H=G.sum64_lo,T=G.sum64_4_hi,A=G.sum64_4_lo,P=G.sum64_5_hi,j=G.sum64_5_lo,E=Y.BlockHash,C=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function N(){if(!(this instanceof N))return new N;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=C,this.W=Array(160)}G.inherits(N,E),U.exports=N,N.blockSize=1024,N.outSize=512,N.hmacStrength=192,N.padLength=128,N.prototype._prepareBlock=function(B0,i){var V0=this.W;for(var s=0;s<32;s++)V0[s]=B0[i+s];for(;s{var G=G2(),Y=iB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=1024,Q.outSize=384,Q.hmacStrength=192,Q.padLength=128,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),yG=R0((B)=>{B.sha1=SG(),B.sha224=bG(),B.sha256=rB(),B.sha384=vG(),B.sha512=iB()}),gG=R0((B)=>{var U=G2(),G=L1(),Y=U.rotl32,Q=U.sum32,K=U.sum32_3,Z=U.sum32_4,J=G.BlockHash;function q(){if(!(this instanceof q))return new q;J.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}U.inherits(q,J),B.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(C,N){var v=this.h[0],S=this.h[1],F=this.h[2],M=this.h[3],$=this.h[4],x=v,z=S,a=F,U0=M,b=$;for(var c=0;c<80;c++){var D=Q(Y(Z(v,W(c,S,F,M),C[T[c]+N],I(c)),P[c]),$);v=$,$=M,M=Y(F,10),F=S,S=D,D=Q(Y(Z(x,W(79-c,z,a,U0),C[A[c]+N],H(c)),j[c]),b),x=b,b=U0,U0=Y(a,10),a=z,z=D}D=K(this.h[1],F,U0),this.h[1]=K(this.h[2],M,b),this.h[2]=K(this.h[3],$,x),this.h[3]=K(this.h[4],v,z),this.h[4]=K(this.h[0],S,a),this.h[0]=D},q.prototype._digest=function(C){if(C==="hex")return U.toHex32(this.h,"little");else return U.split32(this.h,"little")};function W(E,C,N,v){if(E<=15)return C^N^v;else if(E<=31)return C&N|~C&v;else if(E<=47)return(C|~N)^v;else if(E<=63)return C&v|N&~v;else return C^(N|~v)}function I(E){if(E<=15)return 0;else if(E<=31)return 1518500249;else if(E<=47)return 1859775393;else if(E<=63)return 2400959708;else return 2840853838}function H(E){if(E<=15)return 1352829926;else if(E<=31)return 1548603684;else if(E<=47)return 1836072691;else if(E<=63)return 2053994217;else return 0}var T=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],A=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],P=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],j=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),fG=R0((B,U)=>{var G=G2(),Y=R1();function Q(K,Z,J){if(!(this instanceof Q))return new Q(K,Z,J);this.Hash=K,this.blockSize=K.blockSize/8,this.outSize=K.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(Z,J))}U.exports=Q,Q.prototype._init=function(Z){if(Z.length>this.blockSize)Z=new this.Hash().update(Z).digest();Y(Z.length<=this.blockSize);for(var J=Z.length;J{var U=B;U.utils=G2(),U.common=L1(),U.sha=yG(),U.ripemd=gG(),U.hmac=fG(),U.sha1=U.sha.sha1,U.sha256=U.sha.sha256,U.sha224=U.sha.sha224,U.sha384=U.sha.sha384,U.sha512=U.sha.sha512,U.ripemd160=U.ripemd.ripemd160})(),1),_G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",hG=(B,U=21)=>{return(G=U)=>{let Y="",Q=G|0;while(Q--)Y+=B[Math.random()*B.length|0];return Y}},uG=(B=21)=>{let U="",G=B|0;while(G--)U+=_G[Math.random()*64|0];return U},dG=(B)=>Math.floor(B/25.4*72*20),u0=(B)=>Math.floor(B*72*20),I1=(B=0)=>{let U=B;return()=>++U},nB=()=>I1(),sB=()=>I1(1),oB=()=>I1(),tB=()=>I1(),O1=()=>uG().toLowerCase(),P8=(B)=>xG.default.sha1().update(B instanceof ArrayBuffer?new Uint8Array(B):B).digest("hex"),s2=(B)=>hG("1234567890abcdef",B)(),eB=()=>`${s2(8)}-${s2(4)}-${s2(4)}-${s2(4)}-${s2(12)}`,U1=(B)=>new Uint8Array(new TextEncoder().encode(B)),B4={CHARACTER:"character",COLUMN:"column",INSIDE_MARGIN:"insideMargin",LEFT_MARGIN:"leftMargin",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",RIGHT_MARGIN:"rightMargin"},U4={BOTTOM_MARGIN:"bottomMargin",INSIDE_MARGIN:"insideMargin",LINE:"line",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",PARAGRAPH:"paragraph",TOP_MARGIN:"topMargin"},G4=()=>new M0({name:"wp:simplePos",attributes:{x:{key:"x",value:0},y:{key:"y",value:0}}}),Y4=(B)=>new M0({name:"wp:align",children:[B]}),Z4=(B)=>new M0({name:"wp:posOffset",children:[B.toString()]}),Q4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionH",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:B4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),J4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionV",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:U4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),cG=function(B){return B.CENTER="ctr",B.TOP="t",B.BOTTOM="b",B}({}),K4=(B={})=>{var U,G,Y,Q;return new M0({name:"wps:bodyPr",attributes:{lIns:{key:"lIns",value:(U=B.margins)===null||U===void 0?void 0:U.left},rIns:{key:"rIns",value:(G=B.margins)===null||G===void 0?void 0:G.right},tIns:{key:"tIns",value:(Y=B.margins)===null||Y===void 0?void 0:Y.top},bIns:{key:"bIns",value:(Q=B.margins)===null||Q===void 0?void 0:Q.bottom},anchor:{key:"anchor",value:B.verticalAnchor}},children:[...B.noAutoFit?[new q0("a:noAutofit",B.noAutoFit)]:[]]})},mG=(B={txBox:"1"})=>new M0({name:"wps:cNvSpPr",attributes:{txBox:{key:"txBox",value:B.txBox}}}),lG=(B)=>new M0({name:"w:txbxContent",children:[...B]}),aG=(B)=>new M0({name:"wps:txbx",children:[lG(B)]}),pG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{cx:"cx",cy:"cy"})}},rG=class extends t{constructor(B,U){super("a:ext");e(this,"attributes",void 0),this.attributes=new pG({cx:B,cy:U}),this.root.push(this.attributes)}},iG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{x:"x",y:"y"})}},nG=class extends t{constructor(B,U){super("a:off");this.root.push(new iG({x:B!==null&&B!==void 0?B:0,y:U!==null&&U!==void 0?U:0}))}},sG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{flipVertical:"flipV",flipHorizontal:"flipH",rotation:"rot"})}},V4=class extends t{constructor(B){var U,G,Y,Q;super("a:xfrm");e(this,"extents",void 0),e(this,"offset",void 0),this.root.push(new sG({flipVertical:(U=B.flip)===null||U===void 0?void 0:U.vertical,flipHorizontal:(G=B.flip)===null||G===void 0?void 0:G.horizontal,rotation:B.rotation})),this.offset=new nG((Y=B.offset)===null||Y===void 0||(Y=Y.emus)===null||Y===void 0?void 0:Y.x,(Q=B.offset)===null||Q===void 0||(Q=Q.emus)===null||Q===void 0?void 0:Q.y),this.extents=new rG(B.emus.x,B.emus.y),this.root.push(this.offset),this.root.push(this.extents)}},X4=()=>new M0({name:"a:noFill"}),oG=(B)=>new M0({name:"a:srgbClr",attributes:{value:{key:"val",value:B.value}}}),tG=(B)=>new M0({name:"a:schemeClr",attributes:{value:{key:"val",value:B.value}}}),A8=(B)=>new M0({name:"a:solidFill",children:[B.type==="rgb"?oG(B):tG(B)]}),eG=(B)=>new M0({name:"a:ln",attributes:{width:{key:"w",value:B.width},cap:{key:"cap",value:B.cap},compoundLine:{key:"cmpd",value:B.compoundLine},align:{key:"algn",value:B.align}},children:[B.type==="noFill"?X4():B.solidFillType==="rgb"?A8({type:"rgb",value:B.value}):A8({type:"scheme",value:B.value})]}),BY=class extends t{constructor(){super("a:avLst")}},UY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{prst:"prst"})}},GY=class extends t{constructor(){super("a:prstGeom");this.root.push(new UY({prst:"rect"})),this.root.push(new BY)}},YY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{bwMode:"bwMode"})}},q4=class extends t{constructor({element:B,outline:U,solidFill:G,transform:Y}){super(`${B}:spPr`);if(e(this,"form",void 0),this.root.push(new YY({bwMode:"auto"})),this.form=new V4(Y),this.root.push(this.form),this.root.push(new GY),U)this.root.push(X4()),this.root.push(eG(U));if(G)this.root.push(A8(G))}},l6=(B)=>new M0({name:"wps:wsp",children:[mG(B.nonVisualProperties),new q4({element:"wps",transform:B.transformation,outline:B.outline,solidFill:B.solidFill}),aG(B.children),K4(B.bodyProperties)]}),K8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{uri:"uri"})}},ZY=(B)=>new M0({name:"asvg:svgBlip",attributes:{asvg:{key:"xmlns:asvg",value:"http://schemas.microsoft.com/office/drawing/2016/SVG/main"},embed:{key:"r:embed",value:`rId{${B.fileName}}`}}}),QY=(B)=>new M0({name:"a:ext",attributes:{uri:{key:"uri",value:"{96DAC541-7B7A-43D3-8B79-37D633B846F1}"}},children:[ZY(B)]}),JY=(B)=>new M0({name:"a:extLst",children:[QY(B)]}),KY=(B)=>new M0({name:"a:blip",attributes:{embed:{key:"r:embed",value:`rId{${B.type==="svg"?B.fallback.fileName:B.fileName}}`},cstate:{key:"cstate",value:"none"}},children:B.type==="svg"?[JY(B)]:[]}),VY=class extends t{constructor(){super("a:srcRect")}},XY=class extends t{constructor(){super("a:fillRect")}},qY=class extends t{constructor(){super("a:stretch");this.root.push(new XY)}},MY=class extends t{constructor(B){super("pic:blipFill");this.root.push(KY(B)),this.root.push(new VY),this.root.push(new qY)}},RY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{noChangeAspect:"noChangeAspect",noChangeArrowheads:"noChangeArrowheads"})}},LY=class extends t{constructor(){super("a:picLocks");this.root.push(new RY({noChangeAspect:1,noChangeArrowheads:1}))}},IY=class extends t{constructor(){super("pic:cNvPicPr");this.root.push(new LY)}},M4=(B,U)=>new M0({name:"a:hlinkClick",attributes:L0(L0({},U?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${B}`}})}),OY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"id",name:"name",descr:"descr"})}},HY=class extends t{constructor(){super("pic:cNvPr");this.root.push(new OY({id:0,name:"",descr:""}))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!1));break}return super.prepForXml(B)}},FY=class extends t{constructor(){super("pic:nvPicPr");this.root.push(new HY),this.root.push(new IY)}},WY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:pic"})}},a6=class extends t{constructor({mediaData:B,transform:U,outline:G}){super("pic:pic");this.root.push(new WY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/picture"})),this.root.push(new FY),this.root.push(new MY(B)),this.root.push(new q4({element:"pic",transform:U,outline:G}))}},PY=(B)=>new M0({name:"wpg:grpSpPr",children:[new V4(B)]}),AY=()=>new M0({name:"wpg:cNvGrpSpPr"}),jY=(B)=>new M0({name:"wpg:wgp",children:[AY(),PY(B.transformation),...B.children]}),NY=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphicData");if(B.type==="wps"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));let Q=l6(L0(L0({},B.data),{},{transformation:U,outline:G,solidFill:Y}));this.root.push(Q)}else if(B.type==="wpg"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"}));let Q=jY({children:B.children.map((K)=>{if(K.type==="wps")return l6(L0(L0({},K.data),{},{transformation:K.transformation,outline:K.outline,solidFill:K.solidFill}));else return new a6({mediaData:K,transform:K.transformation,outline:K.outline})}),transformation:U});this.root.push(Q)}else{this.root.push(new K8({uri:"http://schemas.openxmlformats.org/drawingml/2006/picture"}));let Q=new a6({mediaData:B,transform:U,outline:G});this.root.push(Q)}}},zY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{a:"xmlns:a"})}},R4=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphic");e(this,"data",void 0),this.root.push(new zY({a:"http://schemas.openxmlformats.org/drawingml/2006/main"})),this.data=new NY({mediaData:B,transform:U,outline:G,solidFill:Y}),this.root.push(this.data)}},e2={NONE:0,SQUARE:1,TIGHT:2,TOP_AND_BOTTOM:3},L4={BOTH_SIDES:"bothSides",LEFT:"left",RIGHT:"right",LARGEST:"largest"},j8=()=>new M0({name:"wp:wrapNone"}),I4=(B,U={top:0,bottom:0,left:0,right:0})=>new M0({name:"wp:wrapSquare",attributes:{wrapText:{key:"wrapText",value:B.side||L4.BOTH_SIDES},distT:{key:"distT",value:U.top},distB:{key:"distB",value:U.bottom},distL:{key:"distL",value:U.left},distR:{key:"distR",value:U.right}}}),O4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTight",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),H4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTopAndBottom",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),F4=class extends t{constructor({name:B,description:U,title:G,id:Y}={name:"",description:"",title:""}){super("wp:docPr");e(this,"docPropertiesUniqueNumericId",oB());let Q={id:{key:"id",value:Y!==null&&Y!==void 0?Y:this.docPropertiesUniqueNumericId()},name:{key:"name",value:B}};if(U!==null&&U!==void 0)Q.description={key:"descr",value:U};if(G!==null&&G!==void 0)Q.title={key:"title",value:G};this.root.push(new $8(Q))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!0));break}return super.prepForXml(B)}},W4=({top:B,right:U,bottom:G,left:Y})=>new M0({name:"wp:effectExtent",attributes:{top:{key:"t",value:B},right:{key:"r",value:U},bottom:{key:"b",value:G},left:{key:"l",value:Y}}}),P4=({x:B,y:U})=>new M0({name:"wp:extent",attributes:{x:{key:"cx",value:B},y:{key:"cy",value:U}}}),wY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:a",noChangeAspect:"noChangeAspect"})}},EY=class extends t{constructor(){super("a:graphicFrameLocks");this.root.push(new wY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/main",noChangeAspect:1}))}},A4=()=>new M0({name:"wp:cNvGraphicFramePr",children:[new EY]}),DY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{distT:"distT",distB:"distB",distL:"distL",distR:"distR",allowOverlap:"allowOverlap",behindDoc:"behindDoc",layoutInCell:"layoutInCell",locked:"locked",relativeHeight:"relativeHeight",simplePos:"simplePos"})}},TY=class extends t{constructor({mediaData:B,transform:U,drawingOptions:G}){super("wp:anchor");let Y=L0({allowOverlap:!0,behindDocument:!1,lockAnchor:!1,layoutInCell:!0,verticalPosition:{},horizontalPosition:{}},G.floating);if(this.root.push(new DY({distT:Y.margins?Y.margins.top||0:0,distB:Y.margins?Y.margins.bottom||0:0,distL:Y.margins?Y.margins.left||0:0,distR:Y.margins?Y.margins.right||0:0,simplePos:"0",allowOverlap:Y.allowOverlap===!0?"1":"0",behindDoc:Y.behindDocument===!0?"1":"0",locked:Y.lockAnchor===!0?"1":"0",layoutInCell:Y.layoutInCell===!0?"1":"0",relativeHeight:Y.zIndex?Y.zIndex:U.emus.y})),this.root.push(G4()),this.root.push(Q4(Y.horizontalPosition)),this.root.push(J4(Y.verticalPosition)),this.root.push(P4({x:U.emus.x,y:U.emus.y})),this.root.push(W4({top:0,right:0,bottom:0,left:0})),G.floating!==void 0&&G.floating.wrap!==void 0)switch(G.floating.wrap.type){case e2.SQUARE:this.root.push(I4(G.floating.wrap,G.floating.margins));break;case e2.TIGHT:this.root.push(O4(G.floating.margins));break;case e2.TOP_AND_BOTTOM:this.root.push(H4(G.floating.margins));break;case e2.NONE:default:this.root.push(j8())}else this.root.push(j8());this.root.push(new F4(G.docProperties)),this.root.push(A4()),this.root.push(new R4({mediaData:B,transform:U,outline:G.outline,solidFill:G.solidFill}))}},CY=({mediaData:B,transform:U,docProperties:G,outline:Y,solidFill:Q})=>{var K,Z,J,q;return new M0({name:"wp:inline",attributes:{distanceTop:{key:"distT",value:0},distanceBottom:{key:"distB",value:0},distanceLeft:{key:"distL",value:0},distanceRight:{key:"distR",value:0}},children:[P4({x:U.emus.x,y:U.emus.y}),W4(Y?{top:((K=Y.width)!==null&&K!==void 0?K:9525)*2,right:((Z=Y.width)!==null&&Z!==void 0?Z:9525)*2,bottom:((J=Y.width)!==null&&J!==void 0?J:9525)*2,left:((q=Y.width)!==null&&q!==void 0?q:9525)*2}:{top:0,right:0,bottom:0,left:0}),new F4(G),A4(),new R4({mediaData:B,transform:U,outline:Y,solidFill:Q})]})},m1=class extends t{constructor(B,U={}){super("w:drawing");if(!U.floating)this.root.push(CY({mediaData:B,transform:B.transformation,docProperties:U.docProperties,outline:U.outline,solidFill:U.solidFill}));else this.root.push(new TY({mediaData:B,transform:B.transformation,drawingOptions:U}))}},kY=(B)=>{let U=B.indexOf(";base64,"),G=U===-1?0:U+8;return new Uint8Array(atob(B.substring(G)).split("").map((Y)=>Y.charCodeAt(0)))},j4=(B)=>typeof B==="string"?kY(B):B,V8=(B,U)=>({data:j4(B.data),fileName:U,transformation:{pixels:{x:Math.round(B.transformation.width),y:Math.round(B.transformation.height)},emus:{x:Math.round(B.transformation.width*9525),y:Math.round(B.transformation.height*9525)},flip:B.transformation.flip,rotation:B.transformation.rotation?B.transformation.rotation*60000:void 0}}),$Y=class extends t{constructor(B){var U=(...Z)=>(super(...Z),e(this,"imageData",void 0),this);let G=`${P8(B.data)}.${B.type}`,Y=B.type==="svg"?L0(L0({type:B.type},V8(B,G)),{},{fallback:L0({type:B.fallback.type},V8(L0(L0({},B.fallback),{},{transformation:B.transformation}),`${P8(B.fallback.data)}.${B.fallback.type}`))}):L0({type:B.type},V8(B,G)),Q=new m1(Y,{floating:B.floating,docProperties:B.altText,outline:B.outline}),K=new D0({children:[Q]});if(B.insertion)U("w:ins"),this.root.push(new b0({id:B.insertion.id,author:B.insertion.author,date:B.insertion.date})),this.addChildElement(K);else if(B.deletion)U("w:del"),this.root.push(new b0({id:B.deletion.id,author:B.deletion.author,date:B.deletion.date})),this.addChildElement(K);else U("w:r"),this.root.push(new U2({})),this.root.push(Q);this.imageData=Y}prepForXml(B){if(B.file.Media.addImage(this.imageData.fileName,this.imageData),this.imageData.type==="svg")B.file.Media.addImage(this.imageData.fallback.fileName,this.imageData.fallback);return super.prepForXml(B)}},n8=(B)=>{var U,G,Y,Q,K,Z,J,q;return{offset:{pixels:{x:Math.round((U=(G=B.offset)===null||G===void 0?void 0:G.left)!==null&&U!==void 0?U:0),y:Math.round((Y=(Q=B.offset)===null||Q===void 0?void 0:Q.top)!==null&&Y!==void 0?Y:0)},emus:{x:Math.round(((K=(Z=B.offset)===null||Z===void 0?void 0:Z.left)!==null&&K!==void 0?K:0)*9525),y:Math.round(((J=(q=B.offset)===null||q===void 0?void 0:q.top)!==null&&J!==void 0?J:0)*9525)}},pixels:{x:Math.round(B.width),y:Math.round(B.height)},emus:{x:Math.round(B.width*9525),y:Math.round(B.height*9525)},flip:B.flip,rotation:B.rotation?B.rotation*60000:void 0}},SY=class extends D0{constructor(B){super({});e(this,"wpsShapeData",void 0),this.wpsShapeData={type:B.type,transformation:n8(B.transformation),data:L0({},B)};let U=new m1(this.wpsShapeData,{floating:B.floating,docProperties:B.altText,outline:B.outline,solidFill:B.solidFill});this.root.push(U)}},bY=class extends D0{constructor(B){super({});e(this,"wpgGroupData",void 0),e(this,"mediaDatas",void 0),this.wpgGroupData={type:B.type,transformation:n8(B.transformation),children:B.children};let U=new m1(this.wpgGroupData,{floating:B.floating,docProperties:B.altText});this.mediaDatas=B.children.filter((G)=>G.type!=="wps").map((G)=>G),this.root.push(U)}prepForXml(B){return this.mediaDatas.forEach((U)=>{if(B.file.Media.addImage(U.fileName,U),U.type==="svg")B.file.Media.addImage(U.fallback.fileName,U.fallback)}),super.prepForXml(B)}},vY=class extends t{constructor(B){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(`SEQ ${B}`)}},yY=class extends D0{constructor(B){super({});this.root.push(e0(!0)),this.root.push(new vY(B)),this.root.push(X2()),this.root.push(B2())}},gY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{instr:"w:instr"})}},s8=class extends t{constructor(B,U){super("w:fldSimple");if(this.root.push(new gY({instr:B})),U!==void 0)this.root.push(new Q1(U))}},fY=class extends s8{constructor(B){super(` MERGEFIELD ${B} `,`«${B}»`)}},xY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},N4={EXTERNAL:"External"},_Y=(B,U,G,Y)=>new M0({name:"Relationship",attributes:{id:{key:"Id",value:B},type:{key:"Type",value:U},target:{key:"Target",value:G},targetMode:{key:"TargetMode",value:Y}}}),A2=class extends t{constructor(){super("Relationships");this.root.push(new xY({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(B,U,G,Y){this.root.push(_Y(`rId${B}`,U,G,Y))}get RelationshipCount(){return this.root.length-1}},hY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},o8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},uY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}},dY=class extends t{constructor(B){super("w:commentRangeStart");this.root.push(new o8({id:B}))}},cY=class extends t{constructor(B){super("w:commentRangeEnd");this.root.push(new o8({id:B}))}},mY=class extends t{constructor(B){super("w:commentReference");this.root.push(new o8({id:B}))}},N8=class extends t{constructor({id:B,initials:U,author:G,date:Y=new Date,children:Q},K){super("w:comment");e(this,"paraId",void 0),this.paraId=K,this.root.push(new hY({id:B,initials:U,author:G,date:Y.toISOString()}));for(let Z of Q)this.root.push(Z)}prepForXml(B){let U=super.prepForXml(B);if(!U||!this.paraId)return U;let G=U["w:comment"];if(!Array.isArray(G))return U;for(let Y=G.length-1;Y>=0;Y--){let Q=G[Y];if(Q&&typeof Q==="object"&&"w:p"in Q){let K=Q["w:p"];if(Array.isArray(K))K.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return U}},z4=(B)=>(B+1).toString(16).toUpperCase().padStart(8,"0"),w4=class extends t{constructor({children:B}){super("w:comments");if(e(this,"relationships",void 0),e(this,"threadData",void 0),this.root.push(new uY({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"})),B.some((U)=>U.parentId!==void 0)){let U=new Map(B.map((G)=>[G.id,z4(G.id)]));for(let G of B)this.root.push(new N8(G,U.get(G.id)));this.threadData=B.map((G)=>({paraId:U.get(G.id),parentParaId:G.parentId!==void 0?U.get(G.parentId):void 0,done:G.resolved}))}else for(let U of B)this.root.push(new N8(U));this.relationships=new A2}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}},lY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},aY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},pY=class extends t{constructor(B){super("w15:commentEx");this.root.push(new aY({paraId:B.paraId,paraIdParent:B.parentParaId,done:B.done!==void 0?B.done?"1":"0":void 0}))}},E4=class extends t{constructor(B){super("w15:commentsEx");this.root.push(new lY({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let U of B)this.root.push(new pY(U))}},rY=class extends S0{constructor(){super("w:noBreakHyphen")}},iY=class extends S0{constructor(){super("w:softHyphen")}},nY=class extends S0{constructor(){super("w:dayShort")}},sY=class extends S0{constructor(){super("w:monthShort")}},oY=class extends S0{constructor(){super("w:yearShort")}},tY=class extends S0{constructor(){super("w:dayLong")}},eY=class extends S0{constructor(){super("w:monthLong")}},BZ=class extends S0{constructor(){super("w:yearLong")}},UZ=class extends S0{constructor(){super("w:annotationRef")}},GZ=class extends S0{constructor(){super("w:footnoteRef")}},D4=class extends S0{constructor(){super("w:endnoteRef")}},YZ=class extends S0{constructor(){super("w:separator")}},ZZ=class extends S0{constructor(){super("w:continuationSeparator")}},QZ=class extends S0{constructor(){super("w:pgNum")}},JZ=class extends S0{constructor(){super("w:cr")}},T4=class extends S0{constructor(){super("w:tab")}},KZ=class extends S0{constructor(){super("w:lastRenderedPageBreak")}},VZ={LEFT:"left",CENTER:"center",RIGHT:"right"},XZ={MARGIN:"margin",INDENT:"indent"},qZ={NONE:"none",DOT:"dot",HYPHEN:"hyphen",UNDERSCORE:"underscore",MIDDLE_DOT:"middleDot"},MZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{alignment:"w:alignment",relativeTo:"w:relativeTo",leader:"w:leader"})}},RZ=class extends t{constructor(B){super("w:ptab");this.root.push(new MZ({alignment:B.alignment,relativeTo:B.relativeTo,leader:B.leader}))}},C4={COLUMN:"column",PAGE:"page"},k4=class extends t{constructor(B){super("w:br");this.root.push(new C0({type:B}))}},LZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.PAGE))}},IZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.COLUMN))}},$4=class extends t{constructor(){super("w:pageBreakBefore")}},k2={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},S4=({after:B,before:U,line:G,lineRule:Y,beforeAutoSpacing:Q,afterAutoSpacing:K})=>new M0({name:"w:spacing",attributes:{after:{key:"w:after",value:B},before:{key:"w:before",value:U},line:{key:"w:line",value:G},lineRule:{key:"w:lineRule",value:Y},beforeAutoSpacing:{key:"w:beforeAutospacing",value:Q},afterAutoSpacing:{key:"w:afterAutospacing",value:K}}}),OZ={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},x2=(B)=>new M0({name:"w:pStyle",attributes:{val:{key:"w:val",value:B}}}),z8={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},HZ={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},FZ={MAX:9026},b4=({type:B,position:U,leader:G})=>new M0({name:"w:tab",attributes:{val:{key:"w:val",value:B},pos:{key:"w:pos",value:U},leader:{key:"w:leader",value:G}}}),v4=(B)=>new M0({name:"w:tabs",children:B.map((U)=>b4(U))}),C1=class extends t{constructor(B,U){super("w:numPr");this.root.push(new WZ(U)),this.root.push(new PZ(B))}},WZ=class extends t{constructor(B){super("w:ilvl");if(B>9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new C0({val:B}))}},PZ=class extends t{constructor(B){super("w:numId");this.root.push(new C0({val:typeof B==="string"?`{${B}}`:B}))}},H1=class extends t{constructor(...B){super(...B);e(this,"fileChild",Symbol())}},AZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},jZ={INTERNAL:"INTERNAL",EXTERNAL:"EXTERNAL"},m2=class extends t{constructor(B,U,G){super("w:hyperlink");e(this,"linkId",void 0),this.linkId=U;let Y=new AZ({history:1,anchor:G?G:void 0,id:!G?`rId${this.linkId}`:void 0});this.root.push(Y),B.forEach((Q)=>{this.root.push(Q)})}},y4=class extends m2{constructor(B){super(B.children,O1(),B.anchor)}},t8=class extends t{constructor(B){super("w:externalHyperlink");e(this,"options",void 0),this.options=B}},NZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",name:"w:name"})}},zZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},g4=class{constructor(B){e(this,"bookmarkUniqueNumericId",tB()),e(this,"start",void 0),e(this,"children",void 0),e(this,"end",void 0);let U=this.bookmarkUniqueNumericId();this.start=new f4(B.id,U),this.children=B.children,this.end=new x4(U)}},f4=class extends t{constructor(B,U){super("w:bookmarkStart");let G=new NZ({name:B,id:U});this.root.push(G)}},x4=class extends t{constructor(B){super("w:bookmarkEnd");let U=new zZ({id:B});this.root.push(U)}},wZ=function(B){return B.NONE="none",B.RELATIVE="relative",B.NO_CONTEXT="no_context",B.FULL_CONTEXT="full_context",B}({}),EZ={["relative"]:"\\r",["no_context"]:"\\n",["full_context"]:"\\w",["none"]:void 0},DZ=class extends s8{constructor(B,U,G={}){let{hyperlink:Y=!0,referenceFormat:Q="full_context"}=G,K=`${`REF ${B}`} ${[...Y?["\\h"]:[],...[EZ[Q]].filter((Z)=>!!Z)].join(" ")}`;super(K,U)}},_4=(B)=>new M0({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:B}}}),TZ=class extends t{constructor(B,U={}){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE}));let G=`PAGEREF ${B}`;if(U.hyperlink)G=`${G} \\h`;if(U.useRelativePosition)G=`${G} \\p`;this.root.push(G)}},CZ=class extends D0{constructor(B,U={}){super({children:[e0(!0),new TZ(B,U),B2()]})}},kZ={ANSI:"00",DEFAULT:"01",SYMBOL:"02",MAC:"4D",JIS:"80",HANGUL:"81",JOHAB:"82",GB_2312:"86",CHINESEBIG5:"88",GREEK:"A1",TURKISH:"A2",VIETNAMESE:"A3",HEBREW:"B1",ARABIC:"B2",BALTIC:"BA",RUSSIAN:"CC",THAI:"DE",EASTEUROPE:"EE",OEM:"FF"},E1=({id:B,fontKey:U,subsetted:G},Y)=>new M0({name:Y,attributes:L0({id:{key:"r:id",value:B}},U?{fontKey:{key:"w:fontKey",value:`{${U}}`}}:{}),children:[...G?[new q0("w:subsetted",G)]:[]]}),$Z=({name:B,altName:U,panose1:G,charset:Y,family:Q,notTrueType:K,pitch:Z,sig:J,embedRegular:q,embedBold:W,embedItalic:I,embedBoldItalic:H})=>new M0({name:"w:font",attributes:{name:{key:"w:name",value:B}},children:[...U?[f2("w:altName",U)]:[],...G?[f2("w:panose1",G)]:[],...Y?[f2("w:charset",Y)]:[],...Q?[f2("w:family",Q)]:[],...K?[new q0("w:notTrueType",K)]:[],...Z?[f2("w:pitch",Z)]:[],...J?[new M0({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:J.usb0},usb1:{key:"w:usb1",value:J.usb1},usb2:{key:"w:usb2",value:J.usb2},usb3:{key:"w:usb3",value:J.usb3},csb0:{key:"w:csb0",value:J.csb0},csb1:{key:"w:csb1",value:J.csb1}}})]:[],...q?[E1(q,"w:embedRegular")]:[],...W?[E1(W,"w:embedBold")]:[],...I?[E1(I,"w:embedItalic")]:[],...H?[E1(H,"w:embedBoldItalic")]:[]]}),SZ=({name:B,index:U,fontKey:G,characterSet:Y})=>$Z({name:B,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:Y,family:"auto",pitch:"variable",embedRegular:{fontKey:G,id:`rId${U}`}}),bZ=(B)=>new M0({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:B.map((U,G)=>SZ({name:U.name,index:G+1,fontKey:U.fontKey,characterSet:U.characterSet}))}),h4=class{constructor(B){e(this,"options",void 0),e(this,"fontTable",void 0),e(this,"relationships",void 0),e(this,"fontOptionsWithKey",[]),this.options=B,this.fontOptionsWithKey=B.map((U)=>L0(L0({},U),{},{fontKey:eB()})),this.fontTable=bZ(this.fontOptionsWithKey),this.relationships=new A2;for(let U=0;Unew M0({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),yZ={NONE:"none",DROP:"drop",MARGIN:"margin"},gZ={MARGIN:"margin",PAGE:"page",TEXT:"text"},fZ={AROUND:"around",AUTO:"auto",NONE:"none",NOT_BESIDE:"notBeside",THROUGH:"through",TIGHT:"tight"},u4=(B)=>{var U,G;return new M0({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:B.anchorLock},dropCap:{key:"w:dropCap",value:B.dropCap},width:{key:"w:w",value:B.width},height:{key:"w:h",value:B.height},x:{key:"w:x",value:B.position?B.position.x:void 0},y:{key:"w:y",value:B.position?B.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:B.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:B.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(U=B.space)===null||U===void 0?void 0:U.horizontal},spaceVertical:{key:"w:vSpace",value:(G=B.space)===null||G===void 0?void 0:G.vertical},rule:{key:"w:hRule",value:B.rule},alignmentX:{key:"w:xAlign",value:B.alignment?B.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:B.alignment?B.alignment.y:void 0},lines:{key:"w:lines",value:B.lines},wrap:{key:"w:wrap",value:B.wrap}}})},M2=class extends R2{constructor(B){super("w:pPr",B===null||B===void 0?void 0:B.includeIfEmpty);if(e(this,"numberingReferences",[]),!B)return this;if(B.heading)this.push(x2(B.heading));if(B.bullet)this.push(x2("ListParagraph"));if(B.numbering){if(!B.style&&!B.heading){if(!B.numbering.custom)this.push(x2("ListParagraph"))}}if(B.style)this.push(x2(B.style));if(B.keepNext!==void 0)this.push(new q0("w:keepNext",B.keepNext));if(B.keepLines!==void 0)this.push(new q0("w:keepLines",B.keepLines));if(B.pageBreakBefore)this.push(new $4);if(B.frame)this.push(u4(B.frame));if(B.widowControl!==void 0)this.push(new q0("w:widowControl",B.widowControl));if(B.bullet)this.push(new C1(1,B.bullet.level));if(B.numbering){var U,G;this.numberingReferences.push({reference:B.numbering.reference,instance:(U=B.numbering.instance)!==null&&U!==void 0?U:0}),this.push(new C1(`${B.numbering.reference}-${(G=B.numbering.instance)!==null&&G!==void 0?G:0}`,B.numbering.level))}else if(B.numbering===!1)this.push(new C1(0,0));if(B.border)this.push(new xB(B.border));if(B.thematicBreak)this.push(new _B);if(B.shading)this.push(M1(B.shading));if(B.wordWrap)this.push(vZ());if(B.overflowPunctuation)this.push(new q0("w:overflowPunct",B.overflowPunctuation));let Y=[...B.rightTabStop!==void 0?[{type:z8.RIGHT,position:B.rightTabStop}]:[],...B.tabStops?B.tabStops:[],...B.leftTabStop!==void 0?[{type:z8.LEFT,position:B.leftTabStop}]:[]];if(Y.length>0)this.push(v4(Y));if(B.bidirectional!==void 0)this.push(new q0("w:bidi",B.bidirectional));if(B.spacing)this.push(S4(B.spacing));if(B.indent)this.push(hB(B.indent));if(B.contextualSpacing!==void 0)this.push(new q0("w:contextualSpacing",B.contextualSpacing));if(B.alignment)this.push(m8(B.alignment));if(B.outlineLevel!==void 0)this.push(_4(B.outlineLevel));if(B.suppressLineNumbers!==void 0)this.push(new q0("w:suppressLineNumbers",B.suppressLineNumbers));if(B.autoSpaceEastAsianText!==void 0)this.push(new q0("w:autoSpaceDN",B.autoSpaceEastAsianText));if(B.run)this.push(new mB(B.run));if(B.revision)this.push(new d4(B.revision))}push(B){this.root.push(B)}prepForXml(B){if(!(B.viewWrapper instanceof h4))for(let U of this.numberingReferences)B.file.Numbering.createConcreteNumberingInstance(U.reference,U.instance);return super.prepForXml(B)}},d4=class extends t{constructor(B){super("w:pPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new M2(L0(L0({},B),{},{includeIfEmpty:!0})))}},d0=class extends H1{constructor(B){super("w:p");if(e(this,"properties",void 0),typeof B==="string")return this.properties=new M2({}),this.root.push(this.properties),this.root.push(new Q1(B)),this;if(this.properties=new M2(B),this.root.push(this.properties),B.text)this.root.push(new Q1(B.text));if(B.children)for(let U of B.children){if(U instanceof g4){this.root.push(U.start);for(let G of U.children)this.root.push(G);this.root.push(U.end);continue}this.root.push(U)}}prepForXml(B){for(let U of this.root)if(U instanceof t8){let G=this.root.indexOf(U),Y=new m2(U.options.children,O1());B.viewWrapper.Relationships.addRelationship(Y.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",U.options.link,N4.EXTERNAL),this.root[G]=Y}return super.prepForXml(B)}addRunToFront(B){return this.root.splice(1,0,B),this}},xZ=class extends t{constructor(B){super("m:oMath");for(let U of B.children)this.root.push(U)}},_Z=class extends t{constructor(B){super("m:t");this.root.push(B)}},hZ=class extends t{constructor(B){super("m:r");this.root.push(new _Z(B))}},c4=class extends t{constructor(B){super("m:den");for(let U of B)this.root.push(U)}},m4=class extends t{constructor(B){super("m:num");for(let U of B)this.root.push(U)}},uZ=class extends t{constructor(B){super("m:f");this.root.push(new m4(B.numerator)),this.root.push(new c4(B.denominator))}},l4=({accent:B})=>new M0({name:"m:chr",attributes:{accent:{key:"m:val",value:B}}}),y0=({children:B})=>new M0({name:"m:e",children:B}),a4=({value:B})=>new M0({name:"m:limLoc",attributes:{value:{key:"m:val",value:B||"undOvr"}}}),dZ=()=>new M0({name:"m:subHide",attributes:{hide:{key:"m:val",value:1}}}),cZ=()=>new M0({name:"m:supHide",attributes:{hide:{key:"m:val",value:1}}}),e8=({accent:B,hasSuperScript:U,hasSubScript:G,limitLocationVal:Y})=>new M0({name:"m:naryPr",children:[...B?[l4({accent:B})]:[],a4({value:Y}),...!U?[cZ()]:[],...!G?[dZ()]:[]]}),l2=({children:B})=>new M0({name:"m:sub",children:B}),a2=({children:B})=>new M0({name:"m:sup",children:B}),mZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"∑",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},lZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript,limitLocationVal:"subSup"})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},B6=class extends t{constructor(B){super("m:lim");for(let U of B)this.root.push(U)}},aZ=class extends t{constructor(B){super("m:limUpp");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},pZ=class extends t{constructor(B){super("m:limLow");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},p4=()=>new M0({name:"m:sSupPr"}),rZ=class extends t{constructor(B){super("m:sSup");this.root.push(p4()),this.root.push(y0({children:B.children})),this.root.push(a2({children:B.superScript}))}},r4=()=>new M0({name:"m:sSubPr"}),iZ=class extends t{constructor(B){super("m:sSub");this.root.push(r4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript}))}},i4=()=>new M0({name:"m:sSubSupPr"}),nZ=class extends t{constructor(B){super("m:sSubSup");this.root.push(i4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript})),this.root.push(a2({children:B.superScript}))}},n4=()=>new M0({name:"m:sPrePr"}),sZ=class extends M0{constructor({children:B,subScript:U,superScript:G}){super({name:"m:sPre",children:[n4(),y0({children:B}),l2({children:U}),a2({children:G})]})}},oZ="",s4=class extends t{constructor(B){super("m:deg");if(B)for(let U of B)this.root.push(U)}},tZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{hide:"m:val"})}},eZ=class extends t{constructor(){super("m:degHide");this.root.push(new tZ({hide:1}))}},o4=class extends t{constructor(B){super("m:radPr");if(!B)this.root.push(new eZ)}},BQ=class extends t{constructor(B){super("m:rad");this.root.push(new o4(!!B.degree)),this.root.push(new s4(B.degree)),this.root.push(y0({children:B.children}))}},t4=class extends t{constructor(B){super("m:fName");for(let U of B)this.root.push(U)}},e4=class extends t{constructor(){super("m:funcPr")}},UQ=class extends t{constructor(B){super("m:func");this.root.push(new e4),this.root.push(new t4(B.name)),this.root.push(y0({children:B.children}))}},GQ=({character:B})=>new M0({name:"m:begChr",attributes:{character:{key:"m:val",value:B}}}),YQ=({character:B})=>new M0({name:"m:endChr",attributes:{character:{key:"m:val",value:B}}}),l1=({characters:B})=>new M0({name:"m:dPr",children:B?[GQ({character:B.beginningCharacter}),YQ({character:B.endingCharacter})]:[]}),ZQ=class extends t{constructor(B){super("m:d");this.root.push(l1({})),this.root.push(y0({children:B.children}))}},QQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"[",endingCharacter:"]"}})),this.root.push(y0({children:B.children}))}},JQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"{",endingCharacter:"}"}})),this.root.push(y0({children:B.children}))}},KQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"〈",endingCharacter:"〉"}})),this.root.push(y0({children:B.children}))}},VQ=(B)=>new M0({name:"w:gridCol",attributes:B!==void 0?{width:{key:"w:w",value:E0(B)}}:void 0}),B9=class extends t{constructor(B,U){super("w:tblGrid");for(let G of B)this.root.push(VQ(G));if(U)this.root.push(new qQ(U))}},XQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},qQ=class extends t{constructor(B){super("w:tblGridChange");this.root.push(new XQ({id:B.id})),this.root.push(new B9(B.columnWidths))}},MQ=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new Q1(B))}},RQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},LQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},IQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},p6=class extends t{constructor(B){super("w:delText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B)}},OQ=class extends t{constructor(B){super("w:del");e(this,"deletedTextRunWrapper",void 0),this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.deletedTextRunWrapper=new HQ(B),this.addChildElement(this.deletedTextRunWrapper)}},HQ=class extends t{constructor(B){super("w:r");if(this.root.push(new U2(B)),B.children)for(let U of B.children){if(typeof U==="string"){switch(U){case F2.CURRENT:this.root.push(e0()),this.root.push(new RQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES:this.root.push(e0()),this.root.push(new LQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES_IN_SECTION:this.root.push(e0()),this.root.push(new IQ),this.root.push(X2()),this.root.push(B2());break;default:this.root.push(new p6(U));break}continue}this.root.push(U)}else if(B.text)this.root.push(new p6(B.text));if(B.break)for(let U=0;Unew M0({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:B}}}),X9=({marginUnitType:B=v1.DXA,top:U,left:G,bottom:Y,right:Q})=>[{name:"w:top",size:U},{name:"w:left",size:G},{name:"w:bottom",size:Y},{name:"w:right",size:Q}].filter((K)=>K.size!==void 0).map(({name:K,size:Z})=>J1(K,{type:B,size:Z})),PQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tblCellMar",children:U})},AQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tcMar",children:U})},v1={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},J1=(B,{type:U=v1.AUTO,size:G})=>{let Y=G;if(U===v1.PERCENTAGE&&typeof G==="number")Y=`${G}%`;return new M0({name:B,attributes:{type:{key:"w:type",value:U},size:{key:"w:w",value:c8(Y)}}})},q9=class extends R2{constructor(B){super("w:tcBorders");if(B.top)this.root.push(j0("w:top",B.top));if(B.start)this.root.push(j0("w:start",B.start));if(B.left)this.root.push(j0("w:left",B.left));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.end)this.root.push(j0("w:end",B.end));if(B.right)this.root.push(j0("w:right",B.right))}},jQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},M9=class extends t{constructor(B){super("w:gridSpan");this.root.push(new jQ({val:T0(B)}))}},G6={CONTINUE:"continue",RESTART:"restart"},NQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},w8=class extends t{constructor(B){super("w:vMerge");this.root.push(new NQ({val:B}))}},zQ={BOTTOM_TO_TOP_LEFT_TO_RIGHT:"btLr",LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},wQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},R9=class extends t{constructor(B){super("w:textDirection");this.root.push(new wQ({val:B}))}},L9=class extends R2{constructor(B){super("w:tcPr",B.includeIfEmpty);if(B.width)this.root.push(J1("w:tcW",B.width));if(B.columnSpan)this.root.push(new M9(B.columnSpan));if(B.verticalMerge)this.root.push(new w8(B.verticalMerge));else if(B.rowSpan&&B.rowSpan>1)this.root.push(new w8(G6.RESTART));if(B.borders)this.root.push(new q9(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.margins){let U=AQ(B.margins);if(U)this.root.push(U)}if(B.textDirection)this.root.push(new R9(B.textDirection));if(B.verticalAlign)this.root.push(U6(B.verticalAlign));if(B.insertion)this.root.push(new Y9(B.insertion));if(B.deletion)this.root.push(new Z9(B.deletion));if(B.revision)this.root.push(new EQ(B.revision));if(B.cellMerge)this.root.push(new J9(B.cellMerge))}},EQ=class extends t{constructor(B){super("w:tcPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new L9(L0(L0({},B),{},{includeIfEmpty:!0})))}},Y6=class extends t{constructor(B){super("w:tc");e(this,"options",void 0),this.options=B,this.root.push(new L9(B));for(let U of B.children)this.root.push(U)}prepForXml(B){if(!(this.root[this.root.length-1]instanceof d0))this.root.push(new d0({}));return super.prepForXml(B)}},v2={style:c1.NONE,size:0,color:"auto"},y2={style:c1.SINGLE,size:4,color:"auto"},Z6=class extends t{constructor(B){var U,G,Y,Q,K,Z;super("w:tblBorders");this.root.push(j0("w:top",(U=B.top)!==null&&U!==void 0?U:y2)),this.root.push(j0("w:left",(G=B.left)!==null&&G!==void 0?G:y2)),this.root.push(j0("w:bottom",(Y=B.bottom)!==null&&Y!==void 0?Y:y2)),this.root.push(j0("w:right",(Q=B.right)!==null&&Q!==void 0?Q:y2)),this.root.push(j0("w:insideH",(K=B.insideHorizontal)!==null&&K!==void 0?K:y2)),this.root.push(j0("w:insideV",(Z=B.insideVertical)!==null&&Z!==void 0?Z:y2))}};e(Z6,"NONE",{top:v2,bottom:v2,left:v2,right:v2,insideHorizontal:v2,insideVertical:v2});var DQ={MARGIN:"margin",PAGE:"page",TEXT:"text"},TQ={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},CQ={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},kQ={NEVER:"never",OVERLAP:"overlap"},$Q=(B)=>new M0({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:B}}}),I9=({horizontalAnchor:B,verticalAnchor:U,absoluteHorizontalPosition:G,relativeHorizontalPosition:Y,absoluteVerticalPosition:Q,relativeVerticalPosition:K,bottomFromText:Z,topFromText:J,leftFromText:q,rightFromText:W,overlap:I})=>new M0({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:q===void 0?void 0:E0(q)},rightFromText:{key:"w:rightFromText",value:W===void 0?void 0:E0(W)},topFromText:{key:"w:topFromText",value:J===void 0?void 0:E0(J)},bottomFromText:{key:"w:bottomFromText",value:Z===void 0?void 0:E0(Z)},absoluteHorizontalPosition:{key:"w:tblpX",value:G===void 0?void 0:t0(G)},absoluteVerticalPosition:{key:"w:tblpY",value:Q===void 0?void 0:t0(Q)},horizontalAnchor:{key:"w:horzAnchor",value:B},relativeHorizontalPosition:{key:"w:tblpXSpec",value:Y},relativeVerticalPosition:{key:"w:tblpYSpec",value:K},verticalAnchor:{key:"w:vertAnchor",value:U}},children:I?[$Q(I)]:void 0}),SQ={AUTOFIT:"autofit",FIXED:"fixed"},O9=(B)=>new M0({name:"w:tblLayout",attributes:{type:{key:"w:type",value:B}}}),bQ={DXA:"dxa",NIL:"nil"},H9=({type:B=bQ.DXA,value:U})=>new M0({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:B},value:{key:"w:w",value:c8(U)}}}),F9=({firstRow:B,lastRow:U,firstColumn:G,lastColumn:Y,noHBand:Q,noVBand:K})=>new M0({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:B},lastRow:{key:"w:lastRow",value:U},firstColumn:{key:"w:firstColumn",value:G},lastColumn:{key:"w:lastColumn",value:Y},noHBand:{key:"w:noHBand",value:Q},noVBand:{key:"w:noVBand",value:K}}}),Q6=class extends R2{constructor(B){super("w:tblPr",B.includeIfEmpty);if(B.style)this.root.push(new q2("w:tblStyle",B.style));if(B.float)this.root.push(I9(B.float));if(B.visuallyRightToLeft!==void 0)this.root.push(new q0("w:bidiVisual",B.visuallyRightToLeft));if(B.width)this.root.push(J1("w:tblW",B.width));if(B.alignment)this.root.push(m8(B.alignment));if(B.indent)this.root.push(J1("w:tblInd",B.indent));if(B.borders)this.root.push(new Z6(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.layout)this.root.push(O9(B.layout));if(B.cellMargin){let U=PQ(B.cellMargin);if(U)this.root.push(U)}if(B.tableLook)this.root.push(F9(B.tableLook));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.revision)this.root.push(new vQ(B.revision))}},vQ=class extends t{constructor(B){super("w:tblPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new Q6(L0(L0({},B),{},{includeIfEmpty:!0})))}},yQ=class extends H1{constructor({rows:B,width:U,columnWidths:G=Array(Math.max(...B.map((j)=>j.CellCount))).fill(100),columnWidthsRevision:Y,margins:Q,indent:K,float:Z,layout:J,style:q,borders:W,alignment:I,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P}){super("w:tbl");this.root.push(new Q6({borders:W!==null&&W!==void 0?W:{},width:U!==null&&U!==void 0?U:{size:100},indent:K,float:Z,layout:J,style:q,alignment:I,cellMargin:Q,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P})),this.root.push(new B9(G,Y));for(let j of B)this.root.push(j);B.forEach((j,E)=>{if(E===B.length-1)return;let C=0;j.cells.forEach((N)=>{if(N.options.rowSpan&&N.options.rowSpan>1){let v=new Y6({rowSpan:N.options.rowSpan-1,columnSpan:N.options.columnSpan,borders:N.options.borders,children:[],verticalMerge:G6.CONTINUE});B[E+1].addCellToColumnIndex(v,C)}C+=N.options.columnSpan||1})})}},gQ={AUTO:"auto",ATLEAST:"atLeast",EXACT:"exact"},W9=(B,U)=>new M0({name:"w:trHeight",attributes:{value:{key:"w:val",value:E0(B)},rule:{key:"w:hRule",value:U}}}),J6=class extends R2{constructor(B){super("w:trPr",B.includeIfEmpty);if(B.cantSplit!==void 0)this.root.push(new q0("w:cantSplit",B.cantSplit));if(B.tableHeader!==void 0)this.root.push(new q0("w:tblHeader",B.tableHeader));if(B.height)this.root.push(W9(B.height.value,B.height.rule));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.insertion)this.root.push(new U9(B.insertion));if(B.deletion)this.root.push(new G9(B.deletion));if(B.revision)this.root.push(new P9(B.revision))}},P9=class extends t{constructor(B){super("w:trPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new J6(L0(L0({},B),{},{includeIfEmpty:!0})))}},fQ=class extends t{constructor(B){super("w:tr");e(this,"options",void 0),this.options=B,this.root.push(new J6(B));for(let U of B.children)this.root.push(U)}get CellCount(){return this.options.children.length}get cells(){return this.root.filter((B)=>B instanceof Y6)}addCellToIndex(B,U){this.root.splice(U+1,0,B)}addCellToColumnIndex(B,U){let G=this.columnIndexToRootIndex(U,!0);this.addCellToIndex(B,G-1)}rootIndexToColumnIndex(B){if(B<1||B>=this.root.length)throw Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let U=0;for(let G=1;G=this.root.length)if(U)return this.root.length;else throw Error(`cell 'columnIndex' should not great than ${G-1}`);let Q=this.root[Y];Y+=1,G+=Q&&Q.options.columnSpan||1}return Y-1}},xQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},_Q=class extends t{constructor(){super("Properties");this.root.push(new xQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},hQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},V2=(B,U)=>new M0({name:"Default",attributes:{contentType:{key:"ContentType",value:B},extension:{key:"Extension",value:U}}}),f0=(B,U)=>new M0({name:"Override",attributes:{contentType:{key:"ContentType",value:B},partName:{key:"PartName",value:U}}}),uQ=class extends t{constructor(){super("Types");this.root.push(new hQ({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(V2("image/png","png")),this.root.push(V2("image/jpeg","jpeg")),this.root.push(V2("image/jpeg","jpg")),this.root.push(V2("image/bmp","bmp")),this.root.push(V2("image/gif","gif")),this.root.push(V2("image/svg+xml","svg")),this.root.push(V2("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(V2("application/xml","xml")),this.root.push(V2("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(f0("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addCommentsExtended(){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addFooter(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${B}.xml`))}addHeader(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${B}.xml`))}},y1={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},F1=class extends H0{constructor(B,U){super(L0({Ignorable:U},Object.fromEntries(B.map((G)=>[G,y1[G]]))));e(this,"xmlKeys",L0({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(y1).map((G)=>[G,`xmlns:${G}`]))))}},dQ=class extends t{constructor(B){super("cp:coreProperties");if(this.root.push(new F1(["cp","dc","dcterms","dcmitype","xsi"])),B.title)this.root.push(new O2("dc:title",B.title));if(B.subject)this.root.push(new O2("dc:subject",B.subject));if(B.creator)this.root.push(new O2("dc:creator",B.creator));if(B.keywords)this.root.push(new O2("cp:keywords",B.keywords));if(B.description)this.root.push(new O2("dc:description",B.description));if(B.lastModifiedBy)this.root.push(new O2("cp:lastModifiedBy",B.lastModifiedBy));if(B.revision)this.root.push(new O2("cp:revision",String(B.revision)));this.root.push(new r6("dcterms:created")),this.root.push(new r6("dcterms:modified"))}},cQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"xsi:type"})}},r6=class extends t{constructor(B){super(B);this.root.push(new cQ({type:"dcterms:W3CDTF"})),this.root.push(fB(new Date))}},mQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},lQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},aQ=class extends t{constructor(B,U){super("property");this.root.push(new lQ({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:B.toString(),name:U.name})),this.root.push(new pQ(U.value))}},pQ=class extends t{constructor(B){super("vt:lpwstr");this.root.push(B)}},rQ=class extends t{constructor(B){super("Properties");e(this,"nextId",void 0),e(this,"properties",[]),this.root.push(new mQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let U of B)this.addCustomProperty(U)}prepForXml(B){return this.properties.forEach((U)=>this.root.push(U)),super.prepForXml(B)}addCustomProperty(B){this.properties.push(new aQ(this.nextId++,B))}},A9=({space:B,count:U,separate:G,equalWidth:Y,children:Q})=>new M0({name:"w:cols",attributes:{space:{key:"w:space",value:B===void 0?void 0:E0(B)},count:{key:"w:num",value:U===void 0?void 0:T0(U)},separate:{key:"w:sep",value:G},equalWidth:{key:"w:equalWidth",value:Y}},children:!Y&&Q?Q:void 0}),iQ={DEFAULT:"default",LINES:"lines",LINES_AND_CHARS:"linesAndChars",SNAP_TO_CHARS:"snapToChars"},j9=({type:B,linePitch:U,charSpace:G})=>new M0({name:"w:docGrid",attributes:{type:{key:"w:type",value:B},linePitch:{key:"w:linePitch",value:T0(U)},charSpace:{key:"w:charSpace",value:G?T0(G):void 0}}}),T2={DEFAULT:"default",FIRST:"first",EVEN:"even"},E8={HEADER:"w:headerReference",FOOTER:"w:footerReference"},k1=(B,U)=>new M0({name:B,attributes:{type:{key:"w:type",value:U.type||T2.DEFAULT},id:{key:"r:id",value:`rId${U.id}`}}}),nQ={NEW_PAGE:"newPage",NEW_SECTION:"newSection",CONTINUOUS:"continuous"},N9=({countBy:B,start:U,restart:G,distance:Y})=>new M0({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:B===void 0?void 0:T0(B)},start:{key:"w:start",value:U===void 0?void 0:T0(U)},restart:{key:"w:restart",value:G},distance:{key:"w:distance",value:Y===void 0?void 0:E0(Y)}}}),sQ={ALL_PAGES:"allPages",FIRST_PAGE:"firstPage",NOT_FIRST_PAGE:"notFirstPage"},oQ={PAGE:"page",TEXT:"text"},tQ={BACK:"back",FRONT:"front"},i6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},z9=class extends R2{constructor(B){super("w:pgBorders");if(!B)return this;if(B.pageBorders)this.root.push(new i6({display:B.pageBorders.display,offsetFrom:B.pageBorders.offsetFrom,zOrder:B.pageBorders.zOrder}));else this.root.push(new i6({}));if(B.pageBorderTop)this.root.push(j0("w:top",B.pageBorderTop));if(B.pageBorderLeft)this.root.push(j0("w:left",B.pageBorderLeft));if(B.pageBorderBottom)this.root.push(j0("w:bottom",B.pageBorderBottom));if(B.pageBorderRight)this.root.push(j0("w:right",B.pageBorderRight))}},w9=(B,U,G,Y,Q,K,Z)=>new M0({name:"w:pgMar",attributes:{top:{key:"w:top",value:t0(B)},right:{key:"w:right",value:E0(U)},bottom:{key:"w:bottom",value:t0(G)},left:{key:"w:left",value:E0(Y)},header:{key:"w:header",value:E0(Q)},footer:{key:"w:footer",value:E0(K)},gutter:{key:"w:gutter",value:E0(Z)}}}),eQ={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},E9=({start:B,formatType:U,separator:G})=>new M0({name:"w:pgNumType",attributes:{start:{key:"w:start",value:B===void 0?void 0:T0(B)},formatType:{key:"w:fmt",value:U},separator:{key:"w:chapSep",value:G}}}),g1={PORTRAIT:"portrait",LANDSCAPE:"landscape"},D9=({width:B,height:U,orientation:G,code:Y})=>{let Q=E0(B),K=E0(U);return new M0({name:"w:pgSz",attributes:{width:{key:"w:w",value:G===g1.LANDSCAPE?K:Q},height:{key:"w:h",value:G===g1.LANDSCAPE?Q:K},orientation:{key:"w:orient",value:G},code:{key:"w:code",value:Y}}})},BJ={LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},UJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},T9=class extends t{constructor(B){super("w:textDirection");this.root.push(new UJ({val:B}))}},GJ={NEXT_PAGE:"nextPage",NEXT_COLUMN:"nextColumn",CONTINUOUS:"continuous",EVEN_PAGE:"evenPage",ODD_PAGE:"oddPage"},C9=(B)=>new M0({name:"w:type",attributes:{val:{key:"w:val",value:B}}}),H2={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},$1={WIDTH:11906,HEIGHT:16838,ORIENTATION:g1.PORTRAIT},K6=class extends t{constructor({page:{size:{width:B=$1.WIDTH,height:U=$1.HEIGHT,orientation:G=$1.ORIENTATION,code:Y}={},margin:{top:Q=H2.TOP,right:K=H2.RIGHT,bottom:Z=H2.BOTTOM,left:J=H2.LEFT,header:q=H2.HEADER,footer:W=H2.FOOTER,gutter:I=H2.GUTTER}={},pageNumbers:H={},borders:T,textDirection:A}={},grid:{linePitch:P=360,charSpace:j,type:E}={},headerWrapperGroup:C={},footerWrapperGroup:N={},lineNumbers:v,titlePage:S,verticalAlign:F,column:M,type:$,revision:x}={}){super("w:sectPr");if(this.addHeaderFooterGroup(E8.HEADER,C),this.addHeaderFooterGroup(E8.FOOTER,N),$)this.root.push(C9($));if(this.root.push(D9({width:B,height:U,orientation:G,code:Y})),this.root.push(w9(Q,K,Z,J,q,W,I)),T)this.root.push(new z9(T));if(v)this.root.push(N9(v));if(this.root.push(E9(H)),M)this.root.push(A9(M));if(F)this.root.push(U6(F));if(S!==void 0)this.root.push(new q0("w:titlePg",S));if(A)this.root.push(new T9(A));if(x)this.root.push(new k9(x));this.root.push(j9({linePitch:P,charSpace:j,type:E}))}addHeaderFooterGroup(B,U){if(U.default)this.root.push(k1(B,{type:T2.DEFAULT,id:U.default.View.ReferenceId}));if(U.first)this.root.push(k1(B,{type:T2.FIRST,id:U.first.View.ReferenceId}));if(U.even)this.root.push(k1(B,{type:T2.EVEN,id:U.even.View.ReferenceId}))}},k9=class extends t{constructor(B){super("w:sectPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new K6(B))}},YJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{width:"w:w",space:"w:space"})}},ZJ=class extends t{constructor(B){super("w:col");this.root.push(new YJ({width:E0(B.width),space:B.space===void 0?void 0:E0(B.space)}))}},$9=class extends t{constructor(){super("w:body");e(this,"sections",[])}addSection(B){let U=this.sections.pop();this.root.push(this.createSectionParagraph(U)),this.sections.push(new K6(B))}prepForXml(B){if(this.sections.length===1)this.root.splice(0,1),this.root.push(this.sections.pop());return super.prepForXml(B)}push(B){this.root.push(B)}createSectionParagraph(B){let U=new d0({}),G=new M2({});return G.push(B),U.addChildElement(G),U}},S9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}},b9=class extends t{constructor(B){super("w:background");this.root.push(new S9({color:B.color===void 0?void 0:C2(B.color),themeColor:B.themeColor,themeShade:B.themeShade===void 0?void 0:W8(B.themeShade),themeTint:B.themeTint===void 0?void 0:W8(B.themeTint)}))}},QJ=class extends t{constructor(B){super("w:document");if(e(this,"body",void 0),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new $9,B.background)this.root.push(new b9(B.background));this.root.push(this.body)}add(B){return this.body.push(B),this}get Body(){return this.body}},JJ=class{constructor(B){e(this,"document",void 0),e(this,"relationships",void 0),this.document=new QJ(B),this.relationships=new A2}get View(){return this.document}get Relationships(){return this.relationships}},KJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},VJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",id:"w:id"})}},XJ=class extends D0{constructor(){super({style:"EndnoteReference"});this.root.push(new D4)}},n6={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},X8=class extends t{constructor(B){super("w:endnote");this.root.push(new VJ({type:B.type,id:B.id}));for(let U=0;U9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new zJ({ilvl:T0(B),tentative:1}))}},h9=class extends X6{},$J=class extends X6{},SJ=class extends t{constructor(B){super("w:multiLevelType");this.root.push(new C0({val:B}))}},bJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},D8=class extends t{constructor(B,U){super("w:abstractNum");e(this,"id",void 0),this.root.push(new bJ({abstractNumId:T0(B),restartNumberingAfterBreak:0})),this.root.push(new SJ("hybridMultilevel")),this.id=B;for(let G of U)this.root.push(new h9(G))}},vJ=class extends t{constructor(B){super("w:abstractNumId");this.root.push(new C0({val:B}))}},yJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{numId:"w:numId"})}},T8=class extends t{constructor(B){super("w:num");if(e(this,"numId",void 0),e(this,"reference",void 0),e(this,"instance",void 0),this.numId=B.numId,this.reference=B.reference,this.instance=B.instance,this.root.push(new yJ({numId:T0(B.numId)})),this.root.push(new vJ(T0(B.abstractNumId))),B.overrideLevels&&B.overrideLevels.length)for(let U of B.overrideLevels)this.root.push(new u9(U.num,U.start))}},gJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{ilvl:"w:ilvl"})}},u9=class extends t{constructor(B,U){super("w:lvlOverride");if(this.root.push(new gJ({ilvl:B})),U!==void 0)this.root.push(new xJ(U))}},fJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},xJ=class extends t{constructor(B){super("w:startOverride");this.root.push(new fJ({val:B}))}},d9=class extends t{constructor(B){super("w:numbering");e(this,"abstractNumberingMap",new Map),e(this,"concreteNumberingMap",new Map),e(this,"referenceConfigMap",new Map),e(this,"abstractNumUniqueNumericId",nB()),e(this,"concreteNumUniqueNumericId",sB()),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let U=new D8(this.abstractNumUniqueNumericId(),[{level:0,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(0.5),hanging:u0(0.25)}}}},{level:1,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(1),hanging:u0(0.25)}}}},{level:2,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:2160,hanging:u0(0.25)}}}},{level:3,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:2880,hanging:u0(0.25)}}}},{level:4,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:3600,hanging:u0(0.25)}}}},{level:5,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:4320,hanging:u0(0.25)}}}},{level:6,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5040,hanging:u0(0.25)}}}},{level:7,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5760,hanging:u0(0.25)}}}},{level:8,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:6480,hanging:u0(0.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new T8({numId:1,abstractNumId:U.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",U);for(let G of B.config)this.abstractNumberingMap.set(G.reference,new D8(this.abstractNumUniqueNumericId(),G.levels)),this.referenceConfigMap.set(G.reference,G.levels)}prepForXml(B){for(let U of this.abstractNumberingMap.values())this.root.push(U);for(let U of this.concreteNumberingMap.values())this.root.push(U);return super.prepForXml(B)}createConcreteNumberingInstance(B,U){let G=this.abstractNumberingMap.get(B);if(!G)return;let Y=`${B}-${U}`;if(this.concreteNumberingMap.has(Y))return;let Q=this.referenceConfigMap.get(B),K=Q&&Q[0].start,Z={numId:this.concreteNumUniqueNumericId(),abstractNumId:G.id,reference:B,instance:U,overrideLevels:[typeof K==="number"&&Number.isInteger(K)?{num:0,start:K}:{num:0,start:1}]};this.concreteNumberingMap.set(Y,new T8(Z))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},_J=(B)=>new M0({name:"w:compatSetting",attributes:{version:{key:"w:val",value:B},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),hJ=class extends t{constructor(B){super("w:compat");if(B.version)this.root.push(_J(B.version));if(B.useSingleBorderforContiguousCells)this.root.push(new q0("w:useSingleBorderforContiguousCells",B.useSingleBorderforContiguousCells));if(B.wordPerfectJustification)this.root.push(new q0("w:wpJustification",B.wordPerfectJustification));if(B.noTabStopForHangingIndent)this.root.push(new q0("w:noTabHangInd",B.noTabStopForHangingIndent));if(B.noLeading)this.root.push(new q0("w:noLeading",B.noLeading));if(B.spaceForUnderline)this.root.push(new q0("w:spaceForUL",B.spaceForUnderline));if(B.noColumnBalance)this.root.push(new q0("w:noColumnBalance",B.noColumnBalance));if(B.balanceSingleByteDoubleByteWidth)this.root.push(new q0("w:balanceSingleByteDoubleByteWidth",B.balanceSingleByteDoubleByteWidth));if(B.noExtraLineSpacing)this.root.push(new q0("w:noExtraLineSpacing",B.noExtraLineSpacing));if(B.doNotLeaveBackslashAlone)this.root.push(new q0("w:doNotLeaveBackslashAlone",B.doNotLeaveBackslashAlone));if(B.underlineTrailingSpaces)this.root.push(new q0("w:ulTrailSpace",B.underlineTrailingSpaces));if(B.doNotExpandShiftReturn)this.root.push(new q0("w:doNotExpandShiftReturn",B.doNotExpandShiftReturn));if(B.spacingInWholePoints)this.root.push(new q0("w:spacingInWholePoints",B.spacingInWholePoints));if(B.lineWrapLikeWord6)this.root.push(new q0("w:lineWrapLikeWord6",B.lineWrapLikeWord6));if(B.printBodyTextBeforeHeader)this.root.push(new q0("w:printBodyTextBeforeHeader",B.printBodyTextBeforeHeader));if(B.printColorsBlack)this.root.push(new q0("w:printColBlack",B.printColorsBlack));if(B.spaceWidth)this.root.push(new q0("w:wpSpaceWidth",B.spaceWidth));if(B.showBreaksInFrames)this.root.push(new q0("w:showBreaksInFrames",B.showBreaksInFrames));if(B.subFontBySize)this.root.push(new q0("w:subFontBySize",B.subFontBySize));if(B.suppressBottomSpacing)this.root.push(new q0("w:suppressBottomSpacing",B.suppressBottomSpacing));if(B.suppressTopSpacing)this.root.push(new q0("w:suppressTopSpacing",B.suppressTopSpacing));if(B.suppressSpacingAtTopOfPage)this.root.push(new q0("w:suppressSpacingAtTopOfPage",B.suppressSpacingAtTopOfPage));if(B.suppressTopSpacingWP)this.root.push(new q0("w:suppressTopSpacingWP",B.suppressTopSpacingWP));if(B.suppressSpBfAfterPgBrk)this.root.push(new q0("w:suppressSpBfAfterPgBrk",B.suppressSpBfAfterPgBrk));if(B.swapBordersFacingPages)this.root.push(new q0("w:swapBordersFacingPages",B.swapBordersFacingPages));if(B.convertMailMergeEsc)this.root.push(new q0("w:convMailMergeEsc",B.convertMailMergeEsc));if(B.truncateFontHeightsLikeWP6)this.root.push(new q0("w:truncateFontHeightsLikeWP6",B.truncateFontHeightsLikeWP6));if(B.macWordSmallCaps)this.root.push(new q0("w:mwSmallCaps",B.macWordSmallCaps));if(B.usePrinterMetrics)this.root.push(new q0("w:usePrinterMetrics",B.usePrinterMetrics));if(B.doNotSuppressParagraphBorders)this.root.push(new q0("w:doNotSuppressParagraphBorders",B.doNotSuppressParagraphBorders));if(B.wrapTrailSpaces)this.root.push(new q0("w:wrapTrailSpaces",B.wrapTrailSpaces));if(B.footnoteLayoutLikeWW8)this.root.push(new q0("w:footnoteLayoutLikeWW8",B.footnoteLayoutLikeWW8));if(B.shapeLayoutLikeWW8)this.root.push(new q0("w:shapeLayoutLikeWW8",B.shapeLayoutLikeWW8));if(B.alignTablesRowByRow)this.root.push(new q0("w:alignTablesRowByRow",B.alignTablesRowByRow));if(B.forgetLastTabAlignment)this.root.push(new q0("w:forgetLastTabAlignment",B.forgetLastTabAlignment));if(B.adjustLineHeightInTable)this.root.push(new q0("w:adjustLineHeightInTable",B.adjustLineHeightInTable));if(B.autoSpaceLikeWord95)this.root.push(new q0("w:autoSpaceLikeWord95",B.autoSpaceLikeWord95));if(B.noSpaceRaiseLower)this.root.push(new q0("w:noSpaceRaiseLower",B.noSpaceRaiseLower));if(B.doNotUseHTMLParagraphAutoSpacing)this.root.push(new q0("w:doNotUseHTMLParagraphAutoSpacing",B.doNotUseHTMLParagraphAutoSpacing));if(B.layoutRawTableWidth)this.root.push(new q0("w:layoutRawTableWidth",B.layoutRawTableWidth));if(B.layoutTableRowsApart)this.root.push(new q0("w:layoutTableRowsApart",B.layoutTableRowsApart));if(B.useWord97LineBreakRules)this.root.push(new q0("w:useWord97LineBreakRules",B.useWord97LineBreakRules));if(B.doNotBreakWrappedTables)this.root.push(new q0("w:doNotBreakWrappedTables",B.doNotBreakWrappedTables));if(B.doNotSnapToGridInCell)this.root.push(new q0("w:doNotSnapToGridInCell",B.doNotSnapToGridInCell));if(B.selectFieldWithFirstOrLastCharacter)this.root.push(new q0("w:selectFldWithFirstOrLastChar",B.selectFieldWithFirstOrLastCharacter));if(B.applyBreakingRules)this.root.push(new q0("w:applyBreakingRules",B.applyBreakingRules));if(B.doNotWrapTextWithPunctuation)this.root.push(new q0("w:doNotWrapTextWithPunct",B.doNotWrapTextWithPunctuation));if(B.doNotUseEastAsianBreakRules)this.root.push(new q0("w:doNotUseEastAsianBreakRules",B.doNotUseEastAsianBreakRules));if(B.useWord2002TableStyleRules)this.root.push(new q0("w:useWord2002TableStyleRules",B.useWord2002TableStyleRules));if(B.growAutofit)this.root.push(new q0("w:growAutofit",B.growAutofit));if(B.useFELayout)this.root.push(new q0("w:useFELayout",B.useFELayout));if(B.useNormalStyleForList)this.root.push(new q0("w:useNormalStyleForList",B.useNormalStyleForList));if(B.doNotUseIndentAsNumberingTabStop)this.root.push(new q0("w:doNotUseIndentAsNumberingTabStop",B.doNotUseIndentAsNumberingTabStop));if(B.useAlternateEastAsianLineBreakRules)this.root.push(new q0("w:useAltKinsokuLineBreakRules",B.useAlternateEastAsianLineBreakRules));if(B.allowSpaceOfSameStyleInTable)this.root.push(new q0("w:allowSpaceOfSameStyleInTable",B.allowSpaceOfSameStyleInTable));if(B.doNotSuppressIndentation)this.root.push(new q0("w:doNotSuppressIndentation",B.doNotSuppressIndentation));if(B.doNotAutofitConstrainedTables)this.root.push(new q0("w:doNotAutofitConstrainedTables",B.doNotAutofitConstrainedTables));if(B.autofitToFirstFixedWidthCell)this.root.push(new q0("w:autofitToFirstFixedWidthCell",B.autofitToFirstFixedWidthCell));if(B.underlineTabInNumberingList)this.root.push(new q0("w:underlineTabInNumList",B.underlineTabInNumberingList));if(B.displayHangulFixedWidth)this.root.push(new q0("w:displayHangulFixedWidth",B.displayHangulFixedWidth));if(B.splitPgBreakAndParaMark)this.root.push(new q0("w:splitPgBreakAndParaMark",B.splitPgBreakAndParaMark));if(B.doNotVerticallyAlignCellWithSp)this.root.push(new q0("w:doNotVertAlignCellWithSp",B.doNotVerticallyAlignCellWithSp));if(B.doNotBreakConstrainedForcedTable)this.root.push(new q0("w:doNotBreakConstrainedForcedTable",B.doNotBreakConstrainedForcedTable));if(B.ignoreVerticalAlignmentInTextboxes)this.root.push(new q0("w:doNotVertAlignInTxbx",B.ignoreVerticalAlignmentInTextboxes));if(B.useAnsiKerningPairs)this.root.push(new q0("w:useAnsiKerningPairs",B.useAnsiKerningPairs));if(B.cachedColumnBalance)this.root.push(new q0("w:cachedColBalance",B.cachedColumnBalance))}},uJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},dJ=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w:settings");if(this.root.push(new uJ({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new q0("w:displayBackgroundShape",!0)),B.trackRevisions!==void 0)this.root.push(new q0("w:trackRevisions",B.trackRevisions));if(B.evenAndOddHeaders!==void 0)this.root.push(new q0("w:evenAndOddHeaders",B.evenAndOddHeaders));if(B.updateFields!==void 0)this.root.push(new q0("w:updateFields",B.updateFields));if(B.defaultTabStop!==void 0)this.root.push(new _2("w:defaultTabStop",B.defaultTabStop));if(((U=B.hyphenation)===null||U===void 0?void 0:U.autoHyphenation)!==void 0)this.root.push(new q0("w:autoHyphenation",B.hyphenation.autoHyphenation));if(((G=B.hyphenation)===null||G===void 0?void 0:G.hyphenationZone)!==void 0)this.root.push(new _2("w:hyphenationZone",B.hyphenation.hyphenationZone));if(((Y=B.hyphenation)===null||Y===void 0?void 0:Y.consecutiveHyphenLimit)!==void 0)this.root.push(new _2("w:consecutiveHyphenLimit",B.hyphenation.consecutiveHyphenLimit));if(((Q=B.hyphenation)===null||Q===void 0?void 0:Q.doNotHyphenateCaps)!==void 0)this.root.push(new q0("w:doNotHyphenateCaps",B.hyphenation.doNotHyphenateCaps));this.root.push(new hJ(L0(L0({},(K=B.compatibility)!==null&&K!==void 0?K:{}),{},{version:(Z=(J=(q=B.compatibility)===null||q===void 0?void 0:q.version)!==null&&J!==void 0?J:B.compatibilityModeVersion)!==null&&Z!==void 0?Z:15})))}},c9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},cJ=class extends t{constructor(B){super("w:name");this.root.push(new c9({val:B}))}},mJ=class extends t{constructor(B){super("w:uiPriority");this.root.push(new c9({val:T0(B)}))}},lJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},m9=class extends t{constructor(B,U){super("w:style");if(this.root.push(new lJ(B)),U.name)this.root.push(new cJ(U.name));if(U.basedOn)this.root.push(new q2("w:basedOn",U.basedOn));if(U.next)this.root.push(new q2("w:next",U.next));if(U.link)this.root.push(new q2("w:link",U.link));if(U.uiPriority!==void 0)this.root.push(new mJ(U.uiPriority));if(U.semiHidden!==void 0)this.root.push(new q0("w:semiHidden",U.semiHidden));if(U.unhideWhenUsed!==void 0)this.root.push(new q0("w:unhideWhenUsed",U.unhideWhenUsed));if(U.quickFormat!==void 0)this.root.push(new q0("w:qFormat",U.quickFormat))}},p2=class extends m9{constructor(B){super({type:"paragraph",styleId:B.id},B);e(this,"paragraphProperties",void 0),e(this,"runProperties",void 0),this.paragraphProperties=new M2(B.paragraph),this.runProperties=new U2(B.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},$2=class extends m9{constructor(B){super({type:"character",styleId:B.id},L0({uiPriority:99,unhideWhenUsed:!0},B));e(this,"runProperties",void 0),this.runProperties=new U2(B.run),this.root.push(this.runProperties)}},j2=class extends p2{constructor(B){super(L0({basedOn:"Normal",next:"Normal",quickFormat:!0},B))}},aJ=class extends j2{constructor(B){super(L0({id:"Title",name:"Title"},B))}},pJ=class extends j2{constructor(B){super(L0({id:"Heading1",name:"Heading 1"},B))}},rJ=class extends j2{constructor(B){super(L0({id:"Heading2",name:"Heading 2"},B))}},iJ=class extends j2{constructor(B){super(L0({id:"Heading3",name:"Heading 3"},B))}},nJ=class extends j2{constructor(B){super(L0({id:"Heading4",name:"Heading 4"},B))}},sJ=class extends j2{constructor(B){super(L0({id:"Heading5",name:"Heading 5"},B))}},oJ=class extends j2{constructor(B){super(L0({id:"Heading6",name:"Heading 6"},B))}},tJ=class extends j2{constructor(B){super(L0({id:"Strong",name:"Strong"},B))}},eJ=class extends p2{constructor(B){super(L0({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},B))}},BK=class extends p2{constructor(B){super(L0({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},UK=class extends $2{constructor(B){super(L0({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},GK=class extends $2{constructor(B){super(L0({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},B))}},YK=class extends p2{constructor(B){super(L0({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},ZK=class extends $2{constructor(B){super(L0({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},QK=class extends $2{constructor(B){super(L0({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},B))}},JK=class extends $2{constructor(B){super(L0({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:i8.SINGLE}}},B))}},S1=class extends t{constructor(B){super("w:styles");if(B.initialStyles)this.root.push(B.initialStyles);if(B.importedStyles)for(let U of B.importedStyles)this.root.push(U);if(B.paragraphStyles)for(let U of B.paragraphStyles)this.root.push(new p2(U));if(B.characterStyles)for(let U of B.characterStyles)this.root.push(new $2(U))}},l9=class extends t{constructor(B){super("w:pPrDefault");this.root.push(new M2(B))}},a9=class extends t{constructor(B){super("w:rPrDefault");this.root.push(new U2(B))}},p9=class extends t{constructor(B){super("w:docDefaults");e(this,"runPropertiesDefaults",void 0),e(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new a9(B.run),this.paragraphPropertiesDefaults=new l9(B.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},KK=class{newInstance(B){let U=(0,h1.xml2js)(B,{compact:!1}),G;for(let Q of U.elements||[])if(Q.name==="w:styles")G=Q;if(G===void 0)throw Error("can not find styles element");let Y=G.elements||[];return{initialStyles:new $B(G.attributes),importedStyles:Y.map((Q)=>u1(Q))}}},M8=class{newInstance(B={}){var U;return{initialStyles:new F1(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new p9((U=B.document)!==null&&U!==void 0?U:{}),new aJ(L0({run:{size:56}},B.title)),new pJ(L0({run:{color:"2E74B5",size:32}},B.heading1)),new rJ(L0({run:{color:"2E74B5",size:26}},B.heading2)),new iJ(L0({run:{color:"1F4D78",size:24}},B.heading3)),new nJ(L0({run:{color:"2E74B5",italics:!0}},B.heading4)),new sJ(L0({run:{color:"2E74B5"}},B.heading5)),new oJ(L0({run:{color:"1F4D78"}},B.heading6)),new tJ(L0({run:{bold:!0}},B.strong)),new eJ(B.listParagraph||{}),new JK(B.hyperlink||{}),new UK(B.footnoteReference||{}),new BK(B.footnoteText||{}),new GK(B.footnoteTextChar||{}),new ZK(B.endnoteReference||{}),new YK(B.endnoteText||{}),new QK(B.endnoteTextChar||{})]}}},VK=class{constructor(B){var U,G,Y,Q,K,Z,J,q,W,I,H,T;if(e(this,"currentRelationshipId",1),e(this,"documentWrapper",void 0),e(this,"headers",[]),e(this,"footers",[]),e(this,"coreProperties",void 0),e(this,"numbering",void 0),e(this,"media",void 0),e(this,"fileRelationships",void 0),e(this,"footnotesWrapper",void 0),e(this,"endnotesWrapper",void 0),e(this,"settings",void 0),e(this,"contentTypes",void 0),e(this,"customProperties",void 0),e(this,"appProperties",void 0),e(this,"styles",void 0),e(this,"comments",void 0),e(this,"commentsExtended",void 0),e(this,"fontWrapper",void 0),this.coreProperties=new dQ(L0(L0({},B),{},{creator:(U=B.creator)!==null&&U!==void 0?U:"Un-named",revision:(G=B.revision)!==null&&G!==void 0?G:1,lastModifiedBy:(Y=B.lastModifiedBy)!==null&&Y!==void 0?Y:"Un-named"})),this.numbering=new d9(B.numbering?B.numbering:{config:[]}),this.comments=new w4((Q=B.comments)!==null&&Q!==void 0?Q:{children:[]}),this.comments.ThreadData)this.commentsExtended=new E4(this.comments.ThreadData);if(this.fileRelationships=new A2,this.customProperties=new rQ((K=B.customProperties)!==null&&K!==void 0?K:[]),this.appProperties=new _Q,this.footnotesWrapper=new PJ,this.endnotesWrapper=new RJ,this.contentTypes=new uQ,this.documentWrapper=new JJ({background:B.background}),this.settings=new dJ({compatibilityModeVersion:B.compatabilityModeVersion,compatibility:B.compatibility,evenAndOddHeaders:B.evenAndOddHeaderAndFooters?!0:!1,trackRevisions:(Z=B.features)===null||Z===void 0?void 0:Z.trackRevisions,updateFields:(J=B.features)===null||J===void 0?void 0:J.updateFields,defaultTabStop:B.defaultTabStop,hyphenation:{autoHyphenation:(q=B.hyphenation)===null||q===void 0?void 0:q.autoHyphenation,hyphenationZone:(W=B.hyphenation)===null||W===void 0?void 0:W.hyphenationZone,consecutiveHyphenLimit:(I=B.hyphenation)===null||I===void 0?void 0:I.consecutiveHyphenLimit,doNotHyphenateCaps:(H=B.hyphenation)===null||H===void 0?void 0:H.doNotHyphenateCaps}}),this.media=new V6,B.externalStyles!==void 0){var A;let P=new M8().newInstance((A=B.styles)===null||A===void 0?void 0:A.default),j=new KK().newInstance(B.externalStyles);this.styles=new S1(L0(L0({},j),{},{importedStyles:[...P.importedStyles,...j.importedStyles]}))}else if(B.styles){let P=new M8().newInstance(B.styles.default);this.styles=new S1(L0(L0({},P),B.styles))}else{let P=new M8;this.styles=new S1(P.newInstance())}this.addDefaultRelationships();for(let P of B.sections)this.addSection(P);if(B.footnotes)for(let P in B.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(P),B.footnotes[P].children);if(B.endnotes)for(let P in B.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(P),B.endnotes[P].children);this.fontWrapper=new h4((T=B.fonts)!==null&&T!==void 0?T:[])}addSection({headers:B={},footers:U={},children:G,properties:Y}){this.documentWrapper.View.Body.addSection(L0(L0({},Y),{},{headerWrapperGroup:{default:B.default?this.createHeader(B.default):void 0,first:B.first?this.createHeader(B.first):void 0,even:B.even?this.createHeader(B.even):void 0},footerWrapperGroup:{default:U.default?this.createFooter(U.default):void 0,first:U.first?this.createFooter(U.first):void 0,even:U.even?this.createFooter(U.even):void 0}}));for(let Q of G)this.documentWrapper.View.add(Q)}createHeader(B){let U=new _9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addHeaderToDocument(U),U}createFooter(B){let U=new f9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addFooterToDocument(U),U}addHeaderToDocument(B,U=T2.DEFAULT){this.headers.push({header:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(B,U=T2.DEFAULT){this.footers.push({footer:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){if(this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.commentsExtended)this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map((B)=>B.header)}get Footers(){return this.footers.map((B)=>B.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get FontTable(){return this.fontWrapper}},XK=class extends t{constructor(B={}){super("w:instrText");e(this,"properties",void 0),this.properties=B,this.root.push(new _0({space:x0.PRESERVE}));let U="TOC";if(this.properties.captionLabel)U=`${U} \\a "${this.properties.captionLabel}"`;if(this.properties.entriesFromBookmark)U=`${U} \\b "${this.properties.entriesFromBookmark}"`;if(this.properties.captionLabelIncludingNumbers)U=`${U} \\c "${this.properties.captionLabelIncludingNumbers}"`;if(this.properties.sequenceAndPageNumbersSeparator)U=`${U} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`;if(this.properties.tcFieldIdentifier)U=`${U} \\f "${this.properties.tcFieldIdentifier}"`;if(this.properties.hyperlink)U=`${U} \\h`;if(this.properties.tcFieldLevelRange)U=`${U} \\l "${this.properties.tcFieldLevelRange}"`;if(this.properties.pageNumbersEntryLevelsRange)U=`${U} \\n "${this.properties.pageNumbersEntryLevelsRange}"`;if(this.properties.headingStyleRange)U=`${U} \\o "${this.properties.headingStyleRange}"`;if(this.properties.entryAndPageNumberSeparator)U=`${U} \\p "${this.properties.entryAndPageNumberSeparator}"`;if(this.properties.seqFieldIdentifierForPrefix)U=`${U} \\s "${this.properties.seqFieldIdentifierForPrefix}"`;if(this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let G=this.properties.stylesWithLevels.map((Y)=>`${Y.styleName},${Y.level}`).join(",");U=`${U} \\t "${G}"`}if(this.properties.useAppliedParagraphOutlineLevel)U=`${U} \\u`;if(this.properties.preserveTabInEntries)U=`${U} \\w`;if(this.properties.preserveNewLineInEntries)U=`${U} \\x`;if(this.properties.hideTabAndPageNumbersInWebView)U=`${U} \\z`;this.root.push(U)}},r9=class extends t{constructor(){super("w:sdtContent")}},i9=class extends t{constructor(B){super("w:sdtPr");if(B)this.root.push(new q2("w:alias",B))}};function qK(B,U){if(B==null)return{};var G={};for(var Y in B)if({}.hasOwnProperty.call(B,Y)){if(U.includes(Y))continue;G[Y]=B[Y]}return G}function n9(B,U){if(B==null)return{};var G,Y,Q=qK(B,U);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(B);for(Y=0;Y0){let{stylesWithLevels:W}=K,I=Y.map((T,A)=>{var P,j;let E=this.buildCachedContentParagraphChild(T,K),C=(P=W===null||W===void 0||(j=W.find((v)=>v.level===T.level))===null||j===void 0?void 0:j.styleName)!==null&&P!==void 0?P:`TOC${T.level}`,N=A===0?[...J,E]:A===Y.length-1?[E,...q]:[E];return new d0({style:C,tabStops:this.getTabStopsForLevel(T.level),children:N})}),H=I;if(Y.length<=1)H=[...I,new d0({children:q})];for(let T of H)Z.addChildElement(T)}else{let W=new d0({children:J});Z.addChildElement(W);for(let H of G)Z.addChildElement(H);let I=new d0({children:q});Z.addChildElement(I)}this.root.push(Z)}getTabStopsForLevel(B,U=9025){return[{type:"clear",position:U+1-(B-1)*240},{type:"right",position:U,leader:"dot"}]}buildCachedContentRun(B,U){var G,Y;return new D0({style:(U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0?"IndexLink":void 0,children:[new Z1({text:B.title}),new T4,new Z1({text:(G=(Y=B.page)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:""})]})}buildCachedContentParagraphChild(B,U){let G=this.buildCachedContentRun(B,U);if((U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0)return new y4({anchor:B.href,children:[G]});return G}},LK=class{constructor(B,U){e(this,"styleName",void 0),e(this,"level",void 0),this.styleName=B,this.level=U}},IK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},OK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},s9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},o9=class extends t{constructor(B){super("w:footnoteReference");this.root.push(new s9({id:B}))}},HK=class extends D0{constructor(B){super({style:"FootnoteReference"});this.root.push(new o9(B))}},t9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},e9=class extends t{constructor(B){super("w:endnoteReference");this.root.push(new t9({id:B}))}},FK=class extends D0{constructor(B){super({style:"EndnoteReference"});this.root.push(new e9(B))}},o6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w14:val",symbolfont:"w14:font"})}},b1=class extends t{constructor(B,U,G){super(B);if(G)this.root.push(new o6({val:SB(U),symbolfont:G}));else this.root.push(new o6({val:U}))}},B5=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w14:checkbox");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let W=(B===null||B===void 0?void 0:B.checked)?"1":"0",I,H;this.root.push(new b1("w14:checked",W)),I=(B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.value)?B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value:this.DEFAULT_CHECKED_SYMBOL,H=(B===null||B===void 0||(Y=B.checkedState)===null||Y===void 0?void 0:Y.font)?B===null||B===void 0||(Q=B.checkedState)===null||Q===void 0?void 0:Q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:checkedState",I,H)),I=(B===null||B===void 0||(K=B.uncheckedState)===null||K===void 0?void 0:K.value)?B===null||B===void 0||(Z=B.uncheckedState)===null||Z===void 0?void 0:Z.value:this.DEFAULT_UNCHECKED_SYMBOL,H=(B===null||B===void 0||(J=B.uncheckedState)===null||J===void 0?void 0:J.font)?B===null||B===void 0||(q=B.uncheckedState)===null||q===void 0?void 0:q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:uncheckedState",I,H))}},WK=class extends t{constructor(B){var U,G,Y,Q;super("w:sdt");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let K=new i9(B===null||B===void 0?void 0:B.alias);K.addChildElement(new B5(B)),this.root.push(K);let Z=new r9,J=B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.font,q=B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value,W=B===null||B===void 0||(Y=B.uncheckedState)===null||Y===void 0?void 0:Y.font,I=B===null||B===void 0||(Q=B.uncheckedState)===null||Q===void 0?void 0:Q.value,H,T;if(B===null||B===void 0?void 0:B.checked)H=J?J:this.DEFAULT_FONT,T=q?q:this.DEFAULT_CHECKED_SYMBOL;else H=W?W:this.DEFAULT_FONT,T=I?I:this.DEFAULT_UNCHECKED_SYMBOL;let A=new aB({char:T,symbolfont:H});Z.addChildElement(A),this.root.push(Z)}},PK=({shape:B})=>new M0({name:"w:pict",children:[B]}),AK=({children:B=[]})=>new M0({name:"w:txbxContent",children:B}),jK=({style:B,children:U,inset:G})=>new M0({name:"v:textbox",attributes:{style:{key:"style",value:B},insetMode:{key:"insetmode",value:G?"custom":"auto"},inset:{key:"inset",value:G?`${G.left}, ${G.top}, ${G.right}, ${G.bottom}`:void 0}},children:[AK({children:U})]}),NK="#_x0000_t202",zK={flip:"flip",height:"height",left:"left",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",positionHorizontal:"mso-position-horizontal",positionHorizontalRelative:"mso-position-horizontal-relative",positionVertical:"mso-position-vertical",positionVerticalRelative:"mso-position-vertical-relative",wrapDistanceBottom:"mso-wrap-distance-bottom",wrapDistanceLeft:"mso-wrap-distance-left",wrapDistanceRight:"mso-wrap-distance-right",wrapDistanceTop:"mso-wrap-distance-top",wrapEdited:"mso-wrap-edited",wrapStyle:"mso-wrap-style",position:"position",rotation:"rotation",top:"top",visibility:"visibility",width:"width",zIndex:"z-index"},wK=(B)=>B?Object.entries(B).map(([U,G])=>`${zK[U]}:${G}`).join(";"):void 0,EK=({id:B,children:U,type:G=NK,style:Y})=>new M0({name:"v:shape",attributes:{id:{key:"id",value:B},type:{key:"type",value:G},style:{key:"style",value:wK(Y)}},children:[jK({style:"mso-fit-shape-to-text:t;",children:U})]}),DK=["style","children"],TK=class extends H1{constructor(B){let{style:U,children:G}=B,Y=n9(B,DK);super("w:p");this.root.push(new M2(Y)),this.root.push(PK({shape:EK({children:G,id:O1(),style:U})}))}},CK=R0((B,U)=>{d2(),P2();/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -35,8 +35,8 @@ Actual: `+z.attribValue);else{var Z0=z.tag,g=z.tags[z.tags.length-1]||z;if(Z0.ns JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE - */(function(G){if(typeof B=="object"&&typeof U<"u")U.exports=G();else if(typeof define=="function"&&define.amd)define([],G);else(typeof window<"u"?window:typeof v0<"u"?v0:typeof self<"u"?self:this).JSZip=G()})(function(){return function G(Y,Q,K){function Z(W,I){if(!Q[W]){if(!Y[W]){var H=typeof z1=="function"&&z1;if(!I&&H)return H(W,!0);if(J)return J(W,!0);var T=Error("Cannot find module '"+W+"'");throw T.code="MODULE_NOT_FOUND",T}var A=Q[W]={exports:{}};Y[W][0].call(A.exports,function(P){var j=Y[W][1][P];return Z(j||P)},A,A.exports,G,Y,Q,K)}return Q[W].exports}for(var J=typeof z1=="function"&&z1,q=0;q>2,A=(3&W)<<4|I>>4,P=1>6:64,j=2>4,I=(15&T)<<4|(A=J.indexOf(q.charAt(j++)))>>2,H=(3&A)<<6|(P=J.indexOf(q.charAt(j++))),N[E++]=W,A!==64&&(N[E++]=I),P!==64&&(N[E++]=H);return N}},{"./support":30,"./utils":32}],2:[function(G,Y,Q){var K=G("./external"),Z=G("./stream/DataWorker"),J=G("./stream/Crc32Probe"),q=G("./stream/DataLengthProbe");function W(I,H,T,A,P){this.compressedSize=I,this.uncompressedSize=H,this.crc32=T,this.compression=A,this.compressedContent=P}W.prototype={getContentWorker:function(){var I=new Z(K.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new q("data_length")),H=this;return I.on("end",function(){if(this.streamInfo.data_length!==H.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),I},getCompressedWorker:function(){return new Z(K.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},W.createWorkerFrom=function(I,H,T){return I.pipe(new J).pipe(new q("uncompressedSize")).pipe(H.compressWorker(T)).pipe(new q("compressedSize")).withStreamInfo("compression",H)},Y.exports=W},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(G,Y,Q){var K=G("./stream/GenericWorker");Q.STORE={magic:"\x00\x00",compressWorker:function(){return new K("STORE compression")},uncompressWorker:function(){return new K("STORE decompression")}},Q.DEFLATE=G("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(G,Y,Q){var K=G("./utils"),Z=function(){for(var J,q=[],W=0;W<256;W++){J=W;for(var I=0;I<8;I++)J=1&J?3988292384^J>>>1:J>>>1;q[W]=J}return q}();Y.exports=function(J,q){return J!==void 0&&J.length?K.getTypeOf(J)!=="string"?function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I[j])];return-1^W}(0|q,J,J.length,0):function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I.charCodeAt(j))];return-1^W}(0|q,J,J.length,0):0}},{"./utils":32}],5:[function(G,Y,Q){Q.base64=!1,Q.binary=!1,Q.dir=!1,Q.createFolders=!0,Q.date=null,Q.compression=null,Q.compressionOptions=null,Q.comment=null,Q.unixPermissions=null,Q.dosPermissions=null},{}],6:[function(G,Y,Q){var K=null;K=typeof Promise<"u"?Promise:G("lie"),Y.exports={Promise:K}},{lie:37}],7:[function(G,Y,Q){var K=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",Z=G("pako"),J=G("./utils"),q=G("./stream/GenericWorker"),W=K?"uint8array":"array";function I(H,T){q.call(this,"FlateWorker/"+H),this._pako=null,this._pakoAction=H,this._pakoOptions=T,this.meta={}}Q.magic="\b\x00",J.inherits(I,q),I.prototype.processChunk=function(H){this.meta=H.meta,this._pako===null&&this._createPako(),this._pako.push(J.transformTo(W,H.data),!1)},I.prototype.flush=function(){q.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},I.prototype.cleanUp=function(){q.prototype.cleanUp.call(this),this._pako=null},I.prototype._createPako=function(){this._pako=new Z[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var H=this;this._pako.onData=function(T){H.push({data:T,meta:H.meta})}},Q.compressWorker=function(H){return new I("Deflate",H)},Q.uncompressWorker=function(){return new I("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(G,Y,Q){function K(A,P){var j,E="";for(j=0;j>>=8;return E}function Z(A,P,j,E,C,N){var v,S,F=A.file,M=A.compression,$=N!==W.utf8encode,x=J.transformTo("string",N(F.name)),w=J.transformTo("string",W.utf8encode(F.name)),a=F.comment,U0=J.transformTo("string",N(a)),b=J.transformTo("string",W.utf8encode(a)),c=w.length!==F.name.length,D=b.length!==a.length,m="",B0="",i="",V0=F.dir,s=F.date,G0={crc32:0,compressedSize:0,uncompressedSize:0};P&&!j||(G0.crc32=A.crc32,G0.compressedSize=A.compressedSize,G0.uncompressedSize=A.uncompressedSize);var r=0;P&&(r|=8),$||!c&&!D||(r|=2048);var y=0,n=0;V0&&(y|=16),C==="UNIX"?(n=798,y|=function(Y0,O0){var z=Y0;return Y0||(z=O0?16893:33204),(65535&z)<<16}(F.unixPermissions,V0)):(n=20,y|=function(Y0){return 63&(Y0||0)}(F.dosPermissions)),v=s.getUTCHours(),v<<=6,v|=s.getUTCMinutes(),v<<=5,v|=s.getUTCSeconds()/2,S=s.getUTCFullYear()-1980,S<<=4,S|=s.getUTCMonth()+1,S<<=5,S|=s.getUTCDate(),c&&(B0=K(1,1)+K(I(x),4)+w,m+="up"+K(B0.length,2)+B0),D&&(i=K(1,1)+K(I(U0),4)+b,m+="uc"+K(i.length,2)+i);var o="";return o+=` -\x00`,o+=K(r,2),o+=M.magic,o+=K(v,2),o+=K(S,2),o+=K(G0.crc32,4),o+=K(G0.compressedSize,4),o+=K(G0.uncompressedSize,4),o+=K(x.length,2),o+=K(m.length,2),{fileRecord:H.LOCAL_FILE_HEADER+o+x+m,dirRecord:H.CENTRAL_FILE_HEADER+K(n,2)+o+K(U0.length,2)+"\x00\x00\x00\x00"+K(y,4)+K(E,4)+x+m+U0}}var J=G("../utils"),q=G("../stream/GenericWorker"),W=G("../utf8"),I=G("../crc32"),H=G("../signature");function T(A,P,j,E){q.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=j,this.encodeFileName=E,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}J.inherits(T,q),T.prototype.push=function(A){var P=A.meta.percent||0,j=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,q.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:j?(P+100*(j-E-1))/j:100}}))},T.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var P=this.streamFiles&&!A.file.dir;if(P){var j=Z(A,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},T.prototype.closedSource=function(A){this.accumulate=!1;var P=this.streamFiles&&!A.file.dir,j=Z(A,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),P)this.push({data:function(E){return H.DATA_DESCRIPTOR+K(E.crc32,4)+K(E.compressedSize,4)+K(E.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},T.prototype.flush=function(){for(var A=this.bytesWritten,P=0;P=this.index;q--)W=(W<<8)+this.byteAt(q);return this.index+=J,W},readString:function(J){return K.transformTo("string",this.readData(J))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var J=this.readInt(4);return new Date(Date.UTC(1980+(J>>25&127),(J>>21&15)-1,J>>16&31,J>>11&31,J>>5&63,(31&J)<<1))}},Y.exports=Z},{"../utils":32}],19:[function(G,Y,Q){var K=G("./Uint8ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(G,Y,Q){var K=G("./DataReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.byteAt=function(J){return this.data.charCodeAt(this.zero+J)},Z.prototype.lastIndexOfSignature=function(J){return this.data.lastIndexOf(J)-this.zero},Z.prototype.readAndCheckSignature=function(J){return J===this.readData(4)},Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./DataReader":18}],21:[function(G,Y,Q){var K=G("./ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){if(this.checkOffset(J),J===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./ArrayReader":17}],22:[function(G,Y,Q){var K=G("../utils"),Z=G("../support"),J=G("./ArrayReader"),q=G("./StringReader"),W=G("./NodeBufferReader"),I=G("./Uint8ArrayReader");Y.exports=function(H){var T=K.getTypeOf(H);return K.checkSupport(T),T!=="string"||Z.uint8array?T==="nodebuffer"?new W(H):Z.uint8array?new I(K.transformTo("uint8array",H)):new J(K.transformTo("array",H)):new q(H)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(G,Y,Q){Q.LOCAL_FILE_HEADER="PK\x03\x04",Q.CENTRAL_FILE_HEADER="PK\x01\x02",Q.CENTRAL_DIRECTORY_END="PK\x05\x06",Q.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",Q.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",Q.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../utils");function J(q){K.call(this,"ConvertWorker to "+q),this.destType=q}Z.inherits(J,K),J.prototype.processChunk=function(q){this.push({data:Z.transformTo(this.destType,q.data),meta:q.meta})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],25:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../crc32");function J(){K.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}G("../utils").inherits(J,K),J.prototype.processChunk=function(q){this.streamInfo.crc32=Z(q.data,this.streamInfo.crc32||0),this.push(q)},Y.exports=J},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataLengthProbe for "+q),this.propName=q,this.withStreamInfo(q,0)}K.inherits(J,Z),J.prototype.processChunk=function(q){if(q){var W=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=W+q.data.length}Z.prototype.processChunk.call(this,q)},Y.exports=J},{"../utils":32,"./GenericWorker":28}],27:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataWorker");var W=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,q.then(function(I){W.dataIsReady=!0,W.data=I,W.max=I&&I.length||0,W.type=K.getTypeOf(I),W.isPaused||W._tickAndRepeat()},function(I){W.error(I)})}K.inherits(J,Z),J.prototype.cleanUp=function(){Z.prototype.cleanUp.call(this),this.data=null},J.prototype.resume=function(){return!!Z.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,K.delay(this._tickAndRepeat,[],this)),!0)},J.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(K.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},J.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var q=null,W=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":q=this.data.substring(this.index,W);break;case"uint8array":q=this.data.subarray(this.index,W);break;case"array":case"nodebuffer":q=this.data.slice(this.index,W)}return this.index=W,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],28:[function(G,Y,Q){function K(Z){this.name=Z||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}K.prototype={push:function(Z){this.emit("data",Z)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Z){this.emit("error",Z)}return!0},error:function(Z){return!this.isFinished&&(this.isPaused?this.generatedError=Z:(this.isFinished=!0,this.emit("error",Z),this.previous&&this.previous.error(Z),this.cleanUp()),!0)},on:function(Z,J){return this._listeners[Z].push(J),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Z,J){if(this._listeners[Z])for(var q=0;q "+Z:Z}},Y.exports=K},{}],29:[function(G,Y,Q){var K=G("../utils"),Z=G("./ConvertWorker"),J=G("./GenericWorker"),q=G("../base64"),W=G("../support"),I=G("../external"),H=null;if(W.nodestream)try{H=G("../nodejs/NodejsStreamOutputAdapter")}catch(P){}function T(P,j){return new I.Promise(function(E,C){var N=[],v=P._internalType,S=P._outputType,F=P._mimeType;P.on("data",function(M,$){N.push(M),j&&j($)}).on("error",function(M){N=[],C(M)}).on("end",function(){try{E(function(M,$,x){switch(M){case"blob":return K.newBlob(K.transformTo("arraybuffer",$),x);case"base64":return q.encode($);default:return K.transformTo(M,$)}}(S,function(M,$){var x,w=0,a=null,U0=0;for(x=0;x<$.length;x++)U0+=$[x].length;switch(M){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":for(a=new Uint8Array(U0),x=0;x<$.length;x++)a.set($[x],w),w+=$[x].length;return a;case"nodebuffer":return Buffer.concat($);default:throw Error("concat : unsupported type '"+M+"'")}}(v,N),F))}catch(M){C(M)}N=[]}).resume()})}function A(P,j,E){var C=j;switch(j){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=j,this._mimeType=E,K.checkSupport(C),this._worker=P.pipe(new Z(C)),P.lock()}catch(N){this._worker=new J("error"),this._worker.error(N)}}A.prototype={accumulate:function(P){return T(this,P)},on:function(P,j){var E=this;return P==="data"?this._worker.on(P,function(C){j.call(E,C.data,C.meta)}):this._worker.on(P,function(){K.delay(j,arguments,E)}),this},resume:function(){return K.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(P){if(K.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new H(this,{objectMode:this._outputType!=="nodebuffer"},P)}},Y.exports=A},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(G,Y,Q){if(Q.base64=!0,Q.array=!0,Q.string=!0,Q.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Q.nodebuffer=typeof Buffer<"u",Q.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")Q.blob=!1;else{var K=new ArrayBuffer(0);try{Q.blob=new Blob([K],{type:"application/zip"}).size===0}catch(J){try{var Z=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Z.append(K),Q.blob=Z.getBlob("application/zip").size===0}catch(q){Q.blob=!1}}}try{Q.nodestream=!!G("readable-stream").Readable}catch(J){Q.nodestream=!1}},{"readable-stream":16}],31:[function(G,Y,Q){for(var K=G("./utils"),Z=G("./support"),J=G("./nodejsUtils"),q=G("./stream/GenericWorker"),W=Array(256),I=0;I<256;I++)W[I]=252<=I?6:248<=I?5:240<=I?4:224<=I?3:192<=I?2:1;W[254]=W[254]=1;function H(){q.call(this,"utf-8 decode"),this.leftOver=null}function T(){q.call(this,"utf-8 encode")}Q.utf8encode=function(A){return Z.nodebuffer?J.newBufferFrom(A,"utf-8"):function(P){var j,E,C,N,v,S=P.length,F=0;for(N=0;N>>6:(E<65536?j[v++]=224|E>>>12:(j[v++]=240|E>>>18,j[v++]=128|E>>>12&63),j[v++]=128|E>>>6&63),j[v++]=128|63&E);return j}(A)},Q.utf8decode=function(A){return Z.nodebuffer?K.transformTo("nodebuffer",A).toString("utf-8"):function(P){var j,E,C,N,v=P.length,S=Array(2*v);for(j=E=0;j>10&1023,S[E++]=56320|1023&C)}return S.length!==E&&(S.subarray?S=S.subarray(0,E):S.length=E),K.applyFromCharCode(S)}(A=K.transformTo(Z.uint8array?"uint8array":"array",A))},K.inherits(H,q),H.prototype.processChunk=function(A){var P=K.transformTo(Z.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(Z.uint8array){var j=P;(P=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),P.set(j,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var E=function(N,v){var S;for((v=v||N.length)>N.length&&(v=N.length),S=v-1;0<=S&&(192&N[S])==128;)S--;return S<0?v:S===0?v:S+W[N[S]]>v?S:v}(P),C=P;E!==P.length&&(Z.uint8array?(C=P.subarray(0,E),this.leftOver=P.subarray(E,P.length)):(C=P.slice(0,E),this.leftOver=P.slice(E,P.length))),this.push({data:Q.utf8decode(C),meta:A.meta})},H.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:Q.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},Q.Utf8DecodeWorker=H,K.inherits(T,q),T.prototype.processChunk=function(A){this.push({data:Q.utf8encode(A.data),meta:A.meta})},Q.Utf8EncodeWorker=T},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(G,Y,Q){var K=G("./support"),Z=G("./base64"),J=G("./nodejsUtils"),q=G("./external");function W(j){return j}function I(j,E){for(var C=0;C>8;this.dir=!!(16&this.externalFileAttributes),A==0&&(this.dosPermissions=63&this.externalFileAttributes),A==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var A=K(this.extraFields[1].value);this.uncompressedSize===Z.MAX_VALUE_32BITS&&(this.uncompressedSize=A.readInt(8)),this.compressedSize===Z.MAX_VALUE_32BITS&&(this.compressedSize=A.readInt(8)),this.localHeaderOffset===Z.MAX_VALUE_32BITS&&(this.localHeaderOffset=A.readInt(8)),this.diskNumberStart===Z.MAX_VALUE_32BITS&&(this.diskNumberStart=A.readInt(4))}},readExtraFields:function(A){var P,j,E,C=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(A<65536?T[E++]=224|A>>>12:(T[E++]=240|A>>>18,T[E++]=128|A>>>12&63),T[E++]=128|A>>>6&63),T[E++]=128|63&A);return T},Q.buf2binstring=function(H){return I(H,H.length)},Q.binstring2buf=function(H){for(var T=new K.Buf8(H.length),A=0,P=T.length;A>10&1023,N[P++]=56320|1023&j)}return I(N,P)},Q.utf8border=function(H,T){var A;for((T=T||H.length)>H.length&&(T=H.length),A=T-1;0<=A&&(192&H[A])==128;)A--;return A<0?T:A===0?T:A+q[H[A]]>T?A:T}},{"./common":41}],43:[function(G,Y,Q){Y.exports=function(K,Z,J,q){for(var W=65535&K|0,I=K>>>16&65535|0,H=0;J!==0;){for(J-=H=2000>>1:Z>>>1;J[q]=Z}return J}();Y.exports=function(Z,J,q,W){var I=K,H=W+q;Z^=-1;for(var T=W;T>>8^I[255&(Z^J[T])];return-1^Z}},{}],46:[function(G,Y,Q){var K,Z=G("../utils/common"),J=G("./trees"),q=G("./adler32"),W=G("./crc32"),I=G("./messages"),H=0,T=4,A=0,P=-2,j=-1,E=4,C=2,N=8,v=9,S=286,F=30,M=19,$=2*S+1,x=15,w=3,a=258,U0=a+w+1,b=42,c=113,D=1,m=2,B0=3,i=4;function V0(R,p){return R.msg=I[p],p}function s(R){return(R<<1)-(4R.avail_out&&(k=R.avail_out),k!==0&&(Z.arraySet(R.output,p.pending_buf,p.pending_out,k,R.next_out),R.next_out+=k,p.pending_out+=k,R.total_out+=k,R.avail_out-=k,p.pending-=k,p.pending===0&&(p.pending_out=0))}function y(R,p){J._tr_flush_block(R,0<=R.block_start?R.block_start:-1,R.strstart-R.block_start,p),R.block_start=R.strstart,r(R.strm)}function n(R,p){R.pending_buf[R.pending++]=p}function o(R,p){R.pending_buf[R.pending++]=p>>>8&255,R.pending_buf[R.pending++]=255&p}function Y0(R,p){var k,V,X=R.max_chain_length,O=R.strstart,_=R.prev_length,l=R.nice_match,d=R.strstart>R.w_size-U0?R.strstart-(R.w_size-U0):0,Q0=R.window,X0=R.w_mask,K0=R.prev,I0=R.strstart+a,F0=Q0[O+_-1],W0=Q0[O+_];R.prev_length>=R.good_match&&(X>>=2),l>R.lookahead&&(l=R.lookahead);do if(Q0[(k=p)+_]===W0&&Q0[k+_-1]===F0&&Q0[k]===Q0[O]&&Q0[++k]===Q0[O+1]){O+=2,k++;do;while(Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Od&&--X!=0);return _<=R.lookahead?_:R.lookahead}function O0(R){var p,k,V,X,O,_,l,d,Q0,X0,K0=R.w_size;do{if(X=R.window_size-R.lookahead-R.strstart,R.strstart>=K0+(K0-U0)){for(Z.arraySet(R.window,R.window,K0,K0,0),R.match_start-=K0,R.strstart-=K0,R.block_start-=K0,p=k=R.hash_size;V=R.head[--p],R.head[p]=K0<=V?V-K0:0,--k;);for(p=k=K0;V=R.prev[--p],R.prev[p]=K0<=V?V-K0:0,--k;);X+=K0}if(R.strm.avail_in===0)break;if(_=R.strm,l=R.window,d=R.strstart+R.lookahead,Q0=X,X0=void 0,X0=_.avail_in,Q0=w)for(O=R.strstart-R.insert,R.ins_h=R.window[O],R.ins_h=(R.ins_h<=w&&(R.ins_h=(R.ins_h<=w)if(V=J._tr_tally(R,R.strstart-R.match_start,R.match_length-w),R.lookahead-=R.match_length,R.match_length<=R.max_lazy_match&&R.lookahead>=w){for(R.match_length--;R.strstart++,R.ins_h=(R.ins_h<=w&&(R.ins_h=(R.ins_h<=w&&R.match_length<=R.prev_length){for(X=R.strstart+R.lookahead-w,V=J._tr_tally(R,R.strstart-1-R.prev_match,R.prev_length-w),R.lookahead-=R.prev_length-1,R.prev_length-=2;++R.strstart<=X&&(R.ins_h=(R.ins_h<R.pending_buf_size-5&&(k=R.pending_buf_size-5);;){if(R.lookahead<=1){if(O0(R),R.lookahead===0&&p===H)return D;if(R.lookahead===0)break}R.strstart+=R.lookahead,R.lookahead=0;var V=R.block_start+k;if((R.strstart===0||R.strstart>=V)&&(R.lookahead=R.strstart-V,R.strstart=V,y(R,!1),R.strm.avail_out===0))return D;if(R.strstart-R.block_start>=R.w_size-U0&&(y(R,!1),R.strm.avail_out===0))return D}return R.insert=0,p===T?(y(R,!0),R.strm.avail_out===0?B0:i):(R.strstart>R.block_start&&(y(R,!1),R.strm.avail_out),D)}),new u(4,4,8,4,z),new u(4,5,16,8,z),new u(4,6,32,32,z),new u(4,4,16,16,L),new u(8,16,32,32,L),new u(8,16,128,128,L),new u(8,32,128,256,L),new u(32,128,258,1024,L),new u(32,258,258,4096,L)],Q.deflateInit=function(R,p){return f(R,p,N,15,8,0)},Q.deflateInit2=f,Q.deflateReset=g,Q.deflateResetKeep=Z0,Q.deflateSetHeader=function(R,p){return R&&R.state?R.state.wrap!==2?P:(R.state.gzhead=p,A):P},Q.deflate=function(R,p){var k,V,X,O;if(!R||!R.state||5>8&255),n(V,V.gzhead.time>>16&255),n(V,V.gzhead.time>>24&255),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,255&V.gzhead.os),V.gzhead.extra&&V.gzhead.extra.length&&(n(V,255&V.gzhead.extra.length),n(V,V.gzhead.extra.length>>8&255)),V.gzhead.hcrc&&(R.adler=W(R.adler,V.pending_buf,V.pending,0)),V.gzindex=0,V.status=69):(n(V,0),n(V,0),n(V,0),n(V,0),n(V,0),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,3),V.status=c);else{var _=N+(V.w_bits-8<<4)<<8;_|=(2<=V.strategy||V.level<2?0:V.level<6?1:V.level===6?2:3)<<6,V.strstart!==0&&(_|=32),_+=31-_%31,V.status=c,o(V,_),V.strstart!==0&&(o(V,R.adler>>>16),o(V,65535&R.adler)),R.adler=1}if(V.status===69)if(V.gzhead.extra){for(X=V.pending;V.gzindex<(65535&V.gzhead.extra.length)&&(V.pending!==V.pending_buf_size||(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending!==V.pending_buf_size));)n(V,255&V.gzhead.extra[V.gzindex]),V.gzindex++;V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),V.gzindex===V.gzhead.extra.length&&(V.gzindex=0,V.status=73)}else V.status=73;if(V.status===73)if(V.gzhead.name){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.gzindex=0,V.status=91)}else V.status=91;if(V.status===91)if(V.gzhead.comment){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.status=103)}else V.status=103;if(V.status===103&&(V.gzhead.hcrc?(V.pending+2>V.pending_buf_size&&r(R),V.pending+2<=V.pending_buf_size&&(n(V,255&R.adler),n(V,R.adler>>8&255),R.adler=0,V.status=c)):V.status=c),V.pending!==0){if(r(R),R.avail_out===0)return V.last_flush=-1,A}else if(R.avail_in===0&&s(p)<=s(k)&&p!==T)return V0(R,-5);if(V.status===666&&R.avail_in!==0)return V0(R,-5);if(R.avail_in!==0||V.lookahead!==0||p!==H&&V.status!==666){var l=V.strategy===2?function(d,Q0){for(var X0;;){if(d.lookahead===0&&(O0(d),d.lookahead===0)){if(Q0===H)return D;break}if(d.match_length=0,X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++,X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):V.strategy===3?function(d,Q0){for(var X0,K0,I0,F0,W0=d.window;;){if(d.lookahead<=a){if(O0(d),d.lookahead<=a&&Q0===H)return D;if(d.lookahead===0)break}if(d.match_length=0,d.lookahead>=w&&0d.lookahead&&(d.match_length=d.lookahead)}if(d.match_length>=w?(X0=J._tr_tally(d,1,d.match_length-w),d.lookahead-=d.match_length,d.strstart+=d.match_length,d.match_length=0):(X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++),X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):K[V.level].func(V,p);if(l!==B0&&l!==i||(V.status=666),l===D||l===B0)return R.avail_out===0&&(V.last_flush=-1),A;if(l===m&&(p===1?J._tr_align(V):p!==5&&(J._tr_stored_block(V,0,0,!1),p===3&&(G0(V.head),V.lookahead===0&&(V.strstart=0,V.block_start=0,V.insert=0))),r(R),R.avail_out===0))return V.last_flush=-1,A}return p!==T?A:V.wrap<=0?1:(V.wrap===2?(n(V,255&R.adler),n(V,R.adler>>8&255),n(V,R.adler>>16&255),n(V,R.adler>>24&255),n(V,255&R.total_in),n(V,R.total_in>>8&255),n(V,R.total_in>>16&255),n(V,R.total_in>>24&255)):(o(V,R.adler>>>16),o(V,65535&R.adler)),r(R),0=k.w_size&&(O===0&&(G0(k.head),k.strstart=0,k.block_start=0,k.insert=0),Q0=new Z.Buf8(k.w_size),Z.arraySet(Q0,p,X0-k.w_size,k.w_size,0),p=Q0,X0=k.w_size),_=R.avail_in,l=R.next_in,d=R.input,R.avail_in=X0,R.next_in=0,R.input=p,O0(k);k.lookahead>=w;){for(V=k.strstart,X=k.lookahead-(w-1);k.ins_h=(k.ins_h<>>=w=x>>>24,v-=w,(w=x>>>16&255)===0)m[I++]=65535&x;else{if(!(16&w)){if((64&w)==0){x=S[(65535&x)+(N&(1<>>=w,v-=w),v<15&&(N+=D[q++]<>>=w=x>>>24,v-=w,!(16&(w=x>>>16&255))){if((64&w)==0){x=F[(65535&x)+(N&(1<>>=w,v-=w,(w=I-H)>3,N&=(1<<(v-=a<<3))-1,K.next_in=q,K.next_out=I,K.avail_in=q>>24&255)+(b>>>8&65280)+((65280&b)<<8)+((255&b)<<24)}function N(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new K.Buf16(320),this.work=new K.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(b){var c;return b&&b.state?(c=b.state,b.total_in=b.total_out=c.total=0,b.msg="",c.wrap&&(b.adler=1&c.wrap),c.mode=P,c.last=0,c.havedict=0,c.dmax=32768,c.head=null,c.hold=0,c.bits=0,c.lencode=c.lendyn=new K.Buf32(j),c.distcode=c.distdyn=new K.Buf32(E),c.sane=1,c.back=-1,T):A}function S(b){var c;return b&&b.state?((c=b.state).wsize=0,c.whave=0,c.wnext=0,v(b)):A}function F(b,c){var D,m;return b&&b.state?(m=b.state,c<0?(D=0,c=-c):(D=1+(c>>4),c<48&&(c&=15)),c&&(c<8||15=i.wsize?(K.arraySet(i.window,c,D-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(m<(B0=i.wsize-i.wnext)&&(B0=m),K.arraySet(i.window,c,D-m,B0,i.wnext),(m-=B0)?(K.arraySet(i.window,c,D-m,m,0),i.wnext=m,i.whave=i.wsize):(i.wnext+=B0,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,D.check=J(D.check,O,2,0),y=r=0,D.mode=2;break}if(D.flags=0,D.head&&(D.head.done=!1),!(1&D.wrap)||(((255&r)<<8)+(r>>8))%31){b.msg="incorrect header check",D.mode=30;break}if((15&r)!=8){b.msg="unknown compression method",D.mode=30;break}if(y-=4,R=8+(15&(r>>>=4)),D.wbits===0)D.wbits=R;else if(R>D.wbits){b.msg="invalid window size",D.mode=30;break}D.dmax=1<>8&1),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=3;case 3:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>8&255,O[2]=r>>>16&255,O[3]=r>>>24&255,D.check=J(D.check,O,4,0)),y=r=0,D.mode=4;case 4:for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>8),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=5;case 5:if(1024&D.flags){for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>>8&255,D.check=J(D.check,O,2,0)),y=r=0}else D.head&&(D.head.extra=null);D.mode=6;case 6:if(1024&D.flags&&(s<(Y0=D.length)&&(Y0=s),Y0&&(D.head&&(R=D.head.extra_len-D.length,D.head.extra||(D.head.extra=Array(D.head.extra_len)),K.arraySet(D.head.extra,m,i,Y0,R)),512&D.flags&&(D.check=J(D.check,m,Y0,i)),s-=Y0,i+=Y0,D.length-=Y0),D.length))break B;D.length=0,D.mode=7;case 7:if(2048&D.flags){if(s===0)break B;for(Y0=0;R=m[i+Y0++],D.head&&R&&D.length<65536&&(D.head.name+=String.fromCharCode(R)),R&&Y0>9&1,D.head.done=!0),b.adler=D.check=0,D.mode=12;break;case 10:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>=7&y,y-=7&y,D.mode=27;break}for(;y<3;){if(s===0)break B;s--,r+=m[i++]<>>=1)){case 0:D.mode=14;break;case 1:if(a(D),D.mode=20,c!==6)break;r>>>=2,y-=2;break B;case 2:D.mode=17;break;case 3:b.msg="invalid block type",D.mode=30}r>>>=2,y-=2;break;case 14:for(r>>>=7&y,y-=7&y;y<32;){if(s===0)break B;s--,r+=m[i++]<>>16^65535)){b.msg="invalid stored block lengths",D.mode=30;break}if(D.length=65535&r,y=r=0,D.mode=15,c===6)break B;case 15:D.mode=16;case 16:if(Y0=D.length){if(s>>=5,y-=5,D.ndist=1+(31&r),r>>>=5,y-=5,D.ncode=4+(15&r),r>>>=4,y-=4,286>>=3,y-=3}for(;D.have<19;)D.lens[_[D.have++]]=0;if(D.lencode=D.lendyn,D.lenbits=7,k={bits:D.lenbits},p=W(0,D.lens,0,19,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid code lengths set",D.mode=30;break}D.have=0,D.mode=19;case 19:for(;D.have>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=L,y-=L,D.lens[D.have++]=h;else{if(h===16){for(V=L+2;y>>=L,y-=L,D.have===0){b.msg="invalid bit length repeat",D.mode=30;break}R=D.lens[D.have-1],Y0=3+(3&r),r>>>=2,y-=2}else if(h===17){for(V=L+3;y>>=L)),r>>>=3,y-=3}else{for(V=L+7;y>>=L)),r>>>=7,y-=7}if(D.have+Y0>D.nlen+D.ndist){b.msg="invalid bit length repeat",D.mode=30;break}for(;Y0--;)D.lens[D.have++]=R}}if(D.mode===30)break;if(D.lens[256]===0){b.msg="invalid code -- missing end-of-block",D.mode=30;break}if(D.lenbits=9,k={bits:D.lenbits},p=W(I,D.lens,0,D.nlen,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid literal/lengths set",D.mode=30;break}if(D.distbits=6,D.distcode=D.distdyn,k={bits:D.distbits},p=W(H,D.lens,D.nlen,D.ndist,D.distcode,0,D.work,k),D.distbits=k.bits,p){b.msg="invalid distances set",D.mode=30;break}if(D.mode=20,c===6)break B;case 20:D.mode=21;case 21:if(6<=s&&258<=G0){b.next_out=V0,b.avail_out=G0,b.next_in=i,b.avail_in=s,D.hold=r,D.bits=y,q(b,o),V0=b.next_out,B0=b.output,G0=b.avail_out,i=b.next_in,m=b.input,s=b.avail_in,r=D.hold,y=D.bits,D.mode===12&&(D.back=-1);break}for(D.back=0;u=(X=D.lencode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,D.length=h,u===0){D.mode=26;break}if(32&u){D.back=-1,D.mode=12;break}if(64&u){b.msg="invalid literal/length code",D.mode=30;break}D.extra=15&u,D.mode=22;case 22:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}D.was=D.length,D.mode=23;case 23:for(;u=(X=D.distcode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,64&u){b.msg="invalid distance code",D.mode=30;break}D.offset=h,D.extra=15&u,D.mode=24;case 24:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}if(D.offset>D.dmax){b.msg="invalid distance too far back",D.mode=30;break}D.mode=25;case 25:if(G0===0)break B;if(Y0=o-G0,D.offset>Y0){if((Y0=D.offset-Y0)>D.whave&&D.sane){b.msg="invalid distance too far back",D.mode=30;break}O0=Y0>D.wnext?(Y0-=D.wnext,D.wsize-Y0):D.wnext-Y0,Y0>D.length&&(Y0=D.length),z=D.window}else z=B0,O0=V0-D.offset,Y0=D.length;for(G0$?(w=O0[z+E[c]],y[n+E[c]]):(w=96,0),N=1<>V0)+(v-=N)]=x<<24|w<<16|a|0,v!==0;);for(N=1<>=1;if(N!==0?(r&=N-1,r+=N):r=0,c++,--o[b]==0){if(b===m)break;b=H[T+E[c]]}if(B0>>7)]}function n(X,O){X.pending_buf[X.pending++]=255&O,X.pending_buf[X.pending++]=O>>>8&255}function o(X,O,_){X.bi_valid>C-_?(X.bi_buf|=O<>C-X.bi_valid,X.bi_valid+=_-C):(X.bi_buf|=O<>>=1,_<<=1,0<--O;);return _>>>1}function z(X,O,_){var l,d,Q0=Array(E+1),X0=0;for(l=1;l<=E;l++)Q0[l]=X0=X0+_[l-1]<<1;for(d=0;d<=O;d++){var K0=X[2*d+1];K0!==0&&(X[2*d]=O0(Q0[K0]++,K0))}}function L(X){var O;for(O=0;O>1;1<=_;_--)Z0(X,Q0,_);for(d=I0;_=X.heap[1],X.heap[1]=X.heap[X.heap_len--],Z0(X,Q0,1),l=X.heap[1],X.heap[--X.heap_max]=_,X.heap[--X.heap_max]=l,Q0[2*d]=Q0[2*_]+Q0[2*l],X.depth[d]=(X.depth[_]>=X.depth[l]?X.depth[_]:X.depth[l])+1,Q0[2*_+1]=Q0[2*l+1]=d,X.heap[1]=d++,Z0(X,Q0,1),2<=X.heap_len;);X.heap[--X.heap_max]=X.heap[1],function(W0,k0){var L2,m0,r2,w0,W1,p1,Y2=k0.dyn_tree,I6=k0.max_code,X5=k0.stat_desc.static_tree,q5=k0.stat_desc.has_stree,M5=k0.stat_desc.extra_bits,O6=k0.stat_desc.extra_base,i2=k0.stat_desc.max_length,P1=0;for(w0=0;w0<=E;w0++)W0.bl_count[w0]=0;for(Y2[2*W0.heap[W0.heap_max]+1]=0,L2=W0.heap_max+1;L2>=7;d>>=1)if(1&F0&&K0.dyn_ltree[2*I0]!==0)return Z;if(K0.dyn_ltree[18]!==0||K0.dyn_ltree[20]!==0||K0.dyn_ltree[26]!==0)return J;for(I0=32;I0>>3,(Q0=X.static_len+3+7>>>3)<=d&&(d=Q0)):d=Q0=_+5,_+4<=d&&O!==-1?V(X,O,_,l):X.strategy===4||Q0===d?(o(X,2+(l?1:0),3),g(X,U0,b)):(o(X,4+(l?1:0),3),function(K0,I0,F0,W0){var k0;for(o(K0,I0-257,5),o(K0,F0-1,5),o(K0,W0-4,4),k0=0;k0>>8&255,X.pending_buf[X.d_buf+2*X.last_lit+1]=255&O,X.pending_buf[X.l_buf+X.last_lit]=255&_,X.last_lit++,O===0?X.dyn_ltree[2*_]++:(X.matches++,O--,X.dyn_ltree[2*(D[_]+H+1)]++,X.dyn_dtree[2*y(O)]++),X.last_lit===X.lit_bufsize-1},Q._tr_align=function(X){o(X,2,3),Y0(X,v,U0),function(O){O.bi_valid===16?(n(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(X)}},{"../utils/common":41}],53:[function(G,Y,Q){Y.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(G,Y,Q){(function(K){(function(Z,J){if(!Z.setImmediate){var q,W,I,H,T=1,A={},P=!1,j=Z.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(Z);E=E&&E.setTimeout?E:Z,q={}.toString.call(Z.process)==="[object process]"?function(S){P0.nextTick(function(){N(S)})}:function(){if(Z.postMessage&&!Z.importScripts){var S=!0,F=Z.onmessage;return Z.onmessage=function(){S=!1},Z.postMessage("","*"),Z.onmessage=F,S}}()?(H="setImmediate$"+Math.random()+"$",Z.addEventListener?Z.addEventListener("message",v,!1):Z.attachEvent("onmessage",v),function(S){Z.postMessage(H+S,"*")}):Z.MessageChannel?((I=new MessageChannel).port1.onmessage=function(S){N(S.data)},function(S){I.port2.postMessage(S)}):j&&("onreadystatechange"in j.createElement("script"))?(W=j.documentElement,function(S){var F=j.createElement("script");F.onreadystatechange=function(){N(S),F.onreadystatechange=null,W.removeChild(F),F=null},W.appendChild(F)}):function(S){setTimeout(N,0,S)},E.setImmediate=function(S){typeof S!="function"&&(S=Function(""+S));for(var F=Array(arguments.length-1),M=0;M"u"?K===void 0?this:K:self)}).call(this,typeof v0<"u"?v0:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}),kK=R0((B,U)=>{var G={"&":"&",'"':""","'":"'","<":"<",">":">"};function Y(Q){return Q&&Q.replace?Q.replace(/([&"<>'])/g,function(K,Z){return G[Z]}):Q}U.exports=Y}),$K=R0((B,U)=>{P2();var G=kK(),Y=x8().Stream,Q=" ";function K(H,T){if(typeof T!=="object")T={indent:T};var A=T.stream?new Y:null,P="",j=!1,E=!T.indent?"":T.indent===!0?Q:T.indent,C=!0;function N($){if(!C)$();else P0.nextTick($)}function v($,x){if(x!==void 0)P+=x;if($&&!j)A=A||new Y,j=!0;if($&&j){var w=P;N(function(){A.emit("data",w)}),P=""}}function S($,x){W(v,q($,E,E?1:0),x)}function F(){if(A){var $=P;N(function(){A.emit("data",$),A.emit("end"),A.readable=!1,A.emit("close")})}}function M($){var x={version:"1.0",encoding:$.encoding||"UTF-8"};if($.standalone)x.standalone=$.standalone;S({"?xml":{_attr:x}}),P=P.replace("/>","?>")}if(N(function(){C=!1}),T.declaration)M(T.declaration);if(H&&H.forEach)H.forEach(function($,x){var w;if(x+1===H.length)w=F;S($,w)});else S(H,F);if(A)return A.readable=!0,A;return P}function Z(){var H={_elem:q(Array.prototype.slice.call(arguments))};return H.push=function(T){if(!this.append)throw Error("not assigned to a parent!");var A=this,P=this._elem.indent;W(this.append,q(T,P,this._elem.icount+(P?1:0)),function(){A.append(!0)})},H.close=function(T){if(T!==void 0)this.push(T);if(this.end)this.end()},H}function J(H,T){return Array(T||0).join(H||"")}function q(H,T,A){A=A||0;var P=J(T,A),j,E=H,C=!1;if(typeof H==="object"){if(j=Object.keys(H)[0],E=H[j],E&&E._elem)return E._elem.name=j,E._elem.icount=A,E._elem.indent=T,E._elem.indents=P,E._elem.interrupt=E,E._elem}var N=[],v=[],S;function F(M){Object.keys(M).forEach(function($){N.push(I($,M[$]))})}switch(typeof E){case"object":if(E===null)break;if(E._attr)F(E._attr);if(E._cdata)v.push(("/g,"]]]]>")+"]]>");if(E.forEach){if(S=!1,v.push(""),E.forEach(function(M){if(typeof M=="object")if(Object.keys(M)[0]=="_attr")F(M._attr);else v.push(q(M,T,A+1));else v.pop(),S=!0,v.push(G(M))}),!S)v.push("")}break;default:v.push(G(E))}return{name:j,interrupt:C,attributes:N,content:v,icount:A,indents:P,indent:T}}function W(H,T,A){if(typeof T!="object")return H(!1,T);var P=T.interrupt?1:T.content.length;function j(){while(T.content.length){var C=T.content.shift();if(C===void 0)continue;if(E(C))return;W(H,C)}if(H(!1,(P>1?T.indents:"")+(T.name?"":"")+(T.indent&&!A?` + */(function(G){if(typeof B=="object"&&typeof U<"u")U.exports=G();else if(typeof define=="function"&&define.amd)define([],G);else(typeof window<"u"?window:typeof v0<"u"?v0:typeof self<"u"?self:this).JSZip=G()})(function(){return function G(Y,Q,K){function Z(W,I){if(!Q[W]){if(!Y[W]){var H=typeof w1=="function"&&w1;if(!I&&H)return H(W,!0);if(J)return J(W,!0);var T=Error("Cannot find module '"+W+"'");throw T.code="MODULE_NOT_FOUND",T}var A=Q[W]={exports:{}};Y[W][0].call(A.exports,function(P){var j=Y[W][1][P];return Z(j||P)},A,A.exports,G,Y,Q,K)}return Q[W].exports}for(var J=typeof w1=="function"&&w1,q=0;q>2,A=(3&W)<<4|I>>4,P=1>6:64,j=2>4,I=(15&T)<<4|(A=J.indexOf(q.charAt(j++)))>>2,H=(3&A)<<6|(P=J.indexOf(q.charAt(j++))),N[E++]=W,A!==64&&(N[E++]=I),P!==64&&(N[E++]=H);return N}},{"./support":30,"./utils":32}],2:[function(G,Y,Q){var K=G("./external"),Z=G("./stream/DataWorker"),J=G("./stream/Crc32Probe"),q=G("./stream/DataLengthProbe");function W(I,H,T,A,P){this.compressedSize=I,this.uncompressedSize=H,this.crc32=T,this.compression=A,this.compressedContent=P}W.prototype={getContentWorker:function(){var I=new Z(K.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new q("data_length")),H=this;return I.on("end",function(){if(this.streamInfo.data_length!==H.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),I},getCompressedWorker:function(){return new Z(K.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},W.createWorkerFrom=function(I,H,T){return I.pipe(new J).pipe(new q("uncompressedSize")).pipe(H.compressWorker(T)).pipe(new q("compressedSize")).withStreamInfo("compression",H)},Y.exports=W},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(G,Y,Q){var K=G("./stream/GenericWorker");Q.STORE={magic:"\x00\x00",compressWorker:function(){return new K("STORE compression")},uncompressWorker:function(){return new K("STORE decompression")}},Q.DEFLATE=G("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(G,Y,Q){var K=G("./utils"),Z=function(){for(var J,q=[],W=0;W<256;W++){J=W;for(var I=0;I<8;I++)J=1&J?3988292384^J>>>1:J>>>1;q[W]=J}return q}();Y.exports=function(J,q){return J!==void 0&&J.length?K.getTypeOf(J)!=="string"?function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I[j])];return-1^W}(0|q,J,J.length,0):function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I.charCodeAt(j))];return-1^W}(0|q,J,J.length,0):0}},{"./utils":32}],5:[function(G,Y,Q){Q.base64=!1,Q.binary=!1,Q.dir=!1,Q.createFolders=!0,Q.date=null,Q.compression=null,Q.compressionOptions=null,Q.comment=null,Q.unixPermissions=null,Q.dosPermissions=null},{}],6:[function(G,Y,Q){var K=null;K=typeof Promise<"u"?Promise:G("lie"),Y.exports={Promise:K}},{lie:37}],7:[function(G,Y,Q){var K=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",Z=G("pako"),J=G("./utils"),q=G("./stream/GenericWorker"),W=K?"uint8array":"array";function I(H,T){q.call(this,"FlateWorker/"+H),this._pako=null,this._pakoAction=H,this._pakoOptions=T,this.meta={}}Q.magic="\b\x00",J.inherits(I,q),I.prototype.processChunk=function(H){this.meta=H.meta,this._pako===null&&this._createPako(),this._pako.push(J.transformTo(W,H.data),!1)},I.prototype.flush=function(){q.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},I.prototype.cleanUp=function(){q.prototype.cleanUp.call(this),this._pako=null},I.prototype._createPako=function(){this._pako=new Z[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var H=this;this._pako.onData=function(T){H.push({data:T,meta:H.meta})}},Q.compressWorker=function(H){return new I("Deflate",H)},Q.uncompressWorker=function(){return new I("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(G,Y,Q){function K(A,P){var j,E="";for(j=0;j>>=8;return E}function Z(A,P,j,E,C,N){var v,S,F=A.file,M=A.compression,$=N!==W.utf8encode,x=J.transformTo("string",N(F.name)),z=J.transformTo("string",W.utf8encode(F.name)),a=F.comment,U0=J.transformTo("string",N(a)),b=J.transformTo("string",W.utf8encode(a)),c=z.length!==F.name.length,D=b.length!==a.length,m="",B0="",i="",V0=F.dir,s=F.date,G0={crc32:0,compressedSize:0,uncompressedSize:0};P&&!j||(G0.crc32=A.crc32,G0.compressedSize=A.compressedSize,G0.uncompressedSize=A.uncompressedSize);var r=0;P&&(r|=8),$||!c&&!D||(r|=2048);var y=0,n=0;V0&&(y|=16),C==="UNIX"?(n=798,y|=function(Y0,O0){var w=Y0;return Y0||(w=O0?16893:33204),(65535&w)<<16}(F.unixPermissions,V0)):(n=20,y|=function(Y0){return 63&(Y0||0)}(F.dosPermissions)),v=s.getUTCHours(),v<<=6,v|=s.getUTCMinutes(),v<<=5,v|=s.getUTCSeconds()/2,S=s.getUTCFullYear()-1980,S<<=4,S|=s.getUTCMonth()+1,S<<=5,S|=s.getUTCDate(),c&&(B0=K(1,1)+K(I(x),4)+z,m+="up"+K(B0.length,2)+B0),D&&(i=K(1,1)+K(I(U0),4)+b,m+="uc"+K(i.length,2)+i);var o="";return o+=` +\x00`,o+=K(r,2),o+=M.magic,o+=K(v,2),o+=K(S,2),o+=K(G0.crc32,4),o+=K(G0.compressedSize,4),o+=K(G0.uncompressedSize,4),o+=K(x.length,2),o+=K(m.length,2),{fileRecord:H.LOCAL_FILE_HEADER+o+x+m,dirRecord:H.CENTRAL_FILE_HEADER+K(n,2)+o+K(U0.length,2)+"\x00\x00\x00\x00"+K(y,4)+K(E,4)+x+m+U0}}var J=G("../utils"),q=G("../stream/GenericWorker"),W=G("../utf8"),I=G("../crc32"),H=G("../signature");function T(A,P,j,E){q.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=j,this.encodeFileName=E,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}J.inherits(T,q),T.prototype.push=function(A){var P=A.meta.percent||0,j=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,q.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:j?(P+100*(j-E-1))/j:100}}))},T.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var P=this.streamFiles&&!A.file.dir;if(P){var j=Z(A,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},T.prototype.closedSource=function(A){this.accumulate=!1;var P=this.streamFiles&&!A.file.dir,j=Z(A,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),P)this.push({data:function(E){return H.DATA_DESCRIPTOR+K(E.crc32,4)+K(E.compressedSize,4)+K(E.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},T.prototype.flush=function(){for(var A=this.bytesWritten,P=0;P=this.index;q--)W=(W<<8)+this.byteAt(q);return this.index+=J,W},readString:function(J){return K.transformTo("string",this.readData(J))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var J=this.readInt(4);return new Date(Date.UTC(1980+(J>>25&127),(J>>21&15)-1,J>>16&31,J>>11&31,J>>5&63,(31&J)<<1))}},Y.exports=Z},{"../utils":32}],19:[function(G,Y,Q){var K=G("./Uint8ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(G,Y,Q){var K=G("./DataReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.byteAt=function(J){return this.data.charCodeAt(this.zero+J)},Z.prototype.lastIndexOfSignature=function(J){return this.data.lastIndexOf(J)-this.zero},Z.prototype.readAndCheckSignature=function(J){return J===this.readData(4)},Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./DataReader":18}],21:[function(G,Y,Q){var K=G("./ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){if(this.checkOffset(J),J===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./ArrayReader":17}],22:[function(G,Y,Q){var K=G("../utils"),Z=G("../support"),J=G("./ArrayReader"),q=G("./StringReader"),W=G("./NodeBufferReader"),I=G("./Uint8ArrayReader");Y.exports=function(H){var T=K.getTypeOf(H);return K.checkSupport(T),T!=="string"||Z.uint8array?T==="nodebuffer"?new W(H):Z.uint8array?new I(K.transformTo("uint8array",H)):new J(K.transformTo("array",H)):new q(H)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(G,Y,Q){Q.LOCAL_FILE_HEADER="PK\x03\x04",Q.CENTRAL_FILE_HEADER="PK\x01\x02",Q.CENTRAL_DIRECTORY_END="PK\x05\x06",Q.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",Q.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",Q.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../utils");function J(q){K.call(this,"ConvertWorker to "+q),this.destType=q}Z.inherits(J,K),J.prototype.processChunk=function(q){this.push({data:Z.transformTo(this.destType,q.data),meta:q.meta})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],25:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../crc32");function J(){K.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}G("../utils").inherits(J,K),J.prototype.processChunk=function(q){this.streamInfo.crc32=Z(q.data,this.streamInfo.crc32||0),this.push(q)},Y.exports=J},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataLengthProbe for "+q),this.propName=q,this.withStreamInfo(q,0)}K.inherits(J,Z),J.prototype.processChunk=function(q){if(q){var W=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=W+q.data.length}Z.prototype.processChunk.call(this,q)},Y.exports=J},{"../utils":32,"./GenericWorker":28}],27:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataWorker");var W=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,q.then(function(I){W.dataIsReady=!0,W.data=I,W.max=I&&I.length||0,W.type=K.getTypeOf(I),W.isPaused||W._tickAndRepeat()},function(I){W.error(I)})}K.inherits(J,Z),J.prototype.cleanUp=function(){Z.prototype.cleanUp.call(this),this.data=null},J.prototype.resume=function(){return!!Z.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,K.delay(this._tickAndRepeat,[],this)),!0)},J.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(K.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},J.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var q=null,W=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":q=this.data.substring(this.index,W);break;case"uint8array":q=this.data.subarray(this.index,W);break;case"array":case"nodebuffer":q=this.data.slice(this.index,W)}return this.index=W,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],28:[function(G,Y,Q){function K(Z){this.name=Z||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}K.prototype={push:function(Z){this.emit("data",Z)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Z){this.emit("error",Z)}return!0},error:function(Z){return!this.isFinished&&(this.isPaused?this.generatedError=Z:(this.isFinished=!0,this.emit("error",Z),this.previous&&this.previous.error(Z),this.cleanUp()),!0)},on:function(Z,J){return this._listeners[Z].push(J),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Z,J){if(this._listeners[Z])for(var q=0;q "+Z:Z}},Y.exports=K},{}],29:[function(G,Y,Q){var K=G("../utils"),Z=G("./ConvertWorker"),J=G("./GenericWorker"),q=G("../base64"),W=G("../support"),I=G("../external"),H=null;if(W.nodestream)try{H=G("../nodejs/NodejsStreamOutputAdapter")}catch(P){}function T(P,j){return new I.Promise(function(E,C){var N=[],v=P._internalType,S=P._outputType,F=P._mimeType;P.on("data",function(M,$){N.push(M),j&&j($)}).on("error",function(M){N=[],C(M)}).on("end",function(){try{E(function(M,$,x){switch(M){case"blob":return K.newBlob(K.transformTo("arraybuffer",$),x);case"base64":return q.encode($);default:return K.transformTo(M,$)}}(S,function(M,$){var x,z=0,a=null,U0=0;for(x=0;x<$.length;x++)U0+=$[x].length;switch(M){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":for(a=new Uint8Array(U0),x=0;x<$.length;x++)a.set($[x],z),z+=$[x].length;return a;case"nodebuffer":return Buffer.concat($);default:throw Error("concat : unsupported type '"+M+"'")}}(v,N),F))}catch(M){C(M)}N=[]}).resume()})}function A(P,j,E){var C=j;switch(j){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=j,this._mimeType=E,K.checkSupport(C),this._worker=P.pipe(new Z(C)),P.lock()}catch(N){this._worker=new J("error"),this._worker.error(N)}}A.prototype={accumulate:function(P){return T(this,P)},on:function(P,j){var E=this;return P==="data"?this._worker.on(P,function(C){j.call(E,C.data,C.meta)}):this._worker.on(P,function(){K.delay(j,arguments,E)}),this},resume:function(){return K.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(P){if(K.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new H(this,{objectMode:this._outputType!=="nodebuffer"},P)}},Y.exports=A},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(G,Y,Q){if(Q.base64=!0,Q.array=!0,Q.string=!0,Q.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Q.nodebuffer=typeof Buffer<"u",Q.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")Q.blob=!1;else{var K=new ArrayBuffer(0);try{Q.blob=new Blob([K],{type:"application/zip"}).size===0}catch(J){try{var Z=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Z.append(K),Q.blob=Z.getBlob("application/zip").size===0}catch(q){Q.blob=!1}}}try{Q.nodestream=!!G("readable-stream").Readable}catch(J){Q.nodestream=!1}},{"readable-stream":16}],31:[function(G,Y,Q){for(var K=G("./utils"),Z=G("./support"),J=G("./nodejsUtils"),q=G("./stream/GenericWorker"),W=Array(256),I=0;I<256;I++)W[I]=252<=I?6:248<=I?5:240<=I?4:224<=I?3:192<=I?2:1;W[254]=W[254]=1;function H(){q.call(this,"utf-8 decode"),this.leftOver=null}function T(){q.call(this,"utf-8 encode")}Q.utf8encode=function(A){return Z.nodebuffer?J.newBufferFrom(A,"utf-8"):function(P){var j,E,C,N,v,S=P.length,F=0;for(N=0;N>>6:(E<65536?j[v++]=224|E>>>12:(j[v++]=240|E>>>18,j[v++]=128|E>>>12&63),j[v++]=128|E>>>6&63),j[v++]=128|63&E);return j}(A)},Q.utf8decode=function(A){return Z.nodebuffer?K.transformTo("nodebuffer",A).toString("utf-8"):function(P){var j,E,C,N,v=P.length,S=Array(2*v);for(j=E=0;j>10&1023,S[E++]=56320|1023&C)}return S.length!==E&&(S.subarray?S=S.subarray(0,E):S.length=E),K.applyFromCharCode(S)}(A=K.transformTo(Z.uint8array?"uint8array":"array",A))},K.inherits(H,q),H.prototype.processChunk=function(A){var P=K.transformTo(Z.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(Z.uint8array){var j=P;(P=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),P.set(j,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var E=function(N,v){var S;for((v=v||N.length)>N.length&&(v=N.length),S=v-1;0<=S&&(192&N[S])==128;)S--;return S<0?v:S===0?v:S+W[N[S]]>v?S:v}(P),C=P;E!==P.length&&(Z.uint8array?(C=P.subarray(0,E),this.leftOver=P.subarray(E,P.length)):(C=P.slice(0,E),this.leftOver=P.slice(E,P.length))),this.push({data:Q.utf8decode(C),meta:A.meta})},H.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:Q.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},Q.Utf8DecodeWorker=H,K.inherits(T,q),T.prototype.processChunk=function(A){this.push({data:Q.utf8encode(A.data),meta:A.meta})},Q.Utf8EncodeWorker=T},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(G,Y,Q){var K=G("./support"),Z=G("./base64"),J=G("./nodejsUtils"),q=G("./external");function W(j){return j}function I(j,E){for(var C=0;C>8;this.dir=!!(16&this.externalFileAttributes),A==0&&(this.dosPermissions=63&this.externalFileAttributes),A==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var A=K(this.extraFields[1].value);this.uncompressedSize===Z.MAX_VALUE_32BITS&&(this.uncompressedSize=A.readInt(8)),this.compressedSize===Z.MAX_VALUE_32BITS&&(this.compressedSize=A.readInt(8)),this.localHeaderOffset===Z.MAX_VALUE_32BITS&&(this.localHeaderOffset=A.readInt(8)),this.diskNumberStart===Z.MAX_VALUE_32BITS&&(this.diskNumberStart=A.readInt(4))}},readExtraFields:function(A){var P,j,E,C=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(A<65536?T[E++]=224|A>>>12:(T[E++]=240|A>>>18,T[E++]=128|A>>>12&63),T[E++]=128|A>>>6&63),T[E++]=128|63&A);return T},Q.buf2binstring=function(H){return I(H,H.length)},Q.binstring2buf=function(H){for(var T=new K.Buf8(H.length),A=0,P=T.length;A>10&1023,N[P++]=56320|1023&j)}return I(N,P)},Q.utf8border=function(H,T){var A;for((T=T||H.length)>H.length&&(T=H.length),A=T-1;0<=A&&(192&H[A])==128;)A--;return A<0?T:A===0?T:A+q[H[A]]>T?A:T}},{"./common":41}],43:[function(G,Y,Q){Y.exports=function(K,Z,J,q){for(var W=65535&K|0,I=K>>>16&65535|0,H=0;J!==0;){for(J-=H=2000>>1:Z>>>1;J[q]=Z}return J}();Y.exports=function(Z,J,q,W){var I=K,H=W+q;Z^=-1;for(var T=W;T>>8^I[255&(Z^J[T])];return-1^Z}},{}],46:[function(G,Y,Q){var K,Z=G("../utils/common"),J=G("./trees"),q=G("./adler32"),W=G("./crc32"),I=G("./messages"),H=0,T=4,A=0,P=-2,j=-1,E=4,C=2,N=8,v=9,S=286,F=30,M=19,$=2*S+1,x=15,z=3,a=258,U0=a+z+1,b=42,c=113,D=1,m=2,B0=3,i=4;function V0(R,p){return R.msg=I[p],p}function s(R){return(R<<1)-(4R.avail_out&&(k=R.avail_out),k!==0&&(Z.arraySet(R.output,p.pending_buf,p.pending_out,k,R.next_out),R.next_out+=k,p.pending_out+=k,R.total_out+=k,R.avail_out-=k,p.pending-=k,p.pending===0&&(p.pending_out=0))}function y(R,p){J._tr_flush_block(R,0<=R.block_start?R.block_start:-1,R.strstart-R.block_start,p),R.block_start=R.strstart,r(R.strm)}function n(R,p){R.pending_buf[R.pending++]=p}function o(R,p){R.pending_buf[R.pending++]=p>>>8&255,R.pending_buf[R.pending++]=255&p}function Y0(R,p){var k,V,X=R.max_chain_length,O=R.strstart,_=R.prev_length,l=R.nice_match,d=R.strstart>R.w_size-U0?R.strstart-(R.w_size-U0):0,Q0=R.window,X0=R.w_mask,K0=R.prev,I0=R.strstart+a,F0=Q0[O+_-1],W0=Q0[O+_];R.prev_length>=R.good_match&&(X>>=2),l>R.lookahead&&(l=R.lookahead);do if(Q0[(k=p)+_]===W0&&Q0[k+_-1]===F0&&Q0[k]===Q0[O]&&Q0[++k]===Q0[O+1]){O+=2,k++;do;while(Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Od&&--X!=0);return _<=R.lookahead?_:R.lookahead}function O0(R){var p,k,V,X,O,_,l,d,Q0,X0,K0=R.w_size;do{if(X=R.window_size-R.lookahead-R.strstart,R.strstart>=K0+(K0-U0)){for(Z.arraySet(R.window,R.window,K0,K0,0),R.match_start-=K0,R.strstart-=K0,R.block_start-=K0,p=k=R.hash_size;V=R.head[--p],R.head[p]=K0<=V?V-K0:0,--k;);for(p=k=K0;V=R.prev[--p],R.prev[p]=K0<=V?V-K0:0,--k;);X+=K0}if(R.strm.avail_in===0)break;if(_=R.strm,l=R.window,d=R.strstart+R.lookahead,Q0=X,X0=void 0,X0=_.avail_in,Q0=z)for(O=R.strstart-R.insert,R.ins_h=R.window[O],R.ins_h=(R.ins_h<=z&&(R.ins_h=(R.ins_h<=z)if(V=J._tr_tally(R,R.strstart-R.match_start,R.match_length-z),R.lookahead-=R.match_length,R.match_length<=R.max_lazy_match&&R.lookahead>=z){for(R.match_length--;R.strstart++,R.ins_h=(R.ins_h<=z&&(R.ins_h=(R.ins_h<=z&&R.match_length<=R.prev_length){for(X=R.strstart+R.lookahead-z,V=J._tr_tally(R,R.strstart-1-R.prev_match,R.prev_length-z),R.lookahead-=R.prev_length-1,R.prev_length-=2;++R.strstart<=X&&(R.ins_h=(R.ins_h<R.pending_buf_size-5&&(k=R.pending_buf_size-5);;){if(R.lookahead<=1){if(O0(R),R.lookahead===0&&p===H)return D;if(R.lookahead===0)break}R.strstart+=R.lookahead,R.lookahead=0;var V=R.block_start+k;if((R.strstart===0||R.strstart>=V)&&(R.lookahead=R.strstart-V,R.strstart=V,y(R,!1),R.strm.avail_out===0))return D;if(R.strstart-R.block_start>=R.w_size-U0&&(y(R,!1),R.strm.avail_out===0))return D}return R.insert=0,p===T?(y(R,!0),R.strm.avail_out===0?B0:i):(R.strstart>R.block_start&&(y(R,!1),R.strm.avail_out),D)}),new u(4,4,8,4,w),new u(4,5,16,8,w),new u(4,6,32,32,w),new u(4,4,16,16,L),new u(8,16,32,32,L),new u(8,16,128,128,L),new u(8,32,128,256,L),new u(32,128,258,1024,L),new u(32,258,258,4096,L)],Q.deflateInit=function(R,p){return f(R,p,N,15,8,0)},Q.deflateInit2=f,Q.deflateReset=g,Q.deflateResetKeep=Z0,Q.deflateSetHeader=function(R,p){return R&&R.state?R.state.wrap!==2?P:(R.state.gzhead=p,A):P},Q.deflate=function(R,p){var k,V,X,O;if(!R||!R.state||5>8&255),n(V,V.gzhead.time>>16&255),n(V,V.gzhead.time>>24&255),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,255&V.gzhead.os),V.gzhead.extra&&V.gzhead.extra.length&&(n(V,255&V.gzhead.extra.length),n(V,V.gzhead.extra.length>>8&255)),V.gzhead.hcrc&&(R.adler=W(R.adler,V.pending_buf,V.pending,0)),V.gzindex=0,V.status=69):(n(V,0),n(V,0),n(V,0),n(V,0),n(V,0),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,3),V.status=c);else{var _=N+(V.w_bits-8<<4)<<8;_|=(2<=V.strategy||V.level<2?0:V.level<6?1:V.level===6?2:3)<<6,V.strstart!==0&&(_|=32),_+=31-_%31,V.status=c,o(V,_),V.strstart!==0&&(o(V,R.adler>>>16),o(V,65535&R.adler)),R.adler=1}if(V.status===69)if(V.gzhead.extra){for(X=V.pending;V.gzindex<(65535&V.gzhead.extra.length)&&(V.pending!==V.pending_buf_size||(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending!==V.pending_buf_size));)n(V,255&V.gzhead.extra[V.gzindex]),V.gzindex++;V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),V.gzindex===V.gzhead.extra.length&&(V.gzindex=0,V.status=73)}else V.status=73;if(V.status===73)if(V.gzhead.name){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.gzindex=0,V.status=91)}else V.status=91;if(V.status===91)if(V.gzhead.comment){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.status=103)}else V.status=103;if(V.status===103&&(V.gzhead.hcrc?(V.pending+2>V.pending_buf_size&&r(R),V.pending+2<=V.pending_buf_size&&(n(V,255&R.adler),n(V,R.adler>>8&255),R.adler=0,V.status=c)):V.status=c),V.pending!==0){if(r(R),R.avail_out===0)return V.last_flush=-1,A}else if(R.avail_in===0&&s(p)<=s(k)&&p!==T)return V0(R,-5);if(V.status===666&&R.avail_in!==0)return V0(R,-5);if(R.avail_in!==0||V.lookahead!==0||p!==H&&V.status!==666){var l=V.strategy===2?function(d,Q0){for(var X0;;){if(d.lookahead===0&&(O0(d),d.lookahead===0)){if(Q0===H)return D;break}if(d.match_length=0,X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++,X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):V.strategy===3?function(d,Q0){for(var X0,K0,I0,F0,W0=d.window;;){if(d.lookahead<=a){if(O0(d),d.lookahead<=a&&Q0===H)return D;if(d.lookahead===0)break}if(d.match_length=0,d.lookahead>=z&&0d.lookahead&&(d.match_length=d.lookahead)}if(d.match_length>=z?(X0=J._tr_tally(d,1,d.match_length-z),d.lookahead-=d.match_length,d.strstart+=d.match_length,d.match_length=0):(X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++),X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):K[V.level].func(V,p);if(l!==B0&&l!==i||(V.status=666),l===D||l===B0)return R.avail_out===0&&(V.last_flush=-1),A;if(l===m&&(p===1?J._tr_align(V):p!==5&&(J._tr_stored_block(V,0,0,!1),p===3&&(G0(V.head),V.lookahead===0&&(V.strstart=0,V.block_start=0,V.insert=0))),r(R),R.avail_out===0))return V.last_flush=-1,A}return p!==T?A:V.wrap<=0?1:(V.wrap===2?(n(V,255&R.adler),n(V,R.adler>>8&255),n(V,R.adler>>16&255),n(V,R.adler>>24&255),n(V,255&R.total_in),n(V,R.total_in>>8&255),n(V,R.total_in>>16&255),n(V,R.total_in>>24&255)):(o(V,R.adler>>>16),o(V,65535&R.adler)),r(R),0=k.w_size&&(O===0&&(G0(k.head),k.strstart=0,k.block_start=0,k.insert=0),Q0=new Z.Buf8(k.w_size),Z.arraySet(Q0,p,X0-k.w_size,k.w_size,0),p=Q0,X0=k.w_size),_=R.avail_in,l=R.next_in,d=R.input,R.avail_in=X0,R.next_in=0,R.input=p,O0(k);k.lookahead>=z;){for(V=k.strstart,X=k.lookahead-(z-1);k.ins_h=(k.ins_h<>>=z=x>>>24,v-=z,(z=x>>>16&255)===0)m[I++]=65535&x;else{if(!(16&z)){if((64&z)==0){x=S[(65535&x)+(N&(1<>>=z,v-=z),v<15&&(N+=D[q++]<>>=z=x>>>24,v-=z,!(16&(z=x>>>16&255))){if((64&z)==0){x=F[(65535&x)+(N&(1<>>=z,v-=z,(z=I-H)>3,N&=(1<<(v-=a<<3))-1,K.next_in=q,K.next_out=I,K.avail_in=q>>24&255)+(b>>>8&65280)+((65280&b)<<8)+((255&b)<<24)}function N(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new K.Buf16(320),this.work=new K.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(b){var c;return b&&b.state?(c=b.state,b.total_in=b.total_out=c.total=0,b.msg="",c.wrap&&(b.adler=1&c.wrap),c.mode=P,c.last=0,c.havedict=0,c.dmax=32768,c.head=null,c.hold=0,c.bits=0,c.lencode=c.lendyn=new K.Buf32(j),c.distcode=c.distdyn=new K.Buf32(E),c.sane=1,c.back=-1,T):A}function S(b){var c;return b&&b.state?((c=b.state).wsize=0,c.whave=0,c.wnext=0,v(b)):A}function F(b,c){var D,m;return b&&b.state?(m=b.state,c<0?(D=0,c=-c):(D=1+(c>>4),c<48&&(c&=15)),c&&(c<8||15=i.wsize?(K.arraySet(i.window,c,D-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(m<(B0=i.wsize-i.wnext)&&(B0=m),K.arraySet(i.window,c,D-m,B0,i.wnext),(m-=B0)?(K.arraySet(i.window,c,D-m,m,0),i.wnext=m,i.whave=i.wsize):(i.wnext+=B0,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,D.check=J(D.check,O,2,0),y=r=0,D.mode=2;break}if(D.flags=0,D.head&&(D.head.done=!1),!(1&D.wrap)||(((255&r)<<8)+(r>>8))%31){b.msg="incorrect header check",D.mode=30;break}if((15&r)!=8){b.msg="unknown compression method",D.mode=30;break}if(y-=4,R=8+(15&(r>>>=4)),D.wbits===0)D.wbits=R;else if(R>D.wbits){b.msg="invalid window size",D.mode=30;break}D.dmax=1<>8&1),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=3;case 3:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>8&255,O[2]=r>>>16&255,O[3]=r>>>24&255,D.check=J(D.check,O,4,0)),y=r=0,D.mode=4;case 4:for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>8),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=5;case 5:if(1024&D.flags){for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>>8&255,D.check=J(D.check,O,2,0)),y=r=0}else D.head&&(D.head.extra=null);D.mode=6;case 6:if(1024&D.flags&&(s<(Y0=D.length)&&(Y0=s),Y0&&(D.head&&(R=D.head.extra_len-D.length,D.head.extra||(D.head.extra=Array(D.head.extra_len)),K.arraySet(D.head.extra,m,i,Y0,R)),512&D.flags&&(D.check=J(D.check,m,Y0,i)),s-=Y0,i+=Y0,D.length-=Y0),D.length))break B;D.length=0,D.mode=7;case 7:if(2048&D.flags){if(s===0)break B;for(Y0=0;R=m[i+Y0++],D.head&&R&&D.length<65536&&(D.head.name+=String.fromCharCode(R)),R&&Y0>9&1,D.head.done=!0),b.adler=D.check=0,D.mode=12;break;case 10:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>=7&y,y-=7&y,D.mode=27;break}for(;y<3;){if(s===0)break B;s--,r+=m[i++]<>>=1)){case 0:D.mode=14;break;case 1:if(a(D),D.mode=20,c!==6)break;r>>>=2,y-=2;break B;case 2:D.mode=17;break;case 3:b.msg="invalid block type",D.mode=30}r>>>=2,y-=2;break;case 14:for(r>>>=7&y,y-=7&y;y<32;){if(s===0)break B;s--,r+=m[i++]<>>16^65535)){b.msg="invalid stored block lengths",D.mode=30;break}if(D.length=65535&r,y=r=0,D.mode=15,c===6)break B;case 15:D.mode=16;case 16:if(Y0=D.length){if(s>>=5,y-=5,D.ndist=1+(31&r),r>>>=5,y-=5,D.ncode=4+(15&r),r>>>=4,y-=4,286>>=3,y-=3}for(;D.have<19;)D.lens[_[D.have++]]=0;if(D.lencode=D.lendyn,D.lenbits=7,k={bits:D.lenbits},p=W(0,D.lens,0,19,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid code lengths set",D.mode=30;break}D.have=0,D.mode=19;case 19:for(;D.have>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=L,y-=L,D.lens[D.have++]=h;else{if(h===16){for(V=L+2;y>>=L,y-=L,D.have===0){b.msg="invalid bit length repeat",D.mode=30;break}R=D.lens[D.have-1],Y0=3+(3&r),r>>>=2,y-=2}else if(h===17){for(V=L+3;y>>=L)),r>>>=3,y-=3}else{for(V=L+7;y>>=L)),r>>>=7,y-=7}if(D.have+Y0>D.nlen+D.ndist){b.msg="invalid bit length repeat",D.mode=30;break}for(;Y0--;)D.lens[D.have++]=R}}if(D.mode===30)break;if(D.lens[256]===0){b.msg="invalid code -- missing end-of-block",D.mode=30;break}if(D.lenbits=9,k={bits:D.lenbits},p=W(I,D.lens,0,D.nlen,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid literal/lengths set",D.mode=30;break}if(D.distbits=6,D.distcode=D.distdyn,k={bits:D.distbits},p=W(H,D.lens,D.nlen,D.ndist,D.distcode,0,D.work,k),D.distbits=k.bits,p){b.msg="invalid distances set",D.mode=30;break}if(D.mode=20,c===6)break B;case 20:D.mode=21;case 21:if(6<=s&&258<=G0){b.next_out=V0,b.avail_out=G0,b.next_in=i,b.avail_in=s,D.hold=r,D.bits=y,q(b,o),V0=b.next_out,B0=b.output,G0=b.avail_out,i=b.next_in,m=b.input,s=b.avail_in,r=D.hold,y=D.bits,D.mode===12&&(D.back=-1);break}for(D.back=0;u=(X=D.lencode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,D.length=h,u===0){D.mode=26;break}if(32&u){D.back=-1,D.mode=12;break}if(64&u){b.msg="invalid literal/length code",D.mode=30;break}D.extra=15&u,D.mode=22;case 22:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}D.was=D.length,D.mode=23;case 23:for(;u=(X=D.distcode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,64&u){b.msg="invalid distance code",D.mode=30;break}D.offset=h,D.extra=15&u,D.mode=24;case 24:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}if(D.offset>D.dmax){b.msg="invalid distance too far back",D.mode=30;break}D.mode=25;case 25:if(G0===0)break B;if(Y0=o-G0,D.offset>Y0){if((Y0=D.offset-Y0)>D.whave&&D.sane){b.msg="invalid distance too far back",D.mode=30;break}O0=Y0>D.wnext?(Y0-=D.wnext,D.wsize-Y0):D.wnext-Y0,Y0>D.length&&(Y0=D.length),w=D.window}else w=B0,O0=V0-D.offset,Y0=D.length;for(G0$?(z=O0[w+E[c]],y[n+E[c]]):(z=96,0),N=1<>V0)+(v-=N)]=x<<24|z<<16|a|0,v!==0;);for(N=1<>=1;if(N!==0?(r&=N-1,r+=N):r=0,c++,--o[b]==0){if(b===m)break;b=H[T+E[c]]}if(B0>>7)]}function n(X,O){X.pending_buf[X.pending++]=255&O,X.pending_buf[X.pending++]=O>>>8&255}function o(X,O,_){X.bi_valid>C-_?(X.bi_buf|=O<>C-X.bi_valid,X.bi_valid+=_-C):(X.bi_buf|=O<>>=1,_<<=1,0<--O;);return _>>>1}function w(X,O,_){var l,d,Q0=Array(E+1),X0=0;for(l=1;l<=E;l++)Q0[l]=X0=X0+_[l-1]<<1;for(d=0;d<=O;d++){var K0=X[2*d+1];K0!==0&&(X[2*d]=O0(Q0[K0]++,K0))}}function L(X){var O;for(O=0;O>1;1<=_;_--)Z0(X,Q0,_);for(d=I0;_=X.heap[1],X.heap[1]=X.heap[X.heap_len--],Z0(X,Q0,1),l=X.heap[1],X.heap[--X.heap_max]=_,X.heap[--X.heap_max]=l,Q0[2*d]=Q0[2*_]+Q0[2*l],X.depth[d]=(X.depth[_]>=X.depth[l]?X.depth[_]:X.depth[l])+1,Q0[2*_+1]=Q0[2*l+1]=d,X.heap[1]=d++,Z0(X,Q0,1),2<=X.heap_len;);X.heap[--X.heap_max]=X.heap[1],function(W0,k0){var L2,m0,r2,z0,W1,p1,Y2=k0.dyn_tree,I6=k0.max_code,X5=k0.stat_desc.static_tree,q5=k0.stat_desc.has_stree,M5=k0.stat_desc.extra_bits,O6=k0.stat_desc.extra_base,i2=k0.stat_desc.max_length,P1=0;for(z0=0;z0<=E;z0++)W0.bl_count[z0]=0;for(Y2[2*W0.heap[W0.heap_max]+1]=0,L2=W0.heap_max+1;L2>=7;d>>=1)if(1&F0&&K0.dyn_ltree[2*I0]!==0)return Z;if(K0.dyn_ltree[18]!==0||K0.dyn_ltree[20]!==0||K0.dyn_ltree[26]!==0)return J;for(I0=32;I0>>3,(Q0=X.static_len+3+7>>>3)<=d&&(d=Q0)):d=Q0=_+5,_+4<=d&&O!==-1?V(X,O,_,l):X.strategy===4||Q0===d?(o(X,2+(l?1:0),3),g(X,U0,b)):(o(X,4+(l?1:0),3),function(K0,I0,F0,W0){var k0;for(o(K0,I0-257,5),o(K0,F0-1,5),o(K0,W0-4,4),k0=0;k0>>8&255,X.pending_buf[X.d_buf+2*X.last_lit+1]=255&O,X.pending_buf[X.l_buf+X.last_lit]=255&_,X.last_lit++,O===0?X.dyn_ltree[2*_]++:(X.matches++,O--,X.dyn_ltree[2*(D[_]+H+1)]++,X.dyn_dtree[2*y(O)]++),X.last_lit===X.lit_bufsize-1},Q._tr_align=function(X){o(X,2,3),Y0(X,v,U0),function(O){O.bi_valid===16?(n(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(X)}},{"../utils/common":41}],53:[function(G,Y,Q){Y.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(G,Y,Q){(function(K){(function(Z,J){if(!Z.setImmediate){var q,W,I,H,T=1,A={},P=!1,j=Z.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(Z);E=E&&E.setTimeout?E:Z,q={}.toString.call(Z.process)==="[object process]"?function(S){P0.nextTick(function(){N(S)})}:function(){if(Z.postMessage&&!Z.importScripts){var S=!0,F=Z.onmessage;return Z.onmessage=function(){S=!1},Z.postMessage("","*"),Z.onmessage=F,S}}()?(H="setImmediate$"+Math.random()+"$",Z.addEventListener?Z.addEventListener("message",v,!1):Z.attachEvent("onmessage",v),function(S){Z.postMessage(H+S,"*")}):Z.MessageChannel?((I=new MessageChannel).port1.onmessage=function(S){N(S.data)},function(S){I.port2.postMessage(S)}):j&&("onreadystatechange"in j.createElement("script"))?(W=j.documentElement,function(S){var F=j.createElement("script");F.onreadystatechange=function(){N(S),F.onreadystatechange=null,W.removeChild(F),F=null},W.appendChild(F)}):function(S){setTimeout(N,0,S)},E.setImmediate=function(S){typeof S!="function"&&(S=Function(""+S));for(var F=Array(arguments.length-1),M=0;M"u"?K===void 0?this:K:self)}).call(this,typeof v0<"u"?v0:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}),kK=R0((B,U)=>{var G={"&":"&",'"':""","'":"'","<":"<",">":">"};function Y(Q){return Q&&Q.replace?Q.replace(/([&"<>'])/g,function(K,Z){return G[Z]}):Q}U.exports=Y}),$K=R0((B,U)=>{P2();var G=kK(),Y=x8().Stream,Q=" ";function K(H,T){if(typeof T!=="object")T={indent:T};var A=T.stream?new Y:null,P="",j=!1,E=!T.indent?"":T.indent===!0?Q:T.indent,C=!0;function N($){if(!C)$();else P0.nextTick($)}function v($,x){if(x!==void 0)P+=x;if($&&!j)A=A||new Y,j=!0;if($&&j){var z=P;N(function(){A.emit("data",z)}),P=""}}function S($,x){W(v,q($,E,E?1:0),x)}function F(){if(A){var $=P;N(function(){A.emit("data",$),A.emit("end"),A.readable=!1,A.emit("close")})}}function M($){var x={version:"1.0",encoding:$.encoding||"UTF-8"};if($.standalone)x.standalone=$.standalone;S({"?xml":{_attr:x}}),P=P.replace("/>","?>")}if(N(function(){C=!1}),T.declaration)M(T.declaration);if(H&&H.forEach)H.forEach(function($,x){var z;if(x+1===H.length)z=F;S($,z)});else S(H,F);if(A)return A.readable=!0,A;return P}function Z(){var H={_elem:q(Array.prototype.slice.call(arguments))};return H.push=function(T){if(!this.append)throw Error("not assigned to a parent!");var A=this,P=this._elem.indent;W(this.append,q(T,P,this._elem.icount+(P?1:0)),function(){A.append(!0)})},H.close=function(T){if(T!==void 0)this.push(T);if(this.end)this.end()},H}function J(H,T){return Array(T||0).join(H||"")}function q(H,T,A){A=A||0;var P=J(T,A),j,E=H,C=!1;if(typeof H==="object"){if(j=Object.keys(H)[0],E=H[j],E&&E._elem)return E._elem.name=j,E._elem.icount=A,E._elem.indent=T,E._elem.indents=P,E._elem.interrupt=E,E._elem}var N=[],v=[],S;function F(M){Object.keys(M).forEach(function($){N.push(I($,M[$]))})}switch(typeof E){case"object":if(E===null)break;if(E._attr)F(E._attr);if(E._cdata)v.push(("/g,"]]]]>")+"]]>");if(E.forEach){if(S=!1,v.push(""),E.forEach(function(M){if(typeof M=="object")if(Object.keys(M)[0]=="_attr")F(M._attr);else v.push(q(M,T,A+1));else v.pop(),S=!0,v.push(G(M))}),!S)v.push("")}break;default:v.push(G(E))}return{name:j,interrupt:C,attributes:N,content:v,icount:A,indents:P,indent:T}}function W(H,T,A){if(typeof T!="object")return H(!1,T);var P=T.interrupt?1:T.content.length;function j(){while(T.content.length){var C=T.content.shift();if(C===void 0)continue;if(E(C))return;W(H,C)}if(H(!1,(P>1?T.indents:"")+(T.name?"":"")+(T.indent&&!A?` `:"")),A)A()}function E(C){if(C.interrupt)return C.interrupt.append=H,C.interrupt.end=j,C.interrupt=!1,H(!0),!0;return!1}if(H(!1,T.indents+(T.name?"<"+T.name:"")+(T.attributes.length?" "+T.attributes.join(" "):"")+(P?T.name?">":"":T.name?"/>":"")+(T.indent&&P>1?` `:"")),!P)return H(!1,T.indent?` -`:"");if(!E(T))j()}function I(H,T){return H+'="'+G(T)+'"'}U.exports=K,U.exports.element=U.exports.Element=Z}),SK=x8(),h2=k8(CK(),1),A0=k8($K(),1),o2=0,R8=32,bK=32,vK=(B,U)=>{let G=U.replace(/-/g,"");if(G.length!==bK)throw Error(`Error: Cannot extract GUID from font filename: ${U}`);let Y=G.replace(/(..)/g,"$1 ").trim().split(" ").map((Z)=>parseInt(Z,16));Y.reverse();let Q=B.slice(o2,R8).map((Z,J)=>Z^Y[J%Y.length]),K=new Uint8Array(o2+Q.length+Math.max(0,B.length-R8));return K.set(B.slice(0,o2)),K.set(Q,o2),K.set(B.slice(R8),o2+Q.length),K},q6=class{format(B,U={stack:[]}){let G=B.prepForXml(U);if(G)return G;else throw Error("XMLComponent did not format correctly")}},U5=class{replace(B,U,G){let Y=B;return U.forEach((Q,K)=>{Y=Y.replace(new RegExp(`{${Q.fileName}}`,"g"),(G+K).toString())}),Y}getMediaData(B,U){return U.Array.filter((G)=>B.search(`{${G.fileName}}`)>0)}},yK=class{replace(B,U){let G=B;for(let Y of U)G=G.replace(new RegExp(`{${Y.reference}-${Y.instance}}`,"g"),Y.numId.toString());return G}},gK=class{constructor(){e(this,"formatter",void 0),e(this,"imageReplacer",void 0),e(this,"numberingReplacer",void 0),this.formatter=new q6,this.imageReplacer=new U5,this.numberingReplacer=new yK}compile(B,U,G=[]){let Y=new h2.default,Q=this.xmlifyFile(B,U),K=new Map(Object.entries(Q));for(let[,Z]of K)if(Array.isArray(Z))for(let J of Z)Y.file(J.path,U1(J.data));else Y.file(Z.path,U1(Z.data));for(let Z of G)Y.file(Z.path,U1(Z.data));for(let Z of B.Media.Array)if(Z.type!=="svg")Y.file(`word/media/${Z.fileName}`,Z.data);else Y.file(`word/media/${Z.fileName}`,Z.data),Y.file(`word/media/${Z.fallback.fileName}`,Z.fallback.data);for(let[Z,{data:J,fontKey:q}]of B.FontTable.fontOptionsWithKey.entries())Y.file(`word/fonts/font${Z+1}.odttf`,vK(J,q));return Y}xmlifyFile(B,U){let G=B.Document.Relationships.RelationshipCount+1,Y=(0,A0.default)(this.formatter.format(B.Document.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Q=B.Comments.Relationships.RelationshipCount+1,K=(0,A0.default)(this.formatter.format(B.Comments,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Z=B.FootNotes.Relationships.RelationshipCount+1,J=(0,A0.default)(this.formatter.format(B.FootNotes.View,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),q=this.imageReplacer.getMediaData(Y,B.Media),W=this.imageReplacer.getMediaData(K,B.Media),I=this.imageReplacer.getMediaData(J,B.Media);return L0(L0({Relationships:{data:(()=>{return q.forEach((H,T)=>{B.Document.Relationships.addRelationship(G+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),B.Document.Relationships.addRelationship(B.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),(0,A0.default)(this.formatter.format(B.Document.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let H=this.imageReplacer.replace(Y,q,G);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let H=(0,A0.default)(this.formatter.format(B.Styles,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:(0,A0.default)(this.formatter.format(B.CoreProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:(0,A0.default)(this.formatter.format(B.Numbering,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:(0,A0.default)(this.formatter.format(B.FileRelationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${T+1}.xml.rels`}}),FooterRelationships:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${T+1}.xml.rels`}}),Headers:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/header${T+1}.xml`}}),Footers:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/footer${T+1}.xml`}}),ContentTypes:{data:(0,A0.default)(this.formatter.format(B.ContentTypes,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:(0,A0.default)(this.formatter.format(B.CustomProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:(0,A0.default)(this.formatter.format(B.AppProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let H=this.imageReplacer.replace(J,I,Z);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{return I.forEach((H,T)=>{B.FootNotes.Relationships.addRelationship(Z+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.FootNotes.Relationships,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(0,A0.default)(this.formatter.format(B.Endnotes.View,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/endnotes.xml"},EndnotesRelationships:{data:(0,A0.default)(this.formatter.format(B.Endnotes.Relationships,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/endnotes.xml.rels"},Settings:{data:(0,A0.default)(this.formatter.format(B.Settings,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{let H=this.imageReplacer.replace(K,W,Q);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{return W.forEach((H,T)=>{B.Comments.Relationships.addRelationship(Q+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.Comments.Relationships,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}},B.CommentsExtended?{CommentsExtended:{data:(0,A0.default)(this.formatter.format(B.CommentsExtended,{viewWrapper:{View:B.CommentsExtended,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),{},{FontTable:{data:(0,A0.default)(this.formatter.format(B.FontTable.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:(0,A0.default)(this.formatter.format(B.FontTable.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}})}};function t6(B,U,G,Y,Q,K,Z){try{var J=B[K](Z),q=J.value}catch(W){G(W);return}J.done?U(q):Promise.resolve(q).then(Y,Q)}function M6(B){return function(){var U=this,G=arguments;return new Promise(function(Y,Q){var K=B.apply(U,G);function Z(q){t6(K,Y,Q,Z,J,"next",q)}function J(q){t6(K,Y,Q,Z,J,"throw",q)}Z(void 0)})}}var G5={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:"\t"},e6=(B)=>B===!0?G5.WITH_2_BLANKS:B===!1?void 0:B,Y5=class B{static pack(U,G,Y){var Q=this;return M6(function*(K,Z,J,q=[]){return Q.compiler.compile(K,e6(J),q).generateAsync({type:Z,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})}).apply(this,arguments)}static toString(U,G,Y=[]){return B.pack(U,"string",G,Y)}static toBuffer(U,G,Y=[]){return B.pack(U,"nodebuffer",G,Y)}static toBase64String(U,G,Y=[]){return B.pack(U,"base64",G,Y)}static toBlob(U,G,Y=[]){return B.pack(U,"blob",G,Y)}static toArrayBuffer(U,G,Y=[]){return B.pack(U,"arraybuffer",G,Y)}static toStream(U,G,Y=[]){let Q=new SK.Stream;return this.compiler.compile(U,e6(G),Y).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then((K)=>{Q.emit("data",K),Q.emit("end")}),Q}};e(Y5,"compiler",new gK);var fK=new q6,a1=(B)=>{return(0,h1.xml2js)(B,{compact:!1,captureSpacesBetweenElements:!0})},Z5=(B)=>{var U;return(U=a1((0,A0.default)(fK.format(new Z1({text:B})))).elements[0].elements)!==null&&U!==void 0?U:[]},Q5=(B)=>L0(L0({},B),{},{attributes:{"xml:space":"preserve"}}),R6=(B,U)=>{var G,Y;return(G=(Y=B.elements)===null||Y===void 0?void 0:Y.filter((Q)=>Q.name===U)[0].elements)!==null&&G!==void 0?G:[]},g2=(B,U,G)=>{let Y=R6(B,"Types");if(Y.some((Q)=>{var K,Z;return Q.type==="element"&&Q.name==="Default"&&(Q===null||Q===void 0||(K=Q.attributes)===null||K===void 0?void 0:K.ContentType)===U&&(Q===null||Q===void 0||(Z=Q.attributes)===null||Z===void 0?void 0:Z.Extension)===G}))return;Y.push({attributes:{ContentType:U,Extension:G},name:"Default",type:"element"})},xK=(B)=>{let U=parseInt(B.substring(3),10);return isNaN(U)?0:U},_K=(B)=>{return R6(B,"Relationships").map((U)=>{var G,Y;return xK((G=(Y=U.attributes)===null||Y===void 0||(Y=Y.Id)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:"")}).reduce((U,G)=>Math.max(U,G),0)+1},BB=(B,U,G,Y,Q)=>{let K=R6(B,"Relationships");return K.push({attributes:{Id:`rId${U}`,Type:G,Target:Y,TargetMode:Q},name:"Relationship",type:"element"}),K},hK=class extends Error{constructor(B){super(`Token ${B} not found`);this.name="TokenNotFoundError"}},uK=(B,U)=>{var G;for(let Z=0;Z<((G=B.elements)!==null&&G!==void 0?G:[]).length;Z++){let J=B.elements[Z];if(J.type==="element"&&J.name==="w:r"){var Y;let q=((Y=J.elements)!==null&&Y!==void 0?Y:[]).filter((W)=>W.type==="element"&&W.name==="w:t");for(let W of q){var Q,K;if(!((Q=W.elements)===null||Q===void 0?void 0:Q[0]))continue;if((K=W.elements[0].text)===null||K===void 0?void 0:K.includes(U))return Z}}}throw new hK(U)},dK=(B,U)=>{var G,Y;let Q=-1,K=(G=(Y=B.elements)===null||Y===void 0?void 0:Y.map((Z,J)=>{if(Q!==-1)return Z;if(Z.type==="element"&&Z.name==="w:t"){var q,W;let I=((q=(W=Z.elements)===null||W===void 0||(W=W[0])===null||W===void 0?void 0:W.text)!==null&&q!==void 0?q:"").split(U),H=I.map((T)=>L0(L0(L0({},Z),Q5(Z)),{},{elements:Z5(T)}));if(I.length>1)Q=J;return H}else return Z}).flat())!==null&&G!==void 0?G:[];return{left:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(0,Q+1)}),right:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(Q+1)})}},t2={START:0,MIDDLE:1,END:2},cK=({paragraphElement:B,renderedParagraph:U,originalText:G,replacementText:Y})=>{let Q=U.text.indexOf(G),K=Q+G.length-1,Z=t2.START;for(let J of U.runs)for(let{text:q,index:W,start:I,end:H}of J.parts)switch(Z){case t2.START:if(Q>=I&&Q<=H){let T=Q-I,A=Math.min(K,H)-I,P=J.text.substring(T,A+1);if(P==="")continue;let j=q.replace(P,Y);L8(B.elements[J.index].elements[W],j),Z=t2.MIDDLE;continue}break;case t2.MIDDLE:if(K<=H){let T=q.substring(K-I+1);L8(B.elements[J.index].elements[W],T);let A=B.elements[J.index].elements[W];B.elements[J.index].elements[W]=Q5(A),Z=t2.END}else L8(B.elements[J.index].elements[W],"");break;default:}return B},L8=(B,U)=>{return B.elements=Z5(U),B},mK=(B)=>{if(B.element.name!=="w:p")throw Error(`Invalid node type: ${B.element.name}`);if(!B.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let U=0,G=B.element.elements.map((Y,Q)=>({element:Y,i:Q})).filter(({element:Y})=>Y.name==="w:r").map(({element:Y,i:Q})=>{let K=lK(Y,Q,U);return U+=K.text.length,K}).filter((Y)=>!!Y);return{text:G.reduce((Y,Q)=>Y+Q.text,""),runs:G,index:B.index,pathToParagraph:J5(B)}},lK=(B,U,G)=>{if(!B.elements)return{text:"",parts:[],index:-1,start:G,end:G};let Y=G,Q=B.elements.map((K,Z)=>{var J,q;return K.name==="w:t"&&K.elements&&K.elements.length>0?{text:(J=(q=K.elements[0].text)===null||q===void 0?void 0:q.toString())!==null&&J!==void 0?J:"",index:Z,start:Y,end:(()=>{var W,I;return Y+=((W=(I=K.elements[0].text)===null||I===void 0?void 0:I.toString())!==null&&W!==void 0?W:"").length-1,Y})()}:void 0}).filter((K)=>!!K).map((K)=>K);return{text:Q.reduce((K,Z)=>K+Z.text,""),parts:Q,index:U,start:G,end:Y}},J5=(B)=>B.parent?[...J5(B.parent),B.index]:[B.index],UB=(B)=>{var U,G;return(U=(G=B.element.elements)===null||G===void 0?void 0:G.map((Y,Q)=>({element:Y,index:Q,parent:B})))!==null&&U!==void 0?U:[]},K5=(B)=>{let U=[],G=[...UB({element:B,index:0,parent:void 0})],Y;while(G.length>0){if(Y=G.shift(),Y.element.name==="w:p")U=[...U,mK(Y)];G.push(...UB(Y))}return U},aK=(B,U)=>K5(B).filter((G)=>G.text.includes(U)),pK=new q6,I8="ɵ",rK=({json:B,patch:U,patchText:G,context:Y,keepOriginalStyles:Q=!0})=>{let K=aK(B,G);if(K.length===0)return{element:B,didFindOccurrence:!1};for(let Z of K){let J=U.children.map((q)=>a1((0,A0.default)(pK.format(q,Y)))).map((q)=>q.elements[0]);switch(U.type){case C8.DOCUMENT:{let q=iK(B,Z.pathToParagraph),W=nK(Z.pathToParagraph);q.elements.splice(W,1,...J);break}case C8.PARAGRAPH:default:{let q=V5(B,Z.pathToParagraph);cK({paragraphElement:q,renderedParagraph:Z,originalText:G,replacementText:I8});let W=uK(q,I8),I=q.elements[W],{left:H,right:T}=dK(I,I8),A=J,P=T;if(Q){let j=I.elements.filter((E)=>E.type==="element"&&E.name==="w:rPr");A=J.map((E)=>{var C;return L0(L0({},E),{},{elements:[...j,...(C=E.elements)!==null&&C!==void 0?C:[]]})}),P=L0(L0({},T),{},{elements:[...j,...T.elements]})}q.elements.splice(W,1,H,...A,P);break}}}return{element:B,didFindOccurrence:!0}},V5=(B,U)=>{let G=B;for(let Y=1;YV5(B,U.slice(0,U.length-1)),nK=(B)=>B[B.length-1],C8={DOCUMENT:"file",PARAGRAPH:"paragraph"},GB=new U5,sK=new Uint8Array([255,254]),oK=new Uint8Array([254,255]),YB=(B,U)=>{if(B.length!==U.length)return!1;for(let G=0;Gw.name==="w:document");if(x&&x.attributes){for(let w of["mc","wp","r","w15","m"])x.attributes[`xmlns:${w}`]=y1[w];x.attributes["mc:Ignorable"]=`${x.attributes["mc:Ignorable"]||""} w15`.trim()}}if(v.startsWith("word/")&&!v.endsWith(".xml.rels")){let x={file:W,viewWrapper:{Relationships:{addRelationship:(b,c,D,m)=>{T.push({key:v,hyperlink:{id:b,link:D}})}}},stack:[]};if(q.set(v,x),!(K===null||K===void 0?void 0:K.start.trim())||!(K===null||K===void 0?void 0:K.end.trim()))throw Error("Both start and end delimiters must be non-empty strings.");let{start:w,end:a}=K;for(let[b,c]of Object.entries(Y)){let D=`${w}${b}${a}`;while(!0){let{didFindOccurrence:m}=rK({json:$,patch:L0(L0({},c),{},{children:c.children.map((B0)=>{if(B0 instanceof t8){let i=new m2(B0.options.children,O1());return T.push({key:v,hyperlink:{id:i.linkId,link:B0.options.link}}),i}else return B0})}),patchText:D,context:x,keepOriginalStyles:Q});if(!Z||!m)break}}let U0=GB.getMediaData(JSON.stringify($),x.file.Media);if(U0.length>0)A=!0,H.push({key:v,mediaDatas:U0})}I.set(v,$)}for(let{key:v,mediaDatas:S}of H){var E;let F=`word/_rels/${v.split("/").pop()}.rels`,M=(E=I.get(F))!==null&&E!==void 0?E:ZB();I.set(F,M);let $=_K(M),x=GB.replace(JSON.stringify(I.get(v)),S,$);I.set(v,JSON.parse(x));for(let w=0;w{return(0,h1.js2xml)(B,{attributeValueFn:(U)=>String(U).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})},ZB=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),B7=function(){var B=M6(function*({data:U}){let G=U instanceof h2.default?U:yield h2.default.loadAsync(U),Y=new Set;for(let[Q,K]of Object.entries(G.files)){if(!Q.endsWith(".xml")&&!Q.endsWith(".rels"))continue;if(Q.startsWith("word/")&&!Q.endsWith(".xml.rels"))K5(a1(yield K.async("text"))).forEach((Z)=>U7(Z.text).forEach((J)=>Y.add(J)))}return Array.from(Y)});return function(G){return B.apply(this,arguments)}}(),U7=(B)=>{var U;let G=new RegExp("(?<=\\{\\{).+?(?=\\}\\})","gs");return(U=B.match(G))!==null&&U!==void 0?U:[]};if(typeof globalThis.Buffer>"u")globalThis.Buffer=J0;if(typeof globalThis.process>"u")globalThis.process=G7;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.docx=L6;})(); +`:"");if(!E(T))j()}function I(H,T){return H+'="'+G(T)+'"'}U.exports=K,U.exports.element=U.exports.Element=Z}),SK=x8(),h2=k8(CK(),1),A0=k8($K(),1),o2=0,R8=32,bK=32,vK=(B,U)=>{let G=U.replace(/-/g,"");if(G.length!==bK)throw Error(`Error: Cannot extract GUID from font filename: ${U}`);let Y=G.replace(/(..)/g,"$1 ").trim().split(" ").map((Z)=>parseInt(Z,16));Y.reverse();let Q=B.slice(o2,R8).map((Z,J)=>Z^Y[J%Y.length]),K=new Uint8Array(o2+Q.length+Math.max(0,B.length-R8));return K.set(B.slice(0,o2)),K.set(Q,o2),K.set(B.slice(R8),o2+Q.length),K},q6=class{format(B,U={stack:[]}){let G=B.prepForXml(U);if(G)return G;else throw Error("XMLComponent did not format correctly")}},U5=class{replace(B,U,G){let Y=B;return U.forEach((Q,K)=>{Y=Y.replace(new RegExp(`{${Q.fileName}}`,"g"),(G+K).toString())}),Y}getMediaData(B,U){return U.Array.filter((G)=>B.search(`{${G.fileName}}`)>0)}},yK=class{replace(B,U){let G=B;for(let Y of U)G=G.replace(new RegExp(`{${Y.reference}-${Y.instance}}`,"g"),Y.numId.toString());return G}},gK=class{constructor(){e(this,"formatter",void 0),e(this,"imageReplacer",void 0),e(this,"numberingReplacer",void 0),this.formatter=new q6,this.imageReplacer=new U5,this.numberingReplacer=new yK}compile(B,U,G=[]){let Y=new h2.default,Q=this.xmlifyFile(B,U),K=new Map(Object.entries(Q));for(let[,Z]of K)if(Array.isArray(Z))for(let J of Z)Y.file(J.path,U1(J.data));else Y.file(Z.path,U1(Z.data));for(let Z of G)Y.file(Z.path,U1(Z.data));for(let Z of B.Media.Array)if(Z.type!=="svg")Y.file(`word/media/${Z.fileName}`,Z.data);else Y.file(`word/media/${Z.fileName}`,Z.data),Y.file(`word/media/${Z.fallback.fileName}`,Z.fallback.data);for(let[Z,{data:J,fontKey:q}]of B.FontTable.fontOptionsWithKey.entries())Y.file(`word/fonts/font${Z+1}.odttf`,vK(J,q));return Y}xmlifyFile(B,U){let G=B.Document.Relationships.RelationshipCount+1,Y=(0,A0.default)(this.formatter.format(B.Document.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Q=B.Comments.Relationships.RelationshipCount+1,K=(0,A0.default)(this.formatter.format(B.Comments,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Z=B.FootNotes.Relationships.RelationshipCount+1,J=(0,A0.default)(this.formatter.format(B.FootNotes.View,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),q=this.imageReplacer.getMediaData(Y,B.Media),W=this.imageReplacer.getMediaData(K,B.Media),I=this.imageReplacer.getMediaData(J,B.Media);return L0(L0({Relationships:{data:(()=>{return q.forEach((H,T)=>{B.Document.Relationships.addRelationship(G+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),B.Document.Relationships.addRelationship(B.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),(0,A0.default)(this.formatter.format(B.Document.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let H=this.imageReplacer.replace(Y,q,G);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let H=(0,A0.default)(this.formatter.format(B.Styles,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:(0,A0.default)(this.formatter.format(B.CoreProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:(0,A0.default)(this.formatter.format(B.Numbering,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:(0,A0.default)(this.formatter.format(B.FileRelationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${T+1}.xml.rels`}}),FooterRelationships:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${T+1}.xml.rels`}}),Headers:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/header${T+1}.xml`}}),Footers:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/footer${T+1}.xml`}}),ContentTypes:{data:(0,A0.default)(this.formatter.format(B.ContentTypes,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:(0,A0.default)(this.formatter.format(B.CustomProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:(0,A0.default)(this.formatter.format(B.AppProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let H=this.imageReplacer.replace(J,I,Z);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{return I.forEach((H,T)=>{B.FootNotes.Relationships.addRelationship(Z+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.FootNotes.Relationships,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(0,A0.default)(this.formatter.format(B.Endnotes.View,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/endnotes.xml"},EndnotesRelationships:{data:(0,A0.default)(this.formatter.format(B.Endnotes.Relationships,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/endnotes.xml.rels"},Settings:{data:(0,A0.default)(this.formatter.format(B.Settings,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{let H=this.imageReplacer.replace(K,W,Q);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{return W.forEach((H,T)=>{B.Comments.Relationships.addRelationship(Q+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.Comments.Relationships,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}},B.CommentsExtended?{CommentsExtended:{data:(0,A0.default)(this.formatter.format(B.CommentsExtended,{viewWrapper:{View:B.CommentsExtended,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),{},{FontTable:{data:(0,A0.default)(this.formatter.format(B.FontTable.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:(0,A0.default)(this.formatter.format(B.FontTable.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}})}};function t6(B,U,G,Y,Q,K,Z){try{var J=B[K](Z),q=J.value}catch(W){G(W);return}J.done?U(q):Promise.resolve(q).then(Y,Q)}function M6(B){return function(){var U=this,G=arguments;return new Promise(function(Y,Q){var K=B.apply(U,G);function Z(q){t6(K,Y,Q,Z,J,"next",q)}function J(q){t6(K,Y,Q,Z,J,"throw",q)}Z(void 0)})}}var G5={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:"\t"},e6=(B)=>B===!0?G5.WITH_2_BLANKS:B===!1?void 0:B,Y5=class B{static pack(U,G,Y){var Q=this;return M6(function*(K,Z,J,q=[]){return Q.compiler.compile(K,e6(J),q).generateAsync({type:Z,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})}).apply(this,arguments)}static toString(U,G,Y=[]){return B.pack(U,"string",G,Y)}static toBuffer(U,G,Y=[]){return B.pack(U,"nodebuffer",G,Y)}static toBase64String(U,G,Y=[]){return B.pack(U,"base64",G,Y)}static toBlob(U,G,Y=[]){return B.pack(U,"blob",G,Y)}static toArrayBuffer(U,G,Y=[]){return B.pack(U,"arraybuffer",G,Y)}static toStream(U,G,Y=[]){let Q=new SK.Stream;return this.compiler.compile(U,e6(G),Y).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then((K)=>{Q.emit("data",K),Q.emit("end")}),Q}};e(Y5,"compiler",new gK);var fK=new q6,a1=(B)=>{return(0,h1.xml2js)(B,{compact:!1,captureSpacesBetweenElements:!0})},Z5=(B)=>{var U;return(U=a1((0,A0.default)(fK.format(new Z1({text:B})))).elements[0].elements)!==null&&U!==void 0?U:[]},Q5=(B)=>L0(L0({},B),{},{attributes:{"xml:space":"preserve"}}),R6=(B,U)=>{var G,Y;return(G=(Y=B.elements)===null||Y===void 0?void 0:Y.filter((Q)=>Q.name===U)[0].elements)!==null&&G!==void 0?G:[]},g2=(B,U,G)=>{let Y=R6(B,"Types");if(Y.some((Q)=>{var K,Z;return Q.type==="element"&&Q.name==="Default"&&(Q===null||Q===void 0||(K=Q.attributes)===null||K===void 0?void 0:K.ContentType)===U&&(Q===null||Q===void 0||(Z=Q.attributes)===null||Z===void 0?void 0:Z.Extension)===G}))return;Y.push({attributes:{ContentType:U,Extension:G},name:"Default",type:"element"})},xK=(B)=>{let U=parseInt(B.substring(3),10);return isNaN(U)?0:U},_K=(B)=>{return R6(B,"Relationships").map((U)=>{var G,Y;return xK((G=(Y=U.attributes)===null||Y===void 0||(Y=Y.Id)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:"")}).reduce((U,G)=>Math.max(U,G),0)+1},BB=(B,U,G,Y,Q)=>{let K=R6(B,"Relationships");return K.push({attributes:{Id:`rId${U}`,Type:G,Target:Y,TargetMode:Q},name:"Relationship",type:"element"}),K},hK=class extends Error{constructor(B){super(`Token ${B} not found`);this.name="TokenNotFoundError"}},uK=(B,U)=>{var G;for(let Z=0;Z<((G=B.elements)!==null&&G!==void 0?G:[]).length;Z++){let J=B.elements[Z];if(J.type==="element"&&J.name==="w:r"){var Y;let q=((Y=J.elements)!==null&&Y!==void 0?Y:[]).filter((W)=>W.type==="element"&&W.name==="w:t");for(let W of q){var Q,K;if(!((Q=W.elements)===null||Q===void 0?void 0:Q[0]))continue;if((K=W.elements[0].text)===null||K===void 0?void 0:K.includes(U))return Z}}}throw new hK(U)},dK=(B,U)=>{var G,Y;let Q=-1,K=(G=(Y=B.elements)===null||Y===void 0?void 0:Y.map((Z,J)=>{if(Q!==-1)return Z;if(Z.type==="element"&&Z.name==="w:t"){var q,W;let I=((q=(W=Z.elements)===null||W===void 0||(W=W[0])===null||W===void 0?void 0:W.text)!==null&&q!==void 0?q:"").split(U),H=I.map((T)=>L0(L0(L0({},Z),Q5(Z)),{},{elements:Z5(T)}));if(I.length>1)Q=J;return H}else return Z}).flat())!==null&&G!==void 0?G:[];return{left:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(0,Q+1)}),right:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(Q+1)})}},t2={START:0,MIDDLE:1,END:2},cK=({paragraphElement:B,renderedParagraph:U,originalText:G,replacementText:Y})=>{let Q=U.text.indexOf(G),K=Q+G.length-1,Z=t2.START;for(let J of U.runs)for(let{text:q,index:W,start:I,end:H}of J.parts)switch(Z){case t2.START:if(Q>=I&&Q<=H){let T=Q-I,A=Math.min(K,H)-I,P=J.text.substring(T,A+1);if(P==="")continue;let j=q.replace(P,Y);L8(B.elements[J.index].elements[W],j),Z=t2.MIDDLE;continue}break;case t2.MIDDLE:if(K<=H){let T=q.substring(K-I+1);L8(B.elements[J.index].elements[W],T);let A=B.elements[J.index].elements[W];B.elements[J.index].elements[W]=Q5(A),Z=t2.END}else L8(B.elements[J.index].elements[W],"");break;default:}return B},L8=(B,U)=>{return B.elements=Z5(U),B},mK=(B)=>{if(B.element.name!=="w:p")throw Error(`Invalid node type: ${B.element.name}`);if(!B.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let U=0,G=B.element.elements.map((Y,Q)=>({element:Y,i:Q})).filter(({element:Y})=>Y.name==="w:r").map(({element:Y,i:Q})=>{let K=lK(Y,Q,U);return U+=K.text.length,K}).filter((Y)=>!!Y);return{text:G.reduce((Y,Q)=>Y+Q.text,""),runs:G,index:B.index,pathToParagraph:J5(B)}},lK=(B,U,G)=>{if(!B.elements)return{text:"",parts:[],index:-1,start:G,end:G};let Y=G,Q=B.elements.map((K,Z)=>{var J,q;return K.name==="w:t"&&K.elements&&K.elements.length>0?{text:(J=(q=K.elements[0].text)===null||q===void 0?void 0:q.toString())!==null&&J!==void 0?J:"",index:Z,start:Y,end:(()=>{var W,I;return Y+=((W=(I=K.elements[0].text)===null||I===void 0?void 0:I.toString())!==null&&W!==void 0?W:"").length-1,Y})()}:void 0}).filter((K)=>!!K).map((K)=>K);return{text:Q.reduce((K,Z)=>K+Z.text,""),parts:Q,index:U,start:G,end:Y}},J5=(B)=>B.parent?[...J5(B.parent),B.index]:[B.index],UB=(B)=>{var U,G;return(U=(G=B.element.elements)===null||G===void 0?void 0:G.map((Y,Q)=>({element:Y,index:Q,parent:B})))!==null&&U!==void 0?U:[]},K5=(B)=>{let U=[],G=[...UB({element:B,index:0,parent:void 0})],Y;while(G.length>0){if(Y=G.shift(),Y.element.name==="w:p")U=[...U,mK(Y)];G.push(...UB(Y))}return U},aK=(B,U)=>K5(B).filter((G)=>G.text.includes(U)),pK=new q6,I8="ɵ",rK=({json:B,patch:U,patchText:G,context:Y,keepOriginalStyles:Q=!0})=>{let K=aK(B,G);if(K.length===0)return{element:B,didFindOccurrence:!1};for(let Z of K){let J=U.children.map((q)=>a1((0,A0.default)(pK.format(q,Y)))).map((q)=>q.elements[0]);switch(U.type){case C8.DOCUMENT:{let q=iK(B,Z.pathToParagraph),W=nK(Z.pathToParagraph);q.elements.splice(W,1,...J);break}case C8.PARAGRAPH:default:{let q=V5(B,Z.pathToParagraph);cK({paragraphElement:q,renderedParagraph:Z,originalText:G,replacementText:I8});let W=uK(q,I8),I=q.elements[W],{left:H,right:T}=dK(I,I8),A=J,P=T;if(Q){let j=I.elements.filter((E)=>E.type==="element"&&E.name==="w:rPr");A=J.map((E)=>{var C;return L0(L0({},E),{},{elements:[...j,...(C=E.elements)!==null&&C!==void 0?C:[]]})}),P=L0(L0({},T),{},{elements:[...j,...T.elements]})}q.elements.splice(W,1,H,...A,P);break}}}return{element:B,didFindOccurrence:!0}},V5=(B,U)=>{let G=B;for(let Y=1;YV5(B,U.slice(0,U.length-1)),nK=(B)=>B[B.length-1],C8={DOCUMENT:"file",PARAGRAPH:"paragraph"},GB=new U5,sK=new Uint8Array([255,254]),oK=new Uint8Array([254,255]),YB=(B,U)=>{if(B.length!==U.length)return!1;for(let G=0;Gz.name==="w:document");if(x&&x.attributes){for(let z of["mc","wp","r","w15","m"])x.attributes[`xmlns:${z}`]=y1[z];x.attributes["mc:Ignorable"]=`${x.attributes["mc:Ignorable"]||""} w15`.trim()}}if(v.startsWith("word/")&&!v.endsWith(".xml.rels")){let x={file:W,viewWrapper:{Relationships:{addRelationship:(b,c,D,m)=>{T.push({key:v,hyperlink:{id:b,link:D}})}}},stack:[]};if(q.set(v,x),!(K===null||K===void 0?void 0:K.start.trim())||!(K===null||K===void 0?void 0:K.end.trim()))throw Error("Both start and end delimiters must be non-empty strings.");let{start:z,end:a}=K;for(let[b,c]of Object.entries(Y)){let D=`${z}${b}${a}`;while(!0){let{didFindOccurrence:m}=rK({json:$,patch:L0(L0({},c),{},{children:c.children.map((B0)=>{if(B0 instanceof t8){let i=new m2(B0.options.children,O1());return T.push({key:v,hyperlink:{id:i.linkId,link:B0.options.link}}),i}else return B0})}),patchText:D,context:x,keepOriginalStyles:Q});if(!Z||!m)break}}let U0=GB.getMediaData(JSON.stringify($),x.file.Media);if(U0.length>0)A=!0,H.push({key:v,mediaDatas:U0})}I.set(v,$)}for(let{key:v,mediaDatas:S}of H){var E;let F=`word/_rels/${v.split("/").pop()}.rels`,M=(E=I.get(F))!==null&&E!==void 0?E:ZB();I.set(F,M);let $=_K(M),x=GB.replace(JSON.stringify(I.get(v)),S,$);I.set(v,JSON.parse(x));for(let z=0;z{return(0,h1.js2xml)(B,{attributeValueFn:(U)=>String(U).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})},ZB=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),B7=function(){var B=M6(function*({data:U}){let G=U instanceof h2.default?U:yield h2.default.loadAsync(U),Y=new Set;for(let[Q,K]of Object.entries(G.files)){if(!Q.endsWith(".xml")&&!Q.endsWith(".rels"))continue;if(Q.startsWith("word/")&&!Q.endsWith(".xml.rels"))K5(a1(yield K.async("text"))).forEach((Z)=>U7(Z.text).forEach((J)=>Y.add(J)))}return Array.from(Y)});return function(G){return B.apply(this,arguments)}}(),U7=(B)=>{var U;let G=new RegExp("(?<=\\{\\{).+?(?=\\}\\})","gs");return(U=B.match(G))!==null&&U!==void 0?U:[]};if(typeof globalThis.Buffer>"u")globalThis.Buffer=J0;if(typeof globalThis.process>"u")globalThis.process=G7;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.docx=L6;})(); diff --git a/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs b/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs index 3368b6a2676..c39925856ee 100644 --- a/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs +++ b/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs @@ -1,9 +1,9 @@ // sandbox bundle: pptxgenjs // generated by apps/sim/lib/execution/sandbox/bundles/build.ts // do not edit by hand. run `bun run build:sandbox-bundles` to regenerate. -(()=>{var fJ=Object.create;var{getPrototypeOf:RJ,defineProperty:X6,getOwnPropertyNames:Q9,getOwnPropertyDescriptor:IJ}=Object,q9=Object.prototype.hasOwnProperty;function K9($){return this[$]}var CJ,jJ,J9=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?CJ??=new WeakMap:jJ??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?fJ(RJ($)):{};let G=q||!$||!$.__esModule?X6(Q,"default",{value:$,enumerable:!0}):Q;for(let W of Q9($))if(!q9.call(G,W))X6(G,W,{get:K9.bind($,W),enumerable:!0});if(K)J.set($,G);return G},X0=($)=>{var q=($9??=new WeakMap).get($),Q;if(q)return q;if(q=X6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var K of Q9($))if(!q9.call(q,K))X6(q,K,{get:K9.bind($,K),enumerable:!(Q=IJ($,K))||Q.enumerable})}return $9.set($,q),q},$9,N0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var gJ=($)=>$;function AJ($,q){this[$]=gJ.bind(null,q)}var c1=($,q)=>{for(var Q in q)X6($,Q,{get:q[Q],enumerable:!0,configurable:!0,set:AJ.bind(q,Q)})};var b1=($,q)=>()=>($&&(q=$($=0)),q);var V9=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(q,Q)=>(typeof require<"u"?require:q)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var K2={};c1(K2,{transcode:()=>MV,resolveObjectURL:()=>BV,kStringMaxLength:()=>w9,kMaxLength:()=>y6,isUtf8:()=>zV,isAscii:()=>FV,default:()=>wV,constants:()=>EJ,btoa:()=>PJ,atob:()=>TJ,INSPECT_MAX_BYTES:()=>M9,File:()=>uJ,Buffer:()=>o,Blob:()=>SJ});function XJ($){var q=$.length;if(q%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=$.indexOf("=");if(Q===-1)Q=q;var K=Q===q?0:4-Q%4;return[Q,K]}function yJ($,q){return($+q)*3/4-q}function hJ($){var q,Q=XJ($),K=Q[0],J=Q[1],Z=new Uint8Array(yJ(K,J)),G=0,W=J>0?K-4:K,B;for(B=0;B>16&255,Z[G++]=q>>8&255,Z[G++]=q&255;if(J===2)q=F2[$.charCodeAt(B)]<<2|F2[$.charCodeAt(B+1)]>>4,Z[G++]=q&255;if(J===1)q=F2[$.charCodeAt(B)]<<10|F2[$.charCodeAt(B+1)]<<4|F2[$.charCodeAt(B+2)]>>2,Z[G++]=q>>8&255,Z[G++]=q&255;return Z}function xJ($){return I2[$>>18&63]+I2[$>>12&63]+I2[$>>6&63]+I2[$&63]}function OJ($,q,Q){var K,J=[];for(var Z=q;ZW?W:G+Z));if(K===1)q=$[Q-1],J.push(I2[q>>2]+I2[q<<4&63]+"==");else if(K===2)q=($[Q-2]<<8)+$[Q-1],J.push(I2[q>>10]+I2[q>>4&63]+I2[q<<2&63]+"=");return J.join("")}function Y8($,q,Q,K,J){var Z,G,W=J*8-K-1,B=(1<>1,U=-7,w=Q?J-1:0,F=Q?-1:1,M=$[q+w];w+=F,Z=M&(1<<-U)-1,M>>=-U,U+=W;for(;U>0;Z=Z*256+$[q+w],w+=F,U-=8);G=Z&(1<<-U)-1,Z>>=-U,U+=K;for(;U>0;G=G*256+$[q+w],w+=F,U-=8);if(Z===0)Z=1-V;else if(Z===B)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,K),Z=Z-V;return(M?-1:1)*G*Math.pow(2,Z-K)}function F9($,q,Q,K,J,Z){var G,W,B,V=Z*8-J-1,U=(1<>1,F=J===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:Z-1,k=K?1:-1,f=q<0||q===0&&1/q<0?1:0;if(q=Math.abs(q),isNaN(q)||q===1/0)W=isNaN(q)?1:0,G=U;else{if(G=Math.floor(Math.log(q)/Math.LN2),q*(B=Math.pow(2,-G))<1)G--,B*=2;if(G+w>=1)q+=F/B;else q+=F*Math.pow(2,1-w);if(q*B>=2)G++,B/=2;if(G+w>=U)W=0,G=U;else if(G+w>=1)W=(q*B-1)*Math.pow(2,J),G=G+w;else W=q*Math.pow(2,w-1)*Math.pow(2,J),G=0}for(;J>=8;$[Q+M]=W&255,M+=k,W/=256,J-=8);G=G<0;$[Q+M]=G&255,M+=k,G/=256,V-=8);$[Q+M-k]|=f*128}function S2($){if($>y6)throw RangeError('The value "'+$+'" is invalid for option "size"');let q=new Uint8Array($);return Object.setPrototypeOf(q,o.prototype),q}function x5($,q,Q){return class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:q.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}function o($,q,Q){if(typeof $==="number"){if(typeof q==="string")throw TypeError('The "string" argument must be of type string. Received type number');return O5($)}return N9($,q,Q)}function N9($,q,Q){if(typeof $==="string")return nJ($,q);if(ArrayBuffer.isView($))return dJ($);if($==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(C2($,ArrayBuffer)||$&&C2($.buffer,ArrayBuffer))return y5($,q,Q);if(typeof SharedArrayBuffer<"u"&&(C2($,SharedArrayBuffer)||$&&C2($.buffer,SharedArrayBuffer)))return y5($,q,Q);if(typeof $==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=$.valueOf&&$.valueOf();if(K!=null&&K!==$)return o.from(K,q,Q);let J=mJ($);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]==="function")return o.from($[Symbol.toPrimitive]("string"),q,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}function Y9($){if(typeof $!=="number")throw TypeError('"size" argument must be of type number');else if($<0)throw RangeError('The value "'+$+'" is invalid for option "size"')}function bJ($,q,Q){if(Y9($),$<=0)return S2($);if(q!==void 0)return typeof Q==="string"?S2($).fill(q,Q):S2($).fill(q);return S2($)}function O5($){return Y9($),S2($<0?0:P5($)|0)}function nJ($,q){if(typeof q!=="string"||q==="")q="utf8";if(!o.isEncoding(q))throw TypeError("Unknown encoding: "+q);let Q=k9($,q)|0,K=S2(Q),J=K.write($,q);if(J!==Q)K=K.slice(0,J);return K}function X5($){let q=$.length<0?0:P5($.length)|0,Q=S2(q);for(let K=0;K=y6)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y6.toString(16)+" bytes");return $|0}function k9($,q){if(o.isBuffer($))return $.length;if(ArrayBuffer.isView($)||C2($,ArrayBuffer))return $.byteLength;if(typeof $!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let Q=$.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&Q===0)return 0;let J=!1;for(;;)switch(q){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return h5($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return j9($).length;default:if(J)return K?-1:h5($).length;q=(""+q).toLowerCase(),J=!0}}function pJ($,q,Q){let K=!1;if(q===void 0||q<0)q=0;if(q>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,q>>>=0,Q<=q)return"";if(!$)$="utf8";while(!0)switch($){case"hex":return QV(this,q,Q);case"utf8":case"utf-8":return L9(this,q,Q);case"ascii":return eJ(this,q,Q);case"latin1":case"binary":return $V(this,q,Q);case"base64":return sJ(this,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qV(this,q,Q);default:if(K)throw TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),K=!0}}function w1($,q,Q){let K=$[q];$[q]=$[Q],$[Q]=K}function D9($,q,Q,K,J){if($.length===0)return-1;if(typeof Q==="string")K=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,Number.isNaN(Q))Q=J?0:$.length-1;if(Q<0)Q=$.length+Q;if(Q>=$.length)if(J)return-1;else Q=$.length-1;else if(Q<0)if(J)Q=0;else return-1;if(typeof q==="string")q=o.from(q,K);if(o.isBuffer(q)){if(q.length===0)return-1;return W9($,q,Q,K,J)}else if(typeof q==="number"){if(q=q&255,typeof Uint8Array.prototype.indexOf==="function")if(J)return Uint8Array.prototype.indexOf.call($,q,Q);else return Uint8Array.prototype.lastIndexOf.call($,q,Q);return W9($,[q],Q,K,J)}throw TypeError("val must be string, number or Buffer")}function W9($,q,Q,K,J){let Z=1,G=$.length,W=q.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if($.length<2||q.length<2)return-1;Z=2,G/=2,W/=2,Q/=2}}function B(U,w){if(Z===1)return U[w];else return U.readUInt16BE(w*Z)}let V;if(J){let U=-1;for(V=Q;VG)Q=G-W;for(V=Q;V>=0;V--){let U=!0;for(let w=0;wJ)K=J;let Z=q.length;if(K>Z/2)K=Z/2;let G;for(G=0;G239?4:Z>223?3:Z>191?2:1;if(J+W<=Q){let B,V,U,w;switch(W){case 1:if(Z<128)G=Z;break;case 2:if(B=$[J+1],(B&192)===128){if(w=(Z&31)<<6|B&63,w>127)G=w}break;case 3:if(B=$[J+1],V=$[J+2],(B&192)===128&&(V&192)===128){if(w=(Z&15)<<12|(B&63)<<6|V&63,w>2047&&(w<55296||w>57343))G=w}break;case 4:if(B=$[J+1],V=$[J+2],U=$[J+3],(B&192)===128&&(V&192)===128&&(U&192)===128){if(w=(Z&15)<<18|(B&63)<<12|(V&63)<<6|U&63,w>65535&&w<1114112)G=w}}}if(G===null)G=65533,W=1;else if(G>65535)G-=65536,K.push(G>>>10&1023|55296),G=56320|G&1023;K.push(G),J+=W}return tJ(K)}function tJ($){let q=$.length;if(q<=B9)return String.fromCharCode.apply(String,$);let Q="",K=0;while(KK)Q=K;let J="";for(let Z=q;ZQ)throw RangeError("Trying to access beyond buffer length")}function s0($,q,Q,K,J,Z){if(!o.isBuffer($))throw TypeError('"buffer" argument must be a Buffer instance');if(q>J||q$.length)throw RangeError("Index out of range")}function H9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,Q}function v9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q+7]=Z,Z=Z>>8,$[Q+6]=Z,Z=Z>>8,$[Q+5]=Z,Z=Z>>8,$[Q+4]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q+3]=G,G=G>>8,$[Q+2]=G,G=G>>8,$[Q+1]=G,G=G>>8,$[Q]=G,Q+8}function f9($,q,Q,K,J,Z){if(Q+K>$.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function R9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return F9($,q,Q,K,23,4),Q+4}function I9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return F9($,q,Q,K,52,8),Q+8}function z9($){let q="",Q=$.length,K=$[0]==="-"?1:0;for(;Q>=K+4;Q-=3)q=`_${$.slice(Q-3,Q)}${q}`;return`${$.slice(0,Q)}${q}`}function KV($,q,Q){if(n1(q,"offset"),$[q]===void 0||$[q+Q]===void 0)h6(q,$.length-(Q+1))}function C9($,q,Q,K,J,Z){if($>Q||$3)if(q===0||q===BigInt(0))W=`>= 0${G} and < 2${G} ** ${(Z+1)*8}${G}`;else W=`>= -(2${G} ** ${(Z+1)*8-1}${G}) and < 2 ** ${(Z+1)*8-1}${G}`;else W=`>= ${q}${G} and <= ${Q}${G}`;throw new A5("value",W,$)}KV(K,J,Z)}function n1($,q){if(typeof $!=="number")throw new cJ(q,"number",$)}function h6($,q,Q){if(Math.floor($)!==$)throw n1($,Q),new A5(Q||"offset","an integer",$);if(q<0)throw new _J;throw new A5(Q||"offset",`>= ${Q?1:0} and <= ${q}`,$)}function VV($){if($=$.split("=")[0],$=$.trim().replace(JV,""),$.length<2)return"";while($.length%4!==0)$=$+"=";return $}function h5($,q){q=q||1/0;let Q,K=$.length,J=null,Z=[];for(let G=0;G55295&&Q<57344){if(!J){if(Q>56319){if((q-=3)>-1)Z.push(239,191,189);continue}else if(G+1===K){if((q-=3)>-1)Z.push(239,191,189);continue}J=Q;continue}if(Q<56320){if((q-=3)>-1)Z.push(239,191,189);J=Q;continue}Q=(J-55296<<10|Q-56320)+65536}else if(J){if((q-=3)>-1)Z.push(239,191,189)}if(J=null,Q<128){if((q-=1)<0)break;Z.push(Q)}else if(Q<2048){if((q-=2)<0)break;Z.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((q-=3)<0)break;Z.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((q-=4)<0)break;Z.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return Z}function UV($){let q=[];for(let Q=0;Q<$.length;++Q)q.push($.charCodeAt(Q)&255);return q}function ZV($,q){let Q,K,J,Z=[];for(let G=0;G<$.length;++G){if((q-=2)<0)break;Q=$.charCodeAt(G),K=Q>>8,J=Q%256,Z.push(J),Z.push(K)}return Z}function j9($){return hJ(VV($))}function k8($,q,Q,K){let J;for(J=0;J=q.length||J>=$.length)break;q[J+Q]=$[J]}return J}function C2($,q){return $ instanceof q||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===q.name}function l2($){return typeof BigInt>"u"?WV:$}function WV(){throw Error("BigInt not supported")}function T5($){return()=>{throw Error($+" is not implemented for node:buffer browser polyfill")}}var I2,F2,g5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M1,U9,G9,M9=50,y6=2147483647,w9=536870888,PJ,TJ,uJ,SJ,EJ,_J,cJ,A5,B9=4096,JV,GV,BV,zV,FV=($)=>{for(let q of $)if(q.charCodeAt(0)>127)return!1;return!0},MV,wV;var t0=b1(()=>{I2=[],F2=[];for(M1=0,U9=g5.length;M14294967296)J=z9(String(Q));else if(typeof Q==="bigint"){if(J=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))J=z9(J);J+="n"}return K+=` It must be ${q}. Received ${J}`,K},RangeError);Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.buffer}});Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.byteOffset}});o.poolSize=8192;o.from=function($,q,Q){return N9($,q,Q)};Object.setPrototypeOf(o.prototype,Uint8Array.prototype);Object.setPrototypeOf(o,Uint8Array);o.alloc=function($,q,Q){return bJ($,q,Q)};o.allocUnsafe=function($){return O5($)};o.allocUnsafeSlow=function($){return O5($)};o.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==o.prototype};o.compare=function($,q){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(C2(q,Uint8Array))q=o.from(q,q.offset,q.byteLength);if(!o.isBuffer($)||!o.isBuffer(q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===q)return 0;let Q=$.length,K=q.length;for(let J=0,Z=Math.min(Q,K);JK.length){if(!o.isBuffer(Z))Z=o.from(Z);Z.copy(K,J)}else Uint8Array.prototype.set.call(K,Z,J);else if(!o.isBuffer(Z))throw TypeError('"list" argument must be an Array of Buffers');else Z.copy(K,J);J+=Z.length}return K};o.byteLength=k9;o.prototype._isBuffer=!0;o.prototype.swap16=function(){let $=this.length;if($%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let q=0;q<$;q+=2)w1(this,q,q+1);return this};o.prototype.swap32=function(){let $=this.length;if($%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let q=0;q<$;q+=4)w1(this,q,q+3),w1(this,q+1,q+2);return this};o.prototype.swap64=function(){let $=this.length;if($%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let q=0;q<$;q+=8)w1(this,q,q+7),w1(this,q+1,q+6),w1(this,q+2,q+5),w1(this,q+3,q+4);return this};o.prototype.toString=function(){let $=this.length;if($===0)return"";if(arguments.length===0)return L9(this,0,$);return pJ.apply(this,arguments)};o.prototype.toLocaleString=o.prototype.toString;o.prototype.equals=function($){if(!o.isBuffer($))throw TypeError("Argument must be a Buffer");if(this===$)return!0;return o.compare(this,$)===0};o.prototype.inspect=function(){let $="",q=M9;if($=this.toString("hex",0,q).replace(/(.{2})/g,"$1 ").trim(),this.length>q)$+=" ... ";return""};if(G9)o.prototype[G9]=o.prototype.inspect;o.prototype.compare=function($,q,Q,K,J){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(!o.isBuffer($))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(q===void 0)q=0;if(Q===void 0)Q=$?$.length:0;if(K===void 0)K=0;if(J===void 0)J=this.length;if(q<0||Q>$.length||K<0||J>this.length)throw RangeError("out of range index");if(K>=J&&q>=Q)return 0;if(K>=J)return-1;if(q>=Q)return 1;if(q>>>=0,Q>>>=0,K>>>=0,J>>>=0,this===$)return 0;let Z=J-K,G=Q-q,W=Math.min(Z,G),B=this.slice(K,J),V=$.slice(q,Q);for(let U=0;U>>0,isFinite(Q)){if(Q=Q>>>0,K===void 0)K="utf8"}else K=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let J=this.length-q;if(Q===void 0||Q>J)Q=J;if($.length>0&&(Q<0||q<0)||q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let Z=!1;for(;;)switch(K){case"hex":return iJ(this,$,q,Q);case"utf8":case"utf-8":return oJ(this,$,q,Q);case"ascii":case"latin1":case"binary":return aJ(this,$,q,Q);case"base64":return lJ(this,$,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rJ(this,$,q,Q);default:if(Z)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),Z=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};o.prototype.slice=function($,q){let Q=this.length;if($=~~$,q=q===void 0?Q:~~q,$<0){if($+=Q,$<0)$=0}else if($>Q)$=Q;if(q<0){if(q+=Q,q<0)q=0}else if(q>Q)q=Q;if(q<$)q=$;let K=this.subarray($,q);return Object.setPrototypeOf(K,o.prototype),K};o.prototype.readUintLE=o.prototype.readUIntLE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$+--q],J=1;while(q>0&&(J*=256))K+=this[$+--q]*J;return K};o.prototype.readUint8=o.prototype.readUInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);return this[$]};o.prototype.readUint16LE=o.prototype.readUInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]|this[$+1]<<8};o.prototype.readUint16BE=o.prototype.readUInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]<<8|this[$+1]};o.prototype.readUint32LE=o.prototype.readUInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216};o.prototype.readUint32BE=o.prototype.readUInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])};o.prototype.readBigUInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q+this[++$]*256+this[++$]*65536+this[++$]*16777216,J=this[++$]+this[++$]*256+this[++$]*65536+Q*16777216;return BigInt(K)+(BigInt(J)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q*16777216+this[++$]*65536+this[++$]*256+this[++$],J=this[++$]*16777216+this[++$]*65536+this[++$]*256+Q;return(BigInt(K)<>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z=J)K-=Math.pow(2,8*q);return K};o.prototype.readIntBE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=q,J=1,Z=this[$+--K];while(K>0&&(J*=256))Z+=this[$+--K]*J;if(J*=128,Z>=J)Z-=Math.pow(2,8*q);return Z};o.prototype.readInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);if(!(this[$]&128))return this[$];return(255-this[$]+1)*-1};o.prototype.readInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$]|this[$+1]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$+1]|this[$]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24};o.prototype.readInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]};o.prototype.readBigInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=this[$+4]+this[$+5]*256+this[$+6]*65536+(Q<<24);return(BigInt(K)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=(q<<24)+this[++$]*65536+this[++$]*256+this[++$];return(BigInt(K)<>>0,!q)b0($,4,this.length);return Y8(this,$,!0,23,4)};o.prototype.readFloatBE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return Y8(this,$,!1,23,4)};o.prototype.readDoubleLE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!0,52,8)};o.prototype.readDoubleBE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!1,52,8)};o.prototype.writeUintLE=o.prototype.writeUIntLE=function($,q,Q,K){if($=+$,q=q>>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=1,Z=0;this[q]=$&255;while(++Z>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=Q-1,Z=1;this[q+J]=$&255;while(--J>=0&&(Z*=256))this[q+J]=$/Z&255;return q+Q};o.prototype.writeUint8=o.prototype.writeUInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,255,0);return this[q]=$&255,q+1};o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q+3]=$>>>24,this[q+2]=$>>>16,this[q+1]=$>>>8,this[q]=$&255,q+4};o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigUInt64LE=l2(function($,q=0){return H9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeBigUInt64BE=l2(function($,q=0){return v9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeIntLE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=0,Z=1,G=0;this[q]=$&255;while(++J>0)-G&255}return q+Q};o.prototype.writeIntBE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=Q-1,Z=1,G=0;this[q+J]=$&255;while(--J>=0&&(Z*=256)){if($<0&&G===0&&this[q+J+1]!==0)G=1;this[q+J]=($/Z>>0)-G&255}return q+Q};o.prototype.writeInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,127,-128);if($<0)$=255+$+1;return this[q]=$&255,q+1};o.prototype.writeInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);return this[q]=$&255,this[q+1]=$>>>8,this[q+2]=$>>>16,this[q+3]=$>>>24,q+4};o.prototype.writeInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);if($<0)$=4294967295+$+1;return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigInt64LE=l2(function($,q=0){return H9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeBigInt64BE=l2(function($,q=0){return v9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeFloatLE=function($,q,Q){return R9(this,$,q,!0,Q)};o.prototype.writeFloatBE=function($,q,Q){return R9(this,$,q,!1,Q)};o.prototype.writeDoubleLE=function($,q,Q){return I9(this,$,q,!0,Q)};o.prototype.writeDoubleBE=function($,q,Q){return I9(this,$,q,!1,Q)};o.prototype.copy=function($,q,Q,K){if(!o.isBuffer($))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!K&&K!==0)K=this.length;if(q>=$.length)q=$.length;if(!q)q=0;if(K>0&&K=this.length)throw RangeError("Index out of range");if(K<0)throw RangeError("sourceEnd out of bounds");if(K>this.length)K=this.length;if($.length-q>>0,Q=Q===void 0?this.length:Q>>>0,!$)$=0;let J;if(typeof $==="number")for(J=q;J{var S0=y9.exports={},j2,g2;function u5(){throw Error("setTimeout has not been defined")}function S5(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")j2=setTimeout;else j2=u5}catch($){j2=u5}try{if(typeof clearTimeout==="function")g2=clearTimeout;else g2=S5}catch($){g2=S5}})();function g9($){if(j2===setTimeout)return setTimeout($,0);if((j2===u5||!j2)&&setTimeout)return j2=setTimeout,setTimeout($,0);try{return j2($,0)}catch(q){try{return j2.call(null,$,0)}catch(Q){return j2.call(this,$,0)}}}function NV($){if(g2===clearTimeout)return clearTimeout($);if((g2===S5||!g2)&&clearTimeout)return g2=clearTimeout,clearTimeout($);try{return g2($)}catch(q){try{return g2.call(null,$)}catch(Q){return g2.call(this,$)}}}var E2=[],d1=!1,N1,D8=-1;function YV(){if(!d1||!N1)return;if(d1=!1,N1.length)E2=N1.concat(E2);else D8=-1;if(E2.length)A9()}function A9(){if(d1)return;var $=g9(YV);d1=!0;var q=E2.length;while(q){N1=E2,E2=[];while(++D81)for(var Q=1;Qn9,once:()=>c9,listenerCount:()=>d9,init:()=>r2,getMaxListeners:()=>p9,getEventListeners:()=>b9,default:()=>CV,captureRejectionSymbol:()=>u9,addAbortListener:()=>i9,EventEmitter:()=>r2});function S9($,q){var{_events:Q}=$;if(q[0]??=Error("Unhandled error."),!Q)throw q[0];var K=Q[T9];if(K)for(var J of O9.call(K))J.apply($,q);var Z=Q.error;if(!Z)throw q[0];for(var J of O9.call(Z))J.apply($,q);return!0}function LV($,q,Q,K){q.then(void 0,function(J){queueMicrotask(()=>HV($,J,Q,K))})}function HV($,q,Q,K){if(typeof $[x9]==="function")$[x9](q,Q,...K);else try{$[Y1]=!1,$.emit("error",q)}finally{$[Y1]=!0}}function E9($,q,Q){Q.warned=!0;let K=Error(`Possible EventEmitter memory leak detected. ${Q.length} ${String(q)} listeners added to [${$.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=$,K.type=q,K.count=Q.length,console.warn(K)}function _9($,q,...Q){this.removeListener($,q),q.apply(this,Q)}function c9($,q,Q){var K=Q?.signal;if(m9(K,"options.signal"),K?.aborted)throw new E5(void 0,{cause:K?.reason});let{resolve:J,reject:Z,promise:G}=$newPromiseCapability(Promise),W=(U)=>{if($.removeListener(q,B),K!=null)L8(K,"abort",V);Z(U)},B=(...U)=>{if(typeof $.removeListener==="function")$.removeListener("error",W);if(K!=null)L8(K,"abort",V);J(U)};if(P9($,q,B,{once:!0}),q!=="error"&&typeof $.once==="function")$.once("error",W);function V(){L8($,q,B),L8($,"error",W),Z(new E5(void 0,{cause:K?.reason}))}if(K!=null)P9(K,"abort",V,{once:!0});return G}function b9($,q){return $.listeners(q)}function n9($,...q){c5($,"setMaxListeners",0);var Q;if(q&&(Q=q.length))for(let K=0;KK||(Q!=null||K!=null)&&Number.isNaN($))throw RV(q,`${Q!=null?`>= ${Q}`:""}${Q!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,$)}function x6($){if(typeof $!=="function")throw TypeError("The listener must be a function")}function IV($,q){if(typeof $!=="boolean")throw m1(q,"boolean",$)}function p9($){return $?._maxListeners??k1}function i9($,q){if($===void 0)throw m1("signal","AbortSignal",$);if(m9($,"signal"),typeof q!=="function")throw m1("listener","function",q);let Q;if($.aborted)queueMicrotask(()=>q());else $.addEventListener("abort",q,{__proto__:null,once:!0}),Q=()=>{$.removeEventListener("abort",q)};return{__proto__:null,[Symbol.dispose](){Q?.()}}}var _5,Y1,T9,kV,DV,x9,u9,O9,k1=10,r2=function($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[Y1]=$?.captureRejections?Boolean($?.captureRejections):y0[Y1])this.emit=fV},y0,vV=function($,...q){if($==="error")return S9(this,q);var{_events:Q}=this;if(Q===void 0)return!1;var K=Q[$];if(K===void 0)return!1;let J=K.length>1?K.slice():K;for(let Z=0,{length:G}=J;Z1?K.slice():K;for(let Z=0,{length:G}=J;Z{_5=Symbol.for,Y1=Symbol("kCapture"),T9=_5("events.errorMonitor"),kV=Symbol("events.maxEventTargetListeners"),DV=Symbol("events.maxEventTargetListenersWarned"),x9=_5("nodejs.rejection"),u9=_5("nodejs.rejection"),O9=Array.prototype.slice,y0=r2.prototype={};y0._events=void 0;y0._eventsCount=0;y0._maxListeners=void 0;y0.setMaxListeners=function($){return c5($,"setMaxListeners",0),this._maxListeners=$,this};y0.constructor=r2;y0.getMaxListeners=function(){return this?._maxListeners??k1};y0.emit=vV;y0.addListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.push(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.on=y0.addListener;y0.prependListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.unshift(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.once=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.addListener($,Q),this};y0.prependOnceListener=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.prependListener($,Q),this};y0.removeListener=function($,q){x6(q);var{_events:Q}=this;if(!Q)return this;var K=Q[$];if(!K)return this;var J=K.length;let Z=-1;for(let G=J-1;G>=0;G--)if(K[G]===q||K[G].listener===q){Z=G;break}if(Z<0)return this;if(Z===0)K.shift();else K.splice(Z,1);if(K.length===0)delete Q[$],this._eventsCount--;return this};y0.off=y0.removeListener;y0.removeAllListeners=function($){var{_events:q}=this;if($&&q){if(q[$])delete q[$],this._eventsCount--}else this._events={__proto__:null};return this};y0.listeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.map((K)=>K.listener??K)};y0.rawListeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.slice()};y0.listenerCount=function($){var{_events:q}=this;if(!q)return 0;return q[$]?.length??0};y0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};y0[Y1]=!1;E5=class E5 extends Error{constructor($="The operation was aborted",q=void 0){if(q!==void 0&&typeof q!=="object")throw m1("options","Object",q);super($,q);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(r2,{captureRejections:{get(){return y0[Y1]},set($){IV($,"EventEmitter.captureRejections"),y0[Y1]=$},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return k1},set:($)=>{c5($,"defaultMaxListeners",0),k1=$}},kMaxEventTargetListeners:{value:kV,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:DV,enumerable:!1,configurable:!1,writable:!1}});Object.assign(r2,{once:c9,getEventListeners:b9,getMaxListeners:p9,setMaxListeners:n9,EventEmitter:r2,usingDomains:!1,captureRejectionSymbol:u9,errorMonitor:T9,addAbortListener:i9,init:r2,listenerCount:d9});CV=r2});var a1=N0((Bz,$$)=>{var g0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),P0=g0(($,q)=>{class Q extends Error{constructor(K){if(!Array.isArray(K))throw TypeError(`Expected input to be an Array, got ${typeof K}`);let J="";for(let Z=0;Z{q.exports={format(Q,...K){return Q.replace(/%([sdifj])/g,function(...[J,Z]){let G=K.shift();if(Z==="f")return G.toFixed(6);else if(Z==="j")return JSON.stringify(G);else if(Z==="s"&&typeof G==="object")return`${G.constructor!==Object?G.constructor.name:""} {}`.trim();else return G.toString()})},inspect(Q){switch(typeof Q){case"string":if(Q.includes("'")){if(!Q.includes('"'))return`"${Q}"`;else if(!Q.includes("`")&&!Q.includes("${"))return`\`${Q}\``}return`'${Q}'`;case"number":if(isNaN(Q))return"NaN";else if(Object.is(Q,-0))return String(Q);return Q;case"bigint":return`${String(Q)}n`;case"boolean":case"undefined":return String(Q);case"object":return"{}"}}}}),a0=g0(($,q)=>{var{format:Q,inspect:K}=o9(),{AggregateError:J}=P0(),Z=globalThis.AggregateError||J,G=Symbol("kIsNodeError"),W=["string","function","number","object","Function","Object","boolean","bigint","symbol"],B=/^([A-Z][a-z0-9]*)+$/,V={};function U(D,z){if(!D)throw new V.ERR_INTERNAL_ASSERTION(z)}function w(D){let z="",N=D.length,H=D[0]==="-"?1:0;for(;N>=H+4;N-=3)z=`_${D.slice(N-3,N)}${z}`;return`${D.slice(0,N)}${z}`}function F(D,z,N){if(typeof z==="function")return U(z.length<=N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${z.length}).`),z(...N);let H=(z.match(/%[dfijoOs]/g)||[]).length;if(U(H===N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${H}).`),N.length===0)return z;return Q(z,...N)}function M(D,z,N){if(!N)N=Error;class H extends N{constructor(...v){super(F(D,z,v))}toString(){return`${this.name} [${D}]: ${this.message}`}}Object.defineProperties(H.prototype,{name:{value:N.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${D}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),H.prototype.code=D,H.prototype[G]=!0,V[D]=H}function k(D){let z="__node_internal_"+D.name;return Object.defineProperty(D,"name",{value:z}),D}function f(D,z){if(D&&z&&D!==z){if(Array.isArray(z.errors))return z.errors.push(D),z;let N=new Z([z,D],z.message);return N.code=z.code,N}return D||z}class L extends Error{constructor(D="The operation was aborted",z=void 0){if(z!==void 0&&typeof z!=="object")throw new V.ERR_INVALID_ARG_TYPE("options","Object",z);super(D,z);this.code="ABORT_ERR",this.name="AbortError"}}M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(D,z,N)=>{if(U(typeof D==="string","'name' must be a string"),!Array.isArray(z))z=[z];let H="The ";if(D.endsWith(" argument"))H+=`${D} `;else H+=`"${D}" ${D.includes(".")?"property":"argument"} `;H+="must be ";let v=[],j=[],n=[];for(let _ of z)if(U(typeof _==="string","All expected entries have to be of type string"),W.includes(_))v.push(_.toLowerCase());else if(B.test(_))j.push(_);else U(_!=="object",'The value "object" should be written as "Object"'),n.push(_);if(j.length>0){let _=v.indexOf("object");if(_!==-1)v.splice(v,_,1),j.push("Object")}if(v.length>0){switch(v.length){case 1:H+=`of type ${v[0]}`;break;case 2:H+=`one of type ${v[0]} or ${v[1]}`;break;default:{let _=v.pop();H+=`one of type ${v.join(", ")}, or ${_}`}}if(j.length>0||n.length>0)H+=" or "}if(j.length>0){switch(j.length){case 1:H+=`an instance of ${j[0]}`;break;case 2:H+=`an instance of ${j[0]} or ${j[1]}`;break;default:{let _=j.pop();H+=`an instance of ${j.join(", ")}, or ${_}`}}if(n.length>0)H+=" or "}switch(n.length){case 0:break;case 1:if(n[0].toLowerCase()!==n[0])H+="an ";H+=`${n[0]}`;break;case 2:H+=`one of ${n[0]} or ${n[1]}`;break;default:{let _=n.pop();H+=`one of ${n.join(", ")}, or ${_}`}}if(N==null)H+=`. Received ${N}`;else if(typeof N==="function"&&N.name)H+=`. Received function ${N.name}`;else if(typeof N==="object"){var d;if((d=N.constructor)!==null&&d!==void 0&&d.name)H+=`. Received an instance of ${N.constructor.name}`;else{let _=K(N,{depth:-1});H+=`. Received ${_}`}}else{let _=K(N,{colors:!1});if(_.length>25)_=`${_.slice(0,25)}...`;H+=`. Received type ${typeof N} (${_})`}return H},TypeError),M("ERR_INVALID_ARG_VALUE",(D,z,N="is invalid")=>{let H=K(z);if(H.length>128)H=H.slice(0,128)+"...";return`The ${D.includes(".")?"property":"argument"} '${D}' ${N}. Received ${H}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(D,z,N)=>{var H;let v=N!==null&&N!==void 0&&(H=N.constructor)!==null&&H!==void 0&&H.name?`instance of ${N.constructor.name}`:`type ${typeof N}`;return`Expected ${D} to be returned from the "${z}" function but got ${v}.`},TypeError),M("ERR_MISSING_ARGS",(...D)=>{U(D.length>0,"At least one arg needs to be specified");let z,N=D.length;switch(D=(Array.isArray(D)?D:[D]).map((H)=>`"${H}"`).join(" or "),N){case 1:z+=`The ${D[0]} argument`;break;case 2:z+=`The ${D[0]} and ${D[1]} arguments`;break;default:{let H=D.pop();z+=`The ${D.join(", ")}, and ${H} arguments`}break}return`${z} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(D,z,N)=>{U(z,'Missing "range" argument');let H;if(Number.isInteger(N)&&Math.abs(N)>4294967296)H=w(String(N));else if(typeof N==="bigint"){H=String(N);let v=BigInt(2)**BigInt(32);if(N>v||N<-v)H=w(H);H+="n"}else H=K(N);return`The value of "${D}" is out of range. It must be ${z}. Received ${H}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),q.exports={AbortError:L,aggregateTwoErrors:k(f),hideStackFrames:k,codes:V}}),jV=g0(($,q)=>{Object.defineProperty($,"__esModule",{value:!0});var Q=new WeakMap,K=new WeakMap;function J(X){let P=Q.get(X);return console.assert(P!=null,"'this' is expected an Event object, but got",X),P}function Z(X){if(X.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",X.passiveListener);return}if(!X.event.cancelable)return;if(X.canceled=!0,typeof X.event.preventDefault==="function")X.event.preventDefault()}function G(X,P){Q.set(this,{eventTarget:X,event:P,eventPhase:2,currentTarget:X,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:P.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let g=Object.keys(P);for(let c=0;c0){let X=Array(arguments.length);for(let P=0;P{Object.defineProperty($,"__esModule",{value:!0});var Q=jV();class K extends Q.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let U=G.get(this);if(typeof U!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return U}}Q.defineEventAttribute(K.prototype,"abort");function J(){let U=Object.create(K.prototype);return Q.EventTarget.call(U),G.set(U,!1),U}function Z(U){if(G.get(U)!==!1)return;G.set(U,!0),U.dispatchEvent({type:"abort"})}var G=new WeakMap;if(Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class W{constructor(){B.set(this,J())}get signal(){return V(this)}abort(){Z(V(this))}}var B=new WeakMap;function V(U){let w=B.get(U);if(w==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${U===null?"null":typeof U}`);return w}if(Object.defineProperties(W.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(W.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});$.AbortController=W,$.AbortSignal=K,$.default=W,q.exports=W,q.exports.AbortController=q.exports.default=W,q.exports.AbortSignal=K}),e0=g0(($,q)=>{var Q=(t0(),X0(K2)),{format:K,inspect:J}=o9(),{codes:{ERR_INVALID_ARG_TYPE:Z}}=a0(),{kResistStopPropagation:G,AggregateError:W,SymbolDispose:B}=P0(),V=globalThis.AbortSignal||O6().AbortSignal,U=globalThis.AbortController||O6().AbortController,w=Object.getPrototypeOf(async function(){}).constructor,F=globalThis.Blob||Q.Blob,M=typeof F<"u"?function(L){return L instanceof F}:function(L){return!1},k=(L,D)=>{if(L!==void 0&&(L===null||typeof L!=="object"||!("aborted"in L)))throw new Z(D,"AbortSignal",L)},f=(L,D)=>{if(typeof L!=="function")throw new Z(D,"Function",L)};q.exports={AggregateError:W,kEmptyObject:Object.freeze({}),once(L){let D=!1;return function(...z){if(D)return;D=!0,L.apply(this,z)}},createDeferredPromise:function(){let L,D;return{promise:new Promise((z,N)=>{L=z,D=N}),resolve:L,reject:D}},promisify(L){return new Promise((D,z)=>{L((N,...H)=>{if(N)return z(N);return D(...H)})})},debuglog(){return function(){}},format:K,inspect:J,types:{isAsyncFunction(L){return L instanceof w},isArrayBufferView(L){return ArrayBuffer.isView(L)}},isBlob:M,deprecate(L,D){return L},addAbortListener:(i1(),X0(p1)).addAbortListener||function(L,D){if(L===void 0)throw new Z("signal","AbortSignal",L);k(L,"signal"),f(D,"listener");let z;if(L.aborted)queueMicrotask(()=>D());else L.addEventListener("abort",D,{__proto__:null,once:!0,[G]:!0}),z=()=>{L.removeEventListener("abort",D)};return{__proto__:null,[B](){var N;(N=z)===null||N===void 0||N()}}},AbortSignalAny:V.any||function(L){if(L.length===1)return L[0];let D=new U,z=()=>D.abort();return L.forEach((N)=>{k(N,"signals"),N.addEventListener("abort",z,{once:!0})}),D.signal.addEventListener("abort",()=>{L.forEach((N)=>N.removeEventListener("abort",z))},{once:!0}),D.signal}},q.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),P6=g0(($,q)=>{var{ArrayIsArray:Q,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:J,ArrayPrototypeMap:Z,NumberIsInteger:G,NumberIsNaN:W,NumberMAX_SAFE_INTEGER:B,NumberMIN_SAFE_INTEGER:V,NumberParseInt:U,ObjectPrototypeHasOwnProperty:w,RegExpPrototypeExec:F,String:M,StringPrototypeToUpperCase:k,StringPrototypeTrim:f}=P0(),{hideStackFrames:L,codes:{ERR_SOCKET_BAD_PORT:D,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:N,ERR_OUT_OF_RANGE:H,ERR_UNKNOWN_SIGNAL:v}}=a0(),{normalizeEncoding:j}=e0(),{isAsyncFunction:n,isArrayBufferView:d}=e0().types,_={};function X(T){return T===(T|0)}function P(T){return T===T>>>0}var g=/^[0-7]+$/,c="must be a 32-bit unsigned integer or an octal string";function h(T,t,G0){if(typeof T>"u")T=G0;if(typeof T==="string"){if(F(g,T)===null)throw new N(t,T,c);T=U(T,8)}return $0(T,t),T}var x=L((T,t,G0=V,Q0=B)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),l=L((T,t,G0=-2147483648,Q0=2147483647)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),$0=L((T,t,G0=!1)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);let Q0=G0?1:0,M0=4294967295;if(TM0)throw new H(t,`>= ${Q0} && <= ${M0}`,T)});function Z0(T,t){if(typeof T!=="string")throw new z(t,"string",T)}function F0(T,t,G0=void 0,Q0){if(typeof T!=="number")throw new z(t,"number",T);if(G0!=null&&TQ0||(G0!=null||Q0!=null)&&W(T))throw new H(t,`${G0!=null?`>= ${G0}`:""}${G0!=null&&Q0!=null?" && ":""}${Q0!=null?`<= ${Q0}`:""}`,T)}var p=L((T,t,G0)=>{if(!K(G0,T)){let Q0="must be one of: "+J(Z(G0,(M0)=>typeof M0==="string"?`'${M0}'`:M(M0)),", ");throw new N(t,T,Q0)}});function W0(T,t){if(typeof T!=="boolean")throw new z(t,"boolean",T)}function y(T,t,G0){return T==null||!w(T,t)?G0:T[t]}var i=L((T,t,G0=null)=>{let Q0=y(G0,"allowArray",!1),M0=y(G0,"allowFunction",!1);if(!y(G0,"nullable",!1)&&T===null||!Q0&&Q(T)||typeof T!=="object"&&(!M0||typeof T!=="function"))throw new z(t,"Object",T)}),U0=L((T,t)=>{if(T!=null&&typeof T!=="object"&&typeof T!=="function")throw new z(t,"a dictionary",T)}),m=L((T,t,G0=0)=>{if(!Q(T))throw new z(t,"Array",T);if(T.length{if(!d(T))throw new z(t,["Buffer","TypedArray","DataView"],T)});function E(T,t){let G0=j(t),Q0=T.length;if(G0==="hex"&&Q0%2!==0)throw new N("encoding",t,`is invalid for data of length ${Q0}`)}function a(T,t="Port",G0=!0){if(typeof T!=="number"&&typeof T!=="string"||typeof T==="string"&&f(T).length===0||+T!==+T>>>0||T>65535||T===0&&!G0)throw new D(t,T,G0);return T|0}var K0=L((T,t)=>{if(T!==void 0&&(T===null||typeof T!=="object"||!("aborted"in T)))throw new z(t,"AbortSignal",T)}),R=L((T,t)=>{if(typeof T!=="function")throw new z(t,"Function",T)}),Y=L((T,t)=>{if(typeof T!=="function"||n(T))throw new z(t,"Function",T)}),C=L((T,t)=>{if(T!==void 0)throw new z(t,"undefined",T)});function u(T,t,G0){if(!K(G0,T))throw new z(t,`('${J(G0,"|")}')`,T)}var e=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function r(T,t){if(typeof T>"u"||!F(e,T))throw new N(t,T,'must be an array or string of format "; rel=preload; as=style"')}function s(T){if(typeof T==="string")return r(T,"hints"),T;else if(Q(T)){let t=T.length,G0="";if(t===0)return G0;for(let Q0=0;Q0; rel=preload; as=style"')}q.exports={isInt32:X,isUint32:P,parseFileMode:h,validateArray:m,validateStringArray:V0,validateBooleanArray:w0,validateAbortSignalArray:S,validateBoolean:W0,validateBuffer:O,validateDictionary:U0,validateEncoding:E,validateFunction:R,validateInt32:l,validateInteger:x,validateNumber:F0,validateObject:i,validateOneOf:p,validatePlainFunction:Y,validatePort:a,validateSignalName:b,validateString:Z0,validateUint32:$0,validateUndefined:C,validateUnion:u,validateAbortSignal:K0,validateLinkHeaderValue:s}}),D1=g0(($,q)=>{q.exports=globalThis.process}),b2=g0(($,q)=>{var{SymbolAsyncIterator:Q,SymbolIterator:K,SymbolFor:J}=P0(),Z=J("nodejs.stream.destroyed"),G=J("nodejs.stream.errored"),W=J("nodejs.stream.readable"),B=J("nodejs.stream.writable"),V=J("nodejs.stream.disturbed"),U=J("nodejs.webstream.isClosedPromise"),w=J("nodejs.webstream.controllerErrorFunction");function F(y,i=!1){var U0;return!!(y&&typeof y.pipe==="function"&&typeof y.on==="function"&&(!i||typeof y.pause==="function"&&typeof y.resume==="function")&&(!y._writableState||((U0=y._readableState)===null||U0===void 0?void 0:U0.readable)!==!1)&&(!y._writableState||y._readableState))}function M(y){var i;return!!(y&&typeof y.write==="function"&&typeof y.on==="function"&&(!y._readableState||((i=y._writableState)===null||i===void 0?void 0:i.writable)!==!1))}function k(y){return!!(y&&typeof y.pipe==="function"&&y._readableState&&typeof y.on==="function"&&typeof y.write==="function")}function f(y){return y&&(y._readableState||y._writableState||typeof y.write==="function"&&typeof y.on==="function"||typeof y.pipe==="function"&&typeof y.on==="function")}function L(y){return!!(y&&!f(y)&&typeof y.pipeThrough==="function"&&typeof y.getReader==="function"&&typeof y.cancel==="function")}function D(y){return!!(y&&!f(y)&&typeof y.getWriter==="function"&&typeof y.abort==="function")}function z(y){return!!(y&&!f(y)&&typeof y.readable==="object"&&typeof y.writable==="object")}function N(y){return L(y)||D(y)||z(y)}function H(y,i){if(y==null)return!1;if(i===!0)return typeof y[Q]==="function";if(i===!1)return typeof y[K]==="function";return typeof y[Q]==="function"||typeof y[K]==="function"}function v(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!!(y.destroyed||y[Z]||m!==null&&m!==void 0&&m.destroyed)}function j(y){if(!M(y))return null;if(y.writableEnded===!0)return!0;let i=y._writableState;if(i!==null&&i!==void 0&&i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function n(y,i){if(!M(y))return null;if(y.writableFinished===!0)return!0;let U0=y._writableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.finished)!=="boolean")return null;return!!(U0.finished||i===!1&&U0.ended===!0&&U0.length===0)}function d(y){if(!F(y))return null;if(y.readableEnded===!0)return!0;let i=y._readableState;if(!i||i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function _(y,i){if(!F(y))return null;let U0=y._readableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.endEmitted)!=="boolean")return null;return!!(U0.endEmitted||i===!1&&U0.ended===!0&&U0.length===0)}function X(y){if(y&&y[W]!=null)return y[W];if(typeof(y===null||y===void 0?void 0:y.readable)!=="boolean")return null;if(v(y))return!1;return F(y)&&y.readable&&!_(y)}function P(y){if(y&&y[B]!=null)return y[B];if(typeof(y===null||y===void 0?void 0:y.writable)!=="boolean")return null;if(v(y))return!1;return M(y)&&y.writable&&!j(y)}function g(y,i){if(!f(y))return null;if(v(y))return!0;if((i===null||i===void 0?void 0:i.readable)!==!1&&X(y))return!1;if((i===null||i===void 0?void 0:i.writable)!==!1&&P(y))return!1;return!0}function c(y){var i,U0;if(!f(y))return null;if(y.writableErrored)return y.writableErrored;return(i=(U0=y._writableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function h(y){var i,U0;if(!f(y))return null;if(y.readableErrored)return y.readableErrored;return(i=(U0=y._readableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function x(y){if(!f(y))return null;if(typeof y.closed==="boolean")return y.closed;let{_writableState:i,_readableState:U0}=y;if(typeof(i===null||i===void 0?void 0:i.closed)==="boolean"||typeof(U0===null||U0===void 0?void 0:U0.closed)==="boolean")return(i===null||i===void 0?void 0:i.closed)||(U0===null||U0===void 0?void 0:U0.closed);if(typeof y._closed==="boolean"&&l(y))return y._closed;return null}function l(y){return typeof y._closed==="boolean"&&typeof y._defaultKeepAlive==="boolean"&&typeof y._removedConnection==="boolean"&&typeof y._removedContLen==="boolean"}function $0(y){return typeof y._sent100==="boolean"&&l(y)}function Z0(y){var i;return typeof y._consuming==="boolean"&&typeof y._dumped==="boolean"&&((i=y.req)===null||i===void 0?void 0:i.upgradeOrConnect)===void 0}function F0(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!m&&$0(y)||!!(m&&m.autoDestroy&&m.emitClose&&m.closed===!1)}function p(y){var i;return!!(y&&((i=y[V])!==null&&i!==void 0?i:y.readableDidRead||y.readableAborted))}function W0(y){var i,U0,m,V0,w0,S,b,O,E,a;return!!(y&&((i=(U0=(m=(V0=(w0=(S=y[G])!==null&&S!==void 0?S:y.readableErrored)!==null&&w0!==void 0?w0:y.writableErrored)!==null&&V0!==void 0?V0:(b=y._readableState)===null||b===void 0?void 0:b.errorEmitted)!==null&&m!==void 0?m:(O=y._writableState)===null||O===void 0?void 0:O.errorEmitted)!==null&&U0!==void 0?U0:(E=y._readableState)===null||E===void 0?void 0:E.errored)!==null&&i!==void 0?i:(a=y._writableState)===null||a===void 0?void 0:a.errored))}q.exports={isDestroyed:v,kIsDestroyed:Z,isDisturbed:p,kIsDisturbed:V,isErrored:W0,kIsErrored:G,isReadable:X,kIsReadable:W,kIsClosedPromise:U,kControllerErrorFunction:w,kIsWritable:B,isClosed:x,isDuplexNodeStream:k,isFinished:g,isIterable:H,isReadableNodeStream:F,isReadableStream:L,isReadableEnded:d,isReadableFinished:_,isReadableErrored:h,isNodeStream:f,isWebStream:N,isWritable:P,isWritableNodeStream:M,isWritableStream:D,isWritableEnded:j,isWritableFinished:n,isWritableErrored:c,isServerRequest:Z0,isServerResponse:$0,willEmitClose:F0,isTransformStream:z}}),s2=g0(($,q)=>{var Q=D1(),{AbortError:K,codes:J}=a0(),{ERR_INVALID_ARG_TYPE:Z,ERR_STREAM_PREMATURE_CLOSE:G}=J,{kEmptyObject:W,once:B}=e0(),{validateAbortSignal:V,validateFunction:U,validateObject:w,validateBoolean:F}=P6(),{Promise:M,PromisePrototypeThen:k,SymbolDispose:f}=P0(),{isClosed:L,isReadable:D,isReadableNodeStream:z,isReadableStream:N,isReadableFinished:H,isReadableErrored:v,isWritable:j,isWritableNodeStream:n,isWritableStream:d,isWritableFinished:_,isWritableErrored:X,isNodeStream:P,willEmitClose:g,kIsClosedPromise:c}=b2(),h;function x(p){return p.setHeader&&typeof p.abort==="function"}var l=()=>{};function $0(p,W0,y){var i,U0;if(arguments.length===2)y=W0,W0=W;else if(W0==null)W0=W;else w(W0,"options");if(U(y,"callback"),V(W0.signal,"options.signal"),y=B(y),N(p)||d(p))return Z0(p,W0,y);if(!P(p))throw new Z("stream",["ReadableStream","WritableStream","Stream"],p);let m=(i=W0.readable)!==null&&i!==void 0?i:z(p),V0=(U0=W0.writable)!==null&&U0!==void 0?U0:n(p),w0=p._writableState,S=p._readableState,b=()=>{if(!p.writable)a()},O=g(p)&&z(p)===m&&n(p)===V0,E=_(p,!1),a=()=>{if(E=!0,p.destroyed)O=!1;if(O&&(!p.readable||m))return;if(!m||K0)y.call(p)},K0=H(p,!1),R=()=>{if(K0=!0,p.destroyed)O=!1;if(O&&(!p.writable||V0))return;if(!V0||E)y.call(p)},Y=(T)=>{y.call(p,T)},C=L(p),u=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);if(m&&!K0&&z(p,!0)){if(!H(p,!1))return y.call(p,new G)}if(V0&&!E){if(!_(p,!1))return y.call(p,new G)}y.call(p)},e=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);y.call(p)},r=()=>{p.req.on("finish",a)};if(x(p)){if(p.on("complete",a),!O)p.on("abort",u);if(p.req)r();else p.on("request",r)}else if(V0&&!w0)p.on("end",b),p.on("close",b);if(!O&&typeof p.aborted==="boolean")p.on("aborted",u);if(p.on("end",R),p.on("finish",a),W0.error!==!1)p.on("error",Y);if(p.on("close",u),C)Q.nextTick(u);else if(w0!==null&&w0!==void 0&&w0.errorEmitted||S!==null&&S!==void 0&&S.errorEmitted){if(!O)Q.nextTick(e)}else if(!m&&(!O||D(p))&&(E||j(p)===!1))Q.nextTick(e);else if(!V0&&(!O||j(p))&&(K0||D(p)===!1))Q.nextTick(e);else if(S&&p.req&&p.aborted)Q.nextTick(e);let s=()=>{if(y=l,p.removeListener("aborted",u),p.removeListener("complete",a),p.removeListener("abort",u),p.removeListener("request",r),p.req)p.req.removeListener("finish",a);p.removeListener("end",b),p.removeListener("close",b),p.removeListener("finish",a),p.removeListener("end",R),p.removeListener("error",Y),p.removeListener("close",u)};if(W0.signal&&!C){let T=()=>{let t=y;s(),t.call(p,new K(void 0,{cause:W0.signal.reason}))};if(W0.signal.aborted)Q.nextTick(T);else{h=h||e0().addAbortListener;let t=h(W0.signal,T),G0=y;y=B((...Q0)=>{t[f](),G0.apply(p,Q0)})}}return s}function Z0(p,W0,y){let i=!1,U0=l;if(W0.signal)if(U0=()=>{i=!0,y.call(p,new K(void 0,{cause:W0.signal.reason}))},W0.signal.aborted)Q.nextTick(U0);else{h=h||e0().addAbortListener;let V0=h(W0.signal,U0),w0=y;y=B((...S)=>{V0[f](),w0.apply(p,S)})}let m=(...V0)=>{if(!i)Q.nextTick(()=>y.apply(p,V0))};return k(p[c].promise,m,m),l}function F0(p,W0){var y;let i=!1;if(W0===null)W0=W;if((y=W0)!==null&&y!==void 0&&y.cleanup)F(W0.cleanup,"cleanup"),i=W0.cleanup;return new M((U0,m)=>{let V0=$0(p,W0,(w0)=>{if(i)V0();if(w0)m(w0);else U0()})})}q.exports=$0,q.exports.finished=F0}),o1=g0(($,q)=>{var Q=D1(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:J},AbortError:Z}=a0(),{Symbol:G}=P0(),{kIsDestroyed:W,isDestroyed:B,isFinished:V,isServerRequest:U}=b2(),w=G("kDestroy"),F=G("kConstruct");function M(g,c,h){if(g){if(g.stack,c&&!c.errored)c.errored=g;if(h&&!h.errored)h.errored=g}}function k(g,c){let h=this._readableState,x=this._writableState,l=x||h;if(x!==null&&x!==void 0&&x.destroyed||h!==null&&h!==void 0&&h.destroyed){if(typeof c==="function")c();return this}if(M(g,x,h),x)x.destroyed=!0;if(h)h.destroyed=!0;if(!l.constructed)this.once(w,function($0){f(this,K($0,g),c)});else f(this,g,c);return this}function f(g,c,h){let x=!1;function l($0){if(x)return;x=!0;let{_readableState:Z0,_writableState:F0}=g;if(M($0,F0,Z0),F0)F0.closed=!0;if(Z0)Z0.closed=!0;if(typeof h==="function")h($0);if($0)Q.nextTick(L,g,$0);else Q.nextTick(D,g)}try{g._destroy(c||null,l)}catch($0){l($0)}}function L(g,c){z(g,c),D(g)}function D(g){let{_readableState:c,_writableState:h}=g;if(h)h.closeEmitted=!0;if(c)c.closeEmitted=!0;if(h!==null&&h!==void 0&&h.emitClose||c!==null&&c!==void 0&&c.emitClose)g.emit("close")}function z(g,c){let{_readableState:h,_writableState:x}=g;if(x!==null&&x!==void 0&&x.errorEmitted||h!==null&&h!==void 0&&h.errorEmitted)return;if(x)x.errorEmitted=!0;if(h)h.errorEmitted=!0;g.emit("error",c)}function N(){let g=this._readableState,c=this._writableState;if(g)g.constructed=!0,g.closed=!1,g.closeEmitted=!1,g.destroyed=!1,g.errored=null,g.errorEmitted=!1,g.reading=!1,g.ended=g.readable===!1,g.endEmitted=g.readable===!1;if(c)c.constructed=!0,c.destroyed=!1,c.closed=!1,c.closeEmitted=!1,c.errored=null,c.errorEmitted=!1,c.finalCalled=!1,c.prefinished=!1,c.ended=c.writable===!1,c.ending=c.writable===!1,c.finished=c.writable===!1}function H(g,c,h){let{_readableState:x,_writableState:l}=g;if(l!==null&&l!==void 0&&l.destroyed||x!==null&&x!==void 0&&x.destroyed)return this;if(x!==null&&x!==void 0&&x.autoDestroy||l!==null&&l!==void 0&&l.autoDestroy)g.destroy(c);else if(c){if(c.stack,l&&!l.errored)l.errored=c;if(x&&!x.errored)x.errored=c;if(h)Q.nextTick(z,g,c);else z(g,c)}}function v(g,c){if(typeof g._construct!=="function")return;let{_readableState:h,_writableState:x}=g;if(h)h.constructed=!1;if(x)x.constructed=!1;if(g.once(F,c),g.listenerCount(F)>1)return;Q.nextTick(j,g)}function j(g){let c=!1;function h(x){if(c){H(g,x!==null&&x!==void 0?x:new J);return}c=!0;let{_readableState:l,_writableState:$0}=g,Z0=$0||l;if(l)l.constructed=!0;if($0)$0.constructed=!0;if(Z0.destroyed)g.emit(w,x);else if(x)H(g,x,!0);else Q.nextTick(n,g)}try{g._construct((x)=>{Q.nextTick(h,x)})}catch(x){Q.nextTick(h,x)}}function n(g){g.emit(F)}function d(g){return(g===null||g===void 0?void 0:g.setHeader)&&typeof g.abort==="function"}function _(g){g.emit("close")}function X(g,c){g.emit("error",c),Q.nextTick(_,g)}function P(g,c){if(!g||B(g))return;if(!c&&!V(g))c=new Z;if(U(g))g.socket=null,g.destroy(c);else if(d(g))g.abort();else if(d(g.req))g.req.abort();else if(typeof g.destroy==="function")g.destroy(c);else if(typeof g.close==="function")g.close();else if(c)Q.nextTick(X,g,c);else Q.nextTick(_,g);if(!g.destroyed)g[W]=!0}q.exports={construct:v,destroyer:P,destroy:k,undestroy:N,errorOrDestroy:H}}),b5=g0(($,q)=>{var{ArrayIsArray:Q,ObjectSetPrototypeOf:K}=P0(),{EventEmitter:J}=(i1(),X0(p1));function Z(W){J.call(this,W)}K(Z.prototype,J.prototype),K(Z,J),Z.prototype.pipe=function(W,B){let V=this;function U(D){if(W.writable&&W.write(D)===!1&&V.pause)V.pause()}V.on("data",U);function w(){if(V.readable&&V.resume)V.resume()}if(W.on("drain",w),!W._isStdio&&(!B||B.end!==!1))V.on("end",M),V.on("close",k);let F=!1;function M(){if(F)return;F=!0,W.end()}function k(){if(F)return;if(F=!0,typeof W.destroy==="function")W.destroy()}function f(D){if(L(),J.listenerCount(this,"error")===0)this.emit("error",D)}G(V,"error",f),G(W,"error",f);function L(){V.removeListener("data",U),W.removeListener("drain",w),V.removeListener("end",M),V.removeListener("close",k),V.removeListener("error",f),W.removeListener("error",f),V.removeListener("end",L),V.removeListener("close",L),W.removeListener("close",L)}return V.on("end",L),V.on("close",L),W.on("close",L),W.emit("pipe",V),W};function G(W,B,V){if(typeof W.prependListener==="function")return W.prependListener(B,V);if(!W._events||!W._events[B])W.on(B,V);else if(Q(W._events[B]))W._events[B].unshift(V);else W._events[B]=[V,W._events[B]]}q.exports={Stream:Z,prependListener:G}}),H8=g0(($,q)=>{var{SymbolDispose:Q}=P0(),{AbortError:K,codes:J}=a0(),{isNodeStream:Z,isWebStream:G,kControllerErrorFunction:W}=b2(),B=s2(),{ERR_INVALID_ARG_TYPE:V}=J,U,w=(F,M)=>{if(typeof F!=="object"||!("aborted"in F))throw new V(M,"AbortSignal",F)};q.exports.addAbortSignal=function(F,M){if(w(F,"signal"),!Z(M)&&!G(M))throw new V("stream",["ReadableStream","WritableStream","Stream"],M);return q.exports.addAbortSignalNoValidate(F,M)},q.exports.addAbortSignalNoValidate=function(F,M){if(typeof F!=="object"||!("aborted"in F))return M;let k=Z(M)?()=>{M.destroy(new K(void 0,{cause:F.reason}))}:()=>{M[W](new K(void 0,{cause:F.reason}))};if(F.aborted)k();else{U=U||e0().addAbortListener;let f=U(F,k);B(M,f[Q])}return M}}),gV=g0(($,q)=>{var{StringPrototypeSlice:Q,SymbolIterator:K,TypedArrayPrototypeSet:J,Uint8Array:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{inspect:W}=e0();q.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(B){let V={data:B,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length}unshift(B){let V={data:B,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length}shift(){if(this.length===0)return;let B=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,B}clear(){this.head=this.tail=null,this.length=0}join(B){if(this.length===0)return"";let V=this.head,U=""+V.data;while((V=V.next)!==null)U+=B+V.data;return U}concat(B){if(this.length===0)return G.alloc(0);let V=G.allocUnsafe(B>>>0),U=this.head,w=0;while(U)J(V,U.data,w),w+=U.data.length,U=U.next;return V}consume(B,V){let U=this.head.data;if(BF.length)V+=F,B-=F.length;else{if(B===F.length)if(V+=F,++w,U.next)this.head=U.next;else this.head=this.tail=null;else V+=Q(F,0,B),this.head=U,U.data=Q(F,B);break}++w}while((U=U.next)!==null);return this.length-=w,V}_getBuffer(B){let V=G.allocUnsafe(B),U=B,w=this.head,F=0;do{let M=w.data;if(B>M.length)J(V,M,U-B),B-=M.length;else{if(B===M.length)if(J(V,M,U-B),++F,w.next)this.head=w.next;else this.head=this.tail=null;else J(V,new Z(M.buffer,M.byteOffset,B),U-B),this.head=w,w.data=M.slice(B);break}++F}while((w=w.next)!==null);return this.length-=F,V}[Symbol.for("nodejs.util.inspect.custom")](B,V){return W(this,{...V,depth:0,customInspect:!1})}}}),v8=g0(($,q)=>{var{MathFloor:Q,NumberIsInteger:K}=P0(),{validateInteger:J}=P6(),{ERR_INVALID_ARG_VALUE:Z}=a0().codes,G=16384,W=16;function B(F,M,k){return F.highWaterMark!=null?F.highWaterMark:M?F[k]:null}function V(F){return F?W:G}function U(F,M){if(J(M,"value",0),F)W=M;else G=M}function w(F,M,k,f){let L=B(M,f,k);if(L!=null){if(!K(L)||L<0){let D=f?`options.${k}`:"options.highWaterMark";throw new Z(D,L)}return Q(L)}return V(F.objectMode)}q.exports={getHighWaterMark:w,getDefaultHighWaterMark:V,setDefaultHighWaterMark:U}}),AV=g0(($,q)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),XV=g0(($)=>{var q=AV().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),a9=g0(($,q)=>{var Q=D1(),{PromisePrototypeThen:K,SymbolAsyncIterator:J,SymbolIterator:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{ERR_INVALID_ARG_TYPE:W,ERR_STREAM_NULL_VALUES:B}=a0().codes;function V(U,w,F){let M;if(typeof w==="string"||w instanceof G)return new U({objectMode:!0,...F,read(){this.push(w),this.push(null)}});let k;if(w&&w[J])k=!0,M=w[J]();else if(w&&w[Z])k=!1,M=w[Z]();else throw new W("iterable",["Iterable"],w);let f=new U({objectMode:!0,highWaterMark:1,...F}),L=!1;f._read=function(){if(!L)L=!0,z()},f._destroy=function(N,H){K(D(N),()=>Q.nextTick(H,N),(v)=>Q.nextTick(H,v||N))};async function D(N){let H=N!==void 0&&N!==null,v=typeof M.throw==="function";if(H&&v){let{value:j,done:n}=await M.throw(N);if(await j,n)return}if(typeof M.return==="function"){let{value:j}=await M.return();await j}}async function z(){for(;;){try{let{value:N,done:H}=k?await M.next():M.next();if(H)f.push(null);else{let v=N&&typeof N.then==="function"?await N:N;if(v===null)throw L=!1,new B;else if(f.push(v))continue;else L=!1}}catch(N){f.destroy(N)}break}}return f}q.exports=V}),f8=g0(($,q)=>{var Q=D1(),{ArrayPrototypeIndexOf:K,NumberIsInteger:J,NumberIsNaN:Z,NumberParseInt:G,ObjectDefineProperties:W,ObjectKeys:B,ObjectSetPrototypeOf:V,Promise:U,SafeSet:w,SymbolAsyncDispose:F,SymbolAsyncIterator:M,Symbol:k}=P0();q.exports=Q0,Q0.ReadableState=G0;var{EventEmitter:f}=(i1(),X0(p1)),{Stream:L,prependListener:D}=b5(),{Buffer:z}=(t0(),X0(K2)),{addAbortSignal:N}=H8(),H=s2(),v=e0().debuglog("stream",(I)=>{v=I}),j=gV(),n=o1(),{getHighWaterMark:d,getDefaultHighWaterMark:_}=v8(),{aggregateTwoErrors:X,codes:{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:g,ERR_OUT_OF_RANGE:c,ERR_STREAM_PUSH_AFTER_EOF:h,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:x},AbortError:l}=a0(),{validateObject:$0}=P6(),Z0=k("kPaused"),{StringDecoder:F0}=XV(),p=a9();V(Q0.prototype,L.prototype),V(Q0,L);var W0=()=>{},{errorOrDestroy:y}=n,i=1,U0=2,m=4,V0=8,w0=16,S=32,b=64,O=128,E=256,a=512,K0=1024,R=2048,Y=4096,C=8192,u=16384,e=32768,r=65536,s=131072,T=262144;function t(I){return{enumerable:!1,get(){return(this.state&I)!==0},set(A){if(A)this.state|=I;else this.state&=~I}}}W(G0.prototype,{objectMode:t(i),ended:t(U0),endEmitted:t(m),reading:t(V0),constructed:t(w0),sync:t(S),needReadable:t(b),emittedReadable:t(O),readableListening:t(E),resumeScheduled:t(a),errorEmitted:t(K0),emitClose:t(R),autoDestroy:t(Y),destroyed:t(C),closed:t(u),closeEmitted:t(e),multiAwaitDrain:t(r),readingMore:t(s),dataEmitted:t(T)});function G0(I,A,J0){if(typeof J0!=="boolean")J0=A instanceof c2();if(this.state=R|Y|w0|S,I&&I.objectMode)this.state|=i;if(J0&&I&&I.readableObjectMode)this.state|=i;if(this.highWaterMark=I?d(this,I,"readableHighWaterMark",J0):_(!1),this.buffer=new j,this.length=0,this.pipes=[],this.flowing=null,this[Z0]=null,I&&I.emitClose===!1)this.state&=~R;if(I&&I.autoDestroy===!1)this.state&=~Y;if(this.errored=null,this.defaultEncoding=I&&I.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,I&&I.encoding)this.decoder=new F0(I.encoding),this.encoding=I.encoding}function Q0(I){if(!(this instanceof Q0))return new Q0(I);let A=this instanceof c2();if(this._readableState=new G0(I,this,A),I){if(typeof I.read==="function")this._read=I.read;if(typeof I.destroy==="function")this._destroy=I.destroy;if(typeof I.construct==="function")this._construct=I.construct;if(I.signal&&!A)N(I.signal,this)}L.call(this,I),n.construct(this,()=>{if(this._readableState.needReadable)_1(this,this._readableState)})}Q0.prototype.destroy=n.destroy,Q0.prototype._undestroy=n.undestroy,Q0.prototype._destroy=function(I,A){A(I)},Q0.prototype[f.captureRejectionSymbol]=function(I){this.destroy(I)},Q0.prototype[F]=function(){let I;if(!this.destroyed)I=this.readableEnded?null:new l,this.destroy(I);return new U((A,J0)=>H(this,(B0)=>B0&&B0!==I?J0(B0):A(null)))},Q0.prototype.push=function(I,A){return M0(this,I,A,!1)},Q0.prototype.unshift=function(I,A){return M0(this,I,A,!0)};function M0(I,A,J0,B0){v("readableAddChunk",A);let z0=I._readableState,i0;if((z0.state&i)===0){if(typeof A==="string"){if(J0=J0||z0.defaultEncoding,z0.encoding!==J0)if(B0&&z0.encoding)A=z.from(A,J0).toString(z0.encoding);else A=z.from(A,J0),J0=""}else if(A instanceof z)J0="";else if(L._isUint8Array(A))A=L._uint8ArrayToBuffer(A),J0="";else if(A!=null)i0=new P("chunk",["string","Buffer","Uint8Array"],A)}if(i0)y(I,i0);else if(A===null)z0.state&=~V0,O0(I,z0);else if((z0.state&i)!==0||A&&A.length>0)if(B0)if((z0.state&m)!==0)y(I,new x);else if(z0.destroyed||z0.errored)return!1;else I0(I,z0,A,!0);else if(z0.ended)y(I,new h);else if(z0.destroyed||z0.errored)return!1;else if(z0.state&=~V0,z0.decoder&&!J0)if(A=z0.decoder.write(A),z0.objectMode||A.length!==0)I0(I,z0,A,!1);else _1(I,z0);else I0(I,z0,A,!1);else if(!B0)z0.state&=~V0,_1(I,z0);return!z0.ended&&(z0.length0){if((A.state&r)!==0)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;A.dataEmitted=!0,I.emit("data",J0)}else{if(A.length+=A.objectMode?1:J0.length,B0)A.buffer.unshift(J0);else A.buffer.push(J0);if((A.state&b)!==0)u0(I)}_1(I,A)}Q0.prototype.isPaused=function(){let I=this._readableState;return I[Z0]===!0||I.flowing===!1},Q0.prototype.setEncoding=function(I){let A=new F0(I);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;let J0=this._readableState.buffer,B0="";for(let z0 of J0)B0+=A.write(z0);if(J0.clear(),B0!=="")J0.push(B0);return this._readableState.length=B0.length,this};var m0=1073741824;function p0(I){if(I>m0)throw new c("size","<= 1GiB",I);else I--,I|=I>>>1,I|=I>>>2,I|=I>>>4,I|=I>>>8,I|=I>>>16,I++;return I}function q2(I,A){if(I<=0||A.length===0&&A.ended)return 0;if((A.state&i)!==0)return 1;if(Z(I)){if(A.flowing&&A.length)return A.buffer.first().length;return A.length}if(I<=A.length)return I;return A.ended?A.length:0}Q0.prototype.read=function(I){if(v("read",I),I===void 0)I=NaN;else if(!J(I))I=G(I,10);let A=this._readableState,J0=I;if(I>A.highWaterMark)A.highWaterMark=p0(I);if(I!==0)A.state&=~O;if(I===0&&A.needReadable&&((A.highWaterMark!==0?A.length>=A.highWaterMark:A.length>0)||A.ended)){if(v("read: emitReadable",A.length,A.ended),A.length===0&&A.ended)f5(this);else u0(this);return null}if(I=q2(I,A),I===0&&A.ended){if(A.length===0)f5(this);return null}let B0=(A.state&b)!==0;if(v("need readable",B0),A.length===0||A.length-I0)z0=l7(I,A);else z0=null;if(z0===null)A.needReadable=A.length<=A.highWaterMark,I=0;else if(A.length-=I,A.multiAwaitDrain)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;if(A.length===0){if(!A.ended)A.needReadable=!0;if(J0!==I&&A.ended)f5(this)}if(z0!==null&&!A.errorEmitted&&!A.closeEmitted)A.dataEmitted=!0,this.emit("data",z0);return z0};function O0(I,A){if(v("onEofChunk"),A.ended)return;if(A.decoder){let J0=A.decoder.end();if(J0&&J0.length)A.buffer.push(J0),A.length+=A.objectMode?1:J0.length}if(A.ended=!0,A.sync)u0(I);else A.needReadable=!1,A.emittedReadable=!0,E1(I)}function u0(I){let A=I._readableState;if(v("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,!A.emittedReadable)v("emitReadable",A.flowing),A.emittedReadable=!0,Q.nextTick(E1,I)}function E1(I){let A=I._readableState;if(v("emitReadable_",A.destroyed,A.length,A.ended),!A.destroyed&&!A.errored&&(A.length||A.ended))I.emit("readable"),A.emittedReadable=!1;A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,o7(I)}function _1(I,A){if(!A.readingMore&&A.constructed)A.readingMore=!0,Q.nextTick(R2,I,A)}function R2(I,A){while(!A.reading&&!A.ended&&(A.length1&&B0.pipes.includes(I))v("false write response, pause",B0.awaitDrainWriters.size),B0.awaitDrainWriters.add(I);J0.pause()}if(!z1)z1=wJ(J0,I),I.on("drain",z1)}J0.on("data",e7);function e7(F1){v("ondata");let u2=I.write(F1);if(v("dest.write",u2),u2===!1)t7()}function I5(F1){if(v("onerror",F1),A6(),I.removeListener("error",I5),I.listenerCount("error")===0){let u2=I._writableState||I._readableState;if(u2&&!u2.errorEmitted)y(I,F1);else I.emit("error",F1)}}D(I,"error",I5);function C5(){I.removeListener("finish",j5),A6()}I.once("close",C5);function j5(){v("onfinish"),I.removeListener("close",C5),A6()}I.once("finish",j5);function A6(){v("unpipe"),J0.unpipe(I)}if(I.emit("pipe",J0),I.writableNeedDrain===!0)t7();else if(!B0.flowing)v("pipe resume"),J0.resume();return I};function wJ(I,A){return function(){let J0=I._readableState;if(J0.awaitDrainWriters===A)v("pipeOnDrain",1),J0.awaitDrainWriters=null;else if(J0.multiAwaitDrain)v("pipeOnDrain",J0.awaitDrainWriters.size),J0.awaitDrainWriters.delete(A);if((!J0.awaitDrainWriters||J0.awaitDrainWriters.size===0)&&I.listenerCount("data"))I.resume()}}Q0.prototype.unpipe=function(I){let A=this._readableState,J0={hasUnpiped:!1};if(A.pipes.length===0)return this;if(!I){let z0=A.pipes;A.pipes=[],this.pause();for(let i0=0;i00,B0.flowing!==!1)this.resume()}else if(I==="readable"){if(!B0.endEmitted&&!B0.readableListening){if(B0.readableListening=B0.needReadable=!0,B0.flowing=!1,B0.emittedReadable=!1,v("on readable",B0.length,B0.reading),B0.length)u0(this);else if(!B0.reading)Q.nextTick(NJ,this)}}return J0},Q0.prototype.addListener=Q0.prototype.on,Q0.prototype.removeListener=function(I,A){let J0=L.prototype.removeListener.call(this,I,A);if(I==="readable")Q.nextTick(i7,this);return J0},Q0.prototype.off=Q0.prototype.removeListener,Q0.prototype.removeAllListeners=function(I){let A=L.prototype.removeAllListeners.apply(this,arguments);if(I==="readable"||I===void 0)Q.nextTick(i7,this);return A};function i7(I){let A=I._readableState;if(A.readableListening=I.listenerCount("readable")>0,A.resumeScheduled&&A[Z0]===!1)A.flowing=!0;else if(I.listenerCount("data")>0)I.resume();else if(!A.readableListening)A.flowing=null}function NJ(I){v("readable nexttick read 0"),I.read(0)}Q0.prototype.resume=function(){let I=this._readableState;if(!I.flowing)v("resume"),I.flowing=!I.readableListening,YJ(this,I);return I[Z0]=!1,this};function YJ(I,A){if(!A.resumeScheduled)A.resumeScheduled=!0,Q.nextTick(kJ,I,A)}function kJ(I,A){if(v("resume",A.reading),!A.reading)I.read(0);if(A.resumeScheduled=!1,I.emit("resume"),o7(I),A.flowing&&!A.reading)I.read(0)}Q0.prototype.pause=function(){if(v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)v("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[Z0]=!0,this};function o7(I){let A=I._readableState;v("flow",A.flowing);while(A.flowing&&I.read()!==null);}Q0.prototype.wrap=function(I){let A=!1;I.on("data",(B0)=>{if(!this.push(B0)&&I.pause)A=!0,I.pause()}),I.on("end",()=>{this.push(null)}),I.on("error",(B0)=>{y(this,B0)}),I.on("close",()=>{this.destroy()}),I.on("destroy",()=>{this.destroy()}),this._read=()=>{if(A&&I.resume)A=!1,I.resume()};let J0=B(I);for(let B0=1;B0{z0=z2?X(z0,z2):null,J0(),J0=W0});try{while(!0){let z2=I.destroyed?null:I.read();if(z2!==null)yield z2;else if(z0)throw z0;else if(z0===null)return;else await new U(B0)}}catch(z2){throw z0=X(z0,z2),z0}finally{if((z0||(A===null||A===void 0?void 0:A.destroyOnReturn)!==!1)&&(z0===void 0||I._readableState.autoDestroy))n.destroyer(I,null);else I.off("readable",B0),i0()}}W(Q0.prototype,{readable:{__proto__:null,get(){let I=this._readableState;return!!I&&I.readable!==!1&&!I.destroyed&&!I.errorEmitted&&!I.endEmitted},set(I){if(this._readableState)this._readableState.readable=!!I}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(I){if(this._readableState)this._readableState.flowing=I}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(I){if(!this._readableState)return;this._readableState.destroyed=I}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),W(G0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Z0]!==!1},set(I){this[Z0]=!!I}}}),Q0._fromList=l7;function l7(I,A){if(A.length===0)return null;let J0;if(A.objectMode)J0=A.buffer.shift();else if(!I||I>=A.length){if(A.decoder)J0=A.buffer.join("");else if(A.buffer.length===1)J0=A.buffer.first();else J0=A.buffer.concat(A.length);A.buffer.clear()}else J0=A.buffer.consume(I,A.decoder);return J0}function f5(I){let A=I._readableState;if(v("endReadable",A.endEmitted),!A.endEmitted)A.ended=!0,Q.nextTick(LJ,A,I)}function LJ(I,A){if(v("endReadableNT",I.endEmitted,I.length),!I.errored&&!I.closeEmitted&&!I.endEmitted&&I.length===0){if(I.endEmitted=!0,A.emit("end"),A.writable&&A.allowHalfOpen===!1)Q.nextTick(HJ,A);else if(I.autoDestroy){let J0=A._writableState;if(!J0||J0.autoDestroy&&(J0.finished||J0.writable===!1))A.destroy()}}}function HJ(I){if(I.writable&&!I.writableEnded&&!I.destroyed)I.end()}Q0.from=function(I,A){return p(Q0,I,A)};var R5;function r7(){if(R5===void 0)R5={};return R5}Q0.fromWeb=function(I,A){return r7().newStreamReadableFromReadableStream(I,A)},Q0.toWeb=function(I,A){return r7().newReadableStreamFromStreamReadable(I,A)},Q0.wrap=function(I,A){var J0,B0;return new Q0({objectMode:(J0=(B0=I.readableObjectMode)!==null&&B0!==void 0?B0:I.objectMode)!==null&&J0!==void 0?J0:!0,...A,destroy(z0,i0){n.destroyer(I,z0),i0(z0)}}).wrap(I)}}),n5=g0(($,q)=>{var Q=D1(),{ArrayPrototypeSlice:K,Error:J,FunctionPrototypeSymbolHasInstance:Z,ObjectDefineProperty:G,ObjectDefineProperties:W,ObjectSetPrototypeOf:B,StringPrototypeToLowerCase:V,Symbol:U,SymbolHasInstance:w}=P0();q.exports=$0,$0.WritableState=x;var{EventEmitter:F}=(i1(),X0(p1)),M=b5().Stream,{Buffer:k}=(t0(),X0(K2)),f=o1(),{addAbortSignal:L}=H8(),{getHighWaterMark:D,getDefaultHighWaterMark:z}=v8(),{ERR_INVALID_ARG_TYPE:N,ERR_METHOD_NOT_IMPLEMENTED:H,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:j,ERR_STREAM_DESTROYED:n,ERR_STREAM_ALREADY_FINISHED:d,ERR_STREAM_NULL_VALUES:_,ERR_STREAM_WRITE_AFTER_END:X,ERR_UNKNOWN_ENCODING:P}=a0().codes,{errorOrDestroy:g}=f;B($0.prototype,M.prototype),B($0,M);function c(){}var h=U("kOnFinished");function x(Y,C,u){if(typeof u!=="boolean")u=C instanceof c2();if(this.objectMode=!!(Y&&Y.objectMode),u)this.objectMode=this.objectMode||!!(Y&&Y.writableObjectMode);this.highWaterMark=Y?D(this,Y,"writableHighWaterMark",u):z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let e=!!(Y&&Y.decodeStrings===!1);this.decodeStrings=!e,this.defaultEncoding=Y&&Y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=y.bind(void 0,C),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,l(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!Y||Y.emitClose!==!1,this.autoDestroy=!Y||Y.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[h]=[]}function l(Y){Y.buffered=[],Y.bufferedIndex=0,Y.allBuffers=!0,Y.allNoop=!0}x.prototype.getBuffer=function(){return K(this.buffered,this.bufferedIndex)},G(x.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function $0(Y){let C=this instanceof c2();if(!C&&!Z($0,this))return new $0(Y);if(this._writableState=new x(Y,this,C),Y){if(typeof Y.write==="function")this._write=Y.write;if(typeof Y.writev==="function")this._writev=Y.writev;if(typeof Y.destroy==="function")this._destroy=Y.destroy;if(typeof Y.final==="function")this._final=Y.final;if(typeof Y.construct==="function")this._construct=Y.construct;if(Y.signal)L(Y.signal,this)}M.call(this,Y),f.construct(this,()=>{let u=this._writableState;if(!u.writing)V0(this,u);O(this,u)})}G($0,w,{__proto__:null,value:function(Y){if(Z(this,Y))return!0;if(this!==$0)return!1;return Y&&Y._writableState instanceof x}}),$0.prototype.pipe=function(){g(this,new j)};function Z0(Y,C,u,e){let r=Y._writableState;if(typeof u==="function")e=u,u=r.defaultEncoding;else{if(!u)u=r.defaultEncoding;else if(u!=="buffer"&&!k.isEncoding(u))throw new P(u);if(typeof e!=="function")e=c}if(C===null)throw new _;else if(!r.objectMode)if(typeof C==="string"){if(r.decodeStrings!==!1)C=k.from(C,u),u="buffer"}else if(C instanceof k)u="buffer";else if(M._isUint8Array(C))C=M._uint8ArrayToBuffer(C),u="buffer";else throw new N("chunk",["string","Buffer","Uint8Array"],C);let s;if(r.ending)s=new X;else if(r.destroyed)s=new n("write");if(s)return Q.nextTick(e,s),g(Y,s,!0),s;return r.pendingcb++,F0(Y,r,C,u,e)}$0.prototype.write=function(Y,C,u){return Z0(this,Y,C,u)===!0},$0.prototype.cork=function(){this._writableState.corked++},$0.prototype.uncork=function(){let Y=this._writableState;if(Y.corked){if(Y.corked--,!Y.writing)V0(this,Y)}},$0.prototype.setDefaultEncoding=function(Y){if(typeof Y==="string")Y=V(Y);if(!k.isEncoding(Y))throw new P(Y);return this._writableState.defaultEncoding=Y,this};function F0(Y,C,u,e,r){let s=C.objectMode?1:u.length;C.length+=s;let T=C.lengthu.bufferedIndex)V0(Y,u);if(e)if(u.afterWriteTickInfo!==null&&u.afterWriteTickInfo.cb===r)u.afterWriteTickInfo.count++;else u.afterWriteTickInfo={count:1,cb:r,stream:Y,state:u},Q.nextTick(i,u.afterWriteTickInfo);else U0(Y,u,1,r)}}function i({stream:Y,state:C,count:u,cb:e}){return C.afterWriteTickInfo=null,U0(Y,C,u,e)}function U0(Y,C,u,e){if(!C.ending&&!Y.destroyed&&C.length===0&&C.needDrain)C.needDrain=!1,Y.emit("drain");while(u-- >0)C.pendingcb--,e();if(C.destroyed)m(C);O(Y,C)}function m(Y){if(Y.writing)return;for(let r=Y.bufferedIndex;r1&&Y._writev){C.pendingcb-=s-1;let t=C.allNoop?c:(Q0)=>{for(let M0=T;M0256)u.splice(0,T),C.bufferedIndex=0;else C.bufferedIndex=T}C.bufferProcessing=!1}$0.prototype._write=function(Y,C,u){if(this._writev)this._writev([{chunk:Y,encoding:C}],u);else throw new H("_write()")},$0.prototype._writev=null,$0.prototype.end=function(Y,C,u){let e=this._writableState;if(typeof Y==="function")u=Y,Y=null,C=null;else if(typeof C==="function")u=C,C=null;let r;if(Y!==null&&Y!==void 0){let s=Z0(this,Y,C);if(s instanceof J)r=s}if(e.corked)e.corked=1,this.uncork();if(r);else if(!e.errored&&!e.ending)e.ending=!0,O(this,e,!0),e.ended=!0;else if(e.finished)r=new d("end");else if(e.destroyed)r=new n("end");if(typeof u==="function")if(r||e.finished)Q.nextTick(u,r);else e[h].push(u);return this};function w0(Y){return Y.ending&&!Y.destroyed&&Y.constructed&&Y.length===0&&!Y.errored&&Y.buffered.length===0&&!Y.finished&&!Y.writing&&!Y.errorEmitted&&!Y.closeEmitted}function S(Y,C){let u=!1;function e(r){if(u){g(Y,r!==null&&r!==void 0?r:v());return}if(u=!0,C.pendingcb--,r){let s=C[h].splice(0);for(let T=0;T{if(w0(r))E(e,r);else r.pendingcb--},Y,C);else if(w0(C))C.pendingcb++,E(Y,C)}}}function E(Y,C){C.pendingcb--,C.finished=!0;let u=C[h].splice(0);for(let e=0;e{var Q=D1(),K=(t0(),X0(K2)),{isReadable:J,isWritable:Z,isIterable:G,isNodeStream:W,isReadableNodeStream:B,isWritableNodeStream:V,isDuplexNodeStream:U,isReadableStream:w,isWritableStream:F}=b2(),M=s2(),{AbortError:k,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:L}}=a0(),{destroyer:D}=o1(),z=c2(),N=f8(),H=n5(),{createDeferredPromise:v}=e0(),j=a9(),n=globalThis.Blob||K.Blob,d=typeof n<"u"?function(h){return h instanceof n}:function(h){return!1},_=globalThis.AbortController||O6().AbortController,{FunctionPrototypeCall:X}=P0();class P extends z{constructor(h){super(h);if((h===null||h===void 0?void 0:h.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((h===null||h===void 0?void 0:h.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}q.exports=function h(x,l){if(U(x))return x;if(B(x))return c({readable:x});if(V(x))return c({writable:x});if(W(x))return c({writable:!1,readable:!1});if(w(x))return c({readable:N.fromWeb(x)});if(F(x))return c({writable:H.fromWeb(x)});if(typeof x==="function"){let{value:Z0,write:F0,final:p,destroy:W0}=g(x);if(G(Z0))return j(P,Z0,{objectMode:!0,write:F0,final:p,destroy:W0});let y=Z0===null||Z0===void 0?void 0:Z0.then;if(typeof y==="function"){let i,U0=X(y,Z0,(m)=>{if(m!=null)throw new L("nully","body",m)},(m)=>{D(i,m)});return i=new P({objectMode:!0,readable:!1,write:F0,final(m){p(async()=>{try{await U0,Q.nextTick(m,null)}catch(V0){Q.nextTick(m,V0)}})},destroy:W0})}throw new L("Iterable, AsyncIterable or AsyncFunction",l,Z0)}if(d(x))return h(x.arrayBuffer());if(G(x))return j(P,x,{objectMode:!0,writable:!1});if(w(x===null||x===void 0?void 0:x.readable)&&F(x===null||x===void 0?void 0:x.writable))return P.fromWeb(x);if(typeof(x===null||x===void 0?void 0:x.writable)==="object"||typeof(x===null||x===void 0?void 0:x.readable)==="object"){let Z0=x!==null&&x!==void 0&&x.readable?B(x===null||x===void 0?void 0:x.readable)?x===null||x===void 0?void 0:x.readable:h(x.readable):void 0,F0=x!==null&&x!==void 0&&x.writable?V(x===null||x===void 0?void 0:x.writable)?x===null||x===void 0?void 0:x.writable:h(x.writable):void 0;return c({readable:Z0,writable:F0})}let $0=x===null||x===void 0?void 0:x.then;if(typeof $0==="function"){let Z0;return X($0,x,(F0)=>{if(F0!=null)Z0.push(F0);Z0.push(null)},(F0)=>{D(Z0,F0)}),Z0=new P({objectMode:!0,writable:!1,read(){}})}throw new f(l,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],x)};function g(h){let{promise:x,resolve:l}=v(),$0=new _,Z0=$0.signal;return{value:h(async function*(){while(!0){let F0=x;x=null;let{chunk:p,done:W0,cb:y}=await F0;if(Q.nextTick(y),W0)return;if(Z0.aborted)throw new k(void 0,{cause:Z0.reason});({promise:x,resolve:l}=v()),yield p}}(),{signal:Z0}),write(F0,p,W0){let y=l;l=null,y({chunk:F0,done:!1,cb:W0})},final(F0){let p=l;l=null,p({done:!0,cb:F0})},destroy(F0,p){$0.abort(),p(F0)}}}function c(h){let x=h.readable&&typeof h.readable.read!=="function"?N.wrap(h.readable):h.readable,l=h.writable,$0=!!J(x),Z0=!!Z(l),F0,p,W0,y,i;function U0(m){let V0=y;if(y=null,V0)V0(m);else if(m)i.destroy(m)}if(i=new P({readableObjectMode:!!(x!==null&&x!==void 0&&x.readableObjectMode),writableObjectMode:!!(l!==null&&l!==void 0&&l.writableObjectMode),readable:$0,writable:Z0}),Z0)M(l,(m)=>{if(Z0=!1,m)D(x,m);U0(m)}),i._write=function(m,V0,w0){if(l.write(m,V0))w0();else F0=w0},i._final=function(m){l.end(),p=m},l.on("drain",function(){if(F0){let m=F0;F0=null,m()}}),l.on("finish",function(){if(p){let m=p;p=null,m()}});if($0)M(x,(m)=>{if($0=!1,m)D(x,m);U0(m)}),x.on("readable",function(){if(W0){let m=W0;W0=null,m()}}),x.on("end",function(){i.push(null)}),i._read=function(){while(!0){let m=x.read();if(m===null){W0=i._read;return}if(!i.push(m))return}};return i._destroy=function(m,V0){if(!m&&y!==null)m=new k;if(W0=null,F0=null,p=null,y===null)V0(m);else y=V0,D(l,m),D(x,m)},i}}),c2=g0(($,q)=>{var{ObjectDefineProperties:Q,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:J,ObjectSetPrototypeOf:Z}=P0();q.exports=B;var G=f8(),W=n5();Z(B.prototype,G.prototype),Z(B,G);{let F=J(W.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:Q,Symbol:K}=P0();q.exports=B;var{ERR_METHOD_NOT_IMPLEMENTED:J}=a0().codes,Z=c2(),{getHighWaterMark:G}=v8();Q(B.prototype,Z.prototype),Q(B,Z);var W=K("kCallback");function B(w){if(!(this instanceof B))return new B(w);let F=w?G(this,w,"readableHighWaterMark",!0):null;if(F===0)w={...w,highWaterMark:null,readableHighWaterMark:F,writableHighWaterMark:w.writableHighWaterMark||0};if(Z.call(this,w),this._readableState.sync=!1,this[W]=null,w){if(typeof w.transform==="function")this._transform=w.transform;if(typeof w.flush==="function")this._flush=w.flush}this.on("prefinish",U)}function V(w){if(typeof this._flush==="function"&&!this.destroyed)this._flush((F,M)=>{if(F){if(w)w(F);else this.destroy(F);return}if(M!=null)this.push(M);if(this.push(null),w)w()});else if(this.push(null),w)w()}function U(){if(this._final!==V)V.call(this)}B.prototype._final=V,B.prototype._transform=function(w,F,M){throw new J("_transform()")},B.prototype._write=function(w,F,M){let k=this._readableState,f=this._writableState,L=k.length;this._transform(w,F,(D,z)=>{if(D){M(D);return}if(z!=null)this.push(z);if(f.ended||L===k.length||k.length{var{ObjectSetPrototypeOf:Q}=P0();q.exports=J;var K=l9();Q(J.prototype,K.prototype),Q(J,K);function J(Z){if(!(this instanceof J))return new J(Z);K.call(this,Z)}J.prototype._transform=function(Z,G,W){W(null,Z)}}),d5=g0(($,q)=>{var Q=D1(),{ArrayIsArray:K,Promise:J,SymbolAsyncIterator:Z,SymbolDispose:G}=P0(),W=s2(),{once:B}=e0(),V=o1(),U=c2(),{aggregateTwoErrors:w,codes:{ERR_INVALID_ARG_TYPE:F,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:k,ERR_STREAM_DESTROYED:f,ERR_STREAM_PREMATURE_CLOSE:L},AbortError:D}=a0(),{validateFunction:z,validateAbortSignal:N}=P6(),{isIterable:H,isReadable:v,isReadableNodeStream:j,isNodeStream:n,isTransformStream:d,isWebStream:_,isReadableStream:X,isReadableFinished:P}=b2(),g=globalThis.AbortController||O6().AbortController,c,h,x;function l(m,V0,w0){let S=!1;m.on("close",()=>{S=!0});let b=W(m,{readable:V0,writable:w0},(O)=>{S=!O});return{destroy:(O)=>{if(S)return;S=!0,V.destroyer(m,O||new f("pipe"))},cleanup:b}}function $0(m){return z(m[m.length-1],"streams[stream.length - 1]"),m.pop()}function Z0(m){if(H(m))return m;else if(j(m))return F0(m);throw new F("val",["Readable","Iterable","AsyncIterable"],m)}async function*F0(m){if(!h)h=f8();yield*h.prototype[Z].call(m)}async function p(m,V0,w0,{end:S}){let b,O=null,E=(R)=>{if(R)b=R;if(O){let Y=O;O=null,Y()}},a=()=>new J((R,Y)=>{if(b)Y(b);else O=()=>{if(b)Y(b);else R()}});V0.on("drain",E);let K0=W(V0,{readable:!1},E);try{if(V0.writableNeedDrain)await a();for await(let R of m)if(!V0.write(R))await a();if(S)V0.end(),await a();w0()}catch(R){w0(b!==R?w(b,R):R)}finally{K0(),V0.off("drain",E)}}async function W0(m,V0,w0,{end:S}){if(d(V0))V0=V0.writable;let b=V0.getWriter();try{for await(let O of m)await b.ready,b.write(O).catch(()=>{});if(await b.ready,S)await b.close();w0()}catch(O){try{await b.abort(O),w0(O)}catch(E){w0(E)}}}function y(...m){return i(m,B($0(m)))}function i(m,V0,w0){if(m.length===1&&K(m[0]))m=m[0];if(m.length<2)throw new k("streams");let S=new g,b=S.signal,O=w0===null||w0===void 0?void 0:w0.signal,E=[];N(O,"options.signal");function a(){r(new D)}x=x||e0().addAbortListener;let K0;if(O)K0=x(O,a);let R,Y,C=[],u=0;function e(Q0){r(Q0,--u===0)}function r(Q0,M0){var I0;if(Q0&&(!R||R.code==="ERR_STREAM_PREMATURE_CLOSE"))R=Q0;if(!R&&!M0)return;while(C.length)C.shift()(R);if((I0=K0)===null||I0===void 0||I0[G](),S.abort(),M0){if(!R)E.forEach((m0)=>m0());Q.nextTick(V0,R,Y)}}let s;for(let Q0=0;Q00,p0=I0||(w0===null||w0===void 0?void 0:w0.end)!==!1,q2=Q0===m.length-1;if(n(M0)){let O0=function(u0){if(u0&&u0.name!=="AbortError"&&u0.code!=="ERR_STREAM_PREMATURE_CLOSE")e(u0)};var T=O0;if(p0){let{destroy:u0,cleanup:E1}=l(M0,I0,m0);if(C.push(u0),v(M0)&&q2)E.push(E1)}if(M0.on("error",O0),v(M0)&&q2)E.push(()=>{M0.removeListener("error",O0)})}if(Q0===0)if(typeof M0==="function"){if(s=M0({signal:b}),!H(s))throw new M("Iterable, AsyncIterable or Stream","source",s)}else if(H(M0)||j(M0)||d(M0))s=M0;else s=U.from(M0);else if(typeof M0==="function"){if(d(s)){var t;s=Z0((t=s)===null||t===void 0?void 0:t.readable)}else s=Z0(s);if(s=M0(s,{signal:b}),I0){if(!H(s,!0))throw new M("AsyncIterable",`transform[${Q0-1}]`,s)}else{var G0;if(!c)c=r9();let O0=new c({objectMode:!0}),u0=(G0=s)===null||G0===void 0?void 0:G0.then;if(typeof u0==="function")u++,u0.call(s,(R2)=>{if(Y=R2,R2!=null)O0.write(R2);if(p0)O0.end();Q.nextTick(e)},(R2)=>{O0.destroy(R2),Q.nextTick(e,R2)});else if(H(s,!0))u++,p(s,O0,e,{end:p0});else if(X(s)||d(s)){let R2=s.readable||s;u++,p(R2,O0,e,{end:p0})}else throw new M("AsyncIterable or Promise","destination",s);s=O0;let{destroy:E1,cleanup:_1}=l(s,!1,!0);if(C.push(E1),q2)E.push(_1)}}else if(n(M0)){if(j(s)){u+=2;let O0=U0(s,M0,e,{end:p0});if(v(M0)&&q2)E.push(O0)}else if(d(s)||X(s)){let O0=s.readable||s;u++,p(O0,M0,e,{end:p0})}else if(H(s))u++,p(s,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else if(_(M0)){if(j(s))u++,W0(Z0(s),M0,e,{end:p0});else if(X(s)||H(s))u++,W0(s,M0,e,{end:p0});else if(d(s))u++,W0(s.readable,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else s=U.from(M0)}if(b!==null&&b!==void 0&&b.aborted||O!==null&&O!==void 0&&O.aborted)Q.nextTick(a);return s}function U0(m,V0,w0,{end:S}){let b=!1;if(V0.on("close",()=>{if(!b)w0(new L)}),m.pipe(V0,{end:!1}),S){let E=function(){b=!0,V0.end()};var O=E;if(P(m))Q.nextTick(E);else m.once("end",E)}else w0();return W(m,{readable:!0,writable:!1},(E)=>{let a=m._readableState;if(E&&E.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted)m.once("end",w0).once("error",w0);else w0(E)}),W(V0,{readable:!1,writable:!0},w0)}q.exports={pipelineImpl:i,pipeline:y}}),s9=g0(($,q)=>{var{pipeline:Q}=d5(),K=c2(),{destroyer:J}=o1(),{isNodeStream:Z,isReadable:G,isWritable:W,isWebStream:B,isTransformStream:V,isWritableStream:U,isReadableStream:w}=b2(),{AbortError:F,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:k}}=a0(),f=s2();q.exports=function(...L){if(L.length===0)throw new k("streams");if(L.length===1)return K.from(L[0]);let D=[...L];if(typeof L[0]==="function")L[0]=K.from(L[0]);if(typeof L[L.length-1]==="function"){let g=L.length-1;L[g]=K.from(L[g])}for(let g=0;g0&&!(W(L[g])||U(L[g])||V(L[g])))throw new M(`streams[${g}]`,D[g],"must be writable")}let z,N,H,v,j;function n(g){let c=v;if(v=null,c)c(g);else if(g)j.destroy(g);else if(!P&&!X)j.destroy()}let d=L[0],_=Q(L,n),X=!!(W(d)||U(d)||V(d)),P=!!(G(_)||w(_)||V(_));if(j=new K({writableObjectMode:!!(d!==null&&d!==void 0&&d.writableObjectMode),readableObjectMode:!!(_!==null&&_!==void 0&&_.readableObjectMode),writable:X,readable:P}),X){if(Z(d))j._write=function(c,h,x){if(d.write(c,h))x();else z=x},j._final=function(c){d.end(),N=c},d.on("drain",function(){if(z){let c=z;z=null,c()}});else if(B(d)){let c=(V(d)?d.writable:d).getWriter();j._write=async function(h,x,l){try{await c.ready,c.write(h).catch(()=>{}),l()}catch($0){l($0)}},j._final=async function(h){try{await c.ready,c.close().catch(()=>{}),N=h}catch(x){h(x)}}}let g=V(_)?_.readable:_;f(g,()=>{if(N){let c=N;N=null,c()}})}if(P){if(Z(_))_.on("readable",function(){if(H){let g=H;H=null,g()}}),_.on("end",function(){j.push(null)}),j._read=function(){while(!0){let g=_.read();if(g===null){H=j._read;return}if(!j.push(g))return}};else if(B(_)){let g=(V(_)?_.readable:_).getReader();j._read=async function(){while(!0)try{let{value:c,done:h}=await g.read();if(!j.push(c))return;if(h){j.push(null);return}}catch{return}}}}return j._destroy=function(g,c){if(!g&&v!==null)g=new F;if(H=null,z=null,N=null,v===null)c(g);else if(v=c,Z(_))J(_,g)},j}}),hV=g0(($,q)=>{var Q=globalThis.AbortController||O6().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:J,ERR_MISSING_ARGS:Z,ERR_OUT_OF_RANGE:G},AbortError:W}=a0(),{validateAbortSignal:B,validateInteger:V,validateObject:U}=P6(),w=P0().Symbol("kWeak"),F=P0().Symbol("kResistStopPropagation"),{finished:M}=s2(),k=s9(),{addAbortSignalNoValidate:f}=H8(),{isWritable:L,isNodeStream:D}=b2(),{deprecate:z}=e0(),{ArrayPrototypePush:N,Boolean:H,MathFloor:v,Number:j,NumberIsNaN:n,Promise:d,PromiseReject:_,PromiseResolve:X,PromisePrototypeThen:P,Symbol:g}=P0(),c=g("kEmpty"),h=g("kEof");function x(O,E){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");if(D(O)&&!L(O))throw new K("stream",O,"must be writable");let a=k(this,O);if(E!==null&&E!==void 0&&E.signal)f(E.signal,a);return a}function l(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");let a=1;if((E===null||E===void 0?void 0:E.concurrency)!=null)a=v(E.concurrency);let K0=a-1;if((E===null||E===void 0?void 0:E.highWaterMark)!=null)K0=v(E.highWaterMark);return V(a,"options.concurrency",1),V(K0,"options.highWaterMark",0),K0+=a,async function*(){let R=e0().AbortSignalAny([E===null||E===void 0?void 0:E.signal].filter(H)),Y=this,C=[],u={signal:R},e,r,s=!1,T=0;function t(){s=!0,G0()}function G0(){T-=1,Q0()}function Q0(){if(r&&!s&&T=K0||T>=a))await new d((m0)=>{r=m0})}C.push(h)}catch(I0){let m0=_(I0);P(m0,G0,t),C.push(m0)}finally{if(s=!0,e)e(),e=null}}M0();try{while(!0){while(C.length>0){let I0=await C[0];if(I0===h)return;if(R.aborted)throw new W;if(I0!==c)yield I0;C.shift(),Q0()}await new d((I0)=>{e=I0})}}finally{if(s=!0,r)r(),r=null}}.call(this)}function $0(O=void 0){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");return async function*(){let E=0;for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W({cause:O.signal.reason});yield[E++,K0]}}.call(this)}async function Z0(O,E=void 0){for await(let a of y.call(this,O,E))return!0;return!1}async function F0(O,E=void 0){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);return!await Z0.call(this,async(...a)=>{return!await O(...a)},E)}async function p(O,E){for await(let a of y.call(this,O,E))return a;return}async function W0(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){return await O(K0,R),c}for await(let K0 of l.call(this,a,E));}function y(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){if(await O(K0,R))return K0;return c}return l.call(this,a,E)}class i extends Z{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function U0(O,E,a){var K0;if(typeof O!=="function")throw new J("reducer",["Function","AsyncFunction"],O);if(a!=null)U(a,"options");if((a===null||a===void 0?void 0:a.signal)!=null)B(a.signal,"options.signal");let R=arguments.length>1;if(a!==null&&a!==void 0&&(K0=a.signal)!==null&&K0!==void 0&&K0.aborted){let r=new W(void 0,{cause:a.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(r)),r}let Y=new Q,C=Y.signal;if(a!==null&&a!==void 0&&a.signal){let r={once:!0,[w]:this,[F]:!0};a.signal.addEventListener("abort",()=>Y.abort(),r)}let u=!1;try{for await(let r of this){var e;if(u=!0,a!==null&&a!==void 0&&(e=a.signal)!==null&&e!==void 0&&e.aborted)throw new W;if(!R)E=r,R=!0;else E=await O(E,r,{signal:C})}if(!u&&!R)throw new i}finally{Y.abort()}return E}async function m(O){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");let E=[];for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W(void 0,{cause:O.signal.reason});N(E,K0)}return E}function V0(O,E){let a=l.call(this,O,E);return async function*(){for await(let K0 of a)yield*K0}.call(this)}function w0(O){if(O=j(O),n(O))return 0;if(O<0)throw new G("number",">= 0",O);return O}function S(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O--<=0)yield R}}.call(this)}function b(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O-- >0)yield R;if(O<=0)return}}.call(this)}q.exports.streamReturningOperators={asIndexedPairs:z($0,"readable.asIndexedPairs will be removed in a future version."),drop:S,filter:y,flatMap:V0,map:l,take:b,compose:x},q.exports.promiseReturningOperators={every:F0,forEach:W0,reduce:U0,toArray:m,some:Z0,find:p}}),t9=g0(($,q)=>{var{ArrayPrototypePop:Q,Promise:K}=P0(),{isIterable:J,isNodeStream:Z,isWebStream:G}=b2(),{pipelineImpl:W}=d5(),{finished:B}=s2();e9();function V(...U){return new K((w,F)=>{let M,k,f=U[U.length-1];if(f&&typeof f==="object"&&!Z(f)&&!J(f)&&!G(f)){let L=Q(U);M=L.signal,k=L.end}W(U,(L,D)=>{if(L)F(L);else w(D)},{signal:M,end:k})})}q.exports={finished:B,pipeline:V}}),e9=g0(($,q)=>{var{Buffer:Q}=(t0(),X0(K2)),{ObjectDefineProperty:K,ObjectKeys:J,ReflectApply:Z}=P0(),{promisify:{custom:G}}=e0(),{streamReturningOperators:W,promiseReturningOperators:B}=hV(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:V}}=a0(),U=s9(),{setDefaultHighWaterMark:w,getDefaultHighWaterMark:F}=v8(),{pipeline:M}=d5(),{destroyer:k}=o1(),f=s2(),L=t9(),D=b2(),z=q.exports=b5().Stream;z.isDestroyed=D.isDestroyed,z.isDisturbed=D.isDisturbed,z.isErrored=D.isErrored,z.isReadable=D.isReadable,z.isWritable=D.isWritable,z.Readable=f8();for(let H of J(W)){let v=function(...n){if(new.target)throw V();return z.Readable.from(Z(j,this,n))},j=W[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(let H of J(B)){let v=function(...n){if(new.target)throw V();return Z(j,this,n)},j=B[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}z.Writable=n5(),z.Duplex=c2(),z.Transform=l9(),z.PassThrough=r9(),z.pipeline=M;var{addAbortSignal:N}=H8();z.addAbortSignal=N,z.finished=f,z.destroy=k,z.compose=U,z.setDefaultHighWaterMark=w,z.getDefaultHighWaterMark=F,K(z,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return L}}),K(M,G,{__proto__:null,enumerable:!0,get(){return L.pipeline}}),K(f,G,{__proto__:null,enumerable:!0,get(){return L.finished}}),z.Stream=z,z._isUint8Array=function(H){return H instanceof Uint8Array},z._uint8ArrayToBuffer=function(H){return Q.from(H.buffer,H.byteOffset,H.byteLength)}}),xV=g0(($,q)=>{var Q=a1();{let K=e9(),J=t9(),Z=K.Readable.destroy;q.exports=K.Readable,q.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,q.exports._isUint8Array=K._isUint8Array,q.exports.isDisturbed=K.isDisturbed,q.exports.isErrored=K.isErrored,q.exports.isReadable=K.isReadable,q.exports.Readable=K.Readable,q.exports.Writable=K.Writable,q.exports.Duplex=K.Duplex,q.exports.Transform=K.Transform,q.exports.PassThrough=K.PassThrough,q.exports.addAbortSignal=K.addAbortSignal,q.exports.finished=K.finished,q.exports.destroy=K.destroy,q.exports.destroy=Z,q.exports.pipeline=K.pipeline,q.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return J}}),q.exports.Stream=K.Stream}q.exports.default=q.exports});$$.exports=xV()});var m5=N0((Fz,Q$)=>{Q$.exports=a1()});var n2=N0((J2)=>{J2.base64=!0;J2.array=!0;J2.string=!0;J2.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";J2.nodebuffer=typeof Buffer<"u";J2.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")J2.blob=!1;else{R8=new ArrayBuffer(0);try{J2.blob=new Blob([R8],{type:"application/zip"}).size===0}catch($){try{p5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,I8=new p5,I8.append(R8),J2.blob=I8.getBlob("application/zip").size===0}catch(q){J2.blob=!1}}}var R8,p5,I8;try{J2.nodestream=!!m5().Readable}catch($){J2.nodestream=!1}});var o5=N0((i5)=>{var OV=T0(),PV=n2(),A2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i5.encode=function($){var q=[],Q,K,J,Z,G,W,B,V=0,U=$.length,w=U,F=OV.getTypeOf($)!=="string";while(V<$.length){if(w=U-V,!F)Q=$.charCodeAt(V++),K=V>2,G=(Q&3)<<4|K>>4,W=w>1?(K&15)<<2|J>>6:64,B=w>2?J&63:64,q.push(A2.charAt(Z)+A2.charAt(G)+A2.charAt(W)+A2.charAt(B))}return q.join("")};i5.decode=function($){var q,Q,K,J,Z,G,W,B=0,V=0,U="data:";if($.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var w=$.length*3/4;if($.charAt($.length-1)===A2.charAt(64))w--;if($.charAt($.length-2)===A2.charAt(64))w--;if(w%1!==0)throw Error("Invalid base64 input, bad content length.");var F;if(PV.uint8array)F=new Uint8Array(w|0);else F=Array(w|0);while(B<$.length){if(J=A2.indexOf($.charAt(B++)),Z=A2.indexOf($.charAt(B++)),G=A2.indexOf($.charAt(B++)),W=A2.indexOf($.charAt(B++)),q=J<<2|Z>>4,Q=(Z&15)<<4|G>>2,K=(G&3)<<6|W,F[V++]=q,G!==64)F[V++]=Q;if(W!==64)F[V++]=K}return F}});var T6=N0((Nz,q$)=>{q$.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var q=new Buffer($);return q.fill(0),q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var V$=N0((Yz,J$)=>{var K$=global.MutationObserver||global.WebKitMutationObserver,u6;if(K$)j8=0,a5=new K$(C8),g8=global.document.createTextNode(""),a5.observe(g8,{characterData:!0}),u6=function(){g8.data=j8=++j8%2};else if(!global.setImmediate&&typeof global.MessageChannel<"u")A8=new global.MessageChannel,A8.port1.onmessage=C8,u6=function(){A8.port2.postMessage(0)};else if("document"in global&&"onreadystatechange"in global.document.createElement("script"))u6=function(){var $=global.document.createElement("script");$.onreadystatechange=function(){C8(),$.onreadystatechange=null,$.parentNode.removeChild($),$=null},global.document.documentElement.appendChild($)};else u6=function(){setTimeout(C8,0)};var j8,a5,g8,A8,l5,S6=[];function C8(){l5=!0;var $,q,Q=S6.length;while(Q){q=S6,S6=[],$=-1;while(++${var uV=V$();function l1(){}var o0={},U$=["REJECTED"],r5=["FULFILLED"],Z$=["PENDING"];B$.exports=t2;function t2($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Z$,this.queue=[],this.outcome=void 0,$!==l1)G$(this,$)}t2.prototype.finally=function($){if(typeof $!=="function")return this;var q=this.constructor;return this.then(Q,K);function Q(J){function Z(){return J}return q.resolve($()).then(Z)}function K(J){function Z(){throw J}return q.resolve($()).then(Z)}};t2.prototype.catch=function($){return this.then(null,$)};t2.prototype.then=function($,q){if(typeof $!=="function"&&this.state===r5||typeof q!=="function"&&this.state===U$)return this;var Q=new this.constructor(l1);if(this.state!==Z$){var K=this.state===r5?$:q;s5(Q,K,this.outcome)}else this.queue.push(new E6(Q,$,q));return Q};function E6($,q,Q){if(this.promise=$,typeof q==="function")this.onFulfilled=q,this.callFulfilled=this.otherCallFulfilled;if(typeof Q==="function")this.onRejected=Q,this.callRejected=this.otherCallRejected}E6.prototype.callFulfilled=function($){o0.resolve(this.promise,$)};E6.prototype.otherCallFulfilled=function($){s5(this.promise,this.onFulfilled,$)};E6.prototype.callRejected=function($){o0.reject(this.promise,$)};E6.prototype.otherCallRejected=function($){s5(this.promise,this.onRejected,$)};function s5($,q,Q){uV(function(){var K;try{K=q(Q)}catch(J){return o0.reject($,J)}if(K===$)o0.reject($,TypeError("Cannot resolve promise with itself"));else o0.resolve($,K)})}o0.resolve=function($,q){var Q=W$(SV,q);if(Q.status==="error")return o0.reject($,Q.value);var K=Q.value;if(K)G$($,K);else{$.state=r5,$.outcome=q;var J=-1,Z=$.queue.length;while(++J{var t5=null;if(typeof Promise<"u")t5=Promise;else t5=z$();F$.exports={Promise:t5}});var w$=N0((M$)=>{(function($,q){if($.setImmediate)return;var Q=1,K={},J=!1,Z=$.document,G;function W(z){if(typeof z!=="function")z=Function(""+z);var N=Array(arguments.length-1);for(var H=0;H"u"?typeof global>"u"?M$:global:self)});var T0=N0((_0)=>{var e2=n2(),nV=o5(),s1=T6(),e5=r1();w$();function dV($){var q=null;if(e2.uint8array)q=new Uint8Array($.length);else q=Array($.length);return y8($,q)}_0.newBlob=function($,q){_0.checkSupport("blob");try{return new Blob([$],{type:q})}catch(J){try{var Q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,K=new Q;return K.append($),K.getBlob(q)}catch(Z){throw Error("Bug : can't construct the Blob.")}}};function _6($){return $}function y8($,q){for(var Q=0;Q<$.length;++Q)q[Q]=$.charCodeAt(Q)&255;return q}var X8={stringifyByChunk:function($,q,Q){var K=[],J=0,Z=$.length;if(Z<=Q)return String.fromCharCode.apply(null,$);while(J1)try{return X8.stringifyByChunk($,Q,q)}catch(J){q=Math.floor(q/2)}return X8.stringifyByChar($)}_0.applyFromCharCode=c6;function h8($,q){for(var Q=0;Q<$.length;Q++)q[Q]=$[Q];return q}var $1={};$1.string={string:_6,array:function($){return y8($,Array($.length))},arraybuffer:function($){return $1.string.uint8array($).buffer},uint8array:function($){return y8($,new Uint8Array($.length))},nodebuffer:function($){return y8($,s1.allocBuffer($.length))}};$1.array={string:c6,array:_6,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom($)}};$1.arraybuffer={string:function($){return c6(new Uint8Array($))},array:function($){return h8(new Uint8Array($),Array($.byteLength))},arraybuffer:_6,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom(new Uint8Array($))}};$1.uint8array={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:_6,nodebuffer:function($){return s1.newBufferFrom($)}};$1.nodebuffer={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $1.nodebuffer.uint8array($).buffer},uint8array:function($){return h8($,new Uint8Array($.length))},nodebuffer:_6};_0.transformTo=function($,q){if(!q)q="";if(!$)return q;_0.checkSupport($);var Q=_0.getTypeOf(q),K=$1[Q][$](q);return K};_0.resolve=function($){var q=$.split("/"),Q=[];for(var K=0;K"u")$[Q]=arguments[q][Q];return $};_0.prepareContent=function($,q,Q,K,J){var Z=e5.Promise.resolve(q).then(function(G){var W=e2.blob&&(G instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(G))!==-1);if(W&&typeof FileReader<"u")return new e5.Promise(function(B,V){var U=new FileReader;U.onload=function(w){B(w.target.result)},U.onerror=function(w){V(w.target.error)},U.readAsArrayBuffer(G)});else return G});return Z.then(function(G){var W=_0.getTypeOf(G);if(!W)return e5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(W==="arraybuffer")G=_0.transformTo("uint8array",G);else if(W==="string"){if(J)G=nV.decode(G);else if(Q){if(K!==!0)G=dV(G)}}return G})}});var V2=N0((vz,Y$)=>{function N$($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}N$.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,q){return this._listeners[$].push(q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,q){if(this._listeners[$])for(var Q=0;Q "+$;else return $}};Y$.exports=N$});var e1=N0((Q1)=>{var t1=T0(),L1=n2(),mV=T6(),x8=V2(),b6=Array(256);for(X2=0;X2<256;X2++)b6[X2]=X2>=252?6:X2>=248?5:X2>=240?4:X2>=224?3:X2>=192?2:1;var X2;b6[254]=b6[254]=1;var pV=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q},iV=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+b6[$[Q]]>q?Q:q},oV=function($){var q,Q,K,J,Z=$.length,G=Array(Z*2);for(Q=0,q=0;q4){G[Q++]=65533,q+=J-1;continue}K&=J===2?31:J===3?15:7;while(J>1&&q1){G[Q++]=65533;continue}if(K<65536)G[Q++]=K;else K-=65536,G[Q++]=55296|K>>10&1023,G[Q++]=56320|K&1023}if(G.length!==Q)if(G.subarray)G=G.subarray(0,Q);else G.length=Q;return t1.applyFromCharCode(G)};Q1.utf8encode=function(q){if(L1.nodebuffer)return mV.newBufferFrom(q,"utf-8");return pV(q)};Q1.utf8decode=function(q){if(L1.nodebuffer)return t1.transformTo("nodebuffer",q).toString("utf-8");return q=t1.transformTo(L1.uint8array?"uint8array":"array",q),oV(q)};function O8(){x8.call(this,"utf-8 decode"),this.leftOver=null}t1.inherits(O8,x8);O8.prototype.processChunk=function($){var q=t1.transformTo(L1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(L1.uint8array){var Q=q;q=new Uint8Array(Q.length+this.leftOver.length),q.set(this.leftOver,0),q.set(Q,this.leftOver.length)}else q=this.leftOver.concat(q);this.leftOver=null}var K=iV(q),J=q;if(K!==q.length)if(L1.uint8array)J=q.subarray(0,K),this.leftOver=q.subarray(K,q.length);else J=q.slice(0,K),this.leftOver=q.slice(K,q.length);this.push({data:Q1.utf8decode(J),meta:$.meta})};O8.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:Q1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};Q1.Utf8DecodeWorker=O8;function $4(){x8.call(this,"utf-8 encode")}t1.inherits($4,x8);$4.prototype.processChunk=function($){this.push({data:Q1.utf8encode($.data),meta:$.meta})};Q1.Utf8EncodeWorker=$4});var H$=N0((Rz,L$)=>{var k$=V2(),D$=T0();function Q4($){k$.call(this,"ConvertWorker to "+$),this.destType=$}D$.inherits(Q4,k$);Q4.prototype.processChunk=function($){this.push({data:D$.transformTo(this.destType,$.data),meta:$.meta})};L$.exports=Q4});var R$=N0((Iz,f$)=>{var v$=m5().Readable,aV=T0();aV.inherits(q4,v$);function q4($,q,Q){v$.call(this,q),this._helper=$;var K=this;$.on("data",function(J,Z){if(!K.push(J))K._helper.pause();if(Q)Q(Z)}).on("error",function(J){K.emit("error",J)}).on("end",function(){K.push(null)})}q4.prototype._read=function(){this._helper.resume()};f$.exports=q4});var K4=N0((Cz,j$)=>{var H1=T0(),lV=H$(),rV=V2(),sV=o5(),tV=n2(),eV=r1(),I$=null;if(tV.nodestream)try{I$=R$()}catch($){}function $U($,q,Q){switch($){case"blob":return H1.newBlob(H1.transformTo("arraybuffer",q),Q);case"base64":return sV.encode(q);default:return H1.transformTo($,q)}}function QU($,q){var Q,K=0,J=null,Z=0;for(Q=0;Q{D2.base64=!1;D2.binary=!1;D2.dir=!1;D2.createFolders=!0;D2.date=null;D2.compression=null;D2.compressionOptions=null;D2.comment=null;D2.unixPermissions=null;D2.dosPermissions=null});var V4=N0((gz,g$)=>{var P8=T0(),T8=V2(),KU=16384;function $6($){T8.call(this,"DataWorker");var q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(Q){if(q.dataIsReady=!0,q.data=Q,q.max=Q&&Q.length||0,q.type=P8.getTypeOf(Q),!q.isPaused)q._tickAndRepeat()},function(Q){q.error(Q)})}P8.inherits($6,T8);$6.prototype.cleanUp=function(){T8.prototype.cleanUp.call(this),this.data=null};$6.prototype.resume=function(){if(!T8.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,P8.delay(this._tickAndRepeat,[],this);return!0};$6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)P8.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};$6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=KU,q=null,Q=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":q=this.data.substring(this.index,Q);break;case"uint8array":q=this.data.subarray(this.index,Q);break;case"array":case"nodebuffer":q=this.data.slice(this.index,Q);break}return this.index=Q,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})}};g$.exports=$6});var u8=N0((Az,X$)=>{var JU=T0();function VU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var A$=VU();function UU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}function ZU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q.charCodeAt(G))&255];return $^-1}X$.exports=function(q,Q){if(typeof q>"u"||!q.length)return 0;var K=JU.getTypeOf(q)!=="string";if(K)return UU(Q|0,q,q.length,0);else return ZU(Q|0,q,q.length,0)}});var Z4=N0((Xz,h$)=>{var y$=V2(),GU=u8(),WU=T0();function U4(){y$.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}WU.inherits(U4,y$);U4.prototype.processChunk=function($){this.streamInfo.crc32=GU($.data,this.streamInfo.crc32||0),this.push($)};h$.exports=U4});var O$=N0((yz,x$)=>{var BU=T0(),G4=V2();function W4($){G4.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}BU.inherits(W4,G4);W4.prototype.processChunk=function($){if($){var q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=q+$.data.length}G4.prototype.processChunk.call(this,$)};x$.exports=W4});var S8=N0((hz,u$)=>{var P$=r1(),T$=V4(),zU=Z4(),B4=O$();function z4($,q,Q,K,J){this.compressedSize=$,this.uncompressedSize=q,this.crc32=Q,this.compression=K,this.compressedContent=J}z4.prototype={getContentWorker:function(){var $=new T$(P$.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new B4("data_length")),q=this;return $.on("end",function(){if(this.streamInfo.data_length!==q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new T$(P$.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};z4.createWorkerFrom=function($,q,Q){return $.pipe(new zU).pipe(new B4("uncompressedSize")).pipe(q.compressWorker(Q)).pipe(new B4("compressedSize")).withStreamInfo("compression",q)};u$.exports=z4});var c$=N0((xz,_$)=>{var FU=K4(),MU=V4(),F4=e1(),M4=S8(),S$=V2(),w4=function($,q,Q){this.name=$,this.dir=Q.dir,this.date=Q.date,this.comment=Q.comment,this.unixPermissions=Q.unixPermissions,this.dosPermissions=Q.dosPermissions,this._data=q,this._dataBinary=Q.binary,this.options={compression:Q.compression,compressionOptions:Q.compressionOptions}};w4.prototype={internalStream:function($){var q=null,Q="string";try{if(!$)throw Error("No output type specified.");Q=$.toLowerCase();var K=Q==="string"||Q==="text";if(Q==="binarystring"||Q==="text")Q="string";q=this._decompressWorker();var J=!this._dataBinary;if(J&&!K)q=q.pipe(new F4.Utf8EncodeWorker);if(!J&&K)q=q.pipe(new F4.Utf8DecodeWorker)}catch(Z){q=new S$("error"),q.error(Z)}return new FU(q,Q,"")},async:function($,q){return this.internalStream($).accumulate(q)},nodeStream:function($,q){return this.internalStream($||"nodebuffer").toNodejsStream(q)},_compressWorker:function($,q){if(this._data instanceof M4&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var Q=this._decompressWorker();if(!this._dataBinary)Q=Q.pipe(new F4.Utf8EncodeWorker);return M4.createWorkerFrom(Q,$,q)}},_decompressWorker:function(){if(this._data instanceof M4)return this._data.getContentWorker();else if(this._data instanceof S$)return this._data;else return new MU(this._data)}};var E$=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],wU=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(n6=0;n6{var NU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function YU($,q){return Object.prototype.hasOwnProperty.call($,q)}l0.assign=function($){var q=Array.prototype.slice.call(arguments,1);while(q.length){var Q=q.shift();if(!Q)continue;if(typeof Q!=="object")throw TypeError(Q+"must be non-object");for(var K in Q)if(YU(Q,K))$[K]=Q[K]}return $};l0.shrinkBuf=function($,q){if($.length===q)return $;if($.subarray)return $.subarray(0,q);return $.length=q,$};var kU={arraySet:function($,q,Q,K,J){if(q.subarray&&$.subarray){$.set(q.subarray(Q,Q+K),J);return}for(var Z=0;Z{var LU=d2(),HU=4,b$=0,n$=1,vU=2;function q6($){var q=$.length;while(--q>=0)$[q]=0}var fU=0,a$=1,RU=2,IU=3,CU=258,v4=29,a6=256,m6=a6+1+v4,Q6=30,f4=19,l$=2*m6+1,v1=15,N4=16,jU=7,R4=256,r$=16,s$=17,t$=18,L4=[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],E8=[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],gU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],AU=512,m2=Array((m6+2)*2);q6(m2);var d6=Array(Q6*2);q6(d6);var p6=Array(AU);q6(p6);var i6=Array(CU-IU+1);q6(i6);var I4=Array(v4);q6(I4);var _8=Array(Q6);q6(_8);function Y4($,q,Q,K,J){this.static_tree=$,this.extra_bits=q,this.extra_base=Q,this.elems=K,this.max_length=J,this.has_stree=$&&$.length}var $Q,QQ,qQ;function k4($,q){this.dyn_tree=$,this.max_code=0,this.stat_desc=q}function KQ($){return $<256?p6[$]:p6[256+($>>>7)]}function o6($,q){$.pending_buf[$.pending++]=q&255,$.pending_buf[$.pending++]=q>>>8&255}function $2($,q,Q){if($.bi_valid>N4-Q)$.bi_buf|=q<<$.bi_valid&65535,o6($,$.bi_buf),$.bi_buf=q>>N4-$.bi_valid,$.bi_valid+=Q-N4;else $.bi_buf|=q<<$.bi_valid&65535,$.bi_valid+=Q}function y2($,q,Q){$2($,Q[q*2],Q[q*2+1])}function JQ($,q){var Q=0;do Q|=$&1,$>>>=1,Q<<=1;while(--q>0);return Q>>>1}function XU($){if($.bi_valid===16)o6($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function yU($,q){var{dyn_tree:Q,max_code:K}=q,J=q.stat_desc.static_tree,Z=q.stat_desc.has_stree,G=q.stat_desc.extra_bits,W=q.stat_desc.extra_base,B=q.stat_desc.max_length,V,U,w,F,M,k,f=0;for(F=0;F<=v1;F++)$.bl_count[F]=0;Q[$.heap[$.heap_max]*2+1]=0;for(V=$.heap_max+1;VB)F=B,f++;if(Q[U*2+1]=F,U>K)continue;if($.bl_count[F]++,M=0,U>=W)M=G[U-W];if(k=Q[U*2],$.opt_len+=k*(F+M),Z)$.static_len+=k*(J[U*2+1]+M)}if(f===0)return;do{F=B-1;while($.bl_count[F]===0)F--;$.bl_count[F]--,$.bl_count[F+1]+=2,$.bl_count[B]--,f-=2}while(f>0);for(F=B;F!==0;F--){U=$.bl_count[F];while(U!==0){if(w=$.heap[--V],w>K)continue;if(Q[w*2+1]!==F)$.opt_len+=(F-Q[w*2+1])*Q[w*2],Q[w*2+1]=F;U--}}}function VQ($,q,Q){var K=Array(v1+1),J=0,Z,G;for(Z=1;Z<=v1;Z++)K[Z]=J=J+Q[Z-1]<<1;for(G=0;G<=q;G++){var W=$[G*2+1];if(W===0)continue;$[G*2]=JQ(K[W]++,W)}}function hU(){var $,q,Q,K,J,Z=Array(v1+1);Q=0;for(K=0;K>=7;for(;K8)o6($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function xU($,q,Q,K){if(ZQ($),K)o6($,Q),o6($,~Q);LU.arraySet($.pending_buf,$.window,q,Q,$.pending),$.pending+=Q}function d$($,q,Q,K){var J=q*2,Z=Q*2;return $[J]<$[Z]||$[J]===$[Z]&&K[q]<=K[Q]}function D4($,q,Q){var K=$.heap[Q],J=Q<<1;while(J<=$.heap_len){if(J<$.heap_len&&d$(q,$.heap[J+1],$.heap[J],$.depth))J++;if(d$(q,K,$.heap[J],$.depth))break;$.heap[Q]=$.heap[J],Q=J,J<<=1}$.heap[Q]=K}function m$($,q,Q){var K,J,Z=0,G,W;if($.last_lit!==0)do if(K=$.pending_buf[$.d_buf+Z*2]<<8|$.pending_buf[$.d_buf+Z*2+1],J=$.pending_buf[$.l_buf+Z],Z++,K===0)y2($,J,q);else{if(G=i6[J],y2($,G+a6+1,q),W=L4[G],W!==0)J-=I4[G],$2($,J,W);if(K--,G=KQ(K),y2($,G,Q),W=E8[G],W!==0)K-=_8[G],$2($,K,W)}while(Z<$.last_lit);y2($,R4,q)}function H4($,q){var Q=q.dyn_tree,K=q.stat_desc.static_tree,J=q.stat_desc.has_stree,Z=q.stat_desc.elems,G,W,B=-1,V;$.heap_len=0,$.heap_max=l$;for(G=0;G>1;G>=1;G--)D4($,Q,G);V=Z;do G=$.heap[1],$.heap[1]=$.heap[$.heap_len--],D4($,Q,1),W=$.heap[1],$.heap[--$.heap_max]=G,$.heap[--$.heap_max]=W,Q[V*2]=Q[G*2]+Q[W*2],$.depth[V]=($.depth[G]>=$.depth[W]?$.depth[G]:$.depth[W])+1,Q[G*2+1]=Q[W*2+1]=V,$.heap[1]=V++,D4($,Q,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],yU($,q),VQ(Q,B,$.bl_count)}function p$($,q,Q){var K,J=-1,Z,G=q[1],W=0,B=7,V=4;if(G===0)B=138,V=3;q[(Q+1)*2+1]=65535;for(K=0;K<=Q;K++){if(Z=G,G=q[(K+1)*2+1],++W=3;q--)if($.bl_tree[e$[q]*2+1]!==0)break;return $.opt_len+=3*(q+1)+5+5+4,q}function PU($,q,Q,K){var J;$2($,q-257,5),$2($,Q-1,5),$2($,K-4,4);for(J=0;J>>=1)if(q&1&&$.dyn_ltree[Q*2]!==0)return b$;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return n$;for(Q=32;Q0){if($.strm.data_type===vU)$.strm.data_type=TU($);if(H4($,$.l_desc),H4($,$.d_desc),G=OU($),J=$.opt_len+3+7>>>3,Z=$.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=Q+5;if(Q+4<=J&&q!==-1)GQ($,q,Q,K);else if($.strategy===HU||Z===J)$2($,(a$<<1)+(K?1:0),3),m$($,m2,d6);else $2($,(RU<<1)+(K?1:0),3),PU($,$.l_desc.max_code+1,$.d_desc.max_code+1,G+1),m$($,$.dyn_ltree,$.dyn_dtree);if(UQ($),K)ZQ($)}function _U($,q,Q){if($.pending_buf[$.d_buf+$.last_lit*2]=q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=q&255,$.pending_buf[$.l_buf+$.last_lit]=Q&255,$.last_lit++,q===0)$.dyn_ltree[Q*2]++;else $.matches++,q--,$.dyn_ltree[(i6[Q]+a6+1)*2]++,$.dyn_dtree[KQ(q)*2]++;return $.last_lit===$.lit_bufsize-1}K6._tr_init=uU;K6._tr_stored_block=GQ;K6._tr_flush_block=EU;K6._tr_tally=_U;K6._tr_align=SU});var C4=N0((Tz,BQ)=>{function cU($,q,Q,K){var J=$&65535|0,Z=$>>>16&65535|0,G=0;while(Q!==0){G=Q>2000?2000:Q,Q-=G;do J=J+q[K++]|0,Z=Z+J|0;while(--G);J%=65521,Z%=65521}return J|Z<<16|0}BQ.exports=cU});var j4=N0((uz,zQ)=>{function bU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var nU=bU();function dU($,q,Q,K){var J=nU,Z=K+Q;$^=-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}zQ.exports=dU});var c8=N0((Sz,FQ)=>{FQ.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var vQ=N0((O2)=>{var r0=d2(),M2=WQ(),YQ=C4(),q1=j4(),mU=c8(),C1=0,pU=1,iU=3,Z1=4,MQ=5,x2=0,wQ=1,w2=-2,oU=-3,g4=-5,aU=-1,lU=1,b8=2,rU=3,sU=4,tU=0,eU=2,p8=8,$Z=9,QZ=15,qZ=8,KZ=29,JZ=256,X4=JZ+1+KZ,VZ=30,UZ=19,ZZ=2*X4+1,GZ=15,f0=3,V1=258,L2=V1+f0+1,WZ=32,i8=42,y4=69,n8=73,d8=91,m8=103,f1=113,r6=666,c0=1,s6=2,R1=3,U6=4,BZ=3;function U1($,q){return $.msg=mU[q],q}function NQ($){return($<<1)-($>4?9:0)}function J1($){var q=$.length;while(--q>=0)$[q]=0}function K1($){var q=$.state,Q=q.pending;if(Q>$.avail_out)Q=$.avail_out;if(Q===0)return;if(r0.arraySet($.output,q.pending_buf,q.pending_out,Q,$.next_out),$.next_out+=Q,q.pending_out+=Q,$.total_out+=Q,$.avail_out-=Q,q.pending-=Q,q.pending===0)q.pending_out=0}function d0($,q){M2._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,q),$.block_start=$.strstart,K1($.strm)}function C0($,q){$.pending_buf[$.pending++]=q}function l6($,q){$.pending_buf[$.pending++]=q>>>8&255,$.pending_buf[$.pending++]=q&255}function zZ($,q,Q,K){var J=$.avail_in;if(J>K)J=K;if(J===0)return 0;if($.avail_in-=J,r0.arraySet(q,$.input,$.next_in,J,Q),$.state.wrap===1)$.adler=YQ($.adler,q,J,Q);else if($.state.wrap===2)$.adler=q1($.adler,q,J,Q);return $.next_in+=J,$.total_in+=J,J}function kQ($,q){var{max_chain_length:Q,strstart:K}=$,J,Z,G=$.prev_length,W=$.nice_match,B=$.strstart>$.w_size-L2?$.strstart-($.w_size-L2):0,V=$.window,U=$.w_mask,w=$.prev,F=$.strstart+V1,M=V[K+G-1],k=V[K+G];if($.prev_length>=$.good_match)Q>>=2;if(W>$.lookahead)W=$.lookahead;do{if(J=q,V[J+G]!==k||V[J+G-1]!==M||V[J]!==V[K]||V[++J]!==V[K+1])continue;K+=2,J++;do;while(V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&KG){if($.match_start=q,G=Z,Z>=W)break;M=V[K+G-1],k=V[K+G]}}while((q=w[q&U])>B&&--Q!==0);if(G<=$.lookahead)return G;return $.lookahead}function I1($){var q=$.w_size,Q,K,J,Z,G;do{if(Z=$.window_size-$.lookahead-$.strstart,$.strstart>=q+(q-L2)){r0.arraySet($.window,$.window,q,q,0),$.match_start-=q,$.strstart-=q,$.block_start-=q,K=$.hash_size,Q=K;do J=$.head[--Q],$.head[Q]=J>=q?J-q:0;while(--K);K=q,Q=K;do J=$.prev[--Q],$.prev[Q]=J>=q?J-q:0;while(--K);Z+=q}if($.strm.avail_in===0)break;if(K=zZ($.strm,$.window,$.strstart+$.lookahead,Z),$.lookahead+=K,$.lookahead+$.insert>=f0){G=$.strstart-$.insert,$.ins_h=$.window[G],$.ins_h=($.ins_h<<$.hash_shift^$.window[G+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[G+f0-1])&$.hash_mask,$.prev[G&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=G,G++,$.insert--,$.lookahead+$.insert$.pending_buf_size-5)Q=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(I1($),$.lookahead===0&&q===C1)return c0;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var K=$.block_start+Q;if($.strstart===0||$.strstart>=K){if($.lookahead=$.strstart-K,$.strstart=K,d0($,!1),$.strm.avail_out===0)return c0}if($.strstart-$.block_start>=$.w_size-L2){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.strstart>$.block_start){if(d0($,!1),$.strm.avail_out===0)return c0}return c0}function A4($,q){var Q,K;for(;;){if($.lookahead=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(Q!==0&&$.strstart-Q<=$.w_size-L2)$.match_length=kQ($,Q);if($.match_length>=f0)if(K=M2._tr_tally($,$.strstart-$.match_start,$.match_length-f0),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=f0){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else K=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(K){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=$.strstart=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=f0-1,Q!==0&&$.prev_length<$.max_lazy_match&&$.strstart-Q<=$.w_size-L2){if($.match_length=kQ($,Q),$.match_length<=5&&($.strategy===lU||$.match_length===f0&&$.strstart-$.match_start>4096))$.match_length=f0-1}if($.prev_length>=f0&&$.match_length<=$.prev_length){J=$.strstart+$.lookahead-f0,K=M2._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-f0),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=J)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=f0-1,$.strstart++,K){if(d0($,!1),$.strm.avail_out===0)return c0}}else if($.match_available){if(K=M2._tr_tally($,0,$.window[$.strstart-1]),K)d0($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return c0}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)K=M2._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart=f0&&$.strstart>0){if(J=$.strstart-1,K=G[J],K===G[++J]&&K===G[++J]&&K===G[++J]){Z=$.strstart+V1;do;while(K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&J$.lookahead)$.match_length=$.lookahead}}if($.match_length>=f0)Q=M2._tr_tally($,1,$.match_length-f0),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function wZ($,q){var Q;for(;;){if($.lookahead===0){if(I1($),$.lookahead===0){if(q===C1)return c0;break}}if($.match_length=0,Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function h2($,q,Q,K,J){this.good_length=$,this.max_lazy=q,this.nice_length=Q,this.max_chain=K,this.func=J}var V6;V6=[new h2(0,0,0,0,FZ),new h2(4,4,8,4,A4),new h2(4,5,16,8,A4),new h2(4,6,32,32,A4),new h2(4,4,16,16,J6),new h2(8,16,32,32,J6),new h2(8,16,128,128,J6),new h2(8,32,128,256,J6),new h2(32,128,258,1024,J6),new h2(32,258,258,4096,J6)];function NZ($){$.window_size=2*$.w_size,J1($.head),$.max_lazy_match=V6[$.level].max_lazy,$.good_match=V6[$.level].good_length,$.nice_match=V6[$.level].nice_length,$.max_chain_length=V6[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=f0-1,$.match_available=0,$.ins_h=0}function YZ(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=p8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r0.Buf16(ZZ*2),this.dyn_dtree=new r0.Buf16((2*VZ+1)*2),this.bl_tree=new r0.Buf16((2*UZ+1)*2),J1(this.dyn_ltree),J1(this.dyn_dtree),J1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r0.Buf16(GZ+1),this.heap=new r0.Buf16(2*X4+1),J1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r0.Buf16(2*X4+1),J1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function DQ($){var q;if(!$||!$.state)return U1($,w2);if($.total_in=$.total_out=0,$.data_type=eU,q=$.state,q.pending=0,q.pending_out=0,q.wrap<0)q.wrap=-q.wrap;return q.status=q.wrap?i8:f1,$.adler=q.wrap===2?0:1,q.last_flush=C1,M2._tr_init(q),x2}function LQ($){var q=DQ($);if(q===x2)NZ($.state);return q}function kZ($,q){if(!$||!$.state)return w2;if($.state.wrap!==2)return w2;return $.state.gzhead=q,x2}function HQ($,q,Q,K,J,Z){if(!$)return w2;var G=1;if(q===aU)q=6;if(K<0)G=0,K=-K;else if(K>15)G=2,K-=16;if(J<1||J>$Z||Q!==p8||K<8||K>15||q<0||q>9||Z<0||Z>sU)return U1($,w2);if(K===8)K=9;var W=new YZ;return $.state=W,W.strm=$,W.wrap=G,W.gzhead=null,W.w_bits=K,W.w_size=1<MQ||q<0)return $?U1($,w2):w2;if(K=$.state,!$.output||!$.input&&$.avail_in!==0||K.status===r6&&q!==Z1)return U1($,$.avail_out===0?g4:w2);if(K.strm=$,Q=K.last_flush,K.last_flush=q,K.status===i8)if(K.wrap===2)if($.adler=0,C0(K,31),C0(K,139),C0(K,8),!K.gzhead)C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,BZ),K.status=f1;else{if(C0(K,(K.gzhead.text?1:0)+(K.gzhead.hcrc?2:0)+(!K.gzhead.extra?0:4)+(!K.gzhead.name?0:8)+(!K.gzhead.comment?0:16)),C0(K,K.gzhead.time&255),C0(K,K.gzhead.time>>8&255),C0(K,K.gzhead.time>>16&255),C0(K,K.gzhead.time>>24&255),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)C0(K,K.gzhead.extra.length&255),C0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)$.adler=q1($.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=y4}else{var G=p8+(K.w_bits-8<<4)<<8,W=-1;if(K.strategy>=b8||K.level<2)W=0;else if(K.level<6)W=1;else if(K.level===6)W=2;else W=3;if(G|=W<<6,K.strstart!==0)G|=WZ;if(G+=31-G%31,K.status=f1,l6(K,G),K.strstart!==0)l6(K,$.adler>>>16),l6(K,$.adler&65535);$.adler=1}if(K.status===y4)if(K.gzhead.extra){J=K.pending;while(K.gzindex<(K.gzhead.extra.length&65535)){if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size)break}C0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=n8}else K.status=n8;if(K.status===n8)if(K.gzhead.name){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.gzindex=0,K.status=d8}else K.status=d8;if(K.status===d8)if(K.gzhead.comment){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.status=m8}else K.status=m8;if(K.status===m8)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)K1($);if(K.pending+2<=K.pending_buf_size)C0(K,$.adler&255),C0(K,$.adler>>8&255),$.adler=0,K.status=f1}else K.status=f1;if(K.pending!==0){if(K1($),$.avail_out===0)return K.last_flush=-1,x2}else if($.avail_in===0&&NQ(q)<=NQ(Q)&&q!==Z1)return U1($,g4);if(K.status===r6&&$.avail_in!==0)return U1($,g4);if($.avail_in!==0||K.lookahead!==0||q!==C1&&K.status!==r6){var B=K.strategy===b8?wZ(K,q):K.strategy===rU?MZ(K,q):V6[K.level].func(K,q);if(B===R1||B===U6)K.status=r6;if(B===c0||B===R1){if($.avail_out===0)K.last_flush=-1;return x2}if(B===s6){if(q===pU)M2._tr_align(K);else if(q!==MQ){if(M2._tr_stored_block(K,0,0,!1),q===iU){if(J1(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(K1($),$.avail_out===0)return K.last_flush=-1,x2}}if(q!==Z1)return x2;if(K.wrap<=0)return wQ;if(K.wrap===2)C0(K,$.adler&255),C0(K,$.adler>>8&255),C0(K,$.adler>>16&255),C0(K,$.adler>>24&255),C0(K,$.total_in&255),C0(K,$.total_in>>8&255),C0(K,$.total_in>>16&255),C0(K,$.total_in>>24&255);else l6(K,$.adler>>>16),l6(K,$.adler&65535);if(K1($),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?x2:wQ}function HZ($){var q;if(!$||!$.state)return w2;if(q=$.state.status,q!==i8&&q!==y4&&q!==n8&&q!==d8&&q!==m8&&q!==f1&&q!==r6)return U1($,w2);return $.state=null,q===f1?U1($,oU):x2}function vZ($,q){var Q=q.length,K,J,Z,G,W,B,V,U;if(!$||!$.state)return w2;if(K=$.state,G=K.wrap,G===2||G===1&&K.status!==i8||K.lookahead)return w2;if(G===1)$.adler=YQ($.adler,q,Q,0);if(K.wrap=0,Q>=K.w_size){if(G===0)J1(K.head),K.strstart=0,K.block_start=0,K.insert=0;U=new r0.Buf8(K.w_size),r0.arraySet(U,q,Q-K.w_size,K.w_size,0),q=U,Q=K.w_size}W=$.avail_in,B=$.next_in,V=$.input,$.avail_in=Q,$.next_in=0,$.input=q,I1(K);while(K.lookahead>=f0){J=K.strstart,Z=K.lookahead-(f0-1);do K.ins_h=(K.ins_h<{var o8=d2(),fQ=!0,RQ=!0;try{String.fromCharCode.apply(null,[0])}catch($){fQ=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){RQ=!1}var t6=new o8.Buf8(256);for(P2=0;P2<256;P2++)t6[P2]=P2>=252?6:P2>=248?5:P2>=240?4:P2>=224?3:P2>=192?2:1;var P2;t6[254]=t6[254]=1;Z6.string2buf=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q};function IQ($,q){if(q<65534){if($.subarray&&RQ||!$.subarray&&fQ)return String.fromCharCode.apply(null,o8.shrinkBuf($,q))}var Q="";for(var K=0;K4){W[K++]=65533,Q+=Z-1;continue}J&=Z===2?31:Z===3?15:7;while(Z>1&&Q1){W[K++]=65533;continue}if(J<65536)W[K++]=J;else J-=65536,W[K++]=55296|J>>10&1023,W[K++]=56320|J&1023}return IQ(W,K)};Z6.utf8border=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+t6[$[Q]]>q?Q:q}});var x4=N0((cz,CQ)=>{function fZ(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}CQ.exports=fZ});var XQ=N0((Q8)=>{var e6=vQ(),$8=d2(),P4=h4(),T4=c8(),RZ=x4(),AQ=Object.prototype.toString,IZ=0,O4=4,G6=0,jQ=1,gQ=2,CZ=-1,jZ=0,gZ=8;function j1($){if(!(this instanceof j1))return new j1($);this.options=$8.assign({level:CZ,method:gZ,chunkSize:16384,windowBits:15,memLevel:8,strategy:jZ,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>0)q.windowBits=-q.windowBits;else if(q.gzip&&q.windowBits>0&&q.windowBits<16)q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new RZ,this.strm.avail_out=0;var Q=e6.deflateInit2(this.strm,q.level,q.method,q.windowBits,q.memLevel,q.strategy);if(Q!==G6)throw Error(T4[Q]);if(q.header)e6.deflateSetHeader(this.strm,q.header);if(q.dictionary){var K;if(typeof q.dictionary==="string")K=P4.string2buf(q.dictionary);else if(AQ.call(q.dictionary)==="[object ArrayBuffer]")K=new Uint8Array(q.dictionary);else K=q.dictionary;if(Q=e6.deflateSetDictionary(this.strm,K),Q!==G6)throw Error(T4[Q]);this._dict_set=!0}}j1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J,Z;if(this.ended)return!1;if(Z=q===~~q?q:q===!0?O4:IZ,typeof $==="string")Q.input=P4.string2buf($);else if(AQ.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new $8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(J=e6.deflate(Q,Z),J!==jQ&&J!==G6)return this.onEnd(J),this.ended=!0,!1;if(Q.avail_out===0||Q.avail_in===0&&(Z===O4||Z===gQ))if(this.options.to==="string")this.onData(P4.buf2binstring($8.shrinkBuf(Q.output,Q.next_out)));else this.onData($8.shrinkBuf(Q.output,Q.next_out))}while((Q.avail_in>0||Q.avail_out===0)&&J!==jQ);if(Z===O4)return J=e6.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===G6;if(Z===gQ)return this.onEnd(G6),Q.avail_out=0,!0;return!0};j1.prototype.onData=function($){this.chunks.push($)};j1.prototype.onEnd=function($){if($===G6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=$8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function u4($,q){var Q=new j1(q);if(Q.push($,!0),Q.err)throw Q.msg||T4[Q.err];return Q.result}function AZ($,q){return q=q||{},q.raw=!0,u4($,q)}function XZ($,q){return q=q||{},q.gzip=!0,u4($,q)}Q8.Deflate=j1;Q8.deflate=u4;Q8.deflateRaw=AZ;Q8.gzip=XZ});var hQ=N0((nz,yQ)=>{var a8=30,yZ=12;yQ.exports=function(q,Q){var K,J,Z,G,W,B,V,U,w,F,M,k,f,L,D,z,N,H,v,j,n,d,_,X,P;K=q.state,J=q.next_in,X=q.input,Z=J+(q.avail_in-5),G=q.next_out,P=q.output,W=G-(Q-q.avail_out),B=G+(q.avail_out-257),V=K.dmax,U=K.wsize,w=K.whave,F=K.wnext,M=K.window,k=K.hold,f=K.bits,L=K.lencode,D=K.distcode,z=(1<>>24,k>>>=v,f-=v,v=H>>>16&255,v===0)P[G++]=H&65535;else if(v&16){if(j=H&65535,v&=15,v){if(f>>=v,f-=v}if(f<15)k+=X[J++]<>>24,k>>>=v,f-=v,v=H>>>16&255,v&16){if(n=H&65535,v&=15,fV){q.msg="invalid distance too far back",K.mode=a8;break $}if(k>>>=v,f-=v,v=G-W,n>v){if(v=n-v,v>w){if(K.sane){q.msg="invalid distance too far back",K.mode=a8;break $}}if(d=0,_=M,F===0){if(d+=U-v,v2)P[G++]=_[d++],P[G++]=_[d++],P[G++]=_[d++],j-=3;if(j){if(P[G++]=_[d++],j>1)P[G++]=_[d++]}}else{d=G-n;do P[G++]=P[d++],P[G++]=P[d++],P[G++]=P[d++],j-=3;while(j>2);if(j){if(P[G++]=P[d++],j>1)P[G++]=P[d++]}}}else if((v&64)===0){H=D[(H&65535)+(k&(1<>3,J-=j,f-=j<<3,k&=(1<{var xQ=d2(),W6=15,OQ=852,PQ=592,TQ=0,S4=1,uQ=2,hZ=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],xZ=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],OZ=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],PZ=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];SQ.exports=function(q,Q,K,J,Z,G,W,B){var V=B.bits,U=0,w=0,F=0,M=0,k=0,f=0,L=0,D=0,z=0,N=0,H,v,j,n,d,_=null,X=0,P,g=new xQ.Buf16(W6+1),c=new xQ.Buf16(W6+1),h=null,x=0,l,$0,Z0;for(U=0;U<=W6;U++)g[U]=0;for(w=0;w=1;M--)if(g[M]!==0)break;if(k>M)k=M;if(M===0)return Z[G++]=20971520,Z[G++]=20971520,B.bits=1,0;for(F=1;F0&&(q===TQ||M!==1))return-1;c[1]=0;for(U=1;UOQ||q===uQ&&z>PQ)return 1;for(;;){if(l=U-L,W[w]P)$0=h[x+W[w]],Z0=_[X+W[w]];else $0=96,Z0=0;H=1<>L)+v]=l<<24|$0<<16|Z0|0;while(v!==0);H=1<>=1;if(H!==0)N&=H-1,N+=H;else N=0;if(w++,--g[U]===0){if(U===M)break;U=Q[K+W[w]]}if(U>k&&(N&n)!==j){if(L===0)L=k;d+=F,f=U-L,D=1<OQ||q===uQ&&z>PQ)return 1;j=N&n,Z[j]=k<<24|f<<16|d-G|0}}if(N!==0)Z[d+N]=U-L<<24|4194304|0;return B.bits=k,0}});var Lq=N0((H2)=>{var U2=d2(),d4=C4(),T2=j4(),TZ=hQ(),q8=EQ(),uZ=0,Bq=1,zq=2,_Q=4,SZ=5,l8=6,g1=0,EZ=1,_Z=2,N2=-2,Fq=-3,m4=-4,cZ=-5,cQ=8,Mq=1,bQ=2,nQ=3,dQ=4,mQ=5,pQ=6,iQ=7,oQ=8,aQ=9,lQ=10,t8=11,p2=12,E4=13,rQ=14,_4=15,sQ=16,tQ=17,eQ=18,$q=19,r8=20,s8=21,Qq=22,qq=23,Kq=24,Jq=25,Vq=26,c4=27,Uq=28,Zq=29,x0=30,p4=31,bZ=32,nZ=852,dZ=592,mZ=15,pZ=mZ;function Gq($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function iZ(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U2.Buf16(320),this.work=new U2.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function wq($){var q;if(!$||!$.state)return N2;if(q=$.state,$.total_in=$.total_out=q.total=0,$.msg="",q.wrap)$.adler=q.wrap&1;return q.mode=Mq,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new U2.Buf32(nZ),q.distcode=q.distdyn=new U2.Buf32(dZ),q.sane=1,q.back=-1,g1}function Nq($){var q;if(!$||!$.state)return N2;return q=$.state,q.wsize=0,q.whave=0,q.wnext=0,wq($)}function Yq($,q){var Q,K;if(!$||!$.state)return N2;if(K=$.state,q<0)Q=0,q=-q;else if(Q=(q>>4)+1,q<48)q&=15;if(q&&(q<8||q>15))return N2;if(K.window!==null&&K.wbits!==q)K.window=null;return K.wrap=Q,K.wbits=q,Nq($)}function kq($,q){var Q,K;if(!$)return N2;if(K=new iZ,$.state=K,K.window=null,Q=Yq($,q),Q!==g1)$.state=null;return Q}function oZ($){return kq($,pZ)}var Wq=!0,b4,n4;function aZ($){if(Wq){var q;b4=new U2.Buf32(512),n4=new U2.Buf32(32),q=0;while(q<144)$.lens[q++]=8;while(q<256)$.lens[q++]=9;while(q<280)$.lens[q++]=7;while(q<288)$.lens[q++]=8;q8(Bq,$.lens,0,288,b4,0,$.work,{bits:9}),q=0;while(q<32)$.lens[q++]=5;q8(zq,$.lens,0,32,n4,0,$.work,{bits:5}),Wq=!1}$.lencode=b4,$.lenbits=9,$.distcode=n4,$.distbits=5}function Dq($,q,Q,K){var J,Z=$.state;if(Z.window===null)Z.wsize=1<=Z.wsize)U2.arraySet(Z.window,q,Q-Z.wsize,Z.wsize,0),Z.wnext=0,Z.whave=Z.wsize;else{if(J=Z.wsize-Z.wnext,J>K)J=K;if(U2.arraySet(Z.window,q,Q-K,J,Z.wnext),K-=J,K)U2.arraySet(Z.window,q,Q-K,K,0),Z.wnext=K,Z.whave=Z.wsize;else{if(Z.wnext+=J,Z.wnext===Z.wsize)Z.wnext=0;if(Z.whave>>8&255,Q.check=T2(Q.check,_,2,0),V=0,U=0,Q.mode=bQ;break}if(Q.flags=0,Q.head)Q.head.done=!1;if(!(Q.wrap&1)||(((V&255)<<8)+(V>>8))%31){$.msg="incorrect header check",Q.mode=x0;break}if((V&15)!==cQ){$.msg="unknown compression method",Q.mode=x0;break}if(V>>>=4,U-=4,n=(V&15)+8,Q.wbits===0)Q.wbits=n;else if(n>Q.wbits){$.msg="invalid window size",Q.mode=x0;break}Q.dmax=1<>8&1;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=nQ;case nQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>8&255,_[2]=V>>>16&255,_[3]=V>>>24&255,Q.check=T2(Q.check,_,4,0);V=0,U=0,Q.mode=dQ;case dQ:while(U<16){if(W===0)break $;W--,V+=K[Z++]<>8;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=mQ;case mQ:if(Q.flags&1024){while(U<16){if(W===0)break $;W--,V+=K[Z++]<>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0}else if(Q.head)Q.head.extra=null;Q.mode=pQ;case pQ:if(Q.flags&1024){if(M=Q.length,M>W)M=W;if(M){if(Q.head){if(n=Q.head.extra_len-Q.length,!Q.head.extra)Q.head.extra=Array(Q.head.extra_len);U2.arraySet(Q.head.extra,K,Z,M,n)}if(Q.flags&512)Q.check=T2(Q.check,K,M,Z);W-=M,Z+=M,Q.length-=M}if(Q.length)break $}Q.length=0,Q.mode=iQ;case iQ:if(Q.flags&2048){if(W===0)break $;M=0;do if(n=K[Z+M++],Q.head&&n&&Q.length<65536)Q.head.name+=String.fromCharCode(n);while(n&&M>9&1,Q.head.done=!0;$.adler=Q.check=0,Q.mode=p2;break;case lQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>=U&7,U-=U&7,Q.mode=c4;break}while(U<3){if(W===0)break $;W--,V+=K[Z++]<>>=1,U-=1,V&3){case 0:Q.mode=rQ;break;case 1:if(aZ(Q),Q.mode=r8,q===l8){V>>>=2,U-=2;break $}break;case 2:Q.mode=tQ;break;case 3:$.msg="invalid block type",Q.mode=x0}V>>>=2,U-=2;break;case rQ:V>>>=U&7,U-=U&7;while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>16^65535)){$.msg="invalid stored block lengths",Q.mode=x0;break}if(Q.length=V&65535,V=0,U=0,Q.mode=_4,q===l8)break $;case _4:Q.mode=sQ;case sQ:if(M=Q.length,M){if(M>W)M=W;if(M>B)M=B;if(M===0)break $;U2.arraySet(J,K,Z,M,G),W-=M,Z+=M,B-=M,G+=M,Q.length-=M;break}Q.mode=p2;break;case tQ:while(U<14){if(W===0)break $;W--,V+=K[Z++]<>>=5,U-=5,Q.ndist=(V&31)+1,V>>>=5,U-=5,Q.ncode=(V&15)+4,V>>>=4,U-=4,Q.nlen>286||Q.ndist>30){$.msg="too many length or distance symbols",Q.mode=x0;break}Q.have=0,Q.mode=eQ;case eQ:while(Q.have>>=3,U-=3}while(Q.have<19)Q.lens[g[Q.have++]]=0;if(Q.lencode=Q.lendyn,Q.lenbits=7,X={bits:Q.lenbits},d=q8(uZ,Q.lens,0,19,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid code lengths set",Q.mode=x0;break}Q.have=0,Q.mode=$q;case $q:while(Q.have>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=D,U-=D,Q.lens[Q.have++]=N;else{if(N===16){P=D+2;while(U>>=D,U-=D,Q.have===0){$.msg="invalid bit length repeat",Q.mode=x0;break}n=Q.lens[Q.have-1],M=3+(V&3),V>>>=2,U-=2}else if(N===17){P=D+3;while(U>>=D,U-=D,n=0,M=3+(V&7),V>>>=3,U-=3}else{P=D+7;while(U>>=D,U-=D,n=0,M=11+(V&127),V>>>=7,U-=7}if(Q.have+M>Q.nlen+Q.ndist){$.msg="invalid bit length repeat",Q.mode=x0;break}while(M--)Q.lens[Q.have++]=n}}if(Q.mode===x0)break;if(Q.lens[256]===0){$.msg="invalid code -- missing end-of-block",Q.mode=x0;break}if(Q.lenbits=9,X={bits:Q.lenbits},d=q8(Bq,Q.lens,0,Q.nlen,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid literal/lengths set",Q.mode=x0;break}if(Q.distbits=6,Q.distcode=Q.distdyn,X={bits:Q.distbits},d=q8(zq,Q.lens,Q.nlen,Q.ndist,Q.distcode,0,Q.work,X),Q.distbits=X.bits,d){$.msg="invalid distances set",Q.mode=x0;break}if(Q.mode=r8,q===l8)break $;case r8:Q.mode=s8;case s8:if(W>=6&&B>=258){if($.next_out=G,$.avail_out=B,$.next_in=Z,$.avail_in=W,Q.hold=V,Q.bits=U,TZ($,F),G=$.next_out,J=$.output,B=$.avail_out,Z=$.next_in,K=$.input,W=$.avail_in,V=Q.hold,U=Q.bits,Q.mode===p2)Q.back=-1;break}Q.back=0;for(;;){if(L=Q.lencode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,Q.length=N,z===0){Q.mode=Vq;break}if(z&32){Q.back=-1,Q.mode=p2;break}if(z&64){$.msg="invalid literal/length code",Q.mode=x0;break}Q.extra=z&15,Q.mode=Qq;case Qq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}Q.was=Q.length,Q.mode=qq;case qq:for(;;){if(L=Q.distcode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,z&64){$.msg="invalid distance code",Q.mode=x0;break}Q.offset=N,Q.extra=z&15,Q.mode=Kq;case Kq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}if(Q.offset>Q.dmax){$.msg="invalid distance too far back",Q.mode=x0;break}Q.mode=Jq;case Jq:if(B===0)break $;if(M=F-B,Q.offset>M){if(M=Q.offset-M,M>Q.whave){if(Q.sane){$.msg="invalid distance too far back",Q.mode=x0;break}}if(M>Q.wnext)M-=Q.wnext,k=Q.wsize-M;else k=Q.wnext-M;if(M>Q.length)M=Q.length;f=Q.window}else f=J,k=G-Q.offset,M=Q.length;if(M>B)M=B;B-=M,Q.length-=M;do J[G++]=f[k++];while(--M);if(Q.length===0)Q.mode=s8;break;case Vq:if(B===0)break $;J[G++]=Q.length,B--,Q.mode=s8;break;case c4:if(Q.wrap){while(U<32){if(W===0)break $;W--,V|=K[Z++]<{Hq.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var fq=N0((iz,vq)=>{function eZ(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}vq.exports=eZ});var Iq=N0((J8)=>{var B6=Lq(),K8=d2(),e8=h4(),E0=i4(),o4=c8(),$G=x4(),QG=fq(),Rq=Object.prototype.toString;function A1($){if(!(this instanceof A1))return new A1($);this.options=K8.assign({chunkSize:16384,windowBits:0,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>=0&&q.windowBits<16){if(q.windowBits=-q.windowBits,q.windowBits===0)q.windowBits=-15}if(q.windowBits>=0&&q.windowBits<16&&!($&&$.windowBits))q.windowBits+=32;if(q.windowBits>15&&q.windowBits<48){if((q.windowBits&15)===0)q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $G,this.strm.avail_out=0;var Q=B6.inflateInit2(this.strm,q.windowBits);if(Q!==E0.Z_OK)throw Error(o4[Q]);if(this.header=new QG,B6.inflateGetHeader(this.strm,this.header),q.dictionary){if(typeof q.dictionary==="string")q.dictionary=e8.string2buf(q.dictionary);else if(Rq.call(q.dictionary)==="[object ArrayBuffer]")q.dictionary=new Uint8Array(q.dictionary);if(q.raw){if(Q=B6.inflateSetDictionary(this.strm,q.dictionary),Q!==E0.Z_OK)throw Error(o4[Q])}}}A1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J=this.options.dictionary,Z,G,W,B,V,U=!1;if(this.ended)return!1;if(G=q===~~q?q:q===!0?E0.Z_FINISH:E0.Z_NO_FLUSH,typeof $==="string")Q.input=e8.binstring2buf($);else if(Rq.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new K8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(Z=B6.inflate(Q,E0.Z_NO_FLUSH),Z===E0.Z_NEED_DICT&&J)Z=B6.inflateSetDictionary(this.strm,J);if(Z===E0.Z_BUF_ERROR&&U===!0)Z=E0.Z_OK,U=!1;if(Z!==E0.Z_STREAM_END&&Z!==E0.Z_OK)return this.onEnd(Z),this.ended=!0,!1;if(Q.next_out){if(Q.avail_out===0||Z===E0.Z_STREAM_END||Q.avail_in===0&&(G===E0.Z_FINISH||G===E0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(W=e8.utf8border(Q.output,Q.next_out),B=Q.next_out-W,V=e8.buf2string(Q.output,W),Q.next_out=B,Q.avail_out=K-B,B)K8.arraySet(Q.output,Q.output,W,B,0);this.onData(V)}else this.onData(K8.shrinkBuf(Q.output,Q.next_out))}if(Q.avail_in===0&&Q.avail_out===0)U=!0}while((Q.avail_in>0||Q.avail_out===0)&&Z!==E0.Z_STREAM_END);if(Z===E0.Z_STREAM_END)G=E0.Z_FINISH;if(G===E0.Z_FINISH)return Z=B6.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===E0.Z_OK;if(G===E0.Z_SYNC_FLUSH)return this.onEnd(E0.Z_OK),Q.avail_out=0,!0;return!0};A1.prototype.onData=function($){this.chunks.push($)};A1.prototype.onEnd=function($){if($===E0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=K8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function a4($,q){var Q=new A1(q);if(Q.push($,!0),Q.err)throw Q.msg||o4[Q.err];return Q.result}function qG($,q){return q=q||{},q.raw=!0,a4($,q)}J8.Inflate=A1;J8.inflate=a4;J8.inflateRaw=qG;J8.ungzip=a4});var gq=N0((az,jq)=>{var KG=d2().assign,JG=XQ(),VG=Iq(),UG=i4(),Cq={};KG(Cq,JG,VG,UG);jq.exports=Cq});var Xq=N0((Q5)=>{var ZG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",GG=gq(),Aq=T0(),$5=V2(),WG=ZG?"uint8array":"array";Q5.magic="\b\x00";function X1($,q){$5.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=q,this.meta={}}Aq.inherits(X1,$5);X1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(Aq.transformTo(WG,$.data),!1)};X1.prototype.flush=function(){if($5.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};X1.prototype.cleanUp=function(){$5.prototype.cleanUp.call(this),this._pako=null};X1.prototype._createPako=function(){this._pako=new GG[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(q){$.push({data:q,meta:$.meta})}};Q5.compressWorker=function($){return new X1("Deflate",$)};Q5.uncompressWorker=function(){return new X1("Inflate",{})}});var r4=N0((l4)=>{var yq=V2();l4.STORE={magic:"\x00\x00",compressWorker:function(){return new yq("STORE compression")},uncompressWorker:function(){return new yq("STORE decompression")}};l4.DEFLATE=Xq()});var s4=N0((y1)=>{y1.LOCAL_FILE_HEADER="PK\x03\x04";y1.CENTRAL_FILE_HEADER="PK\x01\x02";y1.CENTRAL_DIRECTORY_END="PK\x05\x06";y1.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";y1.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";y1.DATA_DESCRIPTOR="PK\x07\b"});var Pq=N0((tz,Oq)=>{var z6=T0(),F6=V2(),t4=e1(),hq=u8(),q5=s4(),A0=function($,q){var Q="",K;for(K=0;K>>8;return Q},BG=function($,q){var Q=$;if(!$)Q=q?16893:33204;return(Q&65535)<<16},zG=function($){return($||0)&63},xq=function($,q,Q,K,J,Z){var{file:G,compression:W}=$,B=Z!==t4.utf8encode,V=z6.transformTo("string",Z(G.name)),U=z6.transformTo("string",t4.utf8encode(G.name)),w=G.comment,F=z6.transformTo("string",Z(w)),M=z6.transformTo("string",t4.utf8encode(w)),k=U.length!==G.name.length,f=M.length!==w.length,L,D,z="",N="",H="",v=G.dir,j=G.date,n={crc32:0,compressedSize:0,uncompressedSize:0};if(!q||Q)n.crc32=$.crc32,n.compressedSize=$.compressedSize,n.uncompressedSize=$.uncompressedSize;var d=0;if(q)d|=8;if(!B&&(k||f))d|=2048;var _=0,X=0;if(v)_|=16;if(J==="UNIX")X=798,_|=BG(G.unixPermissions,v);else X=20,_|=zG(G.dosPermissions,v);if(L=j.getUTCHours(),L=L<<6,L=L|j.getUTCMinutes(),L=L<<5,L=L|j.getUTCSeconds()/2,D=j.getUTCFullYear()-1980,D=D<<4,D=D|j.getUTCMonth()+1,D=D<<5,D=D|j.getUTCDate(),k)N=A0(1,1)+A0(hq(V),4)+U,z+="up"+A0(N.length,2)+N;if(f)H=A0(1,1)+A0(hq(F),4)+M,z+="uc"+A0(H.length,2)+H;var P="";P+=` -\x00`,P+=A0(d,2),P+=W.magic,P+=A0(L,2),P+=A0(D,2),P+=A0(n.crc32,4),P+=A0(n.compressedSize,4),P+=A0(n.uncompressedSize,4),P+=A0(V.length,2),P+=A0(z.length,2);var g=q5.LOCAL_FILE_HEADER+P+V+z,c=q5.CENTRAL_FILE_HEADER+A0(X,2)+P+A0(F.length,2)+"\x00\x00\x00\x00"+A0(_,4)+A0(K,4)+V+z+F;return{fileRecord:g,dirRecord:c}},FG=function($,q,Q,K,J){var Z="",G=z6.transformTo("string",J(K));return Z=q5.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+A0($,2)+A0($,2)+A0(q,4)+A0(Q,4)+A0(G.length,2)+G,Z},MG=function($){var q="";return q=q5.DATA_DESCRIPTOR+A0($.crc32,4)+A0($.compressedSize,4)+A0($.uncompressedSize,4),q};function v2($,q,Q,K){F6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=q,this.zipPlatform=Q,this.encodeFileName=K,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}z6.inherits(v2,F6);v2.prototype.push=function($){var q=$.meta.percent||0,Q=this.entriesCount,K=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,F6.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:Q?(q+100*(Q-K-1))/Q:100}})};v2.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var q=this.streamFiles&&!$.file.dir;if(q){var Q=xq($,q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:Q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};v2.prototype.closedSource=function($){this.accumulate=!1;var q=this.streamFiles&&!$.file.dir,Q=xq($,q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(Q.dirRecord),q)this.push({data:MG($),meta:{percent:100}});else{this.push({data:Q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};v2.prototype.flush=function(){var $=this.bytesWritten;for(var q=0;q{var wG=r4(),NG=Pq(),YG=function($,q){var Q=$||q,K=wG[Q];if(!K)throw Error(Q+" is not a valid compression method !");return K};Tq.generateWorker=function($,q,Q){var K=new NG(q.streamFiles,Q,q.platform,q.encodeFileName),J=0;try{$.forEach(function(Z,G){J++;var W=YG(G.options.compression,q.compression),B=G.options.compressionOptions||q.compressionOptions||{},V=G.dir,U=G.date;G._compressWorker(W,B).withStreamInfo("file",{name:Z,dir:V,date:U,comment:G.comment||"",unixPermissions:G.unixPermissions,dosPermissions:G.dosPermissions}).pipe(K)}),K.entriesCount=J}catch(Z){K.error(Z)}return K}});var Eq=N0(($F,Sq)=>{var kG=T0(),K5=V2();function V8($,q){K5.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(q)}kG.inherits(V8,K5);V8.prototype._bindStream=function($){var q=this;this._stream=$,$.pause(),$.on("data",function(Q){q.push({data:Q,meta:{percent:0}})}).on("error",function(Q){if(q.isPaused)this.generatedError=Q;else q.error(Q)}).on("end",function(){if(q.isPaused)q._upstreamEnded=!0;else q.end()})};V8.prototype.pause=function(){if(!K5.prototype.pause.call(this))return!1;return this._stream.pause(),!0};V8.prototype.resume=function(){if(!K5.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};Sq.exports=V8});var aq=N0((QF,oq)=>{var DG=e1(),U8=T0(),nq=V2(),LG=K4(),dq=J4(),_q=S8(),HG=c$(),vG=uq(),cq=T6(),fG=Eq(),mq=function($,q,Q){var K=U8.getTypeOf(q),J,Z=U8.extend(Q||{},dq);if(Z.date=Z.date||new Date,Z.compression!==null)Z.compression=Z.compression.toUpperCase();if(typeof Z.unixPermissions==="string")Z.unixPermissions=parseInt(Z.unixPermissions,8);if(Z.unixPermissions&&Z.unixPermissions&16384)Z.dir=!0;if(Z.dosPermissions&&Z.dosPermissions&16)Z.dir=!0;if(Z.dir)$=pq($);if(Z.createFolders&&(J=RG($)))iq.call(this,J,!0);var G=K==="string"&&Z.binary===!1&&Z.base64===!1;if(!Q||typeof Q.binary>"u")Z.binary=!G;var W=q instanceof _q&&q.uncompressedSize===0;if(W||Z.dir||!q||q.length===0)Z.base64=!1,Z.binary=!0,q="",Z.compression="STORE",K="string";var B=null;if(q instanceof _q||q instanceof nq)B=q;else if(cq.isNode&&cq.isStream(q))B=new fG($,q);else B=U8.prepareContent($,q,Z.binary,Z.optimizedBinaryString,Z.base64);var V=new HG($,B,Z);this.files[$]=V},RG=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var q=$.lastIndexOf("/");return q>0?$.substring(0,q):""},pq=function($){if($.slice(-1)!=="/")$+="/";return $},iq=function($,q){if(q=typeof q<"u"?q:dq.createFolders,$=pq($),!this.files[$])mq.call(this,$,null,{dir:!0,createFolders:q});return this.files[$]};function bq($){return Object.prototype.toString.call($)==="[object RegExp]"}var IG={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var q,Q,K;for(q in this.files)if(K=this.files[q],Q=q.slice(this.root.length,q.length),Q&&q.slice(0,this.root.length)===this.root)$(Q,K)},filter:function($){var q=[];return this.forEach(function(Q,K){if($(Q,K))q.push(K)}),q},file:function($,q,Q){if(arguments.length===1)if(bq($)){var K=$;return this.filter(function(Z,G){return!G.dir&&K.test(Z)})}else{var J=this.files[this.root+$];if(J&&!J.dir)return J;else return null}else $=this.root+$,mq.call(this,$,q,Q);return this},folder:function($){if(!$)return this;if(bq($))return this.filter(function(J,Z){return Z.dir&&$.test(J)});var q=this.root+$,Q=iq.call(this,q),K=this.clone();return K.root=Q.name,K},remove:function($){$=this.root+$;var q=this.files[$];if(!q){if($.slice(-1)!=="/")$+="/";q=this.files[$]}if(q&&!q.dir)delete this.files[$];else{var Q=this.filter(function(J,Z){return Z.name.slice(0,$.length)===$});for(var K=0;K{var CG=T0();function lq($){this.data=$,this.length=$.length,this.index=0,this.zero=0}lq.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length=this.index;Q--)q=(q<<8)+this.byteAt(Q);return this.index+=$,q},readString:function($){return CG.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};rq.exports=lq});var $7=N0((KF,tq)=>{var sq=e4(),jG=T0();function M6($){sq.call(this,$);for(var q=0;q=0;--Z)if(this.data[Z]===q&&this.data[Z+1]===Q&&this.data[Z+2]===K&&this.data[Z+3]===J)return Z-this.zero;return-1};M6.prototype.readAndCheckSignature=function($){var q=$.charCodeAt(0),Q=$.charCodeAt(1),K=$.charCodeAt(2),J=$.charCodeAt(3),Z=this.readData(4);return q===Z[0]&&Q===Z[1]&&K===Z[2]&&J===Z[3]};M6.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};tq.exports=M6});var QK=N0((JF,$K)=>{var eq=e4(),gG=T0();function w6($){eq.call(this,$)}gG.inherits(w6,eq);w6.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};w6.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};w6.prototype.readAndCheckSignature=function($){var q=this.readData(4);return $===q};w6.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};$K.exports=w6});var q7=N0((VF,KK)=>{var qK=$7(),AG=T0();function Q7($){qK.call(this,$)}AG.inherits(Q7,qK);Q7.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};KK.exports=Q7});var UK=N0((UF,VK)=>{var JK=q7(),XG=T0();function K7($){JK.call(this,$)}XG.inherits(K7,JK);K7.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};VK.exports=K7});var J7=N0((ZF,GK)=>{var J5=T0(),ZK=n2(),yG=$7(),hG=QK(),xG=UK(),OG=q7();GK.exports=function($){var q=J5.getTypeOf($);if(J5.checkSupport(q),q==="string"&&!ZK.uint8array)return new hG($);if(q==="nodebuffer")return new xG($);if(ZK.uint8array)return new OG(J5.transformTo("uint8array",$));return new yG(J5.transformTo("array",$))}});var FK=N0((GF,zK)=>{var V7=J7(),G1=T0(),PG=S8(),WK=u8(),V5=e1(),U5=r4(),TG=n2(),uG=0,SG=3,EG=function($){for(var q in U5){if(!Object.prototype.hasOwnProperty.call(U5,q))continue;if(U5[q].magic===$)return U5[q]}return null};function BK($,q){this.options=$,this.loadOptions=q}BK.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var q,Q;if($.skip(22),this.fileNameLength=$.readInt(2),Q=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(Q),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(q=EG(this.compressionMethod),q===null)throw Error("Corrupted zip : compression "+G1.pretty(this.compressionMethod)+" unknown (inner file : "+G1.transformTo("string",this.fileName)+")");this.decompressed=new PG(this.compressedSize,this.uncompressedSize,this.crc32,q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===uG)this.dosPermissions=this.externalFileAttributes&63;if($===SG)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=V7(this.extraFields[1].value);if(this.uncompressedSize===G1.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G1.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G1.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G1.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var q=$.index+this.extraFieldsLength,Q,K,J;if(!this.extraFields)this.extraFields={};while($.index+4{var _G=J7(),i2=T0(),f2=s4(),cG=FK(),bG=n2();function MK($){this.files=[],this.loadOptions=$}MK.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+i2.pretty(q)+", expected "+i2.pretty($)+")")}},isSignature:function($,q){var Q=this.reader.index;this.reader.setIndex($);var K=this.reader.readString(4),J=K===q;return this.reader.setIndex(Q),J},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),q=bG.uint8array?"uint8array":"array",Q=i2.transformTo(q,$);this.zipComment=this.loadOptions.decodeFileName(Q)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,q=0,Q,K,J;while(q<$)Q=this.reader.readInt(2),K=this.reader.readInt(4),J=this.reader.readData(K),this.zip64ExtensibleData[Q]={id:Q,length:K,value:J}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,q;for($=0;$0)if(this.isSignature(Q,f2.CENTRAL_FILE_HEADER));else this.reader.zero=J;else if(J<0)throw Error("Corrupted zip: missing "+Math.abs(J)+" bytes.")},prepareReader:function($){this.reader=_G($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};wK.exports=MK});var DK=N0((BF,kK)=>{var U7=T0(),Z5=r1(),nG=e1(),dG=NK(),mG=Z4(),YK=T6();function pG($){return new Z5.Promise(function(q,Q){var K=$.decompressed.getContentWorker().pipe(new mG);K.on("error",function(J){Q(J)}).on("end",function(){if(K.streamInfo.crc32!==$.decompressed.crc32)Q(Error("Corrupted zip : CRC32 mismatch"));else q()}).resume()})}kK.exports=function($,q){var Q=this;if(q=U7.extend(q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:nG.utf8decode}),YK.isNode&&YK.isStream($))return Z5.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return U7.prepareContent("the loaded zip file",$,!0,q.optimizedBinaryString,q.base64).then(function(K){var J=new dG(q);return J.load(K),J}).then(function(J){var Z=[Z5.Promise.resolve(J)],G=J.files;if(q.checkCRC32)for(var W=0;W{function Y2(){if(!(this instanceof Y2))return new Y2;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new Y2;for(var q in this)if(typeof this[q]!=="function")$[q]=this[q];return $}}Y2.prototype=aq();Y2.prototype.loadAsync=DK();Y2.support=n2();Y2.defaults=J4();Y2.version="3.10.1";Y2.loadAsync=function($,q){return new Y2().loadAsync($,q)};Y2.external=r1();LK.exports=Y2});var Z8={};c1(Z8,{types:()=>QW,promisify:()=>jK,log:()=>RK,isUndefined:()=>N6,isSymbol:()=>KW,isString:()=>M5,isRegExp:()=>G5,isPrimitive:()=>JW,isObject:()=>Y6,isNumber:()=>fK,isNullOrUndefined:()=>qW,isNull:()=>F5,isFunction:()=>B5,isError:()=>W5,isDate:()=>B7,isBuffer:()=>VW,isBoolean:()=>F7,isArray:()=>vK,inspect:()=>h1,inherits:()=>IK,format:()=>z7,deprecate:()=>oG,default:()=>GW,debuglog:()=>aG,callbackifyOnRejected:()=>N7,callbackify:()=>gK,_extend:()=>w7,TextEncoder:()=>AK,TextDecoder:()=>XK});function z7($,...q){if(!M5($)){var Q=[$];for(var K=0;K=J)return W;switch(W){case"%s":return String(q[K++]);case"%d":return Number(q[K++]);case"%j":try{return JSON.stringify(q[K++])}catch(B){return"[Circular]"}default:return W}});for(var G=q[K];K"u"||process?.noDeprecation===!0)return $;var Q=!1;function K(...J){if(!Q){if(process.throwDeprecation)throw Error(q);else if(process.traceDeprecation)console.trace(q);else console.error(q);Q=!0}return $.apply(this,...J)}return K}function lG($,q){var Q=h1.styles[q];if(Q)return"\x1B["+h1.colors[Q][0]+"m"+$+"\x1B["+h1.colors[Q][1]+"m";else return $}function rG($,q){return $}function sG($){var q={};return $.forEach(function(Q,K){q[Q]=!0}),q}function z5($,q,Q){if($.customInspect&&q&&B5(q.inspect)&&q.inspect!==h1&&!(q.constructor&&q.constructor.prototype===q)){var K=q.inspect(Q,$);if(!M5(K))K=z5($,K,Q);return K}var J=tG($,q);if(J)return J;var Z=Object.keys(q),G=sG(Z);if($.showHidden)Z=Object.getOwnPropertyNames(q);if(W5(q)&&(Z.indexOf("message")>=0||Z.indexOf("description")>=0))return Z7(q);if(Z.length===0){if(B5(q)){var W=q.name?": "+q.name:"";return $.stylize("[Function"+W+"]","special")}if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");if(B7(q))return $.stylize(Date.prototype.toString.call(q),"date");if(W5(q))return Z7(q)}var B="",V=!1,U=["{","}"];if(vK(q))V=!0,U=["[","]"];if(B5(q)){var w=q.name?": "+q.name:"";B=" [Function"+w+"]"}if(G5(q))B=" "+RegExp.prototype.toString.call(q);if(B7(q))B=" "+Date.prototype.toUTCString.call(q);if(W5(q))B=" "+Z7(q);if(Z.length===0&&(!V||q.length==0))return U[0]+B+U[1];if(Q<0)if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");else return $.stylize("[Object]","special");$.seen.push(q);var F;if(V)F=eG($,q,Q,G,Z);else F=Z.map(function(M){return W7($,q,Q,G,M,V)});return $.seen.pop(),$W(F,B,U)}function tG($,q){if(N6(q))return $.stylize("undefined","undefined");if(M5(q)){var Q="'"+JSON.stringify(q).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(Q,"string")}if(fK(q))return $.stylize(""+q,"number");if(F7(q))return $.stylize(""+q,"boolean");if(F5(q))return $.stylize("null","null")}function Z7($){return"["+Error.prototype.toString.call($)+"]"}function eG($,q,Q,K,J){var Z=[];for(var G=0,W=q.length;G{var fJ=Object.create;var{getPrototypeOf:RJ,defineProperty:X6,getOwnPropertyNames:Q9,getOwnPropertyDescriptor:IJ}=Object,q9=Object.prototype.hasOwnProperty;function K9($){return this[$]}var CJ,jJ,J9=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?CJ??=new WeakMap:jJ??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?fJ(RJ($)):{};let G=q||!$||!$.__esModule?X6(Q,"default",{value:$,enumerable:!0}):Q;for(let W of Q9($))if(!q9.call(G,W))X6(G,W,{get:K9.bind($,W),enumerable:!0});if(K)J.set($,G);return G},X0=($)=>{var q=($9??=new WeakMap).get($),Q;if(q)return q;if(q=X6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var K of Q9($))if(!q9.call(q,K))X6(q,K,{get:K9.bind($,K),enumerable:!(Q=IJ($,K))||Q.enumerable})}return $9.set($,q),q},$9,N0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var gJ=($)=>$;function AJ($,q){this[$]=gJ.bind(null,q)}var c1=($,q)=>{for(var Q in q)X6($,Q,{get:q[Q],enumerable:!0,configurable:!0,set:AJ.bind(q,Q)})};var b1=($,q)=>()=>($&&(q=$($=0)),q);var V9=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(q,Q)=>(typeof require<"u"?require:q)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var K2={};c1(K2,{transcode:()=>MV,resolveObjectURL:()=>BV,kStringMaxLength:()=>w9,kMaxLength:()=>y6,isUtf8:()=>zV,isAscii:()=>FV,default:()=>wV,constants:()=>EJ,btoa:()=>PJ,atob:()=>TJ,INSPECT_MAX_BYTES:()=>M9,File:()=>uJ,Buffer:()=>o,Blob:()=>SJ});function XJ($){var q=$.length;if(q%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=$.indexOf("=");if(Q===-1)Q=q;var K=Q===q?0:4-Q%4;return[Q,K]}function yJ($,q){return($+q)*3/4-q}function hJ($){var q,Q=XJ($),K=Q[0],J=Q[1],Z=new Uint8Array(yJ(K,J)),G=0,W=J>0?K-4:K,B;for(B=0;B>16&255,Z[G++]=q>>8&255,Z[G++]=q&255;if(J===2)q=F2[$.charCodeAt(B)]<<2|F2[$.charCodeAt(B+1)]>>4,Z[G++]=q&255;if(J===1)q=F2[$.charCodeAt(B)]<<10|F2[$.charCodeAt(B+1)]<<4|F2[$.charCodeAt(B+2)]>>2,Z[G++]=q>>8&255,Z[G++]=q&255;return Z}function xJ($){return I2[$>>18&63]+I2[$>>12&63]+I2[$>>6&63]+I2[$&63]}function OJ($,q,Q){var K,J=[];for(var Z=q;ZW?W:G+Z));if(K===1)q=$[Q-1],J.push(I2[q>>2]+I2[q<<4&63]+"==");else if(K===2)q=($[Q-2]<<8)+$[Q-1],J.push(I2[q>>10]+I2[q>>4&63]+I2[q<<2&63]+"=");return J.join("")}function Y8($,q,Q,K,J){var Z,G,W=J*8-K-1,B=(1<>1,U=-7,w=Q?J-1:0,F=Q?-1:1,M=$[q+w];w+=F,Z=M&(1<<-U)-1,M>>=-U,U+=W;for(;U>0;Z=Z*256+$[q+w],w+=F,U-=8);G=Z&(1<<-U)-1,Z>>=-U,U+=K;for(;U>0;G=G*256+$[q+w],w+=F,U-=8);if(Z===0)Z=1-V;else if(Z===B)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,K),Z=Z-V;return(M?-1:1)*G*Math.pow(2,Z-K)}function F9($,q,Q,K,J,Z){var G,W,B,V=Z*8-J-1,U=(1<>1,F=J===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:Z-1,k=K?1:-1,f=q<0||q===0&&1/q<0?1:0;if(q=Math.abs(q),isNaN(q)||q===1/0)W=isNaN(q)?1:0,G=U;else{if(G=Math.floor(Math.log(q)/Math.LN2),q*(B=Math.pow(2,-G))<1)G--,B*=2;if(G+w>=1)q+=F/B;else q+=F*Math.pow(2,1-w);if(q*B>=2)G++,B/=2;if(G+w>=U)W=0,G=U;else if(G+w>=1)W=(q*B-1)*Math.pow(2,J),G=G+w;else W=q*Math.pow(2,w-1)*Math.pow(2,J),G=0}for(;J>=8;$[Q+M]=W&255,M+=k,W/=256,J-=8);G=G<0;$[Q+M]=G&255,M+=k,G/=256,V-=8);$[Q+M-k]|=f*128}function S2($){if($>y6)throw RangeError('The value "'+$+'" is invalid for option "size"');let q=new Uint8Array($);return Object.setPrototypeOf(q,o.prototype),q}function x5($,q,Q){return class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:q.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}function o($,q,Q){if(typeof $==="number"){if(typeof q==="string")throw TypeError('The "string" argument must be of type string. Received type number');return O5($)}return N9($,q,Q)}function N9($,q,Q){if(typeof $==="string")return nJ($,q);if(ArrayBuffer.isView($))return dJ($);if($==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(C2($,ArrayBuffer)||$&&C2($.buffer,ArrayBuffer))return y5($,q,Q);if(typeof SharedArrayBuffer<"u"&&(C2($,SharedArrayBuffer)||$&&C2($.buffer,SharedArrayBuffer)))return y5($,q,Q);if(typeof $==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=$.valueOf&&$.valueOf();if(K!=null&&K!==$)return o.from(K,q,Q);let J=mJ($);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]==="function")return o.from($[Symbol.toPrimitive]("string"),q,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}function Y9($){if(typeof $!=="number")throw TypeError('"size" argument must be of type number');else if($<0)throw RangeError('The value "'+$+'" is invalid for option "size"')}function bJ($,q,Q){if(Y9($),$<=0)return S2($);if(q!==void 0)return typeof Q==="string"?S2($).fill(q,Q):S2($).fill(q);return S2($)}function O5($){return Y9($),S2($<0?0:P5($)|0)}function nJ($,q){if(typeof q!=="string"||q==="")q="utf8";if(!o.isEncoding(q))throw TypeError("Unknown encoding: "+q);let Q=k9($,q)|0,K=S2(Q),J=K.write($,q);if(J!==Q)K=K.slice(0,J);return K}function X5($){let q=$.length<0?0:P5($.length)|0,Q=S2(q);for(let K=0;K=y6)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y6.toString(16)+" bytes");return $|0}function k9($,q){if(o.isBuffer($))return $.length;if(ArrayBuffer.isView($)||C2($,ArrayBuffer))return $.byteLength;if(typeof $!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let Q=$.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&Q===0)return 0;let J=!1;for(;;)switch(q){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return h5($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return j9($).length;default:if(J)return K?-1:h5($).length;q=(""+q).toLowerCase(),J=!0}}function pJ($,q,Q){let K=!1;if(q===void 0||q<0)q=0;if(q>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,q>>>=0,Q<=q)return"";if(!$)$="utf8";while(!0)switch($){case"hex":return QV(this,q,Q);case"utf8":case"utf-8":return L9(this,q,Q);case"ascii":return eJ(this,q,Q);case"latin1":case"binary":return $V(this,q,Q);case"base64":return sJ(this,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qV(this,q,Q);default:if(K)throw TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),K=!0}}function w1($,q,Q){let K=$[q];$[q]=$[Q],$[Q]=K}function D9($,q,Q,K,J){if($.length===0)return-1;if(typeof Q==="string")K=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,Number.isNaN(Q))Q=J?0:$.length-1;if(Q<0)Q=$.length+Q;if(Q>=$.length)if(J)return-1;else Q=$.length-1;else if(Q<0)if(J)Q=0;else return-1;if(typeof q==="string")q=o.from(q,K);if(o.isBuffer(q)){if(q.length===0)return-1;return W9($,q,Q,K,J)}else if(typeof q==="number"){if(q=q&255,typeof Uint8Array.prototype.indexOf==="function")if(J)return Uint8Array.prototype.indexOf.call($,q,Q);else return Uint8Array.prototype.lastIndexOf.call($,q,Q);return W9($,[q],Q,K,J)}throw TypeError("val must be string, number or Buffer")}function W9($,q,Q,K,J){let Z=1,G=$.length,W=q.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if($.length<2||q.length<2)return-1;Z=2,G/=2,W/=2,Q/=2}}function B(U,w){if(Z===1)return U[w];else return U.readUInt16BE(w*Z)}let V;if(J){let U=-1;for(V=Q;VG)Q=G-W;for(V=Q;V>=0;V--){let U=!0;for(let w=0;wJ)K=J;let Z=q.length;if(K>Z/2)K=Z/2;let G;for(G=0;G239?4:Z>223?3:Z>191?2:1;if(J+W<=Q){let B,V,U,w;switch(W){case 1:if(Z<128)G=Z;break;case 2:if(B=$[J+1],(B&192)===128){if(w=(Z&31)<<6|B&63,w>127)G=w}break;case 3:if(B=$[J+1],V=$[J+2],(B&192)===128&&(V&192)===128){if(w=(Z&15)<<12|(B&63)<<6|V&63,w>2047&&(w<55296||w>57343))G=w}break;case 4:if(B=$[J+1],V=$[J+2],U=$[J+3],(B&192)===128&&(V&192)===128&&(U&192)===128){if(w=(Z&15)<<18|(B&63)<<12|(V&63)<<6|U&63,w>65535&&w<1114112)G=w}}}if(G===null)G=65533,W=1;else if(G>65535)G-=65536,K.push(G>>>10&1023|55296),G=56320|G&1023;K.push(G),J+=W}return tJ(K)}function tJ($){let q=$.length;if(q<=B9)return String.fromCharCode.apply(String,$);let Q="",K=0;while(KK)Q=K;let J="";for(let Z=q;ZQ)throw RangeError("Trying to access beyond buffer length")}function s0($,q,Q,K,J,Z){if(!o.isBuffer($))throw TypeError('"buffer" argument must be a Buffer instance');if(q>J||q$.length)throw RangeError("Index out of range")}function H9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,Q}function v9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q+7]=Z,Z=Z>>8,$[Q+6]=Z,Z=Z>>8,$[Q+5]=Z,Z=Z>>8,$[Q+4]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q+3]=G,G=G>>8,$[Q+2]=G,G=G>>8,$[Q+1]=G,G=G>>8,$[Q]=G,Q+8}function f9($,q,Q,K,J,Z){if(Q+K>$.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function R9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return F9($,q,Q,K,23,4),Q+4}function I9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return F9($,q,Q,K,52,8),Q+8}function z9($){let q="",Q=$.length,K=$[0]==="-"?1:0;for(;Q>=K+4;Q-=3)q=`_${$.slice(Q-3,Q)}${q}`;return`${$.slice(0,Q)}${q}`}function KV($,q,Q){if(n1(q,"offset"),$[q]===void 0||$[q+Q]===void 0)h6(q,$.length-(Q+1))}function C9($,q,Q,K,J,Z){if($>Q||$3)if(q===0||q===BigInt(0))W=`>= 0${G} and < 2${G} ** ${(Z+1)*8}${G}`;else W=`>= -(2${G} ** ${(Z+1)*8-1}${G}) and < 2 ** ${(Z+1)*8-1}${G}`;else W=`>= ${q}${G} and <= ${Q}${G}`;throw new A5("value",W,$)}KV(K,J,Z)}function n1($,q){if(typeof $!=="number")throw new cJ(q,"number",$)}function h6($,q,Q){if(Math.floor($)!==$)throw n1($,Q),new A5(Q||"offset","an integer",$);if(q<0)throw new _J;throw new A5(Q||"offset",`>= ${Q?1:0} and <= ${q}`,$)}function VV($){if($=$.split("=")[0],$=$.trim().replace(JV,""),$.length<2)return"";while($.length%4!==0)$=$+"=";return $}function h5($,q){q=q||1/0;let Q,K=$.length,J=null,Z=[];for(let G=0;G55295&&Q<57344){if(!J){if(Q>56319){if((q-=3)>-1)Z.push(239,191,189);continue}else if(G+1===K){if((q-=3)>-1)Z.push(239,191,189);continue}J=Q;continue}if(Q<56320){if((q-=3)>-1)Z.push(239,191,189);J=Q;continue}Q=(J-55296<<10|Q-56320)+65536}else if(J){if((q-=3)>-1)Z.push(239,191,189)}if(J=null,Q<128){if((q-=1)<0)break;Z.push(Q)}else if(Q<2048){if((q-=2)<0)break;Z.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((q-=3)<0)break;Z.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((q-=4)<0)break;Z.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return Z}function UV($){let q=[];for(let Q=0;Q<$.length;++Q)q.push($.charCodeAt(Q)&255);return q}function ZV($,q){let Q,K,J,Z=[];for(let G=0;G<$.length;++G){if((q-=2)<0)break;Q=$.charCodeAt(G),K=Q>>8,J=Q%256,Z.push(J),Z.push(K)}return Z}function j9($){return hJ(VV($))}function k8($,q,Q,K){let J;for(J=0;J=q.length||J>=$.length)break;q[J+Q]=$[J]}return J}function C2($,q){return $ instanceof q||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===q.name}function l2($){return typeof BigInt>"u"?WV:$}function WV(){throw Error("BigInt not supported")}function T5($){return()=>{throw Error($+" is not implemented for node:buffer browser polyfill")}}var I2,F2,g5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M1,U9,G9,M9=50,y6=2147483647,w9=536870888,PJ,TJ,uJ,SJ,EJ,_J,cJ,A5,B9=4096,JV,GV,BV,zV,FV=($)=>{for(let q of $)if(q.charCodeAt(0)>127)return!1;return!0},MV,wV;var t0=b1(()=>{I2=[],F2=[];for(M1=0,U9=g5.length;M14294967296)J=z9(String(Q));else if(typeof Q==="bigint"){if(J=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))J=z9(J);J+="n"}return K+=` It must be ${q}. Received ${J}`,K},RangeError);Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.buffer}});Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.byteOffset}});o.poolSize=8192;o.from=function($,q,Q){return N9($,q,Q)};Object.setPrototypeOf(o.prototype,Uint8Array.prototype);Object.setPrototypeOf(o,Uint8Array);o.alloc=function($,q,Q){return bJ($,q,Q)};o.allocUnsafe=function($){return O5($)};o.allocUnsafeSlow=function($){return O5($)};o.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==o.prototype};o.compare=function($,q){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(C2(q,Uint8Array))q=o.from(q,q.offset,q.byteLength);if(!o.isBuffer($)||!o.isBuffer(q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===q)return 0;let Q=$.length,K=q.length;for(let J=0,Z=Math.min(Q,K);JK.length){if(!o.isBuffer(Z))Z=o.from(Z);Z.copy(K,J)}else Uint8Array.prototype.set.call(K,Z,J);else if(!o.isBuffer(Z))throw TypeError('"list" argument must be an Array of Buffers');else Z.copy(K,J);J+=Z.length}return K};o.byteLength=k9;o.prototype._isBuffer=!0;o.prototype.swap16=function(){let $=this.length;if($%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let q=0;q<$;q+=2)w1(this,q,q+1);return this};o.prototype.swap32=function(){let $=this.length;if($%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let q=0;q<$;q+=4)w1(this,q,q+3),w1(this,q+1,q+2);return this};o.prototype.swap64=function(){let $=this.length;if($%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let q=0;q<$;q+=8)w1(this,q,q+7),w1(this,q+1,q+6),w1(this,q+2,q+5),w1(this,q+3,q+4);return this};o.prototype.toString=function(){let $=this.length;if($===0)return"";if(arguments.length===0)return L9(this,0,$);return pJ.apply(this,arguments)};o.prototype.toLocaleString=o.prototype.toString;o.prototype.equals=function($){if(!o.isBuffer($))throw TypeError("Argument must be a Buffer");if(this===$)return!0;return o.compare(this,$)===0};o.prototype.inspect=function(){let $="",q=M9;if($=this.toString("hex",0,q).replace(/(.{2})/g,"$1 ").trim(),this.length>q)$+=" ... ";return""};if(G9)o.prototype[G9]=o.prototype.inspect;o.prototype.compare=function($,q,Q,K,J){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(!o.isBuffer($))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(q===void 0)q=0;if(Q===void 0)Q=$?$.length:0;if(K===void 0)K=0;if(J===void 0)J=this.length;if(q<0||Q>$.length||K<0||J>this.length)throw RangeError("out of range index");if(K>=J&&q>=Q)return 0;if(K>=J)return-1;if(q>=Q)return 1;if(q>>>=0,Q>>>=0,K>>>=0,J>>>=0,this===$)return 0;let Z=J-K,G=Q-q,W=Math.min(Z,G),B=this.slice(K,J),V=$.slice(q,Q);for(let U=0;U>>0,isFinite(Q)){if(Q=Q>>>0,K===void 0)K="utf8"}else K=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let J=this.length-q;if(Q===void 0||Q>J)Q=J;if($.length>0&&(Q<0||q<0)||q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let Z=!1;for(;;)switch(K){case"hex":return iJ(this,$,q,Q);case"utf8":case"utf-8":return oJ(this,$,q,Q);case"ascii":case"latin1":case"binary":return aJ(this,$,q,Q);case"base64":return lJ(this,$,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rJ(this,$,q,Q);default:if(Z)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),Z=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};o.prototype.slice=function($,q){let Q=this.length;if($=~~$,q=q===void 0?Q:~~q,$<0){if($+=Q,$<0)$=0}else if($>Q)$=Q;if(q<0){if(q+=Q,q<0)q=0}else if(q>Q)q=Q;if(q<$)q=$;let K=this.subarray($,q);return Object.setPrototypeOf(K,o.prototype),K};o.prototype.readUintLE=o.prototype.readUIntLE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$+--q],J=1;while(q>0&&(J*=256))K+=this[$+--q]*J;return K};o.prototype.readUint8=o.prototype.readUInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);return this[$]};o.prototype.readUint16LE=o.prototype.readUInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]|this[$+1]<<8};o.prototype.readUint16BE=o.prototype.readUInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]<<8|this[$+1]};o.prototype.readUint32LE=o.prototype.readUInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216};o.prototype.readUint32BE=o.prototype.readUInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])};o.prototype.readBigUInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q+this[++$]*256+this[++$]*65536+this[++$]*16777216,J=this[++$]+this[++$]*256+this[++$]*65536+Q*16777216;return BigInt(K)+(BigInt(J)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q*16777216+this[++$]*65536+this[++$]*256+this[++$],J=this[++$]*16777216+this[++$]*65536+this[++$]*256+Q;return(BigInt(K)<>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z=J)K-=Math.pow(2,8*q);return K};o.prototype.readIntBE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=q,J=1,Z=this[$+--K];while(K>0&&(J*=256))Z+=this[$+--K]*J;if(J*=128,Z>=J)Z-=Math.pow(2,8*q);return Z};o.prototype.readInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);if(!(this[$]&128))return this[$];return(255-this[$]+1)*-1};o.prototype.readInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$]|this[$+1]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$+1]|this[$]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24};o.prototype.readInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]};o.prototype.readBigInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=this[$+4]+this[$+5]*256+this[$+6]*65536+(Q<<24);return(BigInt(K)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=(q<<24)+this[++$]*65536+this[++$]*256+this[++$];return(BigInt(K)<>>0,!q)b0($,4,this.length);return Y8(this,$,!0,23,4)};o.prototype.readFloatBE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return Y8(this,$,!1,23,4)};o.prototype.readDoubleLE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!0,52,8)};o.prototype.readDoubleBE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!1,52,8)};o.prototype.writeUintLE=o.prototype.writeUIntLE=function($,q,Q,K){if($=+$,q=q>>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=1,Z=0;this[q]=$&255;while(++Z>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=Q-1,Z=1;this[q+J]=$&255;while(--J>=0&&(Z*=256))this[q+J]=$/Z&255;return q+Q};o.prototype.writeUint8=o.prototype.writeUInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,255,0);return this[q]=$&255,q+1};o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q+3]=$>>>24,this[q+2]=$>>>16,this[q+1]=$>>>8,this[q]=$&255,q+4};o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigUInt64LE=l2(function($,q=0){return H9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeBigUInt64BE=l2(function($,q=0){return v9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeIntLE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=0,Z=1,G=0;this[q]=$&255;while(++J>0)-G&255}return q+Q};o.prototype.writeIntBE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=Q-1,Z=1,G=0;this[q+J]=$&255;while(--J>=0&&(Z*=256)){if($<0&&G===0&&this[q+J+1]!==0)G=1;this[q+J]=($/Z>>0)-G&255}return q+Q};o.prototype.writeInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,127,-128);if($<0)$=255+$+1;return this[q]=$&255,q+1};o.prototype.writeInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);return this[q]=$&255,this[q+1]=$>>>8,this[q+2]=$>>>16,this[q+3]=$>>>24,q+4};o.prototype.writeInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);if($<0)$=4294967295+$+1;return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigInt64LE=l2(function($,q=0){return H9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeBigInt64BE=l2(function($,q=0){return v9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeFloatLE=function($,q,Q){return R9(this,$,q,!0,Q)};o.prototype.writeFloatBE=function($,q,Q){return R9(this,$,q,!1,Q)};o.prototype.writeDoubleLE=function($,q,Q){return I9(this,$,q,!0,Q)};o.prototype.writeDoubleBE=function($,q,Q){return I9(this,$,q,!1,Q)};o.prototype.copy=function($,q,Q,K){if(!o.isBuffer($))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!K&&K!==0)K=this.length;if(q>=$.length)q=$.length;if(!q)q=0;if(K>0&&K=this.length)throw RangeError("Index out of range");if(K<0)throw RangeError("sourceEnd out of bounds");if(K>this.length)K=this.length;if($.length-q>>0,Q=Q===void 0?this.length:Q>>>0,!$)$=0;let J;if(typeof $==="number")for(J=q;J{var S0=y9.exports={},j2,g2;function u5(){throw Error("setTimeout has not been defined")}function S5(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")j2=setTimeout;else j2=u5}catch($){j2=u5}try{if(typeof clearTimeout==="function")g2=clearTimeout;else g2=S5}catch($){g2=S5}})();function g9($){if(j2===setTimeout)return setTimeout($,0);if((j2===u5||!j2)&&setTimeout)return j2=setTimeout,setTimeout($,0);try{return j2($,0)}catch(q){try{return j2.call(null,$,0)}catch(Q){return j2.call(this,$,0)}}}function NV($){if(g2===clearTimeout)return clearTimeout($);if((g2===S5||!g2)&&clearTimeout)return g2=clearTimeout,clearTimeout($);try{return g2($)}catch(q){try{return g2.call(null,$)}catch(Q){return g2.call(this,$)}}}var E2=[],d1=!1,N1,D8=-1;function YV(){if(!d1||!N1)return;if(d1=!1,N1.length)E2=N1.concat(E2);else D8=-1;if(E2.length)A9()}function A9(){if(d1)return;var $=g9(YV);d1=!0;var q=E2.length;while(q){N1=E2,E2=[];while(++D81)for(var Q=1;Qn9,once:()=>c9,listenerCount:()=>d9,init:()=>r2,getMaxListeners:()=>p9,getEventListeners:()=>b9,default:()=>CV,captureRejectionSymbol:()=>u9,addAbortListener:()=>i9,EventEmitter:()=>r2});function S9($,q){var{_events:Q}=$;if(q[0]??=Error("Unhandled error."),!Q)throw q[0];var K=Q[T9];if(K)for(var J of O9.call(K))J.apply($,q);var Z=Q.error;if(!Z)throw q[0];for(var J of O9.call(Z))J.apply($,q);return!0}function LV($,q,Q,K){q.then(void 0,function(J){queueMicrotask(()=>HV($,J,Q,K))})}function HV($,q,Q,K){if(typeof $[x9]==="function")$[x9](q,Q,...K);else try{$[Y1]=!1,$.emit("error",q)}finally{$[Y1]=!0}}function E9($,q,Q){Q.warned=!0;let K=Error(`Possible EventEmitter memory leak detected. ${Q.length} ${String(q)} listeners added to [${$.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=$,K.type=q,K.count=Q.length,console.warn(K)}function _9($,q,...Q){this.removeListener($,q),q.apply(this,Q)}function c9($,q,Q){var K=Q?.signal;if(m9(K,"options.signal"),K?.aborted)throw new E5(void 0,{cause:K?.reason});let{resolve:J,reject:Z,promise:G}=$newPromiseCapability(Promise),W=(U)=>{if($.removeListener(q,B),K!=null)L8(K,"abort",V);Z(U)},B=(...U)=>{if(typeof $.removeListener==="function")$.removeListener("error",W);if(K!=null)L8(K,"abort",V);J(U)};if(P9($,q,B,{once:!0}),q!=="error"&&typeof $.once==="function")$.once("error",W);function V(){L8($,q,B),L8($,"error",W),Z(new E5(void 0,{cause:K?.reason}))}if(K!=null)P9(K,"abort",V,{once:!0});return G}function b9($,q){return $.listeners(q)}function n9($,...q){c5($,"setMaxListeners",0);var Q;if(q&&(Q=q.length))for(let K=0;KK||(Q!=null||K!=null)&&Number.isNaN($))throw RV(q,`${Q!=null?`>= ${Q}`:""}${Q!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,$)}function x6($){if(typeof $!=="function")throw TypeError("The listener must be a function")}function IV($,q){if(typeof $!=="boolean")throw m1(q,"boolean",$)}function p9($){return $?._maxListeners??k1}function i9($,q){if($===void 0)throw m1("signal","AbortSignal",$);if(m9($,"signal"),typeof q!=="function")throw m1("listener","function",q);let Q;if($.aborted)queueMicrotask(()=>q());else $.addEventListener("abort",q,{__proto__:null,once:!0}),Q=()=>{$.removeEventListener("abort",q)};return{__proto__:null,[Symbol.dispose](){Q?.()}}}var _5,Y1,T9,kV,DV,x9,u9,O9,k1=10,r2=function($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[Y1]=$?.captureRejections?Boolean($?.captureRejections):y0[Y1])this.emit=fV},y0,vV=function($,...q){if($==="error")return S9(this,q);var{_events:Q}=this;if(Q===void 0)return!1;var K=Q[$];if(K===void 0)return!1;let J=K.length>1?K.slice():K;for(let Z=0,{length:G}=J;Z1?K.slice():K;for(let Z=0,{length:G}=J;Z{_5=Symbol.for,Y1=Symbol("kCapture"),T9=_5("events.errorMonitor"),kV=Symbol("events.maxEventTargetListeners"),DV=Symbol("events.maxEventTargetListenersWarned"),x9=_5("nodejs.rejection"),u9=_5("nodejs.rejection"),O9=Array.prototype.slice,y0=r2.prototype={};y0._events=void 0;y0._eventsCount=0;y0._maxListeners=void 0;y0.setMaxListeners=function($){return c5($,"setMaxListeners",0),this._maxListeners=$,this};y0.constructor=r2;y0.getMaxListeners=function(){return this?._maxListeners??k1};y0.emit=vV;y0.addListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.push(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.on=y0.addListener;y0.prependListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.unshift(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.once=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.addListener($,Q),this};y0.prependOnceListener=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.prependListener($,Q),this};y0.removeListener=function($,q){x6(q);var{_events:Q}=this;if(!Q)return this;var K=Q[$];if(!K)return this;var J=K.length;let Z=-1;for(let G=J-1;G>=0;G--)if(K[G]===q||K[G].listener===q){Z=G;break}if(Z<0)return this;if(Z===0)K.shift();else K.splice(Z,1);if(K.length===0)delete Q[$],this._eventsCount--;return this};y0.off=y0.removeListener;y0.removeAllListeners=function($){var{_events:q}=this;if($&&q){if(q[$])delete q[$],this._eventsCount--}else this._events={__proto__:null};return this};y0.listeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.map((K)=>K.listener??K)};y0.rawListeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.slice()};y0.listenerCount=function($){var{_events:q}=this;if(!q)return 0;return q[$]?.length??0};y0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};y0[Y1]=!1;E5=class E5 extends Error{constructor($="The operation was aborted",q=void 0){if(q!==void 0&&typeof q!=="object")throw m1("options","Object",q);super($,q);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(r2,{captureRejections:{get(){return y0[Y1]},set($){IV($,"EventEmitter.captureRejections"),y0[Y1]=$},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return k1},set:($)=>{c5($,"defaultMaxListeners",0),k1=$}},kMaxEventTargetListeners:{value:kV,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:DV,enumerable:!1,configurable:!1,writable:!1}});Object.assign(r2,{once:c9,getEventListeners:b9,getMaxListeners:p9,setMaxListeners:n9,EventEmitter:r2,usingDomains:!1,captureRejectionSymbol:u9,errorMonitor:T9,addAbortListener:i9,init:r2,listenerCount:d9});CV=r2});var a1=N0((Yz,$$)=>{var g0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),P0=g0(($,q)=>{class Q extends Error{constructor(K){if(!Array.isArray(K))throw TypeError(`Expected input to be an Array, got ${typeof K}`);let J="";for(let Z=0;Z{q.exports={format(Q,...K){return Q.replace(/%([sdifj])/g,function(...[J,Z]){let G=K.shift();if(Z==="f")return G.toFixed(6);else if(Z==="j")return JSON.stringify(G);else if(Z==="s"&&typeof G==="object")return`${G.constructor!==Object?G.constructor.name:""} {}`.trim();else return G.toString()})},inspect(Q){switch(typeof Q){case"string":if(Q.includes("'")){if(!Q.includes('"'))return`"${Q}"`;else if(!Q.includes("`")&&!Q.includes("${"))return`\`${Q}\``}return`'${Q}'`;case"number":if(isNaN(Q))return"NaN";else if(Object.is(Q,-0))return String(Q);return Q;case"bigint":return`${String(Q)}n`;case"boolean":case"undefined":return String(Q);case"object":return"{}"}}}}),a0=g0(($,q)=>{var{format:Q,inspect:K}=o9(),{AggregateError:J}=P0(),Z=globalThis.AggregateError||J,G=Symbol("kIsNodeError"),W=["string","function","number","object","Function","Object","boolean","bigint","symbol"],B=/^([A-Z][a-z0-9]*)+$/,V={};function U(D,z){if(!D)throw new V.ERR_INTERNAL_ASSERTION(z)}function w(D){let z="",N=D.length,H=D[0]==="-"?1:0;for(;N>=H+4;N-=3)z=`_${D.slice(N-3,N)}${z}`;return`${D.slice(0,N)}${z}`}function F(D,z,N){if(typeof z==="function")return U(z.length<=N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${z.length}).`),z(...N);let H=(z.match(/%[dfijoOs]/g)||[]).length;if(U(H===N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${H}).`),N.length===0)return z;return Q(z,...N)}function M(D,z,N){if(!N)N=Error;class H extends N{constructor(...v){super(F(D,z,v))}toString(){return`${this.name} [${D}]: ${this.message}`}}Object.defineProperties(H.prototype,{name:{value:N.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${D}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),H.prototype.code=D,H.prototype[G]=!0,V[D]=H}function k(D){let z="__node_internal_"+D.name;return Object.defineProperty(D,"name",{value:z}),D}function f(D,z){if(D&&z&&D!==z){if(Array.isArray(z.errors))return z.errors.push(D),z;let N=new Z([z,D],z.message);return N.code=z.code,N}return D||z}class L extends Error{constructor(D="The operation was aborted",z=void 0){if(z!==void 0&&typeof z!=="object")throw new V.ERR_INVALID_ARG_TYPE("options","Object",z);super(D,z);this.code="ABORT_ERR",this.name="AbortError"}}M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(D,z,N)=>{if(U(typeof D==="string","'name' must be a string"),!Array.isArray(z))z=[z];let H="The ";if(D.endsWith(" argument"))H+=`${D} `;else H+=`"${D}" ${D.includes(".")?"property":"argument"} `;H+="must be ";let v=[],j=[],n=[];for(let _ of z)if(U(typeof _==="string","All expected entries have to be of type string"),W.includes(_))v.push(_.toLowerCase());else if(B.test(_))j.push(_);else U(_!=="object",'The value "object" should be written as "Object"'),n.push(_);if(j.length>0){let _=v.indexOf("object");if(_!==-1)v.splice(v,_,1),j.push("Object")}if(v.length>0){switch(v.length){case 1:H+=`of type ${v[0]}`;break;case 2:H+=`one of type ${v[0]} or ${v[1]}`;break;default:{let _=v.pop();H+=`one of type ${v.join(", ")}, or ${_}`}}if(j.length>0||n.length>0)H+=" or "}if(j.length>0){switch(j.length){case 1:H+=`an instance of ${j[0]}`;break;case 2:H+=`an instance of ${j[0]} or ${j[1]}`;break;default:{let _=j.pop();H+=`an instance of ${j.join(", ")}, or ${_}`}}if(n.length>0)H+=" or "}switch(n.length){case 0:break;case 1:if(n[0].toLowerCase()!==n[0])H+="an ";H+=`${n[0]}`;break;case 2:H+=`one of ${n[0]} or ${n[1]}`;break;default:{let _=n.pop();H+=`one of ${n.join(", ")}, or ${_}`}}if(N==null)H+=`. Received ${N}`;else if(typeof N==="function"&&N.name)H+=`. Received function ${N.name}`;else if(typeof N==="object"){var d;if((d=N.constructor)!==null&&d!==void 0&&d.name)H+=`. Received an instance of ${N.constructor.name}`;else{let _=K(N,{depth:-1});H+=`. Received ${_}`}}else{let _=K(N,{colors:!1});if(_.length>25)_=`${_.slice(0,25)}...`;H+=`. Received type ${typeof N} (${_})`}return H},TypeError),M("ERR_INVALID_ARG_VALUE",(D,z,N="is invalid")=>{let H=K(z);if(H.length>128)H=H.slice(0,128)+"...";return`The ${D.includes(".")?"property":"argument"} '${D}' ${N}. Received ${H}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(D,z,N)=>{var H;let v=N!==null&&N!==void 0&&(H=N.constructor)!==null&&H!==void 0&&H.name?`instance of ${N.constructor.name}`:`type ${typeof N}`;return`Expected ${D} to be returned from the "${z}" function but got ${v}.`},TypeError),M("ERR_MISSING_ARGS",(...D)=>{U(D.length>0,"At least one arg needs to be specified");let z,N=D.length;switch(D=(Array.isArray(D)?D:[D]).map((H)=>`"${H}"`).join(" or "),N){case 1:z+=`The ${D[0]} argument`;break;case 2:z+=`The ${D[0]} and ${D[1]} arguments`;break;default:{let H=D.pop();z+=`The ${D.join(", ")}, and ${H} arguments`}break}return`${z} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(D,z,N)=>{U(z,'Missing "range" argument');let H;if(Number.isInteger(N)&&Math.abs(N)>4294967296)H=w(String(N));else if(typeof N==="bigint"){H=String(N);let v=BigInt(2)**BigInt(32);if(N>v||N<-v)H=w(H);H+="n"}else H=K(N);return`The value of "${D}" is out of range. It must be ${z}. Received ${H}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),q.exports={AbortError:L,aggregateTwoErrors:k(f),hideStackFrames:k,codes:V}}),jV=g0(($,q)=>{Object.defineProperty($,"__esModule",{value:!0});var Q=new WeakMap,K=new WeakMap;function J(X){let P=Q.get(X);return console.assert(P!=null,"'this' is expected an Event object, but got",X),P}function Z(X){if(X.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",X.passiveListener);return}if(!X.event.cancelable)return;if(X.canceled=!0,typeof X.event.preventDefault==="function")X.event.preventDefault()}function G(X,P){Q.set(this,{eventTarget:X,event:P,eventPhase:2,currentTarget:X,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:P.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let g=Object.keys(P);for(let c=0;c0){let X=Array(arguments.length);for(let P=0;P{Object.defineProperty($,"__esModule",{value:!0});var Q=jV();class K extends Q.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let U=G.get(this);if(typeof U!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return U}}Q.defineEventAttribute(K.prototype,"abort");function J(){let U=Object.create(K.prototype);return Q.EventTarget.call(U),G.set(U,!1),U}function Z(U){if(G.get(U)!==!1)return;G.set(U,!0),U.dispatchEvent({type:"abort"})}var G=new WeakMap;if(Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class W{constructor(){B.set(this,J())}get signal(){return V(this)}abort(){Z(V(this))}}var B=new WeakMap;function V(U){let w=B.get(U);if(w==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${U===null?"null":typeof U}`);return w}if(Object.defineProperties(W.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(W.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});$.AbortController=W,$.AbortSignal=K,$.default=W,q.exports=W,q.exports.AbortController=q.exports.default=W,q.exports.AbortSignal=K}),e0=g0(($,q)=>{var Q=(t0(),X0(K2)),{format:K,inspect:J}=o9(),{codes:{ERR_INVALID_ARG_TYPE:Z}}=a0(),{kResistStopPropagation:G,AggregateError:W,SymbolDispose:B}=P0(),V=globalThis.AbortSignal||O6().AbortSignal,U=globalThis.AbortController||O6().AbortController,w=Object.getPrototypeOf(async function(){}).constructor,F=globalThis.Blob||Q.Blob,M=typeof F<"u"?function(L){return L instanceof F}:function(L){return!1},k=(L,D)=>{if(L!==void 0&&(L===null||typeof L!=="object"||!("aborted"in L)))throw new Z(D,"AbortSignal",L)},f=(L,D)=>{if(typeof L!=="function")throw new Z(D,"Function",L)};q.exports={AggregateError:W,kEmptyObject:Object.freeze({}),once(L){let D=!1;return function(...z){if(D)return;D=!0,L.apply(this,z)}},createDeferredPromise:function(){let L,D;return{promise:new Promise((z,N)=>{L=z,D=N}),resolve:L,reject:D}},promisify(L){return new Promise((D,z)=>{L((N,...H)=>{if(N)return z(N);return D(...H)})})},debuglog(){return function(){}},format:K,inspect:J,types:{isAsyncFunction(L){return L instanceof w},isArrayBufferView(L){return ArrayBuffer.isView(L)}},isBlob:M,deprecate(L,D){return L},addAbortListener:(i1(),X0(p1)).addAbortListener||function(L,D){if(L===void 0)throw new Z("signal","AbortSignal",L);k(L,"signal"),f(D,"listener");let z;if(L.aborted)queueMicrotask(()=>D());else L.addEventListener("abort",D,{__proto__:null,once:!0,[G]:!0}),z=()=>{L.removeEventListener("abort",D)};return{__proto__:null,[B](){var N;(N=z)===null||N===void 0||N()}}},AbortSignalAny:V.any||function(L){if(L.length===1)return L[0];let D=new U,z=()=>D.abort();return L.forEach((N)=>{k(N,"signals"),N.addEventListener("abort",z,{once:!0})}),D.signal.addEventListener("abort",()=>{L.forEach((N)=>N.removeEventListener("abort",z))},{once:!0}),D.signal}},q.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),P6=g0(($,q)=>{var{ArrayIsArray:Q,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:J,ArrayPrototypeMap:Z,NumberIsInteger:G,NumberIsNaN:W,NumberMAX_SAFE_INTEGER:B,NumberMIN_SAFE_INTEGER:V,NumberParseInt:U,ObjectPrototypeHasOwnProperty:w,RegExpPrototypeExec:F,String:M,StringPrototypeToUpperCase:k,StringPrototypeTrim:f}=P0(),{hideStackFrames:L,codes:{ERR_SOCKET_BAD_PORT:D,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:N,ERR_OUT_OF_RANGE:H,ERR_UNKNOWN_SIGNAL:v}}=a0(),{normalizeEncoding:j}=e0(),{isAsyncFunction:n,isArrayBufferView:d}=e0().types,_={};function X(T){return T===(T|0)}function P(T){return T===T>>>0}var g=/^[0-7]+$/,c="must be a 32-bit unsigned integer or an octal string";function h(T,t,G0){if(typeof T>"u")T=G0;if(typeof T==="string"){if(F(g,T)===null)throw new N(t,T,c);T=U(T,8)}return $0(T,t),T}var x=L((T,t,G0=V,Q0=B)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),l=L((T,t,G0=-2147483648,Q0=2147483647)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),$0=L((T,t,G0=!1)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);let Q0=G0?1:0,M0=4294967295;if(TM0)throw new H(t,`>= ${Q0} && <= ${M0}`,T)});function Z0(T,t){if(typeof T!=="string")throw new z(t,"string",T)}function F0(T,t,G0=void 0,Q0){if(typeof T!=="number")throw new z(t,"number",T);if(G0!=null&&TQ0||(G0!=null||Q0!=null)&&W(T))throw new H(t,`${G0!=null?`>= ${G0}`:""}${G0!=null&&Q0!=null?" && ":""}${Q0!=null?`<= ${Q0}`:""}`,T)}var p=L((T,t,G0)=>{if(!K(G0,T)){let Q0="must be one of: "+J(Z(G0,(M0)=>typeof M0==="string"?`'${M0}'`:M(M0)),", ");throw new N(t,T,Q0)}});function W0(T,t){if(typeof T!=="boolean")throw new z(t,"boolean",T)}function y(T,t,G0){return T==null||!w(T,t)?G0:T[t]}var i=L((T,t,G0=null)=>{let Q0=y(G0,"allowArray",!1),M0=y(G0,"allowFunction",!1);if(!y(G0,"nullable",!1)&&T===null||!Q0&&Q(T)||typeof T!=="object"&&(!M0||typeof T!=="function"))throw new z(t,"Object",T)}),U0=L((T,t)=>{if(T!=null&&typeof T!=="object"&&typeof T!=="function")throw new z(t,"a dictionary",T)}),m=L((T,t,G0=0)=>{if(!Q(T))throw new z(t,"Array",T);if(T.length{if(!d(T))throw new z(t,["Buffer","TypedArray","DataView"],T)});function E(T,t){let G0=j(t),Q0=T.length;if(G0==="hex"&&Q0%2!==0)throw new N("encoding",t,`is invalid for data of length ${Q0}`)}function a(T,t="Port",G0=!0){if(typeof T!=="number"&&typeof T!=="string"||typeof T==="string"&&f(T).length===0||+T!==+T>>>0||T>65535||T===0&&!G0)throw new D(t,T,G0);return T|0}var K0=L((T,t)=>{if(T!==void 0&&(T===null||typeof T!=="object"||!("aborted"in T)))throw new z(t,"AbortSignal",T)}),R=L((T,t)=>{if(typeof T!=="function")throw new z(t,"Function",T)}),Y=L((T,t)=>{if(typeof T!=="function"||n(T))throw new z(t,"Function",T)}),C=L((T,t)=>{if(T!==void 0)throw new z(t,"undefined",T)});function u(T,t,G0){if(!K(G0,T))throw new z(t,`('${J(G0,"|")}')`,T)}var e=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function r(T,t){if(typeof T>"u"||!F(e,T))throw new N(t,T,'must be an array or string of format "; rel=preload; as=style"')}function s(T){if(typeof T==="string")return r(T,"hints"),T;else if(Q(T)){let t=T.length,G0="";if(t===0)return G0;for(let Q0=0;Q0; rel=preload; as=style"')}q.exports={isInt32:X,isUint32:P,parseFileMode:h,validateArray:m,validateStringArray:V0,validateBooleanArray:w0,validateAbortSignalArray:S,validateBoolean:W0,validateBuffer:O,validateDictionary:U0,validateEncoding:E,validateFunction:R,validateInt32:l,validateInteger:x,validateNumber:F0,validateObject:i,validateOneOf:p,validatePlainFunction:Y,validatePort:a,validateSignalName:b,validateString:Z0,validateUint32:$0,validateUndefined:C,validateUnion:u,validateAbortSignal:K0,validateLinkHeaderValue:s}}),D1=g0(($,q)=>{q.exports=globalThis.process}),b2=g0(($,q)=>{var{SymbolAsyncIterator:Q,SymbolIterator:K,SymbolFor:J}=P0(),Z=J("nodejs.stream.destroyed"),G=J("nodejs.stream.errored"),W=J("nodejs.stream.readable"),B=J("nodejs.stream.writable"),V=J("nodejs.stream.disturbed"),U=J("nodejs.webstream.isClosedPromise"),w=J("nodejs.webstream.controllerErrorFunction");function F(y,i=!1){var U0;return!!(y&&typeof y.pipe==="function"&&typeof y.on==="function"&&(!i||typeof y.pause==="function"&&typeof y.resume==="function")&&(!y._writableState||((U0=y._readableState)===null||U0===void 0?void 0:U0.readable)!==!1)&&(!y._writableState||y._readableState))}function M(y){var i;return!!(y&&typeof y.write==="function"&&typeof y.on==="function"&&(!y._readableState||((i=y._writableState)===null||i===void 0?void 0:i.writable)!==!1))}function k(y){return!!(y&&typeof y.pipe==="function"&&y._readableState&&typeof y.on==="function"&&typeof y.write==="function")}function f(y){return y&&(y._readableState||y._writableState||typeof y.write==="function"&&typeof y.on==="function"||typeof y.pipe==="function"&&typeof y.on==="function")}function L(y){return!!(y&&!f(y)&&typeof y.pipeThrough==="function"&&typeof y.getReader==="function"&&typeof y.cancel==="function")}function D(y){return!!(y&&!f(y)&&typeof y.getWriter==="function"&&typeof y.abort==="function")}function z(y){return!!(y&&!f(y)&&typeof y.readable==="object"&&typeof y.writable==="object")}function N(y){return L(y)||D(y)||z(y)}function H(y,i){if(y==null)return!1;if(i===!0)return typeof y[Q]==="function";if(i===!1)return typeof y[K]==="function";return typeof y[Q]==="function"||typeof y[K]==="function"}function v(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!!(y.destroyed||y[Z]||m!==null&&m!==void 0&&m.destroyed)}function j(y){if(!M(y))return null;if(y.writableEnded===!0)return!0;let i=y._writableState;if(i!==null&&i!==void 0&&i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function n(y,i){if(!M(y))return null;if(y.writableFinished===!0)return!0;let U0=y._writableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.finished)!=="boolean")return null;return!!(U0.finished||i===!1&&U0.ended===!0&&U0.length===0)}function d(y){if(!F(y))return null;if(y.readableEnded===!0)return!0;let i=y._readableState;if(!i||i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function _(y,i){if(!F(y))return null;let U0=y._readableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.endEmitted)!=="boolean")return null;return!!(U0.endEmitted||i===!1&&U0.ended===!0&&U0.length===0)}function X(y){if(y&&y[W]!=null)return y[W];if(typeof(y===null||y===void 0?void 0:y.readable)!=="boolean")return null;if(v(y))return!1;return F(y)&&y.readable&&!_(y)}function P(y){if(y&&y[B]!=null)return y[B];if(typeof(y===null||y===void 0?void 0:y.writable)!=="boolean")return null;if(v(y))return!1;return M(y)&&y.writable&&!j(y)}function g(y,i){if(!f(y))return null;if(v(y))return!0;if((i===null||i===void 0?void 0:i.readable)!==!1&&X(y))return!1;if((i===null||i===void 0?void 0:i.writable)!==!1&&P(y))return!1;return!0}function c(y){var i,U0;if(!f(y))return null;if(y.writableErrored)return y.writableErrored;return(i=(U0=y._writableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function h(y){var i,U0;if(!f(y))return null;if(y.readableErrored)return y.readableErrored;return(i=(U0=y._readableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function x(y){if(!f(y))return null;if(typeof y.closed==="boolean")return y.closed;let{_writableState:i,_readableState:U0}=y;if(typeof(i===null||i===void 0?void 0:i.closed)==="boolean"||typeof(U0===null||U0===void 0?void 0:U0.closed)==="boolean")return(i===null||i===void 0?void 0:i.closed)||(U0===null||U0===void 0?void 0:U0.closed);if(typeof y._closed==="boolean"&&l(y))return y._closed;return null}function l(y){return typeof y._closed==="boolean"&&typeof y._defaultKeepAlive==="boolean"&&typeof y._removedConnection==="boolean"&&typeof y._removedContLen==="boolean"}function $0(y){return typeof y._sent100==="boolean"&&l(y)}function Z0(y){var i;return typeof y._consuming==="boolean"&&typeof y._dumped==="boolean"&&((i=y.req)===null||i===void 0?void 0:i.upgradeOrConnect)===void 0}function F0(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!m&&$0(y)||!!(m&&m.autoDestroy&&m.emitClose&&m.closed===!1)}function p(y){var i;return!!(y&&((i=y[V])!==null&&i!==void 0?i:y.readableDidRead||y.readableAborted))}function W0(y){var i,U0,m,V0,w0,S,b,O,E,a;return!!(y&&((i=(U0=(m=(V0=(w0=(S=y[G])!==null&&S!==void 0?S:y.readableErrored)!==null&&w0!==void 0?w0:y.writableErrored)!==null&&V0!==void 0?V0:(b=y._readableState)===null||b===void 0?void 0:b.errorEmitted)!==null&&m!==void 0?m:(O=y._writableState)===null||O===void 0?void 0:O.errorEmitted)!==null&&U0!==void 0?U0:(E=y._readableState)===null||E===void 0?void 0:E.errored)!==null&&i!==void 0?i:(a=y._writableState)===null||a===void 0?void 0:a.errored))}q.exports={isDestroyed:v,kIsDestroyed:Z,isDisturbed:p,kIsDisturbed:V,isErrored:W0,kIsErrored:G,isReadable:X,kIsReadable:W,kIsClosedPromise:U,kControllerErrorFunction:w,kIsWritable:B,isClosed:x,isDuplexNodeStream:k,isFinished:g,isIterable:H,isReadableNodeStream:F,isReadableStream:L,isReadableEnded:d,isReadableFinished:_,isReadableErrored:h,isNodeStream:f,isWebStream:N,isWritable:P,isWritableNodeStream:M,isWritableStream:D,isWritableEnded:j,isWritableFinished:n,isWritableErrored:c,isServerRequest:Z0,isServerResponse:$0,willEmitClose:F0,isTransformStream:z}}),s2=g0(($,q)=>{var Q=D1(),{AbortError:K,codes:J}=a0(),{ERR_INVALID_ARG_TYPE:Z,ERR_STREAM_PREMATURE_CLOSE:G}=J,{kEmptyObject:W,once:B}=e0(),{validateAbortSignal:V,validateFunction:U,validateObject:w,validateBoolean:F}=P6(),{Promise:M,PromisePrototypeThen:k,SymbolDispose:f}=P0(),{isClosed:L,isReadable:D,isReadableNodeStream:z,isReadableStream:N,isReadableFinished:H,isReadableErrored:v,isWritable:j,isWritableNodeStream:n,isWritableStream:d,isWritableFinished:_,isWritableErrored:X,isNodeStream:P,willEmitClose:g,kIsClosedPromise:c}=b2(),h;function x(p){return p.setHeader&&typeof p.abort==="function"}var l=()=>{};function $0(p,W0,y){var i,U0;if(arguments.length===2)y=W0,W0=W;else if(W0==null)W0=W;else w(W0,"options");if(U(y,"callback"),V(W0.signal,"options.signal"),y=B(y),N(p)||d(p))return Z0(p,W0,y);if(!P(p))throw new Z("stream",["ReadableStream","WritableStream","Stream"],p);let m=(i=W0.readable)!==null&&i!==void 0?i:z(p),V0=(U0=W0.writable)!==null&&U0!==void 0?U0:n(p),w0=p._writableState,S=p._readableState,b=()=>{if(!p.writable)a()},O=g(p)&&z(p)===m&&n(p)===V0,E=_(p,!1),a=()=>{if(E=!0,p.destroyed)O=!1;if(O&&(!p.readable||m))return;if(!m||K0)y.call(p)},K0=H(p,!1),R=()=>{if(K0=!0,p.destroyed)O=!1;if(O&&(!p.writable||V0))return;if(!V0||E)y.call(p)},Y=(T)=>{y.call(p,T)},C=L(p),u=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);if(m&&!K0&&z(p,!0)){if(!H(p,!1))return y.call(p,new G)}if(V0&&!E){if(!_(p,!1))return y.call(p,new G)}y.call(p)},e=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);y.call(p)},r=()=>{p.req.on("finish",a)};if(x(p)){if(p.on("complete",a),!O)p.on("abort",u);if(p.req)r();else p.on("request",r)}else if(V0&&!w0)p.on("end",b),p.on("close",b);if(!O&&typeof p.aborted==="boolean")p.on("aborted",u);if(p.on("end",R),p.on("finish",a),W0.error!==!1)p.on("error",Y);if(p.on("close",u),C)Q.nextTick(u);else if(w0!==null&&w0!==void 0&&w0.errorEmitted||S!==null&&S!==void 0&&S.errorEmitted){if(!O)Q.nextTick(e)}else if(!m&&(!O||D(p))&&(E||j(p)===!1))Q.nextTick(e);else if(!V0&&(!O||j(p))&&(K0||D(p)===!1))Q.nextTick(e);else if(S&&p.req&&p.aborted)Q.nextTick(e);let s=()=>{if(y=l,p.removeListener("aborted",u),p.removeListener("complete",a),p.removeListener("abort",u),p.removeListener("request",r),p.req)p.req.removeListener("finish",a);p.removeListener("end",b),p.removeListener("close",b),p.removeListener("finish",a),p.removeListener("end",R),p.removeListener("error",Y),p.removeListener("close",u)};if(W0.signal&&!C){let T=()=>{let t=y;s(),t.call(p,new K(void 0,{cause:W0.signal.reason}))};if(W0.signal.aborted)Q.nextTick(T);else{h=h||e0().addAbortListener;let t=h(W0.signal,T),G0=y;y=B((...Q0)=>{t[f](),G0.apply(p,Q0)})}}return s}function Z0(p,W0,y){let i=!1,U0=l;if(W0.signal)if(U0=()=>{i=!0,y.call(p,new K(void 0,{cause:W0.signal.reason}))},W0.signal.aborted)Q.nextTick(U0);else{h=h||e0().addAbortListener;let V0=h(W0.signal,U0),w0=y;y=B((...S)=>{V0[f](),w0.apply(p,S)})}let m=(...V0)=>{if(!i)Q.nextTick(()=>y.apply(p,V0))};return k(p[c].promise,m,m),l}function F0(p,W0){var y;let i=!1;if(W0===null)W0=W;if((y=W0)!==null&&y!==void 0&&y.cleanup)F(W0.cleanup,"cleanup"),i=W0.cleanup;return new M((U0,m)=>{let V0=$0(p,W0,(w0)=>{if(i)V0();if(w0)m(w0);else U0()})})}q.exports=$0,q.exports.finished=F0}),o1=g0(($,q)=>{var Q=D1(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:J},AbortError:Z}=a0(),{Symbol:G}=P0(),{kIsDestroyed:W,isDestroyed:B,isFinished:V,isServerRequest:U}=b2(),w=G("kDestroy"),F=G("kConstruct");function M(g,c,h){if(g){if(g.stack,c&&!c.errored)c.errored=g;if(h&&!h.errored)h.errored=g}}function k(g,c){let h=this._readableState,x=this._writableState,l=x||h;if(x!==null&&x!==void 0&&x.destroyed||h!==null&&h!==void 0&&h.destroyed){if(typeof c==="function")c();return this}if(M(g,x,h),x)x.destroyed=!0;if(h)h.destroyed=!0;if(!l.constructed)this.once(w,function($0){f(this,K($0,g),c)});else f(this,g,c);return this}function f(g,c,h){let x=!1;function l($0){if(x)return;x=!0;let{_readableState:Z0,_writableState:F0}=g;if(M($0,F0,Z0),F0)F0.closed=!0;if(Z0)Z0.closed=!0;if(typeof h==="function")h($0);if($0)Q.nextTick(L,g,$0);else Q.nextTick(D,g)}try{g._destroy(c||null,l)}catch($0){l($0)}}function L(g,c){z(g,c),D(g)}function D(g){let{_readableState:c,_writableState:h}=g;if(h)h.closeEmitted=!0;if(c)c.closeEmitted=!0;if(h!==null&&h!==void 0&&h.emitClose||c!==null&&c!==void 0&&c.emitClose)g.emit("close")}function z(g,c){let{_readableState:h,_writableState:x}=g;if(x!==null&&x!==void 0&&x.errorEmitted||h!==null&&h!==void 0&&h.errorEmitted)return;if(x)x.errorEmitted=!0;if(h)h.errorEmitted=!0;g.emit("error",c)}function N(){let g=this._readableState,c=this._writableState;if(g)g.constructed=!0,g.closed=!1,g.closeEmitted=!1,g.destroyed=!1,g.errored=null,g.errorEmitted=!1,g.reading=!1,g.ended=g.readable===!1,g.endEmitted=g.readable===!1;if(c)c.constructed=!0,c.destroyed=!1,c.closed=!1,c.closeEmitted=!1,c.errored=null,c.errorEmitted=!1,c.finalCalled=!1,c.prefinished=!1,c.ended=c.writable===!1,c.ending=c.writable===!1,c.finished=c.writable===!1}function H(g,c,h){let{_readableState:x,_writableState:l}=g;if(l!==null&&l!==void 0&&l.destroyed||x!==null&&x!==void 0&&x.destroyed)return this;if(x!==null&&x!==void 0&&x.autoDestroy||l!==null&&l!==void 0&&l.autoDestroy)g.destroy(c);else if(c){if(c.stack,l&&!l.errored)l.errored=c;if(x&&!x.errored)x.errored=c;if(h)Q.nextTick(z,g,c);else z(g,c)}}function v(g,c){if(typeof g._construct!=="function")return;let{_readableState:h,_writableState:x}=g;if(h)h.constructed=!1;if(x)x.constructed=!1;if(g.once(F,c),g.listenerCount(F)>1)return;Q.nextTick(j,g)}function j(g){let c=!1;function h(x){if(c){H(g,x!==null&&x!==void 0?x:new J);return}c=!0;let{_readableState:l,_writableState:$0}=g,Z0=$0||l;if(l)l.constructed=!0;if($0)$0.constructed=!0;if(Z0.destroyed)g.emit(w,x);else if(x)H(g,x,!0);else Q.nextTick(n,g)}try{g._construct((x)=>{Q.nextTick(h,x)})}catch(x){Q.nextTick(h,x)}}function n(g){g.emit(F)}function d(g){return(g===null||g===void 0?void 0:g.setHeader)&&typeof g.abort==="function"}function _(g){g.emit("close")}function X(g,c){g.emit("error",c),Q.nextTick(_,g)}function P(g,c){if(!g||B(g))return;if(!c&&!V(g))c=new Z;if(U(g))g.socket=null,g.destroy(c);else if(d(g))g.abort();else if(d(g.req))g.req.abort();else if(typeof g.destroy==="function")g.destroy(c);else if(typeof g.close==="function")g.close();else if(c)Q.nextTick(X,g,c);else Q.nextTick(_,g);if(!g.destroyed)g[W]=!0}q.exports={construct:v,destroyer:P,destroy:k,undestroy:N,errorOrDestroy:H}}),b5=g0(($,q)=>{var{ArrayIsArray:Q,ObjectSetPrototypeOf:K}=P0(),{EventEmitter:J}=(i1(),X0(p1));function Z(W){J.call(this,W)}K(Z.prototype,J.prototype),K(Z,J),Z.prototype.pipe=function(W,B){let V=this;function U(D){if(W.writable&&W.write(D)===!1&&V.pause)V.pause()}V.on("data",U);function w(){if(V.readable&&V.resume)V.resume()}if(W.on("drain",w),!W._isStdio&&(!B||B.end!==!1))V.on("end",M),V.on("close",k);let F=!1;function M(){if(F)return;F=!0,W.end()}function k(){if(F)return;if(F=!0,typeof W.destroy==="function")W.destroy()}function f(D){if(L(),J.listenerCount(this,"error")===0)this.emit("error",D)}G(V,"error",f),G(W,"error",f);function L(){V.removeListener("data",U),W.removeListener("drain",w),V.removeListener("end",M),V.removeListener("close",k),V.removeListener("error",f),W.removeListener("error",f),V.removeListener("end",L),V.removeListener("close",L),W.removeListener("close",L)}return V.on("end",L),V.on("close",L),W.on("close",L),W.emit("pipe",V),W};function G(W,B,V){if(typeof W.prependListener==="function")return W.prependListener(B,V);if(!W._events||!W._events[B])W.on(B,V);else if(Q(W._events[B]))W._events[B].unshift(V);else W._events[B]=[V,W._events[B]]}q.exports={Stream:Z,prependListener:G}}),H8=g0(($,q)=>{var{SymbolDispose:Q}=P0(),{AbortError:K,codes:J}=a0(),{isNodeStream:Z,isWebStream:G,kControllerErrorFunction:W}=b2(),B=s2(),{ERR_INVALID_ARG_TYPE:V}=J,U,w=(F,M)=>{if(typeof F!=="object"||!("aborted"in F))throw new V(M,"AbortSignal",F)};q.exports.addAbortSignal=function(F,M){if(w(F,"signal"),!Z(M)&&!G(M))throw new V("stream",["ReadableStream","WritableStream","Stream"],M);return q.exports.addAbortSignalNoValidate(F,M)},q.exports.addAbortSignalNoValidate=function(F,M){if(typeof F!=="object"||!("aborted"in F))return M;let k=Z(M)?()=>{M.destroy(new K(void 0,{cause:F.reason}))}:()=>{M[W](new K(void 0,{cause:F.reason}))};if(F.aborted)k();else{U=U||e0().addAbortListener;let f=U(F,k);B(M,f[Q])}return M}}),gV=g0(($,q)=>{var{StringPrototypeSlice:Q,SymbolIterator:K,TypedArrayPrototypeSet:J,Uint8Array:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{inspect:W}=e0();q.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(B){let V={data:B,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length}unshift(B){let V={data:B,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length}shift(){if(this.length===0)return;let B=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,B}clear(){this.head=this.tail=null,this.length=0}join(B){if(this.length===0)return"";let V=this.head,U=""+V.data;while((V=V.next)!==null)U+=B+V.data;return U}concat(B){if(this.length===0)return G.alloc(0);let V=G.allocUnsafe(B>>>0),U=this.head,w=0;while(U)J(V,U.data,w),w+=U.data.length,U=U.next;return V}consume(B,V){let U=this.head.data;if(BF.length)V+=F,B-=F.length;else{if(B===F.length)if(V+=F,++w,U.next)this.head=U.next;else this.head=this.tail=null;else V+=Q(F,0,B),this.head=U,U.data=Q(F,B);break}++w}while((U=U.next)!==null);return this.length-=w,V}_getBuffer(B){let V=G.allocUnsafe(B),U=B,w=this.head,F=0;do{let M=w.data;if(B>M.length)J(V,M,U-B),B-=M.length;else{if(B===M.length)if(J(V,M,U-B),++F,w.next)this.head=w.next;else this.head=this.tail=null;else J(V,new Z(M.buffer,M.byteOffset,B),U-B),this.head=w,w.data=M.slice(B);break}++F}while((w=w.next)!==null);return this.length-=F,V}[Symbol.for("nodejs.util.inspect.custom")](B,V){return W(this,{...V,depth:0,customInspect:!1})}}}),v8=g0(($,q)=>{var{MathFloor:Q,NumberIsInteger:K}=P0(),{validateInteger:J}=P6(),{ERR_INVALID_ARG_VALUE:Z}=a0().codes,G=16384,W=16;function B(F,M,k){return F.highWaterMark!=null?F.highWaterMark:M?F[k]:null}function V(F){return F?W:G}function U(F,M){if(J(M,"value",0),F)W=M;else G=M}function w(F,M,k,f){let L=B(M,f,k);if(L!=null){if(!K(L)||L<0){let D=f?`options.${k}`:"options.highWaterMark";throw new Z(D,L)}return Q(L)}return V(F.objectMode)}q.exports={getHighWaterMark:w,getDefaultHighWaterMark:V,setDefaultHighWaterMark:U}}),AV=g0(($,q)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),XV=g0(($)=>{var q=AV().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),a9=g0(($,q)=>{var Q=D1(),{PromisePrototypeThen:K,SymbolAsyncIterator:J,SymbolIterator:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{ERR_INVALID_ARG_TYPE:W,ERR_STREAM_NULL_VALUES:B}=a0().codes;function V(U,w,F){let M;if(typeof w==="string"||w instanceof G)return new U({objectMode:!0,...F,read(){this.push(w),this.push(null)}});let k;if(w&&w[J])k=!0,M=w[J]();else if(w&&w[Z])k=!1,M=w[Z]();else throw new W("iterable",["Iterable"],w);let f=new U({objectMode:!0,highWaterMark:1,...F}),L=!1;f._read=function(){if(!L)L=!0,z()},f._destroy=function(N,H){K(D(N),()=>Q.nextTick(H,N),(v)=>Q.nextTick(H,v||N))};async function D(N){let H=N!==void 0&&N!==null,v=typeof M.throw==="function";if(H&&v){let{value:j,done:n}=await M.throw(N);if(await j,n)return}if(typeof M.return==="function"){let{value:j}=await M.return();await j}}async function z(){for(;;){try{let{value:N,done:H}=k?await M.next():M.next();if(H)f.push(null);else{let v=N&&typeof N.then==="function"?await N:N;if(v===null)throw L=!1,new B;else if(f.push(v))continue;else L=!1}}catch(N){f.destroy(N)}break}}return f}q.exports=V}),f8=g0(($,q)=>{var Q=D1(),{ArrayPrototypeIndexOf:K,NumberIsInteger:J,NumberIsNaN:Z,NumberParseInt:G,ObjectDefineProperties:W,ObjectKeys:B,ObjectSetPrototypeOf:V,Promise:U,SafeSet:w,SymbolAsyncDispose:F,SymbolAsyncIterator:M,Symbol:k}=P0();q.exports=Q0,Q0.ReadableState=G0;var{EventEmitter:f}=(i1(),X0(p1)),{Stream:L,prependListener:D}=b5(),{Buffer:z}=(t0(),X0(K2)),{addAbortSignal:N}=H8(),H=s2(),v=e0().debuglog("stream",(I)=>{v=I}),j=gV(),n=o1(),{getHighWaterMark:d,getDefaultHighWaterMark:_}=v8(),{aggregateTwoErrors:X,codes:{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:g,ERR_OUT_OF_RANGE:c,ERR_STREAM_PUSH_AFTER_EOF:h,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:x},AbortError:l}=a0(),{validateObject:$0}=P6(),Z0=k("kPaused"),{StringDecoder:F0}=XV(),p=a9();V(Q0.prototype,L.prototype),V(Q0,L);var W0=()=>{},{errorOrDestroy:y}=n,i=1,U0=2,m=4,V0=8,w0=16,S=32,b=64,O=128,E=256,a=512,K0=1024,R=2048,Y=4096,C=8192,u=16384,e=32768,r=65536,s=131072,T=262144;function t(I){return{enumerable:!1,get(){return(this.state&I)!==0},set(A){if(A)this.state|=I;else this.state&=~I}}}W(G0.prototype,{objectMode:t(i),ended:t(U0),endEmitted:t(m),reading:t(V0),constructed:t(w0),sync:t(S),needReadable:t(b),emittedReadable:t(O),readableListening:t(E),resumeScheduled:t(a),errorEmitted:t(K0),emitClose:t(R),autoDestroy:t(Y),destroyed:t(C),closed:t(u),closeEmitted:t(e),multiAwaitDrain:t(r),readingMore:t(s),dataEmitted:t(T)});function G0(I,A,J0){if(typeof J0!=="boolean")J0=A instanceof c2();if(this.state=R|Y|w0|S,I&&I.objectMode)this.state|=i;if(J0&&I&&I.readableObjectMode)this.state|=i;if(this.highWaterMark=I?d(this,I,"readableHighWaterMark",J0):_(!1),this.buffer=new j,this.length=0,this.pipes=[],this.flowing=null,this[Z0]=null,I&&I.emitClose===!1)this.state&=~R;if(I&&I.autoDestroy===!1)this.state&=~Y;if(this.errored=null,this.defaultEncoding=I&&I.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,I&&I.encoding)this.decoder=new F0(I.encoding),this.encoding=I.encoding}function Q0(I){if(!(this instanceof Q0))return new Q0(I);let A=this instanceof c2();if(this._readableState=new G0(I,this,A),I){if(typeof I.read==="function")this._read=I.read;if(typeof I.destroy==="function")this._destroy=I.destroy;if(typeof I.construct==="function")this._construct=I.construct;if(I.signal&&!A)N(I.signal,this)}L.call(this,I),n.construct(this,()=>{if(this._readableState.needReadable)_1(this,this._readableState)})}Q0.prototype.destroy=n.destroy,Q0.prototype._undestroy=n.undestroy,Q0.prototype._destroy=function(I,A){A(I)},Q0.prototype[f.captureRejectionSymbol]=function(I){this.destroy(I)},Q0.prototype[F]=function(){let I;if(!this.destroyed)I=this.readableEnded?null:new l,this.destroy(I);return new U((A,J0)=>H(this,(B0)=>B0&&B0!==I?J0(B0):A(null)))},Q0.prototype.push=function(I,A){return M0(this,I,A,!1)},Q0.prototype.unshift=function(I,A){return M0(this,I,A,!0)};function M0(I,A,J0,B0){v("readableAddChunk",A);let z0=I._readableState,i0;if((z0.state&i)===0){if(typeof A==="string"){if(J0=J0||z0.defaultEncoding,z0.encoding!==J0)if(B0&&z0.encoding)A=z.from(A,J0).toString(z0.encoding);else A=z.from(A,J0),J0=""}else if(A instanceof z)J0="";else if(L._isUint8Array(A))A=L._uint8ArrayToBuffer(A),J0="";else if(A!=null)i0=new P("chunk",["string","Buffer","Uint8Array"],A)}if(i0)y(I,i0);else if(A===null)z0.state&=~V0,O0(I,z0);else if((z0.state&i)!==0||A&&A.length>0)if(B0)if((z0.state&m)!==0)y(I,new x);else if(z0.destroyed||z0.errored)return!1;else I0(I,z0,A,!0);else if(z0.ended)y(I,new h);else if(z0.destroyed||z0.errored)return!1;else if(z0.state&=~V0,z0.decoder&&!J0)if(A=z0.decoder.write(A),z0.objectMode||A.length!==0)I0(I,z0,A,!1);else _1(I,z0);else I0(I,z0,A,!1);else if(!B0)z0.state&=~V0,_1(I,z0);return!z0.ended&&(z0.length0){if((A.state&r)!==0)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;A.dataEmitted=!0,I.emit("data",J0)}else{if(A.length+=A.objectMode?1:J0.length,B0)A.buffer.unshift(J0);else A.buffer.push(J0);if((A.state&b)!==0)u0(I)}_1(I,A)}Q0.prototype.isPaused=function(){let I=this._readableState;return I[Z0]===!0||I.flowing===!1},Q0.prototype.setEncoding=function(I){let A=new F0(I);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;let J0=this._readableState.buffer,B0="";for(let z0 of J0)B0+=A.write(z0);if(J0.clear(),B0!=="")J0.push(B0);return this._readableState.length=B0.length,this};var m0=1073741824;function p0(I){if(I>m0)throw new c("size","<= 1GiB",I);else I--,I|=I>>>1,I|=I>>>2,I|=I>>>4,I|=I>>>8,I|=I>>>16,I++;return I}function q2(I,A){if(I<=0||A.length===0&&A.ended)return 0;if((A.state&i)!==0)return 1;if(Z(I)){if(A.flowing&&A.length)return A.buffer.first().length;return A.length}if(I<=A.length)return I;return A.ended?A.length:0}Q0.prototype.read=function(I){if(v("read",I),I===void 0)I=NaN;else if(!J(I))I=G(I,10);let A=this._readableState,J0=I;if(I>A.highWaterMark)A.highWaterMark=p0(I);if(I!==0)A.state&=~O;if(I===0&&A.needReadable&&((A.highWaterMark!==0?A.length>=A.highWaterMark:A.length>0)||A.ended)){if(v("read: emitReadable",A.length,A.ended),A.length===0&&A.ended)f5(this);else u0(this);return null}if(I=q2(I,A),I===0&&A.ended){if(A.length===0)f5(this);return null}let B0=(A.state&b)!==0;if(v("need readable",B0),A.length===0||A.length-I0)z0=l7(I,A);else z0=null;if(z0===null)A.needReadable=A.length<=A.highWaterMark,I=0;else if(A.length-=I,A.multiAwaitDrain)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;if(A.length===0){if(!A.ended)A.needReadable=!0;if(J0!==I&&A.ended)f5(this)}if(z0!==null&&!A.errorEmitted&&!A.closeEmitted)A.dataEmitted=!0,this.emit("data",z0);return z0};function O0(I,A){if(v("onEofChunk"),A.ended)return;if(A.decoder){let J0=A.decoder.end();if(J0&&J0.length)A.buffer.push(J0),A.length+=A.objectMode?1:J0.length}if(A.ended=!0,A.sync)u0(I);else A.needReadable=!1,A.emittedReadable=!0,E1(I)}function u0(I){let A=I._readableState;if(v("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,!A.emittedReadable)v("emitReadable",A.flowing),A.emittedReadable=!0,Q.nextTick(E1,I)}function E1(I){let A=I._readableState;if(v("emitReadable_",A.destroyed,A.length,A.ended),!A.destroyed&&!A.errored&&(A.length||A.ended))I.emit("readable"),A.emittedReadable=!1;A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,o7(I)}function _1(I,A){if(!A.readingMore&&A.constructed)A.readingMore=!0,Q.nextTick(R2,I,A)}function R2(I,A){while(!A.reading&&!A.ended&&(A.length1&&B0.pipes.includes(I))v("false write response, pause",B0.awaitDrainWriters.size),B0.awaitDrainWriters.add(I);J0.pause()}if(!z1)z1=wJ(J0,I),I.on("drain",z1)}J0.on("data",e7);function e7(F1){v("ondata");let u2=I.write(F1);if(v("dest.write",u2),u2===!1)t7()}function I5(F1){if(v("onerror",F1),A6(),I.removeListener("error",I5),I.listenerCount("error")===0){let u2=I._writableState||I._readableState;if(u2&&!u2.errorEmitted)y(I,F1);else I.emit("error",F1)}}D(I,"error",I5);function C5(){I.removeListener("finish",j5),A6()}I.once("close",C5);function j5(){v("onfinish"),I.removeListener("close",C5),A6()}I.once("finish",j5);function A6(){v("unpipe"),J0.unpipe(I)}if(I.emit("pipe",J0),I.writableNeedDrain===!0)t7();else if(!B0.flowing)v("pipe resume"),J0.resume();return I};function wJ(I,A){return function(){let J0=I._readableState;if(J0.awaitDrainWriters===A)v("pipeOnDrain",1),J0.awaitDrainWriters=null;else if(J0.multiAwaitDrain)v("pipeOnDrain",J0.awaitDrainWriters.size),J0.awaitDrainWriters.delete(A);if((!J0.awaitDrainWriters||J0.awaitDrainWriters.size===0)&&I.listenerCount("data"))I.resume()}}Q0.prototype.unpipe=function(I){let A=this._readableState,J0={hasUnpiped:!1};if(A.pipes.length===0)return this;if(!I){let z0=A.pipes;A.pipes=[],this.pause();for(let i0=0;i00,B0.flowing!==!1)this.resume()}else if(I==="readable"){if(!B0.endEmitted&&!B0.readableListening){if(B0.readableListening=B0.needReadable=!0,B0.flowing=!1,B0.emittedReadable=!1,v("on readable",B0.length,B0.reading),B0.length)u0(this);else if(!B0.reading)Q.nextTick(NJ,this)}}return J0},Q0.prototype.addListener=Q0.prototype.on,Q0.prototype.removeListener=function(I,A){let J0=L.prototype.removeListener.call(this,I,A);if(I==="readable")Q.nextTick(i7,this);return J0},Q0.prototype.off=Q0.prototype.removeListener,Q0.prototype.removeAllListeners=function(I){let A=L.prototype.removeAllListeners.apply(this,arguments);if(I==="readable"||I===void 0)Q.nextTick(i7,this);return A};function i7(I){let A=I._readableState;if(A.readableListening=I.listenerCount("readable")>0,A.resumeScheduled&&A[Z0]===!1)A.flowing=!0;else if(I.listenerCount("data")>0)I.resume();else if(!A.readableListening)A.flowing=null}function NJ(I){v("readable nexttick read 0"),I.read(0)}Q0.prototype.resume=function(){let I=this._readableState;if(!I.flowing)v("resume"),I.flowing=!I.readableListening,YJ(this,I);return I[Z0]=!1,this};function YJ(I,A){if(!A.resumeScheduled)A.resumeScheduled=!0,Q.nextTick(kJ,I,A)}function kJ(I,A){if(v("resume",A.reading),!A.reading)I.read(0);if(A.resumeScheduled=!1,I.emit("resume"),o7(I),A.flowing&&!A.reading)I.read(0)}Q0.prototype.pause=function(){if(v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)v("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[Z0]=!0,this};function o7(I){let A=I._readableState;v("flow",A.flowing);while(A.flowing&&I.read()!==null);}Q0.prototype.wrap=function(I){let A=!1;I.on("data",(B0)=>{if(!this.push(B0)&&I.pause)A=!0,I.pause()}),I.on("end",()=>{this.push(null)}),I.on("error",(B0)=>{y(this,B0)}),I.on("close",()=>{this.destroy()}),I.on("destroy",()=>{this.destroy()}),this._read=()=>{if(A&&I.resume)A=!1,I.resume()};let J0=B(I);for(let B0=1;B0{z0=z2?X(z0,z2):null,J0(),J0=W0});try{while(!0){let z2=I.destroyed?null:I.read();if(z2!==null)yield z2;else if(z0)throw z0;else if(z0===null)return;else await new U(B0)}}catch(z2){throw z0=X(z0,z2),z0}finally{if((z0||(A===null||A===void 0?void 0:A.destroyOnReturn)!==!1)&&(z0===void 0||I._readableState.autoDestroy))n.destroyer(I,null);else I.off("readable",B0),i0()}}W(Q0.prototype,{readable:{__proto__:null,get(){let I=this._readableState;return!!I&&I.readable!==!1&&!I.destroyed&&!I.errorEmitted&&!I.endEmitted},set(I){if(this._readableState)this._readableState.readable=!!I}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(I){if(this._readableState)this._readableState.flowing=I}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(I){if(!this._readableState)return;this._readableState.destroyed=I}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),W(G0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Z0]!==!1},set(I){this[Z0]=!!I}}}),Q0._fromList=l7;function l7(I,A){if(A.length===0)return null;let J0;if(A.objectMode)J0=A.buffer.shift();else if(!I||I>=A.length){if(A.decoder)J0=A.buffer.join("");else if(A.buffer.length===1)J0=A.buffer.first();else J0=A.buffer.concat(A.length);A.buffer.clear()}else J0=A.buffer.consume(I,A.decoder);return J0}function f5(I){let A=I._readableState;if(v("endReadable",A.endEmitted),!A.endEmitted)A.ended=!0,Q.nextTick(LJ,A,I)}function LJ(I,A){if(v("endReadableNT",I.endEmitted,I.length),!I.errored&&!I.closeEmitted&&!I.endEmitted&&I.length===0){if(I.endEmitted=!0,A.emit("end"),A.writable&&A.allowHalfOpen===!1)Q.nextTick(HJ,A);else if(I.autoDestroy){let J0=A._writableState;if(!J0||J0.autoDestroy&&(J0.finished||J0.writable===!1))A.destroy()}}}function HJ(I){if(I.writable&&!I.writableEnded&&!I.destroyed)I.end()}Q0.from=function(I,A){return p(Q0,I,A)};var R5;function r7(){if(R5===void 0)R5={};return R5}Q0.fromWeb=function(I,A){return r7().newStreamReadableFromReadableStream(I,A)},Q0.toWeb=function(I,A){return r7().newReadableStreamFromStreamReadable(I,A)},Q0.wrap=function(I,A){var J0,B0;return new Q0({objectMode:(J0=(B0=I.readableObjectMode)!==null&&B0!==void 0?B0:I.objectMode)!==null&&J0!==void 0?J0:!0,...A,destroy(z0,i0){n.destroyer(I,z0),i0(z0)}}).wrap(I)}}),n5=g0(($,q)=>{var Q=D1(),{ArrayPrototypeSlice:K,Error:J,FunctionPrototypeSymbolHasInstance:Z,ObjectDefineProperty:G,ObjectDefineProperties:W,ObjectSetPrototypeOf:B,StringPrototypeToLowerCase:V,Symbol:U,SymbolHasInstance:w}=P0();q.exports=$0,$0.WritableState=x;var{EventEmitter:F}=(i1(),X0(p1)),M=b5().Stream,{Buffer:k}=(t0(),X0(K2)),f=o1(),{addAbortSignal:L}=H8(),{getHighWaterMark:D,getDefaultHighWaterMark:z}=v8(),{ERR_INVALID_ARG_TYPE:N,ERR_METHOD_NOT_IMPLEMENTED:H,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:j,ERR_STREAM_DESTROYED:n,ERR_STREAM_ALREADY_FINISHED:d,ERR_STREAM_NULL_VALUES:_,ERR_STREAM_WRITE_AFTER_END:X,ERR_UNKNOWN_ENCODING:P}=a0().codes,{errorOrDestroy:g}=f;B($0.prototype,M.prototype),B($0,M);function c(){}var h=U("kOnFinished");function x(Y,C,u){if(typeof u!=="boolean")u=C instanceof c2();if(this.objectMode=!!(Y&&Y.objectMode),u)this.objectMode=this.objectMode||!!(Y&&Y.writableObjectMode);this.highWaterMark=Y?D(this,Y,"writableHighWaterMark",u):z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let e=!!(Y&&Y.decodeStrings===!1);this.decodeStrings=!e,this.defaultEncoding=Y&&Y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=y.bind(void 0,C),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,l(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!Y||Y.emitClose!==!1,this.autoDestroy=!Y||Y.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[h]=[]}function l(Y){Y.buffered=[],Y.bufferedIndex=0,Y.allBuffers=!0,Y.allNoop=!0}x.prototype.getBuffer=function(){return K(this.buffered,this.bufferedIndex)},G(x.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function $0(Y){let C=this instanceof c2();if(!C&&!Z($0,this))return new $0(Y);if(this._writableState=new x(Y,this,C),Y){if(typeof Y.write==="function")this._write=Y.write;if(typeof Y.writev==="function")this._writev=Y.writev;if(typeof Y.destroy==="function")this._destroy=Y.destroy;if(typeof Y.final==="function")this._final=Y.final;if(typeof Y.construct==="function")this._construct=Y.construct;if(Y.signal)L(Y.signal,this)}M.call(this,Y),f.construct(this,()=>{let u=this._writableState;if(!u.writing)V0(this,u);O(this,u)})}G($0,w,{__proto__:null,value:function(Y){if(Z(this,Y))return!0;if(this!==$0)return!1;return Y&&Y._writableState instanceof x}}),$0.prototype.pipe=function(){g(this,new j)};function Z0(Y,C,u,e){let r=Y._writableState;if(typeof u==="function")e=u,u=r.defaultEncoding;else{if(!u)u=r.defaultEncoding;else if(u!=="buffer"&&!k.isEncoding(u))throw new P(u);if(typeof e!=="function")e=c}if(C===null)throw new _;else if(!r.objectMode)if(typeof C==="string"){if(r.decodeStrings!==!1)C=k.from(C,u),u="buffer"}else if(C instanceof k)u="buffer";else if(M._isUint8Array(C))C=M._uint8ArrayToBuffer(C),u="buffer";else throw new N("chunk",["string","Buffer","Uint8Array"],C);let s;if(r.ending)s=new X;else if(r.destroyed)s=new n("write");if(s)return Q.nextTick(e,s),g(Y,s,!0),s;return r.pendingcb++,F0(Y,r,C,u,e)}$0.prototype.write=function(Y,C,u){return Z0(this,Y,C,u)===!0},$0.prototype.cork=function(){this._writableState.corked++},$0.prototype.uncork=function(){let Y=this._writableState;if(Y.corked){if(Y.corked--,!Y.writing)V0(this,Y)}},$0.prototype.setDefaultEncoding=function(Y){if(typeof Y==="string")Y=V(Y);if(!k.isEncoding(Y))throw new P(Y);return this._writableState.defaultEncoding=Y,this};function F0(Y,C,u,e,r){let s=C.objectMode?1:u.length;C.length+=s;let T=C.lengthu.bufferedIndex)V0(Y,u);if(e)if(u.afterWriteTickInfo!==null&&u.afterWriteTickInfo.cb===r)u.afterWriteTickInfo.count++;else u.afterWriteTickInfo={count:1,cb:r,stream:Y,state:u},Q.nextTick(i,u.afterWriteTickInfo);else U0(Y,u,1,r)}}function i({stream:Y,state:C,count:u,cb:e}){return C.afterWriteTickInfo=null,U0(Y,C,u,e)}function U0(Y,C,u,e){if(!C.ending&&!Y.destroyed&&C.length===0&&C.needDrain)C.needDrain=!1,Y.emit("drain");while(u-- >0)C.pendingcb--,e();if(C.destroyed)m(C);O(Y,C)}function m(Y){if(Y.writing)return;for(let r=Y.bufferedIndex;r1&&Y._writev){C.pendingcb-=s-1;let t=C.allNoop?c:(Q0)=>{for(let M0=T;M0256)u.splice(0,T),C.bufferedIndex=0;else C.bufferedIndex=T}C.bufferProcessing=!1}$0.prototype._write=function(Y,C,u){if(this._writev)this._writev([{chunk:Y,encoding:C}],u);else throw new H("_write()")},$0.prototype._writev=null,$0.prototype.end=function(Y,C,u){let e=this._writableState;if(typeof Y==="function")u=Y,Y=null,C=null;else if(typeof C==="function")u=C,C=null;let r;if(Y!==null&&Y!==void 0){let s=Z0(this,Y,C);if(s instanceof J)r=s}if(e.corked)e.corked=1,this.uncork();if(r);else if(!e.errored&&!e.ending)e.ending=!0,O(this,e,!0),e.ended=!0;else if(e.finished)r=new d("end");else if(e.destroyed)r=new n("end");if(typeof u==="function")if(r||e.finished)Q.nextTick(u,r);else e[h].push(u);return this};function w0(Y){return Y.ending&&!Y.destroyed&&Y.constructed&&Y.length===0&&!Y.errored&&Y.buffered.length===0&&!Y.finished&&!Y.writing&&!Y.errorEmitted&&!Y.closeEmitted}function S(Y,C){let u=!1;function e(r){if(u){g(Y,r!==null&&r!==void 0?r:v());return}if(u=!0,C.pendingcb--,r){let s=C[h].splice(0);for(let T=0;T{if(w0(r))E(e,r);else r.pendingcb--},Y,C);else if(w0(C))C.pendingcb++,E(Y,C)}}}function E(Y,C){C.pendingcb--,C.finished=!0;let u=C[h].splice(0);for(let e=0;e{var Q=D1(),K=(t0(),X0(K2)),{isReadable:J,isWritable:Z,isIterable:G,isNodeStream:W,isReadableNodeStream:B,isWritableNodeStream:V,isDuplexNodeStream:U,isReadableStream:w,isWritableStream:F}=b2(),M=s2(),{AbortError:k,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:L}}=a0(),{destroyer:D}=o1(),z=c2(),N=f8(),H=n5(),{createDeferredPromise:v}=e0(),j=a9(),n=globalThis.Blob||K.Blob,d=typeof n<"u"?function(h){return h instanceof n}:function(h){return!1},_=globalThis.AbortController||O6().AbortController,{FunctionPrototypeCall:X}=P0();class P extends z{constructor(h){super(h);if((h===null||h===void 0?void 0:h.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((h===null||h===void 0?void 0:h.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}q.exports=function h(x,l){if(U(x))return x;if(B(x))return c({readable:x});if(V(x))return c({writable:x});if(W(x))return c({writable:!1,readable:!1});if(w(x))return c({readable:N.fromWeb(x)});if(F(x))return c({writable:H.fromWeb(x)});if(typeof x==="function"){let{value:Z0,write:F0,final:p,destroy:W0}=g(x);if(G(Z0))return j(P,Z0,{objectMode:!0,write:F0,final:p,destroy:W0});let y=Z0===null||Z0===void 0?void 0:Z0.then;if(typeof y==="function"){let i,U0=X(y,Z0,(m)=>{if(m!=null)throw new L("nully","body",m)},(m)=>{D(i,m)});return i=new P({objectMode:!0,readable:!1,write:F0,final(m){p(async()=>{try{await U0,Q.nextTick(m,null)}catch(V0){Q.nextTick(m,V0)}})},destroy:W0})}throw new L("Iterable, AsyncIterable or AsyncFunction",l,Z0)}if(d(x))return h(x.arrayBuffer());if(G(x))return j(P,x,{objectMode:!0,writable:!1});if(w(x===null||x===void 0?void 0:x.readable)&&F(x===null||x===void 0?void 0:x.writable))return P.fromWeb(x);if(typeof(x===null||x===void 0?void 0:x.writable)==="object"||typeof(x===null||x===void 0?void 0:x.readable)==="object"){let Z0=x!==null&&x!==void 0&&x.readable?B(x===null||x===void 0?void 0:x.readable)?x===null||x===void 0?void 0:x.readable:h(x.readable):void 0,F0=x!==null&&x!==void 0&&x.writable?V(x===null||x===void 0?void 0:x.writable)?x===null||x===void 0?void 0:x.writable:h(x.writable):void 0;return c({readable:Z0,writable:F0})}let $0=x===null||x===void 0?void 0:x.then;if(typeof $0==="function"){let Z0;return X($0,x,(F0)=>{if(F0!=null)Z0.push(F0);Z0.push(null)},(F0)=>{D(Z0,F0)}),Z0=new P({objectMode:!0,writable:!1,read(){}})}throw new f(l,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],x)};function g(h){let{promise:x,resolve:l}=v(),$0=new _,Z0=$0.signal;return{value:h(async function*(){while(!0){let F0=x;x=null;let{chunk:p,done:W0,cb:y}=await F0;if(Q.nextTick(y),W0)return;if(Z0.aborted)throw new k(void 0,{cause:Z0.reason});({promise:x,resolve:l}=v()),yield p}}(),{signal:Z0}),write(F0,p,W0){let y=l;l=null,y({chunk:F0,done:!1,cb:W0})},final(F0){let p=l;l=null,p({done:!0,cb:F0})},destroy(F0,p){$0.abort(),p(F0)}}}function c(h){let x=h.readable&&typeof h.readable.read!=="function"?N.wrap(h.readable):h.readable,l=h.writable,$0=!!J(x),Z0=!!Z(l),F0,p,W0,y,i;function U0(m){let V0=y;if(y=null,V0)V0(m);else if(m)i.destroy(m)}if(i=new P({readableObjectMode:!!(x!==null&&x!==void 0&&x.readableObjectMode),writableObjectMode:!!(l!==null&&l!==void 0&&l.writableObjectMode),readable:$0,writable:Z0}),Z0)M(l,(m)=>{if(Z0=!1,m)D(x,m);U0(m)}),i._write=function(m,V0,w0){if(l.write(m,V0))w0();else F0=w0},i._final=function(m){l.end(),p=m},l.on("drain",function(){if(F0){let m=F0;F0=null,m()}}),l.on("finish",function(){if(p){let m=p;p=null,m()}});if($0)M(x,(m)=>{if($0=!1,m)D(x,m);U0(m)}),x.on("readable",function(){if(W0){let m=W0;W0=null,m()}}),x.on("end",function(){i.push(null)}),i._read=function(){while(!0){let m=x.read();if(m===null){W0=i._read;return}if(!i.push(m))return}};return i._destroy=function(m,V0){if(!m&&y!==null)m=new k;if(W0=null,F0=null,p=null,y===null)V0(m);else y=V0,D(l,m),D(x,m)},i}}),c2=g0(($,q)=>{var{ObjectDefineProperties:Q,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:J,ObjectSetPrototypeOf:Z}=P0();q.exports=B;var G=f8(),W=n5();Z(B.prototype,G.prototype),Z(B,G);{let F=J(W.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:Q,Symbol:K}=P0();q.exports=B;var{ERR_METHOD_NOT_IMPLEMENTED:J}=a0().codes,Z=c2(),{getHighWaterMark:G}=v8();Q(B.prototype,Z.prototype),Q(B,Z);var W=K("kCallback");function B(w){if(!(this instanceof B))return new B(w);let F=w?G(this,w,"readableHighWaterMark",!0):null;if(F===0)w={...w,highWaterMark:null,readableHighWaterMark:F,writableHighWaterMark:w.writableHighWaterMark||0};if(Z.call(this,w),this._readableState.sync=!1,this[W]=null,w){if(typeof w.transform==="function")this._transform=w.transform;if(typeof w.flush==="function")this._flush=w.flush}this.on("prefinish",U)}function V(w){if(typeof this._flush==="function"&&!this.destroyed)this._flush((F,M)=>{if(F){if(w)w(F);else this.destroy(F);return}if(M!=null)this.push(M);if(this.push(null),w)w()});else if(this.push(null),w)w()}function U(){if(this._final!==V)V.call(this)}B.prototype._final=V,B.prototype._transform=function(w,F,M){throw new J("_transform()")},B.prototype._write=function(w,F,M){let k=this._readableState,f=this._writableState,L=k.length;this._transform(w,F,(D,z)=>{if(D){M(D);return}if(z!=null)this.push(z);if(f.ended||L===k.length||k.length{var{ObjectSetPrototypeOf:Q}=P0();q.exports=J;var K=l9();Q(J.prototype,K.prototype),Q(J,K);function J(Z){if(!(this instanceof J))return new J(Z);K.call(this,Z)}J.prototype._transform=function(Z,G,W){W(null,Z)}}),d5=g0(($,q)=>{var Q=D1(),{ArrayIsArray:K,Promise:J,SymbolAsyncIterator:Z,SymbolDispose:G}=P0(),W=s2(),{once:B}=e0(),V=o1(),U=c2(),{aggregateTwoErrors:w,codes:{ERR_INVALID_ARG_TYPE:F,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:k,ERR_STREAM_DESTROYED:f,ERR_STREAM_PREMATURE_CLOSE:L},AbortError:D}=a0(),{validateFunction:z,validateAbortSignal:N}=P6(),{isIterable:H,isReadable:v,isReadableNodeStream:j,isNodeStream:n,isTransformStream:d,isWebStream:_,isReadableStream:X,isReadableFinished:P}=b2(),g=globalThis.AbortController||O6().AbortController,c,h,x;function l(m,V0,w0){let S=!1;m.on("close",()=>{S=!0});let b=W(m,{readable:V0,writable:w0},(O)=>{S=!O});return{destroy:(O)=>{if(S)return;S=!0,V.destroyer(m,O||new f("pipe"))},cleanup:b}}function $0(m){return z(m[m.length-1],"streams[stream.length - 1]"),m.pop()}function Z0(m){if(H(m))return m;else if(j(m))return F0(m);throw new F("val",["Readable","Iterable","AsyncIterable"],m)}async function*F0(m){if(!h)h=f8();yield*h.prototype[Z].call(m)}async function p(m,V0,w0,{end:S}){let b,O=null,E=(R)=>{if(R)b=R;if(O){let Y=O;O=null,Y()}},a=()=>new J((R,Y)=>{if(b)Y(b);else O=()=>{if(b)Y(b);else R()}});V0.on("drain",E);let K0=W(V0,{readable:!1},E);try{if(V0.writableNeedDrain)await a();for await(let R of m)if(!V0.write(R))await a();if(S)V0.end(),await a();w0()}catch(R){w0(b!==R?w(b,R):R)}finally{K0(),V0.off("drain",E)}}async function W0(m,V0,w0,{end:S}){if(d(V0))V0=V0.writable;let b=V0.getWriter();try{for await(let O of m)await b.ready,b.write(O).catch(()=>{});if(await b.ready,S)await b.close();w0()}catch(O){try{await b.abort(O),w0(O)}catch(E){w0(E)}}}function y(...m){return i(m,B($0(m)))}function i(m,V0,w0){if(m.length===1&&K(m[0]))m=m[0];if(m.length<2)throw new k("streams");let S=new g,b=S.signal,O=w0===null||w0===void 0?void 0:w0.signal,E=[];N(O,"options.signal");function a(){r(new D)}x=x||e0().addAbortListener;let K0;if(O)K0=x(O,a);let R,Y,C=[],u=0;function e(Q0){r(Q0,--u===0)}function r(Q0,M0){var I0;if(Q0&&(!R||R.code==="ERR_STREAM_PREMATURE_CLOSE"))R=Q0;if(!R&&!M0)return;while(C.length)C.shift()(R);if((I0=K0)===null||I0===void 0||I0[G](),S.abort(),M0){if(!R)E.forEach((m0)=>m0());Q.nextTick(V0,R,Y)}}let s;for(let Q0=0;Q00,p0=I0||(w0===null||w0===void 0?void 0:w0.end)!==!1,q2=Q0===m.length-1;if(n(M0)){let O0=function(u0){if(u0&&u0.name!=="AbortError"&&u0.code!=="ERR_STREAM_PREMATURE_CLOSE")e(u0)};var T=O0;if(p0){let{destroy:u0,cleanup:E1}=l(M0,I0,m0);if(C.push(u0),v(M0)&&q2)E.push(E1)}if(M0.on("error",O0),v(M0)&&q2)E.push(()=>{M0.removeListener("error",O0)})}if(Q0===0)if(typeof M0==="function"){if(s=M0({signal:b}),!H(s))throw new M("Iterable, AsyncIterable or Stream","source",s)}else if(H(M0)||j(M0)||d(M0))s=M0;else s=U.from(M0);else if(typeof M0==="function"){if(d(s)){var t;s=Z0((t=s)===null||t===void 0?void 0:t.readable)}else s=Z0(s);if(s=M0(s,{signal:b}),I0){if(!H(s,!0))throw new M("AsyncIterable",`transform[${Q0-1}]`,s)}else{var G0;if(!c)c=r9();let O0=new c({objectMode:!0}),u0=(G0=s)===null||G0===void 0?void 0:G0.then;if(typeof u0==="function")u++,u0.call(s,(R2)=>{if(Y=R2,R2!=null)O0.write(R2);if(p0)O0.end();Q.nextTick(e)},(R2)=>{O0.destroy(R2),Q.nextTick(e,R2)});else if(H(s,!0))u++,p(s,O0,e,{end:p0});else if(X(s)||d(s)){let R2=s.readable||s;u++,p(R2,O0,e,{end:p0})}else throw new M("AsyncIterable or Promise","destination",s);s=O0;let{destroy:E1,cleanup:_1}=l(s,!1,!0);if(C.push(E1),q2)E.push(_1)}}else if(n(M0)){if(j(s)){u+=2;let O0=U0(s,M0,e,{end:p0});if(v(M0)&&q2)E.push(O0)}else if(d(s)||X(s)){let O0=s.readable||s;u++,p(O0,M0,e,{end:p0})}else if(H(s))u++,p(s,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else if(_(M0)){if(j(s))u++,W0(Z0(s),M0,e,{end:p0});else if(X(s)||H(s))u++,W0(s,M0,e,{end:p0});else if(d(s))u++,W0(s.readable,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else s=U.from(M0)}if(b!==null&&b!==void 0&&b.aborted||O!==null&&O!==void 0&&O.aborted)Q.nextTick(a);return s}function U0(m,V0,w0,{end:S}){let b=!1;if(V0.on("close",()=>{if(!b)w0(new L)}),m.pipe(V0,{end:!1}),S){let E=function(){b=!0,V0.end()};var O=E;if(P(m))Q.nextTick(E);else m.once("end",E)}else w0();return W(m,{readable:!0,writable:!1},(E)=>{let a=m._readableState;if(E&&E.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted)m.once("end",w0).once("error",w0);else w0(E)}),W(V0,{readable:!1,writable:!0},w0)}q.exports={pipelineImpl:i,pipeline:y}}),s9=g0(($,q)=>{var{pipeline:Q}=d5(),K=c2(),{destroyer:J}=o1(),{isNodeStream:Z,isReadable:G,isWritable:W,isWebStream:B,isTransformStream:V,isWritableStream:U,isReadableStream:w}=b2(),{AbortError:F,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:k}}=a0(),f=s2();q.exports=function(...L){if(L.length===0)throw new k("streams");if(L.length===1)return K.from(L[0]);let D=[...L];if(typeof L[0]==="function")L[0]=K.from(L[0]);if(typeof L[L.length-1]==="function"){let g=L.length-1;L[g]=K.from(L[g])}for(let g=0;g0&&!(W(L[g])||U(L[g])||V(L[g])))throw new M(`streams[${g}]`,D[g],"must be writable")}let z,N,H,v,j;function n(g){let c=v;if(v=null,c)c(g);else if(g)j.destroy(g);else if(!P&&!X)j.destroy()}let d=L[0],_=Q(L,n),X=!!(W(d)||U(d)||V(d)),P=!!(G(_)||w(_)||V(_));if(j=new K({writableObjectMode:!!(d!==null&&d!==void 0&&d.writableObjectMode),readableObjectMode:!!(_!==null&&_!==void 0&&_.readableObjectMode),writable:X,readable:P}),X){if(Z(d))j._write=function(c,h,x){if(d.write(c,h))x();else z=x},j._final=function(c){d.end(),N=c},d.on("drain",function(){if(z){let c=z;z=null,c()}});else if(B(d)){let c=(V(d)?d.writable:d).getWriter();j._write=async function(h,x,l){try{await c.ready,c.write(h).catch(()=>{}),l()}catch($0){l($0)}},j._final=async function(h){try{await c.ready,c.close().catch(()=>{}),N=h}catch(x){h(x)}}}let g=V(_)?_.readable:_;f(g,()=>{if(N){let c=N;N=null,c()}})}if(P){if(Z(_))_.on("readable",function(){if(H){let g=H;H=null,g()}}),_.on("end",function(){j.push(null)}),j._read=function(){while(!0){let g=_.read();if(g===null){H=j._read;return}if(!j.push(g))return}};else if(B(_)){let g=(V(_)?_.readable:_).getReader();j._read=async function(){while(!0)try{let{value:c,done:h}=await g.read();if(!j.push(c))return;if(h){j.push(null);return}}catch{return}}}}return j._destroy=function(g,c){if(!g&&v!==null)g=new F;if(H=null,z=null,N=null,v===null)c(g);else if(v=c,Z(_))J(_,g)},j}}),hV=g0(($,q)=>{var Q=globalThis.AbortController||O6().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:J,ERR_MISSING_ARGS:Z,ERR_OUT_OF_RANGE:G},AbortError:W}=a0(),{validateAbortSignal:B,validateInteger:V,validateObject:U}=P6(),w=P0().Symbol("kWeak"),F=P0().Symbol("kResistStopPropagation"),{finished:M}=s2(),k=s9(),{addAbortSignalNoValidate:f}=H8(),{isWritable:L,isNodeStream:D}=b2(),{deprecate:z}=e0(),{ArrayPrototypePush:N,Boolean:H,MathFloor:v,Number:j,NumberIsNaN:n,Promise:d,PromiseReject:_,PromiseResolve:X,PromisePrototypeThen:P,Symbol:g}=P0(),c=g("kEmpty"),h=g("kEof");function x(O,E){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");if(D(O)&&!L(O))throw new K("stream",O,"must be writable");let a=k(this,O);if(E!==null&&E!==void 0&&E.signal)f(E.signal,a);return a}function l(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");let a=1;if((E===null||E===void 0?void 0:E.concurrency)!=null)a=v(E.concurrency);let K0=a-1;if((E===null||E===void 0?void 0:E.highWaterMark)!=null)K0=v(E.highWaterMark);return V(a,"options.concurrency",1),V(K0,"options.highWaterMark",0),K0+=a,async function*(){let R=e0().AbortSignalAny([E===null||E===void 0?void 0:E.signal].filter(H)),Y=this,C=[],u={signal:R},e,r,s=!1,T=0;function t(){s=!0,G0()}function G0(){T-=1,Q0()}function Q0(){if(r&&!s&&T=K0||T>=a))await new d((m0)=>{r=m0})}C.push(h)}catch(I0){let m0=_(I0);P(m0,G0,t),C.push(m0)}finally{if(s=!0,e)e(),e=null}}M0();try{while(!0){while(C.length>0){let I0=await C[0];if(I0===h)return;if(R.aborted)throw new W;if(I0!==c)yield I0;C.shift(),Q0()}await new d((I0)=>{e=I0})}}finally{if(s=!0,r)r(),r=null}}.call(this)}function $0(O=void 0){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");return async function*(){let E=0;for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W({cause:O.signal.reason});yield[E++,K0]}}.call(this)}async function Z0(O,E=void 0){for await(let a of y.call(this,O,E))return!0;return!1}async function F0(O,E=void 0){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);return!await Z0.call(this,async(...a)=>{return!await O(...a)},E)}async function p(O,E){for await(let a of y.call(this,O,E))return a;return}async function W0(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){return await O(K0,R),c}for await(let K0 of l.call(this,a,E));}function y(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){if(await O(K0,R))return K0;return c}return l.call(this,a,E)}class i extends Z{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function U0(O,E,a){var K0;if(typeof O!=="function")throw new J("reducer",["Function","AsyncFunction"],O);if(a!=null)U(a,"options");if((a===null||a===void 0?void 0:a.signal)!=null)B(a.signal,"options.signal");let R=arguments.length>1;if(a!==null&&a!==void 0&&(K0=a.signal)!==null&&K0!==void 0&&K0.aborted){let r=new W(void 0,{cause:a.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(r)),r}let Y=new Q,C=Y.signal;if(a!==null&&a!==void 0&&a.signal){let r={once:!0,[w]:this,[F]:!0};a.signal.addEventListener("abort",()=>Y.abort(),r)}let u=!1;try{for await(let r of this){var e;if(u=!0,a!==null&&a!==void 0&&(e=a.signal)!==null&&e!==void 0&&e.aborted)throw new W;if(!R)E=r,R=!0;else E=await O(E,r,{signal:C})}if(!u&&!R)throw new i}finally{Y.abort()}return E}async function m(O){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");let E=[];for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W(void 0,{cause:O.signal.reason});N(E,K0)}return E}function V0(O,E){let a=l.call(this,O,E);return async function*(){for await(let K0 of a)yield*K0}.call(this)}function w0(O){if(O=j(O),n(O))return 0;if(O<0)throw new G("number",">= 0",O);return O}function S(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O--<=0)yield R}}.call(this)}function b(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O-- >0)yield R;if(O<=0)return}}.call(this)}q.exports.streamReturningOperators={asIndexedPairs:z($0,"readable.asIndexedPairs will be removed in a future version."),drop:S,filter:y,flatMap:V0,map:l,take:b,compose:x},q.exports.promiseReturningOperators={every:F0,forEach:W0,reduce:U0,toArray:m,some:Z0,find:p}}),t9=g0(($,q)=>{var{ArrayPrototypePop:Q,Promise:K}=P0(),{isIterable:J,isNodeStream:Z,isWebStream:G}=b2(),{pipelineImpl:W}=d5(),{finished:B}=s2();e9();function V(...U){return new K((w,F)=>{let M,k,f=U[U.length-1];if(f&&typeof f==="object"&&!Z(f)&&!J(f)&&!G(f)){let L=Q(U);M=L.signal,k=L.end}W(U,(L,D)=>{if(L)F(L);else w(D)},{signal:M,end:k})})}q.exports={finished:B,pipeline:V}}),e9=g0(($,q)=>{var{Buffer:Q}=(t0(),X0(K2)),{ObjectDefineProperty:K,ObjectKeys:J,ReflectApply:Z}=P0(),{promisify:{custom:G}}=e0(),{streamReturningOperators:W,promiseReturningOperators:B}=hV(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:V}}=a0(),U=s9(),{setDefaultHighWaterMark:w,getDefaultHighWaterMark:F}=v8(),{pipeline:M}=d5(),{destroyer:k}=o1(),f=s2(),L=t9(),D=b2(),z=q.exports=b5().Stream;z.isDestroyed=D.isDestroyed,z.isDisturbed=D.isDisturbed,z.isErrored=D.isErrored,z.isReadable=D.isReadable,z.isWritable=D.isWritable,z.Readable=f8();for(let H of J(W)){let v=function(...n){if(new.target)throw V();return z.Readable.from(Z(j,this,n))},j=W[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(let H of J(B)){let v=function(...n){if(new.target)throw V();return Z(j,this,n)},j=B[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}z.Writable=n5(),z.Duplex=c2(),z.Transform=l9(),z.PassThrough=r9(),z.pipeline=M;var{addAbortSignal:N}=H8();z.addAbortSignal=N,z.finished=f,z.destroy=k,z.compose=U,z.setDefaultHighWaterMark=w,z.getDefaultHighWaterMark=F,K(z,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return L}}),K(M,G,{__proto__:null,enumerable:!0,get(){return L.pipeline}}),K(f,G,{__proto__:null,enumerable:!0,get(){return L.finished}}),z.Stream=z,z._isUint8Array=function(H){return H instanceof Uint8Array},z._uint8ArrayToBuffer=function(H){return Q.from(H.buffer,H.byteOffset,H.byteLength)}}),xV=g0(($,q)=>{var Q=a1();{let K=e9(),J=t9(),Z=K.Readable.destroy;q.exports=K.Readable,q.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,q.exports._isUint8Array=K._isUint8Array,q.exports.isDisturbed=K.isDisturbed,q.exports.isErrored=K.isErrored,q.exports.isReadable=K.isReadable,q.exports.Readable=K.Readable,q.exports.Writable=K.Writable,q.exports.Duplex=K.Duplex,q.exports.Transform=K.Transform,q.exports.PassThrough=K.PassThrough,q.exports.addAbortSignal=K.addAbortSignal,q.exports.finished=K.finished,q.exports.destroy=K.destroy,q.exports.destroy=Z,q.exports.pipeline=K.pipeline,q.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return J}}),q.exports.Stream=K.Stream}q.exports.default=q.exports});$$.exports=xV()});var m5=N0((Dz,Q$)=>{Q$.exports=a1()});var n2=N0((J2)=>{J2.base64=!0;J2.array=!0;J2.string=!0;J2.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";J2.nodebuffer=typeof Buffer<"u";J2.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")J2.blob=!1;else{R8=new ArrayBuffer(0);try{J2.blob=new Blob([R8],{type:"application/zip"}).size===0}catch($){try{p5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,I8=new p5,I8.append(R8),J2.blob=I8.getBlob("application/zip").size===0}catch(q){J2.blob=!1}}}var R8,p5,I8;try{J2.nodestream=!!m5().Readable}catch($){J2.nodestream=!1}});var o5=N0((i5)=>{var OV=T0(),PV=n2(),A2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i5.encode=function($){var q=[],Q,K,J,Z,G,W,B,V=0,U=$.length,w=U,F=OV.getTypeOf($)!=="string";while(V<$.length){if(w=U-V,!F)Q=$.charCodeAt(V++),K=V>2,G=(Q&3)<<4|K>>4,W=w>1?(K&15)<<2|J>>6:64,B=w>2?J&63:64,q.push(A2.charAt(Z)+A2.charAt(G)+A2.charAt(W)+A2.charAt(B))}return q.join("")};i5.decode=function($){var q,Q,K,J,Z,G,W,B=0,V=0,U="data:";if($.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var w=$.length*3/4;if($.charAt($.length-1)===A2.charAt(64))w--;if($.charAt($.length-2)===A2.charAt(64))w--;if(w%1!==0)throw Error("Invalid base64 input, bad content length.");var F;if(PV.uint8array)F=new Uint8Array(w|0);else F=Array(w|0);while(B<$.length){if(J=A2.indexOf($.charAt(B++)),Z=A2.indexOf($.charAt(B++)),G=A2.indexOf($.charAt(B++)),W=A2.indexOf($.charAt(B++)),q=J<<2|Z>>4,Q=(Z&15)<<4|G>>2,K=(G&3)<<6|W,F[V++]=q,G!==64)F[V++]=Q;if(W!==64)F[V++]=K}return F}});var T6=N0((vz,q$)=>{q$.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var q=new Buffer($);return q.fill(0),q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var V$=N0((fz,J$)=>{var K$=global.MutationObserver||global.WebKitMutationObserver,u6;if(K$)j8=0,a5=new K$(C8),g8=global.document.createTextNode(""),a5.observe(g8,{characterData:!0}),u6=function(){g8.data=j8=++j8%2};else if(!global.setImmediate&&typeof global.MessageChannel<"u")A8=new global.MessageChannel,A8.port1.onmessage=C8,u6=function(){A8.port2.postMessage(0)};else if("document"in global&&"onreadystatechange"in global.document.createElement("script"))u6=function(){var $=global.document.createElement("script");$.onreadystatechange=function(){C8(),$.onreadystatechange=null,$.parentNode.removeChild($),$=null},global.document.documentElement.appendChild($)};else u6=function(){setTimeout(C8,0)};var j8,a5,g8,A8,l5,S6=[];function C8(){l5=!0;var $,q,Q=S6.length;while(Q){q=S6,S6=[],$=-1;while(++${var uV=V$();function l1(){}var o0={},U$=["REJECTED"],r5=["FULFILLED"],Z$=["PENDING"];B$.exports=t2;function t2($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Z$,this.queue=[],this.outcome=void 0,$!==l1)G$(this,$)}t2.prototype.finally=function($){if(typeof $!=="function")return this;var q=this.constructor;return this.then(Q,K);function Q(J){function Z(){return J}return q.resolve($()).then(Z)}function K(J){function Z(){throw J}return q.resolve($()).then(Z)}};t2.prototype.catch=function($){return this.then(null,$)};t2.prototype.then=function($,q){if(typeof $!=="function"&&this.state===r5||typeof q!=="function"&&this.state===U$)return this;var Q=new this.constructor(l1);if(this.state!==Z$){var K=this.state===r5?$:q;s5(Q,K,this.outcome)}else this.queue.push(new E6(Q,$,q));return Q};function E6($,q,Q){if(this.promise=$,typeof q==="function")this.onFulfilled=q,this.callFulfilled=this.otherCallFulfilled;if(typeof Q==="function")this.onRejected=Q,this.callRejected=this.otherCallRejected}E6.prototype.callFulfilled=function($){o0.resolve(this.promise,$)};E6.prototype.otherCallFulfilled=function($){s5(this.promise,this.onFulfilled,$)};E6.prototype.callRejected=function($){o0.reject(this.promise,$)};E6.prototype.otherCallRejected=function($){s5(this.promise,this.onRejected,$)};function s5($,q,Q){uV(function(){var K;try{K=q(Q)}catch(J){return o0.reject($,J)}if(K===$)o0.reject($,TypeError("Cannot resolve promise with itself"));else o0.resolve($,K)})}o0.resolve=function($,q){var Q=W$(SV,q);if(Q.status==="error")return o0.reject($,Q.value);var K=Q.value;if(K)G$($,K);else{$.state=r5,$.outcome=q;var J=-1,Z=$.queue.length;while(++J{var t5=null;if(typeof Promise<"u")t5=Promise;else t5=z$();F$.exports={Promise:t5}});var w$=N0((M$)=>{(function($,q){if($.setImmediate)return;var Q=1,K={},J=!1,Z=$.document,G;function W(z){if(typeof z!=="function")z=Function(""+z);var N=Array(arguments.length-1);for(var H=0;H"u"?typeof global>"u"?M$:global:self)});var T0=N0((_0)=>{var e2=n2(),nV=o5(),s1=T6(),e5=r1();w$();function dV($){var q=null;if(e2.uint8array)q=new Uint8Array($.length);else q=Array($.length);return y8($,q)}_0.newBlob=function($,q){_0.checkSupport("blob");try{return new Blob([$],{type:q})}catch(J){try{var Q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,K=new Q;return K.append($),K.getBlob(q)}catch(Z){throw Error("Bug : can't construct the Blob.")}}};function _6($){return $}function y8($,q){for(var Q=0;Q<$.length;++Q)q[Q]=$.charCodeAt(Q)&255;return q}var X8={stringifyByChunk:function($,q,Q){var K=[],J=0,Z=$.length;if(Z<=Q)return String.fromCharCode.apply(null,$);while(J1)try{return X8.stringifyByChunk($,Q,q)}catch(J){q=Math.floor(q/2)}return X8.stringifyByChar($)}_0.applyFromCharCode=c6;function h8($,q){for(var Q=0;Q<$.length;Q++)q[Q]=$[Q];return q}var $1={};$1.string={string:_6,array:function($){return y8($,Array($.length))},arraybuffer:function($){return $1.string.uint8array($).buffer},uint8array:function($){return y8($,new Uint8Array($.length))},nodebuffer:function($){return y8($,s1.allocBuffer($.length))}};$1.array={string:c6,array:_6,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom($)}};$1.arraybuffer={string:function($){return c6(new Uint8Array($))},array:function($){return h8(new Uint8Array($),Array($.byteLength))},arraybuffer:_6,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom(new Uint8Array($))}};$1.uint8array={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:_6,nodebuffer:function($){return s1.newBufferFrom($)}};$1.nodebuffer={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $1.nodebuffer.uint8array($).buffer},uint8array:function($){return h8($,new Uint8Array($.length))},nodebuffer:_6};_0.transformTo=function($,q){if(!q)q="";if(!$)return q;_0.checkSupport($);var Q=_0.getTypeOf(q),K=$1[Q][$](q);return K};_0.resolve=function($){var q=$.split("/"),Q=[];for(var K=0;K"u")$[Q]=arguments[q][Q];return $};_0.prepareContent=function($,q,Q,K,J){var Z=e5.Promise.resolve(q).then(function(G){var W=e2.blob&&(G instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(G))!==-1);if(W&&typeof FileReader<"u")return new e5.Promise(function(B,V){var U=new FileReader;U.onload=function(w){B(w.target.result)},U.onerror=function(w){V(w.target.error)},U.readAsArrayBuffer(G)});else return G});return Z.then(function(G){var W=_0.getTypeOf(G);if(!W)return e5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(W==="arraybuffer")G=_0.transformTo("uint8array",G);else if(W==="string"){if(J)G=nV.decode(G);else if(Q){if(K!==!0)G=dV(G)}}return G})}});var V2=N0((gz,Y$)=>{function N$($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}N$.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,q){return this._listeners[$].push(q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,q){if(this._listeners[$])for(var Q=0;Q "+$;else return $}};Y$.exports=N$});var e1=N0((Q1)=>{var t1=T0(),L1=n2(),mV=T6(),x8=V2(),b6=Array(256);for(X2=0;X2<256;X2++)b6[X2]=X2>=252?6:X2>=248?5:X2>=240?4:X2>=224?3:X2>=192?2:1;var X2;b6[254]=b6[254]=1;var pV=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q},iV=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+b6[$[Q]]>q?Q:q},oV=function($){var q,Q,K,J,Z=$.length,G=Array(Z*2);for(Q=0,q=0;q4){G[Q++]=65533,q+=J-1;continue}K&=J===2?31:J===3?15:7;while(J>1&&q1){G[Q++]=65533;continue}if(K<65536)G[Q++]=K;else K-=65536,G[Q++]=55296|K>>10&1023,G[Q++]=56320|K&1023}if(G.length!==Q)if(G.subarray)G=G.subarray(0,Q);else G.length=Q;return t1.applyFromCharCode(G)};Q1.utf8encode=function(q){if(L1.nodebuffer)return mV.newBufferFrom(q,"utf-8");return pV(q)};Q1.utf8decode=function(q){if(L1.nodebuffer)return t1.transformTo("nodebuffer",q).toString("utf-8");return q=t1.transformTo(L1.uint8array?"uint8array":"array",q),oV(q)};function O8(){x8.call(this,"utf-8 decode"),this.leftOver=null}t1.inherits(O8,x8);O8.prototype.processChunk=function($){var q=t1.transformTo(L1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(L1.uint8array){var Q=q;q=new Uint8Array(Q.length+this.leftOver.length),q.set(this.leftOver,0),q.set(Q,this.leftOver.length)}else q=this.leftOver.concat(q);this.leftOver=null}var K=iV(q),J=q;if(K!==q.length)if(L1.uint8array)J=q.subarray(0,K),this.leftOver=q.subarray(K,q.length);else J=q.slice(0,K),this.leftOver=q.slice(K,q.length);this.push({data:Q1.utf8decode(J),meta:$.meta})};O8.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:Q1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};Q1.Utf8DecodeWorker=O8;function $4(){x8.call(this,"utf-8 encode")}t1.inherits($4,x8);$4.prototype.processChunk=function($){this.push({data:Q1.utf8encode($.data),meta:$.meta})};Q1.Utf8EncodeWorker=$4});var H$=N0((Xz,L$)=>{var k$=V2(),D$=T0();function Q4($){k$.call(this,"ConvertWorker to "+$),this.destType=$}D$.inherits(Q4,k$);Q4.prototype.processChunk=function($){this.push({data:D$.transformTo(this.destType,$.data),meta:$.meta})};L$.exports=Q4});var R$=N0((yz,f$)=>{var v$=m5().Readable,aV=T0();aV.inherits(q4,v$);function q4($,q,Q){v$.call(this,q),this._helper=$;var K=this;$.on("data",function(J,Z){if(!K.push(J))K._helper.pause();if(Q)Q(Z)}).on("error",function(J){K.emit("error",J)}).on("end",function(){K.push(null)})}q4.prototype._read=function(){this._helper.resume()};f$.exports=q4});var K4=N0((hz,j$)=>{var H1=T0(),lV=H$(),rV=V2(),sV=o5(),tV=n2(),eV=r1(),I$=null;if(tV.nodestream)try{I$=R$()}catch($){}function $U($,q,Q){switch($){case"blob":return H1.newBlob(H1.transformTo("arraybuffer",q),Q);case"base64":return sV.encode(q);default:return H1.transformTo($,q)}}function QU($,q){var Q,K=0,J=null,Z=0;for(Q=0;Q{D2.base64=!1;D2.binary=!1;D2.dir=!1;D2.createFolders=!0;D2.date=null;D2.compression=null;D2.compressionOptions=null;D2.comment=null;D2.unixPermissions=null;D2.dosPermissions=null});var V4=N0((Oz,g$)=>{var P8=T0(),T8=V2(),KU=16384;function $6($){T8.call(this,"DataWorker");var q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(Q){if(q.dataIsReady=!0,q.data=Q,q.max=Q&&Q.length||0,q.type=P8.getTypeOf(Q),!q.isPaused)q._tickAndRepeat()},function(Q){q.error(Q)})}P8.inherits($6,T8);$6.prototype.cleanUp=function(){T8.prototype.cleanUp.call(this),this.data=null};$6.prototype.resume=function(){if(!T8.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,P8.delay(this._tickAndRepeat,[],this);return!0};$6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)P8.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};$6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=KU,q=null,Q=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":q=this.data.substring(this.index,Q);break;case"uint8array":q=this.data.subarray(this.index,Q);break;case"array":case"nodebuffer":q=this.data.slice(this.index,Q);break}return this.index=Q,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})}};g$.exports=$6});var u8=N0((Pz,X$)=>{var JU=T0();function VU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var A$=VU();function UU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}function ZU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q.charCodeAt(G))&255];return $^-1}X$.exports=function(q,Q){if(typeof q>"u"||!q.length)return 0;var K=JU.getTypeOf(q)!=="string";if(K)return UU(Q|0,q,q.length,0);else return ZU(Q|0,q,q.length,0)}});var Z4=N0((Tz,h$)=>{var y$=V2(),GU=u8(),WU=T0();function U4(){y$.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}WU.inherits(U4,y$);U4.prototype.processChunk=function($){this.streamInfo.crc32=GU($.data,this.streamInfo.crc32||0),this.push($)};h$.exports=U4});var O$=N0((uz,x$)=>{var BU=T0(),G4=V2();function W4($){G4.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}BU.inherits(W4,G4);W4.prototype.processChunk=function($){if($){var q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=q+$.data.length}G4.prototype.processChunk.call(this,$)};x$.exports=W4});var S8=N0((Sz,u$)=>{var P$=r1(),T$=V4(),zU=Z4(),B4=O$();function z4($,q,Q,K,J){this.compressedSize=$,this.uncompressedSize=q,this.crc32=Q,this.compression=K,this.compressedContent=J}z4.prototype={getContentWorker:function(){var $=new T$(P$.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new B4("data_length")),q=this;return $.on("end",function(){if(this.streamInfo.data_length!==q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new T$(P$.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};z4.createWorkerFrom=function($,q,Q){return $.pipe(new zU).pipe(new B4("uncompressedSize")).pipe(q.compressWorker(Q)).pipe(new B4("compressedSize")).withStreamInfo("compression",q)};u$.exports=z4});var c$=N0((Ez,_$)=>{var FU=K4(),MU=V4(),F4=e1(),M4=S8(),S$=V2(),w4=function($,q,Q){this.name=$,this.dir=Q.dir,this.date=Q.date,this.comment=Q.comment,this.unixPermissions=Q.unixPermissions,this.dosPermissions=Q.dosPermissions,this._data=q,this._dataBinary=Q.binary,this.options={compression:Q.compression,compressionOptions:Q.compressionOptions}};w4.prototype={internalStream:function($){var q=null,Q="string";try{if(!$)throw Error("No output type specified.");Q=$.toLowerCase();var K=Q==="string"||Q==="text";if(Q==="binarystring"||Q==="text")Q="string";q=this._decompressWorker();var J=!this._dataBinary;if(J&&!K)q=q.pipe(new F4.Utf8EncodeWorker);if(!J&&K)q=q.pipe(new F4.Utf8DecodeWorker)}catch(Z){q=new S$("error"),q.error(Z)}return new FU(q,Q,"")},async:function($,q){return this.internalStream($).accumulate(q)},nodeStream:function($,q){return this.internalStream($||"nodebuffer").toNodejsStream(q)},_compressWorker:function($,q){if(this._data instanceof M4&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var Q=this._decompressWorker();if(!this._dataBinary)Q=Q.pipe(new F4.Utf8EncodeWorker);return M4.createWorkerFrom(Q,$,q)}},_decompressWorker:function(){if(this._data instanceof M4)return this._data.getContentWorker();else if(this._data instanceof S$)return this._data;else return new MU(this._data)}};var E$=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],wU=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(n6=0;n6{var NU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function YU($,q){return Object.prototype.hasOwnProperty.call($,q)}l0.assign=function($){var q=Array.prototype.slice.call(arguments,1);while(q.length){var Q=q.shift();if(!Q)continue;if(typeof Q!=="object")throw TypeError(Q+"must be non-object");for(var K in Q)if(YU(Q,K))$[K]=Q[K]}return $};l0.shrinkBuf=function($,q){if($.length===q)return $;if($.subarray)return $.subarray(0,q);return $.length=q,$};var kU={arraySet:function($,q,Q,K,J){if(q.subarray&&$.subarray){$.set(q.subarray(Q,Q+K),J);return}for(var Z=0;Z{var LU=d2(),HU=4,b$=0,n$=1,vU=2;function q6($){var q=$.length;while(--q>=0)$[q]=0}var fU=0,a$=1,RU=2,IU=3,CU=258,v4=29,a6=256,m6=a6+1+v4,Q6=30,f4=19,l$=2*m6+1,v1=15,N4=16,jU=7,R4=256,r$=16,s$=17,t$=18,L4=[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],E8=[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],gU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],AU=512,m2=Array((m6+2)*2);q6(m2);var d6=Array(Q6*2);q6(d6);var p6=Array(AU);q6(p6);var i6=Array(CU-IU+1);q6(i6);var I4=Array(v4);q6(I4);var _8=Array(Q6);q6(_8);function Y4($,q,Q,K,J){this.static_tree=$,this.extra_bits=q,this.extra_base=Q,this.elems=K,this.max_length=J,this.has_stree=$&&$.length}var $Q,QQ,qQ;function k4($,q){this.dyn_tree=$,this.max_code=0,this.stat_desc=q}function KQ($){return $<256?p6[$]:p6[256+($>>>7)]}function o6($,q){$.pending_buf[$.pending++]=q&255,$.pending_buf[$.pending++]=q>>>8&255}function $2($,q,Q){if($.bi_valid>N4-Q)$.bi_buf|=q<<$.bi_valid&65535,o6($,$.bi_buf),$.bi_buf=q>>N4-$.bi_valid,$.bi_valid+=Q-N4;else $.bi_buf|=q<<$.bi_valid&65535,$.bi_valid+=Q}function y2($,q,Q){$2($,Q[q*2],Q[q*2+1])}function JQ($,q){var Q=0;do Q|=$&1,$>>>=1,Q<<=1;while(--q>0);return Q>>>1}function XU($){if($.bi_valid===16)o6($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function yU($,q){var{dyn_tree:Q,max_code:K}=q,J=q.stat_desc.static_tree,Z=q.stat_desc.has_stree,G=q.stat_desc.extra_bits,W=q.stat_desc.extra_base,B=q.stat_desc.max_length,V,U,w,F,M,k,f=0;for(F=0;F<=v1;F++)$.bl_count[F]=0;Q[$.heap[$.heap_max]*2+1]=0;for(V=$.heap_max+1;VB)F=B,f++;if(Q[U*2+1]=F,U>K)continue;if($.bl_count[F]++,M=0,U>=W)M=G[U-W];if(k=Q[U*2],$.opt_len+=k*(F+M),Z)$.static_len+=k*(J[U*2+1]+M)}if(f===0)return;do{F=B-1;while($.bl_count[F]===0)F--;$.bl_count[F]--,$.bl_count[F+1]+=2,$.bl_count[B]--,f-=2}while(f>0);for(F=B;F!==0;F--){U=$.bl_count[F];while(U!==0){if(w=$.heap[--V],w>K)continue;if(Q[w*2+1]!==F)$.opt_len+=(F-Q[w*2+1])*Q[w*2],Q[w*2+1]=F;U--}}}function VQ($,q,Q){var K=Array(v1+1),J=0,Z,G;for(Z=1;Z<=v1;Z++)K[Z]=J=J+Q[Z-1]<<1;for(G=0;G<=q;G++){var W=$[G*2+1];if(W===0)continue;$[G*2]=JQ(K[W]++,W)}}function hU(){var $,q,Q,K,J,Z=Array(v1+1);Q=0;for(K=0;K>=7;for(;K8)o6($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function xU($,q,Q,K){if(ZQ($),K)o6($,Q),o6($,~Q);LU.arraySet($.pending_buf,$.window,q,Q,$.pending),$.pending+=Q}function d$($,q,Q,K){var J=q*2,Z=Q*2;return $[J]<$[Z]||$[J]===$[Z]&&K[q]<=K[Q]}function D4($,q,Q){var K=$.heap[Q],J=Q<<1;while(J<=$.heap_len){if(J<$.heap_len&&d$(q,$.heap[J+1],$.heap[J],$.depth))J++;if(d$(q,K,$.heap[J],$.depth))break;$.heap[Q]=$.heap[J],Q=J,J<<=1}$.heap[Q]=K}function m$($,q,Q){var K,J,Z=0,G,W;if($.last_lit!==0)do if(K=$.pending_buf[$.d_buf+Z*2]<<8|$.pending_buf[$.d_buf+Z*2+1],J=$.pending_buf[$.l_buf+Z],Z++,K===0)y2($,J,q);else{if(G=i6[J],y2($,G+a6+1,q),W=L4[G],W!==0)J-=I4[G],$2($,J,W);if(K--,G=KQ(K),y2($,G,Q),W=E8[G],W!==0)K-=_8[G],$2($,K,W)}while(Z<$.last_lit);y2($,R4,q)}function H4($,q){var Q=q.dyn_tree,K=q.stat_desc.static_tree,J=q.stat_desc.has_stree,Z=q.stat_desc.elems,G,W,B=-1,V;$.heap_len=0,$.heap_max=l$;for(G=0;G>1;G>=1;G--)D4($,Q,G);V=Z;do G=$.heap[1],$.heap[1]=$.heap[$.heap_len--],D4($,Q,1),W=$.heap[1],$.heap[--$.heap_max]=G,$.heap[--$.heap_max]=W,Q[V*2]=Q[G*2]+Q[W*2],$.depth[V]=($.depth[G]>=$.depth[W]?$.depth[G]:$.depth[W])+1,Q[G*2+1]=Q[W*2+1]=V,$.heap[1]=V++,D4($,Q,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],yU($,q),VQ(Q,B,$.bl_count)}function p$($,q,Q){var K,J=-1,Z,G=q[1],W=0,B=7,V=4;if(G===0)B=138,V=3;q[(Q+1)*2+1]=65535;for(K=0;K<=Q;K++){if(Z=G,G=q[(K+1)*2+1],++W=3;q--)if($.bl_tree[e$[q]*2+1]!==0)break;return $.opt_len+=3*(q+1)+5+5+4,q}function PU($,q,Q,K){var J;$2($,q-257,5),$2($,Q-1,5),$2($,K-4,4);for(J=0;J>>=1)if(q&1&&$.dyn_ltree[Q*2]!==0)return b$;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return n$;for(Q=32;Q0){if($.strm.data_type===vU)$.strm.data_type=TU($);if(H4($,$.l_desc),H4($,$.d_desc),G=OU($),J=$.opt_len+3+7>>>3,Z=$.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=Q+5;if(Q+4<=J&&q!==-1)GQ($,q,Q,K);else if($.strategy===HU||Z===J)$2($,(a$<<1)+(K?1:0),3),m$($,m2,d6);else $2($,(RU<<1)+(K?1:0),3),PU($,$.l_desc.max_code+1,$.d_desc.max_code+1,G+1),m$($,$.dyn_ltree,$.dyn_dtree);if(UQ($),K)ZQ($)}function _U($,q,Q){if($.pending_buf[$.d_buf+$.last_lit*2]=q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=q&255,$.pending_buf[$.l_buf+$.last_lit]=Q&255,$.last_lit++,q===0)$.dyn_ltree[Q*2]++;else $.matches++,q--,$.dyn_ltree[(i6[Q]+a6+1)*2]++,$.dyn_dtree[KQ(q)*2]++;return $.last_lit===$.lit_bufsize-1}K6._tr_init=uU;K6._tr_stored_block=GQ;K6._tr_flush_block=EU;K6._tr_tally=_U;K6._tr_align=SU});var C4=N0((bz,BQ)=>{function cU($,q,Q,K){var J=$&65535|0,Z=$>>>16&65535|0,G=0;while(Q!==0){G=Q>2000?2000:Q,Q-=G;do J=J+q[K++]|0,Z=Z+J|0;while(--G);J%=65521,Z%=65521}return J|Z<<16|0}BQ.exports=cU});var j4=N0((nz,zQ)=>{function bU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var nU=bU();function dU($,q,Q,K){var J=nU,Z=K+Q;$^=-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}zQ.exports=dU});var c8=N0((dz,FQ)=>{FQ.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var vQ=N0((O2)=>{var r0=d2(),M2=WQ(),YQ=C4(),q1=j4(),mU=c8(),C1=0,pU=1,iU=3,Z1=4,MQ=5,x2=0,wQ=1,w2=-2,oU=-3,g4=-5,aU=-1,lU=1,b8=2,rU=3,sU=4,tU=0,eU=2,p8=8,$Z=9,QZ=15,qZ=8,KZ=29,JZ=256,X4=JZ+1+KZ,VZ=30,UZ=19,ZZ=2*X4+1,GZ=15,f0=3,V1=258,L2=V1+f0+1,WZ=32,i8=42,y4=69,n8=73,d8=91,m8=103,f1=113,r6=666,c0=1,s6=2,R1=3,U6=4,BZ=3;function U1($,q){return $.msg=mU[q],q}function NQ($){return($<<1)-($>4?9:0)}function J1($){var q=$.length;while(--q>=0)$[q]=0}function K1($){var q=$.state,Q=q.pending;if(Q>$.avail_out)Q=$.avail_out;if(Q===0)return;if(r0.arraySet($.output,q.pending_buf,q.pending_out,Q,$.next_out),$.next_out+=Q,q.pending_out+=Q,$.total_out+=Q,$.avail_out-=Q,q.pending-=Q,q.pending===0)q.pending_out=0}function d0($,q){M2._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,q),$.block_start=$.strstart,K1($.strm)}function C0($,q){$.pending_buf[$.pending++]=q}function l6($,q){$.pending_buf[$.pending++]=q>>>8&255,$.pending_buf[$.pending++]=q&255}function zZ($,q,Q,K){var J=$.avail_in;if(J>K)J=K;if(J===0)return 0;if($.avail_in-=J,r0.arraySet(q,$.input,$.next_in,J,Q),$.state.wrap===1)$.adler=YQ($.adler,q,J,Q);else if($.state.wrap===2)$.adler=q1($.adler,q,J,Q);return $.next_in+=J,$.total_in+=J,J}function kQ($,q){var{max_chain_length:Q,strstart:K}=$,J,Z,G=$.prev_length,W=$.nice_match,B=$.strstart>$.w_size-L2?$.strstart-($.w_size-L2):0,V=$.window,U=$.w_mask,w=$.prev,F=$.strstart+V1,M=V[K+G-1],k=V[K+G];if($.prev_length>=$.good_match)Q>>=2;if(W>$.lookahead)W=$.lookahead;do{if(J=q,V[J+G]!==k||V[J+G-1]!==M||V[J]!==V[K]||V[++J]!==V[K+1])continue;K+=2,J++;do;while(V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&KG){if($.match_start=q,G=Z,Z>=W)break;M=V[K+G-1],k=V[K+G]}}while((q=w[q&U])>B&&--Q!==0);if(G<=$.lookahead)return G;return $.lookahead}function I1($){var q=$.w_size,Q,K,J,Z,G;do{if(Z=$.window_size-$.lookahead-$.strstart,$.strstart>=q+(q-L2)){r0.arraySet($.window,$.window,q,q,0),$.match_start-=q,$.strstart-=q,$.block_start-=q,K=$.hash_size,Q=K;do J=$.head[--Q],$.head[Q]=J>=q?J-q:0;while(--K);K=q,Q=K;do J=$.prev[--Q],$.prev[Q]=J>=q?J-q:0;while(--K);Z+=q}if($.strm.avail_in===0)break;if(K=zZ($.strm,$.window,$.strstart+$.lookahead,Z),$.lookahead+=K,$.lookahead+$.insert>=f0){G=$.strstart-$.insert,$.ins_h=$.window[G],$.ins_h=($.ins_h<<$.hash_shift^$.window[G+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[G+f0-1])&$.hash_mask,$.prev[G&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=G,G++,$.insert--,$.lookahead+$.insert$.pending_buf_size-5)Q=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(I1($),$.lookahead===0&&q===C1)return c0;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var K=$.block_start+Q;if($.strstart===0||$.strstart>=K){if($.lookahead=$.strstart-K,$.strstart=K,d0($,!1),$.strm.avail_out===0)return c0}if($.strstart-$.block_start>=$.w_size-L2){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.strstart>$.block_start){if(d0($,!1),$.strm.avail_out===0)return c0}return c0}function A4($,q){var Q,K;for(;;){if($.lookahead=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(Q!==0&&$.strstart-Q<=$.w_size-L2)$.match_length=kQ($,Q);if($.match_length>=f0)if(K=M2._tr_tally($,$.strstart-$.match_start,$.match_length-f0),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=f0){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else K=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(K){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=$.strstart=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=f0-1,Q!==0&&$.prev_length<$.max_lazy_match&&$.strstart-Q<=$.w_size-L2){if($.match_length=kQ($,Q),$.match_length<=5&&($.strategy===lU||$.match_length===f0&&$.strstart-$.match_start>4096))$.match_length=f0-1}if($.prev_length>=f0&&$.match_length<=$.prev_length){J=$.strstart+$.lookahead-f0,K=M2._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-f0),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=J)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=f0-1,$.strstart++,K){if(d0($,!1),$.strm.avail_out===0)return c0}}else if($.match_available){if(K=M2._tr_tally($,0,$.window[$.strstart-1]),K)d0($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return c0}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)K=M2._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart=f0&&$.strstart>0){if(J=$.strstart-1,K=G[J],K===G[++J]&&K===G[++J]&&K===G[++J]){Z=$.strstart+V1;do;while(K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&J$.lookahead)$.match_length=$.lookahead}}if($.match_length>=f0)Q=M2._tr_tally($,1,$.match_length-f0),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function wZ($,q){var Q;for(;;){if($.lookahead===0){if(I1($),$.lookahead===0){if(q===C1)return c0;break}}if($.match_length=0,Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function h2($,q,Q,K,J){this.good_length=$,this.max_lazy=q,this.nice_length=Q,this.max_chain=K,this.func=J}var V6;V6=[new h2(0,0,0,0,FZ),new h2(4,4,8,4,A4),new h2(4,5,16,8,A4),new h2(4,6,32,32,A4),new h2(4,4,16,16,J6),new h2(8,16,32,32,J6),new h2(8,16,128,128,J6),new h2(8,32,128,256,J6),new h2(32,128,258,1024,J6),new h2(32,258,258,4096,J6)];function NZ($){$.window_size=2*$.w_size,J1($.head),$.max_lazy_match=V6[$.level].max_lazy,$.good_match=V6[$.level].good_length,$.nice_match=V6[$.level].nice_length,$.max_chain_length=V6[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=f0-1,$.match_available=0,$.ins_h=0}function YZ(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=p8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r0.Buf16(ZZ*2),this.dyn_dtree=new r0.Buf16((2*VZ+1)*2),this.bl_tree=new r0.Buf16((2*UZ+1)*2),J1(this.dyn_ltree),J1(this.dyn_dtree),J1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r0.Buf16(GZ+1),this.heap=new r0.Buf16(2*X4+1),J1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r0.Buf16(2*X4+1),J1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function DQ($){var q;if(!$||!$.state)return U1($,w2);if($.total_in=$.total_out=0,$.data_type=eU,q=$.state,q.pending=0,q.pending_out=0,q.wrap<0)q.wrap=-q.wrap;return q.status=q.wrap?i8:f1,$.adler=q.wrap===2?0:1,q.last_flush=C1,M2._tr_init(q),x2}function LQ($){var q=DQ($);if(q===x2)NZ($.state);return q}function kZ($,q){if(!$||!$.state)return w2;if($.state.wrap!==2)return w2;return $.state.gzhead=q,x2}function HQ($,q,Q,K,J,Z){if(!$)return w2;var G=1;if(q===aU)q=6;if(K<0)G=0,K=-K;else if(K>15)G=2,K-=16;if(J<1||J>$Z||Q!==p8||K<8||K>15||q<0||q>9||Z<0||Z>sU)return U1($,w2);if(K===8)K=9;var W=new YZ;return $.state=W,W.strm=$,W.wrap=G,W.gzhead=null,W.w_bits=K,W.w_size=1<MQ||q<0)return $?U1($,w2):w2;if(K=$.state,!$.output||!$.input&&$.avail_in!==0||K.status===r6&&q!==Z1)return U1($,$.avail_out===0?g4:w2);if(K.strm=$,Q=K.last_flush,K.last_flush=q,K.status===i8)if(K.wrap===2)if($.adler=0,C0(K,31),C0(K,139),C0(K,8),!K.gzhead)C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,BZ),K.status=f1;else{if(C0(K,(K.gzhead.text?1:0)+(K.gzhead.hcrc?2:0)+(!K.gzhead.extra?0:4)+(!K.gzhead.name?0:8)+(!K.gzhead.comment?0:16)),C0(K,K.gzhead.time&255),C0(K,K.gzhead.time>>8&255),C0(K,K.gzhead.time>>16&255),C0(K,K.gzhead.time>>24&255),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)C0(K,K.gzhead.extra.length&255),C0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)$.adler=q1($.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=y4}else{var G=p8+(K.w_bits-8<<4)<<8,W=-1;if(K.strategy>=b8||K.level<2)W=0;else if(K.level<6)W=1;else if(K.level===6)W=2;else W=3;if(G|=W<<6,K.strstart!==0)G|=WZ;if(G+=31-G%31,K.status=f1,l6(K,G),K.strstart!==0)l6(K,$.adler>>>16),l6(K,$.adler&65535);$.adler=1}if(K.status===y4)if(K.gzhead.extra){J=K.pending;while(K.gzindex<(K.gzhead.extra.length&65535)){if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size)break}C0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=n8}else K.status=n8;if(K.status===n8)if(K.gzhead.name){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.gzindex=0,K.status=d8}else K.status=d8;if(K.status===d8)if(K.gzhead.comment){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.status=m8}else K.status=m8;if(K.status===m8)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)K1($);if(K.pending+2<=K.pending_buf_size)C0(K,$.adler&255),C0(K,$.adler>>8&255),$.adler=0,K.status=f1}else K.status=f1;if(K.pending!==0){if(K1($),$.avail_out===0)return K.last_flush=-1,x2}else if($.avail_in===0&&NQ(q)<=NQ(Q)&&q!==Z1)return U1($,g4);if(K.status===r6&&$.avail_in!==0)return U1($,g4);if($.avail_in!==0||K.lookahead!==0||q!==C1&&K.status!==r6){var B=K.strategy===b8?wZ(K,q):K.strategy===rU?MZ(K,q):V6[K.level].func(K,q);if(B===R1||B===U6)K.status=r6;if(B===c0||B===R1){if($.avail_out===0)K.last_flush=-1;return x2}if(B===s6){if(q===pU)M2._tr_align(K);else if(q!==MQ){if(M2._tr_stored_block(K,0,0,!1),q===iU){if(J1(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(K1($),$.avail_out===0)return K.last_flush=-1,x2}}if(q!==Z1)return x2;if(K.wrap<=0)return wQ;if(K.wrap===2)C0(K,$.adler&255),C0(K,$.adler>>8&255),C0(K,$.adler>>16&255),C0(K,$.adler>>24&255),C0(K,$.total_in&255),C0(K,$.total_in>>8&255),C0(K,$.total_in>>16&255),C0(K,$.total_in>>24&255);else l6(K,$.adler>>>16),l6(K,$.adler&65535);if(K1($),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?x2:wQ}function HZ($){var q;if(!$||!$.state)return w2;if(q=$.state.status,q!==i8&&q!==y4&&q!==n8&&q!==d8&&q!==m8&&q!==f1&&q!==r6)return U1($,w2);return $.state=null,q===f1?U1($,oU):x2}function vZ($,q){var Q=q.length,K,J,Z,G,W,B,V,U;if(!$||!$.state)return w2;if(K=$.state,G=K.wrap,G===2||G===1&&K.status!==i8||K.lookahead)return w2;if(G===1)$.adler=YQ($.adler,q,Q,0);if(K.wrap=0,Q>=K.w_size){if(G===0)J1(K.head),K.strstart=0,K.block_start=0,K.insert=0;U=new r0.Buf8(K.w_size),r0.arraySet(U,q,Q-K.w_size,K.w_size,0),q=U,Q=K.w_size}W=$.avail_in,B=$.next_in,V=$.input,$.avail_in=Q,$.next_in=0,$.input=q,I1(K);while(K.lookahead>=f0){J=K.strstart,Z=K.lookahead-(f0-1);do K.ins_h=(K.ins_h<{var o8=d2(),fQ=!0,RQ=!0;try{String.fromCharCode.apply(null,[0])}catch($){fQ=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){RQ=!1}var t6=new o8.Buf8(256);for(P2=0;P2<256;P2++)t6[P2]=P2>=252?6:P2>=248?5:P2>=240?4:P2>=224?3:P2>=192?2:1;var P2;t6[254]=t6[254]=1;Z6.string2buf=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q};function IQ($,q){if(q<65534){if($.subarray&&RQ||!$.subarray&&fQ)return String.fromCharCode.apply(null,o8.shrinkBuf($,q))}var Q="";for(var K=0;K4){W[K++]=65533,Q+=Z-1;continue}J&=Z===2?31:Z===3?15:7;while(Z>1&&Q1){W[K++]=65533;continue}if(J<65536)W[K++]=J;else J-=65536,W[K++]=55296|J>>10&1023,W[K++]=56320|J&1023}return IQ(W,K)};Z6.utf8border=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+t6[$[Q]]>q?Q:q}});var x4=N0((iz,CQ)=>{function fZ(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}CQ.exports=fZ});var XQ=N0((Q8)=>{var e6=vQ(),$8=d2(),P4=h4(),T4=c8(),RZ=x4(),AQ=Object.prototype.toString,IZ=0,O4=4,G6=0,jQ=1,gQ=2,CZ=-1,jZ=0,gZ=8;function j1($){if(!(this instanceof j1))return new j1($);this.options=$8.assign({level:CZ,method:gZ,chunkSize:16384,windowBits:15,memLevel:8,strategy:jZ,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>0)q.windowBits=-q.windowBits;else if(q.gzip&&q.windowBits>0&&q.windowBits<16)q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new RZ,this.strm.avail_out=0;var Q=e6.deflateInit2(this.strm,q.level,q.method,q.windowBits,q.memLevel,q.strategy);if(Q!==G6)throw Error(T4[Q]);if(q.header)e6.deflateSetHeader(this.strm,q.header);if(q.dictionary){var K;if(typeof q.dictionary==="string")K=P4.string2buf(q.dictionary);else if(AQ.call(q.dictionary)==="[object ArrayBuffer]")K=new Uint8Array(q.dictionary);else K=q.dictionary;if(Q=e6.deflateSetDictionary(this.strm,K),Q!==G6)throw Error(T4[Q]);this._dict_set=!0}}j1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J,Z;if(this.ended)return!1;if(Z=q===~~q?q:q===!0?O4:IZ,typeof $==="string")Q.input=P4.string2buf($);else if(AQ.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new $8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(J=e6.deflate(Q,Z),J!==jQ&&J!==G6)return this.onEnd(J),this.ended=!0,!1;if(Q.avail_out===0||Q.avail_in===0&&(Z===O4||Z===gQ))if(this.options.to==="string")this.onData(P4.buf2binstring($8.shrinkBuf(Q.output,Q.next_out)));else this.onData($8.shrinkBuf(Q.output,Q.next_out))}while((Q.avail_in>0||Q.avail_out===0)&&J!==jQ);if(Z===O4)return J=e6.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===G6;if(Z===gQ)return this.onEnd(G6),Q.avail_out=0,!0;return!0};j1.prototype.onData=function($){this.chunks.push($)};j1.prototype.onEnd=function($){if($===G6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=$8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function u4($,q){var Q=new j1(q);if(Q.push($,!0),Q.err)throw Q.msg||T4[Q.err];return Q.result}function AZ($,q){return q=q||{},q.raw=!0,u4($,q)}function XZ($,q){return q=q||{},q.gzip=!0,u4($,q)}Q8.Deflate=j1;Q8.deflate=u4;Q8.deflateRaw=AZ;Q8.gzip=XZ});var hQ=N0((az,yQ)=>{var a8=30,yZ=12;yQ.exports=function(q,Q){var K,J,Z,G,W,B,V,U,w,F,M,k,f,L,D,z,N,H,v,j,n,d,_,X,P;K=q.state,J=q.next_in,X=q.input,Z=J+(q.avail_in-5),G=q.next_out,P=q.output,W=G-(Q-q.avail_out),B=G+(q.avail_out-257),V=K.dmax,U=K.wsize,w=K.whave,F=K.wnext,M=K.window,k=K.hold,f=K.bits,L=K.lencode,D=K.distcode,z=(1<>>24,k>>>=v,f-=v,v=H>>>16&255,v===0)P[G++]=H&65535;else if(v&16){if(j=H&65535,v&=15,v){if(f>>=v,f-=v}if(f<15)k+=X[J++]<>>24,k>>>=v,f-=v,v=H>>>16&255,v&16){if(n=H&65535,v&=15,fV){q.msg="invalid distance too far back",K.mode=a8;break $}if(k>>>=v,f-=v,v=G-W,n>v){if(v=n-v,v>w){if(K.sane){q.msg="invalid distance too far back",K.mode=a8;break $}}if(d=0,_=M,F===0){if(d+=U-v,v2)P[G++]=_[d++],P[G++]=_[d++],P[G++]=_[d++],j-=3;if(j){if(P[G++]=_[d++],j>1)P[G++]=_[d++]}}else{d=G-n;do P[G++]=P[d++],P[G++]=P[d++],P[G++]=P[d++],j-=3;while(j>2);if(j){if(P[G++]=P[d++],j>1)P[G++]=P[d++]}}}else if((v&64)===0){H=D[(H&65535)+(k&(1<>3,J-=j,f-=j<<3,k&=(1<{var xQ=d2(),W6=15,OQ=852,PQ=592,TQ=0,S4=1,uQ=2,hZ=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],xZ=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],OZ=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],PZ=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];SQ.exports=function(q,Q,K,J,Z,G,W,B){var V=B.bits,U=0,w=0,F=0,M=0,k=0,f=0,L=0,D=0,z=0,N=0,H,v,j,n,d,_=null,X=0,P,g=new xQ.Buf16(W6+1),c=new xQ.Buf16(W6+1),h=null,x=0,l,$0,Z0;for(U=0;U<=W6;U++)g[U]=0;for(w=0;w=1;M--)if(g[M]!==0)break;if(k>M)k=M;if(M===0)return Z[G++]=20971520,Z[G++]=20971520,B.bits=1,0;for(F=1;F0&&(q===TQ||M!==1))return-1;c[1]=0;for(U=1;UOQ||q===uQ&&z>PQ)return 1;for(;;){if(l=U-L,W[w]P)$0=h[x+W[w]],Z0=_[X+W[w]];else $0=96,Z0=0;H=1<>L)+v]=l<<24|$0<<16|Z0|0;while(v!==0);H=1<>=1;if(H!==0)N&=H-1,N+=H;else N=0;if(w++,--g[U]===0){if(U===M)break;U=Q[K+W[w]]}if(U>k&&(N&n)!==j){if(L===0)L=k;d+=F,f=U-L,D=1<OQ||q===uQ&&z>PQ)return 1;j=N&n,Z[j]=k<<24|f<<16|d-G|0}}if(N!==0)Z[d+N]=U-L<<24|4194304|0;return B.bits=k,0}});var Lq=N0((H2)=>{var U2=d2(),d4=C4(),T2=j4(),TZ=hQ(),q8=EQ(),uZ=0,Bq=1,zq=2,_Q=4,SZ=5,l8=6,g1=0,EZ=1,_Z=2,N2=-2,Fq=-3,m4=-4,cZ=-5,cQ=8,Mq=1,bQ=2,nQ=3,dQ=4,mQ=5,pQ=6,iQ=7,oQ=8,aQ=9,lQ=10,t8=11,p2=12,E4=13,rQ=14,_4=15,sQ=16,tQ=17,eQ=18,$q=19,r8=20,s8=21,Qq=22,qq=23,Kq=24,Jq=25,Vq=26,c4=27,Uq=28,Zq=29,x0=30,p4=31,bZ=32,nZ=852,dZ=592,mZ=15,pZ=mZ;function Gq($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function iZ(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U2.Buf16(320),this.work=new U2.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function wq($){var q;if(!$||!$.state)return N2;if(q=$.state,$.total_in=$.total_out=q.total=0,$.msg="",q.wrap)$.adler=q.wrap&1;return q.mode=Mq,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new U2.Buf32(nZ),q.distcode=q.distdyn=new U2.Buf32(dZ),q.sane=1,q.back=-1,g1}function Nq($){var q;if(!$||!$.state)return N2;return q=$.state,q.wsize=0,q.whave=0,q.wnext=0,wq($)}function Yq($,q){var Q,K;if(!$||!$.state)return N2;if(K=$.state,q<0)Q=0,q=-q;else if(Q=(q>>4)+1,q<48)q&=15;if(q&&(q<8||q>15))return N2;if(K.window!==null&&K.wbits!==q)K.window=null;return K.wrap=Q,K.wbits=q,Nq($)}function kq($,q){var Q,K;if(!$)return N2;if(K=new iZ,$.state=K,K.window=null,Q=Yq($,q),Q!==g1)$.state=null;return Q}function oZ($){return kq($,pZ)}var Wq=!0,b4,n4;function aZ($){if(Wq){var q;b4=new U2.Buf32(512),n4=new U2.Buf32(32),q=0;while(q<144)$.lens[q++]=8;while(q<256)$.lens[q++]=9;while(q<280)$.lens[q++]=7;while(q<288)$.lens[q++]=8;q8(Bq,$.lens,0,288,b4,0,$.work,{bits:9}),q=0;while(q<32)$.lens[q++]=5;q8(zq,$.lens,0,32,n4,0,$.work,{bits:5}),Wq=!1}$.lencode=b4,$.lenbits=9,$.distcode=n4,$.distbits=5}function Dq($,q,Q,K){var J,Z=$.state;if(Z.window===null)Z.wsize=1<=Z.wsize)U2.arraySet(Z.window,q,Q-Z.wsize,Z.wsize,0),Z.wnext=0,Z.whave=Z.wsize;else{if(J=Z.wsize-Z.wnext,J>K)J=K;if(U2.arraySet(Z.window,q,Q-K,J,Z.wnext),K-=J,K)U2.arraySet(Z.window,q,Q-K,K,0),Z.wnext=K,Z.whave=Z.wsize;else{if(Z.wnext+=J,Z.wnext===Z.wsize)Z.wnext=0;if(Z.whave>>8&255,Q.check=T2(Q.check,_,2,0),V=0,U=0,Q.mode=bQ;break}if(Q.flags=0,Q.head)Q.head.done=!1;if(!(Q.wrap&1)||(((V&255)<<8)+(V>>8))%31){$.msg="incorrect header check",Q.mode=x0;break}if((V&15)!==cQ){$.msg="unknown compression method",Q.mode=x0;break}if(V>>>=4,U-=4,n=(V&15)+8,Q.wbits===0)Q.wbits=n;else if(n>Q.wbits){$.msg="invalid window size",Q.mode=x0;break}Q.dmax=1<>8&1;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=nQ;case nQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>8&255,_[2]=V>>>16&255,_[3]=V>>>24&255,Q.check=T2(Q.check,_,4,0);V=0,U=0,Q.mode=dQ;case dQ:while(U<16){if(W===0)break $;W--,V+=K[Z++]<>8;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=mQ;case mQ:if(Q.flags&1024){while(U<16){if(W===0)break $;W--,V+=K[Z++]<>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0}else if(Q.head)Q.head.extra=null;Q.mode=pQ;case pQ:if(Q.flags&1024){if(M=Q.length,M>W)M=W;if(M){if(Q.head){if(n=Q.head.extra_len-Q.length,!Q.head.extra)Q.head.extra=Array(Q.head.extra_len);U2.arraySet(Q.head.extra,K,Z,M,n)}if(Q.flags&512)Q.check=T2(Q.check,K,M,Z);W-=M,Z+=M,Q.length-=M}if(Q.length)break $}Q.length=0,Q.mode=iQ;case iQ:if(Q.flags&2048){if(W===0)break $;M=0;do if(n=K[Z+M++],Q.head&&n&&Q.length<65536)Q.head.name+=String.fromCharCode(n);while(n&&M>9&1,Q.head.done=!0;$.adler=Q.check=0,Q.mode=p2;break;case lQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>=U&7,U-=U&7,Q.mode=c4;break}while(U<3){if(W===0)break $;W--,V+=K[Z++]<>>=1,U-=1,V&3){case 0:Q.mode=rQ;break;case 1:if(aZ(Q),Q.mode=r8,q===l8){V>>>=2,U-=2;break $}break;case 2:Q.mode=tQ;break;case 3:$.msg="invalid block type",Q.mode=x0}V>>>=2,U-=2;break;case rQ:V>>>=U&7,U-=U&7;while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>16^65535)){$.msg="invalid stored block lengths",Q.mode=x0;break}if(Q.length=V&65535,V=0,U=0,Q.mode=_4,q===l8)break $;case _4:Q.mode=sQ;case sQ:if(M=Q.length,M){if(M>W)M=W;if(M>B)M=B;if(M===0)break $;U2.arraySet(J,K,Z,M,G),W-=M,Z+=M,B-=M,G+=M,Q.length-=M;break}Q.mode=p2;break;case tQ:while(U<14){if(W===0)break $;W--,V+=K[Z++]<>>=5,U-=5,Q.ndist=(V&31)+1,V>>>=5,U-=5,Q.ncode=(V&15)+4,V>>>=4,U-=4,Q.nlen>286||Q.ndist>30){$.msg="too many length or distance symbols",Q.mode=x0;break}Q.have=0,Q.mode=eQ;case eQ:while(Q.have>>=3,U-=3}while(Q.have<19)Q.lens[g[Q.have++]]=0;if(Q.lencode=Q.lendyn,Q.lenbits=7,X={bits:Q.lenbits},d=q8(uZ,Q.lens,0,19,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid code lengths set",Q.mode=x0;break}Q.have=0,Q.mode=$q;case $q:while(Q.have>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=D,U-=D,Q.lens[Q.have++]=N;else{if(N===16){P=D+2;while(U>>=D,U-=D,Q.have===0){$.msg="invalid bit length repeat",Q.mode=x0;break}n=Q.lens[Q.have-1],M=3+(V&3),V>>>=2,U-=2}else if(N===17){P=D+3;while(U>>=D,U-=D,n=0,M=3+(V&7),V>>>=3,U-=3}else{P=D+7;while(U>>=D,U-=D,n=0,M=11+(V&127),V>>>=7,U-=7}if(Q.have+M>Q.nlen+Q.ndist){$.msg="invalid bit length repeat",Q.mode=x0;break}while(M--)Q.lens[Q.have++]=n}}if(Q.mode===x0)break;if(Q.lens[256]===0){$.msg="invalid code -- missing end-of-block",Q.mode=x0;break}if(Q.lenbits=9,X={bits:Q.lenbits},d=q8(Bq,Q.lens,0,Q.nlen,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid literal/lengths set",Q.mode=x0;break}if(Q.distbits=6,Q.distcode=Q.distdyn,X={bits:Q.distbits},d=q8(zq,Q.lens,Q.nlen,Q.ndist,Q.distcode,0,Q.work,X),Q.distbits=X.bits,d){$.msg="invalid distances set",Q.mode=x0;break}if(Q.mode=r8,q===l8)break $;case r8:Q.mode=s8;case s8:if(W>=6&&B>=258){if($.next_out=G,$.avail_out=B,$.next_in=Z,$.avail_in=W,Q.hold=V,Q.bits=U,TZ($,F),G=$.next_out,J=$.output,B=$.avail_out,Z=$.next_in,K=$.input,W=$.avail_in,V=Q.hold,U=Q.bits,Q.mode===p2)Q.back=-1;break}Q.back=0;for(;;){if(L=Q.lencode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,Q.length=N,z===0){Q.mode=Vq;break}if(z&32){Q.back=-1,Q.mode=p2;break}if(z&64){$.msg="invalid literal/length code",Q.mode=x0;break}Q.extra=z&15,Q.mode=Qq;case Qq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}Q.was=Q.length,Q.mode=qq;case qq:for(;;){if(L=Q.distcode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,z&64){$.msg="invalid distance code",Q.mode=x0;break}Q.offset=N,Q.extra=z&15,Q.mode=Kq;case Kq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}if(Q.offset>Q.dmax){$.msg="invalid distance too far back",Q.mode=x0;break}Q.mode=Jq;case Jq:if(B===0)break $;if(M=F-B,Q.offset>M){if(M=Q.offset-M,M>Q.whave){if(Q.sane){$.msg="invalid distance too far back",Q.mode=x0;break}}if(M>Q.wnext)M-=Q.wnext,k=Q.wsize-M;else k=Q.wnext-M;if(M>Q.length)M=Q.length;f=Q.window}else f=J,k=G-Q.offset,M=Q.length;if(M>B)M=B;B-=M,Q.length-=M;do J[G++]=f[k++];while(--M);if(Q.length===0)Q.mode=s8;break;case Vq:if(B===0)break $;J[G++]=Q.length,B--,Q.mode=s8;break;case c4:if(Q.wrap){while(U<32){if(W===0)break $;W--,V|=K[Z++]<{Hq.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var fq=N0((tz,vq)=>{function eZ(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}vq.exports=eZ});var Iq=N0((J8)=>{var B6=Lq(),K8=d2(),e8=h4(),E0=i4(),o4=c8(),$G=x4(),QG=fq(),Rq=Object.prototype.toString;function A1($){if(!(this instanceof A1))return new A1($);this.options=K8.assign({chunkSize:16384,windowBits:0,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>=0&&q.windowBits<16){if(q.windowBits=-q.windowBits,q.windowBits===0)q.windowBits=-15}if(q.windowBits>=0&&q.windowBits<16&&!($&&$.windowBits))q.windowBits+=32;if(q.windowBits>15&&q.windowBits<48){if((q.windowBits&15)===0)q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $G,this.strm.avail_out=0;var Q=B6.inflateInit2(this.strm,q.windowBits);if(Q!==E0.Z_OK)throw Error(o4[Q]);if(this.header=new QG,B6.inflateGetHeader(this.strm,this.header),q.dictionary){if(typeof q.dictionary==="string")q.dictionary=e8.string2buf(q.dictionary);else if(Rq.call(q.dictionary)==="[object ArrayBuffer]")q.dictionary=new Uint8Array(q.dictionary);if(q.raw){if(Q=B6.inflateSetDictionary(this.strm,q.dictionary),Q!==E0.Z_OK)throw Error(o4[Q])}}}A1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J=this.options.dictionary,Z,G,W,B,V,U=!1;if(this.ended)return!1;if(G=q===~~q?q:q===!0?E0.Z_FINISH:E0.Z_NO_FLUSH,typeof $==="string")Q.input=e8.binstring2buf($);else if(Rq.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new K8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(Z=B6.inflate(Q,E0.Z_NO_FLUSH),Z===E0.Z_NEED_DICT&&J)Z=B6.inflateSetDictionary(this.strm,J);if(Z===E0.Z_BUF_ERROR&&U===!0)Z=E0.Z_OK,U=!1;if(Z!==E0.Z_STREAM_END&&Z!==E0.Z_OK)return this.onEnd(Z),this.ended=!0,!1;if(Q.next_out){if(Q.avail_out===0||Z===E0.Z_STREAM_END||Q.avail_in===0&&(G===E0.Z_FINISH||G===E0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(W=e8.utf8border(Q.output,Q.next_out),B=Q.next_out-W,V=e8.buf2string(Q.output,W),Q.next_out=B,Q.avail_out=K-B,B)K8.arraySet(Q.output,Q.output,W,B,0);this.onData(V)}else this.onData(K8.shrinkBuf(Q.output,Q.next_out))}if(Q.avail_in===0&&Q.avail_out===0)U=!0}while((Q.avail_in>0||Q.avail_out===0)&&Z!==E0.Z_STREAM_END);if(Z===E0.Z_STREAM_END)G=E0.Z_FINISH;if(G===E0.Z_FINISH)return Z=B6.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===E0.Z_OK;if(G===E0.Z_SYNC_FLUSH)return this.onEnd(E0.Z_OK),Q.avail_out=0,!0;return!0};A1.prototype.onData=function($){this.chunks.push($)};A1.prototype.onEnd=function($){if($===E0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=K8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function a4($,q){var Q=new A1(q);if(Q.push($,!0),Q.err)throw Q.msg||o4[Q.err];return Q.result}function qG($,q){return q=q||{},q.raw=!0,a4($,q)}J8.Inflate=A1;J8.inflate=a4;J8.inflateRaw=qG;J8.ungzip=a4});var gq=N0(($F,jq)=>{var KG=d2().assign,JG=XQ(),VG=Iq(),UG=i4(),Cq={};KG(Cq,JG,VG,UG);jq.exports=Cq});var Xq=N0((Q5)=>{var ZG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",GG=gq(),Aq=T0(),$5=V2(),WG=ZG?"uint8array":"array";Q5.magic="\b\x00";function X1($,q){$5.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=q,this.meta={}}Aq.inherits(X1,$5);X1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(Aq.transformTo(WG,$.data),!1)};X1.prototype.flush=function(){if($5.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};X1.prototype.cleanUp=function(){$5.prototype.cleanUp.call(this),this._pako=null};X1.prototype._createPako=function(){this._pako=new GG[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(q){$.push({data:q,meta:$.meta})}};Q5.compressWorker=function($){return new X1("Deflate",$)};Q5.uncompressWorker=function(){return new X1("Inflate",{})}});var r4=N0((l4)=>{var yq=V2();l4.STORE={magic:"\x00\x00",compressWorker:function(){return new yq("STORE compression")},uncompressWorker:function(){return new yq("STORE decompression")}};l4.DEFLATE=Xq()});var s4=N0((y1)=>{y1.LOCAL_FILE_HEADER="PK\x03\x04";y1.CENTRAL_FILE_HEADER="PK\x01\x02";y1.CENTRAL_DIRECTORY_END="PK\x05\x06";y1.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";y1.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";y1.DATA_DESCRIPTOR="PK\x07\b"});var Pq=N0((JF,Oq)=>{var z6=T0(),F6=V2(),t4=e1(),hq=u8(),q5=s4(),A0=function($,q){var Q="",K;for(K=0;K>>8;return Q},BG=function($,q){var Q=$;if(!$)Q=q?16893:33204;return(Q&65535)<<16},zG=function($){return($||0)&63},xq=function($,q,Q,K,J,Z){var{file:G,compression:W}=$,B=Z!==t4.utf8encode,V=z6.transformTo("string",Z(G.name)),U=z6.transformTo("string",t4.utf8encode(G.name)),w=G.comment,F=z6.transformTo("string",Z(w)),M=z6.transformTo("string",t4.utf8encode(w)),k=U.length!==G.name.length,f=M.length!==w.length,L,D,z="",N="",H="",v=G.dir,j=G.date,n={crc32:0,compressedSize:0,uncompressedSize:0};if(!q||Q)n.crc32=$.crc32,n.compressedSize=$.compressedSize,n.uncompressedSize=$.uncompressedSize;var d=0;if(q)d|=8;if(!B&&(k||f))d|=2048;var _=0,X=0;if(v)_|=16;if(J==="UNIX")X=798,_|=BG(G.unixPermissions,v);else X=20,_|=zG(G.dosPermissions,v);if(L=j.getUTCHours(),L=L<<6,L=L|j.getUTCMinutes(),L=L<<5,L=L|j.getUTCSeconds()/2,D=j.getUTCFullYear()-1980,D=D<<4,D=D|j.getUTCMonth()+1,D=D<<5,D=D|j.getUTCDate(),k)N=A0(1,1)+A0(hq(V),4)+U,z+="up"+A0(N.length,2)+N;if(f)H=A0(1,1)+A0(hq(F),4)+M,z+="uc"+A0(H.length,2)+H;var P="";P+=` +\x00`,P+=A0(d,2),P+=W.magic,P+=A0(L,2),P+=A0(D,2),P+=A0(n.crc32,4),P+=A0(n.compressedSize,4),P+=A0(n.uncompressedSize,4),P+=A0(V.length,2),P+=A0(z.length,2);var g=q5.LOCAL_FILE_HEADER+P+V+z,c=q5.CENTRAL_FILE_HEADER+A0(X,2)+P+A0(F.length,2)+"\x00\x00\x00\x00"+A0(_,4)+A0(K,4)+V+z+F;return{fileRecord:g,dirRecord:c}},FG=function($,q,Q,K,J){var Z="",G=z6.transformTo("string",J(K));return Z=q5.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+A0($,2)+A0($,2)+A0(q,4)+A0(Q,4)+A0(G.length,2)+G,Z},MG=function($){var q="";return q=q5.DATA_DESCRIPTOR+A0($.crc32,4)+A0($.compressedSize,4)+A0($.uncompressedSize,4),q};function v2($,q,Q,K){F6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=q,this.zipPlatform=Q,this.encodeFileName=K,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}z6.inherits(v2,F6);v2.prototype.push=function($){var q=$.meta.percent||0,Q=this.entriesCount,K=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,F6.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:Q?(q+100*(Q-K-1))/Q:100}})};v2.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var q=this.streamFiles&&!$.file.dir;if(q){var Q=xq($,q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:Q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};v2.prototype.closedSource=function($){this.accumulate=!1;var q=this.streamFiles&&!$.file.dir,Q=xq($,q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(Q.dirRecord),q)this.push({data:MG($),meta:{percent:100}});else{this.push({data:Q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};v2.prototype.flush=function(){var $=this.bytesWritten;for(var q=0;q{var wG=r4(),NG=Pq(),YG=function($,q){var Q=$||q,K=wG[Q];if(!K)throw Error(Q+" is not a valid compression method !");return K};Tq.generateWorker=function($,q,Q){var K=new NG(q.streamFiles,Q,q.platform,q.encodeFileName),J=0;try{$.forEach(function(Z,G){J++;var W=YG(G.options.compression,q.compression),B=G.options.compressionOptions||q.compressionOptions||{},V=G.dir,U=G.date;G._compressWorker(W,B).withStreamInfo("file",{name:Z,dir:V,date:U,comment:G.comment||"",unixPermissions:G.unixPermissions,dosPermissions:G.dosPermissions}).pipe(K)}),K.entriesCount=J}catch(Z){K.error(Z)}return K}});var Eq=N0((UF,Sq)=>{var kG=T0(),K5=V2();function V8($,q){K5.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(q)}kG.inherits(V8,K5);V8.prototype._bindStream=function($){var q=this;this._stream=$,$.pause(),$.on("data",function(Q){q.push({data:Q,meta:{percent:0}})}).on("error",function(Q){if(q.isPaused)this.generatedError=Q;else q.error(Q)}).on("end",function(){if(q.isPaused)q._upstreamEnded=!0;else q.end()})};V8.prototype.pause=function(){if(!K5.prototype.pause.call(this))return!1;return this._stream.pause(),!0};V8.prototype.resume=function(){if(!K5.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};Sq.exports=V8});var aq=N0((ZF,oq)=>{var DG=e1(),U8=T0(),nq=V2(),LG=K4(),dq=J4(),_q=S8(),HG=c$(),vG=uq(),cq=T6(),fG=Eq(),mq=function($,q,Q){var K=U8.getTypeOf(q),J,Z=U8.extend(Q||{},dq);if(Z.date=Z.date||new Date,Z.compression!==null)Z.compression=Z.compression.toUpperCase();if(typeof Z.unixPermissions==="string")Z.unixPermissions=parseInt(Z.unixPermissions,8);if(Z.unixPermissions&&Z.unixPermissions&16384)Z.dir=!0;if(Z.dosPermissions&&Z.dosPermissions&16)Z.dir=!0;if(Z.dir)$=pq($);if(Z.createFolders&&(J=RG($)))iq.call(this,J,!0);var G=K==="string"&&Z.binary===!1&&Z.base64===!1;if(!Q||typeof Q.binary>"u")Z.binary=!G;var W=q instanceof _q&&q.uncompressedSize===0;if(W||Z.dir||!q||q.length===0)Z.base64=!1,Z.binary=!0,q="",Z.compression="STORE",K="string";var B=null;if(q instanceof _q||q instanceof nq)B=q;else if(cq.isNode&&cq.isStream(q))B=new fG($,q);else B=U8.prepareContent($,q,Z.binary,Z.optimizedBinaryString,Z.base64);var V=new HG($,B,Z);this.files[$]=V},RG=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var q=$.lastIndexOf("/");return q>0?$.substring(0,q):""},pq=function($){if($.slice(-1)!=="/")$+="/";return $},iq=function($,q){if(q=typeof q<"u"?q:dq.createFolders,$=pq($),!this.files[$])mq.call(this,$,null,{dir:!0,createFolders:q});return this.files[$]};function bq($){return Object.prototype.toString.call($)==="[object RegExp]"}var IG={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var q,Q,K;for(q in this.files)if(K=this.files[q],Q=q.slice(this.root.length,q.length),Q&&q.slice(0,this.root.length)===this.root)$(Q,K)},filter:function($){var q=[];return this.forEach(function(Q,K){if($(Q,K))q.push(K)}),q},file:function($,q,Q){if(arguments.length===1)if(bq($)){var K=$;return this.filter(function(Z,G){return!G.dir&&K.test(Z)})}else{var J=this.files[this.root+$];if(J&&!J.dir)return J;else return null}else $=this.root+$,mq.call(this,$,q,Q);return this},folder:function($){if(!$)return this;if(bq($))return this.filter(function(J,Z){return Z.dir&&$.test(J)});var q=this.root+$,Q=iq.call(this,q),K=this.clone();return K.root=Q.name,K},remove:function($){$=this.root+$;var q=this.files[$];if(!q){if($.slice(-1)!=="/")$+="/";q=this.files[$]}if(q&&!q.dir)delete this.files[$];else{var Q=this.filter(function(J,Z){return Z.name.slice(0,$.length)===$});for(var K=0;K{var CG=T0();function lq($){this.data=$,this.length=$.length,this.index=0,this.zero=0}lq.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length=this.index;Q--)q=(q<<8)+this.byteAt(Q);return this.index+=$,q},readString:function($){return CG.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};rq.exports=lq});var $7=N0((WF,tq)=>{var sq=e4(),jG=T0();function M6($){sq.call(this,$);for(var q=0;q=0;--Z)if(this.data[Z]===q&&this.data[Z+1]===Q&&this.data[Z+2]===K&&this.data[Z+3]===J)return Z-this.zero;return-1};M6.prototype.readAndCheckSignature=function($){var q=$.charCodeAt(0),Q=$.charCodeAt(1),K=$.charCodeAt(2),J=$.charCodeAt(3),Z=this.readData(4);return q===Z[0]&&Q===Z[1]&&K===Z[2]&&J===Z[3]};M6.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};tq.exports=M6});var QK=N0((BF,$K)=>{var eq=e4(),gG=T0();function w6($){eq.call(this,$)}gG.inherits(w6,eq);w6.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};w6.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};w6.prototype.readAndCheckSignature=function($){var q=this.readData(4);return $===q};w6.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};$K.exports=w6});var q7=N0((zF,KK)=>{var qK=$7(),AG=T0();function Q7($){qK.call(this,$)}AG.inherits(Q7,qK);Q7.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};KK.exports=Q7});var UK=N0((FF,VK)=>{var JK=q7(),XG=T0();function K7($){JK.call(this,$)}XG.inherits(K7,JK);K7.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};VK.exports=K7});var J7=N0((MF,GK)=>{var J5=T0(),ZK=n2(),yG=$7(),hG=QK(),xG=UK(),OG=q7();GK.exports=function($){var q=J5.getTypeOf($);if(J5.checkSupport(q),q==="string"&&!ZK.uint8array)return new hG($);if(q==="nodebuffer")return new xG($);if(ZK.uint8array)return new OG(J5.transformTo("uint8array",$));return new yG(J5.transformTo("array",$))}});var FK=N0((wF,zK)=>{var V7=J7(),G1=T0(),PG=S8(),WK=u8(),V5=e1(),U5=r4(),TG=n2(),uG=0,SG=3,EG=function($){for(var q in U5){if(!Object.prototype.hasOwnProperty.call(U5,q))continue;if(U5[q].magic===$)return U5[q]}return null};function BK($,q){this.options=$,this.loadOptions=q}BK.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var q,Q;if($.skip(22),this.fileNameLength=$.readInt(2),Q=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(Q),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(q=EG(this.compressionMethod),q===null)throw Error("Corrupted zip : compression "+G1.pretty(this.compressionMethod)+" unknown (inner file : "+G1.transformTo("string",this.fileName)+")");this.decompressed=new PG(this.compressedSize,this.uncompressedSize,this.crc32,q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===uG)this.dosPermissions=this.externalFileAttributes&63;if($===SG)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=V7(this.extraFields[1].value);if(this.uncompressedSize===G1.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G1.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G1.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G1.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var q=$.index+this.extraFieldsLength,Q,K,J;if(!this.extraFields)this.extraFields={};while($.index+4{var _G=J7(),i2=T0(),f2=s4(),cG=FK(),bG=n2();function MK($){this.files=[],this.loadOptions=$}MK.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+i2.pretty(q)+", expected "+i2.pretty($)+")")}},isSignature:function($,q){var Q=this.reader.index;this.reader.setIndex($);var K=this.reader.readString(4),J=K===q;return this.reader.setIndex(Q),J},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),q=bG.uint8array?"uint8array":"array",Q=i2.transformTo(q,$);this.zipComment=this.loadOptions.decodeFileName(Q)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,q=0,Q,K,J;while(q<$)Q=this.reader.readInt(2),K=this.reader.readInt(4),J=this.reader.readData(K),this.zip64ExtensibleData[Q]={id:Q,length:K,value:J}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,q;for($=0;$0)if(this.isSignature(Q,f2.CENTRAL_FILE_HEADER));else this.reader.zero=J;else if(J<0)throw Error("Corrupted zip: missing "+Math.abs(J)+" bytes.")},prepareReader:function($){this.reader=_G($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};wK.exports=MK});var DK=N0((YF,kK)=>{var U7=T0(),Z5=r1(),nG=e1(),dG=NK(),mG=Z4(),YK=T6();function pG($){return new Z5.Promise(function(q,Q){var K=$.decompressed.getContentWorker().pipe(new mG);K.on("error",function(J){Q(J)}).on("end",function(){if(K.streamInfo.crc32!==$.decompressed.crc32)Q(Error("Corrupted zip : CRC32 mismatch"));else q()}).resume()})}kK.exports=function($,q){var Q=this;if(q=U7.extend(q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:nG.utf8decode}),YK.isNode&&YK.isStream($))return Z5.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return U7.prepareContent("the loaded zip file",$,!0,q.optimizedBinaryString,q.base64).then(function(K){var J=new dG(q);return J.load(K),J}).then(function(J){var Z=[Z5.Promise.resolve(J)],G=J.files;if(q.checkCRC32)for(var W=0;W{function Y2(){if(!(this instanceof Y2))return new Y2;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new Y2;for(var q in this)if(typeof this[q]!=="function")$[q]=this[q];return $}}Y2.prototype=aq();Y2.prototype.loadAsync=DK();Y2.support=n2();Y2.defaults=J4();Y2.version="3.10.1";Y2.loadAsync=function($,q){return new Y2().loadAsync($,q)};Y2.external=r1();LK.exports=Y2});var Z8={};c1(Z8,{types:()=>QW,promisify:()=>jK,log:()=>RK,isUndefined:()=>N6,isSymbol:()=>KW,isString:()=>M5,isRegExp:()=>G5,isPrimitive:()=>JW,isObject:()=>Y6,isNumber:()=>fK,isNullOrUndefined:()=>qW,isNull:()=>F5,isFunction:()=>B5,isError:()=>W5,isDate:()=>B7,isBuffer:()=>VW,isBoolean:()=>F7,isArray:()=>vK,inspect:()=>h1,inherits:()=>IK,format:()=>z7,deprecate:()=>oG,default:()=>GW,debuglog:()=>aG,callbackifyOnRejected:()=>N7,callbackify:()=>gK,_extend:()=>w7,TextEncoder:()=>AK,TextDecoder:()=>XK});function z7($,...q){if(!M5($)){var Q=[$];for(var K=0;K=J)return W;switch(W){case"%s":return String(q[K++]);case"%d":return Number(q[K++]);case"%j":try{return JSON.stringify(q[K++])}catch(B){return"[Circular]"}default:return W}});for(var G=q[K];K"u"||process?.noDeprecation===!0)return $;var Q=!1;function K(...J){if(!Q){if(process.throwDeprecation)throw Error(q);else if(process.traceDeprecation)console.trace(q);else console.error(q);Q=!0}return $.apply(this,...J)}return K}function lG($,q){var Q=h1.styles[q];if(Q)return"\x1B["+h1.colors[Q][0]+"m"+$+"\x1B["+h1.colors[Q][1]+"m";else return $}function rG($,q){return $}function sG($){var q={};return $.forEach(function(Q,K){q[Q]=!0}),q}function z5($,q,Q){if($.customInspect&&q&&B5(q.inspect)&&q.inspect!==h1&&!(q.constructor&&q.constructor.prototype===q)){var K=q.inspect(Q,$);if(!M5(K))K=z5($,K,Q);return K}var J=tG($,q);if(J)return J;var Z=Object.keys(q),G=sG(Z);if($.showHidden)Z=Object.getOwnPropertyNames(q);if(W5(q)&&(Z.indexOf("message")>=0||Z.indexOf("description")>=0))return Z7(q);if(Z.length===0){if(B5(q)){var W=q.name?": "+q.name:"";return $.stylize("[Function"+W+"]","special")}if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");if(B7(q))return $.stylize(Date.prototype.toString.call(q),"date");if(W5(q))return Z7(q)}var B="",V=!1,U=["{","}"];if(vK(q))V=!0,U=["[","]"];if(B5(q)){var w=q.name?": "+q.name:"";B=" [Function"+w+"]"}if(G5(q))B=" "+RegExp.prototype.toString.call(q);if(B7(q))B=" "+Date.prototype.toUTCString.call(q);if(W5(q))B=" "+Z7(q);if(Z.length===0&&(!V||q.length==0))return U[0]+B+U[1];if(Q<0)if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");else return $.stylize("[Object]","special");$.seen.push(q);var F;if(V)F=eG($,q,Q,G,Z);else F=Z.map(function(M){return W7($,q,Q,G,M,V)});return $.seen.pop(),$W(F,B,U)}function tG($,q){if(N6(q))return $.stylize("undefined","undefined");if(M5(q)){var Q="'"+JSON.stringify(q).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(Q,"string")}if(fK(q))return $.stylize(""+q,"number");if(F7(q))return $.stylize(""+q,"boolean");if(F5(q))return $.stylize("null","null")}function Z7($){return"["+Error.prototype.toString.call($)+"]"}function eG($,q,Q,K,J){var Z=[];for(var G=0,W=q.length;G-1)if(Z)W=W.split(` `).map(function(V){return" "+V}).join(` `).slice(2);else W=` @@ -13,23 +13,23 @@ `)>=0)K++;return Z+G.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(J>60)return Q[0]+(q===""?"":q+` `)+" "+$.join(`, `)+" "+Q[1];return Q[0]+q+" "+$.join(", ")+" "+Q[1]}function vK($){return Array.isArray($)}function F7($){return typeof $==="boolean"}function F5($){return $===null}function qW($){return $==null}function fK($){return typeof $==="number"}function M5($){return typeof $==="string"}function KW($){return typeof $==="symbol"}function N6($){return $===void 0}function G5($){return Y6($)&&M7($)==="[object RegExp]"}function Y6($){return typeof $==="object"&&$!==null}function B7($){return Y6($)&&M7($)==="[object Date]"}function W5($){return Y6($)&&(M7($)==="[object Error]"||$ instanceof Error)}function B5($){return typeof $==="function"}function JW($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}function VW($){return $ instanceof Buffer}function M7($){return Object.prototype.toString.call($)}function G7($){return $<10?"0"+$.toString(10):$.toString(10)}function ZW(){var $=new Date,q=[G7($.getHours()),G7($.getMinutes()),G7($.getSeconds())].join(":");return[$.getDate(),UW[$.getMonth()],q].join(" ")}function RK(...$){console.log("%s - %s",ZW(),z7.apply(null,$))}function IK($,q){if(q)$.super_=q,$.prototype=Object.create(q.prototype,{constructor:{value:$,enumerable:!1,writable:!0,configurable:!0}})}function w7($,q){if(!q||!Y6(q))return $;var Q=Object.keys(q),K=Q.length;while(K--)$[Q[K]]=q[Q[K]];return $}function CK($,q){return Object.prototype.hasOwnProperty.call($,q)}function N7($,q){if(!$){var Q=Error("Promise was rejected with a falsy value");Q.reason=$,$=Q}return q($)}function gK($){if(typeof $!=="function")throw TypeError('The "original" argument must be of type Function');function q(...Q){var K=Q.pop();if(typeof K!=="function")throw TypeError("The last argument must be of type Function");var J=this,Z=function(...G){return K.apply(J,...G)};$.apply(this,Q).then(function(G){process.nextTick(Z.bind(null,null,G))},function(G){process.nextTick(N7.bind(null,G,Z))})}return Object.setPrototypeOf(q,Object.getPrototypeOf($)),Object.defineProperties(q,Object.getOwnPropertyDescriptors($)),q}var iG,aG,h1,QW=()=>{},UW,jK,AK,XK,GW;var G8=b1(()=>{iG=/%[sdj%]/g;aG=(($={},q={},Q)=>((Q=typeof process<"u"&&!1)&&(Q=Q.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),q=new RegExp("^"+Q+"$","i"),(K)=>{if(K=K.toUpperCase(),!$[K])if(q.test(K))$[K]=function(...J){console.error("%s: %s",K,pid,z7.apply(null,...J))};else $[K]=function(){};return $[K]}))(),h1=(($)=>($.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},$.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},$.custom=Symbol.for("nodejs.util.inspect.custom"),$))(function($,q,...Q){var K={seen:[],stylize:rG};if(Q.length>=1)K.depth=Q[0];if(Q.length>=2)K.colors=Q[1];if(F7(q))K.showHidden=q;else if(q)w7(K,q);if(N6(K.showHidden))K.showHidden=!1;if(N6(K.depth))K.depth=2;if(N6(K.colors))K.colors=!1;if(K.colors)K.stylize=lG;return z5(K,$,K.depth)});UW=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];jK=(($)=>($.custom=Symbol.for("nodejs.util.promisify.custom"),$))(function($){if(typeof $!=="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&$[kCustomPromisifiedSymbol]){var q=$[kCustomPromisifiedSymbol];if(typeof q!=="function")throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(q,kCustomPromisifiedSymbol,{value:q,enumerable:!1,writable:!1,configurable:!0}),q}function q(...Q){var K,J,Z=new Promise(function(G,W){K=G,J=W});Q.push(function(G,W){if(G)J(G);else K(W)});try{$.apply(this,Q)}catch(G){J(G)}return Z}if(Object.setPrototypeOf(q,Object.getPrototypeOf($)),kCustomPromisifiedSymbol)Object.defineProperty(q,kCustomPromisifiedSymbol,{value:q,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(q,Object.getOwnPropertyDescriptors($))});({TextEncoder:AK,TextDecoder:XK}=globalThis),GW={TextEncoder:AK,TextDecoder:XK,promisify:jK,log:RK,inherits:IK,_extend:w7,callbackifyOnRejected:N7,callbackify:gK}});var v7={};c1(v7,{resolveObject:()=>SK,resolve:()=>uK,parse:()=>D6,format:()=>TK,default:()=>DW,Url:()=>Z2,URLSearchParams:()=>OK,URL:()=>L7});function H7($){return typeof $==="string"}function PK($){return typeof $==="object"&&$!==null}function w5($){return $===null}function WW($){return $==null}function Z2(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function D6($,q,Q){if($&&PK($)&&$ instanceof Z2)return $;var K=new Z2;return K.parse($,q,Q),K}function TK($){if(H7($))$=D6($);if(!($ instanceof Z2))return Z2.prototype.format.call($);return $.format()}function uK($,q){return D6($,!1,!0).resolve(q)}function SK($,q){if(!$)return q;return D6($,!1,!0).resolveObject(q)}var L7,OK,BW,zW,FW,MW,wW,Y7,yK,hK,NW=255,xK,YW,kW,k7,k6,D7,DW;var f7=b1(()=>{({URL:L7,URLSearchParams:OK}=globalThis);BW=/^([a-z0-9.+-]+:)/i,zW=/:[0-9]*$/,FW=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,MW=["<",">",'"',"`"," ","\r",` -`,"\t"],wW=["{","}","|","\\","^","`"].concat(MW),Y7=["'"].concat(wW),yK=["%","/","?",";","#"].concat(Y7),hK=["/","?","#"],xK=/^[+a-z0-9A-Z_-]{0,63}$/,YW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kW={javascript:!0,"javascript:":!0},k7={javascript:!0,"javascript:":!0},k6={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},D7={parse($){var q=decodeURIComponent;return($+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(Q,K,J){var Z=K.split("="),G=q(Z[0]||""),W=q(Z[1]||""),B=Q[G];return Q[G]=B===void 0?W:[].concat(B,W),Q},{})},stringify($){var q=encodeURIComponent;return Object.keys($||{}).reduce(function(Q,K){return[].concat($[K]).forEach(function(J){Q.push(q(K)+"="+q(J))}),Q},[]).join("&").replace(/\s/g,"+")}};Z2.prototype.parse=function($,q,Q){if(!H7($))throw TypeError("Parameter 'url' must be a string, not "+typeof $);var K=$.indexOf("?"),J=K!==-1&&K<$.indexOf("#")?"?":"#",Z=$.split(J),G=/\\/g;Z[0]=Z[0].replace(G,"/"),$=Z.join(J);var W=$;if(W=W.trim(),!Q&&$.split("#").length===1){var B=FW.exec(W);if(B){if(this.path=W,this.href=W,this.pathname=B[1],B[2])if(this.search=B[2],q)this.query=D7.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(q)this.search="",this.query={};return this}}var V=BW.exec(W);if(V){V=V[0];var U=V.toLowerCase();this.protocol=U,W=W.substr(V.length)}if(Q||V||W.match(/^\/\/[^@\/]+@[^@\/]+/)){var w=W.substr(0,2)==="//";if(w&&!(V&&k7[V]))W=W.substr(2),this.slashes=!0}if(!k7[V]&&(w||V&&!k6[V])){var F=-1;for(var M=0;M127)v+="x";else v+=H[j];if(!v.match(xK)){var d=z.slice(0,M),_=z.slice(M+1),X=H.match(YW);if(X)d.push(X[1]),_.unshift(X[2]);if(_.length)W="/"+_.join(".")+W;this.hostname=d.join(".");break}}}}if(this.hostname.length>NW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!D)this.hostname=new L7(`https://${this.hostname}`).hostname;var P=this.port?":"+this.port:"",g=this.hostname||"";if(this.host=g+P,this.href+=this.host,D){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),W[0]!=="/")W="/"+W}}if(!kW[U])for(var M=0,N=Y7.length;M0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(Q.search=$.search,Q.query=$.query,!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.href=Q.format(),Q}if(!z.length){if(Q.pathname=null,Q.search)Q.path="/"+Q.search;else Q.path=null;return Q.href=Q.format(),Q}var j=z.slice(-1)[0],n=(Q.host||$.host||z.length>1)&&(j==="."||j==="..")||j==="",d=0;for(var _=z.length;_>=0;_--)if(j=z[_],j===".")z.splice(_,1);else if(j==="..")z.splice(_,1),d++;else if(d)z.splice(_,1),d--;if(!L&&!D)for(;d--;d)z.unshift("..");if(L&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/"))z.unshift("");if(n&&z.join("/").substr(-1)!=="/")z.push("");var X=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){Q.hostname=Q.host=X?"":z.length?z.shift():"";var v=Q.host&&Q.host.indexOf("@")>0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(L=L||Q.host&&z.length,L&&!X)z.unshift("");if(!z.length)Q.pathname=null,Q.path=null;else Q.pathname=z.join("/");if(!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.auth=$.auth||Q.auth,Q.slashes=Q.slashes||$.slashes,Q.href=Q.format(),Q};Z2.prototype.parseHost=function(){var $=this.host,q=zW.exec($);if(q){if(q=q[0],q!==":")this.port=q.substr(1);$=$.substr(0,$.length-q.length)}if($)this.hostname=$};DW={parse:D6,resolve:uK,resolveObject:SK,format:TK,Url:Z2,URL:L7,URLSearchParams:OK}});var I7={};c1(I7,{request:()=>uW,globalAgent:()=>bW,get:()=>SW,default:()=>mW,STATUS_CODES:()=>nW,METHODS:()=>dW,IncomingMessage:()=>_W,ClientRequest:()=>EW,Agent:()=>cW});var LW,HW,EK,vW,fW,RW=($,q,Q)=>{Q=$!=null?LW(HW($)):{};let K=q||!$||!$.__esModule?EK(Q,"default",{value:$,enumerable:!0}):Q;for(let J of vW($))if(!fW.call(K,J))EK(K,J,{get:()=>$[J],enumerable:!0});return K},h0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),cK,IW,x1,CW,bK,O1,nK,jW,dK,L6,gW,_K,R7,AW,XW,mK,pK,yW,hW,iK,oK,xW,OW,PW,TW,aK,uW,SW,EW,_W,cW,bW,nW,dW,mW;var C7=b1(()=>{LW=Object.create,{getPrototypeOf:HW,defineProperty:EK,getOwnPropertyNames:vW}=Object,fW=Object.prototype.hasOwnProperty,cK=h0(($)=>{$.fetch=J(globalThis.fetch)&&J(globalThis.ReadableStream),$.writableStream=J(globalThis.WritableStream),$.abortController=J(globalThis.AbortController);var q;function Q(){if(q!==void 0)return q;if(globalThis.XMLHttpRequest){q=new globalThis.XMLHttpRequest;try{q.open("GET",globalThis.XDomainRequest?"/":"https://example.com")}catch(Z){q=null}}else q=null;return q}function K(Z){var G=Q();if(!G)return!1;try{return G.responseType=Z,G.responseType===Z}catch(W){}return!1}$.arraybuffer=$.fetch||K("arraybuffer"),$.msstream=!$.fetch&&K("ms-stream"),$.mozchunkedarraybuffer=!$.fetch&&K("moz-chunked-arraybuffer"),$.overrideMimeType=$.fetch||(Q()?J(Q().overrideMimeType):!1);function J(Z){return typeof Z==="function"}q=null}),IW=h0(($,q)=>{if(typeof Object.create==="function")q.exports=function(Q,K){if(K)Q.super_=K,Q.prototype=Object.create(K.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else q.exports=function(Q,K){if(K){Q.super_=K;var J=function(){};J.prototype=K.prototype,Q.prototype=new J,Q.prototype.constructor=Q}}}),x1=h0(($,q)=>{try{if(Q=(G8(),X0(Z8)),typeof Q.inherits!=="function")throw"";q.exports=Q.inherits}catch(K){q.exports=IW()}var Q}),CW=h0(($,q)=>{function Q(L,D){var z=Object.keys(L);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(L);D&&(N=N.filter(function(H){return Object.getOwnPropertyDescriptor(L,H).enumerable})),z.push.apply(z,N)}return z}function K(L){for(var D=1;D0)this.tail.next=z;else this.head=z;this.tail=z,++this.length}},{key:"unshift",value:function(D){var z={data:D,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var D=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,D}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(D){if(this.length===0)return"";var z=this.head,N=""+z.data;while(z=z.next)N+=D+z.data;return N}},{key:"concat",value:function(D){if(this.length===0)return w.alloc(0);var z=w.allocUnsafe(D>>>0),N=this.head,H=0;while(N)f(N.data,z,H),H+=N.data.length,N=N.next;return z}},{key:"consume",value:function(D,z){var N;if(Dv.length?v.length:D;if(j===v.length)H+=v;else H+=v.slice(0,D);if(D-=j,D===0){if(j===v.length)if(++N,z.next)this.head=z.next;else this.head=this.tail=null;else this.head=z,z.data=v.slice(j);break}++N}return this.length-=N,H}},{key:"_getBuffer",value:function(D){var z=w.allocUnsafe(D),N=this.head,H=1;N.data.copy(z),D-=N.data.length;while(N=N.next){var v=N.data,j=D>v.length?v.length:D;if(v.copy(z,z.length-D,0,j),D-=j,D===0){if(j===v.length)if(++H,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=v.slice(j);break}++H}return this.length-=H,z}},{key:k,value:function(D,z){return M(this,K(K({},z),{},{depth:0,customInspect:!1}))}}]),L}()}),bK=h0(($,q)=>{function Q(B,V){var U=this,w=this._readableState&&this._readableState.destroyed,F=this._writableState&&this._writableState.destroyed;if(w||F){if(V)V(B);else if(B){if(!this._writableState)process.nextTick(G,this,B);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,process.nextTick(G,this,B)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(B||null,function(M){if(!V&&M)if(!U._writableState)process.nextTick(K,U,M);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,process.nextTick(K,U,M);else process.nextTick(J,U);else if(V)process.nextTick(J,U),V(M);else process.nextTick(J,U)}),this}function K(B,V){G(B,V),J(B)}function J(B){if(B._writableState&&!B._writableState.emitClose)return;if(B._readableState&&!B._readableState.emitClose)return;B.emit("close")}function Z(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function G(B,V){B.emit("error",V)}function W(B,V){var{_readableState:U,_writableState:w}=B;if(U&&U.autoDestroy||w&&w.autoDestroy)B.destroy(V);else B.emit("error",V)}q.exports={destroy:Q,undestroy:Z,errorOrDestroy:W}}),O1=h0(($,q)=>{var Q={};function K(B,V,U){if(!U)U=Error;function w(M,k,f){if(typeof V==="string")return V;else return V(M,k,f)}class F extends U{constructor(M,k,f){super(w(M,k,f))}}F.prototype.name=U.name,F.prototype.code=B,Q[B]=F}function J(B,V){if(Array.isArray(B)){let U=B.length;if(B=B.map((w)=>String(w)),U>2)return`one of ${V} ${B.slice(0,U-1).join(", ")}, or `+B[U-1];else if(U===2)return`one of ${V} ${B[0]} or ${B[1]}`;else return`of ${V} ${B[0]}`}else return`of ${V} ${String(B)}`}function Z(B,V,U){return B.substr(!U||U<0?0:+U,V.length)===V}function G(B,V,U){if(U===void 0||U>B.length)U=B.length;return B.substring(U-V.length,U)===V}function W(B,V,U){if(typeof U!=="number")U=0;if(U+V.length>B.length)return!1;else return B.indexOf(V,U)!==-1}K("ERR_INVALID_OPT_VALUE",function(B,V){return'The value "'+V+'" is invalid for option "'+B+'"'},TypeError),K("ERR_INVALID_ARG_TYPE",function(B,V,U){let w;if(typeof V==="string"&&Z(V,"not "))w="must not be",V=V.replace(/^not /,"");else w="must be";let F;if(G(B," argument"))F=`The ${B} ${w} ${J(V,"type")}`;else{let M=W(B,".")?"property":"argument";F=`The "${B}" ${M} ${w} ${J(V,"type")}`}return F+=`. Received type ${typeof U}`,F},TypeError),K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),K("ERR_METHOD_NOT_IMPLEMENTED",function(B){return"The "+B+" method is not implemented"}),K("ERR_STREAM_PREMATURE_CLOSE","Premature close"),K("ERR_STREAM_DESTROYED",function(B){return"Cannot call "+B+" after a stream was destroyed"}),K("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),K("ERR_STREAM_WRITE_AFTER_END","write after end"),K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),K("ERR_UNKNOWN_ENCODING",function(B){return"Unknown encoding: "+B},TypeError),K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$.codes=Q}),nK=h0(($,q)=>{var Q=O1().codes.ERR_INVALID_OPT_VALUE;function K(Z,G,W){return Z.highWaterMark!=null?Z.highWaterMark:G?Z[W]:null}function J(Z,G,W,B){var V=K(G,B,W);if(V!=null){if(!(isFinite(V)&&Math.floor(V)===V)||V<0){var U=B?W:"highWaterMark";throw new Q(U,V)}return Math.floor(V)}return Z.objectMode?16:16384}q.exports={getHighWaterMark:J}}),jW=h0(($,q)=>{q.exports=(G8(),X0(Z8)).deprecate}),dK=h0(($,q)=>{q.exports=X;function Q(S){var b=this;this.next=null,this.entry=null,this.finish=function(){w0(b,S)}}var K;X.WritableState=d;var J={deprecate:jW()},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(S){return G.from(S)}function V(S){return G.isBuffer(S)||S instanceof W}var U=bK(),w=nK(),F=w.getHighWaterMark,M=O1().codes,k=M.ERR_INVALID_ARG_TYPE,f=M.ERR_METHOD_NOT_IMPLEMENTED,L=M.ERR_MULTIPLE_CALLBACK,D=M.ERR_STREAM_CANNOT_PIPE,z=M.ERR_STREAM_DESTROYED,N=M.ERR_STREAM_NULL_VALUES,H=M.ERR_STREAM_WRITE_AFTER_END,v=M.ERR_UNKNOWN_ENCODING,j=U.errorOrDestroy;x1()(X,Z);function n(){}function d(S,b,O){if(K=K||L6(),S=S||{},typeof O!=="boolean")O=b instanceof K;if(this.objectMode=!!S.objectMode,O)this.objectMode=this.objectMode||!!S.writableObjectMode;this.highWaterMark=F(this,S,"writableHighWaterMark",O),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var E=S.decodeStrings===!1;this.decodeStrings=!E,this.defaultEncoding=S.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){Z0(b,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=S.emitClose!==!1,this.autoDestroy=!!S.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Q(this)}d.prototype.getBuffer=function(){var S=this.bufferedRequest,b=[];while(S)b.push(S),S=S.next;return b},function(){try{Object.defineProperty(d.prototype,"buffer",{get:J.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(S){}}();var _;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")_=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(S){if(_.call(this,S))return!0;if(this!==X)return!1;return S&&S._writableState instanceof d}});else _=function(S){return S instanceof this};function X(S){K=K||L6();var b=this instanceof K;if(!b&&!_.call(X,this))return new X(S);if(this._writableState=new d(S,this,b),this.writable=!0,S){if(typeof S.write==="function")this._write=S.write;if(typeof S.writev==="function")this._writev=S.writev;if(typeof S.destroy==="function")this._destroy=S.destroy;if(typeof S.final==="function")this._final=S.final}Z.call(this)}X.prototype.pipe=function(){j(this,new D)};function P(S,b){var O=new H;j(S,O),process.nextTick(b,O)}function g(S,b,O,E){var a;if(O===null)a=new N;else if(typeof O!=="string"&&!b.objectMode)a=new k("chunk",["string","Buffer"],O);if(a)return j(S,a),process.nextTick(E,a),!1;return!0}X.prototype.write=function(S,b,O){var E=this._writableState,a=!1,K0=!E.objectMode&&V(S);if(K0&&!G.isBuffer(S))S=B(S);if(typeof b==="function")O=b,b=null;if(K0)b="buffer";else if(!b)b=E.defaultEncoding;if(typeof O!=="function")O=n;if(E.ending)P(this,O);else if(K0||g(this,E,S,O))E.pendingcb++,a=h(this,E,K0,S,b,O);return a},X.prototype.cork=function(){this._writableState.corked++},X.prototype.uncork=function(){var S=this._writableState;if(S.corked){if(S.corked--,!S.writing&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest)W0(this,S)}},X.prototype.setDefaultEncoding=function(S){if(typeof S==="string")S=S.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((S+"").toLowerCase())>-1))throw new v(S);return this._writableState.defaultEncoding=S,this},Object.defineProperty(X.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function c(S,b,O){if(!S.objectMode&&S.decodeStrings!==!1&&typeof b==="string")b=G.from(b,O);return b}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function h(S,b,O,E,a,K0){if(!O){var R=c(b,E,a);if(E!==R)O=!0,a="buffer",E=R}var Y=b.objectMode?1:E.length;b.length+=Y;var C=b.length{var Q=Object.keys||function(w){var F=[];for(var M in w)F.push(M);return F};q.exports=B;var K=mK(),J=dK();x1()(B,K);{Z=Q(J.prototype);for(W=0;W{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),_K=h0(($)=>{var q=gW().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),R7=h0(($,q)=>{var Q=O1().codes.ERR_STREAM_PREMATURE_CLOSE;function K(W){var B=!1;return function(){if(B)return;B=!0;for(var V=arguments.length,U=Array(V),w=0;w{var Q;function K(v,j,n){if(j=J(j),j in v)Object.defineProperty(v,j,{value:n,enumerable:!0,configurable:!0,writable:!0});else v[j]=n;return v}function J(v){var j=Z(v,"string");return typeof j==="symbol"?j:String(j)}function Z(v,j){if(typeof v!=="object"||v===null)return v;var n=v[Symbol.toPrimitive];if(n!==void 0){var d=n.call(v,j||"default");if(typeof d!=="object")return d;throw TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(v)}var G=R7(),W=Symbol("lastResolve"),B=Symbol("lastReject"),V=Symbol("error"),U=Symbol("ended"),w=Symbol("lastPromise"),F=Symbol("handlePromise"),M=Symbol("stream");function k(v,j){return{value:v,done:j}}function f(v){var j=v[W];if(j!==null){var n=v[M].read();if(n!==null)v[w]=null,v[W]=null,v[B]=null,j(k(n,!1))}}function L(v){process.nextTick(f,v)}function D(v,j){return function(n,d){v.then(function(){if(j[U]){n(k(void 0,!0));return}j[F](n,d)},d)}}var z=Object.getPrototypeOf(function(){}),N=Object.setPrototypeOf((Q={get stream(){return this[M]},next:function(){var v=this,j=this[V];if(j!==null)return Promise.reject(j);if(this[U])return Promise.resolve(k(void 0,!0));if(this[M].destroyed)return new Promise(function(X,P){process.nextTick(function(){if(v[V])P(v[V]);else X(k(void 0,!0))})});var n=this[w],d;if(n)d=new Promise(D(n,this));else{var _=this[M].read();if(_!==null)return Promise.resolve(k(_,!1));d=new Promise(this[F])}return this[w]=d,d}},K(Q,Symbol.asyncIterator,function(){return this}),K(Q,"return",function(){var v=this;return new Promise(function(j,n){v[M].destroy(null,function(d){if(d){n(d);return}j(k(void 0,!0))})})}),Q),z),H=function(v){var j,n=Object.create(N,(j={},K(j,M,{value:v,writable:!0}),K(j,W,{value:null,writable:!0}),K(j,B,{value:null,writable:!0}),K(j,V,{value:null,writable:!0}),K(j,U,{value:v._readableState.endEmitted,writable:!0}),K(j,F,{value:function(d,_){var X=n[M].read();if(X)n[w]=null,n[W]=null,n[B]=null,d(k(X,!1));else n[W]=d,n[B]=_},writable:!0}),j));return n[w]=null,G(v,function(d){if(d&&d.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=n[B];if(_!==null)n[w]=null,n[W]=null,n[B]=null,_(d);n[V]=d;return}var X=n[W];if(X!==null)n[w]=null,n[W]=null,n[B]=null,X(k(void 0,!0));n[U]=!0}),v.on("readable",L.bind(null,n)),n};q.exports=H}),XW=h0(($,q)=>{function Q(w,F,M,k,f,L,D){try{var z=w[L](D),N=z.value}catch(H){M(H);return}if(z.done)F(N);else Promise.resolve(N).then(k,f)}function K(w){return function(){var F=this,M=arguments;return new Promise(function(k,f){var L=w.apply(F,M);function D(N){Q(L,k,f,D,z,"next",N)}function z(N){Q(L,k,f,D,z,"throw",N)}D(void 0)})}}function J(w,F){var M=Object.keys(w);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(w);F&&(k=k.filter(function(f){return Object.getOwnPropertyDescriptor(w,f).enumerable})),M.push.apply(M,k)}return M}function Z(w){for(var F=1;F{q.exports=g;var Q;g.ReadableState=P;var K=(i1(),X0(p1)).EventEmitter,J=function(R,Y){return R.listeners(Y).length},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(R){return G.from(R)}function V(R){return G.isBuffer(R)||R instanceof W}var U=(G8(),X0(Z8)),w;if(U&&U.debuglog)w=U.debuglog("stream");else w=function(){};var F=CW(),M=bK(),k=nK(),f=k.getHighWaterMark,L=O1().codes,D=L.ERR_INVALID_ARG_TYPE,z=L.ERR_STREAM_PUSH_AFTER_EOF,N=L.ERR_METHOD_NOT_IMPLEMENTED,H=L.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,j,n;x1()(g,Z);var d=M.errorOrDestroy,_=["error","close","destroy","pause","resume"];function X(R,Y,C){if(typeof R.prependListener==="function")return R.prependListener(Y,C);if(!R._events||!R._events[Y])R.on(Y,C);else if(Array.isArray(R._events[Y]))R._events[Y].unshift(C);else R._events[Y]=[C,R._events[Y]]}function P(R,Y,C){if(Q=Q||L6(),R=R||{},typeof C!=="boolean")C=Y instanceof Q;if(this.objectMode=!!R.objectMode,C)this.objectMode=this.objectMode||!!R.readableObjectMode;if(this.highWaterMark=f(this,R,"readableHighWaterMark",C),this.buffer=new F,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.destroyed=!1,this.defaultEncoding=R.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,R.encoding){if(!v)v=_K().StringDecoder;this.decoder=new v(R.encoding),this.encoding=R.encoding}}function g(R){if(Q=Q||L6(),!(this instanceof g))return new g(R);var Y=this instanceof Q;if(this._readableState=new P(R,this,Y),this.readable=!0,R){if(typeof R.read==="function")this._read=R.read;if(typeof R.destroy==="function")this._destroy=R.destroy}Z.call(this)}Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(R){if(!this._readableState)return;this._readableState.destroyed=R}}),g.prototype.destroy=M.destroy,g.prototype._undestroy=M.undestroy,g.prototype._destroy=function(R,Y){Y(R)},g.prototype.push=function(R,Y){var C=this._readableState,u;if(!C.objectMode){if(typeof R==="string"){if(Y=Y||C.defaultEncoding,Y!==C.encoding)R=G.from(R,Y),Y="";u=!0}}else u=!0;return c(this,R,Y,!1,u)},g.prototype.unshift=function(R){return c(this,R,null,!0,!1)};function c(R,Y,C,u,e){w("readableAddChunk",Y);var r=R._readableState;if(Y===null)r.reading=!1,F0(R,r);else{var s;if(!e)s=x(r,Y);if(s)d(R,s);else if(r.objectMode||Y&&Y.length>0){if(typeof Y!=="string"&&!r.objectMode&&Object.getPrototypeOf(Y)!==G.prototype)Y=B(Y);if(u)if(r.endEmitted)d(R,new H);else h(R,r,Y,!0);else if(r.ended)d(R,new z);else if(r.destroyed)return!1;else if(r.reading=!1,r.decoder&&!C)if(Y=r.decoder.write(Y),r.objectMode||Y.length!==0)h(R,r,Y,!1);else y(R,r);else h(R,r,Y,!1)}else if(!u)r.reading=!1,y(R,r)}return!r.ended&&(r.length=l)R=l;else R--,R|=R>>>1,R|=R>>>2,R|=R>>>4,R|=R>>>8,R|=R>>>16,R++;return R}function Z0(R,Y){if(R<=0||Y.length===0&&Y.ended)return 0;if(Y.objectMode)return 1;if(R!==R)if(Y.flowing&&Y.length)return Y.buffer.head.data.length;else return Y.length;if(R>Y.highWaterMark)Y.highWaterMark=$0(R);if(R<=Y.length)return R;if(!Y.ended)return Y.needReadable=!0,0;return Y.length}g.prototype.read=function(R){w("read",R),R=parseInt(R,10);var Y=this._readableState,C=R;if(R!==0)Y.emittedReadable=!1;if(R===0&&Y.needReadable&&((Y.highWaterMark!==0?Y.length>=Y.highWaterMark:Y.length>0)||Y.ended)){if(w("read: emitReadable",Y.length,Y.ended),Y.length===0&&Y.ended)E(this);else p(this);return null}if(R=Z0(R,Y),R===0&&Y.ended){if(Y.length===0)E(this);return null}var u=Y.needReadable;if(w("need readable",u),Y.length===0||Y.length-R0)e=O(R,Y);else e=null;if(e===null)Y.needReadable=Y.length<=Y.highWaterMark,R=0;else Y.length-=R,Y.awaitDrain=0;if(Y.length===0){if(!Y.ended)Y.needReadable=!0;if(C!==R&&Y.ended)E(this)}if(e!==null)this.emit("data",e);return e};function F0(R,Y){if(w("onEofChunk"),Y.ended)return;if(Y.decoder){var C=Y.decoder.end();if(C&&C.length)Y.buffer.push(C),Y.length+=Y.objectMode?1:C.length}if(Y.ended=!0,Y.sync)p(R);else if(Y.needReadable=!1,!Y.emittedReadable)Y.emittedReadable=!0,W0(R)}function p(R){var Y=R._readableState;if(w("emitReadable",Y.needReadable,Y.emittedReadable),Y.needReadable=!1,!Y.emittedReadable)w("emitReadable",Y.flowing),Y.emittedReadable=!0,process.nextTick(W0,R)}function W0(R){var Y=R._readableState;if(w("emitReadable_",Y.destroyed,Y.length,Y.ended),!Y.destroyed&&(Y.length||Y.ended))R.emit("readable"),Y.emittedReadable=!1;Y.needReadable=!Y.flowing&&!Y.ended&&Y.length<=Y.highWaterMark,b(R)}function y(R,Y){if(!Y.readingMore)Y.readingMore=!0,process.nextTick(i,R,Y)}function i(R,Y){while(!Y.reading&&!Y.ended&&(Y.length1&&K0(u.pipes,R)!==-1)&&!G0)w("false write response, pause",u.awaitDrain),u.awaitDrain++;C.pause()}}function I0(O0){if(w("onerror",O0),q2(),R.removeListener("error",I0),J(R,"error")===0)d(R,O0)}X(R,"error",I0);function m0(){R.removeListener("finish",p0),q2()}R.once("close",m0);function p0(){w("onfinish"),R.removeListener("close",m0),q2()}R.once("finish",p0);function q2(){w("unpipe"),C.unpipe(R)}if(R.emit("pipe",C),!u.flowing)w("pipe resume"),C.resume();return R};function U0(R){return function(){var Y=R._readableState;if(w("pipeOnDrain",Y.awaitDrain),Y.awaitDrain)Y.awaitDrain--;if(Y.awaitDrain===0&&J(R,"data"))Y.flowing=!0,b(R)}}g.prototype.unpipe=function(R){var Y=this._readableState,C={hasUnpiped:!1};if(Y.pipesCount===0)return this;if(Y.pipesCount===1){if(R&&R!==Y.pipes)return this;if(!R)R=Y.pipes;if(Y.pipes=null,Y.pipesCount=0,Y.flowing=!1,R)R.emit("unpipe",this,C);return this}if(!R){var{pipes:u,pipesCount:e}=Y;Y.pipes=null,Y.pipesCount=0,Y.flowing=!1;for(var r=0;r0,u.flowing!==!1)this.resume()}else if(R==="readable"){if(!u.endEmitted&&!u.readableListening){if(u.readableListening=u.needReadable=!0,u.flowing=!1,u.emittedReadable=!1,w("on readable",u.length,u.reading),u.length)p(this);else if(!u.reading)process.nextTick(V0,this)}}return C},g.prototype.addListener=g.prototype.on,g.prototype.removeListener=function(R,Y){var C=Z.prototype.removeListener.call(this,R,Y);if(R==="readable")process.nextTick(m,this);return C},g.prototype.removeAllListeners=function(R){var Y=Z.prototype.removeAllListeners.apply(this,arguments);if(R==="readable"||R===void 0)process.nextTick(m,this);return Y};function m(R){var Y=R._readableState;if(Y.readableListening=R.listenerCount("readable")>0,Y.resumeScheduled&&!Y.paused)Y.flowing=!0;else if(R.listenerCount("data")>0)R.resume()}function V0(R){w("readable nexttick read 0"),R.read(0)}g.prototype.resume=function(){var R=this._readableState;if(!R.flowing)w("resume"),R.flowing=!R.readableListening,w0(this,R);return R.paused=!1,this};function w0(R,Y){if(!Y.resumeScheduled)Y.resumeScheduled=!0,process.nextTick(S,R,Y)}function S(R,Y){if(w("resume",Y.reading),!Y.reading)R.read(0);if(Y.resumeScheduled=!1,R.emit("resume"),b(R),Y.flowing&&!Y.reading)R.read(0)}g.prototype.pause=function(){if(w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)w("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function b(R){var Y=R._readableState;w("flow",Y.flowing);while(Y.flowing&&R.read()!==null);}if(g.prototype.wrap=function(R){var Y=this,C=this._readableState,u=!1;R.on("end",function(){if(w("wrapped end"),C.decoder&&!C.ended){var s=C.decoder.end();if(s&&s.length)Y.push(s)}Y.push(null)}),R.on("data",function(s){if(w("wrapped data"),C.decoder)s=C.decoder.write(s);if(C.objectMode&&(s===null||s===void 0))return;else if(!C.objectMode&&(!s||!s.length))return;var T=Y.push(s);if(!T)u=!0,R.pause()});for(var e in R)if(this[e]===void 0&&typeof R[e]==="function")this[e]=function(s){return function(){return R[s].apply(R,arguments)}}(e);for(var r=0;r<_.length;r++)R.on(_[r],this.emit.bind(this,_[r]));return this._read=function(s){if(w("wrapped _read",s),u)u=!1,R.resume()},this},typeof Symbol==="function")g.prototype[Symbol.asyncIterator]=function(){if(j===void 0)j=AW();return j(this)};Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(g.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(g.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){if(this._readableState)this._readableState.flowing=R}}),g._fromList=O,Object.defineProperty(g.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function O(R,Y){if(Y.length===0)return null;var C;if(Y.objectMode)C=Y.buffer.shift();else if(!R||R>=Y.length){if(Y.decoder)C=Y.buffer.join("");else if(Y.buffer.length===1)C=Y.buffer.first();else C=Y.buffer.concat(Y.length);Y.buffer.clear()}else C=Y.buffer.consume(R,Y.decoder);return C}function E(R){var Y=R._readableState;if(w("endReadable",Y.endEmitted),!Y.endEmitted)Y.ended=!0,process.nextTick(a,Y,R)}function a(R,Y){if(w("endReadableNT",R.endEmitted,R.length),!R.endEmitted&&R.length===0){if(R.endEmitted=!0,Y.readable=!1,Y.emit("end"),R.autoDestroy){var C=Y._writableState;if(!C||C.autoDestroy&&C.finished)Y.destroy()}}}if(typeof Symbol==="function")g.from=function(R,Y){if(n===void 0)n=XW();return n(g,R,Y)};function K0(R,Y){for(var C=0,u=R.length;C{q.exports=V;var Q=O1().codes,K=Q.ERR_METHOD_NOT_IMPLEMENTED,J=Q.ERR_MULTIPLE_CALLBACK,Z=Q.ERR_TRANSFORM_ALREADY_TRANSFORMING,G=Q.ERR_TRANSFORM_WITH_LENGTH_0,W=L6();x1()(V,W);function B(F,M){var k=this._transformState;k.transforming=!1;var f=k.writecb;if(f===null)return this.emit("error",new J);if(k.writechunk=null,k.writecb=null,M!=null)this.push(M);f(F);var L=this._readableState;if(L.reading=!1,L.needReadable||L.length{q.exports=K;var Q=pK();x1()(K,Q);function K(J){if(!(this instanceof K))return new K(J);Q.call(this,J)}K.prototype._transform=function(J,Z,G){G(null,J)}}),hW=h0(($,q)=>{var Q;function K(k){var f=!1;return function(){if(f)return;f=!0,k.apply(void 0,arguments)}}var J=O1().codes,Z=J.ERR_MISSING_ARGS,G=J.ERR_STREAM_DESTROYED;function W(k){if(k)throw k}function B(k){return k.setHeader&&typeof k.abort==="function"}function V(k,f,L,D){D=K(D);var z=!1;if(k.on("close",function(){z=!0}),Q===void 0)Q=R7();Q(k,{readable:f,writable:L},function(H){if(H)return D(H);z=!0,D()});var N=!1;return function(H){if(z)return;if(N)return;if(N=!0,B(k))return k.abort();if(typeof k.destroy==="function")return k.destroy();D(H||new G("pipe"))}}function U(k){k()}function w(k,f){return k.pipe(f)}function F(k){if(!k.length)return W;if(typeof k[k.length-1]!=="function")return W;return k.pop()}function M(){for(var k=arguments.length,f=Array(k),L=0;L0;return V(H,j,n,function(d){if(!z)z=d;if(d)N.forEach(U);if(j)return;N.forEach(U),D(z)})});return f.reduce(w)}q.exports=M}),iK=h0(($,q)=>{var Q=a1();$=q.exports=mK(),$.Stream=Q||$,$.Readable=$,$.Writable=dK(),$.Duplex=L6(),$.Transform=pK(),$.PassThrough=yW(),$.finished=R7(),$.pipeline=hW()}),oK=h0(($)=>{var q=cK(),Q=x1(),K=iK(),J=$.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Z=$.IncomingMessage=function(G,W,B,V){var U=this;if(K.Readable.call(U),U._mode=B,U.headers={},U.rawHeaders=[],U.trailers={},U.rawTrailers=[],U.on("end",function(){process.nextTick(function(){U.emit("close")})}),B==="fetch"){let D=function(){M.read().then(function(z){if(U._destroyed)return;if(V(z.done),z.done){U.push(null);return}U.push(Buffer.from(z.value)),D()}).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)})};var w=D;if(U._fetchResponse=W,U.url=W.url,U.statusCode=W.status,U.statusMessage=W.statusText,W.headers.forEach(function(z,N){U.headers[N.toLowerCase()]=z,U.rawHeaders.push(N,z)}),q.writableStream){var F=new WritableStream({write:function(z){return V(!1),new Promise(function(N,H){if(U._destroyed)H();else if(U.push(Buffer.from(z)))N();else U._resumeFetch=N})},close:function(){if(V(!0),!U._destroyed)U.push(null)},abort:function(z){if(V(!0),!U._destroyed)U.emit("error",z)}});try{W.body.pipeTo(F).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)});return}catch(z){}}var M=W.body.getReader();D()}else{U._xhr=G,U._pos=0,U.url=G.responseURL,U.statusCode=G.status,U.statusMessage=G.statusText;var k=G.getAllResponseHeaders().split(/\r?\n/);if(k.forEach(function(D){var z=D.match(/^([^:]+):\s*(.*)/);if(z){var N=z[1].toLowerCase();if(N==="set-cookie"){if(U.headers[N]===void 0)U.headers[N]=[];U.headers[N].push(z[2])}else if(U.headers[N]!==void 0)U.headers[N]+=", "+z[2];else U.headers[N]=z[2];U.rawHeaders.push(z[1],z[2])}}),U._charset="x-user-defined",!q.overrideMimeType){var f=U.rawHeaders["mime-type"];if(f){var L=f.match(/;\s*charset=([^;])(;|$)/);if(L)U._charset=L[1].toLowerCase()}if(!U._charset)U._charset="utf-8"}}};Q(Z,K.Readable),Z.prototype._read=function(){var G=this,W=G._resumeFetch;if(W)G._resumeFetch=null,W()},Z.prototype._onXHRProgress=function(G){var W=this,B=W._xhr,V=null;switch(W._mode){case"text":if(V=B.responseText,V.length>W._pos){var U=V.substr(W._pos);if(W._charset==="x-user-defined"){var w=Buffer.alloc(U.length);for(var F=0;FW._pos)W.push(Buffer.from(new Uint8Array(M.result.slice(W._pos)))),W._pos=M.result.byteLength},M.onload=function(){G(!0),W.push(null)},M.readAsArrayBuffer(V);break}if(W._xhr.readyState===J.DONE&&W._mode!=="ms-stream")G(!0),W.push(null)}}),xW=h0(($,q)=>{var Q=cK(),K=x1(),J=oK(),Z=iK(),G=J.IncomingMessage,W=J.readyStates;function B(F,M){if(Q.fetch&&M)return"fetch";else if(Q.mozchunkedarraybuffer)return"moz-chunked-arraybuffer";else if(Q.msstream)return"ms-stream";else if(Q.arraybuffer&&F)return"arraybuffer";else return"text"}var V=q.exports=function(F){var M=this;if(Z.Writable.call(M),M._opts=F,M._body=[],M._headers={},F.auth)M.setHeader("Authorization","Basic "+Buffer.from(F.auth).toString("base64"));Object.keys(F.headers).forEach(function(L){M.setHeader(L,F.headers[L])});var k,f=!0;if(F.mode==="disable-fetch"||"requestTimeout"in F&&!Q.abortController)f=!1,k=!0;else if(F.mode==="prefer-streaming")k=!1;else if(F.mode==="allow-wrong-content-type")k=!Q.overrideMimeType;else if(!F.mode||F.mode==="default"||F.mode==="prefer-fast")k=!0;else throw Error("Invalid value for opts.mode");M._mode=B(k,f),M._fetchTimer=null,M._socketTimeout=null,M._socketTimer=null,M.on("finish",function(){M._onFinish()})};K(V,Z.Writable),V.prototype.setHeader=function(F,M){var k=this,f=F.toLowerCase();if(w.indexOf(f)!==-1)return;k._headers[f]={name:F,value:M}},V.prototype.getHeader=function(F){var M=this._headers[F.toLowerCase()];if(M)return M.value;return null},V.prototype.removeHeader=function(F){var M=this;delete M._headers[F.toLowerCase()]},V.prototype._onFinish=function(){var F=this;if(F._destroyed)return;var M=F._opts;if("timeout"in M&&M.timeout!==0)F.setTimeout(M.timeout);var k=F._headers,f=null;if(M.method!=="GET"&&M.method!=="HEAD")f=new Blob(F._body,{type:(k["content-type"]||{}).value||""});var L=[];if(Object.keys(k).forEach(function(H){var v=k[H].name,j=k[H].value;if(Array.isArray(j))j.forEach(function(n){L.push([v,n])});else L.push([v,j])}),F._mode==="fetch"){var D=null;if(Q.abortController){var z=new AbortController;if(D=z.signal,F._fetchAbortController=z,"requestTimeout"in M&&M.requestTimeout!==0)F._fetchTimer=globalThis.setTimeout(function(){if(F.emit("requestTimeout"),F._fetchAbortController)F._fetchAbortController.abort()},M.requestTimeout)}globalThis.fetch(F._opts.url,{method:F._opts.method,headers:L,body:f||void 0,mode:"cors",credentials:M.withCredentials?"include":"same-origin",signal:D}).then(function(H){F._fetchResponse=H,F._resetTimers(!1),F._connect()},function(H){if(F._resetTimers(!0),!F._destroyed)F.emit("error",H)})}else{var N=F._xhr=new globalThis.XMLHttpRequest;try{N.open(F._opts.method,F._opts.url,!0)}catch(H){process.nextTick(function(){F.emit("error",H)});return}if("responseType"in N)N.responseType=F._mode;if("withCredentials"in N)N.withCredentials=!!M.withCredentials;if(F._mode==="text"&&"overrideMimeType"in N)N.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in M)N.timeout=M.requestTimeout,N.ontimeout=function(){F.emit("requestTimeout")};if(L.forEach(function(H){N.setRequestHeader(H[0],H[1])}),F._response=null,N.onreadystatechange=function(){switch(N.readyState){case W.LOADING:case W.DONE:F._onXHRProgress();break}},F._mode==="moz-chunked-arraybuffer")N.onprogress=function(){F._onXHRProgress()};N.onerror=function(){if(F._destroyed)return;F._resetTimers(!0),F.emit("error",Error("XHR error"))};try{N.send(f)}catch(H){process.nextTick(function(){F.emit("error",H)});return}}};function U(F){try{var M=F.status;return M!==null&&M!==0}catch(k){return!1}}V.prototype._onXHRProgress=function(){var F=this;if(F._resetTimers(!1),!U(F._xhr)||F._destroyed)return;if(!F._response)F._connect();F._response._onXHRProgress(F._resetTimers.bind(F))},V.prototype._connect=function(){var F=this;if(F._destroyed)return;F._response=new G(F._xhr,F._fetchResponse,F._mode,F._resetTimers.bind(F)),F._response.on("error",function(M){F.emit("error",M)}),F.emit("response",F._response)},V.prototype._write=function(F,M,k){var f=this;f._body.push(F),k()},V.prototype._resetTimers=function(F){var M=this;if(globalThis.clearTimeout(M._socketTimer),M._socketTimer=null,F)globalThis.clearTimeout(M._fetchTimer),M._fetchTimer=null;else if(M._socketTimeout)M._socketTimer=globalThis.setTimeout(function(){M.emit("timeout")},M._socketTimeout)},V.prototype.abort=V.prototype.destroy=function(F){var M=this;if(M._destroyed=!0,M._resetTimers(!0),M._response)M._response._destroyed=!0;if(M._xhr)M._xhr.abort();else if(M._fetchAbortController)M._fetchAbortController.abort();if(F)M.emit("error",F)},V.prototype.end=function(F,M,k){var f=this;if(typeof F==="function")k=F,F=void 0;Z.Writable.prototype.end.call(f,F,M,k)},V.prototype.setTimeout=function(F,M){var k=this;if(M)k.once("timeout",M);k._socketTimeout=F,k._resetTimers(!1)},V.prototype.flushHeaders=function(){},V.prototype.setNoDelay=function(){},V.prototype.setSocketKeepAlive=function(){};var w=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}),OW=h0(($,q)=>{q.exports=K;var Q=Object.prototype.hasOwnProperty;function K(){var J={};for(var Z=0;Z{q.exports=(C7(),X0(I7)).STATUS_CODES}),TW=h0(($)=>{var q=xW(),Q=oK(),K=OW(),J=PW(),Z=(f7(),X0(v7)),G=$;G.request=function(W,B){if(typeof W==="string")W=Z.parse(W);else W=K(W);var V=globalThis.location.protocol.search(/^https?:$/)===-1?"http:":"",U=W.protocol||V,w=W.hostname||W.host,F=W.port,M=W.path||"/";if(w&&w.indexOf(":")!==-1)w="["+w+"]";W.url=(w?U+"//"+w:"")+(F?":"+F:"")+M,W.method=(W.method||"GET").toUpperCase(),W.headers=W.headers||{};var k=new q(W);if(B)k.on("response",B);return k},G.get=function(W,B){var V=G.request(W,B);return V.end(),V},G.ClientRequest=q,G.IncomingMessage=Q.IncomingMessage,G.Agent=function(){},G.Agent.defaultMaxSockets=4,G.globalAgent=new G.Agent,G.STATUS_CODES=J,G.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}),aK=RW(TW(),1),{request:uW,get:SW,ClientRequest:EW,IncomingMessage:_W,Agent:cW,globalAgent:bW,STATUS_CODES:nW,METHODS:dW}=aK.default,mW=aK.default});var sK={};c1(sK,{validateHeaderValue:()=>MB,validateHeaderName:()=>FB,setMaxIdleHTTPParsers:()=>zB,request:()=>BB,maxHeaderSize:()=>WB,globalAgent:()=>GB,get:()=>ZB,default:()=>wB,createServer:()=>UB,ServerResponse:()=>VB,Server:()=>JB,STATUS_CODES:()=>KB,OutgoingMessage:()=>qB,METHODS:()=>QB,IncomingMessage:()=>$B,ClientRequest:()=>eW,Agent:()=>tW});var pW,iW,lK,oW,aW,lW=($,q,Q)=>{Q=$!=null?pW(iW($)):{};let K=q||!$||!$.__esModule?lK(Q,"default",{value:$,enumerable:!0}):Q;for(let J of oW($))if(!aW.call(K,J))lK(K,J,{get:()=>$[J],enumerable:!0});return K},rW=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),sW,rK,tW,eW,$B,QB,qB,KB,JB,VB,UB,ZB,GB,WB,BB,zB,FB,MB,wB;var tK=b1(()=>{pW=Object.create,{getPrototypeOf:iW,defineProperty:lK,getOwnPropertyNames:oW}=Object,aW=Object.prototype.hasOwnProperty,sW=rW(($,q)=>{var Q=(C7(),X0(I7)),K=(f7(),X0(v7)),J=$;for(Z in Q)if(Q.hasOwnProperty(Z))J[Z]=Q[Z];var Z;J.request=function(W,B){return W=G(W),Q.request.call(this,W,B)},J.get=function(W,B){return W=G(W),Q.get.call(this,W,B)};function G(W){if(typeof W==="string")W=K.parse(W);if(!W.protocol)W.protocol="https:";if(W.protocol!=="https:")throw Error('Protocol "'+W.protocol+'" not supported. Expected "https:"');return W}}),rK=lW(sW(),1),{Agent:tW,ClientRequest:eW,IncomingMessage:$B,METHODS:QB,OutgoingMessage:qB,STATUS_CODES:KB,Server:JB,ServerResponse:VB,createServer:UB,get:ZB,globalAgent:GB,maxHeaderSize:WB,request:BB,setMaxIdleHTTPParsers:zB,validateHeaderName:FB,validateHeaderValue:MB}=rK,wB=rK});var N8=globalThis;if(typeof N8.global>"u")N8.global=globalThis;if(typeof N8.__require>"u")N8.__require=($)=>{throw Error(`Dynamic require of "${$}" is not supported in the sandbox`)};t0();var Uz=J9(h9(),1);var c7=J9(HK(),1);function W2($,q,Q,K){function J(Z){return Z instanceof Q?Z:new Q(function(G){G(Z)})}return new(Q||(Q=Promise))(function(Z,G){function W(U){try{V(K.next(U))}catch(w){G(w)}}function B(U){try{V(K.throw(U))}catch(w){G(w)}}function V(U){U.done?Z(U.value):J(U.value).then(W,B)}V((K=K.apply($,q||[])).next())})}var L0=914400,w8=12700,n0=`\r -`,NB=2147483649,j7=/^[0-9a-fA-F]{6}$/,YB=1.67,kB=27,H6={type:"solid",color:"666666",pt:1},JJ=[0.05,0.1,0.05,0.1],v6={color:"363636",pt:1},u1={color:"888888",style:"solid",size:1,cap:"flat"},Q2="000000",k2=12,DB=18,f6="LAYOUT_16x9",x7="DEFAULT",VJ="333333",P1={type:"outer",blur:3,offset:1.811023622047244,angle:90,color:"000000",opacity:0.35,rotateWithShape:!0},M8=[0.5,0.5,0.5,0.5],eK={color:"000000"},LB={size:8,color:"FFFFFF",opacity:0.75},o2="2094734552",Y5="2094734553",B8="2094734554",O7="2094734555",UJ="2094734556",W8="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),z8=["C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360","C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360"],HB=["5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7","5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7"],R6;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(R6||(R6={}));var I6;(function($){$.b="b",$.ctr="ctr",$.t="t"})(I6||(I6={}));var ZJ="{F7021451-1387-4CA6-816F-3879F97B5CBC}",P7;(function($){$.arraybuffer="arraybuffer",$.base64="base64",$.binarystring="binarystring",$.blob="blob",$.nodebuffer="nodebuffer",$.uint8array="uint8array"})(P7||(P7={}));var T7;(function($){$.area="area",$.bar="bar",$.bar3d="bar3D",$.bubble="bubble",$.bubble3d="bubble3D",$.doughnut="doughnut",$.line="line",$.pie="pie",$.radar="radar",$.scatter="scatter"})(T7||(T7={}));var u7;(function($){$.accentBorderCallout1="accentBorderCallout1",$.accentBorderCallout2="accentBorderCallout2",$.accentBorderCallout3="accentBorderCallout3",$.accentCallout1="accentCallout1",$.accentCallout2="accentCallout2",$.accentCallout3="accentCallout3",$.actionButtonBackPrevious="actionButtonBackPrevious",$.actionButtonBeginning="actionButtonBeginning",$.actionButtonBlank="actionButtonBlank",$.actionButtonDocument="actionButtonDocument",$.actionButtonEnd="actionButtonEnd",$.actionButtonForwardNext="actionButtonForwardNext",$.actionButtonHelp="actionButtonHelp",$.actionButtonHome="actionButtonHome",$.actionButtonInformation="actionButtonInformation",$.actionButtonMovie="actionButtonMovie",$.actionButtonReturn="actionButtonReturn",$.actionButtonSound="actionButtonSound",$.arc="arc",$.bentArrow="bentArrow",$.bentUpArrow="bentUpArrow",$.bevel="bevel",$.blockArc="blockArc",$.borderCallout1="borderCallout1",$.borderCallout2="borderCallout2",$.borderCallout3="borderCallout3",$.bracePair="bracePair",$.bracketPair="bracketPair",$.callout1="callout1",$.callout2="callout2",$.callout3="callout3",$.can="can",$.chartPlus="chartPlus",$.chartStar="chartStar",$.chartX="chartX",$.chevron="chevron",$.chord="chord",$.circularArrow="circularArrow",$.cloud="cloud",$.cloudCallout="cloudCallout",$.corner="corner",$.cornerTabs="cornerTabs",$.cube="cube",$.curvedDownArrow="curvedDownArrow",$.curvedLeftArrow="curvedLeftArrow",$.curvedRightArrow="curvedRightArrow",$.curvedUpArrow="curvedUpArrow",$.custGeom="custGeom",$.decagon="decagon",$.diagStripe="diagStripe",$.diamond="diamond",$.dodecagon="dodecagon",$.donut="donut",$.doubleWave="doubleWave",$.downArrow="downArrow",$.downArrowCallout="downArrowCallout",$.ellipse="ellipse",$.ellipseRibbon="ellipseRibbon",$.ellipseRibbon2="ellipseRibbon2",$.flowChartAlternateProcess="flowChartAlternateProcess",$.flowChartCollate="flowChartCollate",$.flowChartConnector="flowChartConnector",$.flowChartDecision="flowChartDecision",$.flowChartDelay="flowChartDelay",$.flowChartDisplay="flowChartDisplay",$.flowChartDocument="flowChartDocument",$.flowChartExtract="flowChartExtract",$.flowChartInputOutput="flowChartInputOutput",$.flowChartInternalStorage="flowChartInternalStorage",$.flowChartMagneticDisk="flowChartMagneticDisk",$.flowChartMagneticDrum="flowChartMagneticDrum",$.flowChartMagneticTape="flowChartMagneticTape",$.flowChartManualInput="flowChartManualInput",$.flowChartManualOperation="flowChartManualOperation",$.flowChartMerge="flowChartMerge",$.flowChartMultidocument="flowChartMultidocument",$.flowChartOfflineStorage="flowChartOfflineStorage",$.flowChartOffpageConnector="flowChartOffpageConnector",$.flowChartOnlineStorage="flowChartOnlineStorage",$.flowChartOr="flowChartOr",$.flowChartPredefinedProcess="flowChartPredefinedProcess",$.flowChartPreparation="flowChartPreparation",$.flowChartProcess="flowChartProcess",$.flowChartPunchedCard="flowChartPunchedCard",$.flowChartPunchedTape="flowChartPunchedTape",$.flowChartSort="flowChartSort",$.flowChartSummingJunction="flowChartSummingJunction",$.flowChartTerminator="flowChartTerminator",$.folderCorner="folderCorner",$.frame="frame",$.funnel="funnel",$.gear6="gear6",$.gear9="gear9",$.halfFrame="halfFrame",$.heart="heart",$.heptagon="heptagon",$.hexagon="hexagon",$.homePlate="homePlate",$.horizontalScroll="horizontalScroll",$.irregularSeal1="irregularSeal1",$.irregularSeal2="irregularSeal2",$.leftArrow="leftArrow",$.leftArrowCallout="leftArrowCallout",$.leftBrace="leftBrace",$.leftBracket="leftBracket",$.leftCircularArrow="leftCircularArrow",$.leftRightArrow="leftRightArrow",$.leftRightArrowCallout="leftRightArrowCallout",$.leftRightCircularArrow="leftRightCircularArrow",$.leftRightRibbon="leftRightRibbon",$.leftRightUpArrow="leftRightUpArrow",$.leftUpArrow="leftUpArrow",$.lightningBolt="lightningBolt",$.line="line",$.lineInv="lineInv",$.mathDivide="mathDivide",$.mathEqual="mathEqual",$.mathMinus="mathMinus",$.mathMultiply="mathMultiply",$.mathNotEqual="mathNotEqual",$.mathPlus="mathPlus",$.moon="moon",$.noSmoking="noSmoking",$.nonIsoscelesTrapezoid="nonIsoscelesTrapezoid",$.notchedRightArrow="notchedRightArrow",$.octagon="octagon",$.parallelogram="parallelogram",$.pentagon="pentagon",$.pie="pie",$.pieWedge="pieWedge",$.plaque="plaque",$.plaqueTabs="plaqueTabs",$.plus="plus",$.quadArrow="quadArrow",$.quadArrowCallout="quadArrowCallout",$.rect="rect",$.ribbon="ribbon",$.ribbon2="ribbon2",$.rightArrow="rightArrow",$.rightArrowCallout="rightArrowCallout",$.rightBrace="rightBrace",$.rightBracket="rightBracket",$.round1Rect="round1Rect",$.round2DiagRect="round2DiagRect",$.round2SameRect="round2SameRect",$.roundRect="roundRect",$.rtTriangle="rtTriangle",$.smileyFace="smileyFace",$.snip1Rect="snip1Rect",$.snip2DiagRect="snip2DiagRect",$.snip2SameRect="snip2SameRect",$.snipRoundRect="snipRoundRect",$.squareTabs="squareTabs",$.star10="star10",$.star12="star12",$.star16="star16",$.star24="star24",$.star32="star32",$.star4="star4",$.star5="star5",$.star6="star6",$.star7="star7",$.star8="star8",$.stripedRightArrow="stripedRightArrow",$.sun="sun",$.swooshArrow="swooshArrow",$.teardrop="teardrop",$.trapezoid="trapezoid",$.triangle="triangle",$.upArrow="upArrow",$.upArrowCallout="upArrowCallout",$.upDownArrow="upDownArrow",$.upDownArrowCallout="upDownArrowCallout",$.uturnArrow="uturnArrow",$.verticalScroll="verticalScroll",$.wave="wave",$.wedgeEllipseCallout="wedgeEllipseCallout",$.wedgeRectCallout="wedgeRectCallout",$.wedgeRoundRectCallout="wedgeRoundRectCallout"})(u7||(u7={}));var G2;(function($){$.text1="tx1",$.text2="tx2",$.background1="bg1",$.background2="bg2",$.accent1="accent1",$.accent2="accent2",$.accent3="accent3",$.accent4="accent4",$.accent5="accent5",$.accent6="accent6"})(G2||(G2={}));var S7;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(S7||(S7={}));var E7;(function($){$.top="top",$.middle="middle",$.bottom="bottom"})(E7||(E7={}));var B1;(function($){$.ACTION_BUTTON_BACK_OR_PREVIOUS="actionButtonBackPrevious",$.ACTION_BUTTON_BEGINNING="actionButtonBeginning",$.ACTION_BUTTON_CUSTOM="actionButtonBlank",$.ACTION_BUTTON_DOCUMENT="actionButtonDocument",$.ACTION_BUTTON_END="actionButtonEnd",$.ACTION_BUTTON_FORWARD_OR_NEXT="actionButtonForwardNext",$.ACTION_BUTTON_HELP="actionButtonHelp",$.ACTION_BUTTON_HOME="actionButtonHome",$.ACTION_BUTTON_INFORMATION="actionButtonInformation",$.ACTION_BUTTON_MOVIE="actionButtonMovie",$.ACTION_BUTTON_RETURN="actionButtonReturn",$.ACTION_BUTTON_SOUND="actionButtonSound",$.ARC="arc",$.BALLOON="wedgeRoundRectCallout",$.BENT_ARROW="bentArrow",$.BENT_UP_ARROW="bentUpArrow",$.BEVEL="bevel",$.BLOCK_ARC="blockArc",$.CAN="can",$.CHART_PLUS="chartPlus",$.CHART_STAR="chartStar",$.CHART_X="chartX",$.CHEVRON="chevron",$.CHORD="chord",$.CIRCULAR_ARROW="circularArrow",$.CLOUD="cloud",$.CLOUD_CALLOUT="cloudCallout",$.CORNER="corner",$.CORNER_TABS="cornerTabs",$.CROSS="plus",$.CUBE="cube",$.CURVED_DOWN_ARROW="curvedDownArrow",$.CURVED_DOWN_RIBBON="ellipseRibbon",$.CURVED_LEFT_ARROW="curvedLeftArrow",$.CURVED_RIGHT_ARROW="curvedRightArrow",$.CURVED_UP_ARROW="curvedUpArrow",$.CURVED_UP_RIBBON="ellipseRibbon2",$.CUSTOM_GEOMETRY="custGeom",$.DECAGON="decagon",$.DIAGONAL_STRIPE="diagStripe",$.DIAMOND="diamond",$.DODECAGON="dodecagon",$.DONUT="donut",$.DOUBLE_BRACE="bracePair",$.DOUBLE_BRACKET="bracketPair",$.DOUBLE_WAVE="doubleWave",$.DOWN_ARROW="downArrow",$.DOWN_ARROW_CALLOUT="downArrowCallout",$.DOWN_RIBBON="ribbon",$.EXPLOSION1="irregularSeal1",$.EXPLOSION2="irregularSeal2",$.FLOWCHART_ALTERNATE_PROCESS="flowChartAlternateProcess",$.FLOWCHART_CARD="flowChartPunchedCard",$.FLOWCHART_COLLATE="flowChartCollate",$.FLOWCHART_CONNECTOR="flowChartConnector",$.FLOWCHART_DATA="flowChartInputOutput",$.FLOWCHART_DECISION="flowChartDecision",$.FLOWCHART_DELAY="flowChartDelay",$.FLOWCHART_DIRECT_ACCESS_STORAGE="flowChartMagneticDrum",$.FLOWCHART_DISPLAY="flowChartDisplay",$.FLOWCHART_DOCUMENT="flowChartDocument",$.FLOWCHART_EXTRACT="flowChartExtract",$.FLOWCHART_INTERNAL_STORAGE="flowChartInternalStorage",$.FLOWCHART_MAGNETIC_DISK="flowChartMagneticDisk",$.FLOWCHART_MANUAL_INPUT="flowChartManualInput",$.FLOWCHART_MANUAL_OPERATION="flowChartManualOperation",$.FLOWCHART_MERGE="flowChartMerge",$.FLOWCHART_MULTIDOCUMENT="flowChartMultidocument",$.FLOWCHART_OFFLINE_STORAGE="flowChartOfflineStorage",$.FLOWCHART_OFFPAGE_CONNECTOR="flowChartOffpageConnector",$.FLOWCHART_OR="flowChartOr",$.FLOWCHART_PREDEFINED_PROCESS="flowChartPredefinedProcess",$.FLOWCHART_PREPARATION="flowChartPreparation",$.FLOWCHART_PROCESS="flowChartProcess",$.FLOWCHART_PUNCHED_TAPE="flowChartPunchedTape",$.FLOWCHART_SEQUENTIAL_ACCESS_STORAGE="flowChartMagneticTape",$.FLOWCHART_SORT="flowChartSort",$.FLOWCHART_STORED_DATA="flowChartOnlineStorage",$.FLOWCHART_SUMMING_JUNCTION="flowChartSummingJunction",$.FLOWCHART_TERMINATOR="flowChartTerminator",$.FOLDED_CORNER="folderCorner",$.FRAME="frame",$.FUNNEL="funnel",$.GEAR_6="gear6",$.GEAR_9="gear9",$.HALF_FRAME="halfFrame",$.HEART="heart",$.HEPTAGON="heptagon",$.HEXAGON="hexagon",$.HORIZONTAL_SCROLL="horizontalScroll",$.ISOSCELES_TRIANGLE="triangle",$.LEFT_ARROW="leftArrow",$.LEFT_ARROW_CALLOUT="leftArrowCallout",$.LEFT_BRACE="leftBrace",$.LEFT_BRACKET="leftBracket",$.LEFT_CIRCULAR_ARROW="leftCircularArrow",$.LEFT_RIGHT_ARROW="leftRightArrow",$.LEFT_RIGHT_ARROW_CALLOUT="leftRightArrowCallout",$.LEFT_RIGHT_CIRCULAR_ARROW="leftRightCircularArrow",$.LEFT_RIGHT_RIBBON="leftRightRibbon",$.LEFT_RIGHT_UP_ARROW="leftRightUpArrow",$.LEFT_UP_ARROW="leftUpArrow",$.LIGHTNING_BOLT="lightningBolt",$.LINE_CALLOUT_1="borderCallout1",$.LINE_CALLOUT_1_ACCENT_BAR="accentCallout1",$.LINE_CALLOUT_1_BORDER_AND_ACCENT_BAR="accentBorderCallout1",$.LINE_CALLOUT_1_NO_BORDER="callout1",$.LINE_CALLOUT_2="borderCallout2",$.LINE_CALLOUT_2_ACCENT_BAR="accentCallout2",$.LINE_CALLOUT_2_BORDER_AND_ACCENT_BAR="accentBorderCallout2",$.LINE_CALLOUT_2_NO_BORDER="callout2",$.LINE_CALLOUT_3="borderCallout3",$.LINE_CALLOUT_3_ACCENT_BAR="accentCallout3",$.LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR="accentBorderCallout3",$.LINE_CALLOUT_3_NO_BORDER="callout3",$.LINE_CALLOUT_4="borderCallout4",$.LINE_CALLOUT_4_ACCENT_BAR="accentCallout3=4",$.LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR="accentBorderCallout4",$.LINE_CALLOUT_4_NO_BORDER="callout4",$.LINE="line",$.LINE_INVERSE="lineInv",$.MATH_DIVIDE="mathDivide",$.MATH_EQUAL="mathEqual",$.MATH_MINUS="mathMinus",$.MATH_MULTIPLY="mathMultiply",$.MATH_NOT_EQUAL="mathNotEqual",$.MATH_PLUS="mathPlus",$.MOON="moon",$.NON_ISOSCELES_TRAPEZOID="nonIsoscelesTrapezoid",$.NOTCHED_RIGHT_ARROW="notchedRightArrow",$.NO_SYMBOL="noSmoking",$.OCTAGON="octagon",$.OVAL="ellipse",$.OVAL_CALLOUT="wedgeEllipseCallout",$.PARALLELOGRAM="parallelogram",$.PENTAGON="homePlate",$.PIE="pie",$.PIE_WEDGE="pieWedge",$.PLAQUE="plaque",$.PLAQUE_TABS="plaqueTabs",$.QUAD_ARROW="quadArrow",$.QUAD_ARROW_CALLOUT="quadArrowCallout",$.RECTANGLE="rect",$.RECTANGULAR_CALLOUT="wedgeRectCallout",$.REGULAR_PENTAGON="pentagon",$.RIGHT_ARROW="rightArrow",$.RIGHT_ARROW_CALLOUT="rightArrowCallout",$.RIGHT_BRACE="rightBrace",$.RIGHT_BRACKET="rightBracket",$.RIGHT_TRIANGLE="rtTriangle",$.ROUNDED_RECTANGLE="roundRect",$.ROUNDED_RECTANGULAR_CALLOUT="wedgeRoundRectCallout",$.ROUND_1_RECTANGLE="round1Rect",$.ROUND_2_DIAG_RECTANGLE="round2DiagRect",$.ROUND_2_SAME_RECTANGLE="round2SameRect",$.SMILEY_FACE="smileyFace",$.SNIP_1_RECTANGLE="snip1Rect",$.SNIP_2_DIAG_RECTANGLE="snip2DiagRect",$.SNIP_2_SAME_RECTANGLE="snip2SameRect",$.SNIP_ROUND_RECTANGLE="snipRoundRect",$.SQUARE_TABS="squareTabs",$.STAR_10_POINT="star10",$.STAR_12_POINT="star12",$.STAR_16_POINT="star16",$.STAR_24_POINT="star24",$.STAR_32_POINT="star32",$.STAR_4_POINT="star4",$.STAR_5_POINT="star5",$.STAR_6_POINT="star6",$.STAR_7_POINT="star7",$.STAR_8_POINT="star8",$.STRIPED_RIGHT_ARROW="stripedRightArrow",$.SUN="sun",$.SWOOSH_ARROW="swooshArrow",$.TEAR="teardrop",$.TRAPEZOID="trapezoid",$.UP_ARROW="upArrow",$.UP_ARROW_CALLOUT="upArrowCallout",$.UP_DOWN_ARROW="upDownArrow",$.UP_DOWN_ARROW_CALLOUT="upDownArrowCallout",$.UP_RIBBON="ribbon2",$.U_TURN_ARROW="uturnArrow",$.VERTICAL_SCROLL="verticalScroll",$.WAVE="wave"})(B1||(B1={}));var q0;(function($){$.AREA="area",$.BAR="bar",$.BAR3D="bar3D",$.BUBBLE="bubble",$.BUBBLE3D="bubble3D",$.DOUGHNUT="doughnut",$.LINE="line",$.PIE="pie",$.RADAR="radar",$.SCATTER="scatter"})(q0||(q0={}));var L5;(function($){$.TEXT1="tx1",$.TEXT2="tx2",$.BACKGROUND1="bg1",$.BACKGROUND2="bg2",$.ACCENT1="accent1",$.ACCENT2="accent2",$.ACCENT3="accent3",$.ACCENT4="accent4",$.ACCENT5="accent5",$.ACCENT6="accent6"})(L5||(L5={}));var W1;(function($){$.chart="chart",$.image="image",$.line="line",$.rect="rect",$.text="text",$.placeholder="placeholder"})(W1||(W1={}));var D0;(function($){$.chart="chart",$.hyperlink="hyperlink",$.image="image",$.media="media",$.online="online",$.placeholder="placeholder",$.table="table",$.tablecell="tablecell",$.text="text",$.notes="notes"})(D0||(D0={}));var F8;(function($){$.title="title",$.body="body",$.image="pic",$.chart="chart",$.table="tbl",$.media="media"})(F8||(F8={}));var C6;(function($){$.DEFAULT="•",$.CHECK="✓",$.STAR="★",$.TRIANGLE="▶"})(C6||(C6={}));var j6="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOVhAAAGAUlEQVR4Xu2dT0xcRRzHf7tAYSsc0EBSIq2xEg8mtTGebVzEqOVIolz0siRE4gGTStqKwdpWsXoyGhMuyAVJOHBgqyvLNgonDkabeCBYW/8kTUr0wsJC+Wfm0bfuvn37Znbem9mR9303mJnf/Pb7ed95M7PDI5JIJPYJV5EC7e3t1N/fT62trdqViQCIu+bVgpIHEo/Hqbe3V/sdYVKHyWSSZmZm8ilVA0oeyNjYmEnaVC2Xvr6+qg5fAOJAz4DU1dURGzFSqZRVqtMpAFIGyMjICC0vL9PExIRWKADiAYTNshYWFrRCARAOEFZcCKWtrY0GBgaUTYkBRACIE4rKZwqACALR5RQAqQCIDqcASIVAVDsFQCSAqHQKgEgCUeUUAPEBRIVTAMQnEBvK5OQkbW9vk991CoAEAMQJxc86BUACAhKUUwAkQCBBOAVAAgbi1ykAogCIH6cAiCIgsk4BEIVAZJwCIIqBVLqiBxANQFgXS0tLND4+zl08AogmIG5OSSQS1gGKwgtANAIRcQqAaAbCe6YASBWA2E6xDyeyDUl7+AKQMkDYYevm5mZHabA/Li4uUiaTsYLau8QA4gLE/hU7wajyYtv1hReDAiAOxQcHBymbzark4BkbQKom/X8dp9Npmpqasn4BIAYAYSnYp+4BBEAMUcCwNOCQsAKZnp62NtQOw8WmwT09PUo+ijaHsOMx7GppaaH6+nolH0Z10K2tLVpdXbW6UfV3mNqBdHd3U1NTk2rtlMRfW1uj2dlZAFGirkRQAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAGHqrm8caPzQ0WC1logbeiC7X3xJm0PvUmRzh45cuki1588FAmVn9BO6P3yF9utrqGH0MtW82S8UN9RA9v/4k7InjhcJFTs/TLVXLwmJV67S7vD7tHF5pKi46fYdosdOcOOGG8j1OcqefbFEJD9Q3GCwDhqT31HklS4A8VRgfYM2Op6k3bt/BQJl58J7lPvwg5JYNccepaMry0LPqFA7hCm39+NNyp2J0172b19QysGINj5CsRtpij57musOViH0QPJQXn6J9u7dlYJSFkbrMYolrwvDAJAC+WWdEpQz7FTgECeUCpzi6YxvvqXoM6eEhqnCSgDikEzUKUE7Aw7xuHctKB5OYU3dZlNR9syQdAaAcAYTC0pXF+39c09o2Ik+3EqxVKqiB7hbYAxZkk4pbBaEM+AQofv+wTrFwylBOQNABIGwavdfe4O2pg5elO+86l99nY58/VUF0byrYsjiSFluNlXYrOHcBar7+EogUADEQ0YRGHbzoKAASBkg2+9cpM1rV0tK2QOcXW7bLEFAARAXIF4w2DrDWoeUWaf4hQIgDiA8GPZ2iNfi0Q8UACkAIgrDbrJ385eDxaPLLrEsFAB5oG6lMPJQPLZZZKAACBGVhcG2Q+bmuLu2nk55e4jqPv1IeEoceiBeX7s2zCa5MAqdstl91vfXwaEGsv/rb5TtOFk6tWXOuJGh6KmnhO9sayrMninPx103JBtXblHkice58cINZP4Hyr5wpkgkdiChEmc4FWazLzenNKa/p0jncwDiqcD6BuWePk07t1asatZGoYQzSqA4nFJ7soNiP/+EUyfc25GI2GG53dHPrKo1g/1Cw4pIXLrzO+1c+/wg7tBbFDle/EbQcjFCPWQJCau5EoBoFpzXHYDwFNJcDiCaBed1ByA8hTSXA4hmwXndAQhPIc3lAKJZcF53AMJTSHM5gGgWnNcdgPAU0lwOIJoF53UHIDyFNJcfSiCdnZ0Ui8U0SxlMd7lcjubn561gh+Y1scFIU/0o/3sgeLO12E2k7UXKYumgFoAYdg8ACIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6ZQ4JB6PKzviYthnNy4d9h+1M5mMlVckkUjsG5dhiBMCEMPg/wuOfrZZ/RSywQAAAABJRU5ErkJggg==",vB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB4AAAAVnCAYAAACzfHDVAAAAYHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjaVcjJDYAwDEXBu6ughBfH+YnLQSwSHVA+Yrkwx7HtPHabHuEWrQ+lBBAZ6TMweBWoCwUH8quZH6VWFXVT696zxp12ARkVFEqn8wB8AAAACXBIWXMAAC4jAAAuIwF4pT92AADZLklEQVR42uzdd5hV9Z0/8M+dmcsUZmDovYOhKCiKYhR7JJuoSTCWGFI0WUxijBoTTXazVlyza4maYm9rTRSJigVsqCDNQhHBAogKCEgRMjMMU+7vj93sL8kqClLmnPt6PY+PeXZM9vP9vO8jZ+Y955xMfJLjorBrRMuSgmiViyjN1Ee2oSCyucbIBAAAAAAAAADbXaYgcoWNUZcrirpMbdRsysa69wbF+rggGrf439vSF7seF12aFUTnxvoosGIAAAAAAACAXacgoqEgF++/VRgr4r5o+Kh/pvD//F8uiII+LaPrum/EXzqui2b1ddHGKgEAAAAAAAB2rVxEQWMmWrQtjHZlA6N2w2tR84//zP8pgHu3ib6NBdG+zdqorK6KVUXZaB85j3sGAAAAAAAAaAoaG6OwIBdtyneP2PBabPzbr/1dAdx3VHRtyESHiIhcYzQrLo7WmVzkcjmPgAYAAAAAAABoSgpy0eIfS+D/LYD7fy3abC6Inn/7X2hsjELlLwAAAAAAAEDT9D8lcM1fHwddFBFxyAVR9M686PVp/gfqayKiJiLqLBMAAAAAAABgh8hGRGlEUekn/6PFEb3ikNgQk6O+KCJi6dzoksv83/cB/1X9xoiaJdmoWxlRV1dk2QAAAAAAAAA7QTZbH9muERX96v7n9t7/q6Exinq3i86LI94pjOOisHUu+uYykfmof7h+Y8Sa6aVRt74gGhs9DRoAAAAAAABgZ2lsLIi69QWxeUUmSjs0/vedwR8hk4uydSfE+wVd6qOyMfMx7/mtj9jwUtbjngEAAAAAAAB2obrqolg7IxtR/9Ffb4wo7P5GtCwobRaVH/c/UvNmNuqqPfIZAAAAAAAAYFerqy6KmjezH/v1ktpoVZBr/PgCeMN7yl8AAAAAAACApmJLHW5jUVQWNDSP+Q3ZeLco4i9/+8X6teHRzwAAAAAAAABNSd3/dLn/oLAoqqIuVhXFxhhSGB/xqGjlLwAAAAAAAECTU1eTjaK/KXSLIv7SWB+bc5ko9YxnAAAAAAAAgATJFv393bz1EeV//c8F1gMAAAAAAACQDgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKREkRUAAACwrUpLSwuGDRvWfMCAAS26du3avKysrLiioqKkZcuWzZs1a1bcvHnz0tLS0rJsNtusuLi4ebNmzUoLCgo+8/eijY2N9Zs3b66pra2tqqur21xTU1NdVVVVs2nTptqNGzdWbdiwoeYvf/nL5hUrVlQtWLBgw6xZs6pqamoaJQYAAEDaKYABAACIiIghQ4aUHnTQQW379u3bql27dq3at2/fpkWLFq2bN29eWVpa2qpZs2bNCwsLm2ez2fLCwsLyoqKi8sLCwtKknK+hoaG6vr6+qqGh4S91dXV/aWhoqNq8eXNVTU3NuqqqqvUbNmxYu2rVqjWrV69e99Zbb6177rnnPpgzZ06NTwYAAABJogAGAADIA8OGDWt+xBFHdBwwYECnLl26dGjdunXHFi1adCgtLe1YUlLSvlmzZq0KCgqK07yDwsLCssLCwrKIaPdp/zuNjY21mzdvXrdp06ZVNTU172/YsGHl2rVr31+2bNnKBQsWrHjyySffnzVrVpVPGAAAAE1Fpuexsd9HfaF+ZcSal0ptCAAAIAE6deqUPf744zvtueeeXbp3796lbdu2XSorKzuXlpZ2KS0t7VBYWFhhSztGQ0PDxpqampU1NTXL169fv+yDDz5Y9s477yybPXv2sj/96U8rVqxYUWdLAAAAbE9t9q6Jog4f/TUFMAAAQEJks9nMt7/97Y4jRozo1bdv397t2rXrXl5e3rWsrKxzcXFx+4gosKUmp7G2tnZVTU3Nso0bNy5btWrV0tdff/2tJ598cvG999672noAAADYFgpgAACAhPne977X6a9Fb/v27Xu1bNmyV1lZWa8kvXOXLauvr9/wl7/8ZdG6desWL1u2bNHChQsX/fGPf1w8derUjbYDAADAliiAAQAAmqhsNps59dRTuxx66KH9+/Tp87n27dv3Ly8v719UVOSRzXlq06ZNKzZu3Pj6+++//8abb775xqOPPvrG3XffvcpmAAAA+CsFMAAAQBNx6qmndvniF784qHfv3v3btWv3uYqKis8VFhaW2wxbUl9fv37Dhg1vfPDBB68vXrz4jccee2z+jTfeuNxmAAAA8pMCGAAAYBc45phjWn/rW9/aq3///kPatGnTv6Kiop9HOLO9NDQ0VG/cuPGtNWvWLFy4cOGcO+6445WHHnporc0AAACknwIYAABgJzjjjDO6f+lLX9qrV69eg1u3bj2orKysR0RkbIadJFddXb103bp18xcvXjz30UcffeXqq69+x1oAAADSRwEMAACwnZWWlhb86le/2u3QQw8d1r17931btmw5qLCwsMxmaEoaGhqqP/zww/nvvPPOzGeeeWbW2LFj36ipqWm0GQAAgGRTAAMAAGwHP/7xj7t+9atf3bdXr15D27Ztu1c2m21jKyRJXV3dmg8++OCVRYsWvfznP/95xh/+8IdltgIAAJA8CmAAAIBtcOKJJ7Y75ZRTDujXr9+w1q1bD81ms61shTSpq6tbt3bt2pfffPPNWbfccsvUe++9d7WtAAAANH0KYAAAgE+hoqKi4IILLhg0YsSI/bp27bpfy5YtB2YymUKbIR/kcrmGDz/8cP6777474/nnn59x4YUXvrZx40aPiwYAAGiCFMAAAAAf4/jjj2/7/e9//8D+/fsf2Lp1630KCgpKbAUiGhsbN61fv37eW2+9NeWGG2545u67715lKwAAAE2DAhgAAOB/ZLPZzAUXXPC5I4888sDu3bsfWFFRsVtEFNgMbFl1dfWSd999d8qsWbNmnnvuuS+vW7euwVYAAAB2DQUwAACQ10pLSwsuvfTSQYcccsjBXbt2HVFWVtbDVmDb1dbWrnr//fdfmDp16uRf/vKXL65evbreVgAAAHYeBTAAAJB3Bg0aVHrBBRd8fs899zywQ4cOBxQVFbWwFdj+Ghsba9euXTtrzpw5T59//vmTX3755WpbAQAA2LEUwAAAQF4YNmxY8/POO+/gIUOGHOZ9vrDz/W0ZfNFFFz07a9asKlsBAADY/hTAAABAarVq1arwyiuv3HfEiBEjO3TocFBhYWGZrcCu19DQUP3+++8/O2XKlIk/+clPZm7cuLHRVgAAALYPBTAAAJAqrVq1Kvztb3+7/3777Xd4x44dRxQWFpbbCjRdDQ0NG99///0pM2bMeOqHP/zhC8pgAACAz0YBDAAApMJZZ53V45vf/OaRvXr1GllaWtrVRiB5ampq3l28ePHEO++8c9LVV1/9jo0AAABsPQUwAACQWMOHDy+/6KKLvjB48OCjW7RoMdBGID0+/PDDV+fNmzfhvPPOe3L69Ol/sREAAIBPRwEMAAAkSqtWrQpvuOGGQ/bbb79/atOmzX6ZTCZrK5BeuVyubs2aNTNmzJjx2JgxYyavW7euwVYAAAA+ngIYAABIhB//+Mddv/e9732lZ8+e/1RcXNzWRiD/1NbWfvD2228/dssttzz029/+9l0bAQAA+L8UwAAAQJNVUVFRcO21137+4IMPPrZ169b7ZTKZAlsBIqJxzZo1M59//vnxp5122hR3BQMAAPx/CmAAAKDJOeWUUzqefvrpx/bu3ftL2Wy2jY0AH6e+vn7j0qVLH/vd7373x+uvv36ZjQAAAPlOAQwAADQJ2Ww2c+uttx5wyCGHnNC6deu9I8LdvsDWaFy7du1L06ZN+/OPfvSjZ1evXl1vJQAAQD5SAAMAALtU//79S6655pp/2nPPPY8tLy/vayPAZ1VTU7NswYIF488999wHp06dutFGAACAfKIABgAAdomf//znPU855ZQTu3btemRhYWGZjQDbW2NjY92KFSuevOWWW+689NJLF9kIAACQDxTAAADATuMxz8Cusn79+rlPP/30f5188slT6+rqcjYCAACklQIYAADY4fr27Vv8hz/84a+Pee5nI8CuUlNT8+68efPu/8EPfvDgwoULN9kIAACQNgpgAABghxkyZEjpNddc89XBgwefWFxc3MFGgKaitrZ21dy5c+/5yU9+8uc5c+bU2AgAAJAWWyqAPYoNAADYJqNHj+4wb968n06ZMuXRYcOGnaH8BZqa4uLi9sOGDTtjypQpj86bN++nJ510UntbAQAA0s4dwAAAwFY599xze33/+9//dufOnY/IZDJZGwGSIpfL1S1fvvzJG2644fbLLrvsbRsBAACSyiOgAQCAz+y8887r+53vfOfbHTt2PDyTyRTaCJBUuVyuYcWKFU/cdNNN//XrX/96sY0AAABJowAGAAC22WWXXTboG9/4xg9at249zDaAtFm7du2su++++9pzzjnnNdsAAACSQgEMAABsNcUvkE8UwQAAQJIogAEAgE9N8Qvks7Vr18665557rvv5z38+3zYAAICmaksFcGHlwOj6UV9orIqoWZG1PQAAyBO/+MUvet9xxx3nHHrooT8pLS3tYiNAPiotLe2y7777HvP973+/X1lZ2ZIpU6assxUAAKCpKetcHwXlH/01BTAAAOS5M844o/u99957zpe//OWflZeX94qIjK0AeS5TXl7e8+CDDx71/e9/v3dEvDVjxowPrQUAAGgqFMAAAMD/ceKJJ7a77777fjJq1Kh/KS8v7xOKX4B/lCkvL+99+OGHj/rWt77VfvXq1Qvnz59fbS0AAMCutqUC2DuAAQAgzwwdOrTs+uuvP6l///4nFRYWltkI20NjY2Ns2rQpqquro6amJurr62PTpk2xefPmqK+vj+rq6qivr4/NmzfHpk2boqGhYZv/fxUWFkZJSUk0a9YsioqKoqysLIqKiqJZs2ZRUlISRUVFUVpa+r9/FRQUCIjtoqGhoeq11167a8yYMffMmTOnxkYAAIBdZUvvAFYAAwBAnujUqVP2nnvuGbXXXnudnM1mK22Ej9PQ0BAbN26MDRs2/J+/Nm7cGBs3boyamprYtGlTbNq0KWpqaqK2trbJnqe4uDhKSkqitLT0f/9eUVERFRUV0aJFi//zV0VFRRQWFvog8LHq6urWvvjii7eceOKJf169enW9jQAAADubAhgAAPLcXXfdddAXv/jF00tLS7vZRn7L5XKxYcOGWLt2baxbty7Wrl37d3+tW7cuNmzYkPd7atGiRbRu3TpatWoVrVu3jjZt2vzvf27dunW0aNHCh4morq5e+sgjj1zzne98Z6ptAAAAO5MCGAAA8tTVV189+MQTTzyzoqJioG3kj8bGxli5cmUsX748Pvjgg1i9evX//n3t2rXR2NhoSZ9RYWFhtGrVKtq1axdt27b937937tw5OnTo4LHTeWbDhg3z77333qvOPPPMebYBAADsDApgAADIM1/72tfaXHrppad27979qIjQRKVUQ0NDrFq1KlasWBHvv//+//595cqVTfqRzGlXXFwcHTp0iI4dO0bnzp2jY8eO0alTp2jXrp1HS6dYLpdrfOeddx76+c9/fv2ECRPW2QgAALAjKYABACBP9OrVq9ldd931jT322OM7hYWFZTaSHh9++GG88847sXTp0njvvfdixYoVsXr16mhoaLCchCgsLIz27dtHp06dolu3btG9e/fo3r27x0mnTENDQ9W8efNu++Y3v/nHJUuWbLYRAABgR1AAAwBAHrjrrrtG/NM//dOZJSUlXWwj2davXx9Lly6Nd955539L3w8//NBiUqqysvJ/y+C//tWqVSuLSbiamppljz322G9Gjx49xTYAAIDtTQEMAAAp9qtf/arPD3/4w5+1atVqL9tIno0bN8aSJUvirbfeikWLFsV7770XmzZtspg8V1JSEl27do0+ffpE3759o3fv3lFeXm4xCbRu3bqXr7322ivGjh27yDYAAIDtRQEMAAApNGjQoNI77rjju7vttttJBQUFWRtJhtWrV8ebb74ZixcvjiVLlsTy5cujsbHRYtiigoKC6Ny5c/Tu3Tt69+4d/fr1i7Zt21pMQjQ2Nta98cYbd33rW9+6ff78+TU2AgAAfFYKYAAASJHS0tKCBx988Jj99tvvn7PZbBsbaboaGhri7bffjrfeeisWLFgQS5YscXcv201FRUX06tUr+vbtG3379o2ePXtGYWGhxTRhdXV1a2bMmHHjV77ylYdqamr85gcAALDNFMAAAJASp59+erdf/vKX51ZWVu5jG03T6tWr47XXXouFCxfGm2++GRs3brQUdooWLVpE3759Y8CAATFw4EB3CDdh69evf/E//uM//vPqq69+xzYAAIBtoQAGAICEGzRoUOm99977w969ex+byWTc4teErF+/PubNmxcLFiyIN954Q+FLk9GiRYvo169fDBgwIPbYY4+orKy0lCYkl8s1LF68eNyJJ554rcdCAwAAW0sBDAAACXbNNdcMOemkk35RVlbWyzZ2vVwuF++++27MnTs3XnvttViyZIl3+NLkFRQURK9evWLQoEExePDg6Natm6U0EdXV1UvuvvvuX//kJz+ZYxsAAMCnpQAGAIAEOuqoo1r99re//VmHDh0Ot41da9OmTTF79uyYO3duLFy4MKqqqiyFRGvevHn0798/Bg8eHHvuuWeUlJRYyi62cuXKp04//fTLJ0yYsM42AACAT6IABgCAhBk3btwRRxxxxFnZbLaNbewaVVVVMXfu3Jg7d27Mnz8/amtrLYVUKi4ujoEDB8bgwYNj8ODBUV5ebim7SF1d3ZqnnnrqqlGjRj1hGwAAwJYogAEAICFOOeWUjhdddNEvW7duvZ9t7HwrV66MWbNmxdy5c+Odd96JXC5nKeSdzp07x9577x3Dhg2LDh06WMgusHbt2hnnnXfepbfccsv7tgEAAHwUBTAAADRxpaWlBU899dQ3Bw8e/L2CggLPYt2JVqxYES+99FK89NJLsXz5cguBv/HXMnjvvfeOTp06WchO1NjYuGnu3Lk3H3744XfV1NR40TgAAPB3FMAAANCEjR49usOll176yzZt2gy3jZ1j/fr18eKLL8bMmTNj6dKlFgKfQs+ePWPfffeNYcOGRYsWLSxkJ1mzZs0L55577q/vvvvuVbYBAAD8lQIYAACaoIqKioKJEyd+c/Dgwd8vKCgotpEda8OGDfHiiy/G9OnTlb7wGfXo0SOGDx8ew4YNi4qKCgvZwdwNDAAA/CMFMAAANDGnnHJKx7Fjx/5rZWXlMNvYcerr6+PVV1+NGTNmxLx586Kurs5SYDvKZrMxZMiQ2HfffWP33XePwsJCS9mB1q5dO+MXv/jFv995550rbQMAAPKbAhgAAJqIbDabeeKJJ47fZ599fuSu3x0jl8vFwoULY/r06TF79uzYtGmTpcBOUFpaGkOGDInhw4fHgAEDLGQHaWhoqJ42bdo1Rx555J9tAwAA8pcCGAAAmoDjjz++7ZVXXvmr1q1be9fvDrBmzZqYNm1azJw5M1audHMc7EodO3aMz3/+87H//vt7X/CO+3fetDPPPPOScePGfWAbAACQfxTAAACwi9100037HXvssf9WXFzc1ja2n1wuF6+99lo8//zzMW/evKivr7cUaEKKiopizz33jBEjRsTnPve5yGQylrId1dbWrvrjH/948Q9+8INZtgEAAPlFAQwAALvIkCFDSu+///5zunTp8k+2sf2sXbs2Jk+eHNOnT48PP/zQQiABKisrY8SIEXHIIYdEeXm5hWxHy5Yte+zrX//6f86ZM6fGNgAAID9sqQAurBwYXT/qC41VETUrsrYHAADb6IILLtjt97///VVt2rQZZhvbx+LFi2P8+PFx9913xxtvvBG1tbWWAgmxadOmeOONN+LZZ5+NtWvXRps2bTweejtp0aJFv5NOOumg0tLSuc8+++xaGwEAgPQr61wfBR/zu7XuAAYAgO0sm81mJk2a9PVhw4b9pKCgwG9VfkZ1dXUxY8aMeOaZZ+K9996zEEiRfv36xSGHHBJDhw6NgoICC/mMGhsbN8+YMeOaL37xi+Pq6upyNgIAAOnlEdAAALCTHH/88W2vuuqqCyorK/exjc9mzZo18dRTT8XUqVNj06ZNFgIpVlFREZ///OfjsMMOi8rKSgv5jNavXz/r9NNPv3DcuHEf2AYAAKSTAhgAAHaC22677fNf+9rXzstms5W2se0WLVoUjz/+eMybNy9yOTewQT4pKiqKIUOGxBFHHBG9e/e2kM+grq5u3QMPPHDRySefPM02AAAgfRTAAACwA1VUVBQ8/fTTpwwcOPCUTCbjGabbIJfLxauvvhpPPvlkLFy40EIgz2UymRgwYEAcccQRMWjQIAvZ9n+3Ns6fP/+Www8//JaNGzc22ggAAKTHlgrgwsqB0fWjvtBYFVGzwuvKAABgS0488cR2EyZMuLx79+5fzmQyGRvZOo2NjTFr1qy49dZb48knn4wPPvC0UuC/rV69OmbMmBFz5syJ0tLS6NSpU/jX7NbJZDKZ9u3bD/3+978/dPny5TNfffXValsBAIB0KOtcHwXlH/O9gDuAAQBg29x66637H3vssRcWFRW1sI2tU1NTE0899VQ8++yzsWHDBgsBPlGLFi3i4IMPjsMPPzxKS/28YmvV19d/OG7cuPNPPvnk6bYBAADJ5xHQAACwHWWz2cyzzz77rSFDhvzAI5+3zqZNm2Ly5Mnx1FNPKX6BbdKiRYs47LDD4pBDDlEEb6VcLtfwyiuvXHfooYfeWVdX5yXrAACQYApgAADYTo455pjW11133cWVlZV728ant2HDhnj88cdjypQpUVtbayHAZ1ZcXBwHHnhgfPGLX4wWLTyIYWusWbNm2re//e3zn3nmGb+JAwAACeUdwAAAsB1cfvnlu1900UW/LS8v72cbn05VVVVMmDAhbrnllnjzzTejoaHBUoDtoqGhIZYsWRLPPfdc1NTURI8ePSKb9XOMT6OsrKzb17/+9SPbtm0774knnlhtIwAAkMDreu8ABgCAz+bhhx/+8qGHHnpOQUFBsW18sk2bNsUzzzwTTzzxRFRVVVkIsMOVl5fHkUceGYccckgUF/tX9afR2Ni46emnn/71Mccc87htAABAsngENAAAbKN27doVTZ48+YxevXodZxufrK6uLp5++umYOHGi4hfYJSoqKuKLX/xiHHzwwe4I/pQWLVr0x4MOOuiadevWeUwDAAAkhEdAAwDANjj22GPbPvzww7/p2LHjobaxZXV1dfHkk0/GddddF3Pnzo26ujpLAXaJzZs3x2uvvRbPPfdcRET06NEjCgsLLWYLWrduvfv3vve9fd9+++1pCxYsqLYRAABo+rb0CGgFMAAAfITLL7989wsuuOB3zZs372UbH6+xsTGmTJkS119/fbzyyiuKX6DJ2Lx5cyxYsCCmT58excXF0a1bt8hkMhbzMUpKSjp8+ctfPrJt27ZzvBcYAACaPu8ABgCArTB+/Pgjv/CFL/xLQUFBiW18vAULFsT48eNj6dKllgE0eT169IivfOUrMWjQIMvYgsbGxpqJEydecuyxxz5pGwAA0HR5BzAAAHwK7dq1K3ruued+1qNHj6/axsdbtGhR3H///bF48WLLABKnV69ecdxxx0WfPn0sYwuWLl3654MOOujy1atX19sGAAA0Pd4BDAAAn2DYsGHNn3766V936tTpC7bx0TZs2BD33Xdf/PGPf4y1a9daCJBI69evj2nTpsW6deuiZ8+eUVLiYQ8fpbKysv+3v/3t/lOmTJmyfPlyz/cHAIAmxjuAAQBgC372s5/1uP76669t0aKF54J+hJqamhg/fnzcfPPN8fbbb0cul7MUINFyuVy888478cwzz0RVVVX07t07slk/A/lHZWVl3U488cTD6+rqZkyfPv1DGwEAgCZ0va4ABgCAj3bFFVfscdZZZ11dXFzcwTb+Xi6XixkzZsR1110XCxYsiMbGRksBUqWxsTGWLFkSM2bMiPLy8ujSpUtkMhmL+RvZbLbFQQcddHibNm1mP/HEE6ttBAAAmoYtFcDeAQwAQN6aNGnSqAMOOODsTCZTaBt/b9GiRXHPPffEu+++axlA3ujWrVucdNJJ0bt3b8v4B7lcrm7y5Mm//vKXv/yIbQAAwK63pXcAK4ABAMg7paWlBTNnzjyzT58+x9vG39uwYUOMGzcuZsyY4VHPQF7KZDKx3377xde//vWoqKiwkH+waNGiP+27775X1dTUeCwEAADsQgpgAAD4H926dctOnjz5V506dRppG/9fLpeLqVOnxp///OfYuHGjhQB5r6KiIkaNGhX777+/x0L/g+XLlz9+6KGHXvLuu+/W2QYAAOwaWyqAvQMYAIC8MXz48PInnnjiynbt2o2wjf/vnXfeiWuvvTaee+652Lx5s4UARMTmzZtjzpw58dprr0XPnj2jRYsWlvI/Kioq+n7rW98aMnXq1Ofee+89f3AAAMAusKV3ACuAAQDIC9/+9rc73n777X9o0aLFANv4b1VVVXHXXXfFvffeG+vXr7cQgI+wbt26eP7552P9+vWx2267RVFRkaVERElJSefjjjvuoA8++GDKK6+88hcbAQCAnUsBDABAXjv//PP7XXzxxX8oKSnpbBv/bfr06XHttdfGokWLLAPgU3jnnXdi2rRp0bp16+jc2R8nERHZbLbyC1/4whElJSUvTp48eY2NAADAzqMABgAgb/3ud7/b60c/+tFVRUVFrWwjYs2aNXHzzTfHpEmTora21kIAtkJtbW289NJL8c4770Tfvn2jtLQ073dSWFhYNnz48C/26dNn4UMPPbTMpwQAAHYOBTAAAHnp1ltv3f+b3/zmfxYWFjbP913kcrl4/vnn4/rrr4/ly5f7cAB8BitXroxp06ZFRUVFdOvWLTKZTF7vo6CgIDto0KBDBw0atOiBBx54xycEAAB2vC0VwJmex8Z+H/WF+pURa17ym6wAACTTww8//KXDDjvsXzKZTN6/rPGDDz6I22+/Pd544w0fDIDtbMCAAfGtb30r2rRpk/e7yOVyjVOmTPn1yJEjH/LJAACAHavN3jVR1OGjv6YABgAgdV555ZXTPve5z30r3/fQ0NAQjz32WDz++ONRV1fngwGwg2Sz2Tj66KPjC1/4QhQUFOT9Pl5//fU79tprr9/7ZAAAwI6jAAYAIC9ks9nMyy+/fFafPn2Oz/ddvPvuu3HbbbfFe++954MBsJN069YtvvOd70S3bt3yfhdLliy5f5999rmypqam0ScDAAC2PwUwAACpV1paWjBr1qyzevfufVw+7yGXy8WTTz4ZDz74oLt+AXaBbDYbxxxzTBxxxBF5fzfw0qVLHxg6dOjlSmAAANj+FMAAAKRar169mk2ePHlsu3btDsrnPaxcuTJuueWWePvtt30oAHaxnj17ximnnBIdOnTI6z2sXr16yiGHHPIvS5Ys2exTAQAA28+WCuDCyoHR9aO+0FgVUbMia3sAADRpQ4cOLXvqqacub9Omzf75uoNcLhfPPPNMXH/99bF27VofCoAmYP369TFlypQoKSmJnj17RiaTycs9NG/evPtJJ500ZPLkyc+sWLHCoykAAGA7KetcHwXlH/01BTAAAIk1ZMiQ0kceeeSKVq1a7Z2vO6iuro7bb789nnjiiWhs9IRNgKaksbEx5s+fH++//34MGDAgstn8/DlLaWlpp6997WuDn3rqqadXrlxZ75MBAACfnQIYAIDUOfTQQ1s8+OCDv2/ZsuUe+bqDOXPmxNVXX+2RzwBN3PLly+OFF16Ijh075u0joUtLSzudcMIJ+7/00ktPv/3227U+FQAA8NkogAEASJVhw4Y1v++++37TsmXLQfl4/vr6+hg/fnz88Y9/jNpaP0MHSILNmzfHiy++GJs3b47ddtstCgoK8m4HxcXFbY866qg9n3vuuaeXL1/ucdAAAPAZKIABAEiNI488snLcuHG/b9GixcB8PP97770XV111VcyZM8eHASCBFi1aFC+//HL069cvWrRokXfnLykp6XDcccftP2fOnGcWLVq0yScCAAC2jQIYAIBUOPLIIyvvvPPO35aXl++Wj+d/+umn48Ybb4wPP/zQhwEgwf7yl7/ECy+8ECUlJdGrV6+8O3+zZs3aHHXUUfspgQEAYNspgAEASLxjjz227W233faH5s2b98m3s1dVVcXNN98cTz31VDQ2NvowAKRAY2NjzJ8/P5YtWxYDBgyIZs2a5dX5mzVr1uaYY4458M0333xm4cKFNT4RAACwdRTAAAAk2qGHHtritttuuzofy9+33347rrnmmli8eLEPAkAKvf/++/HKK69Enz59orKyMq/Ons1mK4888sh9Zs6c+dTSpUs3+zQAAMCnpwAGACCxjjjiiJb33nvvteXl5f3y6dy5XC4mTZoUN998c1RVVfkgAKRYVVVVTJ06NbLZbPTp0ycymUzenL24uLjtV7/61c+/8sorTy1evLjWpwEAAD4dBTAAAIl06KGHtrj33nt/l2/lb3V1ddx0000xefLkyOVyPggAeSCXy8WCBQvi3Xffjd133z2y2fz5mUyzZs1aH3300fvNmDHjSXcCAwDAp6MABgAgcYYOHVo2fvz4qysqKgbk07mXLVsWV111lUc+A+SplStXxiuvvBKf+9znoqKiIm/O3axZszZHH3300GeeeebJFStW1PkkAADAlimAAQBIlCFDhpQ++uij17Rs2XL3fDr31KlT49prr42NGzf6EADksaqqqpg+fXq0bds2unTpkjfnLikpaT9q1KihTz755JMrV66s90kAAICPt6UCuMB6AABoSjp16pSdMGHCv1dWVu6RL2dubGyMcePGxR133BF1dW56AiCitrY2br755hg/fnw0NjbmzbkrKyv3mDBhwr9369bNXQkAALCNFMAAADQZrVq1Kpw+ffolbdq02T9fzlxdXR2/+93vYtKkSd73C8DfyeVy8fjjj8fvf//7qK6uzptzt2nTZv8pU6Zc0qpVq0KfAgAA2HoKYAAAmoSKioqC2bNnX9KuXbuD8uXMS5cujYsuuijmz5/vAwDAx3r11VfjoosuiqVLl+bNmdu1a3fQ7Nmz/72iosLPrgAAYCu5iAYAoEmYOXPmz9q1a3dIvpz35ZdfjiuuuCLWrVsnfAA+0bp16+KKK66Il19+OW/O3K5du4Nnzpz5M+kDAMDWUQADALDLvfjii2N69OgxKh/Omsvl4oEHHogbbrghamtrhQ/Ap1ZbWxs33HBDPPDAA3nz2oAePXqMevHFF8dIHwAAPj0FMAAAu9SkSZO+NnDgwFPy4ax1dXVx8803x8SJE73vF4BtksvlYuLEiXHLLbdEXV1dXpx54MCBJ0+aNOlr0gcAgE9HAQwAwC7z6KOPHnXggQeekw9nXbduXfz617+OWbNmCR6Az2zmzJnx61//Ol9eJZA58MADz3n00UePkjwAAHyywsqB0fWjvtBYFVGzImtDAADsEDfeeOO+Rx999EWZTKYw7Wddvnx5XHXVVbFy5UrBA7DdbNiwIWbPnh0DBw6MioqKtB8307179/179uz56sMPP7xc+gAA5LuyzvVRUP7RX1MAAwCw011xxRV7fPe7372qoKCgWdrPOmfOnPjtb38bGzduFDwA2111dXVMmzYtOnfuHB07dkz1WTOZTOHuu+9+eJs2bV6aNGnSKukDAJDPFMAAADQZZ5xxRvef/exnvy0sLCxP+1knTJgQd999d9TX1wsegB2moaEhXnrppchms9G3b99UnzWTyRTttddeB/3lL395dubMmRukDwBAvlIAAwDQJBx00EEVf/jDH64pLi7ulOZz5nK5eOCBB+Kxxx4TOgA77c+eBQsWRF1dXfTv3z8ymUxqz1pQUFBywAEHDJs+ffqkpUuXbpY+AAD5aEsFcIH1AACwMwwaNKj0vvvuu7qsrKxXms9ZV1cX1113XUyaNEnoAOx0EydOjOuvvz7q6upSfc6ysrJef/rTn67u379/idQBAODvKYABANjhKioqCh577LGLKyoqBqb5nNXV1XHNNdfE7NmzhQ7ALvPKK6/ElVdeGVVVVak+Z4sWLQZOnDhxbEVFhZ9vAQDA33CBDADADjdz5syftW3b9sA0n3HdunVx2WWXxRtvvCFwAHa5xYsXx2WXXRZr165N9TnbtWt34MyZM38mcQAA+P8UwAAA7FBPPvnkqB49eoxK8xlXrVoVV1xxRSxfvlzgADQZK1asiCuuuCJWrlyZ6nP26NFj1KRJk0ZJHAAA/lth5cDo+lFfaKyKqFmRtSEAALbZjTfeuO+XvvSlCzOZTGp/8fDdd9+NK6+8MtatWydwAJqc6urqmDVrVvTv3z8qKytTe85u3boN79mz57yHH37Yb2MBAJAXyjrXR0H5R39NAQwAwA5x3nnn9T311FOvLigoKE7rGV977bW45pprorq6WuAANFmbN2+OGTNmRI8ePaJ9+/apPGMmkykYNGjQIYWFhVOee+45v5UFAEDqKYABANipjjrqqFb/8R//8YdmzZq1SusZX3755bj++uujrq5O4AA0eQ0NDfHSSy9Fp06dolOnTqk8Y0FBQXbYsGGfnz9//qQ33nhjk9QBAEizLRXA3gEMAMB21a1bt+wNN9zwnyUlJR3TesYpU6bEjTfeGPX19QIHIDHq6+vjxhtvjKlTp6b2jCUlJZ1uuOGG/+jWrZu7GgAAyFsKYAAAtqunn376XyorK/dI6/kmTZoUd955ZzQ2NgobgMRpbGyMO+64I5588snUnrGysnLw008//UtpAwCQrxTAAABsN88///w3unTp8k9pPd/EiRNj3LhxkcvlhA1AYuVyubj//vtTXQJ36dLlS88+++yJ0gYAIB95BzAAANvFTTfdNPzII488L5PJZNJ4vsceeyzGjx8vaABS47XXXotmzZpF3759U3m+zp0779urV695Dz/88DJpAwCQNlt6B7ACGACAz+wXv/hF7x/+8IdXFxQUNEvj+R544IF45JFHBA1A6ixYsCDq6upiwIABqTtbJpPJDBo06ODGxsbnpk6dul7aAACkiQIYAIAd5oADDqj43e9+99tmzZq1TeP5xo0bF5MmTRI0AKm1aNGi2Lx5cwwcODB1ZysoKMjut99+w5577rnH33vvvc3SBgAgLbZUAHsHMAAA2yybzWbuvPPOfyktLe2exvNNmDBB+QtAXpg0aVI89NBDqTxbaWlpj3vuuedfstlsRtIAAOQDBTAAANvs+eef/06HDh0OTePZHn744Xj44YeFDEDeeOSRR+LPf/5zKs/WoUOHw5599tlvSxkAgHygAAYAYJvcd999hw8ePPjUNJ7t/vvvjwkTJggZgLzz2GOPxX333ZfKs+25554/+NOf/nSYlAEASDvvAAYAYKudccYZ3ceMGXN5QUFBcdrONnHixHjkkUeEDEDeWrx4cWSz2ejbt2/ajpbp06fPvn/5y18mz5w5c4OkAQBIsi29A1gBDADAVhk2bFjzG2+88Q/NmjVrl7azPfroo6l99CUAbI2FCxdGUVFR9OvXL1XnKigoKD7wwAP3e/LJJx9dsWJFnaQBAEiqLRXAHgENAMBWuffee39ZWlraPW3nevzxx+PBBx8UMAD8jz//+c8xceLE1J2rtLS0x3333fdLCQMAkFYKYAAAPrVJkyaN6tSp0xEpPFeMHz9ewADwD8aPHx+TJ09O3bk6der0hUmTJn1VwgAApJFHQAMA8Kmcd955fU888cR/z2QyRWk618yZM+Puu+8WMAB8jNdeey06duwYnTt3TtW5unbtuk9BQcHzzz333DopAwCQNN4BDADAZ3LEEUe0vOKKK67NZrOVaTrXyy+/HDfffHPkcjkhA8DHyOVyMXv27OjSpUt06tQpNefKZDJF++yzz/CpU6c+9u67726WNAAASeIdwAAAbLNsNpu55ZZb/q2kpKRjms61YMGCuPnmm6OxsVHIAPAJGhsb4+abb44333wzVecqLS3tcvfdd5+fzWYzUgYAIC0UwAAAbNGkSZO+3rZt2wPTdKZly5bFDTfcEPX19QIGgE+prq4urr322li+fHmqztWuXbsDH3/88VESBgAgLTwCGgCAj3XZZZcN+upXvzo2k8mk5hcH33///bjyyiujqqpKwACwlerq6uLll1+OIUOGRHl5eWrO1aVLl31LS0unPvPMM2ukDABAEngENAAAW61///4lJ5988q8ymUxRWs60YcOG+P3vfx8bN24UMABso40bN8bvfve7VP15WlBQkP3hD394ft++fYslDABA4q9vrQAAgI/y4IMPnl1WVtYrLeeprq6O3/zmN7Fq1SrhAsBntGrVqrjyyiujuro6NWcqKyvr8/DDD58lXQAAkk4BDADA/zF+/Pgju3XrdnRazlNfX5/KdxYCwK60fPnyuO6666K+vj41Z+rRo8dXx40bd4R0AQBIMgUwAAB/53vf+16nI4444py0nCeXy8Vtt90Wb7zxhnABYDt7/fXX47bbbotcLpeaMx155JHnfvvb3+4oXQAAkkoBDADA/6qoqCi4+OKLLywsLCxPy5nGjx8fs2bNEi4A7CCzZs2Khx56KDXnKSwsrPj1r399QUVFhZ+bAQCQSC5kAQD4XxMnThxdWVk5OC3nef7552PixImCBYAd7LHHHosXXnghNeeprKzc89FHHz1RsgAAJFFh5cDo+lFfaKyKqFmRtSEAgDxxwQUX7DZq1KgLM5lMYRrO8+qrr8Ytt9ySqkdSAkBT/7O3d+/e0a5du1Scp2PHjkNzudxzU6ZMWSddAACamrLO9VHwMc/wcwcwAADRt2/f4h//+McXZzKZVPwG4HvvvRc33HBDNDY2ChcAdpKGhoa47rrrYtmyZak4T0FBQfbss88e27dv32LpAgCQqGtZKwAAYPz48T8qKyvrkYazbNiwIX7/+99HbW2tYAFgJ9u0aVP8/ve/j40bN6biPGVlZb3GjRs3RrIAACSJAhgAIM/ddNNNw/v06XN8Gs5SX18f1157baxdu1awALCLrFmzJq699tqor69PxXn69ev3jd///vdDJQsAQFIogAEA8thBBx1Uceyxx/5rRGTScJ477rgjFi9eLFgA2MUWLVoUd955Z1qOU/CNb3zj34YNG9ZcsgAAJOIC1goAAPLXzTfffFZxcXG7NJxl4sSJMX36dKECQBMxbdq0mDRpUirOUlJS0unOO+88Q6oAACSBAhgAIE/913/914FdunT5UhrO8tprr8Wf//xnoQJAEzN+/PhYsGBBKs7SrVu3o2+66abhUgUAoKlTAAMA5KEvfelLlV/5yld+lYazrFixIq6//vpobGwULAA0MY2NjXHdddfFihUr0nCczHHHHfergw46qEKyAAA0ZQpgAIA8dPXVV5+ezWYrk36OmpqauPbaa2PTpk1CBYAmatOmTXHttddGTU1N4s+SzWbb3njjjT+RKgAATZkCGAAgz9x6663Du3Tp8uWknyOXy8Utt9wSK1euFCoANHErV66MW2+9NXK5XOLP4lHQAAA0dQpgAIA8MnTo0LKvfvWrv0jDWSZMmBBz584VKgAkxJw5c+Kxxx5LxVlGjRr1i6FDh5ZJFQCApkgBDACQR+64444fFRcXd0z6OV5++eV45JFHBAoACfPQQw+l4he4SkpKOt5xxx0/lCgAAE2RAhgAIE9cfvnlu/fs2XNU0s/xwQcfxB133JGKR0gCQL7J5XJx2223xZo1axJ/lp49ex57+eWX7y5VAACaGgUwAEAe6NatW/a73/3uv2YymURf/9XX18cNN9wQ1dXVQgWAhKqqqoobb7wx6uvrE32OTCZT8N3vfvdX3bp1y0oVAICmRAEMAJAHxo8ff0pZWVmvpJ/jnnvuiaVLlwoUABJuyZIlcd999yX+HGVlZT3Hjx9/ikQBAGhKFMAAACn385//vOeAAQNGJ/0c06dPjylTpggUAFJi8uTJMWPGjMSfY8CAAaN//vOf95QoAABNhQIYACDFstls5qyzzjo3k8kk+tGEK1asiLvvvlugAJAyd911V6xYsSLRZ8hkMtmzzjrr3Gw2m5EoAABNgQIYACDFxo0b98XKysq9knyG2trauOGGG6K2tlagAJAyf/1zfvPmzYk+R2Vl5V7jxo0bKVEAAJoCBTAAQEoNHz68/OCDDz4t6ee4//77Y/ny5QIFgJRavnx5jBs3LvHnGDFixI+HDRvWXKIAAOxqCmAAgJS69dZbT8tms22TfIYZM2bEc889J0wASLnJkyfHzJkzE32G4uLitrfffvtp0gQAYFdTAAMApNBVV121R48ePb6S5DOsXLky7rrrLmECQJ64++6744MPPkj0GXr27PnVK664Yg9pAgCwKymAAQBSprS0tOAb3/jGT5N8rdfY2Bi333679/4CQB6pqamJ2267LRobG5N8jIJvfvObZ5aWlvqZGwAAu+6i1AoAANJlwoQJX6uoqBiQ5DOMHz8+Fi1aJEwAyDNvvvlmPPjgg4k+Q4sWLQY9+OCDx0gTAIBdRQEMAJAiRx55ZOWwYcN+kOQzzJ07N5544glhAkCemjhxYixYsCDRZxg+fPiPjjjiiJbSBABgV1AAAwCkyBVXXHFyUVFRRVLnr6qqijvvvDNyuZwwASBP5XK5uP3226O6ujqxZygqKmrxm9/85mRpAgCwKyiAAQBS4vzzz+/Xu3fv45J8httvvz0+/PBDYQJAnlu3bl3cfvvtiT5D7969jz///PP7SRMAgJ1NAQwAkALZbDZz6qmn/jyTyST2+m769OkxZ84cYQIAERExe/bsmDFjRmLnz2QyBaeeeurPs9lsRpoAAOxMCmAAgBT44x//eERlZeXgpM6/du3auPfeewUJAPyde+65J9atW5fY+SsrKwf/6U9/+oIkAQDYmRTAAAAJ17dv3+JDDjnkR0k+w9133x01NTXCBAD+Tk1NTdx9992JPsPBBx/8o759+xZLEwCAnUUBDACQcHfdddc3S0pKOiV1/smTJ8e8efMECQB8pLlz58azzz6b2PlLSko63nPPPd+SJAAAO4sCGAAgwb70pS9VDhw48KSkzr9mzZoYP368IAGALXrggQdizZo1iZ2/f//+Jx111FGtJAkAwM6gAAYASLArrrji1MLCwvIkzp7L5eK2226LTZs2CRIA2KJNmzbFbbfdFrlcLpHzFxYWll1++eU/kCQAADuDAhgAIKF+8Ytf9O7evftXkjr/s88+G2+88YYgAYBP5Y033ojnn38+sfN369bt6F/96ld9JAkAwI6mAAYASKgf/vCHP8pkMom8nvvggw/igQceECIAsFXGjRsX69atS+TsmUym4NRTT/2xFAEA2NEUwAAACXTdddcNa9eu3YFJnD2Xy8Udd9wRtbW1ggQAtsqmTZvizjvvTOz8bdq02f+mm27aT5IAAOxICmAAgIQpLS0t+NrXvnZ6Uud/4YUXYuHChYIEALbJq6++GjNmzEjs/Mccc8zpFRUVfiYHAMAO42ITACBhbr/99oMrKip2S+LsGzZsiHHjxgkRAPhM7r///qiqqkrk7OXl5X3/67/+6wgpAgCwoyiAAQASpKKiouCwww47Nanz33vvvYn9YS0A0HRs2LAh7r///sTOf9BBB/1zq1atCiUJAMCOoAAGAEiQ+++//+iysrKeSZx9zpw58dJLLwkRANguXnjhhViwYEEiZy8tLe32xz/+8StSBABgR1AAAwAkRN++fYv33Xfff07i7LW1tXHvvfcKEQDYru6+++6oq6tL5Oz77bffKf379y+RIgAA25sCGAAgIW6++eZRxcXFbZM4+yOPPBJr164VIgCwXa1atSoee+yxRM6ezWbb3njjjV+TIgAA25sCGAAgAYYOHVq21157fSeJs7/33nvxxBNPCBEA2CEmTpwYK1asSOTsQ4YM+c7QoUPLpAgAwPakAAYASIBrr732xKKiosqkzZ3L5eKee+6JxsZGIQIAO0R9fX3cddddkcvlEjd7UVFR5bXXXnuCFAEA2J4UwAAATdwBBxxQMWDAgG8kcfYZM2bEW2+9JUQAYId6880348UXX0zk7AMGDPjG8OHDy6UIAMD2ogAGAGjirrrqqhOKiooqkjb3pk2b4oEHHhAgALBT3H///VFbW5u4uYuKilpcffXV7gIGAGC7UQADADRhBx10UEX//v0Teffvww8/HB9++KEQAYCdYv369TFhwoREzj5w4MBvHHDAARVSBABge1AAAwA0Yf/5n/95bGFhYfOkzb1q1aqYPHmyAAGAnerpp5+O1atXJ27uwsLC8ssuu2yUBAEA2B4UwAAATdQBBxxQMWjQoNFJnP3uu++O+vp6IQIAO1V9fX3cddddiZx99913/+bQoUPLpAgAwGelAAYAaKIuv/zyYwsLC8uTNvfcuXNjwYIFAgQAdokFCxbE3LlzEzd3UVFRi9/97ndflyAAAJ+VAhgAoAkaOnRo2aBBgxL37t+6urr405/+JEAAYJf605/+FHV1dYmbe/fdd//mkCFDSiUIAMBnoQAGAGiCfvOb33ylqKioZdLmfu655xL53j0AIF1Wr14dzz33XOLmLioqann11VcfLUEAAD4LBTAAQBPTq1evZoMHD/5m0uaurq6ORx55RIAAQJPwyCOPRHV1deLmHjJkyLe6deuWlSAAANtKAQwA0MTcdNNNxxQXF7dN2twTJkyIqqoqAQIATUJVVVUifzmtuLi43a233uouYAAAtpkCGACgCWnVqlXhXnvtdVLS5l61alU8++yzAgQAmpTJkyfHqlWrEjf30KFDR7dq1apQggAAbAsFMABAE3LLLbccXlJS0jlpcz/44INRX18vQACgSamvr48HH3wwcXOXlJR0vummmw6VIAAA20IBDADQRGSz2cwBBxzw7aTNvWjRonjppZcECAA0SS+99FIsXrw4cXOPGDHiO9lsNiNBAAC2lgIYAKCJuOaaa/YuLy/vm7S5H3roocjlcgIEAJqkXC6XyLuAy8vL+1111VV7SRAAgK2lAAYAaCK+8pWvfDdpM8+bNy8WLlwoPACgSVu4cGG8+uqrrg8BAMgLCmAAgCbgsssuG1RZWblPkmbO5XIxfvx44QEAifDAAw8k7qklrVu33veSSy7pLz0AALaGAhgAoAkYNWrUCUmbefbs2bFs2TLhAQCJsGzZsnjllVcSN/cJJ5xwovQAANgaCmAAgF3sn//5nzt37NjxiCTN3NjYGA888IDwAIBEGT9+fDQ0NCRq5k6dOn1h9OjRHaQHAMCnpQAGANjFfvSjH30tk8kk6rps2rRpsWrVKuEBAImyatWqeOGFFxI1cyaTKfzpT386SnoAAHxaCmAAgF1o0KBBpX369Plqkmaur6+PCRMmCA8ASKQJEyZEXV1dombu27fvV/r27VssPQAAPg0FMADALnTZZZcdXlRUVJGkmadOnRpr164VHgCQSOvXr48pU6YkauaioqLK3/zmN0dIDwCAT0MBDACwi2Sz2cy+++57UpJmrqurc/cvAJB4jz76aOLuAt5///1PymazGekBAPBJFMAAALvI1VdfPbSsrKx3kmaeMmVKbNiwQXgAQKJt2LAhnn/++UTNXFZW1ueqq67aS3oAAHwSBTAAwC7y5S9/+bgkzVtfXx8TJ04UHACQCo8//nji7gL+0pe+dLzkAAD4JApgAIBdYPTo0R3atm07IkkzT5s2LdatWyc8ACAVPvzww5g+fXqiZm7fvv2I0aNHd5AeAABbogAGANgFfvrTn47KZDKFSZm3vr4+HnnkEcEBAKnyyCOPRH19fWLmzWQyhT/96U+/JjkAALZEAQwAsJN16tQp26dPn6OTNLO7fwGANFq3bl1MmzYtUTP36dPnmE6dOmWlBwDAx1EAAwDsZFddddUB2Wy2dVLmbWxsjEmTJgmOVOvYsWN06OCJmgD5aNKkSdHY2JiYebPZbOurrrrqAMkBAPBxFMAAADvZiBEjvp6keV988cVYtWqV4Ei1Ll26xIUXXhinnXZadO3a1UIA8siqVavipZdecj0JAEBqKIABAHaiM844o3tlZeXeSZk3l8vFxIkTBUdeyGQyMXjw4PjVr34VY8aMcUcwQB55/PHHI5fLJWbeysrKvc8444zukgMA4KMogAEAdqJTTjnlqxGRScq8CxYsiPfee09w5JVMJhN77713XHjhhTFmzJho3769pQCk3HvvvRcLFy5M1B9X/3NdCQAA/4cCGABgJ+nVq1ezXr16fTlJM3v3L/nsr0XwBRdcECeffHK0bdvWUgBSLGnXPb169fpyr169mkkOAIB/pAAGANhJrrjiioOLiopaJmXeBN4JAztEYWFhDB8+PC688MIYPXp0VFZWWgpACi1YsCCWLVuWmHmLiopaXnnllYdIDgCAf6QABgDYSYYPH/6VJM2btHfhwY5WVFQUI0aMiEsuuSRGjx4dLVu2tBSAFMnlcvH4448naub99tvvK5IDAOAfKYABAHaC0aNHd6isrByalHnXrl0bL7/8suDgI/y1CL744ovjhBNOiBYtWlgKQEq89NJLsW7dusTMW1lZudfo0aM7SA4AgL+lAAYA2AlOP/30o5J07fXMM89EQ0OD4GALiouL47DDDouxY8fGqFGjoqyszFIAEq6hoSGeeeaZJI1c8D/XmQAA8P8vEq0AAGDHymazmX79+n05KfPW1tbGlClTBAefUnFxcYwcOTIuvfTSGDVqVJSWlloKQII9//zzUVtbm5h5+/Xr9+VsNpuRHAAAf6UABgDYwX7zm9/sWVJS0jkp886YMSOqq6sFB1uppKQkRo4cGZdcckkcffTRUVJSYikACVRdXR0zZ85M0p8/na+44orBkgMA4K8UwAAAO9gXvvCFLyVl1lwuF08//bTQ4DNo3rx5HHXUUXHJJZfEyJEjI5vNWgpAwjz11FORy+USM++RRx75ZakBAPBXCmAAgB1oyJAhpZ07dz4iKfO+/vrrsWLFCsHBdlBeXh6jRo2KSy+9VBEMkDArVqyI119/PTHzdunS5fD+/ft79AQAABGhAAYA2KHGjh17aGFhYWJeCOruX9j+KioqYtSoUXHxxRfH4YcfHkVFRZYC4LpouyosLGz+H//xHwdLDQCACAUwAMAOteeeex6ZlFnXrl0b8+bNExrsIK1atYrjjz8+LrroohgxYkQUFPh2DKApmzdvXqxZsyYx8+61115HSg0AgAgFMADADnPMMce0bt269b5Jmfe5556LxsZGwcEO1qZNmxg9enRcfPHFimCAJqyxsTGee+65JP35MvyYY45pLTkAAPykAQBgBznzzDMPz2Qyibjeqq+vj6lTpwoNdqK2bdvG6NGj47zzzovhw4crggGaoBdeeCHq6+sTMWsmkyk844wzDpUaAAB+wgAAsIP079//C0mZdc6cObFhwwahwS7QqVOnOPnkk+Pf/u3fYu+9945MJmMpAE3Ehg0bYvbs2YmZd8CAAR4DDQCAAhgAYEf43ve+16mysnKPpMybpMcbQlp17tw5xowZE7/61a8UwQBNyPPPP5+YWSsrKwd/73vf6yQ1AID8pgAGANgBTj755CMiIhHtzcqVK+P1118XGjQRXbt2jTFjxsQ555wTgwcPthCAXez111+PlStXJmXczMknn3y41AAA8psCGABgB+jXr19iHv88ZcqUyOVyQoMmpnfv3nHaaafFOeecE/3797cQgF0kl8vFlClTknQd6jHQAAB5TgEMALCdnX766d0qKip2S8Ks9fX1MW3aNKFBE9anT58466yz4pxzzonddtvNQgB2gWnTpkV9fX0iZq2oqNjt9NNP7yY1AID8pQAGANjORo8efURSZp03b15s3LhRaJAAffr0ibPPPjvOPPPM6Nmzp4UA7EQbN26MefPmuR4FACARFMAAANtZr169EvPetSQ9zhD4bwMGDIhf/vKXceaZZ0b37t0tBGAnmTp1apKuRw+TGABA/lIAAwBsR2eccUb38vLyvkmYdf369fHaa68JDRJqwIAB8S//8i9x2mmnRbdunvQJsKPNnz8/Pvzww0TMWl5e3u9HP/pRF6kBAOQnBTAAwHZ03HHHHZSUWWfMmBGNjY1CgwTLZDIxePDg+Nd//dcYM2ZMdOjQwVIAdpDGxsaYMWNGYub9xje+cYjUAADykwIYAGA76tOnz8FJmDOXyyXqMYbAlmUymdh7773jwgsvjDFjxkT79u0tBWAHeOGFF5J0XXqIxAAA8pMCGABgOznppJPat2zZcvckzLpkyZJYuXKl0CBl/loEX3DBBXHyySdH27ZtLQVgO1qxYkW8/fbbiZi1srJy0PHHH+8PAgCAPKQABgDYTr773e8eGBGZJMyapMcXAluvsLAwhg8fHhdeeGGMHj06KisrLQVgO5k+fXpSRi34/ve/f6DEAADyjwIYAGA72X333Q9Nwpz19fUxc+ZMgUEeKCoqihEjRsQll1wSo0ePjpYtW1oKwGc0c+bMqK+vT8SsAwcOPFRiAAD5RwEMALAdHHTQQRUtW7bcKwmzLly4MKqrq4UGeeSvRfDFF18cJ5xwQrRo0cJSALZRVVVVvP7664mYtVWrVkOHDx9eLjUAgPyiAAYA2A7OPvvsz2cymaIkzOrxz5C/iouL47DDDouxY8fGqFGjoqyszFIAtkFSnqaSyWSy55577uclBgCQXxTAAADbwe67735AEuasra2NOXPmCAzyXHFxcYwcOTIuvfRSRTDANpg9e3bU1dUlYtY99tjjAIkBAOQXBTAAwGfUqlWrwnbt2u2fhFnnzZsXtbW1QgMiIqKkpCRGjhwZY8eOjaOPPjpKSkosBeBT2LRpU8ybNy8Rs7Zv337/iooKPwMEAMgjLv4AAD6jCy+8cPeioqKKJMz64osvCgz4P5o3bx5HHXVUXHLJJTFy5MjIZrOWAvAJZs2alYg5i4qKWlx88cWDJAYAkD8UwAAAn9GBBx6YiMfqVVdXJ+ZOFWDXKC8vj1GjRsWll16qCAb4BPPmzYuamppEzHrQQQd5DDQAQB5RAAMAfEZdu3YdnoQ5582bF/X19QIDPlFFRUWMGjUqLr744jj88MOjqKjIUgD+QV1dXbz66quJmLVLly77SwwAIH8ogAEAPoNTTjmlY3l5+W5JmPXll18WGLBVWrVqFccff3xcdNFFMWLEiCgo8C0kwN966aWXEjFnRUXFbieddFJ7iQEA5AffvQMAfAYnnnji55MwZ21tbcyfP19gwDZp06ZNjB49OsaOHasIBvgb8+fPj9ra2iSMmvnud7/7eYkBAOQH37UDAHwGn/vc5/ZLwpwLFy6Muro6gQGfyV+L4PPOOy+GDx+uCAby3ubNm2PhwoWJmLVfv37DJQYAkB98tw4AsI1atWpV2Lp1672TMKvHPwPbU6dOneLkk0+Oc889NwYNGmQhQF6bPXt2IuZs06bN3hUVFX4WCACQB1z0AQBso/PPP39gYWFheVOfs76+PubMmSMwYLvr2bNn/OQnP4nzzjsv9t5778hkMpYC5J3Zs2dHfX19k5+zqKio4vzzzx8oMQCA9FMAAwBso/3333/fJMz5+uuvR01NjcCAHaZLly4xZsyYOOecc2Lw4MEWAuSV6urqeOONNxIx64EHHriPxAAA0k8BDACwjbp27ZqIxz/PnTtXWMBO0bt37zjttNPinHPOif79+1sIkDeScr3VvXv3vaUFAJB+CmAAgG0wZMiQ0srKyj2a+py5XM7jn4Gdrk+fPnHWWWfFOeecE7vttpuFAKk3e/bsyOVyTX7Oli1b7jlo0KBSiQEApJsCGABgG5x55pl7ZjKZbFOfc9myZbFu3TqBAbtEnz594uyzz44zzzwzevbsaSFAaq1bty6WL1/e5OfMZDLZs846a4jEAADSrcgKAAC23tChQ4clYc558+YJC9jlBgwYEAMGDIgFCxbE+PHjY+nSpZYCpM68efOiS5cuTX7OffbZZ5+ImC4xAID0cgcwAMA26Nix4z5JmHP+/PnCApqMAQMGxC9/+cs47bTTolu3bhYCpEpSrrs6deq0j7QAANJNAQwAsJWOOOKIlhUVFf2a+pxVVVWxaNEigQFNSiaTicGDB8e//uu/xpgxY6JDhw6WAqTCW2+9FVVVVU1+zoqKis8deuihLSQGAJBeCmAAgK108sknD46ITFOfc/78+dHY2CgwoEnKZDKx9957x4UXXhhjxoyJ9u3bWwqQaI2NjbFgwYJE/Cv4u9/97h4SAwBILwUwAMBW2n333fdMwpze/wskwV+L4AsuuCBOPvnkaNu2raUAiZWU66/BgwfvKS0AgPQqsgIAgK3Trl27wU19xlwul5Q7UAAiIqKwsDCGDx8e++yzT0ybNi0mTJgQ69evtxggURYsWBC5XC4ymab9sJgOHToMlhYAQHq5AxgAYCsMGjSotGXLlgOa+pzvvfdebNy4UWBA4hQVFcWIESPikksuidGjR0fLli0tBUiMDz/8MJYtW9bk52zZsuXA/v37l0gMACCdFMAAAFvhxz/+8aBMJtPkn6Li7l8g6f5aBI8dOzZOOOGEaNGihaUAibBw4cImP2Mmk8n+5Cc/GSAtAIB0UgADAGyFvffee88kzJmEHzwCfBrNmjWLww47LMaOHRujRo2KsrIySwGatKT8Il5SrmsBANh63gEMALAVunbtOqSpz1hfXx9vvvmmsIBUKS4ujpEjR8bBBx8czz77bDz++ONRXV1tMUCT8+abb0Z9fX0UFTXtH7t16dJlT2kBAKSTO4ABAD6lioqKgoqKikFNfc4lS5bE5s2bBQakUklJSYwcOTLGjh0bRx99dJSUeIUl0LTU1tbG0qVLm/ycLVu2HFRaWupngwAAKeQiDwDgUzr77LP7FhYWNvlnj7722mvCAlKvefPmcdRRR8Ull1wSI0eOjGbNmlkK4HpsKxQWFpafffbZvaQFAJA+CmAAgE9p//3375+EOV9//XVhAXmjvLw8Ro0aFf/+7/8eI0eOjGw2aymA67FP6fOf//xAaQEApI8CGADgU+rRo8fuTX3G2traePvtt4UF5J2KiooYNWpUXHzxxXH44Yc3+XdvAum2ePHiRLySo1evXoOkBQCQPgpgAIBPqXXr1k3+DoklS5ZEQ0ODsIC81apVqzj++OPj4osvjhEjRkRBgW97gZ2voaEhlixZ0uTnbNOmjQIYACCFfCcMAPApDBkypLR58+a9m/qcb775prAAIqJ169YxevToGDt2rCIYcF32MZo3b95n0KBBpdICAEgX3wEDAHwKp556av9MJtPkr53eeustYQH8jTZt2sTo0aPjvPPOi+HDhyuCAddlfyOTyRT84Ac/+Jy0AADSxXe+AACfwuDBg5v84/Hq6+tj0aJFwgL4CJ06dYqTTz45/u3f/i323nvvyGQylgLsUIsXL07Eqzn23HPPgdICAEgXBTAAwKfQpUuXAU19xnfeeSfq6uqEBbAFnTt3jjFjxiiCgR2utrY23n333SRc53oPMABAyiiAAQA+hZYtW/Zv6jN6/DPAp9elS5cYM2ZMnHvuuTF48GALAfL2+iwJ17kAAGwdBTAAwCcYPnx4eUlJSeemPqfHPwNsvV69esVpp50W55xzTvTvrwMB8u/6rLS0tPPw4cPLpQUAkB4KYACAT/Ctb31rt4ho8s8IXbx4sbAAtlGfPn3irLPOinPOOSd22203CwG2i4T8gl7m29/+dj9pAQCkhwIYAOAT7L777k2+CVi7dm1s2LBBWACfUZ8+feLss8+OM888M3r27GkhwGfy4Ycfxrp165r8nAMHDlQAAwCkSJEVAABsWadOnZr8D8TefvttQQFsRwMGDIgBAwbEggULYvz48bF06VJLAbb5Oq1Vq1audwEA2GkUwAAAn6CyslIBDJCnBgwYEP3794958+bFQw89FO+++66lAFtlyZIlsddeezX1613PvgcASBEFMADAFnTq1CnbvHnzXk19ziVLlggLYAfJZDIxePDg2GOPPeLll1+OBx98MFauXGkxQGqu05o3b967Xbt2RatXr66XGABA8nkHMADAFowZM6ZnJpPJNuUZGxsbPZoUYCfIZDKx9957x4UXXhhjxoyJ9u3bWwrwiZYuXRqNjY1NesaCgoLsqaee2kNaAADp4A5gAIAt2Hvvvfs29RlXrlwZtbW1wgLYSf5aBO+5554xa9asmDBhQqxevdpigI9UW1sb77//fnTu3LlJzzls2LC+EbFIYgAAyecOYACALejRo0eTL4DfeecdQQHsAoWFhTF8+PC48MILY/To0VFZWWkpQGKv15Jw3QsAwKejAAYA2ILWrVs3+ff/vvvuu4IC2IUKCwtjxIgRcckll8To0aOjZcuWlgIk7notCde9AAB8Oh4BDQCwBc2bN+/Z1GdUAAM0kW+wi4pixIgRsd9++8WUKVPiscceiw0bNlgMEO+9914SrnsVwAAAKeEOYACAj9G/f/+SkpKSjk19TgUwQNPSrFmzOOyww2Ls2LExatSoKCsrsxTIc0m4XistLe3Ut2/fYmkBACSfAhgA4GOccMIJ3Zr69dK6deuiqqpKWABNUHFxcYwcOTJ+/etfK4Ihz1VVVcX69eub+pgF3/zmN7tLCwAg+RTAAAAfY8iQIT2b+oxJeJwgQL77axE8duzYOProo6OkpMRSIA8l4botCde/AAB8MgUwAMDH6N69e8+mPqPHPwMkR/PmzeOoo46KSy65JEaOHBnNmjWzFMgjSbhuS8L1LwAAn0wBDADwMVq1atWjqc+4bNkyQQEkTHl5eYwaNSr+/d//PUaOHBnZbNZSIA8k4botCde/AAB8MgUwAMDHqKio6NXUZ1y+fLmgAJL750yMGjUqLr744jj88MOjqKjIUiDFknDd1rJly16SAgBIPgUwAMBHyGazmbKysq5NecbGxsZYtWqVsAASrlWrVnH88cfHxRdfHCNGjIiCAt+qQxqtWrUqGhsbm/SMJSUlXbPZbEZaAADJ5rtKAICPcNxxx7UrKCgobsozrl69Ourr64UFkBKtW7eO0aNHx9ixYxXBkEJ1dXXxwQcfNOkZCwoKio877rh20gIASDbfTQIAfITPf/7zXZr6jO+//76gAFKoTZs2MXr06Dj//PNj+PDhimBIkRUrVrgOBgBgh/NdJP+PvTuPr7I888d/nSwEkhD2HUQEUVRAoIiouCtq64Jabd1arVorbqO2tlXbaavTOu38Rqffdmpbu9rWpYogsqgFRXCttAIKArJDgAAJBLKQ5JzfH8WO4+DOcp6T9/v18jWvTv657ut6hNvnk/t+AICd2G+//bL+xVcSXiAC8PF17do1Lr300rj99ttj2LBhkUq5lRWSLgn7tyTsgwEAeH8FWgAA8H917txZAAxAVujevXtceeWVsXr16njiiSdi9uzZkclkNAYSKAn7tyTsgwEAeH8CYACAnWjXrp0roAHIKj169Igrr7wyli5dGpMmTYo5c+ZoCiRMEvZvSdgHAwDw/gTAAAA7UVxc3D3baxQAAzRPffr0ibFjx8aSJUti/PjxsWDBAk2BhEjC/i0J+2AAAN6fbwADAOxESUlJz2yur7q6Ourq6gwKoBnbb7/94l/+5V/ia1/7WhxwwAEaAglQV1cX1dXV9sEAAOxWAmAAgHc5/PDDSwsKCtpmc40VFRUGBUBERPTt2zduvPHGuOGGG2LffffVEMhy2b6PKygoaDt8+PASkwIASC4BMADAu5x44oldsr3GDRs2GBQA/8uAAQPiG9/4Rtxwww3Ru3dvDQH7uE+yH+5qUgAAyeUbwAAA79KvX7+sD4DXr19vUADs1IABA+LAAw+MuXPnxoQJE2LlypWaAlkkCTe5HHDAAV0i4i3TAgBIJgEwAMC7dO/evXO21+gEMADvJ5VKxaBBg2LgwIExe/bsGD9+fKxbt05jwD4uZ/bDAAC8NwEwAMC7tG/fvlO21ygABuDDSKVSMWzYsBg6dGjMnj07HnvsMbdIwF6WhBPASdgPAwDw3gTAAADv0rp166w/8ZCEF4cAZI+3g+BDDz00XnnllZg4caK/S8A+LtH7YQAA3psAGADgXUpKSrL6xENjY2Ns3rzZoAD4yPLz8+Pwww+P4cOHx/PPPx8TJ06MqqoqjYE9aPPmzdHY2BgFBdn7Wi7b98MAALw/ATAAwLu0bNmySzbXV1lZGZlMxqAA+Njy8/Nj1KhRMXLkyHjhhRcEwbAHZTKZqKqqio4dO9oPAwCwWwiAAQDepaioKKuvvKusrDQkAHaJgoKCGDVqVIwYMSJmzpwZkydPji1btmgM7IH9XDYHwNm+HwYA4P3laQEAwP8YPnx4SX5+fkk21ygABmBXa9GiRRx//PFxxx13xNlnnx0lJSWaAs14P5efn18yfPhwfxAAACSUABgA4B2OOOKIDtleo+//ArC7FBUVxejRo+P73/9+nH322VFcXKwpsBsk4cr1JOyLAQDYOQEwAMA79O3bt1221+gEMAC729tB8B133BGnn356tGrVSlOgme3n9ttvv7YmBQCQTAJgAIB36NSpkwAYAHYoKSmJz3zmM3HnnXfG6NGjo0WLFpoCzWQ/l4R9MQAAOycABgB4hw4dOrTN9hqTcGUgALmlpKQkzj777PjOd74To0aNivz8fE2BHN/PJWFfDADAzgmAAQDeoaysrG221ygABmBvad++fVx00UVx5513xgknnBCFhYWaAjm6nysrK3MCGAAgoQTAAADvUFJS0j6b68tkMlFdXW1QAOxV7dq1i/POOy+++93vxqhRoyIvz+sF+CiSsJ8rLS0VAAMAJJT/QgMAeIfi4uK22VxfXV1dNDY2GhQAWeHtE8F33HGHIBg+gsbGxqirq7MvBgBgt/BfZgAA79CqVausPung9C8A2ahDhw5x0UUXxbe//e04/PDDBcGQA/u6oqIiJ4ABABLKf5EBALxDQUGBABgAPqauXbvGpZdeGt/61rdi2LBhkUqlNAUSuq9r0aJFW1MCAEimAi0AAPgfhYWFZdlc39atWw0JgKzXrVu3uPLKK2P16tXxxBNPxOzZsyOTyWgMJGhfl+37YgAA3psAGADgnZujgoLW2VyfE8AAJEmPHj3iyiuvjKVLl8akSZNizpw5mgIJ2ddl+74YAID35gpoAIAdWrdunZefn98ym2sUAAOQRH369ImxY8fGLbfcEgMGDNAQSMC+Lj8/v1WrVq28OwQASCCbOACAHQYNGlQSEVn9scJt27YZFACJtd9++8UNN9wQX/va1+KAAw7QEJq1BOzr8gYPHlxsUgAAySMABgDY4YADDijJ9hpramoMCoDE69u3b9x4441xww03xL777qshNEu1tbVZX2P//v1LTQoAIHl8AxgAYIeePXtm/QuuJLwoBIAPa8CAATFgwICYP39+jBs3LpYvX64pNBtJ2Nf16NGjxKQAAJJHAAwAsEOnTp0EwACwFwwYMCAOPPDAmDt3bkyYMCFWrlypKeS8JOzrunbtKgAGAEggATAAwA5lZWVZ/4Krrq7OoADISalUKgYNGhQDBw6M2bNnx4QJE2Lt2rUaQ85KQgDcpk0bV0ADACSQABgAYIeysjIngAFgL0ulUjFs2LAYOnRozJ49O8aPHx/r1q3TGHKOABgAgN1FAAwAsENJSUlxttfoBDAAzcXbQfCQIUPi5ZdfjokTJ0ZFRYXGkDOSEAAnYX8MAMD/JQAGANihqKioKNtrrKmpMSgAmpW8vLw4/PDDY/jw4fH888/HE088EZWVlRpD4iUhAG7RokWRSQEAJI8AGABgh8LCwhbZXF86nY7t27cbFADNUn5+fowaNSpGjhwZL7zwQkycODGqqqo0hsTavn17ZDKZSKVSWVtjixYtWpgUAEDyCIABAHbI9gC4oaHBkABo9goKCmLUqFExYsSImDlzZkyePDm2bNmiMSROJpOJhoaGyOaMtbCw0AlgAIAk/neTFgAA7NgYFRRk9QuuxsZGQwKAHVq0aBHHH398HHnkkfHMM8/E1KlTY9u2bRpDomR7AJzt+2MAAN5jH6cFAAA7NkZZ/oLL9c8A8H8VFRXF6NGj49hjj41nnnkmpkyZEjU1NRpDImT7DS8FBQWugAYASCABMADA2xujLH/B5QpoAHhvbwfBRx11VEyfPj2efvrpqK2t1RiymgAYAIDdIU8LAAD+QQAMAMlXUlISn/nMZ+LOO++M0aNHZ/X1uiAABgBgdxAAAwDskO1XQAuAAeDDKykpibPPPjv+7d/+LUaPHh2FhYWagv3dR5Sfn9/SlAAAkkcADADw9sYoL88JYADIMa1bt46zzz47vve978UJJ5wgCMb+7iPIz8/3LwwAQAIJgAEAdkilUlm9N2psbDQkAPiY2rVrF+edd15897vfjRNOOCEKCgo0Bfu7D94f55sSAEDyCIABAHbI9gA4nU4bEgB8Qu3bt/9nEDxq1KjIy/NqBPu799kfp0wJACB5/FcOAMAOXnABQPPRoUOHuOiii+J73/ueIJi9JpPJZHuJ/sUAAEggmzgAgP+R1QFwAl4QAkDidOzYMS666KL41re+FYcffnj4fTDs796xOc7yG3IAANg5mzgAgITsjQTAALD7dOvWLS699NL41re+FcOGDRMEs0dk+xXQeXl5/kUAAEigAi0AAPiHbH/BJQAGgN2ve/fuceWVV8ayZcviiSeeiDlz5mgKzXl/5/AIAEACCYABAHbIZDJOAAMAERGx7777xtixY2PJkiUxYcKEmD9/vqZgfwwAQCIIgAEA/ocr7gCA/2W//faLG264Id56660YP358vPnmm5rCLpPtV0Cn3IUOAJBIAmAAgB2y/QVXtr8gBIBc1rdv37jxxhvjrbfeinHjxsWiRYs0hU/MFdAAANjEAQDsXln9Bs4BDADY+/r27Rs333xz3HDDDdG7d28NIdf3d75BAgCQQE4AAwDskO0nMATAAJA9BgwYEAMGDIj58+fHI488EitXrtQUcnF/5woaAIAEcgIYAGCHVCqVzvL6DAkAssyAAQPi1ltvjbFjx0bPnj01hJza32UScEc1AAD/lxPAAAD/QwAMAHysv6MHDRoUBx98cDz//PMxadKk2LRpk8aQ+P1dtv+CJAAAO+cEMADADul0dr/fEgADQHarr6+PioqK2LZtm2aQE/u7dDrtBDAAQAI5AQwA8D+cAAYAPrK6urp4+umnY9q0acJfcm1/5wQwAEACCYABAP6HEw4AwIfW0NAQ06ZNiyeffDK2bt2qIXxkCfgGsAAYACCBBMAAADtkMpmsDoDz8ny9AwCywdvB71NPPRXV1dUaQs7u7wTAAADJJAAGANgh219wCYABYO9qbGyMGTNmxJNPPhmVlZUawieWn5+f9VtkUwIASB4BMADADplMpiGb6yssLDQkANgL0ul0zJo1KyZPnhwbN27UEHaZgoLsfjXX1NTUaEoAAAncZ2oBAMA/NDY2bs/m+gTAALBnpdPpePnll2Py5Mmxdu1aDWGXa9GiRbb/O1BvSgAAySMABgDYoampSQAMAEQmk4nZs2fH448/HuXl5RpCs93fNTY2CoABABJIAAwAsENDQ0NWv+ASAAPA7vV28PvEE0/E6tWrNYTdLtuvgM72G3IAAHiPfaYWAAD8gyugAaD5mjNnTkyaNCmWLl2qGewx2X4FtAAYACCZBMAAADs0NTU5AQwAzcyCBQtiwoQJ8dZbb2kG9nfv0tDQIAAGAEggATAAwA7Z/oJLAAwAu87ChQtj/PjxsXjxYs1gr8n2K6Cz/RckAQB4j32mFgAA/EO2B8AFBQWRl5cX6XTasADgY1q+fHmMGzcu5s+frxnsVXl5eVkfAG/fvt0JYACABBIAAwDs0NDQkPUnHFq1ahXbtm0zLAD4iFauXBmPPPKI4Jes2tclYH8sAAYASCABMADADrW1tXXZXqMAGAA+mnXr1sX48eNj9uzZkclkNISs2tdlu7q6ulqTAgBIHgEwAMAOW7du3ZrtNSbhRSEAZIP169fHY489JvjFvu4TqK6u3mpSAADJIwAGANihqqpKAAwACbdhw4Z4/PHH45VXXommpiYNwb7uE6isrHT1DABAAgmAAQB22LRpU9a/4GrZsqVBAcBOVFVVxcSJE+OFF16IxsZGDSHrJSEA3rRpkxPAAAAJJAAGANhh3bp1WR8AOwEMAP/bli1bYsKECYJfEicJ+7ry8nIBMABAAgmAAQB2WLZsmSugASAhqqurY/LkyTFz5syor6/XEBInCfu6pUuXCoABABJIAAwAsMP8+fOz/gRwcXGxQQHQrNXU1MSUKVPimWeeEfySaEnY173++uu+AQwAkEACYACAHRYsWFCXyWQaUqlUYbbW2Lp1a4MCoFmqq6uLp59+OqZNmxbbtsmkSL5s39el0+mGpUuXbjcpAIDkEQADALxDU1PTtoKCgrbZWp8AGIDmZvv27TF9+vR48sknY+tWt9GSO7J9X9fU1ORfOACAhBIAAwC8Q0NDw9ZsDoBLS0sNCYDm8ndyTJs2LZ566qmorq7WEHJOtu/rGhsb/YsHAJBQAmAAgHeor6+vbNWqVc9src8JYAByXWNjY8yYMSOefPLJqKys1BByVrbv6+rr66tMCQAgmQTAAADv0NDQkNVvmgXAAOSqdDods2bNismTJ8fGjRs1hJyX7fu6bN8XAwDw3gTAAADvUFdXV5XN9ZWWlkYqlYpMJmNYAOSETCYTr732Wjz++OOxatUqDaFZSKVSUVJSktU11tbWVpkUAEAyCYABAN5h27Ztm7K5vvz8/GjVqlXU1NQYFgCJlslkYvbs2fH4449HeXm5htCstGrVKvLz87O6xq1btzoBDACQUAJgAIB3qK6u3pztNZaVlQmAAUist4PfiRMnxpo1azSEZqmsrCzra9y2bVuVSQEAJJMAGADgHaqqqjZle43t2rWLtWvXGhYAiTNnzpyYNGlSLF26VDNo1tq1a5f1NW7atMkJYACALNbQWBgFjQ0REZFKRSavMJre/pkAGADgHSoqKqqyvcYkvDAEgHdasGBBTJgwId566y3NgITs5zZs2CAABgDIYoUFDf9MejMRqab0/+S+AmAAgHdYtWpV1r/oatu2rUEBkAgLFy6M8ePHx+LFizUD3iEJAfDq1aurTAoAIJkEwAAA77BgwYKsD4CdAAYg2y1fvjzGjRsX8+fP1wzYiST8Ql8S9sUAAOycABgA4B2eeOKJjZlMpimVSuVna41OAAOQrVauXBmPPPKI4Bc+QLb/Ql8mk2l64oknNpoUAEAyCYABAN6huro6vX379g1FRUVdsrVGJ4AByDZr166NCRMmxOzZsyOTyWgIJHw/t3379g3V1dVpkwIASCYBMADAu9TV1a0XAAPAB1u/fn089thjgl/Isf1cXV3delMCAEguATAAwLvU1dVVtGnTJmvrKykpiRYtWsT27dsNC4C9oqKiIiZOnBivvPJKNDU1aQh8BEVFRVFcXJz1+2GTAgBILgEwAMC7bN26dV2XLll7ADhSqVR07Ngx1qxZY1gA7FFVVVUxceLEeP755wW/8DF17NgxUqlU1u+HTQoAILkEwAAA71JVVZX1Jx46deokAAZgj9m8eXM8/vjj8cILL0RjY6OGwCfcx9kPAwCwOwmAAQDeZf369Vn/zbMkvDgEIPm2bNkSU6ZMiZkzZ0Z9fb2GwC7QsWNH+2EAAHYrATAAwLusXr066088JOHFIQDJVVNTE1OmTIlnnnlG8Au7WBJ+kW/VqlUCYACABBMAAwC8y9///ves/+aZABiA3aG2tjYmT54czz77bNTV1WkINNN93KuvvioABgBIMAEwAMC7PPzww+t//OMfN6RSqcJsrbFz584GBcAus3379pg+fXpMnTo1tm3bpiGwG2X7CeB0Ot3w8MMPC4ABABJMAAwA8C7V1dXpurq68latWu2TrTV26NAh8vLyIp1OGxgAH1tDQ0NMmzYtnnrqqaiurtYQ2M3y8vKiQ4cOWV1jfX39mtraWptMAIAEEwADAOxEbW3tmmwOgAsKCqJdu3axceNGwwLgI2tsbIwZM2bEk08+GZWVlRoCe0j79u2joCC7X8fV1NSUmxQAQLIJgAEAdmLz5s2r2rdvn9U1duvWTQAMwEeSTqdj1qxZMXnyZH+HwF7av2W7LVu2rDQpAIBkEwADAOzEpk2bVvfp0yera+zWrVvMmzfPsAD4QG8Hv1OmTIkNGzZoCOzF/Vu227BhwxqTAgBINgEwAMBOrFixYvWwYcOyusYkvEAEYO/KZDLx0ksvxZQpU6K83K2usLd17do162tctWrVKpMCAEg2ATAAwE7Mnz9/9ZgxY7K6xiS8QARg78hkMjF79uyYOHFirFnjMB9kiyT8At+8efP8oQEAkHACYACAnRg3btyab37zm5mISGVrjU4AA7Azc+bMiSeeeCKWLVumGZBlEvALfJlx48atNikAgGQTAAMA7MTrr79e29DQsKmwsLBDttZYXFwcZWVlsWXLFgMDIBYsWBDjx4+PJUuWaAZkobKysiguLs7qGhsaGjYuWLCgzrQAAJJNAAwA8B62bt26vF27dh2yucauXbsKgAGauYULF8b48eNj8eLFmgFZLAm3t2zbtm25SQEAJJ8AGADgPVRVVS1t167d0GyusWfPnrFw4ULDAmiGli1bFo899ljMnz9fMyABevbsmfU1VlZWLjUpAIDkEwADALyHdevWLevTp09W15iEF4kA7ForVqyIRx99VPALCZOEfdvatWuXmRQAQPIJgAEA3sPChQuXHX744VldY69evQwKoJlYtWpVjB8/PubOnRuZTEZDIGGSsG9buHDhMpMCAEg+ATAAwHuYNm3a0ksuuSSra+zevXvk5+dHU1OTgQHkqHXr1sX48eNj9uzZgl9IqIKCgkR8A/jpp59eZloAADmw/9QCAICde+ihhzbcd999W/Pz80uzdjNXUBBdunSJNWvWGBhAjqmoqIiJEyfGyy+/HOl0WkMgwbp27RoFBdn9Gq6xsbH6kUce2WBaAADJJwAGAHgf27ZtW15WVnZwNtfYq1cvATBADqmqqoqJEyfG888/74YHyBFJ+P7vtm3blpsUAEBuEAADALyPLVu2LMv2ALhnz57x0ksvGRZAwm3evDkef/zxeOGFF6KxsVFDIIck4fu/W7ZsWWpSAAC5QQAMAPA+1q9fvyzbT2z06NHDoAASbMuWLTFlypSYOXNm1NfXawjkoCTs19avX7/MpAAAcoMAGADgfSxYsGDh0KFDs7rGfffdN1KpVGQyGQMDSJCampqYMmVKPPPMM4JfyGGpVCr23XffrK9z/vz5C00LACA3CIABAN7Ho48++uYFF1yQ1TWWlJRE586dY926dQYGkAC1tbUxefLkePbZZ6Ourk5DIMd17do1WrVqlfV1/vnPf15kWgAAuUEADADwPiZNmlRVX1+/oaioqGM217nvvvsKgAGy3Pbt22P69OkxderU2LZtm4ZAM9GnT5+sr7G+vr7iySefrDItAIDcIAAGAPgAW7duXZTtAXCfPn3ipZdeMiyALNTQ0BDTpk2Lp556KqqrqzUEmpkkXP+8detWp38BAHKIABgA4ANUVFQs7NChw8hsrjEJLxYBmpvGxsaYMWNGPPnkk1FZWakh0EwlYZ9WUVHh+78AADlEAAwA8AGWLl266MADD8zqGnv16hUFBQXR2NhoYAB7WTqdjlmzZsWkSZNi06ZNGgLNWGFhYfTs2TMR+13TAgDIHQJgAIAPMHPmzEWnnnpqdm/qCgqiZ8+esWzZMgMD2EveDn4nT54cGzdu1BAg9tlnn8jPz0/CfnexaQEA5I48LQAAeH+//OUvV6bT6bpsr7NPnz6GBbAXZDKZePHFF+O73/1u3H///cJf4J+ScP1zOp2u++Uvf7nStAAAcocTwAAAH6C6ujpdXV29uE2bNodkc539+vWL6dOnGxjAHpLJZGL27NkxceLEWLNmjYYAO92fJWCvu7i6ujptWgAAuUMADADwIWzYsGFetgfA/fv3NyiAPeTVV1+NSZMmxapVqzQD2KlUKpWI/dmGDRvmmhYAQG4RAAMAfAiLFy9+o2/fvlldY1lZWXTu3DnWr19vYAC7yYIFC2L8+PGxZMkSzQDeV5cuXaK0tDQJ+9z5pgUAkFsEwAAAH8JTTz31+ujRo7O+zv33318ADLAbLFy4MMaPHx+LFy/WDOBD78uSYMqUKa+bFgBAbsnTAgCAD/aLX/xiTWNjY1W215mUF40ASbFs2bK4++674z/+4z+Ev8BHkoTv/zY0NFTee++9q00LACC3OAEMAPAhNDQ0ZDZv3jy/Q4cOI7O5TgEwwK6xYsWKePTRR2P+fDejArm7L9uyZYs/5AAAcpAAGADgQ1q3bl3WB8AdO3aMNm3axObNmw0M4GNYtWpVjB8/PubOnRuZTEZDgI+lbdu20aFDh0Tsb00LACD3CIABAD6kefPmzTvooIOyvs4DDzwwXnrpJQMD+AjWrVsX48ePj9mzZwt+gV2yH0uCuXPnzjMtAIDcIwAGAPiQ/vznP88/77zzsr7OAw44QAAM8CFVVFTEuHHjBL/ALt+PJcHDDz/sBDAAQA4SAAMAfEgTJ06srK2tXdGqVat9srnOgw8+2LAAPkBVVVVMnDgxnn/++WhqatIQYJdKwq0xNTU1yydNmlRlWgAAuUcADADwEWzYsOHvvXr1yuoAuG3bttG1a9dYu3atgQG8y+bNm+Pxxx+PF154IRobGzUE2OW6desWbdu2TcS+1rQAAHKTABgA4CNYuHDha7169Toj2+scMGCAABjgHbZs2RJTpkyJ5557LrZv364hwG6TlO//Lly48O+mBQCQmwTAAAAfwcSJE/9+wgknZH2dBx54YEyfPt3AgGavpqYmpkyZEs8880zU19drCLDbDRgwIBF1jh8//u+mBQCQmwTAAAAfwb333rv6Bz/4wfqioqLO2VznAQccEHl5eZFOpw0NaJZqa2tj8uTJ8eyzz0ZdXZ2GAHtEXl5e9O/fP+vrrK+vX3ffffeVmxgAQG4SAAMAfESVlZVzu3btmtXHgFu1ahX77LNPLFu2zMCAZqWuri6efvrpmDZtWmzbtk1DgD1qn332iVatWmV9nZs2bZpjWgAAuUsADADwES1dunR2tgfAERGDBg0SAAPNRkNDQ0ybNi2eeuqpqK6u1hBgr+2/kuCtt976m2kBAOQuATAAwEc0ffr0v48cOTLr6xw4cGBMmDDBwICc1tDQEM8991w8+eSTUVlZqSHAXt9/JcG0adP+bloAALlLAAwA8BH9x3/8x9JbbrmlOj8/v3U219mrV68oKyuLLVu2GBqQc9LpdMyaNSsmTZoUmzZt0hBgrysrK4tevXplfZ2NjY1b7rnnnmUmBgCQuwTAAAAfUW1tbXrDhg1/7dKly3HZXGcqlYqBAwfGrFmzDA3IGW8Hv5MnT46NGzdqCJA1Bg4cGKlUKuvr3Lhx4yu1tbVpEwMAyF0CYACAj+Gtt956JdsD4IgQAAM5I51Ox8svvxxTpkyJ8vJyDQGyct+VBIsWLXrFtAAAcpsAGADgYxg/fvwrRxxxRNbXedBBB0VBQUE0NjYaGpBImUwmZs+eHRMnTow1a9ZoCJCVCgoK4qCDDkpErY888ogAGAAgx+VpAQDAR/fjH/94ZX19/fpsr7OoqCj69etnYEAivfrqq3HHHXfEz3/+c+EvkNX69esXRUVFWV9nXV1d+b333rvaxAAAcpsTwAAAH9OGDRte6dGjx6ezvc5BgwbFggULDAxIjCVLlsSECRNi/vz5mgEkwuDBgxNR5/r1653+BQBoBgTAAAAf07x5815OQgA8bNiwePjhhyOTyRgakNXefPPNmDBhQixevFgzgMRIpVIxdOjQRNQ6d+7cl0wMACD3CYABAD6m++677+XRo0dnIiKVzXW2bds2evfuHcuWLTM0ICstW7YsHnvsMSd+gUTq06dPtG3bNgmlpu+9996/mhgAQO4TAAMAfEwTJ06s3Lp165LS0tK+2V7rkCFDBMBA1lmxYkU8+uijgl8g0YYMGZKIOqurqxc+/fTTm00MACD3CYABAD6B8vLyl/fff/+sD4AHDx4c48aNMzAgK6xcuTImTJgQc+fOdT09kHhJ+f7vmjVrfP8XAKCZEAADAHwCM2fOfG7//ff/fLbX2a1bt+jWrVuUl5cbGrDXrFu3LsaPHx+zZ88W/AI5oWfPntGlS5dE1DpjxoznTAwAoHkQAAMAfAK33Xbba5dcckl1fn5+62yvdciQIQJgYK9Yv359PPbYY4JfIOck5frnxsbGzbfddts8EwMAaB4EwAAAn0BlZWXThg0b/tqlS5fjsr3WQw89NCZNmmRowJ78MzKeeOKJeP7556OpqUlDgJxz6KGHJqLOioqKV6qrq9MmBgDQPAiAAQA+oXnz5s1MQgDcu3dv10ADe0RVVVVMnDgxXnjhhWhsbNQQICd17949evbsmZT9quufAQCakTwtAAD4ZP77v/97VkQk4kTFpz71KQMDdpstW7bEQw89FLfffns899xzwl8gpw0fPjwRdWYymfTdd9/9gokBADQfTgADAHxCkyZNqtqyZcuCsrKyg7K91uHDh8fjjz9uaMAuVVNTE1OmTIlnnnkm6uvrNQTIealUKg477LBE1Lply5bXp0+fvsXUAACaDwEwAMAusHz58lkDBw7M+gC4S5cu0atXr1i5cqWhAZ9YbW1tTJ48OZ599tmoq6vTEKDZ6N27d3Ts2DEx+1QTAwBoXgTAAAC7wLPPPvvCwIEDr0hCrcOGDRMAA59IXV1dPP300zFt2rTYtm2bhgDNzrBhwxJT61/+8pcXTQwAoHnxDWAAgF3g1ltvnV9fX782CbUefvjhkUqlDA34yBoaGmLq1Klx6623xuOPPy78BZqlJF3/XFdXt/rWW29dYGoAAM2LE8AAALtAQ0NDZs2aNc/16dPns9lea7t27aJPnz6xZMkSgwM+7J9xMW3atHjqqaeiurpaQ4Bmbb/99ou2bdsmotbVq1fPNDEAgOZHAAwAsIs8++yz05IQAEdEHHHEEQJg4AOl0+mYNWtWTJo0KTZt2qQhABFx5JFHJqbW6dOnTzMxAIDmxxXQAAC7yC233PJaQ0NDZRJqHT58eLRo0cLQgJ1Kp9Px3HPPxW233Rb333+/8Bdgh6KiovjUpz6ViFobGho23HLLLXNNDQCg+XECGABgF6murk6Xl5c/t88++5yR7bW2bNkyDj300Hj55ZcNDvindDodL7/8ckyZMiXKy8s1BOBdhgwZEkVFRYmodc2aNc/V1tamTQ0AoPkRAAMA7EIvvvjiM0kIgCMiRo4cKQAGIiIik8nE7NmzY+LEibFmzRoNAXif/VNSzJo161kTAwBongTAAAC70O233/7KOeecszU/P78022sdMGBAtG/f3tWu0My9+uqrMWnSpFi1apVmALyPjh07xgEHHJCIWhsbG6u/8Y1v/NXUAACaJwEwAMAutHLlyob169fP6tat2+hsrzWVSsXhhx8ekyZNMjhohubMmROTJ0+OJUuWaAbAh3D44YdHKpVKRK3r16+fVVFR0WhqAADNU54WAADsWq+++mpirts77LDDDAyamTfffDP+/d//PX7yk58IfwE+pFQqFSNGjEhMva+88sozpgYA0Hw5AQwAsIvddNNNz5166qnV+fn5rbO91m7dukX//v1j4cKFBgc5btmyZfHYY4/F/PnzNQPgIzrggAOic+fOiai1sbFxy4033jjL1AAAmi8BMADALrZy5cqG8vLyGT179vx0Euo9+uijBcCQw5YvXx7jxo0T/AJ8wv1SUpSXlz9TXl7eYGoAAM2XABgAYDeYMWPGUxdccEEiAuAhQ4ZE69ato7q62uAgh6xcuTImTJgQc+fOjUwmoyEAH1ObNm3i0EMPTUy9zz777FOmBgDQvPkGMADAbvDVr371lYaGhk1JqLWgoCCOOOIIQ4McsW7duvj5z38ed955Z8yZM0f4C/AJjRw5MvLz8xNRa0NDw8abbrrpVVMDAGjenAAGANgNKisrm1atWjW9T58+5ySh3qOPPjqefPJJQREk2Pr16+Oxxx6L2bNn+3cZYBdJpVIxatSoxNS7cuXKadXV1WmTAwBo3pwABgDYTaZNm5aY6/c6duwYAwYMMDRIoA0bNsSvf/3r+Nd//dd49dVXhb8Au9CAAQOiY8eOian36aefftLUAAAQAAMA7CZf+9rX5tTX11ckpd6jjjrK0CBBqqqq4v77749vf/vb8eKLL0ZTU5OmAOxiRx55ZGJqra+vX/eNb3zjdVMDAMAV0AAAu0ltbW16xYoVT++///6fT0K9hx56aLRt2zaqqqoMD7LYli1bYsqUKfHcc8/F9u3bNQRgN2nbtm0MGTIkMfUuX778qdraWtc/AwDgBDAAwO70xz/+cUJSas3Pz4/jjjvO0CBL1dTUxKOPPhq33XZb/OUvfxH+Auxmxx57bOTn5yel3Myvf/3rCaYGAECEABgAYLe66667llZXV89PSr1HH310tGjRwuAgi7wd/H7jG9+IqVOnRn19vaYA7GYtWrSIo48+OjH1btmy5Y177rlnhckBABDhCmgAgN3u9ddfn3T44YcPSEKtxcXFcdhhh8XMmTMNDvayurq6ePrpp2PatGmxbds2DQHYgw477LAoKSlJTL3z5s17wtQAAHibE8AAALvZ9773vanpdLohKfWecMIJkUqlDA72koaGhpg6dWrceuut8fjjjwt/AfawVCoVJ5xwQmLqTafT27/73e8+ZXIAALzNCWAAgN1s+vTpWyoqKmZ26dIlER/Y7d69e/Tv3z/efPNNw4M9qKGhIaZNmxZPPfVUVFdXawjAXnLAAQdE9+7dE1NvRUXFczNmzPAXBwAA/+QEMADAHjBr1qxEXcuXpFMvkHTpdDqee+65uP322+PRRx8V/gLsZccff3yi6p0xY8YkUwMA4J2cAAYA2AO++tWvvnT66adXFRYWtk1CvQMHDoyOHTvGhg0bDA92k3Q6HbNmzYrJkyfHxo0bNQQgC3Ts2DEGDhyYmHobGhoqb7755pdMDgCAd3ICGABgDygvL29YsWLF1MRsEvPy4sQTTzQ42A3S6XS8+OKL8Z3vfCfuv/9+4S9AFjnppJMiLy85r8tWrFgxpaKiotHkAAB4JwEwAMAe8qtf/erRiMgkpd6jjjoqysrKDA52kUwmE6+++mp873vfi1//+texdu1aTQHIImVlZXHUUUcl6q+W//7v//6zyQEA8G4CYACAPeQ///M/l1dWVv4tKfUWFhbGMcccY3CwC7wd/P785z+PNWvWaAhAFjruuOOioCA5X0urqqqa/dOf/nS1yQEA8G4CYACAPeill14al6R6jzvuuCgqKjI4+JjmzJkTd911V/z85z+P1au9owfIVkVFRYn7xbcXXnhhnMkBALAzBVoAALDnjB079pkFCxZUFhYWtktCvSUlJXHEEUfE9OnTDQ8+gjfffDPGjx8fb731lmYAJMCRRx4ZJSUliam3oaFh0zXXXPOsyQEAsDMCYACAPai8vLxh6dKlE/v3739xUmo+8cQT49lnn410Om2A8AEWLVoUjz32WCxevFgzABIiLy8vTjzxxETVvGTJkifKy8sbTA8AgJ3ucbUAAGDP+u1vfzsxIjJJqbdjx44xdOhQg4P3sXz58rj77rvjRz/6kfAXIGGGDRsWHTp0SFLJmd/85jePmxwAAO9FAAwAsIf953/+5/JNmza9kqSaTz/99EilUoYH77Jy5cr4yU9+Et///vdj/vz5GgKQMHl5eXHGGWckquZNmza9fM8996wwPQAA3osroAEA9oKXXnpp/KmnnnpYUurt2rVrDBkyJGbPnm14EBHr1q2L8ePHx+zZsyOTyWgIQEINHTo0OnfunKiaX3jhhQkmBwDA+xEAAwDsBZdffvkzS5YsWVdUVNQlKTWfccYZ8be//U3YRbO2fv36eOyxxwS/ADkglUrF6aefnqia6+rq1lx22WXTTQ8AgPcjAAYA2AsqKyub5s+f/8ihhx56dVJq7tatm1PANFsbNmyIxx9/PF555ZVoamrSEIAc8KlPfSq6du2aqJrfeOONcdXV1WnTAwDg/fgGMADAXvL1r399XDqdrktSzb4FTHNTVVUV999/f3z729+OF198UfgLkCNSqVR8+tOfTlTN6XS69pvf/OZjpgcAwAdxAhgAYC+ZMWNG9Zo1a/7Ss2fPxLx97N69ewwcODDmzJljgOS0LVu2xIQJE+KFF16IxsZGDQHIMYceemh069YtUTWvXr36qRkzZlSbHgAAH8QJYACAvejXv/71HyMiUR8SPeuss5wCJmdt27YtHn300bjtttviueeeE/4C5KC8vLwYM2ZM0srO/OpXv/qT6QEA8KH2vFoAALD3fP/733+rqqoqUR/V7dGjR3zqU58yPHJKfX19TJ06Nb71rW/F1KlTo76+XlMActSIESOiS5cuiap506ZNf73rrruWmh4AAB+GABgAYC975plnHkpazWeccUbk5dlKkjvmzZsXjz76aGzdulUzAHJYQUFBnH766Ymre9q0aQ+aHgAAH5a3dgAAe9nYsWNn1tfXr01SzZ07d47DDjvM8ACARBk5cmR06NAhUTXX1dWtHjt27POmBwDAhyUABgDYyyorK5tee+21Pyat7jPPPDMKCgoMEABIhBYtWiTy9O/s2bP/UF1dnTZBAAA+LAEwAEAWuOqqqyY0NjZWJanm9u3bx9FHH214AEAiHHfccdGmTZtE1dzQ0LDxiiuumGh6AAB8FAJgAIAssGDBgrqFCxc+lrS6R48eHYWFhQYIAGS1li1bxsknn5y4uhcuXDhu6dKl200QAICPQgAMAJAlvv71r/8pnU7XJqnmtm3bximnnGJ4AEBWO+2006K0tDRRNTc1NdV+7Wtfe8j0AAD4qATAAABZ4umnn968fPnyxF3xN3r06GjXrp0BAgBZqUOHDnH88ccnru5ly5ZNmD59+hYTBADgoxIAAwBkkbvvvvtPmUymKUk1FxYWxumnn254AEBWOvPMMxP3yYpMJtN41113/dH0AAD4OATAAABZ5Be/+MWatWvXTkta3UcccUT06tXLAAGArNK7d+847LDDEld3eXn5X+6///51JggAwMchAAYAyDIPP/zwn5JWcyqVijPPPNPwAICsMmbMmEilUomr+8EHH/yT6QEA8HEJgAEAsszXv/71NzZs2DAraXUPHDgwDj74YAMEALLCoEGDYsCAAYmru6KiYuatt966wAQBAPi4BMAAAFlo3Lhxv01i3WPGjIm8PFtMAGDvysvLizFjxiSy9j//+c+/NUEAAD7RflgLAACyz/XXXz+nqqrqr0mru1evXnHUUUcZIACwVx1zzDHRvXv3xNW9adOmV2666aa5JggAwCchAAYAyFJ/+tOf7k1i3WPGjInS0lIDBAD2ijZt2sRZZ52VyNofeOCBe00QAIBPSgAMAJClbrrpprlJPAVcXFwcZ555pgECAHvFWWedFS1btkxc3Zs2bXrl5ptvnmeCAAB8UgJgAIAsNm7cuF8lse5Ro0ZF7969DRAA2KP69OkTI0eOTGTtjz322K9MEACAXUEADACQxcaOHTu7qqrqb0mrO5VKxfnnnx+pVMoQAYA9tv/4/Oc/n8j9R2Vl5d+uueaav5kiAAC7ggAYACDLTZ069bdJrLtv374xZMgQAwQA9ojDDjsssTeQTJ48+TcmCADAriIABgDIcpdeeumLVVVVryax9s9//vNRXFxsiADAblVaWhrnn39+Imuvqqr66+WXX/6SKQIAsKsIgAEAEuChhx76WRLrLisri9NPP90AAYDd6qyzzoqSkpIklp753e9+91MTBABgVxIAAwAkwA033DB3w4YNs5JY+3HHHRd9+vQxRABgt+jbt28cddRRiay9oqJi1te//vU3TBEAgF1JAAwAkBA///nPfxoR6aTVnUql4vOf/3zk5dl6AgC7Vn5+flx00UWRSqWSWH76F7/4xX+bIgAAu5q3cAAACXHHHXe8tW7duulJrL13795xzDHHGCIAsEudcMIJ0b1790TWXl5e/pc77rjjLVMEAGBXEwADACTI3XfffW8mk2lKYu1nnXVWtG3b1hABgF2iQ4cOcfrppyey9kwm03T33Xf/3BQBANgdBMAAAAlyzz33rCgvL386ibW3bNkyzj33XEMEAHaJc889N1q0aJHI2tesWTP1xz/+8UpTBABgdxAAAwAkzA9/+MOfZzKZhiTWPnz48Bg0aJAhAgCfyKGHHhpDhw5NZO3pdLrhBz/4wS9MEQCA3UUADACQMPfee+/qRYsWPZDU+i+++OIoKSkxSADgY2ndunVcfPHFia1/4cKFf7jvvvvKTRIAgN1FAAwAkECXXXbZrxsaGjYlsfaysjJXQQMAH9u5554bpaWliay9oaFh4+WXX/47UwQAYHcSAAMAJNDs2bNrXn311V8ntf4jjjgiDj74YIMEAD6SwYMHx+GHH57Y+l955ZX7Zs+eXWOSAADsTgJgAICEOueccx6tqalZmtT6L7roomjZsqVBAgAfSsuWLeNzn/tcYuuvqalZMmbMmMdMEgCA3U0ADACQUJWVlU3Tpk37RVLrb9++fZx++ukGCQB8KGeccUa0b98+sfU/+eST91ZXV6dNEgCA3U0ADACQYOedd960qqqqV5Ja/wknnOAqaADgAx188MFx/PHHJ7b+TZs2vXzBBRc8a5IAAOwJAmAAgIT74x//eG9EZJJYeyqVigsuuMBV0ADAe2rZsmVccMEFkUqlkrqEzP333/8zkwQAYE8RAAMAJNzNN988b9WqVU8ktf6OHTsm+nt+AMDudcEFF0THjh0TW/+KFSse//rXv/6GSQIAsKcIgAEAcsCNN974k6ampq1JrX/kyJExdOhQgwQA/pdPfepTMWLEiMTW39TUVH3zzTf/t0kCALAnCYABAHLAxIkTK//+97//KslruPDCC6OsrMwwAYCIiGjTpk18/vOfT/QaZs+efd/EiRMrTRMAgD1JAAwAkCPOPvvsh2pqapYntf7S0tK46KKLDBIAiFQqFV/84hejtLQ0sWuoqal566yzznrYNAEA2NMEwAAAOaKioqJx0qRJP07yGgYPHhwjR440TABo5o444og46KCDEr2GJ5544qeVlZVNpgkAwJ4mAAYAyCGXXHLJzIqKihlJXsMFF1wQ3bp1M0wAaKZ69uyZ+KufKyoqZnzhC1+YZZoAAOwNAmAAgBzzb//2b/ek0+ntSa2/RYsWceWVV0ZhYaFhAkAzU1hYGF/60pcSvQ9Ip9Pb/+3f/u0e0wQAYG8RAAMA5Jh777139aJFix5M8hq6d+8eZ555pmECQDNzxhlnRPfu3RO9hsWLFz947733rjZNAAD2FgEwAEAO+uxnP/vL2traRL94PPHEE2Pw4MGGCQDNxKBBg+Kkk05K9Bpqa2tXn3vuub80TQAA9iYBMABADlq8eHH9uHHj/j3Ja0ilUnHJJZdE27ZtDRQAclybNm3ikksuiVQqleh1jBs37t8XL15cb6IAAOxNAmAAgBx1+eWXv1RRUTEjyWsoLS2NL3zhC4l/GQwAvLe3f+mrdevWiV5HRUXFM5dffvlLJgoAwN4mAAYAyGE33HDDXU1NTVuTvIaDDjrI94ABIId95jOfiUMOOSTRa2hqaqq+4YYbfmiaAABkAwEwAEAOGzdu3MbZs2cn/jt0p5xyiu8BA0AOOuSQQ+LTn/504tfx17/+9efjxo3baKIAAGQDATAAQI77zGc+81B1dfXCJK8hlUrFF7/4xejQoYOBAkCO6NixY3zpS19K/KceNm/ePO+00057xEQBAMgWAmAAgBxXXV2dfuCBB34UEekkr6O4uDguvfTSyMuzhQWApMvPz4/LLrssiouLk76U9P333/+ftbW1aVMFACBbeHsGANAMXH/99XMWLVr0YNLXsf/++8e5555roACQcOedd1707ds38etYuHDhH7/61a++bqIAAGQTATAAQDNxySWX/Lyurq486es4/vjjfQ8YABJs2LBhccwxxyR+HXV1dWsuvPDC+0wUAIBsIwAGAGgmXnvttdoHHnjguxGRSfI6UqlUfOlLX4oePXoYKgAkTO/evePSSy9N/Hd/IyLzwAMPfO/111+vNVUAALKNABgAoBm5+uqr/7Z06dJHk76OoqKiGDt2bJSWlhoqACRE69at46qrrorCwsLEr2X58uXjrr766r+ZKgAA2UgADADQzJx33nn/r66ubnXS19GhQ4e4/PLLIy/PlhYAsl1eXl5cfvnl0b59+8Svpb6+ft0ll1zyE1MFACBr999aAADQvLz++uu1Dz744Pcj4VdBR0QMGDAgzjrrLEMFgCw3ZsyYOPDAA3NiLY899tgPXnnllW2mCgBAthIAAwA0Q1/5ylf+umbNmqm5sJaTTz45Dj30UEMFgCw1ZMiQOOmkk3JiLWvXrv3LpZde+oKpAgCQzQTAAADN1GWXXfYf9fX1FUlfRyqViksvvTS6d+9uqACQZXr06BFf/OIXI5VKJX4tDQ0Nm6655pofmioAANlOAAwA0EzNmDGj+oEHHvhO5MBV0C1btozrr78+2rZta7AAkCXatWsX1113XbRs2TIXlpN56KGH/nXSpElVJgsAQLYTAAMANGNf+cpX/rpkyZI/58Ja2rZtG1dffXW0aNHCYAFgL2vRokVcffXVOfPLWUuXLn30iiuueNlkAQBIAgEwAEAzd+655/6ktrZ2eS6spXfv3jlzzSQAJNXbn2fYZ599cmI9tbW1y88555wfmywAAEkhAAYAaOYWLFhQ97Of/ezbmUymMRfWM2zYsDjllFMMFgD2kk9/+tMxdOjQnFhLJpNp/NnPfvbtBQsW1JksAABJIQAGACBuvfXWBfPnz78/V9Zz5plnxuDBgw0WAPaw4cOHx2c+85mcWc/8+fN/d+utty4wWQAAkkQADABARESMGTPmvpqamrdyYS2pVCouu+yy6Nmzp8ECwB7Su3fvuPjii3PmUwxbt25ddPrpp//aZAEASBoBMAAAERGxcuXKhh/+8Ie3pdPpnLjisGXLlvEv//Iv0aVLF8MFgN2sS5cucf3110dRUVFOrKepqanmu9/97jfKy8sbTBcAgKQRAAMA8E933XXX0ueff/6eXFlPaWlpXHvttVFWVma4ALCblJWVxXXXXRclJSU5s6aZM2fe/f/+3/9bZboAACSRABgAgP/l5JNPHldeXv50rqynU6dOMXbs2Jw5kQQA2aSoqCiuueaa6NixY86sqby8/MlTTz11gukCAJBUAmAAAP6PSy655K66urq1ubKefffdN6644orIy7P9BYBdJS8vL6688sro3bt3zqyprq6u/JJLLvmh6QIAkOi9uhYAAPBus2bNqn7ooYfujIh0rqxp4MCBcd555xkuAOwi559/fhxyyCG5tKT0gw8+eOesWbOqTRcAgCTLb3tQ9NzpjndbRG15oQ4BADRTEydOXDNmzJi8Tp06Dc2VNfXp0yfy8/PjzTffNGAA+ATOOuusOOmkk3JqTa+//vp9Z5555kTTBQAgCYq7N0Ze6c5/5gQwAADv6dRTT/31li1bXs+lNZ122mlx9NFHGy4AfEzHHntsnHrqqTm1pi1btrxx2mmn/cZ0AQDIBQJgAADeU0VFReONN974jcbGxqpcWtcFF1wQRx55pAEDwEd05JFHxuc+97mcWlNjY2PVzTff/I2KiopGEwYAIBcIgAEAeF9//OMf1z/yyCPfiRz6HnAqlYqLLroohgwZYsAA8CENHTo0LrrookilUrm0rPQjjzzynfvvv3+dCQMAkCsEwAAAfKBLL730hQULFvwupzbCeXnxpS99Kfbff38DBoAPcNBBB8WXvvSlyMvLrVdJCxYs+N2ll176ggkDAJBLBMAAAHwoo0eP/mVVVdXcXFpTYWFhfOUrX4kePXoYMAC8h169esUVV1wRBQUFObWuqqqqOaNHj/6lCQMAkGsEwAAAfCgVFRWNV1111S0NDQ0bcmldJSUlcfPNN8c+++xjyADwLr17946bbropiouLc2pdDQ0NG6666qqv++4vAAC5SAAMAMCHNmHChE3333//tzKZTDqX1lVcXBzXXXdddO/e3ZABYIfu3bvHtddeG61atcqpdWUymfT999//rQkTJmwyZQAAcpEAGACAj2Ts2LGz58+f/9tcW1fr1q3juuuuiw4dOhgyAM1ehw4d4rrrrovWrVvn3Nrmz5//m7Fjx842ZQAAcpUAGACAj+y44477xaZNm17MtXW1a9cubrzxxmjXrp0hA9BstW3bNmf/Pty4ceOLxx13nO/+AgCQ0wTAAAB8ZNXV1emLL774W3V1datzbW0dO3aMG2+8Mdq0aWPQADQ7ZWVlceONN0bHjh1zbm21tbWrL7zwwturq6vTJg0AQC7Lb3tQ9NzZD9LbImrLC3UIAICdWrZsWf327dtfOvbYY0/Ny8trkUtrKykpiaFDh8Zrr70WNTU1hg1As9ChQ4f42te+Fp06dcq5tTU1NW39zne+M/bBBx9cb9IAAOSC4u6NkVe6858JgAEA+NhefPHFzYcccsiyAQMGnBgRqZzaRBcXx5AhQ4TAADQLHTt2jJtuuik6dOiQi8tLjx8//ravfvWrc0waAIBc8X4BsCugAQD4RC688MIZb7zxxm9ycW3t27ePm266KSdPQgHA2zp16pTL4W+88cYbv77wwgufM2kAAJoLATAAAJ/YqFGjfrFhw4aZubi2t0Pgzp07GzQAOadz585x0003Rfv27XNyfRs2bJg5atSo+0waAIDmRAAMAMAnVltbm77sssu+V1dXtzoX19euXbu44YYbomPHjoYNQM7o0KFDXH/99dGuXbtc3Z+s/sIXvvDd2tratGkDANCc+AYwAAC7xJIlS+oj4pVRo0admpeX1yLX1ldcXBxDhw6NuXPnxrZt2wwcgETr0qVL3HjjjTl77XNTU1P1nXfeec0f/vCHdaYNAEAuer9vAAuAAQDYZWbNmlXVo0ePuYceeujoVCqVn2vra9WqVYwYMSIWLVoUlZWVBg5AIu23335x0003RVlZWU6uL51ON/z617++4fbbb3/TtAEAyFUCYAAA9phJkyatPeqoozbsu+++R+fi+goLC2P48OGxbNmy2LBhg4EDkCgDBgyIa6+9Nlq1apWza5w2bdq/XXLJJc+ZNgAAuez9AmDfAAYAYJc77bTTHn/rrbcezNX1FRUVxTXXXBNDhgwxbAASY8iQIXHNNddEUVFRzq5xwYIFvzv99NOfMG0AAJozATAAALvFEUcccc+GDRtm5ur6CgoK4sorr4wjjjjCsAFIwt/LceWVV0ZBQUHOrrG8vPypESNG/LdpAwDQ3AmAAQDYLaqrq9MXXXTRd2pra1fk7GY6Ly8uvvjiOPLIIw0cgKw1atSouPjiiyMvL3dfA23dunXxZz/72e83NDRkTBwAgObON4ABANhtli9fvr2mpuaFY4899uT8/PyWubjGVCoVgwYNikwmE4sWLTJ0ALLK6aefHueee26kUqmcXWN9fX3FDTfccM3UqVOrTBwAgObi/b4BLAAGAGC3evnll7cUFBS8cMQRR4zOy8trkYtrTKVSccABB0SnTp1i7ty5kck4fATA3lVYWBhXXHFFHHPMMTm9zsbGxuo777zzKz/72c9WmzoAAM2JABgAgL1qxowZlb169Xp98ODBJ6dSqfxcXWfPnj2jb9++8fe//z0aGxsNHoC9olWrVnH11VfHwIEDc3qd6XS64be//e2Nt9122wJTBwCguREAAwCw1z3xxBPlw4cPX9OvX79jIyJn76Hs2LFjDBw4MObMmRN1dXUGD8Ae1a5du7jxxhujT58+ub7U9JQpU779xS9+8XlTBwCgOXq/ADhPewAA2FPGjBkz9Y033vh1rq+zZ8+eceONN0bHjh0NHYA9pkuXLnHTTTdF9+7dc36tc+fO/eU555zzF1MHAID/SwAMAMAe9alPfernS5cufTjX19mlS5e49dZb48ADDzR0AHa7gQMHxje/+c3o1KlTzq/1rbfeemjEiBG/MnUAANg5ATAAAHvcsccee8/GjRtfyPV1FhcXx7XXXhsjRowwdAB2m8MPPzyuuuqqaNmyZc6vdePGjc8fffTR95g6AAC8NwEwAAB7XEVFReNxxx339crKyr/l+loLCgrisssui/PPPz9SqZThA7DLpFKpOP/88+PSSy+NgoKCnF/vpk2bXj7ssMNuqaysbDJ9AAB4bwJgAAD2isWLF9efddZZN1dXV7/ZHNZ7/PHHx5e//OUoKioyfAA+sRYtWsSXv/zlOP7445vFequrq98cM2bMN8rLyxtMHwAA3l9+24Oi585+kN4WUVteqEMAAOw2a9asaVi1atWs0aNHH1dQUNA619fbrVu3OOCAA2LevHlRX1/vAQDgYykrK4trrrkmDjrooGax3rq6uvKxY8de89RTT202fQAA+Ifi7o2RV7rznwmAAQDYq+bNm1ezevXqZ04++eTjCwoKSnN9ve3atYuRI0fG8uXLY+PGjR4AAD6S/v37x0033RRdu3ZtFuutr69fd9111335T3/6U4XpAwDA/xAAAwCQ1ebMmbMtlUq9fOSRR56Ul5eX83ckt2jRIkaMGBG1tbWxdOlSDwAAH8rxxx8fX/rSl5rN5wQaGxu33HXXXdf99Kc/XWn6AADwvwmAAQDIejNnzqzs2bPn64MHDz4plUrl5/p6U6lUHHLIIdGqVatYsGBBZDIZDwEAO5WXlxef/exn4/TTT49UKtUs1pxOp7f//ve//+o3vvGN1z0BAADwfwmAAQBIhEmTJpXvs88+8wYOHHhCKpUqaA5r3m+//WLAgAExd+5c3wUG4P8oKyuL6667LoYNG9Zs1pxOp7f/8Y9/vOmqq676qycAAAB2TgAMAEBiTJw4cc3BBx+85MADDzwulUrlNYc1t2/fPoYOHRqLFi2KLVu2eAgAiIiIffbZJ66//vro2bNns1lzJpNpnDBhwm1f/OIXn/cEAADAexMAAwCQKI8++ujy/fff/42DDjrohOZwHXRERHFxcRx11FHR2NgYb731locAoJkbPXp0XHHFFVFSUtJs1pxOpxsefvjhr15yySWzPAEAAPD+BMAAACTO+PHjVw0cOHDpAQcccGxzOQmcSqViwIAB0aVLl3jjjTeiqanJgwDQzBQVFcWll14aJ554YrP53m/EP07+Pv7447dffPHFMz0FAADwwQTAAAAk0iOPPLLs0EMPXbb//vs3mxA4IqJHjx4xZMiQePPNN2Pr1q0eBIBmonv37vEv//IvccABBzSrdWcymaYnnnji9s997nPPeAoAAODDEQADAJBYDz/88NJjjjlmY+/evY+KiGZzFKq0tDSGDx8eq1evjvXr13sQAHLcwIED45prrol27do1t6VnZsyY8YOzzjprqqcAAAA+PAEwAACJdv/99795zDHHVO6zzz5HRDMKgVu0aBGHHXZYtGzZMhYuXBjpdNrDAJBjCgoK4pxzzonzzz8/WrRo0dyWn37uuefuOuWUUyZ4EgAA4KMRAAMAkHi///3v5w8bNmxF3759j2lO10GnUqno27dvDB06NBYvXhxbtmzxMADkiJ49e8YNN9wQgwcPblbf+434x7XPU6ZM+fbpp58+2ZMAAAAfnQAYAICc8OCDDy4ZNmzYin79+jWrEDgionXr1nHEEUdEfX19LF261MMAkGCpVCpOOOGEuOKKK6JNmzbNbv07wt9vnXPOOX/xNAAAwMcjAAYAIGc89NBDS4YNG7a8X79+xza3EDg/Pz8OPvjg6NWrV8yfPz8aGho8EAAJU1JSEpdffnmccMIJkZ+f3+zWn8lkGp944olvffazn53maQAAgI9PAAwAQE556KGHlo4cOXJdnz59RqWa252ZEdG1a9cYNmxYLFu2LCorKz0QAAnRt2/fuO6662K//fZrluvPZDLpp59++rvnnHPO054GAAD4ZATAAADknD/96U+LDj300KX7779/s7sOOiKiuLg4jjzyyCgpKYk333wz0um0hwIgSxUUFMRnP/vZuPDCC6OkpKRZ9iCdTjc88sgjt5x//vnTPREAAPDJCYABAMhJDz/88NId3wQelUqlmt09mqlUKvr06RMHH3xwLFy4MLZt2+ahAMgynTt3jrFjx8bQoUOjGV5aERH/CH+feOKJ2y+88MLnPBEAALBrCIABAMhZDz300JIePXq8NmjQoGPz8vJaNMcetG3bNkaNGhVNTU2xZMkSDwVAFkilUjF69Oi48soro0OHDs22D01NTdt++9vf/stll132oqcCAAB2HQEwAAA5bdKkSeXdu3efM3jw4GYbAufn58eAAQOiV69esWDBgti+fbsHA2Avad26dVx66aVx/PHHR35+frPtQ2NjY/WvfvWrf7nuuute81QAAMCuJQAGACDnTZ48eW1jY+OMI4444uiCgoKS5tqHrl27xqhRo2Lbtm2xcuVKDwbAHpRKpWLUqFExduzY6NWrV7PuRX19/fo77rjjK9/61rcWejIAAGDXEwADANAsPP/881UbNmx45rjjjjuqsLCwrLn2obCwMAYNGhT77bdfLF68OGpraz0cALtZ+/bt44orrogTTzwxCgub9/uU2tralTfffPPVP/nJT1Z7MgAAYPcQAAMA0Gz87W9/27p27doZJ5xwwsjCwsK2zbkXnTp1ipEjR0Z1dbXTwAC70ciRI+Pqq6+OHj16NPte1NTULL/hhhuu/e1vf7vOkwEAALuPABgAgGbltdde2zpv3rynTznllKFFRUWdmnMvCgsL49BDD4399tsvFi1a5DQwwC709qnfk08+udmf+o2I2Lx587yLL774unHjxm30dAAAwO71fgFwat9zYsTOftC4LmLjq610DwCAxOrVq1fhs88++69du3Y9QTciGhoaYurUqTF58uRobGzUEICPqaCgIE499dQYPXq04HeH8vLyp4499tjvrly5skE3AABg9+swrDYKuuz8ZwJgAAByWuvWrfNeeumlm/fdd9+zdeMfVq9eHffff38sWbJEMwA+ov322y8uuugi1z2/w8KFC38/fPjwnzY0NGR0AwAA9gwBMAAAzd7zzz9/8aGHHnp1RKR0IyKTycTMmTPjz3/+c9TV1WkIwAcoKSmJ8847L0aMGBGplL9Kdki//PLL9xx77LEPagUAAOxZ7xcA+wYwAADNwn333Tfn+OOP39yrV6/DQwgcqVQqevfuHcOHD49169ZFRUWFhwTgPRxyyCExduzY6N+/v/B3h0wm0/jMM8/828knnzxONwAAYM97v28AC4ABAGg2fve7370xePDgJf369Ts6lUrl60hEcXFxjBgxInr06BFLly6N2tpaTQHYoUOHDvGFL3whzjzzzCguLtaQHZqammoeeOCBWz73uc9N1w0AANg7BMAAALDDww8/vKygoOC54cOHH1FQUFCqI//QrVu3OO6446K0tDQWL14cTU1NmgI0Wy1btoxzzjknLr300ujevbuGvENtbe2K22677arbbrvtDd0AAIC9RwAMAADv8Oyzz25avHjx0yeddNKQoqKiTjryD3l5edGnT58YOXJkbN26NVatWqUpQLNz+OGHx1e+8pUYMGBA5OXlacg7VFVV/e3CCy+8/oEHHvDdAAAA2MsEwAAA8C7z58+vefbZZ58+44wz+hcXF/fSkf/RsmXLGDJkSOyzzz6xdOnSqKmp0RQg53Xs2DG++MUvximnnBItW7bUkHdZt27dMyeffPI3Xn755W26AQAAe9/7BcCpfc+JETv7QeO6iI2vttI9AAByWmFhYer555//0sEHH3y5bvxfTU1N8fzzz8f48eOjurpaQ4Cc07p16zjzzDPjyCOPdOJ35zJ///vff3rMMcfc39DQkNEOAADIDh2G1UZBl53/TAAMAAARMWnSpM8cc8wxt6RSKdfg7ERNTU1MmTIlpk2bFg0NDRoCJF5hYWGccsopcdJJJ0VRUZGG7EQ6na6fOnXqd88555y/6AYAAGSX9wuAXQENAAAR8Yc//GHhfvvt98aAAQOOysvLkwS8S2FhYQwYMCCGDh0amzZtinXr1mkKkFiDBw+Oq666KoYOHRoFBQUashONjY1Vv//972/5whe+MEs3AAAg+/gGMAAAfAgTJkxYXV1dPf3II4/8VGFhYTsd+b9KS0vjsMMOi/79+8eaNWti8+bNmgIkRu/evePyyy+PU045JUpLSzXkPWzdunXxLbfccs33vve9hboBAADZyTeAAQDgI+jTp0+LJ5988us9evQ4TTfe3/z58+ORRx6JlStXagaQtXr16hXnnHNODBgwQDM+wKpVq5444YQTfrBy5Ur3/QMAQBbzDWAAAPgYnnnmmfOHDx9+fSqVytON95bJZGL27Nkxbty4qKio0BAga3Tu3DnOOuusGDp0aKRSKQ15/z/Lm2bNmvXDk08++THdAACA7OcbwAAA8DH85je/eX3//fd//cADDzzSd4HfWyqViu7du8cxxxwT7dq1i2XLlkV9fb3GAHtN27Zt49xzz42LL744evToIfz9AI2NjdUPPvjgLZ/97Gf/ohsAAJAMvgEMAAAf0/jx41dFxPOHHXbYiMLCwjIdeW95eXnRu3fvOOqoo6KgoCBWrlwZjY2NGgPsMcXFxXHKKafEl770pejbt2/k5bnA4YPU1tau+MEPfnD9LbfcMk83AAAgQf/94xvAAADwyQwePLjVo48++s1u3bqdpBsfTn19fTzzzDMxderU2LZtm4YAu01ZWVmceuqpceSRR0ZRkQsbPqyVK1c+/ulPf/pHixcvdm0DAAAkjG8AAwDALvLkk0+edeSRR96USqVcl/MhCYKB3eXtE7/HHnus4PcjyGQyDbNmzfoP3/sFAIDk8g1gAADYRX7/+98v6NGjx2uHHHLIyPz8fL8x+SEUFBREv3794qijjoq8vLxYtWqVq6GBT6Rly5ZxwgknxBVXXBEHHXRQFBQUaMqH1NDQsOG3v/3t1z7/+c8/oxsAAJBcroAGAIBd7Lzzzut4991339m2bdvBuvHR1NTUxLPPPhvTpk2LLVu2aAjwoZWVlcXxxx8fxxxzTBQXF2vIR1RVVfW3a6+99vZHHnlkg24AAECyuQIaAAB2g06dOhVMmzZtbN++fT8XESkd+WgaGhri+eefjyeffDI2bJBFAO/7522cdNJJccQRR0RhodvKPobMokWL/nTsscf+pLKyskk7AAAg+QTAAACwG/3hD38Ydfrpp99WUFDQRjc+unQ6Ha+++mpMnTo1Vq5cqSHAP/Xq1StOOeWUGDp0aOTl5WnIx9DY2Fg1YcKEOy666KKZugEAALlDAAwAALvZaaed1vbee+/9docOHUbqxse3fPnymDZtWrz88suRTqc1BJqhvLy8OOyww+L444+P3r17a8gnsHHjxue//OUvf3fSpElVugEAALlFAAwAAHtAYWFh6qmnnjpv+PDh16RSKXeUfgIbNmyIGTNmxHPPPRc1NTUaAs1AcXFxjBo1Ko4++ujo2LGjhnwCmUym4ZVXXvl/J5100kMNDQ0ZHQEAgNzzfgFwftuDoufOfpDeFlFb7p0VAAB8WOl0On7zm9+8Xlpa+uLgwYM/VVhYWKYrH09xcXEMGDAgjj322GjTpk2sXbs2amtrNQZyUIcOHeKMM86ISy+9NAYOHBjFxcWa8gnU1tau+slPfnLjxRdf/IybFAAAIHcVd2+MvNKd/8wJYAAA2A1OPPHENvfdd9+tnTp1Olo3PrnGxsb429/+Fs8++2wsWrRIQyAH9OvXL44++ugYNmxYFBQUaMguUFFR8cwXv/jFf5s+ffoW3QAAgNzmCmgAANhLHn744RNGjx799YKCgta6sWusX78+Zs6cGc8//3xUV1drCCRIaWlpHHnkkXHUUUdF586dNWQXaWxs3DJ16tS7PvvZz/5FNwAAoHkQAAMAwF50ySWXdP3+97//rXbt2g3VjV2nsbExXnvttXjuuedi/vz5GgJZbMCAATFq1KgYPHiw0767WFVV1atf//rXv/e73/1urW4AAEDzIQAGAIC9rF27dvlTp0699OCDD740lUrl68iutXz58nj++efj5ZdfjpqaGg2BLFBSUhLDhw+PI444Inr37q0hu1gmk2mcN2/efSeeeOJvq6urfewXAACaGQEwAABkia9//ev73Xjjjf9aWlraXzd2vXQ6HW+++WY899xz8dprr0VjY6OmwB5UUFAQgwcPjlGjRsUBBxwQeXl5mrIbVFdXL/zP//zPf/3BD36wRDcAAKB5EgADAEAWOfjgg1v9+c9/vrZ3795jIiKlI7tHZWVlvPjii/HCCy/EunXrNAR2o65du8bIkSPj8MMPj7Zt22rI7pNZunTpn88888z/t3jx4nrtAACA5ksADAAAWejuu+8eePHFF9/WqlUrd6PuZuXl5fHqq6/GSy+9FOvXr9cQ2AU6d+4cI0aMiGHDhkW3bt00ZDerqalZ9tvf/vbOm266aa5uAAAAAmAAAMhS/fr1K3r44Ycv79+//4WpVMpdqXvA8uXL46WXXoqXX345qqurNQQ+grKyshg+fHiMGDHCd333kEwmk164cOEfzj777F8sXbp0u44AAAARAmAAAMh6P/3pT4d97nOf+2bLli176Mae0dDQEHPnzo2//vWvMXfu3Ni+Xa4CO9OyZcsYNGhQDBs2LA455JAoKCjQlD2ktrZ21R//+Mc7rr322r/rBgAA8E4CYAAASIA+ffq0ePTRR69wGnjPS6fTsXTp0nj11VedDIaIaNu2bQwbNiyGDRsWffr0ibw8fyTtSZlMpuG11177+ZlnnvmnioqKRh0BAADeTQAMAAAJ8uMf//jQCy644JutWrXaRzf2vLdPBs+ePTvmzp0bdXV1mkKzUFZWFoMHD45hw4ZF//79Iz8/X1P2gpqammX333//nTfccINv/QIAAO9JAAwAAAnTrl27/HHjxp37qU996qq8vDwb870kk8nEihUrYu7cuTFnzpxYsWJFZDIZjSEnpFKp6Nu3bwwbNiwGDRoUHTt21JS9qKmpqfbVV1/92ZgxY/5cWVnZpCMAAMD7EQADAEBCffnLX+5x++23f7V9+/aH68bet2XLlnjjjTdizpw5MW/evKivr9cUEqVly5Zx8MEHx6BBg+KQQw6J0tJSTckCGzdufPG73/3uv//iF79YoxsAAMCHIQAGAIAEKywsTE2cOPGMkSNHXlNQUNBaR7JDXV1dvPnmm/HGG2/EG2+8EevXr9cUslKXLl3ioIMOioMOOigOOOCAKCoq0pQs0djYuGXmzJk/PvPMMyc2NDS4XgAAAPjQBMAAAJADjjzyyNY/+9nPrujbt++5EZGnI9mluro6Fi5cGPPnz4958+ZFZWWlprBXtGvXLg455JAYMGBA9O/fP1q39nsjWSj91ltv/fmqq676xaxZs6q1AwAA+KgEwAAAkEN++ctfjhgzZsyNrVq16q0b2SmdTsfKlStj0aJFsXDhwli8eHFs27ZNY9gtSkpKol+/ftG/f//Yf//9o1evXpGX53dEslVNTc3yRx999EdXXnnlK7oBAAB8XAJgAADIMd26dSt8+OGHPzd48ODL8vPzbdyzXCaTiTVr1sTChQtj0aJFsWjRotiyZYvG8LGUlZVF//79/xn6du/ePVKplMZkuaampprXXnvtV2PGjHmgoqKiUUcAAIBPQgAMAAA56rjjjiv7r//6r8tdC508mzdvjuXLl8eKFSti+fLlsXjx4qipqdEY/pfi4uLo169f9O7dO/bZZ5/Yd999o6ysTGMSJJPJpJcsWfLn66677pfTp0/3mx8AAMAuIQAGAIAc99Of/nTIueeee3NpaWlf3UimxsbGWLlyZSxdujSWLVsWy5cvj3Xr1kUmk9GcZiKVSkWXLl1in332iT59+kSfPn2iV69eUVBQoDkJtXXr1sUPPvjgj6699tq/6wYAALArCYABAKAZaNeuXf64cePOGTp06BUFBQWtdST56uvrY+XKlf88KbxixYpYu3ZtpNNpzUm4vLy86Nq1a+yzzz7//KdXr17RsmVLzckBjY2NW/7617/+4pxzznm0srKySUcAAIBdTQAMAADNyIknntjmnnvuuXzfffcdk0qlHB3MMdu3b481a9bEmjVrYu3atbF27dooLy+PDRs2CIazUF5eXnTs2DG6desWXbt2jW7dukW3bt2iR48eUVhYqEE5JpPJNC5ZsuRR1z0DAAC7mwAYAACaoa9+9av7Xnfdddd16NDhCN3IfY2Njf8MhNetWxfr1q2LioqKWLduXWzbtk2DdrPS0tLo3LnzP//p0qVLdO3aNbp27eoK52Ziw4YNM//rv/7rxz/60Y+W6wYAALC7CYABAKAZ++UvfznirLPOuq64uNj3gZupmpqaWL9+/T//qaioiMrKyqisrIxNmzZFY2OjJn2AgoKCaN++fbRr1y7at28fHTt2jC5dukSnTp2ic+fOUVxcrEnN1NatW98aP378PVdcccXLugEAAOwpAmAAAGjm2rVrl//ggw+eOWLEiCsLCwvb6gjvtHnz5n+GwZs2bYrKysqorq6OLVu2xJYtW6K6ujqqq6sjk8nk3NpTqVS0bt06WrduHWVlZdGmTZsoLS39X2Fvu3btok2bNh4U/peGhobKl1566efnnHPO+OrqavevAwAAe5QAGAAAiIiIoUOHFt97770XHHjggRfk5+c7ssiHlk6n/xkEV1dXR01Nzfv+k8lkora2NtLpdNTX10dTU1PU1dXt0u8U5+XlRcuWLSM/Pz+KiooiLy8vWrVqFalUKoqLi3f6T0lJSbRq1eqfgW9paWnk5eUZMB9aU1NTzYIFC/745S9/+Y+zZ8+u0REAAGBvEAADAAD/y2mnndb2rrvuurRPnz5n5+XlFeoIe9LbgfDbtm/f/r7XUBcUFESLFi3++b/fDnxhT8pkMg1LliwZd8stt/xq0qRJVToCAADsTQJgAABgp0477bS2d95554X777//5wTBAP9XJpNpWLhw4QO33nrrHwS/AABAtni/ADi/7UHRc2c/SG+LqC33/gcAAHLZokWL6u69995X0un0swcddFCnkpKS3roC8A8VFRUz/7//7/+77aKLLpq6aNGiOh0BAACyRXH3xsgr3fnPBMAAAEDMnDmz8u67736qqalpWr9+/Ypbt27dN5VKpXQGaG4ymUx6zZo1U+65555/Peeccx6cOXNmpa4AAADZRgAMAAB8KDNnzqz88Y9//Gw6nZ4uCAaak7eD37vvvvtfzz///McEvwAAQDYTAAMAAB+JIBhoLgS/AABAEgmAAQCAj+XtILisrOyFvn37diwuLu4VEYJgIBdkKioqnrv33nu/PWbMmEcEvwAAQJK8XwCc2vecGLGzHzSui9j4aivdAwAA/unqq6/u8ZWvfOX8Pn36nJWXl9dCR4CkSafT9UuXLh3/X//1Xw/84he/WKMjAABAEnUYVhsFXXb+MwEwAADwkZ1xxhntb7/99rMPPPDA8/Pz81vrCJDtmpqaqhcsWPDgd77znUcmTpzotC8AAJBoAmAAAGC3GD58eMkPf/jDzwwePPjioqKijjoCZJv6+voNr7322u9vvPHGx2fPnl2jIwAAQC4QAAMAALvV0KFDi++5556zDjnkkPOKioq66giwt9XV1a19/fXXH7z++uvHC34BAIBcIwAGAAD2iFatWuXdc889w0455ZTzO3bseJSOAHtYZsOGDbOmTJny4PXXX/9qbW1tWksAAIBcJAAGAAD2uH/913/tf/7555/dq1ev0/Ly8lroCLC7pNPp+pUrV05+4IEHHvnOd76zSEcAAIBcJwAGAAD2mjPOOKP97bfffvYBBxzw2YKCgjY6AuwqjY2NVW+++eafv/e97z06YcKETToCAAA0FwJgAABgrxs+fHjJ97///dGDBg0aU1paur+OAB9XdXX1wtdee+3Rr371q1Nfe+21Wh0BAACaGwEwAACQVb761a/ue8EFF3y6b9++ZxUUFLTWEeCDNDY2bnnrrbfG/+EPf5j4ox/9aLmOAAAAzZkAGAAAyEpDhw4t/sEPfnDy4MGDz27dunV/HQHerbq6+s2XX375weuuu+7ppUuXbtcRAAAAATAAAJDlCgsLU3ffffeQ0aNHn9G1a9fj8vLyinQFmq90Ol1XXl4+bcqUKROuvfbav+sIAADA/yYABgAAEqNPnz4t/v3f/33UyJEjz2rfvv2nIiKlK9AsZDZt2vTXF1544bGvfe1rzzntCwAA8N4EwAAAQCJddNFFXa6++uqTDzzwwLNbtmzZTUcg99TV1a1ZsGDBuJ/+9KdP3n///et0BAAA4IMJgAEAgETr1q1b4d13333k4YcffmqHDh2OyMvLK9QVSK50Ot2wcePGWbNmzZp8/fXXz6qoqGjUFQAAgA9PAAwAAOSMo48+uvWtt956/CGHHHJKu3btBkdEnq5AIqQrKytfmzdv3uQ777xz+owZM6q1BAAA4OMRAAMAADnpuOOOK/vGN75x/CGHHHJa27ZtB4bvBUO2yVRVVc2dN2/epO9///vTpk+fvkVLAAAAPjkBMAAAkPNuu+22vmedddZJffr0Oa5Vq1a9dQT2ntra2uXLly+f/uijjz51xx13vKUjAAAAu5YAGAAAaFa+9KUvdbv44ouP7t+//wlOBsMekamqqpq7cOHCv/z+97+fcd9995VrCQAAwO4jAAYAAJqtSy65pOtll112jDAYdrl0VVXVvIULF/7lV7/61bO/+93v1moJAADAniEABgAAiIirr766x/nnnz9q//33P7JNmzZDUqlUga7Ah5fJZBoqKyv/vnjx4uf+9Kc/zbr33ntX6woAAMCeJwAGAAB4l379+hV97WtfGzRy5MhRPXv2PLaoqKizrsD/VV9fv37VqlXPvPDCC8/9+7//+5zFixfX6woAAMDeJQAGAAB4H61bt8678847Bx599NFHde/efURpaen+4apomq/M1q1bF69Zs+bF5557btY3v/nNOdXV1WltAQAAyB4CYAAAgI9g8ODBrcaOHXvI8OHDD+vevfvw1q1bHxACYXJXprq6+s01a9a88sorr7z8k5/8ZN5rr71Wqy0AAADZSwAMAADwCVx//fX7nHHGGYf169dvePv27Yfm5+e31hWSrLGxsXrjxo2vvvXWWy+PHz/+lR//+McrdQUAACA5BMAAAAC70Je//OUe55xzzvA+ffoM7tix45CioqKuukI2q6+vX7t27doXFy9ePGfixImv3Xvvvat1BQAAILkEwAAAALvRl7/85R6f+cxnBvfr129Qly5dDm/ZsqVAmL2qrq5u7bp16wS+AAAAOUoADAAAsIe0atUq75prrtnn2GOPPXi//fY7uH379oeUlpb2TaVS+brDbpKuqalZtnHjxnlvvfXW3GeffXbef/3Xfy2vra1Naw0AAEBuEgADAADsRQceeGDLq6+++oAhQ4Yc3LNnz4Pbtm17sGuj+biampqqq6qqXi8vL583Z86ceb/85S/nvfjii1t1BgAAoPkQAAMAAGSZoUOHFn/xi1/cf9CgQQf26NHjwHbt2h3YqlWr3qlUKk932CFdU1OzvLKycsHq1asXzJkzZ8Gf//znJTNmzKjWGgAAgOZNAAwAAJAAxx13XNkFF1xw4MEHH3xA165dDywtLd23pKRkn1QqVag7uS2TyTRs27ZtRXV19dJ169YtfOONNxZOmDBh4YQJEzbpDgAAAO8mAAYAAEiw8847r+OJJ57Yp3///vt16dKlT5s2bfZr3bp1v/z8/GLdSZampqaa6urqxZs3b16ybt26pQsXLlzy9NNPL33ooYc26A4AAAAflgAYAAAgx7Rr1y7/kksu6TFkyJCe++67b89OnTr1Kisr61VcXNyzZcuW3VKpVL4u7R2ZTKaprq6uvKamZtWWLVtWVlRUrFy6dOnK2bNnr7r//vvXVFZWNukSAAAAn4QAGAAAoBnp1KlTwec+97luQ4cO7bnPPvv0aNeuXafWrVt3Li4u7tqyZcvORUVFnfLy8lro1MeTTqe319fXr6+rq6uoqalZW11dvb6ysnL9ihUrVr/66qurHnzwwbUVFRWNOgUAAMDuIgAGAADgfznjjDPaH3bYYZ369OnTuUuXLp3Kysral5SUtC0uLu5YVFTUrqioqG2LFi065OfnlzaXnjQ1NW3dvn37xvr6+qr6+vrKmpqaDdu2bavasmXLpnXr1lUsXbp0/Ysvvrh+4sSJlZ4gAAAA9iYBMAAAAB9Lr169CkeNGtXuoIMOatexY8ey9u3bl7Zp06Z1SUlJWXFxcetWrVq1btGiRVlRUVHrwsLC1hGRX1hYWBoR+QUFBSV5eXkFeXl5u/0/LtPpdG06nW5sbGzcFhFNDQ0NW3f83+r6+vrq7du3b6mtra2uqamp3rZtW/XmzZurN23aVL1hw4YtCxYsqJo1a1bl0qVLt5s4AAAASSAABgAAYK/q169fUffu3Vvss88+xSUlJQVv//8LCwtT3bp1+8BTxuXl5VsbGhoyb//vbdu2Na5YsaJmzZo12xcvXlyvwwAAADQn7xcAF2gPAAAAu9vixYvrdwS11boBAAAAu0+eFgAAAAAAAADkBgEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4o0AIAAAAAAACA5GhoLIyCxoaIiEilIpNXGE1v/0wADAAAAAAAAJAghQUN/0x6MxGppvT/5L6ugAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAIb/v5272ZHiusM4/FZ1NUkz9sQwOF4EyZJtpJCwysa5jSy4n1xPEqRIuQFvvfGSgIwBOzGRQAQERnx0d1UW0cgWGvKxsMGvnmfVdc7/1OJsf+oCAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoMY3JP//9K8My551lzpAk293a7QAAAAAAAAD8iIw3r+SL7TpPxuSt4/ibJJuz20QDBgAAAAAAAHhzrJPp6NvHYcyyjLl7dJTPbl/Jp6sPLufSsM+5ec7q5YOrF0OeP/SVaAAAAAAAAIA3weH7u6zfm79dWDIMSw6225w785vsx3XyzasOby5ssz69c4sAAAAAAAAAr9n69C6bC9sT93a7rKdnORin5Otxynzi1JQcfiwCAwAAAAAAALxO69O7HH68TaaT98cp85R8vbp3Nfszv8q0LHn7xMF1sjk/ZzUPmZ/MmWefhAYAAAAAAAD4oayPdjn7223Gn7x6ZrXPnetX8mBKkpv3cufDd/Pufn5FL56SzcVtNheT3dNt8tQlAwAAAAAAAHyv1sm0ySv/9XtsNWZ3I/lHkgzHi7/4XY7WYz5yiwAAAAAAAAA/Ivtcv/3nPEyS1fHa42t5+vNLyX7JoRsCAAAAAAAAePPt1/nbV3/KvePn1Xc371/NYxEYAAAAAAAA4M0yTHk2rvNo2WdzvHZqzN9v/SF3vju3evng/at5fPDLPDu1yuGyZHSVAAAAAAAAAK/XOGe4ueSvZ4e8M8xZbVe5ceuPufvy3Oqkw4+v5emDX+fuuTlLhhwsEYIBAAAAAAAAXpclGR8OuXP0TR4cPM/9z/+SRyfNDf/1TZezOp/87KdjzizJZkhO7edMy/w/nAUAAAAAAADg/zaMWcZkP8/ZLsmLacr2/MV8+cnvs/tP5/4FmLjAq1ifcioAAAAASUVORK5CYII=";function H0($,q,Q){if(typeof $==="string"&&!isNaN(Number($)))$=Number($);if(typeof $==="number"&&$<100)return v0($);if(typeof $==="number"&&$>=100)return $;if(typeof $==="string"&&$.includes("%")){if(q&&q==="X")return Math.round(parseFloat($)/100*Q.width);if(q&&q==="Y")return Math.round(parseFloat($)/100*Q.height);return Math.round(parseFloat($)/100*Q.width)}return 0}function k5($){return $.replace(/[xy]/g,function(q){let Q=Math.random()*16|0;return(q==="x"?Q:Q&3|8).toString(16)})}function k0($){if(typeof $>"u"||$==null)return"";return $.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function v0($){if(typeof $==="number"&&$>100)return $;if(typeof $==="string")$=Number($.replace(/in*/gi,""));return Math.round(L0*$)}function Y0($){let q=Number($)||0;return isNaN(q)?0:Math.round(q*w8)}function S1($){return $=$||0,Math.round(($>360?$-360:$)*60000)}function g7($){let q=$.toString(16);return q.length===1?"0"+q:q}function A7($,q,Q){return(g7($)+g7(q)+g7(Q)).toUpperCase()}function R0($,q){let Q=($||"").replace("#","");if(!j7.test(Q)&&Q!==G2.background1&&Q!==G2.background2&&Q!==G2.text1&&Q!==G2.text2&&Q!==G2.accent1&&Q!==G2.accent2&&Q!==G2.accent3&&Q!==G2.accent4&&Q!==G2.accent5&&Q!==G2.accent6)console.warn(`"${Q}" is not a valid scheme color or hex RGB! "${Q2}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`),Q=Q2;let K=j7.test(Q)?"srgbClr":"schemeClr",J='val="'+(j7.test(Q)?Q.toUpperCase():Q)+'"';return q?`${q}`:``}function fB($,q){let Q="",K=Object.assign(Object.assign({},q),$),J=Math.round(K.size*w8),Z=K.color,G=Math.round(K.opacity*1e5);return Q+=``,Q+=R0(Z,``),Q+="",Q}function B2($){let q="solid",Q="",K="",J="";if($){if(typeof $==="string")Q=$;else{if($.type)q=$.type;if($.color)Q=$.color;if($.alpha)K+=``;if($.transparency)K+=``}switch(q){case"solid":J+=`${R0(Q,K)}`;break;default:J+="";break}}return J}function a2($){return $._rels.length+$._relsChart.length+$._relsMedia.length+1}function b7($){if(!$||typeof $!=="object")return;if($.type!=="outer"&&$.type!=="inner"&&$.type!=="none")console.warn("Warning: shadow.type options are `outer`, `inner` or `none`."),$.type="outer";if($.angle){if(isNaN(Number($.angle))||$.angle<0||$.angle>359)console.warn("Warning: shadow.angle can only be 0-359"),$.angle=270;$.angle=Math.round(Number($.angle))}if($.opacity){if(isNaN(Number($.opacity))||$.opacity<0||$.opacity>1)console.warn("Warning: shadow.opacity can only be 0-1"),$.opacity=0.75;$.opacity=Number($.opacity)}if($.color){if($.color.startsWith("#"))console.warn('Warning: shadow.color should not include hash (#) character, , e.g. "FF0000"'),$.color=$.color.replace("#","")}return $}function RB($,q,Q){var K,J;let Z=2.3+(((K=$.options)===null||K===void 0?void 0:K.autoPageCharWeight)?$.options.autoPageCharWeight:0),G=Math.floor(q/w8*L0)/((((J=$.options)===null||J===void 0?void 0:J.fontSize)?$.options.fontSize:k2)/Z),W=[],B=[],V=[],U=[];if($.text&&$.text.toString().trim().length===0)B.push({_type:D0.tablecell,text:" "});else if(typeof $.text==="number"||typeof $.text==="string")B.push({_type:D0.tablecell,text:($.text||"").toString().trim()});else if(Array.isArray($.text))B=$.text;let w=[];return B.forEach((F)=>{var M;if(typeof F.text==="string"){if(F.text.split(` +`,"\t"],wW=["{","}","|","\\","^","`"].concat(MW),Y7=["'"].concat(wW),yK=["%","/","?",";","#"].concat(Y7),hK=["/","?","#"],xK=/^[+a-z0-9A-Z_-]{0,63}$/,YW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kW={javascript:!0,"javascript:":!0},k7={javascript:!0,"javascript:":!0},k6={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},D7={parse($){var q=decodeURIComponent;return($+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(Q,K,J){var Z=K.split("="),G=q(Z[0]||""),W=q(Z[1]||""),B=Q[G];return Q[G]=B===void 0?W:[].concat(B,W),Q},{})},stringify($){var q=encodeURIComponent;return Object.keys($||{}).reduce(function(Q,K){return[].concat($[K]).forEach(function(J){Q.push(q(K)+"="+q(J))}),Q},[]).join("&").replace(/\s/g,"+")}};Z2.prototype.parse=function($,q,Q){if(!H7($))throw TypeError("Parameter 'url' must be a string, not "+typeof $);var K=$.indexOf("?"),J=K!==-1&&K<$.indexOf("#")?"?":"#",Z=$.split(J),G=/\\/g;Z[0]=Z[0].replace(G,"/"),$=Z.join(J);var W=$;if(W=W.trim(),!Q&&$.split("#").length===1){var B=FW.exec(W);if(B){if(this.path=W,this.href=W,this.pathname=B[1],B[2])if(this.search=B[2],q)this.query=D7.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(q)this.search="",this.query={};return this}}var V=BW.exec(W);if(V){V=V[0];var U=V.toLowerCase();this.protocol=U,W=W.substr(V.length)}if(Q||V||W.match(/^\/\/[^@\/]+@[^@\/]+/)){var w=W.substr(0,2)==="//";if(w&&!(V&&k7[V]))W=W.substr(2),this.slashes=!0}if(!k7[V]&&(w||V&&!k6[V])){var F=-1;for(var M=0;M127)v+="x";else v+=H[j];if(!v.match(xK)){var d=z.slice(0,M),_=z.slice(M+1),X=H.match(YW);if(X)d.push(X[1]),_.unshift(X[2]);if(_.length)W="/"+_.join(".")+W;this.hostname=d.join(".");break}}}}if(this.hostname.length>NW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!D)this.hostname=new L7(`https://${this.hostname}`).hostname;var P=this.port?":"+this.port:"",g=this.hostname||"";if(this.host=g+P,this.href+=this.host,D){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),W[0]!=="/")W="/"+W}}if(!kW[U])for(var M=0,N=Y7.length;M0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(Q.search=$.search,Q.query=$.query,!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.href=Q.format(),Q}if(!z.length){if(Q.pathname=null,Q.search)Q.path="/"+Q.search;else Q.path=null;return Q.href=Q.format(),Q}var j=z.slice(-1)[0],n=(Q.host||$.host||z.length>1)&&(j==="."||j==="..")||j==="",d=0;for(var _=z.length;_>=0;_--)if(j=z[_],j===".")z.splice(_,1);else if(j==="..")z.splice(_,1),d++;else if(d)z.splice(_,1),d--;if(!L&&!D)for(;d--;d)z.unshift("..");if(L&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/"))z.unshift("");if(n&&z.join("/").substr(-1)!=="/")z.push("");var X=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){Q.hostname=Q.host=X?"":z.length?z.shift():"";var v=Q.host&&Q.host.indexOf("@")>0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(L=L||Q.host&&z.length,L&&!X)z.unshift("");if(!z.length)Q.pathname=null,Q.path=null;else Q.pathname=z.join("/");if(!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.auth=$.auth||Q.auth,Q.slashes=Q.slashes||$.slashes,Q.href=Q.format(),Q};Z2.prototype.parseHost=function(){var $=this.host,q=zW.exec($);if(q){if(q=q[0],q!==":")this.port=q.substr(1);$=$.substr(0,$.length-q.length)}if($)this.hostname=$};DW={parse:D6,resolve:uK,resolveObject:SK,format:TK,Url:Z2,URL:L7,URLSearchParams:OK}});var I7={};c1(I7,{request:()=>_W,globalAgent:()=>mW,get:()=>cW,default:()=>oW,STATUS_CODES:()=>pW,METHODS:()=>iW,IncomingMessage:()=>nW,ClientRequest:()=>bW,Agent:()=>dW});function RW($){return this[$]}var LW,HW,EK,vW,fW,IW,CW,jW=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?IW??=new WeakMap:CW??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?LW(HW($)):{};let G=q||!$||!$.__esModule?EK(Q,"default",{value:$,enumerable:!0}):Q;for(let W of vW($))if(!fW.call(G,W))EK(G,W,{get:RW.bind($,W),enumerable:!0});if(K)J.set($,G);return G},h0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),cK,gW,x1,AW,bK,O1,nK,XW,dK,L6,yW,_K,R7,hW,xW,mK,pK,OW,PW,iK,oK,TW,uW,SW,EW,aK,_W,cW,bW,nW,dW,mW,pW,iW,oW;var C7=b1(()=>{LW=Object.create,{getPrototypeOf:HW,defineProperty:EK,getOwnPropertyNames:vW}=Object,fW=Object.prototype.hasOwnProperty;cK=h0(($)=>{$.fetch=J(globalThis.fetch)&&J(globalThis.ReadableStream),$.writableStream=J(globalThis.WritableStream),$.abortController=J(globalThis.AbortController);var q;function Q(){if(q!==void 0)return q;if(globalThis.XMLHttpRequest){q=new globalThis.XMLHttpRequest;try{q.open("GET",globalThis.XDomainRequest?"/":"https://example.com")}catch(Z){q=null}}else q=null;return q}function K(Z){var G=Q();if(!G)return!1;try{return G.responseType=Z,G.responseType===Z}catch(W){}return!1}$.arraybuffer=$.fetch||K("arraybuffer"),$.msstream=!$.fetch&&K("ms-stream"),$.mozchunkedarraybuffer=!$.fetch&&K("moz-chunked-arraybuffer"),$.overrideMimeType=$.fetch||(Q()?J(Q().overrideMimeType):!1);function J(Z){return typeof Z==="function"}q=null}),gW=h0(($,q)=>{if(typeof Object.create==="function")q.exports=function(Q,K){if(K)Q.super_=K,Q.prototype=Object.create(K.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else q.exports=function(Q,K){if(K){Q.super_=K;var J=function(){};J.prototype=K.prototype,Q.prototype=new J,Q.prototype.constructor=Q}}}),x1=h0(($,q)=>{try{if(Q=(G8(),X0(Z8)),typeof Q.inherits!=="function")throw"";q.exports=Q.inherits}catch(K){q.exports=gW()}var Q}),AW=h0(($,q)=>{function Q(L,D){var z=Object.keys(L);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(L);D&&(N=N.filter(function(H){return Object.getOwnPropertyDescriptor(L,H).enumerable})),z.push.apply(z,N)}return z}function K(L){for(var D=1;D0)this.tail.next=z;else this.head=z;this.tail=z,++this.length}},{key:"unshift",value:function(D){var z={data:D,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var D=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,D}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(D){if(this.length===0)return"";var z=this.head,N=""+z.data;while(z=z.next)N+=D+z.data;return N}},{key:"concat",value:function(D){if(this.length===0)return w.alloc(0);var z=w.allocUnsafe(D>>>0),N=this.head,H=0;while(N)f(N.data,z,H),H+=N.data.length,N=N.next;return z}},{key:"consume",value:function(D,z){var N;if(Dv.length?v.length:D;if(j===v.length)H+=v;else H+=v.slice(0,D);if(D-=j,D===0){if(j===v.length)if(++N,z.next)this.head=z.next;else this.head=this.tail=null;else this.head=z,z.data=v.slice(j);break}++N}return this.length-=N,H}},{key:"_getBuffer",value:function(D){var z=w.allocUnsafe(D),N=this.head,H=1;N.data.copy(z),D-=N.data.length;while(N=N.next){var v=N.data,j=D>v.length?v.length:D;if(v.copy(z,z.length-D,0,j),D-=j,D===0){if(j===v.length)if(++H,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=v.slice(j);break}++H}return this.length-=H,z}},{key:k,value:function(D,z){return M(this,K(K({},z),{},{depth:0,customInspect:!1}))}}]),L}()}),bK=h0(($,q)=>{function Q(B,V){var U=this,w=this._readableState&&this._readableState.destroyed,F=this._writableState&&this._writableState.destroyed;if(w||F){if(V)V(B);else if(B){if(!this._writableState)process.nextTick(G,this,B);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,process.nextTick(G,this,B)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(B||null,function(M){if(!V&&M)if(!U._writableState)process.nextTick(K,U,M);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,process.nextTick(K,U,M);else process.nextTick(J,U);else if(V)process.nextTick(J,U),V(M);else process.nextTick(J,U)}),this}function K(B,V){G(B,V),J(B)}function J(B){if(B._writableState&&!B._writableState.emitClose)return;if(B._readableState&&!B._readableState.emitClose)return;B.emit("close")}function Z(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function G(B,V){B.emit("error",V)}function W(B,V){var{_readableState:U,_writableState:w}=B;if(U&&U.autoDestroy||w&&w.autoDestroy)B.destroy(V);else B.emit("error",V)}q.exports={destroy:Q,undestroy:Z,errorOrDestroy:W}}),O1=h0(($,q)=>{var Q={};function K(B,V,U){if(!U)U=Error;function w(M,k,f){if(typeof V==="string")return V;else return V(M,k,f)}class F extends U{constructor(M,k,f){super(w(M,k,f))}}F.prototype.name=U.name,F.prototype.code=B,Q[B]=F}function J(B,V){if(Array.isArray(B)){let U=B.length;if(B=B.map((w)=>String(w)),U>2)return`one of ${V} ${B.slice(0,U-1).join(", ")}, or `+B[U-1];else if(U===2)return`one of ${V} ${B[0]} or ${B[1]}`;else return`of ${V} ${B[0]}`}else return`of ${V} ${String(B)}`}function Z(B,V,U){return B.substr(!U||U<0?0:+U,V.length)===V}function G(B,V,U){if(U===void 0||U>B.length)U=B.length;return B.substring(U-V.length,U)===V}function W(B,V,U){if(typeof U!=="number")U=0;if(U+V.length>B.length)return!1;else return B.indexOf(V,U)!==-1}K("ERR_INVALID_OPT_VALUE",function(B,V){return'The value "'+V+'" is invalid for option "'+B+'"'},TypeError),K("ERR_INVALID_ARG_TYPE",function(B,V,U){let w;if(typeof V==="string"&&Z(V,"not "))w="must not be",V=V.replace(/^not /,"");else w="must be";let F;if(G(B," argument"))F=`The ${B} ${w} ${J(V,"type")}`;else{let M=W(B,".")?"property":"argument";F=`The "${B}" ${M} ${w} ${J(V,"type")}`}return F+=`. Received type ${typeof U}`,F},TypeError),K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),K("ERR_METHOD_NOT_IMPLEMENTED",function(B){return"The "+B+" method is not implemented"}),K("ERR_STREAM_PREMATURE_CLOSE","Premature close"),K("ERR_STREAM_DESTROYED",function(B){return"Cannot call "+B+" after a stream was destroyed"}),K("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),K("ERR_STREAM_WRITE_AFTER_END","write after end"),K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),K("ERR_UNKNOWN_ENCODING",function(B){return"Unknown encoding: "+B},TypeError),K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$.codes=Q}),nK=h0(($,q)=>{var Q=O1().codes.ERR_INVALID_OPT_VALUE;function K(Z,G,W){return Z.highWaterMark!=null?Z.highWaterMark:G?Z[W]:null}function J(Z,G,W,B){var V=K(G,B,W);if(V!=null){if(!(isFinite(V)&&Math.floor(V)===V)||V<0){var U=B?W:"highWaterMark";throw new Q(U,V)}return Math.floor(V)}return Z.objectMode?16:16384}q.exports={getHighWaterMark:J}}),XW=h0(($,q)=>{q.exports=(G8(),X0(Z8)).deprecate}),dK=h0(($,q)=>{q.exports=X;function Q(S){var b=this;this.next=null,this.entry=null,this.finish=function(){w0(b,S)}}var K;X.WritableState=d;var J={deprecate:XW()},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(S){return G.from(S)}function V(S){return G.isBuffer(S)||S instanceof W}var U=bK(),w=nK(),F=w.getHighWaterMark,M=O1().codes,k=M.ERR_INVALID_ARG_TYPE,f=M.ERR_METHOD_NOT_IMPLEMENTED,L=M.ERR_MULTIPLE_CALLBACK,D=M.ERR_STREAM_CANNOT_PIPE,z=M.ERR_STREAM_DESTROYED,N=M.ERR_STREAM_NULL_VALUES,H=M.ERR_STREAM_WRITE_AFTER_END,v=M.ERR_UNKNOWN_ENCODING,j=U.errorOrDestroy;x1()(X,Z);function n(){}function d(S,b,O){if(K=K||L6(),S=S||{},typeof O!=="boolean")O=b instanceof K;if(this.objectMode=!!S.objectMode,O)this.objectMode=this.objectMode||!!S.writableObjectMode;this.highWaterMark=F(this,S,"writableHighWaterMark",O),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var E=S.decodeStrings===!1;this.decodeStrings=!E,this.defaultEncoding=S.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){Z0(b,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=S.emitClose!==!1,this.autoDestroy=!!S.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Q(this)}d.prototype.getBuffer=function(){var S=this.bufferedRequest,b=[];while(S)b.push(S),S=S.next;return b},function(){try{Object.defineProperty(d.prototype,"buffer",{get:J.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(S){}}();var _;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")_=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(S){if(_.call(this,S))return!0;if(this!==X)return!1;return S&&S._writableState instanceof d}});else _=function(S){return S instanceof this};function X(S){K=K||L6();var b=this instanceof K;if(!b&&!_.call(X,this))return new X(S);if(this._writableState=new d(S,this,b),this.writable=!0,S){if(typeof S.write==="function")this._write=S.write;if(typeof S.writev==="function")this._writev=S.writev;if(typeof S.destroy==="function")this._destroy=S.destroy;if(typeof S.final==="function")this._final=S.final}Z.call(this)}X.prototype.pipe=function(){j(this,new D)};function P(S,b){var O=new H;j(S,O),process.nextTick(b,O)}function g(S,b,O,E){var a;if(O===null)a=new N;else if(typeof O!=="string"&&!b.objectMode)a=new k("chunk",["string","Buffer"],O);if(a)return j(S,a),process.nextTick(E,a),!1;return!0}X.prototype.write=function(S,b,O){var E=this._writableState,a=!1,K0=!E.objectMode&&V(S);if(K0&&!G.isBuffer(S))S=B(S);if(typeof b==="function")O=b,b=null;if(K0)b="buffer";else if(!b)b=E.defaultEncoding;if(typeof O!=="function")O=n;if(E.ending)P(this,O);else if(K0||g(this,E,S,O))E.pendingcb++,a=h(this,E,K0,S,b,O);return a},X.prototype.cork=function(){this._writableState.corked++},X.prototype.uncork=function(){var S=this._writableState;if(S.corked){if(S.corked--,!S.writing&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest)W0(this,S)}},X.prototype.setDefaultEncoding=function(S){if(typeof S==="string")S=S.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((S+"").toLowerCase())>-1))throw new v(S);return this._writableState.defaultEncoding=S,this},Object.defineProperty(X.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function c(S,b,O){if(!S.objectMode&&S.decodeStrings!==!1&&typeof b==="string")b=G.from(b,O);return b}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function h(S,b,O,E,a,K0){if(!O){var R=c(b,E,a);if(E!==R)O=!0,a="buffer",E=R}var Y=b.objectMode?1:E.length;b.length+=Y;var C=b.length{var Q=Object.keys||function(w){var F=[];for(var M in w)F.push(M);return F};q.exports=B;var K=mK(),J=dK();x1()(B,K);{Z=Q(J.prototype);for(W=0;W{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),_K=h0(($)=>{var q=yW().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),R7=h0(($,q)=>{var Q=O1().codes.ERR_STREAM_PREMATURE_CLOSE;function K(W){var B=!1;return function(){if(B)return;B=!0;for(var V=arguments.length,U=Array(V),w=0;w{var Q;function K(v,j,n){if(j=J(j),j in v)Object.defineProperty(v,j,{value:n,enumerable:!0,configurable:!0,writable:!0});else v[j]=n;return v}function J(v){var j=Z(v,"string");return typeof j==="symbol"?j:String(j)}function Z(v,j){if(typeof v!=="object"||v===null)return v;var n=v[Symbol.toPrimitive];if(n!==void 0){var d=n.call(v,j||"default");if(typeof d!=="object")return d;throw TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(v)}var G=R7(),W=Symbol("lastResolve"),B=Symbol("lastReject"),V=Symbol("error"),U=Symbol("ended"),w=Symbol("lastPromise"),F=Symbol("handlePromise"),M=Symbol("stream");function k(v,j){return{value:v,done:j}}function f(v){var j=v[W];if(j!==null){var n=v[M].read();if(n!==null)v[w]=null,v[W]=null,v[B]=null,j(k(n,!1))}}function L(v){process.nextTick(f,v)}function D(v,j){return function(n,d){v.then(function(){if(j[U]){n(k(void 0,!0));return}j[F](n,d)},d)}}var z=Object.getPrototypeOf(function(){}),N=Object.setPrototypeOf((Q={get stream(){return this[M]},next:function(){var v=this,j=this[V];if(j!==null)return Promise.reject(j);if(this[U])return Promise.resolve(k(void 0,!0));if(this[M].destroyed)return new Promise(function(X,P){process.nextTick(function(){if(v[V])P(v[V]);else X(k(void 0,!0))})});var n=this[w],d;if(n)d=new Promise(D(n,this));else{var _=this[M].read();if(_!==null)return Promise.resolve(k(_,!1));d=new Promise(this[F])}return this[w]=d,d}},K(Q,Symbol.asyncIterator,function(){return this}),K(Q,"return",function(){var v=this;return new Promise(function(j,n){v[M].destroy(null,function(d){if(d){n(d);return}j(k(void 0,!0))})})}),Q),z),H=function(v){var j,n=Object.create(N,(j={},K(j,M,{value:v,writable:!0}),K(j,W,{value:null,writable:!0}),K(j,B,{value:null,writable:!0}),K(j,V,{value:null,writable:!0}),K(j,U,{value:v._readableState.endEmitted,writable:!0}),K(j,F,{value:function(d,_){var X=n[M].read();if(X)n[w]=null,n[W]=null,n[B]=null,d(k(X,!1));else n[W]=d,n[B]=_},writable:!0}),j));return n[w]=null,G(v,function(d){if(d&&d.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=n[B];if(_!==null)n[w]=null,n[W]=null,n[B]=null,_(d);n[V]=d;return}var X=n[W];if(X!==null)n[w]=null,n[W]=null,n[B]=null,X(k(void 0,!0));n[U]=!0}),v.on("readable",L.bind(null,n)),n};q.exports=H}),xW=h0(($,q)=>{function Q(w,F,M,k,f,L,D){try{var z=w[L](D),N=z.value}catch(H){M(H);return}if(z.done)F(N);else Promise.resolve(N).then(k,f)}function K(w){return function(){var F=this,M=arguments;return new Promise(function(k,f){var L=w.apply(F,M);function D(N){Q(L,k,f,D,z,"next",N)}function z(N){Q(L,k,f,D,z,"throw",N)}D(void 0)})}}function J(w,F){var M=Object.keys(w);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(w);F&&(k=k.filter(function(f){return Object.getOwnPropertyDescriptor(w,f).enumerable})),M.push.apply(M,k)}return M}function Z(w){for(var F=1;F{q.exports=g;var Q;g.ReadableState=P;var K=(i1(),X0(p1)).EventEmitter,J=function(R,Y){return R.listeners(Y).length},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(R){return G.from(R)}function V(R){return G.isBuffer(R)||R instanceof W}var U=(G8(),X0(Z8)),w;if(U&&U.debuglog)w=U.debuglog("stream");else w=function(){};var F=AW(),M=bK(),k=nK(),f=k.getHighWaterMark,L=O1().codes,D=L.ERR_INVALID_ARG_TYPE,z=L.ERR_STREAM_PUSH_AFTER_EOF,N=L.ERR_METHOD_NOT_IMPLEMENTED,H=L.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,j,n;x1()(g,Z);var d=M.errorOrDestroy,_=["error","close","destroy","pause","resume"];function X(R,Y,C){if(typeof R.prependListener==="function")return R.prependListener(Y,C);if(!R._events||!R._events[Y])R.on(Y,C);else if(Array.isArray(R._events[Y]))R._events[Y].unshift(C);else R._events[Y]=[C,R._events[Y]]}function P(R,Y,C){if(Q=Q||L6(),R=R||{},typeof C!=="boolean")C=Y instanceof Q;if(this.objectMode=!!R.objectMode,C)this.objectMode=this.objectMode||!!R.readableObjectMode;if(this.highWaterMark=f(this,R,"readableHighWaterMark",C),this.buffer=new F,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.destroyed=!1,this.defaultEncoding=R.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,R.encoding){if(!v)v=_K().StringDecoder;this.decoder=new v(R.encoding),this.encoding=R.encoding}}function g(R){if(Q=Q||L6(),!(this instanceof g))return new g(R);var Y=this instanceof Q;if(this._readableState=new P(R,this,Y),this.readable=!0,R){if(typeof R.read==="function")this._read=R.read;if(typeof R.destroy==="function")this._destroy=R.destroy}Z.call(this)}Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(R){if(!this._readableState)return;this._readableState.destroyed=R}}),g.prototype.destroy=M.destroy,g.prototype._undestroy=M.undestroy,g.prototype._destroy=function(R,Y){Y(R)},g.prototype.push=function(R,Y){var C=this._readableState,u;if(!C.objectMode){if(typeof R==="string"){if(Y=Y||C.defaultEncoding,Y!==C.encoding)R=G.from(R,Y),Y="";u=!0}}else u=!0;return c(this,R,Y,!1,u)},g.prototype.unshift=function(R){return c(this,R,null,!0,!1)};function c(R,Y,C,u,e){w("readableAddChunk",Y);var r=R._readableState;if(Y===null)r.reading=!1,F0(R,r);else{var s;if(!e)s=x(r,Y);if(s)d(R,s);else if(r.objectMode||Y&&Y.length>0){if(typeof Y!=="string"&&!r.objectMode&&Object.getPrototypeOf(Y)!==G.prototype)Y=B(Y);if(u)if(r.endEmitted)d(R,new H);else h(R,r,Y,!0);else if(r.ended)d(R,new z);else if(r.destroyed)return!1;else if(r.reading=!1,r.decoder&&!C)if(Y=r.decoder.write(Y),r.objectMode||Y.length!==0)h(R,r,Y,!1);else y(R,r);else h(R,r,Y,!1)}else if(!u)r.reading=!1,y(R,r)}return!r.ended&&(r.length=l)R=l;else R--,R|=R>>>1,R|=R>>>2,R|=R>>>4,R|=R>>>8,R|=R>>>16,R++;return R}function Z0(R,Y){if(R<=0||Y.length===0&&Y.ended)return 0;if(Y.objectMode)return 1;if(R!==R)if(Y.flowing&&Y.length)return Y.buffer.head.data.length;else return Y.length;if(R>Y.highWaterMark)Y.highWaterMark=$0(R);if(R<=Y.length)return R;if(!Y.ended)return Y.needReadable=!0,0;return Y.length}g.prototype.read=function(R){w("read",R),R=parseInt(R,10);var Y=this._readableState,C=R;if(R!==0)Y.emittedReadable=!1;if(R===0&&Y.needReadable&&((Y.highWaterMark!==0?Y.length>=Y.highWaterMark:Y.length>0)||Y.ended)){if(w("read: emitReadable",Y.length,Y.ended),Y.length===0&&Y.ended)E(this);else p(this);return null}if(R=Z0(R,Y),R===0&&Y.ended){if(Y.length===0)E(this);return null}var u=Y.needReadable;if(w("need readable",u),Y.length===0||Y.length-R0)e=O(R,Y);else e=null;if(e===null)Y.needReadable=Y.length<=Y.highWaterMark,R=0;else Y.length-=R,Y.awaitDrain=0;if(Y.length===0){if(!Y.ended)Y.needReadable=!0;if(C!==R&&Y.ended)E(this)}if(e!==null)this.emit("data",e);return e};function F0(R,Y){if(w("onEofChunk"),Y.ended)return;if(Y.decoder){var C=Y.decoder.end();if(C&&C.length)Y.buffer.push(C),Y.length+=Y.objectMode?1:C.length}if(Y.ended=!0,Y.sync)p(R);else if(Y.needReadable=!1,!Y.emittedReadable)Y.emittedReadable=!0,W0(R)}function p(R){var Y=R._readableState;if(w("emitReadable",Y.needReadable,Y.emittedReadable),Y.needReadable=!1,!Y.emittedReadable)w("emitReadable",Y.flowing),Y.emittedReadable=!0,process.nextTick(W0,R)}function W0(R){var Y=R._readableState;if(w("emitReadable_",Y.destroyed,Y.length,Y.ended),!Y.destroyed&&(Y.length||Y.ended))R.emit("readable"),Y.emittedReadable=!1;Y.needReadable=!Y.flowing&&!Y.ended&&Y.length<=Y.highWaterMark,b(R)}function y(R,Y){if(!Y.readingMore)Y.readingMore=!0,process.nextTick(i,R,Y)}function i(R,Y){while(!Y.reading&&!Y.ended&&(Y.length1&&K0(u.pipes,R)!==-1)&&!G0)w("false write response, pause",u.awaitDrain),u.awaitDrain++;C.pause()}}function I0(O0){if(w("onerror",O0),q2(),R.removeListener("error",I0),J(R,"error")===0)d(R,O0)}X(R,"error",I0);function m0(){R.removeListener("finish",p0),q2()}R.once("close",m0);function p0(){w("onfinish"),R.removeListener("close",m0),q2()}R.once("finish",p0);function q2(){w("unpipe"),C.unpipe(R)}if(R.emit("pipe",C),!u.flowing)w("pipe resume"),C.resume();return R};function U0(R){return function(){var Y=R._readableState;if(w("pipeOnDrain",Y.awaitDrain),Y.awaitDrain)Y.awaitDrain--;if(Y.awaitDrain===0&&J(R,"data"))Y.flowing=!0,b(R)}}g.prototype.unpipe=function(R){var Y=this._readableState,C={hasUnpiped:!1};if(Y.pipesCount===0)return this;if(Y.pipesCount===1){if(R&&R!==Y.pipes)return this;if(!R)R=Y.pipes;if(Y.pipes=null,Y.pipesCount=0,Y.flowing=!1,R)R.emit("unpipe",this,C);return this}if(!R){var{pipes:u,pipesCount:e}=Y;Y.pipes=null,Y.pipesCount=0,Y.flowing=!1;for(var r=0;r0,u.flowing!==!1)this.resume()}else if(R==="readable"){if(!u.endEmitted&&!u.readableListening){if(u.readableListening=u.needReadable=!0,u.flowing=!1,u.emittedReadable=!1,w("on readable",u.length,u.reading),u.length)p(this);else if(!u.reading)process.nextTick(V0,this)}}return C},g.prototype.addListener=g.prototype.on,g.prototype.removeListener=function(R,Y){var C=Z.prototype.removeListener.call(this,R,Y);if(R==="readable")process.nextTick(m,this);return C},g.prototype.removeAllListeners=function(R){var Y=Z.prototype.removeAllListeners.apply(this,arguments);if(R==="readable"||R===void 0)process.nextTick(m,this);return Y};function m(R){var Y=R._readableState;if(Y.readableListening=R.listenerCount("readable")>0,Y.resumeScheduled&&!Y.paused)Y.flowing=!0;else if(R.listenerCount("data")>0)R.resume()}function V0(R){w("readable nexttick read 0"),R.read(0)}g.prototype.resume=function(){var R=this._readableState;if(!R.flowing)w("resume"),R.flowing=!R.readableListening,w0(this,R);return R.paused=!1,this};function w0(R,Y){if(!Y.resumeScheduled)Y.resumeScheduled=!0,process.nextTick(S,R,Y)}function S(R,Y){if(w("resume",Y.reading),!Y.reading)R.read(0);if(Y.resumeScheduled=!1,R.emit("resume"),b(R),Y.flowing&&!Y.reading)R.read(0)}g.prototype.pause=function(){if(w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)w("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function b(R){var Y=R._readableState;w("flow",Y.flowing);while(Y.flowing&&R.read()!==null);}if(g.prototype.wrap=function(R){var Y=this,C=this._readableState,u=!1;R.on("end",function(){if(w("wrapped end"),C.decoder&&!C.ended){var s=C.decoder.end();if(s&&s.length)Y.push(s)}Y.push(null)}),R.on("data",function(s){if(w("wrapped data"),C.decoder)s=C.decoder.write(s);if(C.objectMode&&(s===null||s===void 0))return;else if(!C.objectMode&&(!s||!s.length))return;var T=Y.push(s);if(!T)u=!0,R.pause()});for(var e in R)if(this[e]===void 0&&typeof R[e]==="function")this[e]=function(s){return function(){return R[s].apply(R,arguments)}}(e);for(var r=0;r<_.length;r++)R.on(_[r],this.emit.bind(this,_[r]));return this._read=function(s){if(w("wrapped _read",s),u)u=!1,R.resume()},this},typeof Symbol==="function")g.prototype[Symbol.asyncIterator]=function(){if(j===void 0)j=hW();return j(this)};Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(g.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(g.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){if(this._readableState)this._readableState.flowing=R}}),g._fromList=O,Object.defineProperty(g.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function O(R,Y){if(Y.length===0)return null;var C;if(Y.objectMode)C=Y.buffer.shift();else if(!R||R>=Y.length){if(Y.decoder)C=Y.buffer.join("");else if(Y.buffer.length===1)C=Y.buffer.first();else C=Y.buffer.concat(Y.length);Y.buffer.clear()}else C=Y.buffer.consume(R,Y.decoder);return C}function E(R){var Y=R._readableState;if(w("endReadable",Y.endEmitted),!Y.endEmitted)Y.ended=!0,process.nextTick(a,Y,R)}function a(R,Y){if(w("endReadableNT",R.endEmitted,R.length),!R.endEmitted&&R.length===0){if(R.endEmitted=!0,Y.readable=!1,Y.emit("end"),R.autoDestroy){var C=Y._writableState;if(!C||C.autoDestroy&&C.finished)Y.destroy()}}}if(typeof Symbol==="function")g.from=function(R,Y){if(n===void 0)n=xW();return n(g,R,Y)};function K0(R,Y){for(var C=0,u=R.length;C{q.exports=V;var Q=O1().codes,K=Q.ERR_METHOD_NOT_IMPLEMENTED,J=Q.ERR_MULTIPLE_CALLBACK,Z=Q.ERR_TRANSFORM_ALREADY_TRANSFORMING,G=Q.ERR_TRANSFORM_WITH_LENGTH_0,W=L6();x1()(V,W);function B(F,M){var k=this._transformState;k.transforming=!1;var f=k.writecb;if(f===null)return this.emit("error",new J);if(k.writechunk=null,k.writecb=null,M!=null)this.push(M);f(F);var L=this._readableState;if(L.reading=!1,L.needReadable||L.length{q.exports=K;var Q=pK();x1()(K,Q);function K(J){if(!(this instanceof K))return new K(J);Q.call(this,J)}K.prototype._transform=function(J,Z,G){G(null,J)}}),PW=h0(($,q)=>{var Q;function K(k){var f=!1;return function(){if(f)return;f=!0,k.apply(void 0,arguments)}}var J=O1().codes,Z=J.ERR_MISSING_ARGS,G=J.ERR_STREAM_DESTROYED;function W(k){if(k)throw k}function B(k){return k.setHeader&&typeof k.abort==="function"}function V(k,f,L,D){D=K(D);var z=!1;if(k.on("close",function(){z=!0}),Q===void 0)Q=R7();Q(k,{readable:f,writable:L},function(H){if(H)return D(H);z=!0,D()});var N=!1;return function(H){if(z)return;if(N)return;if(N=!0,B(k))return k.abort();if(typeof k.destroy==="function")return k.destroy();D(H||new G("pipe"))}}function U(k){k()}function w(k,f){return k.pipe(f)}function F(k){if(!k.length)return W;if(typeof k[k.length-1]!=="function")return W;return k.pop()}function M(){for(var k=arguments.length,f=Array(k),L=0;L0;return V(H,j,n,function(d){if(!z)z=d;if(d)N.forEach(U);if(j)return;N.forEach(U),D(z)})});return f.reduce(w)}q.exports=M}),iK=h0(($,q)=>{var Q=a1();$=q.exports=mK(),$.Stream=Q||$,$.Readable=$,$.Writable=dK(),$.Duplex=L6(),$.Transform=pK(),$.PassThrough=OW(),$.finished=R7(),$.pipeline=PW()}),oK=h0(($)=>{var q=cK(),Q=x1(),K=iK(),J=$.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Z=$.IncomingMessage=function(G,W,B,V){var U=this;if(K.Readable.call(U),U._mode=B,U.headers={},U.rawHeaders=[],U.trailers={},U.rawTrailers=[],U.on("end",function(){process.nextTick(function(){U.emit("close")})}),B==="fetch"){let D=function(){M.read().then(function(z){if(U._destroyed)return;if(V(z.done),z.done){U.push(null);return}U.push(Buffer.from(z.value)),D()}).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)})};var w=D;if(U._fetchResponse=W,U.url=W.url,U.statusCode=W.status,U.statusMessage=W.statusText,W.headers.forEach(function(z,N){U.headers[N.toLowerCase()]=z,U.rawHeaders.push(N,z)}),q.writableStream){var F=new WritableStream({write:function(z){return V(!1),new Promise(function(N,H){if(U._destroyed)H();else if(U.push(Buffer.from(z)))N();else U._resumeFetch=N})},close:function(){if(V(!0),!U._destroyed)U.push(null)},abort:function(z){if(V(!0),!U._destroyed)U.emit("error",z)}});try{W.body.pipeTo(F).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)});return}catch(z){}}var M=W.body.getReader();D()}else{U._xhr=G,U._pos=0,U.url=G.responseURL,U.statusCode=G.status,U.statusMessage=G.statusText;var k=G.getAllResponseHeaders().split(/\r?\n/);if(k.forEach(function(D){var z=D.match(/^([^:]+):\s*(.*)/);if(z){var N=z[1].toLowerCase();if(N==="set-cookie"){if(U.headers[N]===void 0)U.headers[N]=[];U.headers[N].push(z[2])}else if(U.headers[N]!==void 0)U.headers[N]+=", "+z[2];else U.headers[N]=z[2];U.rawHeaders.push(z[1],z[2])}}),U._charset="x-user-defined",!q.overrideMimeType){var f=U.rawHeaders["mime-type"];if(f){var L=f.match(/;\s*charset=([^;])(;|$)/);if(L)U._charset=L[1].toLowerCase()}if(!U._charset)U._charset="utf-8"}}};Q(Z,K.Readable),Z.prototype._read=function(){var G=this,W=G._resumeFetch;if(W)G._resumeFetch=null,W()},Z.prototype._onXHRProgress=function(G){var W=this,B=W._xhr,V=null;switch(W._mode){case"text":if(V=B.responseText,V.length>W._pos){var U=V.substr(W._pos);if(W._charset==="x-user-defined"){var w=Buffer.alloc(U.length);for(var F=0;FW._pos)W.push(Buffer.from(new Uint8Array(M.result.slice(W._pos)))),W._pos=M.result.byteLength},M.onload=function(){G(!0),W.push(null)},M.readAsArrayBuffer(V);break}if(W._xhr.readyState===J.DONE&&W._mode!=="ms-stream")G(!0),W.push(null)}}),TW=h0(($,q)=>{var Q=cK(),K=x1(),J=oK(),Z=iK(),G=J.IncomingMessage,W=J.readyStates;function B(F,M){if(Q.fetch&&M)return"fetch";else if(Q.mozchunkedarraybuffer)return"moz-chunked-arraybuffer";else if(Q.msstream)return"ms-stream";else if(Q.arraybuffer&&F)return"arraybuffer";else return"text"}var V=q.exports=function(F){var M=this;if(Z.Writable.call(M),M._opts=F,M._body=[],M._headers={},F.auth)M.setHeader("Authorization","Basic "+Buffer.from(F.auth).toString("base64"));Object.keys(F.headers).forEach(function(L){M.setHeader(L,F.headers[L])});var k,f=!0;if(F.mode==="disable-fetch"||"requestTimeout"in F&&!Q.abortController)f=!1,k=!0;else if(F.mode==="prefer-streaming")k=!1;else if(F.mode==="allow-wrong-content-type")k=!Q.overrideMimeType;else if(!F.mode||F.mode==="default"||F.mode==="prefer-fast")k=!0;else throw Error("Invalid value for opts.mode");M._mode=B(k,f),M._fetchTimer=null,M._socketTimeout=null,M._socketTimer=null,M.on("finish",function(){M._onFinish()})};K(V,Z.Writable),V.prototype.setHeader=function(F,M){var k=this,f=F.toLowerCase();if(w.indexOf(f)!==-1)return;k._headers[f]={name:F,value:M}},V.prototype.getHeader=function(F){var M=this._headers[F.toLowerCase()];if(M)return M.value;return null},V.prototype.removeHeader=function(F){var M=this;delete M._headers[F.toLowerCase()]},V.prototype._onFinish=function(){var F=this;if(F._destroyed)return;var M=F._opts;if("timeout"in M&&M.timeout!==0)F.setTimeout(M.timeout);var k=F._headers,f=null;if(M.method!=="GET"&&M.method!=="HEAD")f=new Blob(F._body,{type:(k["content-type"]||{}).value||""});var L=[];if(Object.keys(k).forEach(function(H){var v=k[H].name,j=k[H].value;if(Array.isArray(j))j.forEach(function(n){L.push([v,n])});else L.push([v,j])}),F._mode==="fetch"){var D=null;if(Q.abortController){var z=new AbortController;if(D=z.signal,F._fetchAbortController=z,"requestTimeout"in M&&M.requestTimeout!==0)F._fetchTimer=globalThis.setTimeout(function(){if(F.emit("requestTimeout"),F._fetchAbortController)F._fetchAbortController.abort()},M.requestTimeout)}globalThis.fetch(F._opts.url,{method:F._opts.method,headers:L,body:f||void 0,mode:"cors",credentials:M.withCredentials?"include":"same-origin",signal:D}).then(function(H){F._fetchResponse=H,F._resetTimers(!1),F._connect()},function(H){if(F._resetTimers(!0),!F._destroyed)F.emit("error",H)})}else{var N=F._xhr=new globalThis.XMLHttpRequest;try{N.open(F._opts.method,F._opts.url,!0)}catch(H){process.nextTick(function(){F.emit("error",H)});return}if("responseType"in N)N.responseType=F._mode;if("withCredentials"in N)N.withCredentials=!!M.withCredentials;if(F._mode==="text"&&"overrideMimeType"in N)N.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in M)N.timeout=M.requestTimeout,N.ontimeout=function(){F.emit("requestTimeout")};if(L.forEach(function(H){N.setRequestHeader(H[0],H[1])}),F._response=null,N.onreadystatechange=function(){switch(N.readyState){case W.LOADING:case W.DONE:F._onXHRProgress();break}},F._mode==="moz-chunked-arraybuffer")N.onprogress=function(){F._onXHRProgress()};N.onerror=function(){if(F._destroyed)return;F._resetTimers(!0),F.emit("error",Error("XHR error"))};try{N.send(f)}catch(H){process.nextTick(function(){F.emit("error",H)});return}}};function U(F){try{var M=F.status;return M!==null&&M!==0}catch(k){return!1}}V.prototype._onXHRProgress=function(){var F=this;if(F._resetTimers(!1),!U(F._xhr)||F._destroyed)return;if(!F._response)F._connect();F._response._onXHRProgress(F._resetTimers.bind(F))},V.prototype._connect=function(){var F=this;if(F._destroyed)return;F._response=new G(F._xhr,F._fetchResponse,F._mode,F._resetTimers.bind(F)),F._response.on("error",function(M){F.emit("error",M)}),F.emit("response",F._response)},V.prototype._write=function(F,M,k){var f=this;f._body.push(F),k()},V.prototype._resetTimers=function(F){var M=this;if(globalThis.clearTimeout(M._socketTimer),M._socketTimer=null,F)globalThis.clearTimeout(M._fetchTimer),M._fetchTimer=null;else if(M._socketTimeout)M._socketTimer=globalThis.setTimeout(function(){M.emit("timeout")},M._socketTimeout)},V.prototype.abort=V.prototype.destroy=function(F){var M=this;if(M._destroyed=!0,M._resetTimers(!0),M._response)M._response._destroyed=!0;if(M._xhr)M._xhr.abort();else if(M._fetchAbortController)M._fetchAbortController.abort();if(F)M.emit("error",F)},V.prototype.end=function(F,M,k){var f=this;if(typeof F==="function")k=F,F=void 0;Z.Writable.prototype.end.call(f,F,M,k)},V.prototype.setTimeout=function(F,M){var k=this;if(M)k.once("timeout",M);k._socketTimeout=F,k._resetTimers(!1)},V.prototype.flushHeaders=function(){},V.prototype.setNoDelay=function(){},V.prototype.setSocketKeepAlive=function(){};var w=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}),uW=h0(($,q)=>{q.exports=K;var Q=Object.prototype.hasOwnProperty;function K(){var J={};for(var Z=0;Z{q.exports=(C7(),X0(I7)).STATUS_CODES}),EW=h0(($)=>{var q=TW(),Q=oK(),K=uW(),J=SW(),Z=(f7(),X0(v7)),G=$;G.request=function(W,B){if(typeof W==="string")W=Z.parse(W);else W=K(W);var V=globalThis.location.protocol.search(/^https?:$/)===-1?"http:":"",U=W.protocol||V,w=W.hostname||W.host,F=W.port,M=W.path||"/";if(w&&w.indexOf(":")!==-1)w="["+w+"]";W.url=(w?U+"//"+w:"")+(F?":"+F:"")+M,W.method=(W.method||"GET").toUpperCase(),W.headers=W.headers||{};var k=new q(W);if(B)k.on("response",B);return k},G.get=function(W,B){var V=G.request(W,B);return V.end(),V},G.ClientRequest=q,G.IncomingMessage=Q.IncomingMessage,G.Agent=function(){},G.Agent.defaultMaxSockets=4,G.globalAgent=new G.Agent,G.STATUS_CODES=J,G.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}),aK=jW(EW(),1),{request:_W,get:cW,ClientRequest:bW,IncomingMessage:nW,Agent:dW,globalAgent:mW,STATUS_CODES:pW,METHODS:iW}=aK.default,oW=aK.default});var sK={};c1(sK,{validateHeaderValue:()=>LB,validateHeaderName:()=>DB,setMaxIdleHTTPParsers:()=>kB,request:()=>YB,maxHeaderSize:()=>NB,globalAgent:()=>wB,get:()=>MB,default:()=>HB,createServer:()=>FB,ServerResponse:()=>zB,Server:()=>BB,STATUS_CODES:()=>WB,OutgoingMessage:()=>GB,METHODS:()=>ZB,IncomingMessage:()=>UB,ClientRequest:()=>VB,Agent:()=>JB});function tW($){return this[$]}var aW,lW,lK,rW,sW,eW,$B,QB=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?eW??=new WeakMap:$B??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?aW(lW($)):{};let G=q||!$||!$.__esModule?lK(Q,"default",{value:$,enumerable:!0}):Q;for(let W of rW($))if(!sW.call(G,W))lK(G,W,{get:tW.bind($,W),enumerable:!0});if(K)J.set($,G);return G},qB=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),KB,rK,JB,VB,UB,ZB,GB,WB,BB,zB,FB,MB,wB,NB,YB,kB,DB,LB,HB;var tK=b1(()=>{aW=Object.create,{getPrototypeOf:lW,defineProperty:lK,getOwnPropertyNames:rW}=Object,sW=Object.prototype.hasOwnProperty;KB=qB(($,q)=>{var Q=(C7(),X0(I7)),K=(f7(),X0(v7)),J=$;for(Z in Q)if(Q.hasOwnProperty(Z))J[Z]=Q[Z];var Z;J.request=function(W,B){return W=G(W),Q.request.call(this,W,B)},J.get=function(W,B){return W=G(W),Q.get.call(this,W,B)};function G(W){if(typeof W==="string")W=K.parse(W);if(!W.protocol)W.protocol="https:";if(W.protocol!=="https:")throw Error('Protocol "'+W.protocol+'" not supported. Expected "https:"');return W}}),rK=QB(KB(),1),{Agent:JB,ClientRequest:VB,IncomingMessage:UB,METHODS:ZB,OutgoingMessage:GB,STATUS_CODES:WB,Server:BB,ServerResponse:zB,createServer:FB,get:MB,globalAgent:wB,maxHeaderSize:NB,request:YB,setMaxIdleHTTPParsers:kB,validateHeaderName:DB,validateHeaderValue:LB}=rK,HB=rK});var N8=globalThis;if(typeof N8.global>"u")N8.global=globalThis;if(typeof N8.__require>"u")N8.__require=($)=>{throw Error(`Dynamic require of "${$}" is not supported in the sandbox`)};t0();var Fz=J9(h9(),1);var c7=J9(HK(),1);function W2($,q,Q,K){function J(Z){return Z instanceof Q?Z:new Q(function(G){G(Z)})}return new(Q||(Q=Promise))(function(Z,G){function W(U){try{V(K.next(U))}catch(w){G(w)}}function B(U){try{V(K.throw(U))}catch(w){G(w)}}function V(U){U.done?Z(U.value):J(U.value).then(W,B)}V((K=K.apply($,q||[])).next())})}var L0=914400,w8=12700,n0=`\r +`,vB=2147483649,j7=/^[0-9a-fA-F]{6}$/,fB=1.67,RB=27,H6={type:"solid",color:"666666",pt:1},JJ=[0.05,0.1,0.05,0.1],v6={color:"363636",pt:1},u1={color:"888888",style:"solid",size:1,cap:"flat"},Q2="000000",k2=12,IB=18,f6="LAYOUT_16x9",x7="DEFAULT",VJ="333333",P1={type:"outer",blur:3,offset:1.811023622047244,angle:90,color:"000000",opacity:0.35,rotateWithShape:!0},M8=[0.5,0.5,0.5,0.5],eK={color:"000000"},CB={size:8,color:"FFFFFF",opacity:0.75},o2="2094734552",Y5="2094734553",B8="2094734554",O7="2094734555",UJ="2094734556",W8="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),z8=["C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360","C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360"],jB=["5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7","5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7"],R6;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(R6||(R6={}));var I6;(function($){$.b="b",$.ctr="ctr",$.t="t"})(I6||(I6={}));var ZJ="{F7021451-1387-4CA6-816F-3879F97B5CBC}",P7;(function($){$.arraybuffer="arraybuffer",$.base64="base64",$.binarystring="binarystring",$.blob="blob",$.nodebuffer="nodebuffer",$.uint8array="uint8array"})(P7||(P7={}));var T7;(function($){$.area="area",$.bar="bar",$.bar3d="bar3D",$.bubble="bubble",$.bubble3d="bubble3D",$.doughnut="doughnut",$.line="line",$.pie="pie",$.radar="radar",$.scatter="scatter"})(T7||(T7={}));var u7;(function($){$.accentBorderCallout1="accentBorderCallout1",$.accentBorderCallout2="accentBorderCallout2",$.accentBorderCallout3="accentBorderCallout3",$.accentCallout1="accentCallout1",$.accentCallout2="accentCallout2",$.accentCallout3="accentCallout3",$.actionButtonBackPrevious="actionButtonBackPrevious",$.actionButtonBeginning="actionButtonBeginning",$.actionButtonBlank="actionButtonBlank",$.actionButtonDocument="actionButtonDocument",$.actionButtonEnd="actionButtonEnd",$.actionButtonForwardNext="actionButtonForwardNext",$.actionButtonHelp="actionButtonHelp",$.actionButtonHome="actionButtonHome",$.actionButtonInformation="actionButtonInformation",$.actionButtonMovie="actionButtonMovie",$.actionButtonReturn="actionButtonReturn",$.actionButtonSound="actionButtonSound",$.arc="arc",$.bentArrow="bentArrow",$.bentUpArrow="bentUpArrow",$.bevel="bevel",$.blockArc="blockArc",$.borderCallout1="borderCallout1",$.borderCallout2="borderCallout2",$.borderCallout3="borderCallout3",$.bracePair="bracePair",$.bracketPair="bracketPair",$.callout1="callout1",$.callout2="callout2",$.callout3="callout3",$.can="can",$.chartPlus="chartPlus",$.chartStar="chartStar",$.chartX="chartX",$.chevron="chevron",$.chord="chord",$.circularArrow="circularArrow",$.cloud="cloud",$.cloudCallout="cloudCallout",$.corner="corner",$.cornerTabs="cornerTabs",$.cube="cube",$.curvedDownArrow="curvedDownArrow",$.curvedLeftArrow="curvedLeftArrow",$.curvedRightArrow="curvedRightArrow",$.curvedUpArrow="curvedUpArrow",$.custGeom="custGeom",$.decagon="decagon",$.diagStripe="diagStripe",$.diamond="diamond",$.dodecagon="dodecagon",$.donut="donut",$.doubleWave="doubleWave",$.downArrow="downArrow",$.downArrowCallout="downArrowCallout",$.ellipse="ellipse",$.ellipseRibbon="ellipseRibbon",$.ellipseRibbon2="ellipseRibbon2",$.flowChartAlternateProcess="flowChartAlternateProcess",$.flowChartCollate="flowChartCollate",$.flowChartConnector="flowChartConnector",$.flowChartDecision="flowChartDecision",$.flowChartDelay="flowChartDelay",$.flowChartDisplay="flowChartDisplay",$.flowChartDocument="flowChartDocument",$.flowChartExtract="flowChartExtract",$.flowChartInputOutput="flowChartInputOutput",$.flowChartInternalStorage="flowChartInternalStorage",$.flowChartMagneticDisk="flowChartMagneticDisk",$.flowChartMagneticDrum="flowChartMagneticDrum",$.flowChartMagneticTape="flowChartMagneticTape",$.flowChartManualInput="flowChartManualInput",$.flowChartManualOperation="flowChartManualOperation",$.flowChartMerge="flowChartMerge",$.flowChartMultidocument="flowChartMultidocument",$.flowChartOfflineStorage="flowChartOfflineStorage",$.flowChartOffpageConnector="flowChartOffpageConnector",$.flowChartOnlineStorage="flowChartOnlineStorage",$.flowChartOr="flowChartOr",$.flowChartPredefinedProcess="flowChartPredefinedProcess",$.flowChartPreparation="flowChartPreparation",$.flowChartProcess="flowChartProcess",$.flowChartPunchedCard="flowChartPunchedCard",$.flowChartPunchedTape="flowChartPunchedTape",$.flowChartSort="flowChartSort",$.flowChartSummingJunction="flowChartSummingJunction",$.flowChartTerminator="flowChartTerminator",$.folderCorner="folderCorner",$.frame="frame",$.funnel="funnel",$.gear6="gear6",$.gear9="gear9",$.halfFrame="halfFrame",$.heart="heart",$.heptagon="heptagon",$.hexagon="hexagon",$.homePlate="homePlate",$.horizontalScroll="horizontalScroll",$.irregularSeal1="irregularSeal1",$.irregularSeal2="irregularSeal2",$.leftArrow="leftArrow",$.leftArrowCallout="leftArrowCallout",$.leftBrace="leftBrace",$.leftBracket="leftBracket",$.leftCircularArrow="leftCircularArrow",$.leftRightArrow="leftRightArrow",$.leftRightArrowCallout="leftRightArrowCallout",$.leftRightCircularArrow="leftRightCircularArrow",$.leftRightRibbon="leftRightRibbon",$.leftRightUpArrow="leftRightUpArrow",$.leftUpArrow="leftUpArrow",$.lightningBolt="lightningBolt",$.line="line",$.lineInv="lineInv",$.mathDivide="mathDivide",$.mathEqual="mathEqual",$.mathMinus="mathMinus",$.mathMultiply="mathMultiply",$.mathNotEqual="mathNotEqual",$.mathPlus="mathPlus",$.moon="moon",$.noSmoking="noSmoking",$.nonIsoscelesTrapezoid="nonIsoscelesTrapezoid",$.notchedRightArrow="notchedRightArrow",$.octagon="octagon",$.parallelogram="parallelogram",$.pentagon="pentagon",$.pie="pie",$.pieWedge="pieWedge",$.plaque="plaque",$.plaqueTabs="plaqueTabs",$.plus="plus",$.quadArrow="quadArrow",$.quadArrowCallout="quadArrowCallout",$.rect="rect",$.ribbon="ribbon",$.ribbon2="ribbon2",$.rightArrow="rightArrow",$.rightArrowCallout="rightArrowCallout",$.rightBrace="rightBrace",$.rightBracket="rightBracket",$.round1Rect="round1Rect",$.round2DiagRect="round2DiagRect",$.round2SameRect="round2SameRect",$.roundRect="roundRect",$.rtTriangle="rtTriangle",$.smileyFace="smileyFace",$.snip1Rect="snip1Rect",$.snip2DiagRect="snip2DiagRect",$.snip2SameRect="snip2SameRect",$.snipRoundRect="snipRoundRect",$.squareTabs="squareTabs",$.star10="star10",$.star12="star12",$.star16="star16",$.star24="star24",$.star32="star32",$.star4="star4",$.star5="star5",$.star6="star6",$.star7="star7",$.star8="star8",$.stripedRightArrow="stripedRightArrow",$.sun="sun",$.swooshArrow="swooshArrow",$.teardrop="teardrop",$.trapezoid="trapezoid",$.triangle="triangle",$.upArrow="upArrow",$.upArrowCallout="upArrowCallout",$.upDownArrow="upDownArrow",$.upDownArrowCallout="upDownArrowCallout",$.uturnArrow="uturnArrow",$.verticalScroll="verticalScroll",$.wave="wave",$.wedgeEllipseCallout="wedgeEllipseCallout",$.wedgeRectCallout="wedgeRectCallout",$.wedgeRoundRectCallout="wedgeRoundRectCallout"})(u7||(u7={}));var G2;(function($){$.text1="tx1",$.text2="tx2",$.background1="bg1",$.background2="bg2",$.accent1="accent1",$.accent2="accent2",$.accent3="accent3",$.accent4="accent4",$.accent5="accent5",$.accent6="accent6"})(G2||(G2={}));var S7;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(S7||(S7={}));var E7;(function($){$.top="top",$.middle="middle",$.bottom="bottom"})(E7||(E7={}));var B1;(function($){$.ACTION_BUTTON_BACK_OR_PREVIOUS="actionButtonBackPrevious",$.ACTION_BUTTON_BEGINNING="actionButtonBeginning",$.ACTION_BUTTON_CUSTOM="actionButtonBlank",$.ACTION_BUTTON_DOCUMENT="actionButtonDocument",$.ACTION_BUTTON_END="actionButtonEnd",$.ACTION_BUTTON_FORWARD_OR_NEXT="actionButtonForwardNext",$.ACTION_BUTTON_HELP="actionButtonHelp",$.ACTION_BUTTON_HOME="actionButtonHome",$.ACTION_BUTTON_INFORMATION="actionButtonInformation",$.ACTION_BUTTON_MOVIE="actionButtonMovie",$.ACTION_BUTTON_RETURN="actionButtonReturn",$.ACTION_BUTTON_SOUND="actionButtonSound",$.ARC="arc",$.BALLOON="wedgeRoundRectCallout",$.BENT_ARROW="bentArrow",$.BENT_UP_ARROW="bentUpArrow",$.BEVEL="bevel",$.BLOCK_ARC="blockArc",$.CAN="can",$.CHART_PLUS="chartPlus",$.CHART_STAR="chartStar",$.CHART_X="chartX",$.CHEVRON="chevron",$.CHORD="chord",$.CIRCULAR_ARROW="circularArrow",$.CLOUD="cloud",$.CLOUD_CALLOUT="cloudCallout",$.CORNER="corner",$.CORNER_TABS="cornerTabs",$.CROSS="plus",$.CUBE="cube",$.CURVED_DOWN_ARROW="curvedDownArrow",$.CURVED_DOWN_RIBBON="ellipseRibbon",$.CURVED_LEFT_ARROW="curvedLeftArrow",$.CURVED_RIGHT_ARROW="curvedRightArrow",$.CURVED_UP_ARROW="curvedUpArrow",$.CURVED_UP_RIBBON="ellipseRibbon2",$.CUSTOM_GEOMETRY="custGeom",$.DECAGON="decagon",$.DIAGONAL_STRIPE="diagStripe",$.DIAMOND="diamond",$.DODECAGON="dodecagon",$.DONUT="donut",$.DOUBLE_BRACE="bracePair",$.DOUBLE_BRACKET="bracketPair",$.DOUBLE_WAVE="doubleWave",$.DOWN_ARROW="downArrow",$.DOWN_ARROW_CALLOUT="downArrowCallout",$.DOWN_RIBBON="ribbon",$.EXPLOSION1="irregularSeal1",$.EXPLOSION2="irregularSeal2",$.FLOWCHART_ALTERNATE_PROCESS="flowChartAlternateProcess",$.FLOWCHART_CARD="flowChartPunchedCard",$.FLOWCHART_COLLATE="flowChartCollate",$.FLOWCHART_CONNECTOR="flowChartConnector",$.FLOWCHART_DATA="flowChartInputOutput",$.FLOWCHART_DECISION="flowChartDecision",$.FLOWCHART_DELAY="flowChartDelay",$.FLOWCHART_DIRECT_ACCESS_STORAGE="flowChartMagneticDrum",$.FLOWCHART_DISPLAY="flowChartDisplay",$.FLOWCHART_DOCUMENT="flowChartDocument",$.FLOWCHART_EXTRACT="flowChartExtract",$.FLOWCHART_INTERNAL_STORAGE="flowChartInternalStorage",$.FLOWCHART_MAGNETIC_DISK="flowChartMagneticDisk",$.FLOWCHART_MANUAL_INPUT="flowChartManualInput",$.FLOWCHART_MANUAL_OPERATION="flowChartManualOperation",$.FLOWCHART_MERGE="flowChartMerge",$.FLOWCHART_MULTIDOCUMENT="flowChartMultidocument",$.FLOWCHART_OFFLINE_STORAGE="flowChartOfflineStorage",$.FLOWCHART_OFFPAGE_CONNECTOR="flowChartOffpageConnector",$.FLOWCHART_OR="flowChartOr",$.FLOWCHART_PREDEFINED_PROCESS="flowChartPredefinedProcess",$.FLOWCHART_PREPARATION="flowChartPreparation",$.FLOWCHART_PROCESS="flowChartProcess",$.FLOWCHART_PUNCHED_TAPE="flowChartPunchedTape",$.FLOWCHART_SEQUENTIAL_ACCESS_STORAGE="flowChartMagneticTape",$.FLOWCHART_SORT="flowChartSort",$.FLOWCHART_STORED_DATA="flowChartOnlineStorage",$.FLOWCHART_SUMMING_JUNCTION="flowChartSummingJunction",$.FLOWCHART_TERMINATOR="flowChartTerminator",$.FOLDED_CORNER="folderCorner",$.FRAME="frame",$.FUNNEL="funnel",$.GEAR_6="gear6",$.GEAR_9="gear9",$.HALF_FRAME="halfFrame",$.HEART="heart",$.HEPTAGON="heptagon",$.HEXAGON="hexagon",$.HORIZONTAL_SCROLL="horizontalScroll",$.ISOSCELES_TRIANGLE="triangle",$.LEFT_ARROW="leftArrow",$.LEFT_ARROW_CALLOUT="leftArrowCallout",$.LEFT_BRACE="leftBrace",$.LEFT_BRACKET="leftBracket",$.LEFT_CIRCULAR_ARROW="leftCircularArrow",$.LEFT_RIGHT_ARROW="leftRightArrow",$.LEFT_RIGHT_ARROW_CALLOUT="leftRightArrowCallout",$.LEFT_RIGHT_CIRCULAR_ARROW="leftRightCircularArrow",$.LEFT_RIGHT_RIBBON="leftRightRibbon",$.LEFT_RIGHT_UP_ARROW="leftRightUpArrow",$.LEFT_UP_ARROW="leftUpArrow",$.LIGHTNING_BOLT="lightningBolt",$.LINE_CALLOUT_1="borderCallout1",$.LINE_CALLOUT_1_ACCENT_BAR="accentCallout1",$.LINE_CALLOUT_1_BORDER_AND_ACCENT_BAR="accentBorderCallout1",$.LINE_CALLOUT_1_NO_BORDER="callout1",$.LINE_CALLOUT_2="borderCallout2",$.LINE_CALLOUT_2_ACCENT_BAR="accentCallout2",$.LINE_CALLOUT_2_BORDER_AND_ACCENT_BAR="accentBorderCallout2",$.LINE_CALLOUT_2_NO_BORDER="callout2",$.LINE_CALLOUT_3="borderCallout3",$.LINE_CALLOUT_3_ACCENT_BAR="accentCallout3",$.LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR="accentBorderCallout3",$.LINE_CALLOUT_3_NO_BORDER="callout3",$.LINE_CALLOUT_4="borderCallout4",$.LINE_CALLOUT_4_ACCENT_BAR="accentCallout3=4",$.LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR="accentBorderCallout4",$.LINE_CALLOUT_4_NO_BORDER="callout4",$.LINE="line",$.LINE_INVERSE="lineInv",$.MATH_DIVIDE="mathDivide",$.MATH_EQUAL="mathEqual",$.MATH_MINUS="mathMinus",$.MATH_MULTIPLY="mathMultiply",$.MATH_NOT_EQUAL="mathNotEqual",$.MATH_PLUS="mathPlus",$.MOON="moon",$.NON_ISOSCELES_TRAPEZOID="nonIsoscelesTrapezoid",$.NOTCHED_RIGHT_ARROW="notchedRightArrow",$.NO_SYMBOL="noSmoking",$.OCTAGON="octagon",$.OVAL="ellipse",$.OVAL_CALLOUT="wedgeEllipseCallout",$.PARALLELOGRAM="parallelogram",$.PENTAGON="homePlate",$.PIE="pie",$.PIE_WEDGE="pieWedge",$.PLAQUE="plaque",$.PLAQUE_TABS="plaqueTabs",$.QUAD_ARROW="quadArrow",$.QUAD_ARROW_CALLOUT="quadArrowCallout",$.RECTANGLE="rect",$.RECTANGULAR_CALLOUT="wedgeRectCallout",$.REGULAR_PENTAGON="pentagon",$.RIGHT_ARROW="rightArrow",$.RIGHT_ARROW_CALLOUT="rightArrowCallout",$.RIGHT_BRACE="rightBrace",$.RIGHT_BRACKET="rightBracket",$.RIGHT_TRIANGLE="rtTriangle",$.ROUNDED_RECTANGLE="roundRect",$.ROUNDED_RECTANGULAR_CALLOUT="wedgeRoundRectCallout",$.ROUND_1_RECTANGLE="round1Rect",$.ROUND_2_DIAG_RECTANGLE="round2DiagRect",$.ROUND_2_SAME_RECTANGLE="round2SameRect",$.SMILEY_FACE="smileyFace",$.SNIP_1_RECTANGLE="snip1Rect",$.SNIP_2_DIAG_RECTANGLE="snip2DiagRect",$.SNIP_2_SAME_RECTANGLE="snip2SameRect",$.SNIP_ROUND_RECTANGLE="snipRoundRect",$.SQUARE_TABS="squareTabs",$.STAR_10_POINT="star10",$.STAR_12_POINT="star12",$.STAR_16_POINT="star16",$.STAR_24_POINT="star24",$.STAR_32_POINT="star32",$.STAR_4_POINT="star4",$.STAR_5_POINT="star5",$.STAR_6_POINT="star6",$.STAR_7_POINT="star7",$.STAR_8_POINT="star8",$.STRIPED_RIGHT_ARROW="stripedRightArrow",$.SUN="sun",$.SWOOSH_ARROW="swooshArrow",$.TEAR="teardrop",$.TRAPEZOID="trapezoid",$.UP_ARROW="upArrow",$.UP_ARROW_CALLOUT="upArrowCallout",$.UP_DOWN_ARROW="upDownArrow",$.UP_DOWN_ARROW_CALLOUT="upDownArrowCallout",$.UP_RIBBON="ribbon2",$.U_TURN_ARROW="uturnArrow",$.VERTICAL_SCROLL="verticalScroll",$.WAVE="wave"})(B1||(B1={}));var q0;(function($){$.AREA="area",$.BAR="bar",$.BAR3D="bar3D",$.BUBBLE="bubble",$.BUBBLE3D="bubble3D",$.DOUGHNUT="doughnut",$.LINE="line",$.PIE="pie",$.RADAR="radar",$.SCATTER="scatter"})(q0||(q0={}));var L5;(function($){$.TEXT1="tx1",$.TEXT2="tx2",$.BACKGROUND1="bg1",$.BACKGROUND2="bg2",$.ACCENT1="accent1",$.ACCENT2="accent2",$.ACCENT3="accent3",$.ACCENT4="accent4",$.ACCENT5="accent5",$.ACCENT6="accent6"})(L5||(L5={}));var W1;(function($){$.chart="chart",$.image="image",$.line="line",$.rect="rect",$.text="text",$.placeholder="placeholder"})(W1||(W1={}));var D0;(function($){$.chart="chart",$.hyperlink="hyperlink",$.image="image",$.media="media",$.online="online",$.placeholder="placeholder",$.table="table",$.tablecell="tablecell",$.text="text",$.notes="notes"})(D0||(D0={}));var F8;(function($){$.title="title",$.body="body",$.image="pic",$.chart="chart",$.table="tbl",$.media="media"})(F8||(F8={}));var C6;(function($){$.DEFAULT="•",$.CHECK="✓",$.STAR="★",$.TRIANGLE="▶"})(C6||(C6={}));var j6="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOVhAAAGAUlEQVR4Xu2dT0xcRRzHf7tAYSsc0EBSIq2xEg8mtTGebVzEqOVIolz0siRE4gGTStqKwdpWsXoyGhMuyAVJOHBgqyvLNgonDkabeCBYW/8kTUr0wsJC+Wfm0bfuvn37Znbem9mR9303mJnf/Pb7ed95M7PDI5JIJPYJV5EC7e3t1N/fT62trdqViQCIu+bVgpIHEo/Hqbe3V/sdYVKHyWSSZmZm8ilVA0oeyNjYmEnaVC2Xvr6+qg5fAOJAz4DU1dURGzFSqZRVqtMpAFIGyMjICC0vL9PExIRWKADiAYTNshYWFrRCARAOEFZcCKWtrY0GBgaUTYkBRACIE4rKZwqACALR5RQAqQCIDqcASIVAVDsFQCSAqHQKgEgCUeUUAPEBRIVTAMQnEBvK5OQkbW9vk991CoAEAMQJxc86BUACAhKUUwAkQCBBOAVAAgbi1ykAogCIH6cAiCIgsk4BEIVAZJwCIIqBVLqiBxANQFgXS0tLND4+zl08AogmIG5OSSQS1gGKwgtANAIRcQqAaAbCe6YASBWA2E6xDyeyDUl7+AKQMkDYYevm5mZHabA/Li4uUiaTsYLau8QA4gLE/hU7wajyYtv1hReDAiAOxQcHBymbzark4BkbQKom/X8dp9Npmpqasn4BIAYAYSnYp+4BBEAMUcCwNOCQsAKZnp62NtQOw8WmwT09PUo+ijaHsOMx7GppaaH6+nolH0Z10K2tLVpdXbW6UfV3mNqBdHd3U1NTk2rtlMRfW1uj2dlZAFGirkRQAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAGHqrm8caPzQ0WC1logbeiC7X3xJm0PvUmRzh45cuki1588FAmVn9BO6P3yF9utrqGH0MtW82S8UN9RA9v/4k7InjhcJFTs/TLVXLwmJV67S7vD7tHF5pKi46fYdosdOcOOGG8j1OcqefbFEJD9Q3GCwDhqT31HklS4A8VRgfYM2Op6k3bt/BQJl58J7lPvwg5JYNccepaMry0LPqFA7hCm39+NNyp2J0172b19QysGINj5CsRtpij57musOViH0QPJQXn6J9u7dlYJSFkbrMYolrwvDAJAC+WWdEpQz7FTgECeUCpzi6YxvvqXoM6eEhqnCSgDikEzUKUE7Aw7xuHctKB5OYU3dZlNR9syQdAaAcAYTC0pXF+39c09o2Ik+3EqxVKqiB7hbYAxZkk4pbBaEM+AQofv+wTrFwylBOQNABIGwavdfe4O2pg5elO+86l99nY58/VUF0byrYsjiSFluNlXYrOHcBar7+EogUADEQ0YRGHbzoKAASBkg2+9cpM1rV0tK2QOcXW7bLEFAARAXIF4w2DrDWoeUWaf4hQIgDiA8GPZ2iNfi0Q8UACkAIgrDbrJ385eDxaPLLrEsFAB5oG6lMPJQPLZZZKAACBGVhcG2Q+bmuLu2nk55e4jqPv1IeEoceiBeX7s2zCa5MAqdstl91vfXwaEGsv/rb5TtOFk6tWXOuJGh6KmnhO9sayrMninPx103JBtXblHkice58cINZP4Hyr5wpkgkdiChEmc4FWazLzenNKa/p0jncwDiqcD6BuWePk07t1asatZGoYQzSqA4nFJ7soNiP/+EUyfc25GI2GG53dHPrKo1g/1Cw4pIXLrzO+1c+/wg7tBbFDle/EbQcjFCPWQJCau5EoBoFpzXHYDwFNJcDiCaBed1ByA8hTSXA4hmwXndAQhPIc3lAKJZcF53AMJTSHM5gGgWnNcdgPAU0lwOIJoF53UHIDyFNJcfSiCdnZ0Ui8U0SxlMd7lcjubn561gh+Y1scFIU/0o/3sgeLO12E2k7UXKYumgFoAYdg8ACIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6ZQ4JB6PKzviYthnNy4d9h+1M5mMlVckkUjsG5dhiBMCEMPg/wuOfrZZ/RSywQAAAABJRU5ErkJggg==",gB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB4AAAAVnCAYAAACzfHDVAAAAYHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjaVcjJDYAwDEXBu6ughBfH+YnLQSwSHVA+Yrkwx7HtPHabHuEWrQ+lBBAZ6TMweBWoCwUH8quZH6VWFXVT696zxp12ARkVFEqn8wB8AAAACXBIWXMAAC4jAAAuIwF4pT92AADZLklEQVR42uzdd5hV9Z0/8M+dmcsUZmDovYOhKCiKYhR7JJuoSTCWGFI0WUxijBoTTXazVlyza4maYm9rTRSJigVsqCDNQhHBAogKCEgRMjMMU+7vj93sL8kqClLmnPt6PY+PeXZM9vP9vO8jZ+Y955xMfJLjorBrRMuSgmiViyjN1Ee2oSCyucbIBAAAAAAAAADbXaYgcoWNUZcrirpMbdRsysa69wbF+rggGrf439vSF7seF12aFUTnxvoosGIAAAAAAACAXacgoqEgF++/VRgr4r5o+Kh/pvD//F8uiII+LaPrum/EXzqui2b1ddHGKgEAAAAAAAB2rVxEQWMmWrQtjHZlA6N2w2tR84//zP8pgHu3ib6NBdG+zdqorK6KVUXZaB85j3sGAAAAAAAAaAoaG6OwIBdtyneP2PBabPzbr/1dAdx3VHRtyESHiIhcYzQrLo7WmVzkcjmPgAYAAAAAAABoSgpy0eIfS+D/LYD7fy3abC6Inn/7X2hsjELlLwAAAAAAAEDT9D8lcM1fHwddFBFxyAVR9M686PVp/gfqayKiJiLqLBMAAAAAAABgh8hGRGlEUekn/6PFEb3ikNgQk6O+KCJi6dzoksv83/cB/1X9xoiaJdmoWxlRV1dk2QAAAAAAAAA7QTZbH9muERX96v7n9t7/q6Exinq3i86LI94pjOOisHUu+uYykfmof7h+Y8Sa6aVRt74gGhs9DRoAAAAAAABgZ2lsLIi69QWxeUUmSjs0/vedwR8hk4uydSfE+wVd6qOyMfMx7/mtj9jwUtbjngEAAAAAAAB2obrqolg7IxtR/9Ffb4wo7P5GtCwobRaVH/c/UvNmNuqqPfIZAAAAAAAAYFerqy6KmjezH/v1ktpoVZBr/PgCeMN7yl8AAAAAAACApmJLHW5jUVQWNDSP+Q3ZeLco4i9/+8X6teHRzwAAAAAAAABNSd3/dLn/oLAoqqIuVhXFxhhSGB/xqGjlLwAAAAAAAECTU1eTjaK/KXSLIv7SWB+bc5ko9YxnAAAAAAAAgATJFv393bz1EeV//c8F1gMAAAAAAACQDgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKREkRUAAACwrUpLSwuGDRvWfMCAAS26du3avKysrLiioqKkZcuWzZs1a1bcvHnz0tLS0rJsNtusuLi4ebNmzUoLCgo+8/eijY2N9Zs3b66pra2tqqur21xTU1NdVVVVs2nTptqNGzdWbdiwoeYvf/nL5hUrVlQtWLBgw6xZs6pqamoaJQYAAEDaKYABAACIiIghQ4aUHnTQQW379u3bql27dq3at2/fpkWLFq2bN29eWVpa2qpZs2bNCwsLm2ez2fLCwsLyoqKi8sLCwtKknK+hoaG6vr6+qqGh4S91dXV/aWhoqNq8eXNVTU3NuqqqqvUbNmxYu2rVqjWrV69e99Zbb6177rnnPpgzZ06NTwYAAABJogAGAADIA8OGDWt+xBFHdBwwYECnLl26dGjdunXHFi1adCgtLe1YUlLSvlmzZq0KCgqK07yDwsLCssLCwrKIaPdp/zuNjY21mzdvXrdp06ZVNTU172/YsGHl2rVr31+2bNnKBQsWrHjyySffnzVrVpVPGAAAAE1Fpuexsd9HfaF+ZcSal0ptCAAAIAE6deqUPf744zvtueeeXbp3796lbdu2XSorKzuXlpZ2KS0t7VBYWFhhSztGQ0PDxpqampU1NTXL169fv+yDDz5Y9s477yybPXv2sj/96U8rVqxYUWdLAAAAbE9t9q6Jog4f/TUFMAAAQEJks9nMt7/97Y4jRozo1bdv397t2rXrXl5e3rWsrKxzcXFx+4gosKUmp7G2tnZVTU3Nso0bNy5btWrV0tdff/2tJ598cvG999672noAAADYFgpgAACAhPne977X6a9Fb/v27Xu1bNmyV1lZWa8kvXOXLauvr9/wl7/8ZdG6desWL1u2bNHChQsX/fGPf1w8derUjbYDAADAliiAAQAAmqhsNps59dRTuxx66KH9+/Tp87n27dv3Ly8v719UVOSRzXlq06ZNKzZu3Pj6+++//8abb775xqOPPvrG3XffvcpmAAAA+CsFMAAAQBNx6qmndvniF784qHfv3v3btWv3uYqKis8VFhaW2wxbUl9fv37Dhg1vfPDBB68vXrz4jccee2z+jTfeuNxmAAAA8pMCGAAAYBc45phjWn/rW9/aq3///kPatGnTv6Kiop9HOLO9NDQ0VG/cuPGtNWvWLFy4cOGcO+6445WHHnporc0AAACknwIYAABgJzjjjDO6f+lLX9qrV69eg1u3bj2orKysR0RkbIadJFddXb103bp18xcvXjz30UcffeXqq69+x1oAAADSRwEMAACwnZWWlhb86le/2u3QQw8d1r17931btmw5qLCwsMxmaEoaGhqqP/zww/nvvPPOzGeeeWbW2LFj36ipqWm0GQAAgGRTAAMAAGwHP/7xj7t+9atf3bdXr15D27Ztu1c2m21jKyRJXV3dmg8++OCVRYsWvfznP/95xh/+8IdltgIAAJA8CmAAAIBtcOKJJ7Y75ZRTDujXr9+w1q1bD81ms61shTSpq6tbt3bt2pfffPPNWbfccsvUe++9d7WtAAAANH0KYAAAgE+hoqKi4IILLhg0YsSI/bp27bpfy5YtB2YymUKbIR/kcrmGDz/8cP6777474/nnn59x4YUXvrZx40aPiwYAAGiCFMAAAAAf4/jjj2/7/e9//8D+/fsf2Lp1630KCgpKbAUiGhsbN61fv37eW2+9NeWGG2545u67715lKwAAAE2DAhgAAOB/ZLPZzAUXXPC5I4888sDu3bsfWFFRsVtEFNgMbFl1dfWSd999d8qsWbNmnnvuuS+vW7euwVYAAAB2DQUwAACQ10pLSwsuvfTSQYcccsjBXbt2HVFWVtbDVmDb1dbWrnr//fdfmDp16uRf/vKXL65evbreVgAAAHYeBTAAAJB3Bg0aVHrBBRd8fs899zywQ4cOBxQVFbWwFdj+Ghsba9euXTtrzpw5T59//vmTX3755WpbAQAA2LEUwAAAQF4YNmxY8/POO+/gIUOGHOZ9vrDz/W0ZfNFFFz07a9asKlsBAADY/hTAAABAarVq1arwyiuv3HfEiBEjO3TocFBhYWGZrcCu19DQUP3+++8/O2XKlIk/+clPZm7cuLHRVgAAALYPBTAAAJAqrVq1Kvztb3+7/3777Xd4x44dRxQWFpbbCjRdDQ0NG99///0pM2bMeOqHP/zhC8pgAACAz0YBDAAApMJZZ53V45vf/OaRvXr1GllaWtrVRiB5ampq3l28ePHEO++8c9LVV1/9jo0AAABsPQUwAACQWMOHDy+/6KKLvjB48OCjW7RoMdBGID0+/PDDV+fNmzfhvPPOe3L69Ol/sREAAIBPRwEMAAAkSqtWrQpvuOGGQ/bbb79/atOmzX6ZTCZrK5BeuVyubs2aNTNmzJjx2JgxYyavW7euwVYAAAA+ngIYAABIhB//+Mddv/e9732lZ8+e/1RcXNzWRiD/1NbWfvD2228/dssttzz029/+9l0bAQAA+L8UwAAAQJNVUVFRcO21137+4IMPPrZ169b7ZTKZAlsBIqJxzZo1M59//vnxp5122hR3BQMAAPx/CmAAAKDJOeWUUzqefvrpx/bu3ftL2Wy2jY0AH6e+vn7j0qVLH/vd7373x+uvv36ZjQAAAPlOAQwAADQJ2Ww2c+uttx5wyCGHnNC6deu9I8LdvsDWaFy7du1L06ZN+/OPfvSjZ1evXl1vJQAAQD5SAAMAALtU//79S6655pp/2nPPPY8tLy/vayPAZ1VTU7NswYIF488999wHp06dutFGAACAfKIABgAAdomf//znPU855ZQTu3btemRhYWGZjQDbW2NjY92KFSuevOWWW+689NJLF9kIAACQDxTAAADATuMxz8Cusn79+rlPP/30f5188slT6+rqcjYCAACklQIYAADY4fr27Vv8hz/84a+Pee5nI8CuUlNT8+68efPu/8EPfvDgwoULN9kIAACQNgpgAABghxkyZEjpNddc89XBgwefWFxc3MFGgKaitrZ21dy5c+/5yU9+8uc5c+bU2AgAAJAWWyqAPYoNAADYJqNHj+4wb968n06ZMuXRYcOGnaH8BZqa4uLi9sOGDTtjypQpj86bN++nJ510UntbAQAA0s4dwAAAwFY599xze33/+9//dufOnY/IZDJZGwGSIpfL1S1fvvzJG2644fbLLrvsbRsBAACSyiOgAQCAz+y8887r+53vfOfbHTt2PDyTyRTaCJBUuVyuYcWKFU/cdNNN//XrX/96sY0AAABJowAGAAC22WWXXTboG9/4xg9at249zDaAtFm7du2su++++9pzzjnnNdsAAACSQgEMAABsNcUvkE8UwQAAQJIogAEAgE9N8Qvks7Vr18665557rvv5z38+3zYAAICmaksFcGHlwOj6UV9orIqoWZG1PQAAyBO/+MUvet9xxx3nHHrooT8pLS3tYiNAPiotLe2y7777HvP973+/X1lZ2ZIpU6assxUAAKCpKetcHwXlH/01BTAAAOS5M844o/u99957zpe//OWflZeX94qIjK0AeS5TXl7e8+CDDx71/e9/v3dEvDVjxowPrQUAAGgqFMAAAMD/ceKJJ7a77777fjJq1Kh/KS8v7xOKX4B/lCkvL+99+OGHj/rWt77VfvXq1Qvnz59fbS0AAMCutqUC2DuAAQAgzwwdOrTs+uuvP6l///4nFRYWltkI20NjY2Ns2rQpqquro6amJurr62PTpk2xefPmqK+vj+rq6qivr4/NmzfHpk2boqGhYZv/fxUWFkZJSUk0a9YsioqKoqysLIqKiqJZs2ZRUlISRUVFUVpa+r9/FRQUCIjtoqGhoeq11167a8yYMffMmTOnxkYAAIBdZUvvAFYAAwBAnujUqVP2nnvuGbXXXnudnM1mK22Ej9PQ0BAbN26MDRs2/J+/Nm7cGBs3boyamprYtGlTbNq0KWpqaqK2trbJnqe4uDhKSkqitLT0f/9eUVERFRUV0aJFi//zV0VFRRQWFvog8LHq6urWvvjii7eceOKJf169enW9jQAAADubAhgAAPLcXXfdddAXv/jF00tLS7vZRn7L5XKxYcOGWLt2baxbty7Wrl37d3+tW7cuNmzYkPd7atGiRbRu3TpatWoVrVu3jjZt2vzvf27dunW0aNHCh4morq5e+sgjj1zzne98Z6ptAAAAO5MCGAAA8tTVV189+MQTTzyzoqJioG3kj8bGxli5cmUsX748Pvjgg1i9evX//n3t2rXR2NhoSZ9RYWFhtGrVKtq1axdt27b937937tw5OnTo4LHTeWbDhg3z77333qvOPPPMebYBAADsDApgAADIM1/72tfaXHrppad27979qIjQRKVUQ0NDrFq1KlasWBHvv//+//595cqVTfqRzGlXXFwcHTp0iI4dO0bnzp2jY8eO0alTp2jXrp1HS6dYLpdrfOeddx76+c9/fv2ECRPW2QgAALAjKYABACBP9OrVq9ldd931jT322OM7hYWFZTaSHh9++GG88847sXTp0njvvfdixYoVsXr16mhoaLCchCgsLIz27dtHp06dolu3btG9e/fo3r27x0mnTENDQ9W8efNu++Y3v/nHJUuWbLYRAABgR1AAAwBAHrjrrrtG/NM//dOZJSUlXWwj2davXx9Lly6Nd955539L3w8//NBiUqqysvJ/y+C//tWqVSuLSbiamppljz322G9Gjx49xTYAAIDtTQEMAAAp9qtf/arPD3/4w5+1atVqL9tIno0bN8aSJUvirbfeikWLFsV7770XmzZtspg8V1JSEl27do0+ffpE3759o3fv3lFeXm4xCbRu3bqXr7322ivGjh27yDYAAIDtRQEMAAApNGjQoNI77rjju7vttttJBQUFWRtJhtWrV8ebb74ZixcvjiVLlsTy5cujsbHRYtiigoKC6Ny5c/Tu3Tt69+4d/fr1i7Zt21pMQjQ2Nta98cYbd33rW9+6ff78+TU2AgAAfFYKYAAASJHS0tKCBx988Jj99tvvn7PZbBsbaboaGhri7bffjrfeeisWLFgQS5YscXcv201FRUX06tUr+vbtG3379o2ePXtGYWGhxTRhdXV1a2bMmHHjV77ylYdqamr85gcAALDNFMAAAJASp59+erdf/vKX51ZWVu5jG03T6tWr47XXXouFCxfGm2++GRs3brQUdooWLVpE3759Y8CAATFw4EB3CDdh69evf/E//uM//vPqq69+xzYAAIBtoQAGAICEGzRoUOm99977w969ex+byWTc4teErF+/PubNmxcLFiyIN954Q+FLk9GiRYvo169fDBgwIPbYY4+orKy0lCYkl8s1LF68eNyJJ554rcdCAwAAW0sBDAAACXbNNdcMOemkk35RVlbWyzZ2vVwuF++++27MnTs3XnvttViyZIl3+NLkFRQURK9evWLQoEExePDg6Natm6U0EdXV1UvuvvvuX//kJz+ZYxsAAMCnpQAGAIAEOuqoo1r99re//VmHDh0Ot41da9OmTTF79uyYO3duLFy4MKqqqiyFRGvevHn0798/Bg8eHHvuuWeUlJRYyi62cuXKp04//fTLJ0yYsM42AACAT6IABgCAhBk3btwRRxxxxFnZbLaNbewaVVVVMXfu3Jg7d27Mnz8/amtrLYVUKi4ujoEDB8bgwYNj8ODBUV5ebim7SF1d3ZqnnnrqqlGjRj1hGwAAwJYogAEAICFOOeWUjhdddNEvW7duvZ9t7HwrV66MWbNmxdy5c+Odd96JXC5nKeSdzp07x9577x3Dhg2LDh06WMgusHbt2hnnnXfepbfccsv7tgEAAHwUBTAAADRxpaWlBU899dQ3Bw8e/L2CggLPYt2JVqxYES+99FK89NJLsXz5cguBv/HXMnjvvfeOTp06WchO1NjYuGnu3Lk3H3744XfV1NR40TgAAPB3FMAAANCEjR49usOll176yzZt2gy3jZ1j/fr18eKLL8bMmTNj6dKlFgKfQs+ePWPfffeNYcOGRYsWLSxkJ1mzZs0L55577q/vvvvuVbYBAAD8lQIYAACaoIqKioKJEyd+c/Dgwd8vKCgotpEda8OGDfHiiy/G9OnTlb7wGfXo0SOGDx8ew4YNi4qKCgvZwdwNDAAA/CMFMAAANDGnnHJKx7Fjx/5rZWXlMNvYcerr6+PVV1+NGTNmxLx586Kurs5SYDvKZrMxZMiQ2HfffWP33XePwsJCS9mB1q5dO+MXv/jFv995550rbQMAAPKbAhgAAJqIbDabeeKJJ47fZ599fuSu3x0jl8vFwoULY/r06TF79uzYtGmTpcBOUFpaGkOGDInhw4fHgAEDLGQHaWhoqJ42bdo1Rx555J9tAwAA8pcCGAAAmoDjjz++7ZVXXvmr1q1be9fvDrBmzZqYNm1azJw5M1audHMc7EodO3aMz3/+87H//vt7X/CO+3fetDPPPPOScePGfWAbAACQfxTAAACwi9100037HXvssf9WXFzc1ja2n1wuF6+99lo8//zzMW/evKivr7cUaEKKiopizz33jBEjRsTnPve5yGQylrId1dbWrvrjH/948Q9+8INZtgEAAPlFAQwAALvIkCFDSu+///5zunTp8k+2sf2sXbs2Jk+eHNOnT48PP/zQQiABKisrY8SIEXHIIYdEeXm5hWxHy5Yte+zrX//6f86ZM6fGNgAAID9sqQAurBwYXT/qC41VETUrsrYHAADb6IILLtjt97///VVt2rQZZhvbx+LFi2P8+PFx9913xxtvvBG1tbWWAgmxadOmeOONN+LZZ5+NtWvXRps2bTweejtp0aJFv5NOOumg0tLSuc8+++xaGwEAgPQr61wfBR/zu7XuAAYAgO0sm81mJk2a9PVhw4b9pKCgwG9VfkZ1dXUxY8aMeOaZZ+K9996zEEiRfv36xSGHHBJDhw6NgoICC/mMGhsbN8+YMeOaL37xi+Pq6upyNgIAAOnlEdAAALCTHH/88W2vuuqqCyorK/exjc9mzZo18dRTT8XUqVNj06ZNFgIpVlFREZ///OfjsMMOi8rKSgv5jNavXz/r9NNPv3DcuHEf2AYAAKSTAhgAAHaC22677fNf+9rXzstms5W2se0WLVoUjz/+eMybNy9yOTewQT4pKiqKIUOGxBFHHBG9e/e2kM+grq5u3QMPPHDRySefPM02AAAgfRTAAACwA1VUVBQ8/fTTpwwcOPCUTCbjGabbIJfLxauvvhpPPvlkLFy40EIgz2UymRgwYEAcccQRMWjQIAvZ9n+3Ns6fP/+Www8//JaNGzc22ggAAKTHlgrgwsqB0fWjvtBYFVGzwuvKAABgS0488cR2EyZMuLx79+5fzmQyGRvZOo2NjTFr1qy49dZb48knn4wPPvC0UuC/rV69OmbMmBFz5syJ0tLS6NSpU/jX7NbJZDKZ9u3bD/3+978/dPny5TNfffXValsBAIB0KOtcHwXlH/O9gDuAAQBg29x66637H3vssRcWFRW1sI2tU1NTE0899VQ8++yzsWHDBgsBPlGLFi3i4IMPjsMPPzxKS/28YmvV19d/OG7cuPNPPvnk6bYBAADJ5xHQAACwHWWz2cyzzz77rSFDhvzAI5+3zqZNm2Ly5Mnx1FNPKX6BbdKiRYs47LDD4pBDDlEEb6VcLtfwyiuvXHfooYfeWVdX5yXrAACQYApgAADYTo455pjW11133cWVlZV728ant2HDhnj88cdjypQpUVtbayHAZ1ZcXBwHHnhgfPGLX4wWLTyIYWusWbNm2re//e3zn3nmGb+JAwAACeUdwAAAsB1cfvnlu1900UW/LS8v72cbn05VVVVMmDAhbrnllnjzzTejoaHBUoDtoqGhIZYsWRLPPfdc1NTURI8ePSKb9XOMT6OsrKzb17/+9SPbtm0774knnlhtIwAAkMDreu8ABgCAz+bhhx/+8qGHHnpOQUFBsW18sk2bNsUzzzwTTzzxRFRVVVkIsMOVl5fHkUceGYccckgUF/tX9afR2Ni46emnn/71Mccc87htAABAsngENAAAbKN27doVTZ48+YxevXodZxufrK6uLp5++umYOHGi4hfYJSoqKuKLX/xiHHzwwe4I/pQWLVr0x4MOOuiadevWeUwDAAAkhEdAAwDANjj22GPbPvzww7/p2LHjobaxZXV1dfHkk0/GddddF3Pnzo26ujpLAXaJzZs3x2uvvRbPPfdcRET06NEjCgsLLWYLWrduvfv3vve9fd9+++1pCxYsqLYRAABo+rb0CGgFMAAAfITLL7989wsuuOB3zZs372UbH6+xsTGmTJkS119/fbzyyiuKX6DJ2Lx5cyxYsCCmT58excXF0a1bt8hkMhbzMUpKSjp8+ctfPrJt27ZzvBcYAACaPu8ABgCArTB+/Pgjv/CFL/xLQUFBiW18vAULFsT48eNj6dKllgE0eT169IivfOUrMWjQIMvYgsbGxpqJEydecuyxxz5pGwAA0HR5BzAAAHwK7dq1K3ruued+1qNHj6/axsdbtGhR3H///bF48WLLABKnV69ecdxxx0WfPn0sYwuWLl3654MOOujy1atX19sGAAA0Pd4BDAAAn2DYsGHNn3766V936tTpC7bx0TZs2BD33Xdf/PGPf4y1a9daCJBI69evj2nTpsW6deuiZ8+eUVLiYQ8fpbKysv+3v/3t/lOmTJmyfPlyz/cHAIAmxjuAAQBgC372s5/1uP76669t0aKF54J+hJqamhg/fnzcfPPN8fbbb0cul7MUINFyuVy888478cwzz0RVVVX07t07slk/A/lHZWVl3U488cTD6+rqZkyfPv1DGwEAgCZ0va4ABgCAj3bFFVfscdZZZ11dXFzcwTb+Xi6XixkzZsR1110XCxYsiMbGRksBUqWxsTGWLFkSM2bMiPLy8ujSpUtkMhmL+RvZbLbFQQcddHibNm1mP/HEE6ttBAAAmoYtFcDeAQwAQN6aNGnSqAMOOODsTCZTaBt/b9GiRXHPPffEu+++axlA3ujWrVucdNJJ0bt3b8v4B7lcrm7y5Mm//vKXv/yIbQAAwK63pXcAK4ABAMg7paWlBTNnzjyzT58+x9vG39uwYUOMGzcuZsyY4VHPQF7KZDKx3377xde//vWoqKiwkH+waNGiP+27775X1dTUeCwEAADsQgpgAAD4H926dctOnjz5V506dRppG/9fLpeLqVOnxp///OfYuHGjhQB5r6KiIkaNGhX777+/x0L/g+XLlz9+6KGHXvLuu+/W2QYAAOwaWyqAvQMYAIC8MXz48PInnnjiynbt2o2wjf/vnXfeiWuvvTaee+652Lx5s4UARMTmzZtjzpw58dprr0XPnj2jRYsWlvI/Kioq+n7rW98aMnXq1Ofee+89f3AAAMAusKV3ACuAAQDIC9/+9rc73n777X9o0aLFANv4b1VVVXHXXXfFvffeG+vXr7cQgI+wbt26eP7552P9+vWx2267RVFRkaVERElJSefjjjvuoA8++GDKK6+88hcbAQCAnUsBDABAXjv//PP7XXzxxX8oKSnpbBv/bfr06XHttdfGokWLLAPgU3jnnXdi2rRp0bp16+jc2R8nERHZbLbyC1/4whElJSUvTp48eY2NAADAzqMABgAgb/3ud7/b60c/+tFVRUVFrWwjYs2aNXHzzTfHpEmTora21kIAtkJtbW289NJL8c4770Tfvn2jtLQ073dSWFhYNnz48C/26dNn4UMPPbTMpwQAAHYOBTAAAHnp1ltv3f+b3/zmfxYWFjbP913kcrl4/vnn4/rrr4/ly5f7cAB8BitXroxp06ZFRUVFdOvWLTKZTF7vo6CgIDto0KBDBw0atOiBBx54xycEAAB2vC0VwJmex8Z+H/WF+pURa17ym6wAACTTww8//KXDDjvsXzKZTN6/rPGDDz6I22+/Pd544w0fDIDtbMCAAfGtb30r2rRpk/e7yOVyjVOmTPn1yJEjH/LJAACAHavN3jVR1OGjv6YABgAgdV555ZXTPve5z30r3/fQ0NAQjz32WDz++ONRV1fngwGwg2Sz2Tj66KPjC1/4QhQUFOT9Pl5//fU79tprr9/7ZAAAwI6jAAYAIC9ks9nMyy+/fFafPn2Oz/ddvPvuu3HbbbfFe++954MBsJN069YtvvOd70S3bt3yfhdLliy5f5999rmypqam0ScDAAC2PwUwAACpV1paWjBr1qyzevfufVw+7yGXy8WTTz4ZDz74oLt+AXaBbDYbxxxzTBxxxBF5fzfw0qVLHxg6dOjlSmAAANj+FMAAAKRar169mk2ePHlsu3btDsrnPaxcuTJuueWWePvtt30oAHaxnj17ximnnBIdOnTI6z2sXr16yiGHHPIvS5Ys2exTAQAA28+WCuDCyoHR9aO+0FgVUbMia3sAADRpQ4cOLXvqqacub9Omzf75uoNcLhfPPPNMXH/99bF27VofCoAmYP369TFlypQoKSmJnj17RiaTycs9NG/evPtJJ500ZPLkyc+sWLHCoykAAGA7KetcHwXlH/01BTAAAIk1ZMiQ0kceeeSKVq1a7Z2vO6iuro7bb789nnjiiWhs9IRNgKaksbEx5s+fH++//34MGDAgstn8/DlLaWlpp6997WuDn3rqqadXrlxZ75MBAACfnQIYAIDUOfTQQ1s8+OCDv2/ZsuUe+bqDOXPmxNVXX+2RzwBN3PLly+OFF16Ijh075u0joUtLSzudcMIJ+7/00ktPv/3227U+FQAA8NkogAEASJVhw4Y1v++++37TsmXLQfl4/vr6+hg/fnz88Y9/jNpaP0MHSILNmzfHiy++GJs3b47ddtstCgoK8m4HxcXFbY866qg9n3vuuaeXL1/ucdAAAPAZKIABAEiNI488snLcuHG/b9GixcB8PP97770XV111VcyZM8eHASCBFi1aFC+//HL069cvWrRokXfnLykp6XDcccftP2fOnGcWLVq0yScCAAC2jQIYAIBUOPLIIyvvvPPO35aXl++Wj+d/+umn48Ybb4wPP/zQhwEgwf7yl7/ECy+8ECUlJdGrV6+8O3+zZs3aHHXUUfspgQEAYNspgAEASLxjjz227W233faH5s2b98m3s1dVVcXNN98cTz31VDQ2NvowAKRAY2NjzJ8/P5YtWxYDBgyIZs2a5dX5mzVr1uaYY4458M0333xm4cKFNT4RAACwdRTAAAAk2qGHHtritttuuzofy9+33347rrnmmli8eLEPAkAKvf/++/HKK69Enz59orKyMq/Ons1mK4888sh9Zs6c+dTSpUs3+zQAAMCnpwAGACCxjjjiiJb33nvvteXl5f3y6dy5XC4mTZoUN998c1RVVfkgAKRYVVVVTJ06NbLZbPTp0ycymUzenL24uLjtV7/61c+/8sorTy1evLjWpwEAAD4dBTAAAIl06KGHtrj33nt/l2/lb3V1ddx0000xefLkyOVyPggAeSCXy8WCBQvi3Xffjd133z2y2fz5mUyzZs1aH3300fvNmDHjSXcCAwDAp6MABgAgcYYOHVo2fvz4qysqKgbk07mXLVsWV111lUc+A+SplStXxiuvvBKf+9znoqKiIm/O3axZszZHH3300GeeeebJFStW1PkkAADAlimAAQBIlCFDhpQ++uij17Rs2XL3fDr31KlT49prr42NGzf6EADksaqqqpg+fXq0bds2unTpkjfnLikpaT9q1KihTz755JMrV66s90kAAICPt6UCuMB6AABoSjp16pSdMGHCv1dWVu6RL2dubGyMcePGxR133BF1dW56AiCitrY2br755hg/fnw0NjbmzbkrKyv3mDBhwr9369bNXQkAALCNFMAAADQZrVq1Kpw+ffolbdq02T9fzlxdXR2/+93vYtKkSd73C8DfyeVy8fjjj8fvf//7qK6uzptzt2nTZv8pU6Zc0qpVq0KfAgAA2HoKYAAAmoSKioqC2bNnX9KuXbuD8uXMS5cujYsuuijmz5/vAwDAx3r11VfjoosuiqVLl+bNmdu1a3fQ7Nmz/72iosLPrgAAYCu5iAYAoEmYOXPmz9q1a3dIvpz35ZdfjiuuuCLWrVsnfAA+0bp16+KKK66Il19+OW/O3K5du4Nnzpz5M+kDAMDWUQADALDLvfjii2N69OgxKh/Omsvl4oEHHogbbrghamtrhQ/Ap1ZbWxs33HBDPPDAA3nz2oAePXqMevHFF8dIHwAAPj0FMAAAu9SkSZO+NnDgwFPy4ax1dXVx8803x8SJE73vF4BtksvlYuLEiXHLLbdEXV1dXpx54MCBJ0+aNOlr0gcAgE9HAQwAwC7z6KOPHnXggQeekw9nXbduXfz617+OWbNmCR6Az2zmzJnx61//Ol9eJZA58MADz3n00UePkjwAAHyywsqB0fWjvtBYFVGzImtDAADsEDfeeOO+Rx999EWZTKYw7Wddvnx5XHXVVbFy5UrBA7DdbNiwIWbPnh0DBw6MioqKtB8307179/179uz56sMPP7xc+gAA5LuyzvVRUP7RX1MAAwCw011xxRV7fPe7372qoKCgWdrPOmfOnPjtb38bGzduFDwA2111dXVMmzYtOnfuHB07dkz1WTOZTOHuu+9+eJs2bV6aNGnSKukDAJDPFMAAADQZZ5xxRvef/exnvy0sLCxP+1knTJgQd999d9TX1wsegB2moaEhXnrppchms9G3b99UnzWTyRTttddeB/3lL395dubMmRukDwBAvlIAAwDQJBx00EEVf/jDH64pLi7ulOZz5nK5eOCBB+Kxxx4TOgA77c+eBQsWRF1dXfTv3z8ymUxqz1pQUFBywAEHDJs+ffqkpUuXbpY+AAD5aEsFcIH1AACwMwwaNKj0vvvuu7qsrKxXms9ZV1cX1113XUyaNEnoAOx0EydOjOuvvz7q6upSfc6ysrJef/rTn67u379/idQBAODvKYABANjhKioqCh577LGLKyoqBqb5nNXV1XHNNdfE7NmzhQ7ALvPKK6/ElVdeGVVVVak+Z4sWLQZOnDhxbEVFhZ9vAQDA33CBDADADjdz5syftW3b9sA0n3HdunVx2WWXxRtvvCFwAHa5xYsXx2WXXRZr165N9TnbtWt34MyZM38mcQAA+P8UwAAA7FBPPvnkqB49eoxK8xlXrVoVV1xxRSxfvlzgADQZK1asiCuuuCJWrlyZ6nP26NFj1KRJk0ZJHAAA/lth5cDo+lFfaKyKqFmRtSEAALbZjTfeuO+XvvSlCzOZTGp/8fDdd9+NK6+8MtatWydwAJqc6urqmDVrVvTv3z8qKytTe85u3boN79mz57yHH37Yb2MBAJAXyjrXR0H5R39NAQwAwA5x3nnn9T311FOvLigoKE7rGV977bW45pprorq6WuAANFmbN2+OGTNmRI8ePaJ9+/apPGMmkykYNGjQIYWFhVOee+45v5UFAEDqKYABANipjjrqqFb/8R//8YdmzZq1SusZX3755bj++uujrq5O4AA0eQ0NDfHSSy9Fp06dolOnTqk8Y0FBQXbYsGGfnz9//qQ33nhjk9QBAEizLRXA3gEMAMB21a1bt+wNN9zwnyUlJR3TesYpU6bEjTfeGPX19QIHIDHq6+vjxhtvjKlTp6b2jCUlJZ1uuOGG/+jWrZu7GgAAyFsKYAAAtqunn376XyorK/dI6/kmTZoUd955ZzQ2NgobgMRpbGyMO+64I5588snUnrGysnLw008//UtpAwCQrxTAAABsN88///w3unTp8k9pPd/EiRNj3LhxkcvlhA1AYuVyubj//vtTXQJ36dLlS88+++yJ0gYAIB95BzAAANvFTTfdNPzII488L5PJZNJ4vsceeyzGjx8vaABS47XXXotmzZpF3759U3m+zp0779urV695Dz/88DJpAwCQNlt6B7ACGACAz+wXv/hF7x/+8IdXFxQUNEvj+R544IF45JFHBA1A6ixYsCDq6upiwIABqTtbJpPJDBo06ODGxsbnpk6dul7aAACkiQIYAIAd5oADDqj43e9+99tmzZq1TeP5xo0bF5MmTRI0AKm1aNGi2Lx5cwwcODB1ZysoKMjut99+w5577rnH33vvvc3SBgAgLbZUAHsHMAAA2yybzWbuvPPOfyktLe2exvNNmDBB+QtAXpg0aVI89NBDqTxbaWlpj3vuuedfstlsRtIAAOQDBTAAANvs+eef/06HDh0OTePZHn744Xj44YeFDEDeeOSRR+LPf/5zKs/WoUOHw5599tlvSxkAgHygAAYAYJvcd999hw8ePPjUNJ7t/vvvjwkTJggZgLzz2GOPxX333ZfKs+25554/+NOf/nSYlAEASDvvAAYAYKudccYZ3ceMGXN5QUFBcdrONnHixHjkkUeEDEDeWrx4cWSz2ejbt2/ajpbp06fPvn/5y18mz5w5c4OkAQBIsi29A1gBDADAVhk2bFjzG2+88Q/NmjVrl7azPfroo6l99CUAbI2FCxdGUVFR9OvXL1XnKigoKD7wwAP3e/LJJx9dsWJFnaQBAEiqLRXAHgENAMBWuffee39ZWlraPW3nevzxx+PBBx8UMAD8jz//+c8xceLE1J2rtLS0x3333fdLCQMAkFYKYAAAPrVJkyaN6tSp0xEpPFeMHz9ewADwD8aPHx+TJ09O3bk6der0hUmTJn1VwgAApJFHQAMA8Kmcd955fU888cR/z2QyRWk618yZM+Puu+8WMAB8jNdeey06duwYnTt3TtW5unbtuk9BQcHzzz333DopAwCQNN4BDADAZ3LEEUe0vOKKK67NZrOVaTrXyy+/HDfffHPkcjkhA8DHyOVyMXv27OjSpUt06tQpNefKZDJF++yzz/CpU6c+9u67726WNAAASeIdwAAAbLNsNpu55ZZb/q2kpKRjms61YMGCuPnmm6OxsVHIAPAJGhsb4+abb44333wzVecqLS3tcvfdd5+fzWYzUgYAIC0UwAAAbNGkSZO+3rZt2wPTdKZly5bFDTfcEPX19QIGgE+prq4urr322li+fHmqztWuXbsDH3/88VESBgAgLTwCGgCAj3XZZZcN+upXvzo2k8mk5hcH33///bjyyiujqqpKwACwlerq6uLll1+OIUOGRHl5eWrO1aVLl31LS0unPvPMM2ukDABAEngENAAAW61///4lJ5988q8ymUxRWs60YcOG+P3vfx8bN24UMABso40bN8bvfve7VP15WlBQkP3hD394ft++fYslDABA4q9vrQAAgI/y4IMPnl1WVtYrLeeprq6O3/zmN7Fq1SrhAsBntGrVqrjyyiujuro6NWcqKyvr8/DDD58lXQAAkk4BDADA/zF+/Pgju3XrdnRazlNfX5/KdxYCwK60fPnyuO6666K+vj41Z+rRo8dXx40bd4R0AQBIMgUwAAB/53vf+16nI4444py0nCeXy8Vtt90Wb7zxhnABYDt7/fXX47bbbotcLpeaMx155JHnfvvb3+4oXQAAkkoBDADA/6qoqCi4+OKLLywsLCxPy5nGjx8fs2bNEi4A7CCzZs2Khx56KDXnKSwsrPj1r399QUVFhZ+bAQCQSC5kAQD4XxMnThxdWVk5OC3nef7552PixImCBYAd7LHHHosXXnghNeeprKzc89FHHz1RsgAAJFFh5cDo+lFfaKyKqFmRtSEAgDxxwQUX7DZq1KgLM5lMYRrO8+qrr8Ytt9ySqkdSAkBT/7O3d+/e0a5du1Scp2PHjkNzudxzU6ZMWSddAACamrLO9VHwMc/wcwcwAADRt2/f4h//+McXZzKZVPwG4HvvvRc33HBDNDY2ChcAdpKGhoa47rrrYtmyZak4T0FBQfbss88e27dv32LpAgCQqGtZKwAAYPz48T8qKyvrkYazbNiwIX7/+99HbW2tYAFgJ9u0aVP8/ve/j40bN6biPGVlZb3GjRs3RrIAACSJAhgAIM/ddNNNw/v06XN8Gs5SX18f1157baxdu1awALCLrFmzJq699tqor69PxXn69ev3jd///vdDJQsAQFIogAEA8thBBx1Uceyxx/5rRGTScJ477rgjFi9eLFgA2MUWLVoUd955Z1qOU/CNb3zj34YNG9ZcsgAAJOIC1goAAPLXzTfffFZxcXG7NJxl4sSJMX36dKECQBMxbdq0mDRpUirOUlJS0unOO+88Q6oAACSBAhgAIE/913/914FdunT5UhrO8tprr8Wf//xnoQJAEzN+/PhYsGBBKs7SrVu3o2+66abhUgUAoKlTAAMA5KEvfelLlV/5yld+lYazrFixIq6//vpobGwULAA0MY2NjXHdddfFihUr0nCczHHHHfergw46qEKyAAA0ZQpgAIA8dPXVV5+ezWYrk36OmpqauPbaa2PTpk1CBYAmatOmTXHttddGTU1N4s+SzWbb3njjjT+RKgAATZkCGAAgz9x6663Du3Tp8uWknyOXy8Utt9wSK1euFCoANHErV66MW2+9NXK5XOLP4lHQAAA0dQpgAIA8MnTo0LKvfvWrv0jDWSZMmBBz584VKgAkxJw5c+Kxxx5LxVlGjRr1i6FDh5ZJFQCApkgBDACQR+64444fFRcXd0z6OV5++eV45JFHBAoACfPQQw+l4he4SkpKOt5xxx0/lCgAAE2RAhgAIE9cfvnlu/fs2XNU0s/xwQcfxB133JGKR0gCQL7J5XJx2223xZo1axJ/lp49ex57+eWX7y5VAACaGgUwAEAe6NatW/a73/3uv2YymURf/9XX18cNN9wQ1dXVQgWAhKqqqoobb7wx6uvrE32OTCZT8N3vfvdX3bp1y0oVAICmRAEMAJAHxo8ff0pZWVmvpJ/jnnvuiaVLlwoUABJuyZIlcd999yX+HGVlZT3Hjx9/ikQBAGhKFMAAACn385//vOeAAQNGJ/0c06dPjylTpggUAFJi8uTJMWPGjMSfY8CAAaN//vOf95QoAABNhQIYACDFstls5qyzzjo3k8kk+tGEK1asiLvvvlugAJAyd911V6xYsSLRZ8hkMtmzzjrr3Gw2m5EoAABNgQIYACDFxo0b98XKysq9knyG2trauOGGG6K2tlagAJAyf/1zfvPmzYk+R2Vl5V7jxo0bKVEAAJoCBTAAQEoNHz68/OCDDz4t6ee4//77Y/ny5QIFgJRavnx5jBs3LvHnGDFixI+HDRvWXKIAAOxqCmAAgJS69dZbT8tms22TfIYZM2bEc889J0wASLnJkyfHzJkzE32G4uLitrfffvtp0gQAYFdTAAMApNBVV121R48ePb6S5DOsXLky7rrrLmECQJ64++6744MPPkj0GXr27PnVK664Yg9pAgCwKymAAQBSprS0tOAb3/jGT5N8rdfY2Bi333679/4CQB6pqamJ2267LRobG5N8jIJvfvObZ5aWlvqZGwAAu+6i1AoAANJlwoQJX6uoqBiQ5DOMHz8+Fi1aJEwAyDNvvvlmPPjgg4k+Q4sWLQY9+OCDx0gTAIBdRQEMAJAiRx55ZOWwYcN+kOQzzJ07N5544glhAkCemjhxYixYsCDRZxg+fPiPjjjiiJbSBABgV1AAAwCkyBVXXHFyUVFRRVLnr6qqijvvvDNyuZwwASBP5XK5uP3226O6ujqxZygqKmrxm9/85mRpAgCwKyiAAQBS4vzzz+/Xu3fv45J8httvvz0+/PBDYQJAnlu3bl3cfvvtiT5D7969jz///PP7SRMAgJ1NAQwAkALZbDZz6qmn/jyTyST2+m769OkxZ84cYQIAERExe/bsmDFjRmLnz2QyBaeeeurPs9lsRpoAAOxMCmAAgBT44x//eERlZeXgpM6/du3auPfeewUJAPyde+65J9atW5fY+SsrKwf/6U9/+oIkAQDYmRTAAAAJ17dv3+JDDjnkR0k+w9133x01NTXCBAD+Tk1NTdx9992JPsPBBx/8o759+xZLEwCAnUUBDACQcHfdddc3S0pKOiV1/smTJ8e8efMECQB8pLlz58azzz6b2PlLSko63nPPPd+SJAAAO4sCGAAgwb70pS9VDhw48KSkzr9mzZoYP368IAGALXrggQdizZo1iZ2/f//+Jx111FGtJAkAwM6gAAYASLArrrji1MLCwvIkzp7L5eK2226LTZs2CRIA2KJNmzbFbbfdFrlcLpHzFxYWll1++eU/kCQAADuDAhgAIKF+8Ytf9O7evftXkjr/s88+G2+88YYgAYBP5Y033ojnn38+sfN369bt6F/96ld9JAkAwI6mAAYASKgf/vCHP8pkMom8nvvggw/igQceECIAsFXGjRsX69atS+TsmUym4NRTT/2xFAEA2NEUwAAACXTdddcNa9eu3YFJnD2Xy8Udd9wRtbW1ggQAtsqmTZvizjvvTOz8bdq02f+mm27aT5IAAOxICmAAgIQpLS0t+NrXvnZ6Uud/4YUXYuHChYIEALbJq6++GjNmzEjs/Mccc8zpFRUVfiYHAMAO42ITACBhbr/99oMrKip2S+LsGzZsiHHjxgkRAPhM7r///qiqqkrk7OXl5X3/67/+6wgpAgCwoyiAAQASpKKiouCwww47Nanz33vvvYn9YS0A0HRs2LAh7r///sTOf9BBB/1zq1atCiUJAMCOoAAGAEiQ+++//+iysrKeSZx9zpw58dJLLwkRANguXnjhhViwYEEiZy8tLe32xz/+8StSBABgR1AAAwAkRN++fYv33Xfff07i7LW1tXHvvfcKEQDYru6+++6oq6tL5Oz77bffKf379y+RIgAA25sCGAAgIW6++eZRxcXFbZM4+yOPPBJr164VIgCwXa1atSoee+yxRM6ezWbb3njjjV+TIgAA25sCGAAgAYYOHVq21157fSeJs7/33nvxxBNPCBEA2CEmTpwYK1asSOTsQ4YM+c7QoUPLpAgAwPakAAYASIBrr732xKKiosqkzZ3L5eKee+6JxsZGIQIAO0R9fX3cddddkcvlEjd7UVFR5bXXXnuCFAEA2J4UwAAATdwBBxxQMWDAgG8kcfYZM2bEW2+9JUQAYId6880348UXX0zk7AMGDPjG8OHDy6UIAMD2ogAGAGjirrrqqhOKiooqkjb3pk2b4oEHHhAgALBT3H///VFbW5u4uYuKilpcffXV7gIGAGC7UQADADRhBx10UEX//v0Teffvww8/HB9++KEQAYCdYv369TFhwoREzj5w4MBvHHDAARVSBABge1AAAwA0Yf/5n/95bGFhYfOkzb1q1aqYPHmyAAGAnerpp5+O1atXJ27uwsLC8ssuu2yUBAEA2B4UwAAATdQBBxxQMWjQoNFJnP3uu++O+vp6IQIAO1V9fX3cddddiZx99913/+bQoUPLpAgAwGelAAYAaKIuv/zyYwsLC8uTNvfcuXNjwYIFAgQAdokFCxbE3LlzEzd3UVFRi9/97ndflyAAAJ+VAhgAoAkaOnRo2aBBgxL37t+6urr405/+JEAAYJf605/+FHV1dYmbe/fdd//mkCFDSiUIAMBnoQAGAGiCfvOb33ylqKioZdLmfu655xL53j0AIF1Wr14dzz33XOLmLioqann11VcfLUEAAD4LBTAAQBPTq1evZoMHD/5m0uaurq6ORx55RIAAQJPwyCOPRHV1deLmHjJkyLe6deuWlSAAANtKAQwA0MTcdNNNxxQXF7dN2twTJkyIqqoqAQIATUJVVVUifzmtuLi43a233uouYAAAtpkCGACgCWnVqlXhXnvtdVLS5l61alU8++yzAgQAmpTJkyfHqlWrEjf30KFDR7dq1apQggAAbAsFMABAE3LLLbccXlJS0jlpcz/44INRX18vQACgSamvr48HH3wwcXOXlJR0vummmw6VIAAA20IBDADQRGSz2cwBBxzw7aTNvWjRonjppZcECAA0SS+99FIsXrw4cXOPGDHiO9lsNiNBAAC2lgIYAKCJuOaaa/YuLy/vm7S5H3roocjlcgIEAJqkXC6XyLuAy8vL+1111VV7SRAAgK2lAAYAaCK+8pWvfDdpM8+bNy8WLlwoPACgSVu4cGG8+uqrrg8BAMgLCmAAgCbgsssuG1RZWblPkmbO5XIxfvx44QEAifDAAw8k7qklrVu33veSSy7pLz0AALaGAhgAoAkYNWrUCUmbefbs2bFs2TLhAQCJsGzZsnjllVcSN/cJJ5xwovQAANgaCmAAgF3sn//5nzt37NjxiCTN3NjYGA888IDwAIBEGT9+fDQ0NCRq5k6dOn1h9OjRHaQHAMCnpQAGANjFfvSjH30tk8kk6rps2rRpsWrVKuEBAImyatWqeOGFFxI1cyaTKfzpT386SnoAAHxaCmAAgF1o0KBBpX369Plqkmaur6+PCRMmCA8ASKQJEyZEXV1dombu27fvV/r27VssPQAAPg0FMADALnTZZZcdXlRUVJGkmadOnRpr164VHgCQSOvXr48pU6YkauaioqLK3/zmN0dIDwCAT0MBDACwi2Sz2cy+++57UpJmrqurc/cvAJB4jz76aOLuAt5///1PymazGekBAPBJFMAAALvI1VdfPbSsrKx3kmaeMmVKbNiwQXgAQKJt2LAhnn/++UTNXFZW1ueqq67aS3oAAHwSBTAAwC7y5S9/+bgkzVtfXx8TJ04UHACQCo8//nji7gL+0pe+dLzkAAD4JApgAIBdYPTo0R3atm07IkkzT5s2LdatWyc8ACAVPvzww5g+fXqiZm7fvv2I0aNHd5AeAABbogAGANgFfvrTn47KZDKFSZm3vr4+HnnkEcEBAKnyyCOPRH19fWLmzWQyhT/96U+/JjkAALZEAQwAsJN16tQp26dPn6OTNLO7fwGANFq3bl1MmzYtUTP36dPnmE6dOmWlBwDAx1EAAwDsZFddddUB2Wy2dVLmbWxsjEmTJgmOVOvYsWN06OCJmgD5aNKkSdHY2JiYebPZbOurrrrqAMkBAPBxFMAAADvZiBEjvp6keV988cVYtWqV4Ei1Ll26xIUXXhinnXZadO3a1UIA8siqVavipZdecj0JAEBqKIABAHaiM844o3tlZeXeSZk3l8vFxIkTBUdeyGQyMXjw4PjVr34VY8aMcUcwQB55/PHHI5fLJWbeysrKvc8444zukgMA4KMogAEAdqJTTjnlqxGRScq8CxYsiPfee09w5JVMJhN77713XHjhhTFmzJho3769pQCk3HvvvRcLFy5M1B9X/3NdCQAA/4cCGABgJ+nVq1ezXr16fTlJM3v3L/nsr0XwBRdcECeffHK0bdvWUgBSLGnXPb169fpyr169mkkOAIB/pAAGANhJrrjiioOLiopaJmXeBN4JAztEYWFhDB8+PC688MIYPXp0VFZWWgpACi1YsCCWLVuWmHmLiopaXnnllYdIDgCAf6QABgDYSYYPH/6VJM2btHfhwY5WVFQUI0aMiEsuuSRGjx4dLVu2tBSAFMnlcvH4448naub99tvvK5IDAOAfKYABAHaC0aNHd6isrByalHnXrl0bL7/8suDgI/y1CL744ovjhBNOiBYtWlgKQEq89NJLsW7dusTMW1lZudfo0aM7SA4AgL+lAAYA2AlOP/30o5J07fXMM89EQ0OD4GALiouL47DDDouxY8fGqFGjoqyszFIAEq6hoSGeeeaZJI1c8D/XmQAA8P8vEq0AAGDHymazmX79+n05KfPW1tbGlClTBAefUnFxcYwcOTIuvfTSGDVqVJSWlloKQII9//zzUVtbm5h5+/Xr9+VsNpuRHAAAf6UABgDYwX7zm9/sWVJS0jkp886YMSOqq6sFB1uppKQkRo4cGZdcckkcffTRUVJSYikACVRdXR0zZ85M0p8/na+44orBkgMA4K8UwAAAO9gXvvCFLyVl1lwuF08//bTQ4DNo3rx5HHXUUXHJJZfEyJEjI5vNWgpAwjz11FORy+USM++RRx75ZakBAPBXCmAAgB1oyJAhpZ07dz4iKfO+/vrrsWLFCsHBdlBeXh6jRo2KSy+9VBEMkDArVqyI119/PTHzdunS5fD+/ft79AQAABGhAAYA2KHGjh17aGFhYWJeCOruX9j+KioqYtSoUXHxxRfH4YcfHkVFRZYC4LpouyosLGz+H//xHwdLDQCACAUwAMAOteeeex6ZlFnXrl0b8+bNExrsIK1atYrjjz8+LrroohgxYkQUFPh2DKApmzdvXqxZsyYx8+61115HSg0AgAgFMADADnPMMce0bt269b5Jmfe5556LxsZGwcEO1qZNmxg9enRcfPHFimCAJqyxsTGee+65JP35MvyYY45pLTkAAPykAQBgBznzzDMPz2Qyibjeqq+vj6lTpwoNdqK2bdvG6NGj47zzzovhw4crggGaoBdeeCHq6+sTMWsmkyk844wzDpUaAAB+wgAAsIP079//C0mZdc6cObFhwwahwS7QqVOnOPnkk+Pf/u3fYu+9945MJmMpAE3Ehg0bYvbs2YmZd8CAAR4DDQCAAhgAYEf43ve+16mysnKPpMybpMcbQlp17tw5xowZE7/61a8UwQBNyPPPP5+YWSsrKwd/73vf6yQ1AID8pgAGANgBTj755CMiIhHtzcqVK+P1118XGjQRXbt2jTFjxsQ555wTgwcPthCAXez111+PlStXJmXczMknn3y41AAA8psCGABgB+jXr19iHv88ZcqUyOVyQoMmpnfv3nHaaafFOeecE/3797cQgF0kl8vFlClTknQd6jHQAAB5TgEMALCdnX766d0qKip2S8Ks9fX1MW3aNKFBE9anT58466yz4pxzzonddtvNQgB2gWnTpkV9fX0iZq2oqNjt9NNP7yY1AID8pQAGANjORo8efURSZp03b15s3LhRaJAAffr0ibPPPjvOPPPM6Nmzp4UA7EQbN26MefPmuR4FACARFMAAANtZr169EvPetSQ9zhD4bwMGDIhf/vKXceaZZ0b37t0tBGAnmTp1apKuRw+TGABA/lIAAwBsR2eccUb38vLyvkmYdf369fHaa68JDRJqwIAB8S//8i9x2mmnRbdunvQJsKPNnz8/Pvzww0TMWl5e3u9HP/pRF6kBAOQnBTAAwHZ03HHHHZSUWWfMmBGNjY1CgwTLZDIxePDg+Nd//dcYM2ZMdOjQwVIAdpDGxsaYMWNGYub9xje+cYjUAADykwIYAGA76tOnz8FJmDOXyyXqMYbAlmUymdh7773jwgsvjDFjxkT79u0tBWAHeOGFF5J0XXqIxAAA8pMCGABgOznppJPat2zZcvckzLpkyZJYuXKl0CBl/loEX3DBBXHyySdH27ZtLQVgO1qxYkW8/fbbiZi1srJy0PHHH+8PAgCAPKQABgDYTr773e8eGBGZJMyapMcXAluvsLAwhg8fHhdeeGGMHj06KisrLQVgO5k+fXpSRi34/ve/f6DEAADyjwIYAGA72X333Q9Nwpz19fUxc+ZMgUEeKCoqihEjRsQll1wSo0ePjpYtW1oKwGc0c+bMqK+vT8SsAwcOPFRiAAD5RwEMALAdHHTQQRUtW7bcKwmzLly4MKqrq4UGeeSvRfDFF18cJ5xwQrRo0cJSALZRVVVVvP7664mYtVWrVkOHDx9eLjUAgPyiAAYA2A7OPvvsz2cymaIkzOrxz5C/iouL47DDDouxY8fGqFGjoqyszFIAtkFSnqaSyWSy55577uclBgCQXxTAAADbwe67735AEuasra2NOXPmCAzyXHFxcYwcOTIuvfRSRTDANpg9e3bU1dUlYtY99tjjAIkBAOQXBTAAwGfUqlWrwnbt2u2fhFnnzZsXtbW1QgMiIqKkpCRGjhwZY8eOjaOPPjpKSkosBeBT2LRpU8ybNy8Rs7Zv337/iooKPwMEAMgjLv4AAD6jCy+8cPeioqKKJMz64osvCgz4P5o3bx5HHXVUXHLJJTFy5MjIZrOWAvAJZs2alYg5i4qKWlx88cWDJAYAkD8UwAAAn9GBBx6YiMfqVVdXJ+ZOFWDXKC8vj1GjRsWll16qCAb4BPPmzYuamppEzHrQQQd5DDQAQB5RAAMAfEZdu3YdnoQ5582bF/X19QIDPlFFRUWMGjUqLr744jj88MOjqKjIUgD+QV1dXbz66quJmLVLly77SwwAIH8ogAEAPoNTTjmlY3l5+W5JmPXll18WGLBVWrVqFccff3xcdNFFMWLEiCgo8C0kwN966aWXEjFnRUXFbieddFJ7iQEA5AffvQMAfAYnnnji55MwZ21tbcyfP19gwDZp06ZNjB49OsaOHasIBvgb8+fPj9ra2iSMmvnud7/7eYkBAOQH37UDAHwGn/vc5/ZLwpwLFy6Muro6gQGfyV+L4PPOOy+GDx+uCAby3ubNm2PhwoWJmLVfv37DJQYAkB98tw4AsI1atWpV2Lp1672TMKvHPwPbU6dOneLkk0+Oc889NwYNGmQhQF6bPXt2IuZs06bN3hUVFX4WCACQB1z0AQBso/PPP39gYWFheVOfs76+PubMmSMwYLvr2bNn/OQnP4nzzjsv9t5778hkMpYC5J3Zs2dHfX19k5+zqKio4vzzzx8oMQCA9FMAAwBso/3333/fJMz5+uuvR01NjcCAHaZLly4xZsyYOOecc2Lw4MEWAuSV6urqeOONNxIx64EHHriPxAAA0k8BDACwjbp27ZqIxz/PnTtXWMBO0bt37zjttNPinHPOif79+1sIkDeScr3VvXv3vaUFAJB+CmAAgG0wZMiQ0srKyj2a+py5XM7jn4Gdrk+fPnHWWWfFOeecE7vttpuFAKk3e/bsyOVyTX7Oli1b7jlo0KBSiQEApJsCGABgG5x55pl7ZjKZbFOfc9myZbFu3TqBAbtEnz594uyzz44zzzwzevbsaSFAaq1bty6WL1/e5OfMZDLZs846a4jEAADSrcgKAAC23tChQ4clYc558+YJC9jlBgwYEAMGDIgFCxbE+PHjY+nSpZYCpM68efOiS5cuTX7OffbZZ5+ImC4xAID0cgcwAMA26Nix4z5JmHP+/PnCApqMAQMGxC9/+cs47bTTolu3bhYCpEpSrrs6deq0j7QAANJNAQwAsJWOOOKIlhUVFf2a+pxVVVWxaNEigQFNSiaTicGDB8e//uu/xpgxY6JDhw6WAqTCW2+9FVVVVU1+zoqKis8deuihLSQGAJBeCmAAgK108sknD46ITFOfc/78+dHY2CgwoEnKZDKx9957x4UXXhhjxoyJ9u3bWwqQaI2NjbFgwYJE/Cv4u9/97h4SAwBILwUwAMBW2n333fdMwpze/wskwV+L4AsuuCBOPvnkaNu2raUAiZWU66/BgwfvKS0AgPQqsgIAgK3Trl27wU19xlwul5Q7UAAiIqKwsDCGDx8e++yzT0ybNi0mTJgQ69evtxggURYsWBC5XC4ymab9sJgOHToMlhYAQHq5AxgAYCsMGjSotGXLlgOa+pzvvfdebNy4UWBA4hQVFcWIESPikksuidGjR0fLli0tBUiMDz/8MJYtW9bk52zZsuXA/v37l0gMACCdFMAAAFvhxz/+8aBMJtPkn6Li7l8g6f5aBI8dOzZOOOGEaNGihaUAibBw4cImP2Mmk8n+5Cc/GSAtAIB0UgADAGyFvffee88kzJmEHzwCfBrNmjWLww47LMaOHRujRo2KsrIySwGatKT8Il5SrmsBANh63gEMALAVunbtOqSpz1hfXx9vvvmmsIBUKS4ujpEjR8bBBx8czz77bDz++ONRXV1tMUCT8+abb0Z9fX0UFTXtH7t16dJlT2kBAKSTO4ABAD6lioqKgoqKikFNfc4lS5bE5s2bBQakUklJSYwcOTLGjh0bRx99dJSUeIUl0LTU1tbG0qVLm/ycLVu2HFRaWupngwAAKeQiDwDgUzr77LP7FhYWNvlnj7722mvCAlKvefPmcdRRR8Ull1wSI0eOjGbNmlkK4HpsKxQWFpafffbZvaQFAJA+CmAAgE9p//3375+EOV9//XVhAXmjvLw8Ro0aFf/+7/8eI0eOjGw2aymA67FP6fOf//xAaQEApI8CGADgU+rRo8fuTX3G2traePvtt4UF5J2KiooYNWpUXHzxxXH44Yc3+XdvAum2ePHiRLySo1evXoOkBQCQPgpgAIBPqXXr1k3+DoklS5ZEQ0ODsIC81apVqzj++OPj4osvjhEjRkRBgW97gZ2voaEhlixZ0uTnbNOmjQIYACCFfCcMAPApDBkypLR58+a9m/qcb775prAAIqJ169YxevToGDt2rCIYcF32MZo3b95n0KBBpdICAEgX3wEDAHwKp556av9MJtPkr53eeustYQH8jTZt2sTo0aPjvPPOi+HDhyuCAddlfyOTyRT84Ac/+Jy0AADSxXe+AACfwuDBg5v84/Hq6+tj0aJFwgL4CJ06dYqTTz45/u3f/i323nvvyGQylgLsUIsXL07Eqzn23HPPgdICAEgXBTAAwKfQpUuXAU19xnfeeSfq6uqEBbAFnTt3jjFjxiiCgR2utrY23n333SRc53oPMABAyiiAAQA+hZYtW/Zv6jN6/DPAp9elS5cYM2ZMnHvuuTF48GALAfL2+iwJ17kAAGwdBTAAwCcYPnx4eUlJSeemPqfHPwNsvV69esVpp50W55xzTvTvrwMB8u/6rLS0tPPw4cPLpQUAkB4KYACAT/Ctb31rt4ho8s8IXbx4sbAAtlGfPn3irLPOinPOOSd22203CwG2i4T8gl7m29/+dj9pAQCkhwIYAOAT7L777k2+CVi7dm1s2LBBWACfUZ8+feLss8+OM888M3r27GkhwGfy4Ycfxrp165r8nAMHDlQAAwCkSJEVAABsWadOnZr8D8TefvttQQFsRwMGDIgBAwbEggULYvz48bF06VJLAbb5Oq1Vq1audwEA2GkUwAAAn6CyslIBDJCnBgwYEP3794958+bFQw89FO+++66lAFtlyZIlsddeezX1613PvgcASBEFMADAFnTq1CnbvHnzXk19ziVLlggLYAfJZDIxePDg2GOPPeLll1+OBx98MFauXGkxQGqu05o3b967Xbt2RatXr66XGABA8nkHMADAFowZM6ZnJpPJNuUZGxsbPZoUYCfIZDKx9957x4UXXhhjxoyJ9u3bWwrwiZYuXRqNjY1NesaCgoLsqaee2kNaAADp4A5gAIAt2Hvvvfs29RlXrlwZtbW1wgLYSf5aBO+5554xa9asmDBhQqxevdpigI9UW1sb77//fnTu3LlJzzls2LC+EbFIYgAAyecOYACALejRo0eTL4DfeecdQQHsAoWFhTF8+PC48MILY/To0VFZWWkpQGKv15Jw3QsAwKejAAYA2ILWrVs3+ff/vvvuu4IC2IUKCwtjxIgRcckll8To0aOjZcuWlgIk7notCde9AAB8Oh4BDQCwBc2bN+/Z1GdUAAM0kW+wi4pixIgRsd9++8WUKVPiscceiw0bNlgMEO+9914SrnsVwAAAKeEOYACAj9G/f/+SkpKSjk19TgUwQNPSrFmzOOyww2Ls2LExatSoKCsrsxTIc0m4XistLe3Ut2/fYmkBACSfAhgA4GOccMIJ3Zr69dK6deuiqqpKWABNUHFxcYwcOTJ+/etfK4Ihz1VVVcX69eub+pgF3/zmN7tLCwAg+RTAAAAfY8iQIT2b+oxJeJwgQL77axE8duzYOProo6OkpMRSIA8l4botCde/AAB8MgUwAMDH6N69e8+mPqPHPwMkR/PmzeOoo46KSy65JEaOHBnNmjWzFMgjSbhuS8L1LwAAn0wBDADwMVq1atWjqc+4bNkyQQEkTHl5eYwaNSr+/d//PUaOHBnZbNZSIA8k4botCde/AAB8MgUwAMDHqKio6NXUZ1y+fLmgAJL750yMGjUqLr744jj88MOjqKjIUiDFknDd1rJly16SAgBIPgUwAMBHyGazmbKysq5NecbGxsZYtWqVsAASrlWrVnH88cfHxRdfHCNGjIiCAt+qQxqtWrUqGhsbm/SMJSUlXbPZbEZaAADJ5rtKAICPcNxxx7UrKCgobsozrl69Ourr64UFkBKtW7eO0aNHx9ixYxXBkEJ1dXXxwQcfNOkZCwoKio877rh20gIASDbfTQIAfITPf/7zXZr6jO+//76gAFKoTZs2MXr06Dj//PNj+PDhimBIkRUrVrgOBgBgh/NdJP+PvTuPr7I888d/nSwEkhD2HUQEUVRAoIiouCtq64Jabd1arVorbqO2tlXbaavTOu38Rqffdmpbu9rWpYogsqgFRXCttAIKArJDgAAJBLKQ5JzfH8WO4+DOcp6T9/v18jWvTv657ut6hNvnk/t+AICd2G+//bL+xVcSXiAC8PF17do1Lr300rj99ttj2LBhkUq5lRWSLgn7tyTsgwEAeH8FWgAA8H917txZAAxAVujevXtceeWVsXr16njiiSdi9uzZkclkNAYSKAn7tyTsgwEAeH8CYACAnWjXrp0roAHIKj169Igrr7wyli5dGpMmTYo5c+ZoCiRMEvZvSdgHAwDw/gTAAAA7UVxc3D3baxQAAzRPffr0ibFjx8aSJUti/PjxsWDBAk2BhEjC/i0J+2AAAN6fbwADAOxESUlJz2yur7q6Ourq6gwKoBnbb7/94l/+5V/ia1/7WhxwwAEaAglQV1cX1dXV9sEAAOxWAmAAgHc5/PDDSwsKCtpmc40VFRUGBUBERPTt2zduvPHGuOGGG2LffffVEMhy2b6PKygoaDt8+PASkwIASC4BMADAu5x44oldsr3GDRs2GBQA/8uAAQPiG9/4Rtxwww3Ru3dvDQH7uE+yH+5qUgAAyeUbwAAA79KvX7+sD4DXr19vUADs1IABA+LAAw+MuXPnxoQJE2LlypWaAlkkCTe5HHDAAV0i4i3TAgBIJgEwAMC7dO/evXO21+gEMADvJ5VKxaBBg2LgwIExe/bsGD9+fKxbt05jwD4uZ/bDAAC8NwEwAMC7tG/fvlO21ygABuDDSKVSMWzYsBg6dGjMnj07HnvsMbdIwF6WhBPASdgPAwDw3gTAAADv0rp166w/8ZCEF4cAZI+3g+BDDz00XnnllZg4caK/S8A+LtH7YQAA3psAGADgXUpKSrL6xENjY2Ns3rzZoAD4yPLz8+Pwww+P4cOHx/PPPx8TJ06MqqoqjYE9aPPmzdHY2BgFBdn7Wi7b98MAALw/ATAAwLu0bNmySzbXV1lZGZlMxqAA+Njy8/Nj1KhRMXLkyHjhhRcEwbAHZTKZqKqqio4dO9oPAwCwWwiAAQDepaioKKuvvKusrDQkAHaJgoKCGDVqVIwYMSJmzpwZkydPji1btmgM7IH9XDYHwNm+HwYA4P3laQEAwP8YPnx4SX5+fkk21ygABmBXa9GiRRx//PFxxx13xNlnnx0lJSWaAs14P5efn18yfPhwfxAAACSUABgA4B2OOOKIDtleo+//ArC7FBUVxejRo+P73/9+nH322VFcXKwpsBsk4cr1JOyLAQDYOQEwAMA79O3bt1221+gEMAC729tB8B133BGnn356tGrVSlOgme3n9ttvv7YmBQCQTAJgAIB36NSpkwAYAHYoKSmJz3zmM3HnnXfG6NGjo0WLFpoCzWQ/l4R9MQAAOycABgB4hw4dOrTN9hqTcGUgALmlpKQkzj777PjOd74To0aNivz8fE2BHN/PJWFfDADAzgmAAQDeoaysrG221ygABmBvad++fVx00UVx5513xgknnBCFhYWaAjm6nysrK3MCGAAgoQTAAADvUFJS0j6b68tkMlFdXW1QAOxV7dq1i/POOy+++93vxqhRoyIvz+sF+CiSsJ8rLS0VAAMAJJT/QgMAeIfi4uK22VxfXV1dNDY2GhQAWeHtE8F33HGHIBg+gsbGxqirq7MvBgBgt/BfZgAA79CqVausPung9C8A2ahDhw5x0UUXxbe//e04/PDDBcGQA/u6oqIiJ4ABABLKf5EBALxDQUGBABgAPqauXbvGpZdeGt/61rdi2LBhkUqlNAUSuq9r0aJFW1MCAEimAi0AAPgfhYWFZdlc39atWw0JgKzXrVu3uPLKK2P16tXxxBNPxOzZsyOTyWgMJGhfl+37YgAA3psAGADgnZujgoLW2VyfE8AAJEmPHj3iyiuvjKVLl8akSZNizpw5mgIJ2ddl+74YAID35gpoAIAdWrdunZefn98ym2sUAAOQRH369ImxY8fGLbfcEgMGDNAQSMC+Lj8/v1WrVq28OwQASCCbOACAHQYNGlQSEVn9scJt27YZFACJtd9++8UNN9wQX/va1+KAAw7QEJq1BOzr8gYPHlxsUgAAySMABgDY4YADDijJ9hpramoMCoDE69u3b9x4441xww03xL777qshNEu1tbVZX2P//v1LTQoAIHl8AxgAYIeePXtm/QuuJLwoBIAPa8CAATFgwICYP39+jBs3LpYvX64pNBtJ2Nf16NGjxKQAAJJHAAwAsEOnTp0EwACwFwwYMCAOPPDAmDt3bkyYMCFWrlypKeS8JOzrunbtKgAGAEggATAAwA5lZWVZ/4Krrq7OoADISalUKgYNGhQDBw6M2bNnx4QJE2Lt2rUaQ85KQgDcpk0bV0ADACSQABgAYIeysjIngAFgL0ulUjFs2LAYOnRozJ49O8aPHx/r1q3TGHKOABgAgN1FAAwAsENJSUlxttfoBDAAzcXbQfCQIUPi5ZdfjokTJ0ZFRYXGkDOSEAAnYX8MAMD/JQAGANihqKioKNtrrKmpMSgAmpW8vLw4/PDDY/jw4fH888/HE088EZWVlRpD4iUhAG7RokWRSQEAJI8AGABgh8LCwhbZXF86nY7t27cbFADNUn5+fowaNSpGjhwZL7zwQkycODGqqqo0hsTavn17ZDKZSKVSWVtjixYtWpgUAEDyCIABAHbI9gC4oaHBkABo9goKCmLUqFExYsSImDlzZkyePDm2bNmiMSROJpOJhoaGyOaMtbCw0AlgAIAk/neTFgAA7NgYFRRk9QuuxsZGQwKAHVq0aBHHH398HHnkkfHMM8/E1KlTY9u2bRpDomR7AJzt+2MAAN5jH6cFAAA7NkZZ/oLL9c8A8H8VFRXF6NGj49hjj41nnnkmpkyZEjU1NRpDImT7DS8FBQWugAYASCABMADA2xujLH/B5QpoAHhvbwfBRx11VEyfPj2efvrpqK2t1RiymgAYAIDdIU8LAAD+QQAMAMlXUlISn/nMZ+LOO++M0aNHZ/X1uiAABgBgdxAAAwDskO1XQAuAAeDDKykpibPPPjv+7d/+LUaPHh2FhYWagv3dR5Sfn9/SlAAAkkcADADw9sYoL88JYADIMa1bt46zzz47vve978UJJ5wgCMb+7iPIz8/3LwwAQAIJgAEAdkilUlm9N2psbDQkAPiY2rVrF+edd15897vfjRNOOCEKCgo0Bfu7D94f55sSAEDyCIABAHbI9gA4nU4bEgB8Qu3bt/9nEDxq1KjIy/NqBPu799kfp0wJACB5/FcOAMAOXnABQPPRoUOHuOiii+J73/ueIJi9JpPJZHuJ/sUAAEggmzgAgP+R1QFwAl4QAkDidOzYMS666KL41re+FYcffnj4fTDs796xOc7yG3IAANg5mzgAgITsjQTAALD7dOvWLS699NL41re+FcOGDRMEs0dk+xXQeXl5/kUAAEigAi0AAPiHbH/BJQAGgN2ve/fuceWVV8ayZcviiSeeiDlz5mgKzXl/5/AIAEACCYABAHbIZDJOAAMAERGx7777xtixY2PJkiUxYcKEmD9/vqZgfwwAQCIIgAEA/ocr7gCA/2W//faLG264Id56660YP358vPnmm5rCLpPtV0Cn3IUOAJBIAmAAgB2y/QVXtr8gBIBc1rdv37jxxhvjrbfeinHjxsWiRYs0hU/MFdAAANjEAQDsXln9Bs4BDADY+/r27Rs333xz3HDDDdG7d28NIdf3d75BAgCQQE4AAwDskO0nMATAAJA9BgwYEAMGDIj58+fHI488EitXrtQUcnF/5woaAIAEcgIYAGCHVCqVzvL6DAkAssyAAQPi1ltvjbFjx0bPnj01hJza32UScEc1AAD/lxPAAAD/QwAMAHysv6MHDRoUBx98cDz//PMxadKk2LRpk8aQ+P1dtv+CJAAAO+cEMADADul0dr/fEgADQHarr6+PioqK2LZtm2aQE/u7dDrtBDAAQAI5AQwA8D+cAAYAPrK6urp4+umnY9q0acJfcm1/5wQwAEACCYABAP6HEw4AwIfW0NAQ06ZNiyeffDK2bt2qIXxkCfgGsAAYACCBBMAAADtkMpmsDoDz8ny9AwCywdvB71NPPRXV1dUaQs7u7wTAAADJJAAGANgh219wCYABYO9qbGyMGTNmxJNPPhmVlZUawieWn5+f9VtkUwIASB4BMADADplMpiGb6yssLDQkANgL0ul0zJo1KyZPnhwbN27UEHaZgoLsfjXX1NTUaEoAAAncZ2oBAMA/NDY2bs/m+gTAALBnpdPpePnll2Py5Mmxdu1aDWGXa9GiRbb/O1BvSgAAySMABgDYoampSQAMAEQmk4nZs2fH448/HuXl5RpCs93fNTY2CoABABJIAAwAsENDQ0NWv+ASAAPA7vV28PvEE0/E6tWrNYTdLtuvgM72G3IAAHiPfaYWAAD8gyugAaD5mjNnTkyaNCmWLl2qGewx2X4FtAAYACCZBMAAADs0NTU5AQwAzcyCBQtiwoQJ8dZbb2kG9nfv0tDQIAAGAEggATAAwA7Z/oJLAAwAu87ChQtj/PjxsXjxYs1gr8n2K6Cz/RckAQB4j32mFgAA/EO2B8AFBQWRl5cX6XTasADgY1q+fHmMGzcu5s+frxnsVXl5eVkfAG/fvt0JYACABBIAAwDs0NDQkPUnHFq1ahXbtm0zLAD4iFauXBmPPPKI4Jes2tclYH8sAAYASCABMADADrW1tXXZXqMAGAA+mnXr1sX48eNj9uzZkclkNISs2tdlu7q6ulqTAgBIHgEwAMAOW7du3ZrtNSbhRSEAZIP169fHY489JvjFvu4TqK6u3mpSAADJIwAGANihqqpKAAwACbdhw4Z4/PHH45VXXommpiYNwb7uE6isrHT1DABAAgmAAQB22LRpU9a/4GrZsqVBAcBOVFVVxcSJE+OFF16IxsZGDSHrJSEA3rRpkxPAAAAJJAAGANhh3bp1WR8AOwEMAP/bli1bYsKECYJfEicJ+7ry8nIBMABAAgmAAQB2WLZsmSugASAhqqurY/LkyTFz5syor6/XEBInCfu6pUuXCoABABJIAAwAsMP8+fOz/gRwcXGxQQHQrNXU1MSUKVPimWeeEfySaEnY173++uu+AQwAkEACYACAHRYsWFCXyWQaUqlUYbbW2Lp1a4MCoFmqq6uLp59+OqZNmxbbtsmkSL5s39el0+mGpUuXbjcpAIDkEQADALxDU1PTtoKCgrbZWp8AGIDmZvv27TF9+vR48sknY+tWt9GSO7J9X9fU1ORfOACAhBIAAwC8Q0NDw9ZsDoBLS0sNCYDm8ndyTJs2LZ566qmorq7WEHJOtu/rGhsb/YsHAJBQAmAAgHeor6+vbNWqVc9src8JYAByXWNjY8yYMSOefPLJqKys1BByVrbv6+rr66tMCQAgmQTAAADv0NDQkNVvmgXAAOSqdDods2bNismTJ8fGjRs1hJyX7fu6bN8XAwDw3gTAAADvUFdXV5XN9ZWWlkYqlYpMJmNYAOSETCYTr732Wjz++OOxatUqDaFZSKVSUVJSktU11tbWVpkUAEAyCYABAN5h27Ztm7K5vvz8/GjVqlXU1NQYFgCJlslkYvbs2fH4449HeXm5htCstGrVKvLz87O6xq1btzoBDACQUAJgAIB3qK6u3pztNZaVlQmAAUist4PfiRMnxpo1azSEZqmsrCzra9y2bVuVSQEAJJMAGADgHaqqqjZle43t2rWLtWvXGhYAiTNnzpyYNGlSLF26VDNo1tq1a5f1NW7atMkJYACALNbQWBgFjQ0REZFKRSavMJre/pkAGADgHSoqKqqyvcYkvDAEgHdasGBBTJgwId566y3NgITs5zZs2CAABgDIYoUFDf9MejMRqab0/+S+AmAAgHdYtWpV1r/oatu2rUEBkAgLFy6M8ePHx+LFizUD3iEJAfDq1aurTAoAIJkEwAAA77BgwYKsD4CdAAYg2y1fvjzGjRsX8+fP1wzYiST8Ql8S9sUAAOycABgA4B2eeOKJjZlMpimVSuVna41OAAOQrVauXBmPPPKI4Bc+QLb/Ql8mk2l64oknNpoUAEAyCYABAN6huro6vX379g1FRUVdsrVGJ4AByDZr166NCRMmxOzZsyOTyWgIJHw/t3379g3V1dVpkwIASCYBMADAu9TV1a0XAAPAB1u/fn089thjgl/Isf1cXV3delMCAEguATAAwLvU1dVVtGnTJmvrKykpiRYtWsT27dsNC4C9oqKiIiZOnBivvPJKNDU1aQh8BEVFRVFcXJz1+2GTAgBILgEwAMC7bN26dV2XLll7ADhSqVR07Ngx1qxZY1gA7FFVVVUxceLEeP755wW/8DF17NgxUqlU1u+HTQoAILkEwAAA71JVVZX1Jx46deokAAZgj9m8eXM8/vjj8cILL0RjY6OGwCfcx9kPAwCwOwmAAQDeZf369Vn/zbMkvDgEIPm2bNkSU6ZMiZkzZ0Z9fb2GwC7QsWNH+2EAAHYrATAAwLusXr066088JOHFIQDJVVNTE1OmTIlnnnlG8Au7WBJ+kW/VqlUCYACABBMAAwC8y9///ves/+aZABiA3aG2tjYmT54czz77bNTV1WkINNN93KuvvioABgBIMAEwAMC7PPzww+t//OMfN6RSqcJsrbFz584GBcAus3379pg+fXpMnTo1tm3bpiGwG2X7CeB0Ot3w8MMPC4ABABJMAAwA8C7V1dXpurq68latWu2TrTV26NAh8vLyIp1OGxgAH1tDQ0NMmzYtnnrqqaiurtYQ2M3y8vKiQ4cOWV1jfX39mtraWptMAIAEEwADAOxEbW3tmmwOgAsKCqJdu3axceNGwwLgI2tsbIwZM2bEk08+GZWVlRoCe0j79u2joCC7X8fV1NSUmxQAQLIJgAEAdmLz5s2r2rdvn9U1duvWTQAMwEeSTqdj1qxZMXnyZH+HwF7av2W7LVu2rDQpAIBkEwADAOzEpk2bVvfp0yera+zWrVvMmzfPsAD4QG8Hv1OmTIkNGzZoCOzF/Vu227BhwxqTAgBINgEwAMBOrFixYvWwYcOyusYkvEAEYO/KZDLx0ksvxZQpU6K83K2usLd17do162tctWrVKpMCAEg2ATAAwE7Mnz9/9ZgxY7K6xiS8QARg78hkMjF79uyYOHFirFnjMB9kiyT8At+8efP8oQEAkHACYACAnRg3btyab37zm5mISGVrjU4AA7Azc+bMiSeeeCKWLVumGZBlEvALfJlx48atNikAgGQTAAMA7MTrr79e29DQsKmwsLBDttZYXFwcZWVlsWXLFgMDIBYsWBDjx4+PJUuWaAZkobKysiguLs7qGhsaGjYuWLCgzrQAAJJNAAwA8B62bt26vF27dh2yucauXbsKgAGauYULF8b48eNj8eLFmgFZLAm3t2zbtm25SQEAJJ8AGADgPVRVVS1t167d0GyusWfPnrFw4ULDAmiGli1bFo899ljMnz9fMyABevbsmfU1VlZWLjUpAIDkEwADALyHdevWLevTp09W15iEF4kA7ForVqyIRx99VPALCZOEfdvatWuXmRQAQPIJgAEA3sPChQuXHX744VldY69evQwKoJlYtWpVjB8/PubOnRuZTEZDIGGSsG9buHDhMpMCAEg+ATAAwHuYNm3a0ksuuSSra+zevXvk5+dHU1OTgQHkqHXr1sX48eNj9uzZgl9IqIKCgkR8A/jpp59eZloAADmw/9QCAICde+ihhzbcd999W/Pz80uzdjNXUBBdunSJNWvWGBhAjqmoqIiJEyfGyy+/HOl0WkMgwbp27RoFBdn9Gq6xsbH6kUce2WBaAADJJwAGAHgf27ZtW15WVnZwNtfYq1cvATBADqmqqoqJEyfG888/74YHyBFJ+P7vtm3blpsUAEBuEAADALyPLVu2LMv2ALhnz57x0ksvGRZAwm3evDkef/zxeOGFF6KxsVFDIIck4fu/W7ZsWWpSAAC5QQAMAPA+1q9fvyzbT2z06NHDoAASbMuWLTFlypSYOXNm1NfXawjkoCTs19avX7/MpAAAcoMAGADgfSxYsGDh0KFDs7rGfffdN1KpVGQyGQMDSJCampqYMmVKPPPMM4JfyGGpVCr23XffrK9z/vz5C00LACA3CIABAN7Ho48++uYFF1yQ1TWWlJRE586dY926dQYGkAC1tbUxefLkePbZZ6Ourk5DIMd17do1WrVqlfV1/vnPf15kWgAAuUEADADwPiZNmlRVX1+/oaioqGM217nvvvsKgAGy3Pbt22P69OkxderU2LZtm4ZAM9GnT5+sr7G+vr7iySefrDItAIDcIAAGAPgAW7duXZTtAXCfPn3ipZdeMiyALNTQ0BDTpk2Lp556KqqrqzUEmpkkXP+8detWp38BAHKIABgA4ANUVFQs7NChw8hsrjEJLxYBmpvGxsaYMWNGPPnkk1FZWakh0EwlYZ9WUVHh+78AADlEAAwA8AGWLl266MADD8zqGnv16hUFBQXR2NhoYAB7WTqdjlmzZsWkSZNi06ZNGgLNWGFhYfTs2TMR+13TAgDIHQJgAIAPMHPmzEWnnnpqdm/qCgqiZ8+esWzZMgMD2EveDn4nT54cGzdu1BAg9tlnn8jPz0/CfnexaQEA5I48LQAAeH+//OUvV6bT6bpsr7NPnz6GBbAXZDKZePHFF+O73/1u3H///cJf4J+ScP1zOp2u++Uvf7nStAAAcocTwAAAH6C6ujpdXV29uE2bNodkc539+vWL6dOnGxjAHpLJZGL27NkxceLEWLNmjYYAO92fJWCvu7i6ujptWgAAuUMADADwIWzYsGFetgfA/fv3NyiAPeTVV1+NSZMmxapVqzQD2KlUKpWI/dmGDRvmmhYAQG4RAAMAfAiLFy9+o2/fvlldY1lZWXTu3DnWr19vYAC7yYIFC2L8+PGxZMkSzQDeV5cuXaK0tDQJ+9z5pgUAkFsEwAAAH8JTTz31+ujRo7O+zv33318ADLAbLFy4MMaPHx+LFy/WDOBD78uSYMqUKa+bFgBAbsnTAgCAD/aLX/xiTWNjY1W215mUF40ASbFs2bK4++674z/+4z+Ev8BHkoTv/zY0NFTee++9q00LACC3OAEMAPAhNDQ0ZDZv3jy/Q4cOI7O5TgEwwK6xYsWKePTRR2P+fDejArm7L9uyZYs/5AAAcpAAGADgQ1q3bl3WB8AdO3aMNm3axObNmw0M4GNYtWpVjB8/PubOnRuZTEZDgI+lbdu20aFDh0Tsb00LACD3CIABAD6kefPmzTvooIOyvs4DDzwwXnrpJQMD+AjWrVsX48ePj9mzZwt+gV2yH0uCuXPnzjMtAIDcIwAGAPiQ/vznP88/77zzsr7OAw44QAAM8CFVVFTEuHHjBL/ALt+PJcHDDz/sBDAAQA4SAAMAfEgTJ06srK2tXdGqVat9srnOgw8+2LAAPkBVVVVMnDgxnn/++WhqatIQYJdKwq0xNTU1yydNmlRlWgAAuUcADADwEWzYsOHvvXr1yuoAuG3bttG1a9dYu3atgQG8y+bNm+Pxxx+PF154IRobGzUE2OW6desWbdu2TcS+1rQAAHKTABgA4CNYuHDha7169Toj2+scMGCAABjgHbZs2RJTpkyJ5557LrZv364hwG6TlO//Lly48O+mBQCQmwTAAAAfwcSJE/9+wgknZH2dBx54YEyfPt3AgGavpqYmpkyZEs8880zU19drCLDbDRgwIBF1jh8//u+mBQCQmwTAAAAfwb333rv6Bz/4wfqioqLO2VznAQccEHl5eZFOpw0NaJZqa2tj8uTJ8eyzz0ZdXZ2GAHtEXl5e9O/fP+vrrK+vX3ffffeVmxgAQG4SAAMAfESVlZVzu3btmtXHgFu1ahX77LNPLFu2zMCAZqWuri6efvrpmDZtWmzbtk1DgD1qn332iVatWmV9nZs2bZpjWgAAuUsADADwES1dunR2tgfAERGDBg0SAAPNRkNDQ0ybNi2eeuqpqK6u1hBgr+2/kuCtt976m2kBAOQuATAAwEc0ffr0v48cOTLr6xw4cGBMmDDBwICc1tDQEM8991w8+eSTUVlZqSHAXt9/JcG0adP+bloAALlLAAwA8BH9x3/8x9JbbrmlOj8/v3U219mrV68oKyuLLVu2GBqQc9LpdMyaNSsmTZoUmzZt0hBgrysrK4tevXplfZ2NjY1b7rnnnmUmBgCQuwTAAAAfUW1tbXrDhg1/7dKly3HZXGcqlYqBAwfGrFmzDA3IGW8Hv5MnT46NGzdqCJA1Bg4cGKlUKuvr3Lhx4yu1tbVpEwMAyF0CYACAj+Gtt956JdsD4IgQAAM5I51Ox8svvxxTpkyJ8vJyDQGyct+VBIsWLXrFtAAAcpsAGADgYxg/fvwrRxxxRNbXedBBB0VBQUE0NjYaGpBImUwmZs+eHRMnTow1a9ZoCJCVCgoK4qCDDkpErY888ogAGAAgx+VpAQDAR/fjH/94ZX19/fpsr7OoqCj69etnYEAivfrqq3HHHXfEz3/+c+EvkNX69esXRUVFWV9nXV1d+b333rvaxAAAcpsTwAAAH9OGDRte6dGjx6ezvc5BgwbFggULDAxIjCVLlsSECRNi/vz5mgEkwuDBgxNR5/r1653+BQBoBgTAAAAf07x5815OQgA8bNiwePjhhyOTyRgakNXefPPNmDBhQixevFgzgMRIpVIxdOjQRNQ6d+7cl0wMACD3CYABAD6m++677+XRo0dnIiKVzXW2bds2evfuHcuWLTM0ICstW7YsHnvsMSd+gUTq06dPtG3bNgmlpu+9996/mhgAQO4TAAMAfEwTJ06s3Lp165LS0tK+2V7rkCFDBMBA1lmxYkU8+uijgl8g0YYMGZKIOqurqxc+/fTTm00MACD3CYABAD6B8vLyl/fff/+sD4AHDx4c48aNMzAgK6xcuTImTJgQc+fOdT09kHhJ+f7vmjVrfP8XAKCZEAADAHwCM2fOfG7//ff/fLbX2a1bt+jWrVuUl5cbGrDXrFu3LsaPHx+zZ88W/AI5oWfPntGlS5dE1DpjxoznTAwAoHkQAAMAfAK33Xbba5dcckl1fn5+62yvdciQIQJgYK9Yv359PPbYY4JfIOck5frnxsbGzbfddts8EwMAaB4EwAAAn0BlZWXThg0b/tqlS5fjsr3WQw89NCZNmmRowJ78MzKeeOKJeP7556OpqUlDgJxz6KGHJqLOioqKV6qrq9MmBgDQPAiAAQA+oXnz5s1MQgDcu3dv10ADe0RVVVVMnDgxXnjhhWhsbNQQICd17949evbsmZT9quufAQCakTwtAAD4ZP77v/97VkQk4kTFpz71KQMDdpstW7bEQw89FLfffns899xzwl8gpw0fPjwRdWYymfTdd9/9gokBADQfTgADAHxCkyZNqtqyZcuCsrKyg7K91uHDh8fjjz9uaMAuVVNTE1OmTIlnnnkm6uvrNQTIealUKg477LBE1Lply5bXp0+fvsXUAACaDwEwAMAusHz58lkDBw7M+gC4S5cu0atXr1i5cqWhAZ9YbW1tTJ48OZ599tmoq6vTEKDZ6N27d3Ts2DEx+1QTAwBoXgTAAAC7wLPPPvvCwIEDr0hCrcOGDRMAA59IXV1dPP300zFt2rTYtm2bhgDNzrBhwxJT61/+8pcXTQwAoHnxDWAAgF3g1ltvnV9fX782CbUefvjhkUqlDA34yBoaGmLq1Klx6623xuOPPy78BZqlJF3/XFdXt/rWW29dYGoAAM2LE8AAALtAQ0NDZs2aNc/16dPns9lea7t27aJPnz6xZMkSgwM+7J9xMW3atHjqqaeiurpaQ4Bmbb/99ou2bdsmotbVq1fPNDEAgOZHAAwAsIs8++yz05IQAEdEHHHEEQJg4AOl0+mYNWtWTJo0KTZt2qQhABFx5JFHJqbW6dOnTzMxAIDmxxXQAAC7yC233PJaQ0NDZRJqHT58eLRo0cLQgJ1Kp9Px3HPPxW233Rb333+/8Bdgh6KiovjUpz6ViFobGho23HLLLXNNDQCg+XECGABgF6murk6Xl5c/t88++5yR7bW2bNkyDj300Hj55ZcNDvindDodL7/8ckyZMiXKy8s1BOBdhgwZEkVFRYmodc2aNc/V1tamTQ0AoPkRAAMA7EIvvvjiM0kIgCMiRo4cKQAGIiIik8nE7NmzY+LEibFmzRoNAXif/VNSzJo161kTAwBongTAAAC70O233/7KOeecszU/P78022sdMGBAtG/f3tWu0My9+uqrMWnSpFi1apVmALyPjh07xgEHHJCIWhsbG6u/8Y1v/NXUAACaJwEwAMAutHLlyob169fP6tat2+hsrzWVSsXhhx8ekyZNMjhohubMmROTJ0+OJUuWaAbAh3D44YdHKpVKRK3r16+fVVFR0WhqAADNU54WAADsWq+++mpirts77LDDDAyamTfffDP+/d//PX7yk58IfwE+pFQqFSNGjEhMva+88sozpgYA0Hw5AQwAsIvddNNNz5166qnV+fn5rbO91m7dukX//v1j4cKFBgc5btmyZfHYY4/F/PnzNQPgIzrggAOic+fOiai1sbFxy4033jjL1AAAmi8BMADALrZy5cqG8vLyGT179vx0Euo9+uijBcCQw5YvXx7jxo0T/AJ8wv1SUpSXlz9TXl7eYGoAAM2XABgAYDeYMWPGUxdccEEiAuAhQ4ZE69ato7q62uAgh6xcuTImTJgQc+fOjUwmoyEAH1ObNm3i0EMPTUy9zz777FOmBgDQvPkGMADAbvDVr371lYaGhk1JqLWgoCCOOOIIQ4McsW7duvj5z38ed955Z8yZM0f4C/AJjRw5MvLz8xNRa0NDw8abbrrpVVMDAGjenAAGANgNKisrm1atWjW9T58+5ySh3qOPPjqefPJJQREk2Pr16+Oxxx6L2bNn+3cZYBdJpVIxatSoxNS7cuXKadXV1WmTAwBo3pwABgDYTaZNm5aY6/c6duwYAwYMMDRIoA0bNsSvf/3r+Nd//dd49dVXhb8Au9CAAQOiY8eOian36aefftLUAAAQAAMA7CZf+9rX5tTX11ckpd6jjjrK0CBBqqqq4v77749vf/vb8eKLL0ZTU5OmAOxiRx55ZGJqra+vX/eNb3zjdVMDAMAV0AAAu0ltbW16xYoVT++///6fT0K9hx56aLRt2zaqqqoMD7LYli1bYsqUKfHcc8/F9u3bNQRgN2nbtm0MGTIkMfUuX778qdraWtc/AwDgBDAAwO70xz/+cUJSas3Pz4/jjjvO0CBL1dTUxKOPPhq33XZb/OUvfxH+Auxmxx57bOTn5yel3Myvf/3rCaYGAECEABgAYLe66667llZXV89PSr1HH310tGjRwuAgi7wd/H7jG9+IqVOnRn19vaYA7GYtWrSIo48+OjH1btmy5Y177rlnhckBABDhCmgAgN3u9ddfn3T44YcPSEKtxcXFcdhhh8XMmTMNDvayurq6ePrpp2PatGmxbds2DQHYgw477LAoKSlJTL3z5s17wtQAAHibE8AAALvZ9773vanpdLohKfWecMIJkUqlDA72koaGhpg6dWrceuut8fjjjwt/AfawVCoVJ5xwQmLqTafT27/73e8+ZXIAALzNCWAAgN1s+vTpWyoqKmZ26dIlER/Y7d69e/Tv3z/efPNNw4M9qKGhIaZNmxZPPfVUVFdXawjAXnLAAQdE9+7dE1NvRUXFczNmzPAXBwAA/+QEMADAHjBr1qxEXcuXpFMvkHTpdDqee+65uP322+PRRx8V/gLsZccff3yi6p0xY8YkUwMA4J2cAAYA2AO++tWvvnT66adXFRYWtk1CvQMHDoyOHTvGhg0bDA92k3Q6HbNmzYrJkyfHxo0bNQQgC3Ts2DEGDhyYmHobGhoqb7755pdMDgCAd3ICGABgDygvL29YsWLF1MRsEvPy4sQTTzQ42A3S6XS8+OKL8Z3vfCfuv/9+4S9AFjnppJMiLy85r8tWrFgxpaKiotHkAAB4JwEwAMAe8qtf/erRiMgkpd6jjjoqysrKDA52kUwmE6+++mp873vfi1//+texdu1aTQHIImVlZXHUUUcl6q+W//7v//6zyQEA8G4CYACAPeQ///M/l1dWVv4tKfUWFhbGMcccY3CwC7wd/P785z+PNWvWaAhAFjruuOOioCA5X0urqqqa/dOf/nS1yQEA8G4CYACAPeill14al6R6jzvuuCgqKjI4+JjmzJkTd911V/z85z+P1au9owfIVkVFRYn7xbcXXnhhnMkBALAzBVoAALDnjB079pkFCxZUFhYWtktCvSUlJXHEEUfE9OnTDQ8+gjfffDPGjx8fb731lmYAJMCRRx4ZJSUliam3oaFh0zXXXPOsyQEAsDMCYACAPai8vLxh6dKlE/v3739xUmo+8cQT49lnn410Om2A8AEWLVoUjz32WCxevFgzABIiLy8vTjzxxETVvGTJkifKy8sbTA8AgJ3ucbUAAGDP+u1vfzsxIjJJqbdjx44xdOhQg4P3sXz58rj77rvjRz/6kfAXIGGGDRsWHTp0SFLJmd/85jePmxwAAO9FAAwAsIf953/+5/JNmza9kqSaTz/99EilUoYH77Jy5cr4yU9+Et///vdj/vz5GgKQMHl5eXHGGWckquZNmza9fM8996wwPQAA3osroAEA9oKXXnpp/KmnnnpYUurt2rVrDBkyJGbPnm14EBHr1q2L8ePHx+zZsyOTyWgIQEINHTo0OnfunKiaX3jhhQkmBwDA+xEAAwDsBZdffvkzS5YsWVdUVNQlKTWfccYZ8be//U3YRbO2fv36eOyxxwS/ADkglUrF6aefnqia6+rq1lx22WXTTQ8AgPcjAAYA2AsqKyub5s+f/8ihhx56dVJq7tatm1PANFsbNmyIxx9/PF555ZVoamrSEIAc8KlPfSq6du2aqJrfeOONcdXV1WnTAwDg/fgGMADAXvL1r399XDqdrktSzb4FTHNTVVUV999/f3z729+OF198UfgLkCNSqVR8+tOfTlTN6XS69pvf/OZjpgcAwAdxAhgAYC+ZMWNG9Zo1a/7Ss2fPxLx97N69ewwcODDmzJljgOS0LVu2xIQJE+KFF16IxsZGDQHIMYceemh069YtUTWvXr36qRkzZlSbHgAAH8QJYACAvejXv/71HyMiUR8SPeuss5wCJmdt27YtHn300bjtttviueeeE/4C5KC8vLwYM2ZM0srO/OpXv/qT6QEA8KH2vFoAALD3fP/733+rqqoqUR/V7dGjR3zqU58yPHJKfX19TJ06Nb71rW/F1KlTo76+XlMActSIESOiS5cuiap506ZNf73rrruWmh4AAB+GABgAYC975plnHkpazWeccUbk5dlKkjvmzZsXjz76aGzdulUzAHJYQUFBnH766Ymre9q0aQ+aHgAAH5a3dgAAe9nYsWNn1tfXr01SzZ07d47DDjvM8ACARBk5cmR06NAhUTXX1dWtHjt27POmBwDAhyUABgDYyyorK5tee+21Pyat7jPPPDMKCgoMEABIhBYtWiTy9O/s2bP/UF1dnTZBAAA+LAEwAEAWuOqqqyY0NjZWJanm9u3bx9FHH214AEAiHHfccdGmTZtE1dzQ0LDxiiuumGh6AAB8FAJgAIAssGDBgrqFCxc+lrS6R48eHYWFhQYIAGS1li1bxsknn5y4uhcuXDhu6dKl200QAICPQgAMAJAlvv71r/8pnU7XJqnmtm3bximnnGJ4AEBWO+2006K0tDRRNTc1NdV+7Wtfe8j0AAD4qATAAABZ4umnn968fPnyxF3xN3r06GjXrp0BAgBZqUOHDnH88ccnru5ly5ZNmD59+hYTBADgoxIAAwBkkbvvvvtPmUymKUk1FxYWxumnn254AEBWOvPMMxP3yYpMJtN41113/dH0AAD4OATAAABZ5Be/+MWatWvXTkta3UcccUT06tXLAAGArNK7d+847LDDEld3eXn5X+6///51JggAwMchAAYAyDIPP/zwn5JWcyqVijPPPNPwAICsMmbMmEilUomr+8EHH/yT6QEA8HEJgAEAsszXv/71NzZs2DAraXUPHDgwDj74YAMEALLCoEGDYsCAAYmru6KiYuatt966wAQBAPi4BMAAAFlo3Lhxv01i3WPGjIm8PFtMAGDvysvLizFjxiSy9j//+c+/NUEAAD7RflgLAACyz/XXXz+nqqrqr0mru1evXnHUUUcZIACwVx1zzDHRvXv3xNW9adOmV2666aa5JggAwCchAAYAyFJ/+tOf7k1i3WPGjInS0lIDBAD2ijZt2sRZZ52VyNofeOCBe00QAIBPSgAMAJClbrrpprlJPAVcXFwcZ555pgECAHvFWWedFS1btkxc3Zs2bXrl5ptvnmeCAAB8UgJgAIAsNm7cuF8lse5Ro0ZF7969DRAA2KP69OkTI0eOTGTtjz322K9MEACAXUEADACQxcaOHTu7qqrqb0mrO5VKxfnnnx+pVMoQAYA9tv/4/Oc/n8j9R2Vl5d+uueaav5kiAAC7ggAYACDLTZ069bdJrLtv374xZMgQAwQA9ojDDjsssTeQTJ48+TcmCADAriIABgDIcpdeeumLVVVVryax9s9//vNRXFxsiADAblVaWhrnn39+Imuvqqr66+WXX/6SKQIAsKsIgAEAEuChhx76WRLrLisri9NPP90AAYDd6qyzzoqSkpIklp753e9+91MTBABgVxIAAwAkwA033DB3w4YNs5JY+3HHHRd9+vQxRABgt+jbt28cddRRiay9oqJi1te//vU3TBEAgF1JAAwAkBA///nPfxoR6aTVnUql4vOf/3zk5dl6AgC7Vn5+flx00UWRSqWSWH76F7/4xX+bIgAAu5q3cAAACXHHHXe8tW7duulJrL13795xzDHHGCIAsEudcMIJ0b1790TWXl5e/pc77rjjLVMEAGBXEwADACTI3XfffW8mk2lKYu1nnXVWtG3b1hABgF2iQ4cOcfrppyey9kwm03T33Xf/3BQBANgdBMAAAAlyzz33rCgvL386ibW3bNkyzj33XEMEAHaJc889N1q0aJHI2tesWTP1xz/+8UpTBABgdxAAAwAkzA9/+MOfZzKZhiTWPnz48Bg0aJAhAgCfyKGHHhpDhw5NZO3pdLrhBz/4wS9MEQCA3UUADACQMPfee+/qRYsWPZDU+i+++OIoKSkxSADgY2ndunVcfPHFia1/4cKFf7jvvvvKTRIAgN1FAAwAkECXXXbZrxsaGjYlsfaysjJXQQMAH9u5554bpaWliay9oaFh4+WXX/47UwQAYHcSAAMAJNDs2bNrXn311V8ntf4jjjgiDj74YIMEAD6SwYMHx+GHH57Y+l955ZX7Zs+eXWOSAADsTgJgAICEOueccx6tqalZmtT6L7roomjZsqVBAgAfSsuWLeNzn/tcYuuvqalZMmbMmMdMEgCA3U0ADACQUJWVlU3Tpk37RVLrb9++fZx++ukGCQB8KGeccUa0b98+sfU/+eST91ZXV6dNEgCA3U0ADACQYOedd960qqqqV5Ja/wknnOAqaADgAx188MFx/PHHJ7b+TZs2vXzBBRc8a5IAAOwJAmAAgIT74x//eG9EZJJYeyqVigsuuMBV0ADAe2rZsmVccMEFkUqlkrqEzP333/8zkwQAYE8RAAMAJNzNN988b9WqVU8ktf6OHTsm+nt+AMDudcEFF0THjh0TW/+KFSse//rXv/6GSQIAsKcIgAEAcsCNN974k6ampq1JrX/kyJExdOhQgwQA/pdPfepTMWLEiMTW39TUVH3zzTf/t0kCALAnCYABAHLAxIkTK//+97//KslruPDCC6OsrMwwAYCIiGjTpk18/vOfT/QaZs+efd/EiRMrTRMAgD1JAAwAkCPOPvvsh2pqapYntf7S0tK46KKLDBIAiFQqFV/84hejtLQ0sWuoqal566yzznrYNAEA2NMEwAAAOaKioqJx0qRJP07yGgYPHhwjR440TABo5o444og46KCDEr2GJ5544qeVlZVNpgkAwJ4mAAYAyCGXXHLJzIqKihlJXsMFF1wQ3bp1M0wAaKZ69uyZ+KufKyoqZnzhC1+YZZoAAOwNAmAAgBzzb//2b/ek0+ntSa2/RYsWceWVV0ZhYaFhAkAzU1hYGF/60pcSvQ9Ip9Pb/+3f/u0e0wQAYG8RAAMA5Jh777139aJFix5M8hq6d+8eZ555pmECQDNzxhlnRPfu3RO9hsWLFz947733rjZNAAD2FgEwAEAO+uxnP/vL2traRL94PPHEE2Pw4MGGCQDNxKBBg+Kkk05K9Bpqa2tXn3vuub80TQAA9iYBMABADlq8eHH9uHHj/j3Ja0ilUnHJJZdE27ZtDRQAclybNm3ikksuiVQqleh1jBs37t8XL15cb6IAAOxNAmAAgBx1+eWXv1RRUTEjyWsoLS2NL3zhC4l/GQwAvLe3f+mrdevWiV5HRUXFM5dffvlLJgoAwN4mAAYAyGE33HDDXU1NTVuTvIaDDjrI94ABIId95jOfiUMOOSTRa2hqaqq+4YYbfmiaAABkAwEwAEAOGzdu3MbZs2cn/jt0p5xyiu8BA0AOOuSQQ+LTn/504tfx17/+9efjxo3baKIAAGQDATAAQI77zGc+81B1dfXCJK8hlUrFF7/4xejQoYOBAkCO6NixY3zpS19K/KceNm/ePO+00057xEQBAMgWAmAAgBxXXV2dfuCBB34UEekkr6O4uDguvfTSyMuzhQWApMvPz4/LLrssiouLk76U9P333/+ftbW1aVMFACBbeHsGANAMXH/99XMWLVr0YNLXsf/++8e5555roACQcOedd1707ds38etYuHDhH7/61a++bqIAAGQTATAAQDNxySWX/Lyurq486es4/vjjfQ8YABJs2LBhccwxxyR+HXV1dWsuvPDC+0wUAIBsIwAGAGgmXnvttdoHHnjguxGRSfI6UqlUfOlLX4oePXoYKgAkTO/evePSSy9N/Hd/IyLzwAMPfO/111+vNVUAALKNABgAoBm5+uqr/7Z06dJHk76OoqKiGDt2bJSWlhoqACRE69at46qrrorCwsLEr2X58uXjrr766r+ZKgAA2UgADADQzJx33nn/r66ubnXS19GhQ4e4/PLLIy/PlhYAsl1eXl5cfvnl0b59+8Svpb6+ft0ll1zyE1MFACBr999aAADQvLz++uu1Dz744Pcj4VdBR0QMGDAgzjrrLEMFgCw3ZsyYOPDAA3NiLY899tgPXnnllW2mCgBAthIAAwA0Q1/5ylf+umbNmqm5sJaTTz45Dj30UEMFgCw1ZMiQOOmkk3JiLWvXrv3LpZde+oKpAgCQzQTAAADN1GWXXfYf9fX1FUlfRyqViksvvTS6d+9uqACQZXr06BFf/OIXI5VKJX4tDQ0Nm6655pofmioAANlOAAwA0EzNmDGj+oEHHvhO5MBV0C1btozrr78+2rZta7AAkCXatWsX1113XbRs2TIXlpN56KGH/nXSpElVJgsAQLYTAAMANGNf+cpX/rpkyZI/58Ja2rZtG1dffXW0aNHCYAFgL2vRokVcffXVOfPLWUuXLn30iiuueNlkAQBIAgEwAEAzd+655/6ktrZ2eS6spXfv3jlzzSQAJNXbn2fYZ599cmI9tbW1y88555wfmywAAEkhAAYAaOYWLFhQ97Of/ezbmUymMRfWM2zYsDjllFMMFgD2kk9/+tMxdOjQnFhLJpNp/NnPfvbtBQsW1JksAABJIQAGACBuvfXWBfPnz78/V9Zz5plnxuDBgw0WAPaw4cOHx2c+85mcWc/8+fN/d+utty4wWQAAkkQADABARESMGTPmvpqamrdyYS2pVCouu+yy6Nmzp8ECwB7Su3fvuPjii3PmUwxbt25ddPrpp//aZAEASBoBMAAAERGxcuXKhh/+8Ie3pdPpnLjisGXLlvEv//Iv0aVLF8MFgN2sS5cucf3110dRUVFOrKepqanmu9/97jfKy8sbTBcAgKQRAAMA8E933XXX0ueff/6eXFlPaWlpXHvttVFWVma4ALCblJWVxXXXXRclJSU5s6aZM2fe/f/+3/9bZboAACSRABgAgP/l5JNPHldeXv50rqynU6dOMXbs2Jw5kQQA2aSoqCiuueaa6NixY86sqby8/MlTTz11gukCAJBUAmAAAP6PSy655K66urq1ubKefffdN6644orIy7P9BYBdJS8vL6688sro3bt3zqyprq6u/JJLLvmh6QIAkOi9uhYAAPBus2bNqn7ooYfujIh0rqxp4MCBcd555xkuAOwi559/fhxyyCG5tKT0gw8+eOesWbOqTRcAgCTLb3tQ9NzpjndbRG15oQ4BADRTEydOXDNmzJi8Tp06Dc2VNfXp0yfy8/PjzTffNGAA+ATOOuusOOmkk3JqTa+//vp9Z5555kTTBQAgCYq7N0Ze6c5/5gQwAADv6dRTT/31li1bXs+lNZ122mlx9NFHGy4AfEzHHntsnHrqqTm1pi1btrxx2mmn/cZ0AQDIBQJgAADeU0VFReONN974jcbGxqpcWtcFF1wQRx55pAEDwEd05JFHxuc+97mcWlNjY2PVzTff/I2KiopGEwYAIBcIgAEAeF9//OMf1z/yyCPfiRz6HnAqlYqLLroohgwZYsAA8CENHTo0LrrookilUrm0rPQjjzzynfvvv3+dCQMAkCsEwAAAfKBLL730hQULFvwupzbCeXnxpS99Kfbff38DBoAPcNBBB8WXvvSlyMvLrVdJCxYs+N2ll176ggkDAJBLBMAAAHwoo0eP/mVVVdXcXFpTYWFhfOUrX4kePXoYMAC8h169esUVV1wRBQUFObWuqqqqOaNHj/6lCQMAkGsEwAAAfCgVFRWNV1111S0NDQ0bcmldJSUlcfPNN8c+++xjyADwLr17946bbropiouLc2pdDQ0NG6666qqv++4vAAC5SAAMAMCHNmHChE3333//tzKZTDqX1lVcXBzXXXdddO/e3ZABYIfu3bvHtddeG61atcqpdWUymfT999//rQkTJmwyZQAAcpEAGACAj2Ts2LGz58+f/9tcW1fr1q3juuuuiw4dOhgyAM1ehw4d4rrrrovWrVvn3Nrmz5//m7Fjx842ZQAAcpUAGACAj+y44477xaZNm17MtXW1a9cubrzxxmjXrp0hA9BstW3bNmf/Pty4ceOLxx13nO/+AgCQ0wTAAAB8ZNXV1emLL774W3V1datzbW0dO3aMG2+8Mdq0aWPQADQ7ZWVlceONN0bHjh1zbm21tbWrL7zwwturq6vTJg0AQC7Lb3tQ9NzZD9LbImrLC3UIAICdWrZsWf327dtfOvbYY0/Ny8trkUtrKykpiaFDh8Zrr70WNTU1hg1As9ChQ4f42te+Fp06dcq5tTU1NW39zne+M/bBBx9cb9IAAOSC4u6NkVe6858JgAEA+NhefPHFzYcccsiyAQMGnBgRqZzaRBcXx5AhQ4TAADQLHTt2jJtuuik6dOiQi8tLjx8//ravfvWrc0waAIBc8X4BsCugAQD4RC688MIZb7zxxm9ycW3t27ePm266KSdPQgHA2zp16pTL4W+88cYbv77wwgufM2kAAJoLATAAAJ/YqFGjfrFhw4aZubi2t0Pgzp07GzQAOadz585x0003Rfv27XNyfRs2bJg5atSo+0waAIDmRAAMAMAnVltbm77sssu+V1dXtzoX19euXbu44YYbomPHjoYNQM7o0KFDXH/99dGuXbtc3Z+s/sIXvvDd2tratGkDANCc+AYwAAC7xJIlS+oj4pVRo0admpeX1yLX1ldcXBxDhw6NuXPnxrZt2wwcgETr0qVL3HjjjTl77XNTU1P1nXfeec0f/vCHdaYNAEAuer9vAAuAAQDYZWbNmlXVo0ePuYceeujoVCqVn2vra9WqVYwYMSIWLVoUlZWVBg5AIu23335x0003RVlZWU6uL51ON/z617++4fbbb3/TtAEAyFUCYAAA9phJkyatPeqoozbsu+++R+fi+goLC2P48OGxbNmy2LBhg4EDkCgDBgyIa6+9Nlq1apWza5w2bdq/XXLJJc+ZNgAAuez9AmDfAAYAYJc77bTTHn/rrbcezNX1FRUVxTXXXBNDhgwxbAASY8iQIXHNNddEUVFRzq5xwYIFvzv99NOfMG0AAJozATAAALvFEUcccc+GDRtm5ur6CgoK4sorr4wjjjjCsAFIwt/LceWVV0ZBQUHOrrG8vPypESNG/LdpAwDQ3AmAAQDYLaqrq9MXXXTRd2pra1fk7GY6Ly8uvvjiOPLIIw0cgKw1atSouPjiiyMvL3dfA23dunXxZz/72e83NDRkTBwAgObON4ABANhtli9fvr2mpuaFY4899uT8/PyWubjGVCoVgwYNikwmE4sWLTJ0ALLK6aefHueee26kUqmcXWN9fX3FDTfccM3UqVOrTBwAgObi/b4BLAAGAGC3evnll7cUFBS8cMQRR4zOy8trkYtrTKVSccABB0SnTp1i7ty5kck4fATA3lVYWBhXXHFFHHPMMTm9zsbGxuo777zzKz/72c9WmzoAAM2JABgAgL1qxowZlb169Xp98ODBJ6dSqfxcXWfPnj2jb9++8fe//z0aGxsNHoC9olWrVnH11VfHwIEDc3qd6XS64be//e2Nt9122wJTBwCguREAAwCw1z3xxBPlw4cPX9OvX79jIyJn76Hs2LFjDBw4MObMmRN1dXUGD8Ae1a5du7jxxhujT58+ub7U9JQpU779xS9+8XlTBwCgOXq/ADhPewAA2FPGjBkz9Y033vh1rq+zZ8+eceONN0bHjh0NHYA9pkuXLnHTTTdF9+7dc36tc+fO/eU555zzF1MHAID/SwAMAMAe9alPfernS5cufTjX19mlS5e49dZb48ADDzR0AHa7gQMHxje/+c3o1KlTzq/1rbfeemjEiBG/MnUAANg5ATAAAHvcsccee8/GjRtfyPV1FhcXx7XXXhsjRowwdAB2m8MPPzyuuuqqaNmyZc6vdePGjc8fffTR95g6AAC8NwEwAAB7XEVFReNxxx339crKyr/l+loLCgrisssui/PPPz9SqZThA7DLpFKpOP/88+PSSy+NgoKCnF/vpk2bXj7ssMNuqaysbDJ9AAB4bwJgAAD2isWLF9efddZZN1dXV7/ZHNZ7/PHHx5e//OUoKioyfAA+sRYtWsSXv/zlOP7445vFequrq98cM2bMN8rLyxtMHwAA3l9+24Oi585+kN4WUVteqEMAAOw2a9asaVi1atWs0aNHH1dQUNA619fbrVu3OOCAA2LevHlRX1/vAQDgYykrK4trrrkmDjrooGax3rq6uvKxY8de89RTT202fQAA+Ifi7o2RV7rznwmAAQDYq+bNm1ezevXqZ04++eTjCwoKSnN9ve3atYuRI0fG8uXLY+PGjR4AAD6S/v37x0033RRdu3ZtFuutr69fd9111335T3/6U4XpAwDA/xAAAwCQ1ebMmbMtlUq9fOSRR56Ul5eX83ckt2jRIkaMGBG1tbWxdOlSDwAAH8rxxx8fX/rSl5rN5wQaGxu33HXXXdf99Kc/XWn6AADwvwmAAQDIejNnzqzs2bPn64MHDz4plUrl5/p6U6lUHHLIIdGqVatYsGBBZDIZDwEAO5WXlxef/exn4/TTT49UKtUs1pxOp7f//ve//+o3vvGN1z0BAADwfwmAAQBIhEmTJpXvs88+8wYOHHhCKpUqaA5r3m+//WLAgAExd+5c3wUG4P8oKyuL6667LoYNG9Zs1pxOp7f/8Y9/vOmqq676qycAAAB2TgAMAEBiTJw4cc3BBx+85MADDzwulUrlNYc1t2/fPoYOHRqLFi2KLVu2eAgAiIiIffbZJ66//vro2bNns1lzJpNpnDBhwm1f/OIXn/cEAADAexMAAwCQKI8++ujy/fff/42DDjrohOZwHXRERHFxcRx11FHR2NgYb731locAoJkbPXp0XHHFFVFSUtJs1pxOpxsefvjhr15yySWzPAEAAPD+BMAAACTO+PHjVw0cOHDpAQcccGxzOQmcSqViwIAB0aVLl3jjjTeiqanJgwDQzBQVFcWll14aJ554YrP53m/EP07+Pv7447dffPHFMz0FAADwwQTAAAAk0iOPPLLs0EMPXbb//vs3mxA4IqJHjx4xZMiQePPNN2Pr1q0eBIBmonv37vEv//IvccABBzSrdWcymaYnnnji9s997nPPeAoAAODDEQADAJBYDz/88NJjjjlmY+/evY+KiGZzFKq0tDSGDx8eq1evjvXr13sQAHLcwIED45prrol27do1t6VnZsyY8YOzzjprqqcAAAA+PAEwAACJdv/99795zDHHVO6zzz5HRDMKgVu0aBGHHXZYtGzZMhYuXBjpdNrDAJBjCgoK4pxzzonzzz8/WrRo0dyWn37uuefuOuWUUyZ4EgAA4KMRAAMAkHi///3v5w8bNmxF3759j2lO10GnUqno27dvDB06NBYvXhxbtmzxMADkiJ49e8YNN9wQgwcPblbf+434x7XPU6ZM+fbpp58+2ZMAAAAfnQAYAICc8OCDDy4ZNmzYin79+jWrEDgionXr1nHEEUdEfX19LF261MMAkGCpVCpOOOGEuOKKK6JNmzbNbv07wt9vnXPOOX/xNAAAwMcjAAYAIGc89NBDS4YNG7a8X79+xza3EDg/Pz8OPvjg6NWrV8yfPz8aGho8EAAJU1JSEpdffnmccMIJkZ+f3+zWn8lkGp944olvffazn53maQAAgI9PAAwAQE556KGHlo4cOXJdnz59RqWa252ZEdG1a9cYNmxYLFu2LCorKz0QAAnRt2/fuO6662K//fZrluvPZDLpp59++rvnnHPO054GAAD4ZATAAADknD/96U+LDj300KX7779/s7sOOiKiuLg4jjzyyCgpKYk333wz0um0hwIgSxUUFMRnP/vZuPDCC6OkpKRZ9iCdTjc88sgjt5x//vnTPREAAPDJCYABAMhJDz/88NId3wQelUqlmt09mqlUKvr06RMHH3xwLFy4MLZt2+ahAMgynTt3jrFjx8bQoUOjGV5aERH/CH+feOKJ2y+88MLnPBEAALBrCIABAMhZDz300JIePXq8NmjQoGPz8vJaNMcetG3bNkaNGhVNTU2xZMkSDwVAFkilUjF69Oi48soro0OHDs22D01NTdt++9vf/stll132oqcCAAB2HQEwAAA5bdKkSeXdu3efM3jw4GYbAufn58eAAQOiV69esWDBgti+fbsHA2Avad26dVx66aVx/PHHR35+frPtQ2NjY/WvfvWrf7nuuute81QAAMCuJQAGACDnTZ48eW1jY+OMI4444uiCgoKS5tqHrl27xqhRo2Lbtm2xcuVKDwbAHpRKpWLUqFExduzY6NWrV7PuRX19/fo77rjjK9/61rcWejIAAGDXEwADANAsPP/881UbNmx45rjjjjuqsLCwrLn2obCwMAYNGhT77bdfLF68OGpraz0cALtZ+/bt44orrogTTzwxCgub9/uU2tralTfffPPVP/nJT1Z7MgAAYPcQAAMA0Gz87W9/27p27doZJ5xwwsjCwsK2zbkXnTp1ipEjR0Z1dbXTwAC70ciRI+Pqq6+OHj16NPte1NTULL/hhhuu/e1vf7vOkwEAALuPABgAgGbltdde2zpv3rynTznllKFFRUWdmnMvCgsL49BDD4399tsvFi1a5DQwwC709qnfk08+udmf+o2I2Lx587yLL774unHjxm30dAAAwO71fgFwat9zYsTOftC4LmLjq610DwCAxOrVq1fhs88++69du3Y9QTciGhoaYurUqTF58uRobGzUEICPqaCgIE499dQYPXq04HeH8vLyp4499tjvrly5skE3AABg9+swrDYKuuz8ZwJgAAByWuvWrfNeeumlm/fdd9+zdeMfVq9eHffff38sWbJEMwA+ov322y8uuugi1z2/w8KFC38/fPjwnzY0NGR0AwAA9gwBMAAAzd7zzz9/8aGHHnp1RKR0IyKTycTMmTPjz3/+c9TV1WkIwAcoKSmJ8847L0aMGBGplL9Kdki//PLL9xx77LEPagUAAOxZ7xcA+wYwAADNwn333Tfn+OOP39yrV6/DQwgcqVQqevfuHcOHD49169ZFRUWFhwTgPRxyyCExduzY6N+/v/B3h0wm0/jMM8/828knnzxONwAAYM97v28AC4ABAGg2fve7370xePDgJf369Ts6lUrl60hEcXFxjBgxInr06BFLly6N2tpaTQHYoUOHDvGFL3whzjzzzCguLtaQHZqammoeeOCBWz73uc9N1w0AANg7BMAAALDDww8/vKygoOC54cOHH1FQUFCqI//QrVu3OO6446K0tDQWL14cTU1NmgI0Wy1btoxzzjknLr300ujevbuGvENtbe2K22677arbbrvtDd0AAIC9RwAMAADv8Oyzz25avHjx0yeddNKQoqKiTjryD3l5edGnT58YOXJkbN26NVatWqUpQLNz+OGHx1e+8pUYMGBA5OXlacg7VFVV/e3CCy+8/oEHHvDdAAAA2MsEwAAA8C7z58+vefbZZ58+44wz+hcXF/fSkf/RsmXLGDJkSOyzzz6xdOnSqKmp0RQg53Xs2DG++MUvximnnBItW7bUkHdZt27dMyeffPI3Xn755W26AQAAe9/7BcCpfc+JETv7QeO6iI2vttI9AAByWmFhYer555//0sEHH3y5bvxfTU1N8fzzz8f48eOjurpaQ4Cc07p16zjzzDPjyCOPdOJ35zJ///vff3rMMcfc39DQkNEOAADIDh2G1UZBl53/TAAMAAARMWnSpM8cc8wxt6RSKdfg7ERNTU1MmTIlpk2bFg0NDRoCJF5hYWGccsopcdJJJ0VRUZGG7EQ6na6fOnXqd88555y/6AYAAGSX9wuAXQENAAAR8Yc//GHhfvvt98aAAQOOysvLkwS8S2FhYQwYMCCGDh0amzZtinXr1mkKkFiDBw+Oq666KoYOHRoFBQUashONjY1Vv//972/5whe+MEs3AAAg+/gGMAAAfAgTJkxYXV1dPf3II4/8VGFhYTsd+b9KS0vjsMMOi/79+8eaNWti8+bNmgIkRu/evePyyy+PU045JUpLSzXkPWzdunXxLbfccs33vve9hboBAADZyTeAAQDgI+jTp0+LJ5988us9evQ4TTfe3/z58+ORRx6JlStXagaQtXr16hXnnHNODBgwQDM+wKpVq5444YQTfrBy5Ur3/QMAQBbzDWAAAPgYnnnmmfOHDx9+fSqVytON95bJZGL27Nkxbty4qKio0BAga3Tu3DnOOuusGDp0aKRSKQ15/z/Lm2bNmvXDk08++THdAACA7OcbwAAA8DH85je/eX3//fd//cADDzzSd4HfWyqViu7du8cxxxwT7dq1i2XLlkV9fb3GAHtN27Zt49xzz42LL744evToIfz9AI2NjdUPPvjgLZ/97Gf/ohsAAJAMvgEMAAAf0/jx41dFxPOHHXbYiMLCwjIdeW95eXnRu3fvOOqoo6KgoCBWrlwZjY2NGgPsMcXFxXHKKafEl770pejbt2/k5bnA4YPU1tau+MEPfnD9LbfcMk83AAAgQf/94xvAAADwyQwePLjVo48++s1u3bqdpBsfTn19fTzzzDMxderU2LZtm4YAu01ZWVmceuqpceSRR0ZRkQsbPqyVK1c+/ulPf/pHixcvdm0DAAAkjG8AAwDALvLkk0+edeSRR96USqVcl/MhCYKB3eXtE7/HHnus4PcjyGQyDbNmzfoP3/sFAIDk8g1gAADYRX7/+98v6NGjx2uHHHLIyPz8fL8x+SEUFBREv3794qijjoq8vLxYtWqVq6GBT6Rly5ZxwgknxBVXXBEHHXRQFBQUaMqH1NDQsOG3v/3t1z7/+c8/oxsAAJBcroAGAIBd7Lzzzut4991339m2bdvBuvHR1NTUxLPPPhvTpk2LLVu2aAjwoZWVlcXxxx8fxxxzTBQXF2vIR1RVVfW3a6+99vZHHnlkg24AAECyuQIaAAB2g06dOhVMmzZtbN++fT8XESkd+WgaGhri+eefjyeffDI2bJBFAO/7522cdNJJccQRR0RhodvKPobMokWL/nTsscf+pLKyskk7AAAg+QTAAACwG/3hD38Ydfrpp99WUFDQRjc+unQ6Ha+++mpMnTo1Vq5cqSHAP/Xq1StOOeWUGDp0aOTl5WnIx9DY2Fg1YcKEOy666KKZugEAALlDAAwAALvZaaed1vbee+/9docOHUbqxse3fPnymDZtWrz88suRTqc1BJqhvLy8OOyww+L444+P3r17a8gnsHHjxue//OUvf3fSpElVugEAALlFAAwAAHtAYWFh6qmnnjpv+PDh16RSKXeUfgIbNmyIGTNmxHPPPRc1NTUaAs1AcXFxjBo1Ko4++ujo2LGjhnwCmUym4ZVXXvl/J5100kMNDQ0ZHQEAgNzzfgFwftuDoufOfpDeFlFb7p0VAAB8WOl0On7zm9+8Xlpa+uLgwYM/VVhYWKYrH09xcXEMGDAgjj322GjTpk2sXbs2amtrNQZyUIcOHeKMM86ISy+9NAYOHBjFxcWa8gnU1tau+slPfnLjxRdf/IybFAAAIHcVd2+MvNKd/8wJYAAA2A1OPPHENvfdd9+tnTp1Olo3PrnGxsb429/+Fs8++2wsWrRIQyAH9OvXL44++ugYNmxYFBQUaMguUFFR8cwXv/jFf5s+ffoW3QAAgNzmCmgAANhLHn744RNGjx799YKCgta6sWusX78+Zs6cGc8//3xUV1drCCRIaWlpHHnkkXHUUUdF586dNWQXaWxs3DJ16tS7PvvZz/5FNwAAoHkQAAMAwF50ySWXdP3+97//rXbt2g3VjV2nsbExXnvttXjuuedi/vz5GgJZbMCAATFq1KgYPHiw0767WFVV1atf//rXv/e73/1urW4AAEDzIQAGAIC9rF27dvlTp0699OCDD740lUrl68iutXz58nj++efj5ZdfjpqaGg2BLFBSUhLDhw+PI444Inr37q0hu1gmk2mcN2/efSeeeOJvq6urfewXAACaGQEwAABkia9//ev73Xjjjf9aWlraXzd2vXQ6HW+++WY899xz8dprr0VjY6OmwB5UUFAQgwcPjlGjRsUBBxwQeXl5mrIbVFdXL/zP//zPf/3BD36wRDcAAKB5EgADAEAWOfjgg1v9+c9/vrZ3795jIiKlI7tHZWVlvPjii/HCCy/EunXrNAR2o65du8bIkSPj8MMPj7Zt22rI7pNZunTpn88888z/t3jx4nrtAACA5ksADAAAWejuu+8eePHFF9/WqlUrd6PuZuXl5fHqq6/GSy+9FOvXr9cQ2AU6d+4cI0aMiGHDhkW3bt00ZDerqalZ9tvf/vbOm266aa5uAAAAAmAAAMhS/fr1K3r44Ycv79+//4WpVMpdqXvA8uXL46WXXoqXX345qqurNQQ+grKyshg+fHiMGDHCd333kEwmk164cOEfzj777F8sXbp0u44AAAARAmAAAMh6P/3pT4d97nOf+2bLli176Mae0dDQEHPnzo2//vWvMXfu3Ni+Xa4CO9OyZcsYNGhQDBs2LA455JAoKCjQlD2ktrZ21R//+Mc7rr322r/rBgAA8E4CYAAASIA+ffq0ePTRR69wGnjPS6fTsXTp0nj11VedDIaIaNu2bQwbNiyGDRsWffr0ibw8fyTtSZlMpuG11177+ZlnnvmnioqKRh0BAADeTQAMAAAJ8uMf//jQCy644JutWrXaRzf2vLdPBs+ePTvmzp0bdXV1mkKzUFZWFoMHD45hw4ZF//79Iz8/X1P2gpqammX333//nTfccINv/QIAAO9JAAwAAAnTrl27/HHjxp37qU996qq8vDwb870kk8nEihUrYu7cuTFnzpxYsWJFZDIZjSEnpFKp6Nu3bwwbNiwGDRoUHTt21JS9qKmpqfbVV1/92ZgxY/5cWVnZpCMAAMD7EQADAEBCffnLX+5x++23f7V9+/aH68bet2XLlnjjjTdizpw5MW/evKivr9cUEqVly5Zx8MEHx6BBg+KQQw6J0tJSTckCGzdufPG73/3uv//iF79YoxsAAMCHIQAGAIAEKywsTE2cOPGMkSNHXlNQUNBaR7JDXV1dvPnmm/HGG2/EG2+8EevXr9cUslKXLl3ioIMOioMOOigOOOCAKCoq0pQs0djYuGXmzJk/PvPMMyc2NDS4XgAAAPjQBMAAAJADjjzyyNY/+9nPrujbt++5EZGnI9mluro6Fi5cGPPnz4958+ZFZWWlprBXtGvXLg455JAYMGBA9O/fP1q39nsjWSj91ltv/fmqq676xaxZs6q1AwAA+KgEwAAAkEN++ctfjhgzZsyNrVq16q0b2SmdTsfKlStj0aJFsXDhwli8eHFs27ZNY9gtSkpKol+/ftG/f//Yf//9o1evXpGX53dEslVNTc3yRx999EdXXnnlK7oBAAB8XAJgAADIMd26dSt8+OGHPzd48ODL8vPzbdyzXCaTiTVr1sTChQtj0aJFsWjRotiyZYvG8LGUlZVF//79/xn6du/ePVKplMZkuaampprXXnvtV2PGjHmgoqKiUUcAAIBPQgAMAAA56rjjjiv7r//6r8tdC508mzdvjuXLl8eKFSti+fLlsXjx4qipqdEY/pfi4uLo169f9O7dO/bZZ5/Yd999o6ysTGMSJJPJpJcsWfLn66677pfTp0/3mx8AAMAuIQAGAIAc99Of/nTIueeee3NpaWlf3UimxsbGWLlyZSxdujSWLVsWy5cvj3Xr1kUmk9GcZiKVSkWXLl1in332iT59+kSfPn2iV69eUVBQoDkJtXXr1sUPPvjgj6699tq/6wYAALArCYABAKAZaNeuXf64cePOGTp06BUFBQWtdST56uvrY+XKlf88KbxixYpYu3ZtpNNpzUm4vLy86Nq1a+yzzz7//KdXr17RsmVLzckBjY2NW/7617/+4pxzznm0srKySUcAAIBdTQAMAADNyIknntjmnnvuuXzfffcdk0qlHB3MMdu3b481a9bEmjVrYu3atbF27dooLy+PDRs2CIazUF5eXnTs2DG6desWXbt2jW7dukW3bt2iR48eUVhYqEE5JpPJNC5ZsuRR1z0DAAC7mwAYAACaoa9+9av7Xnfdddd16NDhCN3IfY2Njf8MhNetWxfr1q2LioqKWLduXWzbtk2DdrPS0tLo3LnzP//p0qVLdO3aNbp27eoK52Ziw4YNM//rv/7rxz/60Y+W6wYAALC7CYABAKAZ++UvfznirLPOuq64uNj3gZupmpqaWL9+/T//qaioiMrKyqisrIxNmzZFY2OjJn2AgoKCaN++fbRr1y7at28fHTt2jC5dukSnTp2ic+fOUVxcrEnN1NatW98aP378PVdcccXLugEAAOwpAmAAAGjm2rVrl//ggw+eOWLEiCsLCwvb6gjvtHnz5n+GwZs2bYrKysqorq6OLVu2xJYtW6K6ujqqq6sjk8nk3NpTqVS0bt06WrduHWVlZdGmTZsoLS39X2Fvu3btok2bNh4U/peGhobKl1566efnnHPO+OrqavevAwAAe5QAGAAAiIiIoUOHFt97770XHHjggRfk5+c7ssiHlk6n/xkEV1dXR01Nzfv+k8lkora2NtLpdNTX10dTU1PU1dXt0u8U5+XlRcuWLSM/Pz+KiooiLy8vWrVqFalUKoqLi3f6T0lJSbRq1eqfgW9paWnk5eUZMB9aU1NTzYIFC/745S9/+Y+zZ8+u0REAAGBvEAADAAD/y2mnndb2rrvuurRPnz5n5+XlFeoIe9LbgfDbtm/f/r7XUBcUFESLFi3++b/fDnxhT8pkMg1LliwZd8stt/xq0qRJVToCAADsTQJgAABgp0477bS2d95554X777//5wTBAP9XJpNpWLhw4QO33nrrHwS/AABAtni/ADi/7UHRc2c/SG+LqC33/gcAAHLZokWL6u69995X0un0swcddFCnkpKS3roC8A8VFRUz/7//7/+77aKLLpq6aNGiOh0BAACyRXH3xsgr3fnPBMAAAEDMnDmz8u67736qqalpWr9+/Ypbt27dN5VKpXQGaG4ymUx6zZo1U+65555/Peeccx6cOXNmpa4AAADZRgAMAAB8KDNnzqz88Y9//Gw6nZ4uCAaak7eD37vvvvtfzz///McEvwAAQDYTAAMAAB+JIBhoLgS/AABAEgmAAQCAj+XtILisrOyFvn37diwuLu4VEYJgIBdkKioqnrv33nu/PWbMmEcEvwAAQJK8XwCc2vecGLGzHzSui9j4aivdAwAA/unqq6/u8ZWvfOX8Pn36nJWXl9dCR4CkSafT9UuXLh3/X//1Xw/84he/WKMjAABAEnUYVhsFXXb+MwEwAADwkZ1xxhntb7/99rMPPPDA8/Pz81vrCJDtmpqaqhcsWPDgd77znUcmTpzotC8AAJBoAmAAAGC3GD58eMkPf/jDzwwePPjioqKijjoCZJv6+voNr7322u9vvPHGx2fPnl2jIwAAQC4QAAMAALvV0KFDi++5556zDjnkkPOKioq66giwt9XV1a19/fXXH7z++uvHC34BAIBcIwAGAAD2iFatWuXdc889w0455ZTzO3bseJSOAHtYZsOGDbOmTJny4PXXX/9qbW1tWksAAIBcJAAGAAD2uH/913/tf/7555/dq1ev0/Ly8lroCLC7pNPp+pUrV05+4IEHHvnOd76zSEcAAIBcJwAGAAD2mjPOOKP97bfffvYBBxzw2YKCgjY6AuwqjY2NVW+++eafv/e97z06YcKETToCAAA0FwJgAABgrxs+fHjJ97///dGDBg0aU1paur+OAB9XdXX1wtdee+3Rr371q1Nfe+21Wh0BAACaGwEwAACQVb761a/ue8EFF3y6b9++ZxUUFLTWEeCDNDY2bnnrrbfG/+EPf5j4ox/9aLmOAAAAzZkAGAAAyEpDhw4t/sEPfnDy4MGDz27dunV/HQHerbq6+s2XX375weuuu+7ppUuXbtcRAAAAATAAAJDlCgsLU3ffffeQ0aNHn9G1a9fj8vLyinQFmq90Ol1XXl4+bcqUKROuvfbav+sIAADA/yYABgAAEqNPnz4t/v3f/33UyJEjz2rfvv2nIiKlK9AsZDZt2vTXF1544bGvfe1rzzntCwAA8N4EwAAAQCJddNFFXa6++uqTDzzwwLNbtmzZTUcg99TV1a1ZsGDBuJ/+9KdP3n///et0BAAA4IMJgAEAgETr1q1b4d13333k4YcffmqHDh2OyMvLK9QVSK50Ot2wcePGWbNmzZp8/fXXz6qoqGjUFQAAgA9PAAwAAOSMo48+uvWtt956/CGHHHJKu3btBkdEnq5AIqQrKytfmzdv3uQ777xz+owZM6q1BAAA4OMRAAMAADnpuOOOK/vGN75x/CGHHHJa27ZtB4bvBUO2yVRVVc2dN2/epO9///vTpk+fvkVLAAAAPjkBMAAAkPNuu+22vmedddZJffr0Oa5Vq1a9dQT2ntra2uXLly+f/uijjz51xx13vKUjAAAAu5YAGAAAaFa+9KUvdbv44ouP7t+//wlOBsMekamqqpq7cOHCv/z+97+fcd9995VrCQAAwO4jAAYAAJqtSy65pOtll112jDAYdrl0VVXVvIULF/7lV7/61bO/+93v1moJAADAniEABgAAiIirr766x/nnnz9q//33P7JNmzZDUqlUga7Ah5fJZBoqKyv/vnjx4uf+9Kc/zbr33ntX6woAAMCeJwAGAAB4l379+hV97WtfGzRy5MhRPXv2PLaoqKizrsD/VV9fv37VqlXPvPDCC8/9+7//+5zFixfX6woAAMDeJQAGAAB4H61bt8678847Bx599NFHde/efURpaen+4apomq/M1q1bF69Zs+bF5557btY3v/nNOdXV1WltAQAAyB4CYAAAgI9g8ODBrcaOHXvI8OHDD+vevfvw1q1bHxACYXJXprq6+s01a9a88sorr7z8k5/8ZN5rr71Wqy0AAADZSwAMAADwCVx//fX7nHHGGYf169dvePv27Yfm5+e31hWSrLGxsXrjxo2vvvXWWy+PHz/+lR//+McrdQUAACA5BMAAAAC70Je//OUe55xzzvA+ffoM7tix45CioqKuukI2q6+vX7t27doXFy9ePGfixImv3Xvvvat1BQAAILkEwAAAALvRl7/85R6f+cxnBvfr129Qly5dDm/ZsqVAmL2qrq5u7bp16wS+AAAAOUoADAAAsIe0atUq75prrtnn2GOPPXi//fY7uH379oeUlpb2TaVS+brDbpKuqalZtnHjxnlvvfXW3GeffXbef/3Xfy2vra1Naw0AAEBuEgADAADsRQceeGDLq6+++oAhQ4Yc3LNnz4Pbtm17sGuj+biampqqq6qqXi8vL583Z86ceb/85S/nvfjii1t1BgAAoPkQAAMAAGSZoUOHFn/xi1/cf9CgQQf26NHjwHbt2h3YqlWr3qlUKk932CFdU1OzvLKycsHq1asXzJkzZ8Gf//znJTNmzKjWGgAAgOZNAAwAAJAAxx13XNkFF1xw4MEHH3xA165dDywtLd23pKRkn1QqVag7uS2TyTRs27ZtRXV19dJ169YtfOONNxZOmDBh4YQJEzbpDgAAAO8mAAYAAEiw8847r+OJJ57Yp3///vt16dKlT5s2bfZr3bp1v/z8/GLdSZampqaa6urqxZs3b16ybt26pQsXLlzy9NNPL33ooYc26A4AAAAflgAYAAAgx7Rr1y7/kksu6TFkyJCe++67b89OnTr1Kisr61VcXNyzZcuW3VKpVL4u7R2ZTKaprq6uvKamZtWWLVtWVlRUrFy6dOnK2bNnr7r//vvXVFZWNukSAAAAn4QAGAAAoBnp1KlTwec+97luQ4cO7bnPPvv0aNeuXafWrVt3Li4u7tqyZcvORUVFnfLy8lro1MeTTqe319fXr6+rq6uoqalZW11dvb6ysnL9ihUrVr/66qurHnzwwbUVFRWNOgUAAMDuIgAGAADgfznjjDPaH3bYYZ369OnTuUuXLp3Kysral5SUtC0uLu5YVFTUrqioqG2LFi065OfnlzaXnjQ1NW3dvn37xvr6+qr6+vrKmpqaDdu2bavasmXLpnXr1lUsXbp0/Ysvvrh+4sSJlZ4gAAAA9iYBMAAAAB9Lr169CkeNGtXuoIMOatexY8ey9u3bl7Zp06Z1SUlJWXFxcetWrVq1btGiRVlRUVHrwsLC1hGRX1hYWBoR+QUFBSV5eXkFeXl5u/0/LtPpdG06nW5sbGzcFhFNDQ0NW3f83+r6+vrq7du3b6mtra2uqamp3rZtW/XmzZurN23aVL1hw4YtCxYsqJo1a1bl0qVLt5s4AAAASSAABgAAYK/q169fUffu3Vvss88+xSUlJQVv//8LCwtT3bp1+8BTxuXl5VsbGhoyb//vbdu2Na5YsaJmzZo12xcvXlyvwwAAADQn7xcAF2gPAAAAu9vixYvrdwS11boBAAAAu0+eFgAAAAAAAADkBgEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4o0AIAAAAAAACA5GhoLIyCxoaIiEilIpNXGE1v/0wADAAAAAAAAJAghQUN/0x6MxGppvT/5L6ugAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAIb/v5272ZHiusM4/FZ1NUkz9sQwOF4EyZJtpJCwysa5jSy4n1xPEqRIuQFvvfGSgIwBOzGRQAQERnx0d1UW0cgWGvKxsMGvnmfVdc7/1OJsf+oCAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoMY3JP//9K8My551lzpAk293a7QAAAAAAAAD8iIw3r+SL7TpPxuSt4/ibJJuz20QDBgAAAAAAAHhzrJPp6NvHYcyyjLl7dJTPbl/Jp6sPLufSsM+5ec7q5YOrF0OeP/SVaAAAAAAAAIA3weH7u6zfm79dWDIMSw6225w785vsx3XyzasOby5ssz69c4sAAAAAAAAAr9n69C6bC9sT93a7rKdnORin5Otxynzi1JQcfiwCAwAAAAAAALxO69O7HH68TaaT98cp85R8vbp3Nfszv8q0LHn7xMF1sjk/ZzUPmZ/MmWefhAYAAAAAAAD4oayPdjn7223Gn7x6ZrXPnetX8mBKkpv3cufDd/Pufn5FL56SzcVtNheT3dNt8tQlAwAAAAAAAHyv1sm0ySv/9XtsNWZ3I/lHkgzHi7/4XY7WYz5yiwAAAAAAAAA/Ivtcv/3nPEyS1fHa42t5+vNLyX7JoRsCAAAAAAAAePPt1/nbV3/KvePn1Xc371/NYxEYAAAAAAAA4M0yTHk2rvNo2WdzvHZqzN9v/SF3vju3evng/at5fPDLPDu1yuGyZHSVAAAAAAAAAK/XOGe4ueSvZ4e8M8xZbVe5ceuPufvy3Oqkw4+v5emDX+fuuTlLhhwsEYIBAAAAAAAAXpclGR8OuXP0TR4cPM/9z/+SRyfNDf/1TZezOp/87KdjzizJZkhO7edMy/w/nAUAAAAAAADg/zaMWcZkP8/ZLsmLacr2/MV8+cnvs/tP5/4FmLjAq1ifcioAAAAASUVORK5CYII=";function H0($,q,Q){if(typeof $==="string"&&!isNaN(Number($)))$=Number($);if(typeof $==="number"&&$<100)return v0($);if(typeof $==="number"&&$>=100)return $;if(typeof $==="string"&&$.includes("%")){if(q&&q==="X")return Math.round(parseFloat($)/100*Q.width);if(q&&q==="Y")return Math.round(parseFloat($)/100*Q.height);return Math.round(parseFloat($)/100*Q.width)}return 0}function k5($){return $.replace(/[xy]/g,function(q){let Q=Math.random()*16|0;return(q==="x"?Q:Q&3|8).toString(16)})}function k0($){if(typeof $>"u"||$==null)return"";return $.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function v0($){if(typeof $==="number"&&$>100)return $;if(typeof $==="string")$=Number($.replace(/in*/gi,""));return Math.round(L0*$)}function Y0($){let q=Number($)||0;return isNaN(q)?0:Math.round(q*w8)}function S1($){return $=$||0,Math.round(($>360?$-360:$)*60000)}function g7($){let q=$.toString(16);return q.length===1?"0"+q:q}function A7($,q,Q){return(g7($)+g7(q)+g7(Q)).toUpperCase()}function R0($,q){let Q=($||"").replace("#","");if(!j7.test(Q)&&Q!==G2.background1&&Q!==G2.background2&&Q!==G2.text1&&Q!==G2.text2&&Q!==G2.accent1&&Q!==G2.accent2&&Q!==G2.accent3&&Q!==G2.accent4&&Q!==G2.accent5&&Q!==G2.accent6)console.warn(`"${Q}" is not a valid scheme color or hex RGB! "${Q2}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`),Q=Q2;let K=j7.test(Q)?"srgbClr":"schemeClr",J='val="'+(j7.test(Q)?Q.toUpperCase():Q)+'"';return q?`${q}`:``}function AB($,q){let Q="",K=Object.assign(Object.assign({},q),$),J=Math.round(K.size*w8),Z=K.color,G=Math.round(K.opacity*1e5);return Q+=``,Q+=R0(Z,``),Q+="",Q}function B2($){let q="solid",Q="",K="",J="";if($){if(typeof $==="string")Q=$;else{if($.type)q=$.type;if($.color)Q=$.color;if($.alpha)K+=``;if($.transparency)K+=``}switch(q){case"solid":J+=`${R0(Q,K)}`;break;default:J+="";break}}return J}function a2($){return $._rels.length+$._relsChart.length+$._relsMedia.length+1}function b7($){if(!$||typeof $!=="object")return;if($.type!=="outer"&&$.type!=="inner"&&$.type!=="none")console.warn("Warning: shadow.type options are `outer`, `inner` or `none`."),$.type="outer";if($.angle){if(isNaN(Number($.angle))||$.angle<0||$.angle>359)console.warn("Warning: shadow.angle can only be 0-359"),$.angle=270;$.angle=Math.round(Number($.angle))}if($.opacity){if(isNaN(Number($.opacity))||$.opacity<0||$.opacity>1)console.warn("Warning: shadow.opacity can only be 0-1"),$.opacity=0.75;$.opacity=Number($.opacity)}if($.color){if($.color.startsWith("#"))console.warn('Warning: shadow.color should not include hash (#) character, , e.g. "FF0000"'),$.color=$.color.replace("#","")}return $}function XB($,q,Q){var K,J;let Z=2.3+(((K=$.options)===null||K===void 0?void 0:K.autoPageCharWeight)?$.options.autoPageCharWeight:0),G=Math.floor(q/w8*L0)/((((J=$.options)===null||J===void 0?void 0:J.fontSize)?$.options.fontSize:k2)/Z),W=[],B=[],V=[],U=[];if($.text&&$.text.toString().trim().length===0)B.push({_type:D0.tablecell,text:" "});else if(typeof $.text==="number"||typeof $.text==="string")B.push({_type:D0.tablecell,text:($.text||"").toString().trim()});else if(Array.isArray($.text))B=$.text;let w=[];return B.forEach((F)=>{var M;if(typeof F.text==="string"){if(F.text.split(` `).length>1)F.text.split(` -`).forEach((k)=>{w.push({_type:D0.tablecell,text:k,options:Object.assign(Object.assign({},F.options),{breakLine:!0})})});else w.push({_type:D0.tablecell,text:F.text.trim(),options:F.options});if((M=F.options)===null||M===void 0?void 0:M.breakLine)V.push(w),w=[]}if(w.length>0)V.push(w),w=[]}),V.forEach((F)=>{F.forEach((M)=>{let k=[],L=String(M.text).split(" ");L.forEach((D,z)=>{let N=Object.assign({},M.options);if(N===null||N===void 0?void 0:N.breakLine)N.breakLine=z+1===L.length;k.push({_type:D0.tablecell,text:D+(z+1{let M=[],k="";if(F.forEach((f)=>{if(k.length+f.text.length>G)W.push(M),M=[],k="";M.push(f),k+=f.text.toString()}),M.length>0)W.push(M)}),W}function GJ($=[],q={},Q,K){let J=M8,Z=L0*1,G=L0*1,W=0,B=0,V=[],U=H0(q.x,"X",Q),w=H0(q.y,"Y",Q),F=H0(q.w,"X",Q),M=H0(q.h,"Y",Q),k=F;function f(){let D=0;if(V.length===0)D=w||v0(J[0]);if(V.length>0)D=v0(q.autoPageSlideStartY||q.newSlideStartY||J[0]);if(G=(M||Q.height)-D-v0(J[2]),V.length>1){if(typeof q.autoPageSlideStartY==="number")G=(M||Q.height)-v0(q.autoPageSlideStartY+J[2]);else if(typeof q.newSlideStartY==="number")G=(M||Q.height)-v0(q.newSlideStartY+J[2]);else if(w){if(G=(M||Q.height)-v0((w/L0{if(!z)z={_type:D0.tablecell};let N=z.options||null;B+=Number((N===null||N===void 0?void 0:N.colspan)?N.colspan:1)}),q.verbose)console.log(`| numCols ......................................... = ${B}`);if(!F&&q.colW){if(k=Array.isArray(q.colW)?q.colW.reduce((D,z)=>D+z)*L0:q.colW*B||0,q.verbose)console.log(`| tableCalcW ...................................... = ${k/L0}`)}if(Z=k||v0((U?U/L0:J[1])+J[3]),q.verbose)console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);if(!q.colW||!Array.isArray(q.colW))if(q.colW&&!isNaN(Number(q.colW))){let D=[];($[0]||[]).forEach(()=>D.push(q.colW)),q.colW=[],D.forEach((N)=>{if(Array.isArray(q.colW))q.colW.push(N)})}else{q.colW=[];for(let D=0;D{let N=[],H=0,v=0,j=[];if(D.forEach((X)=>{var P,g,c,h;if(j.push({_type:D0.tablecell,text:[],options:X.options}),X.options.margin&&X.options.margin[0]>=1){if(((P=X.options)===null||P===void 0?void 0:P.margin)&&X.options.margin[0]&&Y0(X.options.margin[0])>H)H=Y0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&Y0(q.margin[0])>H)H=Y0(q.margin[0]);if(((g=X.options)===null||g===void 0?void 0:g.margin)&&X.options.margin[2]&&Y0(X.options.margin[2])>v)v=Y0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&Y0(q.margin[2])>v)v=Y0(q.margin[2])}else{if(((c=X.options)===null||c===void 0?void 0:c.margin)&&X.options.margin[0]&&v0(X.options.margin[0])>H)H=v0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&v0(q.margin[0])>H)H=v0(q.margin[0]);if(((h=X.options)===null||h===void 0?void 0:h.margin)&&X.options.margin[2]&&v0(X.options.margin[2])>v)v=v0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&v0(q.margin[2])>v)v=v0(q.margin[2])}}),f(),W+=H+v,q.verbose&&z===0)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(D.forEach((X,P)=>{var g;let c={_type:D0.tablecell,_lines:null,_lineHeight:v0((((g=X.options)===null||g===void 0?void 0:g.fontSize)?X.options.fontSize:q.fontSize?q.fontSize:k2)*(YB+(q.autoPageLineWeight?q.autoPageLineWeight:0))/100),text:[],options:X.options};if(c.options.rowspan)c._lineHeight=0;c.options.autoPageCharWeight=q.autoPageCharWeight?q.autoPageCharWeight:null;let h=q.colW[P];if(X.options.colspan&&Array.isArray(q.colW))h=q.colW.filter((x,l)=>l>=P&&lx+l);c._lines=RB(X,h),N.push(c)}),q.verbose)console.log(` +`).forEach((k)=>{w.push({_type:D0.tablecell,text:k,options:Object.assign(Object.assign({},F.options),{breakLine:!0})})});else w.push({_type:D0.tablecell,text:F.text.trim(),options:F.options});if((M=F.options)===null||M===void 0?void 0:M.breakLine)V.push(w),w=[]}if(w.length>0)V.push(w),w=[]}),V.forEach((F)=>{F.forEach((M)=>{let k=[],L=String(M.text).split(" ");L.forEach((D,z)=>{let N=Object.assign({},M.options);if(N===null||N===void 0?void 0:N.breakLine)N.breakLine=z+1===L.length;k.push({_type:D0.tablecell,text:D+(z+1{let M=[],k="";if(F.forEach((f)=>{if(k.length+f.text.length>G)W.push(M),M=[],k="";M.push(f),k+=f.text.toString()}),M.length>0)W.push(M)}),W}function GJ($=[],q={},Q,K){let J=M8,Z=L0*1,G=L0*1,W=0,B=0,V=[],U=H0(q.x,"X",Q),w=H0(q.y,"Y",Q),F=H0(q.w,"X",Q),M=H0(q.h,"Y",Q),k=F;function f(){let D=0;if(V.length===0)D=w||v0(J[0]);if(V.length>0)D=v0(q.autoPageSlideStartY||q.newSlideStartY||J[0]);if(G=(M||Q.height)-D-v0(J[2]),V.length>1){if(typeof q.autoPageSlideStartY==="number")G=(M||Q.height)-v0(q.autoPageSlideStartY+J[2]);else if(typeof q.newSlideStartY==="number")G=(M||Q.height)-v0(q.newSlideStartY+J[2]);else if(w){if(G=(M||Q.height)-v0((w/L0{if(!z)z={_type:D0.tablecell};let N=z.options||null;B+=Number((N===null||N===void 0?void 0:N.colspan)?N.colspan:1)}),q.verbose)console.log(`| numCols ......................................... = ${B}`);if(!F&&q.colW){if(k=Array.isArray(q.colW)?q.colW.reduce((D,z)=>D+z)*L0:q.colW*B||0,q.verbose)console.log(`| tableCalcW ...................................... = ${k/L0}`)}if(Z=k||v0((U?U/L0:J[1])+J[3]),q.verbose)console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);if(!q.colW||!Array.isArray(q.colW))if(q.colW&&!isNaN(Number(q.colW))){let D=[];($[0]||[]).forEach(()=>D.push(q.colW)),q.colW=[],D.forEach((N)=>{if(Array.isArray(q.colW))q.colW.push(N)})}else{q.colW=[];for(let D=0;D{let N=[],H=0,v=0,j=[];if(D.forEach((X)=>{var P,g,c,h;if(j.push({_type:D0.tablecell,text:[],options:X.options}),X.options.margin&&X.options.margin[0]>=1){if(((P=X.options)===null||P===void 0?void 0:P.margin)&&X.options.margin[0]&&Y0(X.options.margin[0])>H)H=Y0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&Y0(q.margin[0])>H)H=Y0(q.margin[0]);if(((g=X.options)===null||g===void 0?void 0:g.margin)&&X.options.margin[2]&&Y0(X.options.margin[2])>v)v=Y0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&Y0(q.margin[2])>v)v=Y0(q.margin[2])}else{if(((c=X.options)===null||c===void 0?void 0:c.margin)&&X.options.margin[0]&&v0(X.options.margin[0])>H)H=v0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&v0(q.margin[0])>H)H=v0(q.margin[0]);if(((h=X.options)===null||h===void 0?void 0:h.margin)&&X.options.margin[2]&&v0(X.options.margin[2])>v)v=v0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&v0(q.margin[2])>v)v=v0(q.margin[2])}}),f(),W+=H+v,q.verbose&&z===0)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(D.forEach((X,P)=>{var g;let c={_type:D0.tablecell,_lines:null,_lineHeight:v0((((g=X.options)===null||g===void 0?void 0:g.fontSize)?X.options.fontSize:q.fontSize?q.fontSize:k2)*(fB+(q.autoPageLineWeight?q.autoPageLineWeight:0))/100),text:[],options:X.options};if(c.options.rowspan)c._lineHeight=0;c.options.autoPageCharWeight=q.autoPageCharWeight?q.autoPageCharWeight:null;let h=q.colW[P];if(X.options.colspan&&Array.isArray(q.colW))h=q.colW.filter((x,l)=>l>=P&&lx+l);c._lines=XB(X,h),N.push(c)}),q.verbose)console.log(` | SLIDE [${V.length}]: ROW [${z}]: START...`);let n=0,d=0,_=!1;while(!_){let X=N[n],P=j[n];if(N.forEach((h)=>{if(h._lineHeight>=d)d=h._lineHeight}),W+d>G){if(q.verbose)console.log(` |-----------------------------------------------------------------------|`),console.log(`|-- NEW SLIDE CREATED (currTabH+currLineH > maxH) => ${(W/L0).toFixed(2)} + ${(X._lineHeight/L0).toFixed(2)} > ${G/L0}`),console.log(`|-----------------------------------------------------------------------| `);if(j.length>0&&j.map((x)=>x.text.length).reduce((x,l)=>x+l)>0)L.rows.push(j);if(V.push(L),L={rows:[]},j=[],D.forEach((x)=>j.push({_type:D0.tablecell,text:[],options:x.options})),f(),W+=H+v,q.verbose)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(W=0,(q.addHeaderToEach||q.autoPageRepeatHeader)&&q._arrObjTabHeadRows)q._arrObjTabHeadRows.forEach((x)=>{let l=[],$0=0;x.forEach((Z0)=>{if(l.push(Z0),Z0._lineHeight>$0)$0=Z0._lineHeight}),L.rows.push(l),W+=$0});P=j[n]}let g=X._lines.shift();if(Array.isArray(P.text)){if(g)P.text=P.text.concat(g);else if(P.text.length===0)P.text=P.text.concat({_type:D0.tablecell,text:""})}if(n===N.length-1)W+=d;if(n=nh._lines.length).reduce((h,x)=>h+x)===0)_=!0}if(j.length>0)L.rows.push(j);if(q.verbose)console.log(`- SLIDE [${V.length}]: ROW [${z}]: ...COMPLETE ...... emuTabCurrH = ${(W/L0).toFixed(2)} ( emuSlideTabH = ${(G/L0).toFixed(2)} )`)}),V.push(L),q.verbose)console.log(` |================================================|`),console.log(`| FINAL: tableRowSlides.length = ${V.length}`),V.forEach((D)=>console.log(D)),console.log(`|================================================| -`);return V}function IB($,q,Q={},K){let J=Q||{};J.slideMargin=J.slideMargin||J.slideMargin===0?J.slideMargin:0.5;let Z=J.w||$.presLayout.width,G=[],W=[],B=[],V=[],U=[],w=[0.5,0.5,0.5,0.5],F=0;if(!document.getElementById(q))throw Error('tableToSlides: Table ID "'+q+'" does not exist!');if(K===null||K===void 0?void 0:K._margin){if(Array.isArray(K._margin))w=K._margin;else if(!isNaN(K._margin))w=[K._margin,K._margin,K._margin,K._margin];J.slideMargin=w}else if(J===null||J===void 0?void 0:J.slideMargin){if(Array.isArray(J.slideMargin))w=J.slideMargin;else if(!isNaN(J.slideMargin))w=[J.slideMargin,J.slideMargin,J.slideMargin,J.slideMargin]}if(Z=(J.w?v0(J.w):$.presLayout.width)-v0(w[1]+w[3]),J.verbose)console.log("[[VERBOSE MODE]]"),console.log("|-- `tableToSlides` ----------------------------------------------------|"),console.log(`| tableProps.h .................................... = ${J.h}`),console.log(`| tableProps.w .................................... = ${J.w}`),console.log(`| pptx.presLayout.width ........................... = ${($.presLayout.width/L0).toFixed(1)}`),console.log(`| pptx.presLayout.height .......................... = ${($.presLayout.height/L0).toFixed(1)}`),console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);let M=document.querySelectorAll(`#${q} tr:first-child th`);if(M.length===0)M=document.querySelectorAll(`#${q} tr:first-child td`);if(M.forEach((f)=>{let L=f;if(L.getAttribute("colspan"))for(let D=0;D{F+=f}),U.forEach((f,L)=>{let D=Number((Number(Z)*(f/F*100)/100/L0).toFixed(2)),z=0,N=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(N)z=Number(N.getAttribute("data-pptx-min-width"));let H=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(H)z=Number(H.getAttribute("data-pptx-width"));V.push(z>D?z:D)}),J.verbose)console.log(`| arrColW ......................................... = [${V.join(", ")}]`);["thead","tbody","tfoot"].forEach((f)=>{document.querySelectorAll(`#${q} ${f} tr`).forEach((L)=>{let D=L,z=[];switch(Array.from(D.cells).forEach((N)=>{let H=window.getComputedStyle(N).getPropertyValue("color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(","),v=window.getComputedStyle(N).getPropertyValue("background-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");if(window.getComputedStyle(N).getPropertyValue("background-color")==="rgba(0, 0, 0, 0)"||window.getComputedStyle(N).getPropertyValue("transparent"))v=["255","255","255"];let j={align:null,bold:window.getComputedStyle(N).getPropertyValue("font-weight")==="bold"||Number(window.getComputedStyle(N).getPropertyValue("font-weight"))>=500,border:null,color:A7(Number(H[0]),Number(H[1]),Number(H[2])),fill:{color:A7(Number(v[0]),Number(v[1]),Number(v[2]))},fontFace:(window.getComputedStyle(N).getPropertyValue("font-family")||"").split(",")[0].replace(/"/g,"").replace("inherit","").replace("initial","")||null,fontSize:Number(window.getComputedStyle(N).getPropertyValue("font-size").replace(/[a-z]/gi,"")),margin:null,colspan:Number(N.getAttribute("colspan"))||null,rowspan:Number(N.getAttribute("rowspan"))||null,valign:null};if(["left","center","right","start","end"].includes(window.getComputedStyle(N).getPropertyValue("text-align"))){let n=window.getComputedStyle(N).getPropertyValue("text-align").replace("start","left").replace("end","right");j.align=n==="center"?"center":n==="left"?"left":n==="right"?"right":null}if(["top","middle","bottom"].includes(window.getComputedStyle(N).getPropertyValue("vertical-align"))){let n=window.getComputedStyle(N).getPropertyValue("vertical-align");j.valign=n==="top"?"top":n==="middle"?"middle":n==="bottom"?"bottom":null}if(window.getComputedStyle(N).getPropertyValue("padding-left"))j.margin=[0,0,0,0],["padding-top","padding-right","padding-bottom","padding-left"].forEach((d,_)=>{j.margin[_]=Math.round(Number(window.getComputedStyle(N).getPropertyValue(d).replace(/\D/gi,"")))});if(window.getComputedStyle(N).getPropertyValue("border-top-width")||window.getComputedStyle(N).getPropertyValue("border-right-width")||window.getComputedStyle(N).getPropertyValue("border-bottom-width")||window.getComputedStyle(N).getPropertyValue("border-left-width"))j.border=[null,null,null,null],["top","right","bottom","left"].forEach((d,_)=>{let X=Math.round(Number(window.getComputedStyle(N).getPropertyValue("border-"+d+"-width").replace("px",""))),P=[];P=window.getComputedStyle(N).getPropertyValue("border-"+d+"-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");let g=A7(Number(P[0]),Number(P[1]),Number(P[2]));j.border[_]={pt:X,color:g}});z.push({_type:D0.tablecell,text:N.innerText,options:j})}),f){case"thead":G.push(z);break;case"tbody":W.push(z);break;case"tfoot":B.push(z);break;default:console.log(`table parsing: unexpected table part: ${f}`);break}})}),J._arrObjTabHeadRows=G||null,J.colW=V,GJ([...G,...W,...B],J,$.presLayout,K).forEach((f,L)=>{let D=$.addSlide({masterName:J.masterSlideName||null});if(L===0)J.y=J.y||w[0];if(L>0)J.y=J.autoPageSlideStartY||J.newSlideStartY||w[0];if(J.verbose)console.log(`| opts.autoPageSlideStartY: ${J.autoPageSlideStartY} / arrInchMargins[0]: ${w[0]} => opts.y = ${J.y}`);if(D.addTable(f.rows,{x:J.x||w[3],y:J.y,w:Number(Z)/L0,colW:V,autoPage:!1}),J.addImage)if(J.addImage.options=J.addImage.options||{},!J.addImage.image||!J.addImage.image.path&&!J.addImage.image.data)console.warn("Warning: tableToSlides.addImage requires either `path` or `data`");else D.addImage({path:J.addImage.image.path,data:J.addImage.image.data,x:J.addImage.options.x,y:J.addImage.options.y,w:J.addImage.options.w,h:J.addImage.options.h});if(J.addShape)D.addShape(J.addShape.shapeName,J.addShape.options||{});if(J.addTable)D.addTable(J.addTable.rows,J.addTable.options||{});if(J.addText)D.addText(J.addText.text,J.addText.options||{})})}var CB=0;function jB($,q){if($.bkgd)q.bkgd=$.bkgd;if($.objects&&Array.isArray($.objects)&&$.objects.length>0)$.objects.forEach((Q,K)=>{let J=Object.keys(Q)[0],Z=q;if(W1[J]&&J==="chart")WJ(Z,Q[J].type,Q[J].data,Q[J].opts);else if(W1[J]&&J==="image")BJ(Z,Q[J]);else if(W1[J]&&J==="line")_7(Z,B1.LINE,Q[J]);else if(W1[J]&&J==="rect")_7(Z,B1.RECTANGLE,Q[J]);else if(W1[J]&&J==="text")H5(Z,[{text:Q[J].text}],Q[J].options,!1);else if(W1[J]&&J==="placeholder")Q[J].options.placeholder=Q[J].options.name,delete Q[J].options.name,Q[J].options._placeholderType=Q[J].options.type,delete Q[J].options.type,Q[J].options._placeholderIdx=100+K,H5(Z,[{text:Q[J].text}],Q[J].options,!0)});if($.slideNumber&&typeof $.slideNumber==="object")q._slideNumberProps=$.slideNumber}function WJ($,q,Q,K){var J;function Z(w){if(!w||w.style==="none")return;if(w.size!==void 0&&(isNaN(Number(w.size))||w.size<=0))console.warn("Warning: chart.gridLine.size must be greater than 0."),delete w.size;if(w.style&&!["solid","dash","dot"].includes(w.style))console.warn("Warning: chart.gridLine.style options: `solid`, `dash`, `dot`."),delete w.style;if(w.cap&&!["flat","square","round"].includes(w.cap))console.warn("Warning: chart.gridLine.cap options: `flat`, `square`, `round`."),delete w.cap}let G=++CB,W={_type:null,text:null,options:null,chartRid:null},B=null,V=[];if(Array.isArray(q))q.forEach((w)=>{V=V.concat(w.data)}),B=Q||K;else V=Q,B=K;V.forEach((w,F)=>{if(w._dataIndex=F,w.labels!==void 0&&!Array.isArray(w.labels[0]))w.labels=[w.labels]});let U=B&&typeof B==="object"?B:{};if(U._type=q,U.x=typeof U.x<"u"&&U.x!=null&&!isNaN(Number(U.x))?U.x:1,U.y=typeof U.y<"u"&&U.y!=null&&!isNaN(Number(U.y))?U.y:1,U.w=U.w||"50%",U.h=U.h||"50%",U.objectName=U.objectName?k0(U.objectName):`Chart ${$._slideObjects.filter((w)=>w._type===D0.chart).length}`,!["bar","col"].includes(U.barDir||""))U.barDir="col";if(U._type===q0.AREA){if(!["stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if(U._type===q0.BAR){if(!["clustered","stacked","percentStacked"].includes(U.barGrouping||""))U.barGrouping="clustered"}if(U._type===q0.BAR3D){if(!["clustered","stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if((J=U.barGrouping)===null||J===void 0?void 0:J.includes("tacked")){if(!U.barGapWidthPct)U.barGapWidthPct=50}if(U.dataLabelPosition){if(U._type===q0.AREA||U._type===q0.BAR3D||U._type===q0.DOUGHNUT||U._type===q0.RADAR)delete U.dataLabelPosition;if(U._type===q0.PIE){if(!["bestFit","ctr","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BUBBLE||U._type===q0.BUBBLE3D||U._type===q0.LINE||U._type===q0.SCATTER){if(!["b","ctr","l","r","t"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BAR){if(!["stacked","percentStacked"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(!["clustered"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}}}if(U.dataLabelBkgrdColors=U.dataLabelBkgrdColors||!U.dataLabelBkgrdColors?U.dataLabelBkgrdColors:!1,!["b","l","r","t","tr"].includes(U.legendPos||""))U.legendPos="r";if(!["cone","coneToMax","box","cylinder","pyramid","pyramidToMax"].includes(U.bar3DShape||""))U.bar3DShape="box";if(!["circle","dash","diamond","dot","none","square","triangle"].includes(U.lineDataSymbol||""))U.lineDataSymbol="circle";if(!["gap","span"].includes(U.displayBlanksAs||""))U.displayBlanksAs="span";if(!["standard","marker","filled"].includes(U.radarStyle||""))U.radarStyle="standard";if(U.lineDataSymbolSize=U.lineDataSymbolSize&&!isNaN(U.lineDataSymbolSize)?U.lineDataSymbolSize:6,U.lineDataSymbolLineSize=U.lineDataSymbolLineSize&&!isNaN(U.lineDataSymbolLineSize)?Y0(U.lineDataSymbolLineSize):Y0(0.75),U.layout)["x","y","w","h"].forEach((w)=>{let F=U.layout[w];if(isNaN(Number(F))||F<0||F>1)console.warn("Warning: chart.layout."+w+" can only be 0-1"),delete U.layout[w]});if(U.catGridLine=U.catGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),U.valGridLine=U.valGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{}),U.serGridLine=U.serGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),Z(U.catGridLine),Z(U.valGridLine),Z(U.serGridLine),b7(U.shadow),U.showDataTable=U.showDataTable||!U.showDataTable?U.showDataTable:!1,U.showDataTableHorzBorder=U.showDataTableHorzBorder||!U.showDataTableHorzBorder?U.showDataTableHorzBorder:!0,U.showDataTableVertBorder=U.showDataTableVertBorder||!U.showDataTableVertBorder?U.showDataTableVertBorder:!0,U.showDataTableOutline=U.showDataTableOutline||!U.showDataTableOutline?U.showDataTableOutline:!0,U.showDataTableKeys=U.showDataTableKeys||!U.showDataTableKeys?U.showDataTableKeys:!0,U.showLabel=U.showLabel||!U.showLabel?U.showLabel:!1,U.showLegend=U.showLegend||!U.showLegend?U.showLegend:!1,U.showPercent=U.showPercent||!U.showPercent?U.showPercent:!0,U.showTitle=U.showTitle||!U.showTitle?U.showTitle:!1,U.showValue=U.showValue||!U.showValue?U.showValue:!1,U.showLeaderLines=U.showLeaderLines||!U.showLeaderLines?U.showLeaderLines:!1,U.catAxisLineShow=typeof U.catAxisLineShow<"u"?U.catAxisLineShow:!0,U.valAxisLineShow=typeof U.valAxisLineShow<"u"?U.valAxisLineShow:!0,U.serAxisLineShow=typeof U.serAxisLineShow<"u"?U.serAxisLineShow:!0,U.v3DRotX=!isNaN(U.v3DRotX)&&U.v3DRotX>=-90&&U.v3DRotX<=90?U.v3DRotX:30,U.v3DRotY=!isNaN(U.v3DRotY)&&U.v3DRotY>=0&&U.v3DRotY<=360?U.v3DRotY:30,U.v3DRAngAx=U.v3DRAngAx||!U.v3DRAngAx?U.v3DRAngAx:!0,U.v3DPerspective=!isNaN(U.v3DPerspective)&&U.v3DPerspective>=0&&U.v3DPerspective<=240?U.v3DPerspective:30,U.barGapWidthPct=!isNaN(U.barGapWidthPct)&&U.barGapWidthPct>=0&&U.barGapWidthPct<=1000?U.barGapWidthPct:150,U.barGapDepthPct=!isNaN(U.barGapDepthPct)&&U.barGapDepthPct>=0&&U.barGapDepthPct<=1000?U.barGapDepthPct:150,U.chartColors=Array.isArray(U.chartColors)?U.chartColors:U._type===q0.PIE||U._type===q0.DOUGHNUT?HB:z8,U.chartColorsOpacity=U.chartColorsOpacity&&!isNaN(U.chartColorsOpacity)?U.chartColorsOpacity:null,U.border=U.border&&typeof U.border==="object"?U.border:null,U.border&&(!U.border.pt||isNaN(U.border.pt)))U.border.pt=v6.pt;if(U.border&&(!U.border.color||typeof U.border.color!=="string"))U.border.color=v6.color;if(U.plotArea=U.plotArea||{},U.plotArea.border=U.plotArea.border&&typeof U.plotArea.border==="object"?U.plotArea.border:null,U.plotArea.border&&(!U.plotArea.border.pt||isNaN(U.plotArea.border.pt)))U.plotArea.border.pt=v6.pt;if(U.plotArea.border&&(!U.plotArea.border.color||typeof U.plotArea.border.color!=="string"))U.plotArea.border.color=v6.color;if(U.border)U.plotArea.border=U.border;if(U.plotArea.fill=U.plotArea.fill||{color:null,transparency:null},U.fill)U.plotArea.fill.color=U.fill;if(U.chartArea=U.chartArea||{},U.chartArea.border=U.chartArea.border&&typeof U.chartArea.border==="object"?U.chartArea.border:null,U.chartArea.border)U.chartArea.border={color:U.chartArea.border.color||v6.color,pt:U.chartArea.border.pt||v6.pt};if(U.chartArea.roundedCorners=typeof U.chartArea.roundedCorners==="boolean"?U.chartArea.roundedCorners:!0,U.dataBorder=U.dataBorder&&typeof U.dataBorder==="object"?U.dataBorder:null,U.dataBorder&&(!U.dataBorder.pt||isNaN(U.dataBorder.pt)))U.dataBorder.pt=0.75;if(U.dataBorder&&U.dataBorder.color){let w=typeof U.dataBorder.color==="string"&&U.dataBorder.color.length===6&&/^[0-9A-Fa-f]{6}$/.test(U.dataBorder.color),F=Object.values(L5).includes(U.dataBorder.color);if(!w&&!F)U.dataBorder.color="F9F9F9"}if(!U.dataLabelFormatCode&&U._type===q0.SCATTER)U.dataLabelFormatCode="General";if(!U.dataLabelFormatCode&&(U._type===q0.PIE||U._type===q0.DOUGHNUT))U.dataLabelFormatCode=U.showPercent?"0%":"General";if(U.dataLabelFormatCode=U.dataLabelFormatCode&&typeof U.dataLabelFormatCode==="string"?U.dataLabelFormatCode:"#,##0",!U.dataLabelFormatScatter&&U._type===q0.SCATTER)U.dataLabelFormatScatter="custom";if(U.lineSize=typeof U.lineSize==="number"?U.lineSize:2,U.valAxisMajorUnit=typeof U.valAxisMajorUnit==="number"?U.valAxisMajorUnit:null,U._type===q0.AREA||U._type===q0.BAR||U._type===q0.BAR3D||U._type===q0.LINE)U.catAxisMultiLevelLabels=!!U.catAxisMultiLevelLabels;else delete U.catAxisMultiLevelLabels;return W._type="chart",W.options=U,W.chartRid=a2($),$._relsChart.push({rId:a2($),data:V,opts:U,type:U._type,globalId:G,fileName:`chart${G}.xml`,Target:`/ppt/charts/chart${G}.xml`}),$._slideObjects.push(W),W}function BJ($,q){let Q={_type:null,text:null,options:null,image:null,imageRid:null,hyperlink:null},K=q.x||0,J=q.y||0,Z=q.w||0,G=q.h||0,W=q.sizing||null,B=q.hyperlink||"",V=q.data||"",U=q.path||"",w=a2($),F=q.objectName?k0(q.objectName):`Image ${$._slideObjects.filter((k)=>k._type===D0.image).length}`;if(!U&&!V)return console.error("ERROR: addImage() requires either 'data' or 'path' parameter!"),null;else if(U&&typeof U!=="string")return console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(U)}`),null;else if(V&&typeof V!=="string")return console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(V)}`),null;else if(V&&typeof V==="string"&&!V.toLowerCase().includes("base64,"))return console.error("ERROR: Image `data` value lacks a base64 header! Ex: 'image/png;base64,NMP[...]')"),null;let M=(U.substring(U.lastIndexOf("/")+1).split("?")[0].split(".").pop().split("#")[0]||"png").toLowerCase();if(V&&/image\/(\w+);/.exec(V)&&/image\/(\w+);/.exec(V).length>0)M=/image\/(\w+);/.exec(V)[1];else if(V===null||V===void 0?void 0:V.toLowerCase().includes("image/svg+xml"))M="svg";if(Q._type=D0.image,Q.image=U||"preencoded.png",Q.options={x:K||0,y:J||0,w:Z||1,h:G||1,altText:q.altText||"",rounding:typeof q.rounding==="boolean"?q.rounding:!1,sizing:W,placeholder:q.placeholder,rotate:q.rotate||0,flipV:q.flipV||!1,flipH:q.flipH||!1,transparency:q.transparency||0,objectName:F,shadow:b7(q.shadow)},M==="svg")$._relsMedia.push({path:U||V+"png",type:"image/png",extn:"png",data:V||"",rId:w,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`,isSvgPng:!0,svgSize:{w:H0(Q.options.w,"X",$._presLayout),h:H0(Q.options.h,"Y",$._presLayout)}}),Q.imageRid=w,$._relsMedia.push({path:U||V,type:"image/svg+xml",extn:M,data:V||"",rId:w+1,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w+1;else{let k=$._relsMedia.filter((f)=>f.path&&f.path===U&&f.type==="image/"+M&&!f.isDuplicate)[0];$._relsMedia.push({path:U||"preencoded."+M,type:"image/"+M,extn:M,data:V||"",rId:w,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w}if(typeof B==="object")if(!B.url&&!B.slide)throw Error("ERROR: `hyperlink` option requires either: `url` or `slide`");else w++,$._rels.push({type:D0.hyperlink,data:B.slide?"slide":"dummy",rId:w,Target:B.url||B.slide.toString()}),B._rId=w,Q.hyperlink=B;$._slideObjects.push(Q)}function gB($,q){let Q=q.x||0,K=q.y||0,J=q.w||2,Z=q.h||2,G=q.data||"",W=q.link||"",B=q.path||"",V=q.type||"audio",U="",w=q.cover||vB,F=q.objectName?k0(q.objectName):`Media ${$._slideObjects.filter((k)=>k._type===D0.media).length}`,M={_type:D0.media};if(!B&&!G&&V!=="online")throw Error("addMedia() error: either `data` or `path` are required!");else if(G&&!G.toLowerCase().includes("base64,"))throw Error("addMedia() error: `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')");else if(!w.toLowerCase().includes("base64,"))throw Error("addMedia() error: `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')");if(V==="online"&&!W)throw Error("addMedia() error: online videos require `link` value");if(U=q.extn||(G?G.split(";")[0].split("/")[1]:B.split(".").pop())||"mp3",M.mtype=V,M.media=B||"preencoded.mov",M.options={},M.options.x=Q,M.options.y=K,M.options.w=J,M.options.h=Z,M.options.objectName=F,V==="online"){let k=a2($);$._relsMedia.push({path:B||"preencoded"+U,data:"dummy",type:"online",extn:U,rId:k,Target:W}),M.mediaRid=k,$._relsMedia.push({path:"preencoded.png",data:w,type:"image/png",extn:"png",rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}else{let k=$._relsMedia.filter((L)=>L.path&&L.path===B&&L.type===V+"/"+U&&!L.isDuplicate)[0],f=a2($);$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:f,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+1}.${U}`}),M.mediaRid=f,$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:a2($),isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+0}.${U}`}),$._relsMedia.push({path:"preencoded.png",type:"image/png",extn:"png",data:w,rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}$._slideObjects.push(M)}function AB($,q){$._slideObjects.push({_type:D0.notes,text:[{text:q}]})}function _7($,q,Q){let K=typeof Q==="object"?Q:{};K.line=K.line||{type:"none"};let J={_type:D0.text,shape:q||B1.RECTANGLE,options:K,text:null};if(!q)throw Error("Missing/Invalid shape parameter! Example: `addShape(pptxgen.shapes.LINE, {x:1, y:1, w:1, h:1});`");let Z={type:K.line.type||"solid",color:K.line.color||VJ,transparency:K.line.transparency||0,width:K.line.width||1,dashType:K.line.dashType||"solid",beginArrowType:K.line.beginArrowType||null,endArrowType:K.line.endArrowType||null};if(typeof K.line==="object"&&K.line.type!=="none")K.line=Z;if(K.x=K.x||(K.x===0?0:1),K.y=K.y||(K.y===0?0:1),K.w=K.w||(K.w===0?0:1),K.h=K.h||(K.h===0?0:1),K.objectName=K.objectName?k0(K.objectName):`Shape ${$._slideObjects.filter((G)=>G._type===D0.text).length}`,typeof K.line==="string"){let G=Z;G.color=String(K.line),K.line=G}if(typeof K.lineSize==="number")K.line.width=K.lineSize;if(typeof K.lineDash==="string")K.line.dashType=K.lineDash;if(typeof K.lineHead==="string")K.line.beginArrowType=K.lineHead;if(typeof K.lineTail==="string")K.line.endArrowType=K.lineTail;g6($,J),$._slideObjects.push(J)}function XB($,q,Q,K,J,Z,G){let W=[$],B=Q&&typeof Q==="object"?Q:{};B.objectName=B.objectName?k0(B.objectName):`Table ${$._slideObjects.filter((F)=>F._type===D0.table).length}`;{if(q===null||q.length===0||!Array.isArray(q))throw Error("addTable: Array expected! EX: 'slide.addTable( [rows], {options} );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)");if(!q[0]||!Array.isArray(q[0]))throw Error("addTable: 'rows' should be an array of cells! EX: 'slide.addTable( [ ['A'], ['B'], {text:'C',options:{align:'center'}} ] );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)")}let V=[];if(q.forEach((F)=>{let M=[];if(Array.isArray(F))F.forEach((k)=>{let f={_type:D0.tablecell,text:"",options:typeof k==="object"&&k.options?k.options:{}};if(typeof k==="string"||typeof k==="number")f.text=k.toString();else if(k.text){if(typeof k.text==="string"||typeof k.text==="number")f.text=k.text.toString();else if(k.text)f.text=k.text;if(k.options&&typeof k.options==="object")f.options=k.options}f.options.border=f.options.border||B.border||[{type:"none"},{type:"none"},{type:"none"},{type:"none"}];let L=f.options.border;if(!Array.isArray(L)&&typeof L==="object")f.options.border=[L,L,L,L];if(!f.options.border[0])f.options.border[0]={type:"none"};if(!f.options.border[1])f.options.border[1]={type:"none"};if(!f.options.border[2])f.options.border[2]={type:"none"};if(!f.options.border[3])f.options.border[3]={type:"none"};[0,1,2,3].forEach((z)=>{f.options.border[z]={type:f.options.border[z].type||H6.type,color:f.options.border[z].color||H6.color,pt:typeof f.options.border[z].pt==="number"?f.options.border[z].pt:H6.pt}}),M.push(f)});else console.log("addTable: tableRows has a bad row. A row should be an array of cells. You provided:"),console.log(F);V.push(M)}),B.x=H0(B.x||(B.x===0?0:L0/2),"X",J),B.y=H0(B.y||(B.y===0?0:L0/2),"Y",J),B.h)B.h=H0(B.h,"Y",J);if(B.fontSize=B.fontSize||k2,B.margin=B.margin===0||B.margin?B.margin:JJ,typeof B.margin==="number")B.margin=[Number(B.margin),Number(B.margin),Number(B.margin),Number(B.margin)];if(JSON.stringify({arrRows:V}).indexOf("hyperlink")===-1){if(!B.color)B.color=B.color||Q2}if(typeof B.border==="string")console.warn("addTable `border` option must be an object. Ex: `{border: {type:'none'}}`"),B.border=null;else if(Array.isArray(B.border))[0,1,2,3].forEach((F)=>{B.border[F]=B.border[F]?{type:B.border[F].type||H6.type,color:B.border[F].color||H6.color,pt:B.border[F].pt||H6.pt}:{type:"none"}});if(B.autoPage=typeof B.autoPage==="boolean"?B.autoPage:!1,B.autoPageRepeatHeader=typeof B.autoPageRepeatHeader==="boolean"?B.autoPageRepeatHeader:!1,B.autoPageHeaderRows=typeof B.autoPageHeaderRows<"u"&&!isNaN(Number(B.autoPageHeaderRows))?Number(B.autoPageHeaderRows):1,B.autoPageLineWeight=typeof B.autoPageLineWeight<"u"&&!isNaN(Number(B.autoPageLineWeight))?Number(B.autoPageLineWeight):0,B.autoPageLineWeight){if(B.autoPageLineWeight>1)B.autoPageLineWeight=1;else if(B.autoPageLineWeight<-1)B.autoPageLineWeight=-1}let U=M8;if(K&&typeof K._margin<"u"){if(Array.isArray(K._margin))U=K._margin;else if(!isNaN(Number(K._margin)))U=[Number(K._margin),Number(K._margin),Number(K._margin),Number(K._margin)]}if(B.colW){let F=V[0].reduce((M,k)=>{var f;if(((f=k===null||k===void 0?void 0:k.options)===null||f===void 0?void 0:f.colspan)&&typeof k.options.colspan==="number")M+=k.options.colspan;else M+=1;return M},0);if(typeof B.colW==="string"||typeof B.colW==="number")B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length===1&&F>1)B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length!==F)console.warn("addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths."),B.colW=null}else if(B.w)B.w=H0(B.w,"X",J);else B.w=Math.floor(J._sizeW/L0-U[1]-U[3]);if(B.x&&B.x<20)B.x=v0(B.x);if(B.y&&B.y<20)B.y=v0(B.y);if(B.w&&typeof B.w==="number"&&B.w<20)B.w=v0(B.w);if(B.h&&typeof B.h==="number"&&B.h<20)B.h=v0(B.h);V.forEach((F)=>{F.forEach((M,k)=>{if(typeof M==="number"||typeof M==="string")F[k]={_type:D0.tablecell,text:String(F[k]),options:B};else if(typeof M==="object"){if(typeof M.text==="number")F[k].text=F[k].text.toString();else if(typeof M.text>"u"||M.text===null)F[k].text="";F[k].options=M.options||{},F[k]._type=D0.tablecell}})});let w=[];if(B&&!B.autoPage)g6($,V),$._slideObjects.push({_type:D0.table,arrTabRows:V,options:Object.assign({},B)});else{if(B.autoPageRepeatHeader)B._arrObjTabHeadRows=V.filter((F,M)=>M{if(!G($._slideNum+M))W.push(Z({masterName:(K===null||K===void 0?void 0:K._name)||null}));if(M>0)B.y=v0(B.autoPageSlideStartY||B.newSlideStartY||U[0]);{let k=G($._slideNum+M);if(B.autoPage=!1,g6(k,F.rows),k.addTable(F.rows,Object.assign({},B)),M>0)w.push(k)}})}return w}function H5($,q,Q,K){let J={_type:K?D0.placeholder:D0.text,shape:(Q===null||Q===void 0?void 0:Q.shape)||B1.RECTANGLE,text:!q||q.length===0?[{text:"",options:null}]:q,options:Q||{}};function Z(G){{if(!G.placeholder)G.color=G.color||J.options.color||$.color||Q2;if(G.placeholder||K)G.bullet=G.bullet||!1;if(G.placeholder&&$._slideLayout&&$._slideLayout._slideObjects){let W=$._slideLayout._slideObjects.filter((B)=>B._type==="placeholder"&&B.options&&B.options.placeholder&&B.options.placeholder===G.placeholder)[0];if(W===null||W===void 0?void 0:W.options)G=Object.assign(Object.assign({},G),W.options)}if(G.objectName=G.objectName?k0(G.objectName):`Text ${$._slideObjects.filter((W)=>W._type===D0.text).length}`,G.shape===B1.LINE){let W={type:G.line.type||"solid",color:G.line.color||VJ,transparency:G.line.transparency||0,width:G.line.width||1,dashType:G.line.dashType||"solid",beginArrowType:G.line.beginArrowType||null,endArrowType:G.line.endArrowType||null};if(typeof G.line==="object")G.line=W;if(typeof G.line==="string"){let B=W;if(typeof G.line==="string")B.color=G.line;G.line=B}if(typeof G.lineSize==="number")G.line.width=G.lineSize;if(typeof G.lineDash==="string")G.line.dashType=G.lineDash;if(typeof G.lineHead==="string")G.line.beginArrowType=G.lineHead;if(typeof G.lineTail==="string")G.line.endArrowType=G.lineTail}if(G.line=G.line||{},G.lineSpacing=G.lineSpacing&&!isNaN(G.lineSpacing)?G.lineSpacing:null,G.lineSpacingMultiple=G.lineSpacingMultiple&&!isNaN(G.lineSpacingMultiple)?G.lineSpacingMultiple:null,G._bodyProp=G._bodyProp||{},G._bodyProp.autoFit=G.autoFit||!1,G._bodyProp.anchor=!G.placeholder?I6.ctr:null,G._bodyProp.vert=G.vert||null,G._bodyProp.wrap=typeof G.wrap==="boolean"?G.wrap:!0,G.inset&&!isNaN(Number(G.inset))||G.inset===0)G._bodyProp.lIns=v0(G.inset),G._bodyProp.rIns=v0(G.inset),G._bodyProp.tIns=v0(G.inset),G._bodyProp.bIns=v0(G.inset);if(typeof G.underline==="boolean"&&G.underline===!0)G.underline={style:"sng"}}{if((G.align||"").toLowerCase().indexOf("c")===0)G._bodyProp.align=R6.center;else if((G.align||"").toLowerCase().indexOf("l")===0)G._bodyProp.align=R6.left;else if((G.align||"").toLowerCase().indexOf("r")===0)G._bodyProp.align=R6.right;else if((G.align||"").toLowerCase().indexOf("j")===0)G._bodyProp.align=R6.justify;if((G.valign||"").toLowerCase().indexOf("b")===0)G._bodyProp.anchor=I6.b;else if((G.valign||"").toLowerCase().indexOf("m")===0)G._bodyProp.anchor=I6.ctr;else if((G.valign||"").toLowerCase().indexOf("t")===0)G._bodyProp.anchor=I6.t}return b7(G.shadow),G}J.options=Z(J.options),J.text.forEach((G)=>G.options=Z(G.options||{})),g6($,J.text||""),$._slideObjects.push(J)}function yB($){($._slideLayout._slideObjects||[]).forEach((q)=>{if(q._type===D0.placeholder){if($._slideObjects.filter((Q)=>Q.options&&Q.options.placeholder===q.options.placeholder).length===0)H5($,[{text:""}],q.options,!1)}})}function zJ($,q){var Q;if(q.bkgd){if(!q.background)q.background={};if(typeof q.bkgd==="string")q.background.color=q.bkgd;else{if(q.bkgd.data)q.background.data=q.bkgd.data;if(q.bkgd.path)q.background.path=q.bkgd.path;if(q.bkgd.src)q.background.path=q.bkgd.src}}if((Q=q.background)===null||Q===void 0?void 0:Q.fill)q.background.color=q.background.fill;if($&&($.path||$.data)){$.path=$.path||"preencoded.png";let K=($.path.split(".").pop()||"png").split("?")[0];if(K==="jpg")K="jpeg";q._relsMedia=q._relsMedia||[];let J=q._relsMedia.length+1;q._relsMedia.push({path:$.path,type:D0.image,extn:K,data:$.data||null,rId:J,Target:`../media/${(q._name||"").replace(/\s+/gi,"-")}-image-${q._relsMedia.length+1}.${K}`}),q._bkgdImgRid=J}}function g6($,q,Q){let K=[];if(typeof q==="string"||typeof q==="number")return;else if(Array.isArray(q))K=q;else if(typeof q==="object")K=[q];K.forEach((J,Z)=>{if(Q&&Q[Z]&&Q[Z].hyperlink)J.options=Object.assign(Object.assign({},J.options),Q[Z]);if(Array.isArray(J)){let G=[];J.forEach((W)=>{if(W.options&&!W.text.options)G.push(W.options)}),g6($,J,G)}else if(Array.isArray(J.text))g6($,J.text,Q&&Q[Z]?[Q[Z]]:void 0);else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&!J.options.hyperlink._rId)if(typeof J.options.hyperlink!=="object")console.log("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:'https://github.com'}` ");else if(!J.options.hyperlink.url&&!J.options.hyperlink.slide)console.log("ERROR: 'hyperlink requires either: `url` or `slide`'");else{let G=a2($);$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:G,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()}),J.options.hyperlink._rId=G}else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&J.options.hyperlink._rId){if($._rels.filter((G)=>G.rId===J.options.hyperlink._rId).length===0)$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:J.options.hyperlink._rId,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()})}})}class FJ{constructor($){var q;this.addSlide=$.addSlide,this.getSlide=$.getSlide,this._name=`Slide ${$.slideNumber}`,this._presLayout=$.presLayout,this._rId=$.slideRId,this._rels=[],this._relsChart=[],this._relsMedia=[],this._setSlideNum=$.setSlideNum,this._slideId=$.slideId,this._slideLayout=$.slideLayout||null,this._slideNum=$.slideNumber,this._slideObjects=[],this._slideNumberProps=((q=this._slideLayout)===null||q===void 0?void 0:q._slideNumberProps)?this._slideLayout._slideNumberProps:null}set bkgd($){if(this._bkgd=$,!this._background||!this._background.color){if(!this._background)this._background={};if(typeof $==="string")this._background.color=$}}get bkgd(){return this._bkgd}set background($){if(this._background=$,$)zJ($,this)}get background(){return this._background}set color($){this._color=$}get color(){return this._color}set hidden($){this._hidden=$}get hidden(){return this._hidden}set slideNumber($){this._slideNumberProps=$,this._setSlideNum($)}get slideNumber(){return this._slideNumberProps}get newAutoPagedSlides(){return this._newAutoPagedSlides}addChart($,q,Q){let K=Q||{};return K._type=$,WJ(this,$,q,Q),this}addImage($){return BJ(this,$),this}addMedia($){return gB(this,$),this}addNotes($){return AB(this,$),this}addShape($,q){return _7(this,$,q),this}addTable($,q){return this._newAutoPagedSlides=XB(this,$,q,this._slideLayout,this._presLayout,this.addSlide,this.getSlide),this}addText($,q){return H5(this,typeof $==="string"||typeof $==="number"?[{text:$,options:q}]:$,q,!1),this}}function hB($,q){return W2(this,void 0,void 0,function*(){let Q=$.data;return yield new Promise((K,J)=>{var Z,G;let W=new c7.default,B=(Q.length-1)*2+1,V=((G=(Z=Q[0])===null||Z===void 0?void 0:Z.labels)===null||G===void 0?void 0:G.length)>1;W.folder("_rels"),W.folder("docProps"),W.folder("xl/_rels"),W.folder("xl/tables"),W.folder("xl/theme"),W.folder("xl/worksheets"),W.folder("xl/worksheets/_rels"),W.file("[Content_Types].xml",' \n'),W.file("_rels/.rels",` +`);return V}function yB($,q,Q={},K){let J=Q||{};J.slideMargin=J.slideMargin||J.slideMargin===0?J.slideMargin:0.5;let Z=J.w||$.presLayout.width,G=[],W=[],B=[],V=[],U=[],w=[0.5,0.5,0.5,0.5],F=0;if(!document.getElementById(q))throw Error('tableToSlides: Table ID "'+q+'" does not exist!');if(K===null||K===void 0?void 0:K._margin){if(Array.isArray(K._margin))w=K._margin;else if(!isNaN(K._margin))w=[K._margin,K._margin,K._margin,K._margin];J.slideMargin=w}else if(J===null||J===void 0?void 0:J.slideMargin){if(Array.isArray(J.slideMargin))w=J.slideMargin;else if(!isNaN(J.slideMargin))w=[J.slideMargin,J.slideMargin,J.slideMargin,J.slideMargin]}if(Z=(J.w?v0(J.w):$.presLayout.width)-v0(w[1]+w[3]),J.verbose)console.log("[[VERBOSE MODE]]"),console.log("|-- `tableToSlides` ----------------------------------------------------|"),console.log(`| tableProps.h .................................... = ${J.h}`),console.log(`| tableProps.w .................................... = ${J.w}`),console.log(`| pptx.presLayout.width ........................... = ${($.presLayout.width/L0).toFixed(1)}`),console.log(`| pptx.presLayout.height .......................... = ${($.presLayout.height/L0).toFixed(1)}`),console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);let M=document.querySelectorAll(`#${q} tr:first-child th`);if(M.length===0)M=document.querySelectorAll(`#${q} tr:first-child td`);if(M.forEach((f)=>{let L=f;if(L.getAttribute("colspan"))for(let D=0;D{F+=f}),U.forEach((f,L)=>{let D=Number((Number(Z)*(f/F*100)/100/L0).toFixed(2)),z=0,N=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(N)z=Number(N.getAttribute("data-pptx-min-width"));let H=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(H)z=Number(H.getAttribute("data-pptx-width"));V.push(z>D?z:D)}),J.verbose)console.log(`| arrColW ......................................... = [${V.join(", ")}]`);["thead","tbody","tfoot"].forEach((f)=>{document.querySelectorAll(`#${q} ${f} tr`).forEach((L)=>{let D=L,z=[];switch(Array.from(D.cells).forEach((N)=>{let H=window.getComputedStyle(N).getPropertyValue("color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(","),v=window.getComputedStyle(N).getPropertyValue("background-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");if(window.getComputedStyle(N).getPropertyValue("background-color")==="rgba(0, 0, 0, 0)"||window.getComputedStyle(N).getPropertyValue("transparent"))v=["255","255","255"];let j={align:null,bold:window.getComputedStyle(N).getPropertyValue("font-weight")==="bold"||Number(window.getComputedStyle(N).getPropertyValue("font-weight"))>=500,border:null,color:A7(Number(H[0]),Number(H[1]),Number(H[2])),fill:{color:A7(Number(v[0]),Number(v[1]),Number(v[2]))},fontFace:(window.getComputedStyle(N).getPropertyValue("font-family")||"").split(",")[0].replace(/"/g,"").replace("inherit","").replace("initial","")||null,fontSize:Number(window.getComputedStyle(N).getPropertyValue("font-size").replace(/[a-z]/gi,"")),margin:null,colspan:Number(N.getAttribute("colspan"))||null,rowspan:Number(N.getAttribute("rowspan"))||null,valign:null};if(["left","center","right","start","end"].includes(window.getComputedStyle(N).getPropertyValue("text-align"))){let n=window.getComputedStyle(N).getPropertyValue("text-align").replace("start","left").replace("end","right");j.align=n==="center"?"center":n==="left"?"left":n==="right"?"right":null}if(["top","middle","bottom"].includes(window.getComputedStyle(N).getPropertyValue("vertical-align"))){let n=window.getComputedStyle(N).getPropertyValue("vertical-align");j.valign=n==="top"?"top":n==="middle"?"middle":n==="bottom"?"bottom":null}if(window.getComputedStyle(N).getPropertyValue("padding-left"))j.margin=[0,0,0,0],["padding-top","padding-right","padding-bottom","padding-left"].forEach((d,_)=>{j.margin[_]=Math.round(Number(window.getComputedStyle(N).getPropertyValue(d).replace(/\D/gi,"")))});if(window.getComputedStyle(N).getPropertyValue("border-top-width")||window.getComputedStyle(N).getPropertyValue("border-right-width")||window.getComputedStyle(N).getPropertyValue("border-bottom-width")||window.getComputedStyle(N).getPropertyValue("border-left-width"))j.border=[null,null,null,null],["top","right","bottom","left"].forEach((d,_)=>{let X=Math.round(Number(window.getComputedStyle(N).getPropertyValue("border-"+d+"-width").replace("px",""))),P=[];P=window.getComputedStyle(N).getPropertyValue("border-"+d+"-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");let g=A7(Number(P[0]),Number(P[1]),Number(P[2]));j.border[_]={pt:X,color:g}});z.push({_type:D0.tablecell,text:N.innerText,options:j})}),f){case"thead":G.push(z);break;case"tbody":W.push(z);break;case"tfoot":B.push(z);break;default:console.log(`table parsing: unexpected table part: ${f}`);break}})}),J._arrObjTabHeadRows=G||null,J.colW=V,GJ([...G,...W,...B],J,$.presLayout,K).forEach((f,L)=>{let D=$.addSlide({masterName:J.masterSlideName||null});if(L===0)J.y=J.y||w[0];if(L>0)J.y=J.autoPageSlideStartY||J.newSlideStartY||w[0];if(J.verbose)console.log(`| opts.autoPageSlideStartY: ${J.autoPageSlideStartY} / arrInchMargins[0]: ${w[0]} => opts.y = ${J.y}`);if(D.addTable(f.rows,{x:J.x||w[3],y:J.y,w:Number(Z)/L0,colW:V,autoPage:!1}),J.addImage)if(J.addImage.options=J.addImage.options||{},!J.addImage.image||!J.addImage.image.path&&!J.addImage.image.data)console.warn("Warning: tableToSlides.addImage requires either `path` or `data`");else D.addImage({path:J.addImage.image.path,data:J.addImage.image.data,x:J.addImage.options.x,y:J.addImage.options.y,w:J.addImage.options.w,h:J.addImage.options.h});if(J.addShape)D.addShape(J.addShape.shapeName,J.addShape.options||{});if(J.addTable)D.addTable(J.addTable.rows,J.addTable.options||{});if(J.addText)D.addText(J.addText.text,J.addText.options||{})})}var hB=0;function xB($,q){if($.bkgd)q.bkgd=$.bkgd;if($.objects&&Array.isArray($.objects)&&$.objects.length>0)$.objects.forEach((Q,K)=>{let J=Object.keys(Q)[0],Z=q;if(W1[J]&&J==="chart")WJ(Z,Q[J].type,Q[J].data,Q[J].opts);else if(W1[J]&&J==="image")BJ(Z,Q[J]);else if(W1[J]&&J==="line")_7(Z,B1.LINE,Q[J]);else if(W1[J]&&J==="rect")_7(Z,B1.RECTANGLE,Q[J]);else if(W1[J]&&J==="text")H5(Z,[{text:Q[J].text}],Q[J].options,!1);else if(W1[J]&&J==="placeholder")Q[J].options.placeholder=Q[J].options.name,delete Q[J].options.name,Q[J].options._placeholderType=Q[J].options.type,delete Q[J].options.type,Q[J].options._placeholderIdx=100+K,H5(Z,[{text:Q[J].text}],Q[J].options,!0)});if($.slideNumber&&typeof $.slideNumber==="object")q._slideNumberProps=$.slideNumber}function WJ($,q,Q,K){var J;function Z(w){if(!w||w.style==="none")return;if(w.size!==void 0&&(isNaN(Number(w.size))||w.size<=0))console.warn("Warning: chart.gridLine.size must be greater than 0."),delete w.size;if(w.style&&!["solid","dash","dot"].includes(w.style))console.warn("Warning: chart.gridLine.style options: `solid`, `dash`, `dot`."),delete w.style;if(w.cap&&!["flat","square","round"].includes(w.cap))console.warn("Warning: chart.gridLine.cap options: `flat`, `square`, `round`."),delete w.cap}let G=++hB,W={_type:null,text:null,options:null,chartRid:null},B=null,V=[];if(Array.isArray(q))q.forEach((w)=>{V=V.concat(w.data)}),B=Q||K;else V=Q,B=K;V.forEach((w,F)=>{if(w._dataIndex=F,w.labels!==void 0&&!Array.isArray(w.labels[0]))w.labels=[w.labels]});let U=B&&typeof B==="object"?B:{};if(U._type=q,U.x=typeof U.x<"u"&&U.x!=null&&!isNaN(Number(U.x))?U.x:1,U.y=typeof U.y<"u"&&U.y!=null&&!isNaN(Number(U.y))?U.y:1,U.w=U.w||"50%",U.h=U.h||"50%",U.objectName=U.objectName?k0(U.objectName):`Chart ${$._slideObjects.filter((w)=>w._type===D0.chart).length}`,!["bar","col"].includes(U.barDir||""))U.barDir="col";if(U._type===q0.AREA){if(!["stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if(U._type===q0.BAR){if(!["clustered","stacked","percentStacked"].includes(U.barGrouping||""))U.barGrouping="clustered"}if(U._type===q0.BAR3D){if(!["clustered","stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if((J=U.barGrouping)===null||J===void 0?void 0:J.includes("tacked")){if(!U.barGapWidthPct)U.barGapWidthPct=50}if(U.dataLabelPosition){if(U._type===q0.AREA||U._type===q0.BAR3D||U._type===q0.DOUGHNUT||U._type===q0.RADAR)delete U.dataLabelPosition;if(U._type===q0.PIE){if(!["bestFit","ctr","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BUBBLE||U._type===q0.BUBBLE3D||U._type===q0.LINE||U._type===q0.SCATTER){if(!["b","ctr","l","r","t"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BAR){if(!["stacked","percentStacked"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(!["clustered"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}}}if(U.dataLabelBkgrdColors=U.dataLabelBkgrdColors||!U.dataLabelBkgrdColors?U.dataLabelBkgrdColors:!1,!["b","l","r","t","tr"].includes(U.legendPos||""))U.legendPos="r";if(!["cone","coneToMax","box","cylinder","pyramid","pyramidToMax"].includes(U.bar3DShape||""))U.bar3DShape="box";if(!["circle","dash","diamond","dot","none","square","triangle"].includes(U.lineDataSymbol||""))U.lineDataSymbol="circle";if(!["gap","span"].includes(U.displayBlanksAs||""))U.displayBlanksAs="span";if(!["standard","marker","filled"].includes(U.radarStyle||""))U.radarStyle="standard";if(U.lineDataSymbolSize=U.lineDataSymbolSize&&!isNaN(U.lineDataSymbolSize)?U.lineDataSymbolSize:6,U.lineDataSymbolLineSize=U.lineDataSymbolLineSize&&!isNaN(U.lineDataSymbolLineSize)?Y0(U.lineDataSymbolLineSize):Y0(0.75),U.layout)["x","y","w","h"].forEach((w)=>{let F=U.layout[w];if(isNaN(Number(F))||F<0||F>1)console.warn("Warning: chart.layout."+w+" can only be 0-1"),delete U.layout[w]});if(U.catGridLine=U.catGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),U.valGridLine=U.valGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{}),U.serGridLine=U.serGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),Z(U.catGridLine),Z(U.valGridLine),Z(U.serGridLine),b7(U.shadow),U.showDataTable=U.showDataTable||!U.showDataTable?U.showDataTable:!1,U.showDataTableHorzBorder=U.showDataTableHorzBorder||!U.showDataTableHorzBorder?U.showDataTableHorzBorder:!0,U.showDataTableVertBorder=U.showDataTableVertBorder||!U.showDataTableVertBorder?U.showDataTableVertBorder:!0,U.showDataTableOutline=U.showDataTableOutline||!U.showDataTableOutline?U.showDataTableOutline:!0,U.showDataTableKeys=U.showDataTableKeys||!U.showDataTableKeys?U.showDataTableKeys:!0,U.showLabel=U.showLabel||!U.showLabel?U.showLabel:!1,U.showLegend=U.showLegend||!U.showLegend?U.showLegend:!1,U.showPercent=U.showPercent||!U.showPercent?U.showPercent:!0,U.showTitle=U.showTitle||!U.showTitle?U.showTitle:!1,U.showValue=U.showValue||!U.showValue?U.showValue:!1,U.showLeaderLines=U.showLeaderLines||!U.showLeaderLines?U.showLeaderLines:!1,U.catAxisLineShow=typeof U.catAxisLineShow<"u"?U.catAxisLineShow:!0,U.valAxisLineShow=typeof U.valAxisLineShow<"u"?U.valAxisLineShow:!0,U.serAxisLineShow=typeof U.serAxisLineShow<"u"?U.serAxisLineShow:!0,U.v3DRotX=!isNaN(U.v3DRotX)&&U.v3DRotX>=-90&&U.v3DRotX<=90?U.v3DRotX:30,U.v3DRotY=!isNaN(U.v3DRotY)&&U.v3DRotY>=0&&U.v3DRotY<=360?U.v3DRotY:30,U.v3DRAngAx=U.v3DRAngAx||!U.v3DRAngAx?U.v3DRAngAx:!0,U.v3DPerspective=!isNaN(U.v3DPerspective)&&U.v3DPerspective>=0&&U.v3DPerspective<=240?U.v3DPerspective:30,U.barGapWidthPct=!isNaN(U.barGapWidthPct)&&U.barGapWidthPct>=0&&U.barGapWidthPct<=1000?U.barGapWidthPct:150,U.barGapDepthPct=!isNaN(U.barGapDepthPct)&&U.barGapDepthPct>=0&&U.barGapDepthPct<=1000?U.barGapDepthPct:150,U.chartColors=Array.isArray(U.chartColors)?U.chartColors:U._type===q0.PIE||U._type===q0.DOUGHNUT?jB:z8,U.chartColorsOpacity=U.chartColorsOpacity&&!isNaN(U.chartColorsOpacity)?U.chartColorsOpacity:null,U.border=U.border&&typeof U.border==="object"?U.border:null,U.border&&(!U.border.pt||isNaN(U.border.pt)))U.border.pt=v6.pt;if(U.border&&(!U.border.color||typeof U.border.color!=="string"))U.border.color=v6.color;if(U.plotArea=U.plotArea||{},U.plotArea.border=U.plotArea.border&&typeof U.plotArea.border==="object"?U.plotArea.border:null,U.plotArea.border&&(!U.plotArea.border.pt||isNaN(U.plotArea.border.pt)))U.plotArea.border.pt=v6.pt;if(U.plotArea.border&&(!U.plotArea.border.color||typeof U.plotArea.border.color!=="string"))U.plotArea.border.color=v6.color;if(U.border)U.plotArea.border=U.border;if(U.plotArea.fill=U.plotArea.fill||{color:null,transparency:null},U.fill)U.plotArea.fill.color=U.fill;if(U.chartArea=U.chartArea||{},U.chartArea.border=U.chartArea.border&&typeof U.chartArea.border==="object"?U.chartArea.border:null,U.chartArea.border)U.chartArea.border={color:U.chartArea.border.color||v6.color,pt:U.chartArea.border.pt||v6.pt};if(U.chartArea.roundedCorners=typeof U.chartArea.roundedCorners==="boolean"?U.chartArea.roundedCorners:!0,U.dataBorder=U.dataBorder&&typeof U.dataBorder==="object"?U.dataBorder:null,U.dataBorder&&(!U.dataBorder.pt||isNaN(U.dataBorder.pt)))U.dataBorder.pt=0.75;if(U.dataBorder&&U.dataBorder.color){let w=typeof U.dataBorder.color==="string"&&U.dataBorder.color.length===6&&/^[0-9A-Fa-f]{6}$/.test(U.dataBorder.color),F=Object.values(L5).includes(U.dataBorder.color);if(!w&&!F)U.dataBorder.color="F9F9F9"}if(!U.dataLabelFormatCode&&U._type===q0.SCATTER)U.dataLabelFormatCode="General";if(!U.dataLabelFormatCode&&(U._type===q0.PIE||U._type===q0.DOUGHNUT))U.dataLabelFormatCode=U.showPercent?"0%":"General";if(U.dataLabelFormatCode=U.dataLabelFormatCode&&typeof U.dataLabelFormatCode==="string"?U.dataLabelFormatCode:"#,##0",!U.dataLabelFormatScatter&&U._type===q0.SCATTER)U.dataLabelFormatScatter="custom";if(U.lineSize=typeof U.lineSize==="number"?U.lineSize:2,U.valAxisMajorUnit=typeof U.valAxisMajorUnit==="number"?U.valAxisMajorUnit:null,U._type===q0.AREA||U._type===q0.BAR||U._type===q0.BAR3D||U._type===q0.LINE)U.catAxisMultiLevelLabels=!!U.catAxisMultiLevelLabels;else delete U.catAxisMultiLevelLabels;return W._type="chart",W.options=U,W.chartRid=a2($),$._relsChart.push({rId:a2($),data:V,opts:U,type:U._type,globalId:G,fileName:`chart${G}.xml`,Target:`/ppt/charts/chart${G}.xml`}),$._slideObjects.push(W),W}function BJ($,q){let Q={_type:null,text:null,options:null,image:null,imageRid:null,hyperlink:null},K=q.x||0,J=q.y||0,Z=q.w||0,G=q.h||0,W=q.sizing||null,B=q.hyperlink||"",V=q.data||"",U=q.path||"",w=a2($),F=q.objectName?k0(q.objectName):`Image ${$._slideObjects.filter((k)=>k._type===D0.image).length}`;if(!U&&!V)return console.error("ERROR: addImage() requires either 'data' or 'path' parameter!"),null;else if(U&&typeof U!=="string")return console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(U)}`),null;else if(V&&typeof V!=="string")return console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(V)}`),null;else if(V&&typeof V==="string"&&!V.toLowerCase().includes("base64,"))return console.error("ERROR: Image `data` value lacks a base64 header! Ex: 'image/png;base64,NMP[...]')"),null;let M=(U.substring(U.lastIndexOf("/")+1).split("?")[0].split(".").pop().split("#")[0]||"png").toLowerCase();if(V&&/image\/(\w+);/.exec(V)&&/image\/(\w+);/.exec(V).length>0)M=/image\/(\w+);/.exec(V)[1];else if(V===null||V===void 0?void 0:V.toLowerCase().includes("image/svg+xml"))M="svg";if(Q._type=D0.image,Q.image=U||"preencoded.png",Q.options={x:K||0,y:J||0,w:Z||1,h:G||1,altText:q.altText||"",rounding:typeof q.rounding==="boolean"?q.rounding:!1,sizing:W,placeholder:q.placeholder,rotate:q.rotate||0,flipV:q.flipV||!1,flipH:q.flipH||!1,transparency:q.transparency||0,objectName:F,shadow:b7(q.shadow)},M==="svg")$._relsMedia.push({path:U||V+"png",type:"image/png",extn:"png",data:V||"",rId:w,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`,isSvgPng:!0,svgSize:{w:H0(Q.options.w,"X",$._presLayout),h:H0(Q.options.h,"Y",$._presLayout)}}),Q.imageRid=w,$._relsMedia.push({path:U||V,type:"image/svg+xml",extn:M,data:V||"",rId:w+1,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w+1;else{let k=$._relsMedia.filter((f)=>f.path&&f.path===U&&f.type==="image/"+M&&!f.isDuplicate)[0];$._relsMedia.push({path:U||"preencoded."+M,type:"image/"+M,extn:M,data:V||"",rId:w,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w}if(typeof B==="object")if(!B.url&&!B.slide)throw Error("ERROR: `hyperlink` option requires either: `url` or `slide`");else w++,$._rels.push({type:D0.hyperlink,data:B.slide?"slide":"dummy",rId:w,Target:B.url||B.slide.toString()}),B._rId=w,Q.hyperlink=B;$._slideObjects.push(Q)}function OB($,q){let Q=q.x||0,K=q.y||0,J=q.w||2,Z=q.h||2,G=q.data||"",W=q.link||"",B=q.path||"",V=q.type||"audio",U="",w=q.cover||gB,F=q.objectName?k0(q.objectName):`Media ${$._slideObjects.filter((k)=>k._type===D0.media).length}`,M={_type:D0.media};if(!B&&!G&&V!=="online")throw Error("addMedia() error: either `data` or `path` are required!");else if(G&&!G.toLowerCase().includes("base64,"))throw Error("addMedia() error: `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')");else if(!w.toLowerCase().includes("base64,"))throw Error("addMedia() error: `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')");if(V==="online"&&!W)throw Error("addMedia() error: online videos require `link` value");if(U=q.extn||(G?G.split(";")[0].split("/")[1]:B.split(".").pop())||"mp3",M.mtype=V,M.media=B||"preencoded.mov",M.options={},M.options.x=Q,M.options.y=K,M.options.w=J,M.options.h=Z,M.options.objectName=F,V==="online"){let k=a2($);$._relsMedia.push({path:B||"preencoded"+U,data:"dummy",type:"online",extn:U,rId:k,Target:W}),M.mediaRid=k,$._relsMedia.push({path:"preencoded.png",data:w,type:"image/png",extn:"png",rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}else{let k=$._relsMedia.filter((L)=>L.path&&L.path===B&&L.type===V+"/"+U&&!L.isDuplicate)[0],f=a2($);$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:f,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+1}.${U}`}),M.mediaRid=f,$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:a2($),isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+0}.${U}`}),$._relsMedia.push({path:"preencoded.png",type:"image/png",extn:"png",data:w,rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}$._slideObjects.push(M)}function PB($,q){$._slideObjects.push({_type:D0.notes,text:[{text:q}]})}function _7($,q,Q){let K=typeof Q==="object"?Q:{};K.line=K.line||{type:"none"};let J={_type:D0.text,shape:q||B1.RECTANGLE,options:K,text:null};if(!q)throw Error("Missing/Invalid shape parameter! Example: `addShape(pptxgen.shapes.LINE, {x:1, y:1, w:1, h:1});`");let Z={type:K.line.type||"solid",color:K.line.color||VJ,transparency:K.line.transparency||0,width:K.line.width||1,dashType:K.line.dashType||"solid",beginArrowType:K.line.beginArrowType||null,endArrowType:K.line.endArrowType||null};if(typeof K.line==="object"&&K.line.type!=="none")K.line=Z;if(K.x=K.x||(K.x===0?0:1),K.y=K.y||(K.y===0?0:1),K.w=K.w||(K.w===0?0:1),K.h=K.h||(K.h===0?0:1),K.objectName=K.objectName?k0(K.objectName):`Shape ${$._slideObjects.filter((G)=>G._type===D0.text).length}`,typeof K.line==="string"){let G=Z;G.color=String(K.line),K.line=G}if(typeof K.lineSize==="number")K.line.width=K.lineSize;if(typeof K.lineDash==="string")K.line.dashType=K.lineDash;if(typeof K.lineHead==="string")K.line.beginArrowType=K.lineHead;if(typeof K.lineTail==="string")K.line.endArrowType=K.lineTail;g6($,J),$._slideObjects.push(J)}function TB($,q,Q,K,J,Z,G){let W=[$],B=Q&&typeof Q==="object"?Q:{};B.objectName=B.objectName?k0(B.objectName):`Table ${$._slideObjects.filter((F)=>F._type===D0.table).length}`;{if(q===null||q.length===0||!Array.isArray(q))throw Error("addTable: Array expected! EX: 'slide.addTable( [rows], {options} );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)");if(!q[0]||!Array.isArray(q[0]))throw Error("addTable: 'rows' should be an array of cells! EX: 'slide.addTable( [ ['A'], ['B'], {text:'C',options:{align:'center'}} ] );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)")}let V=[];if(q.forEach((F)=>{let M=[];if(Array.isArray(F))F.forEach((k)=>{let f={_type:D0.tablecell,text:"",options:typeof k==="object"&&k.options?k.options:{}};if(typeof k==="string"||typeof k==="number")f.text=k.toString();else if(k.text){if(typeof k.text==="string"||typeof k.text==="number")f.text=k.text.toString();else if(k.text)f.text=k.text;if(k.options&&typeof k.options==="object")f.options=k.options}f.options.border=f.options.border||B.border||[{type:"none"},{type:"none"},{type:"none"},{type:"none"}];let L=f.options.border;if(!Array.isArray(L)&&typeof L==="object")f.options.border=[L,L,L,L];if(!f.options.border[0])f.options.border[0]={type:"none"};if(!f.options.border[1])f.options.border[1]={type:"none"};if(!f.options.border[2])f.options.border[2]={type:"none"};if(!f.options.border[3])f.options.border[3]={type:"none"};[0,1,2,3].forEach((z)=>{f.options.border[z]={type:f.options.border[z].type||H6.type,color:f.options.border[z].color||H6.color,pt:typeof f.options.border[z].pt==="number"?f.options.border[z].pt:H6.pt}}),M.push(f)});else console.log("addTable: tableRows has a bad row. A row should be an array of cells. You provided:"),console.log(F);V.push(M)}),B.x=H0(B.x||(B.x===0?0:L0/2),"X",J),B.y=H0(B.y||(B.y===0?0:L0/2),"Y",J),B.h)B.h=H0(B.h,"Y",J);if(B.fontSize=B.fontSize||k2,B.margin=B.margin===0||B.margin?B.margin:JJ,typeof B.margin==="number")B.margin=[Number(B.margin),Number(B.margin),Number(B.margin),Number(B.margin)];if(JSON.stringify({arrRows:V}).indexOf("hyperlink")===-1){if(!B.color)B.color=B.color||Q2}if(typeof B.border==="string")console.warn("addTable `border` option must be an object. Ex: `{border: {type:'none'}}`"),B.border=null;else if(Array.isArray(B.border))[0,1,2,3].forEach((F)=>{B.border[F]=B.border[F]?{type:B.border[F].type||H6.type,color:B.border[F].color||H6.color,pt:B.border[F].pt||H6.pt}:{type:"none"}});if(B.autoPage=typeof B.autoPage==="boolean"?B.autoPage:!1,B.autoPageRepeatHeader=typeof B.autoPageRepeatHeader==="boolean"?B.autoPageRepeatHeader:!1,B.autoPageHeaderRows=typeof B.autoPageHeaderRows<"u"&&!isNaN(Number(B.autoPageHeaderRows))?Number(B.autoPageHeaderRows):1,B.autoPageLineWeight=typeof B.autoPageLineWeight<"u"&&!isNaN(Number(B.autoPageLineWeight))?Number(B.autoPageLineWeight):0,B.autoPageLineWeight){if(B.autoPageLineWeight>1)B.autoPageLineWeight=1;else if(B.autoPageLineWeight<-1)B.autoPageLineWeight=-1}let U=M8;if(K&&typeof K._margin<"u"){if(Array.isArray(K._margin))U=K._margin;else if(!isNaN(Number(K._margin)))U=[Number(K._margin),Number(K._margin),Number(K._margin),Number(K._margin)]}if(B.colW){let F=V[0].reduce((M,k)=>{var f;if(((f=k===null||k===void 0?void 0:k.options)===null||f===void 0?void 0:f.colspan)&&typeof k.options.colspan==="number")M+=k.options.colspan;else M+=1;return M},0);if(typeof B.colW==="string"||typeof B.colW==="number")B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length===1&&F>1)B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length!==F)console.warn("addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths."),B.colW=null}else if(B.w)B.w=H0(B.w,"X",J);else B.w=Math.floor(J._sizeW/L0-U[1]-U[3]);if(B.x&&B.x<20)B.x=v0(B.x);if(B.y&&B.y<20)B.y=v0(B.y);if(B.w&&typeof B.w==="number"&&B.w<20)B.w=v0(B.w);if(B.h&&typeof B.h==="number"&&B.h<20)B.h=v0(B.h);V.forEach((F)=>{F.forEach((M,k)=>{if(typeof M==="number"||typeof M==="string")F[k]={_type:D0.tablecell,text:String(F[k]),options:B};else if(typeof M==="object"){if(typeof M.text==="number")F[k].text=F[k].text.toString();else if(typeof M.text>"u"||M.text===null)F[k].text="";F[k].options=M.options||{},F[k]._type=D0.tablecell}})});let w=[];if(B&&!B.autoPage)g6($,V),$._slideObjects.push({_type:D0.table,arrTabRows:V,options:Object.assign({},B)});else{if(B.autoPageRepeatHeader)B._arrObjTabHeadRows=V.filter((F,M)=>M{if(!G($._slideNum+M))W.push(Z({masterName:(K===null||K===void 0?void 0:K._name)||null}));if(M>0)B.y=v0(B.autoPageSlideStartY||B.newSlideStartY||U[0]);{let k=G($._slideNum+M);if(B.autoPage=!1,g6(k,F.rows),k.addTable(F.rows,Object.assign({},B)),M>0)w.push(k)}})}return w}function H5($,q,Q,K){let J={_type:K?D0.placeholder:D0.text,shape:(Q===null||Q===void 0?void 0:Q.shape)||B1.RECTANGLE,text:!q||q.length===0?[{text:"",options:null}]:q,options:Q||{}};function Z(G){{if(!G.placeholder)G.color=G.color||J.options.color||$.color||Q2;if(G.placeholder||K)G.bullet=G.bullet||!1;if(G.placeholder&&$._slideLayout&&$._slideLayout._slideObjects){let W=$._slideLayout._slideObjects.filter((B)=>B._type==="placeholder"&&B.options&&B.options.placeholder&&B.options.placeholder===G.placeholder)[0];if(W===null||W===void 0?void 0:W.options)G=Object.assign(Object.assign({},G),W.options)}if(G.objectName=G.objectName?k0(G.objectName):`Text ${$._slideObjects.filter((W)=>W._type===D0.text).length}`,G.shape===B1.LINE){let W={type:G.line.type||"solid",color:G.line.color||VJ,transparency:G.line.transparency||0,width:G.line.width||1,dashType:G.line.dashType||"solid",beginArrowType:G.line.beginArrowType||null,endArrowType:G.line.endArrowType||null};if(typeof G.line==="object")G.line=W;if(typeof G.line==="string"){let B=W;if(typeof G.line==="string")B.color=G.line;G.line=B}if(typeof G.lineSize==="number")G.line.width=G.lineSize;if(typeof G.lineDash==="string")G.line.dashType=G.lineDash;if(typeof G.lineHead==="string")G.line.beginArrowType=G.lineHead;if(typeof G.lineTail==="string")G.line.endArrowType=G.lineTail}if(G.line=G.line||{},G.lineSpacing=G.lineSpacing&&!isNaN(G.lineSpacing)?G.lineSpacing:null,G.lineSpacingMultiple=G.lineSpacingMultiple&&!isNaN(G.lineSpacingMultiple)?G.lineSpacingMultiple:null,G._bodyProp=G._bodyProp||{},G._bodyProp.autoFit=G.autoFit||!1,G._bodyProp.anchor=!G.placeholder?I6.ctr:null,G._bodyProp.vert=G.vert||null,G._bodyProp.wrap=typeof G.wrap==="boolean"?G.wrap:!0,G.inset&&!isNaN(Number(G.inset))||G.inset===0)G._bodyProp.lIns=v0(G.inset),G._bodyProp.rIns=v0(G.inset),G._bodyProp.tIns=v0(G.inset),G._bodyProp.bIns=v0(G.inset);if(typeof G.underline==="boolean"&&G.underline===!0)G.underline={style:"sng"}}{if((G.align||"").toLowerCase().indexOf("c")===0)G._bodyProp.align=R6.center;else if((G.align||"").toLowerCase().indexOf("l")===0)G._bodyProp.align=R6.left;else if((G.align||"").toLowerCase().indexOf("r")===0)G._bodyProp.align=R6.right;else if((G.align||"").toLowerCase().indexOf("j")===0)G._bodyProp.align=R6.justify;if((G.valign||"").toLowerCase().indexOf("b")===0)G._bodyProp.anchor=I6.b;else if((G.valign||"").toLowerCase().indexOf("m")===0)G._bodyProp.anchor=I6.ctr;else if((G.valign||"").toLowerCase().indexOf("t")===0)G._bodyProp.anchor=I6.t}return b7(G.shadow),G}J.options=Z(J.options),J.text.forEach((G)=>G.options=Z(G.options||{})),g6($,J.text||""),$._slideObjects.push(J)}function uB($){($._slideLayout._slideObjects||[]).forEach((q)=>{if(q._type===D0.placeholder){if($._slideObjects.filter((Q)=>Q.options&&Q.options.placeholder===q.options.placeholder).length===0)H5($,[{text:""}],q.options,!1)}})}function zJ($,q){var Q;if(q.bkgd){if(!q.background)q.background={};if(typeof q.bkgd==="string")q.background.color=q.bkgd;else{if(q.bkgd.data)q.background.data=q.bkgd.data;if(q.bkgd.path)q.background.path=q.bkgd.path;if(q.bkgd.src)q.background.path=q.bkgd.src}}if((Q=q.background)===null||Q===void 0?void 0:Q.fill)q.background.color=q.background.fill;if($&&($.path||$.data)){$.path=$.path||"preencoded.png";let K=($.path.split(".").pop()||"png").split("?")[0];if(K==="jpg")K="jpeg";q._relsMedia=q._relsMedia||[];let J=q._relsMedia.length+1;q._relsMedia.push({path:$.path,type:D0.image,extn:K,data:$.data||null,rId:J,Target:`../media/${(q._name||"").replace(/\s+/gi,"-")}-image-${q._relsMedia.length+1}.${K}`}),q._bkgdImgRid=J}}function g6($,q,Q){let K=[];if(typeof q==="string"||typeof q==="number")return;else if(Array.isArray(q))K=q;else if(typeof q==="object")K=[q];K.forEach((J,Z)=>{if(Q&&Q[Z]&&Q[Z].hyperlink)J.options=Object.assign(Object.assign({},J.options),Q[Z]);if(Array.isArray(J)){let G=[];J.forEach((W)=>{if(W.options&&!W.text.options)G.push(W.options)}),g6($,J,G)}else if(Array.isArray(J.text))g6($,J.text,Q&&Q[Z]?[Q[Z]]:void 0);else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&!J.options.hyperlink._rId)if(typeof J.options.hyperlink!=="object")console.log("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:'https://github.com'}` ");else if(!J.options.hyperlink.url&&!J.options.hyperlink.slide)console.log("ERROR: 'hyperlink requires either: `url` or `slide`'");else{let G=a2($);$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:G,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()}),J.options.hyperlink._rId=G}else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&J.options.hyperlink._rId){if($._rels.filter((G)=>G.rId===J.options.hyperlink._rId).length===0)$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:J.options.hyperlink._rId,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()})}})}class FJ{constructor($){var q;this.addSlide=$.addSlide,this.getSlide=$.getSlide,this._name=`Slide ${$.slideNumber}`,this._presLayout=$.presLayout,this._rId=$.slideRId,this._rels=[],this._relsChart=[],this._relsMedia=[],this._setSlideNum=$.setSlideNum,this._slideId=$.slideId,this._slideLayout=$.slideLayout||null,this._slideNum=$.slideNumber,this._slideObjects=[],this._slideNumberProps=((q=this._slideLayout)===null||q===void 0?void 0:q._slideNumberProps)?this._slideLayout._slideNumberProps:null}set bkgd($){if(this._bkgd=$,!this._background||!this._background.color){if(!this._background)this._background={};if(typeof $==="string")this._background.color=$}}get bkgd(){return this._bkgd}set background($){if(this._background=$,$)zJ($,this)}get background(){return this._background}set color($){this._color=$}get color(){return this._color}set hidden($){this._hidden=$}get hidden(){return this._hidden}set slideNumber($){this._slideNumberProps=$,this._setSlideNum($)}get slideNumber(){return this._slideNumberProps}get newAutoPagedSlides(){return this._newAutoPagedSlides}addChart($,q,Q){let K=Q||{};return K._type=$,WJ(this,$,q,Q),this}addImage($){return BJ(this,$),this}addMedia($){return OB(this,$),this}addNotes($){return PB(this,$),this}addShape($,q){return _7(this,$,q),this}addTable($,q){return this._newAutoPagedSlides=TB(this,$,q,this._slideLayout,this._presLayout,this.addSlide,this.getSlide),this}addText($,q){return H5(this,typeof $==="string"||typeof $==="number"?[{text:$,options:q}]:$,q,!1),this}}function SB($,q){return W2(this,void 0,void 0,function*(){let Q=$.data;return yield new Promise((K,J)=>{var Z,G;let W=new c7.default,B=(Q.length-1)*2+1,V=((G=(Z=Q[0])===null||Z===void 0?void 0:Z.labels)===null||G===void 0?void 0:G.length)>1;W.folder("_rels"),W.folder("docProps"),W.folder("xl/_rels"),W.folder("xl/tables"),W.folder("xl/theme"),W.folder("xl/worksheets"),W.folder("xl/worksheets/_rels"),W.file("[Content_Types].xml",' \n'),W.file("_rels/.rels",` `),W.file("docProps/app.xml",`Microsoft Macintosh Excel0falseWorksheets1Sheet1falsefalsefalse16.0300 `),W.file("docProps/core.xml",'PptxGenJSPptxGenJS'+new Date().toISOString()+''+new Date().toISOString()+""),W.file("xl/_rels/workbook.xml.rels",''),W.file("xl/styles.xml",'\n'),W.file("xl/theme/theme1.xml",''),W.file("xl/workbook.xml",` `),W.file("xl/worksheets/_rels/sheet1.xml.rels",` `);{let U='';if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)U+=``;else if($.opts._type===q0.SCATTER)U+=``;else if(V){let w=Q.length;Q[0].labels.forEach((F)=>w+=F.filter((M)=>M&&M!=="").length),U+=``,U+=""}else{let w=Q.length+Q[0].labels.length*Q[0].labels[0].length+Q[0].labels.length,F=Q.length+Q[0].labels.length*Q[0].labels[0].length+1;U+=``,U+=''}if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)Q.forEach((w,F)=>{if(F===0)U+="X-Axis";else U+=`${k0(w.name||`Y-Axis${F}`)}`,U+=`${k0(`Size${F}`)}`});else Q.forEach((w)=>{U+=`${k0((w.name||" ").replace("X-Axis","X-Values"))}`});if($.opts._type!==q0.BUBBLE&&$.opts._type!==q0.BUBBLE3D&&$.opts._type!==q0.SCATTER)Q[0].labels.slice().reverse().forEach((w)=>{w.filter((F)=>F&&F!=="").forEach((F)=>{U+=`${k0(F)}`})});U+=` `,W.file("xl/sharedStrings.xml",U)}{let U='';if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D){U+=``,U+=``;let w=1;Q.forEach((F,M)=>{if(M===0)U+=``;else U+=``,w++,U+=``})}else if($.opts._type===q0.SCATTER)U+=`
`,U+=``,Q.forEach((w,F)=>{U+=``});else U+=`
`,U+=``,Q[0].labels.forEach((w,F)=>{U+=``}),Q.forEach((w,F)=>{U+=``});U+="",U+='',U+="
",W.file("xl/tables/table1.xml",U)}{let U='';if(U+='',$.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)U+=``;else if($.opts._type===q0.SCATTER)U+=``;else U+=``;if(U+='',U+='',$.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D){U+="",U+=``,U+='0';for(let w=1;w${w}
`;U+="",Q[0].values.forEach((w,F)=>{U+=``,U+=`${w}`;let M=2;for(let k=1;k${Q[k].values[F]||""}
`,M++,U+=`${Q[k].sizes[F]||""}`,M++;U+=""})}else if($.opts._type===q0.SCATTER){U+="",U+=``;for(let w=0;w${w}
`;U+="",Q[0].values.forEach((w,F)=>{U+=``,U+=`${w}`;for(let M=1;M${Q[M].values[F]||Q[M].values[F]===0?Q[M].values[F]:""}
`;U+=""})}else if(U+="",!V){U+=``,Q[0].labels.forEach((w,F)=>{U+=`0`});for(let w=0;w${w+1}
`;U+="",Q[0].labels[0].forEach((w,F)=>{U+=``;for(let M=Q[0].labels.length-1;M>=0;M--)U+=``,U+=`${Q.length+F+1}`,U+="";for(let M=0;M${Q[M].values[F]||""}
`;U+=""})}else{U+=``;for(let k=0;k0`;for(let k=Q[0].labels.length-1;k${k}`;U+="";let w=Q.length,F=Q[0].labels[0].length,M=Q[0].labels.length;for(let k=0;k`;let f=w,L=Q[0].labels.slice().reverse();L.forEach((D,z)=>{if(D[k]){let H=z===0?1:L[z-1].filter((v)=>v&&v!=="").length;f+=H,U+=`${f}`}});for(let D=0;D${Q[D].values[k]||0}`;U+=""}}U+="",U+='',U+=` -`,W.file("xl/worksheets/sheet1.xml",U)}W.generateAsync({type:"base64"}).then((U)=>{q.file(`ppt/embeddings/Microsoft_Excel_Worksheet${$.globalId}.xlsx`,U,{base64:!0}),q.file("ppt/charts/_rels/"+$.fileName+".rels",``),q.file(`ppt/charts/${$.fileName}`,xB($)),K("")}).catch((U)=>{J(U)})})})}function xB($){var q,Q,K,J;let Z='',G=!1;{if(Z+='',Z+='',Z+=``,Z+="",$.opts.showTitle)Z+=v5({title:$.opts.title||"Chart Title",color:$.opts.titleColor,fontFace:$.opts.titleFontFace,fontSize:$.opts.titleFontSize||DB,titleAlign:$.opts.titleAlign,titleBold:$.opts.titleBold,titlePos:$.opts.titlePos,titleRotate:$.opts.titleRotate},$.opts.x,$.opts.y),Z+='';else Z+='';if($.opts._type===q0.BAR3D)Z+=``;if(Z+="",$.opts.layout)Z+="",Z+=" ",Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+="";else Z+=""}if(Array.isArray($.opts._type))$.opts._type.forEach((W)=>{let B=Object.assign(Object.assign({},$.opts),W.options),V=B.secondaryValAxis?Y5:o2,U=B.secondaryCatAxis?O7:B8;G=G||B.secondaryValAxis,Z+=$J(W.type,W.data,B,V,U)});else Z+=$J($.opts._type,$.data,$.opts,o2,B8);if($.opts._type!==q0.PIE&&$.opts._type!==q0.DOUGHNUT){if($.opts.valAxes&&$.opts.valAxes.length>1&&!G)throw Error("Secondary axis must be used by one of the multiple charts");if($.opts.catAxes){if(!$.opts.valAxes||$.opts.valAxes.length!==$.opts.catAxes.length)throw Error("There must be the same number of value and category axes.");Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[0]),B8,o2)}else Z+=X7($.opts,B8,o2);if($.opts.valAxes){if(Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[0]),o2),$.opts.valAxes[1])Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[1]),Y5)}else if(Z+=y7($.opts,o2),$.opts._type===q0.BAR3D)Z+=OB($.opts,UJ,o2);if(((q=$.opts)===null||q===void 0?void 0:q.catAxes)&&((Q=$.opts)===null||Q===void 0?void 0:Q.catAxes[1]))Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[1]),O7,Y5)}{if($.opts.showDataTable)Z+="",Z+=` `,Z+=` `,Z+=` `,Z+=` `,Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=` `,Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+="";if(Z+=" ",Z+=((K=$.opts.plotArea.fill)===null||K===void 0?void 0:K.color)?B2($.opts.plotArea.fill):"",Z+=$.opts.plotArea.border?`${B2($.opts.plotArea.border.color)}`:"",Z+=" ",Z+=" ",Z+="",$.opts.showLegend){if(Z+="",Z+='',Z+='',$.opts.legendFontFace||$.opts.legendFontSize||$.opts.legendColor){if(Z+="",Z+=" ",Z+=" ",Z+=" ",Z+=" ",Z+=$.opts.legendFontSize?``:"",$.opts.legendColor)Z+=B2($.opts.legendColor);if($.opts.legendFontFace)Z+='';if($.opts.legendFontFace)Z+='';Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=""}Z+=""}}if(Z+=' ',Z+=' ',$.opts._type===q0.SCATTER)Z+='';return Z+="",Z+="",Z+=((J=$.opts.chartArea.fill)===null||J===void 0?void 0:J.color)?B2($.opts.chartArea.fill):"",Z+=$.opts.chartArea.border?`${B2($.opts.chartArea.border.color)}`:"",Z+=" ",Z+="",Z+='',Z+="",Z}function $J($,q,Q,K,J,Z){let G=-1,W=1,B=null,V="";switch($){case q0.AREA:case q0.BAR:case q0.BAR3D:case q0.LINE:case q0.RADAR:if(V+=``,$===q0.AREA&&Q.barGrouping==="stacked")V+='';if($===q0.BAR||$===q0.BAR3D)V+='',V+='';if($===q0.RADAR)V+='';V+='',q.forEach((U)=>{var w;G++,V+="",V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(U._dataIndex+U.labels.length+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";let F=Q.chartColors?Q.chartColors[G%Q.chartColors.length]:null;if(V+=" ",F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,``)+"";else V+=""+R0(F)+"";if($===q0.LINE||$===q0.RADAR)if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+='';else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;if(V+=T1(Q.shadow,P1),V+=" ",V+=' ',$!==q0.RADAR){if(V+="",V+=``,Q.dataLabelBkgrdColors)V+=`${R0(F)}`;if(V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+=``,V+=""}if($===q0.LINE||$===q0.RADAR){if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+=" ",V+=` ${R0(Q.chartColors[U._dataIndex+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):U._dataIndex])}`,V+=` ${R0(Q.lineDataSymbolLineColor||F)}`,V+=" ",V+=" ",V+=""}if(($===q0.BAR||$===q0.BAR3D)&&q.length===1&&(Q.chartColors&&Q.chartColors!==z8&&Q.chartColors.length>1||((w=Q.invertedColors)===null||w===void 0?void 0:w.length)))U.values.forEach((M,k)=>{let f=M<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else if($===q0.BAR)V+="",V+=' ',V+="";else V+="",V+=" ",V+=' ',V+=" ",V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});{if(V+="",Q.catLabelFormatCode)V+=" ",V+=` Sheet1!$A$2:$A$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.catLabelFormatCode||"General")+"",V+=` `,U.labels[0].forEach((M,k)=>V+=`${k0(M)}`),V+=" ",V+=" ";else V+=" ",V+=` Sheet1!$A$2:$${j0(U.labels.length)}$${U.labels[0].length+1}`,V+=" ",V+=` `,U.labels.forEach((M)=>{V+="",M.forEach((k,f)=>V+=`${k0(k)}`),V+=""}),V+=" ",V+=" ";V+=""}if(V+="",V+=" ",V+=`Sheet1!$${j0(U._dataIndex+U.labels.length+1)}$2:$${j0(U._dataIndex+U.labels.length+1)}$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.valLabelFormatCode||Q.dataTableFormatCode||"General")+"",V+=` `,U.values.forEach((M,k)=>V+=`${M||M===0?M:""}`),V+=" ",V+=" ",V+="",$===q0.LINE)V+='';V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+=" "}if($===q0.BAR)V+=` `,V+=` `;else if($===q0.BAR3D)V+=` `,V+=` `,V+=' ';else if($===q0.LINE)V+=' ';V+=``,V+=``;break;case q0.SCATTER:V+="",V+='',V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=` Sheet1!$${j0(w+2)}$1`,V+=' '+k0(U.name)+"",V+=" ",V+=" ",V+=" ";{let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,'')+"";else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1)}V+=" ";{if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+="",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,V+=`${R0(Q.lineDataSymbolLineColor||Q.chartColors[G%Q.chartColors.length])}`,V+="",V+="",V+=""}if(Q.showLabel){let F=k5("-xxxx-xxxx-xxxx-xxxxxxxxxxxx");if(U.labels[0]&&(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"))V+="",U.labels[0].forEach((M,k)=>{if(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"){if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" "+k0(M)+"",V+=" ",Q.dataLabelFormatScatter==="customXY"&&!/^ *$/.test(M))V+=" ",V+=' ',V+=" (",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"",V+=" ",V+=" ",V+=' ',V+=" , ",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"]",V+=" ",V+=" ",V+=' ',V+=" )",V+=" ",V+=' ';if(V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=` `,V+=" ",V+=" ",V+=""}}),V+="";if(Q.dataLabelFormatScatter==="XY"){if(V+="",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=` `,V+=` `,V+=` `,V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=""}}if(q.length===1&&Q.chartColors!==z8)U.values.forEach((F,M)=>{let k=F<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else V+="",V+=' ',V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=` Sheet1!$${j0(w+2)}$2:$${j0(w+2)}$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+='',V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}V+=``,V+="";break;case q0.BUBBLE:case q0.BUBBLE3D:V+="",V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(W+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";{V+="";let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=`${R0(F,'')}`;else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1),V+=""}V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${q[0].values.length+1}`,W++,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${U.sizes.length+1}`,W++,V+=" ",V+=" General",V+=` `,U.sizes.forEach((F,M)=>{V+=`${F||""}`}),V+=" ",V+=" ",V+=" ",V+=' ',V+=""});{if(V+="",V+=``,V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+="",V+=' ',V+=' ',V+=" ",V+="",V+=""}V+=``,V+="";break;case q0.DOUGHNUT:case q0.PIE:if(B=q[0],V+="",V+=' ',V+="",V+=' ',V+=' ',V+=" ",V+=" ",V+=" Sheet1!$B$1",V+=" ",V+=' ',V+=' '+k0(B.name)+"",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=' ',Q.dataNoEffects)V+="";else V+=T1(Q.shadow,P1);if(V+=" ",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=' ',V+=" ",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;V+=T1(Q.shadow,P1),V+=" ",V+=""}),V+="",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=` `,V+=" ",V+=" ",V+=" ",$===q0.PIE&&Q.dataLabelPosition)V+=``;V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}),V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=' ',V+=" ",V+=" ",V+=" ",V+=" ",V+=$===q0.PIE?'':"",V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+="",V+="",V+=" ",V+=` Sheet1!$A$2:$A$${B.labels[0].length+1}`,V+=" ",V+=` `,B.labels[0].forEach((U,w)=>{V+=`${k0(U)}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=` Sheet1!$B$2:$B$${B.labels[0].length+1}`,V+=" ",V+=` `,B.values.forEach((U,w)=>{V+=`${U||U===0?U:""}`}),V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,$===q0.DOUGHNUT)V+=``;V+="";break;default:V+="";break}return V}function X7($,q,Q){let K="";if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";if(K+=' ',K+=" ",K+='',$.catAxisMaxVal||$.catAxisMaxVal===0)K+=``;if($.catAxisMinVal||$.catAxisMinVal===0)K+=``;if(K+="",K+=' ',K+=' ',K+=$.catGridLine.style!=="none"?n7($.catGridLine):"",$.showCatAxisTitle)K+=v5({color:$.catAxisTitleColor,fontFace:$.catAxisTitleFontFace,fontSize:$.catAxisTitleFontSize,titleRotate:$.catAxisTitleRotate,title:$.catAxisTitle||"Axis Title"});if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+=' ';else K+=' ';if($._type===q0.SCATTER)K+=' ',K+=' ',K+=' ';else K+=' ',K+=' ',K+=' ';if(K+=" ",K+=` `,K+=!$.catAxisLineShow?"":""+R0($.catAxisLineColor||u1.color)+"",K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",$.catAxisLabelRotate)K+=``;else K+="";if(K+=" ",K+=" ",K+=" ",K+=` `,K+=" "+R0($.catAxisLabelColor||Q2)+"",K+=' ',K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=` `,K+=' ',K+=' ',K+=` `,$.catAxisLabelFrequency)K+=' ';if($.catLabelFormatCode||$._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D){if($.catLabelFormatCode){if(["catAxisBaseTimeUnit","catAxisMajorTimeUnit","catAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes($[J].toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.catAxisBaseTimeUnit)K+='';if($.catAxisMajorTimeUnit)K+='';if($.catAxisMinorTimeUnit)K+=''}if($.catAxisMajorUnit)K+=``;if($.catAxisMinorUnit)K+=``}if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";return K}function y7($,q){let Q=q===o2?$.barDir==="col"?"l":"b":$.barDir!=="col"?"r":"t";if(q===Y5)Q="r";let K=q===o2?B8:O7,J="";if(J+="",J+=' ',J+=" ",$.valAxisLogScaleBase)J+=``;if(J+='',$.valAxisMaxVal||$.valAxisMaxVal===0)J+=``;if($.valAxisMinVal||$.valAxisMinVal===0)J+=``;if(J+=" ",J+=` `,J+=' ',$.valGridLine.style!=="none")J+=n7($.valGridLine);if($.showValAxisTitle)J+=v5({color:$.valAxisTitleColor,fontFace:$.valAxisTitleFontFace,fontSize:$.valAxisTitleFontSize,titleRotate:$.valAxisTitleRotate,title:$.valAxisTitle||"Axis Title"});if(J+=``,$._type===q0.SCATTER)J+=' ',J+=' ',J+=' ';else J+=' ',J+=' ',J+=' ';if(J+=" ",J+=` `,J+=!$.valAxisLineShow?"":""+R0($.valAxisLineColor||u1.color)+"",J+=' ',J+=" ",J+=" ",J+=" ",J+=" ",J+=` `,J+=" ",J+=" ",J+=" ",J+=` `,J+=" "+R0($.valAxisLabelColor||Q2)+"",J+=' ',J+=" ",J+=" ",J+=' ',J+=" ",J+=" ",J+=' ',typeof $.catAxisCrossesAt==="number")J+=` `;else if(typeof $.catAxisCrossesAt==="string")J+=' ';else J+=' ';if(J+=' ',$.valAxisMajorUnit)J+=` `;if($.valAxisDisplayUnit)J+=`${$.valAxisDisplayUnitLabel?"":""}`;return J+="",J}function OB($,q,Q){let K="";if(K+="",K+=' ',K+=' ',K+=' ',K+=' ',K+=$.serGridLine.style!=="none"?n7($.serGridLine):"",$.showSerAxisTitle)K+=v5({color:$.serAxisTitleColor,fontFace:$.serAxisTitleFontFace,fontSize:$.serAxisTitleFontSize,titleRotate:$.serAxisTitleRotate,title:$.serAxisTitle||"Axis Title"});if(K+=` `,K+=' ',K+=' ',K+=` `,K+=" ",K+=' ',K+=!$.serAxisLineShow?"":`${R0($.serAxisLineColor||u1.color)}`,K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=` `,K+=` ${R0($.serAxisLabelColor||Q2)}`,K+=` `,K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=' ',$.serAxisLabelFrequency)K+=' ';if($.serLabelFormatCode){if(["serAxisBaseTimeUnit","serAxisMajorTimeUnit","serAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes(J.toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.serAxisBaseTimeUnit)K+=` `;if($.serAxisMajorTimeUnit)K+=` `;if($.serAxisMinorTimeUnit)K+=` `;if($.serAxisMajorUnit)K+=` `;if($.serAxisMinorUnit)K+=` `}return K+="",K}function v5($,q,Q){let K=$.titleAlign==="left"||$.titleAlign==="right"?``:"",J=$.titleRotate?``:"",Z=$.fontSize?`sz="${Math.round($.fontSize*100)}"`:"",G=$.titleBold?1:0,W="";if($.titlePos&&typeof $.titlePos.x==="number"&&typeof $.titlePos.y==="number"){let B=$.titlePos.x+q,V=$.titlePos.y+Q,U=B===0?0:B*(B/5)/10;if(U>=1)U=U/10;if(U>=0.1)U=U/10;let w=V===0?0:V*(V/5)/10;if(w>=1)w=w/10;if(w>=0.1)w=w/10;W=``}return` +`,W.file("xl/worksheets/sheet1.xml",U)}W.generateAsync({type:"base64"}).then((U)=>{q.file(`ppt/embeddings/Microsoft_Excel_Worksheet${$.globalId}.xlsx`,U,{base64:!0}),q.file("ppt/charts/_rels/"+$.fileName+".rels",``),q.file(`ppt/charts/${$.fileName}`,EB($)),K("")}).catch((U)=>{J(U)})})})}function EB($){var q,Q,K,J;let Z='',G=!1;{if(Z+='',Z+='',Z+=``,Z+="",$.opts.showTitle)Z+=v5({title:$.opts.title||"Chart Title",color:$.opts.titleColor,fontFace:$.opts.titleFontFace,fontSize:$.opts.titleFontSize||IB,titleAlign:$.opts.titleAlign,titleBold:$.opts.titleBold,titlePos:$.opts.titlePos,titleRotate:$.opts.titleRotate},$.opts.x,$.opts.y),Z+='';else Z+='';if($.opts._type===q0.BAR3D)Z+=``;if(Z+="",$.opts.layout)Z+="",Z+=" ",Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+="";else Z+=""}if(Array.isArray($.opts._type))$.opts._type.forEach((W)=>{let B=Object.assign(Object.assign({},$.opts),W.options),V=B.secondaryValAxis?Y5:o2,U=B.secondaryCatAxis?O7:B8;G=G||B.secondaryValAxis,Z+=$J(W.type,W.data,B,V,U)});else Z+=$J($.opts._type,$.data,$.opts,o2,B8);if($.opts._type!==q0.PIE&&$.opts._type!==q0.DOUGHNUT){if($.opts.valAxes&&$.opts.valAxes.length>1&&!G)throw Error("Secondary axis must be used by one of the multiple charts");if($.opts.catAxes){if(!$.opts.valAxes||$.opts.valAxes.length!==$.opts.catAxes.length)throw Error("There must be the same number of value and category axes.");Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[0]),B8,o2)}else Z+=X7($.opts,B8,o2);if($.opts.valAxes){if(Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[0]),o2),$.opts.valAxes[1])Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[1]),Y5)}else if(Z+=y7($.opts,o2),$.opts._type===q0.BAR3D)Z+=_B($.opts,UJ,o2);if(((q=$.opts)===null||q===void 0?void 0:q.catAxes)&&((Q=$.opts)===null||Q===void 0?void 0:Q.catAxes[1]))Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[1]),O7,Y5)}{if($.opts.showDataTable)Z+="",Z+=` `,Z+=` `,Z+=` `,Z+=` `,Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=` `,Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+="";if(Z+=" ",Z+=((K=$.opts.plotArea.fill)===null||K===void 0?void 0:K.color)?B2($.opts.plotArea.fill):"",Z+=$.opts.plotArea.border?`${B2($.opts.plotArea.border.color)}`:"",Z+=" ",Z+=" ",Z+="",$.opts.showLegend){if(Z+="",Z+='',Z+='',$.opts.legendFontFace||$.opts.legendFontSize||$.opts.legendColor){if(Z+="",Z+=" ",Z+=" ",Z+=" ",Z+=" ",Z+=$.opts.legendFontSize?``:"",$.opts.legendColor)Z+=B2($.opts.legendColor);if($.opts.legendFontFace)Z+='';if($.opts.legendFontFace)Z+='';Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=""}Z+=""}}if(Z+=' ',Z+=' ',$.opts._type===q0.SCATTER)Z+='';return Z+="",Z+="",Z+=((J=$.opts.chartArea.fill)===null||J===void 0?void 0:J.color)?B2($.opts.chartArea.fill):"",Z+=$.opts.chartArea.border?`${B2($.opts.chartArea.border.color)}`:"",Z+=" ",Z+="",Z+='',Z+="",Z}function $J($,q,Q,K,J,Z){let G=-1,W=1,B=null,V="";switch($){case q0.AREA:case q0.BAR:case q0.BAR3D:case q0.LINE:case q0.RADAR:if(V+=``,$===q0.AREA&&Q.barGrouping==="stacked")V+='';if($===q0.BAR||$===q0.BAR3D)V+='',V+='';if($===q0.RADAR)V+='';V+='',q.forEach((U)=>{var w;G++,V+="",V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(U._dataIndex+U.labels.length+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";let F=Q.chartColors?Q.chartColors[G%Q.chartColors.length]:null;if(V+=" ",F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,``)+"";else V+=""+R0(F)+"";if($===q0.LINE||$===q0.RADAR)if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+='';else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;if(V+=T1(Q.shadow,P1),V+=" ",V+=' ',$!==q0.RADAR){if(V+="",V+=``,Q.dataLabelBkgrdColors)V+=`${R0(F)}`;if(V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+=``,V+=""}if($===q0.LINE||$===q0.RADAR){if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+=" ",V+=` ${R0(Q.chartColors[U._dataIndex+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):U._dataIndex])}`,V+=` ${R0(Q.lineDataSymbolLineColor||F)}`,V+=" ",V+=" ",V+=""}if(($===q0.BAR||$===q0.BAR3D)&&q.length===1&&(Q.chartColors&&Q.chartColors!==z8&&Q.chartColors.length>1||((w=Q.invertedColors)===null||w===void 0?void 0:w.length)))U.values.forEach((M,k)=>{let f=M<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else if($===q0.BAR)V+="",V+=' ',V+="";else V+="",V+=" ",V+=' ',V+=" ",V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});{if(V+="",Q.catLabelFormatCode)V+=" ",V+=` Sheet1!$A$2:$A$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.catLabelFormatCode||"General")+"",V+=` `,U.labels[0].forEach((M,k)=>V+=`${k0(M)}`),V+=" ",V+=" ";else V+=" ",V+=` Sheet1!$A$2:$${j0(U.labels.length)}$${U.labels[0].length+1}`,V+=" ",V+=` `,U.labels.forEach((M)=>{V+="",M.forEach((k,f)=>V+=`${k0(k)}`),V+=""}),V+=" ",V+=" ";V+=""}if(V+="",V+=" ",V+=`Sheet1!$${j0(U._dataIndex+U.labels.length+1)}$2:$${j0(U._dataIndex+U.labels.length+1)}$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.valLabelFormatCode||Q.dataTableFormatCode||"General")+"",V+=` `,U.values.forEach((M,k)=>V+=`${M||M===0?M:""}`),V+=" ",V+=" ",V+="",$===q0.LINE)V+='';V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+=" "}if($===q0.BAR)V+=` `,V+=` `;else if($===q0.BAR3D)V+=` `,V+=` `,V+=' ';else if($===q0.LINE)V+=' ';V+=``,V+=``;break;case q0.SCATTER:V+="",V+='',V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=` Sheet1!$${j0(w+2)}$1`,V+=' '+k0(U.name)+"",V+=" ",V+=" ",V+=" ";{let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,'')+"";else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1)}V+=" ";{if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+="",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,V+=`${R0(Q.lineDataSymbolLineColor||Q.chartColors[G%Q.chartColors.length])}`,V+="",V+="",V+=""}if(Q.showLabel){let F=k5("-xxxx-xxxx-xxxx-xxxxxxxxxxxx");if(U.labels[0]&&(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"))V+="",U.labels[0].forEach((M,k)=>{if(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"){if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" "+k0(M)+"",V+=" ",Q.dataLabelFormatScatter==="customXY"&&!/^ *$/.test(M))V+=" ",V+=' ',V+=" (",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"",V+=" ",V+=" ",V+=' ',V+=" , ",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"]",V+=" ",V+=" ",V+=' ',V+=" )",V+=" ",V+=' ';if(V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=` `,V+=" ",V+=" ",V+=""}}),V+="";if(Q.dataLabelFormatScatter==="XY"){if(V+="",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=` `,V+=` `,V+=` `,V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=""}}if(q.length===1&&Q.chartColors!==z8)U.values.forEach((F,M)=>{let k=F<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else V+="",V+=' ',V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=` Sheet1!$${j0(w+2)}$2:$${j0(w+2)}$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+='',V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}V+=``,V+="";break;case q0.BUBBLE:case q0.BUBBLE3D:V+="",V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(W+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";{V+="";let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=`${R0(F,'')}`;else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1),V+=""}V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${q[0].values.length+1}`,W++,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${U.sizes.length+1}`,W++,V+=" ",V+=" General",V+=` `,U.sizes.forEach((F,M)=>{V+=`${F||""}`}),V+=" ",V+=" ",V+=" ",V+=' ',V+=""});{if(V+="",V+=``,V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+="",V+=' ',V+=' ',V+=" ",V+="",V+=""}V+=``,V+="";break;case q0.DOUGHNUT:case q0.PIE:if(B=q[0],V+="",V+=' ',V+="",V+=' ',V+=' ',V+=" ",V+=" ",V+=" Sheet1!$B$1",V+=" ",V+=' ',V+=' '+k0(B.name)+"",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=' ',Q.dataNoEffects)V+="";else V+=T1(Q.shadow,P1);if(V+=" ",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=' ',V+=" ",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;V+=T1(Q.shadow,P1),V+=" ",V+=""}),V+="",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=` `,V+=" ",V+=" ",V+=" ",$===q0.PIE&&Q.dataLabelPosition)V+=``;V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}),V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=' ',V+=" ",V+=" ",V+=" ",V+=" ",V+=$===q0.PIE?'':"",V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+="",V+="",V+=" ",V+=` Sheet1!$A$2:$A$${B.labels[0].length+1}`,V+=" ",V+=` `,B.labels[0].forEach((U,w)=>{V+=`${k0(U)}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=` Sheet1!$B$2:$B$${B.labels[0].length+1}`,V+=" ",V+=` `,B.values.forEach((U,w)=>{V+=`${U||U===0?U:""}`}),V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,$===q0.DOUGHNUT)V+=``;V+="";break;default:V+="";break}return V}function X7($,q,Q){let K="";if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";if(K+=' ',K+=" ",K+='',$.catAxisMaxVal||$.catAxisMaxVal===0)K+=``;if($.catAxisMinVal||$.catAxisMinVal===0)K+=``;if(K+="",K+=' ',K+=' ',K+=$.catGridLine.style!=="none"?n7($.catGridLine):"",$.showCatAxisTitle)K+=v5({color:$.catAxisTitleColor,fontFace:$.catAxisTitleFontFace,fontSize:$.catAxisTitleFontSize,titleRotate:$.catAxisTitleRotate,title:$.catAxisTitle||"Axis Title"});if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+=' ';else K+=' ';if($._type===q0.SCATTER)K+=' ',K+=' ',K+=' ';else K+=' ',K+=' ',K+=' ';if(K+=" ",K+=` `,K+=!$.catAxisLineShow?"":""+R0($.catAxisLineColor||u1.color)+"",K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",$.catAxisLabelRotate)K+=``;else K+="";if(K+=" ",K+=" ",K+=" ",K+=` `,K+=" "+R0($.catAxisLabelColor||Q2)+"",K+=' ',K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=` `,K+=' ',K+=' ',K+=` `,$.catAxisLabelFrequency)K+=' ';if($.catLabelFormatCode||$._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D){if($.catLabelFormatCode){if(["catAxisBaseTimeUnit","catAxisMajorTimeUnit","catAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes($[J].toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.catAxisBaseTimeUnit)K+='';if($.catAxisMajorTimeUnit)K+='';if($.catAxisMinorTimeUnit)K+=''}if($.catAxisMajorUnit)K+=``;if($.catAxisMinorUnit)K+=``}if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";return K}function y7($,q){let Q=q===o2?$.barDir==="col"?"l":"b":$.barDir!=="col"?"r":"t";if(q===Y5)Q="r";let K=q===o2?B8:O7,J="";if(J+="",J+=' ',J+=" ",$.valAxisLogScaleBase)J+=``;if(J+='',$.valAxisMaxVal||$.valAxisMaxVal===0)J+=``;if($.valAxisMinVal||$.valAxisMinVal===0)J+=``;if(J+=" ",J+=` `,J+=' ',$.valGridLine.style!=="none")J+=n7($.valGridLine);if($.showValAxisTitle)J+=v5({color:$.valAxisTitleColor,fontFace:$.valAxisTitleFontFace,fontSize:$.valAxisTitleFontSize,titleRotate:$.valAxisTitleRotate,title:$.valAxisTitle||"Axis Title"});if(J+=``,$._type===q0.SCATTER)J+=' ',J+=' ',J+=' ';else J+=' ',J+=' ',J+=' ';if(J+=" ",J+=` `,J+=!$.valAxisLineShow?"":""+R0($.valAxisLineColor||u1.color)+"",J+=' ',J+=" ",J+=" ",J+=" ",J+=" ",J+=` `,J+=" ",J+=" ",J+=" ",J+=` `,J+=" "+R0($.valAxisLabelColor||Q2)+"",J+=' ',J+=" ",J+=" ",J+=' ',J+=" ",J+=" ",J+=' ',typeof $.catAxisCrossesAt==="number")J+=` `;else if(typeof $.catAxisCrossesAt==="string")J+=' ';else J+=' ';if(J+=' ',$.valAxisMajorUnit)J+=` `;if($.valAxisDisplayUnit)J+=`${$.valAxisDisplayUnitLabel?"":""}`;return J+="",J}function _B($,q,Q){let K="";if(K+="",K+=' ',K+=' ',K+=' ',K+=' ',K+=$.serGridLine.style!=="none"?n7($.serGridLine):"",$.showSerAxisTitle)K+=v5({color:$.serAxisTitleColor,fontFace:$.serAxisTitleFontFace,fontSize:$.serAxisTitleFontSize,titleRotate:$.serAxisTitleRotate,title:$.serAxisTitle||"Axis Title"});if(K+=` `,K+=' ',K+=' ',K+=` `,K+=" ",K+=' ',K+=!$.serAxisLineShow?"":`${R0($.serAxisLineColor||u1.color)}`,K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=` `,K+=` ${R0($.serAxisLabelColor||Q2)}`,K+=` `,K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=' ',$.serAxisLabelFrequency)K+=' ';if($.serLabelFormatCode){if(["serAxisBaseTimeUnit","serAxisMajorTimeUnit","serAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes(J.toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.serAxisBaseTimeUnit)K+=` `;if($.serAxisMajorTimeUnit)K+=` `;if($.serAxisMinorTimeUnit)K+=` `;if($.serAxisMajorUnit)K+=` `;if($.serAxisMinorUnit)K+=` `}return K+="",K}function v5($,q,Q){let K=$.titleAlign==="left"||$.titleAlign==="right"?``:"",J=$.titleRotate?``:"",Z=$.fontSize?`sz="${Math.round($.fontSize*100)}"`:"",G=$.titleBold?1:0,W="";if($.titlePos&&typeof $.titlePos.x==="number"&&typeof $.titlePos.y==="number"){let B=$.titlePos.x+q,V=$.titlePos.y+Q,U=B===0?0:B*(B/5)/10;if(U>=1)U=U/10;if(U>=0.1)U=U/10;let w=V===0?0:V*(V/5)/10;if(w>=1)w=w/10;if(w>=0.1)w=w/10;W=``}return` ${J} @@ -54,22 +54,22 @@ ${W} `}function j0($){let q="",Q=$-1;if(Q<=25)q=W8[Q];else q=`${W8[Math.floor(Q/W8.length-1)]}${W8[Q%W8.length]}`;return q}function T1($,q){if(!$)return"";else if(typeof $!=="object")return console.warn("`shadow` options must be an object. Ex: `{shadow: {type:'none'}}`"),"";let Q="",K=Object.assign(Object.assign({},q),$),J=K.type||"outer",Z=Y0(K.blur),G=Y0(K.offset),W=Math.round(K.angle*60000),B=K.color,V=Math.round(K.opacity*1e5),U=K.rotateWithShape?1:0;return Q+=``,Q+=``,Q+=``,Q+=``,Q+="",Q}function n7($){let q="";return q+=" ",q+=` `,q+=' ',q+=' ',q+=" ",q+=" ",q+="",q}function D5($){if(!$||$==="flat")return"flat";else if($==="square")return"sq";else if($==="round")return"rnd";else throw Error(`Invalid chart line cap: ${$}`)}function h7($){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node",J,Z,G=K?()=>W2(this,void 0,void 0,function*(){({default:J}=yield import("node:fs")),{default:Z}=yield Promise.resolve().then(() => (tK(),sK))}):()=>W2(this,void 0,void 0,function*(){});if(K)G();let W=[],B=$._relsMedia.filter((U)=>U.type!=="online"&&!U.data&&(!U.path||U.path&&!U.path.includes("preencoded"))),V=[];return B.forEach((U)=>{if(!V.includes(U.path))U.isDuplicate=!1,V.push(U.path);else U.isDuplicate=!0}),B.filter((U)=>!U.isDuplicate).forEach((U)=>{W.push((()=>W2(this,void 0,void 0,function*(){if(!Z)yield G();if(K&&J&&U.path.indexOf("http")!==0)try{let w=J.readFileSync(U.path);return U.data=Buffer.from(w).toString("base64"),B.filter((F)=>F.isDuplicate&&F.path===U.path).forEach((F)=>F.data=U.data),"done"}catch(w){throw U.data=j6,B.filter((F)=>F.isDuplicate&&F.path===U.path).forEach((F)=>F.data=U.data),Error(`ERROR: Unable to read media: "${U.path}" -${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F)=>{Z.get(U.path,(M)=>{let k="";M.setEncoding("binary"),M.on("data",(f)=>k+=f),M.on("end",()=>{U.data=Buffer.from(k,"binary").toString("base64"),B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),w("done")}),M.on("error",()=>{U.data=j6,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),F(Error(`ERROR! Unable to load image (https.get): ${U.path}`))})})});return yield new Promise((w,F)=>{let M=new XMLHttpRequest;M.onload=()=>{let k=new FileReader;k.onloadend=()=>{if(U.data=k.result,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),!U.isSvgPng)w("done");else QJ(U).then(()=>w("done")).catch(F)},k.readAsDataURL(M.response)},M.onerror=()=>{U.data=j6,B.filter((k)=>k.isDuplicate&&k.path===U.path).forEach((k)=>k.data=U.data),F(Error(`ERROR! Unable to load image (xhr.onerror): ${U.path}`))},M.open("GET",U.path),M.responseType="blob",M.send()})}))())}),$._relsMedia.filter((U)=>U.isSvgPng&&U.data).forEach((U)=>{(()=>W2(this,void 0,void 0,function*(){if(K&&!J)yield G();if(K&&J)U.data=j6,W.push(Promise.resolve("done"));else W.push(QJ(U))}))()}),W}function QJ($){return W2(this,void 0,void 0,function*(){return yield new Promise((q,Q)=>{let K=new Image;K.onload=()=>{if(K.width+K.height===0)K.onerror("h/w=0");let J=document.createElement("CANVAS"),Z=J.getContext("2d");J.width=K.width,J.height=K.height,Z.drawImage(K,0,0);try{$.data=J.toDataURL($.type),q("done")}catch(G){K.onerror(G.toString())}J=null},K.onerror=()=>{$.data=j6,Q(Error(`ERROR! Unable to load image (image.onerror): ${$.path}`))},K.src=typeof $.data==="string"?$.data:j6})})}var PB={cover:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.h/Q:q.w,G=J?q.h:q.w*Q,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},contain:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.w:q.h/Q,G=J?q.w*Q:q.h,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},crop:function($,q){let Q=q.x,K=$.w-(q.x+q.w),J=q.y,Z=$.h-(q.y+q.h),G=Math.round(1e5*(Q/$.w)),W=Math.round(1e5*(K/$.w)),B=Math.round(1e5*(J/$.h)),V=Math.round(1e5*(Z/$.h));return``}};function d7($){var q;let Q=$._name?'':"",K=1;if($._bkgdImgRid)Q+=``;else if((q=$.background)===null||q===void 0?void 0:q.color)Q+=`${B2($.background)}`;else if(!$.bkgd&&$._name&&$._name===x7)Q+='';if(Q+="",Q+='',Q+='',Q+='',$._slideObjects.forEach((J,Z)=>{var G,W,B,V,U,w,F,M;let k=0,f=0,L=H0("75%","X",$._presLayout),D=0,z,N="",H=null,v=null,j=0,n=0,d=null,_=null,X=(G=J.options)===null||G===void 0?void 0:G.sizing,P=(W=J.options)===null||W===void 0?void 0:W.rounding;if($._slideLayout!==void 0&&$._slideLayout._slideObjects!==void 0&&J.options&&J.options.placeholder)z=$._slideLayout._slideObjects.filter((h)=>h.options.placeholder===J.options.placeholder)[0];if(J.options=J.options||{},typeof J.options.x<"u")k=H0(J.options.x,"X",$._presLayout);if(typeof J.options.y<"u")f=H0(J.options.y,"Y",$._presLayout);if(typeof J.options.w<"u")L=H0(J.options.w,"X",$._presLayout);if(typeof J.options.h<"u")D=H0(J.options.h,"Y",$._presLayout);let g=L,c=D;if(z){if(z.options.x||z.options.x===0)k=H0(z.options.x,"X",$._presLayout);if(z.options.y||z.options.y===0)f=H0(z.options.y,"Y",$._presLayout);if(z.options.w||z.options.w===0)L=H0(z.options.w,"X",$._presLayout);if(z.options.h||z.options.h===0)D=H0(z.options.h,"Y",$._presLayout)}if(J.options.flipH)N+=' flipH="1"';if(J.options.flipV)N+=' flipV="1"';if(J.options.rotate)N+=` rot="${S1(J.options.rotate)}"`;switch(J._type){case D0.table:if(H=J.arrTabRows,v=J.options,j=0,n=0,H[0].forEach((h)=>{d=h.options||null,j+=(d===null||d===void 0?void 0:d.colspan)?Number(d.colspan):1}),_=``,_+=' ',_+=``,_+='',Array.isArray(v.colW)){_+="";for(let h=0;h`}_+=""}else{if(n=v.colW?v.colW:L0,J.options.w&&!v.colW)n=Math.round((typeof J.options.w==="number"?J.options.w:1)/j);_+="";for(let h=0;h`;_+=""}H.forEach((h)=>{var x,l;for(let $0=0;$01){let W0=Array(F0-1).fill(void 0).map(()=>{return{_type:D0.tablecell,options:{rowspan:p},_hmerge:!0}});h.splice($0+1,0,...W0),$0+=F0}else $0+=1}}),H.forEach((h,x)=>{let l=H[x+1];if(!l)return;h.forEach(($0,Z0)=>{var F0,p;let W0=$0._rowContinue||((F0=$0.options)===null||F0===void 0?void 0:F0.rowspan),y=(p=$0.options)===null||p===void 0?void 0:p.colspan,i=$0._hmerge;if(W0&&W0>1){let U0={_type:D0.tablecell,options:{colspan:y},_rowContinue:W0-1,_vmerge:!0,_hmerge:i};l.splice(Z0,0,U0)}})}),H.forEach((h,x)=>{let l=0;if(Array.isArray(v.rowH)&&v.rowH[x])l=v0(Number(v.rowH[x]));else if(v.rowH&&!isNaN(Number(v.rowH)))l=v0(Number(v.rowH));else if(J.options.cy||J.options.h)l=Math.round((J.options.h?v0(J.options.h):typeof J.options.cy==="number"?J.options.cy:1)/H.length);_+=``,h.forEach(($0)=>{var Z0,F0,p,W0,y;let i=$0,U0={rowSpan:((Z0=i.options)===null||Z0===void 0?void 0:Z0.rowspan)>1?i.options.rowspan:void 0,gridSpan:((F0=i.options)===null||F0===void 0?void 0:F0.colspan)>1?i.options.colspan:void 0,vMerge:i._vmerge?1:void 0,hMerge:i._hmerge?1:void 0},m=Object.keys(U0).map((K0)=>[K0,U0[K0]]).filter(([,K0])=>!!K0).map(([K0,R])=>`${String(K0)}="${String(R)}"`).join(" ");if(m)m=" "+m;if(i._hmerge||i._vmerge){_+=``;return}let V0=i.options||{};i.options=V0,["align","bold","border","color","fill","fontFace","fontSize","margin","textDirection","underline","valign"].forEach((K0)=>{if(v[K0]&&!V0[K0]&&V0[K0]!==0)V0[K0]=v[K0]});let w0=V0.valign?` anchor="${V0.valign.replace(/^c$/i,"ctr").replace(/^m$/i,"ctr").replace("center","ctr").replace("middle","ctr").replace("top","t").replace("btm","b").replace("bottom","b")}"`:"",S=V0.textDirection&&V0.textDirection!=="horz"?` vert="${V0.textDirection}"`:"",b=((W0=(p=i._optImp)===null||p===void 0?void 0:p.fill)===null||W0===void 0?void 0:W0.color)?i._optImp.fill.color:((y=i._optImp)===null||y===void 0?void 0:y.fill)&&typeof i._optImp.fill==="string"?i._optImp.fill:"";b=b||V0.fill?V0.fill:"";let O=b?B2(b):"",E=V0.margin===0||V0.margin?V0.margin:JJ;if(!Array.isArray(E)&&typeof E==="number")E=[E,E,E,E];let a="";if(E[0]>=1)a=` marL="${Y0(E[3])}" marR="${Y0(E[1])}" marT="${Y0(E[0])}" marB="${Y0(E[2])}"`;else a=` marL="${v0(E[3])}" marR="${v0(E[1])}" marT="${v0(E[0])}" marB="${v0(E[2])}"`;if(_+=`${KJ(i)}`,V0.border&&Array.isArray(V0.border))[{idx:3,name:"lnL"},{idx:1,name:"lnR"},{idx:0,name:"lnT"},{idx:2,name:"lnB"}].forEach((K0)=>{if(V0.border[K0.idx].type!=="none")_+=``,_+=`${R0(V0.border[K0.idx].color)}`,_+=``,_+=``;else _+=``});_+=O,_+=" ",_+=" "}),_+=""}),_+=" ",_+=" ",_+=" ",_+="",Q+=_,K++;break;case D0.text:case D0.placeholder:if(!J.options.line&&D===0)D=L0*0.3;if(!J.options._bodyProp)J.options._bodyProp={};if(J.options.margin&&Array.isArray(J.options.margin))J.options._bodyProp.lIns=Y0(J.options.margin[0]||0),J.options._bodyProp.rIns=Y0(J.options.margin[1]||0),J.options._bodyProp.bIns=Y0(J.options.margin[2]||0),J.options._bodyProp.tIns=Y0(J.options.margin[3]||0);else if(typeof J.options.margin==="number")J.options._bodyProp.lIns=Y0(J.options.margin),J.options._bodyProp.rIns=Y0(J.options.margin),J.options._bodyProp.bIns=Y0(J.options.margin),J.options._bodyProp.tIns=Y0(J.options.margin);if(Q+="",Q+=``,(B=J.options.hyperlink)===null||B===void 0?void 0:B.url)Q+=``;if((V=J.options.hyperlink)===null||V===void 0?void 0:V.slide)Q+=``;if(Q+="",Q+="':"/>"),Q+=`${J._type==="placeholder"?N5(J):N5(z)}`,Q+="",Q+=``,Q+=``,Q+=``,J.shape==="custGeom")Q+="",Q+="",Q+="",Q+="",Q+="",Q+="",Q+='',Q+="",Q+=``,(w=J.options.points)===null||w===void 0||w.forEach((h,x)=>{if("curve"in h)switch(h.curve.type){case"arc":Q+=``;break;case"cubic":Q+=` +${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F)=>{Z.get(U.path,(M)=>{let k="";M.setEncoding("binary"),M.on("data",(f)=>k+=f),M.on("end",()=>{U.data=Buffer.from(k,"binary").toString("base64"),B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),w("done")}),M.on("error",()=>{U.data=j6,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),F(Error(`ERROR! Unable to load image (https.get): ${U.path}`))})})});return yield new Promise((w,F)=>{let M=new XMLHttpRequest;M.onload=()=>{let k=new FileReader;k.onloadend=()=>{if(U.data=k.result,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),!U.isSvgPng)w("done");else QJ(U).then(()=>w("done")).catch(F)},k.readAsDataURL(M.response)},M.onerror=()=>{U.data=j6,B.filter((k)=>k.isDuplicate&&k.path===U.path).forEach((k)=>k.data=U.data),F(Error(`ERROR! Unable to load image (xhr.onerror): ${U.path}`))},M.open("GET",U.path),M.responseType="blob",M.send()})}))())}),$._relsMedia.filter((U)=>U.isSvgPng&&U.data).forEach((U)=>{(()=>W2(this,void 0,void 0,function*(){if(K&&!J)yield G();if(K&&J)U.data=j6,W.push(Promise.resolve("done"));else W.push(QJ(U))}))()}),W}function QJ($){return W2(this,void 0,void 0,function*(){return yield new Promise((q,Q)=>{let K=new Image;K.onload=()=>{if(K.width+K.height===0)K.onerror("h/w=0");let J=document.createElement("CANVAS"),Z=J.getContext("2d");J.width=K.width,J.height=K.height,Z.drawImage(K,0,0);try{$.data=J.toDataURL($.type),q("done")}catch(G){K.onerror(G.toString())}J=null},K.onerror=()=>{$.data=j6,Q(Error(`ERROR! Unable to load image (image.onerror): ${$.path}`))},K.src=typeof $.data==="string"?$.data:j6})})}var cB={cover:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.h/Q:q.w,G=J?q.h:q.w*Q,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},contain:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.w:q.h/Q,G=J?q.w*Q:q.h,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},crop:function($,q){let Q=q.x,K=$.w-(q.x+q.w),J=q.y,Z=$.h-(q.y+q.h),G=Math.round(1e5*(Q/$.w)),W=Math.round(1e5*(K/$.w)),B=Math.round(1e5*(J/$.h)),V=Math.round(1e5*(Z/$.h));return``}};function d7($){var q;let Q=$._name?'':"",K=1;if($._bkgdImgRid)Q+=``;else if((q=$.background)===null||q===void 0?void 0:q.color)Q+=`${B2($.background)}`;else if(!$.bkgd&&$._name&&$._name===x7)Q+='';if(Q+="",Q+='',Q+='',Q+='',$._slideObjects.forEach((J,Z)=>{var G,W,B,V,U,w,F,M;let k=0,f=0,L=H0("75%","X",$._presLayout),D=0,z,N="",H=null,v=null,j=0,n=0,d=null,_=null,X=(G=J.options)===null||G===void 0?void 0:G.sizing,P=(W=J.options)===null||W===void 0?void 0:W.rounding;if($._slideLayout!==void 0&&$._slideLayout._slideObjects!==void 0&&J.options&&J.options.placeholder)z=$._slideLayout._slideObjects.filter((h)=>h.options.placeholder===J.options.placeholder)[0];if(J.options=J.options||{},typeof J.options.x<"u")k=H0(J.options.x,"X",$._presLayout);if(typeof J.options.y<"u")f=H0(J.options.y,"Y",$._presLayout);if(typeof J.options.w<"u")L=H0(J.options.w,"X",$._presLayout);if(typeof J.options.h<"u")D=H0(J.options.h,"Y",$._presLayout);let g=L,c=D;if(z){if(z.options.x||z.options.x===0)k=H0(z.options.x,"X",$._presLayout);if(z.options.y||z.options.y===0)f=H0(z.options.y,"Y",$._presLayout);if(z.options.w||z.options.w===0)L=H0(z.options.w,"X",$._presLayout);if(z.options.h||z.options.h===0)D=H0(z.options.h,"Y",$._presLayout)}if(J.options.flipH)N+=' flipH="1"';if(J.options.flipV)N+=' flipV="1"';if(J.options.rotate)N+=` rot="${S1(J.options.rotate)}"`;switch(J._type){case D0.table:if(H=J.arrTabRows,v=J.options,j=0,n=0,H[0].forEach((h)=>{d=h.options||null,j+=(d===null||d===void 0?void 0:d.colspan)?Number(d.colspan):1}),_=``,_+=' ',_+=``,_+='',Array.isArray(v.colW)){_+="";for(let h=0;h`}_+=""}else{if(n=v.colW?v.colW:L0,J.options.w&&!v.colW)n=Math.round((typeof J.options.w==="number"?J.options.w:1)/j);_+="";for(let h=0;h`;_+=""}H.forEach((h)=>{var x,l;for(let $0=0;$01){let W0=Array(F0-1).fill(void 0).map(()=>{return{_type:D0.tablecell,options:{rowspan:p},_hmerge:!0}});h.splice($0+1,0,...W0),$0+=F0}else $0+=1}}),H.forEach((h,x)=>{let l=H[x+1];if(!l)return;h.forEach(($0,Z0)=>{var F0,p;let W0=$0._rowContinue||((F0=$0.options)===null||F0===void 0?void 0:F0.rowspan),y=(p=$0.options)===null||p===void 0?void 0:p.colspan,i=$0._hmerge;if(W0&&W0>1){let U0={_type:D0.tablecell,options:{colspan:y},_rowContinue:W0-1,_vmerge:!0,_hmerge:i};l.splice(Z0,0,U0)}})}),H.forEach((h,x)=>{let l=0;if(Array.isArray(v.rowH)&&v.rowH[x])l=v0(Number(v.rowH[x]));else if(v.rowH&&!isNaN(Number(v.rowH)))l=v0(Number(v.rowH));else if(J.options.cy||J.options.h)l=Math.round((J.options.h?v0(J.options.h):typeof J.options.cy==="number"?J.options.cy:1)/H.length);_+=``,h.forEach(($0)=>{var Z0,F0,p,W0,y;let i=$0,U0={rowSpan:((Z0=i.options)===null||Z0===void 0?void 0:Z0.rowspan)>1?i.options.rowspan:void 0,gridSpan:((F0=i.options)===null||F0===void 0?void 0:F0.colspan)>1?i.options.colspan:void 0,vMerge:i._vmerge?1:void 0,hMerge:i._hmerge?1:void 0},m=Object.keys(U0).map((K0)=>[K0,U0[K0]]).filter(([,K0])=>!!K0).map(([K0,R])=>`${String(K0)}="${String(R)}"`).join(" ");if(m)m=" "+m;if(i._hmerge||i._vmerge){_+=``;return}let V0=i.options||{};i.options=V0,["align","bold","border","color","fill","fontFace","fontSize","margin","textDirection","underline","valign"].forEach((K0)=>{if(v[K0]&&!V0[K0]&&V0[K0]!==0)V0[K0]=v[K0]});let w0=V0.valign?` anchor="${V0.valign.replace(/^c$/i,"ctr").replace(/^m$/i,"ctr").replace("center","ctr").replace("middle","ctr").replace("top","t").replace("btm","b").replace("bottom","b")}"`:"",S=V0.textDirection&&V0.textDirection!=="horz"?` vert="${V0.textDirection}"`:"",b=((W0=(p=i._optImp)===null||p===void 0?void 0:p.fill)===null||W0===void 0?void 0:W0.color)?i._optImp.fill.color:((y=i._optImp)===null||y===void 0?void 0:y.fill)&&typeof i._optImp.fill==="string"?i._optImp.fill:"";b=b||V0.fill?V0.fill:"";let O=b?B2(b):"",E=V0.margin===0||V0.margin?V0.margin:JJ;if(!Array.isArray(E)&&typeof E==="number")E=[E,E,E,E];let a="";if(E[0]>=1)a=` marL="${Y0(E[3])}" marR="${Y0(E[1])}" marT="${Y0(E[0])}" marB="${Y0(E[2])}"`;else a=` marL="${v0(E[3])}" marR="${v0(E[1])}" marT="${v0(E[0])}" marB="${v0(E[2])}"`;if(_+=`${KJ(i)}`,V0.border&&Array.isArray(V0.border))[{idx:3,name:"lnL"},{idx:1,name:"lnR"},{idx:0,name:"lnT"},{idx:2,name:"lnB"}].forEach((K0)=>{if(V0.border[K0.idx].type!=="none")_+=``,_+=`${R0(V0.border[K0.idx].color)}`,_+=``,_+=``;else _+=``});_+=O,_+=" ",_+=" "}),_+=""}),_+=" ",_+=" ",_+=" ",_+="",Q+=_,K++;break;case D0.text:case D0.placeholder:if(!J.options.line&&D===0)D=L0*0.3;if(!J.options._bodyProp)J.options._bodyProp={};if(J.options.margin&&Array.isArray(J.options.margin))J.options._bodyProp.lIns=Y0(J.options.margin[0]||0),J.options._bodyProp.rIns=Y0(J.options.margin[1]||0),J.options._bodyProp.bIns=Y0(J.options.margin[2]||0),J.options._bodyProp.tIns=Y0(J.options.margin[3]||0);else if(typeof J.options.margin==="number")J.options._bodyProp.lIns=Y0(J.options.margin),J.options._bodyProp.rIns=Y0(J.options.margin),J.options._bodyProp.bIns=Y0(J.options.margin),J.options._bodyProp.tIns=Y0(J.options.margin);if(Q+="",Q+=``,(B=J.options.hyperlink)===null||B===void 0?void 0:B.url)Q+=``;if((V=J.options.hyperlink)===null||V===void 0?void 0:V.slide)Q+=``;if(Q+="",Q+="':"/>"),Q+=`${J._type==="placeholder"?N5(J):N5(z)}`,Q+="",Q+=``,Q+=``,Q+=``,J.shape==="custGeom")Q+="",Q+="",Q+="",Q+="",Q+="",Q+="",Q+='',Q+="",Q+=``,(w=J.options.points)===null||w===void 0||w.forEach((h,x)=>{if("curve"in h)switch(h.curve.type){case"arc":Q+=``;break;case"cubic":Q+=` `;break;case"quadratic":Q+=` - `;break}else if("close"in h)Q+="";else if(h.moveTo||x===0)Q+=``;else Q+=``}),Q+="",Q+="",Q+="";else{if(Q+='',J.options.rectRadius)Q+=``;else if(J.options.angleRange){for(let h=0;h<2;h++){let x=J.options.angleRange[h];Q+=``}if(J.options.arcThicknessRatio)Q+=``}Q+=""}if(Q+=J.options.fill?B2(J.options.fill):"",J.options.line){if(Q+=J.options.line.width?``:"",J.options.line.color)Q+=B2(J.options.line);if(J.options.line.dashType)Q+=``;if(J.options.line.beginArrowType)Q+=``;if(J.options.line.endArrowType)Q+=``;Q+=""}if(J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=` `,Q+=` `,Q+=` `,Q+=" ",Q+="";Q+="",Q+=KJ(J),Q+="";break;case D0.image:if(Q+="",Q+=" ",Q+=``,(F=J.hyperlink)===null||F===void 0?void 0:F.url)Q+=``;if((M=J.hyperlink)===null||M===void 0?void 0:M.slide)Q+=``;if(Q+=" ",Q+=' ',Q+=" "+N5(z)+"",Q+=" ",Q+="",($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0]&&($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0].extn==="svg")Q+=``,Q+=J.options.transparency?` `:"",Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";else Q+=``,Q+=J.options.transparency?``:"",Q+="";if(X===null||X===void 0?void 0:X.type){let h=X.w?H0(X.w,"X",$._presLayout):L,x=X.h?H0(X.h,"Y",$._presLayout):D,l=H0(X.x||0,"X",$._presLayout),$0=H0(X.y||0,"Y",$._presLayout);Q+=PB[X.type]({w:g,h:c},{w:h,h:x,x:l,y:$0}),g=h,c=x}else Q+=" ";if(Q+="",Q+="",Q+=" ",Q+=` `,Q+=` `,Q+=" ",Q+=` `,J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=``,Q+=``,Q+=``,Q+=``,Q+="";Q+="",Q+="";break;case D0.media:if(J.mtype==="online")Q+="",Q+=" ",Q+=``,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";else Q+="",Q+=" ",Q+=``,Q+=' ',Q+=" ",Q+=` `,Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";break;case D0.chart:Q+="",Q+=" ",Q+=` `,Q+=" ",Q+=` ${N5(z)}`,Q+=" ",Q+=` `,Q+=' ',Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";break;default:Q+="";break}}),$._slideNumberProps){if(!$._slideNumberProps.align)$._slideNumberProps.align="left";if(Q+="",Q+=" ",Q+=' ',Q+=' ',Q+=" ",Q+=" ",Q+=` `,Q+="",Q+="`,$._slideNumberProps.color)Q+=B2($._slideNumberProps.color);if($._slideNumberProps.fontFace)Q+=``;Q+=""}if(Q+="",Q+="",$._slideNumberProps.align.startsWith("l"))Q+='';else if($._slideNumberProps.align.startsWith("c"))Q+='';else if($._slideNumberProps.align.startsWith("r"))Q+='';else Q+='';Q+=``,Q+=`${$._slideNum}`,Q+=""}return Q+="",Q+="",Q}function m7($,q){let Q=0,K=''+n0+'';return $._rels.forEach((J)=>{if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("hyperlink"))if(J.data==="slide")K+=``;else K+=``;else if(J.type.toLowerCase().includes("notesSlide"))K+=``}),($._relsChart||[]).forEach((J)=>{Q=Math.max(Q,J.rId),K+=``}),($._relsMedia||[]).forEach((J)=>{let Z=J.rId.toString();if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("image"))K+='';else if(J.type.toLowerCase().includes("audio"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("video"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("online"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+=''}),q.forEach((J,Z)=>{K+=``}),K+="",K}function qJ($,q){var Q,K;let J="",Z="",G="",W="",B=q?"a:lvl1pPr":"a:pPr",V=Y0(kB),U=`<${B}${$.options.rtlMode?' rtl="1" ':""}`;{if($.options.align)switch($.options.align){case"left":U+=' algn="l"';break;case"right":U+=' algn="r"';break;case"center":U+=' algn="ctr"';break;case"justify":U+=' algn="just"';break;default:U+="";break}if($.options.lineSpacing)Z=``;else if($.options.lineSpacingMultiple)Z=``;if($.options.indentLevel&&!isNaN(Number($.options.indentLevel))&&$.options.indentLevel>0)U+=` lvl="${$.options.indentLevel}"`;if($.options.paraSpaceBefore&&!isNaN(Number($.options.paraSpaceBefore))&&$.options.paraSpaceBefore>0)G+=``;if($.options.paraSpaceAfter&&!isNaN(Number($.options.paraSpaceAfter))&&$.options.paraSpaceAfter>0)G+=``;if(typeof $.options.bullet==="object"){if((K=(Q=$===null||$===void 0?void 0:$.options)===null||Q===void 0?void 0:Q.bullet)===null||K===void 0?void 0:K.indent)V=Y0($.options.bullet.indent);if($.options.bullet.type){if($.options.bullet.type.toString().toLowerCase()==="number")U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet.characterCode){let w=`&#x${$.options.bullet.characterCode};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.characterCode))console.warn("Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else if($.options.bullet.code){let w=`&#x${$.options.bullet.code};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.code))console.warn("Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet)U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``;else if(!$.options.bullet)U+=' indent="0" marL="0"',J="";if($.options.tabStops&&Array.isArray($.options.tabStops))W=`${$.options.tabStops.map((F)=>``).join("")}`;if(U+=">"+Z+G+J+W,q)U+=MJ($.options,!0);U+=""}return U}function MJ($,q){var Q;let K="",J=q?"a:defRPr":"a:rPr";if(K+="<"+J+' lang="'+($.lang?$.lang:"en-US")+'"'+($.lang?' altLang="en-US"':""),K+=$.fontSize?` sz="${Math.round($.fontSize*100)}"`:"",K+=($===null||$===void 0?void 0:$.bold)?` b="${$.bold?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.italic)?` i="${$.italic?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.strike)?` strike="${typeof $.strike==="string"?$.strike:"sngStrike"}"`:"",typeof $.underline==="object"&&((Q=$.underline)===null||Q===void 0?void 0:Q.style))K+=` u="${$.underline.style}"`;else if(typeof $.underline==="string")K+=` u="${String($.underline)}"`;else if($.hyperlink)K+=' u="sng"';if($.baseline)K+=` baseline="${Math.round($.baseline*50)}"`;else if($.subscript)K+=' baseline="-40000"';else if($.superscript)K+=' baseline="30000"';if(K+=$.charSpacing?` spc="${Math.round($.charSpacing*100)}" kern="0"`:"",K+=' dirty="0">',$.color||$.fontFace||$.outline||typeof $.underline==="object"&&$.underline.color){if($.outline&&typeof $.outline==="object")K+=`${B2($.outline.color||"FFFFFF")}`;if($.color)K+=B2({color:$.color,transparency:$.transparency});if($.highlight)K+=`${R0($.highlight)}`;if(typeof $.underline==="object"&&$.underline.color)K+=`${B2($.underline.color)}`;if($.glow)K+=`${fB($.glow,LB)}`;if($.fontFace)K+=``}if($.hyperlink){if(typeof $.hyperlink!=="object")throw Error("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:'https://github.com'}` ");else if(!$.hyperlink.url&&!$.hyperlink.slide)throw Error("ERROR: 'hyperlink requires either `url` or `slide`'");else if($.hyperlink.url)K+=`":"/>"}`;else if($.hyperlink.slide)K+=`":"/>"}`;if($.color)K+=" ",K+=' ',K+=' ',K+=" ",K+=" ",K+=""}return K+=``,K}function TB($){return $.text?`${MJ($.options,!1)}${k0($.text)}`:""}function uB($){let q="";else if($.options.fit==="resize")q+=""}if($.options.shrinkText)q+="";q+=$.options._bodyProp.autoFit?"":"",q+=""}else q+=' wrap="square" rtlCol="0">',q+="";return $._type===D0.tablecell?"":q}function KJ($){let q=$.options||{},Q=[],K=[];if(q&&$._type!==D0.tablecell&&(typeof $.text>"u"||$.text===null))return"";let J=$._type===D0.tablecell?"":"";if(J+=uB($),q.h===0&&q.line&&q.align)J+='';else if($._type==="placeholder")J+=`${qJ($,!0)}`;else J+="";if(typeof $.text==="string"||typeof $.text==="number")Q.push({text:$.text.toString(),options:q||{}});else if($.text&&!Array.isArray($.text)&&typeof $.text==="object"&&Object.keys($.text).includes("text"))Q.push({text:$.text||"",options:$.options||{}});else if(Array.isArray($.text))Q=$.text.map((W)=>({text:W.text,options:W.options}));Q.forEach((W,B)=>{if(!W.text)W.text="";if(W.options=W.options||q||{},B===0&&W.options&&!W.options.bullet&&q.bullet)W.options.bullet=q.bullet;if(typeof W.text==="string"||typeof W.text==="number")W.text=W.text.toString().replace(/\r*\n/g,n0);if(W.text.includes(n0)&&W.text.match(/\n$/g)===null)W.text.split(n0).forEach((V)=>{W.options.breakLine=!0,K.push({text:V,options:W.options})});else K.push(W)});let Z=[],G=[];if(K.forEach((W,B)=>{if(G.length>0&&(W.options.align||q.align)){if(W.options.align!==K[B-1].options.align)Z.push(G),G=[]}else if(G.length>0&&W.options.bullet&&G.length>0)Z.push(G),G=[],W.options.breakLine=!1;if(G.push(W),G.length>0&&W.options.breakLine){if(B+1{var B;let V=!1;J+="";let U=`{if(w.options._lineIdx=F,F>0&&w.options.softBreakBefore)J+="";if(w.options.align=w.options.align||q.align,w.options.lineSpacing=w.options.lineSpacing||q.lineSpacing,w.options.lineSpacingMultiple=w.options.lineSpacingMultiple||q.lineSpacingMultiple,w.options.indentLevel=w.options.indentLevel||q.indentLevel,w.options.paraSpaceBefore=w.options.paraSpaceBefore||q.paraSpaceBefore,w.options.paraSpaceAfter=w.options.paraSpaceAfter||q.paraSpaceAfter,U=qJ(w,!1),J+=U.replace("",""),Object.entries(q).filter(([M])=>!(w.options.hyperlink&&M==="color")).forEach(([M,k])=>{if(M!=="bullet"&&!w.options[M])w.options[M]=k}),J+=TB(w),!w.text&&q.fontSize||w.options.fontSize)V=!0,q.fontSize=q.fontSize||w.options.fontSize}),$._type===D0.tablecell&&(q.fontSize||q.fontFace))if(q.fontFace)J+=`',J+=``,J+=``,J+=``,J+="";else J+=`';else if(V)J+=`';else J+=``;J+=""}),J.indexOf("")===-1)J+="";return J+=$._type===D0.tablecell?"":"",J}function N5($){var q,Q;if(!$)return"";let K=((q=$.options)===null||q===void 0?void 0:q._placeholderIdx)?$.options._placeholderIdx:"",J=((Q=$.options)===null||Q===void 0?void 0:Q._placeholderType)?$.options._placeholderType:"",Z=J&&F8[J]?F8[J].toString():"";return``;break}else if("close"in h)Q+="";else if(h.moveTo||x===0)Q+=``;else Q+=``}),Q+="",Q+="",Q+="";else{if(Q+='',J.options.rectRadius)Q+=``;else if(J.options.angleRange){for(let h=0;h<2;h++){let x=J.options.angleRange[h];Q+=``}if(J.options.arcThicknessRatio)Q+=``}Q+=""}if(Q+=J.options.fill?B2(J.options.fill):"",J.options.line){if(Q+=J.options.line.width?``:"",J.options.line.color)Q+=B2(J.options.line);if(J.options.line.dashType)Q+=``;if(J.options.line.beginArrowType)Q+=``;if(J.options.line.endArrowType)Q+=``;Q+=""}if(J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=` `,Q+=` `,Q+=` `,Q+=" ",Q+="";Q+="",Q+=KJ(J),Q+="";break;case D0.image:if(Q+="",Q+=" ",Q+=``,(F=J.hyperlink)===null||F===void 0?void 0:F.url)Q+=``;if((M=J.hyperlink)===null||M===void 0?void 0:M.slide)Q+=``;if(Q+=" ",Q+=' ',Q+=" "+N5(z)+"",Q+=" ",Q+="",($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0]&&($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0].extn==="svg")Q+=``,Q+=J.options.transparency?` `:"",Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";else Q+=``,Q+=J.options.transparency?``:"",Q+="";if(X===null||X===void 0?void 0:X.type){let h=X.w?H0(X.w,"X",$._presLayout):L,x=X.h?H0(X.h,"Y",$._presLayout):D,l=H0(X.x||0,"X",$._presLayout),$0=H0(X.y||0,"Y",$._presLayout);Q+=cB[X.type]({w:g,h:c},{w:h,h:x,x:l,y:$0}),g=h,c=x}else Q+=" ";if(Q+="",Q+="",Q+=" ",Q+=` `,Q+=` `,Q+=" ",Q+=` `,J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=``,Q+=``,Q+=``,Q+=``,Q+="";Q+="",Q+="";break;case D0.media:if(J.mtype==="online")Q+="",Q+=" ",Q+=``,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";else Q+="",Q+=" ",Q+=``,Q+=' ',Q+=" ",Q+=` `,Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";break;case D0.chart:Q+="",Q+=" ",Q+=` `,Q+=" ",Q+=` ${N5(z)}`,Q+=" ",Q+=` `,Q+=' ',Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";break;default:Q+="";break}}),$._slideNumberProps){if(!$._slideNumberProps.align)$._slideNumberProps.align="left";if(Q+="",Q+=" ",Q+=' ',Q+=' ',Q+=" ",Q+=" ",Q+=` `,Q+="",Q+="`,$._slideNumberProps.color)Q+=B2($._slideNumberProps.color);if($._slideNumberProps.fontFace)Q+=``;Q+=""}if(Q+="",Q+="",$._slideNumberProps.align.startsWith("l"))Q+='';else if($._slideNumberProps.align.startsWith("c"))Q+='';else if($._slideNumberProps.align.startsWith("r"))Q+='';else Q+='';Q+=``,Q+=`${$._slideNum}`,Q+=""}return Q+="",Q+="",Q}function m7($,q){let Q=0,K=''+n0+'';return $._rels.forEach((J)=>{if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("hyperlink"))if(J.data==="slide")K+=``;else K+=``;else if(J.type.toLowerCase().includes("notesSlide"))K+=``}),($._relsChart||[]).forEach((J)=>{Q=Math.max(Q,J.rId),K+=``}),($._relsMedia||[]).forEach((J)=>{let Z=J.rId.toString();if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("image"))K+='';else if(J.type.toLowerCase().includes("audio"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("video"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("online"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+=''}),q.forEach((J,Z)=>{K+=``}),K+="",K}function qJ($,q){var Q,K;let J="",Z="",G="",W="",B=q?"a:lvl1pPr":"a:pPr",V=Y0(RB),U=`<${B}${$.options.rtlMode?' rtl="1" ':""}`;{if($.options.align)switch($.options.align){case"left":U+=' algn="l"';break;case"right":U+=' algn="r"';break;case"center":U+=' algn="ctr"';break;case"justify":U+=' algn="just"';break;default:U+="";break}if($.options.lineSpacing)Z=``;else if($.options.lineSpacingMultiple)Z=``;if($.options.indentLevel&&!isNaN(Number($.options.indentLevel))&&$.options.indentLevel>0)U+=` lvl="${$.options.indentLevel}"`;if($.options.paraSpaceBefore&&!isNaN(Number($.options.paraSpaceBefore))&&$.options.paraSpaceBefore>0)G+=``;if($.options.paraSpaceAfter&&!isNaN(Number($.options.paraSpaceAfter))&&$.options.paraSpaceAfter>0)G+=``;if(typeof $.options.bullet==="object"){if((K=(Q=$===null||$===void 0?void 0:$.options)===null||Q===void 0?void 0:Q.bullet)===null||K===void 0?void 0:K.indent)V=Y0($.options.bullet.indent);if($.options.bullet.type){if($.options.bullet.type.toString().toLowerCase()==="number")U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet.characterCode){let w=`&#x${$.options.bullet.characterCode};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.characterCode))console.warn("Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else if($.options.bullet.code){let w=`&#x${$.options.bullet.code};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.code))console.warn("Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet)U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``;else if(!$.options.bullet)U+=' indent="0" marL="0"',J="";if($.options.tabStops&&Array.isArray($.options.tabStops))W=`${$.options.tabStops.map((F)=>``).join("")}`;if(U+=">"+Z+G+J+W,q)U+=MJ($.options,!0);U+=""}return U}function MJ($,q){var Q;let K="",J=q?"a:defRPr":"a:rPr";if(K+="<"+J+' lang="'+($.lang?$.lang:"en-US")+'"'+($.lang?' altLang="en-US"':""),K+=$.fontSize?` sz="${Math.round($.fontSize*100)}"`:"",K+=($===null||$===void 0?void 0:$.bold)?` b="${$.bold?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.italic)?` i="${$.italic?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.strike)?` strike="${typeof $.strike==="string"?$.strike:"sngStrike"}"`:"",typeof $.underline==="object"&&((Q=$.underline)===null||Q===void 0?void 0:Q.style))K+=` u="${$.underline.style}"`;else if(typeof $.underline==="string")K+=` u="${String($.underline)}"`;else if($.hyperlink)K+=' u="sng"';if($.baseline)K+=` baseline="${Math.round($.baseline*50)}"`;else if($.subscript)K+=' baseline="-40000"';else if($.superscript)K+=' baseline="30000"';if(K+=$.charSpacing?` spc="${Math.round($.charSpacing*100)}" kern="0"`:"",K+=' dirty="0">',$.color||$.fontFace||$.outline||typeof $.underline==="object"&&$.underline.color){if($.outline&&typeof $.outline==="object")K+=`${B2($.outline.color||"FFFFFF")}`;if($.color)K+=B2({color:$.color,transparency:$.transparency});if($.highlight)K+=`${R0($.highlight)}`;if(typeof $.underline==="object"&&$.underline.color)K+=`${B2($.underline.color)}`;if($.glow)K+=`${AB($.glow,CB)}`;if($.fontFace)K+=``}if($.hyperlink){if(typeof $.hyperlink!=="object")throw Error("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:'https://github.com'}` ");else if(!$.hyperlink.url&&!$.hyperlink.slide)throw Error("ERROR: 'hyperlink requires either `url` or `slide`'");else if($.hyperlink.url)K+=`":"/>"}`;else if($.hyperlink.slide)K+=`":"/>"}`;if($.color)K+=" ",K+=' ',K+=' ',K+=" ",K+=" ",K+=""}return K+=``,K}function bB($){return $.text?`${MJ($.options,!1)}${k0($.text)}`:""}function nB($){let q="";else if($.options.fit==="resize")q+=""}if($.options.shrinkText)q+="";q+=$.options._bodyProp.autoFit?"":"",q+=""}else q+=' wrap="square" rtlCol="0">',q+="";return $._type===D0.tablecell?"":q}function KJ($){let q=$.options||{},Q=[],K=[];if(q&&$._type!==D0.tablecell&&(typeof $.text>"u"||$.text===null))return"";let J=$._type===D0.tablecell?"":"";if(J+=nB($),q.h===0&&q.line&&q.align)J+='';else if($._type==="placeholder")J+=`${qJ($,!0)}`;else J+="";if(typeof $.text==="string"||typeof $.text==="number")Q.push({text:$.text.toString(),options:q||{}});else if($.text&&!Array.isArray($.text)&&typeof $.text==="object"&&Object.keys($.text).includes("text"))Q.push({text:$.text||"",options:$.options||{}});else if(Array.isArray($.text))Q=$.text.map((W)=>({text:W.text,options:W.options}));Q.forEach((W,B)=>{if(!W.text)W.text="";if(W.options=W.options||q||{},B===0&&W.options&&!W.options.bullet&&q.bullet)W.options.bullet=q.bullet;if(typeof W.text==="string"||typeof W.text==="number")W.text=W.text.toString().replace(/\r*\n/g,n0);if(W.text.includes(n0)&&W.text.match(/\n$/g)===null)W.text.split(n0).forEach((V)=>{W.options.breakLine=!0,K.push({text:V,options:W.options})});else K.push(W)});let Z=[],G=[];if(K.forEach((W,B)=>{if(G.length>0&&(W.options.align||q.align)){if(W.options.align!==K[B-1].options.align)Z.push(G),G=[]}else if(G.length>0&&W.options.bullet&&G.length>0)Z.push(G),G=[],W.options.breakLine=!1;if(G.push(W),G.length>0&&W.options.breakLine){if(B+1{var B;let V=!1;J+="";let U=`{if(w.options._lineIdx=F,F>0&&w.options.softBreakBefore)J+="";if(w.options.align=w.options.align||q.align,w.options.lineSpacing=w.options.lineSpacing||q.lineSpacing,w.options.lineSpacingMultiple=w.options.lineSpacingMultiple||q.lineSpacingMultiple,w.options.indentLevel=w.options.indentLevel||q.indentLevel,w.options.paraSpaceBefore=w.options.paraSpaceBefore||q.paraSpaceBefore,w.options.paraSpaceAfter=w.options.paraSpaceAfter||q.paraSpaceAfter,U=qJ(w,!1),J+=U.replace("",""),Object.entries(q).filter(([M])=>!(w.options.hyperlink&&M==="color")).forEach(([M,k])=>{if(M!=="bullet"&&!w.options[M])w.options[M]=k}),J+=bB(w),!w.text&&q.fontSize||w.options.fontSize)V=!0,q.fontSize=q.fontSize||w.options.fontSize}),$._type===D0.tablecell&&(q.fontSize||q.fontFace))if(q.fontFace)J+=`',J+=``,J+=``,J+=``,J+="";else J+=`';else if(V)J+=`';else J+=``;J+=""}),J.indexOf("")===-1)J+="";return J+=$._type===D0.tablecell?"":"",J}function N5($){var q,Q;if(!$)return"";let K=((q=$.options)===null||q===void 0?void 0:q._placeholderIdx)?$.options._placeholderIdx:"",J=((Q=$.options)===null||Q===void 0?void 0:Q._placeholderType)?$.options._placeholderType:"",Z=J&&F8[J]?F8[J].toString():"";return`0?' hasCustomPrompt="1"':""} - />`}function SB($,q,Q){let K=''+n0;return K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',$.forEach((J)=>{(J._relsMedia||[]).forEach((Z)=>{if(Z.type!=="image"&&Z.type!=="online"&&Z.type!=="chart"&&Z.extn!=="m4v"&&!K.includes(Z.type))K+=''})}),K+='',K+='',K+='',K+='',$.forEach((J,Z)=>{K+=``,K+=``,J._relsChart.forEach((G)=>{K+=``})}),K+='',K+='',K+='',K+='',q.forEach((J,Z)=>{K+=``,(J._relsChart||[]).forEach((G)=>{K+=' '})}),$.forEach((J,Z)=>{K+=``}),Q._relsChart.forEach((J)=>{K+=' '}),Q._relsMedia.forEach((J)=>{if(J.type!=="image"&&J.type!=="online"&&J.type!=="chart"&&J.extn!=="m4v"&&!K.includes(J.type))K+=' '}),K+=' ',K+=' ',K+="",K}function EB(){return`${n0} + />`}function dB($,q,Q){let K=''+n0;return K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',$.forEach((J)=>{(J._relsMedia||[]).forEach((Z)=>{if(Z.type!=="image"&&Z.type!=="online"&&Z.type!=="chart"&&Z.extn!=="m4v"&&!K.includes(Z.type))K+=''})}),K+='',K+='',K+='',K+='',$.forEach((J,Z)=>{K+=``,K+=``,J._relsChart.forEach((G)=>{K+=``})}),K+='',K+='',K+='',K+='',q.forEach((J,Z)=>{K+=``,(J._relsChart||[]).forEach((G)=>{K+=' '})}),$.forEach((J,Z)=>{K+=``}),Q._relsChart.forEach((J)=>{K+=' '}),Q._relsMedia.forEach((J)=>{if(J.type!=="image"&&J.type!=="online"&&J.type!=="chart"&&J.extn!=="m4v"&&!K.includes(J.type))K+=' '}),K+=' ',K+=' ',K+="",K}function mB(){return`${n0} - `}function _B($,q){return`${n0} + `}function pB($,q){return`${n0} 0 0 Microsoft Office PowerPoint @@ -103,7 +103,7 @@ ${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F) false false 16.0000 - `}function cB($,q,Q,K){return` + `}function iB($,q,Q,K){return` ${k0($)} ${k0(q)} @@ -112,13 +112,13 @@ ${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F) ${K} ${new Date().toISOString().replace(/\.\d\d\dZ/,"Z")} ${new Date().toISOString().replace(/\.\d\d\dZ/,"Z")} - `}function bB($){let q=1,Q=''+n0;Q+='',Q+='';for(let K=1;K<=$.length;K++)Q+=``;return q++,Q+=``,Q}function nB($){return`${n0}${d7($)}`}function dB($){let q="";return $._slideObjects.forEach((Q)=>{if(Q._type===D0.notes)q+=(Q===null||Q===void 0?void 0:Q.text)&&Q.text[0]?Q.text[0].text:""}),q.replace(/\r*\n/g,n0)}function mB(){return`${n0}7/23/19Click to edit Master text stylesSecond levelThird levelFourth levelFifth level‹#›`}function pB($){return`${n0}${k0(dB($))}${$._slideNum}`}function iB($){return` + `}function oB($){let q=1,Q=''+n0;Q+='',Q+='';for(let K=1;K<=$.length;K++)Q+=``;return q++,Q+=``,Q}function aB($){return`${n0}${d7($)}`}function lB($){let q="";return $._slideObjects.forEach((Q)=>{if(Q._type===D0.notes)q+=(Q===null||Q===void 0?void 0:Q.text)&&Q.text[0]?Q.text[0].text:""}),q.replace(/\r*\n/g,n0)}function rB(){return`${n0}7/23/19Click to edit Master text stylesSecond levelThird levelFourth levelFifth level‹#›`}function sB($){return`${n0}${k0(lB($))}${$._slideNum}`}function tB($){return` ${d7($)} - `}function oB($,q){let Q=q.map((J,Z)=>``),K=''+n0;return K+='',K+=d7($),K+='',K+=""+Q.join("")+"",K+='',K+=' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' ',K+="",K}function aB($,q){return m7(q[$-1],[{target:"../slideMasters/slideMaster1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"}])}function lB($,q,Q){return m7($[Q-1],[{target:`../slideLayouts/slideLayout${eB($,q,Q)}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"},{target:`../notesSlides/notesSlide${Q}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"}])}function rB($){return` + `}function eB($,q){let Q=q.map((J,Z)=>``),K=''+n0;return K+='',K+=d7($),K+='',K+=""+Q.join("")+"",K+='',K+=' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' ',K+="",K}function $z($,q){return m7(q[$-1],[{target:"../slideMasters/slideMaster1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"}])}function Qz($,q,Q){return m7($[Q-1],[{target:`../slideLayouts/slideLayout${Vz($,q,Q)}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"},{target:`../notesSlides/notesSlide${Q}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"}])}function qz($){return` - `}function sB($,q){let Q=q.map((K,J)=>({target:`../slideLayouts/slideLayout${J+1}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"}));return Q.push({target:"../theme/theme1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}),m7($,Q)}function tB(){return`${n0} + `}function Kz($,q){let Q=q.map((K,J)=>({target:`../slideLayouts/slideLayout${J+1}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"}));return Q.push({target:"../theme/theme1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}),m7($,Q)}function Jz(){return`${n0} - `}function eB($,q,Q){for(let K=0;K`:'',G=((K=$.theme)===null||K===void 0?void 0:K.bodyFontFace)?``:'';return`${Z}${G}`}function Qz($){let q=`${n0}`;q+='',q+="",$.slides.forEach((Q)=>q+=``),q+="",q+=``,q+=``,q+=``,q+="";for(let Q=1;Q<10;Q++)q+=``;if(q+="",$.sections&&$.sections.length>0)q+='',q+='',$.sections.forEach((Q)=>{q+=``,Q._slides.forEach((K)=>q+=``),q+=""}),q+="",q+='',q+="";return q+="",q}function qz(){return`${n0}`}function Kz(){return`${n0}`}function Jz(){return`${n0}`}var Vz="4.0.1";class p7{set layout($){let q=this.LAYOUTS[$];if(q)this._layout=$,this._presLayout=q;else throw Error("UNKNOWN-LAYOUT")}get layout(){return this._layout}get version(){return this._version}set author($){this._author=$}get author(){return this._author}set company($){this._company=$}get company(){return this._company}set revision($){this._revision=$}get revision(){return this._revision}set subject($){this._subject=$}get subject(){return this._subject}set theme($){this._theme=$}get theme(){return this._theme}set title($){this._title=$}get title(){return this._title}set rtlMode($){this._rtlMode=$}get rtlMode(){return this._rtlMode}get masterSlide(){return this._masterSlide}get slides(){return this._slides}get sections(){return this._sections}get slideLayouts(){return this._slideLayouts}get AlignH(){return this._alignH}get AlignV(){return this._alignV}get ChartType(){return this._chartType}get OutputType(){return this._outputType}get presLayout(){return this._presLayout}get SchemeColor(){return this._schemeColor}get ShapeType(){return this._shapeType}get charts(){return this._charts}get colors(){return this._colors}get shapes(){return this._shapes}constructor(){this._version=Vz,this._alignH=S7,this._alignV=E7,this._chartType=T7,this._outputType=P7,this._schemeColor=G2,this._shapeType=u7,this._charts=q0,this._colors=L5,this._shapes=B1,this.addNewSlide=(J)=>{let Z=this.sections.length>0&&this.sections[this.sections.length-1]._slides.filter((G)=>G._slideNum===this.slides[this.slides.length-1]._slideNum).length>0;return J.sectionTitle=Z?this.sections[this.sections.length-1].title:null,this.addSlide(J)},this.getSlide=(J)=>this.slides.filter((Z)=>Z._slideNum===J)[0],this.setSlideNumber=(J)=>{this.masterSlide._slideNumberProps=J,this.slideLayouts.filter((Z)=>Z._name===x7)[0]._slideNumberProps=J},this.createChartMediaRels=(J,Z,G)=>{J._relsChart.forEach((W)=>G.push(hB(W,Z))),J._relsMedia.forEach((W)=>{if(W.type!=="online"&&W.type!=="hyperlink"){let B=W.data&&typeof W.data==="string"?W.data:"";if(!B.includes(",")&&!B.includes(";"))B="image/png;base64,"+B;else if(!B.includes(","))B="image/png;base64,"+B;else if(!B.includes(";"))B="image/png;"+B;Z.file(W.Target.replace("..","ppt"),B.split(",").pop(),{base64:!0})}})},this.writeFileToBrowser=(J,Z)=>W2(this,void 0,void 0,function*(){let G=document.createElement("a");if(G.setAttribute("style","display:none;"),G.dataset.interception="off",document.body.appendChild(G),window.URL.createObjectURL){let W=window.URL.createObjectURL(new Blob([Z],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}));return G.href=W,G.download=J,G.click(),setTimeout(()=>{window.URL.revokeObjectURL(W),document.body.removeChild(G)},100),yield Promise.resolve(J)}}),this.exportPresentation=(J)=>W2(this,void 0,void 0,function*(){let Z=[],G=[],W=new c7.default;return this.slides.forEach((B)=>{G=G.concat(h7(B))}),this.slideLayouts.forEach((B)=>{G=G.concat(h7(B))}),G=G.concat(h7(this.masterSlide)),yield Promise.all(G).then(()=>W2(this,void 0,void 0,function*(){return this.slides.forEach((B)=>{if(B._slideLayout)yB(B)}),W.folder("_rels"),W.folder("docProps"),W.folder("ppt").folder("_rels"),W.folder("ppt/charts").folder("_rels"),W.folder("ppt/embeddings"),W.folder("ppt/media"),W.folder("ppt/slideLayouts").folder("_rels"),W.folder("ppt/slideMasters").folder("_rels"),W.folder("ppt/slides").folder("_rels"),W.folder("ppt/theme"),W.folder("ppt/notesMasters").folder("_rels"),W.folder("ppt/notesSlides").folder("_rels"),W.file("[Content_Types].xml",SB(this.slides,this.slideLayouts,this.masterSlide)),W.file("_rels/.rels",EB()),W.file("docProps/app.xml",_B(this.slides,this.company)),W.file("docProps/core.xml",cB(this.title,this.subject,this.author,this.revision)),W.file("ppt/_rels/presentation.xml.rels",bB(this.slides)),W.file("ppt/theme/theme1.xml",$z(this)),W.file("ppt/presentation.xml",Qz(this)),W.file("ppt/presProps.xml",qz()),W.file("ppt/tableStyles.xml",Kz()),W.file("ppt/viewProps.xml",Jz()),this.slideLayouts.forEach((B,V)=>{W.file(`ppt/slideLayouts/slideLayout${V+1}.xml`,iB(B)),W.file(`ppt/slideLayouts/_rels/slideLayout${V+1}.xml.rels`,aB(V+1,this.slideLayouts))}),this.slides.forEach((B,V)=>{W.file(`ppt/slides/slide${V+1}.xml`,nB(B)),W.file(`ppt/slides/_rels/slide${V+1}.xml.rels`,lB(this.slides,this.slideLayouts,V+1)),W.file(`ppt/notesSlides/notesSlide${V+1}.xml`,pB(B)),W.file(`ppt/notesSlides/_rels/notesSlide${V+1}.xml.rels`,rB(V+1))}),W.file("ppt/slideMasters/slideMaster1.xml",oB(this.masterSlide,this.slideLayouts)),W.file("ppt/slideMasters/_rels/slideMaster1.xml.rels",sB(this.masterSlide,this.slideLayouts)),W.file("ppt/notesMasters/notesMaster1.xml",mB()),W.file("ppt/notesMasters/_rels/notesMaster1.xml.rels",tB()),this.slideLayouts.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.slides.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.createChartMediaRels(this.masterSlide,W,Z),yield Promise.all(Z).then(()=>W2(this,void 0,void 0,function*(){if(J.outputType==="STREAM")return yield W.generateAsync({type:"nodebuffer",compression:J.compression?"DEFLATE":"STORE"});else if(J.outputType)return yield W.generateAsync({type:J.outputType});else return yield W.generateAsync({type:"blob",compression:J.compression?"DEFLATE":"STORE"})}))}))});let $={name:"screen4x3",width:9144000,height:6858000},q={name:"screen16x9",width:9144000,height:5143500},Q={name:"screen16x10",width:9144000,height:5715000},K={name:"custom",width:12192000,height:6858000};this.LAYOUTS={LAYOUT_4x3:$,LAYOUT_16x9:q,LAYOUT_16x10:Q,LAYOUT_WIDE:K},this._author="PptxGenJS",this._company="PptxGenJS",this._revision="1",this._subject="PptxGenJS Presentation",this._title="PptxGenJS Presentation",this._presLayout={name:this.LAYOUTS[f6].name,_sizeW:this.LAYOUTS[f6].width,_sizeH:this.LAYOUTS[f6].height,width:this.LAYOUTS[f6].width,height:this.LAYOUTS[f6].height},this._rtlMode=!1,this._slideLayouts=[{_margin:M8,_name:x7,_presLayout:this._presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000,_slideNumberProps:null,_slideObjects:[]}],this._slides=[],this._sections=[],this._masterSlide={addChart:null,addImage:null,addMedia:null,addNotes:null,addShape:null,addTable:null,addText:null,_name:null,_presLayout:this._presLayout,_rId:null,_rels:[],_relsChart:[],_relsMedia:[],_slideId:null,_slideLayout:null,_slideNum:null,_slideNumberProps:null,_slideObjects:[]}}stream($){return W2(this,void 0,void 0,function*(){return yield this.exportPresentation({compression:$===null||$===void 0?void 0:$.compression,outputType:"STREAM"})})}write($){return W2(this,void 0,void 0,function*(){let q=typeof $==="object"&&($===null||$===void 0?void 0:$.outputType)?$.outputType:$?$:null,Q=typeof $==="object"&&($===null||$===void 0?void 0:$.compression)?$.compression:!1;return yield this.exportPresentation({compression:Q,outputType:q})})}writeFile($){return W2(this,void 0,void 0,function*(){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node";if(typeof $==="string")console.warn("[WARNING] writeFile(string) is deprecated - pass { fileName } instead."),$={fileName:$};let{fileName:J="Presentation.pptx",compression:Z=!1}=$,G=J.toLowerCase().endsWith(".pptx")?J:`${J}.pptx`,W=K?"nodebuffer":null,B=yield this.exportPresentation({compression:Z,outputType:W});if(K){let{promises:V}=yield import("node:fs"),{writeFile:U}=V;return yield U(G,B),G}return yield this.writeFileToBrowser(G,B),G})}addSection($){if(!$)console.warn("addSection requires an argument");else if(!$.title)console.warn("addSection requires a title");let q={_type:"user",_slides:[],title:$.title};if($.order)this.sections.splice($.order,0,q);else this._sections.push(q)}addSlide($){let q=typeof $==="string"?$:($===null||$===void 0?void 0:$.masterName)?$.masterName:"",Q={_name:this.LAYOUTS[f6].name,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slideNum:this.slides.length+1};if(q){let J=this.slideLayouts.filter((Z)=>Z._name===q)[0];if(J)Q=J}let K=new FJ({addSlide:this.addNewSlide,getSlide:this.getSlide,presLayout:this.presLayout,setSlideNum:this.setSlideNumber,slideId:this.slides.length+256,slideRId:this.slides.length+2,slideNumber:this.slides.length+1,slideLayout:Q});if(this._slides.push(K),$===null||$===void 0?void 0:$.sectionTitle){let J=this.sections.filter((Z)=>Z.title===$.sectionTitle)[0];if(!J)console.warn(`addSlide: unable to find section with title: "${$.sectionTitle}"`);else J._slides.push(K)}else if(this.sections&&this.sections.length>0&&!($===null||$===void 0?void 0:$.sectionTitle)){let J=this._sections[this.sections.length-1];if(J._type==="default")J._slides.push(K);else this._sections.push({title:`Default-${this.sections.filter((Z)=>Z._type==="default").length+1}`,_type:"default",_slides:[K]})}return K}defineLayout($){if(!$)console.warn("defineLayout requires `{name, width, height}`");else if(!$.name)console.warn("defineLayout requires `name`");else if(!$.width)console.warn("defineLayout requires `width`");else if(!$.height)console.warn("defineLayout requires `height`");else if(typeof $.height!=="number")console.warn("defineLayout `height` should be a number (inches)");else if(typeof $.width!=="number")console.warn("defineLayout `width` should be a number (inches)");this.LAYOUTS[$.name]={name:$.name,_sizeW:Math.round(Number($.width)*L0),_sizeH:Math.round(Number($.height)*L0),width:Math.round(Number($.width)*L0),height:Math.round(Number($.height)*L0)}}defineSlideMaster($){let q=JSON.parse(JSON.stringify($));if(!q.title)throw Error("defineSlideMaster() object argument requires a `title` value. (https://gitbrent.github.io/PptxGenJS/docs/masters.html)");let Q={_margin:q.margin||M8,_name:q.title,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000+this.slideLayouts.length+1,_slideNumberProps:q.slideNumber||null,_slideObjects:[],background:q.background||null,bkgd:q.bkgd||null};if(jB(q,Q),this.slideLayouts.push(Q),q.background||q.bkgd)zJ(q.background,Q);if(Q._slideNumberProps&&!this.masterSlide._slideNumberProps)this.masterSlide._slideNumberProps=Q._slideNumberProps}tableToSlides($,q={}){IB(this,$,q,(q===null||q===void 0?void 0:q.masterSlideName)?this.slideLayouts.filter((Q)=>Q._name===q.masterSlideName)[0]:null)}}if(typeof globalThis.Buffer>"u")globalThis.Buffer=o;if(typeof globalThis.process>"u")globalThis.process=Uz;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.pptxgenjs=p7;})(); + `}function Vz($,q,Q){for(let K=0;K`:'',G=((K=$.theme)===null||K===void 0?void 0:K.bodyFontFace)?``:'';return`${Z}${G}`}function Zz($){let q=`${n0}`;q+='',q+="",$.slides.forEach((Q)=>q+=``),q+="",q+=``,q+=``,q+=``,q+="";for(let Q=1;Q<10;Q++)q+=``;if(q+="",$.sections&&$.sections.length>0)q+='',q+='',$.sections.forEach((Q)=>{q+=``,Q._slides.forEach((K)=>q+=``),q+=""}),q+="",q+='',q+="";return q+="",q}function Gz(){return`${n0}`}function Wz(){return`${n0}`}function Bz(){return`${n0}`}var zz="4.0.1";class p7{set layout($){let q=this.LAYOUTS[$];if(q)this._layout=$,this._presLayout=q;else throw Error("UNKNOWN-LAYOUT")}get layout(){return this._layout}get version(){return this._version}set author($){this._author=$}get author(){return this._author}set company($){this._company=$}get company(){return this._company}set revision($){this._revision=$}get revision(){return this._revision}set subject($){this._subject=$}get subject(){return this._subject}set theme($){this._theme=$}get theme(){return this._theme}set title($){this._title=$}get title(){return this._title}set rtlMode($){this._rtlMode=$}get rtlMode(){return this._rtlMode}get masterSlide(){return this._masterSlide}get slides(){return this._slides}get sections(){return this._sections}get slideLayouts(){return this._slideLayouts}get AlignH(){return this._alignH}get AlignV(){return this._alignV}get ChartType(){return this._chartType}get OutputType(){return this._outputType}get presLayout(){return this._presLayout}get SchemeColor(){return this._schemeColor}get ShapeType(){return this._shapeType}get charts(){return this._charts}get colors(){return this._colors}get shapes(){return this._shapes}constructor(){this._version=zz,this._alignH=S7,this._alignV=E7,this._chartType=T7,this._outputType=P7,this._schemeColor=G2,this._shapeType=u7,this._charts=q0,this._colors=L5,this._shapes=B1,this.addNewSlide=(J)=>{let Z=this.sections.length>0&&this.sections[this.sections.length-1]._slides.filter((G)=>G._slideNum===this.slides[this.slides.length-1]._slideNum).length>0;return J.sectionTitle=Z?this.sections[this.sections.length-1].title:null,this.addSlide(J)},this.getSlide=(J)=>this.slides.filter((Z)=>Z._slideNum===J)[0],this.setSlideNumber=(J)=>{this.masterSlide._slideNumberProps=J,this.slideLayouts.filter((Z)=>Z._name===x7)[0]._slideNumberProps=J},this.createChartMediaRels=(J,Z,G)=>{J._relsChart.forEach((W)=>G.push(SB(W,Z))),J._relsMedia.forEach((W)=>{if(W.type!=="online"&&W.type!=="hyperlink"){let B=W.data&&typeof W.data==="string"?W.data:"";if(!B.includes(",")&&!B.includes(";"))B="image/png;base64,"+B;else if(!B.includes(","))B="image/png;base64,"+B;else if(!B.includes(";"))B="image/png;"+B;Z.file(W.Target.replace("..","ppt"),B.split(",").pop(),{base64:!0})}})},this.writeFileToBrowser=(J,Z)=>W2(this,void 0,void 0,function*(){let G=document.createElement("a");if(G.setAttribute("style","display:none;"),G.dataset.interception="off",document.body.appendChild(G),window.URL.createObjectURL){let W=window.URL.createObjectURL(new Blob([Z],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}));return G.href=W,G.download=J,G.click(),setTimeout(()=>{window.URL.revokeObjectURL(W),document.body.removeChild(G)},100),yield Promise.resolve(J)}}),this.exportPresentation=(J)=>W2(this,void 0,void 0,function*(){let Z=[],G=[],W=new c7.default;return this.slides.forEach((B)=>{G=G.concat(h7(B))}),this.slideLayouts.forEach((B)=>{G=G.concat(h7(B))}),G=G.concat(h7(this.masterSlide)),yield Promise.all(G).then(()=>W2(this,void 0,void 0,function*(){return this.slides.forEach((B)=>{if(B._slideLayout)uB(B)}),W.folder("_rels"),W.folder("docProps"),W.folder("ppt").folder("_rels"),W.folder("ppt/charts").folder("_rels"),W.folder("ppt/embeddings"),W.folder("ppt/media"),W.folder("ppt/slideLayouts").folder("_rels"),W.folder("ppt/slideMasters").folder("_rels"),W.folder("ppt/slides").folder("_rels"),W.folder("ppt/theme"),W.folder("ppt/notesMasters").folder("_rels"),W.folder("ppt/notesSlides").folder("_rels"),W.file("[Content_Types].xml",dB(this.slides,this.slideLayouts,this.masterSlide)),W.file("_rels/.rels",mB()),W.file("docProps/app.xml",pB(this.slides,this.company)),W.file("docProps/core.xml",iB(this.title,this.subject,this.author,this.revision)),W.file("ppt/_rels/presentation.xml.rels",oB(this.slides)),W.file("ppt/theme/theme1.xml",Uz(this)),W.file("ppt/presentation.xml",Zz(this)),W.file("ppt/presProps.xml",Gz()),W.file("ppt/tableStyles.xml",Wz()),W.file("ppt/viewProps.xml",Bz()),this.slideLayouts.forEach((B,V)=>{W.file(`ppt/slideLayouts/slideLayout${V+1}.xml`,tB(B)),W.file(`ppt/slideLayouts/_rels/slideLayout${V+1}.xml.rels`,$z(V+1,this.slideLayouts))}),this.slides.forEach((B,V)=>{W.file(`ppt/slides/slide${V+1}.xml`,aB(B)),W.file(`ppt/slides/_rels/slide${V+1}.xml.rels`,Qz(this.slides,this.slideLayouts,V+1)),W.file(`ppt/notesSlides/notesSlide${V+1}.xml`,sB(B)),W.file(`ppt/notesSlides/_rels/notesSlide${V+1}.xml.rels`,qz(V+1))}),W.file("ppt/slideMasters/slideMaster1.xml",eB(this.masterSlide,this.slideLayouts)),W.file("ppt/slideMasters/_rels/slideMaster1.xml.rels",Kz(this.masterSlide,this.slideLayouts)),W.file("ppt/notesMasters/notesMaster1.xml",rB()),W.file("ppt/notesMasters/_rels/notesMaster1.xml.rels",Jz()),this.slideLayouts.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.slides.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.createChartMediaRels(this.masterSlide,W,Z),yield Promise.all(Z).then(()=>W2(this,void 0,void 0,function*(){if(J.outputType==="STREAM")return yield W.generateAsync({type:"nodebuffer",compression:J.compression?"DEFLATE":"STORE"});else if(J.outputType)return yield W.generateAsync({type:J.outputType});else return yield W.generateAsync({type:"blob",compression:J.compression?"DEFLATE":"STORE"})}))}))});let $={name:"screen4x3",width:9144000,height:6858000},q={name:"screen16x9",width:9144000,height:5143500},Q={name:"screen16x10",width:9144000,height:5715000},K={name:"custom",width:12192000,height:6858000};this.LAYOUTS={LAYOUT_4x3:$,LAYOUT_16x9:q,LAYOUT_16x10:Q,LAYOUT_WIDE:K},this._author="PptxGenJS",this._company="PptxGenJS",this._revision="1",this._subject="PptxGenJS Presentation",this._title="PptxGenJS Presentation",this._presLayout={name:this.LAYOUTS[f6].name,_sizeW:this.LAYOUTS[f6].width,_sizeH:this.LAYOUTS[f6].height,width:this.LAYOUTS[f6].width,height:this.LAYOUTS[f6].height},this._rtlMode=!1,this._slideLayouts=[{_margin:M8,_name:x7,_presLayout:this._presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000,_slideNumberProps:null,_slideObjects:[]}],this._slides=[],this._sections=[],this._masterSlide={addChart:null,addImage:null,addMedia:null,addNotes:null,addShape:null,addTable:null,addText:null,_name:null,_presLayout:this._presLayout,_rId:null,_rels:[],_relsChart:[],_relsMedia:[],_slideId:null,_slideLayout:null,_slideNum:null,_slideNumberProps:null,_slideObjects:[]}}stream($){return W2(this,void 0,void 0,function*(){return yield this.exportPresentation({compression:$===null||$===void 0?void 0:$.compression,outputType:"STREAM"})})}write($){return W2(this,void 0,void 0,function*(){let q=typeof $==="object"&&($===null||$===void 0?void 0:$.outputType)?$.outputType:$?$:null,Q=typeof $==="object"&&($===null||$===void 0?void 0:$.compression)?$.compression:!1;return yield this.exportPresentation({compression:Q,outputType:q})})}writeFile($){return W2(this,void 0,void 0,function*(){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node";if(typeof $==="string")console.warn("[WARNING] writeFile(string) is deprecated - pass { fileName } instead."),$={fileName:$};let{fileName:J="Presentation.pptx",compression:Z=!1}=$,G=J.toLowerCase().endsWith(".pptx")?J:`${J}.pptx`,W=K?"nodebuffer":null,B=yield this.exportPresentation({compression:Z,outputType:W});if(K){let{promises:V}=yield import("node:fs"),{writeFile:U}=V;return yield U(G,B),G}return yield this.writeFileToBrowser(G,B),G})}addSection($){if(!$)console.warn("addSection requires an argument");else if(!$.title)console.warn("addSection requires a title");let q={_type:"user",_slides:[],title:$.title};if($.order)this.sections.splice($.order,0,q);else this._sections.push(q)}addSlide($){let q=typeof $==="string"?$:($===null||$===void 0?void 0:$.masterName)?$.masterName:"",Q={_name:this.LAYOUTS[f6].name,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slideNum:this.slides.length+1};if(q){let J=this.slideLayouts.filter((Z)=>Z._name===q)[0];if(J)Q=J}let K=new FJ({addSlide:this.addNewSlide,getSlide:this.getSlide,presLayout:this.presLayout,setSlideNum:this.setSlideNumber,slideId:this.slides.length+256,slideRId:this.slides.length+2,slideNumber:this.slides.length+1,slideLayout:Q});if(this._slides.push(K),$===null||$===void 0?void 0:$.sectionTitle){let J=this.sections.filter((Z)=>Z.title===$.sectionTitle)[0];if(!J)console.warn(`addSlide: unable to find section with title: "${$.sectionTitle}"`);else J._slides.push(K)}else if(this.sections&&this.sections.length>0&&!($===null||$===void 0?void 0:$.sectionTitle)){let J=this._sections[this.sections.length-1];if(J._type==="default")J._slides.push(K);else this._sections.push({title:`Default-${this.sections.filter((Z)=>Z._type==="default").length+1}`,_type:"default",_slides:[K]})}return K}defineLayout($){if(!$)console.warn("defineLayout requires `{name, width, height}`");else if(!$.name)console.warn("defineLayout requires `name`");else if(!$.width)console.warn("defineLayout requires `width`");else if(!$.height)console.warn("defineLayout requires `height`");else if(typeof $.height!=="number")console.warn("defineLayout `height` should be a number (inches)");else if(typeof $.width!=="number")console.warn("defineLayout `width` should be a number (inches)");this.LAYOUTS[$.name]={name:$.name,_sizeW:Math.round(Number($.width)*L0),_sizeH:Math.round(Number($.height)*L0),width:Math.round(Number($.width)*L0),height:Math.round(Number($.height)*L0)}}defineSlideMaster($){let q=JSON.parse(JSON.stringify($));if(!q.title)throw Error("defineSlideMaster() object argument requires a `title` value. (https://gitbrent.github.io/PptxGenJS/docs/masters.html)");let Q={_margin:q.margin||M8,_name:q.title,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000+this.slideLayouts.length+1,_slideNumberProps:q.slideNumber||null,_slideObjects:[],background:q.background||null,bkgd:q.bkgd||null};if(xB(q,Q),this.slideLayouts.push(Q),q.background||q.bkgd)zJ(q.background,Q);if(Q._slideNumberProps&&!this.masterSlide._slideNumberProps)this.masterSlide._slideNumberProps=Q._slideNumberProps}tableToSlides($,q={}){yB(this,$,q,(q===null||q===void 0?void 0:q.masterSlideName)?this.slideLayouts.filter((Q)=>Q._name===q.masterSlideName)[0]:null)}}if(typeof globalThis.Buffer>"u")globalThis.Buffer=o;if(typeof globalThis.process>"u")globalThis.process=Fz;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.pptxgenjs=p7;})(); diff --git a/apps/sim/lib/invitations/workspace-invitations.ts b/apps/sim/lib/invitations/workspace-invitations.ts index c96c3934fbe..329b746183e 100644 --- a/apps/sim/lib/invitations/workspace-invitations.ts +++ b/apps/sim/lib/invitations/workspace-invitations.ts @@ -30,6 +30,10 @@ import { sendInvitationEmail, } from '@/lib/invitations/send' import { captureServerEvent } from '@/lib/posthog/server' +import { + assertInviteeNotScimManaged, + scimManagedUserPredicate, +} from '@/lib/scim/managed-membership' import { getEffectiveWorkspacePermission, getWorkspaceWithOwner, @@ -477,11 +481,19 @@ export async function createWorkspaceInvitation({ const allWorkspaceIds = context.targets.map((target) => target.workspaceId) const existingUser = await db - .select({ id: user.id }) + .select({ id: user.id, scimManaged: scimManagedUserPredicate(user.id) }) .from(user) .where(sql`lower(${user.email}) = ${normalizedEmail}`) .then((rows) => rows[0]) + /** + * When the organization has made its identity provider the source of truth for + * membership, a Sim invitation to someone the directory already provisions is + * redundant at best and reverted at worst. Read as part of the lookup above so + * the common case costs no extra query. + */ + assertInviteeNotScimManaged(existingUser?.scimManaged) + const existingMembership = existingUser ? await getUserOrganization(existingUser.id) : null let existingOrganizationRole = existingMembership?.role let organizationRoleUpdated = false diff --git a/apps/sim/lib/organizations/members/lifecycle.ts b/apps/sim/lib/organizations/members/lifecycle.ts new file mode 100644 index 00000000000..1b018792521 --- /dev/null +++ b/apps/sim/lib/organizations/members/lifecycle.ts @@ -0,0 +1,207 @@ +import { apiKey, member, organization, session as sessionTable, user } from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { and, eq, isNull, ne, sql } from 'drizzle-orm' +import { + invalidateMembershipCache, + invalidateSecurityPolicyVersionCache, +} from '@/lib/auth/security-policy' +import { acquireOrganizationUserMutationLocks } from '@/lib/billing/organizations/membership' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import type { DbOrTx } from '@/lib/db/types' + +const logger = createLogger('OrganizationMemberLifecycle') + +/** + * Member lifecycle primitives shared by the settings UI and directory + * provisioning. + * + * Before this module each of these lived inline in the route that needed it, and + * two of them did not exist at all: removing a member left their sessions and + * API keys working until the cookie cache lapsed. Directory deprovisioning made + * that gap load-bearing, so the behavior is defined once here. + */ + +/** Why an account is suspended. SCIM only ever lifts a suspension it applied. */ +export type SuspensionSource = 'scim' | 'admin' + +export interface RevokeSessionsResult { + revoked: number +} + +/** + * Deletes a user's sessions and forces cached session cookies in the + * organization to re-read the database. + * + * Both halves commit together. Deleting sessions without bumping the version + * would leave the signed cookie cache authenticating a deleted session for up + * to five minutes, which is precisely the window a deprovisioning exists to + * close. + * + * Impersonation sessions are spared: they are platform support tooling, not the + * member's own access. + */ +export async function revokeUserSessionsTx( + tx: DbOrTx, + params: { userId: string; organizationId: string; spareSessionToken?: string } +): Promise { + const deleted = await tx + .delete(sessionTable) + .where( + and( + eq(sessionTable.userId, params.userId), + isNull(sessionTable.impersonatedBy), + ...(params.spareSessionToken ? [ne(sessionTable.token, params.spareSessionToken)] : []) + ) + ) + .returning({ id: sessionTable.id }) + + await tx + .update(organization) + .set({ securityPolicyVersion: sql`${organization.securityPolicyVersion} + 1` }) + .where(eq(organization.id, params.organizationId)) + + return { revoked: deleted.length } +} + +/** + * Drops the caches that make a revocation visible to the next request. + * + * Separate from the transaction on purpose: an in-process cache cleared before + * the commit lands would be repopulated with the pre-commit answer. + */ +export function invalidateAfterSessionRevocation(params: { + userId: string + organizationId: string +}): void { + invalidateSecurityPolicyVersionCache(params.organizationId) + invalidateMembershipCache(params.userId) +} + +/** + * Deletes a user's personal API keys. + * + * Workspace keys are left alone: they belong to the workspace and are shared, so + * one person's departure must not break every automation using them. + */ +export async function revokePersonalApiKeysTx( + tx: DbOrTx, + params: { userId: string } +): Promise<{ revoked: number }> { + const deleted = await tx + .delete(apiKey) + .where(and(eq(apiKey.userId, params.userId), eq(apiKey.type, 'personal'))) + .returning({ id: apiKey.id }) + return { revoked: deleted.length } +} + +export interface SuspendMemberResult { + suspended: boolean + sessionsRevoked: number + apiKeysRevoked: number +} + +/** + * Suspends an account: sign-in is refused, API keys stop authenticating, and + * everything the person owns is left exactly as it was. + * + * Deliberately not the platform ban. A ban runs `disableUserResources`, which + * archives every workspace the user owns and deletes their API keys, and there + * is no server-side path to undo it. A directory deactivation is routine and + * reversible — someone on leave, or moved between teams — so it must not destroy + * the work they own. + */ +export async function suspendMemberTx( + tx: DbOrTx, + params: { userId: string; organizationId: string; source: SuspensionSource } +): Promise { + await acquireOrganizationUserMutationLocks(tx, { + userId: params.userId, + organizationIds: [params.organizationId], + }) + + const [updated] = await tx + .update(user) + .set({ suspendedAt: new Date(), suspensionSource: params.source, updatedAt: new Date() }) + .where(and(eq(user.id, params.userId), isNull(user.suspendedAt))) + .returning({ id: user.id }) + + const sessions = await revokeUserSessionsTx(tx, { + userId: params.userId, + organizationId: params.organizationId, + }) + const keys = await revokePersonalApiKeysTx(tx, { userId: params.userId }) + + return { + suspended: Boolean(updated), + sessionsRevoked: sessions.revoked, + apiKeysRevoked: keys.revoked, + } +} + +/** + * Lifts a suspension, but only one raised by the same source. + * + * An administrator who suspends someone during an investigation must not have + * that undone by the next directory sync, so a SCIM reactivation leaves an + * `admin` suspension in place. + */ +export async function unsuspendMemberTx( + tx: DbOrTx, + params: { userId: string; source: SuspensionSource } +): Promise<{ unsuspended: boolean }> { + const [updated] = await tx + .update(user) + .set({ suspendedAt: null, suspensionSource: null, updatedAt: new Date() }) + .where(and(eq(user.id, params.userId), eq(user.suspensionSource, params.source))) + .returning({ id: user.id }) + return { unsuspended: Boolean(updated) } +} + +export type OrganizationMemberRole = 'admin' | 'member' + +export type ChangeMemberRoleResult = + | { changed: true; from: string; to: OrganizationMemberRole } + | { changed: false; role: string } + +/** + * Changes a member's organization role. + * + * Ownership is out of scope in both directions: the owner's role cannot be + * lowered here, and no caller can raise someone to owner. Transferring ownership + * moves billing and the last-owner guarantee with it, which is its own operation. + */ +export async function changeMemberRoleTx( + tx: DbOrTx, + params: { organizationId: string; userId: string; role: OrganizationMemberRole } +): Promise { + await acquireOrganizationUserMutationLocks(tx, { + userId: params.userId, + organizationIds: [params.organizationId], + }) + + const [current] = await tx + .select({ id: member.id, role: member.role }) + .from(member) + .where(and(eq(member.organizationId, params.organizationId), eq(member.userId, params.userId))) + .limit(1) + + if (!current) throw new OrchestrationError('not_found', 'Member not found') + if (current.role === 'owner') { + throw new OrchestrationError('conflict', 'The organization owner’s role cannot be changed') + } + if (current.role === params.role) return { changed: false, role: current.role } + + await tx.update(member).set({ role: params.role }).where(eq(member.id, current.id)) + logger.info('Changed organization member role', { + organizationId: params.organizationId, + userId: params.userId, + from: current.role, + to: params.role, + }) + return { changed: true, from: current.role, to: params.role } +} + +/** True when the account is currently suspended. */ +export function isSuspended(row: { suspendedAt: Date | null }): boolean { + return row.suspendedAt !== null +} diff --git a/apps/sim/lib/permission-groups/application/group-membership.ts b/apps/sim/lib/permission-groups/application/group-membership.ts new file mode 100644 index 00000000000..33480f66f1a --- /dev/null +++ b/apps/sim/lib/permission-groups/application/group-membership.ts @@ -0,0 +1,257 @@ +import { permissionGroup, permissionGroupMember, permissionGroupWorkspace } from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import { and, count, eq, inArray, ne } from 'drizzle-orm' +import type { DbOrTx } from '@/lib/db/types' +import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' + +/** + * Permission-group membership as a shared domain primitive. + * + * The conflict rules live here rather than in each caller because there are now + * three: the settings UI, the bulk assignment route, and directory + * provisioning. Two of them predate this module and carried the rules inline; a + * third copy is where they would first diverge. + */ + +/** A user already governed by another group that shares one of these workspaces. */ +export interface PermissionGroupScopeConflict { + userId: string + groupId: string + groupName: string + workspaceId: string +} + +export class PermissionGroupScopeConflictError extends Error { + constructor(readonly conflicts: PermissionGroupScopeConflict[]) { + super('The user is already governed by another permission group on a shared workspace') + this.name = 'PermissionGroupScopeConflictError' + } +} + +export class PermissionGroupAllMembersConflictError extends Error { + constructor(readonly workspaceId: string) { + super( + 'Removing the last member would make this group govern every member of its workspaces, and another group already does' + ) + this.name = 'PermissionGroupAllMembersConflictError' + } +} + +export class PermissionGroupNotFoundError extends Error { + constructor() { + super('Permission group not found') + this.name = 'PermissionGroupNotFoundError' + } +} + +interface LockedGroup { + id: string + name: string + isDefault: boolean + membershipMode: string + workspaceIds: string[] +} + +async function loadLockedGroup( + tx: DbOrTx, + organizationId: string, + groupId: string +): Promise { + const [group] = await tx + .select({ + id: permissionGroup.id, + name: permissionGroup.name, + isDefault: permissionGroup.isDefault, + membershipMode: permissionGroup.membershipMode, + }) + .from(permissionGroup) + .where(and(eq(permissionGroup.id, groupId), eq(permissionGroup.organizationId, organizationId))) + .limit(1) + if (!group) throw new PermissionGroupNotFoundError() + + const workspaces = await tx + .select({ workspaceId: permissionGroupWorkspace.workspaceId }) + .from(permissionGroupWorkspace) + .where(eq(permissionGroupWorkspace.permissionGroupId, groupId)) + + return { ...group, workspaceIds: workspaces.map((row) => row.workspaceId) } +} + +/** Groups other than this one that already govern the given user on a shared workspace. */ +async function findScopeConflicts( + tx: DbOrTx, + params: { organizationId: string; groupId: string; workspaceIds: string[]; userId: string } +): Promise { + if (params.workspaceIds.length === 0) return [] + const rows = await tx + .selectDistinct({ + userId: permissionGroupMember.userId, + groupId: permissionGroup.id, + groupName: permissionGroup.name, + workspaceId: permissionGroupWorkspace.workspaceId, + }) + .from(permissionGroupMember) + .innerJoin(permissionGroup, eq(permissionGroup.id, permissionGroupMember.permissionGroupId)) + .innerJoin( + permissionGroupWorkspace, + eq(permissionGroupWorkspace.permissionGroupId, permissionGroup.id) + ) + .where( + and( + eq(permissionGroup.organizationId, params.organizationId), + eq(permissionGroup.isDefault, false), + ne(permissionGroup.id, params.groupId), + eq(permissionGroupMember.userId, params.userId), + inArray(permissionGroupWorkspace.workspaceId, params.workspaceIds) + ) + ) + return rows +} + +/** + * Another group that would collide once this one starts governing everybody. + * + * Only meaningful for a group in `inherit` mode, where emptying the member list + * widens the group to every member of its workspaces. + */ +async function findAllMembersConflict( + tx: DbOrTx, + params: { organizationId: string; groupId: string; workspaceIds: string[] } +): Promise { + if (params.workspaceIds.length === 0) return null + const rows = await tx + .select({ + groupId: permissionGroup.id, + workspaceId: permissionGroupWorkspace.workspaceId, + memberCount: count(permissionGroupMember.id), + }) + .from(permissionGroup) + .innerJoin( + permissionGroupWorkspace, + eq(permissionGroupWorkspace.permissionGroupId, permissionGroup.id) + ) + .leftJoin( + permissionGroupMember, + eq(permissionGroupMember.permissionGroupId, permissionGroup.id) + ) + .where( + and( + eq(permissionGroup.organizationId, params.organizationId), + eq(permissionGroup.isDefault, false), + eq(permissionGroup.membershipMode, 'inherit'), + ne(permissionGroup.id, params.groupId), + inArray(permissionGroupWorkspace.workspaceId, params.workspaceIds) + ) + ) + .groupBy(permissionGroup.id, permissionGroupWorkspace.workspaceId) + + return rows.find((row) => Number(row.memberCount) === 0)?.workspaceId ?? null +} + +export type AddPermissionGroupMemberResult = 'added' | 'already-member' + +/** + * Adds a user to a permission group. + * + * Takes the organization's permission-group lock, which the lock ordering + * documents as a leaf: acquire no further advisory lock after this one. + */ +export async function addPermissionGroupMemberTx( + tx: DbOrTx, + params: { + organizationId: string + groupId: string + userId: string + assignedBy: string | null + lockTimeoutAlreadyBounded?: boolean + } +): Promise { + await acquirePermissionGroupOrgLock(tx, params.organizationId, { + lockTimeoutAlreadyBounded: params.lockTimeoutAlreadyBounded ?? false, + }) + const group = await loadLockedGroup(tx, params.organizationId, params.groupId) + + const [existing] = await tx + .select({ id: permissionGroupMember.id }) + .from(permissionGroupMember) + .where( + and( + eq(permissionGroupMember.permissionGroupId, params.groupId), + eq(permissionGroupMember.userId, params.userId) + ) + ) + .limit(1) + if (existing) return 'already-member' + + const conflicts = await findScopeConflicts(tx, { + organizationId: params.organizationId, + groupId: params.groupId, + workspaceIds: group.workspaceIds, + userId: params.userId, + }) + if (conflicts.length > 0) throw new PermissionGroupScopeConflictError(conflicts) + + await tx.insert(permissionGroupMember).values({ + id: generateId(), + permissionGroupId: params.groupId, + organizationId: params.organizationId, + userId: params.userId, + assignedBy: params.assignedBy, + assignedAt: new Date(), + }) + return 'added' +} + +export type RemovePermissionGroupMemberResult = 'removed' | 'not-a-member' + +/** Removes a user from a permission group. */ +export async function removePermissionGroupMemberTx( + tx: DbOrTx, + params: { + organizationId: string + groupId: string + userId: string + lockTimeoutAlreadyBounded?: boolean + } +): Promise { + await acquirePermissionGroupOrgLock(tx, params.organizationId, { + lockTimeoutAlreadyBounded: params.lockTimeoutAlreadyBounded ?? false, + }) + const group = await loadLockedGroup(tx, params.organizationId, params.groupId) + + const [member] = await tx + .select({ id: permissionGroupMember.id }) + .from(permissionGroupMember) + .where( + and( + eq(permissionGroupMember.permissionGroupId, params.groupId), + eq(permissionGroupMember.userId, params.userId) + ) + ) + .limit(1) + if (!member) return 'not-a-member' + + /** + * Emptying a non-default group in `inherit` mode flips it from governing + * these users to governing everyone in its workspaces, and only one group may + * do that per workspace. A group in `explicit` mode governs nobody when empty, + * so it cannot collide and the check does not apply. + */ + if (!group.isDefault && group.membershipMode === 'inherit') { + const [remaining] = await tx + .select({ value: count() }) + .from(permissionGroupMember) + .where(eq(permissionGroupMember.permissionGroupId, params.groupId)) + if ((remaining?.value ?? 0) <= 1) { + const conflict = await findAllMembersConflict(tx, { + organizationId: params.organizationId, + groupId: params.groupId, + workspaceIds: group.workspaceIds, + }) + if (conflict) throw new PermissionGroupAllMembersConflictError(conflict) + } + } + + await tx.delete(permissionGroupMember).where(eq(permissionGroupMember.id, member.id)) + return 'removed' +} diff --git a/apps/sim/lib/permission-groups/resolve.server.ts b/apps/sim/lib/permission-groups/resolve.server.ts index cc2bebb91f9..f0511724f07 100644 --- a/apps/sim/lib/permission-groups/resolve.server.ts +++ b/apps/sim/lib/permission-groups/resolve.server.ts @@ -132,8 +132,9 @@ async function resolveDefaultGroup( * `organizationId`). One effective group per workspace, by precedence: * 1. a non-default group targeting this workspace that `userId` is an explicit * member of, else - * 2. a non-default group targeting this workspace that has no explicit members - * — governs all members of the workspace, including external members, else + * 2. a non-default group in `inherit` mode targeting this workspace that has no + * explicit members — governs all members of the workspace, including + * external members, else * 3. the organization's default group (also governs external members), else * 4. `null` (unrestricted). * @@ -142,6 +143,12 @@ async function resolveDefaultGroup( * workspace. If an overlap nonetheless exists, the oldest group wins — rows are * ordered by `created_at` (then `id`). * + * A group in `explicit` membership mode is excluded from step 2: it governs + * exactly its member rows and therefore governs nobody when empty. Directory- + * provisioned groups use that mode, so an identity provider removing the last + * member narrows the group to nobody rather than silently widening it to + * everyone in its workspaces. + * * Callers gate on enterprise entitlement before invoking this and merge the env * allowlist afterwards. */ @@ -164,6 +171,7 @@ export async function resolveWorkspaceGroup( select 1 from ${permissionGroupMember} where ${permissionGroupMember.permissionGroupId} = ${permissionGroup.id} )`, + membershipMode: permissionGroup.membershipMode, }) .from(permissionGroup) .innerJoin( @@ -179,7 +187,8 @@ export async function resolveWorkspaceGroup( .orderBy(asc(permissionGroup.createdAt), asc(permissionGroup.id)) const explicitMemberGroup = rows.find((row) => row.isMember) - const winner = explicitMemberGroup ?? rows.find((row) => !row.hasMembers) + const winner = + explicitMemberGroup ?? rows.find((row) => !row.hasMembers && row.membershipMode === 'inherit') if (winner) { return { diff --git a/apps/sim/lib/posthog/events.ts b/apps/sim/lib/posthog/events.ts index 982f963fa02..4d05734eebd 100644 --- a/apps/sim/lib/posthog/events.ts +++ b/apps/sim/lib/posthog/events.ts @@ -726,6 +726,12 @@ export interface PostHogEventMap { is_self_removal: boolean } + /** A member the organization's identity provider created rather than a person. */ + scim_user_provisioned: { + organization_id: string + created_account: boolean + } + org_member_role_changed: { organization_id: string new_role: string diff --git a/apps/sim/lib/scim/application/admin/manage-connection.ts b/apps/sim/lib/scim/application/admin/manage-connection.ts new file mode 100644 index 00000000000..97f59d46a4d --- /dev/null +++ b/apps/sim/lib/scim/application/admin/manage-connection.ts @@ -0,0 +1,751 @@ +import { AuditAction, AuditResourceType, recordAudit } from '@sim/audit' +import { db } from '@sim/db' +import { + permissionGroup, + SCIM_SCOPES, + type ScimConnectionSettings, + type ScimScope, + scimConnection, + scimCredential, + scimGroup, + scimGroupMapping, + scimGroupMember, + scimRequestLog, + scimUser, + ssoProvider, + workspace, +} from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import { and, count, desc, eq, isNull, sql } from 'drizzle-orm' +import type { + ScimConnectionSettingsInput, + ScimConnectionView, + ScimCredentialView, + ScimGroupMappingView, +} from '@/lib/api/contracts/organization-scim' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { getBaseUrl } from '@/lib/core/utils/urls' +import { defineAuthorizedScimAdminUseCase } from '@/lib/scim/application/authorized-scim-admin-use-case' +import { scimAdminOperations } from '@/lib/scim/application/operations' +import { + activeCredentialCondition, + generateScimToken, + pruneExpiredCredentials, +} from '@/lib/scim/authenticate' +import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' +import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' +import { listScimUserIds } from '@/lib/scim/repository/users' + +/** + * Administering the connection: enabling it, issuing and revoking credentials, + * mapping directory groups onto Sim access, and reading recent activity. + * + * Two credentials may be active at once. That is the whole point of rotation: an + * administrator issues the replacement, updates the directory, confirms it + * works, and only then revokes the old one — with no window where the directory + * cannot authenticate. + */ +const MAX_ACTIVE_CREDENTIALS = 2 + +function scimBaseUrl(): string { + return `${getBaseUrl()}${SCIM_BASE_PATH}` +} + +function toCredentialView(row: { + id: string + tokenPrefix: string + scopes: ScimScope[] + expiresAt: Date | null + lastUsedAt: Date | null + createdAt: Date +}): ScimCredentialView { + return { + id: row.id, + tokenPrefix: row.tokenPrefix, + scopes: row.scopes, + expiresAt: row.expiresAt?.toISOString() ?? null, + lastUsedAt: row.lastUsedAt?.toISOString() ?? null, + createdAt: row.createdAt.toISOString(), + } +} + +async function loadConnectionView(organizationId: string): Promise { + const [row] = await db + .select() + .from(scimConnection) + .where(eq(scimConnection.organizationId, organizationId)) + .limit(1) + if (!row) return null + + const [credentials, [users], [groups]] = await Promise.all([ + db + .select({ + id: scimCredential.id, + tokenPrefix: scimCredential.tokenPrefix, + scopes: scimCredential.scopes, + expiresAt: scimCredential.expiresAt, + lastUsedAt: scimCredential.lastUsedAt, + createdAt: scimCredential.createdAt, + }) + .from(scimCredential) + .where(activeCredentialCondition(row.id)) + .orderBy(desc(scimCredential.createdAt)), + db.select({ value: count() }).from(scimUser).where(eq(scimUser.connectionId, row.id)), + db.select({ value: count() }).from(scimGroup).where(eq(scimGroup.connectionId, row.id)), + ]) + + return { + id: row.id, + status: row.status === 'disabled' ? 'disabled' : 'active', + baseUrl: scimBaseUrl(), + settings: row.settings, + ssoProviderId: row.ssoProviderId, + lastRequestAt: row.lastRequestAt?.toISOString() ?? null, + reconciledAt: row.reconciledAt?.toISOString() ?? null, + createdAt: row.createdAt.toISOString(), + credentials: credentials.map(toCredentialView), + userCount: users?.value ?? 0, + groupCount: groups?.value ?? 0, + } +} + +export const getScimConnection = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.read, + async execute({ input }: { input: { organizationId: string } }) { + return { + connection: await loadConnectionView(input.organizationId), + baseUrl: scimBaseUrl(), + } + }, +}) + +export interface ConfigureScimConnectionInput { + organizationId: string + status?: 'active' | 'disabled' + settings?: ScimConnectionSettingsInput + ssoProviderId?: string | null +} + +export const configureScimConnection = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.configure, + async execute({ + input, + context, + request, + }: { + input: ConfigureScimConnectionInput + context: { organizationId: string; actorUserId: string } + request?: { headers: { get(name: string): string | null } } + }) { + if (input.ssoProviderId) { + const [provider] = await db + .select({ id: ssoProvider.id }) + .from(ssoProvider) + .where( + and( + eq(ssoProvider.id, input.ssoProviderId), + eq(ssoProvider.organizationId, context.organizationId) + ) + ) + .limit(1) + if (!provider) { + throw new OrchestrationError( + 'not_found', + 'That SSO provider does not belong to this organization' + ) + } + } + + const [existing] = await db + .select({ + id: scimConnection.id, + settings: scimConnection.settings, + status: scimConnection.status, + }) + .from(scimConnection) + .where(eq(scimConnection.organizationId, context.organizationId)) + .limit(1) + + const nextSettings: ScimConnectionSettings = { + /** + * Locking manual membership defaults on for a new connection. Once a + * directory owns membership, a change made only in Sim is reverted by the + * next sync, so a member edited by hand looks like it worked and then + * silently does not. + */ + lockManualMembership: true, + ...(existing?.settings ?? {}), + ...(input.settings ?? {}), + } + + const connectionId = existing?.id ?? generateId() + const nextStatus = input.status ?? existing?.status ?? 'active' + + await db.transaction(async (tx) => { + if (existing) { + await tx + .update(scimConnection) + .set({ + status: nextStatus, + settings: nextSettings, + ...(input.ssoProviderId !== undefined ? { ssoProviderId: input.ssoProviderId } : {}), + updatedAt: new Date(), + }) + .where(eq(scimConnection.id, existing.id)) + } else { + await tx.insert(scimConnection).values({ + id: connectionId, + organizationId: context.organizationId, + ssoProviderId: input.ssoProviderId ?? null, + status: nextStatus, + settings: nextSettings, + createdBy: context.actorUserId, + }) + } + + /** + * When the directory is the way in, just-in-time provisioning is turned + * off so a first sign-in cannot create a membership the directory did not + * ask for and will not know about. + */ + if (nextStatus === 'active' && nextSettings.disableJit) { + await tx + .update(ssoProvider) + .set({ jitProvisioningEnabled: false }) + .where(eq(ssoProvider.organizationId, context.organizationId)) + } + }) + + recordAudit({ + workspaceId: null, + actorId: context.actorUserId, + action: + nextStatus === 'active' + ? existing + ? AuditAction.SCIM_CONNECTION_SETTINGS_UPDATED + : AuditAction.SCIM_CONNECTION_ENABLED + : AuditAction.SCIM_CONNECTION_DISABLED, + resourceType: AuditResourceType.SCIM_CONNECTION, + resourceId: connectionId, + metadata: { organizationId: context.organizationId, status: nextStatus }, + request, + }) + + const view = await loadConnectionView(context.organizationId) + if (!view) throw new OrchestrationError('internal', 'The connection could not be read back') + return { connection: view } + }, +}) + +export interface IssueScimCredentialInput { + organizationId: string + scopes?: ScimScope[] + expiresInDays?: number +} + +export const issueScimCredential = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.issueCredential, + async execute({ + input, + context, + request, + }: { + input: IssueScimCredentialInput + context: { organizationId: string; actorUserId: string } + request?: { headers: { get(name: string): string | null } } + }) { + const [connection] = await db + .select({ id: scimConnection.id }) + .from(scimConnection) + .where(eq(scimConnection.organizationId, context.organizationId)) + .limit(1) + if (!connection) { + throw new OrchestrationError( + 'not_found', + 'Enable directory provisioning for this organization before issuing a credential' + ) + } + + /** Sweep lapsed credentials first so an expired one does not hold a slot. */ + await pruneExpiredCredentials(connection.id) + + const [active] = await db + .select({ value: count() }) + .from(scimCredential) + .where(activeCredentialCondition(connection.id)) + if ((active?.value ?? 0) >= MAX_ACTIVE_CREDENTIALS) { + throw new OrchestrationError( + 'conflict', + `At most ${MAX_ACTIVE_CREDENTIALS} credentials may be active at once. Revoke one before issuing another.` + ) + } + + const { secret, hash, prefix } = generateScimToken() + const scopes = input.scopes ?? [...SCIM_SCOPES] + const expiresAt = input.expiresInDays + ? new Date(Date.now() + input.expiresInDays * 24 * 60 * 60 * 1000) + : null + + const [created] = await db + .insert(scimCredential) + .values({ + id: generateId(), + connectionId: connection.id, + tokenHash: hash, + tokenPrefix: prefix, + scopes, + expiresAt, + createdBy: context.actorUserId, + }) + .returning({ + id: scimCredential.id, + tokenPrefix: scimCredential.tokenPrefix, + scopes: scimCredential.scopes, + expiresAt: scimCredential.expiresAt, + lastUsedAt: scimCredential.lastUsedAt, + createdAt: scimCredential.createdAt, + }) + + recordAudit({ + workspaceId: null, + actorId: context.actorUserId, + action: AuditAction.SCIM_CREDENTIAL_ISSUED, + resourceType: AuditResourceType.SCIM_CONNECTION, + resourceId: connection.id, + /** The prefix identifies the credential; the secret is never recorded. */ + metadata: { organizationId: context.organizationId, tokenPrefix: prefix, scopes }, + request, + }) + + return { secret, credential: toCredentialView(created) } + }, +}) + +export const revokeScimCredential = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.revokeCredential, + async execute({ + input, + context, + request, + }: { + input: { organizationId: string; credentialId: string } + context: { organizationId: string; actorUserId: string } + request?: { headers: { get(name: string): string | null } } + }) { + const [revoked] = await db + .update(scimCredential) + .set({ revokedAt: new Date(), revokedBy: context.actorUserId }) + .where( + and( + eq(scimCredential.id, input.credentialId), + isNull(scimCredential.revokedAt), + sql`${scimCredential.connectionId} in ( + select ${scimConnection.id} from ${scimConnection} + where ${scimConnection.organizationId} = ${context.organizationId} + )` + ) + ) + .returning({ id: scimCredential.id, tokenPrefix: scimCredential.tokenPrefix }) + + if (!revoked) throw new OrchestrationError('not_found', 'Credential not found') + + recordAudit({ + workspaceId: null, + actorId: context.actorUserId, + action: AuditAction.SCIM_CREDENTIAL_REVOKED, + resourceType: AuditResourceType.SCIM_CONNECTION, + resourceId: revoked.id, + metadata: { organizationId: context.organizationId, tokenPrefix: revoked.tokenPrefix }, + request, + }) + return { success: true as const } + }, +}) + +export const listScimActivity = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.listActivity, + async execute({ input }: { input: { organizationId: string; limit?: number } }) { + const rows = await db + .select({ + id: scimRequestLog.id, + method: scimRequestLog.method, + path: scimRequestLog.path, + status: scimRequestLog.status, + scimType: scimRequestLog.scimType, + detail: scimRequestLog.detail, + userAgent: scimRequestLog.userAgent, + durationMs: scimRequestLog.durationMs, + createdAt: scimRequestLog.createdAt, + }) + .from(scimRequestLog) + .innerJoin(scimConnection, eq(scimConnection.id, scimRequestLog.connectionId)) + .where(eq(scimConnection.organizationId, input.organizationId)) + .orderBy(desc(scimRequestLog.createdAt)) + .limit(input.limit ?? 50) + + return { + entries: rows.map((row) => ({ ...row, createdAt: row.createdAt.toISOString() })), + } + }, +}) + +function toMappingView(row: { + id: string + groupId: string + groupDisplayName: string + targetKind: string + permissionGroupId: string | null + workspaceId: string | null + permissionType: 'admin' | 'write' | 'read' | null + role: string | null +}): ScimGroupMappingView { + return { + id: row.id, + groupId: row.groupId, + groupDisplayName: row.groupDisplayName, + targetKind: row.targetKind as ScimGroupMappingView['targetKind'], + permissionGroupId: row.permissionGroupId, + workspaceId: row.workspaceId, + permissionType: row.permissionType, + role: row.role, + } +} + +export const listScimGroupMappings = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.read, + async execute({ input }: { input: { organizationId: string } }) { + const [connection] = await db + .select({ id: scimConnection.id }) + .from(scimConnection) + .where(eq(scimConnection.organizationId, input.organizationId)) + .limit(1) + if (!connection) return { groups: [] } + + const groups = await db + .select({ id: scimGroup.id, displayName: scimGroup.displayName }) + .from(scimGroup) + .where(eq(scimGroup.connectionId, connection.id)) + .orderBy(scimGroup.displayName) + + const mappings = await db + .select({ + id: scimGroupMapping.id, + groupId: scimGroupMapping.groupId, + groupDisplayName: scimGroup.displayName, + targetKind: scimGroupMapping.targetKind, + permissionGroupId: scimGroupMapping.permissionGroupId, + workspaceId: scimGroupMapping.workspaceId, + permissionType: scimGroupMapping.permissionType, + role: scimGroupMapping.role, + }) + .from(scimGroupMapping) + .innerJoin(scimGroup, eq(scimGroup.id, scimGroupMapping.groupId)) + .where(eq(scimGroup.connectionId, connection.id)) + + const counts = await db + .select({ groupId: scimGroupMember.groupId, value: count() }) + .from(scimGroupMember) + .innerJoin(scimGroup, eq(scimGroup.id, scimGroupMember.groupId)) + .where(eq(scimGroup.connectionId, connection.id)) + .groupBy(scimGroupMember.groupId) + + const memberCounts = new Map(counts.map((row) => [row.groupId, Number(row.value)])) + + return { + groups: groups.map((group) => ({ + id: group.id, + displayName: group.displayName, + memberCount: memberCounts.get(group.id) ?? 0, + mappings: mappings.filter((row) => row.groupId === group.id).map(toMappingView), + })), + } + }, +}) + +export type UpsertScimGroupMappingInput = { organizationId: string } & ( + | { targetKind: 'permission_group'; groupId: string; permissionGroupId: string } + | { + targetKind: 'workspace' + groupId: string + workspaceId: string + permissionType: 'admin' | 'write' | 'read' + } + | { targetKind: 'org_role'; groupId: string; role: 'admin' } +) + +/** Re-runs the projection for every member of a group whose mapping changed. */ +async function reconcileGroupMembers(params: { + connectionId: string + organizationId: string + groupId: string + settings: ScimConnectionSettings +}): Promise { + const members = await db + .select({ scimUserId: scimGroupMember.scimUserId }) + .from(scimGroupMember) + .where(eq(scimGroupMember.groupId, params.groupId)) + + await db.transaction(async (tx) => { + for (const { scimUserId } of members) { + await reconcileUserProjection(tx, { + connectionId: params.connectionId, + organizationId: params.organizationId, + scimUserId, + settings: params.settings, + }) + } + }) + return members.length +} + +export const upsertScimGroupMapping = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.upsertMapping, + async execute({ + input, + context, + request, + }: { + input: UpsertScimGroupMappingInput + context: { organizationId: string; actorUserId: string } + request?: { headers: { get(name: string): string | null } } + }) { + const [connection] = await db + .select({ id: scimConnection.id, settings: scimConnection.settings }) + .from(scimConnection) + .where(eq(scimConnection.organizationId, context.organizationId)) + .limit(1) + if (!connection) + throw new OrchestrationError('not_found', 'Directory provisioning is not enabled') + + const [group] = await db + .select({ id: scimGroup.id, displayName: scimGroup.displayName }) + .from(scimGroup) + .where(and(eq(scimGroup.id, input.groupId), eq(scimGroup.connectionId, connection.id))) + .limit(1) + if (!group) throw new OrchestrationError('not_found', 'Directory group not found') + + if (input.targetKind === 'permission_group') { + const [target] = await db + .select({ id: permissionGroup.id, membershipMode: permissionGroup.membershipMode }) + .from(permissionGroup) + .where( + and( + eq(permissionGroup.id, input.permissionGroupId), + eq(permissionGroup.organizationId, context.organizationId) + ) + ) + .limit(1) + if (!target) { + throw new OrchestrationError( + 'not_found', + 'That permission group does not belong to this organization' + ) + } + /** + * A directory-managed group must govern exactly its members. Left in + * `inherit` mode, the directory removing the last person would widen it + * from "these people" to "everyone in these workspaces". + */ + if (target.membershipMode !== 'explicit') { + await db + .update(permissionGroup) + .set({ membershipMode: 'explicit', updatedAt: new Date() }) + .where(eq(permissionGroup.id, target.id)) + } + } + + if (input.targetKind === 'workspace') { + const [target] = await db + .select({ id: workspace.id }) + .from(workspace) + .where( + and( + eq(workspace.id, input.workspaceId), + eq(workspace.organizationId, context.organizationId) + ) + ) + .limit(1) + if (!target) { + throw new OrchestrationError( + 'not_found', + 'That workspace does not belong to this organization' + ) + } + } + + const values = { + id: generateId(), + groupId: group.id, + targetKind: input.targetKind, + permissionGroupId: input.targetKind === 'permission_group' ? input.permissionGroupId : null, + workspaceId: input.targetKind === 'workspace' ? input.workspaceId : null, + permissionType: input.targetKind === 'workspace' ? input.permissionType : null, + role: input.targetKind === 'org_role' ? input.role : null, + createdBy: context.actorUserId, + } + + /** + * Selected, then inserted or updated, rather than an upsert. The uniqueness + * index is on a `coalesce` of the three target columns, which is an + * expression rather than a column list and so cannot be named as a conflict + * target. + */ + const mappingColumns = { + id: scimGroupMapping.id, + groupId: scimGroupMapping.groupId, + targetKind: scimGroupMapping.targetKind, + permissionGroupId: scimGroupMapping.permissionGroupId, + workspaceId: scimGroupMapping.workspaceId, + permissionType: scimGroupMapping.permissionType, + role: scimGroupMapping.role, + } + const targetId = values.permissionGroupId ?? values.workspaceId ?? values.role + const [existingMapping] = await db + .select({ id: scimGroupMapping.id }) + .from(scimGroupMapping) + .where( + and( + eq(scimGroupMapping.groupId, group.id), + eq(scimGroupMapping.targetKind, input.targetKind), + sql`coalesce(${scimGroupMapping.permissionGroupId}, ${scimGroupMapping.workspaceId}, ${scimGroupMapping.role}) = ${targetId}` + ) + ) + .limit(1) + + const [mapping] = existingMapping + ? await db + .update(scimGroupMapping) + .set({ permissionType: values.permissionType }) + .where(eq(scimGroupMapping.id, existingMapping.id)) + .returning(mappingColumns) + : await db.insert(scimGroupMapping).values(values).returning(mappingColumns) + + const reconciledUsers = await reconcileGroupMembers({ + connectionId: connection.id, + organizationId: context.organizationId, + groupId: group.id, + settings: connection.settings, + }) + + recordAudit({ + workspaceId: null, + actorId: context.actorUserId, + action: AuditAction.SCIM_GROUP_MAPPING_UPSERTED, + resourceType: AuditResourceType.SCIM_GROUP, + resourceId: group.id, + resourceName: group.displayName, + metadata: { organizationId: context.organizationId, targetKind: input.targetKind }, + request, + }) + + return { + mapping: toMappingView({ ...mapping, groupDisplayName: group.displayName }), + reconciledUsers, + } + }, +}) + +export const deleteScimGroupMapping = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.deleteMapping, + async execute({ + input, + context, + request, + }: { + input: { organizationId: string; mappingId: string } + context: { organizationId: string; actorUserId: string } + request?: { headers: { get(name: string): string | null } } + }) { + const [connection] = await db + .select({ id: scimConnection.id, settings: scimConnection.settings }) + .from(scimConnection) + .where(eq(scimConnection.organizationId, context.organizationId)) + .limit(1) + if (!connection) + throw new OrchestrationError('not_found', 'Directory provisioning is not enabled') + + const [mapping] = await db + .select({ id: scimGroupMapping.id, groupId: scimGroupMapping.groupId }) + .from(scimGroupMapping) + .innerJoin(scimGroup, eq(scimGroup.id, scimGroupMapping.groupId)) + .where( + and(eq(scimGroupMapping.id, input.mappingId), eq(scimGroup.connectionId, connection.id)) + ) + .limit(1) + if (!mapping) throw new OrchestrationError('not_found', 'Mapping not found') + + await db.delete(scimGroupMapping).where(eq(scimGroupMapping.id, mapping.id)) + + const reconciledUsers = await reconcileGroupMembers({ + connectionId: connection.id, + organizationId: context.organizationId, + groupId: mapping.groupId, + settings: connection.settings, + }) + + recordAudit({ + workspaceId: null, + actorId: context.actorUserId, + action: AuditAction.SCIM_GROUP_MAPPING_DELETED, + resourceType: AuditResourceType.SCIM_GROUP, + resourceId: mapping.groupId, + metadata: { organizationId: context.organizationId, mappingId: mapping.id }, + request, + }) + + return { success: true as const, reconciledUsers } + }, +}) + +export const reconcileScimConnection = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.reconcile, + async execute({ input }: { input: { organizationId: string } }) { + const [connection] = await db + .select({ id: scimConnection.id, settings: scimConnection.settings }) + .from(scimConnection) + .where(eq(scimConnection.organizationId, input.organizationId)) + .limit(1) + if (!connection) + throw new OrchestrationError('not_found', 'Directory provisioning is not enabled') + + let reconciledUsers = 0 + let grantsAdded = 0 + let grantsRemoved = 0 + let cursor: string | undefined + + /** + * Paged rather than loaded whole: a large directory has tens of thousands of + * users, and one transaction over all of them would hold locks far too long. + */ + for (;;) { + const page = await listScimUserIds(db, { + connectionId: connection.id, + ...(cursor ? { afterOrderKey: cursor } : {}), + limit: 200, + }) + if (page.length === 0) break + + await db.transaction(async (tx) => { + for (const row of page) { + const delta = await reconcileUserProjection(tx, { + connectionId: connection.id, + organizationId: input.organizationId, + scimUserId: row.id, + settings: connection.settings, + }) + reconciledUsers += 1 + grantsAdded += delta.added.length + delta.raised.length + grantsRemoved += delta.removed.length + } + }) + cursor = page[page.length - 1].orderKey + } + + await db + .update(scimConnection) + .set({ reconciledAt: new Date() }) + .where(eq(scimConnection.id, connection.id)) + + return { reconciledUsers, grantsAdded, grantsRemoved } + }, +}) diff --git a/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts b/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts new file mode 100644 index 00000000000..05ec285d297 --- /dev/null +++ b/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts @@ -0,0 +1,96 @@ +import type { Principal } from '@sim/auth/principal' +import { db } from '@sim/db' +import { member } from '@sim/db/schema' +import { and, eq } from 'drizzle-orm' +import { isOrganizationFeatureEntitled } from '@/lib/billing/core/subscription' +import { ForbiddenOperationError, type OperationUseCase } from '@/lib/core/application' +import { isScimEnabled } from '@/lib/core/config/env-flags' +import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' +import type { ScimAdminOperation, ScimAdminPrincipal } from '@/lib/scim/application/operations' + +/** + * The authorized wrapper for administering a connection from the settings UI. + * + * Gate order is deliberate and each step is its own refusal, so a failure says + * which rule stopped it: principal kind, then organization membership, then the + * admin role, then the entitlement. Mirrors the organization BYOK and usage + * wrappers rather than inventing a fourth shape. + */ + +export interface ScimAdminContext { + organizationId: string + actorUserId: string +} + +interface AuthorizedScimAdminDefinition< + O extends ScimAdminOperation, + I extends { organizationId: string }, + R, +> { + operation: O + execute(args: { + principal: ScimAdminPrincipal + input: I + context: ScimAdminContext + request?: OrchestrationRequestContext + }): Promise +} + +function requireScimAdminPrincipal( + principal: Principal, + operation: ScimAdminOperation +): asserts principal is ScimAdminPrincipal { + if (principal.kind !== 'session') { + throw new ForbiddenOperationError( + 'PRINCIPAL_KIND_NOT_PERMITTED', + `Principal kind ${principal.kind} cannot perform operation ${operation.id}` + ) + } +} + +export function defineAuthorizedScimAdminUseCase< + const O extends ScimAdminOperation, + I extends { organizationId: string }, + R, +>(definition: AuthorizedScimAdminDefinition): OperationUseCase { + return { + operation: definition.operation, + async execute({ principal, input, request }) { + requireScimAdminPrincipal(principal, definition.operation) + + const [membership] = await db + .select({ role: member.role }) + .from(member) + .where( + and(eq(member.organizationId, input.organizationId), eq(member.userId, principal.userId)) + ) + .limit(1) + + if (!membership) { + throw new ForbiddenOperationError( + 'ORGANIZATION_MEMBERSHIP_REQUIRED', + 'Not a member of the requested organization' + ) + } + if (!definition.operation.organizationRoles.some((role) => role === membership.role)) { + throw new ForbiddenOperationError( + 'ORGANIZATION_ADMIN_REQUIRED', + 'Organization admin or owner role required' + ) + } + if (!(await isOrganizationFeatureEntitled(input.organizationId, isScimEnabled))) { + throw new ForbiddenOperationError( + 'ENTERPRISE_PLAN_REQUIRED', + 'Directory provisioning requires an active enterprise subscription' + ) + } + + return definition.execute({ + principal, + input, + context: { organizationId: input.organizationId, actorUserId: principal.userId }, + request, + }) + }, + } +} diff --git a/apps/sim/lib/scim/application/authorized-scim-use-case.ts b/apps/sim/lib/scim/application/authorized-scim-use-case.ts new file mode 100644 index 00000000000..1d16b855713 --- /dev/null +++ b/apps/sim/lib/scim/application/authorized-scim-use-case.ts @@ -0,0 +1,187 @@ +import { type AuditActionType, type AuditResourceTypeValue, recordAudit } from '@sim/audit' +import type { Principal } from '@sim/auth/principal' +import { resolvePrincipalAuditAttribution } from '@sim/auth/principal' +import { db } from '@sim/db' +import { type ScimConnectionSettings, scimConnection } from '@sim/db/schema' +import { eq } from 'drizzle-orm' +import type { OperationUseCase } from '@/lib/core/application' +import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' +import { getBaseUrl } from '@/lib/core/utils/urls' +import type { ScimOperation, ScimPrincipal } from '@/lib/scim/application/operations' +import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' +import { ScimError } from '@/lib/scim/protocol/errors' + +/** + * The authorized wrapper every directory operation runs inside. + * + * It owns the lifecycle the application boundary prescribes — principal check, + * canonical load, authorization, execute, audit projection, post-commit effects + * — for an operation whose scope is an organization rather than a workspace, so + * it cannot use `defineAuthorizedWorkspaceUseCase`. + */ + +export interface ScimUseCaseContext { + connection: { + id: string + organizationId: string + settings: ScimConnectionSettings + } + organizationId: string + /** Absolute base for `meta.location` and `$ref`, e.g. `https://sim.ai/api/scim/v2`. */ + baseUrl: string +} + +export interface ScimAuditEntry { + action: AuditActionType + resourceType: AuditResourceTypeValue + resourceId?: string + resourceName?: string + description?: string + metadata?: Record +} + +export interface ScimUseCaseArgs { + principal: ScimPrincipal + input: I + context: ScimUseCaseContext + request?: OrchestrationRequestContext +} + +export interface ScimUseCaseResultArgs extends ScimUseCaseArgs { + result: R +} + +interface AuthorizedScimUseCaseDefinition { + operation: O + execute(args: ScimUseCaseArgs): Promise + projectAudit?(args: ScimUseCaseResultArgs): ScimAuditEntry | ScimAuditEntry[] | undefined + afterSuccess?(args: ScimUseCaseResultArgs): Promise +} + +function requireScimPrincipal( + principal: Principal, + operation: ScimOperation +): asserts principal is ScimPrincipal { + if (principal.kind !== 'scim_connection') { + throw new Error( + `Operation ${operation.id} reached by principal kind ${principal.kind}, which its policy does not name` + ) + } +} + +/** + * Records semantic audit for a directory change. + * + * The actor is the connection, never a person: nobody was at a keyboard when the + * directory synchronized, and naming the administrator who configured it would + * attribute months of automated changes to one login. + */ +function recordScimAudit( + operation: ScimOperation, + principal: ScimPrincipal, + context: ScimUseCaseContext, + request: OrchestrationRequestContext | undefined, + entries: readonly ScimAuditEntry[] +): void { + const attribution = resolvePrincipalAuditAttribution(principal) + for (const entry of entries) { + recordAudit({ + workspaceId: null, + actorId: attribution.actorId, + actorName: attribution.actorName, + action: entry.action, + resourceType: entry.resourceType, + resourceId: entry.resourceId, + resourceName: entry.resourceName, + description: entry.description, + metadata: { + ...entry.metadata, + organizationId: context.organizationId, + connectionId: context.connection.id, + credentialId: principal.credentialId, + operation: operation.id, + source: 'scim', + actor: attribution.actor, + }, + request, + }) + } +} + +/** + * Re-reads the connection on every operation. + * + * Authentication already resolved it, but a long-running provisioning cycle can + * outlive an administrator disabling the connection. Reading it here means the + * next request in that cycle stops, rather than the cycle continuing until its + * credential happens to be checked again. + */ +async function loadActiveConnection( + connectionId: string +): Promise { + const [row] = await db + .select({ + id: scimConnection.id, + organizationId: scimConnection.organizationId, + status: scimConnection.status, + settings: scimConnection.settings, + }) + .from(scimConnection) + .where(eq(scimConnection.id, connectionId)) + .limit(1) + + if (!row || row.status !== 'active') { + throw new ScimError(401, undefined, 'Invalid SCIM credential', { + 'WWW-Authenticate': 'Bearer realm="SCIM"', + }) + } + return { id: row.id, organizationId: row.organizationId, settings: row.settings } +} + +export function defineAuthorizedScimUseCase( + definition: AuthorizedScimUseCaseDefinition +): OperationUseCase { + return { + operation: definition.operation, + async execute({ principal, input, request }) { + requireScimPrincipal(principal, definition.operation) + + if (!principal.scopes.includes(definition.operation.scope)) { + throw new ScimError( + 403, + undefined, + `The credential does not carry the ${definition.operation.scope} scope` + ) + } + + const connection = await loadActiveConnection(principal.connectionId) + if (connection.organizationId !== principal.organizationId) { + /** + * Unreachable through the authenticator, which reads both from the same + * joined row. Asserted anyway because every query below is scoped by the + * connection alone, so a mismatch here would be a cross-tenant read. + */ + throw new Error('SCIM connection organization does not match its principal') + } + + const context: ScimUseCaseContext = { + connection, + organizationId: connection.organizationId, + baseUrl: `${getBaseUrl()}${SCIM_BASE_PATH}`, + } + + const result = await definition.execute({ principal, input, context, request }) + const resultArgs = { principal, input, context, request, result } + + const projected = definition.projectAudit?.(resultArgs) + const entries = + projected === undefined ? [] : Array.isArray(projected) ? projected : [projected] + if (entries.length > 0) { + recordScimAudit(definition.operation, principal, context, request, entries) + } + + await definition.afterSuccess?.(resultArgs) + return result + }, + } +} diff --git a/apps/sim/lib/scim/application/groups/manage-groups.ts b/apps/sim/lib/scim/application/groups/manage-groups.ts new file mode 100644 index 00000000000..0e37b137cae --- /dev/null +++ b/apps/sim/lib/scim/application/groups/manage-groups.ts @@ -0,0 +1,405 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import { db } from '@sim/db' +import { scimGroup } from '@sim/db/schema' +import { and, eq, ne } from 'drizzle-orm' +import type { ScimPatchOperation } from '@/lib/api/contracts/scim' +import type { DbOrTx } from '@/lib/db/types' +import { + defineAuthorizedScimUseCase, + type ScimUseCaseArgs, +} from '@/lib/scim/application/authorized-scim-use-case' +import { scimOperations } from '@/lib/scim/application/operations' +import { reconcileUsersProjection } from '@/lib/scim/projection/reconcile-user' +import type { CanonicalScimGroup } from '@/lib/scim/protocol/canonical' +import { SCIM_MAX_GROUP_MEMBERS } from '@/lib/scim/protocol/constants' +import { invalidValue, notFound, ScimError, uniqueness } from '@/lib/scim/protocol/errors' +import { parseGroupFilter } from '@/lib/scim/protocol/filter' +import { parseGroupPatch } from '@/lib/scim/protocol/group-patch' +import { + projectionWants, + projectResource, + resolvePage, + type ScimAttributeProjection, + type ScimGroupResource, + toGroupResource, +} from '@/lib/scim/protocol/resources' +import { + addGroupMember, + assertConnectionOwnsUsers, + countGroupMembers, + deleteScimGroup, + findScimGroupById, + insertScimGroup, + loadGroupMemberIds, + loadGroupMembers, + pageScimGroups, + removeGroupMember, + touchScimGroup, + updateScimGroup, +} from '@/lib/scim/repository/groups' + +/** Reads and writes of the Group resource, and the projection each change triggers. */ + +async function assertDisplayNameAvailable( + tx: DbOrTx, + params: { connectionId: string; displayName: string; exceptGroupId?: string } +): Promise { + const [clash] = await tx + .select({ id: scimGroup.id }) + .from(scimGroup) + .where( + and( + eq(scimGroup.connectionId, params.connectionId), + eq(scimGroup.displayNameKey, params.displayName.toLowerCase()), + ...(params.exceptGroupId ? [ne(scimGroup.id, params.exceptGroupId)] : []) + ) + ) + .limit(1) + if (clash) uniquenessThrow(params.displayName) +} + +function uniquenessThrow(displayName: string): never { + throw uniqueness(`A group named ${displayName} already exists in this directory`) +} + +async function assertMemberCount(tx: DbOrTx, groupId: string): Promise { + const total = await countGroupMembers(tx, groupId) + if (total > SCIM_MAX_GROUP_MEMBERS) { + throw invalidValue(`A Group cannot carry more than ${SCIM_MAX_GROUP_MEMBERS} members`) + } +} + +export interface ListScimGroupsInput { + filter?: string | undefined + startIndex?: number | undefined + count?: number | undefined + projection: ScimAttributeProjection +} + +export const listScimGroups = defineAuthorizedScimUseCase({ + operation: scimOperations.listGroups, + async execute({ input, context }: ScimUseCaseArgs) { + const page = resolvePage({ startIndex: input.startIndex, count: input.count }) + const filters = input.filter ? parseGroupFilter(input.filter) : [] + const { records, totalResults } = await pageScimGroups(db, { + connectionId: context.connection.id, + filters, + offset: page.offset, + limit: page.count, + }) + + /** + * Microsoft Entra lists groups with `excludedAttributes=members` on every + * cycle. Honoring that skips the membership query entirely rather than + * loading thousands of rows only to drop them. + */ + const wantsMembers = projectionWants(input.projection, 'members') + const resources: ScimGroupResource[] = [] + for (const record of records) { + const members = wantsMembers ? await loadGroupMembers(db, record.id) : undefined + resources.push( + projectResource( + toGroupResource({ ...record, ...(members ? { members } : {}) }, context.baseUrl), + input.projection + ) + ) + } + + return { resources, totalResults, startIndex: page.startIndex } + }, +}) + +export interface GetScimGroupInput { + groupId: string + projection: ScimAttributeProjection +} + +export const getScimGroup = defineAuthorizedScimUseCase({ + operation: scimOperations.readGroup, + async execute({ input, context }: ScimUseCaseArgs) { + const record = await findScimGroupById(db, context.connection.id, input.groupId) + if (!record) throw notFound('SCIM Group not found') + /** + * Okta requires the member list on a bare read, so `members` is included + * unless the request explicitly excluded it. + */ + const members = projectionWants(input.projection, 'members') + ? await loadGroupMembers(db, record.id) + : undefined + return projectResource( + toGroupResource({ ...record, ...(members ? { members } : {}) }, context.baseUrl), + input.projection + ) + }, +}) + +export interface CreateScimGroupInput { + group: CanonicalScimGroup +} + +export interface ScimGroupWriteResult { + groupId: string + displayName: string + resource: ScimGroupResource + touchedUserIds: string[] +} + +export const createScimGroup = defineAuthorizedScimUseCase({ + operation: scimOperations.writeGroup, + async execute({ + input, + context, + }: ScimUseCaseArgs): Promise { + const { group } = input + return db.transaction(async (tx) => { + await assertDisplayNameAvailable(tx, { + connectionId: context.connection.id, + displayName: group.displayName, + }) + await assertConnectionOwnsUsers(tx, context.connection.id, group.memberIds) + + const created = await insertScimGroup(tx, { + connectionId: context.connection.id, + displayName: group.displayName, + externalId: group.externalId, + }) + for (const scimUserId of group.memberIds) { + await addGroupMember(tx, { groupId: created.id, scimUserId }) + } + await assertMemberCount(tx, created.id) + + await reconcileUsersProjection(tx, { + connectionId: context.connection.id, + organizationId: context.organizationId, + scimUserIds: group.memberIds, + settings: context.connection.settings, + }) + + const members = await loadGroupMembers(tx, created.id) + return { + groupId: created.id, + displayName: created.displayName, + resource: toGroupResource({ ...created, members }, context.baseUrl), + touchedUserIds: group.memberIds, + } + }) + }, + projectAudit: ({ result }) => ({ + action: AuditAction.SCIM_GROUP_CREATED, + resourceType: AuditResourceType.SCIM_GROUP, + resourceId: result.groupId, + resourceName: result.displayName, + metadata: { memberCount: result.touchedUserIds.length }, + }), +}) + +export interface ReplaceScimGroupInput { + groupId: string + group: CanonicalScimGroup +} + +export const replaceScimGroup = defineAuthorizedScimUseCase({ + operation: scimOperations.writeGroup, + async execute({ + input, + context, + }: ScimUseCaseArgs): Promise { + return db.transaction(async (tx) => { + const current = await findScimGroupById(tx, context.connection.id, input.groupId) + if (!current) throw notFound('SCIM Group not found') + + await assertDisplayNameAvailable(tx, { + connectionId: context.connection.id, + displayName: input.group.displayName, + exceptGroupId: current.id, + }) + await assertConnectionOwnsUsers(tx, context.connection.id, input.group.memberIds) + + await updateScimGroup(tx, { + groupId: current.id, + displayName: input.group.displayName, + externalId: input.group.externalId ?? null, + }) + + const before = await loadGroupMemberIds(tx, current.id) + const desired = new Set(input.group.memberIds) + const touched = new Set() + + for (const scimUserId of before) { + if (desired.has(scimUserId)) continue + await removeGroupMember(tx, { groupId: current.id, scimUserId }) + touched.add(scimUserId) + } + for (const scimUserId of desired) { + if (await addGroupMember(tx, { groupId: current.id, scimUserId })) touched.add(scimUserId) + } + await assertMemberCount(tx, current.id) + + await reconcileUsersProjection(tx, { + connectionId: context.connection.id, + organizationId: context.organizationId, + scimUserIds: [...touched], + settings: context.connection.settings, + }) + + const refreshed = await findScimGroupById(tx, context.connection.id, current.id) + if (!refreshed) throw new ScimError(500, undefined, 'The group could not be read back') + const members = await loadGroupMembers(tx, current.id) + return { + groupId: current.id, + displayName: refreshed.displayName, + resource: toGroupResource({ ...refreshed, members }, context.baseUrl), + touchedUserIds: [...touched], + } + }) + }, + projectAudit: ({ result }) => ({ + action: AuditAction.SCIM_GROUP_UPDATED, + resourceType: AuditResourceType.SCIM_GROUP, + resourceId: result.groupId, + resourceName: result.displayName, + metadata: { membersChanged: result.touchedUserIds.length }, + }), +}) + +export interface PatchScimGroupInput { + groupId: string + operations: readonly ScimPatchOperation[] +} + +export interface PatchScimGroupResult { + groupId: string + displayName: string + touchedUserIds: string[] + renamed: boolean +} + +export const patchScimGroup = defineAuthorizedScimUseCase({ + operation: scimOperations.writeGroup, + async execute({ + input, + context, + }: ScimUseCaseArgs): Promise { + const patch = parseGroupPatch(input.operations) + + return db.transaction(async (tx) => { + const current = await findScimGroupById(tx, context.connection.id, input.groupId) + if (!current) throw notFound('SCIM Group not found') + + const touched = new Set() + let renamed = false + + const applyAdds = async (ids: string[]) => { + await assertConnectionOwnsUsers(tx, context.connection.id, ids) + for (const scimUserId of ids) { + if (await addGroupMember(tx, { groupId: current.id, scimUserId })) touched.add(scimUserId) + } + } + const applyRemoves = async (ids: string[]) => { + for (const scimUserId of ids) { + if (await removeGroupMember(tx, { groupId: current.id, scimUserId })) { + touched.add(scimUserId) + } + } + } + + if (patch.kind === 'incremental') { + await applyAdds(patch.add) + await applyRemoves(patch.remove) + } else { + if (patch.displayName !== undefined && patch.displayName !== current.displayName) { + await assertDisplayNameAvailable(tx, { + connectionId: context.connection.id, + displayName: patch.displayName, + exceptGroupId: current.id, + }) + renamed = true + } + if (patch.displayName !== undefined || patch.externalId !== undefined) { + await updateScimGroup(tx, { + groupId: current.id, + ...(patch.displayName !== undefined ? { displayName: patch.displayName } : {}), + ...(patch.externalId !== undefined ? { externalId: patch.externalId } : {}), + }) + } + if (patch.members !== undefined) { + const before = await loadGroupMemberIds(tx, current.id) + const desired = new Set(patch.members) + await applyRemoves(before.filter((id) => !desired.has(id))) + await applyAdds([...desired].filter((id) => !before.includes(id))) + } + await applyAdds(patch.addMembers) + await applyRemoves(patch.removeMembers) + } + + await assertMemberCount(tx, current.id) + if (touched.size > 0) await touchScimGroup(tx, current.id) + + await reconcileUsersProjection(tx, { + connectionId: context.connection.id, + organizationId: context.organizationId, + scimUserIds: [...touched], + settings: context.connection.settings, + }) + + return { + groupId: current.id, + displayName: + patch.kind === 'full' ? (patch.displayName ?? current.displayName) : current.displayName, + touchedUserIds: [...touched], + renamed, + } + }) + }, + /** A patch that moved nobody and renamed nothing records nothing. */ + projectAudit: ({ result }) => + result.touchedUserIds.length === 0 && !result.renamed + ? undefined + : { + action: AuditAction.SCIM_GROUP_MEMBERSHIP_CHANGED, + resourceType: AuditResourceType.SCIM_GROUP, + resourceId: result.groupId, + resourceName: result.displayName, + metadata: { membersChanged: result.touchedUserIds.length, renamed: result.renamed }, + }, +}) + +export interface DeleteScimGroupInput { + groupId: string +} + +export const deleteScimGroupUseCase = defineAuthorizedScimUseCase({ + operation: scimOperations.deleteGroup, + async execute({ input, context }: ScimUseCaseArgs) { + return db.transaction(async (tx) => { + const current = await findScimGroupById(tx, context.connection.id, input.groupId) + if (!current) throw notFound('SCIM Group not found') + + /** + * Members are read before the delete cascades their rows away, because + * each of them loses whatever access the group's mappings granted and the + * projection has to be re-run for them afterwards. + */ + const memberIds = await loadGroupMemberIds(tx, current.id) + await deleteScimGroup(tx, current.id) + await reconcileUsersProjection(tx, { + connectionId: context.connection.id, + organizationId: context.organizationId, + scimUserIds: memberIds, + settings: context.connection.settings, + }) + return { + groupId: current.id, + displayName: current.displayName, + memberCount: memberIds.length, + } + }) + }, + projectAudit: ({ result }) => ({ + action: AuditAction.SCIM_GROUP_DELETED, + resourceType: AuditResourceType.SCIM_GROUP, + resourceId: result.groupId, + resourceName: result.displayName, + metadata: { memberCount: result.memberCount }, + }), +}) diff --git a/apps/sim/lib/scim/application/operations.ts b/apps/sim/lib/scim/application/operations.ts new file mode 100644 index 00000000000..0790347ee8e --- /dev/null +++ b/apps/sim/lib/scim/application/operations.ts @@ -0,0 +1,216 @@ +import type { Principal, ScimCredentialScope } from '@sim/auth/principal' +import type { ApplicationOperation } from '@/lib/core/application' +import { assertOperationCapability } from '@/lib/core/application' + +/** + * The semantic operations of directory provisioning. + * + * SCIM has its own operation type rather than reusing `defineWorkspaceOperation` + * for the same reason organization BYOK does: the caller has no workspace and no + * role in one. Its authority is the credential the organization issued, and the + * only policy left to declare is which credential scope each operation needs. + */ + +export type ScimPrincipal = Extract + +export interface ScimOperation extends ApplicationOperation { + readonly authority: 'scim_connection' + readonly principalKinds: readonly ['scim_connection'] + readonly scope: ScimCredentialScope +} + +function defineScimOperation( + operation: ScimOperation +): ScimOperation { + assertOperationCapability(operation) + Object.freeze(operation.principalKinds) + return Object.freeze(operation) +} + +export const scimOperations = { + // permission-group-exempt: the caller is the organization's identity provider, not a member a permission group can govern + listUsers: defineScimOperation({ + id: 'scim.users.list', + capability: 'none', + authority: 'scim_connection', + principalKinds: ['scim_connection'], + scope: 'users:read', + }), + // permission-group-exempt: the caller is the organization's identity provider, not a member a permission group can govern + readUser: defineScimOperation({ + id: 'scim.users.read', + capability: 'none', + authority: 'scim_connection', + principalKinds: ['scim_connection'], + scope: 'users:read', + }), + // permission-group-exempt: the caller is the organization's identity provider, not a member a permission group can govern + provisionUser: defineScimOperation({ + id: 'scim.users.provision', + capability: 'none', + authority: 'scim_connection', + principalKinds: ['scim_connection'], + scope: 'users:write', + }), + // permission-group-exempt: the caller is the organization's identity provider, not a member a permission group can govern + updateUser: defineScimOperation({ + id: 'scim.users.update', + capability: 'none', + authority: 'scim_connection', + principalKinds: ['scim_connection'], + scope: 'users:write', + }), + // permission-group-exempt: the caller is the organization's identity provider, not a member a permission group can govern + deprovisionUser: defineScimOperation({ + id: 'scim.users.deprovision', + capability: 'none', + authority: 'scim_connection', + principalKinds: ['scim_connection'], + scope: 'users:write', + }), + // permission-group-exempt: the caller is the organization's identity provider, not a member a permission group can govern + listGroups: defineScimOperation({ + id: 'scim.groups.list', + capability: 'none', + authority: 'scim_connection', + principalKinds: ['scim_connection'], + scope: 'groups:read', + }), + // permission-group-exempt: the caller is the organization's identity provider, not a member a permission group can govern + readGroup: defineScimOperation({ + id: 'scim.groups.read', + capability: 'none', + authority: 'scim_connection', + principalKinds: ['scim_connection'], + scope: 'groups:read', + }), + // permission-group-exempt: the caller is the organization's identity provider, not a member a permission group can govern + writeGroup: defineScimOperation({ + id: 'scim.groups.write', + capability: 'none', + authority: 'scim_connection', + principalKinds: ['scim_connection'], + scope: 'groups:write', + }), + // permission-group-exempt: the caller is the organization's identity provider, not a member a permission group can govern + deleteGroup: defineScimOperation({ + id: 'scim.groups.delete', + capability: 'none', + authority: 'scim_connection', + principalKinds: ['scim_connection'], + scope: 'groups:write', + }), +} as const + +/** + * Administration of the connection itself, performed by a person in the Sim + * settings UI rather than by the directory. + * + * Separate from the operations above because the authority is different in kind: + * an organization owner or admin holding a session, gated on the enterprise + * entitlement. Mirrors the organization BYOK operation shape. + */ +export interface ScimAdminOperation extends ApplicationOperation { + readonly authority: 'organization_admin' + readonly organizationRoles: readonly ['admin', 'owner'] + readonly principalKinds: readonly ['session'] + readonly workspaceApiKey: 'deny' +} + +export type ScimAdminPrincipal = Extract + +function defineScimAdminOperation( + operation: ScimAdminOperation +): ScimAdminOperation { + assertOperationCapability(operation) + Object.freeze(operation.organizationRoles) + Object.freeze(operation.principalKinds) + return Object.freeze(operation) +} + +const ADMIN_ROLES = ['admin', 'owner'] as const +const ADMIN_PRINCIPALS = ['session'] as const + +/** + * Each operation spells its policy out rather than spreading a shared literal. + * `check:permission-group-enforcement` reads these declarations from source, and + * a spread hides the capability from it — leaving the operation unaudited, which + * is exactly the gap that check exists to catch. + */ +export const scimAdminOperations = { + // permission-group-exempt: directory configuration is an owner/admin organization setting, like SSO provider registration + read: defineScimAdminOperation({ + id: 'scim.connection.read', + capability: 'none', + authority: 'organization_admin', + organizationRoles: ADMIN_ROLES, + principalKinds: ADMIN_PRINCIPALS, + workspaceApiKey: 'deny', + }), + // permission-group-exempt: directory configuration is an owner/admin organization setting, like SSO provider registration + configure: defineScimAdminOperation({ + id: 'scim.connection.configure', + capability: 'none', + authority: 'organization_admin', + organizationRoles: ADMIN_ROLES, + principalKinds: ADMIN_PRINCIPALS, + workspaceApiKey: 'deny', + }), + // permission-group-exempt: directory configuration is an owner/admin organization setting, like SSO provider registration + issueCredential: defineScimAdminOperation({ + id: 'scim.credential.issue', + capability: 'none', + authority: 'organization_admin', + organizationRoles: ADMIN_ROLES, + principalKinds: ADMIN_PRINCIPALS, + workspaceApiKey: 'deny', + }), + // permission-group-exempt: directory configuration is an owner/admin organization setting, like SSO provider registration + revokeCredential: defineScimAdminOperation({ + id: 'scim.credential.revoke', + capability: 'none', + authority: 'organization_admin', + organizationRoles: ADMIN_ROLES, + principalKinds: ADMIN_PRINCIPALS, + workspaceApiKey: 'deny', + }), + // permission-group-exempt: directory configuration is an owner/admin organization setting, like SSO provider registration + upsertMapping: defineScimAdminOperation({ + id: 'scim.group_mapping.upsert', + capability: 'none', + authority: 'organization_admin', + organizationRoles: ADMIN_ROLES, + principalKinds: ADMIN_PRINCIPALS, + workspaceApiKey: 'deny', + }), + // permission-group-exempt: directory configuration is an owner/admin organization setting, like SSO provider registration + deleteMapping: defineScimAdminOperation({ + id: 'scim.group_mapping.delete', + capability: 'none', + authority: 'organization_admin', + organizationRoles: ADMIN_ROLES, + principalKinds: ADMIN_PRINCIPALS, + workspaceApiKey: 'deny', + }), + // permission-group-exempt: directory configuration is an owner/admin organization setting, like SSO provider registration + listActivity: defineScimAdminOperation({ + id: 'scim.activity.list', + capability: 'none', + authority: 'organization_admin', + organizationRoles: ADMIN_ROLES, + principalKinds: ADMIN_PRINCIPALS, + workspaceApiKey: 'deny', + }), + // permission-group-exempt: directory configuration is an owner/admin organization setting, like SSO provider registration + reconcile: defineScimAdminOperation({ + id: 'scim.connection.reconcile', + capability: 'none', + authority: 'organization_admin', + organizationRoles: ADMIN_ROLES, + principalKinds: ADMIN_PRINCIPALS, + workspaceApiKey: 'deny', + }), +} as const + +export type AnyScimOperation = (typeof scimOperations)[keyof typeof scimOperations] +export type AnyScimAdminOperation = (typeof scimAdminOperations)[keyof typeof scimAdminOperations] diff --git a/apps/sim/lib/scim/application/users/deprovision-user.ts b/apps/sim/lib/scim/application/users/deprovision-user.ts new file mode 100644 index 00000000000..d4cc1a55906 --- /dev/null +++ b/apps/sim/lib/scim/application/users/deprovision-user.ts @@ -0,0 +1,154 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import { db } from '@sim/db' +import { member } from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { and, eq } from 'drizzle-orm' +import { removeUserFromOrganization } from '@/lib/billing/organizations/membership' +import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' +import { + invalidateAfterSessionRevocation, + revokePersonalApiKeysTx, + revokeUserSessionsTx, + unsuspendMemberTx, +} from '@/lib/organizations/members/lifecycle' +import { + defineAuthorizedScimUseCase, + type ScimUseCaseArgs, +} from '@/lib/scim/application/authorized-scim-use-case' +import { scimOperations } from '@/lib/scim/application/operations' +import { upsertTombstone } from '@/lib/scim/identity/resolve-user' +import { withdrawAllProjectedGrants } from '@/lib/scim/projection/reconcile-user' +import { notFound, ScimError } from '@/lib/scim/protocol/errors' +import { deleteScimUser, findScimUserById } from '@/lib/scim/repository/users' + +const logger = createLogger('ScimDeprovisionUser') + +export interface DeprovisionScimUserInput { + scimUserId: string +} + +export interface DeprovisionScimUserResult { + scimUserId: string + userId: string +} + +/** + * Removes a user from the organization at the directory's instruction. + * + * Okta never sends this — it deactivates instead — but Microsoft Entra does, 30 + * days after a hard delete, and OneLogin and JumpCloud can be configured to. The + * Sim account itself survives: the person may hold access in another + * organization later, and their audit history must remain attributable. + */ +export const deprovisionScimUser = defineAuthorizedScimUseCase({ + operation: scimOperations.deprovisionUser, + async execute({ + input, + context, + }: ScimUseCaseArgs): Promise { + const current = await findScimUserById(db, context.connection.id, input.scimUserId) + if (!current) throw notFound('SCIM User not found') + + const [membership] = await db + .select({ id: member.id, role: member.role }) + .from(member) + .where( + and(eq(member.organizationId, context.organizationId), eq(member.userId, current.userId)) + ) + .limit(1) + + /** + * The owner is refused. Removing them would leave the organization with + * nobody able to administer billing or transfer ownership, and a directory + * cannot know that Sim treats one member differently. + */ + if (membership?.role === 'owner') { + throw new ScimError( + 409, + undefined, + 'The organization owner cannot be deprovisioned through the directory. Transfer ownership in Sim first.' + ) + } + + /** + * Withdraw directory-granted access first, in its own transaction, so the + * removal below sees a user with nothing left to reassign from a group. + */ + await db.transaction(async (tx) => { + await withdrawAllProjectedGrants(tx, { + connectionId: context.connection.id, + organizationId: context.organizationId, + scimUserId: current.id, + userId: current.userId, + }) + }) + + if (membership) { + /** + * Owns its own invitation-safe lock scope and reassigns everything the + * member owned, so it runs on its own rather than inside a transaction + * this use case controls. + */ + const removal = await removeUserFromOrganization({ + userId: current.userId, + organizationId: context.organizationId, + memberId: membership.id, + }) + if (!removal.success) { + throw new ScimError(409, undefined, removal.error ?? 'The member could not be removed') + } + } + + await db.transaction(async (tx) => { + await revokeUserSessionsTx(tx, { + userId: current.userId, + organizationId: context.organizationId, + }) + await revokePersonalApiKeysTx(tx, { userId: current.userId }) + /** A suspension the directory applied has no meaning once membership ends. */ + await unsuspendMemberTx(tx, { userId: current.userId, source: 'scim' }) + + if (current.externalId) { + await upsertTombstone(tx, { + connectionId: context.connection.id, + externalId: current.externalId, + userId: current.userId, + }) + } + await deleteScimUser(tx, current.id) + }) + + return { scimUserId: current.id, userId: current.userId } + }, + + projectAudit: ({ result, context }) => [ + { + action: AuditAction.SCIM_USER_DEPROVISIONED, + resourceType: AuditResourceType.USER, + resourceId: result.userId, + metadata: { scimUserId: result.scimUserId }, + }, + { + action: AuditAction.ORG_MEMBER_REMOVED, + resourceType: AuditResourceType.ORGANIZATION, + resourceId: context.organizationId, + description: 'Removed from the organization through directory deprovisioning', + metadata: { targetUserId: result.userId, scimUserId: result.scimUserId }, + }, + ], + + afterSuccess: async ({ result, context }) => { + invalidateAfterSessionRevocation({ + userId: result.userId, + organizationId: context.organizationId, + }) + try { + await reconcileOrganizationSeats({ + organizationId: context.organizationId, + reason: 'scim-member-removed', + }) + } catch (error) { + logger.error('Failed to reconcile seats after directory deprovisioning', { error }) + } + }, +}) diff --git a/apps/sim/lib/scim/application/users/provision-user.ts b/apps/sim/lib/scim/application/users/provision-user.ts new file mode 100644 index 00000000000..17cdb91d0ec --- /dev/null +++ b/apps/sim/lib/scim/application/users/provision-user.ts @@ -0,0 +1,246 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import { db } from '@sim/db' +import { type ScimUserAttributes, subscription } from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { and, desc, eq, inArray } from 'drizzle-orm' +import { auth } from '@/lib/auth' +import { applySessionPolicyToNewMember } from '@/lib/auth/session-policy' +import { syncUsageLimitsFromSubscription } from '@/lib/billing/core/usage' +import { ensureUserInOrganizationTx } from '@/lib/billing/organizations/membership' +import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' +import { isTeam } from '@/lib/billing/plan-helpers' +import { ENTITLED_SUBSCRIPTION_STATUSES } from '@/lib/billing/subscriptions/utils' +import type { DbOrTx } from '@/lib/db/types' +import { suspendMemberTx } from '@/lib/organizations/members/lifecycle' +import { captureServerEvent } from '@/lib/posthog/server' +import { + defineAuthorizedScimUseCase, + type ScimUseCaseArgs, +} from '@/lib/scim/application/authorized-scim-use-case' +import { scimOperations } from '@/lib/scim/application/operations' +import { + assertEmailAvailable, + consumeTombstone, + resolveProvisionedIdentity, +} from '@/lib/scim/identity/resolve-user' +import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' +import { primaryEmail } from '@/lib/scim/protocol/canonical' +import { ScimError, uniqueness } from '@/lib/scim/protocol/errors' +import { toUserResource } from '@/lib/scim/protocol/resources' +import { + findScimUserById, + findScimUserByUserId, + insertScimUser, + toUserResourceRow, +} from '@/lib/scim/repository/users' + +const logger = createLogger('ScimProvisionUser') + +export interface ProvisionScimUserInput { + attributes: ScimUserAttributes +} + +export interface ProvisionScimUserResult { + scimUserId: string + userId: string + createdAccount: boolean + organizationId: string + resource: ReturnType +} + +/** + * Whether this organization's plan lets membership grow on demand. + * + * Team plans add a seat when someone joins; Enterprise buys a fixed number in + * advance and must refuse beyond it. The same rule governs SSO just-in-time + * provisioning, so a directory and a first sign-in agree on who fits. + */ +async function resolveSeatPolicy( + tx: DbOrTx, + organizationId: string +): Promise<{ skipSeatValidation?: true; organizationSubscriptionId?: string }> { + const [entitled] = await tx + .select({ id: subscription.id, plan: subscription.plan }) + .from(subscription) + .where( + and( + eq(subscription.referenceId, organizationId), + inArray(subscription.status, ENTITLED_SUBSCRIPTION_STATUSES) + ) + ) + .orderBy(desc(subscription.periodStart), desc(subscription.id)) + .limit(1) + + return { + ...(isTeam(entitled?.plan) ? { skipSeatValidation: true as const } : {}), + ...(entitled?.id ? { organizationSubscriptionId: entitled.id } : {}), + } +} + +/** Turns a membership refusal into the SCIM error a directory administrator can act on. */ +function membershipFailure(code: string | undefined): ScimError { + if (code === 'no-seats-available') { + return new ScimError( + 409, + undefined, + 'This organization has no available seats. Add seats in Sim, then retry provisioning.' + ) + } + if (code === 'already-in-other-organization') { + return uniqueness('This user already belongs to a different Sim organization') + } + return new ScimError(409, undefined, 'The user could not be added to the organization') +} + +/** + * Creates a user resource, and the Sim account behind it when there is not one + * already. + */ +export const provisionScimUser = defineAuthorizedScimUseCase({ + operation: scimOperations.provisionUser, + async execute({ + input, + context, + }: ScimUseCaseArgs): Promise { + const { attributes } = input + const email = primaryEmail(attributes) + + /** + * Account creation happens before the transaction because it runs through + * Better Auth, which owns its own writes and its own hooks — the blocked + * email gate, the usage-counter row, and instance-organization placement all + * hang off them. Reimplementing that with a direct insert would skip every + * one. + */ + const resolution = await resolveProvisionedIdentity(db, { + connectionId: context.connection.id, + organizationId: context.organizationId, + attributes, + }) + + let userId: string + let createdAccount = false + + if (resolution.action === 'create') { + await assertEmailAvailable(db, email) + const created = await auth.api.createUser({ + body: { + email, + name: attributes.name.formatted, + data: { emailVerified: false }, + }, + }) + userId = created.user.id + createdAccount = true + } else { + userId = resolution.userId + } + + const existing = await findScimUserByUserId(db, context.connection.id, userId) + if (existing) { + throw uniqueness('This directory already provisions the user') + } + + const scimUserId = await db.transaction(async (tx) => { + const seatPolicy = await resolveSeatPolicy(tx, context.organizationId) + const membership = await ensureUserInOrganizationTx(tx, { + userId, + organizationId: context.organizationId, + role: 'member', + ...seatPolicy, + }) + if (!membership.success) throw membershipFailure(membership.failureCode) + + const inserted = await insertScimUser(tx, { + connectionId: context.connection.id, + userId, + attributes, + active: attributes.active, + }) + + /** + * Microsoft Entra pre-provisions a disabled account before its start date, + * so a create can arrive already inactive and must land suspended rather + * than briefly usable. + */ + if (!attributes.active) { + await suspendMemberTx(tx, { + userId, + organizationId: context.organizationId, + source: 'scim', + }) + } + + await consumeTombstone(tx, { + connectionId: context.connection.id, + externalId: attributes.externalId, + }) + await reconcileUserProjection(tx, { + connectionId: context.connection.id, + organizationId: context.organizationId, + scimUserId: inserted.id, + settings: context.connection.settings, + }) + return inserted.id + }) + + const record = await findScimUserById(db, context.connection.id, scimUserId) + if (!record) throw new ScimError(500, undefined, 'The provisioned user could not be read back') + + return { + scimUserId, + userId, + createdAccount, + organizationId: context.organizationId, + resource: toUserResource(toUserResourceRow(record, []), context.baseUrl), + } + }, + + projectAudit: ({ result }) => [ + { + action: AuditAction.SCIM_USER_PROVISIONED, + resourceType: AuditResourceType.USER, + resourceId: result.userId, + metadata: { scimUserId: result.scimUserId, createdAccount: result.createdAccount }, + }, + { + action: AuditAction.ORG_MEMBER_ADDED, + resourceType: AuditResourceType.ORGANIZATION, + resourceId: result.organizationId, + description: 'Joined the organization through directory provisioning', + metadata: { memberRole: 'member', scimUserId: result.scimUserId }, + }, + ], + + /** + * Post-commit effects mirror what SSO just-in-time admission runs, each + * guarded on its own: a failure to reconcile seats must not undo a membership + * that is already committed and already correct. + */ + afterSuccess: async ({ result, context }) => { + try { + await applySessionPolicyToNewMember(result.userId, context.organizationId) + } catch (error) { + logger.error('Failed to apply session policy to a provisioned member', { error }) + } + try { + await reconcileOrganizationSeats({ + organizationId: context.organizationId, + reason: 'scim-member-added', + }) + } catch (error) { + logger.error('Failed to reconcile seats after directory provisioning', { error }) + } + try { + await syncUsageLimitsFromSubscription(result.userId) + } catch (error) { + logger.error('Failed to sync usage limits after directory provisioning', { error }) + } + captureServerEvent( + result.userId, + 'scim_user_provisioned', + { organization_id: context.organizationId, created_account: result.createdAccount }, + { groups: { organization: context.organizationId } } + ) + }, +}) diff --git a/apps/sim/lib/scim/application/users/read-users.ts b/apps/sim/lib/scim/application/users/read-users.ts new file mode 100644 index 00000000000..7c2dde2ecfa --- /dev/null +++ b/apps/sim/lib/scim/application/users/read-users.ts @@ -0,0 +1,105 @@ +import { db } from '@sim/db' +import { + defineAuthorizedScimUseCase, + type ScimUseCaseArgs, +} from '@/lib/scim/application/authorized-scim-use-case' +import { scimOperations } from '@/lib/scim/application/operations' +import { notFound } from '@/lib/scim/protocol/errors' +import { parseUserFilter } from '@/lib/scim/protocol/filter' +import { + projectionWants, + projectResource, + resolvePage, + type ScimAttributeProjection, + type ScimUserResource, + toListResponse, + toUserResource, +} from '@/lib/scim/protocol/resources' +import { + findScimUserById, + loadGroupsForScimUsers, + pageScimUsers, + toUserResourceRow, +} from '@/lib/scim/repository/users' + +export interface ListScimUsersInput { + filter?: string | undefined + startIndex?: number | undefined + count?: number | undefined + projection: ScimAttributeProjection +} + +export interface ListScimUsersResult { + resources: ScimUserResource[] + totalResults: number + startIndex: number +} + +export const listScimUsers = defineAuthorizedScimUseCase({ + operation: scimOperations.listUsers, + async execute({ input, context }: ScimUseCaseArgs) { + const page = resolvePage({ startIndex: input.startIndex, count: input.count }) + const filters = input.filter ? parseUserFilter(input.filter) : [] + + const { records, totalResults } = await pageScimUsers(db, { + connectionId: context.connection.id, + filters, + offset: page.offset, + limit: page.count, + }) + + /** + * The group join is skipped when the request excluded `groups`. Microsoft + * Entra pages every user on an initial cycle, so avoiding a per-page join it + * did not ask for is the difference between one query and two at scale. + */ + const wantsGroups = projectionWants(input.projection, 'groups') + const groupsByUser = wantsGroups + ? await loadGroupsForScimUsers( + db, + records.map((record) => record.id) + ) + : new Map>() + + const resources = records.map((record) => + projectResource( + toUserResource( + toUserResourceRow(record, groupsByUser.get(record.id) ?? []), + context.baseUrl + ), + input.projection + ) + ) + + return { resources, totalResults, startIndex: page.startIndex } + }, +}) + +export interface GetScimUserInput { + scimUserId: string + projection: ScimAttributeProjection +} + +export const getScimUser = defineAuthorizedScimUseCase({ + operation: scimOperations.readUser, + async execute({ input, context }: ScimUseCaseArgs) { + const record = await findScimUserById(db, context.connection.id, input.scimUserId) + /** + * A resource belonging to another connection is reported as absent rather + * than forbidden. Distinguishing the two would confirm that an id exists in + * some other tenant. + */ + if (!record) throw notFound('SCIM User not found') + + const groups = projectionWants(input.projection, 'groups') + ? ((await loadGroupsForScimUsers(db, [record.id])).get(record.id) ?? []) + : [] + + return projectResource( + toUserResource(toUserResourceRow(record, groups), context.baseUrl), + input.projection + ) + }, +}) + +export { toListResponse } diff --git a/apps/sim/lib/scim/application/users/update-user.ts b/apps/sim/lib/scim/application/users/update-user.ts new file mode 100644 index 00000000000..18fb0333a2c --- /dev/null +++ b/apps/sim/lib/scim/application/users/update-user.ts @@ -0,0 +1,258 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import { db } from '@sim/db' +import { type ScimUserAttributes, user } from '@sim/db/schema' +import { normalizeEmail } from '@sim/utils/string' +import { eq } from 'drizzle-orm' +import type { ScimPatchOperation } from '@/lib/api/contracts/scim' +import type { DbOrTx } from '@/lib/db/types' +import { + invalidateAfterSessionRevocation, + revokeUserSessionsTx, + suspendMemberTx, + unsuspendMemberTx, +} from '@/lib/organizations/members/lifecycle' +import { + defineAuthorizedScimUseCase, + type ScimAuditEntry, + type ScimUseCaseArgs, + type ScimUseCaseContext, +} from '@/lib/scim/application/authorized-scim-use-case' +import { scimOperations } from '@/lib/scim/application/operations' +import { assertDomainOwned, assertEmailAvailable } from '@/lib/scim/identity/resolve-user' +import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' +import { primaryEmail } from '@/lib/scim/protocol/canonical' +import { notFound, ScimError } from '@/lib/scim/protocol/errors' +import { toUserResource } from '@/lib/scim/protocol/resources' +import { applyUserPatch } from '@/lib/scim/protocol/user-patch' +import { + findScimUserById, + loadGroupsForScimUsers, + type ScimUserRecord, + toUserResourceRow, + updateScimUser, +} from '@/lib/scim/repository/users' + +/** + * The write half of the User resource. + * + * `PUT` and `PATCH` differ only in how they arrive at the next resource — one + * carries it whole, the other as operations against the stored copy. They share + * everything after that, so the two cannot drift on what an email change or a + * deactivation actually does. + */ + +export interface UpdateOutcome { + emailChanged: boolean + deactivated: boolean + reactivated: boolean + changed: boolean +} + +async function applyUserUpdate( + tx: DbOrTx, + context: ScimUseCaseContext, + current: ScimUserRecord, + next: ScimUserAttributes +): Promise { + const nextEmail = primaryEmail(next) + const emailChanged = normalizeEmail(nextEmail) !== normalizeEmail(current.email) + + if (emailChanged) { + /** + * A directory may only move an account to an address in a domain the + * organization has proven it owns. Without that, a tenant could point + * someone else's Sim account at a mailbox it controls and recover it. + */ + await assertDomainOwned(tx, context.organizationId, nextEmail) + await assertEmailAvailable(tx, nextEmail, current.userId) + await tx + .update(user) + .set({ + email: nextEmail, + normalizedEmail: normalizeEmail(nextEmail), + /** The new address is unproven until its owner acts on it. */ + emailVerified: false, + name: next.name.formatted, + updatedAt: new Date(), + }) + .where(eq(user.id, current.userId)) + + /** An address change ends the sessions established under the old one. */ + await revokeUserSessionsTx(tx, { + userId: current.userId, + organizationId: context.organizationId, + }) + } else if (next.name.formatted !== current.attributes.name.formatted) { + await tx + .update(user) + .set({ name: next.name.formatted, updatedAt: new Date() }) + .where(eq(user.id, current.userId)) + } + + const deactivated = current.active && !next.active + const reactivated = !current.active && next.active + + if (deactivated) { + await suspendMemberTx(tx, { + userId: current.userId, + organizationId: context.organizationId, + source: 'scim', + }) + } else if (reactivated) { + await unsuspendMemberTx(tx, { userId: current.userId, source: 'scim' }) + } + + await updateScimUser(tx, { + scimUserId: current.id, + attributes: next, + active: next.active, + }) + + await reconcileUserProjection(tx, { + connectionId: context.connection.id, + organizationId: context.organizationId, + scimUserId: current.id, + settings: context.connection.settings, + }) + + return { emailChanged, deactivated, reactivated, changed: true } +} + +export interface UpdateScimUserResult { + scimUserId: string + userId: string + outcome: UpdateOutcome | null + resource: ReturnType +} + +async function renderUpdated( + connectionId: string, + scimUserId: string, + baseUrl: string +): Promise> { + const record = await findScimUserById(db, connectionId, scimUserId) + if (!record) throw new ScimError(500, undefined, 'The updated user could not be read back') + const groups = (await loadGroupsForScimUsers(db, [record.id])).get(record.id) ?? [] + return toUserResource(toUserResourceRow(record, groups), baseUrl) +} + +function auditEntries(result: UpdateScimUserResult): ScimAuditEntry[] | undefined { + if (!result.outcome) return undefined + const entries: ScimAuditEntry[] = [ + { + action: AuditAction.SCIM_USER_UPDATED, + resourceType: AuditResourceType.USER, + resourceId: result.userId, + metadata: { + scimUserId: result.scimUserId, + emailChanged: result.outcome.emailChanged, + }, + }, + ] + if (result.outcome.deactivated) { + entries.push({ + action: AuditAction.SCIM_USER_DEACTIVATED, + resourceType: AuditResourceType.USER, + resourceId: result.userId, + metadata: { scimUserId: result.scimUserId }, + }) + } + if (result.outcome.reactivated) { + entries.push({ + action: AuditAction.SCIM_USER_REACTIVATED, + resourceType: AuditResourceType.USER, + resourceId: result.userId, + metadata: { scimUserId: result.scimUserId }, + }) + } + return entries +} + +async function invalidateIfAccessChanged(result: UpdateScimUserResult, organizationId: string) { + if (!result.outcome) return + if (result.outcome.emailChanged || result.outcome.deactivated || result.outcome.reactivated) { + invalidateAfterSessionRevocation({ userId: result.userId, organizationId }) + } +} + +export interface ReplaceScimUserInput { + scimUserId: string + attributes: ScimUserAttributes +} + +export const replaceScimUser = defineAuthorizedScimUseCase({ + operation: scimOperations.updateUser, + async execute({ + input, + context, + }: ScimUseCaseArgs): Promise { + const current = await findScimUserById(db, context.connection.id, input.scimUserId) + if (!current) throw notFound('SCIM User not found') + + /** + * A replace keeps attributes Sim does not model that the directory sent on a + * previous write but omitted now, so a partial mapping does not erase them. + */ + const next: ScimUserAttributes = { + ...input.attributes, + ...(current.attributes.extra || input.attributes.extra + ? { extra: { ...current.attributes.extra, ...input.attributes.extra } } + : {}), + } + + const outcome = await db.transaction((tx) => applyUserUpdate(tx, context, current, next)) + return { + scimUserId: current.id, + userId: current.userId, + outcome, + resource: await renderUpdated(context.connection.id, current.id, context.baseUrl), + } + }, + projectAudit: ({ result }) => auditEntries(result), + afterSuccess: async ({ result, context }) => + invalidateIfAccessChanged(result, context.organizationId), +}) + +export interface PatchScimUserInput { + scimUserId: string + operations: readonly ScimPatchOperation[] +} + +export const patchScimUser = defineAuthorizedScimUseCase({ + operation: scimOperations.updateUser, + async execute({ + input, + context, + }: ScimUseCaseArgs): Promise { + const current = await findScimUserById(db, context.connection.id, input.scimUserId) + if (!current) throw notFound('SCIM User not found') + + const { next, changed } = applyUserPatch(current.attributes, input.operations) + + /** + * A patch that changes nothing is answered with the resource and no write. + * Directories re-send unchanged attributes constantly on incremental cycles, + * and treating each as a write would produce an audit row, a projection pass, + * and a `lastModified` bump for a request that meant nothing. + */ + if (!changed) { + return { + scimUserId: current.id, + userId: current.userId, + outcome: null, + resource: await renderUpdated(context.connection.id, current.id, context.baseUrl), + } + } + + const outcome = await db.transaction((tx) => applyUserUpdate(tx, context, current, next)) + return { + scimUserId: current.id, + userId: current.userId, + outcome, + resource: await renderUpdated(context.connection.id, current.id, context.baseUrl), + } + }, + projectAudit: ({ result }) => auditEntries(result), + afterSuccess: async ({ result, context }) => + invalidateIfAccessChanged(result, context.organizationId), +}) diff --git a/apps/sim/lib/scim/authenticate.ts b/apps/sim/lib/scim/authenticate.ts new file mode 100644 index 00000000000..94de8eef0a8 --- /dev/null +++ b/apps/sim/lib/scim/authenticate.ts @@ -0,0 +1,183 @@ +import { createHash, timingSafeEqual } from 'node:crypto' +import type { ScimConnectionPrincipal, ScimCredentialScope } from '@sim/auth/principal' +import { db } from '@sim/db' +import { scimConnection, scimCredential } from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { generateId, generateShortId } from '@sim/utils/id' +import { and, eq, isNull, lt, or, sql } from 'drizzle-orm' +import type { NextRequest } from 'next/server' +import { isOrganizationFeatureEntitled } from '@/lib/billing/core/subscription' +import { isScimEnabled } from '@/lib/core/config/env-flags' +import { ScimError } from '@/lib/scim/protocol/errors' + +const logger = createLogger('ScimAuthenticate') + +export type ScimConnectionAuthenticator = (request: NextRequest) => Promise + +/** + * The prefix every issued credential carries. + * + * Makes a leaked token identifiable in a log or a secret scanner without + * revealing which tenant it belongs to. + */ +export const SCIM_TOKEN_PREFIX = 'sim_scim_' + +/** Characters shown in the settings list so an administrator can tell two apart. */ +const DISPLAY_PREFIX_LENGTH = SCIM_TOKEN_PREFIX.length + 6 + +/** + * Mints a credential. + * + * 40 url-safe characters is about 238 bits, far beyond guessing, and the secret + * is returned exactly once — only its digest is stored, so a database read + * cannot recover a live token. + */ +export function generateScimToken(): { secret: string; hash: string; prefix: string } { + const secret = `${SCIM_TOKEN_PREFIX}${generateShortId(40)}` + return { + secret, + hash: hashScimToken(secret), + prefix: secret.slice(0, DISPLAY_PREFIX_LENGTH), + } +} + +export function hashScimToken(secret: string): string { + return createHash('sha256').update(secret).digest('base64url') +} + +/** + * Compares digests without leaking their difference through timing. + * + * The lookup is by digest, so a mismatch normally means no row at all; this + * guards the case where a row is found by an equal-prefix collision. + */ +function digestsMatch(left: string, right: string): boolean { + const a = Buffer.from(left) + const b = Buffer.from(right) + return a.length === b.length && timingSafeEqual(a, b) +} + +function unauthorized(detail = 'Invalid SCIM credential'): ScimError { + return new ScimError(401, undefined, detail, { + 'WWW-Authenticate': 'Bearer realm="SCIM"', + }) +} + +function readBearerToken(request: NextRequest): string | null { + const header = request.headers.get('authorization') + if (!header) return null + const match = header.match(/^Bearer\s+(.+)$/i) + return match ? match[1].trim() : null +} + +/** + * How long a credential's `last_used_at` may lag before it is rewritten. + * + * A provisioning cycle makes hundreds of calls a minute; writing the timestamp + * on each one would turn a read path into a write path for a value nobody reads + * more precisely than "today". + */ +const LAST_USED_WRITE_INTERVAL_MS = 5 * 60 * 1000 + +function touchCredentialLastUsed(credentialId: string, lastUsedAt: Date | null): void { + if (lastUsedAt && Date.now() - lastUsedAt.getTime() < LAST_USED_WRITE_INTERVAL_MS) return + void db + .update(scimCredential) + .set({ lastUsedAt: new Date() }) + .where(eq(scimCredential.id, credentialId)) + .catch((error) => logger.warn('Failed to record SCIM credential use', { error })) +} + +function touchConnectionLastRequest(connectionId: string, lastRequestAt: Date | null): void { + if (lastRequestAt && Date.now() - lastRequestAt.getTime() < LAST_USED_WRITE_INTERVAL_MS) return + void db + .update(scimConnection) + .set({ lastRequestAt: new Date() }) + .where(eq(scimConnection.id, connectionId)) + .catch((error) => logger.warn('Failed to record SCIM connection activity', { error })) +} + +/** + * Resolves the bearer credential on a SCIM request into a principal. + * + * Every refusal renders the same message. A provider cannot be helped by knowing + * whether a token was unknown, revoked, expired, or belonged to a disabled + * connection, while an attacker probing tokens learns which of those it hit. + */ +export async function authenticateScimRequest( + request: NextRequest +): Promise { + const token = readBearerToken(request) + if (!token) throw unauthorized('A bearer credential is required') + + const [row] = await db + .select({ + credentialId: scimCredential.id, + tokenHash: scimCredential.tokenHash, + scopes: scimCredential.scopes, + expiresAt: scimCredential.expiresAt, + revokedAt: scimCredential.revokedAt, + lastUsedAt: scimCredential.lastUsedAt, + connectionId: scimConnection.id, + organizationId: scimConnection.organizationId, + status: scimConnection.status, + lastRequestAt: scimConnection.lastRequestAt, + }) + .from(scimCredential) + .innerJoin(scimConnection, eq(scimConnection.id, scimCredential.connectionId)) + .where(eq(scimCredential.tokenHash, hashScimToken(token))) + .limit(1) + + if (!row || !digestsMatch(row.tokenHash, hashScimToken(token))) throw unauthorized() + if (row.revokedAt) throw unauthorized() + if (row.expiresAt && row.expiresAt.getTime() <= Date.now()) throw unauthorized() + if (row.status !== 'active') throw unauthorized() + + /** + * The entitlement is checked on every request, not only when the connection is + * created. An organization that lapses stops accepting directory writes rather + * than continuing to provision members it is no longer paying for. + */ + if (!(await isOrganizationFeatureEntitled(row.organizationId, isScimEnabled))) { + throw unauthorized() + } + + touchCredentialLastUsed(row.credentialId, row.lastUsedAt) + touchConnectionLastRequest(row.connectionId, row.lastRequestAt) + + return { + kind: 'scim_connection', + organizationId: row.organizationId, + connectionId: row.connectionId, + credentialId: row.credentialId, + scopes: row.scopes as ScimCredentialScope[], + } +} + +/** Active credentials for a connection, used to bound how many may exist at once. */ +export function activeCredentialCondition(connectionId: string) { + return and( + eq(scimCredential.connectionId, connectionId), + isNull(scimCredential.revokedAt), + or(isNull(scimCredential.expiresAt), sql`${scimCredential.expiresAt} > now()`) + ) +} + +/** Marks credentials whose expiry has passed, so the active count stays honest. */ +export async function pruneExpiredCredentials(connectionId: string): Promise { + await db + .update(scimCredential) + .set({ revokedAt: new Date() }) + .where( + and( + eq(scimCredential.connectionId, connectionId), + isNull(scimCredential.revokedAt), + lt(scimCredential.expiresAt, new Date()) + ) + ) +} + +/** Generates the ids the SCIM tables use, kept here so callers share one source. */ +export function newScimId(): string { + return generateId() +} diff --git a/apps/sim/lib/scim/identity/resolve-user.ts b/apps/sim/lib/scim/identity/resolve-user.ts new file mode 100644 index 00000000000..fbae00eeabf --- /dev/null +++ b/apps/sim/lib/scim/identity/resolve-user.ts @@ -0,0 +1,182 @@ +import { member, type ScimUserAttributes, scimUserTombstone, ssoDomain, user } from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import { normalizeSSODomain } from '@sim/utils/sso-domain' +import { normalizeEmail } from '@sim/utils/string' +import { and, eq, sql } from 'drizzle-orm' +import type { DbOrTx } from '@/lib/db/types' +import { primaryEmail } from '@/lib/scim/protocol/canonical' +import { uniqueness } from '@/lib/scim/protocol/errors' + +/** + * Deciding which Sim account an incoming directory identity refers to. + * + * This is the security boundary of the whole surface. A directory that could + * name an arbitrary address and have Sim hand back the matching account would be + * an account-takeover primitive: the tenant controls what it sends, so it would + * control which account it captures. Every branch below either proves the + * identity was provisioned by this same connection, or proves the organization + * owns the email's domain. + */ + +export type IdentityResolution = + | { action: 'create' } + | { action: 'link'; userId: string; via: 'tombstone' | 'verified-domain' } + +/** Domains this organization has proven it owns, through the SSO domain flow. */ +export async function listVerifiedDomains( + tx: DbOrTx, + organizationId: string +): Promise> { + const rows = await tx + .select({ domain: ssoDomain.domain }) + .from(ssoDomain) + .where(and(eq(ssoDomain.organizationId, organizationId), eq(ssoDomain.status, 'verified'))) + const domains = new Set() + for (const row of rows) { + const normalized = normalizeSSODomain(row.domain) + if (normalized) domains.add(normalized) + } + return domains +} + +/** + * Refuses an address outside the organization's verified domains. + * + * Applied on every create and every email change, not only when linking. A + * directory that could set a member's address to a domain the organization does + * not own could point a Sim account at a mailbox it controls and then use + * password recovery against it. + */ +export async function assertDomainOwned( + tx: DbOrTx, + organizationId: string, + email: string +): Promise { + const domain = normalizeSSODomain(email) + if (!domain) throw uniqueness(`${email} is not a usable email address`) + const verified = await listVerifiedDomains(tx, organizationId) + if (verified.size === 0) { + throw uniqueness( + 'This organization has no verified email domains. Verify the domain in Sim before provisioning users.' + ) + } + if (!verified.has(domain)) { + throw uniqueness( + `The domain ${domain} is not verified for this organization, so ${email} cannot be provisioned` + ) + } +} + +/** Refuses an address already held by a different Sim account. */ +export async function assertEmailAvailable( + tx: DbOrTx, + email: string, + exceptUserId?: string +): Promise { + const [existing] = await tx + .select({ id: user.id }) + .from(user) + .where(sql`lower(trim(${user.email})) = ${normalizeEmail(email)}`) + .limit(1) + if (existing && existing.id !== exceptUserId) { + throw uniqueness('Another Sim account already uses this email address') + } +} + +/** + * Chooses whether to create an account or attach to an existing one. + * + * Order matters. An exact tombstone match is the strongest signal available — + * this connection provisioned that external id before — and it is what makes a + * directory's delete-and-recreate (an ordinary rename or rehire) reattach the + * original account instead of stranding it behind a duplicate. + * + * Only then is email considered, and only under two conditions together: the + * organization has proven it owns the domain, and the account is not already + * committed to a different organization. + */ +export async function resolveProvisionedIdentity( + tx: DbOrTx, + params: { connectionId: string; organizationId: string; attributes: ScimUserAttributes } +): Promise { + const externalId = params.attributes.externalId + if (externalId) { + const [tombstone] = await tx + .select({ userId: scimUserTombstone.userId }) + .from(scimUserTombstone) + .where( + and( + eq(scimUserTombstone.connectionId, params.connectionId), + eq(scimUserTombstone.externalId, externalId) + ) + ) + .limit(1) + if (tombstone) return { action: 'link', userId: tombstone.userId, via: 'tombstone' } + } + + const email = primaryEmail(params.attributes) + await assertDomainOwned(tx, params.organizationId, email) + + const [existing] = await tx + .select({ id: user.id }) + .from(user) + .where(sql`lower(trim(${user.email})) = ${normalizeEmail(email)}`) + .limit(1) + if (!existing) return { action: 'create' } + + /** + * A Sim account belongs to at most one organization, enforced by a unique + * index on `member.userId`. Attaching to someone already committed elsewhere + * cannot succeed, and reporting it as a conflict is what tells the directory + * administrator to resolve it rather than retrying forever. + */ + const [membership] = await tx + .select({ organizationId: member.organizationId }) + .from(member) + .where(eq(member.userId, existing.id)) + .limit(1) + + if (membership && membership.organizationId !== params.organizationId) { + throw uniqueness( + 'A Sim account with this email already belongs to a different organization. Remove it there before provisioning.' + ) + } + + return { action: 'link', userId: existing.id, via: 'verified-domain' } +} + +/** Records that an external identity was deprovisioned, so a later recreate relinks. */ +export async function upsertTombstone( + tx: DbOrTx, + params: { connectionId: string; externalId: string; userId: string } +): Promise { + await tx + .insert(scimUserTombstone) + .values({ + id: generateId(), + connectionId: params.connectionId, + externalId: params.externalId, + userId: params.userId, + deletedAt: new Date(), + }) + .onConflictDoUpdate({ + target: [scimUserTombstone.connectionId, scimUserTombstone.externalId], + set: { userId: params.userId, deletedAt: new Date() }, + }) +} + +/** Clears a tombstone once its identity has been provisioned again. */ +export async function consumeTombstone( + tx: DbOrTx, + params: { connectionId: string; externalId?: string | undefined } +): Promise { + if (!params.externalId) return + await tx + .delete(scimUserTombstone) + .where( + and( + eq(scimUserTombstone.connectionId, params.connectionId), + eq(scimUserTombstone.externalId, params.externalId) + ) + ) +} diff --git a/apps/sim/lib/scim/managed-membership.ts b/apps/sim/lib/scim/managed-membership.ts new file mode 100644 index 00000000000..19d5b7597ca --- /dev/null +++ b/apps/sim/lib/scim/managed-membership.ts @@ -0,0 +1,111 @@ +import { db } from '@sim/db' +import { scimConnection, scimUser } from '@sim/db/schema' +import { type AnyColumn, and, eq, type SQL, sql } from 'drizzle-orm' +import { ForbiddenOperationError } from '@/lib/core/application' +import type { DbOrTx } from '@/lib/db/types' + +/** + * Refusing membership edits that the organization's directory owns. + * + * When an administrator makes the directory the source of truth, a change made + * only in Sim is undone by the next sync. Accepting it would be worse than + * refusing: the person doing it sees success, the change disappears hours later, + * and nothing explains why. This turns that into an error that names the + * remedy. + * + * Deliberately not applied to deprovisioning: an administrator must always be + * able to remove someone in an emergency, whatever the directory believes. + */ + +export type ManagedMembershipAction = 'invite' | 'change-role' | 'workspace-grant' + +const ACTION_WORDING: Record = { + invite: 'Inviting a member', + 'change-role': 'Changing a member’s role', + 'workspace-grant': 'Granting workspace access', +} + +/** + * Whether this organization has handed membership to its directory. + * + * Read fresh rather than cached: the setting is toggled rarely, and a stale + * answer would either block an administrator who just turned locking off or + * admit a change the directory is about to revert. + */ +async function loadLockedConnection( + tx: DbOrTx, + organizationId: string +): Promise<{ id: string } | null> { + const [connection] = await tx + .select({ id: scimConnection.id, settings: scimConnection.settings }) + .from(scimConnection) + .where( + and(eq(scimConnection.organizationId, organizationId), eq(scimConnection.status, 'active')) + ) + .limit(1) + if (!connection?.settings?.lockManualMembership) return null + return { id: connection.id } +} + +/** True when the user is provisioned by the organization's directory. */ +export async function isScimManagedUser( + tx: DbOrTx, + params: { organizationId: string; userId: string } +): Promise { + const connection = await loadLockedConnection(tx, params.organizationId) + if (!connection) return false + const [row] = await tx + .select({ id: scimUser.id }) + .from(scimUser) + .where(and(eq(scimUser.connectionId, connection.id), eq(scimUser.userId, params.userId))) + .limit(1) + return Boolean(row) +} + +/** Refuses a change to a member the directory owns. */ +export async function assertMembershipNotScimManaged(params: { + organizationId: string + userId: string + action: ManagedMembershipAction + executor?: DbOrTx +}): Promise { + const managed = await isScimManagedUser(params.executor ?? db, { + organizationId: params.organizationId, + userId: params.userId, + }) + if (!managed) return + throw new ForbiddenOperationError( + 'SCIM_MANAGED_MEMBERSHIP', + `${ACTION_WORDING[params.action]} is managed by this organization’s identity provider. Make the change there, or turn off managed-membership locking in the organization’s directory settings.` + ) +} + +/** + * A SQL predicate that is true when the given user is provisioned by an active + * directory connection whose organization has locked manual membership. + * + * Exposed as a predicate rather than a query so a caller that is already reading + * the user can fold it into that read. The invitation flow does exactly that: it + * looks the invitee up by email regardless, and paying for a second round trip + * on every invitation to answer a question that is almost always "no" is not + * worth it. + */ +export function scimManagedUserPredicate(userIdColumn: SQL | AnyColumn): SQL { + return sql`exists ( + select 1 + from ${scimUser} + join ${scimConnection} on ${scimConnection.id} = ${scimUser.connectionId} + where ${scimUser.userId} = ${userIdColumn} + and ${scimConnection.status} = 'active' + and coalesce((${scimConnection.settings} ->> 'lockManualMembership')::boolean, false) = true + )` +} + +/** Refuses an invitation to someone the directory already provisions. */ +export function assertInviteeNotScimManaged(managed: boolean | null | undefined): void { + if (!managed) return + throw new ForbiddenOperationError( + 'SCIM_MANAGED_MEMBERSHIP', + 'This person is provisioned by the organization’s identity provider, so Sim will not grant them access separately. They already have access, or will once the next directory sync runs.' + ) +} diff --git a/apps/sim/lib/scim/projection/reconcile-user.ts b/apps/sim/lib/scim/projection/reconcile-user.ts new file mode 100644 index 00000000000..092e8511fa1 --- /dev/null +++ b/apps/sim/lib/scim/projection/reconcile-user.ts @@ -0,0 +1,420 @@ +import { + type ScimConnectionSettings, + scimGroupMapping, + scimGroupMember, + scimProjectionGrant, + scimUser, + user, +} from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import type { PermissionType } from '@sim/platform-authz/workspace' +import { generateId } from '@sim/utils/id' +import { and, eq } from 'drizzle-orm' +import type { DbOrTx } from '@/lib/db/types' +import { changeMemberRoleTx } from '@/lib/organizations/members/lifecycle' +import { + addPermissionGroupMemberTx, + PermissionGroupNotFoundError, + removePermissionGroupMemberTx, +} from '@/lib/permission-groups/application/group-membership' +import { + grantWorkspaceAccessTx, + permissionRank, + readWorkspacePermission, + revokeWorkspaceAccessTx, +} from '@/lib/workspaces/access/workspace-access' + +const logger = createLogger('ScimProjection') + +/** + * Turning directory group membership into Sim access. + * + * A SCIM group means nothing on its own; an administrator maps it to something + * Sim understands. This module computes what a user's mappings say they should + * have, compares it to what SCIM previously granted them, and applies only the + * difference. + * + * The comparison is against SCIM's own grants, recorded in + * `scim_projection_grant`, never against the user's total access. That is the + * distinction that keeps a directory sync from revoking access a workspace + * administrator granted by hand. + */ + +export type ProjectionTargetKind = 'permission_group' | 'workspace' | 'org_role' + +export interface ProjectionGrant { + targetKind: ProjectionTargetKind + targetId: string + permissionType?: PermissionType +} + +export interface ProjectionDelta { + added: ProjectionGrant[] + removed: ProjectionGrant[] + raised: ProjectionGrant[] +} + +const EMPTY_DELTA: ProjectionDelta = { added: [], removed: [], raised: [] } + +function grantKey(grant: ProjectionGrant): string { + return `${grant.targetKind}:${grant.targetId}` +} + +/** + * What this user's group mappings entitle them to. + * + * An inactive user is entitled to nothing: a deactivation must withdraw access + * rather than merely blocking sign-in, so that a reactivation is what restores + * it and nothing is left dangling in between. + */ +async function desiredGrants( + tx: DbOrTx, + params: { scimUserId: string; active: boolean; settings: ScimConnectionSettings } +): Promise { + if (!params.active) return [] + + const rows = await tx + .select({ + targetKind: scimGroupMapping.targetKind, + permissionGroupId: scimGroupMapping.permissionGroupId, + workspaceId: scimGroupMapping.workspaceId, + permissionType: scimGroupMapping.permissionType, + role: scimGroupMapping.role, + }) + .from(scimGroupMember) + .innerJoin(scimGroupMapping, eq(scimGroupMapping.groupId, scimGroupMember.groupId)) + .where(eq(scimGroupMember.scimUserId, params.scimUserId)) + + const byKey = new Map() + + for (const grant of params.settings.defaultWorkspaceGrants ?? []) { + const entry: ProjectionGrant = { + targetKind: 'workspace', + targetId: grant.workspaceId, + permissionType: grant.permission, + } + byKey.set(grantKey(entry), entry) + } + + for (const row of rows) { + if (row.targetKind === 'permission_group' && row.permissionGroupId) { + const entry: ProjectionGrant = { + targetKind: 'permission_group', + targetId: row.permissionGroupId, + } + byKey.set(grantKey(entry), entry) + continue + } + if (row.targetKind === 'workspace' && row.workspaceId && row.permissionType) { + const entry: ProjectionGrant = { + targetKind: 'workspace', + targetId: row.workspaceId, + permissionType: row.permissionType, + } + const existing = byKey.get(grantKey(entry)) + /** Two groups granting the same workspace resolve to the stronger one. */ + if ( + !existing?.permissionType || + permissionRank(row.permissionType) > permissionRank(existing.permissionType) + ) { + byKey.set(grantKey(entry), entry) + } + continue + } + if (row.targetKind === 'org_role' && row.role) { + const entry: ProjectionGrant = { targetKind: 'org_role', targetId: row.role } + byKey.set(grantKey(entry), entry) + } + } + + return [...byKey.values()] +} + +async function currentGrants(tx: DbOrTx, scimUserId: string): Promise { + const rows = await tx + .select({ + targetKind: scimProjectionGrant.targetKind, + targetId: scimProjectionGrant.targetId, + permissionType: scimProjectionGrant.permissionType, + }) + .from(scimProjectionGrant) + .where(eq(scimProjectionGrant.scimUserId, scimUserId)) + return rows.map((row) => ({ + targetKind: row.targetKind as ProjectionTargetKind, + targetId: row.targetId, + ...(row.permissionType ? { permissionType: row.permissionType } : {}), + })) +} + +async function applyGrant( + tx: DbOrTx, + params: { + organizationId: string + userId: string + grant: ProjectionGrant + lockTimeoutAlreadyBounded: boolean + } +): Promise { + const { grant } = params + switch (grant.targetKind) { + case 'workspace': + if (!grant.permissionType) return + await grantWorkspaceAccessTx(tx, { + workspaceId: grant.targetId, + userId: params.userId, + permission: grant.permissionType, + }) + return + case 'org_role': + if (grant.targetId !== 'admin') return + await changeMemberRoleTx(tx, { + organizationId: params.organizationId, + userId: params.userId, + role: 'admin', + }) + return + case 'permission_group': + /** + * Last, because the permission-group lock is a documented leaf: no further + * advisory lock may be taken after it. + */ + await addPermissionGroupMemberTx(tx, { + organizationId: params.organizationId, + groupId: grant.targetId, + userId: params.userId, + assignedBy: null, + lockTimeoutAlreadyBounded: params.lockTimeoutAlreadyBounded, + }) + } +} + +async function withdrawGrant( + tx: DbOrTx, + params: { + organizationId: string + userId: string + grant: ProjectionGrant + lockManualMembership: boolean + lockTimeoutAlreadyBounded: boolean + } +): Promise { + const { grant } = params + switch (grant.targetKind) { + case 'workspace': { + /** + * A grant raised by hand above what the directory set is left alone. The + * directory said "at least write"; someone deliberately made it admin, and + * removing the group should not silently undo that decision. When the + * organization has made the directory the source of truth, it does. + */ + const current = await readWorkspacePermission(tx, { + workspaceId: grant.targetId, + userId: params.userId, + }) + if (!current) return + if ( + !params.lockManualMembership && + grant.permissionType && + permissionRank(current) > permissionRank(grant.permissionType) + ) { + return + } + const outcome = await revokeWorkspaceAccessTx(tx, { + workspaceId: grant.targetId, + userId: params.userId, + }) + if (!outcome.revoked && outcome.unresolvedWorkflows.length > 0) { + logger.warn('Left workspace access in place: workflow ownership could not be reassigned', { + workspaceId: grant.targetId, + userId: params.userId, + unresolved: outcome.unresolvedWorkflows.length, + }) + } + return + } + case 'org_role': + if (grant.targetId !== 'admin') return + await changeMemberRoleTx(tx, { + organizationId: params.organizationId, + userId: params.userId, + role: 'member', + }) + return + case 'permission_group': + await removePermissionGroupMemberTx(tx, { + organizationId: params.organizationId, + groupId: grant.targetId, + userId: params.userId, + lockTimeoutAlreadyBounded: params.lockTimeoutAlreadyBounded, + }) + } +} + +/** + * Brings a user's Sim access in line with their directory groups. + * + * Idempotent by construction: it reads the desired set, reads what SCIM granted + * before, and acts only on the difference. Running it twice changes nothing the + * second time, which is what lets the reconcile job re-run it over every user + * without a dry-run mode. + * + * Ordering within the transaction follows the documented advisory-lock order: + * workspace and role writes first, permission-group writes last. + */ +export async function reconcileUserProjection( + tx: DbOrTx, + params: { + connectionId: string + organizationId: string + scimUserId: string + settings: ScimConnectionSettings + } +): Promise { + const [record] = await tx + .select({ + userId: scimUser.userId, + active: scimUser.active, + suspendedAt: user.suspendedAt, + }) + .from(scimUser) + .innerJoin(user, eq(user.id, scimUser.userId)) + .where(and(eq(scimUser.id, params.scimUserId), eq(scimUser.connectionId, params.connectionId))) + .limit(1) + + if (!record) return EMPTY_DELTA + + const desired = await desiredGrants(tx, { + scimUserId: params.scimUserId, + active: record.active && record.suspendedAt === null, + settings: params.settings, + }) + const current = await currentGrants(tx, params.scimUserId) + + const desiredByKey = new Map(desired.map((grant) => [grantKey(grant), grant])) + const currentByKey = new Map(current.map((grant) => [grantKey(grant), grant])) + + const delta: ProjectionDelta = { added: [], removed: [], raised: [] } + const lockManualMembership = params.settings.lockManualMembership === true + + /** Withdrawals first, so a move between groups frees its workspace slot. */ + for (const [key, grant] of currentByKey) { + if (desiredByKey.has(key)) continue + await withdrawGrant(tx, { + organizationId: params.organizationId, + userId: record.userId, + grant, + lockManualMembership, + lockTimeoutAlreadyBounded: false, + }) + await tx + .delete(scimProjectionGrant) + .where( + and( + eq(scimProjectionGrant.scimUserId, params.scimUserId), + eq(scimProjectionGrant.targetKind, grant.targetKind), + eq(scimProjectionGrant.targetId, grant.targetId) + ) + ) + delta.removed.push(grant) + } + + for (const [key, grant] of desiredByKey) { + const existing = currentByKey.get(key) + const raised = + existing !== undefined && + grant.permissionType !== undefined && + existing.permissionType !== undefined && + permissionRank(grant.permissionType) > permissionRank(existing.permissionType) + + if (existing && !raised) continue + + try { + await applyGrant(tx, { + organizationId: params.organizationId, + userId: record.userId, + grant, + lockTimeoutAlreadyBounded: false, + }) + } catch (error) { + /** + * A mapping can outlive its target — an administrator deletes a permission + * group and the row cascades away, or deletes the group between the read + * and the write. Skipping one target is right; failing the whole + * provisioning request over it is not. + */ + if (error instanceof PermissionGroupNotFoundError) { + logger.warn('Skipped a SCIM mapping whose permission group no longer exists', { + connectionId: params.connectionId, + groupId: grant.targetId, + }) + continue + } + throw error + } + + await tx + .insert(scimProjectionGrant) + .values({ + id: generateId(), + connectionId: params.connectionId, + scimUserId: params.scimUserId, + targetKind: grant.targetKind, + targetId: grant.targetId, + permissionType: grant.permissionType ?? null, + createdAt: new Date(), + updatedAt: new Date(), + }) + .onConflictDoUpdate({ + target: [ + scimProjectionGrant.scimUserId, + scimProjectionGrant.targetKind, + scimProjectionGrant.targetId, + ], + set: { permissionType: grant.permissionType ?? null, updatedAt: new Date() }, + }) + + if (raised) delta.raised.push(grant) + else delta.added.push(grant) + } + + return delta +} + +/** Withdraws everything SCIM granted a user, for deprovisioning. */ +export async function withdrawAllProjectedGrants( + tx: DbOrTx, + params: { connectionId: string; organizationId: string; scimUserId: string; userId: string } +): Promise { + const grants = await currentGrants(tx, params.scimUserId) + for (const grant of grants) { + await withdrawGrant(tx, { + organizationId: params.organizationId, + userId: params.userId, + grant, + /** Deprovisioning removes access regardless of later manual changes. */ + lockManualMembership: true, + lockTimeoutAlreadyBounded: false, + }) + } + await tx.delete(scimProjectionGrant).where(eq(scimProjectionGrant.scimUserId, params.scimUserId)) +} + +/** Reconciles several users, in a stable order so concurrent syncs cannot deadlock. */ +export async function reconcileUsersProjection( + tx: DbOrTx, + params: { + connectionId: string + organizationId: string + scimUserIds: string[] + settings: ScimConnectionSettings + } +): Promise { + for (const scimUserId of [...new Set(params.scimUserIds)].sort()) { + await reconcileUserProjection(tx, { + connectionId: params.connectionId, + organizationId: params.organizationId, + scimUserId, + settings: params.settings, + }) + } +} diff --git a/apps/sim/lib/scim/protocol/canonical.test.ts b/apps/sim/lib/scim/protocol/canonical.test.ts new file mode 100644 index 00000000000..b70ee943833 --- /dev/null +++ b/apps/sim/lib/scim/protocol/canonical.test.ts @@ -0,0 +1,130 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { scimGroupWriteSchema, scimUserWriteSchema } from '@/lib/api/contracts/scim' +import { + assertGroupSchemas, + assertUserSchemas, + primaryEmail, + toCanonicalGroup, + toCanonicalUser, +} from '@/lib/scim/protocol/canonical' +import { + SCIM_ENTERPRISE_USER_SCHEMA, + SCIM_GROUP_SCHEMA, + SCIM_USER_SCHEMA, +} from '@/lib/scim/protocol/constants' +import type { ScimError } from '@/lib/scim/protocol/errors' +import { ENTRA_LEGACY_GROUP_SCHEMA } from '@/lib/scim/protocol/normalize' + +function parseUser(body: Record) { + return toCanonicalUser(scimUserWriteSchema.parse({ schemas: [SCIM_USER_SCHEMA], ...body })) +} + +describe('toCanonicalUser', () => { + it('takes the flagged primary address', () => { + const user = parseUser({ + userName: 'ada', + emails: [ + { value: 'home@acme.test', primary: false }, + { value: 'work@acme.test', primary: true, type: 'work' }, + ], + }) + expect(primaryEmail(user)).toBe('work@acme.test') + }) + + it('falls back to the first address when none is flagged, as OneLogin sends', () => { + const user = parseUser({ + userName: 'ada', + emails: [{ value: 'first@acme.test' }, { value: 'second@acme.test' }], + }) + expect(primaryEmail(user)).toBe('first@acme.test') + }) + + it('falls back to an email-shaped userName, as Entra often sends alone', () => { + const user = parseUser({ userName: 'Ada@Acme.Test' }) + expect(primaryEmail(user)).toBe('ada@acme.test') + expect(user.userName).toBe('ada@acme.test') + }) + + it('refuses a resource with no usable address', () => { + let scimType: string | undefined + try { + parseUser({ userName: 'ada' }) + } catch (error) { + scimType = (error as ScimError).scimType + } + expect(scimType).toBe('invalidValue') + }) + + it('builds a display name from the parts when none is supplied', () => { + const user = parseUser({ + userName: 'ada@acme.test', + name: { givenName: 'Ada', familyName: 'Lovelace' }, + }) + expect(user.name.formatted).toBe('Ada Lovelace') + expect(user.displayName).toBe('Ada Lovelace') + }) + + it('keeps attributes Sim does not model so responses round-trip them', () => { + const user = parseUser({ userName: 'ada@acme.test', nickName: 'Countess' }) + expect(user.extra).toEqual({ nickName: 'Countess' }) + }) + + it('never keeps a password, even though Okta always sends one', () => { + const user = parseUser({ userName: 'ada@acme.test', password: 'hunter2' }) + expect(JSON.stringify(user)).not.toContain('hunter2') + }) + + it('accepts Entra’s string boolean for active', () => { + expect(parseUser({ userName: 'ada@acme.test', active: 'False' }).active).toBe(false) + }) + + it('defaults active to true when omitted', () => { + expect(parseUser({ userName: 'ada@acme.test' }).active).toBe(true) + }) +}) + +describe('schema assertions', () => { + it('accepts the core User schema with the enterprise extension', () => { + expect(() => assertUserSchemas([SCIM_USER_SCHEMA, SCIM_ENTERPRISE_USER_SCHEMA])).not.toThrow() + }) + + it('refuses an extension this server does not implement', () => { + expect(() => assertUserSchemas([SCIM_USER_SCHEMA, 'urn:example:2.0:Custom'])).toThrow() + }) + + it('tolerates Microsoft’s legacy Group schema marker', () => { + expect(() => assertGroupSchemas([SCIM_GROUP_SCHEMA, ENTRA_LEGACY_GROUP_SCHEMA])).not.toThrow() + }) +}) + +describe('toCanonicalGroup', () => { + it('deduplicates member ids', () => { + const group = toCanonicalGroup( + scimGroupWriteSchema.parse({ + schemas: [SCIM_GROUP_SCHEMA], + displayName: 'Engineering', + members: [{ value: 'u1' }, { value: 'u1' }, { value: 'u2' }], + }) + ) + expect(group.memberIds).toEqual(['u1', 'u2']) + }) + + it('refuses a nested group member', () => { + let scimType: string | undefined + try { + toCanonicalGroup( + scimGroupWriteSchema.parse({ + schemas: [SCIM_GROUP_SCHEMA], + displayName: 'Engineering', + members: [{ value: 'g2', type: 'Group' }], + }) + ) + } catch (error) { + scimType = (error as ScimError).scimType + } + expect(scimType).toBe('invalidValue') + }) +}) diff --git a/apps/sim/lib/scim/protocol/canonical.ts b/apps/sim/lib/scim/protocol/canonical.ts new file mode 100644 index 00000000000..91d747906ca --- /dev/null +++ b/apps/sim/lib/scim/protocol/canonical.ts @@ -0,0 +1,196 @@ +import type { ScimUserAttributes, ScimUserEmail } from '@sim/db/schema' +import type { ScimGroupWriteParsed, ScimUserWriteParsed } from '@/lib/api/contracts/scim' +import { + SCIM_ENTERPRISE_USER_SCHEMA, + SCIM_GROUP_SCHEMA, + SCIM_MAX_GROUP_MEMBERS, + SCIM_USER_SCHEMA, +} from '@/lib/scim/protocol/constants' +import { invalidValue } from '@/lib/scim/protocol/errors' +import { isRecord, stripProviderSchemaMarkers } from '@/lib/scim/protocol/normalize' + +/** Attributes Sim models itself; everything else is preserved under `extra`. */ +const MODELLED_USER_KEYS = new Set([ + 'schemas', + 'id', + 'meta', + 'username', + 'externalid', + 'active', + 'displayname', + 'name', + 'emails', + 'password', + SCIM_ENTERPRISE_USER_SCHEMA.toLowerCase(), +]) + +function trimmed(value: string | undefined): string | undefined { + const next = value?.trim() + return next ? next : undefined +} + +function looksLikeEmail(value: string): boolean { + return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) +} + +/** + * Chooses the address Sim will use as the account's email. + * + * Providers disagree about where it lives: Okta always sends `emails`, Entra + * often sends only an email-shaped `userName`, and OneLogin sends both with no + * `primary` flag. Preference order is the flagged primary, then the first + * address, then an email-shaped `userName`. + */ +function normalizeEmails( + emails: ScimUserWriteParsed['emails'], + userName: string +): { emails: ScimUserEmail[]; primary: string } { + const supplied = (emails ?? []) + .map((entry) => ({ + value: entry.value.trim().toLowerCase(), + type: trimmed(entry.type), + primary: entry.primary === true, + })) + .filter((entry) => entry.value.length > 0) + + if (supplied.length === 0) { + if (!looksLikeEmail(userName)) { + throw invalidValue( + 'A primary email address is required: send emails[], or a userName that is an email address' + ) + } + return { + emails: [{ value: userName, type: 'work', primary: true }], + primary: userName, + } + } + + const primaryIndex = supplied.findIndex((entry) => entry.primary) + const chosen = primaryIndex >= 0 ? primaryIndex : 0 + const normalized = supplied.map((entry, index) => ({ ...entry, primary: index === chosen })) + return { emails: normalized, primary: normalized[chosen].value } +} + +function formatName( + name: ScimUserWriteParsed['name'], + displayName: string | undefined, + fallback: string +): ScimUserAttributes['name'] { + const givenName = trimmed(name?.givenName) + const familyName = trimmed(name?.familyName) + const joined = [givenName, familyName].filter(Boolean).join(' ') + const formatted = trimmed(name?.formatted) ?? (joined || trimmed(displayName) || fallback) + return { + formatted, + ...(givenName ? { givenName } : {}), + ...(familyName ? { familyName } : {}), + } +} + +function collectExtra(body: ScimUserWriteParsed): Record | undefined { + const extra: Record = {} + for (const [key, value] of Object.entries(body)) { + if (MODELLED_USER_KEYS.has(key.toLowerCase())) continue + extra[key] = value + } + return Object.keys(extra).length > 0 ? extra : undefined +} + +/** + * Turns an inbound User resource into the shape Sim stores. + * + * The whole resource is kept, not only the fields Sim reads, so a `GET` returns + * what the provider wrote and a later `PATCH` applies to the provider's own view + * rather than to a lossy projection of it. + */ +export function toCanonicalUser(body: ScimUserWriteParsed): ScimUserAttributes { + const userName = body.userName.trim().toLowerCase() + if (!userName) throw invalidValue('userName must not be empty') + + const { emails, primary } = normalizeEmails(body.emails, userName) + const name = formatName(body.name, body.displayName, primary) + const enterprise = body[SCIM_ENTERPRISE_USER_SCHEMA] + const extra = collectExtra(body) + + return { + userName, + ...(trimmed(body.externalId) ? { externalId: trimmed(body.externalId) } : {}), + active: body.active ?? true, + displayName: trimmed(body.displayName) ?? name.formatted, + name, + emails, + ...(enterprise ? { enterprise: enterprise as ScimUserAttributes['enterprise'] } : {}), + ...(extra ? { extra } : {}), + } +} + +/** The primary address of a canonical resource. */ +export function primaryEmail(attributes: ScimUserAttributes): string { + return (attributes.emails.find((entry) => entry.primary) ?? attributes.emails[0]).value +} + +/** + * Refuses a `schemas` array that names something this server does not implement. + * + * A provider that believes an unimplemented extension was accepted will keep + * sending attributes that are silently dropped, so the mismatch is worth an + * error at the first write rather than a support case later. + */ +export function assertUserSchemas(schemas: readonly string[]): void { + for (const schema of schemas) { + if (schema !== SCIM_USER_SCHEMA && schema !== SCIM_ENTERPRISE_USER_SCHEMA) { + throw invalidValue(`Unsupported User schema ${schema}`) + } + } + if (!schemas.includes(SCIM_USER_SCHEMA)) { + throw invalidValue(`schemas must include ${SCIM_USER_SCHEMA}`) + } +} + +export function assertGroupSchemas(schemas: readonly string[]): void { + const declared = stripProviderSchemaMarkers(schemas) + for (const schema of declared) { + if (schema !== SCIM_GROUP_SCHEMA) throw invalidValue(`Unsupported Group schema ${schema}`) + } + if (!declared.includes(SCIM_GROUP_SCHEMA)) { + throw invalidValue(`schemas must include ${SCIM_GROUP_SCHEMA}`) + } +} + +export interface CanonicalScimGroup { + displayName: string + externalId?: string + memberIds: string[] +} + +/** Turns an inbound Group resource into a display name and a member id list. */ +export function toCanonicalGroup(body: ScimGroupWriteParsed): CanonicalScimGroup { + const displayName = body.displayName.trim() + if (!displayName) throw invalidValue('displayName must not be empty') + + const memberIds: string[] = [] + for (const member of body.members ?? []) { + if (member.type && member.type.toLowerCase() !== 'user') { + throw invalidValue('Group members must be Users; nested groups are not supported') + } + const value = member.value.trim() + if (!value) throw invalidValue('Group member entries require a value') + if (!memberIds.includes(value)) memberIds.push(value) + } + if (memberIds.length > SCIM_MAX_GROUP_MEMBERS) { + throw invalidValue(`A Group cannot carry more than ${SCIM_MAX_GROUP_MEMBERS} members`) + } + + return { + displayName, + ...(trimmed(body.externalId) ? { externalId: trimmed(body.externalId) } : {}), + memberIds, + } +} + +/** Reads the member id out of a PATCH value entry, which may be bare or wrapped. */ +export function readMemberValue(entry: unknown): string { + if (typeof entry === 'string') return entry.trim() + if (isRecord(entry) && typeof entry.value === 'string') return entry.value.trim() + throw invalidValue('Group member entries require a value') +} diff --git a/apps/sim/lib/scim/protocol/constants.ts b/apps/sim/lib/scim/protocol/constants.ts new file mode 100644 index 00000000000..ccb19ad1fb3 --- /dev/null +++ b/apps/sim/lib/scim/protocol/constants.ts @@ -0,0 +1,56 @@ +/** Schema URNs, media types, and limits fixed by RFC 7643 and RFC 7644. */ + +export const SCIM_USER_SCHEMA = 'urn:ietf:params:scim:schemas:core:2.0:User' +export const SCIM_ENTERPRISE_USER_SCHEMA = + 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User' +export const SCIM_GROUP_SCHEMA = 'urn:ietf:params:scim:schemas:core:2.0:Group' +export const SCIM_LIST_RESPONSE_SCHEMA = 'urn:ietf:params:scim:api:messages:2.0:ListResponse' +export const SCIM_PATCH_OP_SCHEMA = 'urn:ietf:params:scim:api:messages:2.0:PatchOp' +export const SCIM_ERROR_SCHEMA = 'urn:ietf:params:scim:api:messages:2.0:Error' +export const SCIM_SERVICE_PROVIDER_CONFIG_SCHEMA = + 'urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig' +export const SCIM_RESOURCE_TYPE_SCHEMA = 'urn:ietf:params:scim:schemas:core:2.0:ResourceType' +export const SCIM_SCHEMA_SCHEMA = 'urn:ietf:params:scim:schemas:core:2.0:Schema' + +/** SCIM's own media type, plus the plain JSON every provider also sends. */ +export const SCIM_MEDIA_TYPE = 'application/scim+json' +export const SCIM_ACCEPTED_MEDIA_TYPES = [SCIM_MEDIA_TYPE, 'application/json'] as const + +/** The mount point every `meta.location` and `$ref` is built from. */ +export const SCIM_BASE_PATH = '/api/scim/v2' + +/** + * Largest page a list response returns, and the default when a provider asks + * for none. Okta imports with `count=100`; advertising a ceiling above what the + * providers use would only invite a request we would rather not serve in one + * transaction. + */ +export const SCIM_MAX_PAGE_SIZE = 100 + +/** Largest membership a single Group may carry. */ +export const SCIM_MAX_GROUP_MEMBERS = 1000 + +/** Largest number of `and`-joined terms accepted in one filter. */ +export const SCIM_MAX_FILTER_TERMS = 10 + +/** Largest number of operations accepted in one PATCH request. */ +export const SCIM_MAX_PATCH_OPERATIONS = 100 + +/** Largest request body accepted, sized for a full-membership Group write. */ +export const SCIM_MAX_BODY_BYTES = 1_000_000 + +/** + * Requests a connection may make per minute, and the burst it may spend at once. + * + * Microsoft Entra opens a provisioning cycle with a burst of reads and Okta + * pages imports at 100 users, so a limit tuned to interactive traffic would + * throttle an ordinary first sync. + */ +export const SCIM_RATE_LIMIT = { + maxTokens: 600, + refillRate: 300, + refillIntervalMs: 60_000, +} as const + +/** Request-log rows kept per connection; the reconcile job prunes the rest. */ +export const SCIM_REQUEST_LOG_RETENTION = 500 diff --git a/apps/sim/lib/scim/protocol/discovery.ts b/apps/sim/lib/scim/protocol/discovery.ts new file mode 100644 index 00000000000..1add3630a12 --- /dev/null +++ b/apps/sim/lib/scim/protocol/discovery.ts @@ -0,0 +1,175 @@ +import { + SCIM_ENTERPRISE_USER_SCHEMA, + SCIM_GROUP_SCHEMA, + SCIM_LIST_RESPONSE_SCHEMA, + SCIM_MAX_PAGE_SIZE, + SCIM_RESOURCE_TYPE_SCHEMA, + SCIM_SCHEMA_SCHEMA, + SCIM_SERVICE_PROVIDER_CONFIG_SCHEMA, + SCIM_USER_SCHEMA, +} from '@/lib/scim/protocol/constants' + +/** + * The discovery documents RFC 7644 requires. + * + * They describe exactly what this server implements, so a provider negotiating + * against them never configures something that will fail later. In particular + * `sort`, `etag`, and `bulk` are advertised as unsupported rather than omitted: + * a provider reading an absent capability may assume the default is true. + */ + +export function serviceProviderConfig(baseUrl: string) { + return { + schemas: [SCIM_SERVICE_PROVIDER_CONFIG_SCHEMA], + documentationUri: 'https://docs.sim.ai/platform/enterprise/scim', + patch: { supported: true }, + bulk: { supported: false, maxOperations: 0, maxPayloadSize: 0 }, + filter: { supported: true, maxResults: SCIM_MAX_PAGE_SIZE }, + changePassword: { supported: false }, + sort: { supported: false }, + etag: { supported: false }, + authenticationSchemes: [ + { + type: 'oauthbearertoken', + name: 'OAuth Bearer Token', + description: 'Authentication using a bearer token issued in Sim organization settings', + specUri: 'http://www.rfc-editor.org/info/rfc6750', + primary: true, + }, + ], + meta: { + resourceType: 'ServiceProviderConfig', + location: `${baseUrl}/ServiceProviderConfig`, + }, + } +} + +function resourceType( + id: 'User' | 'Group', + schema: string, + baseUrl: string, + extensions: Array<{ schema: string; required: boolean }> = [] +) { + return { + schemas: [SCIM_RESOURCE_TYPE_SCHEMA], + id, + name: id, + endpoint: `/${id}s`, + description: id === 'User' ? 'User Account' : 'Group', + schema, + ...(extensions.length > 0 ? { schemaExtensions: extensions } : {}), + meta: { resourceType: 'ResourceType', location: `${baseUrl}/ResourceTypes/${id}` }, + } +} + +export function resourceTypes(baseUrl: string) { + return [ + resourceType('User', SCIM_USER_SCHEMA, baseUrl, [ + { schema: SCIM_ENTERPRISE_USER_SCHEMA, required: false }, + ]), + resourceType('Group', SCIM_GROUP_SCHEMA, baseUrl), + ] +} + +function attribute(name: string, overrides: Record = {}): Record { + return { + name, + type: 'string', + multiValued: false, + required: false, + caseExact: false, + mutability: 'readWrite', + returned: 'default', + uniqueness: 'none', + ...overrides, + } +} + +export function schemaDefinitions(baseUrl: string) { + return [ + { + schemas: [SCIM_SCHEMA_SCHEMA], + id: SCIM_USER_SCHEMA, + name: 'User', + description: 'User Account', + attributes: [ + attribute('userName', { required: true, uniqueness: 'server' }), + attribute('externalId'), + attribute('displayName', { mutability: 'readWrite' }), + attribute('active', { type: 'boolean' }), + attribute('name', { + type: 'complex', + subAttributes: [attribute('formatted'), attribute('givenName'), attribute('familyName')], + }), + attribute('emails', { + type: 'complex', + multiValued: true, + subAttributes: [ + attribute('value', { uniqueness: 'server' }), + attribute('type'), + attribute('primary', { type: 'boolean' }), + ], + }), + attribute('groups', { + type: 'complex', + multiValued: true, + mutability: 'readOnly', + subAttributes: [ + attribute('value', { mutability: 'readOnly' }), + attribute('display', { mutability: 'readOnly' }), + attribute('$ref', { mutability: 'readOnly' }), + ], + }), + ], + meta: { resourceType: 'Schema', location: `${baseUrl}/Schemas/${SCIM_USER_SCHEMA}` }, + }, + { + schemas: [SCIM_SCHEMA_SCHEMA], + id: SCIM_ENTERPRISE_USER_SCHEMA, + name: 'EnterpriseUser', + description: 'Enterprise User Extension', + attributes: [ + attribute('employeeNumber'), + attribute('costCenter'), + attribute('organization'), + attribute('division'), + attribute('department'), + attribute('manager', { + type: 'complex', + subAttributes: [attribute('value'), attribute('displayName')], + }), + ], + meta: { + resourceType: 'Schema', + location: `${baseUrl}/Schemas/${SCIM_ENTERPRISE_USER_SCHEMA}`, + }, + }, + { + schemas: [SCIM_SCHEMA_SCHEMA], + id: SCIM_GROUP_SCHEMA, + name: 'Group', + description: 'Group', + attributes: [ + attribute('displayName', { required: true, uniqueness: 'server' }), + attribute('externalId'), + attribute('members', { + type: 'complex', + multiValued: true, + subAttributes: [attribute('value'), attribute('display'), attribute('type')], + }), + ], + meta: { resourceType: 'Schema', location: `${baseUrl}/Schemas/${SCIM_GROUP_SCHEMA}` }, + }, + ] +} + +/** Wraps discovery documents in the list envelope RFC 7644 requires. */ +export function discoveryList(resources: unknown[]) { + return { + schemas: [SCIM_LIST_RESPONSE_SCHEMA], + totalResults: resources.length, + startIndex: 1, + itemsPerPage: resources.length, + Resources: resources, + } +} diff --git a/apps/sim/lib/scim/protocol/errors.ts b/apps/sim/lib/scim/protocol/errors.ts new file mode 100644 index 00000000000..15d77f2e2e0 --- /dev/null +++ b/apps/sim/lib/scim/protocol/errors.ts @@ -0,0 +1,145 @@ +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { SCIM_ERROR_SCHEMA } from '@/lib/scim/protocol/constants' + +/** + * The `scimType` vocabulary of RFC 7644 section 3.12. + * + * A provider branches on this, not on the message: Okta reports a `uniqueness` + * conflict as an existing user and retries nothing, while it treats an + * unlabelled 409 as a transient failure worth retrying for the rest of the sync. + */ +export type ScimType = + | 'invalidFilter' + | 'tooMany' + | 'uniqueness' + | 'mutability' + | 'invalidSyntax' + | 'invalidPath' + | 'noTarget' + | 'invalidValue' + | 'invalidVers' + | 'sensitive' + +export interface ScimErrorBody { + schemas: [typeof SCIM_ERROR_SCHEMA] + /** RFC 7644 carries the status as a string inside the body as well. */ + status: string + scimType?: ScimType + detail: string +} + +/** A refusal rendered in the envelope RFC 7644 requires. */ +export class ScimError extends Error { + constructor( + readonly status: number, + readonly scimType: ScimType | undefined, + detail: string, + readonly headers?: Record + ) { + super(detail) + this.name = 'ScimError' + } + + get body(): ScimErrorBody { + return { + schemas: [SCIM_ERROR_SCHEMA], + status: String(this.status), + ...(this.scimType ? { scimType: this.scimType } : {}), + detail: this.message, + } + } +} + +export function scimErrorBody( + status: number, + scimType: ScimType | undefined, + detail: string +): ScimErrorBody { + return new ScimError(status, scimType, detail).body +} + +/** A value the provider sent is not one this attribute accepts. */ +export function invalidValue(detail: string): ScimError { + return new ScimError(400, 'invalidValue', detail) +} + +/** The provider addressed an attribute path this server does not implement. */ +export function invalidPath(detail: string): ScimError { + return new ScimError(400, 'invalidPath', detail) +} + +/** The provider tried to write an attribute the server owns. */ +export function mutability(detail: string): ScimError { + return new ScimError(400, 'mutability', detail) +} + +/** A filtered operation matched nothing and the operation cannot create one. */ +export function noTarget(detail: string): ScimError { + return new ScimError(400, 'noTarget', detail) +} + +/** The filter expression is outside the grammar this server supports. */ +export function invalidFilter(detail: string): ScimError { + return new ScimError(400, 'invalidFilter', detail) +} + +/** A uniqueness constraint the provider must resolve on its side. */ +export function uniqueness(detail: string): ScimError { + return new ScimError(409, 'uniqueness', detail) +} + +export function notFound(detail: string): ScimError { + return new ScimError(404, undefined, detail) +} + +/** + * PostgreSQL's lock-not-available code, raised when an advisory lock waiter hits + * `lock_timeout`. It means "try again", not "your request was wrong". + */ +const PG_LOCK_NOT_AVAILABLE = '55P03' + +function isLockTimeout(error: unknown): boolean { + return ( + typeof error === 'object' && + error !== null && + 'code' in error && + (error as { code?: unknown }).code === PG_LOCK_NOT_AVAILABLE + ) +} + +/** + * Renders any failure as a SCIM error. + * + * Domain failures arrive as {@link OrchestrationError} from the shared + * membership and permission primitives, which know nothing about SCIM. Mapping + * them here rather than at each throw site keeps those primitives usable by the + * UI, which needs the same failures rendered as ordinary HTTP. + */ +export function toScimError(error: unknown): ScimError { + if (error instanceof ScimError) return error + + if (isLockTimeout(error)) { + return new ScimError(503, undefined, 'The organization is busy; retry shortly', { + 'Retry-After': '5', + }) + } + + if (error instanceof OrchestrationError) { + switch (error.code) { + case 'not_found': + return new ScimError(404, undefined, error.message) + case 'conflict': + return new ScimError(409, 'uniqueness', error.message) + case 'forbidden': + return new ScimError(403, undefined, error.message) + case 'validation': + return new ScimError(400, 'invalidValue', error.message) + case 'locked': + return new ScimError(503, undefined, error.message, { 'Retry-After': '5' }) + default: + return new ScimError(500, undefined, 'Internal server error') + } + } + + return new ScimError(500, undefined, 'Internal server error') +} diff --git a/apps/sim/lib/scim/protocol/filter.test.ts b/apps/sim/lib/scim/protocol/filter.test.ts new file mode 100644 index 00000000000..4591e522ea3 --- /dev/null +++ b/apps/sim/lib/scim/protocol/filter.test.ts @@ -0,0 +1,96 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import type { ScimError } from '@/lib/scim/protocol/errors' +import { parseGroupFilter, parseUserFilter } from '@/lib/scim/protocol/filter' + +/** + * The grammar is deliberately small, so these tests are as much about what is + * refused as what is accepted. A filter this server silently widened would hand + * a provider a different set of users than it asked for, and the provider would + * reconcile against that set. + */ + +function scimTypeOf(run: () => unknown): string | undefined { + try { + run() + } catch (error) { + return (error as ScimError).scimType + } + return undefined +} + +describe('parseUserFilter', () => { + it('parses the lookup Okta sends before every create', () => { + expect(parseUserFilter('userName eq "ada@acme.test"')).toEqual([ + { field: 'userName', value: 'ada@acme.test' }, + ]) + }) + + it('parses an externalId lookup, which Entra uses when it is the match attribute', () => { + expect(parseUserFilter('externalId eq "00u1"')).toEqual([ + { field: 'externalId', value: '00u1' }, + ]) + }) + + it('parses the work-email filtered path Entra sends', () => { + expect(parseUserFilter('emails[type eq "work"].value eq "ada@acme.test"')).toEqual([ + { field: 'email', value: 'ada@acme.test' }, + ]) + }) + + it('joins expressions with and', () => { + expect(parseUserFilter('userName eq "ada@acme.test" and externalId eq "00u1"')).toEqual([ + { field: 'userName', value: 'ada@acme.test' }, + { field: 'externalId', value: '00u1' }, + ]) + }) + + it('accepts a URN-qualified attribute name', () => { + expect( + parseUserFilter('urn:ietf:params:scim:schemas:core:2.0:User:userName eq "a@b.test"') + ).toEqual([{ field: 'userName', value: 'a@b.test' }]) + }) + + it('treats the operator as case-insensitive', () => { + expect(parseUserFilter('userName Eq "a@b.test"')).toEqual([ + { field: 'userName', value: 'a@b.test' }, + ]) + }) + + it('does not split on the word and inside a quoted value', () => { + expect(parseUserFilter('userName eq "sand@acme.test"')).toEqual([ + { field: 'userName', value: 'sand@acme.test' }, + ]) + }) + + it('refuses an operator outside the supported set', () => { + expect(scimTypeOf(() => parseUserFilter('userName co "ada"'))).toBe('invalidFilter') + }) + + it('refuses an attribute this server cannot answer', () => { + expect(scimTypeOf(() => parseUserFilter('nickName eq "Ada"'))).toBe('invalidFilter') + }) + + it('refuses an unquoted value', () => { + expect(scimTypeOf(() => parseUserFilter('active eq true'))).toBe('invalidFilter') + }) + + it('refuses more than ten joined expressions', () => { + const filter = Array.from({ length: 11 }, (_, index) => `userName eq "u${index}"`).join(' and ') + expect(scimTypeOf(() => parseUserFilter(filter))).toBe('invalidFilter') + }) +}) + +describe('parseGroupFilter', () => { + it('parses the displayName lookup Okta sends before a group push', () => { + expect(parseGroupFilter('displayName eq "Engineering"')).toEqual([ + { field: 'displayName', value: 'Engineering' }, + ]) + }) + + it('refuses a User attribute on the Group endpoint', () => { + expect(scimTypeOf(() => parseGroupFilter('userName eq "a@b.test"'))).toBe('invalidFilter') + }) +}) diff --git a/apps/sim/lib/scim/protocol/filter.ts b/apps/sim/lib/scim/protocol/filter.ts new file mode 100644 index 00000000000..44d35a50d1a --- /dev/null +++ b/apps/sim/lib/scim/protocol/filter.ts @@ -0,0 +1,204 @@ +import { SCIM_MAX_FILTER_TERMS } from '@/lib/scim/protocol/constants' +import { invalidFilter } from '@/lib/scim/protocol/errors' +import { normalizeAttributePath } from '@/lib/scim/protocol/normalize' + +/** + * The filter grammar this server accepts, which is the subset the provisioning + * clients actually send. + * + * Okta filters `userName eq "x"` before every create and `displayName eq "x"` + * before every group push. Microsoft Entra states plainly that it "only uses + * the following operators: eq, and", and queries by `userName`, `externalId`, + * or `emails[type eq "work"].value` depending on which attribute the tenant + * chose for matching. OneLogin and JumpCloud send the same `userName eq` probe. + * + * Everything outside that is refused with `invalidFilter` rather than + * approximated. A filter this server silently widened would hand a provider a + * different set of users than it asked for, and it would reconcile against that + * set — deleting or deactivating whatever it believes has disappeared. + */ + +/** Attributes a User filter may name, mapped to the field the repository knows. */ +export type ScimUserFilterField = 'id' | 'userName' | 'externalId' | 'email' | 'active' + +/** Attributes a Group filter may name. */ +export type ScimGroupFilterField = 'id' | 'displayName' | 'externalId' + +export interface ScimFilterTerm { + field: Field + value: string +} + +const USER_FILTER_FIELDS: Record = { + id: 'id', + username: 'userName', + externalid: 'externalId', + 'emails.value': 'email', + 'emails[type eq "work"].value': 'email', + "emails[type eq 'work'].value": 'email', + 'emails[primary eq true].value': 'email', + active: 'active', +} + +const GROUP_FILTER_FIELDS: Record = { + id: 'id', + displayname: 'displayName', + externalid: 'externalId', +} + +/** + * Splits on the `and` keyword at the top level of the expression. + * + * Quote- and bracket-aware, so an `and` inside a quoted value or inside a + * `[type eq "work"]` value filter is not mistaken for a separator. + */ +function splitConjunction(expression: string): string[] { + const terms: string[] = [] + let depth = 0 + let quoted = false + let escaped = false + let start = 0 + + for (let index = 0; index < expression.length; index += 1) { + const character = expression[index] + + if (escaped) { + escaped = false + continue + } + if (quoted) { + if (character === '\\') escaped = true + else if (character === '"') quoted = false + continue + } + if (character === '"') { + quoted = true + continue + } + if (character === '[' || character === '(') { + depth += 1 + continue + } + if (character === ']' || character === ')') { + depth -= 1 + if (depth < 0) throw invalidFilter('Unbalanced brackets in filter expression') + continue + } + if (depth > 0) continue + + const isBoundary = (position: number) => + position < 0 || position >= expression.length || /\s/.test(expression[position]) + if ( + (character === 'a' || character === 'A') && + expression.slice(index, index + 3).toLowerCase() === 'and' && + isBoundary(index - 1) && + isBoundary(index + 3) + ) { + terms.push(expression.slice(start, index)) + start = index + 3 + index += 2 + } + } + + if (quoted || depth !== 0) throw invalidFilter('Unterminated quote or bracket in filter') + terms.push(expression.slice(start)) + return terms +} + +/** + * Splits `attributePath operator "value"` at the operator. + * + * Scanned rather than matched with one expression, because an attribute path may + * itself contain spaces and an operator: `emails[type eq "work"].value` is a + * single attribute, and a regex that stopped at the first space would read its + * inner `eq` as the comparison and the rest as a malformed value. + */ +function splitAtOperator(term: string): { attribute: string; operator: string; value: string } { + let depth = 0 + let quoted = false + let escaped = false + + for (let index = 0; index < term.length; index += 1) { + const character = term[index] + if (escaped) { + escaped = false + continue + } + if (quoted) { + if (character === '\\') escaped = true + else if (character === '"') quoted = false + continue + } + if (character === '"') { + quoted = true + continue + } + if (character === '[') depth += 1 + else if (character === ']') depth -= 1 + if (depth !== 0 || !/\s/.test(character)) continue + + const rest = term.slice(index).trimStart() + const operatorEnd = rest.search(/\s/) + if (operatorEnd === -1) break + const operator = rest.slice(0, operatorEnd) + if (!/^[a-zA-Z]{2}$/.test(operator)) continue + + return { + attribute: term.slice(0, index).trim(), + operator: operator.toLowerCase(), + value: rest.slice(operatorEnd).trim(), + } + } + + throw invalidFilter(`Unsupported filter expression: ${term.trim()}`) +} + +function parseTerm(term: string): { attribute: string; value: string } { + const { attribute, operator, value: rawValue } = splitAtOperator(term.trim()) + + if (operator !== 'eq') { + throw invalidFilter(`The filter operator ${operator} is not supported; use eq`) + } + + const raw = rawValue.trim() + if (!raw.startsWith('"') || !raw.endsWith('"') || raw.length < 2) { + throw invalidFilter('Filter values must be quoted strings') + } + let value: string + try { + value = JSON.parse(raw) as string + } catch { + throw invalidFilter('Filter values must be quoted strings') + } + + return { attribute, value } +} + +function parseTerms( + filter: string, + fields: Record, + resourceName: string +): ScimFilterTerm[] { + const parts = splitConjunction(filter) + if (parts.length > SCIM_MAX_FILTER_TERMS) { + throw invalidFilter(`A filter may join at most ${SCIM_MAX_FILTER_TERMS} expressions with and`) + } + + return parts.map((part) => { + const { attribute, value } = parseTerm(part) + const normalized = normalizeAttributePath(attribute).toLowerCase() + const field = fields[normalized] + if (!field) { + throw invalidFilter(`The filter attribute ${attribute} is not supported for ${resourceName}`) + } + return { field, value } + }) +} + +export function parseUserFilter(filter: string): ScimFilterTerm[] { + return parseTerms(filter, USER_FILTER_FIELDS, 'User') +} + +export function parseGroupFilter(filter: string): ScimFilterTerm[] { + return parseTerms(filter, GROUP_FILTER_FIELDS, 'Group') +} diff --git a/apps/sim/lib/scim/protocol/group-patch.test.ts b/apps/sim/lib/scim/protocol/group-patch.test.ts new file mode 100644 index 00000000000..827acf16915 --- /dev/null +++ b/apps/sim/lib/scim/protocol/group-patch.test.ts @@ -0,0 +1,102 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { scimPatchBodySchema } from '@/lib/api/contracts/scim' +import { SCIM_PATCH_OP_SCHEMA } from '@/lib/scim/protocol/constants' +import type { ScimError } from '@/lib/scim/protocol/errors' +import { parseGroupPatch } from '@/lib/scim/protocol/group-patch' + +function parseOperations(operations: unknown[]) { + return scimPatchBodySchema.parse({ schemas: [SCIM_PATCH_OP_SCHEMA], Operations: operations }) + .Operations +} + +describe('parseGroupPatch', () => { + it('reads Okta’s filtered member removal', () => { + const patch = parseGroupPatch( + parseOperations([{ op: 'remove', path: 'members[value eq "u1"]' }]) + ) + expect(patch).toEqual({ kind: 'incremental', add: [], remove: ['u1'] }) + }) + + it('reads Okta’s member addition', () => { + const patch = parseGroupPatch( + parseOperations([{ op: 'add', path: 'members', value: [{ value: 'u1', display: 'Ada' }] }]) + ) + expect(patch).toEqual({ kind: 'incremental', add: ['u1'], remove: [] }) + }) + + it('reads Entra’s legacy removal, which identifies the member by value alone', () => { + const patch = parseGroupPatch( + parseOperations([{ op: 'Remove', path: 'members', value: [{ value: 'u1' }] }]) + ) + expect(patch).toEqual({ kind: 'incremental', add: [], remove: ['u1'] }) + }) + + it('reads Entra’s add form with a null $ref alongside the value', () => { + const patch = parseGroupPatch( + parseOperations([{ op: 'Add', path: 'members', value: [{ $ref: null, value: 'u2' }] }]) + ) + expect(patch).toEqual({ kind: 'incremental', add: ['u2'], remove: [] }) + }) + + it('treats a wholesale member replacement as a full patch', () => { + const patch = parseGroupPatch( + parseOperations([{ op: 'replace', path: 'members', value: [{ value: 'u1' }] }]) + ) + expect(patch).toMatchObject({ kind: 'full', members: ['u1'] }) + }) + + it('treats a valueless member removal as clearing the membership', () => { + const patch = parseGroupPatch(parseOperations([{ op: 'remove', path: 'members' }])) + expect(patch).toMatchObject({ kind: 'full', members: [] }) + }) + + it('reads Okta’s rename, ignoring the id it echoes back', () => { + const patch = parseGroupPatch( + parseOperations([{ op: 'replace', value: { id: 'g1', displayName: 'Platform' } }]) + ) + expect(patch).toMatchObject({ kind: 'full', displayName: 'Platform' }) + }) + + it('carries membership deltas that accompany a rename', () => { + const patch = parseGroupPatch( + parseOperations([ + { op: 'replace', path: 'displayName', value: 'Platform' }, + { op: 'add', path: 'members', value: [{ value: 'u3' }] }, + ]) + ) + expect(patch).toMatchObject({ kind: 'full', displayName: 'Platform', addMembers: ['u3'] }) + }) + + it('refuses a remove with no path', () => { + let scimType: string | undefined + try { + parseGroupPatch(parseOperations([{ op: 'remove', value: { members: [] } }])) + } catch (error) { + scimType = (error as ScimError).scimType + } + expect(scimType).toBe('noTarget') + }) + + it('refuses removing the display name', () => { + let scimType: string | undefined + try { + parseGroupPatch(parseOperations([{ op: 'remove', path: 'displayName' }])) + } catch (error) { + scimType = (error as ScimError).scimType + } + expect(scimType).toBe('mutability') + }) + + it('refuses an unsupported path', () => { + let scimType: string | undefined + try { + parseGroupPatch(parseOperations([{ op: 'replace', path: 'owner', value: 'u1' }])) + } catch (error) { + scimType = (error as ScimError).scimType + } + expect(scimType).toBe('invalidPath') + }) +}) diff --git a/apps/sim/lib/scim/protocol/group-patch.ts b/apps/sim/lib/scim/protocol/group-patch.ts new file mode 100644 index 00000000000..46b57e9a4ca --- /dev/null +++ b/apps/sim/lib/scim/protocol/group-patch.ts @@ -0,0 +1,155 @@ +import type { ScimPatchOperation } from '@/lib/api/contracts/scim' +import { readMemberValue } from '@/lib/scim/protocol/canonical' +import { invalidPath, invalidValue, mutability, noTarget } from '@/lib/scim/protocol/errors' +import { isRecord, normalizeAttributePath } from '@/lib/scim/protocol/normalize' + +/** + * A parsed Group PATCH. + * + * Membership changes are separated from whole-resource writes because the + * providers send far more of the former: an incremental sync that moves one + * person between groups should touch two membership rows, not rewrite two full + * member lists. + */ +export type GroupPatch = + | { kind: 'incremental'; add: string[]; remove: string[] } + | { + kind: 'full' + displayName?: string + externalId?: string | null + /** Replaces the whole membership when present. */ + members?: string[] + /** Deltas that accompanied a rename in the same request. */ + addMembers: string[] + removeMembers: string[] + } + +/** `members[value eq "id"]`, the removal form Okta and Entra's newer job send. */ +const FILTERED_MEMBER_PATTERN = + /^members\[\s*value\s+eq\s+(?"|')(?[^"']+)\k\s*\]$/i + +function readMemberList(value: unknown): string[] { + const entries = Array.isArray(value) ? value : [value] + const ids: string[] = [] + for (const entry of entries) { + const id = readMemberValue(entry) + if (id && !ids.includes(id)) ids.push(id) + } + return ids +} + +/** + * Reads a Group PATCH, choosing the incremental path when every operation is a + * membership delta. + */ +export function parseGroupPatch(operations: readonly ScimPatchOperation[]): GroupPatch { + const add: string[] = [] + const remove: string[] = [] + let incremental = true + + const full: Extract = { + kind: 'full', + addMembers: [], + removeMembers: [], + } + + const applyFullMembers = (ids: string[]) => { + incremental = false + full.members = ids + } + + for (const operation of operations) { + if (operation.op === 'remove' && !operation.path) { + throw noTarget('A remove operation requires a path') + } + + if (!operation.path) { + const value = operation.value + if (!isRecord(value)) { + throw invalidValue('A PATCH operation without a path requires an object value') + } + incremental = false + for (const [attribute, nested] of Object.entries(value)) { + const key = normalizeAttributePath(attribute).toLowerCase() + if (key === 'displayname') { + if (typeof nested !== 'string' || !nested.trim()) { + throw invalidValue('displayName must be a non-empty string') + } + full.displayName = nested.trim() + } else if (key === 'externalid') { + full.externalId = typeof nested === 'string' && nested.trim() ? nested.trim() : null + } else if (key === 'members') { + applyFullMembers(readMemberList(nested)) + } else if (key === 'id' || key === 'schemas' || key.startsWith('meta')) { + } else { + throw invalidPath(`Group PATCH path ${attribute} is not supported`) + } + } + continue + } + + const path = normalizeAttributePath(operation.path) + const filtered = path.match(FILTERED_MEMBER_PATTERN) + if (filtered?.groups) { + if (operation.op !== 'remove') { + throw invalidPath('A filtered members path is only supported for remove') + } + const id = filtered.groups.value.trim() + if (id && !remove.includes(id)) remove.push(id) + continue + } + + const key = path.toLowerCase() + if (key === 'members') { + if (operation.op === 'replace') { + applyFullMembers(readMemberList(operation.value ?? [])) + continue + } + if (operation.op === 'remove' && operation.value === undefined) { + /** A remove with no value clears the membership entirely. */ + applyFullMembers([]) + continue + } + const ids = readMemberList(operation.value ?? []) + const target = operation.op === 'add' ? add : remove + for (const id of ids) if (!target.includes(id)) target.push(id) + continue + } + + if (key === 'displayname') { + if (operation.op === 'remove') throw mutability('displayName cannot be removed') + if (typeof operation.value !== 'string' || !operation.value.trim()) { + throw invalidValue('displayName must be a non-empty string') + } + incremental = false + full.displayName = operation.value.trim() + continue + } + + if (key === 'externalid') { + incremental = false + full.externalId = + operation.op === 'remove' || typeof operation.value !== 'string' + ? null + : operation.value.trim() || null + continue + } + + if (key === 'id' || key === 'schemas' || key.startsWith('meta')) { + throw mutability(`${operation.path} is read-only`) + } + + throw invalidPath(`Group PATCH path ${operation.path} is not supported`) + } + + if (incremental) return { kind: 'incremental', add, remove } + + /** + * A request that mixed a rename with membership deltas still has to apply + * those deltas. They ride along so the caller resolves them against current + * membership after any wholesale replacement in the same request. + */ + full.addMembers = add + full.removeMembers = remove + return full +} diff --git a/apps/sim/lib/scim/protocol/normalize.ts b/apps/sim/lib/scim/protocol/normalize.ts new file mode 100644 index 00000000000..968025c45be --- /dev/null +++ b/apps/sim/lib/scim/protocol/normalize.ts @@ -0,0 +1,106 @@ +/** + * Tolerances for what identity providers actually send, as distinct from what + * RFC 7644 describes. + * + * Every rule here is a documented provider behavior, not a guess. Microsoft + * Entra's classic provisioning job sends booleans as the strings `"True"` and + * `"False"`, capitalizes PATCH operation names, and wraps a single-valued + * attribute in a one-element array. Rejecting any of those is a failed sync the + * administrator cannot fix from their side. + */ + +/** + * Reads a SCIM boolean, accepting the string forms Entra sends. + * + * Returns the input unchanged when it is neither, so the caller's schema + * produces the error rather than this function silently coercing nonsense. + */ +export function normalizeScimBoolean(value: unknown): unknown { + if (typeof value === 'boolean') return value + if (typeof value !== 'string') return value + const lowered = value.trim().toLowerCase() + if (lowered === 'true') return true + if (lowered === 'false') return false + return value +} + +/** + * Unwraps `[x]` to `x`. + * + * Entra sends a one-element array where the schema declares a single value. + * Only applied where a scalar is expected, so a genuinely multi-valued + * attribute keeps its array. + */ +export function unwrapSingleElement(value: unknown): unknown { + return Array.isArray(value) && value.length === 1 ? value[0] : value +} + +/** True when the value is a plain object rather than an array or null. */ +export function isRecord(value: unknown): value is Record { + return typeof value === 'object' && value !== null && !Array.isArray(value) +} + +/** + * Rewrites the boolean-valued attributes of an inbound body in place of their + * string forms, before schema validation sees them. + * + * Applied to the whole body rather than to individual fields because the same + * job sends `active` at the top level, `primary` inside every multi-valued + * attribute, and both again nested in PATCH operation values. + */ +export function normalizeScimBooleansDeep(value: unknown): unknown { + if (Array.isArray(value)) return value.map(normalizeScimBooleansDeep) + if (!isRecord(value)) return value + const next: Record = {} + for (const [key, nested] of Object.entries(value)) { + next[key] = BOOLEAN_ATTRIBUTES.has(key.toLowerCase()) + ? normalizeScimBoolean(unwrapSingleElement(nested)) + : normalizeScimBooleansDeep(nested) + } + return next +} + +/** Attribute names whose value is a boolean everywhere they appear. */ +const BOOLEAN_ATTRIBUTES = new Set(['active', 'primary']) + +/** + * Strips a schema URN prefix from an attribute path and lower-cases the + * attribute name. + * + * RFC 7643 makes attribute names case-insensitive, and providers disagree: + * Okta sends `userName`, Entra sometimes sends `username` and sometimes the + * fully qualified `urn:...:User:userName`. + */ +export function normalizeAttributePath(path: string): string { + let value = path.trim() + if (value.startsWith('/')) value = value.slice(1) + try { + value = decodeURIComponent(value) + } catch { + // A path that is not valid percent-encoding is used as written; the caller's + // closed path table rejects it with `invalidPath` either way. + } + const lowered = value.toLowerCase() + const coreUserPrefix = 'urn:ietf:params:scim:schemas:core:2.0:user:' + const coreGroupPrefix = 'urn:ietf:params:scim:schemas:core:2.0:group:' + const enterprisePrefix = 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:user:' + if (lowered.startsWith(coreUserPrefix)) return value.slice(coreUserPrefix.length) + if (lowered.startsWith(coreGroupPrefix)) return value.slice(coreGroupPrefix.length) + if (lowered.startsWith(enterprisePrefix)) { + return `enterprise.${value.slice(enterprisePrefix.length)}` + } + return value +} + +/** + * Microsoft's classic Group schema marker, sent on `POST /Groups` by older + * provisioning jobs alongside the core Group URN. It carries no attributes and + * is never stored or returned. + */ +export const ENTRA_LEGACY_GROUP_SCHEMA = + 'http://schemas.microsoft.com/2006/11/ResourceManagement/ADSCIM/2.0/Group' + +/** Drops schema URNs that are provider markers rather than real extensions. */ +export function stripProviderSchemaMarkers(schemas: readonly string[]): string[] { + return schemas.filter((schema) => schema !== ENTRA_LEGACY_GROUP_SCHEMA) +} diff --git a/apps/sim/lib/scim/protocol/resources.test.ts b/apps/sim/lib/scim/protocol/resources.test.ts new file mode 100644 index 00000000000..22dd30cd547 --- /dev/null +++ b/apps/sim/lib/scim/protocol/resources.test.ts @@ -0,0 +1,119 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { SCIM_MAX_PAGE_SIZE } from '@/lib/scim/protocol/constants' +import type { ScimError } from '@/lib/scim/protocol/errors' +import { + parseAttributeProjection, + projectionWants, + projectResource, + resolvePage, + toUserResource, +} from '@/lib/scim/protocol/resources' + +const BASE_URL = 'https://sim.test/api/scim/v2' + +function userRow() { + return { + id: 'su1', + externalId: '00u1', + userName: 'ada@acme.test', + active: true, + attributes: { + userName: 'ada@acme.test', + active: true, + displayName: 'Ada Lovelace', + name: { formatted: 'Ada Lovelace', givenName: 'Ada', familyName: 'Lovelace' }, + emails: [{ value: 'ada@acme.test', type: 'work', primary: true }], + }, + createdAt: new Date('2026-01-01T00:00:00.000Z'), + updatedAt: new Date('2026-02-01T00:00:00.000Z'), + email: 'ada@acme.test', + groups: [{ id: 'g1', displayName: 'Engineering' }], + } +} + +describe('resolvePage', () => { + it('defaults to the first page at the maximum size', () => { + expect(resolvePage({})).toEqual({ + startIndex: 1, + offset: 0, + count: SCIM_MAX_PAGE_SIZE, + }) + }) + + it('clamps a zero startIndex up, because Okta sends one on its first import page', () => { + expect(resolvePage({ startIndex: 0 })).toMatchObject({ startIndex: 1, offset: 0 }) + }) + + it('caps the page size so one request cannot ask for an unbounded read', () => { + expect(resolvePage({ count: 5000 }).count).toBe(SCIM_MAX_PAGE_SIZE) + }) + + it('allows a zero count, which Entra uses to ask only for the total', () => { + expect(resolvePage({ count: 0 }).count).toBe(0) + }) + + it('refuses a non-integer count', () => { + let scimType: string | undefined + try { + resolvePage({ count: 1.5 }) + } catch (error) { + scimType = (error as ScimError).scimType + } + expect(scimType).toBe('invalidValue') + }) +}) + +describe('toUserResource', () => { + it('renders the resource a provider expects', () => { + const resource = toUserResource(userRow(), BASE_URL) + expect(resource).toMatchObject({ + id: 'su1', + externalId: '00u1', + userName: 'ada@acme.test', + active: true, + meta: { + resourceType: 'User', + location: `${BASE_URL}/Users/su1`, + lastModified: '2026-02-01T00:00:00.000Z', + }, + }) + expect(resource.groups).toEqual([ + { value: 'g1', display: 'Engineering', $ref: `${BASE_URL}/Groups/g1` }, + ]) + }) + + it('reports the Sim account address rather than a stale stored copy', () => { + const row = { ...userRow(), email: 'moved@acme.test' } + expect(toUserResource(row, BASE_URL).emails[0]).toMatchObject({ + value: 'moved@acme.test', + primary: true, + }) + }) +}) + +describe('attribute projection', () => { + it('honours the members exclusion Entra sends on every group list', () => { + const projection = parseAttributeProjection({ excludedAttributes: 'members' }) + expect(projectionWants(projection, 'members')).toBe(false) + expect(projectionWants(projection, 'displayName')).toBe(true) + }) + + it('keeps schemas, id and meta whatever the request asked for', () => { + const projection = parseAttributeProjection({ attributes: 'userName' }) + const projected = projectResource(toUserResource(userRow(), BASE_URL), projection) + expect(Object.keys(projected).sort()).toEqual(['id', 'meta', 'schemas', 'userName']) + }) + + it('refuses combining an include list with an exclude list', () => { + let scimType: string | undefined + try { + parseAttributeProjection({ attributes: 'userName', excludedAttributes: 'groups' }) + } catch (error) { + scimType = (error as ScimError).scimType + } + expect(scimType).toBe('invalidValue') + }) +}) diff --git a/apps/sim/lib/scim/protocol/resources.ts b/apps/sim/lib/scim/protocol/resources.ts new file mode 100644 index 00000000000..246309090a9 --- /dev/null +++ b/apps/sim/lib/scim/protocol/resources.ts @@ -0,0 +1,263 @@ +import type { ScimUserAttributes } from '@sim/db/schema' +import { + SCIM_ENTERPRISE_USER_SCHEMA, + SCIM_GROUP_SCHEMA, + SCIM_LIST_RESPONSE_SCHEMA, + SCIM_MAX_PAGE_SIZE, + SCIM_USER_SCHEMA, +} from '@/lib/scim/protocol/constants' +import { invalidValue } from '@/lib/scim/protocol/errors' + +export interface ScimResourceMeta { + resourceType: 'User' | 'Group' + created: string + lastModified: string + location: string + version: string +} + +export interface ScimUserResource { + schemas: string[] + id: string + externalId?: string + userName: string + active: boolean + displayName: string + name: { formatted: string; givenName?: string; familyName?: string } + emails: Array<{ value: string; type?: string; primary: boolean }> + groups: Array<{ value: string; display: string; $ref: string }> + meta: ScimResourceMeta + [attribute: string]: unknown +} + +export interface ScimGroupResource { + schemas: string[] + id: string + externalId?: string + displayName: string + members?: Array<{ value: string; display?: string; $ref: string; type: 'User' }> + meta: ScimResourceMeta + [attribute: string]: unknown +} + +export interface ScimListResponse { + schemas: [typeof SCIM_LIST_RESPONSE_SCHEMA] + totalResults: number + startIndex: number + itemsPerPage: number + Resources: Resource[] +} + +/** + * An entity tag derived from the row's last write. + * + * Advertised as unsupported in `ServiceProviderConfig`, so no provider will send + * `If-Match`. It is still returned because Okta's import surfaces `meta.version` + * in its admin UI, where an empty value reads as a broken integration. + */ +function versionOf(updatedAt: Date): string { + return `W/"${updatedAt.getTime()}"` +} + +export interface UserResourceRow { + id: string + externalId: string | null + userName: string + active: boolean + attributes: ScimUserAttributes + createdAt: Date + updatedAt: Date + /** The Sim account's address, which is authoritative over the stored copy. */ + email: string + groups: Array<{ id: string; displayName: string }> +} + +export function toUserResource(row: UserResourceRow, baseUrl: string): ScimUserResource { + const stored = row.attributes + const primaryType = stored.emails.find((entry) => entry.primary)?.type + + /** + * The address comes from the Sim account rather than the stored resource. The + * two only diverge when something outside SCIM changed it, and reporting the + * stale copy would tell the directory its write is still in place while sign-in + * uses a different address. + */ + const emails: ScimUserResource['emails'] = [ + { value: row.email, primary: true, ...(primaryType ? { type: primaryType } : {}) }, + ...stored.emails + .filter((entry) => !entry.primary && entry.value !== row.email) + .map((entry) => ({ + value: entry.value, + primary: false, + ...(entry.type ? { type: entry.type } : {}), + })), + ] + + return { + schemas: [SCIM_USER_SCHEMA, ...(stored.enterprise ? [SCIM_ENTERPRISE_USER_SCHEMA] : [])], + ...(stored.extra ?? {}), + id: row.id, + ...(row.externalId ? { externalId: row.externalId } : {}), + userName: row.userName, + active: row.active, + displayName: stored.displayName, + name: stored.name, + emails, + groups: row.groups.map((group) => ({ + value: group.id, + display: group.displayName, + $ref: `${baseUrl}/Groups/${group.id}`, + })), + ...(stored.enterprise ? { [SCIM_ENTERPRISE_USER_SCHEMA]: stored.enterprise } : {}), + meta: { + resourceType: 'User', + created: row.createdAt.toISOString(), + lastModified: row.updatedAt.toISOString(), + location: `${baseUrl}/Users/${row.id}`, + version: versionOf(row.updatedAt), + }, + } +} + +export interface GroupResourceRow { + id: string + externalId: string | null + displayName: string + createdAt: Date + updatedAt: Date + members?: Array<{ scimUserId: string; displayName: string }> +} + +export function toGroupResource(row: GroupResourceRow, baseUrl: string): ScimGroupResource { + return { + schemas: [SCIM_GROUP_SCHEMA], + id: row.id, + ...(row.externalId ? { externalId: row.externalId } : {}), + displayName: row.displayName, + ...(row.members + ? { + members: row.members.map((member) => ({ + value: member.scimUserId, + display: member.displayName, + $ref: `${baseUrl}/Users/${member.scimUserId}`, + type: 'User' as const, + })), + } + : {}), + meta: { + resourceType: 'Group', + created: row.createdAt.toISOString(), + lastModified: row.updatedAt.toISOString(), + location: `${baseUrl}/Groups/${row.id}`, + version: versionOf(row.updatedAt), + }, + } +} + +export function toListResponse( + resources: Resource[], + totalResults: number, + startIndex: number +): ScimListResponse { + return { + schemas: [SCIM_LIST_RESPONSE_SCHEMA], + totalResults, + startIndex, + itemsPerPage: resources.length, + Resources: resources, + } +} + +export interface ScimPage { + startIndex: number + offset: number + count: number +} + +/** + * Resolves the page a list request asked for. + * + * `startIndex` is 1-based per RFC 7644 and clamped up rather than rejected, + * because Okta's import sends `startIndex=0` on its first page. `count` is + * capped so one request cannot ask the database for an unbounded page. + */ +export function resolvePage(input: { + startIndex?: number | undefined + count?: number | undefined +}): ScimPage { + const rawStart = input.startIndex + const rawCount = input.count + if (rawStart !== undefined && !Number.isInteger(rawStart)) { + throw invalidValue('startIndex must be an integer') + } + if (rawCount !== undefined && !Number.isInteger(rawCount)) { + throw invalidValue('count must be an integer') + } + + const startIndex = Math.max(rawStart ?? 1, 1) + const count = Math.min(Math.max(rawCount ?? SCIM_MAX_PAGE_SIZE, 0), SCIM_MAX_PAGE_SIZE) + return { startIndex, offset: startIndex - 1, count } +} + +/** + * The attribute projection a request asked for. + * + * Only `members` on Groups and `groups` on Users are honored as real query + * shortcuts, because those are the two that cost a join. Entra sends + * `excludedAttributes=members` on every group list, and answering it by loading + * the membership and then discarding it would defeat the point of the request. + */ +export interface ScimAttributeProjection { + include?: Set + exclude?: Set +} + +function parseAttributeList(value: string | undefined): Set | undefined { + if (!value) return undefined + const names = value + .split(',') + .map((name) => name.trim().toLowerCase()) + .filter(Boolean) + return names.length > 0 ? new Set(names) : undefined +} + +export function parseAttributeProjection(query: { + attributes?: string | undefined + excludedAttributes?: string | undefined +}): ScimAttributeProjection { + const include = parseAttributeList(query.attributes) + const exclude = parseAttributeList(query.excludedAttributes) + if (include && exclude) { + throw invalidValue('attributes and excludedAttributes cannot be combined') + } + return { ...(include ? { include } : {}), ...(exclude ? { exclude } : {}) } +} + +/** Whether a projection asks for an attribute that costs a separate query. */ +export function projectionWants(projection: ScimAttributeProjection, attribute: string): boolean { + const name = attribute.toLowerCase() + if (projection.exclude?.has(name)) return false + if (projection.include) return projection.include.has(name) + return true +} + +/** Attributes every resource keeps regardless of the projection requested. */ +const ALWAYS_RETURNED = new Set(['schemas', 'id', 'meta']) + +/** Drops attributes the request did not ask for. */ +export function projectResource( + resource: Resource, + projection: ScimAttributeProjection +): Resource { + if (!projection.include && !projection.exclude) return resource + const projected: Record = {} + for (const [key, value] of Object.entries(resource)) { + const name = key.toLowerCase() + if (ALWAYS_RETURNED.has(name)) { + projected[key] = value + continue + } + if (projectionWants(projection, name)) projected[key] = value + } + return projected as Resource +} diff --git a/apps/sim/lib/scim/protocol/user-patch.test.ts b/apps/sim/lib/scim/protocol/user-patch.test.ts new file mode 100644 index 00000000000..e058e4f41bb --- /dev/null +++ b/apps/sim/lib/scim/protocol/user-patch.test.ts @@ -0,0 +1,196 @@ +/** + * @vitest-environment node + */ +import type { ScimUserAttributes } from '@sim/db/schema' +import { describe, expect, it } from 'vitest' +import { scimPatchBodySchema } from '@/lib/api/contracts/scim' +import { SCIM_PATCH_OP_SCHEMA } from '@/lib/scim/protocol/constants' +import { ScimError } from '@/lib/scim/protocol/errors' +import { applyUserPatch } from '@/lib/scim/protocol/user-patch' + +/** + * Every fixture here is a request shape taken from Okta's or Microsoft's own + * provisioning documentation, not an invented one. The point of the test is that + * what those two products actually send is accepted. + */ + +function baseUser(overrides: Partial = {}): ScimUserAttributes { + return { + userName: 'ada@acme.test', + externalId: '00u1', + active: true, + displayName: 'Ada Lovelace', + name: { formatted: 'Ada Lovelace', givenName: 'Ada', familyName: 'Lovelace' }, + emails: [{ value: 'ada@acme.test', type: 'work', primary: true }], + ...overrides, + } +} + +/** Parses through the real contract so the tests exercise the tolerances too. */ +function parseOperations(operations: unknown[]) { + return scimPatchBodySchema.parse({ schemas: [SCIM_PATCH_OP_SCHEMA], Operations: operations }) + .Operations +} + +describe('applyUserPatch', () => { + it('deactivates from Okta’s path-less replace', () => { + const { next, changed } = applyUserPatch( + baseUser(), + parseOperations([{ op: 'replace', value: { active: false } }]) + ) + expect(changed).toBe(true) + expect(next.active).toBe(false) + }) + + it('deactivates from Entra’s capitalized op and string boolean', () => { + const { next, changed } = applyUserPatch( + baseUser(), + parseOperations([{ op: 'Replace', path: 'active', value: 'False' }]) + ) + expect(changed).toBe(true) + expect(next.active).toBe(false) + }) + + it('reactivates', () => { + const { next } = applyUserPatch( + baseUser({ active: false }), + parseOperations([{ op: 'replace', value: { active: true } }]) + ) + expect(next.active).toBe(true) + }) + + it('applies Entra’s path-less replace with dotted attribute keys', () => { + const { next } = applyUserPatch( + baseUser(), + parseOperations([ + { + op: 'Replace', + value: { + 'name.givenName': 'Augusta', + 'name.familyName': 'King', + displayName: 'Augusta King', + }, + }, + ]) + ) + expect(next.name.givenName).toBe('Augusta') + expect(next.name.familyName).toBe('King') + expect(next.name.formatted).toBe('Augusta King') + expect(next.displayName).toBe('Augusta King') + }) + + it('creates a work email when the filtered path matches nothing', () => { + const { next } = applyUserPatch( + baseUser({ emails: [{ value: 'ada@acme.test', primary: true }] }), + parseOperations([ + { op: 'replace', path: 'emails[type eq "work"].value', value: 'ada.k@acme.test' }, + ]) + ) + expect(next.emails).toContainEqual({ value: 'ada.k@acme.test', type: 'work', primary: false }) + }) + + it('replaces an existing work email in place', () => { + const { next } = applyUserPatch( + baseUser(), + parseOperations([ + { op: 'Replace', path: 'emails[type eq "work"].value', value: 'ADA.K@ACME.TEST' }, + ]) + ) + expect(next.emails).toEqual([{ value: 'ada.k@acme.test', type: 'work', primary: true }]) + }) + + it('replaces the primary email through Entra’s primary filter', () => { + const { next } = applyUserPatch( + baseUser(), + parseOperations([ + { op: 'replace', path: 'emails[primary eq true].value', value: 'new@acme.test' }, + ]) + ) + expect(next.emails[0].value).toBe('new@acme.test') + }) + + it('unwraps a single-element array around a scalar', () => { + const { next } = applyUserPatch( + baseUser(), + parseOperations([{ op: 'replace', path: 'name.givenName', value: ['Augusta'] }]) + ) + expect(next.name.givenName).toBe('Augusta') + }) + + it('reads enterprise attributes under the URN-qualified path', () => { + const { next } = applyUserPatch( + baseUser(), + parseOperations([ + { + op: 'Replace', + path: 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:department', + value: 'Analytical Engines', + }, + ]) + ) + expect(next.enterprise?.department).toBe('Analytical Engines') + }) + + it('clears a manager when Entra sends an empty string', () => { + const { next } = applyUserPatch( + baseUser({ enterprise: { manager: { value: 'mgr-1' } } }), + parseOperations([{ op: 'Replace', path: 'enterprise.manager', value: '' }]) + ) + expect(next.enterprise?.manager).toBeUndefined() + }) + + it('reports no change when a patch re-sends what is already stored', () => { + const { changed } = applyUserPatch( + baseUser(), + parseOperations([ + { op: 'replace', value: { active: true } }, + { op: 'Replace', path: 'name.givenName', value: 'Ada' }, + ]) + ) + expect(changed).toBe(false) + }) + + it('defaults a missing op to replace, as Okta omits it', () => { + const { next } = applyUserPatch(baseUser(), parseOperations([{ value: { active: false } }])) + expect(next.active).toBe(false) + }) + + it('refuses a remove with no path', () => { + expect(() => + applyUserPatch(baseUser(), parseOperations([{ op: 'remove', value: { active: false } }])) + ).toThrowError(expect.objectContaining({ scimType: 'noTarget' })) + }) + + it('refuses writing a server-owned attribute', () => { + expect(() => + applyUserPatch(baseUser(), parseOperations([{ op: 'replace', path: 'id', value: 'x' }])) + ).toThrowError(expect.objectContaining({ scimType: 'mutability' })) + }) + + it('refuses an attribute this server does not store', () => { + let raised: unknown + try { + applyUserPatch( + baseUser(), + parseOperations([{ op: 'replace', path: 'nickName', value: 'Ada' }]) + ) + } catch (error) { + raised = error + } + expect(raised).toBeInstanceOf(ScimError) + expect((raised as ScimError).scimType).toBe('invalidPath') + }) + + it('refuses a non-boolean active value', () => { + expect(() => + applyUserPatch(baseUser(), parseOperations([{ op: 'replace', path: 'active', value: 'yes' }])) + ).toThrowError(expect.objectContaining({ scimType: 'invalidValue' })) + }) + + it('leaves the stored resource untouched', () => { + const original = baseUser() + const snapshot = structuredClone(original) + applyUserPatch(original, parseOperations([{ op: 'replace', value: { active: false } }])) + expect(original).toEqual(snapshot) + }) +}) diff --git a/apps/sim/lib/scim/protocol/user-patch.ts b/apps/sim/lib/scim/protocol/user-patch.ts new file mode 100644 index 00000000000..1285617df8a --- /dev/null +++ b/apps/sim/lib/scim/protocol/user-patch.ts @@ -0,0 +1,308 @@ +import type { ScimUserAttributes, ScimUserEmail } from '@sim/db/schema' +import type { ScimPatchOperation } from '@/lib/api/contracts/scim' +import { invalidPath, invalidValue, mutability, noTarget } from '@/lib/scim/protocol/errors' +import { + isRecord, + normalizeAttributePath, + normalizeScimBoolean, + unwrapSingleElement, +} from '@/lib/scim/protocol/normalize' + +/** + * Applies a PATCH operation list to a stored User resource. + * + * Written here rather than taken from a library. The published SCIM patch + * packages assume the RFC's wire shapes, and the two providers that matter do + * not send them: Microsoft Entra capitalizes operation names, sends booleans as + * strings, and identifies a member to remove by value alone where a library + * compares the whole object. A patch engine that silently no-ops on a removal is + * worse than one that refuses, because the directory records a success and stops + * retrying. + * + * The attribute table is closed. An unrecognized path is an error, never a + * silent drop, so a provider mapping an attribute Sim does not store learns it + * on the first sync. + */ + +export interface UserPatchOutcome { + next: ScimUserAttributes + changed: boolean +} + +function clone(attributes: ScimUserAttributes): ScimUserAttributes { + return structuredClone(attributes) +} + +function requireString(value: unknown, attribute: string): string { + const unwrapped = unwrapSingleElement(value) + if (typeof unwrapped !== 'string') throw invalidValue(`${attribute} must be a string`) + const trimmed = unwrapped.trim() + if (!trimmed) throw invalidValue(`${attribute} must not be empty`) + return trimmed +} + +function requireBoolean(value: unknown, attribute: string): boolean { + const normalized = normalizeScimBoolean(unwrapSingleElement(value)) + if (typeof normalized !== 'boolean') throw invalidValue(`${attribute} must be a boolean`) + return normalized +} + +/** Recomputes `formatted` and `displayName` after a name part changes. */ +function refreshDerivedNames(user: ScimUserAttributes, fallback: string): void { + const joined = [user.name.givenName, user.name.familyName].filter(Boolean).join(' ') + if (joined) user.name.formatted = joined + else if (!user.name.formatted) user.name.formatted = fallback + if (!user.displayName) user.displayName = user.name.formatted +} + +function setPrimaryEmailValue(user: ScimUserAttributes, value: string): void { + const primary = user.emails.find((entry) => entry.primary) + if (!primary) throw noTarget('The resource has no primary email address to replace') + primary.value = value.toLowerCase() +} + +function upsertTypedEmail(user: ScimUserAttributes, type: string, value: string): void { + const existing = user.emails.find((entry) => entry.type?.toLowerCase() === type.toLowerCase()) + if (existing) { + existing.value = value.toLowerCase() + return + } + /** + * Entra maps a work address to a filtered path and expects the target to be + * created when the resource does not already carry one. RFC 7644 would answer + * `noTarget`, and doing so fails the whole atomic PATCH over an attribute the + * provider is trying to populate for the first time. + */ + user.emails.push({ value: value.toLowerCase(), type, primary: user.emails.length === 0 }) +} + +function removeTypedEmail(user: ScimUserAttributes, type: string): void { + const remaining = user.emails.filter((entry) => entry.type?.toLowerCase() !== type.toLowerCase()) + if (remaining.length === user.emails.length) return + if (remaining.length === 0) throw invalidValue('A user must keep at least one email address') + if (!remaining.some((entry) => entry.primary)) remaining[0].primary = true + user.emails = remaining +} + +function normalizeEmailList(value: unknown, attribute: string): ScimUserEmail[] { + const entries = Array.isArray(value) ? value : [value] + const normalized: ScimUserEmail[] = [] + for (const entry of entries) { + if (!isRecord(entry)) throw invalidValue(`${attribute} entries must be objects`) + const address = requireString(entry.value, `${attribute}.value`) + normalized.push({ + value: address.toLowerCase(), + ...(typeof entry.type === 'string' && entry.type.trim() ? { type: entry.type.trim() } : {}), + primary: normalizeScimBoolean(entry.primary) === true, + }) + } + if (normalized.length === 0) throw invalidValue(`${attribute} must not be empty`) + if (!normalized.some((entry) => entry.primary)) normalized[0].primary = true + return normalized +} + +/** `emails[type eq "work"].value` and the `primary eq true` variant Entra sends. */ +const FILTERED_EMAIL_PATTERN = + /^emails\[\s*(?type|primary)\s+eq\s+(?"|')?(?[^"'\]]+)\k?\s*\]\.value$/i + +function applyOperation( + user: ScimUserAttributes, + op: 'add' | 'replace' | 'remove', + rawPath: string, + value: unknown +): void { + const path = normalizeAttributePath(rawPath) + const key = path.toLowerCase() + + const filtered = path.match(FILTERED_EMAIL_PATTERN) + if (filtered?.groups) { + const { selector, match } = filtered.groups + if (selector.toLowerCase() === 'primary') { + if (normalizeScimBoolean(match) !== true) { + throw invalidPath(`Unsupported User PATCH path ${rawPath}`) + } + if (op === 'remove') throw invalidValue('The primary email address cannot be removed') + setPrimaryEmailValue(user, requireString(value, 'emails.value')) + return + } + if (op === 'remove') removeTypedEmail(user, match) + else upsertTypedEmail(user, match, requireString(value, 'emails.value')) + return + } + + switch (key) { + case 'active': + user.active = op === 'remove' ? true : requireBoolean(value, 'active') + return + + case 'username': + if (op === 'remove') throw mutability('userName cannot be removed') + user.userName = requireString(value, 'userName').toLowerCase() + return + + case 'externalid': + if (op === 'remove') user.externalId = undefined + else user.externalId = requireString(value, 'externalId') + return + + case 'displayname': + user.displayName = op === 'remove' ? user.name.formatted : requireString(value, 'displayName') + return + + case 'name.formatted': + if (op === 'remove') throw invalidValue('name.formatted cannot be removed') + user.name.formatted = requireString(value, 'name.formatted') + return + + case 'name.givenname': + if (op === 'remove') user.name.givenName = undefined + else user.name.givenName = requireString(value, 'name.givenName') + refreshDerivedNames(user, user.userName) + return + + case 'name.familyname': + if (op === 'remove') user.name.familyName = undefined + else user.name.familyName = requireString(value, 'name.familyName') + refreshDerivedNames(user, user.userName) + return + + case 'emails': + if (op === 'remove') throw invalidValue('emails cannot be removed') + if (op === 'replace') { + user.emails = normalizeEmailList(value, 'emails') + return + } + for (const entry of normalizeEmailList(value, 'emails')) { + const existing = user.emails.find((candidate) => candidate.value === entry.value) + if (existing) { + if (entry.primary) { + for (const candidate of user.emails) candidate.primary = false + existing.primary = true + } + continue + } + if (entry.primary) for (const candidate of user.emails) candidate.primary = false + user.emails.push(entry) + } + return + + case 'emails.value': + if (op === 'remove') throw invalidValue('emails cannot be removed') + setPrimaryEmailValue(user, requireString(value, 'emails.value')) + return + + case 'enterprise.department': + case 'enterprise.employeenumber': + case 'enterprise.costcenter': + case 'enterprise.division': + case 'enterprise.organization': { + const field = key.slice('enterprise.'.length) + const attribute = ( + { + department: 'department', + employeenumber: 'employeeNumber', + costcenter: 'costCenter', + division: 'division', + organization: 'organization', + } as const + )[field as 'department' | 'employeenumber' | 'costcenter' | 'division' | 'organization'] + user.enterprise ??= {} + if (op === 'remove') user.enterprise[attribute] = undefined + else user.enterprise[attribute] = requireString(value, `enterprise.${attribute}`) + return + } + + case 'enterprise.manager': + case 'enterprise.manager.value': { + user.enterprise ??= {} + const unwrapped = unwrapSingleElement(value) + /** Entra clears a manager by sending an empty string rather than removing. */ + if (op === 'remove' || unwrapped === '' || unwrapped === null) { + user.enterprise.manager = undefined + return + } + if (typeof unwrapped === 'string') { + user.enterprise.manager = { value: unwrapped } + return + } + if (isRecord(unwrapped)) { + user.enterprise.manager = { + ...(typeof unwrapped.value === 'string' ? { value: unwrapped.value } : {}), + ...(typeof unwrapped.displayName === 'string' + ? { displayName: unwrapped.displayName } + : {}), + } + return + } + throw invalidValue('enterprise manager must be an identifier or an object') + } + + case 'id': + case 'schemas': + throw mutability(`${rawPath} is read-only`) + + default: + if (key.startsWith('meta')) throw mutability(`${rawPath} is read-only`) + throw invalidPath(`User PATCH path ${rawPath} is not supported`) + } +} + +/** + * Sorts object keys at every depth so serialization is order-independent. + * + * Cleared attributes are set to `undefined` rather than deleted, and + * `JSON.stringify` drops those, so a cleared attribute compares equal to an + * absent one — which is what it means on the wire and in storage. + */ +function sortDeep(value: unknown): unknown { + if (Array.isArray(value)) return value.map(sortDeep) + if (!isRecord(value)) return value + const sorted: Record = {} + for (const key of Object.keys(value).sort()) sorted[key] = sortDeep(value[key]) + return sorted +} + +/** + * Canonical form used only to decide whether a patch changed anything. + * + * Key order in the stored JSON is not meaningful, so comparing serialized + * objects directly would report a change whenever a provider reordered its + * attributes — and every such false positive is a write, an audit row, and a + * projection pass that did nothing. + */ +function comparisonKey(attributes: ScimUserAttributes): string { + return JSON.stringify(sortDeep(attributes)) +} + +export function applyUserPatch( + current: ScimUserAttributes, + operations: readonly ScimPatchOperation[] +): UserPatchOutcome { + const next = clone(current) + + for (const operation of operations) { + if (operation.op === 'remove' && !operation.path) { + throw noTarget('A remove operation requires a path') + } + + if (!operation.path) { + const value = operation.value + if (!isRecord(value)) { + throw invalidValue('A PATCH operation without a path requires an object value') + } + /** + * Entra's compliant mode sends one path-less replace whose value object is + * keyed by dotted attribute paths, so each key is dispatched as if it had + * arrived as its own operation. + */ + for (const [attribute, nested] of Object.entries(value)) { + applyOperation(next, operation.op, attribute, nested) + } + continue + } + + applyOperation(next, operation.op, operation.path, operation.value) + } + + return { next, changed: comparisonKey(current) !== comparisonKey(next) } +} diff --git a/apps/sim/lib/scim/reconcile/job.ts b/apps/sim/lib/scim/reconcile/job.ts new file mode 100644 index 00000000000..8dd3080db8b --- /dev/null +++ b/apps/sim/lib/scim/reconcile/job.ts @@ -0,0 +1,182 @@ +import { db } from '@sim/db' +import { scimConnection } from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { generateId } from '@sim/utils/id' +import { and, eq, isNull, lt, or, sql } from 'drizzle-orm' +import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' +import { listScimUserIds } from '@/lib/scim/repository/users' +import { pruneScimRequestLog } from '@/lib/scim/request-log' + +const logger = createLogger('ScimReconcile') + +/** + * The scheduled drift pass. + * + * Group mappings are applied when membership changes, so in the ordinary case + * this finds nothing. It exists for the cases where the ordinary path could not + * finish: a post-commit effect that failed, a manual change made while + * managed-membership locking was off, or a mapping edited against a target that + * was concurrently deleted. Re-running the projection is idempotent, so a pass + * that finds nothing writes nothing. + */ + +/** How long a claimed lease is honored before another run may take it over. */ +const LEASE_TTL_MS = 15 * 60 * 1000 + +/** How often a connection is swept when nothing else triggers it. */ +const RECONCILE_INTERVAL_MS = 24 * 60 * 60 * 1000 + +/** Users reconciled per transaction, so no single one holds locks for long. */ +const BATCH_SIZE = 200 + +export interface ScimReconcileReport { + connectionId: string + reconciledUsers: number + grantsAdded: number + grantsRemoved: number +} + +/** + * Claims a connection with a single conditional update. + * + * The compare-and-set is the claim: two schedulers racing produce one winner, + * because only one `UPDATE` can match a row whose lease is free or stale. + */ +async function acquireLease(connectionId: string, runId: string): Promise { + const staleBefore = new Date(Date.now() - LEASE_TTL_MS) + const claimed = await db + .update(scimConnection) + .set({ reconcileLockToken: runId, reconcileLeaseAt: new Date() }) + .where( + and( + eq(scimConnection.id, connectionId), + eq(scimConnection.status, 'active'), + or( + isNull(scimConnection.reconcileLockToken), + lt(scimConnection.reconcileLeaseAt, staleBefore) + ) + ) + ) + .returning({ id: scimConnection.id }) + return claimed.length > 0 +} + +async function releaseLease(connectionId: string, runId: string): Promise { + await db + .update(scimConnection) + .set({ reconcileLockToken: null, reconcileLeaseAt: null, reconciledAt: new Date() }) + .where(and(eq(scimConnection.id, connectionId), eq(scimConnection.reconcileLockToken, runId))) +} + +/** Connections whose last sweep is older than the interval, oldest first. */ +export async function findConnectionsDueForReconcile(limit: number): Promise< + Array<{ + id: string + organizationId: string + settings: (typeof scimConnection.$inferSelect)['settings'] + }> +> { + const dueBefore = new Date(Date.now() - RECONCILE_INTERVAL_MS) + return db + .select({ + id: scimConnection.id, + organizationId: scimConnection.organizationId, + settings: scimConnection.settings, + }) + .from(scimConnection) + .where( + and( + eq(scimConnection.status, 'active'), + or(isNull(scimConnection.reconciledAt), lt(scimConnection.reconciledAt, dueBefore)) + ) + ) + .orderBy(sql`${scimConnection.reconciledAt} asc nulls first`) + .limit(limit) +} + +export async function reconcileConnection(connection: { + id: string + organizationId: string + settings: (typeof scimConnection.$inferSelect)['settings'] +}): Promise { + const runId = generateId() + if (!(await acquireLease(connection.id, runId))) return null + + const report: ScimReconcileReport = { + connectionId: connection.id, + reconciledUsers: 0, + grantsAdded: 0, + grantsRemoved: 0, + } + + try { + let cursor: string | undefined + for (;;) { + const page = await listScimUserIds(db, { + connectionId: connection.id, + ...(cursor ? { afterOrderKey: cursor } : {}), + limit: BATCH_SIZE, + }) + if (page.length === 0) break + + await db.transaction(async (tx) => { + for (const row of page) { + const delta = await reconcileUserProjection(tx, { + connectionId: connection.id, + organizationId: connection.organizationId, + scimUserId: row.id, + settings: connection.settings, + }) + report.reconciledUsers += 1 + report.grantsAdded += delta.added.length + delta.raised.length + report.grantsRemoved += delta.removed.length + } + }) + cursor = page[page.length - 1].orderKey + } + + await pruneScimRequestLog(connection.id) + if (report.grantsAdded > 0 || report.grantsRemoved > 0) { + logger.warn('Directory reconciliation corrected drift', report) + } + return report + } finally { + await releaseLease(connection.id, runId) + } +} + +export interface ScimReconcileSweep { + connections: number + reconciledUsers: number + grantsAdded: number + grantsRemoved: number +} + +export async function runScimReconcileSweep(maxConnections = 25): Promise { + const due = await findConnectionsDueForReconcile(maxConnections) + const sweep: ScimReconcileSweep = { + connections: 0, + reconciledUsers: 0, + grantsAdded: 0, + grantsRemoved: 0, + } + + for (const connection of due) { + try { + const report = await reconcileConnection(connection) + if (!report) continue + sweep.connections += 1 + sweep.reconciledUsers += report.reconciledUsers + sweep.grantsAdded += report.grantsAdded + sweep.grantsRemoved += report.grantsRemoved + } catch (error) { + /** One tenant's failure must not stop the sweep for the others. */ + logger.error('Directory reconciliation failed for a connection', { + connectionId: connection.id, + error, + }) + } + } + + return sweep +} diff --git a/apps/sim/lib/scim/repository/groups.ts b/apps/sim/lib/scim/repository/groups.ts new file mode 100644 index 00000000000..ce6c8b3ae83 --- /dev/null +++ b/apps/sim/lib/scim/repository/groups.ts @@ -0,0 +1,221 @@ +import { scimGroup, scimGroupMember, scimUser } from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import { and, asc, count, eq, inArray, type SQL } from 'drizzle-orm' +import type { DbOrTx } from '@/lib/db/types' +import { invalidValue } from '@/lib/scim/protocol/errors' +import type { ScimFilterTerm, ScimGroupFilterField } from '@/lib/scim/protocol/filter' +import { buildOrderKey } from '@/lib/scim/repository/users' + +/** Reads and writes of the provisioned Group table, always anchored to a connection. */ + +export interface ScimGroupRecord { + id: string + externalId: string | null + displayName: string + createdAt: Date + updatedAt: Date +} + +const GROUP_SELECTION = { + id: scimGroup.id, + externalId: scimGroup.externalId, + displayName: scimGroup.displayName, + createdAt: scimGroup.createdAt, + updatedAt: scimGroup.updatedAt, +} as const + +function groupFilterCondition(term: ScimFilterTerm): SQL | undefined { + switch (term.field) { + case 'id': + return eq(scimGroup.id, term.value) + case 'displayName': + return eq(scimGroup.displayNameKey, term.value.toLowerCase()) + case 'externalId': + return eq(scimGroup.externalId, term.value) + } +} + +export async function findScimGroupById( + tx: DbOrTx, + connectionId: string, + groupId: string +): Promise { + const [row] = await tx + .select(GROUP_SELECTION) + .from(scimGroup) + .where(and(eq(scimGroup.connectionId, connectionId), eq(scimGroup.id, groupId))) + .limit(1) + return row ?? null +} + +export async function pageScimGroups( + tx: DbOrTx, + params: { + connectionId: string + filters: ScimFilterTerm[] + offset: number + limit: number + } +): Promise<{ records: ScimGroupRecord[]; totalResults: number }> { + const conditions = [ + eq(scimGroup.connectionId, params.connectionId), + ...params.filters + .map(groupFilterCondition) + .filter((value): value is SQL => value !== undefined), + ] + + const [totalRow] = await tx + .select({ value: count() }) + .from(scimGroup) + .where(and(...conditions)) + + const records = + params.limit === 0 + ? [] + : await tx + .select(GROUP_SELECTION) + .from(scimGroup) + .where(and(...conditions)) + .orderBy(asc(scimGroup.orderKey)) + .limit(params.limit) + .offset(params.offset) + + return { records, totalResults: totalRow?.value ?? 0 } +} + +export interface ScimGroupMemberRow { + scimUserId: string + displayName: string +} + +/** Members of one group, ordered so a response is stable between reads. */ +export async function loadGroupMembers(tx: DbOrTx, groupId: string): Promise { + const rows = await tx + .select({ scimUserId: scimGroupMember.scimUserId, displayName: scimUser.userName }) + .from(scimGroupMember) + .innerJoin(scimUser, eq(scimUser.id, scimGroupMember.scimUserId)) + .where(eq(scimGroupMember.groupId, groupId)) + .orderBy(asc(scimGroupMember.createdAt), asc(scimGroupMember.scimUserId)) + return rows +} + +export async function loadGroupMemberIds(tx: DbOrTx, groupId: string): Promise { + const rows = await tx + .select({ scimUserId: scimGroupMember.scimUserId }) + .from(scimGroupMember) + .where(eq(scimGroupMember.groupId, groupId)) + return rows.map((row) => row.scimUserId) +} + +/** + * Refuses member ids that belong to another connection or do not exist. + * + * Without it a directory could name any resource id and pull an unrelated + * organization's user into a group it controls. + */ +export async function assertConnectionOwnsUsers( + tx: DbOrTx, + connectionId: string, + scimUserIds: string[] +): Promise { + if (scimUserIds.length === 0) return + const rows = await tx + .select({ id: scimUser.id }) + .from(scimUser) + .where(and(eq(scimUser.connectionId, connectionId), inArray(scimUser.id, scimUserIds))) + if (rows.length !== scimUserIds.length) { + throw invalidValue('One or more Group members are not users of this directory') + } +} + +export async function insertScimGroup( + tx: DbOrTx, + params: { connectionId: string; displayName: string; externalId?: string | undefined } +): Promise { + const id = generateId() + const createdAt = new Date() + await tx.insert(scimGroup).values({ + id, + connectionId: params.connectionId, + externalId: params.externalId ?? null, + displayName: params.displayName, + displayNameKey: params.displayName.toLowerCase(), + orderKey: buildOrderKey(createdAt, id), + createdAt, + updatedAt: createdAt, + }) + return { + id, + externalId: params.externalId ?? null, + displayName: params.displayName, + createdAt, + updatedAt: createdAt, + } +} + +export async function updateScimGroup( + tx: DbOrTx, + params: { groupId: string; displayName?: string; externalId?: string | null } +): Promise { + await tx + .update(scimGroup) + .set({ + ...(params.displayName !== undefined + ? { displayName: params.displayName, displayNameKey: params.displayName.toLowerCase() } + : {}), + ...(params.externalId !== undefined ? { externalId: params.externalId } : {}), + updatedAt: new Date(), + }) + .where(eq(scimGroup.id, params.groupId)) +} + +export async function touchScimGroup(tx: DbOrTx, groupId: string): Promise { + await tx.update(scimGroup).set({ updatedAt: new Date() }).where(eq(scimGroup.id, groupId)) +} + +export async function deleteScimGroup(tx: DbOrTx, groupId: string): Promise { + await tx.delete(scimGroup).where(eq(scimGroup.id, groupId)) +} + +/** Adds a member, tolerating a repeat. Returns whether the row was new. */ +export async function addGroupMember( + tx: DbOrTx, + params: { groupId: string; scimUserId: string } +): Promise { + const inserted = await tx + .insert(scimGroupMember) + .values({ + id: generateId(), + groupId: params.groupId, + scimUserId: params.scimUserId, + createdAt: new Date(), + }) + .onConflictDoNothing() + .returning({ id: scimGroupMember.id }) + return inserted.length > 0 +} + +/** Removes a member, tolerating one who is not in the group. */ +export async function removeGroupMember( + tx: DbOrTx, + params: { groupId: string; scimUserId: string } +): Promise { + const deleted = await tx + .delete(scimGroupMember) + .where( + and( + eq(scimGroupMember.groupId, params.groupId), + eq(scimGroupMember.scimUserId, params.scimUserId) + ) + ) + .returning({ id: scimGroupMember.id }) + return deleted.length > 0 +} + +export async function countGroupMembers(tx: DbOrTx, groupId: string): Promise { + const [row] = await tx + .select({ value: count() }) + .from(scimGroupMember) + .where(eq(scimGroupMember.groupId, groupId)) + return row?.value ?? 0 +} diff --git a/apps/sim/lib/scim/repository/users.ts b/apps/sim/lib/scim/repository/users.ts new file mode 100644 index 00000000000..5a5dd0aa39a --- /dev/null +++ b/apps/sim/lib/scim/repository/users.ts @@ -0,0 +1,254 @@ +import { type ScimUserAttributes, scimGroup, scimGroupMember, scimUser, user } from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import { and, asc, count, eq, inArray, type SQL, sql } from 'drizzle-orm' +import type { DbOrTx } from '@/lib/db/types' +import type { ScimFilterTerm, ScimUserFilterField } from '@/lib/scim/protocol/filter' +import type { UserResourceRow } from '@/lib/scim/protocol/resources' + +/** + * Reads and writes of the provisioned User table. + * + * Every predicate is anchored to a connection id. That is the whole tenant + * boundary for this surface: a request names a resource id and nothing else, so + * a query that forgot the anchor would let one organization's directory address + * another's users. + */ + +/** + * A sortable key that never reorders between pages. + * + * A provider walks a list with `startIndex`, so rows must keep their positions + * across separate requests. Two rows created in the same millisecond would tie + * on a timestamp alone and could swap places between pages, silently hiding one + * from an import; appending the id breaks the tie permanently. + */ +export function buildOrderKey(createdAt: Date, id: string): string { + return `${String(createdAt.getTime()).padStart(15, '0')}:${id}` +} + +function userFilterCondition(term: ScimFilterTerm): SQL | undefined { + switch (term.field) { + case 'id': + return eq(scimUser.id, term.value) + case 'userName': + return eq(scimUser.userName, term.value.toLowerCase()) + case 'externalId': + return eq(scimUser.externalId, term.value) + case 'email': + return sql`lower(${user.email}) = ${term.value.toLowerCase()}` + case 'active': + return eq(scimUser.active, term.value.toLowerCase() === 'true') + } +} + +const USER_SELECTION = { + id: scimUser.id, + userId: scimUser.userId, + externalId: scimUser.externalId, + userName: scimUser.userName, + active: scimUser.active, + attributes: scimUser.attributes, + createdAt: scimUser.createdAt, + updatedAt: scimUser.updatedAt, + email: user.email, + userSuspendedAt: user.suspendedAt, +} as const + +export interface ScimUserRecord { + id: string + userId: string + externalId: string | null + userName: string + active: boolean + attributes: ScimUserAttributes + createdAt: Date + updatedAt: Date + email: string + userSuspendedAt: Date | null +} + +/** Group memberships for a set of provisioned users, for the `groups` attribute. */ +export async function loadGroupsForScimUsers( + tx: DbOrTx, + scimUserIds: string[] +): Promise>> { + const byUser = new Map>() + if (scimUserIds.length === 0) return byUser + + const rows = await tx + .select({ + scimUserId: scimGroupMember.scimUserId, + groupId: scimGroup.id, + displayName: scimGroup.displayName, + }) + .from(scimGroupMember) + .innerJoin(scimGroup, eq(scimGroup.id, scimGroupMember.groupId)) + .where(inArray(scimGroupMember.scimUserId, scimUserIds)) + .orderBy(asc(scimGroup.displayName)) + + for (const row of rows) { + const existing = byUser.get(row.scimUserId) + const entry = { id: row.groupId, displayName: row.displayName } + if (existing) existing.push(entry) + else byUser.set(row.scimUserId, [entry]) + } + return byUser +} + +export function toUserResourceRow( + record: ScimUserRecord, + groups: Array<{ id: string; displayName: string }> +): UserResourceRow { + return { + id: record.id, + externalId: record.externalId, + userName: record.userName, + /** + * A suspension applied outside the directory — by an administrator during an + * investigation — is reported as inactive. Answering `true` would tell the + * directory the person can sign in when they cannot. + */ + active: record.active && record.userSuspendedAt === null, + attributes: record.attributes, + createdAt: record.createdAt, + updatedAt: record.updatedAt, + email: record.email, + groups, + } +} + +export async function findScimUserById( + tx: DbOrTx, + connectionId: string, + scimUserId: string +): Promise { + const [row] = await tx + .select(USER_SELECTION) + .from(scimUser) + .innerJoin(user, eq(user.id, scimUser.userId)) + .where(and(eq(scimUser.connectionId, connectionId), eq(scimUser.id, scimUserId))) + .limit(1) + return row ?? null +} + +export async function findScimUserByUserId( + tx: DbOrTx, + connectionId: string, + userId: string +): Promise { + const [row] = await tx + .select(USER_SELECTION) + .from(scimUser) + .innerJoin(user, eq(user.id, scimUser.userId)) + .where(and(eq(scimUser.connectionId, connectionId), eq(scimUser.userId, userId))) + .limit(1) + return row ?? null +} + +export interface ScimUserPage { + records: ScimUserRecord[] + totalResults: number +} + +export async function pageScimUsers( + tx: DbOrTx, + params: { + connectionId: string + filters: ScimFilterTerm[] + offset: number + limit: number + } +): Promise { + const conditions = [ + eq(scimUser.connectionId, params.connectionId), + ...params.filters.map(userFilterCondition).filter((value): value is SQL => value !== undefined), + ] + + const [totalRow] = await tx + .select({ value: count() }) + .from(scimUser) + .innerJoin(user, eq(user.id, scimUser.userId)) + .where(and(...conditions)) + + /** + * A page of zero is a real request: Microsoft Entra's connection test asks for + * the total without any resources. Skipping the row query keeps that cheap. + */ + const records = + params.limit === 0 + ? [] + : await tx + .select(USER_SELECTION) + .from(scimUser) + .innerJoin(user, eq(user.id, scimUser.userId)) + .where(and(...conditions)) + .orderBy(asc(scimUser.orderKey)) + .limit(params.limit) + .offset(params.offset) + + return { records, totalResults: totalRow?.value ?? 0 } +} + +export async function insertScimUser( + tx: DbOrTx, + params: { + connectionId: string + userId: string + attributes: ScimUserAttributes + active: boolean + } +): Promise<{ id: string }> { + const id = generateId() + const createdAt = new Date() + await tx.insert(scimUser).values({ + id, + connectionId: params.connectionId, + userId: params.userId, + externalId: params.attributes.externalId ?? null, + userName: params.attributes.userName, + active: params.active, + attributes: params.attributes, + orderKey: buildOrderKey(createdAt, id), + createdAt, + updatedAt: createdAt, + }) + return { id } +} + +export async function updateScimUser( + tx: DbOrTx, + params: { scimUserId: string; attributes: ScimUserAttributes; active: boolean } +): Promise { + await tx + .update(scimUser) + .set({ + externalId: params.attributes.externalId ?? null, + userName: params.attributes.userName, + active: params.active, + attributes: params.attributes, + updatedAt: new Date(), + }) + .where(eq(scimUser.id, params.scimUserId)) +} + +export async function deleteScimUser(tx: DbOrTx, scimUserId: string): Promise { + await tx.delete(scimUser).where(eq(scimUser.id, scimUserId)) +} + +/** All provisioned users on a connection, in pages, for the reconcile job. */ +export async function listScimUserIds( + tx: DbOrTx, + params: { connectionId: string; afterOrderKey?: string; limit: number } +): Promise> { + return tx + .select({ id: scimUser.id, orderKey: scimUser.orderKey }) + .from(scimUser) + .where( + and( + eq(scimUser.connectionId, params.connectionId), + ...(params.afterOrderKey ? [sql`${scimUser.orderKey} > ${params.afterOrderKey}`] : []) + ) + ) + .orderBy(asc(scimUser.orderKey)) + .limit(params.limit) +} diff --git a/apps/sim/lib/scim/request-log.ts b/apps/sim/lib/scim/request-log.ts new file mode 100644 index 00000000000..98f11d8df68 --- /dev/null +++ b/apps/sim/lib/scim/request-log.ts @@ -0,0 +1,57 @@ +import { db } from '@sim/db' +import { scimRequestLog } from '@sim/db/schema' +import { createLogger } from '@sim/logger' +import { generateId } from '@sim/utils/id' +import { truncate } from '@sim/utils/string' +import { sql } from 'drizzle-orm' +import type { ScimRequestLogEntry } from '@/lib/api/server/routes/scim-route' +import { SCIM_REQUEST_LOG_RETENTION } from '@/lib/scim/protocol/constants' + +const logger = createLogger('ScimRequestLog') + +/** + * Records one provisioning request for the settings activity view. + * + * An administrator debugging a connection has nothing else to look at: + * Microsoft Entra reports a failed cycle without saying what it sent, and Okta + * surfaces only the status. Fire-and-forget, because a logging failure must not + * turn a successful provisioning call into an error the directory will retry. + */ +export function recordScimRequest(entry: ScimRequestLogEntry): void { + void db + .insert(scimRequestLog) + .values({ + id: generateId(), + connectionId: entry.principal.connectionId, + credentialId: entry.principal.credentialId, + method: entry.method, + path: entry.path, + status: entry.status, + scimType: entry.scimType ?? null, + /** Bounded: a detail is a sentence for a person, not a payload dump. */ + detail: entry.detail ? truncate(entry.detail, 500) : null, + userAgent: entry.userAgent ? truncate(entry.userAgent, 200) : null, + durationMs: entry.durationMs, + createdAt: new Date(), + }) + .catch((error) => logger.warn('Failed to record a SCIM request', { error })) +} + +/** + * Trims a connection's log to its most recent rows. + * + * Run by the reconcile job rather than on write: pruning inline would add a + * delete to every provisioning call, and the bound only has to hold over hours. + */ +export async function pruneScimRequestLog(connectionId: string): Promise { + await db.execute(sql` + delete from ${scimRequestLog} + where ${scimRequestLog.connectionId} = ${connectionId} + and ${scimRequestLog.id} not in ( + select id from ${scimRequestLog} + where ${scimRequestLog.connectionId} = ${connectionId} + order by ${scimRequestLog.createdAt} desc + limit ${SCIM_REQUEST_LOG_RETENTION} + ) + `) +} diff --git a/apps/sim/lib/scim/route.ts b/apps/sim/lib/scim/route.ts new file mode 100644 index 00000000000..bb3b7f443ea --- /dev/null +++ b/apps/sim/lib/scim/route.ts @@ -0,0 +1,18 @@ +import { createScimRouteBuilder } from '@/lib/api/server/routes/scim-route' +import { getBaseUrl } from '@/lib/core/utils/urls' +import { authenticateScimRequest } from '@/lib/scim/authenticate' +import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' +import { recordScimRequest } from '@/lib/scim/request-log' + +/** + * The route builder wired to this deployment. + * + * The builder takes its authenticator, base URL, and request recorder as + * dependencies so it stays testable without a database; this module is where + * the real ones are bound, and it is what every route file imports. + */ +export const defineScimRoute = createScimRouteBuilder({ + authenticate: authenticateScimRequest, + baseUrl: () => `${getBaseUrl()}${SCIM_BASE_PATH}`, + recordRequest: recordScimRequest, +}) diff --git a/apps/sim/lib/uploads/upload-session/service.ts b/apps/sim/lib/uploads/upload-session/service.ts index a766af1c680..b1a2cde1807 100644 --- a/apps/sim/lib/uploads/upload-session/service.ts +++ b/apps/sim/lib/uploads/upload-session/service.ts @@ -474,6 +474,11 @@ export function createUploadSessionAuthBinding( 'forbidden', 'Credential Group enrollment principals cannot create uploads' ) + case 'scim_connection': + throw new UploadSessionError( + 'forbidden', + 'Directory provisioning credentials cannot create uploads' + ) case 'system': throw new UploadSessionError('forbidden', 'System principals cannot create uploads') } diff --git a/apps/sim/lib/workflows/application/run-workflow-from-copilot.ts b/apps/sim/lib/workflows/application/run-workflow-from-copilot.ts index 31ed03811fc..f85d07d62d7 100644 --- a/apps/sim/lib/workflows/application/run-workflow-from-copilot.ts +++ b/apps/sim/lib/workflows/application/run-workflow-from-copilot.ts @@ -230,6 +230,7 @@ async function executeCopilotRun(params: { }): Promise { if ( params.principal.kind === 'credential_group_enrollment' || + params.principal.kind === 'scim_connection' || (params.principal.kind === 'delegated' && params.principal.serviceId === 'executor') ) { throw new Error('The principal cannot start a Copilot workflow execution') diff --git a/apps/sim/lib/workspaces/access/workspace-access.ts b/apps/sim/lib/workspaces/access/workspace-access.ts new file mode 100644 index 00000000000..02cc3368af2 --- /dev/null +++ b/apps/sim/lib/workspaces/access/workspace-access.ts @@ -0,0 +1,137 @@ +import { permissions } from '@sim/db/schema' +import type { PermissionType } from '@sim/platform-authz/workspace' +import { generateId } from '@sim/utils/id' +import { and, eq } from 'drizzle-orm' +import { revokeWorkspaceCredentialMembershipsTx } from '@/lib/credentials/access' +import type { DbOrTx } from '@/lib/db/types' +import { removeWorkspaceSkillMembershipsTx } from '@/lib/skills/access' +import { reassignWorkflowOwnershipForWorkspaceMemberRemovalTx } from '@/lib/workspaces/utils' + +/** + * Workspace access as a shared domain primitive. + * + * The permission row is only part of the story — removing someone also has to + * reassign what they own and drop the credential and skill memberships that + * dangle otherwise. That sequence lived inline in the members route; directory + * deprovisioning needs the same one, and a second copy is where the two would + * drift. + */ + +/** Ordering used to decide whether an existing grant already suffices. */ +const PERMISSION_RANK: Record = { read: 1, write: 2, admin: 3 } + +export function permissionRank(permission: PermissionType): number { + return PERMISSION_RANK[permission] +} + +export type GrantWorkspaceAccessOutcome = 'granted' | 'raised' | 'unchanged' + +/** + * Grants a user access to a workspace, never lowering an existing grant. + * + * A directory group says what access someone should have at minimum. Someone + * who was deliberately promoted to workspace admin should not be demoted by the + * next sync of a group that grants write. + */ +export async function grantWorkspaceAccessTx( + tx: DbOrTx, + params: { workspaceId: string; userId: string; permission: PermissionType } +): Promise { + const [existing] = await tx + .select({ id: permissions.id, permissionType: permissions.permissionType }) + .from(permissions) + .where( + and( + eq(permissions.userId, params.userId), + eq(permissions.entityType, 'workspace'), + eq(permissions.entityId, params.workspaceId) + ) + ) + .limit(1) + .for('update') + + if (!existing) { + await tx.insert(permissions).values({ + id: generateId(), + userId: params.userId, + entityType: 'workspace', + entityId: params.workspaceId, + permissionType: params.permission, + createdAt: new Date(), + updatedAt: new Date(), + }) + return 'granted' + } + + if (permissionRank(existing.permissionType) >= permissionRank(params.permission)) { + return 'unchanged' + } + + await tx + .update(permissions) + .set({ permissionType: params.permission, updatedAt: new Date() }) + .where(eq(permissions.id, existing.id)) + return 'raised' +} + +export interface RevokeWorkspaceAccessResult { + revoked: boolean + /** Workflows whose owner could not be reassigned, which blocks the removal. */ + unresolvedWorkflows: string[] +} + +/** + * Removes a user's access to one workspace and everything that hangs off it. + * + * Ownership reassignment runs first and can fail: a workflow whose owner cannot + * be moved would be orphaned by the delete, so the caller is expected to treat + * an unresolved list as a refusal rather than proceeding. + */ +export async function revokeWorkspaceAccessTx( + tx: DbOrTx, + params: { workspaceId: string; userId: string } +): Promise { + const reassignment = await reassignWorkflowOwnershipForWorkspaceMemberRemovalTx({ + tx, + workspaceIds: [params.workspaceId], + departingUserId: params.userId, + }) + if (reassignment.unresolved.length > 0) { + return { revoked: false, unresolvedWorkflows: reassignment.unresolved } + } + + const deleted = await tx + .delete(permissions) + .where( + and( + eq(permissions.userId, params.userId), + eq(permissions.entityType, 'workspace'), + eq(permissions.entityId, params.workspaceId) + ) + ) + .returning({ id: permissions.id }) + + await revokeWorkspaceCredentialMembershipsTx(tx, params.workspaceId, params.userId) + await removeWorkspaceSkillMembershipsTx(tx, params.workspaceId, params.userId) + + return { revoked: deleted.length > 0, unresolvedWorkflows: [] } +} + +/** The permission a user currently holds on a workspace, if any. */ +export async function readWorkspacePermission( + tx: DbOrTx, + params: { workspaceId: string; userId: string } +): Promise { + const [row] = await tx + .select({ permissionType: permissions.permissionType }) + .from(permissions) + .where( + and( + eq(permissions.userId, params.userId), + eq(permissions.entityType, 'workspace'), + eq(permissions.entityId, params.workspaceId) + ) + ) + .limit(1) + return row?.permissionType ?? null +} diff --git a/docker/crontab b/docker/crontab index 39a2eeccf2d..64beafeb4e8 100644 --- a/docker/crontab +++ b/docker/crontab @@ -43,6 +43,9 @@ SHELL=/bin/sh # Enterprise data drains 0 * * * * curl -fsS -m 300 -o /dev/null -H "Authorization: Bearer $CRON_SECRET" "$SIM_URL/api/cron/run-data-drains" +# Directory provisioning drift sweep (re-applies SCIM group mappings) +17 * * * * curl -fsS -m 300 -o /dev/null -H "Authorization: Bearer $CRON_SECRET" "$SIM_URL/api/cron/scim-reconcile" + # Deletes table rows whose TTL column has expired */15 * * * * curl -fsS -m 60 -o /dev/null -H "Authorization: Bearer $CRON_SECRET" "$SIM_URL/api/cron/cleanup-table-row-ttl" diff --git a/helm/sim/values.yaml b/helm/sim/values.yaml index 9324fa59c1a..be5e21b04d4 100644 --- a/helm/sim/values.yaml +++ b/helm/sim/values.yaml @@ -1492,6 +1492,18 @@ cronjobs: successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 1 + # Re-applies directory group mappings so drift between what a mapping says a + # member should have and what SCIM granted them cannot persist. Idempotent, + # and a no-op for organizations with no connection. + scimReconcile: + enabled: true + name: scim-reconcile + schedule: "17 * * * *" + path: "/api/cron/scim-reconcile" + concurrencyPolicy: Forbid + successfulJobsHistoryLimit: 3 + failedJobsHistoryLimit: 1 + # Deletes table rows whose TTL column contains an expired Unix timestamp. cleanupTableRowTtl: enabled: true diff --git a/packages/audit/src/types.ts b/packages/audit/src/types.ts index 68569697fa8..05a6ee8c013 100644 --- a/packages/audit/src/types.ts +++ b/packages/audit/src/types.ts @@ -169,6 +169,8 @@ export const AuditAction = { ORG_INVITATION_CANCELLED: 'org_invitation.cancelled', ORG_INVITATION_REVOKED: 'org_invitation.revoked', ORG_INVITATION_RESENT: 'org_invitation.resent', + ORG_MEMBER_SUSPENDED: 'org_member.suspended', + ORG_MEMBER_UNSUSPENDED: 'org_member.unsuspended', ORG_SEAT_PROVISIONED: 'org_seat.provisioned', ORG_SEAT_DEPROVISIONED: 'org_seat.deprovisioned', ORG_PLAN_CONVERTED: 'org_plan.converted', @@ -236,6 +238,23 @@ export const AuditAction = { WORKSPACE_FORK_ROLLED_BACK: 'workspace.fork_rolled_back', WORKSPACE_FORK_UNLINKED: 'workspace.fork_unlinked', WORKSPACE_EXPORTED: 'workspace.exported', + // SCIM directory provisioning + SCIM_CONNECTION_ENABLED: 'scim_connection.enabled', + SCIM_CONNECTION_DISABLED: 'scim_connection.disabled', + SCIM_CONNECTION_SETTINGS_UPDATED: 'scim_connection.settings_updated', + SCIM_CREDENTIAL_ISSUED: 'scim_credential.issued', + SCIM_CREDENTIAL_REVOKED: 'scim_credential.revoked', + SCIM_USER_PROVISIONED: 'scim_user.provisioned', + SCIM_USER_UPDATED: 'scim_user.updated', + SCIM_USER_DEACTIVATED: 'scim_user.deactivated', + SCIM_USER_REACTIVATED: 'scim_user.reactivated', + SCIM_USER_DEPROVISIONED: 'scim_user.deprovisioned', + SCIM_GROUP_CREATED: 'scim_group.created', + SCIM_GROUP_UPDATED: 'scim_group.updated', + SCIM_GROUP_MEMBERSHIP_CHANGED: 'scim_group.membership_changed', + SCIM_GROUP_DELETED: 'scim_group.deleted', + SCIM_GROUP_MAPPING_UPSERTED: 'scim_group_mapping.upserted', + SCIM_GROUP_MAPPING_DELETED: 'scim_group_mapping.deleted', } as const export type AuditActionType = (typeof AuditAction)[keyof typeof AuditAction] @@ -267,11 +286,14 @@ export const AuditResourceType = { PERMISSION_GROUP: 'permission_group', SANDBOX: 'sandbox', SCHEDULE: 'schedule', + SCIM_CONNECTION: 'scim_connection', + SCIM_GROUP: 'scim_group', /** Not a stored resource: the workspace's secrets, as the thing put at risk. */ SECRET_PROVENANCE: 'secret_provenance', SKILL: 'skill', SUBSCRIPTION: 'subscription', TABLE: 'table', + USER: 'user', WEBHOOK: 'webhook', WORKFLOW: 'workflow', WORKSPACE: 'workspace', diff --git a/packages/auth/src/principal.ts b/packages/auth/src/principal.ts index d535d29f23e..95fcbc5b513 100644 --- a/packages/auth/src/principal.ts +++ b/packages/auth/src/principal.ts @@ -5,6 +5,7 @@ export type Principal = | DelegatedPrincipal | SystemPrincipal | CredentialGroupEnrollmentPrincipal + | ScimConnectionPrincipal export interface SessionPrincipal { kind: 'session' @@ -24,6 +25,26 @@ export interface WorkspaceApiKeyPrincipal { keyId: string } +/** Operations a SCIM bearer credential may perform. Mirrors `ScimScope` in the schema. */ +export type ScimCredentialScope = 'users:read' | 'users:write' | 'groups:read' | 'groups:write' + +/** + * An organization's identity provider, authenticated by a SCIM bearer credential. + * + * It represents no human: a directory synchronizes on its own schedule, so + * attributing its writes to whoever last configured the connection would put a + * name on the audit trail that did not perform the change. The organization is + * carried by the credential rather than by the request, which is what keeps one + * tenant's directory from addressing another tenant's users. + */ +export interface ScimConnectionPrincipal { + kind: 'scim_connection' + organizationId: string + connectionId: string + credentialId: string + scopes: readonly ScimCredentialScope[] +} + export interface ExternalUserSubject { kind: 'external_user' provider: string @@ -470,6 +491,12 @@ export type PrincipalActor = enrollmentId: string email: string } + | { + kind: 'scim_connection' + organizationId: string + connectionId: string + credentialId: string + } export interface PrincipalAttribution { actor: PrincipalActor @@ -519,6 +546,7 @@ export function resolvePrincipalSubject(principal: Principal): PrincipalSubject : null case 'workspace_api_key': case 'credential_group_enrollment': + case 'scim_connection': return null } } @@ -566,6 +594,13 @@ export function toPrincipalActor(principal: Principal): PrincipalActor { enrollmentId: principal.enrollmentId, email: principal.email, } + case 'scim_connection': + return { + kind: principal.kind, + organizationId: principal.organizationId, + connectionId: principal.connectionId, + credentialId: principal.credentialId, + } } } @@ -587,6 +622,8 @@ export function resolvePrincipalAuditAttribution(principal: Principal): Principa return { actor, actorId: null, actorName: `System: ${actor.serviceId}` } case 'credential_group_enrollment': return { actor, actorId: null, actorName: actor.email } + case 'scim_connection': + return { actor, actorId: null, actorName: 'SCIM provisioning' } } } @@ -622,6 +659,7 @@ export function resolvePrincipalAttribution( return { actor, attributedUserId } } case 'credential_group_enrollment': + case 'scim_connection': throw new PrincipalSubjectUserRequiredError(actor.kind) } } diff --git a/packages/db/migrations/0323_scim_provisioning.sql b/packages/db/migrations/0323_scim_provisioning.sql new file mode 100644 index 00000000000..a1069c6f42d --- /dev/null +++ b/packages/db/migrations/0323_scim_provisioning.sql @@ -0,0 +1,153 @@ +CREATE TABLE "scim_connection" ( + "id" text PRIMARY KEY NOT NULL, + "organization_id" text NOT NULL, + "sso_provider_id" text, + "status" text DEFAULT 'active' NOT NULL, + "settings" jsonb DEFAULT '{}'::jsonb NOT NULL, + "last_request_at" timestamp, + "reconcile_lock_token" text, + "reconcile_lease_at" timestamp, + "reconciled_at" timestamp, + "created_by" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "scim_credential" ( + "id" text PRIMARY KEY NOT NULL, + "connection_id" text NOT NULL, + "token_hash" text NOT NULL, + "token_prefix" text NOT NULL, + "scopes" jsonb NOT NULL, + "expires_at" timestamp, + "revoked_at" timestamp, + "revoked_by" text, + "last_used_at" timestamp, + "created_by" text, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "scim_group" ( + "id" text PRIMARY KEY NOT NULL, + "connection_id" text NOT NULL, + "external_id" text, + "display_name" text NOT NULL, + "display_name_key" text NOT NULL, + "order_key" text NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "scim_group_mapping" ( + "id" text PRIMARY KEY NOT NULL, + "group_id" text NOT NULL, + "target_kind" text NOT NULL, + "permission_group_id" text, + "workspace_id" text, + "permission_type" "permission_type", + "role" text, + "created_by" text, + "created_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "scim_group_mapping_target_shape" CHECK (( + ("scim_group_mapping"."target_kind" = 'permission_group' AND "scim_group_mapping"."permission_group_id" IS NOT NULL AND "scim_group_mapping"."workspace_id" IS NULL AND "scim_group_mapping"."permission_type" IS NULL AND "scim_group_mapping"."role" IS NULL) + OR ("scim_group_mapping"."target_kind" = 'workspace' AND "scim_group_mapping"."workspace_id" IS NOT NULL AND "scim_group_mapping"."permission_type" IS NOT NULL AND "scim_group_mapping"."permission_group_id" IS NULL AND "scim_group_mapping"."role" IS NULL) + OR ("scim_group_mapping"."target_kind" = 'org_role' AND "scim_group_mapping"."role" IS NOT NULL AND "scim_group_mapping"."permission_group_id" IS NULL AND "scim_group_mapping"."workspace_id" IS NULL AND "scim_group_mapping"."permission_type" IS NULL) + )) +); +--> statement-breakpoint +CREATE TABLE "scim_group_member" ( + "id" text PRIMARY KEY NOT NULL, + "group_id" text NOT NULL, + "scim_user_id" text NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "scim_projection_grant" ( + "id" text PRIMARY KEY NOT NULL, + "connection_id" text NOT NULL, + "scim_user_id" text NOT NULL, + "target_kind" text NOT NULL, + "target_id" text NOT NULL, + "permission_type" "permission_type", + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "scim_request_log" ( + "id" text PRIMARY KEY NOT NULL, + "connection_id" text NOT NULL, + "credential_id" text, + "method" text NOT NULL, + "path" text NOT NULL, + "status" integer NOT NULL, + "scim_type" text, + "detail" text, + "user_agent" text, + "duration_ms" integer NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "scim_user" ( + "id" text PRIMARY KEY NOT NULL, + "connection_id" text NOT NULL, + "user_id" text NOT NULL, + "external_id" text, + "user_name" text NOT NULL, + "active" boolean DEFAULT true NOT NULL, + "attributes" jsonb NOT NULL, + "order_key" text NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "scim_user_tombstone" ( + "id" text PRIMARY KEY NOT NULL, + "connection_id" text NOT NULL, + "external_id" text NOT NULL, + "user_id" text NOT NULL, + "deleted_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +ALTER TABLE "permission_group" ADD COLUMN "membership_mode" text DEFAULT 'inherit' NOT NULL;--> statement-breakpoint +ALTER TABLE "user" ADD COLUMN "suspended_at" timestamp;--> statement-breakpoint +ALTER TABLE "user" ADD COLUMN "suspension_source" text;--> statement-breakpoint +ALTER TABLE "scim_connection" ADD CONSTRAINT "scim_connection_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_connection" ADD CONSTRAINT "scim_connection_sso_provider_id_sso_provider_id_fk" FOREIGN KEY ("sso_provider_id") REFERENCES "public"."sso_provider"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_connection" ADD CONSTRAINT "scim_connection_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_credential" ADD CONSTRAINT "scim_credential_connection_id_scim_connection_id_fk" FOREIGN KEY ("connection_id") REFERENCES "public"."scim_connection"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_credential" ADD CONSTRAINT "scim_credential_revoked_by_user_id_fk" FOREIGN KEY ("revoked_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_credential" ADD CONSTRAINT "scim_credential_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_group" ADD CONSTRAINT "scim_group_connection_id_scim_connection_id_fk" FOREIGN KEY ("connection_id") REFERENCES "public"."scim_connection"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_group_mapping" ADD CONSTRAINT "scim_group_mapping_group_id_scim_group_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."scim_group"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_group_mapping" ADD CONSTRAINT "scim_group_mapping_permission_group_id_permission_group_id_fk" FOREIGN KEY ("permission_group_id") REFERENCES "public"."permission_group"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_group_mapping" ADD CONSTRAINT "scim_group_mapping_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_group_mapping" ADD CONSTRAINT "scim_group_mapping_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_group_member" ADD CONSTRAINT "scim_group_member_group_id_scim_group_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."scim_group"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_group_member" ADD CONSTRAINT "scim_group_member_scim_user_id_scim_user_id_fk" FOREIGN KEY ("scim_user_id") REFERENCES "public"."scim_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_projection_grant" ADD CONSTRAINT "scim_projection_grant_connection_id_scim_connection_id_fk" FOREIGN KEY ("connection_id") REFERENCES "public"."scim_connection"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_projection_grant" ADD CONSTRAINT "scim_projection_grant_scim_user_id_scim_user_id_fk" FOREIGN KEY ("scim_user_id") REFERENCES "public"."scim_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_request_log" ADD CONSTRAINT "scim_request_log_connection_id_scim_connection_id_fk" FOREIGN KEY ("connection_id") REFERENCES "public"."scim_connection"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_user" ADD CONSTRAINT "scim_user_connection_id_scim_connection_id_fk" FOREIGN KEY ("connection_id") REFERENCES "public"."scim_connection"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_user" ADD CONSTRAINT "scim_user_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_user_tombstone" ADD CONSTRAINT "scim_user_tombstone_connection_id_scim_connection_id_fk" FOREIGN KEY ("connection_id") REFERENCES "public"."scim_connection"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "scim_user_tombstone" ADD CONSTRAINT "scim_user_tombstone_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +CREATE UNIQUE INDEX "scim_connection_organization_unique" ON "scim_connection" USING btree ("organization_id");--> statement-breakpoint +CREATE INDEX "scim_connection_reconcile_due_idx" ON "scim_connection" USING btree ("reconciled_at");--> statement-breakpoint +CREATE UNIQUE INDEX "scim_credential_token_hash_unique" ON "scim_credential" USING btree ("token_hash");--> statement-breakpoint +CREATE INDEX "scim_credential_connection_idx" ON "scim_credential" USING btree ("connection_id");--> statement-breakpoint +CREATE UNIQUE INDEX "scim_group_connection_display_name_unique" ON "scim_group" USING btree ("connection_id","display_name_key");--> statement-breakpoint +CREATE UNIQUE INDEX "scim_group_connection_external_id_unique" ON "scim_group" USING btree ("connection_id","external_id") WHERE external_id is not null;--> statement-breakpoint +CREATE INDEX "scim_group_connection_order_idx" ON "scim_group" USING btree ("connection_id","order_key");--> statement-breakpoint +CREATE INDEX "scim_group_mapping_group_idx" ON "scim_group_mapping" USING btree ("group_id");--> statement-breakpoint +CREATE UNIQUE INDEX "scim_group_mapping_group_target_unique" ON "scim_group_mapping" USING btree ("group_id","target_kind",coalesce("permission_group_id", "workspace_id", "role"));--> statement-breakpoint +CREATE UNIQUE INDEX "scim_group_member_group_user_unique" ON "scim_group_member" USING btree ("group_id","scim_user_id");--> statement-breakpoint +CREATE INDEX "scim_group_member_scim_user_idx" ON "scim_group_member" USING btree ("scim_user_id");--> statement-breakpoint +CREATE UNIQUE INDEX "scim_projection_grant_user_target_unique" ON "scim_projection_grant" USING btree ("scim_user_id","target_kind","target_id");--> statement-breakpoint +CREATE INDEX "scim_projection_grant_connection_idx" ON "scim_projection_grant" USING btree ("connection_id");--> statement-breakpoint +CREATE INDEX "scim_request_log_connection_created_idx" ON "scim_request_log" USING btree ("connection_id","created_at");--> statement-breakpoint +CREATE UNIQUE INDEX "scim_user_connection_user_unique" ON "scim_user" USING btree ("connection_id","user_id");--> statement-breakpoint +CREATE UNIQUE INDEX "scim_user_connection_user_name_unique" ON "scim_user" USING btree ("connection_id","user_name");--> statement-breakpoint +CREATE UNIQUE INDEX "scim_user_connection_external_id_unique" ON "scim_user" USING btree ("connection_id","external_id") WHERE external_id is not null;--> statement-breakpoint +CREATE INDEX "scim_user_connection_order_idx" ON "scim_user" USING btree ("connection_id","order_key");--> statement-breakpoint +CREATE INDEX "scim_user_user_idx" ON "scim_user" USING btree ("user_id");--> statement-breakpoint +CREATE UNIQUE INDEX "scim_user_tombstone_connection_external_id_unique" ON "scim_user_tombstone" USING btree ("connection_id","external_id"); \ No newline at end of file diff --git a/packages/db/migrations/meta/0323_snapshot.json b/packages/db/migrations/meta/0323_snapshot.json new file mode 100644 index 00000000000..32b56a2e58d --- /dev/null +++ b/packages/db/migrations/meta/0323_snapshot.json @@ -0,0 +1,22964 @@ +{ + "id": "21abba38-933e-49f5-987c-7e2ec982c472", + "prevId": "43e7d6af-94da-4f1c-8bfc-568d5937765c", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.academy_certificate": { + "name": "academy_certificate", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "course_id": { + "name": "course_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "academy_cert_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "issued_at": { + "name": "issued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "certificate_number": { + "name": "certificate_number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "academy_certificate_user_id_idx": { + "name": "academy_certificate_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "academy_certificate_course_id_idx": { + "name": "academy_certificate_course_id_idx", + "columns": [ + { + "expression": "course_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "academy_certificate_user_course_unique": { + "name": "academy_certificate_user_course_unique", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "course_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "academy_certificate_status_idx": { + "name": "academy_certificate_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "academy_certificate_user_id_user_id_fk": { + "name": "academy_certificate_user_id_user_id_fk", + "tableFrom": "academy_certificate", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "academy_certificate_certificate_number_unique": { + "name": "academy_certificate_certificate_number_unique", + "nullsNotDistinct": false, + "columns": ["certificate_number"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "oauth_config": { + "name": "oauth_config", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "account_user_id_idx": { + "name": "account_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_account_on_account_id_provider_id": { + "name": "idx_account_on_account_id_provider_id", + "columns": [ + { + "expression": "account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_key": { + "name": "api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'personal'" + }, + "last_used": { + "name": "last_used", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "api_key_workspace_type_idx": { + "name": "api_key_workspace_type_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "api_key_user_type_idx": { + "name": "api_key_user_type_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "api_key_key_hash_idx": { + "name": "api_key_key_hash_idx", + "columns": [ + { + "expression": "key_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "api_key_user_id_user_id_fk": { + "name": "api_key_user_id_user_id_fk", + "tableFrom": "api_key", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "api_key_workspace_id_workspace_id_fk": { + "name": "api_key_workspace_id_workspace_id_fk", + "tableFrom": "api_key", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "api_key_created_by_user_id_fk": { + "name": "api_key_created_by_user_id_fk", + "tableFrom": "api_key", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "api_key_key_unique": { + "name": "api_key_key_unique", + "nullsNotDistinct": false, + "columns": ["key"] + } + }, + "policies": {}, + "checkConstraints": { + "workspace_type_check": { + "name": "workspace_type_check", + "value": "(type = 'workspace' AND workspace_id IS NOT NULL) OR (type = 'personal' AND workspace_id IS NULL)" + } + }, + "isRLSEnabled": false + }, + "public.async_jobs": { + "name": "async_jobs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "run_at": { + "name": "run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "max_attempts": { + "name": "max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 3 + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "output": { + "name": "output", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "async_jobs_status_started_at_idx": { + "name": "async_jobs_status_started_at_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_status_completed_at_idx": { + "name": "async_jobs_status_completed_at_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "completed_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_schedule_pending_run_at_idx": { + "name": "async_jobs_schedule_pending_run_at_idx", + "columns": [ + { + "expression": "run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" = 'pending'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_schedule_processing_started_at_idx": { + "name": "async_jobs_schedule_processing_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" = 'processing'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "async_jobs_schedule_unreconciled_terminal_idx": { + "name": "async_jobs_schedule_unreconciled_terminal_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"async_jobs\".\"type\" = 'schedule-execution' AND \"async_jobs\".\"status\" IN ('completed', 'failed', 'cancelled') AND COALESCE(\"async_jobs\".\"metadata\" ->> 'scheduleReconciled', 'false') <> 'true'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.audit_log": { + "name": "audit_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_name": { + "name": "actor_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_email": { + "name": "actor_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "resource_name": { + "name": "resource_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "audit_log_workspace_created_idx": { + "name": "audit_log_workspace_created_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_workspace_created_at_id_idx": { + "name": "audit_log_workspace_created_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"created_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_actor_created_idx": { + "name": "audit_log_actor_created_idx", + "columns": [ + { + "expression": "actor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_resource_idx": { + "name": "audit_log_resource_idx", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_log_action_idx": { + "name": "audit_log_action_idx", + "columns": [ + { + "expression": "action", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "audit_log_workspace_id_workspace_id_fk": { + "name": "audit_log_workspace_id_workspace_id_fk", + "tableFrom": "audit_log", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "audit_log_actor_id_user_id_fk": { + "name": "audit_log_actor_id_user_id_fk", + "tableFrom": "audit_log", + "tableTo": "user", + "columnsFrom": ["actor_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.background_work_status": { + "name": "background_work_status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "background_work_kind", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "background_work_status_value", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "background_work_status_workspace_status_idx": { + "name": "background_work_status_workspace_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "background_work_status_workflow_status_idx": { + "name": "background_work_status_workflow_status_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "background_work_status_meta_child_ws_idx": { + "name": "background_work_status_meta_child_ws_idx", + "columns": [ + { + "expression": "(\"metadata\" ->> 'childWorkspaceId')", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "background_work_status_meta_other_ws_idx": { + "name": "background_work_status_meta_other_ws_idx", + "columns": [ + { + "expression": "(\"metadata\" ->> 'otherWorkspaceId')", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "background_work_status_workspace_id_workspace_id_fk": { + "name": "background_work_status_workspace_id_workspace_id_fk", + "tableFrom": "background_work_status", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "background_work_status_workflow_id_workflow_id_fk": { + "name": "background_work_status_workflow_id_workflow_id_fk", + "tableFrom": "background_work_status", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.chat": { + "name": "chat", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "customizations": { + "name": "customizations", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "auth_type": { + "name": "auth_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'public'" + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "allowed_emails": { + "name": "allowed_emails", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "output_configs": { + "name": "output_configs", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "include_thinking": { + "name": "include_thinking", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "include_tool_calls": { + "name": "include_tool_calls", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "identifier_idx": { + "name": "identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"chat\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "chat_archived_at_partial_idx": { + "name": "chat_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"chat\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_chat_on_workflow_id_archived_at": { + "name": "idx_chat_on_workflow_id_archived_at", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "chat_workflow_id_workflow_id_fk": { + "name": "chat_workflow_id_workflow_id_fk", + "tableFrom": "chat", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "chat_user_id_user_id_fk": { + "name": "chat_user_id_user_id_fk", + "tableFrom": "chat", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_async_tool_calls": { + "name": "copilot_async_tool_calls", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "checkpoint_id": { + "name": "checkpoint_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "tool_call_id": { + "name": "tool_call_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tool_name": { + "name": "tool_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "args": { + "name": "args", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "status": { + "name": "status", + "type": "copilot_async_tool_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "result": { + "name": "result", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "permission_decision": { + "name": "permission_decision", + "type": "copilot_tool_permission_decision", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "permission_decided_at": { + "name": "permission_decided_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "claimed_at": { + "name": "claimed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "claimed_by": { + "name": "claimed_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_async_tool_calls_run_id_idx": { + "name": "copilot_async_tool_calls_run_id_idx", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_checkpoint_id_idx": { + "name": "copilot_async_tool_calls_checkpoint_id_idx", + "columns": [ + { + "expression": "checkpoint_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_status_idx": { + "name": "copilot_async_tool_calls_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_run_status_idx": { + "name": "copilot_async_tool_calls_run_status_idx", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_async_tool_calls_tool_call_id_unique": { + "name": "copilot_async_tool_calls_tool_call_id_unique", + "columns": [ + { + "expression": "tool_call_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_async_tool_calls_run_id_copilot_runs_id_fk": { + "name": "copilot_async_tool_calls_run_id_copilot_runs_id_fk", + "tableFrom": "copilot_async_tool_calls", + "tableTo": "copilot_runs", + "columnsFrom": ["run_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_async_tool_calls_checkpoint_id_copilot_run_checkpoints_id_fk": { + "name": "copilot_async_tool_calls_checkpoint_id_copilot_run_checkpoints_id_fk", + "tableFrom": "copilot_async_tool_calls", + "tableTo": "copilot_run_checkpoints", + "columnsFrom": ["checkpoint_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_chats": { + "name": "copilot_chats", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "chat_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'copilot'" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'claude-3-7-sonnet-latest'" + }, + "conversation_id": { + "name": "conversation_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "preview_yaml": { + "name": "preview_yaml", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plan_artifact": { + "name": "plan_artifact", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "resources": { + "name": "resources", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "auto_allowed_tools": { + "name": "auto_allowed_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "pinned": { + "name": "pinned", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_chats_user_id_idx": { + "name": "copilot_chats_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_workflow_id_idx": { + "name": "copilot_chats_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_user_workflow_idx": { + "name": "copilot_chats_user_workflow_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_user_workspace_idx": { + "name": "copilot_chats_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_created_at_idx": { + "name": "copilot_chats_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_updated_at_idx": { + "name": "copilot_chats_updated_at_idx", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_workspace_created_at_id_idx": { + "name": "copilot_chats_workspace_created_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"created_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_chats_user_workspace_deleted_partial_idx": { + "name": "copilot_chats_user_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_chats\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_chats_user_id_user_id_fk": { + "name": "copilot_chats_user_id_user_id_fk", + "tableFrom": "copilot_chats", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_chats_workflow_id_workflow_id_fk": { + "name": "copilot_chats_workflow_id_workflow_id_fk", + "tableFrom": "copilot_chats", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_chats_workspace_id_workspace_id_fk": { + "name": "copilot_chats_workspace_id_workspace_id_fk", + "tableFrom": "copilot_chats", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_feedback": { + "name": "copilot_feedback", + "schema": "", + "columns": { + "feedback_id": { + "name": "feedback_id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_query": { + "name": "user_query", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "agent_response": { + "name": "agent_response", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_positive": { + "name": "is_positive", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "feedback": { + "name": "feedback", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_yaml": { + "name": "workflow_yaml", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_feedback_user_id_idx": { + "name": "copilot_feedback_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_chat_id_idx": { + "name": "copilot_feedback_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_user_chat_idx": { + "name": "copilot_feedback_user_chat_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_is_positive_idx": { + "name": "copilot_feedback_is_positive_idx", + "columns": [ + { + "expression": "is_positive", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_feedback_created_at_idx": { + "name": "copilot_feedback_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_feedback_user_id_user_id_fk": { + "name": "copilot_feedback_user_id_user_id_fk", + "tableFrom": "copilot_feedback", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_feedback_chat_id_copilot_chats_id_fk": { + "name": "copilot_feedback_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_feedback", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_messages": { + "name": "copilot_messages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "stream_id": { + "name": "stream_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_message_id": { + "name": "parent_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tokens_in": { + "name": "tokens_in", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tokens_out": { + "name": "tokens_out", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_messages_chat_message_unique": { + "name": "copilot_messages_chat_message_unique", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_chat_created_at_idx": { + "name": "copilot_messages_chat_created_at_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_chat_seq_idx": { + "name": "copilot_messages_chat_seq_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_chat_stream_idx": { + "name": "copilot_messages_chat_stream_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "stream_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"stream_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_messages_user_created_at_idx": { + "name": "copilot_messages_user_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"copilot_messages\".\"role\" = 'user' AND \"copilot_messages\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_messages_chat_id_copilot_chats_id_fk": { + "name": "copilot_messages_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_messages", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_run_checkpoints": { + "name": "copilot_run_checkpoints", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "pending_tool_call_id": { + "name": "pending_tool_call_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "conversation_snapshot": { + "name": "conversation_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "agent_state": { + "name": "agent_state", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "provider_request": { + "name": "provider_request", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_run_checkpoints_run_id_idx": { + "name": "copilot_run_checkpoints_run_id_idx", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_run_checkpoints_pending_tool_call_id_idx": { + "name": "copilot_run_checkpoints_pending_tool_call_id_idx", + "columns": [ + { + "expression": "pending_tool_call_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_run_checkpoints_run_pending_tool_unique": { + "name": "copilot_run_checkpoints_run_pending_tool_unique", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "pending_tool_call_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_run_checkpoints_run_id_copilot_runs_id_fk": { + "name": "copilot_run_checkpoints_run_id_copilot_runs_id_fk", + "tableFrom": "copilot_run_checkpoints", + "tableTo": "copilot_runs", + "columnsFrom": ["run_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_runs": { + "name": "copilot_runs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_run_id": { + "name": "parent_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stream_id": { + "name": "stream_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "agent": { + "name": "agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "copilot_run_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "request_context": { + "name": "request_context", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "copilot_runs_execution_id_idx": { + "name": "copilot_runs_execution_id_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_parent_run_id_idx": { + "name": "copilot_runs_parent_run_id_idx", + "columns": [ + { + "expression": "parent_run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_chat_id_idx": { + "name": "copilot_runs_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_user_id_idx": { + "name": "copilot_runs_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_workflow_id_idx": { + "name": "copilot_runs_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_workspace_id_idx": { + "name": "copilot_runs_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_status_idx": { + "name": "copilot_runs_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_chat_execution_idx": { + "name": "copilot_runs_chat_execution_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_execution_started_at_idx": { + "name": "copilot_runs_execution_started_at_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_workspace_completed_at_id_idx": { + "name": "copilot_runs_workspace_completed_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"completed_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_runs_stream_id_unique": { + "name": "copilot_runs_stream_id_unique", + "columns": [ + { + "expression": "stream_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_runs_chat_id_copilot_chats_id_fk": { + "name": "copilot_runs_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_runs_user_id_user_id_fk": { + "name": "copilot_runs_user_id_user_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_runs_workflow_id_workflow_id_fk": { + "name": "copilot_runs_workflow_id_workflow_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_runs_workspace_id_workspace_id_fk": { + "name": "copilot_runs_workspace_id_workspace_id_fk", + "tableFrom": "copilot_runs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.copilot_workflow_read_hashes": { + "name": "copilot_workflow_read_hashes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "copilot_workflow_read_hashes_chat_id_idx": { + "name": "copilot_workflow_read_hashes_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_workflow_read_hashes_workflow_id_idx": { + "name": "copilot_workflow_read_hashes_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "copilot_workflow_read_hashes_chat_workflow_unique": { + "name": "copilot_workflow_read_hashes_chat_workflow_unique", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "copilot_workflow_read_hashes_chat_id_copilot_chats_id_fk": { + "name": "copilot_workflow_read_hashes_chat_id_copilot_chats_id_fk", + "tableFrom": "copilot_workflow_read_hashes", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "copilot_workflow_read_hashes_workflow_id_workflow_id_fk": { + "name": "copilot_workflow_read_hashes_workflow_id_workflow_id_fk", + "tableFrom": "copilot_workflow_read_hashes", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.credential": { + "name": "credential", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "credential_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unredacted": { + "name": "unredacted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "env_key": { + "name": "env_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "env_owner_user_id": { + "name": "env_owner_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encrypted_service_account_key": { + "name": "encrypted_service_account_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorization_app_id": { + "name": "authorization_app_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_group_enrollment_id": { + "name": "credential_group_enrollment_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_group_option_id": { + "name": "credential_group_option_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mcp_server_id": { + "name": "mcp_server_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "managed_oauth_scope_version": { + "name": "managed_oauth_scope_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "provider_subject_id": { + "name": "provider_subject_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_tenant_id": { + "name": "provider_tenant_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "managed_oauth_status": { + "name": "managed_oauth_status", + "type": "managed_oauth_credential_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "granted_scopes": { + "name": "granted_scopes", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "provider_metadata": { + "name": "provider_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "encrypted_oauth_token_set": { + "name": "encrypted_oauth_token_set", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mcp_tools": { + "name": "mcp_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "mcp_tools_refreshed_at": { + "name": "mcp_tools_refreshed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "granted_at": { + "name": "granted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_refreshed_at": { + "name": "last_refreshed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_workspace_id_idx": { + "name": "credential_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_type_idx": { + "name": "credential_type_idx", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_provider_id_idx": { + "name": "credential_provider_id_idx", + "columns": [ + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_account_id_idx": { + "name": "credential_account_id_idx", + "columns": [ + { + "expression": "account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_env_owner_user_id_idx": { + "name": "credential_env_owner_user_id_idx", + "columns": [ + { + "expression": "env_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_idx": { + "name": "credential_group_enrollment_idx", + "columns": [ + { + "expression": "credential_group_enrollment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_mcp_server_idx": { + "name": "credential_mcp_server_idx", + "columns": [ + { + "expression": "mcp_server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_option_unique": { + "name": "credential_group_option_unique", + "columns": [ + { + "expression": "credential_group_enrollment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "credential_group_option_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"credential\".\"type\" = 'managed_oauth'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_managed_mcp_enrollment_server_unique": { + "name": "credential_managed_mcp_enrollment_server_unique", + "columns": [ + { + "expression": "credential_group_enrollment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "mcp_server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"credential\".\"type\" = 'managed_mcp'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_workspace_account_unique": { + "name": "credential_workspace_account_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "account_id IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_workspace_env_unique": { + "name": "credential_workspace_env_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "env_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "type = 'env_workspace'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_workspace_personal_env_unique": { + "name": "credential_workspace_personal_env_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "env_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "env_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "type = 'env_personal'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_workspace_id_workspace_id_fk": { + "name": "credential_workspace_id_workspace_id_fk", + "tableFrom": "credential", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_account_id_account_id_fk": { + "name": "credential_account_id_account_id_fk", + "tableFrom": "credential", + "tableTo": "account", + "columnsFrom": ["account_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_env_owner_user_id_user_id_fk": { + "name": "credential_env_owner_user_id_user_id_fk", + "tableFrom": "credential", + "tableTo": "user", + "columnsFrom": ["env_owner_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_credential_group_enrollment_id_credential_group_enrollment_id_fk": { + "name": "credential_credential_group_enrollment_id_credential_group_enrollment_id_fk", + "tableFrom": "credential", + "tableTo": "credential_group_enrollment", + "columnsFrom": ["credential_group_enrollment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_mcp_server_id_mcp_servers_id_fk": { + "name": "credential_mcp_server_id_mcp_servers_id_fk", + "tableFrom": "credential", + "tableTo": "mcp_servers", + "columnsFrom": ["mcp_server_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_created_by_user_id_fk": { + "name": "credential_created_by_user_id_fk", + "tableFrom": "credential", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "credential_oauth_source_check": { + "name": "credential_oauth_source_check", + "value": "(type <> 'oauth') OR (account_id IS NOT NULL AND provider_id IS NOT NULL)" + }, + "credential_managed_oauth_source_check": { + "name": "credential_managed_oauth_source_check", + "value": "(type::text <> 'managed_oauth') OR (\n account_id IS NULL\n AND provider_id IS NOT NULL\n AND authorization_app_id IS NOT NULL\n AND provider_subject_id IS NOT NULL\n AND managed_oauth_status IS NOT NULL\n AND granted_scopes IS NOT NULL\n AND cardinality(granted_scopes) > 0\n AND encrypted_oauth_token_set IS NOT NULL\n AND granted_at IS NOT NULL\n )" + }, + "credential_managed_oauth_group_binding_check": { + "name": "credential_managed_oauth_group_binding_check", + "value": "(type::text <> 'managed_oauth') OR (\n credential_group_enrollment_id IS NOT NULL\n AND credential_group_option_id IS NOT NULL\n AND managed_oauth_scope_version IS NOT NULL\n AND managed_oauth_scope_version > 0\n )" + }, + "credential_managed_mcp_source_check": { + "name": "credential_managed_mcp_source_check", + "value": "(type::text <> 'managed_mcp') OR (\n id LIKE 'mcp-cg-%'\n AND account_id IS NULL\n AND provider_id IS NULL\n AND authorization_app_id IS NULL\n AND credential_group_enrollment_id IS NOT NULL\n AND credential_group_option_id IS NULL\n AND mcp_server_id IS NOT NULL\n AND managed_oauth_status IS NOT NULL\n AND (managed_oauth_status <> 'active' OR (\n encrypted_oauth_token_set IS NOT NULL\n AND mcp_tools IS NOT NULL\n ))\n AND granted_at IS NOT NULL\n AND managed_oauth_scope_version IS NULL\n AND provider_subject_id IS NULL\n AND provider_tenant_id IS NULL\n AND granted_scopes IS NULL\n AND provider_metadata IS NULL\n AND created_by IS NULL\n AND env_key IS NULL\n AND env_owner_user_id IS NULL\n AND encrypted_service_account_key IS NULL\n AND unredacted = false\n )" + }, + "credential_creator_source_check": { + "name": "credential_creator_source_check", + "value": "(type::text = 'managed_mcp') OR created_by IS NOT NULL" + }, + "credential_workspace_env_source_check": { + "name": "credential_workspace_env_source_check", + "value": "(type <> 'env_workspace') OR (env_key IS NOT NULL AND env_owner_user_id IS NULL)" + }, + "credential_personal_env_source_check": { + "name": "credential_personal_env_source_check", + "value": "(type <> 'env_personal') OR (env_key IS NOT NULL AND env_owner_user_id IS NOT NULL)" + } + }, + "isRLSEnabled": false + }, + "public.credential_group": { + "name": "credential_group", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "public_id": { + "name": "public_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "options": { + "name": "options", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "encrypted_provider_configuration": { + "name": "encrypted_provider_configuration", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "credential_group_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_group_public_id_unique": { + "name": "credential_group_public_id_unique", + "columns": [ + { + "expression": "public_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_workspace_status_idx": { + "name": "credential_group_workspace_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_workspace_name_unique": { + "name": "credential_group_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lower(\"name\")", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_group_workspace_id_workspace_id_fk": { + "name": "credential_group_workspace_id_workspace_id_fk", + "tableFrom": "credential_group", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_group_created_by_user_id_fk": { + "name": "credential_group_created_by_user_id_fk", + "tableFrom": "credential_group", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.credential_group_enrollment": { + "name": "credential_group_enrollment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "credential_group_id": { + "name": "credential_group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "credential_group_enrollment_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'invited'" + }, + "invitation_token_hash": { + "name": "invitation_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invitation_expires_at": { + "name": "invitation_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "invited_at": { + "name": "invited_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "sent_at": { + "name": "sent_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_delivery_error": { + "name": "last_delivery_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_group_enrollment_group_email_unique": { + "name": "credential_group_enrollment_group_email_unique", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_invitation_token_hash_unique": { + "name": "credential_group_enrollment_invitation_token_hash_unique", + "columns": [ + { + "expression": "invitation_token_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_group_status_idx": { + "name": "credential_group_enrollment_group_status_idx", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_group_enrollment_group_invited_at_id_idx": { + "name": "credential_group_enrollment_group_invited_at_id_idx", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "invited_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_group_enrollment_credential_group_id_credential_group_id_fk": { + "name": "credential_group_enrollment_credential_group_id_credential_group_id_fk", + "tableFrom": "credential_group_enrollment", + "tableTo": "credential_group", + "columnsFrom": ["credential_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_group_enrollment_created_by_user_id_fk": { + "name": "credential_group_enrollment_created_by_user_id_fk", + "tableFrom": "credential_group_enrollment", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "credential_group_enrollment_normalized_email_check": { + "name": "credential_group_enrollment_normalized_email_check", + "value": "\"credential_group_enrollment\".\"email\" = lower(btrim(\"credential_group_enrollment\".\"email\")) AND length(\"credential_group_enrollment\".\"email\") BETWEEN 3 AND 320" + }, + "credential_group_enrollment_invitation_token_hash_length_check": { + "name": "credential_group_enrollment_invitation_token_hash_length_check", + "value": "length(\"credential_group_enrollment\".\"invitation_token_hash\") = 64" + } + }, + "isRLSEnabled": false + }, + "public.credential_member": { + "name": "credential_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "credential_member_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'member'" + }, + "status": { + "name": "status", + "type": "credential_member_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "joined_at": { + "name": "joined_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "invited_by": { + "name": "invited_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_member_user_id_idx": { + "name": "credential_member_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_member_role_idx": { + "name": "credential_member_role_idx", + "columns": [ + { + "expression": "role", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_member_status_idx": { + "name": "credential_member_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "credential_member_unique": { + "name": "credential_member_unique", + "columns": [ + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "credential_member_credential_id_credential_id_fk": { + "name": "credential_member_credential_id_credential_id_fk", + "tableFrom": "credential_member", + "tableTo": "credential", + "columnsFrom": ["credential_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_member_user_id_user_id_fk": { + "name": "credential_member_user_id_user_id_fk", + "tableFrom": "credential_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "credential_member_invited_by_user_id_fk": { + "name": "credential_member_invited_by_user_id_fk", + "tableFrom": "credential_member", + "tableTo": "user", + "columnsFrom": ["invited_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.custom_block": { + "name": "custom_block", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "icon_url": { + "name": "icon_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inputs": { + "name": "inputs", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "outputs": { + "name": "outputs", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "trace_child_runs": { + "name": "trace_child_runs", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "custom_block_organization_id_idx": { + "name": "custom_block_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "custom_block_workflow_id_idx": { + "name": "custom_block_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "custom_block_organization_type_unique": { + "name": "custom_block_organization_type_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "custom_block_organization_id_organization_id_fk": { + "name": "custom_block_organization_id_organization_id_fk", + "tableFrom": "custom_block", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "custom_block_workflow_id_workflow_id_fk": { + "name": "custom_block_workflow_id_workflow_id_fk", + "tableFrom": "custom_block", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "custom_block_created_by_user_id_fk": { + "name": "custom_block_created_by_user_id_fk", + "tableFrom": "custom_block", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.custom_tools": { + "name": "custom_tools", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "schema": { + "name": "schema", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "custom_tools_workspace_id_idx": { + "name": "custom_tools_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "custom_tools_workspace_title_unique": { + "name": "custom_tools_workspace_title_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "title", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "custom_tools_workspace_id_workspace_id_fk": { + "name": "custom_tools_workspace_id_workspace_id_fk", + "tableFrom": "custom_tools", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "custom_tools_user_id_user_id_fk": { + "name": "custom_tools_user_id_user_id_fk", + "tableFrom": "custom_tools", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.data_drain_runs": { + "name": "data_drain_runs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "drain_id": { + "name": "drain_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "data_drain_run_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "trigger": { + "name": "trigger", + "type": "data_drain_run_trigger", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "finished_at": { + "name": "finished_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "rows_exported": { + "name": "rows_exported", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "bytes_written": { + "name": "bytes_written", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "cursor_before": { + "name": "cursor_before", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cursor_after": { + "name": "cursor_after", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "locators": { + "name": "locators", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "data_drain_runs_drain_started_idx": { + "name": "data_drain_runs_drain_started_idx", + "columns": [ + { + "expression": "drain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "data_drain_runs_drain_id_data_drains_id_fk": { + "name": "data_drain_runs_drain_id_data_drains_id_fk", + "tableFrom": "data_drain_runs", + "tableTo": "data_drains", + "columnsFrom": ["drain_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.data_drains": { + "name": "data_drains", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "data_drain_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "destination_type": { + "name": "destination_type", + "type": "data_drain_destination", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "destination_config": { + "name": "destination_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "destination_credentials": { + "name": "destination_credentials", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "schedule_cadence": { + "name": "schedule_cadence", + "type": "data_drain_cadence", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "cursor": { + "name": "cursor", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_run_at": { + "name": "last_run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_success_at": { + "name": "last_success_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "data_drains_org_idx": { + "name": "data_drains_org_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "data_drains_due_idx": { + "name": "data_drains_due_idx", + "columns": [ + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "data_drains_org_name_unique": { + "name": "data_drains_org_name_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "data_drains_organization_id_organization_id_fk": { + "name": "data_drains_organization_id_organization_id_fk", + "tableFrom": "data_drains", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "data_drains_created_by_user_id_fk": { + "name": "data_drains_created_by_user_id_fk", + "tableFrom": "data_drains", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.docs_embeddings": { + "name": "docs_embeddings", + "schema": "", + "columns": { + "chunk_id": { + "name": "chunk_id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "chunk_text": { + "name": "chunk_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_document": { + "name": "source_document", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_link": { + "name": "source_link", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header_text": { + "name": "header_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header_level": { + "name": "header_level", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "embedding": { + "name": "embedding", + "type": "vector(1536)", + "primaryKey": false, + "notNull": true + }, + "embedding_model": { + "name": "embedding_model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text-embedding-3-small'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "chunk_text_tsv": { + "name": "chunk_text_tsv", + "type": "tsvector", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "to_tsvector('english', \"docs_embeddings\".\"chunk_text\")", + "type": "stored" + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "docs_emb_source_document_idx": { + "name": "docs_emb_source_document_idx", + "columns": [ + { + "expression": "source_document", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_header_level_idx": { + "name": "docs_emb_header_level_idx", + "columns": [ + { + "expression": "header_level", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_source_header_idx": { + "name": "docs_emb_source_header_idx", + "columns": [ + { + "expression": "source_document", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "header_level", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_model_idx": { + "name": "docs_emb_model_idx", + "columns": [ + { + "expression": "embedding_model", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_emb_created_at_idx": { + "name": "docs_emb_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "docs_embedding_vector_hnsw_idx": { + "name": "docs_embedding_vector_hnsw_idx", + "columns": [ + { + "expression": "embedding", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "vector_cosine_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hnsw", + "with": { + "m": 16, + "ef_construction": 64 + } + }, + "docs_emb_metadata_gin_idx": { + "name": "docs_emb_metadata_gin_idx", + "columns": [ + { + "expression": "metadata", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "docs_emb_chunk_text_fts_idx": { + "name": "docs_emb_chunk_text_fts_idx", + "columns": [ + { + "expression": "chunk_text_tsv", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "docs_embedding_not_null_check": { + "name": "docs_embedding_not_null_check", + "value": "\"embedding\" IS NOT NULL" + }, + "docs_header_level_check": { + "name": "docs_header_level_check", + "value": "\"header_level\" >= 1 AND \"header_level\" <= 6" + } + }, + "isRLSEnabled": false + }, + "public.document": { + "name": "document", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "filename": { + "name": "filename", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_url": { + "name": "file_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "storage_key": { + "name": "storage_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_size": { + "name": "file_size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chunk_count": { + "name": "chunk_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "character_count": { + "name": "character_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "processing_status": { + "name": "processing_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "processing_attempts": { + "name": "processing_attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "processing_queued_at": { + "name": "processing_queued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_queue_token": { + "name": "processing_queue_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "processing_started_at": { + "name": "processing_started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_deferred_until": { + "name": "processing_deferred_until", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_completed_at": { + "name": "processing_completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "processing_error": { + "name": "processing_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "user_excluded": { + "name": "user_excluded", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "tag1": { + "name": "tag1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag2": { + "name": "tag2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag3": { + "name": "tag3", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag4": { + "name": "tag4", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag5": { + "name": "tag5", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag6": { + "name": "tag6", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag7": { + "name": "tag7", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "number1": { + "name": "number1", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number2": { + "name": "number2", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number3": { + "name": "number3", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number4": { + "name": "number4", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number5": { + "name": "number5", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "date1": { + "name": "date1", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "date2": { + "name": "date2", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "boolean1": { + "name": "boolean1", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean2": { + "name": "boolean2", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean3": { + "name": "boolean3", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_url": { + "name": "source_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "acl": { + "name": "acl", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{ws}'::text[]" + }, + "source_modified_at": { + "name": "source_modified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "doc_kb_id_idx": { + "name": "doc_kb_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_acl_gin_idx": { + "name": "doc_acl_gin_idx", + "columns": [ + { + "expression": "acl", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "array_ops" + } + ], + "isUnique": false, + "where": "\"document\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "gin", + "with": {} + }, + "doc_filename_idx": { + "name": "doc_filename_idx", + "columns": [ + { + "expression": "filename", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_processing_status_idx": { + "name": "doc_processing_status_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "processing_status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_connector_external_id_idx": { + "name": "doc_connector_external_id_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"document\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_connector_id_idx": { + "name": "doc_connector_id_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_active_kb_token_count_idx": { + "name": "doc_active_kb_token_count_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "token_count", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"user_excluded\" = false AND \"document\".\"archived_at\" IS NULL AND \"document\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_storage_key_idx": { + "name": "doc_storage_key_idx", + "columns": [ + { + "expression": "storage_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"storage_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_archived_at_partial_idx": { + "name": "doc_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_deleted_at_partial_idx": { + "name": "doc_deleted_at_partial_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"document\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag1_idx": { + "name": "doc_tag1_idx", + "columns": [ + { + "expression": "tag1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag2_idx": { + "name": "doc_tag2_idx", + "columns": [ + { + "expression": "tag2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag3_idx": { + "name": "doc_tag3_idx", + "columns": [ + { + "expression": "tag3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag4_idx": { + "name": "doc_tag4_idx", + "columns": [ + { + "expression": "tag4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag5_idx": { + "name": "doc_tag5_idx", + "columns": [ + { + "expression": "tag5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag6_idx": { + "name": "doc_tag6_idx", + "columns": [ + { + "expression": "tag6", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_tag7_idx": { + "name": "doc_tag7_idx", + "columns": [ + { + "expression": "tag7", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number1_idx": { + "name": "doc_number1_idx", + "columns": [ + { + "expression": "number1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number2_idx": { + "name": "doc_number2_idx", + "columns": [ + { + "expression": "number2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number3_idx": { + "name": "doc_number3_idx", + "columns": [ + { + "expression": "number3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number4_idx": { + "name": "doc_number4_idx", + "columns": [ + { + "expression": "number4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_number5_idx": { + "name": "doc_number5_idx", + "columns": [ + { + "expression": "number5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_date1_idx": { + "name": "doc_date1_idx", + "columns": [ + { + "expression": "date1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_date2_idx": { + "name": "doc_date2_idx", + "columns": [ + { + "expression": "date2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_boolean1_idx": { + "name": "doc_boolean1_idx", + "columns": [ + { + "expression": "boolean1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_boolean2_idx": { + "name": "doc_boolean2_idx", + "columns": [ + { + "expression": "boolean2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "doc_boolean3_idx": { + "name": "doc_boolean3_idx", + "columns": [ + { + "expression": "boolean3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "document_knowledge_base_id_knowledge_base_id_fk": { + "name": "document_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "document", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "document_connector_id_knowledge_connector_id_fk": { + "name": "document_connector_id_knowledge_connector_id_fk", + "tableFrom": "document", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "document_uploaded_by_user_id_fk": { + "name": "document_uploaded_by_user_id_fk", + "tableFrom": "document", + "tableTo": "user", + "columnsFrom": ["uploaded_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "doc_acl_token_shape_check": { + "name": "doc_acl_token_shape_check", + "value": "array_position(\"document\".\"acl\", NULL) IS NULL AND (cardinality(\"document\".\"acl\") = 0 OR (cardinality(\"document\".\"acl\") = array_length(string_to_array(array_to_string(\"document\".\"acl\", E'\\n'), E'\\n'), 1) AND array_to_string(\"document\".\"acl\", E'\\n') ~ '^((ws|pub|link|u:[^\\nA-Z]+@[^\\nA-Z]+|[gs]:[^\\n:]+:[^\\n:]+:[^\\n]+)(\\n(ws|pub|link|u:[^\\nA-Z]+@[^\\nA-Z]+|[gs]:[^\\n:]+:[^\\n:]+:[^\\n]+))*)$'))" + } + }, + "isRLSEnabled": false + }, + "public.document_secret_provenance": { + "name": "document_secret_provenance", + "schema": "", + "columns": { + "document_id": { + "name": "document_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "source_hash": { + "name": "source_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "document_secret_provenance_document_id_document_id_fk": { + "name": "document_secret_provenance_document_id_document_id_fk", + "tableFrom": "document_secret_provenance", + "tableTo": "document", + "columnsFrom": ["document_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "document_secret_provenance_status_check": { + "name": "document_secret_provenance_status_check", + "value": "\"document_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.embedding": { + "name": "embedding", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chunk_index": { + "name": "chunk_index", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "chunk_hash": { + "name": "chunk_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "content_length": { + "name": "content_length", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "embedding": { + "name": "embedding", + "type": "vector(1536)", + "primaryKey": false, + "notNull": false + }, + "embedding_384": { + "name": "embedding_384", + "type": "vector(384)", + "primaryKey": false, + "notNull": false + }, + "embedding_768": { + "name": "embedding_768", + "type": "vector(768)", + "primaryKey": false, + "notNull": false + }, + "embedding_1024": { + "name": "embedding_1024", + "type": "vector(1024)", + "primaryKey": false, + "notNull": false + }, + "embedding_3072": { + "name": "embedding_3072", + "type": "vector(3072)", + "primaryKey": false, + "notNull": false + }, + "embedding_model": { + "name": "embedding_model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text-embedding-3-small'" + }, + "start_offset": { + "name": "start_offset", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "end_offset": { + "name": "end_offset", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tag1": { + "name": "tag1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag2": { + "name": "tag2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag3": { + "name": "tag3", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag4": { + "name": "tag4", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag5": { + "name": "tag5", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag6": { + "name": "tag6", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag7": { + "name": "tag7", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "number1": { + "name": "number1", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number2": { + "name": "number2", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number3": { + "name": "number3", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number4": { + "name": "number4", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "number5": { + "name": "number5", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "date1": { + "name": "date1", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "date2": { + "name": "date2", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "boolean1": { + "name": "boolean1", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean2": { + "name": "boolean2", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "boolean3": { + "name": "boolean3", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "content_tsv": { + "name": "content_tsv", + "type": "tsvector", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "to_tsvector('english', \"embedding\".\"content\")", + "type": "stored" + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "emb_kb_id_idx": { + "name": "emb_kb_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_doc_id_idx": { + "name": "emb_doc_id_idx", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_doc_chunk_idx": { + "name": "emb_doc_chunk_idx", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chunk_index", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_kb_model_idx": { + "name": "emb_kb_model_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "embedding_model", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_kb_enabled_idx": { + "name": "emb_kb_enabled_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_doc_enabled_idx": { + "name": "emb_doc_enabled_idx", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "embedding_vector_hnsw_idx": { + "name": "embedding_vector_hnsw_idx", + "columns": [ + { + "expression": "embedding", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "vector_cosine_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hnsw", + "with": { + "m": 16, + "ef_construction": 64 + } + }, + "embedding_384_vector_hnsw_idx": { + "name": "embedding_384_vector_hnsw_idx", + "columns": [ + { + "expression": "embedding_384", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "vector_cosine_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hnsw", + "with": { + "m": 16, + "ef_construction": 64 + } + }, + "embedding_768_vector_hnsw_idx": { + "name": "embedding_768_vector_hnsw_idx", + "columns": [ + { + "expression": "embedding_768", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "vector_cosine_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hnsw", + "with": { + "m": 16, + "ef_construction": 64 + } + }, + "embedding_1024_vector_hnsw_idx": { + "name": "embedding_1024_vector_hnsw_idx", + "columns": [ + { + "expression": "embedding_1024", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "vector_cosine_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hnsw", + "with": { + "m": 16, + "ef_construction": 64 + } + }, + "embedding_3072_vector_hnsw_idx": { + "name": "embedding_3072_vector_hnsw_idx", + "columns": [ + { + "expression": "(\"embedding_3072\"::halfvec(3072)) halfvec_cosine_ops", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "hnsw", + "with": { + "m": 16, + "ef_construction": 64 + } + }, + "emb_tag1_idx": { + "name": "emb_tag1_idx", + "columns": [ + { + "expression": "tag1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag2_idx": { + "name": "emb_tag2_idx", + "columns": [ + { + "expression": "tag2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag3_idx": { + "name": "emb_tag3_idx", + "columns": [ + { + "expression": "tag3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag4_idx": { + "name": "emb_tag4_idx", + "columns": [ + { + "expression": "tag4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag5_idx": { + "name": "emb_tag5_idx", + "columns": [ + { + "expression": "tag5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag6_idx": { + "name": "emb_tag6_idx", + "columns": [ + { + "expression": "tag6", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_tag7_idx": { + "name": "emb_tag7_idx", + "columns": [ + { + "expression": "tag7", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number1_idx": { + "name": "emb_number1_idx", + "columns": [ + { + "expression": "number1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number2_idx": { + "name": "emb_number2_idx", + "columns": [ + { + "expression": "number2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number3_idx": { + "name": "emb_number3_idx", + "columns": [ + { + "expression": "number3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number4_idx": { + "name": "emb_number4_idx", + "columns": [ + { + "expression": "number4", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_number5_idx": { + "name": "emb_number5_idx", + "columns": [ + { + "expression": "number5", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_date1_idx": { + "name": "emb_date1_idx", + "columns": [ + { + "expression": "date1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_date2_idx": { + "name": "emb_date2_idx", + "columns": [ + { + "expression": "date2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_boolean1_idx": { + "name": "emb_boolean1_idx", + "columns": [ + { + "expression": "boolean1", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_boolean2_idx": { + "name": "emb_boolean2_idx", + "columns": [ + { + "expression": "boolean2", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_boolean3_idx": { + "name": "emb_boolean3_idx", + "columns": [ + { + "expression": "boolean3", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "emb_content_fts_idx": { + "name": "emb_content_fts_idx", + "columns": [ + { + "expression": "content_tsv", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": { + "embedding_knowledge_base_id_knowledge_base_id_fk": { + "name": "embedding_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "embedding", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "embedding_document_id_document_id_fk": { + "name": "embedding_document_id_document_id_fk", + "tableFrom": "embedding", + "tableTo": "document", + "columnsFrom": ["document_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "embedding_width_check": { + "name": "embedding_width_check", + "value": "num_nonnulls(\"embedding\", \"embedding_384\", \"embedding_768\", \"embedding_1024\", \"embedding_3072\") = 1" + } + }, + "isRLSEnabled": false + }, + "public.embedding_secret_provenance": { + "name": "embedding_secret_provenance", + "schema": "", + "columns": { + "embedding_id": { + "name": "embedding_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "embedding_secret_provenance_embedding_id_embedding_id_fk": { + "name": "embedding_secret_provenance_embedding_id_embedding_id_fk", + "tableFrom": "embedding_secret_provenance", + "tableTo": "embedding", + "columnsFrom": ["embedding_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "embedding_secret_provenance_status_check": { + "name": "embedding_secret_provenance_status_check", + "value": "\"embedding_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.environment": { + "name": "environment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "variables": { + "name": "variables", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "environment_user_id_user_id_fk": { + "name": "environment_user_id_user_id_fk", + "tableFrom": "environment", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "environment_user_id_unique": { + "name": "environment_user_id_unique", + "nullsNotDistinct": false, + "columns": ["user_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_large_value_dependencies": { + "name": "execution_large_value_dependencies", + "schema": "", + "columns": { + "parent_key": { + "name": "parent_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_key": { + "name": "child_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "execution_large_value_dependencies_workspace_parent_key_idx": { + "name": "execution_large_value_dependencies_workspace_parent_key_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_value_dependencies_workspace_child_key_idx": { + "name": "execution_large_value_dependencies_workspace_child_key_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "child_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_large_value_dependencies_workspace_id_workspace_id_fk": { + "name": "execution_large_value_dependencies_workspace_id_workspace_id_fk", + "tableFrom": "execution_large_value_dependencies", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "execution_large_value_dependencies_parent_key_child_key_pk": { + "name": "execution_large_value_dependencies_parent_key_child_key_pk", + "columns": ["parent_key", "child_key"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_large_value_references": { + "name": "execution_large_value_references", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "execution_large_value_reference_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "execution_large_value_references_workspace_execution_source_idx": { + "name": "execution_large_value_references_workspace_execution_source_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_value_references_workflow_id_idx": { + "name": "execution_large_value_references_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_large_value_references_workspace_id_workspace_id_fk": { + "name": "execution_large_value_references_workspace_id_workspace_id_fk", + "tableFrom": "execution_large_value_references", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "execution_large_value_references_workflow_id_workflow_id_fk": { + "name": "execution_large_value_references_workflow_id_workflow_id_fk", + "tableFrom": "execution_large_value_references", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "execution_large_value_references_key_execution_id_source_pk": { + "name": "execution_large_value_references_key_execution_id_source_pk", + "columns": ["key", "execution_id", "source"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_large_values": { + "name": "execution_large_values", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_execution_id": { + "name": "owner_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "execution_large_values_owner_execution_id_idx": { + "name": "execution_large_values_owner_execution_id_idx", + "columns": [ + { + "expression": "owner_execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_values_cleanup_idx": { + "name": "execution_large_values_cleanup_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"execution_large_values\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_values_tombstone_cleanup_idx": { + "name": "execution_large_values_tombstone_cleanup_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"execution_large_values\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "execution_large_values_workflow_id_idx": { + "name": "execution_large_values_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_large_values_workspace_id_workspace_id_fk": { + "name": "execution_large_values_workspace_id_workspace_id_fk", + "tableFrom": "execution_large_values", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "execution_large_values_workflow_id_workflow_id_fk": { + "name": "execution_large_values_workflow_id_workflow_id_fk", + "tableFrom": "execution_large_values", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.folder": { + "name": "folder", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "folder_resource_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_id": { + "name": "parent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "locked": { + "name": "locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "folder_user_idx": { + "name": "folder_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_workspace_resource_parent_idx": { + "name": "folder_workspace_resource_parent_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_parent_sort_idx": { + "name": "folder_parent_sort_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_deleted_at_idx": { + "name": "folder_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_workspace_deleted_partial_idx": { + "name": "folder_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"folder\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "folder_workspace_resource_parent_name_active_unique": { + "name": "folder_workspace_resource_parent_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"parent_id\", '')", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"folder\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "folder_user_id_user_id_fk": { + "name": "folder_user_id_user_id_fk", + "tableFrom": "folder", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "folder_workspace_id_workspace_id_fk": { + "name": "folder_workspace_id_workspace_id_fk", + "tableFrom": "folder", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "folder_parent_id_folder_id_fk": { + "name": "folder_parent_id_folder_id_fk", + "tableFrom": "folder", + "tableTo": "folder", + "columnsFrom": ["parent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.idempotency_key": { + "name": "idempotency_key", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "result": { + "name": "result", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idempotency_key_created_at_idx": { + "name": "idempotency_key_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.invitation": { + "name": "invitation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "invitation_kind", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'organization'" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inviter_id": { + "name": "inviter_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "membership_intent": { + "name": "membership_intent", + "type": "invitation_membership_intent", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'internal'" + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "invitation_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "invitation_email_idx": { + "name": "invitation_email_idx", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_organization_id_idx": { + "name": "invitation_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_status_idx": { + "name": "invitation_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_pending_email_org_unique": { + "name": "invitation_pending_email_org_unique", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"invitation\".\"status\" = 'pending' AND \"invitation\".\"organization_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "invitation_inviter_id_user_id_fk": { + "name": "invitation_inviter_id_user_id_fk", + "tableFrom": "invitation", + "tableTo": "user", + "columnsFrom": ["inviter_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "invitation_organization_id_organization_id_fk": { + "name": "invitation_organization_id_organization_id_fk", + "tableFrom": "invitation", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "invitation_token_unique": { + "name": "invitation_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.invitation_workspace_grant": { + "name": "invitation_workspace_grant", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "invitation_id": { + "name": "invitation_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "permission_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "invitation_workspace_grant_unique": { + "name": "invitation_workspace_grant_unique", + "columns": [ + { + "expression": "invitation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_workspace_grant_workspace_id_idx": { + "name": "invitation_workspace_grant_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "invitation_workspace_grant_invitation_id_invitation_id_fk": { + "name": "invitation_workspace_grant_invitation_id_invitation_id_fk", + "tableFrom": "invitation_workspace_grant", + "tableTo": "invitation", + "columnsFrom": ["invitation_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "invitation_workspace_grant_workspace_id_workspace_id_fk": { + "name": "invitation_workspace_grant_workspace_id_workspace_id_fk", + "tableFrom": "invitation_workspace_grant", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_execution_logs": { + "name": "job_execution_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "schedule_id": { + "name": "schedule_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "level": { + "name": "level", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'running'" + }, + "trigger": { + "name": "trigger", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "total_duration_ms": { + "name": "total_duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "execution_data": { + "name": "execution_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "cost": { + "name": "cost", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "job_execution_logs_schedule_id_idx": { + "name": "job_execution_logs_schedule_id_idx", + "columns": [ + { + "expression": "schedule_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_workspace_started_at_idx": { + "name": "job_execution_logs_workspace_started_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_workspace_ended_at_id_idx": { + "name": "job_execution_logs_workspace_ended_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"ended_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_execution_id_unique": { + "name": "job_execution_logs_execution_id_unique", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_execution_logs_trigger_idx": { + "name": "job_execution_logs_trigger_idx", + "columns": [ + { + "expression": "trigger", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_execution_logs_schedule_id_workflow_schedule_id_fk": { + "name": "job_execution_logs_schedule_id_workflow_schedule_id_fk", + "tableFrom": "job_execution_logs", + "tableTo": "workflow_schedule", + "columnsFrom": ["schedule_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "job_execution_logs_workspace_id_workspace_id_fk": { + "name": "job_execution_logs_workspace_id_workspace_id_fk", + "tableFrom": "job_execution_logs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_base": { + "name": "knowledge_base", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "embedding_model": { + "name": "embedding_model", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text-embedding-3-small'" + }, + "embedding_dimension": { + "name": "embedding_dimension", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1536 + }, + "chunking_config": { + "name": "chunking_config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{\"maxSize\": 1024, \"minSize\": 1, \"overlap\": 200}'" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "kb_user_id_idx": { + "name": "kb_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_workspace_id_idx": { + "name": "kb_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_user_workspace_idx": { + "name": "kb_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_folder_id_idx": { + "name": "kb_folder_id_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_deleted_at_idx": { + "name": "kb_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_workspace_deleted_partial_idx": { + "name": "kb_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_base\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_workspace_name_active_unique": { + "name": "kb_workspace_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"knowledge_base\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_base_user_id_user_id_fk": { + "name": "knowledge_base_user_id_user_id_fk", + "tableFrom": "knowledge_base", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_base_workspace_id_workspace_id_fk": { + "name": "knowledge_base_workspace_id_workspace_id_fk", + "tableFrom": "knowledge_base", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_base_folder_id_folder_id_fk": { + "name": "knowledge_base_folder_id_folder_id_fk", + "tableFrom": "knowledge_base", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_base_tag_definitions": { + "name": "knowledge_base_tag_definitions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag_slot": { + "name": "tag_slot", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "field_type": { + "name": "field_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "kb_tag_definitions_kb_slot_idx": { + "name": "kb_tag_definitions_kb_slot_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag_slot", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_tag_definitions_kb_display_name_idx": { + "name": "kb_tag_definitions_kb_display_name_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "display_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kb_tag_definitions_kb_id_idx": { + "name": "kb_tag_definitions_kb_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_base_tag_definitions_knowledge_base_id_knowledge_base_id_fk": { + "name": "knowledge_base_tag_definitions_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "knowledge_base_tag_definitions", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_connector": { + "name": "knowledge_connector", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "connector_type": { + "name": "connector_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_config": { + "name": "source_config", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "sync_mode": { + "name": "sync_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'full'" + }, + "sync_interval_minutes": { + "name": "sync_interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1440 + }, + "access_mode": { + "name": "access_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'workspace'" + }, + "credential_group_id": { + "name": "credential_group_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_group_option_id": { + "name": "credential_group_option_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_sync_status": { + "name": "member_sync_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'idle'" + }, + "member_sync_lock_token": { + "name": "member_sync_lock_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_sync_lock_lease_at": { + "name": "member_sync_lock_lease_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_member_sync_at": { + "name": "next_member_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_member_sync_at": { + "name": "last_member_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_member_sync_error": { + "name": "last_member_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_sync_consecutive_failures": { + "name": "member_sync_consecutive_failures", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "access_rewrite_pending": { + "name": "access_rewrite_pending", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_sync_error": { + "name": "last_sync_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_sync_doc_count": { + "name": "last_sync_doc_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "next_sync_at": { + "name": "next_sync_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "consecutive_failures": { + "name": "consecutive_failures", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "sync_lock_token": { + "name": "sync_lock_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sync_lock_lease_at": { + "name": "sync_lock_lease_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "kc_knowledge_base_id_idx": { + "name": "kc_knowledge_base_id_idx", + "columns": [ + { + "expression": "knowledge_base_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_status_next_sync_idx": { + "name": "kc_status_next_sync_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "next_sync_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_archived_at_partial_idx": { + "name": "kc_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_deleted_at_partial_idx": { + "name": "kc_deleted_at_partial_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "kc_member_sync_due_idx": { + "name": "kc_member_sync_due_idx", + "columns": [ + { + "expression": "member_sync_status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "next_member_sync_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector\".\"access_mode\" = 'members' AND \"knowledge_connector\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_knowledge_base_id_knowledge_base_id_fk": { + "name": "knowledge_connector_knowledge_base_id_knowledge_base_id_fk", + "tableFrom": "knowledge_connector", + "tableTo": "knowledge_base", + "columnsFrom": ["knowledge_base_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_connector_credential_group_id_credential_group_id_fk": { + "name": "knowledge_connector_credential_group_id_credential_group_id_fk", + "tableFrom": "knowledge_connector", + "tableTo": "credential_group", + "columnsFrom": ["credential_group_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "kc_access_mode_check": { + "name": "kc_access_mode_check", + "value": "\"knowledge_connector\".\"access_mode\" IN ('workspace', 'members', 'admin')" + }, + "kc_member_sync_status_check": { + "name": "kc_member_sync_status_check", + "value": "\"knowledge_connector\".\"member_sync_status\" IN ('idle', 'pending', 'running', 'error', 'disabled')" + }, + "kc_sync_lock_exclusive_check": { + "name": "kc_sync_lock_exclusive_check", + "value": "NOT (\"knowledge_connector\".\"sync_lock_token\" IS NOT NULL AND \"knowledge_connector\".\"member_sync_lock_token\" IS NOT NULL)" + } + }, + "isRLSEnabled": false + }, + "public.knowledge_connector_member": { + "name": "knowledge_connector_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "subject_token": { + "name": "subject_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "consecutive_failures": { + "name": "consecutive_failures", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "next_attempt_at": { + "name": "next_attempt_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_started_at": { + "name": "last_started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_complete_listing_at": { + "name": "last_complete_listing_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_listed_count": { + "name": "last_listed_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "member_synced_through": { + "name": "member_synced_through", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "change_cursor": { + "name": "change_cursor", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "suspended_at": { + "name": "suspended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "kcm_connector_credential_unique": { + "name": "kcm_connector_credential_unique", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcm_connector_queue_idx": { + "name": "kcm_connector_queue_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "next_attempt_at", + "isExpression": false, + "asc": true, + "nulls": "first" + }, + { + "expression": "last_started_at", + "isExpression": false, + "asc": true, + "nulls": "first" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcm_credential_idx": { + "name": "kcm_credential_idx", + "columns": [ + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_member_workspace_id_workspace_id_fk": { + "name": "knowledge_connector_member_workspace_id_workspace_id_fk", + "tableFrom": "knowledge_connector_member", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_connector_member_connector_id_knowledge_connector_id_fk": { + "name": "knowledge_connector_member_connector_id_knowledge_connector_id_fk", + "tableFrom": "knowledge_connector_member", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_connector_member_credential_id_credential_id_fk": { + "name": "knowledge_connector_member_credential_id_credential_id_fk", + "tableFrom": "knowledge_connector_member", + "tableTo": "credential", + "columnsFrom": ["credential_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "kcm_status_check": { + "name": "kcm_status_check", + "value": "\"knowledge_connector_member\".\"status\" IN ('active', 'suspended', 'disabled')" + }, + "kcm_subject_token_shape_check": { + "name": "kcm_subject_token_shape_check", + "value": "\"knowledge_connector_member\".\"subject_token\" ~ '^s:[^:]+:[^:]+:.+$'" + } + }, + "isRLSEnabled": false + }, + "public.knowledge_connector_member_sync_log": { + "name": "knowledge_connector_member_sync_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "members_claimed": { + "name": "members_claimed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "members_completed": { + "name": "members_completed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "members_incomplete": { + "name": "members_incomplete", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "members_failed": { + "name": "members_failed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_listed": { + "name": "docs_listed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_added": { + "name": "docs_added", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_updated": { + "name": "docs_updated", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_unchanged": { + "name": "docs_unchanged", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_hydrated_once": { + "name": "docs_hydrated_once", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "observations_added": { + "name": "observations_added", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "observations_removed": { + "name": "observations_removed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_tombstoned": { + "name": "docs_tombstoned", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_resurrected": { + "name": "docs_resurrected", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_purged": { + "name": "docs_purged", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "credentials_audited": { + "name": "credentials_audited", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "kcmsl_connector_started_at_idx": { + "name": "kcmsl_connector_started_at_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"started_at\" DESC", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcmsl_started_at_partial_idx": { + "name": "kcmsl_started_at_partial_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector_member_sync_log\".\"status\" = 'started'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_member_sync_log_connector_id_knowledge_connector_id_fk": { + "name": "knowledge_connector_member_sync_log_connector_id_knowledge_connector_id_fk", + "tableFrom": "knowledge_connector_member_sync_log", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "kcmsl_status_check": { + "name": "kcmsl_status_check", + "value": "\"knowledge_connector_member_sync_log\".\"status\" IN ('started', 'completed', 'failed')" + } + }, + "isRLSEnabled": false + }, + "public.knowledge_connector_sync_log": { + "name": "knowledge_connector_sync_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connector_id": { + "name": "connector_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "docs_added": { + "name": "docs_added", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_updated": { + "name": "docs_updated", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_deleted": { + "name": "docs_deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_unchanged": { + "name": "docs_unchanged", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_skipped": { + "name": "docs_skipped", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "docs_failed": { + "name": "docs_failed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "kcsl_connector_started_at_idx": { + "name": "kcsl_connector_started_at_idx", + "columns": [ + { + "expression": "connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"started_at\" DESC", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kcsl_started_at_partial_idx": { + "name": "kcsl_started_at_partial_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"knowledge_connector_sync_log\".\"status\" = 'started'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_connector_sync_log_connector_id_knowledge_connector_id_fk": { + "name": "knowledge_connector_sync_log_connector_id_knowledge_connector_id_fk", + "tableFrom": "knowledge_connector_sync_log", + "tableTo": "knowledge_connector", + "columnsFrom": ["connector_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.knowledge_document_observation": { + "name": "knowledge_document_observation", + "schema": "", + "columns": { + "document_id": { + "name": "document_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "member_id": { + "name": "member_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "run_id": { + "name": "run_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "kdo_member_idx": { + "name": "kdo_member_idx", + "columns": [ + { + "expression": "member_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "knowledge_document_observation_document_id_document_id_fk": { + "name": "knowledge_document_observation_document_id_document_id_fk", + "tableFrom": "knowledge_document_observation", + "tableTo": "document", + "columnsFrom": ["document_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "knowledge_document_observation_member_id_knowledge_connector_member_id_fk": { + "name": "knowledge_document_observation_member_id_knowledge_connector_member_id_fk", + "tableFrom": "knowledge_document_observation", + "tableTo": "knowledge_connector_member", + "columnsFrom": ["member_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "knowledge_document_observation_document_id_member_id_pk": { + "name": "knowledge_document_observation_document_id_member_id_pk", + "columns": ["document_id", "member_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mcp_server_oauth": { + "name": "mcp_server_oauth", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "mcp_server_id": { + "name": "mcp_server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_information": { + "name": "client_information", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tokens": { + "name": "tokens", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "code_verifier": { + "name": "code_verifier", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state_created_at": { + "name": "state_created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_refreshed_at": { + "name": "last_refreshed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "mcp_server_oauth_server_unique": { + "name": "mcp_server_oauth_server_unique", + "columns": [ + { + "expression": "mcp_server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_server_oauth_state_idx": { + "name": "mcp_server_oauth_state_idx", + "columns": [ + { + "expression": "state", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mcp_server_oauth_mcp_server_id_mcp_servers_id_fk": { + "name": "mcp_server_oauth_mcp_server_id_mcp_servers_id_fk", + "tableFrom": "mcp_server_oauth", + "tableTo": "mcp_servers", + "columnsFrom": ["mcp_server_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mcp_server_oauth_user_id_user_id_fk": { + "name": "mcp_server_oauth_user_id_user_id_fk", + "tableFrom": "mcp_server_oauth", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "mcp_server_oauth_workspace_id_workspace_id_fk": { + "name": "mcp_server_oauth_workspace_id_workspace_id_fk", + "tableFrom": "mcp_server_oauth", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mcp_servers": { + "name": "mcp_servers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_group_id": { + "name": "credential_group_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "managed_connector_id": { + "name": "managed_connector_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "transport": { + "name": "transport", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "auth_type": { + "name": "auth_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'headers'" + }, + "oauth_client_id": { + "name": "oauth_client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "oauth_client_secret": { + "name": "oauth_client_secret", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "headers": { + "name": "headers", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "timeout": { + "name": "timeout", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 30000 + }, + "retries": { + "name": "retries", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 3 + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "last_connected": { + "name": "last_connected", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "connection_status": { + "name": "connection_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'disconnected'" + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status_config": { + "name": "status_config", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "tool_count": { + "name": "tool_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_tools_refresh": { + "name": "last_tools_refresh", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "total_requests": { + "name": "total_requests", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_used": { + "name": "last_used", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "mcp_servers_workspace_enabled_idx": { + "name": "mcp_servers_workspace_enabled_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_servers_credential_group_idx": { + "name": "mcp_servers_credential_group_idx", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_servers_credential_group_managed_connector_unique": { + "name": "mcp_servers_credential_group_managed_connector_unique", + "columns": [ + { + "expression": "credential_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "managed_connector_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"mcp_servers\".\"credential_group_id\" IS NOT NULL AND \"mcp_servers\".\"managed_connector_id\" IS NOT NULL AND \"mcp_servers\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "mcp_servers_workspace_deleted_partial_idx": { + "name": "mcp_servers_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"mcp_servers\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mcp_servers_workspace_id_workspace_id_fk": { + "name": "mcp_servers_workspace_id_workspace_id_fk", + "tableFrom": "mcp_servers", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mcp_servers_credential_group_id_credential_group_id_fk": { + "name": "mcp_servers_credential_group_id_credential_group_id_fk", + "tableFrom": "mcp_servers", + "tableTo": "credential_group", + "columnsFrom": ["credential_group_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "mcp_servers_created_by_user_id_fk": { + "name": "mcp_servers_created_by_user_id_fk", + "tableFrom": "mcp_servers", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "mcp_servers_credential_group_managed_connector_check": { + "name": "mcp_servers_credential_group_managed_connector_check", + "value": "\"mcp_servers\".\"credential_group_id\" IS NULL OR \"mcp_servers\".\"managed_connector_id\" IS NOT NULL" + }, + "mcp_servers_managed_connector_oauth_check": { + "name": "mcp_servers_managed_connector_oauth_check", + "value": "\"mcp_servers\".\"managed_connector_id\" IS NULL OR \"mcp_servers\".\"auth_type\" = 'oauth'" + } + }, + "isRLSEnabled": false + }, + "public.member": { + "name": "member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "member_user_id_unique": { + "name": "member_user_id_unique", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "member_organization_id_idx": { + "name": "member_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "member_user_id_user_id_fk": { + "name": "member_user_id_user_id_fk", + "tableFrom": "member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "member_organization_id_organization_id_fk": { + "name": "member_organization_id_organization_id_fk", + "tableFrom": "member", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.memory": { + "name": "memory", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "memory_key_idx": { + "name": "memory_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "memory_workspace_idx": { + "name": "memory_workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "memory_workspace_key_idx": { + "name": "memory_workspace_key_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "memory_workspace_deleted_partial_idx": { + "name": "memory_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"memory\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "memory_workspace_id_workspace_id_fk": { + "name": "memory_workspace_id_workspace_id_fk", + "tableFrom": "memory", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.memory_secret_provenance": { + "name": "memory_secret_provenance", + "schema": "", + "columns": { + "memory_id": { + "name": "memory_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "memory_secret_provenance_memory_id_memory_id_fk": { + "name": "memory_secret_provenance_memory_id_memory_id_fk", + "tableFrom": "memory_secret_provenance", + "tableTo": "memory", + "columnsFrom": ["memory_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "memory_secret_provenance_status_check": { + "name": "memory_secret_provenance_status_check", + "value": "\"memory_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.mothership_inbox_allowed_sender": { + "name": "mothership_inbox_allowed_sender", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "added_by": { + "name": "added_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "inbox_sender_ws_email_idx": { + "name": "inbox_sender_ws_email_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mothership_inbox_allowed_sender_workspace_id_workspace_id_fk": { + "name": "mothership_inbox_allowed_sender_workspace_id_workspace_id_fk", + "tableFrom": "mothership_inbox_allowed_sender", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mothership_inbox_allowed_sender_added_by_user_id_fk": { + "name": "mothership_inbox_allowed_sender_added_by_user_id_fk", + "tableFrom": "mothership_inbox_allowed_sender", + "tableTo": "user", + "columnsFrom": ["added_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mothership_inbox_task": { + "name": "mothership_inbox_task", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "from_email": { + "name": "from_email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "from_name": { + "name": "from_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "subject": { + "name": "subject", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "body_preview": { + "name": "body_preview", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "body_text": { + "name": "body_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "body_html": { + "name": "body_html", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_message_id": { + "name": "email_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "in_reply_to": { + "name": "in_reply_to", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "response_message_id": { + "name": "response_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "agentmail_message_id": { + "name": "agentmail_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'received'" + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "trigger_job_id": { + "name": "trigger_job_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "result_summary": { + "name": "result_summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rejection_reason": { + "name": "rejection_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "has_attachments": { + "name": "has_attachments", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cc_recipients": { + "name": "cc_recipients", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "processing_started_at": { + "name": "processing_started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "inbox_task_ws_created_at_idx": { + "name": "inbox_task_ws_created_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "inbox_task_ws_status_idx": { + "name": "inbox_task_ws_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "inbox_task_response_msg_id_idx": { + "name": "inbox_task_response_msg_id_idx", + "columns": [ + { + "expression": "response_message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "inbox_task_email_msg_id_idx": { + "name": "inbox_task_email_msg_id_idx", + "columns": [ + { + "expression": "email_message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "mothership_inbox_task_workspace_id_workspace_id_fk": { + "name": "mothership_inbox_task_workspace_id_workspace_id_fk", + "tableFrom": "mothership_inbox_task", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "mothership_inbox_task_chat_id_copilot_chats_id_fk": { + "name": "mothership_inbox_task_chat_id_copilot_chats_id_fk", + "tableFrom": "mothership_inbox_task", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mothership_inbox_webhook": { + "name": "mothership_inbox_webhook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "webhook_id": { + "name": "webhook_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "mothership_inbox_webhook_workspace_id_workspace_id_fk": { + "name": "mothership_inbox_webhook_workspace_id_workspace_id_fk", + "tableFrom": "mothership_inbox_webhook", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "mothership_inbox_webhook_workspace_id_unique": { + "name": "mothership_inbox_webhook_workspace_id_unique", + "nullsNotDistinct": false, + "columns": ["workspace_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mothership_settings": { + "name": "mothership_settings", + "schema": "", + "columns": { + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "mcp_tool_refs": { + "name": "mcp_tool_refs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "custom_tool_refs": { + "name": "custom_tool_refs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "skill_refs": { + "name": "skill_refs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "mothership_settings_workspace_id_workspace_id_fk": { + "name": "mothership_settings_workspace_id_workspace_id_fk", + "tableFrom": "mothership_settings", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization": { + "name": "organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "session_policy_settings": { + "name": "session_policy_settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "security_policy_version": { + "name": "security_policy_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "whitelabel_settings": { + "name": "whitelabel_settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "data_retention_settings": { + "name": "data_retention_settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "org_usage_limit": { + "name": "org_usage_limit", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "storage_used_bytes": { + "name": "storage_used_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "limit_notifications": { + "name": "limit_notifications", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "departed_member_usage": { + "name": "departed_member_usage", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "credit_balance": { + "name": "credit_balance", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_byok_keys": { + "name": "organization_byok_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "organization_byok_organization_provider_idx": { + "name": "organization_byok_organization_provider_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_byok_keys_organization_id_organization_id_fk": { + "name": "organization_byok_keys_organization_id_organization_id_fk", + "tableFrom": "organization_byok_keys", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_byok_keys_created_by_user_id_fk": { + "name": "organization_byok_keys_created_by_user_id_fk", + "tableFrom": "organization_byok_keys", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_member_usage_limit": { + "name": "organization_member_usage_limit", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "usage_limit": { + "name": "usage_limit", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "set_by": { + "name": "set_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "org_member_usage_limit_org_user_unique": { + "name": "org_member_usage_limit_org_user_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "org_member_usage_limit_organization_id_idx": { + "name": "org_member_usage_limit_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_member_usage_limit_organization_id_organization_id_fk": { + "name": "organization_member_usage_limit_organization_id_organization_id_fk", + "tableFrom": "organization_member_usage_limit", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_member_usage_limit_user_id_user_id_fk": { + "name": "organization_member_usage_limit_user_id_user_id_fk", + "tableFrom": "organization_member_usage_limit", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_member_usage_limit_set_by_user_id_fk": { + "name": "organization_member_usage_limit_set_by_user_id_fk", + "tableFrom": "organization_member_usage_limit", + "tableTo": "user", + "columnsFrom": ["set_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.outbox_event": { + "name": "outbox_event", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "max_attempts": { + "name": "max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 10 + }, + "available_at": { + "name": "available_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "locked_at": { + "name": "locked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "processed_at": { + "name": "processed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "outbox_event_status_available_idx": { + "name": "outbox_event_status_available_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "available_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "outbox_event_locked_at_idx": { + "name": "outbox_event_locked_at_idx", + "columns": [ + { + "expression": "locked_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "outbox_event_type_created_idx": { + "name": "outbox_event_type_created_idx", + "columns": [ + { + "expression": "event_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.paused_executions": { + "name": "paused_executions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_snapshot": { + "name": "execution_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "pause_points": { + "name": "pause_points", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "total_pause_count": { + "name": "total_pause_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "resumed_count": { + "name": "resumed_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "automatic_resume_retry_count": { + "name": "automatic_resume_retry_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'paused'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "paused_at": { + "name": "paused_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "next_resume_at": { + "name": "next_resume_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "paused_executions_workflow_id_idx": { + "name": "paused_executions_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "paused_executions_status_idx": { + "name": "paused_executions_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "paused_executions_execution_id_unique": { + "name": "paused_executions_execution_id_unique", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "paused_executions_next_resume_at_idx": { + "name": "paused_executions_next_resume_at_idx", + "columns": [ + { + "expression": "next_resume_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "status = 'paused' AND next_resume_at IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "paused_executions_workflow_id_workflow_id_fk": { + "name": "paused_executions_workflow_id_workflow_id_fk", + "tableFrom": "paused_executions", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pending_credential_draft": { + "name": "pending_credential_draft", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "oauth_config": { + "name": "oauth_config", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "pending_draft_user_provider_ws": { + "name": "pending_draft_user_provider_ws", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "pending_credential_draft_user_id_user_id_fk": { + "name": "pending_credential_draft_user_id_user_id_fk", + "tableFrom": "pending_credential_draft", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pending_credential_draft_workspace_id_workspace_id_fk": { + "name": "pending_credential_draft_workspace_id_workspace_id_fk", + "tableFrom": "pending_credential_draft", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pending_credential_draft_credential_id_credential_id_fk": { + "name": "pending_credential_draft_credential_id_credential_id_fk", + "tableFrom": "pending_credential_draft", + "tableTo": "credential", + "columnsFrom": ["credential_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permission_group": { + "name": "permission_group", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "membership_mode": { + "name": "membership_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'inherit'" + } + }, + "indexes": { + "permission_group_created_by_idx": { + "name": "permission_group_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_organization_name_unique": { + "name": "permission_group_organization_name_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_organization_default_unique": { + "name": "permission_group_organization_default_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "is_default = true", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permission_group_organization_id_organization_id_fk": { + "name": "permission_group_organization_id_organization_id_fk", + "tableFrom": "permission_group", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_created_by_user_id_fk": { + "name": "permission_group_created_by_user_id_fk", + "tableFrom": "permission_group", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permission_group_member": { + "name": "permission_group_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "permission_group_id": { + "name": "permission_group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "assigned_by": { + "name": "assigned_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "assigned_at": { + "name": "assigned_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "permission_group_member_group_id_idx": { + "name": "permission_group_member_group_id_idx", + "columns": [ + { + "expression": "permission_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_member_group_user_unique": { + "name": "permission_group_member_group_user_unique", + "columns": [ + { + "expression": "permission_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_member_organization_user_idx": { + "name": "permission_group_member_organization_user_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permission_group_member_permission_group_id_permission_group_id_fk": { + "name": "permission_group_member_permission_group_id_permission_group_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "permission_group", + "columnsFrom": ["permission_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_member_organization_id_organization_id_fk": { + "name": "permission_group_member_organization_id_organization_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_member_user_id_user_id_fk": { + "name": "permission_group_member_user_id_user_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_member_assigned_by_user_id_fk": { + "name": "permission_group_member_assigned_by_user_id_fk", + "tableFrom": "permission_group_member", + "tableTo": "user", + "columnsFrom": ["assigned_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permission_group_workspace": { + "name": "permission_group_workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "permission_group_id": { + "name": "permission_group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "permission_group_workspace_workspace_id_idx": { + "name": "permission_group_workspace_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permission_group_workspace_group_workspace_unique": { + "name": "permission_group_workspace_group_workspace_unique", + "columns": [ + { + "expression": "permission_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permission_group_workspace_permission_group_id_permission_group_id_fk": { + "name": "permission_group_workspace_permission_group_id_permission_group_id_fk", + "tableFrom": "permission_group_workspace", + "tableTo": "permission_group", + "columnsFrom": ["permission_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_workspace_workspace_id_workspace_id_fk": { + "name": "permission_group_workspace_workspace_id_workspace_id_fk", + "tableFrom": "permission_group_workspace", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permission_group_workspace_organization_id_organization_id_fk": { + "name": "permission_group_workspace_organization_id_organization_id_fk", + "tableFrom": "permission_group_workspace", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission_type": { + "name": "permission_type", + "type": "permission_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "permissions_user_id_idx": { + "name": "permissions_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_entity_idx": { + "name": "permissions_entity_idx", + "columns": [ + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_user_entity_type_idx": { + "name": "permissions_user_entity_type_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_user_entity_permission_idx": { + "name": "permissions_user_entity_permission_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "permission_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "permissions_unique_constraint": { + "name": "permissions_unique_constraint", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "permissions_user_id_user_id_fk": { + "name": "permissions_user_id_user_id_fk", + "tableFrom": "permissions", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pinned_item": { + "name": "pinned_item", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pinned_at": { + "name": "pinned_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "pinned_item_user_workspace_idx": { + "name": "pinned_item_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "pinned_item_resource_idx": { + "name": "pinned_item_resource_idx", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "pinned_item_user_resource_unique": { + "name": "pinned_item_user_resource_unique", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "pinned_item_user_id_user_id_fk": { + "name": "pinned_item_user_id_user_id_fk", + "tableFrom": "pinned_item", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "pinned_item_workspace_id_workspace_id_fk": { + "name": "pinned_item_workspace_id_workspace_id_fk", + "tableFrom": "pinned_item", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.public_share": { + "name": "public_share", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "auth_type": { + "name": "auth_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'public'" + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "allowed_emails": { + "name": "allowed_emails", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "public_share_token_unique": { + "name": "public_share_token_unique", + "columns": [ + { + "expression": "token", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "public_share_resource_unique": { + "name": "public_share_resource_unique", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "public_share_resource_id_idx": { + "name": "public_share_resource_id_idx", + "columns": [ + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "public_share_workspace_id_idx": { + "name": "public_share_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "public_share_workspace_id_workspace_id_fk": { + "name": "public_share_workspace_id_workspace_id_fk", + "tableFrom": "public_share", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "public_share_created_by_user_id_fk": { + "name": "public_share_created_by_user_id_fk", + "tableFrom": "public_share", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rate_limit_bucket": { + "name": "rate_limit_bucket", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "tokens": { + "name": "tokens", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "last_refill_at": { + "name": "last_refill_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_policy": { + "name": "resource_policy", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "revision": { + "name": "revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "document": { + "name": "document", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "resource_policy_resource_unique": { + "name": "resource_policy_resource_unique", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resource_policy_workspace_id_idx": { + "name": "resource_policy_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_policy_workspace_id_workspace_id_fk": { + "name": "resource_policy_workspace_id_workspace_id_fk", + "tableFrom": "resource_policy", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "resource_policy_created_by_user_id_fk": { + "name": "resource_policy_created_by_user_id_fk", + "tableFrom": "resource_policy", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "resource_policy_updated_by_user_id_fk": { + "name": "resource_policy_updated_by_user_id_fk", + "tableFrom": "resource_policy", + "tableTo": "user", + "columnsFrom": ["updated_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resume_queue": { + "name": "resume_queue", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "paused_execution_id": { + "name": "paused_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_execution_id": { + "name": "parent_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "new_execution_id": { + "name": "new_execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "context_id": { + "name": "context_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resume_input": { + "name": "resume_input", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "queued_at": { + "name": "queued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "claimed_at": { + "name": "claimed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "failure_reason": { + "name": "failure_reason", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "resume_queue_parent_status_idx": { + "name": "resume_queue_parent_status_idx", + "columns": [ + { + "expression": "parent_execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "queued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resume_queue_new_execution_idx": { + "name": "resume_queue_new_execution_idx", + "columns": [ + { + "expression": "new_execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resume_queue_paused_execution_id_paused_executions_id_fk": { + "name": "resume_queue_paused_execution_id_paused_executions_id_fk", + "tableFrom": "resume_queue", + "tableTo": "paused_executions", + "columnsFrom": ["paused_execution_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sandbox_image": { + "name": "sandbox_image", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "spec_hash": { + "name": "spec_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "spec": { + "name": "spec", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "sandbox_image_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "image_ref": { + "name": "image_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_image_id": { + "name": "provider_image_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "build_id": { + "name": "build_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "materialization_generation": { + "name": "materialization_generation", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "error_code": { + "name": "error_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_detail": { + "name": "error_detail", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "sandbox_image_provider_spec_unique": { + "name": "sandbox_image_provider_spec_unique", + "columns": [ + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "spec_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sandbox_image_status_idx": { + "name": "sandbox_image_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sandbox_image_last_used_idx": { + "name": "sandbox_image_last_used_idx", + "columns": [ + { + "expression": "last_used_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scim_connection": { + "name": "scim_connection", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sso_provider_id": { + "name": "sso_provider_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "settings": { + "name": "settings", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "last_request_at": { + "name": "last_request_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reconcile_lock_token": { + "name": "reconcile_lock_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reconcile_lease_at": { + "name": "reconcile_lease_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "reconciled_at": { + "name": "reconciled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scim_connection_organization_unique": { + "name": "scim_connection_organization_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_connection_reconcile_due_idx": { + "name": "scim_connection_reconcile_due_idx", + "columns": [ + { + "expression": "reconciled_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "scim_connection_organization_id_organization_id_fk": { + "name": "scim_connection_organization_id_organization_id_fk", + "tableFrom": "scim_connection", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "scim_connection_sso_provider_id_sso_provider_id_fk": { + "name": "scim_connection_sso_provider_id_sso_provider_id_fk", + "tableFrom": "scim_connection", + "tableTo": "sso_provider", + "columnsFrom": ["sso_provider_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "scim_connection_created_by_user_id_fk": { + "name": "scim_connection_created_by_user_id_fk", + "tableFrom": "scim_connection", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scim_credential": { + "name": "scim_credential", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connection_id": { + "name": "connection_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_prefix": { + "name": "token_prefix", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "revoked_by": { + "name": "revoked_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scim_credential_token_hash_unique": { + "name": "scim_credential_token_hash_unique", + "columns": [ + { + "expression": "token_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_credential_connection_idx": { + "name": "scim_credential_connection_idx", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "scim_credential_connection_id_scim_connection_id_fk": { + "name": "scim_credential_connection_id_scim_connection_id_fk", + "tableFrom": "scim_credential", + "tableTo": "scim_connection", + "columnsFrom": ["connection_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "scim_credential_revoked_by_user_id_fk": { + "name": "scim_credential_revoked_by_user_id_fk", + "tableFrom": "scim_credential", + "tableTo": "user", + "columnsFrom": ["revoked_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "scim_credential_created_by_user_id_fk": { + "name": "scim_credential_created_by_user_id_fk", + "tableFrom": "scim_credential", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scim_group": { + "name": "scim_group", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connection_id": { + "name": "connection_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name_key": { + "name": "display_name_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "order_key": { + "name": "order_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scim_group_connection_display_name_unique": { + "name": "scim_group_connection_display_name_unique", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "display_name_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_group_connection_external_id_unique": { + "name": "scim_group_connection_external_id_unique", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "external_id is not null", + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_group_connection_order_idx": { + "name": "scim_group_connection_order_idx", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "order_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "scim_group_connection_id_scim_connection_id_fk": { + "name": "scim_group_connection_id_scim_connection_id_fk", + "tableFrom": "scim_group", + "tableTo": "scim_connection", + "columnsFrom": ["connection_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scim_group_mapping": { + "name": "scim_group_mapping", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "group_id": { + "name": "group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_kind": { + "name": "target_kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission_group_id": { + "name": "permission_group_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "permission_type": { + "name": "permission_type", + "type": "permission_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scim_group_mapping_group_idx": { + "name": "scim_group_mapping_group_idx", + "columns": [ + { + "expression": "group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_group_mapping_group_target_unique": { + "name": "scim_group_mapping_group_target_unique", + "columns": [ + { + "expression": "group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"permission_group_id\", \"workspace_id\", \"role\")", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "scim_group_mapping_group_id_scim_group_id_fk": { + "name": "scim_group_mapping_group_id_scim_group_id_fk", + "tableFrom": "scim_group_mapping", + "tableTo": "scim_group", + "columnsFrom": ["group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "scim_group_mapping_permission_group_id_permission_group_id_fk": { + "name": "scim_group_mapping_permission_group_id_permission_group_id_fk", + "tableFrom": "scim_group_mapping", + "tableTo": "permission_group", + "columnsFrom": ["permission_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "scim_group_mapping_workspace_id_workspace_id_fk": { + "name": "scim_group_mapping_workspace_id_workspace_id_fk", + "tableFrom": "scim_group_mapping", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "scim_group_mapping_created_by_user_id_fk": { + "name": "scim_group_mapping_created_by_user_id_fk", + "tableFrom": "scim_group_mapping", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "scim_group_mapping_target_shape": { + "name": "scim_group_mapping_target_shape", + "value": "(\n (\"scim_group_mapping\".\"target_kind\" = 'permission_group' AND \"scim_group_mapping\".\"permission_group_id\" IS NOT NULL AND \"scim_group_mapping\".\"workspace_id\" IS NULL AND \"scim_group_mapping\".\"permission_type\" IS NULL AND \"scim_group_mapping\".\"role\" IS NULL)\n OR (\"scim_group_mapping\".\"target_kind\" = 'workspace' AND \"scim_group_mapping\".\"workspace_id\" IS NOT NULL AND \"scim_group_mapping\".\"permission_type\" IS NOT NULL AND \"scim_group_mapping\".\"permission_group_id\" IS NULL AND \"scim_group_mapping\".\"role\" IS NULL)\n OR (\"scim_group_mapping\".\"target_kind\" = 'org_role' AND \"scim_group_mapping\".\"role\" IS NOT NULL AND \"scim_group_mapping\".\"permission_group_id\" IS NULL AND \"scim_group_mapping\".\"workspace_id\" IS NULL AND \"scim_group_mapping\".\"permission_type\" IS NULL)\n )" + } + }, + "isRLSEnabled": false + }, + "public.scim_group_member": { + "name": "scim_group_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "group_id": { + "name": "group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scim_user_id": { + "name": "scim_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scim_group_member_group_user_unique": { + "name": "scim_group_member_group_user_unique", + "columns": [ + { + "expression": "group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scim_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_group_member_scim_user_idx": { + "name": "scim_group_member_scim_user_idx", + "columns": [ + { + "expression": "scim_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "scim_group_member_group_id_scim_group_id_fk": { + "name": "scim_group_member_group_id_scim_group_id_fk", + "tableFrom": "scim_group_member", + "tableTo": "scim_group", + "columnsFrom": ["group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "scim_group_member_scim_user_id_scim_user_id_fk": { + "name": "scim_group_member_scim_user_id_scim_user_id_fk", + "tableFrom": "scim_group_member", + "tableTo": "scim_user", + "columnsFrom": ["scim_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scim_projection_grant": { + "name": "scim_projection_grant", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connection_id": { + "name": "connection_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scim_user_id": { + "name": "scim_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_kind": { + "name": "target_kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "permission_type": { + "name": "permission_type", + "type": "permission_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scim_projection_grant_user_target_unique": { + "name": "scim_projection_grant_user_target_unique", + "columns": [ + { + "expression": "scim_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_projection_grant_connection_idx": { + "name": "scim_projection_grant_connection_idx", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "scim_projection_grant_connection_id_scim_connection_id_fk": { + "name": "scim_projection_grant_connection_id_scim_connection_id_fk", + "tableFrom": "scim_projection_grant", + "tableTo": "scim_connection", + "columnsFrom": ["connection_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "scim_projection_grant_scim_user_id_scim_user_id_fk": { + "name": "scim_projection_grant_scim_user_id_scim_user_id_fk", + "tableFrom": "scim_projection_grant", + "tableTo": "scim_user", + "columnsFrom": ["scim_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scim_request_log": { + "name": "scim_request_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connection_id": { + "name": "connection_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "method": { + "name": "method", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "scim_type": { + "name": "scim_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "detail": { + "name": "detail", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "duration_ms": { + "name": "duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scim_request_log_connection_created_idx": { + "name": "scim_request_log_connection_created_idx", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "scim_request_log_connection_id_scim_connection_id_fk": { + "name": "scim_request_log_connection_id_scim_connection_id_fk", + "tableFrom": "scim_request_log", + "tableTo": "scim_connection", + "columnsFrom": ["connection_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scim_user": { + "name": "scim_user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connection_id": { + "name": "connection_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_name": { + "name": "user_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "attributes": { + "name": "attributes", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "order_key": { + "name": "order_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scim_user_connection_user_unique": { + "name": "scim_user_connection_user_unique", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_user_connection_user_name_unique": { + "name": "scim_user_connection_user_name_unique", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_user_connection_external_id_unique": { + "name": "scim_user_connection_external_id_unique", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "external_id is not null", + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_user_connection_order_idx": { + "name": "scim_user_connection_order_idx", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "order_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_user_user_idx": { + "name": "scim_user_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "scim_user_connection_id_scim_connection_id_fk": { + "name": "scim_user_connection_id_scim_connection_id_fk", + "tableFrom": "scim_user", + "tableTo": "scim_connection", + "columnsFrom": ["connection_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "scim_user_user_id_user_id_fk": { + "name": "scim_user_user_id_user_id_fk", + "tableFrom": "scim_user", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scim_user_tombstone": { + "name": "scim_user_tombstone", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "connection_id": { + "name": "connection_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scim_user_tombstone_connection_external_id_unique": { + "name": "scim_user_tombstone_connection_external_id_unique", + "columns": [ + { + "expression": "connection_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "external_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "scim_user_tombstone_connection_id_scim_connection_id_fk": { + "name": "scim_user_tombstone_connection_id_scim_connection_id_fk", + "tableFrom": "scim_user_tombstone", + "tableTo": "scim_connection", + "columnsFrom": ["connection_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "scim_user_tombstone_user_id_user_id_fk": { + "name": "scim_user_tombstone_user_id_user_id_fk", + "tableFrom": "scim_user_tombstone", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.secret_usage": { + "name": "secret_usage", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret_name": { + "name": "secret_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret_scope": { + "name": "secret_scope", + "type": "secret_usage_scope", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "secret_owner_user_id": { + "name": "secret_owner_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "source": { + "name": "source", + "type": "secret_usage_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "actor_user_id": { + "name": "actor_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "usage_date": { + "name": "usage_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "use_count": { + "name": "use_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "last_execution_id": { + "name": "last_execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_trigger": { + "name": "last_trigger", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "secret_usage_bucket_unique": { + "name": "secret_usage_bucket_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_scope", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "actor_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "usage_date", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "secret_usage_secret_recent_idx": { + "name": "secret_usage_secret_recent_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_scope", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "secret_owner_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_used_at", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "secret_usage_workspace_id_workspace_id_fk": { + "name": "secret_usage_workspace_id_workspace_id_fk", + "tableFrom": "secret_usage", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "active_organization_id": { + "name": "active_organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "impersonated_by": { + "name": "impersonated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "session_user_id_idx": { + "name": "session_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "session_active_organization_id_organization_id_fk": { + "name": "session_active_organization_id_organization_id_fk", + "tableFrom": "session", + "tableTo": "organization", + "columnsFrom": ["active_organization_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.settings": { + "name": "settings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "theme": { + "name": "theme", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'system'" + }, + "auto_connect": { + "name": "auto_connect", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "telemetry_enabled": { + "name": "telemetry_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "email_preferences": { + "name": "email_preferences", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "billing_usage_notifications_enabled": { + "name": "billing_usage_notifications_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "show_training_controls": { + "name": "show_training_controls", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "super_user_mode_enabled": { + "name": "super_user_mode_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "mothership_environment": { + "name": "mothership_environment", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'default'" + }, + "error_notifications_enabled": { + "name": "error_notifications_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "snap_to_grid_size": { + "name": "snap_to_grid_size", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "show_action_bar": { + "name": "show_action_bar", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "auto_focus_on_click": { + "name": "auto_focus_on_click", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "copilot_enabled_models": { + "name": "copilot_enabled_models", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "copilot_auto_allowed_tools": { + "name": "copilot_auto_allowed_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "last_active_workspace_id": { + "name": "last_active_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "settings_user_id_user_id_fk": { + "name": "settings_user_id_user_id_fk", + "tableFrom": "settings", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "settings_user_id_unique": { + "name": "settings_user_id_unique", + "nullsNotDistinct": false, + "columns": ["user_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sim_trigger_state": { + "name": "sim_trigger_state", + "schema": "", + "columns": { + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "block_id": { + "name": "block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope_key": { + "name": "scope_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "last_fired_at": { + "name": "last_fired_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "sim_trigger_state_workflow_id_workflow_id_fk": { + "name": "sim_trigger_state_workflow_id_workflow_id_fk", + "tableFrom": "sim_trigger_state", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "sim_trigger_state_workflow_id_block_id_scope_key_pk": { + "name": "sim_trigger_state_workflow_id_block_id_scope_key_pk", + "columns": ["workflow_id", "block_id", "scope_key"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.skill": { + "name": "skill", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "skill_workspace_name_unique": { + "name": "skill_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "skill_workspace_id_workspace_id_fk": { + "name": "skill_workspace_id_workspace_id_fk", + "tableFrom": "skill", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "skill_user_id_user_id_fk": { + "name": "skill_user_id_user_id_fk", + "tableFrom": "skill", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.skill_member": { + "name": "skill_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "skill_id": { + "name": "skill_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invited_by": { + "name": "invited_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "skill_member_user_id_idx": { + "name": "skill_member_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "skill_member_unique": { + "name": "skill_member_unique", + "columns": [ + { + "expression": "skill_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "skill_member_skill_id_skill_id_fk": { + "name": "skill_member_skill_id_skill_id_fk", + "tableFrom": "skill_member", + "tableTo": "skill", + "columnsFrom": ["skill_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "skill_member_user_id_user_id_fk": { + "name": "skill_member_user_id_user_id_fk", + "tableFrom": "skill_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "skill_member_invited_by_user_id_fk": { + "name": "skill_member_invited_by_user_id_fk", + "tableFrom": "skill_member", + "tableTo": "user", + "columnsFrom": ["invited_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sso_domain": { + "name": "sso_domain", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "verification_token": { + "name": "verification_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "verified_at": { + "name": "verified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "sso_domain_organization_id_idx": { + "name": "sso_domain_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_domain_domain_idx": { + "name": "sso_domain_domain_idx", + "columns": [ + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_domain_org_domain_unique": { + "name": "sso_domain_org_domain_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_domain_verified_unique": { + "name": "sso_domain_verified_unique", + "columns": [ + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "status = 'verified'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sso_domain_organization_id_organization_id_fk": { + "name": "sso_domain_organization_id_organization_id_fk", + "tableFrom": "sso_domain", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "sso_domain_created_by_user_id_fk": { + "name": "sso_domain_created_by_user_id_fk", + "tableFrom": "sso_domain", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sso_provider": { + "name": "sso_provider", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "issuer": { + "name": "issuer", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "oidc_config": { + "name": "oidc_config", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "saml_config": { + "name": "saml_config", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "domain_verified": { + "name": "domain_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "jit_provisioning_enabled": { + "name": "jit_provisioning_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": { + "sso_provider_provider_id_unique": { + "name": "sso_provider_provider_id_unique", + "columns": [ + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_provider_domain_idx": { + "name": "sso_provider_domain_idx", + "columns": [ + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_provider_user_id_idx": { + "name": "sso_provider_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sso_provider_organization_id_idx": { + "name": "sso_provider_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sso_provider_user_id_user_id_fk": { + "name": "sso_provider_user_id_user_id_fk", + "tableFrom": "sso_provider", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "sso_provider_organization_id_organization_id_fk": { + "name": "sso_provider_organization_id_organization_id_fk", + "tableFrom": "sso_provider", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.subscription": { + "name": "subscription", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "plan": { + "name": "plan", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reference_id": { + "name": "reference_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_subscription_id": { + "name": "stripe_subscription_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "period_start": { + "name": "period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "period_end": { + "name": "period_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "cancel_at_period_end": { + "name": "cancel_at_period_end", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "cancel_at": { + "name": "cancel_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "canceled_at": { + "name": "canceled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "seats": { + "name": "seats", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "trial_start": { + "name": "trial_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "trial_end": { + "name": "trial_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "billing_interval": { + "name": "billing_interval", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_schedule_id": { + "name": "stripe_schedule_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "last_closed_period_start": { + "name": "last_closed_period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "subscription_reference_status_idx": { + "name": "subscription_reference_status_idx", + "columns": [ + { + "expression": "reference_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "subscription_cycle_close_lagging_idx": { + "name": "subscription_cycle_close_lagging_idx", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"subscription\".\"status\" in ('active', 'past_due') and \"subscription\".\"period_start\" is not null and (\"subscription\".\"last_closed_period_start\" is null or \"subscription\".\"last_closed_period_start\" < \"subscription\".\"period_start\")", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "check_enterprise_metadata": { + "name": "check_enterprise_metadata", + "value": "plan != 'enterprise' OR metadata IS NOT NULL" + } + }, + "isRLSEnabled": false + }, + "public.table_jobs": { + "name": "table_jobs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'running'" + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "rows_processed": { + "name": "rows_processed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "table_jobs_one_active_per_table": { + "name": "table_jobs_one_active_per_table", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"table_jobs\".\"status\" = 'running' AND \"table_jobs\".\"type\" <> 'export'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_jobs_watchdog_idx": { + "name": "table_jobs_watchdog_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_jobs_table_started_idx": { + "name": "table_jobs_table_started_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_jobs_table_id_user_table_definitions_id_fk": { + "name": "table_jobs_table_id_user_table_definitions_id_fk", + "tableFrom": "table_jobs", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_jobs_workspace_id_workspace_id_fk": { + "name": "table_jobs_workspace_id_workspace_id_fk", + "tableFrom": "table_jobs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_row_executions": { + "name": "table_row_executions", + "schema": "", + "columns": { + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "row_id": { + "name": "row_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "group_id": { + "name": "group_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "job_id": { + "name": "job_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "running_block_ids": { + "name": "running_block_ids", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'::text[]" + }, + "block_errors": { + "name": "block_errors", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "cancelled_at": { + "name": "cancelled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "capability_governed_user_id": { + "name": "capability_governed_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enrichment_details": { + "name": "enrichment_details", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "table_row_executions_table_status_idx": { + "name": "table_row_executions_table_status_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"table_row_executions\".\"status\" IN ('queued', 'running', 'pending')", + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_row_executions_execution_id_idx": { + "name": "table_row_executions_execution_id_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"table_row_executions\".\"execution_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_row_executions_table_group_idx": { + "name": "table_row_executions_table_group_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_row_executions_table_id_user_table_definitions_id_fk": { + "name": "table_row_executions_table_id_user_table_definitions_id_fk", + "tableFrom": "table_row_executions", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_row_executions_row_id_user_table_rows_id_fk": { + "name": "table_row_executions_row_id_user_table_rows_id_fk", + "tableFrom": "table_row_executions", + "tableTo": "user_table_rows", + "columnsFrom": ["row_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_row_executions_capability_governed_user_id_user_id_fk": { + "name": "table_row_executions_capability_governed_user_id_user_id_fk", + "tableFrom": "table_row_executions", + "tableTo": "user", + "columnsFrom": ["capability_governed_user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "table_row_executions_row_id_group_id_pk": { + "name": "table_row_executions_row_id_group_id_pk", + "columns": ["row_id", "group_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_run_dispatches": { + "name": "table_run_dispatches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "request_id": { + "name": "request_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "mode": { + "name": "mode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "cursor": { + "name": "cursor", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "limit": { + "name": "limit", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "processed_count": { + "name": "processed_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "is_manual_run": { + "name": "is_manual_run", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "triggered_by_user_id": { + "name": "triggered_by_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "capability_governed_user_id": { + "name": "capability_governed_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "heartbeat_at": { + "name": "heartbeat_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "cancelled_at": { + "name": "cancelled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "table_run_dispatches_active_idx": { + "name": "table_run_dispatches_active_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_run_dispatches_watchdog_idx": { + "name": "table_run_dispatches_watchdog_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "requested_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_run_dispatches_governed_active_idx": { + "name": "table_run_dispatches_governed_active_idx", + "columns": [ + { + "expression": "capability_governed_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"table_run_dispatches\".\"status\" IN ('pending', 'dispatching')", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_run_dispatches_table_id_user_table_definitions_id_fk": { + "name": "table_run_dispatches_table_id_user_table_definitions_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_run_dispatches_workspace_id_workspace_id_fk": { + "name": "table_run_dispatches_workspace_id_workspace_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_run_dispatches_triggered_by_user_id_user_id_fk": { + "name": "table_run_dispatches_triggered_by_user_id_user_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "user", + "columnsFrom": ["triggered_by_user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "table_run_dispatches_capability_governed_user_id_user_id_fk": { + "name": "table_run_dispatches_capability_governed_user_id_user_id_fk", + "tableFrom": "table_run_dispatches", + "tableTo": "user", + "columnsFrom": ["capability_governed_user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.table_views": { + "name": "table_views", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "table_views_table_created_idx": { + "name": "table_views_table_created_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_views_workspace_created_idx": { + "name": "table_views_workspace_created_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "table_views_table_default_unique": { + "name": "table_views_table_default_unique", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "is_default = true", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "table_views_table_id_user_table_definitions_id_fk": { + "name": "table_views_table_id_user_table_definitions_id_fk", + "tableFrom": "table_views", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_views_workspace_id_workspace_id_fk": { + "name": "table_views_workspace_id_workspace_id_fk", + "tableFrom": "table_views", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "table_views_created_by_user_id_fk": { + "name": "table_views_created_by_user_id_fk", + "tableFrom": "table_views", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.upload_session": { + "name": "upload_session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "knowledge_base_id": { + "name": "knowledge_base_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "purpose": { + "name": "purpose", + "type": "upload_session_purpose", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "method": { + "name": "method", + "type": "upload_session_method", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "storage_context": { + "name": "storage_context", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "final_key": { + "name": "final_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "storage_provider": { + "name": "storage_provider", + "type": "upload_session_provider", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "provider_upload_id": { + "name": "provider_upload_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_object_version": { + "name": "provider_object_version", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_size": { + "name": "file_size", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "part_size": { + "name": "part_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "part_count": { + "name": "part_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "upload_session_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'uploading'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "processing_lease_id": { + "name": "processing_lease_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "processing_lease_expires_at": { + "name": "processing_lease_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "completed_file_id": { + "name": "completed_file_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "upload_session_token_hash_unique": { + "name": "upload_session_token_hash_unique", + "columns": [ + { + "expression": "token_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "upload_session_final_key_unique": { + "name": "upload_session_final_key_unique", + "columns": [ + { + "expression": "final_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "upload_session_status_expires_at_idx": { + "name": "upload_session_status_expires_at_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.usage_log": { + "name": "usage_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "category": { + "name": "category", + "type": "usage_log_category", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "usage_log_source", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "cost": { + "name": "cost", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "event_key": { + "name": "event_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "billing_entity_type": { + "name": "billing_entity_type", + "type": "billing_entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "billing_entity_id": { + "name": "billing_entity_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "billing_period_start": { + "name": "billing_period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "billing_period_end": { + "name": "billing_period_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "usage_log_user_created_at_idx": { + "name": "usage_log_user_created_at_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_source_idx": { + "name": "usage_log_source_idx", + "columns": [ + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_workspace_id_idx": { + "name": "usage_log_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_workflow_id_idx": { + "name": "usage_log_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_event_key_unique": { + "name": "usage_log_event_key_unique", + "columns": [ + { + "expression": "event_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"usage_log\".\"event_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_billing_entity_period_idx": { + "name": "usage_log_billing_entity_period_idx", + "columns": [ + { + "expression": "billing_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_start", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_end", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_billing_period_cost_idx": { + "name": "usage_log_billing_period_cost_idx", + "columns": [ + { + "expression": "billing_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_start", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_period_end", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "cost", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_billing_entity_created_at_cost_idx": { + "name": "usage_log_billing_entity_created_at_cost_idx", + "columns": [ + { + "expression": "billing_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "billing_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "cost", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"usage_log\".\"billing_entity_type\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_workspace_created_at_idx": { + "name": "usage_log_workspace_created_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "usage_log_execution_id_idx": { + "name": "usage_log_execution_id_idx", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "usage_log_user_id_user_id_fk": { + "name": "usage_log_user_id_user_id_fk", + "tableFrom": "usage_log", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "usage_log_workspace_id_workspace_id_fk": { + "name": "usage_log_workspace_id_workspace_id_fk", + "tableFrom": "usage_log", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "usage_log_workflow_id_workflow_id_fk": { + "name": "usage_log_workflow_id_workflow_id_fk", + "tableFrom": "usage_log", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "usage_log_billing_scope_all_or_none": { + "name": "usage_log_billing_scope_all_or_none", + "value": "(\n (\"usage_log\".\"billing_entity_type\" IS NULL AND \"usage_log\".\"billing_entity_id\" IS NULL AND \"usage_log\".\"billing_period_start\" IS NULL AND \"usage_log\".\"billing_period_end\" IS NULL)\n OR\n (\"usage_log\".\"billing_entity_type\" IS NOT NULL AND \"usage_log\".\"billing_entity_id\" IS NOT NULL AND \"usage_log\".\"billing_period_start\" IS NOT NULL AND \"usage_log\".\"billing_period_end\" IS NOT NULL AND \"usage_log\".\"billing_period_start\" < \"usage_log\".\"billing_period_end\")\n )" + } + }, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "normalized_email": { + "name": "normalized_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'user'" + }, + "banned": { + "name": "banned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ban_expires": { + "name": "ban_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "suspended_at": { + "name": "suspended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "suspension_source": { + "name": "suspension_source", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + }, + "user_normalized_email_unique": { + "name": "user_normalized_email_unique", + "nullsNotDistinct": false, + "columns": ["normalized_email"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_stats": { + "name": "user_stats", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "total_manual_executions": { + "name": "total_manual_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_api_calls": { + "name": "total_api_calls", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_webhook_triggers": { + "name": "total_webhook_triggers", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_scheduled_executions": { + "name": "total_scheduled_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_chat_executions": { + "name": "total_chat_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_mcp_executions": { + "name": "total_mcp_executions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_tokens_used": { + "name": "total_tokens_used", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_cost": { + "name": "total_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "current_usage_limit": { + "name": "current_usage_limit", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'5'" + }, + "usage_limit_updated_at": { + "name": "usage_limit_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "current_period_cost": { + "name": "current_period_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "last_period_cost": { + "name": "last_period_cost", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "billed_overage_this_period": { + "name": "billed_overage_this_period", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "pro_period_cost_snapshot": { + "name": "pro_period_cost_snapshot", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "pro_period_cost_snapshot_at": { + "name": "pro_period_cost_snapshot_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "credit_balance": { + "name": "credit_balance", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "total_copilot_cost": { + "name": "total_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "current_period_copilot_cost": { + "name": "current_period_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "last_period_copilot_cost": { + "name": "last_period_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "total_copilot_tokens": { + "name": "total_copilot_tokens", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_copilot_calls": { + "name": "total_copilot_calls", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_mcp_copilot_calls": { + "name": "total_mcp_copilot_calls", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "total_mcp_copilot_cost": { + "name": "total_mcp_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "current_period_mcp_copilot_cost": { + "name": "current_period_mcp_copilot_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "storage_used_bytes": { + "name": "storage_used_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_active": { + "name": "last_active", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "billing_blocked": { + "name": "billing_blocked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "billing_blocked_reason": { + "name": "billing_blocked_reason", + "type": "billing_blocked_reason", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "limit_notifications": { + "name": "limit_notifications", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": { + "user_stats_user_id_user_id_fk": { + "name": "user_stats_user_id_user_id_fk", + "tableFrom": "user_stats", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_stats_user_id_unique": { + "name": "user_stats_user_id_unique", + "nullsNotDistinct": false, + "columns": ["user_id"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_table_definitions": { + "name": "user_table_definitions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "max_rows": { + "name": "max_rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 10000 + }, + "row_count": { + "name": "row_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "rows_version": { + "name": "rows_version", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "schema_locked": { + "name": "schema_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "insert_locked": { + "name": "insert_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "update_locked": { + "name": "update_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "delete_locked": { + "name": "delete_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "user_table_def_workspace_id_idx": { + "name": "user_table_def_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_folder_id_idx": { + "name": "user_table_def_folder_id_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_workspace_name_unique": { + "name": "user_table_def_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"user_table_definitions\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_archived_at_idx": { + "name": "user_table_def_archived_at_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_def_workspace_archived_partial_idx": { + "name": "user_table_def_workspace_archived_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"user_table_definitions\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_table_definitions_workspace_id_workspace_id_fk": { + "name": "user_table_definitions_workspace_id_workspace_id_fk", + "tableFrom": "user_table_definitions", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_table_definitions_folder_id_folder_id_fk": { + "name": "user_table_definitions_folder_id_folder_id_fk", + "tableFrom": "user_table_definitions", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "user_table_definitions_created_by_user_id_fk": { + "name": "user_table_definitions_created_by_user_id_fk", + "tableFrom": "user_table_definitions", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_table_row_secret_provenance": { + "name": "user_table_row_secret_provenance", + "schema": "", + "columns": { + "row_id": { + "name": "row_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_updated_at": { + "name": "content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "user_table_row_secret_provenance_row_id_user_table_rows_id_fk": { + "name": "user_table_row_secret_provenance_row_id_user_table_rows_id_fk", + "tableFrom": "user_table_row_secret_provenance", + "tableTo": "user_table_rows", + "columnsFrom": ["row_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "user_table_row_secret_provenance_status_check": { + "name": "user_table_row_secret_provenance_status_check", + "value": "\"user_table_row_secret_provenance\".\"status\" IN ('exact', 'unknown')" + } + }, + "isRLSEnabled": false + }, + "public.user_table_rows": { + "name": "user_table_rows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "order_key": { + "name": "order_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_table_rows_tenant_data_gin_idx": { + "name": "user_table_rows_tenant_data_gin_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"data\" jsonb_path_ops", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "user_table_rows_workspace_table_idx": { + "name": "user_table_rows_workspace_table_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_position_idx": { + "name": "user_table_rows_table_position_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "position", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_order_key_idx": { + "name": "user_table_rows_table_order_key_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "order_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_created_id_idx": { + "name": "user_table_rows_table_created_id_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_table_rows_table_id_id_idx": { + "name": "user_table_rows_table_id_id_idx", + "columns": [ + { + "expression": "table_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_table_rows_table_id_user_table_definitions_id_fk": { + "name": "user_table_rows_table_id_user_table_definitions_id_fk", + "tableFrom": "user_table_rows", + "tableTo": "user_table_definitions", + "columnsFrom": ["table_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_table_rows_workspace_id_workspace_id_fk": { + "name": "user_table_rows_workspace_id_workspace_id_fk", + "tableFrom": "user_table_rows", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_table_rows_created_by_user_id_fk": { + "name": "user_table_rows_created_by_user_id_fk", + "tableFrom": "user_table_rows", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "verification_identifier_idx": { + "name": "verification_identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "verification_expires_at_idx": { + "name": "verification_expires_at_idx", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.waitlist": { + "name": "waitlist", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "waitlist_email_unique": { + "name": "waitlist_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.webhook": { + "name": "webhook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "registration_status": { + "name": "registration_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "registration_generation": { + "name": "registration_generation", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "config_fingerprint": { + "name": "config_fingerprint", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prepared_at": { + "name": "prepared_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "block_id": { + "name": "block_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "routing_key": { + "name": "routing_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_config": { + "name": "provider_config", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "failed_count": { + "name": "failed_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_failed_at": { + "name": "last_failed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "path_deployment_unique": { + "name": "path_deployment_unique", + "columns": [ + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"webhook\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_workflow_deployment_idx": { + "name": "webhook_workflow_deployment_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_routing_key_active_idx": { + "name": "webhook_routing_key_active_idx", + "columns": [ + { + "expression": "routing_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"webhook\".\"archived_at\" IS NULL AND \"webhook\".\"routing_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_archived_at_partial_idx": { + "name": "webhook_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"webhook\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_webhook_on_provider_is_active_workflow_id_deploym_bdeed5468": { + "name": "idx_webhook_on_provider_is_active_workflow_id_deploym_bdeed5468", + "columns": [ + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_active", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_webhook_on_workflow_id_block_id_updated_at_desc": { + "name": "idx_webhook_on_workflow_id_block_id_updated_at_desc", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "updated_at", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_active_registration_unique": { + "name": "webhook_active_registration_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"webhook\".\"registration_status\" = 'active' AND \"webhook\".\"block_id\" IS NOT NULL AND \"webhook\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_candidate_registration_unique": { + "name": "webhook_candidate_registration_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"webhook\".\"registration_status\" = 'candidate' AND \"webhook\".\"block_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhook_registration_status_generation_idx": { + "name": "webhook_registration_status_generation_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "registration_status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "registration_generation", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "webhook_workflow_id_workflow_id_fk": { + "name": "webhook_workflow_id_workflow_id_fk", + "tableFrom": "webhook", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "webhook_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "webhook_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "webhook", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "webhook_registration_status_check": { + "name": "webhook_registration_status_check", + "value": "\"webhook\".\"registration_status\" IS NULL OR \"webhook\".\"registration_status\" IN ('active', 'candidate', 'retired', 'orphaned')" + }, + "webhook_registration_generation_check": { + "name": "webhook_registration_generation_check", + "value": "\"webhook\".\"registration_generation\" IS NULL OR \"webhook\".\"registration_generation\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.webhook_path_claim": { + "name": "webhook_path_claim", + "schema": "", + "columns": { + "path": { + "name": "path", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "generation": { + "name": "generation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "webhook_path_claim_workflow_idx": { + "name": "webhook_path_claim_workflow_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "webhook_path_claim_workflow_id_workflow_id_fk": { + "name": "webhook_path_claim_workflow_id_workflow_id_fk", + "tableFrom": "webhook_path_claim", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "webhook_path_claim_generation_check": { + "name": "webhook_path_claim_generation_check", + "value": "\"webhook_path_claim\".\"generation\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.workflow": { + "name": "workflow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_synced": { + "name": "last_synced", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "is_deployed": { + "name": "is_deployed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deployed_at": { + "name": "deployed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "is_public_api": { + "name": "is_public_api", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "locked": { + "name": "locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "fork_sync_excluded": { + "name": "fork_sync_excluded", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "run_count": { + "name": "run_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_run_at": { + "name": "last_run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "variables": { + "name": "variables", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workflow_user_id_idx": { + "name": "workflow_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_workspace_id_idx": { + "name": "workflow_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_user_workspace_idx": { + "name": "workflow_user_workspace_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_workspace_folder_name_active_unique": { + "name": "workflow_workspace_folder_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"folder_id\", '')", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_folder_sort_idx": { + "name": "workflow_folder_sort_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_active_workspace_sort_idx": { + "name": "workflow_active_workspace_sort_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_archived_at_idx": { + "name": "workflow_archived_at_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_workspace_archived_partial_idx": { + "name": "workflow_workspace_archived_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_user_id_user_id_fk": { + "name": "workflow_user_id_user_id_fk", + "tableFrom": "workflow", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_workspace_id_workspace_id_fk": { + "name": "workflow_workspace_id_workspace_id_fk", + "tableFrom": "workflow", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_folder_id_folder_id_fk": { + "name": "workflow_folder_id_folder_id_fk", + "tableFrom": "workflow", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_blocks": { + "name": "workflow_blocks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "position_x": { + "name": "position_x", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "position_y": { + "name": "position_y", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "horizontal_handles": { + "name": "horizontal_handles", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "is_wide": { + "name": "is_wide", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "advanced_mode": { + "name": "advanced_mode", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "trigger_mode": { + "name": "trigger_mode", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "error_enabled": { + "name": "error_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "retry": { + "name": "retry", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "locked": { + "name": "locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "height": { + "name": "height", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "sub_blocks": { + "name": "sub_blocks", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "outputs": { + "name": "outputs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_blocks_workflow_id_idx": { + "name": "workflow_blocks_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_blocks_type_idx": { + "name": "workflow_blocks_type_idx", + "columns": [ + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_blocks_workflow_id_workflow_id_fk": { + "name": "workflow_blocks_workflow_id_workflow_id_fk", + "tableFrom": "workflow_blocks", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_checkpoints": { + "name": "workflow_checkpoints", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_state": { + "name": "workflow_state", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_checkpoints_user_id_idx": { + "name": "workflow_checkpoints_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_workflow_id_idx": { + "name": "workflow_checkpoints_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_chat_id_idx": { + "name": "workflow_checkpoints_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_message_id_idx": { + "name": "workflow_checkpoints_message_id_idx", + "columns": [ + { + "expression": "message_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_user_workflow_idx": { + "name": "workflow_checkpoints_user_workflow_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_workflow_chat_idx": { + "name": "workflow_checkpoints_workflow_chat_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_created_at_idx": { + "name": "workflow_checkpoints_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_checkpoints_chat_created_at_idx": { + "name": "workflow_checkpoints_chat_created_at_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_checkpoints_user_id_user_id_fk": { + "name": "workflow_checkpoints_user_id_user_id_fk", + "tableFrom": "workflow_checkpoints", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_checkpoints_workflow_id_workflow_id_fk": { + "name": "workflow_checkpoints_workflow_id_workflow_id_fk", + "tableFrom": "workflow_checkpoints", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_checkpoints_chat_id_copilot_chats_id_fk": { + "name": "workflow_checkpoints_chat_id_copilot_chats_id_fk", + "tableFrom": "workflow_checkpoints", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_deployment_operation": { + "name": "workflow_deployment_operation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "previous_active_version_id": { + "name": "previous_active_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "protocol_version": { + "name": "protocol_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "generation": { + "name": "generation", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'preparing'" + }, + "component_readiness": { + "name": "component_readiness", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "error_code": { + "name": "error_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "idempotency_key": { + "name": "idempotency_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "request_hash": { + "name": "request_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_deployment_operation_workflow_generation_unique": { + "name": "workflow_deployment_operation_workflow_generation_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "generation", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_idempotency_unique": { + "name": "workflow_deployment_operation_workflow_idempotency_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "idempotency_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_deployment_operation\".\"idempotency_key\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_in_flight_unique": { + "name": "workflow_deployment_operation_workflow_in_flight_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_deployment_operation\".\"status\" IN ('preparing', 'activating')", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_status_idx": { + "name": "workflow_deployment_operation_workflow_status_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_deployment_version_idx": { + "name": "workflow_deployment_operation_deployment_version_idx", + "columns": [ + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_operation_workflow_version_generation_idx": { + "name": "workflow_deployment_operation_workflow_version_generation_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "generation", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_deployment_operation_workflow_id_workflow_id_fk": { + "name": "workflow_deployment_operation_workflow_id_workflow_id_fk", + "tableFrom": "workflow_deployment_operation", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_deployment_operation_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_deployment_operation_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_deployment_operation", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_deployment_operation_previous_active_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_deployment_operation_previous_active_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_deployment_operation", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["previous_active_version_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "workflow_deployment_operation_action_check": { + "name": "workflow_deployment_operation_action_check", + "value": "\"workflow_deployment_operation\".\"action\" IN ('deploy', 'activate')" + }, + "workflow_deployment_operation_status_check": { + "name": "workflow_deployment_operation_status_check", + "value": "\"workflow_deployment_operation\".\"status\" IN ('preparing', 'activating', 'active', 'failed', 'superseded')" + }, + "workflow_deployment_operation_generation_check": { + "name": "workflow_deployment_operation_generation_check", + "value": "\"workflow_deployment_operation\".\"generation\" > 0" + }, + "workflow_deployment_operation_protocol_version_check": { + "name": "workflow_deployment_operation_protocol_version_check", + "value": "\"workflow_deployment_operation\".\"protocol_version\" > 0" + } + }, + "isRLSEnabled": false + }, + "public.workflow_deployment_version": { + "name": "workflow_deployment_version", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workflow_deployment_version_workflow_version_unique": { + "name": "workflow_deployment_version_workflow_version_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "version", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_version_workflow_active_idx": { + "name": "workflow_deployment_version_workflow_active_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_active", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_deployment_version_created_at_idx": { + "name": "workflow_deployment_version_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_deployment_version_workflow_id_workflow_id_fk": { + "name": "workflow_deployment_version_workflow_id_workflow_id_fk", + "tableFrom": "workflow_deployment_version", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_edges": { + "name": "workflow_edges", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_block_id": { + "name": "source_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_block_id": { + "name": "target_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_handle": { + "name": "source_handle", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "target_handle": { + "name": "target_handle", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_edges_workflow_id_idx": { + "name": "workflow_edges_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_edges_workflow_source_idx": { + "name": "workflow_edges_workflow_source_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_edges_workflow_target_idx": { + "name": "workflow_edges_workflow_target_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_edges_workflow_id_workflow_id_fk": { + "name": "workflow_edges_workflow_id_workflow_id_fk", + "tableFrom": "workflow_edges", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_edges_source_block_id_workflow_blocks_id_fk": { + "name": "workflow_edges_source_block_id_workflow_blocks_id_fk", + "tableFrom": "workflow_edges", + "tableTo": "workflow_blocks", + "columnsFrom": ["source_block_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_edges_target_block_id_workflow_blocks_id_fk": { + "name": "workflow_edges_target_block_id_workflow_blocks_id_fk", + "tableFrom": "workflow_edges", + "tableTo": "workflow_blocks", + "columnsFrom": ["target_block_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_execution_logs": { + "name": "workflow_execution_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state_snapshot_id": { + "name": "state_snapshot_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "level": { + "name": "level", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'running'" + }, + "trigger": { + "name": "trigger", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "execution_deadline_at": { + "name": "execution_deadline_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "total_duration_ms": { + "name": "total_duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "execution_data": { + "name": "execution_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "cost": { + "name": "cost", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "cost_total": { + "name": "cost_total", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "models_used": { + "name": "models_used", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "files": { + "name": "files", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_execution_logs_workflow_id_idx": { + "name": "workflow_execution_logs_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_state_snapshot_id_idx": { + "name": "workflow_execution_logs_state_snapshot_id_idx", + "columns": [ + { + "expression": "state_snapshot_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_deployment_version_id_idx": { + "name": "workflow_execution_logs_deployment_version_id_idx", + "columns": [ + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_trigger_idx": { + "name": "workflow_execution_logs_trigger_idx", + "columns": [ + { + "expression": "trigger", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_level_idx": { + "name": "workflow_execution_logs_level_idx", + "columns": [ + { + "expression": "level", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_started_at_idx": { + "name": "workflow_execution_logs_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_execution_id_unique": { + "name": "workflow_execution_logs_execution_id_unique", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workflow_started_at_idx": { + "name": "workflow_execution_logs_workflow_started_at_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workspace_started_at_idx": { + "name": "workflow_execution_logs_workspace_started_at_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workspace_started_at_id_desc_idx": { + "name": "workflow_execution_logs_workspace_started_at_id_desc_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "\"started_at\" DESC NULLS LAST", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "\"id\" DESC", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_workspace_cost_total_idx": { + "name": "workflow_execution_logs_workspace_cost_total_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "cost_total", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_models_used_idx": { + "name": "workflow_execution_logs_models_used_idx", + "columns": [ + { + "expression": "models_used", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "workflow_execution_logs_workspace_ended_at_id_idx": { + "name": "workflow_execution_logs_workspace_ended_at_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "date_trunc('milliseconds', \"ended_at\")", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_running_started_at_idx": { + "name": "workflow_execution_logs_running_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "status = 'running'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_running_deadline_idx": { + "name": "workflow_execution_logs_running_deadline_idx", + "columns": [ + { + "expression": "execution_deadline_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_execution_logs\".\"status\" = 'running' AND \"workflow_execution_logs\".\"execution_deadline_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_redacting_started_at_idx": { + "name": "workflow_execution_logs_redacting_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "status = 'redacting'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_redacting_deadline_idx": { + "name": "workflow_execution_logs_redacting_deadline_idx", + "columns": [ + { + "expression": "execution_deadline_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_execution_logs\".\"status\" = 'redacting' AND \"workflow_execution_logs\".\"execution_deadline_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_execution_logs_completed_ended_at_idx": { + "name": "workflow_execution_logs_completed_ended_at_idx", + "columns": [ + { + "expression": "ended_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_execution_logs\".\"status\" = 'completed' AND \"workflow_execution_logs\".\"level\" = 'info' AND \"workflow_execution_logs\".\"ended_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_execution_logs_workflow_id_workflow_id_fk": { + "name": "workflow_execution_logs_workflow_id_workflow_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workflow_execution_logs_workspace_id_workspace_id_fk": { + "name": "workflow_execution_logs_workspace_id_workspace_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_execution_logs_state_snapshot_id_workflow_execution_snapshots_id_fk": { + "name": "workflow_execution_logs_state_snapshot_id_workflow_execution_snapshots_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workflow_execution_snapshots", + "columnsFrom": ["state_snapshot_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workflow_execution_logs_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_execution_logs_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_execution_snapshots": { + "name": "workflow_execution_snapshots", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state_hash": { + "name": "state_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state_data": { + "name": "state_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_snapshots_workflow_id_idx": { + "name": "workflow_snapshots_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_snapshots_hash_idx": { + "name": "workflow_snapshots_hash_idx", + "columns": [ + { + "expression": "state_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_snapshots_workflow_hash_idx": { + "name": "workflow_snapshots_workflow_hash_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "state_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_snapshots_created_at_idx": { + "name": "workflow_snapshots_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_execution_snapshots_workflow_id_workflow_id_fk": { + "name": "workflow_execution_snapshots_workflow_id_workflow_id_fk", + "tableFrom": "workflow_execution_snapshots", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_mcp_server": { + "name": "workflow_mcp_server", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_mcp_server_workspace_id_idx": { + "name": "workflow_mcp_server_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_server_created_by_idx": { + "name": "workflow_mcp_server_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_server_deleted_at_idx": { + "name": "workflow_mcp_server_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_server_workspace_deleted_partial_idx": { + "name": "workflow_mcp_server_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_mcp_server\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_mcp_server_workspace_id_workspace_id_fk": { + "name": "workflow_mcp_server_workspace_id_workspace_id_fk", + "tableFrom": "workflow_mcp_server", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_mcp_server_created_by_user_id_fk": { + "name": "workflow_mcp_server_created_by_user_id_fk", + "tableFrom": "workflow_mcp_server", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_mcp_tool": { + "name": "workflow_mcp_tool", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tool_name": { + "name": "tool_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tool_description": { + "name": "tool_description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parameter_schema": { + "name": "parameter_schema", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "parameter_description_overrides": { + "name": "parameter_description_overrides", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'::json" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_mcp_tool_server_id_idx": { + "name": "workflow_mcp_tool_server_id_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_tool_workflow_id_idx": { + "name": "workflow_mcp_tool_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_tool_server_workflow_unique": { + "name": "workflow_mcp_tool_server_workflow_unique", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_mcp_tool\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_mcp_tool_archived_at_partial_idx": { + "name": "workflow_mcp_tool_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_mcp_tool\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_mcp_tool_server_id_workflow_mcp_server_id_fk": { + "name": "workflow_mcp_tool_server_id_workflow_mcp_server_id_fk", + "tableFrom": "workflow_mcp_tool", + "tableTo": "workflow_mcp_server", + "columnsFrom": ["server_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_mcp_tool_workflow_id_workflow_id_fk": { + "name": "workflow_mcp_tool_workflow_id_workflow_id_fk", + "tableFrom": "workflow_mcp_tool", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_schedule": { + "name": "workflow_schedule", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deployment_operation_id": { + "name": "deployment_operation_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "block_id": { + "name": "block_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cron_expression": { + "name": "cron_expression", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "next_run_at": { + "name": "next_run_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_ran_at": { + "name": "last_ran_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_queued_at": { + "name": "last_queued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "trigger_type": { + "name": "trigger_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'UTC'" + }, + "failed_count": { + "name": "failed_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "infra_retry_count": { + "name": "infra_retry_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "last_failed_at": { + "name": "last_failed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "source_type": { + "name": "source_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'workflow'" + }, + "job_title": { + "name": "job_title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prompt": { + "name": "prompt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lifecycle": { + "name": "lifecycle", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'persistent'" + }, + "success_condition": { + "name": "success_condition", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "max_runs": { + "name": "max_runs", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "run_count": { + "name": "run_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "source_chat_id": { + "name": "source_chat_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_task_name": { + "name": "source_task_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_user_id": { + "name": "source_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source_workspace_id": { + "name": "source_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_scope": { + "name": "secret_scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "mounted_secrets": { + "name": "mounted_secrets", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "job_history": { + "name": "job_history", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "contexts": { + "name": "contexts", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "excluded_dates": { + "name": "excluded_dates", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "ends_at": { + "name": "ends_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_schedule_workflow_block_deployment_unique": { + "name": "workflow_schedule_workflow_block_deployment_unique", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflow_schedule\".\"archived_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_workflow_deployment_idx": { + "name": "workflow_schedule_workflow_deployment_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_archived_at_partial_idx": { + "name": "workflow_schedule_archived_at_partial_idx", + "columns": [ + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_schedule\".\"archived_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_schedule_on_source_workspace_id_source_t_c07f3bba6": { + "name": "idx_workflow_schedule_on_source_workspace_id_source_t_c07f3bba6", + "columns": [ + { + "expression": "source_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "archived_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_due_workflow_idx": { + "name": "workflow_schedule_due_workflow_idx", + "columns": [ + { + "expression": "next_run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_queued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_schedule\".\"archived_at\" IS NULL AND \"workflow_schedule\".\"status\" NOT IN ('disabled', 'completed') AND (\"workflow_schedule\".\"source_type\" = 'workflow' OR \"workflow_schedule\".\"source_type\" IS NULL)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_schedule_due_job_idx": { + "name": "workflow_schedule_due_job_idx", + "columns": [ + { + "expression": "next_run_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "last_queued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_schedule\".\"archived_at\" IS NULL AND \"workflow_schedule\".\"status\" NOT IN ('disabled', 'completed') AND \"workflow_schedule\".\"source_type\" = 'job'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_schedule_workflow_id_workflow_id_fk": { + "name": "workflow_schedule_workflow_id_workflow_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_schedule_deployment_version_id_workflow_deployment_version_id_fk": { + "name": "workflow_schedule_deployment_version_id_workflow_deployment_version_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workflow_deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_schedule_deployment_operation_id_workflow_deployment_operation_id_fk": { + "name": "workflow_schedule_deployment_operation_id_workflow_deployment_operation_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workflow_deployment_operation", + "columnsFrom": ["deployment_operation_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workflow_schedule_source_user_id_user_id_fk": { + "name": "workflow_schedule_source_user_id_user_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "user", + "columnsFrom": ["source_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_schedule_source_workspace_id_workspace_id_fk": { + "name": "workflow_schedule_source_workspace_id_workspace_id_fk", + "tableFrom": "workflow_schedule", + "tableTo": "workspace", + "columnsFrom": ["source_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_subflows": { + "name": "workflow_subflows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workflow_subflows_workflow_id_idx": { + "name": "workflow_subflows_workflow_id_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workflow_subflows_workflow_type_idx": { + "name": "workflow_subflows_workflow_type_idx", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_subflows_workflow_id_workflow_id_fk": { + "name": "workflow_subflows_workflow_id_workflow_id_fk", + "tableFrom": "workflow_subflows", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace": { + "name": "workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'#33C482'" + }, + "logo_url": { + "name": "logo_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_mode": { + "name": "workspace_mode", + "type": "workspace_mode", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'grandfathered_shared'" + }, + "billed_account_user_id": { + "name": "billed_account_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "storage_used_bytes": { + "name": "storage_used_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "allow_personal_api_keys": { + "name": "allow_personal_api_keys", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "inbox_enabled": { + "name": "inbox_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "inbox_address": { + "name": "inbox_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inbox_provider_id": { + "name": "inbox_provider_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "inbox_secret_scope": { + "name": "inbox_secret_scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "inbox_mounted_secrets": { + "name": "inbox_mounted_secrets", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "organization_assigned_at": { + "name": "organization_assigned_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "forked_from_workspace_id": { + "name": "forked_from_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_owner_id_idx": { + "name": "workspace_owner_id_idx", + "columns": [ + { + "expression": "owner_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_organization_id_idx": { + "name": "workspace_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_mode_idx": { + "name": "workspace_mode_idx", + "columns": [ + { + "expression": "workspace_mode", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_forked_from_workspace_id_idx": { + "name": "workspace_forked_from_workspace_id_idx", + "columns": [ + { + "expression": "forked_from_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_inbox_provider_id_idx": { + "name": "workspace_inbox_provider_id_idx", + "columns": [ + { + "expression": "inbox_provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace\".\"inbox_provider_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_owner_id_user_id_fk": { + "name": "workspace_owner_id_user_id_fk", + "tableFrom": "workspace", + "tableTo": "user", + "columnsFrom": ["owner_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_organization_id_organization_id_fk": { + "name": "workspace_organization_id_organization_id_fk", + "tableFrom": "workspace", + "tableTo": "organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_billed_account_user_id_user_id_fk": { + "name": "workspace_billed_account_user_id_user_id_fk", + "tableFrom": "workspace", + "tableTo": "user", + "columnsFrom": ["billed_account_user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workspace_forked_from_workspace_id_workspace_id_fk": { + "name": "workspace_forked_from_workspace_id_workspace_id_fk", + "tableFrom": "workspace", + "tableTo": "workspace", + "columnsFrom": ["forked_from_workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "workspace_storage_used_bytes_non_negative": { + "name": "workspace_storage_used_bytes_non_negative", + "value": "\"workspace\".\"storage_used_bytes\" >= 0" + } + }, + "isRLSEnabled": false + }, + "public.workspace_byok_keys": { + "name": "workspace_byok_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_byok_workspace_provider_idx": { + "name": "workspace_byok_workspace_provider_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_byok_keys_workspace_id_workspace_id_fk": { + "name": "workspace_byok_keys_workspace_id_workspace_id_fk", + "tableFrom": "workspace_byok_keys", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_byok_keys_created_by_user_id_fk": { + "name": "workspace_byok_keys_created_by_user_id_fk", + "tableFrom": "workspace_byok_keys", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_environment": { + "name": "workspace_environment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "variables": { + "name": "variables", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_environment_workspace_unique": { + "name": "workspace_environment_workspace_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_environment_workspace_id_workspace_id_fk": { + "name": "workspace_environment_workspace_id_workspace_id_fk", + "tableFrom": "workspace_environment", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file": { + "name": "workspace_file", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_file_workspace_id_idx": { + "name": "workspace_file_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_deleted_at_idx": { + "name": "workspace_file_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_workspace_deleted_partial_idx": { + "name": "workspace_file_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_file\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_workspace_id_workspace_id_fk": { + "name": "workspace_file_workspace_id_workspace_id_fk", + "tableFrom": "workspace_file", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_file_uploaded_by_user_id_fk": { + "name": "workspace_file_uploaded_by_user_id_fk", + "tableFrom": "workspace_file", + "tableTo": "user", + "columnsFrom": ["uploaded_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_file_key_unique": { + "name": "workspace_file_key_unique", + "nullsNotDistinct": false, + "columns": ["key"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_collab_state": { + "name": "workspace_file_collab_state", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "doc_state": { + "name": "doc_state", + "type": "bytea", + "primaryKey": false, + "notNull": true + }, + "source_hash": { + "name": "source_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_file_collab_state_file_id_workspace_files_id_fk": { + "name": "workspace_file_collab_state_file_id_workspace_files_id_fk", + "tableFrom": "workspace_file_collab_state", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_backfill": { + "name": "workspace_file_search_backfill", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "after_workspace_id": { + "name": "after_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "after_file_id": { + "name": "after_file_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_dispatch_queue": { + "name": "workspace_file_search_dispatch_queue", + "schema": "", + "columns": { + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "enqueued_at": { + "name": "enqueued_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_dispatched_at": { + "name": "last_dispatched_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_file_search_dispatch_queue_schedule_idx": { + "name": "workspace_file_search_dispatch_queue_schedule_idx", + "columns": [ + { + "expression": "last_dispatched_at", + "isExpression": false, + "asc": true, + "nulls": "first" + }, + { + "expression": "enqueued_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_search_queue_workspace_fk": { + "name": "workspace_file_search_queue_workspace_fk", + "tableFrom": "workspace_file_search_dispatch_queue", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_index": { + "name": "workspace_file_search_index", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_content_updated_at": { + "name": "source_content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "workspace_file_search_index_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "partial": { + "name": "partial", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "failure_reason": { + "name": "failure_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "line_count": { + "name": "line_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "indexed_bytes": { + "name": "indexed_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "dispatched_at": { + "name": "dispatched_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_file_search_index_workspace_status_idx": { + "name": "workspace_file_search_index_workspace_status_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_content_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_search_index_pending_dispatch_idx": { + "name": "workspace_file_search_index_pending_dispatch_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "file_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_content_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_file_search_index\".\"status\" = 'pending' AND \"workspace_file_search_index\".\"dispatched_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_search_index_active_dispatch_idx": { + "name": "workspace_file_search_index_active_dispatch_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "dispatched_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_file_search_index\".\"status\" = 'pending' AND \"workspace_file_search_index\".\"dispatched_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_search_index_file_fk": { + "name": "workspace_file_search_index_file_fk", + "tableFrom": "workspace_file_search_index", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_file_search_index_workspace_fk": { + "name": "workspace_file_search_index_workspace_fk", + "tableFrom": "workspace_file_search_index", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "workspace_file_search_index_pk": { + "name": "workspace_file_search_index_pk", + "columns": ["file_id", "source_content_updated_at"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_search_segment": { + "name": "workspace_file_search_segment", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_content_updated_at": { + "name": "source_content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "line_number": { + "name": "line_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "segment_number": { + "name": "segment_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "segment_start": { + "name": "segment_start", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "line_length": { + "name": "line_length", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "workspace_file_search_segment_workspace_revision_idx": { + "name": "workspace_file_search_segment_workspace_revision_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "file_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_content_updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_file_search_segment_workspace_content_trgm_idx": { + "name": "workspace_file_search_segment_workspace_content_trgm_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "text_ops" + }, + { + "expression": "content", + "isExpression": false, + "asc": true, + "nulls": "last", + "opclass": "gin_trgm_ops" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": { + "workspace_file_search_segment_file_fk": { + "name": "workspace_file_search_segment_file_fk", + "tableFrom": "workspace_file_search_segment", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_file_search_segment_workspace_fk": { + "name": "workspace_file_search_segment_workspace_fk", + "tableFrom": "workspace_file_search_segment", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "workspace_file_search_segment_pk": { + "name": "workspace_file_search_segment_pk", + "columns": ["file_id", "source_content_updated_at", "line_number", "segment_number"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_file_secret_provenance": { + "name": "workspace_file_secret_provenance", + "schema": "", + "columns": { + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content_updated_at": { + "name": "content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entries": { + "name": "entries", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_file_secret_provenance_file_id_workspace_files_id_fk": { + "name": "workspace_file_secret_provenance_file_id_workspace_files_id_fk", + "tableFrom": "workspace_file_secret_provenance", + "tableTo": "workspace_files", + "columnsFrom": ["file_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "workspace_file_secret_provenance_status_check": { + "name": "workspace_file_secret_provenance_status_check", + "value": "\"workspace_file_secret_provenance\".\"status\" IN ('exact', 'unknown', 'unrecorded')" + } + }, + "isRLSEnabled": false + }, + "public.workspace_files": { + "name": "workspace_files", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "context": { + "name": "context", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chat_id": { + "name": "chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "original_name": { + "name": "original_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "size_bytes": { + "name": "size_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "uploaded_at": { + "name": "uploaded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "content_updated_at": { + "name": "content_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "secret_provenance_version": { + "name": "secret_provenance_version", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workspace_files_key_active_unique": { + "name": "workspace_files_key_active_unique", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace_files\".\"deleted_at\" IS NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_workspace_folder_name_active_unique": { + "name": "workspace_files_workspace_folder_name_active_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"folder_id\", '')", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "original_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace_files\".\"deleted_at\" IS NULL AND \"workspace_files\".\"context\" = 'workspace' AND \"workspace_files\".\"workspace_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_chat_display_name_unique": { + "name": "workspace_files_chat_display_name_unique", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "display_name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workspace_files\".\"context\" = 'mothership' AND \"workspace_files\".\"chat_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_key_idx": { + "name": "workspace_files_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_user_id_idx": { + "name": "workspace_files_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_workspace_id_idx": { + "name": "workspace_files_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_folder_id_idx": { + "name": "workspace_files_folder_id_idx", + "columns": [ + { + "expression": "folder_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_context_idx": { + "name": "workspace_files_context_idx", + "columns": [ + { + "expression": "context", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_chat_id_idx": { + "name": "workspace_files_chat_id_idx", + "columns": [ + { + "expression": "chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_deleted_at_idx": { + "name": "workspace_files_deleted_at_idx", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_files_workspace_deleted_partial_idx": { + "name": "workspace_files_workspace_deleted_partial_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workspace_files\".\"deleted_at\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_files_user_id_user_id_fk": { + "name": "workspace_files_user_id_user_id_fk", + "tableFrom": "workspace_files", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_files_workspace_id_workspace_id_fk": { + "name": "workspace_files_workspace_id_workspace_id_fk", + "tableFrom": "workspace_files", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_files_folder_id_folder_id_fk": { + "name": "workspace_files_folder_id_folder_id_fk", + "tableFrom": "workspace_files", + "tableTo": "folder", + "columnsFrom": ["folder_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_files_chat_id_copilot_chats_id_fk": { + "name": "workspace_files_chat_id_copilot_chats_id_fk", + "tableFrom": "workspace_files", + "tableTo": "copilot_chats", + "columnsFrom": ["chat_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_block_map": { + "name": "workspace_fork_block_map", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_workflow_id": { + "name": "parent_workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_block_id": { + "name": "parent_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_workflow_id": { + "name": "child_workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_block_id": { + "name": "child_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_block_map_child_ws_parent_unique": { + "name": "workspace_fork_block_map_child_ws_parent_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_block_map_child_ws_child_unique": { + "name": "workspace_fork_block_map_child_ws_child_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "child_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_block_map_child_ws_parent_wf_idx": { + "name": "workspace_fork_block_map_child_ws_parent_wf_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_block_map_child_ws_child_wf_idx": { + "name": "workspace_fork_block_map_child_ws_child_wf_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "child_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_block_map_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_block_map_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_block_map", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_dependent_value": { + "name": "workspace_fork_dependent_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_workflow_id": { + "name": "target_workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_block_id": { + "name": "target_block_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sub_block_key": { + "name": "sub_block_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_dependent_value_child_ws_wf_idx": { + "name": "workspace_fork_dependent_value_child_ws_wf_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_dependent_value_field_unique": { + "name": "workspace_fork_dependent_value_field_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_block_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sub_block_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_dependent_value_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_dependent_value_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_dependent_value", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_promote_run": { + "name": "workspace_fork_promote_run", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_workspace_id": { + "name": "source_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_workspace_id": { + "name": "target_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "direction": { + "name": "direction", + "type": "workspace_fork_promote_direction", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "snapshot": { + "name": "snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_promote_run_child_ws_target_unique": { + "name": "workspace_fork_promote_run_child_ws_target_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_promote_run_target_ws_idx": { + "name": "workspace_fork_promote_run_target_ws_idx", + "columns": [ + { + "expression": "target_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_promote_run_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_promote_run_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_promote_run", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_fork_promote_run_created_by_user_id_fk": { + "name": "workspace_fork_promote_run_created_by_user_id_fk", + "tableFrom": "workspace_fork_promote_run", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_fork_resource_map": { + "name": "workspace_fork_resource_map", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "child_workspace_id": { + "name": "child_workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "workspace_fork_resource_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "parent_resource_id": { + "name": "parent_resource_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "child_resource_id": { + "name": "child_resource_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_fork_resource_map_child_ws_idx": { + "name": "workspace_fork_resource_map_child_ws_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_resource_map_child_ws_type_idx": { + "name": "workspace_fork_resource_map_child_ws_type_idx", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_fork_resource_map_child_type_parent_unique": { + "name": "workspace_fork_resource_map_child_type_parent_unique", + "columns": [ + { + "expression": "child_workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "parent_resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_fork_resource_map_child_workspace_id_workspace_id_fk": { + "name": "workspace_fork_resource_map_child_workspace_id_workspace_id_fk", + "tableFrom": "workspace_fork_resource_map", + "tableTo": "workspace", + "columnsFrom": ["child_workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_fork_resource_map_created_by_user_id_fk": { + "name": "workspace_fork_resource_map_created_by_user_id_fk", + "tableFrom": "workspace_fork_resource_map", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_sandbox": { + "name": "workspace_sandbox", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "language": { + "name": "language", + "type": "sandbox_language", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "dependencies": { + "name": "dependencies", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "cli_tools": { + "name": "cli_tools", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "system_packages": { + "name": "system_packages", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "spec_hash": { + "name": "spec_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_sandbox_workspace_name_unique": { + "name": "workspace_sandbox_workspace_name_unique", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_sandbox_workspace_idx": { + "name": "workspace_sandbox_workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "workspace_sandbox_spec_hash_idx": { + "name": "workspace_sandbox_spec_hash_idx", + "columns": [ + { + "expression": "spec_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_sandbox_workspace_id_workspace_id_fk": { + "name": "workspace_sandbox_workspace_id_workspace_id_fk", + "tableFrom": "workspace_sandbox", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_sandbox_created_by_user_id_fk": { + "name": "workspace_sandbox_created_by_user_id_fk", + "tableFrom": "workspace_sandbox", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.academy_cert_status": { + "name": "academy_cert_status", + "schema": "public", + "values": ["active", "revoked", "expired"] + }, + "public.background_work_kind": { + "name": "background_work_kind", + "schema": "public", + "values": ["deployment_side_effects", "fork_content_copy", "fork_sync", "fork_rollback"] + }, + "public.background_work_status_value": { + "name": "background_work_status_value", + "schema": "public", + "values": ["pending", "processing", "completed", "completed_with_warnings", "failed"] + }, + "public.billing_blocked_reason": { + "name": "billing_blocked_reason", + "schema": "public", + "values": ["payment_failed", "dispute"] + }, + "public.billing_entity_type": { + "name": "billing_entity_type", + "schema": "public", + "values": ["user", "organization"] + }, + "public.chat_type": { + "name": "chat_type", + "schema": "public", + "values": ["mothership", "copilot"] + }, + "public.copilot_async_tool_status": { + "name": "copilot_async_tool_status", + "schema": "public", + "values": ["pending", "running", "completed", "failed", "cancelled", "delivered"] + }, + "public.copilot_run_status": { + "name": "copilot_run_status", + "schema": "public", + "values": ["active", "paused_waiting_for_tool", "resuming", "complete", "error", "cancelled"] + }, + "public.copilot_tool_permission_decision": { + "name": "copilot_tool_permission_decision", + "schema": "public", + "values": ["allow", "allow_chat", "always_allow", "skip"] + }, + "public.credential_group_enrollment_status": { + "name": "credential_group_enrollment_status", + "schema": "public", + "values": ["invited", "delivery_failed", "in_progress", "completed", "revoked"] + }, + "public.credential_group_status": { + "name": "credential_group_status", + "schema": "public", + "values": ["active", "disabled"] + }, + "public.credential_member_role": { + "name": "credential_member_role", + "schema": "public", + "values": ["admin", "member"] + }, + "public.credential_member_status": { + "name": "credential_member_status", + "schema": "public", + "values": ["active", "pending", "revoked"] + }, + "public.credential_type": { + "name": "credential_type", + "schema": "public", + "values": [ + "oauth", + "managed_oauth", + "managed_mcp", + "env_workspace", + "env_personal", + "service_account" + ] + }, + "public.data_drain_cadence": { + "name": "data_drain_cadence", + "schema": "public", + "values": ["hourly", "daily"] + }, + "public.data_drain_destination": { + "name": "data_drain_destination", + "schema": "public", + "values": ["s3", "gcs", "azure_blob", "datadog", "bigquery", "snowflake", "webhook"] + }, + "public.data_drain_run_status": { + "name": "data_drain_run_status", + "schema": "public", + "values": ["running", "success", "failed"] + }, + "public.data_drain_run_trigger": { + "name": "data_drain_run_trigger", + "schema": "public", + "values": ["cron", "manual"] + }, + "public.data_drain_source": { + "name": "data_drain_source", + "schema": "public", + "values": ["workflow_logs", "job_logs", "audit_logs", "copilot_chats", "copilot_runs"] + }, + "public.execution_large_value_reference_source": { + "name": "execution_large_value_reference_source", + "schema": "public", + "values": ["execution_log", "paused_snapshot"] + }, + "public.folder_resource_type": { + "name": "folder_resource_type", + "schema": "public", + "values": ["workflow", "file", "knowledge_base", "table"] + }, + "public.invitation_kind": { + "name": "invitation_kind", + "schema": "public", + "values": ["organization", "workspace"] + }, + "public.invitation_membership_intent": { + "name": "invitation_membership_intent", + "schema": "public", + "values": ["internal", "external"] + }, + "public.invitation_status": { + "name": "invitation_status", + "schema": "public", + "values": ["pending", "accepted", "rejected", "cancelled", "expired"] + }, + "public.managed_oauth_credential_status": { + "name": "managed_oauth_credential_status", + "schema": "public", + "values": ["active", "needs_reauth", "revoked"] + }, + "public.permission_type": { + "name": "permission_type", + "schema": "public", + "values": ["admin", "write", "read"] + }, + "public.sandbox_image_status": { + "name": "sandbox_image_status", + "schema": "public", + "values": ["pending", "building", "ready", "failed"] + }, + "public.sandbox_language": { + "name": "sandbox_language", + "schema": "public", + "values": ["javascript", "python"] + }, + "public.secret_usage_scope": { + "name": "secret_usage_scope", + "schema": "public", + "values": ["workspace", "personal"] + }, + "public.secret_usage_source": { + "name": "secret_usage_source", + "schema": "public", + "values": ["workflow", "copilot", "mcp"] + }, + "public.upload_session_method": { + "name": "upload_session_method", + "schema": "public", + "values": ["put", "multipart"] + }, + "public.upload_session_provider": { + "name": "upload_session_provider", + "schema": "public", + "values": ["local", "s3", "blob", "gcs"] + }, + "public.upload_session_purpose": { + "name": "upload_session_purpose", + "schema": "public", + "values": [ + "workspace_file", + "table_import", + "knowledge_document", + "profile_picture", + "workspace_logo", + "mothership_attachment", + "execution_attachment" + ] + }, + "public.upload_session_status": { + "name": "upload_session_status", + "schema": "public", + "values": [ + "uploading", + "completing", + "finalizing", + "completed", + "aborting", + "aborted", + "failed", + "expired" + ] + }, + "public.usage_log_category": { + "name": "usage_log_category", + "schema": "public", + "values": ["model", "fixed", "tool", "model_unbilled"] + }, + "public.usage_log_source": { + "name": "usage_log_source", + "schema": "public", + "values": [ + "workflow", + "wand", + "copilot", + "workspace-chat", + "mcp_copilot", + "mothership_block", + "knowledge-base", + "voice-input", + "enrichment", + "voice-output", + "api-tool" + ] + }, + "public.workspace_file_search_index_status": { + "name": "workspace_file_search_index_status", + "schema": "public", + "values": ["pending", "ready", "skipped", "failed"] + }, + "public.workspace_fork_promote_direction": { + "name": "workspace_fork_promote_direction", + "schema": "public", + "values": ["push", "pull"] + }, + "public.workspace_fork_resource_type": { + "name": "workspace_fork_resource_type", + "schema": "public", + "values": [ + "workflow", + "oauth_credential", + "service_account_credential", + "env_var", + "table", + "knowledge_base", + "knowledge_document", + "file", + "file_folder", + "mcp_server", + "workflow_mcp_server", + "custom_block", + "custom_tool", + "skill" + ] + }, + "public.workspace_mode": { + "name": "workspace_mode", + "schema": "public", + "values": ["personal", "organization", "grandfathered_shared"] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 05c8c82f2a7..6acd2cdcf1c 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -2255,6 +2255,13 @@ "when": 1788554098115, "tag": "0322_friendly_white_tiger", "breakpoints": true + }, + { + "idx": 323, + "version": "7", + "when": 1788808514065, + "tag": "0323_scim_provisioning", + "breakpoints": true } ] } diff --git a/packages/db/schema.ts b/packages/db/schema.ts index 214d240506b..576ef5b0b92 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -58,6 +58,24 @@ export const user = pgTable('user', { banned: boolean('banned').default(false), banReason: text('ban_reason'), banExpires: timestamp('ban_expires'), + /** + * When set, the account is suspended: sign-in is refused and API keys stop + * authenticating, while every resource the user owns is left untouched. + * + * Deliberately not `banned`. A ban is a platform-admin action whose + * `user.update.after` hook runs `disableUserResources`, archiving every + * workspace the user owns and deleting their API keys, and Sim has no + * server-side unban to reverse it. SCIM `active: false` is a reversible + * organization-level suspension that must preserve ownership for a later + * reactivation, so it needs a state of its own. + */ + suspendedAt: timestamp('suspended_at'), + /** + * Who suspended the account: `scim` for an identity-provider deactivation, + * `admin` for a manual one. SCIM only ever lifts a suspension it applied, so + * an administrator's suspension survives the next directory sync. + */ + suspensionSource: text('suspension_source'), }) export const session = pgTable( @@ -4615,6 +4633,20 @@ export const permissionGroup = pgTable( createdAt: timestamp('created_at').notNull().defaultNow(), updatedAt: timestamp('updated_at').notNull().defaultNow(), isDefault: boolean('is_default').notNull().default(false), + /** + * How an empty non-default group behaves. + * + * `inherit` (the default, and every pre-existing group) keeps the member + * invariant above: no member rows means the group governs every member of + * its workspaces. `explicit` means the group governs exactly its member + * rows and therefore governs nobody when empty. + * + * Directory-managed groups must be `explicit`. Under `inherit`, an identity + * provider removing the last member would silently widen the group from + * "these three people" to "everyone in these workspaces" — the opposite of + * what the administrator asked for. + */ + membershipMode: text('membership_mode').notNull().default('inherit'), }, (table) => ({ createdByIdx: index('permission_group_created_by_idx').on(table.createdBy), @@ -5802,3 +5834,394 @@ export const sandboxImage = pgTable( lastUsedIdx: index('sandbox_image_last_used_idx').on(table.lastUsedAt), }) ) + +/** Operations a SCIM bearer credential is allowed to perform. */ +export type ScimScope = 'users:read' | 'users:write' | 'groups:read' | 'groups:write' + +export const SCIM_SCOPES: readonly ScimScope[] = [ + 'users:read', + 'users:write', + 'groups:read', + 'groups:write', +] + +/** A workspace every provisioned user receives, at the named permission. */ +export interface ScimDefaultWorkspaceGrant { + workspaceId: string + permission: 'admin' | 'write' | 'read' +} + +/** Administrator-controlled behavior of one organization's SCIM connection. */ +export interface ScimConnectionSettings { + /** + * Refuse manual invitations, removals, and role edits for users the identity + * provider manages. Out-of-band edits desync the directory, so this defaults + * to on for a new connection and an owner may turn it off. + */ + lockManualMembership?: boolean + /** + * Turn off SSO just-in-time provisioning while the connection is active, so + * the directory is the only way into the organization. + */ + disableJit?: boolean + /** Auto-create a matching permission group the first time a SCIM group appears. */ + autoMapPermissionGroupsByName?: boolean + /** Workspaces every provisioned user receives regardless of group membership. */ + defaultWorkspaceGrants?: ScimDefaultWorkspaceGrant[] +} + +/** One email address as the identity provider supplied it. */ +export interface ScimUserEmail { + value: string + type?: string + primary: boolean +} + +/** + * The last User resource a connection sent, canonicalized. Stored whole so a + * `GET` returns what the provider wrote and a `PATCH` applies to the provider's + * own view rather than to a lossy projection of it. + */ +export interface ScimUserAttributes { + userName: string + externalId?: string + active: boolean + displayName: string + name: { + formatted: string + givenName?: string + familyName?: string + } + emails: ScimUserEmail[] + enterprise?: { + department?: string + employeeNumber?: string + costCenter?: string + division?: string + organization?: string + manager?: { value?: string; displayName?: string } + } + /** Attributes Sim does not model, preserved so responses round-trip them. */ + extra?: Record +} + +/** + * One directory-provisioning connection per organization. + * + * The bearer credential an identity provider presents resolves to this row, and + * that row is the entire authorization scope: no SCIM request names an + * organization, so no request can reach another tenant's users. + */ +export const scimConnection = pgTable( + 'scim_connection', + { + id: text('id').primaryKey(), + organizationId: text('organization_id') + .notNull() + .references(() => organization.id, { onDelete: 'cascade' }), + /** The SSO provider this directory pairs with, shown in settings. */ + ssoProviderId: text('sso_provider_id').references(() => ssoProvider.id, { + onDelete: 'set null', + }), + /** `active` or `disabled`. Disabling refuses every credential immediately. */ + status: text('status').notNull().default('active'), + settings: jsonb('settings').$type().notNull().default({}), + lastRequestAt: timestamp('last_request_at'), + /** Reconcile-job lease, in the shape the connector member sync already uses. */ + reconcileLockToken: text('reconcile_lock_token'), + reconcileLeaseAt: timestamp('reconcile_lease_at'), + reconciledAt: timestamp('reconciled_at'), + createdBy: text('created_by').references(() => user.id, { onDelete: 'set null' }), + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at').notNull().defaultNow(), + }, + (table) => ({ + organizationUnique: uniqueIndex('scim_connection_organization_unique').on(table.organizationId), + reconcileDueIdx: index('scim_connection_reconcile_due_idx').on(table.reconciledAt), + }) +) + +/** + * A bearer credential for one connection. + * + * Only the SHA-256 digest is stored, so a database read cannot recover a live + * token. Two credentials may be active at once, which is what lets an + * administrator rotate without a window where the directory cannot authenticate. + */ +export const scimCredential = pgTable( + 'scim_credential', + { + id: text('id').primaryKey(), + connectionId: text('connection_id') + .notNull() + .references(() => scimConnection.id, { onDelete: 'cascade' }), + tokenHash: text('token_hash').notNull(), + /** Leading characters of the token, for identifying it in the settings list. */ + tokenPrefix: text('token_prefix').notNull(), + scopes: jsonb('scopes').$type().notNull(), + expiresAt: timestamp('expires_at'), + revokedAt: timestamp('revoked_at'), + revokedBy: text('revoked_by').references(() => user.id, { onDelete: 'set null' }), + lastUsedAt: timestamp('last_used_at'), + createdBy: text('created_by').references(() => user.id, { onDelete: 'set null' }), + createdAt: timestamp('created_at').notNull().defaultNow(), + }, + (table) => ({ + tokenHashUnique: uniqueIndex('scim_credential_token_hash_unique').on(table.tokenHash), + connectionIdx: index('scim_credential_connection_idx').on(table.connectionId), + }) +) + +/** + * The User resource one connection provisioned, and its link to a Sim account. + * + * `id` is the SCIM resource id the provider stores and addresses; it is never a + * Sim user id, so a provider cannot reach an account it did not provision by + * guessing one. + */ +export const scimUser = pgTable( + 'scim_user', + { + id: text('id').primaryKey(), + connectionId: text('connection_id') + .notNull() + .references(() => scimConnection.id, { onDelete: 'cascade' }), + userId: text('user_id') + .notNull() + .references(() => user.id, { onDelete: 'cascade' }), + externalId: text('external_id'), + /** Lower-cased `userName`; the uniqueness and lookup key within a connection. */ + userName: text('user_name').notNull(), + active: boolean('active').notNull().default(true), + attributes: jsonb('attributes').$type().notNull(), + /** + * Stable ascending sort key for pagination. A provider pages with + * `startIndex`, so the order must not shift between pages the way + * `created_at` alone can when rows share a timestamp. + */ + orderKey: text('order_key').notNull(), + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at').notNull().defaultNow(), + }, + (table) => ({ + connectionUserUnique: uniqueIndex('scim_user_connection_user_unique').on( + table.connectionId, + table.userId + ), + connectionUserNameUnique: uniqueIndex('scim_user_connection_user_name_unique').on( + table.connectionId, + table.userName + ), + connectionExternalIdUnique: uniqueIndex('scim_user_connection_external_id_unique') + .on(table.connectionId, table.externalId) + .where(sql`external_id is not null`), + connectionOrderIdx: index('scim_user_connection_order_idx').on( + table.connectionId, + table.orderKey + ), + userIdx: index('scim_user_user_idx').on(table.userId), + }) +) + +/** + * Remembers which Sim account a deleted external identity belonged to. + * + * Directories delete and recreate a person for an ordinary rename or rehire. The + * tombstone makes the recreated resource relink to the same account instead of + * creating a second one, which is what would otherwise strand the original. + */ +export const scimUserTombstone = pgTable( + 'scim_user_tombstone', + { + id: text('id').primaryKey(), + connectionId: text('connection_id') + .notNull() + .references(() => scimConnection.id, { onDelete: 'cascade' }), + externalId: text('external_id').notNull(), + userId: text('user_id') + .notNull() + .references(() => user.id, { onDelete: 'cascade' }), + deletedAt: timestamp('deleted_at').notNull().defaultNow(), + }, + (table) => ({ + connectionExternalIdUnique: uniqueIndex('scim_user_tombstone_connection_external_id_unique').on( + table.connectionId, + table.externalId + ), + }) +) + +/** A Group resource one connection provisioned. */ +export const scimGroup = pgTable( + 'scim_group', + { + id: text('id').primaryKey(), + connectionId: text('connection_id') + .notNull() + .references(() => scimConnection.id, { onDelete: 'cascade' }), + externalId: text('external_id'), + displayName: text('display_name').notNull(), + /** + * Lower-cased `displayName`. Uniqueness is case-insensitive because + * Microsoft Entra treats a group name as its match key and will otherwise + * create a duplicate whose only difference is capitalization. + */ + displayNameKey: text('display_name_key').notNull(), + orderKey: text('order_key').notNull(), + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at').notNull().defaultNow(), + }, + (table) => ({ + connectionDisplayNameUnique: uniqueIndex('scim_group_connection_display_name_unique').on( + table.connectionId, + table.displayNameKey + ), + connectionExternalIdUnique: uniqueIndex('scim_group_connection_external_id_unique') + .on(table.connectionId, table.externalId) + .where(sql`external_id is not null`), + connectionOrderIdx: index('scim_group_connection_order_idx').on( + table.connectionId, + table.orderKey + ), + }) +) + +/** Membership of a provisioned group. */ +export const scimGroupMember = pgTable( + 'scim_group_member', + { + id: text('id').primaryKey(), + groupId: text('group_id') + .notNull() + .references(() => scimGroup.id, { onDelete: 'cascade' }), + scimUserId: text('scim_user_id') + .notNull() + .references(() => scimUser.id, { onDelete: 'cascade' }), + createdAt: timestamp('created_at').notNull().defaultNow(), + }, + (table) => ({ + groupUserUnique: uniqueIndex('scim_group_member_group_user_unique').on( + table.groupId, + table.scimUserId + ), + scimUserIdx: index('scim_group_member_scim_user_idx').on(table.scimUserId), + }) +) + +/** + * What a directory group means inside Sim, as an administrator configured it. + * + * A group may carry several mappings — a permission group, one or more + * workspaces, and the organization admin role are independent targets. + */ +export const scimGroupMapping = pgTable( + 'scim_group_mapping', + { + id: text('id').primaryKey(), + groupId: text('group_id') + .notNull() + .references(() => scimGroup.id, { onDelete: 'cascade' }), + /** `permission_group`, `workspace`, or `org_role`. */ + targetKind: text('target_kind').notNull(), + permissionGroupId: text('permission_group_id').references(() => permissionGroup.id, { + onDelete: 'cascade', + }), + workspaceId: text('workspace_id').references(() => workspace.id, { onDelete: 'cascade' }), + /** Permission granted on `workspaceId`, for workspace targets. */ + permissionType: permissionTypeEnum('permission_type'), + /** Organization role granted, for `org_role` targets. Only `admin` is accepted. */ + role: text('role'), + createdBy: text('created_by').references(() => user.id, { onDelete: 'set null' }), + createdAt: timestamp('created_at').notNull().defaultNow(), + }, + (table) => ({ + groupIdx: index('scim_group_mapping_group_idx').on(table.groupId), + /** + * One mapping per group and target. `coalesce` collapses the three mutually + * exclusive target columns into the single value that identifies the target, + * so a group cannot carry the same workspace twice at two permissions. + */ + groupTargetUnique: uniqueIndex('scim_group_mapping_group_target_unique').on( + table.groupId, + table.targetKind, + sql`coalesce(${table.permissionGroupId}, ${table.workspaceId}, ${table.role})` + ), + /** Exactly the columns belonging to `target_kind` are populated. */ + targetShape: check( + 'scim_group_mapping_target_shape', + sql`( + (${table.targetKind} = 'permission_group' AND ${table.permissionGroupId} IS NOT NULL AND ${table.workspaceId} IS NULL AND ${table.permissionType} IS NULL AND ${table.role} IS NULL) + OR (${table.targetKind} = 'workspace' AND ${table.workspaceId} IS NOT NULL AND ${table.permissionType} IS NOT NULL AND ${table.permissionGroupId} IS NULL AND ${table.role} IS NULL) + OR (${table.targetKind} = 'org_role' AND ${table.role} IS NOT NULL AND ${table.permissionGroupId} IS NULL AND ${table.workspaceId} IS NULL AND ${table.permissionType} IS NULL) + )` + ), + }) +) + +/** + * Provenance for every access SCIM granted. + * + * Without it, withdrawing a group's access could not tell an access the + * directory granted from one a workspace administrator granted by hand, and a + * routine group change would revoke the administrator's work. + */ +export const scimProjectionGrant = pgTable( + 'scim_projection_grant', + { + id: text('id').primaryKey(), + connectionId: text('connection_id') + .notNull() + .references(() => scimConnection.id, { onDelete: 'cascade' }), + scimUserId: text('scim_user_id') + .notNull() + .references(() => scimUser.id, { onDelete: 'cascade' }), + targetKind: text('target_kind').notNull(), + /** Permission group id, workspace id, or the granted organization role. */ + targetId: text('target_id').notNull(), + /** The permission SCIM set, so a later manual upgrade stays detectable. */ + permissionType: permissionTypeEnum('permission_type'), + createdAt: timestamp('created_at').notNull().defaultNow(), + updatedAt: timestamp('updated_at').notNull().defaultNow(), + }, + (table) => ({ + userTargetUnique: uniqueIndex('scim_projection_grant_user_target_unique').on( + table.scimUserId, + table.targetKind, + table.targetId + ), + connectionIdx: index('scim_projection_grant_connection_idx').on(table.connectionId), + }) +) + +/** + * Recent provisioning requests, for the settings activity view. + * + * Microsoft Entra reports a failed sync without saying what it sent, so an + * administrator debugging a connection has no other way to see the request that + * failed. Pruned by the reconcile job. + */ +export const scimRequestLog = pgTable( + 'scim_request_log', + { + id: text('id').primaryKey(), + connectionId: text('connection_id') + .notNull() + .references(() => scimConnection.id, { onDelete: 'cascade' }), + credentialId: text('credential_id'), + method: text('method').notNull(), + /** Resource path only. Query strings can carry directory attribute values. */ + path: text('path').notNull(), + status: integer('status').notNull(), + scimType: text('scim_type'), + detail: text('detail'), + userAgent: text('user_agent'), + durationMs: integer('duration_ms').notNull(), + createdAt: timestamp('created_at').notNull().defaultNow(), + }, + (table) => ({ + connectionCreatedIdx: index('scim_request_log_connection_created_idx').on( + table.connectionId, + table.createdAt + ), + }) +) diff --git a/packages/testing/src/mocks/env-flags.mock.ts b/packages/testing/src/mocks/env-flags.mock.ts index 471798c780c..cd771a74cd5 100644 --- a/packages/testing/src/mocks/env-flags.mock.ts +++ b/packages/testing/src/mocks/env-flags.mock.ts @@ -35,6 +35,7 @@ export interface EnvFlagsMockState { isInboxEnabled: boolean isSandboxDeploymentEntitled: boolean isSandboxesEnabled: boolean + isScimEnabled: boolean isWhitelabelingEnabled: boolean isAuditLogsEnabled: boolean isCustomBlocksEnabled: boolean @@ -89,6 +90,7 @@ const defaultEnvFlagsState: EnvFlagsMockState = { isInboxEnabled: true, isSandboxDeploymentEntitled: false, isSandboxesEnabled: false, + isScimEnabled: false, isWhitelabelingEnabled: true, isSessionPoliciesEnabled: true, isAuditLogsEnabled: false, diff --git a/packages/testing/src/mocks/schema.mock.ts b/packages/testing/src/mocks/schema.mock.ts index b2baad89363..e68c7977fce 100644 --- a/packages/testing/src/mocks/schema.mock.ts +++ b/packages/testing/src/mocks/schema.mock.ts @@ -154,6 +154,8 @@ export const schemaMock = { banned: 'user.banned', banReason: 'user.banReason', banExpires: 'user.banExpires', + suspendedAt: 'user.suspendedAt', + suspensionSource: 'user.suspensionSource', }, session: { id: 'session.id', @@ -1162,6 +1164,102 @@ export const schemaMock = { createdAt: 'ssoDomain.createdAt', updatedAt: 'ssoDomain.updatedAt', }, + scimConnection: { + id: 'scimConnection.id', + organizationId: 'scimConnection.organizationId', + ssoProviderId: 'scimConnection.ssoProviderId', + status: 'scimConnection.status', + settings: 'scimConnection.settings', + lastRequestAt: 'scimConnection.lastRequestAt', + reconcileLockToken: 'scimConnection.reconcileLockToken', + reconcileLeaseAt: 'scimConnection.reconcileLeaseAt', + reconciledAt: 'scimConnection.reconciledAt', + createdBy: 'scimConnection.createdBy', + createdAt: 'scimConnection.createdAt', + updatedAt: 'scimConnection.updatedAt', + }, + scimCredential: { + id: 'scimCredential.id', + connectionId: 'scimCredential.connectionId', + tokenHash: 'scimCredential.tokenHash', + tokenPrefix: 'scimCredential.tokenPrefix', + scopes: 'scimCredential.scopes', + expiresAt: 'scimCredential.expiresAt', + revokedAt: 'scimCredential.revokedAt', + revokedBy: 'scimCredential.revokedBy', + lastUsedAt: 'scimCredential.lastUsedAt', + createdBy: 'scimCredential.createdBy', + createdAt: 'scimCredential.createdAt', + }, + scimUser: { + id: 'scimUser.id', + connectionId: 'scimUser.connectionId', + userId: 'scimUser.userId', + externalId: 'scimUser.externalId', + userName: 'scimUser.userName', + active: 'scimUser.active', + attributes: 'scimUser.attributes', + orderKey: 'scimUser.orderKey', + createdAt: 'scimUser.createdAt', + updatedAt: 'scimUser.updatedAt', + }, + scimUserTombstone: { + id: 'scimUserTombstone.id', + connectionId: 'scimUserTombstone.connectionId', + externalId: 'scimUserTombstone.externalId', + userId: 'scimUserTombstone.userId', + deletedAt: 'scimUserTombstone.deletedAt', + }, + scimGroup: { + id: 'scimGroup.id', + connectionId: 'scimGroup.connectionId', + externalId: 'scimGroup.externalId', + displayName: 'scimGroup.displayName', + displayNameKey: 'scimGroup.displayNameKey', + orderKey: 'scimGroup.orderKey', + createdAt: 'scimGroup.createdAt', + updatedAt: 'scimGroup.updatedAt', + }, + scimGroupMember: { + id: 'scimGroupMember.id', + groupId: 'scimGroupMember.groupId', + scimUserId: 'scimGroupMember.scimUserId', + createdAt: 'scimGroupMember.createdAt', + }, + scimGroupMapping: { + id: 'scimGroupMapping.id', + groupId: 'scimGroupMapping.groupId', + targetKind: 'scimGroupMapping.targetKind', + permissionGroupId: 'scimGroupMapping.permissionGroupId', + workspaceId: 'scimGroupMapping.workspaceId', + permissionType: 'scimGroupMapping.permissionType', + role: 'scimGroupMapping.role', + createdBy: 'scimGroupMapping.createdBy', + createdAt: 'scimGroupMapping.createdAt', + }, + scimProjectionGrant: { + id: 'scimProjectionGrant.id', + connectionId: 'scimProjectionGrant.connectionId', + scimUserId: 'scimProjectionGrant.scimUserId', + targetKind: 'scimProjectionGrant.targetKind', + targetId: 'scimProjectionGrant.targetId', + permissionType: 'scimProjectionGrant.permissionType', + createdAt: 'scimProjectionGrant.createdAt', + updatedAt: 'scimProjectionGrant.updatedAt', + }, + scimRequestLog: { + id: 'scimRequestLog.id', + connectionId: 'scimRequestLog.connectionId', + credentialId: 'scimRequestLog.credentialId', + method: 'scimRequestLog.method', + path: 'scimRequestLog.path', + status: 'scimRequestLog.status', + scimType: 'scimRequestLog.scimType', + detail: 'scimRequestLog.detail', + userAgent: 'scimRequestLog.userAgent', + durationMs: 'scimRequestLog.durationMs', + createdAt: 'scimRequestLog.createdAt', + }, workflowMcpServer: { id: 'workflowMcpServer.id', workspaceId: 'workflowMcpServer.workspaceId', @@ -1347,6 +1445,7 @@ export const schemaMock = { createdAt: 'permissionGroup.createdAt', updatedAt: 'permissionGroup.updatedAt', isDefault: 'permissionGroup.isDefault', + membershipMode: 'permissionGroup.membershipMode', }, permissionGroupWorkspace: { id: 'permissionGroupWorkspace.id', diff --git a/scripts/check-api-validation-contracts.ts b/scripts/check-api-validation-contracts.ts index 378d7ce4aa6..2a3c7eaf2b1 100644 --- a/scripts/check-api-validation-contracts.ts +++ b/scripts/check-api-validation-contracts.ts @@ -42,6 +42,16 @@ const BOUNDARY_POLICY_BASELINE = { } as const const INDIRECT_ZOD_ROUTES = new Set([ + // SCIM discovery documents (RFC 7644 section 4). Each serves a fixed document + // describing what this server implements and accepts no params, query, or body, + // so there is no input to validate and no contract to bind. They are deliberately + // unauthenticated: a provider negotiates against them before it holds a + // credential. Wrapped in withRouteHandler by `defineScimDiscoveryRoute`. + 'apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts', + 'apps/sim/app/api/scim/v2/ResourceTypes/route.ts', + 'apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts', + 'apps/sim/app/api/scim/v2/Schemas/route.ts', + 'apps/sim/app/api/scim/v2/Schemas/[id]/route.ts', // Catch-all JSON 404 for unknown /api/v2 paths. It has no contract by // construction: it exists precisely for requests that match no operation, so // there is no input to validate and its only response is the fixed v2 error @@ -84,6 +94,7 @@ const INDIRECT_ZOD_ROUTES = new Set([ 'apps/sim/app/api/settings/allowed-providers/route.ts', 'apps/sim/app/api/settings/allowed-integrations/route.ts', 'apps/sim/app/api/settings/allowed-mcp-domains/route.ts', + 'apps/sim/app/api/cron/scim-reconcile/route.ts', 'apps/sim/app/api/cron/cleanup-tasks/route.ts', 'apps/sim/app/api/cron/cleanup-soft-deletes/route.ts', 'apps/sim/app/api/cron/cleanup-table-row-ttl/route.ts', @@ -169,9 +180,9 @@ const RAW_JSON_BASELINE_ROUTES = new Set([ const CONTRACT_IMPORT_PATTERN = /\bfrom\s+['"]@\/lib\/api\/contracts(?:\/[^'"]*)?['"]/ const DECLARATIVE_ROUTE_BUILDER_IMPORT_PATTERN = - /\bimport\s*\{[^}]*(?:\bdefineInternalJsonRoute\b|\bdefineV2JsonRoute\b|\bdefineInternalBinaryRoute\b|\bdefineV2BinaryRoute\b)[^}]*\}\s*from\s*['"]@\/lib\/api\/server\/routes['"]/ + /\bimport\s*\{[^}]*(?:\bdefineInternalJsonRoute\b|\bdefineV2JsonRoute\b|\bdefineInternalBinaryRoute\b|\bdefineV2BinaryRoute\b)[^}]*\}\s*from\s*['"]@\/lib\/api\/server\/routes['"]|\bimport\s*\{[^}]*\bdefineScimRoute\b[^}]*\}\s*from\s*['"]@\/lib\/scim\/route['"]/ const DECLARATIVE_ROUTE_BUILDER_USAGE_PATTERN = - /\b(?:defineInternalJsonRoute|defineV2JsonRoute|defineInternalBinaryRoute|defineV2BinaryRoute)\s*\(/ + /\b(?:defineInternalJsonRoute|defineV2JsonRoute|defineInternalBinaryRoute|defineV2BinaryRoute|defineScimRoute)\s*\(/ const SERVER_VALIDATION_IMPORT_PATTERN = /\bfrom\s+['"]@\/lib\/api\/server(?:\/validation)?['"]/ const SCHEMA_PARSE_PATTERN = /\b\w+Schema\.(?:safeParse|parse)\(/ const CONTRACT_SERVER_HELPER_PATTERN = /\bparseToolRequest\(/ diff --git a/scripts/check-route-verbs.ts b/scripts/check-route-verbs.ts index 277309de866..aa12468fce1 100644 --- a/scripts/check-route-verbs.ts +++ b/scripts/check-route-verbs.ts @@ -62,6 +62,7 @@ const BUILDERS = [ 'defineV2BodyLifecycleRoute', 'defineInternalJsonRoute', 'defineInternalBinaryRoute', + 'defineScimRoute', ] as const const BUILDER_ALT = BUILDERS.join('|') From 1592ef14d2235e3a1a22e0afb928a4d3cca8368d Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 13:38:38 -0700 Subject: [PATCH 12/31] fix(scim): audit fixes, admin settings UI, and reversible deactivation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review and enterprise-norms audit of the provisioning surface: - Deactivation keeps workspace grants and API keys; it only blocks sign-in, refuses personal keys at auth, and stops scheduled/webhook execution via isAccountBlocked. Reactivation restores access exactly as it was - Organization/user advisory locks are taken before permission-group locks in projection and user update; concurrent PATCHes lock the SCIM row - Downgrades of a projected workspace level are applied, not just raises - No-op PUT/PATCH/replace writes nothing and records no audit - Unique violations map to 409 uniqueness; domain refusals to invalidValue - scimManagedUserPredicate is anchored to the organization - autoMapPermissionGroupsByName adopts an existing same-name group - Rate limit raised for Entra's initial-cycle burst; discovery is IP-limited - Dead exports and duplicate scope checks removed Adds the Settings → SSO → Directory provisioning section: enable toggle, base URL, connection settings, credential issue/revoke (token shown once), group mappings, recent activity, and reconcile now. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01JVf3fLVj7iWzED7L2wQvhG --- .../content/docs/platform/enterprise/scim.mdx | 2 +- .../content/docs/platform/enterprise/sso.mdx | 2 +- .../[id]/members/[memberId]/route.ts | 27 +- apps/sim/app/api/scim/v2/Groups/[id]/route.ts | 10 +- apps/sim/app/api/scim/v2/Groups/route.ts | 2 - apps/sim/app/api/scim/v2/Users/[id]/route.ts | 4 - apps/sim/app/api/scim/v2/Users/route.ts | 2 - apps/sim/ee/scim/components/scim-section.tsx | 589 ++++++++++++++++++ apps/sim/ee/scim/hooks/scim.ts | 169 +++++ apps/sim/ee/sso/components/sso-settings.tsx | 3 + apps/sim/lib/api-key/service.ts | 7 +- .../lib/api/contracts/organization-scim.ts | 68 +- apps/sim/lib/api/contracts/scim.ts | 45 +- apps/sim/lib/api/server/routes/scim-route.ts | 39 +- apps/sim/lib/auth/ban.ts | 40 +- .../lib/invitations/workspace-invitations.ts | 7 +- .../lib/organizations/members/lifecycle.ts | 17 +- .../application/admin/manage-connection.ts | 66 +- .../scim/application/groups/manage-groups.ts | 60 +- apps/sim/lib/scim/application/operations.ts | 3 - .../application/users/deprovision-user.ts | 48 +- .../scim/application/users/provision-user.ts | 146 +++-- .../lib/scim/application/users/read-users.ts | 2 - .../lib/scim/application/users/update-user.ts | 124 ++-- apps/sim/lib/scim/authenticate.ts | 53 +- apps/sim/lib/scim/identity/resolve-user.ts | 26 +- apps/sim/lib/scim/managed-membership.ts | 89 +-- apps/sim/lib/scim/projection/auto-map.ts | 64 ++ .../sim/lib/scim/projection/reconcile-user.ts | 183 ++++-- apps/sim/lib/scim/protocol/constants.ts | 11 +- apps/sim/lib/scim/protocol/errors.ts | 32 +- apps/sim/lib/scim/protocol/filter.ts | 1 - apps/sim/lib/scim/protocol/normalize.ts | 33 +- apps/sim/lib/scim/protocol/user-patch.ts | 5 + apps/sim/lib/scim/reconcile/job.ts | 23 +- apps/sim/lib/scim/repository/groups.ts | 2 +- apps/sim/lib/scim/repository/users.ts | 44 +- .../lib/workspaces/access/workspace-access.ts | 62 +- 38 files changed, 1559 insertions(+), 551 deletions(-) create mode 100644 apps/sim/ee/scim/components/scim-section.tsx create mode 100644 apps/sim/ee/scim/hooks/scim.ts create mode 100644 apps/sim/lib/scim/projection/auto-map.ts diff --git a/apps/docs/content/docs/platform/enterprise/scim.mdx b/apps/docs/content/docs/platform/enterprise/scim.mdx index bc8c16779e6..293f13cc064 100644 --- a/apps/docs/content/docs/platform/enterprise/scim.mdx +++ b/apps/docs/content/docs/platform/enterprise/scim.mdx @@ -21,7 +21,7 @@ It pairs with [SSO](/platform/enterprise/sso). SSO proves who someone is when th | --- | --- | | Assigns a person to the Sim app | Creates their account and adds them to your organization as a Member | | Updates their name or email | Updates the Sim account, and ends their sessions if the address changed | -| Deactivates them | Blocks sign-in, stops their API keys, and withdraws directory-granted access. Everything they own is left untouched | +| Deactivates them | Blocks sign-in and stops their API keys. Everything they own, and every grant they hold, is left untouched | | Reactivates them | Restores access exactly as it was | | Removes them from the app | Removes their organization membership and reassigns what they owned | | Adds them to a group | Grants whatever that group maps to | diff --git a/apps/docs/content/docs/platform/enterprise/sso.mdx b/apps/docs/content/docs/platform/enterprise/sso.mdx index 79b4e87851e..ac693199dbb 100644 --- a/apps/docs/content/docs/platform/enterprise/sso.mdx +++ b/apps/docs/content/docs/platform/enterprise/sso.mdx @@ -305,7 +305,7 @@ SSO provisioning creates internal organization members but does not grant worksp }, { question: "Does disabling someone in the identity provider remove their Sim access?", - answer: "With [directory provisioning](/platform/enterprise/scim) connected, yes: your identity provider sends the deactivation, and Sim blocks sign-in, stops their API keys, and withdraws directory-granted access while leaving everything they own intact. With SSO alone, disabling the IdP account only blocks future SSO authentication — remove or suspend the user in Sim as part of offboarding." + answer: "With [directory provisioning](/platform/enterprise/scim) connected, yes: your identity provider sends the deactivation, and Sim blocks sign-in and stops their API keys while leaving everything they own intact. With SSO alone, disabling the IdP account only blocks future SSO authentication — remove or suspend the user in Sim as part of offboarding." }, { question: "Can I still use email/password login after enabling SSO?", diff --git a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts index 3ab5b9f3420..218f857347f 100644 --- a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts @@ -17,6 +17,7 @@ import { } from '@/lib/billing/organizations/membership' import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' import { ForbiddenOperationError } from '@/lib/core/application' +import { OrchestrationError, statusForOrchestrationError } from '@/lib/core/orchestration/types' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { changeMemberRoleTx } from '@/lib/organizations/members/lifecycle' import { captureServerEvent } from '@/lib/posthog/server' @@ -231,19 +232,11 @@ export const PUT = withRouteHandler( changeMemberRoleTx(tx, { organizationId, userId: memberId, role }) ) - if (!roleChange.changed) { - return NextResponse.json({ - success: true, - message: 'Member role updated successfully', - data: { - id: targetMember[0].id, - userId: targetMember[0].userId, - role: roleChange.role, - updatedBy: session.user.id, - }, - }) - } - + /** + * The audit row and analytics event fire whether or not the role actually + * moved, exactly as this route did before the write went through the + * shared primitive. Callers assert on those side effects. + */ logger.info('Organization member role updated', { organizationId, memberId, @@ -282,7 +275,7 @@ export const PUT = withRouteHandler( data: { id: targetMember[0].id, userId: targetMember[0].userId, - role: roleChange.to, + role: roleChange.changed ? roleChange.to : roleChange.role, updatedBy: session.user.id, }, }) @@ -293,6 +286,12 @@ export const PUT = withRouteHandler( { status: 403 } ) } + if (error instanceof OrchestrationError) { + return NextResponse.json( + { error: error.message }, + { status: statusForOrchestrationError(error.code) } + ) + } logger.error('Failed to update organization member role', { organizationId: (await context.params).id, diff --git a/apps/sim/app/api/scim/v2/Groups/[id]/route.ts b/apps/sim/app/api/scim/v2/Groups/[id]/route.ts index d43b9d45c82..e65c4b995a3 100644 --- a/apps/sim/app/api/scim/v2/Groups/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Groups/[id]/route.ts @@ -5,7 +5,7 @@ import { replaceScimGroupContract, } from '@/lib/api/contracts/scim' import { - deleteScimGroupUseCase, + deleteScimGroup, getScimGroup, patchScimGroup, replaceScimGroup, @@ -18,7 +18,6 @@ import { defineScimRoute } from '@/lib/scim/route' export const GET = defineScimRoute({ contract: getScimGroupContract, - scope: 'groups:read', operation: getScimGroup.operation, useCase: getScimGroup, mapInput: ({ params, query }) => ({ @@ -30,7 +29,6 @@ export const GET = defineScimRoute({ export const PUT = defineScimRoute({ contract: replaceScimGroupContract, - scope: 'groups:write', operation: replaceScimGroup.operation, useCase: replaceScimGroup, mapInput: ({ params, body }) => { @@ -43,7 +41,6 @@ export const PUT = defineScimRoute({ /** Answers 204: Microsoft asks that a group patch not echo the member list. */ export const PATCH = defineScimRoute({ contract: patchScimGroupContract, - scope: 'groups:write', operation: patchScimGroup.operation, useCase: patchScimGroup, mapInput: ({ params, body }) => ({ groupId: params.id, operations: body.Operations }), @@ -51,8 +48,7 @@ export const PATCH = defineScimRoute({ export const DELETE = defineScimRoute({ contract: deleteScimGroupContract, - scope: 'groups:write', - operation: deleteScimGroupUseCase.operation, - useCase: deleteScimGroupUseCase, + operation: deleteScimGroup.operation, + useCase: deleteScimGroup, mapInput: ({ params }) => ({ groupId: params.id }), }) diff --git a/apps/sim/app/api/scim/v2/Groups/route.ts b/apps/sim/app/api/scim/v2/Groups/route.ts index 01e636bd1c5..a6444bd3107 100644 --- a/apps/sim/app/api/scim/v2/Groups/route.ts +++ b/apps/sim/app/api/scim/v2/Groups/route.ts @@ -8,7 +8,6 @@ import { defineScimRoute } from '@/lib/scim/route' export const GET = defineScimRoute({ contract: listScimGroupsContract, - scope: 'groups:read', operation: listScimGroups.operation, useCase: listScimGroups, mapInput: ({ query }) => ({ @@ -22,7 +21,6 @@ export const GET = defineScimRoute({ export const POST = defineScimRoute({ contract: createScimGroupContract, - scope: 'groups:write', operation: createScimGroup.operation, useCase: createScimGroup, mapInput: ({ body }) => { diff --git a/apps/sim/app/api/scim/v2/Users/[id]/route.ts b/apps/sim/app/api/scim/v2/Users/[id]/route.ts index 5a347246643..3b11be0b6b2 100644 --- a/apps/sim/app/api/scim/v2/Users/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Users/[id]/route.ts @@ -15,7 +15,6 @@ import { defineScimRoute } from '@/lib/scim/route' export const GET = defineScimRoute({ contract: getScimUserContract, - scope: 'users:read', operation: getScimUser.operation, useCase: getScimUser, mapInput: ({ params, query }) => ({ @@ -27,7 +26,6 @@ export const GET = defineScimRoute({ export const PUT = defineScimRoute({ contract: replaceScimUserContract, - scope: 'users:write', operation: replaceScimUser.operation, useCase: replaceScimUser, mapInput: ({ params, body }) => { @@ -39,7 +37,6 @@ export const PUT = defineScimRoute({ export const PATCH = defineScimRoute({ contract: patchScimUserContract, - scope: 'users:write', operation: patchScimUser.operation, useCase: patchScimUser, mapInput: ({ params, body }) => ({ scimUserId: params.id, operations: body.Operations }), @@ -48,7 +45,6 @@ export const PATCH = defineScimRoute({ export const DELETE = defineScimRoute({ contract: deleteScimUserContract, - scope: 'users:write', operation: deprovisionScimUser.operation, useCase: deprovisionScimUser, mapInput: ({ params }) => ({ scimUserId: params.id }), diff --git a/apps/sim/app/api/scim/v2/Users/route.ts b/apps/sim/app/api/scim/v2/Users/route.ts index a14ad88c155..c8c1c6367bf 100644 --- a/apps/sim/app/api/scim/v2/Users/route.ts +++ b/apps/sim/app/api/scim/v2/Users/route.ts @@ -15,7 +15,6 @@ import { defineScimRoute } from '@/lib/scim/route' export const GET = defineScimRoute({ contract: listScimUsersContract, - scope: 'users:read', operation: listScimUsers.operation, useCase: listScimUsers, mapInput: ({ query }) => ({ @@ -29,7 +28,6 @@ export const GET = defineScimRoute({ export const POST = defineScimRoute({ contract: createScimUserContract, - scope: 'users:write', operation: provisionScimUser.operation, useCase: provisionScimUser, mapInput: ({ body }) => { diff --git a/apps/sim/ee/scim/components/scim-section.tsx b/apps/sim/ee/scim/components/scim-section.tsx new file mode 100644 index 00000000000..9e48196105b --- /dev/null +++ b/apps/sim/ee/scim/components/scim-section.tsx @@ -0,0 +1,589 @@ +'use client' + +import { useState } from 'react' +import { + Chip, + ChipConfirmModal, + ChipCopyInput, + ChipModal, + ChipModalBody, + ChipModalField, + ChipModalFooter, + ChipModalHeader, + ChipSelect, + ChipTag, + Switch, + toast, +} from '@sim/emcn' +import { Key, X } from '@sim/emcn/icons' +import { getErrorMessage } from '@sim/utils/errors' +import type { + ScimActivityEntry, + ScimConnectionView, + ScimCredentialView, + ScimGroupMappingBody, + ScimGroupMappingView, +} from '@/lib/api/contracts/organization-scim' +import { useDeploymentShape } from '@/lib/core/config/deployment-shape' +import { RowActionsMenu } from '@/app/workspace/[workspaceId]/settings/components/row-actions-menu' +import { SettingsEmptyState } from '@/app/workspace/[workspaceId]/settings/components/settings-empty-state' +import { SettingsResourceRow } from '@/app/workspace/[workspaceId]/settings/components/settings-resource-row' +import { SettingsSection } from '@/app/workspace/[workspaceId]/settings/components/settings-section/settings-section' +import { + useOrganizationWorkspaces, + usePermissionGroups, +} from '@/ee/access-control/hooks/permission-groups' +import { SettingRow } from '@/ee/components/setting-row' +import { + useConfigureScimConnection, + useDeleteScimGroupMapping, + useIssueScimCredential, + useReconcileScimConnection, + useRevokeScimCredential, + useScimActivity, + useScimConnection, + useScimGroupMappings, + useUpsertScimGroupMapping, +} from '@/ee/scim/hooks/scim' + +interface ScimSectionProps { + organizationId: string +} + +type MappingTargetKind = ScimGroupMappingView['targetKind'] +type WorkspacePermission = NonNullable + +const TARGET_KIND_OPTIONS = [ + { value: 'permission_group', label: 'Permission group' }, + { value: 'workspace', label: 'Workspace' }, + { value: 'org_role', label: 'Organization admin' }, +] as const + +const PERMISSION_OPTIONS = [ + { value: 'read', label: 'Read' }, + { value: 'write', label: 'Write' }, + { value: 'admin', label: 'Admin' }, +] as const + +const SETTING_TOGGLES = [ + { + key: 'lockManualMembership', + label: 'Lock managed membership', + description: + 'Refuse invitations, role changes, and manual grants for members the directory provisions. The next sync would revert them anyway.', + }, + { + key: 'disableJit', + label: 'Disable just-in-time provisioning', + description: + 'Refuse membership for someone signing in with SSO who the directory never provisioned. The directory becomes the only way in.', + }, + { + key: 'autoMapPermissionGroupsByName', + label: 'Match permission groups by name', + description: + 'When a pushed group has the same name as one of your permission groups, map them automatically. Nothing is created.', + }, +] as const + +const RELATIVE_TIME = new Intl.RelativeTimeFormat('en', { numeric: 'auto' }) + +/** Renders "3 minutes ago" for the activity list and credential rows. */ +function formatRelative(iso: string | null): string { + if (!iso) return 'never' + const deltaMs = new Date(iso).getTime() - Date.now() + const minutes = Math.round(deltaMs / 60_000) + if (Math.abs(minutes) < 60) return RELATIVE_TIME.format(minutes, 'minute') + const hours = Math.round(minutes / 60) + if (Math.abs(hours) < 48) return RELATIVE_TIME.format(hours, 'hour') + return RELATIVE_TIME.format(Math.round(hours / 24), 'day') +} + +function describeMapping( + mapping: ScimGroupMappingView, + names: { permissionGroups: Map; workspaces: Map } +): string { + switch (mapping.targetKind) { + case 'permission_group': + return names.permissionGroups.get(mapping.permissionGroupId ?? '') ?? 'Permission group' + case 'workspace': { + const name = names.workspaces.get(mapping.workspaceId ?? '') ?? 'Workspace' + const level = PERMISSION_OPTIONS.find((o) => o.value === mapping.permissionType)?.label + return level ? `${name} · ${level}` : name + } + case 'org_role': + return 'Organization admin' + } +} + +interface CredentialRowProps { + credential: ScimCredentialView + onRevoke: (credential: ScimCredentialView) => void +} + +function CredentialRow({ credential, onRevoke }: CredentialRowProps) { + const expired = credential.expiresAt ? new Date(credential.expiresAt) < new Date() : false + const expiry = credential.expiresAt + ? `${expired ? 'expired' : 'expires'} ${formatRelative(credential.expiresAt)}` + : 'no expiry' + return ( + } + title={{credential.tokenPrefix}…} + description={`Last used ${formatRelative(credential.lastUsedAt)} · ${expiry}`} + badge={expired ? Expired : undefined} + trailing={ + onRevoke(credential), destructive: true }]} + /> + } + /> + ) +} + +interface AddMappingProps { + organizationId: string + groupId: string + permissionGroups: Array<{ id: string; name: string }> + workspaces: Array<{ id: string; name: string }> +} + +function AddMapping({ organizationId, groupId, permissionGroups, workspaces }: AddMappingProps) { + const upsertMapping = useUpsertScimGroupMapping() + const [targetKind, setTargetKind] = useState('permission_group') + const [targetId, setTargetId] = useState('') + const [permission, setPermission] = useState('read') + + function buildBody(): ScimGroupMappingBody | null { + switch (targetKind) { + case 'permission_group': + return targetId ? { groupId, targetKind, permissionGroupId: targetId } : null + case 'workspace': + return targetId + ? { groupId, targetKind, workspaceId: targetId, permissionType: permission } + : null + case 'org_role': + return { groupId, targetKind, role: 'admin' } + } + } + + const body = buildBody() + + async function handleAdd() { + if (!body) return + try { + const result = await upsertMapping.mutateAsync({ organizationId, body }) + setTargetId('') + toast.success( + result.reconciledUsers === 0 + ? 'Mapping added' + : `Mapping added and applied to ${result.reconciledUsers} member${result.reconciledUsers === 1 ? '' : 's'}` + ) + } catch (error) { + toast.error(getErrorMessage(error, 'Failed to add mapping')) + } + } + + const targetOptions = targetKind === 'permission_group' ? permissionGroups : workspaces + + return ( +
+ { + setTargetKind(next as MappingTargetKind) + setTargetId('') + }} + options={[...TARGET_KIND_OPTIONS]} + /> + {targetKind !== 'org_role' && ( + ({ value: target.id, label: target.name }))} + /> + )} + {targetKind === 'workspace' && ( + setPermission(next as WorkspacePermission)} + options={[...PERMISSION_OPTIONS]} + /> + )} + + {upsertMapping.isPending ? 'Adding...' : 'Add mapping'} + +
+ ) +} + +interface GroupMappingsProps { + organizationId: string +} + +function GroupMappings({ organizationId }: GroupMappingsProps) { + const { data: groups, isLoading } = useScimGroupMappings(organizationId) + const { data: permissionGroups = [] } = usePermissionGroups(organizationId) + const { data: workspaces = [] } = useOrganizationWorkspaces(organizationId) + const deleteMapping = useDeleteScimGroupMapping() + + const names = { + permissionGroups: new Map(permissionGroups.map((group) => [group.id, group.name])), + workspaces: new Map(workspaces.map((workspace) => [workspace.id, workspace.name])), + } + + async function handleRemove(mapping: ScimGroupMappingView) { + try { + await deleteMapping.mutateAsync({ organizationId, mappingId: mapping.id }) + toast.success('Mapping removed') + } catch (error) { + toast.error(getErrorMessage(error, 'Failed to remove mapping')) + } + } + + if (isLoading) { + return Loading groups... + } + if (!groups || groups.length === 0) { + return ( + + No groups yet. Push a group from your identity provider and it appears here. + + ) + } + + return ( +
+ {groups.map((group) => ( +
+ +
+ {group.mappings.length > 0 && ( +
+ {group.mappings.map((mapping) => ( + void handleRemove(mapping)} + > + {describeMapping(mapping, names)} + + ))} +
+ )} + +
+
+ ))} +
+ ) +} + +interface ActivityListProps { + organizationId: string +} + +function ActivityList({ organizationId }: ActivityListProps) { + const { data: entries, isLoading } = useScimActivity(organizationId) + + if (isLoading) { + return Loading activity... + } + if (!entries || entries.length === 0) { + return No requests yet. + } + + return ( +
+ {entries.map((entry: ScimActivityEntry) => { + const failed = entry.status >= 400 + return ( +
+
+ + {entry.status} + + + {entry.method} {entry.path} + + + {formatRelative(entry.createdAt)} + +
+ {failed && entry.detail && ( +

+ {entry.scimType ? `${entry.scimType}: ` : ''} + {entry.detail} +

+ )} +
+ ) + })} +
+ ) +} + +interface ConnectionDetailsProps { + organizationId: string + connection: ScimConnectionView +} + +function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProps) { + const configure = useConfigureScimConnection() + const issueCredential = useIssueScimCredential() + const revokeCredential = useRevokeScimCredential() + const reconcile = useReconcileScimConnection() + + const [issuedSecret, setIssuedSecret] = useState(null) + const [pendingRevoke, setPendingRevoke] = useState(null) + + async function handleToggleSetting(key: (typeof SETTING_TOGGLES)[number]['key'], value: boolean) { + try { + await configure.mutateAsync({ + organizationId, + settings: { ...connection.settings, [key]: value }, + }) + } catch (error) { + toast.error(getErrorMessage(error, 'Failed to update setting')) + } + } + + async function handleIssue() { + try { + const result = await issueCredential.mutateAsync({ organizationId }) + setIssuedSecret(result.secret) + } catch (error) { + toast.error(getErrorMessage(error, 'Failed to issue credential')) + } + } + + async function handleConfirmRevoke() { + if (!pendingRevoke) return + try { + await revokeCredential.mutateAsync({ organizationId, credentialId: pendingRevoke.id }) + setPendingRevoke(null) + toast.success('Credential revoked') + } catch (error) { + toast.error(getErrorMessage(error, 'Failed to revoke credential')) + } + } + + async function handleReconcile() { + try { + const report = await reconcile.mutateAsync(organizationId) + const corrections = report.grantsAdded + report.grantsRemoved + toast.success( + corrections === 0 + ? `Checked ${report.reconciledUsers} members; nothing to correct` + : `Checked ${report.reconciledUsers} members; corrected ${corrections} grant${corrections === 1 ? '' : 's'}` + ) + } catch (error) { + toast.error(getErrorMessage(error, 'Reconciliation failed')) + } + } + + const activeCredentials = connection.credentials.filter( + (credential) => !credential.expiresAt || new Date(credential.expiresAt) > new Date() + ) + + return ( + <> + + + + + +

+ {connection.userCount} provisioned member{connection.userCount === 1 ? '' : 's'},{' '} + {connection.groupCount} group{connection.groupCount === 1 ? '' : 's'}. Last request{' '} + {formatRelative(connection.lastRequestAt)}. +

+
+ + {SETTING_TOGGLES.map((toggle) => ( + + void handleToggleSetting(toggle.key, checked)} + disabled={configure.isPending} + /> + + ))} + + +
+ {connection.credentials.length === 0 ? ( + No credentials yet. + ) : ( + connection.credentials.map((credential) => ( + + )) + )} +
+ = 2} + > + {issueCredential.isPending ? 'Issuing...' : 'Issue credential'} + +
+
+
+ + + + + + +
+ +
+ + {reconcile.isPending ? 'Reconciling...' : 'Reconcile now'} + +
+
+
+ + !open && setIssuedSecret(null)} + > + setIssuedSecret(null)}> + Credential issued + + + + + + + setIssuedSecret(null)} + primaryAction={{ label: 'Done', onClick: () => setIssuedSecret(null) }} + /> + + + !open && setPendingRevoke(null)} + title='Revoke credential' + text={[ + 'Revoke ', + { text: pendingRevoke?.tokenPrefix ?? '', bold: true }, + '? Your identity provider stops syncing the moment it next uses this token. Issue a new credential first if you are rotating.', + ]} + confirm={{ + label: 'Revoke', + onClick: handleConfirmRevoke, + pending: revokeCredential.isPending, + pendingLabel: 'Revoking...', + }} + /> + + ) +} + +/** + * Directory provisioning (SCIM) settings, rendered as a section of the SSO page. + * SSO decides who someone is; provisioning decides who exists and what they can + * reach, so the two are configured together. + */ +export function ScimSection({ organizationId }: ScimSectionProps) { + const { features } = useDeploymentShape() + const { data, isLoading } = useScimConnection(organizationId, features.scim) + const configure = useConfigureScimConnection() + + if (!features.scim) return null + + const connection = data?.connection ?? null + const enabled = connection?.status === 'active' + + async function handleToggleEnabled(next: boolean) { + try { + await configure.mutateAsync({ organizationId, status: next ? 'active' : 'disabled' }) + toast.success(next ? 'Directory provisioning enabled' : 'Directory provisioning disabled') + } catch (error) { + toast.error(getErrorMessage(error, 'Failed to update directory provisioning')) + } + } + + return ( + +
+ + void handleToggleEnabled(checked)} + disabled={isLoading || configure.isPending} + /> + + + {connection && enabled && ( + + )} +
+
+ ) +} diff --git a/apps/sim/ee/scim/hooks/scim.ts b/apps/sim/ee/scim/hooks/scim.ts new file mode 100644 index 00000000000..6de69554b41 --- /dev/null +++ b/apps/sim/ee/scim/hooks/scim.ts @@ -0,0 +1,169 @@ +import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' +import { requestJson } from '@/lib/api/client/request' +import { + configureScimConnectionContract, + deleteScimGroupMappingContract, + getScimConnectionContract, + issueScimCredentialContract, + listScimActivityContract, + listScimGroupMappingsContract, + reconcileScimConnectionContract, + revokeScimCredentialContract, + type ScimConnectionSettingsInput, + type ScimGroupMappingBody, + upsertScimGroupMappingContract, +} from '@/lib/api/contracts/organization-scim' + +export const SCIM_CONNECTION_STALE_TIME = 30 * 1000 +export const SCIM_MAPPINGS_STALE_TIME = 30 * 1000 +/** Activity is a debugging surface; a short window keeps it close to live. */ +export const SCIM_ACTIVITY_STALE_TIME = 10 * 1000 + +export const scimKeys = { + all: ['scim'] as const, + connections: () => [...scimKeys.all, 'connection'] as const, + connection: (organizationId?: string) => + [...scimKeys.connections(), organizationId ?? ''] as const, + mappingLists: () => [...scimKeys.all, 'mappings'] as const, + mappings: (organizationId?: string) => + [...scimKeys.mappingLists(), organizationId ?? ''] as const, + activities: () => [...scimKeys.all, 'activity'] as const, + activity: (organizationId?: string) => [...scimKeys.activities(), organizationId ?? ''] as const, +} + +export function useScimConnection(organizationId?: string, enabled = true) { + return useQuery({ + queryKey: scimKeys.connection(organizationId), + queryFn: ({ signal }) => + requestJson(getScimConnectionContract, { params: { id: organizationId as string }, signal }), + enabled: Boolean(organizationId) && enabled, + staleTime: SCIM_CONNECTION_STALE_TIME, + }) +} + +export function useScimGroupMappings(organizationId?: string, enabled = true) { + return useQuery({ + queryKey: scimKeys.mappings(organizationId), + queryFn: async ({ signal }) => { + const data = await requestJson(listScimGroupMappingsContract, { + params: { id: organizationId as string }, + signal, + }) + return data.groups + }, + enabled: Boolean(organizationId) && enabled, + staleTime: SCIM_MAPPINGS_STALE_TIME, + }) +} + +export function useScimActivity(organizationId?: string, enabled = true) { + return useQuery({ + queryKey: scimKeys.activity(organizationId), + queryFn: async ({ signal }) => { + const data = await requestJson(listScimActivityContract, { + params: { id: organizationId as string }, + query: { limit: 50 }, + signal, + }) + return data.entries + }, + enabled: Boolean(organizationId) && enabled, + staleTime: SCIM_ACTIVITY_STALE_TIME, + }) +} + +interface ConfigureScimConnectionVariables { + organizationId: string + status?: 'active' | 'disabled' + settings?: ScimConnectionSettingsInput +} + +export function useConfigureScimConnection() { + const queryClient = useQueryClient() + return useMutation({ + mutationFn: async ({ organizationId, ...body }: ConfigureScimConnectionVariables) => + requestJson(configureScimConnectionContract, { params: { id: organizationId }, body }), + onSettled: (_data, _error, { organizationId }) => { + queryClient.invalidateQueries({ queryKey: scimKeys.connection(organizationId) }) + }, + }) +} + +interface IssueScimCredentialVariables { + organizationId: string + expiresInDays?: number +} + +export function useIssueScimCredential() { + const queryClient = useQueryClient() + return useMutation({ + mutationFn: async ({ organizationId, expiresInDays }: IssueScimCredentialVariables) => + requestJson(issueScimCredentialContract, { + params: { id: organizationId }, + body: expiresInDays ? { expiresInDays } : {}, + }), + onSettled: (_data, _error, { organizationId }) => { + queryClient.invalidateQueries({ queryKey: scimKeys.connection(organizationId) }) + }, + }) +} + +interface RevokeScimCredentialVariables { + organizationId: string + credentialId: string +} + +export function useRevokeScimCredential() { + const queryClient = useQueryClient() + return useMutation({ + mutationFn: async ({ organizationId, credentialId }: RevokeScimCredentialVariables) => + requestJson(revokeScimCredentialContract, { params: { id: organizationId, credentialId } }), + onSettled: (_data, _error, { organizationId }) => { + queryClient.invalidateQueries({ queryKey: scimKeys.connection(organizationId) }) + }, + }) +} + +interface UpsertScimGroupMappingVariables { + organizationId: string + body: ScimGroupMappingBody +} + +export function useUpsertScimGroupMapping() { + const queryClient = useQueryClient() + return useMutation({ + mutationFn: async ({ organizationId, body }: UpsertScimGroupMappingVariables) => + requestJson(upsertScimGroupMappingContract, { params: { id: organizationId }, body }), + onSettled: (_data, _error, { organizationId }) => { + queryClient.invalidateQueries({ queryKey: scimKeys.mappings(organizationId) }) + }, + }) +} + +interface DeleteScimGroupMappingVariables { + organizationId: string + mappingId: string +} + +export function useDeleteScimGroupMapping() { + const queryClient = useQueryClient() + return useMutation({ + mutationFn: async ({ organizationId, mappingId }: DeleteScimGroupMappingVariables) => + requestJson(deleteScimGroupMappingContract, { params: { id: organizationId, mappingId } }), + onSettled: (_data, _error, { organizationId }) => { + queryClient.invalidateQueries({ queryKey: scimKeys.mappings(organizationId) }) + }, + }) +} + +export function useReconcileScimConnection() { + const queryClient = useQueryClient() + return useMutation({ + mutationFn: async (organizationId: string) => + requestJson(reconcileScimConnectionContract, { params: { id: organizationId } }), + onSettled: (_data, _error, organizationId) => { + queryClient.invalidateQueries({ queryKey: scimKeys.connection(organizationId) }) + queryClient.invalidateQueries({ queryKey: scimKeys.mappings(organizationId) }) + }, + }) +} diff --git a/apps/sim/ee/sso/components/sso-settings.tsx b/apps/sim/ee/sso/components/sso-settings.tsx index 630d3edc260..551ebaea63b 100644 --- a/apps/sim/ee/sso/components/sso-settings.tsx +++ b/apps/sim/ee/sso/components/sso-settings.tsx @@ -35,6 +35,7 @@ import { SettingsPanel } from '@/app/workspace/[workspaceId]/settings/components import { SettingsSection } from '@/app/workspace/[workspaceId]/settings/components/settings-section/settings-section' import { useSettingsUnsavedGuard } from '@/app/workspace/[workspaceId]/settings/hooks/use-settings-unsaved-guard' import { SettingRow } from '@/ee/components/setting-row' +import { ScimSection } from '@/ee/scim/components/scim-section' import { VerifiedDomainsSection } from '@/ee/sso/components/verified-domains-section' import { SSO_TRUSTED_PROVIDERS } from '@/ee/sso/constants' import { useConfigureSSO, useSSOProviders } from '@/ee/sso/hooks/sso' @@ -642,6 +643,7 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) { return ( +
@@ -756,6 +758,7 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) { ]} > +
diff --git a/apps/sim/lib/api-key/service.ts b/apps/sim/lib/api-key/service.ts index ef90a17da78..edcee7df2f1 100644 --- a/apps/sim/lib/api-key/service.ts +++ b/apps/sim/lib/api-key/service.ts @@ -101,10 +101,11 @@ export async function authenticateApiKeyFromHeader( /** * A suspension deliberately leaves the account's resources intact, so unlike - * a ban it does not delete the keys. Refusing them here is what actually - * ends machine access for a deactivated member. + * a ban it does not delete the keys. Refusing a personal key here is what + * ends the member's own machine access. A workspace key is shared and + * belongs to the workspace, so one member's suspension does not break it. */ - if (record.userSuspendedAt) return INVALID + if (record.userSuspendedAt && keyType === 'personal') return INVALID if (options.userId && record.userId !== options.userId) return INVALID if (options.keyTypes?.length && !options.keyTypes.includes(keyType)) return INVALID diff --git a/apps/sim/lib/api/contracts/organization-scim.ts b/apps/sim/lib/api/contracts/organization-scim.ts index 23ecdfa0761..df8eaf55ec8 100644 --- a/apps/sim/lib/api/contracts/organization-scim.ts +++ b/apps/sim/lib/api/contracts/organization-scim.ts @@ -124,28 +124,30 @@ export const listScimGroupMappingsContract = defineRouteContract({ }, }) +export const scimGroupMappingBodySchema = z.discriminatedUnion('targetKind', [ + z.object({ + groupId: z.string().min(1).max(128), + targetKind: z.literal('permission_group'), + permissionGroupId: z.string().min(1).max(128), + }), + z.object({ + groupId: z.string().min(1).max(128), + targetKind: z.literal('workspace'), + workspaceId: z.string().min(1).max(128), + permissionType: z.enum(['admin', 'write', 'read']), + }), + z.object({ + groupId: z.string().min(1).max(128), + targetKind: z.literal('org_role'), + role: z.literal('admin'), + }), +]) + export const upsertScimGroupMappingContract = defineRouteContract({ method: 'POST', path: '/api/organizations/[id]/scim/mappings', params: organizationParamsSchema, - body: z.discriminatedUnion('targetKind', [ - z.object({ - groupId: z.string().min(1).max(128), - targetKind: z.literal('permission_group'), - permissionGroupId: z.string().min(1).max(128), - }), - z.object({ - groupId: z.string().min(1).max(128), - targetKind: z.literal('workspace'), - workspaceId: z.string().min(1).max(128), - permissionType: z.enum(['admin', 'write', 'read']), - }), - z.object({ - groupId: z.string().min(1).max(128), - targetKind: z.literal('org_role'), - role: z.literal('admin'), - }), - ]), + body: scimGroupMappingBodySchema, response: { mode: 'json', schema: z.object({ mapping: groupMappingSchema, reconciledUsers: z.number().int() }), @@ -163,6 +165,18 @@ export const deleteScimGroupMappingContract = defineRouteContract({ }, }) +const scimActivityEntrySchema = z.object({ + id: z.string(), + method: z.string(), + path: z.string(), + status: z.number().int(), + scimType: z.string().nullable(), + detail: z.string().nullable(), + userAgent: z.string().nullable(), + durationMs: z.number().int(), + createdAt: z.string(), +}) + export const listScimActivityContract = defineRouteContract({ method: 'GET', path: '/api/organizations/[id]/scim/activity', @@ -170,21 +184,7 @@ export const listScimActivityContract = defineRouteContract({ query: z.object({ limit: z.coerce.number().int().min(1).max(200).optional() }), response: { mode: 'json', - schema: z.object({ - entries: z.array( - z.object({ - id: z.string(), - method: z.string(), - path: z.string(), - status: z.number().int(), - scimType: z.string().nullable(), - detail: z.string().nullable(), - userAgent: z.string().nullable(), - durationMs: z.number().int(), - createdAt: z.string(), - }) - ), - }), + schema: z.object({ entries: z.array(scimActivityEntrySchema) }), }, }) @@ -202,6 +202,8 @@ export const reconcileScimConnectionContract = defineRouteContract({ }, }) +export type ScimGroupMappingBody = z.input +export type ScimActivityEntry = z.output export type ScimConnectionView = z.output export type ScimCredentialView = z.output export type ScimGroupMappingView = z.output diff --git a/apps/sim/lib/api/contracts/scim.ts b/apps/sim/lib/api/contracts/scim.ts index dc2ba60fb52..d1b3f06f059 100644 --- a/apps/sim/lib/api/contracts/scim.ts +++ b/apps/sim/lib/api/contracts/scim.ts @@ -2,13 +2,10 @@ import { z } from 'zod' import { defineRouteContract } from '@/lib/api/contracts/types' import { SCIM_ENTERPRISE_USER_SCHEMA, - SCIM_ERROR_SCHEMA, - SCIM_GROUP_SCHEMA, SCIM_LIST_RESPONSE_SCHEMA, SCIM_MAX_GROUP_MEMBERS, SCIM_MAX_PATCH_OPERATIONS, SCIM_PATCH_OP_SCHEMA, - SCIM_USER_SCHEMA, } from '@/lib/scim/protocol/constants' import { normalizeScimBoolean, unwrapSingleElement } from '@/lib/scim/protocol/normalize' @@ -61,20 +58,23 @@ const scimEnterpriseSchema = z.looseObject({ /** * An inbound User. * - * `password` is absent on purpose. Okta sends one on every create even when - * password sync is off; naming it here would put a credential into the parsed - * request object and from there into logs and error details. + * `password` is stripped during parsing. Okta sends one on every create even + * when password sync is off, and Sim never stores or uses it; dropping it here + * keeps the credential out of the parsed request object and therefore out of + * every log line and error detail downstream. */ -export const scimUserWriteSchema = z.looseObject({ - schemas: z.array(z.string().max(256)).min(1, 'schemas must name at least one URN').max(10), - userName: z.string().trim().min(1, 'userName must not be empty').max(320), - externalId: z.string().trim().max(256).optional(), - active: scimBoolean.optional(), - displayName: z.string().max(256).optional(), - name: scimNameSchema.optional(), - emails: z.array(scimEmailSchema).max(20).optional(), - [SCIM_ENTERPRISE_USER_SCHEMA]: scimEnterpriseSchema.optional(), -}) +export const scimUserWriteSchema = z + .looseObject({ + schemas: z.array(z.string().max(256)).min(1, 'schemas must name at least one URN').max(10), + userName: z.string().trim().min(1, 'userName must not be empty').max(320), + externalId: z.string().trim().max(256).optional(), + active: scimBoolean.optional(), + displayName: z.string().max(256).optional(), + name: scimNameSchema.optional(), + emails: z.array(scimEmailSchema).max(20).optional(), + [SCIM_ENTERPRISE_USER_SCHEMA]: scimEnterpriseSchema.optional(), + }) + .transform(({ password: _password, ...rest }) => rest) /** What a client may send. */ export type ScimUserWrite = z.input /** What the route receives after parsing, which is what the canonicalizer reads. */ @@ -195,13 +195,6 @@ function listResponseSchema(item: Item) { }) } -export const scimErrorResponseSchema = z.object({ - schemas: z.tuple([z.literal(SCIM_ERROR_SCHEMA)]), - status: z.string(), - scimType: z.string().optional(), - detail: z.string(), -}) - export const listScimUsersContract = defineRouteContract({ method: 'GET', path: '/api/scim/v2/Users', @@ -302,9 +295,3 @@ export const deleteScimGroupContract = defineRouteContract({ params: scimResourceParamsSchema, response: { mode: 'empty', status: 204 }, }) - -export const SCIM_SUPPORTED_SCHEMA_URNS = [ - SCIM_USER_SCHEMA, - SCIM_ENTERPRISE_USER_SCHEMA, - SCIM_GROUP_SCHEMA, -] as const diff --git a/apps/sim/lib/api/server/routes/scim-route.ts b/apps/sim/lib/api/server/routes/scim-route.ts index 9fd486256fc..af43d707448 100644 --- a/apps/sim/lib/api/server/routes/scim-route.ts +++ b/apps/sim/lib/api/server/routes/scim-route.ts @@ -1,10 +1,10 @@ -import type { Principal, ScimConnectionPrincipal } from '@sim/auth/principal' +import type { ScimConnectionPrincipal } from '@sim/auth/principal' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import type { AnyApiRouteContract, ContractJsonResponse } from '@/lib/api/contracts/types' import { type ParsedRequest, parseRequest } from '@/lib/api/server/validation' import type { ApplicationOperation, OperationUseCase } from '@/lib/core/application/operation' -import { RateLimiter } from '@/lib/core/rate-limiter' +import { enforceIpRateLimit, RateLimiter } from '@/lib/core/rate-limiter' import { getBaseUrl } from '@/lib/core/utils/urls' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import type { ScimConnectionAuthenticator } from '@/lib/scim/authenticate' @@ -33,17 +33,12 @@ const rateLimiter = new RateLimiter() * so request ids, logging, and abort handling stay identical. */ -/** Which credential scope a route requires, derived from its contract. */ -export type ScimRouteScope = 'users:read' | 'users:write' | 'groups:read' | 'groups:write' - export interface ScimPresenterContext { - principal: ScimConnectionPrincipal baseUrl: string } interface ScimRouteOptions { contract: C - scope: ScimRouteScope operation: O useCase: OperationUseCase, I, R> mapInput( @@ -173,14 +168,12 @@ export function createScimRouteBuilder(dependencies: ScimRouteDependencies) { } assertAcceptableMediaType(request) + /** + * Scope is enforced by the use-case wrapper from the operation's own + * declaration, so the route cannot disagree with it. The builder only + * authenticates and admits. + */ principal = await dependencies.authenticate(request) - if (!principal.scopes.includes(options.scope)) { - throw new ScimError( - 403, - undefined, - `The credential does not carry the ${options.scope} scope` - ) - } await enforceConnectionRateLimit(principal) const parsed = await parseRequest(options.contract, request, context ?? {}, { @@ -222,13 +215,13 @@ export function createScimRouteBuilder(dependencies: ScimRouteDependencies) { }) } - const presented = options.present!(result, { principal, baseUrl }) + const presented = options.present!(result, { baseUrl }) const validated = options.contract.response.mode === 'json' ? options.contract.response.schema.parse(presented) : presented status = successStatus - return scimResponse(validated, status, options.headers?.(result, { principal, baseUrl })) + return scimResponse(validated, status, options.headers?.(result, { baseUrl })) } catch (error) { const scim = toScimError(error) status = scim.status @@ -288,6 +281,13 @@ export function defineScimDiscoveryRoute( if (request.method !== 'GET') { throw new ScimError(405, undefined, `${request.method} is not supported here`) } + /** Unauthenticated, so the only admission control available is by address. */ + const limited = await enforceIpRateLimit('scim-discovery', request) + if (limited) { + throw new ScimError(429, undefined, 'Rate limit exceeded', { + 'Retry-After': limited.headers.get('Retry-After') ?? '60', + }) + } const params = context?.params ? await context.params : {} return scimResponse(build(`${getBaseUrl()}${SCIM_BASE_PATH}`, params), 200) } catch (error) { @@ -302,10 +302,3 @@ export function defineScimDiscoveryRoute( } ) } - -/** Narrows an arbitrary principal to a SCIM connection, for use-case entry points. */ -export function isScimConnectionPrincipal( - principal: Principal -): principal is ScimConnectionPrincipal { - return principal.kind === 'scim_connection' -} diff --git a/apps/sim/lib/auth/ban.ts b/apps/sim/lib/auth/ban.ts index 8ca733d2994..6c0d0379cd9 100644 --- a/apps/sim/lib/auth/ban.ts +++ b/apps/sim/lib/auth/ban.ts @@ -12,26 +12,44 @@ export function isBanActive(row: { banned: boolean | null; banExpires: Date | nu return true } +/** + * True when the account cannot act: an active ban, or a suspension. + * + * A suspension is what a directory deactivation applies. It must stop the + * person's scheduled runs, webhook triggers, and inbox tasks the same way a ban + * does — the identity provider said "this person is gone", and their + * automations continuing to run under their credentials would be exactly the + * outcome deprovisioning exists to prevent. + */ +export function isAccountBlocked(row: { + banned: boolean | null + banExpires: Date | null + suspendedAt?: Date | null +}): boolean { + return isBanActive(row) || Boolean(row.suspendedAt) +} + /** * True when a raw email (e.g. an inbound sender) is blocked: it is in the * appconfig blocked-emails list, its domain is in the blocked-domains list, - * or it belongs to an account with an active ban. Covers senders that don't - * resolve to a known user id. + * or it belongs to an account with an active ban or suspension. Covers senders + * that don't resolve to a known user id. */ export async function isEmailBlocked(email: string | null | undefined): Promise { if (!email) return false const accessControl = await getAccessControlConfig() if (isEmailBlockedByAccessControl(email, accessControl)) return true const rows = await db - .select({ banned: user.banned, banExpires: user.banExpires }) + .select({ banned: user.banned, banExpires: user.banExpires, suspendedAt: user.suspendedAt }) .from(user) .where(sql`lower(${user.email}) = ${email.toLowerCase()}`) - return rows.some(isBanActive) + return rows.some(isAccountBlocked) } /** * Returns the subset of the given user ids that are currently blocked: an - * active account ban, or an email/domain in the appconfig blocked lists. + * active account ban or suspension, or an email/domain in the appconfig + * blocked lists. * One user query plus the cached access-control fetch. Throws on db * failure — callers must fail closed. */ @@ -42,12 +60,20 @@ export async function getActivelyBannedUserIds(userIds: string[]): Promise isBanActive(row) || isEmailBlockedByAccessControl(row.email, accessControl)) + .filter( + (row) => isAccountBlocked(row) || isEmailBlockedByAccessControl(row.email, accessControl) + ) .map((row) => row.id) } diff --git a/apps/sim/lib/invitations/workspace-invitations.ts b/apps/sim/lib/invitations/workspace-invitations.ts index 329b746183e..141d1c4c30d 100644 --- a/apps/sim/lib/invitations/workspace-invitations.ts +++ b/apps/sim/lib/invitations/workspace-invitations.ts @@ -481,7 +481,12 @@ export async function createWorkspaceInvitation({ const allWorkspaceIds = context.targets.map((target) => target.workspaceId) const existingUser = await db - .select({ id: user.id, scimManaged: scimManagedUserPredicate(user.id) }) + .select({ + id: user.id, + scimManaged: organizationId + ? scimManagedUserPredicate(organizationId, user.id) + : sql`false`, + }) .from(user) .where(sql`lower(${user.email}) = ${normalizedEmail}`) .then((rows) => rows[0]) diff --git a/apps/sim/lib/organizations/members/lifecycle.ts b/apps/sim/lib/organizations/members/lifecycle.ts index 1b018792521..9277282c2bf 100644 --- a/apps/sim/lib/organizations/members/lifecycle.ts +++ b/apps/sim/lib/organizations/members/lifecycle.ts @@ -97,7 +97,6 @@ export async function revokePersonalApiKeysTx( export interface SuspendMemberResult { suspended: boolean sessionsRevoked: number - apiKeysRevoked: number } /** @@ -108,7 +107,9 @@ export interface SuspendMemberResult { * archives every workspace the user owns and deletes their API keys, and there * is no server-side path to undo it. A directory deactivation is routine and * reversible — someone on leave, or moved between teams — so it must not destroy - * the work they own. + * the work they own. That includes their API keys: the key rows stay, and the + * authentication paths refuse them while `suspendedAt` is set, so reactivation + * restores every automation exactly as it was. */ export async function suspendMemberTx( tx: DbOrTx, @@ -129,13 +130,8 @@ export async function suspendMemberTx( userId: params.userId, organizationId: params.organizationId, }) - const keys = await revokePersonalApiKeysTx(tx, { userId: params.userId }) - return { - suspended: Boolean(updated), - sessionsRevoked: sessions.revoked, - apiKeysRevoked: keys.revoked, - } + return { suspended: Boolean(updated), sessionsRevoked: sessions.revoked } } /** @@ -200,8 +196,3 @@ export async function changeMemberRoleTx( }) return { changed: true, from: current.role, to: params.role } } - -/** True when the account is currently suspended. */ -export function isSuspended(row: { suspendedAt: Date | null }): boolean { - return row.suspendedAt !== null -} diff --git a/apps/sim/lib/scim/application/admin/manage-connection.ts b/apps/sim/lib/scim/application/admin/manage-connection.ts index 97f59d46a4d..a4c0dca22c4 100644 --- a/apps/sim/lib/scim/application/admin/manage-connection.ts +++ b/apps/sim/lib/scim/application/admin/manage-connection.ts @@ -27,14 +27,10 @@ import { OrchestrationError } from '@/lib/core/orchestration/types' import { getBaseUrl } from '@/lib/core/utils/urls' import { defineAuthorizedScimAdminUseCase } from '@/lib/scim/application/authorized-scim-admin-use-case' import { scimAdminOperations } from '@/lib/scim/application/operations' -import { - activeCredentialCondition, - generateScimToken, - pruneExpiredCredentials, -} from '@/lib/scim/authenticate' +import { activeCredentialCondition, generateScimToken } from '@/lib/scim/authenticate' import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' -import { listScimUserIds } from '@/lib/scim/repository/users' +import { reconcileConnection } from '@/lib/scim/reconcile/job' /** * Administering the connection: enabling it, issuing and revoking credentials, @@ -266,9 +262,6 @@ export const issueScimCredential = defineAuthorizedScimAdminUseCase({ ) } - /** Sweep lapsed credentials first so an expired one does not hold a slot. */ - await pruneExpiredCredentials(connection.id) - const [active] = await db .select({ value: count() }) .from(scimCredential) @@ -701,51 +694,32 @@ export const reconcileScimConnection = defineAuthorizedScimAdminUseCase({ operation: scimAdminOperations.reconcile, async execute({ input }: { input: { organizationId: string } }) { const [connection] = await db - .select({ id: scimConnection.id, settings: scimConnection.settings }) + .select({ + id: scimConnection.id, + organizationId: scimConnection.organizationId, + settings: scimConnection.settings, + }) .from(scimConnection) .where(eq(scimConnection.organizationId, input.organizationId)) .limit(1) if (!connection) throw new OrchestrationError('not_found', 'Directory provisioning is not enabled') - let reconciledUsers = 0 - let grantsAdded = 0 - let grantsRemoved = 0 - let cursor: string | undefined - /** - * Paged rather than loaded whole: a large directory has tens of thousands of - * users, and one transaction over all of them would hold locks far too long. + * The same lease-protected pass the scheduler runs, so an administrator's + * click and the hourly sweep can never reconcile one connection at once. */ - for (;;) { - const page = await listScimUserIds(db, { - connectionId: connection.id, - ...(cursor ? { afterOrderKey: cursor } : {}), - limit: 200, - }) - if (page.length === 0) break - - await db.transaction(async (tx) => { - for (const row of page) { - const delta = await reconcileUserProjection(tx, { - connectionId: connection.id, - organizationId: input.organizationId, - scimUserId: row.id, - settings: connection.settings, - }) - reconciledUsers += 1 - grantsAdded += delta.added.length + delta.raised.length - grantsRemoved += delta.removed.length - } - }) - cursor = page[page.length - 1].orderKey + const report = await reconcileConnection(connection) + if (!report) { + throw new OrchestrationError( + 'conflict', + 'A reconciliation is already running for this organization; try again in a few minutes' + ) + } + return { + reconciledUsers: report.reconciledUsers, + grantsAdded: report.grantsAdded, + grantsRemoved: report.grantsRemoved, } - - await db - .update(scimConnection) - .set({ reconciledAt: new Date() }) - .where(eq(scimConnection.id, connection.id)) - - return { reconciledUsers, grantsAdded, grantsRemoved } }, }) diff --git a/apps/sim/lib/scim/application/groups/manage-groups.ts b/apps/sim/lib/scim/application/groups/manage-groups.ts index 0e37b137cae..f829b3ca875 100644 --- a/apps/sim/lib/scim/application/groups/manage-groups.ts +++ b/apps/sim/lib/scim/application/groups/manage-groups.ts @@ -9,6 +9,7 @@ import { type ScimUseCaseArgs, } from '@/lib/scim/application/authorized-scim-use-case' import { scimOperations } from '@/lib/scim/application/operations' +import { autoMapPermissionGroupByName } from '@/lib/scim/projection/auto-map' import { reconcileUsersProjection } from '@/lib/scim/projection/reconcile-user' import type { CanonicalScimGroup } from '@/lib/scim/protocol/canonical' import { SCIM_MAX_GROUP_MEMBERS } from '@/lib/scim/protocol/constants' @@ -27,7 +28,7 @@ import { addGroupMember, assertConnectionOwnsUsers, countGroupMembers, - deleteScimGroup, + deleteScimGroupRow, findScimGroupById, insertScimGroup, loadGroupMemberIds, @@ -142,6 +143,8 @@ export interface ScimGroupWriteResult { displayName: string resource: ScimGroupResource touchedUserIds: string[] + /** Whether the name or external id changed; always true for a create. */ + renamed: boolean } export const createScimGroup = defineAuthorizedScimUseCase({ @@ -168,6 +171,14 @@ export const createScimGroup = defineAuthorizedScimUseCase({ } await assertMemberCount(tx, created.id) + if (context.connection.settings.autoMapPermissionGroupsByName) { + await autoMapPermissionGroupByName(tx, { + organizationId: context.organizationId, + scimGroupId: created.id, + displayName: created.displayName, + }) + } + await reconcileUsersProjection(tx, { connectionId: context.connection.id, organizationId: context.organizationId, @@ -181,6 +192,7 @@ export const createScimGroup = defineAuthorizedScimUseCase({ displayName: created.displayName, resource: toGroupResource({ ...created, members }, context.baseUrl), touchedUserIds: group.memberIds, + renamed: true, } }) }, @@ -220,6 +232,16 @@ export const replaceScimGroup = defineAuthorizedScimUseCase({ displayName: input.group.displayName, externalId: input.group.externalId ?? null, }) + if ( + context.connection.settings.autoMapPermissionGroupsByName && + input.group.displayName !== current.displayName + ) { + await autoMapPermissionGroupByName(tx, { + organizationId: context.organizationId, + scimGroupId: current.id, + displayName: input.group.displayName, + }) + } const before = await loadGroupMemberIds(tx, current.id) const desired = new Set(input.group.memberIds) @@ -250,16 +272,23 @@ export const replaceScimGroup = defineAuthorizedScimUseCase({ displayName: refreshed.displayName, resource: toGroupResource({ ...refreshed, members }, context.baseUrl), touchedUserIds: [...touched], + renamed: + current.displayName !== refreshed.displayName || + (current.externalId ?? null) !== (refreshed.externalId ?? null), } }) }, - projectAudit: ({ result }) => ({ - action: AuditAction.SCIM_GROUP_UPDATED, - resourceType: AuditResourceType.SCIM_GROUP, - resourceId: result.groupId, - resourceName: result.displayName, - metadata: { membersChanged: result.touchedUserIds.length }, - }), + /** Okta re-sends the whole group each cycle; an unchanged one records nothing. */ + projectAudit: ({ result }) => + result.touchedUserIds.length === 0 && !result.renamed + ? undefined + : { + action: AuditAction.SCIM_GROUP_UPDATED, + resourceType: AuditResourceType.SCIM_GROUP, + resourceId: result.groupId, + resourceName: result.displayName, + metadata: { membersChanged: result.touchedUserIds.length, renamed: result.renamed }, + }, }) export interface PatchScimGroupInput { @@ -322,6 +351,17 @@ export const patchScimGroup = defineAuthorizedScimUseCase({ ...(patch.externalId !== undefined ? { externalId: patch.externalId } : {}), }) } + if ( + renamed && + patch.displayName && + context.connection.settings.autoMapPermissionGroupsByName + ) { + await autoMapPermissionGroupByName(tx, { + organizationId: context.organizationId, + scimGroupId: current.id, + displayName: patch.displayName, + }) + } if (patch.members !== undefined) { const before = await loadGroupMemberIds(tx, current.id) const desired = new Set(patch.members) @@ -368,7 +408,7 @@ export interface DeleteScimGroupInput { groupId: string } -export const deleteScimGroupUseCase = defineAuthorizedScimUseCase({ +export const deleteScimGroup = defineAuthorizedScimUseCase({ operation: scimOperations.deleteGroup, async execute({ input, context }: ScimUseCaseArgs) { return db.transaction(async (tx) => { @@ -381,7 +421,7 @@ export const deleteScimGroupUseCase = defineAuthorizedScimUseCase({ * projection has to be re-run for them afterwards. */ const memberIds = await loadGroupMemberIds(tx, current.id) - await deleteScimGroup(tx, current.id) + await deleteScimGroupRow(tx, current.id) await reconcileUsersProjection(tx, { connectionId: context.connection.id, organizationId: context.organizationId, diff --git a/apps/sim/lib/scim/application/operations.ts b/apps/sim/lib/scim/application/operations.ts index 0790347ee8e..6461f51d596 100644 --- a/apps/sim/lib/scim/application/operations.ts +++ b/apps/sim/lib/scim/application/operations.ts @@ -211,6 +211,3 @@ export const scimAdminOperations = { workspaceApiKey: 'deny', }), } as const - -export type AnyScimOperation = (typeof scimOperations)[keyof typeof scimOperations] -export type AnyScimAdminOperation = (typeof scimAdminOperations)[keyof typeof scimAdminOperations] diff --git a/apps/sim/lib/scim/application/users/deprovision-user.ts b/apps/sim/lib/scim/application/users/deprovision-user.ts index d4cc1a55906..1207684c65a 100644 --- a/apps/sim/lib/scim/application/users/deprovision-user.ts +++ b/apps/sim/lib/scim/application/users/deprovision-user.ts @@ -17,7 +17,6 @@ import { } from '@/lib/scim/application/authorized-scim-use-case' import { scimOperations } from '@/lib/scim/application/operations' import { upsertTombstone } from '@/lib/scim/identity/resolve-user' -import { withdrawAllProjectedGrants } from '@/lib/scim/projection/reconcile-user' import { notFound, ScimError } from '@/lib/scim/protocol/errors' import { deleteScimUser, findScimUserById } from '@/lib/scim/repository/users' @@ -30,6 +29,8 @@ export interface DeprovisionScimUserInput { export interface DeprovisionScimUserResult { scimUserId: string userId: string + /** False when the account had already left the organization by other means. */ + removedFromOrganization: boolean } /** @@ -70,24 +71,13 @@ export const deprovisionScimUser = defineAuthorizedScimUseCase({ ) } - /** - * Withdraw directory-granted access first, in its own transaction, so the - * removal below sees a user with nothing left to reassign from a group. - */ - await db.transaction(async (tx) => { - await withdrawAllProjectedGrants(tx, { - connectionId: context.connection.id, - organizationId: context.organizationId, - scimUserId: current.id, - userId: current.userId, - }) - }) - if (membership) { /** - * Owns its own invitation-safe lock scope and reassigns everything the - * member owned, so it runs on its own rather than inside a transaction - * this use case controls. + * Owns its own invitation-safe lock scope, clears every workspace + * permission and permission-group membership in the organization, and + * reassigns everything the member owned — so directory-granted access is + * withdrawn here as a consequence, and the projection rows cascade away + * with the SCIM user below. */ const removal = await removeUserFromOrganization({ userId: current.userId, @@ -118,7 +108,11 @@ export const deprovisionScimUser = defineAuthorizedScimUseCase({ await deleteScimUser(tx, current.id) }) - return { scimUserId: current.id, userId: current.userId } + return { + scimUserId: current.id, + userId: current.userId, + removedFromOrganization: Boolean(membership), + } }, projectAudit: ({ result, context }) => [ @@ -128,13 +122,17 @@ export const deprovisionScimUser = defineAuthorizedScimUseCase({ resourceId: result.userId, metadata: { scimUserId: result.scimUserId }, }, - { - action: AuditAction.ORG_MEMBER_REMOVED, - resourceType: AuditResourceType.ORGANIZATION, - resourceId: context.organizationId, - description: 'Removed from the organization through directory deprovisioning', - metadata: { targetUserId: result.userId, scimUserId: result.scimUserId }, - }, + ...(result.removedFromOrganization + ? [ + { + action: AuditAction.ORG_MEMBER_REMOVED, + resourceType: AuditResourceType.ORGANIZATION, + resourceId: context.organizationId, + description: 'Removed from the organization through directory deprovisioning', + metadata: { targetUserId: result.userId, scimUserId: result.scimUserId }, + }, + ] + : []), ], afterSuccess: async ({ result, context }) => { diff --git a/apps/sim/lib/scim/application/users/provision-user.ts b/apps/sim/lib/scim/application/users/provision-user.ts index 17cdb91d0ec..14d8c883433 100644 --- a/apps/sim/lib/scim/application/users/provision-user.ts +++ b/apps/sim/lib/scim/application/users/provision-user.ts @@ -1,12 +1,15 @@ import { AuditAction, AuditResourceType } from '@sim/audit' import { db } from '@sim/db' -import { type ScimUserAttributes, subscription } from '@sim/db/schema' +import { type ScimUserAttributes, subscription, user } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { and, desc, eq, inArray } from 'drizzle-orm' import { auth } from '@/lib/auth' import { applySessionPolicyToNewMember } from '@/lib/auth/session-policy' import { syncUsageLimitsFromSubscription } from '@/lib/billing/core/usage' -import { ensureUserInOrganizationTx } from '@/lib/billing/organizations/membership' +import { + ensureUserInOrganizationTx, + getUserOrganization, +} from '@/lib/billing/organizations/membership' import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' import { isTeam } from '@/lib/billing/plan-helpers' import { ENTITLED_SUBSCRIPTION_STATUSES } from '@/lib/billing/subscriptions/utils' @@ -28,6 +31,8 @@ import { primaryEmail } from '@/lib/scim/protocol/canonical' import { ScimError, uniqueness } from '@/lib/scim/protocol/errors' import { toUserResource } from '@/lib/scim/protocol/resources' import { + assertUserNameAvailable, + deleteScimUser, findScimUserById, findScimUserByUserId, insertScimUser, @@ -44,6 +49,8 @@ export interface ProvisionScimUserResult { scimUserId: string userId: string createdAccount: boolean + /** False when the account was already a member and only the SCIM link was new. */ + joinedOrganization: boolean organizationId: string resource: ReturnType } @@ -121,6 +128,13 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ let userId: string let createdAccount = false + /** + * `userName` is unique per connection. Checked up front for a message the + * directory administrator can read; a race that slips past this lands on the + * unique index and is rendered as the same 409 by the error mapper. + */ + await assertUserNameAvailable(db, context.connection.id, attributes.userName) + if (resolution.action === 'create') { await assertEmailAvailable(db, email) const created = await auth.api.createUser({ @@ -138,51 +152,84 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ const existing = await findScimUserByUserId(db, context.connection.id, userId) if (existing) { - throw uniqueness('This directory already provisions the user') - } - - const scimUserId = await db.transaction(async (tx) => { - const seatPolicy = await resolveSeatPolicy(tx, context.organizationId) - const membership = await ensureUserInOrganizationTx(tx, { - userId, - organizationId: context.organizationId, - role: 'member', - ...seatPolicy, - }) - if (!membership.success) throw membershipFailure(membership.failureCode) - - const inserted = await insertScimUser(tx, { - connectionId: context.connection.id, - userId, - attributes, - active: attributes.active, - }) - /** - * Microsoft Entra pre-provisions a disabled account before its start date, - * so a create can arrive already inactive and must land suspended rather - * than briefly usable. + * A SCIM row whose account has already left the organization is the + * residue of a deprovisioning interrupted between its two commits. The + * directory is telling us the person is back; clearing the stale row lets + * it proceed rather than reporting a conflict nobody can act on. */ - if (!attributes.active) { - await suspendMemberTx(tx, { + const stillMember = await getUserOrganization(userId) + if (stillMember?.organizationId === context.organizationId) { + throw uniqueness('This directory already provisions the user') + } + await deleteScimUser(db, existing.id) + } + + let provisioned: { scimUserId: string; joinedOrganization: boolean } + try { + provisioned = await db.transaction(async (tx) => { + const seatPolicy = await resolveSeatPolicy(tx, context.organizationId) + const membership = await ensureUserInOrganizationTx(tx, { userId, organizationId: context.organizationId, - source: 'scim', + role: 'member', + ...seatPolicy, }) - } + if (!membership.success) throw membershipFailure(membership.failureCode) - await consumeTombstone(tx, { - connectionId: context.connection.id, - externalId: attributes.externalId, - }) - await reconcileUserProjection(tx, { - connectionId: context.connection.id, - organizationId: context.organizationId, - scimUserId: inserted.id, - settings: context.connection.settings, + const inserted = await insertScimUser(tx, { + connectionId: context.connection.id, + userId, + attributes, + active: attributes.active, + }) + + /** + * Microsoft Entra pre-provisions a disabled account before its start date, + * so a create can arrive already inactive and must land suspended rather + * than briefly usable. + */ + if (!attributes.active) { + await suspendMemberTx(tx, { + userId, + organizationId: context.organizationId, + source: 'scim', + }) + } + + await consumeTombstone(tx, { + connectionId: context.connection.id, + externalId: attributes.externalId, + }) + await reconcileUserProjection(tx, { + connectionId: context.connection.id, + organizationId: context.organizationId, + scimUserId: inserted.id, + settings: context.connection.settings, + }) + return { scimUserId: inserted.id, joinedOrganization: !membership.alreadyMember } }) - return inserted.id - }) + } catch (error) { + /** + * The account was created through Better Auth ahead of this transaction, + * so a refusal here — no seats, a lock timeout — would otherwise leave an + * orphan with no membership and no directory link. Removing it means the + * directory's retry starts from a clean slate instead of a half-state. + */ + if (createdAccount) { + await db + .delete(user) + .where(eq(user.id, userId)) + .catch((cleanupError) => + logger.error('Failed to remove an account after provisioning was refused', { + userId, + cleanupError, + }) + ) + } + throw error + } + const { scimUserId, joinedOrganization } = provisioned const record = await findScimUserById(db, context.connection.id, scimUserId) if (!record) throw new ScimError(500, undefined, 'The provisioned user could not be read back') @@ -191,6 +238,7 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ scimUserId, userId, createdAccount, + joinedOrganization, organizationId: context.organizationId, resource: toUserResource(toUserResourceRow(record, []), context.baseUrl), } @@ -203,13 +251,17 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ resourceId: result.userId, metadata: { scimUserId: result.scimUserId, createdAccount: result.createdAccount }, }, - { - action: AuditAction.ORG_MEMBER_ADDED, - resourceType: AuditResourceType.ORGANIZATION, - resourceId: result.organizationId, - description: 'Joined the organization through directory provisioning', - metadata: { memberRole: 'member', scimUserId: result.scimUserId }, - }, + ...(result.joinedOrganization + ? [ + { + action: AuditAction.ORG_MEMBER_ADDED, + resourceType: AuditResourceType.ORGANIZATION, + resourceId: result.organizationId, + description: 'Joined the organization through directory provisioning', + metadata: { memberRole: 'member', scimUserId: result.scimUserId }, + }, + ] + : []), ], /** diff --git a/apps/sim/lib/scim/application/users/read-users.ts b/apps/sim/lib/scim/application/users/read-users.ts index 7c2dde2ecfa..9a444190695 100644 --- a/apps/sim/lib/scim/application/users/read-users.ts +++ b/apps/sim/lib/scim/application/users/read-users.ts @@ -101,5 +101,3 @@ export const getScimUser = defineAuthorizedScimUseCase({ ) }, }) - -export { toListResponse } diff --git a/apps/sim/lib/scim/application/users/update-user.ts b/apps/sim/lib/scim/application/users/update-user.ts index 18fb0333a2c..d3237483b30 100644 --- a/apps/sim/lib/scim/application/users/update-user.ts +++ b/apps/sim/lib/scim/application/users/update-user.ts @@ -4,6 +4,7 @@ import { type ScimUserAttributes, user } from '@sim/db/schema' import { normalizeEmail } from '@sim/utils/string' import { eq } from 'drizzle-orm' import type { ScimPatchOperation } from '@/lib/api/contracts/scim' +import { acquireOrganizationUserMutationLocks } from '@/lib/billing/organizations/membership' import type { DbOrTx } from '@/lib/db/types' import { invalidateAfterSessionRevocation, @@ -23,10 +24,12 @@ import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' import { primaryEmail } from '@/lib/scim/protocol/canonical' import { notFound, ScimError } from '@/lib/scim/protocol/errors' import { toUserResource } from '@/lib/scim/protocol/resources' -import { applyUserPatch } from '@/lib/scim/protocol/user-patch' +import { applyUserPatch, userAttributesEqual } from '@/lib/scim/protocol/user-patch' import { + assertUserNameAvailable, findScimUserById, loadGroupsForScimUsers, + lockScimUserById, type ScimUserRecord, toUserResourceRow, updateScimUser, @@ -45,7 +48,6 @@ export interface UpdateOutcome { emailChanged: boolean deactivated: boolean reactivated: boolean - changed: boolean } async function applyUserUpdate( @@ -56,6 +58,21 @@ async function applyUserUpdate( ): Promise { const nextEmail = primaryEmail(next) const emailChanged = normalizeEmail(nextEmail) !== normalizeEmail(current.email) + const deactivated = current.active && !next.active + const reactivated = !current.active && next.active + + /** + * Taken first so the advisory locks always precede the `organization` row + * lock that a session revocation takes, in every path through this function. + */ + await acquireOrganizationUserMutationLocks(tx, { + userId: current.userId, + organizationIds: [context.organizationId], + }) + + if (next.userName !== current.userName) { + await assertUserNameAvailable(tx, context.connection.id, next.userName, current.id) + } if (emailChanged) { /** @@ -77,11 +94,17 @@ async function applyUserUpdate( }) .where(eq(user.id, current.userId)) - /** An address change ends the sessions established under the old one. */ - await revokeUserSessionsTx(tx, { - userId: current.userId, - organizationId: context.organizationId, - }) + /** + * An address change ends the sessions established under the old one. A + * deactivation in the same request revokes them itself, so this only runs + * when nothing else will. + */ + if (!deactivated) { + await revokeUserSessionsTx(tx, { + userId: current.userId, + organizationId: context.organizationId, + }) + } } else if (next.name.formatted !== current.attributes.name.formatted) { await tx .update(user) @@ -89,9 +112,6 @@ async function applyUserUpdate( .where(eq(user.id, current.userId)) } - const deactivated = current.active && !next.active - const reactivated = !current.active && next.active - if (deactivated) { await suspendMemberTx(tx, { userId: current.userId, @@ -115,7 +135,7 @@ async function applyUserUpdate( settings: context.connection.settings, }) - return { emailChanged, deactivated, reactivated, changed: true } + return { emailChanged, deactivated, reactivated } } export interface UpdateScimUserResult { @@ -186,26 +206,41 @@ export const replaceScimUser = defineAuthorizedScimUseCase({ input, context, }: ScimUseCaseArgs): Promise { - const current = await findScimUserById(db, context.connection.id, input.scimUserId) - if (!current) throw notFound('SCIM User not found') + const { scimUserId, userId, outcome } = await db.transaction(async (tx) => { + const current = await lockScimUserById(tx, context.connection.id, input.scimUserId) + if (!current) throw notFound('SCIM User not found') - /** - * A replace keeps attributes Sim does not model that the directory sent on a - * previous write but omitted now, so a partial mapping does not erase them. - */ - const next: ScimUserAttributes = { - ...input.attributes, - ...(current.attributes.extra || input.attributes.extra - ? { extra: { ...current.attributes.extra, ...input.attributes.extra } } - : {}), - } + /** + * A replace keeps attributes Sim does not model that the directory sent on + * a previous write but omitted now, so a partial mapping does not erase + * them. + */ + const next: ScimUserAttributes = { + ...input.attributes, + ...(current.attributes.extra || input.attributes.extra + ? { extra: { ...current.attributes.extra, ...input.attributes.extra } } + : {}), + } - const outcome = await db.transaction((tx) => applyUserUpdate(tx, context, current, next)) + /** + * Okta re-sends the whole resource on every cycle for every user. A PUT that + * changes nothing must not write, audit, or re-project, or a 2,000-user + * organization produces 2,000 spurious audit rows per sync. + */ + if (userAttributesEqual(current.attributes, next)) { + return { scimUserId: current.id, userId: current.userId, outcome: null } + } + return { + scimUserId: current.id, + userId: current.userId, + outcome: await applyUserUpdate(tx, context, current, next), + } + }) return { - scimUserId: current.id, - userId: current.userId, + scimUserId, + userId, outcome, - resource: await renderUpdated(context.connection.id, current.id, context.baseUrl), + resource: await renderUpdated(context.connection.id, scimUserId, context.baseUrl), } }, projectAudit: ({ result }) => auditEntries(result), @@ -224,32 +259,31 @@ export const patchScimUser = defineAuthorizedScimUseCase({ input, context, }: ScimUseCaseArgs): Promise { - const current = await findScimUserById(db, context.connection.id, input.scimUserId) - if (!current) throw notFound('SCIM User not found') + const { scimUserId, userId, outcome } = await db.transaction(async (tx) => { + const current = await lockScimUserById(tx, context.connection.id, input.scimUserId) + if (!current) throw notFound('SCIM User not found') - const { next, changed } = applyUserPatch(current.attributes, input.operations) + const { next, changed } = applyUserPatch(current.attributes, input.operations) - /** - * A patch that changes nothing is answered with the resource and no write. - * Directories re-send unchanged attributes constantly on incremental cycles, - * and treating each as a write would produce an audit row, a projection pass, - * and a `lastModified` bump for a request that meant nothing. - */ - if (!changed) { + /** + * A patch that changes nothing is answered with the resource and no write. + * Directories re-send unchanged attributes constantly on incremental + * cycles, and treating each as a write would produce an audit row, a + * projection pass, and a `lastModified` bump for a request that meant + * nothing. + */ + if (!changed) return { scimUserId: current.id, userId: current.userId, outcome: null } return { scimUserId: current.id, userId: current.userId, - outcome: null, - resource: await renderUpdated(context.connection.id, current.id, context.baseUrl), + outcome: await applyUserUpdate(tx, context, current, next), } - } - - const outcome = await db.transaction((tx) => applyUserUpdate(tx, context, current, next)) + }) return { - scimUserId: current.id, - userId: current.userId, + scimUserId, + userId, outcome, - resource: await renderUpdated(context.connection.id, current.id, context.baseUrl), + resource: await renderUpdated(context.connection.id, scimUserId, context.baseUrl), } }, projectAudit: ({ result }) => auditEntries(result), diff --git a/apps/sim/lib/scim/authenticate.ts b/apps/sim/lib/scim/authenticate.ts index 94de8eef0a8..2e306f1846a 100644 --- a/apps/sim/lib/scim/authenticate.ts +++ b/apps/sim/lib/scim/authenticate.ts @@ -1,10 +1,10 @@ -import { createHash, timingSafeEqual } from 'node:crypto' +import { createHash } from 'node:crypto' import type { ScimConnectionPrincipal, ScimCredentialScope } from '@sim/auth/principal' import { db } from '@sim/db' import { scimConnection, scimCredential } from '@sim/db/schema' import { createLogger } from '@sim/logger' -import { generateId, generateShortId } from '@sim/utils/id' -import { and, eq, isNull, lt, or, sql } from 'drizzle-orm' +import { generateShortId } from '@sim/utils/id' +import { and, eq, isNull, or, sql } from 'drizzle-orm' import type { NextRequest } from 'next/server' import { isOrganizationFeatureEntitled } from '@/lib/billing/core/subscription' import { isScimEnabled } from '@/lib/core/config/env-flags' @@ -20,7 +20,7 @@ export type ScimConnectionAuthenticator = (request: NextRequest) => Promise now()`) ) } - -/** Marks credentials whose expiry has passed, so the active count stays honest. */ -export async function pruneExpiredCredentials(connectionId: string): Promise { - await db - .update(scimCredential) - .set({ revokedAt: new Date() }) - .where( - and( - eq(scimCredential.connectionId, connectionId), - isNull(scimCredential.revokedAt), - lt(scimCredential.expiresAt, new Date()) - ) - ) -} - -/** Generates the ids the SCIM tables use, kept here so callers share one source. */ -export function newScimId(): string { - return generateId() -} diff --git a/apps/sim/lib/scim/identity/resolve-user.ts b/apps/sim/lib/scim/identity/resolve-user.ts index fbae00eeabf..515bb4b0b5d 100644 --- a/apps/sim/lib/scim/identity/resolve-user.ts +++ b/apps/sim/lib/scim/identity/resolve-user.ts @@ -5,7 +5,7 @@ import { normalizeEmail } from '@sim/utils/string' import { and, eq, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' import { primaryEmail } from '@/lib/scim/protocol/canonical' -import { uniqueness } from '@/lib/scim/protocol/errors' +import { invalidValue, uniqueness } from '@/lib/scim/protocol/errors' /** * Deciding which Sim account an incoming directory identity refers to. @@ -23,10 +23,7 @@ export type IdentityResolution = | { action: 'link'; userId: string; via: 'tombstone' | 'verified-domain' } /** Domains this organization has proven it owns, through the SSO domain flow. */ -export async function listVerifiedDomains( - tx: DbOrTx, - organizationId: string -): Promise> { +async function listVerifiedDomains(tx: DbOrTx, organizationId: string): Promise> { const rows = await tx .select({ domain: ssoDomain.domain }) .from(ssoDomain) @@ -53,15 +50,21 @@ export async function assertDomainOwned( email: string ): Promise { const domain = normalizeSSODomain(email) - if (!domain) throw uniqueness(`${email} is not a usable email address`) + if (!domain) throw invalidValue(`${email} is not a usable email address`) const verified = await listVerifiedDomains(tx, organizationId) + /** + * `invalidValue` rather than `uniqueness`. Nothing is duplicated here; the + * value is one this organization may not use. Labelling it a uniqueness + * conflict would make Okta record the user as "already exists" and hide the + * actual remedy — verify the domain — from the administrator. + */ if (verified.size === 0) { - throw uniqueness( + throw invalidValue( 'This organization has no verified email domains. Verify the domain in Sim before provisioning users.' ) } if (!verified.has(domain)) { - throw uniqueness( + throw invalidValue( `The domain ${domain} is not verified for this organization, so ${email} cannot be provisioned` ) } @@ -99,6 +102,10 @@ export async function resolveProvisionedIdentity( tx: DbOrTx, params: { connectionId: string; organizationId: string; attributes: ScimUserAttributes } ): Promise { + const email = primaryEmail(params.attributes) + /** Checked first so no path — a tombstone relink included — skips it. */ + await assertDomainOwned(tx, params.organizationId, email) + const externalId = params.attributes.externalId if (externalId) { const [tombstone] = await tx @@ -114,9 +121,6 @@ export async function resolveProvisionedIdentity( if (tombstone) return { action: 'link', userId: tombstone.userId, via: 'tombstone' } } - const email = primaryEmail(params.attributes) - await assertDomainOwned(tx, params.organizationId, email) - const [existing] = await tx .select({ id: user.id }) .from(user) diff --git a/apps/sim/lib/scim/managed-membership.ts b/apps/sim/lib/scim/managed-membership.ts index 19d5b7597ca..a3cad521d12 100644 --- a/apps/sim/lib/scim/managed-membership.ts +++ b/apps/sim/lib/scim/managed-membership.ts @@ -17,7 +17,7 @@ import type { DbOrTx } from '@/lib/db/types' * able to remove someone in an emergency, whatever the directory believes. */ -export type ManagedMembershipAction = 'invite' | 'change-role' | 'workspace-grant' +type ManagedMembershipAction = 'invite' | 'change-role' | 'workspace-grant' const ACTION_WORDING: Record = { invite: 'Inviting a member', @@ -26,40 +26,33 @@ const ACTION_WORDING: Record = { } /** - * Whether this organization has handed membership to its directory. + * A SQL predicate that is true when the given user is provisioned by THIS + * organization's active directory connection and that connection has locked + * manual membership. * - * Read fresh rather than cached: the setting is toggled rarely, and a stale - * answer would either block an administrator who just turned locking off or - * admit a change the directory is about to revert. + * Anchored to the organization on purpose. Without that anchor, a person + * provisioned by one tenant's directory would be reported as managed to every + * other tenant that happens to look them up — a false refusal and a + * cross-tenant disclosure in one. + * + * Exposed as a predicate rather than a query so a caller that is already + * reading the user can fold it into that read; the invitation flow does, since + * paying a second round trip on every invitation to answer a question that is + * almost always "no" is not worth it. */ -async function loadLockedConnection( - tx: DbOrTx, - organizationId: string -): Promise<{ id: string } | null> { - const [connection] = await tx - .select({ id: scimConnection.id, settings: scimConnection.settings }) - .from(scimConnection) - .where( - and(eq(scimConnection.organizationId, organizationId), eq(scimConnection.status, 'active')) - ) - .limit(1) - if (!connection?.settings?.lockManualMembership) return null - return { id: connection.id } -} - -/** True when the user is provisioned by the organization's directory. */ -export async function isScimManagedUser( - tx: DbOrTx, - params: { organizationId: string; userId: string } -): Promise { - const connection = await loadLockedConnection(tx, params.organizationId) - if (!connection) return false - const [row] = await tx - .select({ id: scimUser.id }) - .from(scimUser) - .where(and(eq(scimUser.connectionId, connection.id), eq(scimUser.userId, params.userId))) - .limit(1) - return Boolean(row) +export function scimManagedUserPredicate( + organizationId: string, + userIdColumn: SQL | AnyColumn +): SQL { + return sql`exists ( + select 1 + from ${scimUser} + join ${scimConnection} on ${scimConnection.id} = ${scimUser.connectionId} + where ${scimUser.userId} = ${userIdColumn} + and ${scimConnection.organizationId} = ${organizationId} + and ${scimConnection.status} = 'active' + and coalesce((${scimConnection.settings} ->> 'lockManualMembership')::boolean, false) = true + )` } /** Refuses a change to a member the directory owns. */ @@ -69,38 +62,16 @@ export async function assertMembershipNotScimManaged(params: { action: ManagedMembershipAction executor?: DbOrTx }): Promise { - const managed = await isScimManagedUser(params.executor ?? db, { - organizationId: params.organizationId, - userId: params.userId, - }) - if (!managed) return + const [row] = await (params.executor ?? db) + .select({ managed: scimManagedUserPredicate(params.organizationId, sql`${params.userId}`) }) + .from(sql`(select 1) as probe`) + if (!row?.managed) return throw new ForbiddenOperationError( 'SCIM_MANAGED_MEMBERSHIP', `${ACTION_WORDING[params.action]} is managed by this organization’s identity provider. Make the change there, or turn off managed-membership locking in the organization’s directory settings.` ) } -/** - * A SQL predicate that is true when the given user is provisioned by an active - * directory connection whose organization has locked manual membership. - * - * Exposed as a predicate rather than a query so a caller that is already reading - * the user can fold it into that read. The invitation flow does exactly that: it - * looks the invitee up by email regardless, and paying for a second round trip - * on every invitation to answer a question that is almost always "no" is not - * worth it. - */ -export function scimManagedUserPredicate(userIdColumn: SQL | AnyColumn): SQL { - return sql`exists ( - select 1 - from ${scimUser} - join ${scimConnection} on ${scimConnection.id} = ${scimUser.connectionId} - where ${scimUser.userId} = ${userIdColumn} - and ${scimConnection.status} = 'active' - and coalesce((${scimConnection.settings} ->> 'lockManualMembership')::boolean, false) = true - )` -} - /** Refuses an invitation to someone the directory already provisions. */ export function assertInviteeNotScimManaged(managed: boolean | null | undefined): void { if (!managed) return diff --git a/apps/sim/lib/scim/projection/auto-map.ts b/apps/sim/lib/scim/projection/auto-map.ts new file mode 100644 index 00000000000..930f8622dd8 --- /dev/null +++ b/apps/sim/lib/scim/projection/auto-map.ts @@ -0,0 +1,64 @@ +import { permissionGroup, scimGroupMapping } from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import { and, eq } from 'drizzle-orm' +import type { DbOrTx } from '@/lib/db/types' + +/** + * Links a pushed directory group to a permission group of the same name. + * + * Every mature provisioning integration adopts the container that matches the + * pushed group's name rather than waiting for a person to wire it up, because + * the administrator has usually already created both sides to match. Sim adopts + * only an existing permission group here and never creates one: a permission + * group is an access-control decision with an owner, and a directory sync is not + * the place to make it. + * + * The adopted group is moved to explicit membership so the directory removing + * its last member narrows it to nobody instead of widening it to everyone. + */ +export async function autoMapPermissionGroupByName( + tx: DbOrTx, + params: { organizationId: string; scimGroupId: string; displayName: string } +): Promise<'mapped' | 'already-mapped' | 'no-match'> { + const [target] = await tx + .select({ id: permissionGroup.id, membershipMode: permissionGroup.membershipMode }) + .from(permissionGroup) + .where( + and( + eq(permissionGroup.organizationId, params.organizationId), + eq(permissionGroup.name, params.displayName), + eq(permissionGroup.isDefault, false) + ) + ) + .limit(1) + if (!target) return 'no-match' + + const [existing] = await tx + .select({ id: scimGroupMapping.id }) + .from(scimGroupMapping) + .where( + and( + eq(scimGroupMapping.groupId, params.scimGroupId), + eq(scimGroupMapping.targetKind, 'permission_group'), + eq(scimGroupMapping.permissionGroupId, target.id) + ) + ) + .limit(1) + if (existing) return 'already-mapped' + + if (target.membershipMode !== 'explicit') { + await tx + .update(permissionGroup) + .set({ membershipMode: 'explicit', updatedAt: new Date() }) + .where(eq(permissionGroup.id, target.id)) + } + + await tx.insert(scimGroupMapping).values({ + id: generateId(), + groupId: params.scimGroupId, + targetKind: 'permission_group', + permissionGroupId: target.id, + createdBy: null, + }) + return 'mapped' +} diff --git a/apps/sim/lib/scim/projection/reconcile-user.ts b/apps/sim/lib/scim/projection/reconcile-user.ts index 092e8511fa1..c6d53304856 100644 --- a/apps/sim/lib/scim/projection/reconcile-user.ts +++ b/apps/sim/lib/scim/projection/reconcile-user.ts @@ -1,24 +1,27 @@ +import { db } from '@sim/db' import { type ScimConnectionSettings, scimGroupMapping, scimGroupMember, scimProjectionGrant, scimUser, - user, } from '@sim/db/schema' import { createLogger } from '@sim/logger' import type { PermissionType } from '@sim/platform-authz/workspace' import { generateId } from '@sim/utils/id' import { and, eq } from 'drizzle-orm' +import { acquireOrganizationUserMutationLocks } from '@/lib/billing/organizations/membership' import type { DbOrTx } from '@/lib/db/types' import { changeMemberRoleTx } from '@/lib/organizations/members/lifecycle' import { addPermissionGroupMemberTx, PermissionGroupNotFoundError, + PermissionGroupScopeConflictError, removePermissionGroupMemberTx, } from '@/lib/permission-groups/application/group-membership' import { grantWorkspaceAccessTx, + lowerWorkspaceAccessTx, permissionRank, readWorkspacePermission, revokeWorkspaceAccessTx, @@ -51,6 +54,7 @@ export interface ProjectionGrant { export interface ProjectionDelta { added: ProjectionGrant[] removed: ProjectionGrant[] + /** Workspace grants whose level changed in either direction. */ raised: ProjectionGrant[] } @@ -63,16 +67,16 @@ function grantKey(grant: ProjectionGrant): string { /** * What this user's group mappings entitle them to. * - * An inactive user is entitled to nothing: a deactivation must withdraw access - * rather than merely blocking sign-in, so that a reactivation is what restores - * it and nothing is left dangling in between. + * Deliberately independent of whether the user is active. A deactivation blocks + * sign-in and API keys through suspension; it does not withdraw grants, because + * withdrawing a workspace grant reassigns the workflows the person owns there, + * and that cannot be undone by reactivating them. Grants change only when group + * membership or mappings change, or when the user is deprovisioned outright. */ async function desiredGrants( tx: DbOrTx, - params: { scimUserId: string; active: boolean; settings: ScimConnectionSettings } + params: { scimUserId: string; settings: ScimConnectionSettings } ): Promise { - if (!params.active) return [] - const rows = await tx .select({ targetKind: scimGroupMapping.targetKind, @@ -146,45 +150,59 @@ async function currentGrants(tx: DbOrTx, scimUserId: string): Promise { +): Promise { const { grant } = params switch (grant.targetKind) { case 'workspace': - if (!grant.permissionType) return + if (!grant.permissionType) return false + if ( + params.previousPermission && + permissionRank(params.previousPermission) > permissionRank(grant.permissionType) + ) { + await lowerWorkspaceAccessTx(tx, { + workspaceId: grant.targetId, + userId: params.userId, + from: params.previousPermission, + to: grant.permissionType, + }) + return true + } await grantWorkspaceAccessTx(tx, { workspaceId: grant.targetId, userId: params.userId, permission: grant.permissionType, }) - return + return true case 'org_role': - if (grant.targetId !== 'admin') return + if (grant.targetId !== 'admin') return false await changeMemberRoleTx(tx, { organizationId: params.organizationId, userId: params.userId, role: 'admin', }) - return + return true case 'permission_group': - /** - * Last, because the permission-group lock is a documented leaf: no further - * advisory lock may be taken after it. - */ await addPermissionGroupMemberTx(tx, { organizationId: params.organizationId, groupId: grant.targetId, userId: params.userId, assignedBy: null, - lockTimeoutAlreadyBounded: params.lockTimeoutAlreadyBounded, + lockTimeoutAlreadyBounded: true, }) + return true } } @@ -195,7 +213,6 @@ async function withdrawGrant( userId: string grant: ProjectionGrant lockManualMembership: boolean - lockTimeoutAlreadyBounded: boolean } ): Promise { const { grant } = params @@ -241,12 +258,21 @@ async function withdrawGrant( }) return case 'permission_group': - await removePermissionGroupMemberTx(tx, { - organizationId: params.organizationId, - groupId: grant.targetId, - userId: params.userId, - lockTimeoutAlreadyBounded: params.lockTimeoutAlreadyBounded, - }) + try { + await removePermissionGroupMemberTx(tx, { + organizationId: params.organizationId, + groupId: grant.targetId, + userId: params.userId, + lockTimeoutAlreadyBounded: true, + }) + } catch (error) { + /** + * The group may already be gone; the grant row outlives it because the + * target column carries no foreign key. Withdrawing from nothing is + * complete, not a failure. + */ + if (!(error instanceof PermissionGroupNotFoundError)) throw error + } } } @@ -257,9 +283,6 @@ async function withdrawGrant( * before, and acts only on the difference. Running it twice changes nothing the * second time, which is what lets the reconcile job re-run it over every user * without a dry-run mode. - * - * Ordering within the transaction follows the documented advisory-lock order: - * workspace and role writes first, permission-group writes last. */ export async function reconcileUserProjection( tx: DbOrTx, @@ -271,21 +294,26 @@ export async function reconcileUserProjection( } ): Promise { const [record] = await tx - .select({ - userId: scimUser.userId, - active: scimUser.active, - suspendedAt: user.suspendedAt, - }) + .select({ userId: scimUser.userId }) .from(scimUser) - .innerJoin(user, eq(user.id, scimUser.userId)) .where(and(eq(scimUser.id, params.scimUserId), eq(scimUser.connectionId, params.connectionId))) .limit(1) if (!record) return EMPTY_DELTA + /** + * Taken before any target is touched so the documented order holds: the + * organization and membership locks first, the permission-group leaf lock + * last. A withdrawal that reached the leaf lock before a later grant took the + * organization lock would invert that order against a concurrent request. + */ + await acquireOrganizationUserMutationLocks(tx, { + userId: record.userId, + organizationIds: [params.organizationId], + }) + const desired = await desiredGrants(tx, { scimUserId: params.scimUserId, - active: record.active && record.suspendedAt === null, settings: params.settings, }) const current = await currentGrants(tx, params.scimUserId) @@ -304,7 +332,6 @@ export async function reconcileUserProjection( userId: record.userId, grant, lockManualMembership, - lockTimeoutAlreadyBounded: false, }) await tx .delete(scimProjectionGrant) @@ -320,27 +347,30 @@ export async function reconcileUserProjection( for (const [key, grant] of desiredByKey) { const existing = currentByKey.get(key) - const raised = + const levelChanged = existing !== undefined && grant.permissionType !== undefined && existing.permissionType !== undefined && - permissionRank(grant.permissionType) > permissionRank(existing.permissionType) + grant.permissionType !== existing.permissionType - if (existing && !raised) continue + if (existing && !levelChanged) continue + let applied: boolean try { - await applyGrant(tx, { + applied = await applyGrant(tx, { organizationId: params.organizationId, userId: record.userId, grant, - lockTimeoutAlreadyBounded: false, + ...(existing?.permissionType ? { previousPermission: existing.permissionType } : {}), }) } catch (error) { /** * A mapping can outlive its target — an administrator deletes a permission * group and the row cascades away, or deletes the group between the read - * and the write. Skipping one target is right; failing the whole - * provisioning request over it is not. + * and the write. And two mapped groups can collide: the same person in + * both, each governing a shared workspace. Both are configuration problems + * for the administrator to see in the activity log, not reasons to fail + * the directory's request and have it retry forever. */ if (error instanceof PermissionGroupNotFoundError) { logger.warn('Skipped a SCIM mapping whose permission group no longer exists', { @@ -349,8 +379,17 @@ export async function reconcileUserProjection( }) continue } + if (error instanceof PermissionGroupScopeConflictError) { + logger.warn('Skipped a SCIM mapping that conflicts with another permission group', { + connectionId: params.connectionId, + groupId: grant.targetId, + conflicts: error.conflicts.length, + }) + continue + } throw error } + if (!applied) continue await tx .insert(scimProjectionGrant) @@ -373,32 +412,13 @@ export async function reconcileUserProjection( set: { permissionType: grant.permissionType ?? null, updatedAt: new Date() }, }) - if (raised) delta.raised.push(grant) + if (levelChanged) delta.raised.push(grant) else delta.added.push(grant) } return delta } -/** Withdraws everything SCIM granted a user, for deprovisioning. */ -export async function withdrawAllProjectedGrants( - tx: DbOrTx, - params: { connectionId: string; organizationId: string; scimUserId: string; userId: string } -): Promise { - const grants = await currentGrants(tx, params.scimUserId) - for (const grant of grants) { - await withdrawGrant(tx, { - organizationId: params.organizationId, - userId: params.userId, - grant, - /** Deprovisioning removes access regardless of later manual changes. */ - lockManualMembership: true, - lockTimeoutAlreadyBounded: false, - }) - } - await tx.delete(scimProjectionGrant).where(eq(scimProjectionGrant.scimUserId, params.scimUserId)) -} - /** Reconciles several users, in a stable order so concurrent syncs cannot deadlock. */ export async function reconcileUsersProjection( tx: DbOrTx, @@ -418,3 +438,40 @@ export async function reconcileUsersProjection( }) } } + +/** + * Reconciles many users in transactions of a bounded size. + * + * For callers that are not already inside a transaction — the reconcile job, + * and an administrator changing a mapping on a large group. One transaction over + * thousands of users would hold the organization's advisory locks for its whole + * duration, blocking every invitation and role change in the tenant meanwhile. + */ +export async function reconcileUsersProjectionInBatches(params: { + connectionId: string + organizationId: string + scimUserIds: string[] + settings: ScimConnectionSettings + batchSize?: number +}): Promise { + const total: ProjectionDelta = { added: [], removed: [], raised: [] } + const ids = [...new Set(params.scimUserIds)].sort() + const size = params.batchSize ?? 200 + for (let start = 0; start < ids.length; start += size) { + const batch = ids.slice(start, start + size) + await db.transaction(async (tx) => { + for (const scimUserId of batch) { + const delta = await reconcileUserProjection(tx, { + connectionId: params.connectionId, + organizationId: params.organizationId, + scimUserId, + settings: params.settings, + }) + total.added.push(...delta.added) + total.removed.push(...delta.removed) + total.raised.push(...delta.raised) + } + }) + } + return total +} diff --git a/apps/sim/lib/scim/protocol/constants.ts b/apps/sim/lib/scim/protocol/constants.ts index ccb19ad1fb3..3a86b755eb2 100644 --- a/apps/sim/lib/scim/protocol/constants.ts +++ b/apps/sim/lib/scim/protocol/constants.ts @@ -42,13 +42,14 @@ export const SCIM_MAX_BODY_BYTES = 1_000_000 /** * Requests a connection may make per minute, and the burst it may spend at once. * - * Microsoft Entra opens a provisioning cycle with a burst of reads and Okta - * pages imports at 100 users, so a limit tuned to interactive traffic would - * throttle an ordinary first sync. + * Microsoft requires a SCIM endpoint to sustain at least 25 requests per second + * per tenant, and opens each provisioning cycle with a burst of reads; Okta pages + * imports at 100 users a call. The bucket is sized to those clients, not to + * interactive traffic. */ export const SCIM_RATE_LIMIT = { - maxTokens: 600, - refillRate: 300, + maxTokens: 3_000, + refillRate: 1_500, refillIntervalMs: 60_000, } as const diff --git a/apps/sim/lib/scim/protocol/errors.ts b/apps/sim/lib/scim/protocol/errors.ts index 15d77f2e2e0..2a48f5c358f 100644 --- a/apps/sim/lib/scim/protocol/errors.ts +++ b/apps/sim/lib/scim/protocol/errors.ts @@ -98,13 +98,30 @@ export function notFound(detail: string): ScimError { */ const PG_LOCK_NOT_AVAILABLE = '55P03' +/** PostgreSQL's unique-violation code: a concurrent write beat this one to a key. */ +const PG_UNIQUE_VIOLATION = '23505' + +function pgErrorCode(error: unknown): string | undefined { + if (typeof error !== 'object' || error === null) return undefined + const direct = (error as { code?: unknown }).code + if (typeof direct === 'string') return direct + /** postgres-js wraps the driver error under `cause` in some paths. */ + const cause = (error as { cause?: { code?: unknown } }).cause + return typeof cause?.code === 'string' ? cause.code : undefined +} + function isLockTimeout(error: unknown): boolean { - return ( - typeof error === 'object' && - error !== null && - 'code' in error && - (error as { code?: unknown }).code === PG_LOCK_NOT_AVAILABLE - ) + return pgErrorCode(error) === PG_LOCK_NOT_AVAILABLE +} + +/** + * Two provisioning requests for the same key can race past every pre-check; + * the unique index is the arbiter. RFC 7644 calls that a `uniqueness` conflict, + * and the label matters: Okta stops retrying on `uniqueness` and treats an + * unlabelled failure as transient. + */ +function isUniqueViolation(error: unknown): boolean { + return pgErrorCode(error) === PG_UNIQUE_VIOLATION } /** @@ -123,6 +140,9 @@ export function toScimError(error: unknown): ScimError { 'Retry-After': '5', }) } + if (isUniqueViolation(error)) { + return new ScimError(409, 'uniqueness', 'A resource with the same identifier already exists') + } if (error instanceof OrchestrationError) { switch (error.code) { diff --git a/apps/sim/lib/scim/protocol/filter.ts b/apps/sim/lib/scim/protocol/filter.ts index 44d35a50d1a..a315deb078a 100644 --- a/apps/sim/lib/scim/protocol/filter.ts +++ b/apps/sim/lib/scim/protocol/filter.ts @@ -35,7 +35,6 @@ const USER_FILTER_FIELDS: Record = { externalid: 'externalId', 'emails.value': 'email', 'emails[type eq "work"].value': 'email', - "emails[type eq 'work'].value": 'email', 'emails[primary eq true].value': 'email', active: 'active', } diff --git a/apps/sim/lib/scim/protocol/normalize.ts b/apps/sim/lib/scim/protocol/normalize.ts index 968025c45be..674bddd20a0 100644 --- a/apps/sim/lib/scim/protocol/normalize.ts +++ b/apps/sim/lib/scim/protocol/normalize.ts @@ -41,35 +41,12 @@ export function isRecord(value: unknown): value is Record { } /** - * Rewrites the boolean-valued attributes of an inbound body in place of their - * string forms, before schema validation sees them. + * Strips a schema URN prefix from an attribute path and decodes it. * - * Applied to the whole body rather than to individual fields because the same - * job sends `active` at the top level, `primary` inside every multi-valued - * attribute, and both again nested in PATCH operation values. - */ -export function normalizeScimBooleansDeep(value: unknown): unknown { - if (Array.isArray(value)) return value.map(normalizeScimBooleansDeep) - if (!isRecord(value)) return value - const next: Record = {} - for (const [key, nested] of Object.entries(value)) { - next[key] = BOOLEAN_ATTRIBUTES.has(key.toLowerCase()) - ? normalizeScimBoolean(unwrapSingleElement(nested)) - : normalizeScimBooleansDeep(nested) - } - return next -} - -/** Attribute names whose value is a boolean everywhere they appear. */ -const BOOLEAN_ATTRIBUTES = new Set(['active', 'primary']) - -/** - * Strips a schema URN prefix from an attribute path and lower-cases the - * attribute name. - * - * RFC 7643 makes attribute names case-insensitive, and providers disagree: - * Okta sends `userName`, Entra sometimes sends `username` and sometimes the - * fully qualified `urn:...:User:userName`. + * Case is left to the caller, which compares lower-cased: RFC 7643 makes + * attribute names case-insensitive, and providers disagree — Okta sends + * `userName`, Entra sometimes `username` and sometimes the fully qualified + * `urn:...:User:userName`. */ export function normalizeAttributePath(path: string): string { let value = path.trim() diff --git a/apps/sim/lib/scim/protocol/user-patch.ts b/apps/sim/lib/scim/protocol/user-patch.ts index 1285617df8a..85bc73d383a 100644 --- a/apps/sim/lib/scim/protocol/user-patch.ts +++ b/apps/sim/lib/scim/protocol/user-patch.ts @@ -274,6 +274,11 @@ function comparisonKey(attributes: ScimUserAttributes): string { return JSON.stringify(sortDeep(attributes)) } +/** Whether two canonical resources describe the same state, ignoring key order. */ +export function userAttributesEqual(left: ScimUserAttributes, right: ScimUserAttributes): boolean { + return comparisonKey(left) === comparisonKey(right) +} + export function applyUserPatch( current: ScimUserAttributes, operations: readonly ScimPatchOperation[] diff --git a/apps/sim/lib/scim/reconcile/job.ts b/apps/sim/lib/scim/reconcile/job.ts index 8dd3080db8b..1c035cc7f5b 100644 --- a/apps/sim/lib/scim/reconcile/job.ts +++ b/apps/sim/lib/scim/reconcile/job.ts @@ -3,6 +3,8 @@ import { scimConnection } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { and, eq, isNull, lt, or, sql } from 'drizzle-orm' +import { isOrganizationFeatureEntitled } from '@/lib/billing/core/subscription' +import { isScimEnabled } from '@/lib/core/config/env-flags' import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' import { listScimUserIds } from '@/lib/scim/repository/users' import { pruneScimRequestLog } from '@/lib/scim/request-log' @@ -23,8 +25,15 @@ const logger = createLogger('ScimReconcile') /** How long a claimed lease is honored before another run may take it over. */ const LEASE_TTL_MS = 15 * 60 * 1000 -/** How often a connection is swept when nothing else triggers it. */ -const RECONCILE_INTERVAL_MS = 24 * 60 * 60 * 1000 +/** + * How often a connection is swept when nothing else triggers it. + * + * The cron fires hourly; each connection is picked up once this interval has + * passed since its last sweep, oldest first. Drift is rare and corrected on the + * next membership change anyway, so a few passes a day is plenty without + * re-walking every tenant every hour. + */ +const RECONCILE_INTERVAL_MS = 6 * 60 * 60 * 1000 /** Users reconciled per transaction, so no single one holds locks for long. */ const BATCH_SIZE = 200 @@ -69,7 +78,7 @@ async function releaseLease(connectionId: string, runId: string): Promise } /** Connections whose last sweep is older than the interval, oldest first. */ -export async function findConnectionsDueForReconcile(limit: number): Promise< +async function findConnectionsDueForReconcile(limit: number): Promise< Array<{ id: string organizationId: string @@ -99,6 +108,12 @@ export async function reconcileConnection(connection: { organizationId: string settings: (typeof scimConnection.$inferSelect)['settings'] }): Promise { + /** + * A lapsed organization's credentials are refused at authentication; its + * projection must not keep being re-applied by the scheduler either. + */ + if (!(await isOrganizationFeatureEntitled(connection.organizationId, isScimEnabled))) return null + const runId = generateId() if (!(await acquireLease(connection.id, runId))) return null @@ -152,7 +167,7 @@ export interface ScimReconcileSweep { grantsRemoved: number } -export async function runScimReconcileSweep(maxConnections = 25): Promise { +export async function runScimReconcileSweep(maxConnections = 200): Promise { const due = await findConnectionsDueForReconcile(maxConnections) const sweep: ScimReconcileSweep = { connections: 0, diff --git a/apps/sim/lib/scim/repository/groups.ts b/apps/sim/lib/scim/repository/groups.ts index ce6c8b3ae83..5356419a88f 100644 --- a/apps/sim/lib/scim/repository/groups.ts +++ b/apps/sim/lib/scim/repository/groups.ts @@ -173,7 +173,7 @@ export async function touchScimGroup(tx: DbOrTx, groupId: string): Promise await tx.update(scimGroup).set({ updatedAt: new Date() }).where(eq(scimGroup.id, groupId)) } -export async function deleteScimGroup(tx: DbOrTx, groupId: string): Promise { +export async function deleteScimGroupRow(tx: DbOrTx, groupId: string): Promise { await tx.delete(scimGroup).where(eq(scimGroup.id, groupId)) } diff --git a/apps/sim/lib/scim/repository/users.ts b/apps/sim/lib/scim/repository/users.ts index 5a5dd0aa39a..b71d04a769f 100644 --- a/apps/sim/lib/scim/repository/users.ts +++ b/apps/sim/lib/scim/repository/users.ts @@ -1,7 +1,9 @@ import { type ScimUserAttributes, scimGroup, scimGroupMember, scimUser, user } from '@sim/db/schema' import { generateId } from '@sim/utils/id' +import { normalizeEmail } from '@sim/utils/string' import { and, asc, count, eq, inArray, type SQL, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' +import { uniqueness } from '@/lib/scim/protocol/errors' import type { ScimFilterTerm, ScimUserFilterField } from '@/lib/scim/protocol/filter' import type { UserResourceRow } from '@/lib/scim/protocol/resources' @@ -35,7 +37,7 @@ function userFilterCondition(term: ScimFilterTerm): SQL | u case 'externalId': return eq(scimUser.externalId, term.value) case 'email': - return sql`lower(${user.email}) = ${term.value.toLowerCase()}` + return sql`lower(trim(${user.email})) = ${normalizeEmail(term.value)}` case 'active': return eq(scimUser.active, term.value.toLowerCase() === 'true') } @@ -131,6 +133,29 @@ export async function findScimUserById( return row ?? null } +/** + * The same lookup, holding the row for the rest of the transaction. + * + * A write path reads the stored resource, computes the next one in memory, and + * writes it back. Two concurrent PATCHes — which Microsoft Entra pipelines + * routinely — would otherwise both read the same base and the second would + * overwrite the first's whole attribute document. + */ +export async function lockScimUserById( + tx: DbOrTx, + connectionId: string, + scimUserId: string +): Promise { + const [row] = await tx + .select(USER_SELECTION) + .from(scimUser) + .innerJoin(user, eq(user.id, scimUser.userId)) + .where(and(eq(scimUser.connectionId, connectionId), eq(scimUser.id, scimUserId))) + .limit(1) + .for('update', { of: scimUser }) + return row ?? null +} + export async function findScimUserByUserId( tx: DbOrTx, connectionId: string, @@ -189,6 +214,23 @@ export async function pageScimUsers( return { records, totalResults: totalRow?.value ?? 0 } } +/** Refuses a `userName` another resource on this connection already holds. */ +export async function assertUserNameAvailable( + tx: DbOrTx, + connectionId: string, + userName: string, + exceptScimUserId?: string +): Promise { + const [clash] = await tx + .select({ id: scimUser.id }) + .from(scimUser) + .where(and(eq(scimUser.connectionId, connectionId), eq(scimUser.userName, userName))) + .limit(1) + if (clash && clash.id !== exceptScimUserId) { + throw uniqueness(`A user with userName ${userName} already exists in this directory`) + } +} + export async function insertScimUser( tx: DbOrTx, params: { diff --git a/apps/sim/lib/workspaces/access/workspace-access.ts b/apps/sim/lib/workspaces/access/workspace-access.ts index 02cc3368af2..2996a9b681d 100644 --- a/apps/sim/lib/workspaces/access/workspace-access.ts +++ b/apps/sim/lib/workspaces/access/workspace-access.ts @@ -37,6 +37,27 @@ export async function grantWorkspaceAccessTx( tx: DbOrTx, params: { workspaceId: string; userId: string; permission: PermissionType } ): Promise { + /** + * Insert first and let the unique index on (user, entity) decide. A read + * followed by an insert would let two concurrent grants both see "absent" and + * one of them fail on the index; this way the loser falls through to the + * comparison below against the row that won. + */ + const inserted = await tx + .insert(permissions) + .values({ + id: generateId(), + userId: params.userId, + entityType: 'workspace', + entityId: params.workspaceId, + permissionType: params.permission, + createdAt: new Date(), + updatedAt: new Date(), + }) + .onConflictDoNothing() + .returning({ id: permissions.id }) + if (inserted.length > 0) return 'granted' + const [existing] = await tx .select({ id: permissions.id, permissionType: permissions.permissionType }) .from(permissions) @@ -49,19 +70,7 @@ export async function grantWorkspaceAccessTx( ) .limit(1) .for('update') - - if (!existing) { - await tx.insert(permissions).values({ - id: generateId(), - userId: params.userId, - entityType: 'workspace', - entityId: params.workspaceId, - permissionType: params.permission, - createdAt: new Date(), - updatedAt: new Date(), - }) - return 'granted' - } + if (!existing) return 'unchanged' if (permissionRank(existing.permissionType) >= permissionRank(params.permission)) { return 'unchanged' @@ -74,6 +83,33 @@ export async function grantWorkspaceAccessTx( return 'raised' } +/** + * Lowers a grant, but only from the level a previous automated grant set. + * + * A directory mapping edited from admin down to write must take effect, yet a + * person a workspace administrator deliberately promoted must not be demoted by + * it. The caller passes the level it last set; if the row no longer matches, + * someone else raised it and the lowering is skipped. + */ +export async function lowerWorkspaceAccessTx( + tx: DbOrTx, + params: { workspaceId: string; userId: string; from: PermissionType; to: PermissionType } +): Promise<'lowered' | 'unchanged'> { + const updated = await tx + .update(permissions) + .set({ permissionType: params.to, updatedAt: new Date() }) + .where( + and( + eq(permissions.userId, params.userId), + eq(permissions.entityType, 'workspace'), + eq(permissions.entityId, params.workspaceId), + eq(permissions.permissionType, params.from) + ) + ) + .returning({ id: permissions.id }) + return updated.length > 0 ? 'lowered' : 'unchanged' +} + export interface RevokeWorkspaceAccessResult { revoked: boolean /** Workflows whose owner could not be reassigned, which blocks the removal. */ From 41ab8b1026e2e8d68e928576fa47e63cab246652 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 14:13:23 -0700 Subject: [PATCH 13/31] =?UTF-8?q?fix(scim):=20second=20audit=20round=20?= =?UTF-8?q?=E2=80=94=20bugs,=20abstractions,=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Findings from a full code review of the SCIM surface and a regression review of the shared primitives it extracted: - attributes/excludedAttributes projection no longer fails response validation (Entra excludes groups on every page); projected attributes are optional in the response contract - defaultWorkspaceGrants are checked against the organization, closing a cross-tenant workspace grant - User PUT/PATCH serialize on the organization/user advisory locks instead of a scim_user row lock that inverted lock order against projection - PATCH add emails keeps the existing primary; canonical nested name and enterprise objects are accepted in a path-less replace - A group mapped to the org admin role skips the owner instead of failing the sync; a withdrawal that cannot hand ownership on is retried next pass - Relinking a recreated identity syncs the account's email and name - disableJit is enforced at SSO admission rather than flipped once on the provider; reconcile refuses a disabled connection clearly - Conflicts that are not duplicates no longer carry scimType uniqueness - Workspace revocation hands the workspace to its billed account first, matching the members route - Batch invitations return 403 for a managed member; role change maps a lock timeout to 409; managed-membership locking is inert with the flag off - Settings routes' all-members conflict rule ignores explicit-mode groups - Admin wrapper projects audit like the directory wrapper; admin use cases split into connection, credentials, mappings - Pure grant resolution/diff extracted; group list N+1 removed; no-op group writes skipped; roster shows directory deactivation - Tests: grants, authentication, identity resolution, lifecycle primitives, projection-vs-contract, email add, canonical nesting (139 SCIM tests) - Dead code removed; unrelated sandbox bundle churn reverted Co-Authored-By: Claude Fable 5.1 --- .../content/docs/platform/enterprise/scim.mdx | 4 +- .../[id]/members/[memberId]/route.ts | 9 +- .../[groupId]/members/route.ts | 2 +- .../[id]/permission-groups/utils.ts | 5 +- .../organizations/[id]/roster/route.test.ts | 5 + .../api/organizations/[id]/roster/route.ts | 5 + .../organizations/[id]/scim/activity/route.ts | 2 +- .../scim/credentials/[credentialId]/route.ts | 3 +- .../[id]/scim/credentials/route.ts | 3 +- .../[id]/scim/mappings/[mappingId]/route.ts | 3 +- .../organizations/[id]/scim/mappings/route.ts | 2 +- .../[id]/scim/reconcile/route.ts | 2 +- .../app/api/organizations/[id]/scim/route.ts | 6 +- .../api/workspaces/invitations/batch/route.ts | 8 + .../organization-member-lists.tsx | 12 +- apps/sim/ee/scim/components/scim-section.tsx | 34 +- apps/sim/hooks/queries/organization.test.tsx | 1 + apps/sim/lib/api/contracts/organization.ts | 2 + apps/sim/lib/api/contracts/scim.ts | 35 +- apps/sim/lib/api/server/routes/scim-route.ts | 16 + .../auth/sso/application/admit-sso-user.ts | 20 +- .../lib/execution/sandbox/bundles/docx.cjs | 38 +- .../execution/sandbox/bundles/pptxgenjs.cjs | 34 +- .../lib/invitations/workspace-invitations.ts | 9 +- .../organizations/members/lifecycle.test.ts | 164 ++++ .../lib/organizations/members/lifecycle.ts | 15 +- .../application/group-membership.ts | 11 +- .../scim/application/admin/connection-view.ts | 125 +++ .../lib/scim/application/admin/connection.ts | 194 +++++ .../lib/scim/application/admin/credentials.ts | 116 +++ .../application/admin/manage-connection.ts | 725 ------------------ .../lib/scim/application/admin/mappings.ts | 293 +++++++ .../authorized-scim-admin-use-case.ts | 59 +- .../scim/application/groups/manage-groups.ts | 77 +- .../scim/application/users/provision-user.ts | 40 +- .../lib/scim/application/users/read-users.ts | 8 - .../lib/scim/application/users/update-user.ts | 69 +- apps/sim/lib/scim/authenticate.test.ts | 133 ++++ .../sim/lib/scim/identity/account-identity.ts | 37 + .../lib/scim/identity/resolve-user.test.ts | 140 ++++ apps/sim/lib/scim/managed-membership.ts | 19 +- apps/sim/lib/scim/projection/grants.test.ts | 158 ++++ apps/sim/lib/scim/projection/grants.ts | 135 ++++ .../sim/lib/scim/projection/reconcile-user.ts | 180 ++--- apps/sim/lib/scim/protocol/canonical.ts | 41 +- apps/sim/lib/scim/protocol/errors.ts | 3 +- apps/sim/lib/scim/protocol/group-patch.ts | 5 + apps/sim/lib/scim/protocol/normalize.ts | 4 +- apps/sim/lib/scim/protocol/resources.test.ts | 12 + apps/sim/lib/scim/protocol/user-patch.test.ts | 31 + apps/sim/lib/scim/protocol/user-patch.ts | 27 +- apps/sim/lib/scim/repository/groups.ts | 25 + apps/sim/lib/scim/repository/users.ts | 23 - .../lib/workspaces/access/workspace-access.ts | 46 +- packages/audit/src/types.ts | 2 - packages/db/schema.ts | 2 +- 56 files changed, 2106 insertions(+), 1073 deletions(-) create mode 100644 apps/sim/lib/organizations/members/lifecycle.test.ts create mode 100644 apps/sim/lib/scim/application/admin/connection-view.ts create mode 100644 apps/sim/lib/scim/application/admin/connection.ts create mode 100644 apps/sim/lib/scim/application/admin/credentials.ts delete mode 100644 apps/sim/lib/scim/application/admin/manage-connection.ts create mode 100644 apps/sim/lib/scim/application/admin/mappings.ts create mode 100644 apps/sim/lib/scim/authenticate.test.ts create mode 100644 apps/sim/lib/scim/identity/account-identity.ts create mode 100644 apps/sim/lib/scim/identity/resolve-user.test.ts create mode 100644 apps/sim/lib/scim/projection/grants.test.ts create mode 100644 apps/sim/lib/scim/projection/grants.ts diff --git a/apps/docs/content/docs/platform/enterprise/scim.mdx b/apps/docs/content/docs/platform/enterprise/scim.mdx index 293f13cc064..6345ed68356 100644 --- a/apps/docs/content/docs/platform/enterprise/scim.mdx +++ b/apps/docs/content/docs/platform/enterprise/scim.mdx @@ -149,13 +149,13 @@ Sim also re-applies every group mapping on a schedule, so drift cannot persist. - Base URL: `https:///api/scim/v2` - Authentication: `Authorization: Bearer ` - Resources: `/Users`, `/Groups`, plus `/ServiceProviderConfig`, `/ResourceTypes`, and `/Schemas` -- Filters: `eq`, joined with `and`, on `userName`, `externalId`, `emails.value`, and `displayName` +- Filters: `eq`, joined with `and`, on `id`, `userName`, `externalId`, `emails.value`, `active`, and `displayName` - Page size: up to 100 per request { name: 'Admin User', email: 'admin@example.com', image: null, + suspendedAt: null, workspaces: [], }, { @@ -128,6 +131,7 @@ describe('GET /api/organizations/[id]/roster', () => { name: 'Reader User', email: 'reader@example.com', image: 'https://example.com/reader.png', + suspendedAt: null, workspaces: [], }, ], @@ -167,6 +171,7 @@ describe('GET /api/organizations/[id]/roster', () => { userName: 'External User', userEmail: 'external@example.com', userImage: null, + userSuspendedAt: null, workspaceId: 'workspace-1', permission: 'read', createdAt: new Date('2026-03-01T00:00:00.000Z'), diff --git a/apps/sim/app/api/organizations/[id]/roster/route.ts b/apps/sim/app/api/organizations/[id]/roster/route.ts index a7d7bba1868..e4def40fdcb 100644 --- a/apps/sim/app/api/organizations/[id]/roster/route.ts +++ b/apps/sim/app/api/organizations/[id]/roster/route.ts @@ -83,6 +83,7 @@ export const GET = withRouteHandler( userName: user.name, userEmail: user.email, userImage: user.image, + userSuspendedAt: user.suspendedAt, }) .from(member) .innerJoin(user, eq(member.userId, user.id)) @@ -96,6 +97,7 @@ export const GET = withRouteHandler( name: row.userName, email: row.userEmail, image: row.userImage, + suspendedAt: row.userSuspendedAt?.toISOString() ?? null, workspaces: [] as RosterWorkspaceAccess[], })) @@ -189,6 +191,7 @@ export const GET = withRouteHandler( userName: user.name, userEmail: user.email, userImage: user.image, + userSuspendedAt: user.suspendedAt, workspaceId: permissions.entityId, permission: permissions.permissionType, createdAt: permissions.createdAt, @@ -218,6 +221,7 @@ export const GET = withRouteHandler( name: string email: string image: string | null + suspendedAt: string | null workspaces: RosterWorkspaceAccess[] } >() @@ -247,6 +251,7 @@ export const GET = withRouteHandler( name: row.userName, email: row.userEmail, image: row.userImage, + suspendedAt: row.userSuspendedAt?.toISOString() ?? null, workspaces: [workspaceAccess], }) } diff --git a/apps/sim/app/api/organizations/[id]/scim/activity/route.ts b/apps/sim/app/api/organizations/[id]/scim/activity/route.ts index c23d444aadd..b1f8d921c63 100644 --- a/apps/sim/app/api/organizations/[id]/scim/activity/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/activity/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { listScimActivity } from '@/lib/scim/application/admin/manage-connection' +import { listScimActivity } from '@/lib/scim/application/admin/connection' /** Recent provisioning requests, so a failing sync can be diagnosed from Sim. */ export const GET = defineInternalJsonRoute({ diff --git a/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts b/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts index 93d9675fa9c..99891256ad2 100644 --- a/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { revokeScimCredential } from '@/lib/scim/application/admin/manage-connection' +import { revokeScimCredential } from '@/lib/scim/application/admin/credentials' export const DELETE = defineInternalJsonRoute({ contract: revokeScimCredentialContract, @@ -18,4 +18,5 @@ export const DELETE = defineInternalJsonRoute({ credentialId: params.credentialId, }), useCase: revokeScimCredential, + present: ({ success }) => ({ success }), }) diff --git a/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts b/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts index cbc7af6c96b..6d35b30891a 100644 --- a/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { issueScimCredential } from '@/lib/scim/application/admin/manage-connection' +import { issueScimCredential } from '@/lib/scim/application/admin/credentials' /** Issues a bearer credential. The secret is returned once and never stored. */ export const POST = defineInternalJsonRoute({ @@ -23,4 +23,5 @@ export const POST = defineInternalJsonRoute({ ...(body.expiresInDays !== undefined ? { expiresInDays: body.expiresInDays } : {}), }), useCase: issueScimCredential, + present: ({ secret, credential }) => ({ secret, credential }), }) diff --git a/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts b/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts index 653b999a826..82d05391030 100644 --- a/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { deleteScimGroupMapping } from '@/lib/scim/application/admin/manage-connection' +import { deleteScimGroupMapping } from '@/lib/scim/application/admin/mappings' export const DELETE = defineInternalJsonRoute({ contract: deleteScimGroupMappingContract, @@ -15,4 +15,5 @@ export const DELETE = defineInternalJsonRoute({ errorPolicy: internalOrchestrationErrorPolicy, mapInput: ({ params }) => ({ organizationId: params.id, mappingId: params.mappingId }), useCase: deleteScimGroupMapping, + present: ({ success, reconciledUsers }) => ({ success, reconciledUsers }), }) diff --git a/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts b/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts index 41a9bf47f01..1ad9e7dcd3f 100644 --- a/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts @@ -11,7 +11,7 @@ import { import { listScimGroupMappings, upsertScimGroupMapping, -} from '@/lib/scim/application/admin/manage-connection' +} from '@/lib/scim/application/admin/mappings' /** What each directory group means inside Sim. */ diff --git a/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts b/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts index ff3f8e46bcd..109821c987a 100644 --- a/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { reconcileScimConnection } from '@/lib/scim/application/admin/manage-connection' +import { reconcileScimConnection } from '@/lib/scim/application/admin/connection' /** * Re-applies every group mapping to every provisioned user. diff --git a/apps/sim/app/api/organizations/[id]/scim/route.ts b/apps/sim/app/api/organizations/[id]/scim/route.ts index 3272e66b7d0..7fe14cbdea9 100644 --- a/apps/sim/app/api/organizations/[id]/scim/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/route.ts @@ -8,10 +8,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { - configureScimConnection, - getScimConnection, -} from '@/lib/scim/application/admin/manage-connection' +import { configureScimConnection, getScimConnection } from '@/lib/scim/application/admin/connection' /** * The organization's directory-provisioning connection. @@ -45,4 +42,5 @@ export const PUT = defineInternalJsonRoute({ ...(body.ssoProviderId !== undefined ? { ssoProviderId: body.ssoProviderId } : {}), }), useCase: configureScimConnection, + present: ({ connection }) => ({ connection }), }) diff --git a/apps/sim/app/api/workspaces/invitations/batch/route.ts b/apps/sim/app/api/workspaces/invitations/batch/route.ts index f41989b9c8e..e544cd716df 100644 --- a/apps/sim/app/api/workspaces/invitations/batch/route.ts +++ b/apps/sim/app/api/workspaces/invitations/batch/route.ts @@ -5,6 +5,7 @@ import { type NextRequest, NextResponse } from 'next/server' import { batchWorkspaceInvitationsContract } from '@/lib/api/contracts/invitations' import { parseRequest } from '@/lib/api/server' import { getSession } from '@/lib/auth' +import { ForbiddenOperationError } from '@/lib/core/application' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { createWorkspaceInvitation, @@ -39,6 +40,13 @@ function batchErrorResponse(error: unknown) { return NextResponse.json({ error: error.message }, { status: 403 }) } + if (error instanceof ForbiddenOperationError) { + return NextResponse.json( + { error: error.message, details: { code: error.detailCode } }, + { status: 403 } + ) + } + logger.error('Error creating workspace invitation batch:', error) return NextResponse.json({ error: 'Failed to create invitation batch' }, { status: 500 }) } diff --git a/apps/sim/app/workspace/[workspaceId]/settings/components/team-management/components/organization-member-lists/organization-member-lists.tsx b/apps/sim/app/workspace/[workspaceId]/settings/components/team-management/components/organization-member-lists/organization-member-lists.tsx index cadb43c8967..3952ac18e48 100644 --- a/apps/sim/app/workspace/[workspaceId]/settings/components/team-management/components/organization-member-lists/organization-member-lists.tsx +++ b/apps/sim/app/workspace/[workspaceId]/settings/components/team-management/components/organization-member-lists/organization-member-lists.tsx @@ -131,7 +131,11 @@ export function OrganizationMemberLists({ name={member.name} email={member.email} image={member.image} - status={`Joined ${formatDate(new Date(member.createdAt))}`} + status={ + member.suspendedAt + ? 'Deactivated by your directory' + : `Joined ${formatDate(new Date(member.createdAt))}` + } roleControl={ editable ? ( } title={{credential.tokenPrefix}…} description={`Last used ${formatRelative(credential.lastUsedAt)} · ${expiry}`} - badge={expired ? Expired : undefined} trailing={ (null) + const [credentialExpiry, setCredentialExpiry] = useState('never') const [pendingRevoke, setPendingRevoke] = useState(null) async function handleToggleSetting(key: (typeof SETTING_TOGGLES)[number]['key'], value: boolean) { @@ -370,7 +378,10 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp async function handleIssue() { try { - const result = await issueCredential.mutateAsync({ organizationId }) + const result = await issueCredential.mutateAsync({ + organizationId, + ...(credentialExpiry === 'never' ? {} : { expiresInDays: Number(credentialExpiry) }), + }) setIssuedSecret(result.secret) } catch (error) { toast.error(getErrorMessage(error, 'Failed to issue credential')) @@ -402,10 +413,6 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp } } - const activeCredentials = connection.credentials.filter( - (credential) => !credential.expiresAt || new Date(credential.expiresAt) > new Date() - ) - return ( <> )) )} -
+
+ setCredentialExpiry(next as CredentialExpiry)} + options={[...CREDENTIAL_EXPIRY_OPTIONS]} + /> = 2} + disabled={issueCredential.isPending || connection.credentials.length >= 2} > {issueCredential.isPending ? 'Issuing...' : 'Issue credential'} diff --git a/apps/sim/hooks/queries/organization.test.tsx b/apps/sim/hooks/queries/organization.test.tsx index 16dfcccad6c..6e5f17644a0 100644 --- a/apps/sim/hooks/queries/organization.test.tsx +++ b/apps/sim/hooks/queries/organization.test.tsx @@ -78,6 +78,7 @@ const ROSTER_A: { success: true; data: OrganizationRoster } = { name: 'Member A', email: 'member-a@example.com', image: null, + suspendedAt: null, workspaces: [], }, ], diff --git a/apps/sim/lib/api/contracts/organization.ts b/apps/sim/lib/api/contracts/organization.ts index f8cf72bed90..c86bdf21da4 100644 --- a/apps/sim/lib/api/contracts/organization.ts +++ b/apps/sim/lib/api/contracts/organization.ts @@ -275,6 +275,8 @@ export const rosterMemberSchema = z.object({ name: z.string(), email: z.string(), image: z.string().nullable(), + /** Set while a directory deactivation blocks the member's sign-in; access is otherwise intact. */ + suspendedAt: z.string().nullable(), workspaces: z.array(rosterWorkspaceAccessSchema), }) diff --git a/apps/sim/lib/api/contracts/scim.ts b/apps/sim/lib/api/contracts/scim.ts index d1b3f06f059..150dcae0f92 100644 --- a/apps/sim/lib/api/contracts/scim.ts +++ b/apps/sim/lib/api/contracts/scim.ts @@ -148,22 +148,31 @@ const scimMetaSchema = z.object({ version: z.string(), }) +/** + * Only `schemas`, `id`, and `meta` are always present. Every other attribute may + * be dropped by `attributes` / `excludedAttributes` (RFC 7644 section 3.9), which + * Entra uses on every listing, so the response schema cannot require them. + */ export const scimUserResourceSchema = z.looseObject({ schemas: z.array(z.string()), id: z.string(), externalId: z.string().optional(), - userName: z.string(), - active: z.boolean(), - displayName: z.string(), - name: z.looseObject({ - formatted: z.string(), - givenName: z.string().optional(), - familyName: z.string().optional(), - }), - emails: z.array( - z.object({ value: z.string(), type: z.string().optional(), primary: z.boolean() }) - ), - groups: z.array(z.object({ value: z.string(), display: z.string(), $ref: z.string() })), + userName: z.string().optional(), + active: z.boolean().optional(), + displayName: z.string().optional(), + name: z + .looseObject({ + formatted: z.string(), + givenName: z.string().optional(), + familyName: z.string().optional(), + }) + .optional(), + emails: z + .array(z.object({ value: z.string(), type: z.string().optional(), primary: z.boolean() })) + .optional(), + groups: z + .array(z.object({ value: z.string(), display: z.string(), $ref: z.string() })) + .optional(), meta: scimMetaSchema, }) @@ -171,7 +180,7 @@ export const scimGroupResourceSchema = z.looseObject({ schemas: z.array(z.string()), id: z.string(), externalId: z.string().optional(), - displayName: z.string(), + displayName: z.string().optional(), members: z .array( z.object({ diff --git a/apps/sim/lib/api/server/routes/scim-route.ts b/apps/sim/lib/api/server/routes/scim-route.ts index af43d707448..4d00dca2ab9 100644 --- a/apps/sim/lib/api/server/routes/scim-route.ts +++ b/apps/sim/lib/api/server/routes/scim-route.ts @@ -227,6 +227,22 @@ export function createScimRouteBuilder(dependencies: ScimRouteDependencies) { status = scim.status scimType = scim.scimType detail = scim.message + /** + * Authenticated traffic is admitted per connection. A caller that failed + * to authenticate has no connection, so token guessing is bounded per + * source address instead. + */ + if (scim.status === 401 && !principal) { + const limited = await enforceIpRateLimit('scim-auth', request) + if (limited) { + status = 429 + return scimResponse( + scimErrorBody(429, undefined, 'Too many failed authentication attempts'), + 429, + { 'Retry-After': '60' } + ) + } + } if (scim.status >= 500) { logger.error('SCIM request failed', { connectionId: principal?.connectionId, diff --git a/apps/sim/lib/auth/sso/application/admit-sso-user.ts b/apps/sim/lib/auth/sso/application/admit-sso-user.ts index 3207660bacc..d75e535b8d1 100644 --- a/apps/sim/lib/auth/sso/application/admit-sso-user.ts +++ b/apps/sim/lib/auth/sso/application/admit-sso-user.ts @@ -5,6 +5,7 @@ import { invitation, member, permissions, + scimConnection, ssoProvider, subscription, user, @@ -130,7 +131,24 @@ async function runAdmissionTransaction( organizationIds: [provider.organizationId], }) - if (!provider.jitProvisioningEnabled) { + /** + * An organization whose directory is the only way in has said so on its + * SCIM connection; a first sign-in must not create a membership the directory + * did not ask for and will not know about. + */ + const [directoryOnly] = await tx + .select({ id: scimConnection.id }) + .from(scimConnection) + .where( + and( + eq(scimConnection.organizationId, provider.organizationId), + eq(scimConnection.status, 'active'), + sql`coalesce((${scimConnection.settings} ->> 'disableJit')::boolean, false) = true` + ) + ) + .limit(1) + + if (!provider.jitProvisioningEnabled || directoryOnly) { const [sameOrganization] = await tx .select({ id: member.id }) .from(member) diff --git a/apps/sim/lib/execution/sandbox/bundles/docx.cjs b/apps/sim/lib/execution/sandbox/bundles/docx.cjs index 8422580d836..333aef7cdf2 100644 --- a/apps/sim/lib/execution/sandbox/bundles/docx.cjs +++ b/apps/sim/lib/execution/sandbox/bundles/docx.cjs @@ -1,31 +1,31 @@ // sandbox bundle: docx // generated by apps/sim/lib/execution/sandbox/bundles/build.ts // do not edit by hand. run `bun run build:sandbox-bundles` to regenerate. -(()=>{var R5=Object.create;var{getPrototypeOf:L5,defineProperty:r1,getOwnPropertyNames:I5}=Object;var O5=Object.prototype.hasOwnProperty;function H5(B){return this[B]}var F5,W5,P5=(B,U,G)=>{var Y=B!=null&&typeof B==="object";if(Y){var Q=U?F5??=new WeakMap:W5??=new WeakMap,K=Q.get(B);if(K)return K}G=B!=null?R5(L5(B)):{};let Z=U||!B||!B.__esModule?r1(G,"default",{value:B,enumerable:!0}):G;for(let J of I5(B))if(!O5.call(Z,J))r1(Z,J,{get:H5.bind(B,J),enumerable:!0});if(Y)Q.set(B,Z);return Z};var A5=(B,U)=>()=>(U||B((U={exports:{}}).exports,U),U.exports);var j5=(B)=>B;function N5(B,U){this[B]=j5.bind(null,U)}var z5=(B,U)=>{for(var G in U)r1(B,G,{get:U[G],enumerable:!0,configurable:!0,set:N5.bind(U,G)})};var h6=A5((L7,_6)=>{var w0=_6.exports={},p0,r0;function Z8(){throw Error("setTimeout has not been defined")}function Q8(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")p0=setTimeout;else p0=Z8}catch(B){p0=Z8}try{if(typeof clearTimeout==="function")r0=clearTimeout;else r0=Q8}catch(B){r0=Q8}})();function g6(B){if(p0===setTimeout)return setTimeout(B,0);if((p0===Z8||!p0)&&setTimeout)return p0=setTimeout,setTimeout(B,0);try{return p0(B,0)}catch(U){try{return p0.call(null,B,0)}catch(G){return p0.call(this,B,0)}}}function UU(B){if(r0===clearTimeout)return clearTimeout(B);if((r0===Q8||!r0)&&clearTimeout)return r0=clearTimeout,clearTimeout(B);try{return r0(B)}catch(U){try{return r0.call(null,B)}catch(G){return r0.call(this,B)}}}var Q2=[],b2=!1,w2,z1=-1;function GU(){if(!b2||!w2)return;if(b2=!1,w2.length)Q2=w2.concat(Q2);else z1=-1;if(Q2.length)f6()}function f6(){if(b2)return;var B=g6(GU);b2=!0;var U=Q2.length;while(U){w2=Q2,Q2=[];while(++z11)for(var G=1;G"u")A1.global=globalThis;if(typeof A1.__require>"u")A1.__require=(B)=>{throw Error(`Dynamic require of "${B}" is not supported in the sandbox`)};var l0=[],h0=[],i1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(N2=0,H6=i1.length;N20)throw Error("Invalid string. Length must be a multiple of 4");var G=B.indexOf("=");if(G===-1)G=U;var Y=G===U?0:4-G%4;return[G,Y]}function E5(B,U){return(B+U)*3/4-U}function D5(B){var U,G=w5(B),Y=G[0],Q=G[1],K=new Uint8Array(E5(Y,Q)),Z=0,J=Q>0?Y-4:Y,q;for(q=0;q>16&255,K[Z++]=U>>8&255,K[Z++]=U&255;if(Q===2)U=h0[B.charCodeAt(q)]<<2|h0[B.charCodeAt(q+1)]>>4,K[Z++]=U&255;if(Q===1)U=h0[B.charCodeAt(q)]<<10|h0[B.charCodeAt(q+1)]<<4|h0[B.charCodeAt(q+2)]>>2,K[Z++]=U>>8&255,K[Z++]=U&255;return K}function T5(B){return l0[B>>18&63]+l0[B>>12&63]+l0[B>>6&63]+l0[B&63]}function C5(B,U,G){var Y,Q=[];for(var K=U;KJ?J:Z+K));if(Y===1)U=B[G-1],Q.push(l0[U>>2]+l0[U<<4&63]+"==");else if(Y===2)U=(B[G-2]<<8)+B[G-1],Q.push(l0[U>>10]+l0[U>>4&63]+l0[U<<2&63]+"=");return Q.join("")}function j1(B,U,G,Y,Q){var K,Z,J=Q*8-Y-1,q=(1<>1,I=-7,H=G?Q-1:0,T=G?-1:1,A=B[U+H];H+=T,K=A&(1<<-I)-1,A>>=-I,I+=J;for(;I>0;K=K*256+B[U+H],H+=T,I-=8);Z=K&(1<<-I)-1,K>>=-I,I+=Y;for(;I>0;Z=Z*256+B[U+H],H+=T,I-=8);if(K===0)K=1-W;else if(K===q)return Z?NaN:(A?-1:1)*(1/0);else Z=Z+Math.pow(2,Y),K=K-W;return(A?-1:1)*Z*Math.pow(2,K-Y)}function N6(B,U,G,Y,Q,K){var Z,J,q,W=K*8-Q-1,I=(1<>1,T=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=Y?0:K-1,P=Y?1:-1,j=U<0||U===0&&1/U<0?1:0;if(U=Math.abs(U),isNaN(U)||U===1/0)J=isNaN(U)?1:0,Z=I;else{if(Z=Math.floor(Math.log(U)/Math.LN2),U*(q=Math.pow(2,-Z))<1)Z--,q*=2;if(Z+H>=1)U+=T/q;else U+=T*Math.pow(2,1-H);if(U*q>=2)Z++,q/=2;if(Z+H>=I)J=0,Z=I;else if(Z+H>=1)J=(U*q-1)*Math.pow(2,Q),Z=Z+H;else J=U*Math.pow(2,H-1)*Math.pow(2,Q),Z=0}for(;Q>=8;B[G+A]=J&255,A+=P,J/=256,Q-=8);Z=Z<0;B[G+A]=Z&255,A+=P,Z/=256,W-=8);B[G+A-P]|=j*128}var W6=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,k5=50,n1=2147483647;var{btoa:Z7,atob:Q7,File:J7,Blob:K7}=globalThis;function Z2(B){if(B>n1)throw RangeError('The value "'+B+'" is invalid for option "size"');let U=new Uint8Array(B);return Object.setPrototypeOf(U,J0.prototype),U}function B8(B,U,G){return class extends G{constructor(){super();Object.defineProperty(this,"message",{value:U.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}var $5=B8("ERR_BUFFER_OUT_OF_BOUNDS",function(B){if(B)return`${B} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),S5=B8("ERR_INVALID_ARG_TYPE",function(B,U){return`The "${B}" argument must be of type number. Received type ${typeof U}`},TypeError),s1=B8("ERR_OUT_OF_RANGE",function(B,U,G){let Y=`The value of "${B}" is out of range.`,Q=G;if(Number.isInteger(G)&&Math.abs(G)>4294967296)Q=j6(String(G));else if(typeof G==="bigint"){if(Q=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))Q=j6(Q);Q+="n"}return Y+=` It must be ${U}. Received ${Q}`,Y},RangeError);function J0(B,U,G){if(typeof B==="number"){if(typeof U==="string")throw TypeError('The "string" argument must be of type string. Received type number');return U8(B)}return z6(B,U,G)}Object.defineProperty(J0.prototype,"parent",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.buffer}});Object.defineProperty(J0.prototype,"offset",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.byteOffset}});J0.poolSize=8192;function z6(B,U,G){if(typeof B==="string")return v5(B,U);if(ArrayBuffer.isView(B))return y5(B);if(B==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(a0(B,ArrayBuffer)||B&&a0(B.buffer,ArrayBuffer))return t1(B,U,G);if(typeof SharedArrayBuffer<"u"&&(a0(B,SharedArrayBuffer)||B&&a0(B.buffer,SharedArrayBuffer)))return t1(B,U,G);if(typeof B==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Y=B.valueOf&&B.valueOf();if(Y!=null&&Y!==B)return J0.from(Y,U,G);let Q=g5(B);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]==="function")return J0.from(B[Symbol.toPrimitive]("string"),U,G);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}J0.from=function(B,U,G){return z6(B,U,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);function w6(B){if(typeof B!=="number")throw TypeError('"size" argument must be of type number');else if(B<0)throw RangeError('The value "'+B+'" is invalid for option "size"')}function b5(B,U,G){if(w6(B),B<=0)return Z2(B);if(U!==void 0)return typeof G==="string"?Z2(B).fill(U,G):Z2(B).fill(U);return Z2(B)}J0.alloc=function(B,U,G){return b5(B,U,G)};function U8(B){return w6(B),Z2(B<0?0:G8(B)|0)}J0.allocUnsafe=function(B){return U8(B)};J0.allocUnsafeSlow=function(B){return U8(B)};function v5(B,U){if(typeof U!=="string"||U==="")U="utf8";if(!J0.isEncoding(U))throw TypeError("Unknown encoding: "+U);let G=E6(B,U)|0,Y=Z2(G),Q=Y.write(B,U);if(Q!==G)Y=Y.slice(0,Q);return Y}function o1(B){let U=B.length<0?0:G8(B.length)|0,G=Z2(U);for(let Y=0;Y=n1)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n1.toString(16)+" bytes");return B|0}J0.isBuffer=function(B){return B!=null&&B._isBuffer===!0&&B!==J0.prototype};J0.compare=function(B,U){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(a0(U,Uint8Array))U=J0.from(U,U.offset,U.byteLength);if(!J0.isBuffer(B)||!J0.isBuffer(U))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(B===U)return 0;let G=B.length,Y=U.length;for(let Q=0,K=Math.min(G,Y);QY.length){if(!J0.isBuffer(K))K=J0.from(K);K.copy(Y,Q)}else Uint8Array.prototype.set.call(Y,K,Q);else if(!J0.isBuffer(K))throw TypeError('"list" argument must be an Array of Buffers');else K.copy(Y,Q);Q+=K.length}return Y};function E6(B,U){if(J0.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||a0(B,ArrayBuffer))return B.byteLength;if(typeof B!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);let G=B.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&G===0)return 0;let Q=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return e1(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return y6(B).length;default:if(Q)return Y?-1:e1(B).length;U=(""+U).toLowerCase(),Q=!0}}J0.byteLength=E6;function f5(B,U,G){let Y=!1;if(U===void 0||U<0)U=0;if(U>this.length)return"";if(G===void 0||G>this.length)G=this.length;if(G<=0)return"";if(G>>>=0,U>>>=0,G<=U)return"";if(!B)B="utf8";while(!0)switch(B){case"hex":return p5(this,U,G);case"utf8":case"utf-8":return T6(this,U,G);case"ascii":return l5(this,U,G);case"latin1":case"binary":return a5(this,U,G);case"base64":return c5(this,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r5(this,U,G);default:if(Y)throw TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),Y=!0}}J0.prototype._isBuffer=!0;function z2(B,U,G){let Y=B[U];B[U]=B[G],B[G]=Y}J0.prototype.swap16=function(){let B=this.length;if(B%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let U=0;UU)B+=" ... ";return""};if(W6)J0.prototype[W6]=J0.prototype.inspect;J0.prototype.compare=function(B,U,G,Y,Q){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(!J0.isBuffer(B))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof B);if(U===void 0)U=0;if(G===void 0)G=B?B.length:0;if(Y===void 0)Y=0;if(Q===void 0)Q=this.length;if(U<0||G>B.length||Y<0||Q>this.length)throw RangeError("out of range index");if(Y>=Q&&U>=G)return 0;if(Y>=Q)return-1;if(U>=G)return 1;if(U>>>=0,G>>>=0,Y>>>=0,Q>>>=0,this===B)return 0;let K=Q-Y,Z=G-U,J=Math.min(K,Z),q=this.slice(Y,Q),W=B.slice(U,G);for(let I=0;I2147483647)G=2147483647;else if(G<-2147483648)G=-2147483648;if(G=+G,Number.isNaN(G))G=Q?0:B.length-1;if(G<0)G=B.length+G;if(G>=B.length)if(Q)return-1;else G=B.length-1;else if(G<0)if(Q)G=0;else return-1;if(typeof U==="string")U=J0.from(U,Y);if(J0.isBuffer(U)){if(U.length===0)return-1;return P6(B,U,G,Y,Q)}else if(typeof U==="number"){if(U=U&255,typeof Uint8Array.prototype.indexOf==="function")if(Q)return Uint8Array.prototype.indexOf.call(B,U,G);else return Uint8Array.prototype.lastIndexOf.call(B,U,G);return P6(B,[U],G,Y,Q)}throw TypeError("val must be string, number or Buffer")}function P6(B,U,G,Y,Q){let K=1,Z=B.length,J=U.length;if(Y!==void 0){if(Y=String(Y).toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le"){if(B.length<2||U.length<2)return-1;K=2,Z/=2,J/=2,G/=2}}function q(I,H){if(K===1)return I[H];else return I.readUInt16BE(H*K)}let W;if(Q){let I=-1;for(W=G;WZ)G=Z-J;for(W=G;W>=0;W--){let I=!0;for(let H=0;HQ)Y=Q;let K=U.length;if(Y>K/2)Y=K/2;let Z;for(Z=0;Z>>0,isFinite(G)){if(G=G>>>0,Y===void 0)Y="utf8"}else Y=G,G=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-U;if(G===void 0||G>Q)G=Q;if(B.length>0&&(G<0||U<0)||U>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!Y)Y="utf8";let K=!1;for(;;)switch(Y){case"hex":return x5(this,B,U,G);case"utf8":case"utf-8":return _5(this,B,U,G);case"ascii":case"latin1":case"binary":return h5(this,B,U,G);case"base64":return u5(this,B,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d5(this,B,U,G);default:if(K)throw TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),K=!0}};J0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c5(B,U,G){if(U===0&&G===B.length)return F6(B);else return F6(B.slice(U,G))}function T6(B,U,G){G=Math.min(B.length,G);let Y=[],Q=U;while(Q239?4:K>223?3:K>191?2:1;if(Q+J<=G){let q,W,I,H;switch(J){case 1:if(K<128)Z=K;break;case 2:if(q=B[Q+1],(q&192)===128){if(H=(K&31)<<6|q&63,H>127)Z=H}break;case 3:if(q=B[Q+1],W=B[Q+2],(q&192)===128&&(W&192)===128){if(H=(K&15)<<12|(q&63)<<6|W&63,H>2047&&(H<55296||H>57343))Z=H}break;case 4:if(q=B[Q+1],W=B[Q+2],I=B[Q+3],(q&192)===128&&(W&192)===128&&(I&192)===128){if(H=(K&15)<<18|(q&63)<<12|(W&63)<<6|I&63,H>65535&&H<1114112)Z=H}}}if(Z===null)Z=65533,J=1;else if(Z>65535)Z-=65536,Y.push(Z>>>10&1023|55296),Z=56320|Z&1023;Y.push(Z),Q+=J}return m5(Y)}var A6=4096;function m5(B){let U=B.length;if(U<=A6)return String.fromCharCode.apply(String,B);let G="",Y=0;while(YY)G=Y;let Q="";for(let K=U;KG)B=G;if(U<0){if(U+=G,U<0)U=0}else if(U>G)U=G;if(UG)throw RangeError("Trying to access beyond buffer length")}J0.prototype.readUintLE=J0.prototype.readUIntLE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B+--U],Q=1;while(U>0&&(Q*=256))Y+=this[B+--U]*Q;return Y};J0.prototype.readUint8=J0.prototype.readUInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);return this[B]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]|this[B+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]<<8|this[B+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return(this[B]|this[B+1]<<8|this[B+2]<<16)+this[B+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]*16777216+(this[B+1]<<16|this[B+2]<<8|this[B+3])};J0.prototype.readBigUInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U+this[++B]*256+this[++B]*65536+this[++B]*16777216,Q=this[++B]+this[++B]*256+this[++B]*65536+G*16777216;return BigInt(Y)+(BigInt(Q)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U*16777216+this[++B]*65536+this[++B]*256+this[++B],Q=this[++B]*16777216+this[++B]*65536+this[++B]*256+G;return(BigInt(Y)<>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K=Q)Y-=Math.pow(2,8*U);return Y};J0.prototype.readIntBE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=U,Q=1,K=this[B+--Y];while(Y>0&&(Q*=256))K+=this[B+--Y]*Q;if(Q*=128,K>=Q)K-=Math.pow(2,8*U);return K};J0.prototype.readInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);if(!(this[B]&128))return this[B];return(255-this[B]+1)*-1};J0.prototype.readInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B]|this[B+1]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B+1]|this[B]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]|this[B+1]<<8|this[B+2]<<16|this[B+3]<<24};J0.prototype.readInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]<<24|this[B+1]<<16|this[B+2]<<8|this[B+3]};J0.prototype.readBigInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=this[B+4]+this[B+5]*256+this[B+6]*65536+(G<<24);return(BigInt(Y)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=(U<<24)+this[++B]*65536+this[++B]*256+this[++B];return(BigInt(Y)<>>0,!U)$0(B,4,this.length);return j1(this,B,!0,23,4)};J0.prototype.readFloatBE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return j1(this,B,!1,23,4)};J0.prototype.readDoubleLE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!0,52,8)};J0.prototype.readDoubleBE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!1,52,8)};function g0(B,U,G,Y,Q,K){if(!J0.isBuffer(B))throw TypeError('"buffer" argument must be a Buffer instance');if(U>Q||UB.length)throw RangeError("Index out of range")}J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=1,K=0;this[U]=B&255;while(++K>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=G-1,K=1;this[U+Q]=B&255;while(--Q>=0&&(K*=256))this[U+Q]=B/K&255;return U+G};J0.prototype.writeUint8=J0.prototype.writeUInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,255,0);return this[U]=B&255,U+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U+3]=B>>>24,this[U+2]=B>>>16,this[U+1]=B>>>8,this[U]=B&255,U+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};function C6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,G}function k6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G+7]=K,K=K>>8,B[G+6]=K,K=K>>8,B[G+5]=K,K=K>>8,B[G+4]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G+3]=Z,Z=Z>>8,B[G+2]=Z,Z=Z>>8,B[G+1]=Z,Z=Z>>8,B[G]=Z,G+8}J0.prototype.writeBigUInt64LE=I2(function(B,U=0){return C6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=I2(function(B,U=0){return k6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=0,K=1,Z=0;this[U]=B&255;while(++Q>0)-Z&255}return U+G};J0.prototype.writeIntBE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=G-1,K=1,Z=0;this[U+Q]=B&255;while(--Q>=0&&(K*=256)){if(B<0&&Z===0&&this[U+Q+1]!==0)Z=1;this[U+Q]=(B/K>>0)-Z&255}return U+G};J0.prototype.writeInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,127,-128);if(B<0)B=255+B+1;return this[U]=B&255,U+1};J0.prototype.writeInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);return this[U]=B&255,this[U+1]=B>>>8,this[U+2]=B>>>16,this[U+3]=B>>>24,U+4};J0.prototype.writeInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);if(B<0)B=4294967295+B+1;return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};J0.prototype.writeBigInt64LE=I2(function(B,U=0){return C6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=I2(function(B,U=0){return k6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $6(B,U,G,Y,Q,K){if(G+Y>B.length)throw RangeError("Index out of range");if(G<0)throw RangeError("Index out of range")}function S6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return N6(B,U,G,Y,23,4),G+4}J0.prototype.writeFloatLE=function(B,U,G){return S6(this,B,U,!0,G)};J0.prototype.writeFloatBE=function(B,U,G){return S6(this,B,U,!1,G)};function b6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return N6(B,U,G,Y,52,8),G+8}J0.prototype.writeDoubleLE=function(B,U,G){return b6(this,B,U,!0,G)};J0.prototype.writeDoubleBE=function(B,U,G){return b6(this,B,U,!1,G)};J0.prototype.copy=function(B,U,G,Y){if(!J0.isBuffer(B))throw TypeError("argument should be a Buffer");if(!G)G=0;if(!Y&&Y!==0)Y=this.length;if(U>=B.length)U=B.length;if(!U)U=0;if(Y>0&&Y=this.length)throw RangeError("Index out of range");if(Y<0)throw RangeError("sourceEnd out of bounds");if(Y>this.length)Y=this.length;if(B.length-U>>0,G=G===void 0?this.length:G>>>0,!B)B=0;let Q;if(typeof B==="number")for(Q=U;Q=Y+4;G-=3)U=`_${B.slice(G-3,G)}${U}`;return`${B.slice(0,G)}${U}`}function i5(B,U,G){if(S2(U,"offset"),B[U]===void 0||B[U+G]===void 0)n2(U,B.length-(G+1))}function v6(B,U,G,Y,Q,K){if(B>G||B3)if(U===0||U===BigInt(0))J=`>= 0${Z} and < 2${Z} ** ${(K+1)*8}${Z}`;else J=`>= -(2${Z} ** ${(K+1)*8-1}${Z}) and < 2 ** ${(K+1)*8-1}${Z}`;else J=`>= ${U}${Z} and <= ${G}${Z}`;throw new s1("value",J,B)}i5(Y,Q,K)}function S2(B,U){if(typeof B!=="number")throw new S5(U,"number",B)}function n2(B,U,G){if(Math.floor(B)!==B)throw S2(B,G),new s1(G||"offset","an integer",B);if(U<0)throw new $5;throw new s1(G||"offset",`>= ${G?1:0} and <= ${U}`,B)}var n5=/[^+/0-9A-Za-z-_]/g;function s5(B){if(B=B.split("=")[0],B=B.trim().replace(n5,""),B.length<2)return"";while(B.length%4!==0)B=B+"=";return B}function e1(B,U){U=U||1/0;let G,Y=B.length,Q=null,K=[];for(let Z=0;Z55295&&G<57344){if(!Q){if(G>56319){if((U-=3)>-1)K.push(239,191,189);continue}else if(Z+1===Y){if((U-=3)>-1)K.push(239,191,189);continue}Q=G;continue}if(G<56320){if((U-=3)>-1)K.push(239,191,189);Q=G;continue}G=(Q-55296<<10|G-56320)+65536}else if(Q){if((U-=3)>-1)K.push(239,191,189)}if(Q=null,G<128){if((U-=1)<0)break;K.push(G)}else if(G<2048){if((U-=2)<0)break;K.push(G>>6|192,G&63|128)}else if(G<65536){if((U-=3)<0)break;K.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((U-=4)<0)break;K.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw Error("Invalid code point")}return K}function o5(B){let U=[];for(let G=0;G>8,Q=G%256,K.push(Q),K.push(Y)}return K}function y6(B){return D5(s5(B))}function N1(B,U,G,Y){let Q;for(Q=0;Q=U.length||Q>=B.length)break;U[Q+G]=B[Q]}return Q}function a0(B,U){return B instanceof U||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===U.name}var e5=function(){let B=Array(256);for(let U=0;U<16;++U){let G=U*16;for(let Y=0;Y<16;++Y)B[G+Y]="0123456789abcdef"[U]+"0123456789abcdef"[Y]}return B}();function I2(B){return typeof BigInt>"u"?BU:B}function BU(){throw Error("BigInt not supported")}function Y8(B){return()=>{throw Error(B+" is not implemented for node:buffer browser polyfill")}}var V7=Y8("resolveObjectURL"),X7=Y8("isUtf8");var q7=Y8("transcode");var G7=P5(h6(),1);var L6={};z5(L6,{unsignedDecimalNumber:()=>X1,universalMeasureValue:()=>q1,uniqueUuid:()=>eB,uniqueNumericIdCreator:()=>I1,uniqueId:()=>O1,uCharHexNumber:()=>W8,twipsMeasureValue:()=>E0,standardizeData:()=>j4,signedTwipsMeasureValue:()=>t0,signedHpsMeasureValue:()=>VG,shortHexNumber:()=>SB,sectionPageSizeDefaults:()=>$1,sectionMarginDefaults:()=>H2,positiveUniversalMeasureValue:()=>d8,pointMeasureValue:()=>gB,percentageValue:()=>vB,patchDocument:()=>tK,patchDetector:()=>B7,measurementOrPercentValue:()=>c8,longHexNumber:()=>KG,hpsMeasureValue:()=>bB,hexColorValue:()=>C2,hashedId:()=>P8,encodeUtf8:()=>U1,eighthPointMeasureValue:()=>yB,docPropertiesUniqueNumericIdGen:()=>oB,decimalNumber:()=>T0,dateTimeValue:()=>fB,createWrapTopAndBottom:()=>H4,createWrapTight:()=>O4,createWrapSquare:()=>I4,createWrapNone:()=>j8,createVerticalPosition:()=>J4,createVerticalAlign:()=>U6,createUnderline:()=>cB,createTransformation:()=>n8,createTableWidthElement:()=>J1,createTableRowHeight:()=>W9,createTableLook:()=>F9,createTableLayout:()=>O9,createTableFloatProperties:()=>I9,createTabStopItem:()=>b4,createTabStop:()=>v4,createStringElement:()=>f2,createSpacing:()=>S4,createSimplePos:()=>G4,createShading:()=>M1,createSectionType:()=>C9,createRunFonts:()=>T1,createParagraphStyle:()=>x2,createPageSize:()=>D9,createPageNumberType:()=>E9,createPageMargin:()=>w9,createOutlineLevel:()=>_4,createMathSuperScriptProperties:()=>p4,createMathSuperScriptElement:()=>a2,createMathSubSuperScriptProperties:()=>i4,createMathSubScriptProperties:()=>r4,createMathSubScriptElement:()=>l2,createMathPreSubSuperScriptProperties:()=>n4,createMathNAryProperties:()=>e8,createMathLimitLocation:()=>a4,createMathBase:()=>y0,createMathAccentCharacter:()=>l4,createLineNumberType:()=>N9,createIndent:()=>hB,createHorizontalPosition:()=>Q4,createHeaderFooterReference:()=>k1,createFrameProperties:()=>u4,createEmphasisMark:()=>r8,createDotEmphasisMark:()=>AG,createDocumentGrid:()=>j9,createColumns:()=>A9,createBorderElement:()=>j0,createBodyProperties:()=>K4,createAlignment:()=>m8,convertToXmlComponent:()=>u1,convertMillimetersToTwip:()=>dG,convertInchesToTwip:()=>u0,concreteNumUniqueNumericIdGen:()=>sB,commentIdToParaId:()=>z4,bookmarkUniqueNumericIdGen:()=>tB,abstractNumUniqueNumericIdGen:()=>nB,YearShort:()=>oY,YearLong:()=>BZ,XmlComponent:()=>t,XmlAttributeComponent:()=>H0,WpsShapeRun:()=>SY,WpgGroupRun:()=>bY,WidthType:()=>v1,WORKAROUND4:()=>oZ,WORKAROUND3:()=>JG,WORKAROUND2:()=>NJ,VerticalPositionRelativeFrom:()=>U4,VerticalPositionAlign:()=>MG,VerticalMergeType:()=>G6,VerticalMergeRevisionType:()=>FQ,VerticalMerge:()=>w8,VerticalAnchor:()=>cG,VerticalAlignTable:()=>K9,VerticalAlignSection:()=>V9,VerticalAlign:()=>WQ,UnderlineType:()=>i8,ThematicBreak:()=>_B,Textbox:()=>TK,TextWrappingType:()=>e2,TextWrappingSide:()=>L4,TextRun:()=>Q1,TextEffect:()=>CG,TextDirection:()=>zQ,TableRowPropertiesChange:()=>P9,TableRowProperties:()=>J6,TableRow:()=>fQ,TableProperties:()=>Q6,TableOfContents:()=>RK,TableLayoutType:()=>SQ,TableCellBorders:()=>q9,TableCell:()=>Y6,TableBorders:()=>Z6,TableAnchorType:()=>DQ,Table:()=>yQ,TabStopType:()=>z8,TabStopPosition:()=>FZ,Tab:()=>T4,TDirection:()=>R9,SymbolRun:()=>aB,Styles:()=>S1,StyleLevel:()=>LK,StyleForParagraph:()=>p2,StyleForCharacter:()=>$2,StringValueElement:()=>q2,StringEnumValueElement:()=>XG,StringContainer:()=>O2,SpaceType:()=>x0,SoftHyphen:()=>iY,SimpleMailMergeField:()=>fY,SimpleField:()=>s8,ShadingType:()=>FG,SequentialIdentifier:()=>yY,Separator:()=>YZ,SectionType:()=>GJ,SectionPropertiesChange:()=>k9,SectionProperties:()=>K6,RunPropertiesDefaults:()=>a9,RunPropertiesChange:()=>lB,RunProperties:()=>U2,Run:()=>D0,RelativeVerticalPosition:()=>CQ,RelativeHorizontalPosition:()=>TQ,PrettifyType:()=>G5,PositionalTabRelativeTo:()=>XZ,PositionalTabLeader:()=>qZ,PositionalTabAlignment:()=>VZ,PositionalTab:()=>RZ,PatchType:()=>C8,ParagraphRunProperties:()=>mB,ParagraphPropertiesDefaults:()=>l9,ParagraphPropertiesChange:()=>d4,ParagraphProperties:()=>M2,Paragraph:()=>d0,PageTextDirectionType:()=>BJ,PageTextDirection:()=>T9,PageReference:()=>CZ,PageOrientation:()=>g1,PageNumberSeparator:()=>eQ,PageNumberElement:()=>QZ,PageNumber:()=>F2,PageBreakBefore:()=>$4,PageBreak:()=>LZ,PageBorders:()=>z9,PageBorderZOrder:()=>tQ,PageBorderOffsetFrom:()=>oQ,PageBorderDisplay:()=>sQ,Packer:()=>Y5,OverlapType:()=>kQ,OnOffElement:()=>q0,Numbering:()=>d9,NumberedItemReferenceFormat:()=>wZ,NumberedItemReference:()=>DZ,NumberValueElement:()=>_2,NumberProperties:()=>C1,NumberFormat:()=>RG,NoBreakHyphen:()=>rY,NextAttributeComponent:()=>$8,MonthShort:()=>sY,MonthLong:()=>eY,Media:()=>V6,MathSuperScript:()=>rZ,MathSum:()=>mZ,MathSubSuperScript:()=>nZ,MathSubScript:()=>iZ,MathSquareBrackets:()=>QQ,MathRun:()=>hZ,MathRoundBrackets:()=>ZQ,MathRadicalProperties:()=>o4,MathRadical:()=>BQ,MathPreSubSuperScript:()=>sZ,MathNumerator:()=>m4,MathLimitUpper:()=>aZ,MathLimitLower:()=>pZ,MathLimit:()=>B6,MathIntegral:()=>lZ,MathFunctionProperties:()=>e4,MathFunctionName:()=>t4,MathFunction:()=>UQ,MathFraction:()=>uZ,MathDenominator:()=>c4,MathDegree:()=>s4,MathCurlyBrackets:()=>JQ,MathAngledBrackets:()=>KQ,Math:()=>xZ,LineRuleType:()=>k2,LineNumberRestartFormat:()=>nQ,LevelSuffix:()=>TJ,LevelOverride:()=>u9,LevelFormat:()=>i0,LevelForOverride:()=>$J,LevelBase:()=>X6,Level:()=>h9,LeaderType:()=>HZ,LastRenderedPageBreak:()=>KZ,InternalHyperlink:()=>y4,InsertedTextRun:()=>MQ,InsertedTableRow:()=>U9,InsertedTableCell:()=>Y9,InitializableXmlComponent:()=>u8,ImportedXmlComponent:()=>kB,ImportedRootElementAttributes:()=>$B,ImageRun:()=>$Y,IgnoreIfEmptyXmlComponent:()=>R2,HyperlinkType:()=>jZ,HpsMeasureElement:()=>D1,HorizontalPositionRelativeFrom:()=>B4,HorizontalPositionAlign:()=>qG,HighlightColor:()=>kG,HeightRule:()=>gQ,HeadingLevel:()=>OZ,HeaderWrapper:()=>_9,HeaderFooterType:()=>E8,HeaderFooterReferenceType:()=>T2,Header:()=>IK,GridSpan:()=>M9,FrameWrap:()=>fZ,FrameAnchorType:()=>gZ,FootnoteReferenceRun:()=>HK,FootnoteReferenceElement:()=>GZ,FootnoteReference:()=>o9,FooterWrapper:()=>f9,Footer:()=>OK,FootNotes:()=>x9,FootNoteReferenceRunAttributes:()=>s9,FileChild:()=>H1,File:()=>VK,ExternalHyperlink:()=>t8,Endnotes:()=>g9,EndnoteReferenceRunAttributes:()=>t9,EndnoteReferenceRun:()=>FK,EndnoteReference:()=>D4,EndnoteIdReference:()=>e9,EmptyElement:()=>S0,EmphasisMarkType:()=>p8,EMPTY_OBJECT:()=>KB,DropCapType:()=>yZ,Drawing:()=>m1,DocumentGridType:()=>iQ,DocumentDefaults:()=>p9,DocumentBackgroundAttributes:()=>S9,DocumentBackground:()=>b9,DocumentAttributes:()=>F1,DocumentAttributeNamespaces:()=>y1,Document:()=>VK,DeletedTextRun:()=>OQ,DeletedTableRow:()=>G9,DeletedTableCell:()=>Z9,DayShort:()=>nY,DayLong:()=>tY,ContinuationSeparator:()=>ZZ,ConcreteNumbering:()=>T8,ConcreteHyperlink:()=>m2,CommentsExtended:()=>E4,Comments:()=>w4,CommentReference:()=>mY,CommentRangeStart:()=>dY,CommentRangeEnd:()=>cY,Comment:()=>N8,ColumnBreak:()=>IZ,Column:()=>ZJ,CheckBoxUtil:()=>B5,CheckBoxSymbolElement:()=>b1,CheckBox:()=>WK,CharacterSet:()=>kZ,CellMergeAttributes:()=>Q9,CellMerge:()=>J9,CarriageReturn:()=>JZ,BuilderElement:()=>M0,BorderStyle:()=>c1,Border:()=>xB,BookmarkStart:()=>f4,BookmarkEnd:()=>x4,Bookmark:()=>g4,Body:()=>$9,BaseXmlComponent:()=>Y1,Attributes:()=>C0,AnnotationReference:()=>UZ,AlignmentType:()=>c0,AbstractNumbering:()=>D8});var{create:YU,defineProperty:QB,getOwnPropertyDescriptor:ZU,getOwnPropertyNames:QU,getPrototypeOf:JU}=Object,KU=Object.prototype.hasOwnProperty,JB=(B,U)=>()=>(B&&(U=B(B=0)),U),R0=(B,U)=>()=>(U||(B((U={exports:{}}).exports,U),B=null),U.exports),VU=(B,U,G,Y)=>{if(U&&typeof U==="object"||typeof U==="function"){for(var Q=QU(U),K=0,Z=Q.length,J;KU[q]).bind(null,J),enumerable:!(Y=ZU(U,J))||Y.enumerable})}return B},k8=(B,U,G)=>(G=B!=null?YU(JU(B)):{},VU(U||!B||!B.__esModule?QB(G,"default",{value:B,enumerable:!0}):G,B)),w1=((B)=>__require)(function(B){return __require.apply(this,arguments)});function G1(B){return G1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},G1(B)}function XU(B,U){if(G1(B)!="object"||!B)return B;var G=B[Symbol.toPrimitive];if(G!==void 0){var Y=G.call(B,U||"default");if(G1(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return(U==="string"?String:Number)(B)}function qU(B){var U=XU(B,"string");return G1(U)=="symbol"?U:U+""}function e(B,U,G){return(U=qU(U))in B?Object.defineProperty(B,U,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[U]=G,B}var Y1=class{constructor(B){e(this,"rootKey",void 0),this.rootKey=B}},KB=Object.seal({}),t=class extends Y1{constructor(B){super(B);e(this,"root",void 0),this.root=[]}prepForXml(B){var U;B.stack.push(this);let G=this.root.map((Y)=>{if(Y instanceof Y1)return Y.prepForXml(B);return Y}).filter((Y)=>Y!==void 0);return B.stack.pop(),{[this.rootKey]:G.length?G.length===1&&((U=G[0])===null||U===void 0?void 0:U._attr)?G[0]:G:KB}}addChildElement(B){return this.root.push(B),this}},R2=class extends t{constructor(B,U){super(B);e(this,"includeIfEmpty",void 0),this.includeIfEmpty=U}prepForXml(B){let U=super.prepForXml(B);if(this.includeIfEmpty)return U;if(U&&(typeof U[this.rootKey]!=="object"||Object.keys(U[this.rootKey]).length))return U}};function u6(B,U){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);U&&(Y=Y.filter(function(Q){return Object.getOwnPropertyDescriptor(B,Q).enumerable})),G.push.apply(G,Y)}return G}function L0(B){for(var U=1;U{if(Y!==void 0){let Q=this.xmlKeys&&this.xmlKeys[G]||G;U[Q]=Y}}),{_attr:U}}},$8=class extends Y1{constructor(B){super("_attr");e(this,"root",void 0),this.root=B}prepForXml(B){return{_attr:Object.values(this.root).filter(({value:U})=>U!==void 0).reduce((U,{key:G,value:Y})=>L0(L0({},U),{},{[G]:Y}),{})}}},C0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}},S8=R0((B,U)=>{var G=typeof Reflect==="object"?Reflect:null,Y=G&&typeof G.apply==="function"?G.apply:function($,x,z){return Function.prototype.apply.call($,x,z)},Q;if(G&&typeof G.ownKeys==="function")Q=G.ownKeys;else if(Object.getOwnPropertySymbols)Q=function($){return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($))};else Q=function($){return Object.getOwnPropertyNames($)};function K(M){if(console&&console.warn)console.warn(M)}var Z=Number.isNaN||function($){return $!==$};function J(){J.init.call(this)}U.exports=J,U.exports.once=v,J.EventEmitter=J,J.prototype._events=void 0,J.prototype._eventsCount=0,J.prototype._maxListeners=void 0;var q=10;function W(M){if(typeof M!=="function")throw TypeError('The "listener" argument must be of type Function. Received type '+typeof M)}Object.defineProperty(J,"defaultMaxListeners",{enumerable:!0,get:function(){return q},set:function(M){if(typeof M!=="number"||M<0||Z(M))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+M+".");q=M}}),J.init=function(){if(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)this._events=Object.create(null),this._eventsCount=0;this._maxListeners=this._maxListeners||void 0},J.prototype.setMaxListeners=function($){if(typeof $!=="number"||$<0||Z($))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+$+".");return this._maxListeners=$,this};function I(M){if(M._maxListeners===void 0)return J.defaultMaxListeners;return M._maxListeners}J.prototype.getMaxListeners=function(){return I(this)},J.prototype.emit=function($){var x=[];for(var z=1;z0)b=x[0];if(b instanceof Error)throw b;var c=Error("Unhandled error."+(b?" ("+b.message+")":""));throw c.context=b,c}var D=U0[$];if(D===void 0)return!1;if(typeof D==="function")Y(D,this,x);else{var m=D.length,B0=E(D,m);for(var z=0;z0&&b.length>a&&!b.warned){b.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+b.length+" "+String($)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=M,c.type=$,c.count=b.length,K(c)}}return M}J.prototype.addListener=function($,x){return H(this,$,x,!1)},J.prototype.on=J.prototype.addListener,J.prototype.prependListener=function($,x){return H(this,$,x,!0)};function T(){if(!this.fired){if(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0)return this.listener.call(this.target);return this.listener.apply(this.target,arguments)}}function A(M,$,x){var z={fired:!1,wrapFn:void 0,target:M,type:$,listener:x},a=T.bind(z);return a.listener=x,z.wrapFn=a,a}J.prototype.once=function($,x){return W(x),this.on($,A(this,$,x)),this},J.prototype.prependOnceListener=function($,x){return W(x),this.prependListener($,A(this,$,x)),this},J.prototype.removeListener=function($,x){var z,a,U0,b,c;if(W(x),a=this._events,a===void 0)return this;if(z=a[$],z===void 0)return this;if(z===x||z.listener===x){if(--this._eventsCount===0)this._events=Object.create(null);else if(delete a[$],a.removeListener)this.emit("removeListener",$,z.listener||x)}else if(typeof z!=="function"){U0=-1;for(b=z.length-1;b>=0;b--)if(z[b]===x||z[b].listener===x){c=z[b].listener,U0=b;break}if(U0<0)return this;if(U0===0)z.shift();else C(z,U0);if(z.length===1)a[$]=z[0];if(a.removeListener!==void 0)this.emit("removeListener",$,c||x)}return this},J.prototype.off=J.prototype.removeListener,J.prototype.removeAllListeners=function($){var x,z=this._events,a;if(z===void 0)return this;if(z.removeListener===void 0){if(arguments.length===0)this._events=Object.create(null),this._eventsCount=0;else if(z[$]!==void 0)if(--this._eventsCount===0)this._events=Object.create(null);else delete z[$];return this}if(arguments.length===0){var U0=Object.keys(z),b;for(a=0;a=0;a--)this.removeListener($,x[a]);return this};function P(M,$,x){var z=M._events;if(z===void 0)return[];var a=z[$];if(a===void 0)return[];if(typeof a==="function")return x?[a.listener||a]:[a];return x?N(a):E(a,a.length)}J.prototype.listeners=function($){return P(this,$,!0)},J.prototype.rawListeners=function($){return P(this,$,!1)},J.listenerCount=function(M,$){if(typeof M.listenerCount==="function")return M.listenerCount($);else return j.call(M,$)},J.prototype.listenerCount=j;function j(M){var $=this._events;if($!==void 0){var x=$[M];if(typeof x==="function")return 1;else if(x!==void 0)return x.length}return 0}J.prototype.eventNames=function(){return this._eventsCount>0?Q(this._events):[]};function E(M,$){var x=Array($);for(var z=0;z<$;++z)x[z]=M[z];return x}function C(M,$){for(;$+1{if(typeof Object.create==="function")U.exports=function(Y,Q){if(Q)Y.super_=Q,Y.prototype=Object.create(Q.prototype,{constructor:{value:Y,enumerable:!1,writable:!0,configurable:!0}})};else U.exports=function(Y,Q){if(Q){Y.super_=Q;var K=function(){};K.prototype=Q.prototype,Y.prototype=new K,Y.prototype.constructor=Y}}}),v0,d2=JB(()=>{v0=globalThis||self});function MU(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function O8(){throw Error("setTimeout has not been defined")}function H8(){throw Error("clearTimeout has not been defined")}function VB(B){if(n0===setTimeout)return setTimeout(B,0);if((n0===O8||!n0)&&setTimeout)return n0=setTimeout,setTimeout(B,0);try{return n0(B,0)}catch(U){try{return n0.call(null,B,0)}catch(G){return n0.call(this,B,0)}}}function RU(B){if(s0===clearTimeout)return clearTimeout(B);if((s0===H8||!s0)&&clearTimeout)return s0=clearTimeout,clearTimeout(B);try{return s0(B)}catch(U){try{return s0.call(null,B)}catch(G){return s0.call(this,B)}}}function LU(){if(!D2||!E2)return;if(D2=!1,E2.length)o0=E2.concat(o0);else B1=-1;if(o0.length)XB()}function XB(){if(D2)return;var B=VB(LU);D2=!0;var U=o0.length;while(U){E2=o0,o0=[];while(++B1{J8={exports:{}},N0=J8.exports={},function(){try{if(typeof setTimeout==="function")n0=setTimeout;else n0=O8}catch(B){n0=O8}try{if(typeof clearTimeout==="function")s0=clearTimeout;else s0=H8}catch(B){s0=H8}}(),o0=[],D2=!1,B1=-1,N0.nextTick=function(B){var U=Array(arguments.length-1);if(arguments.length>1)for(var G=1;G{U.exports=S8().EventEmitter}),IU=R0((B)=>{B.byteLength=q,B.toByteArray=I,B.fromByteArray=A;var U=[],G=[],Y=typeof Uint8Array<"u"?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var K=0,Z=Q.length;K0)throw Error("Invalid string. Length must be a multiple of 4");var E=P.indexOf("=");if(E===-1)E=j;var C=E===j?0:4-E%4;return[E,C]}function q(P){var j=J(P),E=j[0],C=j[1];return(E+C)*3/4-C}function W(P,j,E){return(j+E)*3/4-E}function I(P){var j,E=J(P),C=E[0],N=E[1],v=new Y(W(P,C,N)),S=0,F=N>0?C-4:C,M;for(M=0;M>16&255,v[S++]=j>>8&255,v[S++]=j&255;if(N===2)j=G[P.charCodeAt(M)]<<2|G[P.charCodeAt(M+1)]>>4,v[S++]=j&255;if(N===1)j=G[P.charCodeAt(M)]<<10|G[P.charCodeAt(M+1)]<<4|G[P.charCodeAt(M+2)]>>2,v[S++]=j>>8&255,v[S++]=j&255;return v}function H(P){return U[P>>18&63]+U[P>>12&63]+U[P>>6&63]+U[P&63]}function T(P,j,E){var C,N=[];for(var v=j;vF?F:S+v));if(C===1)j=P[E-1],N.push(U[j>>2]+U[j<<4&63]+"==");else if(C===2)j=(P[E-2]<<8)+P[E-1],N.push(U[j>>10]+U[j>>4&63]+U[j<<2&63]+"=");return N.join("")}}),OU=R0((B)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */B.read=function(U,G,Y,Q,K){var Z,J,q=K*8-Q-1,W=(1<>1,H=-7,T=Y?K-1:0,A=Y?-1:1,P=U[G+T];T+=A,Z=P&(1<<-H)-1,P>>=-H,H+=q;for(;H>0;Z=Z*256+U[G+T],T+=A,H-=8);J=Z&(1<<-H)-1,Z>>=-H,H+=Q;for(;H>0;J=J*256+U[G+T],T+=A,H-=8);if(Z===0)Z=1-I;else if(Z===W)return J?NaN:(P?-1:1)*(1/0);else J=J+Math.pow(2,Q),Z=Z-I;return(P?-1:1)*J*Math.pow(2,Z-Q)},B.write=function(U,G,Y,Q,K,Z){var J,q,W,I=Z*8-K-1,H=(1<>1,A=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=Q?0:Z-1,j=Q?1:-1,E=G<0||G===0&&1/G<0?1:0;if(G=Math.abs(G),isNaN(G)||G===1/0)q=isNaN(G)?1:0,J=H;else{if(J=Math.floor(Math.log(G)/Math.LN2),G*(W=Math.pow(2,-J))<1)J--,W*=2;if(J+T>=1)G+=A/W;else G+=A*Math.pow(2,1-T);if(G*W>=2)J++,W/=2;if(J+T>=H)q=0,J=H;else if(J+T>=1)q=(G*W-1)*Math.pow(2,K),J=J+T;else q=G*Math.pow(2,T-1)*Math.pow(2,K),J=0}for(;K>=8;U[Y+P]=q&255,P+=j,q/=256,K-=8);J=J<0;U[Y+P]=J&255,P+=j,J/=256,I-=8);U[Y+P-j]|=E*128}});/*! +(()=>{var R5=Object.create;var{getPrototypeOf:L5,defineProperty:r1,getOwnPropertyNames:I5}=Object;var O5=Object.prototype.hasOwnProperty;function H5(B){return this[B]}var F5,W5,P5=(B,U,G)=>{var Y=B!=null&&typeof B==="object";if(Y){var Q=U?F5??=new WeakMap:W5??=new WeakMap,K=Q.get(B);if(K)return K}G=B!=null?R5(L5(B)):{};let Z=U||!B||!B.__esModule?r1(G,"default",{value:B,enumerable:!0}):G;for(let J of I5(B))if(!O5.call(Z,J))r1(Z,J,{get:H5.bind(B,J),enumerable:!0});if(Y)Q.set(B,Z);return Z};var A5=(B,U)=>()=>(U||B((U={exports:{}}).exports,U),U.exports);var j5=(B)=>B;function N5(B,U){this[B]=j5.bind(null,U)}var w5=(B,U)=>{for(var G in U)r1(B,G,{get:U[G],enumerable:!0,configurable:!0,set:N5.bind(U,G)})};var h6=A5((L7,_6)=>{var z0=_6.exports={},p0,r0;function Z8(){throw Error("setTimeout has not been defined")}function Q8(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")p0=setTimeout;else p0=Z8}catch(B){p0=Z8}try{if(typeof clearTimeout==="function")r0=clearTimeout;else r0=Q8}catch(B){r0=Q8}})();function g6(B){if(p0===setTimeout)return setTimeout(B,0);if((p0===Z8||!p0)&&setTimeout)return p0=setTimeout,setTimeout(B,0);try{return p0(B,0)}catch(U){try{return p0.call(null,B,0)}catch(G){return p0.call(this,B,0)}}}function UU(B){if(r0===clearTimeout)return clearTimeout(B);if((r0===Q8||!r0)&&clearTimeout)return r0=clearTimeout,clearTimeout(B);try{return r0(B)}catch(U){try{return r0.call(null,B)}catch(G){return r0.call(this,B)}}}var Q2=[],b2=!1,z2,w1=-1;function GU(){if(!b2||!z2)return;if(b2=!1,z2.length)Q2=z2.concat(Q2);else w1=-1;if(Q2.length)f6()}function f6(){if(b2)return;var B=g6(GU);b2=!0;var U=Q2.length;while(U){z2=Q2,Q2=[];while(++w11)for(var G=1;G"u")A1.global=globalThis;if(typeof A1.__require>"u")A1.__require=(B)=>{throw Error(`Dynamic require of "${B}" is not supported in the sandbox`)};var l0=[],h0=[],i1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(N2=0,H6=i1.length;N20)throw Error("Invalid string. Length must be a multiple of 4");var G=B.indexOf("=");if(G===-1)G=U;var Y=G===U?0:4-G%4;return[G,Y]}function E5(B,U){return(B+U)*3/4-U}function D5(B){var U,G=z5(B),Y=G[0],Q=G[1],K=new Uint8Array(E5(Y,Q)),Z=0,J=Q>0?Y-4:Y,q;for(q=0;q>16&255,K[Z++]=U>>8&255,K[Z++]=U&255;if(Q===2)U=h0[B.charCodeAt(q)]<<2|h0[B.charCodeAt(q+1)]>>4,K[Z++]=U&255;if(Q===1)U=h0[B.charCodeAt(q)]<<10|h0[B.charCodeAt(q+1)]<<4|h0[B.charCodeAt(q+2)]>>2,K[Z++]=U>>8&255,K[Z++]=U&255;return K}function T5(B){return l0[B>>18&63]+l0[B>>12&63]+l0[B>>6&63]+l0[B&63]}function C5(B,U,G){var Y,Q=[];for(var K=U;KJ?J:Z+K));if(Y===1)U=B[G-1],Q.push(l0[U>>2]+l0[U<<4&63]+"==");else if(Y===2)U=(B[G-2]<<8)+B[G-1],Q.push(l0[U>>10]+l0[U>>4&63]+l0[U<<2&63]+"=");return Q.join("")}function j1(B,U,G,Y,Q){var K,Z,J=Q*8-Y-1,q=(1<>1,I=-7,H=G?Q-1:0,T=G?-1:1,A=B[U+H];H+=T,K=A&(1<<-I)-1,A>>=-I,I+=J;for(;I>0;K=K*256+B[U+H],H+=T,I-=8);Z=K&(1<<-I)-1,K>>=-I,I+=Y;for(;I>0;Z=Z*256+B[U+H],H+=T,I-=8);if(K===0)K=1-W;else if(K===q)return Z?NaN:(A?-1:1)*(1/0);else Z=Z+Math.pow(2,Y),K=K-W;return(A?-1:1)*Z*Math.pow(2,K-Y)}function N6(B,U,G,Y,Q,K){var Z,J,q,W=K*8-Q-1,I=(1<>1,T=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=Y?0:K-1,P=Y?1:-1,j=U<0||U===0&&1/U<0?1:0;if(U=Math.abs(U),isNaN(U)||U===1/0)J=isNaN(U)?1:0,Z=I;else{if(Z=Math.floor(Math.log(U)/Math.LN2),U*(q=Math.pow(2,-Z))<1)Z--,q*=2;if(Z+H>=1)U+=T/q;else U+=T*Math.pow(2,1-H);if(U*q>=2)Z++,q/=2;if(Z+H>=I)J=0,Z=I;else if(Z+H>=1)J=(U*q-1)*Math.pow(2,Q),Z=Z+H;else J=U*Math.pow(2,H-1)*Math.pow(2,Q),Z=0}for(;Q>=8;B[G+A]=J&255,A+=P,J/=256,Q-=8);Z=Z<0;B[G+A]=Z&255,A+=P,Z/=256,W-=8);B[G+A-P]|=j*128}var W6=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,k5=50,n1=2147483647;var{btoa:Z7,atob:Q7,File:J7,Blob:K7}=globalThis;function Z2(B){if(B>n1)throw RangeError('The value "'+B+'" is invalid for option "size"');let U=new Uint8Array(B);return Object.setPrototypeOf(U,J0.prototype),U}function B8(B,U,G){return class extends G{constructor(){super();Object.defineProperty(this,"message",{value:U.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}var $5=B8("ERR_BUFFER_OUT_OF_BOUNDS",function(B){if(B)return`${B} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),S5=B8("ERR_INVALID_ARG_TYPE",function(B,U){return`The "${B}" argument must be of type number. Received type ${typeof U}`},TypeError),s1=B8("ERR_OUT_OF_RANGE",function(B,U,G){let Y=`The value of "${B}" is out of range.`,Q=G;if(Number.isInteger(G)&&Math.abs(G)>4294967296)Q=j6(String(G));else if(typeof G==="bigint"){if(Q=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))Q=j6(Q);Q+="n"}return Y+=` It must be ${U}. Received ${Q}`,Y},RangeError);function J0(B,U,G){if(typeof B==="number"){if(typeof U==="string")throw TypeError('The "string" argument must be of type string. Received type number');return U8(B)}return w6(B,U,G)}Object.defineProperty(J0.prototype,"parent",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.buffer}});Object.defineProperty(J0.prototype,"offset",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.byteOffset}});J0.poolSize=8192;function w6(B,U,G){if(typeof B==="string")return v5(B,U);if(ArrayBuffer.isView(B))return y5(B);if(B==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(a0(B,ArrayBuffer)||B&&a0(B.buffer,ArrayBuffer))return t1(B,U,G);if(typeof SharedArrayBuffer<"u"&&(a0(B,SharedArrayBuffer)||B&&a0(B.buffer,SharedArrayBuffer)))return t1(B,U,G);if(typeof B==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Y=B.valueOf&&B.valueOf();if(Y!=null&&Y!==B)return J0.from(Y,U,G);let Q=g5(B);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]==="function")return J0.from(B[Symbol.toPrimitive]("string"),U,G);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}J0.from=function(B,U,G){return w6(B,U,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);function z6(B){if(typeof B!=="number")throw TypeError('"size" argument must be of type number');else if(B<0)throw RangeError('The value "'+B+'" is invalid for option "size"')}function b5(B,U,G){if(z6(B),B<=0)return Z2(B);if(U!==void 0)return typeof G==="string"?Z2(B).fill(U,G):Z2(B).fill(U);return Z2(B)}J0.alloc=function(B,U,G){return b5(B,U,G)};function U8(B){return z6(B),Z2(B<0?0:G8(B)|0)}J0.allocUnsafe=function(B){return U8(B)};J0.allocUnsafeSlow=function(B){return U8(B)};function v5(B,U){if(typeof U!=="string"||U==="")U="utf8";if(!J0.isEncoding(U))throw TypeError("Unknown encoding: "+U);let G=E6(B,U)|0,Y=Z2(G),Q=Y.write(B,U);if(Q!==G)Y=Y.slice(0,Q);return Y}function o1(B){let U=B.length<0?0:G8(B.length)|0,G=Z2(U);for(let Y=0;Y=n1)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n1.toString(16)+" bytes");return B|0}J0.isBuffer=function(B){return B!=null&&B._isBuffer===!0&&B!==J0.prototype};J0.compare=function(B,U){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(a0(U,Uint8Array))U=J0.from(U,U.offset,U.byteLength);if(!J0.isBuffer(B)||!J0.isBuffer(U))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(B===U)return 0;let G=B.length,Y=U.length;for(let Q=0,K=Math.min(G,Y);QY.length){if(!J0.isBuffer(K))K=J0.from(K);K.copy(Y,Q)}else Uint8Array.prototype.set.call(Y,K,Q);else if(!J0.isBuffer(K))throw TypeError('"list" argument must be an Array of Buffers');else K.copy(Y,Q);Q+=K.length}return Y};function E6(B,U){if(J0.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||a0(B,ArrayBuffer))return B.byteLength;if(typeof B!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);let G=B.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&G===0)return 0;let Q=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return e1(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return y6(B).length;default:if(Q)return Y?-1:e1(B).length;U=(""+U).toLowerCase(),Q=!0}}J0.byteLength=E6;function f5(B,U,G){let Y=!1;if(U===void 0||U<0)U=0;if(U>this.length)return"";if(G===void 0||G>this.length)G=this.length;if(G<=0)return"";if(G>>>=0,U>>>=0,G<=U)return"";if(!B)B="utf8";while(!0)switch(B){case"hex":return p5(this,U,G);case"utf8":case"utf-8":return T6(this,U,G);case"ascii":return l5(this,U,G);case"latin1":case"binary":return a5(this,U,G);case"base64":return c5(this,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r5(this,U,G);default:if(Y)throw TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),Y=!0}}J0.prototype._isBuffer=!0;function w2(B,U,G){let Y=B[U];B[U]=B[G],B[G]=Y}J0.prototype.swap16=function(){let B=this.length;if(B%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let U=0;UU)B+=" ... ";return""};if(W6)J0.prototype[W6]=J0.prototype.inspect;J0.prototype.compare=function(B,U,G,Y,Q){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(!J0.isBuffer(B))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof B);if(U===void 0)U=0;if(G===void 0)G=B?B.length:0;if(Y===void 0)Y=0;if(Q===void 0)Q=this.length;if(U<0||G>B.length||Y<0||Q>this.length)throw RangeError("out of range index");if(Y>=Q&&U>=G)return 0;if(Y>=Q)return-1;if(U>=G)return 1;if(U>>>=0,G>>>=0,Y>>>=0,Q>>>=0,this===B)return 0;let K=Q-Y,Z=G-U,J=Math.min(K,Z),q=this.slice(Y,Q),W=B.slice(U,G);for(let I=0;I2147483647)G=2147483647;else if(G<-2147483648)G=-2147483648;if(G=+G,Number.isNaN(G))G=Q?0:B.length-1;if(G<0)G=B.length+G;if(G>=B.length)if(Q)return-1;else G=B.length-1;else if(G<0)if(Q)G=0;else return-1;if(typeof U==="string")U=J0.from(U,Y);if(J0.isBuffer(U)){if(U.length===0)return-1;return P6(B,U,G,Y,Q)}else if(typeof U==="number"){if(U=U&255,typeof Uint8Array.prototype.indexOf==="function")if(Q)return Uint8Array.prototype.indexOf.call(B,U,G);else return Uint8Array.prototype.lastIndexOf.call(B,U,G);return P6(B,[U],G,Y,Q)}throw TypeError("val must be string, number or Buffer")}function P6(B,U,G,Y,Q){let K=1,Z=B.length,J=U.length;if(Y!==void 0){if(Y=String(Y).toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le"){if(B.length<2||U.length<2)return-1;K=2,Z/=2,J/=2,G/=2}}function q(I,H){if(K===1)return I[H];else return I.readUInt16BE(H*K)}let W;if(Q){let I=-1;for(W=G;WZ)G=Z-J;for(W=G;W>=0;W--){let I=!0;for(let H=0;HQ)Y=Q;let K=U.length;if(Y>K/2)Y=K/2;let Z;for(Z=0;Z>>0,isFinite(G)){if(G=G>>>0,Y===void 0)Y="utf8"}else Y=G,G=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-U;if(G===void 0||G>Q)G=Q;if(B.length>0&&(G<0||U<0)||U>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!Y)Y="utf8";let K=!1;for(;;)switch(Y){case"hex":return x5(this,B,U,G);case"utf8":case"utf-8":return _5(this,B,U,G);case"ascii":case"latin1":case"binary":return h5(this,B,U,G);case"base64":return u5(this,B,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d5(this,B,U,G);default:if(K)throw TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),K=!0}};J0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c5(B,U,G){if(U===0&&G===B.length)return F6(B);else return F6(B.slice(U,G))}function T6(B,U,G){G=Math.min(B.length,G);let Y=[],Q=U;while(Q239?4:K>223?3:K>191?2:1;if(Q+J<=G){let q,W,I,H;switch(J){case 1:if(K<128)Z=K;break;case 2:if(q=B[Q+1],(q&192)===128){if(H=(K&31)<<6|q&63,H>127)Z=H}break;case 3:if(q=B[Q+1],W=B[Q+2],(q&192)===128&&(W&192)===128){if(H=(K&15)<<12|(q&63)<<6|W&63,H>2047&&(H<55296||H>57343))Z=H}break;case 4:if(q=B[Q+1],W=B[Q+2],I=B[Q+3],(q&192)===128&&(W&192)===128&&(I&192)===128){if(H=(K&15)<<18|(q&63)<<12|(W&63)<<6|I&63,H>65535&&H<1114112)Z=H}}}if(Z===null)Z=65533,J=1;else if(Z>65535)Z-=65536,Y.push(Z>>>10&1023|55296),Z=56320|Z&1023;Y.push(Z),Q+=J}return m5(Y)}var A6=4096;function m5(B){let U=B.length;if(U<=A6)return String.fromCharCode.apply(String,B);let G="",Y=0;while(YY)G=Y;let Q="";for(let K=U;KG)B=G;if(U<0){if(U+=G,U<0)U=0}else if(U>G)U=G;if(UG)throw RangeError("Trying to access beyond buffer length")}J0.prototype.readUintLE=J0.prototype.readUIntLE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B+--U],Q=1;while(U>0&&(Q*=256))Y+=this[B+--U]*Q;return Y};J0.prototype.readUint8=J0.prototype.readUInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);return this[B]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]|this[B+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]<<8|this[B+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return(this[B]|this[B+1]<<8|this[B+2]<<16)+this[B+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]*16777216+(this[B+1]<<16|this[B+2]<<8|this[B+3])};J0.prototype.readBigUInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U+this[++B]*256+this[++B]*65536+this[++B]*16777216,Q=this[++B]+this[++B]*256+this[++B]*65536+G*16777216;return BigInt(Y)+(BigInt(Q)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U*16777216+this[++B]*65536+this[++B]*256+this[++B],Q=this[++B]*16777216+this[++B]*65536+this[++B]*256+G;return(BigInt(Y)<>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K=Q)Y-=Math.pow(2,8*U);return Y};J0.prototype.readIntBE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=U,Q=1,K=this[B+--Y];while(Y>0&&(Q*=256))K+=this[B+--Y]*Q;if(Q*=128,K>=Q)K-=Math.pow(2,8*U);return K};J0.prototype.readInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);if(!(this[B]&128))return this[B];return(255-this[B]+1)*-1};J0.prototype.readInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B]|this[B+1]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B+1]|this[B]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]|this[B+1]<<8|this[B+2]<<16|this[B+3]<<24};J0.prototype.readInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]<<24|this[B+1]<<16|this[B+2]<<8|this[B+3]};J0.prototype.readBigInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=this[B+4]+this[B+5]*256+this[B+6]*65536+(G<<24);return(BigInt(Y)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=(U<<24)+this[++B]*65536+this[++B]*256+this[++B];return(BigInt(Y)<>>0,!U)$0(B,4,this.length);return j1(this,B,!0,23,4)};J0.prototype.readFloatBE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return j1(this,B,!1,23,4)};J0.prototype.readDoubleLE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!0,52,8)};J0.prototype.readDoubleBE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!1,52,8)};function g0(B,U,G,Y,Q,K){if(!J0.isBuffer(B))throw TypeError('"buffer" argument must be a Buffer instance');if(U>Q||UB.length)throw RangeError("Index out of range")}J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=1,K=0;this[U]=B&255;while(++K>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=G-1,K=1;this[U+Q]=B&255;while(--Q>=0&&(K*=256))this[U+Q]=B/K&255;return U+G};J0.prototype.writeUint8=J0.prototype.writeUInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,255,0);return this[U]=B&255,U+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U+3]=B>>>24,this[U+2]=B>>>16,this[U+1]=B>>>8,this[U]=B&255,U+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};function C6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,G}function k6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G+7]=K,K=K>>8,B[G+6]=K,K=K>>8,B[G+5]=K,K=K>>8,B[G+4]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G+3]=Z,Z=Z>>8,B[G+2]=Z,Z=Z>>8,B[G+1]=Z,Z=Z>>8,B[G]=Z,G+8}J0.prototype.writeBigUInt64LE=I2(function(B,U=0){return C6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=I2(function(B,U=0){return k6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=0,K=1,Z=0;this[U]=B&255;while(++Q>0)-Z&255}return U+G};J0.prototype.writeIntBE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=G-1,K=1,Z=0;this[U+Q]=B&255;while(--Q>=0&&(K*=256)){if(B<0&&Z===0&&this[U+Q+1]!==0)Z=1;this[U+Q]=(B/K>>0)-Z&255}return U+G};J0.prototype.writeInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,127,-128);if(B<0)B=255+B+1;return this[U]=B&255,U+1};J0.prototype.writeInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);return this[U]=B&255,this[U+1]=B>>>8,this[U+2]=B>>>16,this[U+3]=B>>>24,U+4};J0.prototype.writeInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);if(B<0)B=4294967295+B+1;return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};J0.prototype.writeBigInt64LE=I2(function(B,U=0){return C6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=I2(function(B,U=0){return k6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $6(B,U,G,Y,Q,K){if(G+Y>B.length)throw RangeError("Index out of range");if(G<0)throw RangeError("Index out of range")}function S6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return N6(B,U,G,Y,23,4),G+4}J0.prototype.writeFloatLE=function(B,U,G){return S6(this,B,U,!0,G)};J0.prototype.writeFloatBE=function(B,U,G){return S6(this,B,U,!1,G)};function b6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return N6(B,U,G,Y,52,8),G+8}J0.prototype.writeDoubleLE=function(B,U,G){return b6(this,B,U,!0,G)};J0.prototype.writeDoubleBE=function(B,U,G){return b6(this,B,U,!1,G)};J0.prototype.copy=function(B,U,G,Y){if(!J0.isBuffer(B))throw TypeError("argument should be a Buffer");if(!G)G=0;if(!Y&&Y!==0)Y=this.length;if(U>=B.length)U=B.length;if(!U)U=0;if(Y>0&&Y=this.length)throw RangeError("Index out of range");if(Y<0)throw RangeError("sourceEnd out of bounds");if(Y>this.length)Y=this.length;if(B.length-U>>0,G=G===void 0?this.length:G>>>0,!B)B=0;let Q;if(typeof B==="number")for(Q=U;Q=Y+4;G-=3)U=`_${B.slice(G-3,G)}${U}`;return`${B.slice(0,G)}${U}`}function i5(B,U,G){if(S2(U,"offset"),B[U]===void 0||B[U+G]===void 0)n2(U,B.length-(G+1))}function v6(B,U,G,Y,Q,K){if(B>G||B3)if(U===0||U===BigInt(0))J=`>= 0${Z} and < 2${Z} ** ${(K+1)*8}${Z}`;else J=`>= -(2${Z} ** ${(K+1)*8-1}${Z}) and < 2 ** ${(K+1)*8-1}${Z}`;else J=`>= ${U}${Z} and <= ${G}${Z}`;throw new s1("value",J,B)}i5(Y,Q,K)}function S2(B,U){if(typeof B!=="number")throw new S5(U,"number",B)}function n2(B,U,G){if(Math.floor(B)!==B)throw S2(B,G),new s1(G||"offset","an integer",B);if(U<0)throw new $5;throw new s1(G||"offset",`>= ${G?1:0} and <= ${U}`,B)}var n5=/[^+/0-9A-Za-z-_]/g;function s5(B){if(B=B.split("=")[0],B=B.trim().replace(n5,""),B.length<2)return"";while(B.length%4!==0)B=B+"=";return B}function e1(B,U){U=U||1/0;let G,Y=B.length,Q=null,K=[];for(let Z=0;Z55295&&G<57344){if(!Q){if(G>56319){if((U-=3)>-1)K.push(239,191,189);continue}else if(Z+1===Y){if((U-=3)>-1)K.push(239,191,189);continue}Q=G;continue}if(G<56320){if((U-=3)>-1)K.push(239,191,189);Q=G;continue}G=(Q-55296<<10|G-56320)+65536}else if(Q){if((U-=3)>-1)K.push(239,191,189)}if(Q=null,G<128){if((U-=1)<0)break;K.push(G)}else if(G<2048){if((U-=2)<0)break;K.push(G>>6|192,G&63|128)}else if(G<65536){if((U-=3)<0)break;K.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((U-=4)<0)break;K.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw Error("Invalid code point")}return K}function o5(B){let U=[];for(let G=0;G>8,Q=G%256,K.push(Q),K.push(Y)}return K}function y6(B){return D5(s5(B))}function N1(B,U,G,Y){let Q;for(Q=0;Q=U.length||Q>=B.length)break;U[Q+G]=B[Q]}return Q}function a0(B,U){return B instanceof U||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===U.name}var e5=function(){let B=Array(256);for(let U=0;U<16;++U){let G=U*16;for(let Y=0;Y<16;++Y)B[G+Y]="0123456789abcdef"[U]+"0123456789abcdef"[Y]}return B}();function I2(B){return typeof BigInt>"u"?BU:B}function BU(){throw Error("BigInt not supported")}function Y8(B){return()=>{throw Error(B+" is not implemented for node:buffer browser polyfill")}}var V7=Y8("resolveObjectURL"),X7=Y8("isUtf8");var q7=Y8("transcode");var G7=P5(h6(),1);var L6={};w5(L6,{unsignedDecimalNumber:()=>X1,universalMeasureValue:()=>q1,uniqueUuid:()=>eB,uniqueNumericIdCreator:()=>I1,uniqueId:()=>O1,uCharHexNumber:()=>W8,twipsMeasureValue:()=>E0,standardizeData:()=>j4,signedTwipsMeasureValue:()=>t0,signedHpsMeasureValue:()=>VG,shortHexNumber:()=>SB,sectionPageSizeDefaults:()=>$1,sectionMarginDefaults:()=>H2,positiveUniversalMeasureValue:()=>d8,pointMeasureValue:()=>gB,percentageValue:()=>vB,patchDocument:()=>tK,patchDetector:()=>B7,measurementOrPercentValue:()=>c8,longHexNumber:()=>KG,hpsMeasureValue:()=>bB,hexColorValue:()=>C2,hashedId:()=>P8,encodeUtf8:()=>U1,eighthPointMeasureValue:()=>yB,docPropertiesUniqueNumericIdGen:()=>oB,decimalNumber:()=>T0,dateTimeValue:()=>fB,createWrapTopAndBottom:()=>H4,createWrapTight:()=>O4,createWrapSquare:()=>I4,createWrapNone:()=>j8,createVerticalPosition:()=>J4,createVerticalAlign:()=>U6,createUnderline:()=>cB,createTransformation:()=>n8,createTableWidthElement:()=>J1,createTableRowHeight:()=>W9,createTableLook:()=>F9,createTableLayout:()=>O9,createTableFloatProperties:()=>I9,createTabStopItem:()=>b4,createTabStop:()=>v4,createStringElement:()=>f2,createSpacing:()=>S4,createSimplePos:()=>G4,createShading:()=>M1,createSectionType:()=>C9,createRunFonts:()=>T1,createParagraphStyle:()=>x2,createPageSize:()=>D9,createPageNumberType:()=>E9,createPageMargin:()=>z9,createOutlineLevel:()=>_4,createMathSuperScriptProperties:()=>p4,createMathSuperScriptElement:()=>a2,createMathSubSuperScriptProperties:()=>i4,createMathSubScriptProperties:()=>r4,createMathSubScriptElement:()=>l2,createMathPreSubSuperScriptProperties:()=>n4,createMathNAryProperties:()=>e8,createMathLimitLocation:()=>a4,createMathBase:()=>y0,createMathAccentCharacter:()=>l4,createLineNumberType:()=>N9,createIndent:()=>hB,createHorizontalPosition:()=>Q4,createHeaderFooterReference:()=>k1,createFrameProperties:()=>u4,createEmphasisMark:()=>r8,createDotEmphasisMark:()=>AG,createDocumentGrid:()=>j9,createColumns:()=>A9,createBorderElement:()=>j0,createBodyProperties:()=>K4,createAlignment:()=>m8,convertToXmlComponent:()=>u1,convertMillimetersToTwip:()=>dG,convertInchesToTwip:()=>u0,concreteNumUniqueNumericIdGen:()=>sB,commentIdToParaId:()=>w4,bookmarkUniqueNumericIdGen:()=>tB,abstractNumUniqueNumericIdGen:()=>nB,YearShort:()=>oY,YearLong:()=>BZ,XmlComponent:()=>t,XmlAttributeComponent:()=>H0,WpsShapeRun:()=>SY,WpgGroupRun:()=>bY,WidthType:()=>v1,WORKAROUND4:()=>oZ,WORKAROUND3:()=>JG,WORKAROUND2:()=>NJ,VerticalPositionRelativeFrom:()=>U4,VerticalPositionAlign:()=>MG,VerticalMergeType:()=>G6,VerticalMergeRevisionType:()=>FQ,VerticalMerge:()=>z8,VerticalAnchor:()=>cG,VerticalAlignTable:()=>K9,VerticalAlignSection:()=>V9,VerticalAlign:()=>WQ,UnderlineType:()=>i8,ThematicBreak:()=>_B,Textbox:()=>TK,TextWrappingType:()=>e2,TextWrappingSide:()=>L4,TextRun:()=>Q1,TextEffect:()=>CG,TextDirection:()=>wQ,TableRowPropertiesChange:()=>P9,TableRowProperties:()=>J6,TableRow:()=>fQ,TableProperties:()=>Q6,TableOfContents:()=>RK,TableLayoutType:()=>SQ,TableCellBorders:()=>q9,TableCell:()=>Y6,TableBorders:()=>Z6,TableAnchorType:()=>DQ,Table:()=>yQ,TabStopType:()=>w8,TabStopPosition:()=>FZ,Tab:()=>T4,TDirection:()=>R9,SymbolRun:()=>aB,Styles:()=>S1,StyleLevel:()=>LK,StyleForParagraph:()=>p2,StyleForCharacter:()=>$2,StringValueElement:()=>q2,StringEnumValueElement:()=>XG,StringContainer:()=>O2,SpaceType:()=>x0,SoftHyphen:()=>iY,SimpleMailMergeField:()=>fY,SimpleField:()=>s8,ShadingType:()=>FG,SequentialIdentifier:()=>yY,Separator:()=>YZ,SectionType:()=>GJ,SectionPropertiesChange:()=>k9,SectionProperties:()=>K6,RunPropertiesDefaults:()=>a9,RunPropertiesChange:()=>lB,RunProperties:()=>U2,Run:()=>D0,RelativeVerticalPosition:()=>CQ,RelativeHorizontalPosition:()=>TQ,PrettifyType:()=>G5,PositionalTabRelativeTo:()=>XZ,PositionalTabLeader:()=>qZ,PositionalTabAlignment:()=>VZ,PositionalTab:()=>RZ,PatchType:()=>C8,ParagraphRunProperties:()=>mB,ParagraphPropertiesDefaults:()=>l9,ParagraphPropertiesChange:()=>d4,ParagraphProperties:()=>M2,Paragraph:()=>d0,PageTextDirectionType:()=>BJ,PageTextDirection:()=>T9,PageReference:()=>CZ,PageOrientation:()=>g1,PageNumberSeparator:()=>eQ,PageNumberElement:()=>QZ,PageNumber:()=>F2,PageBreakBefore:()=>$4,PageBreak:()=>LZ,PageBorders:()=>w9,PageBorderZOrder:()=>tQ,PageBorderOffsetFrom:()=>oQ,PageBorderDisplay:()=>sQ,Packer:()=>Y5,OverlapType:()=>kQ,OnOffElement:()=>q0,Numbering:()=>d9,NumberedItemReferenceFormat:()=>zZ,NumberedItemReference:()=>DZ,NumberValueElement:()=>_2,NumberProperties:()=>C1,NumberFormat:()=>RG,NoBreakHyphen:()=>rY,NextAttributeComponent:()=>$8,MonthShort:()=>sY,MonthLong:()=>eY,Media:()=>V6,MathSuperScript:()=>rZ,MathSum:()=>mZ,MathSubSuperScript:()=>nZ,MathSubScript:()=>iZ,MathSquareBrackets:()=>QQ,MathRun:()=>hZ,MathRoundBrackets:()=>ZQ,MathRadicalProperties:()=>o4,MathRadical:()=>BQ,MathPreSubSuperScript:()=>sZ,MathNumerator:()=>m4,MathLimitUpper:()=>aZ,MathLimitLower:()=>pZ,MathLimit:()=>B6,MathIntegral:()=>lZ,MathFunctionProperties:()=>e4,MathFunctionName:()=>t4,MathFunction:()=>UQ,MathFraction:()=>uZ,MathDenominator:()=>c4,MathDegree:()=>s4,MathCurlyBrackets:()=>JQ,MathAngledBrackets:()=>KQ,Math:()=>xZ,LineRuleType:()=>k2,LineNumberRestartFormat:()=>nQ,LevelSuffix:()=>TJ,LevelOverride:()=>u9,LevelFormat:()=>i0,LevelForOverride:()=>$J,LevelBase:()=>X6,Level:()=>h9,LeaderType:()=>HZ,LastRenderedPageBreak:()=>KZ,InternalHyperlink:()=>y4,InsertedTextRun:()=>MQ,InsertedTableRow:()=>U9,InsertedTableCell:()=>Y9,InitializableXmlComponent:()=>u8,ImportedXmlComponent:()=>kB,ImportedRootElementAttributes:()=>$B,ImageRun:()=>$Y,IgnoreIfEmptyXmlComponent:()=>R2,HyperlinkType:()=>jZ,HpsMeasureElement:()=>D1,HorizontalPositionRelativeFrom:()=>B4,HorizontalPositionAlign:()=>qG,HighlightColor:()=>kG,HeightRule:()=>gQ,HeadingLevel:()=>OZ,HeaderWrapper:()=>_9,HeaderFooterType:()=>E8,HeaderFooterReferenceType:()=>T2,Header:()=>IK,GridSpan:()=>M9,FrameWrap:()=>fZ,FrameAnchorType:()=>gZ,FootnoteReferenceRun:()=>HK,FootnoteReferenceElement:()=>GZ,FootnoteReference:()=>o9,FooterWrapper:()=>f9,Footer:()=>OK,FootNotes:()=>x9,FootNoteReferenceRunAttributes:()=>s9,FileChild:()=>H1,File:()=>VK,ExternalHyperlink:()=>t8,Endnotes:()=>g9,EndnoteReferenceRunAttributes:()=>t9,EndnoteReferenceRun:()=>FK,EndnoteReference:()=>D4,EndnoteIdReference:()=>e9,EmptyElement:()=>S0,EmphasisMarkType:()=>p8,EMPTY_OBJECT:()=>KB,DropCapType:()=>yZ,Drawing:()=>m1,DocumentGridType:()=>iQ,DocumentDefaults:()=>p9,DocumentBackgroundAttributes:()=>S9,DocumentBackground:()=>b9,DocumentAttributes:()=>F1,DocumentAttributeNamespaces:()=>y1,Document:()=>VK,DeletedTextRun:()=>OQ,DeletedTableRow:()=>G9,DeletedTableCell:()=>Z9,DayShort:()=>nY,DayLong:()=>tY,ContinuationSeparator:()=>ZZ,ConcreteNumbering:()=>T8,ConcreteHyperlink:()=>m2,CommentsExtended:()=>E4,Comments:()=>z4,CommentReference:()=>mY,CommentRangeStart:()=>dY,CommentRangeEnd:()=>cY,Comment:()=>N8,ColumnBreak:()=>IZ,Column:()=>ZJ,CheckBoxUtil:()=>B5,CheckBoxSymbolElement:()=>b1,CheckBox:()=>WK,CharacterSet:()=>kZ,CellMergeAttributes:()=>Q9,CellMerge:()=>J9,CarriageReturn:()=>JZ,BuilderElement:()=>M0,BorderStyle:()=>c1,Border:()=>xB,BookmarkStart:()=>f4,BookmarkEnd:()=>x4,Bookmark:()=>g4,Body:()=>$9,BaseXmlComponent:()=>Y1,Attributes:()=>C0,AnnotationReference:()=>UZ,AlignmentType:()=>c0,AbstractNumbering:()=>D8});var{create:YU,defineProperty:QB,getOwnPropertyDescriptor:ZU,getOwnPropertyNames:QU,getPrototypeOf:JU}=Object,KU=Object.prototype.hasOwnProperty,JB=(B,U)=>()=>(B&&(U=B(B=0)),U),R0=(B,U)=>()=>(U||(B((U={exports:{}}).exports,U),B=null),U.exports),VU=(B,U,G,Y)=>{if(U&&typeof U==="object"||typeof U==="function"){for(var Q=QU(U),K=0,Z=Q.length,J;KU[q]).bind(null,J),enumerable:!(Y=ZU(U,J))||Y.enumerable})}return B},k8=(B,U,G)=>(G=B!=null?YU(JU(B)):{},VU(U||!B||!B.__esModule?QB(G,"default",{value:B,enumerable:!0}):G,B)),z1=((B)=>__require)(function(B){return __require.apply(this,arguments)});function G1(B){return G1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},G1(B)}function XU(B,U){if(G1(B)!="object"||!B)return B;var G=B[Symbol.toPrimitive];if(G!==void 0){var Y=G.call(B,U||"default");if(G1(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return(U==="string"?String:Number)(B)}function qU(B){var U=XU(B,"string");return G1(U)=="symbol"?U:U+""}function e(B,U,G){return(U=qU(U))in B?Object.defineProperty(B,U,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[U]=G,B}var Y1=class{constructor(B){e(this,"rootKey",void 0),this.rootKey=B}},KB=Object.seal({}),t=class extends Y1{constructor(B){super(B);e(this,"root",void 0),this.root=[]}prepForXml(B){var U;B.stack.push(this);let G=this.root.map((Y)=>{if(Y instanceof Y1)return Y.prepForXml(B);return Y}).filter((Y)=>Y!==void 0);return B.stack.pop(),{[this.rootKey]:G.length?G.length===1&&((U=G[0])===null||U===void 0?void 0:U._attr)?G[0]:G:KB}}addChildElement(B){return this.root.push(B),this}},R2=class extends t{constructor(B,U){super(B);e(this,"includeIfEmpty",void 0),this.includeIfEmpty=U}prepForXml(B){let U=super.prepForXml(B);if(this.includeIfEmpty)return U;if(U&&(typeof U[this.rootKey]!=="object"||Object.keys(U[this.rootKey]).length))return U}};function u6(B,U){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);U&&(Y=Y.filter(function(Q){return Object.getOwnPropertyDescriptor(B,Q).enumerable})),G.push.apply(G,Y)}return G}function L0(B){for(var U=1;U{if(Y!==void 0){let Q=this.xmlKeys&&this.xmlKeys[G]||G;U[Q]=Y}}),{_attr:U}}},$8=class extends Y1{constructor(B){super("_attr");e(this,"root",void 0),this.root=B}prepForXml(B){return{_attr:Object.values(this.root).filter(({value:U})=>U!==void 0).reduce((U,{key:G,value:Y})=>L0(L0({},U),{},{[G]:Y}),{})}}},C0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}},S8=R0((B,U)=>{var G=typeof Reflect==="object"?Reflect:null,Y=G&&typeof G.apply==="function"?G.apply:function($,x,w){return Function.prototype.apply.call($,x,w)},Q;if(G&&typeof G.ownKeys==="function")Q=G.ownKeys;else if(Object.getOwnPropertySymbols)Q=function($){return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($))};else Q=function($){return Object.getOwnPropertyNames($)};function K(M){if(console&&console.warn)console.warn(M)}var Z=Number.isNaN||function($){return $!==$};function J(){J.init.call(this)}U.exports=J,U.exports.once=v,J.EventEmitter=J,J.prototype._events=void 0,J.prototype._eventsCount=0,J.prototype._maxListeners=void 0;var q=10;function W(M){if(typeof M!=="function")throw TypeError('The "listener" argument must be of type Function. Received type '+typeof M)}Object.defineProperty(J,"defaultMaxListeners",{enumerable:!0,get:function(){return q},set:function(M){if(typeof M!=="number"||M<0||Z(M))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+M+".");q=M}}),J.init=function(){if(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)this._events=Object.create(null),this._eventsCount=0;this._maxListeners=this._maxListeners||void 0},J.prototype.setMaxListeners=function($){if(typeof $!=="number"||$<0||Z($))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+$+".");return this._maxListeners=$,this};function I(M){if(M._maxListeners===void 0)return J.defaultMaxListeners;return M._maxListeners}J.prototype.getMaxListeners=function(){return I(this)},J.prototype.emit=function($){var x=[];for(var w=1;w0)b=x[0];if(b instanceof Error)throw b;var c=Error("Unhandled error."+(b?" ("+b.message+")":""));throw c.context=b,c}var D=U0[$];if(D===void 0)return!1;if(typeof D==="function")Y(D,this,x);else{var m=D.length,B0=E(D,m);for(var w=0;w0&&b.length>a&&!b.warned){b.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+b.length+" "+String($)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=M,c.type=$,c.count=b.length,K(c)}}return M}J.prototype.addListener=function($,x){return H(this,$,x,!1)},J.prototype.on=J.prototype.addListener,J.prototype.prependListener=function($,x){return H(this,$,x,!0)};function T(){if(!this.fired){if(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0)return this.listener.call(this.target);return this.listener.apply(this.target,arguments)}}function A(M,$,x){var w={fired:!1,wrapFn:void 0,target:M,type:$,listener:x},a=T.bind(w);return a.listener=x,w.wrapFn=a,a}J.prototype.once=function($,x){return W(x),this.on($,A(this,$,x)),this},J.prototype.prependOnceListener=function($,x){return W(x),this.prependListener($,A(this,$,x)),this},J.prototype.removeListener=function($,x){var w,a,U0,b,c;if(W(x),a=this._events,a===void 0)return this;if(w=a[$],w===void 0)return this;if(w===x||w.listener===x){if(--this._eventsCount===0)this._events=Object.create(null);else if(delete a[$],a.removeListener)this.emit("removeListener",$,w.listener||x)}else if(typeof w!=="function"){U0=-1;for(b=w.length-1;b>=0;b--)if(w[b]===x||w[b].listener===x){c=w[b].listener,U0=b;break}if(U0<0)return this;if(U0===0)w.shift();else C(w,U0);if(w.length===1)a[$]=w[0];if(a.removeListener!==void 0)this.emit("removeListener",$,c||x)}return this},J.prototype.off=J.prototype.removeListener,J.prototype.removeAllListeners=function($){var x,w=this._events,a;if(w===void 0)return this;if(w.removeListener===void 0){if(arguments.length===0)this._events=Object.create(null),this._eventsCount=0;else if(w[$]!==void 0)if(--this._eventsCount===0)this._events=Object.create(null);else delete w[$];return this}if(arguments.length===0){var U0=Object.keys(w),b;for(a=0;a=0;a--)this.removeListener($,x[a]);return this};function P(M,$,x){var w=M._events;if(w===void 0)return[];var a=w[$];if(a===void 0)return[];if(typeof a==="function")return x?[a.listener||a]:[a];return x?N(a):E(a,a.length)}J.prototype.listeners=function($){return P(this,$,!0)},J.prototype.rawListeners=function($){return P(this,$,!1)},J.listenerCount=function(M,$){if(typeof M.listenerCount==="function")return M.listenerCount($);else return j.call(M,$)},J.prototype.listenerCount=j;function j(M){var $=this._events;if($!==void 0){var x=$[M];if(typeof x==="function")return 1;else if(x!==void 0)return x.length}return 0}J.prototype.eventNames=function(){return this._eventsCount>0?Q(this._events):[]};function E(M,$){var x=Array($);for(var w=0;w<$;++w)x[w]=M[w];return x}function C(M,$){for(;$+1{if(typeof Object.create==="function")U.exports=function(Y,Q){if(Q)Y.super_=Q,Y.prototype=Object.create(Q.prototype,{constructor:{value:Y,enumerable:!1,writable:!0,configurable:!0}})};else U.exports=function(Y,Q){if(Q){Y.super_=Q;var K=function(){};K.prototype=Q.prototype,Y.prototype=new K,Y.prototype.constructor=Y}}}),v0,d2=JB(()=>{v0=globalThis||self});function MU(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function O8(){throw Error("setTimeout has not been defined")}function H8(){throw Error("clearTimeout has not been defined")}function VB(B){if(n0===setTimeout)return setTimeout(B,0);if((n0===O8||!n0)&&setTimeout)return n0=setTimeout,setTimeout(B,0);try{return n0(B,0)}catch(U){try{return n0.call(null,B,0)}catch(G){return n0.call(this,B,0)}}}function RU(B){if(s0===clearTimeout)return clearTimeout(B);if((s0===H8||!s0)&&clearTimeout)return s0=clearTimeout,clearTimeout(B);try{return s0(B)}catch(U){try{return s0.call(null,B)}catch(G){return s0.call(this,B)}}}function LU(){if(!D2||!E2)return;if(D2=!1,E2.length)o0=E2.concat(o0);else B1=-1;if(o0.length)XB()}function XB(){if(D2)return;var B=VB(LU);D2=!0;var U=o0.length;while(U){E2=o0,o0=[];while(++B1{J8={exports:{}},N0=J8.exports={},function(){try{if(typeof setTimeout==="function")n0=setTimeout;else n0=O8}catch(B){n0=O8}try{if(typeof clearTimeout==="function")s0=clearTimeout;else s0=H8}catch(B){s0=H8}}(),o0=[],D2=!1,B1=-1,N0.nextTick=function(B){var U=Array(arguments.length-1);if(arguments.length>1)for(var G=1;G{U.exports=S8().EventEmitter}),IU=R0((B)=>{B.byteLength=q,B.toByteArray=I,B.fromByteArray=A;var U=[],G=[],Y=typeof Uint8Array<"u"?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var K=0,Z=Q.length;K0)throw Error("Invalid string. Length must be a multiple of 4");var E=P.indexOf("=");if(E===-1)E=j;var C=E===j?0:4-E%4;return[E,C]}function q(P){var j=J(P),E=j[0],C=j[1];return(E+C)*3/4-C}function W(P,j,E){return(j+E)*3/4-E}function I(P){var j,E=J(P),C=E[0],N=E[1],v=new Y(W(P,C,N)),S=0,F=N>0?C-4:C,M;for(M=0;M>16&255,v[S++]=j>>8&255,v[S++]=j&255;if(N===2)j=G[P.charCodeAt(M)]<<2|G[P.charCodeAt(M+1)]>>4,v[S++]=j&255;if(N===1)j=G[P.charCodeAt(M)]<<10|G[P.charCodeAt(M+1)]<<4|G[P.charCodeAt(M+2)]>>2,v[S++]=j>>8&255,v[S++]=j&255;return v}function H(P){return U[P>>18&63]+U[P>>12&63]+U[P>>6&63]+U[P&63]}function T(P,j,E){var C,N=[];for(var v=j;vF?F:S+v));if(C===1)j=P[E-1],N.push(U[j>>2]+U[j<<4&63]+"==");else if(C===2)j=(P[E-2]<<8)+P[E-1],N.push(U[j>>10]+U[j>>4&63]+U[j<<2&63]+"=");return N.join("")}}),OU=R0((B)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */B.read=function(U,G,Y,Q,K){var Z,J,q=K*8-Q-1,W=(1<>1,H=-7,T=Y?K-1:0,A=Y?-1:1,P=U[G+T];T+=A,Z=P&(1<<-H)-1,P>>=-H,H+=q;for(;H>0;Z=Z*256+U[G+T],T+=A,H-=8);J=Z&(1<<-H)-1,Z>>=-H,H+=Q;for(;H>0;J=J*256+U[G+T],T+=A,H-=8);if(Z===0)Z=1-I;else if(Z===W)return J?NaN:(P?-1:1)*(1/0);else J=J+Math.pow(2,Q),Z=Z-I;return(P?-1:1)*J*Math.pow(2,Z-Q)},B.write=function(U,G,Y,Q,K,Z){var J,q,W,I=Z*8-K-1,H=(1<>1,A=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=Q?0:Z-1,j=Q?1:-1,E=G<0||G===0&&1/G<0?1:0;if(G=Math.abs(G),isNaN(G)||G===1/0)q=isNaN(G)?1:0,J=H;else{if(J=Math.floor(Math.log(G)/Math.LN2),G*(W=Math.pow(2,-J))<1)J--,W*=2;if(J+T>=1)G+=A/W;else G+=A*Math.pow(2,1-T);if(G*W>=2)J++,W/=2;if(J+T>=H)q=0,J=H;else if(J+T>=1)q=(G*W-1)*Math.pow(2,K),J=J+T;else q=G*Math.pow(2,T-1)*Math.pow(2,K),J=0}for(;K>=8;U[Y+P]=q&255,P+=j,q/=256,K-=8);J=J<0;U[Y+P]=J&255,P+=j,J/=256,I-=8);U[Y+P-j]|=E*128}});/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT -*/var f1=R0((B)=>{var U=IU(),G=OU(),Y=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=J,B.SlowBuffer=N,B.INSPECT_MAX_BYTES=50;var Q=2147483647;if(B.kMaxLength=Q,J.TYPED_ARRAY_SUPPORT=K(),!J.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error==="function")console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function K(){try{var k=new Uint8Array(1),V={foo:function(){return 42}};return Object.setPrototypeOf(V,Uint8Array.prototype),Object.setPrototypeOf(k,V),k.foo()===42}catch(X){return!1}}Object.defineProperty(J.prototype,"parent",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.buffer}}),Object.defineProperty(J.prototype,"offset",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.byteOffset}});function Z(k){if(k>Q)throw RangeError('The value "'+k+'" is invalid for option "size"');var V=new Uint8Array(k);return Object.setPrototypeOf(V,J.prototype),V}function J(k,V,X){if(typeof k==="number"){if(typeof V==="string")throw TypeError('The "string" argument must be of type string. Received type number');return H(k)}return q(k,V,X)}J.poolSize=8192;function q(k,V,X){if(typeof k==="string")return T(k,V);if(ArrayBuffer.isView(k))return P(k);if(k==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(f(k,ArrayBuffer)||k&&f(k.buffer,ArrayBuffer))return j(k,V,X);if(typeof SharedArrayBuffer<"u"&&(f(k,SharedArrayBuffer)||k&&f(k.buffer,SharedArrayBuffer)))return j(k,V,X);if(typeof k==="number")throw TypeError('The "value" argument must not be of type number. Received type number');var O=k.valueOf&&k.valueOf();if(O!=null&&O!==k)return J.from(O,V,X);var _=E(k);if(_)return _;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]==="function")return J.from(k[Symbol.toPrimitive]("string"),V,X);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}J.from=function(k,V,X){return q(k,V,X)},Object.setPrototypeOf(J.prototype,Uint8Array.prototype),Object.setPrototypeOf(J,Uint8Array);function W(k){if(typeof k!=="number")throw TypeError('"size" argument must be of type number');else if(k<0)throw RangeError('The value "'+k+'" is invalid for option "size"')}function I(k,V,X){if(W(k),k<=0)return Z(k);if(V!==void 0)return typeof X==="string"?Z(k).fill(V,X):Z(k).fill(V);return Z(k)}J.alloc=function(k,V,X){return I(k,V,X)};function H(k){return W(k),Z(k<0?0:C(k)|0)}J.allocUnsafe=function(k){return H(k)},J.allocUnsafeSlow=function(k){return H(k)};function T(k,V){if(typeof V!=="string"||V==="")V="utf8";if(!J.isEncoding(V))throw TypeError("Unknown encoding: "+V);var X=v(k,V)|0,O=Z(X),_=O.write(k,V);if(_!==X)O=O.slice(0,_);return O}function A(k){var V=k.length<0?0:C(k.length)|0,X=Z(V);for(var O=0;O=Q)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return k|0}function N(k){if(+k!=k)k=0;return J.alloc(+k)}J.isBuffer=function(V){return V!=null&&V._isBuffer===!0&&V!==J.prototype},J.compare=function(V,X){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(f(X,Uint8Array))X=J.from(X,X.offset,X.byteLength);if(!J.isBuffer(V)||!J.isBuffer(X))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(V===X)return 0;var O=V.length,_=X.length;for(var l=0,d=Math.min(O,_);l_.length)J.from(d).copy(_,l);else Uint8Array.prototype.set.call(_,d,l);else if(!J.isBuffer(d))throw TypeError('"list" argument must be an Array of Buffers');else d.copy(_,l);l+=d.length}return _};function v(k,V){if(J.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||f(k,ArrayBuffer))return k.byteLength;if(typeof k!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);var X=k.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&X===0)return 0;var _=!1;for(;;)switch(V){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return L(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return Z0(k).length;default:if(_)return O?-1:L(k).length;V=(""+V).toLowerCase(),_=!0}}J.byteLength=v;function S(k,V,X){var O=!1;if(V===void 0||V<0)V=0;if(V>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,V>>>=0,X<=V)return"";if(!k)k="utf8";while(!0)switch(k){case"hex":return s(this,V,X);case"utf8":case"utf-8":return D(this,V,X);case"ascii":return i(this,V,X);case"latin1":case"binary":return V0(this,V,X);case"base64":return c(this,V,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G0(this,V,X);default:if(O)throw TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),O=!0}}J.prototype._isBuffer=!0;function F(k,V,X){var O=k[V];k[V]=k[X],k[X]=O}if(J.prototype.swap16=function(){var V=this.length;if(V%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var X=0;XX)V+=" ... ";return""},Y)J.prototype[Y]=J.prototype.inspect;J.prototype.compare=function(V,X,O,_,l){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(!J.isBuffer(V))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof V);if(X===void 0)X=0;if(O===void 0)O=V?V.length:0;if(_===void 0)_=0;if(l===void 0)l=this.length;if(X<0||O>V.length||_<0||l>this.length)throw RangeError("out of range index");if(_>=l&&X>=O)return 0;if(_>=l)return-1;if(X>=O)return 1;if(X>>>=0,O>>>=0,_>>>=0,l>>>=0,this===V)return 0;var d=l-_,Q0=O-X,X0=Math.min(d,Q0),K0=this.slice(_,l),I0=V.slice(X,O);for(var F0=0;F02147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,R(X))X=_?0:k.length-1;if(X<0)X=k.length+X;if(X>=k.length)if(_)return-1;else X=k.length-1;else if(X<0)if(_)X=0;else return-1;if(typeof V==="string")V=J.from(V,O);if(J.isBuffer(V)){if(V.length===0)return-1;return $(k,V,X,O,_)}else if(typeof V==="number"){if(V=V&255,typeof Uint8Array.prototype.indexOf==="function")if(_)return Uint8Array.prototype.indexOf.call(k,V,X);else return Uint8Array.prototype.lastIndexOf.call(k,V,X);return $(k,[V],X,O,_)}throw TypeError("val must be string, number or Buffer")}function $(k,V,X,O,_){var l=1,d=k.length,Q0=V.length;if(O!==void 0){if(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le"){if(k.length<2||V.length<2)return-1;l=2,d/=2,Q0/=2,X/=2}}function X0(k0,L2){if(l===1)return k0[L2];else return k0.readUInt16BE(L2*l)}var K0;if(_){var I0=-1;for(K0=X;K0d)X=d-Q0;for(K0=X;K0>=0;K0--){var F0=!0;for(var W0=0;W0_)O=_;var l=V.length;if(O>l/2)O=l/2;for(var d=0;d>>0,isFinite(O)){if(O=O>>>0,_===void 0)_="utf8"}else _=O,O=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-X;if(O===void 0||O>l)O=l;if(V.length>0&&(O<0||X<0)||X>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!_)_="utf8";var d=!1;for(;;)switch(_){case"hex":return x(this,V,X,O);case"utf8":case"utf-8":return z(this,V,X,O);case"ascii":case"latin1":case"binary":return a(this,V,X,O);case"base64":return U0(this,V,X,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,V,X,O);default:if(d)throw TypeError("Unknown encoding: "+_);_=(""+_).toLowerCase(),d=!0}},J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c(k,V,X){if(V===0&&X===k.length)return U.fromByteArray(k);else return U.fromByteArray(k.slice(V,X))}function D(k,V,X){X=Math.min(k.length,X);var O=[],_=V;while(_239?4:l>223?3:l>191?2:1;if(_+Q0<=X){var X0,K0,I0,F0;switch(Q0){case 1:if(l<128)d=l;break;case 2:if(X0=k[_+1],(X0&192)===128){if(F0=(l&31)<<6|X0&63,F0>127)d=F0}break;case 3:if(X0=k[_+1],K0=k[_+2],(X0&192)===128&&(K0&192)===128){if(F0=(l&15)<<12|(X0&63)<<6|K0&63,F0>2047&&(F0<55296||F0>57343))d=F0}break;case 4:if(X0=k[_+1],K0=k[_+2],I0=k[_+3],(X0&192)===128&&(K0&192)===128&&(I0&192)===128){if(F0=(l&15)<<18|(X0&63)<<12|(K0&63)<<6|I0&63,F0>65535&&F0<1114112)d=F0}}}if(d===null)d=65533,Q0=1;else if(d>65535)d-=65536,O.push(d>>>10&1023|55296),d=56320|d&1023;O.push(d),_+=Q0}return B0(O)}var m=4096;function B0(k){var V=k.length;if(V<=m)return String.fromCharCode.apply(String,k);var X="",O=0;while(OO)X=O;var _="";for(var l=V;lO)V=O;if(X<0){if(X+=O,X<0)X=0}else if(X>O)X=O;if(XX)throw RangeError("Trying to access beyond buffer length")}J.prototype.readUintLE=J.prototype.readUIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V+--X],l=1;while(X>0&&(l*=256))_+=this[V+--X]*l;return _},J.prototype.readUint8=J.prototype.readUInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);return this[V]},J.prototype.readUint16LE=J.prototype.readUInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]|this[V+1]<<8},J.prototype.readUint16BE=J.prototype.readUInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]<<8|this[V+1]},J.prototype.readUint32LE=J.prototype.readUInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return(this[V]|this[V+1]<<8|this[V+2]<<16)+this[V+3]*16777216},J.prototype.readUint32BE=J.prototype.readUInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]*16777216+(this[V+1]<<16|this[V+2]<<8|this[V+3])},J.prototype.readIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d=l)_-=Math.pow(2,8*X);return _},J.prototype.readIntBE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=X,l=1,d=this[V+--_];while(_>0&&(l*=256))d+=this[V+--_]*l;if(l*=128,d>=l)d-=Math.pow(2,8*X);return d},J.prototype.readInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);if(!(this[V]&128))return this[V];return(255-this[V]+1)*-1},J.prototype.readInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V]|this[V+1]<<8;return O&32768?O|4294901760:O},J.prototype.readInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V+1]|this[V]<<8;return O&32768?O|4294901760:O},J.prototype.readInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]|this[V+1]<<8|this[V+2]<<16|this[V+3]<<24},J.prototype.readInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]<<24|this[V+1]<<16|this[V+2]<<8|this[V+3]},J.prototype.readFloatLE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!0,23,4)},J.prototype.readFloatBE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!1,23,4)},J.prototype.readDoubleLE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!0,52,8)},J.prototype.readDoubleBE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!1,52,8)};function y(k,V,X,O,_,l){if(!J.isBuffer(k))throw TypeError('"buffer" argument must be a Buffer instance');if(V>_||Vk.length)throw RangeError("Index out of range")}J.prototype.writeUintLE=J.prototype.writeUIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=1,Q0=0;this[X]=V&255;while(++Q0>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=O-1,Q0=1;this[X+d]=V&255;while(--d>=0&&(Q0*=256))this[X+d]=V/Q0&255;return X+O},J.prototype.writeUint8=J.prototype.writeUInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,255,0);return this[X]=V&255,X+1},J.prototype.writeUint16LE=J.prototype.writeUInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeUint16BE=J.prototype.writeUInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeUint32LE=J.prototype.writeUInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X+3]=V>>>24,this[X+2]=V>>>16,this[X+1]=V>>>8,this[X]=V&255,X+4},J.prototype.writeUint32BE=J.prototype.writeUInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4},J.prototype.writeIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=0,Q0=1,X0=0;this[X]=V&255;while(++d>0)-X0&255}return X+O},J.prototype.writeIntBE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=O-1,Q0=1,X0=0;this[X+d]=V&255;while(--d>=0&&(Q0*=256)){if(V<0&&X0===0&&this[X+d+1]!==0)X0=1;this[X+d]=(V/Q0>>0)-X0&255}return X+O},J.prototype.writeInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,127,-128);if(V<0)V=255+V+1;return this[X]=V&255,X+1},J.prototype.writeInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);return this[X]=V&255,this[X+1]=V>>>8,this[X+2]=V>>>16,this[X+3]=V>>>24,X+4},J.prototype.writeInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);if(V<0)V=4294967295+V+1;return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4};function n(k,V,X,O,_,l){if(X+O>k.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function o(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return G.write(k,V,X,O,23,4),X+4}J.prototype.writeFloatLE=function(V,X,O){return o(this,V,X,!0,O)},J.prototype.writeFloatBE=function(V,X,O){return o(this,V,X,!1,O)};function Y0(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return G.write(k,V,X,O,52,8),X+8}J.prototype.writeDoubleLE=function(V,X,O){return Y0(this,V,X,!0,O)},J.prototype.writeDoubleBE=function(V,X,O){return Y0(this,V,X,!1,O)},J.prototype.copy=function(V,X,O,_){if(!J.isBuffer(V))throw TypeError("argument should be a Buffer");if(!O)O=0;if(!_&&_!==0)_=this.length;if(X>=V.length)X=V.length;if(!X)X=0;if(_>0&&_=this.length)throw RangeError("Index out of range");if(_<0)throw RangeError("sourceEnd out of bounds");if(_>this.length)_=this.length;if(V.length-X<_-O)_=V.length-X+O;var l=_-O;if(this===V&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(X,O,_);else Uint8Array.prototype.set.call(V,this.subarray(O,_),X);return l},J.prototype.fill=function(V,X,O,_){if(typeof V==="string"){if(typeof X==="string")_=X,X=0,O=this.length;else if(typeof O==="string")_=O,O=this.length;if(_!==void 0&&typeof _!=="string")throw TypeError("encoding must be a string");if(typeof _==="string"&&!J.isEncoding(_))throw TypeError("Unknown encoding: "+_);if(V.length===1){var l=V.charCodeAt(0);if(_==="utf8"&&l<128||_==="latin1")V=l}}else if(typeof V==="number")V=V&255;else if(typeof V==="boolean")V=Number(V);if(X<0||this.length>>0,O=O===void 0?this.length:O>>>0,!V)V=0;var d;if(typeof V==="number")for(d=X;d55295&&X<57344){if(!_){if(X>56319){if((V-=3)>-1)l.push(239,191,189);continue}else if(d+1===O){if((V-=3)>-1)l.push(239,191,189);continue}_=X;continue}if(X<56320){if((V-=3)>-1)l.push(239,191,189);_=X;continue}X=(_-55296<<10|X-56320)+65536}else if(_){if((V-=3)>-1)l.push(239,191,189)}if(_=null,X<128){if((V-=1)<0)break;l.push(X)}else if(X<2048){if((V-=2)<0)break;l.push(X>>6|192,X&63|128)}else if(X<65536){if((V-=3)<0)break;l.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((V-=4)<0)break;l.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw Error("Invalid code point")}return l}function u(k){var V=[];for(var X=0;X>8,_=X%256,l.push(_),l.push(O)}return l}function Z0(k){return U.toByteArray(w(k))}function g(k,V,X,O){for(var _=0;_=V.length||_>=k.length)break;V[_+X]=k[_]}return _}function f(k,V){return k instanceof V||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===V.name}function R(k){return k!==k}var p=function(){var k="0123456789abcdef",V=Array(256);for(var X=0;X<16;++X){var O=X*16;for(var _=0;_<16;++_)V[O+_]=k[X]+k[_]}return V}()}),MB=R0((B,U)=>{U.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var Y={},Q=Symbol("test"),K=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var Z=42;Y[Q]=Z;for(var J in Y)return!1;if(typeof Object.keys==="function"&&Object.keys(Y).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(Y).length!==0)return!1;var q=Object.getOwnPropertySymbols(Y);if(q.length!==1||q[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(Y,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var W=Object.getOwnPropertyDescriptor(Y,Q);if(W.value!==Z||W.enumerable!==!0)return!1}return!0}}),b8=R0((B,U)=>{var G=MB();U.exports=function(){return G()&&!!Symbol.toStringTag}}),RB=R0((B,U)=>{U.exports=Object}),HU=R0((B,U)=>{U.exports=Error}),FU=R0((B,U)=>{U.exports=EvalError}),WU=R0((B,U)=>{U.exports=RangeError}),PU=R0((B,U)=>{U.exports=ReferenceError}),LB=R0((B,U)=>{U.exports=SyntaxError}),x1=R0((B,U)=>{U.exports=TypeError}),AU=R0((B,U)=>{U.exports=URIError}),jU=R0((B,U)=>{U.exports=Math.abs}),NU=R0((B,U)=>{U.exports=Math.floor}),zU=R0((B,U)=>{U.exports=Math.max}),wU=R0((B,U)=>{U.exports=Math.min}),EU=R0((B,U)=>{U.exports=Math.pow}),DU=R0((B,U)=>{U.exports=Math.round}),TU=R0((B,U)=>{U.exports=Number.isNaN||function(Y){return Y!==Y}}),CU=R0((B,U)=>{var G=TU();U.exports=function(Q){if(G(Q)||Q===0)return Q;return Q<0?-1:1}}),kU=R0((B,U)=>{U.exports=Object.getOwnPropertyDescriptor}),K1=R0((B,U)=>{var G=kU();if(G)try{G([],"length")}catch(Y){G=null}U.exports=G}),_1=R0((B,U)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(Y){G=!1}U.exports=G}),$U=R0((B,U)=>{var G=typeof Symbol<"u"&&Symbol,Y=MB();U.exports=function(){if(typeof G!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof G("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return Y()}}),IB=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),OB=R0((B,U)=>{U.exports=RB().getPrototypeOf||null}),SU=R0((B,U)=>{var G="Function.prototype.bind called on incompatible ",Y=Object.prototype.toString,Q=Math.max,K="[object Function]",Z=function(I,H){var T=[];for(var A=0;A{var G=SU();U.exports=Function.prototype.bind||G}),v8=R0((B,U)=>{U.exports=Function.prototype.call}),y8=R0((B,U)=>{U.exports=Function.prototype.apply}),bU=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),HB=R0((B,U)=>{var G=V1(),Y=y8(),Q=v8();U.exports=bU()||G.call(Q,Y)}),g8=R0((B,U)=>{var G=V1(),Y=x1(),Q=v8(),K=HB();U.exports=function(J){if(J.length<1||typeof J[0]!=="function")throw new Y("a function is required");return K(G,Q,J)}}),vU=R0((B,U)=>{var G=g8(),Y=K1(),Q;try{Q=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var K=!!Q&&Y&&Y(Object.prototype,"__proto__"),Z=Object,J=Z.getPrototypeOf;U.exports=K&&typeof K.get==="function"?G([K.get]):typeof J==="function"?function(W){return J(W==null?W:Z(W))}:!1}),FB=R0((B,U)=>{var G=IB(),Y=OB(),Q=vU();U.exports=G?function(Z){return G(Z)}:Y?function(Z){if(!Z||typeof Z!=="object"&&typeof Z!=="function")throw TypeError("getProto: not an object");return Y(Z)}:Q?function(Z){return Q(Z)}:null}),yU=R0((B,U)=>{var G=Function.prototype.call,Y=Object.prototype.hasOwnProperty;U.exports=V1().call(G,Y)}),WB=R0((B,U)=>{var G,Y=RB(),Q=HU(),K=FU(),Z=WU(),J=PU(),q=LB(),W=x1(),I=AU(),H=jU(),T=NU(),A=zU(),P=wU(),j=EU(),E=DU(),C=CU(),N=Function,v=function(h){try{return N('"use strict"; return ('+h+").constructor;")()}catch(Z0){}},S=K1(),F=_1(),M=function(){throw new W},$=S?function(){try{return arguments.callee,M}catch(h){try{return S(arguments,"callee").get}catch(Z0){return M}}}():M,x=$U()(),z=FB(),a=OB(),U0=IB(),b=y8(),c=v8(),D={},m=typeof Uint8Array>"u"||!z?G:z(Uint8Array),B0={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":x&&z?z([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":D,"%AsyncGenerator%":D,"%AsyncGeneratorFunction%":D,"%AsyncIteratorPrototype%":D,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q,"%eval%":eval,"%EvalError%":K,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":N,"%GeneratorFunction%":D,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":x&&z?z(z([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!x||!z?G:z(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Y,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Z,"%ReferenceError%":J,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!x||!z?G:z(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":x&&z?z(""[Symbol.iterator]()):G,"%Symbol%":x?Symbol:G,"%SyntaxError%":q,"%ThrowTypeError%":$,"%TypedArray%":m,"%TypeError%":W,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":I,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":c,"%Function.prototype.apply%":b,"%Object.defineProperty%":F,"%Object.getPrototypeOf%":a,"%Math.abs%":H,"%Math.floor%":T,"%Math.max%":A,"%Math.min%":P,"%Math.pow%":j,"%Math.round%":E,"%Math.sign%":C,"%Reflect.getPrototypeOf%":U0};if(z)try{null.error}catch(h){B0["%Error.prototype%"]=z(z(h))}var i=function h(Z0){var g;if(Z0==="%AsyncFunction%")g=v("async function () {}");else if(Z0==="%GeneratorFunction%")g=v("function* () {}");else if(Z0==="%AsyncGeneratorFunction%")g=v("async function* () {}");else if(Z0==="%AsyncGenerator%"){var f=h("%AsyncGeneratorFunction%");if(f)g=f.prototype}else if(Z0==="%AsyncIteratorPrototype%"){var R=h("%AsyncGenerator%");if(R&&z)g=z(R.prototype)}return B0[Z0]=g,g},V0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},s=V1(),G0=yU(),r=s.call(c,Array.prototype.concat),y=s.call(b,Array.prototype.splice),n=s.call(c,String.prototype.replace),o=s.call(c,String.prototype.slice),Y0=s.call(c,RegExp.prototype.exec),O0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,L=function(Z0){var g=o(Z0,0,1),f=o(Z0,-1);if(g==="%"&&f!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(f==="%"&&g!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var R=[];return n(Z0,O0,function(p,k,V,X){R[R.length]=V?n(X,w,"$1"):k||p}),R},u=function(Z0,g){var f=Z0,R;if(G0(V0,f))R=V0[f],f="%"+R[0]+"%";if(G0(B0,f)){var p=B0[f];if(p===D)p=i(f);if(typeof p>"u"&&!g)throw new W("intrinsic "+Z0+" exists, but is not available. Please file an issue!");return{alias:R,name:f,value:p}}throw new q("intrinsic "+Z0+" does not exist!")};U.exports=function(Z0,g){if(typeof Z0!=="string"||Z0.length===0)throw new W("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof g!=="boolean")throw new W('"allowMissing" argument must be a boolean');if(Y0(/^%?[^%]*%?$/,Z0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=L(Z0),R=f.length>0?f[0]:"",p=u("%"+R+"%",g),k=p.name,V=p.value,X=!1,O=p.alias;if(O)R=O[0],y(f,r([0,1],O));for(var _=1,l=!0;_=f.length){var K0=S(V,d);if(l=!!K0,l&&"get"in K0&&!("originalValue"in K0.get))V=K0.get;else V=V[d]}else l=G0(V,d),V=V[d];if(l&&!X)B0[k]=V}}return V}}),PB=R0((B,U)=>{var G=WB(),Y=g8(),Q=Y([G("%String.prototype.indexOf%")]);U.exports=function(Z,J){var q=G(Z,!!J);if(typeof q==="function"&&Q(Z,".prototype.")>-1)return Y([q]);return q}}),gU=R0((B,U)=>{var G=b8()(),Y=PB()("Object.prototype.toString"),Q=function(q){if(G&&q&&typeof q==="object"&&Symbol.toStringTag in q)return!1;return Y(q)==="[object Arguments]"},K=function(q){if(Q(q))return!0;return q!==null&&typeof q==="object"&&"length"in q&&typeof q.length==="number"&&q.length>=0&&Y(q)!=="[object Array]"&&"callee"in q&&Y(q.callee)==="[object Function]"},Z=function(){return Q(arguments)}();Q.isLegacyArguments=K,U.exports=Z?Q:K}),fU=R0((B,U)=>{var G=Object.prototype.toString,Y=Function.prototype.toString,Q=/^\s*(?:function)?\*/,K=b8()(),Z=Object.getPrototypeOf,J=function(){if(!K)return!1;try{return Function("return function*() {}")()}catch(W){}},q;U.exports=function(I){if(typeof I!=="function")return!1;if(Q.test(Y.call(I)))return!0;if(!K)return G.call(I)==="[object GeneratorFunction]";if(!Z)return!1;if(typeof q>"u"){var H=J();q=H?Z(H):!1}return Z(I)===q}}),xU=R0((B,U)=>{var G=Function.prototype.toString,Y=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,Q,K;if(typeof Y==="function"&&typeof Object.defineProperty==="function")try{Q=Object.defineProperty({},"length",{get:function(){throw K}}),K={},Y(function(){throw 42},null,Q)}catch(S){if(S!==K)Y=null}else Y=null;var Z=/^\s*class\b/,J=function(F){try{var M=G.call(F);return Z.test(M)}catch($){return!1}},q=function(F){try{if(J(F))return!1;return G.call(F),!0}catch(M){return!1}},W=Object.prototype.toString,I="[object Object]",H="[object Function]",T="[object GeneratorFunction]",A="[object HTMLAllCollection]",P="[object HTML document.all class]",j="[object HTMLCollection]",E=typeof Symbol==="function"&&!!Symbol.toStringTag,C=!(0 in[,]),N=function(){return!1};if(typeof document==="object"){var v=document.all;if(W.call(v)===W.call(document.all))N=function(F){if((C||!F)&&(typeof F>"u"||typeof F==="object"))try{var M=W.call(F);return(M===A||M===P||M===j||M===I)&&F("")==null}catch($){}return!1}}U.exports=Y?function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;try{Y(F,null,Q)}catch(M){if(M!==K)return!1}return!J(F)&&q(F)}:function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;if(E)return q(F);if(J(F))return!1;var M=W.call(F);if(M!==H&&M!==T&&!/^\[object HTML/.test(M))return!1;return q(F)}}),_U=R0((B,U)=>{var G=xU(),Y=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,K=function(I,H,T){for(var A=0,P=I.length;A=3)A=T;if(q(I))K(I,H,A);else if(typeof I==="string")Z(I,H,A);else J(I,H,A)}}),hU=R0((B,U)=>{U.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),uU=R0((B,U)=>{d2();var G=hU(),Y=typeof globalThis>"u"?v0:globalThis;U.exports=function(){var K=[];for(var Z=0;Z{var G=_1(),Y=LB(),Q=x1(),K=K1();U.exports=function(J,q,W){if(!J||typeof J!=="object"&&typeof J!=="function")throw new Q("`obj` must be an object or a function`");if(typeof q!=="string"&&typeof q!=="symbol")throw new Q("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new Q("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new Q("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new Q("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new Q("`loose`, if provided, must be a boolean");var I=arguments.length>3?arguments[3]:null,H=arguments.length>4?arguments[4]:null,T=arguments.length>5?arguments[5]:null,A=arguments.length>6?arguments[6]:!1,P=!!K&&K(J,q);if(G)G(J,q,{configurable:T===null&&P?P.configurable:!T,enumerable:I===null&&P?P.enumerable:!I,value:W,writable:H===null&&P?P.writable:!H});else if(A||!I&&!H&&!T)J[q]=W;else throw new Y("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),cU=R0((B,U)=>{var G=_1(),Y=function(){return!!G};Y.hasArrayLengthDefineBug=function(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(K){return!0}},U.exports=Y}),mU=R0((B,U)=>{var G=WB(),Y=dU(),Q=cU()(),K=K1(),Z=x1(),J=G("%Math.floor%");U.exports=function(W,I){if(typeof W!=="function")throw new Z("`fn` is not a function");if(typeof I!=="number"||I<0||I>4294967295||J(I)!==I)throw new Z("`length` must be a positive 32-bit integer");var H=arguments.length>2&&!!arguments[2],T=!0,A=!0;if("length"in W&&K){var P=K(W,"length");if(P&&!P.configurable)T=!1;if(P&&!P.writable)A=!1}if(T||A||!H)if(Q)Y(W,"length",I,!0,!0);else Y(W,"length",I);return W}}),lU=R0((B,U)=>{var G=V1(),Y=y8(),Q=HB();U.exports=function(){return Q(G,Y,arguments)}}),aU=R0((B,U)=>{var G=mU(),Y=_1(),Q=g8(),K=lU();if(U.exports=function(J){var q=Q(arguments),W=J.length-(arguments.length-1);return G(q,1+(W>0?W:0),!0)},Y)Y(U.exports,"apply",{value:K});else U.exports.apply=K}),AB=R0((B,U)=>{d2();var G=_U(),Y=uU(),Q=aU(),K=PB(),Z=K1(),J=FB(),q=K("Object.prototype.toString"),W=b8()(),I=typeof globalThis>"u"?v0:globalThis,H=Y(),T=K("String.prototype.slice"),A=K("Array.prototype.indexOf",!0)||function(N,v){for(var S=0;S-1)return v;if(v!=="Object")return!1;return E(N)}if(!Z)return null;return j(N)}}),pU=R0((B,U)=>{var G=AB();U.exports=function(Q){return!!G(Q)}}),rU=R0((B)=>{var U=gU(),G=fU(),Y=AB(),Q=pU();function K(O){return O.call.bind(O)}var Z=typeof BigInt<"u",J=typeof Symbol<"u",q=K(Object.prototype.toString),W=K(Number.prototype.valueOf),I=K(String.prototype.valueOf),H=K(Boolean.prototype.valueOf);if(Z)var T=K(BigInt.prototype.valueOf);if(J)var A=K(Symbol.prototype.valueOf);function P(O,_){if(typeof O!=="object")return!1;try{return _(O),!0}catch(l){return!1}}B.isArgumentsObject=U,B.isGeneratorFunction=G,B.isTypedArray=Q;function j(O){return typeof Promise<"u"&&O instanceof Promise||O!==null&&typeof O==="object"&&typeof O.then==="function"&&typeof O.catch==="function"}B.isPromise=j;function E(O){if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)return ArrayBuffer.isView(O);return Q(O)||n(O)}B.isArrayBufferView=E;function C(O){return Y(O)==="Uint8Array"}B.isUint8Array=C;function N(O){return Y(O)==="Uint8ClampedArray"}B.isUint8ClampedArray=N;function v(O){return Y(O)==="Uint16Array"}B.isUint16Array=v;function S(O){return Y(O)==="Uint32Array"}B.isUint32Array=S;function F(O){return Y(O)==="Int8Array"}B.isInt8Array=F;function M(O){return Y(O)==="Int16Array"}B.isInt16Array=M;function $(O){return Y(O)==="Int32Array"}B.isInt32Array=$;function x(O){return Y(O)==="Float32Array"}B.isFloat32Array=x;function z(O){return Y(O)==="Float64Array"}B.isFloat64Array=z;function a(O){return Y(O)==="BigInt64Array"}B.isBigInt64Array=a;function U0(O){return Y(O)==="BigUint64Array"}B.isBigUint64Array=U0;function b(O){return q(O)==="[object Map]"}b.working=typeof Map<"u"&&b(new Map);function c(O){if(typeof Map>"u")return!1;return b.working?b(O):O instanceof Map}B.isMap=c;function D(O){return q(O)==="[object Set]"}D.working=typeof Set<"u"&&D(new Set);function m(O){if(typeof Set>"u")return!1;return D.working?D(O):O instanceof Set}B.isSet=m;function B0(O){return q(O)==="[object WeakMap]"}B0.working=typeof WeakMap<"u"&&B0(new WeakMap);function i(O){if(typeof WeakMap>"u")return!1;return B0.working?B0(O):O instanceof WeakMap}B.isWeakMap=i;function V0(O){return q(O)==="[object WeakSet]"}V0.working=typeof WeakSet<"u"&&V0(new WeakSet);function s(O){return V0(O)}B.isWeakSet=s;function G0(O){return q(O)==="[object ArrayBuffer]"}G0.working=typeof ArrayBuffer<"u"&&G0(new ArrayBuffer);function r(O){if(typeof ArrayBuffer>"u")return!1;return G0.working?G0(O):O instanceof ArrayBuffer}B.isArrayBuffer=r;function y(O){return q(O)==="[object DataView]"}y.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&y(new DataView(new ArrayBuffer(1),0,1));function n(O){if(typeof DataView>"u")return!1;return y.working?y(O):O instanceof DataView}B.isDataView=n;var o=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Y0(O){return q(O)==="[object SharedArrayBuffer]"}function O0(O){if(typeof o>"u")return!1;if(typeof Y0.working>"u")Y0.working=Y0(new o);return Y0.working?Y0(O):O instanceof o}B.isSharedArrayBuffer=O0;function w(O){return q(O)==="[object AsyncFunction]"}B.isAsyncFunction=w;function L(O){return q(O)==="[object Map Iterator]"}B.isMapIterator=L;function u(O){return q(O)==="[object Set Iterator]"}B.isSetIterator=u;function h(O){return q(O)==="[object Generator]"}B.isGeneratorObject=h;function Z0(O){return q(O)==="[object WebAssembly.Module]"}B.isWebAssemblyCompiledModule=Z0;function g(O){return P(O,W)}B.isNumberObject=g;function f(O){return P(O,I)}B.isStringObject=f;function R(O){return P(O,H)}B.isBooleanObject=R;function p(O){return Z&&P(O,T)}B.isBigIntObject=p;function k(O){return J&&P(O,A)}B.isSymbolObject=k;function V(O){return g(O)||f(O)||R(O)||p(O)||k(O)}B.isBoxedPrimitive=V;function X(O){return typeof Uint8Array<"u"&&(r(O)||O0(O))}B.isAnyArrayBuffer=X,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(O){Object.defineProperty(B,O,{enumerable:!1,value:function(){throw Error(O+" is not supported in userland")}})})}),iU=R0((B,U)=>{U.exports=function(Y){return Y&&typeof Y==="object"&&typeof Y.copy==="function"&&typeof Y.fill==="function"&&typeof Y.readUInt8==="function"}}),jB=R0((B)=>{P2();var U=Object.getOwnPropertyDescriptors||function(n){var o=Object.keys(n),Y0={};for(var O0=0;O0=O0)return u;switch(u){case"%s":return String(Y0[o++]);case"%d":return Number(Y0[o++]);case"%j":try{return JSON.stringify(Y0[o++])}catch(h){return"[Circular]"}default:return u}});for(var L=Y0[o];o"u")return function(){return B.deprecate(y,n).apply(this,arguments)};var o=!1;function Y0(){if(!o){if(P0.throwDeprecation)throw Error(n);else if(P0.traceDeprecation)console.trace(n);else console.error(n);o=!0}return y.apply(this,arguments)}return Y0};var Y={},Q=/^$/;if(P0.env.NODE_DEBUG){var K=P0.env.NODE_DEBUG;K=K.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Q=new RegExp("^"+K+"$","i")}B.debuglog=function(y){if(y=y.toUpperCase(),!Y[y])if(Q.test(y)){var n=P0.pid;Y[y]=function(){var o=B.format.apply(B,arguments);console.error("%s %d: %s",y,n,o)}}else Y[y]=function(){};return Y[y]};function Z(y,n){var o={seen:[],stylize:q};if(arguments.length>=3)o.depth=arguments[2];if(arguments.length>=4)o.colors=arguments[3];if(C(n))o.showHidden=n;else if(n)B._extend(o,n);if($(o.showHidden))o.showHidden=!1;if($(o.depth))o.depth=2;if($(o.colors))o.colors=!1;if($(o.customInspect))o.customInspect=!0;if(o.colors)o.stylize=J;return I(o,y,o.depth)}B.inspect=Z,Z.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Z.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function J(y,n){var o=Z.styles[n];if(o)return"\x1B["+Z.colors[o][0]+"m"+y+"\x1B["+Z.colors[o][1]+"m";else return y}function q(y,n){return y}function W(y){var n={};return y.forEach(function(o,Y0){n[o]=!0}),n}function I(y,n,o){if(y.customInspect&&n&&b(n.inspect)&&n.inspect!==B.inspect&&!(n.constructor&&n.constructor.prototype===n)){var Y0=n.inspect(o,y);if(!F(Y0))Y0=I(y,Y0,o);return Y0}var O0=H(y,n);if(O0)return O0;var w=Object.keys(n),L=W(w);if(y.showHidden)w=Object.getOwnPropertyNames(n);if(U0(n)&&(w.indexOf("message")>=0||w.indexOf("description")>=0))return T(n);if(w.length===0){if(b(n)){var u=n.name?": "+n.name:"";return y.stylize("[Function"+u+"]","special")}if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");if(a(n))return y.stylize(Date.prototype.toString.call(n),"date");if(U0(n))return T(n)}var h="",Z0=!1,g=["{","}"];if(E(n))Z0=!0,g=["[","]"];if(b(n))h=" [Function"+(n.name?": "+n.name:"")+"]";if(x(n))h=" "+RegExp.prototype.toString.call(n);if(a(n))h=" "+Date.prototype.toUTCString.call(n);if(U0(n))h=" "+T(n);if(w.length===0&&(!Z0||n.length==0))return g[0]+h+g[1];if(o<0)if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");else return y.stylize("[Object]","special");y.seen.push(n);var f;if(Z0)f=A(y,n,o,L,w);else f=w.map(function(R){return P(y,n,o,L,R,Z0)});return y.seen.pop(),j(f,h,g)}function H(y,n){if($(n))return y.stylize("undefined","undefined");if(F(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return y.stylize(o,"string")}if(S(n))return y.stylize(""+n,"number");if(C(n))return y.stylize(""+n,"boolean");if(N(n))return y.stylize("null","null")}function T(y){return"["+Error.prototype.toString.call(y)+"]"}function A(y,n,o,Y0,O0){var w=[];for(var L=0,u=n.length;L-1)if(w)u=u.split(` +*/var f1=R0((B)=>{var U=IU(),G=OU(),Y=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=J,B.SlowBuffer=N,B.INSPECT_MAX_BYTES=50;var Q=2147483647;if(B.kMaxLength=Q,J.TYPED_ARRAY_SUPPORT=K(),!J.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error==="function")console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function K(){try{var k=new Uint8Array(1),V={foo:function(){return 42}};return Object.setPrototypeOf(V,Uint8Array.prototype),Object.setPrototypeOf(k,V),k.foo()===42}catch(X){return!1}}Object.defineProperty(J.prototype,"parent",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.buffer}}),Object.defineProperty(J.prototype,"offset",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.byteOffset}});function Z(k){if(k>Q)throw RangeError('The value "'+k+'" is invalid for option "size"');var V=new Uint8Array(k);return Object.setPrototypeOf(V,J.prototype),V}function J(k,V,X){if(typeof k==="number"){if(typeof V==="string")throw TypeError('The "string" argument must be of type string. Received type number');return H(k)}return q(k,V,X)}J.poolSize=8192;function q(k,V,X){if(typeof k==="string")return T(k,V);if(ArrayBuffer.isView(k))return P(k);if(k==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(f(k,ArrayBuffer)||k&&f(k.buffer,ArrayBuffer))return j(k,V,X);if(typeof SharedArrayBuffer<"u"&&(f(k,SharedArrayBuffer)||k&&f(k.buffer,SharedArrayBuffer)))return j(k,V,X);if(typeof k==="number")throw TypeError('The "value" argument must not be of type number. Received type number');var O=k.valueOf&&k.valueOf();if(O!=null&&O!==k)return J.from(O,V,X);var _=E(k);if(_)return _;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]==="function")return J.from(k[Symbol.toPrimitive]("string"),V,X);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}J.from=function(k,V,X){return q(k,V,X)},Object.setPrototypeOf(J.prototype,Uint8Array.prototype),Object.setPrototypeOf(J,Uint8Array);function W(k){if(typeof k!=="number")throw TypeError('"size" argument must be of type number');else if(k<0)throw RangeError('The value "'+k+'" is invalid for option "size"')}function I(k,V,X){if(W(k),k<=0)return Z(k);if(V!==void 0)return typeof X==="string"?Z(k).fill(V,X):Z(k).fill(V);return Z(k)}J.alloc=function(k,V,X){return I(k,V,X)};function H(k){return W(k),Z(k<0?0:C(k)|0)}J.allocUnsafe=function(k){return H(k)},J.allocUnsafeSlow=function(k){return H(k)};function T(k,V){if(typeof V!=="string"||V==="")V="utf8";if(!J.isEncoding(V))throw TypeError("Unknown encoding: "+V);var X=v(k,V)|0,O=Z(X),_=O.write(k,V);if(_!==X)O=O.slice(0,_);return O}function A(k){var V=k.length<0?0:C(k.length)|0,X=Z(V);for(var O=0;O=Q)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return k|0}function N(k){if(+k!=k)k=0;return J.alloc(+k)}J.isBuffer=function(V){return V!=null&&V._isBuffer===!0&&V!==J.prototype},J.compare=function(V,X){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(f(X,Uint8Array))X=J.from(X,X.offset,X.byteLength);if(!J.isBuffer(V)||!J.isBuffer(X))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(V===X)return 0;var O=V.length,_=X.length;for(var l=0,d=Math.min(O,_);l_.length)J.from(d).copy(_,l);else Uint8Array.prototype.set.call(_,d,l);else if(!J.isBuffer(d))throw TypeError('"list" argument must be an Array of Buffers');else d.copy(_,l);l+=d.length}return _};function v(k,V){if(J.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||f(k,ArrayBuffer))return k.byteLength;if(typeof k!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);var X=k.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&X===0)return 0;var _=!1;for(;;)switch(V){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return L(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return Z0(k).length;default:if(_)return O?-1:L(k).length;V=(""+V).toLowerCase(),_=!0}}J.byteLength=v;function S(k,V,X){var O=!1;if(V===void 0||V<0)V=0;if(V>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,V>>>=0,X<=V)return"";if(!k)k="utf8";while(!0)switch(k){case"hex":return s(this,V,X);case"utf8":case"utf-8":return D(this,V,X);case"ascii":return i(this,V,X);case"latin1":case"binary":return V0(this,V,X);case"base64":return c(this,V,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G0(this,V,X);default:if(O)throw TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),O=!0}}J.prototype._isBuffer=!0;function F(k,V,X){var O=k[V];k[V]=k[X],k[X]=O}if(J.prototype.swap16=function(){var V=this.length;if(V%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var X=0;XX)V+=" ... ";return""},Y)J.prototype[Y]=J.prototype.inspect;J.prototype.compare=function(V,X,O,_,l){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(!J.isBuffer(V))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof V);if(X===void 0)X=0;if(O===void 0)O=V?V.length:0;if(_===void 0)_=0;if(l===void 0)l=this.length;if(X<0||O>V.length||_<0||l>this.length)throw RangeError("out of range index");if(_>=l&&X>=O)return 0;if(_>=l)return-1;if(X>=O)return 1;if(X>>>=0,O>>>=0,_>>>=0,l>>>=0,this===V)return 0;var d=l-_,Q0=O-X,X0=Math.min(d,Q0),K0=this.slice(_,l),I0=V.slice(X,O);for(var F0=0;F02147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,R(X))X=_?0:k.length-1;if(X<0)X=k.length+X;if(X>=k.length)if(_)return-1;else X=k.length-1;else if(X<0)if(_)X=0;else return-1;if(typeof V==="string")V=J.from(V,O);if(J.isBuffer(V)){if(V.length===0)return-1;return $(k,V,X,O,_)}else if(typeof V==="number"){if(V=V&255,typeof Uint8Array.prototype.indexOf==="function")if(_)return Uint8Array.prototype.indexOf.call(k,V,X);else return Uint8Array.prototype.lastIndexOf.call(k,V,X);return $(k,[V],X,O,_)}throw TypeError("val must be string, number or Buffer")}function $(k,V,X,O,_){var l=1,d=k.length,Q0=V.length;if(O!==void 0){if(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le"){if(k.length<2||V.length<2)return-1;l=2,d/=2,Q0/=2,X/=2}}function X0(k0,L2){if(l===1)return k0[L2];else return k0.readUInt16BE(L2*l)}var K0;if(_){var I0=-1;for(K0=X;K0d)X=d-Q0;for(K0=X;K0>=0;K0--){var F0=!0;for(var W0=0;W0_)O=_;var l=V.length;if(O>l/2)O=l/2;for(var d=0;d>>0,isFinite(O)){if(O=O>>>0,_===void 0)_="utf8"}else _=O,O=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-X;if(O===void 0||O>l)O=l;if(V.length>0&&(O<0||X<0)||X>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!_)_="utf8";var d=!1;for(;;)switch(_){case"hex":return x(this,V,X,O);case"utf8":case"utf-8":return w(this,V,X,O);case"ascii":case"latin1":case"binary":return a(this,V,X,O);case"base64":return U0(this,V,X,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,V,X,O);default:if(d)throw TypeError("Unknown encoding: "+_);_=(""+_).toLowerCase(),d=!0}},J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c(k,V,X){if(V===0&&X===k.length)return U.fromByteArray(k);else return U.fromByteArray(k.slice(V,X))}function D(k,V,X){X=Math.min(k.length,X);var O=[],_=V;while(_239?4:l>223?3:l>191?2:1;if(_+Q0<=X){var X0,K0,I0,F0;switch(Q0){case 1:if(l<128)d=l;break;case 2:if(X0=k[_+1],(X0&192)===128){if(F0=(l&31)<<6|X0&63,F0>127)d=F0}break;case 3:if(X0=k[_+1],K0=k[_+2],(X0&192)===128&&(K0&192)===128){if(F0=(l&15)<<12|(X0&63)<<6|K0&63,F0>2047&&(F0<55296||F0>57343))d=F0}break;case 4:if(X0=k[_+1],K0=k[_+2],I0=k[_+3],(X0&192)===128&&(K0&192)===128&&(I0&192)===128){if(F0=(l&15)<<18|(X0&63)<<12|(K0&63)<<6|I0&63,F0>65535&&F0<1114112)d=F0}}}if(d===null)d=65533,Q0=1;else if(d>65535)d-=65536,O.push(d>>>10&1023|55296),d=56320|d&1023;O.push(d),_+=Q0}return B0(O)}var m=4096;function B0(k){var V=k.length;if(V<=m)return String.fromCharCode.apply(String,k);var X="",O=0;while(OO)X=O;var _="";for(var l=V;lO)V=O;if(X<0){if(X+=O,X<0)X=0}else if(X>O)X=O;if(XX)throw RangeError("Trying to access beyond buffer length")}J.prototype.readUintLE=J.prototype.readUIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V+--X],l=1;while(X>0&&(l*=256))_+=this[V+--X]*l;return _},J.prototype.readUint8=J.prototype.readUInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);return this[V]},J.prototype.readUint16LE=J.prototype.readUInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]|this[V+1]<<8},J.prototype.readUint16BE=J.prototype.readUInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]<<8|this[V+1]},J.prototype.readUint32LE=J.prototype.readUInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return(this[V]|this[V+1]<<8|this[V+2]<<16)+this[V+3]*16777216},J.prototype.readUint32BE=J.prototype.readUInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]*16777216+(this[V+1]<<16|this[V+2]<<8|this[V+3])},J.prototype.readIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d=l)_-=Math.pow(2,8*X);return _},J.prototype.readIntBE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=X,l=1,d=this[V+--_];while(_>0&&(l*=256))d+=this[V+--_]*l;if(l*=128,d>=l)d-=Math.pow(2,8*X);return d},J.prototype.readInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);if(!(this[V]&128))return this[V];return(255-this[V]+1)*-1},J.prototype.readInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V]|this[V+1]<<8;return O&32768?O|4294901760:O},J.prototype.readInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V+1]|this[V]<<8;return O&32768?O|4294901760:O},J.prototype.readInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]|this[V+1]<<8|this[V+2]<<16|this[V+3]<<24},J.prototype.readInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]<<24|this[V+1]<<16|this[V+2]<<8|this[V+3]},J.prototype.readFloatLE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!0,23,4)},J.prototype.readFloatBE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!1,23,4)},J.prototype.readDoubleLE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!0,52,8)},J.prototype.readDoubleBE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!1,52,8)};function y(k,V,X,O,_,l){if(!J.isBuffer(k))throw TypeError('"buffer" argument must be a Buffer instance');if(V>_||Vk.length)throw RangeError("Index out of range")}J.prototype.writeUintLE=J.prototype.writeUIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=1,Q0=0;this[X]=V&255;while(++Q0>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=O-1,Q0=1;this[X+d]=V&255;while(--d>=0&&(Q0*=256))this[X+d]=V/Q0&255;return X+O},J.prototype.writeUint8=J.prototype.writeUInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,255,0);return this[X]=V&255,X+1},J.prototype.writeUint16LE=J.prototype.writeUInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeUint16BE=J.prototype.writeUInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeUint32LE=J.prototype.writeUInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X+3]=V>>>24,this[X+2]=V>>>16,this[X+1]=V>>>8,this[X]=V&255,X+4},J.prototype.writeUint32BE=J.prototype.writeUInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4},J.prototype.writeIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=0,Q0=1,X0=0;this[X]=V&255;while(++d>0)-X0&255}return X+O},J.prototype.writeIntBE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=O-1,Q0=1,X0=0;this[X+d]=V&255;while(--d>=0&&(Q0*=256)){if(V<0&&X0===0&&this[X+d+1]!==0)X0=1;this[X+d]=(V/Q0>>0)-X0&255}return X+O},J.prototype.writeInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,127,-128);if(V<0)V=255+V+1;return this[X]=V&255,X+1},J.prototype.writeInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);return this[X]=V&255,this[X+1]=V>>>8,this[X+2]=V>>>16,this[X+3]=V>>>24,X+4},J.prototype.writeInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);if(V<0)V=4294967295+V+1;return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4};function n(k,V,X,O,_,l){if(X+O>k.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function o(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return G.write(k,V,X,O,23,4),X+4}J.prototype.writeFloatLE=function(V,X,O){return o(this,V,X,!0,O)},J.prototype.writeFloatBE=function(V,X,O){return o(this,V,X,!1,O)};function Y0(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return G.write(k,V,X,O,52,8),X+8}J.prototype.writeDoubleLE=function(V,X,O){return Y0(this,V,X,!0,O)},J.prototype.writeDoubleBE=function(V,X,O){return Y0(this,V,X,!1,O)},J.prototype.copy=function(V,X,O,_){if(!J.isBuffer(V))throw TypeError("argument should be a Buffer");if(!O)O=0;if(!_&&_!==0)_=this.length;if(X>=V.length)X=V.length;if(!X)X=0;if(_>0&&_=this.length)throw RangeError("Index out of range");if(_<0)throw RangeError("sourceEnd out of bounds");if(_>this.length)_=this.length;if(V.length-X<_-O)_=V.length-X+O;var l=_-O;if(this===V&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(X,O,_);else Uint8Array.prototype.set.call(V,this.subarray(O,_),X);return l},J.prototype.fill=function(V,X,O,_){if(typeof V==="string"){if(typeof X==="string")_=X,X=0,O=this.length;else if(typeof O==="string")_=O,O=this.length;if(_!==void 0&&typeof _!=="string")throw TypeError("encoding must be a string");if(typeof _==="string"&&!J.isEncoding(_))throw TypeError("Unknown encoding: "+_);if(V.length===1){var l=V.charCodeAt(0);if(_==="utf8"&&l<128||_==="latin1")V=l}}else if(typeof V==="number")V=V&255;else if(typeof V==="boolean")V=Number(V);if(X<0||this.length>>0,O=O===void 0?this.length:O>>>0,!V)V=0;var d;if(typeof V==="number")for(d=X;d55295&&X<57344){if(!_){if(X>56319){if((V-=3)>-1)l.push(239,191,189);continue}else if(d+1===O){if((V-=3)>-1)l.push(239,191,189);continue}_=X;continue}if(X<56320){if((V-=3)>-1)l.push(239,191,189);_=X;continue}X=(_-55296<<10|X-56320)+65536}else if(_){if((V-=3)>-1)l.push(239,191,189)}if(_=null,X<128){if((V-=1)<0)break;l.push(X)}else if(X<2048){if((V-=2)<0)break;l.push(X>>6|192,X&63|128)}else if(X<65536){if((V-=3)<0)break;l.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((V-=4)<0)break;l.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw Error("Invalid code point")}return l}function u(k){var V=[];for(var X=0;X>8,_=X%256,l.push(_),l.push(O)}return l}function Z0(k){return U.toByteArray(z(k))}function g(k,V,X,O){for(var _=0;_=V.length||_>=k.length)break;V[_+X]=k[_]}return _}function f(k,V){return k instanceof V||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===V.name}function R(k){return k!==k}var p=function(){var k="0123456789abcdef",V=Array(256);for(var X=0;X<16;++X){var O=X*16;for(var _=0;_<16;++_)V[O+_]=k[X]+k[_]}return V}()}),MB=R0((B,U)=>{U.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var Y={},Q=Symbol("test"),K=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var Z=42;Y[Q]=Z;for(var J in Y)return!1;if(typeof Object.keys==="function"&&Object.keys(Y).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(Y).length!==0)return!1;var q=Object.getOwnPropertySymbols(Y);if(q.length!==1||q[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(Y,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var W=Object.getOwnPropertyDescriptor(Y,Q);if(W.value!==Z||W.enumerable!==!0)return!1}return!0}}),b8=R0((B,U)=>{var G=MB();U.exports=function(){return G()&&!!Symbol.toStringTag}}),RB=R0((B,U)=>{U.exports=Object}),HU=R0((B,U)=>{U.exports=Error}),FU=R0((B,U)=>{U.exports=EvalError}),WU=R0((B,U)=>{U.exports=RangeError}),PU=R0((B,U)=>{U.exports=ReferenceError}),LB=R0((B,U)=>{U.exports=SyntaxError}),x1=R0((B,U)=>{U.exports=TypeError}),AU=R0((B,U)=>{U.exports=URIError}),jU=R0((B,U)=>{U.exports=Math.abs}),NU=R0((B,U)=>{U.exports=Math.floor}),wU=R0((B,U)=>{U.exports=Math.max}),zU=R0((B,U)=>{U.exports=Math.min}),EU=R0((B,U)=>{U.exports=Math.pow}),DU=R0((B,U)=>{U.exports=Math.round}),TU=R0((B,U)=>{U.exports=Number.isNaN||function(Y){return Y!==Y}}),CU=R0((B,U)=>{var G=TU();U.exports=function(Q){if(G(Q)||Q===0)return Q;return Q<0?-1:1}}),kU=R0((B,U)=>{U.exports=Object.getOwnPropertyDescriptor}),K1=R0((B,U)=>{var G=kU();if(G)try{G([],"length")}catch(Y){G=null}U.exports=G}),_1=R0((B,U)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(Y){G=!1}U.exports=G}),$U=R0((B,U)=>{var G=typeof Symbol<"u"&&Symbol,Y=MB();U.exports=function(){if(typeof G!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof G("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return Y()}}),IB=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),OB=R0((B,U)=>{U.exports=RB().getPrototypeOf||null}),SU=R0((B,U)=>{var G="Function.prototype.bind called on incompatible ",Y=Object.prototype.toString,Q=Math.max,K="[object Function]",Z=function(I,H){var T=[];for(var A=0;A{var G=SU();U.exports=Function.prototype.bind||G}),v8=R0((B,U)=>{U.exports=Function.prototype.call}),y8=R0((B,U)=>{U.exports=Function.prototype.apply}),bU=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),HB=R0((B,U)=>{var G=V1(),Y=y8(),Q=v8();U.exports=bU()||G.call(Q,Y)}),g8=R0((B,U)=>{var G=V1(),Y=x1(),Q=v8(),K=HB();U.exports=function(J){if(J.length<1||typeof J[0]!=="function")throw new Y("a function is required");return K(G,Q,J)}}),vU=R0((B,U)=>{var G=g8(),Y=K1(),Q;try{Q=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var K=!!Q&&Y&&Y(Object.prototype,"__proto__"),Z=Object,J=Z.getPrototypeOf;U.exports=K&&typeof K.get==="function"?G([K.get]):typeof J==="function"?function(W){return J(W==null?W:Z(W))}:!1}),FB=R0((B,U)=>{var G=IB(),Y=OB(),Q=vU();U.exports=G?function(Z){return G(Z)}:Y?function(Z){if(!Z||typeof Z!=="object"&&typeof Z!=="function")throw TypeError("getProto: not an object");return Y(Z)}:Q?function(Z){return Q(Z)}:null}),yU=R0((B,U)=>{var G=Function.prototype.call,Y=Object.prototype.hasOwnProperty;U.exports=V1().call(G,Y)}),WB=R0((B,U)=>{var G,Y=RB(),Q=HU(),K=FU(),Z=WU(),J=PU(),q=LB(),W=x1(),I=AU(),H=jU(),T=NU(),A=wU(),P=zU(),j=EU(),E=DU(),C=CU(),N=Function,v=function(h){try{return N('"use strict"; return ('+h+").constructor;")()}catch(Z0){}},S=K1(),F=_1(),M=function(){throw new W},$=S?function(){try{return arguments.callee,M}catch(h){try{return S(arguments,"callee").get}catch(Z0){return M}}}():M,x=$U()(),w=FB(),a=OB(),U0=IB(),b=y8(),c=v8(),D={},m=typeof Uint8Array>"u"||!w?G:w(Uint8Array),B0={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":x&&w?w([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":D,"%AsyncGenerator%":D,"%AsyncGeneratorFunction%":D,"%AsyncIteratorPrototype%":D,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q,"%eval%":eval,"%EvalError%":K,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":N,"%GeneratorFunction%":D,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":x&&w?w(w([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!x||!w?G:w(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Y,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Z,"%ReferenceError%":J,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!x||!w?G:w(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":x&&w?w(""[Symbol.iterator]()):G,"%Symbol%":x?Symbol:G,"%SyntaxError%":q,"%ThrowTypeError%":$,"%TypedArray%":m,"%TypeError%":W,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":I,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":c,"%Function.prototype.apply%":b,"%Object.defineProperty%":F,"%Object.getPrototypeOf%":a,"%Math.abs%":H,"%Math.floor%":T,"%Math.max%":A,"%Math.min%":P,"%Math.pow%":j,"%Math.round%":E,"%Math.sign%":C,"%Reflect.getPrototypeOf%":U0};if(w)try{null.error}catch(h){B0["%Error.prototype%"]=w(w(h))}var i=function h(Z0){var g;if(Z0==="%AsyncFunction%")g=v("async function () {}");else if(Z0==="%GeneratorFunction%")g=v("function* () {}");else if(Z0==="%AsyncGeneratorFunction%")g=v("async function* () {}");else if(Z0==="%AsyncGenerator%"){var f=h("%AsyncGeneratorFunction%");if(f)g=f.prototype}else if(Z0==="%AsyncIteratorPrototype%"){var R=h("%AsyncGenerator%");if(R&&w)g=w(R.prototype)}return B0[Z0]=g,g},V0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},s=V1(),G0=yU(),r=s.call(c,Array.prototype.concat),y=s.call(b,Array.prototype.splice),n=s.call(c,String.prototype.replace),o=s.call(c,String.prototype.slice),Y0=s.call(c,RegExp.prototype.exec),O0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,z=/\\(\\)?/g,L=function(Z0){var g=o(Z0,0,1),f=o(Z0,-1);if(g==="%"&&f!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(f==="%"&&g!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var R=[];return n(Z0,O0,function(p,k,V,X){R[R.length]=V?n(X,z,"$1"):k||p}),R},u=function(Z0,g){var f=Z0,R;if(G0(V0,f))R=V0[f],f="%"+R[0]+"%";if(G0(B0,f)){var p=B0[f];if(p===D)p=i(f);if(typeof p>"u"&&!g)throw new W("intrinsic "+Z0+" exists, but is not available. Please file an issue!");return{alias:R,name:f,value:p}}throw new q("intrinsic "+Z0+" does not exist!")};U.exports=function(Z0,g){if(typeof Z0!=="string"||Z0.length===0)throw new W("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof g!=="boolean")throw new W('"allowMissing" argument must be a boolean');if(Y0(/^%?[^%]*%?$/,Z0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=L(Z0),R=f.length>0?f[0]:"",p=u("%"+R+"%",g),k=p.name,V=p.value,X=!1,O=p.alias;if(O)R=O[0],y(f,r([0,1],O));for(var _=1,l=!0;_=f.length){var K0=S(V,d);if(l=!!K0,l&&"get"in K0&&!("originalValue"in K0.get))V=K0.get;else V=V[d]}else l=G0(V,d),V=V[d];if(l&&!X)B0[k]=V}}return V}}),PB=R0((B,U)=>{var G=WB(),Y=g8(),Q=Y([G("%String.prototype.indexOf%")]);U.exports=function(Z,J){var q=G(Z,!!J);if(typeof q==="function"&&Q(Z,".prototype.")>-1)return Y([q]);return q}}),gU=R0((B,U)=>{var G=b8()(),Y=PB()("Object.prototype.toString"),Q=function(q){if(G&&q&&typeof q==="object"&&Symbol.toStringTag in q)return!1;return Y(q)==="[object Arguments]"},K=function(q){if(Q(q))return!0;return q!==null&&typeof q==="object"&&"length"in q&&typeof q.length==="number"&&q.length>=0&&Y(q)!=="[object Array]"&&"callee"in q&&Y(q.callee)==="[object Function]"},Z=function(){return Q(arguments)}();Q.isLegacyArguments=K,U.exports=Z?Q:K}),fU=R0((B,U)=>{var G=Object.prototype.toString,Y=Function.prototype.toString,Q=/^\s*(?:function)?\*/,K=b8()(),Z=Object.getPrototypeOf,J=function(){if(!K)return!1;try{return Function("return function*() {}")()}catch(W){}},q;U.exports=function(I){if(typeof I!=="function")return!1;if(Q.test(Y.call(I)))return!0;if(!K)return G.call(I)==="[object GeneratorFunction]";if(!Z)return!1;if(typeof q>"u"){var H=J();q=H?Z(H):!1}return Z(I)===q}}),xU=R0((B,U)=>{var G=Function.prototype.toString,Y=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,Q,K;if(typeof Y==="function"&&typeof Object.defineProperty==="function")try{Q=Object.defineProperty({},"length",{get:function(){throw K}}),K={},Y(function(){throw 42},null,Q)}catch(S){if(S!==K)Y=null}else Y=null;var Z=/^\s*class\b/,J=function(F){try{var M=G.call(F);return Z.test(M)}catch($){return!1}},q=function(F){try{if(J(F))return!1;return G.call(F),!0}catch(M){return!1}},W=Object.prototype.toString,I="[object Object]",H="[object Function]",T="[object GeneratorFunction]",A="[object HTMLAllCollection]",P="[object HTML document.all class]",j="[object HTMLCollection]",E=typeof Symbol==="function"&&!!Symbol.toStringTag,C=!(0 in[,]),N=function(){return!1};if(typeof document==="object"){var v=document.all;if(W.call(v)===W.call(document.all))N=function(F){if((C||!F)&&(typeof F>"u"||typeof F==="object"))try{var M=W.call(F);return(M===A||M===P||M===j||M===I)&&F("")==null}catch($){}return!1}}U.exports=Y?function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;try{Y(F,null,Q)}catch(M){if(M!==K)return!1}return!J(F)&&q(F)}:function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;if(E)return q(F);if(J(F))return!1;var M=W.call(F);if(M!==H&&M!==T&&!/^\[object HTML/.test(M))return!1;return q(F)}}),_U=R0((B,U)=>{var G=xU(),Y=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,K=function(I,H,T){for(var A=0,P=I.length;A=3)A=T;if(q(I))K(I,H,A);else if(typeof I==="string")Z(I,H,A);else J(I,H,A)}}),hU=R0((B,U)=>{U.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),uU=R0((B,U)=>{d2();var G=hU(),Y=typeof globalThis>"u"?v0:globalThis;U.exports=function(){var K=[];for(var Z=0;Z{var G=_1(),Y=LB(),Q=x1(),K=K1();U.exports=function(J,q,W){if(!J||typeof J!=="object"&&typeof J!=="function")throw new Q("`obj` must be an object or a function`");if(typeof q!=="string"&&typeof q!=="symbol")throw new Q("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new Q("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new Q("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new Q("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new Q("`loose`, if provided, must be a boolean");var I=arguments.length>3?arguments[3]:null,H=arguments.length>4?arguments[4]:null,T=arguments.length>5?arguments[5]:null,A=arguments.length>6?arguments[6]:!1,P=!!K&&K(J,q);if(G)G(J,q,{configurable:T===null&&P?P.configurable:!T,enumerable:I===null&&P?P.enumerable:!I,value:W,writable:H===null&&P?P.writable:!H});else if(A||!I&&!H&&!T)J[q]=W;else throw new Y("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),cU=R0((B,U)=>{var G=_1(),Y=function(){return!!G};Y.hasArrayLengthDefineBug=function(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(K){return!0}},U.exports=Y}),mU=R0((B,U)=>{var G=WB(),Y=dU(),Q=cU()(),K=K1(),Z=x1(),J=G("%Math.floor%");U.exports=function(W,I){if(typeof W!=="function")throw new Z("`fn` is not a function");if(typeof I!=="number"||I<0||I>4294967295||J(I)!==I)throw new Z("`length` must be a positive 32-bit integer");var H=arguments.length>2&&!!arguments[2],T=!0,A=!0;if("length"in W&&K){var P=K(W,"length");if(P&&!P.configurable)T=!1;if(P&&!P.writable)A=!1}if(T||A||!H)if(Q)Y(W,"length",I,!0,!0);else Y(W,"length",I);return W}}),lU=R0((B,U)=>{var G=V1(),Y=y8(),Q=HB();U.exports=function(){return Q(G,Y,arguments)}}),aU=R0((B,U)=>{var G=mU(),Y=_1(),Q=g8(),K=lU();if(U.exports=function(J){var q=Q(arguments),W=J.length-(arguments.length-1);return G(q,1+(W>0?W:0),!0)},Y)Y(U.exports,"apply",{value:K});else U.exports.apply=K}),AB=R0((B,U)=>{d2();var G=_U(),Y=uU(),Q=aU(),K=PB(),Z=K1(),J=FB(),q=K("Object.prototype.toString"),W=b8()(),I=typeof globalThis>"u"?v0:globalThis,H=Y(),T=K("String.prototype.slice"),A=K("Array.prototype.indexOf",!0)||function(N,v){for(var S=0;S-1)return v;if(v!=="Object")return!1;return E(N)}if(!Z)return null;return j(N)}}),pU=R0((B,U)=>{var G=AB();U.exports=function(Q){return!!G(Q)}}),rU=R0((B)=>{var U=gU(),G=fU(),Y=AB(),Q=pU();function K(O){return O.call.bind(O)}var Z=typeof BigInt<"u",J=typeof Symbol<"u",q=K(Object.prototype.toString),W=K(Number.prototype.valueOf),I=K(String.prototype.valueOf),H=K(Boolean.prototype.valueOf);if(Z)var T=K(BigInt.prototype.valueOf);if(J)var A=K(Symbol.prototype.valueOf);function P(O,_){if(typeof O!=="object")return!1;try{return _(O),!0}catch(l){return!1}}B.isArgumentsObject=U,B.isGeneratorFunction=G,B.isTypedArray=Q;function j(O){return typeof Promise<"u"&&O instanceof Promise||O!==null&&typeof O==="object"&&typeof O.then==="function"&&typeof O.catch==="function"}B.isPromise=j;function E(O){if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)return ArrayBuffer.isView(O);return Q(O)||n(O)}B.isArrayBufferView=E;function C(O){return Y(O)==="Uint8Array"}B.isUint8Array=C;function N(O){return Y(O)==="Uint8ClampedArray"}B.isUint8ClampedArray=N;function v(O){return Y(O)==="Uint16Array"}B.isUint16Array=v;function S(O){return Y(O)==="Uint32Array"}B.isUint32Array=S;function F(O){return Y(O)==="Int8Array"}B.isInt8Array=F;function M(O){return Y(O)==="Int16Array"}B.isInt16Array=M;function $(O){return Y(O)==="Int32Array"}B.isInt32Array=$;function x(O){return Y(O)==="Float32Array"}B.isFloat32Array=x;function w(O){return Y(O)==="Float64Array"}B.isFloat64Array=w;function a(O){return Y(O)==="BigInt64Array"}B.isBigInt64Array=a;function U0(O){return Y(O)==="BigUint64Array"}B.isBigUint64Array=U0;function b(O){return q(O)==="[object Map]"}b.working=typeof Map<"u"&&b(new Map);function c(O){if(typeof Map>"u")return!1;return b.working?b(O):O instanceof Map}B.isMap=c;function D(O){return q(O)==="[object Set]"}D.working=typeof Set<"u"&&D(new Set);function m(O){if(typeof Set>"u")return!1;return D.working?D(O):O instanceof Set}B.isSet=m;function B0(O){return q(O)==="[object WeakMap]"}B0.working=typeof WeakMap<"u"&&B0(new WeakMap);function i(O){if(typeof WeakMap>"u")return!1;return B0.working?B0(O):O instanceof WeakMap}B.isWeakMap=i;function V0(O){return q(O)==="[object WeakSet]"}V0.working=typeof WeakSet<"u"&&V0(new WeakSet);function s(O){return V0(O)}B.isWeakSet=s;function G0(O){return q(O)==="[object ArrayBuffer]"}G0.working=typeof ArrayBuffer<"u"&&G0(new ArrayBuffer);function r(O){if(typeof ArrayBuffer>"u")return!1;return G0.working?G0(O):O instanceof ArrayBuffer}B.isArrayBuffer=r;function y(O){return q(O)==="[object DataView]"}y.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&y(new DataView(new ArrayBuffer(1),0,1));function n(O){if(typeof DataView>"u")return!1;return y.working?y(O):O instanceof DataView}B.isDataView=n;var o=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Y0(O){return q(O)==="[object SharedArrayBuffer]"}function O0(O){if(typeof o>"u")return!1;if(typeof Y0.working>"u")Y0.working=Y0(new o);return Y0.working?Y0(O):O instanceof o}B.isSharedArrayBuffer=O0;function z(O){return q(O)==="[object AsyncFunction]"}B.isAsyncFunction=z;function L(O){return q(O)==="[object Map Iterator]"}B.isMapIterator=L;function u(O){return q(O)==="[object Set Iterator]"}B.isSetIterator=u;function h(O){return q(O)==="[object Generator]"}B.isGeneratorObject=h;function Z0(O){return q(O)==="[object WebAssembly.Module]"}B.isWebAssemblyCompiledModule=Z0;function g(O){return P(O,W)}B.isNumberObject=g;function f(O){return P(O,I)}B.isStringObject=f;function R(O){return P(O,H)}B.isBooleanObject=R;function p(O){return Z&&P(O,T)}B.isBigIntObject=p;function k(O){return J&&P(O,A)}B.isSymbolObject=k;function V(O){return g(O)||f(O)||R(O)||p(O)||k(O)}B.isBoxedPrimitive=V;function X(O){return typeof Uint8Array<"u"&&(r(O)||O0(O))}B.isAnyArrayBuffer=X,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(O){Object.defineProperty(B,O,{enumerable:!1,value:function(){throw Error(O+" is not supported in userland")}})})}),iU=R0((B,U)=>{U.exports=function(Y){return Y&&typeof Y==="object"&&typeof Y.copy==="function"&&typeof Y.fill==="function"&&typeof Y.readUInt8==="function"}}),jB=R0((B)=>{P2();var U=Object.getOwnPropertyDescriptors||function(n){var o=Object.keys(n),Y0={};for(var O0=0;O0=O0)return u;switch(u){case"%s":return String(Y0[o++]);case"%d":return Number(Y0[o++]);case"%j":try{return JSON.stringify(Y0[o++])}catch(h){return"[Circular]"}default:return u}});for(var L=Y0[o];o"u")return function(){return B.deprecate(y,n).apply(this,arguments)};var o=!1;function Y0(){if(!o){if(P0.throwDeprecation)throw Error(n);else if(P0.traceDeprecation)console.trace(n);else console.error(n);o=!0}return y.apply(this,arguments)}return Y0};var Y={},Q=/^$/;if(P0.env.NODE_DEBUG){var K=P0.env.NODE_DEBUG;K=K.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Q=new RegExp("^"+K+"$","i")}B.debuglog=function(y){if(y=y.toUpperCase(),!Y[y])if(Q.test(y)){var n=P0.pid;Y[y]=function(){var o=B.format.apply(B,arguments);console.error("%s %d: %s",y,n,o)}}else Y[y]=function(){};return Y[y]};function Z(y,n){var o={seen:[],stylize:q};if(arguments.length>=3)o.depth=arguments[2];if(arguments.length>=4)o.colors=arguments[3];if(C(n))o.showHidden=n;else if(n)B._extend(o,n);if($(o.showHidden))o.showHidden=!1;if($(o.depth))o.depth=2;if($(o.colors))o.colors=!1;if($(o.customInspect))o.customInspect=!0;if(o.colors)o.stylize=J;return I(o,y,o.depth)}B.inspect=Z,Z.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Z.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function J(y,n){var o=Z.styles[n];if(o)return"\x1B["+Z.colors[o][0]+"m"+y+"\x1B["+Z.colors[o][1]+"m";else return y}function q(y,n){return y}function W(y){var n={};return y.forEach(function(o,Y0){n[o]=!0}),n}function I(y,n,o){if(y.customInspect&&n&&b(n.inspect)&&n.inspect!==B.inspect&&!(n.constructor&&n.constructor.prototype===n)){var Y0=n.inspect(o,y);if(!F(Y0))Y0=I(y,Y0,o);return Y0}var O0=H(y,n);if(O0)return O0;var z=Object.keys(n),L=W(z);if(y.showHidden)z=Object.getOwnPropertyNames(n);if(U0(n)&&(z.indexOf("message")>=0||z.indexOf("description")>=0))return T(n);if(z.length===0){if(b(n)){var u=n.name?": "+n.name:"";return y.stylize("[Function"+u+"]","special")}if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");if(a(n))return y.stylize(Date.prototype.toString.call(n),"date");if(U0(n))return T(n)}var h="",Z0=!1,g=["{","}"];if(E(n))Z0=!0,g=["[","]"];if(b(n))h=" [Function"+(n.name?": "+n.name:"")+"]";if(x(n))h=" "+RegExp.prototype.toString.call(n);if(a(n))h=" "+Date.prototype.toUTCString.call(n);if(U0(n))h=" "+T(n);if(z.length===0&&(!Z0||n.length==0))return g[0]+h+g[1];if(o<0)if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");else return y.stylize("[Object]","special");y.seen.push(n);var f;if(Z0)f=A(y,n,o,L,z);else f=z.map(function(R){return P(y,n,o,L,R,Z0)});return y.seen.pop(),j(f,h,g)}function H(y,n){if($(n))return y.stylize("undefined","undefined");if(F(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return y.stylize(o,"string")}if(S(n))return y.stylize(""+n,"number");if(C(n))return y.stylize(""+n,"boolean");if(N(n))return y.stylize("null","null")}function T(y){return"["+Error.prototype.toString.call(y)+"]"}function A(y,n,o,Y0,O0){var z=[];for(var L=0,u=n.length;L-1)if(z)u=u.split(` `).map(function(Z0){return" "+Z0}).join(` `).slice(2);else u=` `+u.split(` `).map(function(Z0){return" "+Z0}).join(` -`)}else u=y.stylize("[Circular]","special");if($(L)){if(w&&O0.match(/^\d+$/))return u;if(L=JSON.stringify(""+O0),L.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))L=L.slice(1,-1),L=y.stylize(L,"name");else L=L.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),L=y.stylize(L,"string")}return L+": "+u}function j(y,n,o){var Y0=0;if(y.reduce(function(O0,w){if(Y0++,w.indexOf(` -`)>=0)Y0++;return O0+w.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return o[0]+(n===""?"":n+` +`)}else u=y.stylize("[Circular]","special");if($(L)){if(z&&O0.match(/^\d+$/))return u;if(L=JSON.stringify(""+O0),L.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))L=L.slice(1,-1),L=y.stylize(L,"name");else L=L.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),L=y.stylize(L,"string")}return L+": "+u}function j(y,n,o){var Y0=0;if(y.reduce(function(O0,z){if(Y0++,z.indexOf(` +`)>=0)Y0++;return O0+z.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return o[0]+(n===""?"":n+` `)+" "+y.join(`, - `)+" "+o[1];return o[0]+n+" "+y.join(", ")+" "+o[1]}B.types=rU();function E(y){return Array.isArray(y)}B.isArray=E;function C(y){return typeof y==="boolean"}B.isBoolean=C;function N(y){return y===null}B.isNull=N;function v(y){return y==null}B.isNullOrUndefined=v;function S(y){return typeof y==="number"}B.isNumber=S;function F(y){return typeof y==="string"}B.isString=F;function M(y){return typeof y==="symbol"}B.isSymbol=M;function $(y){return y===void 0}B.isUndefined=$;function x(y){return z(y)&&D(y)==="[object RegExp]"}B.isRegExp=x,B.types.isRegExp=x;function z(y){return typeof y==="object"&&y!==null}B.isObject=z;function a(y){return z(y)&&D(y)==="[object Date]"}B.isDate=a,B.types.isDate=a;function U0(y){return z(y)&&(D(y)==="[object Error]"||y instanceof Error)}B.isError=U0,B.types.isNativeError=U0;function b(y){return typeof y==="function"}B.isFunction=b;function c(y){return y===null||typeof y==="boolean"||typeof y==="number"||typeof y==="string"||typeof y==="symbol"||typeof y>"u"}B.isPrimitive=c,B.isBuffer=iU();function D(y){return Object.prototype.toString.call(y)}function m(y){return y<10?"0"+y.toString(10):y.toString(10)}var B0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function i(){var y=new Date,n=[m(y.getHours()),m(y.getMinutes()),m(y.getSeconds())].join(":");return[y.getDate(),B0[y.getMonth()],n].join(" ")}B.log=function(){console.log("%s - %s",i(),B.format.apply(B,arguments))},B.inherits=W2(),B._extend=function(y,n){if(!n||!z(n))return y;var o=Object.keys(n),Y0=o.length;while(Y0--)y[o[Y0]]=n[o[Y0]];return y};function V0(y,n){return Object.prototype.hasOwnProperty.call(y,n)}var s=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;B.promisify=function(n){if(typeof n!=="function")throw TypeError('The "original" argument must be of type Function');if(s&&n[s]){var o=n[s];if(typeof o!=="function")throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(o,s,{value:o,enumerable:!1,writable:!1,configurable:!0}),o}function o(){var Y0,O0,w=new Promise(function(h,Z0){Y0=h,O0=Z0}),L=[];for(var u=0;u{function G(P,j){var E=Object.keys(P);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(P);j&&(C=C.filter(function(N){return Object.getOwnPropertyDescriptor(P,N).enumerable})),E.push.apply(E,C)}return E}function Y(P){for(var j=1;j0)this.tail.next=C;else this.head=C;this.tail=C,++this.length}},{key:"unshift",value:function(E){var C={data:E,next:this.head};if(this.length===0)this.tail=C;this.head=C,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var E=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,E}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";var C=this.head,N=""+C.data;while(C=C.next)N+=E+C.data;return N}},{key:"concat",value:function(E){if(this.length===0)return I.alloc(0);var C=I.allocUnsafe(E>>>0),N=this.head,v=0;while(N)A(N.data,C,v),v+=N.data.length,N=N.next;return C}},{key:"consume",value:function(E,C){var N;if(ES.length?S.length:E;if(F===S.length)v+=S;else v+=S.slice(0,E);if(E-=F,E===0){if(F===S.length)if(++N,C.next)this.head=C.next;else this.head=this.tail=null;else this.head=C,C.data=S.slice(F);break}++N}return this.length-=N,v}},{key:"_getBuffer",value:function(E){var C=I.allocUnsafe(E),N=this.head,v=1;N.data.copy(C),E-=N.data.length;while(N=N.next){var S=N.data,F=E>S.length?S.length:E;if(S.copy(C,C.length-E,0,F),E-=F,E===0){if(F===S.length)if(++v,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=S.slice(F);break}++v}return this.length-=v,C}},{key:T,value:function(E,C){return H(this,Y(Y({},C),{},{depth:0,customInspect:!1}))}}]),P}()}),NB=R0((B,U)=>{P2();function G(q,W){var I=this,H=this._readableState&&this._readableState.destroyed,T=this._writableState&&this._writableState.destroyed;if(H||T){if(W)W(q);else if(q){if(!this._writableState)P0.nextTick(Z,this,q);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,P0.nextTick(Z,this,q)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(q||null,function(A){if(!W&&A)if(!I._writableState)P0.nextTick(Y,I,A);else if(!I._writableState.errorEmitted)I._writableState.errorEmitted=!0,P0.nextTick(Y,I,A);else P0.nextTick(Q,I);else if(W)P0.nextTick(Q,I),W(A);else P0.nextTick(Q,I)}),this}function Y(q,W){Z(q,W),Q(q)}function Q(q){if(q._writableState&&!q._writableState.emitClose)return;if(q._readableState&&!q._readableState.emitClose)return;q.emit("close")}function K(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function Z(q,W){q.emit("error",W)}function J(q,W){var{_readableState:I,_writableState:H}=q;if(I&&I.autoDestroy||H&&H.autoDestroy)q.destroy(W);else q.emit("error",W)}U.exports={destroy:G,undestroy:K,errorOrDestroy:J}}),c2=R0((B,U)=>{function G(W,I){W.prototype=Object.create(I.prototype),W.prototype.constructor=W,W.__proto__=I}var Y={};function Q(W,I,H){if(!H)H=Error;function T(P,j,E){if(typeof I==="string")return I;else return I(P,j,E)}var A=function(P){G(j,P);function j(E,C,N){return P.call(this,T(E,C,N))||this}return j}(H);A.prototype.name=H.name,A.prototype.code=W,Y[W]=A}function K(W,I){if(Array.isArray(W)){var H=W.length;if(W=W.map(function(T){return String(T)}),H>2)return"one of ".concat(I," ").concat(W.slice(0,H-1).join(", "),", or ")+W[H-1];else if(H===2)return"one of ".concat(I," ").concat(W[0]," or ").concat(W[1]);else return"of ".concat(I," ").concat(W[0])}else return"of ".concat(I," ").concat(String(W))}function Z(W,I,H){return W.substr(!H||H<0?0:+H,I.length)===I}function J(W,I,H){if(H===void 0||H>W.length)H=W.length;return W.substring(H-I.length,H)===I}function q(W,I,H){if(typeof H!=="number")H=0;if(H+I.length>W.length)return!1;else return W.indexOf(I,H)!==-1}Q("ERR_INVALID_OPT_VALUE",function(W,I){return'The value "'+I+'" is invalid for option "'+W+'"'},TypeError),Q("ERR_INVALID_ARG_TYPE",function(W,I,H){var T;if(typeof I==="string"&&Z(I,"not "))T="must not be",I=I.replace(/^not /,"");else T="must be";var A;if(J(W," argument"))A="The ".concat(W," ").concat(T," ").concat(K(I,"type"));else{var P=q(W,".")?"property":"argument";A='The "'.concat(W,'" ').concat(P," ").concat(T," ").concat(K(I,"type"))}return A+=". Received type ".concat(typeof H),A},TypeError),Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Q("ERR_METHOD_NOT_IMPLEMENTED",function(W){return"The "+W+" method is not implemented"}),Q("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Q("ERR_STREAM_DESTROYED",function(W){return"Cannot call "+W+" after a stream was destroyed"}),Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Q("ERR_STREAM_WRITE_AFTER_END","write after end"),Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Q("ERR_UNKNOWN_ENCODING",function(W){return"Unknown encoding: "+W},TypeError),Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),U.exports.codes=Y}),zB=R0((B,U)=>{var G=c2().codes.ERR_INVALID_OPT_VALUE;function Y(K,Z,J){return K.highWaterMark!=null?K.highWaterMark:Z?K[J]:null}function Q(K,Z,J,q){var W=Y(Z,q,J);if(W!=null){if(!(isFinite(W)&&Math.floor(W)===W)||W<0)throw new G(q?J:"highWaterMark",W);return Math.floor(W)}return K.objectMode?16:16384}U.exports={getHighWaterMark:Q}}),sU=R0((B,U)=>{d2(),U.exports=G;function G(Q,K){if(Y("noDeprecation"))return Q;var Z=!1;function J(){if(!Z){if(Y("throwDeprecation"))throw Error(K);else if(Y("traceDeprecation"))console.trace(K);else console.warn(K);Z=!0}return Q.apply(this,arguments)}return J}function Y(Q){try{if(!v0.localStorage)return!1}catch(Z){return!1}var K=v0.localStorage[Q];if(K==null)return!1;return String(K).toLowerCase()==="true"}}),wB=R0((B,U)=>{d2(),P2(),U.exports=z;function G(w){var L=this;this.next=null,this.entry=null,this.finish=function(){O0(L,w)}}var Y;z.WritableState=$;var Q={deprecate:sU()},K=qB(),Z=f1().Buffer,J=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function q(w){return Z.from(w)}function W(w){return Z.isBuffer(w)||w instanceof J}var I=NB(),H=zB().getHighWaterMark,T=c2().codes,A=T.ERR_INVALID_ARG_TYPE,P=T.ERR_METHOD_NOT_IMPLEMENTED,j=T.ERR_MULTIPLE_CALLBACK,E=T.ERR_STREAM_CANNOT_PIPE,C=T.ERR_STREAM_DESTROYED,N=T.ERR_STREAM_NULL_VALUES,v=T.ERR_STREAM_WRITE_AFTER_END,S=T.ERR_UNKNOWN_ENCODING,F=I.errorOrDestroy;W2()(z,K);function M(){}function $(w,L,u){if(Y=Y||u2(),w=w||{},typeof u!=="boolean")u=L instanceof Y;if(this.objectMode=!!w.objectMode,u)this.objectMode=this.objectMode||!!w.writableObjectMode;this.highWaterMark=H(this,w,"writableHighWaterMark",u),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=w.decodeStrings===!1;this.decodeStrings=!h,this.defaultEncoding=w.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z0){i(L,Z0)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=w.emitClose!==!1,this.autoDestroy=!!w.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new G(this)}$.prototype.getBuffer=function(){var L=this.bufferedRequest,u=[];while(L)u.push(L),L=L.next;return u},function(){try{Object.defineProperty($.prototype,"buffer",{get:Q.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(w){}}();var x;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")x=Function.prototype[Symbol.hasInstance],Object.defineProperty(z,Symbol.hasInstance,{value:function(L){if(x.call(this,L))return!0;if(this!==z)return!1;return L&&L._writableState instanceof $}});else x=function(L){return L instanceof this};function z(w){Y=Y||u2();var L=this instanceof Y;if(!L&&!x.call(z,this))return new z(w);if(this._writableState=new $(w,this,L),this.writable=!0,w){if(typeof w.write==="function")this._write=w.write;if(typeof w.writev==="function")this._writev=w.writev;if(typeof w.destroy==="function")this._destroy=w.destroy;if(typeof w.final==="function")this._final=w.final}K.call(this)}z.prototype.pipe=function(){F(this,new E)};function a(w,L){var u=new v;F(w,u),P0.nextTick(L,u)}function U0(w,L,u,h){var Z0;if(u===null)Z0=new N;else if(typeof u!=="string"&&!L.objectMode)Z0=new A("chunk",["string","Buffer"],u);if(Z0)return F(w,Z0),P0.nextTick(h,Z0),!1;return!0}z.prototype.write=function(w,L,u){var h=this._writableState,Z0=!1,g=!h.objectMode&&W(w);if(g&&!Z.isBuffer(w))w=q(w);if(typeof L==="function")u=L,L=null;if(g)L="buffer";else if(!L)L=h.defaultEncoding;if(typeof u!=="function")u=M;if(h.ending)a(this,u);else if(g||U0(this,h,w,u))h.pendingcb++,Z0=c(this,h,g,w,L,u);return Z0},z.prototype.cork=function(){this._writableState.corked++},z.prototype.uncork=function(){var w=this._writableState;if(w.corked){if(w.corked--,!w.writing&&!w.corked&&!w.bufferProcessing&&w.bufferedRequest)G0(this,w)}},z.prototype.setDefaultEncoding=function(L){if(typeof L==="string")L=L.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((L+"").toLowerCase())>-1))throw new S(L);return this._writableState.defaultEncoding=L,this},Object.defineProperty(z.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function b(w,L,u){if(!w.objectMode&&w.decodeStrings!==!1&&typeof L==="string")L=Z.from(L,u);return L}Object.defineProperty(z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function c(w,L,u,h,Z0,g){if(!u){var f=b(L,h,Z0);if(h!==f)u=!0,Z0="buffer",h=f}var R=L.objectMode?1:h.length;L.length+=R;var p=L.length{P2();var G=Object.keys||function(H){var T=[];for(var A in H)T.push(A);return T};U.exports=q;var Y=EB(),Q=wB();W2()(q,Y);var K=G(Q.prototype);for(var Z=0;Z{var G=f1(),Y=G.Buffer;function Q(Z,J){for(var q in Z)J[q]=Z[q]}if(Y.from&&Y.alloc&&Y.allocUnsafe&&Y.allocUnsafeSlow)U.exports=G;else Q(G,B),B.Buffer=K;function K(Z,J,q){return Y(Z,J,q)}Q(Y,K),K.from=function(Z,J,q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return Y(Z,J,q)},K.alloc=function(Z,J,q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var W=Y(Z);if(J!==void 0)if(typeof q==="string")W.fill(J,q);else W.fill(J);else W.fill(0);return W},K.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return Y(Z)},K.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),F8=R0((B)=>{var U=oU().Buffer,G=U.isEncoding||function(N){switch(N=""+N,N&&N.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Y(N){if(!N)return"utf8";var v;while(!0)switch(N){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return N;default:if(v)return;N=(""+N).toLowerCase(),v=!0}}function Q(N){var v=Y(N);if(typeof v!=="string"&&(U.isEncoding===G||!G(N)))throw Error("Unknown encoding: "+N);return v||N}B.StringDecoder=K;function K(N){this.encoding=Q(N);var v;switch(this.encoding){case"utf16le":this.text=T,this.end=A,v=4;break;case"utf8":this.fillLast=W,v=4;break;case"base64":this.text=P,this.end=j,v=3;break;default:this.write=E,this.end=C;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=U.allocUnsafe(v)}K.prototype.write=function(N){if(N.length===0)return"";var v,S;if(this.lastNeed){if(v=this.fillLast(N),v===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;if(S>5===6)return 2;else if(N>>4===14)return 3;else if(N>>3===30)return 4;return N>>6===2?-1:-2}function J(N,v,S){var F=v.length-1;if(F=0){if(M>0)N.lastNeed=M-1;return M}if(--F=0){if(M>0)N.lastNeed=M-2;return M}if(--F=0){if(M>0)if(M===2)M=0;else N.lastNeed=M-3;return M}return 0}function q(N,v,S){if((v[0]&192)!==128)return N.lastNeed=0,"�";if(N.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return N.lastNeed=1,"�";if(N.lastNeed>2&&v.length>2){if((v[2]&192)!==128)return N.lastNeed=2,"�"}}}function W(N){var v=this.lastTotal-this.lastNeed,S=q(this,N,v);if(S!==void 0)return S;if(this.lastNeed<=N.length)return N.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);N.copy(this.lastChar,v,0,N.length),this.lastNeed-=N.length}function I(N,v){var S=J(this,N,v);if(!this.lastNeed)return N.toString("utf8",v);this.lastTotal=S;var F=N.length-(S-this.lastNeed);return N.copy(this.lastChar,0,F),N.toString("utf8",v,F)}function H(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+"�";return v}function T(N,v){if((N.length-v)%2===0){var S=N.toString("utf16le",v);if(S){var F=S.charCodeAt(S.length-1);if(F>=55296&&F<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=N[N.length-1],N.toString("utf16le",v,N.length-1)}function A(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,S)}return v}function P(N,v){var S=(N.length-v)%3;if(S===0)return N.toString("base64",v);if(this.lastNeed=3-S,this.lastTotal=3,S===1)this.lastChar[0]=N[N.length-1];else this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1];return N.toString("base64",v,N.length-S)}function j(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+this.lastChar.toString("base64",0,3-this.lastNeed);return v}function E(N){return N.toString(this.encoding)}function C(N){return N&&N.length?this.write(N):""}}),f8=R0((B,U)=>{var G=c2().codes.ERR_STREAM_PREMATURE_CLOSE;function Y(J){var q=!1;return function(){if(q)return;q=!0;for(var W=arguments.length,I=Array(W),H=0;H{P2();var G;function Y(S,F,M){if(F=Q(F),F in S)Object.defineProperty(S,F,{value:M,enumerable:!0,configurable:!0,writable:!0});else S[F]=M;return S}function Q(S){var F=K(S,"string");return typeof F==="symbol"?F:String(F)}function K(S,F){if(typeof S!=="object"||S===null)return S;var M=S[Symbol.toPrimitive];if(M!==void 0){var $=M.call(S,F||"default");if(typeof $!=="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(F==="string"?String:Number)(S)}var Z=f8(),J=Symbol("lastResolve"),q=Symbol("lastReject"),W=Symbol("error"),I=Symbol("ended"),H=Symbol("lastPromise"),T=Symbol("handlePromise"),A=Symbol("stream");function P(S,F){return{value:S,done:F}}function j(S){var F=S[J];if(F!==null){var M=S[A].read();if(M!==null)S[H]=null,S[J]=null,S[q]=null,F(P(M,!1))}}function E(S){P0.nextTick(j,S)}function C(S,F){return function(M,$){S.then(function(){if(F[I]){M(P(void 0,!0));return}F[T](M,$)},$)}}var N=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((G={get stream(){return this[A]},next:function(){var F=this,M=this[W];if(M!==null)return Promise.reject(M);if(this[I])return Promise.resolve(P(void 0,!0));if(this[A].destroyed)return new Promise(function(a,U0){P0.nextTick(function(){if(F[W])U0(F[W]);else a(P(void 0,!0))})});var $=this[H],x;if($)x=new Promise(C($,this));else{var z=this[A].read();if(z!==null)return Promise.resolve(P(z,!1));x=new Promise(this[T])}return this[H]=x,x}},Y(G,Symbol.asyncIterator,function(){return this}),Y(G,"return",function(){var F=this;return new Promise(function(M,$){F[A].destroy(null,function(x){if(x){$(x);return}M(P(void 0,!0))})})}),G),N);U.exports=function(F){var M,$=Object.create(v,(M={},Y(M,A,{value:F,writable:!0}),Y(M,J,{value:null,writable:!0}),Y(M,q,{value:null,writable:!0}),Y(M,W,{value:null,writable:!0}),Y(M,I,{value:F._readableState.endEmitted,writable:!0}),Y(M,T,{value:function(z,a){var U0=$[A].read();if(U0)$[H]=null,$[J]=null,$[q]=null,z(P(U0,!1));else $[J]=z,$[q]=a},writable:!0}),M));return $[H]=null,Z(F,function(x){if(x&&x.code!=="ERR_STREAM_PREMATURE_CLOSE"){var z=$[q];if(z!==null)$[H]=null,$[J]=null,$[q]=null,z(x);$[W]=x;return}var a=$[J];if(a!==null)$[H]=null,$[J]=null,$[q]=null,a(P(void 0,!0));$[I]=!0}),F.on("readable",E.bind(null,$)),$}}),eU=R0((B,U)=>{U.exports=function(){throw Error("Readable.from is not available in the browser")}}),EB=R0((B,U)=>{d2(),P2(),U.exports=a;var G;a.ReadableState=z,S8().EventEmitter;var Y=function(f,R){return f.listeners(R).length},Q=qB(),K=f1().Buffer,Z=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function J(g){return K.from(g)}function q(g){return K.isBuffer(g)||g instanceof Z}var W=jB(),I;if(W&&W.debuglog)I=W.debuglog("stream");else I=function(){};var H=nU(),T=NB(),A=zB().getHighWaterMark,P=c2().codes,j=P.ERR_INVALID_ARG_TYPE,E=P.ERR_STREAM_PUSH_AFTER_EOF,C=P.ERR_METHOD_NOT_IMPLEMENTED,N=P.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,S,F;W2()(a,Q);var M=T.errorOrDestroy,$=["error","close","destroy","pause","resume"];function x(g,f,R){if(typeof g.prependListener==="function")return g.prependListener(f,R);if(!g._events||!g._events[f])g.on(f,R);else if(Array.isArray(g._events[f]))g._events[f].unshift(R);else g._events[f]=[R,g._events[f]]}function z(g,f,R){if(G=G||u2(),g=g||{},typeof R!=="boolean")R=f instanceof G;if(this.objectMode=!!g.objectMode,R)this.objectMode=this.objectMode||!!g.readableObjectMode;if(this.highWaterMark=A(this,g,"readableHighWaterMark",R),this.buffer=new H,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=g.emitClose!==!1,this.autoDestroy=!!g.autoDestroy,this.destroyed=!1,this.defaultEncoding=g.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,g.encoding){if(!v)v=F8().StringDecoder;this.decoder=new v(g.encoding),this.encoding=g.encoding}}function a(g){if(G=G||u2(),!(this instanceof a))return new a(g);var f=this instanceof G;if(this._readableState=new z(g,this,f),this.readable=!0,g){if(typeof g.read==="function")this._read=g.read;if(typeof g.destroy==="function")this._destroy=g.destroy}Q.call(this)}Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(f){if(!this._readableState)return;this._readableState.destroyed=f}}),a.prototype.destroy=T.destroy,a.prototype._undestroy=T.undestroy,a.prototype._destroy=function(g,f){f(g)},a.prototype.push=function(g,f){var R=this._readableState,p;if(!R.objectMode){if(typeof g==="string"){if(f=f||R.defaultEncoding,f!==R.encoding)g=K.from(g,f),f="";p=!0}}else p=!0;return U0(this,g,f,!1,p)},a.prototype.unshift=function(g){return U0(this,g,null,!0,!1)};function U0(g,f,R,p,k){I("readableAddChunk",f);var V=g._readableState;if(f===null)V.reading=!1,i(g,V);else{var X;if(!k)X=c(V,f);if(X)M(g,X);else if(V.objectMode||f&&f.length>0){if(typeof f!=="string"&&!V.objectMode&&Object.getPrototypeOf(f)!==K.prototype)f=J(f);if(p)if(V.endEmitted)M(g,new N);else b(g,V,f,!0);else if(V.ended)M(g,new E);else if(V.destroyed)return!1;else if(V.reading=!1,V.decoder&&!R)if(f=V.decoder.write(f),V.objectMode||f.length!==0)b(g,V,f,!1);else G0(g,V);else b(g,V,f,!1)}else if(!p)V.reading=!1,G0(g,V)}return!V.ended&&(V.length=D)g=D;else g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++;return g}function B0(g,f){if(g<=0||f.length===0&&f.ended)return 0;if(f.objectMode)return 1;if(g!==g)if(f.flowing&&f.length)return f.buffer.head.data.length;else return f.length;if(g>f.highWaterMark)f.highWaterMark=m(g);if(g<=f.length)return g;if(!f.ended)return f.needReadable=!0,0;return f.length}a.prototype.read=function(g){I("read",g),g=parseInt(g,10);var f=this._readableState,R=g;if(g!==0)f.emittedReadable=!1;if(g===0&&f.needReadable&&((f.highWaterMark!==0?f.length>=f.highWaterMark:f.length>0)||f.ended)){if(I("read: emitReadable",f.length,f.ended),f.length===0&&f.ended)u(this);else V0(this);return null}if(g=B0(g,f),g===0&&f.ended){if(f.length===0)u(this);return null}var p=f.needReadable;if(I("need readable",p),f.length===0||f.length-g0)k=L(g,f);else k=null;if(k===null)f.needReadable=f.length<=f.highWaterMark,g=0;else f.length-=g,f.awaitDrain=0;if(f.length===0){if(!f.ended)f.needReadable=!0;if(R!==g&&f.ended)u(this)}if(k!==null)this.emit("data",k);return k};function i(g,f){if(I("onEofChunk"),f.ended)return;if(f.decoder){var R=f.decoder.end();if(R&&R.length)f.buffer.push(R),f.length+=f.objectMode?1:R.length}if(f.ended=!0,f.sync)V0(g);else if(f.needReadable=!1,!f.emittedReadable)f.emittedReadable=!0,s(g)}function V0(g){var f=g._readableState;if(I("emitReadable",f.needReadable,f.emittedReadable),f.needReadable=!1,!f.emittedReadable)I("emitReadable",f.flowing),f.emittedReadable=!0,P0.nextTick(s,g)}function s(g){var f=g._readableState;if(I("emitReadable_",f.destroyed,f.length,f.ended),!f.destroyed&&(f.length||f.ended))g.emit("readable"),f.emittedReadable=!1;f.needReadable=!f.flowing&&!f.ended&&f.length<=f.highWaterMark,w(g)}function G0(g,f){if(!f.readingMore)f.readingMore=!0,P0.nextTick(r,g,f)}function r(g,f){while(!f.reading&&!f.ended&&(f.length1&&Z0(p.pipes,g)!==-1)&&!_)I("false write response, pause",p.awaitDrain),p.awaitDrain++;R.pause()}}function Q0(F0){if(I("onerror",F0),I0(),g.removeListener("error",Q0),Y(g,"error")===0)M(g,F0)}x(g,"error",Q0);function X0(){g.removeListener("finish",K0),I0()}g.once("close",X0);function K0(){I("onfinish"),g.removeListener("close",X0),I0()}g.once("finish",K0);function I0(){I("unpipe"),R.unpipe(g)}if(g.emit("pipe",R),!p.flowing)I("pipe resume"),R.resume();return g};function y(g){return function(){var R=g._readableState;if(I("pipeOnDrain",R.awaitDrain),R.awaitDrain)R.awaitDrain--;if(R.awaitDrain===0&&Y(g,"data"))R.flowing=!0,w(g)}}a.prototype.unpipe=function(g){var f=this._readableState,R={hasUnpiped:!1};if(f.pipesCount===0)return this;if(f.pipesCount===1){if(g&&g!==f.pipes)return this;if(!g)g=f.pipes;if(f.pipes=null,f.pipesCount=0,f.flowing=!1,g)g.emit("unpipe",this,R);return this}if(!g){var{pipes:p,pipesCount:k}=f;f.pipes=null,f.pipesCount=0,f.flowing=!1;for(var V=0;V0,p.flowing!==!1)this.resume()}else if(g==="readable"){if(!p.endEmitted&&!p.readableListening){if(p.readableListening=p.needReadable=!0,p.flowing=!1,p.emittedReadable=!1,I("on readable",p.length,p.reading),p.length)V0(this);else if(!p.reading)P0.nextTick(o,this)}}return R},a.prototype.addListener=a.prototype.on,a.prototype.removeListener=function(g,f){var R=Q.prototype.removeListener.call(this,g,f);if(g==="readable")P0.nextTick(n,this);return R},a.prototype.removeAllListeners=function(g){var f=Q.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)P0.nextTick(n,this);return f};function n(g){var f=g._readableState;if(f.readableListening=g.listenerCount("readable")>0,f.resumeScheduled&&!f.paused)f.flowing=!0;else if(g.listenerCount("data")>0)g.resume()}function o(g){I("readable nexttick read 0"),g.read(0)}a.prototype.resume=function(){var g=this._readableState;if(!g.flowing)I("resume"),g.flowing=!g.readableListening,Y0(this,g);return g.paused=!1,this};function Y0(g,f){if(!f.resumeScheduled)f.resumeScheduled=!0,P0.nextTick(O0,g,f)}function O0(g,f){if(I("resume",f.reading),!f.reading)g.read(0);if(f.resumeScheduled=!1,g.emit("resume"),w(g),f.flowing&&!f.reading)g.read(0)}a.prototype.pause=function(){if(I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)I("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function w(g){var f=g._readableState;I("flow",f.flowing);while(f.flowing&&g.read()!==null);}if(a.prototype.wrap=function(g){var f=this,R=this._readableState,p=!1;g.on("end",function(){if(I("wrapped end"),R.decoder&&!R.ended){var X=R.decoder.end();if(X&&X.length)f.push(X)}f.push(null)}),g.on("data",function(X){if(I("wrapped data"),R.decoder)X=R.decoder.write(X);if(R.objectMode&&(X===null||X===void 0))return;else if(!R.objectMode&&(!X||!X.length))return;if(!f.push(X))p=!0,g.pause()});for(var k in g)if(this[k]===void 0&&typeof g[k]==="function")this[k]=function(O){return function(){return g[O].apply(g,arguments)}}(k);for(var V=0;V<$.length;V++)g.on($[V],this.emit.bind(this,$[V]));return this._read=function(X){if(I("wrapped _read",X),p)p=!1,g.resume()},this},typeof Symbol==="function")a.prototype[Symbol.asyncIterator]=function(){if(S===void 0)S=tU();return S(this)};Object.defineProperty(a.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(a.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(a.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(f){if(this._readableState)this._readableState.flowing=f}}),a._fromList=L,Object.defineProperty(a.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function L(g,f){if(f.length===0)return null;var R;if(f.objectMode)R=f.buffer.shift();else if(!g||g>=f.length){if(f.decoder)R=f.buffer.join("");else if(f.buffer.length===1)R=f.buffer.first();else R=f.buffer.concat(f.length);f.buffer.clear()}else R=f.buffer.consume(g,f.decoder);return R}function u(g){var f=g._readableState;if(I("endReadable",f.endEmitted),!f.endEmitted)f.ended=!0,P0.nextTick(h,f,g)}function h(g,f){if(I("endReadableNT",g.endEmitted,g.length),!g.endEmitted&&g.length===0){if(g.endEmitted=!0,f.readable=!1,f.emit("end"),g.autoDestroy){var R=f._writableState;if(!R||R.autoDestroy&&R.finished)f.destroy()}}}if(typeof Symbol==="function")a.from=function(g,f){if(F===void 0)F=eU();return F(a,g,f)};function Z0(g,f){for(var R=0,p=g.length;R{U.exports=W;var G=c2().codes,Y=G.ERR_METHOD_NOT_IMPLEMENTED,Q=G.ERR_MULTIPLE_CALLBACK,K=G.ERR_TRANSFORM_ALREADY_TRANSFORMING,Z=G.ERR_TRANSFORM_WITH_LENGTH_0,J=u2();W2()(W,J);function q(T,A){var P=this._transformState;P.transforming=!1;var j=P.writecb;if(j===null)return this.emit("error",new Q);if(P.writechunk=null,P.writecb=null,A!=null)this.push(A);j(T);var E=this._readableState;if(E.reading=!1,E.needReadable||E.length{U.exports=Y;var G=DB();W2()(Y,G);function Y(Q){if(!(this instanceof Y))return new Y(Q);G.call(this,Q)}Y.prototype._transform=function(Q,K,Z){Z(null,Q)}}),UG=R0((B,U)=>{var G;function Y(P){var j=!1;return function(){if(j)return;j=!0,P.apply(void 0,arguments)}}var Q=c2().codes,K=Q.ERR_MISSING_ARGS,Z=Q.ERR_STREAM_DESTROYED;function J(P){if(P)throw P}function q(P){return P.setHeader&&typeof P.abort==="function"}function W(P,j,E,C){C=Y(C);var N=!1;if(P.on("close",function(){N=!0}),G===void 0)G=f8();G(P,{readable:j,writable:E},function(S){if(S)return C(S);N=!0,C()});var v=!1;return function(S){if(N)return;if(v)return;if(v=!0,q(P))return P.abort();if(typeof P.destroy==="function")return P.destroy();C(S||new Z("pipe"))}}function I(P){P()}function H(P,j){return P.pipe(j)}function T(P){if(!P.length)return J;if(typeof P[P.length-1]!=="function")return J;return P.pop()}function A(){for(var P=arguments.length,j=Array(P),E=0;E0,function($){if(!N)N=$;if($)v.forEach(I);if(M)return;v.forEach(I),C(N)})});return j.reduce(H)}U.exports=A}),x8=R0((B,U)=>{U.exports=Y;var G=S8().EventEmitter;W2()(Y,G),Y.Readable=EB(),Y.Writable=wB(),Y.Duplex=u2(),Y.Transform=DB(),Y.PassThrough=BG(),Y.finished=f8(),Y.pipeline=UG(),Y.Stream=Y;function Y(){G.call(this)}Y.prototype.pipe=function(Q,K){var Z=this;function J(P){if(Q.writable){if(Q.write(P)===!1&&Z.pause)Z.pause()}}Z.on("data",J);function q(){if(Z.readable&&Z.resume)Z.resume()}if(Q.on("drain",q),!Q._isStdio&&(!K||K.end!==!1))Z.on("end",I),Z.on("close",H);var W=!1;function I(){if(W)return;W=!0,Q.end()}function H(){if(W)return;if(W=!0,typeof Q.destroy==="function")Q.destroy()}function T(P){if(A(),G.listenerCount(this,"error")===0)throw P}Z.on("error",T),Q.on("error",T);function A(){Z.removeListener("data",J),Q.removeListener("drain",q),Z.removeListener("end",I),Z.removeListener("close",H),Z.removeListener("error",T),Q.removeListener("error",T),Z.removeListener("end",A),Z.removeListener("close",A),Q.removeListener("close",A)}return Z.on("end",A),Z.on("close",A),Q.on("close",A),Q.emit("pipe",Z),Q}}),GG=R0((B)=>{(function(U){U.parser=function(w,L){return new Y(w,L)},U.SAXParser=Y,U.SAXStream=I,U.createStream=W,U.MAX_BUFFER_LENGTH=65536;var G=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];U.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Y(w,L){if(!(this instanceof Y))return new Y(w,L);var u=this;if(K(u),u.q=u.c="",u.bufferCheckPosition=U.MAX_BUFFER_LENGTH,u.opt=L||{},u.opt.lowercase=u.opt.lowercase||u.opt.lowercasetags,u.looseCase=u.opt.lowercase?"toLowerCase":"toUpperCase",u.tags=[],u.closed=u.closedRoot=u.sawRoot=!1,u.tag=u.error=null,u.strict=!!w,u.noscript=!!(w||u.opt.noscript),u.state=z.BEGIN,u.strictEntities=u.opt.strictEntities,u.ENTITIES=u.strictEntities?Object.create(U.XML_ENTITIES):Object.create(U.ENTITIES),u.attribList=[],u.opt.xmlns)u.ns=Object.create(j);if(u.trackPosition=u.opt.position!==!1,u.trackPosition)u.position=u.line=u.column=0;U0(u,"onready")}if(!Object.create)Object.create=function(w){function L(){}return L.prototype=w,new L};if(!Object.keys)Object.keys=function(w){var L=[];for(var u in w)if(w.hasOwnProperty(u))L.push(u);return L};function Q(w){var L=Math.max(U.MAX_BUFFER_LENGTH,10),u=0;for(var h=0,Z0=G.length;hL)switch(G[h]){case"textNode":c(w);break;case"cdata":b(w,"oncdata",w.cdata),w.cdata="";break;case"script":b(w,"onscript",w.script),w.script="";break;default:m(w,"Max buffer length exceeded: "+G[h])}u=Math.max(u,g)}w.bufferCheckPosition=U.MAX_BUFFER_LENGTH-u+w.position}function K(w){for(var L=0,u=G.length;L"||S(w)}function $(w,L){return w.test(L)}function x(w,L){return!$(w,L)}var z=0;U.STATE={BEGIN:z++,BEGIN_WHITESPACE:z++,TEXT:z++,TEXT_ENTITY:z++,OPEN_WAKA:z++,SGML_DECL:z++,SGML_DECL_QUOTED:z++,DOCTYPE:z++,DOCTYPE_QUOTED:z++,DOCTYPE_DTD:z++,DOCTYPE_DTD_QUOTED:z++,COMMENT_STARTING:z++,COMMENT:z++,COMMENT_ENDING:z++,COMMENT_ENDED:z++,CDATA:z++,CDATA_ENDING:z++,CDATA_ENDING_2:z++,PROC_INST:z++,PROC_INST_BODY:z++,PROC_INST_ENDING:z++,OPEN_TAG:z++,OPEN_TAG_SLASH:z++,ATTRIB:z++,ATTRIB_NAME:z++,ATTRIB_NAME_SAW_WHITE:z++,ATTRIB_VALUE:z++,ATTRIB_VALUE_QUOTED:z++,ATTRIB_VALUE_CLOSED:z++,ATTRIB_VALUE_UNQUOTED:z++,ATTRIB_VALUE_ENTITY_Q:z++,ATTRIB_VALUE_ENTITY_U:z++,CLOSE_TAG:z++,CLOSE_TAG_SAW_WHITE:z++,SCRIPT:z++,SCRIPT_ENDING:z++},U.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},U.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(U.ENTITIES).forEach(function(w){var L=U.ENTITIES[w],u=typeof L==="number"?String.fromCharCode(L):L;U.ENTITIES[w]=u});for(var a in U.STATE)U.STATE[U.STATE[a]]=a;z=U.STATE;function U0(w,L,u){w[L]&&w[L](u)}function b(w,L,u){if(w.textNode)c(w);U0(w,L,u)}function c(w){if(w.textNode=D(w.opt,w.textNode),w.textNode)U0(w,"ontext",w.textNode);w.textNode=""}function D(w,L){if(w.trim)L=L.trim();if(w.normalize)L=L.replace(/\s+/g," ");return L}function m(w,L){if(c(w),w.trackPosition)L+=` -Line: `+w.line+` -Column: `+w.column+` -Char: `+w.c;return L=Error(L),w.error=L,U0(w,"onerror",L),w}function B0(w){if(w.sawRoot&&!w.closedRoot)i(w,"Unclosed root tag");if(w.state!==z.BEGIN&&w.state!==z.BEGIN_WHITESPACE&&w.state!==z.TEXT)m(w,"Unexpected end");return c(w),w.c="",w.closed=!0,U0(w,"onend"),Y.call(w,w.strict,w.opt),w}function i(w,L){if(typeof w!=="object"||!(w instanceof Y))throw Error("bad call to strictFail");if(w.strict)m(w,L)}function V0(w){if(!w.strict)w.tagName=w.tagName[w.looseCase]();var L=w.tags[w.tags.length-1]||w,u=w.tag={name:w.tagName,attributes:{}};if(w.opt.xmlns)u.ns=L.ns;w.attribList.length=0,b(w,"onopentagstart",u)}function s(w,L){var u=w.indexOf(":")<0?["",w]:w.split(":"),h=u[0],Z0=u[1];if(L&&w==="xmlns")h="xmlns",Z0="";return{prefix:h,local:Z0}}function G0(w){if(!w.strict)w.attribName=w.attribName[w.looseCase]();if(w.attribList.indexOf(w.attribName)!==-1||w.tag.attributes.hasOwnProperty(w.attribName)){w.attribName=w.attribValue="";return}if(w.opt.xmlns){var L=s(w.attribName,!0),u=L.prefix,h=L.local;if(u==="xmlns")if(h==="xml"&&w.attribValue!==A)i(w,"xml: prefix must be bound to "+A+` -Actual: `+w.attribValue);else if(h==="xmlns"&&w.attribValue!==P)i(w,"xmlns: prefix must be bound to "+P+` -Actual: `+w.attribValue);else{var Z0=w.tag,g=w.tags[w.tags.length-1]||w;if(Z0.ns===g.ns)Z0.ns=Object.create(g.ns);Z0.ns[h]=w.attribValue}w.attribList.push([w.attribName,w.attribValue])}else w.tag.attributes[w.attribName]=w.attribValue,b(w,"onattribute",{name:w.attribName,value:w.attribValue});w.attribName=w.attribValue=""}function r(w,L){if(w.opt.xmlns){var u=w.tag,h=s(w.tagName);if(u.prefix=h.prefix,u.local=h.local,u.uri=u.ns[h.prefix]||"",u.prefix&&!u.uri)i(w,"Unbound namespace prefix: "+JSON.stringify(w.tagName)),u.uri=h.prefix;var Z0=w.tags[w.tags.length-1]||w;if(u.ns&&Z0.ns!==u.ns)Object.keys(u.ns).forEach(function(d){b(w,"onopennamespace",{prefix:d,uri:u.ns[d]})});for(var g=0,f=w.attribList.length;g",w.tagName="",w.state=z.SCRIPT;return}b(w,"onscript",w.script),w.script=""}var L=w.tags.length,u=w.tagName;if(!w.strict)u=u[w.looseCase]();var h=u;while(L--)if(w.tags[L].name!==h)i(w,"Unexpected close tag");else break;if(L<0){i(w,"Unmatched closing tag: "+w.tagName),w.textNode+="",w.state=z.TEXT;return}w.tagName=u;var Z0=w.tags.length;while(Z0-- >L){var g=w.tag=w.tags.pop();w.tagName=w.tag.name,b(w,"onclosetag",w.tagName);var f={};for(var R in g.ns)f[R]=g.ns[R];var p=w.tags[w.tags.length-1]||w;if(w.opt.xmlns&&g.ns!==p.ns)Object.keys(g.ns).forEach(function(k){var V=g.ns[k];b(w,"onclosenamespace",{prefix:k,uri:V})})}if(L===0)w.closedRoot=!0;w.tagName=w.attribValue=w.attribName="",w.attribList.length=0,w.state=z.TEXT}function n(w){var L=w.entity,u=L.toLowerCase(),h,Z0="";if(w.ENTITIES[L])return w.ENTITIES[L];if(w.ENTITIES[u])return w.ENTITIES[u];if(L=u,L.charAt(0)==="#")if(L.charAt(1)==="x")L=L.slice(2),h=parseInt(L,16),Z0=h.toString(16);else L=L.slice(1),h=parseInt(L,10),Z0=h.toString(10);if(L=L.replace(/^0+/,""),isNaN(h)||Z0.toLowerCase()!==L)return i(w,"Invalid character entity"),"&"+w.entity+";";return String.fromCodePoint(h)}function o(w,L){if(L==="<")w.state=z.OPEN_WAKA,w.startTagPosition=w.position;else if(!S(L))i(w,"Non-whitespace before first tag."),w.textNode=L,w.state=z.TEXT}function Y0(w,L){var u="";if(L")b(L,"onsgmldeclaration",L.sgmlDecl),L.sgmlDecl="",L.state=z.TEXT;else if(F(h))L.state=z.SGML_DECL_QUOTED,L.sgmlDecl+=h;else L.sgmlDecl+=h;continue;case z.SGML_DECL_QUOTED:if(h===L.q)L.state=z.SGML_DECL,L.q="";L.sgmlDecl+=h;continue;case z.DOCTYPE:if(h===">")L.state=z.TEXT,b(L,"ondoctype",L.doctype),L.doctype=!0;else if(L.doctype+=h,h==="[")L.state=z.DOCTYPE_DTD;else if(F(h))L.state=z.DOCTYPE_QUOTED,L.q=h;continue;case z.DOCTYPE_QUOTED:if(L.doctype+=h,h===L.q)L.q="",L.state=z.DOCTYPE;continue;case z.DOCTYPE_DTD:if(L.doctype+=h,h==="]")L.state=z.DOCTYPE;else if(F(h))L.state=z.DOCTYPE_DTD_QUOTED,L.q=h;continue;case z.DOCTYPE_DTD_QUOTED:if(L.doctype+=h,h===L.q)L.state=z.DOCTYPE_DTD,L.q="";continue;case z.COMMENT:if(h==="-")L.state=z.COMMENT_ENDING;else L.comment+=h;continue;case z.COMMENT_ENDING:if(h==="-"){if(L.state=z.COMMENT_ENDED,L.comment=D(L.opt,L.comment),L.comment)b(L,"oncomment",L.comment);L.comment=""}else L.comment+="-"+h,L.state=z.COMMENT;continue;case z.COMMENT_ENDED:if(h!==">")i(L,"Malformed comment"),L.comment+="--"+h,L.state=z.COMMENT;else L.state=z.TEXT;continue;case z.CDATA:if(h==="]")L.state=z.CDATA_ENDING;else L.cdata+=h;continue;case z.CDATA_ENDING:if(h==="]")L.state=z.CDATA_ENDING_2;else L.cdata+="]"+h,L.state=z.CDATA;continue;case z.CDATA_ENDING_2:if(h===">"){if(L.cdata)b(L,"oncdata",L.cdata);b(L,"onclosecdata"),L.cdata="",L.state=z.TEXT}else if(h==="]")L.cdata+="]";else L.cdata+="]]"+h,L.state=z.CDATA;continue;case z.PROC_INST:if(h==="?")L.state=z.PROC_INST_ENDING;else if(S(h))L.state=z.PROC_INST_BODY;else L.procInstName+=h;continue;case z.PROC_INST_BODY:if(!L.procInstBody&&S(h))continue;else if(h==="?")L.state=z.PROC_INST_ENDING;else L.procInstBody+=h;continue;case z.PROC_INST_ENDING:if(h===">")b(L,"onprocessinginstruction",{name:L.procInstName,body:L.procInstBody}),L.procInstName=L.procInstBody="",L.state=z.TEXT;else L.procInstBody+="?"+h,L.state=z.PROC_INST_BODY;continue;case z.OPEN_TAG:if($(C,h))L.tagName+=h;else if(V0(L),h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else{if(!S(h))i(L,"Invalid character in tag name");L.state=z.ATTRIB}continue;case z.OPEN_TAG_SLASH:if(h===">")r(L,!0),y(L);else i(L,"Forward-slash in opening tag not followed by >"),L.state=z.ATTRIB;continue;case z.ATTRIB:if(S(h))continue;else if(h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else if($(E,h))L.attribName=h,L.attribValue="",L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case z.ATTRIB_NAME:if(h==="=")L.state=z.ATTRIB_VALUE;else if(h===">")i(L,"Attribute without value"),L.attribValue=L.attribName,G0(L),r(L);else if(S(h))L.state=z.ATTRIB_NAME_SAW_WHITE;else if($(C,h))L.attribName+=h;else i(L,"Invalid attribute name");continue;case z.ATTRIB_NAME_SAW_WHITE:if(h==="=")L.state=z.ATTRIB_VALUE;else if(S(h))continue;else if(i(L,"Attribute without value"),L.tag.attributes[L.attribName]="",L.attribValue="",b(L,"onattribute",{name:L.attribName,value:""}),L.attribName="",h===">")r(L);else if($(E,h))L.attribName=h,L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name"),L.state=z.ATTRIB;continue;case z.ATTRIB_VALUE:if(S(h))continue;else if(F(h))L.q=h,L.state=z.ATTRIB_VALUE_QUOTED;else i(L,"Unquoted attribute value"),L.state=z.ATTRIB_VALUE_UNQUOTED,L.attribValue=h;continue;case z.ATTRIB_VALUE_QUOTED:if(h!==L.q){if(h==="&")L.state=z.ATTRIB_VALUE_ENTITY_Q;else L.attribValue+=h;continue}G0(L),L.q="",L.state=z.ATTRIB_VALUE_CLOSED;continue;case z.ATTRIB_VALUE_CLOSED:if(S(h))L.state=z.ATTRIB;else if(h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else if($(E,h))i(L,"No whitespace between attributes"),L.attribName=h,L.attribValue="",L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case z.ATTRIB_VALUE_UNQUOTED:if(!M(h)){if(h==="&")L.state=z.ATTRIB_VALUE_ENTITY_U;else L.attribValue+=h;continue}if(G0(L),h===">")r(L);else L.state=z.ATTRIB;continue;case z.CLOSE_TAG:if(!L.tagName)if(S(h))continue;else if(x(E,h))if(L.script)L.script+="")y(L);else if($(C,h))L.tagName+=h;else if(L.script)L.script+="")y(L);else i(L,"Invalid characters in closing tag");continue;case z.TEXT_ENTITY:case z.ATTRIB_VALUE_ENTITY_Q:case z.ATTRIB_VALUE_ENTITY_U:var f,R;switch(L.state){case z.TEXT_ENTITY:f=z.TEXT,R="textNode";break;case z.ATTRIB_VALUE_ENTITY_Q:f=z.ATTRIB_VALUE_QUOTED,R="attribValue";break;case z.ATTRIB_VALUE_ENTITY_U:f=z.ATTRIB_VALUE_UNQUOTED,R="attribValue";break}if(h===";")L[R]+=n(L),L.entity="",L.state=f;else if($(L.entity.length?v:N,h))L.entity+=h;else i(L,"Invalid character in entity name"),L[R]+="&"+L.entity+h,L.entity="",L.state=f;continue;default:throw Error(L,"Unknown state: "+L.state)}}if(L.position>=L.bufferCheckPosition)Q(L);return L}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint)(function(){var w=String.fromCharCode,L=Math.floor,u=function(){var h=16384,Z0=[],g,f,R=-1,p=arguments.length;if(!p)return"";var k="";while(++R1114111||L(V)!==V)throw RangeError("Invalid code point: "+V);if(V<=65535)Z0.push(V);else V-=65536,g=(V>>10)+55296,f=V%1024+56320,Z0.push(g,f);if(R+1===p||Z0.length>h)k+=w.apply(null,Z0),Z0.length=0}return k};if(Object.defineProperty)Object.defineProperty(String,"fromCodePoint",{value:u,configurable:!0,writable:!0});else String.fromCodePoint=u})()})(typeof B>"u"?B.sax={}:B)}),_8=R0((B,U)=>{U.exports={isArray:function(G){if(Array.isArray)return Array.isArray(G);return Object.prototype.toString.call(G)==="[object Array]"}}}),h8=R0((B,U)=>{var G=_8().isArray;U.exports={copyOptions:function(Y){var Q,K={};for(Q in Y)if(Y.hasOwnProperty(Q))K[Q]=Y[Q];return K},ensureFlagExists:function(Y,Q){if(!(Y in Q)||typeof Q[Y]!=="boolean")Q[Y]=!1},ensureSpacesExists:function(Y){if(!("spaces"in Y)||typeof Y.spaces!=="number"&&typeof Y.spaces!=="string")Y.spaces=0},ensureAlwaysArrayExists:function(Y){if(!("alwaysArray"in Y)||typeof Y.alwaysArray!=="boolean"&&!G(Y.alwaysArray))Y.alwaysArray=!1},ensureKeyExists:function(Y,Q){if(!(Y+"Key"in Q)||typeof Q[Y+"Key"]!=="string")Q[Y+"Key"]=Q.compact?"_"+Y:Y},checkFnExists:function(Y,Q){return Y+"Fn"in Q}}}),TB=R0((B,U)=>{var G=GG(),Y={on:function(){},parse:function(){}},Q=h8(),K=_8().isArray,Z,J=!0,q;function W(F){return Z=Q.copyOptions(F),Q.ensureFlagExists("ignoreDeclaration",Z),Q.ensureFlagExists("ignoreInstruction",Z),Q.ensureFlagExists("ignoreAttributes",Z),Q.ensureFlagExists("ignoreText",Z),Q.ensureFlagExists("ignoreComment",Z),Q.ensureFlagExists("ignoreCdata",Z),Q.ensureFlagExists("ignoreDoctype",Z),Q.ensureFlagExists("compact",Z),Q.ensureFlagExists("alwaysChildren",Z),Q.ensureFlagExists("addParent",Z),Q.ensureFlagExists("trim",Z),Q.ensureFlagExists("nativeType",Z),Q.ensureFlagExists("nativeTypeAttributes",Z),Q.ensureFlagExists("sanitize",Z),Q.ensureFlagExists("instructionHasAttributes",Z),Q.ensureFlagExists("captureSpacesBetweenElements",Z),Q.ensureAlwaysArrayExists(Z),Q.ensureKeyExists("declaration",Z),Q.ensureKeyExists("instruction",Z),Q.ensureKeyExists("attributes",Z),Q.ensureKeyExists("text",Z),Q.ensureKeyExists("comment",Z),Q.ensureKeyExists("cdata",Z),Q.ensureKeyExists("doctype",Z),Q.ensureKeyExists("type",Z),Q.ensureKeyExists("name",Z),Q.ensureKeyExists("elements",Z),Q.ensureKeyExists("parent",Z),Q.checkFnExists("doctype",Z),Q.checkFnExists("instruction",Z),Q.checkFnExists("cdata",Z),Q.checkFnExists("comment",Z),Q.checkFnExists("text",Z),Q.checkFnExists("instructionName",Z),Q.checkFnExists("elementName",Z),Q.checkFnExists("attributeName",Z),Q.checkFnExists("attributeValue",Z),Q.checkFnExists("attributes",Z),Z}function I(F){var M=Number(F);if(!isNaN(M))return M;var $=F.toLowerCase();if($==="true")return!0;else if($==="false")return!1;return F}function H(F,M){var $;if(Z.compact){if(!q[Z[F+"Key"]]&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(Z[F+"Key"])!==-1:Z.alwaysArray))q[Z[F+"Key"]]=[];if(q[Z[F+"Key"]]&&!K(q[Z[F+"Key"]]))q[Z[F+"Key"]]=[q[Z[F+"Key"]]];if(F+"Fn"in Z&&typeof M==="string")M=Z[F+"Fn"](M,q);if(F==="instruction"&&(("instructionFn"in Z)||("instructionNameFn"in Z))){for($ in M)if(M.hasOwnProperty($))if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);else{var x=M[$];delete M[$],M[Z.instructionNameFn($,x,q)]=x}}if(K(q[Z[F+"Key"]]))q[Z[F+"Key"]].push(M);else q[Z[F+"Key"]]=M}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];var z={};if(z[Z.typeKey]=F,F==="instruction"){for($ in M)if(M.hasOwnProperty($))break;if(z[Z.nameKey]="instructionNameFn"in Z?Z.instructionNameFn($,M,q):$,Z.instructionHasAttributes){if(z[Z.attributesKey]=M[$][Z.attributesKey],"instructionFn"in Z)z[Z.attributesKey]=Z.instructionFn(z[Z.attributesKey],$,q)}else{if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);z[Z.instructionKey]=M[$]}}else{if(F+"Fn"in Z)M=Z[F+"Fn"](M,q);z[Z[F+"Key"]]=M}if(Z.addParent)z[Z.parentKey]=q;q[Z.elementsKey].push(z)}}function T(F){if("attributesFn"in Z&&F)F=Z.attributesFn(F,q);if((Z.trim||("attributeValueFn"in Z)||("attributeNameFn"in Z)||Z.nativeTypeAttributes)&&F){var M;for(M in F)if(F.hasOwnProperty(M)){if(Z.trim)F[M]=F[M].trim();if(Z.nativeTypeAttributes)F[M]=I(F[M]);if("attributeValueFn"in Z)F[M]=Z.attributeValueFn(F[M],M,q);if("attributeNameFn"in Z){var $=F[M];delete F[M],F[Z.attributeNameFn(M,F[M],q)]=$}}}return F}function A(F){var M={};if(F.body&&(F.name.toLowerCase()==="xml"||Z.instructionHasAttributes)){var $=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,x;while((x=$.exec(F.body))!==null)M[x[1]]=x[2]||x[3]||x[4];M=T(M)}if(F.name.toLowerCase()==="xml"){if(Z.ignoreDeclaration)return;if(q[Z.declarationKey]={},Object.keys(M).length)q[Z.declarationKey][Z.attributesKey]=M;if(Z.addParent)q[Z.declarationKey][Z.parentKey]=q}else{if(Z.ignoreInstruction)return;if(Z.trim)F.body=F.body.trim();var z={};if(Z.instructionHasAttributes&&Object.keys(M).length)z[F.name]={},z[F.name][Z.attributesKey]=M;else z[F.name]=F.body;H("instruction",z)}}function P(F,M){var $;if(typeof F==="object")M=F.attributes,F=F.name;if(M=T(M),"elementNameFn"in Z)F=Z.elementNameFn(F,q);if(Z.compact){if($={},!Z.ignoreAttributes&&M&&Object.keys(M).length){$[Z.attributesKey]={};var x;for(x in M)if(M.hasOwnProperty(x))$[Z.attributesKey][x]=M[x]}if(!(F in q)&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(F)!==-1:Z.alwaysArray))q[F]=[];if(q[F]&&!K(q[F]))q[F]=[q[F]];if(K(q[F]))q[F].push($);else q[F]=$}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];if($={},$[Z.typeKey]="element",$[Z.nameKey]=F,!Z.ignoreAttributes&&M&&Object.keys(M).length)$[Z.attributesKey]=M;if(Z.alwaysChildren)$[Z.elementsKey]=[];q[Z.elementsKey].push($)}$[Z.parentKey]=q,q=$}function j(F){if(Z.ignoreText)return;if(!F.trim()&&!Z.captureSpacesBetweenElements)return;if(Z.trim)F=F.trim();if(Z.nativeType)F=I(F);if(Z.sanitize)F=F.replace(/&/g,"&").replace(//g,">");H("text",F)}function E(F){if(Z.ignoreComment)return;if(Z.trim)F=F.trim();H("comment",F)}function C(F){var M=q[Z.parentKey];if(!Z.addParent)delete q[Z.parentKey];q=M}function N(F){if(Z.ignoreCdata)return;if(Z.trim)F=F.trim();H("cdata",F)}function v(F){if(Z.ignoreDoctype)return;if(F=F.replace(/^ /,""),Z.trim)F=F.trim();H("doctype",F)}function S(F){F.note=F}U.exports=function(F,M){var $=J?G.parser(!0,{}):$=new Y.Parser("UTF-8"),x={};if(q=x,Z=W(M),J)$.opt={strictEntities:!0},$.onopentag=P,$.ontext=j,$.oncomment=E,$.onclosetag=C,$.onerror=S,$.oncdata=N,$.ondoctype=v,$.onprocessinginstruction=A;else $.on("startElement",P),$.on("text",j),$.on("comment",E),$.on("endElement",C),$.on("error",S);if(J)$.write(F).close();else if(!$.parse(F))throw Error("XML parsing error: "+$.getError());if(x[Z.elementsKey]){var z=x[Z.elementsKey];delete x[Z.elementsKey],x[Z.elementsKey]=z,delete x.text}return x}}),YG=R0((B,U)=>{var G=h8(),Y=TB();function Q(K){var Z=G.copyOptions(K);return G.ensureSpacesExists(Z),Z}U.exports=function(K,Z){var J=Q(Z),q=Y(K,J),W,I="compact"in J&&J.compact?"_parent":"parent";if("addParent"in J&&J.addParent)W=JSON.stringify(q,function(H,T){return H===I?"_":T},J.spaces);else W=JSON.stringify(q,null,J.spaces);return W.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}}),CB=R0((B,U)=>{var G=h8(),Y=_8().isArray,Q,K;function Z(F){var M=G.copyOptions(F);if(G.ensureFlagExists("ignoreDeclaration",M),G.ensureFlagExists("ignoreInstruction",M),G.ensureFlagExists("ignoreAttributes",M),G.ensureFlagExists("ignoreText",M),G.ensureFlagExists("ignoreComment",M),G.ensureFlagExists("ignoreCdata",M),G.ensureFlagExists("ignoreDoctype",M),G.ensureFlagExists("compact",M),G.ensureFlagExists("indentText",M),G.ensureFlagExists("indentCdata",M),G.ensureFlagExists("indentAttributes",M),G.ensureFlagExists("indentInstruction",M),G.ensureFlagExists("fullTagEmptyElement",M),G.ensureFlagExists("noQuotesForNativeAttributes",M),G.ensureSpacesExists(M),typeof M.spaces==="number")M.spaces=Array(M.spaces+1).join(" ");return G.ensureKeyExists("declaration",M),G.ensureKeyExists("instruction",M),G.ensureKeyExists("attributes",M),G.ensureKeyExists("text",M),G.ensureKeyExists("comment",M),G.ensureKeyExists("cdata",M),G.ensureKeyExists("doctype",M),G.ensureKeyExists("type",M),G.ensureKeyExists("name",M),G.ensureKeyExists("elements",M),G.checkFnExists("doctype",M),G.checkFnExists("instruction",M),G.checkFnExists("cdata",M),G.checkFnExists("comment",M),G.checkFnExists("text",M),G.checkFnExists("instructionName",M),G.checkFnExists("elementName",M),G.checkFnExists("attributeName",M),G.checkFnExists("attributeValue",M),G.checkFnExists("attributes",M),G.checkFnExists("fullTagEmptyElement",M),M}function J(F,M,$){return(!$&&F.spaces?` -`:"")+Array(M+1).join(F.spaces)}function q(F,M,$){if(M.ignoreAttributes)return"";if("attributesFn"in M)F=M.attributesFn(F,K,Q);var x,z,a,U0,b=[];for(x in F)if(F.hasOwnProperty(x)&&F[x]!==null&&F[x]!==void 0)U0=M.noQuotesForNativeAttributes&&typeof F[x]!=="string"?"":'"',z=""+F[x],z=z.replace(/"/g,"""),a="attributeNameFn"in M?M.attributeNameFn(x,z,K,Q):x,b.push(M.spaces&&M.indentAttributes?J(M,$+1,!1):" "),b.push(a+"="+U0+("attributeValueFn"in M?M.attributeValueFn(z,x,K,Q):z)+U0);if(F&&Object.keys(F).length&&M.spaces&&M.indentAttributes)b.push(J(M,$,!1));return b.join("")}function W(F,M,$){return Q=F,K="xml",M.ignoreDeclaration?"":""}function I(F,M,$){if(M.ignoreInstruction)return"";var x;for(x in F)if(F.hasOwnProperty(x))break;var z="instructionNameFn"in M?M.instructionNameFn(x,F[x],K,Q):x;if(typeof F[x]==="object")return Q=F,K=z,"";else{var a=F[x]?F[x]:"";if("instructionFn"in M)a=M.instructionFn(a,x,K,Q);return""}}function H(F,M){return M.ignoreComment?"":""}function T(F,M){return M.ignoreCdata?"":"","]]]]>"))+"]]>"}function A(F,M){return M.ignoreDoctype?"":""}function P(F,M){if(M.ignoreText)return"";return F=""+F,F=F.replace(/&/g,"&"),F=F.replace(/&/g,"&").replace(//g,">"),"textFn"in M?M.textFn(F,K,Q):F}function j(F,M){var $;if(F.elements&&F.elements.length)for($=0;$"),F[M.elementsKey]&&F[M.elementsKey].length)x.push(C(F[M.elementsKey],M,$+1)),Q=F,K=F.name;x.push(M.spaces&&j(F,M)?` -`+Array($+1).join(M.spaces):""),x.push("")}else x.push("/>");return x.join("")}function C(F,M,$,x){return F.reduce(function(z,a){var U0=J(M,$,x&&!z);switch(a.type){case"element":return z+U0+E(a,M,$);case"comment":return z+U0+H(a[M.commentKey],M);case"doctype":return z+U0+A(a[M.doctypeKey],M);case"cdata":return z+(M.indentCdata?U0:"")+T(a[M.cdataKey],M);case"text":return z+(M.indentText?U0:"")+P(a[M.textKey],M);case"instruction":var b={};return b[a[M.nameKey]]=a[M.attributesKey]?a:a[M.instructionKey],z+(M.indentInstruction?U0:"")+I(b,M,$)}},"")}function N(F,M,$){var x;for(x in F)if(F.hasOwnProperty(x))switch(x){case M.parentKey:case M.attributesKey:break;case M.textKey:if(M.indentText||$)return!0;break;case M.cdataKey:if(M.indentCdata||$)return!0;break;case M.instructionKey:if(M.indentInstruction||$)return!0;break;case M.doctypeKey:case M.commentKey:return!0;default:return!0}return!1}function v(F,M,$,x,z){Q=F,K=M;var a="elementNameFn"in $?$.elementNameFn(M,F):M;if(typeof F>"u"||F===null||F==="")return"fullTagEmptyElementFn"in $&&$.fullTagEmptyElementFn(M,F)||$.fullTagEmptyElement?"<"+a+">":"<"+a+"/>";var U0=[];if(M){if(U0.push("<"+a),typeof F!=="object")return U0.push(">"+P(F,$)+""),U0.join("");if(F[$.attributesKey])U0.push(q(F[$.attributesKey],$,x));var b=N(F,$,!0)||F[$.attributesKey]&&F[$.attributesKey]["xml:space"]==="preserve";if(!b)if("fullTagEmptyElementFn"in $)b=$.fullTagEmptyElementFn(M,F);else b=$.fullTagEmptyElement;if(b)U0.push(">");else return U0.push("/>"),U0.join("")}if(U0.push(S(F,$,x+1,!1)),Q=F,K=M,M)U0.push((z?J($,x,!1):"")+"");return U0.join("")}function S(F,M,$,x){var z,a,U0,b=[];for(a in F)if(F.hasOwnProperty(a)){U0=Y(F[a])?F[a]:[F[a]];for(z=0;z{var G=CB();U.exports=function(Y,Q){if(Y instanceof Buffer)Y=Y.toString();var K=null;if(typeof Y==="string")try{K=JSON.parse(Y)}catch(Z){throw Error("The JSON structure is invalid")}else K=Y;return G(K,Q)}}),h1=R0((B,U)=>{U.exports={xml2js:TB(),xml2json:YG(),js2xml:CB(),json2xml:ZG()}})(),u1=(B)=>{switch(B.type){case void 0:case"element":let U=new kB(B.name,B.attributes),G=B.elements||[];for(let Y of G){let Q=u1(Y);if(Q!==void 0)U.push(Q)}return U;case"text":return B.text;default:return}},QG=class extends H0{},kB=class extends t{static fromXmlString(B){return u1((0,h1.xml2js)(B,{compact:!1}))}constructor(B,U){super(B);if(U)this.root.push(new QG(U))}push(B){this.root.push(B)}},$B=class extends t{constructor(B){super("");e(this,"_attr",void 0),this._attr=B}prepForXml(B){return{_attr:this._attr}}},JG="",u8=class extends t{constructor(B,U){super(B);if(U)this.root=U.root}},T0=(B)=>{if(isNaN(B))throw Error(`Invalid value '${B}' specified. Must be an integer.`);return Math.floor(B)},X1=(B)=>{let U=T0(B);if(U<0)throw Error(`Invalid value '${B}' specified. Must be a positive integer.`);return U},d1=(B,U)=>{let G=U*2;if(B.length!==G||isNaN(Number(`0x${B}`)))throw Error(`Invalid hex value '${B}'. Expected ${G} digit hex value`);return B},KG=(B)=>d1(B,4),SB=(B)=>d1(B,2),W8=(B)=>d1(B,1),q1=(B)=>{let U=B.slice(-2),G=B.substring(0,B.length-2);return`${Number(G)}${U}`},d8=(B)=>{let U=q1(B);if(parseFloat(U)<0)throw Error(`Invalid value '${U}' specified. Expected a positive number.`);return U},C2=(B)=>{if(B==="auto")return B;return d1(B.charAt(0)==="#"?B.substring(1):B,3)},t0=(B)=>typeof B==="string"?q1(B):T0(B),bB=(B)=>typeof B==="string"?d8(B):X1(B),VG=(B)=>typeof B==="string"?q1(B):T0(B),E0=(B)=>typeof B==="string"?d8(B):X1(B),vB=(B)=>{let U=B.substring(0,B.length-1);return`${Number(U)}%`},c8=(B)=>{if(typeof B==="number")return T0(B);if(B.slice(-1)==="%")return vB(B);return q1(B)},yB=X1,gB=X1,fB=(B)=>B.toISOString(),q0=class extends t{constructor(B,U=!0){super(B);if(U!==!0)this.root.push(new C0({val:U}))}},D1=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:bB(U)}))}},S0=class extends t{},q2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},f2=(B,U)=>new M0({name:B,attributes:{value:{key:"w:val",value:U}}}),_2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},XG=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},O2=class extends t{constructor(B,U){super(B);this.root.push(U)}},M0=class extends t{constructor({name:B,attributes:U,children:G}){super(B);if(U)this.root.push(new $8(U));if(G)this.root.push(...G)}},c0={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},m8=(B)=>new M0({name:"w:jc",attributes:{val:{key:"w:val",value:B}}}),j0=(B,{color:U,size:G,space:Y,style:Q})=>new M0({name:B,attributes:{style:{key:"w:val",value:Q},color:{key:"w:color",value:U===void 0?void 0:C2(U)},size:{key:"w:sz",value:G===void 0?void 0:yB(G)},space:{key:"w:space",value:Y===void 0?void 0:gB(Y)}}}),c1={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},xB=class extends R2{constructor(B){super("w:pBdr");if(B.top)this.root.push(j0("w:top",B.top));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.left)this.root.push(j0("w:left",B.left));if(B.right)this.root.push(j0("w:right",B.right));if(B.between)this.root.push(j0("w:between",B.between))}},_B=class extends t{constructor(){super("w:pBdr");let B=j0("w:bottom",{color:"auto",space:1,style:c1.SINGLE,size:6});this.root.push(B)}},hB=({start:B,end:U,left:G,right:Y,hanging:Q,firstLine:K,firstLineChars:Z})=>new M0({name:"w:ind",attributes:{start:{key:"w:start",value:B===void 0?void 0:t0(B)},end:{key:"w:end",value:U===void 0?void 0:t0(U)},left:{key:"w:left",value:G===void 0?void 0:t0(G)},right:{key:"w:right",value:Y===void 0?void 0:t0(Y)},hanging:{key:"w:hanging",value:Q===void 0?void 0:E0(Q)},firstLine:{key:"w:firstLine",value:K===void 0?void 0:E0(K)},firstLineChars:{key:"w:firstLineChars",value:Z===void 0?void 0:T0(Z)}}}),uB=()=>new M0({name:"w:br"}),l8={BEGIN:"begin",END:"end",SEPARATE:"separate"},a8=(B,U)=>new M0({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:B},dirty:{key:"w:dirty",value:U}}}),e0=(B)=>a8(l8.BEGIN,B),X2=(B)=>a8(l8.SEPARATE,B),B2=(B)=>a8(l8.END,B),qG={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},MG={BOTTOM:"bottom",CENTER:"center",INSIDE:"inside",OUTSIDE:"outside",TOP:"top"},RG={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},x0={DEFAULT:"default",PRESERVE:"preserve"},_0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{space:"xml:space"})}},LG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},IG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},OG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},HG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTION")}},M1=({fill:B,color:U,type:G})=>new M0({name:"w:shd",attributes:{fill:{key:"w:fill",value:B===void 0?void 0:C2(B)},color:{key:"w:color",value:U===void 0?void 0:C2(U)},type:{key:"w:val",value:G}}}),FG={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},b0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},WG=class extends t{constructor(B){super("w:del");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},PG=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},p8={DOT:"dot"},r8=(B=p8.DOT)=>new M0({name:"w:em",attributes:{val:{key:"w:val",value:B}}}),AG=()=>r8(p8.DOT),jG=class extends t{constructor(B){super("w:spacing");this.root.push(new C0({val:t0(B)}))}},NG=class extends t{constructor(B){super("w:color");this.root.push(new C0({val:C2(B)}))}},zG=class extends t{constructor(B){super("w:highlight");this.root.push(new C0({val:B}))}},wG=class extends t{constructor(B){super("w:highlightCs");this.root.push(new C0({val:B}))}},EG=(B)=>new M0({name:"w:lang",attributes:{value:{key:"w:val",value:B.value},eastAsia:{key:"w:eastAsia",value:B.eastAsia},bidirectional:{key:"w:bidi",value:B.bidirectional}}}),T1=(B,U)=>{if(typeof B==="string"){let Y=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:Y},cs:{key:"w:cs",value:Y},eastAsia:{key:"w:eastAsia",value:Y},hAnsi:{key:"w:hAnsi",value:Y},hint:{key:"w:hint",value:U}}})}let G=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:G.ascii},cs:{key:"w:cs",value:G.cs},eastAsia:{key:"w:eastAsia",value:G.eastAsia},hAnsi:{key:"w:hAnsi",value:G.hAnsi},hint:{key:"w:hint",value:G.hint}}})},dB=(B)=>new M0({name:"w:vertAlign",attributes:{val:{key:"w:val",value:B}}}),DG=()=>dB("superscript"),TG=()=>dB("subscript"),i8={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},cB=(B=i8.SINGLE,U)=>new M0({name:"w:u",attributes:{val:{key:"w:val",value:B},color:{key:"w:color",value:U===void 0?void 0:C2(U)}}}),CG={BLINK_BACKGROUND:"blinkBackground",LIGHTS:"lights",ANTS_BLACK:"antsBlack",ANTS_RED:"antsRed",SHIMMER:"shimmer",SPARKLE:"sparkle",NONE:"none"},kG={BLACK:"black",BLUE:"blue",CYAN:"cyan",DARK_BLUE:"darkBlue",DARK_CYAN:"darkCyan",DARK_GRAY:"darkGray",DARK_GREEN:"darkGreen",DARK_MAGENTA:"darkMagenta",DARK_RED:"darkRed",DARK_YELLOW:"darkYellow",GREEN:"green",LIGHT_GRAY:"lightGray",MAGENTA:"magenta",NONE:"none",RED:"red",WHITE:"white",YELLOW:"yellow"},U2=class extends R2{constructor(B){super("w:rPr");if(!B)return;if(B.style)this.push(new q2("w:rStyle",B.style));if(B.font)if(typeof B.font==="string")this.push(T1(B.font));else if("name"in B.font)this.push(T1(B.font.name,B.font.hint));else this.push(T1(B.font));if(B.bold!==void 0)this.push(new q0("w:b",B.bold));if(B.boldComplexScript===void 0&&B.bold!==void 0||B.boldComplexScript){var U;this.push(new q0("w:bCs",(U=B.boldComplexScript)!==null&&U!==void 0?U:B.bold))}if(B.italics!==void 0)this.push(new q0("w:i",B.italics));if(B.italicsComplexScript===void 0&&B.italics!==void 0||B.italicsComplexScript){var G;this.push(new q0("w:iCs",(G=B.italicsComplexScript)!==null&&G!==void 0?G:B.italics))}if(B.smallCaps!==void 0)this.push(new q0("w:smallCaps",B.smallCaps));else if(B.allCaps!==void 0)this.push(new q0("w:caps",B.allCaps));if(B.strike!==void 0)this.push(new q0("w:strike",B.strike));if(B.doubleStrike!==void 0)this.push(new q0("w:dstrike",B.doubleStrike));if(B.emboss!==void 0)this.push(new q0("w:emboss",B.emboss));if(B.imprint!==void 0)this.push(new q0("w:imprint",B.imprint));if(B.noProof!==void 0)this.push(new q0("w:noProof",B.noProof));if(B.snapToGrid!==void 0)this.push(new q0("w:snapToGrid",B.snapToGrid));if(B.vanish)this.push(new q0("w:vanish",B.vanish));if(B.color)this.push(new NG(B.color));if(B.characterSpacing)this.push(new jG(B.characterSpacing));if(B.scale!==void 0)this.push(new _2("w:w",B.scale));if(B.kern)this.push(new D1("w:kern",B.kern));if(B.position)this.push(new q2("w:position",B.position));if(B.size!==void 0)this.push(new D1("w:sz",B.size));let Y=B.sizeComplexScript===void 0||B.sizeComplexScript===!0?B.size:B.sizeComplexScript;if(Y)this.push(new D1("w:szCs",Y));if(B.highlight)this.push(new zG(B.highlight));let Q=B.highlightComplexScript===void 0||B.highlightComplexScript===!0?B.highlight:B.highlightComplexScript;if(Q)this.push(new wG(Q));if(B.underline)this.push(cB(B.underline.type,B.underline.color));if(B.effect)this.push(new q2("w:effect",B.effect));if(B.border)this.push(j0("w:bdr",B.border));if(B.shading)this.push(M1(B.shading));if(B.subScript)this.push(TG());if(B.superScript)this.push(DG());if(B.rightToLeft!==void 0)this.push(new q0("w:rtl",B.rightToLeft));if(B.emphasisMark)this.push(r8(B.emphasisMark.type));if(B.language)this.push(EG(B.language));if(B.specVanish)this.push(new q0("w:specVanish",B.vanish));if(B.math)this.push(new q0("w:oMath",B.math));if(B.revision)this.push(new lB(B.revision))}push(B){this.root.push(B)}},mB=class extends U2{constructor(B){super(B);if(B===null||B===void 0?void 0:B.insertion)this.push(new PG(B.insertion));if(B===null||B===void 0?void 0:B.deletion)this.push(new WG(B.deletion))}},lB=class extends t{constructor(B){super("w:rPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new U2(B))}},Z1=class extends t{constructor(B){super("w:t");if(typeof B==="string")this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B);else{var U;this.root.push(new _0({space:(U=B.space)!==null&&U!==void 0?U:x0.DEFAULT})),this.root.push(B.text)}}},F2={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},D0=class extends t{constructor(B){super("w:r");if(e(this,"properties",void 0),this.properties=new U2(B),this.root.push(this.properties),B.break)for(let U=0;U{U.exports=G;function G(Y,Q){if(!Y)throw Error(Q||"Assertion failed")}G.equal=function(Q,K,Z){if(Q!=K)throw Error(Z||"Assertion failed: "+Q+" != "+K)}}),G2=R0((B)=>{var U=R1();B.inherits=W2();function G(b,c){if((b.charCodeAt(c)&64512)!==55296)return!1;if(c<0||c+1>=b.length)return!1;return(b.charCodeAt(c+1)&64512)===56320}function Y(b,c){if(Array.isArray(b))return b.slice();if(!b)return[];var D=[];if(typeof b==="string"){if(!c){var m=0;for(var B0=0;B0>6|192,D[m++]=i&63|128;else if(G(b,B0))i=65536+((i&1023)<<10)+(b.charCodeAt(++B0)&1023),D[m++]=i>>18|240,D[m++]=i>>12&63|128,D[m++]=i>>6&63|128,D[m++]=i&63|128;else D[m++]=i>>12|224,D[m++]=i>>6&63|128,D[m++]=i&63|128}}else if(c==="hex"){if(b=b.replace(/[^a-z0-9]+/gi,""),b.length%2!==0)b="0"+b;for(B0=0;B0>>24|b>>>8&65280|b<<8&16711680|(b&255)<<24)>>>0}B.htonl=K;function Z(b,c){var D="";for(var m=0;m>>0}return i}B.join32=W;function I(b,c){var D=Array(b.length*4);for(var m=0,B0=0;m>>24,D[B0+1]=i>>>16&255,D[B0+2]=i>>>8&255,D[B0+3]=i&255;else D[B0+3]=i>>>24,D[B0+2]=i>>>16&255,D[B0+1]=i>>>8&255,D[B0]=i&255}return D}B.split32=I;function H(b,c){return b>>>c|b<<32-c}B.rotr32=H;function T(b,c){return b<>>32-c}B.rotl32=T;function A(b,c){return b+c>>>0}B.sum32=A;function P(b,c,D){return b+c+D>>>0}B.sum32_3=P;function j(b,c,D,m){return b+c+D+m>>>0}B.sum32_4=j;function E(b,c,D,m,B0){return b+c+D+m+B0>>>0}B.sum32_5=E;function C(b,c,D,m){var B0=b[c],i=m+b[c+1]>>>0;b[c]=(i>>0,b[c+1]=i}B.sum64=C;function N(b,c,D,m){return(c+m>>>0>>0}B.sum64_hi=N;function v(b,c,D,m){return c+m>>>0}B.sum64_lo=v;function S(b,c,D,m,B0,i,V0,s){var G0=0,r=c;return r=r+m>>>0,G0+=r>>0,G0+=r>>0,G0+=r>>0}B.sum64_4_hi=S;function F(b,c,D,m,B0,i,V0,s){return c+m+i+s>>>0}B.sum64_4_lo=F;function M(b,c,D,m,B0,i,V0,s,G0,r){var y=0,n=c;return n=n+m>>>0,y+=n>>0,y+=n>>0,y+=n>>0,y+=n>>0}B.sum64_5_hi=M;function $(b,c,D,m,B0,i,V0,s,G0,r){return c+m+i+s+r>>>0}B.sum64_5_lo=$;function x(b,c,D){return(c<<32-D|b>>>D)>>>0}B.rotr64_hi=x;function z(b,c,D){return(b<<32-D|c>>>D)>>>0}B.rotr64_lo=z;function a(b,c,D){return b>>>D}B.shr64_hi=a;function U0(b,c,D){return(b<<32-D|c>>>D)>>>0}B.shr64_lo=U0}),L1=R0((B)=>{var U=G2(),G=R1();function Y(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}B.BlockHash=Y,Y.prototype.update=function(K,Z){if(K=U.toArray(K,Z),!this.pending)this.pending=K;else this.pending=this.pending.concat(K);if(this.pendingTotal+=K.length,this.pending.length>=this._delta8){K=this.pending;var J=K.length%this._delta8;if(this.pending=K.slice(K.length-J,K.length),this.pending.length===0)this.pending=null;K=U.join32(K,0,K.length-J,this.endian);for(var q=0;q>>24&255,q[W++]=K>>>16&255,q[W++]=K>>>8&255,q[W++]=K&255}else{q[W++]=K&255,q[W++]=K>>>8&255,q[W++]=K>>>16&255,q[W++]=K>>>24&255,q[W++]=0,q[W++]=0,q[W++]=0,q[W++]=0;for(I=8;I{var U=G2().rotr32;function G(I,H,T,A){if(I===0)return Y(H,T,A);if(I===1||I===3)return K(H,T,A);if(I===2)return Q(H,T,A)}B.ft_1=G;function Y(I,H,T){return I&H^~I&T}B.ch32=Y;function Q(I,H,T){return I&H^I&T^H&T}B.maj32=Q;function K(I,H,T){return I^H^T}B.p32=K;function Z(I){return U(I,2)^U(I,13)^U(I,22)}B.s0_256=Z;function J(I){return U(I,6)^U(I,11)^U(I,25)}B.s1_256=J;function q(I){return U(I,7)^U(I,18)^I>>>3}B.g0_256=q;function W(I){return U(I,17)^U(I,19)^I>>>10}B.g1_256=W}),SG=R0((B,U)=>{var G=G2(),Y=L1(),Q=pB(),K=G.rotl32,Z=G.sum32,J=G.sum32_5,q=Q.ft_1,W=Y.BlockHash,I=[1518500249,1859775393,2400959708,3395469782];function H(){if(!(this instanceof H))return new H;W.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}G.inherits(H,W),U.exports=H,H.blockSize=512,H.outSize=160,H.hmacStrength=80,H.padLength=64,H.prototype._update=function(A,P){var j=this.W;for(var E=0;E<16;E++)j[E]=A[P+E];for(;E{var G=G2(),Y=L1(),Q=pB(),K=R1(),Z=G.sum32,J=G.sum32_4,q=G.sum32_5,W=Q.ch32,I=Q.maj32,H=Q.s0_256,T=Q.s1_256,A=Q.g0_256,P=Q.g1_256,j=Y.BlockHash,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function C(){if(!(this instanceof C))return new C;j.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=Array(64)}G.inherits(C,j),U.exports=C,C.blockSize=512,C.outSize=256,C.hmacStrength=192,C.padLength=64,C.prototype._update=function(v,S){var F=this.W;for(var M=0;M<16;M++)F[M]=v[S+M];for(;M{var G=G2(),Y=rB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=512,Q.outSize=224,Q.hmacStrength=192,Q.padLength=64,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),iB=R0((B,U)=>{var G=G2(),Y=L1(),Q=R1(),K=G.rotr64_hi,Z=G.rotr64_lo,J=G.shr64_hi,q=G.shr64_lo,W=G.sum64,I=G.sum64_hi,H=G.sum64_lo,T=G.sum64_4_hi,A=G.sum64_4_lo,P=G.sum64_5_hi,j=G.sum64_5_lo,E=Y.BlockHash,C=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function N(){if(!(this instanceof N))return new N;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=C,this.W=Array(160)}G.inherits(N,E),U.exports=N,N.blockSize=1024,N.outSize=512,N.hmacStrength=192,N.padLength=128,N.prototype._prepareBlock=function(B0,i){var V0=this.W;for(var s=0;s<32;s++)V0[s]=B0[i+s];for(;s{var G=G2(),Y=iB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=1024,Q.outSize=384,Q.hmacStrength=192,Q.padLength=128,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),yG=R0((B)=>{B.sha1=SG(),B.sha224=bG(),B.sha256=rB(),B.sha384=vG(),B.sha512=iB()}),gG=R0((B)=>{var U=G2(),G=L1(),Y=U.rotl32,Q=U.sum32,K=U.sum32_3,Z=U.sum32_4,J=G.BlockHash;function q(){if(!(this instanceof q))return new q;J.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}U.inherits(q,J),B.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(C,N){var v=this.h[0],S=this.h[1],F=this.h[2],M=this.h[3],$=this.h[4],x=v,z=S,a=F,U0=M,b=$;for(var c=0;c<80;c++){var D=Q(Y(Z(v,W(c,S,F,M),C[T[c]+N],I(c)),P[c]),$);v=$,$=M,M=Y(F,10),F=S,S=D,D=Q(Y(Z(x,W(79-c,z,a,U0),C[A[c]+N],H(c)),j[c]),b),x=b,b=U0,U0=Y(a,10),a=z,z=D}D=K(this.h[1],F,U0),this.h[1]=K(this.h[2],M,b),this.h[2]=K(this.h[3],$,x),this.h[3]=K(this.h[4],v,z),this.h[4]=K(this.h[0],S,a),this.h[0]=D},q.prototype._digest=function(C){if(C==="hex")return U.toHex32(this.h,"little");else return U.split32(this.h,"little")};function W(E,C,N,v){if(E<=15)return C^N^v;else if(E<=31)return C&N|~C&v;else if(E<=47)return(C|~N)^v;else if(E<=63)return C&v|N&~v;else return C^(N|~v)}function I(E){if(E<=15)return 0;else if(E<=31)return 1518500249;else if(E<=47)return 1859775393;else if(E<=63)return 2400959708;else return 2840853838}function H(E){if(E<=15)return 1352829926;else if(E<=31)return 1548603684;else if(E<=47)return 1836072691;else if(E<=63)return 2053994217;else return 0}var T=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],A=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],P=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],j=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),fG=R0((B,U)=>{var G=G2(),Y=R1();function Q(K,Z,J){if(!(this instanceof Q))return new Q(K,Z,J);this.Hash=K,this.blockSize=K.blockSize/8,this.outSize=K.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(Z,J))}U.exports=Q,Q.prototype._init=function(Z){if(Z.length>this.blockSize)Z=new this.Hash().update(Z).digest();Y(Z.length<=this.blockSize);for(var J=Z.length;J{var U=B;U.utils=G2(),U.common=L1(),U.sha=yG(),U.ripemd=gG(),U.hmac=fG(),U.sha1=U.sha.sha1,U.sha256=U.sha.sha256,U.sha224=U.sha.sha224,U.sha384=U.sha.sha384,U.sha512=U.sha.sha512,U.ripemd160=U.ripemd.ripemd160})(),1),_G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",hG=(B,U=21)=>{return(G=U)=>{let Y="",Q=G|0;while(Q--)Y+=B[Math.random()*B.length|0];return Y}},uG=(B=21)=>{let U="",G=B|0;while(G--)U+=_G[Math.random()*64|0];return U},dG=(B)=>Math.floor(B/25.4*72*20),u0=(B)=>Math.floor(B*72*20),I1=(B=0)=>{let U=B;return()=>++U},nB=()=>I1(),sB=()=>I1(1),oB=()=>I1(),tB=()=>I1(),O1=()=>uG().toLowerCase(),P8=(B)=>xG.default.sha1().update(B instanceof ArrayBuffer?new Uint8Array(B):B).digest("hex"),s2=(B)=>hG("1234567890abcdef",B)(),eB=()=>`${s2(8)}-${s2(4)}-${s2(4)}-${s2(4)}-${s2(12)}`,U1=(B)=>new Uint8Array(new TextEncoder().encode(B)),B4={CHARACTER:"character",COLUMN:"column",INSIDE_MARGIN:"insideMargin",LEFT_MARGIN:"leftMargin",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",RIGHT_MARGIN:"rightMargin"},U4={BOTTOM_MARGIN:"bottomMargin",INSIDE_MARGIN:"insideMargin",LINE:"line",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",PARAGRAPH:"paragraph",TOP_MARGIN:"topMargin"},G4=()=>new M0({name:"wp:simplePos",attributes:{x:{key:"x",value:0},y:{key:"y",value:0}}}),Y4=(B)=>new M0({name:"wp:align",children:[B]}),Z4=(B)=>new M0({name:"wp:posOffset",children:[B.toString()]}),Q4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionH",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:B4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),J4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionV",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:U4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),cG=function(B){return B.CENTER="ctr",B.TOP="t",B.BOTTOM="b",B}({}),K4=(B={})=>{var U,G,Y,Q;return new M0({name:"wps:bodyPr",attributes:{lIns:{key:"lIns",value:(U=B.margins)===null||U===void 0?void 0:U.left},rIns:{key:"rIns",value:(G=B.margins)===null||G===void 0?void 0:G.right},tIns:{key:"tIns",value:(Y=B.margins)===null||Y===void 0?void 0:Y.top},bIns:{key:"bIns",value:(Q=B.margins)===null||Q===void 0?void 0:Q.bottom},anchor:{key:"anchor",value:B.verticalAnchor}},children:[...B.noAutoFit?[new q0("a:noAutofit",B.noAutoFit)]:[]]})},mG=(B={txBox:"1"})=>new M0({name:"wps:cNvSpPr",attributes:{txBox:{key:"txBox",value:B.txBox}}}),lG=(B)=>new M0({name:"w:txbxContent",children:[...B]}),aG=(B)=>new M0({name:"wps:txbx",children:[lG(B)]}),pG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{cx:"cx",cy:"cy"})}},rG=class extends t{constructor(B,U){super("a:ext");e(this,"attributes",void 0),this.attributes=new pG({cx:B,cy:U}),this.root.push(this.attributes)}},iG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{x:"x",y:"y"})}},nG=class extends t{constructor(B,U){super("a:off");this.root.push(new iG({x:B!==null&&B!==void 0?B:0,y:U!==null&&U!==void 0?U:0}))}},sG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{flipVertical:"flipV",flipHorizontal:"flipH",rotation:"rot"})}},V4=class extends t{constructor(B){var U,G,Y,Q;super("a:xfrm");e(this,"extents",void 0),e(this,"offset",void 0),this.root.push(new sG({flipVertical:(U=B.flip)===null||U===void 0?void 0:U.vertical,flipHorizontal:(G=B.flip)===null||G===void 0?void 0:G.horizontal,rotation:B.rotation})),this.offset=new nG((Y=B.offset)===null||Y===void 0||(Y=Y.emus)===null||Y===void 0?void 0:Y.x,(Q=B.offset)===null||Q===void 0||(Q=Q.emus)===null||Q===void 0?void 0:Q.y),this.extents=new rG(B.emus.x,B.emus.y),this.root.push(this.offset),this.root.push(this.extents)}},X4=()=>new M0({name:"a:noFill"}),oG=(B)=>new M0({name:"a:srgbClr",attributes:{value:{key:"val",value:B.value}}}),tG=(B)=>new M0({name:"a:schemeClr",attributes:{value:{key:"val",value:B.value}}}),A8=(B)=>new M0({name:"a:solidFill",children:[B.type==="rgb"?oG(B):tG(B)]}),eG=(B)=>new M0({name:"a:ln",attributes:{width:{key:"w",value:B.width},cap:{key:"cap",value:B.cap},compoundLine:{key:"cmpd",value:B.compoundLine},align:{key:"algn",value:B.align}},children:[B.type==="noFill"?X4():B.solidFillType==="rgb"?A8({type:"rgb",value:B.value}):A8({type:"scheme",value:B.value})]}),BY=class extends t{constructor(){super("a:avLst")}},UY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{prst:"prst"})}},GY=class extends t{constructor(){super("a:prstGeom");this.root.push(new UY({prst:"rect"})),this.root.push(new BY)}},YY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{bwMode:"bwMode"})}},q4=class extends t{constructor({element:B,outline:U,solidFill:G,transform:Y}){super(`${B}:spPr`);if(e(this,"form",void 0),this.root.push(new YY({bwMode:"auto"})),this.form=new V4(Y),this.root.push(this.form),this.root.push(new GY),U)this.root.push(X4()),this.root.push(eG(U));if(G)this.root.push(A8(G))}},l6=(B)=>new M0({name:"wps:wsp",children:[mG(B.nonVisualProperties),new q4({element:"wps",transform:B.transformation,outline:B.outline,solidFill:B.solidFill}),aG(B.children),K4(B.bodyProperties)]}),K8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{uri:"uri"})}},ZY=(B)=>new M0({name:"asvg:svgBlip",attributes:{asvg:{key:"xmlns:asvg",value:"http://schemas.microsoft.com/office/drawing/2016/SVG/main"},embed:{key:"r:embed",value:`rId{${B.fileName}}`}}}),QY=(B)=>new M0({name:"a:ext",attributes:{uri:{key:"uri",value:"{96DAC541-7B7A-43D3-8B79-37D633B846F1}"}},children:[ZY(B)]}),JY=(B)=>new M0({name:"a:extLst",children:[QY(B)]}),KY=(B)=>new M0({name:"a:blip",attributes:{embed:{key:"r:embed",value:`rId{${B.type==="svg"?B.fallback.fileName:B.fileName}}`},cstate:{key:"cstate",value:"none"}},children:B.type==="svg"?[JY(B)]:[]}),VY=class extends t{constructor(){super("a:srcRect")}},XY=class extends t{constructor(){super("a:fillRect")}},qY=class extends t{constructor(){super("a:stretch");this.root.push(new XY)}},MY=class extends t{constructor(B){super("pic:blipFill");this.root.push(KY(B)),this.root.push(new VY),this.root.push(new qY)}},RY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{noChangeAspect:"noChangeAspect",noChangeArrowheads:"noChangeArrowheads"})}},LY=class extends t{constructor(){super("a:picLocks");this.root.push(new RY({noChangeAspect:1,noChangeArrowheads:1}))}},IY=class extends t{constructor(){super("pic:cNvPicPr");this.root.push(new LY)}},M4=(B,U)=>new M0({name:"a:hlinkClick",attributes:L0(L0({},U?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${B}`}})}),OY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"id",name:"name",descr:"descr"})}},HY=class extends t{constructor(){super("pic:cNvPr");this.root.push(new OY({id:0,name:"",descr:""}))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!1));break}return super.prepForXml(B)}},FY=class extends t{constructor(){super("pic:nvPicPr");this.root.push(new HY),this.root.push(new IY)}},WY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:pic"})}},a6=class extends t{constructor({mediaData:B,transform:U,outline:G}){super("pic:pic");this.root.push(new WY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/picture"})),this.root.push(new FY),this.root.push(new MY(B)),this.root.push(new q4({element:"pic",transform:U,outline:G}))}},PY=(B)=>new M0({name:"wpg:grpSpPr",children:[new V4(B)]}),AY=()=>new M0({name:"wpg:cNvGrpSpPr"}),jY=(B)=>new M0({name:"wpg:wgp",children:[AY(),PY(B.transformation),...B.children]}),NY=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphicData");if(B.type==="wps"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));let Q=l6(L0(L0({},B.data),{},{transformation:U,outline:G,solidFill:Y}));this.root.push(Q)}else if(B.type==="wpg"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"}));let Q=jY({children:B.children.map((K)=>{if(K.type==="wps")return l6(L0(L0({},K.data),{},{transformation:K.transformation,outline:K.outline,solidFill:K.solidFill}));else return new a6({mediaData:K,transform:K.transformation,outline:K.outline})}),transformation:U});this.root.push(Q)}else{this.root.push(new K8({uri:"http://schemas.openxmlformats.org/drawingml/2006/picture"}));let Q=new a6({mediaData:B,transform:U,outline:G});this.root.push(Q)}}},zY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{a:"xmlns:a"})}},R4=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphic");e(this,"data",void 0),this.root.push(new zY({a:"http://schemas.openxmlformats.org/drawingml/2006/main"})),this.data=new NY({mediaData:B,transform:U,outline:G,solidFill:Y}),this.root.push(this.data)}},e2={NONE:0,SQUARE:1,TIGHT:2,TOP_AND_BOTTOM:3},L4={BOTH_SIDES:"bothSides",LEFT:"left",RIGHT:"right",LARGEST:"largest"},j8=()=>new M0({name:"wp:wrapNone"}),I4=(B,U={top:0,bottom:0,left:0,right:0})=>new M0({name:"wp:wrapSquare",attributes:{wrapText:{key:"wrapText",value:B.side||L4.BOTH_SIDES},distT:{key:"distT",value:U.top},distB:{key:"distB",value:U.bottom},distL:{key:"distL",value:U.left},distR:{key:"distR",value:U.right}}}),O4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTight",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),H4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTopAndBottom",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),F4=class extends t{constructor({name:B,description:U,title:G,id:Y}={name:"",description:"",title:""}){super("wp:docPr");e(this,"docPropertiesUniqueNumericId",oB());let Q={id:{key:"id",value:Y!==null&&Y!==void 0?Y:this.docPropertiesUniqueNumericId()},name:{key:"name",value:B}};if(U!==null&&U!==void 0)Q.description={key:"descr",value:U};if(G!==null&&G!==void 0)Q.title={key:"title",value:G};this.root.push(new $8(Q))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!0));break}return super.prepForXml(B)}},W4=({top:B,right:U,bottom:G,left:Y})=>new M0({name:"wp:effectExtent",attributes:{top:{key:"t",value:B},right:{key:"r",value:U},bottom:{key:"b",value:G},left:{key:"l",value:Y}}}),P4=({x:B,y:U})=>new M0({name:"wp:extent",attributes:{x:{key:"cx",value:B},y:{key:"cy",value:U}}}),wY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:a",noChangeAspect:"noChangeAspect"})}},EY=class extends t{constructor(){super("a:graphicFrameLocks");this.root.push(new wY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/main",noChangeAspect:1}))}},A4=()=>new M0({name:"wp:cNvGraphicFramePr",children:[new EY]}),DY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{distT:"distT",distB:"distB",distL:"distL",distR:"distR",allowOverlap:"allowOverlap",behindDoc:"behindDoc",layoutInCell:"layoutInCell",locked:"locked",relativeHeight:"relativeHeight",simplePos:"simplePos"})}},TY=class extends t{constructor({mediaData:B,transform:U,drawingOptions:G}){super("wp:anchor");let Y=L0({allowOverlap:!0,behindDocument:!1,lockAnchor:!1,layoutInCell:!0,verticalPosition:{},horizontalPosition:{}},G.floating);if(this.root.push(new DY({distT:Y.margins?Y.margins.top||0:0,distB:Y.margins?Y.margins.bottom||0:0,distL:Y.margins?Y.margins.left||0:0,distR:Y.margins?Y.margins.right||0:0,simplePos:"0",allowOverlap:Y.allowOverlap===!0?"1":"0",behindDoc:Y.behindDocument===!0?"1":"0",locked:Y.lockAnchor===!0?"1":"0",layoutInCell:Y.layoutInCell===!0?"1":"0",relativeHeight:Y.zIndex?Y.zIndex:U.emus.y})),this.root.push(G4()),this.root.push(Q4(Y.horizontalPosition)),this.root.push(J4(Y.verticalPosition)),this.root.push(P4({x:U.emus.x,y:U.emus.y})),this.root.push(W4({top:0,right:0,bottom:0,left:0})),G.floating!==void 0&&G.floating.wrap!==void 0)switch(G.floating.wrap.type){case e2.SQUARE:this.root.push(I4(G.floating.wrap,G.floating.margins));break;case e2.TIGHT:this.root.push(O4(G.floating.margins));break;case e2.TOP_AND_BOTTOM:this.root.push(H4(G.floating.margins));break;case e2.NONE:default:this.root.push(j8())}else this.root.push(j8());this.root.push(new F4(G.docProperties)),this.root.push(A4()),this.root.push(new R4({mediaData:B,transform:U,outline:G.outline,solidFill:G.solidFill}))}},CY=({mediaData:B,transform:U,docProperties:G,outline:Y,solidFill:Q})=>{var K,Z,J,q;return new M0({name:"wp:inline",attributes:{distanceTop:{key:"distT",value:0},distanceBottom:{key:"distB",value:0},distanceLeft:{key:"distL",value:0},distanceRight:{key:"distR",value:0}},children:[P4({x:U.emus.x,y:U.emus.y}),W4(Y?{top:((K=Y.width)!==null&&K!==void 0?K:9525)*2,right:((Z=Y.width)!==null&&Z!==void 0?Z:9525)*2,bottom:((J=Y.width)!==null&&J!==void 0?J:9525)*2,left:((q=Y.width)!==null&&q!==void 0?q:9525)*2}:{top:0,right:0,bottom:0,left:0}),new F4(G),A4(),new R4({mediaData:B,transform:U,outline:Y,solidFill:Q})]})},m1=class extends t{constructor(B,U={}){super("w:drawing");if(!U.floating)this.root.push(CY({mediaData:B,transform:B.transformation,docProperties:U.docProperties,outline:U.outline,solidFill:U.solidFill}));else this.root.push(new TY({mediaData:B,transform:B.transformation,drawingOptions:U}))}},kY=(B)=>{let U=B.indexOf(";base64,"),G=U===-1?0:U+8;return new Uint8Array(atob(B.substring(G)).split("").map((Y)=>Y.charCodeAt(0)))},j4=(B)=>typeof B==="string"?kY(B):B,V8=(B,U)=>({data:j4(B.data),fileName:U,transformation:{pixels:{x:Math.round(B.transformation.width),y:Math.round(B.transformation.height)},emus:{x:Math.round(B.transformation.width*9525),y:Math.round(B.transformation.height*9525)},flip:B.transformation.flip,rotation:B.transformation.rotation?B.transformation.rotation*60000:void 0}}),$Y=class extends t{constructor(B){var U=(...Z)=>(super(...Z),e(this,"imageData",void 0),this);let G=`${P8(B.data)}.${B.type}`,Y=B.type==="svg"?L0(L0({type:B.type},V8(B,G)),{},{fallback:L0({type:B.fallback.type},V8(L0(L0({},B.fallback),{},{transformation:B.transformation}),`${P8(B.fallback.data)}.${B.fallback.type}`))}):L0({type:B.type},V8(B,G)),Q=new m1(Y,{floating:B.floating,docProperties:B.altText,outline:B.outline}),K=new D0({children:[Q]});if(B.insertion)U("w:ins"),this.root.push(new b0({id:B.insertion.id,author:B.insertion.author,date:B.insertion.date})),this.addChildElement(K);else if(B.deletion)U("w:del"),this.root.push(new b0({id:B.deletion.id,author:B.deletion.author,date:B.deletion.date})),this.addChildElement(K);else U("w:r"),this.root.push(new U2({})),this.root.push(Q);this.imageData=Y}prepForXml(B){if(B.file.Media.addImage(this.imageData.fileName,this.imageData),this.imageData.type==="svg")B.file.Media.addImage(this.imageData.fallback.fileName,this.imageData.fallback);return super.prepForXml(B)}},n8=(B)=>{var U,G,Y,Q,K,Z,J,q;return{offset:{pixels:{x:Math.round((U=(G=B.offset)===null||G===void 0?void 0:G.left)!==null&&U!==void 0?U:0),y:Math.round((Y=(Q=B.offset)===null||Q===void 0?void 0:Q.top)!==null&&Y!==void 0?Y:0)},emus:{x:Math.round(((K=(Z=B.offset)===null||Z===void 0?void 0:Z.left)!==null&&K!==void 0?K:0)*9525),y:Math.round(((J=(q=B.offset)===null||q===void 0?void 0:q.top)!==null&&J!==void 0?J:0)*9525)}},pixels:{x:Math.round(B.width),y:Math.round(B.height)},emus:{x:Math.round(B.width*9525),y:Math.round(B.height*9525)},flip:B.flip,rotation:B.rotation?B.rotation*60000:void 0}},SY=class extends D0{constructor(B){super({});e(this,"wpsShapeData",void 0),this.wpsShapeData={type:B.type,transformation:n8(B.transformation),data:L0({},B)};let U=new m1(this.wpsShapeData,{floating:B.floating,docProperties:B.altText,outline:B.outline,solidFill:B.solidFill});this.root.push(U)}},bY=class extends D0{constructor(B){super({});e(this,"wpgGroupData",void 0),e(this,"mediaDatas",void 0),this.wpgGroupData={type:B.type,transformation:n8(B.transformation),children:B.children};let U=new m1(this.wpgGroupData,{floating:B.floating,docProperties:B.altText});this.mediaDatas=B.children.filter((G)=>G.type!=="wps").map((G)=>G),this.root.push(U)}prepForXml(B){return this.mediaDatas.forEach((U)=>{if(B.file.Media.addImage(U.fileName,U),U.type==="svg")B.file.Media.addImage(U.fallback.fileName,U.fallback)}),super.prepForXml(B)}},vY=class extends t{constructor(B){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(`SEQ ${B}`)}},yY=class extends D0{constructor(B){super({});this.root.push(e0(!0)),this.root.push(new vY(B)),this.root.push(X2()),this.root.push(B2())}},gY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{instr:"w:instr"})}},s8=class extends t{constructor(B,U){super("w:fldSimple");if(this.root.push(new gY({instr:B})),U!==void 0)this.root.push(new Q1(U))}},fY=class extends s8{constructor(B){super(` MERGEFIELD ${B} `,`«${B}»`)}},xY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},N4={EXTERNAL:"External"},_Y=(B,U,G,Y)=>new M0({name:"Relationship",attributes:{id:{key:"Id",value:B},type:{key:"Type",value:U},target:{key:"Target",value:G},targetMode:{key:"TargetMode",value:Y}}}),A2=class extends t{constructor(){super("Relationships");this.root.push(new xY({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(B,U,G,Y){this.root.push(_Y(`rId${B}`,U,G,Y))}get RelationshipCount(){return this.root.length-1}},hY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},o8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},uY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}},dY=class extends t{constructor(B){super("w:commentRangeStart");this.root.push(new o8({id:B}))}},cY=class extends t{constructor(B){super("w:commentRangeEnd");this.root.push(new o8({id:B}))}},mY=class extends t{constructor(B){super("w:commentReference");this.root.push(new o8({id:B}))}},N8=class extends t{constructor({id:B,initials:U,author:G,date:Y=new Date,children:Q},K){super("w:comment");e(this,"paraId",void 0),this.paraId=K,this.root.push(new hY({id:B,initials:U,author:G,date:Y.toISOString()}));for(let Z of Q)this.root.push(Z)}prepForXml(B){let U=super.prepForXml(B);if(!U||!this.paraId)return U;let G=U["w:comment"];if(!Array.isArray(G))return U;for(let Y=G.length-1;Y>=0;Y--){let Q=G[Y];if(Q&&typeof Q==="object"&&"w:p"in Q){let K=Q["w:p"];if(Array.isArray(K))K.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return U}},z4=(B)=>(B+1).toString(16).toUpperCase().padStart(8,"0"),w4=class extends t{constructor({children:B}){super("w:comments");if(e(this,"relationships",void 0),e(this,"threadData",void 0),this.root.push(new uY({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"})),B.some((U)=>U.parentId!==void 0)){let U=new Map(B.map((G)=>[G.id,z4(G.id)]));for(let G of B)this.root.push(new N8(G,U.get(G.id)));this.threadData=B.map((G)=>({paraId:U.get(G.id),parentParaId:G.parentId!==void 0?U.get(G.parentId):void 0,done:G.resolved}))}else for(let U of B)this.root.push(new N8(U));this.relationships=new A2}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}},lY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},aY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},pY=class extends t{constructor(B){super("w15:commentEx");this.root.push(new aY({paraId:B.paraId,paraIdParent:B.parentParaId,done:B.done!==void 0?B.done?"1":"0":void 0}))}},E4=class extends t{constructor(B){super("w15:commentsEx");this.root.push(new lY({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let U of B)this.root.push(new pY(U))}},rY=class extends S0{constructor(){super("w:noBreakHyphen")}},iY=class extends S0{constructor(){super("w:softHyphen")}},nY=class extends S0{constructor(){super("w:dayShort")}},sY=class extends S0{constructor(){super("w:monthShort")}},oY=class extends S0{constructor(){super("w:yearShort")}},tY=class extends S0{constructor(){super("w:dayLong")}},eY=class extends S0{constructor(){super("w:monthLong")}},BZ=class extends S0{constructor(){super("w:yearLong")}},UZ=class extends S0{constructor(){super("w:annotationRef")}},GZ=class extends S0{constructor(){super("w:footnoteRef")}},D4=class extends S0{constructor(){super("w:endnoteRef")}},YZ=class extends S0{constructor(){super("w:separator")}},ZZ=class extends S0{constructor(){super("w:continuationSeparator")}},QZ=class extends S0{constructor(){super("w:pgNum")}},JZ=class extends S0{constructor(){super("w:cr")}},T4=class extends S0{constructor(){super("w:tab")}},KZ=class extends S0{constructor(){super("w:lastRenderedPageBreak")}},VZ={LEFT:"left",CENTER:"center",RIGHT:"right"},XZ={MARGIN:"margin",INDENT:"indent"},qZ={NONE:"none",DOT:"dot",HYPHEN:"hyphen",UNDERSCORE:"underscore",MIDDLE_DOT:"middleDot"},MZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{alignment:"w:alignment",relativeTo:"w:relativeTo",leader:"w:leader"})}},RZ=class extends t{constructor(B){super("w:ptab");this.root.push(new MZ({alignment:B.alignment,relativeTo:B.relativeTo,leader:B.leader}))}},C4={COLUMN:"column",PAGE:"page"},k4=class extends t{constructor(B){super("w:br");this.root.push(new C0({type:B}))}},LZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.PAGE))}},IZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.COLUMN))}},$4=class extends t{constructor(){super("w:pageBreakBefore")}},k2={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},S4=({after:B,before:U,line:G,lineRule:Y,beforeAutoSpacing:Q,afterAutoSpacing:K})=>new M0({name:"w:spacing",attributes:{after:{key:"w:after",value:B},before:{key:"w:before",value:U},line:{key:"w:line",value:G},lineRule:{key:"w:lineRule",value:Y},beforeAutoSpacing:{key:"w:beforeAutospacing",value:Q},afterAutoSpacing:{key:"w:afterAutospacing",value:K}}}),OZ={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},x2=(B)=>new M0({name:"w:pStyle",attributes:{val:{key:"w:val",value:B}}}),z8={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},HZ={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},FZ={MAX:9026},b4=({type:B,position:U,leader:G})=>new M0({name:"w:tab",attributes:{val:{key:"w:val",value:B},pos:{key:"w:pos",value:U},leader:{key:"w:leader",value:G}}}),v4=(B)=>new M0({name:"w:tabs",children:B.map((U)=>b4(U))}),C1=class extends t{constructor(B,U){super("w:numPr");this.root.push(new WZ(U)),this.root.push(new PZ(B))}},WZ=class extends t{constructor(B){super("w:ilvl");if(B>9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new C0({val:B}))}},PZ=class extends t{constructor(B){super("w:numId");this.root.push(new C0({val:typeof B==="string"?`{${B}}`:B}))}},H1=class extends t{constructor(...B){super(...B);e(this,"fileChild",Symbol())}},AZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},jZ={INTERNAL:"INTERNAL",EXTERNAL:"EXTERNAL"},m2=class extends t{constructor(B,U,G){super("w:hyperlink");e(this,"linkId",void 0),this.linkId=U;let Y=new AZ({history:1,anchor:G?G:void 0,id:!G?`rId${this.linkId}`:void 0});this.root.push(Y),B.forEach((Q)=>{this.root.push(Q)})}},y4=class extends m2{constructor(B){super(B.children,O1(),B.anchor)}},t8=class extends t{constructor(B){super("w:externalHyperlink");e(this,"options",void 0),this.options=B}},NZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",name:"w:name"})}},zZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},g4=class{constructor(B){e(this,"bookmarkUniqueNumericId",tB()),e(this,"start",void 0),e(this,"children",void 0),e(this,"end",void 0);let U=this.bookmarkUniqueNumericId();this.start=new f4(B.id,U),this.children=B.children,this.end=new x4(U)}},f4=class extends t{constructor(B,U){super("w:bookmarkStart");let G=new NZ({name:B,id:U});this.root.push(G)}},x4=class extends t{constructor(B){super("w:bookmarkEnd");let U=new zZ({id:B});this.root.push(U)}},wZ=function(B){return B.NONE="none",B.RELATIVE="relative",B.NO_CONTEXT="no_context",B.FULL_CONTEXT="full_context",B}({}),EZ={["relative"]:"\\r",["no_context"]:"\\n",["full_context"]:"\\w",["none"]:void 0},DZ=class extends s8{constructor(B,U,G={}){let{hyperlink:Y=!0,referenceFormat:Q="full_context"}=G,K=`${`REF ${B}`} ${[...Y?["\\h"]:[],...[EZ[Q]].filter((Z)=>!!Z)].join(" ")}`;super(K,U)}},_4=(B)=>new M0({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:B}}}),TZ=class extends t{constructor(B,U={}){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE}));let G=`PAGEREF ${B}`;if(U.hyperlink)G=`${G} \\h`;if(U.useRelativePosition)G=`${G} \\p`;this.root.push(G)}},CZ=class extends D0{constructor(B,U={}){super({children:[e0(!0),new TZ(B,U),B2()]})}},kZ={ANSI:"00",DEFAULT:"01",SYMBOL:"02",MAC:"4D",JIS:"80",HANGUL:"81",JOHAB:"82",GB_2312:"86",CHINESEBIG5:"88",GREEK:"A1",TURKISH:"A2",VIETNAMESE:"A3",HEBREW:"B1",ARABIC:"B2",BALTIC:"BA",RUSSIAN:"CC",THAI:"DE",EASTEUROPE:"EE",OEM:"FF"},E1=({id:B,fontKey:U,subsetted:G},Y)=>new M0({name:Y,attributes:L0({id:{key:"r:id",value:B}},U?{fontKey:{key:"w:fontKey",value:`{${U}}`}}:{}),children:[...G?[new q0("w:subsetted",G)]:[]]}),$Z=({name:B,altName:U,panose1:G,charset:Y,family:Q,notTrueType:K,pitch:Z,sig:J,embedRegular:q,embedBold:W,embedItalic:I,embedBoldItalic:H})=>new M0({name:"w:font",attributes:{name:{key:"w:name",value:B}},children:[...U?[f2("w:altName",U)]:[],...G?[f2("w:panose1",G)]:[],...Y?[f2("w:charset",Y)]:[],...Q?[f2("w:family",Q)]:[],...K?[new q0("w:notTrueType",K)]:[],...Z?[f2("w:pitch",Z)]:[],...J?[new M0({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:J.usb0},usb1:{key:"w:usb1",value:J.usb1},usb2:{key:"w:usb2",value:J.usb2},usb3:{key:"w:usb3",value:J.usb3},csb0:{key:"w:csb0",value:J.csb0},csb1:{key:"w:csb1",value:J.csb1}}})]:[],...q?[E1(q,"w:embedRegular")]:[],...W?[E1(W,"w:embedBold")]:[],...I?[E1(I,"w:embedItalic")]:[],...H?[E1(H,"w:embedBoldItalic")]:[]]}),SZ=({name:B,index:U,fontKey:G,characterSet:Y})=>$Z({name:B,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:Y,family:"auto",pitch:"variable",embedRegular:{fontKey:G,id:`rId${U}`}}),bZ=(B)=>new M0({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:B.map((U,G)=>SZ({name:U.name,index:G+1,fontKey:U.fontKey,characterSet:U.characterSet}))}),h4=class{constructor(B){e(this,"options",void 0),e(this,"fontTable",void 0),e(this,"relationships",void 0),e(this,"fontOptionsWithKey",[]),this.options=B,this.fontOptionsWithKey=B.map((U)=>L0(L0({},U),{},{fontKey:eB()})),this.fontTable=bZ(this.fontOptionsWithKey),this.relationships=new A2;for(let U=0;Unew M0({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),yZ={NONE:"none",DROP:"drop",MARGIN:"margin"},gZ={MARGIN:"margin",PAGE:"page",TEXT:"text"},fZ={AROUND:"around",AUTO:"auto",NONE:"none",NOT_BESIDE:"notBeside",THROUGH:"through",TIGHT:"tight"},u4=(B)=>{var U,G;return new M0({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:B.anchorLock},dropCap:{key:"w:dropCap",value:B.dropCap},width:{key:"w:w",value:B.width},height:{key:"w:h",value:B.height},x:{key:"w:x",value:B.position?B.position.x:void 0},y:{key:"w:y",value:B.position?B.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:B.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:B.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(U=B.space)===null||U===void 0?void 0:U.horizontal},spaceVertical:{key:"w:vSpace",value:(G=B.space)===null||G===void 0?void 0:G.vertical},rule:{key:"w:hRule",value:B.rule},alignmentX:{key:"w:xAlign",value:B.alignment?B.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:B.alignment?B.alignment.y:void 0},lines:{key:"w:lines",value:B.lines},wrap:{key:"w:wrap",value:B.wrap}}})},M2=class extends R2{constructor(B){super("w:pPr",B===null||B===void 0?void 0:B.includeIfEmpty);if(e(this,"numberingReferences",[]),!B)return this;if(B.heading)this.push(x2(B.heading));if(B.bullet)this.push(x2("ListParagraph"));if(B.numbering){if(!B.style&&!B.heading){if(!B.numbering.custom)this.push(x2("ListParagraph"))}}if(B.style)this.push(x2(B.style));if(B.keepNext!==void 0)this.push(new q0("w:keepNext",B.keepNext));if(B.keepLines!==void 0)this.push(new q0("w:keepLines",B.keepLines));if(B.pageBreakBefore)this.push(new $4);if(B.frame)this.push(u4(B.frame));if(B.widowControl!==void 0)this.push(new q0("w:widowControl",B.widowControl));if(B.bullet)this.push(new C1(1,B.bullet.level));if(B.numbering){var U,G;this.numberingReferences.push({reference:B.numbering.reference,instance:(U=B.numbering.instance)!==null&&U!==void 0?U:0}),this.push(new C1(`${B.numbering.reference}-${(G=B.numbering.instance)!==null&&G!==void 0?G:0}`,B.numbering.level))}else if(B.numbering===!1)this.push(new C1(0,0));if(B.border)this.push(new xB(B.border));if(B.thematicBreak)this.push(new _B);if(B.shading)this.push(M1(B.shading));if(B.wordWrap)this.push(vZ());if(B.overflowPunctuation)this.push(new q0("w:overflowPunct",B.overflowPunctuation));let Y=[...B.rightTabStop!==void 0?[{type:z8.RIGHT,position:B.rightTabStop}]:[],...B.tabStops?B.tabStops:[],...B.leftTabStop!==void 0?[{type:z8.LEFT,position:B.leftTabStop}]:[]];if(Y.length>0)this.push(v4(Y));if(B.bidirectional!==void 0)this.push(new q0("w:bidi",B.bidirectional));if(B.spacing)this.push(S4(B.spacing));if(B.indent)this.push(hB(B.indent));if(B.contextualSpacing!==void 0)this.push(new q0("w:contextualSpacing",B.contextualSpacing));if(B.alignment)this.push(m8(B.alignment));if(B.outlineLevel!==void 0)this.push(_4(B.outlineLevel));if(B.suppressLineNumbers!==void 0)this.push(new q0("w:suppressLineNumbers",B.suppressLineNumbers));if(B.autoSpaceEastAsianText!==void 0)this.push(new q0("w:autoSpaceDN",B.autoSpaceEastAsianText));if(B.run)this.push(new mB(B.run));if(B.revision)this.push(new d4(B.revision))}push(B){this.root.push(B)}prepForXml(B){if(!(B.viewWrapper instanceof h4))for(let U of this.numberingReferences)B.file.Numbering.createConcreteNumberingInstance(U.reference,U.instance);return super.prepForXml(B)}},d4=class extends t{constructor(B){super("w:pPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new M2(L0(L0({},B),{},{includeIfEmpty:!0})))}},d0=class extends H1{constructor(B){super("w:p");if(e(this,"properties",void 0),typeof B==="string")return this.properties=new M2({}),this.root.push(this.properties),this.root.push(new Q1(B)),this;if(this.properties=new M2(B),this.root.push(this.properties),B.text)this.root.push(new Q1(B.text));if(B.children)for(let U of B.children){if(U instanceof g4){this.root.push(U.start);for(let G of U.children)this.root.push(G);this.root.push(U.end);continue}this.root.push(U)}}prepForXml(B){for(let U of this.root)if(U instanceof t8){let G=this.root.indexOf(U),Y=new m2(U.options.children,O1());B.viewWrapper.Relationships.addRelationship(Y.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",U.options.link,N4.EXTERNAL),this.root[G]=Y}return super.prepForXml(B)}addRunToFront(B){return this.root.splice(1,0,B),this}},xZ=class extends t{constructor(B){super("m:oMath");for(let U of B.children)this.root.push(U)}},_Z=class extends t{constructor(B){super("m:t");this.root.push(B)}},hZ=class extends t{constructor(B){super("m:r");this.root.push(new _Z(B))}},c4=class extends t{constructor(B){super("m:den");for(let U of B)this.root.push(U)}},m4=class extends t{constructor(B){super("m:num");for(let U of B)this.root.push(U)}},uZ=class extends t{constructor(B){super("m:f");this.root.push(new m4(B.numerator)),this.root.push(new c4(B.denominator))}},l4=({accent:B})=>new M0({name:"m:chr",attributes:{accent:{key:"m:val",value:B}}}),y0=({children:B})=>new M0({name:"m:e",children:B}),a4=({value:B})=>new M0({name:"m:limLoc",attributes:{value:{key:"m:val",value:B||"undOvr"}}}),dZ=()=>new M0({name:"m:subHide",attributes:{hide:{key:"m:val",value:1}}}),cZ=()=>new M0({name:"m:supHide",attributes:{hide:{key:"m:val",value:1}}}),e8=({accent:B,hasSuperScript:U,hasSubScript:G,limitLocationVal:Y})=>new M0({name:"m:naryPr",children:[...B?[l4({accent:B})]:[],a4({value:Y}),...!U?[cZ()]:[],...!G?[dZ()]:[]]}),l2=({children:B})=>new M0({name:"m:sub",children:B}),a2=({children:B})=>new M0({name:"m:sup",children:B}),mZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"∑",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},lZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript,limitLocationVal:"subSup"})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},B6=class extends t{constructor(B){super("m:lim");for(let U of B)this.root.push(U)}},aZ=class extends t{constructor(B){super("m:limUpp");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},pZ=class extends t{constructor(B){super("m:limLow");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},p4=()=>new M0({name:"m:sSupPr"}),rZ=class extends t{constructor(B){super("m:sSup");this.root.push(p4()),this.root.push(y0({children:B.children})),this.root.push(a2({children:B.superScript}))}},r4=()=>new M0({name:"m:sSubPr"}),iZ=class extends t{constructor(B){super("m:sSub");this.root.push(r4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript}))}},i4=()=>new M0({name:"m:sSubSupPr"}),nZ=class extends t{constructor(B){super("m:sSubSup");this.root.push(i4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript})),this.root.push(a2({children:B.superScript}))}},n4=()=>new M0({name:"m:sPrePr"}),sZ=class extends M0{constructor({children:B,subScript:U,superScript:G}){super({name:"m:sPre",children:[n4(),y0({children:B}),l2({children:U}),a2({children:G})]})}},oZ="",s4=class extends t{constructor(B){super("m:deg");if(B)for(let U of B)this.root.push(U)}},tZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{hide:"m:val"})}},eZ=class extends t{constructor(){super("m:degHide");this.root.push(new tZ({hide:1}))}},o4=class extends t{constructor(B){super("m:radPr");if(!B)this.root.push(new eZ)}},BQ=class extends t{constructor(B){super("m:rad");this.root.push(new o4(!!B.degree)),this.root.push(new s4(B.degree)),this.root.push(y0({children:B.children}))}},t4=class extends t{constructor(B){super("m:fName");for(let U of B)this.root.push(U)}},e4=class extends t{constructor(){super("m:funcPr")}},UQ=class extends t{constructor(B){super("m:func");this.root.push(new e4),this.root.push(new t4(B.name)),this.root.push(y0({children:B.children}))}},GQ=({character:B})=>new M0({name:"m:begChr",attributes:{character:{key:"m:val",value:B}}}),YQ=({character:B})=>new M0({name:"m:endChr",attributes:{character:{key:"m:val",value:B}}}),l1=({characters:B})=>new M0({name:"m:dPr",children:B?[GQ({character:B.beginningCharacter}),YQ({character:B.endingCharacter})]:[]}),ZQ=class extends t{constructor(B){super("m:d");this.root.push(l1({})),this.root.push(y0({children:B.children}))}},QQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"[",endingCharacter:"]"}})),this.root.push(y0({children:B.children}))}},JQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"{",endingCharacter:"}"}})),this.root.push(y0({children:B.children}))}},KQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"〈",endingCharacter:"〉"}})),this.root.push(y0({children:B.children}))}},VQ=(B)=>new M0({name:"w:gridCol",attributes:B!==void 0?{width:{key:"w:w",value:E0(B)}}:void 0}),B9=class extends t{constructor(B,U){super("w:tblGrid");for(let G of B)this.root.push(VQ(G));if(U)this.root.push(new qQ(U))}},XQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},qQ=class extends t{constructor(B){super("w:tblGridChange");this.root.push(new XQ({id:B.id})),this.root.push(new B9(B.columnWidths))}},MQ=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new Q1(B))}},RQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},LQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},IQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},p6=class extends t{constructor(B){super("w:delText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B)}},OQ=class extends t{constructor(B){super("w:del");e(this,"deletedTextRunWrapper",void 0),this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.deletedTextRunWrapper=new HQ(B),this.addChildElement(this.deletedTextRunWrapper)}},HQ=class extends t{constructor(B){super("w:r");if(this.root.push(new U2(B)),B.children)for(let U of B.children){if(typeof U==="string"){switch(U){case F2.CURRENT:this.root.push(e0()),this.root.push(new RQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES:this.root.push(e0()),this.root.push(new LQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES_IN_SECTION:this.root.push(e0()),this.root.push(new IQ),this.root.push(X2()),this.root.push(B2());break;default:this.root.push(new p6(U));break}continue}this.root.push(U)}else if(B.text)this.root.push(new p6(B.text));if(B.break)for(let U=0;Unew M0({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:B}}}),X9=({marginUnitType:B=v1.DXA,top:U,left:G,bottom:Y,right:Q})=>[{name:"w:top",size:U},{name:"w:left",size:G},{name:"w:bottom",size:Y},{name:"w:right",size:Q}].filter((K)=>K.size!==void 0).map(({name:K,size:Z})=>J1(K,{type:B,size:Z})),PQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tblCellMar",children:U})},AQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tcMar",children:U})},v1={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},J1=(B,{type:U=v1.AUTO,size:G})=>{let Y=G;if(U===v1.PERCENTAGE&&typeof G==="number")Y=`${G}%`;return new M0({name:B,attributes:{type:{key:"w:type",value:U},size:{key:"w:w",value:c8(Y)}}})},q9=class extends R2{constructor(B){super("w:tcBorders");if(B.top)this.root.push(j0("w:top",B.top));if(B.start)this.root.push(j0("w:start",B.start));if(B.left)this.root.push(j0("w:left",B.left));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.end)this.root.push(j0("w:end",B.end));if(B.right)this.root.push(j0("w:right",B.right))}},jQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},M9=class extends t{constructor(B){super("w:gridSpan");this.root.push(new jQ({val:T0(B)}))}},G6={CONTINUE:"continue",RESTART:"restart"},NQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},w8=class extends t{constructor(B){super("w:vMerge");this.root.push(new NQ({val:B}))}},zQ={BOTTOM_TO_TOP_LEFT_TO_RIGHT:"btLr",LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},wQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},R9=class extends t{constructor(B){super("w:textDirection");this.root.push(new wQ({val:B}))}},L9=class extends R2{constructor(B){super("w:tcPr",B.includeIfEmpty);if(B.width)this.root.push(J1("w:tcW",B.width));if(B.columnSpan)this.root.push(new M9(B.columnSpan));if(B.verticalMerge)this.root.push(new w8(B.verticalMerge));else if(B.rowSpan&&B.rowSpan>1)this.root.push(new w8(G6.RESTART));if(B.borders)this.root.push(new q9(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.margins){let U=AQ(B.margins);if(U)this.root.push(U)}if(B.textDirection)this.root.push(new R9(B.textDirection));if(B.verticalAlign)this.root.push(U6(B.verticalAlign));if(B.insertion)this.root.push(new Y9(B.insertion));if(B.deletion)this.root.push(new Z9(B.deletion));if(B.revision)this.root.push(new EQ(B.revision));if(B.cellMerge)this.root.push(new J9(B.cellMerge))}},EQ=class extends t{constructor(B){super("w:tcPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new L9(L0(L0({},B),{},{includeIfEmpty:!0})))}},Y6=class extends t{constructor(B){super("w:tc");e(this,"options",void 0),this.options=B,this.root.push(new L9(B));for(let U of B.children)this.root.push(U)}prepForXml(B){if(!(this.root[this.root.length-1]instanceof d0))this.root.push(new d0({}));return super.prepForXml(B)}},v2={style:c1.NONE,size:0,color:"auto"},y2={style:c1.SINGLE,size:4,color:"auto"},Z6=class extends t{constructor(B){var U,G,Y,Q,K,Z;super("w:tblBorders");this.root.push(j0("w:top",(U=B.top)!==null&&U!==void 0?U:y2)),this.root.push(j0("w:left",(G=B.left)!==null&&G!==void 0?G:y2)),this.root.push(j0("w:bottom",(Y=B.bottom)!==null&&Y!==void 0?Y:y2)),this.root.push(j0("w:right",(Q=B.right)!==null&&Q!==void 0?Q:y2)),this.root.push(j0("w:insideH",(K=B.insideHorizontal)!==null&&K!==void 0?K:y2)),this.root.push(j0("w:insideV",(Z=B.insideVertical)!==null&&Z!==void 0?Z:y2))}};e(Z6,"NONE",{top:v2,bottom:v2,left:v2,right:v2,insideHorizontal:v2,insideVertical:v2});var DQ={MARGIN:"margin",PAGE:"page",TEXT:"text"},TQ={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},CQ={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},kQ={NEVER:"never",OVERLAP:"overlap"},$Q=(B)=>new M0({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:B}}}),I9=({horizontalAnchor:B,verticalAnchor:U,absoluteHorizontalPosition:G,relativeHorizontalPosition:Y,absoluteVerticalPosition:Q,relativeVerticalPosition:K,bottomFromText:Z,topFromText:J,leftFromText:q,rightFromText:W,overlap:I})=>new M0({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:q===void 0?void 0:E0(q)},rightFromText:{key:"w:rightFromText",value:W===void 0?void 0:E0(W)},topFromText:{key:"w:topFromText",value:J===void 0?void 0:E0(J)},bottomFromText:{key:"w:bottomFromText",value:Z===void 0?void 0:E0(Z)},absoluteHorizontalPosition:{key:"w:tblpX",value:G===void 0?void 0:t0(G)},absoluteVerticalPosition:{key:"w:tblpY",value:Q===void 0?void 0:t0(Q)},horizontalAnchor:{key:"w:horzAnchor",value:B},relativeHorizontalPosition:{key:"w:tblpXSpec",value:Y},relativeVerticalPosition:{key:"w:tblpYSpec",value:K},verticalAnchor:{key:"w:vertAnchor",value:U}},children:I?[$Q(I)]:void 0}),SQ={AUTOFIT:"autofit",FIXED:"fixed"},O9=(B)=>new M0({name:"w:tblLayout",attributes:{type:{key:"w:type",value:B}}}),bQ={DXA:"dxa",NIL:"nil"},H9=({type:B=bQ.DXA,value:U})=>new M0({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:B},value:{key:"w:w",value:c8(U)}}}),F9=({firstRow:B,lastRow:U,firstColumn:G,lastColumn:Y,noHBand:Q,noVBand:K})=>new M0({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:B},lastRow:{key:"w:lastRow",value:U},firstColumn:{key:"w:firstColumn",value:G},lastColumn:{key:"w:lastColumn",value:Y},noHBand:{key:"w:noHBand",value:Q},noVBand:{key:"w:noVBand",value:K}}}),Q6=class extends R2{constructor(B){super("w:tblPr",B.includeIfEmpty);if(B.style)this.root.push(new q2("w:tblStyle",B.style));if(B.float)this.root.push(I9(B.float));if(B.visuallyRightToLeft!==void 0)this.root.push(new q0("w:bidiVisual",B.visuallyRightToLeft));if(B.width)this.root.push(J1("w:tblW",B.width));if(B.alignment)this.root.push(m8(B.alignment));if(B.indent)this.root.push(J1("w:tblInd",B.indent));if(B.borders)this.root.push(new Z6(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.layout)this.root.push(O9(B.layout));if(B.cellMargin){let U=PQ(B.cellMargin);if(U)this.root.push(U)}if(B.tableLook)this.root.push(F9(B.tableLook));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.revision)this.root.push(new vQ(B.revision))}},vQ=class extends t{constructor(B){super("w:tblPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new Q6(L0(L0({},B),{},{includeIfEmpty:!0})))}},yQ=class extends H1{constructor({rows:B,width:U,columnWidths:G=Array(Math.max(...B.map((j)=>j.CellCount))).fill(100),columnWidthsRevision:Y,margins:Q,indent:K,float:Z,layout:J,style:q,borders:W,alignment:I,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P}){super("w:tbl");this.root.push(new Q6({borders:W!==null&&W!==void 0?W:{},width:U!==null&&U!==void 0?U:{size:100},indent:K,float:Z,layout:J,style:q,alignment:I,cellMargin:Q,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P})),this.root.push(new B9(G,Y));for(let j of B)this.root.push(j);B.forEach((j,E)=>{if(E===B.length-1)return;let C=0;j.cells.forEach((N)=>{if(N.options.rowSpan&&N.options.rowSpan>1){let v=new Y6({rowSpan:N.options.rowSpan-1,columnSpan:N.options.columnSpan,borders:N.options.borders,children:[],verticalMerge:G6.CONTINUE});B[E+1].addCellToColumnIndex(v,C)}C+=N.options.columnSpan||1})})}},gQ={AUTO:"auto",ATLEAST:"atLeast",EXACT:"exact"},W9=(B,U)=>new M0({name:"w:trHeight",attributes:{value:{key:"w:val",value:E0(B)},rule:{key:"w:hRule",value:U}}}),J6=class extends R2{constructor(B){super("w:trPr",B.includeIfEmpty);if(B.cantSplit!==void 0)this.root.push(new q0("w:cantSplit",B.cantSplit));if(B.tableHeader!==void 0)this.root.push(new q0("w:tblHeader",B.tableHeader));if(B.height)this.root.push(W9(B.height.value,B.height.rule));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.insertion)this.root.push(new U9(B.insertion));if(B.deletion)this.root.push(new G9(B.deletion));if(B.revision)this.root.push(new P9(B.revision))}},P9=class extends t{constructor(B){super("w:trPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new J6(L0(L0({},B),{},{includeIfEmpty:!0})))}},fQ=class extends t{constructor(B){super("w:tr");e(this,"options",void 0),this.options=B,this.root.push(new J6(B));for(let U of B.children)this.root.push(U)}get CellCount(){return this.options.children.length}get cells(){return this.root.filter((B)=>B instanceof Y6)}addCellToIndex(B,U){this.root.splice(U+1,0,B)}addCellToColumnIndex(B,U){let G=this.columnIndexToRootIndex(U,!0);this.addCellToIndex(B,G-1)}rootIndexToColumnIndex(B){if(B<1||B>=this.root.length)throw Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let U=0;for(let G=1;G=this.root.length)if(U)return this.root.length;else throw Error(`cell 'columnIndex' should not great than ${G-1}`);let Q=this.root[Y];Y+=1,G+=Q&&Q.options.columnSpan||1}return Y-1}},xQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},_Q=class extends t{constructor(){super("Properties");this.root.push(new xQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},hQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},V2=(B,U)=>new M0({name:"Default",attributes:{contentType:{key:"ContentType",value:B},extension:{key:"Extension",value:U}}}),f0=(B,U)=>new M0({name:"Override",attributes:{contentType:{key:"ContentType",value:B},partName:{key:"PartName",value:U}}}),uQ=class extends t{constructor(){super("Types");this.root.push(new hQ({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(V2("image/png","png")),this.root.push(V2("image/jpeg","jpeg")),this.root.push(V2("image/jpeg","jpg")),this.root.push(V2("image/bmp","bmp")),this.root.push(V2("image/gif","gif")),this.root.push(V2("image/svg+xml","svg")),this.root.push(V2("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(V2("application/xml","xml")),this.root.push(V2("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(f0("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addCommentsExtended(){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addFooter(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${B}.xml`))}addHeader(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${B}.xml`))}},y1={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},F1=class extends H0{constructor(B,U){super(L0({Ignorable:U},Object.fromEntries(B.map((G)=>[G,y1[G]]))));e(this,"xmlKeys",L0({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(y1).map((G)=>[G,`xmlns:${G}`]))))}},dQ=class extends t{constructor(B){super("cp:coreProperties");if(this.root.push(new F1(["cp","dc","dcterms","dcmitype","xsi"])),B.title)this.root.push(new O2("dc:title",B.title));if(B.subject)this.root.push(new O2("dc:subject",B.subject));if(B.creator)this.root.push(new O2("dc:creator",B.creator));if(B.keywords)this.root.push(new O2("cp:keywords",B.keywords));if(B.description)this.root.push(new O2("dc:description",B.description));if(B.lastModifiedBy)this.root.push(new O2("cp:lastModifiedBy",B.lastModifiedBy));if(B.revision)this.root.push(new O2("cp:revision",String(B.revision)));this.root.push(new r6("dcterms:created")),this.root.push(new r6("dcterms:modified"))}},cQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"xsi:type"})}},r6=class extends t{constructor(B){super(B);this.root.push(new cQ({type:"dcterms:W3CDTF"})),this.root.push(fB(new Date))}},mQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},lQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},aQ=class extends t{constructor(B,U){super("property");this.root.push(new lQ({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:B.toString(),name:U.name})),this.root.push(new pQ(U.value))}},pQ=class extends t{constructor(B){super("vt:lpwstr");this.root.push(B)}},rQ=class extends t{constructor(B){super("Properties");e(this,"nextId",void 0),e(this,"properties",[]),this.root.push(new mQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let U of B)this.addCustomProperty(U)}prepForXml(B){return this.properties.forEach((U)=>this.root.push(U)),super.prepForXml(B)}addCustomProperty(B){this.properties.push(new aQ(this.nextId++,B))}},A9=({space:B,count:U,separate:G,equalWidth:Y,children:Q})=>new M0({name:"w:cols",attributes:{space:{key:"w:space",value:B===void 0?void 0:E0(B)},count:{key:"w:num",value:U===void 0?void 0:T0(U)},separate:{key:"w:sep",value:G},equalWidth:{key:"w:equalWidth",value:Y}},children:!Y&&Q?Q:void 0}),iQ={DEFAULT:"default",LINES:"lines",LINES_AND_CHARS:"linesAndChars",SNAP_TO_CHARS:"snapToChars"},j9=({type:B,linePitch:U,charSpace:G})=>new M0({name:"w:docGrid",attributes:{type:{key:"w:type",value:B},linePitch:{key:"w:linePitch",value:T0(U)},charSpace:{key:"w:charSpace",value:G?T0(G):void 0}}}),T2={DEFAULT:"default",FIRST:"first",EVEN:"even"},E8={HEADER:"w:headerReference",FOOTER:"w:footerReference"},k1=(B,U)=>new M0({name:B,attributes:{type:{key:"w:type",value:U.type||T2.DEFAULT},id:{key:"r:id",value:`rId${U.id}`}}}),nQ={NEW_PAGE:"newPage",NEW_SECTION:"newSection",CONTINUOUS:"continuous"},N9=({countBy:B,start:U,restart:G,distance:Y})=>new M0({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:B===void 0?void 0:T0(B)},start:{key:"w:start",value:U===void 0?void 0:T0(U)},restart:{key:"w:restart",value:G},distance:{key:"w:distance",value:Y===void 0?void 0:E0(Y)}}}),sQ={ALL_PAGES:"allPages",FIRST_PAGE:"firstPage",NOT_FIRST_PAGE:"notFirstPage"},oQ={PAGE:"page",TEXT:"text"},tQ={BACK:"back",FRONT:"front"},i6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},z9=class extends R2{constructor(B){super("w:pgBorders");if(!B)return this;if(B.pageBorders)this.root.push(new i6({display:B.pageBorders.display,offsetFrom:B.pageBorders.offsetFrom,zOrder:B.pageBorders.zOrder}));else this.root.push(new i6({}));if(B.pageBorderTop)this.root.push(j0("w:top",B.pageBorderTop));if(B.pageBorderLeft)this.root.push(j0("w:left",B.pageBorderLeft));if(B.pageBorderBottom)this.root.push(j0("w:bottom",B.pageBorderBottom));if(B.pageBorderRight)this.root.push(j0("w:right",B.pageBorderRight))}},w9=(B,U,G,Y,Q,K,Z)=>new M0({name:"w:pgMar",attributes:{top:{key:"w:top",value:t0(B)},right:{key:"w:right",value:E0(U)},bottom:{key:"w:bottom",value:t0(G)},left:{key:"w:left",value:E0(Y)},header:{key:"w:header",value:E0(Q)},footer:{key:"w:footer",value:E0(K)},gutter:{key:"w:gutter",value:E0(Z)}}}),eQ={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},E9=({start:B,formatType:U,separator:G})=>new M0({name:"w:pgNumType",attributes:{start:{key:"w:start",value:B===void 0?void 0:T0(B)},formatType:{key:"w:fmt",value:U},separator:{key:"w:chapSep",value:G}}}),g1={PORTRAIT:"portrait",LANDSCAPE:"landscape"},D9=({width:B,height:U,orientation:G,code:Y})=>{let Q=E0(B),K=E0(U);return new M0({name:"w:pgSz",attributes:{width:{key:"w:w",value:G===g1.LANDSCAPE?K:Q},height:{key:"w:h",value:G===g1.LANDSCAPE?Q:K},orientation:{key:"w:orient",value:G},code:{key:"w:code",value:Y}}})},BJ={LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},UJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},T9=class extends t{constructor(B){super("w:textDirection");this.root.push(new UJ({val:B}))}},GJ={NEXT_PAGE:"nextPage",NEXT_COLUMN:"nextColumn",CONTINUOUS:"continuous",EVEN_PAGE:"evenPage",ODD_PAGE:"oddPage"},C9=(B)=>new M0({name:"w:type",attributes:{val:{key:"w:val",value:B}}}),H2={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},$1={WIDTH:11906,HEIGHT:16838,ORIENTATION:g1.PORTRAIT},K6=class extends t{constructor({page:{size:{width:B=$1.WIDTH,height:U=$1.HEIGHT,orientation:G=$1.ORIENTATION,code:Y}={},margin:{top:Q=H2.TOP,right:K=H2.RIGHT,bottom:Z=H2.BOTTOM,left:J=H2.LEFT,header:q=H2.HEADER,footer:W=H2.FOOTER,gutter:I=H2.GUTTER}={},pageNumbers:H={},borders:T,textDirection:A}={},grid:{linePitch:P=360,charSpace:j,type:E}={},headerWrapperGroup:C={},footerWrapperGroup:N={},lineNumbers:v,titlePage:S,verticalAlign:F,column:M,type:$,revision:x}={}){super("w:sectPr");if(this.addHeaderFooterGroup(E8.HEADER,C),this.addHeaderFooterGroup(E8.FOOTER,N),$)this.root.push(C9($));if(this.root.push(D9({width:B,height:U,orientation:G,code:Y})),this.root.push(w9(Q,K,Z,J,q,W,I)),T)this.root.push(new z9(T));if(v)this.root.push(N9(v));if(this.root.push(E9(H)),M)this.root.push(A9(M));if(F)this.root.push(U6(F));if(S!==void 0)this.root.push(new q0("w:titlePg",S));if(A)this.root.push(new T9(A));if(x)this.root.push(new k9(x));this.root.push(j9({linePitch:P,charSpace:j,type:E}))}addHeaderFooterGroup(B,U){if(U.default)this.root.push(k1(B,{type:T2.DEFAULT,id:U.default.View.ReferenceId}));if(U.first)this.root.push(k1(B,{type:T2.FIRST,id:U.first.View.ReferenceId}));if(U.even)this.root.push(k1(B,{type:T2.EVEN,id:U.even.View.ReferenceId}))}},k9=class extends t{constructor(B){super("w:sectPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new K6(B))}},YJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{width:"w:w",space:"w:space"})}},ZJ=class extends t{constructor(B){super("w:col");this.root.push(new YJ({width:E0(B.width),space:B.space===void 0?void 0:E0(B.space)}))}},$9=class extends t{constructor(){super("w:body");e(this,"sections",[])}addSection(B){let U=this.sections.pop();this.root.push(this.createSectionParagraph(U)),this.sections.push(new K6(B))}prepForXml(B){if(this.sections.length===1)this.root.splice(0,1),this.root.push(this.sections.pop());return super.prepForXml(B)}push(B){this.root.push(B)}createSectionParagraph(B){let U=new d0({}),G=new M2({});return G.push(B),U.addChildElement(G),U}},S9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}},b9=class extends t{constructor(B){super("w:background");this.root.push(new S9({color:B.color===void 0?void 0:C2(B.color),themeColor:B.themeColor,themeShade:B.themeShade===void 0?void 0:W8(B.themeShade),themeTint:B.themeTint===void 0?void 0:W8(B.themeTint)}))}},QJ=class extends t{constructor(B){super("w:document");if(e(this,"body",void 0),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new $9,B.background)this.root.push(new b9(B.background));this.root.push(this.body)}add(B){return this.body.push(B),this}get Body(){return this.body}},JJ=class{constructor(B){e(this,"document",void 0),e(this,"relationships",void 0),this.document=new QJ(B),this.relationships=new A2}get View(){return this.document}get Relationships(){return this.relationships}},KJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},VJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",id:"w:id"})}},XJ=class extends D0{constructor(){super({style:"EndnoteReference"});this.root.push(new D4)}},n6={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},X8=class extends t{constructor(B){super("w:endnote");this.root.push(new VJ({type:B.type,id:B.id}));for(let U=0;U9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new zJ({ilvl:T0(B),tentative:1}))}},h9=class extends X6{},$J=class extends X6{},SJ=class extends t{constructor(B){super("w:multiLevelType");this.root.push(new C0({val:B}))}},bJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},D8=class extends t{constructor(B,U){super("w:abstractNum");e(this,"id",void 0),this.root.push(new bJ({abstractNumId:T0(B),restartNumberingAfterBreak:0})),this.root.push(new SJ("hybridMultilevel")),this.id=B;for(let G of U)this.root.push(new h9(G))}},vJ=class extends t{constructor(B){super("w:abstractNumId");this.root.push(new C0({val:B}))}},yJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{numId:"w:numId"})}},T8=class extends t{constructor(B){super("w:num");if(e(this,"numId",void 0),e(this,"reference",void 0),e(this,"instance",void 0),this.numId=B.numId,this.reference=B.reference,this.instance=B.instance,this.root.push(new yJ({numId:T0(B.numId)})),this.root.push(new vJ(T0(B.abstractNumId))),B.overrideLevels&&B.overrideLevels.length)for(let U of B.overrideLevels)this.root.push(new u9(U.num,U.start))}},gJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{ilvl:"w:ilvl"})}},u9=class extends t{constructor(B,U){super("w:lvlOverride");if(this.root.push(new gJ({ilvl:B})),U!==void 0)this.root.push(new xJ(U))}},fJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},xJ=class extends t{constructor(B){super("w:startOverride");this.root.push(new fJ({val:B}))}},d9=class extends t{constructor(B){super("w:numbering");e(this,"abstractNumberingMap",new Map),e(this,"concreteNumberingMap",new Map),e(this,"referenceConfigMap",new Map),e(this,"abstractNumUniqueNumericId",nB()),e(this,"concreteNumUniqueNumericId",sB()),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let U=new D8(this.abstractNumUniqueNumericId(),[{level:0,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(0.5),hanging:u0(0.25)}}}},{level:1,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(1),hanging:u0(0.25)}}}},{level:2,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:2160,hanging:u0(0.25)}}}},{level:3,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:2880,hanging:u0(0.25)}}}},{level:4,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:3600,hanging:u0(0.25)}}}},{level:5,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:4320,hanging:u0(0.25)}}}},{level:6,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5040,hanging:u0(0.25)}}}},{level:7,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5760,hanging:u0(0.25)}}}},{level:8,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:6480,hanging:u0(0.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new T8({numId:1,abstractNumId:U.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",U);for(let G of B.config)this.abstractNumberingMap.set(G.reference,new D8(this.abstractNumUniqueNumericId(),G.levels)),this.referenceConfigMap.set(G.reference,G.levels)}prepForXml(B){for(let U of this.abstractNumberingMap.values())this.root.push(U);for(let U of this.concreteNumberingMap.values())this.root.push(U);return super.prepForXml(B)}createConcreteNumberingInstance(B,U){let G=this.abstractNumberingMap.get(B);if(!G)return;let Y=`${B}-${U}`;if(this.concreteNumberingMap.has(Y))return;let Q=this.referenceConfigMap.get(B),K=Q&&Q[0].start,Z={numId:this.concreteNumUniqueNumericId(),abstractNumId:G.id,reference:B,instance:U,overrideLevels:[typeof K==="number"&&Number.isInteger(K)?{num:0,start:K}:{num:0,start:1}]};this.concreteNumberingMap.set(Y,new T8(Z))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},_J=(B)=>new M0({name:"w:compatSetting",attributes:{version:{key:"w:val",value:B},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),hJ=class extends t{constructor(B){super("w:compat");if(B.version)this.root.push(_J(B.version));if(B.useSingleBorderforContiguousCells)this.root.push(new q0("w:useSingleBorderforContiguousCells",B.useSingleBorderforContiguousCells));if(B.wordPerfectJustification)this.root.push(new q0("w:wpJustification",B.wordPerfectJustification));if(B.noTabStopForHangingIndent)this.root.push(new q0("w:noTabHangInd",B.noTabStopForHangingIndent));if(B.noLeading)this.root.push(new q0("w:noLeading",B.noLeading));if(B.spaceForUnderline)this.root.push(new q0("w:spaceForUL",B.spaceForUnderline));if(B.noColumnBalance)this.root.push(new q0("w:noColumnBalance",B.noColumnBalance));if(B.balanceSingleByteDoubleByteWidth)this.root.push(new q0("w:balanceSingleByteDoubleByteWidth",B.balanceSingleByteDoubleByteWidth));if(B.noExtraLineSpacing)this.root.push(new q0("w:noExtraLineSpacing",B.noExtraLineSpacing));if(B.doNotLeaveBackslashAlone)this.root.push(new q0("w:doNotLeaveBackslashAlone",B.doNotLeaveBackslashAlone));if(B.underlineTrailingSpaces)this.root.push(new q0("w:ulTrailSpace",B.underlineTrailingSpaces));if(B.doNotExpandShiftReturn)this.root.push(new q0("w:doNotExpandShiftReturn",B.doNotExpandShiftReturn));if(B.spacingInWholePoints)this.root.push(new q0("w:spacingInWholePoints",B.spacingInWholePoints));if(B.lineWrapLikeWord6)this.root.push(new q0("w:lineWrapLikeWord6",B.lineWrapLikeWord6));if(B.printBodyTextBeforeHeader)this.root.push(new q0("w:printBodyTextBeforeHeader",B.printBodyTextBeforeHeader));if(B.printColorsBlack)this.root.push(new q0("w:printColBlack",B.printColorsBlack));if(B.spaceWidth)this.root.push(new q0("w:wpSpaceWidth",B.spaceWidth));if(B.showBreaksInFrames)this.root.push(new q0("w:showBreaksInFrames",B.showBreaksInFrames));if(B.subFontBySize)this.root.push(new q0("w:subFontBySize",B.subFontBySize));if(B.suppressBottomSpacing)this.root.push(new q0("w:suppressBottomSpacing",B.suppressBottomSpacing));if(B.suppressTopSpacing)this.root.push(new q0("w:suppressTopSpacing",B.suppressTopSpacing));if(B.suppressSpacingAtTopOfPage)this.root.push(new q0("w:suppressSpacingAtTopOfPage",B.suppressSpacingAtTopOfPage));if(B.suppressTopSpacingWP)this.root.push(new q0("w:suppressTopSpacingWP",B.suppressTopSpacingWP));if(B.suppressSpBfAfterPgBrk)this.root.push(new q0("w:suppressSpBfAfterPgBrk",B.suppressSpBfAfterPgBrk));if(B.swapBordersFacingPages)this.root.push(new q0("w:swapBordersFacingPages",B.swapBordersFacingPages));if(B.convertMailMergeEsc)this.root.push(new q0("w:convMailMergeEsc",B.convertMailMergeEsc));if(B.truncateFontHeightsLikeWP6)this.root.push(new q0("w:truncateFontHeightsLikeWP6",B.truncateFontHeightsLikeWP6));if(B.macWordSmallCaps)this.root.push(new q0("w:mwSmallCaps",B.macWordSmallCaps));if(B.usePrinterMetrics)this.root.push(new q0("w:usePrinterMetrics",B.usePrinterMetrics));if(B.doNotSuppressParagraphBorders)this.root.push(new q0("w:doNotSuppressParagraphBorders",B.doNotSuppressParagraphBorders));if(B.wrapTrailSpaces)this.root.push(new q0("w:wrapTrailSpaces",B.wrapTrailSpaces));if(B.footnoteLayoutLikeWW8)this.root.push(new q0("w:footnoteLayoutLikeWW8",B.footnoteLayoutLikeWW8));if(B.shapeLayoutLikeWW8)this.root.push(new q0("w:shapeLayoutLikeWW8",B.shapeLayoutLikeWW8));if(B.alignTablesRowByRow)this.root.push(new q0("w:alignTablesRowByRow",B.alignTablesRowByRow));if(B.forgetLastTabAlignment)this.root.push(new q0("w:forgetLastTabAlignment",B.forgetLastTabAlignment));if(B.adjustLineHeightInTable)this.root.push(new q0("w:adjustLineHeightInTable",B.adjustLineHeightInTable));if(B.autoSpaceLikeWord95)this.root.push(new q0("w:autoSpaceLikeWord95",B.autoSpaceLikeWord95));if(B.noSpaceRaiseLower)this.root.push(new q0("w:noSpaceRaiseLower",B.noSpaceRaiseLower));if(B.doNotUseHTMLParagraphAutoSpacing)this.root.push(new q0("w:doNotUseHTMLParagraphAutoSpacing",B.doNotUseHTMLParagraphAutoSpacing));if(B.layoutRawTableWidth)this.root.push(new q0("w:layoutRawTableWidth",B.layoutRawTableWidth));if(B.layoutTableRowsApart)this.root.push(new q0("w:layoutTableRowsApart",B.layoutTableRowsApart));if(B.useWord97LineBreakRules)this.root.push(new q0("w:useWord97LineBreakRules",B.useWord97LineBreakRules));if(B.doNotBreakWrappedTables)this.root.push(new q0("w:doNotBreakWrappedTables",B.doNotBreakWrappedTables));if(B.doNotSnapToGridInCell)this.root.push(new q0("w:doNotSnapToGridInCell",B.doNotSnapToGridInCell));if(B.selectFieldWithFirstOrLastCharacter)this.root.push(new q0("w:selectFldWithFirstOrLastChar",B.selectFieldWithFirstOrLastCharacter));if(B.applyBreakingRules)this.root.push(new q0("w:applyBreakingRules",B.applyBreakingRules));if(B.doNotWrapTextWithPunctuation)this.root.push(new q0("w:doNotWrapTextWithPunct",B.doNotWrapTextWithPunctuation));if(B.doNotUseEastAsianBreakRules)this.root.push(new q0("w:doNotUseEastAsianBreakRules",B.doNotUseEastAsianBreakRules));if(B.useWord2002TableStyleRules)this.root.push(new q0("w:useWord2002TableStyleRules",B.useWord2002TableStyleRules));if(B.growAutofit)this.root.push(new q0("w:growAutofit",B.growAutofit));if(B.useFELayout)this.root.push(new q0("w:useFELayout",B.useFELayout));if(B.useNormalStyleForList)this.root.push(new q0("w:useNormalStyleForList",B.useNormalStyleForList));if(B.doNotUseIndentAsNumberingTabStop)this.root.push(new q0("w:doNotUseIndentAsNumberingTabStop",B.doNotUseIndentAsNumberingTabStop));if(B.useAlternateEastAsianLineBreakRules)this.root.push(new q0("w:useAltKinsokuLineBreakRules",B.useAlternateEastAsianLineBreakRules));if(B.allowSpaceOfSameStyleInTable)this.root.push(new q0("w:allowSpaceOfSameStyleInTable",B.allowSpaceOfSameStyleInTable));if(B.doNotSuppressIndentation)this.root.push(new q0("w:doNotSuppressIndentation",B.doNotSuppressIndentation));if(B.doNotAutofitConstrainedTables)this.root.push(new q0("w:doNotAutofitConstrainedTables",B.doNotAutofitConstrainedTables));if(B.autofitToFirstFixedWidthCell)this.root.push(new q0("w:autofitToFirstFixedWidthCell",B.autofitToFirstFixedWidthCell));if(B.underlineTabInNumberingList)this.root.push(new q0("w:underlineTabInNumList",B.underlineTabInNumberingList));if(B.displayHangulFixedWidth)this.root.push(new q0("w:displayHangulFixedWidth",B.displayHangulFixedWidth));if(B.splitPgBreakAndParaMark)this.root.push(new q0("w:splitPgBreakAndParaMark",B.splitPgBreakAndParaMark));if(B.doNotVerticallyAlignCellWithSp)this.root.push(new q0("w:doNotVertAlignCellWithSp",B.doNotVerticallyAlignCellWithSp));if(B.doNotBreakConstrainedForcedTable)this.root.push(new q0("w:doNotBreakConstrainedForcedTable",B.doNotBreakConstrainedForcedTable));if(B.ignoreVerticalAlignmentInTextboxes)this.root.push(new q0("w:doNotVertAlignInTxbx",B.ignoreVerticalAlignmentInTextboxes));if(B.useAnsiKerningPairs)this.root.push(new q0("w:useAnsiKerningPairs",B.useAnsiKerningPairs));if(B.cachedColumnBalance)this.root.push(new q0("w:cachedColBalance",B.cachedColumnBalance))}},uJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},dJ=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w:settings");if(this.root.push(new uJ({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new q0("w:displayBackgroundShape",!0)),B.trackRevisions!==void 0)this.root.push(new q0("w:trackRevisions",B.trackRevisions));if(B.evenAndOddHeaders!==void 0)this.root.push(new q0("w:evenAndOddHeaders",B.evenAndOddHeaders));if(B.updateFields!==void 0)this.root.push(new q0("w:updateFields",B.updateFields));if(B.defaultTabStop!==void 0)this.root.push(new _2("w:defaultTabStop",B.defaultTabStop));if(((U=B.hyphenation)===null||U===void 0?void 0:U.autoHyphenation)!==void 0)this.root.push(new q0("w:autoHyphenation",B.hyphenation.autoHyphenation));if(((G=B.hyphenation)===null||G===void 0?void 0:G.hyphenationZone)!==void 0)this.root.push(new _2("w:hyphenationZone",B.hyphenation.hyphenationZone));if(((Y=B.hyphenation)===null||Y===void 0?void 0:Y.consecutiveHyphenLimit)!==void 0)this.root.push(new _2("w:consecutiveHyphenLimit",B.hyphenation.consecutiveHyphenLimit));if(((Q=B.hyphenation)===null||Q===void 0?void 0:Q.doNotHyphenateCaps)!==void 0)this.root.push(new q0("w:doNotHyphenateCaps",B.hyphenation.doNotHyphenateCaps));this.root.push(new hJ(L0(L0({},(K=B.compatibility)!==null&&K!==void 0?K:{}),{},{version:(Z=(J=(q=B.compatibility)===null||q===void 0?void 0:q.version)!==null&&J!==void 0?J:B.compatibilityModeVersion)!==null&&Z!==void 0?Z:15})))}},c9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},cJ=class extends t{constructor(B){super("w:name");this.root.push(new c9({val:B}))}},mJ=class extends t{constructor(B){super("w:uiPriority");this.root.push(new c9({val:T0(B)}))}},lJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},m9=class extends t{constructor(B,U){super("w:style");if(this.root.push(new lJ(B)),U.name)this.root.push(new cJ(U.name));if(U.basedOn)this.root.push(new q2("w:basedOn",U.basedOn));if(U.next)this.root.push(new q2("w:next",U.next));if(U.link)this.root.push(new q2("w:link",U.link));if(U.uiPriority!==void 0)this.root.push(new mJ(U.uiPriority));if(U.semiHidden!==void 0)this.root.push(new q0("w:semiHidden",U.semiHidden));if(U.unhideWhenUsed!==void 0)this.root.push(new q0("w:unhideWhenUsed",U.unhideWhenUsed));if(U.quickFormat!==void 0)this.root.push(new q0("w:qFormat",U.quickFormat))}},p2=class extends m9{constructor(B){super({type:"paragraph",styleId:B.id},B);e(this,"paragraphProperties",void 0),e(this,"runProperties",void 0),this.paragraphProperties=new M2(B.paragraph),this.runProperties=new U2(B.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},$2=class extends m9{constructor(B){super({type:"character",styleId:B.id},L0({uiPriority:99,unhideWhenUsed:!0},B));e(this,"runProperties",void 0),this.runProperties=new U2(B.run),this.root.push(this.runProperties)}},j2=class extends p2{constructor(B){super(L0({basedOn:"Normal",next:"Normal",quickFormat:!0},B))}},aJ=class extends j2{constructor(B){super(L0({id:"Title",name:"Title"},B))}},pJ=class extends j2{constructor(B){super(L0({id:"Heading1",name:"Heading 1"},B))}},rJ=class extends j2{constructor(B){super(L0({id:"Heading2",name:"Heading 2"},B))}},iJ=class extends j2{constructor(B){super(L0({id:"Heading3",name:"Heading 3"},B))}},nJ=class extends j2{constructor(B){super(L0({id:"Heading4",name:"Heading 4"},B))}},sJ=class extends j2{constructor(B){super(L0({id:"Heading5",name:"Heading 5"},B))}},oJ=class extends j2{constructor(B){super(L0({id:"Heading6",name:"Heading 6"},B))}},tJ=class extends j2{constructor(B){super(L0({id:"Strong",name:"Strong"},B))}},eJ=class extends p2{constructor(B){super(L0({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},B))}},BK=class extends p2{constructor(B){super(L0({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},UK=class extends $2{constructor(B){super(L0({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},GK=class extends $2{constructor(B){super(L0({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},B))}},YK=class extends p2{constructor(B){super(L0({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},ZK=class extends $2{constructor(B){super(L0({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},QK=class extends $2{constructor(B){super(L0({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},B))}},JK=class extends $2{constructor(B){super(L0({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:i8.SINGLE}}},B))}},S1=class extends t{constructor(B){super("w:styles");if(B.initialStyles)this.root.push(B.initialStyles);if(B.importedStyles)for(let U of B.importedStyles)this.root.push(U);if(B.paragraphStyles)for(let U of B.paragraphStyles)this.root.push(new p2(U));if(B.characterStyles)for(let U of B.characterStyles)this.root.push(new $2(U))}},l9=class extends t{constructor(B){super("w:pPrDefault");this.root.push(new M2(B))}},a9=class extends t{constructor(B){super("w:rPrDefault");this.root.push(new U2(B))}},p9=class extends t{constructor(B){super("w:docDefaults");e(this,"runPropertiesDefaults",void 0),e(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new a9(B.run),this.paragraphPropertiesDefaults=new l9(B.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},KK=class{newInstance(B){let U=(0,h1.xml2js)(B,{compact:!1}),G;for(let Q of U.elements||[])if(Q.name==="w:styles")G=Q;if(G===void 0)throw Error("can not find styles element");let Y=G.elements||[];return{initialStyles:new $B(G.attributes),importedStyles:Y.map((Q)=>u1(Q))}}},M8=class{newInstance(B={}){var U;return{initialStyles:new F1(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new p9((U=B.document)!==null&&U!==void 0?U:{}),new aJ(L0({run:{size:56}},B.title)),new pJ(L0({run:{color:"2E74B5",size:32}},B.heading1)),new rJ(L0({run:{color:"2E74B5",size:26}},B.heading2)),new iJ(L0({run:{color:"1F4D78",size:24}},B.heading3)),new nJ(L0({run:{color:"2E74B5",italics:!0}},B.heading4)),new sJ(L0({run:{color:"2E74B5"}},B.heading5)),new oJ(L0({run:{color:"1F4D78"}},B.heading6)),new tJ(L0({run:{bold:!0}},B.strong)),new eJ(B.listParagraph||{}),new JK(B.hyperlink||{}),new UK(B.footnoteReference||{}),new BK(B.footnoteText||{}),new GK(B.footnoteTextChar||{}),new ZK(B.endnoteReference||{}),new YK(B.endnoteText||{}),new QK(B.endnoteTextChar||{})]}}},VK=class{constructor(B){var U,G,Y,Q,K,Z,J,q,W,I,H,T;if(e(this,"currentRelationshipId",1),e(this,"documentWrapper",void 0),e(this,"headers",[]),e(this,"footers",[]),e(this,"coreProperties",void 0),e(this,"numbering",void 0),e(this,"media",void 0),e(this,"fileRelationships",void 0),e(this,"footnotesWrapper",void 0),e(this,"endnotesWrapper",void 0),e(this,"settings",void 0),e(this,"contentTypes",void 0),e(this,"customProperties",void 0),e(this,"appProperties",void 0),e(this,"styles",void 0),e(this,"comments",void 0),e(this,"commentsExtended",void 0),e(this,"fontWrapper",void 0),this.coreProperties=new dQ(L0(L0({},B),{},{creator:(U=B.creator)!==null&&U!==void 0?U:"Un-named",revision:(G=B.revision)!==null&&G!==void 0?G:1,lastModifiedBy:(Y=B.lastModifiedBy)!==null&&Y!==void 0?Y:"Un-named"})),this.numbering=new d9(B.numbering?B.numbering:{config:[]}),this.comments=new w4((Q=B.comments)!==null&&Q!==void 0?Q:{children:[]}),this.comments.ThreadData)this.commentsExtended=new E4(this.comments.ThreadData);if(this.fileRelationships=new A2,this.customProperties=new rQ((K=B.customProperties)!==null&&K!==void 0?K:[]),this.appProperties=new _Q,this.footnotesWrapper=new PJ,this.endnotesWrapper=new RJ,this.contentTypes=new uQ,this.documentWrapper=new JJ({background:B.background}),this.settings=new dJ({compatibilityModeVersion:B.compatabilityModeVersion,compatibility:B.compatibility,evenAndOddHeaders:B.evenAndOddHeaderAndFooters?!0:!1,trackRevisions:(Z=B.features)===null||Z===void 0?void 0:Z.trackRevisions,updateFields:(J=B.features)===null||J===void 0?void 0:J.updateFields,defaultTabStop:B.defaultTabStop,hyphenation:{autoHyphenation:(q=B.hyphenation)===null||q===void 0?void 0:q.autoHyphenation,hyphenationZone:(W=B.hyphenation)===null||W===void 0?void 0:W.hyphenationZone,consecutiveHyphenLimit:(I=B.hyphenation)===null||I===void 0?void 0:I.consecutiveHyphenLimit,doNotHyphenateCaps:(H=B.hyphenation)===null||H===void 0?void 0:H.doNotHyphenateCaps}}),this.media=new V6,B.externalStyles!==void 0){var A;let P=new M8().newInstance((A=B.styles)===null||A===void 0?void 0:A.default),j=new KK().newInstance(B.externalStyles);this.styles=new S1(L0(L0({},j),{},{importedStyles:[...P.importedStyles,...j.importedStyles]}))}else if(B.styles){let P=new M8().newInstance(B.styles.default);this.styles=new S1(L0(L0({},P),B.styles))}else{let P=new M8;this.styles=new S1(P.newInstance())}this.addDefaultRelationships();for(let P of B.sections)this.addSection(P);if(B.footnotes)for(let P in B.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(P),B.footnotes[P].children);if(B.endnotes)for(let P in B.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(P),B.endnotes[P].children);this.fontWrapper=new h4((T=B.fonts)!==null&&T!==void 0?T:[])}addSection({headers:B={},footers:U={},children:G,properties:Y}){this.documentWrapper.View.Body.addSection(L0(L0({},Y),{},{headerWrapperGroup:{default:B.default?this.createHeader(B.default):void 0,first:B.first?this.createHeader(B.first):void 0,even:B.even?this.createHeader(B.even):void 0},footerWrapperGroup:{default:U.default?this.createFooter(U.default):void 0,first:U.first?this.createFooter(U.first):void 0,even:U.even?this.createFooter(U.even):void 0}}));for(let Q of G)this.documentWrapper.View.add(Q)}createHeader(B){let U=new _9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addHeaderToDocument(U),U}createFooter(B){let U=new f9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addFooterToDocument(U),U}addHeaderToDocument(B,U=T2.DEFAULT){this.headers.push({header:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(B,U=T2.DEFAULT){this.footers.push({footer:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){if(this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.commentsExtended)this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map((B)=>B.header)}get Footers(){return this.footers.map((B)=>B.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get FontTable(){return this.fontWrapper}},XK=class extends t{constructor(B={}){super("w:instrText");e(this,"properties",void 0),this.properties=B,this.root.push(new _0({space:x0.PRESERVE}));let U="TOC";if(this.properties.captionLabel)U=`${U} \\a "${this.properties.captionLabel}"`;if(this.properties.entriesFromBookmark)U=`${U} \\b "${this.properties.entriesFromBookmark}"`;if(this.properties.captionLabelIncludingNumbers)U=`${U} \\c "${this.properties.captionLabelIncludingNumbers}"`;if(this.properties.sequenceAndPageNumbersSeparator)U=`${U} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`;if(this.properties.tcFieldIdentifier)U=`${U} \\f "${this.properties.tcFieldIdentifier}"`;if(this.properties.hyperlink)U=`${U} \\h`;if(this.properties.tcFieldLevelRange)U=`${U} \\l "${this.properties.tcFieldLevelRange}"`;if(this.properties.pageNumbersEntryLevelsRange)U=`${U} \\n "${this.properties.pageNumbersEntryLevelsRange}"`;if(this.properties.headingStyleRange)U=`${U} \\o "${this.properties.headingStyleRange}"`;if(this.properties.entryAndPageNumberSeparator)U=`${U} \\p "${this.properties.entryAndPageNumberSeparator}"`;if(this.properties.seqFieldIdentifierForPrefix)U=`${U} \\s "${this.properties.seqFieldIdentifierForPrefix}"`;if(this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let G=this.properties.stylesWithLevels.map((Y)=>`${Y.styleName},${Y.level}`).join(",");U=`${U} \\t "${G}"`}if(this.properties.useAppliedParagraphOutlineLevel)U=`${U} \\u`;if(this.properties.preserveTabInEntries)U=`${U} \\w`;if(this.properties.preserveNewLineInEntries)U=`${U} \\x`;if(this.properties.hideTabAndPageNumbersInWebView)U=`${U} \\z`;this.root.push(U)}},r9=class extends t{constructor(){super("w:sdtContent")}},i9=class extends t{constructor(B){super("w:sdtPr");if(B)this.root.push(new q2("w:alias",B))}};function qK(B,U){if(B==null)return{};var G={};for(var Y in B)if({}.hasOwnProperty.call(B,Y)){if(U.includes(Y))continue;G[Y]=B[Y]}return G}function n9(B,U){if(B==null)return{};var G,Y,Q=qK(B,U);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(B);for(Y=0;Y0){let{stylesWithLevels:W}=K,I=Y.map((T,A)=>{var P,j;let E=this.buildCachedContentParagraphChild(T,K),C=(P=W===null||W===void 0||(j=W.find((v)=>v.level===T.level))===null||j===void 0?void 0:j.styleName)!==null&&P!==void 0?P:`TOC${T.level}`,N=A===0?[...J,E]:A===Y.length-1?[E,...q]:[E];return new d0({style:C,tabStops:this.getTabStopsForLevel(T.level),children:N})}),H=I;if(Y.length<=1)H=[...I,new d0({children:q})];for(let T of H)Z.addChildElement(T)}else{let W=new d0({children:J});Z.addChildElement(W);for(let H of G)Z.addChildElement(H);let I=new d0({children:q});Z.addChildElement(I)}this.root.push(Z)}getTabStopsForLevel(B,U=9025){return[{type:"clear",position:U+1-(B-1)*240},{type:"right",position:U,leader:"dot"}]}buildCachedContentRun(B,U){var G,Y;return new D0({style:(U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0?"IndexLink":void 0,children:[new Z1({text:B.title}),new T4,new Z1({text:(G=(Y=B.page)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:""})]})}buildCachedContentParagraphChild(B,U){let G=this.buildCachedContentRun(B,U);if((U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0)return new y4({anchor:B.href,children:[G]});return G}},LK=class{constructor(B,U){e(this,"styleName",void 0),e(this,"level",void 0),this.styleName=B,this.level=U}},IK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},OK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},s9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},o9=class extends t{constructor(B){super("w:footnoteReference");this.root.push(new s9({id:B}))}},HK=class extends D0{constructor(B){super({style:"FootnoteReference"});this.root.push(new o9(B))}},t9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},e9=class extends t{constructor(B){super("w:endnoteReference");this.root.push(new t9({id:B}))}},FK=class extends D0{constructor(B){super({style:"EndnoteReference"});this.root.push(new e9(B))}},o6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w14:val",symbolfont:"w14:font"})}},b1=class extends t{constructor(B,U,G){super(B);if(G)this.root.push(new o6({val:SB(U),symbolfont:G}));else this.root.push(new o6({val:U}))}},B5=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w14:checkbox");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let W=(B===null||B===void 0?void 0:B.checked)?"1":"0",I,H;this.root.push(new b1("w14:checked",W)),I=(B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.value)?B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value:this.DEFAULT_CHECKED_SYMBOL,H=(B===null||B===void 0||(Y=B.checkedState)===null||Y===void 0?void 0:Y.font)?B===null||B===void 0||(Q=B.checkedState)===null||Q===void 0?void 0:Q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:checkedState",I,H)),I=(B===null||B===void 0||(K=B.uncheckedState)===null||K===void 0?void 0:K.value)?B===null||B===void 0||(Z=B.uncheckedState)===null||Z===void 0?void 0:Z.value:this.DEFAULT_UNCHECKED_SYMBOL,H=(B===null||B===void 0||(J=B.uncheckedState)===null||J===void 0?void 0:J.font)?B===null||B===void 0||(q=B.uncheckedState)===null||q===void 0?void 0:q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:uncheckedState",I,H))}},WK=class extends t{constructor(B){var U,G,Y,Q;super("w:sdt");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let K=new i9(B===null||B===void 0?void 0:B.alias);K.addChildElement(new B5(B)),this.root.push(K);let Z=new r9,J=B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.font,q=B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value,W=B===null||B===void 0||(Y=B.uncheckedState)===null||Y===void 0?void 0:Y.font,I=B===null||B===void 0||(Q=B.uncheckedState)===null||Q===void 0?void 0:Q.value,H,T;if(B===null||B===void 0?void 0:B.checked)H=J?J:this.DEFAULT_FONT,T=q?q:this.DEFAULT_CHECKED_SYMBOL;else H=W?W:this.DEFAULT_FONT,T=I?I:this.DEFAULT_UNCHECKED_SYMBOL;let A=new aB({char:T,symbolfont:H});Z.addChildElement(A),this.root.push(Z)}},PK=({shape:B})=>new M0({name:"w:pict",children:[B]}),AK=({children:B=[]})=>new M0({name:"w:txbxContent",children:B}),jK=({style:B,children:U,inset:G})=>new M0({name:"v:textbox",attributes:{style:{key:"style",value:B},insetMode:{key:"insetmode",value:G?"custom":"auto"},inset:{key:"inset",value:G?`${G.left}, ${G.top}, ${G.right}, ${G.bottom}`:void 0}},children:[AK({children:U})]}),NK="#_x0000_t202",zK={flip:"flip",height:"height",left:"left",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",positionHorizontal:"mso-position-horizontal",positionHorizontalRelative:"mso-position-horizontal-relative",positionVertical:"mso-position-vertical",positionVerticalRelative:"mso-position-vertical-relative",wrapDistanceBottom:"mso-wrap-distance-bottom",wrapDistanceLeft:"mso-wrap-distance-left",wrapDistanceRight:"mso-wrap-distance-right",wrapDistanceTop:"mso-wrap-distance-top",wrapEdited:"mso-wrap-edited",wrapStyle:"mso-wrap-style",position:"position",rotation:"rotation",top:"top",visibility:"visibility",width:"width",zIndex:"z-index"},wK=(B)=>B?Object.entries(B).map(([U,G])=>`${zK[U]}:${G}`).join(";"):void 0,EK=({id:B,children:U,type:G=NK,style:Y})=>new M0({name:"v:shape",attributes:{id:{key:"id",value:B},type:{key:"type",value:G},style:{key:"style",value:wK(Y)}},children:[jK({style:"mso-fit-shape-to-text:t;",children:U})]}),DK=["style","children"],TK=class extends H1{constructor(B){let{style:U,children:G}=B,Y=n9(B,DK);super("w:p");this.root.push(new M2(Y)),this.root.push(PK({shape:EK({children:G,id:O1(),style:U})}))}},CK=R0((B,U)=>{d2(),P2();/*! + `)+" "+o[1];return o[0]+n+" "+y.join(", ")+" "+o[1]}B.types=rU();function E(y){return Array.isArray(y)}B.isArray=E;function C(y){return typeof y==="boolean"}B.isBoolean=C;function N(y){return y===null}B.isNull=N;function v(y){return y==null}B.isNullOrUndefined=v;function S(y){return typeof y==="number"}B.isNumber=S;function F(y){return typeof y==="string"}B.isString=F;function M(y){return typeof y==="symbol"}B.isSymbol=M;function $(y){return y===void 0}B.isUndefined=$;function x(y){return w(y)&&D(y)==="[object RegExp]"}B.isRegExp=x,B.types.isRegExp=x;function w(y){return typeof y==="object"&&y!==null}B.isObject=w;function a(y){return w(y)&&D(y)==="[object Date]"}B.isDate=a,B.types.isDate=a;function U0(y){return w(y)&&(D(y)==="[object Error]"||y instanceof Error)}B.isError=U0,B.types.isNativeError=U0;function b(y){return typeof y==="function"}B.isFunction=b;function c(y){return y===null||typeof y==="boolean"||typeof y==="number"||typeof y==="string"||typeof y==="symbol"||typeof y>"u"}B.isPrimitive=c,B.isBuffer=iU();function D(y){return Object.prototype.toString.call(y)}function m(y){return y<10?"0"+y.toString(10):y.toString(10)}var B0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function i(){var y=new Date,n=[m(y.getHours()),m(y.getMinutes()),m(y.getSeconds())].join(":");return[y.getDate(),B0[y.getMonth()],n].join(" ")}B.log=function(){console.log("%s - %s",i(),B.format.apply(B,arguments))},B.inherits=W2(),B._extend=function(y,n){if(!n||!w(n))return y;var o=Object.keys(n),Y0=o.length;while(Y0--)y[o[Y0]]=n[o[Y0]];return y};function V0(y,n){return Object.prototype.hasOwnProperty.call(y,n)}var s=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;B.promisify=function(n){if(typeof n!=="function")throw TypeError('The "original" argument must be of type Function');if(s&&n[s]){var o=n[s];if(typeof o!=="function")throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(o,s,{value:o,enumerable:!1,writable:!1,configurable:!0}),o}function o(){var Y0,O0,z=new Promise(function(h,Z0){Y0=h,O0=Z0}),L=[];for(var u=0;u{function G(P,j){var E=Object.keys(P);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(P);j&&(C=C.filter(function(N){return Object.getOwnPropertyDescriptor(P,N).enumerable})),E.push.apply(E,C)}return E}function Y(P){for(var j=1;j0)this.tail.next=C;else this.head=C;this.tail=C,++this.length}},{key:"unshift",value:function(E){var C={data:E,next:this.head};if(this.length===0)this.tail=C;this.head=C,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var E=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,E}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";var C=this.head,N=""+C.data;while(C=C.next)N+=E+C.data;return N}},{key:"concat",value:function(E){if(this.length===0)return I.alloc(0);var C=I.allocUnsafe(E>>>0),N=this.head,v=0;while(N)A(N.data,C,v),v+=N.data.length,N=N.next;return C}},{key:"consume",value:function(E,C){var N;if(ES.length?S.length:E;if(F===S.length)v+=S;else v+=S.slice(0,E);if(E-=F,E===0){if(F===S.length)if(++N,C.next)this.head=C.next;else this.head=this.tail=null;else this.head=C,C.data=S.slice(F);break}++N}return this.length-=N,v}},{key:"_getBuffer",value:function(E){var C=I.allocUnsafe(E),N=this.head,v=1;N.data.copy(C),E-=N.data.length;while(N=N.next){var S=N.data,F=E>S.length?S.length:E;if(S.copy(C,C.length-E,0,F),E-=F,E===0){if(F===S.length)if(++v,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=S.slice(F);break}++v}return this.length-=v,C}},{key:T,value:function(E,C){return H(this,Y(Y({},C),{},{depth:0,customInspect:!1}))}}]),P}()}),NB=R0((B,U)=>{P2();function G(q,W){var I=this,H=this._readableState&&this._readableState.destroyed,T=this._writableState&&this._writableState.destroyed;if(H||T){if(W)W(q);else if(q){if(!this._writableState)P0.nextTick(Z,this,q);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,P0.nextTick(Z,this,q)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(q||null,function(A){if(!W&&A)if(!I._writableState)P0.nextTick(Y,I,A);else if(!I._writableState.errorEmitted)I._writableState.errorEmitted=!0,P0.nextTick(Y,I,A);else P0.nextTick(Q,I);else if(W)P0.nextTick(Q,I),W(A);else P0.nextTick(Q,I)}),this}function Y(q,W){Z(q,W),Q(q)}function Q(q){if(q._writableState&&!q._writableState.emitClose)return;if(q._readableState&&!q._readableState.emitClose)return;q.emit("close")}function K(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function Z(q,W){q.emit("error",W)}function J(q,W){var{_readableState:I,_writableState:H}=q;if(I&&I.autoDestroy||H&&H.autoDestroy)q.destroy(W);else q.emit("error",W)}U.exports={destroy:G,undestroy:K,errorOrDestroy:J}}),c2=R0((B,U)=>{function G(W,I){W.prototype=Object.create(I.prototype),W.prototype.constructor=W,W.__proto__=I}var Y={};function Q(W,I,H){if(!H)H=Error;function T(P,j,E){if(typeof I==="string")return I;else return I(P,j,E)}var A=function(P){G(j,P);function j(E,C,N){return P.call(this,T(E,C,N))||this}return j}(H);A.prototype.name=H.name,A.prototype.code=W,Y[W]=A}function K(W,I){if(Array.isArray(W)){var H=W.length;if(W=W.map(function(T){return String(T)}),H>2)return"one of ".concat(I," ").concat(W.slice(0,H-1).join(", "),", or ")+W[H-1];else if(H===2)return"one of ".concat(I," ").concat(W[0]," or ").concat(W[1]);else return"of ".concat(I," ").concat(W[0])}else return"of ".concat(I," ").concat(String(W))}function Z(W,I,H){return W.substr(!H||H<0?0:+H,I.length)===I}function J(W,I,H){if(H===void 0||H>W.length)H=W.length;return W.substring(H-I.length,H)===I}function q(W,I,H){if(typeof H!=="number")H=0;if(H+I.length>W.length)return!1;else return W.indexOf(I,H)!==-1}Q("ERR_INVALID_OPT_VALUE",function(W,I){return'The value "'+I+'" is invalid for option "'+W+'"'},TypeError),Q("ERR_INVALID_ARG_TYPE",function(W,I,H){var T;if(typeof I==="string"&&Z(I,"not "))T="must not be",I=I.replace(/^not /,"");else T="must be";var A;if(J(W," argument"))A="The ".concat(W," ").concat(T," ").concat(K(I,"type"));else{var P=q(W,".")?"property":"argument";A='The "'.concat(W,'" ').concat(P," ").concat(T," ").concat(K(I,"type"))}return A+=". Received type ".concat(typeof H),A},TypeError),Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Q("ERR_METHOD_NOT_IMPLEMENTED",function(W){return"The "+W+" method is not implemented"}),Q("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Q("ERR_STREAM_DESTROYED",function(W){return"Cannot call "+W+" after a stream was destroyed"}),Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Q("ERR_STREAM_WRITE_AFTER_END","write after end"),Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Q("ERR_UNKNOWN_ENCODING",function(W){return"Unknown encoding: "+W},TypeError),Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),U.exports.codes=Y}),wB=R0((B,U)=>{var G=c2().codes.ERR_INVALID_OPT_VALUE;function Y(K,Z,J){return K.highWaterMark!=null?K.highWaterMark:Z?K[J]:null}function Q(K,Z,J,q){var W=Y(Z,q,J);if(W!=null){if(!(isFinite(W)&&Math.floor(W)===W)||W<0)throw new G(q?J:"highWaterMark",W);return Math.floor(W)}return K.objectMode?16:16384}U.exports={getHighWaterMark:Q}}),sU=R0((B,U)=>{d2(),U.exports=G;function G(Q,K){if(Y("noDeprecation"))return Q;var Z=!1;function J(){if(!Z){if(Y("throwDeprecation"))throw Error(K);else if(Y("traceDeprecation"))console.trace(K);else console.warn(K);Z=!0}return Q.apply(this,arguments)}return J}function Y(Q){try{if(!v0.localStorage)return!1}catch(Z){return!1}var K=v0.localStorage[Q];if(K==null)return!1;return String(K).toLowerCase()==="true"}}),zB=R0((B,U)=>{d2(),P2(),U.exports=w;function G(z){var L=this;this.next=null,this.entry=null,this.finish=function(){O0(L,z)}}var Y;w.WritableState=$;var Q={deprecate:sU()},K=qB(),Z=f1().Buffer,J=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function q(z){return Z.from(z)}function W(z){return Z.isBuffer(z)||z instanceof J}var I=NB(),H=wB().getHighWaterMark,T=c2().codes,A=T.ERR_INVALID_ARG_TYPE,P=T.ERR_METHOD_NOT_IMPLEMENTED,j=T.ERR_MULTIPLE_CALLBACK,E=T.ERR_STREAM_CANNOT_PIPE,C=T.ERR_STREAM_DESTROYED,N=T.ERR_STREAM_NULL_VALUES,v=T.ERR_STREAM_WRITE_AFTER_END,S=T.ERR_UNKNOWN_ENCODING,F=I.errorOrDestroy;W2()(w,K);function M(){}function $(z,L,u){if(Y=Y||u2(),z=z||{},typeof u!=="boolean")u=L instanceof Y;if(this.objectMode=!!z.objectMode,u)this.objectMode=this.objectMode||!!z.writableObjectMode;this.highWaterMark=H(this,z,"writableHighWaterMark",u),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=z.decodeStrings===!1;this.decodeStrings=!h,this.defaultEncoding=z.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z0){i(L,Z0)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=z.emitClose!==!1,this.autoDestroy=!!z.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new G(this)}$.prototype.getBuffer=function(){var L=this.bufferedRequest,u=[];while(L)u.push(L),L=L.next;return u},function(){try{Object.defineProperty($.prototype,"buffer",{get:Q.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(z){}}();var x;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")x=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(L){if(x.call(this,L))return!0;if(this!==w)return!1;return L&&L._writableState instanceof $}});else x=function(L){return L instanceof this};function w(z){Y=Y||u2();var L=this instanceof Y;if(!L&&!x.call(w,this))return new w(z);if(this._writableState=new $(z,this,L),this.writable=!0,z){if(typeof z.write==="function")this._write=z.write;if(typeof z.writev==="function")this._writev=z.writev;if(typeof z.destroy==="function")this._destroy=z.destroy;if(typeof z.final==="function")this._final=z.final}K.call(this)}w.prototype.pipe=function(){F(this,new E)};function a(z,L){var u=new v;F(z,u),P0.nextTick(L,u)}function U0(z,L,u,h){var Z0;if(u===null)Z0=new N;else if(typeof u!=="string"&&!L.objectMode)Z0=new A("chunk",["string","Buffer"],u);if(Z0)return F(z,Z0),P0.nextTick(h,Z0),!1;return!0}w.prototype.write=function(z,L,u){var h=this._writableState,Z0=!1,g=!h.objectMode&&W(z);if(g&&!Z.isBuffer(z))z=q(z);if(typeof L==="function")u=L,L=null;if(g)L="buffer";else if(!L)L=h.defaultEncoding;if(typeof u!=="function")u=M;if(h.ending)a(this,u);else if(g||U0(this,h,z,u))h.pendingcb++,Z0=c(this,h,g,z,L,u);return Z0},w.prototype.cork=function(){this._writableState.corked++},w.prototype.uncork=function(){var z=this._writableState;if(z.corked){if(z.corked--,!z.writing&&!z.corked&&!z.bufferProcessing&&z.bufferedRequest)G0(this,z)}},w.prototype.setDefaultEncoding=function(L){if(typeof L==="string")L=L.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((L+"").toLowerCase())>-1))throw new S(L);return this._writableState.defaultEncoding=L,this},Object.defineProperty(w.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function b(z,L,u){if(!z.objectMode&&z.decodeStrings!==!1&&typeof L==="string")L=Z.from(L,u);return L}Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function c(z,L,u,h,Z0,g){if(!u){var f=b(L,h,Z0);if(h!==f)u=!0,Z0="buffer",h=f}var R=L.objectMode?1:h.length;L.length+=R;var p=L.length{P2();var G=Object.keys||function(H){var T=[];for(var A in H)T.push(A);return T};U.exports=q;var Y=EB(),Q=zB();W2()(q,Y);var K=G(Q.prototype);for(var Z=0;Z{var G=f1(),Y=G.Buffer;function Q(Z,J){for(var q in Z)J[q]=Z[q]}if(Y.from&&Y.alloc&&Y.allocUnsafe&&Y.allocUnsafeSlow)U.exports=G;else Q(G,B),B.Buffer=K;function K(Z,J,q){return Y(Z,J,q)}Q(Y,K),K.from=function(Z,J,q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return Y(Z,J,q)},K.alloc=function(Z,J,q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var W=Y(Z);if(J!==void 0)if(typeof q==="string")W.fill(J,q);else W.fill(J);else W.fill(0);return W},K.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return Y(Z)},K.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),F8=R0((B)=>{var U=oU().Buffer,G=U.isEncoding||function(N){switch(N=""+N,N&&N.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Y(N){if(!N)return"utf8";var v;while(!0)switch(N){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return N;default:if(v)return;N=(""+N).toLowerCase(),v=!0}}function Q(N){var v=Y(N);if(typeof v!=="string"&&(U.isEncoding===G||!G(N)))throw Error("Unknown encoding: "+N);return v||N}B.StringDecoder=K;function K(N){this.encoding=Q(N);var v;switch(this.encoding){case"utf16le":this.text=T,this.end=A,v=4;break;case"utf8":this.fillLast=W,v=4;break;case"base64":this.text=P,this.end=j,v=3;break;default:this.write=E,this.end=C;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=U.allocUnsafe(v)}K.prototype.write=function(N){if(N.length===0)return"";var v,S;if(this.lastNeed){if(v=this.fillLast(N),v===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;if(S>5===6)return 2;else if(N>>4===14)return 3;else if(N>>3===30)return 4;return N>>6===2?-1:-2}function J(N,v,S){var F=v.length-1;if(F=0){if(M>0)N.lastNeed=M-1;return M}if(--F=0){if(M>0)N.lastNeed=M-2;return M}if(--F=0){if(M>0)if(M===2)M=0;else N.lastNeed=M-3;return M}return 0}function q(N,v,S){if((v[0]&192)!==128)return N.lastNeed=0,"�";if(N.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return N.lastNeed=1,"�";if(N.lastNeed>2&&v.length>2){if((v[2]&192)!==128)return N.lastNeed=2,"�"}}}function W(N){var v=this.lastTotal-this.lastNeed,S=q(this,N,v);if(S!==void 0)return S;if(this.lastNeed<=N.length)return N.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);N.copy(this.lastChar,v,0,N.length),this.lastNeed-=N.length}function I(N,v){var S=J(this,N,v);if(!this.lastNeed)return N.toString("utf8",v);this.lastTotal=S;var F=N.length-(S-this.lastNeed);return N.copy(this.lastChar,0,F),N.toString("utf8",v,F)}function H(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+"�";return v}function T(N,v){if((N.length-v)%2===0){var S=N.toString("utf16le",v);if(S){var F=S.charCodeAt(S.length-1);if(F>=55296&&F<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=N[N.length-1],N.toString("utf16le",v,N.length-1)}function A(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,S)}return v}function P(N,v){var S=(N.length-v)%3;if(S===0)return N.toString("base64",v);if(this.lastNeed=3-S,this.lastTotal=3,S===1)this.lastChar[0]=N[N.length-1];else this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1];return N.toString("base64",v,N.length-S)}function j(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+this.lastChar.toString("base64",0,3-this.lastNeed);return v}function E(N){return N.toString(this.encoding)}function C(N){return N&&N.length?this.write(N):""}}),f8=R0((B,U)=>{var G=c2().codes.ERR_STREAM_PREMATURE_CLOSE;function Y(J){var q=!1;return function(){if(q)return;q=!0;for(var W=arguments.length,I=Array(W),H=0;H{P2();var G;function Y(S,F,M){if(F=Q(F),F in S)Object.defineProperty(S,F,{value:M,enumerable:!0,configurable:!0,writable:!0});else S[F]=M;return S}function Q(S){var F=K(S,"string");return typeof F==="symbol"?F:String(F)}function K(S,F){if(typeof S!=="object"||S===null)return S;var M=S[Symbol.toPrimitive];if(M!==void 0){var $=M.call(S,F||"default");if(typeof $!=="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(F==="string"?String:Number)(S)}var Z=f8(),J=Symbol("lastResolve"),q=Symbol("lastReject"),W=Symbol("error"),I=Symbol("ended"),H=Symbol("lastPromise"),T=Symbol("handlePromise"),A=Symbol("stream");function P(S,F){return{value:S,done:F}}function j(S){var F=S[J];if(F!==null){var M=S[A].read();if(M!==null)S[H]=null,S[J]=null,S[q]=null,F(P(M,!1))}}function E(S){P0.nextTick(j,S)}function C(S,F){return function(M,$){S.then(function(){if(F[I]){M(P(void 0,!0));return}F[T](M,$)},$)}}var N=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((G={get stream(){return this[A]},next:function(){var F=this,M=this[W];if(M!==null)return Promise.reject(M);if(this[I])return Promise.resolve(P(void 0,!0));if(this[A].destroyed)return new Promise(function(a,U0){P0.nextTick(function(){if(F[W])U0(F[W]);else a(P(void 0,!0))})});var $=this[H],x;if($)x=new Promise(C($,this));else{var w=this[A].read();if(w!==null)return Promise.resolve(P(w,!1));x=new Promise(this[T])}return this[H]=x,x}},Y(G,Symbol.asyncIterator,function(){return this}),Y(G,"return",function(){var F=this;return new Promise(function(M,$){F[A].destroy(null,function(x){if(x){$(x);return}M(P(void 0,!0))})})}),G),N);U.exports=function(F){var M,$=Object.create(v,(M={},Y(M,A,{value:F,writable:!0}),Y(M,J,{value:null,writable:!0}),Y(M,q,{value:null,writable:!0}),Y(M,W,{value:null,writable:!0}),Y(M,I,{value:F._readableState.endEmitted,writable:!0}),Y(M,T,{value:function(w,a){var U0=$[A].read();if(U0)$[H]=null,$[J]=null,$[q]=null,w(P(U0,!1));else $[J]=w,$[q]=a},writable:!0}),M));return $[H]=null,Z(F,function(x){if(x&&x.code!=="ERR_STREAM_PREMATURE_CLOSE"){var w=$[q];if(w!==null)$[H]=null,$[J]=null,$[q]=null,w(x);$[W]=x;return}var a=$[J];if(a!==null)$[H]=null,$[J]=null,$[q]=null,a(P(void 0,!0));$[I]=!0}),F.on("readable",E.bind(null,$)),$}}),eU=R0((B,U)=>{U.exports=function(){throw Error("Readable.from is not available in the browser")}}),EB=R0((B,U)=>{d2(),P2(),U.exports=a;var G;a.ReadableState=w,S8().EventEmitter;var Y=function(f,R){return f.listeners(R).length},Q=qB(),K=f1().Buffer,Z=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function J(g){return K.from(g)}function q(g){return K.isBuffer(g)||g instanceof Z}var W=jB(),I;if(W&&W.debuglog)I=W.debuglog("stream");else I=function(){};var H=nU(),T=NB(),A=wB().getHighWaterMark,P=c2().codes,j=P.ERR_INVALID_ARG_TYPE,E=P.ERR_STREAM_PUSH_AFTER_EOF,C=P.ERR_METHOD_NOT_IMPLEMENTED,N=P.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,S,F;W2()(a,Q);var M=T.errorOrDestroy,$=["error","close","destroy","pause","resume"];function x(g,f,R){if(typeof g.prependListener==="function")return g.prependListener(f,R);if(!g._events||!g._events[f])g.on(f,R);else if(Array.isArray(g._events[f]))g._events[f].unshift(R);else g._events[f]=[R,g._events[f]]}function w(g,f,R){if(G=G||u2(),g=g||{},typeof R!=="boolean")R=f instanceof G;if(this.objectMode=!!g.objectMode,R)this.objectMode=this.objectMode||!!g.readableObjectMode;if(this.highWaterMark=A(this,g,"readableHighWaterMark",R),this.buffer=new H,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=g.emitClose!==!1,this.autoDestroy=!!g.autoDestroy,this.destroyed=!1,this.defaultEncoding=g.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,g.encoding){if(!v)v=F8().StringDecoder;this.decoder=new v(g.encoding),this.encoding=g.encoding}}function a(g){if(G=G||u2(),!(this instanceof a))return new a(g);var f=this instanceof G;if(this._readableState=new w(g,this,f),this.readable=!0,g){if(typeof g.read==="function")this._read=g.read;if(typeof g.destroy==="function")this._destroy=g.destroy}Q.call(this)}Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(f){if(!this._readableState)return;this._readableState.destroyed=f}}),a.prototype.destroy=T.destroy,a.prototype._undestroy=T.undestroy,a.prototype._destroy=function(g,f){f(g)},a.prototype.push=function(g,f){var R=this._readableState,p;if(!R.objectMode){if(typeof g==="string"){if(f=f||R.defaultEncoding,f!==R.encoding)g=K.from(g,f),f="";p=!0}}else p=!0;return U0(this,g,f,!1,p)},a.prototype.unshift=function(g){return U0(this,g,null,!0,!1)};function U0(g,f,R,p,k){I("readableAddChunk",f);var V=g._readableState;if(f===null)V.reading=!1,i(g,V);else{var X;if(!k)X=c(V,f);if(X)M(g,X);else if(V.objectMode||f&&f.length>0){if(typeof f!=="string"&&!V.objectMode&&Object.getPrototypeOf(f)!==K.prototype)f=J(f);if(p)if(V.endEmitted)M(g,new N);else b(g,V,f,!0);else if(V.ended)M(g,new E);else if(V.destroyed)return!1;else if(V.reading=!1,V.decoder&&!R)if(f=V.decoder.write(f),V.objectMode||f.length!==0)b(g,V,f,!1);else G0(g,V);else b(g,V,f,!1)}else if(!p)V.reading=!1,G0(g,V)}return!V.ended&&(V.length=D)g=D;else g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++;return g}function B0(g,f){if(g<=0||f.length===0&&f.ended)return 0;if(f.objectMode)return 1;if(g!==g)if(f.flowing&&f.length)return f.buffer.head.data.length;else return f.length;if(g>f.highWaterMark)f.highWaterMark=m(g);if(g<=f.length)return g;if(!f.ended)return f.needReadable=!0,0;return f.length}a.prototype.read=function(g){I("read",g),g=parseInt(g,10);var f=this._readableState,R=g;if(g!==0)f.emittedReadable=!1;if(g===0&&f.needReadable&&((f.highWaterMark!==0?f.length>=f.highWaterMark:f.length>0)||f.ended)){if(I("read: emitReadable",f.length,f.ended),f.length===0&&f.ended)u(this);else V0(this);return null}if(g=B0(g,f),g===0&&f.ended){if(f.length===0)u(this);return null}var p=f.needReadable;if(I("need readable",p),f.length===0||f.length-g0)k=L(g,f);else k=null;if(k===null)f.needReadable=f.length<=f.highWaterMark,g=0;else f.length-=g,f.awaitDrain=0;if(f.length===0){if(!f.ended)f.needReadable=!0;if(R!==g&&f.ended)u(this)}if(k!==null)this.emit("data",k);return k};function i(g,f){if(I("onEofChunk"),f.ended)return;if(f.decoder){var R=f.decoder.end();if(R&&R.length)f.buffer.push(R),f.length+=f.objectMode?1:R.length}if(f.ended=!0,f.sync)V0(g);else if(f.needReadable=!1,!f.emittedReadable)f.emittedReadable=!0,s(g)}function V0(g){var f=g._readableState;if(I("emitReadable",f.needReadable,f.emittedReadable),f.needReadable=!1,!f.emittedReadable)I("emitReadable",f.flowing),f.emittedReadable=!0,P0.nextTick(s,g)}function s(g){var f=g._readableState;if(I("emitReadable_",f.destroyed,f.length,f.ended),!f.destroyed&&(f.length||f.ended))g.emit("readable"),f.emittedReadable=!1;f.needReadable=!f.flowing&&!f.ended&&f.length<=f.highWaterMark,z(g)}function G0(g,f){if(!f.readingMore)f.readingMore=!0,P0.nextTick(r,g,f)}function r(g,f){while(!f.reading&&!f.ended&&(f.length1&&Z0(p.pipes,g)!==-1)&&!_)I("false write response, pause",p.awaitDrain),p.awaitDrain++;R.pause()}}function Q0(F0){if(I("onerror",F0),I0(),g.removeListener("error",Q0),Y(g,"error")===0)M(g,F0)}x(g,"error",Q0);function X0(){g.removeListener("finish",K0),I0()}g.once("close",X0);function K0(){I("onfinish"),g.removeListener("close",X0),I0()}g.once("finish",K0);function I0(){I("unpipe"),R.unpipe(g)}if(g.emit("pipe",R),!p.flowing)I("pipe resume"),R.resume();return g};function y(g){return function(){var R=g._readableState;if(I("pipeOnDrain",R.awaitDrain),R.awaitDrain)R.awaitDrain--;if(R.awaitDrain===0&&Y(g,"data"))R.flowing=!0,z(g)}}a.prototype.unpipe=function(g){var f=this._readableState,R={hasUnpiped:!1};if(f.pipesCount===0)return this;if(f.pipesCount===1){if(g&&g!==f.pipes)return this;if(!g)g=f.pipes;if(f.pipes=null,f.pipesCount=0,f.flowing=!1,g)g.emit("unpipe",this,R);return this}if(!g){var{pipes:p,pipesCount:k}=f;f.pipes=null,f.pipesCount=0,f.flowing=!1;for(var V=0;V0,p.flowing!==!1)this.resume()}else if(g==="readable"){if(!p.endEmitted&&!p.readableListening){if(p.readableListening=p.needReadable=!0,p.flowing=!1,p.emittedReadable=!1,I("on readable",p.length,p.reading),p.length)V0(this);else if(!p.reading)P0.nextTick(o,this)}}return R},a.prototype.addListener=a.prototype.on,a.prototype.removeListener=function(g,f){var R=Q.prototype.removeListener.call(this,g,f);if(g==="readable")P0.nextTick(n,this);return R},a.prototype.removeAllListeners=function(g){var f=Q.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)P0.nextTick(n,this);return f};function n(g){var f=g._readableState;if(f.readableListening=g.listenerCount("readable")>0,f.resumeScheduled&&!f.paused)f.flowing=!0;else if(g.listenerCount("data")>0)g.resume()}function o(g){I("readable nexttick read 0"),g.read(0)}a.prototype.resume=function(){var g=this._readableState;if(!g.flowing)I("resume"),g.flowing=!g.readableListening,Y0(this,g);return g.paused=!1,this};function Y0(g,f){if(!f.resumeScheduled)f.resumeScheduled=!0,P0.nextTick(O0,g,f)}function O0(g,f){if(I("resume",f.reading),!f.reading)g.read(0);if(f.resumeScheduled=!1,g.emit("resume"),z(g),f.flowing&&!f.reading)g.read(0)}a.prototype.pause=function(){if(I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)I("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function z(g){var f=g._readableState;I("flow",f.flowing);while(f.flowing&&g.read()!==null);}if(a.prototype.wrap=function(g){var f=this,R=this._readableState,p=!1;g.on("end",function(){if(I("wrapped end"),R.decoder&&!R.ended){var X=R.decoder.end();if(X&&X.length)f.push(X)}f.push(null)}),g.on("data",function(X){if(I("wrapped data"),R.decoder)X=R.decoder.write(X);if(R.objectMode&&(X===null||X===void 0))return;else if(!R.objectMode&&(!X||!X.length))return;if(!f.push(X))p=!0,g.pause()});for(var k in g)if(this[k]===void 0&&typeof g[k]==="function")this[k]=function(O){return function(){return g[O].apply(g,arguments)}}(k);for(var V=0;V<$.length;V++)g.on($[V],this.emit.bind(this,$[V]));return this._read=function(X){if(I("wrapped _read",X),p)p=!1,g.resume()},this},typeof Symbol==="function")a.prototype[Symbol.asyncIterator]=function(){if(S===void 0)S=tU();return S(this)};Object.defineProperty(a.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(a.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(a.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(f){if(this._readableState)this._readableState.flowing=f}}),a._fromList=L,Object.defineProperty(a.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function L(g,f){if(f.length===0)return null;var R;if(f.objectMode)R=f.buffer.shift();else if(!g||g>=f.length){if(f.decoder)R=f.buffer.join("");else if(f.buffer.length===1)R=f.buffer.first();else R=f.buffer.concat(f.length);f.buffer.clear()}else R=f.buffer.consume(g,f.decoder);return R}function u(g){var f=g._readableState;if(I("endReadable",f.endEmitted),!f.endEmitted)f.ended=!0,P0.nextTick(h,f,g)}function h(g,f){if(I("endReadableNT",g.endEmitted,g.length),!g.endEmitted&&g.length===0){if(g.endEmitted=!0,f.readable=!1,f.emit("end"),g.autoDestroy){var R=f._writableState;if(!R||R.autoDestroy&&R.finished)f.destroy()}}}if(typeof Symbol==="function")a.from=function(g,f){if(F===void 0)F=eU();return F(a,g,f)};function Z0(g,f){for(var R=0,p=g.length;R{U.exports=W;var G=c2().codes,Y=G.ERR_METHOD_NOT_IMPLEMENTED,Q=G.ERR_MULTIPLE_CALLBACK,K=G.ERR_TRANSFORM_ALREADY_TRANSFORMING,Z=G.ERR_TRANSFORM_WITH_LENGTH_0,J=u2();W2()(W,J);function q(T,A){var P=this._transformState;P.transforming=!1;var j=P.writecb;if(j===null)return this.emit("error",new Q);if(P.writechunk=null,P.writecb=null,A!=null)this.push(A);j(T);var E=this._readableState;if(E.reading=!1,E.needReadable||E.length{U.exports=Y;var G=DB();W2()(Y,G);function Y(Q){if(!(this instanceof Y))return new Y(Q);G.call(this,Q)}Y.prototype._transform=function(Q,K,Z){Z(null,Q)}}),UG=R0((B,U)=>{var G;function Y(P){var j=!1;return function(){if(j)return;j=!0,P.apply(void 0,arguments)}}var Q=c2().codes,K=Q.ERR_MISSING_ARGS,Z=Q.ERR_STREAM_DESTROYED;function J(P){if(P)throw P}function q(P){return P.setHeader&&typeof P.abort==="function"}function W(P,j,E,C){C=Y(C);var N=!1;if(P.on("close",function(){N=!0}),G===void 0)G=f8();G(P,{readable:j,writable:E},function(S){if(S)return C(S);N=!0,C()});var v=!1;return function(S){if(N)return;if(v)return;if(v=!0,q(P))return P.abort();if(typeof P.destroy==="function")return P.destroy();C(S||new Z("pipe"))}}function I(P){P()}function H(P,j){return P.pipe(j)}function T(P){if(!P.length)return J;if(typeof P[P.length-1]!=="function")return J;return P.pop()}function A(){for(var P=arguments.length,j=Array(P),E=0;E0,function($){if(!N)N=$;if($)v.forEach(I);if(M)return;v.forEach(I),C(N)})});return j.reduce(H)}U.exports=A}),x8=R0((B,U)=>{U.exports=Y;var G=S8().EventEmitter;W2()(Y,G),Y.Readable=EB(),Y.Writable=zB(),Y.Duplex=u2(),Y.Transform=DB(),Y.PassThrough=BG(),Y.finished=f8(),Y.pipeline=UG(),Y.Stream=Y;function Y(){G.call(this)}Y.prototype.pipe=function(Q,K){var Z=this;function J(P){if(Q.writable){if(Q.write(P)===!1&&Z.pause)Z.pause()}}Z.on("data",J);function q(){if(Z.readable&&Z.resume)Z.resume()}if(Q.on("drain",q),!Q._isStdio&&(!K||K.end!==!1))Z.on("end",I),Z.on("close",H);var W=!1;function I(){if(W)return;W=!0,Q.end()}function H(){if(W)return;if(W=!0,typeof Q.destroy==="function")Q.destroy()}function T(P){if(A(),G.listenerCount(this,"error")===0)throw P}Z.on("error",T),Q.on("error",T);function A(){Z.removeListener("data",J),Q.removeListener("drain",q),Z.removeListener("end",I),Z.removeListener("close",H),Z.removeListener("error",T),Q.removeListener("error",T),Z.removeListener("end",A),Z.removeListener("close",A),Q.removeListener("close",A)}return Z.on("end",A),Z.on("close",A),Q.on("close",A),Q.emit("pipe",Z),Q}}),GG=R0((B)=>{(function(U){U.parser=function(z,L){return new Y(z,L)},U.SAXParser=Y,U.SAXStream=I,U.createStream=W,U.MAX_BUFFER_LENGTH=65536;var G=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];U.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Y(z,L){if(!(this instanceof Y))return new Y(z,L);var u=this;if(K(u),u.q=u.c="",u.bufferCheckPosition=U.MAX_BUFFER_LENGTH,u.opt=L||{},u.opt.lowercase=u.opt.lowercase||u.opt.lowercasetags,u.looseCase=u.opt.lowercase?"toLowerCase":"toUpperCase",u.tags=[],u.closed=u.closedRoot=u.sawRoot=!1,u.tag=u.error=null,u.strict=!!z,u.noscript=!!(z||u.opt.noscript),u.state=w.BEGIN,u.strictEntities=u.opt.strictEntities,u.ENTITIES=u.strictEntities?Object.create(U.XML_ENTITIES):Object.create(U.ENTITIES),u.attribList=[],u.opt.xmlns)u.ns=Object.create(j);if(u.trackPosition=u.opt.position!==!1,u.trackPosition)u.position=u.line=u.column=0;U0(u,"onready")}if(!Object.create)Object.create=function(z){function L(){}return L.prototype=z,new L};if(!Object.keys)Object.keys=function(z){var L=[];for(var u in z)if(z.hasOwnProperty(u))L.push(u);return L};function Q(z){var L=Math.max(U.MAX_BUFFER_LENGTH,10),u=0;for(var h=0,Z0=G.length;hL)switch(G[h]){case"textNode":c(z);break;case"cdata":b(z,"oncdata",z.cdata),z.cdata="";break;case"script":b(z,"onscript",z.script),z.script="";break;default:m(z,"Max buffer length exceeded: "+G[h])}u=Math.max(u,g)}z.bufferCheckPosition=U.MAX_BUFFER_LENGTH-u+z.position}function K(z){for(var L=0,u=G.length;L"||S(z)}function $(z,L){return z.test(L)}function x(z,L){return!$(z,L)}var w=0;U.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},U.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},U.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(U.ENTITIES).forEach(function(z){var L=U.ENTITIES[z],u=typeof L==="number"?String.fromCharCode(L):L;U.ENTITIES[z]=u});for(var a in U.STATE)U.STATE[U.STATE[a]]=a;w=U.STATE;function U0(z,L,u){z[L]&&z[L](u)}function b(z,L,u){if(z.textNode)c(z);U0(z,L,u)}function c(z){if(z.textNode=D(z.opt,z.textNode),z.textNode)U0(z,"ontext",z.textNode);z.textNode=""}function D(z,L){if(z.trim)L=L.trim();if(z.normalize)L=L.replace(/\s+/g," ");return L}function m(z,L){if(c(z),z.trackPosition)L+=` +Line: `+z.line+` +Column: `+z.column+` +Char: `+z.c;return L=Error(L),z.error=L,U0(z,"onerror",L),z}function B0(z){if(z.sawRoot&&!z.closedRoot)i(z,"Unclosed root tag");if(z.state!==w.BEGIN&&z.state!==w.BEGIN_WHITESPACE&&z.state!==w.TEXT)m(z,"Unexpected end");return c(z),z.c="",z.closed=!0,U0(z,"onend"),Y.call(z,z.strict,z.opt),z}function i(z,L){if(typeof z!=="object"||!(z instanceof Y))throw Error("bad call to strictFail");if(z.strict)m(z,L)}function V0(z){if(!z.strict)z.tagName=z.tagName[z.looseCase]();var L=z.tags[z.tags.length-1]||z,u=z.tag={name:z.tagName,attributes:{}};if(z.opt.xmlns)u.ns=L.ns;z.attribList.length=0,b(z,"onopentagstart",u)}function s(z,L){var u=z.indexOf(":")<0?["",z]:z.split(":"),h=u[0],Z0=u[1];if(L&&z==="xmlns")h="xmlns",Z0="";return{prefix:h,local:Z0}}function G0(z){if(!z.strict)z.attribName=z.attribName[z.looseCase]();if(z.attribList.indexOf(z.attribName)!==-1||z.tag.attributes.hasOwnProperty(z.attribName)){z.attribName=z.attribValue="";return}if(z.opt.xmlns){var L=s(z.attribName,!0),u=L.prefix,h=L.local;if(u==="xmlns")if(h==="xml"&&z.attribValue!==A)i(z,"xml: prefix must be bound to "+A+` +Actual: `+z.attribValue);else if(h==="xmlns"&&z.attribValue!==P)i(z,"xmlns: prefix must be bound to "+P+` +Actual: `+z.attribValue);else{var Z0=z.tag,g=z.tags[z.tags.length-1]||z;if(Z0.ns===g.ns)Z0.ns=Object.create(g.ns);Z0.ns[h]=z.attribValue}z.attribList.push([z.attribName,z.attribValue])}else z.tag.attributes[z.attribName]=z.attribValue,b(z,"onattribute",{name:z.attribName,value:z.attribValue});z.attribName=z.attribValue=""}function r(z,L){if(z.opt.xmlns){var u=z.tag,h=s(z.tagName);if(u.prefix=h.prefix,u.local=h.local,u.uri=u.ns[h.prefix]||"",u.prefix&&!u.uri)i(z,"Unbound namespace prefix: "+JSON.stringify(z.tagName)),u.uri=h.prefix;var Z0=z.tags[z.tags.length-1]||z;if(u.ns&&Z0.ns!==u.ns)Object.keys(u.ns).forEach(function(d){b(z,"onopennamespace",{prefix:d,uri:u.ns[d]})});for(var g=0,f=z.attribList.length;g",z.tagName="",z.state=w.SCRIPT;return}b(z,"onscript",z.script),z.script=""}var L=z.tags.length,u=z.tagName;if(!z.strict)u=u[z.looseCase]();var h=u;while(L--)if(z.tags[L].name!==h)i(z,"Unexpected close tag");else break;if(L<0){i(z,"Unmatched closing tag: "+z.tagName),z.textNode+="",z.state=w.TEXT;return}z.tagName=u;var Z0=z.tags.length;while(Z0-- >L){var g=z.tag=z.tags.pop();z.tagName=z.tag.name,b(z,"onclosetag",z.tagName);var f={};for(var R in g.ns)f[R]=g.ns[R];var p=z.tags[z.tags.length-1]||z;if(z.opt.xmlns&&g.ns!==p.ns)Object.keys(g.ns).forEach(function(k){var V=g.ns[k];b(z,"onclosenamespace",{prefix:k,uri:V})})}if(L===0)z.closedRoot=!0;z.tagName=z.attribValue=z.attribName="",z.attribList.length=0,z.state=w.TEXT}function n(z){var L=z.entity,u=L.toLowerCase(),h,Z0="";if(z.ENTITIES[L])return z.ENTITIES[L];if(z.ENTITIES[u])return z.ENTITIES[u];if(L=u,L.charAt(0)==="#")if(L.charAt(1)==="x")L=L.slice(2),h=parseInt(L,16),Z0=h.toString(16);else L=L.slice(1),h=parseInt(L,10),Z0=h.toString(10);if(L=L.replace(/^0+/,""),isNaN(h)||Z0.toLowerCase()!==L)return i(z,"Invalid character entity"),"&"+z.entity+";";return String.fromCodePoint(h)}function o(z,L){if(L==="<")z.state=w.OPEN_WAKA,z.startTagPosition=z.position;else if(!S(L))i(z,"Non-whitespace before first tag."),z.textNode=L,z.state=w.TEXT}function Y0(z,L){var u="";if(L")b(L,"onsgmldeclaration",L.sgmlDecl),L.sgmlDecl="",L.state=w.TEXT;else if(F(h))L.state=w.SGML_DECL_QUOTED,L.sgmlDecl+=h;else L.sgmlDecl+=h;continue;case w.SGML_DECL_QUOTED:if(h===L.q)L.state=w.SGML_DECL,L.q="";L.sgmlDecl+=h;continue;case w.DOCTYPE:if(h===">")L.state=w.TEXT,b(L,"ondoctype",L.doctype),L.doctype=!0;else if(L.doctype+=h,h==="[")L.state=w.DOCTYPE_DTD;else if(F(h))L.state=w.DOCTYPE_QUOTED,L.q=h;continue;case w.DOCTYPE_QUOTED:if(L.doctype+=h,h===L.q)L.q="",L.state=w.DOCTYPE;continue;case w.DOCTYPE_DTD:if(L.doctype+=h,h==="]")L.state=w.DOCTYPE;else if(F(h))L.state=w.DOCTYPE_DTD_QUOTED,L.q=h;continue;case w.DOCTYPE_DTD_QUOTED:if(L.doctype+=h,h===L.q)L.state=w.DOCTYPE_DTD,L.q="";continue;case w.COMMENT:if(h==="-")L.state=w.COMMENT_ENDING;else L.comment+=h;continue;case w.COMMENT_ENDING:if(h==="-"){if(L.state=w.COMMENT_ENDED,L.comment=D(L.opt,L.comment),L.comment)b(L,"oncomment",L.comment);L.comment=""}else L.comment+="-"+h,L.state=w.COMMENT;continue;case w.COMMENT_ENDED:if(h!==">")i(L,"Malformed comment"),L.comment+="--"+h,L.state=w.COMMENT;else L.state=w.TEXT;continue;case w.CDATA:if(h==="]")L.state=w.CDATA_ENDING;else L.cdata+=h;continue;case w.CDATA_ENDING:if(h==="]")L.state=w.CDATA_ENDING_2;else L.cdata+="]"+h,L.state=w.CDATA;continue;case w.CDATA_ENDING_2:if(h===">"){if(L.cdata)b(L,"oncdata",L.cdata);b(L,"onclosecdata"),L.cdata="",L.state=w.TEXT}else if(h==="]")L.cdata+="]";else L.cdata+="]]"+h,L.state=w.CDATA;continue;case w.PROC_INST:if(h==="?")L.state=w.PROC_INST_ENDING;else if(S(h))L.state=w.PROC_INST_BODY;else L.procInstName+=h;continue;case w.PROC_INST_BODY:if(!L.procInstBody&&S(h))continue;else if(h==="?")L.state=w.PROC_INST_ENDING;else L.procInstBody+=h;continue;case w.PROC_INST_ENDING:if(h===">")b(L,"onprocessinginstruction",{name:L.procInstName,body:L.procInstBody}),L.procInstName=L.procInstBody="",L.state=w.TEXT;else L.procInstBody+="?"+h,L.state=w.PROC_INST_BODY;continue;case w.OPEN_TAG:if($(C,h))L.tagName+=h;else if(V0(L),h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else{if(!S(h))i(L,"Invalid character in tag name");L.state=w.ATTRIB}continue;case w.OPEN_TAG_SLASH:if(h===">")r(L,!0),y(L);else i(L,"Forward-slash in opening tag not followed by >"),L.state=w.ATTRIB;continue;case w.ATTRIB:if(S(h))continue;else if(h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else if($(E,h))L.attribName=h,L.attribValue="",L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case w.ATTRIB_NAME:if(h==="=")L.state=w.ATTRIB_VALUE;else if(h===">")i(L,"Attribute without value"),L.attribValue=L.attribName,G0(L),r(L);else if(S(h))L.state=w.ATTRIB_NAME_SAW_WHITE;else if($(C,h))L.attribName+=h;else i(L,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if(h==="=")L.state=w.ATTRIB_VALUE;else if(S(h))continue;else if(i(L,"Attribute without value"),L.tag.attributes[L.attribName]="",L.attribValue="",b(L,"onattribute",{name:L.attribName,value:""}),L.attribName="",h===">")r(L);else if($(E,h))L.attribName=h,L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name"),L.state=w.ATTRIB;continue;case w.ATTRIB_VALUE:if(S(h))continue;else if(F(h))L.q=h,L.state=w.ATTRIB_VALUE_QUOTED;else i(L,"Unquoted attribute value"),L.state=w.ATTRIB_VALUE_UNQUOTED,L.attribValue=h;continue;case w.ATTRIB_VALUE_QUOTED:if(h!==L.q){if(h==="&")L.state=w.ATTRIB_VALUE_ENTITY_Q;else L.attribValue+=h;continue}G0(L),L.q="",L.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:if(S(h))L.state=w.ATTRIB;else if(h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else if($(E,h))i(L,"No whitespace between attributes"),L.attribName=h,L.attribValue="",L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!M(h)){if(h==="&")L.state=w.ATTRIB_VALUE_ENTITY_U;else L.attribValue+=h;continue}if(G0(L),h===">")r(L);else L.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(!L.tagName)if(S(h))continue;else if(x(E,h))if(L.script)L.script+="")y(L);else if($(C,h))L.tagName+=h;else if(L.script)L.script+="")y(L);else i(L,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var f,R;switch(L.state){case w.TEXT_ENTITY:f=w.TEXT,R="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:f=w.ATTRIB_VALUE_QUOTED,R="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:f=w.ATTRIB_VALUE_UNQUOTED,R="attribValue";break}if(h===";")L[R]+=n(L),L.entity="",L.state=f;else if($(L.entity.length?v:N,h))L.entity+=h;else i(L,"Invalid character in entity name"),L[R]+="&"+L.entity+h,L.entity="",L.state=f;continue;default:throw Error(L,"Unknown state: "+L.state)}}if(L.position>=L.bufferCheckPosition)Q(L);return L}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint)(function(){var z=String.fromCharCode,L=Math.floor,u=function(){var h=16384,Z0=[],g,f,R=-1,p=arguments.length;if(!p)return"";var k="";while(++R1114111||L(V)!==V)throw RangeError("Invalid code point: "+V);if(V<=65535)Z0.push(V);else V-=65536,g=(V>>10)+55296,f=V%1024+56320,Z0.push(g,f);if(R+1===p||Z0.length>h)k+=z.apply(null,Z0),Z0.length=0}return k};if(Object.defineProperty)Object.defineProperty(String,"fromCodePoint",{value:u,configurable:!0,writable:!0});else String.fromCodePoint=u})()})(typeof B>"u"?B.sax={}:B)}),_8=R0((B,U)=>{U.exports={isArray:function(G){if(Array.isArray)return Array.isArray(G);return Object.prototype.toString.call(G)==="[object Array]"}}}),h8=R0((B,U)=>{var G=_8().isArray;U.exports={copyOptions:function(Y){var Q,K={};for(Q in Y)if(Y.hasOwnProperty(Q))K[Q]=Y[Q];return K},ensureFlagExists:function(Y,Q){if(!(Y in Q)||typeof Q[Y]!=="boolean")Q[Y]=!1},ensureSpacesExists:function(Y){if(!("spaces"in Y)||typeof Y.spaces!=="number"&&typeof Y.spaces!=="string")Y.spaces=0},ensureAlwaysArrayExists:function(Y){if(!("alwaysArray"in Y)||typeof Y.alwaysArray!=="boolean"&&!G(Y.alwaysArray))Y.alwaysArray=!1},ensureKeyExists:function(Y,Q){if(!(Y+"Key"in Q)||typeof Q[Y+"Key"]!=="string")Q[Y+"Key"]=Q.compact?"_"+Y:Y},checkFnExists:function(Y,Q){return Y+"Fn"in Q}}}),TB=R0((B,U)=>{var G=GG(),Y={on:function(){},parse:function(){}},Q=h8(),K=_8().isArray,Z,J=!0,q;function W(F){return Z=Q.copyOptions(F),Q.ensureFlagExists("ignoreDeclaration",Z),Q.ensureFlagExists("ignoreInstruction",Z),Q.ensureFlagExists("ignoreAttributes",Z),Q.ensureFlagExists("ignoreText",Z),Q.ensureFlagExists("ignoreComment",Z),Q.ensureFlagExists("ignoreCdata",Z),Q.ensureFlagExists("ignoreDoctype",Z),Q.ensureFlagExists("compact",Z),Q.ensureFlagExists("alwaysChildren",Z),Q.ensureFlagExists("addParent",Z),Q.ensureFlagExists("trim",Z),Q.ensureFlagExists("nativeType",Z),Q.ensureFlagExists("nativeTypeAttributes",Z),Q.ensureFlagExists("sanitize",Z),Q.ensureFlagExists("instructionHasAttributes",Z),Q.ensureFlagExists("captureSpacesBetweenElements",Z),Q.ensureAlwaysArrayExists(Z),Q.ensureKeyExists("declaration",Z),Q.ensureKeyExists("instruction",Z),Q.ensureKeyExists("attributes",Z),Q.ensureKeyExists("text",Z),Q.ensureKeyExists("comment",Z),Q.ensureKeyExists("cdata",Z),Q.ensureKeyExists("doctype",Z),Q.ensureKeyExists("type",Z),Q.ensureKeyExists("name",Z),Q.ensureKeyExists("elements",Z),Q.ensureKeyExists("parent",Z),Q.checkFnExists("doctype",Z),Q.checkFnExists("instruction",Z),Q.checkFnExists("cdata",Z),Q.checkFnExists("comment",Z),Q.checkFnExists("text",Z),Q.checkFnExists("instructionName",Z),Q.checkFnExists("elementName",Z),Q.checkFnExists("attributeName",Z),Q.checkFnExists("attributeValue",Z),Q.checkFnExists("attributes",Z),Z}function I(F){var M=Number(F);if(!isNaN(M))return M;var $=F.toLowerCase();if($==="true")return!0;else if($==="false")return!1;return F}function H(F,M){var $;if(Z.compact){if(!q[Z[F+"Key"]]&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(Z[F+"Key"])!==-1:Z.alwaysArray))q[Z[F+"Key"]]=[];if(q[Z[F+"Key"]]&&!K(q[Z[F+"Key"]]))q[Z[F+"Key"]]=[q[Z[F+"Key"]]];if(F+"Fn"in Z&&typeof M==="string")M=Z[F+"Fn"](M,q);if(F==="instruction"&&(("instructionFn"in Z)||("instructionNameFn"in Z))){for($ in M)if(M.hasOwnProperty($))if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);else{var x=M[$];delete M[$],M[Z.instructionNameFn($,x,q)]=x}}if(K(q[Z[F+"Key"]]))q[Z[F+"Key"]].push(M);else q[Z[F+"Key"]]=M}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];var w={};if(w[Z.typeKey]=F,F==="instruction"){for($ in M)if(M.hasOwnProperty($))break;if(w[Z.nameKey]="instructionNameFn"in Z?Z.instructionNameFn($,M,q):$,Z.instructionHasAttributes){if(w[Z.attributesKey]=M[$][Z.attributesKey],"instructionFn"in Z)w[Z.attributesKey]=Z.instructionFn(w[Z.attributesKey],$,q)}else{if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);w[Z.instructionKey]=M[$]}}else{if(F+"Fn"in Z)M=Z[F+"Fn"](M,q);w[Z[F+"Key"]]=M}if(Z.addParent)w[Z.parentKey]=q;q[Z.elementsKey].push(w)}}function T(F){if("attributesFn"in Z&&F)F=Z.attributesFn(F,q);if((Z.trim||("attributeValueFn"in Z)||("attributeNameFn"in Z)||Z.nativeTypeAttributes)&&F){var M;for(M in F)if(F.hasOwnProperty(M)){if(Z.trim)F[M]=F[M].trim();if(Z.nativeTypeAttributes)F[M]=I(F[M]);if("attributeValueFn"in Z)F[M]=Z.attributeValueFn(F[M],M,q);if("attributeNameFn"in Z){var $=F[M];delete F[M],F[Z.attributeNameFn(M,F[M],q)]=$}}}return F}function A(F){var M={};if(F.body&&(F.name.toLowerCase()==="xml"||Z.instructionHasAttributes)){var $=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,x;while((x=$.exec(F.body))!==null)M[x[1]]=x[2]||x[3]||x[4];M=T(M)}if(F.name.toLowerCase()==="xml"){if(Z.ignoreDeclaration)return;if(q[Z.declarationKey]={},Object.keys(M).length)q[Z.declarationKey][Z.attributesKey]=M;if(Z.addParent)q[Z.declarationKey][Z.parentKey]=q}else{if(Z.ignoreInstruction)return;if(Z.trim)F.body=F.body.trim();var w={};if(Z.instructionHasAttributes&&Object.keys(M).length)w[F.name]={},w[F.name][Z.attributesKey]=M;else w[F.name]=F.body;H("instruction",w)}}function P(F,M){var $;if(typeof F==="object")M=F.attributes,F=F.name;if(M=T(M),"elementNameFn"in Z)F=Z.elementNameFn(F,q);if(Z.compact){if($={},!Z.ignoreAttributes&&M&&Object.keys(M).length){$[Z.attributesKey]={};var x;for(x in M)if(M.hasOwnProperty(x))$[Z.attributesKey][x]=M[x]}if(!(F in q)&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(F)!==-1:Z.alwaysArray))q[F]=[];if(q[F]&&!K(q[F]))q[F]=[q[F]];if(K(q[F]))q[F].push($);else q[F]=$}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];if($={},$[Z.typeKey]="element",$[Z.nameKey]=F,!Z.ignoreAttributes&&M&&Object.keys(M).length)$[Z.attributesKey]=M;if(Z.alwaysChildren)$[Z.elementsKey]=[];q[Z.elementsKey].push($)}$[Z.parentKey]=q,q=$}function j(F){if(Z.ignoreText)return;if(!F.trim()&&!Z.captureSpacesBetweenElements)return;if(Z.trim)F=F.trim();if(Z.nativeType)F=I(F);if(Z.sanitize)F=F.replace(/&/g,"&").replace(//g,">");H("text",F)}function E(F){if(Z.ignoreComment)return;if(Z.trim)F=F.trim();H("comment",F)}function C(F){var M=q[Z.parentKey];if(!Z.addParent)delete q[Z.parentKey];q=M}function N(F){if(Z.ignoreCdata)return;if(Z.trim)F=F.trim();H("cdata",F)}function v(F){if(Z.ignoreDoctype)return;if(F=F.replace(/^ /,""),Z.trim)F=F.trim();H("doctype",F)}function S(F){F.note=F}U.exports=function(F,M){var $=J?G.parser(!0,{}):$=new Y.Parser("UTF-8"),x={};if(q=x,Z=W(M),J)$.opt={strictEntities:!0},$.onopentag=P,$.ontext=j,$.oncomment=E,$.onclosetag=C,$.onerror=S,$.oncdata=N,$.ondoctype=v,$.onprocessinginstruction=A;else $.on("startElement",P),$.on("text",j),$.on("comment",E),$.on("endElement",C),$.on("error",S);if(J)$.write(F).close();else if(!$.parse(F))throw Error("XML parsing error: "+$.getError());if(x[Z.elementsKey]){var w=x[Z.elementsKey];delete x[Z.elementsKey],x[Z.elementsKey]=w,delete x.text}return x}}),YG=R0((B,U)=>{var G=h8(),Y=TB();function Q(K){var Z=G.copyOptions(K);return G.ensureSpacesExists(Z),Z}U.exports=function(K,Z){var J=Q(Z),q=Y(K,J),W,I="compact"in J&&J.compact?"_parent":"parent";if("addParent"in J&&J.addParent)W=JSON.stringify(q,function(H,T){return H===I?"_":T},J.spaces);else W=JSON.stringify(q,null,J.spaces);return W.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}}),CB=R0((B,U)=>{var G=h8(),Y=_8().isArray,Q,K;function Z(F){var M=G.copyOptions(F);if(G.ensureFlagExists("ignoreDeclaration",M),G.ensureFlagExists("ignoreInstruction",M),G.ensureFlagExists("ignoreAttributes",M),G.ensureFlagExists("ignoreText",M),G.ensureFlagExists("ignoreComment",M),G.ensureFlagExists("ignoreCdata",M),G.ensureFlagExists("ignoreDoctype",M),G.ensureFlagExists("compact",M),G.ensureFlagExists("indentText",M),G.ensureFlagExists("indentCdata",M),G.ensureFlagExists("indentAttributes",M),G.ensureFlagExists("indentInstruction",M),G.ensureFlagExists("fullTagEmptyElement",M),G.ensureFlagExists("noQuotesForNativeAttributes",M),G.ensureSpacesExists(M),typeof M.spaces==="number")M.spaces=Array(M.spaces+1).join(" ");return G.ensureKeyExists("declaration",M),G.ensureKeyExists("instruction",M),G.ensureKeyExists("attributes",M),G.ensureKeyExists("text",M),G.ensureKeyExists("comment",M),G.ensureKeyExists("cdata",M),G.ensureKeyExists("doctype",M),G.ensureKeyExists("type",M),G.ensureKeyExists("name",M),G.ensureKeyExists("elements",M),G.checkFnExists("doctype",M),G.checkFnExists("instruction",M),G.checkFnExists("cdata",M),G.checkFnExists("comment",M),G.checkFnExists("text",M),G.checkFnExists("instructionName",M),G.checkFnExists("elementName",M),G.checkFnExists("attributeName",M),G.checkFnExists("attributeValue",M),G.checkFnExists("attributes",M),G.checkFnExists("fullTagEmptyElement",M),M}function J(F,M,$){return(!$&&F.spaces?` +`:"")+Array(M+1).join(F.spaces)}function q(F,M,$){if(M.ignoreAttributes)return"";if("attributesFn"in M)F=M.attributesFn(F,K,Q);var x,w,a,U0,b=[];for(x in F)if(F.hasOwnProperty(x)&&F[x]!==null&&F[x]!==void 0)U0=M.noQuotesForNativeAttributes&&typeof F[x]!=="string"?"":'"',w=""+F[x],w=w.replace(/"/g,"""),a="attributeNameFn"in M?M.attributeNameFn(x,w,K,Q):x,b.push(M.spaces&&M.indentAttributes?J(M,$+1,!1):" "),b.push(a+"="+U0+("attributeValueFn"in M?M.attributeValueFn(w,x,K,Q):w)+U0);if(F&&Object.keys(F).length&&M.spaces&&M.indentAttributes)b.push(J(M,$,!1));return b.join("")}function W(F,M,$){return Q=F,K="xml",M.ignoreDeclaration?"":""}function I(F,M,$){if(M.ignoreInstruction)return"";var x;for(x in F)if(F.hasOwnProperty(x))break;var w="instructionNameFn"in M?M.instructionNameFn(x,F[x],K,Q):x;if(typeof F[x]==="object")return Q=F,K=w,"";else{var a=F[x]?F[x]:"";if("instructionFn"in M)a=M.instructionFn(a,x,K,Q);return""}}function H(F,M){return M.ignoreComment?"":""}function T(F,M){return M.ignoreCdata?"":"","]]]]>"))+"]]>"}function A(F,M){return M.ignoreDoctype?"":""}function P(F,M){if(M.ignoreText)return"";return F=""+F,F=F.replace(/&/g,"&"),F=F.replace(/&/g,"&").replace(//g,">"),"textFn"in M?M.textFn(F,K,Q):F}function j(F,M){var $;if(F.elements&&F.elements.length)for($=0;$"),F[M.elementsKey]&&F[M.elementsKey].length)x.push(C(F[M.elementsKey],M,$+1)),Q=F,K=F.name;x.push(M.spaces&&j(F,M)?` +`+Array($+1).join(M.spaces):""),x.push("")}else x.push("/>");return x.join("")}function C(F,M,$,x){return F.reduce(function(w,a){var U0=J(M,$,x&&!w);switch(a.type){case"element":return w+U0+E(a,M,$);case"comment":return w+U0+H(a[M.commentKey],M);case"doctype":return w+U0+A(a[M.doctypeKey],M);case"cdata":return w+(M.indentCdata?U0:"")+T(a[M.cdataKey],M);case"text":return w+(M.indentText?U0:"")+P(a[M.textKey],M);case"instruction":var b={};return b[a[M.nameKey]]=a[M.attributesKey]?a:a[M.instructionKey],w+(M.indentInstruction?U0:"")+I(b,M,$)}},"")}function N(F,M,$){var x;for(x in F)if(F.hasOwnProperty(x))switch(x){case M.parentKey:case M.attributesKey:break;case M.textKey:if(M.indentText||$)return!0;break;case M.cdataKey:if(M.indentCdata||$)return!0;break;case M.instructionKey:if(M.indentInstruction||$)return!0;break;case M.doctypeKey:case M.commentKey:return!0;default:return!0}return!1}function v(F,M,$,x,w){Q=F,K=M;var a="elementNameFn"in $?$.elementNameFn(M,F):M;if(typeof F>"u"||F===null||F==="")return"fullTagEmptyElementFn"in $&&$.fullTagEmptyElementFn(M,F)||$.fullTagEmptyElement?"<"+a+">":"<"+a+"/>";var U0=[];if(M){if(U0.push("<"+a),typeof F!=="object")return U0.push(">"+P(F,$)+""),U0.join("");if(F[$.attributesKey])U0.push(q(F[$.attributesKey],$,x));var b=N(F,$,!0)||F[$.attributesKey]&&F[$.attributesKey]["xml:space"]==="preserve";if(!b)if("fullTagEmptyElementFn"in $)b=$.fullTagEmptyElementFn(M,F);else b=$.fullTagEmptyElement;if(b)U0.push(">");else return U0.push("/>"),U0.join("")}if(U0.push(S(F,$,x+1,!1)),Q=F,K=M,M)U0.push((w?J($,x,!1):"")+"");return U0.join("")}function S(F,M,$,x){var w,a,U0,b=[];for(a in F)if(F.hasOwnProperty(a)){U0=Y(F[a])?F[a]:[F[a]];for(w=0;w{var G=CB();U.exports=function(Y,Q){if(Y instanceof Buffer)Y=Y.toString();var K=null;if(typeof Y==="string")try{K=JSON.parse(Y)}catch(Z){throw Error("The JSON structure is invalid")}else K=Y;return G(K,Q)}}),h1=R0((B,U)=>{U.exports={xml2js:TB(),xml2json:YG(),js2xml:CB(),json2xml:ZG()}})(),u1=(B)=>{switch(B.type){case void 0:case"element":let U=new kB(B.name,B.attributes),G=B.elements||[];for(let Y of G){let Q=u1(Y);if(Q!==void 0)U.push(Q)}return U;case"text":return B.text;default:return}},QG=class extends H0{},kB=class extends t{static fromXmlString(B){return u1((0,h1.xml2js)(B,{compact:!1}))}constructor(B,U){super(B);if(U)this.root.push(new QG(U))}push(B){this.root.push(B)}},$B=class extends t{constructor(B){super("");e(this,"_attr",void 0),this._attr=B}prepForXml(B){return{_attr:this._attr}}},JG="",u8=class extends t{constructor(B,U){super(B);if(U)this.root=U.root}},T0=(B)=>{if(isNaN(B))throw Error(`Invalid value '${B}' specified. Must be an integer.`);return Math.floor(B)},X1=(B)=>{let U=T0(B);if(U<0)throw Error(`Invalid value '${B}' specified. Must be a positive integer.`);return U},d1=(B,U)=>{let G=U*2;if(B.length!==G||isNaN(Number(`0x${B}`)))throw Error(`Invalid hex value '${B}'. Expected ${G} digit hex value`);return B},KG=(B)=>d1(B,4),SB=(B)=>d1(B,2),W8=(B)=>d1(B,1),q1=(B)=>{let U=B.slice(-2),G=B.substring(0,B.length-2);return`${Number(G)}${U}`},d8=(B)=>{let U=q1(B);if(parseFloat(U)<0)throw Error(`Invalid value '${U}' specified. Expected a positive number.`);return U},C2=(B)=>{if(B==="auto")return B;return d1(B.charAt(0)==="#"?B.substring(1):B,3)},t0=(B)=>typeof B==="string"?q1(B):T0(B),bB=(B)=>typeof B==="string"?d8(B):X1(B),VG=(B)=>typeof B==="string"?q1(B):T0(B),E0=(B)=>typeof B==="string"?d8(B):X1(B),vB=(B)=>{let U=B.substring(0,B.length-1);return`${Number(U)}%`},c8=(B)=>{if(typeof B==="number")return T0(B);if(B.slice(-1)==="%")return vB(B);return q1(B)},yB=X1,gB=X1,fB=(B)=>B.toISOString(),q0=class extends t{constructor(B,U=!0){super(B);if(U!==!0)this.root.push(new C0({val:U}))}},D1=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:bB(U)}))}},S0=class extends t{},q2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},f2=(B,U)=>new M0({name:B,attributes:{value:{key:"w:val",value:U}}}),_2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},XG=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},O2=class extends t{constructor(B,U){super(B);this.root.push(U)}},M0=class extends t{constructor({name:B,attributes:U,children:G}){super(B);if(U)this.root.push(new $8(U));if(G)this.root.push(...G)}},c0={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},m8=(B)=>new M0({name:"w:jc",attributes:{val:{key:"w:val",value:B}}}),j0=(B,{color:U,size:G,space:Y,style:Q})=>new M0({name:B,attributes:{style:{key:"w:val",value:Q},color:{key:"w:color",value:U===void 0?void 0:C2(U)},size:{key:"w:sz",value:G===void 0?void 0:yB(G)},space:{key:"w:space",value:Y===void 0?void 0:gB(Y)}}}),c1={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},xB=class extends R2{constructor(B){super("w:pBdr");if(B.top)this.root.push(j0("w:top",B.top));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.left)this.root.push(j0("w:left",B.left));if(B.right)this.root.push(j0("w:right",B.right));if(B.between)this.root.push(j0("w:between",B.between))}},_B=class extends t{constructor(){super("w:pBdr");let B=j0("w:bottom",{color:"auto",space:1,style:c1.SINGLE,size:6});this.root.push(B)}},hB=({start:B,end:U,left:G,right:Y,hanging:Q,firstLine:K,firstLineChars:Z})=>new M0({name:"w:ind",attributes:{start:{key:"w:start",value:B===void 0?void 0:t0(B)},end:{key:"w:end",value:U===void 0?void 0:t0(U)},left:{key:"w:left",value:G===void 0?void 0:t0(G)},right:{key:"w:right",value:Y===void 0?void 0:t0(Y)},hanging:{key:"w:hanging",value:Q===void 0?void 0:E0(Q)},firstLine:{key:"w:firstLine",value:K===void 0?void 0:E0(K)},firstLineChars:{key:"w:firstLineChars",value:Z===void 0?void 0:T0(Z)}}}),uB=()=>new M0({name:"w:br"}),l8={BEGIN:"begin",END:"end",SEPARATE:"separate"},a8=(B,U)=>new M0({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:B},dirty:{key:"w:dirty",value:U}}}),e0=(B)=>a8(l8.BEGIN,B),X2=(B)=>a8(l8.SEPARATE,B),B2=(B)=>a8(l8.END,B),qG={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},MG={BOTTOM:"bottom",CENTER:"center",INSIDE:"inside",OUTSIDE:"outside",TOP:"top"},RG={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},x0={DEFAULT:"default",PRESERVE:"preserve"},_0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{space:"xml:space"})}},LG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},IG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},OG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},HG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTION")}},M1=({fill:B,color:U,type:G})=>new M0({name:"w:shd",attributes:{fill:{key:"w:fill",value:B===void 0?void 0:C2(B)},color:{key:"w:color",value:U===void 0?void 0:C2(U)},type:{key:"w:val",value:G}}}),FG={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},b0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},WG=class extends t{constructor(B){super("w:del");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},PG=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},p8={DOT:"dot"},r8=(B=p8.DOT)=>new M0({name:"w:em",attributes:{val:{key:"w:val",value:B}}}),AG=()=>r8(p8.DOT),jG=class extends t{constructor(B){super("w:spacing");this.root.push(new C0({val:t0(B)}))}},NG=class extends t{constructor(B){super("w:color");this.root.push(new C0({val:C2(B)}))}},wG=class extends t{constructor(B){super("w:highlight");this.root.push(new C0({val:B}))}},zG=class extends t{constructor(B){super("w:highlightCs");this.root.push(new C0({val:B}))}},EG=(B)=>new M0({name:"w:lang",attributes:{value:{key:"w:val",value:B.value},eastAsia:{key:"w:eastAsia",value:B.eastAsia},bidirectional:{key:"w:bidi",value:B.bidirectional}}}),T1=(B,U)=>{if(typeof B==="string"){let Y=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:Y},cs:{key:"w:cs",value:Y},eastAsia:{key:"w:eastAsia",value:Y},hAnsi:{key:"w:hAnsi",value:Y},hint:{key:"w:hint",value:U}}})}let G=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:G.ascii},cs:{key:"w:cs",value:G.cs},eastAsia:{key:"w:eastAsia",value:G.eastAsia},hAnsi:{key:"w:hAnsi",value:G.hAnsi},hint:{key:"w:hint",value:G.hint}}})},dB=(B)=>new M0({name:"w:vertAlign",attributes:{val:{key:"w:val",value:B}}}),DG=()=>dB("superscript"),TG=()=>dB("subscript"),i8={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},cB=(B=i8.SINGLE,U)=>new M0({name:"w:u",attributes:{val:{key:"w:val",value:B},color:{key:"w:color",value:U===void 0?void 0:C2(U)}}}),CG={BLINK_BACKGROUND:"blinkBackground",LIGHTS:"lights",ANTS_BLACK:"antsBlack",ANTS_RED:"antsRed",SHIMMER:"shimmer",SPARKLE:"sparkle",NONE:"none"},kG={BLACK:"black",BLUE:"blue",CYAN:"cyan",DARK_BLUE:"darkBlue",DARK_CYAN:"darkCyan",DARK_GRAY:"darkGray",DARK_GREEN:"darkGreen",DARK_MAGENTA:"darkMagenta",DARK_RED:"darkRed",DARK_YELLOW:"darkYellow",GREEN:"green",LIGHT_GRAY:"lightGray",MAGENTA:"magenta",NONE:"none",RED:"red",WHITE:"white",YELLOW:"yellow"},U2=class extends R2{constructor(B){super("w:rPr");if(!B)return;if(B.style)this.push(new q2("w:rStyle",B.style));if(B.font)if(typeof B.font==="string")this.push(T1(B.font));else if("name"in B.font)this.push(T1(B.font.name,B.font.hint));else this.push(T1(B.font));if(B.bold!==void 0)this.push(new q0("w:b",B.bold));if(B.boldComplexScript===void 0&&B.bold!==void 0||B.boldComplexScript){var U;this.push(new q0("w:bCs",(U=B.boldComplexScript)!==null&&U!==void 0?U:B.bold))}if(B.italics!==void 0)this.push(new q0("w:i",B.italics));if(B.italicsComplexScript===void 0&&B.italics!==void 0||B.italicsComplexScript){var G;this.push(new q0("w:iCs",(G=B.italicsComplexScript)!==null&&G!==void 0?G:B.italics))}if(B.smallCaps!==void 0)this.push(new q0("w:smallCaps",B.smallCaps));else if(B.allCaps!==void 0)this.push(new q0("w:caps",B.allCaps));if(B.strike!==void 0)this.push(new q0("w:strike",B.strike));if(B.doubleStrike!==void 0)this.push(new q0("w:dstrike",B.doubleStrike));if(B.emboss!==void 0)this.push(new q0("w:emboss",B.emboss));if(B.imprint!==void 0)this.push(new q0("w:imprint",B.imprint));if(B.noProof!==void 0)this.push(new q0("w:noProof",B.noProof));if(B.snapToGrid!==void 0)this.push(new q0("w:snapToGrid",B.snapToGrid));if(B.vanish)this.push(new q0("w:vanish",B.vanish));if(B.color)this.push(new NG(B.color));if(B.characterSpacing)this.push(new jG(B.characterSpacing));if(B.scale!==void 0)this.push(new _2("w:w",B.scale));if(B.kern)this.push(new D1("w:kern",B.kern));if(B.position)this.push(new q2("w:position",B.position));if(B.size!==void 0)this.push(new D1("w:sz",B.size));let Y=B.sizeComplexScript===void 0||B.sizeComplexScript===!0?B.size:B.sizeComplexScript;if(Y)this.push(new D1("w:szCs",Y));if(B.highlight)this.push(new wG(B.highlight));let Q=B.highlightComplexScript===void 0||B.highlightComplexScript===!0?B.highlight:B.highlightComplexScript;if(Q)this.push(new zG(Q));if(B.underline)this.push(cB(B.underline.type,B.underline.color));if(B.effect)this.push(new q2("w:effect",B.effect));if(B.border)this.push(j0("w:bdr",B.border));if(B.shading)this.push(M1(B.shading));if(B.subScript)this.push(TG());if(B.superScript)this.push(DG());if(B.rightToLeft!==void 0)this.push(new q0("w:rtl",B.rightToLeft));if(B.emphasisMark)this.push(r8(B.emphasisMark.type));if(B.language)this.push(EG(B.language));if(B.specVanish)this.push(new q0("w:specVanish",B.vanish));if(B.math)this.push(new q0("w:oMath",B.math));if(B.revision)this.push(new lB(B.revision))}push(B){this.root.push(B)}},mB=class extends U2{constructor(B){super(B);if(B===null||B===void 0?void 0:B.insertion)this.push(new PG(B.insertion));if(B===null||B===void 0?void 0:B.deletion)this.push(new WG(B.deletion))}},lB=class extends t{constructor(B){super("w:rPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new U2(B))}},Z1=class extends t{constructor(B){super("w:t");if(typeof B==="string")this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B);else{var U;this.root.push(new _0({space:(U=B.space)!==null&&U!==void 0?U:x0.DEFAULT})),this.root.push(B.text)}}},F2={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},D0=class extends t{constructor(B){super("w:r");if(e(this,"properties",void 0),this.properties=new U2(B),this.root.push(this.properties),B.break)for(let U=0;U{U.exports=G;function G(Y,Q){if(!Y)throw Error(Q||"Assertion failed")}G.equal=function(Q,K,Z){if(Q!=K)throw Error(Z||"Assertion failed: "+Q+" != "+K)}}),G2=R0((B)=>{var U=R1();B.inherits=W2();function G(b,c){if((b.charCodeAt(c)&64512)!==55296)return!1;if(c<0||c+1>=b.length)return!1;return(b.charCodeAt(c+1)&64512)===56320}function Y(b,c){if(Array.isArray(b))return b.slice();if(!b)return[];var D=[];if(typeof b==="string"){if(!c){var m=0;for(var B0=0;B0>6|192,D[m++]=i&63|128;else if(G(b,B0))i=65536+((i&1023)<<10)+(b.charCodeAt(++B0)&1023),D[m++]=i>>18|240,D[m++]=i>>12&63|128,D[m++]=i>>6&63|128,D[m++]=i&63|128;else D[m++]=i>>12|224,D[m++]=i>>6&63|128,D[m++]=i&63|128}}else if(c==="hex"){if(b=b.replace(/[^a-z0-9]+/gi,""),b.length%2!==0)b="0"+b;for(B0=0;B0>>24|b>>>8&65280|b<<8&16711680|(b&255)<<24)>>>0}B.htonl=K;function Z(b,c){var D="";for(var m=0;m>>0}return i}B.join32=W;function I(b,c){var D=Array(b.length*4);for(var m=0,B0=0;m>>24,D[B0+1]=i>>>16&255,D[B0+2]=i>>>8&255,D[B0+3]=i&255;else D[B0+3]=i>>>24,D[B0+2]=i>>>16&255,D[B0+1]=i>>>8&255,D[B0]=i&255}return D}B.split32=I;function H(b,c){return b>>>c|b<<32-c}B.rotr32=H;function T(b,c){return b<>>32-c}B.rotl32=T;function A(b,c){return b+c>>>0}B.sum32=A;function P(b,c,D){return b+c+D>>>0}B.sum32_3=P;function j(b,c,D,m){return b+c+D+m>>>0}B.sum32_4=j;function E(b,c,D,m,B0){return b+c+D+m+B0>>>0}B.sum32_5=E;function C(b,c,D,m){var B0=b[c],i=m+b[c+1]>>>0;b[c]=(i>>0,b[c+1]=i}B.sum64=C;function N(b,c,D,m){return(c+m>>>0>>0}B.sum64_hi=N;function v(b,c,D,m){return c+m>>>0}B.sum64_lo=v;function S(b,c,D,m,B0,i,V0,s){var G0=0,r=c;return r=r+m>>>0,G0+=r>>0,G0+=r>>0,G0+=r>>0}B.sum64_4_hi=S;function F(b,c,D,m,B0,i,V0,s){return c+m+i+s>>>0}B.sum64_4_lo=F;function M(b,c,D,m,B0,i,V0,s,G0,r){var y=0,n=c;return n=n+m>>>0,y+=n>>0,y+=n>>0,y+=n>>0,y+=n>>0}B.sum64_5_hi=M;function $(b,c,D,m,B0,i,V0,s,G0,r){return c+m+i+s+r>>>0}B.sum64_5_lo=$;function x(b,c,D){return(c<<32-D|b>>>D)>>>0}B.rotr64_hi=x;function w(b,c,D){return(b<<32-D|c>>>D)>>>0}B.rotr64_lo=w;function a(b,c,D){return b>>>D}B.shr64_hi=a;function U0(b,c,D){return(b<<32-D|c>>>D)>>>0}B.shr64_lo=U0}),L1=R0((B)=>{var U=G2(),G=R1();function Y(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}B.BlockHash=Y,Y.prototype.update=function(K,Z){if(K=U.toArray(K,Z),!this.pending)this.pending=K;else this.pending=this.pending.concat(K);if(this.pendingTotal+=K.length,this.pending.length>=this._delta8){K=this.pending;var J=K.length%this._delta8;if(this.pending=K.slice(K.length-J,K.length),this.pending.length===0)this.pending=null;K=U.join32(K,0,K.length-J,this.endian);for(var q=0;q>>24&255,q[W++]=K>>>16&255,q[W++]=K>>>8&255,q[W++]=K&255}else{q[W++]=K&255,q[W++]=K>>>8&255,q[W++]=K>>>16&255,q[W++]=K>>>24&255,q[W++]=0,q[W++]=0,q[W++]=0,q[W++]=0;for(I=8;I{var U=G2().rotr32;function G(I,H,T,A){if(I===0)return Y(H,T,A);if(I===1||I===3)return K(H,T,A);if(I===2)return Q(H,T,A)}B.ft_1=G;function Y(I,H,T){return I&H^~I&T}B.ch32=Y;function Q(I,H,T){return I&H^I&T^H&T}B.maj32=Q;function K(I,H,T){return I^H^T}B.p32=K;function Z(I){return U(I,2)^U(I,13)^U(I,22)}B.s0_256=Z;function J(I){return U(I,6)^U(I,11)^U(I,25)}B.s1_256=J;function q(I){return U(I,7)^U(I,18)^I>>>3}B.g0_256=q;function W(I){return U(I,17)^U(I,19)^I>>>10}B.g1_256=W}),SG=R0((B,U)=>{var G=G2(),Y=L1(),Q=pB(),K=G.rotl32,Z=G.sum32,J=G.sum32_5,q=Q.ft_1,W=Y.BlockHash,I=[1518500249,1859775393,2400959708,3395469782];function H(){if(!(this instanceof H))return new H;W.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}G.inherits(H,W),U.exports=H,H.blockSize=512,H.outSize=160,H.hmacStrength=80,H.padLength=64,H.prototype._update=function(A,P){var j=this.W;for(var E=0;E<16;E++)j[E]=A[P+E];for(;E{var G=G2(),Y=L1(),Q=pB(),K=R1(),Z=G.sum32,J=G.sum32_4,q=G.sum32_5,W=Q.ch32,I=Q.maj32,H=Q.s0_256,T=Q.s1_256,A=Q.g0_256,P=Q.g1_256,j=Y.BlockHash,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function C(){if(!(this instanceof C))return new C;j.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=Array(64)}G.inherits(C,j),U.exports=C,C.blockSize=512,C.outSize=256,C.hmacStrength=192,C.padLength=64,C.prototype._update=function(v,S){var F=this.W;for(var M=0;M<16;M++)F[M]=v[S+M];for(;M{var G=G2(),Y=rB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=512,Q.outSize=224,Q.hmacStrength=192,Q.padLength=64,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),iB=R0((B,U)=>{var G=G2(),Y=L1(),Q=R1(),K=G.rotr64_hi,Z=G.rotr64_lo,J=G.shr64_hi,q=G.shr64_lo,W=G.sum64,I=G.sum64_hi,H=G.sum64_lo,T=G.sum64_4_hi,A=G.sum64_4_lo,P=G.sum64_5_hi,j=G.sum64_5_lo,E=Y.BlockHash,C=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function N(){if(!(this instanceof N))return new N;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=C,this.W=Array(160)}G.inherits(N,E),U.exports=N,N.blockSize=1024,N.outSize=512,N.hmacStrength=192,N.padLength=128,N.prototype._prepareBlock=function(B0,i){var V0=this.W;for(var s=0;s<32;s++)V0[s]=B0[i+s];for(;s{var G=G2(),Y=iB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=1024,Q.outSize=384,Q.hmacStrength=192,Q.padLength=128,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),yG=R0((B)=>{B.sha1=SG(),B.sha224=bG(),B.sha256=rB(),B.sha384=vG(),B.sha512=iB()}),gG=R0((B)=>{var U=G2(),G=L1(),Y=U.rotl32,Q=U.sum32,K=U.sum32_3,Z=U.sum32_4,J=G.BlockHash;function q(){if(!(this instanceof q))return new q;J.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}U.inherits(q,J),B.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(C,N){var v=this.h[0],S=this.h[1],F=this.h[2],M=this.h[3],$=this.h[4],x=v,w=S,a=F,U0=M,b=$;for(var c=0;c<80;c++){var D=Q(Y(Z(v,W(c,S,F,M),C[T[c]+N],I(c)),P[c]),$);v=$,$=M,M=Y(F,10),F=S,S=D,D=Q(Y(Z(x,W(79-c,w,a,U0),C[A[c]+N],H(c)),j[c]),b),x=b,b=U0,U0=Y(a,10),a=w,w=D}D=K(this.h[1],F,U0),this.h[1]=K(this.h[2],M,b),this.h[2]=K(this.h[3],$,x),this.h[3]=K(this.h[4],v,w),this.h[4]=K(this.h[0],S,a),this.h[0]=D},q.prototype._digest=function(C){if(C==="hex")return U.toHex32(this.h,"little");else return U.split32(this.h,"little")};function W(E,C,N,v){if(E<=15)return C^N^v;else if(E<=31)return C&N|~C&v;else if(E<=47)return(C|~N)^v;else if(E<=63)return C&v|N&~v;else return C^(N|~v)}function I(E){if(E<=15)return 0;else if(E<=31)return 1518500249;else if(E<=47)return 1859775393;else if(E<=63)return 2400959708;else return 2840853838}function H(E){if(E<=15)return 1352829926;else if(E<=31)return 1548603684;else if(E<=47)return 1836072691;else if(E<=63)return 2053994217;else return 0}var T=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],A=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],P=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],j=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),fG=R0((B,U)=>{var G=G2(),Y=R1();function Q(K,Z,J){if(!(this instanceof Q))return new Q(K,Z,J);this.Hash=K,this.blockSize=K.blockSize/8,this.outSize=K.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(Z,J))}U.exports=Q,Q.prototype._init=function(Z){if(Z.length>this.blockSize)Z=new this.Hash().update(Z).digest();Y(Z.length<=this.blockSize);for(var J=Z.length;J{var U=B;U.utils=G2(),U.common=L1(),U.sha=yG(),U.ripemd=gG(),U.hmac=fG(),U.sha1=U.sha.sha1,U.sha256=U.sha.sha256,U.sha224=U.sha.sha224,U.sha384=U.sha.sha384,U.sha512=U.sha.sha512,U.ripemd160=U.ripemd.ripemd160})(),1),_G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",hG=(B,U=21)=>{return(G=U)=>{let Y="",Q=G|0;while(Q--)Y+=B[Math.random()*B.length|0];return Y}},uG=(B=21)=>{let U="",G=B|0;while(G--)U+=_G[Math.random()*64|0];return U},dG=(B)=>Math.floor(B/25.4*72*20),u0=(B)=>Math.floor(B*72*20),I1=(B=0)=>{let U=B;return()=>++U},nB=()=>I1(),sB=()=>I1(1),oB=()=>I1(),tB=()=>I1(),O1=()=>uG().toLowerCase(),P8=(B)=>xG.default.sha1().update(B instanceof ArrayBuffer?new Uint8Array(B):B).digest("hex"),s2=(B)=>hG("1234567890abcdef",B)(),eB=()=>`${s2(8)}-${s2(4)}-${s2(4)}-${s2(4)}-${s2(12)}`,U1=(B)=>new Uint8Array(new TextEncoder().encode(B)),B4={CHARACTER:"character",COLUMN:"column",INSIDE_MARGIN:"insideMargin",LEFT_MARGIN:"leftMargin",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",RIGHT_MARGIN:"rightMargin"},U4={BOTTOM_MARGIN:"bottomMargin",INSIDE_MARGIN:"insideMargin",LINE:"line",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",PARAGRAPH:"paragraph",TOP_MARGIN:"topMargin"},G4=()=>new M0({name:"wp:simplePos",attributes:{x:{key:"x",value:0},y:{key:"y",value:0}}}),Y4=(B)=>new M0({name:"wp:align",children:[B]}),Z4=(B)=>new M0({name:"wp:posOffset",children:[B.toString()]}),Q4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionH",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:B4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),J4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionV",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:U4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),cG=function(B){return B.CENTER="ctr",B.TOP="t",B.BOTTOM="b",B}({}),K4=(B={})=>{var U,G,Y,Q;return new M0({name:"wps:bodyPr",attributes:{lIns:{key:"lIns",value:(U=B.margins)===null||U===void 0?void 0:U.left},rIns:{key:"rIns",value:(G=B.margins)===null||G===void 0?void 0:G.right},tIns:{key:"tIns",value:(Y=B.margins)===null||Y===void 0?void 0:Y.top},bIns:{key:"bIns",value:(Q=B.margins)===null||Q===void 0?void 0:Q.bottom},anchor:{key:"anchor",value:B.verticalAnchor}},children:[...B.noAutoFit?[new q0("a:noAutofit",B.noAutoFit)]:[]]})},mG=(B={txBox:"1"})=>new M0({name:"wps:cNvSpPr",attributes:{txBox:{key:"txBox",value:B.txBox}}}),lG=(B)=>new M0({name:"w:txbxContent",children:[...B]}),aG=(B)=>new M0({name:"wps:txbx",children:[lG(B)]}),pG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{cx:"cx",cy:"cy"})}},rG=class extends t{constructor(B,U){super("a:ext");e(this,"attributes",void 0),this.attributes=new pG({cx:B,cy:U}),this.root.push(this.attributes)}},iG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{x:"x",y:"y"})}},nG=class extends t{constructor(B,U){super("a:off");this.root.push(new iG({x:B!==null&&B!==void 0?B:0,y:U!==null&&U!==void 0?U:0}))}},sG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{flipVertical:"flipV",flipHorizontal:"flipH",rotation:"rot"})}},V4=class extends t{constructor(B){var U,G,Y,Q;super("a:xfrm");e(this,"extents",void 0),e(this,"offset",void 0),this.root.push(new sG({flipVertical:(U=B.flip)===null||U===void 0?void 0:U.vertical,flipHorizontal:(G=B.flip)===null||G===void 0?void 0:G.horizontal,rotation:B.rotation})),this.offset=new nG((Y=B.offset)===null||Y===void 0||(Y=Y.emus)===null||Y===void 0?void 0:Y.x,(Q=B.offset)===null||Q===void 0||(Q=Q.emus)===null||Q===void 0?void 0:Q.y),this.extents=new rG(B.emus.x,B.emus.y),this.root.push(this.offset),this.root.push(this.extents)}},X4=()=>new M0({name:"a:noFill"}),oG=(B)=>new M0({name:"a:srgbClr",attributes:{value:{key:"val",value:B.value}}}),tG=(B)=>new M0({name:"a:schemeClr",attributes:{value:{key:"val",value:B.value}}}),A8=(B)=>new M0({name:"a:solidFill",children:[B.type==="rgb"?oG(B):tG(B)]}),eG=(B)=>new M0({name:"a:ln",attributes:{width:{key:"w",value:B.width},cap:{key:"cap",value:B.cap},compoundLine:{key:"cmpd",value:B.compoundLine},align:{key:"algn",value:B.align}},children:[B.type==="noFill"?X4():B.solidFillType==="rgb"?A8({type:"rgb",value:B.value}):A8({type:"scheme",value:B.value})]}),BY=class extends t{constructor(){super("a:avLst")}},UY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{prst:"prst"})}},GY=class extends t{constructor(){super("a:prstGeom");this.root.push(new UY({prst:"rect"})),this.root.push(new BY)}},YY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{bwMode:"bwMode"})}},q4=class extends t{constructor({element:B,outline:U,solidFill:G,transform:Y}){super(`${B}:spPr`);if(e(this,"form",void 0),this.root.push(new YY({bwMode:"auto"})),this.form=new V4(Y),this.root.push(this.form),this.root.push(new GY),U)this.root.push(X4()),this.root.push(eG(U));if(G)this.root.push(A8(G))}},l6=(B)=>new M0({name:"wps:wsp",children:[mG(B.nonVisualProperties),new q4({element:"wps",transform:B.transformation,outline:B.outline,solidFill:B.solidFill}),aG(B.children),K4(B.bodyProperties)]}),K8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{uri:"uri"})}},ZY=(B)=>new M0({name:"asvg:svgBlip",attributes:{asvg:{key:"xmlns:asvg",value:"http://schemas.microsoft.com/office/drawing/2016/SVG/main"},embed:{key:"r:embed",value:`rId{${B.fileName}}`}}}),QY=(B)=>new M0({name:"a:ext",attributes:{uri:{key:"uri",value:"{96DAC541-7B7A-43D3-8B79-37D633B846F1}"}},children:[ZY(B)]}),JY=(B)=>new M0({name:"a:extLst",children:[QY(B)]}),KY=(B)=>new M0({name:"a:blip",attributes:{embed:{key:"r:embed",value:`rId{${B.type==="svg"?B.fallback.fileName:B.fileName}}`},cstate:{key:"cstate",value:"none"}},children:B.type==="svg"?[JY(B)]:[]}),VY=class extends t{constructor(){super("a:srcRect")}},XY=class extends t{constructor(){super("a:fillRect")}},qY=class extends t{constructor(){super("a:stretch");this.root.push(new XY)}},MY=class extends t{constructor(B){super("pic:blipFill");this.root.push(KY(B)),this.root.push(new VY),this.root.push(new qY)}},RY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{noChangeAspect:"noChangeAspect",noChangeArrowheads:"noChangeArrowheads"})}},LY=class extends t{constructor(){super("a:picLocks");this.root.push(new RY({noChangeAspect:1,noChangeArrowheads:1}))}},IY=class extends t{constructor(){super("pic:cNvPicPr");this.root.push(new LY)}},M4=(B,U)=>new M0({name:"a:hlinkClick",attributes:L0(L0({},U?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${B}`}})}),OY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"id",name:"name",descr:"descr"})}},HY=class extends t{constructor(){super("pic:cNvPr");this.root.push(new OY({id:0,name:"",descr:""}))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!1));break}return super.prepForXml(B)}},FY=class extends t{constructor(){super("pic:nvPicPr");this.root.push(new HY),this.root.push(new IY)}},WY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:pic"})}},a6=class extends t{constructor({mediaData:B,transform:U,outline:G}){super("pic:pic");this.root.push(new WY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/picture"})),this.root.push(new FY),this.root.push(new MY(B)),this.root.push(new q4({element:"pic",transform:U,outline:G}))}},PY=(B)=>new M0({name:"wpg:grpSpPr",children:[new V4(B)]}),AY=()=>new M0({name:"wpg:cNvGrpSpPr"}),jY=(B)=>new M0({name:"wpg:wgp",children:[AY(),PY(B.transformation),...B.children]}),NY=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphicData");if(B.type==="wps"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));let Q=l6(L0(L0({},B.data),{},{transformation:U,outline:G,solidFill:Y}));this.root.push(Q)}else if(B.type==="wpg"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"}));let Q=jY({children:B.children.map((K)=>{if(K.type==="wps")return l6(L0(L0({},K.data),{},{transformation:K.transformation,outline:K.outline,solidFill:K.solidFill}));else return new a6({mediaData:K,transform:K.transformation,outline:K.outline})}),transformation:U});this.root.push(Q)}else{this.root.push(new K8({uri:"http://schemas.openxmlformats.org/drawingml/2006/picture"}));let Q=new a6({mediaData:B,transform:U,outline:G});this.root.push(Q)}}},wY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{a:"xmlns:a"})}},R4=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphic");e(this,"data",void 0),this.root.push(new wY({a:"http://schemas.openxmlformats.org/drawingml/2006/main"})),this.data=new NY({mediaData:B,transform:U,outline:G,solidFill:Y}),this.root.push(this.data)}},e2={NONE:0,SQUARE:1,TIGHT:2,TOP_AND_BOTTOM:3},L4={BOTH_SIDES:"bothSides",LEFT:"left",RIGHT:"right",LARGEST:"largest"},j8=()=>new M0({name:"wp:wrapNone"}),I4=(B,U={top:0,bottom:0,left:0,right:0})=>new M0({name:"wp:wrapSquare",attributes:{wrapText:{key:"wrapText",value:B.side||L4.BOTH_SIDES},distT:{key:"distT",value:U.top},distB:{key:"distB",value:U.bottom},distL:{key:"distL",value:U.left},distR:{key:"distR",value:U.right}}}),O4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTight",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),H4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTopAndBottom",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),F4=class extends t{constructor({name:B,description:U,title:G,id:Y}={name:"",description:"",title:""}){super("wp:docPr");e(this,"docPropertiesUniqueNumericId",oB());let Q={id:{key:"id",value:Y!==null&&Y!==void 0?Y:this.docPropertiesUniqueNumericId()},name:{key:"name",value:B}};if(U!==null&&U!==void 0)Q.description={key:"descr",value:U};if(G!==null&&G!==void 0)Q.title={key:"title",value:G};this.root.push(new $8(Q))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!0));break}return super.prepForXml(B)}},W4=({top:B,right:U,bottom:G,left:Y})=>new M0({name:"wp:effectExtent",attributes:{top:{key:"t",value:B},right:{key:"r",value:U},bottom:{key:"b",value:G},left:{key:"l",value:Y}}}),P4=({x:B,y:U})=>new M0({name:"wp:extent",attributes:{x:{key:"cx",value:B},y:{key:"cy",value:U}}}),zY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:a",noChangeAspect:"noChangeAspect"})}},EY=class extends t{constructor(){super("a:graphicFrameLocks");this.root.push(new zY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/main",noChangeAspect:1}))}},A4=()=>new M0({name:"wp:cNvGraphicFramePr",children:[new EY]}),DY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{distT:"distT",distB:"distB",distL:"distL",distR:"distR",allowOverlap:"allowOverlap",behindDoc:"behindDoc",layoutInCell:"layoutInCell",locked:"locked",relativeHeight:"relativeHeight",simplePos:"simplePos"})}},TY=class extends t{constructor({mediaData:B,transform:U,drawingOptions:G}){super("wp:anchor");let Y=L0({allowOverlap:!0,behindDocument:!1,lockAnchor:!1,layoutInCell:!0,verticalPosition:{},horizontalPosition:{}},G.floating);if(this.root.push(new DY({distT:Y.margins?Y.margins.top||0:0,distB:Y.margins?Y.margins.bottom||0:0,distL:Y.margins?Y.margins.left||0:0,distR:Y.margins?Y.margins.right||0:0,simplePos:"0",allowOverlap:Y.allowOverlap===!0?"1":"0",behindDoc:Y.behindDocument===!0?"1":"0",locked:Y.lockAnchor===!0?"1":"0",layoutInCell:Y.layoutInCell===!0?"1":"0",relativeHeight:Y.zIndex?Y.zIndex:U.emus.y})),this.root.push(G4()),this.root.push(Q4(Y.horizontalPosition)),this.root.push(J4(Y.verticalPosition)),this.root.push(P4({x:U.emus.x,y:U.emus.y})),this.root.push(W4({top:0,right:0,bottom:0,left:0})),G.floating!==void 0&&G.floating.wrap!==void 0)switch(G.floating.wrap.type){case e2.SQUARE:this.root.push(I4(G.floating.wrap,G.floating.margins));break;case e2.TIGHT:this.root.push(O4(G.floating.margins));break;case e2.TOP_AND_BOTTOM:this.root.push(H4(G.floating.margins));break;case e2.NONE:default:this.root.push(j8())}else this.root.push(j8());this.root.push(new F4(G.docProperties)),this.root.push(A4()),this.root.push(new R4({mediaData:B,transform:U,outline:G.outline,solidFill:G.solidFill}))}},CY=({mediaData:B,transform:U,docProperties:G,outline:Y,solidFill:Q})=>{var K,Z,J,q;return new M0({name:"wp:inline",attributes:{distanceTop:{key:"distT",value:0},distanceBottom:{key:"distB",value:0},distanceLeft:{key:"distL",value:0},distanceRight:{key:"distR",value:0}},children:[P4({x:U.emus.x,y:U.emus.y}),W4(Y?{top:((K=Y.width)!==null&&K!==void 0?K:9525)*2,right:((Z=Y.width)!==null&&Z!==void 0?Z:9525)*2,bottom:((J=Y.width)!==null&&J!==void 0?J:9525)*2,left:((q=Y.width)!==null&&q!==void 0?q:9525)*2}:{top:0,right:0,bottom:0,left:0}),new F4(G),A4(),new R4({mediaData:B,transform:U,outline:Y,solidFill:Q})]})},m1=class extends t{constructor(B,U={}){super("w:drawing");if(!U.floating)this.root.push(CY({mediaData:B,transform:B.transformation,docProperties:U.docProperties,outline:U.outline,solidFill:U.solidFill}));else this.root.push(new TY({mediaData:B,transform:B.transformation,drawingOptions:U}))}},kY=(B)=>{let U=B.indexOf(";base64,"),G=U===-1?0:U+8;return new Uint8Array(atob(B.substring(G)).split("").map((Y)=>Y.charCodeAt(0)))},j4=(B)=>typeof B==="string"?kY(B):B,V8=(B,U)=>({data:j4(B.data),fileName:U,transformation:{pixels:{x:Math.round(B.transformation.width),y:Math.round(B.transformation.height)},emus:{x:Math.round(B.transformation.width*9525),y:Math.round(B.transformation.height*9525)},flip:B.transformation.flip,rotation:B.transformation.rotation?B.transformation.rotation*60000:void 0}}),$Y=class extends t{constructor(B){var U=(...Z)=>(super(...Z),e(this,"imageData",void 0),this);let G=`${P8(B.data)}.${B.type}`,Y=B.type==="svg"?L0(L0({type:B.type},V8(B,G)),{},{fallback:L0({type:B.fallback.type},V8(L0(L0({},B.fallback),{},{transformation:B.transformation}),`${P8(B.fallback.data)}.${B.fallback.type}`))}):L0({type:B.type},V8(B,G)),Q=new m1(Y,{floating:B.floating,docProperties:B.altText,outline:B.outline}),K=new D0({children:[Q]});if(B.insertion)U("w:ins"),this.root.push(new b0({id:B.insertion.id,author:B.insertion.author,date:B.insertion.date})),this.addChildElement(K);else if(B.deletion)U("w:del"),this.root.push(new b0({id:B.deletion.id,author:B.deletion.author,date:B.deletion.date})),this.addChildElement(K);else U("w:r"),this.root.push(new U2({})),this.root.push(Q);this.imageData=Y}prepForXml(B){if(B.file.Media.addImage(this.imageData.fileName,this.imageData),this.imageData.type==="svg")B.file.Media.addImage(this.imageData.fallback.fileName,this.imageData.fallback);return super.prepForXml(B)}},n8=(B)=>{var U,G,Y,Q,K,Z,J,q;return{offset:{pixels:{x:Math.round((U=(G=B.offset)===null||G===void 0?void 0:G.left)!==null&&U!==void 0?U:0),y:Math.round((Y=(Q=B.offset)===null||Q===void 0?void 0:Q.top)!==null&&Y!==void 0?Y:0)},emus:{x:Math.round(((K=(Z=B.offset)===null||Z===void 0?void 0:Z.left)!==null&&K!==void 0?K:0)*9525),y:Math.round(((J=(q=B.offset)===null||q===void 0?void 0:q.top)!==null&&J!==void 0?J:0)*9525)}},pixels:{x:Math.round(B.width),y:Math.round(B.height)},emus:{x:Math.round(B.width*9525),y:Math.round(B.height*9525)},flip:B.flip,rotation:B.rotation?B.rotation*60000:void 0}},SY=class extends D0{constructor(B){super({});e(this,"wpsShapeData",void 0),this.wpsShapeData={type:B.type,transformation:n8(B.transformation),data:L0({},B)};let U=new m1(this.wpsShapeData,{floating:B.floating,docProperties:B.altText,outline:B.outline,solidFill:B.solidFill});this.root.push(U)}},bY=class extends D0{constructor(B){super({});e(this,"wpgGroupData",void 0),e(this,"mediaDatas",void 0),this.wpgGroupData={type:B.type,transformation:n8(B.transformation),children:B.children};let U=new m1(this.wpgGroupData,{floating:B.floating,docProperties:B.altText});this.mediaDatas=B.children.filter((G)=>G.type!=="wps").map((G)=>G),this.root.push(U)}prepForXml(B){return this.mediaDatas.forEach((U)=>{if(B.file.Media.addImage(U.fileName,U),U.type==="svg")B.file.Media.addImage(U.fallback.fileName,U.fallback)}),super.prepForXml(B)}},vY=class extends t{constructor(B){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(`SEQ ${B}`)}},yY=class extends D0{constructor(B){super({});this.root.push(e0(!0)),this.root.push(new vY(B)),this.root.push(X2()),this.root.push(B2())}},gY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{instr:"w:instr"})}},s8=class extends t{constructor(B,U){super("w:fldSimple");if(this.root.push(new gY({instr:B})),U!==void 0)this.root.push(new Q1(U))}},fY=class extends s8{constructor(B){super(` MERGEFIELD ${B} `,`«${B}»`)}},xY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},N4={EXTERNAL:"External"},_Y=(B,U,G,Y)=>new M0({name:"Relationship",attributes:{id:{key:"Id",value:B},type:{key:"Type",value:U},target:{key:"Target",value:G},targetMode:{key:"TargetMode",value:Y}}}),A2=class extends t{constructor(){super("Relationships");this.root.push(new xY({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(B,U,G,Y){this.root.push(_Y(`rId${B}`,U,G,Y))}get RelationshipCount(){return this.root.length-1}},hY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},o8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},uY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}},dY=class extends t{constructor(B){super("w:commentRangeStart");this.root.push(new o8({id:B}))}},cY=class extends t{constructor(B){super("w:commentRangeEnd");this.root.push(new o8({id:B}))}},mY=class extends t{constructor(B){super("w:commentReference");this.root.push(new o8({id:B}))}},N8=class extends t{constructor({id:B,initials:U,author:G,date:Y=new Date,children:Q},K){super("w:comment");e(this,"paraId",void 0),this.paraId=K,this.root.push(new hY({id:B,initials:U,author:G,date:Y.toISOString()}));for(let Z of Q)this.root.push(Z)}prepForXml(B){let U=super.prepForXml(B);if(!U||!this.paraId)return U;let G=U["w:comment"];if(!Array.isArray(G))return U;for(let Y=G.length-1;Y>=0;Y--){let Q=G[Y];if(Q&&typeof Q==="object"&&"w:p"in Q){let K=Q["w:p"];if(Array.isArray(K))K.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return U}},w4=(B)=>(B+1).toString(16).toUpperCase().padStart(8,"0"),z4=class extends t{constructor({children:B}){super("w:comments");if(e(this,"relationships",void 0),e(this,"threadData",void 0),this.root.push(new uY({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"})),B.some((U)=>U.parentId!==void 0)){let U=new Map(B.map((G)=>[G.id,w4(G.id)]));for(let G of B)this.root.push(new N8(G,U.get(G.id)));this.threadData=B.map((G)=>({paraId:U.get(G.id),parentParaId:G.parentId!==void 0?U.get(G.parentId):void 0,done:G.resolved}))}else for(let U of B)this.root.push(new N8(U));this.relationships=new A2}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}},lY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},aY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},pY=class extends t{constructor(B){super("w15:commentEx");this.root.push(new aY({paraId:B.paraId,paraIdParent:B.parentParaId,done:B.done!==void 0?B.done?"1":"0":void 0}))}},E4=class extends t{constructor(B){super("w15:commentsEx");this.root.push(new lY({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let U of B)this.root.push(new pY(U))}},rY=class extends S0{constructor(){super("w:noBreakHyphen")}},iY=class extends S0{constructor(){super("w:softHyphen")}},nY=class extends S0{constructor(){super("w:dayShort")}},sY=class extends S0{constructor(){super("w:monthShort")}},oY=class extends S0{constructor(){super("w:yearShort")}},tY=class extends S0{constructor(){super("w:dayLong")}},eY=class extends S0{constructor(){super("w:monthLong")}},BZ=class extends S0{constructor(){super("w:yearLong")}},UZ=class extends S0{constructor(){super("w:annotationRef")}},GZ=class extends S0{constructor(){super("w:footnoteRef")}},D4=class extends S0{constructor(){super("w:endnoteRef")}},YZ=class extends S0{constructor(){super("w:separator")}},ZZ=class extends S0{constructor(){super("w:continuationSeparator")}},QZ=class extends S0{constructor(){super("w:pgNum")}},JZ=class extends S0{constructor(){super("w:cr")}},T4=class extends S0{constructor(){super("w:tab")}},KZ=class extends S0{constructor(){super("w:lastRenderedPageBreak")}},VZ={LEFT:"left",CENTER:"center",RIGHT:"right"},XZ={MARGIN:"margin",INDENT:"indent"},qZ={NONE:"none",DOT:"dot",HYPHEN:"hyphen",UNDERSCORE:"underscore",MIDDLE_DOT:"middleDot"},MZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{alignment:"w:alignment",relativeTo:"w:relativeTo",leader:"w:leader"})}},RZ=class extends t{constructor(B){super("w:ptab");this.root.push(new MZ({alignment:B.alignment,relativeTo:B.relativeTo,leader:B.leader}))}},C4={COLUMN:"column",PAGE:"page"},k4=class extends t{constructor(B){super("w:br");this.root.push(new C0({type:B}))}},LZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.PAGE))}},IZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.COLUMN))}},$4=class extends t{constructor(){super("w:pageBreakBefore")}},k2={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},S4=({after:B,before:U,line:G,lineRule:Y,beforeAutoSpacing:Q,afterAutoSpacing:K})=>new M0({name:"w:spacing",attributes:{after:{key:"w:after",value:B},before:{key:"w:before",value:U},line:{key:"w:line",value:G},lineRule:{key:"w:lineRule",value:Y},beforeAutoSpacing:{key:"w:beforeAutospacing",value:Q},afterAutoSpacing:{key:"w:afterAutospacing",value:K}}}),OZ={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},x2=(B)=>new M0({name:"w:pStyle",attributes:{val:{key:"w:val",value:B}}}),w8={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},HZ={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},FZ={MAX:9026},b4=({type:B,position:U,leader:G})=>new M0({name:"w:tab",attributes:{val:{key:"w:val",value:B},pos:{key:"w:pos",value:U},leader:{key:"w:leader",value:G}}}),v4=(B)=>new M0({name:"w:tabs",children:B.map((U)=>b4(U))}),C1=class extends t{constructor(B,U){super("w:numPr");this.root.push(new WZ(U)),this.root.push(new PZ(B))}},WZ=class extends t{constructor(B){super("w:ilvl");if(B>9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new C0({val:B}))}},PZ=class extends t{constructor(B){super("w:numId");this.root.push(new C0({val:typeof B==="string"?`{${B}}`:B}))}},H1=class extends t{constructor(...B){super(...B);e(this,"fileChild",Symbol())}},AZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},jZ={INTERNAL:"INTERNAL",EXTERNAL:"EXTERNAL"},m2=class extends t{constructor(B,U,G){super("w:hyperlink");e(this,"linkId",void 0),this.linkId=U;let Y=new AZ({history:1,anchor:G?G:void 0,id:!G?`rId${this.linkId}`:void 0});this.root.push(Y),B.forEach((Q)=>{this.root.push(Q)})}},y4=class extends m2{constructor(B){super(B.children,O1(),B.anchor)}},t8=class extends t{constructor(B){super("w:externalHyperlink");e(this,"options",void 0),this.options=B}},NZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",name:"w:name"})}},wZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},g4=class{constructor(B){e(this,"bookmarkUniqueNumericId",tB()),e(this,"start",void 0),e(this,"children",void 0),e(this,"end",void 0);let U=this.bookmarkUniqueNumericId();this.start=new f4(B.id,U),this.children=B.children,this.end=new x4(U)}},f4=class extends t{constructor(B,U){super("w:bookmarkStart");let G=new NZ({name:B,id:U});this.root.push(G)}},x4=class extends t{constructor(B){super("w:bookmarkEnd");let U=new wZ({id:B});this.root.push(U)}},zZ=function(B){return B.NONE="none",B.RELATIVE="relative",B.NO_CONTEXT="no_context",B.FULL_CONTEXT="full_context",B}({}),EZ={["relative"]:"\\r",["no_context"]:"\\n",["full_context"]:"\\w",["none"]:void 0},DZ=class extends s8{constructor(B,U,G={}){let{hyperlink:Y=!0,referenceFormat:Q="full_context"}=G,K=`${`REF ${B}`} ${[...Y?["\\h"]:[],...[EZ[Q]].filter((Z)=>!!Z)].join(" ")}`;super(K,U)}},_4=(B)=>new M0({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:B}}}),TZ=class extends t{constructor(B,U={}){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE}));let G=`PAGEREF ${B}`;if(U.hyperlink)G=`${G} \\h`;if(U.useRelativePosition)G=`${G} \\p`;this.root.push(G)}},CZ=class extends D0{constructor(B,U={}){super({children:[e0(!0),new TZ(B,U),B2()]})}},kZ={ANSI:"00",DEFAULT:"01",SYMBOL:"02",MAC:"4D",JIS:"80",HANGUL:"81",JOHAB:"82",GB_2312:"86",CHINESEBIG5:"88",GREEK:"A1",TURKISH:"A2",VIETNAMESE:"A3",HEBREW:"B1",ARABIC:"B2",BALTIC:"BA",RUSSIAN:"CC",THAI:"DE",EASTEUROPE:"EE",OEM:"FF"},E1=({id:B,fontKey:U,subsetted:G},Y)=>new M0({name:Y,attributes:L0({id:{key:"r:id",value:B}},U?{fontKey:{key:"w:fontKey",value:`{${U}}`}}:{}),children:[...G?[new q0("w:subsetted",G)]:[]]}),$Z=({name:B,altName:U,panose1:G,charset:Y,family:Q,notTrueType:K,pitch:Z,sig:J,embedRegular:q,embedBold:W,embedItalic:I,embedBoldItalic:H})=>new M0({name:"w:font",attributes:{name:{key:"w:name",value:B}},children:[...U?[f2("w:altName",U)]:[],...G?[f2("w:panose1",G)]:[],...Y?[f2("w:charset",Y)]:[],...Q?[f2("w:family",Q)]:[],...K?[new q0("w:notTrueType",K)]:[],...Z?[f2("w:pitch",Z)]:[],...J?[new M0({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:J.usb0},usb1:{key:"w:usb1",value:J.usb1},usb2:{key:"w:usb2",value:J.usb2},usb3:{key:"w:usb3",value:J.usb3},csb0:{key:"w:csb0",value:J.csb0},csb1:{key:"w:csb1",value:J.csb1}}})]:[],...q?[E1(q,"w:embedRegular")]:[],...W?[E1(W,"w:embedBold")]:[],...I?[E1(I,"w:embedItalic")]:[],...H?[E1(H,"w:embedBoldItalic")]:[]]}),SZ=({name:B,index:U,fontKey:G,characterSet:Y})=>$Z({name:B,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:Y,family:"auto",pitch:"variable",embedRegular:{fontKey:G,id:`rId${U}`}}),bZ=(B)=>new M0({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:B.map((U,G)=>SZ({name:U.name,index:G+1,fontKey:U.fontKey,characterSet:U.characterSet}))}),h4=class{constructor(B){e(this,"options",void 0),e(this,"fontTable",void 0),e(this,"relationships",void 0),e(this,"fontOptionsWithKey",[]),this.options=B,this.fontOptionsWithKey=B.map((U)=>L0(L0({},U),{},{fontKey:eB()})),this.fontTable=bZ(this.fontOptionsWithKey),this.relationships=new A2;for(let U=0;Unew M0({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),yZ={NONE:"none",DROP:"drop",MARGIN:"margin"},gZ={MARGIN:"margin",PAGE:"page",TEXT:"text"},fZ={AROUND:"around",AUTO:"auto",NONE:"none",NOT_BESIDE:"notBeside",THROUGH:"through",TIGHT:"tight"},u4=(B)=>{var U,G;return new M0({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:B.anchorLock},dropCap:{key:"w:dropCap",value:B.dropCap},width:{key:"w:w",value:B.width},height:{key:"w:h",value:B.height},x:{key:"w:x",value:B.position?B.position.x:void 0},y:{key:"w:y",value:B.position?B.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:B.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:B.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(U=B.space)===null||U===void 0?void 0:U.horizontal},spaceVertical:{key:"w:vSpace",value:(G=B.space)===null||G===void 0?void 0:G.vertical},rule:{key:"w:hRule",value:B.rule},alignmentX:{key:"w:xAlign",value:B.alignment?B.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:B.alignment?B.alignment.y:void 0},lines:{key:"w:lines",value:B.lines},wrap:{key:"w:wrap",value:B.wrap}}})},M2=class extends R2{constructor(B){super("w:pPr",B===null||B===void 0?void 0:B.includeIfEmpty);if(e(this,"numberingReferences",[]),!B)return this;if(B.heading)this.push(x2(B.heading));if(B.bullet)this.push(x2("ListParagraph"));if(B.numbering){if(!B.style&&!B.heading){if(!B.numbering.custom)this.push(x2("ListParagraph"))}}if(B.style)this.push(x2(B.style));if(B.keepNext!==void 0)this.push(new q0("w:keepNext",B.keepNext));if(B.keepLines!==void 0)this.push(new q0("w:keepLines",B.keepLines));if(B.pageBreakBefore)this.push(new $4);if(B.frame)this.push(u4(B.frame));if(B.widowControl!==void 0)this.push(new q0("w:widowControl",B.widowControl));if(B.bullet)this.push(new C1(1,B.bullet.level));if(B.numbering){var U,G;this.numberingReferences.push({reference:B.numbering.reference,instance:(U=B.numbering.instance)!==null&&U!==void 0?U:0}),this.push(new C1(`${B.numbering.reference}-${(G=B.numbering.instance)!==null&&G!==void 0?G:0}`,B.numbering.level))}else if(B.numbering===!1)this.push(new C1(0,0));if(B.border)this.push(new xB(B.border));if(B.thematicBreak)this.push(new _B);if(B.shading)this.push(M1(B.shading));if(B.wordWrap)this.push(vZ());if(B.overflowPunctuation)this.push(new q0("w:overflowPunct",B.overflowPunctuation));let Y=[...B.rightTabStop!==void 0?[{type:w8.RIGHT,position:B.rightTabStop}]:[],...B.tabStops?B.tabStops:[],...B.leftTabStop!==void 0?[{type:w8.LEFT,position:B.leftTabStop}]:[]];if(Y.length>0)this.push(v4(Y));if(B.bidirectional!==void 0)this.push(new q0("w:bidi",B.bidirectional));if(B.spacing)this.push(S4(B.spacing));if(B.indent)this.push(hB(B.indent));if(B.contextualSpacing!==void 0)this.push(new q0("w:contextualSpacing",B.contextualSpacing));if(B.alignment)this.push(m8(B.alignment));if(B.outlineLevel!==void 0)this.push(_4(B.outlineLevel));if(B.suppressLineNumbers!==void 0)this.push(new q0("w:suppressLineNumbers",B.suppressLineNumbers));if(B.autoSpaceEastAsianText!==void 0)this.push(new q0("w:autoSpaceDN",B.autoSpaceEastAsianText));if(B.run)this.push(new mB(B.run));if(B.revision)this.push(new d4(B.revision))}push(B){this.root.push(B)}prepForXml(B){if(!(B.viewWrapper instanceof h4))for(let U of this.numberingReferences)B.file.Numbering.createConcreteNumberingInstance(U.reference,U.instance);return super.prepForXml(B)}},d4=class extends t{constructor(B){super("w:pPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new M2(L0(L0({},B),{},{includeIfEmpty:!0})))}},d0=class extends H1{constructor(B){super("w:p");if(e(this,"properties",void 0),typeof B==="string")return this.properties=new M2({}),this.root.push(this.properties),this.root.push(new Q1(B)),this;if(this.properties=new M2(B),this.root.push(this.properties),B.text)this.root.push(new Q1(B.text));if(B.children)for(let U of B.children){if(U instanceof g4){this.root.push(U.start);for(let G of U.children)this.root.push(G);this.root.push(U.end);continue}this.root.push(U)}}prepForXml(B){for(let U of this.root)if(U instanceof t8){let G=this.root.indexOf(U),Y=new m2(U.options.children,O1());B.viewWrapper.Relationships.addRelationship(Y.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",U.options.link,N4.EXTERNAL),this.root[G]=Y}return super.prepForXml(B)}addRunToFront(B){return this.root.splice(1,0,B),this}},xZ=class extends t{constructor(B){super("m:oMath");for(let U of B.children)this.root.push(U)}},_Z=class extends t{constructor(B){super("m:t");this.root.push(B)}},hZ=class extends t{constructor(B){super("m:r");this.root.push(new _Z(B))}},c4=class extends t{constructor(B){super("m:den");for(let U of B)this.root.push(U)}},m4=class extends t{constructor(B){super("m:num");for(let U of B)this.root.push(U)}},uZ=class extends t{constructor(B){super("m:f");this.root.push(new m4(B.numerator)),this.root.push(new c4(B.denominator))}},l4=({accent:B})=>new M0({name:"m:chr",attributes:{accent:{key:"m:val",value:B}}}),y0=({children:B})=>new M0({name:"m:e",children:B}),a4=({value:B})=>new M0({name:"m:limLoc",attributes:{value:{key:"m:val",value:B||"undOvr"}}}),dZ=()=>new M0({name:"m:subHide",attributes:{hide:{key:"m:val",value:1}}}),cZ=()=>new M0({name:"m:supHide",attributes:{hide:{key:"m:val",value:1}}}),e8=({accent:B,hasSuperScript:U,hasSubScript:G,limitLocationVal:Y})=>new M0({name:"m:naryPr",children:[...B?[l4({accent:B})]:[],a4({value:Y}),...!U?[cZ()]:[],...!G?[dZ()]:[]]}),l2=({children:B})=>new M0({name:"m:sub",children:B}),a2=({children:B})=>new M0({name:"m:sup",children:B}),mZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"∑",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},lZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript,limitLocationVal:"subSup"})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},B6=class extends t{constructor(B){super("m:lim");for(let U of B)this.root.push(U)}},aZ=class extends t{constructor(B){super("m:limUpp");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},pZ=class extends t{constructor(B){super("m:limLow");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},p4=()=>new M0({name:"m:sSupPr"}),rZ=class extends t{constructor(B){super("m:sSup");this.root.push(p4()),this.root.push(y0({children:B.children})),this.root.push(a2({children:B.superScript}))}},r4=()=>new M0({name:"m:sSubPr"}),iZ=class extends t{constructor(B){super("m:sSub");this.root.push(r4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript}))}},i4=()=>new M0({name:"m:sSubSupPr"}),nZ=class extends t{constructor(B){super("m:sSubSup");this.root.push(i4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript})),this.root.push(a2({children:B.superScript}))}},n4=()=>new M0({name:"m:sPrePr"}),sZ=class extends M0{constructor({children:B,subScript:U,superScript:G}){super({name:"m:sPre",children:[n4(),y0({children:B}),l2({children:U}),a2({children:G})]})}},oZ="",s4=class extends t{constructor(B){super("m:deg");if(B)for(let U of B)this.root.push(U)}},tZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{hide:"m:val"})}},eZ=class extends t{constructor(){super("m:degHide");this.root.push(new tZ({hide:1}))}},o4=class extends t{constructor(B){super("m:radPr");if(!B)this.root.push(new eZ)}},BQ=class extends t{constructor(B){super("m:rad");this.root.push(new o4(!!B.degree)),this.root.push(new s4(B.degree)),this.root.push(y0({children:B.children}))}},t4=class extends t{constructor(B){super("m:fName");for(let U of B)this.root.push(U)}},e4=class extends t{constructor(){super("m:funcPr")}},UQ=class extends t{constructor(B){super("m:func");this.root.push(new e4),this.root.push(new t4(B.name)),this.root.push(y0({children:B.children}))}},GQ=({character:B})=>new M0({name:"m:begChr",attributes:{character:{key:"m:val",value:B}}}),YQ=({character:B})=>new M0({name:"m:endChr",attributes:{character:{key:"m:val",value:B}}}),l1=({characters:B})=>new M0({name:"m:dPr",children:B?[GQ({character:B.beginningCharacter}),YQ({character:B.endingCharacter})]:[]}),ZQ=class extends t{constructor(B){super("m:d");this.root.push(l1({})),this.root.push(y0({children:B.children}))}},QQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"[",endingCharacter:"]"}})),this.root.push(y0({children:B.children}))}},JQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"{",endingCharacter:"}"}})),this.root.push(y0({children:B.children}))}},KQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"〈",endingCharacter:"〉"}})),this.root.push(y0({children:B.children}))}},VQ=(B)=>new M0({name:"w:gridCol",attributes:B!==void 0?{width:{key:"w:w",value:E0(B)}}:void 0}),B9=class extends t{constructor(B,U){super("w:tblGrid");for(let G of B)this.root.push(VQ(G));if(U)this.root.push(new qQ(U))}},XQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},qQ=class extends t{constructor(B){super("w:tblGridChange");this.root.push(new XQ({id:B.id})),this.root.push(new B9(B.columnWidths))}},MQ=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new Q1(B))}},RQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},LQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},IQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},p6=class extends t{constructor(B){super("w:delText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B)}},OQ=class extends t{constructor(B){super("w:del");e(this,"deletedTextRunWrapper",void 0),this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.deletedTextRunWrapper=new HQ(B),this.addChildElement(this.deletedTextRunWrapper)}},HQ=class extends t{constructor(B){super("w:r");if(this.root.push(new U2(B)),B.children)for(let U of B.children){if(typeof U==="string"){switch(U){case F2.CURRENT:this.root.push(e0()),this.root.push(new RQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES:this.root.push(e0()),this.root.push(new LQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES_IN_SECTION:this.root.push(e0()),this.root.push(new IQ),this.root.push(X2()),this.root.push(B2());break;default:this.root.push(new p6(U));break}continue}this.root.push(U)}else if(B.text)this.root.push(new p6(B.text));if(B.break)for(let U=0;Unew M0({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:B}}}),X9=({marginUnitType:B=v1.DXA,top:U,left:G,bottom:Y,right:Q})=>[{name:"w:top",size:U},{name:"w:left",size:G},{name:"w:bottom",size:Y},{name:"w:right",size:Q}].filter((K)=>K.size!==void 0).map(({name:K,size:Z})=>J1(K,{type:B,size:Z})),PQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tblCellMar",children:U})},AQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tcMar",children:U})},v1={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},J1=(B,{type:U=v1.AUTO,size:G})=>{let Y=G;if(U===v1.PERCENTAGE&&typeof G==="number")Y=`${G}%`;return new M0({name:B,attributes:{type:{key:"w:type",value:U},size:{key:"w:w",value:c8(Y)}}})},q9=class extends R2{constructor(B){super("w:tcBorders");if(B.top)this.root.push(j0("w:top",B.top));if(B.start)this.root.push(j0("w:start",B.start));if(B.left)this.root.push(j0("w:left",B.left));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.end)this.root.push(j0("w:end",B.end));if(B.right)this.root.push(j0("w:right",B.right))}},jQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},M9=class extends t{constructor(B){super("w:gridSpan");this.root.push(new jQ({val:T0(B)}))}},G6={CONTINUE:"continue",RESTART:"restart"},NQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},z8=class extends t{constructor(B){super("w:vMerge");this.root.push(new NQ({val:B}))}},wQ={BOTTOM_TO_TOP_LEFT_TO_RIGHT:"btLr",LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},zQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},R9=class extends t{constructor(B){super("w:textDirection");this.root.push(new zQ({val:B}))}},L9=class extends R2{constructor(B){super("w:tcPr",B.includeIfEmpty);if(B.width)this.root.push(J1("w:tcW",B.width));if(B.columnSpan)this.root.push(new M9(B.columnSpan));if(B.verticalMerge)this.root.push(new z8(B.verticalMerge));else if(B.rowSpan&&B.rowSpan>1)this.root.push(new z8(G6.RESTART));if(B.borders)this.root.push(new q9(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.margins){let U=AQ(B.margins);if(U)this.root.push(U)}if(B.textDirection)this.root.push(new R9(B.textDirection));if(B.verticalAlign)this.root.push(U6(B.verticalAlign));if(B.insertion)this.root.push(new Y9(B.insertion));if(B.deletion)this.root.push(new Z9(B.deletion));if(B.revision)this.root.push(new EQ(B.revision));if(B.cellMerge)this.root.push(new J9(B.cellMerge))}},EQ=class extends t{constructor(B){super("w:tcPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new L9(L0(L0({},B),{},{includeIfEmpty:!0})))}},Y6=class extends t{constructor(B){super("w:tc");e(this,"options",void 0),this.options=B,this.root.push(new L9(B));for(let U of B.children)this.root.push(U)}prepForXml(B){if(!(this.root[this.root.length-1]instanceof d0))this.root.push(new d0({}));return super.prepForXml(B)}},v2={style:c1.NONE,size:0,color:"auto"},y2={style:c1.SINGLE,size:4,color:"auto"},Z6=class extends t{constructor(B){var U,G,Y,Q,K,Z;super("w:tblBorders");this.root.push(j0("w:top",(U=B.top)!==null&&U!==void 0?U:y2)),this.root.push(j0("w:left",(G=B.left)!==null&&G!==void 0?G:y2)),this.root.push(j0("w:bottom",(Y=B.bottom)!==null&&Y!==void 0?Y:y2)),this.root.push(j0("w:right",(Q=B.right)!==null&&Q!==void 0?Q:y2)),this.root.push(j0("w:insideH",(K=B.insideHorizontal)!==null&&K!==void 0?K:y2)),this.root.push(j0("w:insideV",(Z=B.insideVertical)!==null&&Z!==void 0?Z:y2))}};e(Z6,"NONE",{top:v2,bottom:v2,left:v2,right:v2,insideHorizontal:v2,insideVertical:v2});var DQ={MARGIN:"margin",PAGE:"page",TEXT:"text"},TQ={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},CQ={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},kQ={NEVER:"never",OVERLAP:"overlap"},$Q=(B)=>new M0({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:B}}}),I9=({horizontalAnchor:B,verticalAnchor:U,absoluteHorizontalPosition:G,relativeHorizontalPosition:Y,absoluteVerticalPosition:Q,relativeVerticalPosition:K,bottomFromText:Z,topFromText:J,leftFromText:q,rightFromText:W,overlap:I})=>new M0({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:q===void 0?void 0:E0(q)},rightFromText:{key:"w:rightFromText",value:W===void 0?void 0:E0(W)},topFromText:{key:"w:topFromText",value:J===void 0?void 0:E0(J)},bottomFromText:{key:"w:bottomFromText",value:Z===void 0?void 0:E0(Z)},absoluteHorizontalPosition:{key:"w:tblpX",value:G===void 0?void 0:t0(G)},absoluteVerticalPosition:{key:"w:tblpY",value:Q===void 0?void 0:t0(Q)},horizontalAnchor:{key:"w:horzAnchor",value:B},relativeHorizontalPosition:{key:"w:tblpXSpec",value:Y},relativeVerticalPosition:{key:"w:tblpYSpec",value:K},verticalAnchor:{key:"w:vertAnchor",value:U}},children:I?[$Q(I)]:void 0}),SQ={AUTOFIT:"autofit",FIXED:"fixed"},O9=(B)=>new M0({name:"w:tblLayout",attributes:{type:{key:"w:type",value:B}}}),bQ={DXA:"dxa",NIL:"nil"},H9=({type:B=bQ.DXA,value:U})=>new M0({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:B},value:{key:"w:w",value:c8(U)}}}),F9=({firstRow:B,lastRow:U,firstColumn:G,lastColumn:Y,noHBand:Q,noVBand:K})=>new M0({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:B},lastRow:{key:"w:lastRow",value:U},firstColumn:{key:"w:firstColumn",value:G},lastColumn:{key:"w:lastColumn",value:Y},noHBand:{key:"w:noHBand",value:Q},noVBand:{key:"w:noVBand",value:K}}}),Q6=class extends R2{constructor(B){super("w:tblPr",B.includeIfEmpty);if(B.style)this.root.push(new q2("w:tblStyle",B.style));if(B.float)this.root.push(I9(B.float));if(B.visuallyRightToLeft!==void 0)this.root.push(new q0("w:bidiVisual",B.visuallyRightToLeft));if(B.width)this.root.push(J1("w:tblW",B.width));if(B.alignment)this.root.push(m8(B.alignment));if(B.indent)this.root.push(J1("w:tblInd",B.indent));if(B.borders)this.root.push(new Z6(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.layout)this.root.push(O9(B.layout));if(B.cellMargin){let U=PQ(B.cellMargin);if(U)this.root.push(U)}if(B.tableLook)this.root.push(F9(B.tableLook));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.revision)this.root.push(new vQ(B.revision))}},vQ=class extends t{constructor(B){super("w:tblPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new Q6(L0(L0({},B),{},{includeIfEmpty:!0})))}},yQ=class extends H1{constructor({rows:B,width:U,columnWidths:G=Array(Math.max(...B.map((j)=>j.CellCount))).fill(100),columnWidthsRevision:Y,margins:Q,indent:K,float:Z,layout:J,style:q,borders:W,alignment:I,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P}){super("w:tbl");this.root.push(new Q6({borders:W!==null&&W!==void 0?W:{},width:U!==null&&U!==void 0?U:{size:100},indent:K,float:Z,layout:J,style:q,alignment:I,cellMargin:Q,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P})),this.root.push(new B9(G,Y));for(let j of B)this.root.push(j);B.forEach((j,E)=>{if(E===B.length-1)return;let C=0;j.cells.forEach((N)=>{if(N.options.rowSpan&&N.options.rowSpan>1){let v=new Y6({rowSpan:N.options.rowSpan-1,columnSpan:N.options.columnSpan,borders:N.options.borders,children:[],verticalMerge:G6.CONTINUE});B[E+1].addCellToColumnIndex(v,C)}C+=N.options.columnSpan||1})})}},gQ={AUTO:"auto",ATLEAST:"atLeast",EXACT:"exact"},W9=(B,U)=>new M0({name:"w:trHeight",attributes:{value:{key:"w:val",value:E0(B)},rule:{key:"w:hRule",value:U}}}),J6=class extends R2{constructor(B){super("w:trPr",B.includeIfEmpty);if(B.cantSplit!==void 0)this.root.push(new q0("w:cantSplit",B.cantSplit));if(B.tableHeader!==void 0)this.root.push(new q0("w:tblHeader",B.tableHeader));if(B.height)this.root.push(W9(B.height.value,B.height.rule));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.insertion)this.root.push(new U9(B.insertion));if(B.deletion)this.root.push(new G9(B.deletion));if(B.revision)this.root.push(new P9(B.revision))}},P9=class extends t{constructor(B){super("w:trPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new J6(L0(L0({},B),{},{includeIfEmpty:!0})))}},fQ=class extends t{constructor(B){super("w:tr");e(this,"options",void 0),this.options=B,this.root.push(new J6(B));for(let U of B.children)this.root.push(U)}get CellCount(){return this.options.children.length}get cells(){return this.root.filter((B)=>B instanceof Y6)}addCellToIndex(B,U){this.root.splice(U+1,0,B)}addCellToColumnIndex(B,U){let G=this.columnIndexToRootIndex(U,!0);this.addCellToIndex(B,G-1)}rootIndexToColumnIndex(B){if(B<1||B>=this.root.length)throw Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let U=0;for(let G=1;G=this.root.length)if(U)return this.root.length;else throw Error(`cell 'columnIndex' should not great than ${G-1}`);let Q=this.root[Y];Y+=1,G+=Q&&Q.options.columnSpan||1}return Y-1}},xQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},_Q=class extends t{constructor(){super("Properties");this.root.push(new xQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},hQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},V2=(B,U)=>new M0({name:"Default",attributes:{contentType:{key:"ContentType",value:B},extension:{key:"Extension",value:U}}}),f0=(B,U)=>new M0({name:"Override",attributes:{contentType:{key:"ContentType",value:B},partName:{key:"PartName",value:U}}}),uQ=class extends t{constructor(){super("Types");this.root.push(new hQ({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(V2("image/png","png")),this.root.push(V2("image/jpeg","jpeg")),this.root.push(V2("image/jpeg","jpg")),this.root.push(V2("image/bmp","bmp")),this.root.push(V2("image/gif","gif")),this.root.push(V2("image/svg+xml","svg")),this.root.push(V2("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(V2("application/xml","xml")),this.root.push(V2("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(f0("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addCommentsExtended(){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addFooter(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${B}.xml`))}addHeader(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${B}.xml`))}},y1={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},F1=class extends H0{constructor(B,U){super(L0({Ignorable:U},Object.fromEntries(B.map((G)=>[G,y1[G]]))));e(this,"xmlKeys",L0({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(y1).map((G)=>[G,`xmlns:${G}`]))))}},dQ=class extends t{constructor(B){super("cp:coreProperties");if(this.root.push(new F1(["cp","dc","dcterms","dcmitype","xsi"])),B.title)this.root.push(new O2("dc:title",B.title));if(B.subject)this.root.push(new O2("dc:subject",B.subject));if(B.creator)this.root.push(new O2("dc:creator",B.creator));if(B.keywords)this.root.push(new O2("cp:keywords",B.keywords));if(B.description)this.root.push(new O2("dc:description",B.description));if(B.lastModifiedBy)this.root.push(new O2("cp:lastModifiedBy",B.lastModifiedBy));if(B.revision)this.root.push(new O2("cp:revision",String(B.revision)));this.root.push(new r6("dcterms:created")),this.root.push(new r6("dcterms:modified"))}},cQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"xsi:type"})}},r6=class extends t{constructor(B){super(B);this.root.push(new cQ({type:"dcterms:W3CDTF"})),this.root.push(fB(new Date))}},mQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},lQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},aQ=class extends t{constructor(B,U){super("property");this.root.push(new lQ({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:B.toString(),name:U.name})),this.root.push(new pQ(U.value))}},pQ=class extends t{constructor(B){super("vt:lpwstr");this.root.push(B)}},rQ=class extends t{constructor(B){super("Properties");e(this,"nextId",void 0),e(this,"properties",[]),this.root.push(new mQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let U of B)this.addCustomProperty(U)}prepForXml(B){return this.properties.forEach((U)=>this.root.push(U)),super.prepForXml(B)}addCustomProperty(B){this.properties.push(new aQ(this.nextId++,B))}},A9=({space:B,count:U,separate:G,equalWidth:Y,children:Q})=>new M0({name:"w:cols",attributes:{space:{key:"w:space",value:B===void 0?void 0:E0(B)},count:{key:"w:num",value:U===void 0?void 0:T0(U)},separate:{key:"w:sep",value:G},equalWidth:{key:"w:equalWidth",value:Y}},children:!Y&&Q?Q:void 0}),iQ={DEFAULT:"default",LINES:"lines",LINES_AND_CHARS:"linesAndChars",SNAP_TO_CHARS:"snapToChars"},j9=({type:B,linePitch:U,charSpace:G})=>new M0({name:"w:docGrid",attributes:{type:{key:"w:type",value:B},linePitch:{key:"w:linePitch",value:T0(U)},charSpace:{key:"w:charSpace",value:G?T0(G):void 0}}}),T2={DEFAULT:"default",FIRST:"first",EVEN:"even"},E8={HEADER:"w:headerReference",FOOTER:"w:footerReference"},k1=(B,U)=>new M0({name:B,attributes:{type:{key:"w:type",value:U.type||T2.DEFAULT},id:{key:"r:id",value:`rId${U.id}`}}}),nQ={NEW_PAGE:"newPage",NEW_SECTION:"newSection",CONTINUOUS:"continuous"},N9=({countBy:B,start:U,restart:G,distance:Y})=>new M0({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:B===void 0?void 0:T0(B)},start:{key:"w:start",value:U===void 0?void 0:T0(U)},restart:{key:"w:restart",value:G},distance:{key:"w:distance",value:Y===void 0?void 0:E0(Y)}}}),sQ={ALL_PAGES:"allPages",FIRST_PAGE:"firstPage",NOT_FIRST_PAGE:"notFirstPage"},oQ={PAGE:"page",TEXT:"text"},tQ={BACK:"back",FRONT:"front"},i6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},w9=class extends R2{constructor(B){super("w:pgBorders");if(!B)return this;if(B.pageBorders)this.root.push(new i6({display:B.pageBorders.display,offsetFrom:B.pageBorders.offsetFrom,zOrder:B.pageBorders.zOrder}));else this.root.push(new i6({}));if(B.pageBorderTop)this.root.push(j0("w:top",B.pageBorderTop));if(B.pageBorderLeft)this.root.push(j0("w:left",B.pageBorderLeft));if(B.pageBorderBottom)this.root.push(j0("w:bottom",B.pageBorderBottom));if(B.pageBorderRight)this.root.push(j0("w:right",B.pageBorderRight))}},z9=(B,U,G,Y,Q,K,Z)=>new M0({name:"w:pgMar",attributes:{top:{key:"w:top",value:t0(B)},right:{key:"w:right",value:E0(U)},bottom:{key:"w:bottom",value:t0(G)},left:{key:"w:left",value:E0(Y)},header:{key:"w:header",value:E0(Q)},footer:{key:"w:footer",value:E0(K)},gutter:{key:"w:gutter",value:E0(Z)}}}),eQ={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},E9=({start:B,formatType:U,separator:G})=>new M0({name:"w:pgNumType",attributes:{start:{key:"w:start",value:B===void 0?void 0:T0(B)},formatType:{key:"w:fmt",value:U},separator:{key:"w:chapSep",value:G}}}),g1={PORTRAIT:"portrait",LANDSCAPE:"landscape"},D9=({width:B,height:U,orientation:G,code:Y})=>{let Q=E0(B),K=E0(U);return new M0({name:"w:pgSz",attributes:{width:{key:"w:w",value:G===g1.LANDSCAPE?K:Q},height:{key:"w:h",value:G===g1.LANDSCAPE?Q:K},orientation:{key:"w:orient",value:G},code:{key:"w:code",value:Y}}})},BJ={LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},UJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},T9=class extends t{constructor(B){super("w:textDirection");this.root.push(new UJ({val:B}))}},GJ={NEXT_PAGE:"nextPage",NEXT_COLUMN:"nextColumn",CONTINUOUS:"continuous",EVEN_PAGE:"evenPage",ODD_PAGE:"oddPage"},C9=(B)=>new M0({name:"w:type",attributes:{val:{key:"w:val",value:B}}}),H2={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},$1={WIDTH:11906,HEIGHT:16838,ORIENTATION:g1.PORTRAIT},K6=class extends t{constructor({page:{size:{width:B=$1.WIDTH,height:U=$1.HEIGHT,orientation:G=$1.ORIENTATION,code:Y}={},margin:{top:Q=H2.TOP,right:K=H2.RIGHT,bottom:Z=H2.BOTTOM,left:J=H2.LEFT,header:q=H2.HEADER,footer:W=H2.FOOTER,gutter:I=H2.GUTTER}={},pageNumbers:H={},borders:T,textDirection:A}={},grid:{linePitch:P=360,charSpace:j,type:E}={},headerWrapperGroup:C={},footerWrapperGroup:N={},lineNumbers:v,titlePage:S,verticalAlign:F,column:M,type:$,revision:x}={}){super("w:sectPr");if(this.addHeaderFooterGroup(E8.HEADER,C),this.addHeaderFooterGroup(E8.FOOTER,N),$)this.root.push(C9($));if(this.root.push(D9({width:B,height:U,orientation:G,code:Y})),this.root.push(z9(Q,K,Z,J,q,W,I)),T)this.root.push(new w9(T));if(v)this.root.push(N9(v));if(this.root.push(E9(H)),M)this.root.push(A9(M));if(F)this.root.push(U6(F));if(S!==void 0)this.root.push(new q0("w:titlePg",S));if(A)this.root.push(new T9(A));if(x)this.root.push(new k9(x));this.root.push(j9({linePitch:P,charSpace:j,type:E}))}addHeaderFooterGroup(B,U){if(U.default)this.root.push(k1(B,{type:T2.DEFAULT,id:U.default.View.ReferenceId}));if(U.first)this.root.push(k1(B,{type:T2.FIRST,id:U.first.View.ReferenceId}));if(U.even)this.root.push(k1(B,{type:T2.EVEN,id:U.even.View.ReferenceId}))}},k9=class extends t{constructor(B){super("w:sectPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new K6(B))}},YJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{width:"w:w",space:"w:space"})}},ZJ=class extends t{constructor(B){super("w:col");this.root.push(new YJ({width:E0(B.width),space:B.space===void 0?void 0:E0(B.space)}))}},$9=class extends t{constructor(){super("w:body");e(this,"sections",[])}addSection(B){let U=this.sections.pop();this.root.push(this.createSectionParagraph(U)),this.sections.push(new K6(B))}prepForXml(B){if(this.sections.length===1)this.root.splice(0,1),this.root.push(this.sections.pop());return super.prepForXml(B)}push(B){this.root.push(B)}createSectionParagraph(B){let U=new d0({}),G=new M2({});return G.push(B),U.addChildElement(G),U}},S9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}},b9=class extends t{constructor(B){super("w:background");this.root.push(new S9({color:B.color===void 0?void 0:C2(B.color),themeColor:B.themeColor,themeShade:B.themeShade===void 0?void 0:W8(B.themeShade),themeTint:B.themeTint===void 0?void 0:W8(B.themeTint)}))}},QJ=class extends t{constructor(B){super("w:document");if(e(this,"body",void 0),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new $9,B.background)this.root.push(new b9(B.background));this.root.push(this.body)}add(B){return this.body.push(B),this}get Body(){return this.body}},JJ=class{constructor(B){e(this,"document",void 0),e(this,"relationships",void 0),this.document=new QJ(B),this.relationships=new A2}get View(){return this.document}get Relationships(){return this.relationships}},KJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},VJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",id:"w:id"})}},XJ=class extends D0{constructor(){super({style:"EndnoteReference"});this.root.push(new D4)}},n6={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},X8=class extends t{constructor(B){super("w:endnote");this.root.push(new VJ({type:B.type,id:B.id}));for(let U=0;U9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new wJ({ilvl:T0(B),tentative:1}))}},h9=class extends X6{},$J=class extends X6{},SJ=class extends t{constructor(B){super("w:multiLevelType");this.root.push(new C0({val:B}))}},bJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},D8=class extends t{constructor(B,U){super("w:abstractNum");e(this,"id",void 0),this.root.push(new bJ({abstractNumId:T0(B),restartNumberingAfterBreak:0})),this.root.push(new SJ("hybridMultilevel")),this.id=B;for(let G of U)this.root.push(new h9(G))}},vJ=class extends t{constructor(B){super("w:abstractNumId");this.root.push(new C0({val:B}))}},yJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{numId:"w:numId"})}},T8=class extends t{constructor(B){super("w:num");if(e(this,"numId",void 0),e(this,"reference",void 0),e(this,"instance",void 0),this.numId=B.numId,this.reference=B.reference,this.instance=B.instance,this.root.push(new yJ({numId:T0(B.numId)})),this.root.push(new vJ(T0(B.abstractNumId))),B.overrideLevels&&B.overrideLevels.length)for(let U of B.overrideLevels)this.root.push(new u9(U.num,U.start))}},gJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{ilvl:"w:ilvl"})}},u9=class extends t{constructor(B,U){super("w:lvlOverride");if(this.root.push(new gJ({ilvl:B})),U!==void 0)this.root.push(new xJ(U))}},fJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},xJ=class extends t{constructor(B){super("w:startOverride");this.root.push(new fJ({val:B}))}},d9=class extends t{constructor(B){super("w:numbering");e(this,"abstractNumberingMap",new Map),e(this,"concreteNumberingMap",new Map),e(this,"referenceConfigMap",new Map),e(this,"abstractNumUniqueNumericId",nB()),e(this,"concreteNumUniqueNumericId",sB()),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let U=new D8(this.abstractNumUniqueNumericId(),[{level:0,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(0.5),hanging:u0(0.25)}}}},{level:1,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(1),hanging:u0(0.25)}}}},{level:2,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:2160,hanging:u0(0.25)}}}},{level:3,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:2880,hanging:u0(0.25)}}}},{level:4,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:3600,hanging:u0(0.25)}}}},{level:5,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:4320,hanging:u0(0.25)}}}},{level:6,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5040,hanging:u0(0.25)}}}},{level:7,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5760,hanging:u0(0.25)}}}},{level:8,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:6480,hanging:u0(0.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new T8({numId:1,abstractNumId:U.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",U);for(let G of B.config)this.abstractNumberingMap.set(G.reference,new D8(this.abstractNumUniqueNumericId(),G.levels)),this.referenceConfigMap.set(G.reference,G.levels)}prepForXml(B){for(let U of this.abstractNumberingMap.values())this.root.push(U);for(let U of this.concreteNumberingMap.values())this.root.push(U);return super.prepForXml(B)}createConcreteNumberingInstance(B,U){let G=this.abstractNumberingMap.get(B);if(!G)return;let Y=`${B}-${U}`;if(this.concreteNumberingMap.has(Y))return;let Q=this.referenceConfigMap.get(B),K=Q&&Q[0].start,Z={numId:this.concreteNumUniqueNumericId(),abstractNumId:G.id,reference:B,instance:U,overrideLevels:[typeof K==="number"&&Number.isInteger(K)?{num:0,start:K}:{num:0,start:1}]};this.concreteNumberingMap.set(Y,new T8(Z))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},_J=(B)=>new M0({name:"w:compatSetting",attributes:{version:{key:"w:val",value:B},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),hJ=class extends t{constructor(B){super("w:compat");if(B.version)this.root.push(_J(B.version));if(B.useSingleBorderforContiguousCells)this.root.push(new q0("w:useSingleBorderforContiguousCells",B.useSingleBorderforContiguousCells));if(B.wordPerfectJustification)this.root.push(new q0("w:wpJustification",B.wordPerfectJustification));if(B.noTabStopForHangingIndent)this.root.push(new q0("w:noTabHangInd",B.noTabStopForHangingIndent));if(B.noLeading)this.root.push(new q0("w:noLeading",B.noLeading));if(B.spaceForUnderline)this.root.push(new q0("w:spaceForUL",B.spaceForUnderline));if(B.noColumnBalance)this.root.push(new q0("w:noColumnBalance",B.noColumnBalance));if(B.balanceSingleByteDoubleByteWidth)this.root.push(new q0("w:balanceSingleByteDoubleByteWidth",B.balanceSingleByteDoubleByteWidth));if(B.noExtraLineSpacing)this.root.push(new q0("w:noExtraLineSpacing",B.noExtraLineSpacing));if(B.doNotLeaveBackslashAlone)this.root.push(new q0("w:doNotLeaveBackslashAlone",B.doNotLeaveBackslashAlone));if(B.underlineTrailingSpaces)this.root.push(new q0("w:ulTrailSpace",B.underlineTrailingSpaces));if(B.doNotExpandShiftReturn)this.root.push(new q0("w:doNotExpandShiftReturn",B.doNotExpandShiftReturn));if(B.spacingInWholePoints)this.root.push(new q0("w:spacingInWholePoints",B.spacingInWholePoints));if(B.lineWrapLikeWord6)this.root.push(new q0("w:lineWrapLikeWord6",B.lineWrapLikeWord6));if(B.printBodyTextBeforeHeader)this.root.push(new q0("w:printBodyTextBeforeHeader",B.printBodyTextBeforeHeader));if(B.printColorsBlack)this.root.push(new q0("w:printColBlack",B.printColorsBlack));if(B.spaceWidth)this.root.push(new q0("w:wpSpaceWidth",B.spaceWidth));if(B.showBreaksInFrames)this.root.push(new q0("w:showBreaksInFrames",B.showBreaksInFrames));if(B.subFontBySize)this.root.push(new q0("w:subFontBySize",B.subFontBySize));if(B.suppressBottomSpacing)this.root.push(new q0("w:suppressBottomSpacing",B.suppressBottomSpacing));if(B.suppressTopSpacing)this.root.push(new q0("w:suppressTopSpacing",B.suppressTopSpacing));if(B.suppressSpacingAtTopOfPage)this.root.push(new q0("w:suppressSpacingAtTopOfPage",B.suppressSpacingAtTopOfPage));if(B.suppressTopSpacingWP)this.root.push(new q0("w:suppressTopSpacingWP",B.suppressTopSpacingWP));if(B.suppressSpBfAfterPgBrk)this.root.push(new q0("w:suppressSpBfAfterPgBrk",B.suppressSpBfAfterPgBrk));if(B.swapBordersFacingPages)this.root.push(new q0("w:swapBordersFacingPages",B.swapBordersFacingPages));if(B.convertMailMergeEsc)this.root.push(new q0("w:convMailMergeEsc",B.convertMailMergeEsc));if(B.truncateFontHeightsLikeWP6)this.root.push(new q0("w:truncateFontHeightsLikeWP6",B.truncateFontHeightsLikeWP6));if(B.macWordSmallCaps)this.root.push(new q0("w:mwSmallCaps",B.macWordSmallCaps));if(B.usePrinterMetrics)this.root.push(new q0("w:usePrinterMetrics",B.usePrinterMetrics));if(B.doNotSuppressParagraphBorders)this.root.push(new q0("w:doNotSuppressParagraphBorders",B.doNotSuppressParagraphBorders));if(B.wrapTrailSpaces)this.root.push(new q0("w:wrapTrailSpaces",B.wrapTrailSpaces));if(B.footnoteLayoutLikeWW8)this.root.push(new q0("w:footnoteLayoutLikeWW8",B.footnoteLayoutLikeWW8));if(B.shapeLayoutLikeWW8)this.root.push(new q0("w:shapeLayoutLikeWW8",B.shapeLayoutLikeWW8));if(B.alignTablesRowByRow)this.root.push(new q0("w:alignTablesRowByRow",B.alignTablesRowByRow));if(B.forgetLastTabAlignment)this.root.push(new q0("w:forgetLastTabAlignment",B.forgetLastTabAlignment));if(B.adjustLineHeightInTable)this.root.push(new q0("w:adjustLineHeightInTable",B.adjustLineHeightInTable));if(B.autoSpaceLikeWord95)this.root.push(new q0("w:autoSpaceLikeWord95",B.autoSpaceLikeWord95));if(B.noSpaceRaiseLower)this.root.push(new q0("w:noSpaceRaiseLower",B.noSpaceRaiseLower));if(B.doNotUseHTMLParagraphAutoSpacing)this.root.push(new q0("w:doNotUseHTMLParagraphAutoSpacing",B.doNotUseHTMLParagraphAutoSpacing));if(B.layoutRawTableWidth)this.root.push(new q0("w:layoutRawTableWidth",B.layoutRawTableWidth));if(B.layoutTableRowsApart)this.root.push(new q0("w:layoutTableRowsApart",B.layoutTableRowsApart));if(B.useWord97LineBreakRules)this.root.push(new q0("w:useWord97LineBreakRules",B.useWord97LineBreakRules));if(B.doNotBreakWrappedTables)this.root.push(new q0("w:doNotBreakWrappedTables",B.doNotBreakWrappedTables));if(B.doNotSnapToGridInCell)this.root.push(new q0("w:doNotSnapToGridInCell",B.doNotSnapToGridInCell));if(B.selectFieldWithFirstOrLastCharacter)this.root.push(new q0("w:selectFldWithFirstOrLastChar",B.selectFieldWithFirstOrLastCharacter));if(B.applyBreakingRules)this.root.push(new q0("w:applyBreakingRules",B.applyBreakingRules));if(B.doNotWrapTextWithPunctuation)this.root.push(new q0("w:doNotWrapTextWithPunct",B.doNotWrapTextWithPunctuation));if(B.doNotUseEastAsianBreakRules)this.root.push(new q0("w:doNotUseEastAsianBreakRules",B.doNotUseEastAsianBreakRules));if(B.useWord2002TableStyleRules)this.root.push(new q0("w:useWord2002TableStyleRules",B.useWord2002TableStyleRules));if(B.growAutofit)this.root.push(new q0("w:growAutofit",B.growAutofit));if(B.useFELayout)this.root.push(new q0("w:useFELayout",B.useFELayout));if(B.useNormalStyleForList)this.root.push(new q0("w:useNormalStyleForList",B.useNormalStyleForList));if(B.doNotUseIndentAsNumberingTabStop)this.root.push(new q0("w:doNotUseIndentAsNumberingTabStop",B.doNotUseIndentAsNumberingTabStop));if(B.useAlternateEastAsianLineBreakRules)this.root.push(new q0("w:useAltKinsokuLineBreakRules",B.useAlternateEastAsianLineBreakRules));if(B.allowSpaceOfSameStyleInTable)this.root.push(new q0("w:allowSpaceOfSameStyleInTable",B.allowSpaceOfSameStyleInTable));if(B.doNotSuppressIndentation)this.root.push(new q0("w:doNotSuppressIndentation",B.doNotSuppressIndentation));if(B.doNotAutofitConstrainedTables)this.root.push(new q0("w:doNotAutofitConstrainedTables",B.doNotAutofitConstrainedTables));if(B.autofitToFirstFixedWidthCell)this.root.push(new q0("w:autofitToFirstFixedWidthCell",B.autofitToFirstFixedWidthCell));if(B.underlineTabInNumberingList)this.root.push(new q0("w:underlineTabInNumList",B.underlineTabInNumberingList));if(B.displayHangulFixedWidth)this.root.push(new q0("w:displayHangulFixedWidth",B.displayHangulFixedWidth));if(B.splitPgBreakAndParaMark)this.root.push(new q0("w:splitPgBreakAndParaMark",B.splitPgBreakAndParaMark));if(B.doNotVerticallyAlignCellWithSp)this.root.push(new q0("w:doNotVertAlignCellWithSp",B.doNotVerticallyAlignCellWithSp));if(B.doNotBreakConstrainedForcedTable)this.root.push(new q0("w:doNotBreakConstrainedForcedTable",B.doNotBreakConstrainedForcedTable));if(B.ignoreVerticalAlignmentInTextboxes)this.root.push(new q0("w:doNotVertAlignInTxbx",B.ignoreVerticalAlignmentInTextboxes));if(B.useAnsiKerningPairs)this.root.push(new q0("w:useAnsiKerningPairs",B.useAnsiKerningPairs));if(B.cachedColumnBalance)this.root.push(new q0("w:cachedColBalance",B.cachedColumnBalance))}},uJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},dJ=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w:settings");if(this.root.push(new uJ({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new q0("w:displayBackgroundShape",!0)),B.trackRevisions!==void 0)this.root.push(new q0("w:trackRevisions",B.trackRevisions));if(B.evenAndOddHeaders!==void 0)this.root.push(new q0("w:evenAndOddHeaders",B.evenAndOddHeaders));if(B.updateFields!==void 0)this.root.push(new q0("w:updateFields",B.updateFields));if(B.defaultTabStop!==void 0)this.root.push(new _2("w:defaultTabStop",B.defaultTabStop));if(((U=B.hyphenation)===null||U===void 0?void 0:U.autoHyphenation)!==void 0)this.root.push(new q0("w:autoHyphenation",B.hyphenation.autoHyphenation));if(((G=B.hyphenation)===null||G===void 0?void 0:G.hyphenationZone)!==void 0)this.root.push(new _2("w:hyphenationZone",B.hyphenation.hyphenationZone));if(((Y=B.hyphenation)===null||Y===void 0?void 0:Y.consecutiveHyphenLimit)!==void 0)this.root.push(new _2("w:consecutiveHyphenLimit",B.hyphenation.consecutiveHyphenLimit));if(((Q=B.hyphenation)===null||Q===void 0?void 0:Q.doNotHyphenateCaps)!==void 0)this.root.push(new q0("w:doNotHyphenateCaps",B.hyphenation.doNotHyphenateCaps));this.root.push(new hJ(L0(L0({},(K=B.compatibility)!==null&&K!==void 0?K:{}),{},{version:(Z=(J=(q=B.compatibility)===null||q===void 0?void 0:q.version)!==null&&J!==void 0?J:B.compatibilityModeVersion)!==null&&Z!==void 0?Z:15})))}},c9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},cJ=class extends t{constructor(B){super("w:name");this.root.push(new c9({val:B}))}},mJ=class extends t{constructor(B){super("w:uiPriority");this.root.push(new c9({val:T0(B)}))}},lJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},m9=class extends t{constructor(B,U){super("w:style");if(this.root.push(new lJ(B)),U.name)this.root.push(new cJ(U.name));if(U.basedOn)this.root.push(new q2("w:basedOn",U.basedOn));if(U.next)this.root.push(new q2("w:next",U.next));if(U.link)this.root.push(new q2("w:link",U.link));if(U.uiPriority!==void 0)this.root.push(new mJ(U.uiPriority));if(U.semiHidden!==void 0)this.root.push(new q0("w:semiHidden",U.semiHidden));if(U.unhideWhenUsed!==void 0)this.root.push(new q0("w:unhideWhenUsed",U.unhideWhenUsed));if(U.quickFormat!==void 0)this.root.push(new q0("w:qFormat",U.quickFormat))}},p2=class extends m9{constructor(B){super({type:"paragraph",styleId:B.id},B);e(this,"paragraphProperties",void 0),e(this,"runProperties",void 0),this.paragraphProperties=new M2(B.paragraph),this.runProperties=new U2(B.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},$2=class extends m9{constructor(B){super({type:"character",styleId:B.id},L0({uiPriority:99,unhideWhenUsed:!0},B));e(this,"runProperties",void 0),this.runProperties=new U2(B.run),this.root.push(this.runProperties)}},j2=class extends p2{constructor(B){super(L0({basedOn:"Normal",next:"Normal",quickFormat:!0},B))}},aJ=class extends j2{constructor(B){super(L0({id:"Title",name:"Title"},B))}},pJ=class extends j2{constructor(B){super(L0({id:"Heading1",name:"Heading 1"},B))}},rJ=class extends j2{constructor(B){super(L0({id:"Heading2",name:"Heading 2"},B))}},iJ=class extends j2{constructor(B){super(L0({id:"Heading3",name:"Heading 3"},B))}},nJ=class extends j2{constructor(B){super(L0({id:"Heading4",name:"Heading 4"},B))}},sJ=class extends j2{constructor(B){super(L0({id:"Heading5",name:"Heading 5"},B))}},oJ=class extends j2{constructor(B){super(L0({id:"Heading6",name:"Heading 6"},B))}},tJ=class extends j2{constructor(B){super(L0({id:"Strong",name:"Strong"},B))}},eJ=class extends p2{constructor(B){super(L0({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},B))}},BK=class extends p2{constructor(B){super(L0({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},UK=class extends $2{constructor(B){super(L0({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},GK=class extends $2{constructor(B){super(L0({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},B))}},YK=class extends p2{constructor(B){super(L0({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},ZK=class extends $2{constructor(B){super(L0({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},QK=class extends $2{constructor(B){super(L0({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},B))}},JK=class extends $2{constructor(B){super(L0({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:i8.SINGLE}}},B))}},S1=class extends t{constructor(B){super("w:styles");if(B.initialStyles)this.root.push(B.initialStyles);if(B.importedStyles)for(let U of B.importedStyles)this.root.push(U);if(B.paragraphStyles)for(let U of B.paragraphStyles)this.root.push(new p2(U));if(B.characterStyles)for(let U of B.characterStyles)this.root.push(new $2(U))}},l9=class extends t{constructor(B){super("w:pPrDefault");this.root.push(new M2(B))}},a9=class extends t{constructor(B){super("w:rPrDefault");this.root.push(new U2(B))}},p9=class extends t{constructor(B){super("w:docDefaults");e(this,"runPropertiesDefaults",void 0),e(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new a9(B.run),this.paragraphPropertiesDefaults=new l9(B.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},KK=class{newInstance(B){let U=(0,h1.xml2js)(B,{compact:!1}),G;for(let Q of U.elements||[])if(Q.name==="w:styles")G=Q;if(G===void 0)throw Error("can not find styles element");let Y=G.elements||[];return{initialStyles:new $B(G.attributes),importedStyles:Y.map((Q)=>u1(Q))}}},M8=class{newInstance(B={}){var U;return{initialStyles:new F1(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new p9((U=B.document)!==null&&U!==void 0?U:{}),new aJ(L0({run:{size:56}},B.title)),new pJ(L0({run:{color:"2E74B5",size:32}},B.heading1)),new rJ(L0({run:{color:"2E74B5",size:26}},B.heading2)),new iJ(L0({run:{color:"1F4D78",size:24}},B.heading3)),new nJ(L0({run:{color:"2E74B5",italics:!0}},B.heading4)),new sJ(L0({run:{color:"2E74B5"}},B.heading5)),new oJ(L0({run:{color:"1F4D78"}},B.heading6)),new tJ(L0({run:{bold:!0}},B.strong)),new eJ(B.listParagraph||{}),new JK(B.hyperlink||{}),new UK(B.footnoteReference||{}),new BK(B.footnoteText||{}),new GK(B.footnoteTextChar||{}),new ZK(B.endnoteReference||{}),new YK(B.endnoteText||{}),new QK(B.endnoteTextChar||{})]}}},VK=class{constructor(B){var U,G,Y,Q,K,Z,J,q,W,I,H,T;if(e(this,"currentRelationshipId",1),e(this,"documentWrapper",void 0),e(this,"headers",[]),e(this,"footers",[]),e(this,"coreProperties",void 0),e(this,"numbering",void 0),e(this,"media",void 0),e(this,"fileRelationships",void 0),e(this,"footnotesWrapper",void 0),e(this,"endnotesWrapper",void 0),e(this,"settings",void 0),e(this,"contentTypes",void 0),e(this,"customProperties",void 0),e(this,"appProperties",void 0),e(this,"styles",void 0),e(this,"comments",void 0),e(this,"commentsExtended",void 0),e(this,"fontWrapper",void 0),this.coreProperties=new dQ(L0(L0({},B),{},{creator:(U=B.creator)!==null&&U!==void 0?U:"Un-named",revision:(G=B.revision)!==null&&G!==void 0?G:1,lastModifiedBy:(Y=B.lastModifiedBy)!==null&&Y!==void 0?Y:"Un-named"})),this.numbering=new d9(B.numbering?B.numbering:{config:[]}),this.comments=new z4((Q=B.comments)!==null&&Q!==void 0?Q:{children:[]}),this.comments.ThreadData)this.commentsExtended=new E4(this.comments.ThreadData);if(this.fileRelationships=new A2,this.customProperties=new rQ((K=B.customProperties)!==null&&K!==void 0?K:[]),this.appProperties=new _Q,this.footnotesWrapper=new PJ,this.endnotesWrapper=new RJ,this.contentTypes=new uQ,this.documentWrapper=new JJ({background:B.background}),this.settings=new dJ({compatibilityModeVersion:B.compatabilityModeVersion,compatibility:B.compatibility,evenAndOddHeaders:B.evenAndOddHeaderAndFooters?!0:!1,trackRevisions:(Z=B.features)===null||Z===void 0?void 0:Z.trackRevisions,updateFields:(J=B.features)===null||J===void 0?void 0:J.updateFields,defaultTabStop:B.defaultTabStop,hyphenation:{autoHyphenation:(q=B.hyphenation)===null||q===void 0?void 0:q.autoHyphenation,hyphenationZone:(W=B.hyphenation)===null||W===void 0?void 0:W.hyphenationZone,consecutiveHyphenLimit:(I=B.hyphenation)===null||I===void 0?void 0:I.consecutiveHyphenLimit,doNotHyphenateCaps:(H=B.hyphenation)===null||H===void 0?void 0:H.doNotHyphenateCaps}}),this.media=new V6,B.externalStyles!==void 0){var A;let P=new M8().newInstance((A=B.styles)===null||A===void 0?void 0:A.default),j=new KK().newInstance(B.externalStyles);this.styles=new S1(L0(L0({},j),{},{importedStyles:[...P.importedStyles,...j.importedStyles]}))}else if(B.styles){let P=new M8().newInstance(B.styles.default);this.styles=new S1(L0(L0({},P),B.styles))}else{let P=new M8;this.styles=new S1(P.newInstance())}this.addDefaultRelationships();for(let P of B.sections)this.addSection(P);if(B.footnotes)for(let P in B.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(P),B.footnotes[P].children);if(B.endnotes)for(let P in B.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(P),B.endnotes[P].children);this.fontWrapper=new h4((T=B.fonts)!==null&&T!==void 0?T:[])}addSection({headers:B={},footers:U={},children:G,properties:Y}){this.documentWrapper.View.Body.addSection(L0(L0({},Y),{},{headerWrapperGroup:{default:B.default?this.createHeader(B.default):void 0,first:B.first?this.createHeader(B.first):void 0,even:B.even?this.createHeader(B.even):void 0},footerWrapperGroup:{default:U.default?this.createFooter(U.default):void 0,first:U.first?this.createFooter(U.first):void 0,even:U.even?this.createFooter(U.even):void 0}}));for(let Q of G)this.documentWrapper.View.add(Q)}createHeader(B){let U=new _9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addHeaderToDocument(U),U}createFooter(B){let U=new f9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addFooterToDocument(U),U}addHeaderToDocument(B,U=T2.DEFAULT){this.headers.push({header:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(B,U=T2.DEFAULT){this.footers.push({footer:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){if(this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.commentsExtended)this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map((B)=>B.header)}get Footers(){return this.footers.map((B)=>B.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get FontTable(){return this.fontWrapper}},XK=class extends t{constructor(B={}){super("w:instrText");e(this,"properties",void 0),this.properties=B,this.root.push(new _0({space:x0.PRESERVE}));let U="TOC";if(this.properties.captionLabel)U=`${U} \\a "${this.properties.captionLabel}"`;if(this.properties.entriesFromBookmark)U=`${U} \\b "${this.properties.entriesFromBookmark}"`;if(this.properties.captionLabelIncludingNumbers)U=`${U} \\c "${this.properties.captionLabelIncludingNumbers}"`;if(this.properties.sequenceAndPageNumbersSeparator)U=`${U} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`;if(this.properties.tcFieldIdentifier)U=`${U} \\f "${this.properties.tcFieldIdentifier}"`;if(this.properties.hyperlink)U=`${U} \\h`;if(this.properties.tcFieldLevelRange)U=`${U} \\l "${this.properties.tcFieldLevelRange}"`;if(this.properties.pageNumbersEntryLevelsRange)U=`${U} \\n "${this.properties.pageNumbersEntryLevelsRange}"`;if(this.properties.headingStyleRange)U=`${U} \\o "${this.properties.headingStyleRange}"`;if(this.properties.entryAndPageNumberSeparator)U=`${U} \\p "${this.properties.entryAndPageNumberSeparator}"`;if(this.properties.seqFieldIdentifierForPrefix)U=`${U} \\s "${this.properties.seqFieldIdentifierForPrefix}"`;if(this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let G=this.properties.stylesWithLevels.map((Y)=>`${Y.styleName},${Y.level}`).join(",");U=`${U} \\t "${G}"`}if(this.properties.useAppliedParagraphOutlineLevel)U=`${U} \\u`;if(this.properties.preserveTabInEntries)U=`${U} \\w`;if(this.properties.preserveNewLineInEntries)U=`${U} \\x`;if(this.properties.hideTabAndPageNumbersInWebView)U=`${U} \\z`;this.root.push(U)}},r9=class extends t{constructor(){super("w:sdtContent")}},i9=class extends t{constructor(B){super("w:sdtPr");if(B)this.root.push(new q2("w:alias",B))}};function qK(B,U){if(B==null)return{};var G={};for(var Y in B)if({}.hasOwnProperty.call(B,Y)){if(U.includes(Y))continue;G[Y]=B[Y]}return G}function n9(B,U){if(B==null)return{};var G,Y,Q=qK(B,U);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(B);for(Y=0;Y0){let{stylesWithLevels:W}=K,I=Y.map((T,A)=>{var P,j;let E=this.buildCachedContentParagraphChild(T,K),C=(P=W===null||W===void 0||(j=W.find((v)=>v.level===T.level))===null||j===void 0?void 0:j.styleName)!==null&&P!==void 0?P:`TOC${T.level}`,N=A===0?[...J,E]:A===Y.length-1?[E,...q]:[E];return new d0({style:C,tabStops:this.getTabStopsForLevel(T.level),children:N})}),H=I;if(Y.length<=1)H=[...I,new d0({children:q})];for(let T of H)Z.addChildElement(T)}else{let W=new d0({children:J});Z.addChildElement(W);for(let H of G)Z.addChildElement(H);let I=new d0({children:q});Z.addChildElement(I)}this.root.push(Z)}getTabStopsForLevel(B,U=9025){return[{type:"clear",position:U+1-(B-1)*240},{type:"right",position:U,leader:"dot"}]}buildCachedContentRun(B,U){var G,Y;return new D0({style:(U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0?"IndexLink":void 0,children:[new Z1({text:B.title}),new T4,new Z1({text:(G=(Y=B.page)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:""})]})}buildCachedContentParagraphChild(B,U){let G=this.buildCachedContentRun(B,U);if((U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0)return new y4({anchor:B.href,children:[G]});return G}},LK=class{constructor(B,U){e(this,"styleName",void 0),e(this,"level",void 0),this.styleName=B,this.level=U}},IK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},OK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},s9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},o9=class extends t{constructor(B){super("w:footnoteReference");this.root.push(new s9({id:B}))}},HK=class extends D0{constructor(B){super({style:"FootnoteReference"});this.root.push(new o9(B))}},t9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},e9=class extends t{constructor(B){super("w:endnoteReference");this.root.push(new t9({id:B}))}},FK=class extends D0{constructor(B){super({style:"EndnoteReference"});this.root.push(new e9(B))}},o6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w14:val",symbolfont:"w14:font"})}},b1=class extends t{constructor(B,U,G){super(B);if(G)this.root.push(new o6({val:SB(U),symbolfont:G}));else this.root.push(new o6({val:U}))}},B5=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w14:checkbox");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let W=(B===null||B===void 0?void 0:B.checked)?"1":"0",I,H;this.root.push(new b1("w14:checked",W)),I=(B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.value)?B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value:this.DEFAULT_CHECKED_SYMBOL,H=(B===null||B===void 0||(Y=B.checkedState)===null||Y===void 0?void 0:Y.font)?B===null||B===void 0||(Q=B.checkedState)===null||Q===void 0?void 0:Q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:checkedState",I,H)),I=(B===null||B===void 0||(K=B.uncheckedState)===null||K===void 0?void 0:K.value)?B===null||B===void 0||(Z=B.uncheckedState)===null||Z===void 0?void 0:Z.value:this.DEFAULT_UNCHECKED_SYMBOL,H=(B===null||B===void 0||(J=B.uncheckedState)===null||J===void 0?void 0:J.font)?B===null||B===void 0||(q=B.uncheckedState)===null||q===void 0?void 0:q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:uncheckedState",I,H))}},WK=class extends t{constructor(B){var U,G,Y,Q;super("w:sdt");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let K=new i9(B===null||B===void 0?void 0:B.alias);K.addChildElement(new B5(B)),this.root.push(K);let Z=new r9,J=B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.font,q=B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value,W=B===null||B===void 0||(Y=B.uncheckedState)===null||Y===void 0?void 0:Y.font,I=B===null||B===void 0||(Q=B.uncheckedState)===null||Q===void 0?void 0:Q.value,H,T;if(B===null||B===void 0?void 0:B.checked)H=J?J:this.DEFAULT_FONT,T=q?q:this.DEFAULT_CHECKED_SYMBOL;else H=W?W:this.DEFAULT_FONT,T=I?I:this.DEFAULT_UNCHECKED_SYMBOL;let A=new aB({char:T,symbolfont:H});Z.addChildElement(A),this.root.push(Z)}},PK=({shape:B})=>new M0({name:"w:pict",children:[B]}),AK=({children:B=[]})=>new M0({name:"w:txbxContent",children:B}),jK=({style:B,children:U,inset:G})=>new M0({name:"v:textbox",attributes:{style:{key:"style",value:B},insetMode:{key:"insetmode",value:G?"custom":"auto"},inset:{key:"inset",value:G?`${G.left}, ${G.top}, ${G.right}, ${G.bottom}`:void 0}},children:[AK({children:U})]}),NK="#_x0000_t202",wK={flip:"flip",height:"height",left:"left",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",positionHorizontal:"mso-position-horizontal",positionHorizontalRelative:"mso-position-horizontal-relative",positionVertical:"mso-position-vertical",positionVerticalRelative:"mso-position-vertical-relative",wrapDistanceBottom:"mso-wrap-distance-bottom",wrapDistanceLeft:"mso-wrap-distance-left",wrapDistanceRight:"mso-wrap-distance-right",wrapDistanceTop:"mso-wrap-distance-top",wrapEdited:"mso-wrap-edited",wrapStyle:"mso-wrap-style",position:"position",rotation:"rotation",top:"top",visibility:"visibility",width:"width",zIndex:"z-index"},zK=(B)=>B?Object.entries(B).map(([U,G])=>`${wK[U]}:${G}`).join(";"):void 0,EK=({id:B,children:U,type:G=NK,style:Y})=>new M0({name:"v:shape",attributes:{id:{key:"id",value:B},type:{key:"type",value:G},style:{key:"style",value:zK(Y)}},children:[jK({style:"mso-fit-shape-to-text:t;",children:U})]}),DK=["style","children"],TK=class extends H1{constructor(B){let{style:U,children:G}=B,Y=n9(B,DK);super("w:p");this.root.push(new M2(Y)),this.root.push(PK({shape:EK({children:G,id:O1(),style:U})}))}},CK=R0((B,U)=>{d2(),P2();/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -35,8 +35,8 @@ Actual: `+w.attribValue);else{var Z0=w.tag,g=w.tags[w.tags.length-1]||w;if(Z0.ns JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE - */(function(G){if(typeof B=="object"&&typeof U<"u")U.exports=G();else if(typeof define=="function"&&define.amd)define([],G);else(typeof window<"u"?window:typeof v0<"u"?v0:typeof self<"u"?self:this).JSZip=G()})(function(){return function G(Y,Q,K){function Z(W,I){if(!Q[W]){if(!Y[W]){var H=typeof w1=="function"&&w1;if(!I&&H)return H(W,!0);if(J)return J(W,!0);var T=Error("Cannot find module '"+W+"'");throw T.code="MODULE_NOT_FOUND",T}var A=Q[W]={exports:{}};Y[W][0].call(A.exports,function(P){var j=Y[W][1][P];return Z(j||P)},A,A.exports,G,Y,Q,K)}return Q[W].exports}for(var J=typeof w1=="function"&&w1,q=0;q>2,A=(3&W)<<4|I>>4,P=1>6:64,j=2>4,I=(15&T)<<4|(A=J.indexOf(q.charAt(j++)))>>2,H=(3&A)<<6|(P=J.indexOf(q.charAt(j++))),N[E++]=W,A!==64&&(N[E++]=I),P!==64&&(N[E++]=H);return N}},{"./support":30,"./utils":32}],2:[function(G,Y,Q){var K=G("./external"),Z=G("./stream/DataWorker"),J=G("./stream/Crc32Probe"),q=G("./stream/DataLengthProbe");function W(I,H,T,A,P){this.compressedSize=I,this.uncompressedSize=H,this.crc32=T,this.compression=A,this.compressedContent=P}W.prototype={getContentWorker:function(){var I=new Z(K.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new q("data_length")),H=this;return I.on("end",function(){if(this.streamInfo.data_length!==H.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),I},getCompressedWorker:function(){return new Z(K.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},W.createWorkerFrom=function(I,H,T){return I.pipe(new J).pipe(new q("uncompressedSize")).pipe(H.compressWorker(T)).pipe(new q("compressedSize")).withStreamInfo("compression",H)},Y.exports=W},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(G,Y,Q){var K=G("./stream/GenericWorker");Q.STORE={magic:"\x00\x00",compressWorker:function(){return new K("STORE compression")},uncompressWorker:function(){return new K("STORE decompression")}},Q.DEFLATE=G("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(G,Y,Q){var K=G("./utils"),Z=function(){for(var J,q=[],W=0;W<256;W++){J=W;for(var I=0;I<8;I++)J=1&J?3988292384^J>>>1:J>>>1;q[W]=J}return q}();Y.exports=function(J,q){return J!==void 0&&J.length?K.getTypeOf(J)!=="string"?function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I[j])];return-1^W}(0|q,J,J.length,0):function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I.charCodeAt(j))];return-1^W}(0|q,J,J.length,0):0}},{"./utils":32}],5:[function(G,Y,Q){Q.base64=!1,Q.binary=!1,Q.dir=!1,Q.createFolders=!0,Q.date=null,Q.compression=null,Q.compressionOptions=null,Q.comment=null,Q.unixPermissions=null,Q.dosPermissions=null},{}],6:[function(G,Y,Q){var K=null;K=typeof Promise<"u"?Promise:G("lie"),Y.exports={Promise:K}},{lie:37}],7:[function(G,Y,Q){var K=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",Z=G("pako"),J=G("./utils"),q=G("./stream/GenericWorker"),W=K?"uint8array":"array";function I(H,T){q.call(this,"FlateWorker/"+H),this._pako=null,this._pakoAction=H,this._pakoOptions=T,this.meta={}}Q.magic="\b\x00",J.inherits(I,q),I.prototype.processChunk=function(H){this.meta=H.meta,this._pako===null&&this._createPako(),this._pako.push(J.transformTo(W,H.data),!1)},I.prototype.flush=function(){q.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},I.prototype.cleanUp=function(){q.prototype.cleanUp.call(this),this._pako=null},I.prototype._createPako=function(){this._pako=new Z[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var H=this;this._pako.onData=function(T){H.push({data:T,meta:H.meta})}},Q.compressWorker=function(H){return new I("Deflate",H)},Q.uncompressWorker=function(){return new I("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(G,Y,Q){function K(A,P){var j,E="";for(j=0;j>>=8;return E}function Z(A,P,j,E,C,N){var v,S,F=A.file,M=A.compression,$=N!==W.utf8encode,x=J.transformTo("string",N(F.name)),z=J.transformTo("string",W.utf8encode(F.name)),a=F.comment,U0=J.transformTo("string",N(a)),b=J.transformTo("string",W.utf8encode(a)),c=z.length!==F.name.length,D=b.length!==a.length,m="",B0="",i="",V0=F.dir,s=F.date,G0={crc32:0,compressedSize:0,uncompressedSize:0};P&&!j||(G0.crc32=A.crc32,G0.compressedSize=A.compressedSize,G0.uncompressedSize=A.uncompressedSize);var r=0;P&&(r|=8),$||!c&&!D||(r|=2048);var y=0,n=0;V0&&(y|=16),C==="UNIX"?(n=798,y|=function(Y0,O0){var w=Y0;return Y0||(w=O0?16893:33204),(65535&w)<<16}(F.unixPermissions,V0)):(n=20,y|=function(Y0){return 63&(Y0||0)}(F.dosPermissions)),v=s.getUTCHours(),v<<=6,v|=s.getUTCMinutes(),v<<=5,v|=s.getUTCSeconds()/2,S=s.getUTCFullYear()-1980,S<<=4,S|=s.getUTCMonth()+1,S<<=5,S|=s.getUTCDate(),c&&(B0=K(1,1)+K(I(x),4)+z,m+="up"+K(B0.length,2)+B0),D&&(i=K(1,1)+K(I(U0),4)+b,m+="uc"+K(i.length,2)+i);var o="";return o+=` -\x00`,o+=K(r,2),o+=M.magic,o+=K(v,2),o+=K(S,2),o+=K(G0.crc32,4),o+=K(G0.compressedSize,4),o+=K(G0.uncompressedSize,4),o+=K(x.length,2),o+=K(m.length,2),{fileRecord:H.LOCAL_FILE_HEADER+o+x+m,dirRecord:H.CENTRAL_FILE_HEADER+K(n,2)+o+K(U0.length,2)+"\x00\x00\x00\x00"+K(y,4)+K(E,4)+x+m+U0}}var J=G("../utils"),q=G("../stream/GenericWorker"),W=G("../utf8"),I=G("../crc32"),H=G("../signature");function T(A,P,j,E){q.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=j,this.encodeFileName=E,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}J.inherits(T,q),T.prototype.push=function(A){var P=A.meta.percent||0,j=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,q.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:j?(P+100*(j-E-1))/j:100}}))},T.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var P=this.streamFiles&&!A.file.dir;if(P){var j=Z(A,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},T.prototype.closedSource=function(A){this.accumulate=!1;var P=this.streamFiles&&!A.file.dir,j=Z(A,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),P)this.push({data:function(E){return H.DATA_DESCRIPTOR+K(E.crc32,4)+K(E.compressedSize,4)+K(E.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},T.prototype.flush=function(){for(var A=this.bytesWritten,P=0;P=this.index;q--)W=(W<<8)+this.byteAt(q);return this.index+=J,W},readString:function(J){return K.transformTo("string",this.readData(J))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var J=this.readInt(4);return new Date(Date.UTC(1980+(J>>25&127),(J>>21&15)-1,J>>16&31,J>>11&31,J>>5&63,(31&J)<<1))}},Y.exports=Z},{"../utils":32}],19:[function(G,Y,Q){var K=G("./Uint8ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(G,Y,Q){var K=G("./DataReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.byteAt=function(J){return this.data.charCodeAt(this.zero+J)},Z.prototype.lastIndexOfSignature=function(J){return this.data.lastIndexOf(J)-this.zero},Z.prototype.readAndCheckSignature=function(J){return J===this.readData(4)},Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./DataReader":18}],21:[function(G,Y,Q){var K=G("./ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){if(this.checkOffset(J),J===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./ArrayReader":17}],22:[function(G,Y,Q){var K=G("../utils"),Z=G("../support"),J=G("./ArrayReader"),q=G("./StringReader"),W=G("./NodeBufferReader"),I=G("./Uint8ArrayReader");Y.exports=function(H){var T=K.getTypeOf(H);return K.checkSupport(T),T!=="string"||Z.uint8array?T==="nodebuffer"?new W(H):Z.uint8array?new I(K.transformTo("uint8array",H)):new J(K.transformTo("array",H)):new q(H)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(G,Y,Q){Q.LOCAL_FILE_HEADER="PK\x03\x04",Q.CENTRAL_FILE_HEADER="PK\x01\x02",Q.CENTRAL_DIRECTORY_END="PK\x05\x06",Q.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",Q.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",Q.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../utils");function J(q){K.call(this,"ConvertWorker to "+q),this.destType=q}Z.inherits(J,K),J.prototype.processChunk=function(q){this.push({data:Z.transformTo(this.destType,q.data),meta:q.meta})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],25:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../crc32");function J(){K.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}G("../utils").inherits(J,K),J.prototype.processChunk=function(q){this.streamInfo.crc32=Z(q.data,this.streamInfo.crc32||0),this.push(q)},Y.exports=J},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataLengthProbe for "+q),this.propName=q,this.withStreamInfo(q,0)}K.inherits(J,Z),J.prototype.processChunk=function(q){if(q){var W=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=W+q.data.length}Z.prototype.processChunk.call(this,q)},Y.exports=J},{"../utils":32,"./GenericWorker":28}],27:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataWorker");var W=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,q.then(function(I){W.dataIsReady=!0,W.data=I,W.max=I&&I.length||0,W.type=K.getTypeOf(I),W.isPaused||W._tickAndRepeat()},function(I){W.error(I)})}K.inherits(J,Z),J.prototype.cleanUp=function(){Z.prototype.cleanUp.call(this),this.data=null},J.prototype.resume=function(){return!!Z.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,K.delay(this._tickAndRepeat,[],this)),!0)},J.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(K.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},J.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var q=null,W=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":q=this.data.substring(this.index,W);break;case"uint8array":q=this.data.subarray(this.index,W);break;case"array":case"nodebuffer":q=this.data.slice(this.index,W)}return this.index=W,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],28:[function(G,Y,Q){function K(Z){this.name=Z||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}K.prototype={push:function(Z){this.emit("data",Z)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Z){this.emit("error",Z)}return!0},error:function(Z){return!this.isFinished&&(this.isPaused?this.generatedError=Z:(this.isFinished=!0,this.emit("error",Z),this.previous&&this.previous.error(Z),this.cleanUp()),!0)},on:function(Z,J){return this._listeners[Z].push(J),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Z,J){if(this._listeners[Z])for(var q=0;q "+Z:Z}},Y.exports=K},{}],29:[function(G,Y,Q){var K=G("../utils"),Z=G("./ConvertWorker"),J=G("./GenericWorker"),q=G("../base64"),W=G("../support"),I=G("../external"),H=null;if(W.nodestream)try{H=G("../nodejs/NodejsStreamOutputAdapter")}catch(P){}function T(P,j){return new I.Promise(function(E,C){var N=[],v=P._internalType,S=P._outputType,F=P._mimeType;P.on("data",function(M,$){N.push(M),j&&j($)}).on("error",function(M){N=[],C(M)}).on("end",function(){try{E(function(M,$,x){switch(M){case"blob":return K.newBlob(K.transformTo("arraybuffer",$),x);case"base64":return q.encode($);default:return K.transformTo(M,$)}}(S,function(M,$){var x,z=0,a=null,U0=0;for(x=0;x<$.length;x++)U0+=$[x].length;switch(M){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":for(a=new Uint8Array(U0),x=0;x<$.length;x++)a.set($[x],z),z+=$[x].length;return a;case"nodebuffer":return Buffer.concat($);default:throw Error("concat : unsupported type '"+M+"'")}}(v,N),F))}catch(M){C(M)}N=[]}).resume()})}function A(P,j,E){var C=j;switch(j){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=j,this._mimeType=E,K.checkSupport(C),this._worker=P.pipe(new Z(C)),P.lock()}catch(N){this._worker=new J("error"),this._worker.error(N)}}A.prototype={accumulate:function(P){return T(this,P)},on:function(P,j){var E=this;return P==="data"?this._worker.on(P,function(C){j.call(E,C.data,C.meta)}):this._worker.on(P,function(){K.delay(j,arguments,E)}),this},resume:function(){return K.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(P){if(K.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new H(this,{objectMode:this._outputType!=="nodebuffer"},P)}},Y.exports=A},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(G,Y,Q){if(Q.base64=!0,Q.array=!0,Q.string=!0,Q.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Q.nodebuffer=typeof Buffer<"u",Q.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")Q.blob=!1;else{var K=new ArrayBuffer(0);try{Q.blob=new Blob([K],{type:"application/zip"}).size===0}catch(J){try{var Z=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Z.append(K),Q.blob=Z.getBlob("application/zip").size===0}catch(q){Q.blob=!1}}}try{Q.nodestream=!!G("readable-stream").Readable}catch(J){Q.nodestream=!1}},{"readable-stream":16}],31:[function(G,Y,Q){for(var K=G("./utils"),Z=G("./support"),J=G("./nodejsUtils"),q=G("./stream/GenericWorker"),W=Array(256),I=0;I<256;I++)W[I]=252<=I?6:248<=I?5:240<=I?4:224<=I?3:192<=I?2:1;W[254]=W[254]=1;function H(){q.call(this,"utf-8 decode"),this.leftOver=null}function T(){q.call(this,"utf-8 encode")}Q.utf8encode=function(A){return Z.nodebuffer?J.newBufferFrom(A,"utf-8"):function(P){var j,E,C,N,v,S=P.length,F=0;for(N=0;N>>6:(E<65536?j[v++]=224|E>>>12:(j[v++]=240|E>>>18,j[v++]=128|E>>>12&63),j[v++]=128|E>>>6&63),j[v++]=128|63&E);return j}(A)},Q.utf8decode=function(A){return Z.nodebuffer?K.transformTo("nodebuffer",A).toString("utf-8"):function(P){var j,E,C,N,v=P.length,S=Array(2*v);for(j=E=0;j>10&1023,S[E++]=56320|1023&C)}return S.length!==E&&(S.subarray?S=S.subarray(0,E):S.length=E),K.applyFromCharCode(S)}(A=K.transformTo(Z.uint8array?"uint8array":"array",A))},K.inherits(H,q),H.prototype.processChunk=function(A){var P=K.transformTo(Z.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(Z.uint8array){var j=P;(P=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),P.set(j,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var E=function(N,v){var S;for((v=v||N.length)>N.length&&(v=N.length),S=v-1;0<=S&&(192&N[S])==128;)S--;return S<0?v:S===0?v:S+W[N[S]]>v?S:v}(P),C=P;E!==P.length&&(Z.uint8array?(C=P.subarray(0,E),this.leftOver=P.subarray(E,P.length)):(C=P.slice(0,E),this.leftOver=P.slice(E,P.length))),this.push({data:Q.utf8decode(C),meta:A.meta})},H.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:Q.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},Q.Utf8DecodeWorker=H,K.inherits(T,q),T.prototype.processChunk=function(A){this.push({data:Q.utf8encode(A.data),meta:A.meta})},Q.Utf8EncodeWorker=T},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(G,Y,Q){var K=G("./support"),Z=G("./base64"),J=G("./nodejsUtils"),q=G("./external");function W(j){return j}function I(j,E){for(var C=0;C>8;this.dir=!!(16&this.externalFileAttributes),A==0&&(this.dosPermissions=63&this.externalFileAttributes),A==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var A=K(this.extraFields[1].value);this.uncompressedSize===Z.MAX_VALUE_32BITS&&(this.uncompressedSize=A.readInt(8)),this.compressedSize===Z.MAX_VALUE_32BITS&&(this.compressedSize=A.readInt(8)),this.localHeaderOffset===Z.MAX_VALUE_32BITS&&(this.localHeaderOffset=A.readInt(8)),this.diskNumberStart===Z.MAX_VALUE_32BITS&&(this.diskNumberStart=A.readInt(4))}},readExtraFields:function(A){var P,j,E,C=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(A<65536?T[E++]=224|A>>>12:(T[E++]=240|A>>>18,T[E++]=128|A>>>12&63),T[E++]=128|A>>>6&63),T[E++]=128|63&A);return T},Q.buf2binstring=function(H){return I(H,H.length)},Q.binstring2buf=function(H){for(var T=new K.Buf8(H.length),A=0,P=T.length;A>10&1023,N[P++]=56320|1023&j)}return I(N,P)},Q.utf8border=function(H,T){var A;for((T=T||H.length)>H.length&&(T=H.length),A=T-1;0<=A&&(192&H[A])==128;)A--;return A<0?T:A===0?T:A+q[H[A]]>T?A:T}},{"./common":41}],43:[function(G,Y,Q){Y.exports=function(K,Z,J,q){for(var W=65535&K|0,I=K>>>16&65535|0,H=0;J!==0;){for(J-=H=2000>>1:Z>>>1;J[q]=Z}return J}();Y.exports=function(Z,J,q,W){var I=K,H=W+q;Z^=-1;for(var T=W;T>>8^I[255&(Z^J[T])];return-1^Z}},{}],46:[function(G,Y,Q){var K,Z=G("../utils/common"),J=G("./trees"),q=G("./adler32"),W=G("./crc32"),I=G("./messages"),H=0,T=4,A=0,P=-2,j=-1,E=4,C=2,N=8,v=9,S=286,F=30,M=19,$=2*S+1,x=15,z=3,a=258,U0=a+z+1,b=42,c=113,D=1,m=2,B0=3,i=4;function V0(R,p){return R.msg=I[p],p}function s(R){return(R<<1)-(4R.avail_out&&(k=R.avail_out),k!==0&&(Z.arraySet(R.output,p.pending_buf,p.pending_out,k,R.next_out),R.next_out+=k,p.pending_out+=k,R.total_out+=k,R.avail_out-=k,p.pending-=k,p.pending===0&&(p.pending_out=0))}function y(R,p){J._tr_flush_block(R,0<=R.block_start?R.block_start:-1,R.strstart-R.block_start,p),R.block_start=R.strstart,r(R.strm)}function n(R,p){R.pending_buf[R.pending++]=p}function o(R,p){R.pending_buf[R.pending++]=p>>>8&255,R.pending_buf[R.pending++]=255&p}function Y0(R,p){var k,V,X=R.max_chain_length,O=R.strstart,_=R.prev_length,l=R.nice_match,d=R.strstart>R.w_size-U0?R.strstart-(R.w_size-U0):0,Q0=R.window,X0=R.w_mask,K0=R.prev,I0=R.strstart+a,F0=Q0[O+_-1],W0=Q0[O+_];R.prev_length>=R.good_match&&(X>>=2),l>R.lookahead&&(l=R.lookahead);do if(Q0[(k=p)+_]===W0&&Q0[k+_-1]===F0&&Q0[k]===Q0[O]&&Q0[++k]===Q0[O+1]){O+=2,k++;do;while(Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Od&&--X!=0);return _<=R.lookahead?_:R.lookahead}function O0(R){var p,k,V,X,O,_,l,d,Q0,X0,K0=R.w_size;do{if(X=R.window_size-R.lookahead-R.strstart,R.strstart>=K0+(K0-U0)){for(Z.arraySet(R.window,R.window,K0,K0,0),R.match_start-=K0,R.strstart-=K0,R.block_start-=K0,p=k=R.hash_size;V=R.head[--p],R.head[p]=K0<=V?V-K0:0,--k;);for(p=k=K0;V=R.prev[--p],R.prev[p]=K0<=V?V-K0:0,--k;);X+=K0}if(R.strm.avail_in===0)break;if(_=R.strm,l=R.window,d=R.strstart+R.lookahead,Q0=X,X0=void 0,X0=_.avail_in,Q0=z)for(O=R.strstart-R.insert,R.ins_h=R.window[O],R.ins_h=(R.ins_h<=z&&(R.ins_h=(R.ins_h<=z)if(V=J._tr_tally(R,R.strstart-R.match_start,R.match_length-z),R.lookahead-=R.match_length,R.match_length<=R.max_lazy_match&&R.lookahead>=z){for(R.match_length--;R.strstart++,R.ins_h=(R.ins_h<=z&&(R.ins_h=(R.ins_h<=z&&R.match_length<=R.prev_length){for(X=R.strstart+R.lookahead-z,V=J._tr_tally(R,R.strstart-1-R.prev_match,R.prev_length-z),R.lookahead-=R.prev_length-1,R.prev_length-=2;++R.strstart<=X&&(R.ins_h=(R.ins_h<R.pending_buf_size-5&&(k=R.pending_buf_size-5);;){if(R.lookahead<=1){if(O0(R),R.lookahead===0&&p===H)return D;if(R.lookahead===0)break}R.strstart+=R.lookahead,R.lookahead=0;var V=R.block_start+k;if((R.strstart===0||R.strstart>=V)&&(R.lookahead=R.strstart-V,R.strstart=V,y(R,!1),R.strm.avail_out===0))return D;if(R.strstart-R.block_start>=R.w_size-U0&&(y(R,!1),R.strm.avail_out===0))return D}return R.insert=0,p===T?(y(R,!0),R.strm.avail_out===0?B0:i):(R.strstart>R.block_start&&(y(R,!1),R.strm.avail_out),D)}),new u(4,4,8,4,w),new u(4,5,16,8,w),new u(4,6,32,32,w),new u(4,4,16,16,L),new u(8,16,32,32,L),new u(8,16,128,128,L),new u(8,32,128,256,L),new u(32,128,258,1024,L),new u(32,258,258,4096,L)],Q.deflateInit=function(R,p){return f(R,p,N,15,8,0)},Q.deflateInit2=f,Q.deflateReset=g,Q.deflateResetKeep=Z0,Q.deflateSetHeader=function(R,p){return R&&R.state?R.state.wrap!==2?P:(R.state.gzhead=p,A):P},Q.deflate=function(R,p){var k,V,X,O;if(!R||!R.state||5>8&255),n(V,V.gzhead.time>>16&255),n(V,V.gzhead.time>>24&255),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,255&V.gzhead.os),V.gzhead.extra&&V.gzhead.extra.length&&(n(V,255&V.gzhead.extra.length),n(V,V.gzhead.extra.length>>8&255)),V.gzhead.hcrc&&(R.adler=W(R.adler,V.pending_buf,V.pending,0)),V.gzindex=0,V.status=69):(n(V,0),n(V,0),n(V,0),n(V,0),n(V,0),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,3),V.status=c);else{var _=N+(V.w_bits-8<<4)<<8;_|=(2<=V.strategy||V.level<2?0:V.level<6?1:V.level===6?2:3)<<6,V.strstart!==0&&(_|=32),_+=31-_%31,V.status=c,o(V,_),V.strstart!==0&&(o(V,R.adler>>>16),o(V,65535&R.adler)),R.adler=1}if(V.status===69)if(V.gzhead.extra){for(X=V.pending;V.gzindex<(65535&V.gzhead.extra.length)&&(V.pending!==V.pending_buf_size||(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending!==V.pending_buf_size));)n(V,255&V.gzhead.extra[V.gzindex]),V.gzindex++;V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),V.gzindex===V.gzhead.extra.length&&(V.gzindex=0,V.status=73)}else V.status=73;if(V.status===73)if(V.gzhead.name){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.gzindex=0,V.status=91)}else V.status=91;if(V.status===91)if(V.gzhead.comment){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.status=103)}else V.status=103;if(V.status===103&&(V.gzhead.hcrc?(V.pending+2>V.pending_buf_size&&r(R),V.pending+2<=V.pending_buf_size&&(n(V,255&R.adler),n(V,R.adler>>8&255),R.adler=0,V.status=c)):V.status=c),V.pending!==0){if(r(R),R.avail_out===0)return V.last_flush=-1,A}else if(R.avail_in===0&&s(p)<=s(k)&&p!==T)return V0(R,-5);if(V.status===666&&R.avail_in!==0)return V0(R,-5);if(R.avail_in!==0||V.lookahead!==0||p!==H&&V.status!==666){var l=V.strategy===2?function(d,Q0){for(var X0;;){if(d.lookahead===0&&(O0(d),d.lookahead===0)){if(Q0===H)return D;break}if(d.match_length=0,X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++,X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):V.strategy===3?function(d,Q0){for(var X0,K0,I0,F0,W0=d.window;;){if(d.lookahead<=a){if(O0(d),d.lookahead<=a&&Q0===H)return D;if(d.lookahead===0)break}if(d.match_length=0,d.lookahead>=z&&0d.lookahead&&(d.match_length=d.lookahead)}if(d.match_length>=z?(X0=J._tr_tally(d,1,d.match_length-z),d.lookahead-=d.match_length,d.strstart+=d.match_length,d.match_length=0):(X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++),X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):K[V.level].func(V,p);if(l!==B0&&l!==i||(V.status=666),l===D||l===B0)return R.avail_out===0&&(V.last_flush=-1),A;if(l===m&&(p===1?J._tr_align(V):p!==5&&(J._tr_stored_block(V,0,0,!1),p===3&&(G0(V.head),V.lookahead===0&&(V.strstart=0,V.block_start=0,V.insert=0))),r(R),R.avail_out===0))return V.last_flush=-1,A}return p!==T?A:V.wrap<=0?1:(V.wrap===2?(n(V,255&R.adler),n(V,R.adler>>8&255),n(V,R.adler>>16&255),n(V,R.adler>>24&255),n(V,255&R.total_in),n(V,R.total_in>>8&255),n(V,R.total_in>>16&255),n(V,R.total_in>>24&255)):(o(V,R.adler>>>16),o(V,65535&R.adler)),r(R),0=k.w_size&&(O===0&&(G0(k.head),k.strstart=0,k.block_start=0,k.insert=0),Q0=new Z.Buf8(k.w_size),Z.arraySet(Q0,p,X0-k.w_size,k.w_size,0),p=Q0,X0=k.w_size),_=R.avail_in,l=R.next_in,d=R.input,R.avail_in=X0,R.next_in=0,R.input=p,O0(k);k.lookahead>=z;){for(V=k.strstart,X=k.lookahead-(z-1);k.ins_h=(k.ins_h<>>=z=x>>>24,v-=z,(z=x>>>16&255)===0)m[I++]=65535&x;else{if(!(16&z)){if((64&z)==0){x=S[(65535&x)+(N&(1<>>=z,v-=z),v<15&&(N+=D[q++]<>>=z=x>>>24,v-=z,!(16&(z=x>>>16&255))){if((64&z)==0){x=F[(65535&x)+(N&(1<>>=z,v-=z,(z=I-H)>3,N&=(1<<(v-=a<<3))-1,K.next_in=q,K.next_out=I,K.avail_in=q>>24&255)+(b>>>8&65280)+((65280&b)<<8)+((255&b)<<24)}function N(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new K.Buf16(320),this.work=new K.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(b){var c;return b&&b.state?(c=b.state,b.total_in=b.total_out=c.total=0,b.msg="",c.wrap&&(b.adler=1&c.wrap),c.mode=P,c.last=0,c.havedict=0,c.dmax=32768,c.head=null,c.hold=0,c.bits=0,c.lencode=c.lendyn=new K.Buf32(j),c.distcode=c.distdyn=new K.Buf32(E),c.sane=1,c.back=-1,T):A}function S(b){var c;return b&&b.state?((c=b.state).wsize=0,c.whave=0,c.wnext=0,v(b)):A}function F(b,c){var D,m;return b&&b.state?(m=b.state,c<0?(D=0,c=-c):(D=1+(c>>4),c<48&&(c&=15)),c&&(c<8||15=i.wsize?(K.arraySet(i.window,c,D-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(m<(B0=i.wsize-i.wnext)&&(B0=m),K.arraySet(i.window,c,D-m,B0,i.wnext),(m-=B0)?(K.arraySet(i.window,c,D-m,m,0),i.wnext=m,i.whave=i.wsize):(i.wnext+=B0,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,D.check=J(D.check,O,2,0),y=r=0,D.mode=2;break}if(D.flags=0,D.head&&(D.head.done=!1),!(1&D.wrap)||(((255&r)<<8)+(r>>8))%31){b.msg="incorrect header check",D.mode=30;break}if((15&r)!=8){b.msg="unknown compression method",D.mode=30;break}if(y-=4,R=8+(15&(r>>>=4)),D.wbits===0)D.wbits=R;else if(R>D.wbits){b.msg="invalid window size",D.mode=30;break}D.dmax=1<>8&1),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=3;case 3:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>8&255,O[2]=r>>>16&255,O[3]=r>>>24&255,D.check=J(D.check,O,4,0)),y=r=0,D.mode=4;case 4:for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>8),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=5;case 5:if(1024&D.flags){for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>>8&255,D.check=J(D.check,O,2,0)),y=r=0}else D.head&&(D.head.extra=null);D.mode=6;case 6:if(1024&D.flags&&(s<(Y0=D.length)&&(Y0=s),Y0&&(D.head&&(R=D.head.extra_len-D.length,D.head.extra||(D.head.extra=Array(D.head.extra_len)),K.arraySet(D.head.extra,m,i,Y0,R)),512&D.flags&&(D.check=J(D.check,m,Y0,i)),s-=Y0,i+=Y0,D.length-=Y0),D.length))break B;D.length=0,D.mode=7;case 7:if(2048&D.flags){if(s===0)break B;for(Y0=0;R=m[i+Y0++],D.head&&R&&D.length<65536&&(D.head.name+=String.fromCharCode(R)),R&&Y0>9&1,D.head.done=!0),b.adler=D.check=0,D.mode=12;break;case 10:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>=7&y,y-=7&y,D.mode=27;break}for(;y<3;){if(s===0)break B;s--,r+=m[i++]<>>=1)){case 0:D.mode=14;break;case 1:if(a(D),D.mode=20,c!==6)break;r>>>=2,y-=2;break B;case 2:D.mode=17;break;case 3:b.msg="invalid block type",D.mode=30}r>>>=2,y-=2;break;case 14:for(r>>>=7&y,y-=7&y;y<32;){if(s===0)break B;s--,r+=m[i++]<>>16^65535)){b.msg="invalid stored block lengths",D.mode=30;break}if(D.length=65535&r,y=r=0,D.mode=15,c===6)break B;case 15:D.mode=16;case 16:if(Y0=D.length){if(s>>=5,y-=5,D.ndist=1+(31&r),r>>>=5,y-=5,D.ncode=4+(15&r),r>>>=4,y-=4,286>>=3,y-=3}for(;D.have<19;)D.lens[_[D.have++]]=0;if(D.lencode=D.lendyn,D.lenbits=7,k={bits:D.lenbits},p=W(0,D.lens,0,19,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid code lengths set",D.mode=30;break}D.have=0,D.mode=19;case 19:for(;D.have>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=L,y-=L,D.lens[D.have++]=h;else{if(h===16){for(V=L+2;y>>=L,y-=L,D.have===0){b.msg="invalid bit length repeat",D.mode=30;break}R=D.lens[D.have-1],Y0=3+(3&r),r>>>=2,y-=2}else if(h===17){for(V=L+3;y>>=L)),r>>>=3,y-=3}else{for(V=L+7;y>>=L)),r>>>=7,y-=7}if(D.have+Y0>D.nlen+D.ndist){b.msg="invalid bit length repeat",D.mode=30;break}for(;Y0--;)D.lens[D.have++]=R}}if(D.mode===30)break;if(D.lens[256]===0){b.msg="invalid code -- missing end-of-block",D.mode=30;break}if(D.lenbits=9,k={bits:D.lenbits},p=W(I,D.lens,0,D.nlen,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid literal/lengths set",D.mode=30;break}if(D.distbits=6,D.distcode=D.distdyn,k={bits:D.distbits},p=W(H,D.lens,D.nlen,D.ndist,D.distcode,0,D.work,k),D.distbits=k.bits,p){b.msg="invalid distances set",D.mode=30;break}if(D.mode=20,c===6)break B;case 20:D.mode=21;case 21:if(6<=s&&258<=G0){b.next_out=V0,b.avail_out=G0,b.next_in=i,b.avail_in=s,D.hold=r,D.bits=y,q(b,o),V0=b.next_out,B0=b.output,G0=b.avail_out,i=b.next_in,m=b.input,s=b.avail_in,r=D.hold,y=D.bits,D.mode===12&&(D.back=-1);break}for(D.back=0;u=(X=D.lencode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,D.length=h,u===0){D.mode=26;break}if(32&u){D.back=-1,D.mode=12;break}if(64&u){b.msg="invalid literal/length code",D.mode=30;break}D.extra=15&u,D.mode=22;case 22:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}D.was=D.length,D.mode=23;case 23:for(;u=(X=D.distcode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,64&u){b.msg="invalid distance code",D.mode=30;break}D.offset=h,D.extra=15&u,D.mode=24;case 24:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}if(D.offset>D.dmax){b.msg="invalid distance too far back",D.mode=30;break}D.mode=25;case 25:if(G0===0)break B;if(Y0=o-G0,D.offset>Y0){if((Y0=D.offset-Y0)>D.whave&&D.sane){b.msg="invalid distance too far back",D.mode=30;break}O0=Y0>D.wnext?(Y0-=D.wnext,D.wsize-Y0):D.wnext-Y0,Y0>D.length&&(Y0=D.length),w=D.window}else w=B0,O0=V0-D.offset,Y0=D.length;for(G0$?(z=O0[w+E[c]],y[n+E[c]]):(z=96,0),N=1<>V0)+(v-=N)]=x<<24|z<<16|a|0,v!==0;);for(N=1<>=1;if(N!==0?(r&=N-1,r+=N):r=0,c++,--o[b]==0){if(b===m)break;b=H[T+E[c]]}if(B0>>7)]}function n(X,O){X.pending_buf[X.pending++]=255&O,X.pending_buf[X.pending++]=O>>>8&255}function o(X,O,_){X.bi_valid>C-_?(X.bi_buf|=O<>C-X.bi_valid,X.bi_valid+=_-C):(X.bi_buf|=O<>>=1,_<<=1,0<--O;);return _>>>1}function w(X,O,_){var l,d,Q0=Array(E+1),X0=0;for(l=1;l<=E;l++)Q0[l]=X0=X0+_[l-1]<<1;for(d=0;d<=O;d++){var K0=X[2*d+1];K0!==0&&(X[2*d]=O0(Q0[K0]++,K0))}}function L(X){var O;for(O=0;O>1;1<=_;_--)Z0(X,Q0,_);for(d=I0;_=X.heap[1],X.heap[1]=X.heap[X.heap_len--],Z0(X,Q0,1),l=X.heap[1],X.heap[--X.heap_max]=_,X.heap[--X.heap_max]=l,Q0[2*d]=Q0[2*_]+Q0[2*l],X.depth[d]=(X.depth[_]>=X.depth[l]?X.depth[_]:X.depth[l])+1,Q0[2*_+1]=Q0[2*l+1]=d,X.heap[1]=d++,Z0(X,Q0,1),2<=X.heap_len;);X.heap[--X.heap_max]=X.heap[1],function(W0,k0){var L2,m0,r2,z0,W1,p1,Y2=k0.dyn_tree,I6=k0.max_code,X5=k0.stat_desc.static_tree,q5=k0.stat_desc.has_stree,M5=k0.stat_desc.extra_bits,O6=k0.stat_desc.extra_base,i2=k0.stat_desc.max_length,P1=0;for(z0=0;z0<=E;z0++)W0.bl_count[z0]=0;for(Y2[2*W0.heap[W0.heap_max]+1]=0,L2=W0.heap_max+1;L2>=7;d>>=1)if(1&F0&&K0.dyn_ltree[2*I0]!==0)return Z;if(K0.dyn_ltree[18]!==0||K0.dyn_ltree[20]!==0||K0.dyn_ltree[26]!==0)return J;for(I0=32;I0>>3,(Q0=X.static_len+3+7>>>3)<=d&&(d=Q0)):d=Q0=_+5,_+4<=d&&O!==-1?V(X,O,_,l):X.strategy===4||Q0===d?(o(X,2+(l?1:0),3),g(X,U0,b)):(o(X,4+(l?1:0),3),function(K0,I0,F0,W0){var k0;for(o(K0,I0-257,5),o(K0,F0-1,5),o(K0,W0-4,4),k0=0;k0>>8&255,X.pending_buf[X.d_buf+2*X.last_lit+1]=255&O,X.pending_buf[X.l_buf+X.last_lit]=255&_,X.last_lit++,O===0?X.dyn_ltree[2*_]++:(X.matches++,O--,X.dyn_ltree[2*(D[_]+H+1)]++,X.dyn_dtree[2*y(O)]++),X.last_lit===X.lit_bufsize-1},Q._tr_align=function(X){o(X,2,3),Y0(X,v,U0),function(O){O.bi_valid===16?(n(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(X)}},{"../utils/common":41}],53:[function(G,Y,Q){Y.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(G,Y,Q){(function(K){(function(Z,J){if(!Z.setImmediate){var q,W,I,H,T=1,A={},P=!1,j=Z.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(Z);E=E&&E.setTimeout?E:Z,q={}.toString.call(Z.process)==="[object process]"?function(S){P0.nextTick(function(){N(S)})}:function(){if(Z.postMessage&&!Z.importScripts){var S=!0,F=Z.onmessage;return Z.onmessage=function(){S=!1},Z.postMessage("","*"),Z.onmessage=F,S}}()?(H="setImmediate$"+Math.random()+"$",Z.addEventListener?Z.addEventListener("message",v,!1):Z.attachEvent("onmessage",v),function(S){Z.postMessage(H+S,"*")}):Z.MessageChannel?((I=new MessageChannel).port1.onmessage=function(S){N(S.data)},function(S){I.port2.postMessage(S)}):j&&("onreadystatechange"in j.createElement("script"))?(W=j.documentElement,function(S){var F=j.createElement("script");F.onreadystatechange=function(){N(S),F.onreadystatechange=null,W.removeChild(F),F=null},W.appendChild(F)}):function(S){setTimeout(N,0,S)},E.setImmediate=function(S){typeof S!="function"&&(S=Function(""+S));for(var F=Array(arguments.length-1),M=0;M"u"?K===void 0?this:K:self)}).call(this,typeof v0<"u"?v0:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}),kK=R0((B,U)=>{var G={"&":"&",'"':""","'":"'","<":"<",">":">"};function Y(Q){return Q&&Q.replace?Q.replace(/([&"<>'])/g,function(K,Z){return G[Z]}):Q}U.exports=Y}),$K=R0((B,U)=>{P2();var G=kK(),Y=x8().Stream,Q=" ";function K(H,T){if(typeof T!=="object")T={indent:T};var A=T.stream?new Y:null,P="",j=!1,E=!T.indent?"":T.indent===!0?Q:T.indent,C=!0;function N($){if(!C)$();else P0.nextTick($)}function v($,x){if(x!==void 0)P+=x;if($&&!j)A=A||new Y,j=!0;if($&&j){var z=P;N(function(){A.emit("data",z)}),P=""}}function S($,x){W(v,q($,E,E?1:0),x)}function F(){if(A){var $=P;N(function(){A.emit("data",$),A.emit("end"),A.readable=!1,A.emit("close")})}}function M($){var x={version:"1.0",encoding:$.encoding||"UTF-8"};if($.standalone)x.standalone=$.standalone;S({"?xml":{_attr:x}}),P=P.replace("/>","?>")}if(N(function(){C=!1}),T.declaration)M(T.declaration);if(H&&H.forEach)H.forEach(function($,x){var z;if(x+1===H.length)z=F;S($,z)});else S(H,F);if(A)return A.readable=!0,A;return P}function Z(){var H={_elem:q(Array.prototype.slice.call(arguments))};return H.push=function(T){if(!this.append)throw Error("not assigned to a parent!");var A=this,P=this._elem.indent;W(this.append,q(T,P,this._elem.icount+(P?1:0)),function(){A.append(!0)})},H.close=function(T){if(T!==void 0)this.push(T);if(this.end)this.end()},H}function J(H,T){return Array(T||0).join(H||"")}function q(H,T,A){A=A||0;var P=J(T,A),j,E=H,C=!1;if(typeof H==="object"){if(j=Object.keys(H)[0],E=H[j],E&&E._elem)return E._elem.name=j,E._elem.icount=A,E._elem.indent=T,E._elem.indents=P,E._elem.interrupt=E,E._elem}var N=[],v=[],S;function F(M){Object.keys(M).forEach(function($){N.push(I($,M[$]))})}switch(typeof E){case"object":if(E===null)break;if(E._attr)F(E._attr);if(E._cdata)v.push(("/g,"]]]]>")+"]]>");if(E.forEach){if(S=!1,v.push(""),E.forEach(function(M){if(typeof M=="object")if(Object.keys(M)[0]=="_attr")F(M._attr);else v.push(q(M,T,A+1));else v.pop(),S=!0,v.push(G(M))}),!S)v.push("")}break;default:v.push(G(E))}return{name:j,interrupt:C,attributes:N,content:v,icount:A,indents:P,indent:T}}function W(H,T,A){if(typeof T!="object")return H(!1,T);var P=T.interrupt?1:T.content.length;function j(){while(T.content.length){var C=T.content.shift();if(C===void 0)continue;if(E(C))return;W(H,C)}if(H(!1,(P>1?T.indents:"")+(T.name?"":"")+(T.indent&&!A?` + */(function(G){if(typeof B=="object"&&typeof U<"u")U.exports=G();else if(typeof define=="function"&&define.amd)define([],G);else(typeof window<"u"?window:typeof v0<"u"?v0:typeof self<"u"?self:this).JSZip=G()})(function(){return function G(Y,Q,K){function Z(W,I){if(!Q[W]){if(!Y[W]){var H=typeof z1=="function"&&z1;if(!I&&H)return H(W,!0);if(J)return J(W,!0);var T=Error("Cannot find module '"+W+"'");throw T.code="MODULE_NOT_FOUND",T}var A=Q[W]={exports:{}};Y[W][0].call(A.exports,function(P){var j=Y[W][1][P];return Z(j||P)},A,A.exports,G,Y,Q,K)}return Q[W].exports}for(var J=typeof z1=="function"&&z1,q=0;q>2,A=(3&W)<<4|I>>4,P=1>6:64,j=2>4,I=(15&T)<<4|(A=J.indexOf(q.charAt(j++)))>>2,H=(3&A)<<6|(P=J.indexOf(q.charAt(j++))),N[E++]=W,A!==64&&(N[E++]=I),P!==64&&(N[E++]=H);return N}},{"./support":30,"./utils":32}],2:[function(G,Y,Q){var K=G("./external"),Z=G("./stream/DataWorker"),J=G("./stream/Crc32Probe"),q=G("./stream/DataLengthProbe");function W(I,H,T,A,P){this.compressedSize=I,this.uncompressedSize=H,this.crc32=T,this.compression=A,this.compressedContent=P}W.prototype={getContentWorker:function(){var I=new Z(K.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new q("data_length")),H=this;return I.on("end",function(){if(this.streamInfo.data_length!==H.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),I},getCompressedWorker:function(){return new Z(K.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},W.createWorkerFrom=function(I,H,T){return I.pipe(new J).pipe(new q("uncompressedSize")).pipe(H.compressWorker(T)).pipe(new q("compressedSize")).withStreamInfo("compression",H)},Y.exports=W},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(G,Y,Q){var K=G("./stream/GenericWorker");Q.STORE={magic:"\x00\x00",compressWorker:function(){return new K("STORE compression")},uncompressWorker:function(){return new K("STORE decompression")}},Q.DEFLATE=G("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(G,Y,Q){var K=G("./utils"),Z=function(){for(var J,q=[],W=0;W<256;W++){J=W;for(var I=0;I<8;I++)J=1&J?3988292384^J>>>1:J>>>1;q[W]=J}return q}();Y.exports=function(J,q){return J!==void 0&&J.length?K.getTypeOf(J)!=="string"?function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I[j])];return-1^W}(0|q,J,J.length,0):function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I.charCodeAt(j))];return-1^W}(0|q,J,J.length,0):0}},{"./utils":32}],5:[function(G,Y,Q){Q.base64=!1,Q.binary=!1,Q.dir=!1,Q.createFolders=!0,Q.date=null,Q.compression=null,Q.compressionOptions=null,Q.comment=null,Q.unixPermissions=null,Q.dosPermissions=null},{}],6:[function(G,Y,Q){var K=null;K=typeof Promise<"u"?Promise:G("lie"),Y.exports={Promise:K}},{lie:37}],7:[function(G,Y,Q){var K=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",Z=G("pako"),J=G("./utils"),q=G("./stream/GenericWorker"),W=K?"uint8array":"array";function I(H,T){q.call(this,"FlateWorker/"+H),this._pako=null,this._pakoAction=H,this._pakoOptions=T,this.meta={}}Q.magic="\b\x00",J.inherits(I,q),I.prototype.processChunk=function(H){this.meta=H.meta,this._pako===null&&this._createPako(),this._pako.push(J.transformTo(W,H.data),!1)},I.prototype.flush=function(){q.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},I.prototype.cleanUp=function(){q.prototype.cleanUp.call(this),this._pako=null},I.prototype._createPako=function(){this._pako=new Z[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var H=this;this._pako.onData=function(T){H.push({data:T,meta:H.meta})}},Q.compressWorker=function(H){return new I("Deflate",H)},Q.uncompressWorker=function(){return new I("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(G,Y,Q){function K(A,P){var j,E="";for(j=0;j>>=8;return E}function Z(A,P,j,E,C,N){var v,S,F=A.file,M=A.compression,$=N!==W.utf8encode,x=J.transformTo("string",N(F.name)),w=J.transformTo("string",W.utf8encode(F.name)),a=F.comment,U0=J.transformTo("string",N(a)),b=J.transformTo("string",W.utf8encode(a)),c=w.length!==F.name.length,D=b.length!==a.length,m="",B0="",i="",V0=F.dir,s=F.date,G0={crc32:0,compressedSize:0,uncompressedSize:0};P&&!j||(G0.crc32=A.crc32,G0.compressedSize=A.compressedSize,G0.uncompressedSize=A.uncompressedSize);var r=0;P&&(r|=8),$||!c&&!D||(r|=2048);var y=0,n=0;V0&&(y|=16),C==="UNIX"?(n=798,y|=function(Y0,O0){var z=Y0;return Y0||(z=O0?16893:33204),(65535&z)<<16}(F.unixPermissions,V0)):(n=20,y|=function(Y0){return 63&(Y0||0)}(F.dosPermissions)),v=s.getUTCHours(),v<<=6,v|=s.getUTCMinutes(),v<<=5,v|=s.getUTCSeconds()/2,S=s.getUTCFullYear()-1980,S<<=4,S|=s.getUTCMonth()+1,S<<=5,S|=s.getUTCDate(),c&&(B0=K(1,1)+K(I(x),4)+w,m+="up"+K(B0.length,2)+B0),D&&(i=K(1,1)+K(I(U0),4)+b,m+="uc"+K(i.length,2)+i);var o="";return o+=` +\x00`,o+=K(r,2),o+=M.magic,o+=K(v,2),o+=K(S,2),o+=K(G0.crc32,4),o+=K(G0.compressedSize,4),o+=K(G0.uncompressedSize,4),o+=K(x.length,2),o+=K(m.length,2),{fileRecord:H.LOCAL_FILE_HEADER+o+x+m,dirRecord:H.CENTRAL_FILE_HEADER+K(n,2)+o+K(U0.length,2)+"\x00\x00\x00\x00"+K(y,4)+K(E,4)+x+m+U0}}var J=G("../utils"),q=G("../stream/GenericWorker"),W=G("../utf8"),I=G("../crc32"),H=G("../signature");function T(A,P,j,E){q.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=j,this.encodeFileName=E,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}J.inherits(T,q),T.prototype.push=function(A){var P=A.meta.percent||0,j=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,q.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:j?(P+100*(j-E-1))/j:100}}))},T.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var P=this.streamFiles&&!A.file.dir;if(P){var j=Z(A,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},T.prototype.closedSource=function(A){this.accumulate=!1;var P=this.streamFiles&&!A.file.dir,j=Z(A,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),P)this.push({data:function(E){return H.DATA_DESCRIPTOR+K(E.crc32,4)+K(E.compressedSize,4)+K(E.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},T.prototype.flush=function(){for(var A=this.bytesWritten,P=0;P=this.index;q--)W=(W<<8)+this.byteAt(q);return this.index+=J,W},readString:function(J){return K.transformTo("string",this.readData(J))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var J=this.readInt(4);return new Date(Date.UTC(1980+(J>>25&127),(J>>21&15)-1,J>>16&31,J>>11&31,J>>5&63,(31&J)<<1))}},Y.exports=Z},{"../utils":32}],19:[function(G,Y,Q){var K=G("./Uint8ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(G,Y,Q){var K=G("./DataReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.byteAt=function(J){return this.data.charCodeAt(this.zero+J)},Z.prototype.lastIndexOfSignature=function(J){return this.data.lastIndexOf(J)-this.zero},Z.prototype.readAndCheckSignature=function(J){return J===this.readData(4)},Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./DataReader":18}],21:[function(G,Y,Q){var K=G("./ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){if(this.checkOffset(J),J===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./ArrayReader":17}],22:[function(G,Y,Q){var K=G("../utils"),Z=G("../support"),J=G("./ArrayReader"),q=G("./StringReader"),W=G("./NodeBufferReader"),I=G("./Uint8ArrayReader");Y.exports=function(H){var T=K.getTypeOf(H);return K.checkSupport(T),T!=="string"||Z.uint8array?T==="nodebuffer"?new W(H):Z.uint8array?new I(K.transformTo("uint8array",H)):new J(K.transformTo("array",H)):new q(H)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(G,Y,Q){Q.LOCAL_FILE_HEADER="PK\x03\x04",Q.CENTRAL_FILE_HEADER="PK\x01\x02",Q.CENTRAL_DIRECTORY_END="PK\x05\x06",Q.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",Q.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",Q.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../utils");function J(q){K.call(this,"ConvertWorker to "+q),this.destType=q}Z.inherits(J,K),J.prototype.processChunk=function(q){this.push({data:Z.transformTo(this.destType,q.data),meta:q.meta})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],25:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../crc32");function J(){K.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}G("../utils").inherits(J,K),J.prototype.processChunk=function(q){this.streamInfo.crc32=Z(q.data,this.streamInfo.crc32||0),this.push(q)},Y.exports=J},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataLengthProbe for "+q),this.propName=q,this.withStreamInfo(q,0)}K.inherits(J,Z),J.prototype.processChunk=function(q){if(q){var W=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=W+q.data.length}Z.prototype.processChunk.call(this,q)},Y.exports=J},{"../utils":32,"./GenericWorker":28}],27:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataWorker");var W=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,q.then(function(I){W.dataIsReady=!0,W.data=I,W.max=I&&I.length||0,W.type=K.getTypeOf(I),W.isPaused||W._tickAndRepeat()},function(I){W.error(I)})}K.inherits(J,Z),J.prototype.cleanUp=function(){Z.prototype.cleanUp.call(this),this.data=null},J.prototype.resume=function(){return!!Z.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,K.delay(this._tickAndRepeat,[],this)),!0)},J.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(K.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},J.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var q=null,W=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":q=this.data.substring(this.index,W);break;case"uint8array":q=this.data.subarray(this.index,W);break;case"array":case"nodebuffer":q=this.data.slice(this.index,W)}return this.index=W,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],28:[function(G,Y,Q){function K(Z){this.name=Z||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}K.prototype={push:function(Z){this.emit("data",Z)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Z){this.emit("error",Z)}return!0},error:function(Z){return!this.isFinished&&(this.isPaused?this.generatedError=Z:(this.isFinished=!0,this.emit("error",Z),this.previous&&this.previous.error(Z),this.cleanUp()),!0)},on:function(Z,J){return this._listeners[Z].push(J),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Z,J){if(this._listeners[Z])for(var q=0;q "+Z:Z}},Y.exports=K},{}],29:[function(G,Y,Q){var K=G("../utils"),Z=G("./ConvertWorker"),J=G("./GenericWorker"),q=G("../base64"),W=G("../support"),I=G("../external"),H=null;if(W.nodestream)try{H=G("../nodejs/NodejsStreamOutputAdapter")}catch(P){}function T(P,j){return new I.Promise(function(E,C){var N=[],v=P._internalType,S=P._outputType,F=P._mimeType;P.on("data",function(M,$){N.push(M),j&&j($)}).on("error",function(M){N=[],C(M)}).on("end",function(){try{E(function(M,$,x){switch(M){case"blob":return K.newBlob(K.transformTo("arraybuffer",$),x);case"base64":return q.encode($);default:return K.transformTo(M,$)}}(S,function(M,$){var x,w=0,a=null,U0=0;for(x=0;x<$.length;x++)U0+=$[x].length;switch(M){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":for(a=new Uint8Array(U0),x=0;x<$.length;x++)a.set($[x],w),w+=$[x].length;return a;case"nodebuffer":return Buffer.concat($);default:throw Error("concat : unsupported type '"+M+"'")}}(v,N),F))}catch(M){C(M)}N=[]}).resume()})}function A(P,j,E){var C=j;switch(j){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=j,this._mimeType=E,K.checkSupport(C),this._worker=P.pipe(new Z(C)),P.lock()}catch(N){this._worker=new J("error"),this._worker.error(N)}}A.prototype={accumulate:function(P){return T(this,P)},on:function(P,j){var E=this;return P==="data"?this._worker.on(P,function(C){j.call(E,C.data,C.meta)}):this._worker.on(P,function(){K.delay(j,arguments,E)}),this},resume:function(){return K.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(P){if(K.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new H(this,{objectMode:this._outputType!=="nodebuffer"},P)}},Y.exports=A},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(G,Y,Q){if(Q.base64=!0,Q.array=!0,Q.string=!0,Q.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Q.nodebuffer=typeof Buffer<"u",Q.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")Q.blob=!1;else{var K=new ArrayBuffer(0);try{Q.blob=new Blob([K],{type:"application/zip"}).size===0}catch(J){try{var Z=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Z.append(K),Q.blob=Z.getBlob("application/zip").size===0}catch(q){Q.blob=!1}}}try{Q.nodestream=!!G("readable-stream").Readable}catch(J){Q.nodestream=!1}},{"readable-stream":16}],31:[function(G,Y,Q){for(var K=G("./utils"),Z=G("./support"),J=G("./nodejsUtils"),q=G("./stream/GenericWorker"),W=Array(256),I=0;I<256;I++)W[I]=252<=I?6:248<=I?5:240<=I?4:224<=I?3:192<=I?2:1;W[254]=W[254]=1;function H(){q.call(this,"utf-8 decode"),this.leftOver=null}function T(){q.call(this,"utf-8 encode")}Q.utf8encode=function(A){return Z.nodebuffer?J.newBufferFrom(A,"utf-8"):function(P){var j,E,C,N,v,S=P.length,F=0;for(N=0;N>>6:(E<65536?j[v++]=224|E>>>12:(j[v++]=240|E>>>18,j[v++]=128|E>>>12&63),j[v++]=128|E>>>6&63),j[v++]=128|63&E);return j}(A)},Q.utf8decode=function(A){return Z.nodebuffer?K.transformTo("nodebuffer",A).toString("utf-8"):function(P){var j,E,C,N,v=P.length,S=Array(2*v);for(j=E=0;j>10&1023,S[E++]=56320|1023&C)}return S.length!==E&&(S.subarray?S=S.subarray(0,E):S.length=E),K.applyFromCharCode(S)}(A=K.transformTo(Z.uint8array?"uint8array":"array",A))},K.inherits(H,q),H.prototype.processChunk=function(A){var P=K.transformTo(Z.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(Z.uint8array){var j=P;(P=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),P.set(j,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var E=function(N,v){var S;for((v=v||N.length)>N.length&&(v=N.length),S=v-1;0<=S&&(192&N[S])==128;)S--;return S<0?v:S===0?v:S+W[N[S]]>v?S:v}(P),C=P;E!==P.length&&(Z.uint8array?(C=P.subarray(0,E),this.leftOver=P.subarray(E,P.length)):(C=P.slice(0,E),this.leftOver=P.slice(E,P.length))),this.push({data:Q.utf8decode(C),meta:A.meta})},H.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:Q.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},Q.Utf8DecodeWorker=H,K.inherits(T,q),T.prototype.processChunk=function(A){this.push({data:Q.utf8encode(A.data),meta:A.meta})},Q.Utf8EncodeWorker=T},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(G,Y,Q){var K=G("./support"),Z=G("./base64"),J=G("./nodejsUtils"),q=G("./external");function W(j){return j}function I(j,E){for(var C=0;C>8;this.dir=!!(16&this.externalFileAttributes),A==0&&(this.dosPermissions=63&this.externalFileAttributes),A==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var A=K(this.extraFields[1].value);this.uncompressedSize===Z.MAX_VALUE_32BITS&&(this.uncompressedSize=A.readInt(8)),this.compressedSize===Z.MAX_VALUE_32BITS&&(this.compressedSize=A.readInt(8)),this.localHeaderOffset===Z.MAX_VALUE_32BITS&&(this.localHeaderOffset=A.readInt(8)),this.diskNumberStart===Z.MAX_VALUE_32BITS&&(this.diskNumberStart=A.readInt(4))}},readExtraFields:function(A){var P,j,E,C=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(A<65536?T[E++]=224|A>>>12:(T[E++]=240|A>>>18,T[E++]=128|A>>>12&63),T[E++]=128|A>>>6&63),T[E++]=128|63&A);return T},Q.buf2binstring=function(H){return I(H,H.length)},Q.binstring2buf=function(H){for(var T=new K.Buf8(H.length),A=0,P=T.length;A>10&1023,N[P++]=56320|1023&j)}return I(N,P)},Q.utf8border=function(H,T){var A;for((T=T||H.length)>H.length&&(T=H.length),A=T-1;0<=A&&(192&H[A])==128;)A--;return A<0?T:A===0?T:A+q[H[A]]>T?A:T}},{"./common":41}],43:[function(G,Y,Q){Y.exports=function(K,Z,J,q){for(var W=65535&K|0,I=K>>>16&65535|0,H=0;J!==0;){for(J-=H=2000>>1:Z>>>1;J[q]=Z}return J}();Y.exports=function(Z,J,q,W){var I=K,H=W+q;Z^=-1;for(var T=W;T>>8^I[255&(Z^J[T])];return-1^Z}},{}],46:[function(G,Y,Q){var K,Z=G("../utils/common"),J=G("./trees"),q=G("./adler32"),W=G("./crc32"),I=G("./messages"),H=0,T=4,A=0,P=-2,j=-1,E=4,C=2,N=8,v=9,S=286,F=30,M=19,$=2*S+1,x=15,w=3,a=258,U0=a+w+1,b=42,c=113,D=1,m=2,B0=3,i=4;function V0(R,p){return R.msg=I[p],p}function s(R){return(R<<1)-(4R.avail_out&&(k=R.avail_out),k!==0&&(Z.arraySet(R.output,p.pending_buf,p.pending_out,k,R.next_out),R.next_out+=k,p.pending_out+=k,R.total_out+=k,R.avail_out-=k,p.pending-=k,p.pending===0&&(p.pending_out=0))}function y(R,p){J._tr_flush_block(R,0<=R.block_start?R.block_start:-1,R.strstart-R.block_start,p),R.block_start=R.strstart,r(R.strm)}function n(R,p){R.pending_buf[R.pending++]=p}function o(R,p){R.pending_buf[R.pending++]=p>>>8&255,R.pending_buf[R.pending++]=255&p}function Y0(R,p){var k,V,X=R.max_chain_length,O=R.strstart,_=R.prev_length,l=R.nice_match,d=R.strstart>R.w_size-U0?R.strstart-(R.w_size-U0):0,Q0=R.window,X0=R.w_mask,K0=R.prev,I0=R.strstart+a,F0=Q0[O+_-1],W0=Q0[O+_];R.prev_length>=R.good_match&&(X>>=2),l>R.lookahead&&(l=R.lookahead);do if(Q0[(k=p)+_]===W0&&Q0[k+_-1]===F0&&Q0[k]===Q0[O]&&Q0[++k]===Q0[O+1]){O+=2,k++;do;while(Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Od&&--X!=0);return _<=R.lookahead?_:R.lookahead}function O0(R){var p,k,V,X,O,_,l,d,Q0,X0,K0=R.w_size;do{if(X=R.window_size-R.lookahead-R.strstart,R.strstart>=K0+(K0-U0)){for(Z.arraySet(R.window,R.window,K0,K0,0),R.match_start-=K0,R.strstart-=K0,R.block_start-=K0,p=k=R.hash_size;V=R.head[--p],R.head[p]=K0<=V?V-K0:0,--k;);for(p=k=K0;V=R.prev[--p],R.prev[p]=K0<=V?V-K0:0,--k;);X+=K0}if(R.strm.avail_in===0)break;if(_=R.strm,l=R.window,d=R.strstart+R.lookahead,Q0=X,X0=void 0,X0=_.avail_in,Q0=w)for(O=R.strstart-R.insert,R.ins_h=R.window[O],R.ins_h=(R.ins_h<=w&&(R.ins_h=(R.ins_h<=w)if(V=J._tr_tally(R,R.strstart-R.match_start,R.match_length-w),R.lookahead-=R.match_length,R.match_length<=R.max_lazy_match&&R.lookahead>=w){for(R.match_length--;R.strstart++,R.ins_h=(R.ins_h<=w&&(R.ins_h=(R.ins_h<=w&&R.match_length<=R.prev_length){for(X=R.strstart+R.lookahead-w,V=J._tr_tally(R,R.strstart-1-R.prev_match,R.prev_length-w),R.lookahead-=R.prev_length-1,R.prev_length-=2;++R.strstart<=X&&(R.ins_h=(R.ins_h<R.pending_buf_size-5&&(k=R.pending_buf_size-5);;){if(R.lookahead<=1){if(O0(R),R.lookahead===0&&p===H)return D;if(R.lookahead===0)break}R.strstart+=R.lookahead,R.lookahead=0;var V=R.block_start+k;if((R.strstart===0||R.strstart>=V)&&(R.lookahead=R.strstart-V,R.strstart=V,y(R,!1),R.strm.avail_out===0))return D;if(R.strstart-R.block_start>=R.w_size-U0&&(y(R,!1),R.strm.avail_out===0))return D}return R.insert=0,p===T?(y(R,!0),R.strm.avail_out===0?B0:i):(R.strstart>R.block_start&&(y(R,!1),R.strm.avail_out),D)}),new u(4,4,8,4,z),new u(4,5,16,8,z),new u(4,6,32,32,z),new u(4,4,16,16,L),new u(8,16,32,32,L),new u(8,16,128,128,L),new u(8,32,128,256,L),new u(32,128,258,1024,L),new u(32,258,258,4096,L)],Q.deflateInit=function(R,p){return f(R,p,N,15,8,0)},Q.deflateInit2=f,Q.deflateReset=g,Q.deflateResetKeep=Z0,Q.deflateSetHeader=function(R,p){return R&&R.state?R.state.wrap!==2?P:(R.state.gzhead=p,A):P},Q.deflate=function(R,p){var k,V,X,O;if(!R||!R.state||5>8&255),n(V,V.gzhead.time>>16&255),n(V,V.gzhead.time>>24&255),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,255&V.gzhead.os),V.gzhead.extra&&V.gzhead.extra.length&&(n(V,255&V.gzhead.extra.length),n(V,V.gzhead.extra.length>>8&255)),V.gzhead.hcrc&&(R.adler=W(R.adler,V.pending_buf,V.pending,0)),V.gzindex=0,V.status=69):(n(V,0),n(V,0),n(V,0),n(V,0),n(V,0),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,3),V.status=c);else{var _=N+(V.w_bits-8<<4)<<8;_|=(2<=V.strategy||V.level<2?0:V.level<6?1:V.level===6?2:3)<<6,V.strstart!==0&&(_|=32),_+=31-_%31,V.status=c,o(V,_),V.strstart!==0&&(o(V,R.adler>>>16),o(V,65535&R.adler)),R.adler=1}if(V.status===69)if(V.gzhead.extra){for(X=V.pending;V.gzindex<(65535&V.gzhead.extra.length)&&(V.pending!==V.pending_buf_size||(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending!==V.pending_buf_size));)n(V,255&V.gzhead.extra[V.gzindex]),V.gzindex++;V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),V.gzindex===V.gzhead.extra.length&&(V.gzindex=0,V.status=73)}else V.status=73;if(V.status===73)if(V.gzhead.name){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.gzindex=0,V.status=91)}else V.status=91;if(V.status===91)if(V.gzhead.comment){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.status=103)}else V.status=103;if(V.status===103&&(V.gzhead.hcrc?(V.pending+2>V.pending_buf_size&&r(R),V.pending+2<=V.pending_buf_size&&(n(V,255&R.adler),n(V,R.adler>>8&255),R.adler=0,V.status=c)):V.status=c),V.pending!==0){if(r(R),R.avail_out===0)return V.last_flush=-1,A}else if(R.avail_in===0&&s(p)<=s(k)&&p!==T)return V0(R,-5);if(V.status===666&&R.avail_in!==0)return V0(R,-5);if(R.avail_in!==0||V.lookahead!==0||p!==H&&V.status!==666){var l=V.strategy===2?function(d,Q0){for(var X0;;){if(d.lookahead===0&&(O0(d),d.lookahead===0)){if(Q0===H)return D;break}if(d.match_length=0,X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++,X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):V.strategy===3?function(d,Q0){for(var X0,K0,I0,F0,W0=d.window;;){if(d.lookahead<=a){if(O0(d),d.lookahead<=a&&Q0===H)return D;if(d.lookahead===0)break}if(d.match_length=0,d.lookahead>=w&&0d.lookahead&&(d.match_length=d.lookahead)}if(d.match_length>=w?(X0=J._tr_tally(d,1,d.match_length-w),d.lookahead-=d.match_length,d.strstart+=d.match_length,d.match_length=0):(X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++),X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):K[V.level].func(V,p);if(l!==B0&&l!==i||(V.status=666),l===D||l===B0)return R.avail_out===0&&(V.last_flush=-1),A;if(l===m&&(p===1?J._tr_align(V):p!==5&&(J._tr_stored_block(V,0,0,!1),p===3&&(G0(V.head),V.lookahead===0&&(V.strstart=0,V.block_start=0,V.insert=0))),r(R),R.avail_out===0))return V.last_flush=-1,A}return p!==T?A:V.wrap<=0?1:(V.wrap===2?(n(V,255&R.adler),n(V,R.adler>>8&255),n(V,R.adler>>16&255),n(V,R.adler>>24&255),n(V,255&R.total_in),n(V,R.total_in>>8&255),n(V,R.total_in>>16&255),n(V,R.total_in>>24&255)):(o(V,R.adler>>>16),o(V,65535&R.adler)),r(R),0=k.w_size&&(O===0&&(G0(k.head),k.strstart=0,k.block_start=0,k.insert=0),Q0=new Z.Buf8(k.w_size),Z.arraySet(Q0,p,X0-k.w_size,k.w_size,0),p=Q0,X0=k.w_size),_=R.avail_in,l=R.next_in,d=R.input,R.avail_in=X0,R.next_in=0,R.input=p,O0(k);k.lookahead>=w;){for(V=k.strstart,X=k.lookahead-(w-1);k.ins_h=(k.ins_h<>>=w=x>>>24,v-=w,(w=x>>>16&255)===0)m[I++]=65535&x;else{if(!(16&w)){if((64&w)==0){x=S[(65535&x)+(N&(1<>>=w,v-=w),v<15&&(N+=D[q++]<>>=w=x>>>24,v-=w,!(16&(w=x>>>16&255))){if((64&w)==0){x=F[(65535&x)+(N&(1<>>=w,v-=w,(w=I-H)>3,N&=(1<<(v-=a<<3))-1,K.next_in=q,K.next_out=I,K.avail_in=q>>24&255)+(b>>>8&65280)+((65280&b)<<8)+((255&b)<<24)}function N(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new K.Buf16(320),this.work=new K.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(b){var c;return b&&b.state?(c=b.state,b.total_in=b.total_out=c.total=0,b.msg="",c.wrap&&(b.adler=1&c.wrap),c.mode=P,c.last=0,c.havedict=0,c.dmax=32768,c.head=null,c.hold=0,c.bits=0,c.lencode=c.lendyn=new K.Buf32(j),c.distcode=c.distdyn=new K.Buf32(E),c.sane=1,c.back=-1,T):A}function S(b){var c;return b&&b.state?((c=b.state).wsize=0,c.whave=0,c.wnext=0,v(b)):A}function F(b,c){var D,m;return b&&b.state?(m=b.state,c<0?(D=0,c=-c):(D=1+(c>>4),c<48&&(c&=15)),c&&(c<8||15=i.wsize?(K.arraySet(i.window,c,D-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(m<(B0=i.wsize-i.wnext)&&(B0=m),K.arraySet(i.window,c,D-m,B0,i.wnext),(m-=B0)?(K.arraySet(i.window,c,D-m,m,0),i.wnext=m,i.whave=i.wsize):(i.wnext+=B0,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,D.check=J(D.check,O,2,0),y=r=0,D.mode=2;break}if(D.flags=0,D.head&&(D.head.done=!1),!(1&D.wrap)||(((255&r)<<8)+(r>>8))%31){b.msg="incorrect header check",D.mode=30;break}if((15&r)!=8){b.msg="unknown compression method",D.mode=30;break}if(y-=4,R=8+(15&(r>>>=4)),D.wbits===0)D.wbits=R;else if(R>D.wbits){b.msg="invalid window size",D.mode=30;break}D.dmax=1<>8&1),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=3;case 3:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>8&255,O[2]=r>>>16&255,O[3]=r>>>24&255,D.check=J(D.check,O,4,0)),y=r=0,D.mode=4;case 4:for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>8),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=5;case 5:if(1024&D.flags){for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>>8&255,D.check=J(D.check,O,2,0)),y=r=0}else D.head&&(D.head.extra=null);D.mode=6;case 6:if(1024&D.flags&&(s<(Y0=D.length)&&(Y0=s),Y0&&(D.head&&(R=D.head.extra_len-D.length,D.head.extra||(D.head.extra=Array(D.head.extra_len)),K.arraySet(D.head.extra,m,i,Y0,R)),512&D.flags&&(D.check=J(D.check,m,Y0,i)),s-=Y0,i+=Y0,D.length-=Y0),D.length))break B;D.length=0,D.mode=7;case 7:if(2048&D.flags){if(s===0)break B;for(Y0=0;R=m[i+Y0++],D.head&&R&&D.length<65536&&(D.head.name+=String.fromCharCode(R)),R&&Y0>9&1,D.head.done=!0),b.adler=D.check=0,D.mode=12;break;case 10:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>=7&y,y-=7&y,D.mode=27;break}for(;y<3;){if(s===0)break B;s--,r+=m[i++]<>>=1)){case 0:D.mode=14;break;case 1:if(a(D),D.mode=20,c!==6)break;r>>>=2,y-=2;break B;case 2:D.mode=17;break;case 3:b.msg="invalid block type",D.mode=30}r>>>=2,y-=2;break;case 14:for(r>>>=7&y,y-=7&y;y<32;){if(s===0)break B;s--,r+=m[i++]<>>16^65535)){b.msg="invalid stored block lengths",D.mode=30;break}if(D.length=65535&r,y=r=0,D.mode=15,c===6)break B;case 15:D.mode=16;case 16:if(Y0=D.length){if(s>>=5,y-=5,D.ndist=1+(31&r),r>>>=5,y-=5,D.ncode=4+(15&r),r>>>=4,y-=4,286>>=3,y-=3}for(;D.have<19;)D.lens[_[D.have++]]=0;if(D.lencode=D.lendyn,D.lenbits=7,k={bits:D.lenbits},p=W(0,D.lens,0,19,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid code lengths set",D.mode=30;break}D.have=0,D.mode=19;case 19:for(;D.have>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=L,y-=L,D.lens[D.have++]=h;else{if(h===16){for(V=L+2;y>>=L,y-=L,D.have===0){b.msg="invalid bit length repeat",D.mode=30;break}R=D.lens[D.have-1],Y0=3+(3&r),r>>>=2,y-=2}else if(h===17){for(V=L+3;y>>=L)),r>>>=3,y-=3}else{for(V=L+7;y>>=L)),r>>>=7,y-=7}if(D.have+Y0>D.nlen+D.ndist){b.msg="invalid bit length repeat",D.mode=30;break}for(;Y0--;)D.lens[D.have++]=R}}if(D.mode===30)break;if(D.lens[256]===0){b.msg="invalid code -- missing end-of-block",D.mode=30;break}if(D.lenbits=9,k={bits:D.lenbits},p=W(I,D.lens,0,D.nlen,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid literal/lengths set",D.mode=30;break}if(D.distbits=6,D.distcode=D.distdyn,k={bits:D.distbits},p=W(H,D.lens,D.nlen,D.ndist,D.distcode,0,D.work,k),D.distbits=k.bits,p){b.msg="invalid distances set",D.mode=30;break}if(D.mode=20,c===6)break B;case 20:D.mode=21;case 21:if(6<=s&&258<=G0){b.next_out=V0,b.avail_out=G0,b.next_in=i,b.avail_in=s,D.hold=r,D.bits=y,q(b,o),V0=b.next_out,B0=b.output,G0=b.avail_out,i=b.next_in,m=b.input,s=b.avail_in,r=D.hold,y=D.bits,D.mode===12&&(D.back=-1);break}for(D.back=0;u=(X=D.lencode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,D.length=h,u===0){D.mode=26;break}if(32&u){D.back=-1,D.mode=12;break}if(64&u){b.msg="invalid literal/length code",D.mode=30;break}D.extra=15&u,D.mode=22;case 22:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}D.was=D.length,D.mode=23;case 23:for(;u=(X=D.distcode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,64&u){b.msg="invalid distance code",D.mode=30;break}D.offset=h,D.extra=15&u,D.mode=24;case 24:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}if(D.offset>D.dmax){b.msg="invalid distance too far back",D.mode=30;break}D.mode=25;case 25:if(G0===0)break B;if(Y0=o-G0,D.offset>Y0){if((Y0=D.offset-Y0)>D.whave&&D.sane){b.msg="invalid distance too far back",D.mode=30;break}O0=Y0>D.wnext?(Y0-=D.wnext,D.wsize-Y0):D.wnext-Y0,Y0>D.length&&(Y0=D.length),z=D.window}else z=B0,O0=V0-D.offset,Y0=D.length;for(G0$?(w=O0[z+E[c]],y[n+E[c]]):(w=96,0),N=1<>V0)+(v-=N)]=x<<24|w<<16|a|0,v!==0;);for(N=1<>=1;if(N!==0?(r&=N-1,r+=N):r=0,c++,--o[b]==0){if(b===m)break;b=H[T+E[c]]}if(B0>>7)]}function n(X,O){X.pending_buf[X.pending++]=255&O,X.pending_buf[X.pending++]=O>>>8&255}function o(X,O,_){X.bi_valid>C-_?(X.bi_buf|=O<>C-X.bi_valid,X.bi_valid+=_-C):(X.bi_buf|=O<>>=1,_<<=1,0<--O;);return _>>>1}function z(X,O,_){var l,d,Q0=Array(E+1),X0=0;for(l=1;l<=E;l++)Q0[l]=X0=X0+_[l-1]<<1;for(d=0;d<=O;d++){var K0=X[2*d+1];K0!==0&&(X[2*d]=O0(Q0[K0]++,K0))}}function L(X){var O;for(O=0;O>1;1<=_;_--)Z0(X,Q0,_);for(d=I0;_=X.heap[1],X.heap[1]=X.heap[X.heap_len--],Z0(X,Q0,1),l=X.heap[1],X.heap[--X.heap_max]=_,X.heap[--X.heap_max]=l,Q0[2*d]=Q0[2*_]+Q0[2*l],X.depth[d]=(X.depth[_]>=X.depth[l]?X.depth[_]:X.depth[l])+1,Q0[2*_+1]=Q0[2*l+1]=d,X.heap[1]=d++,Z0(X,Q0,1),2<=X.heap_len;);X.heap[--X.heap_max]=X.heap[1],function(W0,k0){var L2,m0,r2,w0,W1,p1,Y2=k0.dyn_tree,I6=k0.max_code,X5=k0.stat_desc.static_tree,q5=k0.stat_desc.has_stree,M5=k0.stat_desc.extra_bits,O6=k0.stat_desc.extra_base,i2=k0.stat_desc.max_length,P1=0;for(w0=0;w0<=E;w0++)W0.bl_count[w0]=0;for(Y2[2*W0.heap[W0.heap_max]+1]=0,L2=W0.heap_max+1;L2>=7;d>>=1)if(1&F0&&K0.dyn_ltree[2*I0]!==0)return Z;if(K0.dyn_ltree[18]!==0||K0.dyn_ltree[20]!==0||K0.dyn_ltree[26]!==0)return J;for(I0=32;I0>>3,(Q0=X.static_len+3+7>>>3)<=d&&(d=Q0)):d=Q0=_+5,_+4<=d&&O!==-1?V(X,O,_,l):X.strategy===4||Q0===d?(o(X,2+(l?1:0),3),g(X,U0,b)):(o(X,4+(l?1:0),3),function(K0,I0,F0,W0){var k0;for(o(K0,I0-257,5),o(K0,F0-1,5),o(K0,W0-4,4),k0=0;k0>>8&255,X.pending_buf[X.d_buf+2*X.last_lit+1]=255&O,X.pending_buf[X.l_buf+X.last_lit]=255&_,X.last_lit++,O===0?X.dyn_ltree[2*_]++:(X.matches++,O--,X.dyn_ltree[2*(D[_]+H+1)]++,X.dyn_dtree[2*y(O)]++),X.last_lit===X.lit_bufsize-1},Q._tr_align=function(X){o(X,2,3),Y0(X,v,U0),function(O){O.bi_valid===16?(n(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(X)}},{"../utils/common":41}],53:[function(G,Y,Q){Y.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(G,Y,Q){(function(K){(function(Z,J){if(!Z.setImmediate){var q,W,I,H,T=1,A={},P=!1,j=Z.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(Z);E=E&&E.setTimeout?E:Z,q={}.toString.call(Z.process)==="[object process]"?function(S){P0.nextTick(function(){N(S)})}:function(){if(Z.postMessage&&!Z.importScripts){var S=!0,F=Z.onmessage;return Z.onmessage=function(){S=!1},Z.postMessage("","*"),Z.onmessage=F,S}}()?(H="setImmediate$"+Math.random()+"$",Z.addEventListener?Z.addEventListener("message",v,!1):Z.attachEvent("onmessage",v),function(S){Z.postMessage(H+S,"*")}):Z.MessageChannel?((I=new MessageChannel).port1.onmessage=function(S){N(S.data)},function(S){I.port2.postMessage(S)}):j&&("onreadystatechange"in j.createElement("script"))?(W=j.documentElement,function(S){var F=j.createElement("script");F.onreadystatechange=function(){N(S),F.onreadystatechange=null,W.removeChild(F),F=null},W.appendChild(F)}):function(S){setTimeout(N,0,S)},E.setImmediate=function(S){typeof S!="function"&&(S=Function(""+S));for(var F=Array(arguments.length-1),M=0;M"u"?K===void 0?this:K:self)}).call(this,typeof v0<"u"?v0:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}),kK=R0((B,U)=>{var G={"&":"&",'"':""","'":"'","<":"<",">":">"};function Y(Q){return Q&&Q.replace?Q.replace(/([&"<>'])/g,function(K,Z){return G[Z]}):Q}U.exports=Y}),$K=R0((B,U)=>{P2();var G=kK(),Y=x8().Stream,Q=" ";function K(H,T){if(typeof T!=="object")T={indent:T};var A=T.stream?new Y:null,P="",j=!1,E=!T.indent?"":T.indent===!0?Q:T.indent,C=!0;function N($){if(!C)$();else P0.nextTick($)}function v($,x){if(x!==void 0)P+=x;if($&&!j)A=A||new Y,j=!0;if($&&j){var w=P;N(function(){A.emit("data",w)}),P=""}}function S($,x){W(v,q($,E,E?1:0),x)}function F(){if(A){var $=P;N(function(){A.emit("data",$),A.emit("end"),A.readable=!1,A.emit("close")})}}function M($){var x={version:"1.0",encoding:$.encoding||"UTF-8"};if($.standalone)x.standalone=$.standalone;S({"?xml":{_attr:x}}),P=P.replace("/>","?>")}if(N(function(){C=!1}),T.declaration)M(T.declaration);if(H&&H.forEach)H.forEach(function($,x){var w;if(x+1===H.length)w=F;S($,w)});else S(H,F);if(A)return A.readable=!0,A;return P}function Z(){var H={_elem:q(Array.prototype.slice.call(arguments))};return H.push=function(T){if(!this.append)throw Error("not assigned to a parent!");var A=this,P=this._elem.indent;W(this.append,q(T,P,this._elem.icount+(P?1:0)),function(){A.append(!0)})},H.close=function(T){if(T!==void 0)this.push(T);if(this.end)this.end()},H}function J(H,T){return Array(T||0).join(H||"")}function q(H,T,A){A=A||0;var P=J(T,A),j,E=H,C=!1;if(typeof H==="object"){if(j=Object.keys(H)[0],E=H[j],E&&E._elem)return E._elem.name=j,E._elem.icount=A,E._elem.indent=T,E._elem.indents=P,E._elem.interrupt=E,E._elem}var N=[],v=[],S;function F(M){Object.keys(M).forEach(function($){N.push(I($,M[$]))})}switch(typeof E){case"object":if(E===null)break;if(E._attr)F(E._attr);if(E._cdata)v.push(("/g,"]]]]>")+"]]>");if(E.forEach){if(S=!1,v.push(""),E.forEach(function(M){if(typeof M=="object")if(Object.keys(M)[0]=="_attr")F(M._attr);else v.push(q(M,T,A+1));else v.pop(),S=!0,v.push(G(M))}),!S)v.push("")}break;default:v.push(G(E))}return{name:j,interrupt:C,attributes:N,content:v,icount:A,indents:P,indent:T}}function W(H,T,A){if(typeof T!="object")return H(!1,T);var P=T.interrupt?1:T.content.length;function j(){while(T.content.length){var C=T.content.shift();if(C===void 0)continue;if(E(C))return;W(H,C)}if(H(!1,(P>1?T.indents:"")+(T.name?"":"")+(T.indent&&!A?` `:"")),A)A()}function E(C){if(C.interrupt)return C.interrupt.append=H,C.interrupt.end=j,C.interrupt=!1,H(!0),!0;return!1}if(H(!1,T.indents+(T.name?"<"+T.name:"")+(T.attributes.length?" "+T.attributes.join(" "):"")+(P?T.name?">":"":T.name?"/>":"")+(T.indent&&P>1?` `:"")),!P)return H(!1,T.indent?` -`:"");if(!E(T))j()}function I(H,T){return H+'="'+G(T)+'"'}U.exports=K,U.exports.element=U.exports.Element=Z}),SK=x8(),h2=k8(CK(),1),A0=k8($K(),1),o2=0,R8=32,bK=32,vK=(B,U)=>{let G=U.replace(/-/g,"");if(G.length!==bK)throw Error(`Error: Cannot extract GUID from font filename: ${U}`);let Y=G.replace(/(..)/g,"$1 ").trim().split(" ").map((Z)=>parseInt(Z,16));Y.reverse();let Q=B.slice(o2,R8).map((Z,J)=>Z^Y[J%Y.length]),K=new Uint8Array(o2+Q.length+Math.max(0,B.length-R8));return K.set(B.slice(0,o2)),K.set(Q,o2),K.set(B.slice(R8),o2+Q.length),K},q6=class{format(B,U={stack:[]}){let G=B.prepForXml(U);if(G)return G;else throw Error("XMLComponent did not format correctly")}},U5=class{replace(B,U,G){let Y=B;return U.forEach((Q,K)=>{Y=Y.replace(new RegExp(`{${Q.fileName}}`,"g"),(G+K).toString())}),Y}getMediaData(B,U){return U.Array.filter((G)=>B.search(`{${G.fileName}}`)>0)}},yK=class{replace(B,U){let G=B;for(let Y of U)G=G.replace(new RegExp(`{${Y.reference}-${Y.instance}}`,"g"),Y.numId.toString());return G}},gK=class{constructor(){e(this,"formatter",void 0),e(this,"imageReplacer",void 0),e(this,"numberingReplacer",void 0),this.formatter=new q6,this.imageReplacer=new U5,this.numberingReplacer=new yK}compile(B,U,G=[]){let Y=new h2.default,Q=this.xmlifyFile(B,U),K=new Map(Object.entries(Q));for(let[,Z]of K)if(Array.isArray(Z))for(let J of Z)Y.file(J.path,U1(J.data));else Y.file(Z.path,U1(Z.data));for(let Z of G)Y.file(Z.path,U1(Z.data));for(let Z of B.Media.Array)if(Z.type!=="svg")Y.file(`word/media/${Z.fileName}`,Z.data);else Y.file(`word/media/${Z.fileName}`,Z.data),Y.file(`word/media/${Z.fallback.fileName}`,Z.fallback.data);for(let[Z,{data:J,fontKey:q}]of B.FontTable.fontOptionsWithKey.entries())Y.file(`word/fonts/font${Z+1}.odttf`,vK(J,q));return Y}xmlifyFile(B,U){let G=B.Document.Relationships.RelationshipCount+1,Y=(0,A0.default)(this.formatter.format(B.Document.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Q=B.Comments.Relationships.RelationshipCount+1,K=(0,A0.default)(this.formatter.format(B.Comments,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Z=B.FootNotes.Relationships.RelationshipCount+1,J=(0,A0.default)(this.formatter.format(B.FootNotes.View,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),q=this.imageReplacer.getMediaData(Y,B.Media),W=this.imageReplacer.getMediaData(K,B.Media),I=this.imageReplacer.getMediaData(J,B.Media);return L0(L0({Relationships:{data:(()=>{return q.forEach((H,T)=>{B.Document.Relationships.addRelationship(G+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),B.Document.Relationships.addRelationship(B.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),(0,A0.default)(this.formatter.format(B.Document.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let H=this.imageReplacer.replace(Y,q,G);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let H=(0,A0.default)(this.formatter.format(B.Styles,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:(0,A0.default)(this.formatter.format(B.CoreProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:(0,A0.default)(this.formatter.format(B.Numbering,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:(0,A0.default)(this.formatter.format(B.FileRelationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${T+1}.xml.rels`}}),FooterRelationships:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${T+1}.xml.rels`}}),Headers:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/header${T+1}.xml`}}),Footers:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/footer${T+1}.xml`}}),ContentTypes:{data:(0,A0.default)(this.formatter.format(B.ContentTypes,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:(0,A0.default)(this.formatter.format(B.CustomProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:(0,A0.default)(this.formatter.format(B.AppProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let H=this.imageReplacer.replace(J,I,Z);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{return I.forEach((H,T)=>{B.FootNotes.Relationships.addRelationship(Z+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.FootNotes.Relationships,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(0,A0.default)(this.formatter.format(B.Endnotes.View,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/endnotes.xml"},EndnotesRelationships:{data:(0,A0.default)(this.formatter.format(B.Endnotes.Relationships,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/endnotes.xml.rels"},Settings:{data:(0,A0.default)(this.formatter.format(B.Settings,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{let H=this.imageReplacer.replace(K,W,Q);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{return W.forEach((H,T)=>{B.Comments.Relationships.addRelationship(Q+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.Comments.Relationships,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}},B.CommentsExtended?{CommentsExtended:{data:(0,A0.default)(this.formatter.format(B.CommentsExtended,{viewWrapper:{View:B.CommentsExtended,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),{},{FontTable:{data:(0,A0.default)(this.formatter.format(B.FontTable.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:(0,A0.default)(this.formatter.format(B.FontTable.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}})}};function t6(B,U,G,Y,Q,K,Z){try{var J=B[K](Z),q=J.value}catch(W){G(W);return}J.done?U(q):Promise.resolve(q).then(Y,Q)}function M6(B){return function(){var U=this,G=arguments;return new Promise(function(Y,Q){var K=B.apply(U,G);function Z(q){t6(K,Y,Q,Z,J,"next",q)}function J(q){t6(K,Y,Q,Z,J,"throw",q)}Z(void 0)})}}var G5={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:"\t"},e6=(B)=>B===!0?G5.WITH_2_BLANKS:B===!1?void 0:B,Y5=class B{static pack(U,G,Y){var Q=this;return M6(function*(K,Z,J,q=[]){return Q.compiler.compile(K,e6(J),q).generateAsync({type:Z,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})}).apply(this,arguments)}static toString(U,G,Y=[]){return B.pack(U,"string",G,Y)}static toBuffer(U,G,Y=[]){return B.pack(U,"nodebuffer",G,Y)}static toBase64String(U,G,Y=[]){return B.pack(U,"base64",G,Y)}static toBlob(U,G,Y=[]){return B.pack(U,"blob",G,Y)}static toArrayBuffer(U,G,Y=[]){return B.pack(U,"arraybuffer",G,Y)}static toStream(U,G,Y=[]){let Q=new SK.Stream;return this.compiler.compile(U,e6(G),Y).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then((K)=>{Q.emit("data",K),Q.emit("end")}),Q}};e(Y5,"compiler",new gK);var fK=new q6,a1=(B)=>{return(0,h1.xml2js)(B,{compact:!1,captureSpacesBetweenElements:!0})},Z5=(B)=>{var U;return(U=a1((0,A0.default)(fK.format(new Z1({text:B})))).elements[0].elements)!==null&&U!==void 0?U:[]},Q5=(B)=>L0(L0({},B),{},{attributes:{"xml:space":"preserve"}}),R6=(B,U)=>{var G,Y;return(G=(Y=B.elements)===null||Y===void 0?void 0:Y.filter((Q)=>Q.name===U)[0].elements)!==null&&G!==void 0?G:[]},g2=(B,U,G)=>{let Y=R6(B,"Types");if(Y.some((Q)=>{var K,Z;return Q.type==="element"&&Q.name==="Default"&&(Q===null||Q===void 0||(K=Q.attributes)===null||K===void 0?void 0:K.ContentType)===U&&(Q===null||Q===void 0||(Z=Q.attributes)===null||Z===void 0?void 0:Z.Extension)===G}))return;Y.push({attributes:{ContentType:U,Extension:G},name:"Default",type:"element"})},xK=(B)=>{let U=parseInt(B.substring(3),10);return isNaN(U)?0:U},_K=(B)=>{return R6(B,"Relationships").map((U)=>{var G,Y;return xK((G=(Y=U.attributes)===null||Y===void 0||(Y=Y.Id)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:"")}).reduce((U,G)=>Math.max(U,G),0)+1},BB=(B,U,G,Y,Q)=>{let K=R6(B,"Relationships");return K.push({attributes:{Id:`rId${U}`,Type:G,Target:Y,TargetMode:Q},name:"Relationship",type:"element"}),K},hK=class extends Error{constructor(B){super(`Token ${B} not found`);this.name="TokenNotFoundError"}},uK=(B,U)=>{var G;for(let Z=0;Z<((G=B.elements)!==null&&G!==void 0?G:[]).length;Z++){let J=B.elements[Z];if(J.type==="element"&&J.name==="w:r"){var Y;let q=((Y=J.elements)!==null&&Y!==void 0?Y:[]).filter((W)=>W.type==="element"&&W.name==="w:t");for(let W of q){var Q,K;if(!((Q=W.elements)===null||Q===void 0?void 0:Q[0]))continue;if((K=W.elements[0].text)===null||K===void 0?void 0:K.includes(U))return Z}}}throw new hK(U)},dK=(B,U)=>{var G,Y;let Q=-1,K=(G=(Y=B.elements)===null||Y===void 0?void 0:Y.map((Z,J)=>{if(Q!==-1)return Z;if(Z.type==="element"&&Z.name==="w:t"){var q,W;let I=((q=(W=Z.elements)===null||W===void 0||(W=W[0])===null||W===void 0?void 0:W.text)!==null&&q!==void 0?q:"").split(U),H=I.map((T)=>L0(L0(L0({},Z),Q5(Z)),{},{elements:Z5(T)}));if(I.length>1)Q=J;return H}else return Z}).flat())!==null&&G!==void 0?G:[];return{left:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(0,Q+1)}),right:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(Q+1)})}},t2={START:0,MIDDLE:1,END:2},cK=({paragraphElement:B,renderedParagraph:U,originalText:G,replacementText:Y})=>{let Q=U.text.indexOf(G),K=Q+G.length-1,Z=t2.START;for(let J of U.runs)for(let{text:q,index:W,start:I,end:H}of J.parts)switch(Z){case t2.START:if(Q>=I&&Q<=H){let T=Q-I,A=Math.min(K,H)-I,P=J.text.substring(T,A+1);if(P==="")continue;let j=q.replace(P,Y);L8(B.elements[J.index].elements[W],j),Z=t2.MIDDLE;continue}break;case t2.MIDDLE:if(K<=H){let T=q.substring(K-I+1);L8(B.elements[J.index].elements[W],T);let A=B.elements[J.index].elements[W];B.elements[J.index].elements[W]=Q5(A),Z=t2.END}else L8(B.elements[J.index].elements[W],"");break;default:}return B},L8=(B,U)=>{return B.elements=Z5(U),B},mK=(B)=>{if(B.element.name!=="w:p")throw Error(`Invalid node type: ${B.element.name}`);if(!B.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let U=0,G=B.element.elements.map((Y,Q)=>({element:Y,i:Q})).filter(({element:Y})=>Y.name==="w:r").map(({element:Y,i:Q})=>{let K=lK(Y,Q,U);return U+=K.text.length,K}).filter((Y)=>!!Y);return{text:G.reduce((Y,Q)=>Y+Q.text,""),runs:G,index:B.index,pathToParagraph:J5(B)}},lK=(B,U,G)=>{if(!B.elements)return{text:"",parts:[],index:-1,start:G,end:G};let Y=G,Q=B.elements.map((K,Z)=>{var J,q;return K.name==="w:t"&&K.elements&&K.elements.length>0?{text:(J=(q=K.elements[0].text)===null||q===void 0?void 0:q.toString())!==null&&J!==void 0?J:"",index:Z,start:Y,end:(()=>{var W,I;return Y+=((W=(I=K.elements[0].text)===null||I===void 0?void 0:I.toString())!==null&&W!==void 0?W:"").length-1,Y})()}:void 0}).filter((K)=>!!K).map((K)=>K);return{text:Q.reduce((K,Z)=>K+Z.text,""),parts:Q,index:U,start:G,end:Y}},J5=(B)=>B.parent?[...J5(B.parent),B.index]:[B.index],UB=(B)=>{var U,G;return(U=(G=B.element.elements)===null||G===void 0?void 0:G.map((Y,Q)=>({element:Y,index:Q,parent:B})))!==null&&U!==void 0?U:[]},K5=(B)=>{let U=[],G=[...UB({element:B,index:0,parent:void 0})],Y;while(G.length>0){if(Y=G.shift(),Y.element.name==="w:p")U=[...U,mK(Y)];G.push(...UB(Y))}return U},aK=(B,U)=>K5(B).filter((G)=>G.text.includes(U)),pK=new q6,I8="ɵ",rK=({json:B,patch:U,patchText:G,context:Y,keepOriginalStyles:Q=!0})=>{let K=aK(B,G);if(K.length===0)return{element:B,didFindOccurrence:!1};for(let Z of K){let J=U.children.map((q)=>a1((0,A0.default)(pK.format(q,Y)))).map((q)=>q.elements[0]);switch(U.type){case C8.DOCUMENT:{let q=iK(B,Z.pathToParagraph),W=nK(Z.pathToParagraph);q.elements.splice(W,1,...J);break}case C8.PARAGRAPH:default:{let q=V5(B,Z.pathToParagraph);cK({paragraphElement:q,renderedParagraph:Z,originalText:G,replacementText:I8});let W=uK(q,I8),I=q.elements[W],{left:H,right:T}=dK(I,I8),A=J,P=T;if(Q){let j=I.elements.filter((E)=>E.type==="element"&&E.name==="w:rPr");A=J.map((E)=>{var C;return L0(L0({},E),{},{elements:[...j,...(C=E.elements)!==null&&C!==void 0?C:[]]})}),P=L0(L0({},T),{},{elements:[...j,...T.elements]})}q.elements.splice(W,1,H,...A,P);break}}}return{element:B,didFindOccurrence:!0}},V5=(B,U)=>{let G=B;for(let Y=1;YV5(B,U.slice(0,U.length-1)),nK=(B)=>B[B.length-1],C8={DOCUMENT:"file",PARAGRAPH:"paragraph"},GB=new U5,sK=new Uint8Array([255,254]),oK=new Uint8Array([254,255]),YB=(B,U)=>{if(B.length!==U.length)return!1;for(let G=0;Gz.name==="w:document");if(x&&x.attributes){for(let z of["mc","wp","r","w15","m"])x.attributes[`xmlns:${z}`]=y1[z];x.attributes["mc:Ignorable"]=`${x.attributes["mc:Ignorable"]||""} w15`.trim()}}if(v.startsWith("word/")&&!v.endsWith(".xml.rels")){let x={file:W,viewWrapper:{Relationships:{addRelationship:(b,c,D,m)=>{T.push({key:v,hyperlink:{id:b,link:D}})}}},stack:[]};if(q.set(v,x),!(K===null||K===void 0?void 0:K.start.trim())||!(K===null||K===void 0?void 0:K.end.trim()))throw Error("Both start and end delimiters must be non-empty strings.");let{start:z,end:a}=K;for(let[b,c]of Object.entries(Y)){let D=`${z}${b}${a}`;while(!0){let{didFindOccurrence:m}=rK({json:$,patch:L0(L0({},c),{},{children:c.children.map((B0)=>{if(B0 instanceof t8){let i=new m2(B0.options.children,O1());return T.push({key:v,hyperlink:{id:i.linkId,link:B0.options.link}}),i}else return B0})}),patchText:D,context:x,keepOriginalStyles:Q});if(!Z||!m)break}}let U0=GB.getMediaData(JSON.stringify($),x.file.Media);if(U0.length>0)A=!0,H.push({key:v,mediaDatas:U0})}I.set(v,$)}for(let{key:v,mediaDatas:S}of H){var E;let F=`word/_rels/${v.split("/").pop()}.rels`,M=(E=I.get(F))!==null&&E!==void 0?E:ZB();I.set(F,M);let $=_K(M),x=GB.replace(JSON.stringify(I.get(v)),S,$);I.set(v,JSON.parse(x));for(let z=0;z{return(0,h1.js2xml)(B,{attributeValueFn:(U)=>String(U).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})},ZB=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),B7=function(){var B=M6(function*({data:U}){let G=U instanceof h2.default?U:yield h2.default.loadAsync(U),Y=new Set;for(let[Q,K]of Object.entries(G.files)){if(!Q.endsWith(".xml")&&!Q.endsWith(".rels"))continue;if(Q.startsWith("word/")&&!Q.endsWith(".xml.rels"))K5(a1(yield K.async("text"))).forEach((Z)=>U7(Z.text).forEach((J)=>Y.add(J)))}return Array.from(Y)});return function(G){return B.apply(this,arguments)}}(),U7=(B)=>{var U;let G=new RegExp("(?<=\\{\\{).+?(?=\\}\\})","gs");return(U=B.match(G))!==null&&U!==void 0?U:[]};if(typeof globalThis.Buffer>"u")globalThis.Buffer=J0;if(typeof globalThis.process>"u")globalThis.process=G7;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.docx=L6;})(); +`:"");if(!E(T))j()}function I(H,T){return H+'="'+G(T)+'"'}U.exports=K,U.exports.element=U.exports.Element=Z}),SK=x8(),h2=k8(CK(),1),A0=k8($K(),1),o2=0,R8=32,bK=32,vK=(B,U)=>{let G=U.replace(/-/g,"");if(G.length!==bK)throw Error(`Error: Cannot extract GUID from font filename: ${U}`);let Y=G.replace(/(..)/g,"$1 ").trim().split(" ").map((Z)=>parseInt(Z,16));Y.reverse();let Q=B.slice(o2,R8).map((Z,J)=>Z^Y[J%Y.length]),K=new Uint8Array(o2+Q.length+Math.max(0,B.length-R8));return K.set(B.slice(0,o2)),K.set(Q,o2),K.set(B.slice(R8),o2+Q.length),K},q6=class{format(B,U={stack:[]}){let G=B.prepForXml(U);if(G)return G;else throw Error("XMLComponent did not format correctly")}},U5=class{replace(B,U,G){let Y=B;return U.forEach((Q,K)=>{Y=Y.replace(new RegExp(`{${Q.fileName}}`,"g"),(G+K).toString())}),Y}getMediaData(B,U){return U.Array.filter((G)=>B.search(`{${G.fileName}}`)>0)}},yK=class{replace(B,U){let G=B;for(let Y of U)G=G.replace(new RegExp(`{${Y.reference}-${Y.instance}}`,"g"),Y.numId.toString());return G}},gK=class{constructor(){e(this,"formatter",void 0),e(this,"imageReplacer",void 0),e(this,"numberingReplacer",void 0),this.formatter=new q6,this.imageReplacer=new U5,this.numberingReplacer=new yK}compile(B,U,G=[]){let Y=new h2.default,Q=this.xmlifyFile(B,U),K=new Map(Object.entries(Q));for(let[,Z]of K)if(Array.isArray(Z))for(let J of Z)Y.file(J.path,U1(J.data));else Y.file(Z.path,U1(Z.data));for(let Z of G)Y.file(Z.path,U1(Z.data));for(let Z of B.Media.Array)if(Z.type!=="svg")Y.file(`word/media/${Z.fileName}`,Z.data);else Y.file(`word/media/${Z.fileName}`,Z.data),Y.file(`word/media/${Z.fallback.fileName}`,Z.fallback.data);for(let[Z,{data:J,fontKey:q}]of B.FontTable.fontOptionsWithKey.entries())Y.file(`word/fonts/font${Z+1}.odttf`,vK(J,q));return Y}xmlifyFile(B,U){let G=B.Document.Relationships.RelationshipCount+1,Y=(0,A0.default)(this.formatter.format(B.Document.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Q=B.Comments.Relationships.RelationshipCount+1,K=(0,A0.default)(this.formatter.format(B.Comments,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Z=B.FootNotes.Relationships.RelationshipCount+1,J=(0,A0.default)(this.formatter.format(B.FootNotes.View,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),q=this.imageReplacer.getMediaData(Y,B.Media),W=this.imageReplacer.getMediaData(K,B.Media),I=this.imageReplacer.getMediaData(J,B.Media);return L0(L0({Relationships:{data:(()=>{return q.forEach((H,T)=>{B.Document.Relationships.addRelationship(G+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),B.Document.Relationships.addRelationship(B.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),(0,A0.default)(this.formatter.format(B.Document.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let H=this.imageReplacer.replace(Y,q,G);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let H=(0,A0.default)(this.formatter.format(B.Styles,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:(0,A0.default)(this.formatter.format(B.CoreProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:(0,A0.default)(this.formatter.format(B.Numbering,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:(0,A0.default)(this.formatter.format(B.FileRelationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${T+1}.xml.rels`}}),FooterRelationships:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${T+1}.xml.rels`}}),Headers:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/header${T+1}.xml`}}),Footers:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/footer${T+1}.xml`}}),ContentTypes:{data:(0,A0.default)(this.formatter.format(B.ContentTypes,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:(0,A0.default)(this.formatter.format(B.CustomProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:(0,A0.default)(this.formatter.format(B.AppProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let H=this.imageReplacer.replace(J,I,Z);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{return I.forEach((H,T)=>{B.FootNotes.Relationships.addRelationship(Z+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.FootNotes.Relationships,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(0,A0.default)(this.formatter.format(B.Endnotes.View,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/endnotes.xml"},EndnotesRelationships:{data:(0,A0.default)(this.formatter.format(B.Endnotes.Relationships,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/endnotes.xml.rels"},Settings:{data:(0,A0.default)(this.formatter.format(B.Settings,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{let H=this.imageReplacer.replace(K,W,Q);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{return W.forEach((H,T)=>{B.Comments.Relationships.addRelationship(Q+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.Comments.Relationships,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}},B.CommentsExtended?{CommentsExtended:{data:(0,A0.default)(this.formatter.format(B.CommentsExtended,{viewWrapper:{View:B.CommentsExtended,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),{},{FontTable:{data:(0,A0.default)(this.formatter.format(B.FontTable.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:(0,A0.default)(this.formatter.format(B.FontTable.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}})}};function t6(B,U,G,Y,Q,K,Z){try{var J=B[K](Z),q=J.value}catch(W){G(W);return}J.done?U(q):Promise.resolve(q).then(Y,Q)}function M6(B){return function(){var U=this,G=arguments;return new Promise(function(Y,Q){var K=B.apply(U,G);function Z(q){t6(K,Y,Q,Z,J,"next",q)}function J(q){t6(K,Y,Q,Z,J,"throw",q)}Z(void 0)})}}var G5={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:"\t"},e6=(B)=>B===!0?G5.WITH_2_BLANKS:B===!1?void 0:B,Y5=class B{static pack(U,G,Y){var Q=this;return M6(function*(K,Z,J,q=[]){return Q.compiler.compile(K,e6(J),q).generateAsync({type:Z,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})}).apply(this,arguments)}static toString(U,G,Y=[]){return B.pack(U,"string",G,Y)}static toBuffer(U,G,Y=[]){return B.pack(U,"nodebuffer",G,Y)}static toBase64String(U,G,Y=[]){return B.pack(U,"base64",G,Y)}static toBlob(U,G,Y=[]){return B.pack(U,"blob",G,Y)}static toArrayBuffer(U,G,Y=[]){return B.pack(U,"arraybuffer",G,Y)}static toStream(U,G,Y=[]){let Q=new SK.Stream;return this.compiler.compile(U,e6(G),Y).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then((K)=>{Q.emit("data",K),Q.emit("end")}),Q}};e(Y5,"compiler",new gK);var fK=new q6,a1=(B)=>{return(0,h1.xml2js)(B,{compact:!1,captureSpacesBetweenElements:!0})},Z5=(B)=>{var U;return(U=a1((0,A0.default)(fK.format(new Z1({text:B})))).elements[0].elements)!==null&&U!==void 0?U:[]},Q5=(B)=>L0(L0({},B),{},{attributes:{"xml:space":"preserve"}}),R6=(B,U)=>{var G,Y;return(G=(Y=B.elements)===null||Y===void 0?void 0:Y.filter((Q)=>Q.name===U)[0].elements)!==null&&G!==void 0?G:[]},g2=(B,U,G)=>{let Y=R6(B,"Types");if(Y.some((Q)=>{var K,Z;return Q.type==="element"&&Q.name==="Default"&&(Q===null||Q===void 0||(K=Q.attributes)===null||K===void 0?void 0:K.ContentType)===U&&(Q===null||Q===void 0||(Z=Q.attributes)===null||Z===void 0?void 0:Z.Extension)===G}))return;Y.push({attributes:{ContentType:U,Extension:G},name:"Default",type:"element"})},xK=(B)=>{let U=parseInt(B.substring(3),10);return isNaN(U)?0:U},_K=(B)=>{return R6(B,"Relationships").map((U)=>{var G,Y;return xK((G=(Y=U.attributes)===null||Y===void 0||(Y=Y.Id)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:"")}).reduce((U,G)=>Math.max(U,G),0)+1},BB=(B,U,G,Y,Q)=>{let K=R6(B,"Relationships");return K.push({attributes:{Id:`rId${U}`,Type:G,Target:Y,TargetMode:Q},name:"Relationship",type:"element"}),K},hK=class extends Error{constructor(B){super(`Token ${B} not found`);this.name="TokenNotFoundError"}},uK=(B,U)=>{var G;for(let Z=0;Z<((G=B.elements)!==null&&G!==void 0?G:[]).length;Z++){let J=B.elements[Z];if(J.type==="element"&&J.name==="w:r"){var Y;let q=((Y=J.elements)!==null&&Y!==void 0?Y:[]).filter((W)=>W.type==="element"&&W.name==="w:t");for(let W of q){var Q,K;if(!((Q=W.elements)===null||Q===void 0?void 0:Q[0]))continue;if((K=W.elements[0].text)===null||K===void 0?void 0:K.includes(U))return Z}}}throw new hK(U)},dK=(B,U)=>{var G,Y;let Q=-1,K=(G=(Y=B.elements)===null||Y===void 0?void 0:Y.map((Z,J)=>{if(Q!==-1)return Z;if(Z.type==="element"&&Z.name==="w:t"){var q,W;let I=((q=(W=Z.elements)===null||W===void 0||(W=W[0])===null||W===void 0?void 0:W.text)!==null&&q!==void 0?q:"").split(U),H=I.map((T)=>L0(L0(L0({},Z),Q5(Z)),{},{elements:Z5(T)}));if(I.length>1)Q=J;return H}else return Z}).flat())!==null&&G!==void 0?G:[];return{left:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(0,Q+1)}),right:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(Q+1)})}},t2={START:0,MIDDLE:1,END:2},cK=({paragraphElement:B,renderedParagraph:U,originalText:G,replacementText:Y})=>{let Q=U.text.indexOf(G),K=Q+G.length-1,Z=t2.START;for(let J of U.runs)for(let{text:q,index:W,start:I,end:H}of J.parts)switch(Z){case t2.START:if(Q>=I&&Q<=H){let T=Q-I,A=Math.min(K,H)-I,P=J.text.substring(T,A+1);if(P==="")continue;let j=q.replace(P,Y);L8(B.elements[J.index].elements[W],j),Z=t2.MIDDLE;continue}break;case t2.MIDDLE:if(K<=H){let T=q.substring(K-I+1);L8(B.elements[J.index].elements[W],T);let A=B.elements[J.index].elements[W];B.elements[J.index].elements[W]=Q5(A),Z=t2.END}else L8(B.elements[J.index].elements[W],"");break;default:}return B},L8=(B,U)=>{return B.elements=Z5(U),B},mK=(B)=>{if(B.element.name!=="w:p")throw Error(`Invalid node type: ${B.element.name}`);if(!B.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let U=0,G=B.element.elements.map((Y,Q)=>({element:Y,i:Q})).filter(({element:Y})=>Y.name==="w:r").map(({element:Y,i:Q})=>{let K=lK(Y,Q,U);return U+=K.text.length,K}).filter((Y)=>!!Y);return{text:G.reduce((Y,Q)=>Y+Q.text,""),runs:G,index:B.index,pathToParagraph:J5(B)}},lK=(B,U,G)=>{if(!B.elements)return{text:"",parts:[],index:-1,start:G,end:G};let Y=G,Q=B.elements.map((K,Z)=>{var J,q;return K.name==="w:t"&&K.elements&&K.elements.length>0?{text:(J=(q=K.elements[0].text)===null||q===void 0?void 0:q.toString())!==null&&J!==void 0?J:"",index:Z,start:Y,end:(()=>{var W,I;return Y+=((W=(I=K.elements[0].text)===null||I===void 0?void 0:I.toString())!==null&&W!==void 0?W:"").length-1,Y})()}:void 0}).filter((K)=>!!K).map((K)=>K);return{text:Q.reduce((K,Z)=>K+Z.text,""),parts:Q,index:U,start:G,end:Y}},J5=(B)=>B.parent?[...J5(B.parent),B.index]:[B.index],UB=(B)=>{var U,G;return(U=(G=B.element.elements)===null||G===void 0?void 0:G.map((Y,Q)=>({element:Y,index:Q,parent:B})))!==null&&U!==void 0?U:[]},K5=(B)=>{let U=[],G=[...UB({element:B,index:0,parent:void 0})],Y;while(G.length>0){if(Y=G.shift(),Y.element.name==="w:p")U=[...U,mK(Y)];G.push(...UB(Y))}return U},aK=(B,U)=>K5(B).filter((G)=>G.text.includes(U)),pK=new q6,I8="ɵ",rK=({json:B,patch:U,patchText:G,context:Y,keepOriginalStyles:Q=!0})=>{let K=aK(B,G);if(K.length===0)return{element:B,didFindOccurrence:!1};for(let Z of K){let J=U.children.map((q)=>a1((0,A0.default)(pK.format(q,Y)))).map((q)=>q.elements[0]);switch(U.type){case C8.DOCUMENT:{let q=iK(B,Z.pathToParagraph),W=nK(Z.pathToParagraph);q.elements.splice(W,1,...J);break}case C8.PARAGRAPH:default:{let q=V5(B,Z.pathToParagraph);cK({paragraphElement:q,renderedParagraph:Z,originalText:G,replacementText:I8});let W=uK(q,I8),I=q.elements[W],{left:H,right:T}=dK(I,I8),A=J,P=T;if(Q){let j=I.elements.filter((E)=>E.type==="element"&&E.name==="w:rPr");A=J.map((E)=>{var C;return L0(L0({},E),{},{elements:[...j,...(C=E.elements)!==null&&C!==void 0?C:[]]})}),P=L0(L0({},T),{},{elements:[...j,...T.elements]})}q.elements.splice(W,1,H,...A,P);break}}}return{element:B,didFindOccurrence:!0}},V5=(B,U)=>{let G=B;for(let Y=1;YV5(B,U.slice(0,U.length-1)),nK=(B)=>B[B.length-1],C8={DOCUMENT:"file",PARAGRAPH:"paragraph"},GB=new U5,sK=new Uint8Array([255,254]),oK=new Uint8Array([254,255]),YB=(B,U)=>{if(B.length!==U.length)return!1;for(let G=0;Gw.name==="w:document");if(x&&x.attributes){for(let w of["mc","wp","r","w15","m"])x.attributes[`xmlns:${w}`]=y1[w];x.attributes["mc:Ignorable"]=`${x.attributes["mc:Ignorable"]||""} w15`.trim()}}if(v.startsWith("word/")&&!v.endsWith(".xml.rels")){let x={file:W,viewWrapper:{Relationships:{addRelationship:(b,c,D,m)=>{T.push({key:v,hyperlink:{id:b,link:D}})}}},stack:[]};if(q.set(v,x),!(K===null||K===void 0?void 0:K.start.trim())||!(K===null||K===void 0?void 0:K.end.trim()))throw Error("Both start and end delimiters must be non-empty strings.");let{start:w,end:a}=K;for(let[b,c]of Object.entries(Y)){let D=`${w}${b}${a}`;while(!0){let{didFindOccurrence:m}=rK({json:$,patch:L0(L0({},c),{},{children:c.children.map((B0)=>{if(B0 instanceof t8){let i=new m2(B0.options.children,O1());return T.push({key:v,hyperlink:{id:i.linkId,link:B0.options.link}}),i}else return B0})}),patchText:D,context:x,keepOriginalStyles:Q});if(!Z||!m)break}}let U0=GB.getMediaData(JSON.stringify($),x.file.Media);if(U0.length>0)A=!0,H.push({key:v,mediaDatas:U0})}I.set(v,$)}for(let{key:v,mediaDatas:S}of H){var E;let F=`word/_rels/${v.split("/").pop()}.rels`,M=(E=I.get(F))!==null&&E!==void 0?E:ZB();I.set(F,M);let $=_K(M),x=GB.replace(JSON.stringify(I.get(v)),S,$);I.set(v,JSON.parse(x));for(let w=0;w{return(0,h1.js2xml)(B,{attributeValueFn:(U)=>String(U).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})},ZB=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),B7=function(){var B=M6(function*({data:U}){let G=U instanceof h2.default?U:yield h2.default.loadAsync(U),Y=new Set;for(let[Q,K]of Object.entries(G.files)){if(!Q.endsWith(".xml")&&!Q.endsWith(".rels"))continue;if(Q.startsWith("word/")&&!Q.endsWith(".xml.rels"))K5(a1(yield K.async("text"))).forEach((Z)=>U7(Z.text).forEach((J)=>Y.add(J)))}return Array.from(Y)});return function(G){return B.apply(this,arguments)}}(),U7=(B)=>{var U;let G=new RegExp("(?<=\\{\\{).+?(?=\\}\\})","gs");return(U=B.match(G))!==null&&U!==void 0?U:[]};if(typeof globalThis.Buffer>"u")globalThis.Buffer=J0;if(typeof globalThis.process>"u")globalThis.process=G7;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.docx=L6;})(); diff --git a/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs b/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs index c39925856ee..3368b6a2676 100644 --- a/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs +++ b/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs @@ -1,9 +1,9 @@ // sandbox bundle: pptxgenjs // generated by apps/sim/lib/execution/sandbox/bundles/build.ts // do not edit by hand. run `bun run build:sandbox-bundles` to regenerate. -(()=>{var fJ=Object.create;var{getPrototypeOf:RJ,defineProperty:X6,getOwnPropertyNames:Q9,getOwnPropertyDescriptor:IJ}=Object,q9=Object.prototype.hasOwnProperty;function K9($){return this[$]}var CJ,jJ,J9=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?CJ??=new WeakMap:jJ??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?fJ(RJ($)):{};let G=q||!$||!$.__esModule?X6(Q,"default",{value:$,enumerable:!0}):Q;for(let W of Q9($))if(!q9.call(G,W))X6(G,W,{get:K9.bind($,W),enumerable:!0});if(K)J.set($,G);return G},X0=($)=>{var q=($9??=new WeakMap).get($),Q;if(q)return q;if(q=X6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var K of Q9($))if(!q9.call(q,K))X6(q,K,{get:K9.bind($,K),enumerable:!(Q=IJ($,K))||Q.enumerable})}return $9.set($,q),q},$9,N0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var gJ=($)=>$;function AJ($,q){this[$]=gJ.bind(null,q)}var c1=($,q)=>{for(var Q in q)X6($,Q,{get:q[Q],enumerable:!0,configurable:!0,set:AJ.bind(q,Q)})};var b1=($,q)=>()=>($&&(q=$($=0)),q);var V9=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(q,Q)=>(typeof require<"u"?require:q)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var K2={};c1(K2,{transcode:()=>MV,resolveObjectURL:()=>BV,kStringMaxLength:()=>w9,kMaxLength:()=>y6,isUtf8:()=>zV,isAscii:()=>FV,default:()=>wV,constants:()=>EJ,btoa:()=>PJ,atob:()=>TJ,INSPECT_MAX_BYTES:()=>M9,File:()=>uJ,Buffer:()=>o,Blob:()=>SJ});function XJ($){var q=$.length;if(q%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=$.indexOf("=");if(Q===-1)Q=q;var K=Q===q?0:4-Q%4;return[Q,K]}function yJ($,q){return($+q)*3/4-q}function hJ($){var q,Q=XJ($),K=Q[0],J=Q[1],Z=new Uint8Array(yJ(K,J)),G=0,W=J>0?K-4:K,B;for(B=0;B>16&255,Z[G++]=q>>8&255,Z[G++]=q&255;if(J===2)q=F2[$.charCodeAt(B)]<<2|F2[$.charCodeAt(B+1)]>>4,Z[G++]=q&255;if(J===1)q=F2[$.charCodeAt(B)]<<10|F2[$.charCodeAt(B+1)]<<4|F2[$.charCodeAt(B+2)]>>2,Z[G++]=q>>8&255,Z[G++]=q&255;return Z}function xJ($){return I2[$>>18&63]+I2[$>>12&63]+I2[$>>6&63]+I2[$&63]}function OJ($,q,Q){var K,J=[];for(var Z=q;ZW?W:G+Z));if(K===1)q=$[Q-1],J.push(I2[q>>2]+I2[q<<4&63]+"==");else if(K===2)q=($[Q-2]<<8)+$[Q-1],J.push(I2[q>>10]+I2[q>>4&63]+I2[q<<2&63]+"=");return J.join("")}function Y8($,q,Q,K,J){var Z,G,W=J*8-K-1,B=(1<>1,U=-7,w=Q?J-1:0,F=Q?-1:1,M=$[q+w];w+=F,Z=M&(1<<-U)-1,M>>=-U,U+=W;for(;U>0;Z=Z*256+$[q+w],w+=F,U-=8);G=Z&(1<<-U)-1,Z>>=-U,U+=K;for(;U>0;G=G*256+$[q+w],w+=F,U-=8);if(Z===0)Z=1-V;else if(Z===B)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,K),Z=Z-V;return(M?-1:1)*G*Math.pow(2,Z-K)}function F9($,q,Q,K,J,Z){var G,W,B,V=Z*8-J-1,U=(1<>1,F=J===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:Z-1,k=K?1:-1,f=q<0||q===0&&1/q<0?1:0;if(q=Math.abs(q),isNaN(q)||q===1/0)W=isNaN(q)?1:0,G=U;else{if(G=Math.floor(Math.log(q)/Math.LN2),q*(B=Math.pow(2,-G))<1)G--,B*=2;if(G+w>=1)q+=F/B;else q+=F*Math.pow(2,1-w);if(q*B>=2)G++,B/=2;if(G+w>=U)W=0,G=U;else if(G+w>=1)W=(q*B-1)*Math.pow(2,J),G=G+w;else W=q*Math.pow(2,w-1)*Math.pow(2,J),G=0}for(;J>=8;$[Q+M]=W&255,M+=k,W/=256,J-=8);G=G<0;$[Q+M]=G&255,M+=k,G/=256,V-=8);$[Q+M-k]|=f*128}function S2($){if($>y6)throw RangeError('The value "'+$+'" is invalid for option "size"');let q=new Uint8Array($);return Object.setPrototypeOf(q,o.prototype),q}function x5($,q,Q){return class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:q.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}function o($,q,Q){if(typeof $==="number"){if(typeof q==="string")throw TypeError('The "string" argument must be of type string. Received type number');return O5($)}return N9($,q,Q)}function N9($,q,Q){if(typeof $==="string")return nJ($,q);if(ArrayBuffer.isView($))return dJ($);if($==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(C2($,ArrayBuffer)||$&&C2($.buffer,ArrayBuffer))return y5($,q,Q);if(typeof SharedArrayBuffer<"u"&&(C2($,SharedArrayBuffer)||$&&C2($.buffer,SharedArrayBuffer)))return y5($,q,Q);if(typeof $==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=$.valueOf&&$.valueOf();if(K!=null&&K!==$)return o.from(K,q,Q);let J=mJ($);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]==="function")return o.from($[Symbol.toPrimitive]("string"),q,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}function Y9($){if(typeof $!=="number")throw TypeError('"size" argument must be of type number');else if($<0)throw RangeError('The value "'+$+'" is invalid for option "size"')}function bJ($,q,Q){if(Y9($),$<=0)return S2($);if(q!==void 0)return typeof Q==="string"?S2($).fill(q,Q):S2($).fill(q);return S2($)}function O5($){return Y9($),S2($<0?0:P5($)|0)}function nJ($,q){if(typeof q!=="string"||q==="")q="utf8";if(!o.isEncoding(q))throw TypeError("Unknown encoding: "+q);let Q=k9($,q)|0,K=S2(Q),J=K.write($,q);if(J!==Q)K=K.slice(0,J);return K}function X5($){let q=$.length<0?0:P5($.length)|0,Q=S2(q);for(let K=0;K=y6)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y6.toString(16)+" bytes");return $|0}function k9($,q){if(o.isBuffer($))return $.length;if(ArrayBuffer.isView($)||C2($,ArrayBuffer))return $.byteLength;if(typeof $!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let Q=$.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&Q===0)return 0;let J=!1;for(;;)switch(q){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return h5($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return j9($).length;default:if(J)return K?-1:h5($).length;q=(""+q).toLowerCase(),J=!0}}function pJ($,q,Q){let K=!1;if(q===void 0||q<0)q=0;if(q>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,q>>>=0,Q<=q)return"";if(!$)$="utf8";while(!0)switch($){case"hex":return QV(this,q,Q);case"utf8":case"utf-8":return L9(this,q,Q);case"ascii":return eJ(this,q,Q);case"latin1":case"binary":return $V(this,q,Q);case"base64":return sJ(this,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qV(this,q,Q);default:if(K)throw TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),K=!0}}function w1($,q,Q){let K=$[q];$[q]=$[Q],$[Q]=K}function D9($,q,Q,K,J){if($.length===0)return-1;if(typeof Q==="string")K=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,Number.isNaN(Q))Q=J?0:$.length-1;if(Q<0)Q=$.length+Q;if(Q>=$.length)if(J)return-1;else Q=$.length-1;else if(Q<0)if(J)Q=0;else return-1;if(typeof q==="string")q=o.from(q,K);if(o.isBuffer(q)){if(q.length===0)return-1;return W9($,q,Q,K,J)}else if(typeof q==="number"){if(q=q&255,typeof Uint8Array.prototype.indexOf==="function")if(J)return Uint8Array.prototype.indexOf.call($,q,Q);else return Uint8Array.prototype.lastIndexOf.call($,q,Q);return W9($,[q],Q,K,J)}throw TypeError("val must be string, number or Buffer")}function W9($,q,Q,K,J){let Z=1,G=$.length,W=q.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if($.length<2||q.length<2)return-1;Z=2,G/=2,W/=2,Q/=2}}function B(U,w){if(Z===1)return U[w];else return U.readUInt16BE(w*Z)}let V;if(J){let U=-1;for(V=Q;VG)Q=G-W;for(V=Q;V>=0;V--){let U=!0;for(let w=0;wJ)K=J;let Z=q.length;if(K>Z/2)K=Z/2;let G;for(G=0;G239?4:Z>223?3:Z>191?2:1;if(J+W<=Q){let B,V,U,w;switch(W){case 1:if(Z<128)G=Z;break;case 2:if(B=$[J+1],(B&192)===128){if(w=(Z&31)<<6|B&63,w>127)G=w}break;case 3:if(B=$[J+1],V=$[J+2],(B&192)===128&&(V&192)===128){if(w=(Z&15)<<12|(B&63)<<6|V&63,w>2047&&(w<55296||w>57343))G=w}break;case 4:if(B=$[J+1],V=$[J+2],U=$[J+3],(B&192)===128&&(V&192)===128&&(U&192)===128){if(w=(Z&15)<<18|(B&63)<<12|(V&63)<<6|U&63,w>65535&&w<1114112)G=w}}}if(G===null)G=65533,W=1;else if(G>65535)G-=65536,K.push(G>>>10&1023|55296),G=56320|G&1023;K.push(G),J+=W}return tJ(K)}function tJ($){let q=$.length;if(q<=B9)return String.fromCharCode.apply(String,$);let Q="",K=0;while(KK)Q=K;let J="";for(let Z=q;ZQ)throw RangeError("Trying to access beyond buffer length")}function s0($,q,Q,K,J,Z){if(!o.isBuffer($))throw TypeError('"buffer" argument must be a Buffer instance');if(q>J||q$.length)throw RangeError("Index out of range")}function H9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,Q}function v9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q+7]=Z,Z=Z>>8,$[Q+6]=Z,Z=Z>>8,$[Q+5]=Z,Z=Z>>8,$[Q+4]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q+3]=G,G=G>>8,$[Q+2]=G,G=G>>8,$[Q+1]=G,G=G>>8,$[Q]=G,Q+8}function f9($,q,Q,K,J,Z){if(Q+K>$.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function R9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return F9($,q,Q,K,23,4),Q+4}function I9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return F9($,q,Q,K,52,8),Q+8}function z9($){let q="",Q=$.length,K=$[0]==="-"?1:0;for(;Q>=K+4;Q-=3)q=`_${$.slice(Q-3,Q)}${q}`;return`${$.slice(0,Q)}${q}`}function KV($,q,Q){if(n1(q,"offset"),$[q]===void 0||$[q+Q]===void 0)h6(q,$.length-(Q+1))}function C9($,q,Q,K,J,Z){if($>Q||$3)if(q===0||q===BigInt(0))W=`>= 0${G} and < 2${G} ** ${(Z+1)*8}${G}`;else W=`>= -(2${G} ** ${(Z+1)*8-1}${G}) and < 2 ** ${(Z+1)*8-1}${G}`;else W=`>= ${q}${G} and <= ${Q}${G}`;throw new A5("value",W,$)}KV(K,J,Z)}function n1($,q){if(typeof $!=="number")throw new cJ(q,"number",$)}function h6($,q,Q){if(Math.floor($)!==$)throw n1($,Q),new A5(Q||"offset","an integer",$);if(q<0)throw new _J;throw new A5(Q||"offset",`>= ${Q?1:0} and <= ${q}`,$)}function VV($){if($=$.split("=")[0],$=$.trim().replace(JV,""),$.length<2)return"";while($.length%4!==0)$=$+"=";return $}function h5($,q){q=q||1/0;let Q,K=$.length,J=null,Z=[];for(let G=0;G55295&&Q<57344){if(!J){if(Q>56319){if((q-=3)>-1)Z.push(239,191,189);continue}else if(G+1===K){if((q-=3)>-1)Z.push(239,191,189);continue}J=Q;continue}if(Q<56320){if((q-=3)>-1)Z.push(239,191,189);J=Q;continue}Q=(J-55296<<10|Q-56320)+65536}else if(J){if((q-=3)>-1)Z.push(239,191,189)}if(J=null,Q<128){if((q-=1)<0)break;Z.push(Q)}else if(Q<2048){if((q-=2)<0)break;Z.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((q-=3)<0)break;Z.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((q-=4)<0)break;Z.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return Z}function UV($){let q=[];for(let Q=0;Q<$.length;++Q)q.push($.charCodeAt(Q)&255);return q}function ZV($,q){let Q,K,J,Z=[];for(let G=0;G<$.length;++G){if((q-=2)<0)break;Q=$.charCodeAt(G),K=Q>>8,J=Q%256,Z.push(J),Z.push(K)}return Z}function j9($){return hJ(VV($))}function k8($,q,Q,K){let J;for(J=0;J=q.length||J>=$.length)break;q[J+Q]=$[J]}return J}function C2($,q){return $ instanceof q||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===q.name}function l2($){return typeof BigInt>"u"?WV:$}function WV(){throw Error("BigInt not supported")}function T5($){return()=>{throw Error($+" is not implemented for node:buffer browser polyfill")}}var I2,F2,g5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M1,U9,G9,M9=50,y6=2147483647,w9=536870888,PJ,TJ,uJ,SJ,EJ,_J,cJ,A5,B9=4096,JV,GV,BV,zV,FV=($)=>{for(let q of $)if(q.charCodeAt(0)>127)return!1;return!0},MV,wV;var t0=b1(()=>{I2=[],F2=[];for(M1=0,U9=g5.length;M14294967296)J=z9(String(Q));else if(typeof Q==="bigint"){if(J=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))J=z9(J);J+="n"}return K+=` It must be ${q}. Received ${J}`,K},RangeError);Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.buffer}});Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.byteOffset}});o.poolSize=8192;o.from=function($,q,Q){return N9($,q,Q)};Object.setPrototypeOf(o.prototype,Uint8Array.prototype);Object.setPrototypeOf(o,Uint8Array);o.alloc=function($,q,Q){return bJ($,q,Q)};o.allocUnsafe=function($){return O5($)};o.allocUnsafeSlow=function($){return O5($)};o.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==o.prototype};o.compare=function($,q){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(C2(q,Uint8Array))q=o.from(q,q.offset,q.byteLength);if(!o.isBuffer($)||!o.isBuffer(q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===q)return 0;let Q=$.length,K=q.length;for(let J=0,Z=Math.min(Q,K);JK.length){if(!o.isBuffer(Z))Z=o.from(Z);Z.copy(K,J)}else Uint8Array.prototype.set.call(K,Z,J);else if(!o.isBuffer(Z))throw TypeError('"list" argument must be an Array of Buffers');else Z.copy(K,J);J+=Z.length}return K};o.byteLength=k9;o.prototype._isBuffer=!0;o.prototype.swap16=function(){let $=this.length;if($%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let q=0;q<$;q+=2)w1(this,q,q+1);return this};o.prototype.swap32=function(){let $=this.length;if($%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let q=0;q<$;q+=4)w1(this,q,q+3),w1(this,q+1,q+2);return this};o.prototype.swap64=function(){let $=this.length;if($%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let q=0;q<$;q+=8)w1(this,q,q+7),w1(this,q+1,q+6),w1(this,q+2,q+5),w1(this,q+3,q+4);return this};o.prototype.toString=function(){let $=this.length;if($===0)return"";if(arguments.length===0)return L9(this,0,$);return pJ.apply(this,arguments)};o.prototype.toLocaleString=o.prototype.toString;o.prototype.equals=function($){if(!o.isBuffer($))throw TypeError("Argument must be a Buffer");if(this===$)return!0;return o.compare(this,$)===0};o.prototype.inspect=function(){let $="",q=M9;if($=this.toString("hex",0,q).replace(/(.{2})/g,"$1 ").trim(),this.length>q)$+=" ... ";return""};if(G9)o.prototype[G9]=o.prototype.inspect;o.prototype.compare=function($,q,Q,K,J){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(!o.isBuffer($))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(q===void 0)q=0;if(Q===void 0)Q=$?$.length:0;if(K===void 0)K=0;if(J===void 0)J=this.length;if(q<0||Q>$.length||K<0||J>this.length)throw RangeError("out of range index");if(K>=J&&q>=Q)return 0;if(K>=J)return-1;if(q>=Q)return 1;if(q>>>=0,Q>>>=0,K>>>=0,J>>>=0,this===$)return 0;let Z=J-K,G=Q-q,W=Math.min(Z,G),B=this.slice(K,J),V=$.slice(q,Q);for(let U=0;U>>0,isFinite(Q)){if(Q=Q>>>0,K===void 0)K="utf8"}else K=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let J=this.length-q;if(Q===void 0||Q>J)Q=J;if($.length>0&&(Q<0||q<0)||q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let Z=!1;for(;;)switch(K){case"hex":return iJ(this,$,q,Q);case"utf8":case"utf-8":return oJ(this,$,q,Q);case"ascii":case"latin1":case"binary":return aJ(this,$,q,Q);case"base64":return lJ(this,$,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rJ(this,$,q,Q);default:if(Z)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),Z=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};o.prototype.slice=function($,q){let Q=this.length;if($=~~$,q=q===void 0?Q:~~q,$<0){if($+=Q,$<0)$=0}else if($>Q)$=Q;if(q<0){if(q+=Q,q<0)q=0}else if(q>Q)q=Q;if(q<$)q=$;let K=this.subarray($,q);return Object.setPrototypeOf(K,o.prototype),K};o.prototype.readUintLE=o.prototype.readUIntLE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$+--q],J=1;while(q>0&&(J*=256))K+=this[$+--q]*J;return K};o.prototype.readUint8=o.prototype.readUInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);return this[$]};o.prototype.readUint16LE=o.prototype.readUInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]|this[$+1]<<8};o.prototype.readUint16BE=o.prototype.readUInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]<<8|this[$+1]};o.prototype.readUint32LE=o.prototype.readUInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216};o.prototype.readUint32BE=o.prototype.readUInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])};o.prototype.readBigUInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q+this[++$]*256+this[++$]*65536+this[++$]*16777216,J=this[++$]+this[++$]*256+this[++$]*65536+Q*16777216;return BigInt(K)+(BigInt(J)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q*16777216+this[++$]*65536+this[++$]*256+this[++$],J=this[++$]*16777216+this[++$]*65536+this[++$]*256+Q;return(BigInt(K)<>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z=J)K-=Math.pow(2,8*q);return K};o.prototype.readIntBE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=q,J=1,Z=this[$+--K];while(K>0&&(J*=256))Z+=this[$+--K]*J;if(J*=128,Z>=J)Z-=Math.pow(2,8*q);return Z};o.prototype.readInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);if(!(this[$]&128))return this[$];return(255-this[$]+1)*-1};o.prototype.readInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$]|this[$+1]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$+1]|this[$]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24};o.prototype.readInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]};o.prototype.readBigInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=this[$+4]+this[$+5]*256+this[$+6]*65536+(Q<<24);return(BigInt(K)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=(q<<24)+this[++$]*65536+this[++$]*256+this[++$];return(BigInt(K)<>>0,!q)b0($,4,this.length);return Y8(this,$,!0,23,4)};o.prototype.readFloatBE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return Y8(this,$,!1,23,4)};o.prototype.readDoubleLE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!0,52,8)};o.prototype.readDoubleBE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!1,52,8)};o.prototype.writeUintLE=o.prototype.writeUIntLE=function($,q,Q,K){if($=+$,q=q>>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=1,Z=0;this[q]=$&255;while(++Z>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=Q-1,Z=1;this[q+J]=$&255;while(--J>=0&&(Z*=256))this[q+J]=$/Z&255;return q+Q};o.prototype.writeUint8=o.prototype.writeUInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,255,0);return this[q]=$&255,q+1};o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q+3]=$>>>24,this[q+2]=$>>>16,this[q+1]=$>>>8,this[q]=$&255,q+4};o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigUInt64LE=l2(function($,q=0){return H9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeBigUInt64BE=l2(function($,q=0){return v9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeIntLE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=0,Z=1,G=0;this[q]=$&255;while(++J>0)-G&255}return q+Q};o.prototype.writeIntBE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=Q-1,Z=1,G=0;this[q+J]=$&255;while(--J>=0&&(Z*=256)){if($<0&&G===0&&this[q+J+1]!==0)G=1;this[q+J]=($/Z>>0)-G&255}return q+Q};o.prototype.writeInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,127,-128);if($<0)$=255+$+1;return this[q]=$&255,q+1};o.prototype.writeInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);return this[q]=$&255,this[q+1]=$>>>8,this[q+2]=$>>>16,this[q+3]=$>>>24,q+4};o.prototype.writeInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);if($<0)$=4294967295+$+1;return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigInt64LE=l2(function($,q=0){return H9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeBigInt64BE=l2(function($,q=0){return v9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeFloatLE=function($,q,Q){return R9(this,$,q,!0,Q)};o.prototype.writeFloatBE=function($,q,Q){return R9(this,$,q,!1,Q)};o.prototype.writeDoubleLE=function($,q,Q){return I9(this,$,q,!0,Q)};o.prototype.writeDoubleBE=function($,q,Q){return I9(this,$,q,!1,Q)};o.prototype.copy=function($,q,Q,K){if(!o.isBuffer($))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!K&&K!==0)K=this.length;if(q>=$.length)q=$.length;if(!q)q=0;if(K>0&&K=this.length)throw RangeError("Index out of range");if(K<0)throw RangeError("sourceEnd out of bounds");if(K>this.length)K=this.length;if($.length-q>>0,Q=Q===void 0?this.length:Q>>>0,!$)$=0;let J;if(typeof $==="number")for(J=q;J{var S0=y9.exports={},j2,g2;function u5(){throw Error("setTimeout has not been defined")}function S5(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")j2=setTimeout;else j2=u5}catch($){j2=u5}try{if(typeof clearTimeout==="function")g2=clearTimeout;else g2=S5}catch($){g2=S5}})();function g9($){if(j2===setTimeout)return setTimeout($,0);if((j2===u5||!j2)&&setTimeout)return j2=setTimeout,setTimeout($,0);try{return j2($,0)}catch(q){try{return j2.call(null,$,0)}catch(Q){return j2.call(this,$,0)}}}function NV($){if(g2===clearTimeout)return clearTimeout($);if((g2===S5||!g2)&&clearTimeout)return g2=clearTimeout,clearTimeout($);try{return g2($)}catch(q){try{return g2.call(null,$)}catch(Q){return g2.call(this,$)}}}var E2=[],d1=!1,N1,D8=-1;function YV(){if(!d1||!N1)return;if(d1=!1,N1.length)E2=N1.concat(E2);else D8=-1;if(E2.length)A9()}function A9(){if(d1)return;var $=g9(YV);d1=!0;var q=E2.length;while(q){N1=E2,E2=[];while(++D81)for(var Q=1;Qn9,once:()=>c9,listenerCount:()=>d9,init:()=>r2,getMaxListeners:()=>p9,getEventListeners:()=>b9,default:()=>CV,captureRejectionSymbol:()=>u9,addAbortListener:()=>i9,EventEmitter:()=>r2});function S9($,q){var{_events:Q}=$;if(q[0]??=Error("Unhandled error."),!Q)throw q[0];var K=Q[T9];if(K)for(var J of O9.call(K))J.apply($,q);var Z=Q.error;if(!Z)throw q[0];for(var J of O9.call(Z))J.apply($,q);return!0}function LV($,q,Q,K){q.then(void 0,function(J){queueMicrotask(()=>HV($,J,Q,K))})}function HV($,q,Q,K){if(typeof $[x9]==="function")$[x9](q,Q,...K);else try{$[Y1]=!1,$.emit("error",q)}finally{$[Y1]=!0}}function E9($,q,Q){Q.warned=!0;let K=Error(`Possible EventEmitter memory leak detected. ${Q.length} ${String(q)} listeners added to [${$.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=$,K.type=q,K.count=Q.length,console.warn(K)}function _9($,q,...Q){this.removeListener($,q),q.apply(this,Q)}function c9($,q,Q){var K=Q?.signal;if(m9(K,"options.signal"),K?.aborted)throw new E5(void 0,{cause:K?.reason});let{resolve:J,reject:Z,promise:G}=$newPromiseCapability(Promise),W=(U)=>{if($.removeListener(q,B),K!=null)L8(K,"abort",V);Z(U)},B=(...U)=>{if(typeof $.removeListener==="function")$.removeListener("error",W);if(K!=null)L8(K,"abort",V);J(U)};if(P9($,q,B,{once:!0}),q!=="error"&&typeof $.once==="function")$.once("error",W);function V(){L8($,q,B),L8($,"error",W),Z(new E5(void 0,{cause:K?.reason}))}if(K!=null)P9(K,"abort",V,{once:!0});return G}function b9($,q){return $.listeners(q)}function n9($,...q){c5($,"setMaxListeners",0);var Q;if(q&&(Q=q.length))for(let K=0;KK||(Q!=null||K!=null)&&Number.isNaN($))throw RV(q,`${Q!=null?`>= ${Q}`:""}${Q!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,$)}function x6($){if(typeof $!=="function")throw TypeError("The listener must be a function")}function IV($,q){if(typeof $!=="boolean")throw m1(q,"boolean",$)}function p9($){return $?._maxListeners??k1}function i9($,q){if($===void 0)throw m1("signal","AbortSignal",$);if(m9($,"signal"),typeof q!=="function")throw m1("listener","function",q);let Q;if($.aborted)queueMicrotask(()=>q());else $.addEventListener("abort",q,{__proto__:null,once:!0}),Q=()=>{$.removeEventListener("abort",q)};return{__proto__:null,[Symbol.dispose](){Q?.()}}}var _5,Y1,T9,kV,DV,x9,u9,O9,k1=10,r2=function($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[Y1]=$?.captureRejections?Boolean($?.captureRejections):y0[Y1])this.emit=fV},y0,vV=function($,...q){if($==="error")return S9(this,q);var{_events:Q}=this;if(Q===void 0)return!1;var K=Q[$];if(K===void 0)return!1;let J=K.length>1?K.slice():K;for(let Z=0,{length:G}=J;Z1?K.slice():K;for(let Z=0,{length:G}=J;Z{_5=Symbol.for,Y1=Symbol("kCapture"),T9=_5("events.errorMonitor"),kV=Symbol("events.maxEventTargetListeners"),DV=Symbol("events.maxEventTargetListenersWarned"),x9=_5("nodejs.rejection"),u9=_5("nodejs.rejection"),O9=Array.prototype.slice,y0=r2.prototype={};y0._events=void 0;y0._eventsCount=0;y0._maxListeners=void 0;y0.setMaxListeners=function($){return c5($,"setMaxListeners",0),this._maxListeners=$,this};y0.constructor=r2;y0.getMaxListeners=function(){return this?._maxListeners??k1};y0.emit=vV;y0.addListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.push(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.on=y0.addListener;y0.prependListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.unshift(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.once=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.addListener($,Q),this};y0.prependOnceListener=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.prependListener($,Q),this};y0.removeListener=function($,q){x6(q);var{_events:Q}=this;if(!Q)return this;var K=Q[$];if(!K)return this;var J=K.length;let Z=-1;for(let G=J-1;G>=0;G--)if(K[G]===q||K[G].listener===q){Z=G;break}if(Z<0)return this;if(Z===0)K.shift();else K.splice(Z,1);if(K.length===0)delete Q[$],this._eventsCount--;return this};y0.off=y0.removeListener;y0.removeAllListeners=function($){var{_events:q}=this;if($&&q){if(q[$])delete q[$],this._eventsCount--}else this._events={__proto__:null};return this};y0.listeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.map((K)=>K.listener??K)};y0.rawListeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.slice()};y0.listenerCount=function($){var{_events:q}=this;if(!q)return 0;return q[$]?.length??0};y0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};y0[Y1]=!1;E5=class E5 extends Error{constructor($="The operation was aborted",q=void 0){if(q!==void 0&&typeof q!=="object")throw m1("options","Object",q);super($,q);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(r2,{captureRejections:{get(){return y0[Y1]},set($){IV($,"EventEmitter.captureRejections"),y0[Y1]=$},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return k1},set:($)=>{c5($,"defaultMaxListeners",0),k1=$}},kMaxEventTargetListeners:{value:kV,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:DV,enumerable:!1,configurable:!1,writable:!1}});Object.assign(r2,{once:c9,getEventListeners:b9,getMaxListeners:p9,setMaxListeners:n9,EventEmitter:r2,usingDomains:!1,captureRejectionSymbol:u9,errorMonitor:T9,addAbortListener:i9,init:r2,listenerCount:d9});CV=r2});var a1=N0((Yz,$$)=>{var g0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),P0=g0(($,q)=>{class Q extends Error{constructor(K){if(!Array.isArray(K))throw TypeError(`Expected input to be an Array, got ${typeof K}`);let J="";for(let Z=0;Z{q.exports={format(Q,...K){return Q.replace(/%([sdifj])/g,function(...[J,Z]){let G=K.shift();if(Z==="f")return G.toFixed(6);else if(Z==="j")return JSON.stringify(G);else if(Z==="s"&&typeof G==="object")return`${G.constructor!==Object?G.constructor.name:""} {}`.trim();else return G.toString()})},inspect(Q){switch(typeof Q){case"string":if(Q.includes("'")){if(!Q.includes('"'))return`"${Q}"`;else if(!Q.includes("`")&&!Q.includes("${"))return`\`${Q}\``}return`'${Q}'`;case"number":if(isNaN(Q))return"NaN";else if(Object.is(Q,-0))return String(Q);return Q;case"bigint":return`${String(Q)}n`;case"boolean":case"undefined":return String(Q);case"object":return"{}"}}}}),a0=g0(($,q)=>{var{format:Q,inspect:K}=o9(),{AggregateError:J}=P0(),Z=globalThis.AggregateError||J,G=Symbol("kIsNodeError"),W=["string","function","number","object","Function","Object","boolean","bigint","symbol"],B=/^([A-Z][a-z0-9]*)+$/,V={};function U(D,z){if(!D)throw new V.ERR_INTERNAL_ASSERTION(z)}function w(D){let z="",N=D.length,H=D[0]==="-"?1:0;for(;N>=H+4;N-=3)z=`_${D.slice(N-3,N)}${z}`;return`${D.slice(0,N)}${z}`}function F(D,z,N){if(typeof z==="function")return U(z.length<=N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${z.length}).`),z(...N);let H=(z.match(/%[dfijoOs]/g)||[]).length;if(U(H===N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${H}).`),N.length===0)return z;return Q(z,...N)}function M(D,z,N){if(!N)N=Error;class H extends N{constructor(...v){super(F(D,z,v))}toString(){return`${this.name} [${D}]: ${this.message}`}}Object.defineProperties(H.prototype,{name:{value:N.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${D}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),H.prototype.code=D,H.prototype[G]=!0,V[D]=H}function k(D){let z="__node_internal_"+D.name;return Object.defineProperty(D,"name",{value:z}),D}function f(D,z){if(D&&z&&D!==z){if(Array.isArray(z.errors))return z.errors.push(D),z;let N=new Z([z,D],z.message);return N.code=z.code,N}return D||z}class L extends Error{constructor(D="The operation was aborted",z=void 0){if(z!==void 0&&typeof z!=="object")throw new V.ERR_INVALID_ARG_TYPE("options","Object",z);super(D,z);this.code="ABORT_ERR",this.name="AbortError"}}M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(D,z,N)=>{if(U(typeof D==="string","'name' must be a string"),!Array.isArray(z))z=[z];let H="The ";if(D.endsWith(" argument"))H+=`${D} `;else H+=`"${D}" ${D.includes(".")?"property":"argument"} `;H+="must be ";let v=[],j=[],n=[];for(let _ of z)if(U(typeof _==="string","All expected entries have to be of type string"),W.includes(_))v.push(_.toLowerCase());else if(B.test(_))j.push(_);else U(_!=="object",'The value "object" should be written as "Object"'),n.push(_);if(j.length>0){let _=v.indexOf("object");if(_!==-1)v.splice(v,_,1),j.push("Object")}if(v.length>0){switch(v.length){case 1:H+=`of type ${v[0]}`;break;case 2:H+=`one of type ${v[0]} or ${v[1]}`;break;default:{let _=v.pop();H+=`one of type ${v.join(", ")}, or ${_}`}}if(j.length>0||n.length>0)H+=" or "}if(j.length>0){switch(j.length){case 1:H+=`an instance of ${j[0]}`;break;case 2:H+=`an instance of ${j[0]} or ${j[1]}`;break;default:{let _=j.pop();H+=`an instance of ${j.join(", ")}, or ${_}`}}if(n.length>0)H+=" or "}switch(n.length){case 0:break;case 1:if(n[0].toLowerCase()!==n[0])H+="an ";H+=`${n[0]}`;break;case 2:H+=`one of ${n[0]} or ${n[1]}`;break;default:{let _=n.pop();H+=`one of ${n.join(", ")}, or ${_}`}}if(N==null)H+=`. Received ${N}`;else if(typeof N==="function"&&N.name)H+=`. Received function ${N.name}`;else if(typeof N==="object"){var d;if((d=N.constructor)!==null&&d!==void 0&&d.name)H+=`. Received an instance of ${N.constructor.name}`;else{let _=K(N,{depth:-1});H+=`. Received ${_}`}}else{let _=K(N,{colors:!1});if(_.length>25)_=`${_.slice(0,25)}...`;H+=`. Received type ${typeof N} (${_})`}return H},TypeError),M("ERR_INVALID_ARG_VALUE",(D,z,N="is invalid")=>{let H=K(z);if(H.length>128)H=H.slice(0,128)+"...";return`The ${D.includes(".")?"property":"argument"} '${D}' ${N}. Received ${H}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(D,z,N)=>{var H;let v=N!==null&&N!==void 0&&(H=N.constructor)!==null&&H!==void 0&&H.name?`instance of ${N.constructor.name}`:`type ${typeof N}`;return`Expected ${D} to be returned from the "${z}" function but got ${v}.`},TypeError),M("ERR_MISSING_ARGS",(...D)=>{U(D.length>0,"At least one arg needs to be specified");let z,N=D.length;switch(D=(Array.isArray(D)?D:[D]).map((H)=>`"${H}"`).join(" or "),N){case 1:z+=`The ${D[0]} argument`;break;case 2:z+=`The ${D[0]} and ${D[1]} arguments`;break;default:{let H=D.pop();z+=`The ${D.join(", ")}, and ${H} arguments`}break}return`${z} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(D,z,N)=>{U(z,'Missing "range" argument');let H;if(Number.isInteger(N)&&Math.abs(N)>4294967296)H=w(String(N));else if(typeof N==="bigint"){H=String(N);let v=BigInt(2)**BigInt(32);if(N>v||N<-v)H=w(H);H+="n"}else H=K(N);return`The value of "${D}" is out of range. It must be ${z}. Received ${H}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),q.exports={AbortError:L,aggregateTwoErrors:k(f),hideStackFrames:k,codes:V}}),jV=g0(($,q)=>{Object.defineProperty($,"__esModule",{value:!0});var Q=new WeakMap,K=new WeakMap;function J(X){let P=Q.get(X);return console.assert(P!=null,"'this' is expected an Event object, but got",X),P}function Z(X){if(X.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",X.passiveListener);return}if(!X.event.cancelable)return;if(X.canceled=!0,typeof X.event.preventDefault==="function")X.event.preventDefault()}function G(X,P){Q.set(this,{eventTarget:X,event:P,eventPhase:2,currentTarget:X,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:P.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let g=Object.keys(P);for(let c=0;c0){let X=Array(arguments.length);for(let P=0;P{Object.defineProperty($,"__esModule",{value:!0});var Q=jV();class K extends Q.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let U=G.get(this);if(typeof U!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return U}}Q.defineEventAttribute(K.prototype,"abort");function J(){let U=Object.create(K.prototype);return Q.EventTarget.call(U),G.set(U,!1),U}function Z(U){if(G.get(U)!==!1)return;G.set(U,!0),U.dispatchEvent({type:"abort"})}var G=new WeakMap;if(Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class W{constructor(){B.set(this,J())}get signal(){return V(this)}abort(){Z(V(this))}}var B=new WeakMap;function V(U){let w=B.get(U);if(w==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${U===null?"null":typeof U}`);return w}if(Object.defineProperties(W.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(W.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});$.AbortController=W,$.AbortSignal=K,$.default=W,q.exports=W,q.exports.AbortController=q.exports.default=W,q.exports.AbortSignal=K}),e0=g0(($,q)=>{var Q=(t0(),X0(K2)),{format:K,inspect:J}=o9(),{codes:{ERR_INVALID_ARG_TYPE:Z}}=a0(),{kResistStopPropagation:G,AggregateError:W,SymbolDispose:B}=P0(),V=globalThis.AbortSignal||O6().AbortSignal,U=globalThis.AbortController||O6().AbortController,w=Object.getPrototypeOf(async function(){}).constructor,F=globalThis.Blob||Q.Blob,M=typeof F<"u"?function(L){return L instanceof F}:function(L){return!1},k=(L,D)=>{if(L!==void 0&&(L===null||typeof L!=="object"||!("aborted"in L)))throw new Z(D,"AbortSignal",L)},f=(L,D)=>{if(typeof L!=="function")throw new Z(D,"Function",L)};q.exports={AggregateError:W,kEmptyObject:Object.freeze({}),once(L){let D=!1;return function(...z){if(D)return;D=!0,L.apply(this,z)}},createDeferredPromise:function(){let L,D;return{promise:new Promise((z,N)=>{L=z,D=N}),resolve:L,reject:D}},promisify(L){return new Promise((D,z)=>{L((N,...H)=>{if(N)return z(N);return D(...H)})})},debuglog(){return function(){}},format:K,inspect:J,types:{isAsyncFunction(L){return L instanceof w},isArrayBufferView(L){return ArrayBuffer.isView(L)}},isBlob:M,deprecate(L,D){return L},addAbortListener:(i1(),X0(p1)).addAbortListener||function(L,D){if(L===void 0)throw new Z("signal","AbortSignal",L);k(L,"signal"),f(D,"listener");let z;if(L.aborted)queueMicrotask(()=>D());else L.addEventListener("abort",D,{__proto__:null,once:!0,[G]:!0}),z=()=>{L.removeEventListener("abort",D)};return{__proto__:null,[B](){var N;(N=z)===null||N===void 0||N()}}},AbortSignalAny:V.any||function(L){if(L.length===1)return L[0];let D=new U,z=()=>D.abort();return L.forEach((N)=>{k(N,"signals"),N.addEventListener("abort",z,{once:!0})}),D.signal.addEventListener("abort",()=>{L.forEach((N)=>N.removeEventListener("abort",z))},{once:!0}),D.signal}},q.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),P6=g0(($,q)=>{var{ArrayIsArray:Q,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:J,ArrayPrototypeMap:Z,NumberIsInteger:G,NumberIsNaN:W,NumberMAX_SAFE_INTEGER:B,NumberMIN_SAFE_INTEGER:V,NumberParseInt:U,ObjectPrototypeHasOwnProperty:w,RegExpPrototypeExec:F,String:M,StringPrototypeToUpperCase:k,StringPrototypeTrim:f}=P0(),{hideStackFrames:L,codes:{ERR_SOCKET_BAD_PORT:D,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:N,ERR_OUT_OF_RANGE:H,ERR_UNKNOWN_SIGNAL:v}}=a0(),{normalizeEncoding:j}=e0(),{isAsyncFunction:n,isArrayBufferView:d}=e0().types,_={};function X(T){return T===(T|0)}function P(T){return T===T>>>0}var g=/^[0-7]+$/,c="must be a 32-bit unsigned integer or an octal string";function h(T,t,G0){if(typeof T>"u")T=G0;if(typeof T==="string"){if(F(g,T)===null)throw new N(t,T,c);T=U(T,8)}return $0(T,t),T}var x=L((T,t,G0=V,Q0=B)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),l=L((T,t,G0=-2147483648,Q0=2147483647)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),$0=L((T,t,G0=!1)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);let Q0=G0?1:0,M0=4294967295;if(TM0)throw new H(t,`>= ${Q0} && <= ${M0}`,T)});function Z0(T,t){if(typeof T!=="string")throw new z(t,"string",T)}function F0(T,t,G0=void 0,Q0){if(typeof T!=="number")throw new z(t,"number",T);if(G0!=null&&TQ0||(G0!=null||Q0!=null)&&W(T))throw new H(t,`${G0!=null?`>= ${G0}`:""}${G0!=null&&Q0!=null?" && ":""}${Q0!=null?`<= ${Q0}`:""}`,T)}var p=L((T,t,G0)=>{if(!K(G0,T)){let Q0="must be one of: "+J(Z(G0,(M0)=>typeof M0==="string"?`'${M0}'`:M(M0)),", ");throw new N(t,T,Q0)}});function W0(T,t){if(typeof T!=="boolean")throw new z(t,"boolean",T)}function y(T,t,G0){return T==null||!w(T,t)?G0:T[t]}var i=L((T,t,G0=null)=>{let Q0=y(G0,"allowArray",!1),M0=y(G0,"allowFunction",!1);if(!y(G0,"nullable",!1)&&T===null||!Q0&&Q(T)||typeof T!=="object"&&(!M0||typeof T!=="function"))throw new z(t,"Object",T)}),U0=L((T,t)=>{if(T!=null&&typeof T!=="object"&&typeof T!=="function")throw new z(t,"a dictionary",T)}),m=L((T,t,G0=0)=>{if(!Q(T))throw new z(t,"Array",T);if(T.length{if(!d(T))throw new z(t,["Buffer","TypedArray","DataView"],T)});function E(T,t){let G0=j(t),Q0=T.length;if(G0==="hex"&&Q0%2!==0)throw new N("encoding",t,`is invalid for data of length ${Q0}`)}function a(T,t="Port",G0=!0){if(typeof T!=="number"&&typeof T!=="string"||typeof T==="string"&&f(T).length===0||+T!==+T>>>0||T>65535||T===0&&!G0)throw new D(t,T,G0);return T|0}var K0=L((T,t)=>{if(T!==void 0&&(T===null||typeof T!=="object"||!("aborted"in T)))throw new z(t,"AbortSignal",T)}),R=L((T,t)=>{if(typeof T!=="function")throw new z(t,"Function",T)}),Y=L((T,t)=>{if(typeof T!=="function"||n(T))throw new z(t,"Function",T)}),C=L((T,t)=>{if(T!==void 0)throw new z(t,"undefined",T)});function u(T,t,G0){if(!K(G0,T))throw new z(t,`('${J(G0,"|")}')`,T)}var e=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function r(T,t){if(typeof T>"u"||!F(e,T))throw new N(t,T,'must be an array or string of format "; rel=preload; as=style"')}function s(T){if(typeof T==="string")return r(T,"hints"),T;else if(Q(T)){let t=T.length,G0="";if(t===0)return G0;for(let Q0=0;Q0; rel=preload; as=style"')}q.exports={isInt32:X,isUint32:P,parseFileMode:h,validateArray:m,validateStringArray:V0,validateBooleanArray:w0,validateAbortSignalArray:S,validateBoolean:W0,validateBuffer:O,validateDictionary:U0,validateEncoding:E,validateFunction:R,validateInt32:l,validateInteger:x,validateNumber:F0,validateObject:i,validateOneOf:p,validatePlainFunction:Y,validatePort:a,validateSignalName:b,validateString:Z0,validateUint32:$0,validateUndefined:C,validateUnion:u,validateAbortSignal:K0,validateLinkHeaderValue:s}}),D1=g0(($,q)=>{q.exports=globalThis.process}),b2=g0(($,q)=>{var{SymbolAsyncIterator:Q,SymbolIterator:K,SymbolFor:J}=P0(),Z=J("nodejs.stream.destroyed"),G=J("nodejs.stream.errored"),W=J("nodejs.stream.readable"),B=J("nodejs.stream.writable"),V=J("nodejs.stream.disturbed"),U=J("nodejs.webstream.isClosedPromise"),w=J("nodejs.webstream.controllerErrorFunction");function F(y,i=!1){var U0;return!!(y&&typeof y.pipe==="function"&&typeof y.on==="function"&&(!i||typeof y.pause==="function"&&typeof y.resume==="function")&&(!y._writableState||((U0=y._readableState)===null||U0===void 0?void 0:U0.readable)!==!1)&&(!y._writableState||y._readableState))}function M(y){var i;return!!(y&&typeof y.write==="function"&&typeof y.on==="function"&&(!y._readableState||((i=y._writableState)===null||i===void 0?void 0:i.writable)!==!1))}function k(y){return!!(y&&typeof y.pipe==="function"&&y._readableState&&typeof y.on==="function"&&typeof y.write==="function")}function f(y){return y&&(y._readableState||y._writableState||typeof y.write==="function"&&typeof y.on==="function"||typeof y.pipe==="function"&&typeof y.on==="function")}function L(y){return!!(y&&!f(y)&&typeof y.pipeThrough==="function"&&typeof y.getReader==="function"&&typeof y.cancel==="function")}function D(y){return!!(y&&!f(y)&&typeof y.getWriter==="function"&&typeof y.abort==="function")}function z(y){return!!(y&&!f(y)&&typeof y.readable==="object"&&typeof y.writable==="object")}function N(y){return L(y)||D(y)||z(y)}function H(y,i){if(y==null)return!1;if(i===!0)return typeof y[Q]==="function";if(i===!1)return typeof y[K]==="function";return typeof y[Q]==="function"||typeof y[K]==="function"}function v(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!!(y.destroyed||y[Z]||m!==null&&m!==void 0&&m.destroyed)}function j(y){if(!M(y))return null;if(y.writableEnded===!0)return!0;let i=y._writableState;if(i!==null&&i!==void 0&&i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function n(y,i){if(!M(y))return null;if(y.writableFinished===!0)return!0;let U0=y._writableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.finished)!=="boolean")return null;return!!(U0.finished||i===!1&&U0.ended===!0&&U0.length===0)}function d(y){if(!F(y))return null;if(y.readableEnded===!0)return!0;let i=y._readableState;if(!i||i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function _(y,i){if(!F(y))return null;let U0=y._readableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.endEmitted)!=="boolean")return null;return!!(U0.endEmitted||i===!1&&U0.ended===!0&&U0.length===0)}function X(y){if(y&&y[W]!=null)return y[W];if(typeof(y===null||y===void 0?void 0:y.readable)!=="boolean")return null;if(v(y))return!1;return F(y)&&y.readable&&!_(y)}function P(y){if(y&&y[B]!=null)return y[B];if(typeof(y===null||y===void 0?void 0:y.writable)!=="boolean")return null;if(v(y))return!1;return M(y)&&y.writable&&!j(y)}function g(y,i){if(!f(y))return null;if(v(y))return!0;if((i===null||i===void 0?void 0:i.readable)!==!1&&X(y))return!1;if((i===null||i===void 0?void 0:i.writable)!==!1&&P(y))return!1;return!0}function c(y){var i,U0;if(!f(y))return null;if(y.writableErrored)return y.writableErrored;return(i=(U0=y._writableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function h(y){var i,U0;if(!f(y))return null;if(y.readableErrored)return y.readableErrored;return(i=(U0=y._readableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function x(y){if(!f(y))return null;if(typeof y.closed==="boolean")return y.closed;let{_writableState:i,_readableState:U0}=y;if(typeof(i===null||i===void 0?void 0:i.closed)==="boolean"||typeof(U0===null||U0===void 0?void 0:U0.closed)==="boolean")return(i===null||i===void 0?void 0:i.closed)||(U0===null||U0===void 0?void 0:U0.closed);if(typeof y._closed==="boolean"&&l(y))return y._closed;return null}function l(y){return typeof y._closed==="boolean"&&typeof y._defaultKeepAlive==="boolean"&&typeof y._removedConnection==="boolean"&&typeof y._removedContLen==="boolean"}function $0(y){return typeof y._sent100==="boolean"&&l(y)}function Z0(y){var i;return typeof y._consuming==="boolean"&&typeof y._dumped==="boolean"&&((i=y.req)===null||i===void 0?void 0:i.upgradeOrConnect)===void 0}function F0(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!m&&$0(y)||!!(m&&m.autoDestroy&&m.emitClose&&m.closed===!1)}function p(y){var i;return!!(y&&((i=y[V])!==null&&i!==void 0?i:y.readableDidRead||y.readableAborted))}function W0(y){var i,U0,m,V0,w0,S,b,O,E,a;return!!(y&&((i=(U0=(m=(V0=(w0=(S=y[G])!==null&&S!==void 0?S:y.readableErrored)!==null&&w0!==void 0?w0:y.writableErrored)!==null&&V0!==void 0?V0:(b=y._readableState)===null||b===void 0?void 0:b.errorEmitted)!==null&&m!==void 0?m:(O=y._writableState)===null||O===void 0?void 0:O.errorEmitted)!==null&&U0!==void 0?U0:(E=y._readableState)===null||E===void 0?void 0:E.errored)!==null&&i!==void 0?i:(a=y._writableState)===null||a===void 0?void 0:a.errored))}q.exports={isDestroyed:v,kIsDestroyed:Z,isDisturbed:p,kIsDisturbed:V,isErrored:W0,kIsErrored:G,isReadable:X,kIsReadable:W,kIsClosedPromise:U,kControllerErrorFunction:w,kIsWritable:B,isClosed:x,isDuplexNodeStream:k,isFinished:g,isIterable:H,isReadableNodeStream:F,isReadableStream:L,isReadableEnded:d,isReadableFinished:_,isReadableErrored:h,isNodeStream:f,isWebStream:N,isWritable:P,isWritableNodeStream:M,isWritableStream:D,isWritableEnded:j,isWritableFinished:n,isWritableErrored:c,isServerRequest:Z0,isServerResponse:$0,willEmitClose:F0,isTransformStream:z}}),s2=g0(($,q)=>{var Q=D1(),{AbortError:K,codes:J}=a0(),{ERR_INVALID_ARG_TYPE:Z,ERR_STREAM_PREMATURE_CLOSE:G}=J,{kEmptyObject:W,once:B}=e0(),{validateAbortSignal:V,validateFunction:U,validateObject:w,validateBoolean:F}=P6(),{Promise:M,PromisePrototypeThen:k,SymbolDispose:f}=P0(),{isClosed:L,isReadable:D,isReadableNodeStream:z,isReadableStream:N,isReadableFinished:H,isReadableErrored:v,isWritable:j,isWritableNodeStream:n,isWritableStream:d,isWritableFinished:_,isWritableErrored:X,isNodeStream:P,willEmitClose:g,kIsClosedPromise:c}=b2(),h;function x(p){return p.setHeader&&typeof p.abort==="function"}var l=()=>{};function $0(p,W0,y){var i,U0;if(arguments.length===2)y=W0,W0=W;else if(W0==null)W0=W;else w(W0,"options");if(U(y,"callback"),V(W0.signal,"options.signal"),y=B(y),N(p)||d(p))return Z0(p,W0,y);if(!P(p))throw new Z("stream",["ReadableStream","WritableStream","Stream"],p);let m=(i=W0.readable)!==null&&i!==void 0?i:z(p),V0=(U0=W0.writable)!==null&&U0!==void 0?U0:n(p),w0=p._writableState,S=p._readableState,b=()=>{if(!p.writable)a()},O=g(p)&&z(p)===m&&n(p)===V0,E=_(p,!1),a=()=>{if(E=!0,p.destroyed)O=!1;if(O&&(!p.readable||m))return;if(!m||K0)y.call(p)},K0=H(p,!1),R=()=>{if(K0=!0,p.destroyed)O=!1;if(O&&(!p.writable||V0))return;if(!V0||E)y.call(p)},Y=(T)=>{y.call(p,T)},C=L(p),u=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);if(m&&!K0&&z(p,!0)){if(!H(p,!1))return y.call(p,new G)}if(V0&&!E){if(!_(p,!1))return y.call(p,new G)}y.call(p)},e=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);y.call(p)},r=()=>{p.req.on("finish",a)};if(x(p)){if(p.on("complete",a),!O)p.on("abort",u);if(p.req)r();else p.on("request",r)}else if(V0&&!w0)p.on("end",b),p.on("close",b);if(!O&&typeof p.aborted==="boolean")p.on("aborted",u);if(p.on("end",R),p.on("finish",a),W0.error!==!1)p.on("error",Y);if(p.on("close",u),C)Q.nextTick(u);else if(w0!==null&&w0!==void 0&&w0.errorEmitted||S!==null&&S!==void 0&&S.errorEmitted){if(!O)Q.nextTick(e)}else if(!m&&(!O||D(p))&&(E||j(p)===!1))Q.nextTick(e);else if(!V0&&(!O||j(p))&&(K0||D(p)===!1))Q.nextTick(e);else if(S&&p.req&&p.aborted)Q.nextTick(e);let s=()=>{if(y=l,p.removeListener("aborted",u),p.removeListener("complete",a),p.removeListener("abort",u),p.removeListener("request",r),p.req)p.req.removeListener("finish",a);p.removeListener("end",b),p.removeListener("close",b),p.removeListener("finish",a),p.removeListener("end",R),p.removeListener("error",Y),p.removeListener("close",u)};if(W0.signal&&!C){let T=()=>{let t=y;s(),t.call(p,new K(void 0,{cause:W0.signal.reason}))};if(W0.signal.aborted)Q.nextTick(T);else{h=h||e0().addAbortListener;let t=h(W0.signal,T),G0=y;y=B((...Q0)=>{t[f](),G0.apply(p,Q0)})}}return s}function Z0(p,W0,y){let i=!1,U0=l;if(W0.signal)if(U0=()=>{i=!0,y.call(p,new K(void 0,{cause:W0.signal.reason}))},W0.signal.aborted)Q.nextTick(U0);else{h=h||e0().addAbortListener;let V0=h(W0.signal,U0),w0=y;y=B((...S)=>{V0[f](),w0.apply(p,S)})}let m=(...V0)=>{if(!i)Q.nextTick(()=>y.apply(p,V0))};return k(p[c].promise,m,m),l}function F0(p,W0){var y;let i=!1;if(W0===null)W0=W;if((y=W0)!==null&&y!==void 0&&y.cleanup)F(W0.cleanup,"cleanup"),i=W0.cleanup;return new M((U0,m)=>{let V0=$0(p,W0,(w0)=>{if(i)V0();if(w0)m(w0);else U0()})})}q.exports=$0,q.exports.finished=F0}),o1=g0(($,q)=>{var Q=D1(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:J},AbortError:Z}=a0(),{Symbol:G}=P0(),{kIsDestroyed:W,isDestroyed:B,isFinished:V,isServerRequest:U}=b2(),w=G("kDestroy"),F=G("kConstruct");function M(g,c,h){if(g){if(g.stack,c&&!c.errored)c.errored=g;if(h&&!h.errored)h.errored=g}}function k(g,c){let h=this._readableState,x=this._writableState,l=x||h;if(x!==null&&x!==void 0&&x.destroyed||h!==null&&h!==void 0&&h.destroyed){if(typeof c==="function")c();return this}if(M(g,x,h),x)x.destroyed=!0;if(h)h.destroyed=!0;if(!l.constructed)this.once(w,function($0){f(this,K($0,g),c)});else f(this,g,c);return this}function f(g,c,h){let x=!1;function l($0){if(x)return;x=!0;let{_readableState:Z0,_writableState:F0}=g;if(M($0,F0,Z0),F0)F0.closed=!0;if(Z0)Z0.closed=!0;if(typeof h==="function")h($0);if($0)Q.nextTick(L,g,$0);else Q.nextTick(D,g)}try{g._destroy(c||null,l)}catch($0){l($0)}}function L(g,c){z(g,c),D(g)}function D(g){let{_readableState:c,_writableState:h}=g;if(h)h.closeEmitted=!0;if(c)c.closeEmitted=!0;if(h!==null&&h!==void 0&&h.emitClose||c!==null&&c!==void 0&&c.emitClose)g.emit("close")}function z(g,c){let{_readableState:h,_writableState:x}=g;if(x!==null&&x!==void 0&&x.errorEmitted||h!==null&&h!==void 0&&h.errorEmitted)return;if(x)x.errorEmitted=!0;if(h)h.errorEmitted=!0;g.emit("error",c)}function N(){let g=this._readableState,c=this._writableState;if(g)g.constructed=!0,g.closed=!1,g.closeEmitted=!1,g.destroyed=!1,g.errored=null,g.errorEmitted=!1,g.reading=!1,g.ended=g.readable===!1,g.endEmitted=g.readable===!1;if(c)c.constructed=!0,c.destroyed=!1,c.closed=!1,c.closeEmitted=!1,c.errored=null,c.errorEmitted=!1,c.finalCalled=!1,c.prefinished=!1,c.ended=c.writable===!1,c.ending=c.writable===!1,c.finished=c.writable===!1}function H(g,c,h){let{_readableState:x,_writableState:l}=g;if(l!==null&&l!==void 0&&l.destroyed||x!==null&&x!==void 0&&x.destroyed)return this;if(x!==null&&x!==void 0&&x.autoDestroy||l!==null&&l!==void 0&&l.autoDestroy)g.destroy(c);else if(c){if(c.stack,l&&!l.errored)l.errored=c;if(x&&!x.errored)x.errored=c;if(h)Q.nextTick(z,g,c);else z(g,c)}}function v(g,c){if(typeof g._construct!=="function")return;let{_readableState:h,_writableState:x}=g;if(h)h.constructed=!1;if(x)x.constructed=!1;if(g.once(F,c),g.listenerCount(F)>1)return;Q.nextTick(j,g)}function j(g){let c=!1;function h(x){if(c){H(g,x!==null&&x!==void 0?x:new J);return}c=!0;let{_readableState:l,_writableState:$0}=g,Z0=$0||l;if(l)l.constructed=!0;if($0)$0.constructed=!0;if(Z0.destroyed)g.emit(w,x);else if(x)H(g,x,!0);else Q.nextTick(n,g)}try{g._construct((x)=>{Q.nextTick(h,x)})}catch(x){Q.nextTick(h,x)}}function n(g){g.emit(F)}function d(g){return(g===null||g===void 0?void 0:g.setHeader)&&typeof g.abort==="function"}function _(g){g.emit("close")}function X(g,c){g.emit("error",c),Q.nextTick(_,g)}function P(g,c){if(!g||B(g))return;if(!c&&!V(g))c=new Z;if(U(g))g.socket=null,g.destroy(c);else if(d(g))g.abort();else if(d(g.req))g.req.abort();else if(typeof g.destroy==="function")g.destroy(c);else if(typeof g.close==="function")g.close();else if(c)Q.nextTick(X,g,c);else Q.nextTick(_,g);if(!g.destroyed)g[W]=!0}q.exports={construct:v,destroyer:P,destroy:k,undestroy:N,errorOrDestroy:H}}),b5=g0(($,q)=>{var{ArrayIsArray:Q,ObjectSetPrototypeOf:K}=P0(),{EventEmitter:J}=(i1(),X0(p1));function Z(W){J.call(this,W)}K(Z.prototype,J.prototype),K(Z,J),Z.prototype.pipe=function(W,B){let V=this;function U(D){if(W.writable&&W.write(D)===!1&&V.pause)V.pause()}V.on("data",U);function w(){if(V.readable&&V.resume)V.resume()}if(W.on("drain",w),!W._isStdio&&(!B||B.end!==!1))V.on("end",M),V.on("close",k);let F=!1;function M(){if(F)return;F=!0,W.end()}function k(){if(F)return;if(F=!0,typeof W.destroy==="function")W.destroy()}function f(D){if(L(),J.listenerCount(this,"error")===0)this.emit("error",D)}G(V,"error",f),G(W,"error",f);function L(){V.removeListener("data",U),W.removeListener("drain",w),V.removeListener("end",M),V.removeListener("close",k),V.removeListener("error",f),W.removeListener("error",f),V.removeListener("end",L),V.removeListener("close",L),W.removeListener("close",L)}return V.on("end",L),V.on("close",L),W.on("close",L),W.emit("pipe",V),W};function G(W,B,V){if(typeof W.prependListener==="function")return W.prependListener(B,V);if(!W._events||!W._events[B])W.on(B,V);else if(Q(W._events[B]))W._events[B].unshift(V);else W._events[B]=[V,W._events[B]]}q.exports={Stream:Z,prependListener:G}}),H8=g0(($,q)=>{var{SymbolDispose:Q}=P0(),{AbortError:K,codes:J}=a0(),{isNodeStream:Z,isWebStream:G,kControllerErrorFunction:W}=b2(),B=s2(),{ERR_INVALID_ARG_TYPE:V}=J,U,w=(F,M)=>{if(typeof F!=="object"||!("aborted"in F))throw new V(M,"AbortSignal",F)};q.exports.addAbortSignal=function(F,M){if(w(F,"signal"),!Z(M)&&!G(M))throw new V("stream",["ReadableStream","WritableStream","Stream"],M);return q.exports.addAbortSignalNoValidate(F,M)},q.exports.addAbortSignalNoValidate=function(F,M){if(typeof F!=="object"||!("aborted"in F))return M;let k=Z(M)?()=>{M.destroy(new K(void 0,{cause:F.reason}))}:()=>{M[W](new K(void 0,{cause:F.reason}))};if(F.aborted)k();else{U=U||e0().addAbortListener;let f=U(F,k);B(M,f[Q])}return M}}),gV=g0(($,q)=>{var{StringPrototypeSlice:Q,SymbolIterator:K,TypedArrayPrototypeSet:J,Uint8Array:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{inspect:W}=e0();q.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(B){let V={data:B,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length}unshift(B){let V={data:B,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length}shift(){if(this.length===0)return;let B=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,B}clear(){this.head=this.tail=null,this.length=0}join(B){if(this.length===0)return"";let V=this.head,U=""+V.data;while((V=V.next)!==null)U+=B+V.data;return U}concat(B){if(this.length===0)return G.alloc(0);let V=G.allocUnsafe(B>>>0),U=this.head,w=0;while(U)J(V,U.data,w),w+=U.data.length,U=U.next;return V}consume(B,V){let U=this.head.data;if(BF.length)V+=F,B-=F.length;else{if(B===F.length)if(V+=F,++w,U.next)this.head=U.next;else this.head=this.tail=null;else V+=Q(F,0,B),this.head=U,U.data=Q(F,B);break}++w}while((U=U.next)!==null);return this.length-=w,V}_getBuffer(B){let V=G.allocUnsafe(B),U=B,w=this.head,F=0;do{let M=w.data;if(B>M.length)J(V,M,U-B),B-=M.length;else{if(B===M.length)if(J(V,M,U-B),++F,w.next)this.head=w.next;else this.head=this.tail=null;else J(V,new Z(M.buffer,M.byteOffset,B),U-B),this.head=w,w.data=M.slice(B);break}++F}while((w=w.next)!==null);return this.length-=F,V}[Symbol.for("nodejs.util.inspect.custom")](B,V){return W(this,{...V,depth:0,customInspect:!1})}}}),v8=g0(($,q)=>{var{MathFloor:Q,NumberIsInteger:K}=P0(),{validateInteger:J}=P6(),{ERR_INVALID_ARG_VALUE:Z}=a0().codes,G=16384,W=16;function B(F,M,k){return F.highWaterMark!=null?F.highWaterMark:M?F[k]:null}function V(F){return F?W:G}function U(F,M){if(J(M,"value",0),F)W=M;else G=M}function w(F,M,k,f){let L=B(M,f,k);if(L!=null){if(!K(L)||L<0){let D=f?`options.${k}`:"options.highWaterMark";throw new Z(D,L)}return Q(L)}return V(F.objectMode)}q.exports={getHighWaterMark:w,getDefaultHighWaterMark:V,setDefaultHighWaterMark:U}}),AV=g0(($,q)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),XV=g0(($)=>{var q=AV().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),a9=g0(($,q)=>{var Q=D1(),{PromisePrototypeThen:K,SymbolAsyncIterator:J,SymbolIterator:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{ERR_INVALID_ARG_TYPE:W,ERR_STREAM_NULL_VALUES:B}=a0().codes;function V(U,w,F){let M;if(typeof w==="string"||w instanceof G)return new U({objectMode:!0,...F,read(){this.push(w),this.push(null)}});let k;if(w&&w[J])k=!0,M=w[J]();else if(w&&w[Z])k=!1,M=w[Z]();else throw new W("iterable",["Iterable"],w);let f=new U({objectMode:!0,highWaterMark:1,...F}),L=!1;f._read=function(){if(!L)L=!0,z()},f._destroy=function(N,H){K(D(N),()=>Q.nextTick(H,N),(v)=>Q.nextTick(H,v||N))};async function D(N){let H=N!==void 0&&N!==null,v=typeof M.throw==="function";if(H&&v){let{value:j,done:n}=await M.throw(N);if(await j,n)return}if(typeof M.return==="function"){let{value:j}=await M.return();await j}}async function z(){for(;;){try{let{value:N,done:H}=k?await M.next():M.next();if(H)f.push(null);else{let v=N&&typeof N.then==="function"?await N:N;if(v===null)throw L=!1,new B;else if(f.push(v))continue;else L=!1}}catch(N){f.destroy(N)}break}}return f}q.exports=V}),f8=g0(($,q)=>{var Q=D1(),{ArrayPrototypeIndexOf:K,NumberIsInteger:J,NumberIsNaN:Z,NumberParseInt:G,ObjectDefineProperties:W,ObjectKeys:B,ObjectSetPrototypeOf:V,Promise:U,SafeSet:w,SymbolAsyncDispose:F,SymbolAsyncIterator:M,Symbol:k}=P0();q.exports=Q0,Q0.ReadableState=G0;var{EventEmitter:f}=(i1(),X0(p1)),{Stream:L,prependListener:D}=b5(),{Buffer:z}=(t0(),X0(K2)),{addAbortSignal:N}=H8(),H=s2(),v=e0().debuglog("stream",(I)=>{v=I}),j=gV(),n=o1(),{getHighWaterMark:d,getDefaultHighWaterMark:_}=v8(),{aggregateTwoErrors:X,codes:{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:g,ERR_OUT_OF_RANGE:c,ERR_STREAM_PUSH_AFTER_EOF:h,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:x},AbortError:l}=a0(),{validateObject:$0}=P6(),Z0=k("kPaused"),{StringDecoder:F0}=XV(),p=a9();V(Q0.prototype,L.prototype),V(Q0,L);var W0=()=>{},{errorOrDestroy:y}=n,i=1,U0=2,m=4,V0=8,w0=16,S=32,b=64,O=128,E=256,a=512,K0=1024,R=2048,Y=4096,C=8192,u=16384,e=32768,r=65536,s=131072,T=262144;function t(I){return{enumerable:!1,get(){return(this.state&I)!==0},set(A){if(A)this.state|=I;else this.state&=~I}}}W(G0.prototype,{objectMode:t(i),ended:t(U0),endEmitted:t(m),reading:t(V0),constructed:t(w0),sync:t(S),needReadable:t(b),emittedReadable:t(O),readableListening:t(E),resumeScheduled:t(a),errorEmitted:t(K0),emitClose:t(R),autoDestroy:t(Y),destroyed:t(C),closed:t(u),closeEmitted:t(e),multiAwaitDrain:t(r),readingMore:t(s),dataEmitted:t(T)});function G0(I,A,J0){if(typeof J0!=="boolean")J0=A instanceof c2();if(this.state=R|Y|w0|S,I&&I.objectMode)this.state|=i;if(J0&&I&&I.readableObjectMode)this.state|=i;if(this.highWaterMark=I?d(this,I,"readableHighWaterMark",J0):_(!1),this.buffer=new j,this.length=0,this.pipes=[],this.flowing=null,this[Z0]=null,I&&I.emitClose===!1)this.state&=~R;if(I&&I.autoDestroy===!1)this.state&=~Y;if(this.errored=null,this.defaultEncoding=I&&I.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,I&&I.encoding)this.decoder=new F0(I.encoding),this.encoding=I.encoding}function Q0(I){if(!(this instanceof Q0))return new Q0(I);let A=this instanceof c2();if(this._readableState=new G0(I,this,A),I){if(typeof I.read==="function")this._read=I.read;if(typeof I.destroy==="function")this._destroy=I.destroy;if(typeof I.construct==="function")this._construct=I.construct;if(I.signal&&!A)N(I.signal,this)}L.call(this,I),n.construct(this,()=>{if(this._readableState.needReadable)_1(this,this._readableState)})}Q0.prototype.destroy=n.destroy,Q0.prototype._undestroy=n.undestroy,Q0.prototype._destroy=function(I,A){A(I)},Q0.prototype[f.captureRejectionSymbol]=function(I){this.destroy(I)},Q0.prototype[F]=function(){let I;if(!this.destroyed)I=this.readableEnded?null:new l,this.destroy(I);return new U((A,J0)=>H(this,(B0)=>B0&&B0!==I?J0(B0):A(null)))},Q0.prototype.push=function(I,A){return M0(this,I,A,!1)},Q0.prototype.unshift=function(I,A){return M0(this,I,A,!0)};function M0(I,A,J0,B0){v("readableAddChunk",A);let z0=I._readableState,i0;if((z0.state&i)===0){if(typeof A==="string"){if(J0=J0||z0.defaultEncoding,z0.encoding!==J0)if(B0&&z0.encoding)A=z.from(A,J0).toString(z0.encoding);else A=z.from(A,J0),J0=""}else if(A instanceof z)J0="";else if(L._isUint8Array(A))A=L._uint8ArrayToBuffer(A),J0="";else if(A!=null)i0=new P("chunk",["string","Buffer","Uint8Array"],A)}if(i0)y(I,i0);else if(A===null)z0.state&=~V0,O0(I,z0);else if((z0.state&i)!==0||A&&A.length>0)if(B0)if((z0.state&m)!==0)y(I,new x);else if(z0.destroyed||z0.errored)return!1;else I0(I,z0,A,!0);else if(z0.ended)y(I,new h);else if(z0.destroyed||z0.errored)return!1;else if(z0.state&=~V0,z0.decoder&&!J0)if(A=z0.decoder.write(A),z0.objectMode||A.length!==0)I0(I,z0,A,!1);else _1(I,z0);else I0(I,z0,A,!1);else if(!B0)z0.state&=~V0,_1(I,z0);return!z0.ended&&(z0.length0){if((A.state&r)!==0)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;A.dataEmitted=!0,I.emit("data",J0)}else{if(A.length+=A.objectMode?1:J0.length,B0)A.buffer.unshift(J0);else A.buffer.push(J0);if((A.state&b)!==0)u0(I)}_1(I,A)}Q0.prototype.isPaused=function(){let I=this._readableState;return I[Z0]===!0||I.flowing===!1},Q0.prototype.setEncoding=function(I){let A=new F0(I);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;let J0=this._readableState.buffer,B0="";for(let z0 of J0)B0+=A.write(z0);if(J0.clear(),B0!=="")J0.push(B0);return this._readableState.length=B0.length,this};var m0=1073741824;function p0(I){if(I>m0)throw new c("size","<= 1GiB",I);else I--,I|=I>>>1,I|=I>>>2,I|=I>>>4,I|=I>>>8,I|=I>>>16,I++;return I}function q2(I,A){if(I<=0||A.length===0&&A.ended)return 0;if((A.state&i)!==0)return 1;if(Z(I)){if(A.flowing&&A.length)return A.buffer.first().length;return A.length}if(I<=A.length)return I;return A.ended?A.length:0}Q0.prototype.read=function(I){if(v("read",I),I===void 0)I=NaN;else if(!J(I))I=G(I,10);let A=this._readableState,J0=I;if(I>A.highWaterMark)A.highWaterMark=p0(I);if(I!==0)A.state&=~O;if(I===0&&A.needReadable&&((A.highWaterMark!==0?A.length>=A.highWaterMark:A.length>0)||A.ended)){if(v("read: emitReadable",A.length,A.ended),A.length===0&&A.ended)f5(this);else u0(this);return null}if(I=q2(I,A),I===0&&A.ended){if(A.length===0)f5(this);return null}let B0=(A.state&b)!==0;if(v("need readable",B0),A.length===0||A.length-I0)z0=l7(I,A);else z0=null;if(z0===null)A.needReadable=A.length<=A.highWaterMark,I=0;else if(A.length-=I,A.multiAwaitDrain)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;if(A.length===0){if(!A.ended)A.needReadable=!0;if(J0!==I&&A.ended)f5(this)}if(z0!==null&&!A.errorEmitted&&!A.closeEmitted)A.dataEmitted=!0,this.emit("data",z0);return z0};function O0(I,A){if(v("onEofChunk"),A.ended)return;if(A.decoder){let J0=A.decoder.end();if(J0&&J0.length)A.buffer.push(J0),A.length+=A.objectMode?1:J0.length}if(A.ended=!0,A.sync)u0(I);else A.needReadable=!1,A.emittedReadable=!0,E1(I)}function u0(I){let A=I._readableState;if(v("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,!A.emittedReadable)v("emitReadable",A.flowing),A.emittedReadable=!0,Q.nextTick(E1,I)}function E1(I){let A=I._readableState;if(v("emitReadable_",A.destroyed,A.length,A.ended),!A.destroyed&&!A.errored&&(A.length||A.ended))I.emit("readable"),A.emittedReadable=!1;A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,o7(I)}function _1(I,A){if(!A.readingMore&&A.constructed)A.readingMore=!0,Q.nextTick(R2,I,A)}function R2(I,A){while(!A.reading&&!A.ended&&(A.length1&&B0.pipes.includes(I))v("false write response, pause",B0.awaitDrainWriters.size),B0.awaitDrainWriters.add(I);J0.pause()}if(!z1)z1=wJ(J0,I),I.on("drain",z1)}J0.on("data",e7);function e7(F1){v("ondata");let u2=I.write(F1);if(v("dest.write",u2),u2===!1)t7()}function I5(F1){if(v("onerror",F1),A6(),I.removeListener("error",I5),I.listenerCount("error")===0){let u2=I._writableState||I._readableState;if(u2&&!u2.errorEmitted)y(I,F1);else I.emit("error",F1)}}D(I,"error",I5);function C5(){I.removeListener("finish",j5),A6()}I.once("close",C5);function j5(){v("onfinish"),I.removeListener("close",C5),A6()}I.once("finish",j5);function A6(){v("unpipe"),J0.unpipe(I)}if(I.emit("pipe",J0),I.writableNeedDrain===!0)t7();else if(!B0.flowing)v("pipe resume"),J0.resume();return I};function wJ(I,A){return function(){let J0=I._readableState;if(J0.awaitDrainWriters===A)v("pipeOnDrain",1),J0.awaitDrainWriters=null;else if(J0.multiAwaitDrain)v("pipeOnDrain",J0.awaitDrainWriters.size),J0.awaitDrainWriters.delete(A);if((!J0.awaitDrainWriters||J0.awaitDrainWriters.size===0)&&I.listenerCount("data"))I.resume()}}Q0.prototype.unpipe=function(I){let A=this._readableState,J0={hasUnpiped:!1};if(A.pipes.length===0)return this;if(!I){let z0=A.pipes;A.pipes=[],this.pause();for(let i0=0;i00,B0.flowing!==!1)this.resume()}else if(I==="readable"){if(!B0.endEmitted&&!B0.readableListening){if(B0.readableListening=B0.needReadable=!0,B0.flowing=!1,B0.emittedReadable=!1,v("on readable",B0.length,B0.reading),B0.length)u0(this);else if(!B0.reading)Q.nextTick(NJ,this)}}return J0},Q0.prototype.addListener=Q0.prototype.on,Q0.prototype.removeListener=function(I,A){let J0=L.prototype.removeListener.call(this,I,A);if(I==="readable")Q.nextTick(i7,this);return J0},Q0.prototype.off=Q0.prototype.removeListener,Q0.prototype.removeAllListeners=function(I){let A=L.prototype.removeAllListeners.apply(this,arguments);if(I==="readable"||I===void 0)Q.nextTick(i7,this);return A};function i7(I){let A=I._readableState;if(A.readableListening=I.listenerCount("readable")>0,A.resumeScheduled&&A[Z0]===!1)A.flowing=!0;else if(I.listenerCount("data")>0)I.resume();else if(!A.readableListening)A.flowing=null}function NJ(I){v("readable nexttick read 0"),I.read(0)}Q0.prototype.resume=function(){let I=this._readableState;if(!I.flowing)v("resume"),I.flowing=!I.readableListening,YJ(this,I);return I[Z0]=!1,this};function YJ(I,A){if(!A.resumeScheduled)A.resumeScheduled=!0,Q.nextTick(kJ,I,A)}function kJ(I,A){if(v("resume",A.reading),!A.reading)I.read(0);if(A.resumeScheduled=!1,I.emit("resume"),o7(I),A.flowing&&!A.reading)I.read(0)}Q0.prototype.pause=function(){if(v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)v("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[Z0]=!0,this};function o7(I){let A=I._readableState;v("flow",A.flowing);while(A.flowing&&I.read()!==null);}Q0.prototype.wrap=function(I){let A=!1;I.on("data",(B0)=>{if(!this.push(B0)&&I.pause)A=!0,I.pause()}),I.on("end",()=>{this.push(null)}),I.on("error",(B0)=>{y(this,B0)}),I.on("close",()=>{this.destroy()}),I.on("destroy",()=>{this.destroy()}),this._read=()=>{if(A&&I.resume)A=!1,I.resume()};let J0=B(I);for(let B0=1;B0{z0=z2?X(z0,z2):null,J0(),J0=W0});try{while(!0){let z2=I.destroyed?null:I.read();if(z2!==null)yield z2;else if(z0)throw z0;else if(z0===null)return;else await new U(B0)}}catch(z2){throw z0=X(z0,z2),z0}finally{if((z0||(A===null||A===void 0?void 0:A.destroyOnReturn)!==!1)&&(z0===void 0||I._readableState.autoDestroy))n.destroyer(I,null);else I.off("readable",B0),i0()}}W(Q0.prototype,{readable:{__proto__:null,get(){let I=this._readableState;return!!I&&I.readable!==!1&&!I.destroyed&&!I.errorEmitted&&!I.endEmitted},set(I){if(this._readableState)this._readableState.readable=!!I}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(I){if(this._readableState)this._readableState.flowing=I}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(I){if(!this._readableState)return;this._readableState.destroyed=I}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),W(G0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Z0]!==!1},set(I){this[Z0]=!!I}}}),Q0._fromList=l7;function l7(I,A){if(A.length===0)return null;let J0;if(A.objectMode)J0=A.buffer.shift();else if(!I||I>=A.length){if(A.decoder)J0=A.buffer.join("");else if(A.buffer.length===1)J0=A.buffer.first();else J0=A.buffer.concat(A.length);A.buffer.clear()}else J0=A.buffer.consume(I,A.decoder);return J0}function f5(I){let A=I._readableState;if(v("endReadable",A.endEmitted),!A.endEmitted)A.ended=!0,Q.nextTick(LJ,A,I)}function LJ(I,A){if(v("endReadableNT",I.endEmitted,I.length),!I.errored&&!I.closeEmitted&&!I.endEmitted&&I.length===0){if(I.endEmitted=!0,A.emit("end"),A.writable&&A.allowHalfOpen===!1)Q.nextTick(HJ,A);else if(I.autoDestroy){let J0=A._writableState;if(!J0||J0.autoDestroy&&(J0.finished||J0.writable===!1))A.destroy()}}}function HJ(I){if(I.writable&&!I.writableEnded&&!I.destroyed)I.end()}Q0.from=function(I,A){return p(Q0,I,A)};var R5;function r7(){if(R5===void 0)R5={};return R5}Q0.fromWeb=function(I,A){return r7().newStreamReadableFromReadableStream(I,A)},Q0.toWeb=function(I,A){return r7().newReadableStreamFromStreamReadable(I,A)},Q0.wrap=function(I,A){var J0,B0;return new Q0({objectMode:(J0=(B0=I.readableObjectMode)!==null&&B0!==void 0?B0:I.objectMode)!==null&&J0!==void 0?J0:!0,...A,destroy(z0,i0){n.destroyer(I,z0),i0(z0)}}).wrap(I)}}),n5=g0(($,q)=>{var Q=D1(),{ArrayPrototypeSlice:K,Error:J,FunctionPrototypeSymbolHasInstance:Z,ObjectDefineProperty:G,ObjectDefineProperties:W,ObjectSetPrototypeOf:B,StringPrototypeToLowerCase:V,Symbol:U,SymbolHasInstance:w}=P0();q.exports=$0,$0.WritableState=x;var{EventEmitter:F}=(i1(),X0(p1)),M=b5().Stream,{Buffer:k}=(t0(),X0(K2)),f=o1(),{addAbortSignal:L}=H8(),{getHighWaterMark:D,getDefaultHighWaterMark:z}=v8(),{ERR_INVALID_ARG_TYPE:N,ERR_METHOD_NOT_IMPLEMENTED:H,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:j,ERR_STREAM_DESTROYED:n,ERR_STREAM_ALREADY_FINISHED:d,ERR_STREAM_NULL_VALUES:_,ERR_STREAM_WRITE_AFTER_END:X,ERR_UNKNOWN_ENCODING:P}=a0().codes,{errorOrDestroy:g}=f;B($0.prototype,M.prototype),B($0,M);function c(){}var h=U("kOnFinished");function x(Y,C,u){if(typeof u!=="boolean")u=C instanceof c2();if(this.objectMode=!!(Y&&Y.objectMode),u)this.objectMode=this.objectMode||!!(Y&&Y.writableObjectMode);this.highWaterMark=Y?D(this,Y,"writableHighWaterMark",u):z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let e=!!(Y&&Y.decodeStrings===!1);this.decodeStrings=!e,this.defaultEncoding=Y&&Y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=y.bind(void 0,C),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,l(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!Y||Y.emitClose!==!1,this.autoDestroy=!Y||Y.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[h]=[]}function l(Y){Y.buffered=[],Y.bufferedIndex=0,Y.allBuffers=!0,Y.allNoop=!0}x.prototype.getBuffer=function(){return K(this.buffered,this.bufferedIndex)},G(x.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function $0(Y){let C=this instanceof c2();if(!C&&!Z($0,this))return new $0(Y);if(this._writableState=new x(Y,this,C),Y){if(typeof Y.write==="function")this._write=Y.write;if(typeof Y.writev==="function")this._writev=Y.writev;if(typeof Y.destroy==="function")this._destroy=Y.destroy;if(typeof Y.final==="function")this._final=Y.final;if(typeof Y.construct==="function")this._construct=Y.construct;if(Y.signal)L(Y.signal,this)}M.call(this,Y),f.construct(this,()=>{let u=this._writableState;if(!u.writing)V0(this,u);O(this,u)})}G($0,w,{__proto__:null,value:function(Y){if(Z(this,Y))return!0;if(this!==$0)return!1;return Y&&Y._writableState instanceof x}}),$0.prototype.pipe=function(){g(this,new j)};function Z0(Y,C,u,e){let r=Y._writableState;if(typeof u==="function")e=u,u=r.defaultEncoding;else{if(!u)u=r.defaultEncoding;else if(u!=="buffer"&&!k.isEncoding(u))throw new P(u);if(typeof e!=="function")e=c}if(C===null)throw new _;else if(!r.objectMode)if(typeof C==="string"){if(r.decodeStrings!==!1)C=k.from(C,u),u="buffer"}else if(C instanceof k)u="buffer";else if(M._isUint8Array(C))C=M._uint8ArrayToBuffer(C),u="buffer";else throw new N("chunk",["string","Buffer","Uint8Array"],C);let s;if(r.ending)s=new X;else if(r.destroyed)s=new n("write");if(s)return Q.nextTick(e,s),g(Y,s,!0),s;return r.pendingcb++,F0(Y,r,C,u,e)}$0.prototype.write=function(Y,C,u){return Z0(this,Y,C,u)===!0},$0.prototype.cork=function(){this._writableState.corked++},$0.prototype.uncork=function(){let Y=this._writableState;if(Y.corked){if(Y.corked--,!Y.writing)V0(this,Y)}},$0.prototype.setDefaultEncoding=function(Y){if(typeof Y==="string")Y=V(Y);if(!k.isEncoding(Y))throw new P(Y);return this._writableState.defaultEncoding=Y,this};function F0(Y,C,u,e,r){let s=C.objectMode?1:u.length;C.length+=s;let T=C.lengthu.bufferedIndex)V0(Y,u);if(e)if(u.afterWriteTickInfo!==null&&u.afterWriteTickInfo.cb===r)u.afterWriteTickInfo.count++;else u.afterWriteTickInfo={count:1,cb:r,stream:Y,state:u},Q.nextTick(i,u.afterWriteTickInfo);else U0(Y,u,1,r)}}function i({stream:Y,state:C,count:u,cb:e}){return C.afterWriteTickInfo=null,U0(Y,C,u,e)}function U0(Y,C,u,e){if(!C.ending&&!Y.destroyed&&C.length===0&&C.needDrain)C.needDrain=!1,Y.emit("drain");while(u-- >0)C.pendingcb--,e();if(C.destroyed)m(C);O(Y,C)}function m(Y){if(Y.writing)return;for(let r=Y.bufferedIndex;r1&&Y._writev){C.pendingcb-=s-1;let t=C.allNoop?c:(Q0)=>{for(let M0=T;M0256)u.splice(0,T),C.bufferedIndex=0;else C.bufferedIndex=T}C.bufferProcessing=!1}$0.prototype._write=function(Y,C,u){if(this._writev)this._writev([{chunk:Y,encoding:C}],u);else throw new H("_write()")},$0.prototype._writev=null,$0.prototype.end=function(Y,C,u){let e=this._writableState;if(typeof Y==="function")u=Y,Y=null,C=null;else if(typeof C==="function")u=C,C=null;let r;if(Y!==null&&Y!==void 0){let s=Z0(this,Y,C);if(s instanceof J)r=s}if(e.corked)e.corked=1,this.uncork();if(r);else if(!e.errored&&!e.ending)e.ending=!0,O(this,e,!0),e.ended=!0;else if(e.finished)r=new d("end");else if(e.destroyed)r=new n("end");if(typeof u==="function")if(r||e.finished)Q.nextTick(u,r);else e[h].push(u);return this};function w0(Y){return Y.ending&&!Y.destroyed&&Y.constructed&&Y.length===0&&!Y.errored&&Y.buffered.length===0&&!Y.finished&&!Y.writing&&!Y.errorEmitted&&!Y.closeEmitted}function S(Y,C){let u=!1;function e(r){if(u){g(Y,r!==null&&r!==void 0?r:v());return}if(u=!0,C.pendingcb--,r){let s=C[h].splice(0);for(let T=0;T{if(w0(r))E(e,r);else r.pendingcb--},Y,C);else if(w0(C))C.pendingcb++,E(Y,C)}}}function E(Y,C){C.pendingcb--,C.finished=!0;let u=C[h].splice(0);for(let e=0;e{var Q=D1(),K=(t0(),X0(K2)),{isReadable:J,isWritable:Z,isIterable:G,isNodeStream:W,isReadableNodeStream:B,isWritableNodeStream:V,isDuplexNodeStream:U,isReadableStream:w,isWritableStream:F}=b2(),M=s2(),{AbortError:k,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:L}}=a0(),{destroyer:D}=o1(),z=c2(),N=f8(),H=n5(),{createDeferredPromise:v}=e0(),j=a9(),n=globalThis.Blob||K.Blob,d=typeof n<"u"?function(h){return h instanceof n}:function(h){return!1},_=globalThis.AbortController||O6().AbortController,{FunctionPrototypeCall:X}=P0();class P extends z{constructor(h){super(h);if((h===null||h===void 0?void 0:h.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((h===null||h===void 0?void 0:h.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}q.exports=function h(x,l){if(U(x))return x;if(B(x))return c({readable:x});if(V(x))return c({writable:x});if(W(x))return c({writable:!1,readable:!1});if(w(x))return c({readable:N.fromWeb(x)});if(F(x))return c({writable:H.fromWeb(x)});if(typeof x==="function"){let{value:Z0,write:F0,final:p,destroy:W0}=g(x);if(G(Z0))return j(P,Z0,{objectMode:!0,write:F0,final:p,destroy:W0});let y=Z0===null||Z0===void 0?void 0:Z0.then;if(typeof y==="function"){let i,U0=X(y,Z0,(m)=>{if(m!=null)throw new L("nully","body",m)},(m)=>{D(i,m)});return i=new P({objectMode:!0,readable:!1,write:F0,final(m){p(async()=>{try{await U0,Q.nextTick(m,null)}catch(V0){Q.nextTick(m,V0)}})},destroy:W0})}throw new L("Iterable, AsyncIterable or AsyncFunction",l,Z0)}if(d(x))return h(x.arrayBuffer());if(G(x))return j(P,x,{objectMode:!0,writable:!1});if(w(x===null||x===void 0?void 0:x.readable)&&F(x===null||x===void 0?void 0:x.writable))return P.fromWeb(x);if(typeof(x===null||x===void 0?void 0:x.writable)==="object"||typeof(x===null||x===void 0?void 0:x.readable)==="object"){let Z0=x!==null&&x!==void 0&&x.readable?B(x===null||x===void 0?void 0:x.readable)?x===null||x===void 0?void 0:x.readable:h(x.readable):void 0,F0=x!==null&&x!==void 0&&x.writable?V(x===null||x===void 0?void 0:x.writable)?x===null||x===void 0?void 0:x.writable:h(x.writable):void 0;return c({readable:Z0,writable:F0})}let $0=x===null||x===void 0?void 0:x.then;if(typeof $0==="function"){let Z0;return X($0,x,(F0)=>{if(F0!=null)Z0.push(F0);Z0.push(null)},(F0)=>{D(Z0,F0)}),Z0=new P({objectMode:!0,writable:!1,read(){}})}throw new f(l,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],x)};function g(h){let{promise:x,resolve:l}=v(),$0=new _,Z0=$0.signal;return{value:h(async function*(){while(!0){let F0=x;x=null;let{chunk:p,done:W0,cb:y}=await F0;if(Q.nextTick(y),W0)return;if(Z0.aborted)throw new k(void 0,{cause:Z0.reason});({promise:x,resolve:l}=v()),yield p}}(),{signal:Z0}),write(F0,p,W0){let y=l;l=null,y({chunk:F0,done:!1,cb:W0})},final(F0){let p=l;l=null,p({done:!0,cb:F0})},destroy(F0,p){$0.abort(),p(F0)}}}function c(h){let x=h.readable&&typeof h.readable.read!=="function"?N.wrap(h.readable):h.readable,l=h.writable,$0=!!J(x),Z0=!!Z(l),F0,p,W0,y,i;function U0(m){let V0=y;if(y=null,V0)V0(m);else if(m)i.destroy(m)}if(i=new P({readableObjectMode:!!(x!==null&&x!==void 0&&x.readableObjectMode),writableObjectMode:!!(l!==null&&l!==void 0&&l.writableObjectMode),readable:$0,writable:Z0}),Z0)M(l,(m)=>{if(Z0=!1,m)D(x,m);U0(m)}),i._write=function(m,V0,w0){if(l.write(m,V0))w0();else F0=w0},i._final=function(m){l.end(),p=m},l.on("drain",function(){if(F0){let m=F0;F0=null,m()}}),l.on("finish",function(){if(p){let m=p;p=null,m()}});if($0)M(x,(m)=>{if($0=!1,m)D(x,m);U0(m)}),x.on("readable",function(){if(W0){let m=W0;W0=null,m()}}),x.on("end",function(){i.push(null)}),i._read=function(){while(!0){let m=x.read();if(m===null){W0=i._read;return}if(!i.push(m))return}};return i._destroy=function(m,V0){if(!m&&y!==null)m=new k;if(W0=null,F0=null,p=null,y===null)V0(m);else y=V0,D(l,m),D(x,m)},i}}),c2=g0(($,q)=>{var{ObjectDefineProperties:Q,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:J,ObjectSetPrototypeOf:Z}=P0();q.exports=B;var G=f8(),W=n5();Z(B.prototype,G.prototype),Z(B,G);{let F=J(W.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:Q,Symbol:K}=P0();q.exports=B;var{ERR_METHOD_NOT_IMPLEMENTED:J}=a0().codes,Z=c2(),{getHighWaterMark:G}=v8();Q(B.prototype,Z.prototype),Q(B,Z);var W=K("kCallback");function B(w){if(!(this instanceof B))return new B(w);let F=w?G(this,w,"readableHighWaterMark",!0):null;if(F===0)w={...w,highWaterMark:null,readableHighWaterMark:F,writableHighWaterMark:w.writableHighWaterMark||0};if(Z.call(this,w),this._readableState.sync=!1,this[W]=null,w){if(typeof w.transform==="function")this._transform=w.transform;if(typeof w.flush==="function")this._flush=w.flush}this.on("prefinish",U)}function V(w){if(typeof this._flush==="function"&&!this.destroyed)this._flush((F,M)=>{if(F){if(w)w(F);else this.destroy(F);return}if(M!=null)this.push(M);if(this.push(null),w)w()});else if(this.push(null),w)w()}function U(){if(this._final!==V)V.call(this)}B.prototype._final=V,B.prototype._transform=function(w,F,M){throw new J("_transform()")},B.prototype._write=function(w,F,M){let k=this._readableState,f=this._writableState,L=k.length;this._transform(w,F,(D,z)=>{if(D){M(D);return}if(z!=null)this.push(z);if(f.ended||L===k.length||k.length{var{ObjectSetPrototypeOf:Q}=P0();q.exports=J;var K=l9();Q(J.prototype,K.prototype),Q(J,K);function J(Z){if(!(this instanceof J))return new J(Z);K.call(this,Z)}J.prototype._transform=function(Z,G,W){W(null,Z)}}),d5=g0(($,q)=>{var Q=D1(),{ArrayIsArray:K,Promise:J,SymbolAsyncIterator:Z,SymbolDispose:G}=P0(),W=s2(),{once:B}=e0(),V=o1(),U=c2(),{aggregateTwoErrors:w,codes:{ERR_INVALID_ARG_TYPE:F,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:k,ERR_STREAM_DESTROYED:f,ERR_STREAM_PREMATURE_CLOSE:L},AbortError:D}=a0(),{validateFunction:z,validateAbortSignal:N}=P6(),{isIterable:H,isReadable:v,isReadableNodeStream:j,isNodeStream:n,isTransformStream:d,isWebStream:_,isReadableStream:X,isReadableFinished:P}=b2(),g=globalThis.AbortController||O6().AbortController,c,h,x;function l(m,V0,w0){let S=!1;m.on("close",()=>{S=!0});let b=W(m,{readable:V0,writable:w0},(O)=>{S=!O});return{destroy:(O)=>{if(S)return;S=!0,V.destroyer(m,O||new f("pipe"))},cleanup:b}}function $0(m){return z(m[m.length-1],"streams[stream.length - 1]"),m.pop()}function Z0(m){if(H(m))return m;else if(j(m))return F0(m);throw new F("val",["Readable","Iterable","AsyncIterable"],m)}async function*F0(m){if(!h)h=f8();yield*h.prototype[Z].call(m)}async function p(m,V0,w0,{end:S}){let b,O=null,E=(R)=>{if(R)b=R;if(O){let Y=O;O=null,Y()}},a=()=>new J((R,Y)=>{if(b)Y(b);else O=()=>{if(b)Y(b);else R()}});V0.on("drain",E);let K0=W(V0,{readable:!1},E);try{if(V0.writableNeedDrain)await a();for await(let R of m)if(!V0.write(R))await a();if(S)V0.end(),await a();w0()}catch(R){w0(b!==R?w(b,R):R)}finally{K0(),V0.off("drain",E)}}async function W0(m,V0,w0,{end:S}){if(d(V0))V0=V0.writable;let b=V0.getWriter();try{for await(let O of m)await b.ready,b.write(O).catch(()=>{});if(await b.ready,S)await b.close();w0()}catch(O){try{await b.abort(O),w0(O)}catch(E){w0(E)}}}function y(...m){return i(m,B($0(m)))}function i(m,V0,w0){if(m.length===1&&K(m[0]))m=m[0];if(m.length<2)throw new k("streams");let S=new g,b=S.signal,O=w0===null||w0===void 0?void 0:w0.signal,E=[];N(O,"options.signal");function a(){r(new D)}x=x||e0().addAbortListener;let K0;if(O)K0=x(O,a);let R,Y,C=[],u=0;function e(Q0){r(Q0,--u===0)}function r(Q0,M0){var I0;if(Q0&&(!R||R.code==="ERR_STREAM_PREMATURE_CLOSE"))R=Q0;if(!R&&!M0)return;while(C.length)C.shift()(R);if((I0=K0)===null||I0===void 0||I0[G](),S.abort(),M0){if(!R)E.forEach((m0)=>m0());Q.nextTick(V0,R,Y)}}let s;for(let Q0=0;Q00,p0=I0||(w0===null||w0===void 0?void 0:w0.end)!==!1,q2=Q0===m.length-1;if(n(M0)){let O0=function(u0){if(u0&&u0.name!=="AbortError"&&u0.code!=="ERR_STREAM_PREMATURE_CLOSE")e(u0)};var T=O0;if(p0){let{destroy:u0,cleanup:E1}=l(M0,I0,m0);if(C.push(u0),v(M0)&&q2)E.push(E1)}if(M0.on("error",O0),v(M0)&&q2)E.push(()=>{M0.removeListener("error",O0)})}if(Q0===0)if(typeof M0==="function"){if(s=M0({signal:b}),!H(s))throw new M("Iterable, AsyncIterable or Stream","source",s)}else if(H(M0)||j(M0)||d(M0))s=M0;else s=U.from(M0);else if(typeof M0==="function"){if(d(s)){var t;s=Z0((t=s)===null||t===void 0?void 0:t.readable)}else s=Z0(s);if(s=M0(s,{signal:b}),I0){if(!H(s,!0))throw new M("AsyncIterable",`transform[${Q0-1}]`,s)}else{var G0;if(!c)c=r9();let O0=new c({objectMode:!0}),u0=(G0=s)===null||G0===void 0?void 0:G0.then;if(typeof u0==="function")u++,u0.call(s,(R2)=>{if(Y=R2,R2!=null)O0.write(R2);if(p0)O0.end();Q.nextTick(e)},(R2)=>{O0.destroy(R2),Q.nextTick(e,R2)});else if(H(s,!0))u++,p(s,O0,e,{end:p0});else if(X(s)||d(s)){let R2=s.readable||s;u++,p(R2,O0,e,{end:p0})}else throw new M("AsyncIterable or Promise","destination",s);s=O0;let{destroy:E1,cleanup:_1}=l(s,!1,!0);if(C.push(E1),q2)E.push(_1)}}else if(n(M0)){if(j(s)){u+=2;let O0=U0(s,M0,e,{end:p0});if(v(M0)&&q2)E.push(O0)}else if(d(s)||X(s)){let O0=s.readable||s;u++,p(O0,M0,e,{end:p0})}else if(H(s))u++,p(s,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else if(_(M0)){if(j(s))u++,W0(Z0(s),M0,e,{end:p0});else if(X(s)||H(s))u++,W0(s,M0,e,{end:p0});else if(d(s))u++,W0(s.readable,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else s=U.from(M0)}if(b!==null&&b!==void 0&&b.aborted||O!==null&&O!==void 0&&O.aborted)Q.nextTick(a);return s}function U0(m,V0,w0,{end:S}){let b=!1;if(V0.on("close",()=>{if(!b)w0(new L)}),m.pipe(V0,{end:!1}),S){let E=function(){b=!0,V0.end()};var O=E;if(P(m))Q.nextTick(E);else m.once("end",E)}else w0();return W(m,{readable:!0,writable:!1},(E)=>{let a=m._readableState;if(E&&E.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted)m.once("end",w0).once("error",w0);else w0(E)}),W(V0,{readable:!1,writable:!0},w0)}q.exports={pipelineImpl:i,pipeline:y}}),s9=g0(($,q)=>{var{pipeline:Q}=d5(),K=c2(),{destroyer:J}=o1(),{isNodeStream:Z,isReadable:G,isWritable:W,isWebStream:B,isTransformStream:V,isWritableStream:U,isReadableStream:w}=b2(),{AbortError:F,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:k}}=a0(),f=s2();q.exports=function(...L){if(L.length===0)throw new k("streams");if(L.length===1)return K.from(L[0]);let D=[...L];if(typeof L[0]==="function")L[0]=K.from(L[0]);if(typeof L[L.length-1]==="function"){let g=L.length-1;L[g]=K.from(L[g])}for(let g=0;g0&&!(W(L[g])||U(L[g])||V(L[g])))throw new M(`streams[${g}]`,D[g],"must be writable")}let z,N,H,v,j;function n(g){let c=v;if(v=null,c)c(g);else if(g)j.destroy(g);else if(!P&&!X)j.destroy()}let d=L[0],_=Q(L,n),X=!!(W(d)||U(d)||V(d)),P=!!(G(_)||w(_)||V(_));if(j=new K({writableObjectMode:!!(d!==null&&d!==void 0&&d.writableObjectMode),readableObjectMode:!!(_!==null&&_!==void 0&&_.readableObjectMode),writable:X,readable:P}),X){if(Z(d))j._write=function(c,h,x){if(d.write(c,h))x();else z=x},j._final=function(c){d.end(),N=c},d.on("drain",function(){if(z){let c=z;z=null,c()}});else if(B(d)){let c=(V(d)?d.writable:d).getWriter();j._write=async function(h,x,l){try{await c.ready,c.write(h).catch(()=>{}),l()}catch($0){l($0)}},j._final=async function(h){try{await c.ready,c.close().catch(()=>{}),N=h}catch(x){h(x)}}}let g=V(_)?_.readable:_;f(g,()=>{if(N){let c=N;N=null,c()}})}if(P){if(Z(_))_.on("readable",function(){if(H){let g=H;H=null,g()}}),_.on("end",function(){j.push(null)}),j._read=function(){while(!0){let g=_.read();if(g===null){H=j._read;return}if(!j.push(g))return}};else if(B(_)){let g=(V(_)?_.readable:_).getReader();j._read=async function(){while(!0)try{let{value:c,done:h}=await g.read();if(!j.push(c))return;if(h){j.push(null);return}}catch{return}}}}return j._destroy=function(g,c){if(!g&&v!==null)g=new F;if(H=null,z=null,N=null,v===null)c(g);else if(v=c,Z(_))J(_,g)},j}}),hV=g0(($,q)=>{var Q=globalThis.AbortController||O6().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:J,ERR_MISSING_ARGS:Z,ERR_OUT_OF_RANGE:G},AbortError:W}=a0(),{validateAbortSignal:B,validateInteger:V,validateObject:U}=P6(),w=P0().Symbol("kWeak"),F=P0().Symbol("kResistStopPropagation"),{finished:M}=s2(),k=s9(),{addAbortSignalNoValidate:f}=H8(),{isWritable:L,isNodeStream:D}=b2(),{deprecate:z}=e0(),{ArrayPrototypePush:N,Boolean:H,MathFloor:v,Number:j,NumberIsNaN:n,Promise:d,PromiseReject:_,PromiseResolve:X,PromisePrototypeThen:P,Symbol:g}=P0(),c=g("kEmpty"),h=g("kEof");function x(O,E){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");if(D(O)&&!L(O))throw new K("stream",O,"must be writable");let a=k(this,O);if(E!==null&&E!==void 0&&E.signal)f(E.signal,a);return a}function l(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");let a=1;if((E===null||E===void 0?void 0:E.concurrency)!=null)a=v(E.concurrency);let K0=a-1;if((E===null||E===void 0?void 0:E.highWaterMark)!=null)K0=v(E.highWaterMark);return V(a,"options.concurrency",1),V(K0,"options.highWaterMark",0),K0+=a,async function*(){let R=e0().AbortSignalAny([E===null||E===void 0?void 0:E.signal].filter(H)),Y=this,C=[],u={signal:R},e,r,s=!1,T=0;function t(){s=!0,G0()}function G0(){T-=1,Q0()}function Q0(){if(r&&!s&&T=K0||T>=a))await new d((m0)=>{r=m0})}C.push(h)}catch(I0){let m0=_(I0);P(m0,G0,t),C.push(m0)}finally{if(s=!0,e)e(),e=null}}M0();try{while(!0){while(C.length>0){let I0=await C[0];if(I0===h)return;if(R.aborted)throw new W;if(I0!==c)yield I0;C.shift(),Q0()}await new d((I0)=>{e=I0})}}finally{if(s=!0,r)r(),r=null}}.call(this)}function $0(O=void 0){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");return async function*(){let E=0;for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W({cause:O.signal.reason});yield[E++,K0]}}.call(this)}async function Z0(O,E=void 0){for await(let a of y.call(this,O,E))return!0;return!1}async function F0(O,E=void 0){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);return!await Z0.call(this,async(...a)=>{return!await O(...a)},E)}async function p(O,E){for await(let a of y.call(this,O,E))return a;return}async function W0(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){return await O(K0,R),c}for await(let K0 of l.call(this,a,E));}function y(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){if(await O(K0,R))return K0;return c}return l.call(this,a,E)}class i extends Z{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function U0(O,E,a){var K0;if(typeof O!=="function")throw new J("reducer",["Function","AsyncFunction"],O);if(a!=null)U(a,"options");if((a===null||a===void 0?void 0:a.signal)!=null)B(a.signal,"options.signal");let R=arguments.length>1;if(a!==null&&a!==void 0&&(K0=a.signal)!==null&&K0!==void 0&&K0.aborted){let r=new W(void 0,{cause:a.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(r)),r}let Y=new Q,C=Y.signal;if(a!==null&&a!==void 0&&a.signal){let r={once:!0,[w]:this,[F]:!0};a.signal.addEventListener("abort",()=>Y.abort(),r)}let u=!1;try{for await(let r of this){var e;if(u=!0,a!==null&&a!==void 0&&(e=a.signal)!==null&&e!==void 0&&e.aborted)throw new W;if(!R)E=r,R=!0;else E=await O(E,r,{signal:C})}if(!u&&!R)throw new i}finally{Y.abort()}return E}async function m(O){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");let E=[];for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W(void 0,{cause:O.signal.reason});N(E,K0)}return E}function V0(O,E){let a=l.call(this,O,E);return async function*(){for await(let K0 of a)yield*K0}.call(this)}function w0(O){if(O=j(O),n(O))return 0;if(O<0)throw new G("number",">= 0",O);return O}function S(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O--<=0)yield R}}.call(this)}function b(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O-- >0)yield R;if(O<=0)return}}.call(this)}q.exports.streamReturningOperators={asIndexedPairs:z($0,"readable.asIndexedPairs will be removed in a future version."),drop:S,filter:y,flatMap:V0,map:l,take:b,compose:x},q.exports.promiseReturningOperators={every:F0,forEach:W0,reduce:U0,toArray:m,some:Z0,find:p}}),t9=g0(($,q)=>{var{ArrayPrototypePop:Q,Promise:K}=P0(),{isIterable:J,isNodeStream:Z,isWebStream:G}=b2(),{pipelineImpl:W}=d5(),{finished:B}=s2();e9();function V(...U){return new K((w,F)=>{let M,k,f=U[U.length-1];if(f&&typeof f==="object"&&!Z(f)&&!J(f)&&!G(f)){let L=Q(U);M=L.signal,k=L.end}W(U,(L,D)=>{if(L)F(L);else w(D)},{signal:M,end:k})})}q.exports={finished:B,pipeline:V}}),e9=g0(($,q)=>{var{Buffer:Q}=(t0(),X0(K2)),{ObjectDefineProperty:K,ObjectKeys:J,ReflectApply:Z}=P0(),{promisify:{custom:G}}=e0(),{streamReturningOperators:W,promiseReturningOperators:B}=hV(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:V}}=a0(),U=s9(),{setDefaultHighWaterMark:w,getDefaultHighWaterMark:F}=v8(),{pipeline:M}=d5(),{destroyer:k}=o1(),f=s2(),L=t9(),D=b2(),z=q.exports=b5().Stream;z.isDestroyed=D.isDestroyed,z.isDisturbed=D.isDisturbed,z.isErrored=D.isErrored,z.isReadable=D.isReadable,z.isWritable=D.isWritable,z.Readable=f8();for(let H of J(W)){let v=function(...n){if(new.target)throw V();return z.Readable.from(Z(j,this,n))},j=W[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(let H of J(B)){let v=function(...n){if(new.target)throw V();return Z(j,this,n)},j=B[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}z.Writable=n5(),z.Duplex=c2(),z.Transform=l9(),z.PassThrough=r9(),z.pipeline=M;var{addAbortSignal:N}=H8();z.addAbortSignal=N,z.finished=f,z.destroy=k,z.compose=U,z.setDefaultHighWaterMark=w,z.getDefaultHighWaterMark=F,K(z,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return L}}),K(M,G,{__proto__:null,enumerable:!0,get(){return L.pipeline}}),K(f,G,{__proto__:null,enumerable:!0,get(){return L.finished}}),z.Stream=z,z._isUint8Array=function(H){return H instanceof Uint8Array},z._uint8ArrayToBuffer=function(H){return Q.from(H.buffer,H.byteOffset,H.byteLength)}}),xV=g0(($,q)=>{var Q=a1();{let K=e9(),J=t9(),Z=K.Readable.destroy;q.exports=K.Readable,q.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,q.exports._isUint8Array=K._isUint8Array,q.exports.isDisturbed=K.isDisturbed,q.exports.isErrored=K.isErrored,q.exports.isReadable=K.isReadable,q.exports.Readable=K.Readable,q.exports.Writable=K.Writable,q.exports.Duplex=K.Duplex,q.exports.Transform=K.Transform,q.exports.PassThrough=K.PassThrough,q.exports.addAbortSignal=K.addAbortSignal,q.exports.finished=K.finished,q.exports.destroy=K.destroy,q.exports.destroy=Z,q.exports.pipeline=K.pipeline,q.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return J}}),q.exports.Stream=K.Stream}q.exports.default=q.exports});$$.exports=xV()});var m5=N0((Dz,Q$)=>{Q$.exports=a1()});var n2=N0((J2)=>{J2.base64=!0;J2.array=!0;J2.string=!0;J2.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";J2.nodebuffer=typeof Buffer<"u";J2.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")J2.blob=!1;else{R8=new ArrayBuffer(0);try{J2.blob=new Blob([R8],{type:"application/zip"}).size===0}catch($){try{p5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,I8=new p5,I8.append(R8),J2.blob=I8.getBlob("application/zip").size===0}catch(q){J2.blob=!1}}}var R8,p5,I8;try{J2.nodestream=!!m5().Readable}catch($){J2.nodestream=!1}});var o5=N0((i5)=>{var OV=T0(),PV=n2(),A2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i5.encode=function($){var q=[],Q,K,J,Z,G,W,B,V=0,U=$.length,w=U,F=OV.getTypeOf($)!=="string";while(V<$.length){if(w=U-V,!F)Q=$.charCodeAt(V++),K=V>2,G=(Q&3)<<4|K>>4,W=w>1?(K&15)<<2|J>>6:64,B=w>2?J&63:64,q.push(A2.charAt(Z)+A2.charAt(G)+A2.charAt(W)+A2.charAt(B))}return q.join("")};i5.decode=function($){var q,Q,K,J,Z,G,W,B=0,V=0,U="data:";if($.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var w=$.length*3/4;if($.charAt($.length-1)===A2.charAt(64))w--;if($.charAt($.length-2)===A2.charAt(64))w--;if(w%1!==0)throw Error("Invalid base64 input, bad content length.");var F;if(PV.uint8array)F=new Uint8Array(w|0);else F=Array(w|0);while(B<$.length){if(J=A2.indexOf($.charAt(B++)),Z=A2.indexOf($.charAt(B++)),G=A2.indexOf($.charAt(B++)),W=A2.indexOf($.charAt(B++)),q=J<<2|Z>>4,Q=(Z&15)<<4|G>>2,K=(G&3)<<6|W,F[V++]=q,G!==64)F[V++]=Q;if(W!==64)F[V++]=K}return F}});var T6=N0((vz,q$)=>{q$.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var q=new Buffer($);return q.fill(0),q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var V$=N0((fz,J$)=>{var K$=global.MutationObserver||global.WebKitMutationObserver,u6;if(K$)j8=0,a5=new K$(C8),g8=global.document.createTextNode(""),a5.observe(g8,{characterData:!0}),u6=function(){g8.data=j8=++j8%2};else if(!global.setImmediate&&typeof global.MessageChannel<"u")A8=new global.MessageChannel,A8.port1.onmessage=C8,u6=function(){A8.port2.postMessage(0)};else if("document"in global&&"onreadystatechange"in global.document.createElement("script"))u6=function(){var $=global.document.createElement("script");$.onreadystatechange=function(){C8(),$.onreadystatechange=null,$.parentNode.removeChild($),$=null},global.document.documentElement.appendChild($)};else u6=function(){setTimeout(C8,0)};var j8,a5,g8,A8,l5,S6=[];function C8(){l5=!0;var $,q,Q=S6.length;while(Q){q=S6,S6=[],$=-1;while(++${var uV=V$();function l1(){}var o0={},U$=["REJECTED"],r5=["FULFILLED"],Z$=["PENDING"];B$.exports=t2;function t2($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Z$,this.queue=[],this.outcome=void 0,$!==l1)G$(this,$)}t2.prototype.finally=function($){if(typeof $!=="function")return this;var q=this.constructor;return this.then(Q,K);function Q(J){function Z(){return J}return q.resolve($()).then(Z)}function K(J){function Z(){throw J}return q.resolve($()).then(Z)}};t2.prototype.catch=function($){return this.then(null,$)};t2.prototype.then=function($,q){if(typeof $!=="function"&&this.state===r5||typeof q!=="function"&&this.state===U$)return this;var Q=new this.constructor(l1);if(this.state!==Z$){var K=this.state===r5?$:q;s5(Q,K,this.outcome)}else this.queue.push(new E6(Q,$,q));return Q};function E6($,q,Q){if(this.promise=$,typeof q==="function")this.onFulfilled=q,this.callFulfilled=this.otherCallFulfilled;if(typeof Q==="function")this.onRejected=Q,this.callRejected=this.otherCallRejected}E6.prototype.callFulfilled=function($){o0.resolve(this.promise,$)};E6.prototype.otherCallFulfilled=function($){s5(this.promise,this.onFulfilled,$)};E6.prototype.callRejected=function($){o0.reject(this.promise,$)};E6.prototype.otherCallRejected=function($){s5(this.promise,this.onRejected,$)};function s5($,q,Q){uV(function(){var K;try{K=q(Q)}catch(J){return o0.reject($,J)}if(K===$)o0.reject($,TypeError("Cannot resolve promise with itself"));else o0.resolve($,K)})}o0.resolve=function($,q){var Q=W$(SV,q);if(Q.status==="error")return o0.reject($,Q.value);var K=Q.value;if(K)G$($,K);else{$.state=r5,$.outcome=q;var J=-1,Z=$.queue.length;while(++J{var t5=null;if(typeof Promise<"u")t5=Promise;else t5=z$();F$.exports={Promise:t5}});var w$=N0((M$)=>{(function($,q){if($.setImmediate)return;var Q=1,K={},J=!1,Z=$.document,G;function W(z){if(typeof z!=="function")z=Function(""+z);var N=Array(arguments.length-1);for(var H=0;H"u"?typeof global>"u"?M$:global:self)});var T0=N0((_0)=>{var e2=n2(),nV=o5(),s1=T6(),e5=r1();w$();function dV($){var q=null;if(e2.uint8array)q=new Uint8Array($.length);else q=Array($.length);return y8($,q)}_0.newBlob=function($,q){_0.checkSupport("blob");try{return new Blob([$],{type:q})}catch(J){try{var Q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,K=new Q;return K.append($),K.getBlob(q)}catch(Z){throw Error("Bug : can't construct the Blob.")}}};function _6($){return $}function y8($,q){for(var Q=0;Q<$.length;++Q)q[Q]=$.charCodeAt(Q)&255;return q}var X8={stringifyByChunk:function($,q,Q){var K=[],J=0,Z=$.length;if(Z<=Q)return String.fromCharCode.apply(null,$);while(J1)try{return X8.stringifyByChunk($,Q,q)}catch(J){q=Math.floor(q/2)}return X8.stringifyByChar($)}_0.applyFromCharCode=c6;function h8($,q){for(var Q=0;Q<$.length;Q++)q[Q]=$[Q];return q}var $1={};$1.string={string:_6,array:function($){return y8($,Array($.length))},arraybuffer:function($){return $1.string.uint8array($).buffer},uint8array:function($){return y8($,new Uint8Array($.length))},nodebuffer:function($){return y8($,s1.allocBuffer($.length))}};$1.array={string:c6,array:_6,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom($)}};$1.arraybuffer={string:function($){return c6(new Uint8Array($))},array:function($){return h8(new Uint8Array($),Array($.byteLength))},arraybuffer:_6,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom(new Uint8Array($))}};$1.uint8array={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:_6,nodebuffer:function($){return s1.newBufferFrom($)}};$1.nodebuffer={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $1.nodebuffer.uint8array($).buffer},uint8array:function($){return h8($,new Uint8Array($.length))},nodebuffer:_6};_0.transformTo=function($,q){if(!q)q="";if(!$)return q;_0.checkSupport($);var Q=_0.getTypeOf(q),K=$1[Q][$](q);return K};_0.resolve=function($){var q=$.split("/"),Q=[];for(var K=0;K"u")$[Q]=arguments[q][Q];return $};_0.prepareContent=function($,q,Q,K,J){var Z=e5.Promise.resolve(q).then(function(G){var W=e2.blob&&(G instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(G))!==-1);if(W&&typeof FileReader<"u")return new e5.Promise(function(B,V){var U=new FileReader;U.onload=function(w){B(w.target.result)},U.onerror=function(w){V(w.target.error)},U.readAsArrayBuffer(G)});else return G});return Z.then(function(G){var W=_0.getTypeOf(G);if(!W)return e5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(W==="arraybuffer")G=_0.transformTo("uint8array",G);else if(W==="string"){if(J)G=nV.decode(G);else if(Q){if(K!==!0)G=dV(G)}}return G})}});var V2=N0((gz,Y$)=>{function N$($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}N$.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,q){return this._listeners[$].push(q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,q){if(this._listeners[$])for(var Q=0;Q "+$;else return $}};Y$.exports=N$});var e1=N0((Q1)=>{var t1=T0(),L1=n2(),mV=T6(),x8=V2(),b6=Array(256);for(X2=0;X2<256;X2++)b6[X2]=X2>=252?6:X2>=248?5:X2>=240?4:X2>=224?3:X2>=192?2:1;var X2;b6[254]=b6[254]=1;var pV=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q},iV=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+b6[$[Q]]>q?Q:q},oV=function($){var q,Q,K,J,Z=$.length,G=Array(Z*2);for(Q=0,q=0;q4){G[Q++]=65533,q+=J-1;continue}K&=J===2?31:J===3?15:7;while(J>1&&q1){G[Q++]=65533;continue}if(K<65536)G[Q++]=K;else K-=65536,G[Q++]=55296|K>>10&1023,G[Q++]=56320|K&1023}if(G.length!==Q)if(G.subarray)G=G.subarray(0,Q);else G.length=Q;return t1.applyFromCharCode(G)};Q1.utf8encode=function(q){if(L1.nodebuffer)return mV.newBufferFrom(q,"utf-8");return pV(q)};Q1.utf8decode=function(q){if(L1.nodebuffer)return t1.transformTo("nodebuffer",q).toString("utf-8");return q=t1.transformTo(L1.uint8array?"uint8array":"array",q),oV(q)};function O8(){x8.call(this,"utf-8 decode"),this.leftOver=null}t1.inherits(O8,x8);O8.prototype.processChunk=function($){var q=t1.transformTo(L1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(L1.uint8array){var Q=q;q=new Uint8Array(Q.length+this.leftOver.length),q.set(this.leftOver,0),q.set(Q,this.leftOver.length)}else q=this.leftOver.concat(q);this.leftOver=null}var K=iV(q),J=q;if(K!==q.length)if(L1.uint8array)J=q.subarray(0,K),this.leftOver=q.subarray(K,q.length);else J=q.slice(0,K),this.leftOver=q.slice(K,q.length);this.push({data:Q1.utf8decode(J),meta:$.meta})};O8.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:Q1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};Q1.Utf8DecodeWorker=O8;function $4(){x8.call(this,"utf-8 encode")}t1.inherits($4,x8);$4.prototype.processChunk=function($){this.push({data:Q1.utf8encode($.data),meta:$.meta})};Q1.Utf8EncodeWorker=$4});var H$=N0((Xz,L$)=>{var k$=V2(),D$=T0();function Q4($){k$.call(this,"ConvertWorker to "+$),this.destType=$}D$.inherits(Q4,k$);Q4.prototype.processChunk=function($){this.push({data:D$.transformTo(this.destType,$.data),meta:$.meta})};L$.exports=Q4});var R$=N0((yz,f$)=>{var v$=m5().Readable,aV=T0();aV.inherits(q4,v$);function q4($,q,Q){v$.call(this,q),this._helper=$;var K=this;$.on("data",function(J,Z){if(!K.push(J))K._helper.pause();if(Q)Q(Z)}).on("error",function(J){K.emit("error",J)}).on("end",function(){K.push(null)})}q4.prototype._read=function(){this._helper.resume()};f$.exports=q4});var K4=N0((hz,j$)=>{var H1=T0(),lV=H$(),rV=V2(),sV=o5(),tV=n2(),eV=r1(),I$=null;if(tV.nodestream)try{I$=R$()}catch($){}function $U($,q,Q){switch($){case"blob":return H1.newBlob(H1.transformTo("arraybuffer",q),Q);case"base64":return sV.encode(q);default:return H1.transformTo($,q)}}function QU($,q){var Q,K=0,J=null,Z=0;for(Q=0;Q{D2.base64=!1;D2.binary=!1;D2.dir=!1;D2.createFolders=!0;D2.date=null;D2.compression=null;D2.compressionOptions=null;D2.comment=null;D2.unixPermissions=null;D2.dosPermissions=null});var V4=N0((Oz,g$)=>{var P8=T0(),T8=V2(),KU=16384;function $6($){T8.call(this,"DataWorker");var q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(Q){if(q.dataIsReady=!0,q.data=Q,q.max=Q&&Q.length||0,q.type=P8.getTypeOf(Q),!q.isPaused)q._tickAndRepeat()},function(Q){q.error(Q)})}P8.inherits($6,T8);$6.prototype.cleanUp=function(){T8.prototype.cleanUp.call(this),this.data=null};$6.prototype.resume=function(){if(!T8.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,P8.delay(this._tickAndRepeat,[],this);return!0};$6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)P8.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};$6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=KU,q=null,Q=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":q=this.data.substring(this.index,Q);break;case"uint8array":q=this.data.subarray(this.index,Q);break;case"array":case"nodebuffer":q=this.data.slice(this.index,Q);break}return this.index=Q,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})}};g$.exports=$6});var u8=N0((Pz,X$)=>{var JU=T0();function VU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var A$=VU();function UU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}function ZU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q.charCodeAt(G))&255];return $^-1}X$.exports=function(q,Q){if(typeof q>"u"||!q.length)return 0;var K=JU.getTypeOf(q)!=="string";if(K)return UU(Q|0,q,q.length,0);else return ZU(Q|0,q,q.length,0)}});var Z4=N0((Tz,h$)=>{var y$=V2(),GU=u8(),WU=T0();function U4(){y$.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}WU.inherits(U4,y$);U4.prototype.processChunk=function($){this.streamInfo.crc32=GU($.data,this.streamInfo.crc32||0),this.push($)};h$.exports=U4});var O$=N0((uz,x$)=>{var BU=T0(),G4=V2();function W4($){G4.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}BU.inherits(W4,G4);W4.prototype.processChunk=function($){if($){var q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=q+$.data.length}G4.prototype.processChunk.call(this,$)};x$.exports=W4});var S8=N0((Sz,u$)=>{var P$=r1(),T$=V4(),zU=Z4(),B4=O$();function z4($,q,Q,K,J){this.compressedSize=$,this.uncompressedSize=q,this.crc32=Q,this.compression=K,this.compressedContent=J}z4.prototype={getContentWorker:function(){var $=new T$(P$.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new B4("data_length")),q=this;return $.on("end",function(){if(this.streamInfo.data_length!==q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new T$(P$.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};z4.createWorkerFrom=function($,q,Q){return $.pipe(new zU).pipe(new B4("uncompressedSize")).pipe(q.compressWorker(Q)).pipe(new B4("compressedSize")).withStreamInfo("compression",q)};u$.exports=z4});var c$=N0((Ez,_$)=>{var FU=K4(),MU=V4(),F4=e1(),M4=S8(),S$=V2(),w4=function($,q,Q){this.name=$,this.dir=Q.dir,this.date=Q.date,this.comment=Q.comment,this.unixPermissions=Q.unixPermissions,this.dosPermissions=Q.dosPermissions,this._data=q,this._dataBinary=Q.binary,this.options={compression:Q.compression,compressionOptions:Q.compressionOptions}};w4.prototype={internalStream:function($){var q=null,Q="string";try{if(!$)throw Error("No output type specified.");Q=$.toLowerCase();var K=Q==="string"||Q==="text";if(Q==="binarystring"||Q==="text")Q="string";q=this._decompressWorker();var J=!this._dataBinary;if(J&&!K)q=q.pipe(new F4.Utf8EncodeWorker);if(!J&&K)q=q.pipe(new F4.Utf8DecodeWorker)}catch(Z){q=new S$("error"),q.error(Z)}return new FU(q,Q,"")},async:function($,q){return this.internalStream($).accumulate(q)},nodeStream:function($,q){return this.internalStream($||"nodebuffer").toNodejsStream(q)},_compressWorker:function($,q){if(this._data instanceof M4&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var Q=this._decompressWorker();if(!this._dataBinary)Q=Q.pipe(new F4.Utf8EncodeWorker);return M4.createWorkerFrom(Q,$,q)}},_decompressWorker:function(){if(this._data instanceof M4)return this._data.getContentWorker();else if(this._data instanceof S$)return this._data;else return new MU(this._data)}};var E$=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],wU=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(n6=0;n6{var NU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function YU($,q){return Object.prototype.hasOwnProperty.call($,q)}l0.assign=function($){var q=Array.prototype.slice.call(arguments,1);while(q.length){var Q=q.shift();if(!Q)continue;if(typeof Q!=="object")throw TypeError(Q+"must be non-object");for(var K in Q)if(YU(Q,K))$[K]=Q[K]}return $};l0.shrinkBuf=function($,q){if($.length===q)return $;if($.subarray)return $.subarray(0,q);return $.length=q,$};var kU={arraySet:function($,q,Q,K,J){if(q.subarray&&$.subarray){$.set(q.subarray(Q,Q+K),J);return}for(var Z=0;Z{var LU=d2(),HU=4,b$=0,n$=1,vU=2;function q6($){var q=$.length;while(--q>=0)$[q]=0}var fU=0,a$=1,RU=2,IU=3,CU=258,v4=29,a6=256,m6=a6+1+v4,Q6=30,f4=19,l$=2*m6+1,v1=15,N4=16,jU=7,R4=256,r$=16,s$=17,t$=18,L4=[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],E8=[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],gU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],AU=512,m2=Array((m6+2)*2);q6(m2);var d6=Array(Q6*2);q6(d6);var p6=Array(AU);q6(p6);var i6=Array(CU-IU+1);q6(i6);var I4=Array(v4);q6(I4);var _8=Array(Q6);q6(_8);function Y4($,q,Q,K,J){this.static_tree=$,this.extra_bits=q,this.extra_base=Q,this.elems=K,this.max_length=J,this.has_stree=$&&$.length}var $Q,QQ,qQ;function k4($,q){this.dyn_tree=$,this.max_code=0,this.stat_desc=q}function KQ($){return $<256?p6[$]:p6[256+($>>>7)]}function o6($,q){$.pending_buf[$.pending++]=q&255,$.pending_buf[$.pending++]=q>>>8&255}function $2($,q,Q){if($.bi_valid>N4-Q)$.bi_buf|=q<<$.bi_valid&65535,o6($,$.bi_buf),$.bi_buf=q>>N4-$.bi_valid,$.bi_valid+=Q-N4;else $.bi_buf|=q<<$.bi_valid&65535,$.bi_valid+=Q}function y2($,q,Q){$2($,Q[q*2],Q[q*2+1])}function JQ($,q){var Q=0;do Q|=$&1,$>>>=1,Q<<=1;while(--q>0);return Q>>>1}function XU($){if($.bi_valid===16)o6($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function yU($,q){var{dyn_tree:Q,max_code:K}=q,J=q.stat_desc.static_tree,Z=q.stat_desc.has_stree,G=q.stat_desc.extra_bits,W=q.stat_desc.extra_base,B=q.stat_desc.max_length,V,U,w,F,M,k,f=0;for(F=0;F<=v1;F++)$.bl_count[F]=0;Q[$.heap[$.heap_max]*2+1]=0;for(V=$.heap_max+1;VB)F=B,f++;if(Q[U*2+1]=F,U>K)continue;if($.bl_count[F]++,M=0,U>=W)M=G[U-W];if(k=Q[U*2],$.opt_len+=k*(F+M),Z)$.static_len+=k*(J[U*2+1]+M)}if(f===0)return;do{F=B-1;while($.bl_count[F]===0)F--;$.bl_count[F]--,$.bl_count[F+1]+=2,$.bl_count[B]--,f-=2}while(f>0);for(F=B;F!==0;F--){U=$.bl_count[F];while(U!==0){if(w=$.heap[--V],w>K)continue;if(Q[w*2+1]!==F)$.opt_len+=(F-Q[w*2+1])*Q[w*2],Q[w*2+1]=F;U--}}}function VQ($,q,Q){var K=Array(v1+1),J=0,Z,G;for(Z=1;Z<=v1;Z++)K[Z]=J=J+Q[Z-1]<<1;for(G=0;G<=q;G++){var W=$[G*2+1];if(W===0)continue;$[G*2]=JQ(K[W]++,W)}}function hU(){var $,q,Q,K,J,Z=Array(v1+1);Q=0;for(K=0;K>=7;for(;K8)o6($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function xU($,q,Q,K){if(ZQ($),K)o6($,Q),o6($,~Q);LU.arraySet($.pending_buf,$.window,q,Q,$.pending),$.pending+=Q}function d$($,q,Q,K){var J=q*2,Z=Q*2;return $[J]<$[Z]||$[J]===$[Z]&&K[q]<=K[Q]}function D4($,q,Q){var K=$.heap[Q],J=Q<<1;while(J<=$.heap_len){if(J<$.heap_len&&d$(q,$.heap[J+1],$.heap[J],$.depth))J++;if(d$(q,K,$.heap[J],$.depth))break;$.heap[Q]=$.heap[J],Q=J,J<<=1}$.heap[Q]=K}function m$($,q,Q){var K,J,Z=0,G,W;if($.last_lit!==0)do if(K=$.pending_buf[$.d_buf+Z*2]<<8|$.pending_buf[$.d_buf+Z*2+1],J=$.pending_buf[$.l_buf+Z],Z++,K===0)y2($,J,q);else{if(G=i6[J],y2($,G+a6+1,q),W=L4[G],W!==0)J-=I4[G],$2($,J,W);if(K--,G=KQ(K),y2($,G,Q),W=E8[G],W!==0)K-=_8[G],$2($,K,W)}while(Z<$.last_lit);y2($,R4,q)}function H4($,q){var Q=q.dyn_tree,K=q.stat_desc.static_tree,J=q.stat_desc.has_stree,Z=q.stat_desc.elems,G,W,B=-1,V;$.heap_len=0,$.heap_max=l$;for(G=0;G>1;G>=1;G--)D4($,Q,G);V=Z;do G=$.heap[1],$.heap[1]=$.heap[$.heap_len--],D4($,Q,1),W=$.heap[1],$.heap[--$.heap_max]=G,$.heap[--$.heap_max]=W,Q[V*2]=Q[G*2]+Q[W*2],$.depth[V]=($.depth[G]>=$.depth[W]?$.depth[G]:$.depth[W])+1,Q[G*2+1]=Q[W*2+1]=V,$.heap[1]=V++,D4($,Q,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],yU($,q),VQ(Q,B,$.bl_count)}function p$($,q,Q){var K,J=-1,Z,G=q[1],W=0,B=7,V=4;if(G===0)B=138,V=3;q[(Q+1)*2+1]=65535;for(K=0;K<=Q;K++){if(Z=G,G=q[(K+1)*2+1],++W=3;q--)if($.bl_tree[e$[q]*2+1]!==0)break;return $.opt_len+=3*(q+1)+5+5+4,q}function PU($,q,Q,K){var J;$2($,q-257,5),$2($,Q-1,5),$2($,K-4,4);for(J=0;J>>=1)if(q&1&&$.dyn_ltree[Q*2]!==0)return b$;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return n$;for(Q=32;Q0){if($.strm.data_type===vU)$.strm.data_type=TU($);if(H4($,$.l_desc),H4($,$.d_desc),G=OU($),J=$.opt_len+3+7>>>3,Z=$.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=Q+5;if(Q+4<=J&&q!==-1)GQ($,q,Q,K);else if($.strategy===HU||Z===J)$2($,(a$<<1)+(K?1:0),3),m$($,m2,d6);else $2($,(RU<<1)+(K?1:0),3),PU($,$.l_desc.max_code+1,$.d_desc.max_code+1,G+1),m$($,$.dyn_ltree,$.dyn_dtree);if(UQ($),K)ZQ($)}function _U($,q,Q){if($.pending_buf[$.d_buf+$.last_lit*2]=q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=q&255,$.pending_buf[$.l_buf+$.last_lit]=Q&255,$.last_lit++,q===0)$.dyn_ltree[Q*2]++;else $.matches++,q--,$.dyn_ltree[(i6[Q]+a6+1)*2]++,$.dyn_dtree[KQ(q)*2]++;return $.last_lit===$.lit_bufsize-1}K6._tr_init=uU;K6._tr_stored_block=GQ;K6._tr_flush_block=EU;K6._tr_tally=_U;K6._tr_align=SU});var C4=N0((bz,BQ)=>{function cU($,q,Q,K){var J=$&65535|0,Z=$>>>16&65535|0,G=0;while(Q!==0){G=Q>2000?2000:Q,Q-=G;do J=J+q[K++]|0,Z=Z+J|0;while(--G);J%=65521,Z%=65521}return J|Z<<16|0}BQ.exports=cU});var j4=N0((nz,zQ)=>{function bU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var nU=bU();function dU($,q,Q,K){var J=nU,Z=K+Q;$^=-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}zQ.exports=dU});var c8=N0((dz,FQ)=>{FQ.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var vQ=N0((O2)=>{var r0=d2(),M2=WQ(),YQ=C4(),q1=j4(),mU=c8(),C1=0,pU=1,iU=3,Z1=4,MQ=5,x2=0,wQ=1,w2=-2,oU=-3,g4=-5,aU=-1,lU=1,b8=2,rU=3,sU=4,tU=0,eU=2,p8=8,$Z=9,QZ=15,qZ=8,KZ=29,JZ=256,X4=JZ+1+KZ,VZ=30,UZ=19,ZZ=2*X4+1,GZ=15,f0=3,V1=258,L2=V1+f0+1,WZ=32,i8=42,y4=69,n8=73,d8=91,m8=103,f1=113,r6=666,c0=1,s6=2,R1=3,U6=4,BZ=3;function U1($,q){return $.msg=mU[q],q}function NQ($){return($<<1)-($>4?9:0)}function J1($){var q=$.length;while(--q>=0)$[q]=0}function K1($){var q=$.state,Q=q.pending;if(Q>$.avail_out)Q=$.avail_out;if(Q===0)return;if(r0.arraySet($.output,q.pending_buf,q.pending_out,Q,$.next_out),$.next_out+=Q,q.pending_out+=Q,$.total_out+=Q,$.avail_out-=Q,q.pending-=Q,q.pending===0)q.pending_out=0}function d0($,q){M2._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,q),$.block_start=$.strstart,K1($.strm)}function C0($,q){$.pending_buf[$.pending++]=q}function l6($,q){$.pending_buf[$.pending++]=q>>>8&255,$.pending_buf[$.pending++]=q&255}function zZ($,q,Q,K){var J=$.avail_in;if(J>K)J=K;if(J===0)return 0;if($.avail_in-=J,r0.arraySet(q,$.input,$.next_in,J,Q),$.state.wrap===1)$.adler=YQ($.adler,q,J,Q);else if($.state.wrap===2)$.adler=q1($.adler,q,J,Q);return $.next_in+=J,$.total_in+=J,J}function kQ($,q){var{max_chain_length:Q,strstart:K}=$,J,Z,G=$.prev_length,W=$.nice_match,B=$.strstart>$.w_size-L2?$.strstart-($.w_size-L2):0,V=$.window,U=$.w_mask,w=$.prev,F=$.strstart+V1,M=V[K+G-1],k=V[K+G];if($.prev_length>=$.good_match)Q>>=2;if(W>$.lookahead)W=$.lookahead;do{if(J=q,V[J+G]!==k||V[J+G-1]!==M||V[J]!==V[K]||V[++J]!==V[K+1])continue;K+=2,J++;do;while(V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&KG){if($.match_start=q,G=Z,Z>=W)break;M=V[K+G-1],k=V[K+G]}}while((q=w[q&U])>B&&--Q!==0);if(G<=$.lookahead)return G;return $.lookahead}function I1($){var q=$.w_size,Q,K,J,Z,G;do{if(Z=$.window_size-$.lookahead-$.strstart,$.strstart>=q+(q-L2)){r0.arraySet($.window,$.window,q,q,0),$.match_start-=q,$.strstart-=q,$.block_start-=q,K=$.hash_size,Q=K;do J=$.head[--Q],$.head[Q]=J>=q?J-q:0;while(--K);K=q,Q=K;do J=$.prev[--Q],$.prev[Q]=J>=q?J-q:0;while(--K);Z+=q}if($.strm.avail_in===0)break;if(K=zZ($.strm,$.window,$.strstart+$.lookahead,Z),$.lookahead+=K,$.lookahead+$.insert>=f0){G=$.strstart-$.insert,$.ins_h=$.window[G],$.ins_h=($.ins_h<<$.hash_shift^$.window[G+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[G+f0-1])&$.hash_mask,$.prev[G&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=G,G++,$.insert--,$.lookahead+$.insert$.pending_buf_size-5)Q=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(I1($),$.lookahead===0&&q===C1)return c0;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var K=$.block_start+Q;if($.strstart===0||$.strstart>=K){if($.lookahead=$.strstart-K,$.strstart=K,d0($,!1),$.strm.avail_out===0)return c0}if($.strstart-$.block_start>=$.w_size-L2){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.strstart>$.block_start){if(d0($,!1),$.strm.avail_out===0)return c0}return c0}function A4($,q){var Q,K;for(;;){if($.lookahead=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(Q!==0&&$.strstart-Q<=$.w_size-L2)$.match_length=kQ($,Q);if($.match_length>=f0)if(K=M2._tr_tally($,$.strstart-$.match_start,$.match_length-f0),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=f0){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else K=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(K){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=$.strstart=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=f0-1,Q!==0&&$.prev_length<$.max_lazy_match&&$.strstart-Q<=$.w_size-L2){if($.match_length=kQ($,Q),$.match_length<=5&&($.strategy===lU||$.match_length===f0&&$.strstart-$.match_start>4096))$.match_length=f0-1}if($.prev_length>=f0&&$.match_length<=$.prev_length){J=$.strstart+$.lookahead-f0,K=M2._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-f0),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=J)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=f0-1,$.strstart++,K){if(d0($,!1),$.strm.avail_out===0)return c0}}else if($.match_available){if(K=M2._tr_tally($,0,$.window[$.strstart-1]),K)d0($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return c0}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)K=M2._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart=f0&&$.strstart>0){if(J=$.strstart-1,K=G[J],K===G[++J]&&K===G[++J]&&K===G[++J]){Z=$.strstart+V1;do;while(K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&J$.lookahead)$.match_length=$.lookahead}}if($.match_length>=f0)Q=M2._tr_tally($,1,$.match_length-f0),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function wZ($,q){var Q;for(;;){if($.lookahead===0){if(I1($),$.lookahead===0){if(q===C1)return c0;break}}if($.match_length=0,Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function h2($,q,Q,K,J){this.good_length=$,this.max_lazy=q,this.nice_length=Q,this.max_chain=K,this.func=J}var V6;V6=[new h2(0,0,0,0,FZ),new h2(4,4,8,4,A4),new h2(4,5,16,8,A4),new h2(4,6,32,32,A4),new h2(4,4,16,16,J6),new h2(8,16,32,32,J6),new h2(8,16,128,128,J6),new h2(8,32,128,256,J6),new h2(32,128,258,1024,J6),new h2(32,258,258,4096,J6)];function NZ($){$.window_size=2*$.w_size,J1($.head),$.max_lazy_match=V6[$.level].max_lazy,$.good_match=V6[$.level].good_length,$.nice_match=V6[$.level].nice_length,$.max_chain_length=V6[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=f0-1,$.match_available=0,$.ins_h=0}function YZ(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=p8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r0.Buf16(ZZ*2),this.dyn_dtree=new r0.Buf16((2*VZ+1)*2),this.bl_tree=new r0.Buf16((2*UZ+1)*2),J1(this.dyn_ltree),J1(this.dyn_dtree),J1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r0.Buf16(GZ+1),this.heap=new r0.Buf16(2*X4+1),J1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r0.Buf16(2*X4+1),J1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function DQ($){var q;if(!$||!$.state)return U1($,w2);if($.total_in=$.total_out=0,$.data_type=eU,q=$.state,q.pending=0,q.pending_out=0,q.wrap<0)q.wrap=-q.wrap;return q.status=q.wrap?i8:f1,$.adler=q.wrap===2?0:1,q.last_flush=C1,M2._tr_init(q),x2}function LQ($){var q=DQ($);if(q===x2)NZ($.state);return q}function kZ($,q){if(!$||!$.state)return w2;if($.state.wrap!==2)return w2;return $.state.gzhead=q,x2}function HQ($,q,Q,K,J,Z){if(!$)return w2;var G=1;if(q===aU)q=6;if(K<0)G=0,K=-K;else if(K>15)G=2,K-=16;if(J<1||J>$Z||Q!==p8||K<8||K>15||q<0||q>9||Z<0||Z>sU)return U1($,w2);if(K===8)K=9;var W=new YZ;return $.state=W,W.strm=$,W.wrap=G,W.gzhead=null,W.w_bits=K,W.w_size=1<MQ||q<0)return $?U1($,w2):w2;if(K=$.state,!$.output||!$.input&&$.avail_in!==0||K.status===r6&&q!==Z1)return U1($,$.avail_out===0?g4:w2);if(K.strm=$,Q=K.last_flush,K.last_flush=q,K.status===i8)if(K.wrap===2)if($.adler=0,C0(K,31),C0(K,139),C0(K,8),!K.gzhead)C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,BZ),K.status=f1;else{if(C0(K,(K.gzhead.text?1:0)+(K.gzhead.hcrc?2:0)+(!K.gzhead.extra?0:4)+(!K.gzhead.name?0:8)+(!K.gzhead.comment?0:16)),C0(K,K.gzhead.time&255),C0(K,K.gzhead.time>>8&255),C0(K,K.gzhead.time>>16&255),C0(K,K.gzhead.time>>24&255),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)C0(K,K.gzhead.extra.length&255),C0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)$.adler=q1($.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=y4}else{var G=p8+(K.w_bits-8<<4)<<8,W=-1;if(K.strategy>=b8||K.level<2)W=0;else if(K.level<6)W=1;else if(K.level===6)W=2;else W=3;if(G|=W<<6,K.strstart!==0)G|=WZ;if(G+=31-G%31,K.status=f1,l6(K,G),K.strstart!==0)l6(K,$.adler>>>16),l6(K,$.adler&65535);$.adler=1}if(K.status===y4)if(K.gzhead.extra){J=K.pending;while(K.gzindex<(K.gzhead.extra.length&65535)){if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size)break}C0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=n8}else K.status=n8;if(K.status===n8)if(K.gzhead.name){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.gzindex=0,K.status=d8}else K.status=d8;if(K.status===d8)if(K.gzhead.comment){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.status=m8}else K.status=m8;if(K.status===m8)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)K1($);if(K.pending+2<=K.pending_buf_size)C0(K,$.adler&255),C0(K,$.adler>>8&255),$.adler=0,K.status=f1}else K.status=f1;if(K.pending!==0){if(K1($),$.avail_out===0)return K.last_flush=-1,x2}else if($.avail_in===0&&NQ(q)<=NQ(Q)&&q!==Z1)return U1($,g4);if(K.status===r6&&$.avail_in!==0)return U1($,g4);if($.avail_in!==0||K.lookahead!==0||q!==C1&&K.status!==r6){var B=K.strategy===b8?wZ(K,q):K.strategy===rU?MZ(K,q):V6[K.level].func(K,q);if(B===R1||B===U6)K.status=r6;if(B===c0||B===R1){if($.avail_out===0)K.last_flush=-1;return x2}if(B===s6){if(q===pU)M2._tr_align(K);else if(q!==MQ){if(M2._tr_stored_block(K,0,0,!1),q===iU){if(J1(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(K1($),$.avail_out===0)return K.last_flush=-1,x2}}if(q!==Z1)return x2;if(K.wrap<=0)return wQ;if(K.wrap===2)C0(K,$.adler&255),C0(K,$.adler>>8&255),C0(K,$.adler>>16&255),C0(K,$.adler>>24&255),C0(K,$.total_in&255),C0(K,$.total_in>>8&255),C0(K,$.total_in>>16&255),C0(K,$.total_in>>24&255);else l6(K,$.adler>>>16),l6(K,$.adler&65535);if(K1($),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?x2:wQ}function HZ($){var q;if(!$||!$.state)return w2;if(q=$.state.status,q!==i8&&q!==y4&&q!==n8&&q!==d8&&q!==m8&&q!==f1&&q!==r6)return U1($,w2);return $.state=null,q===f1?U1($,oU):x2}function vZ($,q){var Q=q.length,K,J,Z,G,W,B,V,U;if(!$||!$.state)return w2;if(K=$.state,G=K.wrap,G===2||G===1&&K.status!==i8||K.lookahead)return w2;if(G===1)$.adler=YQ($.adler,q,Q,0);if(K.wrap=0,Q>=K.w_size){if(G===0)J1(K.head),K.strstart=0,K.block_start=0,K.insert=0;U=new r0.Buf8(K.w_size),r0.arraySet(U,q,Q-K.w_size,K.w_size,0),q=U,Q=K.w_size}W=$.avail_in,B=$.next_in,V=$.input,$.avail_in=Q,$.next_in=0,$.input=q,I1(K);while(K.lookahead>=f0){J=K.strstart,Z=K.lookahead-(f0-1);do K.ins_h=(K.ins_h<{var o8=d2(),fQ=!0,RQ=!0;try{String.fromCharCode.apply(null,[0])}catch($){fQ=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){RQ=!1}var t6=new o8.Buf8(256);for(P2=0;P2<256;P2++)t6[P2]=P2>=252?6:P2>=248?5:P2>=240?4:P2>=224?3:P2>=192?2:1;var P2;t6[254]=t6[254]=1;Z6.string2buf=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q};function IQ($,q){if(q<65534){if($.subarray&&RQ||!$.subarray&&fQ)return String.fromCharCode.apply(null,o8.shrinkBuf($,q))}var Q="";for(var K=0;K4){W[K++]=65533,Q+=Z-1;continue}J&=Z===2?31:Z===3?15:7;while(Z>1&&Q1){W[K++]=65533;continue}if(J<65536)W[K++]=J;else J-=65536,W[K++]=55296|J>>10&1023,W[K++]=56320|J&1023}return IQ(W,K)};Z6.utf8border=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+t6[$[Q]]>q?Q:q}});var x4=N0((iz,CQ)=>{function fZ(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}CQ.exports=fZ});var XQ=N0((Q8)=>{var e6=vQ(),$8=d2(),P4=h4(),T4=c8(),RZ=x4(),AQ=Object.prototype.toString,IZ=0,O4=4,G6=0,jQ=1,gQ=2,CZ=-1,jZ=0,gZ=8;function j1($){if(!(this instanceof j1))return new j1($);this.options=$8.assign({level:CZ,method:gZ,chunkSize:16384,windowBits:15,memLevel:8,strategy:jZ,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>0)q.windowBits=-q.windowBits;else if(q.gzip&&q.windowBits>0&&q.windowBits<16)q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new RZ,this.strm.avail_out=0;var Q=e6.deflateInit2(this.strm,q.level,q.method,q.windowBits,q.memLevel,q.strategy);if(Q!==G6)throw Error(T4[Q]);if(q.header)e6.deflateSetHeader(this.strm,q.header);if(q.dictionary){var K;if(typeof q.dictionary==="string")K=P4.string2buf(q.dictionary);else if(AQ.call(q.dictionary)==="[object ArrayBuffer]")K=new Uint8Array(q.dictionary);else K=q.dictionary;if(Q=e6.deflateSetDictionary(this.strm,K),Q!==G6)throw Error(T4[Q]);this._dict_set=!0}}j1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J,Z;if(this.ended)return!1;if(Z=q===~~q?q:q===!0?O4:IZ,typeof $==="string")Q.input=P4.string2buf($);else if(AQ.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new $8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(J=e6.deflate(Q,Z),J!==jQ&&J!==G6)return this.onEnd(J),this.ended=!0,!1;if(Q.avail_out===0||Q.avail_in===0&&(Z===O4||Z===gQ))if(this.options.to==="string")this.onData(P4.buf2binstring($8.shrinkBuf(Q.output,Q.next_out)));else this.onData($8.shrinkBuf(Q.output,Q.next_out))}while((Q.avail_in>0||Q.avail_out===0)&&J!==jQ);if(Z===O4)return J=e6.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===G6;if(Z===gQ)return this.onEnd(G6),Q.avail_out=0,!0;return!0};j1.prototype.onData=function($){this.chunks.push($)};j1.prototype.onEnd=function($){if($===G6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=$8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function u4($,q){var Q=new j1(q);if(Q.push($,!0),Q.err)throw Q.msg||T4[Q.err];return Q.result}function AZ($,q){return q=q||{},q.raw=!0,u4($,q)}function XZ($,q){return q=q||{},q.gzip=!0,u4($,q)}Q8.Deflate=j1;Q8.deflate=u4;Q8.deflateRaw=AZ;Q8.gzip=XZ});var hQ=N0((az,yQ)=>{var a8=30,yZ=12;yQ.exports=function(q,Q){var K,J,Z,G,W,B,V,U,w,F,M,k,f,L,D,z,N,H,v,j,n,d,_,X,P;K=q.state,J=q.next_in,X=q.input,Z=J+(q.avail_in-5),G=q.next_out,P=q.output,W=G-(Q-q.avail_out),B=G+(q.avail_out-257),V=K.dmax,U=K.wsize,w=K.whave,F=K.wnext,M=K.window,k=K.hold,f=K.bits,L=K.lencode,D=K.distcode,z=(1<>>24,k>>>=v,f-=v,v=H>>>16&255,v===0)P[G++]=H&65535;else if(v&16){if(j=H&65535,v&=15,v){if(f>>=v,f-=v}if(f<15)k+=X[J++]<>>24,k>>>=v,f-=v,v=H>>>16&255,v&16){if(n=H&65535,v&=15,fV){q.msg="invalid distance too far back",K.mode=a8;break $}if(k>>>=v,f-=v,v=G-W,n>v){if(v=n-v,v>w){if(K.sane){q.msg="invalid distance too far back",K.mode=a8;break $}}if(d=0,_=M,F===0){if(d+=U-v,v2)P[G++]=_[d++],P[G++]=_[d++],P[G++]=_[d++],j-=3;if(j){if(P[G++]=_[d++],j>1)P[G++]=_[d++]}}else{d=G-n;do P[G++]=P[d++],P[G++]=P[d++],P[G++]=P[d++],j-=3;while(j>2);if(j){if(P[G++]=P[d++],j>1)P[G++]=P[d++]}}}else if((v&64)===0){H=D[(H&65535)+(k&(1<>3,J-=j,f-=j<<3,k&=(1<{var xQ=d2(),W6=15,OQ=852,PQ=592,TQ=0,S4=1,uQ=2,hZ=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],xZ=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],OZ=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],PZ=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];SQ.exports=function(q,Q,K,J,Z,G,W,B){var V=B.bits,U=0,w=0,F=0,M=0,k=0,f=0,L=0,D=0,z=0,N=0,H,v,j,n,d,_=null,X=0,P,g=new xQ.Buf16(W6+1),c=new xQ.Buf16(W6+1),h=null,x=0,l,$0,Z0;for(U=0;U<=W6;U++)g[U]=0;for(w=0;w=1;M--)if(g[M]!==0)break;if(k>M)k=M;if(M===0)return Z[G++]=20971520,Z[G++]=20971520,B.bits=1,0;for(F=1;F0&&(q===TQ||M!==1))return-1;c[1]=0;for(U=1;UOQ||q===uQ&&z>PQ)return 1;for(;;){if(l=U-L,W[w]P)$0=h[x+W[w]],Z0=_[X+W[w]];else $0=96,Z0=0;H=1<>L)+v]=l<<24|$0<<16|Z0|0;while(v!==0);H=1<>=1;if(H!==0)N&=H-1,N+=H;else N=0;if(w++,--g[U]===0){if(U===M)break;U=Q[K+W[w]]}if(U>k&&(N&n)!==j){if(L===0)L=k;d+=F,f=U-L,D=1<OQ||q===uQ&&z>PQ)return 1;j=N&n,Z[j]=k<<24|f<<16|d-G|0}}if(N!==0)Z[d+N]=U-L<<24|4194304|0;return B.bits=k,0}});var Lq=N0((H2)=>{var U2=d2(),d4=C4(),T2=j4(),TZ=hQ(),q8=EQ(),uZ=0,Bq=1,zq=2,_Q=4,SZ=5,l8=6,g1=0,EZ=1,_Z=2,N2=-2,Fq=-3,m4=-4,cZ=-5,cQ=8,Mq=1,bQ=2,nQ=3,dQ=4,mQ=5,pQ=6,iQ=7,oQ=8,aQ=9,lQ=10,t8=11,p2=12,E4=13,rQ=14,_4=15,sQ=16,tQ=17,eQ=18,$q=19,r8=20,s8=21,Qq=22,qq=23,Kq=24,Jq=25,Vq=26,c4=27,Uq=28,Zq=29,x0=30,p4=31,bZ=32,nZ=852,dZ=592,mZ=15,pZ=mZ;function Gq($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function iZ(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U2.Buf16(320),this.work=new U2.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function wq($){var q;if(!$||!$.state)return N2;if(q=$.state,$.total_in=$.total_out=q.total=0,$.msg="",q.wrap)$.adler=q.wrap&1;return q.mode=Mq,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new U2.Buf32(nZ),q.distcode=q.distdyn=new U2.Buf32(dZ),q.sane=1,q.back=-1,g1}function Nq($){var q;if(!$||!$.state)return N2;return q=$.state,q.wsize=0,q.whave=0,q.wnext=0,wq($)}function Yq($,q){var Q,K;if(!$||!$.state)return N2;if(K=$.state,q<0)Q=0,q=-q;else if(Q=(q>>4)+1,q<48)q&=15;if(q&&(q<8||q>15))return N2;if(K.window!==null&&K.wbits!==q)K.window=null;return K.wrap=Q,K.wbits=q,Nq($)}function kq($,q){var Q,K;if(!$)return N2;if(K=new iZ,$.state=K,K.window=null,Q=Yq($,q),Q!==g1)$.state=null;return Q}function oZ($){return kq($,pZ)}var Wq=!0,b4,n4;function aZ($){if(Wq){var q;b4=new U2.Buf32(512),n4=new U2.Buf32(32),q=0;while(q<144)$.lens[q++]=8;while(q<256)$.lens[q++]=9;while(q<280)$.lens[q++]=7;while(q<288)$.lens[q++]=8;q8(Bq,$.lens,0,288,b4,0,$.work,{bits:9}),q=0;while(q<32)$.lens[q++]=5;q8(zq,$.lens,0,32,n4,0,$.work,{bits:5}),Wq=!1}$.lencode=b4,$.lenbits=9,$.distcode=n4,$.distbits=5}function Dq($,q,Q,K){var J,Z=$.state;if(Z.window===null)Z.wsize=1<=Z.wsize)U2.arraySet(Z.window,q,Q-Z.wsize,Z.wsize,0),Z.wnext=0,Z.whave=Z.wsize;else{if(J=Z.wsize-Z.wnext,J>K)J=K;if(U2.arraySet(Z.window,q,Q-K,J,Z.wnext),K-=J,K)U2.arraySet(Z.window,q,Q-K,K,0),Z.wnext=K,Z.whave=Z.wsize;else{if(Z.wnext+=J,Z.wnext===Z.wsize)Z.wnext=0;if(Z.whave>>8&255,Q.check=T2(Q.check,_,2,0),V=0,U=0,Q.mode=bQ;break}if(Q.flags=0,Q.head)Q.head.done=!1;if(!(Q.wrap&1)||(((V&255)<<8)+(V>>8))%31){$.msg="incorrect header check",Q.mode=x0;break}if((V&15)!==cQ){$.msg="unknown compression method",Q.mode=x0;break}if(V>>>=4,U-=4,n=(V&15)+8,Q.wbits===0)Q.wbits=n;else if(n>Q.wbits){$.msg="invalid window size",Q.mode=x0;break}Q.dmax=1<>8&1;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=nQ;case nQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>8&255,_[2]=V>>>16&255,_[3]=V>>>24&255,Q.check=T2(Q.check,_,4,0);V=0,U=0,Q.mode=dQ;case dQ:while(U<16){if(W===0)break $;W--,V+=K[Z++]<>8;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=mQ;case mQ:if(Q.flags&1024){while(U<16){if(W===0)break $;W--,V+=K[Z++]<>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0}else if(Q.head)Q.head.extra=null;Q.mode=pQ;case pQ:if(Q.flags&1024){if(M=Q.length,M>W)M=W;if(M){if(Q.head){if(n=Q.head.extra_len-Q.length,!Q.head.extra)Q.head.extra=Array(Q.head.extra_len);U2.arraySet(Q.head.extra,K,Z,M,n)}if(Q.flags&512)Q.check=T2(Q.check,K,M,Z);W-=M,Z+=M,Q.length-=M}if(Q.length)break $}Q.length=0,Q.mode=iQ;case iQ:if(Q.flags&2048){if(W===0)break $;M=0;do if(n=K[Z+M++],Q.head&&n&&Q.length<65536)Q.head.name+=String.fromCharCode(n);while(n&&M>9&1,Q.head.done=!0;$.adler=Q.check=0,Q.mode=p2;break;case lQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>=U&7,U-=U&7,Q.mode=c4;break}while(U<3){if(W===0)break $;W--,V+=K[Z++]<>>=1,U-=1,V&3){case 0:Q.mode=rQ;break;case 1:if(aZ(Q),Q.mode=r8,q===l8){V>>>=2,U-=2;break $}break;case 2:Q.mode=tQ;break;case 3:$.msg="invalid block type",Q.mode=x0}V>>>=2,U-=2;break;case rQ:V>>>=U&7,U-=U&7;while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>16^65535)){$.msg="invalid stored block lengths",Q.mode=x0;break}if(Q.length=V&65535,V=0,U=0,Q.mode=_4,q===l8)break $;case _4:Q.mode=sQ;case sQ:if(M=Q.length,M){if(M>W)M=W;if(M>B)M=B;if(M===0)break $;U2.arraySet(J,K,Z,M,G),W-=M,Z+=M,B-=M,G+=M,Q.length-=M;break}Q.mode=p2;break;case tQ:while(U<14){if(W===0)break $;W--,V+=K[Z++]<>>=5,U-=5,Q.ndist=(V&31)+1,V>>>=5,U-=5,Q.ncode=(V&15)+4,V>>>=4,U-=4,Q.nlen>286||Q.ndist>30){$.msg="too many length or distance symbols",Q.mode=x0;break}Q.have=0,Q.mode=eQ;case eQ:while(Q.have>>=3,U-=3}while(Q.have<19)Q.lens[g[Q.have++]]=0;if(Q.lencode=Q.lendyn,Q.lenbits=7,X={bits:Q.lenbits},d=q8(uZ,Q.lens,0,19,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid code lengths set",Q.mode=x0;break}Q.have=0,Q.mode=$q;case $q:while(Q.have>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=D,U-=D,Q.lens[Q.have++]=N;else{if(N===16){P=D+2;while(U>>=D,U-=D,Q.have===0){$.msg="invalid bit length repeat",Q.mode=x0;break}n=Q.lens[Q.have-1],M=3+(V&3),V>>>=2,U-=2}else if(N===17){P=D+3;while(U>>=D,U-=D,n=0,M=3+(V&7),V>>>=3,U-=3}else{P=D+7;while(U>>=D,U-=D,n=0,M=11+(V&127),V>>>=7,U-=7}if(Q.have+M>Q.nlen+Q.ndist){$.msg="invalid bit length repeat",Q.mode=x0;break}while(M--)Q.lens[Q.have++]=n}}if(Q.mode===x0)break;if(Q.lens[256]===0){$.msg="invalid code -- missing end-of-block",Q.mode=x0;break}if(Q.lenbits=9,X={bits:Q.lenbits},d=q8(Bq,Q.lens,0,Q.nlen,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid literal/lengths set",Q.mode=x0;break}if(Q.distbits=6,Q.distcode=Q.distdyn,X={bits:Q.distbits},d=q8(zq,Q.lens,Q.nlen,Q.ndist,Q.distcode,0,Q.work,X),Q.distbits=X.bits,d){$.msg="invalid distances set",Q.mode=x0;break}if(Q.mode=r8,q===l8)break $;case r8:Q.mode=s8;case s8:if(W>=6&&B>=258){if($.next_out=G,$.avail_out=B,$.next_in=Z,$.avail_in=W,Q.hold=V,Q.bits=U,TZ($,F),G=$.next_out,J=$.output,B=$.avail_out,Z=$.next_in,K=$.input,W=$.avail_in,V=Q.hold,U=Q.bits,Q.mode===p2)Q.back=-1;break}Q.back=0;for(;;){if(L=Q.lencode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,Q.length=N,z===0){Q.mode=Vq;break}if(z&32){Q.back=-1,Q.mode=p2;break}if(z&64){$.msg="invalid literal/length code",Q.mode=x0;break}Q.extra=z&15,Q.mode=Qq;case Qq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}Q.was=Q.length,Q.mode=qq;case qq:for(;;){if(L=Q.distcode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,z&64){$.msg="invalid distance code",Q.mode=x0;break}Q.offset=N,Q.extra=z&15,Q.mode=Kq;case Kq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}if(Q.offset>Q.dmax){$.msg="invalid distance too far back",Q.mode=x0;break}Q.mode=Jq;case Jq:if(B===0)break $;if(M=F-B,Q.offset>M){if(M=Q.offset-M,M>Q.whave){if(Q.sane){$.msg="invalid distance too far back",Q.mode=x0;break}}if(M>Q.wnext)M-=Q.wnext,k=Q.wsize-M;else k=Q.wnext-M;if(M>Q.length)M=Q.length;f=Q.window}else f=J,k=G-Q.offset,M=Q.length;if(M>B)M=B;B-=M,Q.length-=M;do J[G++]=f[k++];while(--M);if(Q.length===0)Q.mode=s8;break;case Vq:if(B===0)break $;J[G++]=Q.length,B--,Q.mode=s8;break;case c4:if(Q.wrap){while(U<32){if(W===0)break $;W--,V|=K[Z++]<{Hq.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var fq=N0((tz,vq)=>{function eZ(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}vq.exports=eZ});var Iq=N0((J8)=>{var B6=Lq(),K8=d2(),e8=h4(),E0=i4(),o4=c8(),$G=x4(),QG=fq(),Rq=Object.prototype.toString;function A1($){if(!(this instanceof A1))return new A1($);this.options=K8.assign({chunkSize:16384,windowBits:0,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>=0&&q.windowBits<16){if(q.windowBits=-q.windowBits,q.windowBits===0)q.windowBits=-15}if(q.windowBits>=0&&q.windowBits<16&&!($&&$.windowBits))q.windowBits+=32;if(q.windowBits>15&&q.windowBits<48){if((q.windowBits&15)===0)q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $G,this.strm.avail_out=0;var Q=B6.inflateInit2(this.strm,q.windowBits);if(Q!==E0.Z_OK)throw Error(o4[Q]);if(this.header=new QG,B6.inflateGetHeader(this.strm,this.header),q.dictionary){if(typeof q.dictionary==="string")q.dictionary=e8.string2buf(q.dictionary);else if(Rq.call(q.dictionary)==="[object ArrayBuffer]")q.dictionary=new Uint8Array(q.dictionary);if(q.raw){if(Q=B6.inflateSetDictionary(this.strm,q.dictionary),Q!==E0.Z_OK)throw Error(o4[Q])}}}A1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J=this.options.dictionary,Z,G,W,B,V,U=!1;if(this.ended)return!1;if(G=q===~~q?q:q===!0?E0.Z_FINISH:E0.Z_NO_FLUSH,typeof $==="string")Q.input=e8.binstring2buf($);else if(Rq.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new K8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(Z=B6.inflate(Q,E0.Z_NO_FLUSH),Z===E0.Z_NEED_DICT&&J)Z=B6.inflateSetDictionary(this.strm,J);if(Z===E0.Z_BUF_ERROR&&U===!0)Z=E0.Z_OK,U=!1;if(Z!==E0.Z_STREAM_END&&Z!==E0.Z_OK)return this.onEnd(Z),this.ended=!0,!1;if(Q.next_out){if(Q.avail_out===0||Z===E0.Z_STREAM_END||Q.avail_in===0&&(G===E0.Z_FINISH||G===E0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(W=e8.utf8border(Q.output,Q.next_out),B=Q.next_out-W,V=e8.buf2string(Q.output,W),Q.next_out=B,Q.avail_out=K-B,B)K8.arraySet(Q.output,Q.output,W,B,0);this.onData(V)}else this.onData(K8.shrinkBuf(Q.output,Q.next_out))}if(Q.avail_in===0&&Q.avail_out===0)U=!0}while((Q.avail_in>0||Q.avail_out===0)&&Z!==E0.Z_STREAM_END);if(Z===E0.Z_STREAM_END)G=E0.Z_FINISH;if(G===E0.Z_FINISH)return Z=B6.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===E0.Z_OK;if(G===E0.Z_SYNC_FLUSH)return this.onEnd(E0.Z_OK),Q.avail_out=0,!0;return!0};A1.prototype.onData=function($){this.chunks.push($)};A1.prototype.onEnd=function($){if($===E0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=K8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function a4($,q){var Q=new A1(q);if(Q.push($,!0),Q.err)throw Q.msg||o4[Q.err];return Q.result}function qG($,q){return q=q||{},q.raw=!0,a4($,q)}J8.Inflate=A1;J8.inflate=a4;J8.inflateRaw=qG;J8.ungzip=a4});var gq=N0(($F,jq)=>{var KG=d2().assign,JG=XQ(),VG=Iq(),UG=i4(),Cq={};KG(Cq,JG,VG,UG);jq.exports=Cq});var Xq=N0((Q5)=>{var ZG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",GG=gq(),Aq=T0(),$5=V2(),WG=ZG?"uint8array":"array";Q5.magic="\b\x00";function X1($,q){$5.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=q,this.meta={}}Aq.inherits(X1,$5);X1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(Aq.transformTo(WG,$.data),!1)};X1.prototype.flush=function(){if($5.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};X1.prototype.cleanUp=function(){$5.prototype.cleanUp.call(this),this._pako=null};X1.prototype._createPako=function(){this._pako=new GG[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(q){$.push({data:q,meta:$.meta})}};Q5.compressWorker=function($){return new X1("Deflate",$)};Q5.uncompressWorker=function(){return new X1("Inflate",{})}});var r4=N0((l4)=>{var yq=V2();l4.STORE={magic:"\x00\x00",compressWorker:function(){return new yq("STORE compression")},uncompressWorker:function(){return new yq("STORE decompression")}};l4.DEFLATE=Xq()});var s4=N0((y1)=>{y1.LOCAL_FILE_HEADER="PK\x03\x04";y1.CENTRAL_FILE_HEADER="PK\x01\x02";y1.CENTRAL_DIRECTORY_END="PK\x05\x06";y1.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";y1.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";y1.DATA_DESCRIPTOR="PK\x07\b"});var Pq=N0((JF,Oq)=>{var z6=T0(),F6=V2(),t4=e1(),hq=u8(),q5=s4(),A0=function($,q){var Q="",K;for(K=0;K>>8;return Q},BG=function($,q){var Q=$;if(!$)Q=q?16893:33204;return(Q&65535)<<16},zG=function($){return($||0)&63},xq=function($,q,Q,K,J,Z){var{file:G,compression:W}=$,B=Z!==t4.utf8encode,V=z6.transformTo("string",Z(G.name)),U=z6.transformTo("string",t4.utf8encode(G.name)),w=G.comment,F=z6.transformTo("string",Z(w)),M=z6.transformTo("string",t4.utf8encode(w)),k=U.length!==G.name.length,f=M.length!==w.length,L,D,z="",N="",H="",v=G.dir,j=G.date,n={crc32:0,compressedSize:0,uncompressedSize:0};if(!q||Q)n.crc32=$.crc32,n.compressedSize=$.compressedSize,n.uncompressedSize=$.uncompressedSize;var d=0;if(q)d|=8;if(!B&&(k||f))d|=2048;var _=0,X=0;if(v)_|=16;if(J==="UNIX")X=798,_|=BG(G.unixPermissions,v);else X=20,_|=zG(G.dosPermissions,v);if(L=j.getUTCHours(),L=L<<6,L=L|j.getUTCMinutes(),L=L<<5,L=L|j.getUTCSeconds()/2,D=j.getUTCFullYear()-1980,D=D<<4,D=D|j.getUTCMonth()+1,D=D<<5,D=D|j.getUTCDate(),k)N=A0(1,1)+A0(hq(V),4)+U,z+="up"+A0(N.length,2)+N;if(f)H=A0(1,1)+A0(hq(F),4)+M,z+="uc"+A0(H.length,2)+H;var P="";P+=` -\x00`,P+=A0(d,2),P+=W.magic,P+=A0(L,2),P+=A0(D,2),P+=A0(n.crc32,4),P+=A0(n.compressedSize,4),P+=A0(n.uncompressedSize,4),P+=A0(V.length,2),P+=A0(z.length,2);var g=q5.LOCAL_FILE_HEADER+P+V+z,c=q5.CENTRAL_FILE_HEADER+A0(X,2)+P+A0(F.length,2)+"\x00\x00\x00\x00"+A0(_,4)+A0(K,4)+V+z+F;return{fileRecord:g,dirRecord:c}},FG=function($,q,Q,K,J){var Z="",G=z6.transformTo("string",J(K));return Z=q5.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+A0($,2)+A0($,2)+A0(q,4)+A0(Q,4)+A0(G.length,2)+G,Z},MG=function($){var q="";return q=q5.DATA_DESCRIPTOR+A0($.crc32,4)+A0($.compressedSize,4)+A0($.uncompressedSize,4),q};function v2($,q,Q,K){F6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=q,this.zipPlatform=Q,this.encodeFileName=K,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}z6.inherits(v2,F6);v2.prototype.push=function($){var q=$.meta.percent||0,Q=this.entriesCount,K=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,F6.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:Q?(q+100*(Q-K-1))/Q:100}})};v2.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var q=this.streamFiles&&!$.file.dir;if(q){var Q=xq($,q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:Q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};v2.prototype.closedSource=function($){this.accumulate=!1;var q=this.streamFiles&&!$.file.dir,Q=xq($,q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(Q.dirRecord),q)this.push({data:MG($),meta:{percent:100}});else{this.push({data:Q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};v2.prototype.flush=function(){var $=this.bytesWritten;for(var q=0;q{var wG=r4(),NG=Pq(),YG=function($,q){var Q=$||q,K=wG[Q];if(!K)throw Error(Q+" is not a valid compression method !");return K};Tq.generateWorker=function($,q,Q){var K=new NG(q.streamFiles,Q,q.platform,q.encodeFileName),J=0;try{$.forEach(function(Z,G){J++;var W=YG(G.options.compression,q.compression),B=G.options.compressionOptions||q.compressionOptions||{},V=G.dir,U=G.date;G._compressWorker(W,B).withStreamInfo("file",{name:Z,dir:V,date:U,comment:G.comment||"",unixPermissions:G.unixPermissions,dosPermissions:G.dosPermissions}).pipe(K)}),K.entriesCount=J}catch(Z){K.error(Z)}return K}});var Eq=N0((UF,Sq)=>{var kG=T0(),K5=V2();function V8($,q){K5.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(q)}kG.inherits(V8,K5);V8.prototype._bindStream=function($){var q=this;this._stream=$,$.pause(),$.on("data",function(Q){q.push({data:Q,meta:{percent:0}})}).on("error",function(Q){if(q.isPaused)this.generatedError=Q;else q.error(Q)}).on("end",function(){if(q.isPaused)q._upstreamEnded=!0;else q.end()})};V8.prototype.pause=function(){if(!K5.prototype.pause.call(this))return!1;return this._stream.pause(),!0};V8.prototype.resume=function(){if(!K5.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};Sq.exports=V8});var aq=N0((ZF,oq)=>{var DG=e1(),U8=T0(),nq=V2(),LG=K4(),dq=J4(),_q=S8(),HG=c$(),vG=uq(),cq=T6(),fG=Eq(),mq=function($,q,Q){var K=U8.getTypeOf(q),J,Z=U8.extend(Q||{},dq);if(Z.date=Z.date||new Date,Z.compression!==null)Z.compression=Z.compression.toUpperCase();if(typeof Z.unixPermissions==="string")Z.unixPermissions=parseInt(Z.unixPermissions,8);if(Z.unixPermissions&&Z.unixPermissions&16384)Z.dir=!0;if(Z.dosPermissions&&Z.dosPermissions&16)Z.dir=!0;if(Z.dir)$=pq($);if(Z.createFolders&&(J=RG($)))iq.call(this,J,!0);var G=K==="string"&&Z.binary===!1&&Z.base64===!1;if(!Q||typeof Q.binary>"u")Z.binary=!G;var W=q instanceof _q&&q.uncompressedSize===0;if(W||Z.dir||!q||q.length===0)Z.base64=!1,Z.binary=!0,q="",Z.compression="STORE",K="string";var B=null;if(q instanceof _q||q instanceof nq)B=q;else if(cq.isNode&&cq.isStream(q))B=new fG($,q);else B=U8.prepareContent($,q,Z.binary,Z.optimizedBinaryString,Z.base64);var V=new HG($,B,Z);this.files[$]=V},RG=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var q=$.lastIndexOf("/");return q>0?$.substring(0,q):""},pq=function($){if($.slice(-1)!=="/")$+="/";return $},iq=function($,q){if(q=typeof q<"u"?q:dq.createFolders,$=pq($),!this.files[$])mq.call(this,$,null,{dir:!0,createFolders:q});return this.files[$]};function bq($){return Object.prototype.toString.call($)==="[object RegExp]"}var IG={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var q,Q,K;for(q in this.files)if(K=this.files[q],Q=q.slice(this.root.length,q.length),Q&&q.slice(0,this.root.length)===this.root)$(Q,K)},filter:function($){var q=[];return this.forEach(function(Q,K){if($(Q,K))q.push(K)}),q},file:function($,q,Q){if(arguments.length===1)if(bq($)){var K=$;return this.filter(function(Z,G){return!G.dir&&K.test(Z)})}else{var J=this.files[this.root+$];if(J&&!J.dir)return J;else return null}else $=this.root+$,mq.call(this,$,q,Q);return this},folder:function($){if(!$)return this;if(bq($))return this.filter(function(J,Z){return Z.dir&&$.test(J)});var q=this.root+$,Q=iq.call(this,q),K=this.clone();return K.root=Q.name,K},remove:function($){$=this.root+$;var q=this.files[$];if(!q){if($.slice(-1)!=="/")$+="/";q=this.files[$]}if(q&&!q.dir)delete this.files[$];else{var Q=this.filter(function(J,Z){return Z.name.slice(0,$.length)===$});for(var K=0;K{var CG=T0();function lq($){this.data=$,this.length=$.length,this.index=0,this.zero=0}lq.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length=this.index;Q--)q=(q<<8)+this.byteAt(Q);return this.index+=$,q},readString:function($){return CG.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};rq.exports=lq});var $7=N0((WF,tq)=>{var sq=e4(),jG=T0();function M6($){sq.call(this,$);for(var q=0;q=0;--Z)if(this.data[Z]===q&&this.data[Z+1]===Q&&this.data[Z+2]===K&&this.data[Z+3]===J)return Z-this.zero;return-1};M6.prototype.readAndCheckSignature=function($){var q=$.charCodeAt(0),Q=$.charCodeAt(1),K=$.charCodeAt(2),J=$.charCodeAt(3),Z=this.readData(4);return q===Z[0]&&Q===Z[1]&&K===Z[2]&&J===Z[3]};M6.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};tq.exports=M6});var QK=N0((BF,$K)=>{var eq=e4(),gG=T0();function w6($){eq.call(this,$)}gG.inherits(w6,eq);w6.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};w6.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};w6.prototype.readAndCheckSignature=function($){var q=this.readData(4);return $===q};w6.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};$K.exports=w6});var q7=N0((zF,KK)=>{var qK=$7(),AG=T0();function Q7($){qK.call(this,$)}AG.inherits(Q7,qK);Q7.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};KK.exports=Q7});var UK=N0((FF,VK)=>{var JK=q7(),XG=T0();function K7($){JK.call(this,$)}XG.inherits(K7,JK);K7.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};VK.exports=K7});var J7=N0((MF,GK)=>{var J5=T0(),ZK=n2(),yG=$7(),hG=QK(),xG=UK(),OG=q7();GK.exports=function($){var q=J5.getTypeOf($);if(J5.checkSupport(q),q==="string"&&!ZK.uint8array)return new hG($);if(q==="nodebuffer")return new xG($);if(ZK.uint8array)return new OG(J5.transformTo("uint8array",$));return new yG(J5.transformTo("array",$))}});var FK=N0((wF,zK)=>{var V7=J7(),G1=T0(),PG=S8(),WK=u8(),V5=e1(),U5=r4(),TG=n2(),uG=0,SG=3,EG=function($){for(var q in U5){if(!Object.prototype.hasOwnProperty.call(U5,q))continue;if(U5[q].magic===$)return U5[q]}return null};function BK($,q){this.options=$,this.loadOptions=q}BK.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var q,Q;if($.skip(22),this.fileNameLength=$.readInt(2),Q=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(Q),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(q=EG(this.compressionMethod),q===null)throw Error("Corrupted zip : compression "+G1.pretty(this.compressionMethod)+" unknown (inner file : "+G1.transformTo("string",this.fileName)+")");this.decompressed=new PG(this.compressedSize,this.uncompressedSize,this.crc32,q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===uG)this.dosPermissions=this.externalFileAttributes&63;if($===SG)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=V7(this.extraFields[1].value);if(this.uncompressedSize===G1.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G1.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G1.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G1.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var q=$.index+this.extraFieldsLength,Q,K,J;if(!this.extraFields)this.extraFields={};while($.index+4{var _G=J7(),i2=T0(),f2=s4(),cG=FK(),bG=n2();function MK($){this.files=[],this.loadOptions=$}MK.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+i2.pretty(q)+", expected "+i2.pretty($)+")")}},isSignature:function($,q){var Q=this.reader.index;this.reader.setIndex($);var K=this.reader.readString(4),J=K===q;return this.reader.setIndex(Q),J},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),q=bG.uint8array?"uint8array":"array",Q=i2.transformTo(q,$);this.zipComment=this.loadOptions.decodeFileName(Q)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,q=0,Q,K,J;while(q<$)Q=this.reader.readInt(2),K=this.reader.readInt(4),J=this.reader.readData(K),this.zip64ExtensibleData[Q]={id:Q,length:K,value:J}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,q;for($=0;$0)if(this.isSignature(Q,f2.CENTRAL_FILE_HEADER));else this.reader.zero=J;else if(J<0)throw Error("Corrupted zip: missing "+Math.abs(J)+" bytes.")},prepareReader:function($){this.reader=_G($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};wK.exports=MK});var DK=N0((YF,kK)=>{var U7=T0(),Z5=r1(),nG=e1(),dG=NK(),mG=Z4(),YK=T6();function pG($){return new Z5.Promise(function(q,Q){var K=$.decompressed.getContentWorker().pipe(new mG);K.on("error",function(J){Q(J)}).on("end",function(){if(K.streamInfo.crc32!==$.decompressed.crc32)Q(Error("Corrupted zip : CRC32 mismatch"));else q()}).resume()})}kK.exports=function($,q){var Q=this;if(q=U7.extend(q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:nG.utf8decode}),YK.isNode&&YK.isStream($))return Z5.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return U7.prepareContent("the loaded zip file",$,!0,q.optimizedBinaryString,q.base64).then(function(K){var J=new dG(q);return J.load(K),J}).then(function(J){var Z=[Z5.Promise.resolve(J)],G=J.files;if(q.checkCRC32)for(var W=0;W{function Y2(){if(!(this instanceof Y2))return new Y2;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new Y2;for(var q in this)if(typeof this[q]!=="function")$[q]=this[q];return $}}Y2.prototype=aq();Y2.prototype.loadAsync=DK();Y2.support=n2();Y2.defaults=J4();Y2.version="3.10.1";Y2.loadAsync=function($,q){return new Y2().loadAsync($,q)};Y2.external=r1();LK.exports=Y2});var Z8={};c1(Z8,{types:()=>QW,promisify:()=>jK,log:()=>RK,isUndefined:()=>N6,isSymbol:()=>KW,isString:()=>M5,isRegExp:()=>G5,isPrimitive:()=>JW,isObject:()=>Y6,isNumber:()=>fK,isNullOrUndefined:()=>qW,isNull:()=>F5,isFunction:()=>B5,isError:()=>W5,isDate:()=>B7,isBuffer:()=>VW,isBoolean:()=>F7,isArray:()=>vK,inspect:()=>h1,inherits:()=>IK,format:()=>z7,deprecate:()=>oG,default:()=>GW,debuglog:()=>aG,callbackifyOnRejected:()=>N7,callbackify:()=>gK,_extend:()=>w7,TextEncoder:()=>AK,TextDecoder:()=>XK});function z7($,...q){if(!M5($)){var Q=[$];for(var K=0;K=J)return W;switch(W){case"%s":return String(q[K++]);case"%d":return Number(q[K++]);case"%j":try{return JSON.stringify(q[K++])}catch(B){return"[Circular]"}default:return W}});for(var G=q[K];K"u"||process?.noDeprecation===!0)return $;var Q=!1;function K(...J){if(!Q){if(process.throwDeprecation)throw Error(q);else if(process.traceDeprecation)console.trace(q);else console.error(q);Q=!0}return $.apply(this,...J)}return K}function lG($,q){var Q=h1.styles[q];if(Q)return"\x1B["+h1.colors[Q][0]+"m"+$+"\x1B["+h1.colors[Q][1]+"m";else return $}function rG($,q){return $}function sG($){var q={};return $.forEach(function(Q,K){q[Q]=!0}),q}function z5($,q,Q){if($.customInspect&&q&&B5(q.inspect)&&q.inspect!==h1&&!(q.constructor&&q.constructor.prototype===q)){var K=q.inspect(Q,$);if(!M5(K))K=z5($,K,Q);return K}var J=tG($,q);if(J)return J;var Z=Object.keys(q),G=sG(Z);if($.showHidden)Z=Object.getOwnPropertyNames(q);if(W5(q)&&(Z.indexOf("message")>=0||Z.indexOf("description")>=0))return Z7(q);if(Z.length===0){if(B5(q)){var W=q.name?": "+q.name:"";return $.stylize("[Function"+W+"]","special")}if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");if(B7(q))return $.stylize(Date.prototype.toString.call(q),"date");if(W5(q))return Z7(q)}var B="",V=!1,U=["{","}"];if(vK(q))V=!0,U=["[","]"];if(B5(q)){var w=q.name?": "+q.name:"";B=" [Function"+w+"]"}if(G5(q))B=" "+RegExp.prototype.toString.call(q);if(B7(q))B=" "+Date.prototype.toUTCString.call(q);if(W5(q))B=" "+Z7(q);if(Z.length===0&&(!V||q.length==0))return U[0]+B+U[1];if(Q<0)if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");else return $.stylize("[Object]","special");$.seen.push(q);var F;if(V)F=eG($,q,Q,G,Z);else F=Z.map(function(M){return W7($,q,Q,G,M,V)});return $.seen.pop(),$W(F,B,U)}function tG($,q){if(N6(q))return $.stylize("undefined","undefined");if(M5(q)){var Q="'"+JSON.stringify(q).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(Q,"string")}if(fK(q))return $.stylize(""+q,"number");if(F7(q))return $.stylize(""+q,"boolean");if(F5(q))return $.stylize("null","null")}function Z7($){return"["+Error.prototype.toString.call($)+"]"}function eG($,q,Q,K,J){var Z=[];for(var G=0,W=q.length;G{var fJ=Object.create;var{getPrototypeOf:RJ,defineProperty:X6,getOwnPropertyNames:Q9,getOwnPropertyDescriptor:IJ}=Object,q9=Object.prototype.hasOwnProperty;function K9($){return this[$]}var CJ,jJ,J9=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?CJ??=new WeakMap:jJ??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?fJ(RJ($)):{};let G=q||!$||!$.__esModule?X6(Q,"default",{value:$,enumerable:!0}):Q;for(let W of Q9($))if(!q9.call(G,W))X6(G,W,{get:K9.bind($,W),enumerable:!0});if(K)J.set($,G);return G},X0=($)=>{var q=($9??=new WeakMap).get($),Q;if(q)return q;if(q=X6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var K of Q9($))if(!q9.call(q,K))X6(q,K,{get:K9.bind($,K),enumerable:!(Q=IJ($,K))||Q.enumerable})}return $9.set($,q),q},$9,N0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var gJ=($)=>$;function AJ($,q){this[$]=gJ.bind(null,q)}var c1=($,q)=>{for(var Q in q)X6($,Q,{get:q[Q],enumerable:!0,configurable:!0,set:AJ.bind(q,Q)})};var b1=($,q)=>()=>($&&(q=$($=0)),q);var V9=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(q,Q)=>(typeof require<"u"?require:q)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var K2={};c1(K2,{transcode:()=>MV,resolveObjectURL:()=>BV,kStringMaxLength:()=>w9,kMaxLength:()=>y6,isUtf8:()=>zV,isAscii:()=>FV,default:()=>wV,constants:()=>EJ,btoa:()=>PJ,atob:()=>TJ,INSPECT_MAX_BYTES:()=>M9,File:()=>uJ,Buffer:()=>o,Blob:()=>SJ});function XJ($){var q=$.length;if(q%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=$.indexOf("=");if(Q===-1)Q=q;var K=Q===q?0:4-Q%4;return[Q,K]}function yJ($,q){return($+q)*3/4-q}function hJ($){var q,Q=XJ($),K=Q[0],J=Q[1],Z=new Uint8Array(yJ(K,J)),G=0,W=J>0?K-4:K,B;for(B=0;B>16&255,Z[G++]=q>>8&255,Z[G++]=q&255;if(J===2)q=F2[$.charCodeAt(B)]<<2|F2[$.charCodeAt(B+1)]>>4,Z[G++]=q&255;if(J===1)q=F2[$.charCodeAt(B)]<<10|F2[$.charCodeAt(B+1)]<<4|F2[$.charCodeAt(B+2)]>>2,Z[G++]=q>>8&255,Z[G++]=q&255;return Z}function xJ($){return I2[$>>18&63]+I2[$>>12&63]+I2[$>>6&63]+I2[$&63]}function OJ($,q,Q){var K,J=[];for(var Z=q;ZW?W:G+Z));if(K===1)q=$[Q-1],J.push(I2[q>>2]+I2[q<<4&63]+"==");else if(K===2)q=($[Q-2]<<8)+$[Q-1],J.push(I2[q>>10]+I2[q>>4&63]+I2[q<<2&63]+"=");return J.join("")}function Y8($,q,Q,K,J){var Z,G,W=J*8-K-1,B=(1<>1,U=-7,w=Q?J-1:0,F=Q?-1:1,M=$[q+w];w+=F,Z=M&(1<<-U)-1,M>>=-U,U+=W;for(;U>0;Z=Z*256+$[q+w],w+=F,U-=8);G=Z&(1<<-U)-1,Z>>=-U,U+=K;for(;U>0;G=G*256+$[q+w],w+=F,U-=8);if(Z===0)Z=1-V;else if(Z===B)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,K),Z=Z-V;return(M?-1:1)*G*Math.pow(2,Z-K)}function F9($,q,Q,K,J,Z){var G,W,B,V=Z*8-J-1,U=(1<>1,F=J===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:Z-1,k=K?1:-1,f=q<0||q===0&&1/q<0?1:0;if(q=Math.abs(q),isNaN(q)||q===1/0)W=isNaN(q)?1:0,G=U;else{if(G=Math.floor(Math.log(q)/Math.LN2),q*(B=Math.pow(2,-G))<1)G--,B*=2;if(G+w>=1)q+=F/B;else q+=F*Math.pow(2,1-w);if(q*B>=2)G++,B/=2;if(G+w>=U)W=0,G=U;else if(G+w>=1)W=(q*B-1)*Math.pow(2,J),G=G+w;else W=q*Math.pow(2,w-1)*Math.pow(2,J),G=0}for(;J>=8;$[Q+M]=W&255,M+=k,W/=256,J-=8);G=G<0;$[Q+M]=G&255,M+=k,G/=256,V-=8);$[Q+M-k]|=f*128}function S2($){if($>y6)throw RangeError('The value "'+$+'" is invalid for option "size"');let q=new Uint8Array($);return Object.setPrototypeOf(q,o.prototype),q}function x5($,q,Q){return class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:q.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}function o($,q,Q){if(typeof $==="number"){if(typeof q==="string")throw TypeError('The "string" argument must be of type string. Received type number');return O5($)}return N9($,q,Q)}function N9($,q,Q){if(typeof $==="string")return nJ($,q);if(ArrayBuffer.isView($))return dJ($);if($==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(C2($,ArrayBuffer)||$&&C2($.buffer,ArrayBuffer))return y5($,q,Q);if(typeof SharedArrayBuffer<"u"&&(C2($,SharedArrayBuffer)||$&&C2($.buffer,SharedArrayBuffer)))return y5($,q,Q);if(typeof $==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=$.valueOf&&$.valueOf();if(K!=null&&K!==$)return o.from(K,q,Q);let J=mJ($);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]==="function")return o.from($[Symbol.toPrimitive]("string"),q,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}function Y9($){if(typeof $!=="number")throw TypeError('"size" argument must be of type number');else if($<0)throw RangeError('The value "'+$+'" is invalid for option "size"')}function bJ($,q,Q){if(Y9($),$<=0)return S2($);if(q!==void 0)return typeof Q==="string"?S2($).fill(q,Q):S2($).fill(q);return S2($)}function O5($){return Y9($),S2($<0?0:P5($)|0)}function nJ($,q){if(typeof q!=="string"||q==="")q="utf8";if(!o.isEncoding(q))throw TypeError("Unknown encoding: "+q);let Q=k9($,q)|0,K=S2(Q),J=K.write($,q);if(J!==Q)K=K.slice(0,J);return K}function X5($){let q=$.length<0?0:P5($.length)|0,Q=S2(q);for(let K=0;K=y6)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y6.toString(16)+" bytes");return $|0}function k9($,q){if(o.isBuffer($))return $.length;if(ArrayBuffer.isView($)||C2($,ArrayBuffer))return $.byteLength;if(typeof $!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let Q=$.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&Q===0)return 0;let J=!1;for(;;)switch(q){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return h5($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return j9($).length;default:if(J)return K?-1:h5($).length;q=(""+q).toLowerCase(),J=!0}}function pJ($,q,Q){let K=!1;if(q===void 0||q<0)q=0;if(q>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,q>>>=0,Q<=q)return"";if(!$)$="utf8";while(!0)switch($){case"hex":return QV(this,q,Q);case"utf8":case"utf-8":return L9(this,q,Q);case"ascii":return eJ(this,q,Q);case"latin1":case"binary":return $V(this,q,Q);case"base64":return sJ(this,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qV(this,q,Q);default:if(K)throw TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),K=!0}}function w1($,q,Q){let K=$[q];$[q]=$[Q],$[Q]=K}function D9($,q,Q,K,J){if($.length===0)return-1;if(typeof Q==="string")K=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,Number.isNaN(Q))Q=J?0:$.length-1;if(Q<0)Q=$.length+Q;if(Q>=$.length)if(J)return-1;else Q=$.length-1;else if(Q<0)if(J)Q=0;else return-1;if(typeof q==="string")q=o.from(q,K);if(o.isBuffer(q)){if(q.length===0)return-1;return W9($,q,Q,K,J)}else if(typeof q==="number"){if(q=q&255,typeof Uint8Array.prototype.indexOf==="function")if(J)return Uint8Array.prototype.indexOf.call($,q,Q);else return Uint8Array.prototype.lastIndexOf.call($,q,Q);return W9($,[q],Q,K,J)}throw TypeError("val must be string, number or Buffer")}function W9($,q,Q,K,J){let Z=1,G=$.length,W=q.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if($.length<2||q.length<2)return-1;Z=2,G/=2,W/=2,Q/=2}}function B(U,w){if(Z===1)return U[w];else return U.readUInt16BE(w*Z)}let V;if(J){let U=-1;for(V=Q;VG)Q=G-W;for(V=Q;V>=0;V--){let U=!0;for(let w=0;wJ)K=J;let Z=q.length;if(K>Z/2)K=Z/2;let G;for(G=0;G239?4:Z>223?3:Z>191?2:1;if(J+W<=Q){let B,V,U,w;switch(W){case 1:if(Z<128)G=Z;break;case 2:if(B=$[J+1],(B&192)===128){if(w=(Z&31)<<6|B&63,w>127)G=w}break;case 3:if(B=$[J+1],V=$[J+2],(B&192)===128&&(V&192)===128){if(w=(Z&15)<<12|(B&63)<<6|V&63,w>2047&&(w<55296||w>57343))G=w}break;case 4:if(B=$[J+1],V=$[J+2],U=$[J+3],(B&192)===128&&(V&192)===128&&(U&192)===128){if(w=(Z&15)<<18|(B&63)<<12|(V&63)<<6|U&63,w>65535&&w<1114112)G=w}}}if(G===null)G=65533,W=1;else if(G>65535)G-=65536,K.push(G>>>10&1023|55296),G=56320|G&1023;K.push(G),J+=W}return tJ(K)}function tJ($){let q=$.length;if(q<=B9)return String.fromCharCode.apply(String,$);let Q="",K=0;while(KK)Q=K;let J="";for(let Z=q;ZQ)throw RangeError("Trying to access beyond buffer length")}function s0($,q,Q,K,J,Z){if(!o.isBuffer($))throw TypeError('"buffer" argument must be a Buffer instance');if(q>J||q$.length)throw RangeError("Index out of range")}function H9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,Q}function v9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q+7]=Z,Z=Z>>8,$[Q+6]=Z,Z=Z>>8,$[Q+5]=Z,Z=Z>>8,$[Q+4]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q+3]=G,G=G>>8,$[Q+2]=G,G=G>>8,$[Q+1]=G,G=G>>8,$[Q]=G,Q+8}function f9($,q,Q,K,J,Z){if(Q+K>$.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function R9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return F9($,q,Q,K,23,4),Q+4}function I9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return F9($,q,Q,K,52,8),Q+8}function z9($){let q="",Q=$.length,K=$[0]==="-"?1:0;for(;Q>=K+4;Q-=3)q=`_${$.slice(Q-3,Q)}${q}`;return`${$.slice(0,Q)}${q}`}function KV($,q,Q){if(n1(q,"offset"),$[q]===void 0||$[q+Q]===void 0)h6(q,$.length-(Q+1))}function C9($,q,Q,K,J,Z){if($>Q||$3)if(q===0||q===BigInt(0))W=`>= 0${G} and < 2${G} ** ${(Z+1)*8}${G}`;else W=`>= -(2${G} ** ${(Z+1)*8-1}${G}) and < 2 ** ${(Z+1)*8-1}${G}`;else W=`>= ${q}${G} and <= ${Q}${G}`;throw new A5("value",W,$)}KV(K,J,Z)}function n1($,q){if(typeof $!=="number")throw new cJ(q,"number",$)}function h6($,q,Q){if(Math.floor($)!==$)throw n1($,Q),new A5(Q||"offset","an integer",$);if(q<0)throw new _J;throw new A5(Q||"offset",`>= ${Q?1:0} and <= ${q}`,$)}function VV($){if($=$.split("=")[0],$=$.trim().replace(JV,""),$.length<2)return"";while($.length%4!==0)$=$+"=";return $}function h5($,q){q=q||1/0;let Q,K=$.length,J=null,Z=[];for(let G=0;G55295&&Q<57344){if(!J){if(Q>56319){if((q-=3)>-1)Z.push(239,191,189);continue}else if(G+1===K){if((q-=3)>-1)Z.push(239,191,189);continue}J=Q;continue}if(Q<56320){if((q-=3)>-1)Z.push(239,191,189);J=Q;continue}Q=(J-55296<<10|Q-56320)+65536}else if(J){if((q-=3)>-1)Z.push(239,191,189)}if(J=null,Q<128){if((q-=1)<0)break;Z.push(Q)}else if(Q<2048){if((q-=2)<0)break;Z.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((q-=3)<0)break;Z.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((q-=4)<0)break;Z.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return Z}function UV($){let q=[];for(let Q=0;Q<$.length;++Q)q.push($.charCodeAt(Q)&255);return q}function ZV($,q){let Q,K,J,Z=[];for(let G=0;G<$.length;++G){if((q-=2)<0)break;Q=$.charCodeAt(G),K=Q>>8,J=Q%256,Z.push(J),Z.push(K)}return Z}function j9($){return hJ(VV($))}function k8($,q,Q,K){let J;for(J=0;J=q.length||J>=$.length)break;q[J+Q]=$[J]}return J}function C2($,q){return $ instanceof q||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===q.name}function l2($){return typeof BigInt>"u"?WV:$}function WV(){throw Error("BigInt not supported")}function T5($){return()=>{throw Error($+" is not implemented for node:buffer browser polyfill")}}var I2,F2,g5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M1,U9,G9,M9=50,y6=2147483647,w9=536870888,PJ,TJ,uJ,SJ,EJ,_J,cJ,A5,B9=4096,JV,GV,BV,zV,FV=($)=>{for(let q of $)if(q.charCodeAt(0)>127)return!1;return!0},MV,wV;var t0=b1(()=>{I2=[],F2=[];for(M1=0,U9=g5.length;M14294967296)J=z9(String(Q));else if(typeof Q==="bigint"){if(J=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))J=z9(J);J+="n"}return K+=` It must be ${q}. Received ${J}`,K},RangeError);Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.buffer}});Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.byteOffset}});o.poolSize=8192;o.from=function($,q,Q){return N9($,q,Q)};Object.setPrototypeOf(o.prototype,Uint8Array.prototype);Object.setPrototypeOf(o,Uint8Array);o.alloc=function($,q,Q){return bJ($,q,Q)};o.allocUnsafe=function($){return O5($)};o.allocUnsafeSlow=function($){return O5($)};o.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==o.prototype};o.compare=function($,q){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(C2(q,Uint8Array))q=o.from(q,q.offset,q.byteLength);if(!o.isBuffer($)||!o.isBuffer(q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===q)return 0;let Q=$.length,K=q.length;for(let J=0,Z=Math.min(Q,K);JK.length){if(!o.isBuffer(Z))Z=o.from(Z);Z.copy(K,J)}else Uint8Array.prototype.set.call(K,Z,J);else if(!o.isBuffer(Z))throw TypeError('"list" argument must be an Array of Buffers');else Z.copy(K,J);J+=Z.length}return K};o.byteLength=k9;o.prototype._isBuffer=!0;o.prototype.swap16=function(){let $=this.length;if($%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let q=0;q<$;q+=2)w1(this,q,q+1);return this};o.prototype.swap32=function(){let $=this.length;if($%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let q=0;q<$;q+=4)w1(this,q,q+3),w1(this,q+1,q+2);return this};o.prototype.swap64=function(){let $=this.length;if($%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let q=0;q<$;q+=8)w1(this,q,q+7),w1(this,q+1,q+6),w1(this,q+2,q+5),w1(this,q+3,q+4);return this};o.prototype.toString=function(){let $=this.length;if($===0)return"";if(arguments.length===0)return L9(this,0,$);return pJ.apply(this,arguments)};o.prototype.toLocaleString=o.prototype.toString;o.prototype.equals=function($){if(!o.isBuffer($))throw TypeError("Argument must be a Buffer");if(this===$)return!0;return o.compare(this,$)===0};o.prototype.inspect=function(){let $="",q=M9;if($=this.toString("hex",0,q).replace(/(.{2})/g,"$1 ").trim(),this.length>q)$+=" ... ";return""};if(G9)o.prototype[G9]=o.prototype.inspect;o.prototype.compare=function($,q,Q,K,J){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(!o.isBuffer($))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(q===void 0)q=0;if(Q===void 0)Q=$?$.length:0;if(K===void 0)K=0;if(J===void 0)J=this.length;if(q<0||Q>$.length||K<0||J>this.length)throw RangeError("out of range index");if(K>=J&&q>=Q)return 0;if(K>=J)return-1;if(q>=Q)return 1;if(q>>>=0,Q>>>=0,K>>>=0,J>>>=0,this===$)return 0;let Z=J-K,G=Q-q,W=Math.min(Z,G),B=this.slice(K,J),V=$.slice(q,Q);for(let U=0;U>>0,isFinite(Q)){if(Q=Q>>>0,K===void 0)K="utf8"}else K=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let J=this.length-q;if(Q===void 0||Q>J)Q=J;if($.length>0&&(Q<0||q<0)||q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let Z=!1;for(;;)switch(K){case"hex":return iJ(this,$,q,Q);case"utf8":case"utf-8":return oJ(this,$,q,Q);case"ascii":case"latin1":case"binary":return aJ(this,$,q,Q);case"base64":return lJ(this,$,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rJ(this,$,q,Q);default:if(Z)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),Z=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};o.prototype.slice=function($,q){let Q=this.length;if($=~~$,q=q===void 0?Q:~~q,$<0){if($+=Q,$<0)$=0}else if($>Q)$=Q;if(q<0){if(q+=Q,q<0)q=0}else if(q>Q)q=Q;if(q<$)q=$;let K=this.subarray($,q);return Object.setPrototypeOf(K,o.prototype),K};o.prototype.readUintLE=o.prototype.readUIntLE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$+--q],J=1;while(q>0&&(J*=256))K+=this[$+--q]*J;return K};o.prototype.readUint8=o.prototype.readUInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);return this[$]};o.prototype.readUint16LE=o.prototype.readUInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]|this[$+1]<<8};o.prototype.readUint16BE=o.prototype.readUInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]<<8|this[$+1]};o.prototype.readUint32LE=o.prototype.readUInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216};o.prototype.readUint32BE=o.prototype.readUInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])};o.prototype.readBigUInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q+this[++$]*256+this[++$]*65536+this[++$]*16777216,J=this[++$]+this[++$]*256+this[++$]*65536+Q*16777216;return BigInt(K)+(BigInt(J)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q*16777216+this[++$]*65536+this[++$]*256+this[++$],J=this[++$]*16777216+this[++$]*65536+this[++$]*256+Q;return(BigInt(K)<>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z=J)K-=Math.pow(2,8*q);return K};o.prototype.readIntBE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=q,J=1,Z=this[$+--K];while(K>0&&(J*=256))Z+=this[$+--K]*J;if(J*=128,Z>=J)Z-=Math.pow(2,8*q);return Z};o.prototype.readInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);if(!(this[$]&128))return this[$];return(255-this[$]+1)*-1};o.prototype.readInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$]|this[$+1]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$+1]|this[$]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24};o.prototype.readInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]};o.prototype.readBigInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=this[$+4]+this[$+5]*256+this[$+6]*65536+(Q<<24);return(BigInt(K)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=(q<<24)+this[++$]*65536+this[++$]*256+this[++$];return(BigInt(K)<>>0,!q)b0($,4,this.length);return Y8(this,$,!0,23,4)};o.prototype.readFloatBE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return Y8(this,$,!1,23,4)};o.prototype.readDoubleLE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!0,52,8)};o.prototype.readDoubleBE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!1,52,8)};o.prototype.writeUintLE=o.prototype.writeUIntLE=function($,q,Q,K){if($=+$,q=q>>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=1,Z=0;this[q]=$&255;while(++Z>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=Q-1,Z=1;this[q+J]=$&255;while(--J>=0&&(Z*=256))this[q+J]=$/Z&255;return q+Q};o.prototype.writeUint8=o.prototype.writeUInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,255,0);return this[q]=$&255,q+1};o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q+3]=$>>>24,this[q+2]=$>>>16,this[q+1]=$>>>8,this[q]=$&255,q+4};o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigUInt64LE=l2(function($,q=0){return H9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeBigUInt64BE=l2(function($,q=0){return v9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeIntLE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=0,Z=1,G=0;this[q]=$&255;while(++J>0)-G&255}return q+Q};o.prototype.writeIntBE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=Q-1,Z=1,G=0;this[q+J]=$&255;while(--J>=0&&(Z*=256)){if($<0&&G===0&&this[q+J+1]!==0)G=1;this[q+J]=($/Z>>0)-G&255}return q+Q};o.prototype.writeInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,127,-128);if($<0)$=255+$+1;return this[q]=$&255,q+1};o.prototype.writeInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);return this[q]=$&255,this[q+1]=$>>>8,this[q+2]=$>>>16,this[q+3]=$>>>24,q+4};o.prototype.writeInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);if($<0)$=4294967295+$+1;return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigInt64LE=l2(function($,q=0){return H9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeBigInt64BE=l2(function($,q=0){return v9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeFloatLE=function($,q,Q){return R9(this,$,q,!0,Q)};o.prototype.writeFloatBE=function($,q,Q){return R9(this,$,q,!1,Q)};o.prototype.writeDoubleLE=function($,q,Q){return I9(this,$,q,!0,Q)};o.prototype.writeDoubleBE=function($,q,Q){return I9(this,$,q,!1,Q)};o.prototype.copy=function($,q,Q,K){if(!o.isBuffer($))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!K&&K!==0)K=this.length;if(q>=$.length)q=$.length;if(!q)q=0;if(K>0&&K=this.length)throw RangeError("Index out of range");if(K<0)throw RangeError("sourceEnd out of bounds");if(K>this.length)K=this.length;if($.length-q>>0,Q=Q===void 0?this.length:Q>>>0,!$)$=0;let J;if(typeof $==="number")for(J=q;J{var S0=y9.exports={},j2,g2;function u5(){throw Error("setTimeout has not been defined")}function S5(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")j2=setTimeout;else j2=u5}catch($){j2=u5}try{if(typeof clearTimeout==="function")g2=clearTimeout;else g2=S5}catch($){g2=S5}})();function g9($){if(j2===setTimeout)return setTimeout($,0);if((j2===u5||!j2)&&setTimeout)return j2=setTimeout,setTimeout($,0);try{return j2($,0)}catch(q){try{return j2.call(null,$,0)}catch(Q){return j2.call(this,$,0)}}}function NV($){if(g2===clearTimeout)return clearTimeout($);if((g2===S5||!g2)&&clearTimeout)return g2=clearTimeout,clearTimeout($);try{return g2($)}catch(q){try{return g2.call(null,$)}catch(Q){return g2.call(this,$)}}}var E2=[],d1=!1,N1,D8=-1;function YV(){if(!d1||!N1)return;if(d1=!1,N1.length)E2=N1.concat(E2);else D8=-1;if(E2.length)A9()}function A9(){if(d1)return;var $=g9(YV);d1=!0;var q=E2.length;while(q){N1=E2,E2=[];while(++D81)for(var Q=1;Qn9,once:()=>c9,listenerCount:()=>d9,init:()=>r2,getMaxListeners:()=>p9,getEventListeners:()=>b9,default:()=>CV,captureRejectionSymbol:()=>u9,addAbortListener:()=>i9,EventEmitter:()=>r2});function S9($,q){var{_events:Q}=$;if(q[0]??=Error("Unhandled error."),!Q)throw q[0];var K=Q[T9];if(K)for(var J of O9.call(K))J.apply($,q);var Z=Q.error;if(!Z)throw q[0];for(var J of O9.call(Z))J.apply($,q);return!0}function LV($,q,Q,K){q.then(void 0,function(J){queueMicrotask(()=>HV($,J,Q,K))})}function HV($,q,Q,K){if(typeof $[x9]==="function")$[x9](q,Q,...K);else try{$[Y1]=!1,$.emit("error",q)}finally{$[Y1]=!0}}function E9($,q,Q){Q.warned=!0;let K=Error(`Possible EventEmitter memory leak detected. ${Q.length} ${String(q)} listeners added to [${$.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=$,K.type=q,K.count=Q.length,console.warn(K)}function _9($,q,...Q){this.removeListener($,q),q.apply(this,Q)}function c9($,q,Q){var K=Q?.signal;if(m9(K,"options.signal"),K?.aborted)throw new E5(void 0,{cause:K?.reason});let{resolve:J,reject:Z,promise:G}=$newPromiseCapability(Promise),W=(U)=>{if($.removeListener(q,B),K!=null)L8(K,"abort",V);Z(U)},B=(...U)=>{if(typeof $.removeListener==="function")$.removeListener("error",W);if(K!=null)L8(K,"abort",V);J(U)};if(P9($,q,B,{once:!0}),q!=="error"&&typeof $.once==="function")$.once("error",W);function V(){L8($,q,B),L8($,"error",W),Z(new E5(void 0,{cause:K?.reason}))}if(K!=null)P9(K,"abort",V,{once:!0});return G}function b9($,q){return $.listeners(q)}function n9($,...q){c5($,"setMaxListeners",0);var Q;if(q&&(Q=q.length))for(let K=0;KK||(Q!=null||K!=null)&&Number.isNaN($))throw RV(q,`${Q!=null?`>= ${Q}`:""}${Q!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,$)}function x6($){if(typeof $!=="function")throw TypeError("The listener must be a function")}function IV($,q){if(typeof $!=="boolean")throw m1(q,"boolean",$)}function p9($){return $?._maxListeners??k1}function i9($,q){if($===void 0)throw m1("signal","AbortSignal",$);if(m9($,"signal"),typeof q!=="function")throw m1("listener","function",q);let Q;if($.aborted)queueMicrotask(()=>q());else $.addEventListener("abort",q,{__proto__:null,once:!0}),Q=()=>{$.removeEventListener("abort",q)};return{__proto__:null,[Symbol.dispose](){Q?.()}}}var _5,Y1,T9,kV,DV,x9,u9,O9,k1=10,r2=function($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[Y1]=$?.captureRejections?Boolean($?.captureRejections):y0[Y1])this.emit=fV},y0,vV=function($,...q){if($==="error")return S9(this,q);var{_events:Q}=this;if(Q===void 0)return!1;var K=Q[$];if(K===void 0)return!1;let J=K.length>1?K.slice():K;for(let Z=0,{length:G}=J;Z1?K.slice():K;for(let Z=0,{length:G}=J;Z{_5=Symbol.for,Y1=Symbol("kCapture"),T9=_5("events.errorMonitor"),kV=Symbol("events.maxEventTargetListeners"),DV=Symbol("events.maxEventTargetListenersWarned"),x9=_5("nodejs.rejection"),u9=_5("nodejs.rejection"),O9=Array.prototype.slice,y0=r2.prototype={};y0._events=void 0;y0._eventsCount=0;y0._maxListeners=void 0;y0.setMaxListeners=function($){return c5($,"setMaxListeners",0),this._maxListeners=$,this};y0.constructor=r2;y0.getMaxListeners=function(){return this?._maxListeners??k1};y0.emit=vV;y0.addListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.push(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.on=y0.addListener;y0.prependListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.unshift(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.once=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.addListener($,Q),this};y0.prependOnceListener=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.prependListener($,Q),this};y0.removeListener=function($,q){x6(q);var{_events:Q}=this;if(!Q)return this;var K=Q[$];if(!K)return this;var J=K.length;let Z=-1;for(let G=J-1;G>=0;G--)if(K[G]===q||K[G].listener===q){Z=G;break}if(Z<0)return this;if(Z===0)K.shift();else K.splice(Z,1);if(K.length===0)delete Q[$],this._eventsCount--;return this};y0.off=y0.removeListener;y0.removeAllListeners=function($){var{_events:q}=this;if($&&q){if(q[$])delete q[$],this._eventsCount--}else this._events={__proto__:null};return this};y0.listeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.map((K)=>K.listener??K)};y0.rawListeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.slice()};y0.listenerCount=function($){var{_events:q}=this;if(!q)return 0;return q[$]?.length??0};y0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};y0[Y1]=!1;E5=class E5 extends Error{constructor($="The operation was aborted",q=void 0){if(q!==void 0&&typeof q!=="object")throw m1("options","Object",q);super($,q);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(r2,{captureRejections:{get(){return y0[Y1]},set($){IV($,"EventEmitter.captureRejections"),y0[Y1]=$},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return k1},set:($)=>{c5($,"defaultMaxListeners",0),k1=$}},kMaxEventTargetListeners:{value:kV,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:DV,enumerable:!1,configurable:!1,writable:!1}});Object.assign(r2,{once:c9,getEventListeners:b9,getMaxListeners:p9,setMaxListeners:n9,EventEmitter:r2,usingDomains:!1,captureRejectionSymbol:u9,errorMonitor:T9,addAbortListener:i9,init:r2,listenerCount:d9});CV=r2});var a1=N0((Bz,$$)=>{var g0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),P0=g0(($,q)=>{class Q extends Error{constructor(K){if(!Array.isArray(K))throw TypeError(`Expected input to be an Array, got ${typeof K}`);let J="";for(let Z=0;Z{q.exports={format(Q,...K){return Q.replace(/%([sdifj])/g,function(...[J,Z]){let G=K.shift();if(Z==="f")return G.toFixed(6);else if(Z==="j")return JSON.stringify(G);else if(Z==="s"&&typeof G==="object")return`${G.constructor!==Object?G.constructor.name:""} {}`.trim();else return G.toString()})},inspect(Q){switch(typeof Q){case"string":if(Q.includes("'")){if(!Q.includes('"'))return`"${Q}"`;else if(!Q.includes("`")&&!Q.includes("${"))return`\`${Q}\``}return`'${Q}'`;case"number":if(isNaN(Q))return"NaN";else if(Object.is(Q,-0))return String(Q);return Q;case"bigint":return`${String(Q)}n`;case"boolean":case"undefined":return String(Q);case"object":return"{}"}}}}),a0=g0(($,q)=>{var{format:Q,inspect:K}=o9(),{AggregateError:J}=P0(),Z=globalThis.AggregateError||J,G=Symbol("kIsNodeError"),W=["string","function","number","object","Function","Object","boolean","bigint","symbol"],B=/^([A-Z][a-z0-9]*)+$/,V={};function U(D,z){if(!D)throw new V.ERR_INTERNAL_ASSERTION(z)}function w(D){let z="",N=D.length,H=D[0]==="-"?1:0;for(;N>=H+4;N-=3)z=`_${D.slice(N-3,N)}${z}`;return`${D.slice(0,N)}${z}`}function F(D,z,N){if(typeof z==="function")return U(z.length<=N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${z.length}).`),z(...N);let H=(z.match(/%[dfijoOs]/g)||[]).length;if(U(H===N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${H}).`),N.length===0)return z;return Q(z,...N)}function M(D,z,N){if(!N)N=Error;class H extends N{constructor(...v){super(F(D,z,v))}toString(){return`${this.name} [${D}]: ${this.message}`}}Object.defineProperties(H.prototype,{name:{value:N.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${D}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),H.prototype.code=D,H.prototype[G]=!0,V[D]=H}function k(D){let z="__node_internal_"+D.name;return Object.defineProperty(D,"name",{value:z}),D}function f(D,z){if(D&&z&&D!==z){if(Array.isArray(z.errors))return z.errors.push(D),z;let N=new Z([z,D],z.message);return N.code=z.code,N}return D||z}class L extends Error{constructor(D="The operation was aborted",z=void 0){if(z!==void 0&&typeof z!=="object")throw new V.ERR_INVALID_ARG_TYPE("options","Object",z);super(D,z);this.code="ABORT_ERR",this.name="AbortError"}}M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(D,z,N)=>{if(U(typeof D==="string","'name' must be a string"),!Array.isArray(z))z=[z];let H="The ";if(D.endsWith(" argument"))H+=`${D} `;else H+=`"${D}" ${D.includes(".")?"property":"argument"} `;H+="must be ";let v=[],j=[],n=[];for(let _ of z)if(U(typeof _==="string","All expected entries have to be of type string"),W.includes(_))v.push(_.toLowerCase());else if(B.test(_))j.push(_);else U(_!=="object",'The value "object" should be written as "Object"'),n.push(_);if(j.length>0){let _=v.indexOf("object");if(_!==-1)v.splice(v,_,1),j.push("Object")}if(v.length>0){switch(v.length){case 1:H+=`of type ${v[0]}`;break;case 2:H+=`one of type ${v[0]} or ${v[1]}`;break;default:{let _=v.pop();H+=`one of type ${v.join(", ")}, or ${_}`}}if(j.length>0||n.length>0)H+=" or "}if(j.length>0){switch(j.length){case 1:H+=`an instance of ${j[0]}`;break;case 2:H+=`an instance of ${j[0]} or ${j[1]}`;break;default:{let _=j.pop();H+=`an instance of ${j.join(", ")}, or ${_}`}}if(n.length>0)H+=" or "}switch(n.length){case 0:break;case 1:if(n[0].toLowerCase()!==n[0])H+="an ";H+=`${n[0]}`;break;case 2:H+=`one of ${n[0]} or ${n[1]}`;break;default:{let _=n.pop();H+=`one of ${n.join(", ")}, or ${_}`}}if(N==null)H+=`. Received ${N}`;else if(typeof N==="function"&&N.name)H+=`. Received function ${N.name}`;else if(typeof N==="object"){var d;if((d=N.constructor)!==null&&d!==void 0&&d.name)H+=`. Received an instance of ${N.constructor.name}`;else{let _=K(N,{depth:-1});H+=`. Received ${_}`}}else{let _=K(N,{colors:!1});if(_.length>25)_=`${_.slice(0,25)}...`;H+=`. Received type ${typeof N} (${_})`}return H},TypeError),M("ERR_INVALID_ARG_VALUE",(D,z,N="is invalid")=>{let H=K(z);if(H.length>128)H=H.slice(0,128)+"...";return`The ${D.includes(".")?"property":"argument"} '${D}' ${N}. Received ${H}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(D,z,N)=>{var H;let v=N!==null&&N!==void 0&&(H=N.constructor)!==null&&H!==void 0&&H.name?`instance of ${N.constructor.name}`:`type ${typeof N}`;return`Expected ${D} to be returned from the "${z}" function but got ${v}.`},TypeError),M("ERR_MISSING_ARGS",(...D)=>{U(D.length>0,"At least one arg needs to be specified");let z,N=D.length;switch(D=(Array.isArray(D)?D:[D]).map((H)=>`"${H}"`).join(" or "),N){case 1:z+=`The ${D[0]} argument`;break;case 2:z+=`The ${D[0]} and ${D[1]} arguments`;break;default:{let H=D.pop();z+=`The ${D.join(", ")}, and ${H} arguments`}break}return`${z} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(D,z,N)=>{U(z,'Missing "range" argument');let H;if(Number.isInteger(N)&&Math.abs(N)>4294967296)H=w(String(N));else if(typeof N==="bigint"){H=String(N);let v=BigInt(2)**BigInt(32);if(N>v||N<-v)H=w(H);H+="n"}else H=K(N);return`The value of "${D}" is out of range. It must be ${z}. Received ${H}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),q.exports={AbortError:L,aggregateTwoErrors:k(f),hideStackFrames:k,codes:V}}),jV=g0(($,q)=>{Object.defineProperty($,"__esModule",{value:!0});var Q=new WeakMap,K=new WeakMap;function J(X){let P=Q.get(X);return console.assert(P!=null,"'this' is expected an Event object, but got",X),P}function Z(X){if(X.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",X.passiveListener);return}if(!X.event.cancelable)return;if(X.canceled=!0,typeof X.event.preventDefault==="function")X.event.preventDefault()}function G(X,P){Q.set(this,{eventTarget:X,event:P,eventPhase:2,currentTarget:X,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:P.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let g=Object.keys(P);for(let c=0;c0){let X=Array(arguments.length);for(let P=0;P{Object.defineProperty($,"__esModule",{value:!0});var Q=jV();class K extends Q.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let U=G.get(this);if(typeof U!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return U}}Q.defineEventAttribute(K.prototype,"abort");function J(){let U=Object.create(K.prototype);return Q.EventTarget.call(U),G.set(U,!1),U}function Z(U){if(G.get(U)!==!1)return;G.set(U,!0),U.dispatchEvent({type:"abort"})}var G=new WeakMap;if(Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class W{constructor(){B.set(this,J())}get signal(){return V(this)}abort(){Z(V(this))}}var B=new WeakMap;function V(U){let w=B.get(U);if(w==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${U===null?"null":typeof U}`);return w}if(Object.defineProperties(W.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(W.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});$.AbortController=W,$.AbortSignal=K,$.default=W,q.exports=W,q.exports.AbortController=q.exports.default=W,q.exports.AbortSignal=K}),e0=g0(($,q)=>{var Q=(t0(),X0(K2)),{format:K,inspect:J}=o9(),{codes:{ERR_INVALID_ARG_TYPE:Z}}=a0(),{kResistStopPropagation:G,AggregateError:W,SymbolDispose:B}=P0(),V=globalThis.AbortSignal||O6().AbortSignal,U=globalThis.AbortController||O6().AbortController,w=Object.getPrototypeOf(async function(){}).constructor,F=globalThis.Blob||Q.Blob,M=typeof F<"u"?function(L){return L instanceof F}:function(L){return!1},k=(L,D)=>{if(L!==void 0&&(L===null||typeof L!=="object"||!("aborted"in L)))throw new Z(D,"AbortSignal",L)},f=(L,D)=>{if(typeof L!=="function")throw new Z(D,"Function",L)};q.exports={AggregateError:W,kEmptyObject:Object.freeze({}),once(L){let D=!1;return function(...z){if(D)return;D=!0,L.apply(this,z)}},createDeferredPromise:function(){let L,D;return{promise:new Promise((z,N)=>{L=z,D=N}),resolve:L,reject:D}},promisify(L){return new Promise((D,z)=>{L((N,...H)=>{if(N)return z(N);return D(...H)})})},debuglog(){return function(){}},format:K,inspect:J,types:{isAsyncFunction(L){return L instanceof w},isArrayBufferView(L){return ArrayBuffer.isView(L)}},isBlob:M,deprecate(L,D){return L},addAbortListener:(i1(),X0(p1)).addAbortListener||function(L,D){if(L===void 0)throw new Z("signal","AbortSignal",L);k(L,"signal"),f(D,"listener");let z;if(L.aborted)queueMicrotask(()=>D());else L.addEventListener("abort",D,{__proto__:null,once:!0,[G]:!0}),z=()=>{L.removeEventListener("abort",D)};return{__proto__:null,[B](){var N;(N=z)===null||N===void 0||N()}}},AbortSignalAny:V.any||function(L){if(L.length===1)return L[0];let D=new U,z=()=>D.abort();return L.forEach((N)=>{k(N,"signals"),N.addEventListener("abort",z,{once:!0})}),D.signal.addEventListener("abort",()=>{L.forEach((N)=>N.removeEventListener("abort",z))},{once:!0}),D.signal}},q.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),P6=g0(($,q)=>{var{ArrayIsArray:Q,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:J,ArrayPrototypeMap:Z,NumberIsInteger:G,NumberIsNaN:W,NumberMAX_SAFE_INTEGER:B,NumberMIN_SAFE_INTEGER:V,NumberParseInt:U,ObjectPrototypeHasOwnProperty:w,RegExpPrototypeExec:F,String:M,StringPrototypeToUpperCase:k,StringPrototypeTrim:f}=P0(),{hideStackFrames:L,codes:{ERR_SOCKET_BAD_PORT:D,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:N,ERR_OUT_OF_RANGE:H,ERR_UNKNOWN_SIGNAL:v}}=a0(),{normalizeEncoding:j}=e0(),{isAsyncFunction:n,isArrayBufferView:d}=e0().types,_={};function X(T){return T===(T|0)}function P(T){return T===T>>>0}var g=/^[0-7]+$/,c="must be a 32-bit unsigned integer or an octal string";function h(T,t,G0){if(typeof T>"u")T=G0;if(typeof T==="string"){if(F(g,T)===null)throw new N(t,T,c);T=U(T,8)}return $0(T,t),T}var x=L((T,t,G0=V,Q0=B)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),l=L((T,t,G0=-2147483648,Q0=2147483647)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),$0=L((T,t,G0=!1)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);let Q0=G0?1:0,M0=4294967295;if(TM0)throw new H(t,`>= ${Q0} && <= ${M0}`,T)});function Z0(T,t){if(typeof T!=="string")throw new z(t,"string",T)}function F0(T,t,G0=void 0,Q0){if(typeof T!=="number")throw new z(t,"number",T);if(G0!=null&&TQ0||(G0!=null||Q0!=null)&&W(T))throw new H(t,`${G0!=null?`>= ${G0}`:""}${G0!=null&&Q0!=null?" && ":""}${Q0!=null?`<= ${Q0}`:""}`,T)}var p=L((T,t,G0)=>{if(!K(G0,T)){let Q0="must be one of: "+J(Z(G0,(M0)=>typeof M0==="string"?`'${M0}'`:M(M0)),", ");throw new N(t,T,Q0)}});function W0(T,t){if(typeof T!=="boolean")throw new z(t,"boolean",T)}function y(T,t,G0){return T==null||!w(T,t)?G0:T[t]}var i=L((T,t,G0=null)=>{let Q0=y(G0,"allowArray",!1),M0=y(G0,"allowFunction",!1);if(!y(G0,"nullable",!1)&&T===null||!Q0&&Q(T)||typeof T!=="object"&&(!M0||typeof T!=="function"))throw new z(t,"Object",T)}),U0=L((T,t)=>{if(T!=null&&typeof T!=="object"&&typeof T!=="function")throw new z(t,"a dictionary",T)}),m=L((T,t,G0=0)=>{if(!Q(T))throw new z(t,"Array",T);if(T.length{if(!d(T))throw new z(t,["Buffer","TypedArray","DataView"],T)});function E(T,t){let G0=j(t),Q0=T.length;if(G0==="hex"&&Q0%2!==0)throw new N("encoding",t,`is invalid for data of length ${Q0}`)}function a(T,t="Port",G0=!0){if(typeof T!=="number"&&typeof T!=="string"||typeof T==="string"&&f(T).length===0||+T!==+T>>>0||T>65535||T===0&&!G0)throw new D(t,T,G0);return T|0}var K0=L((T,t)=>{if(T!==void 0&&(T===null||typeof T!=="object"||!("aborted"in T)))throw new z(t,"AbortSignal",T)}),R=L((T,t)=>{if(typeof T!=="function")throw new z(t,"Function",T)}),Y=L((T,t)=>{if(typeof T!=="function"||n(T))throw new z(t,"Function",T)}),C=L((T,t)=>{if(T!==void 0)throw new z(t,"undefined",T)});function u(T,t,G0){if(!K(G0,T))throw new z(t,`('${J(G0,"|")}')`,T)}var e=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function r(T,t){if(typeof T>"u"||!F(e,T))throw new N(t,T,'must be an array or string of format "; rel=preload; as=style"')}function s(T){if(typeof T==="string")return r(T,"hints"),T;else if(Q(T)){let t=T.length,G0="";if(t===0)return G0;for(let Q0=0;Q0; rel=preload; as=style"')}q.exports={isInt32:X,isUint32:P,parseFileMode:h,validateArray:m,validateStringArray:V0,validateBooleanArray:w0,validateAbortSignalArray:S,validateBoolean:W0,validateBuffer:O,validateDictionary:U0,validateEncoding:E,validateFunction:R,validateInt32:l,validateInteger:x,validateNumber:F0,validateObject:i,validateOneOf:p,validatePlainFunction:Y,validatePort:a,validateSignalName:b,validateString:Z0,validateUint32:$0,validateUndefined:C,validateUnion:u,validateAbortSignal:K0,validateLinkHeaderValue:s}}),D1=g0(($,q)=>{q.exports=globalThis.process}),b2=g0(($,q)=>{var{SymbolAsyncIterator:Q,SymbolIterator:K,SymbolFor:J}=P0(),Z=J("nodejs.stream.destroyed"),G=J("nodejs.stream.errored"),W=J("nodejs.stream.readable"),B=J("nodejs.stream.writable"),V=J("nodejs.stream.disturbed"),U=J("nodejs.webstream.isClosedPromise"),w=J("nodejs.webstream.controllerErrorFunction");function F(y,i=!1){var U0;return!!(y&&typeof y.pipe==="function"&&typeof y.on==="function"&&(!i||typeof y.pause==="function"&&typeof y.resume==="function")&&(!y._writableState||((U0=y._readableState)===null||U0===void 0?void 0:U0.readable)!==!1)&&(!y._writableState||y._readableState))}function M(y){var i;return!!(y&&typeof y.write==="function"&&typeof y.on==="function"&&(!y._readableState||((i=y._writableState)===null||i===void 0?void 0:i.writable)!==!1))}function k(y){return!!(y&&typeof y.pipe==="function"&&y._readableState&&typeof y.on==="function"&&typeof y.write==="function")}function f(y){return y&&(y._readableState||y._writableState||typeof y.write==="function"&&typeof y.on==="function"||typeof y.pipe==="function"&&typeof y.on==="function")}function L(y){return!!(y&&!f(y)&&typeof y.pipeThrough==="function"&&typeof y.getReader==="function"&&typeof y.cancel==="function")}function D(y){return!!(y&&!f(y)&&typeof y.getWriter==="function"&&typeof y.abort==="function")}function z(y){return!!(y&&!f(y)&&typeof y.readable==="object"&&typeof y.writable==="object")}function N(y){return L(y)||D(y)||z(y)}function H(y,i){if(y==null)return!1;if(i===!0)return typeof y[Q]==="function";if(i===!1)return typeof y[K]==="function";return typeof y[Q]==="function"||typeof y[K]==="function"}function v(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!!(y.destroyed||y[Z]||m!==null&&m!==void 0&&m.destroyed)}function j(y){if(!M(y))return null;if(y.writableEnded===!0)return!0;let i=y._writableState;if(i!==null&&i!==void 0&&i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function n(y,i){if(!M(y))return null;if(y.writableFinished===!0)return!0;let U0=y._writableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.finished)!=="boolean")return null;return!!(U0.finished||i===!1&&U0.ended===!0&&U0.length===0)}function d(y){if(!F(y))return null;if(y.readableEnded===!0)return!0;let i=y._readableState;if(!i||i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function _(y,i){if(!F(y))return null;let U0=y._readableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.endEmitted)!=="boolean")return null;return!!(U0.endEmitted||i===!1&&U0.ended===!0&&U0.length===0)}function X(y){if(y&&y[W]!=null)return y[W];if(typeof(y===null||y===void 0?void 0:y.readable)!=="boolean")return null;if(v(y))return!1;return F(y)&&y.readable&&!_(y)}function P(y){if(y&&y[B]!=null)return y[B];if(typeof(y===null||y===void 0?void 0:y.writable)!=="boolean")return null;if(v(y))return!1;return M(y)&&y.writable&&!j(y)}function g(y,i){if(!f(y))return null;if(v(y))return!0;if((i===null||i===void 0?void 0:i.readable)!==!1&&X(y))return!1;if((i===null||i===void 0?void 0:i.writable)!==!1&&P(y))return!1;return!0}function c(y){var i,U0;if(!f(y))return null;if(y.writableErrored)return y.writableErrored;return(i=(U0=y._writableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function h(y){var i,U0;if(!f(y))return null;if(y.readableErrored)return y.readableErrored;return(i=(U0=y._readableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function x(y){if(!f(y))return null;if(typeof y.closed==="boolean")return y.closed;let{_writableState:i,_readableState:U0}=y;if(typeof(i===null||i===void 0?void 0:i.closed)==="boolean"||typeof(U0===null||U0===void 0?void 0:U0.closed)==="boolean")return(i===null||i===void 0?void 0:i.closed)||(U0===null||U0===void 0?void 0:U0.closed);if(typeof y._closed==="boolean"&&l(y))return y._closed;return null}function l(y){return typeof y._closed==="boolean"&&typeof y._defaultKeepAlive==="boolean"&&typeof y._removedConnection==="boolean"&&typeof y._removedContLen==="boolean"}function $0(y){return typeof y._sent100==="boolean"&&l(y)}function Z0(y){var i;return typeof y._consuming==="boolean"&&typeof y._dumped==="boolean"&&((i=y.req)===null||i===void 0?void 0:i.upgradeOrConnect)===void 0}function F0(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!m&&$0(y)||!!(m&&m.autoDestroy&&m.emitClose&&m.closed===!1)}function p(y){var i;return!!(y&&((i=y[V])!==null&&i!==void 0?i:y.readableDidRead||y.readableAborted))}function W0(y){var i,U0,m,V0,w0,S,b,O,E,a;return!!(y&&((i=(U0=(m=(V0=(w0=(S=y[G])!==null&&S!==void 0?S:y.readableErrored)!==null&&w0!==void 0?w0:y.writableErrored)!==null&&V0!==void 0?V0:(b=y._readableState)===null||b===void 0?void 0:b.errorEmitted)!==null&&m!==void 0?m:(O=y._writableState)===null||O===void 0?void 0:O.errorEmitted)!==null&&U0!==void 0?U0:(E=y._readableState)===null||E===void 0?void 0:E.errored)!==null&&i!==void 0?i:(a=y._writableState)===null||a===void 0?void 0:a.errored))}q.exports={isDestroyed:v,kIsDestroyed:Z,isDisturbed:p,kIsDisturbed:V,isErrored:W0,kIsErrored:G,isReadable:X,kIsReadable:W,kIsClosedPromise:U,kControllerErrorFunction:w,kIsWritable:B,isClosed:x,isDuplexNodeStream:k,isFinished:g,isIterable:H,isReadableNodeStream:F,isReadableStream:L,isReadableEnded:d,isReadableFinished:_,isReadableErrored:h,isNodeStream:f,isWebStream:N,isWritable:P,isWritableNodeStream:M,isWritableStream:D,isWritableEnded:j,isWritableFinished:n,isWritableErrored:c,isServerRequest:Z0,isServerResponse:$0,willEmitClose:F0,isTransformStream:z}}),s2=g0(($,q)=>{var Q=D1(),{AbortError:K,codes:J}=a0(),{ERR_INVALID_ARG_TYPE:Z,ERR_STREAM_PREMATURE_CLOSE:G}=J,{kEmptyObject:W,once:B}=e0(),{validateAbortSignal:V,validateFunction:U,validateObject:w,validateBoolean:F}=P6(),{Promise:M,PromisePrototypeThen:k,SymbolDispose:f}=P0(),{isClosed:L,isReadable:D,isReadableNodeStream:z,isReadableStream:N,isReadableFinished:H,isReadableErrored:v,isWritable:j,isWritableNodeStream:n,isWritableStream:d,isWritableFinished:_,isWritableErrored:X,isNodeStream:P,willEmitClose:g,kIsClosedPromise:c}=b2(),h;function x(p){return p.setHeader&&typeof p.abort==="function"}var l=()=>{};function $0(p,W0,y){var i,U0;if(arguments.length===2)y=W0,W0=W;else if(W0==null)W0=W;else w(W0,"options");if(U(y,"callback"),V(W0.signal,"options.signal"),y=B(y),N(p)||d(p))return Z0(p,W0,y);if(!P(p))throw new Z("stream",["ReadableStream","WritableStream","Stream"],p);let m=(i=W0.readable)!==null&&i!==void 0?i:z(p),V0=(U0=W0.writable)!==null&&U0!==void 0?U0:n(p),w0=p._writableState,S=p._readableState,b=()=>{if(!p.writable)a()},O=g(p)&&z(p)===m&&n(p)===V0,E=_(p,!1),a=()=>{if(E=!0,p.destroyed)O=!1;if(O&&(!p.readable||m))return;if(!m||K0)y.call(p)},K0=H(p,!1),R=()=>{if(K0=!0,p.destroyed)O=!1;if(O&&(!p.writable||V0))return;if(!V0||E)y.call(p)},Y=(T)=>{y.call(p,T)},C=L(p),u=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);if(m&&!K0&&z(p,!0)){if(!H(p,!1))return y.call(p,new G)}if(V0&&!E){if(!_(p,!1))return y.call(p,new G)}y.call(p)},e=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);y.call(p)},r=()=>{p.req.on("finish",a)};if(x(p)){if(p.on("complete",a),!O)p.on("abort",u);if(p.req)r();else p.on("request",r)}else if(V0&&!w0)p.on("end",b),p.on("close",b);if(!O&&typeof p.aborted==="boolean")p.on("aborted",u);if(p.on("end",R),p.on("finish",a),W0.error!==!1)p.on("error",Y);if(p.on("close",u),C)Q.nextTick(u);else if(w0!==null&&w0!==void 0&&w0.errorEmitted||S!==null&&S!==void 0&&S.errorEmitted){if(!O)Q.nextTick(e)}else if(!m&&(!O||D(p))&&(E||j(p)===!1))Q.nextTick(e);else if(!V0&&(!O||j(p))&&(K0||D(p)===!1))Q.nextTick(e);else if(S&&p.req&&p.aborted)Q.nextTick(e);let s=()=>{if(y=l,p.removeListener("aborted",u),p.removeListener("complete",a),p.removeListener("abort",u),p.removeListener("request",r),p.req)p.req.removeListener("finish",a);p.removeListener("end",b),p.removeListener("close",b),p.removeListener("finish",a),p.removeListener("end",R),p.removeListener("error",Y),p.removeListener("close",u)};if(W0.signal&&!C){let T=()=>{let t=y;s(),t.call(p,new K(void 0,{cause:W0.signal.reason}))};if(W0.signal.aborted)Q.nextTick(T);else{h=h||e0().addAbortListener;let t=h(W0.signal,T),G0=y;y=B((...Q0)=>{t[f](),G0.apply(p,Q0)})}}return s}function Z0(p,W0,y){let i=!1,U0=l;if(W0.signal)if(U0=()=>{i=!0,y.call(p,new K(void 0,{cause:W0.signal.reason}))},W0.signal.aborted)Q.nextTick(U0);else{h=h||e0().addAbortListener;let V0=h(W0.signal,U0),w0=y;y=B((...S)=>{V0[f](),w0.apply(p,S)})}let m=(...V0)=>{if(!i)Q.nextTick(()=>y.apply(p,V0))};return k(p[c].promise,m,m),l}function F0(p,W0){var y;let i=!1;if(W0===null)W0=W;if((y=W0)!==null&&y!==void 0&&y.cleanup)F(W0.cleanup,"cleanup"),i=W0.cleanup;return new M((U0,m)=>{let V0=$0(p,W0,(w0)=>{if(i)V0();if(w0)m(w0);else U0()})})}q.exports=$0,q.exports.finished=F0}),o1=g0(($,q)=>{var Q=D1(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:J},AbortError:Z}=a0(),{Symbol:G}=P0(),{kIsDestroyed:W,isDestroyed:B,isFinished:V,isServerRequest:U}=b2(),w=G("kDestroy"),F=G("kConstruct");function M(g,c,h){if(g){if(g.stack,c&&!c.errored)c.errored=g;if(h&&!h.errored)h.errored=g}}function k(g,c){let h=this._readableState,x=this._writableState,l=x||h;if(x!==null&&x!==void 0&&x.destroyed||h!==null&&h!==void 0&&h.destroyed){if(typeof c==="function")c();return this}if(M(g,x,h),x)x.destroyed=!0;if(h)h.destroyed=!0;if(!l.constructed)this.once(w,function($0){f(this,K($0,g),c)});else f(this,g,c);return this}function f(g,c,h){let x=!1;function l($0){if(x)return;x=!0;let{_readableState:Z0,_writableState:F0}=g;if(M($0,F0,Z0),F0)F0.closed=!0;if(Z0)Z0.closed=!0;if(typeof h==="function")h($0);if($0)Q.nextTick(L,g,$0);else Q.nextTick(D,g)}try{g._destroy(c||null,l)}catch($0){l($0)}}function L(g,c){z(g,c),D(g)}function D(g){let{_readableState:c,_writableState:h}=g;if(h)h.closeEmitted=!0;if(c)c.closeEmitted=!0;if(h!==null&&h!==void 0&&h.emitClose||c!==null&&c!==void 0&&c.emitClose)g.emit("close")}function z(g,c){let{_readableState:h,_writableState:x}=g;if(x!==null&&x!==void 0&&x.errorEmitted||h!==null&&h!==void 0&&h.errorEmitted)return;if(x)x.errorEmitted=!0;if(h)h.errorEmitted=!0;g.emit("error",c)}function N(){let g=this._readableState,c=this._writableState;if(g)g.constructed=!0,g.closed=!1,g.closeEmitted=!1,g.destroyed=!1,g.errored=null,g.errorEmitted=!1,g.reading=!1,g.ended=g.readable===!1,g.endEmitted=g.readable===!1;if(c)c.constructed=!0,c.destroyed=!1,c.closed=!1,c.closeEmitted=!1,c.errored=null,c.errorEmitted=!1,c.finalCalled=!1,c.prefinished=!1,c.ended=c.writable===!1,c.ending=c.writable===!1,c.finished=c.writable===!1}function H(g,c,h){let{_readableState:x,_writableState:l}=g;if(l!==null&&l!==void 0&&l.destroyed||x!==null&&x!==void 0&&x.destroyed)return this;if(x!==null&&x!==void 0&&x.autoDestroy||l!==null&&l!==void 0&&l.autoDestroy)g.destroy(c);else if(c){if(c.stack,l&&!l.errored)l.errored=c;if(x&&!x.errored)x.errored=c;if(h)Q.nextTick(z,g,c);else z(g,c)}}function v(g,c){if(typeof g._construct!=="function")return;let{_readableState:h,_writableState:x}=g;if(h)h.constructed=!1;if(x)x.constructed=!1;if(g.once(F,c),g.listenerCount(F)>1)return;Q.nextTick(j,g)}function j(g){let c=!1;function h(x){if(c){H(g,x!==null&&x!==void 0?x:new J);return}c=!0;let{_readableState:l,_writableState:$0}=g,Z0=$0||l;if(l)l.constructed=!0;if($0)$0.constructed=!0;if(Z0.destroyed)g.emit(w,x);else if(x)H(g,x,!0);else Q.nextTick(n,g)}try{g._construct((x)=>{Q.nextTick(h,x)})}catch(x){Q.nextTick(h,x)}}function n(g){g.emit(F)}function d(g){return(g===null||g===void 0?void 0:g.setHeader)&&typeof g.abort==="function"}function _(g){g.emit("close")}function X(g,c){g.emit("error",c),Q.nextTick(_,g)}function P(g,c){if(!g||B(g))return;if(!c&&!V(g))c=new Z;if(U(g))g.socket=null,g.destroy(c);else if(d(g))g.abort();else if(d(g.req))g.req.abort();else if(typeof g.destroy==="function")g.destroy(c);else if(typeof g.close==="function")g.close();else if(c)Q.nextTick(X,g,c);else Q.nextTick(_,g);if(!g.destroyed)g[W]=!0}q.exports={construct:v,destroyer:P,destroy:k,undestroy:N,errorOrDestroy:H}}),b5=g0(($,q)=>{var{ArrayIsArray:Q,ObjectSetPrototypeOf:K}=P0(),{EventEmitter:J}=(i1(),X0(p1));function Z(W){J.call(this,W)}K(Z.prototype,J.prototype),K(Z,J),Z.prototype.pipe=function(W,B){let V=this;function U(D){if(W.writable&&W.write(D)===!1&&V.pause)V.pause()}V.on("data",U);function w(){if(V.readable&&V.resume)V.resume()}if(W.on("drain",w),!W._isStdio&&(!B||B.end!==!1))V.on("end",M),V.on("close",k);let F=!1;function M(){if(F)return;F=!0,W.end()}function k(){if(F)return;if(F=!0,typeof W.destroy==="function")W.destroy()}function f(D){if(L(),J.listenerCount(this,"error")===0)this.emit("error",D)}G(V,"error",f),G(W,"error",f);function L(){V.removeListener("data",U),W.removeListener("drain",w),V.removeListener("end",M),V.removeListener("close",k),V.removeListener("error",f),W.removeListener("error",f),V.removeListener("end",L),V.removeListener("close",L),W.removeListener("close",L)}return V.on("end",L),V.on("close",L),W.on("close",L),W.emit("pipe",V),W};function G(W,B,V){if(typeof W.prependListener==="function")return W.prependListener(B,V);if(!W._events||!W._events[B])W.on(B,V);else if(Q(W._events[B]))W._events[B].unshift(V);else W._events[B]=[V,W._events[B]]}q.exports={Stream:Z,prependListener:G}}),H8=g0(($,q)=>{var{SymbolDispose:Q}=P0(),{AbortError:K,codes:J}=a0(),{isNodeStream:Z,isWebStream:G,kControllerErrorFunction:W}=b2(),B=s2(),{ERR_INVALID_ARG_TYPE:V}=J,U,w=(F,M)=>{if(typeof F!=="object"||!("aborted"in F))throw new V(M,"AbortSignal",F)};q.exports.addAbortSignal=function(F,M){if(w(F,"signal"),!Z(M)&&!G(M))throw new V("stream",["ReadableStream","WritableStream","Stream"],M);return q.exports.addAbortSignalNoValidate(F,M)},q.exports.addAbortSignalNoValidate=function(F,M){if(typeof F!=="object"||!("aborted"in F))return M;let k=Z(M)?()=>{M.destroy(new K(void 0,{cause:F.reason}))}:()=>{M[W](new K(void 0,{cause:F.reason}))};if(F.aborted)k();else{U=U||e0().addAbortListener;let f=U(F,k);B(M,f[Q])}return M}}),gV=g0(($,q)=>{var{StringPrototypeSlice:Q,SymbolIterator:K,TypedArrayPrototypeSet:J,Uint8Array:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{inspect:W}=e0();q.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(B){let V={data:B,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length}unshift(B){let V={data:B,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length}shift(){if(this.length===0)return;let B=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,B}clear(){this.head=this.tail=null,this.length=0}join(B){if(this.length===0)return"";let V=this.head,U=""+V.data;while((V=V.next)!==null)U+=B+V.data;return U}concat(B){if(this.length===0)return G.alloc(0);let V=G.allocUnsafe(B>>>0),U=this.head,w=0;while(U)J(V,U.data,w),w+=U.data.length,U=U.next;return V}consume(B,V){let U=this.head.data;if(BF.length)V+=F,B-=F.length;else{if(B===F.length)if(V+=F,++w,U.next)this.head=U.next;else this.head=this.tail=null;else V+=Q(F,0,B),this.head=U,U.data=Q(F,B);break}++w}while((U=U.next)!==null);return this.length-=w,V}_getBuffer(B){let V=G.allocUnsafe(B),U=B,w=this.head,F=0;do{let M=w.data;if(B>M.length)J(V,M,U-B),B-=M.length;else{if(B===M.length)if(J(V,M,U-B),++F,w.next)this.head=w.next;else this.head=this.tail=null;else J(V,new Z(M.buffer,M.byteOffset,B),U-B),this.head=w,w.data=M.slice(B);break}++F}while((w=w.next)!==null);return this.length-=F,V}[Symbol.for("nodejs.util.inspect.custom")](B,V){return W(this,{...V,depth:0,customInspect:!1})}}}),v8=g0(($,q)=>{var{MathFloor:Q,NumberIsInteger:K}=P0(),{validateInteger:J}=P6(),{ERR_INVALID_ARG_VALUE:Z}=a0().codes,G=16384,W=16;function B(F,M,k){return F.highWaterMark!=null?F.highWaterMark:M?F[k]:null}function V(F){return F?W:G}function U(F,M){if(J(M,"value",0),F)W=M;else G=M}function w(F,M,k,f){let L=B(M,f,k);if(L!=null){if(!K(L)||L<0){let D=f?`options.${k}`:"options.highWaterMark";throw new Z(D,L)}return Q(L)}return V(F.objectMode)}q.exports={getHighWaterMark:w,getDefaultHighWaterMark:V,setDefaultHighWaterMark:U}}),AV=g0(($,q)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),XV=g0(($)=>{var q=AV().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),a9=g0(($,q)=>{var Q=D1(),{PromisePrototypeThen:K,SymbolAsyncIterator:J,SymbolIterator:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{ERR_INVALID_ARG_TYPE:W,ERR_STREAM_NULL_VALUES:B}=a0().codes;function V(U,w,F){let M;if(typeof w==="string"||w instanceof G)return new U({objectMode:!0,...F,read(){this.push(w),this.push(null)}});let k;if(w&&w[J])k=!0,M=w[J]();else if(w&&w[Z])k=!1,M=w[Z]();else throw new W("iterable",["Iterable"],w);let f=new U({objectMode:!0,highWaterMark:1,...F}),L=!1;f._read=function(){if(!L)L=!0,z()},f._destroy=function(N,H){K(D(N),()=>Q.nextTick(H,N),(v)=>Q.nextTick(H,v||N))};async function D(N){let H=N!==void 0&&N!==null,v=typeof M.throw==="function";if(H&&v){let{value:j,done:n}=await M.throw(N);if(await j,n)return}if(typeof M.return==="function"){let{value:j}=await M.return();await j}}async function z(){for(;;){try{let{value:N,done:H}=k?await M.next():M.next();if(H)f.push(null);else{let v=N&&typeof N.then==="function"?await N:N;if(v===null)throw L=!1,new B;else if(f.push(v))continue;else L=!1}}catch(N){f.destroy(N)}break}}return f}q.exports=V}),f8=g0(($,q)=>{var Q=D1(),{ArrayPrototypeIndexOf:K,NumberIsInteger:J,NumberIsNaN:Z,NumberParseInt:G,ObjectDefineProperties:W,ObjectKeys:B,ObjectSetPrototypeOf:V,Promise:U,SafeSet:w,SymbolAsyncDispose:F,SymbolAsyncIterator:M,Symbol:k}=P0();q.exports=Q0,Q0.ReadableState=G0;var{EventEmitter:f}=(i1(),X0(p1)),{Stream:L,prependListener:D}=b5(),{Buffer:z}=(t0(),X0(K2)),{addAbortSignal:N}=H8(),H=s2(),v=e0().debuglog("stream",(I)=>{v=I}),j=gV(),n=o1(),{getHighWaterMark:d,getDefaultHighWaterMark:_}=v8(),{aggregateTwoErrors:X,codes:{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:g,ERR_OUT_OF_RANGE:c,ERR_STREAM_PUSH_AFTER_EOF:h,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:x},AbortError:l}=a0(),{validateObject:$0}=P6(),Z0=k("kPaused"),{StringDecoder:F0}=XV(),p=a9();V(Q0.prototype,L.prototype),V(Q0,L);var W0=()=>{},{errorOrDestroy:y}=n,i=1,U0=2,m=4,V0=8,w0=16,S=32,b=64,O=128,E=256,a=512,K0=1024,R=2048,Y=4096,C=8192,u=16384,e=32768,r=65536,s=131072,T=262144;function t(I){return{enumerable:!1,get(){return(this.state&I)!==0},set(A){if(A)this.state|=I;else this.state&=~I}}}W(G0.prototype,{objectMode:t(i),ended:t(U0),endEmitted:t(m),reading:t(V0),constructed:t(w0),sync:t(S),needReadable:t(b),emittedReadable:t(O),readableListening:t(E),resumeScheduled:t(a),errorEmitted:t(K0),emitClose:t(R),autoDestroy:t(Y),destroyed:t(C),closed:t(u),closeEmitted:t(e),multiAwaitDrain:t(r),readingMore:t(s),dataEmitted:t(T)});function G0(I,A,J0){if(typeof J0!=="boolean")J0=A instanceof c2();if(this.state=R|Y|w0|S,I&&I.objectMode)this.state|=i;if(J0&&I&&I.readableObjectMode)this.state|=i;if(this.highWaterMark=I?d(this,I,"readableHighWaterMark",J0):_(!1),this.buffer=new j,this.length=0,this.pipes=[],this.flowing=null,this[Z0]=null,I&&I.emitClose===!1)this.state&=~R;if(I&&I.autoDestroy===!1)this.state&=~Y;if(this.errored=null,this.defaultEncoding=I&&I.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,I&&I.encoding)this.decoder=new F0(I.encoding),this.encoding=I.encoding}function Q0(I){if(!(this instanceof Q0))return new Q0(I);let A=this instanceof c2();if(this._readableState=new G0(I,this,A),I){if(typeof I.read==="function")this._read=I.read;if(typeof I.destroy==="function")this._destroy=I.destroy;if(typeof I.construct==="function")this._construct=I.construct;if(I.signal&&!A)N(I.signal,this)}L.call(this,I),n.construct(this,()=>{if(this._readableState.needReadable)_1(this,this._readableState)})}Q0.prototype.destroy=n.destroy,Q0.prototype._undestroy=n.undestroy,Q0.prototype._destroy=function(I,A){A(I)},Q0.prototype[f.captureRejectionSymbol]=function(I){this.destroy(I)},Q0.prototype[F]=function(){let I;if(!this.destroyed)I=this.readableEnded?null:new l,this.destroy(I);return new U((A,J0)=>H(this,(B0)=>B0&&B0!==I?J0(B0):A(null)))},Q0.prototype.push=function(I,A){return M0(this,I,A,!1)},Q0.prototype.unshift=function(I,A){return M0(this,I,A,!0)};function M0(I,A,J0,B0){v("readableAddChunk",A);let z0=I._readableState,i0;if((z0.state&i)===0){if(typeof A==="string"){if(J0=J0||z0.defaultEncoding,z0.encoding!==J0)if(B0&&z0.encoding)A=z.from(A,J0).toString(z0.encoding);else A=z.from(A,J0),J0=""}else if(A instanceof z)J0="";else if(L._isUint8Array(A))A=L._uint8ArrayToBuffer(A),J0="";else if(A!=null)i0=new P("chunk",["string","Buffer","Uint8Array"],A)}if(i0)y(I,i0);else if(A===null)z0.state&=~V0,O0(I,z0);else if((z0.state&i)!==0||A&&A.length>0)if(B0)if((z0.state&m)!==0)y(I,new x);else if(z0.destroyed||z0.errored)return!1;else I0(I,z0,A,!0);else if(z0.ended)y(I,new h);else if(z0.destroyed||z0.errored)return!1;else if(z0.state&=~V0,z0.decoder&&!J0)if(A=z0.decoder.write(A),z0.objectMode||A.length!==0)I0(I,z0,A,!1);else _1(I,z0);else I0(I,z0,A,!1);else if(!B0)z0.state&=~V0,_1(I,z0);return!z0.ended&&(z0.length0){if((A.state&r)!==0)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;A.dataEmitted=!0,I.emit("data",J0)}else{if(A.length+=A.objectMode?1:J0.length,B0)A.buffer.unshift(J0);else A.buffer.push(J0);if((A.state&b)!==0)u0(I)}_1(I,A)}Q0.prototype.isPaused=function(){let I=this._readableState;return I[Z0]===!0||I.flowing===!1},Q0.prototype.setEncoding=function(I){let A=new F0(I);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;let J0=this._readableState.buffer,B0="";for(let z0 of J0)B0+=A.write(z0);if(J0.clear(),B0!=="")J0.push(B0);return this._readableState.length=B0.length,this};var m0=1073741824;function p0(I){if(I>m0)throw new c("size","<= 1GiB",I);else I--,I|=I>>>1,I|=I>>>2,I|=I>>>4,I|=I>>>8,I|=I>>>16,I++;return I}function q2(I,A){if(I<=0||A.length===0&&A.ended)return 0;if((A.state&i)!==0)return 1;if(Z(I)){if(A.flowing&&A.length)return A.buffer.first().length;return A.length}if(I<=A.length)return I;return A.ended?A.length:0}Q0.prototype.read=function(I){if(v("read",I),I===void 0)I=NaN;else if(!J(I))I=G(I,10);let A=this._readableState,J0=I;if(I>A.highWaterMark)A.highWaterMark=p0(I);if(I!==0)A.state&=~O;if(I===0&&A.needReadable&&((A.highWaterMark!==0?A.length>=A.highWaterMark:A.length>0)||A.ended)){if(v("read: emitReadable",A.length,A.ended),A.length===0&&A.ended)f5(this);else u0(this);return null}if(I=q2(I,A),I===0&&A.ended){if(A.length===0)f5(this);return null}let B0=(A.state&b)!==0;if(v("need readable",B0),A.length===0||A.length-I0)z0=l7(I,A);else z0=null;if(z0===null)A.needReadable=A.length<=A.highWaterMark,I=0;else if(A.length-=I,A.multiAwaitDrain)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;if(A.length===0){if(!A.ended)A.needReadable=!0;if(J0!==I&&A.ended)f5(this)}if(z0!==null&&!A.errorEmitted&&!A.closeEmitted)A.dataEmitted=!0,this.emit("data",z0);return z0};function O0(I,A){if(v("onEofChunk"),A.ended)return;if(A.decoder){let J0=A.decoder.end();if(J0&&J0.length)A.buffer.push(J0),A.length+=A.objectMode?1:J0.length}if(A.ended=!0,A.sync)u0(I);else A.needReadable=!1,A.emittedReadable=!0,E1(I)}function u0(I){let A=I._readableState;if(v("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,!A.emittedReadable)v("emitReadable",A.flowing),A.emittedReadable=!0,Q.nextTick(E1,I)}function E1(I){let A=I._readableState;if(v("emitReadable_",A.destroyed,A.length,A.ended),!A.destroyed&&!A.errored&&(A.length||A.ended))I.emit("readable"),A.emittedReadable=!1;A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,o7(I)}function _1(I,A){if(!A.readingMore&&A.constructed)A.readingMore=!0,Q.nextTick(R2,I,A)}function R2(I,A){while(!A.reading&&!A.ended&&(A.length1&&B0.pipes.includes(I))v("false write response, pause",B0.awaitDrainWriters.size),B0.awaitDrainWriters.add(I);J0.pause()}if(!z1)z1=wJ(J0,I),I.on("drain",z1)}J0.on("data",e7);function e7(F1){v("ondata");let u2=I.write(F1);if(v("dest.write",u2),u2===!1)t7()}function I5(F1){if(v("onerror",F1),A6(),I.removeListener("error",I5),I.listenerCount("error")===0){let u2=I._writableState||I._readableState;if(u2&&!u2.errorEmitted)y(I,F1);else I.emit("error",F1)}}D(I,"error",I5);function C5(){I.removeListener("finish",j5),A6()}I.once("close",C5);function j5(){v("onfinish"),I.removeListener("close",C5),A6()}I.once("finish",j5);function A6(){v("unpipe"),J0.unpipe(I)}if(I.emit("pipe",J0),I.writableNeedDrain===!0)t7();else if(!B0.flowing)v("pipe resume"),J0.resume();return I};function wJ(I,A){return function(){let J0=I._readableState;if(J0.awaitDrainWriters===A)v("pipeOnDrain",1),J0.awaitDrainWriters=null;else if(J0.multiAwaitDrain)v("pipeOnDrain",J0.awaitDrainWriters.size),J0.awaitDrainWriters.delete(A);if((!J0.awaitDrainWriters||J0.awaitDrainWriters.size===0)&&I.listenerCount("data"))I.resume()}}Q0.prototype.unpipe=function(I){let A=this._readableState,J0={hasUnpiped:!1};if(A.pipes.length===0)return this;if(!I){let z0=A.pipes;A.pipes=[],this.pause();for(let i0=0;i00,B0.flowing!==!1)this.resume()}else if(I==="readable"){if(!B0.endEmitted&&!B0.readableListening){if(B0.readableListening=B0.needReadable=!0,B0.flowing=!1,B0.emittedReadable=!1,v("on readable",B0.length,B0.reading),B0.length)u0(this);else if(!B0.reading)Q.nextTick(NJ,this)}}return J0},Q0.prototype.addListener=Q0.prototype.on,Q0.prototype.removeListener=function(I,A){let J0=L.prototype.removeListener.call(this,I,A);if(I==="readable")Q.nextTick(i7,this);return J0},Q0.prototype.off=Q0.prototype.removeListener,Q0.prototype.removeAllListeners=function(I){let A=L.prototype.removeAllListeners.apply(this,arguments);if(I==="readable"||I===void 0)Q.nextTick(i7,this);return A};function i7(I){let A=I._readableState;if(A.readableListening=I.listenerCount("readable")>0,A.resumeScheduled&&A[Z0]===!1)A.flowing=!0;else if(I.listenerCount("data")>0)I.resume();else if(!A.readableListening)A.flowing=null}function NJ(I){v("readable nexttick read 0"),I.read(0)}Q0.prototype.resume=function(){let I=this._readableState;if(!I.flowing)v("resume"),I.flowing=!I.readableListening,YJ(this,I);return I[Z0]=!1,this};function YJ(I,A){if(!A.resumeScheduled)A.resumeScheduled=!0,Q.nextTick(kJ,I,A)}function kJ(I,A){if(v("resume",A.reading),!A.reading)I.read(0);if(A.resumeScheduled=!1,I.emit("resume"),o7(I),A.flowing&&!A.reading)I.read(0)}Q0.prototype.pause=function(){if(v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)v("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[Z0]=!0,this};function o7(I){let A=I._readableState;v("flow",A.flowing);while(A.flowing&&I.read()!==null);}Q0.prototype.wrap=function(I){let A=!1;I.on("data",(B0)=>{if(!this.push(B0)&&I.pause)A=!0,I.pause()}),I.on("end",()=>{this.push(null)}),I.on("error",(B0)=>{y(this,B0)}),I.on("close",()=>{this.destroy()}),I.on("destroy",()=>{this.destroy()}),this._read=()=>{if(A&&I.resume)A=!1,I.resume()};let J0=B(I);for(let B0=1;B0{z0=z2?X(z0,z2):null,J0(),J0=W0});try{while(!0){let z2=I.destroyed?null:I.read();if(z2!==null)yield z2;else if(z0)throw z0;else if(z0===null)return;else await new U(B0)}}catch(z2){throw z0=X(z0,z2),z0}finally{if((z0||(A===null||A===void 0?void 0:A.destroyOnReturn)!==!1)&&(z0===void 0||I._readableState.autoDestroy))n.destroyer(I,null);else I.off("readable",B0),i0()}}W(Q0.prototype,{readable:{__proto__:null,get(){let I=this._readableState;return!!I&&I.readable!==!1&&!I.destroyed&&!I.errorEmitted&&!I.endEmitted},set(I){if(this._readableState)this._readableState.readable=!!I}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(I){if(this._readableState)this._readableState.flowing=I}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(I){if(!this._readableState)return;this._readableState.destroyed=I}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),W(G0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Z0]!==!1},set(I){this[Z0]=!!I}}}),Q0._fromList=l7;function l7(I,A){if(A.length===0)return null;let J0;if(A.objectMode)J0=A.buffer.shift();else if(!I||I>=A.length){if(A.decoder)J0=A.buffer.join("");else if(A.buffer.length===1)J0=A.buffer.first();else J0=A.buffer.concat(A.length);A.buffer.clear()}else J0=A.buffer.consume(I,A.decoder);return J0}function f5(I){let A=I._readableState;if(v("endReadable",A.endEmitted),!A.endEmitted)A.ended=!0,Q.nextTick(LJ,A,I)}function LJ(I,A){if(v("endReadableNT",I.endEmitted,I.length),!I.errored&&!I.closeEmitted&&!I.endEmitted&&I.length===0){if(I.endEmitted=!0,A.emit("end"),A.writable&&A.allowHalfOpen===!1)Q.nextTick(HJ,A);else if(I.autoDestroy){let J0=A._writableState;if(!J0||J0.autoDestroy&&(J0.finished||J0.writable===!1))A.destroy()}}}function HJ(I){if(I.writable&&!I.writableEnded&&!I.destroyed)I.end()}Q0.from=function(I,A){return p(Q0,I,A)};var R5;function r7(){if(R5===void 0)R5={};return R5}Q0.fromWeb=function(I,A){return r7().newStreamReadableFromReadableStream(I,A)},Q0.toWeb=function(I,A){return r7().newReadableStreamFromStreamReadable(I,A)},Q0.wrap=function(I,A){var J0,B0;return new Q0({objectMode:(J0=(B0=I.readableObjectMode)!==null&&B0!==void 0?B0:I.objectMode)!==null&&J0!==void 0?J0:!0,...A,destroy(z0,i0){n.destroyer(I,z0),i0(z0)}}).wrap(I)}}),n5=g0(($,q)=>{var Q=D1(),{ArrayPrototypeSlice:K,Error:J,FunctionPrototypeSymbolHasInstance:Z,ObjectDefineProperty:G,ObjectDefineProperties:W,ObjectSetPrototypeOf:B,StringPrototypeToLowerCase:V,Symbol:U,SymbolHasInstance:w}=P0();q.exports=$0,$0.WritableState=x;var{EventEmitter:F}=(i1(),X0(p1)),M=b5().Stream,{Buffer:k}=(t0(),X0(K2)),f=o1(),{addAbortSignal:L}=H8(),{getHighWaterMark:D,getDefaultHighWaterMark:z}=v8(),{ERR_INVALID_ARG_TYPE:N,ERR_METHOD_NOT_IMPLEMENTED:H,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:j,ERR_STREAM_DESTROYED:n,ERR_STREAM_ALREADY_FINISHED:d,ERR_STREAM_NULL_VALUES:_,ERR_STREAM_WRITE_AFTER_END:X,ERR_UNKNOWN_ENCODING:P}=a0().codes,{errorOrDestroy:g}=f;B($0.prototype,M.prototype),B($0,M);function c(){}var h=U("kOnFinished");function x(Y,C,u){if(typeof u!=="boolean")u=C instanceof c2();if(this.objectMode=!!(Y&&Y.objectMode),u)this.objectMode=this.objectMode||!!(Y&&Y.writableObjectMode);this.highWaterMark=Y?D(this,Y,"writableHighWaterMark",u):z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let e=!!(Y&&Y.decodeStrings===!1);this.decodeStrings=!e,this.defaultEncoding=Y&&Y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=y.bind(void 0,C),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,l(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!Y||Y.emitClose!==!1,this.autoDestroy=!Y||Y.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[h]=[]}function l(Y){Y.buffered=[],Y.bufferedIndex=0,Y.allBuffers=!0,Y.allNoop=!0}x.prototype.getBuffer=function(){return K(this.buffered,this.bufferedIndex)},G(x.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function $0(Y){let C=this instanceof c2();if(!C&&!Z($0,this))return new $0(Y);if(this._writableState=new x(Y,this,C),Y){if(typeof Y.write==="function")this._write=Y.write;if(typeof Y.writev==="function")this._writev=Y.writev;if(typeof Y.destroy==="function")this._destroy=Y.destroy;if(typeof Y.final==="function")this._final=Y.final;if(typeof Y.construct==="function")this._construct=Y.construct;if(Y.signal)L(Y.signal,this)}M.call(this,Y),f.construct(this,()=>{let u=this._writableState;if(!u.writing)V0(this,u);O(this,u)})}G($0,w,{__proto__:null,value:function(Y){if(Z(this,Y))return!0;if(this!==$0)return!1;return Y&&Y._writableState instanceof x}}),$0.prototype.pipe=function(){g(this,new j)};function Z0(Y,C,u,e){let r=Y._writableState;if(typeof u==="function")e=u,u=r.defaultEncoding;else{if(!u)u=r.defaultEncoding;else if(u!=="buffer"&&!k.isEncoding(u))throw new P(u);if(typeof e!=="function")e=c}if(C===null)throw new _;else if(!r.objectMode)if(typeof C==="string"){if(r.decodeStrings!==!1)C=k.from(C,u),u="buffer"}else if(C instanceof k)u="buffer";else if(M._isUint8Array(C))C=M._uint8ArrayToBuffer(C),u="buffer";else throw new N("chunk",["string","Buffer","Uint8Array"],C);let s;if(r.ending)s=new X;else if(r.destroyed)s=new n("write");if(s)return Q.nextTick(e,s),g(Y,s,!0),s;return r.pendingcb++,F0(Y,r,C,u,e)}$0.prototype.write=function(Y,C,u){return Z0(this,Y,C,u)===!0},$0.prototype.cork=function(){this._writableState.corked++},$0.prototype.uncork=function(){let Y=this._writableState;if(Y.corked){if(Y.corked--,!Y.writing)V0(this,Y)}},$0.prototype.setDefaultEncoding=function(Y){if(typeof Y==="string")Y=V(Y);if(!k.isEncoding(Y))throw new P(Y);return this._writableState.defaultEncoding=Y,this};function F0(Y,C,u,e,r){let s=C.objectMode?1:u.length;C.length+=s;let T=C.lengthu.bufferedIndex)V0(Y,u);if(e)if(u.afterWriteTickInfo!==null&&u.afterWriteTickInfo.cb===r)u.afterWriteTickInfo.count++;else u.afterWriteTickInfo={count:1,cb:r,stream:Y,state:u},Q.nextTick(i,u.afterWriteTickInfo);else U0(Y,u,1,r)}}function i({stream:Y,state:C,count:u,cb:e}){return C.afterWriteTickInfo=null,U0(Y,C,u,e)}function U0(Y,C,u,e){if(!C.ending&&!Y.destroyed&&C.length===0&&C.needDrain)C.needDrain=!1,Y.emit("drain");while(u-- >0)C.pendingcb--,e();if(C.destroyed)m(C);O(Y,C)}function m(Y){if(Y.writing)return;for(let r=Y.bufferedIndex;r1&&Y._writev){C.pendingcb-=s-1;let t=C.allNoop?c:(Q0)=>{for(let M0=T;M0256)u.splice(0,T),C.bufferedIndex=0;else C.bufferedIndex=T}C.bufferProcessing=!1}$0.prototype._write=function(Y,C,u){if(this._writev)this._writev([{chunk:Y,encoding:C}],u);else throw new H("_write()")},$0.prototype._writev=null,$0.prototype.end=function(Y,C,u){let e=this._writableState;if(typeof Y==="function")u=Y,Y=null,C=null;else if(typeof C==="function")u=C,C=null;let r;if(Y!==null&&Y!==void 0){let s=Z0(this,Y,C);if(s instanceof J)r=s}if(e.corked)e.corked=1,this.uncork();if(r);else if(!e.errored&&!e.ending)e.ending=!0,O(this,e,!0),e.ended=!0;else if(e.finished)r=new d("end");else if(e.destroyed)r=new n("end");if(typeof u==="function")if(r||e.finished)Q.nextTick(u,r);else e[h].push(u);return this};function w0(Y){return Y.ending&&!Y.destroyed&&Y.constructed&&Y.length===0&&!Y.errored&&Y.buffered.length===0&&!Y.finished&&!Y.writing&&!Y.errorEmitted&&!Y.closeEmitted}function S(Y,C){let u=!1;function e(r){if(u){g(Y,r!==null&&r!==void 0?r:v());return}if(u=!0,C.pendingcb--,r){let s=C[h].splice(0);for(let T=0;T{if(w0(r))E(e,r);else r.pendingcb--},Y,C);else if(w0(C))C.pendingcb++,E(Y,C)}}}function E(Y,C){C.pendingcb--,C.finished=!0;let u=C[h].splice(0);for(let e=0;e{var Q=D1(),K=(t0(),X0(K2)),{isReadable:J,isWritable:Z,isIterable:G,isNodeStream:W,isReadableNodeStream:B,isWritableNodeStream:V,isDuplexNodeStream:U,isReadableStream:w,isWritableStream:F}=b2(),M=s2(),{AbortError:k,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:L}}=a0(),{destroyer:D}=o1(),z=c2(),N=f8(),H=n5(),{createDeferredPromise:v}=e0(),j=a9(),n=globalThis.Blob||K.Blob,d=typeof n<"u"?function(h){return h instanceof n}:function(h){return!1},_=globalThis.AbortController||O6().AbortController,{FunctionPrototypeCall:X}=P0();class P extends z{constructor(h){super(h);if((h===null||h===void 0?void 0:h.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((h===null||h===void 0?void 0:h.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}q.exports=function h(x,l){if(U(x))return x;if(B(x))return c({readable:x});if(V(x))return c({writable:x});if(W(x))return c({writable:!1,readable:!1});if(w(x))return c({readable:N.fromWeb(x)});if(F(x))return c({writable:H.fromWeb(x)});if(typeof x==="function"){let{value:Z0,write:F0,final:p,destroy:W0}=g(x);if(G(Z0))return j(P,Z0,{objectMode:!0,write:F0,final:p,destroy:W0});let y=Z0===null||Z0===void 0?void 0:Z0.then;if(typeof y==="function"){let i,U0=X(y,Z0,(m)=>{if(m!=null)throw new L("nully","body",m)},(m)=>{D(i,m)});return i=new P({objectMode:!0,readable:!1,write:F0,final(m){p(async()=>{try{await U0,Q.nextTick(m,null)}catch(V0){Q.nextTick(m,V0)}})},destroy:W0})}throw new L("Iterable, AsyncIterable or AsyncFunction",l,Z0)}if(d(x))return h(x.arrayBuffer());if(G(x))return j(P,x,{objectMode:!0,writable:!1});if(w(x===null||x===void 0?void 0:x.readable)&&F(x===null||x===void 0?void 0:x.writable))return P.fromWeb(x);if(typeof(x===null||x===void 0?void 0:x.writable)==="object"||typeof(x===null||x===void 0?void 0:x.readable)==="object"){let Z0=x!==null&&x!==void 0&&x.readable?B(x===null||x===void 0?void 0:x.readable)?x===null||x===void 0?void 0:x.readable:h(x.readable):void 0,F0=x!==null&&x!==void 0&&x.writable?V(x===null||x===void 0?void 0:x.writable)?x===null||x===void 0?void 0:x.writable:h(x.writable):void 0;return c({readable:Z0,writable:F0})}let $0=x===null||x===void 0?void 0:x.then;if(typeof $0==="function"){let Z0;return X($0,x,(F0)=>{if(F0!=null)Z0.push(F0);Z0.push(null)},(F0)=>{D(Z0,F0)}),Z0=new P({objectMode:!0,writable:!1,read(){}})}throw new f(l,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],x)};function g(h){let{promise:x,resolve:l}=v(),$0=new _,Z0=$0.signal;return{value:h(async function*(){while(!0){let F0=x;x=null;let{chunk:p,done:W0,cb:y}=await F0;if(Q.nextTick(y),W0)return;if(Z0.aborted)throw new k(void 0,{cause:Z0.reason});({promise:x,resolve:l}=v()),yield p}}(),{signal:Z0}),write(F0,p,W0){let y=l;l=null,y({chunk:F0,done:!1,cb:W0})},final(F0){let p=l;l=null,p({done:!0,cb:F0})},destroy(F0,p){$0.abort(),p(F0)}}}function c(h){let x=h.readable&&typeof h.readable.read!=="function"?N.wrap(h.readable):h.readable,l=h.writable,$0=!!J(x),Z0=!!Z(l),F0,p,W0,y,i;function U0(m){let V0=y;if(y=null,V0)V0(m);else if(m)i.destroy(m)}if(i=new P({readableObjectMode:!!(x!==null&&x!==void 0&&x.readableObjectMode),writableObjectMode:!!(l!==null&&l!==void 0&&l.writableObjectMode),readable:$0,writable:Z0}),Z0)M(l,(m)=>{if(Z0=!1,m)D(x,m);U0(m)}),i._write=function(m,V0,w0){if(l.write(m,V0))w0();else F0=w0},i._final=function(m){l.end(),p=m},l.on("drain",function(){if(F0){let m=F0;F0=null,m()}}),l.on("finish",function(){if(p){let m=p;p=null,m()}});if($0)M(x,(m)=>{if($0=!1,m)D(x,m);U0(m)}),x.on("readable",function(){if(W0){let m=W0;W0=null,m()}}),x.on("end",function(){i.push(null)}),i._read=function(){while(!0){let m=x.read();if(m===null){W0=i._read;return}if(!i.push(m))return}};return i._destroy=function(m,V0){if(!m&&y!==null)m=new k;if(W0=null,F0=null,p=null,y===null)V0(m);else y=V0,D(l,m),D(x,m)},i}}),c2=g0(($,q)=>{var{ObjectDefineProperties:Q,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:J,ObjectSetPrototypeOf:Z}=P0();q.exports=B;var G=f8(),W=n5();Z(B.prototype,G.prototype),Z(B,G);{let F=J(W.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:Q,Symbol:K}=P0();q.exports=B;var{ERR_METHOD_NOT_IMPLEMENTED:J}=a0().codes,Z=c2(),{getHighWaterMark:G}=v8();Q(B.prototype,Z.prototype),Q(B,Z);var W=K("kCallback");function B(w){if(!(this instanceof B))return new B(w);let F=w?G(this,w,"readableHighWaterMark",!0):null;if(F===0)w={...w,highWaterMark:null,readableHighWaterMark:F,writableHighWaterMark:w.writableHighWaterMark||0};if(Z.call(this,w),this._readableState.sync=!1,this[W]=null,w){if(typeof w.transform==="function")this._transform=w.transform;if(typeof w.flush==="function")this._flush=w.flush}this.on("prefinish",U)}function V(w){if(typeof this._flush==="function"&&!this.destroyed)this._flush((F,M)=>{if(F){if(w)w(F);else this.destroy(F);return}if(M!=null)this.push(M);if(this.push(null),w)w()});else if(this.push(null),w)w()}function U(){if(this._final!==V)V.call(this)}B.prototype._final=V,B.prototype._transform=function(w,F,M){throw new J("_transform()")},B.prototype._write=function(w,F,M){let k=this._readableState,f=this._writableState,L=k.length;this._transform(w,F,(D,z)=>{if(D){M(D);return}if(z!=null)this.push(z);if(f.ended||L===k.length||k.length{var{ObjectSetPrototypeOf:Q}=P0();q.exports=J;var K=l9();Q(J.prototype,K.prototype),Q(J,K);function J(Z){if(!(this instanceof J))return new J(Z);K.call(this,Z)}J.prototype._transform=function(Z,G,W){W(null,Z)}}),d5=g0(($,q)=>{var Q=D1(),{ArrayIsArray:K,Promise:J,SymbolAsyncIterator:Z,SymbolDispose:G}=P0(),W=s2(),{once:B}=e0(),V=o1(),U=c2(),{aggregateTwoErrors:w,codes:{ERR_INVALID_ARG_TYPE:F,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:k,ERR_STREAM_DESTROYED:f,ERR_STREAM_PREMATURE_CLOSE:L},AbortError:D}=a0(),{validateFunction:z,validateAbortSignal:N}=P6(),{isIterable:H,isReadable:v,isReadableNodeStream:j,isNodeStream:n,isTransformStream:d,isWebStream:_,isReadableStream:X,isReadableFinished:P}=b2(),g=globalThis.AbortController||O6().AbortController,c,h,x;function l(m,V0,w0){let S=!1;m.on("close",()=>{S=!0});let b=W(m,{readable:V0,writable:w0},(O)=>{S=!O});return{destroy:(O)=>{if(S)return;S=!0,V.destroyer(m,O||new f("pipe"))},cleanup:b}}function $0(m){return z(m[m.length-1],"streams[stream.length - 1]"),m.pop()}function Z0(m){if(H(m))return m;else if(j(m))return F0(m);throw new F("val",["Readable","Iterable","AsyncIterable"],m)}async function*F0(m){if(!h)h=f8();yield*h.prototype[Z].call(m)}async function p(m,V0,w0,{end:S}){let b,O=null,E=(R)=>{if(R)b=R;if(O){let Y=O;O=null,Y()}},a=()=>new J((R,Y)=>{if(b)Y(b);else O=()=>{if(b)Y(b);else R()}});V0.on("drain",E);let K0=W(V0,{readable:!1},E);try{if(V0.writableNeedDrain)await a();for await(let R of m)if(!V0.write(R))await a();if(S)V0.end(),await a();w0()}catch(R){w0(b!==R?w(b,R):R)}finally{K0(),V0.off("drain",E)}}async function W0(m,V0,w0,{end:S}){if(d(V0))V0=V0.writable;let b=V0.getWriter();try{for await(let O of m)await b.ready,b.write(O).catch(()=>{});if(await b.ready,S)await b.close();w0()}catch(O){try{await b.abort(O),w0(O)}catch(E){w0(E)}}}function y(...m){return i(m,B($0(m)))}function i(m,V0,w0){if(m.length===1&&K(m[0]))m=m[0];if(m.length<2)throw new k("streams");let S=new g,b=S.signal,O=w0===null||w0===void 0?void 0:w0.signal,E=[];N(O,"options.signal");function a(){r(new D)}x=x||e0().addAbortListener;let K0;if(O)K0=x(O,a);let R,Y,C=[],u=0;function e(Q0){r(Q0,--u===0)}function r(Q0,M0){var I0;if(Q0&&(!R||R.code==="ERR_STREAM_PREMATURE_CLOSE"))R=Q0;if(!R&&!M0)return;while(C.length)C.shift()(R);if((I0=K0)===null||I0===void 0||I0[G](),S.abort(),M0){if(!R)E.forEach((m0)=>m0());Q.nextTick(V0,R,Y)}}let s;for(let Q0=0;Q00,p0=I0||(w0===null||w0===void 0?void 0:w0.end)!==!1,q2=Q0===m.length-1;if(n(M0)){let O0=function(u0){if(u0&&u0.name!=="AbortError"&&u0.code!=="ERR_STREAM_PREMATURE_CLOSE")e(u0)};var T=O0;if(p0){let{destroy:u0,cleanup:E1}=l(M0,I0,m0);if(C.push(u0),v(M0)&&q2)E.push(E1)}if(M0.on("error",O0),v(M0)&&q2)E.push(()=>{M0.removeListener("error",O0)})}if(Q0===0)if(typeof M0==="function"){if(s=M0({signal:b}),!H(s))throw new M("Iterable, AsyncIterable or Stream","source",s)}else if(H(M0)||j(M0)||d(M0))s=M0;else s=U.from(M0);else if(typeof M0==="function"){if(d(s)){var t;s=Z0((t=s)===null||t===void 0?void 0:t.readable)}else s=Z0(s);if(s=M0(s,{signal:b}),I0){if(!H(s,!0))throw new M("AsyncIterable",`transform[${Q0-1}]`,s)}else{var G0;if(!c)c=r9();let O0=new c({objectMode:!0}),u0=(G0=s)===null||G0===void 0?void 0:G0.then;if(typeof u0==="function")u++,u0.call(s,(R2)=>{if(Y=R2,R2!=null)O0.write(R2);if(p0)O0.end();Q.nextTick(e)},(R2)=>{O0.destroy(R2),Q.nextTick(e,R2)});else if(H(s,!0))u++,p(s,O0,e,{end:p0});else if(X(s)||d(s)){let R2=s.readable||s;u++,p(R2,O0,e,{end:p0})}else throw new M("AsyncIterable or Promise","destination",s);s=O0;let{destroy:E1,cleanup:_1}=l(s,!1,!0);if(C.push(E1),q2)E.push(_1)}}else if(n(M0)){if(j(s)){u+=2;let O0=U0(s,M0,e,{end:p0});if(v(M0)&&q2)E.push(O0)}else if(d(s)||X(s)){let O0=s.readable||s;u++,p(O0,M0,e,{end:p0})}else if(H(s))u++,p(s,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else if(_(M0)){if(j(s))u++,W0(Z0(s),M0,e,{end:p0});else if(X(s)||H(s))u++,W0(s,M0,e,{end:p0});else if(d(s))u++,W0(s.readable,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else s=U.from(M0)}if(b!==null&&b!==void 0&&b.aborted||O!==null&&O!==void 0&&O.aborted)Q.nextTick(a);return s}function U0(m,V0,w0,{end:S}){let b=!1;if(V0.on("close",()=>{if(!b)w0(new L)}),m.pipe(V0,{end:!1}),S){let E=function(){b=!0,V0.end()};var O=E;if(P(m))Q.nextTick(E);else m.once("end",E)}else w0();return W(m,{readable:!0,writable:!1},(E)=>{let a=m._readableState;if(E&&E.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted)m.once("end",w0).once("error",w0);else w0(E)}),W(V0,{readable:!1,writable:!0},w0)}q.exports={pipelineImpl:i,pipeline:y}}),s9=g0(($,q)=>{var{pipeline:Q}=d5(),K=c2(),{destroyer:J}=o1(),{isNodeStream:Z,isReadable:G,isWritable:W,isWebStream:B,isTransformStream:V,isWritableStream:U,isReadableStream:w}=b2(),{AbortError:F,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:k}}=a0(),f=s2();q.exports=function(...L){if(L.length===0)throw new k("streams");if(L.length===1)return K.from(L[0]);let D=[...L];if(typeof L[0]==="function")L[0]=K.from(L[0]);if(typeof L[L.length-1]==="function"){let g=L.length-1;L[g]=K.from(L[g])}for(let g=0;g0&&!(W(L[g])||U(L[g])||V(L[g])))throw new M(`streams[${g}]`,D[g],"must be writable")}let z,N,H,v,j;function n(g){let c=v;if(v=null,c)c(g);else if(g)j.destroy(g);else if(!P&&!X)j.destroy()}let d=L[0],_=Q(L,n),X=!!(W(d)||U(d)||V(d)),P=!!(G(_)||w(_)||V(_));if(j=new K({writableObjectMode:!!(d!==null&&d!==void 0&&d.writableObjectMode),readableObjectMode:!!(_!==null&&_!==void 0&&_.readableObjectMode),writable:X,readable:P}),X){if(Z(d))j._write=function(c,h,x){if(d.write(c,h))x();else z=x},j._final=function(c){d.end(),N=c},d.on("drain",function(){if(z){let c=z;z=null,c()}});else if(B(d)){let c=(V(d)?d.writable:d).getWriter();j._write=async function(h,x,l){try{await c.ready,c.write(h).catch(()=>{}),l()}catch($0){l($0)}},j._final=async function(h){try{await c.ready,c.close().catch(()=>{}),N=h}catch(x){h(x)}}}let g=V(_)?_.readable:_;f(g,()=>{if(N){let c=N;N=null,c()}})}if(P){if(Z(_))_.on("readable",function(){if(H){let g=H;H=null,g()}}),_.on("end",function(){j.push(null)}),j._read=function(){while(!0){let g=_.read();if(g===null){H=j._read;return}if(!j.push(g))return}};else if(B(_)){let g=(V(_)?_.readable:_).getReader();j._read=async function(){while(!0)try{let{value:c,done:h}=await g.read();if(!j.push(c))return;if(h){j.push(null);return}}catch{return}}}}return j._destroy=function(g,c){if(!g&&v!==null)g=new F;if(H=null,z=null,N=null,v===null)c(g);else if(v=c,Z(_))J(_,g)},j}}),hV=g0(($,q)=>{var Q=globalThis.AbortController||O6().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:J,ERR_MISSING_ARGS:Z,ERR_OUT_OF_RANGE:G},AbortError:W}=a0(),{validateAbortSignal:B,validateInteger:V,validateObject:U}=P6(),w=P0().Symbol("kWeak"),F=P0().Symbol("kResistStopPropagation"),{finished:M}=s2(),k=s9(),{addAbortSignalNoValidate:f}=H8(),{isWritable:L,isNodeStream:D}=b2(),{deprecate:z}=e0(),{ArrayPrototypePush:N,Boolean:H,MathFloor:v,Number:j,NumberIsNaN:n,Promise:d,PromiseReject:_,PromiseResolve:X,PromisePrototypeThen:P,Symbol:g}=P0(),c=g("kEmpty"),h=g("kEof");function x(O,E){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");if(D(O)&&!L(O))throw new K("stream",O,"must be writable");let a=k(this,O);if(E!==null&&E!==void 0&&E.signal)f(E.signal,a);return a}function l(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");let a=1;if((E===null||E===void 0?void 0:E.concurrency)!=null)a=v(E.concurrency);let K0=a-1;if((E===null||E===void 0?void 0:E.highWaterMark)!=null)K0=v(E.highWaterMark);return V(a,"options.concurrency",1),V(K0,"options.highWaterMark",0),K0+=a,async function*(){let R=e0().AbortSignalAny([E===null||E===void 0?void 0:E.signal].filter(H)),Y=this,C=[],u={signal:R},e,r,s=!1,T=0;function t(){s=!0,G0()}function G0(){T-=1,Q0()}function Q0(){if(r&&!s&&T=K0||T>=a))await new d((m0)=>{r=m0})}C.push(h)}catch(I0){let m0=_(I0);P(m0,G0,t),C.push(m0)}finally{if(s=!0,e)e(),e=null}}M0();try{while(!0){while(C.length>0){let I0=await C[0];if(I0===h)return;if(R.aborted)throw new W;if(I0!==c)yield I0;C.shift(),Q0()}await new d((I0)=>{e=I0})}}finally{if(s=!0,r)r(),r=null}}.call(this)}function $0(O=void 0){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");return async function*(){let E=0;for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W({cause:O.signal.reason});yield[E++,K0]}}.call(this)}async function Z0(O,E=void 0){for await(let a of y.call(this,O,E))return!0;return!1}async function F0(O,E=void 0){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);return!await Z0.call(this,async(...a)=>{return!await O(...a)},E)}async function p(O,E){for await(let a of y.call(this,O,E))return a;return}async function W0(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){return await O(K0,R),c}for await(let K0 of l.call(this,a,E));}function y(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){if(await O(K0,R))return K0;return c}return l.call(this,a,E)}class i extends Z{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function U0(O,E,a){var K0;if(typeof O!=="function")throw new J("reducer",["Function","AsyncFunction"],O);if(a!=null)U(a,"options");if((a===null||a===void 0?void 0:a.signal)!=null)B(a.signal,"options.signal");let R=arguments.length>1;if(a!==null&&a!==void 0&&(K0=a.signal)!==null&&K0!==void 0&&K0.aborted){let r=new W(void 0,{cause:a.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(r)),r}let Y=new Q,C=Y.signal;if(a!==null&&a!==void 0&&a.signal){let r={once:!0,[w]:this,[F]:!0};a.signal.addEventListener("abort",()=>Y.abort(),r)}let u=!1;try{for await(let r of this){var e;if(u=!0,a!==null&&a!==void 0&&(e=a.signal)!==null&&e!==void 0&&e.aborted)throw new W;if(!R)E=r,R=!0;else E=await O(E,r,{signal:C})}if(!u&&!R)throw new i}finally{Y.abort()}return E}async function m(O){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");let E=[];for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W(void 0,{cause:O.signal.reason});N(E,K0)}return E}function V0(O,E){let a=l.call(this,O,E);return async function*(){for await(let K0 of a)yield*K0}.call(this)}function w0(O){if(O=j(O),n(O))return 0;if(O<0)throw new G("number",">= 0",O);return O}function S(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O--<=0)yield R}}.call(this)}function b(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O-- >0)yield R;if(O<=0)return}}.call(this)}q.exports.streamReturningOperators={asIndexedPairs:z($0,"readable.asIndexedPairs will be removed in a future version."),drop:S,filter:y,flatMap:V0,map:l,take:b,compose:x},q.exports.promiseReturningOperators={every:F0,forEach:W0,reduce:U0,toArray:m,some:Z0,find:p}}),t9=g0(($,q)=>{var{ArrayPrototypePop:Q,Promise:K}=P0(),{isIterable:J,isNodeStream:Z,isWebStream:G}=b2(),{pipelineImpl:W}=d5(),{finished:B}=s2();e9();function V(...U){return new K((w,F)=>{let M,k,f=U[U.length-1];if(f&&typeof f==="object"&&!Z(f)&&!J(f)&&!G(f)){let L=Q(U);M=L.signal,k=L.end}W(U,(L,D)=>{if(L)F(L);else w(D)},{signal:M,end:k})})}q.exports={finished:B,pipeline:V}}),e9=g0(($,q)=>{var{Buffer:Q}=(t0(),X0(K2)),{ObjectDefineProperty:K,ObjectKeys:J,ReflectApply:Z}=P0(),{promisify:{custom:G}}=e0(),{streamReturningOperators:W,promiseReturningOperators:B}=hV(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:V}}=a0(),U=s9(),{setDefaultHighWaterMark:w,getDefaultHighWaterMark:F}=v8(),{pipeline:M}=d5(),{destroyer:k}=o1(),f=s2(),L=t9(),D=b2(),z=q.exports=b5().Stream;z.isDestroyed=D.isDestroyed,z.isDisturbed=D.isDisturbed,z.isErrored=D.isErrored,z.isReadable=D.isReadable,z.isWritable=D.isWritable,z.Readable=f8();for(let H of J(W)){let v=function(...n){if(new.target)throw V();return z.Readable.from(Z(j,this,n))},j=W[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(let H of J(B)){let v=function(...n){if(new.target)throw V();return Z(j,this,n)},j=B[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}z.Writable=n5(),z.Duplex=c2(),z.Transform=l9(),z.PassThrough=r9(),z.pipeline=M;var{addAbortSignal:N}=H8();z.addAbortSignal=N,z.finished=f,z.destroy=k,z.compose=U,z.setDefaultHighWaterMark=w,z.getDefaultHighWaterMark=F,K(z,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return L}}),K(M,G,{__proto__:null,enumerable:!0,get(){return L.pipeline}}),K(f,G,{__proto__:null,enumerable:!0,get(){return L.finished}}),z.Stream=z,z._isUint8Array=function(H){return H instanceof Uint8Array},z._uint8ArrayToBuffer=function(H){return Q.from(H.buffer,H.byteOffset,H.byteLength)}}),xV=g0(($,q)=>{var Q=a1();{let K=e9(),J=t9(),Z=K.Readable.destroy;q.exports=K.Readable,q.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,q.exports._isUint8Array=K._isUint8Array,q.exports.isDisturbed=K.isDisturbed,q.exports.isErrored=K.isErrored,q.exports.isReadable=K.isReadable,q.exports.Readable=K.Readable,q.exports.Writable=K.Writable,q.exports.Duplex=K.Duplex,q.exports.Transform=K.Transform,q.exports.PassThrough=K.PassThrough,q.exports.addAbortSignal=K.addAbortSignal,q.exports.finished=K.finished,q.exports.destroy=K.destroy,q.exports.destroy=Z,q.exports.pipeline=K.pipeline,q.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return J}}),q.exports.Stream=K.Stream}q.exports.default=q.exports});$$.exports=xV()});var m5=N0((Fz,Q$)=>{Q$.exports=a1()});var n2=N0((J2)=>{J2.base64=!0;J2.array=!0;J2.string=!0;J2.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";J2.nodebuffer=typeof Buffer<"u";J2.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")J2.blob=!1;else{R8=new ArrayBuffer(0);try{J2.blob=new Blob([R8],{type:"application/zip"}).size===0}catch($){try{p5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,I8=new p5,I8.append(R8),J2.blob=I8.getBlob("application/zip").size===0}catch(q){J2.blob=!1}}}var R8,p5,I8;try{J2.nodestream=!!m5().Readable}catch($){J2.nodestream=!1}});var o5=N0((i5)=>{var OV=T0(),PV=n2(),A2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i5.encode=function($){var q=[],Q,K,J,Z,G,W,B,V=0,U=$.length,w=U,F=OV.getTypeOf($)!=="string";while(V<$.length){if(w=U-V,!F)Q=$.charCodeAt(V++),K=V>2,G=(Q&3)<<4|K>>4,W=w>1?(K&15)<<2|J>>6:64,B=w>2?J&63:64,q.push(A2.charAt(Z)+A2.charAt(G)+A2.charAt(W)+A2.charAt(B))}return q.join("")};i5.decode=function($){var q,Q,K,J,Z,G,W,B=0,V=0,U="data:";if($.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var w=$.length*3/4;if($.charAt($.length-1)===A2.charAt(64))w--;if($.charAt($.length-2)===A2.charAt(64))w--;if(w%1!==0)throw Error("Invalid base64 input, bad content length.");var F;if(PV.uint8array)F=new Uint8Array(w|0);else F=Array(w|0);while(B<$.length){if(J=A2.indexOf($.charAt(B++)),Z=A2.indexOf($.charAt(B++)),G=A2.indexOf($.charAt(B++)),W=A2.indexOf($.charAt(B++)),q=J<<2|Z>>4,Q=(Z&15)<<4|G>>2,K=(G&3)<<6|W,F[V++]=q,G!==64)F[V++]=Q;if(W!==64)F[V++]=K}return F}});var T6=N0((Nz,q$)=>{q$.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var q=new Buffer($);return q.fill(0),q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var V$=N0((Yz,J$)=>{var K$=global.MutationObserver||global.WebKitMutationObserver,u6;if(K$)j8=0,a5=new K$(C8),g8=global.document.createTextNode(""),a5.observe(g8,{characterData:!0}),u6=function(){g8.data=j8=++j8%2};else if(!global.setImmediate&&typeof global.MessageChannel<"u")A8=new global.MessageChannel,A8.port1.onmessage=C8,u6=function(){A8.port2.postMessage(0)};else if("document"in global&&"onreadystatechange"in global.document.createElement("script"))u6=function(){var $=global.document.createElement("script");$.onreadystatechange=function(){C8(),$.onreadystatechange=null,$.parentNode.removeChild($),$=null},global.document.documentElement.appendChild($)};else u6=function(){setTimeout(C8,0)};var j8,a5,g8,A8,l5,S6=[];function C8(){l5=!0;var $,q,Q=S6.length;while(Q){q=S6,S6=[],$=-1;while(++${var uV=V$();function l1(){}var o0={},U$=["REJECTED"],r5=["FULFILLED"],Z$=["PENDING"];B$.exports=t2;function t2($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Z$,this.queue=[],this.outcome=void 0,$!==l1)G$(this,$)}t2.prototype.finally=function($){if(typeof $!=="function")return this;var q=this.constructor;return this.then(Q,K);function Q(J){function Z(){return J}return q.resolve($()).then(Z)}function K(J){function Z(){throw J}return q.resolve($()).then(Z)}};t2.prototype.catch=function($){return this.then(null,$)};t2.prototype.then=function($,q){if(typeof $!=="function"&&this.state===r5||typeof q!=="function"&&this.state===U$)return this;var Q=new this.constructor(l1);if(this.state!==Z$){var K=this.state===r5?$:q;s5(Q,K,this.outcome)}else this.queue.push(new E6(Q,$,q));return Q};function E6($,q,Q){if(this.promise=$,typeof q==="function")this.onFulfilled=q,this.callFulfilled=this.otherCallFulfilled;if(typeof Q==="function")this.onRejected=Q,this.callRejected=this.otherCallRejected}E6.prototype.callFulfilled=function($){o0.resolve(this.promise,$)};E6.prototype.otherCallFulfilled=function($){s5(this.promise,this.onFulfilled,$)};E6.prototype.callRejected=function($){o0.reject(this.promise,$)};E6.prototype.otherCallRejected=function($){s5(this.promise,this.onRejected,$)};function s5($,q,Q){uV(function(){var K;try{K=q(Q)}catch(J){return o0.reject($,J)}if(K===$)o0.reject($,TypeError("Cannot resolve promise with itself"));else o0.resolve($,K)})}o0.resolve=function($,q){var Q=W$(SV,q);if(Q.status==="error")return o0.reject($,Q.value);var K=Q.value;if(K)G$($,K);else{$.state=r5,$.outcome=q;var J=-1,Z=$.queue.length;while(++J{var t5=null;if(typeof Promise<"u")t5=Promise;else t5=z$();F$.exports={Promise:t5}});var w$=N0((M$)=>{(function($,q){if($.setImmediate)return;var Q=1,K={},J=!1,Z=$.document,G;function W(z){if(typeof z!=="function")z=Function(""+z);var N=Array(arguments.length-1);for(var H=0;H"u"?typeof global>"u"?M$:global:self)});var T0=N0((_0)=>{var e2=n2(),nV=o5(),s1=T6(),e5=r1();w$();function dV($){var q=null;if(e2.uint8array)q=new Uint8Array($.length);else q=Array($.length);return y8($,q)}_0.newBlob=function($,q){_0.checkSupport("blob");try{return new Blob([$],{type:q})}catch(J){try{var Q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,K=new Q;return K.append($),K.getBlob(q)}catch(Z){throw Error("Bug : can't construct the Blob.")}}};function _6($){return $}function y8($,q){for(var Q=0;Q<$.length;++Q)q[Q]=$.charCodeAt(Q)&255;return q}var X8={stringifyByChunk:function($,q,Q){var K=[],J=0,Z=$.length;if(Z<=Q)return String.fromCharCode.apply(null,$);while(J1)try{return X8.stringifyByChunk($,Q,q)}catch(J){q=Math.floor(q/2)}return X8.stringifyByChar($)}_0.applyFromCharCode=c6;function h8($,q){for(var Q=0;Q<$.length;Q++)q[Q]=$[Q];return q}var $1={};$1.string={string:_6,array:function($){return y8($,Array($.length))},arraybuffer:function($){return $1.string.uint8array($).buffer},uint8array:function($){return y8($,new Uint8Array($.length))},nodebuffer:function($){return y8($,s1.allocBuffer($.length))}};$1.array={string:c6,array:_6,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom($)}};$1.arraybuffer={string:function($){return c6(new Uint8Array($))},array:function($){return h8(new Uint8Array($),Array($.byteLength))},arraybuffer:_6,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom(new Uint8Array($))}};$1.uint8array={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:_6,nodebuffer:function($){return s1.newBufferFrom($)}};$1.nodebuffer={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $1.nodebuffer.uint8array($).buffer},uint8array:function($){return h8($,new Uint8Array($.length))},nodebuffer:_6};_0.transformTo=function($,q){if(!q)q="";if(!$)return q;_0.checkSupport($);var Q=_0.getTypeOf(q),K=$1[Q][$](q);return K};_0.resolve=function($){var q=$.split("/"),Q=[];for(var K=0;K"u")$[Q]=arguments[q][Q];return $};_0.prepareContent=function($,q,Q,K,J){var Z=e5.Promise.resolve(q).then(function(G){var W=e2.blob&&(G instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(G))!==-1);if(W&&typeof FileReader<"u")return new e5.Promise(function(B,V){var U=new FileReader;U.onload=function(w){B(w.target.result)},U.onerror=function(w){V(w.target.error)},U.readAsArrayBuffer(G)});else return G});return Z.then(function(G){var W=_0.getTypeOf(G);if(!W)return e5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(W==="arraybuffer")G=_0.transformTo("uint8array",G);else if(W==="string"){if(J)G=nV.decode(G);else if(Q){if(K!==!0)G=dV(G)}}return G})}});var V2=N0((vz,Y$)=>{function N$($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}N$.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,q){return this._listeners[$].push(q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,q){if(this._listeners[$])for(var Q=0;Q "+$;else return $}};Y$.exports=N$});var e1=N0((Q1)=>{var t1=T0(),L1=n2(),mV=T6(),x8=V2(),b6=Array(256);for(X2=0;X2<256;X2++)b6[X2]=X2>=252?6:X2>=248?5:X2>=240?4:X2>=224?3:X2>=192?2:1;var X2;b6[254]=b6[254]=1;var pV=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q},iV=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+b6[$[Q]]>q?Q:q},oV=function($){var q,Q,K,J,Z=$.length,G=Array(Z*2);for(Q=0,q=0;q4){G[Q++]=65533,q+=J-1;continue}K&=J===2?31:J===3?15:7;while(J>1&&q1){G[Q++]=65533;continue}if(K<65536)G[Q++]=K;else K-=65536,G[Q++]=55296|K>>10&1023,G[Q++]=56320|K&1023}if(G.length!==Q)if(G.subarray)G=G.subarray(0,Q);else G.length=Q;return t1.applyFromCharCode(G)};Q1.utf8encode=function(q){if(L1.nodebuffer)return mV.newBufferFrom(q,"utf-8");return pV(q)};Q1.utf8decode=function(q){if(L1.nodebuffer)return t1.transformTo("nodebuffer",q).toString("utf-8");return q=t1.transformTo(L1.uint8array?"uint8array":"array",q),oV(q)};function O8(){x8.call(this,"utf-8 decode"),this.leftOver=null}t1.inherits(O8,x8);O8.prototype.processChunk=function($){var q=t1.transformTo(L1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(L1.uint8array){var Q=q;q=new Uint8Array(Q.length+this.leftOver.length),q.set(this.leftOver,0),q.set(Q,this.leftOver.length)}else q=this.leftOver.concat(q);this.leftOver=null}var K=iV(q),J=q;if(K!==q.length)if(L1.uint8array)J=q.subarray(0,K),this.leftOver=q.subarray(K,q.length);else J=q.slice(0,K),this.leftOver=q.slice(K,q.length);this.push({data:Q1.utf8decode(J),meta:$.meta})};O8.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:Q1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};Q1.Utf8DecodeWorker=O8;function $4(){x8.call(this,"utf-8 encode")}t1.inherits($4,x8);$4.prototype.processChunk=function($){this.push({data:Q1.utf8encode($.data),meta:$.meta})};Q1.Utf8EncodeWorker=$4});var H$=N0((Rz,L$)=>{var k$=V2(),D$=T0();function Q4($){k$.call(this,"ConvertWorker to "+$),this.destType=$}D$.inherits(Q4,k$);Q4.prototype.processChunk=function($){this.push({data:D$.transformTo(this.destType,$.data),meta:$.meta})};L$.exports=Q4});var R$=N0((Iz,f$)=>{var v$=m5().Readable,aV=T0();aV.inherits(q4,v$);function q4($,q,Q){v$.call(this,q),this._helper=$;var K=this;$.on("data",function(J,Z){if(!K.push(J))K._helper.pause();if(Q)Q(Z)}).on("error",function(J){K.emit("error",J)}).on("end",function(){K.push(null)})}q4.prototype._read=function(){this._helper.resume()};f$.exports=q4});var K4=N0((Cz,j$)=>{var H1=T0(),lV=H$(),rV=V2(),sV=o5(),tV=n2(),eV=r1(),I$=null;if(tV.nodestream)try{I$=R$()}catch($){}function $U($,q,Q){switch($){case"blob":return H1.newBlob(H1.transformTo("arraybuffer",q),Q);case"base64":return sV.encode(q);default:return H1.transformTo($,q)}}function QU($,q){var Q,K=0,J=null,Z=0;for(Q=0;Q{D2.base64=!1;D2.binary=!1;D2.dir=!1;D2.createFolders=!0;D2.date=null;D2.compression=null;D2.compressionOptions=null;D2.comment=null;D2.unixPermissions=null;D2.dosPermissions=null});var V4=N0((gz,g$)=>{var P8=T0(),T8=V2(),KU=16384;function $6($){T8.call(this,"DataWorker");var q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(Q){if(q.dataIsReady=!0,q.data=Q,q.max=Q&&Q.length||0,q.type=P8.getTypeOf(Q),!q.isPaused)q._tickAndRepeat()},function(Q){q.error(Q)})}P8.inherits($6,T8);$6.prototype.cleanUp=function(){T8.prototype.cleanUp.call(this),this.data=null};$6.prototype.resume=function(){if(!T8.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,P8.delay(this._tickAndRepeat,[],this);return!0};$6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)P8.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};$6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=KU,q=null,Q=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":q=this.data.substring(this.index,Q);break;case"uint8array":q=this.data.subarray(this.index,Q);break;case"array":case"nodebuffer":q=this.data.slice(this.index,Q);break}return this.index=Q,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})}};g$.exports=$6});var u8=N0((Az,X$)=>{var JU=T0();function VU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var A$=VU();function UU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}function ZU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q.charCodeAt(G))&255];return $^-1}X$.exports=function(q,Q){if(typeof q>"u"||!q.length)return 0;var K=JU.getTypeOf(q)!=="string";if(K)return UU(Q|0,q,q.length,0);else return ZU(Q|0,q,q.length,0)}});var Z4=N0((Xz,h$)=>{var y$=V2(),GU=u8(),WU=T0();function U4(){y$.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}WU.inherits(U4,y$);U4.prototype.processChunk=function($){this.streamInfo.crc32=GU($.data,this.streamInfo.crc32||0),this.push($)};h$.exports=U4});var O$=N0((yz,x$)=>{var BU=T0(),G4=V2();function W4($){G4.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}BU.inherits(W4,G4);W4.prototype.processChunk=function($){if($){var q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=q+$.data.length}G4.prototype.processChunk.call(this,$)};x$.exports=W4});var S8=N0((hz,u$)=>{var P$=r1(),T$=V4(),zU=Z4(),B4=O$();function z4($,q,Q,K,J){this.compressedSize=$,this.uncompressedSize=q,this.crc32=Q,this.compression=K,this.compressedContent=J}z4.prototype={getContentWorker:function(){var $=new T$(P$.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new B4("data_length")),q=this;return $.on("end",function(){if(this.streamInfo.data_length!==q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new T$(P$.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};z4.createWorkerFrom=function($,q,Q){return $.pipe(new zU).pipe(new B4("uncompressedSize")).pipe(q.compressWorker(Q)).pipe(new B4("compressedSize")).withStreamInfo("compression",q)};u$.exports=z4});var c$=N0((xz,_$)=>{var FU=K4(),MU=V4(),F4=e1(),M4=S8(),S$=V2(),w4=function($,q,Q){this.name=$,this.dir=Q.dir,this.date=Q.date,this.comment=Q.comment,this.unixPermissions=Q.unixPermissions,this.dosPermissions=Q.dosPermissions,this._data=q,this._dataBinary=Q.binary,this.options={compression:Q.compression,compressionOptions:Q.compressionOptions}};w4.prototype={internalStream:function($){var q=null,Q="string";try{if(!$)throw Error("No output type specified.");Q=$.toLowerCase();var K=Q==="string"||Q==="text";if(Q==="binarystring"||Q==="text")Q="string";q=this._decompressWorker();var J=!this._dataBinary;if(J&&!K)q=q.pipe(new F4.Utf8EncodeWorker);if(!J&&K)q=q.pipe(new F4.Utf8DecodeWorker)}catch(Z){q=new S$("error"),q.error(Z)}return new FU(q,Q,"")},async:function($,q){return this.internalStream($).accumulate(q)},nodeStream:function($,q){return this.internalStream($||"nodebuffer").toNodejsStream(q)},_compressWorker:function($,q){if(this._data instanceof M4&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var Q=this._decompressWorker();if(!this._dataBinary)Q=Q.pipe(new F4.Utf8EncodeWorker);return M4.createWorkerFrom(Q,$,q)}},_decompressWorker:function(){if(this._data instanceof M4)return this._data.getContentWorker();else if(this._data instanceof S$)return this._data;else return new MU(this._data)}};var E$=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],wU=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(n6=0;n6{var NU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function YU($,q){return Object.prototype.hasOwnProperty.call($,q)}l0.assign=function($){var q=Array.prototype.slice.call(arguments,1);while(q.length){var Q=q.shift();if(!Q)continue;if(typeof Q!=="object")throw TypeError(Q+"must be non-object");for(var K in Q)if(YU(Q,K))$[K]=Q[K]}return $};l0.shrinkBuf=function($,q){if($.length===q)return $;if($.subarray)return $.subarray(0,q);return $.length=q,$};var kU={arraySet:function($,q,Q,K,J){if(q.subarray&&$.subarray){$.set(q.subarray(Q,Q+K),J);return}for(var Z=0;Z{var LU=d2(),HU=4,b$=0,n$=1,vU=2;function q6($){var q=$.length;while(--q>=0)$[q]=0}var fU=0,a$=1,RU=2,IU=3,CU=258,v4=29,a6=256,m6=a6+1+v4,Q6=30,f4=19,l$=2*m6+1,v1=15,N4=16,jU=7,R4=256,r$=16,s$=17,t$=18,L4=[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],E8=[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],gU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],AU=512,m2=Array((m6+2)*2);q6(m2);var d6=Array(Q6*2);q6(d6);var p6=Array(AU);q6(p6);var i6=Array(CU-IU+1);q6(i6);var I4=Array(v4);q6(I4);var _8=Array(Q6);q6(_8);function Y4($,q,Q,K,J){this.static_tree=$,this.extra_bits=q,this.extra_base=Q,this.elems=K,this.max_length=J,this.has_stree=$&&$.length}var $Q,QQ,qQ;function k4($,q){this.dyn_tree=$,this.max_code=0,this.stat_desc=q}function KQ($){return $<256?p6[$]:p6[256+($>>>7)]}function o6($,q){$.pending_buf[$.pending++]=q&255,$.pending_buf[$.pending++]=q>>>8&255}function $2($,q,Q){if($.bi_valid>N4-Q)$.bi_buf|=q<<$.bi_valid&65535,o6($,$.bi_buf),$.bi_buf=q>>N4-$.bi_valid,$.bi_valid+=Q-N4;else $.bi_buf|=q<<$.bi_valid&65535,$.bi_valid+=Q}function y2($,q,Q){$2($,Q[q*2],Q[q*2+1])}function JQ($,q){var Q=0;do Q|=$&1,$>>>=1,Q<<=1;while(--q>0);return Q>>>1}function XU($){if($.bi_valid===16)o6($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function yU($,q){var{dyn_tree:Q,max_code:K}=q,J=q.stat_desc.static_tree,Z=q.stat_desc.has_stree,G=q.stat_desc.extra_bits,W=q.stat_desc.extra_base,B=q.stat_desc.max_length,V,U,w,F,M,k,f=0;for(F=0;F<=v1;F++)$.bl_count[F]=0;Q[$.heap[$.heap_max]*2+1]=0;for(V=$.heap_max+1;VB)F=B,f++;if(Q[U*2+1]=F,U>K)continue;if($.bl_count[F]++,M=0,U>=W)M=G[U-W];if(k=Q[U*2],$.opt_len+=k*(F+M),Z)$.static_len+=k*(J[U*2+1]+M)}if(f===0)return;do{F=B-1;while($.bl_count[F]===0)F--;$.bl_count[F]--,$.bl_count[F+1]+=2,$.bl_count[B]--,f-=2}while(f>0);for(F=B;F!==0;F--){U=$.bl_count[F];while(U!==0){if(w=$.heap[--V],w>K)continue;if(Q[w*2+1]!==F)$.opt_len+=(F-Q[w*2+1])*Q[w*2],Q[w*2+1]=F;U--}}}function VQ($,q,Q){var K=Array(v1+1),J=0,Z,G;for(Z=1;Z<=v1;Z++)K[Z]=J=J+Q[Z-1]<<1;for(G=0;G<=q;G++){var W=$[G*2+1];if(W===0)continue;$[G*2]=JQ(K[W]++,W)}}function hU(){var $,q,Q,K,J,Z=Array(v1+1);Q=0;for(K=0;K>=7;for(;K8)o6($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function xU($,q,Q,K){if(ZQ($),K)o6($,Q),o6($,~Q);LU.arraySet($.pending_buf,$.window,q,Q,$.pending),$.pending+=Q}function d$($,q,Q,K){var J=q*2,Z=Q*2;return $[J]<$[Z]||$[J]===$[Z]&&K[q]<=K[Q]}function D4($,q,Q){var K=$.heap[Q],J=Q<<1;while(J<=$.heap_len){if(J<$.heap_len&&d$(q,$.heap[J+1],$.heap[J],$.depth))J++;if(d$(q,K,$.heap[J],$.depth))break;$.heap[Q]=$.heap[J],Q=J,J<<=1}$.heap[Q]=K}function m$($,q,Q){var K,J,Z=0,G,W;if($.last_lit!==0)do if(K=$.pending_buf[$.d_buf+Z*2]<<8|$.pending_buf[$.d_buf+Z*2+1],J=$.pending_buf[$.l_buf+Z],Z++,K===0)y2($,J,q);else{if(G=i6[J],y2($,G+a6+1,q),W=L4[G],W!==0)J-=I4[G],$2($,J,W);if(K--,G=KQ(K),y2($,G,Q),W=E8[G],W!==0)K-=_8[G],$2($,K,W)}while(Z<$.last_lit);y2($,R4,q)}function H4($,q){var Q=q.dyn_tree,K=q.stat_desc.static_tree,J=q.stat_desc.has_stree,Z=q.stat_desc.elems,G,W,B=-1,V;$.heap_len=0,$.heap_max=l$;for(G=0;G>1;G>=1;G--)D4($,Q,G);V=Z;do G=$.heap[1],$.heap[1]=$.heap[$.heap_len--],D4($,Q,1),W=$.heap[1],$.heap[--$.heap_max]=G,$.heap[--$.heap_max]=W,Q[V*2]=Q[G*2]+Q[W*2],$.depth[V]=($.depth[G]>=$.depth[W]?$.depth[G]:$.depth[W])+1,Q[G*2+1]=Q[W*2+1]=V,$.heap[1]=V++,D4($,Q,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],yU($,q),VQ(Q,B,$.bl_count)}function p$($,q,Q){var K,J=-1,Z,G=q[1],W=0,B=7,V=4;if(G===0)B=138,V=3;q[(Q+1)*2+1]=65535;for(K=0;K<=Q;K++){if(Z=G,G=q[(K+1)*2+1],++W=3;q--)if($.bl_tree[e$[q]*2+1]!==0)break;return $.opt_len+=3*(q+1)+5+5+4,q}function PU($,q,Q,K){var J;$2($,q-257,5),$2($,Q-1,5),$2($,K-4,4);for(J=0;J>>=1)if(q&1&&$.dyn_ltree[Q*2]!==0)return b$;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return n$;for(Q=32;Q0){if($.strm.data_type===vU)$.strm.data_type=TU($);if(H4($,$.l_desc),H4($,$.d_desc),G=OU($),J=$.opt_len+3+7>>>3,Z=$.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=Q+5;if(Q+4<=J&&q!==-1)GQ($,q,Q,K);else if($.strategy===HU||Z===J)$2($,(a$<<1)+(K?1:0),3),m$($,m2,d6);else $2($,(RU<<1)+(K?1:0),3),PU($,$.l_desc.max_code+1,$.d_desc.max_code+1,G+1),m$($,$.dyn_ltree,$.dyn_dtree);if(UQ($),K)ZQ($)}function _U($,q,Q){if($.pending_buf[$.d_buf+$.last_lit*2]=q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=q&255,$.pending_buf[$.l_buf+$.last_lit]=Q&255,$.last_lit++,q===0)$.dyn_ltree[Q*2]++;else $.matches++,q--,$.dyn_ltree[(i6[Q]+a6+1)*2]++,$.dyn_dtree[KQ(q)*2]++;return $.last_lit===$.lit_bufsize-1}K6._tr_init=uU;K6._tr_stored_block=GQ;K6._tr_flush_block=EU;K6._tr_tally=_U;K6._tr_align=SU});var C4=N0((Tz,BQ)=>{function cU($,q,Q,K){var J=$&65535|0,Z=$>>>16&65535|0,G=0;while(Q!==0){G=Q>2000?2000:Q,Q-=G;do J=J+q[K++]|0,Z=Z+J|0;while(--G);J%=65521,Z%=65521}return J|Z<<16|0}BQ.exports=cU});var j4=N0((uz,zQ)=>{function bU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var nU=bU();function dU($,q,Q,K){var J=nU,Z=K+Q;$^=-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}zQ.exports=dU});var c8=N0((Sz,FQ)=>{FQ.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var vQ=N0((O2)=>{var r0=d2(),M2=WQ(),YQ=C4(),q1=j4(),mU=c8(),C1=0,pU=1,iU=3,Z1=4,MQ=5,x2=0,wQ=1,w2=-2,oU=-3,g4=-5,aU=-1,lU=1,b8=2,rU=3,sU=4,tU=0,eU=2,p8=8,$Z=9,QZ=15,qZ=8,KZ=29,JZ=256,X4=JZ+1+KZ,VZ=30,UZ=19,ZZ=2*X4+1,GZ=15,f0=3,V1=258,L2=V1+f0+1,WZ=32,i8=42,y4=69,n8=73,d8=91,m8=103,f1=113,r6=666,c0=1,s6=2,R1=3,U6=4,BZ=3;function U1($,q){return $.msg=mU[q],q}function NQ($){return($<<1)-($>4?9:0)}function J1($){var q=$.length;while(--q>=0)$[q]=0}function K1($){var q=$.state,Q=q.pending;if(Q>$.avail_out)Q=$.avail_out;if(Q===0)return;if(r0.arraySet($.output,q.pending_buf,q.pending_out,Q,$.next_out),$.next_out+=Q,q.pending_out+=Q,$.total_out+=Q,$.avail_out-=Q,q.pending-=Q,q.pending===0)q.pending_out=0}function d0($,q){M2._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,q),$.block_start=$.strstart,K1($.strm)}function C0($,q){$.pending_buf[$.pending++]=q}function l6($,q){$.pending_buf[$.pending++]=q>>>8&255,$.pending_buf[$.pending++]=q&255}function zZ($,q,Q,K){var J=$.avail_in;if(J>K)J=K;if(J===0)return 0;if($.avail_in-=J,r0.arraySet(q,$.input,$.next_in,J,Q),$.state.wrap===1)$.adler=YQ($.adler,q,J,Q);else if($.state.wrap===2)$.adler=q1($.adler,q,J,Q);return $.next_in+=J,$.total_in+=J,J}function kQ($,q){var{max_chain_length:Q,strstart:K}=$,J,Z,G=$.prev_length,W=$.nice_match,B=$.strstart>$.w_size-L2?$.strstart-($.w_size-L2):0,V=$.window,U=$.w_mask,w=$.prev,F=$.strstart+V1,M=V[K+G-1],k=V[K+G];if($.prev_length>=$.good_match)Q>>=2;if(W>$.lookahead)W=$.lookahead;do{if(J=q,V[J+G]!==k||V[J+G-1]!==M||V[J]!==V[K]||V[++J]!==V[K+1])continue;K+=2,J++;do;while(V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&KG){if($.match_start=q,G=Z,Z>=W)break;M=V[K+G-1],k=V[K+G]}}while((q=w[q&U])>B&&--Q!==0);if(G<=$.lookahead)return G;return $.lookahead}function I1($){var q=$.w_size,Q,K,J,Z,G;do{if(Z=$.window_size-$.lookahead-$.strstart,$.strstart>=q+(q-L2)){r0.arraySet($.window,$.window,q,q,0),$.match_start-=q,$.strstart-=q,$.block_start-=q,K=$.hash_size,Q=K;do J=$.head[--Q],$.head[Q]=J>=q?J-q:0;while(--K);K=q,Q=K;do J=$.prev[--Q],$.prev[Q]=J>=q?J-q:0;while(--K);Z+=q}if($.strm.avail_in===0)break;if(K=zZ($.strm,$.window,$.strstart+$.lookahead,Z),$.lookahead+=K,$.lookahead+$.insert>=f0){G=$.strstart-$.insert,$.ins_h=$.window[G],$.ins_h=($.ins_h<<$.hash_shift^$.window[G+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[G+f0-1])&$.hash_mask,$.prev[G&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=G,G++,$.insert--,$.lookahead+$.insert$.pending_buf_size-5)Q=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(I1($),$.lookahead===0&&q===C1)return c0;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var K=$.block_start+Q;if($.strstart===0||$.strstart>=K){if($.lookahead=$.strstart-K,$.strstart=K,d0($,!1),$.strm.avail_out===0)return c0}if($.strstart-$.block_start>=$.w_size-L2){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.strstart>$.block_start){if(d0($,!1),$.strm.avail_out===0)return c0}return c0}function A4($,q){var Q,K;for(;;){if($.lookahead=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(Q!==0&&$.strstart-Q<=$.w_size-L2)$.match_length=kQ($,Q);if($.match_length>=f0)if(K=M2._tr_tally($,$.strstart-$.match_start,$.match_length-f0),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=f0){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else K=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(K){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=$.strstart=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=f0-1,Q!==0&&$.prev_length<$.max_lazy_match&&$.strstart-Q<=$.w_size-L2){if($.match_length=kQ($,Q),$.match_length<=5&&($.strategy===lU||$.match_length===f0&&$.strstart-$.match_start>4096))$.match_length=f0-1}if($.prev_length>=f0&&$.match_length<=$.prev_length){J=$.strstart+$.lookahead-f0,K=M2._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-f0),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=J)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=f0-1,$.strstart++,K){if(d0($,!1),$.strm.avail_out===0)return c0}}else if($.match_available){if(K=M2._tr_tally($,0,$.window[$.strstart-1]),K)d0($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return c0}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)K=M2._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart=f0&&$.strstart>0){if(J=$.strstart-1,K=G[J],K===G[++J]&&K===G[++J]&&K===G[++J]){Z=$.strstart+V1;do;while(K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&J$.lookahead)$.match_length=$.lookahead}}if($.match_length>=f0)Q=M2._tr_tally($,1,$.match_length-f0),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function wZ($,q){var Q;for(;;){if($.lookahead===0){if(I1($),$.lookahead===0){if(q===C1)return c0;break}}if($.match_length=0,Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function h2($,q,Q,K,J){this.good_length=$,this.max_lazy=q,this.nice_length=Q,this.max_chain=K,this.func=J}var V6;V6=[new h2(0,0,0,0,FZ),new h2(4,4,8,4,A4),new h2(4,5,16,8,A4),new h2(4,6,32,32,A4),new h2(4,4,16,16,J6),new h2(8,16,32,32,J6),new h2(8,16,128,128,J6),new h2(8,32,128,256,J6),new h2(32,128,258,1024,J6),new h2(32,258,258,4096,J6)];function NZ($){$.window_size=2*$.w_size,J1($.head),$.max_lazy_match=V6[$.level].max_lazy,$.good_match=V6[$.level].good_length,$.nice_match=V6[$.level].nice_length,$.max_chain_length=V6[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=f0-1,$.match_available=0,$.ins_h=0}function YZ(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=p8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r0.Buf16(ZZ*2),this.dyn_dtree=new r0.Buf16((2*VZ+1)*2),this.bl_tree=new r0.Buf16((2*UZ+1)*2),J1(this.dyn_ltree),J1(this.dyn_dtree),J1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r0.Buf16(GZ+1),this.heap=new r0.Buf16(2*X4+1),J1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r0.Buf16(2*X4+1),J1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function DQ($){var q;if(!$||!$.state)return U1($,w2);if($.total_in=$.total_out=0,$.data_type=eU,q=$.state,q.pending=0,q.pending_out=0,q.wrap<0)q.wrap=-q.wrap;return q.status=q.wrap?i8:f1,$.adler=q.wrap===2?0:1,q.last_flush=C1,M2._tr_init(q),x2}function LQ($){var q=DQ($);if(q===x2)NZ($.state);return q}function kZ($,q){if(!$||!$.state)return w2;if($.state.wrap!==2)return w2;return $.state.gzhead=q,x2}function HQ($,q,Q,K,J,Z){if(!$)return w2;var G=1;if(q===aU)q=6;if(K<0)G=0,K=-K;else if(K>15)G=2,K-=16;if(J<1||J>$Z||Q!==p8||K<8||K>15||q<0||q>9||Z<0||Z>sU)return U1($,w2);if(K===8)K=9;var W=new YZ;return $.state=W,W.strm=$,W.wrap=G,W.gzhead=null,W.w_bits=K,W.w_size=1<MQ||q<0)return $?U1($,w2):w2;if(K=$.state,!$.output||!$.input&&$.avail_in!==0||K.status===r6&&q!==Z1)return U1($,$.avail_out===0?g4:w2);if(K.strm=$,Q=K.last_flush,K.last_flush=q,K.status===i8)if(K.wrap===2)if($.adler=0,C0(K,31),C0(K,139),C0(K,8),!K.gzhead)C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,BZ),K.status=f1;else{if(C0(K,(K.gzhead.text?1:0)+(K.gzhead.hcrc?2:0)+(!K.gzhead.extra?0:4)+(!K.gzhead.name?0:8)+(!K.gzhead.comment?0:16)),C0(K,K.gzhead.time&255),C0(K,K.gzhead.time>>8&255),C0(K,K.gzhead.time>>16&255),C0(K,K.gzhead.time>>24&255),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)C0(K,K.gzhead.extra.length&255),C0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)$.adler=q1($.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=y4}else{var G=p8+(K.w_bits-8<<4)<<8,W=-1;if(K.strategy>=b8||K.level<2)W=0;else if(K.level<6)W=1;else if(K.level===6)W=2;else W=3;if(G|=W<<6,K.strstart!==0)G|=WZ;if(G+=31-G%31,K.status=f1,l6(K,G),K.strstart!==0)l6(K,$.adler>>>16),l6(K,$.adler&65535);$.adler=1}if(K.status===y4)if(K.gzhead.extra){J=K.pending;while(K.gzindex<(K.gzhead.extra.length&65535)){if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size)break}C0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=n8}else K.status=n8;if(K.status===n8)if(K.gzhead.name){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.gzindex=0,K.status=d8}else K.status=d8;if(K.status===d8)if(K.gzhead.comment){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.status=m8}else K.status=m8;if(K.status===m8)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)K1($);if(K.pending+2<=K.pending_buf_size)C0(K,$.adler&255),C0(K,$.adler>>8&255),$.adler=0,K.status=f1}else K.status=f1;if(K.pending!==0){if(K1($),$.avail_out===0)return K.last_flush=-1,x2}else if($.avail_in===0&&NQ(q)<=NQ(Q)&&q!==Z1)return U1($,g4);if(K.status===r6&&$.avail_in!==0)return U1($,g4);if($.avail_in!==0||K.lookahead!==0||q!==C1&&K.status!==r6){var B=K.strategy===b8?wZ(K,q):K.strategy===rU?MZ(K,q):V6[K.level].func(K,q);if(B===R1||B===U6)K.status=r6;if(B===c0||B===R1){if($.avail_out===0)K.last_flush=-1;return x2}if(B===s6){if(q===pU)M2._tr_align(K);else if(q!==MQ){if(M2._tr_stored_block(K,0,0,!1),q===iU){if(J1(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(K1($),$.avail_out===0)return K.last_flush=-1,x2}}if(q!==Z1)return x2;if(K.wrap<=0)return wQ;if(K.wrap===2)C0(K,$.adler&255),C0(K,$.adler>>8&255),C0(K,$.adler>>16&255),C0(K,$.adler>>24&255),C0(K,$.total_in&255),C0(K,$.total_in>>8&255),C0(K,$.total_in>>16&255),C0(K,$.total_in>>24&255);else l6(K,$.adler>>>16),l6(K,$.adler&65535);if(K1($),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?x2:wQ}function HZ($){var q;if(!$||!$.state)return w2;if(q=$.state.status,q!==i8&&q!==y4&&q!==n8&&q!==d8&&q!==m8&&q!==f1&&q!==r6)return U1($,w2);return $.state=null,q===f1?U1($,oU):x2}function vZ($,q){var Q=q.length,K,J,Z,G,W,B,V,U;if(!$||!$.state)return w2;if(K=$.state,G=K.wrap,G===2||G===1&&K.status!==i8||K.lookahead)return w2;if(G===1)$.adler=YQ($.adler,q,Q,0);if(K.wrap=0,Q>=K.w_size){if(G===0)J1(K.head),K.strstart=0,K.block_start=0,K.insert=0;U=new r0.Buf8(K.w_size),r0.arraySet(U,q,Q-K.w_size,K.w_size,0),q=U,Q=K.w_size}W=$.avail_in,B=$.next_in,V=$.input,$.avail_in=Q,$.next_in=0,$.input=q,I1(K);while(K.lookahead>=f0){J=K.strstart,Z=K.lookahead-(f0-1);do K.ins_h=(K.ins_h<{var o8=d2(),fQ=!0,RQ=!0;try{String.fromCharCode.apply(null,[0])}catch($){fQ=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){RQ=!1}var t6=new o8.Buf8(256);for(P2=0;P2<256;P2++)t6[P2]=P2>=252?6:P2>=248?5:P2>=240?4:P2>=224?3:P2>=192?2:1;var P2;t6[254]=t6[254]=1;Z6.string2buf=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q};function IQ($,q){if(q<65534){if($.subarray&&RQ||!$.subarray&&fQ)return String.fromCharCode.apply(null,o8.shrinkBuf($,q))}var Q="";for(var K=0;K4){W[K++]=65533,Q+=Z-1;continue}J&=Z===2?31:Z===3?15:7;while(Z>1&&Q1){W[K++]=65533;continue}if(J<65536)W[K++]=J;else J-=65536,W[K++]=55296|J>>10&1023,W[K++]=56320|J&1023}return IQ(W,K)};Z6.utf8border=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+t6[$[Q]]>q?Q:q}});var x4=N0((cz,CQ)=>{function fZ(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}CQ.exports=fZ});var XQ=N0((Q8)=>{var e6=vQ(),$8=d2(),P4=h4(),T4=c8(),RZ=x4(),AQ=Object.prototype.toString,IZ=0,O4=4,G6=0,jQ=1,gQ=2,CZ=-1,jZ=0,gZ=8;function j1($){if(!(this instanceof j1))return new j1($);this.options=$8.assign({level:CZ,method:gZ,chunkSize:16384,windowBits:15,memLevel:8,strategy:jZ,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>0)q.windowBits=-q.windowBits;else if(q.gzip&&q.windowBits>0&&q.windowBits<16)q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new RZ,this.strm.avail_out=0;var Q=e6.deflateInit2(this.strm,q.level,q.method,q.windowBits,q.memLevel,q.strategy);if(Q!==G6)throw Error(T4[Q]);if(q.header)e6.deflateSetHeader(this.strm,q.header);if(q.dictionary){var K;if(typeof q.dictionary==="string")K=P4.string2buf(q.dictionary);else if(AQ.call(q.dictionary)==="[object ArrayBuffer]")K=new Uint8Array(q.dictionary);else K=q.dictionary;if(Q=e6.deflateSetDictionary(this.strm,K),Q!==G6)throw Error(T4[Q]);this._dict_set=!0}}j1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J,Z;if(this.ended)return!1;if(Z=q===~~q?q:q===!0?O4:IZ,typeof $==="string")Q.input=P4.string2buf($);else if(AQ.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new $8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(J=e6.deflate(Q,Z),J!==jQ&&J!==G6)return this.onEnd(J),this.ended=!0,!1;if(Q.avail_out===0||Q.avail_in===0&&(Z===O4||Z===gQ))if(this.options.to==="string")this.onData(P4.buf2binstring($8.shrinkBuf(Q.output,Q.next_out)));else this.onData($8.shrinkBuf(Q.output,Q.next_out))}while((Q.avail_in>0||Q.avail_out===0)&&J!==jQ);if(Z===O4)return J=e6.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===G6;if(Z===gQ)return this.onEnd(G6),Q.avail_out=0,!0;return!0};j1.prototype.onData=function($){this.chunks.push($)};j1.prototype.onEnd=function($){if($===G6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=$8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function u4($,q){var Q=new j1(q);if(Q.push($,!0),Q.err)throw Q.msg||T4[Q.err];return Q.result}function AZ($,q){return q=q||{},q.raw=!0,u4($,q)}function XZ($,q){return q=q||{},q.gzip=!0,u4($,q)}Q8.Deflate=j1;Q8.deflate=u4;Q8.deflateRaw=AZ;Q8.gzip=XZ});var hQ=N0((nz,yQ)=>{var a8=30,yZ=12;yQ.exports=function(q,Q){var K,J,Z,G,W,B,V,U,w,F,M,k,f,L,D,z,N,H,v,j,n,d,_,X,P;K=q.state,J=q.next_in,X=q.input,Z=J+(q.avail_in-5),G=q.next_out,P=q.output,W=G-(Q-q.avail_out),B=G+(q.avail_out-257),V=K.dmax,U=K.wsize,w=K.whave,F=K.wnext,M=K.window,k=K.hold,f=K.bits,L=K.lencode,D=K.distcode,z=(1<>>24,k>>>=v,f-=v,v=H>>>16&255,v===0)P[G++]=H&65535;else if(v&16){if(j=H&65535,v&=15,v){if(f>>=v,f-=v}if(f<15)k+=X[J++]<>>24,k>>>=v,f-=v,v=H>>>16&255,v&16){if(n=H&65535,v&=15,fV){q.msg="invalid distance too far back",K.mode=a8;break $}if(k>>>=v,f-=v,v=G-W,n>v){if(v=n-v,v>w){if(K.sane){q.msg="invalid distance too far back",K.mode=a8;break $}}if(d=0,_=M,F===0){if(d+=U-v,v2)P[G++]=_[d++],P[G++]=_[d++],P[G++]=_[d++],j-=3;if(j){if(P[G++]=_[d++],j>1)P[G++]=_[d++]}}else{d=G-n;do P[G++]=P[d++],P[G++]=P[d++],P[G++]=P[d++],j-=3;while(j>2);if(j){if(P[G++]=P[d++],j>1)P[G++]=P[d++]}}}else if((v&64)===0){H=D[(H&65535)+(k&(1<>3,J-=j,f-=j<<3,k&=(1<{var xQ=d2(),W6=15,OQ=852,PQ=592,TQ=0,S4=1,uQ=2,hZ=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],xZ=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],OZ=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],PZ=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];SQ.exports=function(q,Q,K,J,Z,G,W,B){var V=B.bits,U=0,w=0,F=0,M=0,k=0,f=0,L=0,D=0,z=0,N=0,H,v,j,n,d,_=null,X=0,P,g=new xQ.Buf16(W6+1),c=new xQ.Buf16(W6+1),h=null,x=0,l,$0,Z0;for(U=0;U<=W6;U++)g[U]=0;for(w=0;w=1;M--)if(g[M]!==0)break;if(k>M)k=M;if(M===0)return Z[G++]=20971520,Z[G++]=20971520,B.bits=1,0;for(F=1;F0&&(q===TQ||M!==1))return-1;c[1]=0;for(U=1;UOQ||q===uQ&&z>PQ)return 1;for(;;){if(l=U-L,W[w]P)$0=h[x+W[w]],Z0=_[X+W[w]];else $0=96,Z0=0;H=1<>L)+v]=l<<24|$0<<16|Z0|0;while(v!==0);H=1<>=1;if(H!==0)N&=H-1,N+=H;else N=0;if(w++,--g[U]===0){if(U===M)break;U=Q[K+W[w]]}if(U>k&&(N&n)!==j){if(L===0)L=k;d+=F,f=U-L,D=1<OQ||q===uQ&&z>PQ)return 1;j=N&n,Z[j]=k<<24|f<<16|d-G|0}}if(N!==0)Z[d+N]=U-L<<24|4194304|0;return B.bits=k,0}});var Lq=N0((H2)=>{var U2=d2(),d4=C4(),T2=j4(),TZ=hQ(),q8=EQ(),uZ=0,Bq=1,zq=2,_Q=4,SZ=5,l8=6,g1=0,EZ=1,_Z=2,N2=-2,Fq=-3,m4=-4,cZ=-5,cQ=8,Mq=1,bQ=2,nQ=3,dQ=4,mQ=5,pQ=6,iQ=7,oQ=8,aQ=9,lQ=10,t8=11,p2=12,E4=13,rQ=14,_4=15,sQ=16,tQ=17,eQ=18,$q=19,r8=20,s8=21,Qq=22,qq=23,Kq=24,Jq=25,Vq=26,c4=27,Uq=28,Zq=29,x0=30,p4=31,bZ=32,nZ=852,dZ=592,mZ=15,pZ=mZ;function Gq($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function iZ(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U2.Buf16(320),this.work=new U2.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function wq($){var q;if(!$||!$.state)return N2;if(q=$.state,$.total_in=$.total_out=q.total=0,$.msg="",q.wrap)$.adler=q.wrap&1;return q.mode=Mq,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new U2.Buf32(nZ),q.distcode=q.distdyn=new U2.Buf32(dZ),q.sane=1,q.back=-1,g1}function Nq($){var q;if(!$||!$.state)return N2;return q=$.state,q.wsize=0,q.whave=0,q.wnext=0,wq($)}function Yq($,q){var Q,K;if(!$||!$.state)return N2;if(K=$.state,q<0)Q=0,q=-q;else if(Q=(q>>4)+1,q<48)q&=15;if(q&&(q<8||q>15))return N2;if(K.window!==null&&K.wbits!==q)K.window=null;return K.wrap=Q,K.wbits=q,Nq($)}function kq($,q){var Q,K;if(!$)return N2;if(K=new iZ,$.state=K,K.window=null,Q=Yq($,q),Q!==g1)$.state=null;return Q}function oZ($){return kq($,pZ)}var Wq=!0,b4,n4;function aZ($){if(Wq){var q;b4=new U2.Buf32(512),n4=new U2.Buf32(32),q=0;while(q<144)$.lens[q++]=8;while(q<256)$.lens[q++]=9;while(q<280)$.lens[q++]=7;while(q<288)$.lens[q++]=8;q8(Bq,$.lens,0,288,b4,0,$.work,{bits:9}),q=0;while(q<32)$.lens[q++]=5;q8(zq,$.lens,0,32,n4,0,$.work,{bits:5}),Wq=!1}$.lencode=b4,$.lenbits=9,$.distcode=n4,$.distbits=5}function Dq($,q,Q,K){var J,Z=$.state;if(Z.window===null)Z.wsize=1<=Z.wsize)U2.arraySet(Z.window,q,Q-Z.wsize,Z.wsize,0),Z.wnext=0,Z.whave=Z.wsize;else{if(J=Z.wsize-Z.wnext,J>K)J=K;if(U2.arraySet(Z.window,q,Q-K,J,Z.wnext),K-=J,K)U2.arraySet(Z.window,q,Q-K,K,0),Z.wnext=K,Z.whave=Z.wsize;else{if(Z.wnext+=J,Z.wnext===Z.wsize)Z.wnext=0;if(Z.whave>>8&255,Q.check=T2(Q.check,_,2,0),V=0,U=0,Q.mode=bQ;break}if(Q.flags=0,Q.head)Q.head.done=!1;if(!(Q.wrap&1)||(((V&255)<<8)+(V>>8))%31){$.msg="incorrect header check",Q.mode=x0;break}if((V&15)!==cQ){$.msg="unknown compression method",Q.mode=x0;break}if(V>>>=4,U-=4,n=(V&15)+8,Q.wbits===0)Q.wbits=n;else if(n>Q.wbits){$.msg="invalid window size",Q.mode=x0;break}Q.dmax=1<>8&1;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=nQ;case nQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>8&255,_[2]=V>>>16&255,_[3]=V>>>24&255,Q.check=T2(Q.check,_,4,0);V=0,U=0,Q.mode=dQ;case dQ:while(U<16){if(W===0)break $;W--,V+=K[Z++]<>8;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=mQ;case mQ:if(Q.flags&1024){while(U<16){if(W===0)break $;W--,V+=K[Z++]<>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0}else if(Q.head)Q.head.extra=null;Q.mode=pQ;case pQ:if(Q.flags&1024){if(M=Q.length,M>W)M=W;if(M){if(Q.head){if(n=Q.head.extra_len-Q.length,!Q.head.extra)Q.head.extra=Array(Q.head.extra_len);U2.arraySet(Q.head.extra,K,Z,M,n)}if(Q.flags&512)Q.check=T2(Q.check,K,M,Z);W-=M,Z+=M,Q.length-=M}if(Q.length)break $}Q.length=0,Q.mode=iQ;case iQ:if(Q.flags&2048){if(W===0)break $;M=0;do if(n=K[Z+M++],Q.head&&n&&Q.length<65536)Q.head.name+=String.fromCharCode(n);while(n&&M>9&1,Q.head.done=!0;$.adler=Q.check=0,Q.mode=p2;break;case lQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>=U&7,U-=U&7,Q.mode=c4;break}while(U<3){if(W===0)break $;W--,V+=K[Z++]<>>=1,U-=1,V&3){case 0:Q.mode=rQ;break;case 1:if(aZ(Q),Q.mode=r8,q===l8){V>>>=2,U-=2;break $}break;case 2:Q.mode=tQ;break;case 3:$.msg="invalid block type",Q.mode=x0}V>>>=2,U-=2;break;case rQ:V>>>=U&7,U-=U&7;while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>16^65535)){$.msg="invalid stored block lengths",Q.mode=x0;break}if(Q.length=V&65535,V=0,U=0,Q.mode=_4,q===l8)break $;case _4:Q.mode=sQ;case sQ:if(M=Q.length,M){if(M>W)M=W;if(M>B)M=B;if(M===0)break $;U2.arraySet(J,K,Z,M,G),W-=M,Z+=M,B-=M,G+=M,Q.length-=M;break}Q.mode=p2;break;case tQ:while(U<14){if(W===0)break $;W--,V+=K[Z++]<>>=5,U-=5,Q.ndist=(V&31)+1,V>>>=5,U-=5,Q.ncode=(V&15)+4,V>>>=4,U-=4,Q.nlen>286||Q.ndist>30){$.msg="too many length or distance symbols",Q.mode=x0;break}Q.have=0,Q.mode=eQ;case eQ:while(Q.have>>=3,U-=3}while(Q.have<19)Q.lens[g[Q.have++]]=0;if(Q.lencode=Q.lendyn,Q.lenbits=7,X={bits:Q.lenbits},d=q8(uZ,Q.lens,0,19,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid code lengths set",Q.mode=x0;break}Q.have=0,Q.mode=$q;case $q:while(Q.have>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=D,U-=D,Q.lens[Q.have++]=N;else{if(N===16){P=D+2;while(U>>=D,U-=D,Q.have===0){$.msg="invalid bit length repeat",Q.mode=x0;break}n=Q.lens[Q.have-1],M=3+(V&3),V>>>=2,U-=2}else if(N===17){P=D+3;while(U>>=D,U-=D,n=0,M=3+(V&7),V>>>=3,U-=3}else{P=D+7;while(U>>=D,U-=D,n=0,M=11+(V&127),V>>>=7,U-=7}if(Q.have+M>Q.nlen+Q.ndist){$.msg="invalid bit length repeat",Q.mode=x0;break}while(M--)Q.lens[Q.have++]=n}}if(Q.mode===x0)break;if(Q.lens[256]===0){$.msg="invalid code -- missing end-of-block",Q.mode=x0;break}if(Q.lenbits=9,X={bits:Q.lenbits},d=q8(Bq,Q.lens,0,Q.nlen,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid literal/lengths set",Q.mode=x0;break}if(Q.distbits=6,Q.distcode=Q.distdyn,X={bits:Q.distbits},d=q8(zq,Q.lens,Q.nlen,Q.ndist,Q.distcode,0,Q.work,X),Q.distbits=X.bits,d){$.msg="invalid distances set",Q.mode=x0;break}if(Q.mode=r8,q===l8)break $;case r8:Q.mode=s8;case s8:if(W>=6&&B>=258){if($.next_out=G,$.avail_out=B,$.next_in=Z,$.avail_in=W,Q.hold=V,Q.bits=U,TZ($,F),G=$.next_out,J=$.output,B=$.avail_out,Z=$.next_in,K=$.input,W=$.avail_in,V=Q.hold,U=Q.bits,Q.mode===p2)Q.back=-1;break}Q.back=0;for(;;){if(L=Q.lencode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,Q.length=N,z===0){Q.mode=Vq;break}if(z&32){Q.back=-1,Q.mode=p2;break}if(z&64){$.msg="invalid literal/length code",Q.mode=x0;break}Q.extra=z&15,Q.mode=Qq;case Qq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}Q.was=Q.length,Q.mode=qq;case qq:for(;;){if(L=Q.distcode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,z&64){$.msg="invalid distance code",Q.mode=x0;break}Q.offset=N,Q.extra=z&15,Q.mode=Kq;case Kq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}if(Q.offset>Q.dmax){$.msg="invalid distance too far back",Q.mode=x0;break}Q.mode=Jq;case Jq:if(B===0)break $;if(M=F-B,Q.offset>M){if(M=Q.offset-M,M>Q.whave){if(Q.sane){$.msg="invalid distance too far back",Q.mode=x0;break}}if(M>Q.wnext)M-=Q.wnext,k=Q.wsize-M;else k=Q.wnext-M;if(M>Q.length)M=Q.length;f=Q.window}else f=J,k=G-Q.offset,M=Q.length;if(M>B)M=B;B-=M,Q.length-=M;do J[G++]=f[k++];while(--M);if(Q.length===0)Q.mode=s8;break;case Vq:if(B===0)break $;J[G++]=Q.length,B--,Q.mode=s8;break;case c4:if(Q.wrap){while(U<32){if(W===0)break $;W--,V|=K[Z++]<{Hq.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var fq=N0((iz,vq)=>{function eZ(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}vq.exports=eZ});var Iq=N0((J8)=>{var B6=Lq(),K8=d2(),e8=h4(),E0=i4(),o4=c8(),$G=x4(),QG=fq(),Rq=Object.prototype.toString;function A1($){if(!(this instanceof A1))return new A1($);this.options=K8.assign({chunkSize:16384,windowBits:0,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>=0&&q.windowBits<16){if(q.windowBits=-q.windowBits,q.windowBits===0)q.windowBits=-15}if(q.windowBits>=0&&q.windowBits<16&&!($&&$.windowBits))q.windowBits+=32;if(q.windowBits>15&&q.windowBits<48){if((q.windowBits&15)===0)q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $G,this.strm.avail_out=0;var Q=B6.inflateInit2(this.strm,q.windowBits);if(Q!==E0.Z_OK)throw Error(o4[Q]);if(this.header=new QG,B6.inflateGetHeader(this.strm,this.header),q.dictionary){if(typeof q.dictionary==="string")q.dictionary=e8.string2buf(q.dictionary);else if(Rq.call(q.dictionary)==="[object ArrayBuffer]")q.dictionary=new Uint8Array(q.dictionary);if(q.raw){if(Q=B6.inflateSetDictionary(this.strm,q.dictionary),Q!==E0.Z_OK)throw Error(o4[Q])}}}A1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J=this.options.dictionary,Z,G,W,B,V,U=!1;if(this.ended)return!1;if(G=q===~~q?q:q===!0?E0.Z_FINISH:E0.Z_NO_FLUSH,typeof $==="string")Q.input=e8.binstring2buf($);else if(Rq.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new K8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(Z=B6.inflate(Q,E0.Z_NO_FLUSH),Z===E0.Z_NEED_DICT&&J)Z=B6.inflateSetDictionary(this.strm,J);if(Z===E0.Z_BUF_ERROR&&U===!0)Z=E0.Z_OK,U=!1;if(Z!==E0.Z_STREAM_END&&Z!==E0.Z_OK)return this.onEnd(Z),this.ended=!0,!1;if(Q.next_out){if(Q.avail_out===0||Z===E0.Z_STREAM_END||Q.avail_in===0&&(G===E0.Z_FINISH||G===E0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(W=e8.utf8border(Q.output,Q.next_out),B=Q.next_out-W,V=e8.buf2string(Q.output,W),Q.next_out=B,Q.avail_out=K-B,B)K8.arraySet(Q.output,Q.output,W,B,0);this.onData(V)}else this.onData(K8.shrinkBuf(Q.output,Q.next_out))}if(Q.avail_in===0&&Q.avail_out===0)U=!0}while((Q.avail_in>0||Q.avail_out===0)&&Z!==E0.Z_STREAM_END);if(Z===E0.Z_STREAM_END)G=E0.Z_FINISH;if(G===E0.Z_FINISH)return Z=B6.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===E0.Z_OK;if(G===E0.Z_SYNC_FLUSH)return this.onEnd(E0.Z_OK),Q.avail_out=0,!0;return!0};A1.prototype.onData=function($){this.chunks.push($)};A1.prototype.onEnd=function($){if($===E0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=K8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function a4($,q){var Q=new A1(q);if(Q.push($,!0),Q.err)throw Q.msg||o4[Q.err];return Q.result}function qG($,q){return q=q||{},q.raw=!0,a4($,q)}J8.Inflate=A1;J8.inflate=a4;J8.inflateRaw=qG;J8.ungzip=a4});var gq=N0((az,jq)=>{var KG=d2().assign,JG=XQ(),VG=Iq(),UG=i4(),Cq={};KG(Cq,JG,VG,UG);jq.exports=Cq});var Xq=N0((Q5)=>{var ZG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",GG=gq(),Aq=T0(),$5=V2(),WG=ZG?"uint8array":"array";Q5.magic="\b\x00";function X1($,q){$5.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=q,this.meta={}}Aq.inherits(X1,$5);X1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(Aq.transformTo(WG,$.data),!1)};X1.prototype.flush=function(){if($5.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};X1.prototype.cleanUp=function(){$5.prototype.cleanUp.call(this),this._pako=null};X1.prototype._createPako=function(){this._pako=new GG[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(q){$.push({data:q,meta:$.meta})}};Q5.compressWorker=function($){return new X1("Deflate",$)};Q5.uncompressWorker=function(){return new X1("Inflate",{})}});var r4=N0((l4)=>{var yq=V2();l4.STORE={magic:"\x00\x00",compressWorker:function(){return new yq("STORE compression")},uncompressWorker:function(){return new yq("STORE decompression")}};l4.DEFLATE=Xq()});var s4=N0((y1)=>{y1.LOCAL_FILE_HEADER="PK\x03\x04";y1.CENTRAL_FILE_HEADER="PK\x01\x02";y1.CENTRAL_DIRECTORY_END="PK\x05\x06";y1.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";y1.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";y1.DATA_DESCRIPTOR="PK\x07\b"});var Pq=N0((tz,Oq)=>{var z6=T0(),F6=V2(),t4=e1(),hq=u8(),q5=s4(),A0=function($,q){var Q="",K;for(K=0;K>>8;return Q},BG=function($,q){var Q=$;if(!$)Q=q?16893:33204;return(Q&65535)<<16},zG=function($){return($||0)&63},xq=function($,q,Q,K,J,Z){var{file:G,compression:W}=$,B=Z!==t4.utf8encode,V=z6.transformTo("string",Z(G.name)),U=z6.transformTo("string",t4.utf8encode(G.name)),w=G.comment,F=z6.transformTo("string",Z(w)),M=z6.transformTo("string",t4.utf8encode(w)),k=U.length!==G.name.length,f=M.length!==w.length,L,D,z="",N="",H="",v=G.dir,j=G.date,n={crc32:0,compressedSize:0,uncompressedSize:0};if(!q||Q)n.crc32=$.crc32,n.compressedSize=$.compressedSize,n.uncompressedSize=$.uncompressedSize;var d=0;if(q)d|=8;if(!B&&(k||f))d|=2048;var _=0,X=0;if(v)_|=16;if(J==="UNIX")X=798,_|=BG(G.unixPermissions,v);else X=20,_|=zG(G.dosPermissions,v);if(L=j.getUTCHours(),L=L<<6,L=L|j.getUTCMinutes(),L=L<<5,L=L|j.getUTCSeconds()/2,D=j.getUTCFullYear()-1980,D=D<<4,D=D|j.getUTCMonth()+1,D=D<<5,D=D|j.getUTCDate(),k)N=A0(1,1)+A0(hq(V),4)+U,z+="up"+A0(N.length,2)+N;if(f)H=A0(1,1)+A0(hq(F),4)+M,z+="uc"+A0(H.length,2)+H;var P="";P+=` +\x00`,P+=A0(d,2),P+=W.magic,P+=A0(L,2),P+=A0(D,2),P+=A0(n.crc32,4),P+=A0(n.compressedSize,4),P+=A0(n.uncompressedSize,4),P+=A0(V.length,2),P+=A0(z.length,2);var g=q5.LOCAL_FILE_HEADER+P+V+z,c=q5.CENTRAL_FILE_HEADER+A0(X,2)+P+A0(F.length,2)+"\x00\x00\x00\x00"+A0(_,4)+A0(K,4)+V+z+F;return{fileRecord:g,dirRecord:c}},FG=function($,q,Q,K,J){var Z="",G=z6.transformTo("string",J(K));return Z=q5.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+A0($,2)+A0($,2)+A0(q,4)+A0(Q,4)+A0(G.length,2)+G,Z},MG=function($){var q="";return q=q5.DATA_DESCRIPTOR+A0($.crc32,4)+A0($.compressedSize,4)+A0($.uncompressedSize,4),q};function v2($,q,Q,K){F6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=q,this.zipPlatform=Q,this.encodeFileName=K,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}z6.inherits(v2,F6);v2.prototype.push=function($){var q=$.meta.percent||0,Q=this.entriesCount,K=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,F6.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:Q?(q+100*(Q-K-1))/Q:100}})};v2.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var q=this.streamFiles&&!$.file.dir;if(q){var Q=xq($,q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:Q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};v2.prototype.closedSource=function($){this.accumulate=!1;var q=this.streamFiles&&!$.file.dir,Q=xq($,q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(Q.dirRecord),q)this.push({data:MG($),meta:{percent:100}});else{this.push({data:Q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};v2.prototype.flush=function(){var $=this.bytesWritten;for(var q=0;q{var wG=r4(),NG=Pq(),YG=function($,q){var Q=$||q,K=wG[Q];if(!K)throw Error(Q+" is not a valid compression method !");return K};Tq.generateWorker=function($,q,Q){var K=new NG(q.streamFiles,Q,q.platform,q.encodeFileName),J=0;try{$.forEach(function(Z,G){J++;var W=YG(G.options.compression,q.compression),B=G.options.compressionOptions||q.compressionOptions||{},V=G.dir,U=G.date;G._compressWorker(W,B).withStreamInfo("file",{name:Z,dir:V,date:U,comment:G.comment||"",unixPermissions:G.unixPermissions,dosPermissions:G.dosPermissions}).pipe(K)}),K.entriesCount=J}catch(Z){K.error(Z)}return K}});var Eq=N0(($F,Sq)=>{var kG=T0(),K5=V2();function V8($,q){K5.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(q)}kG.inherits(V8,K5);V8.prototype._bindStream=function($){var q=this;this._stream=$,$.pause(),$.on("data",function(Q){q.push({data:Q,meta:{percent:0}})}).on("error",function(Q){if(q.isPaused)this.generatedError=Q;else q.error(Q)}).on("end",function(){if(q.isPaused)q._upstreamEnded=!0;else q.end()})};V8.prototype.pause=function(){if(!K5.prototype.pause.call(this))return!1;return this._stream.pause(),!0};V8.prototype.resume=function(){if(!K5.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};Sq.exports=V8});var aq=N0((QF,oq)=>{var DG=e1(),U8=T0(),nq=V2(),LG=K4(),dq=J4(),_q=S8(),HG=c$(),vG=uq(),cq=T6(),fG=Eq(),mq=function($,q,Q){var K=U8.getTypeOf(q),J,Z=U8.extend(Q||{},dq);if(Z.date=Z.date||new Date,Z.compression!==null)Z.compression=Z.compression.toUpperCase();if(typeof Z.unixPermissions==="string")Z.unixPermissions=parseInt(Z.unixPermissions,8);if(Z.unixPermissions&&Z.unixPermissions&16384)Z.dir=!0;if(Z.dosPermissions&&Z.dosPermissions&16)Z.dir=!0;if(Z.dir)$=pq($);if(Z.createFolders&&(J=RG($)))iq.call(this,J,!0);var G=K==="string"&&Z.binary===!1&&Z.base64===!1;if(!Q||typeof Q.binary>"u")Z.binary=!G;var W=q instanceof _q&&q.uncompressedSize===0;if(W||Z.dir||!q||q.length===0)Z.base64=!1,Z.binary=!0,q="",Z.compression="STORE",K="string";var B=null;if(q instanceof _q||q instanceof nq)B=q;else if(cq.isNode&&cq.isStream(q))B=new fG($,q);else B=U8.prepareContent($,q,Z.binary,Z.optimizedBinaryString,Z.base64);var V=new HG($,B,Z);this.files[$]=V},RG=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var q=$.lastIndexOf("/");return q>0?$.substring(0,q):""},pq=function($){if($.slice(-1)!=="/")$+="/";return $},iq=function($,q){if(q=typeof q<"u"?q:dq.createFolders,$=pq($),!this.files[$])mq.call(this,$,null,{dir:!0,createFolders:q});return this.files[$]};function bq($){return Object.prototype.toString.call($)==="[object RegExp]"}var IG={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var q,Q,K;for(q in this.files)if(K=this.files[q],Q=q.slice(this.root.length,q.length),Q&&q.slice(0,this.root.length)===this.root)$(Q,K)},filter:function($){var q=[];return this.forEach(function(Q,K){if($(Q,K))q.push(K)}),q},file:function($,q,Q){if(arguments.length===1)if(bq($)){var K=$;return this.filter(function(Z,G){return!G.dir&&K.test(Z)})}else{var J=this.files[this.root+$];if(J&&!J.dir)return J;else return null}else $=this.root+$,mq.call(this,$,q,Q);return this},folder:function($){if(!$)return this;if(bq($))return this.filter(function(J,Z){return Z.dir&&$.test(J)});var q=this.root+$,Q=iq.call(this,q),K=this.clone();return K.root=Q.name,K},remove:function($){$=this.root+$;var q=this.files[$];if(!q){if($.slice(-1)!=="/")$+="/";q=this.files[$]}if(q&&!q.dir)delete this.files[$];else{var Q=this.filter(function(J,Z){return Z.name.slice(0,$.length)===$});for(var K=0;K{var CG=T0();function lq($){this.data=$,this.length=$.length,this.index=0,this.zero=0}lq.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length=this.index;Q--)q=(q<<8)+this.byteAt(Q);return this.index+=$,q},readString:function($){return CG.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};rq.exports=lq});var $7=N0((KF,tq)=>{var sq=e4(),jG=T0();function M6($){sq.call(this,$);for(var q=0;q=0;--Z)if(this.data[Z]===q&&this.data[Z+1]===Q&&this.data[Z+2]===K&&this.data[Z+3]===J)return Z-this.zero;return-1};M6.prototype.readAndCheckSignature=function($){var q=$.charCodeAt(0),Q=$.charCodeAt(1),K=$.charCodeAt(2),J=$.charCodeAt(3),Z=this.readData(4);return q===Z[0]&&Q===Z[1]&&K===Z[2]&&J===Z[3]};M6.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};tq.exports=M6});var QK=N0((JF,$K)=>{var eq=e4(),gG=T0();function w6($){eq.call(this,$)}gG.inherits(w6,eq);w6.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};w6.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};w6.prototype.readAndCheckSignature=function($){var q=this.readData(4);return $===q};w6.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};$K.exports=w6});var q7=N0((VF,KK)=>{var qK=$7(),AG=T0();function Q7($){qK.call(this,$)}AG.inherits(Q7,qK);Q7.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};KK.exports=Q7});var UK=N0((UF,VK)=>{var JK=q7(),XG=T0();function K7($){JK.call(this,$)}XG.inherits(K7,JK);K7.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};VK.exports=K7});var J7=N0((ZF,GK)=>{var J5=T0(),ZK=n2(),yG=$7(),hG=QK(),xG=UK(),OG=q7();GK.exports=function($){var q=J5.getTypeOf($);if(J5.checkSupport(q),q==="string"&&!ZK.uint8array)return new hG($);if(q==="nodebuffer")return new xG($);if(ZK.uint8array)return new OG(J5.transformTo("uint8array",$));return new yG(J5.transformTo("array",$))}});var FK=N0((GF,zK)=>{var V7=J7(),G1=T0(),PG=S8(),WK=u8(),V5=e1(),U5=r4(),TG=n2(),uG=0,SG=3,EG=function($){for(var q in U5){if(!Object.prototype.hasOwnProperty.call(U5,q))continue;if(U5[q].magic===$)return U5[q]}return null};function BK($,q){this.options=$,this.loadOptions=q}BK.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var q,Q;if($.skip(22),this.fileNameLength=$.readInt(2),Q=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(Q),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(q=EG(this.compressionMethod),q===null)throw Error("Corrupted zip : compression "+G1.pretty(this.compressionMethod)+" unknown (inner file : "+G1.transformTo("string",this.fileName)+")");this.decompressed=new PG(this.compressedSize,this.uncompressedSize,this.crc32,q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===uG)this.dosPermissions=this.externalFileAttributes&63;if($===SG)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=V7(this.extraFields[1].value);if(this.uncompressedSize===G1.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G1.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G1.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G1.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var q=$.index+this.extraFieldsLength,Q,K,J;if(!this.extraFields)this.extraFields={};while($.index+4{var _G=J7(),i2=T0(),f2=s4(),cG=FK(),bG=n2();function MK($){this.files=[],this.loadOptions=$}MK.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+i2.pretty(q)+", expected "+i2.pretty($)+")")}},isSignature:function($,q){var Q=this.reader.index;this.reader.setIndex($);var K=this.reader.readString(4),J=K===q;return this.reader.setIndex(Q),J},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),q=bG.uint8array?"uint8array":"array",Q=i2.transformTo(q,$);this.zipComment=this.loadOptions.decodeFileName(Q)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,q=0,Q,K,J;while(q<$)Q=this.reader.readInt(2),K=this.reader.readInt(4),J=this.reader.readData(K),this.zip64ExtensibleData[Q]={id:Q,length:K,value:J}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,q;for($=0;$0)if(this.isSignature(Q,f2.CENTRAL_FILE_HEADER));else this.reader.zero=J;else if(J<0)throw Error("Corrupted zip: missing "+Math.abs(J)+" bytes.")},prepareReader:function($){this.reader=_G($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};wK.exports=MK});var DK=N0((BF,kK)=>{var U7=T0(),Z5=r1(),nG=e1(),dG=NK(),mG=Z4(),YK=T6();function pG($){return new Z5.Promise(function(q,Q){var K=$.decompressed.getContentWorker().pipe(new mG);K.on("error",function(J){Q(J)}).on("end",function(){if(K.streamInfo.crc32!==$.decompressed.crc32)Q(Error("Corrupted zip : CRC32 mismatch"));else q()}).resume()})}kK.exports=function($,q){var Q=this;if(q=U7.extend(q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:nG.utf8decode}),YK.isNode&&YK.isStream($))return Z5.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return U7.prepareContent("the loaded zip file",$,!0,q.optimizedBinaryString,q.base64).then(function(K){var J=new dG(q);return J.load(K),J}).then(function(J){var Z=[Z5.Promise.resolve(J)],G=J.files;if(q.checkCRC32)for(var W=0;W{function Y2(){if(!(this instanceof Y2))return new Y2;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new Y2;for(var q in this)if(typeof this[q]!=="function")$[q]=this[q];return $}}Y2.prototype=aq();Y2.prototype.loadAsync=DK();Y2.support=n2();Y2.defaults=J4();Y2.version="3.10.1";Y2.loadAsync=function($,q){return new Y2().loadAsync($,q)};Y2.external=r1();LK.exports=Y2});var Z8={};c1(Z8,{types:()=>QW,promisify:()=>jK,log:()=>RK,isUndefined:()=>N6,isSymbol:()=>KW,isString:()=>M5,isRegExp:()=>G5,isPrimitive:()=>JW,isObject:()=>Y6,isNumber:()=>fK,isNullOrUndefined:()=>qW,isNull:()=>F5,isFunction:()=>B5,isError:()=>W5,isDate:()=>B7,isBuffer:()=>VW,isBoolean:()=>F7,isArray:()=>vK,inspect:()=>h1,inherits:()=>IK,format:()=>z7,deprecate:()=>oG,default:()=>GW,debuglog:()=>aG,callbackifyOnRejected:()=>N7,callbackify:()=>gK,_extend:()=>w7,TextEncoder:()=>AK,TextDecoder:()=>XK});function z7($,...q){if(!M5($)){var Q=[$];for(var K=0;K=J)return W;switch(W){case"%s":return String(q[K++]);case"%d":return Number(q[K++]);case"%j":try{return JSON.stringify(q[K++])}catch(B){return"[Circular]"}default:return W}});for(var G=q[K];K"u"||process?.noDeprecation===!0)return $;var Q=!1;function K(...J){if(!Q){if(process.throwDeprecation)throw Error(q);else if(process.traceDeprecation)console.trace(q);else console.error(q);Q=!0}return $.apply(this,...J)}return K}function lG($,q){var Q=h1.styles[q];if(Q)return"\x1B["+h1.colors[Q][0]+"m"+$+"\x1B["+h1.colors[Q][1]+"m";else return $}function rG($,q){return $}function sG($){var q={};return $.forEach(function(Q,K){q[Q]=!0}),q}function z5($,q,Q){if($.customInspect&&q&&B5(q.inspect)&&q.inspect!==h1&&!(q.constructor&&q.constructor.prototype===q)){var K=q.inspect(Q,$);if(!M5(K))K=z5($,K,Q);return K}var J=tG($,q);if(J)return J;var Z=Object.keys(q),G=sG(Z);if($.showHidden)Z=Object.getOwnPropertyNames(q);if(W5(q)&&(Z.indexOf("message")>=0||Z.indexOf("description")>=0))return Z7(q);if(Z.length===0){if(B5(q)){var W=q.name?": "+q.name:"";return $.stylize("[Function"+W+"]","special")}if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");if(B7(q))return $.stylize(Date.prototype.toString.call(q),"date");if(W5(q))return Z7(q)}var B="",V=!1,U=["{","}"];if(vK(q))V=!0,U=["[","]"];if(B5(q)){var w=q.name?": "+q.name:"";B=" [Function"+w+"]"}if(G5(q))B=" "+RegExp.prototype.toString.call(q);if(B7(q))B=" "+Date.prototype.toUTCString.call(q);if(W5(q))B=" "+Z7(q);if(Z.length===0&&(!V||q.length==0))return U[0]+B+U[1];if(Q<0)if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");else return $.stylize("[Object]","special");$.seen.push(q);var F;if(V)F=eG($,q,Q,G,Z);else F=Z.map(function(M){return W7($,q,Q,G,M,V)});return $.seen.pop(),$W(F,B,U)}function tG($,q){if(N6(q))return $.stylize("undefined","undefined");if(M5(q)){var Q="'"+JSON.stringify(q).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(Q,"string")}if(fK(q))return $.stylize(""+q,"number");if(F7(q))return $.stylize(""+q,"boolean");if(F5(q))return $.stylize("null","null")}function Z7($){return"["+Error.prototype.toString.call($)+"]"}function eG($,q,Q,K,J){var Z=[];for(var G=0,W=q.length;G-1)if(Z)W=W.split(` `).map(function(V){return" "+V}).join(` `).slice(2);else W=` @@ -13,23 +13,23 @@ `)>=0)K++;return Z+G.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(J>60)return Q[0]+(q===""?"":q+` `)+" "+$.join(`, `)+" "+Q[1];return Q[0]+q+" "+$.join(", ")+" "+Q[1]}function vK($){return Array.isArray($)}function F7($){return typeof $==="boolean"}function F5($){return $===null}function qW($){return $==null}function fK($){return typeof $==="number"}function M5($){return typeof $==="string"}function KW($){return typeof $==="symbol"}function N6($){return $===void 0}function G5($){return Y6($)&&M7($)==="[object RegExp]"}function Y6($){return typeof $==="object"&&$!==null}function B7($){return Y6($)&&M7($)==="[object Date]"}function W5($){return Y6($)&&(M7($)==="[object Error]"||$ instanceof Error)}function B5($){return typeof $==="function"}function JW($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}function VW($){return $ instanceof Buffer}function M7($){return Object.prototype.toString.call($)}function G7($){return $<10?"0"+$.toString(10):$.toString(10)}function ZW(){var $=new Date,q=[G7($.getHours()),G7($.getMinutes()),G7($.getSeconds())].join(":");return[$.getDate(),UW[$.getMonth()],q].join(" ")}function RK(...$){console.log("%s - %s",ZW(),z7.apply(null,$))}function IK($,q){if(q)$.super_=q,$.prototype=Object.create(q.prototype,{constructor:{value:$,enumerable:!1,writable:!0,configurable:!0}})}function w7($,q){if(!q||!Y6(q))return $;var Q=Object.keys(q),K=Q.length;while(K--)$[Q[K]]=q[Q[K]];return $}function CK($,q){return Object.prototype.hasOwnProperty.call($,q)}function N7($,q){if(!$){var Q=Error("Promise was rejected with a falsy value");Q.reason=$,$=Q}return q($)}function gK($){if(typeof $!=="function")throw TypeError('The "original" argument must be of type Function');function q(...Q){var K=Q.pop();if(typeof K!=="function")throw TypeError("The last argument must be of type Function");var J=this,Z=function(...G){return K.apply(J,...G)};$.apply(this,Q).then(function(G){process.nextTick(Z.bind(null,null,G))},function(G){process.nextTick(N7.bind(null,G,Z))})}return Object.setPrototypeOf(q,Object.getPrototypeOf($)),Object.defineProperties(q,Object.getOwnPropertyDescriptors($)),q}var iG,aG,h1,QW=()=>{},UW,jK,AK,XK,GW;var G8=b1(()=>{iG=/%[sdj%]/g;aG=(($={},q={},Q)=>((Q=typeof process<"u"&&!1)&&(Q=Q.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),q=new RegExp("^"+Q+"$","i"),(K)=>{if(K=K.toUpperCase(),!$[K])if(q.test(K))$[K]=function(...J){console.error("%s: %s",K,pid,z7.apply(null,...J))};else $[K]=function(){};return $[K]}))(),h1=(($)=>($.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},$.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},$.custom=Symbol.for("nodejs.util.inspect.custom"),$))(function($,q,...Q){var K={seen:[],stylize:rG};if(Q.length>=1)K.depth=Q[0];if(Q.length>=2)K.colors=Q[1];if(F7(q))K.showHidden=q;else if(q)w7(K,q);if(N6(K.showHidden))K.showHidden=!1;if(N6(K.depth))K.depth=2;if(N6(K.colors))K.colors=!1;if(K.colors)K.stylize=lG;return z5(K,$,K.depth)});UW=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];jK=(($)=>($.custom=Symbol.for("nodejs.util.promisify.custom"),$))(function($){if(typeof $!=="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&$[kCustomPromisifiedSymbol]){var q=$[kCustomPromisifiedSymbol];if(typeof q!=="function")throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(q,kCustomPromisifiedSymbol,{value:q,enumerable:!1,writable:!1,configurable:!0}),q}function q(...Q){var K,J,Z=new Promise(function(G,W){K=G,J=W});Q.push(function(G,W){if(G)J(G);else K(W)});try{$.apply(this,Q)}catch(G){J(G)}return Z}if(Object.setPrototypeOf(q,Object.getPrototypeOf($)),kCustomPromisifiedSymbol)Object.defineProperty(q,kCustomPromisifiedSymbol,{value:q,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(q,Object.getOwnPropertyDescriptors($))});({TextEncoder:AK,TextDecoder:XK}=globalThis),GW={TextEncoder:AK,TextDecoder:XK,promisify:jK,log:RK,inherits:IK,_extend:w7,callbackifyOnRejected:N7,callbackify:gK}});var v7={};c1(v7,{resolveObject:()=>SK,resolve:()=>uK,parse:()=>D6,format:()=>TK,default:()=>DW,Url:()=>Z2,URLSearchParams:()=>OK,URL:()=>L7});function H7($){return typeof $==="string"}function PK($){return typeof $==="object"&&$!==null}function w5($){return $===null}function WW($){return $==null}function Z2(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function D6($,q,Q){if($&&PK($)&&$ instanceof Z2)return $;var K=new Z2;return K.parse($,q,Q),K}function TK($){if(H7($))$=D6($);if(!($ instanceof Z2))return Z2.prototype.format.call($);return $.format()}function uK($,q){return D6($,!1,!0).resolve(q)}function SK($,q){if(!$)return q;return D6($,!1,!0).resolveObject(q)}var L7,OK,BW,zW,FW,MW,wW,Y7,yK,hK,NW=255,xK,YW,kW,k7,k6,D7,DW;var f7=b1(()=>{({URL:L7,URLSearchParams:OK}=globalThis);BW=/^([a-z0-9.+-]+:)/i,zW=/:[0-9]*$/,FW=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,MW=["<",">",'"',"`"," ","\r",` -`,"\t"],wW=["{","}","|","\\","^","`"].concat(MW),Y7=["'"].concat(wW),yK=["%","/","?",";","#"].concat(Y7),hK=["/","?","#"],xK=/^[+a-z0-9A-Z_-]{0,63}$/,YW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kW={javascript:!0,"javascript:":!0},k7={javascript:!0,"javascript:":!0},k6={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},D7={parse($){var q=decodeURIComponent;return($+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(Q,K,J){var Z=K.split("="),G=q(Z[0]||""),W=q(Z[1]||""),B=Q[G];return Q[G]=B===void 0?W:[].concat(B,W),Q},{})},stringify($){var q=encodeURIComponent;return Object.keys($||{}).reduce(function(Q,K){return[].concat($[K]).forEach(function(J){Q.push(q(K)+"="+q(J))}),Q},[]).join("&").replace(/\s/g,"+")}};Z2.prototype.parse=function($,q,Q){if(!H7($))throw TypeError("Parameter 'url' must be a string, not "+typeof $);var K=$.indexOf("?"),J=K!==-1&&K<$.indexOf("#")?"?":"#",Z=$.split(J),G=/\\/g;Z[0]=Z[0].replace(G,"/"),$=Z.join(J);var W=$;if(W=W.trim(),!Q&&$.split("#").length===1){var B=FW.exec(W);if(B){if(this.path=W,this.href=W,this.pathname=B[1],B[2])if(this.search=B[2],q)this.query=D7.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(q)this.search="",this.query={};return this}}var V=BW.exec(W);if(V){V=V[0];var U=V.toLowerCase();this.protocol=U,W=W.substr(V.length)}if(Q||V||W.match(/^\/\/[^@\/]+@[^@\/]+/)){var w=W.substr(0,2)==="//";if(w&&!(V&&k7[V]))W=W.substr(2),this.slashes=!0}if(!k7[V]&&(w||V&&!k6[V])){var F=-1;for(var M=0;M127)v+="x";else v+=H[j];if(!v.match(xK)){var d=z.slice(0,M),_=z.slice(M+1),X=H.match(YW);if(X)d.push(X[1]),_.unshift(X[2]);if(_.length)W="/"+_.join(".")+W;this.hostname=d.join(".");break}}}}if(this.hostname.length>NW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!D)this.hostname=new L7(`https://${this.hostname}`).hostname;var P=this.port?":"+this.port:"",g=this.hostname||"";if(this.host=g+P,this.href+=this.host,D){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),W[0]!=="/")W="/"+W}}if(!kW[U])for(var M=0,N=Y7.length;M0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(Q.search=$.search,Q.query=$.query,!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.href=Q.format(),Q}if(!z.length){if(Q.pathname=null,Q.search)Q.path="/"+Q.search;else Q.path=null;return Q.href=Q.format(),Q}var j=z.slice(-1)[0],n=(Q.host||$.host||z.length>1)&&(j==="."||j==="..")||j==="",d=0;for(var _=z.length;_>=0;_--)if(j=z[_],j===".")z.splice(_,1);else if(j==="..")z.splice(_,1),d++;else if(d)z.splice(_,1),d--;if(!L&&!D)for(;d--;d)z.unshift("..");if(L&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/"))z.unshift("");if(n&&z.join("/").substr(-1)!=="/")z.push("");var X=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){Q.hostname=Q.host=X?"":z.length?z.shift():"";var v=Q.host&&Q.host.indexOf("@")>0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(L=L||Q.host&&z.length,L&&!X)z.unshift("");if(!z.length)Q.pathname=null,Q.path=null;else Q.pathname=z.join("/");if(!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.auth=$.auth||Q.auth,Q.slashes=Q.slashes||$.slashes,Q.href=Q.format(),Q};Z2.prototype.parseHost=function(){var $=this.host,q=zW.exec($);if(q){if(q=q[0],q!==":")this.port=q.substr(1);$=$.substr(0,$.length-q.length)}if($)this.hostname=$};DW={parse:D6,resolve:uK,resolveObject:SK,format:TK,Url:Z2,URL:L7,URLSearchParams:OK}});var I7={};c1(I7,{request:()=>_W,globalAgent:()=>mW,get:()=>cW,default:()=>oW,STATUS_CODES:()=>pW,METHODS:()=>iW,IncomingMessage:()=>nW,ClientRequest:()=>bW,Agent:()=>dW});function RW($){return this[$]}var LW,HW,EK,vW,fW,IW,CW,jW=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?IW??=new WeakMap:CW??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?LW(HW($)):{};let G=q||!$||!$.__esModule?EK(Q,"default",{value:$,enumerable:!0}):Q;for(let W of vW($))if(!fW.call(G,W))EK(G,W,{get:RW.bind($,W),enumerable:!0});if(K)J.set($,G);return G},h0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),cK,gW,x1,AW,bK,O1,nK,XW,dK,L6,yW,_K,R7,hW,xW,mK,pK,OW,PW,iK,oK,TW,uW,SW,EW,aK,_W,cW,bW,nW,dW,mW,pW,iW,oW;var C7=b1(()=>{LW=Object.create,{getPrototypeOf:HW,defineProperty:EK,getOwnPropertyNames:vW}=Object,fW=Object.prototype.hasOwnProperty;cK=h0(($)=>{$.fetch=J(globalThis.fetch)&&J(globalThis.ReadableStream),$.writableStream=J(globalThis.WritableStream),$.abortController=J(globalThis.AbortController);var q;function Q(){if(q!==void 0)return q;if(globalThis.XMLHttpRequest){q=new globalThis.XMLHttpRequest;try{q.open("GET",globalThis.XDomainRequest?"/":"https://example.com")}catch(Z){q=null}}else q=null;return q}function K(Z){var G=Q();if(!G)return!1;try{return G.responseType=Z,G.responseType===Z}catch(W){}return!1}$.arraybuffer=$.fetch||K("arraybuffer"),$.msstream=!$.fetch&&K("ms-stream"),$.mozchunkedarraybuffer=!$.fetch&&K("moz-chunked-arraybuffer"),$.overrideMimeType=$.fetch||(Q()?J(Q().overrideMimeType):!1);function J(Z){return typeof Z==="function"}q=null}),gW=h0(($,q)=>{if(typeof Object.create==="function")q.exports=function(Q,K){if(K)Q.super_=K,Q.prototype=Object.create(K.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else q.exports=function(Q,K){if(K){Q.super_=K;var J=function(){};J.prototype=K.prototype,Q.prototype=new J,Q.prototype.constructor=Q}}}),x1=h0(($,q)=>{try{if(Q=(G8(),X0(Z8)),typeof Q.inherits!=="function")throw"";q.exports=Q.inherits}catch(K){q.exports=gW()}var Q}),AW=h0(($,q)=>{function Q(L,D){var z=Object.keys(L);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(L);D&&(N=N.filter(function(H){return Object.getOwnPropertyDescriptor(L,H).enumerable})),z.push.apply(z,N)}return z}function K(L){for(var D=1;D0)this.tail.next=z;else this.head=z;this.tail=z,++this.length}},{key:"unshift",value:function(D){var z={data:D,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var D=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,D}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(D){if(this.length===0)return"";var z=this.head,N=""+z.data;while(z=z.next)N+=D+z.data;return N}},{key:"concat",value:function(D){if(this.length===0)return w.alloc(0);var z=w.allocUnsafe(D>>>0),N=this.head,H=0;while(N)f(N.data,z,H),H+=N.data.length,N=N.next;return z}},{key:"consume",value:function(D,z){var N;if(Dv.length?v.length:D;if(j===v.length)H+=v;else H+=v.slice(0,D);if(D-=j,D===0){if(j===v.length)if(++N,z.next)this.head=z.next;else this.head=this.tail=null;else this.head=z,z.data=v.slice(j);break}++N}return this.length-=N,H}},{key:"_getBuffer",value:function(D){var z=w.allocUnsafe(D),N=this.head,H=1;N.data.copy(z),D-=N.data.length;while(N=N.next){var v=N.data,j=D>v.length?v.length:D;if(v.copy(z,z.length-D,0,j),D-=j,D===0){if(j===v.length)if(++H,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=v.slice(j);break}++H}return this.length-=H,z}},{key:k,value:function(D,z){return M(this,K(K({},z),{},{depth:0,customInspect:!1}))}}]),L}()}),bK=h0(($,q)=>{function Q(B,V){var U=this,w=this._readableState&&this._readableState.destroyed,F=this._writableState&&this._writableState.destroyed;if(w||F){if(V)V(B);else if(B){if(!this._writableState)process.nextTick(G,this,B);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,process.nextTick(G,this,B)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(B||null,function(M){if(!V&&M)if(!U._writableState)process.nextTick(K,U,M);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,process.nextTick(K,U,M);else process.nextTick(J,U);else if(V)process.nextTick(J,U),V(M);else process.nextTick(J,U)}),this}function K(B,V){G(B,V),J(B)}function J(B){if(B._writableState&&!B._writableState.emitClose)return;if(B._readableState&&!B._readableState.emitClose)return;B.emit("close")}function Z(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function G(B,V){B.emit("error",V)}function W(B,V){var{_readableState:U,_writableState:w}=B;if(U&&U.autoDestroy||w&&w.autoDestroy)B.destroy(V);else B.emit("error",V)}q.exports={destroy:Q,undestroy:Z,errorOrDestroy:W}}),O1=h0(($,q)=>{var Q={};function K(B,V,U){if(!U)U=Error;function w(M,k,f){if(typeof V==="string")return V;else return V(M,k,f)}class F extends U{constructor(M,k,f){super(w(M,k,f))}}F.prototype.name=U.name,F.prototype.code=B,Q[B]=F}function J(B,V){if(Array.isArray(B)){let U=B.length;if(B=B.map((w)=>String(w)),U>2)return`one of ${V} ${B.slice(0,U-1).join(", ")}, or `+B[U-1];else if(U===2)return`one of ${V} ${B[0]} or ${B[1]}`;else return`of ${V} ${B[0]}`}else return`of ${V} ${String(B)}`}function Z(B,V,U){return B.substr(!U||U<0?0:+U,V.length)===V}function G(B,V,U){if(U===void 0||U>B.length)U=B.length;return B.substring(U-V.length,U)===V}function W(B,V,U){if(typeof U!=="number")U=0;if(U+V.length>B.length)return!1;else return B.indexOf(V,U)!==-1}K("ERR_INVALID_OPT_VALUE",function(B,V){return'The value "'+V+'" is invalid for option "'+B+'"'},TypeError),K("ERR_INVALID_ARG_TYPE",function(B,V,U){let w;if(typeof V==="string"&&Z(V,"not "))w="must not be",V=V.replace(/^not /,"");else w="must be";let F;if(G(B," argument"))F=`The ${B} ${w} ${J(V,"type")}`;else{let M=W(B,".")?"property":"argument";F=`The "${B}" ${M} ${w} ${J(V,"type")}`}return F+=`. Received type ${typeof U}`,F},TypeError),K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),K("ERR_METHOD_NOT_IMPLEMENTED",function(B){return"The "+B+" method is not implemented"}),K("ERR_STREAM_PREMATURE_CLOSE","Premature close"),K("ERR_STREAM_DESTROYED",function(B){return"Cannot call "+B+" after a stream was destroyed"}),K("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),K("ERR_STREAM_WRITE_AFTER_END","write after end"),K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),K("ERR_UNKNOWN_ENCODING",function(B){return"Unknown encoding: "+B},TypeError),K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$.codes=Q}),nK=h0(($,q)=>{var Q=O1().codes.ERR_INVALID_OPT_VALUE;function K(Z,G,W){return Z.highWaterMark!=null?Z.highWaterMark:G?Z[W]:null}function J(Z,G,W,B){var V=K(G,B,W);if(V!=null){if(!(isFinite(V)&&Math.floor(V)===V)||V<0){var U=B?W:"highWaterMark";throw new Q(U,V)}return Math.floor(V)}return Z.objectMode?16:16384}q.exports={getHighWaterMark:J}}),XW=h0(($,q)=>{q.exports=(G8(),X0(Z8)).deprecate}),dK=h0(($,q)=>{q.exports=X;function Q(S){var b=this;this.next=null,this.entry=null,this.finish=function(){w0(b,S)}}var K;X.WritableState=d;var J={deprecate:XW()},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(S){return G.from(S)}function V(S){return G.isBuffer(S)||S instanceof W}var U=bK(),w=nK(),F=w.getHighWaterMark,M=O1().codes,k=M.ERR_INVALID_ARG_TYPE,f=M.ERR_METHOD_NOT_IMPLEMENTED,L=M.ERR_MULTIPLE_CALLBACK,D=M.ERR_STREAM_CANNOT_PIPE,z=M.ERR_STREAM_DESTROYED,N=M.ERR_STREAM_NULL_VALUES,H=M.ERR_STREAM_WRITE_AFTER_END,v=M.ERR_UNKNOWN_ENCODING,j=U.errorOrDestroy;x1()(X,Z);function n(){}function d(S,b,O){if(K=K||L6(),S=S||{},typeof O!=="boolean")O=b instanceof K;if(this.objectMode=!!S.objectMode,O)this.objectMode=this.objectMode||!!S.writableObjectMode;this.highWaterMark=F(this,S,"writableHighWaterMark",O),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var E=S.decodeStrings===!1;this.decodeStrings=!E,this.defaultEncoding=S.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){Z0(b,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=S.emitClose!==!1,this.autoDestroy=!!S.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Q(this)}d.prototype.getBuffer=function(){var S=this.bufferedRequest,b=[];while(S)b.push(S),S=S.next;return b},function(){try{Object.defineProperty(d.prototype,"buffer",{get:J.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(S){}}();var _;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")_=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(S){if(_.call(this,S))return!0;if(this!==X)return!1;return S&&S._writableState instanceof d}});else _=function(S){return S instanceof this};function X(S){K=K||L6();var b=this instanceof K;if(!b&&!_.call(X,this))return new X(S);if(this._writableState=new d(S,this,b),this.writable=!0,S){if(typeof S.write==="function")this._write=S.write;if(typeof S.writev==="function")this._writev=S.writev;if(typeof S.destroy==="function")this._destroy=S.destroy;if(typeof S.final==="function")this._final=S.final}Z.call(this)}X.prototype.pipe=function(){j(this,new D)};function P(S,b){var O=new H;j(S,O),process.nextTick(b,O)}function g(S,b,O,E){var a;if(O===null)a=new N;else if(typeof O!=="string"&&!b.objectMode)a=new k("chunk",["string","Buffer"],O);if(a)return j(S,a),process.nextTick(E,a),!1;return!0}X.prototype.write=function(S,b,O){var E=this._writableState,a=!1,K0=!E.objectMode&&V(S);if(K0&&!G.isBuffer(S))S=B(S);if(typeof b==="function")O=b,b=null;if(K0)b="buffer";else if(!b)b=E.defaultEncoding;if(typeof O!=="function")O=n;if(E.ending)P(this,O);else if(K0||g(this,E,S,O))E.pendingcb++,a=h(this,E,K0,S,b,O);return a},X.prototype.cork=function(){this._writableState.corked++},X.prototype.uncork=function(){var S=this._writableState;if(S.corked){if(S.corked--,!S.writing&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest)W0(this,S)}},X.prototype.setDefaultEncoding=function(S){if(typeof S==="string")S=S.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((S+"").toLowerCase())>-1))throw new v(S);return this._writableState.defaultEncoding=S,this},Object.defineProperty(X.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function c(S,b,O){if(!S.objectMode&&S.decodeStrings!==!1&&typeof b==="string")b=G.from(b,O);return b}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function h(S,b,O,E,a,K0){if(!O){var R=c(b,E,a);if(E!==R)O=!0,a="buffer",E=R}var Y=b.objectMode?1:E.length;b.length+=Y;var C=b.length{var Q=Object.keys||function(w){var F=[];for(var M in w)F.push(M);return F};q.exports=B;var K=mK(),J=dK();x1()(B,K);{Z=Q(J.prototype);for(W=0;W{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),_K=h0(($)=>{var q=yW().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),R7=h0(($,q)=>{var Q=O1().codes.ERR_STREAM_PREMATURE_CLOSE;function K(W){var B=!1;return function(){if(B)return;B=!0;for(var V=arguments.length,U=Array(V),w=0;w{var Q;function K(v,j,n){if(j=J(j),j in v)Object.defineProperty(v,j,{value:n,enumerable:!0,configurable:!0,writable:!0});else v[j]=n;return v}function J(v){var j=Z(v,"string");return typeof j==="symbol"?j:String(j)}function Z(v,j){if(typeof v!=="object"||v===null)return v;var n=v[Symbol.toPrimitive];if(n!==void 0){var d=n.call(v,j||"default");if(typeof d!=="object")return d;throw TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(v)}var G=R7(),W=Symbol("lastResolve"),B=Symbol("lastReject"),V=Symbol("error"),U=Symbol("ended"),w=Symbol("lastPromise"),F=Symbol("handlePromise"),M=Symbol("stream");function k(v,j){return{value:v,done:j}}function f(v){var j=v[W];if(j!==null){var n=v[M].read();if(n!==null)v[w]=null,v[W]=null,v[B]=null,j(k(n,!1))}}function L(v){process.nextTick(f,v)}function D(v,j){return function(n,d){v.then(function(){if(j[U]){n(k(void 0,!0));return}j[F](n,d)},d)}}var z=Object.getPrototypeOf(function(){}),N=Object.setPrototypeOf((Q={get stream(){return this[M]},next:function(){var v=this,j=this[V];if(j!==null)return Promise.reject(j);if(this[U])return Promise.resolve(k(void 0,!0));if(this[M].destroyed)return new Promise(function(X,P){process.nextTick(function(){if(v[V])P(v[V]);else X(k(void 0,!0))})});var n=this[w],d;if(n)d=new Promise(D(n,this));else{var _=this[M].read();if(_!==null)return Promise.resolve(k(_,!1));d=new Promise(this[F])}return this[w]=d,d}},K(Q,Symbol.asyncIterator,function(){return this}),K(Q,"return",function(){var v=this;return new Promise(function(j,n){v[M].destroy(null,function(d){if(d){n(d);return}j(k(void 0,!0))})})}),Q),z),H=function(v){var j,n=Object.create(N,(j={},K(j,M,{value:v,writable:!0}),K(j,W,{value:null,writable:!0}),K(j,B,{value:null,writable:!0}),K(j,V,{value:null,writable:!0}),K(j,U,{value:v._readableState.endEmitted,writable:!0}),K(j,F,{value:function(d,_){var X=n[M].read();if(X)n[w]=null,n[W]=null,n[B]=null,d(k(X,!1));else n[W]=d,n[B]=_},writable:!0}),j));return n[w]=null,G(v,function(d){if(d&&d.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=n[B];if(_!==null)n[w]=null,n[W]=null,n[B]=null,_(d);n[V]=d;return}var X=n[W];if(X!==null)n[w]=null,n[W]=null,n[B]=null,X(k(void 0,!0));n[U]=!0}),v.on("readable",L.bind(null,n)),n};q.exports=H}),xW=h0(($,q)=>{function Q(w,F,M,k,f,L,D){try{var z=w[L](D),N=z.value}catch(H){M(H);return}if(z.done)F(N);else Promise.resolve(N).then(k,f)}function K(w){return function(){var F=this,M=arguments;return new Promise(function(k,f){var L=w.apply(F,M);function D(N){Q(L,k,f,D,z,"next",N)}function z(N){Q(L,k,f,D,z,"throw",N)}D(void 0)})}}function J(w,F){var M=Object.keys(w);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(w);F&&(k=k.filter(function(f){return Object.getOwnPropertyDescriptor(w,f).enumerable})),M.push.apply(M,k)}return M}function Z(w){for(var F=1;F{q.exports=g;var Q;g.ReadableState=P;var K=(i1(),X0(p1)).EventEmitter,J=function(R,Y){return R.listeners(Y).length},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(R){return G.from(R)}function V(R){return G.isBuffer(R)||R instanceof W}var U=(G8(),X0(Z8)),w;if(U&&U.debuglog)w=U.debuglog("stream");else w=function(){};var F=AW(),M=bK(),k=nK(),f=k.getHighWaterMark,L=O1().codes,D=L.ERR_INVALID_ARG_TYPE,z=L.ERR_STREAM_PUSH_AFTER_EOF,N=L.ERR_METHOD_NOT_IMPLEMENTED,H=L.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,j,n;x1()(g,Z);var d=M.errorOrDestroy,_=["error","close","destroy","pause","resume"];function X(R,Y,C){if(typeof R.prependListener==="function")return R.prependListener(Y,C);if(!R._events||!R._events[Y])R.on(Y,C);else if(Array.isArray(R._events[Y]))R._events[Y].unshift(C);else R._events[Y]=[C,R._events[Y]]}function P(R,Y,C){if(Q=Q||L6(),R=R||{},typeof C!=="boolean")C=Y instanceof Q;if(this.objectMode=!!R.objectMode,C)this.objectMode=this.objectMode||!!R.readableObjectMode;if(this.highWaterMark=f(this,R,"readableHighWaterMark",C),this.buffer=new F,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.destroyed=!1,this.defaultEncoding=R.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,R.encoding){if(!v)v=_K().StringDecoder;this.decoder=new v(R.encoding),this.encoding=R.encoding}}function g(R){if(Q=Q||L6(),!(this instanceof g))return new g(R);var Y=this instanceof Q;if(this._readableState=new P(R,this,Y),this.readable=!0,R){if(typeof R.read==="function")this._read=R.read;if(typeof R.destroy==="function")this._destroy=R.destroy}Z.call(this)}Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(R){if(!this._readableState)return;this._readableState.destroyed=R}}),g.prototype.destroy=M.destroy,g.prototype._undestroy=M.undestroy,g.prototype._destroy=function(R,Y){Y(R)},g.prototype.push=function(R,Y){var C=this._readableState,u;if(!C.objectMode){if(typeof R==="string"){if(Y=Y||C.defaultEncoding,Y!==C.encoding)R=G.from(R,Y),Y="";u=!0}}else u=!0;return c(this,R,Y,!1,u)},g.prototype.unshift=function(R){return c(this,R,null,!0,!1)};function c(R,Y,C,u,e){w("readableAddChunk",Y);var r=R._readableState;if(Y===null)r.reading=!1,F0(R,r);else{var s;if(!e)s=x(r,Y);if(s)d(R,s);else if(r.objectMode||Y&&Y.length>0){if(typeof Y!=="string"&&!r.objectMode&&Object.getPrototypeOf(Y)!==G.prototype)Y=B(Y);if(u)if(r.endEmitted)d(R,new H);else h(R,r,Y,!0);else if(r.ended)d(R,new z);else if(r.destroyed)return!1;else if(r.reading=!1,r.decoder&&!C)if(Y=r.decoder.write(Y),r.objectMode||Y.length!==0)h(R,r,Y,!1);else y(R,r);else h(R,r,Y,!1)}else if(!u)r.reading=!1,y(R,r)}return!r.ended&&(r.length=l)R=l;else R--,R|=R>>>1,R|=R>>>2,R|=R>>>4,R|=R>>>8,R|=R>>>16,R++;return R}function Z0(R,Y){if(R<=0||Y.length===0&&Y.ended)return 0;if(Y.objectMode)return 1;if(R!==R)if(Y.flowing&&Y.length)return Y.buffer.head.data.length;else return Y.length;if(R>Y.highWaterMark)Y.highWaterMark=$0(R);if(R<=Y.length)return R;if(!Y.ended)return Y.needReadable=!0,0;return Y.length}g.prototype.read=function(R){w("read",R),R=parseInt(R,10);var Y=this._readableState,C=R;if(R!==0)Y.emittedReadable=!1;if(R===0&&Y.needReadable&&((Y.highWaterMark!==0?Y.length>=Y.highWaterMark:Y.length>0)||Y.ended)){if(w("read: emitReadable",Y.length,Y.ended),Y.length===0&&Y.ended)E(this);else p(this);return null}if(R=Z0(R,Y),R===0&&Y.ended){if(Y.length===0)E(this);return null}var u=Y.needReadable;if(w("need readable",u),Y.length===0||Y.length-R0)e=O(R,Y);else e=null;if(e===null)Y.needReadable=Y.length<=Y.highWaterMark,R=0;else Y.length-=R,Y.awaitDrain=0;if(Y.length===0){if(!Y.ended)Y.needReadable=!0;if(C!==R&&Y.ended)E(this)}if(e!==null)this.emit("data",e);return e};function F0(R,Y){if(w("onEofChunk"),Y.ended)return;if(Y.decoder){var C=Y.decoder.end();if(C&&C.length)Y.buffer.push(C),Y.length+=Y.objectMode?1:C.length}if(Y.ended=!0,Y.sync)p(R);else if(Y.needReadable=!1,!Y.emittedReadable)Y.emittedReadable=!0,W0(R)}function p(R){var Y=R._readableState;if(w("emitReadable",Y.needReadable,Y.emittedReadable),Y.needReadable=!1,!Y.emittedReadable)w("emitReadable",Y.flowing),Y.emittedReadable=!0,process.nextTick(W0,R)}function W0(R){var Y=R._readableState;if(w("emitReadable_",Y.destroyed,Y.length,Y.ended),!Y.destroyed&&(Y.length||Y.ended))R.emit("readable"),Y.emittedReadable=!1;Y.needReadable=!Y.flowing&&!Y.ended&&Y.length<=Y.highWaterMark,b(R)}function y(R,Y){if(!Y.readingMore)Y.readingMore=!0,process.nextTick(i,R,Y)}function i(R,Y){while(!Y.reading&&!Y.ended&&(Y.length1&&K0(u.pipes,R)!==-1)&&!G0)w("false write response, pause",u.awaitDrain),u.awaitDrain++;C.pause()}}function I0(O0){if(w("onerror",O0),q2(),R.removeListener("error",I0),J(R,"error")===0)d(R,O0)}X(R,"error",I0);function m0(){R.removeListener("finish",p0),q2()}R.once("close",m0);function p0(){w("onfinish"),R.removeListener("close",m0),q2()}R.once("finish",p0);function q2(){w("unpipe"),C.unpipe(R)}if(R.emit("pipe",C),!u.flowing)w("pipe resume"),C.resume();return R};function U0(R){return function(){var Y=R._readableState;if(w("pipeOnDrain",Y.awaitDrain),Y.awaitDrain)Y.awaitDrain--;if(Y.awaitDrain===0&&J(R,"data"))Y.flowing=!0,b(R)}}g.prototype.unpipe=function(R){var Y=this._readableState,C={hasUnpiped:!1};if(Y.pipesCount===0)return this;if(Y.pipesCount===1){if(R&&R!==Y.pipes)return this;if(!R)R=Y.pipes;if(Y.pipes=null,Y.pipesCount=0,Y.flowing=!1,R)R.emit("unpipe",this,C);return this}if(!R){var{pipes:u,pipesCount:e}=Y;Y.pipes=null,Y.pipesCount=0,Y.flowing=!1;for(var r=0;r0,u.flowing!==!1)this.resume()}else if(R==="readable"){if(!u.endEmitted&&!u.readableListening){if(u.readableListening=u.needReadable=!0,u.flowing=!1,u.emittedReadable=!1,w("on readable",u.length,u.reading),u.length)p(this);else if(!u.reading)process.nextTick(V0,this)}}return C},g.prototype.addListener=g.prototype.on,g.prototype.removeListener=function(R,Y){var C=Z.prototype.removeListener.call(this,R,Y);if(R==="readable")process.nextTick(m,this);return C},g.prototype.removeAllListeners=function(R){var Y=Z.prototype.removeAllListeners.apply(this,arguments);if(R==="readable"||R===void 0)process.nextTick(m,this);return Y};function m(R){var Y=R._readableState;if(Y.readableListening=R.listenerCount("readable")>0,Y.resumeScheduled&&!Y.paused)Y.flowing=!0;else if(R.listenerCount("data")>0)R.resume()}function V0(R){w("readable nexttick read 0"),R.read(0)}g.prototype.resume=function(){var R=this._readableState;if(!R.flowing)w("resume"),R.flowing=!R.readableListening,w0(this,R);return R.paused=!1,this};function w0(R,Y){if(!Y.resumeScheduled)Y.resumeScheduled=!0,process.nextTick(S,R,Y)}function S(R,Y){if(w("resume",Y.reading),!Y.reading)R.read(0);if(Y.resumeScheduled=!1,R.emit("resume"),b(R),Y.flowing&&!Y.reading)R.read(0)}g.prototype.pause=function(){if(w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)w("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function b(R){var Y=R._readableState;w("flow",Y.flowing);while(Y.flowing&&R.read()!==null);}if(g.prototype.wrap=function(R){var Y=this,C=this._readableState,u=!1;R.on("end",function(){if(w("wrapped end"),C.decoder&&!C.ended){var s=C.decoder.end();if(s&&s.length)Y.push(s)}Y.push(null)}),R.on("data",function(s){if(w("wrapped data"),C.decoder)s=C.decoder.write(s);if(C.objectMode&&(s===null||s===void 0))return;else if(!C.objectMode&&(!s||!s.length))return;var T=Y.push(s);if(!T)u=!0,R.pause()});for(var e in R)if(this[e]===void 0&&typeof R[e]==="function")this[e]=function(s){return function(){return R[s].apply(R,arguments)}}(e);for(var r=0;r<_.length;r++)R.on(_[r],this.emit.bind(this,_[r]));return this._read=function(s){if(w("wrapped _read",s),u)u=!1,R.resume()},this},typeof Symbol==="function")g.prototype[Symbol.asyncIterator]=function(){if(j===void 0)j=hW();return j(this)};Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(g.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(g.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){if(this._readableState)this._readableState.flowing=R}}),g._fromList=O,Object.defineProperty(g.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function O(R,Y){if(Y.length===0)return null;var C;if(Y.objectMode)C=Y.buffer.shift();else if(!R||R>=Y.length){if(Y.decoder)C=Y.buffer.join("");else if(Y.buffer.length===1)C=Y.buffer.first();else C=Y.buffer.concat(Y.length);Y.buffer.clear()}else C=Y.buffer.consume(R,Y.decoder);return C}function E(R){var Y=R._readableState;if(w("endReadable",Y.endEmitted),!Y.endEmitted)Y.ended=!0,process.nextTick(a,Y,R)}function a(R,Y){if(w("endReadableNT",R.endEmitted,R.length),!R.endEmitted&&R.length===0){if(R.endEmitted=!0,Y.readable=!1,Y.emit("end"),R.autoDestroy){var C=Y._writableState;if(!C||C.autoDestroy&&C.finished)Y.destroy()}}}if(typeof Symbol==="function")g.from=function(R,Y){if(n===void 0)n=xW();return n(g,R,Y)};function K0(R,Y){for(var C=0,u=R.length;C{q.exports=V;var Q=O1().codes,K=Q.ERR_METHOD_NOT_IMPLEMENTED,J=Q.ERR_MULTIPLE_CALLBACK,Z=Q.ERR_TRANSFORM_ALREADY_TRANSFORMING,G=Q.ERR_TRANSFORM_WITH_LENGTH_0,W=L6();x1()(V,W);function B(F,M){var k=this._transformState;k.transforming=!1;var f=k.writecb;if(f===null)return this.emit("error",new J);if(k.writechunk=null,k.writecb=null,M!=null)this.push(M);f(F);var L=this._readableState;if(L.reading=!1,L.needReadable||L.length{q.exports=K;var Q=pK();x1()(K,Q);function K(J){if(!(this instanceof K))return new K(J);Q.call(this,J)}K.prototype._transform=function(J,Z,G){G(null,J)}}),PW=h0(($,q)=>{var Q;function K(k){var f=!1;return function(){if(f)return;f=!0,k.apply(void 0,arguments)}}var J=O1().codes,Z=J.ERR_MISSING_ARGS,G=J.ERR_STREAM_DESTROYED;function W(k){if(k)throw k}function B(k){return k.setHeader&&typeof k.abort==="function"}function V(k,f,L,D){D=K(D);var z=!1;if(k.on("close",function(){z=!0}),Q===void 0)Q=R7();Q(k,{readable:f,writable:L},function(H){if(H)return D(H);z=!0,D()});var N=!1;return function(H){if(z)return;if(N)return;if(N=!0,B(k))return k.abort();if(typeof k.destroy==="function")return k.destroy();D(H||new G("pipe"))}}function U(k){k()}function w(k,f){return k.pipe(f)}function F(k){if(!k.length)return W;if(typeof k[k.length-1]!=="function")return W;return k.pop()}function M(){for(var k=arguments.length,f=Array(k),L=0;L0;return V(H,j,n,function(d){if(!z)z=d;if(d)N.forEach(U);if(j)return;N.forEach(U),D(z)})});return f.reduce(w)}q.exports=M}),iK=h0(($,q)=>{var Q=a1();$=q.exports=mK(),$.Stream=Q||$,$.Readable=$,$.Writable=dK(),$.Duplex=L6(),$.Transform=pK(),$.PassThrough=OW(),$.finished=R7(),$.pipeline=PW()}),oK=h0(($)=>{var q=cK(),Q=x1(),K=iK(),J=$.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Z=$.IncomingMessage=function(G,W,B,V){var U=this;if(K.Readable.call(U),U._mode=B,U.headers={},U.rawHeaders=[],U.trailers={},U.rawTrailers=[],U.on("end",function(){process.nextTick(function(){U.emit("close")})}),B==="fetch"){let D=function(){M.read().then(function(z){if(U._destroyed)return;if(V(z.done),z.done){U.push(null);return}U.push(Buffer.from(z.value)),D()}).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)})};var w=D;if(U._fetchResponse=W,U.url=W.url,U.statusCode=W.status,U.statusMessage=W.statusText,W.headers.forEach(function(z,N){U.headers[N.toLowerCase()]=z,U.rawHeaders.push(N,z)}),q.writableStream){var F=new WritableStream({write:function(z){return V(!1),new Promise(function(N,H){if(U._destroyed)H();else if(U.push(Buffer.from(z)))N();else U._resumeFetch=N})},close:function(){if(V(!0),!U._destroyed)U.push(null)},abort:function(z){if(V(!0),!U._destroyed)U.emit("error",z)}});try{W.body.pipeTo(F).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)});return}catch(z){}}var M=W.body.getReader();D()}else{U._xhr=G,U._pos=0,U.url=G.responseURL,U.statusCode=G.status,U.statusMessage=G.statusText;var k=G.getAllResponseHeaders().split(/\r?\n/);if(k.forEach(function(D){var z=D.match(/^([^:]+):\s*(.*)/);if(z){var N=z[1].toLowerCase();if(N==="set-cookie"){if(U.headers[N]===void 0)U.headers[N]=[];U.headers[N].push(z[2])}else if(U.headers[N]!==void 0)U.headers[N]+=", "+z[2];else U.headers[N]=z[2];U.rawHeaders.push(z[1],z[2])}}),U._charset="x-user-defined",!q.overrideMimeType){var f=U.rawHeaders["mime-type"];if(f){var L=f.match(/;\s*charset=([^;])(;|$)/);if(L)U._charset=L[1].toLowerCase()}if(!U._charset)U._charset="utf-8"}}};Q(Z,K.Readable),Z.prototype._read=function(){var G=this,W=G._resumeFetch;if(W)G._resumeFetch=null,W()},Z.prototype._onXHRProgress=function(G){var W=this,B=W._xhr,V=null;switch(W._mode){case"text":if(V=B.responseText,V.length>W._pos){var U=V.substr(W._pos);if(W._charset==="x-user-defined"){var w=Buffer.alloc(U.length);for(var F=0;FW._pos)W.push(Buffer.from(new Uint8Array(M.result.slice(W._pos)))),W._pos=M.result.byteLength},M.onload=function(){G(!0),W.push(null)},M.readAsArrayBuffer(V);break}if(W._xhr.readyState===J.DONE&&W._mode!=="ms-stream")G(!0),W.push(null)}}),TW=h0(($,q)=>{var Q=cK(),K=x1(),J=oK(),Z=iK(),G=J.IncomingMessage,W=J.readyStates;function B(F,M){if(Q.fetch&&M)return"fetch";else if(Q.mozchunkedarraybuffer)return"moz-chunked-arraybuffer";else if(Q.msstream)return"ms-stream";else if(Q.arraybuffer&&F)return"arraybuffer";else return"text"}var V=q.exports=function(F){var M=this;if(Z.Writable.call(M),M._opts=F,M._body=[],M._headers={},F.auth)M.setHeader("Authorization","Basic "+Buffer.from(F.auth).toString("base64"));Object.keys(F.headers).forEach(function(L){M.setHeader(L,F.headers[L])});var k,f=!0;if(F.mode==="disable-fetch"||"requestTimeout"in F&&!Q.abortController)f=!1,k=!0;else if(F.mode==="prefer-streaming")k=!1;else if(F.mode==="allow-wrong-content-type")k=!Q.overrideMimeType;else if(!F.mode||F.mode==="default"||F.mode==="prefer-fast")k=!0;else throw Error("Invalid value for opts.mode");M._mode=B(k,f),M._fetchTimer=null,M._socketTimeout=null,M._socketTimer=null,M.on("finish",function(){M._onFinish()})};K(V,Z.Writable),V.prototype.setHeader=function(F,M){var k=this,f=F.toLowerCase();if(w.indexOf(f)!==-1)return;k._headers[f]={name:F,value:M}},V.prototype.getHeader=function(F){var M=this._headers[F.toLowerCase()];if(M)return M.value;return null},V.prototype.removeHeader=function(F){var M=this;delete M._headers[F.toLowerCase()]},V.prototype._onFinish=function(){var F=this;if(F._destroyed)return;var M=F._opts;if("timeout"in M&&M.timeout!==0)F.setTimeout(M.timeout);var k=F._headers,f=null;if(M.method!=="GET"&&M.method!=="HEAD")f=new Blob(F._body,{type:(k["content-type"]||{}).value||""});var L=[];if(Object.keys(k).forEach(function(H){var v=k[H].name,j=k[H].value;if(Array.isArray(j))j.forEach(function(n){L.push([v,n])});else L.push([v,j])}),F._mode==="fetch"){var D=null;if(Q.abortController){var z=new AbortController;if(D=z.signal,F._fetchAbortController=z,"requestTimeout"in M&&M.requestTimeout!==0)F._fetchTimer=globalThis.setTimeout(function(){if(F.emit("requestTimeout"),F._fetchAbortController)F._fetchAbortController.abort()},M.requestTimeout)}globalThis.fetch(F._opts.url,{method:F._opts.method,headers:L,body:f||void 0,mode:"cors",credentials:M.withCredentials?"include":"same-origin",signal:D}).then(function(H){F._fetchResponse=H,F._resetTimers(!1),F._connect()},function(H){if(F._resetTimers(!0),!F._destroyed)F.emit("error",H)})}else{var N=F._xhr=new globalThis.XMLHttpRequest;try{N.open(F._opts.method,F._opts.url,!0)}catch(H){process.nextTick(function(){F.emit("error",H)});return}if("responseType"in N)N.responseType=F._mode;if("withCredentials"in N)N.withCredentials=!!M.withCredentials;if(F._mode==="text"&&"overrideMimeType"in N)N.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in M)N.timeout=M.requestTimeout,N.ontimeout=function(){F.emit("requestTimeout")};if(L.forEach(function(H){N.setRequestHeader(H[0],H[1])}),F._response=null,N.onreadystatechange=function(){switch(N.readyState){case W.LOADING:case W.DONE:F._onXHRProgress();break}},F._mode==="moz-chunked-arraybuffer")N.onprogress=function(){F._onXHRProgress()};N.onerror=function(){if(F._destroyed)return;F._resetTimers(!0),F.emit("error",Error("XHR error"))};try{N.send(f)}catch(H){process.nextTick(function(){F.emit("error",H)});return}}};function U(F){try{var M=F.status;return M!==null&&M!==0}catch(k){return!1}}V.prototype._onXHRProgress=function(){var F=this;if(F._resetTimers(!1),!U(F._xhr)||F._destroyed)return;if(!F._response)F._connect();F._response._onXHRProgress(F._resetTimers.bind(F))},V.prototype._connect=function(){var F=this;if(F._destroyed)return;F._response=new G(F._xhr,F._fetchResponse,F._mode,F._resetTimers.bind(F)),F._response.on("error",function(M){F.emit("error",M)}),F.emit("response",F._response)},V.prototype._write=function(F,M,k){var f=this;f._body.push(F),k()},V.prototype._resetTimers=function(F){var M=this;if(globalThis.clearTimeout(M._socketTimer),M._socketTimer=null,F)globalThis.clearTimeout(M._fetchTimer),M._fetchTimer=null;else if(M._socketTimeout)M._socketTimer=globalThis.setTimeout(function(){M.emit("timeout")},M._socketTimeout)},V.prototype.abort=V.prototype.destroy=function(F){var M=this;if(M._destroyed=!0,M._resetTimers(!0),M._response)M._response._destroyed=!0;if(M._xhr)M._xhr.abort();else if(M._fetchAbortController)M._fetchAbortController.abort();if(F)M.emit("error",F)},V.prototype.end=function(F,M,k){var f=this;if(typeof F==="function")k=F,F=void 0;Z.Writable.prototype.end.call(f,F,M,k)},V.prototype.setTimeout=function(F,M){var k=this;if(M)k.once("timeout",M);k._socketTimeout=F,k._resetTimers(!1)},V.prototype.flushHeaders=function(){},V.prototype.setNoDelay=function(){},V.prototype.setSocketKeepAlive=function(){};var w=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}),uW=h0(($,q)=>{q.exports=K;var Q=Object.prototype.hasOwnProperty;function K(){var J={};for(var Z=0;Z{q.exports=(C7(),X0(I7)).STATUS_CODES}),EW=h0(($)=>{var q=TW(),Q=oK(),K=uW(),J=SW(),Z=(f7(),X0(v7)),G=$;G.request=function(W,B){if(typeof W==="string")W=Z.parse(W);else W=K(W);var V=globalThis.location.protocol.search(/^https?:$/)===-1?"http:":"",U=W.protocol||V,w=W.hostname||W.host,F=W.port,M=W.path||"/";if(w&&w.indexOf(":")!==-1)w="["+w+"]";W.url=(w?U+"//"+w:"")+(F?":"+F:"")+M,W.method=(W.method||"GET").toUpperCase(),W.headers=W.headers||{};var k=new q(W);if(B)k.on("response",B);return k},G.get=function(W,B){var V=G.request(W,B);return V.end(),V},G.ClientRequest=q,G.IncomingMessage=Q.IncomingMessage,G.Agent=function(){},G.Agent.defaultMaxSockets=4,G.globalAgent=new G.Agent,G.STATUS_CODES=J,G.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}),aK=jW(EW(),1),{request:_W,get:cW,ClientRequest:bW,IncomingMessage:nW,Agent:dW,globalAgent:mW,STATUS_CODES:pW,METHODS:iW}=aK.default,oW=aK.default});var sK={};c1(sK,{validateHeaderValue:()=>LB,validateHeaderName:()=>DB,setMaxIdleHTTPParsers:()=>kB,request:()=>YB,maxHeaderSize:()=>NB,globalAgent:()=>wB,get:()=>MB,default:()=>HB,createServer:()=>FB,ServerResponse:()=>zB,Server:()=>BB,STATUS_CODES:()=>WB,OutgoingMessage:()=>GB,METHODS:()=>ZB,IncomingMessage:()=>UB,ClientRequest:()=>VB,Agent:()=>JB});function tW($){return this[$]}var aW,lW,lK,rW,sW,eW,$B,QB=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?eW??=new WeakMap:$B??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?aW(lW($)):{};let G=q||!$||!$.__esModule?lK(Q,"default",{value:$,enumerable:!0}):Q;for(let W of rW($))if(!sW.call(G,W))lK(G,W,{get:tW.bind($,W),enumerable:!0});if(K)J.set($,G);return G},qB=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),KB,rK,JB,VB,UB,ZB,GB,WB,BB,zB,FB,MB,wB,NB,YB,kB,DB,LB,HB;var tK=b1(()=>{aW=Object.create,{getPrototypeOf:lW,defineProperty:lK,getOwnPropertyNames:rW}=Object,sW=Object.prototype.hasOwnProperty;KB=qB(($,q)=>{var Q=(C7(),X0(I7)),K=(f7(),X0(v7)),J=$;for(Z in Q)if(Q.hasOwnProperty(Z))J[Z]=Q[Z];var Z;J.request=function(W,B){return W=G(W),Q.request.call(this,W,B)},J.get=function(W,B){return W=G(W),Q.get.call(this,W,B)};function G(W){if(typeof W==="string")W=K.parse(W);if(!W.protocol)W.protocol="https:";if(W.protocol!=="https:")throw Error('Protocol "'+W.protocol+'" not supported. Expected "https:"');return W}}),rK=QB(KB(),1),{Agent:JB,ClientRequest:VB,IncomingMessage:UB,METHODS:ZB,OutgoingMessage:GB,STATUS_CODES:WB,Server:BB,ServerResponse:zB,createServer:FB,get:MB,globalAgent:wB,maxHeaderSize:NB,request:YB,setMaxIdleHTTPParsers:kB,validateHeaderName:DB,validateHeaderValue:LB}=rK,HB=rK});var N8=globalThis;if(typeof N8.global>"u")N8.global=globalThis;if(typeof N8.__require>"u")N8.__require=($)=>{throw Error(`Dynamic require of "${$}" is not supported in the sandbox`)};t0();var Fz=J9(h9(),1);var c7=J9(HK(),1);function W2($,q,Q,K){function J(Z){return Z instanceof Q?Z:new Q(function(G){G(Z)})}return new(Q||(Q=Promise))(function(Z,G){function W(U){try{V(K.next(U))}catch(w){G(w)}}function B(U){try{V(K.throw(U))}catch(w){G(w)}}function V(U){U.done?Z(U.value):J(U.value).then(W,B)}V((K=K.apply($,q||[])).next())})}var L0=914400,w8=12700,n0=`\r -`,vB=2147483649,j7=/^[0-9a-fA-F]{6}$/,fB=1.67,RB=27,H6={type:"solid",color:"666666",pt:1},JJ=[0.05,0.1,0.05,0.1],v6={color:"363636",pt:1},u1={color:"888888",style:"solid",size:1,cap:"flat"},Q2="000000",k2=12,IB=18,f6="LAYOUT_16x9",x7="DEFAULT",VJ="333333",P1={type:"outer",blur:3,offset:1.811023622047244,angle:90,color:"000000",opacity:0.35,rotateWithShape:!0},M8=[0.5,0.5,0.5,0.5],eK={color:"000000"},CB={size:8,color:"FFFFFF",opacity:0.75},o2="2094734552",Y5="2094734553",B8="2094734554",O7="2094734555",UJ="2094734556",W8="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),z8=["C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360","C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360"],jB=["5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7","5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7"],R6;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(R6||(R6={}));var I6;(function($){$.b="b",$.ctr="ctr",$.t="t"})(I6||(I6={}));var ZJ="{F7021451-1387-4CA6-816F-3879F97B5CBC}",P7;(function($){$.arraybuffer="arraybuffer",$.base64="base64",$.binarystring="binarystring",$.blob="blob",$.nodebuffer="nodebuffer",$.uint8array="uint8array"})(P7||(P7={}));var T7;(function($){$.area="area",$.bar="bar",$.bar3d="bar3D",$.bubble="bubble",$.bubble3d="bubble3D",$.doughnut="doughnut",$.line="line",$.pie="pie",$.radar="radar",$.scatter="scatter"})(T7||(T7={}));var u7;(function($){$.accentBorderCallout1="accentBorderCallout1",$.accentBorderCallout2="accentBorderCallout2",$.accentBorderCallout3="accentBorderCallout3",$.accentCallout1="accentCallout1",$.accentCallout2="accentCallout2",$.accentCallout3="accentCallout3",$.actionButtonBackPrevious="actionButtonBackPrevious",$.actionButtonBeginning="actionButtonBeginning",$.actionButtonBlank="actionButtonBlank",$.actionButtonDocument="actionButtonDocument",$.actionButtonEnd="actionButtonEnd",$.actionButtonForwardNext="actionButtonForwardNext",$.actionButtonHelp="actionButtonHelp",$.actionButtonHome="actionButtonHome",$.actionButtonInformation="actionButtonInformation",$.actionButtonMovie="actionButtonMovie",$.actionButtonReturn="actionButtonReturn",$.actionButtonSound="actionButtonSound",$.arc="arc",$.bentArrow="bentArrow",$.bentUpArrow="bentUpArrow",$.bevel="bevel",$.blockArc="blockArc",$.borderCallout1="borderCallout1",$.borderCallout2="borderCallout2",$.borderCallout3="borderCallout3",$.bracePair="bracePair",$.bracketPair="bracketPair",$.callout1="callout1",$.callout2="callout2",$.callout3="callout3",$.can="can",$.chartPlus="chartPlus",$.chartStar="chartStar",$.chartX="chartX",$.chevron="chevron",$.chord="chord",$.circularArrow="circularArrow",$.cloud="cloud",$.cloudCallout="cloudCallout",$.corner="corner",$.cornerTabs="cornerTabs",$.cube="cube",$.curvedDownArrow="curvedDownArrow",$.curvedLeftArrow="curvedLeftArrow",$.curvedRightArrow="curvedRightArrow",$.curvedUpArrow="curvedUpArrow",$.custGeom="custGeom",$.decagon="decagon",$.diagStripe="diagStripe",$.diamond="diamond",$.dodecagon="dodecagon",$.donut="donut",$.doubleWave="doubleWave",$.downArrow="downArrow",$.downArrowCallout="downArrowCallout",$.ellipse="ellipse",$.ellipseRibbon="ellipseRibbon",$.ellipseRibbon2="ellipseRibbon2",$.flowChartAlternateProcess="flowChartAlternateProcess",$.flowChartCollate="flowChartCollate",$.flowChartConnector="flowChartConnector",$.flowChartDecision="flowChartDecision",$.flowChartDelay="flowChartDelay",$.flowChartDisplay="flowChartDisplay",$.flowChartDocument="flowChartDocument",$.flowChartExtract="flowChartExtract",$.flowChartInputOutput="flowChartInputOutput",$.flowChartInternalStorage="flowChartInternalStorage",$.flowChartMagneticDisk="flowChartMagneticDisk",$.flowChartMagneticDrum="flowChartMagneticDrum",$.flowChartMagneticTape="flowChartMagneticTape",$.flowChartManualInput="flowChartManualInput",$.flowChartManualOperation="flowChartManualOperation",$.flowChartMerge="flowChartMerge",$.flowChartMultidocument="flowChartMultidocument",$.flowChartOfflineStorage="flowChartOfflineStorage",$.flowChartOffpageConnector="flowChartOffpageConnector",$.flowChartOnlineStorage="flowChartOnlineStorage",$.flowChartOr="flowChartOr",$.flowChartPredefinedProcess="flowChartPredefinedProcess",$.flowChartPreparation="flowChartPreparation",$.flowChartProcess="flowChartProcess",$.flowChartPunchedCard="flowChartPunchedCard",$.flowChartPunchedTape="flowChartPunchedTape",$.flowChartSort="flowChartSort",$.flowChartSummingJunction="flowChartSummingJunction",$.flowChartTerminator="flowChartTerminator",$.folderCorner="folderCorner",$.frame="frame",$.funnel="funnel",$.gear6="gear6",$.gear9="gear9",$.halfFrame="halfFrame",$.heart="heart",$.heptagon="heptagon",$.hexagon="hexagon",$.homePlate="homePlate",$.horizontalScroll="horizontalScroll",$.irregularSeal1="irregularSeal1",$.irregularSeal2="irregularSeal2",$.leftArrow="leftArrow",$.leftArrowCallout="leftArrowCallout",$.leftBrace="leftBrace",$.leftBracket="leftBracket",$.leftCircularArrow="leftCircularArrow",$.leftRightArrow="leftRightArrow",$.leftRightArrowCallout="leftRightArrowCallout",$.leftRightCircularArrow="leftRightCircularArrow",$.leftRightRibbon="leftRightRibbon",$.leftRightUpArrow="leftRightUpArrow",$.leftUpArrow="leftUpArrow",$.lightningBolt="lightningBolt",$.line="line",$.lineInv="lineInv",$.mathDivide="mathDivide",$.mathEqual="mathEqual",$.mathMinus="mathMinus",$.mathMultiply="mathMultiply",$.mathNotEqual="mathNotEqual",$.mathPlus="mathPlus",$.moon="moon",$.noSmoking="noSmoking",$.nonIsoscelesTrapezoid="nonIsoscelesTrapezoid",$.notchedRightArrow="notchedRightArrow",$.octagon="octagon",$.parallelogram="parallelogram",$.pentagon="pentagon",$.pie="pie",$.pieWedge="pieWedge",$.plaque="plaque",$.plaqueTabs="plaqueTabs",$.plus="plus",$.quadArrow="quadArrow",$.quadArrowCallout="quadArrowCallout",$.rect="rect",$.ribbon="ribbon",$.ribbon2="ribbon2",$.rightArrow="rightArrow",$.rightArrowCallout="rightArrowCallout",$.rightBrace="rightBrace",$.rightBracket="rightBracket",$.round1Rect="round1Rect",$.round2DiagRect="round2DiagRect",$.round2SameRect="round2SameRect",$.roundRect="roundRect",$.rtTriangle="rtTriangle",$.smileyFace="smileyFace",$.snip1Rect="snip1Rect",$.snip2DiagRect="snip2DiagRect",$.snip2SameRect="snip2SameRect",$.snipRoundRect="snipRoundRect",$.squareTabs="squareTabs",$.star10="star10",$.star12="star12",$.star16="star16",$.star24="star24",$.star32="star32",$.star4="star4",$.star5="star5",$.star6="star6",$.star7="star7",$.star8="star8",$.stripedRightArrow="stripedRightArrow",$.sun="sun",$.swooshArrow="swooshArrow",$.teardrop="teardrop",$.trapezoid="trapezoid",$.triangle="triangle",$.upArrow="upArrow",$.upArrowCallout="upArrowCallout",$.upDownArrow="upDownArrow",$.upDownArrowCallout="upDownArrowCallout",$.uturnArrow="uturnArrow",$.verticalScroll="verticalScroll",$.wave="wave",$.wedgeEllipseCallout="wedgeEllipseCallout",$.wedgeRectCallout="wedgeRectCallout",$.wedgeRoundRectCallout="wedgeRoundRectCallout"})(u7||(u7={}));var G2;(function($){$.text1="tx1",$.text2="tx2",$.background1="bg1",$.background2="bg2",$.accent1="accent1",$.accent2="accent2",$.accent3="accent3",$.accent4="accent4",$.accent5="accent5",$.accent6="accent6"})(G2||(G2={}));var S7;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(S7||(S7={}));var E7;(function($){$.top="top",$.middle="middle",$.bottom="bottom"})(E7||(E7={}));var B1;(function($){$.ACTION_BUTTON_BACK_OR_PREVIOUS="actionButtonBackPrevious",$.ACTION_BUTTON_BEGINNING="actionButtonBeginning",$.ACTION_BUTTON_CUSTOM="actionButtonBlank",$.ACTION_BUTTON_DOCUMENT="actionButtonDocument",$.ACTION_BUTTON_END="actionButtonEnd",$.ACTION_BUTTON_FORWARD_OR_NEXT="actionButtonForwardNext",$.ACTION_BUTTON_HELP="actionButtonHelp",$.ACTION_BUTTON_HOME="actionButtonHome",$.ACTION_BUTTON_INFORMATION="actionButtonInformation",$.ACTION_BUTTON_MOVIE="actionButtonMovie",$.ACTION_BUTTON_RETURN="actionButtonReturn",$.ACTION_BUTTON_SOUND="actionButtonSound",$.ARC="arc",$.BALLOON="wedgeRoundRectCallout",$.BENT_ARROW="bentArrow",$.BENT_UP_ARROW="bentUpArrow",$.BEVEL="bevel",$.BLOCK_ARC="blockArc",$.CAN="can",$.CHART_PLUS="chartPlus",$.CHART_STAR="chartStar",$.CHART_X="chartX",$.CHEVRON="chevron",$.CHORD="chord",$.CIRCULAR_ARROW="circularArrow",$.CLOUD="cloud",$.CLOUD_CALLOUT="cloudCallout",$.CORNER="corner",$.CORNER_TABS="cornerTabs",$.CROSS="plus",$.CUBE="cube",$.CURVED_DOWN_ARROW="curvedDownArrow",$.CURVED_DOWN_RIBBON="ellipseRibbon",$.CURVED_LEFT_ARROW="curvedLeftArrow",$.CURVED_RIGHT_ARROW="curvedRightArrow",$.CURVED_UP_ARROW="curvedUpArrow",$.CURVED_UP_RIBBON="ellipseRibbon2",$.CUSTOM_GEOMETRY="custGeom",$.DECAGON="decagon",$.DIAGONAL_STRIPE="diagStripe",$.DIAMOND="diamond",$.DODECAGON="dodecagon",$.DONUT="donut",$.DOUBLE_BRACE="bracePair",$.DOUBLE_BRACKET="bracketPair",$.DOUBLE_WAVE="doubleWave",$.DOWN_ARROW="downArrow",$.DOWN_ARROW_CALLOUT="downArrowCallout",$.DOWN_RIBBON="ribbon",$.EXPLOSION1="irregularSeal1",$.EXPLOSION2="irregularSeal2",$.FLOWCHART_ALTERNATE_PROCESS="flowChartAlternateProcess",$.FLOWCHART_CARD="flowChartPunchedCard",$.FLOWCHART_COLLATE="flowChartCollate",$.FLOWCHART_CONNECTOR="flowChartConnector",$.FLOWCHART_DATA="flowChartInputOutput",$.FLOWCHART_DECISION="flowChartDecision",$.FLOWCHART_DELAY="flowChartDelay",$.FLOWCHART_DIRECT_ACCESS_STORAGE="flowChartMagneticDrum",$.FLOWCHART_DISPLAY="flowChartDisplay",$.FLOWCHART_DOCUMENT="flowChartDocument",$.FLOWCHART_EXTRACT="flowChartExtract",$.FLOWCHART_INTERNAL_STORAGE="flowChartInternalStorage",$.FLOWCHART_MAGNETIC_DISK="flowChartMagneticDisk",$.FLOWCHART_MANUAL_INPUT="flowChartManualInput",$.FLOWCHART_MANUAL_OPERATION="flowChartManualOperation",$.FLOWCHART_MERGE="flowChartMerge",$.FLOWCHART_MULTIDOCUMENT="flowChartMultidocument",$.FLOWCHART_OFFLINE_STORAGE="flowChartOfflineStorage",$.FLOWCHART_OFFPAGE_CONNECTOR="flowChartOffpageConnector",$.FLOWCHART_OR="flowChartOr",$.FLOWCHART_PREDEFINED_PROCESS="flowChartPredefinedProcess",$.FLOWCHART_PREPARATION="flowChartPreparation",$.FLOWCHART_PROCESS="flowChartProcess",$.FLOWCHART_PUNCHED_TAPE="flowChartPunchedTape",$.FLOWCHART_SEQUENTIAL_ACCESS_STORAGE="flowChartMagneticTape",$.FLOWCHART_SORT="flowChartSort",$.FLOWCHART_STORED_DATA="flowChartOnlineStorage",$.FLOWCHART_SUMMING_JUNCTION="flowChartSummingJunction",$.FLOWCHART_TERMINATOR="flowChartTerminator",$.FOLDED_CORNER="folderCorner",$.FRAME="frame",$.FUNNEL="funnel",$.GEAR_6="gear6",$.GEAR_9="gear9",$.HALF_FRAME="halfFrame",$.HEART="heart",$.HEPTAGON="heptagon",$.HEXAGON="hexagon",$.HORIZONTAL_SCROLL="horizontalScroll",$.ISOSCELES_TRIANGLE="triangle",$.LEFT_ARROW="leftArrow",$.LEFT_ARROW_CALLOUT="leftArrowCallout",$.LEFT_BRACE="leftBrace",$.LEFT_BRACKET="leftBracket",$.LEFT_CIRCULAR_ARROW="leftCircularArrow",$.LEFT_RIGHT_ARROW="leftRightArrow",$.LEFT_RIGHT_ARROW_CALLOUT="leftRightArrowCallout",$.LEFT_RIGHT_CIRCULAR_ARROW="leftRightCircularArrow",$.LEFT_RIGHT_RIBBON="leftRightRibbon",$.LEFT_RIGHT_UP_ARROW="leftRightUpArrow",$.LEFT_UP_ARROW="leftUpArrow",$.LIGHTNING_BOLT="lightningBolt",$.LINE_CALLOUT_1="borderCallout1",$.LINE_CALLOUT_1_ACCENT_BAR="accentCallout1",$.LINE_CALLOUT_1_BORDER_AND_ACCENT_BAR="accentBorderCallout1",$.LINE_CALLOUT_1_NO_BORDER="callout1",$.LINE_CALLOUT_2="borderCallout2",$.LINE_CALLOUT_2_ACCENT_BAR="accentCallout2",$.LINE_CALLOUT_2_BORDER_AND_ACCENT_BAR="accentBorderCallout2",$.LINE_CALLOUT_2_NO_BORDER="callout2",$.LINE_CALLOUT_3="borderCallout3",$.LINE_CALLOUT_3_ACCENT_BAR="accentCallout3",$.LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR="accentBorderCallout3",$.LINE_CALLOUT_3_NO_BORDER="callout3",$.LINE_CALLOUT_4="borderCallout4",$.LINE_CALLOUT_4_ACCENT_BAR="accentCallout3=4",$.LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR="accentBorderCallout4",$.LINE_CALLOUT_4_NO_BORDER="callout4",$.LINE="line",$.LINE_INVERSE="lineInv",$.MATH_DIVIDE="mathDivide",$.MATH_EQUAL="mathEqual",$.MATH_MINUS="mathMinus",$.MATH_MULTIPLY="mathMultiply",$.MATH_NOT_EQUAL="mathNotEqual",$.MATH_PLUS="mathPlus",$.MOON="moon",$.NON_ISOSCELES_TRAPEZOID="nonIsoscelesTrapezoid",$.NOTCHED_RIGHT_ARROW="notchedRightArrow",$.NO_SYMBOL="noSmoking",$.OCTAGON="octagon",$.OVAL="ellipse",$.OVAL_CALLOUT="wedgeEllipseCallout",$.PARALLELOGRAM="parallelogram",$.PENTAGON="homePlate",$.PIE="pie",$.PIE_WEDGE="pieWedge",$.PLAQUE="plaque",$.PLAQUE_TABS="plaqueTabs",$.QUAD_ARROW="quadArrow",$.QUAD_ARROW_CALLOUT="quadArrowCallout",$.RECTANGLE="rect",$.RECTANGULAR_CALLOUT="wedgeRectCallout",$.REGULAR_PENTAGON="pentagon",$.RIGHT_ARROW="rightArrow",$.RIGHT_ARROW_CALLOUT="rightArrowCallout",$.RIGHT_BRACE="rightBrace",$.RIGHT_BRACKET="rightBracket",$.RIGHT_TRIANGLE="rtTriangle",$.ROUNDED_RECTANGLE="roundRect",$.ROUNDED_RECTANGULAR_CALLOUT="wedgeRoundRectCallout",$.ROUND_1_RECTANGLE="round1Rect",$.ROUND_2_DIAG_RECTANGLE="round2DiagRect",$.ROUND_2_SAME_RECTANGLE="round2SameRect",$.SMILEY_FACE="smileyFace",$.SNIP_1_RECTANGLE="snip1Rect",$.SNIP_2_DIAG_RECTANGLE="snip2DiagRect",$.SNIP_2_SAME_RECTANGLE="snip2SameRect",$.SNIP_ROUND_RECTANGLE="snipRoundRect",$.SQUARE_TABS="squareTabs",$.STAR_10_POINT="star10",$.STAR_12_POINT="star12",$.STAR_16_POINT="star16",$.STAR_24_POINT="star24",$.STAR_32_POINT="star32",$.STAR_4_POINT="star4",$.STAR_5_POINT="star5",$.STAR_6_POINT="star6",$.STAR_7_POINT="star7",$.STAR_8_POINT="star8",$.STRIPED_RIGHT_ARROW="stripedRightArrow",$.SUN="sun",$.SWOOSH_ARROW="swooshArrow",$.TEAR="teardrop",$.TRAPEZOID="trapezoid",$.UP_ARROW="upArrow",$.UP_ARROW_CALLOUT="upArrowCallout",$.UP_DOWN_ARROW="upDownArrow",$.UP_DOWN_ARROW_CALLOUT="upDownArrowCallout",$.UP_RIBBON="ribbon2",$.U_TURN_ARROW="uturnArrow",$.VERTICAL_SCROLL="verticalScroll",$.WAVE="wave"})(B1||(B1={}));var q0;(function($){$.AREA="area",$.BAR="bar",$.BAR3D="bar3D",$.BUBBLE="bubble",$.BUBBLE3D="bubble3D",$.DOUGHNUT="doughnut",$.LINE="line",$.PIE="pie",$.RADAR="radar",$.SCATTER="scatter"})(q0||(q0={}));var L5;(function($){$.TEXT1="tx1",$.TEXT2="tx2",$.BACKGROUND1="bg1",$.BACKGROUND2="bg2",$.ACCENT1="accent1",$.ACCENT2="accent2",$.ACCENT3="accent3",$.ACCENT4="accent4",$.ACCENT5="accent5",$.ACCENT6="accent6"})(L5||(L5={}));var W1;(function($){$.chart="chart",$.image="image",$.line="line",$.rect="rect",$.text="text",$.placeholder="placeholder"})(W1||(W1={}));var D0;(function($){$.chart="chart",$.hyperlink="hyperlink",$.image="image",$.media="media",$.online="online",$.placeholder="placeholder",$.table="table",$.tablecell="tablecell",$.text="text",$.notes="notes"})(D0||(D0={}));var F8;(function($){$.title="title",$.body="body",$.image="pic",$.chart="chart",$.table="tbl",$.media="media"})(F8||(F8={}));var C6;(function($){$.DEFAULT="•",$.CHECK="✓",$.STAR="★",$.TRIANGLE="▶"})(C6||(C6={}));var j6="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOVhAAAGAUlEQVR4Xu2dT0xcRRzHf7tAYSsc0EBSIq2xEg8mtTGebVzEqOVIolz0siRE4gGTStqKwdpWsXoyGhMuyAVJOHBgqyvLNgonDkabeCBYW/8kTUr0wsJC+Wfm0bfuvn37Znbem9mR9303mJnf/Pb7ed95M7PDI5JIJPYJV5EC7e3t1N/fT62trdqViQCIu+bVgpIHEo/Hqbe3V/sdYVKHyWSSZmZm8ilVA0oeyNjYmEnaVC2Xvr6+qg5fAOJAz4DU1dURGzFSqZRVqtMpAFIGyMjICC0vL9PExIRWKADiAYTNshYWFrRCARAOEFZcCKWtrY0GBgaUTYkBRACIE4rKZwqACALR5RQAqQCIDqcASIVAVDsFQCSAqHQKgEgCUeUUAPEBRIVTAMQnEBvK5OQkbW9vk991CoAEAMQJxc86BUACAhKUUwAkQCBBOAVAAgbi1ykAogCIH6cAiCIgsk4BEIVAZJwCIIqBVLqiBxANQFgXS0tLND4+zl08AogmIG5OSSQS1gGKwgtANAIRcQqAaAbCe6YASBWA2E6xDyeyDUl7+AKQMkDYYevm5mZHabA/Li4uUiaTsYLau8QA4gLE/hU7wajyYtv1hReDAiAOxQcHBymbzark4BkbQKom/X8dp9Npmpqasn4BIAYAYSnYp+4BBEAMUcCwNOCQsAKZnp62NtQOw8WmwT09PUo+ijaHsOMx7GppaaH6+nolH0Z10K2tLVpdXbW6UfV3mNqBdHd3U1NTk2rtlMRfW1uj2dlZAFGirkRQAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAGHqrm8caPzQ0WC1logbeiC7X3xJm0PvUmRzh45cuki1588FAmVn9BO6P3yF9utrqGH0MtW82S8UN9RA9v/4k7InjhcJFTs/TLVXLwmJV67S7vD7tHF5pKi46fYdosdOcOOGG8j1OcqefbFEJD9Q3GCwDhqT31HklS4A8VRgfYM2Op6k3bt/BQJl58J7lPvwg5JYNccepaMry0LPqFA7hCm39+NNyp2J0172b19QysGINj5CsRtpij57musOViH0QPJQXn6J9u7dlYJSFkbrMYolrwvDAJAC+WWdEpQz7FTgECeUCpzi6YxvvqXoM6eEhqnCSgDikEzUKUE7Aw7xuHctKB5OYU3dZlNR9syQdAaAcAYTC0pXF+39c09o2Ik+3EqxVKqiB7hbYAxZkk4pbBaEM+AQofv+wTrFwylBOQNABIGwavdfe4O2pg5elO+86l99nY58/VUF0byrYsjiSFluNlXYrOHcBar7+EogUADEQ0YRGHbzoKAASBkg2+9cpM1rV0tK2QOcXW7bLEFAARAXIF4w2DrDWoeUWaf4hQIgDiA8GPZ2iNfi0Q8UACkAIgrDbrJ385eDxaPLLrEsFAB5oG6lMPJQPLZZZKAACBGVhcG2Q+bmuLu2nk55e4jqPv1IeEoceiBeX7s2zCa5MAqdstl91vfXwaEGsv/rb5TtOFk6tWXOuJGh6KmnhO9sayrMninPx103JBtXblHkice58cINZP4Hyr5wpkgkdiChEmc4FWazLzenNKa/p0jncwDiqcD6BuWePk07t1asatZGoYQzSqA4nFJ7soNiP/+EUyfc25GI2GG53dHPrKo1g/1Cw4pIXLrzO+1c+/wg7tBbFDle/EbQcjFCPWQJCau5EoBoFpzXHYDwFNJcDiCaBed1ByA8hTSXA4hmwXndAQhPIc3lAKJZcF53AMJTSHM5gGgWnNcdgPAU0lwOIJoF53UHIDyFNJcfSiCdnZ0Ui8U0SxlMd7lcjubn561gh+Y1scFIU/0o/3sgeLO12E2k7UXKYumgFoAYdg8ACIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6ZQ4JB6PKzviYthnNy4d9h+1M5mMlVckkUjsG5dhiBMCEMPg/wuOfrZZ/RSywQAAAABJRU5ErkJggg==",gB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB4AAAAVnCAYAAACzfHDVAAAAYHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjaVcjJDYAwDEXBu6ughBfH+YnLQSwSHVA+Yrkwx7HtPHabHuEWrQ+lBBAZ6TMweBWoCwUH8quZH6VWFXVT696zxp12ARkVFEqn8wB8AAAACXBIWXMAAC4jAAAuIwF4pT92AADZLklEQVR42uzdd5hV9Z0/8M+dmcsUZmDovYOhKCiKYhR7JJuoSTCWGFI0WUxijBoTTXazVlyza4maYm9rTRSJigVsqCDNQhHBAogKCEgRMjMMU+7vj93sL8kqClLmnPt6PY+PeXZM9vP9vO8jZ+Y955xMfJLjorBrRMuSgmiViyjN1Ee2oSCyucbIBAAAAAAAAADbXaYgcoWNUZcrirpMbdRsysa69wbF+rggGrf439vSF7seF12aFUTnxvoosGIAAAAAAACAXacgoqEgF++/VRgr4r5o+Kh/pvD//F8uiII+LaPrum/EXzqui2b1ddHGKgEAAAAAAAB2rVxEQWMmWrQtjHZlA6N2w2tR84//zP8pgHu3ib6NBdG+zdqorK6KVUXZaB85j3sGAAAAAAAAaAoaG6OwIBdtyneP2PBabPzbr/1dAdx3VHRtyESHiIhcYzQrLo7WmVzkcjmPgAYAAAAAAABoSgpy0eIfS+D/LYD7fy3abC6Inn/7X2hsjELlLwAAAAAAAEDT9D8lcM1fHwddFBFxyAVR9M686PVp/gfqayKiJiLqLBMAAAAAAABgh8hGRGlEUekn/6PFEb3ikNgQk6O+KCJi6dzoksv83/cB/1X9xoiaJdmoWxlRV1dk2QAAAAAAAAA7QTZbH9muERX96v7n9t7/q6Exinq3i86LI94pjOOisHUu+uYykfmof7h+Y8Sa6aVRt74gGhs9DRoAAAAAAABgZ2lsLIi69QWxeUUmSjs0/vedwR8hk4uydSfE+wVd6qOyMfMx7/mtj9jwUtbjngEAAAAAAAB2obrqolg7IxtR/9Ffb4wo7P5GtCwobRaVH/c/UvNmNuqqPfIZAAAAAAAAYFerqy6KmjezH/v1ktpoVZBr/PgCeMN7yl8AAAAAAACApmJLHW5jUVQWNDSP+Q3ZeLco4i9/+8X6teHRzwAAAAAAAABNSd3/dLn/oLAoqqIuVhXFxhhSGB/xqGjlLwAAAAAAAECTU1eTjaK/KXSLIv7SWB+bc5ko9YxnAAAAAAAAgATJFv393bz1EeV//c8F1gMAAAAAAACQDgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKREkRUAAACwrUpLSwuGDRvWfMCAAS26du3avKysrLiioqKkZcuWzZs1a1bcvHnz0tLS0rJsNtusuLi4ebNmzUoLCgo+8/eijY2N9Zs3b66pra2tqqur21xTU1NdVVVVs2nTptqNGzdWbdiwoeYvf/nL5hUrVlQtWLBgw6xZs6pqamoaJQYAAEDaKYABAACIiIghQ4aUHnTQQW379u3bql27dq3at2/fpkWLFq2bN29eWVpa2qpZs2bNCwsLm2ez2fLCwsLyoqKi8sLCwtKknK+hoaG6vr6+qqGh4S91dXV/aWhoqNq8eXNVTU3NuqqqqvUbNmxYu2rVqjWrV69e99Zbb6177rnnPpgzZ06NTwYAAABJogAGAADIA8OGDWt+xBFHdBwwYECnLl26dGjdunXHFi1adCgtLe1YUlLSvlmzZq0KCgqK07yDwsLCssLCwrKIaPdp/zuNjY21mzdvXrdp06ZVNTU172/YsGHl2rVr31+2bNnKBQsWrHjyySffnzVrVpVPGAAAAE1Fpuexsd9HfaF+ZcSal0ptCAAAIAE6deqUPf744zvtueeeXbp3796lbdu2XSorKzuXlpZ2KS0t7VBYWFhhSztGQ0PDxpqampU1NTXL169fv+yDDz5Y9s477yybPXv2sj/96U8rVqxYUWdLAAAAbE9t9q6Jog4f/TUFMAAAQEJks9nMt7/97Y4jRozo1bdv397t2rXrXl5e3rWsrKxzcXFx+4gosKUmp7G2tnZVTU3Nso0bNy5btWrV0tdff/2tJ598cvG999672noAAADYFgpgAACAhPne977X6a9Fb/v27Xu1bNmyV1lZWa8kvXOXLauvr9/wl7/8ZdG6desWL1u2bNHChQsX/fGPf1w8derUjbYDAADAliiAAQAAmqhsNps59dRTuxx66KH9+/Tp87n27dv3Ly8v719UVOSRzXlq06ZNKzZu3Pj6+++//8abb775xqOPPvrG3XffvcpmAAAA+CsFMAAAQBNx6qmndvniF784qHfv3v3btWv3uYqKis8VFhaW2wxbUl9fv37Dhg1vfPDBB68vXrz4jccee2z+jTfeuNxmAAAA8pMCGAAAYBc45phjWn/rW9/aq3///kPatGnTv6Kiop9HOLO9NDQ0VG/cuPGtNWvWLFy4cOGcO+6445WHHnporc0AAACknwIYAABgJzjjjDO6f+lLX9qrV69eg1u3bj2orKysR0RkbIadJFddXb103bp18xcvXjz30UcffeXqq69+x1oAAADSRwEMAACwnZWWlhb86le/2u3QQw8d1r17931btmw5qLCwsMxmaEoaGhqqP/zww/nvvPPOzGeeeWbW2LFj36ipqWm0GQAAgGRTAAMAAGwHP/7xj7t+9atf3bdXr15D27Ztu1c2m21jKyRJXV3dmg8++OCVRYsWvfznP/95xh/+8IdltgIAAJA8CmAAAIBtcOKJJ7Y75ZRTDujXr9+w1q1bD81ms61shTSpq6tbt3bt2pfffPPNWbfccsvUe++9d7WtAAAANH0KYAAAgE+hoqKi4IILLhg0YsSI/bp27bpfy5YtB2YymUKbIR/kcrmGDz/8cP6777474/nnn59x4YUXvrZx40aPiwYAAGiCFMAAAAAf4/jjj2/7/e9//8D+/fsf2Lp1630KCgpKbAUiGhsbN61fv37eW2+9NeWGG2545u67715lKwAAAE2DAhgAAOB/ZLPZzAUXXPC5I4888sDu3bsfWFFRsVtEFNgMbFl1dfWSd999d8qsWbNmnnvuuS+vW7euwVYAAAB2DQUwAACQ10pLSwsuvfTSQYcccsjBXbt2HVFWVtbDVmDb1dbWrnr//fdfmDp16uRf/vKXL65evbreVgAAAHYeBTAAAJB3Bg0aVHrBBRd8fs899zywQ4cOBxQVFbWwFdj+Ghsba9euXTtrzpw5T59//vmTX3755WpbAQAA2LEUwAAAQF4YNmxY8/POO+/gIUOGHOZ9vrDz/W0ZfNFFFz07a9asKlsBAADY/hTAAABAarVq1arwyiuv3HfEiBEjO3TocFBhYWGZrcCu19DQUP3+++8/O2XKlIk/+clPZm7cuLHRVgAAALYPBTAAAJAqrVq1Kvztb3+7/3777Xd4x44dRxQWFpbbCjRdDQ0NG99///0pM2bMeOqHP/zhC8pgAACAz0YBDAAApMJZZ53V45vf/OaRvXr1GllaWtrVRiB5ampq3l28ePHEO++8c9LVV1/9jo0AAABsPQUwAACQWMOHDy+/6KKLvjB48OCjW7RoMdBGID0+/PDDV+fNmzfhvPPOe3L69Ol/sREAAIBPRwEMAAAkSqtWrQpvuOGGQ/bbb79/atOmzX6ZTCZrK5BeuVyubs2aNTNmzJjx2JgxYyavW7euwVYAAAA+ngIYAABIhB//+Mddv/e9732lZ8+e/1RcXNzWRiD/1NbWfvD2228/dssttzz029/+9l0bAQAA+L8UwAAAQJNVUVFRcO21137+4IMPPrZ169b7ZTKZAlsBIqJxzZo1M59//vnxp5122hR3BQMAAPx/CmAAAKDJOeWUUzqefvrpx/bu3ftL2Wy2jY0AH6e+vn7j0qVLH/vd7373x+uvv36ZjQAAAPlOAQwAADQJ2Ww2c+uttx5wyCGHnNC6deu9I8LdvsDWaFy7du1L06ZN+/OPfvSjZ1evXl1vJQAAQD5SAAMAALtU//79S6655pp/2nPPPY8tLy/vayPAZ1VTU7NswYIF488999wHp06dutFGAACAfKIABgAAdomf//znPU855ZQTu3btemRhYWGZjQDbW2NjY92KFSuevOWWW+689NJLF9kIAACQDxTAAADATuMxz8Cusn79+rlPP/30f5188slT6+rqcjYCAACklQIYAADY4fr27Vv8hz/84a+Pee5nI8CuUlNT8+68efPu/8EPfvDgwoULN9kIAACQNgpgAABghxkyZEjpNddc89XBgwefWFxc3MFGgKaitrZ21dy5c+/5yU9+8uc5c+bU2AgAAJAWWyqAPYoNAADYJqNHj+4wb968n06ZMuXRYcOGnaH8BZqa4uLi9sOGDTtjypQpj86bN++nJ510UntbAQAA0s4dwAAAwFY599xze33/+9//dufOnY/IZDJZGwGSIpfL1S1fvvzJG2644fbLLrvsbRsBAACSyiOgAQCAz+y8887r+53vfOfbHTt2PDyTyRTaCJBUuVyuYcWKFU/cdNNN//XrX/96sY0AAABJowAGAAC22WWXXTboG9/4xg9at249zDaAtFm7du2su++++9pzzjnnNdsAAACSQgEMAABsNcUvkE8UwQAAQJIogAEAgE9N8Qvks7Vr18665557rvv5z38+3zYAAICmaksFcGHlwOj6UV9orIqoWZG1PQAAyBO/+MUvet9xxx3nHHrooT8pLS3tYiNAPiotLe2y7777HvP973+/X1lZ2ZIpU6assxUAAKCpKetcHwXlH/01BTAAAOS5M844o/u99957zpe//OWflZeX94qIjK0AeS5TXl7e8+CDDx71/e9/v3dEvDVjxowPrQUAAGgqFMAAAMD/ceKJJ7a77777fjJq1Kh/KS8v7xOKX4B/lCkvL+99+OGHj/rWt77VfvXq1Qvnz59fbS0AAMCutqUC2DuAAQAgzwwdOrTs+uuvP6l///4nFRYWltkI20NjY2Ns2rQpqquro6amJurr62PTpk2xefPmqK+vj+rq6qivr4/NmzfHpk2boqGhYZv/fxUWFkZJSUk0a9YsioqKoqysLIqKiqJZs2ZRUlISRUVFUVpa+r9/FRQUCIjtoqGhoeq11167a8yYMffMmTOnxkYAAIBdZUvvAFYAAwBAnujUqVP2nnvuGbXXXnudnM1mK22Ej9PQ0BAbN26MDRs2/J+/Nm7cGBs3boyamprYtGlTbNq0KWpqaqK2trbJnqe4uDhKSkqitLT0f/9eUVERFRUV0aJFi//zV0VFRRQWFvog8LHq6urWvvjii7eceOKJf169enW9jQAAADubAhgAAPLcXXfdddAXv/jF00tLS7vZRn7L5XKxYcOGWLt2baxbty7Wrl37d3+tW7cuNmzYkPd7atGiRbRu3TpatWoVrVu3jjZt2vzvf27dunW0aNHCh4morq5e+sgjj1zzne98Z6ptAAAAO5MCGAAA8tTVV189+MQTTzyzoqJioG3kj8bGxli5cmUsX748Pvjgg1i9evX//n3t2rXR2NhoSZ9RYWFhtGrVKtq1axdt27b937937tw5OnTo4LHTeWbDhg3z77333qvOPPPMebYBAADsDApgAADIM1/72tfaXHrppad27979qIjQRKVUQ0NDrFq1KlasWBHvv//+//595cqVTfqRzGlXXFwcHTp0iI4dO0bnzp2jY8eO0alTp2jXrp1HS6dYLpdrfOeddx76+c9/fv2ECRPW2QgAALAjKYABACBP9OrVq9ldd931jT322OM7hYWFZTaSHh9++GG88847sXTp0njvvfdixYoVsXr16mhoaLCchCgsLIz27dtHp06dolu3btG9e/fo3r27x0mnTENDQ9W8efNu++Y3v/nHJUuWbLYRAABgR1AAAwBAHrjrrrtG/NM//dOZJSUlXWwj2davXx9Lly6Nd955539L3w8//NBiUqqysvJ/y+C//tWqVSuLSbiamppljz322G9Gjx49xTYAAIDtTQEMAAAp9qtf/arPD3/4w5+1atVqL9tIno0bN8aSJUvirbfeikWLFsV7770XmzZtspg8V1JSEl27do0+ffpE3759o3fv3lFeXm4xCbRu3bqXr7322ivGjh27yDYAAIDtRQEMAAApNGjQoNI77rjju7vttttJBQUFWRtJhtWrV8ebb74ZixcvjiVLlsTy5cujsbHRYtiigoKC6Ny5c/Tu3Tt69+4d/fr1i7Zt21pMQjQ2Nta98cYbd33rW9+6ff78+TU2AgAAfFYKYAAASJHS0tKCBx988Jj99tvvn7PZbBsbaboaGhri7bffjrfeeisWLFgQS5YscXcv201FRUX06tUr+vbtG3379o2ePXtGYWGhxTRhdXV1a2bMmHHjV77ylYdqamr85gcAALDNFMAAAJASp59+erdf/vKX51ZWVu5jG03T6tWr47XXXouFCxfGm2++GRs3brQUdooWLVpE3759Y8CAATFw4EB3CDdh69evf/E//uM//vPqq69+xzYAAIBtoQAGAICEGzRoUOm99977w969ex+byWTc4teErF+/PubNmxcLFiyIN954Q+FLk9GiRYvo169fDBgwIPbYY4+orKy0lCYkl8s1LF68eNyJJ554rcdCAwAAW0sBDAAACXbNNdcMOemkk35RVlbWyzZ2vVwuF++++27MnTs3XnvttViyZIl3+NLkFRQURK9evWLQoEExePDg6Natm6U0EdXV1UvuvvvuX//kJz+ZYxsAAMCnpQAGAIAEOuqoo1r99re//VmHDh0Ot41da9OmTTF79uyYO3duLFy4MKqqqiyFRGvevHn0798/Bg8eHHvuuWeUlJRYyi62cuXKp04//fTLJ0yYsM42AACAT6IABgCAhBk3btwRRxxxxFnZbLaNbewaVVVVMXfu3Jg7d27Mnz8/amtrLYVUKi4ujoEDB8bgwYNj8ODBUV5ebim7SF1d3ZqnnnrqqlGjRj1hGwAAwJYogAEAICFOOeWUjhdddNEvW7duvZ9t7HwrV66MWbNmxdy5c+Odd96JXC5nKeSdzp07x9577x3Dhg2LDh06WMgusHbt2hnnnXfepbfccsv7tgEAAHwUBTAAADRxpaWlBU899dQ3Bw8e/L2CggLPYt2JVqxYES+99FK89NJLsXz5cguBv/HXMnjvvfeOTp06WchO1NjYuGnu3Lk3H3744XfV1NR40TgAAPB3FMAAANCEjR49usOll176yzZt2gy3jZ1j/fr18eKLL8bMmTNj6dKlFgKfQs+ePWPfffeNYcOGRYsWLSxkJ1mzZs0L55577q/vvvvuVbYBAAD8lQIYAACaoIqKioKJEyd+c/Dgwd8vKCgotpEda8OGDfHiiy/G9OnTlb7wGfXo0SOGDx8ew4YNi4qKCgvZwdwNDAAA/CMFMAAANDGnnHJKx7Fjx/5rZWXlMNvYcerr6+PVV1+NGTNmxLx586Kurs5SYDvKZrMxZMiQ2HfffWP33XePwsJCS9mB1q5dO+MXv/jFv995550rbQMAAPKbAhgAAJqIbDabeeKJJ47fZ599fuSu3x0jl8vFwoULY/r06TF79uzYtGmTpcBOUFpaGkOGDInhw4fHgAEDLGQHaWhoqJ42bdo1Rx555J9tAwAA8pcCGAAAmoDjjz++7ZVXXvmr1q1be9fvDrBmzZqYNm1azJw5M1audHMc7EodO3aMz3/+87H//vt7X/CO+3fetDPPPPOScePGfWAbAACQfxTAAACwi9100037HXvssf9WXFzc1ja2n1wuF6+99lo8//zzMW/evKivr7cUaEKKiopizz33jBEjRsTnPve5yGQylrId1dbWrvrjH/948Q9+8INZtgEAAPlFAQwAALvIkCFDSu+///5zunTp8k+2sf2sXbs2Jk+eHNOnT48PP/zQQiABKisrY8SIEXHIIYdEeXm5hWxHy5Yte+zrX//6f86ZM6fGNgAAID9sqQAurBwYXT/qC41VETUrsrYHAADb6IILLtjt97///VVt2rQZZhvbx+LFi2P8+PFx9913xxtvvBG1tbWWAgmxadOmeOONN+LZZ5+NtWvXRps2bTweejtp0aJFv5NOOumg0tLSuc8+++xaGwEAgPQr61wfBR/zu7XuAAYAgO0sm81mJk2a9PVhw4b9pKCgwG9VfkZ1dXUxY8aMeOaZZ+K9996zEEiRfv36xSGHHBJDhw6NgoICC/mMGhsbN8+YMeOaL37xi+Pq6upyNgIAAOnlEdAAALCTHH/88W2vuuqqCyorK/exjc9mzZo18dRTT8XUqVNj06ZNFgIpVlFREZ///OfjsMMOi8rKSgv5jNavXz/r9NNPv3DcuHEf2AYAAKSTAhgAAHaC22677fNf+9rXzstms5W2se0WLVoUjz/+eMybNy9yOTewQT4pKiqKIUOGxBFHHBG9e/e2kM+grq5u3QMPPHDRySefPM02AAAgfRTAAACwA1VUVBQ8/fTTpwwcOPCUTCbjGabbIJfLxauvvhpPPvlkLFy40EIgz2UymRgwYEAcccQRMWjQIAvZ9n+3Ns6fP/+Www8//JaNGzc22ggAAKTHlgrgwsqB0fWjvtBYFVGzwuvKAABgS0488cR2EyZMuLx79+5fzmQyGRvZOo2NjTFr1qy49dZb48knn4wPPvC0UuC/rV69OmbMmBFz5syJ0tLS6NSpU/jX7NbJZDKZ9u3bD/3+978/dPny5TNfffXValsBAIB0KOtcHwXlH/O9gDuAAQBg29x66637H3vssRcWFRW1sI2tU1NTE0899VQ8++yzsWHDBgsBPlGLFi3i4IMPjsMPPzxKS/28YmvV19d/OG7cuPNPPvnk6bYBAADJ5xHQAACwHWWz2cyzzz77rSFDhvzAI5+3zqZNm2Ly5Mnx1FNPKX6BbdKiRYs47LDD4pBDDlEEb6VcLtfwyiuvXHfooYfeWVdX5yXrAACQYApgAADYTo455pjW11133cWVlZV728ant2HDhnj88cdjypQpUVtbayHAZ1ZcXBwHHnhgfPGLX4wWLTyIYWusWbNm2re//e3zn3nmGb+JAwAACeUdwAAAsB1cfvnlu1900UW/LS8v72cbn05VVVVMmDAhbrnllnjzzTejoaHBUoDtoqGhIZYsWRLPPfdc1NTURI8ePSKb9XOMT6OsrKzb17/+9SPbtm0774knnlhtIwAAkMDreu8ABgCAz+bhhx/+8qGHHnpOQUFBsW18sk2bNsUzzzwTTzzxRFRVVVkIsMOVl5fHkUceGYccckgUF/tX9afR2Ni46emnn/71Mccc87htAABAsngENAAAbKN27doVTZ48+YxevXodZxufrK6uLp5++umYOHGi4hfYJSoqKuKLX/xiHHzwwe4I/pQWLVr0x4MOOuiadevWeUwDAAAkhEdAAwDANjj22GPbPvzww7/p2LHjobaxZXV1dfHkk0/GddddF3Pnzo26ujpLAXaJzZs3x2uvvRbPPfdcRET06NEjCgsLLWYLWrduvfv3vve9fd9+++1pCxYsqLYRAABo+rb0CGgFMAAAfITLL7989wsuuOB3zZs372UbH6+xsTGmTJkS119/fbzyyiuKX6DJ2Lx5cyxYsCCmT58excXF0a1bt8hkMhbzMUpKSjp8+ctfPrJt27ZzvBcYAACaPu8ABgCArTB+/Pgjv/CFL/xLQUFBiW18vAULFsT48eNj6dKllgE0eT169IivfOUrMWjQIMvYgsbGxpqJEydecuyxxz5pGwAA0HR5BzAAAHwK7dq1K3ruued+1qNHj6/axsdbtGhR3H///bF48WLLABKnV69ecdxxx0WfPn0sYwuWLl3654MOOujy1atX19sGAAA0Pd4BDAAAn2DYsGHNn3766V936tTpC7bx0TZs2BD33Xdf/PGPf4y1a9daCJBI69evj2nTpsW6deuiZ8+eUVLiYQ8fpbKysv+3v/3t/lOmTJmyfPlyz/cHAIAmxjuAAQBgC372s5/1uP76669t0aKF54J+hJqamhg/fnzcfPPN8fbbb0cul7MUINFyuVy888478cwzz0RVVVX07t07slk/A/lHZWVl3U488cTD6+rqZkyfPv1DGwEAgCZ0va4ABgCAj3bFFVfscdZZZ11dXFzcwTb+Xi6XixkzZsR1110XCxYsiMbGRksBUqWxsTGWLFkSM2bMiPLy8ujSpUtkMhmL+RvZbLbFQQcddHibNm1mP/HEE6ttBAAAmoYtFcDeAQwAQN6aNGnSqAMOOODsTCZTaBt/b9GiRXHPPffEu+++axlA3ujWrVucdNJJ0bt3b8v4B7lcrm7y5Mm//vKXv/yIbQAAwK63pXcAK4ABAMg7paWlBTNnzjyzT58+x9vG39uwYUOMGzcuZsyY4VHPQF7KZDKx3377xde//vWoqKiwkH+waNGiP+27775X1dTUeCwEAADsQgpgAAD4H926dctOnjz5V506dRppG/9fLpeLqVOnxp///OfYuHGjhQB5r6KiIkaNGhX777+/x0L/g+XLlz9+6KGHXvLuu+/W2QYAAOwaWyqAvQMYAIC8MXz48PInnnjiynbt2o2wjf/vnXfeiWuvvTaee+652Lx5s4UARMTmzZtjzpw58dprr0XPnj2jRYsWlvI/Kioq+n7rW98aMnXq1Ofee+89f3AAAMAusKV3ACuAAQDIC9/+9rc73n777X9o0aLFANv4b1VVVXHXXXfFvffeG+vXr7cQgI+wbt26eP7552P9+vWx2267RVFRkaVERElJSefjjjvuoA8++GDKK6+88hcbAQCAnUsBDABAXjv//PP7XXzxxX8oKSnpbBv/bfr06XHttdfGokWLLAPgU3jnnXdi2rRp0bp16+jc2R8nERHZbLbyC1/4whElJSUvTp48eY2NAADAzqMABgAgb/3ud7/b60c/+tFVRUVFrWwjYs2aNXHzzTfHpEmTora21kIAtkJtbW289NJL8c4770Tfvn2jtLQ073dSWFhYNnz48C/26dNn4UMPPbTMpwQAAHYOBTAAAHnp1ltv3f+b3/zmfxYWFjbP913kcrl4/vnn4/rrr4/ly5f7cAB8BitXroxp06ZFRUVFdOvWLTKZTF7vo6CgIDto0KBDBw0atOiBBx54xycEAAB2vC0VwJmex8Z+H/WF+pURa17ym6wAACTTww8//KXDDjvsXzKZTN6/rPGDDz6I22+/Pd544w0fDIDtbMCAAfGtb30r2rRpk/e7yOVyjVOmTPn1yJEjH/LJAACAHavN3jVR1OGjv6YABgAgdV555ZXTPve5z30r3/fQ0NAQjz32WDz++ONRV1fngwGwg2Sz2Tj66KPjC1/4QhQUFOT9Pl5//fU79tprr9/7ZAAAwI6jAAYAIC9ks9nMyy+/fFafPn2Oz/ddvPvuu3HbbbfFe++954MBsJN069YtvvOd70S3bt3yfhdLliy5f5999rmypqam0ScDAAC2PwUwAACpV1paWjBr1qyzevfufVw+7yGXy8WTTz4ZDz74oLt+AXaBbDYbxxxzTBxxxBF5fzfw0qVLHxg6dOjlSmAAANj+FMAAAKRar169mk2ePHlsu3btDsrnPaxcuTJuueWWePvtt30oAHaxnj17ximnnBIdOnTI6z2sXr16yiGHHPIvS5Ys2exTAQAA28+WCuDCyoHR9aO+0FgVUbMia3sAADRpQ4cOLXvqqacub9Omzf75uoNcLhfPPPNMXH/99bF27VofCoAmYP369TFlypQoKSmJnj17RiaTycs9NG/evPtJJ500ZPLkyc+sWLHCoykAAGA7KetcHwXlH/01BTAAAIk1ZMiQ0kceeeSKVq1a7Z2vO6iuro7bb789nnjiiWhs9IRNgKaksbEx5s+fH++//34MGDAgstn8/DlLaWlpp6997WuDn3rqqadXrlxZ75MBAACfnQIYAIDUOfTQQ1s8+OCDv2/ZsuUe+bqDOXPmxNVXX+2RzwBN3PLly+OFF16Ijh075u0joUtLSzudcMIJ+7/00ktPv/3227U+FQAA8NkogAEASJVhw4Y1v++++37TsmXLQfl4/vr6+hg/fnz88Y9/jNpaP0MHSILNmzfHiy++GJs3b47ddtstCgoK8m4HxcXFbY866qg9n3vuuaeXL1/ucdAAAPAZKIABAEiNI488snLcuHG/b9GixcB8PP97770XV111VcyZM8eHASCBFi1aFC+//HL069cvWrRokXfnLykp6XDcccftP2fOnGcWLVq0yScCAAC2jQIYAIBUOPLIIyvvvPPO35aXl++Wj+d/+umn48Ybb4wPP/zQhwEgwf7yl7/ECy+8ECUlJdGrV6+8O3+zZs3aHHXUUfspgQEAYNspgAEASLxjjz227W233faH5s2b98m3s1dVVcXNN98cTz31VDQ2NvowAKRAY2NjzJ8/P5YtWxYDBgyIZs2a5dX5mzVr1uaYY4458M0333xm4cKFNT4RAACwdRTAAAAk2qGHHtritttuuzofy9+33347rrnmmli8eLEPAkAKvf/++/HKK69Enz59orKyMq/Ons1mK4888sh9Zs6c+dTSpUs3+zQAAMCnpwAGACCxjjjiiJb33nvvteXl5f3y6dy5XC4mTZoUN998c1RVVfkgAKRYVVVVTJ06NbLZbPTp0ycymUzenL24uLjtV7/61c+/8sorTy1evLjWpwEAAD4dBTAAAIl06KGHtrj33nt/l2/lb3V1ddx0000xefLkyOVyPggAeSCXy8WCBQvi3Xffjd133z2y2fz5mUyzZs1aH3300fvNmDHjSXcCAwDAp6MABgAgcYYOHVo2fvz4qysqKgbk07mXLVsWV111lUc+A+SplStXxiuvvBKf+9znoqKiIm/O3axZszZHH3300GeeeebJFStW1PkkAADAlimAAQBIlCFDhpQ++uij17Rs2XL3fDr31KlT49prr42NGzf6EADksaqqqpg+fXq0bds2unTpkjfnLikpaT9q1KihTz755JMrV66s90kAAICPt6UCuMB6AABoSjp16pSdMGHCv1dWVu6RL2dubGyMcePGxR133BF1dW56AiCitrY2br755hg/fnw0NjbmzbkrKyv3mDBhwr9369bNXQkAALCNFMAAADQZrVq1Kpw+ffolbdq02T9fzlxdXR2/+93vYtKkSd73C8DfyeVy8fjjj8fvf//7qK6uzptzt2nTZv8pU6Zc0qpVq0KfAgAA2HoKYAAAmoSKioqC2bNnX9KuXbuD8uXMS5cujYsuuijmz5/vAwDAx3r11VfjoosuiqVLl+bNmdu1a3fQ7Nmz/72iosLPrgAAYCu5iAYAoEmYOXPmz9q1a3dIvpz35ZdfjiuuuCLWrVsnfAA+0bp16+KKK66Il19+OW/O3K5du4Nnzpz5M+kDAMDWUQADALDLvfjii2N69OgxKh/Omsvl4oEHHogbbrghamtrhQ/Ap1ZbWxs33HBDPPDAA3nz2oAePXqMevHFF8dIHwAAPj0FMAAAu9SkSZO+NnDgwFPy4ax1dXVx8803x8SJE73vF4BtksvlYuLEiXHLLbdEXV1dXpx54MCBJ0+aNOlr0gcAgE9HAQwAwC7z6KOPHnXggQeekw9nXbduXfz617+OWbNmCR6Az2zmzJnx61//Ol9eJZA58MADz3n00UePkjwAAHyywsqB0fWjvtBYFVGzImtDAADsEDfeeOO+Rx999EWZTKYw7Wddvnx5XHXVVbFy5UrBA7DdbNiwIWbPnh0DBw6MioqKtB8307179/179uz56sMPP7xc+gAA5LuyzvVRUP7RX1MAAwCw011xxRV7fPe7372qoKCgWdrPOmfOnPjtb38bGzduFDwA2111dXVMmzYtOnfuHB07dkz1WTOZTOHuu+9+eJs2bV6aNGnSKukDAJDPFMAAADQZZ5xxRvef/exnvy0sLCxP+1knTJgQd999d9TX1wsegB2moaEhXnrppchms9G3b99UnzWTyRTttddeB/3lL395dubMmRukDwBAvlIAAwDQJBx00EEVf/jDH64pLi7ulOZz5nK5eOCBB+Kxxx4TOgA77c+eBQsWRF1dXfTv3z8ymUxqz1pQUFBywAEHDJs+ffqkpUuXbpY+AAD5aEsFcIH1AACwMwwaNKj0vvvuu7qsrKxXms9ZV1cX1113XUyaNEnoAOx0EydOjOuvvz7q6upSfc6ysrJef/rTn67u379/idQBAODvKYABANjhKioqCh577LGLKyoqBqb5nNXV1XHNNdfE7NmzhQ7ALvPKK6/ElVdeGVVVVak+Z4sWLQZOnDhxbEVFhZ9vAQDA33CBDADADjdz5syftW3b9sA0n3HdunVx2WWXxRtvvCFwAHa5xYsXx2WXXRZr165N9TnbtWt34MyZM38mcQAA+P8UwAAA7FBPPvnkqB49eoxK8xlXrVoVV1xxRSxfvlzgADQZK1asiCuuuCJWrlyZ6nP26NFj1KRJk0ZJHAAA/lth5cDo+lFfaKyKqFmRtSEAALbZjTfeuO+XvvSlCzOZTGp/8fDdd9+NK6+8MtatWydwAJqc6urqmDVrVvTv3z8qKytTe85u3boN79mz57yHH37Yb2MBAJAXyjrXR0H5R39NAQwAwA5x3nnn9T311FOvLigoKE7rGV977bW45pprorq6WuAANFmbN2+OGTNmRI8ePaJ9+/apPGMmkykYNGjQIYWFhVOee+45v5UFAEDqKYABANipjjrqqFb/8R//8YdmzZq1SusZX3755bj++uujrq5O4AA0eQ0NDfHSSy9Fp06dolOnTqk8Y0FBQXbYsGGfnz9//qQ33nhjk9QBAEizLRXA3gEMAMB21a1bt+wNN9zwnyUlJR3TesYpU6bEjTfeGPX19QIHIDHq6+vjxhtvjKlTp6b2jCUlJZ1uuOGG/+jWrZu7GgAAyFsKYAAAtqunn376XyorK/dI6/kmTZoUd955ZzQ2NgobgMRpbGyMO+64I5588snUnrGysnLw008//UtpAwCQrxTAAABsN88///w3unTp8k9pPd/EiRNj3LhxkcvlhA1AYuVyubj//vtTXQJ36dLlS88+++yJ0gYAIB95BzAAANvFTTfdNPzII488L5PJZNJ4vsceeyzGjx8vaABS47XXXotmzZpF3759U3m+zp0779urV695Dz/88DJpAwCQNlt6B7ACGACAz+wXv/hF7x/+8IdXFxQUNEvj+R544IF45JFHBA1A6ixYsCDq6upiwIABqTtbJpPJDBo06ODGxsbnpk6dul7aAACkiQIYAIAd5oADDqj43e9+99tmzZq1TeP5xo0bF5MmTRI0AKm1aNGi2Lx5cwwcODB1ZysoKMjut99+w5577rnH33vvvc3SBgAgLbZUAHsHMAAA2yybzWbuvPPOfyktLe2exvNNmDBB+QtAXpg0aVI89NBDqTxbaWlpj3vuuedfstlsRtIAAOQDBTAAANvs+eef/06HDh0OTePZHn744Xj44YeFDEDeeOSRR+LPf/5zKs/WoUOHw5599tlvSxkAgHygAAYAYJvcd999hw8ePPjUNJ7t/vvvjwkTJggZgLzz2GOPxX333ZfKs+25554/+NOf/nSYlAEASDvvAAYAYKudccYZ3ceMGXN5QUFBcdrONnHixHjkkUeEDEDeWrx4cWSz2ejbt2/ajpbp06fPvn/5y18mz5w5c4OkAQBIsi29A1gBDADAVhk2bFjzG2+88Q/NmjVrl7azPfroo6l99CUAbI2FCxdGUVFR9OvXL1XnKigoKD7wwAP3e/LJJx9dsWJFnaQBAEiqLRXAHgENAMBWuffee39ZWlraPW3nevzxx+PBBx8UMAD8jz//+c8xceLE1J2rtLS0x3333fdLCQMAkFYKYAAAPrVJkyaN6tSp0xEpPFeMHz9ewADwD8aPHx+TJ09O3bk6der0hUmTJn1VwgAApJFHQAMA8Kmcd955fU888cR/z2QyRWk618yZM+Puu+8WMAB8jNdeey06duwYnTt3TtW5unbtuk9BQcHzzz333DopAwCQNN4BDADAZ3LEEUe0vOKKK67NZrOVaTrXyy+/HDfffHPkcjkhA8DHyOVyMXv27OjSpUt06tQpNefKZDJF++yzz/CpU6c+9u67726WNAAASeIdwAAAbLNsNpu55ZZb/q2kpKRjms61YMGCuPnmm6OxsVHIAPAJGhsb4+abb44333wzVecqLS3tcvfdd5+fzWYzUgYAIC0UwAAAbNGkSZO+3rZt2wPTdKZly5bFDTfcEPX19QIGgE+prq4urr322li+fHmqztWuXbsDH3/88VESBgAgLTwCGgCAj3XZZZcN+upXvzo2k8mk5hcH33///bjyyiujqqpKwACwlerq6uLll1+OIUOGRHl5eWrO1aVLl31LS0unPvPMM2ukDABAEngENAAAW61///4lJ5988q8ymUxRWs60YcOG+P3vfx8bN24UMABso40bN8bvfve7VP15WlBQkP3hD394ft++fYslDABA4q9vrQAAgI/y4IMPnl1WVtYrLeeprq6O3/zmN7Fq1SrhAsBntGrVqrjyyiujuro6NWcqKyvr8/DDD58lXQAAkk4BDADA/zF+/Pgju3XrdnRazlNfX5/KdxYCwK60fPnyuO6666K+vj41Z+rRo8dXx40bd4R0AQBIMgUwAAB/53vf+16nI4444py0nCeXy8Vtt90Wb7zxhnABYDt7/fXX47bbbotcLpeaMx155JHnfvvb3+4oXQAAkkoBDADA/6qoqCi4+OKLLywsLCxPy5nGjx8fs2bNEi4A7CCzZs2Khx56KDXnKSwsrPj1r399QUVFhZ+bAQCQSC5kAQD4XxMnThxdWVk5OC3nef7552PixImCBYAd7LHHHosXXnghNeeprKzc89FHHz1RsgAAJFFh5cDo+lFfaKyKqFmRtSEAgDxxwQUX7DZq1KgLM5lMYRrO8+qrr8Ytt9ySqkdSAkBT/7O3d+/e0a5du1Scp2PHjkNzudxzU6ZMWSddAACamrLO9VHwMc/wcwcwAADRt2/f4h//+McXZzKZVPwG4HvvvRc33HBDNDY2ChcAdpKGhoa47rrrYtmyZak4T0FBQfbss88e27dv32LpAgCQqGtZKwAAYPz48T8qKyvrkYazbNiwIX7/+99HbW2tYAFgJ9u0aVP8/ve/j40bN6biPGVlZb3GjRs3RrIAACSJAhgAIM/ddNNNw/v06XN8Gs5SX18f1157baxdu1awALCLrFmzJq699tqor69PxXn69ev3jd///vdDJQsAQFIogAEA8thBBx1Uceyxx/5rRGTScJ477rgjFi9eLFgA2MUWLVoUd955Z1qOU/CNb3zj34YNG9ZcsgAAJOIC1goAAPLXzTfffFZxcXG7NJxl4sSJMX36dKECQBMxbdq0mDRpUirOUlJS0unOO+88Q6oAACSBAhgAIE/913/914FdunT5UhrO8tprr8Wf//xnoQJAEzN+/PhYsGBBKs7SrVu3o2+66abhUgUAoKlTAAMA5KEvfelLlV/5yld+lYazrFixIq6//vpobGwULAA0MY2NjXHdddfFihUr0nCczHHHHfergw46qEKyAAA0ZQpgAIA8dPXVV5+ezWYrk36OmpqauPbaa2PTpk1CBYAmatOmTXHttddGTU1N4s+SzWbb3njjjT+RKgAATZkCGAAgz9x6663Du3Tp8uWknyOXy8Utt9wSK1euFCoANHErV66MW2+9NXK5XOLP4lHQAAA0dQpgAIA8MnTo0LKvfvWrv0jDWSZMmBBz584VKgAkxJw5c+Kxxx5LxVlGjRr1i6FDh5ZJFQCApkgBDACQR+64444fFRcXd0z6OV5++eV45JFHBAoACfPQQw+l4he4SkpKOt5xxx0/lCgAAE2RAhgAIE9cfvnlu/fs2XNU0s/xwQcfxB133JGKR0gCQL7J5XJx2223xZo1axJ/lp49ex57+eWX7y5VAACaGgUwAEAe6NatW/a73/3uv2YymURf/9XX18cNN9wQ1dXVQgWAhKqqqoobb7wx6uvrE32OTCZT8N3vfvdX3bp1y0oVAICmRAEMAJAHxo8ff0pZWVmvpJ/jnnvuiaVLlwoUABJuyZIlcd999yX+HGVlZT3Hjx9/ikQBAGhKFMAAACn385//vOeAAQNGJ/0c06dPjylTpggUAFJi8uTJMWPGjMSfY8CAAaN//vOf95QoAABNhQIYACDFstls5qyzzjo3k8kk+tGEK1asiLvvvlugAJAyd911V6xYsSLRZ8hkMtmzzjrr3Gw2m5EoAABNgQIYACDFxo0b98XKysq9knyG2trauOGGG6K2tlagAJAyf/1zfvPmzYk+R2Vl5V7jxo0bKVEAAJoCBTAAQEoNHz68/OCDDz4t6ee4//77Y/ny5QIFgJRavnx5jBs3LvHnGDFixI+HDRvWXKIAAOxqCmAAgJS69dZbT8tms22TfIYZM2bEc889J0wASLnJkyfHzJkzE32G4uLitrfffvtp0gQAYFdTAAMApNBVV121R48ePb6S5DOsXLky7rrrLmECQJ64++6744MPPkj0GXr27PnVK664Yg9pAgCwKymAAQBSprS0tOAb3/jGT5N8rdfY2Bi333679/4CQB6pqamJ2267LRobG5N8jIJvfvObZ5aWlvqZGwAAu+6i1AoAANJlwoQJX6uoqBiQ5DOMHz8+Fi1aJEwAyDNvvvlmPPjgg4k+Q4sWLQY9+OCDx0gTAIBdRQEMAJAiRx55ZOWwYcN+kOQzzJ07N5544glhAkCemjhxYixYsCDRZxg+fPiPjjjiiJbSBABgV1AAAwCkyBVXXHFyUVFRRVLnr6qqijvvvDNyuZwwASBP5XK5uP3226O6ujqxZygqKmrxm9/85mRpAgCwKyiAAQBS4vzzz+/Xu3fv45J8httvvz0+/PBDYQJAnlu3bl3cfvvtiT5D7969jz///PP7SRMAgJ1NAQwAkALZbDZz6qmn/jyTyST2+m769OkxZ84cYQIAERExe/bsmDFjRmLnz2QyBaeeeurPs9lsRpoAAOxMCmAAgBT44x//eERlZeXgpM6/du3auPfeewUJAPyde+65J9atW5fY+SsrKwf/6U9/+oIkAQDYmRTAAAAJ17dv3+JDDjnkR0k+w9133x01NTXCBAD+Tk1NTdx9992JPsPBBx/8o759+xZLEwCAnUUBDACQcHfdddc3S0pKOiV1/smTJ8e8efMECQB8pLlz58azzz6b2PlLSko63nPPPd+SJAAAO4sCGAAgwb70pS9VDhw48KSkzr9mzZoYP368IAGALXrggQdizZo1iZ2/f//+Jx111FGtJAkAwM6gAAYASLArrrji1MLCwvIkzp7L5eK2226LTZs2CRIA2KJNmzbFbbfdFrlcLpHzFxYWll1++eU/kCQAADuDAhgAIKF+8Ytf9O7evftXkjr/s88+G2+88YYgAYBP5Y033ojnn38+sfN369bt6F/96ld9JAkAwI6mAAYASKgf/vCHP8pkMom8nvvggw/igQceECIAsFXGjRsX69atS+TsmUym4NRTT/2xFAEA2NEUwAAACXTdddcNa9eu3YFJnD2Xy8Udd9wRtbW1ggQAtsqmTZvizjvvTOz8bdq02f+mm27aT5IAAOxICmAAgIQpLS0t+NrXvnZ6Uud/4YUXYuHChYIEALbJq6++GjNmzEjs/Mccc8zpFRUVfiYHAMAO42ITACBhbr/99oMrKip2S+LsGzZsiHHjxgkRAPhM7r///qiqqkrk7OXl5X3/67/+6wgpAgCwoyiAAQASpKKiouCwww47Nanz33vvvYn9YS0A0HRs2LAh7r///sTOf9BBB/1zq1atCiUJAMCOoAAGAEiQ+++//+iysrKeSZx9zpw58dJLLwkRANguXnjhhViwYEEiZy8tLe32xz/+8StSBABgR1AAAwAkRN++fYv33Xfff07i7LW1tXHvvfcKEQDYru6+++6oq6tL5Oz77bffKf379y+RIgAA25sCGAAgIW6++eZRxcXFbZM4+yOPPBJr164VIgCwXa1atSoee+yxRM6ezWbb3njjjV+TIgAA25sCGAAgAYYOHVq21157fSeJs7/33nvxxBNPCBEA2CEmTpwYK1asSOTsQ4YM+c7QoUPLpAgAwPakAAYASIBrr732xKKiosqkzZ3L5eKee+6JxsZGIQIAO0R9fX3cddddkcvlEjd7UVFR5bXXXnuCFAEA2J4UwAAATdwBBxxQMWDAgG8kcfYZM2bEW2+9JUQAYId6880348UXX0zk7AMGDPjG8OHDy6UIAMD2ogAGAGjirrrqqhOKiooqkjb3pk2b4oEHHhAgALBT3H///VFbW5u4uYuKilpcffXV7gIGAGC7UQADADRhBx10UEX//v0Teffvww8/HB9++KEQAYCdYv369TFhwoREzj5w4MBvHHDAARVSBABge1AAAwA0Yf/5n/95bGFhYfOkzb1q1aqYPHmyAAGAnerpp5+O1atXJ27uwsLC8ssuu2yUBAEA2B4UwAAATdQBBxxQMWjQoNFJnP3uu++O+vp6IQIAO1V9fX3cddddiZx99913/+bQoUPLpAgAwGelAAYAaKIuv/zyYwsLC8uTNvfcuXNjwYIFAgQAdokFCxbE3LlzEzd3UVFRi9/97ndflyAAAJ+VAhgAoAkaOnRo2aBBgxL37t+6urr405/+JEAAYJf605/+FHV1dYmbe/fdd//mkCFDSiUIAMBnoQAGAGiCfvOb33ylqKioZdLmfu655xL53j0AIF1Wr14dzz33XOLmLioqann11VcfLUEAAD4LBTAAQBPTq1evZoMHD/5m0uaurq6ORx55RIAAQJPwyCOPRHV1deLmHjJkyLe6deuWlSAAANtKAQwA0MTcdNNNxxQXF7dN2twTJkyIqqoqAQIATUJVVVUifzmtuLi43a233uouYAAAtpkCGACgCWnVqlXhXnvtdVLS5l61alU8++yzAgQAmpTJkyfHqlWrEjf30KFDR7dq1apQggAAbAsFMABAE3LLLbccXlJS0jlpcz/44INRX18vQACgSamvr48HH3wwcXOXlJR0vummmw6VIAAA20IBDADQRGSz2cwBBxzw7aTNvWjRonjppZcECAA0SS+99FIsXrw4cXOPGDHiO9lsNiNBAAC2lgIYAKCJuOaaa/YuLy/vm7S5H3roocjlcgIEAJqkXC6XyLuAy8vL+1111VV7SRAAgK2lAAYAaCK+8pWvfDdpM8+bNy8WLlwoPACgSVu4cGG8+uqrrg8BAMgLCmAAgCbgsssuG1RZWblPkmbO5XIxfvx44QEAifDAAw8k7qklrVu33veSSy7pLz0AALaGAhgAoAkYNWrUCUmbefbs2bFs2TLhAQCJsGzZsnjllVcSN/cJJ5xwovQAANgaCmAAgF3sn//5nzt37NjxiCTN3NjYGA888IDwAIBEGT9+fDQ0NCRq5k6dOn1h9OjRHaQHAMCnpQAGANjFfvSjH30tk8kk6rps2rRpsWrVKuEBAImyatWqeOGFFxI1cyaTKfzpT386SnoAAHxaCmAAgF1o0KBBpX369Plqkmaur6+PCRMmCA8ASKQJEyZEXV1dombu27fvV/r27VssPQAAPg0FMADALnTZZZcdXlRUVJGkmadOnRpr164VHgCQSOvXr48pU6YkauaioqLK3/zmN0dIDwCAT0MBDACwi2Sz2cy+++57UpJmrqurc/cvAJB4jz76aOLuAt5///1PymazGekBAPBJFMAAALvI1VdfPbSsrKx3kmaeMmVKbNiwQXgAQKJt2LAhnn/++UTNXFZW1ueqq67aS3oAAHwSBTAAwC7y5S9/+bgkzVtfXx8TJ04UHACQCo8//nji7gL+0pe+dLzkAAD4JApgAIBdYPTo0R3atm07IkkzT5s2LdatWyc8ACAVPvzww5g+fXqiZm7fvv2I0aNHd5AeAABbogAGANgFfvrTn47KZDKFSZm3vr4+HnnkEcEBAKnyyCOPRH19fWLmzWQyhT/96U+/JjkAALZEAQwAsJN16tQp26dPn6OTNLO7fwGANFq3bl1MmzYtUTP36dPnmE6dOmWlBwDAx1EAAwDsZFddddUB2Wy2dVLmbWxsjEmTJgmOVOvYsWN06OCJmgD5aNKkSdHY2JiYebPZbOurrrrqAMkBAPBxFMAAADvZiBEjvp6keV988cVYtWqV4Ei1Ll26xIUXXhinnXZadO3a1UIA8siqVavipZdecj0JAEBqKIABAHaiM844o3tlZeXeSZk3l8vFxIkTBUdeyGQyMXjw4PjVr34VY8aMcUcwQB55/PHHI5fLJWbeysrKvc8444zukgMA4KMogAEAdqJTTjnlqxGRScq8CxYsiPfee09w5JVMJhN77713XHjhhTFmzJho3769pQCk3HvvvRcLFy5M1B9X/3NdCQAA/4cCGABgJ+nVq1ezXr16fTlJM3v3L/nsr0XwBRdcECeffHK0bdvWUgBSLGnXPb169fpyr169mkkOAIB/pAAGANhJrrjiioOLiopaJmXeBN4JAztEYWFhDB8+PC688MIYPXp0VFZWWgpACi1YsCCWLVuWmHmLiopaXnnllYdIDgCAf6QABgDYSYYPH/6VJM2btHfhwY5WVFQUI0aMiEsuuSRGjx4dLVu2tBSAFMnlcvH4448naub99tvvK5IDAOAfKYABAHaC0aNHd6isrByalHnXrl0bL7/8suDgI/y1CL744ovjhBNOiBYtWlgKQEq89NJLsW7dusTMW1lZudfo0aM7SA4AgL+lAAYA2AlOP/30o5J07fXMM89EQ0OD4GALiouL47DDDouxY8fGqFGjoqyszFIAEq6hoSGeeeaZJI1c8D/XmQAA8P8vEq0AAGDHymazmX79+n05KfPW1tbGlClTBAefUnFxcYwcOTIuvfTSGDVqVJSWlloKQII9//zzUVtbm5h5+/Xr9+VsNpuRHAAAf6UABgDYwX7zm9/sWVJS0jkp886YMSOqq6sFB1uppKQkRo4cGZdcckkcffTRUVJSYikACVRdXR0zZ85M0p8/na+44orBkgMA4K8UwAAAO9gXvvCFLyVl1lwuF08//bTQ4DNo3rx5HHXUUXHJJZfEyJEjI5vNWgpAwjz11FORy+USM++RRx75ZakBAPBXCmAAgB1oyJAhpZ07dz4iKfO+/vrrsWLFCsHBdlBeXh6jRo2KSy+9VBEMkDArVqyI119/PTHzdunS5fD+/ft79AQAABGhAAYA2KHGjh17aGFhYWJeCOruX9j+KioqYtSoUXHxxRfH4YcfHkVFRZYC4LpouyosLGz+H//xHwdLDQCACAUwAMAOteeeex6ZlFnXrl0b8+bNExrsIK1atYrjjz8+LrroohgxYkQUFPh2DKApmzdvXqxZsyYx8+61115HSg0AgAgFMADADnPMMce0bt269b5Jmfe5556LxsZGwcEO1qZNmxg9enRcfPHFimCAJqyxsTGee+65JP35MvyYY45pLTkAAPykAQBgBznzzDMPz2Qyibjeqq+vj6lTpwoNdqK2bdvG6NGj47zzzovhw4crggGaoBdeeCHq6+sTMWsmkyk844wzDpUaAAB+wgAAsIP079//C0mZdc6cObFhwwahwS7QqVOnOPnkk+Pf/u3fYu+9945MJmMpAE3Ehg0bYvbs2YmZd8CAAR4DDQCAAhgAYEf43ve+16mysnKPpMybpMcbQlp17tw5xowZE7/61a8UwQBNyPPPP5+YWSsrKwd/73vf6yQ1AID8pgAGANgBTj755CMiIhHtzcqVK+P1118XGjQRXbt2jTFjxsQ555wTgwcPthCAXez111+PlStXJmXczMknn3y41AAA8psCGABgB+jXr19iHv88ZcqUyOVyQoMmpnfv3nHaaafFOeecE/3797cQgF0kl8vFlClTknQd6jHQAAB5TgEMALCdnX766d0qKip2S8Ks9fX1MW3aNKFBE9anT58466yz4pxzzonddtvNQgB2gWnTpkV9fX0iZq2oqNjt9NNP7yY1AID8pQAGANjORo8efURSZp03b15s3LhRaJAAffr0ibPPPjvOPPPM6Nmzp4UA7EQbN26MefPmuR4FACARFMAAANtZr169EvPetSQ9zhD4bwMGDIhf/vKXceaZZ0b37t0tBGAnmTp1apKuRw+TGABA/lIAAwBsR2eccUb38vLyvkmYdf369fHaa68JDRJqwIAB8S//8i9x2mmnRbdunvQJsKPNnz8/Pvzww0TMWl5e3u9HP/pRF6kBAOQnBTAAwHZ03HHHHZSUWWfMmBGNjY1CgwTLZDIxePDg+Nd//dcYM2ZMdOjQwVIAdpDGxsaYMWNGYub9xje+cYjUAADykwIYAGA76tOnz8FJmDOXyyXqMYbAlmUymdh7773jwgsvjDFjxkT79u0tBWAHeOGFF5J0XXqIxAAA8pMCGABgOznppJPat2zZcvckzLpkyZJYuXKl0CBl/loEX3DBBXHyySdH27ZtLQVgO1qxYkW8/fbbiZi1srJy0PHHH+8PAgCAPKQABgDYTr773e8eGBGZJMyapMcXAluvsLAwhg8fHhdeeGGMHj06KisrLQVgO5k+fXpSRi34/ve/f6DEAADyjwIYAGA72X333Q9Nwpz19fUxc+ZMgUEeKCoqihEjRsQll1wSo0ePjpYtW1oKwGc0c+bMqK+vT8SsAwcOPFRiAAD5RwEMALAdHHTQQRUtW7bcKwmzLly4MKqrq4UGeeSvRfDFF18cJ5xwQrRo0cJSALZRVVVVvP7664mYtVWrVkOHDx9eLjUAgPyiAAYA2A7OPvvsz2cymaIkzOrxz5C/iouL47DDDouxY8fGqFGjoqyszFIAtkFSnqaSyWSy55577uclBgCQXxTAAADbwe67735AEuasra2NOXPmCAzyXHFxcYwcOTIuvfRSRTDANpg9e3bU1dUlYtY99tjjAIkBAOQXBTAAwGfUqlWrwnbt2u2fhFnnzZsXtbW1QgMiIqKkpCRGjhwZY8eOjaOPPjpKSkosBeBT2LRpU8ybNy8Rs7Zv337/iooKPwMEAMgjLv4AAD6jCy+8cPeioqKKJMz64osvCgz4P5o3bx5HHXVUXHLJJTFy5MjIZrOWAvAJZs2alYg5i4qKWlx88cWDJAYAkD8UwAAAn9GBBx6YiMfqVVdXJ+ZOFWDXKC8vj1GjRsWll16qCAb4BPPmzYuamppEzHrQQQd5DDQAQB5RAAMAfEZdu3YdnoQ5582bF/X19QIDPlFFRUWMGjUqLr744jj88MOjqKjIUgD+QV1dXbz66quJmLVLly77SwwAIH8ogAEAPoNTTjmlY3l5+W5JmPXll18WGLBVWrVqFccff3xcdNFFMWLEiCgo8C0kwN966aWXEjFnRUXFbieddFJ7iQEA5AffvQMAfAYnnnji55MwZ21tbcyfP19gwDZp06ZNjB49OsaOHasIBvgb8+fPj9ra2iSMmvnud7/7eYkBAOQH37UDAHwGn/vc5/ZLwpwLFy6Muro6gQGfyV+L4PPOOy+GDx+uCAby3ubNm2PhwoWJmLVfv37DJQYAkB98tw4AsI1atWpV2Lp1672TMKvHPwPbU6dOneLkk0+Oc889NwYNGmQhQF6bPXt2IuZs06bN3hUVFX4WCACQB1z0AQBso/PPP39gYWFheVOfs76+PubMmSMwYLvr2bNn/OQnP4nzzjsv9t5778hkMpYC5J3Zs2dHfX19k5+zqKio4vzzzx8oMQCA9FMAAwBso/3333/fJMz5+uuvR01NjcCAHaZLly4xZsyYOOecc2Lw4MEWAuSV6urqeOONNxIx64EHHriPxAAA0k8BDACwjbp27ZqIxz/PnTtXWMBO0bt37zjttNPinHPOif79+1sIkDeScr3VvXv3vaUFAJB+CmAAgG0wZMiQ0srKyj2a+py5XM7jn4Gdrk+fPnHWWWfFOeecE7vttpuFAKk3e/bsyOVyTX7Oli1b7jlo0KBSiQEApJsCGABgG5x55pl7ZjKZbFOfc9myZbFu3TqBAbtEnz594uyzz44zzzwzevbsaSFAaq1bty6WL1/e5OfMZDLZs846a4jEAADSrcgKAAC23tChQ4clYc558+YJC9jlBgwYEAMGDIgFCxbE+PHjY+nSpZYCpM68efOiS5cuTX7OffbZZ5+ImC4xAID0cgcwAMA26Nix4z5JmHP+/PnCApqMAQMGxC9/+cs47bTTolu3bhYCpEpSrrs6deq0j7QAANJNAQwAsJWOOOKIlhUVFf2a+pxVVVWxaNEigQFNSiaTicGDB8e//uu/xpgxY6JDhw6WAqTCW2+9FVVVVU1+zoqKis8deuihLSQGAJBeCmAAgK108sknD46ITFOfc/78+dHY2CgwoEnKZDKx9957x4UXXhhjxoyJ9u3bWwqQaI2NjbFgwYJE/Cv4u9/97h4SAwBILwUwAMBW2n333fdMwpze/wskwV+L4AsuuCBOPvnkaNu2raUAiZWU66/BgwfvKS0AgPQqsgIAgK3Trl27wU19xlwul5Q7UAAiIqKwsDCGDx8e++yzT0ybNi0mTJgQ69evtxggURYsWBC5XC4ymab9sJgOHToMlhYAQHq5AxgAYCsMGjSotGXLlgOa+pzvvfdebNy4UWBA4hQVFcWIESPikksuidGjR0fLli0tBUiMDz/8MJYtW9bk52zZsuXA/v37l0gMACCdFMAAAFvhxz/+8aBMJtPkn6Li7l8g6f5aBI8dOzZOOOGEaNGihaUAibBw4cImP2Mmk8n+5Cc/GSAtAIB0UgADAGyFvffee88kzJmEHzwCfBrNmjWLww47LMaOHRujRo2KsrIySwGatKT8Il5SrmsBANh63gEMALAVunbtOqSpz1hfXx9vvvmmsIBUKS4ujpEjR8bBBx8czz77bDz++ONRXV1tMUCT8+abb0Z9fX0UFTXtH7t16dJlT2kBAKSTO4ABAD6lioqKgoqKikFNfc4lS5bE5s2bBQakUklJSYwcOTLGjh0bRx99dJSUeIUl0LTU1tbG0qVLm/ycLVu2HFRaWupngwAAKeQiDwDgUzr77LP7FhYWNvlnj7722mvCAlKvefPmcdRRR8Ull1wSI0eOjGbNmlkK4HpsKxQWFpafffbZvaQFAJA+CmAAgE9p//3375+EOV9//XVhAXmjvLw8Ro0aFf/+7/8eI0eOjGw2aymA67FP6fOf//xAaQEApI8CGADgU+rRo8fuTX3G2traePvtt4UF5J2KiooYNWpUXHzxxXH44Yc3+XdvAum2ePHiRLySo1evXoOkBQCQPgpgAIBPqXXr1k3+DoklS5ZEQ0ODsIC81apVqzj++OPj4osvjhEjRkRBgW97gZ2voaEhlixZ0uTnbNOmjQIYACCFfCcMAPApDBkypLR58+a9m/qcb775prAAIqJ169YxevToGDt2rCIYcF32MZo3b95n0KBBpdICAEgX3wEDAHwKp556av9MJtPkr53eeustYQH8jTZt2sTo0aPjvPPOi+HDhyuCAddlfyOTyRT84Ac/+Jy0AADSxXe+AACfwuDBg5v84/Hq6+tj0aJFwgL4CJ06dYqTTz45/u3f/i323nvvyGQylgLsUIsXL07Eqzn23HPPgdICAEgXBTAAwKfQpUuXAU19xnfeeSfq6uqEBbAFnTt3jjFjxiiCgR2utrY23n333SRc53oPMABAyiiAAQA+hZYtW/Zv6jN6/DPAp9elS5cYM2ZMnHvuuTF48GALAfL2+iwJ17kAAGwdBTAAwCcYPnx4eUlJSeemPqfHPwNsvV69esVpp50W55xzTvTvrwMB8u/6rLS0tPPw4cPLpQUAkB4KYACAT/Ctb31rt4ho8s8IXbx4sbAAtlGfPn3irLPOinPOOSd22203CwG2i4T8gl7m29/+dj9pAQCkhwIYAOAT7L777k2+CVi7dm1s2LBBWACfUZ8+feLss8+OM888M3r27GkhwGfy4Ycfxrp165r8nAMHDlQAAwCkSJEVAABsWadOnZr8D8TefvttQQFsRwMGDIgBAwbEggULYvz48bF06VJLAbb5Oq1Vq1audwEA2GkUwAAAn6CyslIBDJCnBgwYEP3794958+bFQw89FO+++66lAFtlyZIlsddeezX1613PvgcASBEFMADAFnTq1CnbvHnzXk19ziVLlggLYAfJZDIxePDg2GOPPeLll1+OBx98MFauXGkxQGqu05o3b967Xbt2RatXr66XGABA8nkHMADAFowZM6ZnJpPJNuUZGxsbPZoUYCfIZDKx9957x4UXXhhjxoyJ9u3bWwrwiZYuXRqNjY1NesaCgoLsqaee2kNaAADp4A5gAIAt2Hvvvfs29RlXrlwZtbW1wgLYSf5aBO+5554xa9asmDBhQqxevdpigI9UW1sb77//fnTu3LlJzzls2LC+EbFIYgAAyecOYACALejRo0eTL4DfeecdQQHsAoWFhTF8+PC48MILY/To0VFZWWkpQGKv15Jw3QsAwKejAAYA2ILWrVs3+ff/vvvuu4IC2IUKCwtjxIgRcckll8To0aOjZcuWlgIk7notCde9AAB8Oh4BDQCwBc2bN+/Z1GdUAAM0kW+wi4pixIgRsd9++8WUKVPiscceiw0bNlgMEO+9914SrnsVwAAAKeEOYACAj9G/f/+SkpKSjk19TgUwQNPSrFmzOOyww2Ls2LExatSoKCsrsxTIc0m4XistLe3Ut2/fYmkBACSfAhgA4GOccMIJ3Zr69dK6deuiqqpKWABNUHFxcYwcOTJ+/etfK4Ihz1VVVcX69eub+pgF3/zmN7tLCwAg+RTAAAAfY8iQIT2b+oxJeJwgQL77axE8duzYOProo6OkpMRSIA8l4botCde/AAB8MgUwAMDH6N69e8+mPqPHPwMkR/PmzeOoo46KSy65JEaOHBnNmjWzFMgjSbhuS8L1LwAAn0wBDADwMVq1atWjqc+4bNkyQQEkTHl5eYwaNSr+/d//PUaOHBnZbNZSIA8k4botCde/AAB8MgUwAMDHqKio6NXUZ1y+fLmgAJL750yMGjUqLr744jj88MOjqKjIUiDFknDd1rJly16SAgBIPgUwAMBHyGazmbKysq5NecbGxsZYtWqVsAASrlWrVnH88cfHxRdfHCNGjIiCAt+qQxqtWrUqGhsbm/SMJSUlXbPZbEZaAADJ5rtKAICPcNxxx7UrKCgobsozrl69Ourr64UFkBKtW7eO0aNHx9ixYxXBkEJ1dXXxwQcfNOkZCwoKio877rh20gIASDbfTQIAfITPf/7zXZr6jO+//76gAFKoTZs2MXr06Dj//PNj+PDhimBIkRUrVrgOBgBgh/NdJP+PvTuPr7I888d/nSwEkhD2HUQEUVRAoIiouCtq64Jabd1arVorbqO2tlXbaavTOu38Rqffdmpbu9rWpYogsqgFRXCttAIKArJDgAAJBLKQ5JzfH8WO4+DOcp6T9/v18jWvTv657ut6hNvnk/t+AICd2G+//bL+xVcSXiAC8PF17do1Lr300rj99ttj2LBhkUq5lRWSLgn7tyTsgwEAeH8FWgAA8H917txZAAxAVujevXtceeWVsXr16njiiSdi9uzZkclkNAYSKAn7tyTsgwEAeH8CYACAnWjXrp0roAHIKj169Igrr7wyli5dGpMmTYo5c+ZoCiRMEvZvSdgHAwDw/gTAAAA7UVxc3D3baxQAAzRPffr0ibFjx8aSJUti/PjxsWDBAk2BhEjC/i0J+2AAAN6fbwADAOxESUlJz2yur7q6Ourq6gwKoBnbb7/94l/+5V/ia1/7WhxwwAEaAglQV1cX1dXV9sEAAOxWAmAAgHc5/PDDSwsKCtpmc40VFRUGBUBERPTt2zduvPHGuOGGG2LffffVEMhy2b6PKygoaDt8+PASkwIASC4BMADAu5x44oldsr3GDRs2GBQA/8uAAQPiG9/4Rtxwww3Ru3dvDQH7uE+yH+5qUgAAyeUbwAAA79KvX7+sD4DXr19vUADs1IABA+LAAw+MuXPnxoQJE2LlypWaAlkkCTe5HHDAAV0i4i3TAgBIJgEwAMC7dO/evXO21+gEMADvJ5VKxaBBg2LgwIExe/bsGD9+fKxbt05jwD4uZ/bDAAC8NwEwAMC7tG/fvlO21ygABuDDSKVSMWzYsBg6dGjMnj07HnvsMbdIwF6WhBPASdgPAwDw3gTAAADv0rp166w/8ZCEF4cAZI+3g+BDDz00XnnllZg4caK/S8A+LtH7YQAA3psAGADgXUpKSrL6xENjY2Ns3rzZoAD4yPLz8+Pwww+P4cOHx/PPPx8TJ06MqqoqjYE9aPPmzdHY2BgFBdn7Wi7b98MAALw/ATAAwLu0bNmySzbXV1lZGZlMxqAA+Njy8/Nj1KhRMXLkyHjhhRcEwbAHZTKZqKqqio4dO9oPAwCwWwiAAQDepaioKKuvvKusrDQkAHaJgoKCGDVqVIwYMSJmzpwZkydPji1btmgM7IH9XDYHwNm+HwYA4P3laQEAwP8YPnx4SX5+fkk21ygABmBXa9GiRRx//PFxxx13xNlnnx0lJSWaAs14P5efn18yfPhwfxAAACSUABgA4B2OOOKIDtleo+//ArC7FBUVxejRo+P73/9+nH322VFcXKwpsBsk4cr1JOyLAQDYOQEwAMA79O3bt1221+gEMAC729tB8B133BGnn356tGrVSlOgme3n9ttvv7YmBQCQTAJgAIB36NSpkwAYAHYoKSmJz3zmM3HnnXfG6NGjo0WLFpoCzWQ/l4R9MQAAOycABgB4hw4dOrTN9hqTcGUgALmlpKQkzj777PjOd74To0aNivz8fE2BHN/PJWFfDADAzgmAAQDeoaysrG221ygABmBvad++fVx00UVx5513xgknnBCFhYWaAjm6nysrK3MCGAAgoQTAAADvUFJS0j6b68tkMlFdXW1QAOxV7dq1i/POOy+++93vxqhRoyIvz+sF+CiSsJ8rLS0VAAMAJJT/QgMAeIfi4uK22VxfXV1dNDY2GhQAWeHtE8F33HGHIBg+gsbGxqirq7MvBgBgt/BfZgAA79CqVausPung9C8A2ahDhw5x0UUXxbe//e04/PDDBcGQA/u6oqIiJ4ABABLKf5EBALxDQUGBABgAPqauXbvGpZdeGt/61rdi2LBhkUqlNAUSuq9r0aJFW1MCAEimAi0AAPgfhYWFZdlc39atWw0JgKzXrVu3uPLKK2P16tXxxBNPxOzZsyOTyWgMJGhfl+37YgAA3psAGADgnZujgoLW2VyfE8AAJEmPHj3iyiuvjKVLl8akSZNizpw5mgIJ2ddl+74YAID35gpoAIAdWrdunZefn98ym2sUAAOQRH369ImxY8fGLbfcEgMGDNAQSMC+Lj8/v1WrVq28OwQASCCbOACAHQYNGlQSEVn9scJt27YZFACJtd9++8UNN9wQX/va1+KAAw7QEJq1BOzr8gYPHlxsUgAAySMABgDY4YADDijJ9hpramoMCoDE69u3b9x4441xww03xL777qshNEu1tbVZX2P//v1LTQoAIHl8AxgAYIeePXtm/QuuJLwoBIAPa8CAATFgwICYP39+jBs3LpYvX64pNBtJ2Nf16NGjxKQAAJJHAAwAsEOnTp0EwACwFwwYMCAOPPDAmDt3bkyYMCFWrlypKeS8JOzrunbtKgAGAEggATAAwA5lZWVZ/4Krrq7OoADISalUKgYNGhQDBw6M2bNnx4QJE2Lt2rUaQ85KQgDcpk0bV0ADACSQABgAYIeysjIngAFgL0ulUjFs2LAYOnRozJ49O8aPHx/r1q3TGHKOABgAgN1FAAwAsENJSUlxttfoBDAAzcXbQfCQIUPi5ZdfjokTJ0ZFRYXGkDOSEAAnYX8MAMD/JQAGANihqKioKNtrrKmpMSgAmpW8vLw4/PDDY/jw4fH888/HE088EZWVlRpD4iUhAG7RokWRSQEAJI8AGABgh8LCwhbZXF86nY7t27cbFADNUn5+fowaNSpGjhwZL7zwQkycODGqqqo0hsTavn17ZDKZSKVSWVtjixYtWpgUAEDyCIABAHbI9gC4oaHBkABo9goKCmLUqFExYsSImDlzZkyePDm2bNmiMSROJpOJhoaGyOaMtbCw0AlgAIAk/neTFgAA7NgYFRRk9QuuxsZGQwKAHVq0aBHHH398HHnkkfHMM8/E1KlTY9u2bRpDomR7AJzt+2MAAN5jH6cFAAA7NkZZ/oLL9c8A8H8VFRXF6NGj49hjj41nnnkmpkyZEjU1NRpDImT7DS8FBQWugAYASCABMADA2xujLH/B5QpoAHhvbwfBRx11VEyfPj2efvrpqK2t1RiymgAYAIDdIU8LAAD+QQAMAMlXUlISn/nMZ+LOO++M0aNHZ/X1uiAABgBgdxAAAwDskO1XQAuAAeDDKykpibPPPjv+7d/+LUaPHh2FhYWagv3dR5Sfn9/SlAAAkkcADADw9sYoL88JYADIMa1bt46zzz47vve978UJJ5wgCMb+7iPIz8/3LwwAQAIJgAEAdkilUlm9N2psbDQkAPiY2rVrF+edd15897vfjRNOOCEKCgo0Bfu7D94f55sSAEDyCIABAHbI9gA4nU4bEgB8Qu3bt/9nEDxq1KjIy/NqBPu799kfp0wJACB5/FcOAMAOXnABQPPRoUOHuOiii+J73/ueIJi9JpPJZHuJ/sUAAEggmzgAgP+R1QFwAl4QAkDidOzYMS666KL41re+FYcffnj4fTDs796xOc7yG3IAANg5mzgAgITsjQTAALD7dOvWLS699NL41re+FcOGDRMEs0dk+xXQeXl5/kUAAEigAi0AAPiHbH/BJQAGgN2ve/fuceWVV8ayZcviiSeeiDlz5mgKzXl/5/AIAEACCYABAHbIZDJOAAMAERGx7777xtixY2PJkiUxYcKEmD9/vqZgfwwAQCIIgAEA/ocr7gCA/2W//faLG264Id56660YP358vPnmm5rCLpPtV0Cn3IUOAJBIAmAAgB2y/QVXtr8gBIBc1rdv37jxxhvjrbfeinHjxsWiRYs0hU/MFdAAANjEAQDsXln9Bs4BDADY+/r27Rs333xz3HDDDdG7d28NIdf3d75BAgCQQE4AAwDskO0nMATAAJA9BgwYEAMGDIj58+fHI488EitXrtQUcnF/5woaAIAEcgIYAGCHVCqVzvL6DAkAssyAAQPi1ltvjbFjx0bPnj01hJza32UScEc1AAD/lxPAAAD/QwAMAHysv6MHDRoUBx98cDz//PMxadKk2LRpk8aQ+P1dtv+CJAAAO+cEMADADul0dr/fEgADQHarr6+PioqK2LZtm2aQE/u7dDrtBDAAQAI5AQwA8D+cAAYAPrK6urp4+umnY9q0acJfcm1/5wQwAEACCYABAP6HEw4AwIfW0NAQ06ZNiyeffDK2bt2qIXxkCfgGsAAYACCBBMAAADtkMpmsDoDz8ny9AwCywdvB71NPPRXV1dUaQs7u7wTAAADJJAAGANgh219wCYABYO9qbGyMGTNmxJNPPhmVlZUawieWn5+f9VtkUwIASB4BMADADplMpiGb6yssLDQkANgL0ul0zJo1KyZPnhwbN27UEHaZgoLsfjXX1NTUaEoAAAncZ2oBAMA/NDY2bs/m+gTAALBnpdPpePnll2Py5Mmxdu1aDWGXa9GiRbb/O1BvSgAAySMABgDYoampSQAMAEQmk4nZs2fH448/HuXl5RpCs93fNTY2CoABABJIAAwAsENDQ0NWv+ASAAPA7vV28PvEE0/E6tWrNYTdLtuvgM72G3IAAHiPfaYWAAD8gyugAaD5mjNnTkyaNCmWLl2qGewx2X4FtAAYACCZBMAAADs0NTU5AQwAzcyCBQtiwoQJ8dZbb2kG9nfv0tDQIAAGAEggATAAwA7Z/oJLAAwAu87ChQtj/PjxsXjxYs1gr8n2K6Cz/RckAQB4j32mFgAA/EO2B8AFBQWRl5cX6XTasADgY1q+fHmMGzcu5s+frxnsVXl5eVkfAG/fvt0JYACABBIAAwDs0NDQkPUnHFq1ahXbtm0zLAD4iFauXBmPPPKI4Jes2tclYH8sAAYASCABMADADrW1tXXZXqMAGAA+mnXr1sX48eNj9uzZkclkNISs2tdlu7q6ulqTAgBIHgEwAMAOW7du3ZrtNSbhRSEAZIP169fHY489JvjFvu4TqK6u3mpSAADJIwAGANihqqpKAAwACbdhw4Z4/PHH45VXXommpiYNwb7uE6isrHT1DABAAgmAAQB22LRpU9a/4GrZsqVBAcBOVFVVxcSJE+OFF16IxsZGDSHrJSEA3rRpkxPAAAAJJAAGANhh3bp1WR8AOwEMAP/bli1bYsKECYJfEicJ+7ry8nIBMABAAgmAAQB2WLZsmSugASAhqqurY/LkyTFz5syor6/XEBInCfu6pUuXCoABABJIAAwAsMP8+fOz/gRwcXGxQQHQrNXU1MSUKVPimWeeEfySaEnY173++uu+AQwAkEACYACAHRYsWFCXyWQaUqlUYbbW2Lp1a4MCoFmqq6uLp59+OqZNmxbbtsmkSL5s39el0+mGpUuXbjcpAIDkEQADALxDU1PTtoKCgrbZWp8AGIDmZvv27TF9+vR48sknY+tWt9GSO7J9X9fU1ORfOACAhBIAAwC8Q0NDw9ZsDoBLS0sNCYDm8ndyTJs2LZ566qmorq7WEHJOtu/rGhsb/YsHAJBQAmAAgHeor6+vbNWqVc9src8JYAByXWNjY8yYMSOefPLJqKys1BByVrbv6+rr66tMCQAgmQTAAADv0NDQkNVvmgXAAOSqdDods2bNismTJ8fGjRs1hJyX7fu6bN8XAwDw3gTAAADvUFdXV5XN9ZWWlkYqlYpMJmNYAOSETCYTr732Wjz++OOxatUqDaFZSKVSUVJSktU11tbWVpkUAEAyCYABAN5h27Ztm7K5vvz8/GjVqlXU1NQYFgCJlslkYvbs2fH4449HeXm5htCstGrVKvLz87O6xq1btzoBDACQUAJgAIB3qK6u3pztNZaVlQmAAUist4PfiRMnxpo1azSEZqmsrCzra9y2bVuVSQEAJJMAGADgHaqqqjZle43t2rWLtWvXGhYAiTNnzpyYNGlSLF26VDNo1tq1a5f1NW7atMkJYACALNbQWBgFjQ0REZFKRSavMJre/pkAGADgHSoqKqqyvcYkvDAEgHdasGBBTJgwId566y3NgITs5zZs2CAABgDIYoUFDf9MejMRqab0/+S+AmAAgHdYtWpV1r/oatu2rUEBkAgLFy6M8ePHx+LFizUD3iEJAfDq1aurTAoAIJkEwAAA77BgwYKsD4CdAAYg2y1fvjzGjRsX8+fP1wzYiST8Ql8S9sUAAOycABgA4B2eeOKJjZlMpimVSuVna41OAAOQrVauXBmPPPKI4Bc+QLb/Ql8mk2l64oknNpoUAEAyCYABAN6huro6vX379g1FRUVdsrVGJ4AByDZr166NCRMmxOzZsyOTyWgIJHw/t3379g3V1dVpkwIASCYBMADAu9TV1a0XAAPAB1u/fn089thjgl/Isf1cXV3delMCAEguATAAwLvU1dVVtGnTJmvrKykpiRYtWsT27dsNC4C9oqKiIiZOnBivvPJKNDU1aQh8BEVFRVFcXJz1+2GTAgBILgEwAMC7bN26dV2XLll7ADhSqVR07Ngx1qxZY1gA7FFVVVUxceLEeP755wW/8DF17NgxUqlU1u+HTQoAILkEwAAA71JVVZX1Jx46deokAAZgj9m8eXM8/vjj8cILL0RjY6OGwCfcx9kPAwCwOwmAAQDeZf369Vn/zbMkvDgEIPm2bNkSU6ZMiZkzZ0Z9fb2GwC7QsWNH+2EAAHYrATAAwLusXr066088JOHFIQDJVVNTE1OmTIlnnnlG8Au7WBJ+kW/VqlUCYACABBMAAwC8y9///ves/+aZABiA3aG2tjYmT54czz77bNTV1WkINNN93KuvvioABgBIMAEwAMC7PPzww+t//OMfN6RSqcJsrbFz584GBcAus3379pg+fXpMnTo1tm3bpiGwG2X7CeB0Ot3w8MMPC4ABABJMAAwA8C7V1dXpurq68latWu2TrTV26NAh8vLyIp1OGxgAH1tDQ0NMmzYtnnrqqaiurtYQ2M3y8vKiQ4cOWV1jfX39mtraWptMAIAEEwADAOxEbW3tmmwOgAsKCqJdu3axceNGwwLgI2tsbIwZM2bEk08+GZWVlRoCe0j79u2joCC7X8fV1NSUmxQAQLIJgAEAdmLz5s2r2rdvn9U1duvWTQAMwEeSTqdj1qxZMXnyZH+HwF7av2W7LVu2rDQpAIBkEwADAOzEpk2bVvfp0yera+zWrVvMmzfPsAD4QG8Hv1OmTIkNGzZoCOzF/Vu227BhwxqTAgBINgEwAMBOrFixYvWwYcOyusYkvEAEYO/KZDLx0ksvxZQpU6K83K2usLd17do162tctWrVKpMCAEg2ATAAwE7Mnz9/9ZgxY7K6xiS8QARg78hkMjF79uyYOHFirFnjMB9kiyT8At+8efP8oQEAkHACYACAnRg3btyab37zm5mISGVrjU4AA7Azc+bMiSeeeCKWLVumGZBlEvALfJlx48atNikAgGQTAAMA7MTrr79e29DQsKmwsLBDttZYXFwcZWVlsWXLFgMDIBYsWBDjx4+PJUuWaAZkobKysiguLs7qGhsaGjYuWLCgzrQAAJJNAAwA8B62bt26vF27dh2yucauXbsKgAGauYULF8b48eNj8eLFmgFZLAm3t2zbtm25SQEAJJ8AGADgPVRVVS1t167d0GyusWfPnrFw4ULDAmiGli1bFo899ljMnz9fMyABevbsmfU1VlZWLjUpAIDkEwADALyHdevWLevTp09W15iEF4kA7ForVqyIRx99VPALCZOEfdvatWuXmRQAQPIJgAEA3sPChQuXHX744VldY69evQwKoJlYtWpVjB8/PubOnRuZTEZDIGGSsG9buHDhMpMCAEg+ATAAwHuYNm3a0ksuuSSra+zevXvk5+dHU1OTgQHkqHXr1sX48eNj9uzZgl9IqIKCgkR8A/jpp59eZloAADmw/9QCAICde+ihhzbcd999W/Pz80uzdjNXUBBdunSJNWvWGBhAjqmoqIiJEyfGyy+/HOl0WkMgwbp27RoFBdn9Gq6xsbH6kUce2WBaAADJJwAGAHgf27ZtW15WVnZwNtfYq1cvATBADqmqqoqJEyfG888/74YHyBFJ+P7vtm3blpsUAEBuEAADALyPLVu2LMv2ALhnz57x0ksvGRZAwm3evDkef/zxeOGFF6KxsVFDIIck4fu/W7ZsWWpSAAC5QQAMAPA+1q9fvyzbT2z06NHDoAASbMuWLTFlypSYOXNm1NfXawjkoCTs19avX7/MpAAAcoMAGADgfSxYsGDh0KFDs7rGfffdN1KpVGQyGQMDSJCampqYMmVKPPPMM4JfyGGpVCr23XffrK9z/vz5C00LACA3CIABAN7Ho48++uYFF1yQ1TWWlJRE586dY926dQYGkAC1tbUxefLkePbZZ6Ourk5DIMd17do1WrVqlfV1/vnPf15kWgAAuUEADADwPiZNmlRVX1+/oaioqGM217nvvvsKgAGy3Pbt22P69OkxderU2LZtm4ZAM9GnT5+sr7G+vr7iySefrDItAIDcIAAGAPgAW7duXZTtAXCfPn3ipZdeMiyALNTQ0BDTpk2Lp556KqqrqzUEmpkkXP+8detWp38BAHKIABgA4ANUVFQs7NChw8hsrjEJLxYBmpvGxsaYMWNGPPnkk1FZWakh0EwlYZ9WUVHh+78AADlEAAwA8AGWLl266MADD8zqGnv16hUFBQXR2NhoYAB7WTqdjlmzZsWkSZNi06ZNGgLNWGFhYfTs2TMR+13TAgDIHQJgAIAPMHPmzEWnnnpqdm/qCgqiZ8+esWzZMgMD2EveDn4nT54cGzdu1BAg9tlnn8jPz0/CfnexaQEA5I48LQAAeH+//OUvV6bT6bpsr7NPnz6GBbAXZDKZePHFF+O73/1u3H///cJf4J+ScP1zOp2u++Uvf7nStAAAcocTwAAAH6C6ujpdXV29uE2bNodkc539+vWL6dOnGxjAHpLJZGL27NkxceLEWLNmjYYAO92fJWCvu7i6ujptWgAAuUMADADwIWzYsGFetgfA/fv3NyiAPeTVV1+NSZMmxapVqzQD2KlUKpWI/dmGDRvmmhYAQG4RAAMAfAiLFy9+o2/fvlldY1lZWXTu3DnWr19vYAC7yYIFC2L8+PGxZMkSzQDeV5cuXaK0tDQJ+9z5pgUAkFsEwAAAH8JTTz31+ujRo7O+zv33318ADLAbLFy4MMaPHx+LFy/WDOBD78uSYMqUKa+bFgBAbsnTAgCAD/aLX/xiTWNjY1W215mUF40ASbFs2bK4++674z/+4z+Ev8BHkoTv/zY0NFTee++9q00LACC3OAEMAPAhNDQ0ZDZv3jy/Q4cOI7O5TgEwwK6xYsWKePTRR2P+fDejArm7L9uyZYs/5AAAcpAAGADgQ1q3bl3WB8AdO3aMNm3axObNmw0M4GNYtWpVjB8/PubOnRuZTEZDgI+lbdu20aFDh0Tsb00LACD3CIABAD6kefPmzTvooIOyvs4DDzwwXnrpJQMD+AjWrVsX48ePj9mzZwt+gV2yH0uCuXPnzjMtAIDcIwAGAPiQ/vznP88/77zzsr7OAw44QAAM8CFVVFTEuHHjBL/ALt+PJcHDDz/sBDAAQA4SAAMAfEgTJ06srK2tXdGqVat9srnOgw8+2LAAPkBVVVVMnDgxnn/++WhqatIQYJdKwq0xNTU1yydNmlRlWgAAuUcADADwEWzYsOHvvXr1yuoAuG3bttG1a9dYu3atgQG8y+bNm+Pxxx+PF154IRobGzUE2OW6desWbdu2TcS+1rQAAHKTABgA4CNYuHDha7169Toj2+scMGCAABjgHbZs2RJTpkyJ5557LrZv364hwG6TlO//Lly48O+mBQCQmwTAAAAfwcSJE/9+wgknZH2dBx54YEyfPt3AgGavpqYmpkyZEs8880zU19drCLDbDRgwIBF1jh8//u+mBQCQmwTAAAAfwb333rv6Bz/4wfqioqLO2VznAQccEHl5eZFOpw0NaJZqa2tj8uTJ8eyzz0ZdXZ2GAHtEXl5e9O/fP+vrrK+vX3ffffeVmxgAQG4SAAMAfESVlZVzu3btmtXHgFu1ahX77LNPLFu2zMCAZqWuri6efvrpmDZtWmzbtk1DgD1qn332iVatWmV9nZs2bZpjWgAAuUsADADwES1dunR2tgfAERGDBg0SAAPNRkNDQ0ybNi2eeuqpqK6u1hBgr+2/kuCtt976m2kBAOQuATAAwEc0ffr0v48cOTLr6xw4cGBMmDDBwICc1tDQEM8991w8+eSTUVlZqSHAXt9/JcG0adP+bloAALlLAAwA8BH9x3/8x9JbbrmlOj8/v3U219mrV68oKyuLLVu2GBqQc9LpdMyaNSsmTZoUmzZt0hBgrysrK4tevXplfZ2NjY1b7rnnnmUmBgCQuwTAAAAfUW1tbXrDhg1/7dKly3HZXGcqlYqBAwfGrFmzDA3IGW8Hv5MnT46NGzdqCJA1Bg4cGKlUKuvr3Lhx4yu1tbVpEwMAyF0CYACAj+Gtt956JdsD4IgQAAM5I51Ox8svvxxTpkyJ8vJyDQGyct+VBIsWLXrFtAAAcpsAGADgYxg/fvwrRxxxRNbXedBBB0VBQUE0NjYaGpBImUwmZs+eHRMnTow1a9ZoCJCVCgoK4qCDDkpErY888ogAGAAgx+VpAQDAR/fjH/94ZX19/fpsr7OoqCj69etnYEAivfrqq3HHHXfEz3/+c+EvkNX69esXRUVFWV9nXV1d+b333rvaxAAAcpsTwAAAH9OGDRte6dGjx6ezvc5BgwbFggULDAxIjCVLlsSECRNi/vz5mgEkwuDBgxNR5/r1653+BQBoBgTAAAAf07x5815OQgA8bNiwePjhhyOTyRgakNXefPPNmDBhQixevFgzgMRIpVIxdOjQRNQ6d+7cl0wMACD3CYABAD6m++677+XRo0dnIiKVzXW2bds2evfuHcuWLTM0ICstW7YsHnvsMSd+gUTq06dPtG3bNgmlpu+9996/mhgAQO4TAAMAfEwTJ06s3Lp165LS0tK+2V7rkCFDBMBA1lmxYkU8+uijgl8g0YYMGZKIOqurqxc+/fTTm00MACD3CYABAD6B8vLyl/fff/+sD4AHDx4c48aNMzAgK6xcuTImTJgQc+fOdT09kHhJ+f7vmjVrfP8XAKCZEAADAHwCM2fOfG7//ff/fLbX2a1bt+jWrVuUl5cbGrDXrFu3LsaPHx+zZ88W/AI5oWfPntGlS5dE1DpjxoznTAwAoHkQAAMAfAK33Xbba5dcckl1fn5+62yvdciQIQJgYK9Yv359PPbYY4JfIOck5frnxsbGzbfddts8EwMAaB4EwAAAn0BlZWXThg0b/tqlS5fjsr3WQw89NCZNmmRowJ78MzKeeOKJeP7556OpqUlDgJxz6KGHJqLOioqKV6qrq9MmBgDQPAiAAQA+oXnz5s1MQgDcu3dv10ADe0RVVVVMnDgxXnjhhWhsbNQQICd17949evbsmZT9quufAQCakTwtAAD4ZP77v/97VkQk4kTFpz71KQMDdpstW7bEQw89FLfffns899xzwl8gpw0fPjwRdWYymfTdd9/9gokBADQfTgADAHxCkyZNqtqyZcuCsrKyg7K91uHDh8fjjz9uaMAuVVNTE1OmTIlnnnkm6uvrNQTIealUKg477LBE1Lply5bXp0+fvsXUAACaDwEwAMAusHz58lkDBw7M+gC4S5cu0atXr1i5cqWhAZ9YbW1tTJ48OZ599tmoq6vTEKDZ6N27d3Ts2DEx+1QTAwBoXgTAAAC7wLPPPvvCwIEDr0hCrcOGDRMAA59IXV1dPP300zFt2rTYtm2bhgDNzrBhwxJT61/+8pcXTQwAoHnxDWAAgF3g1ltvnV9fX782CbUefvjhkUqlDA34yBoaGmLq1Klx6623xuOPPy78BZqlJF3/XFdXt/rWW29dYGoAAM2LE8AAALtAQ0NDZs2aNc/16dPns9lea7t27aJPnz6xZMkSgwM+7J9xMW3atHjqqaeiurpaQ4Bmbb/99ou2bdsmotbVq1fPNDEAgOZHAAwAsIs8++yz05IQAEdEHHHEEQJg4AOl0+mYNWtWTJo0KTZt2qQhABFx5JFHJqbW6dOnTzMxAIDmxxXQAAC7yC233PJaQ0NDZRJqHT58eLRo0cLQgJ1Kp9Px3HPPxW233Rb333+/8Bdgh6KiovjUpz6ViFobGho23HLLLXNNDQCg+XECGABgF6murk6Xl5c/t88++5yR7bW2bNkyDj300Hj55ZcNDvindDodL7/8ckyZMiXKy8s1BOBdhgwZEkVFRYmodc2aNc/V1tamTQ0AoPkRAAMA7EIvvvjiM0kIgCMiRo4cKQAGIiIik8nE7NmzY+LEibFmzRoNAXif/VNSzJo161kTAwBongTAAAC70O233/7KOeecszU/P78022sdMGBAtG/f3tWu0My9+uqrMWnSpFi1apVmALyPjh07xgEHHJCIWhsbG6u/8Y1v/NXUAACaJwEwAMAutHLlyob169fP6tat2+hsrzWVSsXhhx8ekyZNMjhohubMmROTJ0+OJUuWaAbAh3D44YdHKpVKRK3r16+fVVFR0WhqAADNU54WAADsWq+++mpirts77LDDDAyamTfffDP+/d//PX7yk58IfwE+pFQqFSNGjEhMva+88sozpgYA0Hw5AQwAsIvddNNNz5166qnV+fn5rbO91m7dukX//v1j4cKFBgc5btmyZfHYY4/F/PnzNQPgIzrggAOic+fOiai1sbFxy4033jjL1AAAmi8BMADALrZy5cqG8vLyGT179vx0Euo9+uijBcCQw5YvXx7jxo0T/AJ8wv1SUpSXlz9TXl7eYGoAAM2XABgAYDeYMWPGUxdccEEiAuAhQ4ZE69ato7q62uAgh6xcuTImTJgQc+fOjUwmoyEAH1ObNm3i0EMPTUy9zz777FOmBgDQvPkGMADAbvDVr371lYaGhk1JqLWgoCCOOOIIQ4McsW7duvj5z38ed955Z8yZM0f4C/AJjRw5MvLz8xNRa0NDw8abbrrpVVMDAGjenAAGANgNKisrm1atWjW9T58+5ySh3qOPPjqefPJJQREk2Pr16+Oxxx6L2bNn+3cZYBdJpVIxatSoxNS7cuXKadXV1WmTAwBo3pwABgDYTaZNm5aY6/c6duwYAwYMMDRIoA0bNsSvf/3r+Nd//dd49dVXhb8Au9CAAQOiY8eOian36aefftLUAAAQAAMA7CZf+9rX5tTX11ckpd6jjjrK0CBBqqqq4v77749vf/vb8eKLL0ZTU5OmAOxiRx55ZGJqra+vX/eNb3zjdVMDAMAV0AAAu0ltbW16xYoVT++///6fT0K9hx56aLRt2zaqqqoMD7LYli1bYsqUKfHcc8/F9u3bNQRgN2nbtm0MGTIkMfUuX778qdraWtc/AwDgBDAAwO70xz/+cUJSas3Pz4/jjjvO0CBL1dTUxKOPPhq33XZb/OUvfxH+Auxmxx57bOTn5yel3Myvf/3rCaYGAECEABgAYLe66667llZXV89PSr1HH310tGjRwuAgi7wd/H7jG9+IqVOnRn19vaYA7GYtWrSIo48+OjH1btmy5Y177rlnhckBABDhCmgAgN3u9ddfn3T44YcPSEKtxcXFcdhhh8XMmTMNDvayurq6ePrpp2PatGmxbds2DQHYgw477LAoKSlJTL3z5s17wtQAAHibE8AAALvZ9773vanpdLohKfWecMIJkUqlDA72koaGhpg6dWrceuut8fjjjwt/AfawVCoVJ5xwQmLqTafT27/73e8+ZXIAALzNCWAAgN1s+vTpWyoqKmZ26dIlER/Y7d69e/Tv3z/efPNNw4M9qKGhIaZNmxZPPfVUVFdXawjAXnLAAQdE9+7dE1NvRUXFczNmzPAXBwAA/+QEMADAHjBr1qxEXcuXpFMvkHTpdDqee+65uP322+PRRx8V/gLsZccff3yi6p0xY8YkUwMA4J2cAAYA2AO++tWvvnT66adXFRYWtk1CvQMHDoyOHTvGhg0bDA92k3Q6HbNmzYrJkyfHxo0bNQQgC3Ts2DEGDhyYmHobGhoqb7755pdMDgCAd3ICGABgDygvL29YsWLF1MRsEvPy4sQTTzQ42A3S6XS8+OKL8Z3vfCfuv/9+4S9AFjnppJMiLy85r8tWrFgxpaKiotHkAAB4JwEwAMAe8qtf/erRiMgkpd6jjjoqysrKDA52kUwmE6+++mp873vfi1//+texdu1aTQHIImVlZXHUUUcl6q+W//7v//6zyQEA8G4CYACAPeQ///M/l1dWVv4tKfUWFhbGMcccY3CwC7wd/P785z+PNWvWaAhAFjruuOOioCA5X0urqqqa/dOf/nS1yQEA8G4CYACAPeill14al6R6jzvuuCgqKjI4+JjmzJkTd911V/z85z+P1au9owfIVkVFRYn7xbcXXnhhnMkBALAzBVoAALDnjB079pkFCxZUFhYWtktCvSUlJXHEEUfE9OnTDQ8+gjfffDPGjx8fb731lmYAJMCRRx4ZJSUliam3oaFh0zXXXPOsyQEAsDMCYACAPai8vLxh6dKlE/v3739xUmo+8cQT49lnn410Om2A8AEWLVoUjz32WCxevFgzABIiLy8vTjzxxETVvGTJkifKy8sbTA8AgJ3ucbUAAGDP+u1vfzsxIjJJqbdjx44xdOhQg4P3sXz58rj77rvjRz/6kfAXIGGGDRsWHTp0SFLJmd/85jePmxwAAO9FAAwAsIf953/+5/JNmza9kqSaTz/99EilUoYH77Jy5cr4yU9+Et///vdj/vz5GgKQMHl5eXHGGWckquZNmza9fM8996wwPQAA3osroAEA9oKXXnpp/KmnnnpYUurt2rVrDBkyJGbPnm14EBHr1q2L8ePHx+zZsyOTyWgIQEINHTo0OnfunKiaX3jhhQkmBwDA+xEAAwDsBZdffvkzS5YsWVdUVNQlKTWfccYZ8be//U3YRbO2fv36eOyxxwS/ADkglUrF6aefnqia6+rq1lx22WXTTQ8AgPcjAAYA2AsqKyub5s+f/8ihhx56dVJq7tatm1PANFsbNmyIxx9/PF555ZVoamrSEIAc8KlPfSq6du2aqJrfeOONcdXV1WnTAwDg/fgGMADAXvL1r399XDqdrktSzb4FTHNTVVUV999/f3z729+OF198UfgLkCNSqVR8+tOfTlTN6XS69pvf/OZjpgcAwAdxAhgAYC+ZMWNG9Zo1a/7Ss2fPxLx97N69ewwcODDmzJljgOS0LVu2xIQJE+KFF16IxsZGDQHIMYceemh069YtUTWvXr36qRkzZlSbHgAAH8QJYACAvejXv/71HyMiUR8SPeuss5wCJmdt27YtHn300bjtttviueeeE/4C5KC8vLwYM2ZM0srO/OpXv/qT6QEA8KH2vFoAALD3fP/733+rqqoqUR/V7dGjR3zqU58yPHJKfX19TJ06Nb71rW/F1KlTo76+XlMActSIESOiS5cuiap506ZNf73rrruWmh4AAB+GABgAYC975plnHkpazWeccUbk5dlKkjvmzZsXjz76aGzdulUzAHJYQUFBnH766Ymre9q0aQ+aHgAAH5a3dgAAe9nYsWNn1tfXr01SzZ07d47DDjvM8ACARBk5cmR06NAhUTXX1dWtHjt27POmBwDAhyUABgDYyyorK5tee+21Pyat7jPPPDMKCgoMEABIhBYtWiTy9O/s2bP/UF1dnTZBAAA+LAEwAEAWuOqqqyY0NjZWJanm9u3bx9FHH214AEAiHHfccdGmTZtE1dzQ0LDxiiuumGh6AAB8FAJgAIAssGDBgrqFCxc+lrS6R48eHYWFhQYIAGS1li1bxsknn5y4uhcuXDhu6dKl200QAICPQgAMAJAlvv71r/8pnU7XJqnmtm3bximnnGJ4AEBWO+2006K0tDRRNTc1NdV+7Wtfe8j0AAD4qATAAABZ4umnn968fPnyxF3xN3r06GjXrp0BAgBZqUOHDnH88ccnru5ly5ZNmD59+hYTBADgoxIAAwBkkbvvvvtPmUymKUk1FxYWxumnn254AEBWOvPMMxP3yYpMJtN41113/dH0AAD4OATAAABZ5Be/+MWatWvXTkta3UcccUT06tXLAAGArNK7d+847LDDEld3eXn5X+6///51JggAwMchAAYAyDIPP/zwn5JWcyqVijPPPNPwAICsMmbMmEilUomr+8EHH/yT6QEA8HEJgAEAsszXv/71NzZs2DAraXUPHDgwDj74YAMEALLCoEGDYsCAAYmru6KiYuatt966wAQBAPi4BMAAAFlo3Lhxv01i3WPGjIm8PFtMAGDvysvLizFjxiSy9j//+c+/NUEAAD7RflgLAACyz/XXXz+nqqrqr0mru1evXnHUUUcZIACwVx1zzDHRvXv3xNW9adOmV2666aa5JggAwCchAAYAyFJ/+tOf7k1i3WPGjInS0lIDBAD2ijZt2sRZZ52VyNofeOCBe00QAIBPSgAMAJClbrrpprlJPAVcXFwcZ555pgECAHvFWWedFS1btkxc3Zs2bXrl5ptvnmeCAAB8UgJgAIAsNm7cuF8lse5Ro0ZF7969DRAA2KP69OkTI0eOTGTtjz322K9MEACAXUEADACQxcaOHTu7qqrqb0mrO5VKxfnnnx+pVMoQAYA9tv/4/Oc/n8j9R2Vl5d+uueaav5kiAAC7ggAYACDLTZ069bdJrLtv374xZMgQAwQA9ojDDjsssTeQTJ48+TcmCADAriIABgDIcpdeeumLVVVVryax9s9//vNRXFxsiADAblVaWhrnn39+Imuvqqr66+WXX/6SKQIAsKsIgAEAEuChhx76WRLrLisri9NPP90AAYDd6qyzzoqSkpIklp753e9+91MTBABgVxIAAwAkwA033DB3w4YNs5JY+3HHHRd9+vQxRABgt+jbt28cddRRiay9oqJi1te//vU3TBEAgF1JAAwAkBA///nPfxoR6aTVnUql4vOf/3zk5dl6AgC7Vn5+flx00UWRSqWSWH76F7/4xX+bIgAAu5q3cAAACXHHHXe8tW7duulJrL13795xzDHHGCIAsEudcMIJ0b1790TWXl5e/pc77rjjLVMEAGBXEwADACTI3XfffW8mk2lKYu1nnXVWtG3b1hABgF2iQ4cOcfrppyey9kwm03T33Xf/3BQBANgdBMAAAAlyzz33rCgvL386ibW3bNkyzj33XEMEAHaJc889N1q0aJHI2tesWTP1xz/+8UpTBABgdxAAAwAkzA9/+MOfZzKZhiTWPnz48Bg0aJAhAgCfyKGHHhpDhw5NZO3pdLrhBz/4wS9MEQCA3UUADACQMPfee+/qRYsWPZDU+i+++OIoKSkxSADgY2ndunVcfPHFia1/4cKFf7jvvvvKTRIAgN1FAAwAkECXXXbZrxsaGjYlsfaysjJXQQMAH9u5554bpaWliay9oaFh4+WXX/47UwQAYHcSAAMAJNDs2bNrXn311V8ntf4jjjgiDj74YIMEAD6SwYMHx+GHH57Y+l955ZX7Zs+eXWOSAADsTgJgAICEOueccx6tqalZmtT6L7roomjZsqVBAgAfSsuWLeNzn/tcYuuvqalZMmbMmMdMEgCA3U0ADACQUJWVlU3Tpk37RVLrb9++fZx++ukGCQB8KGeccUa0b98+sfU/+eST91ZXV6dNEgCA3U0ADACQYOedd960qqqqV5Ja/wknnOAqaADgAx188MFx/PHHJ7b+TZs2vXzBBRc8a5IAAOwJAmAAgIT74x//eG9EZJJYeyqVigsuuMBV0ADAe2rZsmVccMEFkUqlkrqEzP333/8zkwQAYE8RAAMAJNzNN988b9WqVU8ktf6OHTsm+nt+AMDudcEFF0THjh0TW/+KFSse//rXv/6GSQIAsKcIgAEAcsCNN974k6ampq1JrX/kyJExdOhQgwQA/pdPfepTMWLEiMTW39TUVH3zzTf/t0kCALAnCYABAHLAxIkTK//+97//KslruPDCC6OsrMwwAYCIiGjTpk18/vOfT/QaZs+efd/EiRMrTRMAgD1JAAwAkCPOPvvsh2pqapYntf7S0tK46KKLDBIAiFQqFV/84hejtLQ0sWuoqal566yzznrYNAEA2NMEwAAAOaKioqJx0qRJP07yGgYPHhwjR440TABo5o444og46KCDEr2GJ5544qeVlZVNpgkAwJ4mAAYAyCGXXHLJzIqKihlJXsMFF1wQ3bp1M0wAaKZ69uyZ+KufKyoqZnzhC1+YZZoAAOwNAmAAgBzzb//2b/ek0+ntSa2/RYsWceWVV0ZhYaFhAkAzU1hYGF/60pcSvQ9Ip9Pb/+3f/u0e0wQAYG8RAAMA5Jh777139aJFix5M8hq6d+8eZ555pmECQDNzxhlnRPfu3RO9hsWLFz947733rjZNAAD2FgEwAEAO+uxnP/vL2traRL94PPHEE2Pw4MGGCQDNxKBBg+Kkk05K9Bpqa2tXn3vuub80TQAA9iYBMABADlq8eHH9uHHj/j3Ja0ilUnHJJZdE27ZtDRQAclybNm3ikksuiVQqleh1jBs37t8XL15cb6IAAOxNAmAAgBx1+eWXv1RRUTEjyWsoLS2NL3zhC4l/GQwAvLe3f+mrdevWiV5HRUXFM5dffvlLJgoAwN4mAAYAyGE33HDDXU1NTVuTvIaDDjrI94ABIId95jOfiUMOOSTRa2hqaqq+4YYbfmiaAABkAwEwAEAOGzdu3MbZs2cn/jt0p5xyiu8BA0AOOuSQQ+LTn/504tfx17/+9efjxo3baKIAAGQDATAAQI77zGc+81B1dfXCJK8hlUrFF7/4xejQoYOBAkCO6NixY3zpS19K/KceNm/ePO+00057xEQBAMgWAmAAgBxXXV2dfuCBB34UEekkr6O4uDguvfTSyMuzhQWApMvPz4/LLrssiouLk76U9P333/+ftbW1aVMFACBbeHsGANAMXH/99XMWLVr0YNLXsf/++8e5555roACQcOedd1707ds38etYuHDhH7/61a++bqIAAGQTATAAQDNxySWX/Lyurq486es4/vjjfQ8YABJs2LBhccwxxyR+HXV1dWsuvPDC+0wUAIBsIwAGAGgmXnvttdoHHnjguxGRSfI6UqlUfOlLX4oePXoYKgAkTO/evePSSy9N/Hd/IyLzwAMPfO/111+vNVUAALKNABgAoBm5+uqr/7Z06dJHk76OoqKiGDt2bJSWlhoqACRE69at46qrrorCwsLEr2X58uXjrr766r+ZKgAA2UgADADQzJx33nn/r66ubnXS19GhQ4e4/PLLIy/PlhYAsl1eXl5cfvnl0b59+8Svpb6+ft0ll1zyE1MFACBr999aAADQvLz++uu1Dz744Pcj4VdBR0QMGDAgzjrrLEMFgCw3ZsyYOPDAA3NiLY899tgPXnnllW2mCgBAthIAAwA0Q1/5ylf+umbNmqm5sJaTTz45Dj30UEMFgCw1ZMiQOOmkk3JiLWvXrv3LpZde+oKpAgCQzQTAAADN1GWXXfYf9fX1FUlfRyqViksvvTS6d+9uqACQZXr06BFf/OIXI5VKJX4tDQ0Nm6655pofmioAANlOAAwA0EzNmDGj+oEHHvhO5MBV0C1btozrr78+2rZta7AAkCXatWsX1113XbRs2TIXlpN56KGH/nXSpElVJgsAQLYTAAMANGNf+cpX/rpkyZI/58Ja2rZtG1dffXW0aNHCYAFgL2vRokVcffXVOfPLWUuXLn30iiuueNlkAQBIAgEwAEAzd+655/6ktrZ2eS6spXfv3jlzzSQAJNXbn2fYZ599cmI9tbW1y88555wfmywAAEkhAAYAaOYWLFhQ97Of/ezbmUymMRfWM2zYsDjllFMMFgD2kk9/+tMxdOjQnFhLJpNp/NnPfvbtBQsW1JksAABJIQAGACBuvfXWBfPnz78/V9Zz5plnxuDBgw0WAPaw4cOHx2c+85mcWc/8+fN/d+utty4wWQAAkkQADABARESMGTPmvpqamrdyYS2pVCouu+yy6Nmzp8ECwB7Su3fvuPjii3PmUwxbt25ddPrpp//aZAEASBoBMAAAERGxcuXKhh/+8Ie3pdPpnLjisGXLlvEv//Iv0aVLF8MFgN2sS5cucf3110dRUVFOrKepqanmu9/97jfKy8sbTBcAgKQRAAMA8E933XXX0ueff/6eXFlPaWlpXHvttVFWVma4ALCblJWVxXXXXRclJSU5s6aZM2fe/f/+3/9bZboAACSRABgAgP/l5JNPHldeXv50rqynU6dOMXbs2Jw5kQQA2aSoqCiuueaa6NixY86sqby8/MlTTz11gukCAJBUAmAAAP6PSy655K66urq1ubKefffdN6644orIy7P9BYBdJS8vL6688sro3bt3zqyprq6u/JJLLvmh6QIAkOi9uhYAAPBus2bNqn7ooYfujIh0rqxp4MCBcd555xkuAOwi559/fhxyyCG5tKT0gw8+eOesWbOqTRcAgCTLb3tQ9NzpjndbRG15oQ4BADRTEydOXDNmzJi8Tp06Dc2VNfXp0yfy8/PjzTffNGAA+ATOOuusOOmkk3JqTa+//vp9Z5555kTTBQAgCYq7N0Ze6c5/5gQwAADv6dRTT/31li1bXs+lNZ122mlx9NFHGy4AfEzHHntsnHrqqTm1pi1btrxx2mmn/cZ0AQDIBQJgAADeU0VFReONN974jcbGxqpcWtcFF1wQRx55pAEDwEd05JFHxuc+97mcWlNjY2PVzTff/I2KiopGEwYAIBcIgAEAeF9//OMf1z/yyCPfiRz6HnAqlYqLLroohgwZYsAA8CENHTo0LrrookilUrm0rPQjjzzynfvvv3+dCQMAkCsEwAAAfKBLL730hQULFvwupzbCeXnxpS99Kfbff38DBoAPcNBBB8WXvvSlyMvLrVdJCxYs+N2ll176ggkDAJBLBMAAAHwoo0eP/mVVVdXcXFpTYWFhfOUrX4kePXoYMAC8h169esUVV1wRBQUFObWuqqqqOaNHj/6lCQMAkGsEwAAAfCgVFRWNV1111S0NDQ0bcmldJSUlcfPNN8c+++xjyADwLr17946bbropiouLc2pdDQ0NG6666qqv++4vAAC5SAAMAMCHNmHChE3333//tzKZTDqX1lVcXBzXXXdddO/e3ZABYIfu3bvHtddeG61atcqpdWUymfT999//rQkTJmwyZQAAcpEAGACAj2Ts2LGz58+f/9tcW1fr1q3juuuuiw4dOhgyAM1ehw4d4rrrrovWrVvn3Nrmz5//m7Fjx842ZQAAcpUAGACAj+y44477xaZNm17MtXW1a9cubrzxxmjXrp0hA9BstW3bNmf/Pty4ceOLxx13nO/+AgCQ0wTAAAB8ZNXV1emLL774W3V1datzbW0dO3aMG2+8Mdq0aWPQADQ7ZWVlceONN0bHjh1zbm21tbWrL7zwwturq6vTJg0AQC7Lb3tQ9NzZD9LbImrLC3UIAICdWrZsWf327dtfOvbYY0/Ny8trkUtrKykpiaFDh8Zrr70WNTU1hg1As9ChQ4f42te+Fp06dcq5tTU1NW39zne+M/bBBx9cb9IAAOSC4u6NkVe6858JgAEA+NhefPHFzYcccsiyAQMGnBgRqZzaRBcXx5AhQ4TAADQLHTt2jJtuuik6dOiQi8tLjx8//ravfvWrc0waAIBc8X4BsCugAQD4RC688MIZb7zxxm9ycW3t27ePm266KSdPQgHA2zp16pTL4W+88cYbv77wwgufM2kAAJoLATAAAJ/YqFGjfrFhw4aZubi2t0Pgzp07GzQAOadz585x0003Rfv27XNyfRs2bJg5atSo+0waAIDmRAAMAMAnVltbm77sssu+V1dXtzoX19euXbu44YYbomPHjoYNQM7o0KFDXH/99dGuXbtc3Z+s/sIXvvDd2tratGkDANCc+AYwAAC7xJIlS+oj4pVRo0admpeX1yLX1ldcXBxDhw6NuXPnxrZt2wwcgETr0qVL3HjjjTl77XNTU1P1nXfeec0f/vCHdaYNAEAuer9vAAuAAQDYZWbNmlXVo0ePuYceeujoVCqVn2vra9WqVYwYMSIWLVoUlZWVBg5AIu23335x0003RVlZWU6uL51ON/z617++4fbbb3/TtAEAyFUCYAAA9phJkyatPeqoozbsu+++R+fi+goLC2P48OGxbNmy2LBhg4EDkCgDBgyIa6+9Nlq1apWza5w2bdq/XXLJJc+ZNgAAuez9AmDfAAYAYJc77bTTHn/rrbcezNX1FRUVxTXXXBNDhgwxbAASY8iQIXHNNddEUVFRzq5xwYIFvzv99NOfMG0AAJozATAAALvFEUcccc+GDRtm5ur6CgoK4sorr4wjjjjCsAFIwt/LceWVV0ZBQUHOrrG8vPypESNG/LdpAwDQ3AmAAQDYLaqrq9MXXXTRd2pra1fk7GY6Ly8uvvjiOPLIIw0cgKw1atSouPjiiyMvL3dfA23dunXxZz/72e83NDRkTBwAgObON4ABANhtli9fvr2mpuaFY4899uT8/PyWubjGVCoVgwYNikwmE4sWLTJ0ALLK6aefHueee26kUqmcXWN9fX3FDTfccM3UqVOrTBwAgObi/b4BLAAGAGC3evnll7cUFBS8cMQRR4zOy8trkYtrTKVSccABB0SnTp1i7ty5kck4fATA3lVYWBhXXHFFHHPMMTm9zsbGxuo777zzKz/72c9WmzoAAM2JABgAgL1qxowZlb169Xp98ODBJ6dSqfxcXWfPnj2jb9++8fe//z0aGxsNHoC9olWrVnH11VfHwIEDc3qd6XS64be//e2Nt9122wJTBwCguREAAwCw1z3xxBPlw4cPX9OvX79jIyJn76Hs2LFjDBw4MObMmRN1dXUGD8Ae1a5du7jxxhujT58+ub7U9JQpU779xS9+8XlTBwCgOXq/ADhPewAA2FPGjBkz9Y033vh1rq+zZ8+eceONN0bHjh0NHYA9pkuXLnHTTTdF9+7dc36tc+fO/eU555zzF1MHAID/SwAMAMAe9alPfernS5cufTjX19mlS5e49dZb48ADDzR0AHa7gQMHxje/+c3o1KlTzq/1rbfeemjEiBG/MnUAANg5ATAAAHvcsccee8/GjRtfyPV1FhcXx7XXXhsjRowwdAB2m8MPPzyuuuqqaNmyZc6vdePGjc8fffTR95g6AAC8NwEwAAB7XEVFReNxxx339crKyr/l+loLCgrisssui/PPPz9SqZThA7DLpFKpOP/88+PSSy+NgoKCnF/vpk2bXj7ssMNuqaysbDJ9AAB4bwJgAAD2isWLF9efddZZN1dXV7/ZHNZ7/PHHx5e//OUoKioyfAA+sRYtWsSXv/zlOP7445vFequrq98cM2bMN8rLyxtMHwAA3l9+24Oi585+kN4WUVteqEMAAOw2a9asaVi1atWs0aNHH1dQUNA619fbrVu3OOCAA2LevHlRX1/vAQDgYykrK4trrrkmDjrooGax3rq6uvKxY8de89RTT202fQAA+Ifi7o2RV7rznwmAAQDYq+bNm1ezevXqZ04++eTjCwoKSnN9ve3atYuRI0fG8uXLY+PGjR4AAD6S/v37x0033RRdu3ZtFuutr69fd9111335T3/6U4XpAwDA/xAAAwCQ1ebMmbMtlUq9fOSRR56Ul5eX83ckt2jRIkaMGBG1tbWxdOlSDwAAH8rxxx8fX/rSl5rN5wQaGxu33HXXXdf99Kc/XWn6AADwvwmAAQDIejNnzqzs2bPn64MHDz4plUrl5/p6U6lUHHLIIdGqVatYsGBBZDIZDwEAO5WXlxef/exn4/TTT49UKtUs1pxOp7f//ve//+o3vvGN1z0BAADwfwmAAQBIhEmTJpXvs88+8wYOHHhCKpUqaA5r3m+//WLAgAExd+5c3wUG4P8oKyuL6667LoYNG9Zs1pxOp7f/8Y9/vOmqq676qycAAAB2TgAMAEBiTJw4cc3BBx+85MADDzwulUrlNYc1t2/fPoYOHRqLFi2KLVu2eAgAiIiIffbZJ66//vro2bNns1lzJpNpnDBhwm1f/OIXn/cEAADAexMAAwCQKI8++ujy/fff/42DDjrohOZwHXRERHFxcRx11FHR2NgYb731locAoJkbPXp0XHHFFVFSUtJs1pxOpxsefvjhr15yySWzPAEAAPD+BMAAACTO+PHjVw0cOHDpAQcccGxzOQmcSqViwIAB0aVLl3jjjTeiqanJgwDQzBQVFcWll14aJ554YrP53m/EP07+Pv7447dffPHFMz0FAADwwQTAAAAk0iOPPLLs0EMPXbb//vs3mxA4IqJHjx4xZMiQePPNN2Pr1q0eBIBmonv37vEv//IvccABBzSrdWcymaYnnnji9s997nPPeAoAAODDEQADAJBYDz/88NJjjjlmY+/evY+KiGZzFKq0tDSGDx8eq1evjvXr13sQAHLcwIED45prrol27do1t6VnZsyY8YOzzjprqqcAAAA+PAEwAACJdv/99795zDHHVO6zzz5HRDMKgVu0aBGHHXZYtGzZMhYuXBjpdNrDAJBjCgoK4pxzzonzzz8/WrRo0dyWn37uuefuOuWUUyZ4EgAA4KMRAAMAkHi///3v5w8bNmxF3759j2lO10GnUqno27dvDB06NBYvXhxbtmzxMADkiJ49e8YNN9wQgwcPblbf+434x7XPU6ZM+fbpp58+2ZMAAAAfnQAYAICc8OCDDy4ZNmzYin79+jWrEDgionXr1nHEEUdEfX19LF261MMAkGCpVCpOOOGEuOKKK6JNmzbNbv07wt9vnXPOOX/xNAAAwMcjAAYAIGc89NBDS4YNG7a8X79+xza3EDg/Pz8OPvjg6NWrV8yfPz8aGho8EAAJU1JSEpdffnmccMIJkZ+f3+zWn8lkGp944olvffazn53maQAAgI9PAAwAQE556KGHlo4cOXJdnz59RqWa252ZEdG1a9cYNmxYLFu2LCorKz0QAAnRt2/fuO6662K//fZrluvPZDLpp59++rvnnHPO054GAAD4ZATAAADknD/96U+LDj300KX7779/s7sOOiKiuLg4jjzyyCgpKYk333wz0um0hwIgSxUUFMRnP/vZuPDCC6OkpKRZ9iCdTjc88sgjt5x//vnTPREAAPDJCYABAMhJDz/88NId3wQelUqlmt09mqlUKvr06RMHH3xwLFy4MLZt2+ahAMgynTt3jrFjx8bQoUOjGV5aERH/CH+feOKJ2y+88MLnPBEAALBrCIABAMhZDz300JIePXq8NmjQoGPz8vJaNMcetG3bNkaNGhVNTU2xZMkSDwVAFkilUjF69Oi48soro0OHDs22D01NTdt++9vf/stll132oqcCAAB2HQEwAAA5bdKkSeXdu3efM3jw4GYbAufn58eAAQOiV69esWDBgti+fbsHA2Avad26dVx66aVx/PHHR35+frPtQ2NjY/WvfvWrf7nuuute81QAAMCuJQAGACDnTZ48eW1jY+OMI4444uiCgoKS5tqHrl27xqhRo2Lbtm2xcuVKDwbAHpRKpWLUqFExduzY6NWrV7PuRX19/fo77rjjK9/61rcWejIAAGDXEwADANAsPP/881UbNmx45rjjjjuqsLCwrLn2obCwMAYNGhT77bdfLF68OGpraz0cALtZ+/bt44orrogTTzwxCgub9/uU2tralTfffPPVP/nJT1Z7MgAAYPcQAAMA0Gz87W9/27p27doZJ5xwwsjCwsK2zbkXnTp1ipEjR0Z1dbXTwAC70ciRI+Pqq6+OHj16NPte1NTULL/hhhuu/e1vf7vOkwEAALuPABgAgGbltdde2zpv3rynTznllKFFRUWdmnMvCgsL49BDD4399tsvFi1a5DQwwC709qnfk08+udmf+o2I2Lx587yLL774unHjxm30dAAAwO71fgFwat9zYsTOftC4LmLjq610DwCAxOrVq1fhs88++69du3Y9QTciGhoaYurUqTF58uRobGzUEICPqaCgIE499dQYPXq04HeH8vLyp4499tjvrly5skE3AABg9+swrDYKuuz8ZwJgAAByWuvWrfNeeumlm/fdd9+zdeMfVq9eHffff38sWbJEMwA+ov322y8uuugi1z2/w8KFC38/fPjwnzY0NGR0AwAA9gwBMAAAzd7zzz9/8aGHHnp1RKR0IyKTycTMmTPjz3/+c9TV1WkIwAcoKSmJ8847L0aMGBGplL9Kdki//PLL9xx77LEPagUAAOxZ7xcA+wYwAADNwn333Tfn+OOP39yrV6/DQwgcqVQqevfuHcOHD49169ZFRUWFhwTgPRxyyCExduzY6N+/v/B3h0wm0/jMM8/828knnzxONwAAYM97v28AC4ABAGg2fve7370xePDgJf369Ts6lUrl60hEcXFxjBgxInr06BFLly6N2tpaTQHYoUOHDvGFL3whzjzzzCguLtaQHZqammoeeOCBWz73uc9N1w0AANg7BMAAALDDww8/vKygoOC54cOHH1FQUFCqI//QrVu3OO6446K0tDQWL14cTU1NmgI0Wy1btoxzzjknLr300ujevbuGvENtbe2K22677arbbrvtDd0AAIC9RwAMAADv8Oyzz25avHjx0yeddNKQoqKiTjryD3l5edGnT58YOXJkbN26NVatWqUpQLNz+OGHx1e+8pUYMGBA5OXlacg7VFVV/e3CCy+8/oEHHvDdAAAA2MsEwAAA8C7z58+vefbZZ58+44wz+hcXF/fSkf/RsmXLGDJkSOyzzz6xdOnSqKmp0RQg53Xs2DG++MUvximnnBItW7bUkHdZt27dMyeffPI3Xn755W26AQAAe9/7BcCpfc+JETv7QeO6iI2vttI9AAByWmFhYer555//0sEHH3y5bvxfTU1N8fzzz8f48eOjurpaQ4Cc07p16zjzzDPjyCOPdOJ35zJ///vff3rMMcfc39DQkNEOAADIDh2G1UZBl53/TAAMAAARMWnSpM8cc8wxt6RSKdfg7ERNTU1MmTIlpk2bFg0NDRoCJF5hYWGccsopcdJJJ0VRUZGG7EQ6na6fOnXqd88555y/6AYAAGSX9wuAXQENAAAR8Yc//GHhfvvt98aAAQOOysvLkwS8S2FhYQwYMCCGDh0amzZtinXr1mkKkFiDBw+Oq666KoYOHRoFBQUashONjY1Vv//972/5whe+MEs3AAAg+/gGMAAAfAgTJkxYXV1dPf3II4/8VGFhYTsd+b9KS0vjsMMOi/79+8eaNWti8+bNmgIkRu/evePyyy+PU045JUpLSzXkPWzdunXxLbfccs33vve9hboBAADZyTeAAQDgI+jTp0+LJ5988us9evQ4TTfe3/z58+ORRx6JlStXagaQtXr16hXnnHNODBgwQDM+wKpVq5444YQTfrBy5Ur3/QMAQBbzDWAAAPgYnnnmmfOHDx9+fSqVytON95bJZGL27Nkxbty4qKio0BAga3Tu3DnOOuusGDp0aKRSKQ15/z/Lm2bNmvXDk08++THdAACA7OcbwAAA8DH85je/eX3//fd//cADDzzSd4HfWyqViu7du8cxxxwT7dq1i2XLlkV9fb3GAHtN27Zt49xzz42LL744evToIfz9AI2NjdUPPvjgLZ/97Gf/ohsAAJAMvgEMAAAf0/jx41dFxPOHHXbYiMLCwjIdeW95eXnRu3fvOOqoo6KgoCBWrlwZjY2NGgPsMcXFxXHKKafEl770pejbt2/k5bnA4YPU1tau+MEPfnD9LbfcMk83AAAgQf/94xvAAADwyQwePLjVo48++s1u3bqdpBsfTn19fTzzzDMxderU2LZtm4YAu01ZWVmceuqpceSRR0ZRkQsbPqyVK1c+/ulPf/pHixcvdm0DAAAkjG8AAwDALvLkk0+edeSRR96USqVcl/MhCYKB3eXtE7/HHnus4PcjyGQyDbNmzfoP3/sFAIDk8g1gAADYRX7/+98v6NGjx2uHHHLIyPz8fL8x+SEUFBREv3794qijjoq8vLxYtWqVq6GBT6Rly5ZxwgknxBVXXBEHHXRQFBQUaMqH1NDQsOG3v/3t1z7/+c8/oxsAAJBcroAGAIBd7Lzzzut4991339m2bdvBuvHR1NTUxLPPPhvTpk2LLVu2aAjwoZWVlcXxxx8fxxxzTBQXF2vIR1RVVfW3a6+99vZHHnlkg24AAECyuQIaAAB2g06dOhVMmzZtbN++fT8XESkd+WgaGhri+eefjyeffDI2bJBFAO/7522cdNJJccQRR0RhodvKPobMokWL/nTsscf+pLKyskk7AAAg+QTAAACwG/3hD38Ydfrpp99WUFDQRjc+unQ6Ha+++mpMnTo1Vq5cqSHAP/Xq1StOOeWUGDp0aOTl5WnIx9DY2Fg1YcKEOy666KKZugEAALlDAAwAALvZaaed1vbee+/9docOHUbqxse3fPnymDZtWrz88suRTqc1BJqhvLy8OOyww+L444+P3r17a8gnsHHjxue//OUvf3fSpElVugEAALlFAAwAAHtAYWFh6qmnnjpv+PDh16RSKXeUfgIbNmyIGTNmxHPPPRc1NTUaAs1AcXFxjBo1Ko4++ujo2LGjhnwCmUym4ZVXXvl/J5100kMNDQ0ZHQEAgNzzfgFwftuDoufOfpDeFlFb7p0VAAB8WOl0On7zm9+8Xlpa+uLgwYM/VVhYWKYrH09xcXEMGDAgjj322GjTpk2sXbs2amtrNQZyUIcOHeKMM86ISy+9NAYOHBjFxcWa8gnU1tau+slPfnLjxRdf/IybFAAAIHcVd2+MvNKd/8wJYAAA2A1OPPHENvfdd9+tnTp1Olo3PrnGxsb429/+Fs8++2wsWrRIQyAH9OvXL44++ugYNmxYFBQUaMguUFFR8cwXv/jFf5s+ffoW3QAAgNzmCmgAANhLHn744RNGjx799YKCgta6sWusX78+Zs6cGc8//3xUV1drCCRIaWlpHHnkkXHUUUdF586dNWQXaWxs3DJ16tS7PvvZz/5FNwAAoHkQAAMAwF50ySWXdP3+97//rXbt2g3VjV2nsbExXnvttXjuuedi/vz5GgJZbMCAATFq1KgYPHiw0767WFVV1atf//rXv/e73/1urW4AAEDzIQAGAIC9rF27dvlTp0699OCDD740lUrl68iutXz58nj++efj5ZdfjpqaGg2BLFBSUhLDhw+PI444Inr37q0hu1gmk2mcN2/efSeeeOJvq6urfewXAACaGQEwAABkia9//ev73Xjjjf9aWlraXzd2vXQ6HW+++WY899xz8dprr0VjY6OmwB5UUFAQgwcPjlGjRsUBBxwQeXl5mrIbVFdXL/zP//zPf/3BD36wRDcAAKB5EgADAEAWOfjgg1v9+c9/vrZ3795jIiKlI7tHZWVlvPjii/HCCy/EunXrNAR2o65du8bIkSPj8MMPj7Zt22rI7pNZunTpn88888z/t3jx4nrtAACA5ksADAAAWejuu+8eePHFF9/WqlUrd6PuZuXl5fHqq6/GSy+9FOvXr9cQ2AU6d+4cI0aMiGHDhkW3bt00ZDerqalZ9tvf/vbOm266aa5uAAAAAmAAAMhS/fr1K3r44Ycv79+//4WpVMpdqXvA8uXL46WXXoqXX345qqurNQQ+grKyshg+fHiMGDHCd333kEwmk164cOEfzj777F8sXbp0u44AAAARAmAAAMh6P/3pT4d97nOf+2bLli176Mae0dDQEHPnzo2//vWvMXfu3Ni+Xa4CO9OyZcsYNGhQDBs2LA455JAoKCjQlD2ktrZ21R//+Mc7rr322r/rBgAA8E4CYAAASIA+ffq0ePTRR69wGnjPS6fTsXTp0nj11VedDIaIaNu2bQwbNiyGDRsWffr0ibw8fyTtSZlMpuG11177+ZlnnvmnioqKRh0BAADeTQAMAAAJ8uMf//jQCy644JutWrXaRzf2vLdPBs+ePTvmzp0bdXV1mkKzUFZWFoMHD45hw4ZF//79Iz8/X1P2gpqammX333//nTfccINv/QIAAO9JAAwAAAnTrl27/HHjxp37qU996qq8vDwb870kk8nEihUrYu7cuTFnzpxYsWJFZDIZjSEnpFKp6Nu3bwwbNiwGDRoUHTt21JS9qKmpqfbVV1/92ZgxY/5cWVnZpCMAAMD7EQADAEBCffnLX+5x++23f7V9+/aH68bet2XLlnjjjTdizpw5MW/evKivr9cUEqVly5Zx8MEHx6BBg+KQQw6J0tJSTckCGzdufPG73/3uv//iF79YoxsAAMCHIQAGAIAEKywsTE2cOPGMkSNHXlNQUNBaR7JDXV1dvPnmm/HGG2/EG2+8EevXr9cUslKXLl3ioIMOioMOOigOOOCAKCoq0pQs0djYuGXmzJk/PvPMMyc2NDS4XgAAAPjQBMAAAJADjjzyyNY/+9nPrujbt++5EZGnI9mluro6Fi5cGPPnz4958+ZFZWWlprBXtGvXLg455JAYMGBA9O/fP1q39nsjWSj91ltv/fmqq676xaxZs6q1AwAA+KgEwAAAkEN++ctfjhgzZsyNrVq16q0b2SmdTsfKlStj0aJFsXDhwli8eHFs27ZNY9gtSkpKol+/ftG/f//Yf//9o1evXpGX53dEslVNTc3yRx999EdXXnnlK7oBAAB8XAJgAADIMd26dSt8+OGHPzd48ODL8vPzbdyzXCaTiTVr1sTChQtj0aJFsWjRotiyZYvG8LGUlZVF//79/xn6du/ePVKplMZkuaampprXXnvtV2PGjHmgoqKiUUcAAIBPQgAMAAA56rjjjiv7r//6r8tdC508mzdvjuXLl8eKFSti+fLlsXjx4qipqdEY/pfi4uLo169f9O7dO/bZZ5/Yd999o6ysTGMSJJPJpJcsWfLn66677pfTp0/3mx8AAMAuIQAGAIAc99Of/nTIueeee3NpaWlf3UimxsbGWLlyZSxdujSWLVsWy5cvj3Xr1kUmk9GcZiKVSkWXLl1in332iT59+kSfPn2iV69eUVBQoDkJtXXr1sUPPvjgj6699tq/6wYAALArCYABAKAZaNeuXf64cePOGTp06BUFBQWtdST56uvrY+XKlf88KbxixYpYu3ZtpNNpzUm4vLy86Nq1a+yzzz7//KdXr17RsmVLzckBjY2NW/7617/+4pxzznm0srKySUcAAIBdTQAMAADNyIknntjmnnvuuXzfffcdk0qlHB3MMdu3b481a9bEmjVrYu3atbF27dooLy+PDRs2CIazUF5eXnTs2DG6desWXbt2jW7dukW3bt2iR48eUVhYqEE5JpPJNC5ZsuRR1z0DAAC7mwAYAACaoa9+9av7Xnfdddd16NDhCN3IfY2Njf8MhNetWxfr1q2LioqKWLduXWzbtk2DdrPS0tLo3LnzP//p0qVLdO3aNbp27eoK52Ziw4YNM//rv/7rxz/60Y+W6wYAALC7CYABAKAZ++UvfznirLPOuq64uNj3gZupmpqaWL9+/T//qaioiMrKyqisrIxNmzZFY2OjJn2AgoKCaN++fbRr1y7at28fHTt2jC5dukSnTp2ic+fOUVxcrEnN1NatW98aP378PVdcccXLugEAAOwpAmAAAGjm2rVrl//ggw+eOWLEiCsLCwvb6gjvtHnz5n+GwZs2bYrKysqorq6OLVu2xJYtW6K6ujqqq6sjk8nk3NpTqVS0bt06WrduHWVlZdGmTZsoLS39X2Fvu3btok2bNh4U/peGhobKl1566efnnHPO+OrqavevAwAAe5QAGAAAiIiIoUOHFt97770XHHjggRfk5+c7ssiHlk6n/xkEV1dXR01Nzfv+k8lkora2NtLpdNTX10dTU1PU1dXt0u8U5+XlRcuWLSM/Pz+KiooiLy8vWrVqFalUKoqLi3f6T0lJSbRq1eqfgW9paWnk5eUZMB9aU1NTzYIFC/745S9/+Y+zZ8+u0REAAGBvEAADAAD/y2mnndb2rrvuurRPnz5n5+XlFeoIe9LbgfDbtm/f/r7XUBcUFESLFi3++b/fDnxhT8pkMg1LliwZd8stt/xq0qRJVToCAADsTQJgAABgp0477bS2d95554X777//5wTBAP9XJpNpWLhw4QO33nrrHwS/AABAtni/ADi/7UHRc2c/SG+LqC33/gcAAHLZokWL6u69995X0un0swcddFCnkpKS3roC8A8VFRUz/7//7/+77aKLLpq6aNGiOh0BAACyRXH3xsgr3fnPBMAAAEDMnDmz8u67736qqalpWr9+/Ypbt27dN5VKpXQGaG4ymUx6zZo1U+65555/Peeccx6cOXNmpa4AAADZRgAMAAB8KDNnzqz88Y9//Gw6nZ4uCAaak7eD37vvvvtfzz///McEvwAAQDYTAAMAAB+JIBhoLgS/AABAEgmAAQCAj+XtILisrOyFvn37diwuLu4VEYJgIBdkKioqnrv33nu/PWbMmEcEvwAAQJK8XwCc2vecGLGzHzSui9j4aivdAwAA/unqq6/u8ZWvfOX8Pn36nJWXl9dCR4CkSafT9UuXLh3/X//1Xw/84he/WKMjAABAEnUYVhsFXXb+MwEwAADwkZ1xxhntb7/99rMPPPDA8/Pz81vrCJDtmpqaqhcsWPDgd77znUcmTpzotC8AAJBoAmAAAGC3GD58eMkPf/jDzwwePPjioqKijjoCZJv6+voNr7322u9vvPHGx2fPnl2jIwAAQC4QAAMAALvV0KFDi++5556zDjnkkPOKioq66giwt9XV1a19/fXXH7z++uvHC34BAIBcIwAGAAD2iFatWuXdc889w0455ZTzO3bseJSOAHtYZsOGDbOmTJny4PXXX/9qbW1tWksAAIBcJAAGAAD2uH/913/tf/7555/dq1ev0/Ly8lroCLC7pNPp+pUrV05+4IEHHvnOd76zSEcAAIBcJwAGAAD2mjPOOKP97bfffvYBBxzw2YKCgjY6AuwqjY2NVW+++eafv/e97z06YcKETToCAAA0FwJgAABgrxs+fHjJ97///dGDBg0aU1paur+OAB9XdXX1wtdee+3Rr371q1Nfe+21Wh0BAACaGwEwAACQVb761a/ue8EFF3y6b9++ZxUUFLTWEeCDNDY2bnnrrbfG/+EPf5j4ox/9aLmOAAAAzZkAGAAAyEpDhw4t/sEPfnDy4MGDz27dunV/HQHerbq6+s2XX375weuuu+7ppUuXbtcRAAAAATAAAJDlCgsLU3ffffeQ0aNHn9G1a9fj8vLyinQFmq90Ol1XXl4+bcqUKROuvfbav+sIAADA/yYABgAAEqNPnz4t/v3f/33UyJEjz2rfvv2nIiKlK9AsZDZt2vTXF1544bGvfe1rzzntCwAA8N4EwAAAQCJddNFFXa6++uqTDzzwwLNbtmzZTUcg99TV1a1ZsGDBuJ/+9KdP3n///et0BAAA4IMJgAEAgETr1q1b4d13333k4YcffmqHDh2OyMvLK9QVSK50Ot2wcePGWbNmzZp8/fXXz6qoqGjUFQAAgA9PAAwAAOSMo48+uvWtt956/CGHHHJKu3btBkdEnq5AIqQrKytfmzdv3uQ777xz+owZM6q1BAAA4OMRAAMAADnpuOOOK/vGN75x/CGHHHJa27ZtB4bvBUO2yVRVVc2dN2/epO9///vTpk+fvkVLAAAAPjkBMAAAkPNuu+22vmedddZJffr0Oa5Vq1a9dQT2ntra2uXLly+f/uijjz51xx13vKUjAAAAu5YAGAAAaFa+9KUvdbv44ouP7t+//wlOBsMekamqqpq7cOHCv/z+97+fcd9995VrCQAAwO4jAAYAAJqtSy65pOtll112jDAYdrl0VVXVvIULF/7lV7/61bO/+93v1moJAADAniEABgAAiIirr766x/nnnz9q//33P7JNmzZDUqlUga7Ah5fJZBoqKyv/vnjx4uf+9Kc/zbr33ntX6woAAMCeJwAGAAB4l379+hV97WtfGzRy5MhRPXv2PLaoqKizrsD/VV9fv37VqlXPvPDCC8/9+7//+5zFixfX6woAAMDeJQAGAAB4H61bt8678847Bx599NFHde/efURpaen+4apomq/M1q1bF69Zs+bF5557btY3v/nNOdXV1WltAQAAyB4CYAAAgI9g8ODBrcaOHXvI8OHDD+vevfvw1q1bHxACYXJXprq6+s01a9a88sorr7z8k5/8ZN5rr71Wqy0AAADZSwAMAADwCVx//fX7nHHGGYf169dvePv27Yfm5+e31hWSrLGxsXrjxo2vvvXWWy+PHz/+lR//+McrdQUAACA5BMAAAAC70Je//OUe55xzzvA+ffoM7tix45CioqKuukI2q6+vX7t27doXFy9ePGfixImv3Xvvvat1BQAAILkEwAAAALvRl7/85R6f+cxnBvfr129Qly5dDm/ZsqVAmL2qrq5u7bp16wS+AAAAOUoADAAAsIe0atUq75prrtnn2GOPPXi//fY7uH379oeUlpb2TaVS+brDbpKuqalZtnHjxnlvvfXW3GeffXbef/3Xfy2vra1Naw0AAEBuEgADAADsRQceeGDLq6+++oAhQ4Yc3LNnz4Pbtm17sGuj+biampqqq6qqXi8vL583Z86ceb/85S/nvfjii1t1BgAAoPkQAAMAAGSZoUOHFn/xi1/cf9CgQQf26NHjwHbt2h3YqlWr3qlUKk932CFdU1OzvLKycsHq1asXzJkzZ8Gf//znJTNmzKjWGgAAgOZNAAwAAJAAxx13XNkFF1xw4MEHH3xA165dDywtLd23pKRkn1QqVag7uS2TyTRs27ZtRXV19dJ169YtfOONNxZOmDBh4YQJEzbpDgAAAO8mAAYAAEiw8847r+OJJ57Yp3///vt16dKlT5s2bfZr3bp1v/z8/GLdSZampqaa6urqxZs3b16ybt26pQsXLlzy9NNPL33ooYc26A4AAAAflgAYAAAgx7Rr1y7/kksu6TFkyJCe++67b89OnTr1Kisr61VcXNyzZcuW3VKpVL4u7R2ZTKaprq6uvKamZtWWLVtWVlRUrFy6dOnK2bNnr7r//vvXVFZWNukSAAAAn4QAGAAAoBnp1KlTwec+97luQ4cO7bnPPvv0aNeuXafWrVt3Li4u7tqyZcvORUVFnfLy8lro1MeTTqe319fXr6+rq6uoqalZW11dvb6ysnL9ihUrVr/66qurHnzwwbUVFRWNOgUAAMDuIgAGAADgfznjjDPaH3bYYZ369OnTuUuXLp3Kysral5SUtC0uLu5YVFTUrqioqG2LFi065OfnlzaXnjQ1NW3dvn37xvr6+qr6+vrKmpqaDdu2bavasmXLpnXr1lUsXbp0/Ysvvrh+4sSJlZ4gAAAA9iYBMAAAAB9Lr169CkeNGtXuoIMOatexY8ey9u3bl7Zp06Z1SUlJWXFxcetWrVq1btGiRVlRUVHrwsLC1hGRX1hYWBoR+QUFBSV5eXkFeXl5u/0/LtPpdG06nW5sbGzcFhFNDQ0NW3f83+r6+vrq7du3b6mtra2uqamp3rZtW/XmzZurN23aVL1hw4YtCxYsqJo1a1bl0qVLt5s4AAAASSAABgAAYK/q169fUffu3Vvss88+xSUlJQVv//8LCwtT3bp1+8BTxuXl5VsbGhoyb//vbdu2Na5YsaJmzZo12xcvXlyvwwAAADQn7xcAF2gPAAAAu9vixYvrdwS11boBAAAAu0+eFgAAAAAAAADkBgEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4o0AIAAAAAAACA5GhoLIyCxoaIiEilIpNXGE1v/0wADAAAAAAAAJAghQUN/0x6MxGppvT/5L6ugAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAIb/v5272ZHiusM4/FZ1NUkz9sQwOF4EyZJtpJCwysa5jSy4n1xPEqRIuQFvvfGSgIwBOzGRQAQERnx0d1UW0cgWGvKxsMGvnmfVdc7/1OJsf+oCAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoMY3JP//9K8My551lzpAk293a7QAAAAAAAAD8iIw3r+SL7TpPxuSt4/ibJJuz20QDBgAAAAAAAHhzrJPp6NvHYcyyjLl7dJTPbl/Jp6sPLufSsM+5ec7q5YOrF0OeP/SVaAAAAAAAAIA3weH7u6zfm79dWDIMSw6225w785vsx3XyzasOby5ssz69c4sAAAAAAAAAr9n69C6bC9sT93a7rKdnORin5Otxynzi1JQcfiwCAwAAAAAAALxO69O7HH68TaaT98cp85R8vbp3Nfszv8q0LHn7xMF1sjk/ZzUPmZ/MmWefhAYAAAAAAAD4oayPdjn7223Gn7x6ZrXPnetX8mBKkpv3cufDd/Pufn5FL56SzcVtNheT3dNt8tQlAwAAAAAAAHyv1sm0ySv/9XtsNWZ3I/lHkgzHi7/4XY7WYz5yiwAAAAAAAAA/Ivtcv/3nPEyS1fHa42t5+vNLyX7JoRsCAAAAAAAAePPt1/nbV3/KvePn1Xc371/NYxEYAAAAAAAA4M0yTHk2rvNo2WdzvHZqzN9v/SF3vju3evng/at5fPDLPDu1yuGyZHSVAAAAAAAAAK/XOGe4ueSvZ4e8M8xZbVe5ceuPufvy3Oqkw4+v5emDX+fuuTlLhhwsEYIBAAAAAAAAXpclGR8OuXP0TR4cPM/9z/+SRyfNDf/1TZezOp/87KdjzizJZkhO7edMy/w/nAUAAAAAAADg/zaMWcZkP8/ZLsmLacr2/MV8+cnvs/tP5/4FmLjAq1ifcioAAAAASUVORK5CYII=";function H0($,q,Q){if(typeof $==="string"&&!isNaN(Number($)))$=Number($);if(typeof $==="number"&&$<100)return v0($);if(typeof $==="number"&&$>=100)return $;if(typeof $==="string"&&$.includes("%")){if(q&&q==="X")return Math.round(parseFloat($)/100*Q.width);if(q&&q==="Y")return Math.round(parseFloat($)/100*Q.height);return Math.round(parseFloat($)/100*Q.width)}return 0}function k5($){return $.replace(/[xy]/g,function(q){let Q=Math.random()*16|0;return(q==="x"?Q:Q&3|8).toString(16)})}function k0($){if(typeof $>"u"||$==null)return"";return $.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function v0($){if(typeof $==="number"&&$>100)return $;if(typeof $==="string")$=Number($.replace(/in*/gi,""));return Math.round(L0*$)}function Y0($){let q=Number($)||0;return isNaN(q)?0:Math.round(q*w8)}function S1($){return $=$||0,Math.round(($>360?$-360:$)*60000)}function g7($){let q=$.toString(16);return q.length===1?"0"+q:q}function A7($,q,Q){return(g7($)+g7(q)+g7(Q)).toUpperCase()}function R0($,q){let Q=($||"").replace("#","");if(!j7.test(Q)&&Q!==G2.background1&&Q!==G2.background2&&Q!==G2.text1&&Q!==G2.text2&&Q!==G2.accent1&&Q!==G2.accent2&&Q!==G2.accent3&&Q!==G2.accent4&&Q!==G2.accent5&&Q!==G2.accent6)console.warn(`"${Q}" is not a valid scheme color or hex RGB! "${Q2}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`),Q=Q2;let K=j7.test(Q)?"srgbClr":"schemeClr",J='val="'+(j7.test(Q)?Q.toUpperCase():Q)+'"';return q?`${q}`:``}function AB($,q){let Q="",K=Object.assign(Object.assign({},q),$),J=Math.round(K.size*w8),Z=K.color,G=Math.round(K.opacity*1e5);return Q+=``,Q+=R0(Z,``),Q+="",Q}function B2($){let q="solid",Q="",K="",J="";if($){if(typeof $==="string")Q=$;else{if($.type)q=$.type;if($.color)Q=$.color;if($.alpha)K+=``;if($.transparency)K+=``}switch(q){case"solid":J+=`${R0(Q,K)}`;break;default:J+="";break}}return J}function a2($){return $._rels.length+$._relsChart.length+$._relsMedia.length+1}function b7($){if(!$||typeof $!=="object")return;if($.type!=="outer"&&$.type!=="inner"&&$.type!=="none")console.warn("Warning: shadow.type options are `outer`, `inner` or `none`."),$.type="outer";if($.angle){if(isNaN(Number($.angle))||$.angle<0||$.angle>359)console.warn("Warning: shadow.angle can only be 0-359"),$.angle=270;$.angle=Math.round(Number($.angle))}if($.opacity){if(isNaN(Number($.opacity))||$.opacity<0||$.opacity>1)console.warn("Warning: shadow.opacity can only be 0-1"),$.opacity=0.75;$.opacity=Number($.opacity)}if($.color){if($.color.startsWith("#"))console.warn('Warning: shadow.color should not include hash (#) character, , e.g. "FF0000"'),$.color=$.color.replace("#","")}return $}function XB($,q,Q){var K,J;let Z=2.3+(((K=$.options)===null||K===void 0?void 0:K.autoPageCharWeight)?$.options.autoPageCharWeight:0),G=Math.floor(q/w8*L0)/((((J=$.options)===null||J===void 0?void 0:J.fontSize)?$.options.fontSize:k2)/Z),W=[],B=[],V=[],U=[];if($.text&&$.text.toString().trim().length===0)B.push({_type:D0.tablecell,text:" "});else if(typeof $.text==="number"||typeof $.text==="string")B.push({_type:D0.tablecell,text:($.text||"").toString().trim()});else if(Array.isArray($.text))B=$.text;let w=[];return B.forEach((F)=>{var M;if(typeof F.text==="string"){if(F.text.split(` +`,"\t"],wW=["{","}","|","\\","^","`"].concat(MW),Y7=["'"].concat(wW),yK=["%","/","?",";","#"].concat(Y7),hK=["/","?","#"],xK=/^[+a-z0-9A-Z_-]{0,63}$/,YW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kW={javascript:!0,"javascript:":!0},k7={javascript:!0,"javascript:":!0},k6={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},D7={parse($){var q=decodeURIComponent;return($+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(Q,K,J){var Z=K.split("="),G=q(Z[0]||""),W=q(Z[1]||""),B=Q[G];return Q[G]=B===void 0?W:[].concat(B,W),Q},{})},stringify($){var q=encodeURIComponent;return Object.keys($||{}).reduce(function(Q,K){return[].concat($[K]).forEach(function(J){Q.push(q(K)+"="+q(J))}),Q},[]).join("&").replace(/\s/g,"+")}};Z2.prototype.parse=function($,q,Q){if(!H7($))throw TypeError("Parameter 'url' must be a string, not "+typeof $);var K=$.indexOf("?"),J=K!==-1&&K<$.indexOf("#")?"?":"#",Z=$.split(J),G=/\\/g;Z[0]=Z[0].replace(G,"/"),$=Z.join(J);var W=$;if(W=W.trim(),!Q&&$.split("#").length===1){var B=FW.exec(W);if(B){if(this.path=W,this.href=W,this.pathname=B[1],B[2])if(this.search=B[2],q)this.query=D7.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(q)this.search="",this.query={};return this}}var V=BW.exec(W);if(V){V=V[0];var U=V.toLowerCase();this.protocol=U,W=W.substr(V.length)}if(Q||V||W.match(/^\/\/[^@\/]+@[^@\/]+/)){var w=W.substr(0,2)==="//";if(w&&!(V&&k7[V]))W=W.substr(2),this.slashes=!0}if(!k7[V]&&(w||V&&!k6[V])){var F=-1;for(var M=0;M127)v+="x";else v+=H[j];if(!v.match(xK)){var d=z.slice(0,M),_=z.slice(M+1),X=H.match(YW);if(X)d.push(X[1]),_.unshift(X[2]);if(_.length)W="/"+_.join(".")+W;this.hostname=d.join(".");break}}}}if(this.hostname.length>NW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!D)this.hostname=new L7(`https://${this.hostname}`).hostname;var P=this.port?":"+this.port:"",g=this.hostname||"";if(this.host=g+P,this.href+=this.host,D){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),W[0]!=="/")W="/"+W}}if(!kW[U])for(var M=0,N=Y7.length;M0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(Q.search=$.search,Q.query=$.query,!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.href=Q.format(),Q}if(!z.length){if(Q.pathname=null,Q.search)Q.path="/"+Q.search;else Q.path=null;return Q.href=Q.format(),Q}var j=z.slice(-1)[0],n=(Q.host||$.host||z.length>1)&&(j==="."||j==="..")||j==="",d=0;for(var _=z.length;_>=0;_--)if(j=z[_],j===".")z.splice(_,1);else if(j==="..")z.splice(_,1),d++;else if(d)z.splice(_,1),d--;if(!L&&!D)for(;d--;d)z.unshift("..");if(L&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/"))z.unshift("");if(n&&z.join("/").substr(-1)!=="/")z.push("");var X=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){Q.hostname=Q.host=X?"":z.length?z.shift():"";var v=Q.host&&Q.host.indexOf("@")>0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(L=L||Q.host&&z.length,L&&!X)z.unshift("");if(!z.length)Q.pathname=null,Q.path=null;else Q.pathname=z.join("/");if(!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.auth=$.auth||Q.auth,Q.slashes=Q.slashes||$.slashes,Q.href=Q.format(),Q};Z2.prototype.parseHost=function(){var $=this.host,q=zW.exec($);if(q){if(q=q[0],q!==":")this.port=q.substr(1);$=$.substr(0,$.length-q.length)}if($)this.hostname=$};DW={parse:D6,resolve:uK,resolveObject:SK,format:TK,Url:Z2,URL:L7,URLSearchParams:OK}});var I7={};c1(I7,{request:()=>uW,globalAgent:()=>bW,get:()=>SW,default:()=>mW,STATUS_CODES:()=>nW,METHODS:()=>dW,IncomingMessage:()=>_W,ClientRequest:()=>EW,Agent:()=>cW});var LW,HW,EK,vW,fW,RW=($,q,Q)=>{Q=$!=null?LW(HW($)):{};let K=q||!$||!$.__esModule?EK(Q,"default",{value:$,enumerable:!0}):Q;for(let J of vW($))if(!fW.call(K,J))EK(K,J,{get:()=>$[J],enumerable:!0});return K},h0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),cK,IW,x1,CW,bK,O1,nK,jW,dK,L6,gW,_K,R7,AW,XW,mK,pK,yW,hW,iK,oK,xW,OW,PW,TW,aK,uW,SW,EW,_W,cW,bW,nW,dW,mW;var C7=b1(()=>{LW=Object.create,{getPrototypeOf:HW,defineProperty:EK,getOwnPropertyNames:vW}=Object,fW=Object.prototype.hasOwnProperty,cK=h0(($)=>{$.fetch=J(globalThis.fetch)&&J(globalThis.ReadableStream),$.writableStream=J(globalThis.WritableStream),$.abortController=J(globalThis.AbortController);var q;function Q(){if(q!==void 0)return q;if(globalThis.XMLHttpRequest){q=new globalThis.XMLHttpRequest;try{q.open("GET",globalThis.XDomainRequest?"/":"https://example.com")}catch(Z){q=null}}else q=null;return q}function K(Z){var G=Q();if(!G)return!1;try{return G.responseType=Z,G.responseType===Z}catch(W){}return!1}$.arraybuffer=$.fetch||K("arraybuffer"),$.msstream=!$.fetch&&K("ms-stream"),$.mozchunkedarraybuffer=!$.fetch&&K("moz-chunked-arraybuffer"),$.overrideMimeType=$.fetch||(Q()?J(Q().overrideMimeType):!1);function J(Z){return typeof Z==="function"}q=null}),IW=h0(($,q)=>{if(typeof Object.create==="function")q.exports=function(Q,K){if(K)Q.super_=K,Q.prototype=Object.create(K.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else q.exports=function(Q,K){if(K){Q.super_=K;var J=function(){};J.prototype=K.prototype,Q.prototype=new J,Q.prototype.constructor=Q}}}),x1=h0(($,q)=>{try{if(Q=(G8(),X0(Z8)),typeof Q.inherits!=="function")throw"";q.exports=Q.inherits}catch(K){q.exports=IW()}var Q}),CW=h0(($,q)=>{function Q(L,D){var z=Object.keys(L);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(L);D&&(N=N.filter(function(H){return Object.getOwnPropertyDescriptor(L,H).enumerable})),z.push.apply(z,N)}return z}function K(L){for(var D=1;D0)this.tail.next=z;else this.head=z;this.tail=z,++this.length}},{key:"unshift",value:function(D){var z={data:D,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var D=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,D}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(D){if(this.length===0)return"";var z=this.head,N=""+z.data;while(z=z.next)N+=D+z.data;return N}},{key:"concat",value:function(D){if(this.length===0)return w.alloc(0);var z=w.allocUnsafe(D>>>0),N=this.head,H=0;while(N)f(N.data,z,H),H+=N.data.length,N=N.next;return z}},{key:"consume",value:function(D,z){var N;if(Dv.length?v.length:D;if(j===v.length)H+=v;else H+=v.slice(0,D);if(D-=j,D===0){if(j===v.length)if(++N,z.next)this.head=z.next;else this.head=this.tail=null;else this.head=z,z.data=v.slice(j);break}++N}return this.length-=N,H}},{key:"_getBuffer",value:function(D){var z=w.allocUnsafe(D),N=this.head,H=1;N.data.copy(z),D-=N.data.length;while(N=N.next){var v=N.data,j=D>v.length?v.length:D;if(v.copy(z,z.length-D,0,j),D-=j,D===0){if(j===v.length)if(++H,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=v.slice(j);break}++H}return this.length-=H,z}},{key:k,value:function(D,z){return M(this,K(K({},z),{},{depth:0,customInspect:!1}))}}]),L}()}),bK=h0(($,q)=>{function Q(B,V){var U=this,w=this._readableState&&this._readableState.destroyed,F=this._writableState&&this._writableState.destroyed;if(w||F){if(V)V(B);else if(B){if(!this._writableState)process.nextTick(G,this,B);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,process.nextTick(G,this,B)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(B||null,function(M){if(!V&&M)if(!U._writableState)process.nextTick(K,U,M);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,process.nextTick(K,U,M);else process.nextTick(J,U);else if(V)process.nextTick(J,U),V(M);else process.nextTick(J,U)}),this}function K(B,V){G(B,V),J(B)}function J(B){if(B._writableState&&!B._writableState.emitClose)return;if(B._readableState&&!B._readableState.emitClose)return;B.emit("close")}function Z(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function G(B,V){B.emit("error",V)}function W(B,V){var{_readableState:U,_writableState:w}=B;if(U&&U.autoDestroy||w&&w.autoDestroy)B.destroy(V);else B.emit("error",V)}q.exports={destroy:Q,undestroy:Z,errorOrDestroy:W}}),O1=h0(($,q)=>{var Q={};function K(B,V,U){if(!U)U=Error;function w(M,k,f){if(typeof V==="string")return V;else return V(M,k,f)}class F extends U{constructor(M,k,f){super(w(M,k,f))}}F.prototype.name=U.name,F.prototype.code=B,Q[B]=F}function J(B,V){if(Array.isArray(B)){let U=B.length;if(B=B.map((w)=>String(w)),U>2)return`one of ${V} ${B.slice(0,U-1).join(", ")}, or `+B[U-1];else if(U===2)return`one of ${V} ${B[0]} or ${B[1]}`;else return`of ${V} ${B[0]}`}else return`of ${V} ${String(B)}`}function Z(B,V,U){return B.substr(!U||U<0?0:+U,V.length)===V}function G(B,V,U){if(U===void 0||U>B.length)U=B.length;return B.substring(U-V.length,U)===V}function W(B,V,U){if(typeof U!=="number")U=0;if(U+V.length>B.length)return!1;else return B.indexOf(V,U)!==-1}K("ERR_INVALID_OPT_VALUE",function(B,V){return'The value "'+V+'" is invalid for option "'+B+'"'},TypeError),K("ERR_INVALID_ARG_TYPE",function(B,V,U){let w;if(typeof V==="string"&&Z(V,"not "))w="must not be",V=V.replace(/^not /,"");else w="must be";let F;if(G(B," argument"))F=`The ${B} ${w} ${J(V,"type")}`;else{let M=W(B,".")?"property":"argument";F=`The "${B}" ${M} ${w} ${J(V,"type")}`}return F+=`. Received type ${typeof U}`,F},TypeError),K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),K("ERR_METHOD_NOT_IMPLEMENTED",function(B){return"The "+B+" method is not implemented"}),K("ERR_STREAM_PREMATURE_CLOSE","Premature close"),K("ERR_STREAM_DESTROYED",function(B){return"Cannot call "+B+" after a stream was destroyed"}),K("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),K("ERR_STREAM_WRITE_AFTER_END","write after end"),K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),K("ERR_UNKNOWN_ENCODING",function(B){return"Unknown encoding: "+B},TypeError),K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$.codes=Q}),nK=h0(($,q)=>{var Q=O1().codes.ERR_INVALID_OPT_VALUE;function K(Z,G,W){return Z.highWaterMark!=null?Z.highWaterMark:G?Z[W]:null}function J(Z,G,W,B){var V=K(G,B,W);if(V!=null){if(!(isFinite(V)&&Math.floor(V)===V)||V<0){var U=B?W:"highWaterMark";throw new Q(U,V)}return Math.floor(V)}return Z.objectMode?16:16384}q.exports={getHighWaterMark:J}}),jW=h0(($,q)=>{q.exports=(G8(),X0(Z8)).deprecate}),dK=h0(($,q)=>{q.exports=X;function Q(S){var b=this;this.next=null,this.entry=null,this.finish=function(){w0(b,S)}}var K;X.WritableState=d;var J={deprecate:jW()},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(S){return G.from(S)}function V(S){return G.isBuffer(S)||S instanceof W}var U=bK(),w=nK(),F=w.getHighWaterMark,M=O1().codes,k=M.ERR_INVALID_ARG_TYPE,f=M.ERR_METHOD_NOT_IMPLEMENTED,L=M.ERR_MULTIPLE_CALLBACK,D=M.ERR_STREAM_CANNOT_PIPE,z=M.ERR_STREAM_DESTROYED,N=M.ERR_STREAM_NULL_VALUES,H=M.ERR_STREAM_WRITE_AFTER_END,v=M.ERR_UNKNOWN_ENCODING,j=U.errorOrDestroy;x1()(X,Z);function n(){}function d(S,b,O){if(K=K||L6(),S=S||{},typeof O!=="boolean")O=b instanceof K;if(this.objectMode=!!S.objectMode,O)this.objectMode=this.objectMode||!!S.writableObjectMode;this.highWaterMark=F(this,S,"writableHighWaterMark",O),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var E=S.decodeStrings===!1;this.decodeStrings=!E,this.defaultEncoding=S.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){Z0(b,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=S.emitClose!==!1,this.autoDestroy=!!S.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Q(this)}d.prototype.getBuffer=function(){var S=this.bufferedRequest,b=[];while(S)b.push(S),S=S.next;return b},function(){try{Object.defineProperty(d.prototype,"buffer",{get:J.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(S){}}();var _;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")_=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(S){if(_.call(this,S))return!0;if(this!==X)return!1;return S&&S._writableState instanceof d}});else _=function(S){return S instanceof this};function X(S){K=K||L6();var b=this instanceof K;if(!b&&!_.call(X,this))return new X(S);if(this._writableState=new d(S,this,b),this.writable=!0,S){if(typeof S.write==="function")this._write=S.write;if(typeof S.writev==="function")this._writev=S.writev;if(typeof S.destroy==="function")this._destroy=S.destroy;if(typeof S.final==="function")this._final=S.final}Z.call(this)}X.prototype.pipe=function(){j(this,new D)};function P(S,b){var O=new H;j(S,O),process.nextTick(b,O)}function g(S,b,O,E){var a;if(O===null)a=new N;else if(typeof O!=="string"&&!b.objectMode)a=new k("chunk",["string","Buffer"],O);if(a)return j(S,a),process.nextTick(E,a),!1;return!0}X.prototype.write=function(S,b,O){var E=this._writableState,a=!1,K0=!E.objectMode&&V(S);if(K0&&!G.isBuffer(S))S=B(S);if(typeof b==="function")O=b,b=null;if(K0)b="buffer";else if(!b)b=E.defaultEncoding;if(typeof O!=="function")O=n;if(E.ending)P(this,O);else if(K0||g(this,E,S,O))E.pendingcb++,a=h(this,E,K0,S,b,O);return a},X.prototype.cork=function(){this._writableState.corked++},X.prototype.uncork=function(){var S=this._writableState;if(S.corked){if(S.corked--,!S.writing&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest)W0(this,S)}},X.prototype.setDefaultEncoding=function(S){if(typeof S==="string")S=S.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((S+"").toLowerCase())>-1))throw new v(S);return this._writableState.defaultEncoding=S,this},Object.defineProperty(X.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function c(S,b,O){if(!S.objectMode&&S.decodeStrings!==!1&&typeof b==="string")b=G.from(b,O);return b}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function h(S,b,O,E,a,K0){if(!O){var R=c(b,E,a);if(E!==R)O=!0,a="buffer",E=R}var Y=b.objectMode?1:E.length;b.length+=Y;var C=b.length{var Q=Object.keys||function(w){var F=[];for(var M in w)F.push(M);return F};q.exports=B;var K=mK(),J=dK();x1()(B,K);{Z=Q(J.prototype);for(W=0;W{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),_K=h0(($)=>{var q=gW().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),R7=h0(($,q)=>{var Q=O1().codes.ERR_STREAM_PREMATURE_CLOSE;function K(W){var B=!1;return function(){if(B)return;B=!0;for(var V=arguments.length,U=Array(V),w=0;w{var Q;function K(v,j,n){if(j=J(j),j in v)Object.defineProperty(v,j,{value:n,enumerable:!0,configurable:!0,writable:!0});else v[j]=n;return v}function J(v){var j=Z(v,"string");return typeof j==="symbol"?j:String(j)}function Z(v,j){if(typeof v!=="object"||v===null)return v;var n=v[Symbol.toPrimitive];if(n!==void 0){var d=n.call(v,j||"default");if(typeof d!=="object")return d;throw TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(v)}var G=R7(),W=Symbol("lastResolve"),B=Symbol("lastReject"),V=Symbol("error"),U=Symbol("ended"),w=Symbol("lastPromise"),F=Symbol("handlePromise"),M=Symbol("stream");function k(v,j){return{value:v,done:j}}function f(v){var j=v[W];if(j!==null){var n=v[M].read();if(n!==null)v[w]=null,v[W]=null,v[B]=null,j(k(n,!1))}}function L(v){process.nextTick(f,v)}function D(v,j){return function(n,d){v.then(function(){if(j[U]){n(k(void 0,!0));return}j[F](n,d)},d)}}var z=Object.getPrototypeOf(function(){}),N=Object.setPrototypeOf((Q={get stream(){return this[M]},next:function(){var v=this,j=this[V];if(j!==null)return Promise.reject(j);if(this[U])return Promise.resolve(k(void 0,!0));if(this[M].destroyed)return new Promise(function(X,P){process.nextTick(function(){if(v[V])P(v[V]);else X(k(void 0,!0))})});var n=this[w],d;if(n)d=new Promise(D(n,this));else{var _=this[M].read();if(_!==null)return Promise.resolve(k(_,!1));d=new Promise(this[F])}return this[w]=d,d}},K(Q,Symbol.asyncIterator,function(){return this}),K(Q,"return",function(){var v=this;return new Promise(function(j,n){v[M].destroy(null,function(d){if(d){n(d);return}j(k(void 0,!0))})})}),Q),z),H=function(v){var j,n=Object.create(N,(j={},K(j,M,{value:v,writable:!0}),K(j,W,{value:null,writable:!0}),K(j,B,{value:null,writable:!0}),K(j,V,{value:null,writable:!0}),K(j,U,{value:v._readableState.endEmitted,writable:!0}),K(j,F,{value:function(d,_){var X=n[M].read();if(X)n[w]=null,n[W]=null,n[B]=null,d(k(X,!1));else n[W]=d,n[B]=_},writable:!0}),j));return n[w]=null,G(v,function(d){if(d&&d.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=n[B];if(_!==null)n[w]=null,n[W]=null,n[B]=null,_(d);n[V]=d;return}var X=n[W];if(X!==null)n[w]=null,n[W]=null,n[B]=null,X(k(void 0,!0));n[U]=!0}),v.on("readable",L.bind(null,n)),n};q.exports=H}),XW=h0(($,q)=>{function Q(w,F,M,k,f,L,D){try{var z=w[L](D),N=z.value}catch(H){M(H);return}if(z.done)F(N);else Promise.resolve(N).then(k,f)}function K(w){return function(){var F=this,M=arguments;return new Promise(function(k,f){var L=w.apply(F,M);function D(N){Q(L,k,f,D,z,"next",N)}function z(N){Q(L,k,f,D,z,"throw",N)}D(void 0)})}}function J(w,F){var M=Object.keys(w);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(w);F&&(k=k.filter(function(f){return Object.getOwnPropertyDescriptor(w,f).enumerable})),M.push.apply(M,k)}return M}function Z(w){for(var F=1;F{q.exports=g;var Q;g.ReadableState=P;var K=(i1(),X0(p1)).EventEmitter,J=function(R,Y){return R.listeners(Y).length},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(R){return G.from(R)}function V(R){return G.isBuffer(R)||R instanceof W}var U=(G8(),X0(Z8)),w;if(U&&U.debuglog)w=U.debuglog("stream");else w=function(){};var F=CW(),M=bK(),k=nK(),f=k.getHighWaterMark,L=O1().codes,D=L.ERR_INVALID_ARG_TYPE,z=L.ERR_STREAM_PUSH_AFTER_EOF,N=L.ERR_METHOD_NOT_IMPLEMENTED,H=L.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,j,n;x1()(g,Z);var d=M.errorOrDestroy,_=["error","close","destroy","pause","resume"];function X(R,Y,C){if(typeof R.prependListener==="function")return R.prependListener(Y,C);if(!R._events||!R._events[Y])R.on(Y,C);else if(Array.isArray(R._events[Y]))R._events[Y].unshift(C);else R._events[Y]=[C,R._events[Y]]}function P(R,Y,C){if(Q=Q||L6(),R=R||{},typeof C!=="boolean")C=Y instanceof Q;if(this.objectMode=!!R.objectMode,C)this.objectMode=this.objectMode||!!R.readableObjectMode;if(this.highWaterMark=f(this,R,"readableHighWaterMark",C),this.buffer=new F,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.destroyed=!1,this.defaultEncoding=R.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,R.encoding){if(!v)v=_K().StringDecoder;this.decoder=new v(R.encoding),this.encoding=R.encoding}}function g(R){if(Q=Q||L6(),!(this instanceof g))return new g(R);var Y=this instanceof Q;if(this._readableState=new P(R,this,Y),this.readable=!0,R){if(typeof R.read==="function")this._read=R.read;if(typeof R.destroy==="function")this._destroy=R.destroy}Z.call(this)}Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(R){if(!this._readableState)return;this._readableState.destroyed=R}}),g.prototype.destroy=M.destroy,g.prototype._undestroy=M.undestroy,g.prototype._destroy=function(R,Y){Y(R)},g.prototype.push=function(R,Y){var C=this._readableState,u;if(!C.objectMode){if(typeof R==="string"){if(Y=Y||C.defaultEncoding,Y!==C.encoding)R=G.from(R,Y),Y="";u=!0}}else u=!0;return c(this,R,Y,!1,u)},g.prototype.unshift=function(R){return c(this,R,null,!0,!1)};function c(R,Y,C,u,e){w("readableAddChunk",Y);var r=R._readableState;if(Y===null)r.reading=!1,F0(R,r);else{var s;if(!e)s=x(r,Y);if(s)d(R,s);else if(r.objectMode||Y&&Y.length>0){if(typeof Y!=="string"&&!r.objectMode&&Object.getPrototypeOf(Y)!==G.prototype)Y=B(Y);if(u)if(r.endEmitted)d(R,new H);else h(R,r,Y,!0);else if(r.ended)d(R,new z);else if(r.destroyed)return!1;else if(r.reading=!1,r.decoder&&!C)if(Y=r.decoder.write(Y),r.objectMode||Y.length!==0)h(R,r,Y,!1);else y(R,r);else h(R,r,Y,!1)}else if(!u)r.reading=!1,y(R,r)}return!r.ended&&(r.length=l)R=l;else R--,R|=R>>>1,R|=R>>>2,R|=R>>>4,R|=R>>>8,R|=R>>>16,R++;return R}function Z0(R,Y){if(R<=0||Y.length===0&&Y.ended)return 0;if(Y.objectMode)return 1;if(R!==R)if(Y.flowing&&Y.length)return Y.buffer.head.data.length;else return Y.length;if(R>Y.highWaterMark)Y.highWaterMark=$0(R);if(R<=Y.length)return R;if(!Y.ended)return Y.needReadable=!0,0;return Y.length}g.prototype.read=function(R){w("read",R),R=parseInt(R,10);var Y=this._readableState,C=R;if(R!==0)Y.emittedReadable=!1;if(R===0&&Y.needReadable&&((Y.highWaterMark!==0?Y.length>=Y.highWaterMark:Y.length>0)||Y.ended)){if(w("read: emitReadable",Y.length,Y.ended),Y.length===0&&Y.ended)E(this);else p(this);return null}if(R=Z0(R,Y),R===0&&Y.ended){if(Y.length===0)E(this);return null}var u=Y.needReadable;if(w("need readable",u),Y.length===0||Y.length-R0)e=O(R,Y);else e=null;if(e===null)Y.needReadable=Y.length<=Y.highWaterMark,R=0;else Y.length-=R,Y.awaitDrain=0;if(Y.length===0){if(!Y.ended)Y.needReadable=!0;if(C!==R&&Y.ended)E(this)}if(e!==null)this.emit("data",e);return e};function F0(R,Y){if(w("onEofChunk"),Y.ended)return;if(Y.decoder){var C=Y.decoder.end();if(C&&C.length)Y.buffer.push(C),Y.length+=Y.objectMode?1:C.length}if(Y.ended=!0,Y.sync)p(R);else if(Y.needReadable=!1,!Y.emittedReadable)Y.emittedReadable=!0,W0(R)}function p(R){var Y=R._readableState;if(w("emitReadable",Y.needReadable,Y.emittedReadable),Y.needReadable=!1,!Y.emittedReadable)w("emitReadable",Y.flowing),Y.emittedReadable=!0,process.nextTick(W0,R)}function W0(R){var Y=R._readableState;if(w("emitReadable_",Y.destroyed,Y.length,Y.ended),!Y.destroyed&&(Y.length||Y.ended))R.emit("readable"),Y.emittedReadable=!1;Y.needReadable=!Y.flowing&&!Y.ended&&Y.length<=Y.highWaterMark,b(R)}function y(R,Y){if(!Y.readingMore)Y.readingMore=!0,process.nextTick(i,R,Y)}function i(R,Y){while(!Y.reading&&!Y.ended&&(Y.length1&&K0(u.pipes,R)!==-1)&&!G0)w("false write response, pause",u.awaitDrain),u.awaitDrain++;C.pause()}}function I0(O0){if(w("onerror",O0),q2(),R.removeListener("error",I0),J(R,"error")===0)d(R,O0)}X(R,"error",I0);function m0(){R.removeListener("finish",p0),q2()}R.once("close",m0);function p0(){w("onfinish"),R.removeListener("close",m0),q2()}R.once("finish",p0);function q2(){w("unpipe"),C.unpipe(R)}if(R.emit("pipe",C),!u.flowing)w("pipe resume"),C.resume();return R};function U0(R){return function(){var Y=R._readableState;if(w("pipeOnDrain",Y.awaitDrain),Y.awaitDrain)Y.awaitDrain--;if(Y.awaitDrain===0&&J(R,"data"))Y.flowing=!0,b(R)}}g.prototype.unpipe=function(R){var Y=this._readableState,C={hasUnpiped:!1};if(Y.pipesCount===0)return this;if(Y.pipesCount===1){if(R&&R!==Y.pipes)return this;if(!R)R=Y.pipes;if(Y.pipes=null,Y.pipesCount=0,Y.flowing=!1,R)R.emit("unpipe",this,C);return this}if(!R){var{pipes:u,pipesCount:e}=Y;Y.pipes=null,Y.pipesCount=0,Y.flowing=!1;for(var r=0;r0,u.flowing!==!1)this.resume()}else if(R==="readable"){if(!u.endEmitted&&!u.readableListening){if(u.readableListening=u.needReadable=!0,u.flowing=!1,u.emittedReadable=!1,w("on readable",u.length,u.reading),u.length)p(this);else if(!u.reading)process.nextTick(V0,this)}}return C},g.prototype.addListener=g.prototype.on,g.prototype.removeListener=function(R,Y){var C=Z.prototype.removeListener.call(this,R,Y);if(R==="readable")process.nextTick(m,this);return C},g.prototype.removeAllListeners=function(R){var Y=Z.prototype.removeAllListeners.apply(this,arguments);if(R==="readable"||R===void 0)process.nextTick(m,this);return Y};function m(R){var Y=R._readableState;if(Y.readableListening=R.listenerCount("readable")>0,Y.resumeScheduled&&!Y.paused)Y.flowing=!0;else if(R.listenerCount("data")>0)R.resume()}function V0(R){w("readable nexttick read 0"),R.read(0)}g.prototype.resume=function(){var R=this._readableState;if(!R.flowing)w("resume"),R.flowing=!R.readableListening,w0(this,R);return R.paused=!1,this};function w0(R,Y){if(!Y.resumeScheduled)Y.resumeScheduled=!0,process.nextTick(S,R,Y)}function S(R,Y){if(w("resume",Y.reading),!Y.reading)R.read(0);if(Y.resumeScheduled=!1,R.emit("resume"),b(R),Y.flowing&&!Y.reading)R.read(0)}g.prototype.pause=function(){if(w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)w("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function b(R){var Y=R._readableState;w("flow",Y.flowing);while(Y.flowing&&R.read()!==null);}if(g.prototype.wrap=function(R){var Y=this,C=this._readableState,u=!1;R.on("end",function(){if(w("wrapped end"),C.decoder&&!C.ended){var s=C.decoder.end();if(s&&s.length)Y.push(s)}Y.push(null)}),R.on("data",function(s){if(w("wrapped data"),C.decoder)s=C.decoder.write(s);if(C.objectMode&&(s===null||s===void 0))return;else if(!C.objectMode&&(!s||!s.length))return;var T=Y.push(s);if(!T)u=!0,R.pause()});for(var e in R)if(this[e]===void 0&&typeof R[e]==="function")this[e]=function(s){return function(){return R[s].apply(R,arguments)}}(e);for(var r=0;r<_.length;r++)R.on(_[r],this.emit.bind(this,_[r]));return this._read=function(s){if(w("wrapped _read",s),u)u=!1,R.resume()},this},typeof Symbol==="function")g.prototype[Symbol.asyncIterator]=function(){if(j===void 0)j=AW();return j(this)};Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(g.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(g.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){if(this._readableState)this._readableState.flowing=R}}),g._fromList=O,Object.defineProperty(g.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function O(R,Y){if(Y.length===0)return null;var C;if(Y.objectMode)C=Y.buffer.shift();else if(!R||R>=Y.length){if(Y.decoder)C=Y.buffer.join("");else if(Y.buffer.length===1)C=Y.buffer.first();else C=Y.buffer.concat(Y.length);Y.buffer.clear()}else C=Y.buffer.consume(R,Y.decoder);return C}function E(R){var Y=R._readableState;if(w("endReadable",Y.endEmitted),!Y.endEmitted)Y.ended=!0,process.nextTick(a,Y,R)}function a(R,Y){if(w("endReadableNT",R.endEmitted,R.length),!R.endEmitted&&R.length===0){if(R.endEmitted=!0,Y.readable=!1,Y.emit("end"),R.autoDestroy){var C=Y._writableState;if(!C||C.autoDestroy&&C.finished)Y.destroy()}}}if(typeof Symbol==="function")g.from=function(R,Y){if(n===void 0)n=XW();return n(g,R,Y)};function K0(R,Y){for(var C=0,u=R.length;C{q.exports=V;var Q=O1().codes,K=Q.ERR_METHOD_NOT_IMPLEMENTED,J=Q.ERR_MULTIPLE_CALLBACK,Z=Q.ERR_TRANSFORM_ALREADY_TRANSFORMING,G=Q.ERR_TRANSFORM_WITH_LENGTH_0,W=L6();x1()(V,W);function B(F,M){var k=this._transformState;k.transforming=!1;var f=k.writecb;if(f===null)return this.emit("error",new J);if(k.writechunk=null,k.writecb=null,M!=null)this.push(M);f(F);var L=this._readableState;if(L.reading=!1,L.needReadable||L.length{q.exports=K;var Q=pK();x1()(K,Q);function K(J){if(!(this instanceof K))return new K(J);Q.call(this,J)}K.prototype._transform=function(J,Z,G){G(null,J)}}),hW=h0(($,q)=>{var Q;function K(k){var f=!1;return function(){if(f)return;f=!0,k.apply(void 0,arguments)}}var J=O1().codes,Z=J.ERR_MISSING_ARGS,G=J.ERR_STREAM_DESTROYED;function W(k){if(k)throw k}function B(k){return k.setHeader&&typeof k.abort==="function"}function V(k,f,L,D){D=K(D);var z=!1;if(k.on("close",function(){z=!0}),Q===void 0)Q=R7();Q(k,{readable:f,writable:L},function(H){if(H)return D(H);z=!0,D()});var N=!1;return function(H){if(z)return;if(N)return;if(N=!0,B(k))return k.abort();if(typeof k.destroy==="function")return k.destroy();D(H||new G("pipe"))}}function U(k){k()}function w(k,f){return k.pipe(f)}function F(k){if(!k.length)return W;if(typeof k[k.length-1]!=="function")return W;return k.pop()}function M(){for(var k=arguments.length,f=Array(k),L=0;L0;return V(H,j,n,function(d){if(!z)z=d;if(d)N.forEach(U);if(j)return;N.forEach(U),D(z)})});return f.reduce(w)}q.exports=M}),iK=h0(($,q)=>{var Q=a1();$=q.exports=mK(),$.Stream=Q||$,$.Readable=$,$.Writable=dK(),$.Duplex=L6(),$.Transform=pK(),$.PassThrough=yW(),$.finished=R7(),$.pipeline=hW()}),oK=h0(($)=>{var q=cK(),Q=x1(),K=iK(),J=$.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Z=$.IncomingMessage=function(G,W,B,V){var U=this;if(K.Readable.call(U),U._mode=B,U.headers={},U.rawHeaders=[],U.trailers={},U.rawTrailers=[],U.on("end",function(){process.nextTick(function(){U.emit("close")})}),B==="fetch"){let D=function(){M.read().then(function(z){if(U._destroyed)return;if(V(z.done),z.done){U.push(null);return}U.push(Buffer.from(z.value)),D()}).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)})};var w=D;if(U._fetchResponse=W,U.url=W.url,U.statusCode=W.status,U.statusMessage=W.statusText,W.headers.forEach(function(z,N){U.headers[N.toLowerCase()]=z,U.rawHeaders.push(N,z)}),q.writableStream){var F=new WritableStream({write:function(z){return V(!1),new Promise(function(N,H){if(U._destroyed)H();else if(U.push(Buffer.from(z)))N();else U._resumeFetch=N})},close:function(){if(V(!0),!U._destroyed)U.push(null)},abort:function(z){if(V(!0),!U._destroyed)U.emit("error",z)}});try{W.body.pipeTo(F).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)});return}catch(z){}}var M=W.body.getReader();D()}else{U._xhr=G,U._pos=0,U.url=G.responseURL,U.statusCode=G.status,U.statusMessage=G.statusText;var k=G.getAllResponseHeaders().split(/\r?\n/);if(k.forEach(function(D){var z=D.match(/^([^:]+):\s*(.*)/);if(z){var N=z[1].toLowerCase();if(N==="set-cookie"){if(U.headers[N]===void 0)U.headers[N]=[];U.headers[N].push(z[2])}else if(U.headers[N]!==void 0)U.headers[N]+=", "+z[2];else U.headers[N]=z[2];U.rawHeaders.push(z[1],z[2])}}),U._charset="x-user-defined",!q.overrideMimeType){var f=U.rawHeaders["mime-type"];if(f){var L=f.match(/;\s*charset=([^;])(;|$)/);if(L)U._charset=L[1].toLowerCase()}if(!U._charset)U._charset="utf-8"}}};Q(Z,K.Readable),Z.prototype._read=function(){var G=this,W=G._resumeFetch;if(W)G._resumeFetch=null,W()},Z.prototype._onXHRProgress=function(G){var W=this,B=W._xhr,V=null;switch(W._mode){case"text":if(V=B.responseText,V.length>W._pos){var U=V.substr(W._pos);if(W._charset==="x-user-defined"){var w=Buffer.alloc(U.length);for(var F=0;FW._pos)W.push(Buffer.from(new Uint8Array(M.result.slice(W._pos)))),W._pos=M.result.byteLength},M.onload=function(){G(!0),W.push(null)},M.readAsArrayBuffer(V);break}if(W._xhr.readyState===J.DONE&&W._mode!=="ms-stream")G(!0),W.push(null)}}),xW=h0(($,q)=>{var Q=cK(),K=x1(),J=oK(),Z=iK(),G=J.IncomingMessage,W=J.readyStates;function B(F,M){if(Q.fetch&&M)return"fetch";else if(Q.mozchunkedarraybuffer)return"moz-chunked-arraybuffer";else if(Q.msstream)return"ms-stream";else if(Q.arraybuffer&&F)return"arraybuffer";else return"text"}var V=q.exports=function(F){var M=this;if(Z.Writable.call(M),M._opts=F,M._body=[],M._headers={},F.auth)M.setHeader("Authorization","Basic "+Buffer.from(F.auth).toString("base64"));Object.keys(F.headers).forEach(function(L){M.setHeader(L,F.headers[L])});var k,f=!0;if(F.mode==="disable-fetch"||"requestTimeout"in F&&!Q.abortController)f=!1,k=!0;else if(F.mode==="prefer-streaming")k=!1;else if(F.mode==="allow-wrong-content-type")k=!Q.overrideMimeType;else if(!F.mode||F.mode==="default"||F.mode==="prefer-fast")k=!0;else throw Error("Invalid value for opts.mode");M._mode=B(k,f),M._fetchTimer=null,M._socketTimeout=null,M._socketTimer=null,M.on("finish",function(){M._onFinish()})};K(V,Z.Writable),V.prototype.setHeader=function(F,M){var k=this,f=F.toLowerCase();if(w.indexOf(f)!==-1)return;k._headers[f]={name:F,value:M}},V.prototype.getHeader=function(F){var M=this._headers[F.toLowerCase()];if(M)return M.value;return null},V.prototype.removeHeader=function(F){var M=this;delete M._headers[F.toLowerCase()]},V.prototype._onFinish=function(){var F=this;if(F._destroyed)return;var M=F._opts;if("timeout"in M&&M.timeout!==0)F.setTimeout(M.timeout);var k=F._headers,f=null;if(M.method!=="GET"&&M.method!=="HEAD")f=new Blob(F._body,{type:(k["content-type"]||{}).value||""});var L=[];if(Object.keys(k).forEach(function(H){var v=k[H].name,j=k[H].value;if(Array.isArray(j))j.forEach(function(n){L.push([v,n])});else L.push([v,j])}),F._mode==="fetch"){var D=null;if(Q.abortController){var z=new AbortController;if(D=z.signal,F._fetchAbortController=z,"requestTimeout"in M&&M.requestTimeout!==0)F._fetchTimer=globalThis.setTimeout(function(){if(F.emit("requestTimeout"),F._fetchAbortController)F._fetchAbortController.abort()},M.requestTimeout)}globalThis.fetch(F._opts.url,{method:F._opts.method,headers:L,body:f||void 0,mode:"cors",credentials:M.withCredentials?"include":"same-origin",signal:D}).then(function(H){F._fetchResponse=H,F._resetTimers(!1),F._connect()},function(H){if(F._resetTimers(!0),!F._destroyed)F.emit("error",H)})}else{var N=F._xhr=new globalThis.XMLHttpRequest;try{N.open(F._opts.method,F._opts.url,!0)}catch(H){process.nextTick(function(){F.emit("error",H)});return}if("responseType"in N)N.responseType=F._mode;if("withCredentials"in N)N.withCredentials=!!M.withCredentials;if(F._mode==="text"&&"overrideMimeType"in N)N.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in M)N.timeout=M.requestTimeout,N.ontimeout=function(){F.emit("requestTimeout")};if(L.forEach(function(H){N.setRequestHeader(H[0],H[1])}),F._response=null,N.onreadystatechange=function(){switch(N.readyState){case W.LOADING:case W.DONE:F._onXHRProgress();break}},F._mode==="moz-chunked-arraybuffer")N.onprogress=function(){F._onXHRProgress()};N.onerror=function(){if(F._destroyed)return;F._resetTimers(!0),F.emit("error",Error("XHR error"))};try{N.send(f)}catch(H){process.nextTick(function(){F.emit("error",H)});return}}};function U(F){try{var M=F.status;return M!==null&&M!==0}catch(k){return!1}}V.prototype._onXHRProgress=function(){var F=this;if(F._resetTimers(!1),!U(F._xhr)||F._destroyed)return;if(!F._response)F._connect();F._response._onXHRProgress(F._resetTimers.bind(F))},V.prototype._connect=function(){var F=this;if(F._destroyed)return;F._response=new G(F._xhr,F._fetchResponse,F._mode,F._resetTimers.bind(F)),F._response.on("error",function(M){F.emit("error",M)}),F.emit("response",F._response)},V.prototype._write=function(F,M,k){var f=this;f._body.push(F),k()},V.prototype._resetTimers=function(F){var M=this;if(globalThis.clearTimeout(M._socketTimer),M._socketTimer=null,F)globalThis.clearTimeout(M._fetchTimer),M._fetchTimer=null;else if(M._socketTimeout)M._socketTimer=globalThis.setTimeout(function(){M.emit("timeout")},M._socketTimeout)},V.prototype.abort=V.prototype.destroy=function(F){var M=this;if(M._destroyed=!0,M._resetTimers(!0),M._response)M._response._destroyed=!0;if(M._xhr)M._xhr.abort();else if(M._fetchAbortController)M._fetchAbortController.abort();if(F)M.emit("error",F)},V.prototype.end=function(F,M,k){var f=this;if(typeof F==="function")k=F,F=void 0;Z.Writable.prototype.end.call(f,F,M,k)},V.prototype.setTimeout=function(F,M){var k=this;if(M)k.once("timeout",M);k._socketTimeout=F,k._resetTimers(!1)},V.prototype.flushHeaders=function(){},V.prototype.setNoDelay=function(){},V.prototype.setSocketKeepAlive=function(){};var w=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}),OW=h0(($,q)=>{q.exports=K;var Q=Object.prototype.hasOwnProperty;function K(){var J={};for(var Z=0;Z{q.exports=(C7(),X0(I7)).STATUS_CODES}),TW=h0(($)=>{var q=xW(),Q=oK(),K=OW(),J=PW(),Z=(f7(),X0(v7)),G=$;G.request=function(W,B){if(typeof W==="string")W=Z.parse(W);else W=K(W);var V=globalThis.location.protocol.search(/^https?:$/)===-1?"http:":"",U=W.protocol||V,w=W.hostname||W.host,F=W.port,M=W.path||"/";if(w&&w.indexOf(":")!==-1)w="["+w+"]";W.url=(w?U+"//"+w:"")+(F?":"+F:"")+M,W.method=(W.method||"GET").toUpperCase(),W.headers=W.headers||{};var k=new q(W);if(B)k.on("response",B);return k},G.get=function(W,B){var V=G.request(W,B);return V.end(),V},G.ClientRequest=q,G.IncomingMessage=Q.IncomingMessage,G.Agent=function(){},G.Agent.defaultMaxSockets=4,G.globalAgent=new G.Agent,G.STATUS_CODES=J,G.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}),aK=RW(TW(),1),{request:uW,get:SW,ClientRequest:EW,IncomingMessage:_W,Agent:cW,globalAgent:bW,STATUS_CODES:nW,METHODS:dW}=aK.default,mW=aK.default});var sK={};c1(sK,{validateHeaderValue:()=>MB,validateHeaderName:()=>FB,setMaxIdleHTTPParsers:()=>zB,request:()=>BB,maxHeaderSize:()=>WB,globalAgent:()=>GB,get:()=>ZB,default:()=>wB,createServer:()=>UB,ServerResponse:()=>VB,Server:()=>JB,STATUS_CODES:()=>KB,OutgoingMessage:()=>qB,METHODS:()=>QB,IncomingMessage:()=>$B,ClientRequest:()=>eW,Agent:()=>tW});var pW,iW,lK,oW,aW,lW=($,q,Q)=>{Q=$!=null?pW(iW($)):{};let K=q||!$||!$.__esModule?lK(Q,"default",{value:$,enumerable:!0}):Q;for(let J of oW($))if(!aW.call(K,J))lK(K,J,{get:()=>$[J],enumerable:!0});return K},rW=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),sW,rK,tW,eW,$B,QB,qB,KB,JB,VB,UB,ZB,GB,WB,BB,zB,FB,MB,wB;var tK=b1(()=>{pW=Object.create,{getPrototypeOf:iW,defineProperty:lK,getOwnPropertyNames:oW}=Object,aW=Object.prototype.hasOwnProperty,sW=rW(($,q)=>{var Q=(C7(),X0(I7)),K=(f7(),X0(v7)),J=$;for(Z in Q)if(Q.hasOwnProperty(Z))J[Z]=Q[Z];var Z;J.request=function(W,B){return W=G(W),Q.request.call(this,W,B)},J.get=function(W,B){return W=G(W),Q.get.call(this,W,B)};function G(W){if(typeof W==="string")W=K.parse(W);if(!W.protocol)W.protocol="https:";if(W.protocol!=="https:")throw Error('Protocol "'+W.protocol+'" not supported. Expected "https:"');return W}}),rK=lW(sW(),1),{Agent:tW,ClientRequest:eW,IncomingMessage:$B,METHODS:QB,OutgoingMessage:qB,STATUS_CODES:KB,Server:JB,ServerResponse:VB,createServer:UB,get:ZB,globalAgent:GB,maxHeaderSize:WB,request:BB,setMaxIdleHTTPParsers:zB,validateHeaderName:FB,validateHeaderValue:MB}=rK,wB=rK});var N8=globalThis;if(typeof N8.global>"u")N8.global=globalThis;if(typeof N8.__require>"u")N8.__require=($)=>{throw Error(`Dynamic require of "${$}" is not supported in the sandbox`)};t0();var Uz=J9(h9(),1);var c7=J9(HK(),1);function W2($,q,Q,K){function J(Z){return Z instanceof Q?Z:new Q(function(G){G(Z)})}return new(Q||(Q=Promise))(function(Z,G){function W(U){try{V(K.next(U))}catch(w){G(w)}}function B(U){try{V(K.throw(U))}catch(w){G(w)}}function V(U){U.done?Z(U.value):J(U.value).then(W,B)}V((K=K.apply($,q||[])).next())})}var L0=914400,w8=12700,n0=`\r +`,NB=2147483649,j7=/^[0-9a-fA-F]{6}$/,YB=1.67,kB=27,H6={type:"solid",color:"666666",pt:1},JJ=[0.05,0.1,0.05,0.1],v6={color:"363636",pt:1},u1={color:"888888",style:"solid",size:1,cap:"flat"},Q2="000000",k2=12,DB=18,f6="LAYOUT_16x9",x7="DEFAULT",VJ="333333",P1={type:"outer",blur:3,offset:1.811023622047244,angle:90,color:"000000",opacity:0.35,rotateWithShape:!0},M8=[0.5,0.5,0.5,0.5],eK={color:"000000"},LB={size:8,color:"FFFFFF",opacity:0.75},o2="2094734552",Y5="2094734553",B8="2094734554",O7="2094734555",UJ="2094734556",W8="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),z8=["C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360","C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360"],HB=["5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7","5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7"],R6;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(R6||(R6={}));var I6;(function($){$.b="b",$.ctr="ctr",$.t="t"})(I6||(I6={}));var ZJ="{F7021451-1387-4CA6-816F-3879F97B5CBC}",P7;(function($){$.arraybuffer="arraybuffer",$.base64="base64",$.binarystring="binarystring",$.blob="blob",$.nodebuffer="nodebuffer",$.uint8array="uint8array"})(P7||(P7={}));var T7;(function($){$.area="area",$.bar="bar",$.bar3d="bar3D",$.bubble="bubble",$.bubble3d="bubble3D",$.doughnut="doughnut",$.line="line",$.pie="pie",$.radar="radar",$.scatter="scatter"})(T7||(T7={}));var u7;(function($){$.accentBorderCallout1="accentBorderCallout1",$.accentBorderCallout2="accentBorderCallout2",$.accentBorderCallout3="accentBorderCallout3",$.accentCallout1="accentCallout1",$.accentCallout2="accentCallout2",$.accentCallout3="accentCallout3",$.actionButtonBackPrevious="actionButtonBackPrevious",$.actionButtonBeginning="actionButtonBeginning",$.actionButtonBlank="actionButtonBlank",$.actionButtonDocument="actionButtonDocument",$.actionButtonEnd="actionButtonEnd",$.actionButtonForwardNext="actionButtonForwardNext",$.actionButtonHelp="actionButtonHelp",$.actionButtonHome="actionButtonHome",$.actionButtonInformation="actionButtonInformation",$.actionButtonMovie="actionButtonMovie",$.actionButtonReturn="actionButtonReturn",$.actionButtonSound="actionButtonSound",$.arc="arc",$.bentArrow="bentArrow",$.bentUpArrow="bentUpArrow",$.bevel="bevel",$.blockArc="blockArc",$.borderCallout1="borderCallout1",$.borderCallout2="borderCallout2",$.borderCallout3="borderCallout3",$.bracePair="bracePair",$.bracketPair="bracketPair",$.callout1="callout1",$.callout2="callout2",$.callout3="callout3",$.can="can",$.chartPlus="chartPlus",$.chartStar="chartStar",$.chartX="chartX",$.chevron="chevron",$.chord="chord",$.circularArrow="circularArrow",$.cloud="cloud",$.cloudCallout="cloudCallout",$.corner="corner",$.cornerTabs="cornerTabs",$.cube="cube",$.curvedDownArrow="curvedDownArrow",$.curvedLeftArrow="curvedLeftArrow",$.curvedRightArrow="curvedRightArrow",$.curvedUpArrow="curvedUpArrow",$.custGeom="custGeom",$.decagon="decagon",$.diagStripe="diagStripe",$.diamond="diamond",$.dodecagon="dodecagon",$.donut="donut",$.doubleWave="doubleWave",$.downArrow="downArrow",$.downArrowCallout="downArrowCallout",$.ellipse="ellipse",$.ellipseRibbon="ellipseRibbon",$.ellipseRibbon2="ellipseRibbon2",$.flowChartAlternateProcess="flowChartAlternateProcess",$.flowChartCollate="flowChartCollate",$.flowChartConnector="flowChartConnector",$.flowChartDecision="flowChartDecision",$.flowChartDelay="flowChartDelay",$.flowChartDisplay="flowChartDisplay",$.flowChartDocument="flowChartDocument",$.flowChartExtract="flowChartExtract",$.flowChartInputOutput="flowChartInputOutput",$.flowChartInternalStorage="flowChartInternalStorage",$.flowChartMagneticDisk="flowChartMagneticDisk",$.flowChartMagneticDrum="flowChartMagneticDrum",$.flowChartMagneticTape="flowChartMagneticTape",$.flowChartManualInput="flowChartManualInput",$.flowChartManualOperation="flowChartManualOperation",$.flowChartMerge="flowChartMerge",$.flowChartMultidocument="flowChartMultidocument",$.flowChartOfflineStorage="flowChartOfflineStorage",$.flowChartOffpageConnector="flowChartOffpageConnector",$.flowChartOnlineStorage="flowChartOnlineStorage",$.flowChartOr="flowChartOr",$.flowChartPredefinedProcess="flowChartPredefinedProcess",$.flowChartPreparation="flowChartPreparation",$.flowChartProcess="flowChartProcess",$.flowChartPunchedCard="flowChartPunchedCard",$.flowChartPunchedTape="flowChartPunchedTape",$.flowChartSort="flowChartSort",$.flowChartSummingJunction="flowChartSummingJunction",$.flowChartTerminator="flowChartTerminator",$.folderCorner="folderCorner",$.frame="frame",$.funnel="funnel",$.gear6="gear6",$.gear9="gear9",$.halfFrame="halfFrame",$.heart="heart",$.heptagon="heptagon",$.hexagon="hexagon",$.homePlate="homePlate",$.horizontalScroll="horizontalScroll",$.irregularSeal1="irregularSeal1",$.irregularSeal2="irregularSeal2",$.leftArrow="leftArrow",$.leftArrowCallout="leftArrowCallout",$.leftBrace="leftBrace",$.leftBracket="leftBracket",$.leftCircularArrow="leftCircularArrow",$.leftRightArrow="leftRightArrow",$.leftRightArrowCallout="leftRightArrowCallout",$.leftRightCircularArrow="leftRightCircularArrow",$.leftRightRibbon="leftRightRibbon",$.leftRightUpArrow="leftRightUpArrow",$.leftUpArrow="leftUpArrow",$.lightningBolt="lightningBolt",$.line="line",$.lineInv="lineInv",$.mathDivide="mathDivide",$.mathEqual="mathEqual",$.mathMinus="mathMinus",$.mathMultiply="mathMultiply",$.mathNotEqual="mathNotEqual",$.mathPlus="mathPlus",$.moon="moon",$.noSmoking="noSmoking",$.nonIsoscelesTrapezoid="nonIsoscelesTrapezoid",$.notchedRightArrow="notchedRightArrow",$.octagon="octagon",$.parallelogram="parallelogram",$.pentagon="pentagon",$.pie="pie",$.pieWedge="pieWedge",$.plaque="plaque",$.plaqueTabs="plaqueTabs",$.plus="plus",$.quadArrow="quadArrow",$.quadArrowCallout="quadArrowCallout",$.rect="rect",$.ribbon="ribbon",$.ribbon2="ribbon2",$.rightArrow="rightArrow",$.rightArrowCallout="rightArrowCallout",$.rightBrace="rightBrace",$.rightBracket="rightBracket",$.round1Rect="round1Rect",$.round2DiagRect="round2DiagRect",$.round2SameRect="round2SameRect",$.roundRect="roundRect",$.rtTriangle="rtTriangle",$.smileyFace="smileyFace",$.snip1Rect="snip1Rect",$.snip2DiagRect="snip2DiagRect",$.snip2SameRect="snip2SameRect",$.snipRoundRect="snipRoundRect",$.squareTabs="squareTabs",$.star10="star10",$.star12="star12",$.star16="star16",$.star24="star24",$.star32="star32",$.star4="star4",$.star5="star5",$.star6="star6",$.star7="star7",$.star8="star8",$.stripedRightArrow="stripedRightArrow",$.sun="sun",$.swooshArrow="swooshArrow",$.teardrop="teardrop",$.trapezoid="trapezoid",$.triangle="triangle",$.upArrow="upArrow",$.upArrowCallout="upArrowCallout",$.upDownArrow="upDownArrow",$.upDownArrowCallout="upDownArrowCallout",$.uturnArrow="uturnArrow",$.verticalScroll="verticalScroll",$.wave="wave",$.wedgeEllipseCallout="wedgeEllipseCallout",$.wedgeRectCallout="wedgeRectCallout",$.wedgeRoundRectCallout="wedgeRoundRectCallout"})(u7||(u7={}));var G2;(function($){$.text1="tx1",$.text2="tx2",$.background1="bg1",$.background2="bg2",$.accent1="accent1",$.accent2="accent2",$.accent3="accent3",$.accent4="accent4",$.accent5="accent5",$.accent6="accent6"})(G2||(G2={}));var S7;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(S7||(S7={}));var E7;(function($){$.top="top",$.middle="middle",$.bottom="bottom"})(E7||(E7={}));var B1;(function($){$.ACTION_BUTTON_BACK_OR_PREVIOUS="actionButtonBackPrevious",$.ACTION_BUTTON_BEGINNING="actionButtonBeginning",$.ACTION_BUTTON_CUSTOM="actionButtonBlank",$.ACTION_BUTTON_DOCUMENT="actionButtonDocument",$.ACTION_BUTTON_END="actionButtonEnd",$.ACTION_BUTTON_FORWARD_OR_NEXT="actionButtonForwardNext",$.ACTION_BUTTON_HELP="actionButtonHelp",$.ACTION_BUTTON_HOME="actionButtonHome",$.ACTION_BUTTON_INFORMATION="actionButtonInformation",$.ACTION_BUTTON_MOVIE="actionButtonMovie",$.ACTION_BUTTON_RETURN="actionButtonReturn",$.ACTION_BUTTON_SOUND="actionButtonSound",$.ARC="arc",$.BALLOON="wedgeRoundRectCallout",$.BENT_ARROW="bentArrow",$.BENT_UP_ARROW="bentUpArrow",$.BEVEL="bevel",$.BLOCK_ARC="blockArc",$.CAN="can",$.CHART_PLUS="chartPlus",$.CHART_STAR="chartStar",$.CHART_X="chartX",$.CHEVRON="chevron",$.CHORD="chord",$.CIRCULAR_ARROW="circularArrow",$.CLOUD="cloud",$.CLOUD_CALLOUT="cloudCallout",$.CORNER="corner",$.CORNER_TABS="cornerTabs",$.CROSS="plus",$.CUBE="cube",$.CURVED_DOWN_ARROW="curvedDownArrow",$.CURVED_DOWN_RIBBON="ellipseRibbon",$.CURVED_LEFT_ARROW="curvedLeftArrow",$.CURVED_RIGHT_ARROW="curvedRightArrow",$.CURVED_UP_ARROW="curvedUpArrow",$.CURVED_UP_RIBBON="ellipseRibbon2",$.CUSTOM_GEOMETRY="custGeom",$.DECAGON="decagon",$.DIAGONAL_STRIPE="diagStripe",$.DIAMOND="diamond",$.DODECAGON="dodecagon",$.DONUT="donut",$.DOUBLE_BRACE="bracePair",$.DOUBLE_BRACKET="bracketPair",$.DOUBLE_WAVE="doubleWave",$.DOWN_ARROW="downArrow",$.DOWN_ARROW_CALLOUT="downArrowCallout",$.DOWN_RIBBON="ribbon",$.EXPLOSION1="irregularSeal1",$.EXPLOSION2="irregularSeal2",$.FLOWCHART_ALTERNATE_PROCESS="flowChartAlternateProcess",$.FLOWCHART_CARD="flowChartPunchedCard",$.FLOWCHART_COLLATE="flowChartCollate",$.FLOWCHART_CONNECTOR="flowChartConnector",$.FLOWCHART_DATA="flowChartInputOutput",$.FLOWCHART_DECISION="flowChartDecision",$.FLOWCHART_DELAY="flowChartDelay",$.FLOWCHART_DIRECT_ACCESS_STORAGE="flowChartMagneticDrum",$.FLOWCHART_DISPLAY="flowChartDisplay",$.FLOWCHART_DOCUMENT="flowChartDocument",$.FLOWCHART_EXTRACT="flowChartExtract",$.FLOWCHART_INTERNAL_STORAGE="flowChartInternalStorage",$.FLOWCHART_MAGNETIC_DISK="flowChartMagneticDisk",$.FLOWCHART_MANUAL_INPUT="flowChartManualInput",$.FLOWCHART_MANUAL_OPERATION="flowChartManualOperation",$.FLOWCHART_MERGE="flowChartMerge",$.FLOWCHART_MULTIDOCUMENT="flowChartMultidocument",$.FLOWCHART_OFFLINE_STORAGE="flowChartOfflineStorage",$.FLOWCHART_OFFPAGE_CONNECTOR="flowChartOffpageConnector",$.FLOWCHART_OR="flowChartOr",$.FLOWCHART_PREDEFINED_PROCESS="flowChartPredefinedProcess",$.FLOWCHART_PREPARATION="flowChartPreparation",$.FLOWCHART_PROCESS="flowChartProcess",$.FLOWCHART_PUNCHED_TAPE="flowChartPunchedTape",$.FLOWCHART_SEQUENTIAL_ACCESS_STORAGE="flowChartMagneticTape",$.FLOWCHART_SORT="flowChartSort",$.FLOWCHART_STORED_DATA="flowChartOnlineStorage",$.FLOWCHART_SUMMING_JUNCTION="flowChartSummingJunction",$.FLOWCHART_TERMINATOR="flowChartTerminator",$.FOLDED_CORNER="folderCorner",$.FRAME="frame",$.FUNNEL="funnel",$.GEAR_6="gear6",$.GEAR_9="gear9",$.HALF_FRAME="halfFrame",$.HEART="heart",$.HEPTAGON="heptagon",$.HEXAGON="hexagon",$.HORIZONTAL_SCROLL="horizontalScroll",$.ISOSCELES_TRIANGLE="triangle",$.LEFT_ARROW="leftArrow",$.LEFT_ARROW_CALLOUT="leftArrowCallout",$.LEFT_BRACE="leftBrace",$.LEFT_BRACKET="leftBracket",$.LEFT_CIRCULAR_ARROW="leftCircularArrow",$.LEFT_RIGHT_ARROW="leftRightArrow",$.LEFT_RIGHT_ARROW_CALLOUT="leftRightArrowCallout",$.LEFT_RIGHT_CIRCULAR_ARROW="leftRightCircularArrow",$.LEFT_RIGHT_RIBBON="leftRightRibbon",$.LEFT_RIGHT_UP_ARROW="leftRightUpArrow",$.LEFT_UP_ARROW="leftUpArrow",$.LIGHTNING_BOLT="lightningBolt",$.LINE_CALLOUT_1="borderCallout1",$.LINE_CALLOUT_1_ACCENT_BAR="accentCallout1",$.LINE_CALLOUT_1_BORDER_AND_ACCENT_BAR="accentBorderCallout1",$.LINE_CALLOUT_1_NO_BORDER="callout1",$.LINE_CALLOUT_2="borderCallout2",$.LINE_CALLOUT_2_ACCENT_BAR="accentCallout2",$.LINE_CALLOUT_2_BORDER_AND_ACCENT_BAR="accentBorderCallout2",$.LINE_CALLOUT_2_NO_BORDER="callout2",$.LINE_CALLOUT_3="borderCallout3",$.LINE_CALLOUT_3_ACCENT_BAR="accentCallout3",$.LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR="accentBorderCallout3",$.LINE_CALLOUT_3_NO_BORDER="callout3",$.LINE_CALLOUT_4="borderCallout4",$.LINE_CALLOUT_4_ACCENT_BAR="accentCallout3=4",$.LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR="accentBorderCallout4",$.LINE_CALLOUT_4_NO_BORDER="callout4",$.LINE="line",$.LINE_INVERSE="lineInv",$.MATH_DIVIDE="mathDivide",$.MATH_EQUAL="mathEqual",$.MATH_MINUS="mathMinus",$.MATH_MULTIPLY="mathMultiply",$.MATH_NOT_EQUAL="mathNotEqual",$.MATH_PLUS="mathPlus",$.MOON="moon",$.NON_ISOSCELES_TRAPEZOID="nonIsoscelesTrapezoid",$.NOTCHED_RIGHT_ARROW="notchedRightArrow",$.NO_SYMBOL="noSmoking",$.OCTAGON="octagon",$.OVAL="ellipse",$.OVAL_CALLOUT="wedgeEllipseCallout",$.PARALLELOGRAM="parallelogram",$.PENTAGON="homePlate",$.PIE="pie",$.PIE_WEDGE="pieWedge",$.PLAQUE="plaque",$.PLAQUE_TABS="plaqueTabs",$.QUAD_ARROW="quadArrow",$.QUAD_ARROW_CALLOUT="quadArrowCallout",$.RECTANGLE="rect",$.RECTANGULAR_CALLOUT="wedgeRectCallout",$.REGULAR_PENTAGON="pentagon",$.RIGHT_ARROW="rightArrow",$.RIGHT_ARROW_CALLOUT="rightArrowCallout",$.RIGHT_BRACE="rightBrace",$.RIGHT_BRACKET="rightBracket",$.RIGHT_TRIANGLE="rtTriangle",$.ROUNDED_RECTANGLE="roundRect",$.ROUNDED_RECTANGULAR_CALLOUT="wedgeRoundRectCallout",$.ROUND_1_RECTANGLE="round1Rect",$.ROUND_2_DIAG_RECTANGLE="round2DiagRect",$.ROUND_2_SAME_RECTANGLE="round2SameRect",$.SMILEY_FACE="smileyFace",$.SNIP_1_RECTANGLE="snip1Rect",$.SNIP_2_DIAG_RECTANGLE="snip2DiagRect",$.SNIP_2_SAME_RECTANGLE="snip2SameRect",$.SNIP_ROUND_RECTANGLE="snipRoundRect",$.SQUARE_TABS="squareTabs",$.STAR_10_POINT="star10",$.STAR_12_POINT="star12",$.STAR_16_POINT="star16",$.STAR_24_POINT="star24",$.STAR_32_POINT="star32",$.STAR_4_POINT="star4",$.STAR_5_POINT="star5",$.STAR_6_POINT="star6",$.STAR_7_POINT="star7",$.STAR_8_POINT="star8",$.STRIPED_RIGHT_ARROW="stripedRightArrow",$.SUN="sun",$.SWOOSH_ARROW="swooshArrow",$.TEAR="teardrop",$.TRAPEZOID="trapezoid",$.UP_ARROW="upArrow",$.UP_ARROW_CALLOUT="upArrowCallout",$.UP_DOWN_ARROW="upDownArrow",$.UP_DOWN_ARROW_CALLOUT="upDownArrowCallout",$.UP_RIBBON="ribbon2",$.U_TURN_ARROW="uturnArrow",$.VERTICAL_SCROLL="verticalScroll",$.WAVE="wave"})(B1||(B1={}));var q0;(function($){$.AREA="area",$.BAR="bar",$.BAR3D="bar3D",$.BUBBLE="bubble",$.BUBBLE3D="bubble3D",$.DOUGHNUT="doughnut",$.LINE="line",$.PIE="pie",$.RADAR="radar",$.SCATTER="scatter"})(q0||(q0={}));var L5;(function($){$.TEXT1="tx1",$.TEXT2="tx2",$.BACKGROUND1="bg1",$.BACKGROUND2="bg2",$.ACCENT1="accent1",$.ACCENT2="accent2",$.ACCENT3="accent3",$.ACCENT4="accent4",$.ACCENT5="accent5",$.ACCENT6="accent6"})(L5||(L5={}));var W1;(function($){$.chart="chart",$.image="image",$.line="line",$.rect="rect",$.text="text",$.placeholder="placeholder"})(W1||(W1={}));var D0;(function($){$.chart="chart",$.hyperlink="hyperlink",$.image="image",$.media="media",$.online="online",$.placeholder="placeholder",$.table="table",$.tablecell="tablecell",$.text="text",$.notes="notes"})(D0||(D0={}));var F8;(function($){$.title="title",$.body="body",$.image="pic",$.chart="chart",$.table="tbl",$.media="media"})(F8||(F8={}));var C6;(function($){$.DEFAULT="•",$.CHECK="✓",$.STAR="★",$.TRIANGLE="▶"})(C6||(C6={}));var j6="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOVhAAAGAUlEQVR4Xu2dT0xcRRzHf7tAYSsc0EBSIq2xEg8mtTGebVzEqOVIolz0siRE4gGTStqKwdpWsXoyGhMuyAVJOHBgqyvLNgonDkabeCBYW/8kTUr0wsJC+Wfm0bfuvn37Znbem9mR9303mJnf/Pb7ed95M7PDI5JIJPYJV5EC7e3t1N/fT62trdqViQCIu+bVgpIHEo/Hqbe3V/sdYVKHyWSSZmZm8ilVA0oeyNjYmEnaVC2Xvr6+qg5fAOJAz4DU1dURGzFSqZRVqtMpAFIGyMjICC0vL9PExIRWKADiAYTNshYWFrRCARAOEFZcCKWtrY0GBgaUTYkBRACIE4rKZwqACALR5RQAqQCIDqcASIVAVDsFQCSAqHQKgEgCUeUUAPEBRIVTAMQnEBvK5OQkbW9vk991CoAEAMQJxc86BUACAhKUUwAkQCBBOAVAAgbi1ykAogCIH6cAiCIgsk4BEIVAZJwCIIqBVLqiBxANQFgXS0tLND4+zl08AogmIG5OSSQS1gGKwgtANAIRcQqAaAbCe6YASBWA2E6xDyeyDUl7+AKQMkDYYevm5mZHabA/Li4uUiaTsYLau8QA4gLE/hU7wajyYtv1hReDAiAOxQcHBymbzark4BkbQKom/X8dp9Npmpqasn4BIAYAYSnYp+4BBEAMUcCwNOCQsAKZnp62NtQOw8WmwT09PUo+ijaHsOMx7GppaaH6+nolH0Z10K2tLVpdXbW6UfV3mNqBdHd3U1NTk2rtlMRfW1uj2dlZAFGirkRQAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAGHqrm8caPzQ0WC1logbeiC7X3xJm0PvUmRzh45cuki1588FAmVn9BO6P3yF9utrqGH0MtW82S8UN9RA9v/4k7InjhcJFTs/TLVXLwmJV67S7vD7tHF5pKi46fYdosdOcOOGG8j1OcqefbFEJD9Q3GCwDhqT31HklS4A8VRgfYM2Op6k3bt/BQJl58J7lPvwg5JYNccepaMry0LPqFA7hCm39+NNyp2J0172b19QysGINj5CsRtpij57musOViH0QPJQXn6J9u7dlYJSFkbrMYolrwvDAJAC+WWdEpQz7FTgECeUCpzi6YxvvqXoM6eEhqnCSgDikEzUKUE7Aw7xuHctKB5OYU3dZlNR9syQdAaAcAYTC0pXF+39c09o2Ik+3EqxVKqiB7hbYAxZkk4pbBaEM+AQofv+wTrFwylBOQNABIGwavdfe4O2pg5elO+86l99nY58/VUF0byrYsjiSFluNlXYrOHcBar7+EogUADEQ0YRGHbzoKAASBkg2+9cpM1rV0tK2QOcXW7bLEFAARAXIF4w2DrDWoeUWaf4hQIgDiA8GPZ2iNfi0Q8UACkAIgrDbrJ385eDxaPLLrEsFAB5oG6lMPJQPLZZZKAACBGVhcG2Q+bmuLu2nk55e4jqPv1IeEoceiBeX7s2zCa5MAqdstl91vfXwaEGsv/rb5TtOFk6tWXOuJGh6KmnhO9sayrMninPx103JBtXblHkice58cINZP4Hyr5wpkgkdiChEmc4FWazLzenNKa/p0jncwDiqcD6BuWePk07t1asatZGoYQzSqA4nFJ7soNiP/+EUyfc25GI2GG53dHPrKo1g/1Cw4pIXLrzO+1c+/wg7tBbFDle/EbQcjFCPWQJCau5EoBoFpzXHYDwFNJcDiCaBed1ByA8hTSXA4hmwXndAQhPIc3lAKJZcF53AMJTSHM5gGgWnNcdgPAU0lwOIJoF53UHIDyFNJcfSiCdnZ0Ui8U0SxlMd7lcjubn561gh+Y1scFIU/0o/3sgeLO12E2k7UXKYumgFoAYdg8ACIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6ZQ4JB6PKzviYthnNy4d9h+1M5mMlVckkUjsG5dhiBMCEMPg/wuOfrZZ/RSywQAAAABJRU5ErkJggg==",vB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB4AAAAVnCAYAAACzfHDVAAAAYHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjaVcjJDYAwDEXBu6ughBfH+YnLQSwSHVA+Yrkwx7HtPHabHuEWrQ+lBBAZ6TMweBWoCwUH8quZH6VWFXVT696zxp12ARkVFEqn8wB8AAAACXBIWXMAAC4jAAAuIwF4pT92AADZLklEQVR42uzdd5hV9Z0/8M+dmcsUZmDovYOhKCiKYhR7JJuoSTCWGFI0WUxijBoTTXazVlyza4maYm9rTRSJigVsqCDNQhHBAogKCEgRMjMMU+7vj93sL8kqClLmnPt6PY+PeXZM9vP9vO8jZ+Y955xMfJLjorBrRMuSgmiViyjN1Ee2oSCyucbIBAAAAAAAAADbXaYgcoWNUZcrirpMbdRsysa69wbF+rggGrf439vSF7seF12aFUTnxvoosGIAAAAAAACAXacgoqEgF++/VRgr4r5o+Kh/pvD//F8uiII+LaPrum/EXzqui2b1ddHGKgEAAAAAAAB2rVxEQWMmWrQtjHZlA6N2w2tR84//zP8pgHu3ib6NBdG+zdqorK6KVUXZaB85j3sGAAAAAAAAaAoaG6OwIBdtyneP2PBabPzbr/1dAdx3VHRtyESHiIhcYzQrLo7WmVzkcjmPgAYAAAAAAABoSgpy0eIfS+D/LYD7fy3abC6Inn/7X2hsjELlLwAAAAAAAEDT9D8lcM1fHwddFBFxyAVR9M686PVp/gfqayKiJiLqLBMAAAAAAABgh8hGRGlEUekn/6PFEb3ikNgQk6O+KCJi6dzoksv83/cB/1X9xoiaJdmoWxlRV1dk2QAAAAAAAAA7QTZbH9muERX96v7n9t7/q6Exinq3i86LI94pjOOisHUu+uYykfmof7h+Y8Sa6aVRt74gGhs9DRoAAAAAAABgZ2lsLIi69QWxeUUmSjs0/vedwR8hk4uydSfE+wVd6qOyMfMx7/mtj9jwUtbjngEAAAAAAAB2obrqolg7IxtR/9Ffb4wo7P5GtCwobRaVH/c/UvNmNuqqPfIZAAAAAAAAYFerqy6KmjezH/v1ktpoVZBr/PgCeMN7yl8AAAAAAACApmJLHW5jUVQWNDSP+Q3ZeLco4i9/+8X6teHRzwAAAAAAAABNSd3/dLn/oLAoqqIuVhXFxhhSGB/xqGjlLwAAAAAAAECTU1eTjaK/KXSLIv7SWB+bc5ko9YxnAAAAAAAAgATJFv393bz1EeV//c8F1gMAAAAAAACQDgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKREkRUAAACwrUpLSwuGDRvWfMCAAS26du3avKysrLiioqKkZcuWzZs1a1bcvHnz0tLS0rJsNtusuLi4ebNmzUoLCgo+8/eijY2N9Zs3b66pra2tqqur21xTU1NdVVVVs2nTptqNGzdWbdiwoeYvf/nL5hUrVlQtWLBgw6xZs6pqamoaJQYAAEDaKYABAACIiIghQ4aUHnTQQW379u3bql27dq3at2/fpkWLFq2bN29eWVpa2qpZs2bNCwsLm2ez2fLCwsLyoqKi8sLCwtKknK+hoaG6vr6+qqGh4S91dXV/aWhoqNq8eXNVTU3NuqqqqvUbNmxYu2rVqjWrV69e99Zbb6177rnnPpgzZ06NTwYAAABJogAGAADIA8OGDWt+xBFHdBwwYECnLl26dGjdunXHFi1adCgtLe1YUlLSvlmzZq0KCgqK07yDwsLCssLCwrKIaPdp/zuNjY21mzdvXrdp06ZVNTU172/YsGHl2rVr31+2bNnKBQsWrHjyySffnzVrVpVPGAAAAE1Fpuexsd9HfaF+ZcSal0ptCAAAIAE6deqUPf744zvtueeeXbp3796lbdu2XSorKzuXlpZ2KS0t7VBYWFhhSztGQ0PDxpqampU1NTXL169fv+yDDz5Y9s477yybPXv2sj/96U8rVqxYUWdLAAAAbE9t9q6Jog4f/TUFMAAAQEJks9nMt7/97Y4jRozo1bdv397t2rXrXl5e3rWsrKxzcXFx+4gosKUmp7G2tnZVTU3Nso0bNy5btWrV0tdff/2tJ598cvG999672noAAADYFgpgAACAhPne977X6a9Fb/v27Xu1bNmyV1lZWa8kvXOXLauvr9/wl7/8ZdG6desWL1u2bNHChQsX/fGPf1w8derUjbYDAADAliiAAQAAmqhsNps59dRTuxx66KH9+/Tp87n27dv3Ly8v719UVOSRzXlq06ZNKzZu3Pj6+++//8abb775xqOPPvrG3XffvcpmAAAA+CsFMAAAQBNx6qmndvniF784qHfv3v3btWv3uYqKis8VFhaW2wxbUl9fv37Dhg1vfPDBB68vXrz4jccee2z+jTfeuNxmAAAA8pMCGAAAYBc45phjWn/rW9/aq3///kPatGnTv6Kiop9HOLO9NDQ0VG/cuPGtNWvWLFy4cOGcO+6445WHHnporc0AAACknwIYAABgJzjjjDO6f+lLX9qrV69eg1u3bj2orKysR0RkbIadJFddXb103bp18xcvXjz30UcffeXqq69+x1oAAADSRwEMAACwnZWWlhb86le/2u3QQw8d1r17931btmw5qLCwsMxmaEoaGhqqP/zww/nvvPPOzGeeeWbW2LFj36ipqWm0GQAAgGRTAAMAAGwHP/7xj7t+9atf3bdXr15D27Ztu1c2m21jKyRJXV3dmg8++OCVRYsWvfznP/95xh/+8IdltgIAAJA8CmAAAIBtcOKJJ7Y75ZRTDujXr9+w1q1bD81ms61shTSpq6tbt3bt2pfffPPNWbfccsvUe++9d7WtAAAANH0KYAAAgE+hoqKi4IILLhg0YsSI/bp27bpfy5YtB2YymUKbIR/kcrmGDz/8cP6777474/nnn59x4YUXvrZx40aPiwYAAGiCFMAAAAAf4/jjj2/7/e9//8D+/fsf2Lp1630KCgpKbAUiGhsbN61fv37eW2+9NeWGG2545u67715lKwAAAE2DAhgAAOB/ZLPZzAUXXPC5I4888sDu3bsfWFFRsVtEFNgMbFl1dfWSd999d8qsWbNmnnvuuS+vW7euwVYAAAB2DQUwAACQ10pLSwsuvfTSQYcccsjBXbt2HVFWVtbDVmDb1dbWrnr//fdfmDp16uRf/vKXL65evbreVgAAAHYeBTAAAJB3Bg0aVHrBBRd8fs899zywQ4cOBxQVFbWwFdj+Ghsba9euXTtrzpw5T59//vmTX3755WpbAQAA2LEUwAAAQF4YNmxY8/POO+/gIUOGHOZ9vrDz/W0ZfNFFFz07a9asKlsBAADY/hTAAABAarVq1arwyiuv3HfEiBEjO3TocFBhYWGZrcCu19DQUP3+++8/O2XKlIk/+clPZm7cuLHRVgAAALYPBTAAAJAqrVq1Kvztb3+7/3777Xd4x44dRxQWFpbbCjRdDQ0NG99///0pM2bMeOqHP/zhC8pgAACAz0YBDAAApMJZZ53V45vf/OaRvXr1GllaWtrVRiB5ampq3l28ePHEO++8c9LVV1/9jo0AAABsPQUwAACQWMOHDy+/6KKLvjB48OCjW7RoMdBGID0+/PDDV+fNmzfhvPPOe3L69Ol/sREAAIBPRwEMAAAkSqtWrQpvuOGGQ/bbb79/atOmzX6ZTCZrK5BeuVyubs2aNTNmzJjx2JgxYyavW7euwVYAAAA+ngIYAABIhB//+Mddv/e9732lZ8+e/1RcXNzWRiD/1NbWfvD2228/dssttzz029/+9l0bAQAA+L8UwAAAQJNVUVFRcO21137+4IMPPrZ169b7ZTKZAlsBIqJxzZo1M59//vnxp5122hR3BQMAAPx/CmAAAKDJOeWUUzqefvrpx/bu3ftL2Wy2jY0AH6e+vn7j0qVLH/vd7373x+uvv36ZjQAAAPlOAQwAADQJ2Ww2c+uttx5wyCGHnNC6deu9I8LdvsDWaFy7du1L06ZN+/OPfvSjZ1evXl1vJQAAQD5SAAMAALtU//79S6655pp/2nPPPY8tLy/vayPAZ1VTU7NswYIF488999wHp06dutFGAACAfKIABgAAdomf//znPU855ZQTu3btemRhYWGZjQDbW2NjY92KFSuevOWWW+689NJLF9kIAACQDxTAAADATuMxz8Cusn79+rlPP/30f5188slT6+rqcjYCAACklQIYAADY4fr27Vv8hz/84a+Pee5nI8CuUlNT8+68efPu/8EPfvDgwoULN9kIAACQNgpgAABghxkyZEjpNddc89XBgwefWFxc3MFGgKaitrZ21dy5c+/5yU9+8uc5c+bU2AgAAJAWWyqAPYoNAADYJqNHj+4wb968n06ZMuXRYcOGnaH8BZqa4uLi9sOGDTtjypQpj86bN++nJ510UntbAQAA0s4dwAAAwFY599xze33/+9//dufOnY/IZDJZGwGSIpfL1S1fvvzJG2644fbLLrvsbRsBAACSyiOgAQCAz+y8887r+53vfOfbHTt2PDyTyRTaCJBUuVyuYcWKFU/cdNNN//XrX/96sY0AAABJowAGAAC22WWXXTboG9/4xg9at249zDaAtFm7du2su++++9pzzjnnNdsAAACSQgEMAABsNcUvkE8UwQAAQJIogAEAgE9N8Qvks7Vr18665557rvv5z38+3zYAAICmaksFcGHlwOj6UV9orIqoWZG1PQAAyBO/+MUvet9xxx3nHHrooT8pLS3tYiNAPiotLe2y7777HvP973+/X1lZ2ZIpU6assxUAAKCpKetcHwXlH/01BTAAAOS5M844o/u99957zpe//OWflZeX94qIjK0AeS5TXl7e8+CDDx71/e9/v3dEvDVjxowPrQUAAGgqFMAAAMD/ceKJJ7a77777fjJq1Kh/KS8v7xOKX4B/lCkvL+99+OGHj/rWt77VfvXq1Qvnz59fbS0AAMCutqUC2DuAAQAgzwwdOrTs+uuvP6l///4nFRYWltkI20NjY2Ns2rQpqquro6amJurr62PTpk2xefPmqK+vj+rq6qivr4/NmzfHpk2boqGhYZv/fxUWFkZJSUk0a9YsioqKoqysLIqKiqJZs2ZRUlISRUVFUVpa+r9/FRQUCIjtoqGhoeq11167a8yYMffMmTOnxkYAAIBdZUvvAFYAAwBAnujUqVP2nnvuGbXXXnudnM1mK22Ej9PQ0BAbN26MDRs2/J+/Nm7cGBs3boyamprYtGlTbNq0KWpqaqK2trbJnqe4uDhKSkqitLT0f/9eUVERFRUV0aJFi//zV0VFRRQWFvog8LHq6urWvvjii7eceOKJf169enW9jQAAADubAhgAAPLcXXfdddAXv/jF00tLS7vZRn7L5XKxYcOGWLt2baxbty7Wrl37d3+tW7cuNmzYkPd7atGiRbRu3TpatWoVrVu3jjZt2vzvf27dunW0aNHCh4morq5e+sgjj1zzne98Z6ptAAAAO5MCGAAA8tTVV189+MQTTzyzoqJioG3kj8bGxli5cmUsX748Pvjgg1i9evX//n3t2rXR2NhoSZ9RYWFhtGrVKtq1axdt27b937937tw5OnTo4LHTeWbDhg3z77333qvOPPPMebYBAADsDApgAADIM1/72tfaXHrppad27979qIjQRKVUQ0NDrFq1KlasWBHvv//+//595cqVTfqRzGlXXFwcHTp0iI4dO0bnzp2jY8eO0alTp2jXrp1HS6dYLpdrfOeddx76+c9/fv2ECRPW2QgAALAjKYABACBP9OrVq9ldd931jT322OM7hYWFZTaSHh9++GG88847sXTp0njvvfdixYoVsXr16mhoaLCchCgsLIz27dtHp06dolu3btG9e/fo3r27x0mnTENDQ9W8efNu++Y3v/nHJUuWbLYRAABgR1AAAwBAHrjrrrtG/NM//dOZJSUlXWwj2davXx9Lly6Nd955539L3w8//NBiUqqysvJ/y+C//tWqVSuLSbiamppljz322G9Gjx49xTYAAIDtTQEMAAAp9qtf/arPD3/4w5+1atVqL9tIno0bN8aSJUvirbfeikWLFsV7770XmzZtspg8V1JSEl27do0+ffpE3759o3fv3lFeXm4xCbRu3bqXr7322ivGjh27yDYAAIDtRQEMAAApNGjQoNI77rjju7vttttJBQUFWRtJhtWrV8ebb74ZixcvjiVLlsTy5cujsbHRYtiigoKC6Ny5c/Tu3Tt69+4d/fr1i7Zt21pMQjQ2Nta98cYbd33rW9+6ff78+TU2AgAAfFYKYAAASJHS0tKCBx988Jj99tvvn7PZbBsbaboaGhri7bffjrfeeisWLFgQS5YscXcv201FRUX06tUr+vbtG3379o2ePXtGYWGhxTRhdXV1a2bMmHHjV77ylYdqamr85gcAALDNFMAAAJASp59+erdf/vKX51ZWVu5jG03T6tWr47XXXouFCxfGm2++GRs3brQUdooWLVpE3759Y8CAATFw4EB3CDdh69evf/E//uM//vPqq69+xzYAAIBtoQAGAICEGzRoUOm99977w969ex+byWTc4teErF+/PubNmxcLFiyIN954Q+FLk9GiRYvo169fDBgwIPbYY4+orKy0lCYkl8s1LF68eNyJJ554rcdCAwAAW0sBDAAACXbNNdcMOemkk35RVlbWyzZ2vVwuF++++27MnTs3XnvttViyZIl3+NLkFRQURK9evWLQoEExePDg6Natm6U0EdXV1UvuvvvuX//kJz+ZYxsAAMCnpQAGAIAEOuqoo1r99re//VmHDh0Ot41da9OmTTF79uyYO3duLFy4MKqqqiyFRGvevHn0798/Bg8eHHvuuWeUlJRYyi62cuXKp04//fTLJ0yYsM42AACAT6IABgCAhBk3btwRRxxxxFnZbLaNbewaVVVVMXfu3Jg7d27Mnz8/amtrLYVUKi4ujoEDB8bgwYNj8ODBUV5ebim7SF1d3ZqnnnrqqlGjRj1hGwAAwJYogAEAICFOOeWUjhdddNEvW7duvZ9t7HwrV66MWbNmxdy5c+Odd96JXC5nKeSdzp07x9577x3Dhg2LDh06WMgusHbt2hnnnXfepbfccsv7tgEAAHwUBTAAADRxpaWlBU899dQ3Bw8e/L2CggLPYt2JVqxYES+99FK89NJLsXz5cguBv/HXMnjvvfeOTp06WchO1NjYuGnu3Lk3H3744XfV1NR40TgAAPB3FMAAANCEjR49usOll176yzZt2gy3jZ1j/fr18eKLL8bMmTNj6dKlFgKfQs+ePWPfffeNYcOGRYsWLSxkJ1mzZs0L55577q/vvvvuVbYBAAD8lQIYAACaoIqKioKJEyd+c/Dgwd8vKCgotpEda8OGDfHiiy/G9OnTlb7wGfXo0SOGDx8ew4YNi4qKCgvZwdwNDAAA/CMFMAAANDGnnHJKx7Fjx/5rZWXlMNvYcerr6+PVV1+NGTNmxLx586Kurs5SYDvKZrMxZMiQ2HfffWP33XePwsJCS9mB1q5dO+MXv/jFv995550rbQMAAPKbAhgAAJqIbDabeeKJJ47fZ599fuSu3x0jl8vFwoULY/r06TF79uzYtGmTpcBOUFpaGkOGDInhw4fHgAEDLGQHaWhoqJ42bdo1Rx555J9tAwAA8pcCGAAAmoDjjz++7ZVXXvmr1q1be9fvDrBmzZqYNm1azJw5M1audHMc7EodO3aMz3/+87H//vt7X/CO+3fetDPPPPOScePGfWAbAACQfxTAAACwi9100037HXvssf9WXFzc1ja2n1wuF6+99lo8//zzMW/evKivr7cUaEKKiopizz33jBEjRsTnPve5yGQylrId1dbWrvrjH/948Q9+8INZtgEAAPlFAQwAALvIkCFDSu+///5zunTp8k+2sf2sXbs2Jk+eHNOnT48PP/zQQiABKisrY8SIEXHIIYdEeXm5hWxHy5Yte+zrX//6f86ZM6fGNgAAID9sqQAurBwYXT/qC41VETUrsrYHAADb6IILLtjt97///VVt2rQZZhvbx+LFi2P8+PFx9913xxtvvBG1tbWWAgmxadOmeOONN+LZZ5+NtWvXRps2bTweejtp0aJFv5NOOumg0tLSuc8+++xaGwEAgPQr61wfBR/zu7XuAAYAgO0sm81mJk2a9PVhw4b9pKCgwG9VfkZ1dXUxY8aMeOaZZ+K9996zEEiRfv36xSGHHBJDhw6NgoICC/mMGhsbN8+YMeOaL37xi+Pq6upyNgIAAOnlEdAAALCTHH/88W2vuuqqCyorK/exjc9mzZo18dRTT8XUqVNj06ZNFgIpVlFREZ///OfjsMMOi8rKSgv5jNavXz/r9NNPv3DcuHEf2AYAAKSTAhgAAHaC22677fNf+9rXzstms5W2se0WLVoUjz/+eMybNy9yOTewQT4pKiqKIUOGxBFHHBG9e/e2kM+grq5u3QMPPHDRySefPM02AAAgfRTAAACwA1VUVBQ8/fTTpwwcOPCUTCbjGabbIJfLxauvvhpPPvlkLFy40EIgz2UymRgwYEAcccQRMWjQIAvZ9n+3Ns6fP/+Www8//JaNGzc22ggAAKTHlgrgwsqB0fWjvtBYFVGzwuvKAABgS0488cR2EyZMuLx79+5fzmQyGRvZOo2NjTFr1qy49dZb48knn4wPPvC0UuC/rV69OmbMmBFz5syJ0tLS6NSpU/jX7NbJZDKZ9u3bD/3+978/dPny5TNfffXValsBAIB0KOtcHwXlH/O9gDuAAQBg29x66637H3vssRcWFRW1sI2tU1NTE0899VQ8++yzsWHDBgsBPlGLFi3i4IMPjsMPPzxKS/28YmvV19d/OG7cuPNPPvnk6bYBAADJ5xHQAACwHWWz2cyzzz77rSFDhvzAI5+3zqZNm2Ly5Mnx1FNPKX6BbdKiRYs47LDD4pBDDlEEb6VcLtfwyiuvXHfooYfeWVdX5yXrAACQYApgAADYTo455pjW11133cWVlZV728ant2HDhnj88cdjypQpUVtbayHAZ1ZcXBwHHnhgfPGLX4wWLTyIYWusWbNm2re//e3zn3nmGb+JAwAACeUdwAAAsB1cfvnlu1900UW/LS8v72cbn05VVVVMmDAhbrnllnjzzTejoaHBUoDtoqGhIZYsWRLPPfdc1NTURI8ePSKb9XOMT6OsrKzb17/+9SPbtm0774knnlhtIwAAkMDreu8ABgCAz+bhhx/+8qGHHnpOQUFBsW18sk2bNsUzzzwTTzzxRFRVVVkIsMOVl5fHkUceGYccckgUF/tX9afR2Ni46emnn/71Mccc87htAABAsngENAAAbKN27doVTZ48+YxevXodZxufrK6uLp5++umYOHGi4hfYJSoqKuKLX/xiHHzwwe4I/pQWLVr0x4MOOuiadevWeUwDAAAkhEdAAwDANjj22GPbPvzww7/p2LHjobaxZXV1dfHkk0/GddddF3Pnzo26ujpLAXaJzZs3x2uvvRbPPfdcRET06NEjCgsLLWYLWrduvfv3vve9fd9+++1pCxYsqLYRAABo+rb0CGgFMAAAfITLL7989wsuuOB3zZs372UbH6+xsTGmTJkS119/fbzyyiuKX6DJ2Lx5cyxYsCCmT58excXF0a1bt8hkMhbzMUpKSjp8+ctfPrJt27ZzvBcYAACaPu8ABgCArTB+/Pgjv/CFL/xLQUFBiW18vAULFsT48eNj6dKllgE0eT169IivfOUrMWjQIMvYgsbGxpqJEydecuyxxz5pGwAA0HR5BzAAAHwK7dq1K3ruued+1qNHj6/axsdbtGhR3H///bF48WLLABKnV69ecdxxx0WfPn0sYwuWLl3654MOOujy1atX19sGAAA0Pd4BDAAAn2DYsGHNn3766V936tTpC7bx0TZs2BD33Xdf/PGPf4y1a9daCJBI69evj2nTpsW6deuiZ8+eUVLiYQ8fpbKysv+3v/3t/lOmTJmyfPlyz/cHAIAmxjuAAQBgC372s5/1uP76669t0aKF54J+hJqamhg/fnzcfPPN8fbbb0cul7MUINFyuVy888478cwzz0RVVVX07t07slk/A/lHZWVl3U488cTD6+rqZkyfPv1DGwEAgCZ0va4ABgCAj3bFFVfscdZZZ11dXFzcwTb+Xi6XixkzZsR1110XCxYsiMbGRksBUqWxsTGWLFkSM2bMiPLy8ujSpUtkMhmL+RvZbLbFQQcddHibNm1mP/HEE6ttBAAAmoYtFcDeAQwAQN6aNGnSqAMOOODsTCZTaBt/b9GiRXHPPffEu+++axlA3ujWrVucdNJJ0bt3b8v4B7lcrm7y5Mm//vKXv/yIbQAAwK63pXcAK4ABAMg7paWlBTNnzjyzT58+x9vG39uwYUOMGzcuZsyY4VHPQF7KZDKx3377xde//vWoqKiwkH+waNGiP+27775X1dTUeCwEAADsQgpgAAD4H926dctOnjz5V506dRppG/9fLpeLqVOnxp///OfYuHGjhQB5r6KiIkaNGhX777+/x0L/g+XLlz9+6KGHXvLuu+/W2QYAAOwaWyqAvQMYAIC8MXz48PInnnjiynbt2o2wjf/vnXfeiWuvvTaee+652Lx5s4UARMTmzZtjzpw58dprr0XPnj2jRYsWlvI/Kioq+n7rW98aMnXq1Ofee+89f3AAAMAusKV3ACuAAQDIC9/+9rc73n777X9o0aLFANv4b1VVVXHXXXfFvffeG+vXr7cQgI+wbt26eP7552P9+vWx2267RVFRkaVERElJSefjjjvuoA8++GDKK6+88hcbAQCAnUsBDABAXjv//PP7XXzxxX8oKSnpbBv/bfr06XHttdfGokWLLAPgU3jnnXdi2rRp0bp16+jc2R8nERHZbLbyC1/4whElJSUvTp48eY2NAADAzqMABgAgb/3ud7/b60c/+tFVRUVFrWwjYs2aNXHzzTfHpEmTora21kIAtkJtbW289NJL8c4770Tfvn2jtLQ073dSWFhYNnz48C/26dNn4UMPPbTMpwQAAHYOBTAAAHnp1ltv3f+b3/zmfxYWFjbP913kcrl4/vnn4/rrr4/ly5f7cAB8BitXroxp06ZFRUVFdOvWLTKZTF7vo6CgIDto0KBDBw0atOiBBx54xycEAAB2vC0VwJmex8Z+H/WF+pURa17ym6wAACTTww8//KXDDjvsXzKZTN6/rPGDDz6I22+/Pd544w0fDIDtbMCAAfGtb30r2rRpk/e7yOVyjVOmTPn1yJEjH/LJAACAHavN3jVR1OGjv6YABgAgdV555ZXTPve5z30r3/fQ0NAQjz32WDz++ONRV1fngwGwg2Sz2Tj66KPjC1/4QhQUFOT9Pl5//fU79tprr9/7ZAAAwI6jAAYAIC9ks9nMyy+/fFafPn2Oz/ddvPvuu3HbbbfFe++954MBsJN069YtvvOd70S3bt3yfhdLliy5f5999rmypqam0ScDAAC2PwUwAACpV1paWjBr1qyzevfufVw+7yGXy8WTTz4ZDz74oLt+AXaBbDYbxxxzTBxxxBF5fzfw0qVLHxg6dOjlSmAAANj+FMAAAKRar169mk2ePHlsu3btDsrnPaxcuTJuueWWePvtt30oAHaxnj17ximnnBIdOnTI6z2sXr16yiGHHPIvS5Ys2exTAQAA28+WCuDCyoHR9aO+0FgVUbMia3sAADRpQ4cOLXvqqacub9Omzf75uoNcLhfPPPNMXH/99bF27VofCoAmYP369TFlypQoKSmJnj17RiaTycs9NG/evPtJJ500ZPLkyc+sWLHCoykAAGA7KetcHwXlH/01BTAAAIk1ZMiQ0kceeeSKVq1a7Z2vO6iuro7bb789nnjiiWhs9IRNgKaksbEx5s+fH++//34MGDAgstn8/DlLaWlpp6997WuDn3rqqadXrlxZ75MBAACfnQIYAIDUOfTQQ1s8+OCDv2/ZsuUe+bqDOXPmxNVXX+2RzwBN3PLly+OFF16Ijh075u0joUtLSzudcMIJ+7/00ktPv/3227U+FQAA8NkogAEASJVhw4Y1v++++37TsmXLQfl4/vr6+hg/fnz88Y9/jNpaP0MHSILNmzfHiy++GJs3b47ddtstCgoK8m4HxcXFbY866qg9n3vuuaeXL1/ucdAAAPAZKIABAEiNI488snLcuHG/b9GixcB8PP97770XV111VcyZM8eHASCBFi1aFC+//HL069cvWrRokXfnLykp6XDcccftP2fOnGcWLVq0yScCAAC2jQIYAIBUOPLIIyvvvPPO35aXl++Wj+d/+umn48Ybb4wPP/zQhwEgwf7yl7/ECy+8ECUlJdGrV6+8O3+zZs3aHHXUUfspgQEAYNspgAEASLxjjz227W233faH5s2b98m3s1dVVcXNN98cTz31VDQ2NvowAKRAY2NjzJ8/P5YtWxYDBgyIZs2a5dX5mzVr1uaYY4458M0333xm4cKFNT4RAACwdRTAAAAk2qGHHtritttuuzofy9+33347rrnmmli8eLEPAkAKvf/++/HKK69Enz59orKyMq/Ons1mK4888sh9Zs6c+dTSpUs3+zQAAMCnpwAGACCxjjjiiJb33nvvteXl5f3y6dy5XC4mTZoUN998c1RVVfkgAKRYVVVVTJ06NbLZbPTp0ycymUzenL24uLjtV7/61c+/8sorTy1evLjWpwEAAD4dBTAAAIl06KGHtrj33nt/l2/lb3V1ddx0000xefLkyOVyPggAeSCXy8WCBQvi3Xffjd133z2y2fz5mUyzZs1aH3300fvNmDHjSXcCAwDAp6MABgAgcYYOHVo2fvz4qysqKgbk07mXLVsWV111lUc+A+SplStXxiuvvBKf+9znoqKiIm/O3axZszZHH3300GeeeebJFStW1PkkAADAlimAAQBIlCFDhpQ++uij17Rs2XL3fDr31KlT49prr42NGzf6EADksaqqqpg+fXq0bds2unTpkjfnLikpaT9q1KihTz755JMrV66s90kAAICPt6UCuMB6AABoSjp16pSdMGHCv1dWVu6RL2dubGyMcePGxR133BF1dW56AiCitrY2br755hg/fnw0NjbmzbkrKyv3mDBhwr9369bNXQkAALCNFMAAADQZrVq1Kpw+ffolbdq02T9fzlxdXR2/+93vYtKkSd73C8DfyeVy8fjjj8fvf//7qK6uzptzt2nTZv8pU6Zc0qpVq0KfAgAA2HoKYAAAmoSKioqC2bNnX9KuXbuD8uXMS5cujYsuuijmz5/vAwDAx3r11VfjoosuiqVLl+bNmdu1a3fQ7Nmz/72iosLPrgAAYCu5iAYAoEmYOXPmz9q1a3dIvpz35ZdfjiuuuCLWrVsnfAA+0bp16+KKK66Il19+OW/O3K5du4Nnzpz5M+kDAMDWUQADALDLvfjii2N69OgxKh/Omsvl4oEHHogbbrghamtrhQ/Ap1ZbWxs33HBDPPDAA3nz2oAePXqMevHFF8dIHwAAPj0FMAAAu9SkSZO+NnDgwFPy4ax1dXVx8803x8SJE73vF4BtksvlYuLEiXHLLbdEXV1dXpx54MCBJ0+aNOlr0gcAgE9HAQwAwC7z6KOPHnXggQeekw9nXbduXfz617+OWbNmCR6Az2zmzJnx61//Ol9eJZA58MADz3n00UePkjwAAHyywsqB0fWjvtBYFVGzImtDAADsEDfeeOO+Rx999EWZTKYw7Wddvnx5XHXVVbFy5UrBA7DdbNiwIWbPnh0DBw6MioqKtB8307179/179uz56sMPP7xc+gAA5LuyzvVRUP7RX1MAAwCw011xxRV7fPe7372qoKCgWdrPOmfOnPjtb38bGzduFDwA2111dXVMmzYtOnfuHB07dkz1WTOZTOHuu+9+eJs2bV6aNGnSKukDAJDPFMAAADQZZ5xxRvef/exnvy0sLCxP+1knTJgQd999d9TX1wsegB2moaEhXnrppchms9G3b99UnzWTyRTttddeB/3lL395dubMmRukDwBAvlIAAwDQJBx00EEVf/jDH64pLi7ulOZz5nK5eOCBB+Kxxx4TOgA77c+eBQsWRF1dXfTv3z8ymUxqz1pQUFBywAEHDJs+ffqkpUuXbpY+AAD5aEsFcIH1AACwMwwaNKj0vvvuu7qsrKxXms9ZV1cX1113XUyaNEnoAOx0EydOjOuvvz7q6upSfc6ysrJef/rTn67u379/idQBAODvKYABANjhKioqCh577LGLKyoqBqb5nNXV1XHNNdfE7NmzhQ7ALvPKK6/ElVdeGVVVVak+Z4sWLQZOnDhxbEVFhZ9vAQDA33CBDADADjdz5syftW3b9sA0n3HdunVx2WWXxRtvvCFwAHa5xYsXx2WXXRZr165N9TnbtWt34MyZM38mcQAA+P8UwAAA7FBPPvnkqB49eoxK8xlXrVoVV1xxRSxfvlzgADQZK1asiCuuuCJWrlyZ6nP26NFj1KRJk0ZJHAAA/lth5cDo+lFfaKyKqFmRtSEAALbZjTfeuO+XvvSlCzOZTGp/8fDdd9+NK6+8MtatWydwAJqc6urqmDVrVvTv3z8qKytTe85u3boN79mz57yHH37Yb2MBAJAXyjrXR0H5R39NAQwAwA5x3nnn9T311FOvLigoKE7rGV977bW45pprorq6WuAANFmbN2+OGTNmRI8ePaJ9+/apPGMmkykYNGjQIYWFhVOee+45v5UFAEDqKYABANipjjrqqFb/8R//8YdmzZq1SusZX3755bj++uujrq5O4AA0eQ0NDfHSSy9Fp06dolOnTqk8Y0FBQXbYsGGfnz9//qQ33nhjk9QBAEizLRXA3gEMAMB21a1bt+wNN9zwnyUlJR3TesYpU6bEjTfeGPX19QIHIDHq6+vjxhtvjKlTp6b2jCUlJZ1uuOGG/+jWrZu7GgAAyFsKYAAAtqunn376XyorK/dI6/kmTZoUd955ZzQ2NgobgMRpbGyMO+64I5588snUnrGysnLw008//UtpAwCQrxTAAABsN88///w3unTp8k9pPd/EiRNj3LhxkcvlhA1AYuVyubj//vtTXQJ36dLlS88+++yJ0gYAIB95BzAAANvFTTfdNPzII488L5PJZNJ4vsceeyzGjx8vaABS47XXXotmzZpF3759U3m+zp0779urV695Dz/88DJpAwCQNlt6B7ACGACAz+wXv/hF7x/+8IdXFxQUNEvj+R544IF45JFHBA1A6ixYsCDq6upiwIABqTtbJpPJDBo06ODGxsbnpk6dul7aAACkiQIYAIAd5oADDqj43e9+99tmzZq1TeP5xo0bF5MmTRI0AKm1aNGi2Lx5cwwcODB1ZysoKMjut99+w5577rnH33vvvc3SBgAgLbZUAHsHMAAA2yybzWbuvPPOfyktLe2exvNNmDBB+QtAXpg0aVI89NBDqTxbaWlpj3vuuedfstlsRtIAAOQDBTAAANvs+eef/06HDh0OTePZHn744Xj44YeFDEDeeOSRR+LPf/5zKs/WoUOHw5599tlvSxkAgHygAAYAYJvcd999hw8ePPjUNJ7t/vvvjwkTJggZgLzz2GOPxX333ZfKs+25554/+NOf/nSYlAEASDvvAAYAYKudccYZ3ceMGXN5QUFBcdrONnHixHjkkUeEDEDeWrx4cWSz2ejbt2/ajpbp06fPvn/5y18mz5w5c4OkAQBIsi29A1gBDADAVhk2bFjzG2+88Q/NmjVrl7azPfroo6l99CUAbI2FCxdGUVFR9OvXL1XnKigoKD7wwAP3e/LJJx9dsWJFnaQBAEiqLRXAHgENAMBWuffee39ZWlraPW3nevzxx+PBBx8UMAD8jz//+c8xceLE1J2rtLS0x3333fdLCQMAkFYKYAAAPrVJkyaN6tSp0xEpPFeMHz9ewADwD8aPHx+TJ09O3bk6der0hUmTJn1VwgAApJFHQAMA8Kmcd955fU888cR/z2QyRWk618yZM+Puu+8WMAB8jNdeey06duwYnTt3TtW5unbtuk9BQcHzzz333DopAwCQNN4BDADAZ3LEEUe0vOKKK67NZrOVaTrXyy+/HDfffHPkcjkhA8DHyOVyMXv27OjSpUt06tQpNefKZDJF++yzz/CpU6c+9u67726WNAAASeIdwAAAbLNsNpu55ZZb/q2kpKRjms61YMGCuPnmm6OxsVHIAPAJGhsb4+abb44333wzVecqLS3tcvfdd5+fzWYzUgYAIC0UwAAAbNGkSZO+3rZt2wPTdKZly5bFDTfcEPX19QIGgE+prq4urr322li+fHmqztWuXbsDH3/88VESBgAgLTwCGgCAj3XZZZcN+upXvzo2k8mk5hcH33///bjyyiujqqpKwACwlerq6uLll1+OIUOGRHl5eWrO1aVLl31LS0unPvPMM2ukDABAEngENAAAW61///4lJ5988q8ymUxRWs60YcOG+P3vfx8bN24UMABso40bN8bvfve7VP15WlBQkP3hD394ft++fYslDABA4q9vrQAAgI/y4IMPnl1WVtYrLeeprq6O3/zmN7Fq1SrhAsBntGrVqrjyyiujuro6NWcqKyvr8/DDD58lXQAAkk4BDADA/zF+/Pgju3XrdnRazlNfX5/KdxYCwK60fPnyuO6666K+vj41Z+rRo8dXx40bd4R0AQBIMgUwAAB/53vf+16nI4444py0nCeXy8Vtt90Wb7zxhnABYDt7/fXX47bbbotcLpeaMx155JHnfvvb3+4oXQAAkkoBDADA/6qoqCi4+OKLLywsLCxPy5nGjx8fs2bNEi4A7CCzZs2Khx56KDXnKSwsrPj1r399QUVFhZ+bAQCQSC5kAQD4XxMnThxdWVk5OC3nef7552PixImCBYAd7LHHHosXXnghNeeprKzc89FHHz1RsgAAJFFh5cDo+lFfaKyKqFmRtSEAgDxxwQUX7DZq1KgLM5lMYRrO8+qrr8Ytt9ySqkdSAkBT/7O3d+/e0a5du1Scp2PHjkNzudxzU6ZMWSddAACamrLO9VHwMc/wcwcwAADRt2/f4h//+McXZzKZVPwG4HvvvRc33HBDNDY2ChcAdpKGhoa47rrrYtmyZak4T0FBQfbss88e27dv32LpAgCQqGtZKwAAYPz48T8qKyvrkYazbNiwIX7/+99HbW2tYAFgJ9u0aVP8/ve/j40bN6biPGVlZb3GjRs3RrIAACSJAhgAIM/ddNNNw/v06XN8Gs5SX18f1157baxdu1awALCLrFmzJq699tqor69PxXn69ev3jd///vdDJQsAQFIogAEA8thBBx1Uceyxx/5rRGTScJ477rgjFi9eLFgA2MUWLVoUd955Z1qOU/CNb3zj34YNG9ZcsgAAJOIC1goAAPLXzTfffFZxcXG7NJxl4sSJMX36dKECQBMxbdq0mDRpUirOUlJS0unOO+88Q6oAACSBAhgAIE/913/914FdunT5UhrO8tprr8Wf//xnoQJAEzN+/PhYsGBBKs7SrVu3o2+66abhUgUAoKlTAAMA5KEvfelLlV/5yld+lYazrFixIq6//vpobGwULAA0MY2NjXHdddfFihUr0nCczHHHHfergw46qEKyAAA0ZQpgAIA8dPXVV5+ezWYrk36OmpqauPbaa2PTpk1CBYAmatOmTXHttddGTU1N4s+SzWbb3njjjT+RKgAATZkCGAAgz9x6663Du3Tp8uWknyOXy8Utt9wSK1euFCoANHErV66MW2+9NXK5XOLP4lHQAAA0dQpgAIA8MnTo0LKvfvWrv0jDWSZMmBBz584VKgAkxJw5c+Kxxx5LxVlGjRr1i6FDh5ZJFQCApkgBDACQR+64444fFRcXd0z6OV5++eV45JFHBAoACfPQQw+l4he4SkpKOt5xxx0/lCgAAE2RAhgAIE9cfvnlu/fs2XNU0s/xwQcfxB133JGKR0gCQL7J5XJx2223xZo1axJ/lp49ex57+eWX7y5VAACaGgUwAEAe6NatW/a73/3uv2YymURf/9XX18cNN9wQ1dXVQgWAhKqqqoobb7wx6uvrE32OTCZT8N3vfvdX3bp1y0oVAICmRAEMAJAHxo8ff0pZWVmvpJ/jnnvuiaVLlwoUABJuyZIlcd999yX+HGVlZT3Hjx9/ikQBAGhKFMAAACn385//vOeAAQNGJ/0c06dPjylTpggUAFJi8uTJMWPGjMSfY8CAAaN//vOf95QoAABNhQIYACDFstls5qyzzjo3k8kk+tGEK1asiLvvvlugAJAyd911V6xYsSLRZ8hkMtmzzjrr3Gw2m5EoAABNgQIYACDFxo0b98XKysq9knyG2trauOGGG6K2tlagAJAyf/1zfvPmzYk+R2Vl5V7jxo0bKVEAAJoCBTAAQEoNHz68/OCDDz4t6ee4//77Y/ny5QIFgJRavnx5jBs3LvHnGDFixI+HDRvWXKIAAOxqCmAAgJS69dZbT8tms22TfIYZM2bEc889J0wASLnJkyfHzJkzE32G4uLitrfffvtp0gQAYFdTAAMApNBVV121R48ePb6S5DOsXLky7rrrLmECQJ64++6744MPPkj0GXr27PnVK664Yg9pAgCwKymAAQBSprS0tOAb3/jGT5N8rdfY2Bi333679/4CQB6pqamJ2267LRobG5N8jIJvfvObZ5aWlvqZGwAAu+6i1AoAANJlwoQJX6uoqBiQ5DOMHz8+Fi1aJEwAyDNvvvlmPPjgg4k+Q4sWLQY9+OCDx0gTAIBdRQEMAJAiRx55ZOWwYcN+kOQzzJ07N5544glhAkCemjhxYixYsCDRZxg+fPiPjjjiiJbSBABgV1AAAwCkyBVXXHFyUVFRRVLnr6qqijvvvDNyuZwwASBP5XK5uP3226O6ujqxZygqKmrxm9/85mRpAgCwKyiAAQBS4vzzz+/Xu3fv45J8httvvz0+/PBDYQJAnlu3bl3cfvvtiT5D7969jz///PP7SRMAgJ1NAQwAkALZbDZz6qmn/jyTyST2+m769OkxZ84cYQIAERExe/bsmDFjRmLnz2QyBaeeeurPs9lsRpoAAOxMCmAAgBT44x//eERlZeXgpM6/du3auPfeewUJAPyde+65J9atW5fY+SsrKwf/6U9/+oIkAQDYmRTAAAAJ17dv3+JDDjnkR0k+w9133x01NTXCBAD+Tk1NTdx9992JPsPBBx/8o759+xZLEwCAnUUBDACQcHfdddc3S0pKOiV1/smTJ8e8efMECQB8pLlz58azzz6b2PlLSko63nPPPd+SJAAAO4sCGAAgwb70pS9VDhw48KSkzr9mzZoYP368IAGALXrggQdizZo1iZ2/f//+Jx111FGtJAkAwM6gAAYASLArrrji1MLCwvIkzp7L5eK2226LTZs2CRIA2KJNmzbFbbfdFrlcLpHzFxYWll1++eU/kCQAADuDAhgAIKF+8Ytf9O7evftXkjr/s88+G2+88YYgAYBP5Y033ojnn38+sfN369bt6F/96ld9JAkAwI6mAAYASKgf/vCHP8pkMom8nvvggw/igQceECIAsFXGjRsX69atS+TsmUym4NRTT/2xFAEA2NEUwAAACXTdddcNa9eu3YFJnD2Xy8Udd9wRtbW1ggQAtsqmTZvizjvvTOz8bdq02f+mm27aT5IAAOxICmAAgIQpLS0t+NrXvnZ6Uud/4YUXYuHChYIEALbJq6++GjNmzEjs/Mccc8zpFRUVfiYHAMAO42ITACBhbr/99oMrKip2S+LsGzZsiHHjxgkRAPhM7r///qiqqkrk7OXl5X3/67/+6wgpAgCwoyiAAQASpKKiouCwww47Nanz33vvvYn9YS0A0HRs2LAh7r///sTOf9BBB/1zq1atCiUJAMCOoAAGAEiQ+++//+iysrKeSZx9zpw58dJLLwkRANguXnjhhViwYEEiZy8tLe32xz/+8StSBABgR1AAAwAkRN++fYv33Xfff07i7LW1tXHvvfcKEQDYru6+++6oq6tL5Oz77bffKf379y+RIgAA25sCGAAgIW6++eZRxcXFbZM4+yOPPBJr164VIgCwXa1atSoee+yxRM6ezWbb3njjjV+TIgAA25sCGAAgAYYOHVq21157fSeJs7/33nvxxBNPCBEA2CEmTpwYK1asSOTsQ4YM+c7QoUPLpAgAwPakAAYASIBrr732xKKiosqkzZ3L5eKee+6JxsZGIQIAO0R9fX3cddddkcvlEjd7UVFR5bXXXnuCFAEA2J4UwAAATdwBBxxQMWDAgG8kcfYZM2bEW2+9JUQAYId6880348UXX0zk7AMGDPjG8OHDy6UIAMD2ogAGAGjirrrqqhOKiooqkjb3pk2b4oEHHhAgALBT3H///VFbW5u4uYuKilpcffXV7gIGAGC7UQADADRhBx10UEX//v0Teffvww8/HB9++KEQAYCdYv369TFhwoREzj5w4MBvHHDAARVSBABge1AAAwA0Yf/5n/95bGFhYfOkzb1q1aqYPHmyAAGAnerpp5+O1atXJ27uwsLC8ssuu2yUBAEA2B4UwAAATdQBBxxQMWjQoNFJnP3uu++O+vp6IQIAO1V9fX3cddddiZx99913/+bQoUPLpAgAwGelAAYAaKIuv/zyYwsLC8uTNvfcuXNjwYIFAgQAdokFCxbE3LlzEzd3UVFRi9/97ndflyAAAJ+VAhgAoAkaOnRo2aBBgxL37t+6urr405/+JEAAYJf605/+FHV1dYmbe/fdd//mkCFDSiUIAMBnoQAGAGiCfvOb33ylqKioZdLmfu655xL53j0AIF1Wr14dzz33XOLmLioqann11VcfLUEAAD4LBTAAQBPTq1evZoMHD/5m0uaurq6ORx55RIAAQJPwyCOPRHV1deLmHjJkyLe6deuWlSAAANtKAQwA0MTcdNNNxxQXF7dN2twTJkyIqqoqAQIATUJVVVUifzmtuLi43a233uouYAAAtpkCGACgCWnVqlXhXnvtdVLS5l61alU8++yzAgQAmpTJkyfHqlWrEjf30KFDR7dq1apQggAAbAsFMABAE3LLLbccXlJS0jlpcz/44INRX18vQACgSamvr48HH3wwcXOXlJR0vummmw6VIAAA20IBDADQRGSz2cwBBxzw7aTNvWjRonjppZcECAA0SS+99FIsXrw4cXOPGDHiO9lsNiNBAAC2lgIYAKCJuOaaa/YuLy/vm7S5H3roocjlcgIEAJqkXC6XyLuAy8vL+1111VV7SRAAgK2lAAYAaCK+8pWvfDdpM8+bNy8WLlwoPACgSVu4cGG8+uqrrg8BAMgLCmAAgCbgsssuG1RZWblPkmbO5XIxfvx44QEAifDAAw8k7qklrVu33veSSy7pLz0AALaGAhgAoAkYNWrUCUmbefbs2bFs2TLhAQCJsGzZsnjllVcSN/cJJ5xwovQAANgaCmAAgF3sn//5nzt37NjxiCTN3NjYGA888IDwAIBEGT9+fDQ0NCRq5k6dOn1h9OjRHaQHAMCnpQAGANjFfvSjH30tk8kk6rps2rRpsWrVKuEBAImyatWqeOGFFxI1cyaTKfzpT386SnoAAHxaCmAAgF1o0KBBpX369Plqkmaur6+PCRMmCA8ASKQJEyZEXV1dombu27fvV/r27VssPQAAPg0FMADALnTZZZcdXlRUVJGkmadOnRpr164VHgCQSOvXr48pU6YkauaioqLK3/zmN0dIDwCAT0MBDACwi2Sz2cy+++57UpJmrqurc/cvAJB4jz76aOLuAt5///1PymazGekBAPBJFMAAALvI1VdfPbSsrKx3kmaeMmVKbNiwQXgAQKJt2LAhnn/++UTNXFZW1ueqq67aS3oAAHwSBTAAwC7y5S9/+bgkzVtfXx8TJ04UHACQCo8//nji7gL+0pe+dLzkAAD4JApgAIBdYPTo0R3atm07IkkzT5s2LdatWyc8ACAVPvzww5g+fXqiZm7fvv2I0aNHd5AeAABbogAGANgFfvrTn47KZDKFSZm3vr4+HnnkEcEBAKnyyCOPRH19fWLmzWQyhT/96U+/JjkAALZEAQwAsJN16tQp26dPn6OTNLO7fwGANFq3bl1MmzYtUTP36dPnmE6dOmWlBwDAx1EAAwDsZFddddUB2Wy2dVLmbWxsjEmTJgmOVOvYsWN06OCJmgD5aNKkSdHY2JiYebPZbOurrrrqAMkBAPBxFMAAADvZiBEjvp6keV988cVYtWqV4Ei1Ll26xIUXXhinnXZadO3a1UIA8siqVavipZdecj0JAEBqKIABAHaiM844o3tlZeXeSZk3l8vFxIkTBUdeyGQyMXjw4PjVr34VY8aMcUcwQB55/PHHI5fLJWbeysrKvc8444zukgMA4KMogAEAdqJTTjnlqxGRScq8CxYsiPfee09w5JVMJhN77713XHjhhTFmzJho3769pQCk3HvvvRcLFy5M1B9X/3NdCQAA/4cCGABgJ+nVq1ezXr16fTlJM3v3L/nsr0XwBRdcECeffHK0bdvWUgBSLGnXPb169fpyr169mkkOAIB/pAAGANhJrrjiioOLiopaJmXeBN4JAztEYWFhDB8+PC688MIYPXp0VFZWWgpACi1YsCCWLVuWmHmLiopaXnnllYdIDgCAf6QABgDYSYYPH/6VJM2btHfhwY5WVFQUI0aMiEsuuSRGjx4dLVu2tBSAFMnlcvH4448naub99tvvK5IDAOAfKYABAHaC0aNHd6isrByalHnXrl0bL7/8suDgI/y1CL744ovjhBNOiBYtWlgKQEq89NJLsW7dusTMW1lZudfo0aM7SA4AgL+lAAYA2AlOP/30o5J07fXMM89EQ0OD4GALiouL47DDDouxY8fGqFGjoqyszFIAEq6hoSGeeeaZJI1c8D/XmQAA8P8vEq0AAGDHymazmX79+n05KfPW1tbGlClTBAefUnFxcYwcOTIuvfTSGDVqVJSWlloKQII9//zzUVtbm5h5+/Xr9+VsNpuRHAAAf6UABgDYwX7zm9/sWVJS0jkp886YMSOqq6sFB1uppKQkRo4cGZdcckkcffTRUVJSYikACVRdXR0zZ85M0p8/na+44orBkgMA4K8UwAAAO9gXvvCFLyVl1lwuF08//bTQ4DNo3rx5HHXUUXHJJZfEyJEjI5vNWgpAwjz11FORy+USM++RRx75ZakBAPBXCmAAgB1oyJAhpZ07dz4iKfO+/vrrsWLFCsHBdlBeXh6jRo2KSy+9VBEMkDArVqyI119/PTHzdunS5fD+/ft79AQAABGhAAYA2KHGjh17aGFhYWJeCOruX9j+KioqYtSoUXHxxRfH4YcfHkVFRZYC4LpouyosLGz+H//xHwdLDQCACAUwAMAOteeeex6ZlFnXrl0b8+bNExrsIK1atYrjjz8+LrroohgxYkQUFPh2DKApmzdvXqxZsyYx8+61115HSg0AgAgFMADADnPMMce0bt269b5Jmfe5556LxsZGwcEO1qZNmxg9enRcfPHFimCAJqyxsTGee+65JP35MvyYY45pLTkAAPykAQBgBznzzDMPz2Qyibjeqq+vj6lTpwoNdqK2bdvG6NGj47zzzovhw4crggGaoBdeeCHq6+sTMWsmkyk844wzDpUaAAB+wgAAsIP079//C0mZdc6cObFhwwahwS7QqVOnOPnkk+Pf/u3fYu+9945MJmMpAE3Ehg0bYvbs2YmZd8CAAR4DDQCAAhgAYEf43ve+16mysnKPpMybpMcbQlp17tw5xowZE7/61a8UwQBNyPPPP5+YWSsrKwd/73vf6yQ1AID8pgAGANgBTj755CMiIhHtzcqVK+P1118XGjQRXbt2jTFjxsQ555wTgwcPthCAXez111+PlStXJmXczMknn3y41AAA8psCGABgB+jXr19iHv88ZcqUyOVyQoMmpnfv3nHaaafFOeecE/3797cQgF0kl8vFlClTknQd6jHQAAB5TgEMALCdnX766d0qKip2S8Ks9fX1MW3aNKFBE9anT58466yz4pxzzonddtvNQgB2gWnTpkV9fX0iZq2oqNjt9NNP7yY1AID8pQAGANjORo8efURSZp03b15s3LhRaJAAffr0ibPPPjvOPPPM6Nmzp4UA7EQbN26MefPmuR4FACARFMAAANtZr169EvPetSQ9zhD4bwMGDIhf/vKXceaZZ0b37t0tBGAnmTp1apKuRw+TGABA/lIAAwBsR2eccUb38vLyvkmYdf369fHaa68JDRJqwIAB8S//8i9x2mmnRbdunvQJsKPNnz8/Pvzww0TMWl5e3u9HP/pRF6kBAOQnBTAAwHZ03HHHHZSUWWfMmBGNjY1CgwTLZDIxePDg+Nd//dcYM2ZMdOjQwVIAdpDGxsaYMWNGYub9xje+cYjUAADykwIYAGA76tOnz8FJmDOXyyXqMYbAlmUymdh7773jwgsvjDFjxkT79u0tBWAHeOGFF5J0XXqIxAAA8pMCGABgOznppJPat2zZcvckzLpkyZJYuXKl0CBl/loEX3DBBXHyySdH27ZtLQVgO1qxYkW8/fbbiZi1srJy0PHHH+8PAgCAPKQABgDYTr773e8eGBGZJMyapMcXAluvsLAwhg8fHhdeeGGMHj06KisrLQVgO5k+fXpSRi34/ve/f6DEAADyjwIYAGA72X333Q9Nwpz19fUxc+ZMgUEeKCoqihEjRsQll1wSo0ePjpYtW1oKwGc0c+bMqK+vT8SsAwcOPFRiAAD5RwEMALAdHHTQQRUtW7bcKwmzLly4MKqrq4UGeeSvRfDFF18cJ5xwQrRo0cJSALZRVVVVvP7664mYtVWrVkOHDx9eLjUAgPyiAAYA2A7OPvvsz2cymaIkzOrxz5C/iouL47DDDouxY8fGqFGjoqyszFIAtkFSnqaSyWSy55577uclBgCQXxTAAADbwe67735AEuasra2NOXPmCAzyXHFxcYwcOTIuvfRSRTDANpg9e3bU1dUlYtY99tjjAIkBAOQXBTAAwGfUqlWrwnbt2u2fhFnnzZsXtbW1QgMiIqKkpCRGjhwZY8eOjaOPPjpKSkosBeBT2LRpU8ybNy8Rs7Zv337/iooKPwMEAMgjLv4AAD6jCy+8cPeioqKKJMz64osvCgz4P5o3bx5HHXVUXHLJJTFy5MjIZrOWAvAJZs2alYg5i4qKWlx88cWDJAYAkD8UwAAAn9GBBx6YiMfqVVdXJ+ZOFWDXKC8vj1GjRsWll16qCAb4BPPmzYuamppEzHrQQQd5DDQAQB5RAAMAfEZdu3YdnoQ5582bF/X19QIDPlFFRUWMGjUqLr744jj88MOjqKjIUgD+QV1dXbz66quJmLVLly77SwwAIH8ogAEAPoNTTjmlY3l5+W5JmPXll18WGLBVWrVqFccff3xcdNFFMWLEiCgo8C0kwN966aWXEjFnRUXFbieddFJ7iQEA5AffvQMAfAYnnnji55MwZ21tbcyfP19gwDZp06ZNjB49OsaOHasIBvgb8+fPj9ra2iSMmvnud7/7eYkBAOQH37UDAHwGn/vc5/ZLwpwLFy6Muro6gQGfyV+L4PPOOy+GDx+uCAby3ubNm2PhwoWJmLVfv37DJQYAkB98tw4AsI1atWpV2Lp1672TMKvHPwPbU6dOneLkk0+Oc889NwYNGmQhQF6bPXt2IuZs06bN3hUVFX4WCACQB1z0AQBso/PPP39gYWFheVOfs76+PubMmSMwYLvr2bNn/OQnP4nzzjsv9t5778hkMpYC5J3Zs2dHfX19k5+zqKio4vzzzx8oMQCA9FMAAwBso/3333/fJMz5+uuvR01NjcCAHaZLly4xZsyYOOecc2Lw4MEWAuSV6urqeOONNxIx64EHHriPxAAA0k8BDACwjbp27ZqIxz/PnTtXWMBO0bt37zjttNPinHPOif79+1sIkDeScr3VvXv3vaUFAJB+CmAAgG0wZMiQ0srKyj2a+py5XM7jn4Gdrk+fPnHWWWfFOeecE7vttpuFAKk3e/bsyOVyTX7Oli1b7jlo0KBSiQEApJsCGABgG5x55pl7ZjKZbFOfc9myZbFu3TqBAbtEnz594uyzz44zzzwzevbsaSFAaq1bty6WL1/e5OfMZDLZs846a4jEAADSrcgKAAC23tChQ4clYc558+YJC9jlBgwYEAMGDIgFCxbE+PHjY+nSpZYCpM68efOiS5cuTX7OffbZZ5+ImC4xAID0cgcwAMA26Nix4z5JmHP+/PnCApqMAQMGxC9/+cs47bTTolu3bhYCpEpSrrs6deq0j7QAANJNAQwAsJWOOOKIlhUVFf2a+pxVVVWxaNEigQFNSiaTicGDB8e//uu/xpgxY6JDhw6WAqTCW2+9FVVVVU1+zoqKis8deuihLSQGAJBeCmAAgK108sknD46ITFOfc/78+dHY2CgwoEnKZDKx9957x4UXXhhjxoyJ9u3bWwqQaI2NjbFgwYJE/Cv4u9/97h4SAwBILwUwAMBW2n333fdMwpze/wskwV+L4AsuuCBOPvnkaNu2raUAiZWU66/BgwfvKS0AgPQqsgIAgK3Trl27wU19xlwul5Q7UAAiIqKwsDCGDx8e++yzT0ybNi0mTJgQ69evtxggURYsWBC5XC4ymab9sJgOHToMlhYAQHq5AxgAYCsMGjSotGXLlgOa+pzvvfdebNy4UWBA4hQVFcWIESPikksuidGjR0fLli0tBUiMDz/8MJYtW9bk52zZsuXA/v37l0gMACCdFMAAAFvhxz/+8aBMJtPkn6Li7l8g6f5aBI8dOzZOOOGEaNGihaUAibBw4cImP2Mmk8n+5Cc/GSAtAIB0UgADAGyFvffee88kzJmEHzwCfBrNmjWLww47LMaOHRujRo2KsrIySwGatKT8Il5SrmsBANh63gEMALAVunbtOqSpz1hfXx9vvvmmsIBUKS4ujpEjR8bBBx8czz77bDz++ONRXV1tMUCT8+abb0Z9fX0UFTXtH7t16dJlT2kBAKSTO4ABAD6lioqKgoqKikFNfc4lS5bE5s2bBQakUklJSYwcOTLGjh0bRx99dJSUeIUl0LTU1tbG0qVLm/ycLVu2HFRaWupngwAAKeQiDwDgUzr77LP7FhYWNvlnj7722mvCAlKvefPmcdRRR8Ull1wSI0eOjGbNmlkK4HpsKxQWFpafffbZvaQFAJA+CmAAgE9p//3375+EOV9//XVhAXmjvLw8Ro0aFf/+7/8eI0eOjGw2aymA67FP6fOf//xAaQEApI8CGADgU+rRo8fuTX3G2traePvtt4UF5J2KiooYNWpUXHzxxXH44Yc3+XdvAum2ePHiRLySo1evXoOkBQCQPgpgAIBPqXXr1k3+DoklS5ZEQ0ODsIC81apVqzj++OPj4osvjhEjRkRBgW97gZ2voaEhlixZ0uTnbNOmjQIYACCFfCcMAPApDBkypLR58+a9m/qcb775prAAIqJ169YxevToGDt2rCIYcF32MZo3b95n0KBBpdICAEgX3wEDAHwKp556av9MJtPkr53eeustYQH8jTZt2sTo0aPjvPPOi+HDhyuCAddlfyOTyRT84Ac/+Jy0AADSxXe+AACfwuDBg5v84/Hq6+tj0aJFwgL4CJ06dYqTTz45/u3f/i323nvvyGQylgLsUIsXL07Eqzn23HPPgdICAEgXBTAAwKfQpUuXAU19xnfeeSfq6uqEBbAFnTt3jjFjxiiCgR2utrY23n333SRc53oPMABAyiiAAQA+hZYtW/Zv6jN6/DPAp9elS5cYM2ZMnHvuuTF48GALAfL2+iwJ17kAAGwdBTAAwCcYPnx4eUlJSeemPqfHPwNsvV69esVpp50W55xzTvTvrwMB8u/6rLS0tPPw4cPLpQUAkB4KYACAT/Ctb31rt4ho8s8IXbx4sbAAtlGfPn3irLPOinPOOSd22203CwG2i4T8gl7m29/+dj9pAQCkhwIYAOAT7L777k2+CVi7dm1s2LBBWACfUZ8+feLss8+OM888M3r27GkhwGfy4Ycfxrp165r8nAMHDlQAAwCkSJEVAABsWadOnZr8D8TefvttQQFsRwMGDIgBAwbEggULYvz48bF06VJLAbb5Oq1Vq1audwEA2GkUwAAAn6CyslIBDJCnBgwYEP3794958+bFQw89FO+++66lAFtlyZIlsddeezX1613PvgcASBEFMADAFnTq1CnbvHnzXk19ziVLlggLYAfJZDIxePDg2GOPPeLll1+OBx98MFauXGkxQGqu05o3b967Xbt2RatXr66XGABA8nkHMADAFowZM6ZnJpPJNuUZGxsbPZoUYCfIZDKx9957x4UXXhhjxoyJ9u3bWwrwiZYuXRqNjY1NesaCgoLsqaee2kNaAADp4A5gAIAt2Hvvvfs29RlXrlwZtbW1wgLYSf5aBO+5554xa9asmDBhQqxevdpigI9UW1sb77//fnTu3LlJzzls2LC+EbFIYgAAyecOYACALejRo0eTL4DfeecdQQHsAoWFhTF8+PC48MILY/To0VFZWWkpQGKv15Jw3QsAwKejAAYA2ILWrVs3+ff/vvvuu4IC2IUKCwtjxIgRcckll8To0aOjZcuWlgIk7notCde9AAB8Oh4BDQCwBc2bN+/Z1GdUAAM0kW+wi4pixIgRsd9++8WUKVPiscceiw0bNlgMEO+9914SrnsVwAAAKeEOYACAj9G/f/+SkpKSjk19TgUwQNPSrFmzOOyww2Ls2LExatSoKCsrsxTIc0m4XistLe3Ut2/fYmkBACSfAhgA4GOccMIJ3Zr69dK6deuiqqpKWABNUHFxcYwcOTJ+/etfK4Ihz1VVVcX69eub+pgF3/zmN7tLCwAg+RTAAAAfY8iQIT2b+oxJeJwgQL77axE8duzYOProo6OkpMRSIA8l4botCde/AAB8MgUwAMDH6N69e8+mPqPHPwMkR/PmzeOoo46KSy65JEaOHBnNmjWzFMgjSbhuS8L1LwAAn0wBDADwMVq1atWjqc+4bNkyQQEkTHl5eYwaNSr+/d//PUaOHBnZbNZSIA8k4botCde/AAB8MgUwAMDHqKio6NXUZ1y+fLmgAJL750yMGjUqLr744jj88MOjqKjIUiDFknDd1rJly16SAgBIPgUwAMBHyGazmbKysq5NecbGxsZYtWqVsAASrlWrVnH88cfHxRdfHCNGjIiCAt+qQxqtWrUqGhsbm/SMJSUlXbPZbEZaAADJ5rtKAICPcNxxx7UrKCgobsozrl69Ourr64UFkBKtW7eO0aNHx9ixYxXBkEJ1dXXxwQcfNOkZCwoKio877rh20gIASDbfTQIAfITPf/7zXZr6jO+//76gAFKoTZs2MXr06Dj//PNj+PDhimBIkRUrVrgOBgBgh/NdJP+PvTuPr7I888d/nSwEkhD2HUQEUVRAoIiouCtq64Jabd1arVorbqO2tlXbaavTOu38Rqffdmpbu9rWpYogsqgFRXCttAIKArJDgAAJBLKQ5JzfH8WO4+DOcp6T9/v18jWvTv657ut6hNvnk/t+AICd2G+//bL+xVcSXiAC8PF17do1Lr300rj99ttj2LBhkUq5lRWSLgn7tyTsgwEAeH8FWgAA8H917txZAAxAVujevXtceeWVsXr16njiiSdi9uzZkclkNAYSKAn7tyTsgwEAeH8CYACAnWjXrp0roAHIKj169Igrr7wyli5dGpMmTYo5c+ZoCiRMEvZvSdgHAwDw/gTAAAA7UVxc3D3baxQAAzRPffr0ibFjx8aSJUti/PjxsWDBAk2BhEjC/i0J+2AAAN6fbwADAOxESUlJz2yur7q6Ourq6gwKoBnbb7/94l/+5V/ia1/7WhxwwAEaAglQV1cX1dXV9sEAAOxWAmAAgHc5/PDDSwsKCtpmc40VFRUGBUBERPTt2zduvPHGuOGGG2LffffVEMhy2b6PKygoaDt8+PASkwIASC4BMADAu5x44oldsr3GDRs2GBQA/8uAAQPiG9/4Rtxwww3Ru3dvDQH7uE+yH+5qUgAAyeUbwAAA79KvX7+sD4DXr19vUADs1IABA+LAAw+MuXPnxoQJE2LlypWaAlkkCTe5HHDAAV0i4i3TAgBIJgEwAMC7dO/evXO21+gEMADvJ5VKxaBBg2LgwIExe/bsGD9+fKxbt05jwD4uZ/bDAAC8NwEwAMC7tG/fvlO21ygABuDDSKVSMWzYsBg6dGjMnj07HnvsMbdIwF6WhBPASdgPAwDw3gTAAADv0rp166w/8ZCEF4cAZI+3g+BDDz00XnnllZg4caK/S8A+LtH7YQAA3psAGADgXUpKSrL6xENjY2Ns3rzZoAD4yPLz8+Pwww+P4cOHx/PPPx8TJ06MqqoqjYE9aPPmzdHY2BgFBdn7Wi7b98MAALw/ATAAwLu0bNmySzbXV1lZGZlMxqAA+Njy8/Nj1KhRMXLkyHjhhRcEwbAHZTKZqKqqio4dO9oPAwCwWwiAAQDepaioKKuvvKusrDQkAHaJgoKCGDVqVIwYMSJmzpwZkydPji1btmgM7IH9XDYHwNm+HwYA4P3laQEAwP8YPnx4SX5+fkk21ygABmBXa9GiRRx//PFxxx13xNlnnx0lJSWaAs14P5efn18yfPhwfxAAACSUABgA4B2OOOKIDtleo+//ArC7FBUVxejRo+P73/9+nH322VFcXKwpsBsk4cr1JOyLAQDYOQEwAMA79O3bt1221+gEMAC729tB8B133BGnn356tGrVSlOgme3n9ttvv7YmBQCQTAJgAIB36NSpkwAYAHYoKSmJz3zmM3HnnXfG6NGjo0WLFpoCzWQ/l4R9MQAAOycABgB4hw4dOrTN9hqTcGUgALmlpKQkzj777PjOd74To0aNivz8fE2BHN/PJWFfDADAzgmAAQDeoaysrG221ygABmBvad++fVx00UVx5513xgknnBCFhYWaAjm6nysrK3MCGAAgoQTAAADvUFJS0j6b68tkMlFdXW1QAOxV7dq1i/POOy+++93vxqhRoyIvz+sF+CiSsJ8rLS0VAAMAJJT/QgMAeIfi4uK22VxfXV1dNDY2GhQAWeHtE8F33HGHIBg+gsbGxqirq7MvBgBgt/BfZgAA79CqVausPung9C8A2ahDhw5x0UUXxbe//e04/PDDBcGQA/u6oqIiJ4ABABLKf5EBALxDQUGBABgAPqauXbvGpZdeGt/61rdi2LBhkUqlNAUSuq9r0aJFW1MCAEimAi0AAPgfhYWFZdlc39atWw0JgKzXrVu3uPLKK2P16tXxxBNPxOzZsyOTyWgMJGhfl+37YgAA3psAGADgnZujgoLW2VyfE8AAJEmPHj3iyiuvjKVLl8akSZNizpw5mgIJ2ddl+74YAID35gpoAIAdWrdunZefn98ym2sUAAOQRH369ImxY8fGLbfcEgMGDNAQSMC+Lj8/v1WrVq28OwQASCCbOACAHQYNGlQSEVn9scJt27YZFACJtd9++8UNN9wQX/va1+KAAw7QEJq1BOzr8gYPHlxsUgAAySMABgDY4YADDijJ9hpramoMCoDE69u3b9x4441xww03xL777qshNEu1tbVZX2P//v1LTQoAIHl8AxgAYIeePXtm/QuuJLwoBIAPa8CAATFgwICYP39+jBs3LpYvX64pNBtJ2Nf16NGjxKQAAJJHAAwAsEOnTp0EwACwFwwYMCAOPPDAmDt3bkyYMCFWrlypKeS8JOzrunbtKgAGAEggATAAwA5lZWVZ/4Krrq7OoADISalUKgYNGhQDBw6M2bNnx4QJE2Lt2rUaQ85KQgDcpk0bV0ADACSQABgAYIeysjIngAFgL0ulUjFs2LAYOnRozJ49O8aPHx/r1q3TGHKOABgAgN1FAAwAsENJSUlxttfoBDAAzcXbQfCQIUPi5ZdfjokTJ0ZFRYXGkDOSEAAnYX8MAMD/JQAGANihqKioKNtrrKmpMSgAmpW8vLw4/PDDY/jw4fH888/HE088EZWVlRpD4iUhAG7RokWRSQEAJI8AGABgh8LCwhbZXF86nY7t27cbFADNUn5+fowaNSpGjhwZL7zwQkycODGqqqo0hsTavn17ZDKZSKVSWVtjixYtWpgUAEDyCIABAHbI9gC4oaHBkABo9goKCmLUqFExYsSImDlzZkyePDm2bNmiMSROJpOJhoaGyOaMtbCw0AlgAIAk/neTFgAA7NgYFRRk9QuuxsZGQwKAHVq0aBHHH398HHnkkfHMM8/E1KlTY9u2bRpDomR7AJzt+2MAAN5jH6cFAAA7NkZZ/oLL9c8A8H8VFRXF6NGj49hjj41nnnkmpkyZEjU1NRpDImT7DS8FBQWugAYASCABMADA2xujLH/B5QpoAHhvbwfBRx11VEyfPj2efvrpqK2t1RiymgAYAIDdIU8LAAD+QQAMAMlXUlISn/nMZ+LOO++M0aNHZ/X1uiAABgBgdxAAAwDskO1XQAuAAeDDKykpibPPPjv+7d/+LUaPHh2FhYWagv3dR5Sfn9/SlAAAkkcADADw9sYoL88JYADIMa1bt46zzz47vve978UJJ5wgCMb+7iPIz8/3LwwAQAIJgAEAdkilUlm9N2psbDQkAPiY2rVrF+edd15897vfjRNOOCEKCgo0Bfu7D94f55sSAEDyCIABAHbI9gA4nU4bEgB8Qu3bt/9nEDxq1KjIy/NqBPu799kfp0wJACB5/FcOAMAOXnABQPPRoUOHuOiii+J73/ueIJi9JpPJZHuJ/sUAAEggmzgAgP+R1QFwAl4QAkDidOzYMS666KL41re+FYcffnj4fTDs796xOc7yG3IAANg5mzgAgITsjQTAALD7dOvWLS699NL41re+FcOGDRMEs0dk+xXQeXl5/kUAAEigAi0AAPiHbH/BJQAGgN2ve/fuceWVV8ayZcviiSeeiDlz5mgKzXl/5/AIAEACCYABAHbIZDJOAAMAERGx7777xtixY2PJkiUxYcKEmD9/vqZgfwwAQCIIgAEA/ocr7gCA/2W//faLG264Id56660YP358vPnmm5rCLpPtV0Cn3IUOAJBIAmAAgB2y/QVXtr8gBIBc1rdv37jxxhvjrbfeinHjxsWiRYs0hU/MFdAAANjEAQDsXln9Bs4BDADY+/r27Rs333xz3HDDDdG7d28NIdf3d75BAgCQQE4AAwDskO0nMATAAJA9BgwYEAMGDIj58+fHI488EitXrtQUcnF/5woaAIAEcgIYAGCHVCqVzvL6DAkAssyAAQPi1ltvjbFjx0bPnj01hJza32UScEc1AAD/lxPAAAD/QwAMAHysv6MHDRoUBx98cDz//PMxadKk2LRpk8aQ+P1dtv+CJAAAO+cEMADADul0dr/fEgADQHarr6+PioqK2LZtm2aQE/u7dDrtBDAAQAI5AQwA8D+cAAYAPrK6urp4+umnY9q0acJfcm1/5wQwAEACCYABAP6HEw4AwIfW0NAQ06ZNiyeffDK2bt2qIXxkCfgGsAAYACCBBMAAADtkMpmsDoDz8ny9AwCywdvB71NPPRXV1dUaQs7u7wTAAADJJAAGANgh219wCYABYO9qbGyMGTNmxJNPPhmVlZUawieWn5+f9VtkUwIASB4BMADADplMpiGb6yssLDQkANgL0ul0zJo1KyZPnhwbN27UEHaZgoLsfjXX1NTUaEoAAAncZ2oBAMA/NDY2bs/m+gTAALBnpdPpePnll2Py5Mmxdu1aDWGXa9GiRbb/O1BvSgAAySMABgDYoampSQAMAEQmk4nZs2fH448/HuXl5RpCs93fNTY2CoABABJIAAwAsENDQ0NWv+ASAAPA7vV28PvEE0/E6tWrNYTdLtuvgM72G3IAAHiPfaYWAAD8gyugAaD5mjNnTkyaNCmWLl2qGewx2X4FtAAYACCZBMAAADs0NTU5AQwAzcyCBQtiwoQJ8dZbb2kG9nfv0tDQIAAGAEggATAAwA7Z/oJLAAwAu87ChQtj/PjxsXjxYs1gr8n2K6Cz/RckAQB4j32mFgAA/EO2B8AFBQWRl5cX6XTasADgY1q+fHmMGzcu5s+frxnsVXl5eVkfAG/fvt0JYACABBIAAwDs0NDQkPUnHFq1ahXbtm0zLAD4iFauXBmPPPKI4Jes2tclYH8sAAYASCABMADADrW1tXXZXqMAGAA+mnXr1sX48eNj9uzZkclkNISs2tdlu7q6ulqTAgBIHgEwAMAOW7du3ZrtNSbhRSEAZIP169fHY489JvjFvu4TqK6u3mpSAADJIwAGANihqqpKAAwACbdhw4Z4/PHH45VXXommpiYNwb7uE6isrHT1DABAAgmAAQB22LRpU9a/4GrZsqVBAcBOVFVVxcSJE+OFF16IxsZGDSHrJSEA3rRpkxPAAAAJJAAGANhh3bp1WR8AOwEMAP/bli1bYsKECYJfEicJ+7ry8nIBMABAAgmAAQB2WLZsmSugASAhqqurY/LkyTFz5syor6/XEBInCfu6pUuXCoABABJIAAwAsMP8+fOz/gRwcXGxQQHQrNXU1MSUKVPimWeeEfySaEnY173++uu+AQwAkEACYACAHRYsWFCXyWQaUqlUYbbW2Lp1a4MCoFmqq6uLp59+OqZNmxbbtsmkSL5s39el0+mGpUuXbjcpAIDkEQADALxDU1PTtoKCgrbZWp8AGIDmZvv27TF9+vR48sknY+tWt9GSO7J9X9fU1ORfOACAhBIAAwC8Q0NDw9ZsDoBLS0sNCYDm8ndyTJs2LZ566qmorq7WEHJOtu/rGhsb/YsHAJBQAmAAgHeor6+vbNWqVc9src8JYAByXWNjY8yYMSOefPLJqKys1BByVrbv6+rr66tMCQAgmQTAAADv0NDQkNVvmgXAAOSqdDods2bNismTJ8fGjRs1hJyX7fu6bN8XAwDw3gTAAADvUFdXV5XN9ZWWlkYqlYpMJmNYAOSETCYTr732Wjz++OOxatUqDaFZSKVSUVJSktU11tbWVpkUAEAyCYABAN5h27Ztm7K5vvz8/GjVqlXU1NQYFgCJlslkYvbs2fH4449HeXm5htCstGrVKvLz87O6xq1btzoBDACQUAJgAIB3qK6u3pztNZaVlQmAAUist4PfiRMnxpo1azSEZqmsrCzra9y2bVuVSQEAJJMAGADgHaqqqjZle43t2rWLtWvXGhYAiTNnzpyYNGlSLF26VDNo1tq1a5f1NW7atMkJYACALNbQWBgFjQ0REZFKRSavMJre/pkAGADgHSoqKqqyvcYkvDAEgHdasGBBTJgwId566y3NgITs5zZs2CAABgDIYoUFDf9MejMRqab0/+S+AmAAgHdYtWpV1r/oatu2rUEBkAgLFy6M8ePHx+LFizUD3iEJAfDq1aurTAoAIJkEwAAA77BgwYKsD4CdAAYg2y1fvjzGjRsX8+fP1wzYiST8Ql8S9sUAAOycABgA4B2eeOKJjZlMpimVSuVna41OAAOQrVauXBmPPPKI4Bc+QLb/Ql8mk2l64oknNpoUAEAyCYABAN6huro6vX379g1FRUVdsrVGJ4AByDZr166NCRMmxOzZsyOTyWgIJHw/t3379g3V1dVpkwIASCYBMADAu9TV1a0XAAPAB1u/fn089thjgl/Isf1cXV3delMCAEguATAAwLvU1dVVtGnTJmvrKykpiRYtWsT27dsNC4C9oqKiIiZOnBivvPJKNDU1aQh8BEVFRVFcXJz1+2GTAgBILgEwAMC7bN26dV2XLll7ADhSqVR07Ngx1qxZY1gA7FFVVVUxceLEeP755wW/8DF17NgxUqlU1u+HTQoAILkEwAAA71JVVZX1Jx46deokAAZgj9m8eXM8/vjj8cILL0RjY6OGwCfcx9kPAwCwOwmAAQDeZf369Vn/zbMkvDgEIPm2bNkSU6ZMiZkzZ0Z9fb2GwC7QsWNH+2EAAHYrATAAwLusXr066088JOHFIQDJVVNTE1OmTIlnnnlG8Au7WBJ+kW/VqlUCYACABBMAAwC8y9///ves/+aZABiA3aG2tjYmT54czz77bNTV1WkINNN93KuvvioABgBIMAEwAMC7PPzww+t//OMfN6RSqcJsrbFz584GBcAus3379pg+fXpMnTo1tm3bpiGwG2X7CeB0Ot3w8MMPC4ABABJMAAwA8C7V1dXpurq68latWu2TrTV26NAh8vLyIp1OGxgAH1tDQ0NMmzYtnnrqqaiurtYQ2M3y8vKiQ4cOWV1jfX39mtraWptMAIAEEwADAOxEbW3tmmwOgAsKCqJdu3axceNGwwLgI2tsbIwZM2bEk08+GZWVlRoCe0j79u2joCC7X8fV1NSUmxQAQLIJgAEAdmLz5s2r2rdvn9U1duvWTQAMwEeSTqdj1qxZMXnyZH+HwF7av2W7LVu2rDQpAIBkEwADAOzEpk2bVvfp0yera+zWrVvMmzfPsAD4QG8Hv1OmTIkNGzZoCOzF/Vu227BhwxqTAgBINgEwAMBOrFixYvWwYcOyusYkvEAEYO/KZDLx0ksvxZQpU6K83K2usLd17do162tctWrVKpMCAEg2ATAAwE7Mnz9/9ZgxY7K6xiS8QARg78hkMjF79uyYOHFirFnjMB9kiyT8At+8efP8oQEAkHACYACAnRg3btyab37zm5mISGVrjU4AA7Azc+bMiSeeeCKWLVumGZBlEvALfJlx48atNikAgGQTAAMA7MTrr79e29DQsKmwsLBDttZYXFwcZWVlsWXLFgMDIBYsWBDjx4+PJUuWaAZkobKysiguLs7qGhsaGjYuWLCgzrQAAJJNAAwA8B62bt26vF27dh2yucauXbsKgAGauYULF8b48eNj8eLFmgFZLAm3t2zbtm25SQEAJJ8AGADgPVRVVS1t167d0GyusWfPnrFw4ULDAmiGli1bFo899ljMnz9fMyABevbsmfU1VlZWLjUpAIDkEwADALyHdevWLevTp09W15iEF4kA7ForVqyIRx99VPALCZOEfdvatWuXmRQAQPIJgAEA3sPChQuXHX744VldY69evQwKoJlYtWpVjB8/PubOnRuZTEZDIGGSsG9buHDhMpMCAEg+ATAAwHuYNm3a0ksuuSSra+zevXvk5+dHU1OTgQHkqHXr1sX48eNj9uzZgl9IqIKCgkR8A/jpp59eZloAADmw/9QCAICde+ihhzbcd999W/Pz80uzdjNXUBBdunSJNWvWGBhAjqmoqIiJEyfGyy+/HOl0WkMgwbp27RoFBdn9Gq6xsbH6kUce2WBaAADJJwAGAHgf27ZtW15WVnZwNtfYq1cvATBADqmqqoqJEyfG888/74YHyBFJ+P7vtm3blpsUAEBuEAADALyPLVu2LMv2ALhnz57x0ksvGRZAwm3evDkef/zxeOGFF6KxsVFDIIck4fu/W7ZsWWpSAAC5QQAMAPA+1q9fvyzbT2z06NHDoAASbMuWLTFlypSYOXNm1NfXawjkoCTs19avX7/MpAAAcoMAGADgfSxYsGDh0KFDs7rGfffdN1KpVGQyGQMDSJCampqYMmVKPPPMM4JfyGGpVCr23XffrK9z/vz5C00LACA3CIABAN7Ho48++uYFF1yQ1TWWlJRE586dY926dQYGkAC1tbUxefLkePbZZ6Ourk5DIMd17do1WrVqlfV1/vnPf15kWgAAuUEADADwPiZNmlRVX1+/oaioqGM217nvvvsKgAGy3Pbt22P69OkxderU2LZtm4ZAM9GnT5+sr7G+vr7iySefrDItAIDcIAAGAPgAW7duXZTtAXCfPn3ipZdeMiyALNTQ0BDTpk2Lp556KqqrqzUEmpkkXP+8detWp38BAHKIABgA4ANUVFQs7NChw8hsrjEJLxYBmpvGxsaYMWNGPPnkk1FZWakh0EwlYZ9WUVHh+78AADlEAAwA8AGWLl266MADD8zqGnv16hUFBQXR2NhoYAB7WTqdjlmzZsWkSZNi06ZNGgLNWGFhYfTs2TMR+13TAgDIHQJgAIAPMHPmzEWnnnpqdm/qCgqiZ8+esWzZMgMD2EveDn4nT54cGzdu1BAg9tlnn8jPz0/CfnexaQEA5I48LQAAeH+//OUvV6bT6bpsr7NPnz6GBbAXZDKZePHFF+O73/1u3H///cJf4J+ScP1zOp2u++Uvf7nStAAAcocTwAAAH6C6ujpdXV29uE2bNodkc539+vWL6dOnGxjAHpLJZGL27NkxceLEWLNmjYYAO92fJWCvu7i6ujptWgAAuUMADADwIWzYsGFetgfA/fv3NyiAPeTVV1+NSZMmxapVqzQD2KlUKpWI/dmGDRvmmhYAQG4RAAMAfAiLFy9+o2/fvlldY1lZWXTu3DnWr19vYAC7yYIFC2L8+PGxZMkSzQDeV5cuXaK0tDQJ+9z5pgUAkFsEwAAAH8JTTz31+ujRo7O+zv33318ADLAbLFy4MMaPHx+LFy/WDOBD78uSYMqUKa+bFgBAbsnTAgCAD/aLX/xiTWNjY1W215mUF40ASbFs2bK4++674z/+4z+Ev8BHkoTv/zY0NFTee++9q00LACC3OAEMAPAhNDQ0ZDZv3jy/Q4cOI7O5TgEwwK6xYsWKePTRR2P+fDejArm7L9uyZYs/5AAAcpAAGADgQ1q3bl3WB8AdO3aMNm3axObNmw0M4GNYtWpVjB8/PubOnRuZTEZDgI+lbdu20aFDh0Tsb00LACD3CIABAD6kefPmzTvooIOyvs4DDzwwXnrpJQMD+AjWrVsX48ePj9mzZwt+gV2yH0uCuXPnzjMtAIDcIwAGAPiQ/vznP88/77zzsr7OAw44QAAM8CFVVFTEuHHjBL/ALt+PJcHDDz/sBDAAQA4SAAMAfEgTJ06srK2tXdGqVat9srnOgw8+2LAAPkBVVVVMnDgxnn/++WhqatIQYJdKwq0xNTU1yydNmlRlWgAAuUcADADwEWzYsOHvvXr1yuoAuG3bttG1a9dYu3atgQG8y+bNm+Pxxx+PF154IRobGzUE2OW6desWbdu2TcS+1rQAAHKTABgA4CNYuHDha7169Toj2+scMGCAABjgHbZs2RJTpkyJ5557LrZv364hwG6TlO//Lly48O+mBQCQmwTAAAAfwcSJE/9+wgknZH2dBx54YEyfPt3AgGavpqYmpkyZEs8880zU19drCLDbDRgwIBF1jh8//u+mBQCQmwTAAAAfwb333rv6Bz/4wfqioqLO2VznAQccEHl5eZFOpw0NaJZqa2tj8uTJ8eyzz0ZdXZ2GAHtEXl5e9O/fP+vrrK+vX3ffffeVmxgAQG4SAAMAfESVlZVzu3btmtXHgFu1ahX77LNPLFu2zMCAZqWuri6efvrpmDZtWmzbtk1DgD1qn332iVatWmV9nZs2bZpjWgAAuUsADADwES1dunR2tgfAERGDBg0SAAPNRkNDQ0ybNi2eeuqpqK6u1hBgr+2/kuCtt976m2kBAOQuATAAwEc0ffr0v48cOTLr6xw4cGBMmDDBwICc1tDQEM8991w8+eSTUVlZqSHAXt9/JcG0adP+bloAALlLAAwA8BH9x3/8x9JbbrmlOj8/v3U219mrV68oKyuLLVu2GBqQc9LpdMyaNSsmTZoUmzZt0hBgrysrK4tevXplfZ2NjY1b7rnnnmUmBgCQuwTAAAAfUW1tbXrDhg1/7dKly3HZXGcqlYqBAwfGrFmzDA3IGW8Hv5MnT46NGzdqCJA1Bg4cGKlUKuvr3Lhx4yu1tbVpEwMAyF0CYACAj+Gtt956JdsD4IgQAAM5I51Ox8svvxxTpkyJ8vJyDQGyct+VBIsWLXrFtAAAcpsAGADgYxg/fvwrRxxxRNbXedBBB0VBQUE0NjYaGpBImUwmZs+eHRMnTow1a9ZoCJCVCgoK4qCDDkpErY888ogAGAAgx+VpAQDAR/fjH/94ZX19/fpsr7OoqCj69etnYEAivfrqq3HHHXfEz3/+c+EvkNX69esXRUVFWV9nXV1d+b333rvaxAAAcpsTwAAAH9OGDRte6dGjx6ezvc5BgwbFggULDAxIjCVLlsSECRNi/vz5mgEkwuDBgxNR5/r1653+BQBoBgTAAAAf07x5815OQgA8bNiwePjhhyOTyRgakNXefPPNmDBhQixevFgzgMRIpVIxdOjQRNQ6d+7cl0wMACD3CYABAD6m++677+XRo0dnIiKVzXW2bds2evfuHcuWLTM0ICstW7YsHnvsMSd+gUTq06dPtG3bNgmlpu+9996/mhgAQO4TAAMAfEwTJ06s3Lp165LS0tK+2V7rkCFDBMBA1lmxYkU8+uijgl8g0YYMGZKIOqurqxc+/fTTm00MACD3CYABAD6B8vLyl/fff/+sD4AHDx4c48aNMzAgK6xcuTImTJgQc+fOdT09kHhJ+f7vmjVrfP8XAKCZEAADAHwCM2fOfG7//ff/fLbX2a1bt+jWrVuUl5cbGrDXrFu3LsaPHx+zZ88W/AI5oWfPntGlS5dE1DpjxoznTAwAoHkQAAMAfAK33Xbba5dcckl1fn5+62yvdciQIQJgYK9Yv359PPbYY4JfIOck5frnxsbGzbfddts8EwMAaB4EwAAAn0BlZWXThg0b/tqlS5fjsr3WQw89NCZNmmRowJ78MzKeeOKJeP7556OpqUlDgJxz6KGHJqLOioqKV6qrq9MmBgDQPAiAAQA+oXnz5s1MQgDcu3dv10ADe0RVVVVMnDgxXnjhhWhsbNQQICd17949evbsmZT9quufAQCakTwtAAD4ZP77v/97VkQk4kTFpz71KQMDdpstW7bEQw89FLfffns899xzwl8gpw0fPjwRdWYymfTdd9/9gokBADQfTgADAHxCkyZNqtqyZcuCsrKyg7K91uHDh8fjjz9uaMAuVVNTE1OmTIlnnnkm6uvrNQTIealUKg477LBE1Lply5bXp0+fvsXUAACaDwEwAMAusHz58lkDBw7M+gC4S5cu0atXr1i5cqWhAZ9YbW1tTJ48OZ599tmoq6vTEKDZ6N27d3Ts2DEx+1QTAwBoXgTAAAC7wLPPPvvCwIEDr0hCrcOGDRMAA59IXV1dPP300zFt2rTYtm2bhgDNzrBhwxJT61/+8pcXTQwAoHnxDWAAgF3g1ltvnV9fX782CbUefvjhkUqlDA34yBoaGmLq1Klx6623xuOPPy78BZqlJF3/XFdXt/rWW29dYGoAAM2LE8AAALtAQ0NDZs2aNc/16dPns9lea7t27aJPnz6xZMkSgwM+7J9xMW3atHjqqaeiurpaQ4Bmbb/99ou2bdsmotbVq1fPNDEAgOZHAAwAsIs8++yz05IQAEdEHHHEEQJg4AOl0+mYNWtWTJo0KTZt2qQhABFx5JFHJqbW6dOnTzMxAIDmxxXQAAC7yC233PJaQ0NDZRJqHT58eLRo0cLQgJ1Kp9Px3HPPxW233Rb333+/8Bdgh6KiovjUpz6ViFobGho23HLLLXNNDQCg+XECGABgF6murk6Xl5c/t88++5yR7bW2bNkyDj300Hj55ZcNDvindDodL7/8ckyZMiXKy8s1BOBdhgwZEkVFRYmodc2aNc/V1tamTQ0AoPkRAAMA7EIvvvjiM0kIgCMiRo4cKQAGIiIik8nE7NmzY+LEibFmzRoNAXif/VNSzJo161kTAwBongTAAAC70O233/7KOeecszU/P78022sdMGBAtG/f3tWu0My9+uqrMWnSpFi1apVmALyPjh07xgEHHJCIWhsbG6u/8Y1v/NXUAACaJwEwAMAutHLlyob169fP6tat2+hsrzWVSsXhhx8ekyZNMjhohubMmROTJ0+OJUuWaAbAh3D44YdHKpVKRK3r16+fVVFR0WhqAADNU54WAADsWq+++mpirts77LDDDAyamTfffDP+/d//PX7yk58IfwE+pFQqFSNGjEhMva+88sozpgYA0Hw5AQwAsIvddNNNz5166qnV+fn5rbO91m7dukX//v1j4cKFBgc5btmyZfHYY4/F/PnzNQPgIzrggAOic+fOiai1sbFxy4033jjL1AAAmi8BMADALrZy5cqG8vLyGT179vx0Euo9+uijBcCQw5YvXx7jxo0T/AJ8wv1SUpSXlz9TXl7eYGoAAM2XABgAYDeYMWPGUxdccEEiAuAhQ4ZE69ato7q62uAgh6xcuTImTJgQc+fOjUwmoyEAH1ObNm3i0EMPTUy9zz777FOmBgDQvPkGMADAbvDVr371lYaGhk1JqLWgoCCOOOIIQ4McsW7duvj5z38ed955Z8yZM0f4C/AJjRw5MvLz8xNRa0NDw8abbrrpVVMDAGjenAAGANgNKisrm1atWjW9T58+5ySh3qOPPjqefPJJQREk2Pr16+Oxxx6L2bNn+3cZYBdJpVIxatSoxNS7cuXKadXV1WmTAwBo3pwABgDYTaZNm5aY6/c6duwYAwYMMDRIoA0bNsSvf/3r+Nd//dd49dVXhb8Au9CAAQOiY8eOian36aefftLUAAAQAAMA7CZf+9rX5tTX11ckpd6jjjrK0CBBqqqq4v77749vf/vb8eKLL0ZTU5OmAOxiRx55ZGJqra+vX/eNb3zjdVMDAMAV0AAAu0ltbW16xYoVT++///6fT0K9hx56aLRt2zaqqqoMD7LYli1bYsqUKfHcc8/F9u3bNQRgN2nbtm0MGTIkMfUuX778qdraWtc/AwDgBDAAwO70xz/+cUJSas3Pz4/jjjvO0CBL1dTUxKOPPhq33XZb/OUvfxH+Auxmxx57bOTn5yel3Myvf/3rCaYGAECEABgAYLe66667llZXV89PSr1HH310tGjRwuAgi7wd/H7jG9+IqVOnRn19vaYA7GYtWrSIo48+OjH1btmy5Y177rlnhckBABDhCmgAgN3u9ddfn3T44YcPSEKtxcXFcdhhh8XMmTMNDvayurq6ePrpp2PatGmxbds2DQHYgw477LAoKSlJTL3z5s17wtQAAHibE8AAALvZ9773vanpdLohKfWecMIJkUqlDA72koaGhpg6dWrceuut8fjjjwt/AfawVCoVJ5xwQmLqTafT27/73e8+ZXIAALzNCWAAgN1s+vTpWyoqKmZ26dIlER/Y7d69e/Tv3z/efPNNw4M9qKGhIaZNmxZPPfVUVFdXawjAXnLAAQdE9+7dE1NvRUXFczNmzPAXBwAA/+QEMADAHjBr1qxEXcuXpFMvkHTpdDqee+65uP322+PRRx8V/gLsZccff3yi6p0xY8YkUwMA4J2cAAYA2AO++tWvvnT66adXFRYWtk1CvQMHDoyOHTvGhg0bDA92k3Q6HbNmzYrJkyfHxo0bNQQgC3Ts2DEGDhyYmHobGhoqb7755pdMDgCAd3ICGABgDygvL29YsWLF1MRsEvPy4sQTTzQ42A3S6XS8+OKL8Z3vfCfuv/9+4S9AFjnppJMiLy85r8tWrFgxpaKiotHkAAB4JwEwAMAe8qtf/erRiMgkpd6jjjoqysrKDA52kUwmE6+++mp873vfi1//+texdu1aTQHIImVlZXHUUUcl6q+W//7v//6zyQEA8G4CYACAPeQ///M/l1dWVv4tKfUWFhbGMcccY3CwC7wd/P785z+PNWvWaAhAFjruuOOioCA5X0urqqqa/dOf/nS1yQEA8G4CYACAPeill14al6R6jzvuuCgqKjI4+JjmzJkTd911V/z85z+P1au9owfIVkVFRYn7xbcXXnhhnMkBALAzBVoAALDnjB079pkFCxZUFhYWtktCvSUlJXHEEUfE9OnTDQ8+gjfffDPGjx8fb731lmYAJMCRRx4ZJSUliam3oaFh0zXXXPOsyQEAsDMCYACAPai8vLxh6dKlE/v3739xUmo+8cQT49lnn410Om2A8AEWLVoUjz32WCxevFgzABIiLy8vTjzxxETVvGTJkifKy8sbTA8AgJ3ucbUAAGDP+u1vfzsxIjJJqbdjx44xdOhQg4P3sXz58rj77rvjRz/6kfAXIGGGDRsWHTp0SFLJmd/85jePmxwAAO9FAAwAsIf953/+5/JNmza9kqSaTz/99EilUoYH77Jy5cr4yU9+Et///vdj/vz5GgKQMHl5eXHGGWckquZNmza9fM8996wwPQAA3osroAEA9oKXXnpp/KmnnnpYUurt2rVrDBkyJGbPnm14EBHr1q2L8ePHx+zZsyOTyWgIQEINHTo0OnfunKiaX3jhhQkmBwDA+xEAAwDsBZdffvkzS5YsWVdUVNQlKTWfccYZ8be//U3YRbO2fv36eOyxxwS/ADkglUrF6aefnqia6+rq1lx22WXTTQ8AgPcjAAYA2AsqKyub5s+f/8ihhx56dVJq7tatm1PANFsbNmyIxx9/PF555ZVoamrSEIAc8KlPfSq6du2aqJrfeOONcdXV1WnTAwDg/fgGMADAXvL1r399XDqdrktSzb4FTHNTVVUV999/f3z729+OF198UfgLkCNSqVR8+tOfTlTN6XS69pvf/OZjpgcAwAdxAhgAYC+ZMWNG9Zo1a/7Ss2fPxLx97N69ewwcODDmzJljgOS0LVu2xIQJE+KFF16IxsZGDQHIMYceemh069YtUTWvXr36qRkzZlSbHgAAH8QJYACAvejXv/71HyMiUR8SPeuss5wCJmdt27YtHn300bjtttviueeeE/4C5KC8vLwYM2ZM0srO/OpXv/qT6QEA8KH2vFoAALD3fP/733+rqqoqUR/V7dGjR3zqU58yPHJKfX19TJ06Nb71rW/F1KlTo76+XlMActSIESOiS5cuiap506ZNf73rrruWmh4AAB+GABgAYC975plnHkpazWeccUbk5dlKkjvmzZsXjz76aGzdulUzAHJYQUFBnH766Ymre9q0aQ+aHgAAH5a3dgAAe9nYsWNn1tfXr01SzZ07d47DDjvM8ACARBk5cmR06NAhUTXX1dWtHjt27POmBwDAhyUABgDYyyorK5tee+21Pyat7jPPPDMKCgoMEABIhBYtWiTy9O/s2bP/UF1dnTZBAAA+LAEwAEAWuOqqqyY0NjZWJanm9u3bx9FHH214AEAiHHfccdGmTZtE1dzQ0LDxiiuumGh6AAB8FAJgAIAssGDBgrqFCxc+lrS6R48eHYWFhQYIAGS1li1bxsknn5y4uhcuXDhu6dKl200QAICPQgAMAJAlvv71r/8pnU7XJqnmtm3bximnnGJ4AEBWO+2006K0tDRRNTc1NdV+7Wtfe8j0AAD4qATAAABZ4umnn968fPnyxF3xN3r06GjXrp0BAgBZqUOHDnH88ccnru5ly5ZNmD59+hYTBADgoxIAAwBkkbvvvvtPmUymKUk1FxYWxumnn254AEBWOvPMMxP3yYpMJtN41113/dH0AAD4OATAAABZ5Be/+MWatWvXTkta3UcccUT06tXLAAGArNK7d+847LDDEld3eXn5X+6///51JggAwMchAAYAyDIPP/zwn5JWcyqVijPPPNPwAICsMmbMmEilUomr+8EHH/yT6QEA8HEJgAEAsszXv/71NzZs2DAraXUPHDgwDj74YAMEALLCoEGDYsCAAYmru6KiYuatt966wAQBAPi4BMAAAFlo3Lhxv01i3WPGjIm8PFtMAGDvysvLizFjxiSy9j//+c+/NUEAAD7RflgLAACyz/XXXz+nqqrqr0mru1evXnHUUUcZIACwVx1zzDHRvXv3xNW9adOmV2666aa5JggAwCchAAYAyFJ/+tOf7k1i3WPGjInS0lIDBAD2ijZt2sRZZ52VyNofeOCBe00QAIBPSgAMAJClbrrpprlJPAVcXFwcZ555pgECAHvFWWedFS1btkxc3Zs2bXrl5ptvnmeCAAB8UgJgAIAsNm7cuF8lse5Ro0ZF7969DRAA2KP69OkTI0eOTGTtjz322K9MEACAXUEADACQxcaOHTu7qqrqb0mrO5VKxfnnnx+pVMoQAYA9tv/4/Oc/n8j9R2Vl5d+uueaav5kiAAC7ggAYACDLTZ069bdJrLtv374xZMgQAwQA9ojDDjsssTeQTJ48+TcmCADAriIABgDIcpdeeumLVVVVryax9s9//vNRXFxsiADAblVaWhrnn39+Imuvqqr66+WXX/6SKQIAsKsIgAEAEuChhx76WRLrLisri9NPP90AAYDd6qyzzoqSkpIklp753e9+91MTBABgVxIAAwAkwA033DB3w4YNs5JY+3HHHRd9+vQxRABgt+jbt28cddRRiay9oqJi1te//vU3TBEAgF1JAAwAkBA///nPfxoR6aTVnUql4vOf/3zk5dl6AgC7Vn5+flx00UWRSqWSWH76F7/4xX+bIgAAu5q3cAAACXHHHXe8tW7duulJrL13795xzDHHGCIAsEudcMIJ0b1790TWXl5e/pc77rjjLVMEAGBXEwADACTI3XfffW8mk2lKYu1nnXVWtG3b1hABgF2iQ4cOcfrppyey9kwm03T33Xf/3BQBANgdBMAAAAlyzz33rCgvL386ibW3bNkyzj33XEMEAHaJc889N1q0aJHI2tesWTP1xz/+8UpTBABgdxAAAwAkzA9/+MOfZzKZhiTWPnz48Bg0aJAhAgCfyKGHHhpDhw5NZO3pdLrhBz/4wS9MEQCA3UUADACQMPfee+/qRYsWPZDU+i+++OIoKSkxSADgY2ndunVcfPHFia1/4cKFf7jvvvvKTRIAgN1FAAwAkECXXXbZrxsaGjYlsfaysjJXQQMAH9u5554bpaWliay9oaFh4+WXX/47UwQAYHcSAAMAJNDs2bNrXn311V8ntf4jjjgiDj74YIMEAD6SwYMHx+GHH57Y+l955ZX7Zs+eXWOSAADsTgJgAICEOueccx6tqalZmtT6L7roomjZsqVBAgAfSsuWLeNzn/tcYuuvqalZMmbMmMdMEgCA3U0ADACQUJWVlU3Tpk37RVLrb9++fZx++ukGCQB8KGeccUa0b98+sfU/+eST91ZXV6dNEgCA3U0ADACQYOedd960qqqqV5Ja/wknnOAqaADgAx188MFx/PHHJ7b+TZs2vXzBBRc8a5IAAOwJAmAAgIT74x//eG9EZJJYeyqVigsuuMBV0ADAe2rZsmVccMEFkUqlkrqEzP333/8zkwQAYE8RAAMAJNzNN988b9WqVU8ktf6OHTsm+nt+AMDudcEFF0THjh0TW/+KFSse//rXv/6GSQIAsKcIgAEAcsCNN974k6ampq1JrX/kyJExdOhQgwQA/pdPfepTMWLEiMTW39TUVH3zzTf/t0kCALAnCYABAHLAxIkTK//+97//KslruPDCC6OsrMwwAYCIiGjTpk18/vOfT/QaZs+efd/EiRMrTRMAgD1JAAwAkCPOPvvsh2pqapYntf7S0tK46KKLDBIAiFQqFV/84hejtLQ0sWuoqal566yzznrYNAEA2NMEwAAAOaKioqJx0qRJP07yGgYPHhwjR440TABo5o444og46KCDEr2GJ5544qeVlZVNpgkAwJ4mAAYAyCGXXHLJzIqKihlJXsMFF1wQ3bp1M0wAaKZ69uyZ+KufKyoqZnzhC1+YZZoAAOwNAmAAgBzzb//2b/ek0+ntSa2/RYsWceWVV0ZhYaFhAkAzU1hYGF/60pcSvQ9Ip9Pb/+3f/u0e0wQAYG8RAAMA5Jh777139aJFix5M8hq6d+8eZ555pmECQDNzxhlnRPfu3RO9hsWLFz947733rjZNAAD2FgEwAEAO+uxnP/vL2traRL94PPHEE2Pw4MGGCQDNxKBBg+Kkk05K9Bpqa2tXn3vuub80TQAA9iYBMABADlq8eHH9uHHj/j3Ja0ilUnHJJZdE27ZtDRQAclybNm3ikksuiVQqleh1jBs37t8XL15cb6IAAOxNAmAAgBx1+eWXv1RRUTEjyWsoLS2NL3zhC4l/GQwAvLe3f+mrdevWiV5HRUXFM5dffvlLJgoAwN4mAAYAyGE33HDDXU1NTVuTvIaDDjrI94ABIId95jOfiUMOOSTRa2hqaqq+4YYbfmiaAABkAwEwAEAOGzdu3MbZs2cn/jt0p5xyiu8BA0AOOuSQQ+LTn/504tfx17/+9efjxo3baKIAAGQDATAAQI77zGc+81B1dfXCJK8hlUrFF7/4xejQoYOBAkCO6NixY3zpS19K/KceNm/ePO+00057xEQBAMgWAmAAgBxXXV2dfuCBB34UEekkr6O4uDguvfTSyMuzhQWApMvPz4/LLrssiouLk76U9P333/+ftbW1aVMFACBbeHsGANAMXH/99XMWLVr0YNLXsf/++8e5555roACQcOedd1707ds38etYuHDhH7/61a++bqIAAGQTATAAQDNxySWX/Lyurq486es4/vjjfQ8YABJs2LBhccwxxyR+HXV1dWsuvPDC+0wUAIBsIwAGAGgmXnvttdoHHnjguxGRSfI6UqlUfOlLX4oePXoYKgAkTO/evePSSy9N/Hd/IyLzwAMPfO/111+vNVUAALKNABgAoBm5+uqr/7Z06dJHk76OoqKiGDt2bJSWlhoqACRE69at46qrrorCwsLEr2X58uXjrr766r+ZKgAA2UgADADQzJx33nn/r66ubnXS19GhQ4e4/PLLIy/PlhYAsl1eXl5cfvnl0b59+8Svpb6+ft0ll1zyE1MFACBr999aAADQvLz++uu1Dz744Pcj4VdBR0QMGDAgzjrrLEMFgCw3ZsyYOPDAA3NiLY899tgPXnnllW2mCgBAthIAAwA0Q1/5ylf+umbNmqm5sJaTTz45Dj30UEMFgCw1ZMiQOOmkk3JiLWvXrv3LpZde+oKpAgCQzQTAAADN1GWXXfYf9fX1FUlfRyqViksvvTS6d+9uqACQZXr06BFf/OIXI5VKJX4tDQ0Nm6655pofmioAANlOAAwA0EzNmDGj+oEHHvhO5MBV0C1btozrr78+2rZta7AAkCXatWsX1113XbRs2TIXlpN56KGH/nXSpElVJgsAQLYTAAMANGNf+cpX/rpkyZI/58Ja2rZtG1dffXW0aNHCYAFgL2vRokVcffXVOfPLWUuXLn30iiuueNlkAQBIAgEwAEAzd+655/6ktrZ2eS6spXfv3jlzzSQAJNXbn2fYZ599cmI9tbW1y88555wfmywAAEkhAAYAaOYWLFhQ97Of/ezbmUymMRfWM2zYsDjllFMMFgD2kk9/+tMxdOjQnFhLJpNp/NnPfvbtBQsW1JksAABJIQAGACBuvfXWBfPnz78/V9Zz5plnxuDBgw0WAPaw4cOHx2c+85mcWc/8+fN/d+utty4wWQAAkkQADABARESMGTPmvpqamrdyYS2pVCouu+yy6Nmzp8ECwB7Su3fvuPjii3PmUwxbt25ddPrpp//aZAEASBoBMAAAERGxcuXKhh/+8Ie3pdPpnLjisGXLlvEv//Iv0aVLF8MFgN2sS5cucf3110dRUVFOrKepqanmu9/97jfKy8sbTBcAgKQRAAMA8E933XXX0ueff/6eXFlPaWlpXHvttVFWVma4ALCblJWVxXXXXRclJSU5s6aZM2fe/f/+3/9bZboAACSRABgAgP/l5JNPHldeXv50rqynU6dOMXbs2Jw5kQQA2aSoqCiuueaa6NixY86sqby8/MlTTz11gukCAJBUAmAAAP6PSy655K66urq1ubKefffdN6644orIy7P9BYBdJS8vL6688sro3bt3zqyprq6u/JJLLvmh6QIAkOi9uhYAAPBus2bNqn7ooYfujIh0rqxp4MCBcd555xkuAOwi559/fhxyyCG5tKT0gw8+eOesWbOqTRcAgCTLb3tQ9NzpjndbRG15oQ4BADRTEydOXDNmzJi8Tp06Dc2VNfXp0yfy8/PjzTffNGAA+ATOOuusOOmkk3JqTa+//vp9Z5555kTTBQAgCYq7N0Ze6c5/5gQwAADv6dRTT/31li1bXs+lNZ122mlx9NFHGy4AfEzHHntsnHrqqTm1pi1btrxx2mmn/cZ0AQDIBQJgAADeU0VFReONN974jcbGxqpcWtcFF1wQRx55pAEDwEd05JFHxuc+97mcWlNjY2PVzTff/I2KiopGEwYAIBcIgAEAeF9//OMf1z/yyCPfiRz6HnAqlYqLLroohgwZYsAA8CENHTo0LrrookilUrm0rPQjjzzynfvvv3+dCQMAkCsEwAAAfKBLL730hQULFvwupzbCeXnxpS99Kfbff38DBoAPcNBBB8WXvvSlyMvLrVdJCxYs+N2ll176ggkDAJBLBMAAAHwoo0eP/mVVVdXcXFpTYWFhfOUrX4kePXoYMAC8h169esUVV1wRBQUFObWuqqqqOaNHj/6lCQMAkGsEwAAAfCgVFRWNV1111S0NDQ0bcmldJSUlcfPNN8c+++xjyADwLr17946bbropiouLc2pdDQ0NG6666qqv++4vAAC5SAAMAMCHNmHChE3333//tzKZTDqX1lVcXBzXXXdddO/e3ZABYIfu3bvHtddeG61atcqpdWUymfT999//rQkTJmwyZQAAcpEAGACAj2Ts2LGz58+f/9tcW1fr1q3juuuuiw4dOhgyAM1ehw4d4rrrrovWrVvn3Nrmz5//m7Fjx842ZQAAcpUAGACAj+y44477xaZNm17MtXW1a9cubrzxxmjXrp0hA9BstW3bNmf/Pty4ceOLxx13nO/+AgCQ0wTAAAB8ZNXV1emLL774W3V1datzbW0dO3aMG2+8Mdq0aWPQADQ7ZWVlceONN0bHjh1zbm21tbWrL7zwwturq6vTJg0AQC7Lb3tQ9NzZD9LbImrLC3UIAICdWrZsWf327dtfOvbYY0/Ny8trkUtrKykpiaFDh8Zrr70WNTU1hg1As9ChQ4f42te+Fp06dcq5tTU1NW39zne+M/bBBx9cb9IAAOSC4u6NkVe6858JgAEA+NhefPHFzYcccsiyAQMGnBgRqZzaRBcXx5AhQ4TAADQLHTt2jJtuuik6dOiQi8tLjx8//ravfvWrc0waAIBc8X4BsCugAQD4RC688MIZb7zxxm9ycW3t27ePm266KSdPQgHA2zp16pTL4W+88cYbv77wwgufM2kAAJoLATAAAJ/YqFGjfrFhw4aZubi2t0Pgzp07GzQAOadz585x0003Rfv27XNyfRs2bJg5atSo+0waAIDmRAAMAMAnVltbm77sssu+V1dXtzoX19euXbu44YYbomPHjoYNQM7o0KFDXH/99dGuXbtc3Z+s/sIXvvDd2tratGkDANCc+AYwAAC7xJIlS+oj4pVRo0admpeX1yLX1ldcXBxDhw6NuXPnxrZt2wwcgETr0qVL3HjjjTl77XNTU1P1nXfeec0f/vCHdaYNAEAuer9vAAuAAQDYZWbNmlXVo0ePuYceeujoVCqVn2vra9WqVYwYMSIWLVoUlZWVBg5AIu23335x0003RVlZWU6uL51ON/z617++4fbbb3/TtAEAyFUCYAAA9phJkyatPeqoozbsu+++R+fi+goLC2P48OGxbNmy2LBhg4EDkCgDBgyIa6+9Nlq1apWza5w2bdq/XXLJJc+ZNgAAuez9AmDfAAYAYJc77bTTHn/rrbcezNX1FRUVxTXXXBNDhgwxbAASY8iQIXHNNddEUVFRzq5xwYIFvzv99NOfMG0AAJozATAAALvFEUcccc+GDRtm5ur6CgoK4sorr4wjjjjCsAFIwt/LceWVV0ZBQUHOrrG8vPypESNG/LdpAwDQ3AmAAQDYLaqrq9MXXXTRd2pra1fk7GY6Ly8uvvjiOPLIIw0cgKw1atSouPjiiyMvL3dfA23dunXxZz/72e83NDRkTBwAgObON4ABANhtli9fvr2mpuaFY4899uT8/PyWubjGVCoVgwYNikwmE4sWLTJ0ALLK6aefHueee26kUqmcXWN9fX3FDTfccM3UqVOrTBwAgObi/b4BLAAGAGC3evnll7cUFBS8cMQRR4zOy8trkYtrTKVSccABB0SnTp1i7ty5kck4fATA3lVYWBhXXHFFHHPMMTm9zsbGxuo777zzKz/72c9WmzoAAM2JABgAgL1qxowZlb169Xp98ODBJ6dSqfxcXWfPnj2jb9++8fe//z0aGxsNHoC9olWrVnH11VfHwIEDc3qd6XS64be//e2Nt9122wJTBwCguREAAwCw1z3xxBPlw4cPX9OvX79jIyJn76Hs2LFjDBw4MObMmRN1dXUGD8Ae1a5du7jxxhujT58+ub7U9JQpU779xS9+8XlTBwCgOXq/ADhPewAA2FPGjBkz9Y033vh1rq+zZ8+eceONN0bHjh0NHYA9pkuXLnHTTTdF9+7dc36tc+fO/eU555zzF1MHAID/SwAMAMAe9alPfernS5cufTjX19mlS5e49dZb48ADDzR0AHa7gQMHxje/+c3o1KlTzq/1rbfeemjEiBG/MnUAANg5ATAAAHvcsccee8/GjRtfyPV1FhcXx7XXXhsjRowwdAB2m8MPPzyuuuqqaNmyZc6vdePGjc8fffTR95g6AAC8NwEwAAB7XEVFReNxxx339crKyr/l+loLCgrisssui/PPPz9SqZThA7DLpFKpOP/88+PSSy+NgoKCnF/vpk2bXj7ssMNuqaysbDJ9AAB4bwJgAAD2isWLF9efddZZN1dXV7/ZHNZ7/PHHx5e//OUoKioyfAA+sRYtWsSXv/zlOP7445vFequrq98cM2bMN8rLyxtMHwAA3l9+24Oi585+kN4WUVteqEMAAOw2a9asaVi1atWs0aNHH1dQUNA619fbrVu3OOCAA2LevHlRX1/vAQDgYykrK4trrrkmDjrooGax3rq6uvKxY8de89RTT202fQAA+Ifi7o2RV7rznwmAAQDYq+bNm1ezevXqZ04++eTjCwoKSnN9ve3atYuRI0fG8uXLY+PGjR4AAD6S/v37x0033RRdu3ZtFuutr69fd9111335T3/6U4XpAwDA/xAAAwCQ1ebMmbMtlUq9fOSRR56Ul5eX83ckt2jRIkaMGBG1tbWxdOlSDwAAH8rxxx8fX/rSl5rN5wQaGxu33HXXXdf99Kc/XWn6AADwvwmAAQDIejNnzqzs2bPn64MHDz4plUrl5/p6U6lUHHLIIdGqVatYsGBBZDIZDwEAO5WXlxef/exn4/TTT49UKtUs1pxOp7f//ve//+o3vvGN1z0BAADwfwmAAQBIhEmTJpXvs88+8wYOHHhCKpUqaA5r3m+//WLAgAExd+5c3wUG4P8oKyuL6667LoYNG9Zs1pxOp7f/8Y9/vOmqq676qycAAAB2TgAMAEBiTJw4cc3BBx+85MADDzwulUrlNYc1t2/fPoYOHRqLFi2KLVu2eAgAiIiIffbZJ66//vro2bNns1lzJpNpnDBhwm1f/OIXn/cEAADAexMAAwCQKI8++ujy/fff/42DDjrohOZwHXRERHFxcRx11FHR2NgYb731locAoJkbPXp0XHHFFVFSUtJs1pxOpxsefvjhr15yySWzPAEAAPD+BMAAACTO+PHjVw0cOHDpAQcccGxzOQmcSqViwIAB0aVLl3jjjTeiqanJgwDQzBQVFcWll14aJ554YrP53m/EP07+Pv7447dffPHFMz0FAADwwQTAAAAk0iOPPLLs0EMPXbb//vs3mxA4IqJHjx4xZMiQePPNN2Pr1q0eBIBmonv37vEv//IvccABBzSrdWcymaYnnnji9s997nPPeAoAAODDEQADAJBYDz/88NJjjjlmY+/evY+KiGZzFKq0tDSGDx8eq1evjvXr13sQAHLcwIED45prrol27do1t6VnZsyY8YOzzjprqqcAAAA+PAEwAACJdv/99795zDHHVO6zzz5HRDMKgVu0aBGHHXZYtGzZMhYuXBjpdNrDAJBjCgoK4pxzzonzzz8/WrRo0dyWn37uuefuOuWUUyZ4EgAA4KMRAAMAkHi///3v5w8bNmxF3759j2lO10GnUqno27dvDB06NBYvXhxbtmzxMADkiJ49e8YNN9wQgwcPblbf+434x7XPU6ZM+fbpp58+2ZMAAAAfnQAYAICc8OCDDy4ZNmzYin79+jWrEDgionXr1nHEEUdEfX19LF261MMAkGCpVCpOOOGEuOKKK6JNmzbNbv07wt9vnXPOOX/xNAAAwMcjAAYAIGc89NBDS4YNG7a8X79+xza3EDg/Pz8OPvjg6NWrV8yfPz8aGho8EAAJU1JSEpdffnmccMIJkZ+f3+zWn8lkGp944olvffazn53maQAAgI9PAAwAQE556KGHlo4cOXJdnz59RqWa252ZEdG1a9cYNmxYLFu2LCorKz0QAAnRt2/fuO6662K//fZrluvPZDLpp59++rvnnHPO054GAAD4ZATAAADknD/96U+LDj300KX7779/s7sOOiKiuLg4jjzyyCgpKYk333wz0um0hwIgSxUUFMRnP/vZuPDCC6OkpKRZ9iCdTjc88sgjt5x//vnTPREAAPDJCYABAMhJDz/88NId3wQelUqlmt09mqlUKvr06RMHH3xwLFy4MLZt2+ahAMgynTt3jrFjx8bQoUOjGV5aERH/CH+feOKJ2y+88MLnPBEAALBrCIABAMhZDz300JIePXq8NmjQoGPz8vJaNMcetG3bNkaNGhVNTU2xZMkSDwVAFkilUjF69Oi48soro0OHDs22D01NTdt++9vf/stll132oqcCAAB2HQEwAAA5bdKkSeXdu3efM3jw4GYbAufn58eAAQOiV69esWDBgti+fbsHA2Avad26dVx66aVx/PHHR35+frPtQ2NjY/WvfvWrf7nuuute81QAAMCuJQAGACDnTZ48eW1jY+OMI4444uiCgoKS5tqHrl27xqhRo2Lbtm2xcuVKDwbAHpRKpWLUqFExduzY6NWrV7PuRX19/fo77rjjK9/61rcWejIAAGDXEwADANAsPP/881UbNmx45rjjjjuqsLCwrLn2obCwMAYNGhT77bdfLF68OGpraz0cALtZ+/bt44orrogTTzwxCgub9/uU2tralTfffPPVP/nJT1Z7MgAAYPcQAAMA0Gz87W9/27p27doZJ5xwwsjCwsK2zbkXnTp1ipEjR0Z1dbXTwAC70ciRI+Pqq6+OHj16NPte1NTULL/hhhuu/e1vf7vOkwEAALuPABgAgGbltdde2zpv3rynTznllKFFRUWdmnMvCgsL49BDD4399tsvFi1a5DQwwC709qnfk08+udmf+o2I2Lx587yLL774unHjxm30dAAAwO71fgFwat9zYsTOftC4LmLjq610DwCAxOrVq1fhs88++69du3Y9QTciGhoaYurUqTF58uRobGzUEICPqaCgIE499dQYPXq04HeH8vLyp4499tjvrly5skE3AABg9+swrDYKuuz8ZwJgAAByWuvWrfNeeumlm/fdd9+zdeMfVq9eHffff38sWbJEMwA+ov322y8uuugi1z2/w8KFC38/fPjwnzY0NGR0AwAA9gwBMAAAzd7zzz9/8aGHHnp1RKR0IyKTycTMmTPjz3/+c9TV1WkIwAcoKSmJ8847L0aMGBGplL9Kdki//PLL9xx77LEPagUAAOxZ7xcA+wYwAADNwn333Tfn+OOP39yrV6/DQwgcqVQqevfuHcOHD49169ZFRUWFhwTgPRxyyCExduzY6N+/v/B3h0wm0/jMM8/828knnzxONwAAYM97v28AC4ABAGg2fve7370xePDgJf369Ts6lUrl60hEcXFxjBgxInr06BFLly6N2tpaTQHYoUOHDvGFL3whzjzzzCguLtaQHZqammoeeOCBWz73uc9N1w0AANg7BMAAALDDww8/vKygoOC54cOHH1FQUFCqI//QrVu3OO6446K0tDQWL14cTU1NmgI0Wy1btoxzzjknLr300ujevbuGvENtbe2K22677arbbrvtDd0AAIC9RwAMAADv8Oyzz25avHjx0yeddNKQoqKiTjryD3l5edGnT58YOXJkbN26NVatWqUpQLNz+OGHx1e+8pUYMGBA5OXlacg7VFVV/e3CCy+8/oEHHvDdAAAA2MsEwAAA8C7z58+vefbZZ58+44wz+hcXF/fSkf/RsmXLGDJkSOyzzz6xdOnSqKmp0RQg53Xs2DG++MUvximnnBItW7bUkHdZt27dMyeffPI3Xn755W26AQAAe9/7BcCpfc+JETv7QeO6iI2vttI9AAByWmFhYer555//0sEHH3y5bvxfTU1N8fzzz8f48eOjurpaQ4Cc07p16zjzzDPjyCOPdOJ35zJ///vff3rMMcfc39DQkNEOAADIDh2G1UZBl53/TAAMAAARMWnSpM8cc8wxt6RSKdfg7ERNTU1MmTIlpk2bFg0NDRoCJF5hYWGccsopcdJJJ0VRUZGG7EQ6na6fOnXqd88555y/6AYAAGSX9wuAXQENAAAR8Yc//GHhfvvt98aAAQOOysvLkwS8S2FhYQwYMCCGDh0amzZtinXr1mkKkFiDBw+Oq666KoYOHRoFBQUashONjY1Vv//972/5whe+MEs3AAAg+/gGMAAAfAgTJkxYXV1dPf3II4/8VGFhYTsd+b9KS0vjsMMOi/79+8eaNWti8+bNmgIkRu/evePyyy+PU045JUpLSzXkPWzdunXxLbfccs33vve9hboBAADZyTeAAQDgI+jTp0+LJ5988us9evQ4TTfe3/z58+ORRx6JlStXagaQtXr16hXnnHNODBgwQDM+wKpVq5444YQTfrBy5Ur3/QMAQBbzDWAAAPgYnnnmmfOHDx9+fSqVytON95bJZGL27Nkxbty4qKio0BAga3Tu3DnOOuusGDp0aKRSKQ15/z/Lm2bNmvXDk08++THdAACA7OcbwAAA8DH85je/eX3//fd//cADDzzSd4HfWyqViu7du8cxxxwT7dq1i2XLlkV9fb3GAHtN27Zt49xzz42LL744evToIfz9AI2NjdUPPvjgLZ/97Gf/ohsAAJAMvgEMAAAf0/jx41dFxPOHHXbYiMLCwjIdeW95eXnRu3fvOOqoo6KgoCBWrlwZjY2NGgPsMcXFxXHKKafEl770pejbt2/k5bnA4YPU1tau+MEPfnD9LbfcMk83AAAgQf/94xvAAADwyQwePLjVo48++s1u3bqdpBsfTn19fTzzzDMxderU2LZtm4YAu01ZWVmceuqpceSRR0ZRkQsbPqyVK1c+/ulPf/pHixcvdm0DAAAkjG8AAwDALvLkk0+edeSRR96USqVcl/MhCYKB3eXtE7/HHnus4PcjyGQyDbNmzfoP3/sFAIDk8g1gAADYRX7/+98v6NGjx2uHHHLIyPz8fL8x+SEUFBREv3794qijjoq8vLxYtWqVq6GBT6Rly5ZxwgknxBVXXBEHHXRQFBQUaMqH1NDQsOG3v/3t1z7/+c8/oxsAAJBcroAGAIBd7Lzzzut4991339m2bdvBuvHR1NTUxLPPPhvTpk2LLVu2aAjwoZWVlcXxxx8fxxxzTBQXF2vIR1RVVfW3a6+99vZHHnlkg24AAECyuQIaAAB2g06dOhVMmzZtbN++fT8XESkd+WgaGhri+eefjyeffDI2bJBFAO/7522cdNJJccQRR0RhodvKPobMokWL/nTsscf+pLKyskk7AAAg+QTAAACwG/3hD38Ydfrpp99WUFDQRjc+unQ6Ha+++mpMnTo1Vq5cqSHAP/Xq1StOOeWUGDp0aOTl5WnIx9DY2Fg1YcKEOy666KKZugEAALlDAAwAALvZaaed1vbee+/9docOHUbqxse3fPnymDZtWrz88suRTqc1BJqhvLy8OOyww+L444+P3r17a8gnsHHjxue//OUvf3fSpElVugEAALlFAAwAAHtAYWFh6qmnnjpv+PDh16RSKXeUfgIbNmyIGTNmxHPPPRc1NTUaAs1AcXFxjBo1Ko4++ujo2LGjhnwCmUym4ZVXXvl/J5100kMNDQ0ZHQEAgNzzfgFwftuDoufOfpDeFlFb7p0VAAB8WOl0On7zm9+8Xlpa+uLgwYM/VVhYWKYrH09xcXEMGDAgjj322GjTpk2sXbs2amtrNQZyUIcOHeKMM86ISy+9NAYOHBjFxcWa8gnU1tau+slPfnLjxRdf/IybFAAAIHcVd2+MvNKd/8wJYAAA2A1OPPHENvfdd9+tnTp1Olo3PrnGxsb429/+Fs8++2wsWrRIQyAH9OvXL44++ugYNmxYFBQUaMguUFFR8cwXv/jFf5s+ffoW3QAAgNzmCmgAANhLHn744RNGjx799YKCgta6sWusX78+Zs6cGc8//3xUV1drCCRIaWlpHHnkkXHUUUdF586dNWQXaWxs3DJ16tS7PvvZz/5FNwAAoHkQAAMAwF50ySWXdP3+97//rXbt2g3VjV2nsbExXnvttXjuuedi/vz5GgJZbMCAATFq1KgYPHiw0767WFVV1atf//rXv/e73/1urW4AAEDzIQAGAIC9rF27dvlTp0699OCDD740lUrl68iutXz58nj++efj5ZdfjpqaGg2BLFBSUhLDhw+PI444Inr37q0hu1gmk2mcN2/efSeeeOJvq6urfewXAACaGQEwAABkia9//ev73Xjjjf9aWlraXzd2vXQ6HW+++WY899xz8dprr0VjY6OmwB5UUFAQgwcPjlGjRsUBBxwQeXl5mrIbVFdXL/zP//zPf/3BD36wRDcAAKB5EgADAEAWOfjgg1v9+c9/vrZ3795jIiKlI7tHZWVlvPjii/HCCy/EunXrNAR2o65du8bIkSPj8MMPj7Zt22rI7pNZunTpn88888z/t3jx4nrtAACA5ksADAAAWejuu+8eePHFF9/WqlUrd6PuZuXl5fHqq6/GSy+9FOvXr9cQ2AU6d+4cI0aMiGHDhkW3bt00ZDerqalZ9tvf/vbOm266aa5uAAAAAmAAAMhS/fr1K3r44Ycv79+//4WpVMpdqXvA8uXL46WXXoqXX345qqurNQQ+grKyshg+fHiMGDHCd333kEwmk164cOEfzj777F8sXbp0u44AAAARAmAAAMh6P/3pT4d97nOf+2bLli176Mae0dDQEHPnzo2//vWvMXfu3Ni+Xa4CO9OyZcsYNGhQDBs2LA455JAoKCjQlD2ktrZ21R//+Mc7rr322r/rBgAA8E4CYAAASIA+ffq0ePTRR69wGnjPS6fTsXTp0nj11VedDIaIaNu2bQwbNiyGDRsWffr0ibw8fyTtSZlMpuG11177+ZlnnvmnioqKRh0BAADeTQAMAAAJ8uMf//jQCy644JutWrXaRzf2vLdPBs+ePTvmzp0bdXV1mkKzUFZWFoMHD45hw4ZF//79Iz8/X1P2gpqammX333//nTfccINv/QIAAO9JAAwAAAnTrl27/HHjxp37qU996qq8vDwb870kk8nEihUrYu7cuTFnzpxYsWJFZDIZjSEnpFKp6Nu3bwwbNiwGDRoUHTt21JS9qKmpqfbVV1/92ZgxY/5cWVnZpCMAAMD7EQADAEBCffnLX+5x++23f7V9+/aH68bet2XLlnjjjTdizpw5MW/evKivr9cUEqVly5Zx8MEHx6BBg+KQQw6J0tJSTckCGzdufPG73/3uv//iF79YoxsAAMCHIQAGAIAEKywsTE2cOPGMkSNHXlNQUNBaR7JDXV1dvPnmm/HGG2/EG2+8EevXr9cUslKXLl3ioIMOioMOOigOOOCAKCoq0pQs0djYuGXmzJk/PvPMMyc2NDS4XgAAAPjQBMAAAJADjjzyyNY/+9nPrujbt++5EZGnI9mluro6Fi5cGPPnz4958+ZFZWWlprBXtGvXLg455JAYMGBA9O/fP1q39nsjWSj91ltv/fmqq676xaxZs6q1AwAA+KgEwAAAkEN++ctfjhgzZsyNrVq16q0b2SmdTsfKlStj0aJFsXDhwli8eHFs27ZNY9gtSkpKol+/ftG/f//Yf//9o1evXpGX53dEslVNTc3yRx999EdXXnnlK7oBAAB8XAJgAADIMd26dSt8+OGHPzd48ODL8vPzbdyzXCaTiTVr1sTChQtj0aJFsWjRotiyZYvG8LGUlZVF//79/xn6du/ePVKplMZkuaampprXXnvtV2PGjHmgoqKiUUcAAIBPQgAMAAA56rjjjiv7r//6r8tdC508mzdvjuXLl8eKFSti+fLlsXjx4qipqdEY/pfi4uLo169f9O7dO/bZZ5/Yd999o6ysTGMSJJPJpJcsWfLn66677pfTp0/3mx8AAMAuIQAGAIAc99Of/nTIueeee3NpaWlf3UimxsbGWLlyZSxdujSWLVsWy5cvj3Xr1kUmk9GcZiKVSkWXLl1in332iT59+kSfPn2iV69eUVBQoDkJtXXr1sUPPvjgj6699tq/6wYAALArCYABAKAZaNeuXf64cePOGTp06BUFBQWtdST56uvrY+XKlf88KbxixYpYu3ZtpNNpzUm4vLy86Nq1a+yzzz7//KdXr17RsmVLzckBjY2NW/7617/+4pxzznm0srKySUcAAIBdTQAMAADNyIknntjmnnvuuXzfffcdk0qlHB3MMdu3b481a9bEmjVrYu3atbF27dooLy+PDRs2CIazUF5eXnTs2DG6desWXbt2jW7dukW3bt2iR48eUVhYqEE5JpPJNC5ZsuRR1z0DAAC7mwAYAACaoa9+9av7Xnfdddd16NDhCN3IfY2Njf8MhNetWxfr1q2LioqKWLduXWzbtk2DdrPS0tLo3LnzP//p0qVLdO3aNbp27eoK52Ziw4YNM//rv/7rxz/60Y+W6wYAALC7CYABAKAZ++UvfznirLPOuq64uNj3gZupmpqaWL9+/T//qaioiMrKyqisrIxNmzZFY2OjJn2AgoKCaN++fbRr1y7at28fHTt2jC5dukSnTp2ic+fOUVxcrEnN1NatW98aP378PVdcccXLugEAAOwpAmAAAGjm2rVrl//ggw+eOWLEiCsLCwvb6gjvtHnz5n+GwZs2bYrKysqorq6OLVu2xJYtW6K6ujqqq6sjk8nk3NpTqVS0bt06WrduHWVlZdGmTZsoLS39X2Fvu3btok2bNh4U/peGhobKl1566efnnHPO+OrqavevAwAAe5QAGAAAiIiIoUOHFt97770XHHjggRfk5+c7ssiHlk6n/xkEV1dXR01Nzfv+k8lkora2NtLpdNTX10dTU1PU1dXt0u8U5+XlRcuWLSM/Pz+KiooiLy8vWrVqFalUKoqLi3f6T0lJSbRq1eqfgW9paWnk5eUZMB9aU1NTzYIFC/745S9/+Y+zZ8+u0REAAGBvEAADAAD/y2mnndb2rrvuurRPnz5n5+XlFeoIe9LbgfDbtm/f/r7XUBcUFESLFi3++b/fDnxhT8pkMg1LliwZd8stt/xq0qRJVToCAADsTQJgAABgp0477bS2d95554X777//5wTBAP9XJpNpWLhw4QO33nrrHwS/AABAtni/ADi/7UHRc2c/SG+LqC33/gcAAHLZokWL6u69995X0un0swcddFCnkpKS3roC8A8VFRUz/7//7/+77aKLLpq6aNGiOh0BAACyRXH3xsgr3fnPBMAAAEDMnDmz8u67736qqalpWr9+/Ypbt27dN5VKpXQGaG4ymUx6zZo1U+65555/Peeccx6cOXNmpa4AAADZRgAMAAB8KDNnzqz88Y9//Gw6nZ4uCAaak7eD37vvvvtfzz///McEvwAAQDYTAAMAAB+JIBhoLgS/AABAEgmAAQCAj+XtILisrOyFvn37diwuLu4VEYJgIBdkKioqnrv33nu/PWbMmEcEvwAAQJK8XwCc2vecGLGzHzSui9j4aivdAwAA/unqq6/u8ZWvfOX8Pn36nJWXl9dCR4CkSafT9UuXLh3/X//1Xw/84he/WKMjAABAEnUYVhsFXXb+MwEwAADwkZ1xxhntb7/99rMPPPDA8/Pz81vrCJDtmpqaqhcsWPDgd77znUcmTpzotC8AAJBoAmAAAGC3GD58eMkPf/jDzwwePPjioqKijjoCZJv6+voNr7322u9vvPHGx2fPnl2jIwAAQC4QAAMAALvV0KFDi++5556zDjnkkPOKioq66giwt9XV1a19/fXXH7z++uvHC34BAIBcIwAGAAD2iFatWuXdc889w0455ZTzO3bseJSOAHtYZsOGDbOmTJny4PXXX/9qbW1tWksAAIBcJAAGAAD2uH/913/tf/7555/dq1ev0/Ly8lroCLC7pNPp+pUrV05+4IEHHvnOd76zSEcAAIBcJwAGAAD2mjPOOKP97bfffvYBBxzw2YKCgjY6AuwqjY2NVW+++eafv/e97z06YcKETToCAAA0FwJgAABgrxs+fHjJ97///dGDBg0aU1paur+OAB9XdXX1wtdee+3Rr371q1Nfe+21Wh0BAACaGwEwAACQVb761a/ue8EFF3y6b9++ZxUUFLTWEeCDNDY2bnnrrbfG/+EPf5j4ox/9aLmOAAAAzZkAGAAAyEpDhw4t/sEPfnDy4MGDz27dunV/HQHerbq6+s2XX375weuuu+7ppUuXbtcRAAAAATAAAJDlCgsLU3ffffeQ0aNHn9G1a9fj8vLyinQFmq90Ol1XXl4+bcqUKROuvfbav+sIAADA/yYABgAAEqNPnz4t/v3f/33UyJEjz2rfvv2nIiKlK9AsZDZt2vTXF1544bGvfe1rzzntCwAA8N4EwAAAQCJddNFFXa6++uqTDzzwwLNbtmzZTUcg99TV1a1ZsGDBuJ/+9KdP3n///et0BAAA4IMJgAEAgETr1q1b4d13333k4YcffmqHDh2OyMvLK9QVSK50Ot2wcePGWbNmzZp8/fXXz6qoqGjUFQAAgA9PAAwAAOSMo48+uvWtt956/CGHHHJKu3btBkdEnq5AIqQrKytfmzdv3uQ777xz+owZM6q1BAAA4OMRAAMAADnpuOOOK/vGN75x/CGHHHJa27ZtB4bvBUO2yVRVVc2dN2/epO9///vTpk+fvkVLAAAAPjkBMAAAkPNuu+22vmedddZJffr0Oa5Vq1a9dQT2ntra2uXLly+f/uijjz51xx13vKUjAAAAu5YAGAAAaFa+9KUvdbv44ouP7t+//wlOBsMekamqqpq7cOHCv/z+97+fcd9995VrCQAAwO4jAAYAAJqtSy65pOtll112jDAYdrl0VVXVvIULF/7lV7/61bO/+93v1moJAADAniEABgAAiIirr766x/nnnz9q//33P7JNmzZDUqlUga7Ah5fJZBoqKyv/vnjx4uf+9Kc/zbr33ntX6woAAMCeJwAGAAB4l379+hV97WtfGzRy5MhRPXv2PLaoqKizrsD/VV9fv37VqlXPvPDCC8/9+7//+5zFixfX6woAAMDeJQAGAAB4H61bt8678847Bx599NFHde/efURpaen+4apomq/M1q1bF69Zs+bF5557btY3v/nNOdXV1WltAQAAyB4CYAAAgI9g8ODBrcaOHXvI8OHDD+vevfvw1q1bHxACYXJXprq6+s01a9a88sorr7z8k5/8ZN5rr71Wqy0AAADZSwAMAADwCVx//fX7nHHGGYf169dvePv27Yfm5+e31hWSrLGxsXrjxo2vvvXWWy+PHz/+lR//+McrdQUAACA5BMAAAAC70Je//OUe55xzzvA+ffoM7tix45CioqKuukI2q6+vX7t27doXFy9ePGfixImv3Xvvvat1BQAAILkEwAAAALvRl7/85R6f+cxnBvfr129Qly5dDm/ZsqVAmL2qrq5u7bp16wS+AAAAOUoADAAAsIe0atUq75prrtnn2GOPPXi//fY7uH379oeUlpb2TaVS+brDbpKuqalZtnHjxnlvvfXW3GeffXbef/3Xfy2vra1Naw0AAEBuEgADAADsRQceeGDLq6+++oAhQ4Yc3LNnz4Pbtm17sGuj+biampqqq6qqXi8vL583Z86ceb/85S/nvfjii1t1BgAAoPkQAAMAAGSZoUOHFn/xi1/cf9CgQQf26NHjwHbt2h3YqlWr3qlUKk932CFdU1OzvLKycsHq1asXzJkzZ8Gf//znJTNmzKjWGgAAgOZNAAwAAJAAxx13XNkFF1xw4MEHH3xA165dDywtLd23pKRkn1QqVag7uS2TyTRs27ZtRXV19dJ169YtfOONNxZOmDBh4YQJEzbpDgAAAO8mAAYAAEiw8847r+OJJ57Yp3///vt16dKlT5s2bfZr3bp1v/z8/GLdSZampqaa6urqxZs3b16ybt26pQsXLlzy9NNPL33ooYc26A4AAAAflgAYAAAgx7Rr1y7/kksu6TFkyJCe++67b89OnTr1Kisr61VcXNyzZcuW3VKpVL4u7R2ZTKaprq6uvKamZtWWLVtWVlRUrFy6dOnK2bNnr7r//vvXVFZWNukSAAAAn4QAGAAAoBnp1KlTwec+97luQ4cO7bnPPvv0aNeuXafWrVt3Li4u7tqyZcvORUVFnfLy8lro1MeTTqe319fXr6+rq6uoqalZW11dvb6ysnL9ihUrVr/66qurHnzwwbUVFRWNOgUAAMDuIgAGAADgfznjjDPaH3bYYZ369OnTuUuXLp3Kysral5SUtC0uLu5YVFTUrqioqG2LFi065OfnlzaXnjQ1NW3dvn37xvr6+qr6+vrKmpqaDdu2bavasmXLpnXr1lUsXbp0/Ysvvrh+4sSJlZ4gAAAA9iYBMAAAAB9Lr169CkeNGtXuoIMOatexY8ey9u3bl7Zp06Z1SUlJWXFxcetWrVq1btGiRVlRUVHrwsLC1hGRX1hYWBoR+QUFBSV5eXkFeXl5u/0/LtPpdG06nW5sbGzcFhFNDQ0NW3f83+r6+vrq7du3b6mtra2uqamp3rZtW/XmzZurN23aVL1hw4YtCxYsqJo1a1bl0qVLt5s4AAAASSAABgAAYK/q169fUffu3Vvss88+xSUlJQVv//8LCwtT3bp1+8BTxuXl5VsbGhoyb//vbdu2Na5YsaJmzZo12xcvXlyvwwAAADQn7xcAF2gPAAAAu9vixYvrdwS11boBAAAAu0+eFgAAAAAAAADkBgEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4o0AIAAAAAAACA5GhoLIyCxoaIiEilIpNXGE1v/0wADAAAAAAAAJAghQUN/0x6MxGppvT/5L6ugAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAIb/v5272ZHiusM4/FZ1NUkz9sQwOF4EyZJtpJCwysa5jSy4n1xPEqRIuQFvvfGSgIwBOzGRQAQERnx0d1UW0cgWGvKxsMGvnmfVdc7/1OJsf+oCAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoMY3JP//9K8My551lzpAk293a7QAAAAAAAAD8iIw3r+SL7TpPxuSt4/ibJJuz20QDBgAAAAAAAHhzrJPp6NvHYcyyjLl7dJTPbl/Jp6sPLufSsM+5ec7q5YOrF0OeP/SVaAAAAAAAAIA3weH7u6zfm79dWDIMSw6225w785vsx3XyzasOby5ssz69c4sAAAAAAAAAr9n69C6bC9sT93a7rKdnORin5Otxynzi1JQcfiwCAwAAAAAAALxO69O7HH68TaaT98cp85R8vbp3Nfszv8q0LHn7xMF1sjk/ZzUPmZ/MmWefhAYAAAAAAAD4oayPdjn7223Gn7x6ZrXPnetX8mBKkpv3cufDd/Pufn5FL56SzcVtNheT3dNt8tQlAwAAAAAAAHyv1sm0ySv/9XtsNWZ3I/lHkgzHi7/4XY7WYz5yiwAAAAAAAAA/Ivtcv/3nPEyS1fHa42t5+vNLyX7JoRsCAAAAAAAAePPt1/nbV3/KvePn1Xc371/NYxEYAAAAAAAA4M0yTHk2rvNo2WdzvHZqzN9v/SF3vju3evng/at5fPDLPDu1yuGyZHSVAAAAAAAAAK/XOGe4ueSvZ4e8M8xZbVe5ceuPufvy3Oqkw4+v5emDX+fuuTlLhhwsEYIBAAAAAAAAXpclGR8OuXP0TR4cPM/9z/+SRyfNDf/1TZezOp/87KdjzizJZkhO7edMy/w/nAUAAAAAAADg/zaMWcZkP8/ZLsmLacr2/MV8+cnvs/tP5/4FmLjAq1ifcioAAAAASUVORK5CYII=";function H0($,q,Q){if(typeof $==="string"&&!isNaN(Number($)))$=Number($);if(typeof $==="number"&&$<100)return v0($);if(typeof $==="number"&&$>=100)return $;if(typeof $==="string"&&$.includes("%")){if(q&&q==="X")return Math.round(parseFloat($)/100*Q.width);if(q&&q==="Y")return Math.round(parseFloat($)/100*Q.height);return Math.round(parseFloat($)/100*Q.width)}return 0}function k5($){return $.replace(/[xy]/g,function(q){let Q=Math.random()*16|0;return(q==="x"?Q:Q&3|8).toString(16)})}function k0($){if(typeof $>"u"||$==null)return"";return $.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function v0($){if(typeof $==="number"&&$>100)return $;if(typeof $==="string")$=Number($.replace(/in*/gi,""));return Math.round(L0*$)}function Y0($){let q=Number($)||0;return isNaN(q)?0:Math.round(q*w8)}function S1($){return $=$||0,Math.round(($>360?$-360:$)*60000)}function g7($){let q=$.toString(16);return q.length===1?"0"+q:q}function A7($,q,Q){return(g7($)+g7(q)+g7(Q)).toUpperCase()}function R0($,q){let Q=($||"").replace("#","");if(!j7.test(Q)&&Q!==G2.background1&&Q!==G2.background2&&Q!==G2.text1&&Q!==G2.text2&&Q!==G2.accent1&&Q!==G2.accent2&&Q!==G2.accent3&&Q!==G2.accent4&&Q!==G2.accent5&&Q!==G2.accent6)console.warn(`"${Q}" is not a valid scheme color or hex RGB! "${Q2}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`),Q=Q2;let K=j7.test(Q)?"srgbClr":"schemeClr",J='val="'+(j7.test(Q)?Q.toUpperCase():Q)+'"';return q?`${q}`:``}function fB($,q){let Q="",K=Object.assign(Object.assign({},q),$),J=Math.round(K.size*w8),Z=K.color,G=Math.round(K.opacity*1e5);return Q+=``,Q+=R0(Z,``),Q+="",Q}function B2($){let q="solid",Q="",K="",J="";if($){if(typeof $==="string")Q=$;else{if($.type)q=$.type;if($.color)Q=$.color;if($.alpha)K+=``;if($.transparency)K+=``}switch(q){case"solid":J+=`${R0(Q,K)}`;break;default:J+="";break}}return J}function a2($){return $._rels.length+$._relsChart.length+$._relsMedia.length+1}function b7($){if(!$||typeof $!=="object")return;if($.type!=="outer"&&$.type!=="inner"&&$.type!=="none")console.warn("Warning: shadow.type options are `outer`, `inner` or `none`."),$.type="outer";if($.angle){if(isNaN(Number($.angle))||$.angle<0||$.angle>359)console.warn("Warning: shadow.angle can only be 0-359"),$.angle=270;$.angle=Math.round(Number($.angle))}if($.opacity){if(isNaN(Number($.opacity))||$.opacity<0||$.opacity>1)console.warn("Warning: shadow.opacity can only be 0-1"),$.opacity=0.75;$.opacity=Number($.opacity)}if($.color){if($.color.startsWith("#"))console.warn('Warning: shadow.color should not include hash (#) character, , e.g. "FF0000"'),$.color=$.color.replace("#","")}return $}function RB($,q,Q){var K,J;let Z=2.3+(((K=$.options)===null||K===void 0?void 0:K.autoPageCharWeight)?$.options.autoPageCharWeight:0),G=Math.floor(q/w8*L0)/((((J=$.options)===null||J===void 0?void 0:J.fontSize)?$.options.fontSize:k2)/Z),W=[],B=[],V=[],U=[];if($.text&&$.text.toString().trim().length===0)B.push({_type:D0.tablecell,text:" "});else if(typeof $.text==="number"||typeof $.text==="string")B.push({_type:D0.tablecell,text:($.text||"").toString().trim()});else if(Array.isArray($.text))B=$.text;let w=[];return B.forEach((F)=>{var M;if(typeof F.text==="string"){if(F.text.split(` `).length>1)F.text.split(` -`).forEach((k)=>{w.push({_type:D0.tablecell,text:k,options:Object.assign(Object.assign({},F.options),{breakLine:!0})})});else w.push({_type:D0.tablecell,text:F.text.trim(),options:F.options});if((M=F.options)===null||M===void 0?void 0:M.breakLine)V.push(w),w=[]}if(w.length>0)V.push(w),w=[]}),V.forEach((F)=>{F.forEach((M)=>{let k=[],L=String(M.text).split(" ");L.forEach((D,z)=>{let N=Object.assign({},M.options);if(N===null||N===void 0?void 0:N.breakLine)N.breakLine=z+1===L.length;k.push({_type:D0.tablecell,text:D+(z+1{let M=[],k="";if(F.forEach((f)=>{if(k.length+f.text.length>G)W.push(M),M=[],k="";M.push(f),k+=f.text.toString()}),M.length>0)W.push(M)}),W}function GJ($=[],q={},Q,K){let J=M8,Z=L0*1,G=L0*1,W=0,B=0,V=[],U=H0(q.x,"X",Q),w=H0(q.y,"Y",Q),F=H0(q.w,"X",Q),M=H0(q.h,"Y",Q),k=F;function f(){let D=0;if(V.length===0)D=w||v0(J[0]);if(V.length>0)D=v0(q.autoPageSlideStartY||q.newSlideStartY||J[0]);if(G=(M||Q.height)-D-v0(J[2]),V.length>1){if(typeof q.autoPageSlideStartY==="number")G=(M||Q.height)-v0(q.autoPageSlideStartY+J[2]);else if(typeof q.newSlideStartY==="number")G=(M||Q.height)-v0(q.newSlideStartY+J[2]);else if(w){if(G=(M||Q.height)-v0((w/L0{if(!z)z={_type:D0.tablecell};let N=z.options||null;B+=Number((N===null||N===void 0?void 0:N.colspan)?N.colspan:1)}),q.verbose)console.log(`| numCols ......................................... = ${B}`);if(!F&&q.colW){if(k=Array.isArray(q.colW)?q.colW.reduce((D,z)=>D+z)*L0:q.colW*B||0,q.verbose)console.log(`| tableCalcW ...................................... = ${k/L0}`)}if(Z=k||v0((U?U/L0:J[1])+J[3]),q.verbose)console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);if(!q.colW||!Array.isArray(q.colW))if(q.colW&&!isNaN(Number(q.colW))){let D=[];($[0]||[]).forEach(()=>D.push(q.colW)),q.colW=[],D.forEach((N)=>{if(Array.isArray(q.colW))q.colW.push(N)})}else{q.colW=[];for(let D=0;D{let N=[],H=0,v=0,j=[];if(D.forEach((X)=>{var P,g,c,h;if(j.push({_type:D0.tablecell,text:[],options:X.options}),X.options.margin&&X.options.margin[0]>=1){if(((P=X.options)===null||P===void 0?void 0:P.margin)&&X.options.margin[0]&&Y0(X.options.margin[0])>H)H=Y0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&Y0(q.margin[0])>H)H=Y0(q.margin[0]);if(((g=X.options)===null||g===void 0?void 0:g.margin)&&X.options.margin[2]&&Y0(X.options.margin[2])>v)v=Y0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&Y0(q.margin[2])>v)v=Y0(q.margin[2])}else{if(((c=X.options)===null||c===void 0?void 0:c.margin)&&X.options.margin[0]&&v0(X.options.margin[0])>H)H=v0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&v0(q.margin[0])>H)H=v0(q.margin[0]);if(((h=X.options)===null||h===void 0?void 0:h.margin)&&X.options.margin[2]&&v0(X.options.margin[2])>v)v=v0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&v0(q.margin[2])>v)v=v0(q.margin[2])}}),f(),W+=H+v,q.verbose&&z===0)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(D.forEach((X,P)=>{var g;let c={_type:D0.tablecell,_lines:null,_lineHeight:v0((((g=X.options)===null||g===void 0?void 0:g.fontSize)?X.options.fontSize:q.fontSize?q.fontSize:k2)*(fB+(q.autoPageLineWeight?q.autoPageLineWeight:0))/100),text:[],options:X.options};if(c.options.rowspan)c._lineHeight=0;c.options.autoPageCharWeight=q.autoPageCharWeight?q.autoPageCharWeight:null;let h=q.colW[P];if(X.options.colspan&&Array.isArray(q.colW))h=q.colW.filter((x,l)=>l>=P&&lx+l);c._lines=XB(X,h),N.push(c)}),q.verbose)console.log(` +`).forEach((k)=>{w.push({_type:D0.tablecell,text:k,options:Object.assign(Object.assign({},F.options),{breakLine:!0})})});else w.push({_type:D0.tablecell,text:F.text.trim(),options:F.options});if((M=F.options)===null||M===void 0?void 0:M.breakLine)V.push(w),w=[]}if(w.length>0)V.push(w),w=[]}),V.forEach((F)=>{F.forEach((M)=>{let k=[],L=String(M.text).split(" ");L.forEach((D,z)=>{let N=Object.assign({},M.options);if(N===null||N===void 0?void 0:N.breakLine)N.breakLine=z+1===L.length;k.push({_type:D0.tablecell,text:D+(z+1{let M=[],k="";if(F.forEach((f)=>{if(k.length+f.text.length>G)W.push(M),M=[],k="";M.push(f),k+=f.text.toString()}),M.length>0)W.push(M)}),W}function GJ($=[],q={},Q,K){let J=M8,Z=L0*1,G=L0*1,W=0,B=0,V=[],U=H0(q.x,"X",Q),w=H0(q.y,"Y",Q),F=H0(q.w,"X",Q),M=H0(q.h,"Y",Q),k=F;function f(){let D=0;if(V.length===0)D=w||v0(J[0]);if(V.length>0)D=v0(q.autoPageSlideStartY||q.newSlideStartY||J[0]);if(G=(M||Q.height)-D-v0(J[2]),V.length>1){if(typeof q.autoPageSlideStartY==="number")G=(M||Q.height)-v0(q.autoPageSlideStartY+J[2]);else if(typeof q.newSlideStartY==="number")G=(M||Q.height)-v0(q.newSlideStartY+J[2]);else if(w){if(G=(M||Q.height)-v0((w/L0{if(!z)z={_type:D0.tablecell};let N=z.options||null;B+=Number((N===null||N===void 0?void 0:N.colspan)?N.colspan:1)}),q.verbose)console.log(`| numCols ......................................... = ${B}`);if(!F&&q.colW){if(k=Array.isArray(q.colW)?q.colW.reduce((D,z)=>D+z)*L0:q.colW*B||0,q.verbose)console.log(`| tableCalcW ...................................... = ${k/L0}`)}if(Z=k||v0((U?U/L0:J[1])+J[3]),q.verbose)console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);if(!q.colW||!Array.isArray(q.colW))if(q.colW&&!isNaN(Number(q.colW))){let D=[];($[0]||[]).forEach(()=>D.push(q.colW)),q.colW=[],D.forEach((N)=>{if(Array.isArray(q.colW))q.colW.push(N)})}else{q.colW=[];for(let D=0;D{let N=[],H=0,v=0,j=[];if(D.forEach((X)=>{var P,g,c,h;if(j.push({_type:D0.tablecell,text:[],options:X.options}),X.options.margin&&X.options.margin[0]>=1){if(((P=X.options)===null||P===void 0?void 0:P.margin)&&X.options.margin[0]&&Y0(X.options.margin[0])>H)H=Y0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&Y0(q.margin[0])>H)H=Y0(q.margin[0]);if(((g=X.options)===null||g===void 0?void 0:g.margin)&&X.options.margin[2]&&Y0(X.options.margin[2])>v)v=Y0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&Y0(q.margin[2])>v)v=Y0(q.margin[2])}else{if(((c=X.options)===null||c===void 0?void 0:c.margin)&&X.options.margin[0]&&v0(X.options.margin[0])>H)H=v0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&v0(q.margin[0])>H)H=v0(q.margin[0]);if(((h=X.options)===null||h===void 0?void 0:h.margin)&&X.options.margin[2]&&v0(X.options.margin[2])>v)v=v0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&v0(q.margin[2])>v)v=v0(q.margin[2])}}),f(),W+=H+v,q.verbose&&z===0)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(D.forEach((X,P)=>{var g;let c={_type:D0.tablecell,_lines:null,_lineHeight:v0((((g=X.options)===null||g===void 0?void 0:g.fontSize)?X.options.fontSize:q.fontSize?q.fontSize:k2)*(YB+(q.autoPageLineWeight?q.autoPageLineWeight:0))/100),text:[],options:X.options};if(c.options.rowspan)c._lineHeight=0;c.options.autoPageCharWeight=q.autoPageCharWeight?q.autoPageCharWeight:null;let h=q.colW[P];if(X.options.colspan&&Array.isArray(q.colW))h=q.colW.filter((x,l)=>l>=P&&lx+l);c._lines=RB(X,h),N.push(c)}),q.verbose)console.log(` | SLIDE [${V.length}]: ROW [${z}]: START...`);let n=0,d=0,_=!1;while(!_){let X=N[n],P=j[n];if(N.forEach((h)=>{if(h._lineHeight>=d)d=h._lineHeight}),W+d>G){if(q.verbose)console.log(` |-----------------------------------------------------------------------|`),console.log(`|-- NEW SLIDE CREATED (currTabH+currLineH > maxH) => ${(W/L0).toFixed(2)} + ${(X._lineHeight/L0).toFixed(2)} > ${G/L0}`),console.log(`|-----------------------------------------------------------------------| `);if(j.length>0&&j.map((x)=>x.text.length).reduce((x,l)=>x+l)>0)L.rows.push(j);if(V.push(L),L={rows:[]},j=[],D.forEach((x)=>j.push({_type:D0.tablecell,text:[],options:x.options})),f(),W+=H+v,q.verbose)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(W=0,(q.addHeaderToEach||q.autoPageRepeatHeader)&&q._arrObjTabHeadRows)q._arrObjTabHeadRows.forEach((x)=>{let l=[],$0=0;x.forEach((Z0)=>{if(l.push(Z0),Z0._lineHeight>$0)$0=Z0._lineHeight}),L.rows.push(l),W+=$0});P=j[n]}let g=X._lines.shift();if(Array.isArray(P.text)){if(g)P.text=P.text.concat(g);else if(P.text.length===0)P.text=P.text.concat({_type:D0.tablecell,text:""})}if(n===N.length-1)W+=d;if(n=nh._lines.length).reduce((h,x)=>h+x)===0)_=!0}if(j.length>0)L.rows.push(j);if(q.verbose)console.log(`- SLIDE [${V.length}]: ROW [${z}]: ...COMPLETE ...... emuTabCurrH = ${(W/L0).toFixed(2)} ( emuSlideTabH = ${(G/L0).toFixed(2)} )`)}),V.push(L),q.verbose)console.log(` |================================================|`),console.log(`| FINAL: tableRowSlides.length = ${V.length}`),V.forEach((D)=>console.log(D)),console.log(`|================================================| -`);return V}function yB($,q,Q={},K){let J=Q||{};J.slideMargin=J.slideMargin||J.slideMargin===0?J.slideMargin:0.5;let Z=J.w||$.presLayout.width,G=[],W=[],B=[],V=[],U=[],w=[0.5,0.5,0.5,0.5],F=0;if(!document.getElementById(q))throw Error('tableToSlides: Table ID "'+q+'" does not exist!');if(K===null||K===void 0?void 0:K._margin){if(Array.isArray(K._margin))w=K._margin;else if(!isNaN(K._margin))w=[K._margin,K._margin,K._margin,K._margin];J.slideMargin=w}else if(J===null||J===void 0?void 0:J.slideMargin){if(Array.isArray(J.slideMargin))w=J.slideMargin;else if(!isNaN(J.slideMargin))w=[J.slideMargin,J.slideMargin,J.slideMargin,J.slideMargin]}if(Z=(J.w?v0(J.w):$.presLayout.width)-v0(w[1]+w[3]),J.verbose)console.log("[[VERBOSE MODE]]"),console.log("|-- `tableToSlides` ----------------------------------------------------|"),console.log(`| tableProps.h .................................... = ${J.h}`),console.log(`| tableProps.w .................................... = ${J.w}`),console.log(`| pptx.presLayout.width ........................... = ${($.presLayout.width/L0).toFixed(1)}`),console.log(`| pptx.presLayout.height .......................... = ${($.presLayout.height/L0).toFixed(1)}`),console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);let M=document.querySelectorAll(`#${q} tr:first-child th`);if(M.length===0)M=document.querySelectorAll(`#${q} tr:first-child td`);if(M.forEach((f)=>{let L=f;if(L.getAttribute("colspan"))for(let D=0;D{F+=f}),U.forEach((f,L)=>{let D=Number((Number(Z)*(f/F*100)/100/L0).toFixed(2)),z=0,N=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(N)z=Number(N.getAttribute("data-pptx-min-width"));let H=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(H)z=Number(H.getAttribute("data-pptx-width"));V.push(z>D?z:D)}),J.verbose)console.log(`| arrColW ......................................... = [${V.join(", ")}]`);["thead","tbody","tfoot"].forEach((f)=>{document.querySelectorAll(`#${q} ${f} tr`).forEach((L)=>{let D=L,z=[];switch(Array.from(D.cells).forEach((N)=>{let H=window.getComputedStyle(N).getPropertyValue("color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(","),v=window.getComputedStyle(N).getPropertyValue("background-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");if(window.getComputedStyle(N).getPropertyValue("background-color")==="rgba(0, 0, 0, 0)"||window.getComputedStyle(N).getPropertyValue("transparent"))v=["255","255","255"];let j={align:null,bold:window.getComputedStyle(N).getPropertyValue("font-weight")==="bold"||Number(window.getComputedStyle(N).getPropertyValue("font-weight"))>=500,border:null,color:A7(Number(H[0]),Number(H[1]),Number(H[2])),fill:{color:A7(Number(v[0]),Number(v[1]),Number(v[2]))},fontFace:(window.getComputedStyle(N).getPropertyValue("font-family")||"").split(",")[0].replace(/"/g,"").replace("inherit","").replace("initial","")||null,fontSize:Number(window.getComputedStyle(N).getPropertyValue("font-size").replace(/[a-z]/gi,"")),margin:null,colspan:Number(N.getAttribute("colspan"))||null,rowspan:Number(N.getAttribute("rowspan"))||null,valign:null};if(["left","center","right","start","end"].includes(window.getComputedStyle(N).getPropertyValue("text-align"))){let n=window.getComputedStyle(N).getPropertyValue("text-align").replace("start","left").replace("end","right");j.align=n==="center"?"center":n==="left"?"left":n==="right"?"right":null}if(["top","middle","bottom"].includes(window.getComputedStyle(N).getPropertyValue("vertical-align"))){let n=window.getComputedStyle(N).getPropertyValue("vertical-align");j.valign=n==="top"?"top":n==="middle"?"middle":n==="bottom"?"bottom":null}if(window.getComputedStyle(N).getPropertyValue("padding-left"))j.margin=[0,0,0,0],["padding-top","padding-right","padding-bottom","padding-left"].forEach((d,_)=>{j.margin[_]=Math.round(Number(window.getComputedStyle(N).getPropertyValue(d).replace(/\D/gi,"")))});if(window.getComputedStyle(N).getPropertyValue("border-top-width")||window.getComputedStyle(N).getPropertyValue("border-right-width")||window.getComputedStyle(N).getPropertyValue("border-bottom-width")||window.getComputedStyle(N).getPropertyValue("border-left-width"))j.border=[null,null,null,null],["top","right","bottom","left"].forEach((d,_)=>{let X=Math.round(Number(window.getComputedStyle(N).getPropertyValue("border-"+d+"-width").replace("px",""))),P=[];P=window.getComputedStyle(N).getPropertyValue("border-"+d+"-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");let g=A7(Number(P[0]),Number(P[1]),Number(P[2]));j.border[_]={pt:X,color:g}});z.push({_type:D0.tablecell,text:N.innerText,options:j})}),f){case"thead":G.push(z);break;case"tbody":W.push(z);break;case"tfoot":B.push(z);break;default:console.log(`table parsing: unexpected table part: ${f}`);break}})}),J._arrObjTabHeadRows=G||null,J.colW=V,GJ([...G,...W,...B],J,$.presLayout,K).forEach((f,L)=>{let D=$.addSlide({masterName:J.masterSlideName||null});if(L===0)J.y=J.y||w[0];if(L>0)J.y=J.autoPageSlideStartY||J.newSlideStartY||w[0];if(J.verbose)console.log(`| opts.autoPageSlideStartY: ${J.autoPageSlideStartY} / arrInchMargins[0]: ${w[0]} => opts.y = ${J.y}`);if(D.addTable(f.rows,{x:J.x||w[3],y:J.y,w:Number(Z)/L0,colW:V,autoPage:!1}),J.addImage)if(J.addImage.options=J.addImage.options||{},!J.addImage.image||!J.addImage.image.path&&!J.addImage.image.data)console.warn("Warning: tableToSlides.addImage requires either `path` or `data`");else D.addImage({path:J.addImage.image.path,data:J.addImage.image.data,x:J.addImage.options.x,y:J.addImage.options.y,w:J.addImage.options.w,h:J.addImage.options.h});if(J.addShape)D.addShape(J.addShape.shapeName,J.addShape.options||{});if(J.addTable)D.addTable(J.addTable.rows,J.addTable.options||{});if(J.addText)D.addText(J.addText.text,J.addText.options||{})})}var hB=0;function xB($,q){if($.bkgd)q.bkgd=$.bkgd;if($.objects&&Array.isArray($.objects)&&$.objects.length>0)$.objects.forEach((Q,K)=>{let J=Object.keys(Q)[0],Z=q;if(W1[J]&&J==="chart")WJ(Z,Q[J].type,Q[J].data,Q[J].opts);else if(W1[J]&&J==="image")BJ(Z,Q[J]);else if(W1[J]&&J==="line")_7(Z,B1.LINE,Q[J]);else if(W1[J]&&J==="rect")_7(Z,B1.RECTANGLE,Q[J]);else if(W1[J]&&J==="text")H5(Z,[{text:Q[J].text}],Q[J].options,!1);else if(W1[J]&&J==="placeholder")Q[J].options.placeholder=Q[J].options.name,delete Q[J].options.name,Q[J].options._placeholderType=Q[J].options.type,delete Q[J].options.type,Q[J].options._placeholderIdx=100+K,H5(Z,[{text:Q[J].text}],Q[J].options,!0)});if($.slideNumber&&typeof $.slideNumber==="object")q._slideNumberProps=$.slideNumber}function WJ($,q,Q,K){var J;function Z(w){if(!w||w.style==="none")return;if(w.size!==void 0&&(isNaN(Number(w.size))||w.size<=0))console.warn("Warning: chart.gridLine.size must be greater than 0."),delete w.size;if(w.style&&!["solid","dash","dot"].includes(w.style))console.warn("Warning: chart.gridLine.style options: `solid`, `dash`, `dot`."),delete w.style;if(w.cap&&!["flat","square","round"].includes(w.cap))console.warn("Warning: chart.gridLine.cap options: `flat`, `square`, `round`."),delete w.cap}let G=++hB,W={_type:null,text:null,options:null,chartRid:null},B=null,V=[];if(Array.isArray(q))q.forEach((w)=>{V=V.concat(w.data)}),B=Q||K;else V=Q,B=K;V.forEach((w,F)=>{if(w._dataIndex=F,w.labels!==void 0&&!Array.isArray(w.labels[0]))w.labels=[w.labels]});let U=B&&typeof B==="object"?B:{};if(U._type=q,U.x=typeof U.x<"u"&&U.x!=null&&!isNaN(Number(U.x))?U.x:1,U.y=typeof U.y<"u"&&U.y!=null&&!isNaN(Number(U.y))?U.y:1,U.w=U.w||"50%",U.h=U.h||"50%",U.objectName=U.objectName?k0(U.objectName):`Chart ${$._slideObjects.filter((w)=>w._type===D0.chart).length}`,!["bar","col"].includes(U.barDir||""))U.barDir="col";if(U._type===q0.AREA){if(!["stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if(U._type===q0.BAR){if(!["clustered","stacked","percentStacked"].includes(U.barGrouping||""))U.barGrouping="clustered"}if(U._type===q0.BAR3D){if(!["clustered","stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if((J=U.barGrouping)===null||J===void 0?void 0:J.includes("tacked")){if(!U.barGapWidthPct)U.barGapWidthPct=50}if(U.dataLabelPosition){if(U._type===q0.AREA||U._type===q0.BAR3D||U._type===q0.DOUGHNUT||U._type===q0.RADAR)delete U.dataLabelPosition;if(U._type===q0.PIE){if(!["bestFit","ctr","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BUBBLE||U._type===q0.BUBBLE3D||U._type===q0.LINE||U._type===q0.SCATTER){if(!["b","ctr","l","r","t"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BAR){if(!["stacked","percentStacked"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(!["clustered"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}}}if(U.dataLabelBkgrdColors=U.dataLabelBkgrdColors||!U.dataLabelBkgrdColors?U.dataLabelBkgrdColors:!1,!["b","l","r","t","tr"].includes(U.legendPos||""))U.legendPos="r";if(!["cone","coneToMax","box","cylinder","pyramid","pyramidToMax"].includes(U.bar3DShape||""))U.bar3DShape="box";if(!["circle","dash","diamond","dot","none","square","triangle"].includes(U.lineDataSymbol||""))U.lineDataSymbol="circle";if(!["gap","span"].includes(U.displayBlanksAs||""))U.displayBlanksAs="span";if(!["standard","marker","filled"].includes(U.radarStyle||""))U.radarStyle="standard";if(U.lineDataSymbolSize=U.lineDataSymbolSize&&!isNaN(U.lineDataSymbolSize)?U.lineDataSymbolSize:6,U.lineDataSymbolLineSize=U.lineDataSymbolLineSize&&!isNaN(U.lineDataSymbolLineSize)?Y0(U.lineDataSymbolLineSize):Y0(0.75),U.layout)["x","y","w","h"].forEach((w)=>{let F=U.layout[w];if(isNaN(Number(F))||F<0||F>1)console.warn("Warning: chart.layout."+w+" can only be 0-1"),delete U.layout[w]});if(U.catGridLine=U.catGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),U.valGridLine=U.valGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{}),U.serGridLine=U.serGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),Z(U.catGridLine),Z(U.valGridLine),Z(U.serGridLine),b7(U.shadow),U.showDataTable=U.showDataTable||!U.showDataTable?U.showDataTable:!1,U.showDataTableHorzBorder=U.showDataTableHorzBorder||!U.showDataTableHorzBorder?U.showDataTableHorzBorder:!0,U.showDataTableVertBorder=U.showDataTableVertBorder||!U.showDataTableVertBorder?U.showDataTableVertBorder:!0,U.showDataTableOutline=U.showDataTableOutline||!U.showDataTableOutline?U.showDataTableOutline:!0,U.showDataTableKeys=U.showDataTableKeys||!U.showDataTableKeys?U.showDataTableKeys:!0,U.showLabel=U.showLabel||!U.showLabel?U.showLabel:!1,U.showLegend=U.showLegend||!U.showLegend?U.showLegend:!1,U.showPercent=U.showPercent||!U.showPercent?U.showPercent:!0,U.showTitle=U.showTitle||!U.showTitle?U.showTitle:!1,U.showValue=U.showValue||!U.showValue?U.showValue:!1,U.showLeaderLines=U.showLeaderLines||!U.showLeaderLines?U.showLeaderLines:!1,U.catAxisLineShow=typeof U.catAxisLineShow<"u"?U.catAxisLineShow:!0,U.valAxisLineShow=typeof U.valAxisLineShow<"u"?U.valAxisLineShow:!0,U.serAxisLineShow=typeof U.serAxisLineShow<"u"?U.serAxisLineShow:!0,U.v3DRotX=!isNaN(U.v3DRotX)&&U.v3DRotX>=-90&&U.v3DRotX<=90?U.v3DRotX:30,U.v3DRotY=!isNaN(U.v3DRotY)&&U.v3DRotY>=0&&U.v3DRotY<=360?U.v3DRotY:30,U.v3DRAngAx=U.v3DRAngAx||!U.v3DRAngAx?U.v3DRAngAx:!0,U.v3DPerspective=!isNaN(U.v3DPerspective)&&U.v3DPerspective>=0&&U.v3DPerspective<=240?U.v3DPerspective:30,U.barGapWidthPct=!isNaN(U.barGapWidthPct)&&U.barGapWidthPct>=0&&U.barGapWidthPct<=1000?U.barGapWidthPct:150,U.barGapDepthPct=!isNaN(U.barGapDepthPct)&&U.barGapDepthPct>=0&&U.barGapDepthPct<=1000?U.barGapDepthPct:150,U.chartColors=Array.isArray(U.chartColors)?U.chartColors:U._type===q0.PIE||U._type===q0.DOUGHNUT?jB:z8,U.chartColorsOpacity=U.chartColorsOpacity&&!isNaN(U.chartColorsOpacity)?U.chartColorsOpacity:null,U.border=U.border&&typeof U.border==="object"?U.border:null,U.border&&(!U.border.pt||isNaN(U.border.pt)))U.border.pt=v6.pt;if(U.border&&(!U.border.color||typeof U.border.color!=="string"))U.border.color=v6.color;if(U.plotArea=U.plotArea||{},U.plotArea.border=U.plotArea.border&&typeof U.plotArea.border==="object"?U.plotArea.border:null,U.plotArea.border&&(!U.plotArea.border.pt||isNaN(U.plotArea.border.pt)))U.plotArea.border.pt=v6.pt;if(U.plotArea.border&&(!U.plotArea.border.color||typeof U.plotArea.border.color!=="string"))U.plotArea.border.color=v6.color;if(U.border)U.plotArea.border=U.border;if(U.plotArea.fill=U.plotArea.fill||{color:null,transparency:null},U.fill)U.plotArea.fill.color=U.fill;if(U.chartArea=U.chartArea||{},U.chartArea.border=U.chartArea.border&&typeof U.chartArea.border==="object"?U.chartArea.border:null,U.chartArea.border)U.chartArea.border={color:U.chartArea.border.color||v6.color,pt:U.chartArea.border.pt||v6.pt};if(U.chartArea.roundedCorners=typeof U.chartArea.roundedCorners==="boolean"?U.chartArea.roundedCorners:!0,U.dataBorder=U.dataBorder&&typeof U.dataBorder==="object"?U.dataBorder:null,U.dataBorder&&(!U.dataBorder.pt||isNaN(U.dataBorder.pt)))U.dataBorder.pt=0.75;if(U.dataBorder&&U.dataBorder.color){let w=typeof U.dataBorder.color==="string"&&U.dataBorder.color.length===6&&/^[0-9A-Fa-f]{6}$/.test(U.dataBorder.color),F=Object.values(L5).includes(U.dataBorder.color);if(!w&&!F)U.dataBorder.color="F9F9F9"}if(!U.dataLabelFormatCode&&U._type===q0.SCATTER)U.dataLabelFormatCode="General";if(!U.dataLabelFormatCode&&(U._type===q0.PIE||U._type===q0.DOUGHNUT))U.dataLabelFormatCode=U.showPercent?"0%":"General";if(U.dataLabelFormatCode=U.dataLabelFormatCode&&typeof U.dataLabelFormatCode==="string"?U.dataLabelFormatCode:"#,##0",!U.dataLabelFormatScatter&&U._type===q0.SCATTER)U.dataLabelFormatScatter="custom";if(U.lineSize=typeof U.lineSize==="number"?U.lineSize:2,U.valAxisMajorUnit=typeof U.valAxisMajorUnit==="number"?U.valAxisMajorUnit:null,U._type===q0.AREA||U._type===q0.BAR||U._type===q0.BAR3D||U._type===q0.LINE)U.catAxisMultiLevelLabels=!!U.catAxisMultiLevelLabels;else delete U.catAxisMultiLevelLabels;return W._type="chart",W.options=U,W.chartRid=a2($),$._relsChart.push({rId:a2($),data:V,opts:U,type:U._type,globalId:G,fileName:`chart${G}.xml`,Target:`/ppt/charts/chart${G}.xml`}),$._slideObjects.push(W),W}function BJ($,q){let Q={_type:null,text:null,options:null,image:null,imageRid:null,hyperlink:null},K=q.x||0,J=q.y||0,Z=q.w||0,G=q.h||0,W=q.sizing||null,B=q.hyperlink||"",V=q.data||"",U=q.path||"",w=a2($),F=q.objectName?k0(q.objectName):`Image ${$._slideObjects.filter((k)=>k._type===D0.image).length}`;if(!U&&!V)return console.error("ERROR: addImage() requires either 'data' or 'path' parameter!"),null;else if(U&&typeof U!=="string")return console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(U)}`),null;else if(V&&typeof V!=="string")return console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(V)}`),null;else if(V&&typeof V==="string"&&!V.toLowerCase().includes("base64,"))return console.error("ERROR: Image `data` value lacks a base64 header! Ex: 'image/png;base64,NMP[...]')"),null;let M=(U.substring(U.lastIndexOf("/")+1).split("?")[0].split(".").pop().split("#")[0]||"png").toLowerCase();if(V&&/image\/(\w+);/.exec(V)&&/image\/(\w+);/.exec(V).length>0)M=/image\/(\w+);/.exec(V)[1];else if(V===null||V===void 0?void 0:V.toLowerCase().includes("image/svg+xml"))M="svg";if(Q._type=D0.image,Q.image=U||"preencoded.png",Q.options={x:K||0,y:J||0,w:Z||1,h:G||1,altText:q.altText||"",rounding:typeof q.rounding==="boolean"?q.rounding:!1,sizing:W,placeholder:q.placeholder,rotate:q.rotate||0,flipV:q.flipV||!1,flipH:q.flipH||!1,transparency:q.transparency||0,objectName:F,shadow:b7(q.shadow)},M==="svg")$._relsMedia.push({path:U||V+"png",type:"image/png",extn:"png",data:V||"",rId:w,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`,isSvgPng:!0,svgSize:{w:H0(Q.options.w,"X",$._presLayout),h:H0(Q.options.h,"Y",$._presLayout)}}),Q.imageRid=w,$._relsMedia.push({path:U||V,type:"image/svg+xml",extn:M,data:V||"",rId:w+1,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w+1;else{let k=$._relsMedia.filter((f)=>f.path&&f.path===U&&f.type==="image/"+M&&!f.isDuplicate)[0];$._relsMedia.push({path:U||"preencoded."+M,type:"image/"+M,extn:M,data:V||"",rId:w,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w}if(typeof B==="object")if(!B.url&&!B.slide)throw Error("ERROR: `hyperlink` option requires either: `url` or `slide`");else w++,$._rels.push({type:D0.hyperlink,data:B.slide?"slide":"dummy",rId:w,Target:B.url||B.slide.toString()}),B._rId=w,Q.hyperlink=B;$._slideObjects.push(Q)}function OB($,q){let Q=q.x||0,K=q.y||0,J=q.w||2,Z=q.h||2,G=q.data||"",W=q.link||"",B=q.path||"",V=q.type||"audio",U="",w=q.cover||gB,F=q.objectName?k0(q.objectName):`Media ${$._slideObjects.filter((k)=>k._type===D0.media).length}`,M={_type:D0.media};if(!B&&!G&&V!=="online")throw Error("addMedia() error: either `data` or `path` are required!");else if(G&&!G.toLowerCase().includes("base64,"))throw Error("addMedia() error: `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')");else if(!w.toLowerCase().includes("base64,"))throw Error("addMedia() error: `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')");if(V==="online"&&!W)throw Error("addMedia() error: online videos require `link` value");if(U=q.extn||(G?G.split(";")[0].split("/")[1]:B.split(".").pop())||"mp3",M.mtype=V,M.media=B||"preencoded.mov",M.options={},M.options.x=Q,M.options.y=K,M.options.w=J,M.options.h=Z,M.options.objectName=F,V==="online"){let k=a2($);$._relsMedia.push({path:B||"preencoded"+U,data:"dummy",type:"online",extn:U,rId:k,Target:W}),M.mediaRid=k,$._relsMedia.push({path:"preencoded.png",data:w,type:"image/png",extn:"png",rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}else{let k=$._relsMedia.filter((L)=>L.path&&L.path===B&&L.type===V+"/"+U&&!L.isDuplicate)[0],f=a2($);$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:f,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+1}.${U}`}),M.mediaRid=f,$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:a2($),isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+0}.${U}`}),$._relsMedia.push({path:"preencoded.png",type:"image/png",extn:"png",data:w,rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}$._slideObjects.push(M)}function PB($,q){$._slideObjects.push({_type:D0.notes,text:[{text:q}]})}function _7($,q,Q){let K=typeof Q==="object"?Q:{};K.line=K.line||{type:"none"};let J={_type:D0.text,shape:q||B1.RECTANGLE,options:K,text:null};if(!q)throw Error("Missing/Invalid shape parameter! Example: `addShape(pptxgen.shapes.LINE, {x:1, y:1, w:1, h:1});`");let Z={type:K.line.type||"solid",color:K.line.color||VJ,transparency:K.line.transparency||0,width:K.line.width||1,dashType:K.line.dashType||"solid",beginArrowType:K.line.beginArrowType||null,endArrowType:K.line.endArrowType||null};if(typeof K.line==="object"&&K.line.type!=="none")K.line=Z;if(K.x=K.x||(K.x===0?0:1),K.y=K.y||(K.y===0?0:1),K.w=K.w||(K.w===0?0:1),K.h=K.h||(K.h===0?0:1),K.objectName=K.objectName?k0(K.objectName):`Shape ${$._slideObjects.filter((G)=>G._type===D0.text).length}`,typeof K.line==="string"){let G=Z;G.color=String(K.line),K.line=G}if(typeof K.lineSize==="number")K.line.width=K.lineSize;if(typeof K.lineDash==="string")K.line.dashType=K.lineDash;if(typeof K.lineHead==="string")K.line.beginArrowType=K.lineHead;if(typeof K.lineTail==="string")K.line.endArrowType=K.lineTail;g6($,J),$._slideObjects.push(J)}function TB($,q,Q,K,J,Z,G){let W=[$],B=Q&&typeof Q==="object"?Q:{};B.objectName=B.objectName?k0(B.objectName):`Table ${$._slideObjects.filter((F)=>F._type===D0.table).length}`;{if(q===null||q.length===0||!Array.isArray(q))throw Error("addTable: Array expected! EX: 'slide.addTable( [rows], {options} );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)");if(!q[0]||!Array.isArray(q[0]))throw Error("addTable: 'rows' should be an array of cells! EX: 'slide.addTable( [ ['A'], ['B'], {text:'C',options:{align:'center'}} ] );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)")}let V=[];if(q.forEach((F)=>{let M=[];if(Array.isArray(F))F.forEach((k)=>{let f={_type:D0.tablecell,text:"",options:typeof k==="object"&&k.options?k.options:{}};if(typeof k==="string"||typeof k==="number")f.text=k.toString();else if(k.text){if(typeof k.text==="string"||typeof k.text==="number")f.text=k.text.toString();else if(k.text)f.text=k.text;if(k.options&&typeof k.options==="object")f.options=k.options}f.options.border=f.options.border||B.border||[{type:"none"},{type:"none"},{type:"none"},{type:"none"}];let L=f.options.border;if(!Array.isArray(L)&&typeof L==="object")f.options.border=[L,L,L,L];if(!f.options.border[0])f.options.border[0]={type:"none"};if(!f.options.border[1])f.options.border[1]={type:"none"};if(!f.options.border[2])f.options.border[2]={type:"none"};if(!f.options.border[3])f.options.border[3]={type:"none"};[0,1,2,3].forEach((z)=>{f.options.border[z]={type:f.options.border[z].type||H6.type,color:f.options.border[z].color||H6.color,pt:typeof f.options.border[z].pt==="number"?f.options.border[z].pt:H6.pt}}),M.push(f)});else console.log("addTable: tableRows has a bad row. A row should be an array of cells. You provided:"),console.log(F);V.push(M)}),B.x=H0(B.x||(B.x===0?0:L0/2),"X",J),B.y=H0(B.y||(B.y===0?0:L0/2),"Y",J),B.h)B.h=H0(B.h,"Y",J);if(B.fontSize=B.fontSize||k2,B.margin=B.margin===0||B.margin?B.margin:JJ,typeof B.margin==="number")B.margin=[Number(B.margin),Number(B.margin),Number(B.margin),Number(B.margin)];if(JSON.stringify({arrRows:V}).indexOf("hyperlink")===-1){if(!B.color)B.color=B.color||Q2}if(typeof B.border==="string")console.warn("addTable `border` option must be an object. Ex: `{border: {type:'none'}}`"),B.border=null;else if(Array.isArray(B.border))[0,1,2,3].forEach((F)=>{B.border[F]=B.border[F]?{type:B.border[F].type||H6.type,color:B.border[F].color||H6.color,pt:B.border[F].pt||H6.pt}:{type:"none"}});if(B.autoPage=typeof B.autoPage==="boolean"?B.autoPage:!1,B.autoPageRepeatHeader=typeof B.autoPageRepeatHeader==="boolean"?B.autoPageRepeatHeader:!1,B.autoPageHeaderRows=typeof B.autoPageHeaderRows<"u"&&!isNaN(Number(B.autoPageHeaderRows))?Number(B.autoPageHeaderRows):1,B.autoPageLineWeight=typeof B.autoPageLineWeight<"u"&&!isNaN(Number(B.autoPageLineWeight))?Number(B.autoPageLineWeight):0,B.autoPageLineWeight){if(B.autoPageLineWeight>1)B.autoPageLineWeight=1;else if(B.autoPageLineWeight<-1)B.autoPageLineWeight=-1}let U=M8;if(K&&typeof K._margin<"u"){if(Array.isArray(K._margin))U=K._margin;else if(!isNaN(Number(K._margin)))U=[Number(K._margin),Number(K._margin),Number(K._margin),Number(K._margin)]}if(B.colW){let F=V[0].reduce((M,k)=>{var f;if(((f=k===null||k===void 0?void 0:k.options)===null||f===void 0?void 0:f.colspan)&&typeof k.options.colspan==="number")M+=k.options.colspan;else M+=1;return M},0);if(typeof B.colW==="string"||typeof B.colW==="number")B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length===1&&F>1)B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length!==F)console.warn("addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths."),B.colW=null}else if(B.w)B.w=H0(B.w,"X",J);else B.w=Math.floor(J._sizeW/L0-U[1]-U[3]);if(B.x&&B.x<20)B.x=v0(B.x);if(B.y&&B.y<20)B.y=v0(B.y);if(B.w&&typeof B.w==="number"&&B.w<20)B.w=v0(B.w);if(B.h&&typeof B.h==="number"&&B.h<20)B.h=v0(B.h);V.forEach((F)=>{F.forEach((M,k)=>{if(typeof M==="number"||typeof M==="string")F[k]={_type:D0.tablecell,text:String(F[k]),options:B};else if(typeof M==="object"){if(typeof M.text==="number")F[k].text=F[k].text.toString();else if(typeof M.text>"u"||M.text===null)F[k].text="";F[k].options=M.options||{},F[k]._type=D0.tablecell}})});let w=[];if(B&&!B.autoPage)g6($,V),$._slideObjects.push({_type:D0.table,arrTabRows:V,options:Object.assign({},B)});else{if(B.autoPageRepeatHeader)B._arrObjTabHeadRows=V.filter((F,M)=>M{if(!G($._slideNum+M))W.push(Z({masterName:(K===null||K===void 0?void 0:K._name)||null}));if(M>0)B.y=v0(B.autoPageSlideStartY||B.newSlideStartY||U[0]);{let k=G($._slideNum+M);if(B.autoPage=!1,g6(k,F.rows),k.addTable(F.rows,Object.assign({},B)),M>0)w.push(k)}})}return w}function H5($,q,Q,K){let J={_type:K?D0.placeholder:D0.text,shape:(Q===null||Q===void 0?void 0:Q.shape)||B1.RECTANGLE,text:!q||q.length===0?[{text:"",options:null}]:q,options:Q||{}};function Z(G){{if(!G.placeholder)G.color=G.color||J.options.color||$.color||Q2;if(G.placeholder||K)G.bullet=G.bullet||!1;if(G.placeholder&&$._slideLayout&&$._slideLayout._slideObjects){let W=$._slideLayout._slideObjects.filter((B)=>B._type==="placeholder"&&B.options&&B.options.placeholder&&B.options.placeholder===G.placeholder)[0];if(W===null||W===void 0?void 0:W.options)G=Object.assign(Object.assign({},G),W.options)}if(G.objectName=G.objectName?k0(G.objectName):`Text ${$._slideObjects.filter((W)=>W._type===D0.text).length}`,G.shape===B1.LINE){let W={type:G.line.type||"solid",color:G.line.color||VJ,transparency:G.line.transparency||0,width:G.line.width||1,dashType:G.line.dashType||"solid",beginArrowType:G.line.beginArrowType||null,endArrowType:G.line.endArrowType||null};if(typeof G.line==="object")G.line=W;if(typeof G.line==="string"){let B=W;if(typeof G.line==="string")B.color=G.line;G.line=B}if(typeof G.lineSize==="number")G.line.width=G.lineSize;if(typeof G.lineDash==="string")G.line.dashType=G.lineDash;if(typeof G.lineHead==="string")G.line.beginArrowType=G.lineHead;if(typeof G.lineTail==="string")G.line.endArrowType=G.lineTail}if(G.line=G.line||{},G.lineSpacing=G.lineSpacing&&!isNaN(G.lineSpacing)?G.lineSpacing:null,G.lineSpacingMultiple=G.lineSpacingMultiple&&!isNaN(G.lineSpacingMultiple)?G.lineSpacingMultiple:null,G._bodyProp=G._bodyProp||{},G._bodyProp.autoFit=G.autoFit||!1,G._bodyProp.anchor=!G.placeholder?I6.ctr:null,G._bodyProp.vert=G.vert||null,G._bodyProp.wrap=typeof G.wrap==="boolean"?G.wrap:!0,G.inset&&!isNaN(Number(G.inset))||G.inset===0)G._bodyProp.lIns=v0(G.inset),G._bodyProp.rIns=v0(G.inset),G._bodyProp.tIns=v0(G.inset),G._bodyProp.bIns=v0(G.inset);if(typeof G.underline==="boolean"&&G.underline===!0)G.underline={style:"sng"}}{if((G.align||"").toLowerCase().indexOf("c")===0)G._bodyProp.align=R6.center;else if((G.align||"").toLowerCase().indexOf("l")===0)G._bodyProp.align=R6.left;else if((G.align||"").toLowerCase().indexOf("r")===0)G._bodyProp.align=R6.right;else if((G.align||"").toLowerCase().indexOf("j")===0)G._bodyProp.align=R6.justify;if((G.valign||"").toLowerCase().indexOf("b")===0)G._bodyProp.anchor=I6.b;else if((G.valign||"").toLowerCase().indexOf("m")===0)G._bodyProp.anchor=I6.ctr;else if((G.valign||"").toLowerCase().indexOf("t")===0)G._bodyProp.anchor=I6.t}return b7(G.shadow),G}J.options=Z(J.options),J.text.forEach((G)=>G.options=Z(G.options||{})),g6($,J.text||""),$._slideObjects.push(J)}function uB($){($._slideLayout._slideObjects||[]).forEach((q)=>{if(q._type===D0.placeholder){if($._slideObjects.filter((Q)=>Q.options&&Q.options.placeholder===q.options.placeholder).length===0)H5($,[{text:""}],q.options,!1)}})}function zJ($,q){var Q;if(q.bkgd){if(!q.background)q.background={};if(typeof q.bkgd==="string")q.background.color=q.bkgd;else{if(q.bkgd.data)q.background.data=q.bkgd.data;if(q.bkgd.path)q.background.path=q.bkgd.path;if(q.bkgd.src)q.background.path=q.bkgd.src}}if((Q=q.background)===null||Q===void 0?void 0:Q.fill)q.background.color=q.background.fill;if($&&($.path||$.data)){$.path=$.path||"preencoded.png";let K=($.path.split(".").pop()||"png").split("?")[0];if(K==="jpg")K="jpeg";q._relsMedia=q._relsMedia||[];let J=q._relsMedia.length+1;q._relsMedia.push({path:$.path,type:D0.image,extn:K,data:$.data||null,rId:J,Target:`../media/${(q._name||"").replace(/\s+/gi,"-")}-image-${q._relsMedia.length+1}.${K}`}),q._bkgdImgRid=J}}function g6($,q,Q){let K=[];if(typeof q==="string"||typeof q==="number")return;else if(Array.isArray(q))K=q;else if(typeof q==="object")K=[q];K.forEach((J,Z)=>{if(Q&&Q[Z]&&Q[Z].hyperlink)J.options=Object.assign(Object.assign({},J.options),Q[Z]);if(Array.isArray(J)){let G=[];J.forEach((W)=>{if(W.options&&!W.text.options)G.push(W.options)}),g6($,J,G)}else if(Array.isArray(J.text))g6($,J.text,Q&&Q[Z]?[Q[Z]]:void 0);else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&!J.options.hyperlink._rId)if(typeof J.options.hyperlink!=="object")console.log("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:'https://github.com'}` ");else if(!J.options.hyperlink.url&&!J.options.hyperlink.slide)console.log("ERROR: 'hyperlink requires either: `url` or `slide`'");else{let G=a2($);$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:G,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()}),J.options.hyperlink._rId=G}else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&J.options.hyperlink._rId){if($._rels.filter((G)=>G.rId===J.options.hyperlink._rId).length===0)$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:J.options.hyperlink._rId,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()})}})}class FJ{constructor($){var q;this.addSlide=$.addSlide,this.getSlide=$.getSlide,this._name=`Slide ${$.slideNumber}`,this._presLayout=$.presLayout,this._rId=$.slideRId,this._rels=[],this._relsChart=[],this._relsMedia=[],this._setSlideNum=$.setSlideNum,this._slideId=$.slideId,this._slideLayout=$.slideLayout||null,this._slideNum=$.slideNumber,this._slideObjects=[],this._slideNumberProps=((q=this._slideLayout)===null||q===void 0?void 0:q._slideNumberProps)?this._slideLayout._slideNumberProps:null}set bkgd($){if(this._bkgd=$,!this._background||!this._background.color){if(!this._background)this._background={};if(typeof $==="string")this._background.color=$}}get bkgd(){return this._bkgd}set background($){if(this._background=$,$)zJ($,this)}get background(){return this._background}set color($){this._color=$}get color(){return this._color}set hidden($){this._hidden=$}get hidden(){return this._hidden}set slideNumber($){this._slideNumberProps=$,this._setSlideNum($)}get slideNumber(){return this._slideNumberProps}get newAutoPagedSlides(){return this._newAutoPagedSlides}addChart($,q,Q){let K=Q||{};return K._type=$,WJ(this,$,q,Q),this}addImage($){return BJ(this,$),this}addMedia($){return OB(this,$),this}addNotes($){return PB(this,$),this}addShape($,q){return _7(this,$,q),this}addTable($,q){return this._newAutoPagedSlides=TB(this,$,q,this._slideLayout,this._presLayout,this.addSlide,this.getSlide),this}addText($,q){return H5(this,typeof $==="string"||typeof $==="number"?[{text:$,options:q}]:$,q,!1),this}}function SB($,q){return W2(this,void 0,void 0,function*(){let Q=$.data;return yield new Promise((K,J)=>{var Z,G;let W=new c7.default,B=(Q.length-1)*2+1,V=((G=(Z=Q[0])===null||Z===void 0?void 0:Z.labels)===null||G===void 0?void 0:G.length)>1;W.folder("_rels"),W.folder("docProps"),W.folder("xl/_rels"),W.folder("xl/tables"),W.folder("xl/theme"),W.folder("xl/worksheets"),W.folder("xl/worksheets/_rels"),W.file("[Content_Types].xml",' \n'),W.file("_rels/.rels",` +`);return V}function IB($,q,Q={},K){let J=Q||{};J.slideMargin=J.slideMargin||J.slideMargin===0?J.slideMargin:0.5;let Z=J.w||$.presLayout.width,G=[],W=[],B=[],V=[],U=[],w=[0.5,0.5,0.5,0.5],F=0;if(!document.getElementById(q))throw Error('tableToSlides: Table ID "'+q+'" does not exist!');if(K===null||K===void 0?void 0:K._margin){if(Array.isArray(K._margin))w=K._margin;else if(!isNaN(K._margin))w=[K._margin,K._margin,K._margin,K._margin];J.slideMargin=w}else if(J===null||J===void 0?void 0:J.slideMargin){if(Array.isArray(J.slideMargin))w=J.slideMargin;else if(!isNaN(J.slideMargin))w=[J.slideMargin,J.slideMargin,J.slideMargin,J.slideMargin]}if(Z=(J.w?v0(J.w):$.presLayout.width)-v0(w[1]+w[3]),J.verbose)console.log("[[VERBOSE MODE]]"),console.log("|-- `tableToSlides` ----------------------------------------------------|"),console.log(`| tableProps.h .................................... = ${J.h}`),console.log(`| tableProps.w .................................... = ${J.w}`),console.log(`| pptx.presLayout.width ........................... = ${($.presLayout.width/L0).toFixed(1)}`),console.log(`| pptx.presLayout.height .......................... = ${($.presLayout.height/L0).toFixed(1)}`),console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);let M=document.querySelectorAll(`#${q} tr:first-child th`);if(M.length===0)M=document.querySelectorAll(`#${q} tr:first-child td`);if(M.forEach((f)=>{let L=f;if(L.getAttribute("colspan"))for(let D=0;D{F+=f}),U.forEach((f,L)=>{let D=Number((Number(Z)*(f/F*100)/100/L0).toFixed(2)),z=0,N=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(N)z=Number(N.getAttribute("data-pptx-min-width"));let H=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(H)z=Number(H.getAttribute("data-pptx-width"));V.push(z>D?z:D)}),J.verbose)console.log(`| arrColW ......................................... = [${V.join(", ")}]`);["thead","tbody","tfoot"].forEach((f)=>{document.querySelectorAll(`#${q} ${f} tr`).forEach((L)=>{let D=L,z=[];switch(Array.from(D.cells).forEach((N)=>{let H=window.getComputedStyle(N).getPropertyValue("color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(","),v=window.getComputedStyle(N).getPropertyValue("background-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");if(window.getComputedStyle(N).getPropertyValue("background-color")==="rgba(0, 0, 0, 0)"||window.getComputedStyle(N).getPropertyValue("transparent"))v=["255","255","255"];let j={align:null,bold:window.getComputedStyle(N).getPropertyValue("font-weight")==="bold"||Number(window.getComputedStyle(N).getPropertyValue("font-weight"))>=500,border:null,color:A7(Number(H[0]),Number(H[1]),Number(H[2])),fill:{color:A7(Number(v[0]),Number(v[1]),Number(v[2]))},fontFace:(window.getComputedStyle(N).getPropertyValue("font-family")||"").split(",")[0].replace(/"/g,"").replace("inherit","").replace("initial","")||null,fontSize:Number(window.getComputedStyle(N).getPropertyValue("font-size").replace(/[a-z]/gi,"")),margin:null,colspan:Number(N.getAttribute("colspan"))||null,rowspan:Number(N.getAttribute("rowspan"))||null,valign:null};if(["left","center","right","start","end"].includes(window.getComputedStyle(N).getPropertyValue("text-align"))){let n=window.getComputedStyle(N).getPropertyValue("text-align").replace("start","left").replace("end","right");j.align=n==="center"?"center":n==="left"?"left":n==="right"?"right":null}if(["top","middle","bottom"].includes(window.getComputedStyle(N).getPropertyValue("vertical-align"))){let n=window.getComputedStyle(N).getPropertyValue("vertical-align");j.valign=n==="top"?"top":n==="middle"?"middle":n==="bottom"?"bottom":null}if(window.getComputedStyle(N).getPropertyValue("padding-left"))j.margin=[0,0,0,0],["padding-top","padding-right","padding-bottom","padding-left"].forEach((d,_)=>{j.margin[_]=Math.round(Number(window.getComputedStyle(N).getPropertyValue(d).replace(/\D/gi,"")))});if(window.getComputedStyle(N).getPropertyValue("border-top-width")||window.getComputedStyle(N).getPropertyValue("border-right-width")||window.getComputedStyle(N).getPropertyValue("border-bottom-width")||window.getComputedStyle(N).getPropertyValue("border-left-width"))j.border=[null,null,null,null],["top","right","bottom","left"].forEach((d,_)=>{let X=Math.round(Number(window.getComputedStyle(N).getPropertyValue("border-"+d+"-width").replace("px",""))),P=[];P=window.getComputedStyle(N).getPropertyValue("border-"+d+"-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");let g=A7(Number(P[0]),Number(P[1]),Number(P[2]));j.border[_]={pt:X,color:g}});z.push({_type:D0.tablecell,text:N.innerText,options:j})}),f){case"thead":G.push(z);break;case"tbody":W.push(z);break;case"tfoot":B.push(z);break;default:console.log(`table parsing: unexpected table part: ${f}`);break}})}),J._arrObjTabHeadRows=G||null,J.colW=V,GJ([...G,...W,...B],J,$.presLayout,K).forEach((f,L)=>{let D=$.addSlide({masterName:J.masterSlideName||null});if(L===0)J.y=J.y||w[0];if(L>0)J.y=J.autoPageSlideStartY||J.newSlideStartY||w[0];if(J.verbose)console.log(`| opts.autoPageSlideStartY: ${J.autoPageSlideStartY} / arrInchMargins[0]: ${w[0]} => opts.y = ${J.y}`);if(D.addTable(f.rows,{x:J.x||w[3],y:J.y,w:Number(Z)/L0,colW:V,autoPage:!1}),J.addImage)if(J.addImage.options=J.addImage.options||{},!J.addImage.image||!J.addImage.image.path&&!J.addImage.image.data)console.warn("Warning: tableToSlides.addImage requires either `path` or `data`");else D.addImage({path:J.addImage.image.path,data:J.addImage.image.data,x:J.addImage.options.x,y:J.addImage.options.y,w:J.addImage.options.w,h:J.addImage.options.h});if(J.addShape)D.addShape(J.addShape.shapeName,J.addShape.options||{});if(J.addTable)D.addTable(J.addTable.rows,J.addTable.options||{});if(J.addText)D.addText(J.addText.text,J.addText.options||{})})}var CB=0;function jB($,q){if($.bkgd)q.bkgd=$.bkgd;if($.objects&&Array.isArray($.objects)&&$.objects.length>0)$.objects.forEach((Q,K)=>{let J=Object.keys(Q)[0],Z=q;if(W1[J]&&J==="chart")WJ(Z,Q[J].type,Q[J].data,Q[J].opts);else if(W1[J]&&J==="image")BJ(Z,Q[J]);else if(W1[J]&&J==="line")_7(Z,B1.LINE,Q[J]);else if(W1[J]&&J==="rect")_7(Z,B1.RECTANGLE,Q[J]);else if(W1[J]&&J==="text")H5(Z,[{text:Q[J].text}],Q[J].options,!1);else if(W1[J]&&J==="placeholder")Q[J].options.placeholder=Q[J].options.name,delete Q[J].options.name,Q[J].options._placeholderType=Q[J].options.type,delete Q[J].options.type,Q[J].options._placeholderIdx=100+K,H5(Z,[{text:Q[J].text}],Q[J].options,!0)});if($.slideNumber&&typeof $.slideNumber==="object")q._slideNumberProps=$.slideNumber}function WJ($,q,Q,K){var J;function Z(w){if(!w||w.style==="none")return;if(w.size!==void 0&&(isNaN(Number(w.size))||w.size<=0))console.warn("Warning: chart.gridLine.size must be greater than 0."),delete w.size;if(w.style&&!["solid","dash","dot"].includes(w.style))console.warn("Warning: chart.gridLine.style options: `solid`, `dash`, `dot`."),delete w.style;if(w.cap&&!["flat","square","round"].includes(w.cap))console.warn("Warning: chart.gridLine.cap options: `flat`, `square`, `round`."),delete w.cap}let G=++CB,W={_type:null,text:null,options:null,chartRid:null},B=null,V=[];if(Array.isArray(q))q.forEach((w)=>{V=V.concat(w.data)}),B=Q||K;else V=Q,B=K;V.forEach((w,F)=>{if(w._dataIndex=F,w.labels!==void 0&&!Array.isArray(w.labels[0]))w.labels=[w.labels]});let U=B&&typeof B==="object"?B:{};if(U._type=q,U.x=typeof U.x<"u"&&U.x!=null&&!isNaN(Number(U.x))?U.x:1,U.y=typeof U.y<"u"&&U.y!=null&&!isNaN(Number(U.y))?U.y:1,U.w=U.w||"50%",U.h=U.h||"50%",U.objectName=U.objectName?k0(U.objectName):`Chart ${$._slideObjects.filter((w)=>w._type===D0.chart).length}`,!["bar","col"].includes(U.barDir||""))U.barDir="col";if(U._type===q0.AREA){if(!["stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if(U._type===q0.BAR){if(!["clustered","stacked","percentStacked"].includes(U.barGrouping||""))U.barGrouping="clustered"}if(U._type===q0.BAR3D){if(!["clustered","stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if((J=U.barGrouping)===null||J===void 0?void 0:J.includes("tacked")){if(!U.barGapWidthPct)U.barGapWidthPct=50}if(U.dataLabelPosition){if(U._type===q0.AREA||U._type===q0.BAR3D||U._type===q0.DOUGHNUT||U._type===q0.RADAR)delete U.dataLabelPosition;if(U._type===q0.PIE){if(!["bestFit","ctr","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BUBBLE||U._type===q0.BUBBLE3D||U._type===q0.LINE||U._type===q0.SCATTER){if(!["b","ctr","l","r","t"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BAR){if(!["stacked","percentStacked"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(!["clustered"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}}}if(U.dataLabelBkgrdColors=U.dataLabelBkgrdColors||!U.dataLabelBkgrdColors?U.dataLabelBkgrdColors:!1,!["b","l","r","t","tr"].includes(U.legendPos||""))U.legendPos="r";if(!["cone","coneToMax","box","cylinder","pyramid","pyramidToMax"].includes(U.bar3DShape||""))U.bar3DShape="box";if(!["circle","dash","diamond","dot","none","square","triangle"].includes(U.lineDataSymbol||""))U.lineDataSymbol="circle";if(!["gap","span"].includes(U.displayBlanksAs||""))U.displayBlanksAs="span";if(!["standard","marker","filled"].includes(U.radarStyle||""))U.radarStyle="standard";if(U.lineDataSymbolSize=U.lineDataSymbolSize&&!isNaN(U.lineDataSymbolSize)?U.lineDataSymbolSize:6,U.lineDataSymbolLineSize=U.lineDataSymbolLineSize&&!isNaN(U.lineDataSymbolLineSize)?Y0(U.lineDataSymbolLineSize):Y0(0.75),U.layout)["x","y","w","h"].forEach((w)=>{let F=U.layout[w];if(isNaN(Number(F))||F<0||F>1)console.warn("Warning: chart.layout."+w+" can only be 0-1"),delete U.layout[w]});if(U.catGridLine=U.catGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),U.valGridLine=U.valGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{}),U.serGridLine=U.serGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),Z(U.catGridLine),Z(U.valGridLine),Z(U.serGridLine),b7(U.shadow),U.showDataTable=U.showDataTable||!U.showDataTable?U.showDataTable:!1,U.showDataTableHorzBorder=U.showDataTableHorzBorder||!U.showDataTableHorzBorder?U.showDataTableHorzBorder:!0,U.showDataTableVertBorder=U.showDataTableVertBorder||!U.showDataTableVertBorder?U.showDataTableVertBorder:!0,U.showDataTableOutline=U.showDataTableOutline||!U.showDataTableOutline?U.showDataTableOutline:!0,U.showDataTableKeys=U.showDataTableKeys||!U.showDataTableKeys?U.showDataTableKeys:!0,U.showLabel=U.showLabel||!U.showLabel?U.showLabel:!1,U.showLegend=U.showLegend||!U.showLegend?U.showLegend:!1,U.showPercent=U.showPercent||!U.showPercent?U.showPercent:!0,U.showTitle=U.showTitle||!U.showTitle?U.showTitle:!1,U.showValue=U.showValue||!U.showValue?U.showValue:!1,U.showLeaderLines=U.showLeaderLines||!U.showLeaderLines?U.showLeaderLines:!1,U.catAxisLineShow=typeof U.catAxisLineShow<"u"?U.catAxisLineShow:!0,U.valAxisLineShow=typeof U.valAxisLineShow<"u"?U.valAxisLineShow:!0,U.serAxisLineShow=typeof U.serAxisLineShow<"u"?U.serAxisLineShow:!0,U.v3DRotX=!isNaN(U.v3DRotX)&&U.v3DRotX>=-90&&U.v3DRotX<=90?U.v3DRotX:30,U.v3DRotY=!isNaN(U.v3DRotY)&&U.v3DRotY>=0&&U.v3DRotY<=360?U.v3DRotY:30,U.v3DRAngAx=U.v3DRAngAx||!U.v3DRAngAx?U.v3DRAngAx:!0,U.v3DPerspective=!isNaN(U.v3DPerspective)&&U.v3DPerspective>=0&&U.v3DPerspective<=240?U.v3DPerspective:30,U.barGapWidthPct=!isNaN(U.barGapWidthPct)&&U.barGapWidthPct>=0&&U.barGapWidthPct<=1000?U.barGapWidthPct:150,U.barGapDepthPct=!isNaN(U.barGapDepthPct)&&U.barGapDepthPct>=0&&U.barGapDepthPct<=1000?U.barGapDepthPct:150,U.chartColors=Array.isArray(U.chartColors)?U.chartColors:U._type===q0.PIE||U._type===q0.DOUGHNUT?HB:z8,U.chartColorsOpacity=U.chartColorsOpacity&&!isNaN(U.chartColorsOpacity)?U.chartColorsOpacity:null,U.border=U.border&&typeof U.border==="object"?U.border:null,U.border&&(!U.border.pt||isNaN(U.border.pt)))U.border.pt=v6.pt;if(U.border&&(!U.border.color||typeof U.border.color!=="string"))U.border.color=v6.color;if(U.plotArea=U.plotArea||{},U.plotArea.border=U.plotArea.border&&typeof U.plotArea.border==="object"?U.plotArea.border:null,U.plotArea.border&&(!U.plotArea.border.pt||isNaN(U.plotArea.border.pt)))U.plotArea.border.pt=v6.pt;if(U.plotArea.border&&(!U.plotArea.border.color||typeof U.plotArea.border.color!=="string"))U.plotArea.border.color=v6.color;if(U.border)U.plotArea.border=U.border;if(U.plotArea.fill=U.plotArea.fill||{color:null,transparency:null},U.fill)U.plotArea.fill.color=U.fill;if(U.chartArea=U.chartArea||{},U.chartArea.border=U.chartArea.border&&typeof U.chartArea.border==="object"?U.chartArea.border:null,U.chartArea.border)U.chartArea.border={color:U.chartArea.border.color||v6.color,pt:U.chartArea.border.pt||v6.pt};if(U.chartArea.roundedCorners=typeof U.chartArea.roundedCorners==="boolean"?U.chartArea.roundedCorners:!0,U.dataBorder=U.dataBorder&&typeof U.dataBorder==="object"?U.dataBorder:null,U.dataBorder&&(!U.dataBorder.pt||isNaN(U.dataBorder.pt)))U.dataBorder.pt=0.75;if(U.dataBorder&&U.dataBorder.color){let w=typeof U.dataBorder.color==="string"&&U.dataBorder.color.length===6&&/^[0-9A-Fa-f]{6}$/.test(U.dataBorder.color),F=Object.values(L5).includes(U.dataBorder.color);if(!w&&!F)U.dataBorder.color="F9F9F9"}if(!U.dataLabelFormatCode&&U._type===q0.SCATTER)U.dataLabelFormatCode="General";if(!U.dataLabelFormatCode&&(U._type===q0.PIE||U._type===q0.DOUGHNUT))U.dataLabelFormatCode=U.showPercent?"0%":"General";if(U.dataLabelFormatCode=U.dataLabelFormatCode&&typeof U.dataLabelFormatCode==="string"?U.dataLabelFormatCode:"#,##0",!U.dataLabelFormatScatter&&U._type===q0.SCATTER)U.dataLabelFormatScatter="custom";if(U.lineSize=typeof U.lineSize==="number"?U.lineSize:2,U.valAxisMajorUnit=typeof U.valAxisMajorUnit==="number"?U.valAxisMajorUnit:null,U._type===q0.AREA||U._type===q0.BAR||U._type===q0.BAR3D||U._type===q0.LINE)U.catAxisMultiLevelLabels=!!U.catAxisMultiLevelLabels;else delete U.catAxisMultiLevelLabels;return W._type="chart",W.options=U,W.chartRid=a2($),$._relsChart.push({rId:a2($),data:V,opts:U,type:U._type,globalId:G,fileName:`chart${G}.xml`,Target:`/ppt/charts/chart${G}.xml`}),$._slideObjects.push(W),W}function BJ($,q){let Q={_type:null,text:null,options:null,image:null,imageRid:null,hyperlink:null},K=q.x||0,J=q.y||0,Z=q.w||0,G=q.h||0,W=q.sizing||null,B=q.hyperlink||"",V=q.data||"",U=q.path||"",w=a2($),F=q.objectName?k0(q.objectName):`Image ${$._slideObjects.filter((k)=>k._type===D0.image).length}`;if(!U&&!V)return console.error("ERROR: addImage() requires either 'data' or 'path' parameter!"),null;else if(U&&typeof U!=="string")return console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(U)}`),null;else if(V&&typeof V!=="string")return console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(V)}`),null;else if(V&&typeof V==="string"&&!V.toLowerCase().includes("base64,"))return console.error("ERROR: Image `data` value lacks a base64 header! Ex: 'image/png;base64,NMP[...]')"),null;let M=(U.substring(U.lastIndexOf("/")+1).split("?")[0].split(".").pop().split("#")[0]||"png").toLowerCase();if(V&&/image\/(\w+);/.exec(V)&&/image\/(\w+);/.exec(V).length>0)M=/image\/(\w+);/.exec(V)[1];else if(V===null||V===void 0?void 0:V.toLowerCase().includes("image/svg+xml"))M="svg";if(Q._type=D0.image,Q.image=U||"preencoded.png",Q.options={x:K||0,y:J||0,w:Z||1,h:G||1,altText:q.altText||"",rounding:typeof q.rounding==="boolean"?q.rounding:!1,sizing:W,placeholder:q.placeholder,rotate:q.rotate||0,flipV:q.flipV||!1,flipH:q.flipH||!1,transparency:q.transparency||0,objectName:F,shadow:b7(q.shadow)},M==="svg")$._relsMedia.push({path:U||V+"png",type:"image/png",extn:"png",data:V||"",rId:w,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`,isSvgPng:!0,svgSize:{w:H0(Q.options.w,"X",$._presLayout),h:H0(Q.options.h,"Y",$._presLayout)}}),Q.imageRid=w,$._relsMedia.push({path:U||V,type:"image/svg+xml",extn:M,data:V||"",rId:w+1,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w+1;else{let k=$._relsMedia.filter((f)=>f.path&&f.path===U&&f.type==="image/"+M&&!f.isDuplicate)[0];$._relsMedia.push({path:U||"preencoded."+M,type:"image/"+M,extn:M,data:V||"",rId:w,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w}if(typeof B==="object")if(!B.url&&!B.slide)throw Error("ERROR: `hyperlink` option requires either: `url` or `slide`");else w++,$._rels.push({type:D0.hyperlink,data:B.slide?"slide":"dummy",rId:w,Target:B.url||B.slide.toString()}),B._rId=w,Q.hyperlink=B;$._slideObjects.push(Q)}function gB($,q){let Q=q.x||0,K=q.y||0,J=q.w||2,Z=q.h||2,G=q.data||"",W=q.link||"",B=q.path||"",V=q.type||"audio",U="",w=q.cover||vB,F=q.objectName?k0(q.objectName):`Media ${$._slideObjects.filter((k)=>k._type===D0.media).length}`,M={_type:D0.media};if(!B&&!G&&V!=="online")throw Error("addMedia() error: either `data` or `path` are required!");else if(G&&!G.toLowerCase().includes("base64,"))throw Error("addMedia() error: `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')");else if(!w.toLowerCase().includes("base64,"))throw Error("addMedia() error: `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')");if(V==="online"&&!W)throw Error("addMedia() error: online videos require `link` value");if(U=q.extn||(G?G.split(";")[0].split("/")[1]:B.split(".").pop())||"mp3",M.mtype=V,M.media=B||"preencoded.mov",M.options={},M.options.x=Q,M.options.y=K,M.options.w=J,M.options.h=Z,M.options.objectName=F,V==="online"){let k=a2($);$._relsMedia.push({path:B||"preencoded"+U,data:"dummy",type:"online",extn:U,rId:k,Target:W}),M.mediaRid=k,$._relsMedia.push({path:"preencoded.png",data:w,type:"image/png",extn:"png",rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}else{let k=$._relsMedia.filter((L)=>L.path&&L.path===B&&L.type===V+"/"+U&&!L.isDuplicate)[0],f=a2($);$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:f,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+1}.${U}`}),M.mediaRid=f,$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:a2($),isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+0}.${U}`}),$._relsMedia.push({path:"preencoded.png",type:"image/png",extn:"png",data:w,rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}$._slideObjects.push(M)}function AB($,q){$._slideObjects.push({_type:D0.notes,text:[{text:q}]})}function _7($,q,Q){let K=typeof Q==="object"?Q:{};K.line=K.line||{type:"none"};let J={_type:D0.text,shape:q||B1.RECTANGLE,options:K,text:null};if(!q)throw Error("Missing/Invalid shape parameter! Example: `addShape(pptxgen.shapes.LINE, {x:1, y:1, w:1, h:1});`");let Z={type:K.line.type||"solid",color:K.line.color||VJ,transparency:K.line.transparency||0,width:K.line.width||1,dashType:K.line.dashType||"solid",beginArrowType:K.line.beginArrowType||null,endArrowType:K.line.endArrowType||null};if(typeof K.line==="object"&&K.line.type!=="none")K.line=Z;if(K.x=K.x||(K.x===0?0:1),K.y=K.y||(K.y===0?0:1),K.w=K.w||(K.w===0?0:1),K.h=K.h||(K.h===0?0:1),K.objectName=K.objectName?k0(K.objectName):`Shape ${$._slideObjects.filter((G)=>G._type===D0.text).length}`,typeof K.line==="string"){let G=Z;G.color=String(K.line),K.line=G}if(typeof K.lineSize==="number")K.line.width=K.lineSize;if(typeof K.lineDash==="string")K.line.dashType=K.lineDash;if(typeof K.lineHead==="string")K.line.beginArrowType=K.lineHead;if(typeof K.lineTail==="string")K.line.endArrowType=K.lineTail;g6($,J),$._slideObjects.push(J)}function XB($,q,Q,K,J,Z,G){let W=[$],B=Q&&typeof Q==="object"?Q:{};B.objectName=B.objectName?k0(B.objectName):`Table ${$._slideObjects.filter((F)=>F._type===D0.table).length}`;{if(q===null||q.length===0||!Array.isArray(q))throw Error("addTable: Array expected! EX: 'slide.addTable( [rows], {options} );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)");if(!q[0]||!Array.isArray(q[0]))throw Error("addTable: 'rows' should be an array of cells! EX: 'slide.addTable( [ ['A'], ['B'], {text:'C',options:{align:'center'}} ] );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)")}let V=[];if(q.forEach((F)=>{let M=[];if(Array.isArray(F))F.forEach((k)=>{let f={_type:D0.tablecell,text:"",options:typeof k==="object"&&k.options?k.options:{}};if(typeof k==="string"||typeof k==="number")f.text=k.toString();else if(k.text){if(typeof k.text==="string"||typeof k.text==="number")f.text=k.text.toString();else if(k.text)f.text=k.text;if(k.options&&typeof k.options==="object")f.options=k.options}f.options.border=f.options.border||B.border||[{type:"none"},{type:"none"},{type:"none"},{type:"none"}];let L=f.options.border;if(!Array.isArray(L)&&typeof L==="object")f.options.border=[L,L,L,L];if(!f.options.border[0])f.options.border[0]={type:"none"};if(!f.options.border[1])f.options.border[1]={type:"none"};if(!f.options.border[2])f.options.border[2]={type:"none"};if(!f.options.border[3])f.options.border[3]={type:"none"};[0,1,2,3].forEach((z)=>{f.options.border[z]={type:f.options.border[z].type||H6.type,color:f.options.border[z].color||H6.color,pt:typeof f.options.border[z].pt==="number"?f.options.border[z].pt:H6.pt}}),M.push(f)});else console.log("addTable: tableRows has a bad row. A row should be an array of cells. You provided:"),console.log(F);V.push(M)}),B.x=H0(B.x||(B.x===0?0:L0/2),"X",J),B.y=H0(B.y||(B.y===0?0:L0/2),"Y",J),B.h)B.h=H0(B.h,"Y",J);if(B.fontSize=B.fontSize||k2,B.margin=B.margin===0||B.margin?B.margin:JJ,typeof B.margin==="number")B.margin=[Number(B.margin),Number(B.margin),Number(B.margin),Number(B.margin)];if(JSON.stringify({arrRows:V}).indexOf("hyperlink")===-1){if(!B.color)B.color=B.color||Q2}if(typeof B.border==="string")console.warn("addTable `border` option must be an object. Ex: `{border: {type:'none'}}`"),B.border=null;else if(Array.isArray(B.border))[0,1,2,3].forEach((F)=>{B.border[F]=B.border[F]?{type:B.border[F].type||H6.type,color:B.border[F].color||H6.color,pt:B.border[F].pt||H6.pt}:{type:"none"}});if(B.autoPage=typeof B.autoPage==="boolean"?B.autoPage:!1,B.autoPageRepeatHeader=typeof B.autoPageRepeatHeader==="boolean"?B.autoPageRepeatHeader:!1,B.autoPageHeaderRows=typeof B.autoPageHeaderRows<"u"&&!isNaN(Number(B.autoPageHeaderRows))?Number(B.autoPageHeaderRows):1,B.autoPageLineWeight=typeof B.autoPageLineWeight<"u"&&!isNaN(Number(B.autoPageLineWeight))?Number(B.autoPageLineWeight):0,B.autoPageLineWeight){if(B.autoPageLineWeight>1)B.autoPageLineWeight=1;else if(B.autoPageLineWeight<-1)B.autoPageLineWeight=-1}let U=M8;if(K&&typeof K._margin<"u"){if(Array.isArray(K._margin))U=K._margin;else if(!isNaN(Number(K._margin)))U=[Number(K._margin),Number(K._margin),Number(K._margin),Number(K._margin)]}if(B.colW){let F=V[0].reduce((M,k)=>{var f;if(((f=k===null||k===void 0?void 0:k.options)===null||f===void 0?void 0:f.colspan)&&typeof k.options.colspan==="number")M+=k.options.colspan;else M+=1;return M},0);if(typeof B.colW==="string"||typeof B.colW==="number")B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length===1&&F>1)B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length!==F)console.warn("addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths."),B.colW=null}else if(B.w)B.w=H0(B.w,"X",J);else B.w=Math.floor(J._sizeW/L0-U[1]-U[3]);if(B.x&&B.x<20)B.x=v0(B.x);if(B.y&&B.y<20)B.y=v0(B.y);if(B.w&&typeof B.w==="number"&&B.w<20)B.w=v0(B.w);if(B.h&&typeof B.h==="number"&&B.h<20)B.h=v0(B.h);V.forEach((F)=>{F.forEach((M,k)=>{if(typeof M==="number"||typeof M==="string")F[k]={_type:D0.tablecell,text:String(F[k]),options:B};else if(typeof M==="object"){if(typeof M.text==="number")F[k].text=F[k].text.toString();else if(typeof M.text>"u"||M.text===null)F[k].text="";F[k].options=M.options||{},F[k]._type=D0.tablecell}})});let w=[];if(B&&!B.autoPage)g6($,V),$._slideObjects.push({_type:D0.table,arrTabRows:V,options:Object.assign({},B)});else{if(B.autoPageRepeatHeader)B._arrObjTabHeadRows=V.filter((F,M)=>M{if(!G($._slideNum+M))W.push(Z({masterName:(K===null||K===void 0?void 0:K._name)||null}));if(M>0)B.y=v0(B.autoPageSlideStartY||B.newSlideStartY||U[0]);{let k=G($._slideNum+M);if(B.autoPage=!1,g6(k,F.rows),k.addTable(F.rows,Object.assign({},B)),M>0)w.push(k)}})}return w}function H5($,q,Q,K){let J={_type:K?D0.placeholder:D0.text,shape:(Q===null||Q===void 0?void 0:Q.shape)||B1.RECTANGLE,text:!q||q.length===0?[{text:"",options:null}]:q,options:Q||{}};function Z(G){{if(!G.placeholder)G.color=G.color||J.options.color||$.color||Q2;if(G.placeholder||K)G.bullet=G.bullet||!1;if(G.placeholder&&$._slideLayout&&$._slideLayout._slideObjects){let W=$._slideLayout._slideObjects.filter((B)=>B._type==="placeholder"&&B.options&&B.options.placeholder&&B.options.placeholder===G.placeholder)[0];if(W===null||W===void 0?void 0:W.options)G=Object.assign(Object.assign({},G),W.options)}if(G.objectName=G.objectName?k0(G.objectName):`Text ${$._slideObjects.filter((W)=>W._type===D0.text).length}`,G.shape===B1.LINE){let W={type:G.line.type||"solid",color:G.line.color||VJ,transparency:G.line.transparency||0,width:G.line.width||1,dashType:G.line.dashType||"solid",beginArrowType:G.line.beginArrowType||null,endArrowType:G.line.endArrowType||null};if(typeof G.line==="object")G.line=W;if(typeof G.line==="string"){let B=W;if(typeof G.line==="string")B.color=G.line;G.line=B}if(typeof G.lineSize==="number")G.line.width=G.lineSize;if(typeof G.lineDash==="string")G.line.dashType=G.lineDash;if(typeof G.lineHead==="string")G.line.beginArrowType=G.lineHead;if(typeof G.lineTail==="string")G.line.endArrowType=G.lineTail}if(G.line=G.line||{},G.lineSpacing=G.lineSpacing&&!isNaN(G.lineSpacing)?G.lineSpacing:null,G.lineSpacingMultiple=G.lineSpacingMultiple&&!isNaN(G.lineSpacingMultiple)?G.lineSpacingMultiple:null,G._bodyProp=G._bodyProp||{},G._bodyProp.autoFit=G.autoFit||!1,G._bodyProp.anchor=!G.placeholder?I6.ctr:null,G._bodyProp.vert=G.vert||null,G._bodyProp.wrap=typeof G.wrap==="boolean"?G.wrap:!0,G.inset&&!isNaN(Number(G.inset))||G.inset===0)G._bodyProp.lIns=v0(G.inset),G._bodyProp.rIns=v0(G.inset),G._bodyProp.tIns=v0(G.inset),G._bodyProp.bIns=v0(G.inset);if(typeof G.underline==="boolean"&&G.underline===!0)G.underline={style:"sng"}}{if((G.align||"").toLowerCase().indexOf("c")===0)G._bodyProp.align=R6.center;else if((G.align||"").toLowerCase().indexOf("l")===0)G._bodyProp.align=R6.left;else if((G.align||"").toLowerCase().indexOf("r")===0)G._bodyProp.align=R6.right;else if((G.align||"").toLowerCase().indexOf("j")===0)G._bodyProp.align=R6.justify;if((G.valign||"").toLowerCase().indexOf("b")===0)G._bodyProp.anchor=I6.b;else if((G.valign||"").toLowerCase().indexOf("m")===0)G._bodyProp.anchor=I6.ctr;else if((G.valign||"").toLowerCase().indexOf("t")===0)G._bodyProp.anchor=I6.t}return b7(G.shadow),G}J.options=Z(J.options),J.text.forEach((G)=>G.options=Z(G.options||{})),g6($,J.text||""),$._slideObjects.push(J)}function yB($){($._slideLayout._slideObjects||[]).forEach((q)=>{if(q._type===D0.placeholder){if($._slideObjects.filter((Q)=>Q.options&&Q.options.placeholder===q.options.placeholder).length===0)H5($,[{text:""}],q.options,!1)}})}function zJ($,q){var Q;if(q.bkgd){if(!q.background)q.background={};if(typeof q.bkgd==="string")q.background.color=q.bkgd;else{if(q.bkgd.data)q.background.data=q.bkgd.data;if(q.bkgd.path)q.background.path=q.bkgd.path;if(q.bkgd.src)q.background.path=q.bkgd.src}}if((Q=q.background)===null||Q===void 0?void 0:Q.fill)q.background.color=q.background.fill;if($&&($.path||$.data)){$.path=$.path||"preencoded.png";let K=($.path.split(".").pop()||"png").split("?")[0];if(K==="jpg")K="jpeg";q._relsMedia=q._relsMedia||[];let J=q._relsMedia.length+1;q._relsMedia.push({path:$.path,type:D0.image,extn:K,data:$.data||null,rId:J,Target:`../media/${(q._name||"").replace(/\s+/gi,"-")}-image-${q._relsMedia.length+1}.${K}`}),q._bkgdImgRid=J}}function g6($,q,Q){let K=[];if(typeof q==="string"||typeof q==="number")return;else if(Array.isArray(q))K=q;else if(typeof q==="object")K=[q];K.forEach((J,Z)=>{if(Q&&Q[Z]&&Q[Z].hyperlink)J.options=Object.assign(Object.assign({},J.options),Q[Z]);if(Array.isArray(J)){let G=[];J.forEach((W)=>{if(W.options&&!W.text.options)G.push(W.options)}),g6($,J,G)}else if(Array.isArray(J.text))g6($,J.text,Q&&Q[Z]?[Q[Z]]:void 0);else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&!J.options.hyperlink._rId)if(typeof J.options.hyperlink!=="object")console.log("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:'https://github.com'}` ");else if(!J.options.hyperlink.url&&!J.options.hyperlink.slide)console.log("ERROR: 'hyperlink requires either: `url` or `slide`'");else{let G=a2($);$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:G,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()}),J.options.hyperlink._rId=G}else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&J.options.hyperlink._rId){if($._rels.filter((G)=>G.rId===J.options.hyperlink._rId).length===0)$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:J.options.hyperlink._rId,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()})}})}class FJ{constructor($){var q;this.addSlide=$.addSlide,this.getSlide=$.getSlide,this._name=`Slide ${$.slideNumber}`,this._presLayout=$.presLayout,this._rId=$.slideRId,this._rels=[],this._relsChart=[],this._relsMedia=[],this._setSlideNum=$.setSlideNum,this._slideId=$.slideId,this._slideLayout=$.slideLayout||null,this._slideNum=$.slideNumber,this._slideObjects=[],this._slideNumberProps=((q=this._slideLayout)===null||q===void 0?void 0:q._slideNumberProps)?this._slideLayout._slideNumberProps:null}set bkgd($){if(this._bkgd=$,!this._background||!this._background.color){if(!this._background)this._background={};if(typeof $==="string")this._background.color=$}}get bkgd(){return this._bkgd}set background($){if(this._background=$,$)zJ($,this)}get background(){return this._background}set color($){this._color=$}get color(){return this._color}set hidden($){this._hidden=$}get hidden(){return this._hidden}set slideNumber($){this._slideNumberProps=$,this._setSlideNum($)}get slideNumber(){return this._slideNumberProps}get newAutoPagedSlides(){return this._newAutoPagedSlides}addChart($,q,Q){let K=Q||{};return K._type=$,WJ(this,$,q,Q),this}addImage($){return BJ(this,$),this}addMedia($){return gB(this,$),this}addNotes($){return AB(this,$),this}addShape($,q){return _7(this,$,q),this}addTable($,q){return this._newAutoPagedSlides=XB(this,$,q,this._slideLayout,this._presLayout,this.addSlide,this.getSlide),this}addText($,q){return H5(this,typeof $==="string"||typeof $==="number"?[{text:$,options:q}]:$,q,!1),this}}function hB($,q){return W2(this,void 0,void 0,function*(){let Q=$.data;return yield new Promise((K,J)=>{var Z,G;let W=new c7.default,B=(Q.length-1)*2+1,V=((G=(Z=Q[0])===null||Z===void 0?void 0:Z.labels)===null||G===void 0?void 0:G.length)>1;W.folder("_rels"),W.folder("docProps"),W.folder("xl/_rels"),W.folder("xl/tables"),W.folder("xl/theme"),W.folder("xl/worksheets"),W.folder("xl/worksheets/_rels"),W.file("[Content_Types].xml",' \n'),W.file("_rels/.rels",` `),W.file("docProps/app.xml",`Microsoft Macintosh Excel0falseWorksheets1Sheet1falsefalsefalse16.0300 `),W.file("docProps/core.xml",'PptxGenJSPptxGenJS'+new Date().toISOString()+''+new Date().toISOString()+""),W.file("xl/_rels/workbook.xml.rels",''),W.file("xl/styles.xml",'\n'),W.file("xl/theme/theme1.xml",''),W.file("xl/workbook.xml",` `),W.file("xl/worksheets/_rels/sheet1.xml.rels",` `);{let U='';if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)U+=``;else if($.opts._type===q0.SCATTER)U+=``;else if(V){let w=Q.length;Q[0].labels.forEach((F)=>w+=F.filter((M)=>M&&M!=="").length),U+=``,U+=""}else{let w=Q.length+Q[0].labels.length*Q[0].labels[0].length+Q[0].labels.length,F=Q.length+Q[0].labels.length*Q[0].labels[0].length+1;U+=``,U+=''}if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)Q.forEach((w,F)=>{if(F===0)U+="X-Axis";else U+=`${k0(w.name||`Y-Axis${F}`)}`,U+=`${k0(`Size${F}`)}`});else Q.forEach((w)=>{U+=`${k0((w.name||" ").replace("X-Axis","X-Values"))}`});if($.opts._type!==q0.BUBBLE&&$.opts._type!==q0.BUBBLE3D&&$.opts._type!==q0.SCATTER)Q[0].labels.slice().reverse().forEach((w)=>{w.filter((F)=>F&&F!=="").forEach((F)=>{U+=`${k0(F)}`})});U+=` `,W.file("xl/sharedStrings.xml",U)}{let U='';if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D){U+=``,U+=``;let w=1;Q.forEach((F,M)=>{if(M===0)U+=``;else U+=``,w++,U+=``})}else if($.opts._type===q0.SCATTER)U+=`
`,U+=``,Q.forEach((w,F)=>{U+=``});else U+=`
`,U+=``,Q[0].labels.forEach((w,F)=>{U+=``}),Q.forEach((w,F)=>{U+=``});U+="",U+='',U+="
",W.file("xl/tables/table1.xml",U)}{let U='';if(U+='',$.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)U+=``;else if($.opts._type===q0.SCATTER)U+=``;else U+=``;if(U+='',U+='',$.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D){U+="",U+=``,U+='0';for(let w=1;w${w}`;U+="",Q[0].values.forEach((w,F)=>{U+=``,U+=`${w}`;let M=2;for(let k=1;k${Q[k].values[F]||""}`,M++,U+=`${Q[k].sizes[F]||""}`,M++;U+=""})}else if($.opts._type===q0.SCATTER){U+="",U+=``;for(let w=0;w${w}`;U+="",Q[0].values.forEach((w,F)=>{U+=``,U+=`${w}`;for(let M=1;M${Q[M].values[F]||Q[M].values[F]===0?Q[M].values[F]:""}`;U+=""})}else if(U+="",!V){U+=``,Q[0].labels.forEach((w,F)=>{U+=`0`});for(let w=0;w${w+1}`;U+="",Q[0].labels[0].forEach((w,F)=>{U+=``;for(let M=Q[0].labels.length-1;M>=0;M--)U+=``,U+=`${Q.length+F+1}`,U+="";for(let M=0;M${Q[M].values[F]||""}`;U+=""})}else{U+=``;for(let k=0;k0`;for(let k=Q[0].labels.length-1;k${k}`;U+="";let w=Q.length,F=Q[0].labels[0].length,M=Q[0].labels.length;for(let k=0;k`;let f=w,L=Q[0].labels.slice().reverse();L.forEach((D,z)=>{if(D[k]){let H=z===0?1:L[z-1].filter((v)=>v&&v!=="").length;f+=H,U+=`${f}`}});for(let D=0;D${Q[D].values[k]||0}`;U+=""}}U+="",U+='',U+=` -`,W.file("xl/worksheets/sheet1.xml",U)}W.generateAsync({type:"base64"}).then((U)=>{q.file(`ppt/embeddings/Microsoft_Excel_Worksheet${$.globalId}.xlsx`,U,{base64:!0}),q.file("ppt/charts/_rels/"+$.fileName+".rels",``),q.file(`ppt/charts/${$.fileName}`,EB($)),K("")}).catch((U)=>{J(U)})})})}function EB($){var q,Q,K,J;let Z='',G=!1;{if(Z+='',Z+='',Z+=``,Z+="",$.opts.showTitle)Z+=v5({title:$.opts.title||"Chart Title",color:$.opts.titleColor,fontFace:$.opts.titleFontFace,fontSize:$.opts.titleFontSize||IB,titleAlign:$.opts.titleAlign,titleBold:$.opts.titleBold,titlePos:$.opts.titlePos,titleRotate:$.opts.titleRotate},$.opts.x,$.opts.y),Z+='';else Z+='';if($.opts._type===q0.BAR3D)Z+=``;if(Z+="",$.opts.layout)Z+="",Z+=" ",Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+="";else Z+=""}if(Array.isArray($.opts._type))$.opts._type.forEach((W)=>{let B=Object.assign(Object.assign({},$.opts),W.options),V=B.secondaryValAxis?Y5:o2,U=B.secondaryCatAxis?O7:B8;G=G||B.secondaryValAxis,Z+=$J(W.type,W.data,B,V,U)});else Z+=$J($.opts._type,$.data,$.opts,o2,B8);if($.opts._type!==q0.PIE&&$.opts._type!==q0.DOUGHNUT){if($.opts.valAxes&&$.opts.valAxes.length>1&&!G)throw Error("Secondary axis must be used by one of the multiple charts");if($.opts.catAxes){if(!$.opts.valAxes||$.opts.valAxes.length!==$.opts.catAxes.length)throw Error("There must be the same number of value and category axes.");Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[0]),B8,o2)}else Z+=X7($.opts,B8,o2);if($.opts.valAxes){if(Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[0]),o2),$.opts.valAxes[1])Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[1]),Y5)}else if(Z+=y7($.opts,o2),$.opts._type===q0.BAR3D)Z+=_B($.opts,UJ,o2);if(((q=$.opts)===null||q===void 0?void 0:q.catAxes)&&((Q=$.opts)===null||Q===void 0?void 0:Q.catAxes[1]))Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[1]),O7,Y5)}{if($.opts.showDataTable)Z+="",Z+=` `,Z+=` `,Z+=` `,Z+=` `,Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=` `,Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+="";if(Z+=" ",Z+=((K=$.opts.plotArea.fill)===null||K===void 0?void 0:K.color)?B2($.opts.plotArea.fill):"",Z+=$.opts.plotArea.border?`${B2($.opts.plotArea.border.color)}`:"",Z+=" ",Z+=" ",Z+="",$.opts.showLegend){if(Z+="",Z+='',Z+='',$.opts.legendFontFace||$.opts.legendFontSize||$.opts.legendColor){if(Z+="",Z+=" ",Z+=" ",Z+=" ",Z+=" ",Z+=$.opts.legendFontSize?``:"",$.opts.legendColor)Z+=B2($.opts.legendColor);if($.opts.legendFontFace)Z+='';if($.opts.legendFontFace)Z+='';Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=""}Z+=""}}if(Z+=' ',Z+=' ',$.opts._type===q0.SCATTER)Z+='';return Z+="",Z+="",Z+=((J=$.opts.chartArea.fill)===null||J===void 0?void 0:J.color)?B2($.opts.chartArea.fill):"",Z+=$.opts.chartArea.border?`${B2($.opts.chartArea.border.color)}`:"",Z+=" ",Z+="",Z+='',Z+="",Z}function $J($,q,Q,K,J,Z){let G=-1,W=1,B=null,V="";switch($){case q0.AREA:case q0.BAR:case q0.BAR3D:case q0.LINE:case q0.RADAR:if(V+=``,$===q0.AREA&&Q.barGrouping==="stacked")V+='';if($===q0.BAR||$===q0.BAR3D)V+='',V+='';if($===q0.RADAR)V+='';V+='',q.forEach((U)=>{var w;G++,V+="",V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(U._dataIndex+U.labels.length+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";let F=Q.chartColors?Q.chartColors[G%Q.chartColors.length]:null;if(V+=" ",F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,``)+"";else V+=""+R0(F)+"";if($===q0.LINE||$===q0.RADAR)if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+='';else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;if(V+=T1(Q.shadow,P1),V+=" ",V+=' ',$!==q0.RADAR){if(V+="",V+=``,Q.dataLabelBkgrdColors)V+=`${R0(F)}`;if(V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+=``,V+=""}if($===q0.LINE||$===q0.RADAR){if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+=" ",V+=` ${R0(Q.chartColors[U._dataIndex+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):U._dataIndex])}`,V+=` ${R0(Q.lineDataSymbolLineColor||F)}`,V+=" ",V+=" ",V+=""}if(($===q0.BAR||$===q0.BAR3D)&&q.length===1&&(Q.chartColors&&Q.chartColors!==z8&&Q.chartColors.length>1||((w=Q.invertedColors)===null||w===void 0?void 0:w.length)))U.values.forEach((M,k)=>{let f=M<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else if($===q0.BAR)V+="",V+=' ',V+="";else V+="",V+=" ",V+=' ',V+=" ",V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});{if(V+="",Q.catLabelFormatCode)V+=" ",V+=` Sheet1!$A$2:$A$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.catLabelFormatCode||"General")+"",V+=` `,U.labels[0].forEach((M,k)=>V+=`${k0(M)}`),V+=" ",V+=" ";else V+=" ",V+=` Sheet1!$A$2:$${j0(U.labels.length)}$${U.labels[0].length+1}`,V+=" ",V+=` `,U.labels.forEach((M)=>{V+="",M.forEach((k,f)=>V+=`${k0(k)}`),V+=""}),V+=" ",V+=" ";V+=""}if(V+="",V+=" ",V+=`Sheet1!$${j0(U._dataIndex+U.labels.length+1)}$2:$${j0(U._dataIndex+U.labels.length+1)}$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.valLabelFormatCode||Q.dataTableFormatCode||"General")+"",V+=` `,U.values.forEach((M,k)=>V+=`${M||M===0?M:""}`),V+=" ",V+=" ",V+="",$===q0.LINE)V+='';V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+=" "}if($===q0.BAR)V+=` `,V+=` `;else if($===q0.BAR3D)V+=` `,V+=` `,V+=' ';else if($===q0.LINE)V+=' ';V+=``,V+=``;break;case q0.SCATTER:V+="",V+='',V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=` Sheet1!$${j0(w+2)}$1`,V+=' '+k0(U.name)+"",V+=" ",V+=" ",V+=" ";{let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,'')+"";else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1)}V+=" ";{if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+="",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,V+=`${R0(Q.lineDataSymbolLineColor||Q.chartColors[G%Q.chartColors.length])}`,V+="",V+="",V+=""}if(Q.showLabel){let F=k5("-xxxx-xxxx-xxxx-xxxxxxxxxxxx");if(U.labels[0]&&(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"))V+="",U.labels[0].forEach((M,k)=>{if(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"){if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" "+k0(M)+"",V+=" ",Q.dataLabelFormatScatter==="customXY"&&!/^ *$/.test(M))V+=" ",V+=' ',V+=" (",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"",V+=" ",V+=" ",V+=' ',V+=" , ",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"]",V+=" ",V+=" ",V+=' ',V+=" )",V+=" ",V+=' ';if(V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=` `,V+=" ",V+=" ",V+=""}}),V+="";if(Q.dataLabelFormatScatter==="XY"){if(V+="",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=` `,V+=` `,V+=` `,V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=""}}if(q.length===1&&Q.chartColors!==z8)U.values.forEach((F,M)=>{let k=F<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else V+="",V+=' ',V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=` Sheet1!$${j0(w+2)}$2:$${j0(w+2)}$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+='',V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}V+=``,V+="";break;case q0.BUBBLE:case q0.BUBBLE3D:V+="",V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(W+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";{V+="";let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=`${R0(F,'')}`;else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1),V+=""}V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${q[0].values.length+1}`,W++,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${U.sizes.length+1}`,W++,V+=" ",V+=" General",V+=` `,U.sizes.forEach((F,M)=>{V+=`${F||""}`}),V+=" ",V+=" ",V+=" ",V+=' ',V+=""});{if(V+="",V+=``,V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+="",V+=' ',V+=' ',V+=" ",V+="",V+=""}V+=``,V+="";break;case q0.DOUGHNUT:case q0.PIE:if(B=q[0],V+="",V+=' ',V+="",V+=' ',V+=' ',V+=" ",V+=" ",V+=" Sheet1!$B$1",V+=" ",V+=' ',V+=' '+k0(B.name)+"",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=' ',Q.dataNoEffects)V+="";else V+=T1(Q.shadow,P1);if(V+=" ",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=' ',V+=" ",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;V+=T1(Q.shadow,P1),V+=" ",V+=""}),V+="",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=` `,V+=" ",V+=" ",V+=" ",$===q0.PIE&&Q.dataLabelPosition)V+=``;V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}),V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=' ',V+=" ",V+=" ",V+=" ",V+=" ",V+=$===q0.PIE?'':"",V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+="",V+="",V+=" ",V+=` Sheet1!$A$2:$A$${B.labels[0].length+1}`,V+=" ",V+=` `,B.labels[0].forEach((U,w)=>{V+=`${k0(U)}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=` Sheet1!$B$2:$B$${B.labels[0].length+1}`,V+=" ",V+=` `,B.values.forEach((U,w)=>{V+=`${U||U===0?U:""}`}),V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,$===q0.DOUGHNUT)V+=``;V+="";break;default:V+="";break}return V}function X7($,q,Q){let K="";if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";if(K+=' ',K+=" ",K+='',$.catAxisMaxVal||$.catAxisMaxVal===0)K+=``;if($.catAxisMinVal||$.catAxisMinVal===0)K+=``;if(K+="",K+=' ',K+=' ',K+=$.catGridLine.style!=="none"?n7($.catGridLine):"",$.showCatAxisTitle)K+=v5({color:$.catAxisTitleColor,fontFace:$.catAxisTitleFontFace,fontSize:$.catAxisTitleFontSize,titleRotate:$.catAxisTitleRotate,title:$.catAxisTitle||"Axis Title"});if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+=' ';else K+=' ';if($._type===q0.SCATTER)K+=' ',K+=' ',K+=' ';else K+=' ',K+=' ',K+=' ';if(K+=" ",K+=` `,K+=!$.catAxisLineShow?"":""+R0($.catAxisLineColor||u1.color)+"",K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",$.catAxisLabelRotate)K+=``;else K+="";if(K+=" ",K+=" ",K+=" ",K+=` `,K+=" "+R0($.catAxisLabelColor||Q2)+"",K+=' ',K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=` `,K+=' ',K+=' ',K+=` `,$.catAxisLabelFrequency)K+=' ';if($.catLabelFormatCode||$._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D){if($.catLabelFormatCode){if(["catAxisBaseTimeUnit","catAxisMajorTimeUnit","catAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes($[J].toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.catAxisBaseTimeUnit)K+='';if($.catAxisMajorTimeUnit)K+='';if($.catAxisMinorTimeUnit)K+=''}if($.catAxisMajorUnit)K+=``;if($.catAxisMinorUnit)K+=``}if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";return K}function y7($,q){let Q=q===o2?$.barDir==="col"?"l":"b":$.barDir!=="col"?"r":"t";if(q===Y5)Q="r";let K=q===o2?B8:O7,J="";if(J+="",J+=' ',J+=" ",$.valAxisLogScaleBase)J+=``;if(J+='',$.valAxisMaxVal||$.valAxisMaxVal===0)J+=``;if($.valAxisMinVal||$.valAxisMinVal===0)J+=``;if(J+=" ",J+=` `,J+=' ',$.valGridLine.style!=="none")J+=n7($.valGridLine);if($.showValAxisTitle)J+=v5({color:$.valAxisTitleColor,fontFace:$.valAxisTitleFontFace,fontSize:$.valAxisTitleFontSize,titleRotate:$.valAxisTitleRotate,title:$.valAxisTitle||"Axis Title"});if(J+=``,$._type===q0.SCATTER)J+=' ',J+=' ',J+=' ';else J+=' ',J+=' ',J+=' ';if(J+=" ",J+=` `,J+=!$.valAxisLineShow?"":""+R0($.valAxisLineColor||u1.color)+"",J+=' ',J+=" ",J+=" ",J+=" ",J+=" ",J+=` `,J+=" ",J+=" ",J+=" ",J+=` `,J+=" "+R0($.valAxisLabelColor||Q2)+"",J+=' ',J+=" ",J+=" ",J+=' ',J+=" ",J+=" ",J+=' ',typeof $.catAxisCrossesAt==="number")J+=` `;else if(typeof $.catAxisCrossesAt==="string")J+=' ';else J+=' ';if(J+=' ',$.valAxisMajorUnit)J+=` `;if($.valAxisDisplayUnit)J+=`${$.valAxisDisplayUnitLabel?"":""}`;return J+="",J}function _B($,q,Q){let K="";if(K+="",K+=' ',K+=' ',K+=' ',K+=' ',K+=$.serGridLine.style!=="none"?n7($.serGridLine):"",$.showSerAxisTitle)K+=v5({color:$.serAxisTitleColor,fontFace:$.serAxisTitleFontFace,fontSize:$.serAxisTitleFontSize,titleRotate:$.serAxisTitleRotate,title:$.serAxisTitle||"Axis Title"});if(K+=` `,K+=' ',K+=' ',K+=` `,K+=" ",K+=' ',K+=!$.serAxisLineShow?"":`${R0($.serAxisLineColor||u1.color)}`,K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=` `,K+=` ${R0($.serAxisLabelColor||Q2)}`,K+=` `,K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=' ',$.serAxisLabelFrequency)K+=' ';if($.serLabelFormatCode){if(["serAxisBaseTimeUnit","serAxisMajorTimeUnit","serAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes(J.toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.serAxisBaseTimeUnit)K+=` `;if($.serAxisMajorTimeUnit)K+=` `;if($.serAxisMinorTimeUnit)K+=` `;if($.serAxisMajorUnit)K+=` `;if($.serAxisMinorUnit)K+=` `}return K+="",K}function v5($,q,Q){let K=$.titleAlign==="left"||$.titleAlign==="right"?``:"",J=$.titleRotate?``:"",Z=$.fontSize?`sz="${Math.round($.fontSize*100)}"`:"",G=$.titleBold?1:0,W="";if($.titlePos&&typeof $.titlePos.x==="number"&&typeof $.titlePos.y==="number"){let B=$.titlePos.x+q,V=$.titlePos.y+Q,U=B===0?0:B*(B/5)/10;if(U>=1)U=U/10;if(U>=0.1)U=U/10;let w=V===0?0:V*(V/5)/10;if(w>=1)w=w/10;if(w>=0.1)w=w/10;W=``}return` +`,W.file("xl/worksheets/sheet1.xml",U)}W.generateAsync({type:"base64"}).then((U)=>{q.file(`ppt/embeddings/Microsoft_Excel_Worksheet${$.globalId}.xlsx`,U,{base64:!0}),q.file("ppt/charts/_rels/"+$.fileName+".rels",``),q.file(`ppt/charts/${$.fileName}`,xB($)),K("")}).catch((U)=>{J(U)})})})}function xB($){var q,Q,K,J;let Z='',G=!1;{if(Z+='',Z+='',Z+=``,Z+="",$.opts.showTitle)Z+=v5({title:$.opts.title||"Chart Title",color:$.opts.titleColor,fontFace:$.opts.titleFontFace,fontSize:$.opts.titleFontSize||DB,titleAlign:$.opts.titleAlign,titleBold:$.opts.titleBold,titlePos:$.opts.titlePos,titleRotate:$.opts.titleRotate},$.opts.x,$.opts.y),Z+='';else Z+='';if($.opts._type===q0.BAR3D)Z+=``;if(Z+="",$.opts.layout)Z+="",Z+=" ",Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+="";else Z+=""}if(Array.isArray($.opts._type))$.opts._type.forEach((W)=>{let B=Object.assign(Object.assign({},$.opts),W.options),V=B.secondaryValAxis?Y5:o2,U=B.secondaryCatAxis?O7:B8;G=G||B.secondaryValAxis,Z+=$J(W.type,W.data,B,V,U)});else Z+=$J($.opts._type,$.data,$.opts,o2,B8);if($.opts._type!==q0.PIE&&$.opts._type!==q0.DOUGHNUT){if($.opts.valAxes&&$.opts.valAxes.length>1&&!G)throw Error("Secondary axis must be used by one of the multiple charts");if($.opts.catAxes){if(!$.opts.valAxes||$.opts.valAxes.length!==$.opts.catAxes.length)throw Error("There must be the same number of value and category axes.");Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[0]),B8,o2)}else Z+=X7($.opts,B8,o2);if($.opts.valAxes){if(Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[0]),o2),$.opts.valAxes[1])Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[1]),Y5)}else if(Z+=y7($.opts,o2),$.opts._type===q0.BAR3D)Z+=OB($.opts,UJ,o2);if(((q=$.opts)===null||q===void 0?void 0:q.catAxes)&&((Q=$.opts)===null||Q===void 0?void 0:Q.catAxes[1]))Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[1]),O7,Y5)}{if($.opts.showDataTable)Z+="",Z+=` `,Z+=` `,Z+=` `,Z+=` `,Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=` `,Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+="";if(Z+=" ",Z+=((K=$.opts.plotArea.fill)===null||K===void 0?void 0:K.color)?B2($.opts.plotArea.fill):"",Z+=$.opts.plotArea.border?`${B2($.opts.plotArea.border.color)}`:"",Z+=" ",Z+=" ",Z+="",$.opts.showLegend){if(Z+="",Z+='',Z+='',$.opts.legendFontFace||$.opts.legendFontSize||$.opts.legendColor){if(Z+="",Z+=" ",Z+=" ",Z+=" ",Z+=" ",Z+=$.opts.legendFontSize?``:"",$.opts.legendColor)Z+=B2($.opts.legendColor);if($.opts.legendFontFace)Z+='';if($.opts.legendFontFace)Z+='';Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=""}Z+=""}}if(Z+=' ',Z+=' ',$.opts._type===q0.SCATTER)Z+='';return Z+="",Z+="",Z+=((J=$.opts.chartArea.fill)===null||J===void 0?void 0:J.color)?B2($.opts.chartArea.fill):"",Z+=$.opts.chartArea.border?`${B2($.opts.chartArea.border.color)}`:"",Z+=" ",Z+="",Z+='',Z+="",Z}function $J($,q,Q,K,J,Z){let G=-1,W=1,B=null,V="";switch($){case q0.AREA:case q0.BAR:case q0.BAR3D:case q0.LINE:case q0.RADAR:if(V+=``,$===q0.AREA&&Q.barGrouping==="stacked")V+='';if($===q0.BAR||$===q0.BAR3D)V+='',V+='';if($===q0.RADAR)V+='';V+='',q.forEach((U)=>{var w;G++,V+="",V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(U._dataIndex+U.labels.length+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";let F=Q.chartColors?Q.chartColors[G%Q.chartColors.length]:null;if(V+=" ",F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,``)+"";else V+=""+R0(F)+"";if($===q0.LINE||$===q0.RADAR)if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+='';else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;if(V+=T1(Q.shadow,P1),V+=" ",V+=' ',$!==q0.RADAR){if(V+="",V+=``,Q.dataLabelBkgrdColors)V+=`${R0(F)}`;if(V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+=``,V+=""}if($===q0.LINE||$===q0.RADAR){if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+=" ",V+=` ${R0(Q.chartColors[U._dataIndex+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):U._dataIndex])}`,V+=` ${R0(Q.lineDataSymbolLineColor||F)}`,V+=" ",V+=" ",V+=""}if(($===q0.BAR||$===q0.BAR3D)&&q.length===1&&(Q.chartColors&&Q.chartColors!==z8&&Q.chartColors.length>1||((w=Q.invertedColors)===null||w===void 0?void 0:w.length)))U.values.forEach((M,k)=>{let f=M<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else if($===q0.BAR)V+="",V+=' ',V+="";else V+="",V+=" ",V+=' ',V+=" ",V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});{if(V+="",Q.catLabelFormatCode)V+=" ",V+=` Sheet1!$A$2:$A$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.catLabelFormatCode||"General")+"",V+=` `,U.labels[0].forEach((M,k)=>V+=`${k0(M)}`),V+=" ",V+=" ";else V+=" ",V+=` Sheet1!$A$2:$${j0(U.labels.length)}$${U.labels[0].length+1}`,V+=" ",V+=` `,U.labels.forEach((M)=>{V+="",M.forEach((k,f)=>V+=`${k0(k)}`),V+=""}),V+=" ",V+=" ";V+=""}if(V+="",V+=" ",V+=`Sheet1!$${j0(U._dataIndex+U.labels.length+1)}$2:$${j0(U._dataIndex+U.labels.length+1)}$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.valLabelFormatCode||Q.dataTableFormatCode||"General")+"",V+=` `,U.values.forEach((M,k)=>V+=`${M||M===0?M:""}`),V+=" ",V+=" ",V+="",$===q0.LINE)V+='';V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+=" "}if($===q0.BAR)V+=` `,V+=` `;else if($===q0.BAR3D)V+=` `,V+=` `,V+=' ';else if($===q0.LINE)V+=' ';V+=``,V+=``;break;case q0.SCATTER:V+="",V+='',V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=` Sheet1!$${j0(w+2)}$1`,V+=' '+k0(U.name)+"",V+=" ",V+=" ",V+=" ";{let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,'')+"";else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1)}V+=" ";{if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+="",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,V+=`${R0(Q.lineDataSymbolLineColor||Q.chartColors[G%Q.chartColors.length])}`,V+="",V+="",V+=""}if(Q.showLabel){let F=k5("-xxxx-xxxx-xxxx-xxxxxxxxxxxx");if(U.labels[0]&&(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"))V+="",U.labels[0].forEach((M,k)=>{if(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"){if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" "+k0(M)+"",V+=" ",Q.dataLabelFormatScatter==="customXY"&&!/^ *$/.test(M))V+=" ",V+=' ',V+=" (",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"",V+=" ",V+=" ",V+=' ',V+=" , ",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"]",V+=" ",V+=" ",V+=' ',V+=" )",V+=" ",V+=' ';if(V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=` `,V+=" ",V+=" ",V+=""}}),V+="";if(Q.dataLabelFormatScatter==="XY"){if(V+="",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=` `,V+=` `,V+=` `,V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=""}}if(q.length===1&&Q.chartColors!==z8)U.values.forEach((F,M)=>{let k=F<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else V+="",V+=' ',V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=` Sheet1!$${j0(w+2)}$2:$${j0(w+2)}$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+='',V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}V+=``,V+="";break;case q0.BUBBLE:case q0.BUBBLE3D:V+="",V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(W+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";{V+="";let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=`${R0(F,'')}`;else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1),V+=""}V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${q[0].values.length+1}`,W++,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${U.sizes.length+1}`,W++,V+=" ",V+=" General",V+=` `,U.sizes.forEach((F,M)=>{V+=`${F||""}`}),V+=" ",V+=" ",V+=" ",V+=' ',V+=""});{if(V+="",V+=``,V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+="",V+=' ',V+=' ',V+=" ",V+="",V+=""}V+=``,V+="";break;case q0.DOUGHNUT:case q0.PIE:if(B=q[0],V+="",V+=' ',V+="",V+=' ',V+=' ',V+=" ",V+=" ",V+=" Sheet1!$B$1",V+=" ",V+=' ',V+=' '+k0(B.name)+"",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=' ',Q.dataNoEffects)V+="";else V+=T1(Q.shadow,P1);if(V+=" ",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=' ',V+=" ",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;V+=T1(Q.shadow,P1),V+=" ",V+=""}),V+="",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=` `,V+=" ",V+=" ",V+=" ",$===q0.PIE&&Q.dataLabelPosition)V+=``;V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}),V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=' ',V+=" ",V+=" ",V+=" ",V+=" ",V+=$===q0.PIE?'':"",V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+="",V+="",V+=" ",V+=` Sheet1!$A$2:$A$${B.labels[0].length+1}`,V+=" ",V+=` `,B.labels[0].forEach((U,w)=>{V+=`${k0(U)}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=` Sheet1!$B$2:$B$${B.labels[0].length+1}`,V+=" ",V+=` `,B.values.forEach((U,w)=>{V+=`${U||U===0?U:""}`}),V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,$===q0.DOUGHNUT)V+=``;V+="";break;default:V+="";break}return V}function X7($,q,Q){let K="";if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";if(K+=' ',K+=" ",K+='',$.catAxisMaxVal||$.catAxisMaxVal===0)K+=``;if($.catAxisMinVal||$.catAxisMinVal===0)K+=``;if(K+="",K+=' ',K+=' ',K+=$.catGridLine.style!=="none"?n7($.catGridLine):"",$.showCatAxisTitle)K+=v5({color:$.catAxisTitleColor,fontFace:$.catAxisTitleFontFace,fontSize:$.catAxisTitleFontSize,titleRotate:$.catAxisTitleRotate,title:$.catAxisTitle||"Axis Title"});if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+=' ';else K+=' ';if($._type===q0.SCATTER)K+=' ',K+=' ',K+=' ';else K+=' ',K+=' ',K+=' ';if(K+=" ",K+=` `,K+=!$.catAxisLineShow?"":""+R0($.catAxisLineColor||u1.color)+"",K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",$.catAxisLabelRotate)K+=``;else K+="";if(K+=" ",K+=" ",K+=" ",K+=` `,K+=" "+R0($.catAxisLabelColor||Q2)+"",K+=' ',K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=` `,K+=' ',K+=' ',K+=` `,$.catAxisLabelFrequency)K+=' ';if($.catLabelFormatCode||$._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D){if($.catLabelFormatCode){if(["catAxisBaseTimeUnit","catAxisMajorTimeUnit","catAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes($[J].toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.catAxisBaseTimeUnit)K+='';if($.catAxisMajorTimeUnit)K+='';if($.catAxisMinorTimeUnit)K+=''}if($.catAxisMajorUnit)K+=``;if($.catAxisMinorUnit)K+=``}if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";return K}function y7($,q){let Q=q===o2?$.barDir==="col"?"l":"b":$.barDir!=="col"?"r":"t";if(q===Y5)Q="r";let K=q===o2?B8:O7,J="";if(J+="",J+=' ',J+=" ",$.valAxisLogScaleBase)J+=``;if(J+='',$.valAxisMaxVal||$.valAxisMaxVal===0)J+=``;if($.valAxisMinVal||$.valAxisMinVal===0)J+=``;if(J+=" ",J+=` `,J+=' ',$.valGridLine.style!=="none")J+=n7($.valGridLine);if($.showValAxisTitle)J+=v5({color:$.valAxisTitleColor,fontFace:$.valAxisTitleFontFace,fontSize:$.valAxisTitleFontSize,titleRotate:$.valAxisTitleRotate,title:$.valAxisTitle||"Axis Title"});if(J+=``,$._type===q0.SCATTER)J+=' ',J+=' ',J+=' ';else J+=' ',J+=' ',J+=' ';if(J+=" ",J+=` `,J+=!$.valAxisLineShow?"":""+R0($.valAxisLineColor||u1.color)+"",J+=' ',J+=" ",J+=" ",J+=" ",J+=" ",J+=` `,J+=" ",J+=" ",J+=" ",J+=` `,J+=" "+R0($.valAxisLabelColor||Q2)+"",J+=' ',J+=" ",J+=" ",J+=' ',J+=" ",J+=" ",J+=' ',typeof $.catAxisCrossesAt==="number")J+=` `;else if(typeof $.catAxisCrossesAt==="string")J+=' ';else J+=' ';if(J+=' ',$.valAxisMajorUnit)J+=` `;if($.valAxisDisplayUnit)J+=`${$.valAxisDisplayUnitLabel?"":""}`;return J+="",J}function OB($,q,Q){let K="";if(K+="",K+=' ',K+=' ',K+=' ',K+=' ',K+=$.serGridLine.style!=="none"?n7($.serGridLine):"",$.showSerAxisTitle)K+=v5({color:$.serAxisTitleColor,fontFace:$.serAxisTitleFontFace,fontSize:$.serAxisTitleFontSize,titleRotate:$.serAxisTitleRotate,title:$.serAxisTitle||"Axis Title"});if(K+=` `,K+=' ',K+=' ',K+=` `,K+=" ",K+=' ',K+=!$.serAxisLineShow?"":`${R0($.serAxisLineColor||u1.color)}`,K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=` `,K+=` ${R0($.serAxisLabelColor||Q2)}`,K+=` `,K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=' ',$.serAxisLabelFrequency)K+=' ';if($.serLabelFormatCode){if(["serAxisBaseTimeUnit","serAxisMajorTimeUnit","serAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes(J.toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.serAxisBaseTimeUnit)K+=` `;if($.serAxisMajorTimeUnit)K+=` `;if($.serAxisMinorTimeUnit)K+=` `;if($.serAxisMajorUnit)K+=` `;if($.serAxisMinorUnit)K+=` `}return K+="",K}function v5($,q,Q){let K=$.titleAlign==="left"||$.titleAlign==="right"?``:"",J=$.titleRotate?``:"",Z=$.fontSize?`sz="${Math.round($.fontSize*100)}"`:"",G=$.titleBold?1:0,W="";if($.titlePos&&typeof $.titlePos.x==="number"&&typeof $.titlePos.y==="number"){let B=$.titlePos.x+q,V=$.titlePos.y+Q,U=B===0?0:B*(B/5)/10;if(U>=1)U=U/10;if(U>=0.1)U=U/10;let w=V===0?0:V*(V/5)/10;if(w>=1)w=w/10;if(w>=0.1)w=w/10;W=``}return` ${J} @@ -54,22 +54,22 @@ ${W} `}function j0($){let q="",Q=$-1;if(Q<=25)q=W8[Q];else q=`${W8[Math.floor(Q/W8.length-1)]}${W8[Q%W8.length]}`;return q}function T1($,q){if(!$)return"";else if(typeof $!=="object")return console.warn("`shadow` options must be an object. Ex: `{shadow: {type:'none'}}`"),"";let Q="",K=Object.assign(Object.assign({},q),$),J=K.type||"outer",Z=Y0(K.blur),G=Y0(K.offset),W=Math.round(K.angle*60000),B=K.color,V=Math.round(K.opacity*1e5),U=K.rotateWithShape?1:0;return Q+=``,Q+=``,Q+=``,Q+=``,Q+="",Q}function n7($){let q="";return q+=" ",q+=` `,q+=' ',q+=' ',q+=" ",q+=" ",q+="",q}function D5($){if(!$||$==="flat")return"flat";else if($==="square")return"sq";else if($==="round")return"rnd";else throw Error(`Invalid chart line cap: ${$}`)}function h7($){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node",J,Z,G=K?()=>W2(this,void 0,void 0,function*(){({default:J}=yield import("node:fs")),{default:Z}=yield Promise.resolve().then(() => (tK(),sK))}):()=>W2(this,void 0,void 0,function*(){});if(K)G();let W=[],B=$._relsMedia.filter((U)=>U.type!=="online"&&!U.data&&(!U.path||U.path&&!U.path.includes("preencoded"))),V=[];return B.forEach((U)=>{if(!V.includes(U.path))U.isDuplicate=!1,V.push(U.path);else U.isDuplicate=!0}),B.filter((U)=>!U.isDuplicate).forEach((U)=>{W.push((()=>W2(this,void 0,void 0,function*(){if(!Z)yield G();if(K&&J&&U.path.indexOf("http")!==0)try{let w=J.readFileSync(U.path);return U.data=Buffer.from(w).toString("base64"),B.filter((F)=>F.isDuplicate&&F.path===U.path).forEach((F)=>F.data=U.data),"done"}catch(w){throw U.data=j6,B.filter((F)=>F.isDuplicate&&F.path===U.path).forEach((F)=>F.data=U.data),Error(`ERROR: Unable to read media: "${U.path}" -${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F)=>{Z.get(U.path,(M)=>{let k="";M.setEncoding("binary"),M.on("data",(f)=>k+=f),M.on("end",()=>{U.data=Buffer.from(k,"binary").toString("base64"),B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),w("done")}),M.on("error",()=>{U.data=j6,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),F(Error(`ERROR! Unable to load image (https.get): ${U.path}`))})})});return yield new Promise((w,F)=>{let M=new XMLHttpRequest;M.onload=()=>{let k=new FileReader;k.onloadend=()=>{if(U.data=k.result,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),!U.isSvgPng)w("done");else QJ(U).then(()=>w("done")).catch(F)},k.readAsDataURL(M.response)},M.onerror=()=>{U.data=j6,B.filter((k)=>k.isDuplicate&&k.path===U.path).forEach((k)=>k.data=U.data),F(Error(`ERROR! Unable to load image (xhr.onerror): ${U.path}`))},M.open("GET",U.path),M.responseType="blob",M.send()})}))())}),$._relsMedia.filter((U)=>U.isSvgPng&&U.data).forEach((U)=>{(()=>W2(this,void 0,void 0,function*(){if(K&&!J)yield G();if(K&&J)U.data=j6,W.push(Promise.resolve("done"));else W.push(QJ(U))}))()}),W}function QJ($){return W2(this,void 0,void 0,function*(){return yield new Promise((q,Q)=>{let K=new Image;K.onload=()=>{if(K.width+K.height===0)K.onerror("h/w=0");let J=document.createElement("CANVAS"),Z=J.getContext("2d");J.width=K.width,J.height=K.height,Z.drawImage(K,0,0);try{$.data=J.toDataURL($.type),q("done")}catch(G){K.onerror(G.toString())}J=null},K.onerror=()=>{$.data=j6,Q(Error(`ERROR! Unable to load image (image.onerror): ${$.path}`))},K.src=typeof $.data==="string"?$.data:j6})})}var cB={cover:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.h/Q:q.w,G=J?q.h:q.w*Q,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},contain:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.w:q.h/Q,G=J?q.w*Q:q.h,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},crop:function($,q){let Q=q.x,K=$.w-(q.x+q.w),J=q.y,Z=$.h-(q.y+q.h),G=Math.round(1e5*(Q/$.w)),W=Math.round(1e5*(K/$.w)),B=Math.round(1e5*(J/$.h)),V=Math.round(1e5*(Z/$.h));return``}};function d7($){var q;let Q=$._name?'':"",K=1;if($._bkgdImgRid)Q+=``;else if((q=$.background)===null||q===void 0?void 0:q.color)Q+=`${B2($.background)}`;else if(!$.bkgd&&$._name&&$._name===x7)Q+='';if(Q+="",Q+='',Q+='',Q+='',$._slideObjects.forEach((J,Z)=>{var G,W,B,V,U,w,F,M;let k=0,f=0,L=H0("75%","X",$._presLayout),D=0,z,N="",H=null,v=null,j=0,n=0,d=null,_=null,X=(G=J.options)===null||G===void 0?void 0:G.sizing,P=(W=J.options)===null||W===void 0?void 0:W.rounding;if($._slideLayout!==void 0&&$._slideLayout._slideObjects!==void 0&&J.options&&J.options.placeholder)z=$._slideLayout._slideObjects.filter((h)=>h.options.placeholder===J.options.placeholder)[0];if(J.options=J.options||{},typeof J.options.x<"u")k=H0(J.options.x,"X",$._presLayout);if(typeof J.options.y<"u")f=H0(J.options.y,"Y",$._presLayout);if(typeof J.options.w<"u")L=H0(J.options.w,"X",$._presLayout);if(typeof J.options.h<"u")D=H0(J.options.h,"Y",$._presLayout);let g=L,c=D;if(z){if(z.options.x||z.options.x===0)k=H0(z.options.x,"X",$._presLayout);if(z.options.y||z.options.y===0)f=H0(z.options.y,"Y",$._presLayout);if(z.options.w||z.options.w===0)L=H0(z.options.w,"X",$._presLayout);if(z.options.h||z.options.h===0)D=H0(z.options.h,"Y",$._presLayout)}if(J.options.flipH)N+=' flipH="1"';if(J.options.flipV)N+=' flipV="1"';if(J.options.rotate)N+=` rot="${S1(J.options.rotate)}"`;switch(J._type){case D0.table:if(H=J.arrTabRows,v=J.options,j=0,n=0,H[0].forEach((h)=>{d=h.options||null,j+=(d===null||d===void 0?void 0:d.colspan)?Number(d.colspan):1}),_=``,_+=' ',_+=``,_+='',Array.isArray(v.colW)){_+="";for(let h=0;h`}_+=""}else{if(n=v.colW?v.colW:L0,J.options.w&&!v.colW)n=Math.round((typeof J.options.w==="number"?J.options.w:1)/j);_+="";for(let h=0;h`;_+=""}H.forEach((h)=>{var x,l;for(let $0=0;$01){let W0=Array(F0-1).fill(void 0).map(()=>{return{_type:D0.tablecell,options:{rowspan:p},_hmerge:!0}});h.splice($0+1,0,...W0),$0+=F0}else $0+=1}}),H.forEach((h,x)=>{let l=H[x+1];if(!l)return;h.forEach(($0,Z0)=>{var F0,p;let W0=$0._rowContinue||((F0=$0.options)===null||F0===void 0?void 0:F0.rowspan),y=(p=$0.options)===null||p===void 0?void 0:p.colspan,i=$0._hmerge;if(W0&&W0>1){let U0={_type:D0.tablecell,options:{colspan:y},_rowContinue:W0-1,_vmerge:!0,_hmerge:i};l.splice(Z0,0,U0)}})}),H.forEach((h,x)=>{let l=0;if(Array.isArray(v.rowH)&&v.rowH[x])l=v0(Number(v.rowH[x]));else if(v.rowH&&!isNaN(Number(v.rowH)))l=v0(Number(v.rowH));else if(J.options.cy||J.options.h)l=Math.round((J.options.h?v0(J.options.h):typeof J.options.cy==="number"?J.options.cy:1)/H.length);_+=``,h.forEach(($0)=>{var Z0,F0,p,W0,y;let i=$0,U0={rowSpan:((Z0=i.options)===null||Z0===void 0?void 0:Z0.rowspan)>1?i.options.rowspan:void 0,gridSpan:((F0=i.options)===null||F0===void 0?void 0:F0.colspan)>1?i.options.colspan:void 0,vMerge:i._vmerge?1:void 0,hMerge:i._hmerge?1:void 0},m=Object.keys(U0).map((K0)=>[K0,U0[K0]]).filter(([,K0])=>!!K0).map(([K0,R])=>`${String(K0)}="${String(R)}"`).join(" ");if(m)m=" "+m;if(i._hmerge||i._vmerge){_+=``;return}let V0=i.options||{};i.options=V0,["align","bold","border","color","fill","fontFace","fontSize","margin","textDirection","underline","valign"].forEach((K0)=>{if(v[K0]&&!V0[K0]&&V0[K0]!==0)V0[K0]=v[K0]});let w0=V0.valign?` anchor="${V0.valign.replace(/^c$/i,"ctr").replace(/^m$/i,"ctr").replace("center","ctr").replace("middle","ctr").replace("top","t").replace("btm","b").replace("bottom","b")}"`:"",S=V0.textDirection&&V0.textDirection!=="horz"?` vert="${V0.textDirection}"`:"",b=((W0=(p=i._optImp)===null||p===void 0?void 0:p.fill)===null||W0===void 0?void 0:W0.color)?i._optImp.fill.color:((y=i._optImp)===null||y===void 0?void 0:y.fill)&&typeof i._optImp.fill==="string"?i._optImp.fill:"";b=b||V0.fill?V0.fill:"";let O=b?B2(b):"",E=V0.margin===0||V0.margin?V0.margin:JJ;if(!Array.isArray(E)&&typeof E==="number")E=[E,E,E,E];let a="";if(E[0]>=1)a=` marL="${Y0(E[3])}" marR="${Y0(E[1])}" marT="${Y0(E[0])}" marB="${Y0(E[2])}"`;else a=` marL="${v0(E[3])}" marR="${v0(E[1])}" marT="${v0(E[0])}" marB="${v0(E[2])}"`;if(_+=`${KJ(i)}`,V0.border&&Array.isArray(V0.border))[{idx:3,name:"lnL"},{idx:1,name:"lnR"},{idx:0,name:"lnT"},{idx:2,name:"lnB"}].forEach((K0)=>{if(V0.border[K0.idx].type!=="none")_+=``,_+=`${R0(V0.border[K0.idx].color)}`,_+=``,_+=``;else _+=``});_+=O,_+=" ",_+=" "}),_+=""}),_+=" ",_+=" ",_+=" ",_+="",Q+=_,K++;break;case D0.text:case D0.placeholder:if(!J.options.line&&D===0)D=L0*0.3;if(!J.options._bodyProp)J.options._bodyProp={};if(J.options.margin&&Array.isArray(J.options.margin))J.options._bodyProp.lIns=Y0(J.options.margin[0]||0),J.options._bodyProp.rIns=Y0(J.options.margin[1]||0),J.options._bodyProp.bIns=Y0(J.options.margin[2]||0),J.options._bodyProp.tIns=Y0(J.options.margin[3]||0);else if(typeof J.options.margin==="number")J.options._bodyProp.lIns=Y0(J.options.margin),J.options._bodyProp.rIns=Y0(J.options.margin),J.options._bodyProp.bIns=Y0(J.options.margin),J.options._bodyProp.tIns=Y0(J.options.margin);if(Q+="",Q+=``,(B=J.options.hyperlink)===null||B===void 0?void 0:B.url)Q+=``;if((V=J.options.hyperlink)===null||V===void 0?void 0:V.slide)Q+=``;if(Q+="",Q+="':"/>"),Q+=`${J._type==="placeholder"?N5(J):N5(z)}`,Q+="",Q+=``,Q+=``,Q+=``,J.shape==="custGeom")Q+="",Q+="",Q+="",Q+="",Q+="",Q+="",Q+='',Q+="",Q+=``,(w=J.options.points)===null||w===void 0||w.forEach((h,x)=>{if("curve"in h)switch(h.curve.type){case"arc":Q+=``;break;case"cubic":Q+=` +${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F)=>{Z.get(U.path,(M)=>{let k="";M.setEncoding("binary"),M.on("data",(f)=>k+=f),M.on("end",()=>{U.data=Buffer.from(k,"binary").toString("base64"),B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),w("done")}),M.on("error",()=>{U.data=j6,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),F(Error(`ERROR! Unable to load image (https.get): ${U.path}`))})})});return yield new Promise((w,F)=>{let M=new XMLHttpRequest;M.onload=()=>{let k=new FileReader;k.onloadend=()=>{if(U.data=k.result,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),!U.isSvgPng)w("done");else QJ(U).then(()=>w("done")).catch(F)},k.readAsDataURL(M.response)},M.onerror=()=>{U.data=j6,B.filter((k)=>k.isDuplicate&&k.path===U.path).forEach((k)=>k.data=U.data),F(Error(`ERROR! Unable to load image (xhr.onerror): ${U.path}`))},M.open("GET",U.path),M.responseType="blob",M.send()})}))())}),$._relsMedia.filter((U)=>U.isSvgPng&&U.data).forEach((U)=>{(()=>W2(this,void 0,void 0,function*(){if(K&&!J)yield G();if(K&&J)U.data=j6,W.push(Promise.resolve("done"));else W.push(QJ(U))}))()}),W}function QJ($){return W2(this,void 0,void 0,function*(){return yield new Promise((q,Q)=>{let K=new Image;K.onload=()=>{if(K.width+K.height===0)K.onerror("h/w=0");let J=document.createElement("CANVAS"),Z=J.getContext("2d");J.width=K.width,J.height=K.height,Z.drawImage(K,0,0);try{$.data=J.toDataURL($.type),q("done")}catch(G){K.onerror(G.toString())}J=null},K.onerror=()=>{$.data=j6,Q(Error(`ERROR! Unable to load image (image.onerror): ${$.path}`))},K.src=typeof $.data==="string"?$.data:j6})})}var PB={cover:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.h/Q:q.w,G=J?q.h:q.w*Q,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},contain:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.w:q.h/Q,G=J?q.w*Q:q.h,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},crop:function($,q){let Q=q.x,K=$.w-(q.x+q.w),J=q.y,Z=$.h-(q.y+q.h),G=Math.round(1e5*(Q/$.w)),W=Math.round(1e5*(K/$.w)),B=Math.round(1e5*(J/$.h)),V=Math.round(1e5*(Z/$.h));return``}};function d7($){var q;let Q=$._name?'':"",K=1;if($._bkgdImgRid)Q+=``;else if((q=$.background)===null||q===void 0?void 0:q.color)Q+=`${B2($.background)}`;else if(!$.bkgd&&$._name&&$._name===x7)Q+='';if(Q+="",Q+='',Q+='',Q+='',$._slideObjects.forEach((J,Z)=>{var G,W,B,V,U,w,F,M;let k=0,f=0,L=H0("75%","X",$._presLayout),D=0,z,N="",H=null,v=null,j=0,n=0,d=null,_=null,X=(G=J.options)===null||G===void 0?void 0:G.sizing,P=(W=J.options)===null||W===void 0?void 0:W.rounding;if($._slideLayout!==void 0&&$._slideLayout._slideObjects!==void 0&&J.options&&J.options.placeholder)z=$._slideLayout._slideObjects.filter((h)=>h.options.placeholder===J.options.placeholder)[0];if(J.options=J.options||{},typeof J.options.x<"u")k=H0(J.options.x,"X",$._presLayout);if(typeof J.options.y<"u")f=H0(J.options.y,"Y",$._presLayout);if(typeof J.options.w<"u")L=H0(J.options.w,"X",$._presLayout);if(typeof J.options.h<"u")D=H0(J.options.h,"Y",$._presLayout);let g=L,c=D;if(z){if(z.options.x||z.options.x===0)k=H0(z.options.x,"X",$._presLayout);if(z.options.y||z.options.y===0)f=H0(z.options.y,"Y",$._presLayout);if(z.options.w||z.options.w===0)L=H0(z.options.w,"X",$._presLayout);if(z.options.h||z.options.h===0)D=H0(z.options.h,"Y",$._presLayout)}if(J.options.flipH)N+=' flipH="1"';if(J.options.flipV)N+=' flipV="1"';if(J.options.rotate)N+=` rot="${S1(J.options.rotate)}"`;switch(J._type){case D0.table:if(H=J.arrTabRows,v=J.options,j=0,n=0,H[0].forEach((h)=>{d=h.options||null,j+=(d===null||d===void 0?void 0:d.colspan)?Number(d.colspan):1}),_=``,_+=' ',_+=``,_+='',Array.isArray(v.colW)){_+="";for(let h=0;h`}_+=""}else{if(n=v.colW?v.colW:L0,J.options.w&&!v.colW)n=Math.round((typeof J.options.w==="number"?J.options.w:1)/j);_+="";for(let h=0;h`;_+=""}H.forEach((h)=>{var x,l;for(let $0=0;$01){let W0=Array(F0-1).fill(void 0).map(()=>{return{_type:D0.tablecell,options:{rowspan:p},_hmerge:!0}});h.splice($0+1,0,...W0),$0+=F0}else $0+=1}}),H.forEach((h,x)=>{let l=H[x+1];if(!l)return;h.forEach(($0,Z0)=>{var F0,p;let W0=$0._rowContinue||((F0=$0.options)===null||F0===void 0?void 0:F0.rowspan),y=(p=$0.options)===null||p===void 0?void 0:p.colspan,i=$0._hmerge;if(W0&&W0>1){let U0={_type:D0.tablecell,options:{colspan:y},_rowContinue:W0-1,_vmerge:!0,_hmerge:i};l.splice(Z0,0,U0)}})}),H.forEach((h,x)=>{let l=0;if(Array.isArray(v.rowH)&&v.rowH[x])l=v0(Number(v.rowH[x]));else if(v.rowH&&!isNaN(Number(v.rowH)))l=v0(Number(v.rowH));else if(J.options.cy||J.options.h)l=Math.round((J.options.h?v0(J.options.h):typeof J.options.cy==="number"?J.options.cy:1)/H.length);_+=``,h.forEach(($0)=>{var Z0,F0,p,W0,y;let i=$0,U0={rowSpan:((Z0=i.options)===null||Z0===void 0?void 0:Z0.rowspan)>1?i.options.rowspan:void 0,gridSpan:((F0=i.options)===null||F0===void 0?void 0:F0.colspan)>1?i.options.colspan:void 0,vMerge:i._vmerge?1:void 0,hMerge:i._hmerge?1:void 0},m=Object.keys(U0).map((K0)=>[K0,U0[K0]]).filter(([,K0])=>!!K0).map(([K0,R])=>`${String(K0)}="${String(R)}"`).join(" ");if(m)m=" "+m;if(i._hmerge||i._vmerge){_+=``;return}let V0=i.options||{};i.options=V0,["align","bold","border","color","fill","fontFace","fontSize","margin","textDirection","underline","valign"].forEach((K0)=>{if(v[K0]&&!V0[K0]&&V0[K0]!==0)V0[K0]=v[K0]});let w0=V0.valign?` anchor="${V0.valign.replace(/^c$/i,"ctr").replace(/^m$/i,"ctr").replace("center","ctr").replace("middle","ctr").replace("top","t").replace("btm","b").replace("bottom","b")}"`:"",S=V0.textDirection&&V0.textDirection!=="horz"?` vert="${V0.textDirection}"`:"",b=((W0=(p=i._optImp)===null||p===void 0?void 0:p.fill)===null||W0===void 0?void 0:W0.color)?i._optImp.fill.color:((y=i._optImp)===null||y===void 0?void 0:y.fill)&&typeof i._optImp.fill==="string"?i._optImp.fill:"";b=b||V0.fill?V0.fill:"";let O=b?B2(b):"",E=V0.margin===0||V0.margin?V0.margin:JJ;if(!Array.isArray(E)&&typeof E==="number")E=[E,E,E,E];let a="";if(E[0]>=1)a=` marL="${Y0(E[3])}" marR="${Y0(E[1])}" marT="${Y0(E[0])}" marB="${Y0(E[2])}"`;else a=` marL="${v0(E[3])}" marR="${v0(E[1])}" marT="${v0(E[0])}" marB="${v0(E[2])}"`;if(_+=`${KJ(i)}`,V0.border&&Array.isArray(V0.border))[{idx:3,name:"lnL"},{idx:1,name:"lnR"},{idx:0,name:"lnT"},{idx:2,name:"lnB"}].forEach((K0)=>{if(V0.border[K0.idx].type!=="none")_+=``,_+=`${R0(V0.border[K0.idx].color)}`,_+=``,_+=``;else _+=``});_+=O,_+=" ",_+=" "}),_+=""}),_+=" ",_+=" ",_+=" ",_+="",Q+=_,K++;break;case D0.text:case D0.placeholder:if(!J.options.line&&D===0)D=L0*0.3;if(!J.options._bodyProp)J.options._bodyProp={};if(J.options.margin&&Array.isArray(J.options.margin))J.options._bodyProp.lIns=Y0(J.options.margin[0]||0),J.options._bodyProp.rIns=Y0(J.options.margin[1]||0),J.options._bodyProp.bIns=Y0(J.options.margin[2]||0),J.options._bodyProp.tIns=Y0(J.options.margin[3]||0);else if(typeof J.options.margin==="number")J.options._bodyProp.lIns=Y0(J.options.margin),J.options._bodyProp.rIns=Y0(J.options.margin),J.options._bodyProp.bIns=Y0(J.options.margin),J.options._bodyProp.tIns=Y0(J.options.margin);if(Q+="",Q+=``,(B=J.options.hyperlink)===null||B===void 0?void 0:B.url)Q+=``;if((V=J.options.hyperlink)===null||V===void 0?void 0:V.slide)Q+=``;if(Q+="",Q+="':"/>"),Q+=`${J._type==="placeholder"?N5(J):N5(z)}`,Q+="",Q+=``,Q+=``,Q+=``,J.shape==="custGeom")Q+="",Q+="",Q+="",Q+="",Q+="",Q+="",Q+='',Q+="",Q+=``,(w=J.options.points)===null||w===void 0||w.forEach((h,x)=>{if("curve"in h)switch(h.curve.type){case"arc":Q+=``;break;case"cubic":Q+=` `;break;case"quadratic":Q+=` - `;break}else if("close"in h)Q+="";else if(h.moveTo||x===0)Q+=``;else Q+=``}),Q+="",Q+="",Q+="";else{if(Q+='',J.options.rectRadius)Q+=``;else if(J.options.angleRange){for(let h=0;h<2;h++){let x=J.options.angleRange[h];Q+=``}if(J.options.arcThicknessRatio)Q+=``}Q+=""}if(Q+=J.options.fill?B2(J.options.fill):"",J.options.line){if(Q+=J.options.line.width?``:"",J.options.line.color)Q+=B2(J.options.line);if(J.options.line.dashType)Q+=``;if(J.options.line.beginArrowType)Q+=``;if(J.options.line.endArrowType)Q+=``;Q+=""}if(J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=` `,Q+=` `,Q+=` `,Q+=" ",Q+="";Q+="",Q+=KJ(J),Q+="";break;case D0.image:if(Q+="",Q+=" ",Q+=``,(F=J.hyperlink)===null||F===void 0?void 0:F.url)Q+=``;if((M=J.hyperlink)===null||M===void 0?void 0:M.slide)Q+=``;if(Q+=" ",Q+=' ',Q+=" "+N5(z)+"",Q+=" ",Q+="",($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0]&&($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0].extn==="svg")Q+=``,Q+=J.options.transparency?` `:"",Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";else Q+=``,Q+=J.options.transparency?``:"",Q+="";if(X===null||X===void 0?void 0:X.type){let h=X.w?H0(X.w,"X",$._presLayout):L,x=X.h?H0(X.h,"Y",$._presLayout):D,l=H0(X.x||0,"X",$._presLayout),$0=H0(X.y||0,"Y",$._presLayout);Q+=cB[X.type]({w:g,h:c},{w:h,h:x,x:l,y:$0}),g=h,c=x}else Q+=" ";if(Q+="",Q+="",Q+=" ",Q+=` `,Q+=` `,Q+=" ",Q+=` `,J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=``,Q+=``,Q+=``,Q+=``,Q+="";Q+="",Q+="";break;case D0.media:if(J.mtype==="online")Q+="",Q+=" ",Q+=``,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";else Q+="",Q+=" ",Q+=``,Q+=' ',Q+=" ",Q+=` `,Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";break;case D0.chart:Q+="",Q+=" ",Q+=` `,Q+=" ",Q+=` ${N5(z)}`,Q+=" ",Q+=` `,Q+=' ',Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";break;default:Q+="";break}}),$._slideNumberProps){if(!$._slideNumberProps.align)$._slideNumberProps.align="left";if(Q+="",Q+=" ",Q+=' ',Q+=' ',Q+=" ",Q+=" ",Q+=` `,Q+="",Q+="`,$._slideNumberProps.color)Q+=B2($._slideNumberProps.color);if($._slideNumberProps.fontFace)Q+=``;Q+=""}if(Q+="",Q+="",$._slideNumberProps.align.startsWith("l"))Q+='';else if($._slideNumberProps.align.startsWith("c"))Q+='';else if($._slideNumberProps.align.startsWith("r"))Q+='';else Q+='';Q+=``,Q+=`${$._slideNum}`,Q+=""}return Q+="",Q+="",Q}function m7($,q){let Q=0,K=''+n0+'';return $._rels.forEach((J)=>{if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("hyperlink"))if(J.data==="slide")K+=``;else K+=``;else if(J.type.toLowerCase().includes("notesSlide"))K+=``}),($._relsChart||[]).forEach((J)=>{Q=Math.max(Q,J.rId),K+=``}),($._relsMedia||[]).forEach((J)=>{let Z=J.rId.toString();if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("image"))K+='';else if(J.type.toLowerCase().includes("audio"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("video"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("online"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+=''}),q.forEach((J,Z)=>{K+=``}),K+="",K}function qJ($,q){var Q,K;let J="",Z="",G="",W="",B=q?"a:lvl1pPr":"a:pPr",V=Y0(RB),U=`<${B}${$.options.rtlMode?' rtl="1" ':""}`;{if($.options.align)switch($.options.align){case"left":U+=' algn="l"';break;case"right":U+=' algn="r"';break;case"center":U+=' algn="ctr"';break;case"justify":U+=' algn="just"';break;default:U+="";break}if($.options.lineSpacing)Z=``;else if($.options.lineSpacingMultiple)Z=``;if($.options.indentLevel&&!isNaN(Number($.options.indentLevel))&&$.options.indentLevel>0)U+=` lvl="${$.options.indentLevel}"`;if($.options.paraSpaceBefore&&!isNaN(Number($.options.paraSpaceBefore))&&$.options.paraSpaceBefore>0)G+=``;if($.options.paraSpaceAfter&&!isNaN(Number($.options.paraSpaceAfter))&&$.options.paraSpaceAfter>0)G+=``;if(typeof $.options.bullet==="object"){if((K=(Q=$===null||$===void 0?void 0:$.options)===null||Q===void 0?void 0:Q.bullet)===null||K===void 0?void 0:K.indent)V=Y0($.options.bullet.indent);if($.options.bullet.type){if($.options.bullet.type.toString().toLowerCase()==="number")U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet.characterCode){let w=`&#x${$.options.bullet.characterCode};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.characterCode))console.warn("Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else if($.options.bullet.code){let w=`&#x${$.options.bullet.code};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.code))console.warn("Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet)U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``;else if(!$.options.bullet)U+=' indent="0" marL="0"',J="";if($.options.tabStops&&Array.isArray($.options.tabStops))W=`${$.options.tabStops.map((F)=>``).join("")}`;if(U+=">"+Z+G+J+W,q)U+=MJ($.options,!0);U+=""}return U}function MJ($,q){var Q;let K="",J=q?"a:defRPr":"a:rPr";if(K+="<"+J+' lang="'+($.lang?$.lang:"en-US")+'"'+($.lang?' altLang="en-US"':""),K+=$.fontSize?` sz="${Math.round($.fontSize*100)}"`:"",K+=($===null||$===void 0?void 0:$.bold)?` b="${$.bold?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.italic)?` i="${$.italic?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.strike)?` strike="${typeof $.strike==="string"?$.strike:"sngStrike"}"`:"",typeof $.underline==="object"&&((Q=$.underline)===null||Q===void 0?void 0:Q.style))K+=` u="${$.underline.style}"`;else if(typeof $.underline==="string")K+=` u="${String($.underline)}"`;else if($.hyperlink)K+=' u="sng"';if($.baseline)K+=` baseline="${Math.round($.baseline*50)}"`;else if($.subscript)K+=' baseline="-40000"';else if($.superscript)K+=' baseline="30000"';if(K+=$.charSpacing?` spc="${Math.round($.charSpacing*100)}" kern="0"`:"",K+=' dirty="0">',$.color||$.fontFace||$.outline||typeof $.underline==="object"&&$.underline.color){if($.outline&&typeof $.outline==="object")K+=`${B2($.outline.color||"FFFFFF")}`;if($.color)K+=B2({color:$.color,transparency:$.transparency});if($.highlight)K+=`${R0($.highlight)}`;if(typeof $.underline==="object"&&$.underline.color)K+=`${B2($.underline.color)}`;if($.glow)K+=`${AB($.glow,CB)}`;if($.fontFace)K+=``}if($.hyperlink){if(typeof $.hyperlink!=="object")throw Error("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:'https://github.com'}` ");else if(!$.hyperlink.url&&!$.hyperlink.slide)throw Error("ERROR: 'hyperlink requires either `url` or `slide`'");else if($.hyperlink.url)K+=`":"/>"}`;else if($.hyperlink.slide)K+=`":"/>"}`;if($.color)K+=" ",K+=' ',K+=' ',K+=" ",K+=" ",K+=""}return K+=``,K}function bB($){return $.text?`${MJ($.options,!1)}${k0($.text)}`:""}function nB($){let q="";else if($.options.fit==="resize")q+=""}if($.options.shrinkText)q+="";q+=$.options._bodyProp.autoFit?"":"",q+=""}else q+=' wrap="square" rtlCol="0">',q+="";return $._type===D0.tablecell?"":q}function KJ($){let q=$.options||{},Q=[],K=[];if(q&&$._type!==D0.tablecell&&(typeof $.text>"u"||$.text===null))return"";let J=$._type===D0.tablecell?"":"";if(J+=nB($),q.h===0&&q.line&&q.align)J+='';else if($._type==="placeholder")J+=`${qJ($,!0)}`;else J+="";if(typeof $.text==="string"||typeof $.text==="number")Q.push({text:$.text.toString(),options:q||{}});else if($.text&&!Array.isArray($.text)&&typeof $.text==="object"&&Object.keys($.text).includes("text"))Q.push({text:$.text||"",options:$.options||{}});else if(Array.isArray($.text))Q=$.text.map((W)=>({text:W.text,options:W.options}));Q.forEach((W,B)=>{if(!W.text)W.text="";if(W.options=W.options||q||{},B===0&&W.options&&!W.options.bullet&&q.bullet)W.options.bullet=q.bullet;if(typeof W.text==="string"||typeof W.text==="number")W.text=W.text.toString().replace(/\r*\n/g,n0);if(W.text.includes(n0)&&W.text.match(/\n$/g)===null)W.text.split(n0).forEach((V)=>{W.options.breakLine=!0,K.push({text:V,options:W.options})});else K.push(W)});let Z=[],G=[];if(K.forEach((W,B)=>{if(G.length>0&&(W.options.align||q.align)){if(W.options.align!==K[B-1].options.align)Z.push(G),G=[]}else if(G.length>0&&W.options.bullet&&G.length>0)Z.push(G),G=[],W.options.breakLine=!1;if(G.push(W),G.length>0&&W.options.breakLine){if(B+1{var B;let V=!1;J+="";let U=`{if(w.options._lineIdx=F,F>0&&w.options.softBreakBefore)J+="";if(w.options.align=w.options.align||q.align,w.options.lineSpacing=w.options.lineSpacing||q.lineSpacing,w.options.lineSpacingMultiple=w.options.lineSpacingMultiple||q.lineSpacingMultiple,w.options.indentLevel=w.options.indentLevel||q.indentLevel,w.options.paraSpaceBefore=w.options.paraSpaceBefore||q.paraSpaceBefore,w.options.paraSpaceAfter=w.options.paraSpaceAfter||q.paraSpaceAfter,U=qJ(w,!1),J+=U.replace("",""),Object.entries(q).filter(([M])=>!(w.options.hyperlink&&M==="color")).forEach(([M,k])=>{if(M!=="bullet"&&!w.options[M])w.options[M]=k}),J+=bB(w),!w.text&&q.fontSize||w.options.fontSize)V=!0,q.fontSize=q.fontSize||w.options.fontSize}),$._type===D0.tablecell&&(q.fontSize||q.fontFace))if(q.fontFace)J+=`',J+=``,J+=``,J+=``,J+="";else J+=`';else if(V)J+=`';else J+=``;J+=""}),J.indexOf("")===-1)J+="";return J+=$._type===D0.tablecell?"":"",J}function N5($){var q,Q;if(!$)return"";let K=((q=$.options)===null||q===void 0?void 0:q._placeholderIdx)?$.options._placeholderIdx:"",J=((Q=$.options)===null||Q===void 0?void 0:Q._placeholderType)?$.options._placeholderType:"",Z=J&&F8[J]?F8[J].toString():"";return``;break}else if("close"in h)Q+="";else if(h.moveTo||x===0)Q+=``;else Q+=``}),Q+="",Q+="",Q+="";else{if(Q+='',J.options.rectRadius)Q+=``;else if(J.options.angleRange){for(let h=0;h<2;h++){let x=J.options.angleRange[h];Q+=``}if(J.options.arcThicknessRatio)Q+=``}Q+=""}if(Q+=J.options.fill?B2(J.options.fill):"",J.options.line){if(Q+=J.options.line.width?``:"",J.options.line.color)Q+=B2(J.options.line);if(J.options.line.dashType)Q+=``;if(J.options.line.beginArrowType)Q+=``;if(J.options.line.endArrowType)Q+=``;Q+=""}if(J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=` `,Q+=` `,Q+=` `,Q+=" ",Q+="";Q+="",Q+=KJ(J),Q+="";break;case D0.image:if(Q+="",Q+=" ",Q+=``,(F=J.hyperlink)===null||F===void 0?void 0:F.url)Q+=``;if((M=J.hyperlink)===null||M===void 0?void 0:M.slide)Q+=``;if(Q+=" ",Q+=' ',Q+=" "+N5(z)+"",Q+=" ",Q+="",($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0]&&($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0].extn==="svg")Q+=``,Q+=J.options.transparency?` `:"",Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";else Q+=``,Q+=J.options.transparency?``:"",Q+="";if(X===null||X===void 0?void 0:X.type){let h=X.w?H0(X.w,"X",$._presLayout):L,x=X.h?H0(X.h,"Y",$._presLayout):D,l=H0(X.x||0,"X",$._presLayout),$0=H0(X.y||0,"Y",$._presLayout);Q+=PB[X.type]({w:g,h:c},{w:h,h:x,x:l,y:$0}),g=h,c=x}else Q+=" ";if(Q+="",Q+="",Q+=" ",Q+=` `,Q+=` `,Q+=" ",Q+=` `,J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=``,Q+=``,Q+=``,Q+=``,Q+="";Q+="",Q+="";break;case D0.media:if(J.mtype==="online")Q+="",Q+=" ",Q+=``,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";else Q+="",Q+=" ",Q+=``,Q+=' ',Q+=" ",Q+=` `,Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";break;case D0.chart:Q+="",Q+=" ",Q+=` `,Q+=" ",Q+=` ${N5(z)}`,Q+=" ",Q+=` `,Q+=' ',Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";break;default:Q+="";break}}),$._slideNumberProps){if(!$._slideNumberProps.align)$._slideNumberProps.align="left";if(Q+="",Q+=" ",Q+=' ',Q+=' ',Q+=" ",Q+=" ",Q+=` `,Q+="",Q+="`,$._slideNumberProps.color)Q+=B2($._slideNumberProps.color);if($._slideNumberProps.fontFace)Q+=``;Q+=""}if(Q+="",Q+="",$._slideNumberProps.align.startsWith("l"))Q+='';else if($._slideNumberProps.align.startsWith("c"))Q+='';else if($._slideNumberProps.align.startsWith("r"))Q+='';else Q+='';Q+=``,Q+=`${$._slideNum}`,Q+=""}return Q+="",Q+="",Q}function m7($,q){let Q=0,K=''+n0+'';return $._rels.forEach((J)=>{if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("hyperlink"))if(J.data==="slide")K+=``;else K+=``;else if(J.type.toLowerCase().includes("notesSlide"))K+=``}),($._relsChart||[]).forEach((J)=>{Q=Math.max(Q,J.rId),K+=``}),($._relsMedia||[]).forEach((J)=>{let Z=J.rId.toString();if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("image"))K+='';else if(J.type.toLowerCase().includes("audio"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("video"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("online"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+=''}),q.forEach((J,Z)=>{K+=``}),K+="",K}function qJ($,q){var Q,K;let J="",Z="",G="",W="",B=q?"a:lvl1pPr":"a:pPr",V=Y0(kB),U=`<${B}${$.options.rtlMode?' rtl="1" ':""}`;{if($.options.align)switch($.options.align){case"left":U+=' algn="l"';break;case"right":U+=' algn="r"';break;case"center":U+=' algn="ctr"';break;case"justify":U+=' algn="just"';break;default:U+="";break}if($.options.lineSpacing)Z=``;else if($.options.lineSpacingMultiple)Z=``;if($.options.indentLevel&&!isNaN(Number($.options.indentLevel))&&$.options.indentLevel>0)U+=` lvl="${$.options.indentLevel}"`;if($.options.paraSpaceBefore&&!isNaN(Number($.options.paraSpaceBefore))&&$.options.paraSpaceBefore>0)G+=``;if($.options.paraSpaceAfter&&!isNaN(Number($.options.paraSpaceAfter))&&$.options.paraSpaceAfter>0)G+=``;if(typeof $.options.bullet==="object"){if((K=(Q=$===null||$===void 0?void 0:$.options)===null||Q===void 0?void 0:Q.bullet)===null||K===void 0?void 0:K.indent)V=Y0($.options.bullet.indent);if($.options.bullet.type){if($.options.bullet.type.toString().toLowerCase()==="number")U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet.characterCode){let w=`&#x${$.options.bullet.characterCode};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.characterCode))console.warn("Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else if($.options.bullet.code){let w=`&#x${$.options.bullet.code};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.code))console.warn("Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet)U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``;else if(!$.options.bullet)U+=' indent="0" marL="0"',J="";if($.options.tabStops&&Array.isArray($.options.tabStops))W=`${$.options.tabStops.map((F)=>``).join("")}`;if(U+=">"+Z+G+J+W,q)U+=MJ($.options,!0);U+=""}return U}function MJ($,q){var Q;let K="",J=q?"a:defRPr":"a:rPr";if(K+="<"+J+' lang="'+($.lang?$.lang:"en-US")+'"'+($.lang?' altLang="en-US"':""),K+=$.fontSize?` sz="${Math.round($.fontSize*100)}"`:"",K+=($===null||$===void 0?void 0:$.bold)?` b="${$.bold?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.italic)?` i="${$.italic?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.strike)?` strike="${typeof $.strike==="string"?$.strike:"sngStrike"}"`:"",typeof $.underline==="object"&&((Q=$.underline)===null||Q===void 0?void 0:Q.style))K+=` u="${$.underline.style}"`;else if(typeof $.underline==="string")K+=` u="${String($.underline)}"`;else if($.hyperlink)K+=' u="sng"';if($.baseline)K+=` baseline="${Math.round($.baseline*50)}"`;else if($.subscript)K+=' baseline="-40000"';else if($.superscript)K+=' baseline="30000"';if(K+=$.charSpacing?` spc="${Math.round($.charSpacing*100)}" kern="0"`:"",K+=' dirty="0">',$.color||$.fontFace||$.outline||typeof $.underline==="object"&&$.underline.color){if($.outline&&typeof $.outline==="object")K+=`${B2($.outline.color||"FFFFFF")}`;if($.color)K+=B2({color:$.color,transparency:$.transparency});if($.highlight)K+=`${R0($.highlight)}`;if(typeof $.underline==="object"&&$.underline.color)K+=`${B2($.underline.color)}`;if($.glow)K+=`${fB($.glow,LB)}`;if($.fontFace)K+=``}if($.hyperlink){if(typeof $.hyperlink!=="object")throw Error("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:'https://github.com'}` ");else if(!$.hyperlink.url&&!$.hyperlink.slide)throw Error("ERROR: 'hyperlink requires either `url` or `slide`'");else if($.hyperlink.url)K+=`":"/>"}`;else if($.hyperlink.slide)K+=`":"/>"}`;if($.color)K+=" ",K+=' ',K+=' ',K+=" ",K+=" ",K+=""}return K+=``,K}function TB($){return $.text?`${MJ($.options,!1)}${k0($.text)}`:""}function uB($){let q="";else if($.options.fit==="resize")q+=""}if($.options.shrinkText)q+="";q+=$.options._bodyProp.autoFit?"":"",q+=""}else q+=' wrap="square" rtlCol="0">',q+="";return $._type===D0.tablecell?"":q}function KJ($){let q=$.options||{},Q=[],K=[];if(q&&$._type!==D0.tablecell&&(typeof $.text>"u"||$.text===null))return"";let J=$._type===D0.tablecell?"":"";if(J+=uB($),q.h===0&&q.line&&q.align)J+='';else if($._type==="placeholder")J+=`${qJ($,!0)}`;else J+="";if(typeof $.text==="string"||typeof $.text==="number")Q.push({text:$.text.toString(),options:q||{}});else if($.text&&!Array.isArray($.text)&&typeof $.text==="object"&&Object.keys($.text).includes("text"))Q.push({text:$.text||"",options:$.options||{}});else if(Array.isArray($.text))Q=$.text.map((W)=>({text:W.text,options:W.options}));Q.forEach((W,B)=>{if(!W.text)W.text="";if(W.options=W.options||q||{},B===0&&W.options&&!W.options.bullet&&q.bullet)W.options.bullet=q.bullet;if(typeof W.text==="string"||typeof W.text==="number")W.text=W.text.toString().replace(/\r*\n/g,n0);if(W.text.includes(n0)&&W.text.match(/\n$/g)===null)W.text.split(n0).forEach((V)=>{W.options.breakLine=!0,K.push({text:V,options:W.options})});else K.push(W)});let Z=[],G=[];if(K.forEach((W,B)=>{if(G.length>0&&(W.options.align||q.align)){if(W.options.align!==K[B-1].options.align)Z.push(G),G=[]}else if(G.length>0&&W.options.bullet&&G.length>0)Z.push(G),G=[],W.options.breakLine=!1;if(G.push(W),G.length>0&&W.options.breakLine){if(B+1{var B;let V=!1;J+="";let U=`{if(w.options._lineIdx=F,F>0&&w.options.softBreakBefore)J+="";if(w.options.align=w.options.align||q.align,w.options.lineSpacing=w.options.lineSpacing||q.lineSpacing,w.options.lineSpacingMultiple=w.options.lineSpacingMultiple||q.lineSpacingMultiple,w.options.indentLevel=w.options.indentLevel||q.indentLevel,w.options.paraSpaceBefore=w.options.paraSpaceBefore||q.paraSpaceBefore,w.options.paraSpaceAfter=w.options.paraSpaceAfter||q.paraSpaceAfter,U=qJ(w,!1),J+=U.replace("",""),Object.entries(q).filter(([M])=>!(w.options.hyperlink&&M==="color")).forEach(([M,k])=>{if(M!=="bullet"&&!w.options[M])w.options[M]=k}),J+=TB(w),!w.text&&q.fontSize||w.options.fontSize)V=!0,q.fontSize=q.fontSize||w.options.fontSize}),$._type===D0.tablecell&&(q.fontSize||q.fontFace))if(q.fontFace)J+=`',J+=``,J+=``,J+=``,J+="";else J+=`';else if(V)J+=`';else J+=``;J+=""}),J.indexOf("")===-1)J+="";return J+=$._type===D0.tablecell?"":"",J}function N5($){var q,Q;if(!$)return"";let K=((q=$.options)===null||q===void 0?void 0:q._placeholderIdx)?$.options._placeholderIdx:"",J=((Q=$.options)===null||Q===void 0?void 0:Q._placeholderType)?$.options._placeholderType:"",Z=J&&F8[J]?F8[J].toString():"";return`0?' hasCustomPrompt="1"':""} - />`}function dB($,q,Q){let K=''+n0;return K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',$.forEach((J)=>{(J._relsMedia||[]).forEach((Z)=>{if(Z.type!=="image"&&Z.type!=="online"&&Z.type!=="chart"&&Z.extn!=="m4v"&&!K.includes(Z.type))K+=''})}),K+='',K+='',K+='',K+='',$.forEach((J,Z)=>{K+=``,K+=``,J._relsChart.forEach((G)=>{K+=``})}),K+='',K+='',K+='',K+='',q.forEach((J,Z)=>{K+=``,(J._relsChart||[]).forEach((G)=>{K+=' '})}),$.forEach((J,Z)=>{K+=``}),Q._relsChart.forEach((J)=>{K+=' '}),Q._relsMedia.forEach((J)=>{if(J.type!=="image"&&J.type!=="online"&&J.type!=="chart"&&J.extn!=="m4v"&&!K.includes(J.type))K+=' '}),K+=' ',K+=' ',K+="",K}function mB(){return`${n0} + />`}function SB($,q,Q){let K=''+n0;return K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',$.forEach((J)=>{(J._relsMedia||[]).forEach((Z)=>{if(Z.type!=="image"&&Z.type!=="online"&&Z.type!=="chart"&&Z.extn!=="m4v"&&!K.includes(Z.type))K+=''})}),K+='',K+='',K+='',K+='',$.forEach((J,Z)=>{K+=``,K+=``,J._relsChart.forEach((G)=>{K+=``})}),K+='',K+='',K+='',K+='',q.forEach((J,Z)=>{K+=``,(J._relsChart||[]).forEach((G)=>{K+=' '})}),$.forEach((J,Z)=>{K+=``}),Q._relsChart.forEach((J)=>{K+=' '}),Q._relsMedia.forEach((J)=>{if(J.type!=="image"&&J.type!=="online"&&J.type!=="chart"&&J.extn!=="m4v"&&!K.includes(J.type))K+=' '}),K+=' ',K+=' ',K+="",K}function EB(){return`${n0} - `}function pB($,q){return`${n0} + `}function _B($,q){return`${n0} 0 0 Microsoft Office PowerPoint @@ -103,7 +103,7 @@ ${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F) false false 16.0000 - `}function iB($,q,Q,K){return` + `}function cB($,q,Q,K){return` ${k0($)} ${k0(q)} @@ -112,13 +112,13 @@ ${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F) ${K} ${new Date().toISOString().replace(/\.\d\d\dZ/,"Z")} ${new Date().toISOString().replace(/\.\d\d\dZ/,"Z")} - `}function oB($){let q=1,Q=''+n0;Q+='',Q+='';for(let K=1;K<=$.length;K++)Q+=``;return q++,Q+=``,Q}function aB($){return`${n0}${d7($)}`}function lB($){let q="";return $._slideObjects.forEach((Q)=>{if(Q._type===D0.notes)q+=(Q===null||Q===void 0?void 0:Q.text)&&Q.text[0]?Q.text[0].text:""}),q.replace(/\r*\n/g,n0)}function rB(){return`${n0}7/23/19Click to edit Master text stylesSecond levelThird levelFourth levelFifth level‹#›`}function sB($){return`${n0}${k0(lB($))}${$._slideNum}`}function tB($){return` + `}function bB($){let q=1,Q=''+n0;Q+='',Q+='';for(let K=1;K<=$.length;K++)Q+=``;return q++,Q+=``,Q}function nB($){return`${n0}${d7($)}`}function dB($){let q="";return $._slideObjects.forEach((Q)=>{if(Q._type===D0.notes)q+=(Q===null||Q===void 0?void 0:Q.text)&&Q.text[0]?Q.text[0].text:""}),q.replace(/\r*\n/g,n0)}function mB(){return`${n0}7/23/19Click to edit Master text stylesSecond levelThird levelFourth levelFifth level‹#›`}function pB($){return`${n0}${k0(dB($))}${$._slideNum}`}function iB($){return` ${d7($)} - `}function eB($,q){let Q=q.map((J,Z)=>``),K=''+n0;return K+='',K+=d7($),K+='',K+=""+Q.join("")+"",K+='',K+=' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' ',K+="",K}function $z($,q){return m7(q[$-1],[{target:"../slideMasters/slideMaster1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"}])}function Qz($,q,Q){return m7($[Q-1],[{target:`../slideLayouts/slideLayout${Vz($,q,Q)}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"},{target:`../notesSlides/notesSlide${Q}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"}])}function qz($){return` + `}function oB($,q){let Q=q.map((J,Z)=>``),K=''+n0;return K+='',K+=d7($),K+='',K+=""+Q.join("")+"",K+='',K+=' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' ',K+="",K}function aB($,q){return m7(q[$-1],[{target:"../slideMasters/slideMaster1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"}])}function lB($,q,Q){return m7($[Q-1],[{target:`../slideLayouts/slideLayout${eB($,q,Q)}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"},{target:`../notesSlides/notesSlide${Q}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"}])}function rB($){return` - `}function Kz($,q){let Q=q.map((K,J)=>({target:`../slideLayouts/slideLayout${J+1}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"}));return Q.push({target:"../theme/theme1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}),m7($,Q)}function Jz(){return`${n0} + `}function sB($,q){let Q=q.map((K,J)=>({target:`../slideLayouts/slideLayout${J+1}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"}));return Q.push({target:"../theme/theme1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}),m7($,Q)}function tB(){return`${n0} - `}function Vz($,q,Q){for(let K=0;K`:'',G=((K=$.theme)===null||K===void 0?void 0:K.bodyFontFace)?``:'';return`${Z}${G}`}function Zz($){let q=`${n0}`;q+='',q+="",$.slides.forEach((Q)=>q+=``),q+="",q+=``,q+=``,q+=``,q+="";for(let Q=1;Q<10;Q++)q+=``;if(q+="",$.sections&&$.sections.length>0)q+='',q+='',$.sections.forEach((Q)=>{q+=``,Q._slides.forEach((K)=>q+=``),q+=""}),q+="",q+='',q+="";return q+="",q}function Gz(){return`${n0}`}function Wz(){return`${n0}`}function Bz(){return`${n0}`}var zz="4.0.1";class p7{set layout($){let q=this.LAYOUTS[$];if(q)this._layout=$,this._presLayout=q;else throw Error("UNKNOWN-LAYOUT")}get layout(){return this._layout}get version(){return this._version}set author($){this._author=$}get author(){return this._author}set company($){this._company=$}get company(){return this._company}set revision($){this._revision=$}get revision(){return this._revision}set subject($){this._subject=$}get subject(){return this._subject}set theme($){this._theme=$}get theme(){return this._theme}set title($){this._title=$}get title(){return this._title}set rtlMode($){this._rtlMode=$}get rtlMode(){return this._rtlMode}get masterSlide(){return this._masterSlide}get slides(){return this._slides}get sections(){return this._sections}get slideLayouts(){return this._slideLayouts}get AlignH(){return this._alignH}get AlignV(){return this._alignV}get ChartType(){return this._chartType}get OutputType(){return this._outputType}get presLayout(){return this._presLayout}get SchemeColor(){return this._schemeColor}get ShapeType(){return this._shapeType}get charts(){return this._charts}get colors(){return this._colors}get shapes(){return this._shapes}constructor(){this._version=zz,this._alignH=S7,this._alignV=E7,this._chartType=T7,this._outputType=P7,this._schemeColor=G2,this._shapeType=u7,this._charts=q0,this._colors=L5,this._shapes=B1,this.addNewSlide=(J)=>{let Z=this.sections.length>0&&this.sections[this.sections.length-1]._slides.filter((G)=>G._slideNum===this.slides[this.slides.length-1]._slideNum).length>0;return J.sectionTitle=Z?this.sections[this.sections.length-1].title:null,this.addSlide(J)},this.getSlide=(J)=>this.slides.filter((Z)=>Z._slideNum===J)[0],this.setSlideNumber=(J)=>{this.masterSlide._slideNumberProps=J,this.slideLayouts.filter((Z)=>Z._name===x7)[0]._slideNumberProps=J},this.createChartMediaRels=(J,Z,G)=>{J._relsChart.forEach((W)=>G.push(SB(W,Z))),J._relsMedia.forEach((W)=>{if(W.type!=="online"&&W.type!=="hyperlink"){let B=W.data&&typeof W.data==="string"?W.data:"";if(!B.includes(",")&&!B.includes(";"))B="image/png;base64,"+B;else if(!B.includes(","))B="image/png;base64,"+B;else if(!B.includes(";"))B="image/png;"+B;Z.file(W.Target.replace("..","ppt"),B.split(",").pop(),{base64:!0})}})},this.writeFileToBrowser=(J,Z)=>W2(this,void 0,void 0,function*(){let G=document.createElement("a");if(G.setAttribute("style","display:none;"),G.dataset.interception="off",document.body.appendChild(G),window.URL.createObjectURL){let W=window.URL.createObjectURL(new Blob([Z],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}));return G.href=W,G.download=J,G.click(),setTimeout(()=>{window.URL.revokeObjectURL(W),document.body.removeChild(G)},100),yield Promise.resolve(J)}}),this.exportPresentation=(J)=>W2(this,void 0,void 0,function*(){let Z=[],G=[],W=new c7.default;return this.slides.forEach((B)=>{G=G.concat(h7(B))}),this.slideLayouts.forEach((B)=>{G=G.concat(h7(B))}),G=G.concat(h7(this.masterSlide)),yield Promise.all(G).then(()=>W2(this,void 0,void 0,function*(){return this.slides.forEach((B)=>{if(B._slideLayout)uB(B)}),W.folder("_rels"),W.folder("docProps"),W.folder("ppt").folder("_rels"),W.folder("ppt/charts").folder("_rels"),W.folder("ppt/embeddings"),W.folder("ppt/media"),W.folder("ppt/slideLayouts").folder("_rels"),W.folder("ppt/slideMasters").folder("_rels"),W.folder("ppt/slides").folder("_rels"),W.folder("ppt/theme"),W.folder("ppt/notesMasters").folder("_rels"),W.folder("ppt/notesSlides").folder("_rels"),W.file("[Content_Types].xml",dB(this.slides,this.slideLayouts,this.masterSlide)),W.file("_rels/.rels",mB()),W.file("docProps/app.xml",pB(this.slides,this.company)),W.file("docProps/core.xml",iB(this.title,this.subject,this.author,this.revision)),W.file("ppt/_rels/presentation.xml.rels",oB(this.slides)),W.file("ppt/theme/theme1.xml",Uz(this)),W.file("ppt/presentation.xml",Zz(this)),W.file("ppt/presProps.xml",Gz()),W.file("ppt/tableStyles.xml",Wz()),W.file("ppt/viewProps.xml",Bz()),this.slideLayouts.forEach((B,V)=>{W.file(`ppt/slideLayouts/slideLayout${V+1}.xml`,tB(B)),W.file(`ppt/slideLayouts/_rels/slideLayout${V+1}.xml.rels`,$z(V+1,this.slideLayouts))}),this.slides.forEach((B,V)=>{W.file(`ppt/slides/slide${V+1}.xml`,aB(B)),W.file(`ppt/slides/_rels/slide${V+1}.xml.rels`,Qz(this.slides,this.slideLayouts,V+1)),W.file(`ppt/notesSlides/notesSlide${V+1}.xml`,sB(B)),W.file(`ppt/notesSlides/_rels/notesSlide${V+1}.xml.rels`,qz(V+1))}),W.file("ppt/slideMasters/slideMaster1.xml",eB(this.masterSlide,this.slideLayouts)),W.file("ppt/slideMasters/_rels/slideMaster1.xml.rels",Kz(this.masterSlide,this.slideLayouts)),W.file("ppt/notesMasters/notesMaster1.xml",rB()),W.file("ppt/notesMasters/_rels/notesMaster1.xml.rels",Jz()),this.slideLayouts.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.slides.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.createChartMediaRels(this.masterSlide,W,Z),yield Promise.all(Z).then(()=>W2(this,void 0,void 0,function*(){if(J.outputType==="STREAM")return yield W.generateAsync({type:"nodebuffer",compression:J.compression?"DEFLATE":"STORE"});else if(J.outputType)return yield W.generateAsync({type:J.outputType});else return yield W.generateAsync({type:"blob",compression:J.compression?"DEFLATE":"STORE"})}))}))});let $={name:"screen4x3",width:9144000,height:6858000},q={name:"screen16x9",width:9144000,height:5143500},Q={name:"screen16x10",width:9144000,height:5715000},K={name:"custom",width:12192000,height:6858000};this.LAYOUTS={LAYOUT_4x3:$,LAYOUT_16x9:q,LAYOUT_16x10:Q,LAYOUT_WIDE:K},this._author="PptxGenJS",this._company="PptxGenJS",this._revision="1",this._subject="PptxGenJS Presentation",this._title="PptxGenJS Presentation",this._presLayout={name:this.LAYOUTS[f6].name,_sizeW:this.LAYOUTS[f6].width,_sizeH:this.LAYOUTS[f6].height,width:this.LAYOUTS[f6].width,height:this.LAYOUTS[f6].height},this._rtlMode=!1,this._slideLayouts=[{_margin:M8,_name:x7,_presLayout:this._presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000,_slideNumberProps:null,_slideObjects:[]}],this._slides=[],this._sections=[],this._masterSlide={addChart:null,addImage:null,addMedia:null,addNotes:null,addShape:null,addTable:null,addText:null,_name:null,_presLayout:this._presLayout,_rId:null,_rels:[],_relsChart:[],_relsMedia:[],_slideId:null,_slideLayout:null,_slideNum:null,_slideNumberProps:null,_slideObjects:[]}}stream($){return W2(this,void 0,void 0,function*(){return yield this.exportPresentation({compression:$===null||$===void 0?void 0:$.compression,outputType:"STREAM"})})}write($){return W2(this,void 0,void 0,function*(){let q=typeof $==="object"&&($===null||$===void 0?void 0:$.outputType)?$.outputType:$?$:null,Q=typeof $==="object"&&($===null||$===void 0?void 0:$.compression)?$.compression:!1;return yield this.exportPresentation({compression:Q,outputType:q})})}writeFile($){return W2(this,void 0,void 0,function*(){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node";if(typeof $==="string")console.warn("[WARNING] writeFile(string) is deprecated - pass { fileName } instead."),$={fileName:$};let{fileName:J="Presentation.pptx",compression:Z=!1}=$,G=J.toLowerCase().endsWith(".pptx")?J:`${J}.pptx`,W=K?"nodebuffer":null,B=yield this.exportPresentation({compression:Z,outputType:W});if(K){let{promises:V}=yield import("node:fs"),{writeFile:U}=V;return yield U(G,B),G}return yield this.writeFileToBrowser(G,B),G})}addSection($){if(!$)console.warn("addSection requires an argument");else if(!$.title)console.warn("addSection requires a title");let q={_type:"user",_slides:[],title:$.title};if($.order)this.sections.splice($.order,0,q);else this._sections.push(q)}addSlide($){let q=typeof $==="string"?$:($===null||$===void 0?void 0:$.masterName)?$.masterName:"",Q={_name:this.LAYOUTS[f6].name,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slideNum:this.slides.length+1};if(q){let J=this.slideLayouts.filter((Z)=>Z._name===q)[0];if(J)Q=J}let K=new FJ({addSlide:this.addNewSlide,getSlide:this.getSlide,presLayout:this.presLayout,setSlideNum:this.setSlideNumber,slideId:this.slides.length+256,slideRId:this.slides.length+2,slideNumber:this.slides.length+1,slideLayout:Q});if(this._slides.push(K),$===null||$===void 0?void 0:$.sectionTitle){let J=this.sections.filter((Z)=>Z.title===$.sectionTitle)[0];if(!J)console.warn(`addSlide: unable to find section with title: "${$.sectionTitle}"`);else J._slides.push(K)}else if(this.sections&&this.sections.length>0&&!($===null||$===void 0?void 0:$.sectionTitle)){let J=this._sections[this.sections.length-1];if(J._type==="default")J._slides.push(K);else this._sections.push({title:`Default-${this.sections.filter((Z)=>Z._type==="default").length+1}`,_type:"default",_slides:[K]})}return K}defineLayout($){if(!$)console.warn("defineLayout requires `{name, width, height}`");else if(!$.name)console.warn("defineLayout requires `name`");else if(!$.width)console.warn("defineLayout requires `width`");else if(!$.height)console.warn("defineLayout requires `height`");else if(typeof $.height!=="number")console.warn("defineLayout `height` should be a number (inches)");else if(typeof $.width!=="number")console.warn("defineLayout `width` should be a number (inches)");this.LAYOUTS[$.name]={name:$.name,_sizeW:Math.round(Number($.width)*L0),_sizeH:Math.round(Number($.height)*L0),width:Math.round(Number($.width)*L0),height:Math.round(Number($.height)*L0)}}defineSlideMaster($){let q=JSON.parse(JSON.stringify($));if(!q.title)throw Error("defineSlideMaster() object argument requires a `title` value. (https://gitbrent.github.io/PptxGenJS/docs/masters.html)");let Q={_margin:q.margin||M8,_name:q.title,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000+this.slideLayouts.length+1,_slideNumberProps:q.slideNumber||null,_slideObjects:[],background:q.background||null,bkgd:q.bkgd||null};if(xB(q,Q),this.slideLayouts.push(Q),q.background||q.bkgd)zJ(q.background,Q);if(Q._slideNumberProps&&!this.masterSlide._slideNumberProps)this.masterSlide._slideNumberProps=Q._slideNumberProps}tableToSlides($,q={}){yB(this,$,q,(q===null||q===void 0?void 0:q.masterSlideName)?this.slideLayouts.filter((Q)=>Q._name===q.masterSlideName)[0]:null)}}if(typeof globalThis.Buffer>"u")globalThis.Buffer=o;if(typeof globalThis.process>"u")globalThis.process=Fz;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.pptxgenjs=p7;})(); + `}function eB($,q,Q){for(let K=0;K`:'',G=((K=$.theme)===null||K===void 0?void 0:K.bodyFontFace)?``:'';return`${Z}${G}`}function Qz($){let q=`${n0}`;q+='',q+="",$.slides.forEach((Q)=>q+=``),q+="",q+=``,q+=``,q+=``,q+="";for(let Q=1;Q<10;Q++)q+=``;if(q+="",$.sections&&$.sections.length>0)q+='',q+='',$.sections.forEach((Q)=>{q+=``,Q._slides.forEach((K)=>q+=``),q+=""}),q+="",q+='',q+="";return q+="",q}function qz(){return`${n0}`}function Kz(){return`${n0}`}function Jz(){return`${n0}`}var Vz="4.0.1";class p7{set layout($){let q=this.LAYOUTS[$];if(q)this._layout=$,this._presLayout=q;else throw Error("UNKNOWN-LAYOUT")}get layout(){return this._layout}get version(){return this._version}set author($){this._author=$}get author(){return this._author}set company($){this._company=$}get company(){return this._company}set revision($){this._revision=$}get revision(){return this._revision}set subject($){this._subject=$}get subject(){return this._subject}set theme($){this._theme=$}get theme(){return this._theme}set title($){this._title=$}get title(){return this._title}set rtlMode($){this._rtlMode=$}get rtlMode(){return this._rtlMode}get masterSlide(){return this._masterSlide}get slides(){return this._slides}get sections(){return this._sections}get slideLayouts(){return this._slideLayouts}get AlignH(){return this._alignH}get AlignV(){return this._alignV}get ChartType(){return this._chartType}get OutputType(){return this._outputType}get presLayout(){return this._presLayout}get SchemeColor(){return this._schemeColor}get ShapeType(){return this._shapeType}get charts(){return this._charts}get colors(){return this._colors}get shapes(){return this._shapes}constructor(){this._version=Vz,this._alignH=S7,this._alignV=E7,this._chartType=T7,this._outputType=P7,this._schemeColor=G2,this._shapeType=u7,this._charts=q0,this._colors=L5,this._shapes=B1,this.addNewSlide=(J)=>{let Z=this.sections.length>0&&this.sections[this.sections.length-1]._slides.filter((G)=>G._slideNum===this.slides[this.slides.length-1]._slideNum).length>0;return J.sectionTitle=Z?this.sections[this.sections.length-1].title:null,this.addSlide(J)},this.getSlide=(J)=>this.slides.filter((Z)=>Z._slideNum===J)[0],this.setSlideNumber=(J)=>{this.masterSlide._slideNumberProps=J,this.slideLayouts.filter((Z)=>Z._name===x7)[0]._slideNumberProps=J},this.createChartMediaRels=(J,Z,G)=>{J._relsChart.forEach((W)=>G.push(hB(W,Z))),J._relsMedia.forEach((W)=>{if(W.type!=="online"&&W.type!=="hyperlink"){let B=W.data&&typeof W.data==="string"?W.data:"";if(!B.includes(",")&&!B.includes(";"))B="image/png;base64,"+B;else if(!B.includes(","))B="image/png;base64,"+B;else if(!B.includes(";"))B="image/png;"+B;Z.file(W.Target.replace("..","ppt"),B.split(",").pop(),{base64:!0})}})},this.writeFileToBrowser=(J,Z)=>W2(this,void 0,void 0,function*(){let G=document.createElement("a");if(G.setAttribute("style","display:none;"),G.dataset.interception="off",document.body.appendChild(G),window.URL.createObjectURL){let W=window.URL.createObjectURL(new Blob([Z],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}));return G.href=W,G.download=J,G.click(),setTimeout(()=>{window.URL.revokeObjectURL(W),document.body.removeChild(G)},100),yield Promise.resolve(J)}}),this.exportPresentation=(J)=>W2(this,void 0,void 0,function*(){let Z=[],G=[],W=new c7.default;return this.slides.forEach((B)=>{G=G.concat(h7(B))}),this.slideLayouts.forEach((B)=>{G=G.concat(h7(B))}),G=G.concat(h7(this.masterSlide)),yield Promise.all(G).then(()=>W2(this,void 0,void 0,function*(){return this.slides.forEach((B)=>{if(B._slideLayout)yB(B)}),W.folder("_rels"),W.folder("docProps"),W.folder("ppt").folder("_rels"),W.folder("ppt/charts").folder("_rels"),W.folder("ppt/embeddings"),W.folder("ppt/media"),W.folder("ppt/slideLayouts").folder("_rels"),W.folder("ppt/slideMasters").folder("_rels"),W.folder("ppt/slides").folder("_rels"),W.folder("ppt/theme"),W.folder("ppt/notesMasters").folder("_rels"),W.folder("ppt/notesSlides").folder("_rels"),W.file("[Content_Types].xml",SB(this.slides,this.slideLayouts,this.masterSlide)),W.file("_rels/.rels",EB()),W.file("docProps/app.xml",_B(this.slides,this.company)),W.file("docProps/core.xml",cB(this.title,this.subject,this.author,this.revision)),W.file("ppt/_rels/presentation.xml.rels",bB(this.slides)),W.file("ppt/theme/theme1.xml",$z(this)),W.file("ppt/presentation.xml",Qz(this)),W.file("ppt/presProps.xml",qz()),W.file("ppt/tableStyles.xml",Kz()),W.file("ppt/viewProps.xml",Jz()),this.slideLayouts.forEach((B,V)=>{W.file(`ppt/slideLayouts/slideLayout${V+1}.xml`,iB(B)),W.file(`ppt/slideLayouts/_rels/slideLayout${V+1}.xml.rels`,aB(V+1,this.slideLayouts))}),this.slides.forEach((B,V)=>{W.file(`ppt/slides/slide${V+1}.xml`,nB(B)),W.file(`ppt/slides/_rels/slide${V+1}.xml.rels`,lB(this.slides,this.slideLayouts,V+1)),W.file(`ppt/notesSlides/notesSlide${V+1}.xml`,pB(B)),W.file(`ppt/notesSlides/_rels/notesSlide${V+1}.xml.rels`,rB(V+1))}),W.file("ppt/slideMasters/slideMaster1.xml",oB(this.masterSlide,this.slideLayouts)),W.file("ppt/slideMasters/_rels/slideMaster1.xml.rels",sB(this.masterSlide,this.slideLayouts)),W.file("ppt/notesMasters/notesMaster1.xml",mB()),W.file("ppt/notesMasters/_rels/notesMaster1.xml.rels",tB()),this.slideLayouts.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.slides.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.createChartMediaRels(this.masterSlide,W,Z),yield Promise.all(Z).then(()=>W2(this,void 0,void 0,function*(){if(J.outputType==="STREAM")return yield W.generateAsync({type:"nodebuffer",compression:J.compression?"DEFLATE":"STORE"});else if(J.outputType)return yield W.generateAsync({type:J.outputType});else return yield W.generateAsync({type:"blob",compression:J.compression?"DEFLATE":"STORE"})}))}))});let $={name:"screen4x3",width:9144000,height:6858000},q={name:"screen16x9",width:9144000,height:5143500},Q={name:"screen16x10",width:9144000,height:5715000},K={name:"custom",width:12192000,height:6858000};this.LAYOUTS={LAYOUT_4x3:$,LAYOUT_16x9:q,LAYOUT_16x10:Q,LAYOUT_WIDE:K},this._author="PptxGenJS",this._company="PptxGenJS",this._revision="1",this._subject="PptxGenJS Presentation",this._title="PptxGenJS Presentation",this._presLayout={name:this.LAYOUTS[f6].name,_sizeW:this.LAYOUTS[f6].width,_sizeH:this.LAYOUTS[f6].height,width:this.LAYOUTS[f6].width,height:this.LAYOUTS[f6].height},this._rtlMode=!1,this._slideLayouts=[{_margin:M8,_name:x7,_presLayout:this._presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000,_slideNumberProps:null,_slideObjects:[]}],this._slides=[],this._sections=[],this._masterSlide={addChart:null,addImage:null,addMedia:null,addNotes:null,addShape:null,addTable:null,addText:null,_name:null,_presLayout:this._presLayout,_rId:null,_rels:[],_relsChart:[],_relsMedia:[],_slideId:null,_slideLayout:null,_slideNum:null,_slideNumberProps:null,_slideObjects:[]}}stream($){return W2(this,void 0,void 0,function*(){return yield this.exportPresentation({compression:$===null||$===void 0?void 0:$.compression,outputType:"STREAM"})})}write($){return W2(this,void 0,void 0,function*(){let q=typeof $==="object"&&($===null||$===void 0?void 0:$.outputType)?$.outputType:$?$:null,Q=typeof $==="object"&&($===null||$===void 0?void 0:$.compression)?$.compression:!1;return yield this.exportPresentation({compression:Q,outputType:q})})}writeFile($){return W2(this,void 0,void 0,function*(){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node";if(typeof $==="string")console.warn("[WARNING] writeFile(string) is deprecated - pass { fileName } instead."),$={fileName:$};let{fileName:J="Presentation.pptx",compression:Z=!1}=$,G=J.toLowerCase().endsWith(".pptx")?J:`${J}.pptx`,W=K?"nodebuffer":null,B=yield this.exportPresentation({compression:Z,outputType:W});if(K){let{promises:V}=yield import("node:fs"),{writeFile:U}=V;return yield U(G,B),G}return yield this.writeFileToBrowser(G,B),G})}addSection($){if(!$)console.warn("addSection requires an argument");else if(!$.title)console.warn("addSection requires a title");let q={_type:"user",_slides:[],title:$.title};if($.order)this.sections.splice($.order,0,q);else this._sections.push(q)}addSlide($){let q=typeof $==="string"?$:($===null||$===void 0?void 0:$.masterName)?$.masterName:"",Q={_name:this.LAYOUTS[f6].name,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slideNum:this.slides.length+1};if(q){let J=this.slideLayouts.filter((Z)=>Z._name===q)[0];if(J)Q=J}let K=new FJ({addSlide:this.addNewSlide,getSlide:this.getSlide,presLayout:this.presLayout,setSlideNum:this.setSlideNumber,slideId:this.slides.length+256,slideRId:this.slides.length+2,slideNumber:this.slides.length+1,slideLayout:Q});if(this._slides.push(K),$===null||$===void 0?void 0:$.sectionTitle){let J=this.sections.filter((Z)=>Z.title===$.sectionTitle)[0];if(!J)console.warn(`addSlide: unable to find section with title: "${$.sectionTitle}"`);else J._slides.push(K)}else if(this.sections&&this.sections.length>0&&!($===null||$===void 0?void 0:$.sectionTitle)){let J=this._sections[this.sections.length-1];if(J._type==="default")J._slides.push(K);else this._sections.push({title:`Default-${this.sections.filter((Z)=>Z._type==="default").length+1}`,_type:"default",_slides:[K]})}return K}defineLayout($){if(!$)console.warn("defineLayout requires `{name, width, height}`");else if(!$.name)console.warn("defineLayout requires `name`");else if(!$.width)console.warn("defineLayout requires `width`");else if(!$.height)console.warn("defineLayout requires `height`");else if(typeof $.height!=="number")console.warn("defineLayout `height` should be a number (inches)");else if(typeof $.width!=="number")console.warn("defineLayout `width` should be a number (inches)");this.LAYOUTS[$.name]={name:$.name,_sizeW:Math.round(Number($.width)*L0),_sizeH:Math.round(Number($.height)*L0),width:Math.round(Number($.width)*L0),height:Math.round(Number($.height)*L0)}}defineSlideMaster($){let q=JSON.parse(JSON.stringify($));if(!q.title)throw Error("defineSlideMaster() object argument requires a `title` value. (https://gitbrent.github.io/PptxGenJS/docs/masters.html)");let Q={_margin:q.margin||M8,_name:q.title,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000+this.slideLayouts.length+1,_slideNumberProps:q.slideNumber||null,_slideObjects:[],background:q.background||null,bkgd:q.bkgd||null};if(jB(q,Q),this.slideLayouts.push(Q),q.background||q.bkgd)zJ(q.background,Q);if(Q._slideNumberProps&&!this.masterSlide._slideNumberProps)this.masterSlide._slideNumberProps=Q._slideNumberProps}tableToSlides($,q={}){IB(this,$,q,(q===null||q===void 0?void 0:q.masterSlideName)?this.slideLayouts.filter((Q)=>Q._name===q.masterSlideName)[0]:null)}}if(typeof globalThis.Buffer>"u")globalThis.Buffer=o;if(typeof globalThis.process>"u")globalThis.process=Uz;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.pptxgenjs=p7;})(); diff --git a/apps/sim/lib/invitations/workspace-invitations.ts b/apps/sim/lib/invitations/workspace-invitations.ts index 141d1c4c30d..8ff61a688de 100644 --- a/apps/sim/lib/invitations/workspace-invitations.ts +++ b/apps/sim/lib/invitations/workspace-invitations.ts @@ -12,7 +12,7 @@ import { getUserOrganization, } from '@/lib/billing/organizations/membership' import { validateSeatAvailability } from '@/lib/billing/validation/seat-management' -import { isBillingEnabled } from '@/lib/core/config/env-flags' +import { isBillingEnabled, isScimEnabled } from '@/lib/core/config/env-flags' import { PlatformEvents } from '@/lib/core/telemetry' import type { DbOrTx } from '@/lib/db/types' import { @@ -483,9 +483,10 @@ export async function createWorkspaceInvitation({ const existingUser = await db .select({ id: user.id, - scimManaged: organizationId - ? scimManagedUserPredicate(organizationId, user.id) - : sql`false`, + scimManaged: + organizationId && isScimEnabled + ? scimManagedUserPredicate(organizationId, user.id) + : sql`false`, }) .from(user) .where(sql`lower(${user.email}) = ${normalizedEmail}`) diff --git a/apps/sim/lib/organizations/members/lifecycle.test.ts b/apps/sim/lib/organizations/members/lifecycle.test.ts new file mode 100644 index 00000000000..ff98629ee9b --- /dev/null +++ b/apps/sim/lib/organizations/members/lifecycle.test.ts @@ -0,0 +1,164 @@ +/** + * @vitest-environment node + */ +import { member, session, user } from '@sim/db/schema' +import { dbChainMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' + +const { mockAcquireLocks, mockInvalidateVersion, mockInvalidateMembership } = vi.hoisted(() => ({ + mockAcquireLocks: vi.fn(), + mockInvalidateVersion: vi.fn(), + mockInvalidateMembership: vi.fn(), +})) + +vi.mock('@/lib/billing/organizations/membership', () => ({ + acquireOrganizationUserMutationLocks: mockAcquireLocks, +})) +vi.mock('@/lib/auth/security-policy', () => ({ + invalidateSecurityPolicyVersionCache: mockInvalidateVersion, + invalidateMembershipCache: mockInvalidateMembership, +})) + +import { db } from '@sim/db' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { + changeMemberRoleTx, + invalidateAfterSessionRevocation, + revokeUserSessionsTx, + suspendMemberTx, + unsuspendMemberTx, +} from '@/lib/organizations/members/lifecycle' + +afterAll(resetDbChainMock) + +beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() +}) + +describe('changeMemberRoleTx', () => { + it('takes the organization and user locks before reading the membership', async () => { + queueTableRows(member, [{ id: 'm-1', role: 'member' }]) + await changeMemberRoleTx(db, { organizationId: 'org-1', userId: 'u-1', role: 'admin' }) + expect(mockAcquireLocks).toHaveBeenCalledWith(db, { + userId: 'u-1', + organizationIds: ['org-1'], + }) + expect(mockAcquireLocks.mock.invocationCallOrder[0]).toBeLessThan( + dbChainMockFns.select.mock.invocationCallOrder[0] + ) + }) + + it('reports the change it made', async () => { + queueTableRows(member, [{ id: 'm-1', role: 'member' }]) + await expect( + changeMemberRoleTx(db, { organizationId: 'org-1', userId: 'u-1', role: 'admin' }) + ).resolves.toEqual({ changed: true, from: 'member', to: 'admin' }) + expect(dbChainMockFns.update).toHaveBeenCalledWith(member) + expect(dbChainMockFns.set).toHaveBeenCalledWith({ role: 'admin' }) + }) + + it('writes nothing when the role already matches', async () => { + queueTableRows(member, [{ id: 'm-1', role: 'admin' }]) + await expect( + changeMemberRoleTx(db, { organizationId: 'org-1', userId: 'u-1', role: 'admin' }) + ).resolves.toEqual({ changed: false, role: 'admin' }) + expect(dbChainMockFns.update).not.toHaveBeenCalled() + }) + + it('refuses to touch the owner and reports a missing member', async () => { + queueTableRows(member, [{ id: 'm-1', role: 'owner' }]) + const owner = await changeMemberRoleTx(db, { + organizationId: 'org-1', + userId: 'u-1', + role: 'member', + }).catch((error) => error) + expect(owner).toBeInstanceOf(OrchestrationError) + expect(owner.code).toBe('conflict') + + const missing = await changeMemberRoleTx(db, { + organizationId: 'org-1', + userId: 'u-2', + role: 'member', + }).catch((error) => error) + expect(missing.code).toBe('not_found') + expect(dbChainMockFns.update).not.toHaveBeenCalled() + }) +}) + +describe('revokeUserSessionsTx', () => { + it('deletes the user’s own sessions and bumps the organization security version together', async () => { + dbChainMockFns.returning.mockResolvedValueOnce([{ id: 's-1' }, { id: 's-2' }]) + await expect( + revokeUserSessionsTx(db, { userId: 'u-1', organizationId: 'org-1' }) + ).resolves.toEqual({ revoked: 2 }) + expect(dbChainMockFns.delete).toHaveBeenCalledWith(session) + expect(dbChainMockFns.where).toHaveBeenCalledWith( + expect.objectContaining({ + type: 'and', + conditions: expect.arrayContaining([ + { type: 'eq', left: session.userId, right: 'u-1' }, + { type: 'isNull', column: session.impersonatedBy }, + ]), + }) + ) + expect(dbChainMockFns.update).toHaveBeenCalledTimes(1) + }) + + it('spares the session token the caller is still using', async () => { + await revokeUserSessionsTx(db, { + userId: 'u-1', + organizationId: 'org-1', + spareSessionToken: 'keep-me', + }) + expect(dbChainMockFns.where).toHaveBeenCalledWith( + expect.objectContaining({ + conditions: expect.arrayContaining([{ type: 'ne', left: session.token, right: 'keep-me' }]), + }) + ) + }) + + it('clears the caches only through the separate post-commit step', () => { + invalidateAfterSessionRevocation({ userId: 'u-1', organizationId: 'org-1' }) + expect(mockInvalidateVersion).toHaveBeenCalledWith('org-1') + expect(mockInvalidateMembership).toHaveBeenCalledWith('u-1') + }) +}) + +describe('suspendMemberTx and unsuspendMemberTx', () => { + it('suspends once, revokes sessions, and never touches API keys', async () => { + dbChainMockFns.returning.mockResolvedValueOnce([{ id: 'u-1' }]) + dbChainMockFns.returning.mockResolvedValueOnce([{ id: 's-1' }]) + await expect( + suspendMemberTx(db, { userId: 'u-1', organizationId: 'org-1', source: 'scim' }) + ).resolves.toEqual({ suspended: true, sessionsRevoked: 1 }) + expect(mockAcquireLocks).toHaveBeenCalledTimes(1) + expect(dbChainMockFns.set).toHaveBeenCalledWith( + expect.objectContaining({ suspensionSource: 'scim', suspendedAt: expect.any(Date) }) + ) + expect(dbChainMockFns.delete).toHaveBeenCalledTimes(1) + expect(dbChainMockFns.delete).toHaveBeenCalledWith(session) + }) + + it('reports an already-suspended account without claiming a second suspension', async () => { + dbChainMockFns.returning.mockResolvedValueOnce([]) + await expect( + suspendMemberTx(db, { userId: 'u-1', organizationId: 'org-1', source: 'scim' }) + ).resolves.toMatchObject({ suspended: false }) + }) + + it('lifts only a suspension raised by the same source', async () => { + dbChainMockFns.returning.mockResolvedValueOnce([{ id: 'u-1' }]) + await expect(unsuspendMemberTx(db, { userId: 'u-1', source: 'scim' })).resolves.toEqual({ + unsuspended: true, + }) + expect(dbChainMockFns.update).toHaveBeenCalledWith(user) + expect(dbChainMockFns.where).toHaveBeenCalledWith({ + type: 'and', + conditions: [ + { type: 'eq', left: user.id, right: 'u-1' }, + { type: 'eq', left: user.suspensionSource, right: 'scim' }, + ], + }) + }) +}) diff --git a/apps/sim/lib/organizations/members/lifecycle.ts b/apps/sim/lib/organizations/members/lifecycle.ts index 9277282c2bf..4cc9f489448 100644 --- a/apps/sim/lib/organizations/members/lifecycle.ts +++ b/apps/sim/lib/organizations/members/lifecycle.ts @@ -21,8 +21,11 @@ const logger = createLogger('OrganizationMemberLifecycle') * that gap load-bearing, so the behavior is defined once here. */ -/** Why an account is suspended. SCIM only ever lifts a suspension it applied. */ -export type SuspensionSource = 'scim' | 'admin' +/** + * Who applied a suspension. A source only ever lifts its own, so a second source + * added later cannot have its suspensions undone by a directory sync. + */ +export type SuspensionSource = 'scim' export interface RevokeSessionsResult { revoked: number @@ -134,13 +137,7 @@ export async function suspendMemberTx( return { suspended: Boolean(updated), sessionsRevoked: sessions.revoked } } -/** - * Lifts a suspension, but only one raised by the same source. - * - * An administrator who suspends someone during an investigation must not have - * that undone by the next directory sync, so a SCIM reactivation leaves an - * `admin` suspension in place. - */ +/** Lifts a suspension, but only one raised by the same source. */ export async function unsuspendMemberTx( tx: DbOrTx, params: { userId: string; source: SuspensionSource } diff --git a/apps/sim/lib/permission-groups/application/group-membership.ts b/apps/sim/lib/permission-groups/application/group-membership.ts index 33480f66f1a..31bacb2e32f 100644 --- a/apps/sim/lib/permission-groups/application/group-membership.ts +++ b/apps/sim/lib/permission-groups/application/group-membership.ts @@ -5,12 +5,13 @@ import type { DbOrTx } from '@/lib/db/types' import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' /** - * Permission-group membership as a shared domain primitive. + * Permission-group membership as a domain primitive for callers outside the + * settings routes, today directory provisioning. * - * The conflict rules live here rather than in each caller because there are now - * three: the settings UI, the bulk assignment route, and directory - * provisioning. Two of them predate this module and carried the rules inline; a - * third copy is where they would first diverge. + * The settings routes still carry their own copies of the scope and + * all-members conflict rules in `app/api/organizations/[id]/permission-groups/utils.ts`; + * both copies must agree on `membershipMode`, and do. Folding the routes onto + * this module is the next step, not a prerequisite for it. */ /** A user already governed by another group that shares one of these workspaces. */ diff --git a/apps/sim/lib/scim/application/admin/connection-view.ts b/apps/sim/lib/scim/application/admin/connection-view.ts new file mode 100644 index 00000000000..0f85254db65 --- /dev/null +++ b/apps/sim/lib/scim/application/admin/connection-view.ts @@ -0,0 +1,125 @@ +import { db } from '@sim/db' +import { + type ScimConnectionSettings, + type ScimScope, + scimConnection, + scimCredential, + scimGroup, + scimUser, + workspace, +} from '@sim/db/schema' +import { and, count, desc, eq } from 'drizzle-orm' +import type { ScimConnectionView, ScimCredentialView } from '@/lib/api/contracts/organization-scim' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { getBaseUrl } from '@/lib/core/utils/urls' +import { activeCredentialCondition } from '@/lib/scim/authenticate' +import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' + +/** Reads shared by the admin use cases: the connection row and its settings view. */ + +export function scimBaseUrl(): string { + return `${getBaseUrl()}${SCIM_BASE_PATH}` +} + +export interface ConnectionRow { + id: string + organizationId: string + status: string + settings: ScimConnectionSettings +} + +/** The organization's connection, or the not-found refusal every admin write shares. */ +export async function requireConnection(organizationId: string): Promise { + const [row] = await db + .select({ + id: scimConnection.id, + organizationId: scimConnection.organizationId, + status: scimConnection.status, + settings: scimConnection.settings, + }) + .from(scimConnection) + .where(eq(scimConnection.organizationId, organizationId)) + .limit(1) + if (!row) { + throw new OrchestrationError( + 'not_found', + 'Enable directory provisioning for this organization first' + ) + } + return row +} + +/** Refuses a workspace id from outside the organization, on every path that grants access to one. */ +export async function assertWorkspaceInOrganization( + organizationId: string, + workspaceId: string +): Promise { + const [target] = await db + .select({ id: workspace.id }) + .from(workspace) + .where(and(eq(workspace.id, workspaceId), eq(workspace.organizationId, organizationId))) + .limit(1) + if (!target) { + throw new OrchestrationError('not_found', 'That workspace does not belong to this organization') + } +} + +export function toCredentialView(row: { + id: string + tokenPrefix: string + scopes: ScimScope[] + expiresAt: Date | null + lastUsedAt: Date | null + createdAt: Date +}): ScimCredentialView { + return { + id: row.id, + tokenPrefix: row.tokenPrefix, + scopes: row.scopes, + expiresAt: row.expiresAt?.toISOString() ?? null, + lastUsedAt: row.lastUsedAt?.toISOString() ?? null, + createdAt: row.createdAt.toISOString(), + } +} + +export async function loadConnectionView( + organizationId: string +): Promise { + const [row] = await db + .select() + .from(scimConnection) + .where(eq(scimConnection.organizationId, organizationId)) + .limit(1) + if (!row) return null + + const [credentials, [users], [groups]] = await Promise.all([ + db + .select({ + id: scimCredential.id, + tokenPrefix: scimCredential.tokenPrefix, + scopes: scimCredential.scopes, + expiresAt: scimCredential.expiresAt, + lastUsedAt: scimCredential.lastUsedAt, + createdAt: scimCredential.createdAt, + }) + .from(scimCredential) + .where(activeCredentialCondition(row.id)) + .orderBy(desc(scimCredential.createdAt)), + db.select({ value: count() }).from(scimUser).where(eq(scimUser.connectionId, row.id)), + db.select({ value: count() }).from(scimGroup).where(eq(scimGroup.connectionId, row.id)), + ]) + + return { + id: row.id, + status: row.status === 'disabled' ? 'disabled' : 'active', + baseUrl: scimBaseUrl(), + settings: row.settings, + ssoProviderId: row.ssoProviderId, + lastRequestAt: row.lastRequestAt?.toISOString() ?? null, + reconciledAt: row.reconciledAt?.toISOString() ?? null, + createdAt: row.createdAt.toISOString(), + credentials: credentials.map(toCredentialView), + userCount: users?.value ?? 0, + groupCount: groups?.value ?? 0, + } +} diff --git a/apps/sim/lib/scim/application/admin/connection.ts b/apps/sim/lib/scim/application/admin/connection.ts new file mode 100644 index 00000000000..4fdaad89fa9 --- /dev/null +++ b/apps/sim/lib/scim/application/admin/connection.ts @@ -0,0 +1,194 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import { db } from '@sim/db' +import { + type ScimConnectionSettings, + scimConnection, + scimRequestLog, + ssoProvider, +} from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import { and, desc, eq } from 'drizzle-orm' +import type { ScimConnectionSettingsInput } from '@/lib/api/contracts/organization-scim' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { + assertWorkspaceInOrganization, + loadConnectionView, + requireConnection, + scimBaseUrl, +} from '@/lib/scim/application/admin/connection-view' +import { + defineAuthorizedScimAdminUseCase, + type ScimAdminUseCaseArgs, +} from '@/lib/scim/application/authorized-scim-admin-use-case' +import { scimAdminOperations } from '@/lib/scim/application/operations' +import { reconcileConnection } from '@/lib/scim/reconcile/job' + +/** The connection itself: reading it, enabling and configuring it, and running a drift pass. */ + +export const getScimConnection = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.read, + async execute({ input }: ScimAdminUseCaseArgs<{ organizationId: string }>) { + return { + connection: await loadConnectionView(input.organizationId), + baseUrl: scimBaseUrl(), + } + }, +}) + +export interface ConfigureScimConnectionInput { + organizationId: string + status?: 'active' | 'disabled' + settings?: ScimConnectionSettingsInput + ssoProviderId?: string | null +} + +export const configureScimConnection = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.configure, + async execute({ input, context }: ScimAdminUseCaseArgs) { + if (input.ssoProviderId) { + const [provider] = await db + .select({ id: ssoProvider.id }) + .from(ssoProvider) + .where( + and( + eq(ssoProvider.id, input.ssoProviderId), + eq(ssoProvider.organizationId, context.organizationId) + ) + ) + .limit(1) + if (!provider) { + throw new OrchestrationError( + 'not_found', + 'That SSO provider does not belong to this organization' + ) + } + } + + /** + * A default grant hands every provisioned member a workspace, so the + * workspace must be this organization's — the same check a group mapping + * gets, or an administrator could name a workspace id from another tenant. + */ + for (const grant of input.settings?.defaultWorkspaceGrants ?? []) { + await assertWorkspaceInOrganization(context.organizationId, grant.workspaceId) + } + + const [existing] = await db + .select({ + id: scimConnection.id, + settings: scimConnection.settings, + status: scimConnection.status, + }) + .from(scimConnection) + .where(eq(scimConnection.organizationId, context.organizationId)) + .limit(1) + + const nextSettings: ScimConnectionSettings = { + /** + * Locking manual membership defaults on for a new connection. Once a + * directory owns membership, a change made only in Sim is reverted by the + * next sync, so a member edited by hand looks like it worked and then + * silently does not. + */ + lockManualMembership: true, + ...(existing?.settings ?? {}), + ...(input.settings ?? {}), + } + + const connectionId = existing?.id ?? generateId() + const nextStatus = input.status ?? existing?.status ?? 'active' + + if (existing) { + await db + .update(scimConnection) + .set({ + status: nextStatus, + settings: nextSettings, + ...(input.ssoProviderId !== undefined ? { ssoProviderId: input.ssoProviderId } : {}), + updatedAt: new Date(), + }) + .where(eq(scimConnection.id, existing.id)) + } else { + await db.insert(scimConnection).values({ + id: connectionId, + organizationId: context.organizationId, + ssoProviderId: input.ssoProviderId ?? null, + status: nextStatus, + settings: nextSettings, + createdBy: context.actorUserId, + }) + } + + const view = await loadConnectionView(context.organizationId) + if (!view) throw new OrchestrationError('internal', 'The connection could not be read back') + return { connection: view, created: !existing } + }, + projectAudit: ({ result }) => ({ + action: + result.connection.status === 'active' + ? result.created + ? AuditAction.SCIM_CONNECTION_ENABLED + : AuditAction.SCIM_CONNECTION_SETTINGS_UPDATED + : AuditAction.SCIM_CONNECTION_DISABLED, + resourceType: AuditResourceType.SCIM_CONNECTION, + resourceId: result.connection.id, + metadata: { status: result.connection.status }, + }), +}) + +export const listScimActivity = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.listActivity, + async execute({ input }: ScimAdminUseCaseArgs<{ organizationId: string; limit?: number }>) { + const rows = await db + .select({ + id: scimRequestLog.id, + method: scimRequestLog.method, + path: scimRequestLog.path, + status: scimRequestLog.status, + scimType: scimRequestLog.scimType, + detail: scimRequestLog.detail, + userAgent: scimRequestLog.userAgent, + durationMs: scimRequestLog.durationMs, + createdAt: scimRequestLog.createdAt, + }) + .from(scimRequestLog) + .innerJoin(scimConnection, eq(scimConnection.id, scimRequestLog.connectionId)) + .where(eq(scimConnection.organizationId, input.organizationId)) + .orderBy(desc(scimRequestLog.createdAt)) + .limit(input.limit ?? 50) + + return { + entries: rows.map((row) => ({ ...row, createdAt: row.createdAt.toISOString() })), + } + }, +}) + +export const reconcileScimConnection = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.reconcile, + async execute({ input }: ScimAdminUseCaseArgs<{ organizationId: string }>) { + const connection = await requireConnection(input.organizationId) + if (connection.status !== 'active') { + throw new OrchestrationError( + 'validation', + 'Enable directory provisioning before running a reconciliation' + ) + } + + /** + * The same lease-protected pass the scheduler runs, so an administrator's + * click and the hourly sweep can never reconcile one connection at once. + */ + const report = await reconcileConnection(connection) + if (!report) { + throw new OrchestrationError( + 'conflict', + 'A reconciliation is already running for this organization; try again in a few minutes' + ) + } + return { + reconciledUsers: report.reconciledUsers, + grantsAdded: report.grantsAdded, + grantsRemoved: report.grantsRemoved, + } + }, +}) diff --git a/apps/sim/lib/scim/application/admin/credentials.ts b/apps/sim/lib/scim/application/admin/credentials.ts new file mode 100644 index 00000000000..659d89a88ff --- /dev/null +++ b/apps/sim/lib/scim/application/admin/credentials.ts @@ -0,0 +1,116 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import { db } from '@sim/db' +import { SCIM_SCOPES, type ScimScope, scimConnection, scimCredential } from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import { and, count, eq, isNull, sql } from 'drizzle-orm' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { requireConnection, toCredentialView } from '@/lib/scim/application/admin/connection-view' +import { + defineAuthorizedScimAdminUseCase, + type ScimAdminUseCaseArgs, +} from '@/lib/scim/application/authorized-scim-admin-use-case' +import { scimAdminOperations } from '@/lib/scim/application/operations' +import { activeCredentialCondition, generateScimToken } from '@/lib/scim/authenticate' + +/** + * Issuing and revoking the bearer credentials a directory authenticates with. + * + * Two may be active at once. That is the whole point of rotation: an + * administrator issues the replacement, updates the directory, confirms it + * works, and only then revokes the old one — with no window where the directory + * cannot authenticate. + */ +const MAX_ACTIVE_CREDENTIALS = 2 + +const DAY_MS = 24 * 60 * 60 * 1000 + +export interface IssueScimCredentialInput { + organizationId: string + scopes?: ScimScope[] + expiresInDays?: number +} + +export const issueScimCredential = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.issueCredential, + async execute({ input, context }: ScimAdminUseCaseArgs) { + const connection = await requireConnection(context.organizationId) + + const [active] = await db + .select({ value: count() }) + .from(scimCredential) + .where(activeCredentialCondition(connection.id)) + if ((active?.value ?? 0) >= MAX_ACTIVE_CREDENTIALS) { + throw new OrchestrationError( + 'conflict', + `At most ${MAX_ACTIVE_CREDENTIALS} credentials may be active at once. Revoke one before issuing another.` + ) + } + + const { secret, hash, prefix } = generateScimToken() + const scopes = input.scopes ?? [...SCIM_SCOPES] + const expiresAt = input.expiresInDays + ? new Date(Date.now() + input.expiresInDays * DAY_MS) + : null + + const [created] = await db + .insert(scimCredential) + .values({ + id: generateId(), + connectionId: connection.id, + tokenHash: hash, + tokenPrefix: prefix, + scopes, + expiresAt, + createdBy: context.actorUserId, + }) + .returning({ + id: scimCredential.id, + tokenPrefix: scimCredential.tokenPrefix, + scopes: scimCredential.scopes, + expiresAt: scimCredential.expiresAt, + lastUsedAt: scimCredential.lastUsedAt, + createdAt: scimCredential.createdAt, + }) + + return { secret, credential: toCredentialView(created), connectionId: connection.id } + }, + /** The prefix identifies the credential; the secret is never recorded. */ + projectAudit: ({ result }) => ({ + action: AuditAction.SCIM_CREDENTIAL_ISSUED, + resourceType: AuditResourceType.SCIM_CONNECTION, + resourceId: result.connectionId, + metadata: { tokenPrefix: result.credential.tokenPrefix, scopes: result.credential.scopes }, + }), +}) + +export const revokeScimCredential = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.revokeCredential, + async execute({ + input, + context, + }: ScimAdminUseCaseArgs<{ organizationId: string; credentialId: string }>) { + const [revoked] = await db + .update(scimCredential) + .set({ revokedAt: new Date(), revokedBy: context.actorUserId }) + .where( + and( + eq(scimCredential.id, input.credentialId), + isNull(scimCredential.revokedAt), + sql`${scimCredential.connectionId} in ( + select ${scimConnection.id} from ${scimConnection} + where ${scimConnection.organizationId} = ${context.organizationId} + )` + ) + ) + .returning({ id: scimCredential.id, tokenPrefix: scimCredential.tokenPrefix }) + + if (!revoked) throw new OrchestrationError('not_found', 'Credential not found') + return { success: true as const, revoked } + }, + projectAudit: ({ result }) => ({ + action: AuditAction.SCIM_CREDENTIAL_REVOKED, + resourceType: AuditResourceType.SCIM_CONNECTION, + resourceId: result.revoked.id, + metadata: { tokenPrefix: result.revoked.tokenPrefix }, + }), +}) diff --git a/apps/sim/lib/scim/application/admin/manage-connection.ts b/apps/sim/lib/scim/application/admin/manage-connection.ts deleted file mode 100644 index a4c0dca22c4..00000000000 --- a/apps/sim/lib/scim/application/admin/manage-connection.ts +++ /dev/null @@ -1,725 +0,0 @@ -import { AuditAction, AuditResourceType, recordAudit } from '@sim/audit' -import { db } from '@sim/db' -import { - permissionGroup, - SCIM_SCOPES, - type ScimConnectionSettings, - type ScimScope, - scimConnection, - scimCredential, - scimGroup, - scimGroupMapping, - scimGroupMember, - scimRequestLog, - scimUser, - ssoProvider, - workspace, -} from '@sim/db/schema' -import { generateId } from '@sim/utils/id' -import { and, count, desc, eq, isNull, sql } from 'drizzle-orm' -import type { - ScimConnectionSettingsInput, - ScimConnectionView, - ScimCredentialView, - ScimGroupMappingView, -} from '@/lib/api/contracts/organization-scim' -import { OrchestrationError } from '@/lib/core/orchestration/types' -import { getBaseUrl } from '@/lib/core/utils/urls' -import { defineAuthorizedScimAdminUseCase } from '@/lib/scim/application/authorized-scim-admin-use-case' -import { scimAdminOperations } from '@/lib/scim/application/operations' -import { activeCredentialCondition, generateScimToken } from '@/lib/scim/authenticate' -import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' -import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' -import { reconcileConnection } from '@/lib/scim/reconcile/job' - -/** - * Administering the connection: enabling it, issuing and revoking credentials, - * mapping directory groups onto Sim access, and reading recent activity. - * - * Two credentials may be active at once. That is the whole point of rotation: an - * administrator issues the replacement, updates the directory, confirms it - * works, and only then revokes the old one — with no window where the directory - * cannot authenticate. - */ -const MAX_ACTIVE_CREDENTIALS = 2 - -function scimBaseUrl(): string { - return `${getBaseUrl()}${SCIM_BASE_PATH}` -} - -function toCredentialView(row: { - id: string - tokenPrefix: string - scopes: ScimScope[] - expiresAt: Date | null - lastUsedAt: Date | null - createdAt: Date -}): ScimCredentialView { - return { - id: row.id, - tokenPrefix: row.tokenPrefix, - scopes: row.scopes, - expiresAt: row.expiresAt?.toISOString() ?? null, - lastUsedAt: row.lastUsedAt?.toISOString() ?? null, - createdAt: row.createdAt.toISOString(), - } -} - -async function loadConnectionView(organizationId: string): Promise { - const [row] = await db - .select() - .from(scimConnection) - .where(eq(scimConnection.organizationId, organizationId)) - .limit(1) - if (!row) return null - - const [credentials, [users], [groups]] = await Promise.all([ - db - .select({ - id: scimCredential.id, - tokenPrefix: scimCredential.tokenPrefix, - scopes: scimCredential.scopes, - expiresAt: scimCredential.expiresAt, - lastUsedAt: scimCredential.lastUsedAt, - createdAt: scimCredential.createdAt, - }) - .from(scimCredential) - .where(activeCredentialCondition(row.id)) - .orderBy(desc(scimCredential.createdAt)), - db.select({ value: count() }).from(scimUser).where(eq(scimUser.connectionId, row.id)), - db.select({ value: count() }).from(scimGroup).where(eq(scimGroup.connectionId, row.id)), - ]) - - return { - id: row.id, - status: row.status === 'disabled' ? 'disabled' : 'active', - baseUrl: scimBaseUrl(), - settings: row.settings, - ssoProviderId: row.ssoProviderId, - lastRequestAt: row.lastRequestAt?.toISOString() ?? null, - reconciledAt: row.reconciledAt?.toISOString() ?? null, - createdAt: row.createdAt.toISOString(), - credentials: credentials.map(toCredentialView), - userCount: users?.value ?? 0, - groupCount: groups?.value ?? 0, - } -} - -export const getScimConnection = defineAuthorizedScimAdminUseCase({ - operation: scimAdminOperations.read, - async execute({ input }: { input: { organizationId: string } }) { - return { - connection: await loadConnectionView(input.organizationId), - baseUrl: scimBaseUrl(), - } - }, -}) - -export interface ConfigureScimConnectionInput { - organizationId: string - status?: 'active' | 'disabled' - settings?: ScimConnectionSettingsInput - ssoProviderId?: string | null -} - -export const configureScimConnection = defineAuthorizedScimAdminUseCase({ - operation: scimAdminOperations.configure, - async execute({ - input, - context, - request, - }: { - input: ConfigureScimConnectionInput - context: { organizationId: string; actorUserId: string } - request?: { headers: { get(name: string): string | null } } - }) { - if (input.ssoProviderId) { - const [provider] = await db - .select({ id: ssoProvider.id }) - .from(ssoProvider) - .where( - and( - eq(ssoProvider.id, input.ssoProviderId), - eq(ssoProvider.organizationId, context.organizationId) - ) - ) - .limit(1) - if (!provider) { - throw new OrchestrationError( - 'not_found', - 'That SSO provider does not belong to this organization' - ) - } - } - - const [existing] = await db - .select({ - id: scimConnection.id, - settings: scimConnection.settings, - status: scimConnection.status, - }) - .from(scimConnection) - .where(eq(scimConnection.organizationId, context.organizationId)) - .limit(1) - - const nextSettings: ScimConnectionSettings = { - /** - * Locking manual membership defaults on for a new connection. Once a - * directory owns membership, a change made only in Sim is reverted by the - * next sync, so a member edited by hand looks like it worked and then - * silently does not. - */ - lockManualMembership: true, - ...(existing?.settings ?? {}), - ...(input.settings ?? {}), - } - - const connectionId = existing?.id ?? generateId() - const nextStatus = input.status ?? existing?.status ?? 'active' - - await db.transaction(async (tx) => { - if (existing) { - await tx - .update(scimConnection) - .set({ - status: nextStatus, - settings: nextSettings, - ...(input.ssoProviderId !== undefined ? { ssoProviderId: input.ssoProviderId } : {}), - updatedAt: new Date(), - }) - .where(eq(scimConnection.id, existing.id)) - } else { - await tx.insert(scimConnection).values({ - id: connectionId, - organizationId: context.organizationId, - ssoProviderId: input.ssoProviderId ?? null, - status: nextStatus, - settings: nextSettings, - createdBy: context.actorUserId, - }) - } - - /** - * When the directory is the way in, just-in-time provisioning is turned - * off so a first sign-in cannot create a membership the directory did not - * ask for and will not know about. - */ - if (nextStatus === 'active' && nextSettings.disableJit) { - await tx - .update(ssoProvider) - .set({ jitProvisioningEnabled: false }) - .where(eq(ssoProvider.organizationId, context.organizationId)) - } - }) - - recordAudit({ - workspaceId: null, - actorId: context.actorUserId, - action: - nextStatus === 'active' - ? existing - ? AuditAction.SCIM_CONNECTION_SETTINGS_UPDATED - : AuditAction.SCIM_CONNECTION_ENABLED - : AuditAction.SCIM_CONNECTION_DISABLED, - resourceType: AuditResourceType.SCIM_CONNECTION, - resourceId: connectionId, - metadata: { organizationId: context.organizationId, status: nextStatus }, - request, - }) - - const view = await loadConnectionView(context.organizationId) - if (!view) throw new OrchestrationError('internal', 'The connection could not be read back') - return { connection: view } - }, -}) - -export interface IssueScimCredentialInput { - organizationId: string - scopes?: ScimScope[] - expiresInDays?: number -} - -export const issueScimCredential = defineAuthorizedScimAdminUseCase({ - operation: scimAdminOperations.issueCredential, - async execute({ - input, - context, - request, - }: { - input: IssueScimCredentialInput - context: { organizationId: string; actorUserId: string } - request?: { headers: { get(name: string): string | null } } - }) { - const [connection] = await db - .select({ id: scimConnection.id }) - .from(scimConnection) - .where(eq(scimConnection.organizationId, context.organizationId)) - .limit(1) - if (!connection) { - throw new OrchestrationError( - 'not_found', - 'Enable directory provisioning for this organization before issuing a credential' - ) - } - - const [active] = await db - .select({ value: count() }) - .from(scimCredential) - .where(activeCredentialCondition(connection.id)) - if ((active?.value ?? 0) >= MAX_ACTIVE_CREDENTIALS) { - throw new OrchestrationError( - 'conflict', - `At most ${MAX_ACTIVE_CREDENTIALS} credentials may be active at once. Revoke one before issuing another.` - ) - } - - const { secret, hash, prefix } = generateScimToken() - const scopes = input.scopes ?? [...SCIM_SCOPES] - const expiresAt = input.expiresInDays - ? new Date(Date.now() + input.expiresInDays * 24 * 60 * 60 * 1000) - : null - - const [created] = await db - .insert(scimCredential) - .values({ - id: generateId(), - connectionId: connection.id, - tokenHash: hash, - tokenPrefix: prefix, - scopes, - expiresAt, - createdBy: context.actorUserId, - }) - .returning({ - id: scimCredential.id, - tokenPrefix: scimCredential.tokenPrefix, - scopes: scimCredential.scopes, - expiresAt: scimCredential.expiresAt, - lastUsedAt: scimCredential.lastUsedAt, - createdAt: scimCredential.createdAt, - }) - - recordAudit({ - workspaceId: null, - actorId: context.actorUserId, - action: AuditAction.SCIM_CREDENTIAL_ISSUED, - resourceType: AuditResourceType.SCIM_CONNECTION, - resourceId: connection.id, - /** The prefix identifies the credential; the secret is never recorded. */ - metadata: { organizationId: context.organizationId, tokenPrefix: prefix, scopes }, - request, - }) - - return { secret, credential: toCredentialView(created) } - }, -}) - -export const revokeScimCredential = defineAuthorizedScimAdminUseCase({ - operation: scimAdminOperations.revokeCredential, - async execute({ - input, - context, - request, - }: { - input: { organizationId: string; credentialId: string } - context: { organizationId: string; actorUserId: string } - request?: { headers: { get(name: string): string | null } } - }) { - const [revoked] = await db - .update(scimCredential) - .set({ revokedAt: new Date(), revokedBy: context.actorUserId }) - .where( - and( - eq(scimCredential.id, input.credentialId), - isNull(scimCredential.revokedAt), - sql`${scimCredential.connectionId} in ( - select ${scimConnection.id} from ${scimConnection} - where ${scimConnection.organizationId} = ${context.organizationId} - )` - ) - ) - .returning({ id: scimCredential.id, tokenPrefix: scimCredential.tokenPrefix }) - - if (!revoked) throw new OrchestrationError('not_found', 'Credential not found') - - recordAudit({ - workspaceId: null, - actorId: context.actorUserId, - action: AuditAction.SCIM_CREDENTIAL_REVOKED, - resourceType: AuditResourceType.SCIM_CONNECTION, - resourceId: revoked.id, - metadata: { organizationId: context.organizationId, tokenPrefix: revoked.tokenPrefix }, - request, - }) - return { success: true as const } - }, -}) - -export const listScimActivity = defineAuthorizedScimAdminUseCase({ - operation: scimAdminOperations.listActivity, - async execute({ input }: { input: { organizationId: string; limit?: number } }) { - const rows = await db - .select({ - id: scimRequestLog.id, - method: scimRequestLog.method, - path: scimRequestLog.path, - status: scimRequestLog.status, - scimType: scimRequestLog.scimType, - detail: scimRequestLog.detail, - userAgent: scimRequestLog.userAgent, - durationMs: scimRequestLog.durationMs, - createdAt: scimRequestLog.createdAt, - }) - .from(scimRequestLog) - .innerJoin(scimConnection, eq(scimConnection.id, scimRequestLog.connectionId)) - .where(eq(scimConnection.organizationId, input.organizationId)) - .orderBy(desc(scimRequestLog.createdAt)) - .limit(input.limit ?? 50) - - return { - entries: rows.map((row) => ({ ...row, createdAt: row.createdAt.toISOString() })), - } - }, -}) - -function toMappingView(row: { - id: string - groupId: string - groupDisplayName: string - targetKind: string - permissionGroupId: string | null - workspaceId: string | null - permissionType: 'admin' | 'write' | 'read' | null - role: string | null -}): ScimGroupMappingView { - return { - id: row.id, - groupId: row.groupId, - groupDisplayName: row.groupDisplayName, - targetKind: row.targetKind as ScimGroupMappingView['targetKind'], - permissionGroupId: row.permissionGroupId, - workspaceId: row.workspaceId, - permissionType: row.permissionType, - role: row.role, - } -} - -export const listScimGroupMappings = defineAuthorizedScimAdminUseCase({ - operation: scimAdminOperations.read, - async execute({ input }: { input: { organizationId: string } }) { - const [connection] = await db - .select({ id: scimConnection.id }) - .from(scimConnection) - .where(eq(scimConnection.organizationId, input.organizationId)) - .limit(1) - if (!connection) return { groups: [] } - - const groups = await db - .select({ id: scimGroup.id, displayName: scimGroup.displayName }) - .from(scimGroup) - .where(eq(scimGroup.connectionId, connection.id)) - .orderBy(scimGroup.displayName) - - const mappings = await db - .select({ - id: scimGroupMapping.id, - groupId: scimGroupMapping.groupId, - groupDisplayName: scimGroup.displayName, - targetKind: scimGroupMapping.targetKind, - permissionGroupId: scimGroupMapping.permissionGroupId, - workspaceId: scimGroupMapping.workspaceId, - permissionType: scimGroupMapping.permissionType, - role: scimGroupMapping.role, - }) - .from(scimGroupMapping) - .innerJoin(scimGroup, eq(scimGroup.id, scimGroupMapping.groupId)) - .where(eq(scimGroup.connectionId, connection.id)) - - const counts = await db - .select({ groupId: scimGroupMember.groupId, value: count() }) - .from(scimGroupMember) - .innerJoin(scimGroup, eq(scimGroup.id, scimGroupMember.groupId)) - .where(eq(scimGroup.connectionId, connection.id)) - .groupBy(scimGroupMember.groupId) - - const memberCounts = new Map(counts.map((row) => [row.groupId, Number(row.value)])) - - return { - groups: groups.map((group) => ({ - id: group.id, - displayName: group.displayName, - memberCount: memberCounts.get(group.id) ?? 0, - mappings: mappings.filter((row) => row.groupId === group.id).map(toMappingView), - })), - } - }, -}) - -export type UpsertScimGroupMappingInput = { organizationId: string } & ( - | { targetKind: 'permission_group'; groupId: string; permissionGroupId: string } - | { - targetKind: 'workspace' - groupId: string - workspaceId: string - permissionType: 'admin' | 'write' | 'read' - } - | { targetKind: 'org_role'; groupId: string; role: 'admin' } -) - -/** Re-runs the projection for every member of a group whose mapping changed. */ -async function reconcileGroupMembers(params: { - connectionId: string - organizationId: string - groupId: string - settings: ScimConnectionSettings -}): Promise { - const members = await db - .select({ scimUserId: scimGroupMember.scimUserId }) - .from(scimGroupMember) - .where(eq(scimGroupMember.groupId, params.groupId)) - - await db.transaction(async (tx) => { - for (const { scimUserId } of members) { - await reconcileUserProjection(tx, { - connectionId: params.connectionId, - organizationId: params.organizationId, - scimUserId, - settings: params.settings, - }) - } - }) - return members.length -} - -export const upsertScimGroupMapping = defineAuthorizedScimAdminUseCase({ - operation: scimAdminOperations.upsertMapping, - async execute({ - input, - context, - request, - }: { - input: UpsertScimGroupMappingInput - context: { organizationId: string; actorUserId: string } - request?: { headers: { get(name: string): string | null } } - }) { - const [connection] = await db - .select({ id: scimConnection.id, settings: scimConnection.settings }) - .from(scimConnection) - .where(eq(scimConnection.organizationId, context.organizationId)) - .limit(1) - if (!connection) - throw new OrchestrationError('not_found', 'Directory provisioning is not enabled') - - const [group] = await db - .select({ id: scimGroup.id, displayName: scimGroup.displayName }) - .from(scimGroup) - .where(and(eq(scimGroup.id, input.groupId), eq(scimGroup.connectionId, connection.id))) - .limit(1) - if (!group) throw new OrchestrationError('not_found', 'Directory group not found') - - if (input.targetKind === 'permission_group') { - const [target] = await db - .select({ id: permissionGroup.id, membershipMode: permissionGroup.membershipMode }) - .from(permissionGroup) - .where( - and( - eq(permissionGroup.id, input.permissionGroupId), - eq(permissionGroup.organizationId, context.organizationId) - ) - ) - .limit(1) - if (!target) { - throw new OrchestrationError( - 'not_found', - 'That permission group does not belong to this organization' - ) - } - /** - * A directory-managed group must govern exactly its members. Left in - * `inherit` mode, the directory removing the last person would widen it - * from "these people" to "everyone in these workspaces". - */ - if (target.membershipMode !== 'explicit') { - await db - .update(permissionGroup) - .set({ membershipMode: 'explicit', updatedAt: new Date() }) - .where(eq(permissionGroup.id, target.id)) - } - } - - if (input.targetKind === 'workspace') { - const [target] = await db - .select({ id: workspace.id }) - .from(workspace) - .where( - and( - eq(workspace.id, input.workspaceId), - eq(workspace.organizationId, context.organizationId) - ) - ) - .limit(1) - if (!target) { - throw new OrchestrationError( - 'not_found', - 'That workspace does not belong to this organization' - ) - } - } - - const values = { - id: generateId(), - groupId: group.id, - targetKind: input.targetKind, - permissionGroupId: input.targetKind === 'permission_group' ? input.permissionGroupId : null, - workspaceId: input.targetKind === 'workspace' ? input.workspaceId : null, - permissionType: input.targetKind === 'workspace' ? input.permissionType : null, - role: input.targetKind === 'org_role' ? input.role : null, - createdBy: context.actorUserId, - } - - /** - * Selected, then inserted or updated, rather than an upsert. The uniqueness - * index is on a `coalesce` of the three target columns, which is an - * expression rather than a column list and so cannot be named as a conflict - * target. - */ - const mappingColumns = { - id: scimGroupMapping.id, - groupId: scimGroupMapping.groupId, - targetKind: scimGroupMapping.targetKind, - permissionGroupId: scimGroupMapping.permissionGroupId, - workspaceId: scimGroupMapping.workspaceId, - permissionType: scimGroupMapping.permissionType, - role: scimGroupMapping.role, - } - const targetId = values.permissionGroupId ?? values.workspaceId ?? values.role - const [existingMapping] = await db - .select({ id: scimGroupMapping.id }) - .from(scimGroupMapping) - .where( - and( - eq(scimGroupMapping.groupId, group.id), - eq(scimGroupMapping.targetKind, input.targetKind), - sql`coalesce(${scimGroupMapping.permissionGroupId}, ${scimGroupMapping.workspaceId}, ${scimGroupMapping.role}) = ${targetId}` - ) - ) - .limit(1) - - const [mapping] = existingMapping - ? await db - .update(scimGroupMapping) - .set({ permissionType: values.permissionType }) - .where(eq(scimGroupMapping.id, existingMapping.id)) - .returning(mappingColumns) - : await db.insert(scimGroupMapping).values(values).returning(mappingColumns) - - const reconciledUsers = await reconcileGroupMembers({ - connectionId: connection.id, - organizationId: context.organizationId, - groupId: group.id, - settings: connection.settings, - }) - - recordAudit({ - workspaceId: null, - actorId: context.actorUserId, - action: AuditAction.SCIM_GROUP_MAPPING_UPSERTED, - resourceType: AuditResourceType.SCIM_GROUP, - resourceId: group.id, - resourceName: group.displayName, - metadata: { organizationId: context.organizationId, targetKind: input.targetKind }, - request, - }) - - return { - mapping: toMappingView({ ...mapping, groupDisplayName: group.displayName }), - reconciledUsers, - } - }, -}) - -export const deleteScimGroupMapping = defineAuthorizedScimAdminUseCase({ - operation: scimAdminOperations.deleteMapping, - async execute({ - input, - context, - request, - }: { - input: { organizationId: string; mappingId: string } - context: { organizationId: string; actorUserId: string } - request?: { headers: { get(name: string): string | null } } - }) { - const [connection] = await db - .select({ id: scimConnection.id, settings: scimConnection.settings }) - .from(scimConnection) - .where(eq(scimConnection.organizationId, context.organizationId)) - .limit(1) - if (!connection) - throw new OrchestrationError('not_found', 'Directory provisioning is not enabled') - - const [mapping] = await db - .select({ id: scimGroupMapping.id, groupId: scimGroupMapping.groupId }) - .from(scimGroupMapping) - .innerJoin(scimGroup, eq(scimGroup.id, scimGroupMapping.groupId)) - .where( - and(eq(scimGroupMapping.id, input.mappingId), eq(scimGroup.connectionId, connection.id)) - ) - .limit(1) - if (!mapping) throw new OrchestrationError('not_found', 'Mapping not found') - - await db.delete(scimGroupMapping).where(eq(scimGroupMapping.id, mapping.id)) - - const reconciledUsers = await reconcileGroupMembers({ - connectionId: connection.id, - organizationId: context.organizationId, - groupId: mapping.groupId, - settings: connection.settings, - }) - - recordAudit({ - workspaceId: null, - actorId: context.actorUserId, - action: AuditAction.SCIM_GROUP_MAPPING_DELETED, - resourceType: AuditResourceType.SCIM_GROUP, - resourceId: mapping.groupId, - metadata: { organizationId: context.organizationId, mappingId: mapping.id }, - request, - }) - - return { success: true as const, reconciledUsers } - }, -}) - -export const reconcileScimConnection = defineAuthorizedScimAdminUseCase({ - operation: scimAdminOperations.reconcile, - async execute({ input }: { input: { organizationId: string } }) { - const [connection] = await db - .select({ - id: scimConnection.id, - organizationId: scimConnection.organizationId, - settings: scimConnection.settings, - }) - .from(scimConnection) - .where(eq(scimConnection.organizationId, input.organizationId)) - .limit(1) - if (!connection) - throw new OrchestrationError('not_found', 'Directory provisioning is not enabled') - - /** - * The same lease-protected pass the scheduler runs, so an administrator's - * click and the hourly sweep can never reconcile one connection at once. - */ - const report = await reconcileConnection(connection) - if (!report) { - throw new OrchestrationError( - 'conflict', - 'A reconciliation is already running for this organization; try again in a few minutes' - ) - } - return { - reconciledUsers: report.reconciledUsers, - grantsAdded: report.grantsAdded, - grantsRemoved: report.grantsRemoved, - } - }, -}) diff --git a/apps/sim/lib/scim/application/admin/mappings.ts b/apps/sim/lib/scim/application/admin/mappings.ts new file mode 100644 index 00000000000..cbdc5e8a374 --- /dev/null +++ b/apps/sim/lib/scim/application/admin/mappings.ts @@ -0,0 +1,293 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import { db } from '@sim/db' +import { + permissionGroup, + type ScimConnectionSettings, + scimConnection, + scimGroup, + scimGroupMapping, + scimGroupMember, +} from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import { and, count, eq, sql } from 'drizzle-orm' +import type { ScimGroupMappingView } from '@/lib/api/contracts/organization-scim' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { + assertWorkspaceInOrganization, + requireConnection, +} from '@/lib/scim/application/admin/connection-view' +import { + defineAuthorizedScimAdminUseCase, + type ScimAdminUseCaseArgs, +} from '@/lib/scim/application/authorized-scim-admin-use-case' +import { scimAdminOperations } from '@/lib/scim/application/operations' +import { reconcileUsersProjectionInBatches } from '@/lib/scim/projection/reconcile-user' + +/** + * Mapping directory groups onto Sim access. + * + * A pushed group means nothing until an administrator says what it stands for: + * a permission group, a workspace at a level, or the organization admin role. + * Changing a mapping re-projects every member of the group at once, so the + * change takes effect without waiting for the directory's next cycle. + */ + +const MAPPING_COLUMNS = { + id: scimGroupMapping.id, + groupId: scimGroupMapping.groupId, + targetKind: scimGroupMapping.targetKind, + permissionGroupId: scimGroupMapping.permissionGroupId, + workspaceId: scimGroupMapping.workspaceId, + permissionType: scimGroupMapping.permissionType, + role: scimGroupMapping.role, +} as const + +function toMappingView(row: { + id: string + groupId: string + groupDisplayName: string + targetKind: string + permissionGroupId: string | null + workspaceId: string | null + permissionType: 'admin' | 'write' | 'read' | null + role: string | null +}): ScimGroupMappingView { + return { + id: row.id, + groupId: row.groupId, + groupDisplayName: row.groupDisplayName, + targetKind: row.targetKind as ScimGroupMappingView['targetKind'], + permissionGroupId: row.permissionGroupId, + workspaceId: row.workspaceId, + permissionType: row.permissionType, + role: row.role, + } +} + +export const listScimGroupMappings = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.read, + async execute({ input }: ScimAdminUseCaseArgs<{ organizationId: string }>) { + const [connection] = await db + .select({ id: scimConnection.id }) + .from(scimConnection) + .where(eq(scimConnection.organizationId, input.organizationId)) + .limit(1) + if (!connection) return { groups: [] } + + const [groups, mappings, counts] = await Promise.all([ + db + .select({ id: scimGroup.id, displayName: scimGroup.displayName }) + .from(scimGroup) + .where(eq(scimGroup.connectionId, connection.id)) + .orderBy(scimGroup.displayName), + db + .select({ ...MAPPING_COLUMNS, groupDisplayName: scimGroup.displayName }) + .from(scimGroupMapping) + .innerJoin(scimGroup, eq(scimGroup.id, scimGroupMapping.groupId)) + .where(eq(scimGroup.connectionId, connection.id)), + db + .select({ groupId: scimGroupMember.groupId, value: count() }) + .from(scimGroupMember) + .innerJoin(scimGroup, eq(scimGroup.id, scimGroupMember.groupId)) + .where(eq(scimGroup.connectionId, connection.id)) + .groupBy(scimGroupMember.groupId), + ]) + + const memberCounts = new Map(counts.map((row) => [row.groupId, Number(row.value)])) + const mappingsByGroup = new Map() + for (const row of mappings) { + const list = mappingsByGroup.get(row.groupId) ?? [] + list.push(toMappingView(row)) + mappingsByGroup.set(row.groupId, list) + } + + return { + groups: groups.map((group) => ({ + id: group.id, + displayName: group.displayName, + memberCount: memberCounts.get(group.id) ?? 0, + mappings: mappingsByGroup.get(group.id) ?? [], + })), + } + }, +}) + +/** Re-runs the projection for every member of a group whose mapping changed. */ +async function reconcileGroupMembers(params: { + connectionId: string + organizationId: string + groupId: string + settings: ScimConnectionSettings +}): Promise { + const members = await db + .select({ scimUserId: scimGroupMember.scimUserId }) + .from(scimGroupMember) + .where(eq(scimGroupMember.groupId, params.groupId)) + + await reconcileUsersProjectionInBatches({ + connectionId: params.connectionId, + organizationId: params.organizationId, + scimUserIds: members.map((row) => row.scimUserId), + settings: params.settings, + }) + return members.length +} + +async function requireGroup(connectionId: string, groupId: string) { + const [group] = await db + .select({ id: scimGroup.id, displayName: scimGroup.displayName }) + .from(scimGroup) + .where(and(eq(scimGroup.id, groupId), eq(scimGroup.connectionId, connectionId))) + .limit(1) + if (!group) throw new OrchestrationError('not_found', 'Directory group not found') + return group +} + +async function assertPermissionGroupTarget(organizationId: string, permissionGroupId: string) { + const [target] = await db + .select({ id: permissionGroup.id, membershipMode: permissionGroup.membershipMode }) + .from(permissionGroup) + .where( + and( + eq(permissionGroup.id, permissionGroupId), + eq(permissionGroup.organizationId, organizationId) + ) + ) + .limit(1) + if (!target) { + throw new OrchestrationError( + 'not_found', + 'That permission group does not belong to this organization' + ) + } + /** + * A directory-managed group must govern exactly its members. Left in + * `inherit` mode, the directory removing the last person would widen it + * from "these people" to "everyone in these workspaces". + */ + if (target.membershipMode !== 'explicit') { + await db + .update(permissionGroup) + .set({ membershipMode: 'explicit', updatedAt: new Date() }) + .where(eq(permissionGroup.id, target.id)) + } +} + +export type UpsertScimGroupMappingInput = { organizationId: string } & ( + | { targetKind: 'permission_group'; groupId: string; permissionGroupId: string } + | { + targetKind: 'workspace' + groupId: string + workspaceId: string + permissionType: 'admin' | 'write' | 'read' + } + | { targetKind: 'org_role'; groupId: string; role: 'admin' } +) + +export const upsertScimGroupMapping = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.upsertMapping, + async execute({ input, context }: ScimAdminUseCaseArgs) { + const connection = await requireConnection(context.organizationId) + const group = await requireGroup(connection.id, input.groupId) + + if (input.targetKind === 'permission_group') { + await assertPermissionGroupTarget(context.organizationId, input.permissionGroupId) + } else if (input.targetKind === 'workspace') { + await assertWorkspaceInOrganization(context.organizationId, input.workspaceId) + } + + const values = { + id: generateId(), + groupId: group.id, + targetKind: input.targetKind, + permissionGroupId: input.targetKind === 'permission_group' ? input.permissionGroupId : null, + workspaceId: input.targetKind === 'workspace' ? input.workspaceId : null, + permissionType: input.targetKind === 'workspace' ? input.permissionType : null, + role: input.targetKind === 'org_role' ? input.role : null, + createdBy: context.actorUserId, + } + + /** + * Selected, then inserted or updated, rather than an upsert. The uniqueness + * index is on a `coalesce` of the three target columns, which is an + * expression rather than a column list and so cannot be named as a conflict + * target. + */ + const targetId = values.permissionGroupId ?? values.workspaceId ?? values.role + const [existingMapping] = await db + .select({ id: scimGroupMapping.id }) + .from(scimGroupMapping) + .where( + and( + eq(scimGroupMapping.groupId, group.id), + eq(scimGroupMapping.targetKind, input.targetKind), + sql`coalesce(${scimGroupMapping.permissionGroupId}, ${scimGroupMapping.workspaceId}, ${scimGroupMapping.role}) = ${targetId}` + ) + ) + .limit(1) + + const [mapping] = existingMapping + ? await db + .update(scimGroupMapping) + .set({ permissionType: values.permissionType }) + .where(eq(scimGroupMapping.id, existingMapping.id)) + .returning(MAPPING_COLUMNS) + : await db.insert(scimGroupMapping).values(values).returning(MAPPING_COLUMNS) + + const reconciledUsers = await reconcileGroupMembers({ + connectionId: connection.id, + organizationId: context.organizationId, + groupId: group.id, + settings: connection.settings, + }) + + return { + mapping: toMappingView({ ...mapping, groupDisplayName: group.displayName }), + reconciledUsers, + } + }, + projectAudit: ({ result }) => ({ + action: AuditAction.SCIM_GROUP_MAPPING_UPSERTED, + resourceType: AuditResourceType.SCIM_GROUP, + resourceId: result.mapping.groupId, + resourceName: result.mapping.groupDisplayName, + metadata: { targetKind: result.mapping.targetKind, mappingId: result.mapping.id }, + }), +}) + +export const deleteScimGroupMapping = defineAuthorizedScimAdminUseCase({ + operation: scimAdminOperations.deleteMapping, + async execute({ + input, + context, + }: ScimAdminUseCaseArgs<{ organizationId: string; mappingId: string }>) { + const connection = await requireConnection(context.organizationId) + + const [mapping] = await db + .select({ id: scimGroupMapping.id, groupId: scimGroupMapping.groupId }) + .from(scimGroupMapping) + .innerJoin(scimGroup, eq(scimGroup.id, scimGroupMapping.groupId)) + .where( + and(eq(scimGroupMapping.id, input.mappingId), eq(scimGroup.connectionId, connection.id)) + ) + .limit(1) + if (!mapping) throw new OrchestrationError('not_found', 'Mapping not found') + + await db.delete(scimGroupMapping).where(eq(scimGroupMapping.id, mapping.id)) + + const reconciledUsers = await reconcileGroupMembers({ + connectionId: connection.id, + organizationId: context.organizationId, + groupId: mapping.groupId, + settings: connection.settings, + }) + + return { success: true as const, reconciledUsers, mapping } + }, + projectAudit: ({ result }) => ({ + action: AuditAction.SCIM_GROUP_MAPPING_DELETED, + resourceType: AuditResourceType.SCIM_GROUP, + resourceId: result.mapping.groupId, + metadata: { mappingId: result.mapping.id }, + }), +}) diff --git a/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts b/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts index 05ec285d297..757324a0bbe 100644 --- a/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts +++ b/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts @@ -1,3 +1,4 @@ +import { type AuditActionType, type AuditResourceTypeValue, recordAudit } from '@sim/audit' import type { Principal } from '@sim/auth/principal' import { db } from '@sim/db' import { member } from '@sim/db/schema' @@ -14,7 +15,9 @@ import type { ScimAdminOperation, ScimAdminPrincipal } from '@/lib/scim/applicat * Gate order is deliberate and each step is its own refusal, so a failure says * which rule stopped it: principal kind, then organization membership, then the * admin role, then the entitlement. Mirrors the organization BYOK and usage - * wrappers rather than inventing a fourth shape. + * wrappers rather than inventing a fourth shape, and mirrors the directory + * wrapper's audit projection so both halves of the surface record audit the + * same way. */ export interface ScimAdminContext { @@ -22,18 +25,34 @@ export interface ScimAdminContext { actorUserId: string } +export interface ScimAdminUseCaseArgs { + principal: ScimAdminPrincipal + input: I + context: ScimAdminContext + request?: OrchestrationRequestContext +} + +export interface ScimAdminUseCaseResultArgs extends ScimAdminUseCaseArgs { + result: R +} + +export interface ScimAdminAuditEntry { + action: AuditActionType + resourceType: AuditResourceTypeValue + resourceId?: string + resourceName?: string + metadata?: Record +} + interface AuthorizedScimAdminDefinition< O extends ScimAdminOperation, I extends { organizationId: string }, R, > { operation: O - execute(args: { - principal: ScimAdminPrincipal - input: I - context: ScimAdminContext - request?: OrchestrationRequestContext - }): Promise + execute(args: ScimAdminUseCaseArgs): Promise + /** Audit attributed to the administrator; the organization id is added for every entry. */ + projectAudit?(args: ScimAdminUseCaseResultArgs): ScimAdminAuditEntry | undefined } function requireScimAdminPrincipal( @@ -85,12 +104,26 @@ export function defineAuthorizedScimAdminUseCase< ) } - return definition.execute({ - principal, - input, - context: { organizationId: input.organizationId, actorUserId: principal.userId }, - request, - }) + const context: ScimAdminContext = { + organizationId: input.organizationId, + actorUserId: principal.userId, + } + const result = await definition.execute({ principal, input, context, request }) + + const entry = definition.projectAudit?.({ principal, input, context, request, result }) + if (entry) { + recordAudit({ + workspaceId: null, + actorId: context.actorUserId, + action: entry.action, + resourceType: entry.resourceType, + resourceId: entry.resourceId, + resourceName: entry.resourceName, + metadata: { ...entry.metadata, organizationId: context.organizationId }, + request, + }) + } + return result }, } } diff --git a/apps/sim/lib/scim/application/groups/manage-groups.ts b/apps/sim/lib/scim/application/groups/manage-groups.ts index f829b3ca875..3edb5787c6e 100644 --- a/apps/sim/lib/scim/application/groups/manage-groups.ts +++ b/apps/sim/lib/scim/application/groups/manage-groups.ts @@ -33,6 +33,7 @@ import { insertScimGroup, loadGroupMemberIds, loadGroupMembers, + loadGroupMembersForGroups, pageScimGroups, removeGroupMember, touchScimGroup, @@ -95,16 +96,24 @@ export const listScimGroups = defineAuthorizedScimUseCase({ * loading thousands of rows only to drop them. */ const wantsMembers = projectionWants(input.projection, 'members') - const resources: ScimGroupResource[] = [] - for (const record of records) { - const members = wantsMembers ? await loadGroupMembers(db, record.id) : undefined - resources.push( - projectResource( - toGroupResource({ ...record, ...(members ? { members } : {}) }, context.baseUrl), - input.projection + const membersByGroup = wantsMembers + ? await loadGroupMembersForGroups( + db, + records.map((record) => record.id) ) + : null + const resources: ScimGroupResource[] = records.map((record) => + projectResource( + toGroupResource( + { + ...record, + ...(membersByGroup ? { members: membersByGroup.get(record.id) ?? [] } : {}), + }, + context.baseUrl + ), + input.projection ) - } + ) return { resources, totalResults, startIndex: page.startIndex } }, @@ -227,26 +236,28 @@ export const replaceScimGroup = defineAuthorizedScimUseCase({ }) await assertConnectionOwnsUsers(tx, context.connection.id, input.group.memberIds) - await updateScimGroup(tx, { - groupId: current.id, - displayName: input.group.displayName, - externalId: input.group.externalId ?? null, - }) - if ( - context.connection.settings.autoMapPermissionGroupsByName && - input.group.displayName !== current.displayName - ) { - await autoMapPermissionGroupByName(tx, { + const before = await loadGroupMemberIds(tx, current.id) + const desired = new Set(input.group.memberIds) + const touched = new Set() + + const renamed = input.group.displayName !== current.displayName + if (renamed || (input.group.externalId ?? null) !== current.externalId) { + await updateScimGroup(tx, { + groupId: current.id, + displayName: input.group.displayName, + externalId: input.group.externalId ?? null, + }) + } + if (renamed && context.connection.settings.autoMapPermissionGroupsByName) { + const mapped = await autoMapPermissionGroupByName(tx, { organizationId: context.organizationId, scimGroupId: current.id, displayName: input.group.displayName, }) + /** A new mapping applies to everyone already in the group, not only to those moving today. */ + if (mapped === 'mapped') for (const scimUserId of before) touched.add(scimUserId) } - const before = await loadGroupMemberIds(tx, current.id) - const desired = new Set(input.group.memberIds) - const touched = new Set() - for (const scimUserId of before) { if (desired.has(scimUserId)) continue await removeGroupMember(tx, { groupId: current.id, scimUserId }) @@ -272,9 +283,7 @@ export const replaceScimGroup = defineAuthorizedScimUseCase({ displayName: refreshed.displayName, resource: toGroupResource({ ...refreshed, members }, context.baseUrl), touchedUserIds: [...touched], - renamed: - current.displayName !== refreshed.displayName || - (current.externalId ?? null) !== (refreshed.externalId ?? null), + renamed: renamed || (current.externalId ?? null) !== (refreshed.externalId ?? null), } }) }, @@ -344,11 +353,15 @@ export const patchScimGroup = defineAuthorizedScimUseCase({ }) renamed = true } - if (patch.displayName !== undefined || patch.externalId !== undefined) { + const externalIdChanged = + patch.externalId !== undefined && patch.externalId !== current.externalId + if (renamed || externalIdChanged) { await updateScimGroup(tx, { groupId: current.id, - ...(patch.displayName !== undefined ? { displayName: patch.displayName } : {}), - ...(patch.externalId !== undefined ? { externalId: patch.externalId } : {}), + ...(renamed && patch.displayName !== undefined + ? { displayName: patch.displayName } + : {}), + ...(externalIdChanged ? { externalId: patch.externalId } : {}), }) } if ( @@ -356,12 +369,18 @@ export const patchScimGroup = defineAuthorizedScimUseCase({ patch.displayName && context.connection.settings.autoMapPermissionGroupsByName ) { - await autoMapPermissionGroupByName(tx, { + const mapped = await autoMapPermissionGroupByName(tx, { organizationId: context.organizationId, scimGroupId: current.id, displayName: patch.displayName, }) + if (mapped === 'mapped') { + for (const scimUserId of await loadGroupMemberIds(tx, current.id)) { + touched.add(scimUserId) + } + } } + renamed = renamed || externalIdChanged if (patch.members !== undefined) { const before = await loadGroupMemberIds(tx, current.id) const desired = new Set(patch.members) diff --git a/apps/sim/lib/scim/application/users/provision-user.ts b/apps/sim/lib/scim/application/users/provision-user.ts index 14d8c883433..85e35f58fa5 100644 --- a/apps/sim/lib/scim/application/users/provision-user.ts +++ b/apps/sim/lib/scim/application/users/provision-user.ts @@ -2,6 +2,7 @@ import { AuditAction, AuditResourceType } from '@sim/audit' import { db } from '@sim/db' import { type ScimUserAttributes, subscription, user } from '@sim/db/schema' import { createLogger } from '@sim/logger' +import { APIError } from 'better-auth/api' import { and, desc, eq, inArray } from 'drizzle-orm' import { auth } from '@/lib/auth' import { applySessionPolicyToNewMember } from '@/lib/auth/session-policy' @@ -21,6 +22,7 @@ import { type ScimUseCaseArgs, } from '@/lib/scim/application/authorized-scim-use-case' import { scimOperations } from '@/lib/scim/application/operations' +import { syncAccountIdentityTx } from '@/lib/scim/identity/account-identity' import { assertEmailAvailable, consumeTombstone, @@ -137,14 +139,26 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ if (resolution.action === 'create') { await assertEmailAvailable(db, email) - const created = await auth.api.createUser({ - body: { - email, - name: attributes.name.formatted, - data: { emailVerified: false }, - }, - }) - userId = created.user.id + try { + const created = await auth.api.createUser({ + body: { + email, + name: attributes.name.formatted, + data: { emailVerified: false }, + }, + }) + userId = created.user.id + } catch (error) { + /** + * Two creates for one address can race past the availability check; + * Better Auth's unique constraint is the arbiter, and the loser is a + * duplicate the directory must resolve, not a server fault to retry. + */ + if (error instanceof APIError && error.statusCode === 422) { + throw uniqueness('Another Sim account already uses this email address') + } + throw error + } createdAccount = true } else { userId = resolution.userId @@ -177,6 +191,16 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ }) if (!membership.success) throw membershipFailure(membership.failureCode) + /** + * A relinked account takes the directory's current identity. A rename + * that arrives as delete-and-recreate must land the same way as one that + * arrives as a PATCH, or the response would describe an address the + * account does not have. + */ + if (resolution.action === 'link') { + await syncAccountIdentityTx(tx, { userId, email, name: attributes.name.formatted }) + } + const inserted = await insertScimUser(tx, { connectionId: context.connection.id, userId, diff --git a/apps/sim/lib/scim/application/users/read-users.ts b/apps/sim/lib/scim/application/users/read-users.ts index 9a444190695..979a5ffeb07 100644 --- a/apps/sim/lib/scim/application/users/read-users.ts +++ b/apps/sim/lib/scim/application/users/read-users.ts @@ -11,8 +11,6 @@ import { projectResource, resolvePage, type ScimAttributeProjection, - type ScimUserResource, - toListResponse, toUserResource, } from '@/lib/scim/protocol/resources' import { @@ -29,12 +27,6 @@ export interface ListScimUsersInput { projection: ScimAttributeProjection } -export interface ListScimUsersResult { - resources: ScimUserResource[] - totalResults: number - startIndex: number -} - export const listScimUsers = defineAuthorizedScimUseCase({ operation: scimOperations.listUsers, async execute({ input, context }: ScimUseCaseArgs) { diff --git a/apps/sim/lib/scim/application/users/update-user.ts b/apps/sim/lib/scim/application/users/update-user.ts index d3237483b30..20cd7568bd5 100644 --- a/apps/sim/lib/scim/application/users/update-user.ts +++ b/apps/sim/lib/scim/application/users/update-user.ts @@ -1,8 +1,7 @@ import { AuditAction, AuditResourceType } from '@sim/audit' import { db } from '@sim/db' -import { type ScimUserAttributes, user } from '@sim/db/schema' +import type { ScimUserAttributes } from '@sim/db/schema' import { normalizeEmail } from '@sim/utils/string' -import { eq } from 'drizzle-orm' import type { ScimPatchOperation } from '@/lib/api/contracts/scim' import { acquireOrganizationUserMutationLocks } from '@/lib/billing/organizations/membership' import type { DbOrTx } from '@/lib/db/types' @@ -19,7 +18,8 @@ import { type ScimUseCaseContext, } from '@/lib/scim/application/authorized-scim-use-case' import { scimOperations } from '@/lib/scim/application/operations' -import { assertDomainOwned, assertEmailAvailable } from '@/lib/scim/identity/resolve-user' +import { syncAccountIdentityTx } from '@/lib/scim/identity/account-identity' +import { assertDomainOwned } from '@/lib/scim/identity/resolve-user' import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' import { primaryEmail } from '@/lib/scim/protocol/canonical' import { notFound, ScimError } from '@/lib/scim/protocol/errors' @@ -29,7 +29,6 @@ import { assertUserNameAvailable, findScimUserById, loadGroupsForScimUsers, - lockScimUserById, type ScimUserRecord, toUserResourceRow, updateScimUser, @@ -61,15 +60,6 @@ async function applyUserUpdate( const deactivated = current.active && !next.active const reactivated = !current.active && next.active - /** - * Taken first so the advisory locks always precede the `organization` row - * lock that a session revocation takes, in every path through this function. - */ - await acquireOrganizationUserMutationLocks(tx, { - userId: current.userId, - organizationIds: [context.organizationId], - }) - if (next.userName !== current.userName) { await assertUserNameAvailable(tx, context.connection.id, next.userName, current.id) } @@ -81,18 +71,11 @@ async function applyUserUpdate( * someone else's Sim account at a mailbox it controls and recover it. */ await assertDomainOwned(tx, context.organizationId, nextEmail) - await assertEmailAvailable(tx, nextEmail, current.userId) - await tx - .update(user) - .set({ - email: nextEmail, - normalizedEmail: normalizeEmail(nextEmail), - /** The new address is unproven until its owner acts on it. */ - emailVerified: false, - name: next.name.formatted, - updatedAt: new Date(), - }) - .where(eq(user.id, current.userId)) + await syncAccountIdentityTx(tx, { + userId: current.userId, + email: nextEmail, + name: next.name.formatted, + }) /** * An address change ends the sessions established under the old one. A @@ -106,10 +89,7 @@ async function applyUserUpdate( }) } } else if (next.name.formatted !== current.attributes.name.formatted) { - await tx - .update(user) - .set({ name: next.name.formatted, updatedAt: new Date() }) - .where(eq(user.id, current.userId)) + await syncAccountIdentityTx(tx, { userId: current.userId, name: next.name.formatted }) } if (deactivated) { @@ -145,6 +125,31 @@ export interface UpdateScimUserResult { resource: ReturnType } +/** + * Loads the stored resource under the organization and user advisory locks. + * + * The locks, not a row lock, serialize two concurrent PATCHes on one account: + * the record is read once to learn the user, locked, then read again so the + * patch is computed against the state the lock protects. A `FOR UPDATE` on the + * `scim_user` row would invert the documented order against projection writers, + * which take the advisory locks first and then touch rows referencing this one. + */ +async function loadUserForUpdate( + tx: DbOrTx, + context: ScimUseCaseContext, + scimUserId: string +): Promise { + const found = await findScimUserById(tx, context.connection.id, scimUserId) + if (!found) throw notFound('SCIM User not found') + await acquireOrganizationUserMutationLocks(tx, { + userId: found.userId, + organizationIds: [context.organizationId], + }) + const current = await findScimUserById(tx, context.connection.id, scimUserId) + if (!current) throw notFound('SCIM User not found') + return current +} + async function renderUpdated( connectionId: string, scimUserId: string, @@ -207,8 +212,7 @@ export const replaceScimUser = defineAuthorizedScimUseCase({ context, }: ScimUseCaseArgs): Promise { const { scimUserId, userId, outcome } = await db.transaction(async (tx) => { - const current = await lockScimUserById(tx, context.connection.id, input.scimUserId) - if (!current) throw notFound('SCIM User not found') + const current = await loadUserForUpdate(tx, context, input.scimUserId) /** * A replace keeps attributes Sim does not model that the directory sent on @@ -260,8 +264,7 @@ export const patchScimUser = defineAuthorizedScimUseCase({ context, }: ScimUseCaseArgs): Promise { const { scimUserId, userId, outcome } = await db.transaction(async (tx) => { - const current = await lockScimUserById(tx, context.connection.id, input.scimUserId) - if (!current) throw notFound('SCIM User not found') + const current = await loadUserForUpdate(tx, context, input.scimUserId) const { next, changed } = applyUserPatch(current.attributes, input.operations) diff --git a/apps/sim/lib/scim/authenticate.test.ts b/apps/sim/lib/scim/authenticate.test.ts new file mode 100644 index 00000000000..3ee9a995338 --- /dev/null +++ b/apps/sim/lib/scim/authenticate.test.ts @@ -0,0 +1,133 @@ +/** + * @vitest-environment node + */ +import { createHash } from 'node:crypto' +import { scimCredential } from '@sim/db/schema' +import { dbChainMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' +import type { NextRequest } from 'next/server' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' + +const { mockIsEntitled } = vi.hoisted(() => ({ mockIsEntitled: vi.fn() })) + +vi.mock('@/lib/billing/core/subscription', () => ({ + isOrganizationFeatureEntitled: mockIsEntitled, +})) + +import { authenticateScimRequest, generateScimToken } from '@/lib/scim/authenticate' +import { ScimError } from '@/lib/scim/protocol/errors' + +function requestWithToken(token?: string): NextRequest { + const headers = new Headers() + if (token !== undefined) headers.set('authorization', `Bearer ${token}`) + // double-cast-allowed: the authenticator reads only headers from the request + return { headers } as unknown as NextRequest +} + +function credentialRow(overrides: Record = {}) { + return { + credentialId: 'cred-1', + scopes: ['users:read', 'users:write'], + expiresAt: null, + revokedAt: null, + lastUsedAt: new Date(), + connectionId: 'conn-1', + organizationId: 'org-1', + status: 'active', + lastRequestAt: new Date(), + ...overrides, + } +} + +async function expectUnauthorized(request: NextRequest, detail?: string) { + const error = await authenticateScimRequest(request).catch((caught) => caught) + expect(error).toBeInstanceOf(ScimError) + expect(error.status).toBe(401) + expect(error.headers).toEqual({ 'WWW-Authenticate': 'Bearer realm="SCIM"' }) + if (detail) expect(error.message).toBe(detail) + else expect(error.message).toBe('Invalid SCIM credential') +} + +afterAll(resetDbChainMock) + +describe('generateScimToken', () => { + it('mints an identifiable secret and stores only its digest', () => { + const { secret, hash, prefix } = generateScimToken() + expect(secret.startsWith('sim_scim_')).toBe(true) + expect(secret.length).toBe('sim_scim_'.length + 40) + expect(hash).toBe(createHash('sha256').update(secret).digest('base64url')) + expect(prefix).toBe(secret.slice(0, 'sim_scim_'.length + 6)) + expect(generateScimToken().secret).not.toBe(secret) + }) +}) + +describe('authenticateScimRequest', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + mockIsEntitled.mockResolvedValue(true) + }) + + it('demands a bearer credential', async () => { + await expectUnauthorized(requestWithToken(), 'A bearer credential is required') + }) + + it('looks the credential up by digest, never by the secret', async () => { + queueTableRows(scimCredential, [credentialRow()]) + await authenticateScimRequest(requestWithToken('sim_scim_secret')) + const digest = createHash('sha256').update('sim_scim_secret').digest('base64url') + expect(dbChainMockFns.where).toHaveBeenCalledWith( + expect.objectContaining({ type: 'eq', right: digest }) + ) + }) + + it('resolves an active credential to a connection principal carrying its scopes', async () => { + queueTableRows(scimCredential, [credentialRow()]) + await expect(authenticateScimRequest(requestWithToken('sim_scim_secret'))).resolves.toEqual({ + kind: 'scim_connection', + organizationId: 'org-1', + connectionId: 'conn-1', + credentialId: 'cred-1', + scopes: ['users:read', 'users:write'], + }) + }) + + it.each([ + ['unknown', null], + ['revoked', credentialRow({ revokedAt: new Date() })], + ['expired', credentialRow({ expiresAt: new Date(Date.now() - 1) })], + ['disabled connection', credentialRow({ status: 'disabled' })], + ])( + 'refuses a %s credential with the same message as every other refusal', + async (_label, row) => { + queueTableRows(scimCredential, row ? [row] : []) + await expectUnauthorized(requestWithToken('sim_scim_secret')) + } + ) + + it('refuses a credential whose organization is no longer entitled', async () => { + queueTableRows(scimCredential, [credentialRow()]) + mockIsEntitled.mockResolvedValue(false) + await expectUnauthorized(requestWithToken('sim_scim_secret')) + expect(mockIsEntitled).toHaveBeenCalledWith('org-1', expect.anything()) + }) + + it('accepts a credential that expires in the future', async () => { + queueTableRows(scimCredential, [credentialRow({ expiresAt: new Date(Date.now() + 60_000) })]) + await expect( + authenticateScimRequest(requestWithToken('sim_scim_secret')) + ).resolves.toMatchObject({ + credentialId: 'cred-1', + }) + }) + + it('rewrites last-used timestamps only when they are stale', async () => { + queueTableRows(scimCredential, [credentialRow()]) + await authenticateScimRequest(requestWithToken('sim_scim_secret')) + expect(dbChainMockFns.update).not.toHaveBeenCalled() + + const stale = new Date(Date.now() - 10 * 60 * 1000) + queueTableRows(scimCredential, [credentialRow({ lastUsedAt: stale, lastRequestAt: stale })]) + await authenticateScimRequest(requestWithToken('sim_scim_secret')) + expect(dbChainMockFns.update).toHaveBeenCalledTimes(2) + }) +}) diff --git a/apps/sim/lib/scim/identity/account-identity.ts b/apps/sim/lib/scim/identity/account-identity.ts new file mode 100644 index 00000000000..7377e079a16 --- /dev/null +++ b/apps/sim/lib/scim/identity/account-identity.ts @@ -0,0 +1,37 @@ +import { user } from '@sim/db/schema' +import { normalizeEmail } from '@sim/utils/string' +import { eq } from 'drizzle-orm' +import type { DbOrTx } from '@/lib/db/types' +import { assertEmailAvailable } from '@/lib/scim/identity/resolve-user' + +/** + * Writes the directory's view of who a person is onto their Sim account. + * + * Shared by an attribute update and by relinking a recreated identity, so a + * rename that arrives as delete-and-recreate lands the same way as one that + * arrives as a PATCH. The caller has already proven the organization owns the + * new address's domain; this asserts nobody else holds it and applies it. + */ +export async function syncAccountIdentityTx( + tx: DbOrTx, + params: { userId: string; email?: string; name: string } +): Promise { + if (params.email !== undefined) { + await assertEmailAvailable(tx, params.email, params.userId) + } + await tx + .update(user) + .set({ + name: params.name, + ...(params.email !== undefined + ? { + email: params.email, + normalizedEmail: normalizeEmail(params.email), + /** The new address is unproven until its owner acts on it. */ + emailVerified: false, + } + : {}), + updatedAt: new Date(), + }) + .where(eq(user.id, params.userId)) +} diff --git a/apps/sim/lib/scim/identity/resolve-user.test.ts b/apps/sim/lib/scim/identity/resolve-user.test.ts new file mode 100644 index 00000000000..9e5c78dc05e --- /dev/null +++ b/apps/sim/lib/scim/identity/resolve-user.test.ts @@ -0,0 +1,140 @@ +/** + * @vitest-environment node + */ +import { db } from '@sim/db' +import { member, type ScimUserAttributes, scimUserTombstone, ssoDomain, user } from '@sim/db/schema' +import { dbChainMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' +import { assertEmailAvailable, resolveProvisionedIdentity } from '@/lib/scim/identity/resolve-user' +import { ScimError } from '@/lib/scim/protocol/errors' + +function attributes(overrides: Partial = {}): ScimUserAttributes { + return { + userName: 'ada@acme.com', + name: { formatted: 'Ada Lovelace' }, + emails: [{ value: 'ada@acme.com', primary: true }], + active: true, + ...overrides, + } +} + +const params = { connectionId: 'conn-1', organizationId: 'org-1' } + +async function expectScimError(promise: Promise, status: number, scimType: string) { + const error = await promise.catch((caught) => caught) + expect(error).toBeInstanceOf(ScimError) + expect(error.status).toBe(status) + expect(error.scimType).toBe(scimType) + return error as ScimError +} + +afterAll(resetDbChainMock) + +describe('resolveProvisionedIdentity', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + }) + + it('refuses every address when the organization has verified no domain', async () => { + queueTableRows(ssoDomain, []) + queueTableRows(scimUserTombstone, [{ userId: 'user-old' }]) + const error = await expectScimError( + resolveProvisionedIdentity(db, { ...params, attributes: attributes() }), + 400, + 'invalidValue' + ) + expect(error.message).toContain('no verified email domains') + }) + + it('refuses an address outside the verified domains before consulting any tombstone', async () => { + queueTableRows(ssoDomain, [{ domain: 'acme.com' }]) + queueTableRows(scimUserTombstone, [{ userId: 'user-old' }]) + const error = await expectScimError( + resolveProvisionedIdentity(db, { + ...params, + attributes: attributes({ + externalId: 'ext-1', + emails: [{ value: 'ada@evil.example', primary: true }], + }), + }), + 400, + 'invalidValue' + ) + expect(error.message).toContain('evil.example') + /** Only the domain read ran; the tombstone queue is untouched. */ + expect(dbChainMockFns.from).toHaveBeenCalledTimes(1) + expect(dbChainMockFns.from).toHaveBeenCalledWith(ssoDomain) + }) + + it('relinks through a tombstone left by this connection before looking at email', async () => { + queueTableRows(ssoDomain, [{ domain: 'ACME.com' }]) + queueTableRows(scimUserTombstone, [{ userId: 'user-old' }]) + queueTableRows(user, [{ id: 'user-other' }]) + await expect( + resolveProvisionedIdentity(db, { ...params, attributes: attributes({ externalId: 'ext-1' }) }) + ).resolves.toEqual({ action: 'link', userId: 'user-old', via: 'tombstone' }) + expect(dbChainMockFns.where).toHaveBeenCalledWith({ + type: 'and', + conditions: [ + { type: 'eq', left: scimUserTombstone.connectionId, right: 'conn-1' }, + { type: 'eq', left: scimUserTombstone.externalId, right: 'ext-1' }, + ], + }) + }) + + it('creates when nobody holds the address', async () => { + queueTableRows(ssoDomain, [{ domain: 'acme.com' }]) + queueTableRows(user, []) + await expect( + resolveProvisionedIdentity(db, { ...params, attributes: attributes() }) + ).resolves.toEqual({ action: 'create' }) + }) + + it('links an existing account in this organization or in none', async () => { + queueTableRows(ssoDomain, [{ domain: 'acme.com' }]) + queueTableRows(user, [{ id: 'user-1' }]) + queueTableRows(member, []) + await expect( + resolveProvisionedIdentity(db, { ...params, attributes: attributes() }) + ).resolves.toEqual({ action: 'link', userId: 'user-1', via: 'verified-domain' }) + + queueTableRows(ssoDomain, [{ domain: 'acme.com' }]) + queueTableRows(user, [{ id: 'user-1' }]) + queueTableRows(member, [{ organizationId: 'org-1' }]) + await expect( + resolveProvisionedIdentity(db, { ...params, attributes: attributes() }) + ).resolves.toEqual({ action: 'link', userId: 'user-1', via: 'verified-domain' }) + }) + + it('reports an account committed to another organization as a uniqueness conflict', async () => { + queueTableRows(ssoDomain, [{ domain: 'acme.com' }]) + queueTableRows(user, [{ id: 'user-1' }]) + queueTableRows(member, [{ organizationId: 'org-2' }]) + const error = await expectScimError( + resolveProvisionedIdentity(db, { ...params, attributes: attributes() }), + 409, + 'uniqueness' + ) + expect(error.message).toContain('different organization') + }) +}) + +describe('assertEmailAvailable', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + }) + + it('allows the address when it is free or already the same account', async () => { + queueTableRows(user, []) + await expect(assertEmailAvailable(db, 'ada@acme.com')).resolves.toBeUndefined() + queueTableRows(user, [{ id: 'user-1' }]) + await expect(assertEmailAvailable(db, 'ada@acme.com', 'user-1')).resolves.toBeUndefined() + }) + + it('refuses an address another account holds', async () => { + queueTableRows(user, [{ id: 'user-2' }]) + await expectScimError(assertEmailAvailable(db, 'ada@acme.com', 'user-1'), 409, 'uniqueness') + }) +}) diff --git a/apps/sim/lib/scim/managed-membership.ts b/apps/sim/lib/scim/managed-membership.ts index a3cad521d12..5e8c8aecd47 100644 --- a/apps/sim/lib/scim/managed-membership.ts +++ b/apps/sim/lib/scim/managed-membership.ts @@ -1,7 +1,8 @@ import { db } from '@sim/db' import { scimConnection, scimUser } from '@sim/db/schema' -import { type AnyColumn, and, eq, type SQL, sql } from 'drizzle-orm' +import { type AnyColumn, type SQL, sql } from 'drizzle-orm' import { ForbiddenOperationError } from '@/lib/core/application' +import { isScimEnabled } from '@/lib/core/config/env-flags' import type { DbOrTx } from '@/lib/db/types' /** @@ -17,14 +18,6 @@ import type { DbOrTx } from '@/lib/db/types' * able to remove someone in an emergency, whatever the directory believes. */ -type ManagedMembershipAction = 'invite' | 'change-role' | 'workspace-grant' - -const ACTION_WORDING: Record = { - invite: 'Inviting a member', - 'change-role': 'Changing a member’s role', - 'workspace-grant': 'Granting workspace access', -} - /** * A SQL predicate that is true when the given user is provisioned by THIS * organization's active directory connection and that connection has locked @@ -59,16 +52,20 @@ export function scimManagedUserPredicate( export async function assertMembershipNotScimManaged(params: { organizationId: string userId: string - action: ManagedMembershipAction executor?: DbOrTx }): Promise { + /** + * A deployment or plan that no longer has directory provisioning must not keep + * refusing manual changes on behalf of a directory that can no longer sync. + */ + if (!isScimEnabled) return const [row] = await (params.executor ?? db) .select({ managed: scimManagedUserPredicate(params.organizationId, sql`${params.userId}`) }) .from(sql`(select 1) as probe`) if (!row?.managed) return throw new ForbiddenOperationError( 'SCIM_MANAGED_MEMBERSHIP', - `${ACTION_WORDING[params.action]} is managed by this organization’s identity provider. Make the change there, or turn off managed-membership locking in the organization’s directory settings.` + 'This member is managed by the organization’s identity provider. Make the change there, or turn off managed-membership locking in the organization’s directory settings.' ) } diff --git a/apps/sim/lib/scim/projection/grants.test.ts b/apps/sim/lib/scim/projection/grants.test.ts new file mode 100644 index 00000000000..7452c3f3454 --- /dev/null +++ b/apps/sim/lib/scim/projection/grants.test.ts @@ -0,0 +1,158 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { + type MappingRow, + type ProjectionGrant, + planGrantChanges, + resolveDesiredGrants, +} from '@/lib/scim/projection/grants' + +function workspaceRow(workspaceId: string, permissionType: 'admin' | 'write' | 'read'): MappingRow { + return { + targetKind: 'workspace', + workspaceId, + permissionType, + permissionGroupId: null, + role: null, + } +} + +describe('resolveDesiredGrants', () => { + it('keeps the stronger level when two groups grant the same workspace', () => { + const desired = resolveDesiredGrants([ + workspaceRow('ws-1', 'read'), + workspaceRow('ws-1', 'admin'), + ]) + expect(desired).toEqual([ + { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'admin' }, + ]) + }) + + it('does not lower a level a later row asks for less of', () => { + const desired = resolveDesiredGrants([ + workspaceRow('ws-1', 'write'), + workspaceRow('ws-1', 'read'), + ]) + expect(desired[0].permissionType).toBe('write') + }) + + it('lets a group raise a connection default', () => { + const desired = resolveDesiredGrants( + [workspaceRow('ws-1', 'write')], + [{ workspaceId: 'ws-1', permission: 'read' }] + ) + expect(desired).toEqual([ + { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'write' }, + ]) + }) + + it('keeps a connection default the groups do not mention', () => { + const desired = resolveDesiredGrants([], [{ workspaceId: 'ws-1', permission: 'read' }]) + expect(desired).toEqual([{ targetKind: 'workspace', targetId: 'ws-1', permissionType: 'read' }]) + }) + + it('emits one grant per permission group and per role however many groups repeat them', () => { + const rows: MappingRow[] = [ + { + targetKind: 'permission_group', + permissionGroupId: 'pg-1', + workspaceId: null, + permissionType: null, + role: null, + }, + { + targetKind: 'permission_group', + permissionGroupId: 'pg-1', + workspaceId: null, + permissionType: null, + role: null, + }, + { + targetKind: 'org_role', + permissionGroupId: null, + workspaceId: null, + permissionType: null, + role: 'admin', + }, + { + targetKind: 'org_role', + permissionGroupId: null, + workspaceId: null, + permissionType: null, + role: 'admin', + }, + ] + expect(resolveDesiredGrants(rows)).toEqual([ + { targetKind: 'permission_group', targetId: 'pg-1' }, + { targetKind: 'org_role', targetId: 'admin' }, + ]) + }) + + it('drops rows whose target column is missing', () => { + const rows: MappingRow[] = [ + { + targetKind: 'workspace', + workspaceId: 'ws-1', + permissionType: null, + permissionGroupId: null, + role: null, + }, + { + targetKind: 'permission_group', + permissionGroupId: null, + workspaceId: null, + permissionType: null, + role: null, + }, + { + targetKind: 'something_else', + permissionGroupId: 'x', + workspaceId: 'y', + permissionType: 'admin', + role: 'admin', + }, + ] + expect(resolveDesiredGrants(rows)).toEqual([]) + }) +}) + +describe('planGrantChanges', () => { + const workspace = ( + targetId: string, + permissionType: 'admin' | 'write' | 'read' + ): ProjectionGrant => ({ + targetKind: 'workspace', + targetId, + permissionType, + }) + + it('plans nothing when desired and current agree, which is what makes a reconcile idempotent', () => { + const grants = [ + workspace('ws-1', 'write'), + { targetKind: 'permission_group' as const, targetId: 'pg-1' }, + ] + expect(planGrantChanges(grants, [...grants].reverse())).toEqual({ withdraw: [], apply: [] }) + }) + + it('withdraws what is no longer desired and applies what is new', () => { + const plan = planGrantChanges([workspace('ws-2', 'read')], [workspace('ws-1', 'read')]) + expect(plan.withdraw).toEqual([workspace('ws-1', 'read')]) + expect(plan.apply).toEqual([{ grant: workspace('ws-2', 'read') }]) + }) + + it('carries the previous level when a workspace changes level in either direction', () => { + expect( + planGrantChanges([workspace('ws-1', 'admin')], [workspace('ws-1', 'read')]).apply + ).toEqual([{ grant: workspace('ws-1', 'admin'), previousPermission: 'read' }]) + expect( + planGrantChanges([workspace('ws-1', 'read')], [workspace('ws-1', 'admin')]).apply + ).toEqual([{ grant: workspace('ws-1', 'read'), previousPermission: 'admin' }]) + }) + + it('never withdraws a grant that is also desired at a different level', () => { + const plan = planGrantChanges([workspace('ws-1', 'read')], [workspace('ws-1', 'admin')]) + expect(plan.withdraw).toEqual([]) + }) +}) diff --git a/apps/sim/lib/scim/projection/grants.ts b/apps/sim/lib/scim/projection/grants.ts new file mode 100644 index 00000000000..f210a6fc493 --- /dev/null +++ b/apps/sim/lib/scim/projection/grants.ts @@ -0,0 +1,135 @@ +import type { PermissionType } from '@sim/platform-authz/workspace' +import { permissionRank } from '@/lib/workspaces/access/workspace-access' + +/** + * The pure half of projection: what a user's mappings entitle them to, and how + * that differs from what the directory granted before. No database here, so the + * rules that decide access can be tested exhaustively without one. + */ + +export type ProjectionTargetKind = 'permission_group' | 'workspace' | 'org_role' + +export interface ProjectionGrant { + targetKind: ProjectionTargetKind + targetId: string + permissionType?: PermissionType +} + +/** One `scim_group_mapping` row the user reaches through a group they belong to. */ +export interface MappingRow { + targetKind: string + permissionGroupId: string | null + workspaceId: string | null + permissionType: PermissionType | null + role: string | null +} + +export interface DefaultWorkspaceGrant { + workspaceId: string + permission: PermissionType +} + +function grantKey(grant: ProjectionGrant): string { + return `${grant.targetKind}:${grant.targetId}` +} + +/** + * Collapses mapping rows and connection defaults into one grant per target. + * + * Two groups granting the same workspace resolve to the stronger level, and a + * connection default is treated like any other mapping so a group can raise it. + * Rows whose target column is missing describe nothing and are dropped. + */ +export function resolveDesiredGrants( + rows: readonly MappingRow[], + defaults: readonly DefaultWorkspaceGrant[] = [] +): ProjectionGrant[] { + const byKey = new Map() + + const offer = (grant: ProjectionGrant) => { + const key = grantKey(grant) + const existing = byKey.get(key) + if ( + !existing || + !existing.permissionType || + !grant.permissionType || + permissionRank(grant.permissionType) > permissionRank(existing.permissionType) + ) { + byKey.set(key, grant) + } + } + + for (const grant of defaults) { + offer({ + targetKind: 'workspace', + targetId: grant.workspaceId, + permissionType: grant.permission, + }) + } + + for (const row of rows) { + if (row.targetKind === 'permission_group' && row.permissionGroupId) { + offer({ targetKind: 'permission_group', targetId: row.permissionGroupId }) + } else if (row.targetKind === 'workspace' && row.workspaceId && row.permissionType) { + offer({ + targetKind: 'workspace', + targetId: row.workspaceId, + permissionType: row.permissionType, + }) + } else if (row.targetKind === 'org_role' && row.role) { + offer({ targetKind: 'org_role', targetId: row.role }) + } + } + + return [...byKey.values()] +} + +export interface GrantApplication { + grant: ProjectionGrant + /** The level a previous pass set on a workspace, present when the level changes. */ + previousPermission?: PermissionType +} + +export interface GrantPlan { + /** Grants the directory made that no mapping asks for any more. */ + withdraw: ProjectionGrant[] + /** Grants to make or re-level, in desired order. */ + apply: GrantApplication[] +} + +/** + * Diffs the desired set against what the directory previously granted. + * + * Only differences are returned, which is what makes a reconcile pass + * idempotent: identical inputs plan nothing. A workspace already granted at a + * different level is planned as an application carrying the previous level, so + * the executor can lower as well as raise. + */ +export function planGrantChanges( + desired: readonly ProjectionGrant[], + current: readonly ProjectionGrant[] +): GrantPlan { + const desiredByKey = new Map(desired.map((grant) => [grantKey(grant), grant])) + const currentByKey = new Map(current.map((grant) => [grantKey(grant), grant])) + + const withdraw: ProjectionGrant[] = [] + for (const [key, grant] of currentByKey) { + if (!desiredByKey.has(key)) withdraw.push(grant) + } + + const apply: GrantApplication[] = [] + for (const [key, grant] of desiredByKey) { + const existing = currentByKey.get(key) + if (!existing) { + apply.push({ grant }) + continue + } + const levelChanged = + grant.permissionType !== undefined && + existing.permissionType !== undefined && + grant.permissionType !== existing.permissionType + if (levelChanged) apply.push({ grant, previousPermission: existing.permissionType }) + } + + return { withdraw, apply } +} diff --git a/apps/sim/lib/scim/projection/reconcile-user.ts b/apps/sim/lib/scim/projection/reconcile-user.ts index c6d53304856..724856b160c 100644 --- a/apps/sim/lib/scim/projection/reconcile-user.ts +++ b/apps/sim/lib/scim/projection/reconcile-user.ts @@ -11,6 +11,7 @@ import type { PermissionType } from '@sim/platform-authz/workspace' import { generateId } from '@sim/utils/id' import { and, eq } from 'drizzle-orm' import { acquireOrganizationUserMutationLocks } from '@/lib/billing/organizations/membership' +import { OrchestrationError } from '@/lib/core/orchestration/types' import type { DbOrTx } from '@/lib/db/types' import { changeMemberRoleTx } from '@/lib/organizations/members/lifecycle' import { @@ -19,6 +20,13 @@ import { PermissionGroupScopeConflictError, removePermissionGroupMemberTx, } from '@/lib/permission-groups/application/group-membership' +import { + type MappingRow, + type ProjectionGrant, + type ProjectionTargetKind, + planGrantChanges, + resolveDesiredGrants, +} from '@/lib/scim/projection/grants' import { grantWorkspaceAccessTx, lowerWorkspaceAccessTx, @@ -43,14 +51,6 @@ const logger = createLogger('ScimProjection') * administrator granted by hand. */ -export type ProjectionTargetKind = 'permission_group' | 'workspace' | 'org_role' - -export interface ProjectionGrant { - targetKind: ProjectionTargetKind - targetId: string - permissionType?: PermissionType -} - export interface ProjectionDelta { added: ProjectionGrant[] removed: ProjectionGrant[] @@ -60,12 +60,8 @@ export interface ProjectionDelta { const EMPTY_DELTA: ProjectionDelta = { added: [], removed: [], raised: [] } -function grantKey(grant: ProjectionGrant): string { - return `${grant.targetKind}:${grant.targetId}` -} - /** - * What this user's group mappings entitle them to. + * The mapping rows this user reaches through their groups. * * Deliberately independent of whether the user is active. A deactivation blocks * sign-in and API keys through suspension; it does not withdraw grants, because @@ -73,11 +69,8 @@ function grantKey(grant: ProjectionGrant): string { * and that cannot be undone by reactivating them. Grants change only when group * membership or mappings change, or when the user is deprovisioned outright. */ -async function desiredGrants( - tx: DbOrTx, - params: { scimUserId: string; settings: ScimConnectionSettings } -): Promise { - const rows = await tx +async function loadMappingRows(tx: DbOrTx, scimUserId: string): Promise { + return tx .select({ targetKind: scimGroupMapping.targetKind, permissionGroupId: scimGroupMapping.permissionGroupId, @@ -87,51 +80,7 @@ async function desiredGrants( }) .from(scimGroupMember) .innerJoin(scimGroupMapping, eq(scimGroupMapping.groupId, scimGroupMember.groupId)) - .where(eq(scimGroupMember.scimUserId, params.scimUserId)) - - const byKey = new Map() - - for (const grant of params.settings.defaultWorkspaceGrants ?? []) { - const entry: ProjectionGrant = { - targetKind: 'workspace', - targetId: grant.workspaceId, - permissionType: grant.permission, - } - byKey.set(grantKey(entry), entry) - } - - for (const row of rows) { - if (row.targetKind === 'permission_group' && row.permissionGroupId) { - const entry: ProjectionGrant = { - targetKind: 'permission_group', - targetId: row.permissionGroupId, - } - byKey.set(grantKey(entry), entry) - continue - } - if (row.targetKind === 'workspace' && row.workspaceId && row.permissionType) { - const entry: ProjectionGrant = { - targetKind: 'workspace', - targetId: row.workspaceId, - permissionType: row.permissionType, - } - const existing = byKey.get(grantKey(entry)) - /** Two groups granting the same workspace resolve to the stronger one. */ - if ( - !existing?.permissionType || - permissionRank(row.permissionType) > permissionRank(existing.permissionType) - ) { - byKey.set(grantKey(entry), entry) - } - continue - } - if (row.targetKind === 'org_role' && row.role) { - const entry: ProjectionGrant = { targetKind: 'org_role', targetId: row.role } - byKey.set(grantKey(entry), entry) - } - } - - return [...byKey.values()] + .where(eq(scimGroupMember.scimUserId, scimUserId)) } async function currentGrants(tx: DbOrTx, scimUserId: string): Promise { @@ -188,12 +137,7 @@ async function applyGrant( return true case 'org_role': if (grant.targetId !== 'admin') return false - await changeMemberRoleTx(tx, { - organizationId: params.organizationId, - userId: params.userId, - role: 'admin', - }) - return true + return setOrganizationRole(tx, params.organizationId, params.userId, 'admin') case 'permission_group': await addPermissionGroupMemberTx(tx, { organizationId: params.organizationId, @@ -206,6 +150,44 @@ async function applyGrant( } } +/** + * Sets a member's organization role on the directory's behalf. + * + * The owner is out of the directory's reach: ownership carries billing and the + * last-owner guarantee, and a group that happens to contain the owner must not + * fail every sync over it. Returns false, and records no grant, so the mapping + * is simply inert for that one person. + */ +async function setOrganizationRole( + tx: DbOrTx, + organizationId: string, + userId: string, + role: 'admin' | 'member' +): Promise { + try { + await changeMemberRoleTx(tx, { organizationId, userId, role }) + return true + } catch (error) { + if (error instanceof OrchestrationError && error.code === 'conflict') { + logger.warn('Skipped an organization role mapping for the owner', { organizationId, userId }) + return false + } + if (error instanceof OrchestrationError && error.code === 'not_found') { + logger.warn('Skipped an organization role mapping for a user who is no longer a member', { + organizationId, + userId, + }) + return false + } + throw error + } +} + +/** + * Withdraws one grant. Returns false when the grant must stay in place — the + * access could not be handed on — so the provenance row survives and the next + * pass retries instead of forgetting. + */ async function withdrawGrant( tx: DbOrTx, params: { @@ -214,7 +196,7 @@ async function withdrawGrant( grant: ProjectionGrant lockManualMembership: boolean } -): Promise { +): Promise { const { grant } = params switch (grant.targetKind) { case 'workspace': { @@ -228,35 +210,32 @@ async function withdrawGrant( workspaceId: grant.targetId, userId: params.userId, }) - if (!current) return + if (!current) return true if ( !params.lockManualMembership && grant.permissionType && permissionRank(current) > permissionRank(grant.permissionType) ) { - return + return true } const outcome = await revokeWorkspaceAccessTx(tx, { workspaceId: grant.targetId, userId: params.userId, }) - if (!outcome.revoked && outcome.unresolvedWorkflows.length > 0) { - logger.warn('Left workspace access in place: workflow ownership could not be reassigned', { + if (!outcome.revoked) { + logger.warn('Left workspace access in place: ownership could not be handed on', { workspaceId: grant.targetId, userId: params.userId, - unresolved: outcome.unresolvedWorkflows.length, + reason: outcome.reason, }) + return false } - return + return true } case 'org_role': - if (grant.targetId !== 'admin') return - await changeMemberRoleTx(tx, { - organizationId: params.organizationId, - userId: params.userId, - role: 'member', - }) - return + if (grant.targetId !== 'admin') return true + await setOrganizationRole(tx, params.organizationId, params.userId, 'member') + return true case 'permission_group': try { await removePermissionGroupMemberTx(tx, { @@ -273,6 +252,7 @@ async function withdrawGrant( */ if (!(error instanceof PermissionGroupNotFoundError)) throw error } + return true } } @@ -312,27 +292,24 @@ export async function reconcileUserProjection( organizationIds: [params.organizationId], }) - const desired = await desiredGrants(tx, { - scimUserId: params.scimUserId, - settings: params.settings, - }) - const current = await currentGrants(tx, params.scimUserId) - - const desiredByKey = new Map(desired.map((grant) => [grantKey(grant), grant])) - const currentByKey = new Map(current.map((grant) => [grantKey(grant), grant])) + const desired = resolveDesiredGrants( + await loadMappingRows(tx, params.scimUserId), + params.settings.defaultWorkspaceGrants ?? [] + ) + const plan = planGrantChanges(desired, await currentGrants(tx, params.scimUserId)) const delta: ProjectionDelta = { added: [], removed: [], raised: [] } const lockManualMembership = params.settings.lockManualMembership === true /** Withdrawals first, so a move between groups frees its workspace slot. */ - for (const [key, grant] of currentByKey) { - if (desiredByKey.has(key)) continue - await withdrawGrant(tx, { + for (const grant of plan.withdraw) { + const withdrawn = await withdrawGrant(tx, { organizationId: params.organizationId, userId: record.userId, grant, lockManualMembership, }) + if (!withdrawn) continue await tx .delete(scimProjectionGrant) .where( @@ -345,23 +322,14 @@ export async function reconcileUserProjection( delta.removed.push(grant) } - for (const [key, grant] of desiredByKey) { - const existing = currentByKey.get(key) - const levelChanged = - existing !== undefined && - grant.permissionType !== undefined && - existing.permissionType !== undefined && - grant.permissionType !== existing.permissionType - - if (existing && !levelChanged) continue - + for (const { grant, previousPermission } of plan.apply) { let applied: boolean try { applied = await applyGrant(tx, { organizationId: params.organizationId, userId: record.userId, grant, - ...(existing?.permissionType ? { previousPermission: existing.permissionType } : {}), + ...(previousPermission ? { previousPermission } : {}), }) } catch (error) { /** @@ -412,7 +380,7 @@ export async function reconcileUserProjection( set: { permissionType: grant.permissionType ?? null, updatedAt: new Date() }, }) - if (levelChanged) delta.raised.push(grant) + if (previousPermission) delta.raised.push(grant) else delta.added.push(grant) } diff --git a/apps/sim/lib/scim/protocol/canonical.ts b/apps/sim/lib/scim/protocol/canonical.ts index 91d747906ca..7332bde23e2 100644 --- a/apps/sim/lib/scim/protocol/canonical.ts +++ b/apps/sim/lib/scim/protocol/canonical.ts @@ -119,11 +119,50 @@ export function toCanonicalUser(body: ScimUserWriteParsed): ScimUserAttributes { displayName: trimmed(body.displayName) ?? name.formatted, name, emails, - ...(enterprise ? { enterprise: enterprise as ScimUserAttributes['enterprise'] } : {}), + ...(isRecord(enterprise) ? { enterprise: normalizeEnterprise(enterprise) } : {}), ...(extra ? { extra } : {}), } } +type EnterpriseAttributes = NonNullable + +const ENTERPRISE_STRING_FIELDS = [ + 'department', + 'employeeNumber', + 'costCenter', + 'division', + 'organization', +] as const + +/** + * The enterprise extension as stored. The write contract accepts `manager` as + * either an identifier string or an object, so the string form is normalized + * here rather than trusted to match the stored shape. + */ +function normalizeEnterprise(value: Record): EnterpriseAttributes { + const text = (candidate: unknown) => + typeof candidate === 'string' ? trimmed(candidate) : undefined + const enterprise: EnterpriseAttributes = {} + for (const field of ENTERPRISE_STRING_FIELDS) { + const candidate = text(value[field]) + if (candidate) enterprise[field] = candidate + } + const manager = value.manager + if (typeof manager === 'string' && manager.trim()) { + enterprise.manager = { value: manager.trim() } + } else if (isRecord(manager)) { + const managerValue = text(manager.value) + const displayName = text(manager.displayName) + if (managerValue || displayName) { + enterprise.manager = { + ...(managerValue ? { value: managerValue } : {}), + ...(displayName ? { displayName } : {}), + } + } + } + return enterprise +} + /** The primary address of a canonical resource. */ export function primaryEmail(attributes: ScimUserAttributes): string { return (attributes.emails.find((entry) => entry.primary) ?? attributes.emails[0]).value diff --git a/apps/sim/lib/scim/protocol/errors.ts b/apps/sim/lib/scim/protocol/errors.ts index 2a48f5c358f..22bf45d2421 100644 --- a/apps/sim/lib/scim/protocol/errors.ts +++ b/apps/sim/lib/scim/protocol/errors.ts @@ -148,8 +148,9 @@ export function toScimError(error: unknown): ScimError { switch (error.code) { case 'not_found': return new ScimError(404, undefined, error.message) + /** A conflict that is not a duplicate carries no `scimType`; `uniqueness` is reserved for duplicates. */ case 'conflict': - return new ScimError(409, 'uniqueness', error.message) + return new ScimError(409, undefined, error.message) case 'forbidden': return new ScimError(403, undefined, error.message) case 'validation': diff --git a/apps/sim/lib/scim/protocol/group-patch.ts b/apps/sim/lib/scim/protocol/group-patch.ts index 46b57e9a4ca..9acf2ae520e 100644 --- a/apps/sim/lib/scim/protocol/group-patch.ts +++ b/apps/sim/lib/scim/protocol/group-patch.ts @@ -81,6 +81,11 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou } else if (key === 'members') { applyFullMembers(readMemberList(nested)) } else if (key === 'id' || key === 'schemas' || key.startsWith('meta')) { + /** + * Okta echoes the group's `id` inside a path-less rename. Read-only + * attributes sent this way are ignored rather than refused, because + * refusing would fail every Okta group rename. + */ } else { throw invalidPath(`Group PATCH path ${attribute} is not supported`) } diff --git a/apps/sim/lib/scim/protocol/normalize.ts b/apps/sim/lib/scim/protocol/normalize.ts index 674bddd20a0..8c72b8d7b70 100644 --- a/apps/sim/lib/scim/protocol/normalize.ts +++ b/apps/sim/lib/scim/protocol/normalize.ts @@ -54,8 +54,7 @@ export function normalizeAttributePath(path: string): string { try { value = decodeURIComponent(value) } catch { - // A path that is not valid percent-encoding is used as written; the caller's - // closed path table rejects it with `invalidPath` either way. + /** Invalid percent-encoding is used as written; the closed path table rejects it as `invalidPath`. */ } const lowered = value.toLowerCase() const coreUserPrefix = 'urn:ietf:params:scim:schemas:core:2.0:user:' @@ -66,6 +65,7 @@ export function normalizeAttributePath(path: string): string { if (lowered.startsWith(enterprisePrefix)) { return `enterprise.${value.slice(enterprisePrefix.length)}` } + if (lowered === enterprisePrefix.slice(0, -1)) return 'enterprise' return value } diff --git a/apps/sim/lib/scim/protocol/resources.test.ts b/apps/sim/lib/scim/protocol/resources.test.ts index 22dd30cd547..66ea9159379 100644 --- a/apps/sim/lib/scim/protocol/resources.test.ts +++ b/apps/sim/lib/scim/protocol/resources.test.ts @@ -2,6 +2,7 @@ * @vitest-environment node */ import { describe, expect, it } from 'vitest' +import { scimUserResourceSchema } from '@/lib/api/contracts/scim' import { SCIM_MAX_PAGE_SIZE } from '@/lib/scim/protocol/constants' import type { ScimError } from '@/lib/scim/protocol/errors' import { @@ -95,6 +96,17 @@ describe('toUserResource', () => { }) describe('attribute projection', () => { + it('keeps a projected resource valid against the response contract', () => { + const excluded = parseAttributeProjection({ excludedAttributes: 'groups,emails' }) + const projected = projectResource(toUserResource(userRow(), BASE_URL), excluded) + expect(() => scimUserResourceSchema.parse(projected)).not.toThrow() + + const only = parseAttributeProjection({ attributes: 'userName' }) + const narrow = projectResource(toUserResource(userRow(), BASE_URL), only) + expect(() => scimUserResourceSchema.parse(narrow)).not.toThrow() + expect(narrow).not.toHaveProperty('emails') + }) + it('honours the members exclusion Entra sends on every group list', () => { const projection = parseAttributeProjection({ excludedAttributes: 'members' }) expect(projectionWants(projection, 'members')).toBe(false) diff --git a/apps/sim/lib/scim/protocol/user-patch.test.ts b/apps/sim/lib/scim/protocol/user-patch.test.ts index e058e4f41bb..859378a670e 100644 --- a/apps/sim/lib/scim/protocol/user-patch.test.ts +++ b/apps/sim/lib/scim/protocol/user-patch.test.ts @@ -139,6 +139,37 @@ describe('applyUserPatch', () => { expect(next.enterprise?.manager).toBeUndefined() }) + it('adds a secondary email without stealing the primary', () => { + const { next } = applyUserPatch( + baseUser(), + parseOperations([ + { op: 'add', path: 'emails', value: [{ value: 'ada@home.test', type: 'home' }] }, + ]) + ) + expect(next.emails).toEqual([ + { value: 'ada@acme.test', type: 'work', primary: true }, + { value: 'ada@home.test', type: 'home', primary: false }, + ]) + }) + + it('applies RFC 7644 canonical nesting in a path-less replace', () => { + const { next } = applyUserPatch( + baseUser(), + parseOperations([ + { + op: 'replace', + value: { + name: { givenName: 'Augusta' }, + 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User': { department: 'Maths' }, + }, + }, + ]) + ) + expect(next.name.givenName).toBe('Augusta') + expect(next.name.formatted).toBe('Augusta Lovelace') + expect(next.enterprise?.department).toBe('Maths') + }) + it('reports no change when a patch re-sends what is already stored', () => { const { changed } = applyUserPatch( baseUser(), diff --git a/apps/sim/lib/scim/protocol/user-patch.ts b/apps/sim/lib/scim/protocol/user-patch.ts index 85bc73d383a..393b1e7ba74 100644 --- a/apps/sim/lib/scim/protocol/user-patch.ts +++ b/apps/sim/lib/scim/protocol/user-patch.ts @@ -84,7 +84,11 @@ function removeTypedEmail(user: ScimUserAttributes, type: string): void { user.emails = remaining } -function normalizeEmailList(value: unknown, attribute: string): ScimUserEmail[] { +function normalizeEmailList( + value: unknown, + attribute: string, + options: { defaultPrimary: boolean } +): ScimUserEmail[] { const entries = Array.isArray(value) ? value : [value] const normalized: ScimUserEmail[] = [] for (const entry of entries) { @@ -97,7 +101,10 @@ function normalizeEmailList(value: unknown, attribute: string): ScimUserEmail[] }) } if (normalized.length === 0) throw invalidValue(`${attribute} must not be empty`) - if (!normalized.some((entry) => entry.primary)) normalized[0].primary = true + /** A whole list needs a primary; an added address stays secondary unless it says otherwise. */ + if (options.defaultPrimary && !normalized.some((entry) => entry.primary)) { + normalized[0].primary = true + } return normalized } @@ -169,10 +176,10 @@ function applyOperation( case 'emails': if (op === 'remove') throw invalidValue('emails cannot be removed') if (op === 'replace') { - user.emails = normalizeEmailList(value, 'emails') + user.emails = normalizeEmailList(value, 'emails', { defaultPrimary: true }) return } - for (const entry of normalizeEmailList(value, 'emails')) { + for (const entry of normalizeEmailList(value, 'emails', { defaultPrimary: false })) { const existing = user.emails.find((candidate) => candidate.value === entry.value) if (existing) { if (entry.primary) { @@ -301,6 +308,18 @@ export function applyUserPatch( * arrived as its own operation. */ for (const [attribute, nested] of Object.entries(value)) { + /** + * RFC 7644's canonical form nests complex attributes — `{"name": {"givenName": …}}` + * and the enterprise extension keyed by its URN — so each sub-attribute is + * dispatched by its dotted path. + */ + const normalized = normalizeAttributePath(attribute).toLowerCase() + if (isRecord(nested) && (normalized === 'name' || normalized === 'enterprise')) { + for (const [sub, subValue] of Object.entries(nested)) { + applyOperation(next, operation.op, `${normalized}.${sub}`, subValue) + } + continue + } applyOperation(next, operation.op, attribute, nested) } continue diff --git a/apps/sim/lib/scim/repository/groups.ts b/apps/sim/lib/scim/repository/groups.ts index 5356419a88f..a38bb5fbc10 100644 --- a/apps/sim/lib/scim/repository/groups.ts +++ b/apps/sim/lib/scim/repository/groups.ts @@ -99,6 +99,31 @@ export async function loadGroupMembers(tx: DbOrTx, groupId: string): Promise> { + const byGroup = new Map() + if (groupIds.length === 0) return byGroup + const rows = await tx + .select({ + groupId: scimGroupMember.groupId, + scimUserId: scimGroupMember.scimUserId, + displayName: scimUser.userName, + }) + .from(scimGroupMember) + .innerJoin(scimUser, eq(scimUser.id, scimGroupMember.scimUserId)) + .where(inArray(scimGroupMember.groupId, groupIds)) + .orderBy(asc(scimGroupMember.createdAt), asc(scimGroupMember.scimUserId)) + for (const row of rows) { + const list = byGroup.get(row.groupId) ?? [] + list.push({ scimUserId: row.scimUserId, displayName: row.displayName }) + byGroup.set(row.groupId, list) + } + return byGroup +} + export async function loadGroupMemberIds(tx: DbOrTx, groupId: string): Promise { const rows = await tx .select({ scimUserId: scimGroupMember.scimUserId }) diff --git a/apps/sim/lib/scim/repository/users.ts b/apps/sim/lib/scim/repository/users.ts index b71d04a769f..604786078de 100644 --- a/apps/sim/lib/scim/repository/users.ts +++ b/apps/sim/lib/scim/repository/users.ts @@ -133,29 +133,6 @@ export async function findScimUserById( return row ?? null } -/** - * The same lookup, holding the row for the rest of the transaction. - * - * A write path reads the stored resource, computes the next one in memory, and - * writes it back. Two concurrent PATCHes — which Microsoft Entra pipelines - * routinely — would otherwise both read the same base and the second would - * overwrite the first's whole attribute document. - */ -export async function lockScimUserById( - tx: DbOrTx, - connectionId: string, - scimUserId: string -): Promise { - const [row] = await tx - .select(USER_SELECTION) - .from(scimUser) - .innerJoin(user, eq(user.id, scimUser.userId)) - .where(and(eq(scimUser.connectionId, connectionId), eq(scimUser.id, scimUserId))) - .limit(1) - .for('update', { of: scimUser }) - return row ?? null -} - export async function findScimUserByUserId( tx: DbOrTx, connectionId: string, diff --git a/apps/sim/lib/workspaces/access/workspace-access.ts b/apps/sim/lib/workspaces/access/workspace-access.ts index 2996a9b681d..690458aaab0 100644 --- a/apps/sim/lib/workspaces/access/workspace-access.ts +++ b/apps/sim/lib/workspaces/access/workspace-access.ts @@ -5,7 +5,11 @@ import { and, eq } from 'drizzle-orm' import { revokeWorkspaceCredentialMembershipsTx } from '@/lib/credentials/access' import type { DbOrTx } from '@/lib/db/types' import { removeWorkspaceSkillMembershipsTx } from '@/lib/skills/access' -import { reassignWorkflowOwnershipForWorkspaceMemberRemovalTx } from '@/lib/workspaces/utils' +import { + reassignWorkflowOwnershipForWorkspaceMemberRemovalTx, + transferWorkspaceOwnershipToBilledAccountForMemberRemovalTx, + WorkspaceBillingAccountRemovalError, +} from '@/lib/workspaces/utils' /** * Workspace access as a shared domain primitive. @@ -110,30 +114,50 @@ export async function lowerWorkspaceAccessTx( return updated.length > 0 ? 'lowered' : 'unchanged' } -export interface RevokeWorkspaceAccessResult { - revoked: boolean - /** Workflows whose owner could not be reassigned, which blocks the removal. */ - unresolvedWorkflows: string[] -} +export type RevokeWorkspaceAccessResult = + | { revoked: true } + /** Workflows whose owner could not be reassigned; the access row is left in place. */ + | { revoked: false; reason: 'unresolved-workflows'; unresolvedWorkflows: string[] } + /** The user owns the workspace and it has no billed account to hand it to. */ + | { revoked: false; reason: 'workspace-owner-without-successor' } /** * Removes a user's access to one workspace and everything that hangs off it. * - * Ownership reassignment runs first and can fail: a workflow whose owner cannot - * be moved would be orphaned by the delete, so the caller is expected to treat - * an unresolved list as a refusal rather than proceeding. + * Ownership moves first, in the same order the members route uses: the workspace + * itself to its billed account when the departing user owns it, then every + * workflow they own to a remaining member. Either can fail, and a failure is a + * refusal rather than a partial removal — deleting the access row would orphan + * what could not be moved. */ export async function revokeWorkspaceAccessTx( tx: DbOrTx, params: { workspaceId: string; userId: string } ): Promise { + try { + await transferWorkspaceOwnershipToBilledAccountForMemberRemovalTx({ + tx, + workspaceId: params.workspaceId, + departingUserId: params.userId, + }) + } catch (error) { + if (error instanceof WorkspaceBillingAccountRemovalError) { + return { revoked: false, reason: 'workspace-owner-without-successor' } + } + throw error + } + const reassignment = await reassignWorkflowOwnershipForWorkspaceMemberRemovalTx({ tx, workspaceIds: [params.workspaceId], departingUserId: params.userId, }) if (reassignment.unresolved.length > 0) { - return { revoked: false, unresolvedWorkflows: reassignment.unresolved } + return { + revoked: false, + reason: 'unresolved-workflows', + unresolvedWorkflows: reassignment.unresolved, + } } const deleted = await tx @@ -150,7 +174,7 @@ export async function revokeWorkspaceAccessTx( await revokeWorkspaceCredentialMembershipsTx(tx, params.workspaceId, params.userId) await removeWorkspaceSkillMembershipsTx(tx, params.workspaceId, params.userId) - return { revoked: deleted.length > 0, unresolvedWorkflows: [] } + return { revoked: true } } /** The permission a user currently holds on a workspace, if any. */ diff --git a/packages/audit/src/types.ts b/packages/audit/src/types.ts index 05a6ee8c013..10ee9450450 100644 --- a/packages/audit/src/types.ts +++ b/packages/audit/src/types.ts @@ -169,8 +169,6 @@ export const AuditAction = { ORG_INVITATION_CANCELLED: 'org_invitation.cancelled', ORG_INVITATION_REVOKED: 'org_invitation.revoked', ORG_INVITATION_RESENT: 'org_invitation.resent', - ORG_MEMBER_SUSPENDED: 'org_member.suspended', - ORG_MEMBER_UNSUSPENDED: 'org_member.unsuspended', ORG_SEAT_PROVISIONED: 'org_seat.provisioned', ORG_SEAT_DEPROVISIONED: 'org_seat.deprovisioned', ORG_PLAN_CONVERTED: 'org_plan.converted', diff --git a/packages/db/schema.ts b/packages/db/schema.ts index 576ef5b0b92..c7e0a27ad98 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -5864,7 +5864,7 @@ export interface ScimConnectionSettings { * the directory is the only way into the organization. */ disableJit?: boolean - /** Auto-create a matching permission group the first time a SCIM group appears. */ + /** Map a pushed group to an existing permission group of the same name. Nothing is created. */ autoMapPermissionGroupsByName?: boolean /** Workspaces every provisioned user receives regardless of group membership. */ defaultWorkspaceGrants?: ScimDefaultWorkspaceGrant[] From 304b4e97f5ea0011a86b0c8ad5f1609cb0717cf6 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 14:22:08 -0700 Subject: [PATCH 14/31] fix(scim): address the first review round and CI - Filters accept unquoted booleans for active (RFC 7644) - Group PATCH resolves order-sensitive membership deltas by last operation and refuses a non-string externalId - Full writes accept case-insensitive attribute names (Entra's `username`) - Credential issue counts and inserts under the connection row lock - Projection records provenance only for access the directory actually granted unless the directory is the source of truth; skips departed members and workspaces moved to another organization - Reconcile job verifies its lease per batch and reads settings after taking it - Group writes serialize on the organization lock; the member role route runs its managed-membership check under the same locks - Seat reconciliation targets the subscription admission validated against - Docs: FAQ import, self-hosted flags; docs manifest regenerated - Chart 1.10.0 for the new cron job; test fixtures carry column defaults Co-Authored-By: Claude Fable 5.1 --- .../content/docs/platform/enterprise/scim.mdx | 3 +- .../[id]/members/[memberId]/route.ts | 28 +++--- .../utils/permission-check.test.ts | 6 +- apps/sim/lib/api/contracts/scim.ts | 61 ++++++++---- .../lib/copilot/generated/docs-manifest.ts | 1 + .../lib/core/config/deployment-shape.test.ts | 1 + .../lib/scim/application/admin/credentials.ts | 71 +++++++------- .../scim/application/groups/manage-groups.ts | 25 +++++ .../scim/application/users/provision-user.ts | 19 +++- .../sim/lib/scim/projection/reconcile-user.ts | 93 +++++++++++++++---- apps/sim/lib/scim/protocol/filter.test.ts | 7 +- apps/sim/lib/scim/protocol/filter.ts | 2 + .../sim/lib/scim/protocol/group-patch.test.ts | 21 +++++ apps/sim/lib/scim/protocol/group-patch.ts | 37 ++++++-- apps/sim/lib/scim/protocol/normalize.ts | 22 +++++ apps/sim/lib/scim/reconcile/job.ts | 30 +++++- helm/sim/Chart.yaml | 2 +- 17 files changed, 327 insertions(+), 102 deletions(-) diff --git a/apps/docs/content/docs/platform/enterprise/scim.mdx b/apps/docs/content/docs/platform/enterprise/scim.mdx index 6345ed68356..81ea8914ab4 100644 --- a/apps/docs/content/docs/platform/enterprise/scim.mdx +++ b/apps/docs/content/docs/platform/enterprise/scim.mdx @@ -6,13 +6,14 @@ description: Create, update, and deactivate Sim members automatically from your import { Callout } from 'fumadocs-ui/components/callout' import { Step, Steps } from 'fumadocs-ui/components/steps' import { Tab, Tabs } from 'fumadocs-ui/components/tabs' +import { FAQ } from '@/components/ui/faq' Directory provisioning connects your identity provider to Sim over SCIM 2.0. Your provider creates members when someone joins, updates them when their details change, and deactivates them the moment they leave — without anyone touching Sim. It pairs with [SSO](/platform/enterprise/sso). SSO proves who someone is when they sign in. Directory provisioning decides who exists and what they can reach, before and after that. - Enterprise plans. Requires at least one [verified domain](/platform/enterprise/verified-domains) for your organization. + Enterprise plans. Requires at least one [verified domain](/platform/enterprise/verified-domains) for your organization. Self-hosted deployments turn it on with `SCIM_ENABLED=true` and `NEXT_PUBLIC_SCIM_ENABLED=true`, alongside the [SSO variables](/platform/enterprise/sso#self-hosted-setup). ## What it does diff --git a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts index e94b931cad7..ca83e2a2869 100644 --- a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts @@ -11,6 +11,7 @@ import { getSession } from '@/lib/auth' import { setActiveOrganizationForCurrentSession } from '@/lib/auth/active-organization' import { getOrganizationMemberUsageSnapshot } from '@/lib/billing/core/organization' import { + acquireOrganizationUserMutationLocks, removeExternalUserFromOrganizationWorkspaces, removeUserFromOrganization, WORKSPACE_BILLING_ACCOUNT_REMOVAL_ERROR, @@ -214,24 +215,21 @@ export const PUT = withRouteHandler( } /** - * When the organization has made its identity provider the source of - * truth for membership, a role set here is reverted by the next sync. - * Refusing says so instead of letting the change quietly disappear. + * The member is re-read under the organization's mutation lock, so a + * concurrent promotion to owner — or a directory provisioning this very + * member — cannot slip between the checks and the write. When the + * organization has made its identity provider the source of truth, a role + * set here is reverted by the next sync; refusing says so. */ - await assertMembershipNotScimManaged({ - organizationId, - userId: memberId, + const roleChange = await db.transaction(async (tx) => { + await acquireOrganizationUserMutationLocks(tx, { + userId: memberId, + organizationIds: [organizationId], + }) + await assertMembershipNotScimManaged({ organizationId, userId: memberId, executor: tx }) + return changeMemberRoleTx(tx, { organizationId, userId: memberId, role }) }) - /** - * The shared primitive re-reads the member under the organization's - * mutation lock, so a concurrent promotion to owner cannot slip between - * the check above and the write. - */ - const roleChange = await db.transaction((tx) => - changeMemberRoleTx(tx, { organizationId, userId: memberId, role }) - ) - /** * The audit row and analytics event fire whether or not the role actually * moved, exactly as this route did before the write went through the diff --git a/apps/sim/ee/access-control/utils/permission-check.test.ts b/apps/sim/ee/access-control/utils/permission-check.test.ts index 02baa8ee855..13b0bfc54da 100644 --- a/apps/sim/ee/access-control/utils/permission-check.test.ts +++ b/apps/sim/ee/access-control/utils/permission-check.test.ts @@ -83,7 +83,11 @@ function queueGroupResolution( workspaceGroups: WorkspaceGroupRow[] = [], defaultGroup: Array<{ config: Record }> = [] ) { - queueTableRows(permissionGroup, workspaceGroups) + /** Every row carries the column default the resolver reads, as a real row would. */ + queueTableRows( + permissionGroup, + workspaceGroups.map((row) => ({ membershipMode: 'inherit', ...row })) + ) queueTableRows(permissionGroup, defaultGroup) } diff --git a/apps/sim/lib/api/contracts/scim.ts b/apps/sim/lib/api/contracts/scim.ts index 150dcae0f92..ebd6e5aa344 100644 --- a/apps/sim/lib/api/contracts/scim.ts +++ b/apps/sim/lib/api/contracts/scim.ts @@ -7,7 +7,11 @@ import { SCIM_MAX_PATCH_OPERATIONS, SCIM_PATCH_OP_SCHEMA, } from '@/lib/scim/protocol/constants' -import { normalizeScimBoolean, unwrapSingleElement } from '@/lib/scim/protocol/normalize' +import { + canonicalizeAttributeNames, + normalizeScimBoolean, + unwrapSingleElement, +} from '@/lib/scim/protocol/normalize' /** * Wire schemas for the SCIM 2.0 surface. @@ -63,18 +67,32 @@ const scimEnterpriseSchema = z.looseObject({ * keeps the credential out of the parsed request object and therefore out of * every log line and error detail downstream. */ -export const scimUserWriteSchema = z - .looseObject({ - schemas: z.array(z.string().max(256)).min(1, 'schemas must name at least one URN').max(10), - userName: z.string().trim().min(1, 'userName must not be empty').max(320), - externalId: z.string().trim().max(256).optional(), - active: scimBoolean.optional(), - displayName: z.string().max(256).optional(), - name: scimNameSchema.optional(), - emails: z.array(scimEmailSchema).max(20).optional(), - [SCIM_ENTERPRISE_USER_SCHEMA]: scimEnterpriseSchema.optional(), - }) - .transform(({ password: _password, ...rest }) => rest) +const USER_WRITE_ATTRIBUTES = [ + 'schemas', + 'userName', + 'externalId', + 'active', + 'displayName', + 'name', + 'emails', + SCIM_ENTERPRISE_USER_SCHEMA, +] as const + +export const scimUserWriteSchema = z.preprocess( + (body) => canonicalizeAttributeNames(body, USER_WRITE_ATTRIBUTES), + z + .looseObject({ + schemas: z.array(z.string().max(256)).min(1, 'schemas must name at least one URN').max(10), + userName: z.string().trim().min(1, 'userName must not be empty').max(320), + externalId: z.string().trim().max(256).optional(), + active: scimBoolean.optional(), + displayName: z.string().max(256).optional(), + name: scimNameSchema.optional(), + emails: z.array(scimEmailSchema).max(20).optional(), + [SCIM_ENTERPRISE_USER_SCHEMA]: scimEnterpriseSchema.optional(), + }) + .transform(({ password: _password, ...rest }) => rest) +) /** What a client may send. */ export type ScimUserWrite = z.input /** What the route receives after parsing, which is what the canonicalizer reads. */ @@ -86,12 +104,17 @@ const scimGroupMemberSchema = z.looseObject({ type: z.string().max(64).optional(), }) -export const scimGroupWriteSchema = z.looseObject({ - schemas: z.array(z.string().max(256)).min(1, 'schemas must name at least one URN').max(10), - displayName: z.string().trim().min(1, 'displayName must not be empty').max(256), - externalId: z.string().trim().max(256).optional(), - members: z.array(scimGroupMemberSchema).max(SCIM_MAX_GROUP_MEMBERS).optional(), -}) +const GROUP_WRITE_ATTRIBUTES = ['schemas', 'displayName', 'externalId', 'members'] as const + +export const scimGroupWriteSchema = z.preprocess( + (body) => canonicalizeAttributeNames(body, GROUP_WRITE_ATTRIBUTES), + z.looseObject({ + schemas: z.array(z.string().max(256)).min(1, 'schemas must name at least one URN').max(10), + displayName: z.string().trim().min(1, 'displayName must not be empty').max(256), + externalId: z.string().trim().max(256).optional(), + members: z.array(scimGroupMemberSchema).max(SCIM_MAX_GROUP_MEMBERS).optional(), + }) +) export type ScimGroupWrite = z.input export type ScimGroupWriteParsed = z.output diff --git a/apps/sim/lib/copilot/generated/docs-manifest.ts b/apps/sim/lib/copilot/generated/docs-manifest.ts index 86005762478..e2f9e8f6189 100644 --- a/apps/sim/lib/copilot/generated/docs-manifest.ts +++ b/apps/sim/lib/copilot/generated/docs-manifest.ts @@ -375,6 +375,7 @@ export const DOCS_MANIFEST: readonly string[] = [ 'platform/enterprise/data-drains.mdx', 'platform/enterprise/data-retention.mdx', 'platform/enterprise/forks.mdx', + 'platform/enterprise/scim.mdx', 'platform/enterprise/self-hosted.mdx', 'platform/enterprise/session-policies.mdx', 'platform/enterprise/sso.mdx', diff --git a/apps/sim/lib/core/config/deployment-shape.test.ts b/apps/sim/lib/core/config/deployment-shape.test.ts index a01adc99bd8..9de0eca990f 100644 --- a/apps/sim/lib/core/config/deployment-shape.test.ts +++ b/apps/sim/lib/core/config/deployment-shape.test.ts @@ -36,6 +36,7 @@ describe('resolveDeploymentShape', () => { dataRetention: false, inbox: true, sandboxes: true, + scim: false, sessionPolicies: true, sso: true, usageMonitoring: false, diff --git a/apps/sim/lib/scim/application/admin/credentials.ts b/apps/sim/lib/scim/application/admin/credentials.ts index 659d89a88ff..2849fca68bc 100644 --- a/apps/sim/lib/scim/application/admin/credentials.ts +++ b/apps/sim/lib/scim/application/admin/credentials.ts @@ -34,43 +34,52 @@ export const issueScimCredential = defineAuthorizedScimAdminUseCase({ operation: scimAdminOperations.issueCredential, async execute({ input, context }: ScimAdminUseCaseArgs) { const connection = await requireConnection(context.organizationId) - - const [active] = await db - .select({ value: count() }) - .from(scimCredential) - .where(activeCredentialCondition(connection.id)) - if ((active?.value ?? 0) >= MAX_ACTIVE_CREDENTIALS) { - throw new OrchestrationError( - 'conflict', - `At most ${MAX_ACTIVE_CREDENTIALS} credentials may be active at once. Revoke one before issuing another.` - ) - } - const { secret, hash, prefix } = generateScimToken() const scopes = input.scopes ?? [...SCIM_SCOPES] const expiresAt = input.expiresInDays ? new Date(Date.now() + input.expiresInDays * DAY_MS) : null - const [created] = await db - .insert(scimCredential) - .values({ - id: generateId(), - connectionId: connection.id, - tokenHash: hash, - tokenPrefix: prefix, - scopes, - expiresAt, - createdBy: context.actorUserId, - }) - .returning({ - id: scimCredential.id, - tokenPrefix: scimCredential.tokenPrefix, - scopes: scimCredential.scopes, - expiresAt: scimCredential.expiresAt, - lastUsedAt: scimCredential.lastUsedAt, - createdAt: scimCredential.createdAt, - }) + const created = await db.transaction(async (tx) => { + /** The connection row is the lock, so two issue requests cannot both see one free slot. */ + await tx + .select({ id: scimConnection.id }) + .from(scimConnection) + .where(eq(scimConnection.id, connection.id)) + .for('update') + + const [active] = await tx + .select({ value: count() }) + .from(scimCredential) + .where(activeCredentialCondition(connection.id)) + if ((active?.value ?? 0) >= MAX_ACTIVE_CREDENTIALS) { + throw new OrchestrationError( + 'conflict', + `At most ${MAX_ACTIVE_CREDENTIALS} credentials may be active at once. Revoke one before issuing another.` + ) + } + + const [row] = await tx + .insert(scimCredential) + .values({ + id: generateId(), + connectionId: connection.id, + tokenHash: hash, + tokenPrefix: prefix, + scopes, + expiresAt, + createdBy: context.actorUserId, + }) + .returning({ + id: scimCredential.id, + tokenPrefix: scimCredential.tokenPrefix, + scopes: scimCredential.scopes, + expiresAt: scimCredential.expiresAt, + lastUsedAt: scimCredential.lastUsedAt, + createdAt: scimCredential.createdAt, + }) + return row + }) return { secret, credential: toCredentialView(created), connectionId: connection.id } }, diff --git a/apps/sim/lib/scim/application/groups/manage-groups.ts b/apps/sim/lib/scim/application/groups/manage-groups.ts index 3edb5787c6e..a7321f8f2ee 100644 --- a/apps/sim/lib/scim/application/groups/manage-groups.ts +++ b/apps/sim/lib/scim/application/groups/manage-groups.ts @@ -3,6 +3,7 @@ import { db } from '@sim/db' import { scimGroup } from '@sim/db/schema' import { and, eq, ne } from 'drizzle-orm' import type { ScimPatchOperation } from '@/lib/api/contracts/scim' +import { acquireOrganizationMutationLock } from '@/lib/billing/organizations/membership' import type { DbOrTx } from '@/lib/db/types' import { defineAuthorizedScimUseCase, @@ -164,6 +165,12 @@ export const createScimGroup = defineAuthorizedScimUseCase({ }: ScimUseCaseArgs): Promise { const { group } = input return db.transaction(async (tx) => { + /** + * Group writes serialize on the organization lock, which also heads the + * documented lock order, so two full-membership PATCHes cannot both compute + * from the same stale membership and keep members from both. + */ + await acquireOrganizationMutationLock(tx, context.organizationId) await assertDisplayNameAvailable(tx, { connectionId: context.connection.id, displayName: group.displayName, @@ -226,6 +233,12 @@ export const replaceScimGroup = defineAuthorizedScimUseCase({ context, }: ScimUseCaseArgs): Promise { return db.transaction(async (tx) => { + /** + * Group writes serialize on the organization lock, which also heads the + * documented lock order, so two full-membership PATCHes cannot both compute + * from the same stale membership and keep members from both. + */ + await acquireOrganizationMutationLock(tx, context.organizationId) const current = await findScimGroupById(tx, context.connection.id, input.groupId) if (!current) throw notFound('SCIM Group not found') @@ -321,6 +334,12 @@ export const patchScimGroup = defineAuthorizedScimUseCase({ const patch = parseGroupPatch(input.operations) return db.transaction(async (tx) => { + /** + * Group writes serialize on the organization lock, which also heads the + * documented lock order, so two full-membership PATCHes cannot both compute + * from the same stale membership and keep members from both. + */ + await acquireOrganizationMutationLock(tx, context.organizationId) const current = await findScimGroupById(tx, context.connection.id, input.groupId) if (!current) throw notFound('SCIM Group not found') @@ -431,6 +450,12 @@ export const deleteScimGroup = defineAuthorizedScimUseCase({ operation: scimOperations.deleteGroup, async execute({ input, context }: ScimUseCaseArgs) { return db.transaction(async (tx) => { + /** + * Group writes serialize on the organization lock, which also heads the + * documented lock order, so two full-membership PATCHes cannot both compute + * from the same stale membership and keep members from both. + */ + await acquireOrganizationMutationLock(tx, context.organizationId) const current = await findScimGroupById(tx, context.connection.id, input.groupId) if (!current) throw notFound('SCIM Group not found') diff --git a/apps/sim/lib/scim/application/users/provision-user.ts b/apps/sim/lib/scim/application/users/provision-user.ts index 85e35f58fa5..0da55002f08 100644 --- a/apps/sim/lib/scim/application/users/provision-user.ts +++ b/apps/sim/lib/scim/application/users/provision-user.ts @@ -53,6 +53,8 @@ export interface ProvisionScimUserResult { createdAccount: boolean /** False when the account was already a member and only the SCIM link was new. */ joinedOrganization: boolean + /** The subscription seats were validated against, so the post-commit seat sync targets the same one. */ + subscriptionId: string | undefined organizationId: string resource: ReturnType } @@ -179,7 +181,11 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ await deleteScimUser(db, existing.id) } - let provisioned: { scimUserId: string; joinedOrganization: boolean } + let provisioned: { + scimUserId: string + joinedOrganization: boolean + subscriptionId: string | undefined + } try { provisioned = await db.transaction(async (tx) => { const seatPolicy = await resolveSeatPolicy(tx, context.organizationId) @@ -231,7 +237,11 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ scimUserId: inserted.id, settings: context.connection.settings, }) - return { scimUserId: inserted.id, joinedOrganization: !membership.alreadyMember } + return { + scimUserId: inserted.id, + joinedOrganization: !membership.alreadyMember, + subscriptionId: seatPolicy.organizationSubscriptionId, + } }) } catch (error) { /** @@ -253,7 +263,7 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ } throw error } - const { scimUserId, joinedOrganization } = provisioned + const { scimUserId, joinedOrganization, subscriptionId } = provisioned const record = await findScimUserById(db, context.connection.id, scimUserId) if (!record) throw new ScimError(500, undefined, 'The provisioned user could not be read back') @@ -263,6 +273,7 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ userId, createdAccount, joinedOrganization, + subscriptionId, organizationId: context.organizationId, resource: toUserResource(toUserResourceRow(record, []), context.baseUrl), } @@ -303,6 +314,8 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ await reconcileOrganizationSeats({ organizationId: context.organizationId, reason: 'scim-member-added', + /** The subscription admission was validated against, not whichever is newest now. */ + ...(result.subscriptionId ? { subscriptionId: result.subscriptionId } : {}), }) } catch (error) { logger.error('Failed to reconcile seats after directory provisioning', { error }) diff --git a/apps/sim/lib/scim/projection/reconcile-user.ts b/apps/sim/lib/scim/projection/reconcile-user.ts index 724856b160c..ea7f7232485 100644 --- a/apps/sim/lib/scim/projection/reconcile-user.ts +++ b/apps/sim/lib/scim/projection/reconcile-user.ts @@ -1,10 +1,12 @@ import { db } from '@sim/db' import { + member, type ScimConnectionSettings, scimGroupMapping, scimGroupMember, scimProjectionGrant, scimUser, + workspace, } from '@sim/db/schema' import { createLogger } from '@sim/logger' import type { PermissionType } from '@sim/platform-authz/workspace' @@ -100,9 +102,26 @@ async function currentGrants(tx: DbOrTx, scimUserId: string): Promise { + const [row] = await tx + .select({ id: workspace.id }) + .from(workspace) + .where(and(eq(workspace.id, workspaceId), eq(workspace.organizationId, organizationId))) + .limit(1) + return Boolean(row) +} + +/** Applies one grant. `skipped` means the grant describes nothing this server can apply. */ async function applyGrant( tx: DbOrTx, params: { @@ -112,11 +131,23 @@ async function applyGrant( /** The level a previous pass set on a workspace, when lowering it. */ previousPermission?: PermissionType } -): Promise { +): Promise { const { grant } = params switch (grant.targetKind) { - case 'workspace': - if (!grant.permissionType) return false + case 'workspace': { + if (!grant.permissionType) return 'skipped' + /** + * A workspace can be moved to another organization after it was mapped. + * The mapping row survives, and following it would hand this + * organization's members access in a tenant the directory does not serve. + */ + if (!(await workspaceBelongsToOrganization(tx, grant.targetId, params.organizationId))) { + logger.warn('Skipped a SCIM mapping whose workspace is no longer in the organization', { + workspaceId: grant.targetId, + organizationId: params.organizationId, + }) + return 'skipped' + } if ( params.previousPermission && permissionRank(params.previousPermission) > permissionRank(grant.permissionType) @@ -127,26 +158,29 @@ async function applyGrant( from: params.previousPermission, to: grant.permissionType, }) - return true + return 'applied' } - await grantWorkspaceAccessTx(tx, { + const outcome = await grantWorkspaceAccessTx(tx, { workspaceId: grant.targetId, userId: params.userId, permission: grant.permissionType, }) - return true - case 'org_role': - if (grant.targetId !== 'admin') return false + return outcome === 'unchanged' ? 'unchanged' : 'applied' + } + case 'org_role': { + if (grant.targetId !== 'admin') return 'skipped' return setOrganizationRole(tx, params.organizationId, params.userId, 'admin') - case 'permission_group': - await addPermissionGroupMemberTx(tx, { + } + case 'permission_group': { + const outcome = await addPermissionGroupMemberTx(tx, { organizationId: params.organizationId, groupId: grant.targetId, userId: params.userId, assignedBy: null, lockTimeoutAlreadyBounded: true, }) - return true + return outcome === 'already-member' ? 'unchanged' : 'applied' + } } } @@ -163,21 +197,21 @@ async function setOrganizationRole( organizationId: string, userId: string, role: 'admin' | 'member' -): Promise { +): Promise { try { - await changeMemberRoleTx(tx, { organizationId, userId, role }) - return true + const change = await changeMemberRoleTx(tx, { organizationId, userId, role }) + return change.changed ? 'applied' : 'unchanged' } catch (error) { if (error instanceof OrchestrationError && error.code === 'conflict') { logger.warn('Skipped an organization role mapping for the owner', { organizationId, userId }) - return false + return 'skipped' } if (error instanceof OrchestrationError && error.code === 'not_found') { logger.warn('Skipped an organization role mapping for a user who is no longer a member', { organizationId, userId, }) - return false + return 'skipped' } throw error } @@ -292,6 +326,18 @@ export async function reconcileUserProjection( organizationIds: [params.organizationId], }) + /** + * Checked under the lock. A deprovisioning removes the membership and deletes + * the SCIM row in separate commits; a pass that lands between them must not + * grant workspace access to someone who has already left. + */ + const [membership] = await tx + .select({ id: member.id }) + .from(member) + .where(and(eq(member.organizationId, params.organizationId), eq(member.userId, record.userId))) + .limit(1) + if (!membership) return EMPTY_DELTA + const desired = resolveDesiredGrants( await loadMappingRows(tx, params.scimUserId), params.settings.defaultWorkspaceGrants ?? [] @@ -323,7 +369,7 @@ export async function reconcileUserProjection( } for (const { grant, previousPermission } of plan.apply) { - let applied: boolean + let applied: GrantApplication try { applied = await applyGrant(tx, { organizationId: params.organizationId, @@ -357,7 +403,14 @@ export async function reconcileUserProjection( } throw error } - if (!applied) continue + if (applied === 'skipped') continue + /** + * Access the person already held by hand is theirs, not the directory's. + * Recording it as a directory grant would let a later group change revoke a + * deliberate manual decision. Only when the organization has made the + * directory the source of truth does the directory take ownership of it. + */ + if (applied === 'unchanged' && !lockManualMembership && !previousPermission) continue await tx .insert(scimProjectionGrant) diff --git a/apps/sim/lib/scim/protocol/filter.test.ts b/apps/sim/lib/scim/protocol/filter.test.ts index 4591e522ea3..2f128433e50 100644 --- a/apps/sim/lib/scim/protocol/filter.test.ts +++ b/apps/sim/lib/scim/protocol/filter.test.ts @@ -73,8 +73,13 @@ describe('parseUserFilter', () => { expect(scimTypeOf(() => parseUserFilter('nickName eq "Ada"'))).toBe('invalidFilter') }) + it('accepts the unquoted booleans RFC 7644 writes for active', () => { + expect(parseUserFilter('active eq true')).toEqual([{ field: 'active', value: 'true' }]) + expect(parseUserFilter('active eq false')).toEqual([{ field: 'active', value: 'false' }]) + }) + it('refuses an unquoted value', () => { - expect(scimTypeOf(() => parseUserFilter('active eq true'))).toBe('invalidFilter') + expect(scimTypeOf(() => parseUserFilter('userName eq ada'))).toBe('invalidFilter') }) it('refuses more than ten joined expressions', () => { diff --git a/apps/sim/lib/scim/protocol/filter.ts b/apps/sim/lib/scim/protocol/filter.ts index a315deb078a..240842e33c8 100644 --- a/apps/sim/lib/scim/protocol/filter.ts +++ b/apps/sim/lib/scim/protocol/filter.ts @@ -160,6 +160,8 @@ function parseTerm(term: string): { attribute: string; value: string } { } const raw = rawValue.trim() + /** RFC 7644 writes boolean comparisons unquoted: `active eq true`. */ + if (raw === 'true' || raw === 'false') return { attribute, value: raw } if (!raw.startsWith('"') || !raw.endsWith('"') || raw.length < 2) { throw invalidFilter('Filter values must be quoted strings') } diff --git a/apps/sim/lib/scim/protocol/group-patch.test.ts b/apps/sim/lib/scim/protocol/group-patch.test.ts index 827acf16915..57ee2d79016 100644 --- a/apps/sim/lib/scim/protocol/group-patch.test.ts +++ b/apps/sim/lib/scim/protocol/group-patch.test.ts @@ -13,6 +13,27 @@ function parseOperations(operations: unknown[]) { } describe('parseGroupPatch', () => { + it('lets the last operation naming a member win', () => { + expect( + parseGroupPatch([ + { op: 'add', path: 'members', value: [{ value: 'u1' }] }, + { op: 'remove', path: 'members[value eq "u1"]' }, + ]) + ).toEqual({ kind: 'incremental', add: [], remove: ['u1'] }) + expect( + parseGroupPatch([ + { op: 'remove', path: 'members[value eq "u1"]' }, + { op: 'add', path: 'members', value: [{ value: 'u1' }] }, + ]) + ).toEqual({ kind: 'incremental', add: ['u1'], remove: [] }) + }) + + it('refuses a non-string externalId instead of clearing it', () => { + expect(() => parseGroupPatch([{ op: 'replace', path: 'externalId', value: 42 }])).toThrow( + 'externalId must be a string' + ) + }) + it('reads Okta’s filtered member removal', () => { const patch = parseGroupPatch( parseOperations([{ op: 'remove', path: 'members[value eq "u1"]' }]) diff --git a/apps/sim/lib/scim/protocol/group-patch.ts b/apps/sim/lib/scim/protocol/group-patch.ts index 9acf2ae520e..dd0fe9595a3 100644 --- a/apps/sim/lib/scim/protocol/group-patch.ts +++ b/apps/sim/lib/scim/protocol/group-patch.ts @@ -53,10 +53,31 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou removeMembers: [], } + /** + * Membership is a set, so the final state of each member is decided by the + * last operation naming them; an earlier delta is dropped when a later one + * contradicts it, and a wholesale replace supersedes every delta before it. + */ + const addMember = (id: string) => { + const removedAt = remove.indexOf(id) + if (removedAt !== -1) remove.splice(removedAt, 1) + if (!add.includes(id)) add.push(id) + } + const removeMember = (id: string) => { + const addedAt = add.indexOf(id) + if (addedAt !== -1) add.splice(addedAt, 1) + if (!remove.includes(id)) remove.push(id) + } const applyFullMembers = (ids: string[]) => { incremental = false + add.length = 0 + remove.length = 0 full.members = ids } + const readExternalId = (value: unknown): string | null => { + if (typeof value !== 'string') throw invalidValue('externalId must be a string') + return value.trim() || null + } for (const operation of operations) { if (operation.op === 'remove' && !operation.path) { @@ -77,7 +98,7 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou } full.displayName = nested.trim() } else if (key === 'externalid') { - full.externalId = typeof nested === 'string' && nested.trim() ? nested.trim() : null + full.externalId = readExternalId(nested) } else if (key === 'members') { applyFullMembers(readMemberList(nested)) } else if (key === 'id' || key === 'schemas' || key.startsWith('meta')) { @@ -100,7 +121,7 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou throw invalidPath('A filtered members path is only supported for remove') } const id = filtered.groups.value.trim() - if (id && !remove.includes(id)) remove.push(id) + if (id) removeMember(id) continue } @@ -115,9 +136,10 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou applyFullMembers([]) continue } - const ids = readMemberList(operation.value ?? []) - const target = operation.op === 'add' ? add : remove - for (const id of ids) if (!target.includes(id)) target.push(id) + for (const id of readMemberList(operation.value ?? [])) { + if (operation.op === 'add') addMember(id) + else removeMember(id) + } continue } @@ -133,10 +155,7 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou if (key === 'externalid') { incremental = false - full.externalId = - operation.op === 'remove' || typeof operation.value !== 'string' - ? null - : operation.value.trim() || null + full.externalId = operation.op === 'remove' ? null : readExternalId(operation.value) continue } diff --git a/apps/sim/lib/scim/protocol/normalize.ts b/apps/sim/lib/scim/protocol/normalize.ts index 8c72b8d7b70..de7b8bd13b3 100644 --- a/apps/sim/lib/scim/protocol/normalize.ts +++ b/apps/sim/lib/scim/protocol/normalize.ts @@ -77,6 +77,28 @@ export function normalizeAttributePath(path: string): string { export const ENTRA_LEGACY_GROUP_SCHEMA = 'http://schemas.microsoft.com/2006/11/ResourceManagement/ADSCIM/2.0/Group' +/** + * Restores canonical casing on top-level attribute names. + * + * RFC 7643 makes attribute names case-insensitive and Entra sends `username` + * where the schema says `userName`. Only the names given are touched; anything + * else passes through so unknown attributes still round-trip as sent. + */ +export function canonicalizeAttributeNames( + body: unknown, + canonicalNames: readonly string[] +): unknown { + if (!isRecord(body)) return body + const byLower = new Map(canonicalNames.map((name) => [name.toLowerCase(), name])) + const result: Record = {} + for (const [key, value] of Object.entries(body)) { + const canonical = byLower.get(key.toLowerCase()) + if (canonical && !(canonical in body) && !(canonical in result)) result[canonical] = value + else result[key] = value + } + return result +} + /** Drops schema URNs that are provider markers rather than real extensions. */ export function stripProviderSchemaMarkers(schemas: readonly string[]): string[] { return schemas.filter((schema) => schema !== ENTRA_LEGACY_GROUP_SCHEMA) diff --git a/apps/sim/lib/scim/reconcile/job.ts b/apps/sim/lib/scim/reconcile/job.ts index 1c035cc7f5b..cdac233886e 100644 --- a/apps/sim/lib/scim/reconcile/job.ts +++ b/apps/sim/lib/scim/reconcile/job.ts @@ -70,6 +70,16 @@ async function acquireLease(connectionId: string, runId: string): Promise 0 } +/** Whether this run still holds the connection; a run past the TTL may have been superseded. */ +async function holdsLease(connectionId: string, runId: string): Promise { + const [row] = await db + .select({ token: scimConnection.reconcileLockToken }) + .from(scimConnection) + .where(eq(scimConnection.id, connectionId)) + .limit(1) + return row?.token === runId +} + async function releaseLease(connectionId: string, runId: string): Promise { await db .update(scimConnection) @@ -117,6 +127,18 @@ export async function reconcileConnection(connection: { const runId = generateId() if (!(await acquireLease(connection.id, runId))) return null + /** + * Settings are read after the lease is held, not from the row the due query + * returned: an administrator may have changed them in between, and projecting + * with the old settings would then stamp the connection as reconciled. + */ + const [fresh] = await db + .select({ settings: scimConnection.settings }) + .from(scimConnection) + .where(eq(scimConnection.id, connection.id)) + .limit(1) + const settings = fresh?.settings ?? connection.settings + const report: ScimReconcileReport = { connectionId: connection.id, reconciledUsers: 0, @@ -133,6 +155,12 @@ export async function reconcileConnection(connection: { limit: BATCH_SIZE, }) if (page.length === 0) break + if (!(await holdsLease(connection.id, runId))) { + logger.warn('Directory reconciliation stopped: the lease was taken over', { + connectionId: connection.id, + }) + break + } await db.transaction(async (tx) => { for (const row of page) { @@ -140,7 +168,7 @@ export async function reconcileConnection(connection: { connectionId: connection.id, organizationId: connection.organizationId, scimUserId: row.id, - settings: connection.settings, + settings, }) report.reconciledUsers += 1 report.grantsAdded += delta.added.length + delta.raised.length diff --git a/helm/sim/Chart.yaml b/helm/sim/Chart.yaml index 83ddb43abe3..8781e11ba72 100644 --- a/helm/sim/Chart.yaml +++ b/helm/sim/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: sim description: A Helm chart for Sim - the open-source AI workspace where teams build, deploy, and manage AI agents type: application -version: 1.9.5 +version: 1.10.0 appVersion: "v0.8.24" kubeVersion: ">=1.25.0-0" home: https://sim.ai From 16fc76e5a0692c44f2afc6a6a454f97b34f13d65 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 14:30:19 -0700 Subject: [PATCH 15/31] test(audit): mirror the SCIM actions and resource types into the shared audit mock Co-Authored-By: Claude Fable 5.1 --- .../lib/execution/sandbox/bundles/docx.cjs | 38 +++++++++---------- .../execution/sandbox/bundles/pptxgenjs.cjs | 34 ++++++++--------- packages/testing/src/mocks/audit.mock.ts | 19 ++++++++++ 3 files changed, 55 insertions(+), 36 deletions(-) diff --git a/apps/sim/lib/execution/sandbox/bundles/docx.cjs b/apps/sim/lib/execution/sandbox/bundles/docx.cjs index 333aef7cdf2..8422580d836 100644 --- a/apps/sim/lib/execution/sandbox/bundles/docx.cjs +++ b/apps/sim/lib/execution/sandbox/bundles/docx.cjs @@ -1,31 +1,31 @@ // sandbox bundle: docx // generated by apps/sim/lib/execution/sandbox/bundles/build.ts // do not edit by hand. run `bun run build:sandbox-bundles` to regenerate. -(()=>{var R5=Object.create;var{getPrototypeOf:L5,defineProperty:r1,getOwnPropertyNames:I5}=Object;var O5=Object.prototype.hasOwnProperty;function H5(B){return this[B]}var F5,W5,P5=(B,U,G)=>{var Y=B!=null&&typeof B==="object";if(Y){var Q=U?F5??=new WeakMap:W5??=new WeakMap,K=Q.get(B);if(K)return K}G=B!=null?R5(L5(B)):{};let Z=U||!B||!B.__esModule?r1(G,"default",{value:B,enumerable:!0}):G;for(let J of I5(B))if(!O5.call(Z,J))r1(Z,J,{get:H5.bind(B,J),enumerable:!0});if(Y)Q.set(B,Z);return Z};var A5=(B,U)=>()=>(U||B((U={exports:{}}).exports,U),U.exports);var j5=(B)=>B;function N5(B,U){this[B]=j5.bind(null,U)}var w5=(B,U)=>{for(var G in U)r1(B,G,{get:U[G],enumerable:!0,configurable:!0,set:N5.bind(U,G)})};var h6=A5((L7,_6)=>{var z0=_6.exports={},p0,r0;function Z8(){throw Error("setTimeout has not been defined")}function Q8(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")p0=setTimeout;else p0=Z8}catch(B){p0=Z8}try{if(typeof clearTimeout==="function")r0=clearTimeout;else r0=Q8}catch(B){r0=Q8}})();function g6(B){if(p0===setTimeout)return setTimeout(B,0);if((p0===Z8||!p0)&&setTimeout)return p0=setTimeout,setTimeout(B,0);try{return p0(B,0)}catch(U){try{return p0.call(null,B,0)}catch(G){return p0.call(this,B,0)}}}function UU(B){if(r0===clearTimeout)return clearTimeout(B);if((r0===Q8||!r0)&&clearTimeout)return r0=clearTimeout,clearTimeout(B);try{return r0(B)}catch(U){try{return r0.call(null,B)}catch(G){return r0.call(this,B)}}}var Q2=[],b2=!1,z2,w1=-1;function GU(){if(!b2||!z2)return;if(b2=!1,z2.length)Q2=z2.concat(Q2);else w1=-1;if(Q2.length)f6()}function f6(){if(b2)return;var B=g6(GU);b2=!0;var U=Q2.length;while(U){z2=Q2,Q2=[];while(++w11)for(var G=1;G"u")A1.global=globalThis;if(typeof A1.__require>"u")A1.__require=(B)=>{throw Error(`Dynamic require of "${B}" is not supported in the sandbox`)};var l0=[],h0=[],i1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(N2=0,H6=i1.length;N20)throw Error("Invalid string. Length must be a multiple of 4");var G=B.indexOf("=");if(G===-1)G=U;var Y=G===U?0:4-G%4;return[G,Y]}function E5(B,U){return(B+U)*3/4-U}function D5(B){var U,G=z5(B),Y=G[0],Q=G[1],K=new Uint8Array(E5(Y,Q)),Z=0,J=Q>0?Y-4:Y,q;for(q=0;q>16&255,K[Z++]=U>>8&255,K[Z++]=U&255;if(Q===2)U=h0[B.charCodeAt(q)]<<2|h0[B.charCodeAt(q+1)]>>4,K[Z++]=U&255;if(Q===1)U=h0[B.charCodeAt(q)]<<10|h0[B.charCodeAt(q+1)]<<4|h0[B.charCodeAt(q+2)]>>2,K[Z++]=U>>8&255,K[Z++]=U&255;return K}function T5(B){return l0[B>>18&63]+l0[B>>12&63]+l0[B>>6&63]+l0[B&63]}function C5(B,U,G){var Y,Q=[];for(var K=U;KJ?J:Z+K));if(Y===1)U=B[G-1],Q.push(l0[U>>2]+l0[U<<4&63]+"==");else if(Y===2)U=(B[G-2]<<8)+B[G-1],Q.push(l0[U>>10]+l0[U>>4&63]+l0[U<<2&63]+"=");return Q.join("")}function j1(B,U,G,Y,Q){var K,Z,J=Q*8-Y-1,q=(1<>1,I=-7,H=G?Q-1:0,T=G?-1:1,A=B[U+H];H+=T,K=A&(1<<-I)-1,A>>=-I,I+=J;for(;I>0;K=K*256+B[U+H],H+=T,I-=8);Z=K&(1<<-I)-1,K>>=-I,I+=Y;for(;I>0;Z=Z*256+B[U+H],H+=T,I-=8);if(K===0)K=1-W;else if(K===q)return Z?NaN:(A?-1:1)*(1/0);else Z=Z+Math.pow(2,Y),K=K-W;return(A?-1:1)*Z*Math.pow(2,K-Y)}function N6(B,U,G,Y,Q,K){var Z,J,q,W=K*8-Q-1,I=(1<>1,T=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=Y?0:K-1,P=Y?1:-1,j=U<0||U===0&&1/U<0?1:0;if(U=Math.abs(U),isNaN(U)||U===1/0)J=isNaN(U)?1:0,Z=I;else{if(Z=Math.floor(Math.log(U)/Math.LN2),U*(q=Math.pow(2,-Z))<1)Z--,q*=2;if(Z+H>=1)U+=T/q;else U+=T*Math.pow(2,1-H);if(U*q>=2)Z++,q/=2;if(Z+H>=I)J=0,Z=I;else if(Z+H>=1)J=(U*q-1)*Math.pow(2,Q),Z=Z+H;else J=U*Math.pow(2,H-1)*Math.pow(2,Q),Z=0}for(;Q>=8;B[G+A]=J&255,A+=P,J/=256,Q-=8);Z=Z<0;B[G+A]=Z&255,A+=P,Z/=256,W-=8);B[G+A-P]|=j*128}var W6=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,k5=50,n1=2147483647;var{btoa:Z7,atob:Q7,File:J7,Blob:K7}=globalThis;function Z2(B){if(B>n1)throw RangeError('The value "'+B+'" is invalid for option "size"');let U=new Uint8Array(B);return Object.setPrototypeOf(U,J0.prototype),U}function B8(B,U,G){return class extends G{constructor(){super();Object.defineProperty(this,"message",{value:U.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}var $5=B8("ERR_BUFFER_OUT_OF_BOUNDS",function(B){if(B)return`${B} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),S5=B8("ERR_INVALID_ARG_TYPE",function(B,U){return`The "${B}" argument must be of type number. Received type ${typeof U}`},TypeError),s1=B8("ERR_OUT_OF_RANGE",function(B,U,G){let Y=`The value of "${B}" is out of range.`,Q=G;if(Number.isInteger(G)&&Math.abs(G)>4294967296)Q=j6(String(G));else if(typeof G==="bigint"){if(Q=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))Q=j6(Q);Q+="n"}return Y+=` It must be ${U}. Received ${Q}`,Y},RangeError);function J0(B,U,G){if(typeof B==="number"){if(typeof U==="string")throw TypeError('The "string" argument must be of type string. Received type number');return U8(B)}return w6(B,U,G)}Object.defineProperty(J0.prototype,"parent",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.buffer}});Object.defineProperty(J0.prototype,"offset",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.byteOffset}});J0.poolSize=8192;function w6(B,U,G){if(typeof B==="string")return v5(B,U);if(ArrayBuffer.isView(B))return y5(B);if(B==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(a0(B,ArrayBuffer)||B&&a0(B.buffer,ArrayBuffer))return t1(B,U,G);if(typeof SharedArrayBuffer<"u"&&(a0(B,SharedArrayBuffer)||B&&a0(B.buffer,SharedArrayBuffer)))return t1(B,U,G);if(typeof B==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Y=B.valueOf&&B.valueOf();if(Y!=null&&Y!==B)return J0.from(Y,U,G);let Q=g5(B);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]==="function")return J0.from(B[Symbol.toPrimitive]("string"),U,G);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}J0.from=function(B,U,G){return w6(B,U,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);function z6(B){if(typeof B!=="number")throw TypeError('"size" argument must be of type number');else if(B<0)throw RangeError('The value "'+B+'" is invalid for option "size"')}function b5(B,U,G){if(z6(B),B<=0)return Z2(B);if(U!==void 0)return typeof G==="string"?Z2(B).fill(U,G):Z2(B).fill(U);return Z2(B)}J0.alloc=function(B,U,G){return b5(B,U,G)};function U8(B){return z6(B),Z2(B<0?0:G8(B)|0)}J0.allocUnsafe=function(B){return U8(B)};J0.allocUnsafeSlow=function(B){return U8(B)};function v5(B,U){if(typeof U!=="string"||U==="")U="utf8";if(!J0.isEncoding(U))throw TypeError("Unknown encoding: "+U);let G=E6(B,U)|0,Y=Z2(G),Q=Y.write(B,U);if(Q!==G)Y=Y.slice(0,Q);return Y}function o1(B){let U=B.length<0?0:G8(B.length)|0,G=Z2(U);for(let Y=0;Y=n1)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n1.toString(16)+" bytes");return B|0}J0.isBuffer=function(B){return B!=null&&B._isBuffer===!0&&B!==J0.prototype};J0.compare=function(B,U){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(a0(U,Uint8Array))U=J0.from(U,U.offset,U.byteLength);if(!J0.isBuffer(B)||!J0.isBuffer(U))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(B===U)return 0;let G=B.length,Y=U.length;for(let Q=0,K=Math.min(G,Y);QY.length){if(!J0.isBuffer(K))K=J0.from(K);K.copy(Y,Q)}else Uint8Array.prototype.set.call(Y,K,Q);else if(!J0.isBuffer(K))throw TypeError('"list" argument must be an Array of Buffers');else K.copy(Y,Q);Q+=K.length}return Y};function E6(B,U){if(J0.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||a0(B,ArrayBuffer))return B.byteLength;if(typeof B!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);let G=B.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&G===0)return 0;let Q=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return e1(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return y6(B).length;default:if(Q)return Y?-1:e1(B).length;U=(""+U).toLowerCase(),Q=!0}}J0.byteLength=E6;function f5(B,U,G){let Y=!1;if(U===void 0||U<0)U=0;if(U>this.length)return"";if(G===void 0||G>this.length)G=this.length;if(G<=0)return"";if(G>>>=0,U>>>=0,G<=U)return"";if(!B)B="utf8";while(!0)switch(B){case"hex":return p5(this,U,G);case"utf8":case"utf-8":return T6(this,U,G);case"ascii":return l5(this,U,G);case"latin1":case"binary":return a5(this,U,G);case"base64":return c5(this,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r5(this,U,G);default:if(Y)throw TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),Y=!0}}J0.prototype._isBuffer=!0;function w2(B,U,G){let Y=B[U];B[U]=B[G],B[G]=Y}J0.prototype.swap16=function(){let B=this.length;if(B%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let U=0;UU)B+=" ... ";return""};if(W6)J0.prototype[W6]=J0.prototype.inspect;J0.prototype.compare=function(B,U,G,Y,Q){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(!J0.isBuffer(B))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof B);if(U===void 0)U=0;if(G===void 0)G=B?B.length:0;if(Y===void 0)Y=0;if(Q===void 0)Q=this.length;if(U<0||G>B.length||Y<0||Q>this.length)throw RangeError("out of range index");if(Y>=Q&&U>=G)return 0;if(Y>=Q)return-1;if(U>=G)return 1;if(U>>>=0,G>>>=0,Y>>>=0,Q>>>=0,this===B)return 0;let K=Q-Y,Z=G-U,J=Math.min(K,Z),q=this.slice(Y,Q),W=B.slice(U,G);for(let I=0;I2147483647)G=2147483647;else if(G<-2147483648)G=-2147483648;if(G=+G,Number.isNaN(G))G=Q?0:B.length-1;if(G<0)G=B.length+G;if(G>=B.length)if(Q)return-1;else G=B.length-1;else if(G<0)if(Q)G=0;else return-1;if(typeof U==="string")U=J0.from(U,Y);if(J0.isBuffer(U)){if(U.length===0)return-1;return P6(B,U,G,Y,Q)}else if(typeof U==="number"){if(U=U&255,typeof Uint8Array.prototype.indexOf==="function")if(Q)return Uint8Array.prototype.indexOf.call(B,U,G);else return Uint8Array.prototype.lastIndexOf.call(B,U,G);return P6(B,[U],G,Y,Q)}throw TypeError("val must be string, number or Buffer")}function P6(B,U,G,Y,Q){let K=1,Z=B.length,J=U.length;if(Y!==void 0){if(Y=String(Y).toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le"){if(B.length<2||U.length<2)return-1;K=2,Z/=2,J/=2,G/=2}}function q(I,H){if(K===1)return I[H];else return I.readUInt16BE(H*K)}let W;if(Q){let I=-1;for(W=G;WZ)G=Z-J;for(W=G;W>=0;W--){let I=!0;for(let H=0;HQ)Y=Q;let K=U.length;if(Y>K/2)Y=K/2;let Z;for(Z=0;Z>>0,isFinite(G)){if(G=G>>>0,Y===void 0)Y="utf8"}else Y=G,G=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-U;if(G===void 0||G>Q)G=Q;if(B.length>0&&(G<0||U<0)||U>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!Y)Y="utf8";let K=!1;for(;;)switch(Y){case"hex":return x5(this,B,U,G);case"utf8":case"utf-8":return _5(this,B,U,G);case"ascii":case"latin1":case"binary":return h5(this,B,U,G);case"base64":return u5(this,B,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d5(this,B,U,G);default:if(K)throw TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),K=!0}};J0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c5(B,U,G){if(U===0&&G===B.length)return F6(B);else return F6(B.slice(U,G))}function T6(B,U,G){G=Math.min(B.length,G);let Y=[],Q=U;while(Q239?4:K>223?3:K>191?2:1;if(Q+J<=G){let q,W,I,H;switch(J){case 1:if(K<128)Z=K;break;case 2:if(q=B[Q+1],(q&192)===128){if(H=(K&31)<<6|q&63,H>127)Z=H}break;case 3:if(q=B[Q+1],W=B[Q+2],(q&192)===128&&(W&192)===128){if(H=(K&15)<<12|(q&63)<<6|W&63,H>2047&&(H<55296||H>57343))Z=H}break;case 4:if(q=B[Q+1],W=B[Q+2],I=B[Q+3],(q&192)===128&&(W&192)===128&&(I&192)===128){if(H=(K&15)<<18|(q&63)<<12|(W&63)<<6|I&63,H>65535&&H<1114112)Z=H}}}if(Z===null)Z=65533,J=1;else if(Z>65535)Z-=65536,Y.push(Z>>>10&1023|55296),Z=56320|Z&1023;Y.push(Z),Q+=J}return m5(Y)}var A6=4096;function m5(B){let U=B.length;if(U<=A6)return String.fromCharCode.apply(String,B);let G="",Y=0;while(YY)G=Y;let Q="";for(let K=U;KG)B=G;if(U<0){if(U+=G,U<0)U=0}else if(U>G)U=G;if(UG)throw RangeError("Trying to access beyond buffer length")}J0.prototype.readUintLE=J0.prototype.readUIntLE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B+--U],Q=1;while(U>0&&(Q*=256))Y+=this[B+--U]*Q;return Y};J0.prototype.readUint8=J0.prototype.readUInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);return this[B]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]|this[B+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]<<8|this[B+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return(this[B]|this[B+1]<<8|this[B+2]<<16)+this[B+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]*16777216+(this[B+1]<<16|this[B+2]<<8|this[B+3])};J0.prototype.readBigUInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U+this[++B]*256+this[++B]*65536+this[++B]*16777216,Q=this[++B]+this[++B]*256+this[++B]*65536+G*16777216;return BigInt(Y)+(BigInt(Q)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U*16777216+this[++B]*65536+this[++B]*256+this[++B],Q=this[++B]*16777216+this[++B]*65536+this[++B]*256+G;return(BigInt(Y)<>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K=Q)Y-=Math.pow(2,8*U);return Y};J0.prototype.readIntBE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=U,Q=1,K=this[B+--Y];while(Y>0&&(Q*=256))K+=this[B+--Y]*Q;if(Q*=128,K>=Q)K-=Math.pow(2,8*U);return K};J0.prototype.readInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);if(!(this[B]&128))return this[B];return(255-this[B]+1)*-1};J0.prototype.readInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B]|this[B+1]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B+1]|this[B]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]|this[B+1]<<8|this[B+2]<<16|this[B+3]<<24};J0.prototype.readInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]<<24|this[B+1]<<16|this[B+2]<<8|this[B+3]};J0.prototype.readBigInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=this[B+4]+this[B+5]*256+this[B+6]*65536+(G<<24);return(BigInt(Y)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=(U<<24)+this[++B]*65536+this[++B]*256+this[++B];return(BigInt(Y)<>>0,!U)$0(B,4,this.length);return j1(this,B,!0,23,4)};J0.prototype.readFloatBE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return j1(this,B,!1,23,4)};J0.prototype.readDoubleLE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!0,52,8)};J0.prototype.readDoubleBE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!1,52,8)};function g0(B,U,G,Y,Q,K){if(!J0.isBuffer(B))throw TypeError('"buffer" argument must be a Buffer instance');if(U>Q||UB.length)throw RangeError("Index out of range")}J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=1,K=0;this[U]=B&255;while(++K>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=G-1,K=1;this[U+Q]=B&255;while(--Q>=0&&(K*=256))this[U+Q]=B/K&255;return U+G};J0.prototype.writeUint8=J0.prototype.writeUInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,255,0);return this[U]=B&255,U+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U+3]=B>>>24,this[U+2]=B>>>16,this[U+1]=B>>>8,this[U]=B&255,U+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};function C6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,G}function k6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G+7]=K,K=K>>8,B[G+6]=K,K=K>>8,B[G+5]=K,K=K>>8,B[G+4]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G+3]=Z,Z=Z>>8,B[G+2]=Z,Z=Z>>8,B[G+1]=Z,Z=Z>>8,B[G]=Z,G+8}J0.prototype.writeBigUInt64LE=I2(function(B,U=0){return C6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=I2(function(B,U=0){return k6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=0,K=1,Z=0;this[U]=B&255;while(++Q>0)-Z&255}return U+G};J0.prototype.writeIntBE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=G-1,K=1,Z=0;this[U+Q]=B&255;while(--Q>=0&&(K*=256)){if(B<0&&Z===0&&this[U+Q+1]!==0)Z=1;this[U+Q]=(B/K>>0)-Z&255}return U+G};J0.prototype.writeInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,127,-128);if(B<0)B=255+B+1;return this[U]=B&255,U+1};J0.prototype.writeInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);return this[U]=B&255,this[U+1]=B>>>8,this[U+2]=B>>>16,this[U+3]=B>>>24,U+4};J0.prototype.writeInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);if(B<0)B=4294967295+B+1;return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};J0.prototype.writeBigInt64LE=I2(function(B,U=0){return C6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=I2(function(B,U=0){return k6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $6(B,U,G,Y,Q,K){if(G+Y>B.length)throw RangeError("Index out of range");if(G<0)throw RangeError("Index out of range")}function S6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return N6(B,U,G,Y,23,4),G+4}J0.prototype.writeFloatLE=function(B,U,G){return S6(this,B,U,!0,G)};J0.prototype.writeFloatBE=function(B,U,G){return S6(this,B,U,!1,G)};function b6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return N6(B,U,G,Y,52,8),G+8}J0.prototype.writeDoubleLE=function(B,U,G){return b6(this,B,U,!0,G)};J0.prototype.writeDoubleBE=function(B,U,G){return b6(this,B,U,!1,G)};J0.prototype.copy=function(B,U,G,Y){if(!J0.isBuffer(B))throw TypeError("argument should be a Buffer");if(!G)G=0;if(!Y&&Y!==0)Y=this.length;if(U>=B.length)U=B.length;if(!U)U=0;if(Y>0&&Y=this.length)throw RangeError("Index out of range");if(Y<0)throw RangeError("sourceEnd out of bounds");if(Y>this.length)Y=this.length;if(B.length-U>>0,G=G===void 0?this.length:G>>>0,!B)B=0;let Q;if(typeof B==="number")for(Q=U;Q=Y+4;G-=3)U=`_${B.slice(G-3,G)}${U}`;return`${B.slice(0,G)}${U}`}function i5(B,U,G){if(S2(U,"offset"),B[U]===void 0||B[U+G]===void 0)n2(U,B.length-(G+1))}function v6(B,U,G,Y,Q,K){if(B>G||B3)if(U===0||U===BigInt(0))J=`>= 0${Z} and < 2${Z} ** ${(K+1)*8}${Z}`;else J=`>= -(2${Z} ** ${(K+1)*8-1}${Z}) and < 2 ** ${(K+1)*8-1}${Z}`;else J=`>= ${U}${Z} and <= ${G}${Z}`;throw new s1("value",J,B)}i5(Y,Q,K)}function S2(B,U){if(typeof B!=="number")throw new S5(U,"number",B)}function n2(B,U,G){if(Math.floor(B)!==B)throw S2(B,G),new s1(G||"offset","an integer",B);if(U<0)throw new $5;throw new s1(G||"offset",`>= ${G?1:0} and <= ${U}`,B)}var n5=/[^+/0-9A-Za-z-_]/g;function s5(B){if(B=B.split("=")[0],B=B.trim().replace(n5,""),B.length<2)return"";while(B.length%4!==0)B=B+"=";return B}function e1(B,U){U=U||1/0;let G,Y=B.length,Q=null,K=[];for(let Z=0;Z55295&&G<57344){if(!Q){if(G>56319){if((U-=3)>-1)K.push(239,191,189);continue}else if(Z+1===Y){if((U-=3)>-1)K.push(239,191,189);continue}Q=G;continue}if(G<56320){if((U-=3)>-1)K.push(239,191,189);Q=G;continue}G=(Q-55296<<10|G-56320)+65536}else if(Q){if((U-=3)>-1)K.push(239,191,189)}if(Q=null,G<128){if((U-=1)<0)break;K.push(G)}else if(G<2048){if((U-=2)<0)break;K.push(G>>6|192,G&63|128)}else if(G<65536){if((U-=3)<0)break;K.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((U-=4)<0)break;K.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw Error("Invalid code point")}return K}function o5(B){let U=[];for(let G=0;G>8,Q=G%256,K.push(Q),K.push(Y)}return K}function y6(B){return D5(s5(B))}function N1(B,U,G,Y){let Q;for(Q=0;Q=U.length||Q>=B.length)break;U[Q+G]=B[Q]}return Q}function a0(B,U){return B instanceof U||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===U.name}var e5=function(){let B=Array(256);for(let U=0;U<16;++U){let G=U*16;for(let Y=0;Y<16;++Y)B[G+Y]="0123456789abcdef"[U]+"0123456789abcdef"[Y]}return B}();function I2(B){return typeof BigInt>"u"?BU:B}function BU(){throw Error("BigInt not supported")}function Y8(B){return()=>{throw Error(B+" is not implemented for node:buffer browser polyfill")}}var V7=Y8("resolveObjectURL"),X7=Y8("isUtf8");var q7=Y8("transcode");var G7=P5(h6(),1);var L6={};w5(L6,{unsignedDecimalNumber:()=>X1,universalMeasureValue:()=>q1,uniqueUuid:()=>eB,uniqueNumericIdCreator:()=>I1,uniqueId:()=>O1,uCharHexNumber:()=>W8,twipsMeasureValue:()=>E0,standardizeData:()=>j4,signedTwipsMeasureValue:()=>t0,signedHpsMeasureValue:()=>VG,shortHexNumber:()=>SB,sectionPageSizeDefaults:()=>$1,sectionMarginDefaults:()=>H2,positiveUniversalMeasureValue:()=>d8,pointMeasureValue:()=>gB,percentageValue:()=>vB,patchDocument:()=>tK,patchDetector:()=>B7,measurementOrPercentValue:()=>c8,longHexNumber:()=>KG,hpsMeasureValue:()=>bB,hexColorValue:()=>C2,hashedId:()=>P8,encodeUtf8:()=>U1,eighthPointMeasureValue:()=>yB,docPropertiesUniqueNumericIdGen:()=>oB,decimalNumber:()=>T0,dateTimeValue:()=>fB,createWrapTopAndBottom:()=>H4,createWrapTight:()=>O4,createWrapSquare:()=>I4,createWrapNone:()=>j8,createVerticalPosition:()=>J4,createVerticalAlign:()=>U6,createUnderline:()=>cB,createTransformation:()=>n8,createTableWidthElement:()=>J1,createTableRowHeight:()=>W9,createTableLook:()=>F9,createTableLayout:()=>O9,createTableFloatProperties:()=>I9,createTabStopItem:()=>b4,createTabStop:()=>v4,createStringElement:()=>f2,createSpacing:()=>S4,createSimplePos:()=>G4,createShading:()=>M1,createSectionType:()=>C9,createRunFonts:()=>T1,createParagraphStyle:()=>x2,createPageSize:()=>D9,createPageNumberType:()=>E9,createPageMargin:()=>z9,createOutlineLevel:()=>_4,createMathSuperScriptProperties:()=>p4,createMathSuperScriptElement:()=>a2,createMathSubSuperScriptProperties:()=>i4,createMathSubScriptProperties:()=>r4,createMathSubScriptElement:()=>l2,createMathPreSubSuperScriptProperties:()=>n4,createMathNAryProperties:()=>e8,createMathLimitLocation:()=>a4,createMathBase:()=>y0,createMathAccentCharacter:()=>l4,createLineNumberType:()=>N9,createIndent:()=>hB,createHorizontalPosition:()=>Q4,createHeaderFooterReference:()=>k1,createFrameProperties:()=>u4,createEmphasisMark:()=>r8,createDotEmphasisMark:()=>AG,createDocumentGrid:()=>j9,createColumns:()=>A9,createBorderElement:()=>j0,createBodyProperties:()=>K4,createAlignment:()=>m8,convertToXmlComponent:()=>u1,convertMillimetersToTwip:()=>dG,convertInchesToTwip:()=>u0,concreteNumUniqueNumericIdGen:()=>sB,commentIdToParaId:()=>w4,bookmarkUniqueNumericIdGen:()=>tB,abstractNumUniqueNumericIdGen:()=>nB,YearShort:()=>oY,YearLong:()=>BZ,XmlComponent:()=>t,XmlAttributeComponent:()=>H0,WpsShapeRun:()=>SY,WpgGroupRun:()=>bY,WidthType:()=>v1,WORKAROUND4:()=>oZ,WORKAROUND3:()=>JG,WORKAROUND2:()=>NJ,VerticalPositionRelativeFrom:()=>U4,VerticalPositionAlign:()=>MG,VerticalMergeType:()=>G6,VerticalMergeRevisionType:()=>FQ,VerticalMerge:()=>z8,VerticalAnchor:()=>cG,VerticalAlignTable:()=>K9,VerticalAlignSection:()=>V9,VerticalAlign:()=>WQ,UnderlineType:()=>i8,ThematicBreak:()=>_B,Textbox:()=>TK,TextWrappingType:()=>e2,TextWrappingSide:()=>L4,TextRun:()=>Q1,TextEffect:()=>CG,TextDirection:()=>wQ,TableRowPropertiesChange:()=>P9,TableRowProperties:()=>J6,TableRow:()=>fQ,TableProperties:()=>Q6,TableOfContents:()=>RK,TableLayoutType:()=>SQ,TableCellBorders:()=>q9,TableCell:()=>Y6,TableBorders:()=>Z6,TableAnchorType:()=>DQ,Table:()=>yQ,TabStopType:()=>w8,TabStopPosition:()=>FZ,Tab:()=>T4,TDirection:()=>R9,SymbolRun:()=>aB,Styles:()=>S1,StyleLevel:()=>LK,StyleForParagraph:()=>p2,StyleForCharacter:()=>$2,StringValueElement:()=>q2,StringEnumValueElement:()=>XG,StringContainer:()=>O2,SpaceType:()=>x0,SoftHyphen:()=>iY,SimpleMailMergeField:()=>fY,SimpleField:()=>s8,ShadingType:()=>FG,SequentialIdentifier:()=>yY,Separator:()=>YZ,SectionType:()=>GJ,SectionPropertiesChange:()=>k9,SectionProperties:()=>K6,RunPropertiesDefaults:()=>a9,RunPropertiesChange:()=>lB,RunProperties:()=>U2,Run:()=>D0,RelativeVerticalPosition:()=>CQ,RelativeHorizontalPosition:()=>TQ,PrettifyType:()=>G5,PositionalTabRelativeTo:()=>XZ,PositionalTabLeader:()=>qZ,PositionalTabAlignment:()=>VZ,PositionalTab:()=>RZ,PatchType:()=>C8,ParagraphRunProperties:()=>mB,ParagraphPropertiesDefaults:()=>l9,ParagraphPropertiesChange:()=>d4,ParagraphProperties:()=>M2,Paragraph:()=>d0,PageTextDirectionType:()=>BJ,PageTextDirection:()=>T9,PageReference:()=>CZ,PageOrientation:()=>g1,PageNumberSeparator:()=>eQ,PageNumberElement:()=>QZ,PageNumber:()=>F2,PageBreakBefore:()=>$4,PageBreak:()=>LZ,PageBorders:()=>w9,PageBorderZOrder:()=>tQ,PageBorderOffsetFrom:()=>oQ,PageBorderDisplay:()=>sQ,Packer:()=>Y5,OverlapType:()=>kQ,OnOffElement:()=>q0,Numbering:()=>d9,NumberedItemReferenceFormat:()=>zZ,NumberedItemReference:()=>DZ,NumberValueElement:()=>_2,NumberProperties:()=>C1,NumberFormat:()=>RG,NoBreakHyphen:()=>rY,NextAttributeComponent:()=>$8,MonthShort:()=>sY,MonthLong:()=>eY,Media:()=>V6,MathSuperScript:()=>rZ,MathSum:()=>mZ,MathSubSuperScript:()=>nZ,MathSubScript:()=>iZ,MathSquareBrackets:()=>QQ,MathRun:()=>hZ,MathRoundBrackets:()=>ZQ,MathRadicalProperties:()=>o4,MathRadical:()=>BQ,MathPreSubSuperScript:()=>sZ,MathNumerator:()=>m4,MathLimitUpper:()=>aZ,MathLimitLower:()=>pZ,MathLimit:()=>B6,MathIntegral:()=>lZ,MathFunctionProperties:()=>e4,MathFunctionName:()=>t4,MathFunction:()=>UQ,MathFraction:()=>uZ,MathDenominator:()=>c4,MathDegree:()=>s4,MathCurlyBrackets:()=>JQ,MathAngledBrackets:()=>KQ,Math:()=>xZ,LineRuleType:()=>k2,LineNumberRestartFormat:()=>nQ,LevelSuffix:()=>TJ,LevelOverride:()=>u9,LevelFormat:()=>i0,LevelForOverride:()=>$J,LevelBase:()=>X6,Level:()=>h9,LeaderType:()=>HZ,LastRenderedPageBreak:()=>KZ,InternalHyperlink:()=>y4,InsertedTextRun:()=>MQ,InsertedTableRow:()=>U9,InsertedTableCell:()=>Y9,InitializableXmlComponent:()=>u8,ImportedXmlComponent:()=>kB,ImportedRootElementAttributes:()=>$B,ImageRun:()=>$Y,IgnoreIfEmptyXmlComponent:()=>R2,HyperlinkType:()=>jZ,HpsMeasureElement:()=>D1,HorizontalPositionRelativeFrom:()=>B4,HorizontalPositionAlign:()=>qG,HighlightColor:()=>kG,HeightRule:()=>gQ,HeadingLevel:()=>OZ,HeaderWrapper:()=>_9,HeaderFooterType:()=>E8,HeaderFooterReferenceType:()=>T2,Header:()=>IK,GridSpan:()=>M9,FrameWrap:()=>fZ,FrameAnchorType:()=>gZ,FootnoteReferenceRun:()=>HK,FootnoteReferenceElement:()=>GZ,FootnoteReference:()=>o9,FooterWrapper:()=>f9,Footer:()=>OK,FootNotes:()=>x9,FootNoteReferenceRunAttributes:()=>s9,FileChild:()=>H1,File:()=>VK,ExternalHyperlink:()=>t8,Endnotes:()=>g9,EndnoteReferenceRunAttributes:()=>t9,EndnoteReferenceRun:()=>FK,EndnoteReference:()=>D4,EndnoteIdReference:()=>e9,EmptyElement:()=>S0,EmphasisMarkType:()=>p8,EMPTY_OBJECT:()=>KB,DropCapType:()=>yZ,Drawing:()=>m1,DocumentGridType:()=>iQ,DocumentDefaults:()=>p9,DocumentBackgroundAttributes:()=>S9,DocumentBackground:()=>b9,DocumentAttributes:()=>F1,DocumentAttributeNamespaces:()=>y1,Document:()=>VK,DeletedTextRun:()=>OQ,DeletedTableRow:()=>G9,DeletedTableCell:()=>Z9,DayShort:()=>nY,DayLong:()=>tY,ContinuationSeparator:()=>ZZ,ConcreteNumbering:()=>T8,ConcreteHyperlink:()=>m2,CommentsExtended:()=>E4,Comments:()=>z4,CommentReference:()=>mY,CommentRangeStart:()=>dY,CommentRangeEnd:()=>cY,Comment:()=>N8,ColumnBreak:()=>IZ,Column:()=>ZJ,CheckBoxUtil:()=>B5,CheckBoxSymbolElement:()=>b1,CheckBox:()=>WK,CharacterSet:()=>kZ,CellMergeAttributes:()=>Q9,CellMerge:()=>J9,CarriageReturn:()=>JZ,BuilderElement:()=>M0,BorderStyle:()=>c1,Border:()=>xB,BookmarkStart:()=>f4,BookmarkEnd:()=>x4,Bookmark:()=>g4,Body:()=>$9,BaseXmlComponent:()=>Y1,Attributes:()=>C0,AnnotationReference:()=>UZ,AlignmentType:()=>c0,AbstractNumbering:()=>D8});var{create:YU,defineProperty:QB,getOwnPropertyDescriptor:ZU,getOwnPropertyNames:QU,getPrototypeOf:JU}=Object,KU=Object.prototype.hasOwnProperty,JB=(B,U)=>()=>(B&&(U=B(B=0)),U),R0=(B,U)=>()=>(U||(B((U={exports:{}}).exports,U),B=null),U.exports),VU=(B,U,G,Y)=>{if(U&&typeof U==="object"||typeof U==="function"){for(var Q=QU(U),K=0,Z=Q.length,J;KU[q]).bind(null,J),enumerable:!(Y=ZU(U,J))||Y.enumerable})}return B},k8=(B,U,G)=>(G=B!=null?YU(JU(B)):{},VU(U||!B||!B.__esModule?QB(G,"default",{value:B,enumerable:!0}):G,B)),z1=((B)=>__require)(function(B){return __require.apply(this,arguments)});function G1(B){return G1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},G1(B)}function XU(B,U){if(G1(B)!="object"||!B)return B;var G=B[Symbol.toPrimitive];if(G!==void 0){var Y=G.call(B,U||"default");if(G1(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return(U==="string"?String:Number)(B)}function qU(B){var U=XU(B,"string");return G1(U)=="symbol"?U:U+""}function e(B,U,G){return(U=qU(U))in B?Object.defineProperty(B,U,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[U]=G,B}var Y1=class{constructor(B){e(this,"rootKey",void 0),this.rootKey=B}},KB=Object.seal({}),t=class extends Y1{constructor(B){super(B);e(this,"root",void 0),this.root=[]}prepForXml(B){var U;B.stack.push(this);let G=this.root.map((Y)=>{if(Y instanceof Y1)return Y.prepForXml(B);return Y}).filter((Y)=>Y!==void 0);return B.stack.pop(),{[this.rootKey]:G.length?G.length===1&&((U=G[0])===null||U===void 0?void 0:U._attr)?G[0]:G:KB}}addChildElement(B){return this.root.push(B),this}},R2=class extends t{constructor(B,U){super(B);e(this,"includeIfEmpty",void 0),this.includeIfEmpty=U}prepForXml(B){let U=super.prepForXml(B);if(this.includeIfEmpty)return U;if(U&&(typeof U[this.rootKey]!=="object"||Object.keys(U[this.rootKey]).length))return U}};function u6(B,U){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);U&&(Y=Y.filter(function(Q){return Object.getOwnPropertyDescriptor(B,Q).enumerable})),G.push.apply(G,Y)}return G}function L0(B){for(var U=1;U{if(Y!==void 0){let Q=this.xmlKeys&&this.xmlKeys[G]||G;U[Q]=Y}}),{_attr:U}}},$8=class extends Y1{constructor(B){super("_attr");e(this,"root",void 0),this.root=B}prepForXml(B){return{_attr:Object.values(this.root).filter(({value:U})=>U!==void 0).reduce((U,{key:G,value:Y})=>L0(L0({},U),{},{[G]:Y}),{})}}},C0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}},S8=R0((B,U)=>{var G=typeof Reflect==="object"?Reflect:null,Y=G&&typeof G.apply==="function"?G.apply:function($,x,w){return Function.prototype.apply.call($,x,w)},Q;if(G&&typeof G.ownKeys==="function")Q=G.ownKeys;else if(Object.getOwnPropertySymbols)Q=function($){return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($))};else Q=function($){return Object.getOwnPropertyNames($)};function K(M){if(console&&console.warn)console.warn(M)}var Z=Number.isNaN||function($){return $!==$};function J(){J.init.call(this)}U.exports=J,U.exports.once=v,J.EventEmitter=J,J.prototype._events=void 0,J.prototype._eventsCount=0,J.prototype._maxListeners=void 0;var q=10;function W(M){if(typeof M!=="function")throw TypeError('The "listener" argument must be of type Function. Received type '+typeof M)}Object.defineProperty(J,"defaultMaxListeners",{enumerable:!0,get:function(){return q},set:function(M){if(typeof M!=="number"||M<0||Z(M))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+M+".");q=M}}),J.init=function(){if(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)this._events=Object.create(null),this._eventsCount=0;this._maxListeners=this._maxListeners||void 0},J.prototype.setMaxListeners=function($){if(typeof $!=="number"||$<0||Z($))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+$+".");return this._maxListeners=$,this};function I(M){if(M._maxListeners===void 0)return J.defaultMaxListeners;return M._maxListeners}J.prototype.getMaxListeners=function(){return I(this)},J.prototype.emit=function($){var x=[];for(var w=1;w0)b=x[0];if(b instanceof Error)throw b;var c=Error("Unhandled error."+(b?" ("+b.message+")":""));throw c.context=b,c}var D=U0[$];if(D===void 0)return!1;if(typeof D==="function")Y(D,this,x);else{var m=D.length,B0=E(D,m);for(var w=0;w0&&b.length>a&&!b.warned){b.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+b.length+" "+String($)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=M,c.type=$,c.count=b.length,K(c)}}return M}J.prototype.addListener=function($,x){return H(this,$,x,!1)},J.prototype.on=J.prototype.addListener,J.prototype.prependListener=function($,x){return H(this,$,x,!0)};function T(){if(!this.fired){if(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0)return this.listener.call(this.target);return this.listener.apply(this.target,arguments)}}function A(M,$,x){var w={fired:!1,wrapFn:void 0,target:M,type:$,listener:x},a=T.bind(w);return a.listener=x,w.wrapFn=a,a}J.prototype.once=function($,x){return W(x),this.on($,A(this,$,x)),this},J.prototype.prependOnceListener=function($,x){return W(x),this.prependListener($,A(this,$,x)),this},J.prototype.removeListener=function($,x){var w,a,U0,b,c;if(W(x),a=this._events,a===void 0)return this;if(w=a[$],w===void 0)return this;if(w===x||w.listener===x){if(--this._eventsCount===0)this._events=Object.create(null);else if(delete a[$],a.removeListener)this.emit("removeListener",$,w.listener||x)}else if(typeof w!=="function"){U0=-1;for(b=w.length-1;b>=0;b--)if(w[b]===x||w[b].listener===x){c=w[b].listener,U0=b;break}if(U0<0)return this;if(U0===0)w.shift();else C(w,U0);if(w.length===1)a[$]=w[0];if(a.removeListener!==void 0)this.emit("removeListener",$,c||x)}return this},J.prototype.off=J.prototype.removeListener,J.prototype.removeAllListeners=function($){var x,w=this._events,a;if(w===void 0)return this;if(w.removeListener===void 0){if(arguments.length===0)this._events=Object.create(null),this._eventsCount=0;else if(w[$]!==void 0)if(--this._eventsCount===0)this._events=Object.create(null);else delete w[$];return this}if(arguments.length===0){var U0=Object.keys(w),b;for(a=0;a=0;a--)this.removeListener($,x[a]);return this};function P(M,$,x){var w=M._events;if(w===void 0)return[];var a=w[$];if(a===void 0)return[];if(typeof a==="function")return x?[a.listener||a]:[a];return x?N(a):E(a,a.length)}J.prototype.listeners=function($){return P(this,$,!0)},J.prototype.rawListeners=function($){return P(this,$,!1)},J.listenerCount=function(M,$){if(typeof M.listenerCount==="function")return M.listenerCount($);else return j.call(M,$)},J.prototype.listenerCount=j;function j(M){var $=this._events;if($!==void 0){var x=$[M];if(typeof x==="function")return 1;else if(x!==void 0)return x.length}return 0}J.prototype.eventNames=function(){return this._eventsCount>0?Q(this._events):[]};function E(M,$){var x=Array($);for(var w=0;w<$;++w)x[w]=M[w];return x}function C(M,$){for(;$+1{if(typeof Object.create==="function")U.exports=function(Y,Q){if(Q)Y.super_=Q,Y.prototype=Object.create(Q.prototype,{constructor:{value:Y,enumerable:!1,writable:!0,configurable:!0}})};else U.exports=function(Y,Q){if(Q){Y.super_=Q;var K=function(){};K.prototype=Q.prototype,Y.prototype=new K,Y.prototype.constructor=Y}}}),v0,d2=JB(()=>{v0=globalThis||self});function MU(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function O8(){throw Error("setTimeout has not been defined")}function H8(){throw Error("clearTimeout has not been defined")}function VB(B){if(n0===setTimeout)return setTimeout(B,0);if((n0===O8||!n0)&&setTimeout)return n0=setTimeout,setTimeout(B,0);try{return n0(B,0)}catch(U){try{return n0.call(null,B,0)}catch(G){return n0.call(this,B,0)}}}function RU(B){if(s0===clearTimeout)return clearTimeout(B);if((s0===H8||!s0)&&clearTimeout)return s0=clearTimeout,clearTimeout(B);try{return s0(B)}catch(U){try{return s0.call(null,B)}catch(G){return s0.call(this,B)}}}function LU(){if(!D2||!E2)return;if(D2=!1,E2.length)o0=E2.concat(o0);else B1=-1;if(o0.length)XB()}function XB(){if(D2)return;var B=VB(LU);D2=!0;var U=o0.length;while(U){E2=o0,o0=[];while(++B1{J8={exports:{}},N0=J8.exports={},function(){try{if(typeof setTimeout==="function")n0=setTimeout;else n0=O8}catch(B){n0=O8}try{if(typeof clearTimeout==="function")s0=clearTimeout;else s0=H8}catch(B){s0=H8}}(),o0=[],D2=!1,B1=-1,N0.nextTick=function(B){var U=Array(arguments.length-1);if(arguments.length>1)for(var G=1;G{U.exports=S8().EventEmitter}),IU=R0((B)=>{B.byteLength=q,B.toByteArray=I,B.fromByteArray=A;var U=[],G=[],Y=typeof Uint8Array<"u"?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var K=0,Z=Q.length;K0)throw Error("Invalid string. Length must be a multiple of 4");var E=P.indexOf("=");if(E===-1)E=j;var C=E===j?0:4-E%4;return[E,C]}function q(P){var j=J(P),E=j[0],C=j[1];return(E+C)*3/4-C}function W(P,j,E){return(j+E)*3/4-E}function I(P){var j,E=J(P),C=E[0],N=E[1],v=new Y(W(P,C,N)),S=0,F=N>0?C-4:C,M;for(M=0;M>16&255,v[S++]=j>>8&255,v[S++]=j&255;if(N===2)j=G[P.charCodeAt(M)]<<2|G[P.charCodeAt(M+1)]>>4,v[S++]=j&255;if(N===1)j=G[P.charCodeAt(M)]<<10|G[P.charCodeAt(M+1)]<<4|G[P.charCodeAt(M+2)]>>2,v[S++]=j>>8&255,v[S++]=j&255;return v}function H(P){return U[P>>18&63]+U[P>>12&63]+U[P>>6&63]+U[P&63]}function T(P,j,E){var C,N=[];for(var v=j;vF?F:S+v));if(C===1)j=P[E-1],N.push(U[j>>2]+U[j<<4&63]+"==");else if(C===2)j=(P[E-2]<<8)+P[E-1],N.push(U[j>>10]+U[j>>4&63]+U[j<<2&63]+"=");return N.join("")}}),OU=R0((B)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */B.read=function(U,G,Y,Q,K){var Z,J,q=K*8-Q-1,W=(1<>1,H=-7,T=Y?K-1:0,A=Y?-1:1,P=U[G+T];T+=A,Z=P&(1<<-H)-1,P>>=-H,H+=q;for(;H>0;Z=Z*256+U[G+T],T+=A,H-=8);J=Z&(1<<-H)-1,Z>>=-H,H+=Q;for(;H>0;J=J*256+U[G+T],T+=A,H-=8);if(Z===0)Z=1-I;else if(Z===W)return J?NaN:(P?-1:1)*(1/0);else J=J+Math.pow(2,Q),Z=Z-I;return(P?-1:1)*J*Math.pow(2,Z-Q)},B.write=function(U,G,Y,Q,K,Z){var J,q,W,I=Z*8-K-1,H=(1<>1,A=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=Q?0:Z-1,j=Q?1:-1,E=G<0||G===0&&1/G<0?1:0;if(G=Math.abs(G),isNaN(G)||G===1/0)q=isNaN(G)?1:0,J=H;else{if(J=Math.floor(Math.log(G)/Math.LN2),G*(W=Math.pow(2,-J))<1)J--,W*=2;if(J+T>=1)G+=A/W;else G+=A*Math.pow(2,1-T);if(G*W>=2)J++,W/=2;if(J+T>=H)q=0,J=H;else if(J+T>=1)q=(G*W-1)*Math.pow(2,K),J=J+T;else q=G*Math.pow(2,T-1)*Math.pow(2,K),J=0}for(;K>=8;U[Y+P]=q&255,P+=j,q/=256,K-=8);J=J<0;U[Y+P]=J&255,P+=j,J/=256,I-=8);U[Y+P-j]|=E*128}});/*! +(()=>{var R5=Object.create;var{getPrototypeOf:L5,defineProperty:r1,getOwnPropertyNames:I5}=Object;var O5=Object.prototype.hasOwnProperty;function H5(B){return this[B]}var F5,W5,P5=(B,U,G)=>{var Y=B!=null&&typeof B==="object";if(Y){var Q=U?F5??=new WeakMap:W5??=new WeakMap,K=Q.get(B);if(K)return K}G=B!=null?R5(L5(B)):{};let Z=U||!B||!B.__esModule?r1(G,"default",{value:B,enumerable:!0}):G;for(let J of I5(B))if(!O5.call(Z,J))r1(Z,J,{get:H5.bind(B,J),enumerable:!0});if(Y)Q.set(B,Z);return Z};var A5=(B,U)=>()=>(U||B((U={exports:{}}).exports,U),U.exports);var j5=(B)=>B;function N5(B,U){this[B]=j5.bind(null,U)}var z5=(B,U)=>{for(var G in U)r1(B,G,{get:U[G],enumerable:!0,configurable:!0,set:N5.bind(U,G)})};var h6=A5((L7,_6)=>{var w0=_6.exports={},p0,r0;function Z8(){throw Error("setTimeout has not been defined")}function Q8(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")p0=setTimeout;else p0=Z8}catch(B){p0=Z8}try{if(typeof clearTimeout==="function")r0=clearTimeout;else r0=Q8}catch(B){r0=Q8}})();function g6(B){if(p0===setTimeout)return setTimeout(B,0);if((p0===Z8||!p0)&&setTimeout)return p0=setTimeout,setTimeout(B,0);try{return p0(B,0)}catch(U){try{return p0.call(null,B,0)}catch(G){return p0.call(this,B,0)}}}function UU(B){if(r0===clearTimeout)return clearTimeout(B);if((r0===Q8||!r0)&&clearTimeout)return r0=clearTimeout,clearTimeout(B);try{return r0(B)}catch(U){try{return r0.call(null,B)}catch(G){return r0.call(this,B)}}}var Q2=[],b2=!1,w2,z1=-1;function GU(){if(!b2||!w2)return;if(b2=!1,w2.length)Q2=w2.concat(Q2);else z1=-1;if(Q2.length)f6()}function f6(){if(b2)return;var B=g6(GU);b2=!0;var U=Q2.length;while(U){w2=Q2,Q2=[];while(++z11)for(var G=1;G"u")A1.global=globalThis;if(typeof A1.__require>"u")A1.__require=(B)=>{throw Error(`Dynamic require of "${B}" is not supported in the sandbox`)};var l0=[],h0=[],i1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(N2=0,H6=i1.length;N20)throw Error("Invalid string. Length must be a multiple of 4");var G=B.indexOf("=");if(G===-1)G=U;var Y=G===U?0:4-G%4;return[G,Y]}function E5(B,U){return(B+U)*3/4-U}function D5(B){var U,G=w5(B),Y=G[0],Q=G[1],K=new Uint8Array(E5(Y,Q)),Z=0,J=Q>0?Y-4:Y,q;for(q=0;q>16&255,K[Z++]=U>>8&255,K[Z++]=U&255;if(Q===2)U=h0[B.charCodeAt(q)]<<2|h0[B.charCodeAt(q+1)]>>4,K[Z++]=U&255;if(Q===1)U=h0[B.charCodeAt(q)]<<10|h0[B.charCodeAt(q+1)]<<4|h0[B.charCodeAt(q+2)]>>2,K[Z++]=U>>8&255,K[Z++]=U&255;return K}function T5(B){return l0[B>>18&63]+l0[B>>12&63]+l0[B>>6&63]+l0[B&63]}function C5(B,U,G){var Y,Q=[];for(var K=U;KJ?J:Z+K));if(Y===1)U=B[G-1],Q.push(l0[U>>2]+l0[U<<4&63]+"==");else if(Y===2)U=(B[G-2]<<8)+B[G-1],Q.push(l0[U>>10]+l0[U>>4&63]+l0[U<<2&63]+"=");return Q.join("")}function j1(B,U,G,Y,Q){var K,Z,J=Q*8-Y-1,q=(1<>1,I=-7,H=G?Q-1:0,T=G?-1:1,A=B[U+H];H+=T,K=A&(1<<-I)-1,A>>=-I,I+=J;for(;I>0;K=K*256+B[U+H],H+=T,I-=8);Z=K&(1<<-I)-1,K>>=-I,I+=Y;for(;I>0;Z=Z*256+B[U+H],H+=T,I-=8);if(K===0)K=1-W;else if(K===q)return Z?NaN:(A?-1:1)*(1/0);else Z=Z+Math.pow(2,Y),K=K-W;return(A?-1:1)*Z*Math.pow(2,K-Y)}function N6(B,U,G,Y,Q,K){var Z,J,q,W=K*8-Q-1,I=(1<>1,T=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=Y?0:K-1,P=Y?1:-1,j=U<0||U===0&&1/U<0?1:0;if(U=Math.abs(U),isNaN(U)||U===1/0)J=isNaN(U)?1:0,Z=I;else{if(Z=Math.floor(Math.log(U)/Math.LN2),U*(q=Math.pow(2,-Z))<1)Z--,q*=2;if(Z+H>=1)U+=T/q;else U+=T*Math.pow(2,1-H);if(U*q>=2)Z++,q/=2;if(Z+H>=I)J=0,Z=I;else if(Z+H>=1)J=(U*q-1)*Math.pow(2,Q),Z=Z+H;else J=U*Math.pow(2,H-1)*Math.pow(2,Q),Z=0}for(;Q>=8;B[G+A]=J&255,A+=P,J/=256,Q-=8);Z=Z<0;B[G+A]=Z&255,A+=P,Z/=256,W-=8);B[G+A-P]|=j*128}var W6=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,k5=50,n1=2147483647;var{btoa:Z7,atob:Q7,File:J7,Blob:K7}=globalThis;function Z2(B){if(B>n1)throw RangeError('The value "'+B+'" is invalid for option "size"');let U=new Uint8Array(B);return Object.setPrototypeOf(U,J0.prototype),U}function B8(B,U,G){return class extends G{constructor(){super();Object.defineProperty(this,"message",{value:U.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}var $5=B8("ERR_BUFFER_OUT_OF_BOUNDS",function(B){if(B)return`${B} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),S5=B8("ERR_INVALID_ARG_TYPE",function(B,U){return`The "${B}" argument must be of type number. Received type ${typeof U}`},TypeError),s1=B8("ERR_OUT_OF_RANGE",function(B,U,G){let Y=`The value of "${B}" is out of range.`,Q=G;if(Number.isInteger(G)&&Math.abs(G)>4294967296)Q=j6(String(G));else if(typeof G==="bigint"){if(Q=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))Q=j6(Q);Q+="n"}return Y+=` It must be ${U}. Received ${Q}`,Y},RangeError);function J0(B,U,G){if(typeof B==="number"){if(typeof U==="string")throw TypeError('The "string" argument must be of type string. Received type number');return U8(B)}return z6(B,U,G)}Object.defineProperty(J0.prototype,"parent",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.buffer}});Object.defineProperty(J0.prototype,"offset",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.byteOffset}});J0.poolSize=8192;function z6(B,U,G){if(typeof B==="string")return v5(B,U);if(ArrayBuffer.isView(B))return y5(B);if(B==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(a0(B,ArrayBuffer)||B&&a0(B.buffer,ArrayBuffer))return t1(B,U,G);if(typeof SharedArrayBuffer<"u"&&(a0(B,SharedArrayBuffer)||B&&a0(B.buffer,SharedArrayBuffer)))return t1(B,U,G);if(typeof B==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Y=B.valueOf&&B.valueOf();if(Y!=null&&Y!==B)return J0.from(Y,U,G);let Q=g5(B);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]==="function")return J0.from(B[Symbol.toPrimitive]("string"),U,G);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}J0.from=function(B,U,G){return z6(B,U,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);function w6(B){if(typeof B!=="number")throw TypeError('"size" argument must be of type number');else if(B<0)throw RangeError('The value "'+B+'" is invalid for option "size"')}function b5(B,U,G){if(w6(B),B<=0)return Z2(B);if(U!==void 0)return typeof G==="string"?Z2(B).fill(U,G):Z2(B).fill(U);return Z2(B)}J0.alloc=function(B,U,G){return b5(B,U,G)};function U8(B){return w6(B),Z2(B<0?0:G8(B)|0)}J0.allocUnsafe=function(B){return U8(B)};J0.allocUnsafeSlow=function(B){return U8(B)};function v5(B,U){if(typeof U!=="string"||U==="")U="utf8";if(!J0.isEncoding(U))throw TypeError("Unknown encoding: "+U);let G=E6(B,U)|0,Y=Z2(G),Q=Y.write(B,U);if(Q!==G)Y=Y.slice(0,Q);return Y}function o1(B){let U=B.length<0?0:G8(B.length)|0,G=Z2(U);for(let Y=0;Y=n1)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n1.toString(16)+" bytes");return B|0}J0.isBuffer=function(B){return B!=null&&B._isBuffer===!0&&B!==J0.prototype};J0.compare=function(B,U){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(a0(U,Uint8Array))U=J0.from(U,U.offset,U.byteLength);if(!J0.isBuffer(B)||!J0.isBuffer(U))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(B===U)return 0;let G=B.length,Y=U.length;for(let Q=0,K=Math.min(G,Y);QY.length){if(!J0.isBuffer(K))K=J0.from(K);K.copy(Y,Q)}else Uint8Array.prototype.set.call(Y,K,Q);else if(!J0.isBuffer(K))throw TypeError('"list" argument must be an Array of Buffers');else K.copy(Y,Q);Q+=K.length}return Y};function E6(B,U){if(J0.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||a0(B,ArrayBuffer))return B.byteLength;if(typeof B!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);let G=B.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&G===0)return 0;let Q=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return e1(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return y6(B).length;default:if(Q)return Y?-1:e1(B).length;U=(""+U).toLowerCase(),Q=!0}}J0.byteLength=E6;function f5(B,U,G){let Y=!1;if(U===void 0||U<0)U=0;if(U>this.length)return"";if(G===void 0||G>this.length)G=this.length;if(G<=0)return"";if(G>>>=0,U>>>=0,G<=U)return"";if(!B)B="utf8";while(!0)switch(B){case"hex":return p5(this,U,G);case"utf8":case"utf-8":return T6(this,U,G);case"ascii":return l5(this,U,G);case"latin1":case"binary":return a5(this,U,G);case"base64":return c5(this,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r5(this,U,G);default:if(Y)throw TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),Y=!0}}J0.prototype._isBuffer=!0;function z2(B,U,G){let Y=B[U];B[U]=B[G],B[G]=Y}J0.prototype.swap16=function(){let B=this.length;if(B%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let U=0;UU)B+=" ... ";return""};if(W6)J0.prototype[W6]=J0.prototype.inspect;J0.prototype.compare=function(B,U,G,Y,Q){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(!J0.isBuffer(B))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof B);if(U===void 0)U=0;if(G===void 0)G=B?B.length:0;if(Y===void 0)Y=0;if(Q===void 0)Q=this.length;if(U<0||G>B.length||Y<0||Q>this.length)throw RangeError("out of range index");if(Y>=Q&&U>=G)return 0;if(Y>=Q)return-1;if(U>=G)return 1;if(U>>>=0,G>>>=0,Y>>>=0,Q>>>=0,this===B)return 0;let K=Q-Y,Z=G-U,J=Math.min(K,Z),q=this.slice(Y,Q),W=B.slice(U,G);for(let I=0;I2147483647)G=2147483647;else if(G<-2147483648)G=-2147483648;if(G=+G,Number.isNaN(G))G=Q?0:B.length-1;if(G<0)G=B.length+G;if(G>=B.length)if(Q)return-1;else G=B.length-1;else if(G<0)if(Q)G=0;else return-1;if(typeof U==="string")U=J0.from(U,Y);if(J0.isBuffer(U)){if(U.length===0)return-1;return P6(B,U,G,Y,Q)}else if(typeof U==="number"){if(U=U&255,typeof Uint8Array.prototype.indexOf==="function")if(Q)return Uint8Array.prototype.indexOf.call(B,U,G);else return Uint8Array.prototype.lastIndexOf.call(B,U,G);return P6(B,[U],G,Y,Q)}throw TypeError("val must be string, number or Buffer")}function P6(B,U,G,Y,Q){let K=1,Z=B.length,J=U.length;if(Y!==void 0){if(Y=String(Y).toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le"){if(B.length<2||U.length<2)return-1;K=2,Z/=2,J/=2,G/=2}}function q(I,H){if(K===1)return I[H];else return I.readUInt16BE(H*K)}let W;if(Q){let I=-1;for(W=G;WZ)G=Z-J;for(W=G;W>=0;W--){let I=!0;for(let H=0;HQ)Y=Q;let K=U.length;if(Y>K/2)Y=K/2;let Z;for(Z=0;Z>>0,isFinite(G)){if(G=G>>>0,Y===void 0)Y="utf8"}else Y=G,G=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-U;if(G===void 0||G>Q)G=Q;if(B.length>0&&(G<0||U<0)||U>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!Y)Y="utf8";let K=!1;for(;;)switch(Y){case"hex":return x5(this,B,U,G);case"utf8":case"utf-8":return _5(this,B,U,G);case"ascii":case"latin1":case"binary":return h5(this,B,U,G);case"base64":return u5(this,B,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d5(this,B,U,G);default:if(K)throw TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),K=!0}};J0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c5(B,U,G){if(U===0&&G===B.length)return F6(B);else return F6(B.slice(U,G))}function T6(B,U,G){G=Math.min(B.length,G);let Y=[],Q=U;while(Q239?4:K>223?3:K>191?2:1;if(Q+J<=G){let q,W,I,H;switch(J){case 1:if(K<128)Z=K;break;case 2:if(q=B[Q+1],(q&192)===128){if(H=(K&31)<<6|q&63,H>127)Z=H}break;case 3:if(q=B[Q+1],W=B[Q+2],(q&192)===128&&(W&192)===128){if(H=(K&15)<<12|(q&63)<<6|W&63,H>2047&&(H<55296||H>57343))Z=H}break;case 4:if(q=B[Q+1],W=B[Q+2],I=B[Q+3],(q&192)===128&&(W&192)===128&&(I&192)===128){if(H=(K&15)<<18|(q&63)<<12|(W&63)<<6|I&63,H>65535&&H<1114112)Z=H}}}if(Z===null)Z=65533,J=1;else if(Z>65535)Z-=65536,Y.push(Z>>>10&1023|55296),Z=56320|Z&1023;Y.push(Z),Q+=J}return m5(Y)}var A6=4096;function m5(B){let U=B.length;if(U<=A6)return String.fromCharCode.apply(String,B);let G="",Y=0;while(YY)G=Y;let Q="";for(let K=U;KG)B=G;if(U<0){if(U+=G,U<0)U=0}else if(U>G)U=G;if(UG)throw RangeError("Trying to access beyond buffer length")}J0.prototype.readUintLE=J0.prototype.readUIntLE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B+--U],Q=1;while(U>0&&(Q*=256))Y+=this[B+--U]*Q;return Y};J0.prototype.readUint8=J0.prototype.readUInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);return this[B]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]|this[B+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]<<8|this[B+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return(this[B]|this[B+1]<<8|this[B+2]<<16)+this[B+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]*16777216+(this[B+1]<<16|this[B+2]<<8|this[B+3])};J0.prototype.readBigUInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U+this[++B]*256+this[++B]*65536+this[++B]*16777216,Q=this[++B]+this[++B]*256+this[++B]*65536+G*16777216;return BigInt(Y)+(BigInt(Q)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U*16777216+this[++B]*65536+this[++B]*256+this[++B],Q=this[++B]*16777216+this[++B]*65536+this[++B]*256+G;return(BigInt(Y)<>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K=Q)Y-=Math.pow(2,8*U);return Y};J0.prototype.readIntBE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=U,Q=1,K=this[B+--Y];while(Y>0&&(Q*=256))K+=this[B+--Y]*Q;if(Q*=128,K>=Q)K-=Math.pow(2,8*U);return K};J0.prototype.readInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);if(!(this[B]&128))return this[B];return(255-this[B]+1)*-1};J0.prototype.readInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B]|this[B+1]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B+1]|this[B]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]|this[B+1]<<8|this[B+2]<<16|this[B+3]<<24};J0.prototype.readInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]<<24|this[B+1]<<16|this[B+2]<<8|this[B+3]};J0.prototype.readBigInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=this[B+4]+this[B+5]*256+this[B+6]*65536+(G<<24);return(BigInt(Y)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=(U<<24)+this[++B]*65536+this[++B]*256+this[++B];return(BigInt(Y)<>>0,!U)$0(B,4,this.length);return j1(this,B,!0,23,4)};J0.prototype.readFloatBE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return j1(this,B,!1,23,4)};J0.prototype.readDoubleLE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!0,52,8)};J0.prototype.readDoubleBE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!1,52,8)};function g0(B,U,G,Y,Q,K){if(!J0.isBuffer(B))throw TypeError('"buffer" argument must be a Buffer instance');if(U>Q||UB.length)throw RangeError("Index out of range")}J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=1,K=0;this[U]=B&255;while(++K>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=G-1,K=1;this[U+Q]=B&255;while(--Q>=0&&(K*=256))this[U+Q]=B/K&255;return U+G};J0.prototype.writeUint8=J0.prototype.writeUInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,255,0);return this[U]=B&255,U+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U+3]=B>>>24,this[U+2]=B>>>16,this[U+1]=B>>>8,this[U]=B&255,U+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};function C6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,G}function k6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G+7]=K,K=K>>8,B[G+6]=K,K=K>>8,B[G+5]=K,K=K>>8,B[G+4]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G+3]=Z,Z=Z>>8,B[G+2]=Z,Z=Z>>8,B[G+1]=Z,Z=Z>>8,B[G]=Z,G+8}J0.prototype.writeBigUInt64LE=I2(function(B,U=0){return C6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=I2(function(B,U=0){return k6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=0,K=1,Z=0;this[U]=B&255;while(++Q>0)-Z&255}return U+G};J0.prototype.writeIntBE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=G-1,K=1,Z=0;this[U+Q]=B&255;while(--Q>=0&&(K*=256)){if(B<0&&Z===0&&this[U+Q+1]!==0)Z=1;this[U+Q]=(B/K>>0)-Z&255}return U+G};J0.prototype.writeInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,127,-128);if(B<0)B=255+B+1;return this[U]=B&255,U+1};J0.prototype.writeInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);return this[U]=B&255,this[U+1]=B>>>8,this[U+2]=B>>>16,this[U+3]=B>>>24,U+4};J0.prototype.writeInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);if(B<0)B=4294967295+B+1;return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};J0.prototype.writeBigInt64LE=I2(function(B,U=0){return C6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=I2(function(B,U=0){return k6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $6(B,U,G,Y,Q,K){if(G+Y>B.length)throw RangeError("Index out of range");if(G<0)throw RangeError("Index out of range")}function S6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return N6(B,U,G,Y,23,4),G+4}J0.prototype.writeFloatLE=function(B,U,G){return S6(this,B,U,!0,G)};J0.prototype.writeFloatBE=function(B,U,G){return S6(this,B,U,!1,G)};function b6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return N6(B,U,G,Y,52,8),G+8}J0.prototype.writeDoubleLE=function(B,U,G){return b6(this,B,U,!0,G)};J0.prototype.writeDoubleBE=function(B,U,G){return b6(this,B,U,!1,G)};J0.prototype.copy=function(B,U,G,Y){if(!J0.isBuffer(B))throw TypeError("argument should be a Buffer");if(!G)G=0;if(!Y&&Y!==0)Y=this.length;if(U>=B.length)U=B.length;if(!U)U=0;if(Y>0&&Y=this.length)throw RangeError("Index out of range");if(Y<0)throw RangeError("sourceEnd out of bounds");if(Y>this.length)Y=this.length;if(B.length-U>>0,G=G===void 0?this.length:G>>>0,!B)B=0;let Q;if(typeof B==="number")for(Q=U;Q=Y+4;G-=3)U=`_${B.slice(G-3,G)}${U}`;return`${B.slice(0,G)}${U}`}function i5(B,U,G){if(S2(U,"offset"),B[U]===void 0||B[U+G]===void 0)n2(U,B.length-(G+1))}function v6(B,U,G,Y,Q,K){if(B>G||B3)if(U===0||U===BigInt(0))J=`>= 0${Z} and < 2${Z} ** ${(K+1)*8}${Z}`;else J=`>= -(2${Z} ** ${(K+1)*8-1}${Z}) and < 2 ** ${(K+1)*8-1}${Z}`;else J=`>= ${U}${Z} and <= ${G}${Z}`;throw new s1("value",J,B)}i5(Y,Q,K)}function S2(B,U){if(typeof B!=="number")throw new S5(U,"number",B)}function n2(B,U,G){if(Math.floor(B)!==B)throw S2(B,G),new s1(G||"offset","an integer",B);if(U<0)throw new $5;throw new s1(G||"offset",`>= ${G?1:0} and <= ${U}`,B)}var n5=/[^+/0-9A-Za-z-_]/g;function s5(B){if(B=B.split("=")[0],B=B.trim().replace(n5,""),B.length<2)return"";while(B.length%4!==0)B=B+"=";return B}function e1(B,U){U=U||1/0;let G,Y=B.length,Q=null,K=[];for(let Z=0;Z55295&&G<57344){if(!Q){if(G>56319){if((U-=3)>-1)K.push(239,191,189);continue}else if(Z+1===Y){if((U-=3)>-1)K.push(239,191,189);continue}Q=G;continue}if(G<56320){if((U-=3)>-1)K.push(239,191,189);Q=G;continue}G=(Q-55296<<10|G-56320)+65536}else if(Q){if((U-=3)>-1)K.push(239,191,189)}if(Q=null,G<128){if((U-=1)<0)break;K.push(G)}else if(G<2048){if((U-=2)<0)break;K.push(G>>6|192,G&63|128)}else if(G<65536){if((U-=3)<0)break;K.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((U-=4)<0)break;K.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw Error("Invalid code point")}return K}function o5(B){let U=[];for(let G=0;G>8,Q=G%256,K.push(Q),K.push(Y)}return K}function y6(B){return D5(s5(B))}function N1(B,U,G,Y){let Q;for(Q=0;Q=U.length||Q>=B.length)break;U[Q+G]=B[Q]}return Q}function a0(B,U){return B instanceof U||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===U.name}var e5=function(){let B=Array(256);for(let U=0;U<16;++U){let G=U*16;for(let Y=0;Y<16;++Y)B[G+Y]="0123456789abcdef"[U]+"0123456789abcdef"[Y]}return B}();function I2(B){return typeof BigInt>"u"?BU:B}function BU(){throw Error("BigInt not supported")}function Y8(B){return()=>{throw Error(B+" is not implemented for node:buffer browser polyfill")}}var V7=Y8("resolveObjectURL"),X7=Y8("isUtf8");var q7=Y8("transcode");var G7=P5(h6(),1);var L6={};z5(L6,{unsignedDecimalNumber:()=>X1,universalMeasureValue:()=>q1,uniqueUuid:()=>eB,uniqueNumericIdCreator:()=>I1,uniqueId:()=>O1,uCharHexNumber:()=>W8,twipsMeasureValue:()=>E0,standardizeData:()=>j4,signedTwipsMeasureValue:()=>t0,signedHpsMeasureValue:()=>VG,shortHexNumber:()=>SB,sectionPageSizeDefaults:()=>$1,sectionMarginDefaults:()=>H2,positiveUniversalMeasureValue:()=>d8,pointMeasureValue:()=>gB,percentageValue:()=>vB,patchDocument:()=>tK,patchDetector:()=>B7,measurementOrPercentValue:()=>c8,longHexNumber:()=>KG,hpsMeasureValue:()=>bB,hexColorValue:()=>C2,hashedId:()=>P8,encodeUtf8:()=>U1,eighthPointMeasureValue:()=>yB,docPropertiesUniqueNumericIdGen:()=>oB,decimalNumber:()=>T0,dateTimeValue:()=>fB,createWrapTopAndBottom:()=>H4,createWrapTight:()=>O4,createWrapSquare:()=>I4,createWrapNone:()=>j8,createVerticalPosition:()=>J4,createVerticalAlign:()=>U6,createUnderline:()=>cB,createTransformation:()=>n8,createTableWidthElement:()=>J1,createTableRowHeight:()=>W9,createTableLook:()=>F9,createTableLayout:()=>O9,createTableFloatProperties:()=>I9,createTabStopItem:()=>b4,createTabStop:()=>v4,createStringElement:()=>f2,createSpacing:()=>S4,createSimplePos:()=>G4,createShading:()=>M1,createSectionType:()=>C9,createRunFonts:()=>T1,createParagraphStyle:()=>x2,createPageSize:()=>D9,createPageNumberType:()=>E9,createPageMargin:()=>w9,createOutlineLevel:()=>_4,createMathSuperScriptProperties:()=>p4,createMathSuperScriptElement:()=>a2,createMathSubSuperScriptProperties:()=>i4,createMathSubScriptProperties:()=>r4,createMathSubScriptElement:()=>l2,createMathPreSubSuperScriptProperties:()=>n4,createMathNAryProperties:()=>e8,createMathLimitLocation:()=>a4,createMathBase:()=>y0,createMathAccentCharacter:()=>l4,createLineNumberType:()=>N9,createIndent:()=>hB,createHorizontalPosition:()=>Q4,createHeaderFooterReference:()=>k1,createFrameProperties:()=>u4,createEmphasisMark:()=>r8,createDotEmphasisMark:()=>AG,createDocumentGrid:()=>j9,createColumns:()=>A9,createBorderElement:()=>j0,createBodyProperties:()=>K4,createAlignment:()=>m8,convertToXmlComponent:()=>u1,convertMillimetersToTwip:()=>dG,convertInchesToTwip:()=>u0,concreteNumUniqueNumericIdGen:()=>sB,commentIdToParaId:()=>z4,bookmarkUniqueNumericIdGen:()=>tB,abstractNumUniqueNumericIdGen:()=>nB,YearShort:()=>oY,YearLong:()=>BZ,XmlComponent:()=>t,XmlAttributeComponent:()=>H0,WpsShapeRun:()=>SY,WpgGroupRun:()=>bY,WidthType:()=>v1,WORKAROUND4:()=>oZ,WORKAROUND3:()=>JG,WORKAROUND2:()=>NJ,VerticalPositionRelativeFrom:()=>U4,VerticalPositionAlign:()=>MG,VerticalMergeType:()=>G6,VerticalMergeRevisionType:()=>FQ,VerticalMerge:()=>w8,VerticalAnchor:()=>cG,VerticalAlignTable:()=>K9,VerticalAlignSection:()=>V9,VerticalAlign:()=>WQ,UnderlineType:()=>i8,ThematicBreak:()=>_B,Textbox:()=>TK,TextWrappingType:()=>e2,TextWrappingSide:()=>L4,TextRun:()=>Q1,TextEffect:()=>CG,TextDirection:()=>zQ,TableRowPropertiesChange:()=>P9,TableRowProperties:()=>J6,TableRow:()=>fQ,TableProperties:()=>Q6,TableOfContents:()=>RK,TableLayoutType:()=>SQ,TableCellBorders:()=>q9,TableCell:()=>Y6,TableBorders:()=>Z6,TableAnchorType:()=>DQ,Table:()=>yQ,TabStopType:()=>z8,TabStopPosition:()=>FZ,Tab:()=>T4,TDirection:()=>R9,SymbolRun:()=>aB,Styles:()=>S1,StyleLevel:()=>LK,StyleForParagraph:()=>p2,StyleForCharacter:()=>$2,StringValueElement:()=>q2,StringEnumValueElement:()=>XG,StringContainer:()=>O2,SpaceType:()=>x0,SoftHyphen:()=>iY,SimpleMailMergeField:()=>fY,SimpleField:()=>s8,ShadingType:()=>FG,SequentialIdentifier:()=>yY,Separator:()=>YZ,SectionType:()=>GJ,SectionPropertiesChange:()=>k9,SectionProperties:()=>K6,RunPropertiesDefaults:()=>a9,RunPropertiesChange:()=>lB,RunProperties:()=>U2,Run:()=>D0,RelativeVerticalPosition:()=>CQ,RelativeHorizontalPosition:()=>TQ,PrettifyType:()=>G5,PositionalTabRelativeTo:()=>XZ,PositionalTabLeader:()=>qZ,PositionalTabAlignment:()=>VZ,PositionalTab:()=>RZ,PatchType:()=>C8,ParagraphRunProperties:()=>mB,ParagraphPropertiesDefaults:()=>l9,ParagraphPropertiesChange:()=>d4,ParagraphProperties:()=>M2,Paragraph:()=>d0,PageTextDirectionType:()=>BJ,PageTextDirection:()=>T9,PageReference:()=>CZ,PageOrientation:()=>g1,PageNumberSeparator:()=>eQ,PageNumberElement:()=>QZ,PageNumber:()=>F2,PageBreakBefore:()=>$4,PageBreak:()=>LZ,PageBorders:()=>z9,PageBorderZOrder:()=>tQ,PageBorderOffsetFrom:()=>oQ,PageBorderDisplay:()=>sQ,Packer:()=>Y5,OverlapType:()=>kQ,OnOffElement:()=>q0,Numbering:()=>d9,NumberedItemReferenceFormat:()=>wZ,NumberedItemReference:()=>DZ,NumberValueElement:()=>_2,NumberProperties:()=>C1,NumberFormat:()=>RG,NoBreakHyphen:()=>rY,NextAttributeComponent:()=>$8,MonthShort:()=>sY,MonthLong:()=>eY,Media:()=>V6,MathSuperScript:()=>rZ,MathSum:()=>mZ,MathSubSuperScript:()=>nZ,MathSubScript:()=>iZ,MathSquareBrackets:()=>QQ,MathRun:()=>hZ,MathRoundBrackets:()=>ZQ,MathRadicalProperties:()=>o4,MathRadical:()=>BQ,MathPreSubSuperScript:()=>sZ,MathNumerator:()=>m4,MathLimitUpper:()=>aZ,MathLimitLower:()=>pZ,MathLimit:()=>B6,MathIntegral:()=>lZ,MathFunctionProperties:()=>e4,MathFunctionName:()=>t4,MathFunction:()=>UQ,MathFraction:()=>uZ,MathDenominator:()=>c4,MathDegree:()=>s4,MathCurlyBrackets:()=>JQ,MathAngledBrackets:()=>KQ,Math:()=>xZ,LineRuleType:()=>k2,LineNumberRestartFormat:()=>nQ,LevelSuffix:()=>TJ,LevelOverride:()=>u9,LevelFormat:()=>i0,LevelForOverride:()=>$J,LevelBase:()=>X6,Level:()=>h9,LeaderType:()=>HZ,LastRenderedPageBreak:()=>KZ,InternalHyperlink:()=>y4,InsertedTextRun:()=>MQ,InsertedTableRow:()=>U9,InsertedTableCell:()=>Y9,InitializableXmlComponent:()=>u8,ImportedXmlComponent:()=>kB,ImportedRootElementAttributes:()=>$B,ImageRun:()=>$Y,IgnoreIfEmptyXmlComponent:()=>R2,HyperlinkType:()=>jZ,HpsMeasureElement:()=>D1,HorizontalPositionRelativeFrom:()=>B4,HorizontalPositionAlign:()=>qG,HighlightColor:()=>kG,HeightRule:()=>gQ,HeadingLevel:()=>OZ,HeaderWrapper:()=>_9,HeaderFooterType:()=>E8,HeaderFooterReferenceType:()=>T2,Header:()=>IK,GridSpan:()=>M9,FrameWrap:()=>fZ,FrameAnchorType:()=>gZ,FootnoteReferenceRun:()=>HK,FootnoteReferenceElement:()=>GZ,FootnoteReference:()=>o9,FooterWrapper:()=>f9,Footer:()=>OK,FootNotes:()=>x9,FootNoteReferenceRunAttributes:()=>s9,FileChild:()=>H1,File:()=>VK,ExternalHyperlink:()=>t8,Endnotes:()=>g9,EndnoteReferenceRunAttributes:()=>t9,EndnoteReferenceRun:()=>FK,EndnoteReference:()=>D4,EndnoteIdReference:()=>e9,EmptyElement:()=>S0,EmphasisMarkType:()=>p8,EMPTY_OBJECT:()=>KB,DropCapType:()=>yZ,Drawing:()=>m1,DocumentGridType:()=>iQ,DocumentDefaults:()=>p9,DocumentBackgroundAttributes:()=>S9,DocumentBackground:()=>b9,DocumentAttributes:()=>F1,DocumentAttributeNamespaces:()=>y1,Document:()=>VK,DeletedTextRun:()=>OQ,DeletedTableRow:()=>G9,DeletedTableCell:()=>Z9,DayShort:()=>nY,DayLong:()=>tY,ContinuationSeparator:()=>ZZ,ConcreteNumbering:()=>T8,ConcreteHyperlink:()=>m2,CommentsExtended:()=>E4,Comments:()=>w4,CommentReference:()=>mY,CommentRangeStart:()=>dY,CommentRangeEnd:()=>cY,Comment:()=>N8,ColumnBreak:()=>IZ,Column:()=>ZJ,CheckBoxUtil:()=>B5,CheckBoxSymbolElement:()=>b1,CheckBox:()=>WK,CharacterSet:()=>kZ,CellMergeAttributes:()=>Q9,CellMerge:()=>J9,CarriageReturn:()=>JZ,BuilderElement:()=>M0,BorderStyle:()=>c1,Border:()=>xB,BookmarkStart:()=>f4,BookmarkEnd:()=>x4,Bookmark:()=>g4,Body:()=>$9,BaseXmlComponent:()=>Y1,Attributes:()=>C0,AnnotationReference:()=>UZ,AlignmentType:()=>c0,AbstractNumbering:()=>D8});var{create:YU,defineProperty:QB,getOwnPropertyDescriptor:ZU,getOwnPropertyNames:QU,getPrototypeOf:JU}=Object,KU=Object.prototype.hasOwnProperty,JB=(B,U)=>()=>(B&&(U=B(B=0)),U),R0=(B,U)=>()=>(U||(B((U={exports:{}}).exports,U),B=null),U.exports),VU=(B,U,G,Y)=>{if(U&&typeof U==="object"||typeof U==="function"){for(var Q=QU(U),K=0,Z=Q.length,J;KU[q]).bind(null,J),enumerable:!(Y=ZU(U,J))||Y.enumerable})}return B},k8=(B,U,G)=>(G=B!=null?YU(JU(B)):{},VU(U||!B||!B.__esModule?QB(G,"default",{value:B,enumerable:!0}):G,B)),w1=((B)=>__require)(function(B){return __require.apply(this,arguments)});function G1(B){return G1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},G1(B)}function XU(B,U){if(G1(B)!="object"||!B)return B;var G=B[Symbol.toPrimitive];if(G!==void 0){var Y=G.call(B,U||"default");if(G1(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return(U==="string"?String:Number)(B)}function qU(B){var U=XU(B,"string");return G1(U)=="symbol"?U:U+""}function e(B,U,G){return(U=qU(U))in B?Object.defineProperty(B,U,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[U]=G,B}var Y1=class{constructor(B){e(this,"rootKey",void 0),this.rootKey=B}},KB=Object.seal({}),t=class extends Y1{constructor(B){super(B);e(this,"root",void 0),this.root=[]}prepForXml(B){var U;B.stack.push(this);let G=this.root.map((Y)=>{if(Y instanceof Y1)return Y.prepForXml(B);return Y}).filter((Y)=>Y!==void 0);return B.stack.pop(),{[this.rootKey]:G.length?G.length===1&&((U=G[0])===null||U===void 0?void 0:U._attr)?G[0]:G:KB}}addChildElement(B){return this.root.push(B),this}},R2=class extends t{constructor(B,U){super(B);e(this,"includeIfEmpty",void 0),this.includeIfEmpty=U}prepForXml(B){let U=super.prepForXml(B);if(this.includeIfEmpty)return U;if(U&&(typeof U[this.rootKey]!=="object"||Object.keys(U[this.rootKey]).length))return U}};function u6(B,U){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);U&&(Y=Y.filter(function(Q){return Object.getOwnPropertyDescriptor(B,Q).enumerable})),G.push.apply(G,Y)}return G}function L0(B){for(var U=1;U{if(Y!==void 0){let Q=this.xmlKeys&&this.xmlKeys[G]||G;U[Q]=Y}}),{_attr:U}}},$8=class extends Y1{constructor(B){super("_attr");e(this,"root",void 0),this.root=B}prepForXml(B){return{_attr:Object.values(this.root).filter(({value:U})=>U!==void 0).reduce((U,{key:G,value:Y})=>L0(L0({},U),{},{[G]:Y}),{})}}},C0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}},S8=R0((B,U)=>{var G=typeof Reflect==="object"?Reflect:null,Y=G&&typeof G.apply==="function"?G.apply:function($,x,z){return Function.prototype.apply.call($,x,z)},Q;if(G&&typeof G.ownKeys==="function")Q=G.ownKeys;else if(Object.getOwnPropertySymbols)Q=function($){return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($))};else Q=function($){return Object.getOwnPropertyNames($)};function K(M){if(console&&console.warn)console.warn(M)}var Z=Number.isNaN||function($){return $!==$};function J(){J.init.call(this)}U.exports=J,U.exports.once=v,J.EventEmitter=J,J.prototype._events=void 0,J.prototype._eventsCount=0,J.prototype._maxListeners=void 0;var q=10;function W(M){if(typeof M!=="function")throw TypeError('The "listener" argument must be of type Function. Received type '+typeof M)}Object.defineProperty(J,"defaultMaxListeners",{enumerable:!0,get:function(){return q},set:function(M){if(typeof M!=="number"||M<0||Z(M))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+M+".");q=M}}),J.init=function(){if(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)this._events=Object.create(null),this._eventsCount=0;this._maxListeners=this._maxListeners||void 0},J.prototype.setMaxListeners=function($){if(typeof $!=="number"||$<0||Z($))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+$+".");return this._maxListeners=$,this};function I(M){if(M._maxListeners===void 0)return J.defaultMaxListeners;return M._maxListeners}J.prototype.getMaxListeners=function(){return I(this)},J.prototype.emit=function($){var x=[];for(var z=1;z0)b=x[0];if(b instanceof Error)throw b;var c=Error("Unhandled error."+(b?" ("+b.message+")":""));throw c.context=b,c}var D=U0[$];if(D===void 0)return!1;if(typeof D==="function")Y(D,this,x);else{var m=D.length,B0=E(D,m);for(var z=0;z0&&b.length>a&&!b.warned){b.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+b.length+" "+String($)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=M,c.type=$,c.count=b.length,K(c)}}return M}J.prototype.addListener=function($,x){return H(this,$,x,!1)},J.prototype.on=J.prototype.addListener,J.prototype.prependListener=function($,x){return H(this,$,x,!0)};function T(){if(!this.fired){if(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0)return this.listener.call(this.target);return this.listener.apply(this.target,arguments)}}function A(M,$,x){var z={fired:!1,wrapFn:void 0,target:M,type:$,listener:x},a=T.bind(z);return a.listener=x,z.wrapFn=a,a}J.prototype.once=function($,x){return W(x),this.on($,A(this,$,x)),this},J.prototype.prependOnceListener=function($,x){return W(x),this.prependListener($,A(this,$,x)),this},J.prototype.removeListener=function($,x){var z,a,U0,b,c;if(W(x),a=this._events,a===void 0)return this;if(z=a[$],z===void 0)return this;if(z===x||z.listener===x){if(--this._eventsCount===0)this._events=Object.create(null);else if(delete a[$],a.removeListener)this.emit("removeListener",$,z.listener||x)}else if(typeof z!=="function"){U0=-1;for(b=z.length-1;b>=0;b--)if(z[b]===x||z[b].listener===x){c=z[b].listener,U0=b;break}if(U0<0)return this;if(U0===0)z.shift();else C(z,U0);if(z.length===1)a[$]=z[0];if(a.removeListener!==void 0)this.emit("removeListener",$,c||x)}return this},J.prototype.off=J.prototype.removeListener,J.prototype.removeAllListeners=function($){var x,z=this._events,a;if(z===void 0)return this;if(z.removeListener===void 0){if(arguments.length===0)this._events=Object.create(null),this._eventsCount=0;else if(z[$]!==void 0)if(--this._eventsCount===0)this._events=Object.create(null);else delete z[$];return this}if(arguments.length===0){var U0=Object.keys(z),b;for(a=0;a=0;a--)this.removeListener($,x[a]);return this};function P(M,$,x){var z=M._events;if(z===void 0)return[];var a=z[$];if(a===void 0)return[];if(typeof a==="function")return x?[a.listener||a]:[a];return x?N(a):E(a,a.length)}J.prototype.listeners=function($){return P(this,$,!0)},J.prototype.rawListeners=function($){return P(this,$,!1)},J.listenerCount=function(M,$){if(typeof M.listenerCount==="function")return M.listenerCount($);else return j.call(M,$)},J.prototype.listenerCount=j;function j(M){var $=this._events;if($!==void 0){var x=$[M];if(typeof x==="function")return 1;else if(x!==void 0)return x.length}return 0}J.prototype.eventNames=function(){return this._eventsCount>0?Q(this._events):[]};function E(M,$){var x=Array($);for(var z=0;z<$;++z)x[z]=M[z];return x}function C(M,$){for(;$+1{if(typeof Object.create==="function")U.exports=function(Y,Q){if(Q)Y.super_=Q,Y.prototype=Object.create(Q.prototype,{constructor:{value:Y,enumerable:!1,writable:!0,configurable:!0}})};else U.exports=function(Y,Q){if(Q){Y.super_=Q;var K=function(){};K.prototype=Q.prototype,Y.prototype=new K,Y.prototype.constructor=Y}}}),v0,d2=JB(()=>{v0=globalThis||self});function MU(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function O8(){throw Error("setTimeout has not been defined")}function H8(){throw Error("clearTimeout has not been defined")}function VB(B){if(n0===setTimeout)return setTimeout(B,0);if((n0===O8||!n0)&&setTimeout)return n0=setTimeout,setTimeout(B,0);try{return n0(B,0)}catch(U){try{return n0.call(null,B,0)}catch(G){return n0.call(this,B,0)}}}function RU(B){if(s0===clearTimeout)return clearTimeout(B);if((s0===H8||!s0)&&clearTimeout)return s0=clearTimeout,clearTimeout(B);try{return s0(B)}catch(U){try{return s0.call(null,B)}catch(G){return s0.call(this,B)}}}function LU(){if(!D2||!E2)return;if(D2=!1,E2.length)o0=E2.concat(o0);else B1=-1;if(o0.length)XB()}function XB(){if(D2)return;var B=VB(LU);D2=!0;var U=o0.length;while(U){E2=o0,o0=[];while(++B1{J8={exports:{}},N0=J8.exports={},function(){try{if(typeof setTimeout==="function")n0=setTimeout;else n0=O8}catch(B){n0=O8}try{if(typeof clearTimeout==="function")s0=clearTimeout;else s0=H8}catch(B){s0=H8}}(),o0=[],D2=!1,B1=-1,N0.nextTick=function(B){var U=Array(arguments.length-1);if(arguments.length>1)for(var G=1;G{U.exports=S8().EventEmitter}),IU=R0((B)=>{B.byteLength=q,B.toByteArray=I,B.fromByteArray=A;var U=[],G=[],Y=typeof Uint8Array<"u"?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var K=0,Z=Q.length;K0)throw Error("Invalid string. Length must be a multiple of 4");var E=P.indexOf("=");if(E===-1)E=j;var C=E===j?0:4-E%4;return[E,C]}function q(P){var j=J(P),E=j[0],C=j[1];return(E+C)*3/4-C}function W(P,j,E){return(j+E)*3/4-E}function I(P){var j,E=J(P),C=E[0],N=E[1],v=new Y(W(P,C,N)),S=0,F=N>0?C-4:C,M;for(M=0;M>16&255,v[S++]=j>>8&255,v[S++]=j&255;if(N===2)j=G[P.charCodeAt(M)]<<2|G[P.charCodeAt(M+1)]>>4,v[S++]=j&255;if(N===1)j=G[P.charCodeAt(M)]<<10|G[P.charCodeAt(M+1)]<<4|G[P.charCodeAt(M+2)]>>2,v[S++]=j>>8&255,v[S++]=j&255;return v}function H(P){return U[P>>18&63]+U[P>>12&63]+U[P>>6&63]+U[P&63]}function T(P,j,E){var C,N=[];for(var v=j;vF?F:S+v));if(C===1)j=P[E-1],N.push(U[j>>2]+U[j<<4&63]+"==");else if(C===2)j=(P[E-2]<<8)+P[E-1],N.push(U[j>>10]+U[j>>4&63]+U[j<<2&63]+"=");return N.join("")}}),OU=R0((B)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */B.read=function(U,G,Y,Q,K){var Z,J,q=K*8-Q-1,W=(1<>1,H=-7,T=Y?K-1:0,A=Y?-1:1,P=U[G+T];T+=A,Z=P&(1<<-H)-1,P>>=-H,H+=q;for(;H>0;Z=Z*256+U[G+T],T+=A,H-=8);J=Z&(1<<-H)-1,Z>>=-H,H+=Q;for(;H>0;J=J*256+U[G+T],T+=A,H-=8);if(Z===0)Z=1-I;else if(Z===W)return J?NaN:(P?-1:1)*(1/0);else J=J+Math.pow(2,Q),Z=Z-I;return(P?-1:1)*J*Math.pow(2,Z-Q)},B.write=function(U,G,Y,Q,K,Z){var J,q,W,I=Z*8-K-1,H=(1<>1,A=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=Q?0:Z-1,j=Q?1:-1,E=G<0||G===0&&1/G<0?1:0;if(G=Math.abs(G),isNaN(G)||G===1/0)q=isNaN(G)?1:0,J=H;else{if(J=Math.floor(Math.log(G)/Math.LN2),G*(W=Math.pow(2,-J))<1)J--,W*=2;if(J+T>=1)G+=A/W;else G+=A*Math.pow(2,1-T);if(G*W>=2)J++,W/=2;if(J+T>=H)q=0,J=H;else if(J+T>=1)q=(G*W-1)*Math.pow(2,K),J=J+T;else q=G*Math.pow(2,T-1)*Math.pow(2,K),J=0}for(;K>=8;U[Y+P]=q&255,P+=j,q/=256,K-=8);J=J<0;U[Y+P]=J&255,P+=j,J/=256,I-=8);U[Y+P-j]|=E*128}});/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT -*/var f1=R0((B)=>{var U=IU(),G=OU(),Y=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=J,B.SlowBuffer=N,B.INSPECT_MAX_BYTES=50;var Q=2147483647;if(B.kMaxLength=Q,J.TYPED_ARRAY_SUPPORT=K(),!J.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error==="function")console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function K(){try{var k=new Uint8Array(1),V={foo:function(){return 42}};return Object.setPrototypeOf(V,Uint8Array.prototype),Object.setPrototypeOf(k,V),k.foo()===42}catch(X){return!1}}Object.defineProperty(J.prototype,"parent",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.buffer}}),Object.defineProperty(J.prototype,"offset",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.byteOffset}});function Z(k){if(k>Q)throw RangeError('The value "'+k+'" is invalid for option "size"');var V=new Uint8Array(k);return Object.setPrototypeOf(V,J.prototype),V}function J(k,V,X){if(typeof k==="number"){if(typeof V==="string")throw TypeError('The "string" argument must be of type string. Received type number');return H(k)}return q(k,V,X)}J.poolSize=8192;function q(k,V,X){if(typeof k==="string")return T(k,V);if(ArrayBuffer.isView(k))return P(k);if(k==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(f(k,ArrayBuffer)||k&&f(k.buffer,ArrayBuffer))return j(k,V,X);if(typeof SharedArrayBuffer<"u"&&(f(k,SharedArrayBuffer)||k&&f(k.buffer,SharedArrayBuffer)))return j(k,V,X);if(typeof k==="number")throw TypeError('The "value" argument must not be of type number. Received type number');var O=k.valueOf&&k.valueOf();if(O!=null&&O!==k)return J.from(O,V,X);var _=E(k);if(_)return _;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]==="function")return J.from(k[Symbol.toPrimitive]("string"),V,X);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}J.from=function(k,V,X){return q(k,V,X)},Object.setPrototypeOf(J.prototype,Uint8Array.prototype),Object.setPrototypeOf(J,Uint8Array);function W(k){if(typeof k!=="number")throw TypeError('"size" argument must be of type number');else if(k<0)throw RangeError('The value "'+k+'" is invalid for option "size"')}function I(k,V,X){if(W(k),k<=0)return Z(k);if(V!==void 0)return typeof X==="string"?Z(k).fill(V,X):Z(k).fill(V);return Z(k)}J.alloc=function(k,V,X){return I(k,V,X)};function H(k){return W(k),Z(k<0?0:C(k)|0)}J.allocUnsafe=function(k){return H(k)},J.allocUnsafeSlow=function(k){return H(k)};function T(k,V){if(typeof V!=="string"||V==="")V="utf8";if(!J.isEncoding(V))throw TypeError("Unknown encoding: "+V);var X=v(k,V)|0,O=Z(X),_=O.write(k,V);if(_!==X)O=O.slice(0,_);return O}function A(k){var V=k.length<0?0:C(k.length)|0,X=Z(V);for(var O=0;O=Q)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return k|0}function N(k){if(+k!=k)k=0;return J.alloc(+k)}J.isBuffer=function(V){return V!=null&&V._isBuffer===!0&&V!==J.prototype},J.compare=function(V,X){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(f(X,Uint8Array))X=J.from(X,X.offset,X.byteLength);if(!J.isBuffer(V)||!J.isBuffer(X))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(V===X)return 0;var O=V.length,_=X.length;for(var l=0,d=Math.min(O,_);l_.length)J.from(d).copy(_,l);else Uint8Array.prototype.set.call(_,d,l);else if(!J.isBuffer(d))throw TypeError('"list" argument must be an Array of Buffers');else d.copy(_,l);l+=d.length}return _};function v(k,V){if(J.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||f(k,ArrayBuffer))return k.byteLength;if(typeof k!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);var X=k.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&X===0)return 0;var _=!1;for(;;)switch(V){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return L(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return Z0(k).length;default:if(_)return O?-1:L(k).length;V=(""+V).toLowerCase(),_=!0}}J.byteLength=v;function S(k,V,X){var O=!1;if(V===void 0||V<0)V=0;if(V>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,V>>>=0,X<=V)return"";if(!k)k="utf8";while(!0)switch(k){case"hex":return s(this,V,X);case"utf8":case"utf-8":return D(this,V,X);case"ascii":return i(this,V,X);case"latin1":case"binary":return V0(this,V,X);case"base64":return c(this,V,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G0(this,V,X);default:if(O)throw TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),O=!0}}J.prototype._isBuffer=!0;function F(k,V,X){var O=k[V];k[V]=k[X],k[X]=O}if(J.prototype.swap16=function(){var V=this.length;if(V%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var X=0;XX)V+=" ... ";return""},Y)J.prototype[Y]=J.prototype.inspect;J.prototype.compare=function(V,X,O,_,l){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(!J.isBuffer(V))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof V);if(X===void 0)X=0;if(O===void 0)O=V?V.length:0;if(_===void 0)_=0;if(l===void 0)l=this.length;if(X<0||O>V.length||_<0||l>this.length)throw RangeError("out of range index");if(_>=l&&X>=O)return 0;if(_>=l)return-1;if(X>=O)return 1;if(X>>>=0,O>>>=0,_>>>=0,l>>>=0,this===V)return 0;var d=l-_,Q0=O-X,X0=Math.min(d,Q0),K0=this.slice(_,l),I0=V.slice(X,O);for(var F0=0;F02147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,R(X))X=_?0:k.length-1;if(X<0)X=k.length+X;if(X>=k.length)if(_)return-1;else X=k.length-1;else if(X<0)if(_)X=0;else return-1;if(typeof V==="string")V=J.from(V,O);if(J.isBuffer(V)){if(V.length===0)return-1;return $(k,V,X,O,_)}else if(typeof V==="number"){if(V=V&255,typeof Uint8Array.prototype.indexOf==="function")if(_)return Uint8Array.prototype.indexOf.call(k,V,X);else return Uint8Array.prototype.lastIndexOf.call(k,V,X);return $(k,[V],X,O,_)}throw TypeError("val must be string, number or Buffer")}function $(k,V,X,O,_){var l=1,d=k.length,Q0=V.length;if(O!==void 0){if(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le"){if(k.length<2||V.length<2)return-1;l=2,d/=2,Q0/=2,X/=2}}function X0(k0,L2){if(l===1)return k0[L2];else return k0.readUInt16BE(L2*l)}var K0;if(_){var I0=-1;for(K0=X;K0d)X=d-Q0;for(K0=X;K0>=0;K0--){var F0=!0;for(var W0=0;W0_)O=_;var l=V.length;if(O>l/2)O=l/2;for(var d=0;d>>0,isFinite(O)){if(O=O>>>0,_===void 0)_="utf8"}else _=O,O=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-X;if(O===void 0||O>l)O=l;if(V.length>0&&(O<0||X<0)||X>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!_)_="utf8";var d=!1;for(;;)switch(_){case"hex":return x(this,V,X,O);case"utf8":case"utf-8":return w(this,V,X,O);case"ascii":case"latin1":case"binary":return a(this,V,X,O);case"base64":return U0(this,V,X,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,V,X,O);default:if(d)throw TypeError("Unknown encoding: "+_);_=(""+_).toLowerCase(),d=!0}},J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c(k,V,X){if(V===0&&X===k.length)return U.fromByteArray(k);else return U.fromByteArray(k.slice(V,X))}function D(k,V,X){X=Math.min(k.length,X);var O=[],_=V;while(_239?4:l>223?3:l>191?2:1;if(_+Q0<=X){var X0,K0,I0,F0;switch(Q0){case 1:if(l<128)d=l;break;case 2:if(X0=k[_+1],(X0&192)===128){if(F0=(l&31)<<6|X0&63,F0>127)d=F0}break;case 3:if(X0=k[_+1],K0=k[_+2],(X0&192)===128&&(K0&192)===128){if(F0=(l&15)<<12|(X0&63)<<6|K0&63,F0>2047&&(F0<55296||F0>57343))d=F0}break;case 4:if(X0=k[_+1],K0=k[_+2],I0=k[_+3],(X0&192)===128&&(K0&192)===128&&(I0&192)===128){if(F0=(l&15)<<18|(X0&63)<<12|(K0&63)<<6|I0&63,F0>65535&&F0<1114112)d=F0}}}if(d===null)d=65533,Q0=1;else if(d>65535)d-=65536,O.push(d>>>10&1023|55296),d=56320|d&1023;O.push(d),_+=Q0}return B0(O)}var m=4096;function B0(k){var V=k.length;if(V<=m)return String.fromCharCode.apply(String,k);var X="",O=0;while(OO)X=O;var _="";for(var l=V;lO)V=O;if(X<0){if(X+=O,X<0)X=0}else if(X>O)X=O;if(XX)throw RangeError("Trying to access beyond buffer length")}J.prototype.readUintLE=J.prototype.readUIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V+--X],l=1;while(X>0&&(l*=256))_+=this[V+--X]*l;return _},J.prototype.readUint8=J.prototype.readUInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);return this[V]},J.prototype.readUint16LE=J.prototype.readUInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]|this[V+1]<<8},J.prototype.readUint16BE=J.prototype.readUInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]<<8|this[V+1]},J.prototype.readUint32LE=J.prototype.readUInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return(this[V]|this[V+1]<<8|this[V+2]<<16)+this[V+3]*16777216},J.prototype.readUint32BE=J.prototype.readUInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]*16777216+(this[V+1]<<16|this[V+2]<<8|this[V+3])},J.prototype.readIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d=l)_-=Math.pow(2,8*X);return _},J.prototype.readIntBE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=X,l=1,d=this[V+--_];while(_>0&&(l*=256))d+=this[V+--_]*l;if(l*=128,d>=l)d-=Math.pow(2,8*X);return d},J.prototype.readInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);if(!(this[V]&128))return this[V];return(255-this[V]+1)*-1},J.prototype.readInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V]|this[V+1]<<8;return O&32768?O|4294901760:O},J.prototype.readInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V+1]|this[V]<<8;return O&32768?O|4294901760:O},J.prototype.readInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]|this[V+1]<<8|this[V+2]<<16|this[V+3]<<24},J.prototype.readInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]<<24|this[V+1]<<16|this[V+2]<<8|this[V+3]},J.prototype.readFloatLE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!0,23,4)},J.prototype.readFloatBE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!1,23,4)},J.prototype.readDoubleLE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!0,52,8)},J.prototype.readDoubleBE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!1,52,8)};function y(k,V,X,O,_,l){if(!J.isBuffer(k))throw TypeError('"buffer" argument must be a Buffer instance');if(V>_||Vk.length)throw RangeError("Index out of range")}J.prototype.writeUintLE=J.prototype.writeUIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=1,Q0=0;this[X]=V&255;while(++Q0>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=O-1,Q0=1;this[X+d]=V&255;while(--d>=0&&(Q0*=256))this[X+d]=V/Q0&255;return X+O},J.prototype.writeUint8=J.prototype.writeUInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,255,0);return this[X]=V&255,X+1},J.prototype.writeUint16LE=J.prototype.writeUInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeUint16BE=J.prototype.writeUInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeUint32LE=J.prototype.writeUInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X+3]=V>>>24,this[X+2]=V>>>16,this[X+1]=V>>>8,this[X]=V&255,X+4},J.prototype.writeUint32BE=J.prototype.writeUInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4},J.prototype.writeIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=0,Q0=1,X0=0;this[X]=V&255;while(++d>0)-X0&255}return X+O},J.prototype.writeIntBE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=O-1,Q0=1,X0=0;this[X+d]=V&255;while(--d>=0&&(Q0*=256)){if(V<0&&X0===0&&this[X+d+1]!==0)X0=1;this[X+d]=(V/Q0>>0)-X0&255}return X+O},J.prototype.writeInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,127,-128);if(V<0)V=255+V+1;return this[X]=V&255,X+1},J.prototype.writeInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);return this[X]=V&255,this[X+1]=V>>>8,this[X+2]=V>>>16,this[X+3]=V>>>24,X+4},J.prototype.writeInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);if(V<0)V=4294967295+V+1;return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4};function n(k,V,X,O,_,l){if(X+O>k.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function o(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return G.write(k,V,X,O,23,4),X+4}J.prototype.writeFloatLE=function(V,X,O){return o(this,V,X,!0,O)},J.prototype.writeFloatBE=function(V,X,O){return o(this,V,X,!1,O)};function Y0(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return G.write(k,V,X,O,52,8),X+8}J.prototype.writeDoubleLE=function(V,X,O){return Y0(this,V,X,!0,O)},J.prototype.writeDoubleBE=function(V,X,O){return Y0(this,V,X,!1,O)},J.prototype.copy=function(V,X,O,_){if(!J.isBuffer(V))throw TypeError("argument should be a Buffer");if(!O)O=0;if(!_&&_!==0)_=this.length;if(X>=V.length)X=V.length;if(!X)X=0;if(_>0&&_=this.length)throw RangeError("Index out of range");if(_<0)throw RangeError("sourceEnd out of bounds");if(_>this.length)_=this.length;if(V.length-X<_-O)_=V.length-X+O;var l=_-O;if(this===V&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(X,O,_);else Uint8Array.prototype.set.call(V,this.subarray(O,_),X);return l},J.prototype.fill=function(V,X,O,_){if(typeof V==="string"){if(typeof X==="string")_=X,X=0,O=this.length;else if(typeof O==="string")_=O,O=this.length;if(_!==void 0&&typeof _!=="string")throw TypeError("encoding must be a string");if(typeof _==="string"&&!J.isEncoding(_))throw TypeError("Unknown encoding: "+_);if(V.length===1){var l=V.charCodeAt(0);if(_==="utf8"&&l<128||_==="latin1")V=l}}else if(typeof V==="number")V=V&255;else if(typeof V==="boolean")V=Number(V);if(X<0||this.length>>0,O=O===void 0?this.length:O>>>0,!V)V=0;var d;if(typeof V==="number")for(d=X;d55295&&X<57344){if(!_){if(X>56319){if((V-=3)>-1)l.push(239,191,189);continue}else if(d+1===O){if((V-=3)>-1)l.push(239,191,189);continue}_=X;continue}if(X<56320){if((V-=3)>-1)l.push(239,191,189);_=X;continue}X=(_-55296<<10|X-56320)+65536}else if(_){if((V-=3)>-1)l.push(239,191,189)}if(_=null,X<128){if((V-=1)<0)break;l.push(X)}else if(X<2048){if((V-=2)<0)break;l.push(X>>6|192,X&63|128)}else if(X<65536){if((V-=3)<0)break;l.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((V-=4)<0)break;l.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw Error("Invalid code point")}return l}function u(k){var V=[];for(var X=0;X>8,_=X%256,l.push(_),l.push(O)}return l}function Z0(k){return U.toByteArray(z(k))}function g(k,V,X,O){for(var _=0;_=V.length||_>=k.length)break;V[_+X]=k[_]}return _}function f(k,V){return k instanceof V||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===V.name}function R(k){return k!==k}var p=function(){var k="0123456789abcdef",V=Array(256);for(var X=0;X<16;++X){var O=X*16;for(var _=0;_<16;++_)V[O+_]=k[X]+k[_]}return V}()}),MB=R0((B,U)=>{U.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var Y={},Q=Symbol("test"),K=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var Z=42;Y[Q]=Z;for(var J in Y)return!1;if(typeof Object.keys==="function"&&Object.keys(Y).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(Y).length!==0)return!1;var q=Object.getOwnPropertySymbols(Y);if(q.length!==1||q[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(Y,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var W=Object.getOwnPropertyDescriptor(Y,Q);if(W.value!==Z||W.enumerable!==!0)return!1}return!0}}),b8=R0((B,U)=>{var G=MB();U.exports=function(){return G()&&!!Symbol.toStringTag}}),RB=R0((B,U)=>{U.exports=Object}),HU=R0((B,U)=>{U.exports=Error}),FU=R0((B,U)=>{U.exports=EvalError}),WU=R0((B,U)=>{U.exports=RangeError}),PU=R0((B,U)=>{U.exports=ReferenceError}),LB=R0((B,U)=>{U.exports=SyntaxError}),x1=R0((B,U)=>{U.exports=TypeError}),AU=R0((B,U)=>{U.exports=URIError}),jU=R0((B,U)=>{U.exports=Math.abs}),NU=R0((B,U)=>{U.exports=Math.floor}),wU=R0((B,U)=>{U.exports=Math.max}),zU=R0((B,U)=>{U.exports=Math.min}),EU=R0((B,U)=>{U.exports=Math.pow}),DU=R0((B,U)=>{U.exports=Math.round}),TU=R0((B,U)=>{U.exports=Number.isNaN||function(Y){return Y!==Y}}),CU=R0((B,U)=>{var G=TU();U.exports=function(Q){if(G(Q)||Q===0)return Q;return Q<0?-1:1}}),kU=R0((B,U)=>{U.exports=Object.getOwnPropertyDescriptor}),K1=R0((B,U)=>{var G=kU();if(G)try{G([],"length")}catch(Y){G=null}U.exports=G}),_1=R0((B,U)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(Y){G=!1}U.exports=G}),$U=R0((B,U)=>{var G=typeof Symbol<"u"&&Symbol,Y=MB();U.exports=function(){if(typeof G!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof G("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return Y()}}),IB=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),OB=R0((B,U)=>{U.exports=RB().getPrototypeOf||null}),SU=R0((B,U)=>{var G="Function.prototype.bind called on incompatible ",Y=Object.prototype.toString,Q=Math.max,K="[object Function]",Z=function(I,H){var T=[];for(var A=0;A{var G=SU();U.exports=Function.prototype.bind||G}),v8=R0((B,U)=>{U.exports=Function.prototype.call}),y8=R0((B,U)=>{U.exports=Function.prototype.apply}),bU=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),HB=R0((B,U)=>{var G=V1(),Y=y8(),Q=v8();U.exports=bU()||G.call(Q,Y)}),g8=R0((B,U)=>{var G=V1(),Y=x1(),Q=v8(),K=HB();U.exports=function(J){if(J.length<1||typeof J[0]!=="function")throw new Y("a function is required");return K(G,Q,J)}}),vU=R0((B,U)=>{var G=g8(),Y=K1(),Q;try{Q=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var K=!!Q&&Y&&Y(Object.prototype,"__proto__"),Z=Object,J=Z.getPrototypeOf;U.exports=K&&typeof K.get==="function"?G([K.get]):typeof J==="function"?function(W){return J(W==null?W:Z(W))}:!1}),FB=R0((B,U)=>{var G=IB(),Y=OB(),Q=vU();U.exports=G?function(Z){return G(Z)}:Y?function(Z){if(!Z||typeof Z!=="object"&&typeof Z!=="function")throw TypeError("getProto: not an object");return Y(Z)}:Q?function(Z){return Q(Z)}:null}),yU=R0((B,U)=>{var G=Function.prototype.call,Y=Object.prototype.hasOwnProperty;U.exports=V1().call(G,Y)}),WB=R0((B,U)=>{var G,Y=RB(),Q=HU(),K=FU(),Z=WU(),J=PU(),q=LB(),W=x1(),I=AU(),H=jU(),T=NU(),A=wU(),P=zU(),j=EU(),E=DU(),C=CU(),N=Function,v=function(h){try{return N('"use strict"; return ('+h+").constructor;")()}catch(Z0){}},S=K1(),F=_1(),M=function(){throw new W},$=S?function(){try{return arguments.callee,M}catch(h){try{return S(arguments,"callee").get}catch(Z0){return M}}}():M,x=$U()(),w=FB(),a=OB(),U0=IB(),b=y8(),c=v8(),D={},m=typeof Uint8Array>"u"||!w?G:w(Uint8Array),B0={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":x&&w?w([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":D,"%AsyncGenerator%":D,"%AsyncGeneratorFunction%":D,"%AsyncIteratorPrototype%":D,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q,"%eval%":eval,"%EvalError%":K,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":N,"%GeneratorFunction%":D,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":x&&w?w(w([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!x||!w?G:w(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Y,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Z,"%ReferenceError%":J,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!x||!w?G:w(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":x&&w?w(""[Symbol.iterator]()):G,"%Symbol%":x?Symbol:G,"%SyntaxError%":q,"%ThrowTypeError%":$,"%TypedArray%":m,"%TypeError%":W,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":I,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":c,"%Function.prototype.apply%":b,"%Object.defineProperty%":F,"%Object.getPrototypeOf%":a,"%Math.abs%":H,"%Math.floor%":T,"%Math.max%":A,"%Math.min%":P,"%Math.pow%":j,"%Math.round%":E,"%Math.sign%":C,"%Reflect.getPrototypeOf%":U0};if(w)try{null.error}catch(h){B0["%Error.prototype%"]=w(w(h))}var i=function h(Z0){var g;if(Z0==="%AsyncFunction%")g=v("async function () {}");else if(Z0==="%GeneratorFunction%")g=v("function* () {}");else if(Z0==="%AsyncGeneratorFunction%")g=v("async function* () {}");else if(Z0==="%AsyncGenerator%"){var f=h("%AsyncGeneratorFunction%");if(f)g=f.prototype}else if(Z0==="%AsyncIteratorPrototype%"){var R=h("%AsyncGenerator%");if(R&&w)g=w(R.prototype)}return B0[Z0]=g,g},V0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},s=V1(),G0=yU(),r=s.call(c,Array.prototype.concat),y=s.call(b,Array.prototype.splice),n=s.call(c,String.prototype.replace),o=s.call(c,String.prototype.slice),Y0=s.call(c,RegExp.prototype.exec),O0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,z=/\\(\\)?/g,L=function(Z0){var g=o(Z0,0,1),f=o(Z0,-1);if(g==="%"&&f!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(f==="%"&&g!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var R=[];return n(Z0,O0,function(p,k,V,X){R[R.length]=V?n(X,z,"$1"):k||p}),R},u=function(Z0,g){var f=Z0,R;if(G0(V0,f))R=V0[f],f="%"+R[0]+"%";if(G0(B0,f)){var p=B0[f];if(p===D)p=i(f);if(typeof p>"u"&&!g)throw new W("intrinsic "+Z0+" exists, but is not available. Please file an issue!");return{alias:R,name:f,value:p}}throw new q("intrinsic "+Z0+" does not exist!")};U.exports=function(Z0,g){if(typeof Z0!=="string"||Z0.length===0)throw new W("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof g!=="boolean")throw new W('"allowMissing" argument must be a boolean');if(Y0(/^%?[^%]*%?$/,Z0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=L(Z0),R=f.length>0?f[0]:"",p=u("%"+R+"%",g),k=p.name,V=p.value,X=!1,O=p.alias;if(O)R=O[0],y(f,r([0,1],O));for(var _=1,l=!0;_=f.length){var K0=S(V,d);if(l=!!K0,l&&"get"in K0&&!("originalValue"in K0.get))V=K0.get;else V=V[d]}else l=G0(V,d),V=V[d];if(l&&!X)B0[k]=V}}return V}}),PB=R0((B,U)=>{var G=WB(),Y=g8(),Q=Y([G("%String.prototype.indexOf%")]);U.exports=function(Z,J){var q=G(Z,!!J);if(typeof q==="function"&&Q(Z,".prototype.")>-1)return Y([q]);return q}}),gU=R0((B,U)=>{var G=b8()(),Y=PB()("Object.prototype.toString"),Q=function(q){if(G&&q&&typeof q==="object"&&Symbol.toStringTag in q)return!1;return Y(q)==="[object Arguments]"},K=function(q){if(Q(q))return!0;return q!==null&&typeof q==="object"&&"length"in q&&typeof q.length==="number"&&q.length>=0&&Y(q)!=="[object Array]"&&"callee"in q&&Y(q.callee)==="[object Function]"},Z=function(){return Q(arguments)}();Q.isLegacyArguments=K,U.exports=Z?Q:K}),fU=R0((B,U)=>{var G=Object.prototype.toString,Y=Function.prototype.toString,Q=/^\s*(?:function)?\*/,K=b8()(),Z=Object.getPrototypeOf,J=function(){if(!K)return!1;try{return Function("return function*() {}")()}catch(W){}},q;U.exports=function(I){if(typeof I!=="function")return!1;if(Q.test(Y.call(I)))return!0;if(!K)return G.call(I)==="[object GeneratorFunction]";if(!Z)return!1;if(typeof q>"u"){var H=J();q=H?Z(H):!1}return Z(I)===q}}),xU=R0((B,U)=>{var G=Function.prototype.toString,Y=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,Q,K;if(typeof Y==="function"&&typeof Object.defineProperty==="function")try{Q=Object.defineProperty({},"length",{get:function(){throw K}}),K={},Y(function(){throw 42},null,Q)}catch(S){if(S!==K)Y=null}else Y=null;var Z=/^\s*class\b/,J=function(F){try{var M=G.call(F);return Z.test(M)}catch($){return!1}},q=function(F){try{if(J(F))return!1;return G.call(F),!0}catch(M){return!1}},W=Object.prototype.toString,I="[object Object]",H="[object Function]",T="[object GeneratorFunction]",A="[object HTMLAllCollection]",P="[object HTML document.all class]",j="[object HTMLCollection]",E=typeof Symbol==="function"&&!!Symbol.toStringTag,C=!(0 in[,]),N=function(){return!1};if(typeof document==="object"){var v=document.all;if(W.call(v)===W.call(document.all))N=function(F){if((C||!F)&&(typeof F>"u"||typeof F==="object"))try{var M=W.call(F);return(M===A||M===P||M===j||M===I)&&F("")==null}catch($){}return!1}}U.exports=Y?function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;try{Y(F,null,Q)}catch(M){if(M!==K)return!1}return!J(F)&&q(F)}:function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;if(E)return q(F);if(J(F))return!1;var M=W.call(F);if(M!==H&&M!==T&&!/^\[object HTML/.test(M))return!1;return q(F)}}),_U=R0((B,U)=>{var G=xU(),Y=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,K=function(I,H,T){for(var A=0,P=I.length;A=3)A=T;if(q(I))K(I,H,A);else if(typeof I==="string")Z(I,H,A);else J(I,H,A)}}),hU=R0((B,U)=>{U.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),uU=R0((B,U)=>{d2();var G=hU(),Y=typeof globalThis>"u"?v0:globalThis;U.exports=function(){var K=[];for(var Z=0;Z{var G=_1(),Y=LB(),Q=x1(),K=K1();U.exports=function(J,q,W){if(!J||typeof J!=="object"&&typeof J!=="function")throw new Q("`obj` must be an object or a function`");if(typeof q!=="string"&&typeof q!=="symbol")throw new Q("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new Q("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new Q("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new Q("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new Q("`loose`, if provided, must be a boolean");var I=arguments.length>3?arguments[3]:null,H=arguments.length>4?arguments[4]:null,T=arguments.length>5?arguments[5]:null,A=arguments.length>6?arguments[6]:!1,P=!!K&&K(J,q);if(G)G(J,q,{configurable:T===null&&P?P.configurable:!T,enumerable:I===null&&P?P.enumerable:!I,value:W,writable:H===null&&P?P.writable:!H});else if(A||!I&&!H&&!T)J[q]=W;else throw new Y("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),cU=R0((B,U)=>{var G=_1(),Y=function(){return!!G};Y.hasArrayLengthDefineBug=function(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(K){return!0}},U.exports=Y}),mU=R0((B,U)=>{var G=WB(),Y=dU(),Q=cU()(),K=K1(),Z=x1(),J=G("%Math.floor%");U.exports=function(W,I){if(typeof W!=="function")throw new Z("`fn` is not a function");if(typeof I!=="number"||I<0||I>4294967295||J(I)!==I)throw new Z("`length` must be a positive 32-bit integer");var H=arguments.length>2&&!!arguments[2],T=!0,A=!0;if("length"in W&&K){var P=K(W,"length");if(P&&!P.configurable)T=!1;if(P&&!P.writable)A=!1}if(T||A||!H)if(Q)Y(W,"length",I,!0,!0);else Y(W,"length",I);return W}}),lU=R0((B,U)=>{var G=V1(),Y=y8(),Q=HB();U.exports=function(){return Q(G,Y,arguments)}}),aU=R0((B,U)=>{var G=mU(),Y=_1(),Q=g8(),K=lU();if(U.exports=function(J){var q=Q(arguments),W=J.length-(arguments.length-1);return G(q,1+(W>0?W:0),!0)},Y)Y(U.exports,"apply",{value:K});else U.exports.apply=K}),AB=R0((B,U)=>{d2();var G=_U(),Y=uU(),Q=aU(),K=PB(),Z=K1(),J=FB(),q=K("Object.prototype.toString"),W=b8()(),I=typeof globalThis>"u"?v0:globalThis,H=Y(),T=K("String.prototype.slice"),A=K("Array.prototype.indexOf",!0)||function(N,v){for(var S=0;S-1)return v;if(v!=="Object")return!1;return E(N)}if(!Z)return null;return j(N)}}),pU=R0((B,U)=>{var G=AB();U.exports=function(Q){return!!G(Q)}}),rU=R0((B)=>{var U=gU(),G=fU(),Y=AB(),Q=pU();function K(O){return O.call.bind(O)}var Z=typeof BigInt<"u",J=typeof Symbol<"u",q=K(Object.prototype.toString),W=K(Number.prototype.valueOf),I=K(String.prototype.valueOf),H=K(Boolean.prototype.valueOf);if(Z)var T=K(BigInt.prototype.valueOf);if(J)var A=K(Symbol.prototype.valueOf);function P(O,_){if(typeof O!=="object")return!1;try{return _(O),!0}catch(l){return!1}}B.isArgumentsObject=U,B.isGeneratorFunction=G,B.isTypedArray=Q;function j(O){return typeof Promise<"u"&&O instanceof Promise||O!==null&&typeof O==="object"&&typeof O.then==="function"&&typeof O.catch==="function"}B.isPromise=j;function E(O){if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)return ArrayBuffer.isView(O);return Q(O)||n(O)}B.isArrayBufferView=E;function C(O){return Y(O)==="Uint8Array"}B.isUint8Array=C;function N(O){return Y(O)==="Uint8ClampedArray"}B.isUint8ClampedArray=N;function v(O){return Y(O)==="Uint16Array"}B.isUint16Array=v;function S(O){return Y(O)==="Uint32Array"}B.isUint32Array=S;function F(O){return Y(O)==="Int8Array"}B.isInt8Array=F;function M(O){return Y(O)==="Int16Array"}B.isInt16Array=M;function $(O){return Y(O)==="Int32Array"}B.isInt32Array=$;function x(O){return Y(O)==="Float32Array"}B.isFloat32Array=x;function w(O){return Y(O)==="Float64Array"}B.isFloat64Array=w;function a(O){return Y(O)==="BigInt64Array"}B.isBigInt64Array=a;function U0(O){return Y(O)==="BigUint64Array"}B.isBigUint64Array=U0;function b(O){return q(O)==="[object Map]"}b.working=typeof Map<"u"&&b(new Map);function c(O){if(typeof Map>"u")return!1;return b.working?b(O):O instanceof Map}B.isMap=c;function D(O){return q(O)==="[object Set]"}D.working=typeof Set<"u"&&D(new Set);function m(O){if(typeof Set>"u")return!1;return D.working?D(O):O instanceof Set}B.isSet=m;function B0(O){return q(O)==="[object WeakMap]"}B0.working=typeof WeakMap<"u"&&B0(new WeakMap);function i(O){if(typeof WeakMap>"u")return!1;return B0.working?B0(O):O instanceof WeakMap}B.isWeakMap=i;function V0(O){return q(O)==="[object WeakSet]"}V0.working=typeof WeakSet<"u"&&V0(new WeakSet);function s(O){return V0(O)}B.isWeakSet=s;function G0(O){return q(O)==="[object ArrayBuffer]"}G0.working=typeof ArrayBuffer<"u"&&G0(new ArrayBuffer);function r(O){if(typeof ArrayBuffer>"u")return!1;return G0.working?G0(O):O instanceof ArrayBuffer}B.isArrayBuffer=r;function y(O){return q(O)==="[object DataView]"}y.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&y(new DataView(new ArrayBuffer(1),0,1));function n(O){if(typeof DataView>"u")return!1;return y.working?y(O):O instanceof DataView}B.isDataView=n;var o=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Y0(O){return q(O)==="[object SharedArrayBuffer]"}function O0(O){if(typeof o>"u")return!1;if(typeof Y0.working>"u")Y0.working=Y0(new o);return Y0.working?Y0(O):O instanceof o}B.isSharedArrayBuffer=O0;function z(O){return q(O)==="[object AsyncFunction]"}B.isAsyncFunction=z;function L(O){return q(O)==="[object Map Iterator]"}B.isMapIterator=L;function u(O){return q(O)==="[object Set Iterator]"}B.isSetIterator=u;function h(O){return q(O)==="[object Generator]"}B.isGeneratorObject=h;function Z0(O){return q(O)==="[object WebAssembly.Module]"}B.isWebAssemblyCompiledModule=Z0;function g(O){return P(O,W)}B.isNumberObject=g;function f(O){return P(O,I)}B.isStringObject=f;function R(O){return P(O,H)}B.isBooleanObject=R;function p(O){return Z&&P(O,T)}B.isBigIntObject=p;function k(O){return J&&P(O,A)}B.isSymbolObject=k;function V(O){return g(O)||f(O)||R(O)||p(O)||k(O)}B.isBoxedPrimitive=V;function X(O){return typeof Uint8Array<"u"&&(r(O)||O0(O))}B.isAnyArrayBuffer=X,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(O){Object.defineProperty(B,O,{enumerable:!1,value:function(){throw Error(O+" is not supported in userland")}})})}),iU=R0((B,U)=>{U.exports=function(Y){return Y&&typeof Y==="object"&&typeof Y.copy==="function"&&typeof Y.fill==="function"&&typeof Y.readUInt8==="function"}}),jB=R0((B)=>{P2();var U=Object.getOwnPropertyDescriptors||function(n){var o=Object.keys(n),Y0={};for(var O0=0;O0=O0)return u;switch(u){case"%s":return String(Y0[o++]);case"%d":return Number(Y0[o++]);case"%j":try{return JSON.stringify(Y0[o++])}catch(h){return"[Circular]"}default:return u}});for(var L=Y0[o];o"u")return function(){return B.deprecate(y,n).apply(this,arguments)};var o=!1;function Y0(){if(!o){if(P0.throwDeprecation)throw Error(n);else if(P0.traceDeprecation)console.trace(n);else console.error(n);o=!0}return y.apply(this,arguments)}return Y0};var Y={},Q=/^$/;if(P0.env.NODE_DEBUG){var K=P0.env.NODE_DEBUG;K=K.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Q=new RegExp("^"+K+"$","i")}B.debuglog=function(y){if(y=y.toUpperCase(),!Y[y])if(Q.test(y)){var n=P0.pid;Y[y]=function(){var o=B.format.apply(B,arguments);console.error("%s %d: %s",y,n,o)}}else Y[y]=function(){};return Y[y]};function Z(y,n){var o={seen:[],stylize:q};if(arguments.length>=3)o.depth=arguments[2];if(arguments.length>=4)o.colors=arguments[3];if(C(n))o.showHidden=n;else if(n)B._extend(o,n);if($(o.showHidden))o.showHidden=!1;if($(o.depth))o.depth=2;if($(o.colors))o.colors=!1;if($(o.customInspect))o.customInspect=!0;if(o.colors)o.stylize=J;return I(o,y,o.depth)}B.inspect=Z,Z.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Z.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function J(y,n){var o=Z.styles[n];if(o)return"\x1B["+Z.colors[o][0]+"m"+y+"\x1B["+Z.colors[o][1]+"m";else return y}function q(y,n){return y}function W(y){var n={};return y.forEach(function(o,Y0){n[o]=!0}),n}function I(y,n,o){if(y.customInspect&&n&&b(n.inspect)&&n.inspect!==B.inspect&&!(n.constructor&&n.constructor.prototype===n)){var Y0=n.inspect(o,y);if(!F(Y0))Y0=I(y,Y0,o);return Y0}var O0=H(y,n);if(O0)return O0;var z=Object.keys(n),L=W(z);if(y.showHidden)z=Object.getOwnPropertyNames(n);if(U0(n)&&(z.indexOf("message")>=0||z.indexOf("description")>=0))return T(n);if(z.length===0){if(b(n)){var u=n.name?": "+n.name:"";return y.stylize("[Function"+u+"]","special")}if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");if(a(n))return y.stylize(Date.prototype.toString.call(n),"date");if(U0(n))return T(n)}var h="",Z0=!1,g=["{","}"];if(E(n))Z0=!0,g=["[","]"];if(b(n))h=" [Function"+(n.name?": "+n.name:"")+"]";if(x(n))h=" "+RegExp.prototype.toString.call(n);if(a(n))h=" "+Date.prototype.toUTCString.call(n);if(U0(n))h=" "+T(n);if(z.length===0&&(!Z0||n.length==0))return g[0]+h+g[1];if(o<0)if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");else return y.stylize("[Object]","special");y.seen.push(n);var f;if(Z0)f=A(y,n,o,L,z);else f=z.map(function(R){return P(y,n,o,L,R,Z0)});return y.seen.pop(),j(f,h,g)}function H(y,n){if($(n))return y.stylize("undefined","undefined");if(F(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return y.stylize(o,"string")}if(S(n))return y.stylize(""+n,"number");if(C(n))return y.stylize(""+n,"boolean");if(N(n))return y.stylize("null","null")}function T(y){return"["+Error.prototype.toString.call(y)+"]"}function A(y,n,o,Y0,O0){var z=[];for(var L=0,u=n.length;L-1)if(z)u=u.split(` +*/var f1=R0((B)=>{var U=IU(),G=OU(),Y=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=J,B.SlowBuffer=N,B.INSPECT_MAX_BYTES=50;var Q=2147483647;if(B.kMaxLength=Q,J.TYPED_ARRAY_SUPPORT=K(),!J.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error==="function")console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function K(){try{var k=new Uint8Array(1),V={foo:function(){return 42}};return Object.setPrototypeOf(V,Uint8Array.prototype),Object.setPrototypeOf(k,V),k.foo()===42}catch(X){return!1}}Object.defineProperty(J.prototype,"parent",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.buffer}}),Object.defineProperty(J.prototype,"offset",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.byteOffset}});function Z(k){if(k>Q)throw RangeError('The value "'+k+'" is invalid for option "size"');var V=new Uint8Array(k);return Object.setPrototypeOf(V,J.prototype),V}function J(k,V,X){if(typeof k==="number"){if(typeof V==="string")throw TypeError('The "string" argument must be of type string. Received type number');return H(k)}return q(k,V,X)}J.poolSize=8192;function q(k,V,X){if(typeof k==="string")return T(k,V);if(ArrayBuffer.isView(k))return P(k);if(k==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(f(k,ArrayBuffer)||k&&f(k.buffer,ArrayBuffer))return j(k,V,X);if(typeof SharedArrayBuffer<"u"&&(f(k,SharedArrayBuffer)||k&&f(k.buffer,SharedArrayBuffer)))return j(k,V,X);if(typeof k==="number")throw TypeError('The "value" argument must not be of type number. Received type number');var O=k.valueOf&&k.valueOf();if(O!=null&&O!==k)return J.from(O,V,X);var _=E(k);if(_)return _;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]==="function")return J.from(k[Symbol.toPrimitive]("string"),V,X);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}J.from=function(k,V,X){return q(k,V,X)},Object.setPrototypeOf(J.prototype,Uint8Array.prototype),Object.setPrototypeOf(J,Uint8Array);function W(k){if(typeof k!=="number")throw TypeError('"size" argument must be of type number');else if(k<0)throw RangeError('The value "'+k+'" is invalid for option "size"')}function I(k,V,X){if(W(k),k<=0)return Z(k);if(V!==void 0)return typeof X==="string"?Z(k).fill(V,X):Z(k).fill(V);return Z(k)}J.alloc=function(k,V,X){return I(k,V,X)};function H(k){return W(k),Z(k<0?0:C(k)|0)}J.allocUnsafe=function(k){return H(k)},J.allocUnsafeSlow=function(k){return H(k)};function T(k,V){if(typeof V!=="string"||V==="")V="utf8";if(!J.isEncoding(V))throw TypeError("Unknown encoding: "+V);var X=v(k,V)|0,O=Z(X),_=O.write(k,V);if(_!==X)O=O.slice(0,_);return O}function A(k){var V=k.length<0?0:C(k.length)|0,X=Z(V);for(var O=0;O=Q)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return k|0}function N(k){if(+k!=k)k=0;return J.alloc(+k)}J.isBuffer=function(V){return V!=null&&V._isBuffer===!0&&V!==J.prototype},J.compare=function(V,X){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(f(X,Uint8Array))X=J.from(X,X.offset,X.byteLength);if(!J.isBuffer(V)||!J.isBuffer(X))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(V===X)return 0;var O=V.length,_=X.length;for(var l=0,d=Math.min(O,_);l_.length)J.from(d).copy(_,l);else Uint8Array.prototype.set.call(_,d,l);else if(!J.isBuffer(d))throw TypeError('"list" argument must be an Array of Buffers');else d.copy(_,l);l+=d.length}return _};function v(k,V){if(J.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||f(k,ArrayBuffer))return k.byteLength;if(typeof k!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);var X=k.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&X===0)return 0;var _=!1;for(;;)switch(V){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return L(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return Z0(k).length;default:if(_)return O?-1:L(k).length;V=(""+V).toLowerCase(),_=!0}}J.byteLength=v;function S(k,V,X){var O=!1;if(V===void 0||V<0)V=0;if(V>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,V>>>=0,X<=V)return"";if(!k)k="utf8";while(!0)switch(k){case"hex":return s(this,V,X);case"utf8":case"utf-8":return D(this,V,X);case"ascii":return i(this,V,X);case"latin1":case"binary":return V0(this,V,X);case"base64":return c(this,V,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G0(this,V,X);default:if(O)throw TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),O=!0}}J.prototype._isBuffer=!0;function F(k,V,X){var O=k[V];k[V]=k[X],k[X]=O}if(J.prototype.swap16=function(){var V=this.length;if(V%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var X=0;XX)V+=" ... ";return""},Y)J.prototype[Y]=J.prototype.inspect;J.prototype.compare=function(V,X,O,_,l){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(!J.isBuffer(V))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof V);if(X===void 0)X=0;if(O===void 0)O=V?V.length:0;if(_===void 0)_=0;if(l===void 0)l=this.length;if(X<0||O>V.length||_<0||l>this.length)throw RangeError("out of range index");if(_>=l&&X>=O)return 0;if(_>=l)return-1;if(X>=O)return 1;if(X>>>=0,O>>>=0,_>>>=0,l>>>=0,this===V)return 0;var d=l-_,Q0=O-X,X0=Math.min(d,Q0),K0=this.slice(_,l),I0=V.slice(X,O);for(var F0=0;F02147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,R(X))X=_?0:k.length-1;if(X<0)X=k.length+X;if(X>=k.length)if(_)return-1;else X=k.length-1;else if(X<0)if(_)X=0;else return-1;if(typeof V==="string")V=J.from(V,O);if(J.isBuffer(V)){if(V.length===0)return-1;return $(k,V,X,O,_)}else if(typeof V==="number"){if(V=V&255,typeof Uint8Array.prototype.indexOf==="function")if(_)return Uint8Array.prototype.indexOf.call(k,V,X);else return Uint8Array.prototype.lastIndexOf.call(k,V,X);return $(k,[V],X,O,_)}throw TypeError("val must be string, number or Buffer")}function $(k,V,X,O,_){var l=1,d=k.length,Q0=V.length;if(O!==void 0){if(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le"){if(k.length<2||V.length<2)return-1;l=2,d/=2,Q0/=2,X/=2}}function X0(k0,L2){if(l===1)return k0[L2];else return k0.readUInt16BE(L2*l)}var K0;if(_){var I0=-1;for(K0=X;K0d)X=d-Q0;for(K0=X;K0>=0;K0--){var F0=!0;for(var W0=0;W0_)O=_;var l=V.length;if(O>l/2)O=l/2;for(var d=0;d>>0,isFinite(O)){if(O=O>>>0,_===void 0)_="utf8"}else _=O,O=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-X;if(O===void 0||O>l)O=l;if(V.length>0&&(O<0||X<0)||X>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!_)_="utf8";var d=!1;for(;;)switch(_){case"hex":return x(this,V,X,O);case"utf8":case"utf-8":return z(this,V,X,O);case"ascii":case"latin1":case"binary":return a(this,V,X,O);case"base64":return U0(this,V,X,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,V,X,O);default:if(d)throw TypeError("Unknown encoding: "+_);_=(""+_).toLowerCase(),d=!0}},J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c(k,V,X){if(V===0&&X===k.length)return U.fromByteArray(k);else return U.fromByteArray(k.slice(V,X))}function D(k,V,X){X=Math.min(k.length,X);var O=[],_=V;while(_239?4:l>223?3:l>191?2:1;if(_+Q0<=X){var X0,K0,I0,F0;switch(Q0){case 1:if(l<128)d=l;break;case 2:if(X0=k[_+1],(X0&192)===128){if(F0=(l&31)<<6|X0&63,F0>127)d=F0}break;case 3:if(X0=k[_+1],K0=k[_+2],(X0&192)===128&&(K0&192)===128){if(F0=(l&15)<<12|(X0&63)<<6|K0&63,F0>2047&&(F0<55296||F0>57343))d=F0}break;case 4:if(X0=k[_+1],K0=k[_+2],I0=k[_+3],(X0&192)===128&&(K0&192)===128&&(I0&192)===128){if(F0=(l&15)<<18|(X0&63)<<12|(K0&63)<<6|I0&63,F0>65535&&F0<1114112)d=F0}}}if(d===null)d=65533,Q0=1;else if(d>65535)d-=65536,O.push(d>>>10&1023|55296),d=56320|d&1023;O.push(d),_+=Q0}return B0(O)}var m=4096;function B0(k){var V=k.length;if(V<=m)return String.fromCharCode.apply(String,k);var X="",O=0;while(OO)X=O;var _="";for(var l=V;lO)V=O;if(X<0){if(X+=O,X<0)X=0}else if(X>O)X=O;if(XX)throw RangeError("Trying to access beyond buffer length")}J.prototype.readUintLE=J.prototype.readUIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V+--X],l=1;while(X>0&&(l*=256))_+=this[V+--X]*l;return _},J.prototype.readUint8=J.prototype.readUInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);return this[V]},J.prototype.readUint16LE=J.prototype.readUInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]|this[V+1]<<8},J.prototype.readUint16BE=J.prototype.readUInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]<<8|this[V+1]},J.prototype.readUint32LE=J.prototype.readUInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return(this[V]|this[V+1]<<8|this[V+2]<<16)+this[V+3]*16777216},J.prototype.readUint32BE=J.prototype.readUInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]*16777216+(this[V+1]<<16|this[V+2]<<8|this[V+3])},J.prototype.readIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d=l)_-=Math.pow(2,8*X);return _},J.prototype.readIntBE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=X,l=1,d=this[V+--_];while(_>0&&(l*=256))d+=this[V+--_]*l;if(l*=128,d>=l)d-=Math.pow(2,8*X);return d},J.prototype.readInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);if(!(this[V]&128))return this[V];return(255-this[V]+1)*-1},J.prototype.readInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V]|this[V+1]<<8;return O&32768?O|4294901760:O},J.prototype.readInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V+1]|this[V]<<8;return O&32768?O|4294901760:O},J.prototype.readInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]|this[V+1]<<8|this[V+2]<<16|this[V+3]<<24},J.prototype.readInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]<<24|this[V+1]<<16|this[V+2]<<8|this[V+3]},J.prototype.readFloatLE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!0,23,4)},J.prototype.readFloatBE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!1,23,4)},J.prototype.readDoubleLE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!0,52,8)},J.prototype.readDoubleBE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!1,52,8)};function y(k,V,X,O,_,l){if(!J.isBuffer(k))throw TypeError('"buffer" argument must be a Buffer instance');if(V>_||Vk.length)throw RangeError("Index out of range")}J.prototype.writeUintLE=J.prototype.writeUIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=1,Q0=0;this[X]=V&255;while(++Q0>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=O-1,Q0=1;this[X+d]=V&255;while(--d>=0&&(Q0*=256))this[X+d]=V/Q0&255;return X+O},J.prototype.writeUint8=J.prototype.writeUInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,255,0);return this[X]=V&255,X+1},J.prototype.writeUint16LE=J.prototype.writeUInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeUint16BE=J.prototype.writeUInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeUint32LE=J.prototype.writeUInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X+3]=V>>>24,this[X+2]=V>>>16,this[X+1]=V>>>8,this[X]=V&255,X+4},J.prototype.writeUint32BE=J.prototype.writeUInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4},J.prototype.writeIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=0,Q0=1,X0=0;this[X]=V&255;while(++d>0)-X0&255}return X+O},J.prototype.writeIntBE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=O-1,Q0=1,X0=0;this[X+d]=V&255;while(--d>=0&&(Q0*=256)){if(V<0&&X0===0&&this[X+d+1]!==0)X0=1;this[X+d]=(V/Q0>>0)-X0&255}return X+O},J.prototype.writeInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,127,-128);if(V<0)V=255+V+1;return this[X]=V&255,X+1},J.prototype.writeInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);return this[X]=V&255,this[X+1]=V>>>8,this[X+2]=V>>>16,this[X+3]=V>>>24,X+4},J.prototype.writeInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);if(V<0)V=4294967295+V+1;return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4};function n(k,V,X,O,_,l){if(X+O>k.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function o(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return G.write(k,V,X,O,23,4),X+4}J.prototype.writeFloatLE=function(V,X,O){return o(this,V,X,!0,O)},J.prototype.writeFloatBE=function(V,X,O){return o(this,V,X,!1,O)};function Y0(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return G.write(k,V,X,O,52,8),X+8}J.prototype.writeDoubleLE=function(V,X,O){return Y0(this,V,X,!0,O)},J.prototype.writeDoubleBE=function(V,X,O){return Y0(this,V,X,!1,O)},J.prototype.copy=function(V,X,O,_){if(!J.isBuffer(V))throw TypeError("argument should be a Buffer");if(!O)O=0;if(!_&&_!==0)_=this.length;if(X>=V.length)X=V.length;if(!X)X=0;if(_>0&&_=this.length)throw RangeError("Index out of range");if(_<0)throw RangeError("sourceEnd out of bounds");if(_>this.length)_=this.length;if(V.length-X<_-O)_=V.length-X+O;var l=_-O;if(this===V&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(X,O,_);else Uint8Array.prototype.set.call(V,this.subarray(O,_),X);return l},J.prototype.fill=function(V,X,O,_){if(typeof V==="string"){if(typeof X==="string")_=X,X=0,O=this.length;else if(typeof O==="string")_=O,O=this.length;if(_!==void 0&&typeof _!=="string")throw TypeError("encoding must be a string");if(typeof _==="string"&&!J.isEncoding(_))throw TypeError("Unknown encoding: "+_);if(V.length===1){var l=V.charCodeAt(0);if(_==="utf8"&&l<128||_==="latin1")V=l}}else if(typeof V==="number")V=V&255;else if(typeof V==="boolean")V=Number(V);if(X<0||this.length>>0,O=O===void 0?this.length:O>>>0,!V)V=0;var d;if(typeof V==="number")for(d=X;d55295&&X<57344){if(!_){if(X>56319){if((V-=3)>-1)l.push(239,191,189);continue}else if(d+1===O){if((V-=3)>-1)l.push(239,191,189);continue}_=X;continue}if(X<56320){if((V-=3)>-1)l.push(239,191,189);_=X;continue}X=(_-55296<<10|X-56320)+65536}else if(_){if((V-=3)>-1)l.push(239,191,189)}if(_=null,X<128){if((V-=1)<0)break;l.push(X)}else if(X<2048){if((V-=2)<0)break;l.push(X>>6|192,X&63|128)}else if(X<65536){if((V-=3)<0)break;l.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((V-=4)<0)break;l.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw Error("Invalid code point")}return l}function u(k){var V=[];for(var X=0;X>8,_=X%256,l.push(_),l.push(O)}return l}function Z0(k){return U.toByteArray(w(k))}function g(k,V,X,O){for(var _=0;_=V.length||_>=k.length)break;V[_+X]=k[_]}return _}function f(k,V){return k instanceof V||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===V.name}function R(k){return k!==k}var p=function(){var k="0123456789abcdef",V=Array(256);for(var X=0;X<16;++X){var O=X*16;for(var _=0;_<16;++_)V[O+_]=k[X]+k[_]}return V}()}),MB=R0((B,U)=>{U.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var Y={},Q=Symbol("test"),K=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var Z=42;Y[Q]=Z;for(var J in Y)return!1;if(typeof Object.keys==="function"&&Object.keys(Y).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(Y).length!==0)return!1;var q=Object.getOwnPropertySymbols(Y);if(q.length!==1||q[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(Y,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var W=Object.getOwnPropertyDescriptor(Y,Q);if(W.value!==Z||W.enumerable!==!0)return!1}return!0}}),b8=R0((B,U)=>{var G=MB();U.exports=function(){return G()&&!!Symbol.toStringTag}}),RB=R0((B,U)=>{U.exports=Object}),HU=R0((B,U)=>{U.exports=Error}),FU=R0((B,U)=>{U.exports=EvalError}),WU=R0((B,U)=>{U.exports=RangeError}),PU=R0((B,U)=>{U.exports=ReferenceError}),LB=R0((B,U)=>{U.exports=SyntaxError}),x1=R0((B,U)=>{U.exports=TypeError}),AU=R0((B,U)=>{U.exports=URIError}),jU=R0((B,U)=>{U.exports=Math.abs}),NU=R0((B,U)=>{U.exports=Math.floor}),zU=R0((B,U)=>{U.exports=Math.max}),wU=R0((B,U)=>{U.exports=Math.min}),EU=R0((B,U)=>{U.exports=Math.pow}),DU=R0((B,U)=>{U.exports=Math.round}),TU=R0((B,U)=>{U.exports=Number.isNaN||function(Y){return Y!==Y}}),CU=R0((B,U)=>{var G=TU();U.exports=function(Q){if(G(Q)||Q===0)return Q;return Q<0?-1:1}}),kU=R0((B,U)=>{U.exports=Object.getOwnPropertyDescriptor}),K1=R0((B,U)=>{var G=kU();if(G)try{G([],"length")}catch(Y){G=null}U.exports=G}),_1=R0((B,U)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(Y){G=!1}U.exports=G}),$U=R0((B,U)=>{var G=typeof Symbol<"u"&&Symbol,Y=MB();U.exports=function(){if(typeof G!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof G("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return Y()}}),IB=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),OB=R0((B,U)=>{U.exports=RB().getPrototypeOf||null}),SU=R0((B,U)=>{var G="Function.prototype.bind called on incompatible ",Y=Object.prototype.toString,Q=Math.max,K="[object Function]",Z=function(I,H){var T=[];for(var A=0;A{var G=SU();U.exports=Function.prototype.bind||G}),v8=R0((B,U)=>{U.exports=Function.prototype.call}),y8=R0((B,U)=>{U.exports=Function.prototype.apply}),bU=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),HB=R0((B,U)=>{var G=V1(),Y=y8(),Q=v8();U.exports=bU()||G.call(Q,Y)}),g8=R0((B,U)=>{var G=V1(),Y=x1(),Q=v8(),K=HB();U.exports=function(J){if(J.length<1||typeof J[0]!=="function")throw new Y("a function is required");return K(G,Q,J)}}),vU=R0((B,U)=>{var G=g8(),Y=K1(),Q;try{Q=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var K=!!Q&&Y&&Y(Object.prototype,"__proto__"),Z=Object,J=Z.getPrototypeOf;U.exports=K&&typeof K.get==="function"?G([K.get]):typeof J==="function"?function(W){return J(W==null?W:Z(W))}:!1}),FB=R0((B,U)=>{var G=IB(),Y=OB(),Q=vU();U.exports=G?function(Z){return G(Z)}:Y?function(Z){if(!Z||typeof Z!=="object"&&typeof Z!=="function")throw TypeError("getProto: not an object");return Y(Z)}:Q?function(Z){return Q(Z)}:null}),yU=R0((B,U)=>{var G=Function.prototype.call,Y=Object.prototype.hasOwnProperty;U.exports=V1().call(G,Y)}),WB=R0((B,U)=>{var G,Y=RB(),Q=HU(),K=FU(),Z=WU(),J=PU(),q=LB(),W=x1(),I=AU(),H=jU(),T=NU(),A=zU(),P=wU(),j=EU(),E=DU(),C=CU(),N=Function,v=function(h){try{return N('"use strict"; return ('+h+").constructor;")()}catch(Z0){}},S=K1(),F=_1(),M=function(){throw new W},$=S?function(){try{return arguments.callee,M}catch(h){try{return S(arguments,"callee").get}catch(Z0){return M}}}():M,x=$U()(),z=FB(),a=OB(),U0=IB(),b=y8(),c=v8(),D={},m=typeof Uint8Array>"u"||!z?G:z(Uint8Array),B0={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":x&&z?z([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":D,"%AsyncGenerator%":D,"%AsyncGeneratorFunction%":D,"%AsyncIteratorPrototype%":D,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q,"%eval%":eval,"%EvalError%":K,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":N,"%GeneratorFunction%":D,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":x&&z?z(z([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!x||!z?G:z(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Y,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Z,"%ReferenceError%":J,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!x||!z?G:z(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":x&&z?z(""[Symbol.iterator]()):G,"%Symbol%":x?Symbol:G,"%SyntaxError%":q,"%ThrowTypeError%":$,"%TypedArray%":m,"%TypeError%":W,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":I,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":c,"%Function.prototype.apply%":b,"%Object.defineProperty%":F,"%Object.getPrototypeOf%":a,"%Math.abs%":H,"%Math.floor%":T,"%Math.max%":A,"%Math.min%":P,"%Math.pow%":j,"%Math.round%":E,"%Math.sign%":C,"%Reflect.getPrototypeOf%":U0};if(z)try{null.error}catch(h){B0["%Error.prototype%"]=z(z(h))}var i=function h(Z0){var g;if(Z0==="%AsyncFunction%")g=v("async function () {}");else if(Z0==="%GeneratorFunction%")g=v("function* () {}");else if(Z0==="%AsyncGeneratorFunction%")g=v("async function* () {}");else if(Z0==="%AsyncGenerator%"){var f=h("%AsyncGeneratorFunction%");if(f)g=f.prototype}else if(Z0==="%AsyncIteratorPrototype%"){var R=h("%AsyncGenerator%");if(R&&z)g=z(R.prototype)}return B0[Z0]=g,g},V0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},s=V1(),G0=yU(),r=s.call(c,Array.prototype.concat),y=s.call(b,Array.prototype.splice),n=s.call(c,String.prototype.replace),o=s.call(c,String.prototype.slice),Y0=s.call(c,RegExp.prototype.exec),O0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,L=function(Z0){var g=o(Z0,0,1),f=o(Z0,-1);if(g==="%"&&f!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(f==="%"&&g!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var R=[];return n(Z0,O0,function(p,k,V,X){R[R.length]=V?n(X,w,"$1"):k||p}),R},u=function(Z0,g){var f=Z0,R;if(G0(V0,f))R=V0[f],f="%"+R[0]+"%";if(G0(B0,f)){var p=B0[f];if(p===D)p=i(f);if(typeof p>"u"&&!g)throw new W("intrinsic "+Z0+" exists, but is not available. Please file an issue!");return{alias:R,name:f,value:p}}throw new q("intrinsic "+Z0+" does not exist!")};U.exports=function(Z0,g){if(typeof Z0!=="string"||Z0.length===0)throw new W("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof g!=="boolean")throw new W('"allowMissing" argument must be a boolean');if(Y0(/^%?[^%]*%?$/,Z0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=L(Z0),R=f.length>0?f[0]:"",p=u("%"+R+"%",g),k=p.name,V=p.value,X=!1,O=p.alias;if(O)R=O[0],y(f,r([0,1],O));for(var _=1,l=!0;_=f.length){var K0=S(V,d);if(l=!!K0,l&&"get"in K0&&!("originalValue"in K0.get))V=K0.get;else V=V[d]}else l=G0(V,d),V=V[d];if(l&&!X)B0[k]=V}}return V}}),PB=R0((B,U)=>{var G=WB(),Y=g8(),Q=Y([G("%String.prototype.indexOf%")]);U.exports=function(Z,J){var q=G(Z,!!J);if(typeof q==="function"&&Q(Z,".prototype.")>-1)return Y([q]);return q}}),gU=R0((B,U)=>{var G=b8()(),Y=PB()("Object.prototype.toString"),Q=function(q){if(G&&q&&typeof q==="object"&&Symbol.toStringTag in q)return!1;return Y(q)==="[object Arguments]"},K=function(q){if(Q(q))return!0;return q!==null&&typeof q==="object"&&"length"in q&&typeof q.length==="number"&&q.length>=0&&Y(q)!=="[object Array]"&&"callee"in q&&Y(q.callee)==="[object Function]"},Z=function(){return Q(arguments)}();Q.isLegacyArguments=K,U.exports=Z?Q:K}),fU=R0((B,U)=>{var G=Object.prototype.toString,Y=Function.prototype.toString,Q=/^\s*(?:function)?\*/,K=b8()(),Z=Object.getPrototypeOf,J=function(){if(!K)return!1;try{return Function("return function*() {}")()}catch(W){}},q;U.exports=function(I){if(typeof I!=="function")return!1;if(Q.test(Y.call(I)))return!0;if(!K)return G.call(I)==="[object GeneratorFunction]";if(!Z)return!1;if(typeof q>"u"){var H=J();q=H?Z(H):!1}return Z(I)===q}}),xU=R0((B,U)=>{var G=Function.prototype.toString,Y=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,Q,K;if(typeof Y==="function"&&typeof Object.defineProperty==="function")try{Q=Object.defineProperty({},"length",{get:function(){throw K}}),K={},Y(function(){throw 42},null,Q)}catch(S){if(S!==K)Y=null}else Y=null;var Z=/^\s*class\b/,J=function(F){try{var M=G.call(F);return Z.test(M)}catch($){return!1}},q=function(F){try{if(J(F))return!1;return G.call(F),!0}catch(M){return!1}},W=Object.prototype.toString,I="[object Object]",H="[object Function]",T="[object GeneratorFunction]",A="[object HTMLAllCollection]",P="[object HTML document.all class]",j="[object HTMLCollection]",E=typeof Symbol==="function"&&!!Symbol.toStringTag,C=!(0 in[,]),N=function(){return!1};if(typeof document==="object"){var v=document.all;if(W.call(v)===W.call(document.all))N=function(F){if((C||!F)&&(typeof F>"u"||typeof F==="object"))try{var M=W.call(F);return(M===A||M===P||M===j||M===I)&&F("")==null}catch($){}return!1}}U.exports=Y?function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;try{Y(F,null,Q)}catch(M){if(M!==K)return!1}return!J(F)&&q(F)}:function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;if(E)return q(F);if(J(F))return!1;var M=W.call(F);if(M!==H&&M!==T&&!/^\[object HTML/.test(M))return!1;return q(F)}}),_U=R0((B,U)=>{var G=xU(),Y=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,K=function(I,H,T){for(var A=0,P=I.length;A=3)A=T;if(q(I))K(I,H,A);else if(typeof I==="string")Z(I,H,A);else J(I,H,A)}}),hU=R0((B,U)=>{U.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),uU=R0((B,U)=>{d2();var G=hU(),Y=typeof globalThis>"u"?v0:globalThis;U.exports=function(){var K=[];for(var Z=0;Z{var G=_1(),Y=LB(),Q=x1(),K=K1();U.exports=function(J,q,W){if(!J||typeof J!=="object"&&typeof J!=="function")throw new Q("`obj` must be an object or a function`");if(typeof q!=="string"&&typeof q!=="symbol")throw new Q("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new Q("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new Q("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new Q("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new Q("`loose`, if provided, must be a boolean");var I=arguments.length>3?arguments[3]:null,H=arguments.length>4?arguments[4]:null,T=arguments.length>5?arguments[5]:null,A=arguments.length>6?arguments[6]:!1,P=!!K&&K(J,q);if(G)G(J,q,{configurable:T===null&&P?P.configurable:!T,enumerable:I===null&&P?P.enumerable:!I,value:W,writable:H===null&&P?P.writable:!H});else if(A||!I&&!H&&!T)J[q]=W;else throw new Y("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),cU=R0((B,U)=>{var G=_1(),Y=function(){return!!G};Y.hasArrayLengthDefineBug=function(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(K){return!0}},U.exports=Y}),mU=R0((B,U)=>{var G=WB(),Y=dU(),Q=cU()(),K=K1(),Z=x1(),J=G("%Math.floor%");U.exports=function(W,I){if(typeof W!=="function")throw new Z("`fn` is not a function");if(typeof I!=="number"||I<0||I>4294967295||J(I)!==I)throw new Z("`length` must be a positive 32-bit integer");var H=arguments.length>2&&!!arguments[2],T=!0,A=!0;if("length"in W&&K){var P=K(W,"length");if(P&&!P.configurable)T=!1;if(P&&!P.writable)A=!1}if(T||A||!H)if(Q)Y(W,"length",I,!0,!0);else Y(W,"length",I);return W}}),lU=R0((B,U)=>{var G=V1(),Y=y8(),Q=HB();U.exports=function(){return Q(G,Y,arguments)}}),aU=R0((B,U)=>{var G=mU(),Y=_1(),Q=g8(),K=lU();if(U.exports=function(J){var q=Q(arguments),W=J.length-(arguments.length-1);return G(q,1+(W>0?W:0),!0)},Y)Y(U.exports,"apply",{value:K});else U.exports.apply=K}),AB=R0((B,U)=>{d2();var G=_U(),Y=uU(),Q=aU(),K=PB(),Z=K1(),J=FB(),q=K("Object.prototype.toString"),W=b8()(),I=typeof globalThis>"u"?v0:globalThis,H=Y(),T=K("String.prototype.slice"),A=K("Array.prototype.indexOf",!0)||function(N,v){for(var S=0;S-1)return v;if(v!=="Object")return!1;return E(N)}if(!Z)return null;return j(N)}}),pU=R0((B,U)=>{var G=AB();U.exports=function(Q){return!!G(Q)}}),rU=R0((B)=>{var U=gU(),G=fU(),Y=AB(),Q=pU();function K(O){return O.call.bind(O)}var Z=typeof BigInt<"u",J=typeof Symbol<"u",q=K(Object.prototype.toString),W=K(Number.prototype.valueOf),I=K(String.prototype.valueOf),H=K(Boolean.prototype.valueOf);if(Z)var T=K(BigInt.prototype.valueOf);if(J)var A=K(Symbol.prototype.valueOf);function P(O,_){if(typeof O!=="object")return!1;try{return _(O),!0}catch(l){return!1}}B.isArgumentsObject=U,B.isGeneratorFunction=G,B.isTypedArray=Q;function j(O){return typeof Promise<"u"&&O instanceof Promise||O!==null&&typeof O==="object"&&typeof O.then==="function"&&typeof O.catch==="function"}B.isPromise=j;function E(O){if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)return ArrayBuffer.isView(O);return Q(O)||n(O)}B.isArrayBufferView=E;function C(O){return Y(O)==="Uint8Array"}B.isUint8Array=C;function N(O){return Y(O)==="Uint8ClampedArray"}B.isUint8ClampedArray=N;function v(O){return Y(O)==="Uint16Array"}B.isUint16Array=v;function S(O){return Y(O)==="Uint32Array"}B.isUint32Array=S;function F(O){return Y(O)==="Int8Array"}B.isInt8Array=F;function M(O){return Y(O)==="Int16Array"}B.isInt16Array=M;function $(O){return Y(O)==="Int32Array"}B.isInt32Array=$;function x(O){return Y(O)==="Float32Array"}B.isFloat32Array=x;function z(O){return Y(O)==="Float64Array"}B.isFloat64Array=z;function a(O){return Y(O)==="BigInt64Array"}B.isBigInt64Array=a;function U0(O){return Y(O)==="BigUint64Array"}B.isBigUint64Array=U0;function b(O){return q(O)==="[object Map]"}b.working=typeof Map<"u"&&b(new Map);function c(O){if(typeof Map>"u")return!1;return b.working?b(O):O instanceof Map}B.isMap=c;function D(O){return q(O)==="[object Set]"}D.working=typeof Set<"u"&&D(new Set);function m(O){if(typeof Set>"u")return!1;return D.working?D(O):O instanceof Set}B.isSet=m;function B0(O){return q(O)==="[object WeakMap]"}B0.working=typeof WeakMap<"u"&&B0(new WeakMap);function i(O){if(typeof WeakMap>"u")return!1;return B0.working?B0(O):O instanceof WeakMap}B.isWeakMap=i;function V0(O){return q(O)==="[object WeakSet]"}V0.working=typeof WeakSet<"u"&&V0(new WeakSet);function s(O){return V0(O)}B.isWeakSet=s;function G0(O){return q(O)==="[object ArrayBuffer]"}G0.working=typeof ArrayBuffer<"u"&&G0(new ArrayBuffer);function r(O){if(typeof ArrayBuffer>"u")return!1;return G0.working?G0(O):O instanceof ArrayBuffer}B.isArrayBuffer=r;function y(O){return q(O)==="[object DataView]"}y.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&y(new DataView(new ArrayBuffer(1),0,1));function n(O){if(typeof DataView>"u")return!1;return y.working?y(O):O instanceof DataView}B.isDataView=n;var o=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Y0(O){return q(O)==="[object SharedArrayBuffer]"}function O0(O){if(typeof o>"u")return!1;if(typeof Y0.working>"u")Y0.working=Y0(new o);return Y0.working?Y0(O):O instanceof o}B.isSharedArrayBuffer=O0;function w(O){return q(O)==="[object AsyncFunction]"}B.isAsyncFunction=w;function L(O){return q(O)==="[object Map Iterator]"}B.isMapIterator=L;function u(O){return q(O)==="[object Set Iterator]"}B.isSetIterator=u;function h(O){return q(O)==="[object Generator]"}B.isGeneratorObject=h;function Z0(O){return q(O)==="[object WebAssembly.Module]"}B.isWebAssemblyCompiledModule=Z0;function g(O){return P(O,W)}B.isNumberObject=g;function f(O){return P(O,I)}B.isStringObject=f;function R(O){return P(O,H)}B.isBooleanObject=R;function p(O){return Z&&P(O,T)}B.isBigIntObject=p;function k(O){return J&&P(O,A)}B.isSymbolObject=k;function V(O){return g(O)||f(O)||R(O)||p(O)||k(O)}B.isBoxedPrimitive=V;function X(O){return typeof Uint8Array<"u"&&(r(O)||O0(O))}B.isAnyArrayBuffer=X,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(O){Object.defineProperty(B,O,{enumerable:!1,value:function(){throw Error(O+" is not supported in userland")}})})}),iU=R0((B,U)=>{U.exports=function(Y){return Y&&typeof Y==="object"&&typeof Y.copy==="function"&&typeof Y.fill==="function"&&typeof Y.readUInt8==="function"}}),jB=R0((B)=>{P2();var U=Object.getOwnPropertyDescriptors||function(n){var o=Object.keys(n),Y0={};for(var O0=0;O0=O0)return u;switch(u){case"%s":return String(Y0[o++]);case"%d":return Number(Y0[o++]);case"%j":try{return JSON.stringify(Y0[o++])}catch(h){return"[Circular]"}default:return u}});for(var L=Y0[o];o"u")return function(){return B.deprecate(y,n).apply(this,arguments)};var o=!1;function Y0(){if(!o){if(P0.throwDeprecation)throw Error(n);else if(P0.traceDeprecation)console.trace(n);else console.error(n);o=!0}return y.apply(this,arguments)}return Y0};var Y={},Q=/^$/;if(P0.env.NODE_DEBUG){var K=P0.env.NODE_DEBUG;K=K.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Q=new RegExp("^"+K+"$","i")}B.debuglog=function(y){if(y=y.toUpperCase(),!Y[y])if(Q.test(y)){var n=P0.pid;Y[y]=function(){var o=B.format.apply(B,arguments);console.error("%s %d: %s",y,n,o)}}else Y[y]=function(){};return Y[y]};function Z(y,n){var o={seen:[],stylize:q};if(arguments.length>=3)o.depth=arguments[2];if(arguments.length>=4)o.colors=arguments[3];if(C(n))o.showHidden=n;else if(n)B._extend(o,n);if($(o.showHidden))o.showHidden=!1;if($(o.depth))o.depth=2;if($(o.colors))o.colors=!1;if($(o.customInspect))o.customInspect=!0;if(o.colors)o.stylize=J;return I(o,y,o.depth)}B.inspect=Z,Z.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Z.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function J(y,n){var o=Z.styles[n];if(o)return"\x1B["+Z.colors[o][0]+"m"+y+"\x1B["+Z.colors[o][1]+"m";else return y}function q(y,n){return y}function W(y){var n={};return y.forEach(function(o,Y0){n[o]=!0}),n}function I(y,n,o){if(y.customInspect&&n&&b(n.inspect)&&n.inspect!==B.inspect&&!(n.constructor&&n.constructor.prototype===n)){var Y0=n.inspect(o,y);if(!F(Y0))Y0=I(y,Y0,o);return Y0}var O0=H(y,n);if(O0)return O0;var w=Object.keys(n),L=W(w);if(y.showHidden)w=Object.getOwnPropertyNames(n);if(U0(n)&&(w.indexOf("message")>=0||w.indexOf("description")>=0))return T(n);if(w.length===0){if(b(n)){var u=n.name?": "+n.name:"";return y.stylize("[Function"+u+"]","special")}if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");if(a(n))return y.stylize(Date.prototype.toString.call(n),"date");if(U0(n))return T(n)}var h="",Z0=!1,g=["{","}"];if(E(n))Z0=!0,g=["[","]"];if(b(n))h=" [Function"+(n.name?": "+n.name:"")+"]";if(x(n))h=" "+RegExp.prototype.toString.call(n);if(a(n))h=" "+Date.prototype.toUTCString.call(n);if(U0(n))h=" "+T(n);if(w.length===0&&(!Z0||n.length==0))return g[0]+h+g[1];if(o<0)if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");else return y.stylize("[Object]","special");y.seen.push(n);var f;if(Z0)f=A(y,n,o,L,w);else f=w.map(function(R){return P(y,n,o,L,R,Z0)});return y.seen.pop(),j(f,h,g)}function H(y,n){if($(n))return y.stylize("undefined","undefined");if(F(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return y.stylize(o,"string")}if(S(n))return y.stylize(""+n,"number");if(C(n))return y.stylize(""+n,"boolean");if(N(n))return y.stylize("null","null")}function T(y){return"["+Error.prototype.toString.call(y)+"]"}function A(y,n,o,Y0,O0){var w=[];for(var L=0,u=n.length;L-1)if(w)u=u.split(` `).map(function(Z0){return" "+Z0}).join(` `).slice(2);else u=` `+u.split(` `).map(function(Z0){return" "+Z0}).join(` -`)}else u=y.stylize("[Circular]","special");if($(L)){if(z&&O0.match(/^\d+$/))return u;if(L=JSON.stringify(""+O0),L.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))L=L.slice(1,-1),L=y.stylize(L,"name");else L=L.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),L=y.stylize(L,"string")}return L+": "+u}function j(y,n,o){var Y0=0;if(y.reduce(function(O0,z){if(Y0++,z.indexOf(` -`)>=0)Y0++;return O0+z.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return o[0]+(n===""?"":n+` +`)}else u=y.stylize("[Circular]","special");if($(L)){if(w&&O0.match(/^\d+$/))return u;if(L=JSON.stringify(""+O0),L.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))L=L.slice(1,-1),L=y.stylize(L,"name");else L=L.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),L=y.stylize(L,"string")}return L+": "+u}function j(y,n,o){var Y0=0;if(y.reduce(function(O0,w){if(Y0++,w.indexOf(` +`)>=0)Y0++;return O0+w.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return o[0]+(n===""?"":n+` `)+" "+y.join(`, - `)+" "+o[1];return o[0]+n+" "+y.join(", ")+" "+o[1]}B.types=rU();function E(y){return Array.isArray(y)}B.isArray=E;function C(y){return typeof y==="boolean"}B.isBoolean=C;function N(y){return y===null}B.isNull=N;function v(y){return y==null}B.isNullOrUndefined=v;function S(y){return typeof y==="number"}B.isNumber=S;function F(y){return typeof y==="string"}B.isString=F;function M(y){return typeof y==="symbol"}B.isSymbol=M;function $(y){return y===void 0}B.isUndefined=$;function x(y){return w(y)&&D(y)==="[object RegExp]"}B.isRegExp=x,B.types.isRegExp=x;function w(y){return typeof y==="object"&&y!==null}B.isObject=w;function a(y){return w(y)&&D(y)==="[object Date]"}B.isDate=a,B.types.isDate=a;function U0(y){return w(y)&&(D(y)==="[object Error]"||y instanceof Error)}B.isError=U0,B.types.isNativeError=U0;function b(y){return typeof y==="function"}B.isFunction=b;function c(y){return y===null||typeof y==="boolean"||typeof y==="number"||typeof y==="string"||typeof y==="symbol"||typeof y>"u"}B.isPrimitive=c,B.isBuffer=iU();function D(y){return Object.prototype.toString.call(y)}function m(y){return y<10?"0"+y.toString(10):y.toString(10)}var B0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function i(){var y=new Date,n=[m(y.getHours()),m(y.getMinutes()),m(y.getSeconds())].join(":");return[y.getDate(),B0[y.getMonth()],n].join(" ")}B.log=function(){console.log("%s - %s",i(),B.format.apply(B,arguments))},B.inherits=W2(),B._extend=function(y,n){if(!n||!w(n))return y;var o=Object.keys(n),Y0=o.length;while(Y0--)y[o[Y0]]=n[o[Y0]];return y};function V0(y,n){return Object.prototype.hasOwnProperty.call(y,n)}var s=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;B.promisify=function(n){if(typeof n!=="function")throw TypeError('The "original" argument must be of type Function');if(s&&n[s]){var o=n[s];if(typeof o!=="function")throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(o,s,{value:o,enumerable:!1,writable:!1,configurable:!0}),o}function o(){var Y0,O0,z=new Promise(function(h,Z0){Y0=h,O0=Z0}),L=[];for(var u=0;u{function G(P,j){var E=Object.keys(P);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(P);j&&(C=C.filter(function(N){return Object.getOwnPropertyDescriptor(P,N).enumerable})),E.push.apply(E,C)}return E}function Y(P){for(var j=1;j0)this.tail.next=C;else this.head=C;this.tail=C,++this.length}},{key:"unshift",value:function(E){var C={data:E,next:this.head};if(this.length===0)this.tail=C;this.head=C,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var E=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,E}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";var C=this.head,N=""+C.data;while(C=C.next)N+=E+C.data;return N}},{key:"concat",value:function(E){if(this.length===0)return I.alloc(0);var C=I.allocUnsafe(E>>>0),N=this.head,v=0;while(N)A(N.data,C,v),v+=N.data.length,N=N.next;return C}},{key:"consume",value:function(E,C){var N;if(ES.length?S.length:E;if(F===S.length)v+=S;else v+=S.slice(0,E);if(E-=F,E===0){if(F===S.length)if(++N,C.next)this.head=C.next;else this.head=this.tail=null;else this.head=C,C.data=S.slice(F);break}++N}return this.length-=N,v}},{key:"_getBuffer",value:function(E){var C=I.allocUnsafe(E),N=this.head,v=1;N.data.copy(C),E-=N.data.length;while(N=N.next){var S=N.data,F=E>S.length?S.length:E;if(S.copy(C,C.length-E,0,F),E-=F,E===0){if(F===S.length)if(++v,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=S.slice(F);break}++v}return this.length-=v,C}},{key:T,value:function(E,C){return H(this,Y(Y({},C),{},{depth:0,customInspect:!1}))}}]),P}()}),NB=R0((B,U)=>{P2();function G(q,W){var I=this,H=this._readableState&&this._readableState.destroyed,T=this._writableState&&this._writableState.destroyed;if(H||T){if(W)W(q);else if(q){if(!this._writableState)P0.nextTick(Z,this,q);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,P0.nextTick(Z,this,q)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(q||null,function(A){if(!W&&A)if(!I._writableState)P0.nextTick(Y,I,A);else if(!I._writableState.errorEmitted)I._writableState.errorEmitted=!0,P0.nextTick(Y,I,A);else P0.nextTick(Q,I);else if(W)P0.nextTick(Q,I),W(A);else P0.nextTick(Q,I)}),this}function Y(q,W){Z(q,W),Q(q)}function Q(q){if(q._writableState&&!q._writableState.emitClose)return;if(q._readableState&&!q._readableState.emitClose)return;q.emit("close")}function K(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function Z(q,W){q.emit("error",W)}function J(q,W){var{_readableState:I,_writableState:H}=q;if(I&&I.autoDestroy||H&&H.autoDestroy)q.destroy(W);else q.emit("error",W)}U.exports={destroy:G,undestroy:K,errorOrDestroy:J}}),c2=R0((B,U)=>{function G(W,I){W.prototype=Object.create(I.prototype),W.prototype.constructor=W,W.__proto__=I}var Y={};function Q(W,I,H){if(!H)H=Error;function T(P,j,E){if(typeof I==="string")return I;else return I(P,j,E)}var A=function(P){G(j,P);function j(E,C,N){return P.call(this,T(E,C,N))||this}return j}(H);A.prototype.name=H.name,A.prototype.code=W,Y[W]=A}function K(W,I){if(Array.isArray(W)){var H=W.length;if(W=W.map(function(T){return String(T)}),H>2)return"one of ".concat(I," ").concat(W.slice(0,H-1).join(", "),", or ")+W[H-1];else if(H===2)return"one of ".concat(I," ").concat(W[0]," or ").concat(W[1]);else return"of ".concat(I," ").concat(W[0])}else return"of ".concat(I," ").concat(String(W))}function Z(W,I,H){return W.substr(!H||H<0?0:+H,I.length)===I}function J(W,I,H){if(H===void 0||H>W.length)H=W.length;return W.substring(H-I.length,H)===I}function q(W,I,H){if(typeof H!=="number")H=0;if(H+I.length>W.length)return!1;else return W.indexOf(I,H)!==-1}Q("ERR_INVALID_OPT_VALUE",function(W,I){return'The value "'+I+'" is invalid for option "'+W+'"'},TypeError),Q("ERR_INVALID_ARG_TYPE",function(W,I,H){var T;if(typeof I==="string"&&Z(I,"not "))T="must not be",I=I.replace(/^not /,"");else T="must be";var A;if(J(W," argument"))A="The ".concat(W," ").concat(T," ").concat(K(I,"type"));else{var P=q(W,".")?"property":"argument";A='The "'.concat(W,'" ').concat(P," ").concat(T," ").concat(K(I,"type"))}return A+=". Received type ".concat(typeof H),A},TypeError),Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Q("ERR_METHOD_NOT_IMPLEMENTED",function(W){return"The "+W+" method is not implemented"}),Q("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Q("ERR_STREAM_DESTROYED",function(W){return"Cannot call "+W+" after a stream was destroyed"}),Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Q("ERR_STREAM_WRITE_AFTER_END","write after end"),Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Q("ERR_UNKNOWN_ENCODING",function(W){return"Unknown encoding: "+W},TypeError),Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),U.exports.codes=Y}),wB=R0((B,U)=>{var G=c2().codes.ERR_INVALID_OPT_VALUE;function Y(K,Z,J){return K.highWaterMark!=null?K.highWaterMark:Z?K[J]:null}function Q(K,Z,J,q){var W=Y(Z,q,J);if(W!=null){if(!(isFinite(W)&&Math.floor(W)===W)||W<0)throw new G(q?J:"highWaterMark",W);return Math.floor(W)}return K.objectMode?16:16384}U.exports={getHighWaterMark:Q}}),sU=R0((B,U)=>{d2(),U.exports=G;function G(Q,K){if(Y("noDeprecation"))return Q;var Z=!1;function J(){if(!Z){if(Y("throwDeprecation"))throw Error(K);else if(Y("traceDeprecation"))console.trace(K);else console.warn(K);Z=!0}return Q.apply(this,arguments)}return J}function Y(Q){try{if(!v0.localStorage)return!1}catch(Z){return!1}var K=v0.localStorage[Q];if(K==null)return!1;return String(K).toLowerCase()==="true"}}),zB=R0((B,U)=>{d2(),P2(),U.exports=w;function G(z){var L=this;this.next=null,this.entry=null,this.finish=function(){O0(L,z)}}var Y;w.WritableState=$;var Q={deprecate:sU()},K=qB(),Z=f1().Buffer,J=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function q(z){return Z.from(z)}function W(z){return Z.isBuffer(z)||z instanceof J}var I=NB(),H=wB().getHighWaterMark,T=c2().codes,A=T.ERR_INVALID_ARG_TYPE,P=T.ERR_METHOD_NOT_IMPLEMENTED,j=T.ERR_MULTIPLE_CALLBACK,E=T.ERR_STREAM_CANNOT_PIPE,C=T.ERR_STREAM_DESTROYED,N=T.ERR_STREAM_NULL_VALUES,v=T.ERR_STREAM_WRITE_AFTER_END,S=T.ERR_UNKNOWN_ENCODING,F=I.errorOrDestroy;W2()(w,K);function M(){}function $(z,L,u){if(Y=Y||u2(),z=z||{},typeof u!=="boolean")u=L instanceof Y;if(this.objectMode=!!z.objectMode,u)this.objectMode=this.objectMode||!!z.writableObjectMode;this.highWaterMark=H(this,z,"writableHighWaterMark",u),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=z.decodeStrings===!1;this.decodeStrings=!h,this.defaultEncoding=z.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z0){i(L,Z0)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=z.emitClose!==!1,this.autoDestroy=!!z.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new G(this)}$.prototype.getBuffer=function(){var L=this.bufferedRequest,u=[];while(L)u.push(L),L=L.next;return u},function(){try{Object.defineProperty($.prototype,"buffer",{get:Q.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(z){}}();var x;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")x=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(L){if(x.call(this,L))return!0;if(this!==w)return!1;return L&&L._writableState instanceof $}});else x=function(L){return L instanceof this};function w(z){Y=Y||u2();var L=this instanceof Y;if(!L&&!x.call(w,this))return new w(z);if(this._writableState=new $(z,this,L),this.writable=!0,z){if(typeof z.write==="function")this._write=z.write;if(typeof z.writev==="function")this._writev=z.writev;if(typeof z.destroy==="function")this._destroy=z.destroy;if(typeof z.final==="function")this._final=z.final}K.call(this)}w.prototype.pipe=function(){F(this,new E)};function a(z,L){var u=new v;F(z,u),P0.nextTick(L,u)}function U0(z,L,u,h){var Z0;if(u===null)Z0=new N;else if(typeof u!=="string"&&!L.objectMode)Z0=new A("chunk",["string","Buffer"],u);if(Z0)return F(z,Z0),P0.nextTick(h,Z0),!1;return!0}w.prototype.write=function(z,L,u){var h=this._writableState,Z0=!1,g=!h.objectMode&&W(z);if(g&&!Z.isBuffer(z))z=q(z);if(typeof L==="function")u=L,L=null;if(g)L="buffer";else if(!L)L=h.defaultEncoding;if(typeof u!=="function")u=M;if(h.ending)a(this,u);else if(g||U0(this,h,z,u))h.pendingcb++,Z0=c(this,h,g,z,L,u);return Z0},w.prototype.cork=function(){this._writableState.corked++},w.prototype.uncork=function(){var z=this._writableState;if(z.corked){if(z.corked--,!z.writing&&!z.corked&&!z.bufferProcessing&&z.bufferedRequest)G0(this,z)}},w.prototype.setDefaultEncoding=function(L){if(typeof L==="string")L=L.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((L+"").toLowerCase())>-1))throw new S(L);return this._writableState.defaultEncoding=L,this},Object.defineProperty(w.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function b(z,L,u){if(!z.objectMode&&z.decodeStrings!==!1&&typeof L==="string")L=Z.from(L,u);return L}Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function c(z,L,u,h,Z0,g){if(!u){var f=b(L,h,Z0);if(h!==f)u=!0,Z0="buffer",h=f}var R=L.objectMode?1:h.length;L.length+=R;var p=L.length{P2();var G=Object.keys||function(H){var T=[];for(var A in H)T.push(A);return T};U.exports=q;var Y=EB(),Q=zB();W2()(q,Y);var K=G(Q.prototype);for(var Z=0;Z{var G=f1(),Y=G.Buffer;function Q(Z,J){for(var q in Z)J[q]=Z[q]}if(Y.from&&Y.alloc&&Y.allocUnsafe&&Y.allocUnsafeSlow)U.exports=G;else Q(G,B),B.Buffer=K;function K(Z,J,q){return Y(Z,J,q)}Q(Y,K),K.from=function(Z,J,q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return Y(Z,J,q)},K.alloc=function(Z,J,q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var W=Y(Z);if(J!==void 0)if(typeof q==="string")W.fill(J,q);else W.fill(J);else W.fill(0);return W},K.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return Y(Z)},K.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),F8=R0((B)=>{var U=oU().Buffer,G=U.isEncoding||function(N){switch(N=""+N,N&&N.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Y(N){if(!N)return"utf8";var v;while(!0)switch(N){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return N;default:if(v)return;N=(""+N).toLowerCase(),v=!0}}function Q(N){var v=Y(N);if(typeof v!=="string"&&(U.isEncoding===G||!G(N)))throw Error("Unknown encoding: "+N);return v||N}B.StringDecoder=K;function K(N){this.encoding=Q(N);var v;switch(this.encoding){case"utf16le":this.text=T,this.end=A,v=4;break;case"utf8":this.fillLast=W,v=4;break;case"base64":this.text=P,this.end=j,v=3;break;default:this.write=E,this.end=C;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=U.allocUnsafe(v)}K.prototype.write=function(N){if(N.length===0)return"";var v,S;if(this.lastNeed){if(v=this.fillLast(N),v===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;if(S>5===6)return 2;else if(N>>4===14)return 3;else if(N>>3===30)return 4;return N>>6===2?-1:-2}function J(N,v,S){var F=v.length-1;if(F=0){if(M>0)N.lastNeed=M-1;return M}if(--F=0){if(M>0)N.lastNeed=M-2;return M}if(--F=0){if(M>0)if(M===2)M=0;else N.lastNeed=M-3;return M}return 0}function q(N,v,S){if((v[0]&192)!==128)return N.lastNeed=0,"�";if(N.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return N.lastNeed=1,"�";if(N.lastNeed>2&&v.length>2){if((v[2]&192)!==128)return N.lastNeed=2,"�"}}}function W(N){var v=this.lastTotal-this.lastNeed,S=q(this,N,v);if(S!==void 0)return S;if(this.lastNeed<=N.length)return N.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);N.copy(this.lastChar,v,0,N.length),this.lastNeed-=N.length}function I(N,v){var S=J(this,N,v);if(!this.lastNeed)return N.toString("utf8",v);this.lastTotal=S;var F=N.length-(S-this.lastNeed);return N.copy(this.lastChar,0,F),N.toString("utf8",v,F)}function H(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+"�";return v}function T(N,v){if((N.length-v)%2===0){var S=N.toString("utf16le",v);if(S){var F=S.charCodeAt(S.length-1);if(F>=55296&&F<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=N[N.length-1],N.toString("utf16le",v,N.length-1)}function A(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,S)}return v}function P(N,v){var S=(N.length-v)%3;if(S===0)return N.toString("base64",v);if(this.lastNeed=3-S,this.lastTotal=3,S===1)this.lastChar[0]=N[N.length-1];else this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1];return N.toString("base64",v,N.length-S)}function j(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+this.lastChar.toString("base64",0,3-this.lastNeed);return v}function E(N){return N.toString(this.encoding)}function C(N){return N&&N.length?this.write(N):""}}),f8=R0((B,U)=>{var G=c2().codes.ERR_STREAM_PREMATURE_CLOSE;function Y(J){var q=!1;return function(){if(q)return;q=!0;for(var W=arguments.length,I=Array(W),H=0;H{P2();var G;function Y(S,F,M){if(F=Q(F),F in S)Object.defineProperty(S,F,{value:M,enumerable:!0,configurable:!0,writable:!0});else S[F]=M;return S}function Q(S){var F=K(S,"string");return typeof F==="symbol"?F:String(F)}function K(S,F){if(typeof S!=="object"||S===null)return S;var M=S[Symbol.toPrimitive];if(M!==void 0){var $=M.call(S,F||"default");if(typeof $!=="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(F==="string"?String:Number)(S)}var Z=f8(),J=Symbol("lastResolve"),q=Symbol("lastReject"),W=Symbol("error"),I=Symbol("ended"),H=Symbol("lastPromise"),T=Symbol("handlePromise"),A=Symbol("stream");function P(S,F){return{value:S,done:F}}function j(S){var F=S[J];if(F!==null){var M=S[A].read();if(M!==null)S[H]=null,S[J]=null,S[q]=null,F(P(M,!1))}}function E(S){P0.nextTick(j,S)}function C(S,F){return function(M,$){S.then(function(){if(F[I]){M(P(void 0,!0));return}F[T](M,$)},$)}}var N=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((G={get stream(){return this[A]},next:function(){var F=this,M=this[W];if(M!==null)return Promise.reject(M);if(this[I])return Promise.resolve(P(void 0,!0));if(this[A].destroyed)return new Promise(function(a,U0){P0.nextTick(function(){if(F[W])U0(F[W]);else a(P(void 0,!0))})});var $=this[H],x;if($)x=new Promise(C($,this));else{var w=this[A].read();if(w!==null)return Promise.resolve(P(w,!1));x=new Promise(this[T])}return this[H]=x,x}},Y(G,Symbol.asyncIterator,function(){return this}),Y(G,"return",function(){var F=this;return new Promise(function(M,$){F[A].destroy(null,function(x){if(x){$(x);return}M(P(void 0,!0))})})}),G),N);U.exports=function(F){var M,$=Object.create(v,(M={},Y(M,A,{value:F,writable:!0}),Y(M,J,{value:null,writable:!0}),Y(M,q,{value:null,writable:!0}),Y(M,W,{value:null,writable:!0}),Y(M,I,{value:F._readableState.endEmitted,writable:!0}),Y(M,T,{value:function(w,a){var U0=$[A].read();if(U0)$[H]=null,$[J]=null,$[q]=null,w(P(U0,!1));else $[J]=w,$[q]=a},writable:!0}),M));return $[H]=null,Z(F,function(x){if(x&&x.code!=="ERR_STREAM_PREMATURE_CLOSE"){var w=$[q];if(w!==null)$[H]=null,$[J]=null,$[q]=null,w(x);$[W]=x;return}var a=$[J];if(a!==null)$[H]=null,$[J]=null,$[q]=null,a(P(void 0,!0));$[I]=!0}),F.on("readable",E.bind(null,$)),$}}),eU=R0((B,U)=>{U.exports=function(){throw Error("Readable.from is not available in the browser")}}),EB=R0((B,U)=>{d2(),P2(),U.exports=a;var G;a.ReadableState=w,S8().EventEmitter;var Y=function(f,R){return f.listeners(R).length},Q=qB(),K=f1().Buffer,Z=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function J(g){return K.from(g)}function q(g){return K.isBuffer(g)||g instanceof Z}var W=jB(),I;if(W&&W.debuglog)I=W.debuglog("stream");else I=function(){};var H=nU(),T=NB(),A=wB().getHighWaterMark,P=c2().codes,j=P.ERR_INVALID_ARG_TYPE,E=P.ERR_STREAM_PUSH_AFTER_EOF,C=P.ERR_METHOD_NOT_IMPLEMENTED,N=P.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,S,F;W2()(a,Q);var M=T.errorOrDestroy,$=["error","close","destroy","pause","resume"];function x(g,f,R){if(typeof g.prependListener==="function")return g.prependListener(f,R);if(!g._events||!g._events[f])g.on(f,R);else if(Array.isArray(g._events[f]))g._events[f].unshift(R);else g._events[f]=[R,g._events[f]]}function w(g,f,R){if(G=G||u2(),g=g||{},typeof R!=="boolean")R=f instanceof G;if(this.objectMode=!!g.objectMode,R)this.objectMode=this.objectMode||!!g.readableObjectMode;if(this.highWaterMark=A(this,g,"readableHighWaterMark",R),this.buffer=new H,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=g.emitClose!==!1,this.autoDestroy=!!g.autoDestroy,this.destroyed=!1,this.defaultEncoding=g.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,g.encoding){if(!v)v=F8().StringDecoder;this.decoder=new v(g.encoding),this.encoding=g.encoding}}function a(g){if(G=G||u2(),!(this instanceof a))return new a(g);var f=this instanceof G;if(this._readableState=new w(g,this,f),this.readable=!0,g){if(typeof g.read==="function")this._read=g.read;if(typeof g.destroy==="function")this._destroy=g.destroy}Q.call(this)}Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(f){if(!this._readableState)return;this._readableState.destroyed=f}}),a.prototype.destroy=T.destroy,a.prototype._undestroy=T.undestroy,a.prototype._destroy=function(g,f){f(g)},a.prototype.push=function(g,f){var R=this._readableState,p;if(!R.objectMode){if(typeof g==="string"){if(f=f||R.defaultEncoding,f!==R.encoding)g=K.from(g,f),f="";p=!0}}else p=!0;return U0(this,g,f,!1,p)},a.prototype.unshift=function(g){return U0(this,g,null,!0,!1)};function U0(g,f,R,p,k){I("readableAddChunk",f);var V=g._readableState;if(f===null)V.reading=!1,i(g,V);else{var X;if(!k)X=c(V,f);if(X)M(g,X);else if(V.objectMode||f&&f.length>0){if(typeof f!=="string"&&!V.objectMode&&Object.getPrototypeOf(f)!==K.prototype)f=J(f);if(p)if(V.endEmitted)M(g,new N);else b(g,V,f,!0);else if(V.ended)M(g,new E);else if(V.destroyed)return!1;else if(V.reading=!1,V.decoder&&!R)if(f=V.decoder.write(f),V.objectMode||f.length!==0)b(g,V,f,!1);else G0(g,V);else b(g,V,f,!1)}else if(!p)V.reading=!1,G0(g,V)}return!V.ended&&(V.length=D)g=D;else g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++;return g}function B0(g,f){if(g<=0||f.length===0&&f.ended)return 0;if(f.objectMode)return 1;if(g!==g)if(f.flowing&&f.length)return f.buffer.head.data.length;else return f.length;if(g>f.highWaterMark)f.highWaterMark=m(g);if(g<=f.length)return g;if(!f.ended)return f.needReadable=!0,0;return f.length}a.prototype.read=function(g){I("read",g),g=parseInt(g,10);var f=this._readableState,R=g;if(g!==0)f.emittedReadable=!1;if(g===0&&f.needReadable&&((f.highWaterMark!==0?f.length>=f.highWaterMark:f.length>0)||f.ended)){if(I("read: emitReadable",f.length,f.ended),f.length===0&&f.ended)u(this);else V0(this);return null}if(g=B0(g,f),g===0&&f.ended){if(f.length===0)u(this);return null}var p=f.needReadable;if(I("need readable",p),f.length===0||f.length-g0)k=L(g,f);else k=null;if(k===null)f.needReadable=f.length<=f.highWaterMark,g=0;else f.length-=g,f.awaitDrain=0;if(f.length===0){if(!f.ended)f.needReadable=!0;if(R!==g&&f.ended)u(this)}if(k!==null)this.emit("data",k);return k};function i(g,f){if(I("onEofChunk"),f.ended)return;if(f.decoder){var R=f.decoder.end();if(R&&R.length)f.buffer.push(R),f.length+=f.objectMode?1:R.length}if(f.ended=!0,f.sync)V0(g);else if(f.needReadable=!1,!f.emittedReadable)f.emittedReadable=!0,s(g)}function V0(g){var f=g._readableState;if(I("emitReadable",f.needReadable,f.emittedReadable),f.needReadable=!1,!f.emittedReadable)I("emitReadable",f.flowing),f.emittedReadable=!0,P0.nextTick(s,g)}function s(g){var f=g._readableState;if(I("emitReadable_",f.destroyed,f.length,f.ended),!f.destroyed&&(f.length||f.ended))g.emit("readable"),f.emittedReadable=!1;f.needReadable=!f.flowing&&!f.ended&&f.length<=f.highWaterMark,z(g)}function G0(g,f){if(!f.readingMore)f.readingMore=!0,P0.nextTick(r,g,f)}function r(g,f){while(!f.reading&&!f.ended&&(f.length1&&Z0(p.pipes,g)!==-1)&&!_)I("false write response, pause",p.awaitDrain),p.awaitDrain++;R.pause()}}function Q0(F0){if(I("onerror",F0),I0(),g.removeListener("error",Q0),Y(g,"error")===0)M(g,F0)}x(g,"error",Q0);function X0(){g.removeListener("finish",K0),I0()}g.once("close",X0);function K0(){I("onfinish"),g.removeListener("close",X0),I0()}g.once("finish",K0);function I0(){I("unpipe"),R.unpipe(g)}if(g.emit("pipe",R),!p.flowing)I("pipe resume"),R.resume();return g};function y(g){return function(){var R=g._readableState;if(I("pipeOnDrain",R.awaitDrain),R.awaitDrain)R.awaitDrain--;if(R.awaitDrain===0&&Y(g,"data"))R.flowing=!0,z(g)}}a.prototype.unpipe=function(g){var f=this._readableState,R={hasUnpiped:!1};if(f.pipesCount===0)return this;if(f.pipesCount===1){if(g&&g!==f.pipes)return this;if(!g)g=f.pipes;if(f.pipes=null,f.pipesCount=0,f.flowing=!1,g)g.emit("unpipe",this,R);return this}if(!g){var{pipes:p,pipesCount:k}=f;f.pipes=null,f.pipesCount=0,f.flowing=!1;for(var V=0;V0,p.flowing!==!1)this.resume()}else if(g==="readable"){if(!p.endEmitted&&!p.readableListening){if(p.readableListening=p.needReadable=!0,p.flowing=!1,p.emittedReadable=!1,I("on readable",p.length,p.reading),p.length)V0(this);else if(!p.reading)P0.nextTick(o,this)}}return R},a.prototype.addListener=a.prototype.on,a.prototype.removeListener=function(g,f){var R=Q.prototype.removeListener.call(this,g,f);if(g==="readable")P0.nextTick(n,this);return R},a.prototype.removeAllListeners=function(g){var f=Q.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)P0.nextTick(n,this);return f};function n(g){var f=g._readableState;if(f.readableListening=g.listenerCount("readable")>0,f.resumeScheduled&&!f.paused)f.flowing=!0;else if(g.listenerCount("data")>0)g.resume()}function o(g){I("readable nexttick read 0"),g.read(0)}a.prototype.resume=function(){var g=this._readableState;if(!g.flowing)I("resume"),g.flowing=!g.readableListening,Y0(this,g);return g.paused=!1,this};function Y0(g,f){if(!f.resumeScheduled)f.resumeScheduled=!0,P0.nextTick(O0,g,f)}function O0(g,f){if(I("resume",f.reading),!f.reading)g.read(0);if(f.resumeScheduled=!1,g.emit("resume"),z(g),f.flowing&&!f.reading)g.read(0)}a.prototype.pause=function(){if(I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)I("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function z(g){var f=g._readableState;I("flow",f.flowing);while(f.flowing&&g.read()!==null);}if(a.prototype.wrap=function(g){var f=this,R=this._readableState,p=!1;g.on("end",function(){if(I("wrapped end"),R.decoder&&!R.ended){var X=R.decoder.end();if(X&&X.length)f.push(X)}f.push(null)}),g.on("data",function(X){if(I("wrapped data"),R.decoder)X=R.decoder.write(X);if(R.objectMode&&(X===null||X===void 0))return;else if(!R.objectMode&&(!X||!X.length))return;if(!f.push(X))p=!0,g.pause()});for(var k in g)if(this[k]===void 0&&typeof g[k]==="function")this[k]=function(O){return function(){return g[O].apply(g,arguments)}}(k);for(var V=0;V<$.length;V++)g.on($[V],this.emit.bind(this,$[V]));return this._read=function(X){if(I("wrapped _read",X),p)p=!1,g.resume()},this},typeof Symbol==="function")a.prototype[Symbol.asyncIterator]=function(){if(S===void 0)S=tU();return S(this)};Object.defineProperty(a.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(a.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(a.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(f){if(this._readableState)this._readableState.flowing=f}}),a._fromList=L,Object.defineProperty(a.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function L(g,f){if(f.length===0)return null;var R;if(f.objectMode)R=f.buffer.shift();else if(!g||g>=f.length){if(f.decoder)R=f.buffer.join("");else if(f.buffer.length===1)R=f.buffer.first();else R=f.buffer.concat(f.length);f.buffer.clear()}else R=f.buffer.consume(g,f.decoder);return R}function u(g){var f=g._readableState;if(I("endReadable",f.endEmitted),!f.endEmitted)f.ended=!0,P0.nextTick(h,f,g)}function h(g,f){if(I("endReadableNT",g.endEmitted,g.length),!g.endEmitted&&g.length===0){if(g.endEmitted=!0,f.readable=!1,f.emit("end"),g.autoDestroy){var R=f._writableState;if(!R||R.autoDestroy&&R.finished)f.destroy()}}}if(typeof Symbol==="function")a.from=function(g,f){if(F===void 0)F=eU();return F(a,g,f)};function Z0(g,f){for(var R=0,p=g.length;R{U.exports=W;var G=c2().codes,Y=G.ERR_METHOD_NOT_IMPLEMENTED,Q=G.ERR_MULTIPLE_CALLBACK,K=G.ERR_TRANSFORM_ALREADY_TRANSFORMING,Z=G.ERR_TRANSFORM_WITH_LENGTH_0,J=u2();W2()(W,J);function q(T,A){var P=this._transformState;P.transforming=!1;var j=P.writecb;if(j===null)return this.emit("error",new Q);if(P.writechunk=null,P.writecb=null,A!=null)this.push(A);j(T);var E=this._readableState;if(E.reading=!1,E.needReadable||E.length{U.exports=Y;var G=DB();W2()(Y,G);function Y(Q){if(!(this instanceof Y))return new Y(Q);G.call(this,Q)}Y.prototype._transform=function(Q,K,Z){Z(null,Q)}}),UG=R0((B,U)=>{var G;function Y(P){var j=!1;return function(){if(j)return;j=!0,P.apply(void 0,arguments)}}var Q=c2().codes,K=Q.ERR_MISSING_ARGS,Z=Q.ERR_STREAM_DESTROYED;function J(P){if(P)throw P}function q(P){return P.setHeader&&typeof P.abort==="function"}function W(P,j,E,C){C=Y(C);var N=!1;if(P.on("close",function(){N=!0}),G===void 0)G=f8();G(P,{readable:j,writable:E},function(S){if(S)return C(S);N=!0,C()});var v=!1;return function(S){if(N)return;if(v)return;if(v=!0,q(P))return P.abort();if(typeof P.destroy==="function")return P.destroy();C(S||new Z("pipe"))}}function I(P){P()}function H(P,j){return P.pipe(j)}function T(P){if(!P.length)return J;if(typeof P[P.length-1]!=="function")return J;return P.pop()}function A(){for(var P=arguments.length,j=Array(P),E=0;E0,function($){if(!N)N=$;if($)v.forEach(I);if(M)return;v.forEach(I),C(N)})});return j.reduce(H)}U.exports=A}),x8=R0((B,U)=>{U.exports=Y;var G=S8().EventEmitter;W2()(Y,G),Y.Readable=EB(),Y.Writable=zB(),Y.Duplex=u2(),Y.Transform=DB(),Y.PassThrough=BG(),Y.finished=f8(),Y.pipeline=UG(),Y.Stream=Y;function Y(){G.call(this)}Y.prototype.pipe=function(Q,K){var Z=this;function J(P){if(Q.writable){if(Q.write(P)===!1&&Z.pause)Z.pause()}}Z.on("data",J);function q(){if(Z.readable&&Z.resume)Z.resume()}if(Q.on("drain",q),!Q._isStdio&&(!K||K.end!==!1))Z.on("end",I),Z.on("close",H);var W=!1;function I(){if(W)return;W=!0,Q.end()}function H(){if(W)return;if(W=!0,typeof Q.destroy==="function")Q.destroy()}function T(P){if(A(),G.listenerCount(this,"error")===0)throw P}Z.on("error",T),Q.on("error",T);function A(){Z.removeListener("data",J),Q.removeListener("drain",q),Z.removeListener("end",I),Z.removeListener("close",H),Z.removeListener("error",T),Q.removeListener("error",T),Z.removeListener("end",A),Z.removeListener("close",A),Q.removeListener("close",A)}return Z.on("end",A),Z.on("close",A),Q.on("close",A),Q.emit("pipe",Z),Q}}),GG=R0((B)=>{(function(U){U.parser=function(z,L){return new Y(z,L)},U.SAXParser=Y,U.SAXStream=I,U.createStream=W,U.MAX_BUFFER_LENGTH=65536;var G=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];U.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Y(z,L){if(!(this instanceof Y))return new Y(z,L);var u=this;if(K(u),u.q=u.c="",u.bufferCheckPosition=U.MAX_BUFFER_LENGTH,u.opt=L||{},u.opt.lowercase=u.opt.lowercase||u.opt.lowercasetags,u.looseCase=u.opt.lowercase?"toLowerCase":"toUpperCase",u.tags=[],u.closed=u.closedRoot=u.sawRoot=!1,u.tag=u.error=null,u.strict=!!z,u.noscript=!!(z||u.opt.noscript),u.state=w.BEGIN,u.strictEntities=u.opt.strictEntities,u.ENTITIES=u.strictEntities?Object.create(U.XML_ENTITIES):Object.create(U.ENTITIES),u.attribList=[],u.opt.xmlns)u.ns=Object.create(j);if(u.trackPosition=u.opt.position!==!1,u.trackPosition)u.position=u.line=u.column=0;U0(u,"onready")}if(!Object.create)Object.create=function(z){function L(){}return L.prototype=z,new L};if(!Object.keys)Object.keys=function(z){var L=[];for(var u in z)if(z.hasOwnProperty(u))L.push(u);return L};function Q(z){var L=Math.max(U.MAX_BUFFER_LENGTH,10),u=0;for(var h=0,Z0=G.length;hL)switch(G[h]){case"textNode":c(z);break;case"cdata":b(z,"oncdata",z.cdata),z.cdata="";break;case"script":b(z,"onscript",z.script),z.script="";break;default:m(z,"Max buffer length exceeded: "+G[h])}u=Math.max(u,g)}z.bufferCheckPosition=U.MAX_BUFFER_LENGTH-u+z.position}function K(z){for(var L=0,u=G.length;L"||S(z)}function $(z,L){return z.test(L)}function x(z,L){return!$(z,L)}var w=0;U.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},U.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},U.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(U.ENTITIES).forEach(function(z){var L=U.ENTITIES[z],u=typeof L==="number"?String.fromCharCode(L):L;U.ENTITIES[z]=u});for(var a in U.STATE)U.STATE[U.STATE[a]]=a;w=U.STATE;function U0(z,L,u){z[L]&&z[L](u)}function b(z,L,u){if(z.textNode)c(z);U0(z,L,u)}function c(z){if(z.textNode=D(z.opt,z.textNode),z.textNode)U0(z,"ontext",z.textNode);z.textNode=""}function D(z,L){if(z.trim)L=L.trim();if(z.normalize)L=L.replace(/\s+/g," ");return L}function m(z,L){if(c(z),z.trackPosition)L+=` -Line: `+z.line+` -Column: `+z.column+` -Char: `+z.c;return L=Error(L),z.error=L,U0(z,"onerror",L),z}function B0(z){if(z.sawRoot&&!z.closedRoot)i(z,"Unclosed root tag");if(z.state!==w.BEGIN&&z.state!==w.BEGIN_WHITESPACE&&z.state!==w.TEXT)m(z,"Unexpected end");return c(z),z.c="",z.closed=!0,U0(z,"onend"),Y.call(z,z.strict,z.opt),z}function i(z,L){if(typeof z!=="object"||!(z instanceof Y))throw Error("bad call to strictFail");if(z.strict)m(z,L)}function V0(z){if(!z.strict)z.tagName=z.tagName[z.looseCase]();var L=z.tags[z.tags.length-1]||z,u=z.tag={name:z.tagName,attributes:{}};if(z.opt.xmlns)u.ns=L.ns;z.attribList.length=0,b(z,"onopentagstart",u)}function s(z,L){var u=z.indexOf(":")<0?["",z]:z.split(":"),h=u[0],Z0=u[1];if(L&&z==="xmlns")h="xmlns",Z0="";return{prefix:h,local:Z0}}function G0(z){if(!z.strict)z.attribName=z.attribName[z.looseCase]();if(z.attribList.indexOf(z.attribName)!==-1||z.tag.attributes.hasOwnProperty(z.attribName)){z.attribName=z.attribValue="";return}if(z.opt.xmlns){var L=s(z.attribName,!0),u=L.prefix,h=L.local;if(u==="xmlns")if(h==="xml"&&z.attribValue!==A)i(z,"xml: prefix must be bound to "+A+` -Actual: `+z.attribValue);else if(h==="xmlns"&&z.attribValue!==P)i(z,"xmlns: prefix must be bound to "+P+` -Actual: `+z.attribValue);else{var Z0=z.tag,g=z.tags[z.tags.length-1]||z;if(Z0.ns===g.ns)Z0.ns=Object.create(g.ns);Z0.ns[h]=z.attribValue}z.attribList.push([z.attribName,z.attribValue])}else z.tag.attributes[z.attribName]=z.attribValue,b(z,"onattribute",{name:z.attribName,value:z.attribValue});z.attribName=z.attribValue=""}function r(z,L){if(z.opt.xmlns){var u=z.tag,h=s(z.tagName);if(u.prefix=h.prefix,u.local=h.local,u.uri=u.ns[h.prefix]||"",u.prefix&&!u.uri)i(z,"Unbound namespace prefix: "+JSON.stringify(z.tagName)),u.uri=h.prefix;var Z0=z.tags[z.tags.length-1]||z;if(u.ns&&Z0.ns!==u.ns)Object.keys(u.ns).forEach(function(d){b(z,"onopennamespace",{prefix:d,uri:u.ns[d]})});for(var g=0,f=z.attribList.length;g",z.tagName="",z.state=w.SCRIPT;return}b(z,"onscript",z.script),z.script=""}var L=z.tags.length,u=z.tagName;if(!z.strict)u=u[z.looseCase]();var h=u;while(L--)if(z.tags[L].name!==h)i(z,"Unexpected close tag");else break;if(L<0){i(z,"Unmatched closing tag: "+z.tagName),z.textNode+="",z.state=w.TEXT;return}z.tagName=u;var Z0=z.tags.length;while(Z0-- >L){var g=z.tag=z.tags.pop();z.tagName=z.tag.name,b(z,"onclosetag",z.tagName);var f={};for(var R in g.ns)f[R]=g.ns[R];var p=z.tags[z.tags.length-1]||z;if(z.opt.xmlns&&g.ns!==p.ns)Object.keys(g.ns).forEach(function(k){var V=g.ns[k];b(z,"onclosenamespace",{prefix:k,uri:V})})}if(L===0)z.closedRoot=!0;z.tagName=z.attribValue=z.attribName="",z.attribList.length=0,z.state=w.TEXT}function n(z){var L=z.entity,u=L.toLowerCase(),h,Z0="";if(z.ENTITIES[L])return z.ENTITIES[L];if(z.ENTITIES[u])return z.ENTITIES[u];if(L=u,L.charAt(0)==="#")if(L.charAt(1)==="x")L=L.slice(2),h=parseInt(L,16),Z0=h.toString(16);else L=L.slice(1),h=parseInt(L,10),Z0=h.toString(10);if(L=L.replace(/^0+/,""),isNaN(h)||Z0.toLowerCase()!==L)return i(z,"Invalid character entity"),"&"+z.entity+";";return String.fromCodePoint(h)}function o(z,L){if(L==="<")z.state=w.OPEN_WAKA,z.startTagPosition=z.position;else if(!S(L))i(z,"Non-whitespace before first tag."),z.textNode=L,z.state=w.TEXT}function Y0(z,L){var u="";if(L")b(L,"onsgmldeclaration",L.sgmlDecl),L.sgmlDecl="",L.state=w.TEXT;else if(F(h))L.state=w.SGML_DECL_QUOTED,L.sgmlDecl+=h;else L.sgmlDecl+=h;continue;case w.SGML_DECL_QUOTED:if(h===L.q)L.state=w.SGML_DECL,L.q="";L.sgmlDecl+=h;continue;case w.DOCTYPE:if(h===">")L.state=w.TEXT,b(L,"ondoctype",L.doctype),L.doctype=!0;else if(L.doctype+=h,h==="[")L.state=w.DOCTYPE_DTD;else if(F(h))L.state=w.DOCTYPE_QUOTED,L.q=h;continue;case w.DOCTYPE_QUOTED:if(L.doctype+=h,h===L.q)L.q="",L.state=w.DOCTYPE;continue;case w.DOCTYPE_DTD:if(L.doctype+=h,h==="]")L.state=w.DOCTYPE;else if(F(h))L.state=w.DOCTYPE_DTD_QUOTED,L.q=h;continue;case w.DOCTYPE_DTD_QUOTED:if(L.doctype+=h,h===L.q)L.state=w.DOCTYPE_DTD,L.q="";continue;case w.COMMENT:if(h==="-")L.state=w.COMMENT_ENDING;else L.comment+=h;continue;case w.COMMENT_ENDING:if(h==="-"){if(L.state=w.COMMENT_ENDED,L.comment=D(L.opt,L.comment),L.comment)b(L,"oncomment",L.comment);L.comment=""}else L.comment+="-"+h,L.state=w.COMMENT;continue;case w.COMMENT_ENDED:if(h!==">")i(L,"Malformed comment"),L.comment+="--"+h,L.state=w.COMMENT;else L.state=w.TEXT;continue;case w.CDATA:if(h==="]")L.state=w.CDATA_ENDING;else L.cdata+=h;continue;case w.CDATA_ENDING:if(h==="]")L.state=w.CDATA_ENDING_2;else L.cdata+="]"+h,L.state=w.CDATA;continue;case w.CDATA_ENDING_2:if(h===">"){if(L.cdata)b(L,"oncdata",L.cdata);b(L,"onclosecdata"),L.cdata="",L.state=w.TEXT}else if(h==="]")L.cdata+="]";else L.cdata+="]]"+h,L.state=w.CDATA;continue;case w.PROC_INST:if(h==="?")L.state=w.PROC_INST_ENDING;else if(S(h))L.state=w.PROC_INST_BODY;else L.procInstName+=h;continue;case w.PROC_INST_BODY:if(!L.procInstBody&&S(h))continue;else if(h==="?")L.state=w.PROC_INST_ENDING;else L.procInstBody+=h;continue;case w.PROC_INST_ENDING:if(h===">")b(L,"onprocessinginstruction",{name:L.procInstName,body:L.procInstBody}),L.procInstName=L.procInstBody="",L.state=w.TEXT;else L.procInstBody+="?"+h,L.state=w.PROC_INST_BODY;continue;case w.OPEN_TAG:if($(C,h))L.tagName+=h;else if(V0(L),h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else{if(!S(h))i(L,"Invalid character in tag name");L.state=w.ATTRIB}continue;case w.OPEN_TAG_SLASH:if(h===">")r(L,!0),y(L);else i(L,"Forward-slash in opening tag not followed by >"),L.state=w.ATTRIB;continue;case w.ATTRIB:if(S(h))continue;else if(h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else if($(E,h))L.attribName=h,L.attribValue="",L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case w.ATTRIB_NAME:if(h==="=")L.state=w.ATTRIB_VALUE;else if(h===">")i(L,"Attribute without value"),L.attribValue=L.attribName,G0(L),r(L);else if(S(h))L.state=w.ATTRIB_NAME_SAW_WHITE;else if($(C,h))L.attribName+=h;else i(L,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if(h==="=")L.state=w.ATTRIB_VALUE;else if(S(h))continue;else if(i(L,"Attribute without value"),L.tag.attributes[L.attribName]="",L.attribValue="",b(L,"onattribute",{name:L.attribName,value:""}),L.attribName="",h===">")r(L);else if($(E,h))L.attribName=h,L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name"),L.state=w.ATTRIB;continue;case w.ATTRIB_VALUE:if(S(h))continue;else if(F(h))L.q=h,L.state=w.ATTRIB_VALUE_QUOTED;else i(L,"Unquoted attribute value"),L.state=w.ATTRIB_VALUE_UNQUOTED,L.attribValue=h;continue;case w.ATTRIB_VALUE_QUOTED:if(h!==L.q){if(h==="&")L.state=w.ATTRIB_VALUE_ENTITY_Q;else L.attribValue+=h;continue}G0(L),L.q="",L.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:if(S(h))L.state=w.ATTRIB;else if(h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else if($(E,h))i(L,"No whitespace between attributes"),L.attribName=h,L.attribValue="",L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!M(h)){if(h==="&")L.state=w.ATTRIB_VALUE_ENTITY_U;else L.attribValue+=h;continue}if(G0(L),h===">")r(L);else L.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(!L.tagName)if(S(h))continue;else if(x(E,h))if(L.script)L.script+="")y(L);else if($(C,h))L.tagName+=h;else if(L.script)L.script+="")y(L);else i(L,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var f,R;switch(L.state){case w.TEXT_ENTITY:f=w.TEXT,R="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:f=w.ATTRIB_VALUE_QUOTED,R="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:f=w.ATTRIB_VALUE_UNQUOTED,R="attribValue";break}if(h===";")L[R]+=n(L),L.entity="",L.state=f;else if($(L.entity.length?v:N,h))L.entity+=h;else i(L,"Invalid character in entity name"),L[R]+="&"+L.entity+h,L.entity="",L.state=f;continue;default:throw Error(L,"Unknown state: "+L.state)}}if(L.position>=L.bufferCheckPosition)Q(L);return L}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint)(function(){var z=String.fromCharCode,L=Math.floor,u=function(){var h=16384,Z0=[],g,f,R=-1,p=arguments.length;if(!p)return"";var k="";while(++R1114111||L(V)!==V)throw RangeError("Invalid code point: "+V);if(V<=65535)Z0.push(V);else V-=65536,g=(V>>10)+55296,f=V%1024+56320,Z0.push(g,f);if(R+1===p||Z0.length>h)k+=z.apply(null,Z0),Z0.length=0}return k};if(Object.defineProperty)Object.defineProperty(String,"fromCodePoint",{value:u,configurable:!0,writable:!0});else String.fromCodePoint=u})()})(typeof B>"u"?B.sax={}:B)}),_8=R0((B,U)=>{U.exports={isArray:function(G){if(Array.isArray)return Array.isArray(G);return Object.prototype.toString.call(G)==="[object Array]"}}}),h8=R0((B,U)=>{var G=_8().isArray;U.exports={copyOptions:function(Y){var Q,K={};for(Q in Y)if(Y.hasOwnProperty(Q))K[Q]=Y[Q];return K},ensureFlagExists:function(Y,Q){if(!(Y in Q)||typeof Q[Y]!=="boolean")Q[Y]=!1},ensureSpacesExists:function(Y){if(!("spaces"in Y)||typeof Y.spaces!=="number"&&typeof Y.spaces!=="string")Y.spaces=0},ensureAlwaysArrayExists:function(Y){if(!("alwaysArray"in Y)||typeof Y.alwaysArray!=="boolean"&&!G(Y.alwaysArray))Y.alwaysArray=!1},ensureKeyExists:function(Y,Q){if(!(Y+"Key"in Q)||typeof Q[Y+"Key"]!=="string")Q[Y+"Key"]=Q.compact?"_"+Y:Y},checkFnExists:function(Y,Q){return Y+"Fn"in Q}}}),TB=R0((B,U)=>{var G=GG(),Y={on:function(){},parse:function(){}},Q=h8(),K=_8().isArray,Z,J=!0,q;function W(F){return Z=Q.copyOptions(F),Q.ensureFlagExists("ignoreDeclaration",Z),Q.ensureFlagExists("ignoreInstruction",Z),Q.ensureFlagExists("ignoreAttributes",Z),Q.ensureFlagExists("ignoreText",Z),Q.ensureFlagExists("ignoreComment",Z),Q.ensureFlagExists("ignoreCdata",Z),Q.ensureFlagExists("ignoreDoctype",Z),Q.ensureFlagExists("compact",Z),Q.ensureFlagExists("alwaysChildren",Z),Q.ensureFlagExists("addParent",Z),Q.ensureFlagExists("trim",Z),Q.ensureFlagExists("nativeType",Z),Q.ensureFlagExists("nativeTypeAttributes",Z),Q.ensureFlagExists("sanitize",Z),Q.ensureFlagExists("instructionHasAttributes",Z),Q.ensureFlagExists("captureSpacesBetweenElements",Z),Q.ensureAlwaysArrayExists(Z),Q.ensureKeyExists("declaration",Z),Q.ensureKeyExists("instruction",Z),Q.ensureKeyExists("attributes",Z),Q.ensureKeyExists("text",Z),Q.ensureKeyExists("comment",Z),Q.ensureKeyExists("cdata",Z),Q.ensureKeyExists("doctype",Z),Q.ensureKeyExists("type",Z),Q.ensureKeyExists("name",Z),Q.ensureKeyExists("elements",Z),Q.ensureKeyExists("parent",Z),Q.checkFnExists("doctype",Z),Q.checkFnExists("instruction",Z),Q.checkFnExists("cdata",Z),Q.checkFnExists("comment",Z),Q.checkFnExists("text",Z),Q.checkFnExists("instructionName",Z),Q.checkFnExists("elementName",Z),Q.checkFnExists("attributeName",Z),Q.checkFnExists("attributeValue",Z),Q.checkFnExists("attributes",Z),Z}function I(F){var M=Number(F);if(!isNaN(M))return M;var $=F.toLowerCase();if($==="true")return!0;else if($==="false")return!1;return F}function H(F,M){var $;if(Z.compact){if(!q[Z[F+"Key"]]&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(Z[F+"Key"])!==-1:Z.alwaysArray))q[Z[F+"Key"]]=[];if(q[Z[F+"Key"]]&&!K(q[Z[F+"Key"]]))q[Z[F+"Key"]]=[q[Z[F+"Key"]]];if(F+"Fn"in Z&&typeof M==="string")M=Z[F+"Fn"](M,q);if(F==="instruction"&&(("instructionFn"in Z)||("instructionNameFn"in Z))){for($ in M)if(M.hasOwnProperty($))if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);else{var x=M[$];delete M[$],M[Z.instructionNameFn($,x,q)]=x}}if(K(q[Z[F+"Key"]]))q[Z[F+"Key"]].push(M);else q[Z[F+"Key"]]=M}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];var w={};if(w[Z.typeKey]=F,F==="instruction"){for($ in M)if(M.hasOwnProperty($))break;if(w[Z.nameKey]="instructionNameFn"in Z?Z.instructionNameFn($,M,q):$,Z.instructionHasAttributes){if(w[Z.attributesKey]=M[$][Z.attributesKey],"instructionFn"in Z)w[Z.attributesKey]=Z.instructionFn(w[Z.attributesKey],$,q)}else{if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);w[Z.instructionKey]=M[$]}}else{if(F+"Fn"in Z)M=Z[F+"Fn"](M,q);w[Z[F+"Key"]]=M}if(Z.addParent)w[Z.parentKey]=q;q[Z.elementsKey].push(w)}}function T(F){if("attributesFn"in Z&&F)F=Z.attributesFn(F,q);if((Z.trim||("attributeValueFn"in Z)||("attributeNameFn"in Z)||Z.nativeTypeAttributes)&&F){var M;for(M in F)if(F.hasOwnProperty(M)){if(Z.trim)F[M]=F[M].trim();if(Z.nativeTypeAttributes)F[M]=I(F[M]);if("attributeValueFn"in Z)F[M]=Z.attributeValueFn(F[M],M,q);if("attributeNameFn"in Z){var $=F[M];delete F[M],F[Z.attributeNameFn(M,F[M],q)]=$}}}return F}function A(F){var M={};if(F.body&&(F.name.toLowerCase()==="xml"||Z.instructionHasAttributes)){var $=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,x;while((x=$.exec(F.body))!==null)M[x[1]]=x[2]||x[3]||x[4];M=T(M)}if(F.name.toLowerCase()==="xml"){if(Z.ignoreDeclaration)return;if(q[Z.declarationKey]={},Object.keys(M).length)q[Z.declarationKey][Z.attributesKey]=M;if(Z.addParent)q[Z.declarationKey][Z.parentKey]=q}else{if(Z.ignoreInstruction)return;if(Z.trim)F.body=F.body.trim();var w={};if(Z.instructionHasAttributes&&Object.keys(M).length)w[F.name]={},w[F.name][Z.attributesKey]=M;else w[F.name]=F.body;H("instruction",w)}}function P(F,M){var $;if(typeof F==="object")M=F.attributes,F=F.name;if(M=T(M),"elementNameFn"in Z)F=Z.elementNameFn(F,q);if(Z.compact){if($={},!Z.ignoreAttributes&&M&&Object.keys(M).length){$[Z.attributesKey]={};var x;for(x in M)if(M.hasOwnProperty(x))$[Z.attributesKey][x]=M[x]}if(!(F in q)&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(F)!==-1:Z.alwaysArray))q[F]=[];if(q[F]&&!K(q[F]))q[F]=[q[F]];if(K(q[F]))q[F].push($);else q[F]=$}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];if($={},$[Z.typeKey]="element",$[Z.nameKey]=F,!Z.ignoreAttributes&&M&&Object.keys(M).length)$[Z.attributesKey]=M;if(Z.alwaysChildren)$[Z.elementsKey]=[];q[Z.elementsKey].push($)}$[Z.parentKey]=q,q=$}function j(F){if(Z.ignoreText)return;if(!F.trim()&&!Z.captureSpacesBetweenElements)return;if(Z.trim)F=F.trim();if(Z.nativeType)F=I(F);if(Z.sanitize)F=F.replace(/&/g,"&").replace(//g,">");H("text",F)}function E(F){if(Z.ignoreComment)return;if(Z.trim)F=F.trim();H("comment",F)}function C(F){var M=q[Z.parentKey];if(!Z.addParent)delete q[Z.parentKey];q=M}function N(F){if(Z.ignoreCdata)return;if(Z.trim)F=F.trim();H("cdata",F)}function v(F){if(Z.ignoreDoctype)return;if(F=F.replace(/^ /,""),Z.trim)F=F.trim();H("doctype",F)}function S(F){F.note=F}U.exports=function(F,M){var $=J?G.parser(!0,{}):$=new Y.Parser("UTF-8"),x={};if(q=x,Z=W(M),J)$.opt={strictEntities:!0},$.onopentag=P,$.ontext=j,$.oncomment=E,$.onclosetag=C,$.onerror=S,$.oncdata=N,$.ondoctype=v,$.onprocessinginstruction=A;else $.on("startElement",P),$.on("text",j),$.on("comment",E),$.on("endElement",C),$.on("error",S);if(J)$.write(F).close();else if(!$.parse(F))throw Error("XML parsing error: "+$.getError());if(x[Z.elementsKey]){var w=x[Z.elementsKey];delete x[Z.elementsKey],x[Z.elementsKey]=w,delete x.text}return x}}),YG=R0((B,U)=>{var G=h8(),Y=TB();function Q(K){var Z=G.copyOptions(K);return G.ensureSpacesExists(Z),Z}U.exports=function(K,Z){var J=Q(Z),q=Y(K,J),W,I="compact"in J&&J.compact?"_parent":"parent";if("addParent"in J&&J.addParent)W=JSON.stringify(q,function(H,T){return H===I?"_":T},J.spaces);else W=JSON.stringify(q,null,J.spaces);return W.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}}),CB=R0((B,U)=>{var G=h8(),Y=_8().isArray,Q,K;function Z(F){var M=G.copyOptions(F);if(G.ensureFlagExists("ignoreDeclaration",M),G.ensureFlagExists("ignoreInstruction",M),G.ensureFlagExists("ignoreAttributes",M),G.ensureFlagExists("ignoreText",M),G.ensureFlagExists("ignoreComment",M),G.ensureFlagExists("ignoreCdata",M),G.ensureFlagExists("ignoreDoctype",M),G.ensureFlagExists("compact",M),G.ensureFlagExists("indentText",M),G.ensureFlagExists("indentCdata",M),G.ensureFlagExists("indentAttributes",M),G.ensureFlagExists("indentInstruction",M),G.ensureFlagExists("fullTagEmptyElement",M),G.ensureFlagExists("noQuotesForNativeAttributes",M),G.ensureSpacesExists(M),typeof M.spaces==="number")M.spaces=Array(M.spaces+1).join(" ");return G.ensureKeyExists("declaration",M),G.ensureKeyExists("instruction",M),G.ensureKeyExists("attributes",M),G.ensureKeyExists("text",M),G.ensureKeyExists("comment",M),G.ensureKeyExists("cdata",M),G.ensureKeyExists("doctype",M),G.ensureKeyExists("type",M),G.ensureKeyExists("name",M),G.ensureKeyExists("elements",M),G.checkFnExists("doctype",M),G.checkFnExists("instruction",M),G.checkFnExists("cdata",M),G.checkFnExists("comment",M),G.checkFnExists("text",M),G.checkFnExists("instructionName",M),G.checkFnExists("elementName",M),G.checkFnExists("attributeName",M),G.checkFnExists("attributeValue",M),G.checkFnExists("attributes",M),G.checkFnExists("fullTagEmptyElement",M),M}function J(F,M,$){return(!$&&F.spaces?` -`:"")+Array(M+1).join(F.spaces)}function q(F,M,$){if(M.ignoreAttributes)return"";if("attributesFn"in M)F=M.attributesFn(F,K,Q);var x,w,a,U0,b=[];for(x in F)if(F.hasOwnProperty(x)&&F[x]!==null&&F[x]!==void 0)U0=M.noQuotesForNativeAttributes&&typeof F[x]!=="string"?"":'"',w=""+F[x],w=w.replace(/"/g,"""),a="attributeNameFn"in M?M.attributeNameFn(x,w,K,Q):x,b.push(M.spaces&&M.indentAttributes?J(M,$+1,!1):" "),b.push(a+"="+U0+("attributeValueFn"in M?M.attributeValueFn(w,x,K,Q):w)+U0);if(F&&Object.keys(F).length&&M.spaces&&M.indentAttributes)b.push(J(M,$,!1));return b.join("")}function W(F,M,$){return Q=F,K="xml",M.ignoreDeclaration?"":""}function I(F,M,$){if(M.ignoreInstruction)return"";var x;for(x in F)if(F.hasOwnProperty(x))break;var w="instructionNameFn"in M?M.instructionNameFn(x,F[x],K,Q):x;if(typeof F[x]==="object")return Q=F,K=w,"";else{var a=F[x]?F[x]:"";if("instructionFn"in M)a=M.instructionFn(a,x,K,Q);return""}}function H(F,M){return M.ignoreComment?"":""}function T(F,M){return M.ignoreCdata?"":"","]]]]>"))+"]]>"}function A(F,M){return M.ignoreDoctype?"":""}function P(F,M){if(M.ignoreText)return"";return F=""+F,F=F.replace(/&/g,"&"),F=F.replace(/&/g,"&").replace(//g,">"),"textFn"in M?M.textFn(F,K,Q):F}function j(F,M){var $;if(F.elements&&F.elements.length)for($=0;$"),F[M.elementsKey]&&F[M.elementsKey].length)x.push(C(F[M.elementsKey],M,$+1)),Q=F,K=F.name;x.push(M.spaces&&j(F,M)?` -`+Array($+1).join(M.spaces):""),x.push("")}else x.push("/>");return x.join("")}function C(F,M,$,x){return F.reduce(function(w,a){var U0=J(M,$,x&&!w);switch(a.type){case"element":return w+U0+E(a,M,$);case"comment":return w+U0+H(a[M.commentKey],M);case"doctype":return w+U0+A(a[M.doctypeKey],M);case"cdata":return w+(M.indentCdata?U0:"")+T(a[M.cdataKey],M);case"text":return w+(M.indentText?U0:"")+P(a[M.textKey],M);case"instruction":var b={};return b[a[M.nameKey]]=a[M.attributesKey]?a:a[M.instructionKey],w+(M.indentInstruction?U0:"")+I(b,M,$)}},"")}function N(F,M,$){var x;for(x in F)if(F.hasOwnProperty(x))switch(x){case M.parentKey:case M.attributesKey:break;case M.textKey:if(M.indentText||$)return!0;break;case M.cdataKey:if(M.indentCdata||$)return!0;break;case M.instructionKey:if(M.indentInstruction||$)return!0;break;case M.doctypeKey:case M.commentKey:return!0;default:return!0}return!1}function v(F,M,$,x,w){Q=F,K=M;var a="elementNameFn"in $?$.elementNameFn(M,F):M;if(typeof F>"u"||F===null||F==="")return"fullTagEmptyElementFn"in $&&$.fullTagEmptyElementFn(M,F)||$.fullTagEmptyElement?"<"+a+">":"<"+a+"/>";var U0=[];if(M){if(U0.push("<"+a),typeof F!=="object")return U0.push(">"+P(F,$)+""),U0.join("");if(F[$.attributesKey])U0.push(q(F[$.attributesKey],$,x));var b=N(F,$,!0)||F[$.attributesKey]&&F[$.attributesKey]["xml:space"]==="preserve";if(!b)if("fullTagEmptyElementFn"in $)b=$.fullTagEmptyElementFn(M,F);else b=$.fullTagEmptyElement;if(b)U0.push(">");else return U0.push("/>"),U0.join("")}if(U0.push(S(F,$,x+1,!1)),Q=F,K=M,M)U0.push((w?J($,x,!1):"")+"");return U0.join("")}function S(F,M,$,x){var w,a,U0,b=[];for(a in F)if(F.hasOwnProperty(a)){U0=Y(F[a])?F[a]:[F[a]];for(w=0;w{var G=CB();U.exports=function(Y,Q){if(Y instanceof Buffer)Y=Y.toString();var K=null;if(typeof Y==="string")try{K=JSON.parse(Y)}catch(Z){throw Error("The JSON structure is invalid")}else K=Y;return G(K,Q)}}),h1=R0((B,U)=>{U.exports={xml2js:TB(),xml2json:YG(),js2xml:CB(),json2xml:ZG()}})(),u1=(B)=>{switch(B.type){case void 0:case"element":let U=new kB(B.name,B.attributes),G=B.elements||[];for(let Y of G){let Q=u1(Y);if(Q!==void 0)U.push(Q)}return U;case"text":return B.text;default:return}},QG=class extends H0{},kB=class extends t{static fromXmlString(B){return u1((0,h1.xml2js)(B,{compact:!1}))}constructor(B,U){super(B);if(U)this.root.push(new QG(U))}push(B){this.root.push(B)}},$B=class extends t{constructor(B){super("");e(this,"_attr",void 0),this._attr=B}prepForXml(B){return{_attr:this._attr}}},JG="",u8=class extends t{constructor(B,U){super(B);if(U)this.root=U.root}},T0=(B)=>{if(isNaN(B))throw Error(`Invalid value '${B}' specified. Must be an integer.`);return Math.floor(B)},X1=(B)=>{let U=T0(B);if(U<0)throw Error(`Invalid value '${B}' specified. Must be a positive integer.`);return U},d1=(B,U)=>{let G=U*2;if(B.length!==G||isNaN(Number(`0x${B}`)))throw Error(`Invalid hex value '${B}'. Expected ${G} digit hex value`);return B},KG=(B)=>d1(B,4),SB=(B)=>d1(B,2),W8=(B)=>d1(B,1),q1=(B)=>{let U=B.slice(-2),G=B.substring(0,B.length-2);return`${Number(G)}${U}`},d8=(B)=>{let U=q1(B);if(parseFloat(U)<0)throw Error(`Invalid value '${U}' specified. Expected a positive number.`);return U},C2=(B)=>{if(B==="auto")return B;return d1(B.charAt(0)==="#"?B.substring(1):B,3)},t0=(B)=>typeof B==="string"?q1(B):T0(B),bB=(B)=>typeof B==="string"?d8(B):X1(B),VG=(B)=>typeof B==="string"?q1(B):T0(B),E0=(B)=>typeof B==="string"?d8(B):X1(B),vB=(B)=>{let U=B.substring(0,B.length-1);return`${Number(U)}%`},c8=(B)=>{if(typeof B==="number")return T0(B);if(B.slice(-1)==="%")return vB(B);return q1(B)},yB=X1,gB=X1,fB=(B)=>B.toISOString(),q0=class extends t{constructor(B,U=!0){super(B);if(U!==!0)this.root.push(new C0({val:U}))}},D1=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:bB(U)}))}},S0=class extends t{},q2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},f2=(B,U)=>new M0({name:B,attributes:{value:{key:"w:val",value:U}}}),_2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},XG=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},O2=class extends t{constructor(B,U){super(B);this.root.push(U)}},M0=class extends t{constructor({name:B,attributes:U,children:G}){super(B);if(U)this.root.push(new $8(U));if(G)this.root.push(...G)}},c0={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},m8=(B)=>new M0({name:"w:jc",attributes:{val:{key:"w:val",value:B}}}),j0=(B,{color:U,size:G,space:Y,style:Q})=>new M0({name:B,attributes:{style:{key:"w:val",value:Q},color:{key:"w:color",value:U===void 0?void 0:C2(U)},size:{key:"w:sz",value:G===void 0?void 0:yB(G)},space:{key:"w:space",value:Y===void 0?void 0:gB(Y)}}}),c1={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},xB=class extends R2{constructor(B){super("w:pBdr");if(B.top)this.root.push(j0("w:top",B.top));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.left)this.root.push(j0("w:left",B.left));if(B.right)this.root.push(j0("w:right",B.right));if(B.between)this.root.push(j0("w:between",B.between))}},_B=class extends t{constructor(){super("w:pBdr");let B=j0("w:bottom",{color:"auto",space:1,style:c1.SINGLE,size:6});this.root.push(B)}},hB=({start:B,end:U,left:G,right:Y,hanging:Q,firstLine:K,firstLineChars:Z})=>new M0({name:"w:ind",attributes:{start:{key:"w:start",value:B===void 0?void 0:t0(B)},end:{key:"w:end",value:U===void 0?void 0:t0(U)},left:{key:"w:left",value:G===void 0?void 0:t0(G)},right:{key:"w:right",value:Y===void 0?void 0:t0(Y)},hanging:{key:"w:hanging",value:Q===void 0?void 0:E0(Q)},firstLine:{key:"w:firstLine",value:K===void 0?void 0:E0(K)},firstLineChars:{key:"w:firstLineChars",value:Z===void 0?void 0:T0(Z)}}}),uB=()=>new M0({name:"w:br"}),l8={BEGIN:"begin",END:"end",SEPARATE:"separate"},a8=(B,U)=>new M0({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:B},dirty:{key:"w:dirty",value:U}}}),e0=(B)=>a8(l8.BEGIN,B),X2=(B)=>a8(l8.SEPARATE,B),B2=(B)=>a8(l8.END,B),qG={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},MG={BOTTOM:"bottom",CENTER:"center",INSIDE:"inside",OUTSIDE:"outside",TOP:"top"},RG={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},x0={DEFAULT:"default",PRESERVE:"preserve"},_0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{space:"xml:space"})}},LG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},IG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},OG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},HG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTION")}},M1=({fill:B,color:U,type:G})=>new M0({name:"w:shd",attributes:{fill:{key:"w:fill",value:B===void 0?void 0:C2(B)},color:{key:"w:color",value:U===void 0?void 0:C2(U)},type:{key:"w:val",value:G}}}),FG={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},b0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},WG=class extends t{constructor(B){super("w:del");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},PG=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},p8={DOT:"dot"},r8=(B=p8.DOT)=>new M0({name:"w:em",attributes:{val:{key:"w:val",value:B}}}),AG=()=>r8(p8.DOT),jG=class extends t{constructor(B){super("w:spacing");this.root.push(new C0({val:t0(B)}))}},NG=class extends t{constructor(B){super("w:color");this.root.push(new C0({val:C2(B)}))}},wG=class extends t{constructor(B){super("w:highlight");this.root.push(new C0({val:B}))}},zG=class extends t{constructor(B){super("w:highlightCs");this.root.push(new C0({val:B}))}},EG=(B)=>new M0({name:"w:lang",attributes:{value:{key:"w:val",value:B.value},eastAsia:{key:"w:eastAsia",value:B.eastAsia},bidirectional:{key:"w:bidi",value:B.bidirectional}}}),T1=(B,U)=>{if(typeof B==="string"){let Y=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:Y},cs:{key:"w:cs",value:Y},eastAsia:{key:"w:eastAsia",value:Y},hAnsi:{key:"w:hAnsi",value:Y},hint:{key:"w:hint",value:U}}})}let G=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:G.ascii},cs:{key:"w:cs",value:G.cs},eastAsia:{key:"w:eastAsia",value:G.eastAsia},hAnsi:{key:"w:hAnsi",value:G.hAnsi},hint:{key:"w:hint",value:G.hint}}})},dB=(B)=>new M0({name:"w:vertAlign",attributes:{val:{key:"w:val",value:B}}}),DG=()=>dB("superscript"),TG=()=>dB("subscript"),i8={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},cB=(B=i8.SINGLE,U)=>new M0({name:"w:u",attributes:{val:{key:"w:val",value:B},color:{key:"w:color",value:U===void 0?void 0:C2(U)}}}),CG={BLINK_BACKGROUND:"blinkBackground",LIGHTS:"lights",ANTS_BLACK:"antsBlack",ANTS_RED:"antsRed",SHIMMER:"shimmer",SPARKLE:"sparkle",NONE:"none"},kG={BLACK:"black",BLUE:"blue",CYAN:"cyan",DARK_BLUE:"darkBlue",DARK_CYAN:"darkCyan",DARK_GRAY:"darkGray",DARK_GREEN:"darkGreen",DARK_MAGENTA:"darkMagenta",DARK_RED:"darkRed",DARK_YELLOW:"darkYellow",GREEN:"green",LIGHT_GRAY:"lightGray",MAGENTA:"magenta",NONE:"none",RED:"red",WHITE:"white",YELLOW:"yellow"},U2=class extends R2{constructor(B){super("w:rPr");if(!B)return;if(B.style)this.push(new q2("w:rStyle",B.style));if(B.font)if(typeof B.font==="string")this.push(T1(B.font));else if("name"in B.font)this.push(T1(B.font.name,B.font.hint));else this.push(T1(B.font));if(B.bold!==void 0)this.push(new q0("w:b",B.bold));if(B.boldComplexScript===void 0&&B.bold!==void 0||B.boldComplexScript){var U;this.push(new q0("w:bCs",(U=B.boldComplexScript)!==null&&U!==void 0?U:B.bold))}if(B.italics!==void 0)this.push(new q0("w:i",B.italics));if(B.italicsComplexScript===void 0&&B.italics!==void 0||B.italicsComplexScript){var G;this.push(new q0("w:iCs",(G=B.italicsComplexScript)!==null&&G!==void 0?G:B.italics))}if(B.smallCaps!==void 0)this.push(new q0("w:smallCaps",B.smallCaps));else if(B.allCaps!==void 0)this.push(new q0("w:caps",B.allCaps));if(B.strike!==void 0)this.push(new q0("w:strike",B.strike));if(B.doubleStrike!==void 0)this.push(new q0("w:dstrike",B.doubleStrike));if(B.emboss!==void 0)this.push(new q0("w:emboss",B.emboss));if(B.imprint!==void 0)this.push(new q0("w:imprint",B.imprint));if(B.noProof!==void 0)this.push(new q0("w:noProof",B.noProof));if(B.snapToGrid!==void 0)this.push(new q0("w:snapToGrid",B.snapToGrid));if(B.vanish)this.push(new q0("w:vanish",B.vanish));if(B.color)this.push(new NG(B.color));if(B.characterSpacing)this.push(new jG(B.characterSpacing));if(B.scale!==void 0)this.push(new _2("w:w",B.scale));if(B.kern)this.push(new D1("w:kern",B.kern));if(B.position)this.push(new q2("w:position",B.position));if(B.size!==void 0)this.push(new D1("w:sz",B.size));let Y=B.sizeComplexScript===void 0||B.sizeComplexScript===!0?B.size:B.sizeComplexScript;if(Y)this.push(new D1("w:szCs",Y));if(B.highlight)this.push(new wG(B.highlight));let Q=B.highlightComplexScript===void 0||B.highlightComplexScript===!0?B.highlight:B.highlightComplexScript;if(Q)this.push(new zG(Q));if(B.underline)this.push(cB(B.underline.type,B.underline.color));if(B.effect)this.push(new q2("w:effect",B.effect));if(B.border)this.push(j0("w:bdr",B.border));if(B.shading)this.push(M1(B.shading));if(B.subScript)this.push(TG());if(B.superScript)this.push(DG());if(B.rightToLeft!==void 0)this.push(new q0("w:rtl",B.rightToLeft));if(B.emphasisMark)this.push(r8(B.emphasisMark.type));if(B.language)this.push(EG(B.language));if(B.specVanish)this.push(new q0("w:specVanish",B.vanish));if(B.math)this.push(new q0("w:oMath",B.math));if(B.revision)this.push(new lB(B.revision))}push(B){this.root.push(B)}},mB=class extends U2{constructor(B){super(B);if(B===null||B===void 0?void 0:B.insertion)this.push(new PG(B.insertion));if(B===null||B===void 0?void 0:B.deletion)this.push(new WG(B.deletion))}},lB=class extends t{constructor(B){super("w:rPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new U2(B))}},Z1=class extends t{constructor(B){super("w:t");if(typeof B==="string")this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B);else{var U;this.root.push(new _0({space:(U=B.space)!==null&&U!==void 0?U:x0.DEFAULT})),this.root.push(B.text)}}},F2={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},D0=class extends t{constructor(B){super("w:r");if(e(this,"properties",void 0),this.properties=new U2(B),this.root.push(this.properties),B.break)for(let U=0;U{U.exports=G;function G(Y,Q){if(!Y)throw Error(Q||"Assertion failed")}G.equal=function(Q,K,Z){if(Q!=K)throw Error(Z||"Assertion failed: "+Q+" != "+K)}}),G2=R0((B)=>{var U=R1();B.inherits=W2();function G(b,c){if((b.charCodeAt(c)&64512)!==55296)return!1;if(c<0||c+1>=b.length)return!1;return(b.charCodeAt(c+1)&64512)===56320}function Y(b,c){if(Array.isArray(b))return b.slice();if(!b)return[];var D=[];if(typeof b==="string"){if(!c){var m=0;for(var B0=0;B0>6|192,D[m++]=i&63|128;else if(G(b,B0))i=65536+((i&1023)<<10)+(b.charCodeAt(++B0)&1023),D[m++]=i>>18|240,D[m++]=i>>12&63|128,D[m++]=i>>6&63|128,D[m++]=i&63|128;else D[m++]=i>>12|224,D[m++]=i>>6&63|128,D[m++]=i&63|128}}else if(c==="hex"){if(b=b.replace(/[^a-z0-9]+/gi,""),b.length%2!==0)b="0"+b;for(B0=0;B0>>24|b>>>8&65280|b<<8&16711680|(b&255)<<24)>>>0}B.htonl=K;function Z(b,c){var D="";for(var m=0;m>>0}return i}B.join32=W;function I(b,c){var D=Array(b.length*4);for(var m=0,B0=0;m>>24,D[B0+1]=i>>>16&255,D[B0+2]=i>>>8&255,D[B0+3]=i&255;else D[B0+3]=i>>>24,D[B0+2]=i>>>16&255,D[B0+1]=i>>>8&255,D[B0]=i&255}return D}B.split32=I;function H(b,c){return b>>>c|b<<32-c}B.rotr32=H;function T(b,c){return b<>>32-c}B.rotl32=T;function A(b,c){return b+c>>>0}B.sum32=A;function P(b,c,D){return b+c+D>>>0}B.sum32_3=P;function j(b,c,D,m){return b+c+D+m>>>0}B.sum32_4=j;function E(b,c,D,m,B0){return b+c+D+m+B0>>>0}B.sum32_5=E;function C(b,c,D,m){var B0=b[c],i=m+b[c+1]>>>0;b[c]=(i>>0,b[c+1]=i}B.sum64=C;function N(b,c,D,m){return(c+m>>>0>>0}B.sum64_hi=N;function v(b,c,D,m){return c+m>>>0}B.sum64_lo=v;function S(b,c,D,m,B0,i,V0,s){var G0=0,r=c;return r=r+m>>>0,G0+=r>>0,G0+=r>>0,G0+=r>>0}B.sum64_4_hi=S;function F(b,c,D,m,B0,i,V0,s){return c+m+i+s>>>0}B.sum64_4_lo=F;function M(b,c,D,m,B0,i,V0,s,G0,r){var y=0,n=c;return n=n+m>>>0,y+=n>>0,y+=n>>0,y+=n>>0,y+=n>>0}B.sum64_5_hi=M;function $(b,c,D,m,B0,i,V0,s,G0,r){return c+m+i+s+r>>>0}B.sum64_5_lo=$;function x(b,c,D){return(c<<32-D|b>>>D)>>>0}B.rotr64_hi=x;function w(b,c,D){return(b<<32-D|c>>>D)>>>0}B.rotr64_lo=w;function a(b,c,D){return b>>>D}B.shr64_hi=a;function U0(b,c,D){return(b<<32-D|c>>>D)>>>0}B.shr64_lo=U0}),L1=R0((B)=>{var U=G2(),G=R1();function Y(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}B.BlockHash=Y,Y.prototype.update=function(K,Z){if(K=U.toArray(K,Z),!this.pending)this.pending=K;else this.pending=this.pending.concat(K);if(this.pendingTotal+=K.length,this.pending.length>=this._delta8){K=this.pending;var J=K.length%this._delta8;if(this.pending=K.slice(K.length-J,K.length),this.pending.length===0)this.pending=null;K=U.join32(K,0,K.length-J,this.endian);for(var q=0;q>>24&255,q[W++]=K>>>16&255,q[W++]=K>>>8&255,q[W++]=K&255}else{q[W++]=K&255,q[W++]=K>>>8&255,q[W++]=K>>>16&255,q[W++]=K>>>24&255,q[W++]=0,q[W++]=0,q[W++]=0,q[W++]=0;for(I=8;I{var U=G2().rotr32;function G(I,H,T,A){if(I===0)return Y(H,T,A);if(I===1||I===3)return K(H,T,A);if(I===2)return Q(H,T,A)}B.ft_1=G;function Y(I,H,T){return I&H^~I&T}B.ch32=Y;function Q(I,H,T){return I&H^I&T^H&T}B.maj32=Q;function K(I,H,T){return I^H^T}B.p32=K;function Z(I){return U(I,2)^U(I,13)^U(I,22)}B.s0_256=Z;function J(I){return U(I,6)^U(I,11)^U(I,25)}B.s1_256=J;function q(I){return U(I,7)^U(I,18)^I>>>3}B.g0_256=q;function W(I){return U(I,17)^U(I,19)^I>>>10}B.g1_256=W}),SG=R0((B,U)=>{var G=G2(),Y=L1(),Q=pB(),K=G.rotl32,Z=G.sum32,J=G.sum32_5,q=Q.ft_1,W=Y.BlockHash,I=[1518500249,1859775393,2400959708,3395469782];function H(){if(!(this instanceof H))return new H;W.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}G.inherits(H,W),U.exports=H,H.blockSize=512,H.outSize=160,H.hmacStrength=80,H.padLength=64,H.prototype._update=function(A,P){var j=this.W;for(var E=0;E<16;E++)j[E]=A[P+E];for(;E{var G=G2(),Y=L1(),Q=pB(),K=R1(),Z=G.sum32,J=G.sum32_4,q=G.sum32_5,W=Q.ch32,I=Q.maj32,H=Q.s0_256,T=Q.s1_256,A=Q.g0_256,P=Q.g1_256,j=Y.BlockHash,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function C(){if(!(this instanceof C))return new C;j.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=Array(64)}G.inherits(C,j),U.exports=C,C.blockSize=512,C.outSize=256,C.hmacStrength=192,C.padLength=64,C.prototype._update=function(v,S){var F=this.W;for(var M=0;M<16;M++)F[M]=v[S+M];for(;M{var G=G2(),Y=rB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=512,Q.outSize=224,Q.hmacStrength=192,Q.padLength=64,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),iB=R0((B,U)=>{var G=G2(),Y=L1(),Q=R1(),K=G.rotr64_hi,Z=G.rotr64_lo,J=G.shr64_hi,q=G.shr64_lo,W=G.sum64,I=G.sum64_hi,H=G.sum64_lo,T=G.sum64_4_hi,A=G.sum64_4_lo,P=G.sum64_5_hi,j=G.sum64_5_lo,E=Y.BlockHash,C=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function N(){if(!(this instanceof N))return new N;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=C,this.W=Array(160)}G.inherits(N,E),U.exports=N,N.blockSize=1024,N.outSize=512,N.hmacStrength=192,N.padLength=128,N.prototype._prepareBlock=function(B0,i){var V0=this.W;for(var s=0;s<32;s++)V0[s]=B0[i+s];for(;s{var G=G2(),Y=iB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=1024,Q.outSize=384,Q.hmacStrength=192,Q.padLength=128,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),yG=R0((B)=>{B.sha1=SG(),B.sha224=bG(),B.sha256=rB(),B.sha384=vG(),B.sha512=iB()}),gG=R0((B)=>{var U=G2(),G=L1(),Y=U.rotl32,Q=U.sum32,K=U.sum32_3,Z=U.sum32_4,J=G.BlockHash;function q(){if(!(this instanceof q))return new q;J.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}U.inherits(q,J),B.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(C,N){var v=this.h[0],S=this.h[1],F=this.h[2],M=this.h[3],$=this.h[4],x=v,w=S,a=F,U0=M,b=$;for(var c=0;c<80;c++){var D=Q(Y(Z(v,W(c,S,F,M),C[T[c]+N],I(c)),P[c]),$);v=$,$=M,M=Y(F,10),F=S,S=D,D=Q(Y(Z(x,W(79-c,w,a,U0),C[A[c]+N],H(c)),j[c]),b),x=b,b=U0,U0=Y(a,10),a=w,w=D}D=K(this.h[1],F,U0),this.h[1]=K(this.h[2],M,b),this.h[2]=K(this.h[3],$,x),this.h[3]=K(this.h[4],v,w),this.h[4]=K(this.h[0],S,a),this.h[0]=D},q.prototype._digest=function(C){if(C==="hex")return U.toHex32(this.h,"little");else return U.split32(this.h,"little")};function W(E,C,N,v){if(E<=15)return C^N^v;else if(E<=31)return C&N|~C&v;else if(E<=47)return(C|~N)^v;else if(E<=63)return C&v|N&~v;else return C^(N|~v)}function I(E){if(E<=15)return 0;else if(E<=31)return 1518500249;else if(E<=47)return 1859775393;else if(E<=63)return 2400959708;else return 2840853838}function H(E){if(E<=15)return 1352829926;else if(E<=31)return 1548603684;else if(E<=47)return 1836072691;else if(E<=63)return 2053994217;else return 0}var T=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],A=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],P=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],j=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),fG=R0((B,U)=>{var G=G2(),Y=R1();function Q(K,Z,J){if(!(this instanceof Q))return new Q(K,Z,J);this.Hash=K,this.blockSize=K.blockSize/8,this.outSize=K.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(Z,J))}U.exports=Q,Q.prototype._init=function(Z){if(Z.length>this.blockSize)Z=new this.Hash().update(Z).digest();Y(Z.length<=this.blockSize);for(var J=Z.length;J{var U=B;U.utils=G2(),U.common=L1(),U.sha=yG(),U.ripemd=gG(),U.hmac=fG(),U.sha1=U.sha.sha1,U.sha256=U.sha.sha256,U.sha224=U.sha.sha224,U.sha384=U.sha.sha384,U.sha512=U.sha.sha512,U.ripemd160=U.ripemd.ripemd160})(),1),_G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",hG=(B,U=21)=>{return(G=U)=>{let Y="",Q=G|0;while(Q--)Y+=B[Math.random()*B.length|0];return Y}},uG=(B=21)=>{let U="",G=B|0;while(G--)U+=_G[Math.random()*64|0];return U},dG=(B)=>Math.floor(B/25.4*72*20),u0=(B)=>Math.floor(B*72*20),I1=(B=0)=>{let U=B;return()=>++U},nB=()=>I1(),sB=()=>I1(1),oB=()=>I1(),tB=()=>I1(),O1=()=>uG().toLowerCase(),P8=(B)=>xG.default.sha1().update(B instanceof ArrayBuffer?new Uint8Array(B):B).digest("hex"),s2=(B)=>hG("1234567890abcdef",B)(),eB=()=>`${s2(8)}-${s2(4)}-${s2(4)}-${s2(4)}-${s2(12)}`,U1=(B)=>new Uint8Array(new TextEncoder().encode(B)),B4={CHARACTER:"character",COLUMN:"column",INSIDE_MARGIN:"insideMargin",LEFT_MARGIN:"leftMargin",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",RIGHT_MARGIN:"rightMargin"},U4={BOTTOM_MARGIN:"bottomMargin",INSIDE_MARGIN:"insideMargin",LINE:"line",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",PARAGRAPH:"paragraph",TOP_MARGIN:"topMargin"},G4=()=>new M0({name:"wp:simplePos",attributes:{x:{key:"x",value:0},y:{key:"y",value:0}}}),Y4=(B)=>new M0({name:"wp:align",children:[B]}),Z4=(B)=>new M0({name:"wp:posOffset",children:[B.toString()]}),Q4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionH",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:B4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),J4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionV",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:U4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),cG=function(B){return B.CENTER="ctr",B.TOP="t",B.BOTTOM="b",B}({}),K4=(B={})=>{var U,G,Y,Q;return new M0({name:"wps:bodyPr",attributes:{lIns:{key:"lIns",value:(U=B.margins)===null||U===void 0?void 0:U.left},rIns:{key:"rIns",value:(G=B.margins)===null||G===void 0?void 0:G.right},tIns:{key:"tIns",value:(Y=B.margins)===null||Y===void 0?void 0:Y.top},bIns:{key:"bIns",value:(Q=B.margins)===null||Q===void 0?void 0:Q.bottom},anchor:{key:"anchor",value:B.verticalAnchor}},children:[...B.noAutoFit?[new q0("a:noAutofit",B.noAutoFit)]:[]]})},mG=(B={txBox:"1"})=>new M0({name:"wps:cNvSpPr",attributes:{txBox:{key:"txBox",value:B.txBox}}}),lG=(B)=>new M0({name:"w:txbxContent",children:[...B]}),aG=(B)=>new M0({name:"wps:txbx",children:[lG(B)]}),pG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{cx:"cx",cy:"cy"})}},rG=class extends t{constructor(B,U){super("a:ext");e(this,"attributes",void 0),this.attributes=new pG({cx:B,cy:U}),this.root.push(this.attributes)}},iG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{x:"x",y:"y"})}},nG=class extends t{constructor(B,U){super("a:off");this.root.push(new iG({x:B!==null&&B!==void 0?B:0,y:U!==null&&U!==void 0?U:0}))}},sG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{flipVertical:"flipV",flipHorizontal:"flipH",rotation:"rot"})}},V4=class extends t{constructor(B){var U,G,Y,Q;super("a:xfrm");e(this,"extents",void 0),e(this,"offset",void 0),this.root.push(new sG({flipVertical:(U=B.flip)===null||U===void 0?void 0:U.vertical,flipHorizontal:(G=B.flip)===null||G===void 0?void 0:G.horizontal,rotation:B.rotation})),this.offset=new nG((Y=B.offset)===null||Y===void 0||(Y=Y.emus)===null||Y===void 0?void 0:Y.x,(Q=B.offset)===null||Q===void 0||(Q=Q.emus)===null||Q===void 0?void 0:Q.y),this.extents=new rG(B.emus.x,B.emus.y),this.root.push(this.offset),this.root.push(this.extents)}},X4=()=>new M0({name:"a:noFill"}),oG=(B)=>new M0({name:"a:srgbClr",attributes:{value:{key:"val",value:B.value}}}),tG=(B)=>new M0({name:"a:schemeClr",attributes:{value:{key:"val",value:B.value}}}),A8=(B)=>new M0({name:"a:solidFill",children:[B.type==="rgb"?oG(B):tG(B)]}),eG=(B)=>new M0({name:"a:ln",attributes:{width:{key:"w",value:B.width},cap:{key:"cap",value:B.cap},compoundLine:{key:"cmpd",value:B.compoundLine},align:{key:"algn",value:B.align}},children:[B.type==="noFill"?X4():B.solidFillType==="rgb"?A8({type:"rgb",value:B.value}):A8({type:"scheme",value:B.value})]}),BY=class extends t{constructor(){super("a:avLst")}},UY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{prst:"prst"})}},GY=class extends t{constructor(){super("a:prstGeom");this.root.push(new UY({prst:"rect"})),this.root.push(new BY)}},YY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{bwMode:"bwMode"})}},q4=class extends t{constructor({element:B,outline:U,solidFill:G,transform:Y}){super(`${B}:spPr`);if(e(this,"form",void 0),this.root.push(new YY({bwMode:"auto"})),this.form=new V4(Y),this.root.push(this.form),this.root.push(new GY),U)this.root.push(X4()),this.root.push(eG(U));if(G)this.root.push(A8(G))}},l6=(B)=>new M0({name:"wps:wsp",children:[mG(B.nonVisualProperties),new q4({element:"wps",transform:B.transformation,outline:B.outline,solidFill:B.solidFill}),aG(B.children),K4(B.bodyProperties)]}),K8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{uri:"uri"})}},ZY=(B)=>new M0({name:"asvg:svgBlip",attributes:{asvg:{key:"xmlns:asvg",value:"http://schemas.microsoft.com/office/drawing/2016/SVG/main"},embed:{key:"r:embed",value:`rId{${B.fileName}}`}}}),QY=(B)=>new M0({name:"a:ext",attributes:{uri:{key:"uri",value:"{96DAC541-7B7A-43D3-8B79-37D633B846F1}"}},children:[ZY(B)]}),JY=(B)=>new M0({name:"a:extLst",children:[QY(B)]}),KY=(B)=>new M0({name:"a:blip",attributes:{embed:{key:"r:embed",value:`rId{${B.type==="svg"?B.fallback.fileName:B.fileName}}`},cstate:{key:"cstate",value:"none"}},children:B.type==="svg"?[JY(B)]:[]}),VY=class extends t{constructor(){super("a:srcRect")}},XY=class extends t{constructor(){super("a:fillRect")}},qY=class extends t{constructor(){super("a:stretch");this.root.push(new XY)}},MY=class extends t{constructor(B){super("pic:blipFill");this.root.push(KY(B)),this.root.push(new VY),this.root.push(new qY)}},RY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{noChangeAspect:"noChangeAspect",noChangeArrowheads:"noChangeArrowheads"})}},LY=class extends t{constructor(){super("a:picLocks");this.root.push(new RY({noChangeAspect:1,noChangeArrowheads:1}))}},IY=class extends t{constructor(){super("pic:cNvPicPr");this.root.push(new LY)}},M4=(B,U)=>new M0({name:"a:hlinkClick",attributes:L0(L0({},U?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${B}`}})}),OY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"id",name:"name",descr:"descr"})}},HY=class extends t{constructor(){super("pic:cNvPr");this.root.push(new OY({id:0,name:"",descr:""}))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!1));break}return super.prepForXml(B)}},FY=class extends t{constructor(){super("pic:nvPicPr");this.root.push(new HY),this.root.push(new IY)}},WY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:pic"})}},a6=class extends t{constructor({mediaData:B,transform:U,outline:G}){super("pic:pic");this.root.push(new WY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/picture"})),this.root.push(new FY),this.root.push(new MY(B)),this.root.push(new q4({element:"pic",transform:U,outline:G}))}},PY=(B)=>new M0({name:"wpg:grpSpPr",children:[new V4(B)]}),AY=()=>new M0({name:"wpg:cNvGrpSpPr"}),jY=(B)=>new M0({name:"wpg:wgp",children:[AY(),PY(B.transformation),...B.children]}),NY=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphicData");if(B.type==="wps"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));let Q=l6(L0(L0({},B.data),{},{transformation:U,outline:G,solidFill:Y}));this.root.push(Q)}else if(B.type==="wpg"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"}));let Q=jY({children:B.children.map((K)=>{if(K.type==="wps")return l6(L0(L0({},K.data),{},{transformation:K.transformation,outline:K.outline,solidFill:K.solidFill}));else return new a6({mediaData:K,transform:K.transformation,outline:K.outline})}),transformation:U});this.root.push(Q)}else{this.root.push(new K8({uri:"http://schemas.openxmlformats.org/drawingml/2006/picture"}));let Q=new a6({mediaData:B,transform:U,outline:G});this.root.push(Q)}}},wY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{a:"xmlns:a"})}},R4=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphic");e(this,"data",void 0),this.root.push(new wY({a:"http://schemas.openxmlformats.org/drawingml/2006/main"})),this.data=new NY({mediaData:B,transform:U,outline:G,solidFill:Y}),this.root.push(this.data)}},e2={NONE:0,SQUARE:1,TIGHT:2,TOP_AND_BOTTOM:3},L4={BOTH_SIDES:"bothSides",LEFT:"left",RIGHT:"right",LARGEST:"largest"},j8=()=>new M0({name:"wp:wrapNone"}),I4=(B,U={top:0,bottom:0,left:0,right:0})=>new M0({name:"wp:wrapSquare",attributes:{wrapText:{key:"wrapText",value:B.side||L4.BOTH_SIDES},distT:{key:"distT",value:U.top},distB:{key:"distB",value:U.bottom},distL:{key:"distL",value:U.left},distR:{key:"distR",value:U.right}}}),O4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTight",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),H4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTopAndBottom",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),F4=class extends t{constructor({name:B,description:U,title:G,id:Y}={name:"",description:"",title:""}){super("wp:docPr");e(this,"docPropertiesUniqueNumericId",oB());let Q={id:{key:"id",value:Y!==null&&Y!==void 0?Y:this.docPropertiesUniqueNumericId()},name:{key:"name",value:B}};if(U!==null&&U!==void 0)Q.description={key:"descr",value:U};if(G!==null&&G!==void 0)Q.title={key:"title",value:G};this.root.push(new $8(Q))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!0));break}return super.prepForXml(B)}},W4=({top:B,right:U,bottom:G,left:Y})=>new M0({name:"wp:effectExtent",attributes:{top:{key:"t",value:B},right:{key:"r",value:U},bottom:{key:"b",value:G},left:{key:"l",value:Y}}}),P4=({x:B,y:U})=>new M0({name:"wp:extent",attributes:{x:{key:"cx",value:B},y:{key:"cy",value:U}}}),zY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:a",noChangeAspect:"noChangeAspect"})}},EY=class extends t{constructor(){super("a:graphicFrameLocks");this.root.push(new zY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/main",noChangeAspect:1}))}},A4=()=>new M0({name:"wp:cNvGraphicFramePr",children:[new EY]}),DY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{distT:"distT",distB:"distB",distL:"distL",distR:"distR",allowOverlap:"allowOverlap",behindDoc:"behindDoc",layoutInCell:"layoutInCell",locked:"locked",relativeHeight:"relativeHeight",simplePos:"simplePos"})}},TY=class extends t{constructor({mediaData:B,transform:U,drawingOptions:G}){super("wp:anchor");let Y=L0({allowOverlap:!0,behindDocument:!1,lockAnchor:!1,layoutInCell:!0,verticalPosition:{},horizontalPosition:{}},G.floating);if(this.root.push(new DY({distT:Y.margins?Y.margins.top||0:0,distB:Y.margins?Y.margins.bottom||0:0,distL:Y.margins?Y.margins.left||0:0,distR:Y.margins?Y.margins.right||0:0,simplePos:"0",allowOverlap:Y.allowOverlap===!0?"1":"0",behindDoc:Y.behindDocument===!0?"1":"0",locked:Y.lockAnchor===!0?"1":"0",layoutInCell:Y.layoutInCell===!0?"1":"0",relativeHeight:Y.zIndex?Y.zIndex:U.emus.y})),this.root.push(G4()),this.root.push(Q4(Y.horizontalPosition)),this.root.push(J4(Y.verticalPosition)),this.root.push(P4({x:U.emus.x,y:U.emus.y})),this.root.push(W4({top:0,right:0,bottom:0,left:0})),G.floating!==void 0&&G.floating.wrap!==void 0)switch(G.floating.wrap.type){case e2.SQUARE:this.root.push(I4(G.floating.wrap,G.floating.margins));break;case e2.TIGHT:this.root.push(O4(G.floating.margins));break;case e2.TOP_AND_BOTTOM:this.root.push(H4(G.floating.margins));break;case e2.NONE:default:this.root.push(j8())}else this.root.push(j8());this.root.push(new F4(G.docProperties)),this.root.push(A4()),this.root.push(new R4({mediaData:B,transform:U,outline:G.outline,solidFill:G.solidFill}))}},CY=({mediaData:B,transform:U,docProperties:G,outline:Y,solidFill:Q})=>{var K,Z,J,q;return new M0({name:"wp:inline",attributes:{distanceTop:{key:"distT",value:0},distanceBottom:{key:"distB",value:0},distanceLeft:{key:"distL",value:0},distanceRight:{key:"distR",value:0}},children:[P4({x:U.emus.x,y:U.emus.y}),W4(Y?{top:((K=Y.width)!==null&&K!==void 0?K:9525)*2,right:((Z=Y.width)!==null&&Z!==void 0?Z:9525)*2,bottom:((J=Y.width)!==null&&J!==void 0?J:9525)*2,left:((q=Y.width)!==null&&q!==void 0?q:9525)*2}:{top:0,right:0,bottom:0,left:0}),new F4(G),A4(),new R4({mediaData:B,transform:U,outline:Y,solidFill:Q})]})},m1=class extends t{constructor(B,U={}){super("w:drawing");if(!U.floating)this.root.push(CY({mediaData:B,transform:B.transformation,docProperties:U.docProperties,outline:U.outline,solidFill:U.solidFill}));else this.root.push(new TY({mediaData:B,transform:B.transformation,drawingOptions:U}))}},kY=(B)=>{let U=B.indexOf(";base64,"),G=U===-1?0:U+8;return new Uint8Array(atob(B.substring(G)).split("").map((Y)=>Y.charCodeAt(0)))},j4=(B)=>typeof B==="string"?kY(B):B,V8=(B,U)=>({data:j4(B.data),fileName:U,transformation:{pixels:{x:Math.round(B.transformation.width),y:Math.round(B.transformation.height)},emus:{x:Math.round(B.transformation.width*9525),y:Math.round(B.transformation.height*9525)},flip:B.transformation.flip,rotation:B.transformation.rotation?B.transformation.rotation*60000:void 0}}),$Y=class extends t{constructor(B){var U=(...Z)=>(super(...Z),e(this,"imageData",void 0),this);let G=`${P8(B.data)}.${B.type}`,Y=B.type==="svg"?L0(L0({type:B.type},V8(B,G)),{},{fallback:L0({type:B.fallback.type},V8(L0(L0({},B.fallback),{},{transformation:B.transformation}),`${P8(B.fallback.data)}.${B.fallback.type}`))}):L0({type:B.type},V8(B,G)),Q=new m1(Y,{floating:B.floating,docProperties:B.altText,outline:B.outline}),K=new D0({children:[Q]});if(B.insertion)U("w:ins"),this.root.push(new b0({id:B.insertion.id,author:B.insertion.author,date:B.insertion.date})),this.addChildElement(K);else if(B.deletion)U("w:del"),this.root.push(new b0({id:B.deletion.id,author:B.deletion.author,date:B.deletion.date})),this.addChildElement(K);else U("w:r"),this.root.push(new U2({})),this.root.push(Q);this.imageData=Y}prepForXml(B){if(B.file.Media.addImage(this.imageData.fileName,this.imageData),this.imageData.type==="svg")B.file.Media.addImage(this.imageData.fallback.fileName,this.imageData.fallback);return super.prepForXml(B)}},n8=(B)=>{var U,G,Y,Q,K,Z,J,q;return{offset:{pixels:{x:Math.round((U=(G=B.offset)===null||G===void 0?void 0:G.left)!==null&&U!==void 0?U:0),y:Math.round((Y=(Q=B.offset)===null||Q===void 0?void 0:Q.top)!==null&&Y!==void 0?Y:0)},emus:{x:Math.round(((K=(Z=B.offset)===null||Z===void 0?void 0:Z.left)!==null&&K!==void 0?K:0)*9525),y:Math.round(((J=(q=B.offset)===null||q===void 0?void 0:q.top)!==null&&J!==void 0?J:0)*9525)}},pixels:{x:Math.round(B.width),y:Math.round(B.height)},emus:{x:Math.round(B.width*9525),y:Math.round(B.height*9525)},flip:B.flip,rotation:B.rotation?B.rotation*60000:void 0}},SY=class extends D0{constructor(B){super({});e(this,"wpsShapeData",void 0),this.wpsShapeData={type:B.type,transformation:n8(B.transformation),data:L0({},B)};let U=new m1(this.wpsShapeData,{floating:B.floating,docProperties:B.altText,outline:B.outline,solidFill:B.solidFill});this.root.push(U)}},bY=class extends D0{constructor(B){super({});e(this,"wpgGroupData",void 0),e(this,"mediaDatas",void 0),this.wpgGroupData={type:B.type,transformation:n8(B.transformation),children:B.children};let U=new m1(this.wpgGroupData,{floating:B.floating,docProperties:B.altText});this.mediaDatas=B.children.filter((G)=>G.type!=="wps").map((G)=>G),this.root.push(U)}prepForXml(B){return this.mediaDatas.forEach((U)=>{if(B.file.Media.addImage(U.fileName,U),U.type==="svg")B.file.Media.addImage(U.fallback.fileName,U.fallback)}),super.prepForXml(B)}},vY=class extends t{constructor(B){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(`SEQ ${B}`)}},yY=class extends D0{constructor(B){super({});this.root.push(e0(!0)),this.root.push(new vY(B)),this.root.push(X2()),this.root.push(B2())}},gY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{instr:"w:instr"})}},s8=class extends t{constructor(B,U){super("w:fldSimple");if(this.root.push(new gY({instr:B})),U!==void 0)this.root.push(new Q1(U))}},fY=class extends s8{constructor(B){super(` MERGEFIELD ${B} `,`«${B}»`)}},xY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},N4={EXTERNAL:"External"},_Y=(B,U,G,Y)=>new M0({name:"Relationship",attributes:{id:{key:"Id",value:B},type:{key:"Type",value:U},target:{key:"Target",value:G},targetMode:{key:"TargetMode",value:Y}}}),A2=class extends t{constructor(){super("Relationships");this.root.push(new xY({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(B,U,G,Y){this.root.push(_Y(`rId${B}`,U,G,Y))}get RelationshipCount(){return this.root.length-1}},hY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},o8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},uY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}},dY=class extends t{constructor(B){super("w:commentRangeStart");this.root.push(new o8({id:B}))}},cY=class extends t{constructor(B){super("w:commentRangeEnd");this.root.push(new o8({id:B}))}},mY=class extends t{constructor(B){super("w:commentReference");this.root.push(new o8({id:B}))}},N8=class extends t{constructor({id:B,initials:U,author:G,date:Y=new Date,children:Q},K){super("w:comment");e(this,"paraId",void 0),this.paraId=K,this.root.push(new hY({id:B,initials:U,author:G,date:Y.toISOString()}));for(let Z of Q)this.root.push(Z)}prepForXml(B){let U=super.prepForXml(B);if(!U||!this.paraId)return U;let G=U["w:comment"];if(!Array.isArray(G))return U;for(let Y=G.length-1;Y>=0;Y--){let Q=G[Y];if(Q&&typeof Q==="object"&&"w:p"in Q){let K=Q["w:p"];if(Array.isArray(K))K.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return U}},w4=(B)=>(B+1).toString(16).toUpperCase().padStart(8,"0"),z4=class extends t{constructor({children:B}){super("w:comments");if(e(this,"relationships",void 0),e(this,"threadData",void 0),this.root.push(new uY({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"})),B.some((U)=>U.parentId!==void 0)){let U=new Map(B.map((G)=>[G.id,w4(G.id)]));for(let G of B)this.root.push(new N8(G,U.get(G.id)));this.threadData=B.map((G)=>({paraId:U.get(G.id),parentParaId:G.parentId!==void 0?U.get(G.parentId):void 0,done:G.resolved}))}else for(let U of B)this.root.push(new N8(U));this.relationships=new A2}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}},lY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},aY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},pY=class extends t{constructor(B){super("w15:commentEx");this.root.push(new aY({paraId:B.paraId,paraIdParent:B.parentParaId,done:B.done!==void 0?B.done?"1":"0":void 0}))}},E4=class extends t{constructor(B){super("w15:commentsEx");this.root.push(new lY({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let U of B)this.root.push(new pY(U))}},rY=class extends S0{constructor(){super("w:noBreakHyphen")}},iY=class extends S0{constructor(){super("w:softHyphen")}},nY=class extends S0{constructor(){super("w:dayShort")}},sY=class extends S0{constructor(){super("w:monthShort")}},oY=class extends S0{constructor(){super("w:yearShort")}},tY=class extends S0{constructor(){super("w:dayLong")}},eY=class extends S0{constructor(){super("w:monthLong")}},BZ=class extends S0{constructor(){super("w:yearLong")}},UZ=class extends S0{constructor(){super("w:annotationRef")}},GZ=class extends S0{constructor(){super("w:footnoteRef")}},D4=class extends S0{constructor(){super("w:endnoteRef")}},YZ=class extends S0{constructor(){super("w:separator")}},ZZ=class extends S0{constructor(){super("w:continuationSeparator")}},QZ=class extends S0{constructor(){super("w:pgNum")}},JZ=class extends S0{constructor(){super("w:cr")}},T4=class extends S0{constructor(){super("w:tab")}},KZ=class extends S0{constructor(){super("w:lastRenderedPageBreak")}},VZ={LEFT:"left",CENTER:"center",RIGHT:"right"},XZ={MARGIN:"margin",INDENT:"indent"},qZ={NONE:"none",DOT:"dot",HYPHEN:"hyphen",UNDERSCORE:"underscore",MIDDLE_DOT:"middleDot"},MZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{alignment:"w:alignment",relativeTo:"w:relativeTo",leader:"w:leader"})}},RZ=class extends t{constructor(B){super("w:ptab");this.root.push(new MZ({alignment:B.alignment,relativeTo:B.relativeTo,leader:B.leader}))}},C4={COLUMN:"column",PAGE:"page"},k4=class extends t{constructor(B){super("w:br");this.root.push(new C0({type:B}))}},LZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.PAGE))}},IZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.COLUMN))}},$4=class extends t{constructor(){super("w:pageBreakBefore")}},k2={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},S4=({after:B,before:U,line:G,lineRule:Y,beforeAutoSpacing:Q,afterAutoSpacing:K})=>new M0({name:"w:spacing",attributes:{after:{key:"w:after",value:B},before:{key:"w:before",value:U},line:{key:"w:line",value:G},lineRule:{key:"w:lineRule",value:Y},beforeAutoSpacing:{key:"w:beforeAutospacing",value:Q},afterAutoSpacing:{key:"w:afterAutospacing",value:K}}}),OZ={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},x2=(B)=>new M0({name:"w:pStyle",attributes:{val:{key:"w:val",value:B}}}),w8={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},HZ={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},FZ={MAX:9026},b4=({type:B,position:U,leader:G})=>new M0({name:"w:tab",attributes:{val:{key:"w:val",value:B},pos:{key:"w:pos",value:U},leader:{key:"w:leader",value:G}}}),v4=(B)=>new M0({name:"w:tabs",children:B.map((U)=>b4(U))}),C1=class extends t{constructor(B,U){super("w:numPr");this.root.push(new WZ(U)),this.root.push(new PZ(B))}},WZ=class extends t{constructor(B){super("w:ilvl");if(B>9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new C0({val:B}))}},PZ=class extends t{constructor(B){super("w:numId");this.root.push(new C0({val:typeof B==="string"?`{${B}}`:B}))}},H1=class extends t{constructor(...B){super(...B);e(this,"fileChild",Symbol())}},AZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},jZ={INTERNAL:"INTERNAL",EXTERNAL:"EXTERNAL"},m2=class extends t{constructor(B,U,G){super("w:hyperlink");e(this,"linkId",void 0),this.linkId=U;let Y=new AZ({history:1,anchor:G?G:void 0,id:!G?`rId${this.linkId}`:void 0});this.root.push(Y),B.forEach((Q)=>{this.root.push(Q)})}},y4=class extends m2{constructor(B){super(B.children,O1(),B.anchor)}},t8=class extends t{constructor(B){super("w:externalHyperlink");e(this,"options",void 0),this.options=B}},NZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",name:"w:name"})}},wZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},g4=class{constructor(B){e(this,"bookmarkUniqueNumericId",tB()),e(this,"start",void 0),e(this,"children",void 0),e(this,"end",void 0);let U=this.bookmarkUniqueNumericId();this.start=new f4(B.id,U),this.children=B.children,this.end=new x4(U)}},f4=class extends t{constructor(B,U){super("w:bookmarkStart");let G=new NZ({name:B,id:U});this.root.push(G)}},x4=class extends t{constructor(B){super("w:bookmarkEnd");let U=new wZ({id:B});this.root.push(U)}},zZ=function(B){return B.NONE="none",B.RELATIVE="relative",B.NO_CONTEXT="no_context",B.FULL_CONTEXT="full_context",B}({}),EZ={["relative"]:"\\r",["no_context"]:"\\n",["full_context"]:"\\w",["none"]:void 0},DZ=class extends s8{constructor(B,U,G={}){let{hyperlink:Y=!0,referenceFormat:Q="full_context"}=G,K=`${`REF ${B}`} ${[...Y?["\\h"]:[],...[EZ[Q]].filter((Z)=>!!Z)].join(" ")}`;super(K,U)}},_4=(B)=>new M0({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:B}}}),TZ=class extends t{constructor(B,U={}){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE}));let G=`PAGEREF ${B}`;if(U.hyperlink)G=`${G} \\h`;if(U.useRelativePosition)G=`${G} \\p`;this.root.push(G)}},CZ=class extends D0{constructor(B,U={}){super({children:[e0(!0),new TZ(B,U),B2()]})}},kZ={ANSI:"00",DEFAULT:"01",SYMBOL:"02",MAC:"4D",JIS:"80",HANGUL:"81",JOHAB:"82",GB_2312:"86",CHINESEBIG5:"88",GREEK:"A1",TURKISH:"A2",VIETNAMESE:"A3",HEBREW:"B1",ARABIC:"B2",BALTIC:"BA",RUSSIAN:"CC",THAI:"DE",EASTEUROPE:"EE",OEM:"FF"},E1=({id:B,fontKey:U,subsetted:G},Y)=>new M0({name:Y,attributes:L0({id:{key:"r:id",value:B}},U?{fontKey:{key:"w:fontKey",value:`{${U}}`}}:{}),children:[...G?[new q0("w:subsetted",G)]:[]]}),$Z=({name:B,altName:U,panose1:G,charset:Y,family:Q,notTrueType:K,pitch:Z,sig:J,embedRegular:q,embedBold:W,embedItalic:I,embedBoldItalic:H})=>new M0({name:"w:font",attributes:{name:{key:"w:name",value:B}},children:[...U?[f2("w:altName",U)]:[],...G?[f2("w:panose1",G)]:[],...Y?[f2("w:charset",Y)]:[],...Q?[f2("w:family",Q)]:[],...K?[new q0("w:notTrueType",K)]:[],...Z?[f2("w:pitch",Z)]:[],...J?[new M0({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:J.usb0},usb1:{key:"w:usb1",value:J.usb1},usb2:{key:"w:usb2",value:J.usb2},usb3:{key:"w:usb3",value:J.usb3},csb0:{key:"w:csb0",value:J.csb0},csb1:{key:"w:csb1",value:J.csb1}}})]:[],...q?[E1(q,"w:embedRegular")]:[],...W?[E1(W,"w:embedBold")]:[],...I?[E1(I,"w:embedItalic")]:[],...H?[E1(H,"w:embedBoldItalic")]:[]]}),SZ=({name:B,index:U,fontKey:G,characterSet:Y})=>$Z({name:B,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:Y,family:"auto",pitch:"variable",embedRegular:{fontKey:G,id:`rId${U}`}}),bZ=(B)=>new M0({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:B.map((U,G)=>SZ({name:U.name,index:G+1,fontKey:U.fontKey,characterSet:U.characterSet}))}),h4=class{constructor(B){e(this,"options",void 0),e(this,"fontTable",void 0),e(this,"relationships",void 0),e(this,"fontOptionsWithKey",[]),this.options=B,this.fontOptionsWithKey=B.map((U)=>L0(L0({},U),{},{fontKey:eB()})),this.fontTable=bZ(this.fontOptionsWithKey),this.relationships=new A2;for(let U=0;Unew M0({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),yZ={NONE:"none",DROP:"drop",MARGIN:"margin"},gZ={MARGIN:"margin",PAGE:"page",TEXT:"text"},fZ={AROUND:"around",AUTO:"auto",NONE:"none",NOT_BESIDE:"notBeside",THROUGH:"through",TIGHT:"tight"},u4=(B)=>{var U,G;return new M0({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:B.anchorLock},dropCap:{key:"w:dropCap",value:B.dropCap},width:{key:"w:w",value:B.width},height:{key:"w:h",value:B.height},x:{key:"w:x",value:B.position?B.position.x:void 0},y:{key:"w:y",value:B.position?B.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:B.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:B.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(U=B.space)===null||U===void 0?void 0:U.horizontal},spaceVertical:{key:"w:vSpace",value:(G=B.space)===null||G===void 0?void 0:G.vertical},rule:{key:"w:hRule",value:B.rule},alignmentX:{key:"w:xAlign",value:B.alignment?B.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:B.alignment?B.alignment.y:void 0},lines:{key:"w:lines",value:B.lines},wrap:{key:"w:wrap",value:B.wrap}}})},M2=class extends R2{constructor(B){super("w:pPr",B===null||B===void 0?void 0:B.includeIfEmpty);if(e(this,"numberingReferences",[]),!B)return this;if(B.heading)this.push(x2(B.heading));if(B.bullet)this.push(x2("ListParagraph"));if(B.numbering){if(!B.style&&!B.heading){if(!B.numbering.custom)this.push(x2("ListParagraph"))}}if(B.style)this.push(x2(B.style));if(B.keepNext!==void 0)this.push(new q0("w:keepNext",B.keepNext));if(B.keepLines!==void 0)this.push(new q0("w:keepLines",B.keepLines));if(B.pageBreakBefore)this.push(new $4);if(B.frame)this.push(u4(B.frame));if(B.widowControl!==void 0)this.push(new q0("w:widowControl",B.widowControl));if(B.bullet)this.push(new C1(1,B.bullet.level));if(B.numbering){var U,G;this.numberingReferences.push({reference:B.numbering.reference,instance:(U=B.numbering.instance)!==null&&U!==void 0?U:0}),this.push(new C1(`${B.numbering.reference}-${(G=B.numbering.instance)!==null&&G!==void 0?G:0}`,B.numbering.level))}else if(B.numbering===!1)this.push(new C1(0,0));if(B.border)this.push(new xB(B.border));if(B.thematicBreak)this.push(new _B);if(B.shading)this.push(M1(B.shading));if(B.wordWrap)this.push(vZ());if(B.overflowPunctuation)this.push(new q0("w:overflowPunct",B.overflowPunctuation));let Y=[...B.rightTabStop!==void 0?[{type:w8.RIGHT,position:B.rightTabStop}]:[],...B.tabStops?B.tabStops:[],...B.leftTabStop!==void 0?[{type:w8.LEFT,position:B.leftTabStop}]:[]];if(Y.length>0)this.push(v4(Y));if(B.bidirectional!==void 0)this.push(new q0("w:bidi",B.bidirectional));if(B.spacing)this.push(S4(B.spacing));if(B.indent)this.push(hB(B.indent));if(B.contextualSpacing!==void 0)this.push(new q0("w:contextualSpacing",B.contextualSpacing));if(B.alignment)this.push(m8(B.alignment));if(B.outlineLevel!==void 0)this.push(_4(B.outlineLevel));if(B.suppressLineNumbers!==void 0)this.push(new q0("w:suppressLineNumbers",B.suppressLineNumbers));if(B.autoSpaceEastAsianText!==void 0)this.push(new q0("w:autoSpaceDN",B.autoSpaceEastAsianText));if(B.run)this.push(new mB(B.run));if(B.revision)this.push(new d4(B.revision))}push(B){this.root.push(B)}prepForXml(B){if(!(B.viewWrapper instanceof h4))for(let U of this.numberingReferences)B.file.Numbering.createConcreteNumberingInstance(U.reference,U.instance);return super.prepForXml(B)}},d4=class extends t{constructor(B){super("w:pPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new M2(L0(L0({},B),{},{includeIfEmpty:!0})))}},d0=class extends H1{constructor(B){super("w:p");if(e(this,"properties",void 0),typeof B==="string")return this.properties=new M2({}),this.root.push(this.properties),this.root.push(new Q1(B)),this;if(this.properties=new M2(B),this.root.push(this.properties),B.text)this.root.push(new Q1(B.text));if(B.children)for(let U of B.children){if(U instanceof g4){this.root.push(U.start);for(let G of U.children)this.root.push(G);this.root.push(U.end);continue}this.root.push(U)}}prepForXml(B){for(let U of this.root)if(U instanceof t8){let G=this.root.indexOf(U),Y=new m2(U.options.children,O1());B.viewWrapper.Relationships.addRelationship(Y.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",U.options.link,N4.EXTERNAL),this.root[G]=Y}return super.prepForXml(B)}addRunToFront(B){return this.root.splice(1,0,B),this}},xZ=class extends t{constructor(B){super("m:oMath");for(let U of B.children)this.root.push(U)}},_Z=class extends t{constructor(B){super("m:t");this.root.push(B)}},hZ=class extends t{constructor(B){super("m:r");this.root.push(new _Z(B))}},c4=class extends t{constructor(B){super("m:den");for(let U of B)this.root.push(U)}},m4=class extends t{constructor(B){super("m:num");for(let U of B)this.root.push(U)}},uZ=class extends t{constructor(B){super("m:f");this.root.push(new m4(B.numerator)),this.root.push(new c4(B.denominator))}},l4=({accent:B})=>new M0({name:"m:chr",attributes:{accent:{key:"m:val",value:B}}}),y0=({children:B})=>new M0({name:"m:e",children:B}),a4=({value:B})=>new M0({name:"m:limLoc",attributes:{value:{key:"m:val",value:B||"undOvr"}}}),dZ=()=>new M0({name:"m:subHide",attributes:{hide:{key:"m:val",value:1}}}),cZ=()=>new M0({name:"m:supHide",attributes:{hide:{key:"m:val",value:1}}}),e8=({accent:B,hasSuperScript:U,hasSubScript:G,limitLocationVal:Y})=>new M0({name:"m:naryPr",children:[...B?[l4({accent:B})]:[],a4({value:Y}),...!U?[cZ()]:[],...!G?[dZ()]:[]]}),l2=({children:B})=>new M0({name:"m:sub",children:B}),a2=({children:B})=>new M0({name:"m:sup",children:B}),mZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"∑",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},lZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript,limitLocationVal:"subSup"})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},B6=class extends t{constructor(B){super("m:lim");for(let U of B)this.root.push(U)}},aZ=class extends t{constructor(B){super("m:limUpp");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},pZ=class extends t{constructor(B){super("m:limLow");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},p4=()=>new M0({name:"m:sSupPr"}),rZ=class extends t{constructor(B){super("m:sSup");this.root.push(p4()),this.root.push(y0({children:B.children})),this.root.push(a2({children:B.superScript}))}},r4=()=>new M0({name:"m:sSubPr"}),iZ=class extends t{constructor(B){super("m:sSub");this.root.push(r4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript}))}},i4=()=>new M0({name:"m:sSubSupPr"}),nZ=class extends t{constructor(B){super("m:sSubSup");this.root.push(i4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript})),this.root.push(a2({children:B.superScript}))}},n4=()=>new M0({name:"m:sPrePr"}),sZ=class extends M0{constructor({children:B,subScript:U,superScript:G}){super({name:"m:sPre",children:[n4(),y0({children:B}),l2({children:U}),a2({children:G})]})}},oZ="",s4=class extends t{constructor(B){super("m:deg");if(B)for(let U of B)this.root.push(U)}},tZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{hide:"m:val"})}},eZ=class extends t{constructor(){super("m:degHide");this.root.push(new tZ({hide:1}))}},o4=class extends t{constructor(B){super("m:radPr");if(!B)this.root.push(new eZ)}},BQ=class extends t{constructor(B){super("m:rad");this.root.push(new o4(!!B.degree)),this.root.push(new s4(B.degree)),this.root.push(y0({children:B.children}))}},t4=class extends t{constructor(B){super("m:fName");for(let U of B)this.root.push(U)}},e4=class extends t{constructor(){super("m:funcPr")}},UQ=class extends t{constructor(B){super("m:func");this.root.push(new e4),this.root.push(new t4(B.name)),this.root.push(y0({children:B.children}))}},GQ=({character:B})=>new M0({name:"m:begChr",attributes:{character:{key:"m:val",value:B}}}),YQ=({character:B})=>new M0({name:"m:endChr",attributes:{character:{key:"m:val",value:B}}}),l1=({characters:B})=>new M0({name:"m:dPr",children:B?[GQ({character:B.beginningCharacter}),YQ({character:B.endingCharacter})]:[]}),ZQ=class extends t{constructor(B){super("m:d");this.root.push(l1({})),this.root.push(y0({children:B.children}))}},QQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"[",endingCharacter:"]"}})),this.root.push(y0({children:B.children}))}},JQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"{",endingCharacter:"}"}})),this.root.push(y0({children:B.children}))}},KQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"〈",endingCharacter:"〉"}})),this.root.push(y0({children:B.children}))}},VQ=(B)=>new M0({name:"w:gridCol",attributes:B!==void 0?{width:{key:"w:w",value:E0(B)}}:void 0}),B9=class extends t{constructor(B,U){super("w:tblGrid");for(let G of B)this.root.push(VQ(G));if(U)this.root.push(new qQ(U))}},XQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},qQ=class extends t{constructor(B){super("w:tblGridChange");this.root.push(new XQ({id:B.id})),this.root.push(new B9(B.columnWidths))}},MQ=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new Q1(B))}},RQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},LQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},IQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},p6=class extends t{constructor(B){super("w:delText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B)}},OQ=class extends t{constructor(B){super("w:del");e(this,"deletedTextRunWrapper",void 0),this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.deletedTextRunWrapper=new HQ(B),this.addChildElement(this.deletedTextRunWrapper)}},HQ=class extends t{constructor(B){super("w:r");if(this.root.push(new U2(B)),B.children)for(let U of B.children){if(typeof U==="string"){switch(U){case F2.CURRENT:this.root.push(e0()),this.root.push(new RQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES:this.root.push(e0()),this.root.push(new LQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES_IN_SECTION:this.root.push(e0()),this.root.push(new IQ),this.root.push(X2()),this.root.push(B2());break;default:this.root.push(new p6(U));break}continue}this.root.push(U)}else if(B.text)this.root.push(new p6(B.text));if(B.break)for(let U=0;Unew M0({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:B}}}),X9=({marginUnitType:B=v1.DXA,top:U,left:G,bottom:Y,right:Q})=>[{name:"w:top",size:U},{name:"w:left",size:G},{name:"w:bottom",size:Y},{name:"w:right",size:Q}].filter((K)=>K.size!==void 0).map(({name:K,size:Z})=>J1(K,{type:B,size:Z})),PQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tblCellMar",children:U})},AQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tcMar",children:U})},v1={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},J1=(B,{type:U=v1.AUTO,size:G})=>{let Y=G;if(U===v1.PERCENTAGE&&typeof G==="number")Y=`${G}%`;return new M0({name:B,attributes:{type:{key:"w:type",value:U},size:{key:"w:w",value:c8(Y)}}})},q9=class extends R2{constructor(B){super("w:tcBorders");if(B.top)this.root.push(j0("w:top",B.top));if(B.start)this.root.push(j0("w:start",B.start));if(B.left)this.root.push(j0("w:left",B.left));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.end)this.root.push(j0("w:end",B.end));if(B.right)this.root.push(j0("w:right",B.right))}},jQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},M9=class extends t{constructor(B){super("w:gridSpan");this.root.push(new jQ({val:T0(B)}))}},G6={CONTINUE:"continue",RESTART:"restart"},NQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},z8=class extends t{constructor(B){super("w:vMerge");this.root.push(new NQ({val:B}))}},wQ={BOTTOM_TO_TOP_LEFT_TO_RIGHT:"btLr",LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},zQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},R9=class extends t{constructor(B){super("w:textDirection");this.root.push(new zQ({val:B}))}},L9=class extends R2{constructor(B){super("w:tcPr",B.includeIfEmpty);if(B.width)this.root.push(J1("w:tcW",B.width));if(B.columnSpan)this.root.push(new M9(B.columnSpan));if(B.verticalMerge)this.root.push(new z8(B.verticalMerge));else if(B.rowSpan&&B.rowSpan>1)this.root.push(new z8(G6.RESTART));if(B.borders)this.root.push(new q9(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.margins){let U=AQ(B.margins);if(U)this.root.push(U)}if(B.textDirection)this.root.push(new R9(B.textDirection));if(B.verticalAlign)this.root.push(U6(B.verticalAlign));if(B.insertion)this.root.push(new Y9(B.insertion));if(B.deletion)this.root.push(new Z9(B.deletion));if(B.revision)this.root.push(new EQ(B.revision));if(B.cellMerge)this.root.push(new J9(B.cellMerge))}},EQ=class extends t{constructor(B){super("w:tcPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new L9(L0(L0({},B),{},{includeIfEmpty:!0})))}},Y6=class extends t{constructor(B){super("w:tc");e(this,"options",void 0),this.options=B,this.root.push(new L9(B));for(let U of B.children)this.root.push(U)}prepForXml(B){if(!(this.root[this.root.length-1]instanceof d0))this.root.push(new d0({}));return super.prepForXml(B)}},v2={style:c1.NONE,size:0,color:"auto"},y2={style:c1.SINGLE,size:4,color:"auto"},Z6=class extends t{constructor(B){var U,G,Y,Q,K,Z;super("w:tblBorders");this.root.push(j0("w:top",(U=B.top)!==null&&U!==void 0?U:y2)),this.root.push(j0("w:left",(G=B.left)!==null&&G!==void 0?G:y2)),this.root.push(j0("w:bottom",(Y=B.bottom)!==null&&Y!==void 0?Y:y2)),this.root.push(j0("w:right",(Q=B.right)!==null&&Q!==void 0?Q:y2)),this.root.push(j0("w:insideH",(K=B.insideHorizontal)!==null&&K!==void 0?K:y2)),this.root.push(j0("w:insideV",(Z=B.insideVertical)!==null&&Z!==void 0?Z:y2))}};e(Z6,"NONE",{top:v2,bottom:v2,left:v2,right:v2,insideHorizontal:v2,insideVertical:v2});var DQ={MARGIN:"margin",PAGE:"page",TEXT:"text"},TQ={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},CQ={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},kQ={NEVER:"never",OVERLAP:"overlap"},$Q=(B)=>new M0({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:B}}}),I9=({horizontalAnchor:B,verticalAnchor:U,absoluteHorizontalPosition:G,relativeHorizontalPosition:Y,absoluteVerticalPosition:Q,relativeVerticalPosition:K,bottomFromText:Z,topFromText:J,leftFromText:q,rightFromText:W,overlap:I})=>new M0({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:q===void 0?void 0:E0(q)},rightFromText:{key:"w:rightFromText",value:W===void 0?void 0:E0(W)},topFromText:{key:"w:topFromText",value:J===void 0?void 0:E0(J)},bottomFromText:{key:"w:bottomFromText",value:Z===void 0?void 0:E0(Z)},absoluteHorizontalPosition:{key:"w:tblpX",value:G===void 0?void 0:t0(G)},absoluteVerticalPosition:{key:"w:tblpY",value:Q===void 0?void 0:t0(Q)},horizontalAnchor:{key:"w:horzAnchor",value:B},relativeHorizontalPosition:{key:"w:tblpXSpec",value:Y},relativeVerticalPosition:{key:"w:tblpYSpec",value:K},verticalAnchor:{key:"w:vertAnchor",value:U}},children:I?[$Q(I)]:void 0}),SQ={AUTOFIT:"autofit",FIXED:"fixed"},O9=(B)=>new M0({name:"w:tblLayout",attributes:{type:{key:"w:type",value:B}}}),bQ={DXA:"dxa",NIL:"nil"},H9=({type:B=bQ.DXA,value:U})=>new M0({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:B},value:{key:"w:w",value:c8(U)}}}),F9=({firstRow:B,lastRow:U,firstColumn:G,lastColumn:Y,noHBand:Q,noVBand:K})=>new M0({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:B},lastRow:{key:"w:lastRow",value:U},firstColumn:{key:"w:firstColumn",value:G},lastColumn:{key:"w:lastColumn",value:Y},noHBand:{key:"w:noHBand",value:Q},noVBand:{key:"w:noVBand",value:K}}}),Q6=class extends R2{constructor(B){super("w:tblPr",B.includeIfEmpty);if(B.style)this.root.push(new q2("w:tblStyle",B.style));if(B.float)this.root.push(I9(B.float));if(B.visuallyRightToLeft!==void 0)this.root.push(new q0("w:bidiVisual",B.visuallyRightToLeft));if(B.width)this.root.push(J1("w:tblW",B.width));if(B.alignment)this.root.push(m8(B.alignment));if(B.indent)this.root.push(J1("w:tblInd",B.indent));if(B.borders)this.root.push(new Z6(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.layout)this.root.push(O9(B.layout));if(B.cellMargin){let U=PQ(B.cellMargin);if(U)this.root.push(U)}if(B.tableLook)this.root.push(F9(B.tableLook));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.revision)this.root.push(new vQ(B.revision))}},vQ=class extends t{constructor(B){super("w:tblPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new Q6(L0(L0({},B),{},{includeIfEmpty:!0})))}},yQ=class extends H1{constructor({rows:B,width:U,columnWidths:G=Array(Math.max(...B.map((j)=>j.CellCount))).fill(100),columnWidthsRevision:Y,margins:Q,indent:K,float:Z,layout:J,style:q,borders:W,alignment:I,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P}){super("w:tbl");this.root.push(new Q6({borders:W!==null&&W!==void 0?W:{},width:U!==null&&U!==void 0?U:{size:100},indent:K,float:Z,layout:J,style:q,alignment:I,cellMargin:Q,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P})),this.root.push(new B9(G,Y));for(let j of B)this.root.push(j);B.forEach((j,E)=>{if(E===B.length-1)return;let C=0;j.cells.forEach((N)=>{if(N.options.rowSpan&&N.options.rowSpan>1){let v=new Y6({rowSpan:N.options.rowSpan-1,columnSpan:N.options.columnSpan,borders:N.options.borders,children:[],verticalMerge:G6.CONTINUE});B[E+1].addCellToColumnIndex(v,C)}C+=N.options.columnSpan||1})})}},gQ={AUTO:"auto",ATLEAST:"atLeast",EXACT:"exact"},W9=(B,U)=>new M0({name:"w:trHeight",attributes:{value:{key:"w:val",value:E0(B)},rule:{key:"w:hRule",value:U}}}),J6=class extends R2{constructor(B){super("w:trPr",B.includeIfEmpty);if(B.cantSplit!==void 0)this.root.push(new q0("w:cantSplit",B.cantSplit));if(B.tableHeader!==void 0)this.root.push(new q0("w:tblHeader",B.tableHeader));if(B.height)this.root.push(W9(B.height.value,B.height.rule));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.insertion)this.root.push(new U9(B.insertion));if(B.deletion)this.root.push(new G9(B.deletion));if(B.revision)this.root.push(new P9(B.revision))}},P9=class extends t{constructor(B){super("w:trPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new J6(L0(L0({},B),{},{includeIfEmpty:!0})))}},fQ=class extends t{constructor(B){super("w:tr");e(this,"options",void 0),this.options=B,this.root.push(new J6(B));for(let U of B.children)this.root.push(U)}get CellCount(){return this.options.children.length}get cells(){return this.root.filter((B)=>B instanceof Y6)}addCellToIndex(B,U){this.root.splice(U+1,0,B)}addCellToColumnIndex(B,U){let G=this.columnIndexToRootIndex(U,!0);this.addCellToIndex(B,G-1)}rootIndexToColumnIndex(B){if(B<1||B>=this.root.length)throw Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let U=0;for(let G=1;G=this.root.length)if(U)return this.root.length;else throw Error(`cell 'columnIndex' should not great than ${G-1}`);let Q=this.root[Y];Y+=1,G+=Q&&Q.options.columnSpan||1}return Y-1}},xQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},_Q=class extends t{constructor(){super("Properties");this.root.push(new xQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},hQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},V2=(B,U)=>new M0({name:"Default",attributes:{contentType:{key:"ContentType",value:B},extension:{key:"Extension",value:U}}}),f0=(B,U)=>new M0({name:"Override",attributes:{contentType:{key:"ContentType",value:B},partName:{key:"PartName",value:U}}}),uQ=class extends t{constructor(){super("Types");this.root.push(new hQ({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(V2("image/png","png")),this.root.push(V2("image/jpeg","jpeg")),this.root.push(V2("image/jpeg","jpg")),this.root.push(V2("image/bmp","bmp")),this.root.push(V2("image/gif","gif")),this.root.push(V2("image/svg+xml","svg")),this.root.push(V2("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(V2("application/xml","xml")),this.root.push(V2("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(f0("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addCommentsExtended(){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addFooter(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${B}.xml`))}addHeader(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${B}.xml`))}},y1={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},F1=class extends H0{constructor(B,U){super(L0({Ignorable:U},Object.fromEntries(B.map((G)=>[G,y1[G]]))));e(this,"xmlKeys",L0({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(y1).map((G)=>[G,`xmlns:${G}`]))))}},dQ=class extends t{constructor(B){super("cp:coreProperties");if(this.root.push(new F1(["cp","dc","dcterms","dcmitype","xsi"])),B.title)this.root.push(new O2("dc:title",B.title));if(B.subject)this.root.push(new O2("dc:subject",B.subject));if(B.creator)this.root.push(new O2("dc:creator",B.creator));if(B.keywords)this.root.push(new O2("cp:keywords",B.keywords));if(B.description)this.root.push(new O2("dc:description",B.description));if(B.lastModifiedBy)this.root.push(new O2("cp:lastModifiedBy",B.lastModifiedBy));if(B.revision)this.root.push(new O2("cp:revision",String(B.revision)));this.root.push(new r6("dcterms:created")),this.root.push(new r6("dcterms:modified"))}},cQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"xsi:type"})}},r6=class extends t{constructor(B){super(B);this.root.push(new cQ({type:"dcterms:W3CDTF"})),this.root.push(fB(new Date))}},mQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},lQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},aQ=class extends t{constructor(B,U){super("property");this.root.push(new lQ({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:B.toString(),name:U.name})),this.root.push(new pQ(U.value))}},pQ=class extends t{constructor(B){super("vt:lpwstr");this.root.push(B)}},rQ=class extends t{constructor(B){super("Properties");e(this,"nextId",void 0),e(this,"properties",[]),this.root.push(new mQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let U of B)this.addCustomProperty(U)}prepForXml(B){return this.properties.forEach((U)=>this.root.push(U)),super.prepForXml(B)}addCustomProperty(B){this.properties.push(new aQ(this.nextId++,B))}},A9=({space:B,count:U,separate:G,equalWidth:Y,children:Q})=>new M0({name:"w:cols",attributes:{space:{key:"w:space",value:B===void 0?void 0:E0(B)},count:{key:"w:num",value:U===void 0?void 0:T0(U)},separate:{key:"w:sep",value:G},equalWidth:{key:"w:equalWidth",value:Y}},children:!Y&&Q?Q:void 0}),iQ={DEFAULT:"default",LINES:"lines",LINES_AND_CHARS:"linesAndChars",SNAP_TO_CHARS:"snapToChars"},j9=({type:B,linePitch:U,charSpace:G})=>new M0({name:"w:docGrid",attributes:{type:{key:"w:type",value:B},linePitch:{key:"w:linePitch",value:T0(U)},charSpace:{key:"w:charSpace",value:G?T0(G):void 0}}}),T2={DEFAULT:"default",FIRST:"first",EVEN:"even"},E8={HEADER:"w:headerReference",FOOTER:"w:footerReference"},k1=(B,U)=>new M0({name:B,attributes:{type:{key:"w:type",value:U.type||T2.DEFAULT},id:{key:"r:id",value:`rId${U.id}`}}}),nQ={NEW_PAGE:"newPage",NEW_SECTION:"newSection",CONTINUOUS:"continuous"},N9=({countBy:B,start:U,restart:G,distance:Y})=>new M0({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:B===void 0?void 0:T0(B)},start:{key:"w:start",value:U===void 0?void 0:T0(U)},restart:{key:"w:restart",value:G},distance:{key:"w:distance",value:Y===void 0?void 0:E0(Y)}}}),sQ={ALL_PAGES:"allPages",FIRST_PAGE:"firstPage",NOT_FIRST_PAGE:"notFirstPage"},oQ={PAGE:"page",TEXT:"text"},tQ={BACK:"back",FRONT:"front"},i6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},w9=class extends R2{constructor(B){super("w:pgBorders");if(!B)return this;if(B.pageBorders)this.root.push(new i6({display:B.pageBorders.display,offsetFrom:B.pageBorders.offsetFrom,zOrder:B.pageBorders.zOrder}));else this.root.push(new i6({}));if(B.pageBorderTop)this.root.push(j0("w:top",B.pageBorderTop));if(B.pageBorderLeft)this.root.push(j0("w:left",B.pageBorderLeft));if(B.pageBorderBottom)this.root.push(j0("w:bottom",B.pageBorderBottom));if(B.pageBorderRight)this.root.push(j0("w:right",B.pageBorderRight))}},z9=(B,U,G,Y,Q,K,Z)=>new M0({name:"w:pgMar",attributes:{top:{key:"w:top",value:t0(B)},right:{key:"w:right",value:E0(U)},bottom:{key:"w:bottom",value:t0(G)},left:{key:"w:left",value:E0(Y)},header:{key:"w:header",value:E0(Q)},footer:{key:"w:footer",value:E0(K)},gutter:{key:"w:gutter",value:E0(Z)}}}),eQ={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},E9=({start:B,formatType:U,separator:G})=>new M0({name:"w:pgNumType",attributes:{start:{key:"w:start",value:B===void 0?void 0:T0(B)},formatType:{key:"w:fmt",value:U},separator:{key:"w:chapSep",value:G}}}),g1={PORTRAIT:"portrait",LANDSCAPE:"landscape"},D9=({width:B,height:U,orientation:G,code:Y})=>{let Q=E0(B),K=E0(U);return new M0({name:"w:pgSz",attributes:{width:{key:"w:w",value:G===g1.LANDSCAPE?K:Q},height:{key:"w:h",value:G===g1.LANDSCAPE?Q:K},orientation:{key:"w:orient",value:G},code:{key:"w:code",value:Y}}})},BJ={LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},UJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},T9=class extends t{constructor(B){super("w:textDirection");this.root.push(new UJ({val:B}))}},GJ={NEXT_PAGE:"nextPage",NEXT_COLUMN:"nextColumn",CONTINUOUS:"continuous",EVEN_PAGE:"evenPage",ODD_PAGE:"oddPage"},C9=(B)=>new M0({name:"w:type",attributes:{val:{key:"w:val",value:B}}}),H2={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},$1={WIDTH:11906,HEIGHT:16838,ORIENTATION:g1.PORTRAIT},K6=class extends t{constructor({page:{size:{width:B=$1.WIDTH,height:U=$1.HEIGHT,orientation:G=$1.ORIENTATION,code:Y}={},margin:{top:Q=H2.TOP,right:K=H2.RIGHT,bottom:Z=H2.BOTTOM,left:J=H2.LEFT,header:q=H2.HEADER,footer:W=H2.FOOTER,gutter:I=H2.GUTTER}={},pageNumbers:H={},borders:T,textDirection:A}={},grid:{linePitch:P=360,charSpace:j,type:E}={},headerWrapperGroup:C={},footerWrapperGroup:N={},lineNumbers:v,titlePage:S,verticalAlign:F,column:M,type:$,revision:x}={}){super("w:sectPr");if(this.addHeaderFooterGroup(E8.HEADER,C),this.addHeaderFooterGroup(E8.FOOTER,N),$)this.root.push(C9($));if(this.root.push(D9({width:B,height:U,orientation:G,code:Y})),this.root.push(z9(Q,K,Z,J,q,W,I)),T)this.root.push(new w9(T));if(v)this.root.push(N9(v));if(this.root.push(E9(H)),M)this.root.push(A9(M));if(F)this.root.push(U6(F));if(S!==void 0)this.root.push(new q0("w:titlePg",S));if(A)this.root.push(new T9(A));if(x)this.root.push(new k9(x));this.root.push(j9({linePitch:P,charSpace:j,type:E}))}addHeaderFooterGroup(B,U){if(U.default)this.root.push(k1(B,{type:T2.DEFAULT,id:U.default.View.ReferenceId}));if(U.first)this.root.push(k1(B,{type:T2.FIRST,id:U.first.View.ReferenceId}));if(U.even)this.root.push(k1(B,{type:T2.EVEN,id:U.even.View.ReferenceId}))}},k9=class extends t{constructor(B){super("w:sectPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new K6(B))}},YJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{width:"w:w",space:"w:space"})}},ZJ=class extends t{constructor(B){super("w:col");this.root.push(new YJ({width:E0(B.width),space:B.space===void 0?void 0:E0(B.space)}))}},$9=class extends t{constructor(){super("w:body");e(this,"sections",[])}addSection(B){let U=this.sections.pop();this.root.push(this.createSectionParagraph(U)),this.sections.push(new K6(B))}prepForXml(B){if(this.sections.length===1)this.root.splice(0,1),this.root.push(this.sections.pop());return super.prepForXml(B)}push(B){this.root.push(B)}createSectionParagraph(B){let U=new d0({}),G=new M2({});return G.push(B),U.addChildElement(G),U}},S9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}},b9=class extends t{constructor(B){super("w:background");this.root.push(new S9({color:B.color===void 0?void 0:C2(B.color),themeColor:B.themeColor,themeShade:B.themeShade===void 0?void 0:W8(B.themeShade),themeTint:B.themeTint===void 0?void 0:W8(B.themeTint)}))}},QJ=class extends t{constructor(B){super("w:document");if(e(this,"body",void 0),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new $9,B.background)this.root.push(new b9(B.background));this.root.push(this.body)}add(B){return this.body.push(B),this}get Body(){return this.body}},JJ=class{constructor(B){e(this,"document",void 0),e(this,"relationships",void 0),this.document=new QJ(B),this.relationships=new A2}get View(){return this.document}get Relationships(){return this.relationships}},KJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},VJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",id:"w:id"})}},XJ=class extends D0{constructor(){super({style:"EndnoteReference"});this.root.push(new D4)}},n6={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},X8=class extends t{constructor(B){super("w:endnote");this.root.push(new VJ({type:B.type,id:B.id}));for(let U=0;U9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new wJ({ilvl:T0(B),tentative:1}))}},h9=class extends X6{},$J=class extends X6{},SJ=class extends t{constructor(B){super("w:multiLevelType");this.root.push(new C0({val:B}))}},bJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},D8=class extends t{constructor(B,U){super("w:abstractNum");e(this,"id",void 0),this.root.push(new bJ({abstractNumId:T0(B),restartNumberingAfterBreak:0})),this.root.push(new SJ("hybridMultilevel")),this.id=B;for(let G of U)this.root.push(new h9(G))}},vJ=class extends t{constructor(B){super("w:abstractNumId");this.root.push(new C0({val:B}))}},yJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{numId:"w:numId"})}},T8=class extends t{constructor(B){super("w:num");if(e(this,"numId",void 0),e(this,"reference",void 0),e(this,"instance",void 0),this.numId=B.numId,this.reference=B.reference,this.instance=B.instance,this.root.push(new yJ({numId:T0(B.numId)})),this.root.push(new vJ(T0(B.abstractNumId))),B.overrideLevels&&B.overrideLevels.length)for(let U of B.overrideLevels)this.root.push(new u9(U.num,U.start))}},gJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{ilvl:"w:ilvl"})}},u9=class extends t{constructor(B,U){super("w:lvlOverride");if(this.root.push(new gJ({ilvl:B})),U!==void 0)this.root.push(new xJ(U))}},fJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},xJ=class extends t{constructor(B){super("w:startOverride");this.root.push(new fJ({val:B}))}},d9=class extends t{constructor(B){super("w:numbering");e(this,"abstractNumberingMap",new Map),e(this,"concreteNumberingMap",new Map),e(this,"referenceConfigMap",new Map),e(this,"abstractNumUniqueNumericId",nB()),e(this,"concreteNumUniqueNumericId",sB()),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let U=new D8(this.abstractNumUniqueNumericId(),[{level:0,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(0.5),hanging:u0(0.25)}}}},{level:1,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(1),hanging:u0(0.25)}}}},{level:2,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:2160,hanging:u0(0.25)}}}},{level:3,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:2880,hanging:u0(0.25)}}}},{level:4,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:3600,hanging:u0(0.25)}}}},{level:5,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:4320,hanging:u0(0.25)}}}},{level:6,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5040,hanging:u0(0.25)}}}},{level:7,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5760,hanging:u0(0.25)}}}},{level:8,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:6480,hanging:u0(0.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new T8({numId:1,abstractNumId:U.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",U);for(let G of B.config)this.abstractNumberingMap.set(G.reference,new D8(this.abstractNumUniqueNumericId(),G.levels)),this.referenceConfigMap.set(G.reference,G.levels)}prepForXml(B){for(let U of this.abstractNumberingMap.values())this.root.push(U);for(let U of this.concreteNumberingMap.values())this.root.push(U);return super.prepForXml(B)}createConcreteNumberingInstance(B,U){let G=this.abstractNumberingMap.get(B);if(!G)return;let Y=`${B}-${U}`;if(this.concreteNumberingMap.has(Y))return;let Q=this.referenceConfigMap.get(B),K=Q&&Q[0].start,Z={numId:this.concreteNumUniqueNumericId(),abstractNumId:G.id,reference:B,instance:U,overrideLevels:[typeof K==="number"&&Number.isInteger(K)?{num:0,start:K}:{num:0,start:1}]};this.concreteNumberingMap.set(Y,new T8(Z))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},_J=(B)=>new M0({name:"w:compatSetting",attributes:{version:{key:"w:val",value:B},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),hJ=class extends t{constructor(B){super("w:compat");if(B.version)this.root.push(_J(B.version));if(B.useSingleBorderforContiguousCells)this.root.push(new q0("w:useSingleBorderforContiguousCells",B.useSingleBorderforContiguousCells));if(B.wordPerfectJustification)this.root.push(new q0("w:wpJustification",B.wordPerfectJustification));if(B.noTabStopForHangingIndent)this.root.push(new q0("w:noTabHangInd",B.noTabStopForHangingIndent));if(B.noLeading)this.root.push(new q0("w:noLeading",B.noLeading));if(B.spaceForUnderline)this.root.push(new q0("w:spaceForUL",B.spaceForUnderline));if(B.noColumnBalance)this.root.push(new q0("w:noColumnBalance",B.noColumnBalance));if(B.balanceSingleByteDoubleByteWidth)this.root.push(new q0("w:balanceSingleByteDoubleByteWidth",B.balanceSingleByteDoubleByteWidth));if(B.noExtraLineSpacing)this.root.push(new q0("w:noExtraLineSpacing",B.noExtraLineSpacing));if(B.doNotLeaveBackslashAlone)this.root.push(new q0("w:doNotLeaveBackslashAlone",B.doNotLeaveBackslashAlone));if(B.underlineTrailingSpaces)this.root.push(new q0("w:ulTrailSpace",B.underlineTrailingSpaces));if(B.doNotExpandShiftReturn)this.root.push(new q0("w:doNotExpandShiftReturn",B.doNotExpandShiftReturn));if(B.spacingInWholePoints)this.root.push(new q0("w:spacingInWholePoints",B.spacingInWholePoints));if(B.lineWrapLikeWord6)this.root.push(new q0("w:lineWrapLikeWord6",B.lineWrapLikeWord6));if(B.printBodyTextBeforeHeader)this.root.push(new q0("w:printBodyTextBeforeHeader",B.printBodyTextBeforeHeader));if(B.printColorsBlack)this.root.push(new q0("w:printColBlack",B.printColorsBlack));if(B.spaceWidth)this.root.push(new q0("w:wpSpaceWidth",B.spaceWidth));if(B.showBreaksInFrames)this.root.push(new q0("w:showBreaksInFrames",B.showBreaksInFrames));if(B.subFontBySize)this.root.push(new q0("w:subFontBySize",B.subFontBySize));if(B.suppressBottomSpacing)this.root.push(new q0("w:suppressBottomSpacing",B.suppressBottomSpacing));if(B.suppressTopSpacing)this.root.push(new q0("w:suppressTopSpacing",B.suppressTopSpacing));if(B.suppressSpacingAtTopOfPage)this.root.push(new q0("w:suppressSpacingAtTopOfPage",B.suppressSpacingAtTopOfPage));if(B.suppressTopSpacingWP)this.root.push(new q0("w:suppressTopSpacingWP",B.suppressTopSpacingWP));if(B.suppressSpBfAfterPgBrk)this.root.push(new q0("w:suppressSpBfAfterPgBrk",B.suppressSpBfAfterPgBrk));if(B.swapBordersFacingPages)this.root.push(new q0("w:swapBordersFacingPages",B.swapBordersFacingPages));if(B.convertMailMergeEsc)this.root.push(new q0("w:convMailMergeEsc",B.convertMailMergeEsc));if(B.truncateFontHeightsLikeWP6)this.root.push(new q0("w:truncateFontHeightsLikeWP6",B.truncateFontHeightsLikeWP6));if(B.macWordSmallCaps)this.root.push(new q0("w:mwSmallCaps",B.macWordSmallCaps));if(B.usePrinterMetrics)this.root.push(new q0("w:usePrinterMetrics",B.usePrinterMetrics));if(B.doNotSuppressParagraphBorders)this.root.push(new q0("w:doNotSuppressParagraphBorders",B.doNotSuppressParagraphBorders));if(B.wrapTrailSpaces)this.root.push(new q0("w:wrapTrailSpaces",B.wrapTrailSpaces));if(B.footnoteLayoutLikeWW8)this.root.push(new q0("w:footnoteLayoutLikeWW8",B.footnoteLayoutLikeWW8));if(B.shapeLayoutLikeWW8)this.root.push(new q0("w:shapeLayoutLikeWW8",B.shapeLayoutLikeWW8));if(B.alignTablesRowByRow)this.root.push(new q0("w:alignTablesRowByRow",B.alignTablesRowByRow));if(B.forgetLastTabAlignment)this.root.push(new q0("w:forgetLastTabAlignment",B.forgetLastTabAlignment));if(B.adjustLineHeightInTable)this.root.push(new q0("w:adjustLineHeightInTable",B.adjustLineHeightInTable));if(B.autoSpaceLikeWord95)this.root.push(new q0("w:autoSpaceLikeWord95",B.autoSpaceLikeWord95));if(B.noSpaceRaiseLower)this.root.push(new q0("w:noSpaceRaiseLower",B.noSpaceRaiseLower));if(B.doNotUseHTMLParagraphAutoSpacing)this.root.push(new q0("w:doNotUseHTMLParagraphAutoSpacing",B.doNotUseHTMLParagraphAutoSpacing));if(B.layoutRawTableWidth)this.root.push(new q0("w:layoutRawTableWidth",B.layoutRawTableWidth));if(B.layoutTableRowsApart)this.root.push(new q0("w:layoutTableRowsApart",B.layoutTableRowsApart));if(B.useWord97LineBreakRules)this.root.push(new q0("w:useWord97LineBreakRules",B.useWord97LineBreakRules));if(B.doNotBreakWrappedTables)this.root.push(new q0("w:doNotBreakWrappedTables",B.doNotBreakWrappedTables));if(B.doNotSnapToGridInCell)this.root.push(new q0("w:doNotSnapToGridInCell",B.doNotSnapToGridInCell));if(B.selectFieldWithFirstOrLastCharacter)this.root.push(new q0("w:selectFldWithFirstOrLastChar",B.selectFieldWithFirstOrLastCharacter));if(B.applyBreakingRules)this.root.push(new q0("w:applyBreakingRules",B.applyBreakingRules));if(B.doNotWrapTextWithPunctuation)this.root.push(new q0("w:doNotWrapTextWithPunct",B.doNotWrapTextWithPunctuation));if(B.doNotUseEastAsianBreakRules)this.root.push(new q0("w:doNotUseEastAsianBreakRules",B.doNotUseEastAsianBreakRules));if(B.useWord2002TableStyleRules)this.root.push(new q0("w:useWord2002TableStyleRules",B.useWord2002TableStyleRules));if(B.growAutofit)this.root.push(new q0("w:growAutofit",B.growAutofit));if(B.useFELayout)this.root.push(new q0("w:useFELayout",B.useFELayout));if(B.useNormalStyleForList)this.root.push(new q0("w:useNormalStyleForList",B.useNormalStyleForList));if(B.doNotUseIndentAsNumberingTabStop)this.root.push(new q0("w:doNotUseIndentAsNumberingTabStop",B.doNotUseIndentAsNumberingTabStop));if(B.useAlternateEastAsianLineBreakRules)this.root.push(new q0("w:useAltKinsokuLineBreakRules",B.useAlternateEastAsianLineBreakRules));if(B.allowSpaceOfSameStyleInTable)this.root.push(new q0("w:allowSpaceOfSameStyleInTable",B.allowSpaceOfSameStyleInTable));if(B.doNotSuppressIndentation)this.root.push(new q0("w:doNotSuppressIndentation",B.doNotSuppressIndentation));if(B.doNotAutofitConstrainedTables)this.root.push(new q0("w:doNotAutofitConstrainedTables",B.doNotAutofitConstrainedTables));if(B.autofitToFirstFixedWidthCell)this.root.push(new q0("w:autofitToFirstFixedWidthCell",B.autofitToFirstFixedWidthCell));if(B.underlineTabInNumberingList)this.root.push(new q0("w:underlineTabInNumList",B.underlineTabInNumberingList));if(B.displayHangulFixedWidth)this.root.push(new q0("w:displayHangulFixedWidth",B.displayHangulFixedWidth));if(B.splitPgBreakAndParaMark)this.root.push(new q0("w:splitPgBreakAndParaMark",B.splitPgBreakAndParaMark));if(B.doNotVerticallyAlignCellWithSp)this.root.push(new q0("w:doNotVertAlignCellWithSp",B.doNotVerticallyAlignCellWithSp));if(B.doNotBreakConstrainedForcedTable)this.root.push(new q0("w:doNotBreakConstrainedForcedTable",B.doNotBreakConstrainedForcedTable));if(B.ignoreVerticalAlignmentInTextboxes)this.root.push(new q0("w:doNotVertAlignInTxbx",B.ignoreVerticalAlignmentInTextboxes));if(B.useAnsiKerningPairs)this.root.push(new q0("w:useAnsiKerningPairs",B.useAnsiKerningPairs));if(B.cachedColumnBalance)this.root.push(new q0("w:cachedColBalance",B.cachedColumnBalance))}},uJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},dJ=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w:settings");if(this.root.push(new uJ({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new q0("w:displayBackgroundShape",!0)),B.trackRevisions!==void 0)this.root.push(new q0("w:trackRevisions",B.trackRevisions));if(B.evenAndOddHeaders!==void 0)this.root.push(new q0("w:evenAndOddHeaders",B.evenAndOddHeaders));if(B.updateFields!==void 0)this.root.push(new q0("w:updateFields",B.updateFields));if(B.defaultTabStop!==void 0)this.root.push(new _2("w:defaultTabStop",B.defaultTabStop));if(((U=B.hyphenation)===null||U===void 0?void 0:U.autoHyphenation)!==void 0)this.root.push(new q0("w:autoHyphenation",B.hyphenation.autoHyphenation));if(((G=B.hyphenation)===null||G===void 0?void 0:G.hyphenationZone)!==void 0)this.root.push(new _2("w:hyphenationZone",B.hyphenation.hyphenationZone));if(((Y=B.hyphenation)===null||Y===void 0?void 0:Y.consecutiveHyphenLimit)!==void 0)this.root.push(new _2("w:consecutiveHyphenLimit",B.hyphenation.consecutiveHyphenLimit));if(((Q=B.hyphenation)===null||Q===void 0?void 0:Q.doNotHyphenateCaps)!==void 0)this.root.push(new q0("w:doNotHyphenateCaps",B.hyphenation.doNotHyphenateCaps));this.root.push(new hJ(L0(L0({},(K=B.compatibility)!==null&&K!==void 0?K:{}),{},{version:(Z=(J=(q=B.compatibility)===null||q===void 0?void 0:q.version)!==null&&J!==void 0?J:B.compatibilityModeVersion)!==null&&Z!==void 0?Z:15})))}},c9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},cJ=class extends t{constructor(B){super("w:name");this.root.push(new c9({val:B}))}},mJ=class extends t{constructor(B){super("w:uiPriority");this.root.push(new c9({val:T0(B)}))}},lJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},m9=class extends t{constructor(B,U){super("w:style");if(this.root.push(new lJ(B)),U.name)this.root.push(new cJ(U.name));if(U.basedOn)this.root.push(new q2("w:basedOn",U.basedOn));if(U.next)this.root.push(new q2("w:next",U.next));if(U.link)this.root.push(new q2("w:link",U.link));if(U.uiPriority!==void 0)this.root.push(new mJ(U.uiPriority));if(U.semiHidden!==void 0)this.root.push(new q0("w:semiHidden",U.semiHidden));if(U.unhideWhenUsed!==void 0)this.root.push(new q0("w:unhideWhenUsed",U.unhideWhenUsed));if(U.quickFormat!==void 0)this.root.push(new q0("w:qFormat",U.quickFormat))}},p2=class extends m9{constructor(B){super({type:"paragraph",styleId:B.id},B);e(this,"paragraphProperties",void 0),e(this,"runProperties",void 0),this.paragraphProperties=new M2(B.paragraph),this.runProperties=new U2(B.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},$2=class extends m9{constructor(B){super({type:"character",styleId:B.id},L0({uiPriority:99,unhideWhenUsed:!0},B));e(this,"runProperties",void 0),this.runProperties=new U2(B.run),this.root.push(this.runProperties)}},j2=class extends p2{constructor(B){super(L0({basedOn:"Normal",next:"Normal",quickFormat:!0},B))}},aJ=class extends j2{constructor(B){super(L0({id:"Title",name:"Title"},B))}},pJ=class extends j2{constructor(B){super(L0({id:"Heading1",name:"Heading 1"},B))}},rJ=class extends j2{constructor(B){super(L0({id:"Heading2",name:"Heading 2"},B))}},iJ=class extends j2{constructor(B){super(L0({id:"Heading3",name:"Heading 3"},B))}},nJ=class extends j2{constructor(B){super(L0({id:"Heading4",name:"Heading 4"},B))}},sJ=class extends j2{constructor(B){super(L0({id:"Heading5",name:"Heading 5"},B))}},oJ=class extends j2{constructor(B){super(L0({id:"Heading6",name:"Heading 6"},B))}},tJ=class extends j2{constructor(B){super(L0({id:"Strong",name:"Strong"},B))}},eJ=class extends p2{constructor(B){super(L0({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},B))}},BK=class extends p2{constructor(B){super(L0({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},UK=class extends $2{constructor(B){super(L0({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},GK=class extends $2{constructor(B){super(L0({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},B))}},YK=class extends p2{constructor(B){super(L0({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},ZK=class extends $2{constructor(B){super(L0({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},QK=class extends $2{constructor(B){super(L0({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},B))}},JK=class extends $2{constructor(B){super(L0({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:i8.SINGLE}}},B))}},S1=class extends t{constructor(B){super("w:styles");if(B.initialStyles)this.root.push(B.initialStyles);if(B.importedStyles)for(let U of B.importedStyles)this.root.push(U);if(B.paragraphStyles)for(let U of B.paragraphStyles)this.root.push(new p2(U));if(B.characterStyles)for(let U of B.characterStyles)this.root.push(new $2(U))}},l9=class extends t{constructor(B){super("w:pPrDefault");this.root.push(new M2(B))}},a9=class extends t{constructor(B){super("w:rPrDefault");this.root.push(new U2(B))}},p9=class extends t{constructor(B){super("w:docDefaults");e(this,"runPropertiesDefaults",void 0),e(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new a9(B.run),this.paragraphPropertiesDefaults=new l9(B.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},KK=class{newInstance(B){let U=(0,h1.xml2js)(B,{compact:!1}),G;for(let Q of U.elements||[])if(Q.name==="w:styles")G=Q;if(G===void 0)throw Error("can not find styles element");let Y=G.elements||[];return{initialStyles:new $B(G.attributes),importedStyles:Y.map((Q)=>u1(Q))}}},M8=class{newInstance(B={}){var U;return{initialStyles:new F1(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new p9((U=B.document)!==null&&U!==void 0?U:{}),new aJ(L0({run:{size:56}},B.title)),new pJ(L0({run:{color:"2E74B5",size:32}},B.heading1)),new rJ(L0({run:{color:"2E74B5",size:26}},B.heading2)),new iJ(L0({run:{color:"1F4D78",size:24}},B.heading3)),new nJ(L0({run:{color:"2E74B5",italics:!0}},B.heading4)),new sJ(L0({run:{color:"2E74B5"}},B.heading5)),new oJ(L0({run:{color:"1F4D78"}},B.heading6)),new tJ(L0({run:{bold:!0}},B.strong)),new eJ(B.listParagraph||{}),new JK(B.hyperlink||{}),new UK(B.footnoteReference||{}),new BK(B.footnoteText||{}),new GK(B.footnoteTextChar||{}),new ZK(B.endnoteReference||{}),new YK(B.endnoteText||{}),new QK(B.endnoteTextChar||{})]}}},VK=class{constructor(B){var U,G,Y,Q,K,Z,J,q,W,I,H,T;if(e(this,"currentRelationshipId",1),e(this,"documentWrapper",void 0),e(this,"headers",[]),e(this,"footers",[]),e(this,"coreProperties",void 0),e(this,"numbering",void 0),e(this,"media",void 0),e(this,"fileRelationships",void 0),e(this,"footnotesWrapper",void 0),e(this,"endnotesWrapper",void 0),e(this,"settings",void 0),e(this,"contentTypes",void 0),e(this,"customProperties",void 0),e(this,"appProperties",void 0),e(this,"styles",void 0),e(this,"comments",void 0),e(this,"commentsExtended",void 0),e(this,"fontWrapper",void 0),this.coreProperties=new dQ(L0(L0({},B),{},{creator:(U=B.creator)!==null&&U!==void 0?U:"Un-named",revision:(G=B.revision)!==null&&G!==void 0?G:1,lastModifiedBy:(Y=B.lastModifiedBy)!==null&&Y!==void 0?Y:"Un-named"})),this.numbering=new d9(B.numbering?B.numbering:{config:[]}),this.comments=new z4((Q=B.comments)!==null&&Q!==void 0?Q:{children:[]}),this.comments.ThreadData)this.commentsExtended=new E4(this.comments.ThreadData);if(this.fileRelationships=new A2,this.customProperties=new rQ((K=B.customProperties)!==null&&K!==void 0?K:[]),this.appProperties=new _Q,this.footnotesWrapper=new PJ,this.endnotesWrapper=new RJ,this.contentTypes=new uQ,this.documentWrapper=new JJ({background:B.background}),this.settings=new dJ({compatibilityModeVersion:B.compatabilityModeVersion,compatibility:B.compatibility,evenAndOddHeaders:B.evenAndOddHeaderAndFooters?!0:!1,trackRevisions:(Z=B.features)===null||Z===void 0?void 0:Z.trackRevisions,updateFields:(J=B.features)===null||J===void 0?void 0:J.updateFields,defaultTabStop:B.defaultTabStop,hyphenation:{autoHyphenation:(q=B.hyphenation)===null||q===void 0?void 0:q.autoHyphenation,hyphenationZone:(W=B.hyphenation)===null||W===void 0?void 0:W.hyphenationZone,consecutiveHyphenLimit:(I=B.hyphenation)===null||I===void 0?void 0:I.consecutiveHyphenLimit,doNotHyphenateCaps:(H=B.hyphenation)===null||H===void 0?void 0:H.doNotHyphenateCaps}}),this.media=new V6,B.externalStyles!==void 0){var A;let P=new M8().newInstance((A=B.styles)===null||A===void 0?void 0:A.default),j=new KK().newInstance(B.externalStyles);this.styles=new S1(L0(L0({},j),{},{importedStyles:[...P.importedStyles,...j.importedStyles]}))}else if(B.styles){let P=new M8().newInstance(B.styles.default);this.styles=new S1(L0(L0({},P),B.styles))}else{let P=new M8;this.styles=new S1(P.newInstance())}this.addDefaultRelationships();for(let P of B.sections)this.addSection(P);if(B.footnotes)for(let P in B.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(P),B.footnotes[P].children);if(B.endnotes)for(let P in B.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(P),B.endnotes[P].children);this.fontWrapper=new h4((T=B.fonts)!==null&&T!==void 0?T:[])}addSection({headers:B={},footers:U={},children:G,properties:Y}){this.documentWrapper.View.Body.addSection(L0(L0({},Y),{},{headerWrapperGroup:{default:B.default?this.createHeader(B.default):void 0,first:B.first?this.createHeader(B.first):void 0,even:B.even?this.createHeader(B.even):void 0},footerWrapperGroup:{default:U.default?this.createFooter(U.default):void 0,first:U.first?this.createFooter(U.first):void 0,even:U.even?this.createFooter(U.even):void 0}}));for(let Q of G)this.documentWrapper.View.add(Q)}createHeader(B){let U=new _9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addHeaderToDocument(U),U}createFooter(B){let U=new f9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addFooterToDocument(U),U}addHeaderToDocument(B,U=T2.DEFAULT){this.headers.push({header:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(B,U=T2.DEFAULT){this.footers.push({footer:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){if(this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.commentsExtended)this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map((B)=>B.header)}get Footers(){return this.footers.map((B)=>B.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get FontTable(){return this.fontWrapper}},XK=class extends t{constructor(B={}){super("w:instrText");e(this,"properties",void 0),this.properties=B,this.root.push(new _0({space:x0.PRESERVE}));let U="TOC";if(this.properties.captionLabel)U=`${U} \\a "${this.properties.captionLabel}"`;if(this.properties.entriesFromBookmark)U=`${U} \\b "${this.properties.entriesFromBookmark}"`;if(this.properties.captionLabelIncludingNumbers)U=`${U} \\c "${this.properties.captionLabelIncludingNumbers}"`;if(this.properties.sequenceAndPageNumbersSeparator)U=`${U} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`;if(this.properties.tcFieldIdentifier)U=`${U} \\f "${this.properties.tcFieldIdentifier}"`;if(this.properties.hyperlink)U=`${U} \\h`;if(this.properties.tcFieldLevelRange)U=`${U} \\l "${this.properties.tcFieldLevelRange}"`;if(this.properties.pageNumbersEntryLevelsRange)U=`${U} \\n "${this.properties.pageNumbersEntryLevelsRange}"`;if(this.properties.headingStyleRange)U=`${U} \\o "${this.properties.headingStyleRange}"`;if(this.properties.entryAndPageNumberSeparator)U=`${U} \\p "${this.properties.entryAndPageNumberSeparator}"`;if(this.properties.seqFieldIdentifierForPrefix)U=`${U} \\s "${this.properties.seqFieldIdentifierForPrefix}"`;if(this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let G=this.properties.stylesWithLevels.map((Y)=>`${Y.styleName},${Y.level}`).join(",");U=`${U} \\t "${G}"`}if(this.properties.useAppliedParagraphOutlineLevel)U=`${U} \\u`;if(this.properties.preserveTabInEntries)U=`${U} \\w`;if(this.properties.preserveNewLineInEntries)U=`${U} \\x`;if(this.properties.hideTabAndPageNumbersInWebView)U=`${U} \\z`;this.root.push(U)}},r9=class extends t{constructor(){super("w:sdtContent")}},i9=class extends t{constructor(B){super("w:sdtPr");if(B)this.root.push(new q2("w:alias",B))}};function qK(B,U){if(B==null)return{};var G={};for(var Y in B)if({}.hasOwnProperty.call(B,Y)){if(U.includes(Y))continue;G[Y]=B[Y]}return G}function n9(B,U){if(B==null)return{};var G,Y,Q=qK(B,U);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(B);for(Y=0;Y0){let{stylesWithLevels:W}=K,I=Y.map((T,A)=>{var P,j;let E=this.buildCachedContentParagraphChild(T,K),C=(P=W===null||W===void 0||(j=W.find((v)=>v.level===T.level))===null||j===void 0?void 0:j.styleName)!==null&&P!==void 0?P:`TOC${T.level}`,N=A===0?[...J,E]:A===Y.length-1?[E,...q]:[E];return new d0({style:C,tabStops:this.getTabStopsForLevel(T.level),children:N})}),H=I;if(Y.length<=1)H=[...I,new d0({children:q})];for(let T of H)Z.addChildElement(T)}else{let W=new d0({children:J});Z.addChildElement(W);for(let H of G)Z.addChildElement(H);let I=new d0({children:q});Z.addChildElement(I)}this.root.push(Z)}getTabStopsForLevel(B,U=9025){return[{type:"clear",position:U+1-(B-1)*240},{type:"right",position:U,leader:"dot"}]}buildCachedContentRun(B,U){var G,Y;return new D0({style:(U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0?"IndexLink":void 0,children:[new Z1({text:B.title}),new T4,new Z1({text:(G=(Y=B.page)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:""})]})}buildCachedContentParagraphChild(B,U){let G=this.buildCachedContentRun(B,U);if((U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0)return new y4({anchor:B.href,children:[G]});return G}},LK=class{constructor(B,U){e(this,"styleName",void 0),e(this,"level",void 0),this.styleName=B,this.level=U}},IK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},OK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},s9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},o9=class extends t{constructor(B){super("w:footnoteReference");this.root.push(new s9({id:B}))}},HK=class extends D0{constructor(B){super({style:"FootnoteReference"});this.root.push(new o9(B))}},t9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},e9=class extends t{constructor(B){super("w:endnoteReference");this.root.push(new t9({id:B}))}},FK=class extends D0{constructor(B){super({style:"EndnoteReference"});this.root.push(new e9(B))}},o6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w14:val",symbolfont:"w14:font"})}},b1=class extends t{constructor(B,U,G){super(B);if(G)this.root.push(new o6({val:SB(U),symbolfont:G}));else this.root.push(new o6({val:U}))}},B5=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w14:checkbox");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let W=(B===null||B===void 0?void 0:B.checked)?"1":"0",I,H;this.root.push(new b1("w14:checked",W)),I=(B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.value)?B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value:this.DEFAULT_CHECKED_SYMBOL,H=(B===null||B===void 0||(Y=B.checkedState)===null||Y===void 0?void 0:Y.font)?B===null||B===void 0||(Q=B.checkedState)===null||Q===void 0?void 0:Q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:checkedState",I,H)),I=(B===null||B===void 0||(K=B.uncheckedState)===null||K===void 0?void 0:K.value)?B===null||B===void 0||(Z=B.uncheckedState)===null||Z===void 0?void 0:Z.value:this.DEFAULT_UNCHECKED_SYMBOL,H=(B===null||B===void 0||(J=B.uncheckedState)===null||J===void 0?void 0:J.font)?B===null||B===void 0||(q=B.uncheckedState)===null||q===void 0?void 0:q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:uncheckedState",I,H))}},WK=class extends t{constructor(B){var U,G,Y,Q;super("w:sdt");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let K=new i9(B===null||B===void 0?void 0:B.alias);K.addChildElement(new B5(B)),this.root.push(K);let Z=new r9,J=B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.font,q=B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value,W=B===null||B===void 0||(Y=B.uncheckedState)===null||Y===void 0?void 0:Y.font,I=B===null||B===void 0||(Q=B.uncheckedState)===null||Q===void 0?void 0:Q.value,H,T;if(B===null||B===void 0?void 0:B.checked)H=J?J:this.DEFAULT_FONT,T=q?q:this.DEFAULT_CHECKED_SYMBOL;else H=W?W:this.DEFAULT_FONT,T=I?I:this.DEFAULT_UNCHECKED_SYMBOL;let A=new aB({char:T,symbolfont:H});Z.addChildElement(A),this.root.push(Z)}},PK=({shape:B})=>new M0({name:"w:pict",children:[B]}),AK=({children:B=[]})=>new M0({name:"w:txbxContent",children:B}),jK=({style:B,children:U,inset:G})=>new M0({name:"v:textbox",attributes:{style:{key:"style",value:B},insetMode:{key:"insetmode",value:G?"custom":"auto"},inset:{key:"inset",value:G?`${G.left}, ${G.top}, ${G.right}, ${G.bottom}`:void 0}},children:[AK({children:U})]}),NK="#_x0000_t202",wK={flip:"flip",height:"height",left:"left",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",positionHorizontal:"mso-position-horizontal",positionHorizontalRelative:"mso-position-horizontal-relative",positionVertical:"mso-position-vertical",positionVerticalRelative:"mso-position-vertical-relative",wrapDistanceBottom:"mso-wrap-distance-bottom",wrapDistanceLeft:"mso-wrap-distance-left",wrapDistanceRight:"mso-wrap-distance-right",wrapDistanceTop:"mso-wrap-distance-top",wrapEdited:"mso-wrap-edited",wrapStyle:"mso-wrap-style",position:"position",rotation:"rotation",top:"top",visibility:"visibility",width:"width",zIndex:"z-index"},zK=(B)=>B?Object.entries(B).map(([U,G])=>`${wK[U]}:${G}`).join(";"):void 0,EK=({id:B,children:U,type:G=NK,style:Y})=>new M0({name:"v:shape",attributes:{id:{key:"id",value:B},type:{key:"type",value:G},style:{key:"style",value:zK(Y)}},children:[jK({style:"mso-fit-shape-to-text:t;",children:U})]}),DK=["style","children"],TK=class extends H1{constructor(B){let{style:U,children:G}=B,Y=n9(B,DK);super("w:p");this.root.push(new M2(Y)),this.root.push(PK({shape:EK({children:G,id:O1(),style:U})}))}},CK=R0((B,U)=>{d2(),P2();/*! + `)+" "+o[1];return o[0]+n+" "+y.join(", ")+" "+o[1]}B.types=rU();function E(y){return Array.isArray(y)}B.isArray=E;function C(y){return typeof y==="boolean"}B.isBoolean=C;function N(y){return y===null}B.isNull=N;function v(y){return y==null}B.isNullOrUndefined=v;function S(y){return typeof y==="number"}B.isNumber=S;function F(y){return typeof y==="string"}B.isString=F;function M(y){return typeof y==="symbol"}B.isSymbol=M;function $(y){return y===void 0}B.isUndefined=$;function x(y){return z(y)&&D(y)==="[object RegExp]"}B.isRegExp=x,B.types.isRegExp=x;function z(y){return typeof y==="object"&&y!==null}B.isObject=z;function a(y){return z(y)&&D(y)==="[object Date]"}B.isDate=a,B.types.isDate=a;function U0(y){return z(y)&&(D(y)==="[object Error]"||y instanceof Error)}B.isError=U0,B.types.isNativeError=U0;function b(y){return typeof y==="function"}B.isFunction=b;function c(y){return y===null||typeof y==="boolean"||typeof y==="number"||typeof y==="string"||typeof y==="symbol"||typeof y>"u"}B.isPrimitive=c,B.isBuffer=iU();function D(y){return Object.prototype.toString.call(y)}function m(y){return y<10?"0"+y.toString(10):y.toString(10)}var B0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function i(){var y=new Date,n=[m(y.getHours()),m(y.getMinutes()),m(y.getSeconds())].join(":");return[y.getDate(),B0[y.getMonth()],n].join(" ")}B.log=function(){console.log("%s - %s",i(),B.format.apply(B,arguments))},B.inherits=W2(),B._extend=function(y,n){if(!n||!z(n))return y;var o=Object.keys(n),Y0=o.length;while(Y0--)y[o[Y0]]=n[o[Y0]];return y};function V0(y,n){return Object.prototype.hasOwnProperty.call(y,n)}var s=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;B.promisify=function(n){if(typeof n!=="function")throw TypeError('The "original" argument must be of type Function');if(s&&n[s]){var o=n[s];if(typeof o!=="function")throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(o,s,{value:o,enumerable:!1,writable:!1,configurable:!0}),o}function o(){var Y0,O0,w=new Promise(function(h,Z0){Y0=h,O0=Z0}),L=[];for(var u=0;u{function G(P,j){var E=Object.keys(P);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(P);j&&(C=C.filter(function(N){return Object.getOwnPropertyDescriptor(P,N).enumerable})),E.push.apply(E,C)}return E}function Y(P){for(var j=1;j0)this.tail.next=C;else this.head=C;this.tail=C,++this.length}},{key:"unshift",value:function(E){var C={data:E,next:this.head};if(this.length===0)this.tail=C;this.head=C,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var E=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,E}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";var C=this.head,N=""+C.data;while(C=C.next)N+=E+C.data;return N}},{key:"concat",value:function(E){if(this.length===0)return I.alloc(0);var C=I.allocUnsafe(E>>>0),N=this.head,v=0;while(N)A(N.data,C,v),v+=N.data.length,N=N.next;return C}},{key:"consume",value:function(E,C){var N;if(ES.length?S.length:E;if(F===S.length)v+=S;else v+=S.slice(0,E);if(E-=F,E===0){if(F===S.length)if(++N,C.next)this.head=C.next;else this.head=this.tail=null;else this.head=C,C.data=S.slice(F);break}++N}return this.length-=N,v}},{key:"_getBuffer",value:function(E){var C=I.allocUnsafe(E),N=this.head,v=1;N.data.copy(C),E-=N.data.length;while(N=N.next){var S=N.data,F=E>S.length?S.length:E;if(S.copy(C,C.length-E,0,F),E-=F,E===0){if(F===S.length)if(++v,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=S.slice(F);break}++v}return this.length-=v,C}},{key:T,value:function(E,C){return H(this,Y(Y({},C),{},{depth:0,customInspect:!1}))}}]),P}()}),NB=R0((B,U)=>{P2();function G(q,W){var I=this,H=this._readableState&&this._readableState.destroyed,T=this._writableState&&this._writableState.destroyed;if(H||T){if(W)W(q);else if(q){if(!this._writableState)P0.nextTick(Z,this,q);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,P0.nextTick(Z,this,q)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(q||null,function(A){if(!W&&A)if(!I._writableState)P0.nextTick(Y,I,A);else if(!I._writableState.errorEmitted)I._writableState.errorEmitted=!0,P0.nextTick(Y,I,A);else P0.nextTick(Q,I);else if(W)P0.nextTick(Q,I),W(A);else P0.nextTick(Q,I)}),this}function Y(q,W){Z(q,W),Q(q)}function Q(q){if(q._writableState&&!q._writableState.emitClose)return;if(q._readableState&&!q._readableState.emitClose)return;q.emit("close")}function K(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function Z(q,W){q.emit("error",W)}function J(q,W){var{_readableState:I,_writableState:H}=q;if(I&&I.autoDestroy||H&&H.autoDestroy)q.destroy(W);else q.emit("error",W)}U.exports={destroy:G,undestroy:K,errorOrDestroy:J}}),c2=R0((B,U)=>{function G(W,I){W.prototype=Object.create(I.prototype),W.prototype.constructor=W,W.__proto__=I}var Y={};function Q(W,I,H){if(!H)H=Error;function T(P,j,E){if(typeof I==="string")return I;else return I(P,j,E)}var A=function(P){G(j,P);function j(E,C,N){return P.call(this,T(E,C,N))||this}return j}(H);A.prototype.name=H.name,A.prototype.code=W,Y[W]=A}function K(W,I){if(Array.isArray(W)){var H=W.length;if(W=W.map(function(T){return String(T)}),H>2)return"one of ".concat(I," ").concat(W.slice(0,H-1).join(", "),", or ")+W[H-1];else if(H===2)return"one of ".concat(I," ").concat(W[0]," or ").concat(W[1]);else return"of ".concat(I," ").concat(W[0])}else return"of ".concat(I," ").concat(String(W))}function Z(W,I,H){return W.substr(!H||H<0?0:+H,I.length)===I}function J(W,I,H){if(H===void 0||H>W.length)H=W.length;return W.substring(H-I.length,H)===I}function q(W,I,H){if(typeof H!=="number")H=0;if(H+I.length>W.length)return!1;else return W.indexOf(I,H)!==-1}Q("ERR_INVALID_OPT_VALUE",function(W,I){return'The value "'+I+'" is invalid for option "'+W+'"'},TypeError),Q("ERR_INVALID_ARG_TYPE",function(W,I,H){var T;if(typeof I==="string"&&Z(I,"not "))T="must not be",I=I.replace(/^not /,"");else T="must be";var A;if(J(W," argument"))A="The ".concat(W," ").concat(T," ").concat(K(I,"type"));else{var P=q(W,".")?"property":"argument";A='The "'.concat(W,'" ').concat(P," ").concat(T," ").concat(K(I,"type"))}return A+=". Received type ".concat(typeof H),A},TypeError),Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Q("ERR_METHOD_NOT_IMPLEMENTED",function(W){return"The "+W+" method is not implemented"}),Q("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Q("ERR_STREAM_DESTROYED",function(W){return"Cannot call "+W+" after a stream was destroyed"}),Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Q("ERR_STREAM_WRITE_AFTER_END","write after end"),Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Q("ERR_UNKNOWN_ENCODING",function(W){return"Unknown encoding: "+W},TypeError),Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),U.exports.codes=Y}),zB=R0((B,U)=>{var G=c2().codes.ERR_INVALID_OPT_VALUE;function Y(K,Z,J){return K.highWaterMark!=null?K.highWaterMark:Z?K[J]:null}function Q(K,Z,J,q){var W=Y(Z,q,J);if(W!=null){if(!(isFinite(W)&&Math.floor(W)===W)||W<0)throw new G(q?J:"highWaterMark",W);return Math.floor(W)}return K.objectMode?16:16384}U.exports={getHighWaterMark:Q}}),sU=R0((B,U)=>{d2(),U.exports=G;function G(Q,K){if(Y("noDeprecation"))return Q;var Z=!1;function J(){if(!Z){if(Y("throwDeprecation"))throw Error(K);else if(Y("traceDeprecation"))console.trace(K);else console.warn(K);Z=!0}return Q.apply(this,arguments)}return J}function Y(Q){try{if(!v0.localStorage)return!1}catch(Z){return!1}var K=v0.localStorage[Q];if(K==null)return!1;return String(K).toLowerCase()==="true"}}),wB=R0((B,U)=>{d2(),P2(),U.exports=z;function G(w){var L=this;this.next=null,this.entry=null,this.finish=function(){O0(L,w)}}var Y;z.WritableState=$;var Q={deprecate:sU()},K=qB(),Z=f1().Buffer,J=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function q(w){return Z.from(w)}function W(w){return Z.isBuffer(w)||w instanceof J}var I=NB(),H=zB().getHighWaterMark,T=c2().codes,A=T.ERR_INVALID_ARG_TYPE,P=T.ERR_METHOD_NOT_IMPLEMENTED,j=T.ERR_MULTIPLE_CALLBACK,E=T.ERR_STREAM_CANNOT_PIPE,C=T.ERR_STREAM_DESTROYED,N=T.ERR_STREAM_NULL_VALUES,v=T.ERR_STREAM_WRITE_AFTER_END,S=T.ERR_UNKNOWN_ENCODING,F=I.errorOrDestroy;W2()(z,K);function M(){}function $(w,L,u){if(Y=Y||u2(),w=w||{},typeof u!=="boolean")u=L instanceof Y;if(this.objectMode=!!w.objectMode,u)this.objectMode=this.objectMode||!!w.writableObjectMode;this.highWaterMark=H(this,w,"writableHighWaterMark",u),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=w.decodeStrings===!1;this.decodeStrings=!h,this.defaultEncoding=w.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z0){i(L,Z0)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=w.emitClose!==!1,this.autoDestroy=!!w.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new G(this)}$.prototype.getBuffer=function(){var L=this.bufferedRequest,u=[];while(L)u.push(L),L=L.next;return u},function(){try{Object.defineProperty($.prototype,"buffer",{get:Q.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(w){}}();var x;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")x=Function.prototype[Symbol.hasInstance],Object.defineProperty(z,Symbol.hasInstance,{value:function(L){if(x.call(this,L))return!0;if(this!==z)return!1;return L&&L._writableState instanceof $}});else x=function(L){return L instanceof this};function z(w){Y=Y||u2();var L=this instanceof Y;if(!L&&!x.call(z,this))return new z(w);if(this._writableState=new $(w,this,L),this.writable=!0,w){if(typeof w.write==="function")this._write=w.write;if(typeof w.writev==="function")this._writev=w.writev;if(typeof w.destroy==="function")this._destroy=w.destroy;if(typeof w.final==="function")this._final=w.final}K.call(this)}z.prototype.pipe=function(){F(this,new E)};function a(w,L){var u=new v;F(w,u),P0.nextTick(L,u)}function U0(w,L,u,h){var Z0;if(u===null)Z0=new N;else if(typeof u!=="string"&&!L.objectMode)Z0=new A("chunk",["string","Buffer"],u);if(Z0)return F(w,Z0),P0.nextTick(h,Z0),!1;return!0}z.prototype.write=function(w,L,u){var h=this._writableState,Z0=!1,g=!h.objectMode&&W(w);if(g&&!Z.isBuffer(w))w=q(w);if(typeof L==="function")u=L,L=null;if(g)L="buffer";else if(!L)L=h.defaultEncoding;if(typeof u!=="function")u=M;if(h.ending)a(this,u);else if(g||U0(this,h,w,u))h.pendingcb++,Z0=c(this,h,g,w,L,u);return Z0},z.prototype.cork=function(){this._writableState.corked++},z.prototype.uncork=function(){var w=this._writableState;if(w.corked){if(w.corked--,!w.writing&&!w.corked&&!w.bufferProcessing&&w.bufferedRequest)G0(this,w)}},z.prototype.setDefaultEncoding=function(L){if(typeof L==="string")L=L.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((L+"").toLowerCase())>-1))throw new S(L);return this._writableState.defaultEncoding=L,this},Object.defineProperty(z.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function b(w,L,u){if(!w.objectMode&&w.decodeStrings!==!1&&typeof L==="string")L=Z.from(L,u);return L}Object.defineProperty(z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function c(w,L,u,h,Z0,g){if(!u){var f=b(L,h,Z0);if(h!==f)u=!0,Z0="buffer",h=f}var R=L.objectMode?1:h.length;L.length+=R;var p=L.length{P2();var G=Object.keys||function(H){var T=[];for(var A in H)T.push(A);return T};U.exports=q;var Y=EB(),Q=wB();W2()(q,Y);var K=G(Q.prototype);for(var Z=0;Z{var G=f1(),Y=G.Buffer;function Q(Z,J){for(var q in Z)J[q]=Z[q]}if(Y.from&&Y.alloc&&Y.allocUnsafe&&Y.allocUnsafeSlow)U.exports=G;else Q(G,B),B.Buffer=K;function K(Z,J,q){return Y(Z,J,q)}Q(Y,K),K.from=function(Z,J,q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return Y(Z,J,q)},K.alloc=function(Z,J,q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var W=Y(Z);if(J!==void 0)if(typeof q==="string")W.fill(J,q);else W.fill(J);else W.fill(0);return W},K.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return Y(Z)},K.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),F8=R0((B)=>{var U=oU().Buffer,G=U.isEncoding||function(N){switch(N=""+N,N&&N.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Y(N){if(!N)return"utf8";var v;while(!0)switch(N){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return N;default:if(v)return;N=(""+N).toLowerCase(),v=!0}}function Q(N){var v=Y(N);if(typeof v!=="string"&&(U.isEncoding===G||!G(N)))throw Error("Unknown encoding: "+N);return v||N}B.StringDecoder=K;function K(N){this.encoding=Q(N);var v;switch(this.encoding){case"utf16le":this.text=T,this.end=A,v=4;break;case"utf8":this.fillLast=W,v=4;break;case"base64":this.text=P,this.end=j,v=3;break;default:this.write=E,this.end=C;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=U.allocUnsafe(v)}K.prototype.write=function(N){if(N.length===0)return"";var v,S;if(this.lastNeed){if(v=this.fillLast(N),v===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;if(S>5===6)return 2;else if(N>>4===14)return 3;else if(N>>3===30)return 4;return N>>6===2?-1:-2}function J(N,v,S){var F=v.length-1;if(F=0){if(M>0)N.lastNeed=M-1;return M}if(--F=0){if(M>0)N.lastNeed=M-2;return M}if(--F=0){if(M>0)if(M===2)M=0;else N.lastNeed=M-3;return M}return 0}function q(N,v,S){if((v[0]&192)!==128)return N.lastNeed=0,"�";if(N.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return N.lastNeed=1,"�";if(N.lastNeed>2&&v.length>2){if((v[2]&192)!==128)return N.lastNeed=2,"�"}}}function W(N){var v=this.lastTotal-this.lastNeed,S=q(this,N,v);if(S!==void 0)return S;if(this.lastNeed<=N.length)return N.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);N.copy(this.lastChar,v,0,N.length),this.lastNeed-=N.length}function I(N,v){var S=J(this,N,v);if(!this.lastNeed)return N.toString("utf8",v);this.lastTotal=S;var F=N.length-(S-this.lastNeed);return N.copy(this.lastChar,0,F),N.toString("utf8",v,F)}function H(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+"�";return v}function T(N,v){if((N.length-v)%2===0){var S=N.toString("utf16le",v);if(S){var F=S.charCodeAt(S.length-1);if(F>=55296&&F<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=N[N.length-1],N.toString("utf16le",v,N.length-1)}function A(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,S)}return v}function P(N,v){var S=(N.length-v)%3;if(S===0)return N.toString("base64",v);if(this.lastNeed=3-S,this.lastTotal=3,S===1)this.lastChar[0]=N[N.length-1];else this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1];return N.toString("base64",v,N.length-S)}function j(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+this.lastChar.toString("base64",0,3-this.lastNeed);return v}function E(N){return N.toString(this.encoding)}function C(N){return N&&N.length?this.write(N):""}}),f8=R0((B,U)=>{var G=c2().codes.ERR_STREAM_PREMATURE_CLOSE;function Y(J){var q=!1;return function(){if(q)return;q=!0;for(var W=arguments.length,I=Array(W),H=0;H{P2();var G;function Y(S,F,M){if(F=Q(F),F in S)Object.defineProperty(S,F,{value:M,enumerable:!0,configurable:!0,writable:!0});else S[F]=M;return S}function Q(S){var F=K(S,"string");return typeof F==="symbol"?F:String(F)}function K(S,F){if(typeof S!=="object"||S===null)return S;var M=S[Symbol.toPrimitive];if(M!==void 0){var $=M.call(S,F||"default");if(typeof $!=="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(F==="string"?String:Number)(S)}var Z=f8(),J=Symbol("lastResolve"),q=Symbol("lastReject"),W=Symbol("error"),I=Symbol("ended"),H=Symbol("lastPromise"),T=Symbol("handlePromise"),A=Symbol("stream");function P(S,F){return{value:S,done:F}}function j(S){var F=S[J];if(F!==null){var M=S[A].read();if(M!==null)S[H]=null,S[J]=null,S[q]=null,F(P(M,!1))}}function E(S){P0.nextTick(j,S)}function C(S,F){return function(M,$){S.then(function(){if(F[I]){M(P(void 0,!0));return}F[T](M,$)},$)}}var N=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((G={get stream(){return this[A]},next:function(){var F=this,M=this[W];if(M!==null)return Promise.reject(M);if(this[I])return Promise.resolve(P(void 0,!0));if(this[A].destroyed)return new Promise(function(a,U0){P0.nextTick(function(){if(F[W])U0(F[W]);else a(P(void 0,!0))})});var $=this[H],x;if($)x=new Promise(C($,this));else{var z=this[A].read();if(z!==null)return Promise.resolve(P(z,!1));x=new Promise(this[T])}return this[H]=x,x}},Y(G,Symbol.asyncIterator,function(){return this}),Y(G,"return",function(){var F=this;return new Promise(function(M,$){F[A].destroy(null,function(x){if(x){$(x);return}M(P(void 0,!0))})})}),G),N);U.exports=function(F){var M,$=Object.create(v,(M={},Y(M,A,{value:F,writable:!0}),Y(M,J,{value:null,writable:!0}),Y(M,q,{value:null,writable:!0}),Y(M,W,{value:null,writable:!0}),Y(M,I,{value:F._readableState.endEmitted,writable:!0}),Y(M,T,{value:function(z,a){var U0=$[A].read();if(U0)$[H]=null,$[J]=null,$[q]=null,z(P(U0,!1));else $[J]=z,$[q]=a},writable:!0}),M));return $[H]=null,Z(F,function(x){if(x&&x.code!=="ERR_STREAM_PREMATURE_CLOSE"){var z=$[q];if(z!==null)$[H]=null,$[J]=null,$[q]=null,z(x);$[W]=x;return}var a=$[J];if(a!==null)$[H]=null,$[J]=null,$[q]=null,a(P(void 0,!0));$[I]=!0}),F.on("readable",E.bind(null,$)),$}}),eU=R0((B,U)=>{U.exports=function(){throw Error("Readable.from is not available in the browser")}}),EB=R0((B,U)=>{d2(),P2(),U.exports=a;var G;a.ReadableState=z,S8().EventEmitter;var Y=function(f,R){return f.listeners(R).length},Q=qB(),K=f1().Buffer,Z=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function J(g){return K.from(g)}function q(g){return K.isBuffer(g)||g instanceof Z}var W=jB(),I;if(W&&W.debuglog)I=W.debuglog("stream");else I=function(){};var H=nU(),T=NB(),A=zB().getHighWaterMark,P=c2().codes,j=P.ERR_INVALID_ARG_TYPE,E=P.ERR_STREAM_PUSH_AFTER_EOF,C=P.ERR_METHOD_NOT_IMPLEMENTED,N=P.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,S,F;W2()(a,Q);var M=T.errorOrDestroy,$=["error","close","destroy","pause","resume"];function x(g,f,R){if(typeof g.prependListener==="function")return g.prependListener(f,R);if(!g._events||!g._events[f])g.on(f,R);else if(Array.isArray(g._events[f]))g._events[f].unshift(R);else g._events[f]=[R,g._events[f]]}function z(g,f,R){if(G=G||u2(),g=g||{},typeof R!=="boolean")R=f instanceof G;if(this.objectMode=!!g.objectMode,R)this.objectMode=this.objectMode||!!g.readableObjectMode;if(this.highWaterMark=A(this,g,"readableHighWaterMark",R),this.buffer=new H,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=g.emitClose!==!1,this.autoDestroy=!!g.autoDestroy,this.destroyed=!1,this.defaultEncoding=g.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,g.encoding){if(!v)v=F8().StringDecoder;this.decoder=new v(g.encoding),this.encoding=g.encoding}}function a(g){if(G=G||u2(),!(this instanceof a))return new a(g);var f=this instanceof G;if(this._readableState=new z(g,this,f),this.readable=!0,g){if(typeof g.read==="function")this._read=g.read;if(typeof g.destroy==="function")this._destroy=g.destroy}Q.call(this)}Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(f){if(!this._readableState)return;this._readableState.destroyed=f}}),a.prototype.destroy=T.destroy,a.prototype._undestroy=T.undestroy,a.prototype._destroy=function(g,f){f(g)},a.prototype.push=function(g,f){var R=this._readableState,p;if(!R.objectMode){if(typeof g==="string"){if(f=f||R.defaultEncoding,f!==R.encoding)g=K.from(g,f),f="";p=!0}}else p=!0;return U0(this,g,f,!1,p)},a.prototype.unshift=function(g){return U0(this,g,null,!0,!1)};function U0(g,f,R,p,k){I("readableAddChunk",f);var V=g._readableState;if(f===null)V.reading=!1,i(g,V);else{var X;if(!k)X=c(V,f);if(X)M(g,X);else if(V.objectMode||f&&f.length>0){if(typeof f!=="string"&&!V.objectMode&&Object.getPrototypeOf(f)!==K.prototype)f=J(f);if(p)if(V.endEmitted)M(g,new N);else b(g,V,f,!0);else if(V.ended)M(g,new E);else if(V.destroyed)return!1;else if(V.reading=!1,V.decoder&&!R)if(f=V.decoder.write(f),V.objectMode||f.length!==0)b(g,V,f,!1);else G0(g,V);else b(g,V,f,!1)}else if(!p)V.reading=!1,G0(g,V)}return!V.ended&&(V.length=D)g=D;else g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++;return g}function B0(g,f){if(g<=0||f.length===0&&f.ended)return 0;if(f.objectMode)return 1;if(g!==g)if(f.flowing&&f.length)return f.buffer.head.data.length;else return f.length;if(g>f.highWaterMark)f.highWaterMark=m(g);if(g<=f.length)return g;if(!f.ended)return f.needReadable=!0,0;return f.length}a.prototype.read=function(g){I("read",g),g=parseInt(g,10);var f=this._readableState,R=g;if(g!==0)f.emittedReadable=!1;if(g===0&&f.needReadable&&((f.highWaterMark!==0?f.length>=f.highWaterMark:f.length>0)||f.ended)){if(I("read: emitReadable",f.length,f.ended),f.length===0&&f.ended)u(this);else V0(this);return null}if(g=B0(g,f),g===0&&f.ended){if(f.length===0)u(this);return null}var p=f.needReadable;if(I("need readable",p),f.length===0||f.length-g0)k=L(g,f);else k=null;if(k===null)f.needReadable=f.length<=f.highWaterMark,g=0;else f.length-=g,f.awaitDrain=0;if(f.length===0){if(!f.ended)f.needReadable=!0;if(R!==g&&f.ended)u(this)}if(k!==null)this.emit("data",k);return k};function i(g,f){if(I("onEofChunk"),f.ended)return;if(f.decoder){var R=f.decoder.end();if(R&&R.length)f.buffer.push(R),f.length+=f.objectMode?1:R.length}if(f.ended=!0,f.sync)V0(g);else if(f.needReadable=!1,!f.emittedReadable)f.emittedReadable=!0,s(g)}function V0(g){var f=g._readableState;if(I("emitReadable",f.needReadable,f.emittedReadable),f.needReadable=!1,!f.emittedReadable)I("emitReadable",f.flowing),f.emittedReadable=!0,P0.nextTick(s,g)}function s(g){var f=g._readableState;if(I("emitReadable_",f.destroyed,f.length,f.ended),!f.destroyed&&(f.length||f.ended))g.emit("readable"),f.emittedReadable=!1;f.needReadable=!f.flowing&&!f.ended&&f.length<=f.highWaterMark,w(g)}function G0(g,f){if(!f.readingMore)f.readingMore=!0,P0.nextTick(r,g,f)}function r(g,f){while(!f.reading&&!f.ended&&(f.length1&&Z0(p.pipes,g)!==-1)&&!_)I("false write response, pause",p.awaitDrain),p.awaitDrain++;R.pause()}}function Q0(F0){if(I("onerror",F0),I0(),g.removeListener("error",Q0),Y(g,"error")===0)M(g,F0)}x(g,"error",Q0);function X0(){g.removeListener("finish",K0),I0()}g.once("close",X0);function K0(){I("onfinish"),g.removeListener("close",X0),I0()}g.once("finish",K0);function I0(){I("unpipe"),R.unpipe(g)}if(g.emit("pipe",R),!p.flowing)I("pipe resume"),R.resume();return g};function y(g){return function(){var R=g._readableState;if(I("pipeOnDrain",R.awaitDrain),R.awaitDrain)R.awaitDrain--;if(R.awaitDrain===0&&Y(g,"data"))R.flowing=!0,w(g)}}a.prototype.unpipe=function(g){var f=this._readableState,R={hasUnpiped:!1};if(f.pipesCount===0)return this;if(f.pipesCount===1){if(g&&g!==f.pipes)return this;if(!g)g=f.pipes;if(f.pipes=null,f.pipesCount=0,f.flowing=!1,g)g.emit("unpipe",this,R);return this}if(!g){var{pipes:p,pipesCount:k}=f;f.pipes=null,f.pipesCount=0,f.flowing=!1;for(var V=0;V0,p.flowing!==!1)this.resume()}else if(g==="readable"){if(!p.endEmitted&&!p.readableListening){if(p.readableListening=p.needReadable=!0,p.flowing=!1,p.emittedReadable=!1,I("on readable",p.length,p.reading),p.length)V0(this);else if(!p.reading)P0.nextTick(o,this)}}return R},a.prototype.addListener=a.prototype.on,a.prototype.removeListener=function(g,f){var R=Q.prototype.removeListener.call(this,g,f);if(g==="readable")P0.nextTick(n,this);return R},a.prototype.removeAllListeners=function(g){var f=Q.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)P0.nextTick(n,this);return f};function n(g){var f=g._readableState;if(f.readableListening=g.listenerCount("readable")>0,f.resumeScheduled&&!f.paused)f.flowing=!0;else if(g.listenerCount("data")>0)g.resume()}function o(g){I("readable nexttick read 0"),g.read(0)}a.prototype.resume=function(){var g=this._readableState;if(!g.flowing)I("resume"),g.flowing=!g.readableListening,Y0(this,g);return g.paused=!1,this};function Y0(g,f){if(!f.resumeScheduled)f.resumeScheduled=!0,P0.nextTick(O0,g,f)}function O0(g,f){if(I("resume",f.reading),!f.reading)g.read(0);if(f.resumeScheduled=!1,g.emit("resume"),w(g),f.flowing&&!f.reading)g.read(0)}a.prototype.pause=function(){if(I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)I("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function w(g){var f=g._readableState;I("flow",f.flowing);while(f.flowing&&g.read()!==null);}if(a.prototype.wrap=function(g){var f=this,R=this._readableState,p=!1;g.on("end",function(){if(I("wrapped end"),R.decoder&&!R.ended){var X=R.decoder.end();if(X&&X.length)f.push(X)}f.push(null)}),g.on("data",function(X){if(I("wrapped data"),R.decoder)X=R.decoder.write(X);if(R.objectMode&&(X===null||X===void 0))return;else if(!R.objectMode&&(!X||!X.length))return;if(!f.push(X))p=!0,g.pause()});for(var k in g)if(this[k]===void 0&&typeof g[k]==="function")this[k]=function(O){return function(){return g[O].apply(g,arguments)}}(k);for(var V=0;V<$.length;V++)g.on($[V],this.emit.bind(this,$[V]));return this._read=function(X){if(I("wrapped _read",X),p)p=!1,g.resume()},this},typeof Symbol==="function")a.prototype[Symbol.asyncIterator]=function(){if(S===void 0)S=tU();return S(this)};Object.defineProperty(a.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(a.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(a.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(f){if(this._readableState)this._readableState.flowing=f}}),a._fromList=L,Object.defineProperty(a.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function L(g,f){if(f.length===0)return null;var R;if(f.objectMode)R=f.buffer.shift();else if(!g||g>=f.length){if(f.decoder)R=f.buffer.join("");else if(f.buffer.length===1)R=f.buffer.first();else R=f.buffer.concat(f.length);f.buffer.clear()}else R=f.buffer.consume(g,f.decoder);return R}function u(g){var f=g._readableState;if(I("endReadable",f.endEmitted),!f.endEmitted)f.ended=!0,P0.nextTick(h,f,g)}function h(g,f){if(I("endReadableNT",g.endEmitted,g.length),!g.endEmitted&&g.length===0){if(g.endEmitted=!0,f.readable=!1,f.emit("end"),g.autoDestroy){var R=f._writableState;if(!R||R.autoDestroy&&R.finished)f.destroy()}}}if(typeof Symbol==="function")a.from=function(g,f){if(F===void 0)F=eU();return F(a,g,f)};function Z0(g,f){for(var R=0,p=g.length;R{U.exports=W;var G=c2().codes,Y=G.ERR_METHOD_NOT_IMPLEMENTED,Q=G.ERR_MULTIPLE_CALLBACK,K=G.ERR_TRANSFORM_ALREADY_TRANSFORMING,Z=G.ERR_TRANSFORM_WITH_LENGTH_0,J=u2();W2()(W,J);function q(T,A){var P=this._transformState;P.transforming=!1;var j=P.writecb;if(j===null)return this.emit("error",new Q);if(P.writechunk=null,P.writecb=null,A!=null)this.push(A);j(T);var E=this._readableState;if(E.reading=!1,E.needReadable||E.length{U.exports=Y;var G=DB();W2()(Y,G);function Y(Q){if(!(this instanceof Y))return new Y(Q);G.call(this,Q)}Y.prototype._transform=function(Q,K,Z){Z(null,Q)}}),UG=R0((B,U)=>{var G;function Y(P){var j=!1;return function(){if(j)return;j=!0,P.apply(void 0,arguments)}}var Q=c2().codes,K=Q.ERR_MISSING_ARGS,Z=Q.ERR_STREAM_DESTROYED;function J(P){if(P)throw P}function q(P){return P.setHeader&&typeof P.abort==="function"}function W(P,j,E,C){C=Y(C);var N=!1;if(P.on("close",function(){N=!0}),G===void 0)G=f8();G(P,{readable:j,writable:E},function(S){if(S)return C(S);N=!0,C()});var v=!1;return function(S){if(N)return;if(v)return;if(v=!0,q(P))return P.abort();if(typeof P.destroy==="function")return P.destroy();C(S||new Z("pipe"))}}function I(P){P()}function H(P,j){return P.pipe(j)}function T(P){if(!P.length)return J;if(typeof P[P.length-1]!=="function")return J;return P.pop()}function A(){for(var P=arguments.length,j=Array(P),E=0;E0,function($){if(!N)N=$;if($)v.forEach(I);if(M)return;v.forEach(I),C(N)})});return j.reduce(H)}U.exports=A}),x8=R0((B,U)=>{U.exports=Y;var G=S8().EventEmitter;W2()(Y,G),Y.Readable=EB(),Y.Writable=wB(),Y.Duplex=u2(),Y.Transform=DB(),Y.PassThrough=BG(),Y.finished=f8(),Y.pipeline=UG(),Y.Stream=Y;function Y(){G.call(this)}Y.prototype.pipe=function(Q,K){var Z=this;function J(P){if(Q.writable){if(Q.write(P)===!1&&Z.pause)Z.pause()}}Z.on("data",J);function q(){if(Z.readable&&Z.resume)Z.resume()}if(Q.on("drain",q),!Q._isStdio&&(!K||K.end!==!1))Z.on("end",I),Z.on("close",H);var W=!1;function I(){if(W)return;W=!0,Q.end()}function H(){if(W)return;if(W=!0,typeof Q.destroy==="function")Q.destroy()}function T(P){if(A(),G.listenerCount(this,"error")===0)throw P}Z.on("error",T),Q.on("error",T);function A(){Z.removeListener("data",J),Q.removeListener("drain",q),Z.removeListener("end",I),Z.removeListener("close",H),Z.removeListener("error",T),Q.removeListener("error",T),Z.removeListener("end",A),Z.removeListener("close",A),Q.removeListener("close",A)}return Z.on("end",A),Z.on("close",A),Q.on("close",A),Q.emit("pipe",Z),Q}}),GG=R0((B)=>{(function(U){U.parser=function(w,L){return new Y(w,L)},U.SAXParser=Y,U.SAXStream=I,U.createStream=W,U.MAX_BUFFER_LENGTH=65536;var G=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];U.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Y(w,L){if(!(this instanceof Y))return new Y(w,L);var u=this;if(K(u),u.q=u.c="",u.bufferCheckPosition=U.MAX_BUFFER_LENGTH,u.opt=L||{},u.opt.lowercase=u.opt.lowercase||u.opt.lowercasetags,u.looseCase=u.opt.lowercase?"toLowerCase":"toUpperCase",u.tags=[],u.closed=u.closedRoot=u.sawRoot=!1,u.tag=u.error=null,u.strict=!!w,u.noscript=!!(w||u.opt.noscript),u.state=z.BEGIN,u.strictEntities=u.opt.strictEntities,u.ENTITIES=u.strictEntities?Object.create(U.XML_ENTITIES):Object.create(U.ENTITIES),u.attribList=[],u.opt.xmlns)u.ns=Object.create(j);if(u.trackPosition=u.opt.position!==!1,u.trackPosition)u.position=u.line=u.column=0;U0(u,"onready")}if(!Object.create)Object.create=function(w){function L(){}return L.prototype=w,new L};if(!Object.keys)Object.keys=function(w){var L=[];for(var u in w)if(w.hasOwnProperty(u))L.push(u);return L};function Q(w){var L=Math.max(U.MAX_BUFFER_LENGTH,10),u=0;for(var h=0,Z0=G.length;hL)switch(G[h]){case"textNode":c(w);break;case"cdata":b(w,"oncdata",w.cdata),w.cdata="";break;case"script":b(w,"onscript",w.script),w.script="";break;default:m(w,"Max buffer length exceeded: "+G[h])}u=Math.max(u,g)}w.bufferCheckPosition=U.MAX_BUFFER_LENGTH-u+w.position}function K(w){for(var L=0,u=G.length;L"||S(w)}function $(w,L){return w.test(L)}function x(w,L){return!$(w,L)}var z=0;U.STATE={BEGIN:z++,BEGIN_WHITESPACE:z++,TEXT:z++,TEXT_ENTITY:z++,OPEN_WAKA:z++,SGML_DECL:z++,SGML_DECL_QUOTED:z++,DOCTYPE:z++,DOCTYPE_QUOTED:z++,DOCTYPE_DTD:z++,DOCTYPE_DTD_QUOTED:z++,COMMENT_STARTING:z++,COMMENT:z++,COMMENT_ENDING:z++,COMMENT_ENDED:z++,CDATA:z++,CDATA_ENDING:z++,CDATA_ENDING_2:z++,PROC_INST:z++,PROC_INST_BODY:z++,PROC_INST_ENDING:z++,OPEN_TAG:z++,OPEN_TAG_SLASH:z++,ATTRIB:z++,ATTRIB_NAME:z++,ATTRIB_NAME_SAW_WHITE:z++,ATTRIB_VALUE:z++,ATTRIB_VALUE_QUOTED:z++,ATTRIB_VALUE_CLOSED:z++,ATTRIB_VALUE_UNQUOTED:z++,ATTRIB_VALUE_ENTITY_Q:z++,ATTRIB_VALUE_ENTITY_U:z++,CLOSE_TAG:z++,CLOSE_TAG_SAW_WHITE:z++,SCRIPT:z++,SCRIPT_ENDING:z++},U.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},U.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(U.ENTITIES).forEach(function(w){var L=U.ENTITIES[w],u=typeof L==="number"?String.fromCharCode(L):L;U.ENTITIES[w]=u});for(var a in U.STATE)U.STATE[U.STATE[a]]=a;z=U.STATE;function U0(w,L,u){w[L]&&w[L](u)}function b(w,L,u){if(w.textNode)c(w);U0(w,L,u)}function c(w){if(w.textNode=D(w.opt,w.textNode),w.textNode)U0(w,"ontext",w.textNode);w.textNode=""}function D(w,L){if(w.trim)L=L.trim();if(w.normalize)L=L.replace(/\s+/g," ");return L}function m(w,L){if(c(w),w.trackPosition)L+=` +Line: `+w.line+` +Column: `+w.column+` +Char: `+w.c;return L=Error(L),w.error=L,U0(w,"onerror",L),w}function B0(w){if(w.sawRoot&&!w.closedRoot)i(w,"Unclosed root tag");if(w.state!==z.BEGIN&&w.state!==z.BEGIN_WHITESPACE&&w.state!==z.TEXT)m(w,"Unexpected end");return c(w),w.c="",w.closed=!0,U0(w,"onend"),Y.call(w,w.strict,w.opt),w}function i(w,L){if(typeof w!=="object"||!(w instanceof Y))throw Error("bad call to strictFail");if(w.strict)m(w,L)}function V0(w){if(!w.strict)w.tagName=w.tagName[w.looseCase]();var L=w.tags[w.tags.length-1]||w,u=w.tag={name:w.tagName,attributes:{}};if(w.opt.xmlns)u.ns=L.ns;w.attribList.length=0,b(w,"onopentagstart",u)}function s(w,L){var u=w.indexOf(":")<0?["",w]:w.split(":"),h=u[0],Z0=u[1];if(L&&w==="xmlns")h="xmlns",Z0="";return{prefix:h,local:Z0}}function G0(w){if(!w.strict)w.attribName=w.attribName[w.looseCase]();if(w.attribList.indexOf(w.attribName)!==-1||w.tag.attributes.hasOwnProperty(w.attribName)){w.attribName=w.attribValue="";return}if(w.opt.xmlns){var L=s(w.attribName,!0),u=L.prefix,h=L.local;if(u==="xmlns")if(h==="xml"&&w.attribValue!==A)i(w,"xml: prefix must be bound to "+A+` +Actual: `+w.attribValue);else if(h==="xmlns"&&w.attribValue!==P)i(w,"xmlns: prefix must be bound to "+P+` +Actual: `+w.attribValue);else{var Z0=w.tag,g=w.tags[w.tags.length-1]||w;if(Z0.ns===g.ns)Z0.ns=Object.create(g.ns);Z0.ns[h]=w.attribValue}w.attribList.push([w.attribName,w.attribValue])}else w.tag.attributes[w.attribName]=w.attribValue,b(w,"onattribute",{name:w.attribName,value:w.attribValue});w.attribName=w.attribValue=""}function r(w,L){if(w.opt.xmlns){var u=w.tag,h=s(w.tagName);if(u.prefix=h.prefix,u.local=h.local,u.uri=u.ns[h.prefix]||"",u.prefix&&!u.uri)i(w,"Unbound namespace prefix: "+JSON.stringify(w.tagName)),u.uri=h.prefix;var Z0=w.tags[w.tags.length-1]||w;if(u.ns&&Z0.ns!==u.ns)Object.keys(u.ns).forEach(function(d){b(w,"onopennamespace",{prefix:d,uri:u.ns[d]})});for(var g=0,f=w.attribList.length;g",w.tagName="",w.state=z.SCRIPT;return}b(w,"onscript",w.script),w.script=""}var L=w.tags.length,u=w.tagName;if(!w.strict)u=u[w.looseCase]();var h=u;while(L--)if(w.tags[L].name!==h)i(w,"Unexpected close tag");else break;if(L<0){i(w,"Unmatched closing tag: "+w.tagName),w.textNode+="",w.state=z.TEXT;return}w.tagName=u;var Z0=w.tags.length;while(Z0-- >L){var g=w.tag=w.tags.pop();w.tagName=w.tag.name,b(w,"onclosetag",w.tagName);var f={};for(var R in g.ns)f[R]=g.ns[R];var p=w.tags[w.tags.length-1]||w;if(w.opt.xmlns&&g.ns!==p.ns)Object.keys(g.ns).forEach(function(k){var V=g.ns[k];b(w,"onclosenamespace",{prefix:k,uri:V})})}if(L===0)w.closedRoot=!0;w.tagName=w.attribValue=w.attribName="",w.attribList.length=0,w.state=z.TEXT}function n(w){var L=w.entity,u=L.toLowerCase(),h,Z0="";if(w.ENTITIES[L])return w.ENTITIES[L];if(w.ENTITIES[u])return w.ENTITIES[u];if(L=u,L.charAt(0)==="#")if(L.charAt(1)==="x")L=L.slice(2),h=parseInt(L,16),Z0=h.toString(16);else L=L.slice(1),h=parseInt(L,10),Z0=h.toString(10);if(L=L.replace(/^0+/,""),isNaN(h)||Z0.toLowerCase()!==L)return i(w,"Invalid character entity"),"&"+w.entity+";";return String.fromCodePoint(h)}function o(w,L){if(L==="<")w.state=z.OPEN_WAKA,w.startTagPosition=w.position;else if(!S(L))i(w,"Non-whitespace before first tag."),w.textNode=L,w.state=z.TEXT}function Y0(w,L){var u="";if(L")b(L,"onsgmldeclaration",L.sgmlDecl),L.sgmlDecl="",L.state=z.TEXT;else if(F(h))L.state=z.SGML_DECL_QUOTED,L.sgmlDecl+=h;else L.sgmlDecl+=h;continue;case z.SGML_DECL_QUOTED:if(h===L.q)L.state=z.SGML_DECL,L.q="";L.sgmlDecl+=h;continue;case z.DOCTYPE:if(h===">")L.state=z.TEXT,b(L,"ondoctype",L.doctype),L.doctype=!0;else if(L.doctype+=h,h==="[")L.state=z.DOCTYPE_DTD;else if(F(h))L.state=z.DOCTYPE_QUOTED,L.q=h;continue;case z.DOCTYPE_QUOTED:if(L.doctype+=h,h===L.q)L.q="",L.state=z.DOCTYPE;continue;case z.DOCTYPE_DTD:if(L.doctype+=h,h==="]")L.state=z.DOCTYPE;else if(F(h))L.state=z.DOCTYPE_DTD_QUOTED,L.q=h;continue;case z.DOCTYPE_DTD_QUOTED:if(L.doctype+=h,h===L.q)L.state=z.DOCTYPE_DTD,L.q="";continue;case z.COMMENT:if(h==="-")L.state=z.COMMENT_ENDING;else L.comment+=h;continue;case z.COMMENT_ENDING:if(h==="-"){if(L.state=z.COMMENT_ENDED,L.comment=D(L.opt,L.comment),L.comment)b(L,"oncomment",L.comment);L.comment=""}else L.comment+="-"+h,L.state=z.COMMENT;continue;case z.COMMENT_ENDED:if(h!==">")i(L,"Malformed comment"),L.comment+="--"+h,L.state=z.COMMENT;else L.state=z.TEXT;continue;case z.CDATA:if(h==="]")L.state=z.CDATA_ENDING;else L.cdata+=h;continue;case z.CDATA_ENDING:if(h==="]")L.state=z.CDATA_ENDING_2;else L.cdata+="]"+h,L.state=z.CDATA;continue;case z.CDATA_ENDING_2:if(h===">"){if(L.cdata)b(L,"oncdata",L.cdata);b(L,"onclosecdata"),L.cdata="",L.state=z.TEXT}else if(h==="]")L.cdata+="]";else L.cdata+="]]"+h,L.state=z.CDATA;continue;case z.PROC_INST:if(h==="?")L.state=z.PROC_INST_ENDING;else if(S(h))L.state=z.PROC_INST_BODY;else L.procInstName+=h;continue;case z.PROC_INST_BODY:if(!L.procInstBody&&S(h))continue;else if(h==="?")L.state=z.PROC_INST_ENDING;else L.procInstBody+=h;continue;case z.PROC_INST_ENDING:if(h===">")b(L,"onprocessinginstruction",{name:L.procInstName,body:L.procInstBody}),L.procInstName=L.procInstBody="",L.state=z.TEXT;else L.procInstBody+="?"+h,L.state=z.PROC_INST_BODY;continue;case z.OPEN_TAG:if($(C,h))L.tagName+=h;else if(V0(L),h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else{if(!S(h))i(L,"Invalid character in tag name");L.state=z.ATTRIB}continue;case z.OPEN_TAG_SLASH:if(h===">")r(L,!0),y(L);else i(L,"Forward-slash in opening tag not followed by >"),L.state=z.ATTRIB;continue;case z.ATTRIB:if(S(h))continue;else if(h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else if($(E,h))L.attribName=h,L.attribValue="",L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case z.ATTRIB_NAME:if(h==="=")L.state=z.ATTRIB_VALUE;else if(h===">")i(L,"Attribute without value"),L.attribValue=L.attribName,G0(L),r(L);else if(S(h))L.state=z.ATTRIB_NAME_SAW_WHITE;else if($(C,h))L.attribName+=h;else i(L,"Invalid attribute name");continue;case z.ATTRIB_NAME_SAW_WHITE:if(h==="=")L.state=z.ATTRIB_VALUE;else if(S(h))continue;else if(i(L,"Attribute without value"),L.tag.attributes[L.attribName]="",L.attribValue="",b(L,"onattribute",{name:L.attribName,value:""}),L.attribName="",h===">")r(L);else if($(E,h))L.attribName=h,L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name"),L.state=z.ATTRIB;continue;case z.ATTRIB_VALUE:if(S(h))continue;else if(F(h))L.q=h,L.state=z.ATTRIB_VALUE_QUOTED;else i(L,"Unquoted attribute value"),L.state=z.ATTRIB_VALUE_UNQUOTED,L.attribValue=h;continue;case z.ATTRIB_VALUE_QUOTED:if(h!==L.q){if(h==="&")L.state=z.ATTRIB_VALUE_ENTITY_Q;else L.attribValue+=h;continue}G0(L),L.q="",L.state=z.ATTRIB_VALUE_CLOSED;continue;case z.ATTRIB_VALUE_CLOSED:if(S(h))L.state=z.ATTRIB;else if(h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else if($(E,h))i(L,"No whitespace between attributes"),L.attribName=h,L.attribValue="",L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case z.ATTRIB_VALUE_UNQUOTED:if(!M(h)){if(h==="&")L.state=z.ATTRIB_VALUE_ENTITY_U;else L.attribValue+=h;continue}if(G0(L),h===">")r(L);else L.state=z.ATTRIB;continue;case z.CLOSE_TAG:if(!L.tagName)if(S(h))continue;else if(x(E,h))if(L.script)L.script+="")y(L);else if($(C,h))L.tagName+=h;else if(L.script)L.script+="")y(L);else i(L,"Invalid characters in closing tag");continue;case z.TEXT_ENTITY:case z.ATTRIB_VALUE_ENTITY_Q:case z.ATTRIB_VALUE_ENTITY_U:var f,R;switch(L.state){case z.TEXT_ENTITY:f=z.TEXT,R="textNode";break;case z.ATTRIB_VALUE_ENTITY_Q:f=z.ATTRIB_VALUE_QUOTED,R="attribValue";break;case z.ATTRIB_VALUE_ENTITY_U:f=z.ATTRIB_VALUE_UNQUOTED,R="attribValue";break}if(h===";")L[R]+=n(L),L.entity="",L.state=f;else if($(L.entity.length?v:N,h))L.entity+=h;else i(L,"Invalid character in entity name"),L[R]+="&"+L.entity+h,L.entity="",L.state=f;continue;default:throw Error(L,"Unknown state: "+L.state)}}if(L.position>=L.bufferCheckPosition)Q(L);return L}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint)(function(){var w=String.fromCharCode,L=Math.floor,u=function(){var h=16384,Z0=[],g,f,R=-1,p=arguments.length;if(!p)return"";var k="";while(++R1114111||L(V)!==V)throw RangeError("Invalid code point: "+V);if(V<=65535)Z0.push(V);else V-=65536,g=(V>>10)+55296,f=V%1024+56320,Z0.push(g,f);if(R+1===p||Z0.length>h)k+=w.apply(null,Z0),Z0.length=0}return k};if(Object.defineProperty)Object.defineProperty(String,"fromCodePoint",{value:u,configurable:!0,writable:!0});else String.fromCodePoint=u})()})(typeof B>"u"?B.sax={}:B)}),_8=R0((B,U)=>{U.exports={isArray:function(G){if(Array.isArray)return Array.isArray(G);return Object.prototype.toString.call(G)==="[object Array]"}}}),h8=R0((B,U)=>{var G=_8().isArray;U.exports={copyOptions:function(Y){var Q,K={};for(Q in Y)if(Y.hasOwnProperty(Q))K[Q]=Y[Q];return K},ensureFlagExists:function(Y,Q){if(!(Y in Q)||typeof Q[Y]!=="boolean")Q[Y]=!1},ensureSpacesExists:function(Y){if(!("spaces"in Y)||typeof Y.spaces!=="number"&&typeof Y.spaces!=="string")Y.spaces=0},ensureAlwaysArrayExists:function(Y){if(!("alwaysArray"in Y)||typeof Y.alwaysArray!=="boolean"&&!G(Y.alwaysArray))Y.alwaysArray=!1},ensureKeyExists:function(Y,Q){if(!(Y+"Key"in Q)||typeof Q[Y+"Key"]!=="string")Q[Y+"Key"]=Q.compact?"_"+Y:Y},checkFnExists:function(Y,Q){return Y+"Fn"in Q}}}),TB=R0((B,U)=>{var G=GG(),Y={on:function(){},parse:function(){}},Q=h8(),K=_8().isArray,Z,J=!0,q;function W(F){return Z=Q.copyOptions(F),Q.ensureFlagExists("ignoreDeclaration",Z),Q.ensureFlagExists("ignoreInstruction",Z),Q.ensureFlagExists("ignoreAttributes",Z),Q.ensureFlagExists("ignoreText",Z),Q.ensureFlagExists("ignoreComment",Z),Q.ensureFlagExists("ignoreCdata",Z),Q.ensureFlagExists("ignoreDoctype",Z),Q.ensureFlagExists("compact",Z),Q.ensureFlagExists("alwaysChildren",Z),Q.ensureFlagExists("addParent",Z),Q.ensureFlagExists("trim",Z),Q.ensureFlagExists("nativeType",Z),Q.ensureFlagExists("nativeTypeAttributes",Z),Q.ensureFlagExists("sanitize",Z),Q.ensureFlagExists("instructionHasAttributes",Z),Q.ensureFlagExists("captureSpacesBetweenElements",Z),Q.ensureAlwaysArrayExists(Z),Q.ensureKeyExists("declaration",Z),Q.ensureKeyExists("instruction",Z),Q.ensureKeyExists("attributes",Z),Q.ensureKeyExists("text",Z),Q.ensureKeyExists("comment",Z),Q.ensureKeyExists("cdata",Z),Q.ensureKeyExists("doctype",Z),Q.ensureKeyExists("type",Z),Q.ensureKeyExists("name",Z),Q.ensureKeyExists("elements",Z),Q.ensureKeyExists("parent",Z),Q.checkFnExists("doctype",Z),Q.checkFnExists("instruction",Z),Q.checkFnExists("cdata",Z),Q.checkFnExists("comment",Z),Q.checkFnExists("text",Z),Q.checkFnExists("instructionName",Z),Q.checkFnExists("elementName",Z),Q.checkFnExists("attributeName",Z),Q.checkFnExists("attributeValue",Z),Q.checkFnExists("attributes",Z),Z}function I(F){var M=Number(F);if(!isNaN(M))return M;var $=F.toLowerCase();if($==="true")return!0;else if($==="false")return!1;return F}function H(F,M){var $;if(Z.compact){if(!q[Z[F+"Key"]]&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(Z[F+"Key"])!==-1:Z.alwaysArray))q[Z[F+"Key"]]=[];if(q[Z[F+"Key"]]&&!K(q[Z[F+"Key"]]))q[Z[F+"Key"]]=[q[Z[F+"Key"]]];if(F+"Fn"in Z&&typeof M==="string")M=Z[F+"Fn"](M,q);if(F==="instruction"&&(("instructionFn"in Z)||("instructionNameFn"in Z))){for($ in M)if(M.hasOwnProperty($))if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);else{var x=M[$];delete M[$],M[Z.instructionNameFn($,x,q)]=x}}if(K(q[Z[F+"Key"]]))q[Z[F+"Key"]].push(M);else q[Z[F+"Key"]]=M}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];var z={};if(z[Z.typeKey]=F,F==="instruction"){for($ in M)if(M.hasOwnProperty($))break;if(z[Z.nameKey]="instructionNameFn"in Z?Z.instructionNameFn($,M,q):$,Z.instructionHasAttributes){if(z[Z.attributesKey]=M[$][Z.attributesKey],"instructionFn"in Z)z[Z.attributesKey]=Z.instructionFn(z[Z.attributesKey],$,q)}else{if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);z[Z.instructionKey]=M[$]}}else{if(F+"Fn"in Z)M=Z[F+"Fn"](M,q);z[Z[F+"Key"]]=M}if(Z.addParent)z[Z.parentKey]=q;q[Z.elementsKey].push(z)}}function T(F){if("attributesFn"in Z&&F)F=Z.attributesFn(F,q);if((Z.trim||("attributeValueFn"in Z)||("attributeNameFn"in Z)||Z.nativeTypeAttributes)&&F){var M;for(M in F)if(F.hasOwnProperty(M)){if(Z.trim)F[M]=F[M].trim();if(Z.nativeTypeAttributes)F[M]=I(F[M]);if("attributeValueFn"in Z)F[M]=Z.attributeValueFn(F[M],M,q);if("attributeNameFn"in Z){var $=F[M];delete F[M],F[Z.attributeNameFn(M,F[M],q)]=$}}}return F}function A(F){var M={};if(F.body&&(F.name.toLowerCase()==="xml"||Z.instructionHasAttributes)){var $=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,x;while((x=$.exec(F.body))!==null)M[x[1]]=x[2]||x[3]||x[4];M=T(M)}if(F.name.toLowerCase()==="xml"){if(Z.ignoreDeclaration)return;if(q[Z.declarationKey]={},Object.keys(M).length)q[Z.declarationKey][Z.attributesKey]=M;if(Z.addParent)q[Z.declarationKey][Z.parentKey]=q}else{if(Z.ignoreInstruction)return;if(Z.trim)F.body=F.body.trim();var z={};if(Z.instructionHasAttributes&&Object.keys(M).length)z[F.name]={},z[F.name][Z.attributesKey]=M;else z[F.name]=F.body;H("instruction",z)}}function P(F,M){var $;if(typeof F==="object")M=F.attributes,F=F.name;if(M=T(M),"elementNameFn"in Z)F=Z.elementNameFn(F,q);if(Z.compact){if($={},!Z.ignoreAttributes&&M&&Object.keys(M).length){$[Z.attributesKey]={};var x;for(x in M)if(M.hasOwnProperty(x))$[Z.attributesKey][x]=M[x]}if(!(F in q)&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(F)!==-1:Z.alwaysArray))q[F]=[];if(q[F]&&!K(q[F]))q[F]=[q[F]];if(K(q[F]))q[F].push($);else q[F]=$}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];if($={},$[Z.typeKey]="element",$[Z.nameKey]=F,!Z.ignoreAttributes&&M&&Object.keys(M).length)$[Z.attributesKey]=M;if(Z.alwaysChildren)$[Z.elementsKey]=[];q[Z.elementsKey].push($)}$[Z.parentKey]=q,q=$}function j(F){if(Z.ignoreText)return;if(!F.trim()&&!Z.captureSpacesBetweenElements)return;if(Z.trim)F=F.trim();if(Z.nativeType)F=I(F);if(Z.sanitize)F=F.replace(/&/g,"&").replace(//g,">");H("text",F)}function E(F){if(Z.ignoreComment)return;if(Z.trim)F=F.trim();H("comment",F)}function C(F){var M=q[Z.parentKey];if(!Z.addParent)delete q[Z.parentKey];q=M}function N(F){if(Z.ignoreCdata)return;if(Z.trim)F=F.trim();H("cdata",F)}function v(F){if(Z.ignoreDoctype)return;if(F=F.replace(/^ /,""),Z.trim)F=F.trim();H("doctype",F)}function S(F){F.note=F}U.exports=function(F,M){var $=J?G.parser(!0,{}):$=new Y.Parser("UTF-8"),x={};if(q=x,Z=W(M),J)$.opt={strictEntities:!0},$.onopentag=P,$.ontext=j,$.oncomment=E,$.onclosetag=C,$.onerror=S,$.oncdata=N,$.ondoctype=v,$.onprocessinginstruction=A;else $.on("startElement",P),$.on("text",j),$.on("comment",E),$.on("endElement",C),$.on("error",S);if(J)$.write(F).close();else if(!$.parse(F))throw Error("XML parsing error: "+$.getError());if(x[Z.elementsKey]){var z=x[Z.elementsKey];delete x[Z.elementsKey],x[Z.elementsKey]=z,delete x.text}return x}}),YG=R0((B,U)=>{var G=h8(),Y=TB();function Q(K){var Z=G.copyOptions(K);return G.ensureSpacesExists(Z),Z}U.exports=function(K,Z){var J=Q(Z),q=Y(K,J),W,I="compact"in J&&J.compact?"_parent":"parent";if("addParent"in J&&J.addParent)W=JSON.stringify(q,function(H,T){return H===I?"_":T},J.spaces);else W=JSON.stringify(q,null,J.spaces);return W.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}}),CB=R0((B,U)=>{var G=h8(),Y=_8().isArray,Q,K;function Z(F){var M=G.copyOptions(F);if(G.ensureFlagExists("ignoreDeclaration",M),G.ensureFlagExists("ignoreInstruction",M),G.ensureFlagExists("ignoreAttributes",M),G.ensureFlagExists("ignoreText",M),G.ensureFlagExists("ignoreComment",M),G.ensureFlagExists("ignoreCdata",M),G.ensureFlagExists("ignoreDoctype",M),G.ensureFlagExists("compact",M),G.ensureFlagExists("indentText",M),G.ensureFlagExists("indentCdata",M),G.ensureFlagExists("indentAttributes",M),G.ensureFlagExists("indentInstruction",M),G.ensureFlagExists("fullTagEmptyElement",M),G.ensureFlagExists("noQuotesForNativeAttributes",M),G.ensureSpacesExists(M),typeof M.spaces==="number")M.spaces=Array(M.spaces+1).join(" ");return G.ensureKeyExists("declaration",M),G.ensureKeyExists("instruction",M),G.ensureKeyExists("attributes",M),G.ensureKeyExists("text",M),G.ensureKeyExists("comment",M),G.ensureKeyExists("cdata",M),G.ensureKeyExists("doctype",M),G.ensureKeyExists("type",M),G.ensureKeyExists("name",M),G.ensureKeyExists("elements",M),G.checkFnExists("doctype",M),G.checkFnExists("instruction",M),G.checkFnExists("cdata",M),G.checkFnExists("comment",M),G.checkFnExists("text",M),G.checkFnExists("instructionName",M),G.checkFnExists("elementName",M),G.checkFnExists("attributeName",M),G.checkFnExists("attributeValue",M),G.checkFnExists("attributes",M),G.checkFnExists("fullTagEmptyElement",M),M}function J(F,M,$){return(!$&&F.spaces?` +`:"")+Array(M+1).join(F.spaces)}function q(F,M,$){if(M.ignoreAttributes)return"";if("attributesFn"in M)F=M.attributesFn(F,K,Q);var x,z,a,U0,b=[];for(x in F)if(F.hasOwnProperty(x)&&F[x]!==null&&F[x]!==void 0)U0=M.noQuotesForNativeAttributes&&typeof F[x]!=="string"?"":'"',z=""+F[x],z=z.replace(/"/g,"""),a="attributeNameFn"in M?M.attributeNameFn(x,z,K,Q):x,b.push(M.spaces&&M.indentAttributes?J(M,$+1,!1):" "),b.push(a+"="+U0+("attributeValueFn"in M?M.attributeValueFn(z,x,K,Q):z)+U0);if(F&&Object.keys(F).length&&M.spaces&&M.indentAttributes)b.push(J(M,$,!1));return b.join("")}function W(F,M,$){return Q=F,K="xml",M.ignoreDeclaration?"":""}function I(F,M,$){if(M.ignoreInstruction)return"";var x;for(x in F)if(F.hasOwnProperty(x))break;var z="instructionNameFn"in M?M.instructionNameFn(x,F[x],K,Q):x;if(typeof F[x]==="object")return Q=F,K=z,"";else{var a=F[x]?F[x]:"";if("instructionFn"in M)a=M.instructionFn(a,x,K,Q);return""}}function H(F,M){return M.ignoreComment?"":""}function T(F,M){return M.ignoreCdata?"":"","]]]]>"))+"]]>"}function A(F,M){return M.ignoreDoctype?"":""}function P(F,M){if(M.ignoreText)return"";return F=""+F,F=F.replace(/&/g,"&"),F=F.replace(/&/g,"&").replace(//g,">"),"textFn"in M?M.textFn(F,K,Q):F}function j(F,M){var $;if(F.elements&&F.elements.length)for($=0;$"),F[M.elementsKey]&&F[M.elementsKey].length)x.push(C(F[M.elementsKey],M,$+1)),Q=F,K=F.name;x.push(M.spaces&&j(F,M)?` +`+Array($+1).join(M.spaces):""),x.push("")}else x.push("/>");return x.join("")}function C(F,M,$,x){return F.reduce(function(z,a){var U0=J(M,$,x&&!z);switch(a.type){case"element":return z+U0+E(a,M,$);case"comment":return z+U0+H(a[M.commentKey],M);case"doctype":return z+U0+A(a[M.doctypeKey],M);case"cdata":return z+(M.indentCdata?U0:"")+T(a[M.cdataKey],M);case"text":return z+(M.indentText?U0:"")+P(a[M.textKey],M);case"instruction":var b={};return b[a[M.nameKey]]=a[M.attributesKey]?a:a[M.instructionKey],z+(M.indentInstruction?U0:"")+I(b,M,$)}},"")}function N(F,M,$){var x;for(x in F)if(F.hasOwnProperty(x))switch(x){case M.parentKey:case M.attributesKey:break;case M.textKey:if(M.indentText||$)return!0;break;case M.cdataKey:if(M.indentCdata||$)return!0;break;case M.instructionKey:if(M.indentInstruction||$)return!0;break;case M.doctypeKey:case M.commentKey:return!0;default:return!0}return!1}function v(F,M,$,x,z){Q=F,K=M;var a="elementNameFn"in $?$.elementNameFn(M,F):M;if(typeof F>"u"||F===null||F==="")return"fullTagEmptyElementFn"in $&&$.fullTagEmptyElementFn(M,F)||$.fullTagEmptyElement?"<"+a+">":"<"+a+"/>";var U0=[];if(M){if(U0.push("<"+a),typeof F!=="object")return U0.push(">"+P(F,$)+""),U0.join("");if(F[$.attributesKey])U0.push(q(F[$.attributesKey],$,x));var b=N(F,$,!0)||F[$.attributesKey]&&F[$.attributesKey]["xml:space"]==="preserve";if(!b)if("fullTagEmptyElementFn"in $)b=$.fullTagEmptyElementFn(M,F);else b=$.fullTagEmptyElement;if(b)U0.push(">");else return U0.push("/>"),U0.join("")}if(U0.push(S(F,$,x+1,!1)),Q=F,K=M,M)U0.push((z?J($,x,!1):"")+"");return U0.join("")}function S(F,M,$,x){var z,a,U0,b=[];for(a in F)if(F.hasOwnProperty(a)){U0=Y(F[a])?F[a]:[F[a]];for(z=0;z{var G=CB();U.exports=function(Y,Q){if(Y instanceof Buffer)Y=Y.toString();var K=null;if(typeof Y==="string")try{K=JSON.parse(Y)}catch(Z){throw Error("The JSON structure is invalid")}else K=Y;return G(K,Q)}}),h1=R0((B,U)=>{U.exports={xml2js:TB(),xml2json:YG(),js2xml:CB(),json2xml:ZG()}})(),u1=(B)=>{switch(B.type){case void 0:case"element":let U=new kB(B.name,B.attributes),G=B.elements||[];for(let Y of G){let Q=u1(Y);if(Q!==void 0)U.push(Q)}return U;case"text":return B.text;default:return}},QG=class extends H0{},kB=class extends t{static fromXmlString(B){return u1((0,h1.xml2js)(B,{compact:!1}))}constructor(B,U){super(B);if(U)this.root.push(new QG(U))}push(B){this.root.push(B)}},$B=class extends t{constructor(B){super("");e(this,"_attr",void 0),this._attr=B}prepForXml(B){return{_attr:this._attr}}},JG="",u8=class extends t{constructor(B,U){super(B);if(U)this.root=U.root}},T0=(B)=>{if(isNaN(B))throw Error(`Invalid value '${B}' specified. Must be an integer.`);return Math.floor(B)},X1=(B)=>{let U=T0(B);if(U<0)throw Error(`Invalid value '${B}' specified. Must be a positive integer.`);return U},d1=(B,U)=>{let G=U*2;if(B.length!==G||isNaN(Number(`0x${B}`)))throw Error(`Invalid hex value '${B}'. Expected ${G} digit hex value`);return B},KG=(B)=>d1(B,4),SB=(B)=>d1(B,2),W8=(B)=>d1(B,1),q1=(B)=>{let U=B.slice(-2),G=B.substring(0,B.length-2);return`${Number(G)}${U}`},d8=(B)=>{let U=q1(B);if(parseFloat(U)<0)throw Error(`Invalid value '${U}' specified. Expected a positive number.`);return U},C2=(B)=>{if(B==="auto")return B;return d1(B.charAt(0)==="#"?B.substring(1):B,3)},t0=(B)=>typeof B==="string"?q1(B):T0(B),bB=(B)=>typeof B==="string"?d8(B):X1(B),VG=(B)=>typeof B==="string"?q1(B):T0(B),E0=(B)=>typeof B==="string"?d8(B):X1(B),vB=(B)=>{let U=B.substring(0,B.length-1);return`${Number(U)}%`},c8=(B)=>{if(typeof B==="number")return T0(B);if(B.slice(-1)==="%")return vB(B);return q1(B)},yB=X1,gB=X1,fB=(B)=>B.toISOString(),q0=class extends t{constructor(B,U=!0){super(B);if(U!==!0)this.root.push(new C0({val:U}))}},D1=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:bB(U)}))}},S0=class extends t{},q2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},f2=(B,U)=>new M0({name:B,attributes:{value:{key:"w:val",value:U}}}),_2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},XG=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},O2=class extends t{constructor(B,U){super(B);this.root.push(U)}},M0=class extends t{constructor({name:B,attributes:U,children:G}){super(B);if(U)this.root.push(new $8(U));if(G)this.root.push(...G)}},c0={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},m8=(B)=>new M0({name:"w:jc",attributes:{val:{key:"w:val",value:B}}}),j0=(B,{color:U,size:G,space:Y,style:Q})=>new M0({name:B,attributes:{style:{key:"w:val",value:Q},color:{key:"w:color",value:U===void 0?void 0:C2(U)},size:{key:"w:sz",value:G===void 0?void 0:yB(G)},space:{key:"w:space",value:Y===void 0?void 0:gB(Y)}}}),c1={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},xB=class extends R2{constructor(B){super("w:pBdr");if(B.top)this.root.push(j0("w:top",B.top));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.left)this.root.push(j0("w:left",B.left));if(B.right)this.root.push(j0("w:right",B.right));if(B.between)this.root.push(j0("w:between",B.between))}},_B=class extends t{constructor(){super("w:pBdr");let B=j0("w:bottom",{color:"auto",space:1,style:c1.SINGLE,size:6});this.root.push(B)}},hB=({start:B,end:U,left:G,right:Y,hanging:Q,firstLine:K,firstLineChars:Z})=>new M0({name:"w:ind",attributes:{start:{key:"w:start",value:B===void 0?void 0:t0(B)},end:{key:"w:end",value:U===void 0?void 0:t0(U)},left:{key:"w:left",value:G===void 0?void 0:t0(G)},right:{key:"w:right",value:Y===void 0?void 0:t0(Y)},hanging:{key:"w:hanging",value:Q===void 0?void 0:E0(Q)},firstLine:{key:"w:firstLine",value:K===void 0?void 0:E0(K)},firstLineChars:{key:"w:firstLineChars",value:Z===void 0?void 0:T0(Z)}}}),uB=()=>new M0({name:"w:br"}),l8={BEGIN:"begin",END:"end",SEPARATE:"separate"},a8=(B,U)=>new M0({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:B},dirty:{key:"w:dirty",value:U}}}),e0=(B)=>a8(l8.BEGIN,B),X2=(B)=>a8(l8.SEPARATE,B),B2=(B)=>a8(l8.END,B),qG={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},MG={BOTTOM:"bottom",CENTER:"center",INSIDE:"inside",OUTSIDE:"outside",TOP:"top"},RG={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},x0={DEFAULT:"default",PRESERVE:"preserve"},_0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{space:"xml:space"})}},LG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},IG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},OG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},HG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTION")}},M1=({fill:B,color:U,type:G})=>new M0({name:"w:shd",attributes:{fill:{key:"w:fill",value:B===void 0?void 0:C2(B)},color:{key:"w:color",value:U===void 0?void 0:C2(U)},type:{key:"w:val",value:G}}}),FG={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},b0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},WG=class extends t{constructor(B){super("w:del");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},PG=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},p8={DOT:"dot"},r8=(B=p8.DOT)=>new M0({name:"w:em",attributes:{val:{key:"w:val",value:B}}}),AG=()=>r8(p8.DOT),jG=class extends t{constructor(B){super("w:spacing");this.root.push(new C0({val:t0(B)}))}},NG=class extends t{constructor(B){super("w:color");this.root.push(new C0({val:C2(B)}))}},zG=class extends t{constructor(B){super("w:highlight");this.root.push(new C0({val:B}))}},wG=class extends t{constructor(B){super("w:highlightCs");this.root.push(new C0({val:B}))}},EG=(B)=>new M0({name:"w:lang",attributes:{value:{key:"w:val",value:B.value},eastAsia:{key:"w:eastAsia",value:B.eastAsia},bidirectional:{key:"w:bidi",value:B.bidirectional}}}),T1=(B,U)=>{if(typeof B==="string"){let Y=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:Y},cs:{key:"w:cs",value:Y},eastAsia:{key:"w:eastAsia",value:Y},hAnsi:{key:"w:hAnsi",value:Y},hint:{key:"w:hint",value:U}}})}let G=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:G.ascii},cs:{key:"w:cs",value:G.cs},eastAsia:{key:"w:eastAsia",value:G.eastAsia},hAnsi:{key:"w:hAnsi",value:G.hAnsi},hint:{key:"w:hint",value:G.hint}}})},dB=(B)=>new M0({name:"w:vertAlign",attributes:{val:{key:"w:val",value:B}}}),DG=()=>dB("superscript"),TG=()=>dB("subscript"),i8={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},cB=(B=i8.SINGLE,U)=>new M0({name:"w:u",attributes:{val:{key:"w:val",value:B},color:{key:"w:color",value:U===void 0?void 0:C2(U)}}}),CG={BLINK_BACKGROUND:"blinkBackground",LIGHTS:"lights",ANTS_BLACK:"antsBlack",ANTS_RED:"antsRed",SHIMMER:"shimmer",SPARKLE:"sparkle",NONE:"none"},kG={BLACK:"black",BLUE:"blue",CYAN:"cyan",DARK_BLUE:"darkBlue",DARK_CYAN:"darkCyan",DARK_GRAY:"darkGray",DARK_GREEN:"darkGreen",DARK_MAGENTA:"darkMagenta",DARK_RED:"darkRed",DARK_YELLOW:"darkYellow",GREEN:"green",LIGHT_GRAY:"lightGray",MAGENTA:"magenta",NONE:"none",RED:"red",WHITE:"white",YELLOW:"yellow"},U2=class extends R2{constructor(B){super("w:rPr");if(!B)return;if(B.style)this.push(new q2("w:rStyle",B.style));if(B.font)if(typeof B.font==="string")this.push(T1(B.font));else if("name"in B.font)this.push(T1(B.font.name,B.font.hint));else this.push(T1(B.font));if(B.bold!==void 0)this.push(new q0("w:b",B.bold));if(B.boldComplexScript===void 0&&B.bold!==void 0||B.boldComplexScript){var U;this.push(new q0("w:bCs",(U=B.boldComplexScript)!==null&&U!==void 0?U:B.bold))}if(B.italics!==void 0)this.push(new q0("w:i",B.italics));if(B.italicsComplexScript===void 0&&B.italics!==void 0||B.italicsComplexScript){var G;this.push(new q0("w:iCs",(G=B.italicsComplexScript)!==null&&G!==void 0?G:B.italics))}if(B.smallCaps!==void 0)this.push(new q0("w:smallCaps",B.smallCaps));else if(B.allCaps!==void 0)this.push(new q0("w:caps",B.allCaps));if(B.strike!==void 0)this.push(new q0("w:strike",B.strike));if(B.doubleStrike!==void 0)this.push(new q0("w:dstrike",B.doubleStrike));if(B.emboss!==void 0)this.push(new q0("w:emboss",B.emboss));if(B.imprint!==void 0)this.push(new q0("w:imprint",B.imprint));if(B.noProof!==void 0)this.push(new q0("w:noProof",B.noProof));if(B.snapToGrid!==void 0)this.push(new q0("w:snapToGrid",B.snapToGrid));if(B.vanish)this.push(new q0("w:vanish",B.vanish));if(B.color)this.push(new NG(B.color));if(B.characterSpacing)this.push(new jG(B.characterSpacing));if(B.scale!==void 0)this.push(new _2("w:w",B.scale));if(B.kern)this.push(new D1("w:kern",B.kern));if(B.position)this.push(new q2("w:position",B.position));if(B.size!==void 0)this.push(new D1("w:sz",B.size));let Y=B.sizeComplexScript===void 0||B.sizeComplexScript===!0?B.size:B.sizeComplexScript;if(Y)this.push(new D1("w:szCs",Y));if(B.highlight)this.push(new zG(B.highlight));let Q=B.highlightComplexScript===void 0||B.highlightComplexScript===!0?B.highlight:B.highlightComplexScript;if(Q)this.push(new wG(Q));if(B.underline)this.push(cB(B.underline.type,B.underline.color));if(B.effect)this.push(new q2("w:effect",B.effect));if(B.border)this.push(j0("w:bdr",B.border));if(B.shading)this.push(M1(B.shading));if(B.subScript)this.push(TG());if(B.superScript)this.push(DG());if(B.rightToLeft!==void 0)this.push(new q0("w:rtl",B.rightToLeft));if(B.emphasisMark)this.push(r8(B.emphasisMark.type));if(B.language)this.push(EG(B.language));if(B.specVanish)this.push(new q0("w:specVanish",B.vanish));if(B.math)this.push(new q0("w:oMath",B.math));if(B.revision)this.push(new lB(B.revision))}push(B){this.root.push(B)}},mB=class extends U2{constructor(B){super(B);if(B===null||B===void 0?void 0:B.insertion)this.push(new PG(B.insertion));if(B===null||B===void 0?void 0:B.deletion)this.push(new WG(B.deletion))}},lB=class extends t{constructor(B){super("w:rPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new U2(B))}},Z1=class extends t{constructor(B){super("w:t");if(typeof B==="string")this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B);else{var U;this.root.push(new _0({space:(U=B.space)!==null&&U!==void 0?U:x0.DEFAULT})),this.root.push(B.text)}}},F2={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},D0=class extends t{constructor(B){super("w:r");if(e(this,"properties",void 0),this.properties=new U2(B),this.root.push(this.properties),B.break)for(let U=0;U{U.exports=G;function G(Y,Q){if(!Y)throw Error(Q||"Assertion failed")}G.equal=function(Q,K,Z){if(Q!=K)throw Error(Z||"Assertion failed: "+Q+" != "+K)}}),G2=R0((B)=>{var U=R1();B.inherits=W2();function G(b,c){if((b.charCodeAt(c)&64512)!==55296)return!1;if(c<0||c+1>=b.length)return!1;return(b.charCodeAt(c+1)&64512)===56320}function Y(b,c){if(Array.isArray(b))return b.slice();if(!b)return[];var D=[];if(typeof b==="string"){if(!c){var m=0;for(var B0=0;B0>6|192,D[m++]=i&63|128;else if(G(b,B0))i=65536+((i&1023)<<10)+(b.charCodeAt(++B0)&1023),D[m++]=i>>18|240,D[m++]=i>>12&63|128,D[m++]=i>>6&63|128,D[m++]=i&63|128;else D[m++]=i>>12|224,D[m++]=i>>6&63|128,D[m++]=i&63|128}}else if(c==="hex"){if(b=b.replace(/[^a-z0-9]+/gi,""),b.length%2!==0)b="0"+b;for(B0=0;B0>>24|b>>>8&65280|b<<8&16711680|(b&255)<<24)>>>0}B.htonl=K;function Z(b,c){var D="";for(var m=0;m>>0}return i}B.join32=W;function I(b,c){var D=Array(b.length*4);for(var m=0,B0=0;m>>24,D[B0+1]=i>>>16&255,D[B0+2]=i>>>8&255,D[B0+3]=i&255;else D[B0+3]=i>>>24,D[B0+2]=i>>>16&255,D[B0+1]=i>>>8&255,D[B0]=i&255}return D}B.split32=I;function H(b,c){return b>>>c|b<<32-c}B.rotr32=H;function T(b,c){return b<>>32-c}B.rotl32=T;function A(b,c){return b+c>>>0}B.sum32=A;function P(b,c,D){return b+c+D>>>0}B.sum32_3=P;function j(b,c,D,m){return b+c+D+m>>>0}B.sum32_4=j;function E(b,c,D,m,B0){return b+c+D+m+B0>>>0}B.sum32_5=E;function C(b,c,D,m){var B0=b[c],i=m+b[c+1]>>>0;b[c]=(i>>0,b[c+1]=i}B.sum64=C;function N(b,c,D,m){return(c+m>>>0>>0}B.sum64_hi=N;function v(b,c,D,m){return c+m>>>0}B.sum64_lo=v;function S(b,c,D,m,B0,i,V0,s){var G0=0,r=c;return r=r+m>>>0,G0+=r>>0,G0+=r>>0,G0+=r>>0}B.sum64_4_hi=S;function F(b,c,D,m,B0,i,V0,s){return c+m+i+s>>>0}B.sum64_4_lo=F;function M(b,c,D,m,B0,i,V0,s,G0,r){var y=0,n=c;return n=n+m>>>0,y+=n>>0,y+=n>>0,y+=n>>0,y+=n>>0}B.sum64_5_hi=M;function $(b,c,D,m,B0,i,V0,s,G0,r){return c+m+i+s+r>>>0}B.sum64_5_lo=$;function x(b,c,D){return(c<<32-D|b>>>D)>>>0}B.rotr64_hi=x;function z(b,c,D){return(b<<32-D|c>>>D)>>>0}B.rotr64_lo=z;function a(b,c,D){return b>>>D}B.shr64_hi=a;function U0(b,c,D){return(b<<32-D|c>>>D)>>>0}B.shr64_lo=U0}),L1=R0((B)=>{var U=G2(),G=R1();function Y(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}B.BlockHash=Y,Y.prototype.update=function(K,Z){if(K=U.toArray(K,Z),!this.pending)this.pending=K;else this.pending=this.pending.concat(K);if(this.pendingTotal+=K.length,this.pending.length>=this._delta8){K=this.pending;var J=K.length%this._delta8;if(this.pending=K.slice(K.length-J,K.length),this.pending.length===0)this.pending=null;K=U.join32(K,0,K.length-J,this.endian);for(var q=0;q>>24&255,q[W++]=K>>>16&255,q[W++]=K>>>8&255,q[W++]=K&255}else{q[W++]=K&255,q[W++]=K>>>8&255,q[W++]=K>>>16&255,q[W++]=K>>>24&255,q[W++]=0,q[W++]=0,q[W++]=0,q[W++]=0;for(I=8;I{var U=G2().rotr32;function G(I,H,T,A){if(I===0)return Y(H,T,A);if(I===1||I===3)return K(H,T,A);if(I===2)return Q(H,T,A)}B.ft_1=G;function Y(I,H,T){return I&H^~I&T}B.ch32=Y;function Q(I,H,T){return I&H^I&T^H&T}B.maj32=Q;function K(I,H,T){return I^H^T}B.p32=K;function Z(I){return U(I,2)^U(I,13)^U(I,22)}B.s0_256=Z;function J(I){return U(I,6)^U(I,11)^U(I,25)}B.s1_256=J;function q(I){return U(I,7)^U(I,18)^I>>>3}B.g0_256=q;function W(I){return U(I,17)^U(I,19)^I>>>10}B.g1_256=W}),SG=R0((B,U)=>{var G=G2(),Y=L1(),Q=pB(),K=G.rotl32,Z=G.sum32,J=G.sum32_5,q=Q.ft_1,W=Y.BlockHash,I=[1518500249,1859775393,2400959708,3395469782];function H(){if(!(this instanceof H))return new H;W.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}G.inherits(H,W),U.exports=H,H.blockSize=512,H.outSize=160,H.hmacStrength=80,H.padLength=64,H.prototype._update=function(A,P){var j=this.W;for(var E=0;E<16;E++)j[E]=A[P+E];for(;E{var G=G2(),Y=L1(),Q=pB(),K=R1(),Z=G.sum32,J=G.sum32_4,q=G.sum32_5,W=Q.ch32,I=Q.maj32,H=Q.s0_256,T=Q.s1_256,A=Q.g0_256,P=Q.g1_256,j=Y.BlockHash,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function C(){if(!(this instanceof C))return new C;j.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=Array(64)}G.inherits(C,j),U.exports=C,C.blockSize=512,C.outSize=256,C.hmacStrength=192,C.padLength=64,C.prototype._update=function(v,S){var F=this.W;for(var M=0;M<16;M++)F[M]=v[S+M];for(;M{var G=G2(),Y=rB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=512,Q.outSize=224,Q.hmacStrength=192,Q.padLength=64,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),iB=R0((B,U)=>{var G=G2(),Y=L1(),Q=R1(),K=G.rotr64_hi,Z=G.rotr64_lo,J=G.shr64_hi,q=G.shr64_lo,W=G.sum64,I=G.sum64_hi,H=G.sum64_lo,T=G.sum64_4_hi,A=G.sum64_4_lo,P=G.sum64_5_hi,j=G.sum64_5_lo,E=Y.BlockHash,C=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function N(){if(!(this instanceof N))return new N;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=C,this.W=Array(160)}G.inherits(N,E),U.exports=N,N.blockSize=1024,N.outSize=512,N.hmacStrength=192,N.padLength=128,N.prototype._prepareBlock=function(B0,i){var V0=this.W;for(var s=0;s<32;s++)V0[s]=B0[i+s];for(;s{var G=G2(),Y=iB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=1024,Q.outSize=384,Q.hmacStrength=192,Q.padLength=128,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),yG=R0((B)=>{B.sha1=SG(),B.sha224=bG(),B.sha256=rB(),B.sha384=vG(),B.sha512=iB()}),gG=R0((B)=>{var U=G2(),G=L1(),Y=U.rotl32,Q=U.sum32,K=U.sum32_3,Z=U.sum32_4,J=G.BlockHash;function q(){if(!(this instanceof q))return new q;J.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}U.inherits(q,J),B.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(C,N){var v=this.h[0],S=this.h[1],F=this.h[2],M=this.h[3],$=this.h[4],x=v,z=S,a=F,U0=M,b=$;for(var c=0;c<80;c++){var D=Q(Y(Z(v,W(c,S,F,M),C[T[c]+N],I(c)),P[c]),$);v=$,$=M,M=Y(F,10),F=S,S=D,D=Q(Y(Z(x,W(79-c,z,a,U0),C[A[c]+N],H(c)),j[c]),b),x=b,b=U0,U0=Y(a,10),a=z,z=D}D=K(this.h[1],F,U0),this.h[1]=K(this.h[2],M,b),this.h[2]=K(this.h[3],$,x),this.h[3]=K(this.h[4],v,z),this.h[4]=K(this.h[0],S,a),this.h[0]=D},q.prototype._digest=function(C){if(C==="hex")return U.toHex32(this.h,"little");else return U.split32(this.h,"little")};function W(E,C,N,v){if(E<=15)return C^N^v;else if(E<=31)return C&N|~C&v;else if(E<=47)return(C|~N)^v;else if(E<=63)return C&v|N&~v;else return C^(N|~v)}function I(E){if(E<=15)return 0;else if(E<=31)return 1518500249;else if(E<=47)return 1859775393;else if(E<=63)return 2400959708;else return 2840853838}function H(E){if(E<=15)return 1352829926;else if(E<=31)return 1548603684;else if(E<=47)return 1836072691;else if(E<=63)return 2053994217;else return 0}var T=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],A=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],P=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],j=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),fG=R0((B,U)=>{var G=G2(),Y=R1();function Q(K,Z,J){if(!(this instanceof Q))return new Q(K,Z,J);this.Hash=K,this.blockSize=K.blockSize/8,this.outSize=K.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(Z,J))}U.exports=Q,Q.prototype._init=function(Z){if(Z.length>this.blockSize)Z=new this.Hash().update(Z).digest();Y(Z.length<=this.blockSize);for(var J=Z.length;J{var U=B;U.utils=G2(),U.common=L1(),U.sha=yG(),U.ripemd=gG(),U.hmac=fG(),U.sha1=U.sha.sha1,U.sha256=U.sha.sha256,U.sha224=U.sha.sha224,U.sha384=U.sha.sha384,U.sha512=U.sha.sha512,U.ripemd160=U.ripemd.ripemd160})(),1),_G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",hG=(B,U=21)=>{return(G=U)=>{let Y="",Q=G|0;while(Q--)Y+=B[Math.random()*B.length|0];return Y}},uG=(B=21)=>{let U="",G=B|0;while(G--)U+=_G[Math.random()*64|0];return U},dG=(B)=>Math.floor(B/25.4*72*20),u0=(B)=>Math.floor(B*72*20),I1=(B=0)=>{let U=B;return()=>++U},nB=()=>I1(),sB=()=>I1(1),oB=()=>I1(),tB=()=>I1(),O1=()=>uG().toLowerCase(),P8=(B)=>xG.default.sha1().update(B instanceof ArrayBuffer?new Uint8Array(B):B).digest("hex"),s2=(B)=>hG("1234567890abcdef",B)(),eB=()=>`${s2(8)}-${s2(4)}-${s2(4)}-${s2(4)}-${s2(12)}`,U1=(B)=>new Uint8Array(new TextEncoder().encode(B)),B4={CHARACTER:"character",COLUMN:"column",INSIDE_MARGIN:"insideMargin",LEFT_MARGIN:"leftMargin",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",RIGHT_MARGIN:"rightMargin"},U4={BOTTOM_MARGIN:"bottomMargin",INSIDE_MARGIN:"insideMargin",LINE:"line",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",PARAGRAPH:"paragraph",TOP_MARGIN:"topMargin"},G4=()=>new M0({name:"wp:simplePos",attributes:{x:{key:"x",value:0},y:{key:"y",value:0}}}),Y4=(B)=>new M0({name:"wp:align",children:[B]}),Z4=(B)=>new M0({name:"wp:posOffset",children:[B.toString()]}),Q4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionH",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:B4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),J4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionV",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:U4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),cG=function(B){return B.CENTER="ctr",B.TOP="t",B.BOTTOM="b",B}({}),K4=(B={})=>{var U,G,Y,Q;return new M0({name:"wps:bodyPr",attributes:{lIns:{key:"lIns",value:(U=B.margins)===null||U===void 0?void 0:U.left},rIns:{key:"rIns",value:(G=B.margins)===null||G===void 0?void 0:G.right},tIns:{key:"tIns",value:(Y=B.margins)===null||Y===void 0?void 0:Y.top},bIns:{key:"bIns",value:(Q=B.margins)===null||Q===void 0?void 0:Q.bottom},anchor:{key:"anchor",value:B.verticalAnchor}},children:[...B.noAutoFit?[new q0("a:noAutofit",B.noAutoFit)]:[]]})},mG=(B={txBox:"1"})=>new M0({name:"wps:cNvSpPr",attributes:{txBox:{key:"txBox",value:B.txBox}}}),lG=(B)=>new M0({name:"w:txbxContent",children:[...B]}),aG=(B)=>new M0({name:"wps:txbx",children:[lG(B)]}),pG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{cx:"cx",cy:"cy"})}},rG=class extends t{constructor(B,U){super("a:ext");e(this,"attributes",void 0),this.attributes=new pG({cx:B,cy:U}),this.root.push(this.attributes)}},iG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{x:"x",y:"y"})}},nG=class extends t{constructor(B,U){super("a:off");this.root.push(new iG({x:B!==null&&B!==void 0?B:0,y:U!==null&&U!==void 0?U:0}))}},sG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{flipVertical:"flipV",flipHorizontal:"flipH",rotation:"rot"})}},V4=class extends t{constructor(B){var U,G,Y,Q;super("a:xfrm");e(this,"extents",void 0),e(this,"offset",void 0),this.root.push(new sG({flipVertical:(U=B.flip)===null||U===void 0?void 0:U.vertical,flipHorizontal:(G=B.flip)===null||G===void 0?void 0:G.horizontal,rotation:B.rotation})),this.offset=new nG((Y=B.offset)===null||Y===void 0||(Y=Y.emus)===null||Y===void 0?void 0:Y.x,(Q=B.offset)===null||Q===void 0||(Q=Q.emus)===null||Q===void 0?void 0:Q.y),this.extents=new rG(B.emus.x,B.emus.y),this.root.push(this.offset),this.root.push(this.extents)}},X4=()=>new M0({name:"a:noFill"}),oG=(B)=>new M0({name:"a:srgbClr",attributes:{value:{key:"val",value:B.value}}}),tG=(B)=>new M0({name:"a:schemeClr",attributes:{value:{key:"val",value:B.value}}}),A8=(B)=>new M0({name:"a:solidFill",children:[B.type==="rgb"?oG(B):tG(B)]}),eG=(B)=>new M0({name:"a:ln",attributes:{width:{key:"w",value:B.width},cap:{key:"cap",value:B.cap},compoundLine:{key:"cmpd",value:B.compoundLine},align:{key:"algn",value:B.align}},children:[B.type==="noFill"?X4():B.solidFillType==="rgb"?A8({type:"rgb",value:B.value}):A8({type:"scheme",value:B.value})]}),BY=class extends t{constructor(){super("a:avLst")}},UY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{prst:"prst"})}},GY=class extends t{constructor(){super("a:prstGeom");this.root.push(new UY({prst:"rect"})),this.root.push(new BY)}},YY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{bwMode:"bwMode"})}},q4=class extends t{constructor({element:B,outline:U,solidFill:G,transform:Y}){super(`${B}:spPr`);if(e(this,"form",void 0),this.root.push(new YY({bwMode:"auto"})),this.form=new V4(Y),this.root.push(this.form),this.root.push(new GY),U)this.root.push(X4()),this.root.push(eG(U));if(G)this.root.push(A8(G))}},l6=(B)=>new M0({name:"wps:wsp",children:[mG(B.nonVisualProperties),new q4({element:"wps",transform:B.transformation,outline:B.outline,solidFill:B.solidFill}),aG(B.children),K4(B.bodyProperties)]}),K8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{uri:"uri"})}},ZY=(B)=>new M0({name:"asvg:svgBlip",attributes:{asvg:{key:"xmlns:asvg",value:"http://schemas.microsoft.com/office/drawing/2016/SVG/main"},embed:{key:"r:embed",value:`rId{${B.fileName}}`}}}),QY=(B)=>new M0({name:"a:ext",attributes:{uri:{key:"uri",value:"{96DAC541-7B7A-43D3-8B79-37D633B846F1}"}},children:[ZY(B)]}),JY=(B)=>new M0({name:"a:extLst",children:[QY(B)]}),KY=(B)=>new M0({name:"a:blip",attributes:{embed:{key:"r:embed",value:`rId{${B.type==="svg"?B.fallback.fileName:B.fileName}}`},cstate:{key:"cstate",value:"none"}},children:B.type==="svg"?[JY(B)]:[]}),VY=class extends t{constructor(){super("a:srcRect")}},XY=class extends t{constructor(){super("a:fillRect")}},qY=class extends t{constructor(){super("a:stretch");this.root.push(new XY)}},MY=class extends t{constructor(B){super("pic:blipFill");this.root.push(KY(B)),this.root.push(new VY),this.root.push(new qY)}},RY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{noChangeAspect:"noChangeAspect",noChangeArrowheads:"noChangeArrowheads"})}},LY=class extends t{constructor(){super("a:picLocks");this.root.push(new RY({noChangeAspect:1,noChangeArrowheads:1}))}},IY=class extends t{constructor(){super("pic:cNvPicPr");this.root.push(new LY)}},M4=(B,U)=>new M0({name:"a:hlinkClick",attributes:L0(L0({},U?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${B}`}})}),OY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"id",name:"name",descr:"descr"})}},HY=class extends t{constructor(){super("pic:cNvPr");this.root.push(new OY({id:0,name:"",descr:""}))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!1));break}return super.prepForXml(B)}},FY=class extends t{constructor(){super("pic:nvPicPr");this.root.push(new HY),this.root.push(new IY)}},WY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:pic"})}},a6=class extends t{constructor({mediaData:B,transform:U,outline:G}){super("pic:pic");this.root.push(new WY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/picture"})),this.root.push(new FY),this.root.push(new MY(B)),this.root.push(new q4({element:"pic",transform:U,outline:G}))}},PY=(B)=>new M0({name:"wpg:grpSpPr",children:[new V4(B)]}),AY=()=>new M0({name:"wpg:cNvGrpSpPr"}),jY=(B)=>new M0({name:"wpg:wgp",children:[AY(),PY(B.transformation),...B.children]}),NY=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphicData");if(B.type==="wps"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));let Q=l6(L0(L0({},B.data),{},{transformation:U,outline:G,solidFill:Y}));this.root.push(Q)}else if(B.type==="wpg"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"}));let Q=jY({children:B.children.map((K)=>{if(K.type==="wps")return l6(L0(L0({},K.data),{},{transformation:K.transformation,outline:K.outline,solidFill:K.solidFill}));else return new a6({mediaData:K,transform:K.transformation,outline:K.outline})}),transformation:U});this.root.push(Q)}else{this.root.push(new K8({uri:"http://schemas.openxmlformats.org/drawingml/2006/picture"}));let Q=new a6({mediaData:B,transform:U,outline:G});this.root.push(Q)}}},zY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{a:"xmlns:a"})}},R4=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphic");e(this,"data",void 0),this.root.push(new zY({a:"http://schemas.openxmlformats.org/drawingml/2006/main"})),this.data=new NY({mediaData:B,transform:U,outline:G,solidFill:Y}),this.root.push(this.data)}},e2={NONE:0,SQUARE:1,TIGHT:2,TOP_AND_BOTTOM:3},L4={BOTH_SIDES:"bothSides",LEFT:"left",RIGHT:"right",LARGEST:"largest"},j8=()=>new M0({name:"wp:wrapNone"}),I4=(B,U={top:0,bottom:0,left:0,right:0})=>new M0({name:"wp:wrapSquare",attributes:{wrapText:{key:"wrapText",value:B.side||L4.BOTH_SIDES},distT:{key:"distT",value:U.top},distB:{key:"distB",value:U.bottom},distL:{key:"distL",value:U.left},distR:{key:"distR",value:U.right}}}),O4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTight",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),H4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTopAndBottom",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),F4=class extends t{constructor({name:B,description:U,title:G,id:Y}={name:"",description:"",title:""}){super("wp:docPr");e(this,"docPropertiesUniqueNumericId",oB());let Q={id:{key:"id",value:Y!==null&&Y!==void 0?Y:this.docPropertiesUniqueNumericId()},name:{key:"name",value:B}};if(U!==null&&U!==void 0)Q.description={key:"descr",value:U};if(G!==null&&G!==void 0)Q.title={key:"title",value:G};this.root.push(new $8(Q))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!0));break}return super.prepForXml(B)}},W4=({top:B,right:U,bottom:G,left:Y})=>new M0({name:"wp:effectExtent",attributes:{top:{key:"t",value:B},right:{key:"r",value:U},bottom:{key:"b",value:G},left:{key:"l",value:Y}}}),P4=({x:B,y:U})=>new M0({name:"wp:extent",attributes:{x:{key:"cx",value:B},y:{key:"cy",value:U}}}),wY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:a",noChangeAspect:"noChangeAspect"})}},EY=class extends t{constructor(){super("a:graphicFrameLocks");this.root.push(new wY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/main",noChangeAspect:1}))}},A4=()=>new M0({name:"wp:cNvGraphicFramePr",children:[new EY]}),DY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{distT:"distT",distB:"distB",distL:"distL",distR:"distR",allowOverlap:"allowOverlap",behindDoc:"behindDoc",layoutInCell:"layoutInCell",locked:"locked",relativeHeight:"relativeHeight",simplePos:"simplePos"})}},TY=class extends t{constructor({mediaData:B,transform:U,drawingOptions:G}){super("wp:anchor");let Y=L0({allowOverlap:!0,behindDocument:!1,lockAnchor:!1,layoutInCell:!0,verticalPosition:{},horizontalPosition:{}},G.floating);if(this.root.push(new DY({distT:Y.margins?Y.margins.top||0:0,distB:Y.margins?Y.margins.bottom||0:0,distL:Y.margins?Y.margins.left||0:0,distR:Y.margins?Y.margins.right||0:0,simplePos:"0",allowOverlap:Y.allowOverlap===!0?"1":"0",behindDoc:Y.behindDocument===!0?"1":"0",locked:Y.lockAnchor===!0?"1":"0",layoutInCell:Y.layoutInCell===!0?"1":"0",relativeHeight:Y.zIndex?Y.zIndex:U.emus.y})),this.root.push(G4()),this.root.push(Q4(Y.horizontalPosition)),this.root.push(J4(Y.verticalPosition)),this.root.push(P4({x:U.emus.x,y:U.emus.y})),this.root.push(W4({top:0,right:0,bottom:0,left:0})),G.floating!==void 0&&G.floating.wrap!==void 0)switch(G.floating.wrap.type){case e2.SQUARE:this.root.push(I4(G.floating.wrap,G.floating.margins));break;case e2.TIGHT:this.root.push(O4(G.floating.margins));break;case e2.TOP_AND_BOTTOM:this.root.push(H4(G.floating.margins));break;case e2.NONE:default:this.root.push(j8())}else this.root.push(j8());this.root.push(new F4(G.docProperties)),this.root.push(A4()),this.root.push(new R4({mediaData:B,transform:U,outline:G.outline,solidFill:G.solidFill}))}},CY=({mediaData:B,transform:U,docProperties:G,outline:Y,solidFill:Q})=>{var K,Z,J,q;return new M0({name:"wp:inline",attributes:{distanceTop:{key:"distT",value:0},distanceBottom:{key:"distB",value:0},distanceLeft:{key:"distL",value:0},distanceRight:{key:"distR",value:0}},children:[P4({x:U.emus.x,y:U.emus.y}),W4(Y?{top:((K=Y.width)!==null&&K!==void 0?K:9525)*2,right:((Z=Y.width)!==null&&Z!==void 0?Z:9525)*2,bottom:((J=Y.width)!==null&&J!==void 0?J:9525)*2,left:((q=Y.width)!==null&&q!==void 0?q:9525)*2}:{top:0,right:0,bottom:0,left:0}),new F4(G),A4(),new R4({mediaData:B,transform:U,outline:Y,solidFill:Q})]})},m1=class extends t{constructor(B,U={}){super("w:drawing");if(!U.floating)this.root.push(CY({mediaData:B,transform:B.transformation,docProperties:U.docProperties,outline:U.outline,solidFill:U.solidFill}));else this.root.push(new TY({mediaData:B,transform:B.transformation,drawingOptions:U}))}},kY=(B)=>{let U=B.indexOf(";base64,"),G=U===-1?0:U+8;return new Uint8Array(atob(B.substring(G)).split("").map((Y)=>Y.charCodeAt(0)))},j4=(B)=>typeof B==="string"?kY(B):B,V8=(B,U)=>({data:j4(B.data),fileName:U,transformation:{pixels:{x:Math.round(B.transformation.width),y:Math.round(B.transformation.height)},emus:{x:Math.round(B.transformation.width*9525),y:Math.round(B.transformation.height*9525)},flip:B.transformation.flip,rotation:B.transformation.rotation?B.transformation.rotation*60000:void 0}}),$Y=class extends t{constructor(B){var U=(...Z)=>(super(...Z),e(this,"imageData",void 0),this);let G=`${P8(B.data)}.${B.type}`,Y=B.type==="svg"?L0(L0({type:B.type},V8(B,G)),{},{fallback:L0({type:B.fallback.type},V8(L0(L0({},B.fallback),{},{transformation:B.transformation}),`${P8(B.fallback.data)}.${B.fallback.type}`))}):L0({type:B.type},V8(B,G)),Q=new m1(Y,{floating:B.floating,docProperties:B.altText,outline:B.outline}),K=new D0({children:[Q]});if(B.insertion)U("w:ins"),this.root.push(new b0({id:B.insertion.id,author:B.insertion.author,date:B.insertion.date})),this.addChildElement(K);else if(B.deletion)U("w:del"),this.root.push(new b0({id:B.deletion.id,author:B.deletion.author,date:B.deletion.date})),this.addChildElement(K);else U("w:r"),this.root.push(new U2({})),this.root.push(Q);this.imageData=Y}prepForXml(B){if(B.file.Media.addImage(this.imageData.fileName,this.imageData),this.imageData.type==="svg")B.file.Media.addImage(this.imageData.fallback.fileName,this.imageData.fallback);return super.prepForXml(B)}},n8=(B)=>{var U,G,Y,Q,K,Z,J,q;return{offset:{pixels:{x:Math.round((U=(G=B.offset)===null||G===void 0?void 0:G.left)!==null&&U!==void 0?U:0),y:Math.round((Y=(Q=B.offset)===null||Q===void 0?void 0:Q.top)!==null&&Y!==void 0?Y:0)},emus:{x:Math.round(((K=(Z=B.offset)===null||Z===void 0?void 0:Z.left)!==null&&K!==void 0?K:0)*9525),y:Math.round(((J=(q=B.offset)===null||q===void 0?void 0:q.top)!==null&&J!==void 0?J:0)*9525)}},pixels:{x:Math.round(B.width),y:Math.round(B.height)},emus:{x:Math.round(B.width*9525),y:Math.round(B.height*9525)},flip:B.flip,rotation:B.rotation?B.rotation*60000:void 0}},SY=class extends D0{constructor(B){super({});e(this,"wpsShapeData",void 0),this.wpsShapeData={type:B.type,transformation:n8(B.transformation),data:L0({},B)};let U=new m1(this.wpsShapeData,{floating:B.floating,docProperties:B.altText,outline:B.outline,solidFill:B.solidFill});this.root.push(U)}},bY=class extends D0{constructor(B){super({});e(this,"wpgGroupData",void 0),e(this,"mediaDatas",void 0),this.wpgGroupData={type:B.type,transformation:n8(B.transformation),children:B.children};let U=new m1(this.wpgGroupData,{floating:B.floating,docProperties:B.altText});this.mediaDatas=B.children.filter((G)=>G.type!=="wps").map((G)=>G),this.root.push(U)}prepForXml(B){return this.mediaDatas.forEach((U)=>{if(B.file.Media.addImage(U.fileName,U),U.type==="svg")B.file.Media.addImage(U.fallback.fileName,U.fallback)}),super.prepForXml(B)}},vY=class extends t{constructor(B){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(`SEQ ${B}`)}},yY=class extends D0{constructor(B){super({});this.root.push(e0(!0)),this.root.push(new vY(B)),this.root.push(X2()),this.root.push(B2())}},gY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{instr:"w:instr"})}},s8=class extends t{constructor(B,U){super("w:fldSimple");if(this.root.push(new gY({instr:B})),U!==void 0)this.root.push(new Q1(U))}},fY=class extends s8{constructor(B){super(` MERGEFIELD ${B} `,`«${B}»`)}},xY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},N4={EXTERNAL:"External"},_Y=(B,U,G,Y)=>new M0({name:"Relationship",attributes:{id:{key:"Id",value:B},type:{key:"Type",value:U},target:{key:"Target",value:G},targetMode:{key:"TargetMode",value:Y}}}),A2=class extends t{constructor(){super("Relationships");this.root.push(new xY({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(B,U,G,Y){this.root.push(_Y(`rId${B}`,U,G,Y))}get RelationshipCount(){return this.root.length-1}},hY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},o8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},uY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}},dY=class extends t{constructor(B){super("w:commentRangeStart");this.root.push(new o8({id:B}))}},cY=class extends t{constructor(B){super("w:commentRangeEnd");this.root.push(new o8({id:B}))}},mY=class extends t{constructor(B){super("w:commentReference");this.root.push(new o8({id:B}))}},N8=class extends t{constructor({id:B,initials:U,author:G,date:Y=new Date,children:Q},K){super("w:comment");e(this,"paraId",void 0),this.paraId=K,this.root.push(new hY({id:B,initials:U,author:G,date:Y.toISOString()}));for(let Z of Q)this.root.push(Z)}prepForXml(B){let U=super.prepForXml(B);if(!U||!this.paraId)return U;let G=U["w:comment"];if(!Array.isArray(G))return U;for(let Y=G.length-1;Y>=0;Y--){let Q=G[Y];if(Q&&typeof Q==="object"&&"w:p"in Q){let K=Q["w:p"];if(Array.isArray(K))K.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return U}},z4=(B)=>(B+1).toString(16).toUpperCase().padStart(8,"0"),w4=class extends t{constructor({children:B}){super("w:comments");if(e(this,"relationships",void 0),e(this,"threadData",void 0),this.root.push(new uY({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"})),B.some((U)=>U.parentId!==void 0)){let U=new Map(B.map((G)=>[G.id,z4(G.id)]));for(let G of B)this.root.push(new N8(G,U.get(G.id)));this.threadData=B.map((G)=>({paraId:U.get(G.id),parentParaId:G.parentId!==void 0?U.get(G.parentId):void 0,done:G.resolved}))}else for(let U of B)this.root.push(new N8(U));this.relationships=new A2}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}},lY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},aY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},pY=class extends t{constructor(B){super("w15:commentEx");this.root.push(new aY({paraId:B.paraId,paraIdParent:B.parentParaId,done:B.done!==void 0?B.done?"1":"0":void 0}))}},E4=class extends t{constructor(B){super("w15:commentsEx");this.root.push(new lY({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let U of B)this.root.push(new pY(U))}},rY=class extends S0{constructor(){super("w:noBreakHyphen")}},iY=class extends S0{constructor(){super("w:softHyphen")}},nY=class extends S0{constructor(){super("w:dayShort")}},sY=class extends S0{constructor(){super("w:monthShort")}},oY=class extends S0{constructor(){super("w:yearShort")}},tY=class extends S0{constructor(){super("w:dayLong")}},eY=class extends S0{constructor(){super("w:monthLong")}},BZ=class extends S0{constructor(){super("w:yearLong")}},UZ=class extends S0{constructor(){super("w:annotationRef")}},GZ=class extends S0{constructor(){super("w:footnoteRef")}},D4=class extends S0{constructor(){super("w:endnoteRef")}},YZ=class extends S0{constructor(){super("w:separator")}},ZZ=class extends S0{constructor(){super("w:continuationSeparator")}},QZ=class extends S0{constructor(){super("w:pgNum")}},JZ=class extends S0{constructor(){super("w:cr")}},T4=class extends S0{constructor(){super("w:tab")}},KZ=class extends S0{constructor(){super("w:lastRenderedPageBreak")}},VZ={LEFT:"left",CENTER:"center",RIGHT:"right"},XZ={MARGIN:"margin",INDENT:"indent"},qZ={NONE:"none",DOT:"dot",HYPHEN:"hyphen",UNDERSCORE:"underscore",MIDDLE_DOT:"middleDot"},MZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{alignment:"w:alignment",relativeTo:"w:relativeTo",leader:"w:leader"})}},RZ=class extends t{constructor(B){super("w:ptab");this.root.push(new MZ({alignment:B.alignment,relativeTo:B.relativeTo,leader:B.leader}))}},C4={COLUMN:"column",PAGE:"page"},k4=class extends t{constructor(B){super("w:br");this.root.push(new C0({type:B}))}},LZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.PAGE))}},IZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.COLUMN))}},$4=class extends t{constructor(){super("w:pageBreakBefore")}},k2={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},S4=({after:B,before:U,line:G,lineRule:Y,beforeAutoSpacing:Q,afterAutoSpacing:K})=>new M0({name:"w:spacing",attributes:{after:{key:"w:after",value:B},before:{key:"w:before",value:U},line:{key:"w:line",value:G},lineRule:{key:"w:lineRule",value:Y},beforeAutoSpacing:{key:"w:beforeAutospacing",value:Q},afterAutoSpacing:{key:"w:afterAutospacing",value:K}}}),OZ={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},x2=(B)=>new M0({name:"w:pStyle",attributes:{val:{key:"w:val",value:B}}}),z8={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},HZ={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},FZ={MAX:9026},b4=({type:B,position:U,leader:G})=>new M0({name:"w:tab",attributes:{val:{key:"w:val",value:B},pos:{key:"w:pos",value:U},leader:{key:"w:leader",value:G}}}),v4=(B)=>new M0({name:"w:tabs",children:B.map((U)=>b4(U))}),C1=class extends t{constructor(B,U){super("w:numPr");this.root.push(new WZ(U)),this.root.push(new PZ(B))}},WZ=class extends t{constructor(B){super("w:ilvl");if(B>9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new C0({val:B}))}},PZ=class extends t{constructor(B){super("w:numId");this.root.push(new C0({val:typeof B==="string"?`{${B}}`:B}))}},H1=class extends t{constructor(...B){super(...B);e(this,"fileChild",Symbol())}},AZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},jZ={INTERNAL:"INTERNAL",EXTERNAL:"EXTERNAL"},m2=class extends t{constructor(B,U,G){super("w:hyperlink");e(this,"linkId",void 0),this.linkId=U;let Y=new AZ({history:1,anchor:G?G:void 0,id:!G?`rId${this.linkId}`:void 0});this.root.push(Y),B.forEach((Q)=>{this.root.push(Q)})}},y4=class extends m2{constructor(B){super(B.children,O1(),B.anchor)}},t8=class extends t{constructor(B){super("w:externalHyperlink");e(this,"options",void 0),this.options=B}},NZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",name:"w:name"})}},zZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},g4=class{constructor(B){e(this,"bookmarkUniqueNumericId",tB()),e(this,"start",void 0),e(this,"children",void 0),e(this,"end",void 0);let U=this.bookmarkUniqueNumericId();this.start=new f4(B.id,U),this.children=B.children,this.end=new x4(U)}},f4=class extends t{constructor(B,U){super("w:bookmarkStart");let G=new NZ({name:B,id:U});this.root.push(G)}},x4=class extends t{constructor(B){super("w:bookmarkEnd");let U=new zZ({id:B});this.root.push(U)}},wZ=function(B){return B.NONE="none",B.RELATIVE="relative",B.NO_CONTEXT="no_context",B.FULL_CONTEXT="full_context",B}({}),EZ={["relative"]:"\\r",["no_context"]:"\\n",["full_context"]:"\\w",["none"]:void 0},DZ=class extends s8{constructor(B,U,G={}){let{hyperlink:Y=!0,referenceFormat:Q="full_context"}=G,K=`${`REF ${B}`} ${[...Y?["\\h"]:[],...[EZ[Q]].filter((Z)=>!!Z)].join(" ")}`;super(K,U)}},_4=(B)=>new M0({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:B}}}),TZ=class extends t{constructor(B,U={}){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE}));let G=`PAGEREF ${B}`;if(U.hyperlink)G=`${G} \\h`;if(U.useRelativePosition)G=`${G} \\p`;this.root.push(G)}},CZ=class extends D0{constructor(B,U={}){super({children:[e0(!0),new TZ(B,U),B2()]})}},kZ={ANSI:"00",DEFAULT:"01",SYMBOL:"02",MAC:"4D",JIS:"80",HANGUL:"81",JOHAB:"82",GB_2312:"86",CHINESEBIG5:"88",GREEK:"A1",TURKISH:"A2",VIETNAMESE:"A3",HEBREW:"B1",ARABIC:"B2",BALTIC:"BA",RUSSIAN:"CC",THAI:"DE",EASTEUROPE:"EE",OEM:"FF"},E1=({id:B,fontKey:U,subsetted:G},Y)=>new M0({name:Y,attributes:L0({id:{key:"r:id",value:B}},U?{fontKey:{key:"w:fontKey",value:`{${U}}`}}:{}),children:[...G?[new q0("w:subsetted",G)]:[]]}),$Z=({name:B,altName:U,panose1:G,charset:Y,family:Q,notTrueType:K,pitch:Z,sig:J,embedRegular:q,embedBold:W,embedItalic:I,embedBoldItalic:H})=>new M0({name:"w:font",attributes:{name:{key:"w:name",value:B}},children:[...U?[f2("w:altName",U)]:[],...G?[f2("w:panose1",G)]:[],...Y?[f2("w:charset",Y)]:[],...Q?[f2("w:family",Q)]:[],...K?[new q0("w:notTrueType",K)]:[],...Z?[f2("w:pitch",Z)]:[],...J?[new M0({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:J.usb0},usb1:{key:"w:usb1",value:J.usb1},usb2:{key:"w:usb2",value:J.usb2},usb3:{key:"w:usb3",value:J.usb3},csb0:{key:"w:csb0",value:J.csb0},csb1:{key:"w:csb1",value:J.csb1}}})]:[],...q?[E1(q,"w:embedRegular")]:[],...W?[E1(W,"w:embedBold")]:[],...I?[E1(I,"w:embedItalic")]:[],...H?[E1(H,"w:embedBoldItalic")]:[]]}),SZ=({name:B,index:U,fontKey:G,characterSet:Y})=>$Z({name:B,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:Y,family:"auto",pitch:"variable",embedRegular:{fontKey:G,id:`rId${U}`}}),bZ=(B)=>new M0({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:B.map((U,G)=>SZ({name:U.name,index:G+1,fontKey:U.fontKey,characterSet:U.characterSet}))}),h4=class{constructor(B){e(this,"options",void 0),e(this,"fontTable",void 0),e(this,"relationships",void 0),e(this,"fontOptionsWithKey",[]),this.options=B,this.fontOptionsWithKey=B.map((U)=>L0(L0({},U),{},{fontKey:eB()})),this.fontTable=bZ(this.fontOptionsWithKey),this.relationships=new A2;for(let U=0;Unew M0({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),yZ={NONE:"none",DROP:"drop",MARGIN:"margin"},gZ={MARGIN:"margin",PAGE:"page",TEXT:"text"},fZ={AROUND:"around",AUTO:"auto",NONE:"none",NOT_BESIDE:"notBeside",THROUGH:"through",TIGHT:"tight"},u4=(B)=>{var U,G;return new M0({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:B.anchorLock},dropCap:{key:"w:dropCap",value:B.dropCap},width:{key:"w:w",value:B.width},height:{key:"w:h",value:B.height},x:{key:"w:x",value:B.position?B.position.x:void 0},y:{key:"w:y",value:B.position?B.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:B.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:B.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(U=B.space)===null||U===void 0?void 0:U.horizontal},spaceVertical:{key:"w:vSpace",value:(G=B.space)===null||G===void 0?void 0:G.vertical},rule:{key:"w:hRule",value:B.rule},alignmentX:{key:"w:xAlign",value:B.alignment?B.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:B.alignment?B.alignment.y:void 0},lines:{key:"w:lines",value:B.lines},wrap:{key:"w:wrap",value:B.wrap}}})},M2=class extends R2{constructor(B){super("w:pPr",B===null||B===void 0?void 0:B.includeIfEmpty);if(e(this,"numberingReferences",[]),!B)return this;if(B.heading)this.push(x2(B.heading));if(B.bullet)this.push(x2("ListParagraph"));if(B.numbering){if(!B.style&&!B.heading){if(!B.numbering.custom)this.push(x2("ListParagraph"))}}if(B.style)this.push(x2(B.style));if(B.keepNext!==void 0)this.push(new q0("w:keepNext",B.keepNext));if(B.keepLines!==void 0)this.push(new q0("w:keepLines",B.keepLines));if(B.pageBreakBefore)this.push(new $4);if(B.frame)this.push(u4(B.frame));if(B.widowControl!==void 0)this.push(new q0("w:widowControl",B.widowControl));if(B.bullet)this.push(new C1(1,B.bullet.level));if(B.numbering){var U,G;this.numberingReferences.push({reference:B.numbering.reference,instance:(U=B.numbering.instance)!==null&&U!==void 0?U:0}),this.push(new C1(`${B.numbering.reference}-${(G=B.numbering.instance)!==null&&G!==void 0?G:0}`,B.numbering.level))}else if(B.numbering===!1)this.push(new C1(0,0));if(B.border)this.push(new xB(B.border));if(B.thematicBreak)this.push(new _B);if(B.shading)this.push(M1(B.shading));if(B.wordWrap)this.push(vZ());if(B.overflowPunctuation)this.push(new q0("w:overflowPunct",B.overflowPunctuation));let Y=[...B.rightTabStop!==void 0?[{type:z8.RIGHT,position:B.rightTabStop}]:[],...B.tabStops?B.tabStops:[],...B.leftTabStop!==void 0?[{type:z8.LEFT,position:B.leftTabStop}]:[]];if(Y.length>0)this.push(v4(Y));if(B.bidirectional!==void 0)this.push(new q0("w:bidi",B.bidirectional));if(B.spacing)this.push(S4(B.spacing));if(B.indent)this.push(hB(B.indent));if(B.contextualSpacing!==void 0)this.push(new q0("w:contextualSpacing",B.contextualSpacing));if(B.alignment)this.push(m8(B.alignment));if(B.outlineLevel!==void 0)this.push(_4(B.outlineLevel));if(B.suppressLineNumbers!==void 0)this.push(new q0("w:suppressLineNumbers",B.suppressLineNumbers));if(B.autoSpaceEastAsianText!==void 0)this.push(new q0("w:autoSpaceDN",B.autoSpaceEastAsianText));if(B.run)this.push(new mB(B.run));if(B.revision)this.push(new d4(B.revision))}push(B){this.root.push(B)}prepForXml(B){if(!(B.viewWrapper instanceof h4))for(let U of this.numberingReferences)B.file.Numbering.createConcreteNumberingInstance(U.reference,U.instance);return super.prepForXml(B)}},d4=class extends t{constructor(B){super("w:pPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new M2(L0(L0({},B),{},{includeIfEmpty:!0})))}},d0=class extends H1{constructor(B){super("w:p");if(e(this,"properties",void 0),typeof B==="string")return this.properties=new M2({}),this.root.push(this.properties),this.root.push(new Q1(B)),this;if(this.properties=new M2(B),this.root.push(this.properties),B.text)this.root.push(new Q1(B.text));if(B.children)for(let U of B.children){if(U instanceof g4){this.root.push(U.start);for(let G of U.children)this.root.push(G);this.root.push(U.end);continue}this.root.push(U)}}prepForXml(B){for(let U of this.root)if(U instanceof t8){let G=this.root.indexOf(U),Y=new m2(U.options.children,O1());B.viewWrapper.Relationships.addRelationship(Y.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",U.options.link,N4.EXTERNAL),this.root[G]=Y}return super.prepForXml(B)}addRunToFront(B){return this.root.splice(1,0,B),this}},xZ=class extends t{constructor(B){super("m:oMath");for(let U of B.children)this.root.push(U)}},_Z=class extends t{constructor(B){super("m:t");this.root.push(B)}},hZ=class extends t{constructor(B){super("m:r");this.root.push(new _Z(B))}},c4=class extends t{constructor(B){super("m:den");for(let U of B)this.root.push(U)}},m4=class extends t{constructor(B){super("m:num");for(let U of B)this.root.push(U)}},uZ=class extends t{constructor(B){super("m:f");this.root.push(new m4(B.numerator)),this.root.push(new c4(B.denominator))}},l4=({accent:B})=>new M0({name:"m:chr",attributes:{accent:{key:"m:val",value:B}}}),y0=({children:B})=>new M0({name:"m:e",children:B}),a4=({value:B})=>new M0({name:"m:limLoc",attributes:{value:{key:"m:val",value:B||"undOvr"}}}),dZ=()=>new M0({name:"m:subHide",attributes:{hide:{key:"m:val",value:1}}}),cZ=()=>new M0({name:"m:supHide",attributes:{hide:{key:"m:val",value:1}}}),e8=({accent:B,hasSuperScript:U,hasSubScript:G,limitLocationVal:Y})=>new M0({name:"m:naryPr",children:[...B?[l4({accent:B})]:[],a4({value:Y}),...!U?[cZ()]:[],...!G?[dZ()]:[]]}),l2=({children:B})=>new M0({name:"m:sub",children:B}),a2=({children:B})=>new M0({name:"m:sup",children:B}),mZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"∑",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},lZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript,limitLocationVal:"subSup"})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},B6=class extends t{constructor(B){super("m:lim");for(let U of B)this.root.push(U)}},aZ=class extends t{constructor(B){super("m:limUpp");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},pZ=class extends t{constructor(B){super("m:limLow");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},p4=()=>new M0({name:"m:sSupPr"}),rZ=class extends t{constructor(B){super("m:sSup");this.root.push(p4()),this.root.push(y0({children:B.children})),this.root.push(a2({children:B.superScript}))}},r4=()=>new M0({name:"m:sSubPr"}),iZ=class extends t{constructor(B){super("m:sSub");this.root.push(r4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript}))}},i4=()=>new M0({name:"m:sSubSupPr"}),nZ=class extends t{constructor(B){super("m:sSubSup");this.root.push(i4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript})),this.root.push(a2({children:B.superScript}))}},n4=()=>new M0({name:"m:sPrePr"}),sZ=class extends M0{constructor({children:B,subScript:U,superScript:G}){super({name:"m:sPre",children:[n4(),y0({children:B}),l2({children:U}),a2({children:G})]})}},oZ="",s4=class extends t{constructor(B){super("m:deg");if(B)for(let U of B)this.root.push(U)}},tZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{hide:"m:val"})}},eZ=class extends t{constructor(){super("m:degHide");this.root.push(new tZ({hide:1}))}},o4=class extends t{constructor(B){super("m:radPr");if(!B)this.root.push(new eZ)}},BQ=class extends t{constructor(B){super("m:rad");this.root.push(new o4(!!B.degree)),this.root.push(new s4(B.degree)),this.root.push(y0({children:B.children}))}},t4=class extends t{constructor(B){super("m:fName");for(let U of B)this.root.push(U)}},e4=class extends t{constructor(){super("m:funcPr")}},UQ=class extends t{constructor(B){super("m:func");this.root.push(new e4),this.root.push(new t4(B.name)),this.root.push(y0({children:B.children}))}},GQ=({character:B})=>new M0({name:"m:begChr",attributes:{character:{key:"m:val",value:B}}}),YQ=({character:B})=>new M0({name:"m:endChr",attributes:{character:{key:"m:val",value:B}}}),l1=({characters:B})=>new M0({name:"m:dPr",children:B?[GQ({character:B.beginningCharacter}),YQ({character:B.endingCharacter})]:[]}),ZQ=class extends t{constructor(B){super("m:d");this.root.push(l1({})),this.root.push(y0({children:B.children}))}},QQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"[",endingCharacter:"]"}})),this.root.push(y0({children:B.children}))}},JQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"{",endingCharacter:"}"}})),this.root.push(y0({children:B.children}))}},KQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"〈",endingCharacter:"〉"}})),this.root.push(y0({children:B.children}))}},VQ=(B)=>new M0({name:"w:gridCol",attributes:B!==void 0?{width:{key:"w:w",value:E0(B)}}:void 0}),B9=class extends t{constructor(B,U){super("w:tblGrid");for(let G of B)this.root.push(VQ(G));if(U)this.root.push(new qQ(U))}},XQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},qQ=class extends t{constructor(B){super("w:tblGridChange");this.root.push(new XQ({id:B.id})),this.root.push(new B9(B.columnWidths))}},MQ=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new Q1(B))}},RQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},LQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},IQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},p6=class extends t{constructor(B){super("w:delText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B)}},OQ=class extends t{constructor(B){super("w:del");e(this,"deletedTextRunWrapper",void 0),this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.deletedTextRunWrapper=new HQ(B),this.addChildElement(this.deletedTextRunWrapper)}},HQ=class extends t{constructor(B){super("w:r");if(this.root.push(new U2(B)),B.children)for(let U of B.children){if(typeof U==="string"){switch(U){case F2.CURRENT:this.root.push(e0()),this.root.push(new RQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES:this.root.push(e0()),this.root.push(new LQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES_IN_SECTION:this.root.push(e0()),this.root.push(new IQ),this.root.push(X2()),this.root.push(B2());break;default:this.root.push(new p6(U));break}continue}this.root.push(U)}else if(B.text)this.root.push(new p6(B.text));if(B.break)for(let U=0;Unew M0({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:B}}}),X9=({marginUnitType:B=v1.DXA,top:U,left:G,bottom:Y,right:Q})=>[{name:"w:top",size:U},{name:"w:left",size:G},{name:"w:bottom",size:Y},{name:"w:right",size:Q}].filter((K)=>K.size!==void 0).map(({name:K,size:Z})=>J1(K,{type:B,size:Z})),PQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tblCellMar",children:U})},AQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tcMar",children:U})},v1={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},J1=(B,{type:U=v1.AUTO,size:G})=>{let Y=G;if(U===v1.PERCENTAGE&&typeof G==="number")Y=`${G}%`;return new M0({name:B,attributes:{type:{key:"w:type",value:U},size:{key:"w:w",value:c8(Y)}}})},q9=class extends R2{constructor(B){super("w:tcBorders");if(B.top)this.root.push(j0("w:top",B.top));if(B.start)this.root.push(j0("w:start",B.start));if(B.left)this.root.push(j0("w:left",B.left));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.end)this.root.push(j0("w:end",B.end));if(B.right)this.root.push(j0("w:right",B.right))}},jQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},M9=class extends t{constructor(B){super("w:gridSpan");this.root.push(new jQ({val:T0(B)}))}},G6={CONTINUE:"continue",RESTART:"restart"},NQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},w8=class extends t{constructor(B){super("w:vMerge");this.root.push(new NQ({val:B}))}},zQ={BOTTOM_TO_TOP_LEFT_TO_RIGHT:"btLr",LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},wQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},R9=class extends t{constructor(B){super("w:textDirection");this.root.push(new wQ({val:B}))}},L9=class extends R2{constructor(B){super("w:tcPr",B.includeIfEmpty);if(B.width)this.root.push(J1("w:tcW",B.width));if(B.columnSpan)this.root.push(new M9(B.columnSpan));if(B.verticalMerge)this.root.push(new w8(B.verticalMerge));else if(B.rowSpan&&B.rowSpan>1)this.root.push(new w8(G6.RESTART));if(B.borders)this.root.push(new q9(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.margins){let U=AQ(B.margins);if(U)this.root.push(U)}if(B.textDirection)this.root.push(new R9(B.textDirection));if(B.verticalAlign)this.root.push(U6(B.verticalAlign));if(B.insertion)this.root.push(new Y9(B.insertion));if(B.deletion)this.root.push(new Z9(B.deletion));if(B.revision)this.root.push(new EQ(B.revision));if(B.cellMerge)this.root.push(new J9(B.cellMerge))}},EQ=class extends t{constructor(B){super("w:tcPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new L9(L0(L0({},B),{},{includeIfEmpty:!0})))}},Y6=class extends t{constructor(B){super("w:tc");e(this,"options",void 0),this.options=B,this.root.push(new L9(B));for(let U of B.children)this.root.push(U)}prepForXml(B){if(!(this.root[this.root.length-1]instanceof d0))this.root.push(new d0({}));return super.prepForXml(B)}},v2={style:c1.NONE,size:0,color:"auto"},y2={style:c1.SINGLE,size:4,color:"auto"},Z6=class extends t{constructor(B){var U,G,Y,Q,K,Z;super("w:tblBorders");this.root.push(j0("w:top",(U=B.top)!==null&&U!==void 0?U:y2)),this.root.push(j0("w:left",(G=B.left)!==null&&G!==void 0?G:y2)),this.root.push(j0("w:bottom",(Y=B.bottom)!==null&&Y!==void 0?Y:y2)),this.root.push(j0("w:right",(Q=B.right)!==null&&Q!==void 0?Q:y2)),this.root.push(j0("w:insideH",(K=B.insideHorizontal)!==null&&K!==void 0?K:y2)),this.root.push(j0("w:insideV",(Z=B.insideVertical)!==null&&Z!==void 0?Z:y2))}};e(Z6,"NONE",{top:v2,bottom:v2,left:v2,right:v2,insideHorizontal:v2,insideVertical:v2});var DQ={MARGIN:"margin",PAGE:"page",TEXT:"text"},TQ={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},CQ={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},kQ={NEVER:"never",OVERLAP:"overlap"},$Q=(B)=>new M0({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:B}}}),I9=({horizontalAnchor:B,verticalAnchor:U,absoluteHorizontalPosition:G,relativeHorizontalPosition:Y,absoluteVerticalPosition:Q,relativeVerticalPosition:K,bottomFromText:Z,topFromText:J,leftFromText:q,rightFromText:W,overlap:I})=>new M0({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:q===void 0?void 0:E0(q)},rightFromText:{key:"w:rightFromText",value:W===void 0?void 0:E0(W)},topFromText:{key:"w:topFromText",value:J===void 0?void 0:E0(J)},bottomFromText:{key:"w:bottomFromText",value:Z===void 0?void 0:E0(Z)},absoluteHorizontalPosition:{key:"w:tblpX",value:G===void 0?void 0:t0(G)},absoluteVerticalPosition:{key:"w:tblpY",value:Q===void 0?void 0:t0(Q)},horizontalAnchor:{key:"w:horzAnchor",value:B},relativeHorizontalPosition:{key:"w:tblpXSpec",value:Y},relativeVerticalPosition:{key:"w:tblpYSpec",value:K},verticalAnchor:{key:"w:vertAnchor",value:U}},children:I?[$Q(I)]:void 0}),SQ={AUTOFIT:"autofit",FIXED:"fixed"},O9=(B)=>new M0({name:"w:tblLayout",attributes:{type:{key:"w:type",value:B}}}),bQ={DXA:"dxa",NIL:"nil"},H9=({type:B=bQ.DXA,value:U})=>new M0({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:B},value:{key:"w:w",value:c8(U)}}}),F9=({firstRow:B,lastRow:U,firstColumn:G,lastColumn:Y,noHBand:Q,noVBand:K})=>new M0({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:B},lastRow:{key:"w:lastRow",value:U},firstColumn:{key:"w:firstColumn",value:G},lastColumn:{key:"w:lastColumn",value:Y},noHBand:{key:"w:noHBand",value:Q},noVBand:{key:"w:noVBand",value:K}}}),Q6=class extends R2{constructor(B){super("w:tblPr",B.includeIfEmpty);if(B.style)this.root.push(new q2("w:tblStyle",B.style));if(B.float)this.root.push(I9(B.float));if(B.visuallyRightToLeft!==void 0)this.root.push(new q0("w:bidiVisual",B.visuallyRightToLeft));if(B.width)this.root.push(J1("w:tblW",B.width));if(B.alignment)this.root.push(m8(B.alignment));if(B.indent)this.root.push(J1("w:tblInd",B.indent));if(B.borders)this.root.push(new Z6(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.layout)this.root.push(O9(B.layout));if(B.cellMargin){let U=PQ(B.cellMargin);if(U)this.root.push(U)}if(B.tableLook)this.root.push(F9(B.tableLook));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.revision)this.root.push(new vQ(B.revision))}},vQ=class extends t{constructor(B){super("w:tblPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new Q6(L0(L0({},B),{},{includeIfEmpty:!0})))}},yQ=class extends H1{constructor({rows:B,width:U,columnWidths:G=Array(Math.max(...B.map((j)=>j.CellCount))).fill(100),columnWidthsRevision:Y,margins:Q,indent:K,float:Z,layout:J,style:q,borders:W,alignment:I,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P}){super("w:tbl");this.root.push(new Q6({borders:W!==null&&W!==void 0?W:{},width:U!==null&&U!==void 0?U:{size:100},indent:K,float:Z,layout:J,style:q,alignment:I,cellMargin:Q,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P})),this.root.push(new B9(G,Y));for(let j of B)this.root.push(j);B.forEach((j,E)=>{if(E===B.length-1)return;let C=0;j.cells.forEach((N)=>{if(N.options.rowSpan&&N.options.rowSpan>1){let v=new Y6({rowSpan:N.options.rowSpan-1,columnSpan:N.options.columnSpan,borders:N.options.borders,children:[],verticalMerge:G6.CONTINUE});B[E+1].addCellToColumnIndex(v,C)}C+=N.options.columnSpan||1})})}},gQ={AUTO:"auto",ATLEAST:"atLeast",EXACT:"exact"},W9=(B,U)=>new M0({name:"w:trHeight",attributes:{value:{key:"w:val",value:E0(B)},rule:{key:"w:hRule",value:U}}}),J6=class extends R2{constructor(B){super("w:trPr",B.includeIfEmpty);if(B.cantSplit!==void 0)this.root.push(new q0("w:cantSplit",B.cantSplit));if(B.tableHeader!==void 0)this.root.push(new q0("w:tblHeader",B.tableHeader));if(B.height)this.root.push(W9(B.height.value,B.height.rule));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.insertion)this.root.push(new U9(B.insertion));if(B.deletion)this.root.push(new G9(B.deletion));if(B.revision)this.root.push(new P9(B.revision))}},P9=class extends t{constructor(B){super("w:trPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new J6(L0(L0({},B),{},{includeIfEmpty:!0})))}},fQ=class extends t{constructor(B){super("w:tr");e(this,"options",void 0),this.options=B,this.root.push(new J6(B));for(let U of B.children)this.root.push(U)}get CellCount(){return this.options.children.length}get cells(){return this.root.filter((B)=>B instanceof Y6)}addCellToIndex(B,U){this.root.splice(U+1,0,B)}addCellToColumnIndex(B,U){let G=this.columnIndexToRootIndex(U,!0);this.addCellToIndex(B,G-1)}rootIndexToColumnIndex(B){if(B<1||B>=this.root.length)throw Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let U=0;for(let G=1;G=this.root.length)if(U)return this.root.length;else throw Error(`cell 'columnIndex' should not great than ${G-1}`);let Q=this.root[Y];Y+=1,G+=Q&&Q.options.columnSpan||1}return Y-1}},xQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},_Q=class extends t{constructor(){super("Properties");this.root.push(new xQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},hQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},V2=(B,U)=>new M0({name:"Default",attributes:{contentType:{key:"ContentType",value:B},extension:{key:"Extension",value:U}}}),f0=(B,U)=>new M0({name:"Override",attributes:{contentType:{key:"ContentType",value:B},partName:{key:"PartName",value:U}}}),uQ=class extends t{constructor(){super("Types");this.root.push(new hQ({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(V2("image/png","png")),this.root.push(V2("image/jpeg","jpeg")),this.root.push(V2("image/jpeg","jpg")),this.root.push(V2("image/bmp","bmp")),this.root.push(V2("image/gif","gif")),this.root.push(V2("image/svg+xml","svg")),this.root.push(V2("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(V2("application/xml","xml")),this.root.push(V2("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(f0("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addCommentsExtended(){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addFooter(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${B}.xml`))}addHeader(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${B}.xml`))}},y1={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},F1=class extends H0{constructor(B,U){super(L0({Ignorable:U},Object.fromEntries(B.map((G)=>[G,y1[G]]))));e(this,"xmlKeys",L0({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(y1).map((G)=>[G,`xmlns:${G}`]))))}},dQ=class extends t{constructor(B){super("cp:coreProperties");if(this.root.push(new F1(["cp","dc","dcterms","dcmitype","xsi"])),B.title)this.root.push(new O2("dc:title",B.title));if(B.subject)this.root.push(new O2("dc:subject",B.subject));if(B.creator)this.root.push(new O2("dc:creator",B.creator));if(B.keywords)this.root.push(new O2("cp:keywords",B.keywords));if(B.description)this.root.push(new O2("dc:description",B.description));if(B.lastModifiedBy)this.root.push(new O2("cp:lastModifiedBy",B.lastModifiedBy));if(B.revision)this.root.push(new O2("cp:revision",String(B.revision)));this.root.push(new r6("dcterms:created")),this.root.push(new r6("dcterms:modified"))}},cQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"xsi:type"})}},r6=class extends t{constructor(B){super(B);this.root.push(new cQ({type:"dcterms:W3CDTF"})),this.root.push(fB(new Date))}},mQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},lQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},aQ=class extends t{constructor(B,U){super("property");this.root.push(new lQ({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:B.toString(),name:U.name})),this.root.push(new pQ(U.value))}},pQ=class extends t{constructor(B){super("vt:lpwstr");this.root.push(B)}},rQ=class extends t{constructor(B){super("Properties");e(this,"nextId",void 0),e(this,"properties",[]),this.root.push(new mQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let U of B)this.addCustomProperty(U)}prepForXml(B){return this.properties.forEach((U)=>this.root.push(U)),super.prepForXml(B)}addCustomProperty(B){this.properties.push(new aQ(this.nextId++,B))}},A9=({space:B,count:U,separate:G,equalWidth:Y,children:Q})=>new M0({name:"w:cols",attributes:{space:{key:"w:space",value:B===void 0?void 0:E0(B)},count:{key:"w:num",value:U===void 0?void 0:T0(U)},separate:{key:"w:sep",value:G},equalWidth:{key:"w:equalWidth",value:Y}},children:!Y&&Q?Q:void 0}),iQ={DEFAULT:"default",LINES:"lines",LINES_AND_CHARS:"linesAndChars",SNAP_TO_CHARS:"snapToChars"},j9=({type:B,linePitch:U,charSpace:G})=>new M0({name:"w:docGrid",attributes:{type:{key:"w:type",value:B},linePitch:{key:"w:linePitch",value:T0(U)},charSpace:{key:"w:charSpace",value:G?T0(G):void 0}}}),T2={DEFAULT:"default",FIRST:"first",EVEN:"even"},E8={HEADER:"w:headerReference",FOOTER:"w:footerReference"},k1=(B,U)=>new M0({name:B,attributes:{type:{key:"w:type",value:U.type||T2.DEFAULT},id:{key:"r:id",value:`rId${U.id}`}}}),nQ={NEW_PAGE:"newPage",NEW_SECTION:"newSection",CONTINUOUS:"continuous"},N9=({countBy:B,start:U,restart:G,distance:Y})=>new M0({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:B===void 0?void 0:T0(B)},start:{key:"w:start",value:U===void 0?void 0:T0(U)},restart:{key:"w:restart",value:G},distance:{key:"w:distance",value:Y===void 0?void 0:E0(Y)}}}),sQ={ALL_PAGES:"allPages",FIRST_PAGE:"firstPage",NOT_FIRST_PAGE:"notFirstPage"},oQ={PAGE:"page",TEXT:"text"},tQ={BACK:"back",FRONT:"front"},i6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},z9=class extends R2{constructor(B){super("w:pgBorders");if(!B)return this;if(B.pageBorders)this.root.push(new i6({display:B.pageBorders.display,offsetFrom:B.pageBorders.offsetFrom,zOrder:B.pageBorders.zOrder}));else this.root.push(new i6({}));if(B.pageBorderTop)this.root.push(j0("w:top",B.pageBorderTop));if(B.pageBorderLeft)this.root.push(j0("w:left",B.pageBorderLeft));if(B.pageBorderBottom)this.root.push(j0("w:bottom",B.pageBorderBottom));if(B.pageBorderRight)this.root.push(j0("w:right",B.pageBorderRight))}},w9=(B,U,G,Y,Q,K,Z)=>new M0({name:"w:pgMar",attributes:{top:{key:"w:top",value:t0(B)},right:{key:"w:right",value:E0(U)},bottom:{key:"w:bottom",value:t0(G)},left:{key:"w:left",value:E0(Y)},header:{key:"w:header",value:E0(Q)},footer:{key:"w:footer",value:E0(K)},gutter:{key:"w:gutter",value:E0(Z)}}}),eQ={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},E9=({start:B,formatType:U,separator:G})=>new M0({name:"w:pgNumType",attributes:{start:{key:"w:start",value:B===void 0?void 0:T0(B)},formatType:{key:"w:fmt",value:U},separator:{key:"w:chapSep",value:G}}}),g1={PORTRAIT:"portrait",LANDSCAPE:"landscape"},D9=({width:B,height:U,orientation:G,code:Y})=>{let Q=E0(B),K=E0(U);return new M0({name:"w:pgSz",attributes:{width:{key:"w:w",value:G===g1.LANDSCAPE?K:Q},height:{key:"w:h",value:G===g1.LANDSCAPE?Q:K},orientation:{key:"w:orient",value:G},code:{key:"w:code",value:Y}}})},BJ={LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},UJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},T9=class extends t{constructor(B){super("w:textDirection");this.root.push(new UJ({val:B}))}},GJ={NEXT_PAGE:"nextPage",NEXT_COLUMN:"nextColumn",CONTINUOUS:"continuous",EVEN_PAGE:"evenPage",ODD_PAGE:"oddPage"},C9=(B)=>new M0({name:"w:type",attributes:{val:{key:"w:val",value:B}}}),H2={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},$1={WIDTH:11906,HEIGHT:16838,ORIENTATION:g1.PORTRAIT},K6=class extends t{constructor({page:{size:{width:B=$1.WIDTH,height:U=$1.HEIGHT,orientation:G=$1.ORIENTATION,code:Y}={},margin:{top:Q=H2.TOP,right:K=H2.RIGHT,bottom:Z=H2.BOTTOM,left:J=H2.LEFT,header:q=H2.HEADER,footer:W=H2.FOOTER,gutter:I=H2.GUTTER}={},pageNumbers:H={},borders:T,textDirection:A}={},grid:{linePitch:P=360,charSpace:j,type:E}={},headerWrapperGroup:C={},footerWrapperGroup:N={},lineNumbers:v,titlePage:S,verticalAlign:F,column:M,type:$,revision:x}={}){super("w:sectPr");if(this.addHeaderFooterGroup(E8.HEADER,C),this.addHeaderFooterGroup(E8.FOOTER,N),$)this.root.push(C9($));if(this.root.push(D9({width:B,height:U,orientation:G,code:Y})),this.root.push(w9(Q,K,Z,J,q,W,I)),T)this.root.push(new z9(T));if(v)this.root.push(N9(v));if(this.root.push(E9(H)),M)this.root.push(A9(M));if(F)this.root.push(U6(F));if(S!==void 0)this.root.push(new q0("w:titlePg",S));if(A)this.root.push(new T9(A));if(x)this.root.push(new k9(x));this.root.push(j9({linePitch:P,charSpace:j,type:E}))}addHeaderFooterGroup(B,U){if(U.default)this.root.push(k1(B,{type:T2.DEFAULT,id:U.default.View.ReferenceId}));if(U.first)this.root.push(k1(B,{type:T2.FIRST,id:U.first.View.ReferenceId}));if(U.even)this.root.push(k1(B,{type:T2.EVEN,id:U.even.View.ReferenceId}))}},k9=class extends t{constructor(B){super("w:sectPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new K6(B))}},YJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{width:"w:w",space:"w:space"})}},ZJ=class extends t{constructor(B){super("w:col");this.root.push(new YJ({width:E0(B.width),space:B.space===void 0?void 0:E0(B.space)}))}},$9=class extends t{constructor(){super("w:body");e(this,"sections",[])}addSection(B){let U=this.sections.pop();this.root.push(this.createSectionParagraph(U)),this.sections.push(new K6(B))}prepForXml(B){if(this.sections.length===1)this.root.splice(0,1),this.root.push(this.sections.pop());return super.prepForXml(B)}push(B){this.root.push(B)}createSectionParagraph(B){let U=new d0({}),G=new M2({});return G.push(B),U.addChildElement(G),U}},S9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}},b9=class extends t{constructor(B){super("w:background");this.root.push(new S9({color:B.color===void 0?void 0:C2(B.color),themeColor:B.themeColor,themeShade:B.themeShade===void 0?void 0:W8(B.themeShade),themeTint:B.themeTint===void 0?void 0:W8(B.themeTint)}))}},QJ=class extends t{constructor(B){super("w:document");if(e(this,"body",void 0),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new $9,B.background)this.root.push(new b9(B.background));this.root.push(this.body)}add(B){return this.body.push(B),this}get Body(){return this.body}},JJ=class{constructor(B){e(this,"document",void 0),e(this,"relationships",void 0),this.document=new QJ(B),this.relationships=new A2}get View(){return this.document}get Relationships(){return this.relationships}},KJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},VJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",id:"w:id"})}},XJ=class extends D0{constructor(){super({style:"EndnoteReference"});this.root.push(new D4)}},n6={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},X8=class extends t{constructor(B){super("w:endnote");this.root.push(new VJ({type:B.type,id:B.id}));for(let U=0;U9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new zJ({ilvl:T0(B),tentative:1}))}},h9=class extends X6{},$J=class extends X6{},SJ=class extends t{constructor(B){super("w:multiLevelType");this.root.push(new C0({val:B}))}},bJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},D8=class extends t{constructor(B,U){super("w:abstractNum");e(this,"id",void 0),this.root.push(new bJ({abstractNumId:T0(B),restartNumberingAfterBreak:0})),this.root.push(new SJ("hybridMultilevel")),this.id=B;for(let G of U)this.root.push(new h9(G))}},vJ=class extends t{constructor(B){super("w:abstractNumId");this.root.push(new C0({val:B}))}},yJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{numId:"w:numId"})}},T8=class extends t{constructor(B){super("w:num");if(e(this,"numId",void 0),e(this,"reference",void 0),e(this,"instance",void 0),this.numId=B.numId,this.reference=B.reference,this.instance=B.instance,this.root.push(new yJ({numId:T0(B.numId)})),this.root.push(new vJ(T0(B.abstractNumId))),B.overrideLevels&&B.overrideLevels.length)for(let U of B.overrideLevels)this.root.push(new u9(U.num,U.start))}},gJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{ilvl:"w:ilvl"})}},u9=class extends t{constructor(B,U){super("w:lvlOverride");if(this.root.push(new gJ({ilvl:B})),U!==void 0)this.root.push(new xJ(U))}},fJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},xJ=class extends t{constructor(B){super("w:startOverride");this.root.push(new fJ({val:B}))}},d9=class extends t{constructor(B){super("w:numbering");e(this,"abstractNumberingMap",new Map),e(this,"concreteNumberingMap",new Map),e(this,"referenceConfigMap",new Map),e(this,"abstractNumUniqueNumericId",nB()),e(this,"concreteNumUniqueNumericId",sB()),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let U=new D8(this.abstractNumUniqueNumericId(),[{level:0,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(0.5),hanging:u0(0.25)}}}},{level:1,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(1),hanging:u0(0.25)}}}},{level:2,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:2160,hanging:u0(0.25)}}}},{level:3,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:2880,hanging:u0(0.25)}}}},{level:4,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:3600,hanging:u0(0.25)}}}},{level:5,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:4320,hanging:u0(0.25)}}}},{level:6,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5040,hanging:u0(0.25)}}}},{level:7,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5760,hanging:u0(0.25)}}}},{level:8,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:6480,hanging:u0(0.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new T8({numId:1,abstractNumId:U.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",U);for(let G of B.config)this.abstractNumberingMap.set(G.reference,new D8(this.abstractNumUniqueNumericId(),G.levels)),this.referenceConfigMap.set(G.reference,G.levels)}prepForXml(B){for(let U of this.abstractNumberingMap.values())this.root.push(U);for(let U of this.concreteNumberingMap.values())this.root.push(U);return super.prepForXml(B)}createConcreteNumberingInstance(B,U){let G=this.abstractNumberingMap.get(B);if(!G)return;let Y=`${B}-${U}`;if(this.concreteNumberingMap.has(Y))return;let Q=this.referenceConfigMap.get(B),K=Q&&Q[0].start,Z={numId:this.concreteNumUniqueNumericId(),abstractNumId:G.id,reference:B,instance:U,overrideLevels:[typeof K==="number"&&Number.isInteger(K)?{num:0,start:K}:{num:0,start:1}]};this.concreteNumberingMap.set(Y,new T8(Z))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},_J=(B)=>new M0({name:"w:compatSetting",attributes:{version:{key:"w:val",value:B},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),hJ=class extends t{constructor(B){super("w:compat");if(B.version)this.root.push(_J(B.version));if(B.useSingleBorderforContiguousCells)this.root.push(new q0("w:useSingleBorderforContiguousCells",B.useSingleBorderforContiguousCells));if(B.wordPerfectJustification)this.root.push(new q0("w:wpJustification",B.wordPerfectJustification));if(B.noTabStopForHangingIndent)this.root.push(new q0("w:noTabHangInd",B.noTabStopForHangingIndent));if(B.noLeading)this.root.push(new q0("w:noLeading",B.noLeading));if(B.spaceForUnderline)this.root.push(new q0("w:spaceForUL",B.spaceForUnderline));if(B.noColumnBalance)this.root.push(new q0("w:noColumnBalance",B.noColumnBalance));if(B.balanceSingleByteDoubleByteWidth)this.root.push(new q0("w:balanceSingleByteDoubleByteWidth",B.balanceSingleByteDoubleByteWidth));if(B.noExtraLineSpacing)this.root.push(new q0("w:noExtraLineSpacing",B.noExtraLineSpacing));if(B.doNotLeaveBackslashAlone)this.root.push(new q0("w:doNotLeaveBackslashAlone",B.doNotLeaveBackslashAlone));if(B.underlineTrailingSpaces)this.root.push(new q0("w:ulTrailSpace",B.underlineTrailingSpaces));if(B.doNotExpandShiftReturn)this.root.push(new q0("w:doNotExpandShiftReturn",B.doNotExpandShiftReturn));if(B.spacingInWholePoints)this.root.push(new q0("w:spacingInWholePoints",B.spacingInWholePoints));if(B.lineWrapLikeWord6)this.root.push(new q0("w:lineWrapLikeWord6",B.lineWrapLikeWord6));if(B.printBodyTextBeforeHeader)this.root.push(new q0("w:printBodyTextBeforeHeader",B.printBodyTextBeforeHeader));if(B.printColorsBlack)this.root.push(new q0("w:printColBlack",B.printColorsBlack));if(B.spaceWidth)this.root.push(new q0("w:wpSpaceWidth",B.spaceWidth));if(B.showBreaksInFrames)this.root.push(new q0("w:showBreaksInFrames",B.showBreaksInFrames));if(B.subFontBySize)this.root.push(new q0("w:subFontBySize",B.subFontBySize));if(B.suppressBottomSpacing)this.root.push(new q0("w:suppressBottomSpacing",B.suppressBottomSpacing));if(B.suppressTopSpacing)this.root.push(new q0("w:suppressTopSpacing",B.suppressTopSpacing));if(B.suppressSpacingAtTopOfPage)this.root.push(new q0("w:suppressSpacingAtTopOfPage",B.suppressSpacingAtTopOfPage));if(B.suppressTopSpacingWP)this.root.push(new q0("w:suppressTopSpacingWP",B.suppressTopSpacingWP));if(B.suppressSpBfAfterPgBrk)this.root.push(new q0("w:suppressSpBfAfterPgBrk",B.suppressSpBfAfterPgBrk));if(B.swapBordersFacingPages)this.root.push(new q0("w:swapBordersFacingPages",B.swapBordersFacingPages));if(B.convertMailMergeEsc)this.root.push(new q0("w:convMailMergeEsc",B.convertMailMergeEsc));if(B.truncateFontHeightsLikeWP6)this.root.push(new q0("w:truncateFontHeightsLikeWP6",B.truncateFontHeightsLikeWP6));if(B.macWordSmallCaps)this.root.push(new q0("w:mwSmallCaps",B.macWordSmallCaps));if(B.usePrinterMetrics)this.root.push(new q0("w:usePrinterMetrics",B.usePrinterMetrics));if(B.doNotSuppressParagraphBorders)this.root.push(new q0("w:doNotSuppressParagraphBorders",B.doNotSuppressParagraphBorders));if(B.wrapTrailSpaces)this.root.push(new q0("w:wrapTrailSpaces",B.wrapTrailSpaces));if(B.footnoteLayoutLikeWW8)this.root.push(new q0("w:footnoteLayoutLikeWW8",B.footnoteLayoutLikeWW8));if(B.shapeLayoutLikeWW8)this.root.push(new q0("w:shapeLayoutLikeWW8",B.shapeLayoutLikeWW8));if(B.alignTablesRowByRow)this.root.push(new q0("w:alignTablesRowByRow",B.alignTablesRowByRow));if(B.forgetLastTabAlignment)this.root.push(new q0("w:forgetLastTabAlignment",B.forgetLastTabAlignment));if(B.adjustLineHeightInTable)this.root.push(new q0("w:adjustLineHeightInTable",B.adjustLineHeightInTable));if(B.autoSpaceLikeWord95)this.root.push(new q0("w:autoSpaceLikeWord95",B.autoSpaceLikeWord95));if(B.noSpaceRaiseLower)this.root.push(new q0("w:noSpaceRaiseLower",B.noSpaceRaiseLower));if(B.doNotUseHTMLParagraphAutoSpacing)this.root.push(new q0("w:doNotUseHTMLParagraphAutoSpacing",B.doNotUseHTMLParagraphAutoSpacing));if(B.layoutRawTableWidth)this.root.push(new q0("w:layoutRawTableWidth",B.layoutRawTableWidth));if(B.layoutTableRowsApart)this.root.push(new q0("w:layoutTableRowsApart",B.layoutTableRowsApart));if(B.useWord97LineBreakRules)this.root.push(new q0("w:useWord97LineBreakRules",B.useWord97LineBreakRules));if(B.doNotBreakWrappedTables)this.root.push(new q0("w:doNotBreakWrappedTables",B.doNotBreakWrappedTables));if(B.doNotSnapToGridInCell)this.root.push(new q0("w:doNotSnapToGridInCell",B.doNotSnapToGridInCell));if(B.selectFieldWithFirstOrLastCharacter)this.root.push(new q0("w:selectFldWithFirstOrLastChar",B.selectFieldWithFirstOrLastCharacter));if(B.applyBreakingRules)this.root.push(new q0("w:applyBreakingRules",B.applyBreakingRules));if(B.doNotWrapTextWithPunctuation)this.root.push(new q0("w:doNotWrapTextWithPunct",B.doNotWrapTextWithPunctuation));if(B.doNotUseEastAsianBreakRules)this.root.push(new q0("w:doNotUseEastAsianBreakRules",B.doNotUseEastAsianBreakRules));if(B.useWord2002TableStyleRules)this.root.push(new q0("w:useWord2002TableStyleRules",B.useWord2002TableStyleRules));if(B.growAutofit)this.root.push(new q0("w:growAutofit",B.growAutofit));if(B.useFELayout)this.root.push(new q0("w:useFELayout",B.useFELayout));if(B.useNormalStyleForList)this.root.push(new q0("w:useNormalStyleForList",B.useNormalStyleForList));if(B.doNotUseIndentAsNumberingTabStop)this.root.push(new q0("w:doNotUseIndentAsNumberingTabStop",B.doNotUseIndentAsNumberingTabStop));if(B.useAlternateEastAsianLineBreakRules)this.root.push(new q0("w:useAltKinsokuLineBreakRules",B.useAlternateEastAsianLineBreakRules));if(B.allowSpaceOfSameStyleInTable)this.root.push(new q0("w:allowSpaceOfSameStyleInTable",B.allowSpaceOfSameStyleInTable));if(B.doNotSuppressIndentation)this.root.push(new q0("w:doNotSuppressIndentation",B.doNotSuppressIndentation));if(B.doNotAutofitConstrainedTables)this.root.push(new q0("w:doNotAutofitConstrainedTables",B.doNotAutofitConstrainedTables));if(B.autofitToFirstFixedWidthCell)this.root.push(new q0("w:autofitToFirstFixedWidthCell",B.autofitToFirstFixedWidthCell));if(B.underlineTabInNumberingList)this.root.push(new q0("w:underlineTabInNumList",B.underlineTabInNumberingList));if(B.displayHangulFixedWidth)this.root.push(new q0("w:displayHangulFixedWidth",B.displayHangulFixedWidth));if(B.splitPgBreakAndParaMark)this.root.push(new q0("w:splitPgBreakAndParaMark",B.splitPgBreakAndParaMark));if(B.doNotVerticallyAlignCellWithSp)this.root.push(new q0("w:doNotVertAlignCellWithSp",B.doNotVerticallyAlignCellWithSp));if(B.doNotBreakConstrainedForcedTable)this.root.push(new q0("w:doNotBreakConstrainedForcedTable",B.doNotBreakConstrainedForcedTable));if(B.ignoreVerticalAlignmentInTextboxes)this.root.push(new q0("w:doNotVertAlignInTxbx",B.ignoreVerticalAlignmentInTextboxes));if(B.useAnsiKerningPairs)this.root.push(new q0("w:useAnsiKerningPairs",B.useAnsiKerningPairs));if(B.cachedColumnBalance)this.root.push(new q0("w:cachedColBalance",B.cachedColumnBalance))}},uJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},dJ=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w:settings");if(this.root.push(new uJ({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new q0("w:displayBackgroundShape",!0)),B.trackRevisions!==void 0)this.root.push(new q0("w:trackRevisions",B.trackRevisions));if(B.evenAndOddHeaders!==void 0)this.root.push(new q0("w:evenAndOddHeaders",B.evenAndOddHeaders));if(B.updateFields!==void 0)this.root.push(new q0("w:updateFields",B.updateFields));if(B.defaultTabStop!==void 0)this.root.push(new _2("w:defaultTabStop",B.defaultTabStop));if(((U=B.hyphenation)===null||U===void 0?void 0:U.autoHyphenation)!==void 0)this.root.push(new q0("w:autoHyphenation",B.hyphenation.autoHyphenation));if(((G=B.hyphenation)===null||G===void 0?void 0:G.hyphenationZone)!==void 0)this.root.push(new _2("w:hyphenationZone",B.hyphenation.hyphenationZone));if(((Y=B.hyphenation)===null||Y===void 0?void 0:Y.consecutiveHyphenLimit)!==void 0)this.root.push(new _2("w:consecutiveHyphenLimit",B.hyphenation.consecutiveHyphenLimit));if(((Q=B.hyphenation)===null||Q===void 0?void 0:Q.doNotHyphenateCaps)!==void 0)this.root.push(new q0("w:doNotHyphenateCaps",B.hyphenation.doNotHyphenateCaps));this.root.push(new hJ(L0(L0({},(K=B.compatibility)!==null&&K!==void 0?K:{}),{},{version:(Z=(J=(q=B.compatibility)===null||q===void 0?void 0:q.version)!==null&&J!==void 0?J:B.compatibilityModeVersion)!==null&&Z!==void 0?Z:15})))}},c9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},cJ=class extends t{constructor(B){super("w:name");this.root.push(new c9({val:B}))}},mJ=class extends t{constructor(B){super("w:uiPriority");this.root.push(new c9({val:T0(B)}))}},lJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},m9=class extends t{constructor(B,U){super("w:style");if(this.root.push(new lJ(B)),U.name)this.root.push(new cJ(U.name));if(U.basedOn)this.root.push(new q2("w:basedOn",U.basedOn));if(U.next)this.root.push(new q2("w:next",U.next));if(U.link)this.root.push(new q2("w:link",U.link));if(U.uiPriority!==void 0)this.root.push(new mJ(U.uiPriority));if(U.semiHidden!==void 0)this.root.push(new q0("w:semiHidden",U.semiHidden));if(U.unhideWhenUsed!==void 0)this.root.push(new q0("w:unhideWhenUsed",U.unhideWhenUsed));if(U.quickFormat!==void 0)this.root.push(new q0("w:qFormat",U.quickFormat))}},p2=class extends m9{constructor(B){super({type:"paragraph",styleId:B.id},B);e(this,"paragraphProperties",void 0),e(this,"runProperties",void 0),this.paragraphProperties=new M2(B.paragraph),this.runProperties=new U2(B.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},$2=class extends m9{constructor(B){super({type:"character",styleId:B.id},L0({uiPriority:99,unhideWhenUsed:!0},B));e(this,"runProperties",void 0),this.runProperties=new U2(B.run),this.root.push(this.runProperties)}},j2=class extends p2{constructor(B){super(L0({basedOn:"Normal",next:"Normal",quickFormat:!0},B))}},aJ=class extends j2{constructor(B){super(L0({id:"Title",name:"Title"},B))}},pJ=class extends j2{constructor(B){super(L0({id:"Heading1",name:"Heading 1"},B))}},rJ=class extends j2{constructor(B){super(L0({id:"Heading2",name:"Heading 2"},B))}},iJ=class extends j2{constructor(B){super(L0({id:"Heading3",name:"Heading 3"},B))}},nJ=class extends j2{constructor(B){super(L0({id:"Heading4",name:"Heading 4"},B))}},sJ=class extends j2{constructor(B){super(L0({id:"Heading5",name:"Heading 5"},B))}},oJ=class extends j2{constructor(B){super(L0({id:"Heading6",name:"Heading 6"},B))}},tJ=class extends j2{constructor(B){super(L0({id:"Strong",name:"Strong"},B))}},eJ=class extends p2{constructor(B){super(L0({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},B))}},BK=class extends p2{constructor(B){super(L0({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},UK=class extends $2{constructor(B){super(L0({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},GK=class extends $2{constructor(B){super(L0({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},B))}},YK=class extends p2{constructor(B){super(L0({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},ZK=class extends $2{constructor(B){super(L0({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},QK=class extends $2{constructor(B){super(L0({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},B))}},JK=class extends $2{constructor(B){super(L0({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:i8.SINGLE}}},B))}},S1=class extends t{constructor(B){super("w:styles");if(B.initialStyles)this.root.push(B.initialStyles);if(B.importedStyles)for(let U of B.importedStyles)this.root.push(U);if(B.paragraphStyles)for(let U of B.paragraphStyles)this.root.push(new p2(U));if(B.characterStyles)for(let U of B.characterStyles)this.root.push(new $2(U))}},l9=class extends t{constructor(B){super("w:pPrDefault");this.root.push(new M2(B))}},a9=class extends t{constructor(B){super("w:rPrDefault");this.root.push(new U2(B))}},p9=class extends t{constructor(B){super("w:docDefaults");e(this,"runPropertiesDefaults",void 0),e(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new a9(B.run),this.paragraphPropertiesDefaults=new l9(B.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},KK=class{newInstance(B){let U=(0,h1.xml2js)(B,{compact:!1}),G;for(let Q of U.elements||[])if(Q.name==="w:styles")G=Q;if(G===void 0)throw Error("can not find styles element");let Y=G.elements||[];return{initialStyles:new $B(G.attributes),importedStyles:Y.map((Q)=>u1(Q))}}},M8=class{newInstance(B={}){var U;return{initialStyles:new F1(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new p9((U=B.document)!==null&&U!==void 0?U:{}),new aJ(L0({run:{size:56}},B.title)),new pJ(L0({run:{color:"2E74B5",size:32}},B.heading1)),new rJ(L0({run:{color:"2E74B5",size:26}},B.heading2)),new iJ(L0({run:{color:"1F4D78",size:24}},B.heading3)),new nJ(L0({run:{color:"2E74B5",italics:!0}},B.heading4)),new sJ(L0({run:{color:"2E74B5"}},B.heading5)),new oJ(L0({run:{color:"1F4D78"}},B.heading6)),new tJ(L0({run:{bold:!0}},B.strong)),new eJ(B.listParagraph||{}),new JK(B.hyperlink||{}),new UK(B.footnoteReference||{}),new BK(B.footnoteText||{}),new GK(B.footnoteTextChar||{}),new ZK(B.endnoteReference||{}),new YK(B.endnoteText||{}),new QK(B.endnoteTextChar||{})]}}},VK=class{constructor(B){var U,G,Y,Q,K,Z,J,q,W,I,H,T;if(e(this,"currentRelationshipId",1),e(this,"documentWrapper",void 0),e(this,"headers",[]),e(this,"footers",[]),e(this,"coreProperties",void 0),e(this,"numbering",void 0),e(this,"media",void 0),e(this,"fileRelationships",void 0),e(this,"footnotesWrapper",void 0),e(this,"endnotesWrapper",void 0),e(this,"settings",void 0),e(this,"contentTypes",void 0),e(this,"customProperties",void 0),e(this,"appProperties",void 0),e(this,"styles",void 0),e(this,"comments",void 0),e(this,"commentsExtended",void 0),e(this,"fontWrapper",void 0),this.coreProperties=new dQ(L0(L0({},B),{},{creator:(U=B.creator)!==null&&U!==void 0?U:"Un-named",revision:(G=B.revision)!==null&&G!==void 0?G:1,lastModifiedBy:(Y=B.lastModifiedBy)!==null&&Y!==void 0?Y:"Un-named"})),this.numbering=new d9(B.numbering?B.numbering:{config:[]}),this.comments=new w4((Q=B.comments)!==null&&Q!==void 0?Q:{children:[]}),this.comments.ThreadData)this.commentsExtended=new E4(this.comments.ThreadData);if(this.fileRelationships=new A2,this.customProperties=new rQ((K=B.customProperties)!==null&&K!==void 0?K:[]),this.appProperties=new _Q,this.footnotesWrapper=new PJ,this.endnotesWrapper=new RJ,this.contentTypes=new uQ,this.documentWrapper=new JJ({background:B.background}),this.settings=new dJ({compatibilityModeVersion:B.compatabilityModeVersion,compatibility:B.compatibility,evenAndOddHeaders:B.evenAndOddHeaderAndFooters?!0:!1,trackRevisions:(Z=B.features)===null||Z===void 0?void 0:Z.trackRevisions,updateFields:(J=B.features)===null||J===void 0?void 0:J.updateFields,defaultTabStop:B.defaultTabStop,hyphenation:{autoHyphenation:(q=B.hyphenation)===null||q===void 0?void 0:q.autoHyphenation,hyphenationZone:(W=B.hyphenation)===null||W===void 0?void 0:W.hyphenationZone,consecutiveHyphenLimit:(I=B.hyphenation)===null||I===void 0?void 0:I.consecutiveHyphenLimit,doNotHyphenateCaps:(H=B.hyphenation)===null||H===void 0?void 0:H.doNotHyphenateCaps}}),this.media=new V6,B.externalStyles!==void 0){var A;let P=new M8().newInstance((A=B.styles)===null||A===void 0?void 0:A.default),j=new KK().newInstance(B.externalStyles);this.styles=new S1(L0(L0({},j),{},{importedStyles:[...P.importedStyles,...j.importedStyles]}))}else if(B.styles){let P=new M8().newInstance(B.styles.default);this.styles=new S1(L0(L0({},P),B.styles))}else{let P=new M8;this.styles=new S1(P.newInstance())}this.addDefaultRelationships();for(let P of B.sections)this.addSection(P);if(B.footnotes)for(let P in B.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(P),B.footnotes[P].children);if(B.endnotes)for(let P in B.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(P),B.endnotes[P].children);this.fontWrapper=new h4((T=B.fonts)!==null&&T!==void 0?T:[])}addSection({headers:B={},footers:U={},children:G,properties:Y}){this.documentWrapper.View.Body.addSection(L0(L0({},Y),{},{headerWrapperGroup:{default:B.default?this.createHeader(B.default):void 0,first:B.first?this.createHeader(B.first):void 0,even:B.even?this.createHeader(B.even):void 0},footerWrapperGroup:{default:U.default?this.createFooter(U.default):void 0,first:U.first?this.createFooter(U.first):void 0,even:U.even?this.createFooter(U.even):void 0}}));for(let Q of G)this.documentWrapper.View.add(Q)}createHeader(B){let U=new _9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addHeaderToDocument(U),U}createFooter(B){let U=new f9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addFooterToDocument(U),U}addHeaderToDocument(B,U=T2.DEFAULT){this.headers.push({header:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(B,U=T2.DEFAULT){this.footers.push({footer:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){if(this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.commentsExtended)this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map((B)=>B.header)}get Footers(){return this.footers.map((B)=>B.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get FontTable(){return this.fontWrapper}},XK=class extends t{constructor(B={}){super("w:instrText");e(this,"properties",void 0),this.properties=B,this.root.push(new _0({space:x0.PRESERVE}));let U="TOC";if(this.properties.captionLabel)U=`${U} \\a "${this.properties.captionLabel}"`;if(this.properties.entriesFromBookmark)U=`${U} \\b "${this.properties.entriesFromBookmark}"`;if(this.properties.captionLabelIncludingNumbers)U=`${U} \\c "${this.properties.captionLabelIncludingNumbers}"`;if(this.properties.sequenceAndPageNumbersSeparator)U=`${U} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`;if(this.properties.tcFieldIdentifier)U=`${U} \\f "${this.properties.tcFieldIdentifier}"`;if(this.properties.hyperlink)U=`${U} \\h`;if(this.properties.tcFieldLevelRange)U=`${U} \\l "${this.properties.tcFieldLevelRange}"`;if(this.properties.pageNumbersEntryLevelsRange)U=`${U} \\n "${this.properties.pageNumbersEntryLevelsRange}"`;if(this.properties.headingStyleRange)U=`${U} \\o "${this.properties.headingStyleRange}"`;if(this.properties.entryAndPageNumberSeparator)U=`${U} \\p "${this.properties.entryAndPageNumberSeparator}"`;if(this.properties.seqFieldIdentifierForPrefix)U=`${U} \\s "${this.properties.seqFieldIdentifierForPrefix}"`;if(this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let G=this.properties.stylesWithLevels.map((Y)=>`${Y.styleName},${Y.level}`).join(",");U=`${U} \\t "${G}"`}if(this.properties.useAppliedParagraphOutlineLevel)U=`${U} \\u`;if(this.properties.preserveTabInEntries)U=`${U} \\w`;if(this.properties.preserveNewLineInEntries)U=`${U} \\x`;if(this.properties.hideTabAndPageNumbersInWebView)U=`${U} \\z`;this.root.push(U)}},r9=class extends t{constructor(){super("w:sdtContent")}},i9=class extends t{constructor(B){super("w:sdtPr");if(B)this.root.push(new q2("w:alias",B))}};function qK(B,U){if(B==null)return{};var G={};for(var Y in B)if({}.hasOwnProperty.call(B,Y)){if(U.includes(Y))continue;G[Y]=B[Y]}return G}function n9(B,U){if(B==null)return{};var G,Y,Q=qK(B,U);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(B);for(Y=0;Y0){let{stylesWithLevels:W}=K,I=Y.map((T,A)=>{var P,j;let E=this.buildCachedContentParagraphChild(T,K),C=(P=W===null||W===void 0||(j=W.find((v)=>v.level===T.level))===null||j===void 0?void 0:j.styleName)!==null&&P!==void 0?P:`TOC${T.level}`,N=A===0?[...J,E]:A===Y.length-1?[E,...q]:[E];return new d0({style:C,tabStops:this.getTabStopsForLevel(T.level),children:N})}),H=I;if(Y.length<=1)H=[...I,new d0({children:q})];for(let T of H)Z.addChildElement(T)}else{let W=new d0({children:J});Z.addChildElement(W);for(let H of G)Z.addChildElement(H);let I=new d0({children:q});Z.addChildElement(I)}this.root.push(Z)}getTabStopsForLevel(B,U=9025){return[{type:"clear",position:U+1-(B-1)*240},{type:"right",position:U,leader:"dot"}]}buildCachedContentRun(B,U){var G,Y;return new D0({style:(U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0?"IndexLink":void 0,children:[new Z1({text:B.title}),new T4,new Z1({text:(G=(Y=B.page)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:""})]})}buildCachedContentParagraphChild(B,U){let G=this.buildCachedContentRun(B,U);if((U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0)return new y4({anchor:B.href,children:[G]});return G}},LK=class{constructor(B,U){e(this,"styleName",void 0),e(this,"level",void 0),this.styleName=B,this.level=U}},IK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},OK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},s9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},o9=class extends t{constructor(B){super("w:footnoteReference");this.root.push(new s9({id:B}))}},HK=class extends D0{constructor(B){super({style:"FootnoteReference"});this.root.push(new o9(B))}},t9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},e9=class extends t{constructor(B){super("w:endnoteReference");this.root.push(new t9({id:B}))}},FK=class extends D0{constructor(B){super({style:"EndnoteReference"});this.root.push(new e9(B))}},o6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w14:val",symbolfont:"w14:font"})}},b1=class extends t{constructor(B,U,G){super(B);if(G)this.root.push(new o6({val:SB(U),symbolfont:G}));else this.root.push(new o6({val:U}))}},B5=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w14:checkbox");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let W=(B===null||B===void 0?void 0:B.checked)?"1":"0",I,H;this.root.push(new b1("w14:checked",W)),I=(B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.value)?B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value:this.DEFAULT_CHECKED_SYMBOL,H=(B===null||B===void 0||(Y=B.checkedState)===null||Y===void 0?void 0:Y.font)?B===null||B===void 0||(Q=B.checkedState)===null||Q===void 0?void 0:Q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:checkedState",I,H)),I=(B===null||B===void 0||(K=B.uncheckedState)===null||K===void 0?void 0:K.value)?B===null||B===void 0||(Z=B.uncheckedState)===null||Z===void 0?void 0:Z.value:this.DEFAULT_UNCHECKED_SYMBOL,H=(B===null||B===void 0||(J=B.uncheckedState)===null||J===void 0?void 0:J.font)?B===null||B===void 0||(q=B.uncheckedState)===null||q===void 0?void 0:q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:uncheckedState",I,H))}},WK=class extends t{constructor(B){var U,G,Y,Q;super("w:sdt");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let K=new i9(B===null||B===void 0?void 0:B.alias);K.addChildElement(new B5(B)),this.root.push(K);let Z=new r9,J=B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.font,q=B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value,W=B===null||B===void 0||(Y=B.uncheckedState)===null||Y===void 0?void 0:Y.font,I=B===null||B===void 0||(Q=B.uncheckedState)===null||Q===void 0?void 0:Q.value,H,T;if(B===null||B===void 0?void 0:B.checked)H=J?J:this.DEFAULT_FONT,T=q?q:this.DEFAULT_CHECKED_SYMBOL;else H=W?W:this.DEFAULT_FONT,T=I?I:this.DEFAULT_UNCHECKED_SYMBOL;let A=new aB({char:T,symbolfont:H});Z.addChildElement(A),this.root.push(Z)}},PK=({shape:B})=>new M0({name:"w:pict",children:[B]}),AK=({children:B=[]})=>new M0({name:"w:txbxContent",children:B}),jK=({style:B,children:U,inset:G})=>new M0({name:"v:textbox",attributes:{style:{key:"style",value:B},insetMode:{key:"insetmode",value:G?"custom":"auto"},inset:{key:"inset",value:G?`${G.left}, ${G.top}, ${G.right}, ${G.bottom}`:void 0}},children:[AK({children:U})]}),NK="#_x0000_t202",zK={flip:"flip",height:"height",left:"left",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",positionHorizontal:"mso-position-horizontal",positionHorizontalRelative:"mso-position-horizontal-relative",positionVertical:"mso-position-vertical",positionVerticalRelative:"mso-position-vertical-relative",wrapDistanceBottom:"mso-wrap-distance-bottom",wrapDistanceLeft:"mso-wrap-distance-left",wrapDistanceRight:"mso-wrap-distance-right",wrapDistanceTop:"mso-wrap-distance-top",wrapEdited:"mso-wrap-edited",wrapStyle:"mso-wrap-style",position:"position",rotation:"rotation",top:"top",visibility:"visibility",width:"width",zIndex:"z-index"},wK=(B)=>B?Object.entries(B).map(([U,G])=>`${zK[U]}:${G}`).join(";"):void 0,EK=({id:B,children:U,type:G=NK,style:Y})=>new M0({name:"v:shape",attributes:{id:{key:"id",value:B},type:{key:"type",value:G},style:{key:"style",value:wK(Y)}},children:[jK({style:"mso-fit-shape-to-text:t;",children:U})]}),DK=["style","children"],TK=class extends H1{constructor(B){let{style:U,children:G}=B,Y=n9(B,DK);super("w:p");this.root.push(new M2(Y)),this.root.push(PK({shape:EK({children:G,id:O1(),style:U})}))}},CK=R0((B,U)=>{d2(),P2();/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -35,8 +35,8 @@ Actual: `+z.attribValue);else{var Z0=z.tag,g=z.tags[z.tags.length-1]||z;if(Z0.ns JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE - */(function(G){if(typeof B=="object"&&typeof U<"u")U.exports=G();else if(typeof define=="function"&&define.amd)define([],G);else(typeof window<"u"?window:typeof v0<"u"?v0:typeof self<"u"?self:this).JSZip=G()})(function(){return function G(Y,Q,K){function Z(W,I){if(!Q[W]){if(!Y[W]){var H=typeof z1=="function"&&z1;if(!I&&H)return H(W,!0);if(J)return J(W,!0);var T=Error("Cannot find module '"+W+"'");throw T.code="MODULE_NOT_FOUND",T}var A=Q[W]={exports:{}};Y[W][0].call(A.exports,function(P){var j=Y[W][1][P];return Z(j||P)},A,A.exports,G,Y,Q,K)}return Q[W].exports}for(var J=typeof z1=="function"&&z1,q=0;q>2,A=(3&W)<<4|I>>4,P=1>6:64,j=2>4,I=(15&T)<<4|(A=J.indexOf(q.charAt(j++)))>>2,H=(3&A)<<6|(P=J.indexOf(q.charAt(j++))),N[E++]=W,A!==64&&(N[E++]=I),P!==64&&(N[E++]=H);return N}},{"./support":30,"./utils":32}],2:[function(G,Y,Q){var K=G("./external"),Z=G("./stream/DataWorker"),J=G("./stream/Crc32Probe"),q=G("./stream/DataLengthProbe");function W(I,H,T,A,P){this.compressedSize=I,this.uncompressedSize=H,this.crc32=T,this.compression=A,this.compressedContent=P}W.prototype={getContentWorker:function(){var I=new Z(K.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new q("data_length")),H=this;return I.on("end",function(){if(this.streamInfo.data_length!==H.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),I},getCompressedWorker:function(){return new Z(K.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},W.createWorkerFrom=function(I,H,T){return I.pipe(new J).pipe(new q("uncompressedSize")).pipe(H.compressWorker(T)).pipe(new q("compressedSize")).withStreamInfo("compression",H)},Y.exports=W},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(G,Y,Q){var K=G("./stream/GenericWorker");Q.STORE={magic:"\x00\x00",compressWorker:function(){return new K("STORE compression")},uncompressWorker:function(){return new K("STORE decompression")}},Q.DEFLATE=G("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(G,Y,Q){var K=G("./utils"),Z=function(){for(var J,q=[],W=0;W<256;W++){J=W;for(var I=0;I<8;I++)J=1&J?3988292384^J>>>1:J>>>1;q[W]=J}return q}();Y.exports=function(J,q){return J!==void 0&&J.length?K.getTypeOf(J)!=="string"?function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I[j])];return-1^W}(0|q,J,J.length,0):function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I.charCodeAt(j))];return-1^W}(0|q,J,J.length,0):0}},{"./utils":32}],5:[function(G,Y,Q){Q.base64=!1,Q.binary=!1,Q.dir=!1,Q.createFolders=!0,Q.date=null,Q.compression=null,Q.compressionOptions=null,Q.comment=null,Q.unixPermissions=null,Q.dosPermissions=null},{}],6:[function(G,Y,Q){var K=null;K=typeof Promise<"u"?Promise:G("lie"),Y.exports={Promise:K}},{lie:37}],7:[function(G,Y,Q){var K=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",Z=G("pako"),J=G("./utils"),q=G("./stream/GenericWorker"),W=K?"uint8array":"array";function I(H,T){q.call(this,"FlateWorker/"+H),this._pako=null,this._pakoAction=H,this._pakoOptions=T,this.meta={}}Q.magic="\b\x00",J.inherits(I,q),I.prototype.processChunk=function(H){this.meta=H.meta,this._pako===null&&this._createPako(),this._pako.push(J.transformTo(W,H.data),!1)},I.prototype.flush=function(){q.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},I.prototype.cleanUp=function(){q.prototype.cleanUp.call(this),this._pako=null},I.prototype._createPako=function(){this._pako=new Z[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var H=this;this._pako.onData=function(T){H.push({data:T,meta:H.meta})}},Q.compressWorker=function(H){return new I("Deflate",H)},Q.uncompressWorker=function(){return new I("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(G,Y,Q){function K(A,P){var j,E="";for(j=0;j>>=8;return E}function Z(A,P,j,E,C,N){var v,S,F=A.file,M=A.compression,$=N!==W.utf8encode,x=J.transformTo("string",N(F.name)),w=J.transformTo("string",W.utf8encode(F.name)),a=F.comment,U0=J.transformTo("string",N(a)),b=J.transformTo("string",W.utf8encode(a)),c=w.length!==F.name.length,D=b.length!==a.length,m="",B0="",i="",V0=F.dir,s=F.date,G0={crc32:0,compressedSize:0,uncompressedSize:0};P&&!j||(G0.crc32=A.crc32,G0.compressedSize=A.compressedSize,G0.uncompressedSize=A.uncompressedSize);var r=0;P&&(r|=8),$||!c&&!D||(r|=2048);var y=0,n=0;V0&&(y|=16),C==="UNIX"?(n=798,y|=function(Y0,O0){var z=Y0;return Y0||(z=O0?16893:33204),(65535&z)<<16}(F.unixPermissions,V0)):(n=20,y|=function(Y0){return 63&(Y0||0)}(F.dosPermissions)),v=s.getUTCHours(),v<<=6,v|=s.getUTCMinutes(),v<<=5,v|=s.getUTCSeconds()/2,S=s.getUTCFullYear()-1980,S<<=4,S|=s.getUTCMonth()+1,S<<=5,S|=s.getUTCDate(),c&&(B0=K(1,1)+K(I(x),4)+w,m+="up"+K(B0.length,2)+B0),D&&(i=K(1,1)+K(I(U0),4)+b,m+="uc"+K(i.length,2)+i);var o="";return o+=` -\x00`,o+=K(r,2),o+=M.magic,o+=K(v,2),o+=K(S,2),o+=K(G0.crc32,4),o+=K(G0.compressedSize,4),o+=K(G0.uncompressedSize,4),o+=K(x.length,2),o+=K(m.length,2),{fileRecord:H.LOCAL_FILE_HEADER+o+x+m,dirRecord:H.CENTRAL_FILE_HEADER+K(n,2)+o+K(U0.length,2)+"\x00\x00\x00\x00"+K(y,4)+K(E,4)+x+m+U0}}var J=G("../utils"),q=G("../stream/GenericWorker"),W=G("../utf8"),I=G("../crc32"),H=G("../signature");function T(A,P,j,E){q.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=j,this.encodeFileName=E,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}J.inherits(T,q),T.prototype.push=function(A){var P=A.meta.percent||0,j=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,q.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:j?(P+100*(j-E-1))/j:100}}))},T.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var P=this.streamFiles&&!A.file.dir;if(P){var j=Z(A,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},T.prototype.closedSource=function(A){this.accumulate=!1;var P=this.streamFiles&&!A.file.dir,j=Z(A,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),P)this.push({data:function(E){return H.DATA_DESCRIPTOR+K(E.crc32,4)+K(E.compressedSize,4)+K(E.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},T.prototype.flush=function(){for(var A=this.bytesWritten,P=0;P=this.index;q--)W=(W<<8)+this.byteAt(q);return this.index+=J,W},readString:function(J){return K.transformTo("string",this.readData(J))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var J=this.readInt(4);return new Date(Date.UTC(1980+(J>>25&127),(J>>21&15)-1,J>>16&31,J>>11&31,J>>5&63,(31&J)<<1))}},Y.exports=Z},{"../utils":32}],19:[function(G,Y,Q){var K=G("./Uint8ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(G,Y,Q){var K=G("./DataReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.byteAt=function(J){return this.data.charCodeAt(this.zero+J)},Z.prototype.lastIndexOfSignature=function(J){return this.data.lastIndexOf(J)-this.zero},Z.prototype.readAndCheckSignature=function(J){return J===this.readData(4)},Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./DataReader":18}],21:[function(G,Y,Q){var K=G("./ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){if(this.checkOffset(J),J===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./ArrayReader":17}],22:[function(G,Y,Q){var K=G("../utils"),Z=G("../support"),J=G("./ArrayReader"),q=G("./StringReader"),W=G("./NodeBufferReader"),I=G("./Uint8ArrayReader");Y.exports=function(H){var T=K.getTypeOf(H);return K.checkSupport(T),T!=="string"||Z.uint8array?T==="nodebuffer"?new W(H):Z.uint8array?new I(K.transformTo("uint8array",H)):new J(K.transformTo("array",H)):new q(H)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(G,Y,Q){Q.LOCAL_FILE_HEADER="PK\x03\x04",Q.CENTRAL_FILE_HEADER="PK\x01\x02",Q.CENTRAL_DIRECTORY_END="PK\x05\x06",Q.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",Q.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",Q.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../utils");function J(q){K.call(this,"ConvertWorker to "+q),this.destType=q}Z.inherits(J,K),J.prototype.processChunk=function(q){this.push({data:Z.transformTo(this.destType,q.data),meta:q.meta})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],25:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../crc32");function J(){K.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}G("../utils").inherits(J,K),J.prototype.processChunk=function(q){this.streamInfo.crc32=Z(q.data,this.streamInfo.crc32||0),this.push(q)},Y.exports=J},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataLengthProbe for "+q),this.propName=q,this.withStreamInfo(q,0)}K.inherits(J,Z),J.prototype.processChunk=function(q){if(q){var W=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=W+q.data.length}Z.prototype.processChunk.call(this,q)},Y.exports=J},{"../utils":32,"./GenericWorker":28}],27:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataWorker");var W=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,q.then(function(I){W.dataIsReady=!0,W.data=I,W.max=I&&I.length||0,W.type=K.getTypeOf(I),W.isPaused||W._tickAndRepeat()},function(I){W.error(I)})}K.inherits(J,Z),J.prototype.cleanUp=function(){Z.prototype.cleanUp.call(this),this.data=null},J.prototype.resume=function(){return!!Z.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,K.delay(this._tickAndRepeat,[],this)),!0)},J.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(K.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},J.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var q=null,W=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":q=this.data.substring(this.index,W);break;case"uint8array":q=this.data.subarray(this.index,W);break;case"array":case"nodebuffer":q=this.data.slice(this.index,W)}return this.index=W,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],28:[function(G,Y,Q){function K(Z){this.name=Z||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}K.prototype={push:function(Z){this.emit("data",Z)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Z){this.emit("error",Z)}return!0},error:function(Z){return!this.isFinished&&(this.isPaused?this.generatedError=Z:(this.isFinished=!0,this.emit("error",Z),this.previous&&this.previous.error(Z),this.cleanUp()),!0)},on:function(Z,J){return this._listeners[Z].push(J),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Z,J){if(this._listeners[Z])for(var q=0;q "+Z:Z}},Y.exports=K},{}],29:[function(G,Y,Q){var K=G("../utils"),Z=G("./ConvertWorker"),J=G("./GenericWorker"),q=G("../base64"),W=G("../support"),I=G("../external"),H=null;if(W.nodestream)try{H=G("../nodejs/NodejsStreamOutputAdapter")}catch(P){}function T(P,j){return new I.Promise(function(E,C){var N=[],v=P._internalType,S=P._outputType,F=P._mimeType;P.on("data",function(M,$){N.push(M),j&&j($)}).on("error",function(M){N=[],C(M)}).on("end",function(){try{E(function(M,$,x){switch(M){case"blob":return K.newBlob(K.transformTo("arraybuffer",$),x);case"base64":return q.encode($);default:return K.transformTo(M,$)}}(S,function(M,$){var x,w=0,a=null,U0=0;for(x=0;x<$.length;x++)U0+=$[x].length;switch(M){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":for(a=new Uint8Array(U0),x=0;x<$.length;x++)a.set($[x],w),w+=$[x].length;return a;case"nodebuffer":return Buffer.concat($);default:throw Error("concat : unsupported type '"+M+"'")}}(v,N),F))}catch(M){C(M)}N=[]}).resume()})}function A(P,j,E){var C=j;switch(j){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=j,this._mimeType=E,K.checkSupport(C),this._worker=P.pipe(new Z(C)),P.lock()}catch(N){this._worker=new J("error"),this._worker.error(N)}}A.prototype={accumulate:function(P){return T(this,P)},on:function(P,j){var E=this;return P==="data"?this._worker.on(P,function(C){j.call(E,C.data,C.meta)}):this._worker.on(P,function(){K.delay(j,arguments,E)}),this},resume:function(){return K.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(P){if(K.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new H(this,{objectMode:this._outputType!=="nodebuffer"},P)}},Y.exports=A},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(G,Y,Q){if(Q.base64=!0,Q.array=!0,Q.string=!0,Q.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Q.nodebuffer=typeof Buffer<"u",Q.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")Q.blob=!1;else{var K=new ArrayBuffer(0);try{Q.blob=new Blob([K],{type:"application/zip"}).size===0}catch(J){try{var Z=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Z.append(K),Q.blob=Z.getBlob("application/zip").size===0}catch(q){Q.blob=!1}}}try{Q.nodestream=!!G("readable-stream").Readable}catch(J){Q.nodestream=!1}},{"readable-stream":16}],31:[function(G,Y,Q){for(var K=G("./utils"),Z=G("./support"),J=G("./nodejsUtils"),q=G("./stream/GenericWorker"),W=Array(256),I=0;I<256;I++)W[I]=252<=I?6:248<=I?5:240<=I?4:224<=I?3:192<=I?2:1;W[254]=W[254]=1;function H(){q.call(this,"utf-8 decode"),this.leftOver=null}function T(){q.call(this,"utf-8 encode")}Q.utf8encode=function(A){return Z.nodebuffer?J.newBufferFrom(A,"utf-8"):function(P){var j,E,C,N,v,S=P.length,F=0;for(N=0;N>>6:(E<65536?j[v++]=224|E>>>12:(j[v++]=240|E>>>18,j[v++]=128|E>>>12&63),j[v++]=128|E>>>6&63),j[v++]=128|63&E);return j}(A)},Q.utf8decode=function(A){return Z.nodebuffer?K.transformTo("nodebuffer",A).toString("utf-8"):function(P){var j,E,C,N,v=P.length,S=Array(2*v);for(j=E=0;j>10&1023,S[E++]=56320|1023&C)}return S.length!==E&&(S.subarray?S=S.subarray(0,E):S.length=E),K.applyFromCharCode(S)}(A=K.transformTo(Z.uint8array?"uint8array":"array",A))},K.inherits(H,q),H.prototype.processChunk=function(A){var P=K.transformTo(Z.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(Z.uint8array){var j=P;(P=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),P.set(j,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var E=function(N,v){var S;for((v=v||N.length)>N.length&&(v=N.length),S=v-1;0<=S&&(192&N[S])==128;)S--;return S<0?v:S===0?v:S+W[N[S]]>v?S:v}(P),C=P;E!==P.length&&(Z.uint8array?(C=P.subarray(0,E),this.leftOver=P.subarray(E,P.length)):(C=P.slice(0,E),this.leftOver=P.slice(E,P.length))),this.push({data:Q.utf8decode(C),meta:A.meta})},H.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:Q.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},Q.Utf8DecodeWorker=H,K.inherits(T,q),T.prototype.processChunk=function(A){this.push({data:Q.utf8encode(A.data),meta:A.meta})},Q.Utf8EncodeWorker=T},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(G,Y,Q){var K=G("./support"),Z=G("./base64"),J=G("./nodejsUtils"),q=G("./external");function W(j){return j}function I(j,E){for(var C=0;C>8;this.dir=!!(16&this.externalFileAttributes),A==0&&(this.dosPermissions=63&this.externalFileAttributes),A==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var A=K(this.extraFields[1].value);this.uncompressedSize===Z.MAX_VALUE_32BITS&&(this.uncompressedSize=A.readInt(8)),this.compressedSize===Z.MAX_VALUE_32BITS&&(this.compressedSize=A.readInt(8)),this.localHeaderOffset===Z.MAX_VALUE_32BITS&&(this.localHeaderOffset=A.readInt(8)),this.diskNumberStart===Z.MAX_VALUE_32BITS&&(this.diskNumberStart=A.readInt(4))}},readExtraFields:function(A){var P,j,E,C=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(A<65536?T[E++]=224|A>>>12:(T[E++]=240|A>>>18,T[E++]=128|A>>>12&63),T[E++]=128|A>>>6&63),T[E++]=128|63&A);return T},Q.buf2binstring=function(H){return I(H,H.length)},Q.binstring2buf=function(H){for(var T=new K.Buf8(H.length),A=0,P=T.length;A>10&1023,N[P++]=56320|1023&j)}return I(N,P)},Q.utf8border=function(H,T){var A;for((T=T||H.length)>H.length&&(T=H.length),A=T-1;0<=A&&(192&H[A])==128;)A--;return A<0?T:A===0?T:A+q[H[A]]>T?A:T}},{"./common":41}],43:[function(G,Y,Q){Y.exports=function(K,Z,J,q){for(var W=65535&K|0,I=K>>>16&65535|0,H=0;J!==0;){for(J-=H=2000>>1:Z>>>1;J[q]=Z}return J}();Y.exports=function(Z,J,q,W){var I=K,H=W+q;Z^=-1;for(var T=W;T>>8^I[255&(Z^J[T])];return-1^Z}},{}],46:[function(G,Y,Q){var K,Z=G("../utils/common"),J=G("./trees"),q=G("./adler32"),W=G("./crc32"),I=G("./messages"),H=0,T=4,A=0,P=-2,j=-1,E=4,C=2,N=8,v=9,S=286,F=30,M=19,$=2*S+1,x=15,w=3,a=258,U0=a+w+1,b=42,c=113,D=1,m=2,B0=3,i=4;function V0(R,p){return R.msg=I[p],p}function s(R){return(R<<1)-(4R.avail_out&&(k=R.avail_out),k!==0&&(Z.arraySet(R.output,p.pending_buf,p.pending_out,k,R.next_out),R.next_out+=k,p.pending_out+=k,R.total_out+=k,R.avail_out-=k,p.pending-=k,p.pending===0&&(p.pending_out=0))}function y(R,p){J._tr_flush_block(R,0<=R.block_start?R.block_start:-1,R.strstart-R.block_start,p),R.block_start=R.strstart,r(R.strm)}function n(R,p){R.pending_buf[R.pending++]=p}function o(R,p){R.pending_buf[R.pending++]=p>>>8&255,R.pending_buf[R.pending++]=255&p}function Y0(R,p){var k,V,X=R.max_chain_length,O=R.strstart,_=R.prev_length,l=R.nice_match,d=R.strstart>R.w_size-U0?R.strstart-(R.w_size-U0):0,Q0=R.window,X0=R.w_mask,K0=R.prev,I0=R.strstart+a,F0=Q0[O+_-1],W0=Q0[O+_];R.prev_length>=R.good_match&&(X>>=2),l>R.lookahead&&(l=R.lookahead);do if(Q0[(k=p)+_]===W0&&Q0[k+_-1]===F0&&Q0[k]===Q0[O]&&Q0[++k]===Q0[O+1]){O+=2,k++;do;while(Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Od&&--X!=0);return _<=R.lookahead?_:R.lookahead}function O0(R){var p,k,V,X,O,_,l,d,Q0,X0,K0=R.w_size;do{if(X=R.window_size-R.lookahead-R.strstart,R.strstart>=K0+(K0-U0)){for(Z.arraySet(R.window,R.window,K0,K0,0),R.match_start-=K0,R.strstart-=K0,R.block_start-=K0,p=k=R.hash_size;V=R.head[--p],R.head[p]=K0<=V?V-K0:0,--k;);for(p=k=K0;V=R.prev[--p],R.prev[p]=K0<=V?V-K0:0,--k;);X+=K0}if(R.strm.avail_in===0)break;if(_=R.strm,l=R.window,d=R.strstart+R.lookahead,Q0=X,X0=void 0,X0=_.avail_in,Q0=w)for(O=R.strstart-R.insert,R.ins_h=R.window[O],R.ins_h=(R.ins_h<=w&&(R.ins_h=(R.ins_h<=w)if(V=J._tr_tally(R,R.strstart-R.match_start,R.match_length-w),R.lookahead-=R.match_length,R.match_length<=R.max_lazy_match&&R.lookahead>=w){for(R.match_length--;R.strstart++,R.ins_h=(R.ins_h<=w&&(R.ins_h=(R.ins_h<=w&&R.match_length<=R.prev_length){for(X=R.strstart+R.lookahead-w,V=J._tr_tally(R,R.strstart-1-R.prev_match,R.prev_length-w),R.lookahead-=R.prev_length-1,R.prev_length-=2;++R.strstart<=X&&(R.ins_h=(R.ins_h<R.pending_buf_size-5&&(k=R.pending_buf_size-5);;){if(R.lookahead<=1){if(O0(R),R.lookahead===0&&p===H)return D;if(R.lookahead===0)break}R.strstart+=R.lookahead,R.lookahead=0;var V=R.block_start+k;if((R.strstart===0||R.strstart>=V)&&(R.lookahead=R.strstart-V,R.strstart=V,y(R,!1),R.strm.avail_out===0))return D;if(R.strstart-R.block_start>=R.w_size-U0&&(y(R,!1),R.strm.avail_out===0))return D}return R.insert=0,p===T?(y(R,!0),R.strm.avail_out===0?B0:i):(R.strstart>R.block_start&&(y(R,!1),R.strm.avail_out),D)}),new u(4,4,8,4,z),new u(4,5,16,8,z),new u(4,6,32,32,z),new u(4,4,16,16,L),new u(8,16,32,32,L),new u(8,16,128,128,L),new u(8,32,128,256,L),new u(32,128,258,1024,L),new u(32,258,258,4096,L)],Q.deflateInit=function(R,p){return f(R,p,N,15,8,0)},Q.deflateInit2=f,Q.deflateReset=g,Q.deflateResetKeep=Z0,Q.deflateSetHeader=function(R,p){return R&&R.state?R.state.wrap!==2?P:(R.state.gzhead=p,A):P},Q.deflate=function(R,p){var k,V,X,O;if(!R||!R.state||5>8&255),n(V,V.gzhead.time>>16&255),n(V,V.gzhead.time>>24&255),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,255&V.gzhead.os),V.gzhead.extra&&V.gzhead.extra.length&&(n(V,255&V.gzhead.extra.length),n(V,V.gzhead.extra.length>>8&255)),V.gzhead.hcrc&&(R.adler=W(R.adler,V.pending_buf,V.pending,0)),V.gzindex=0,V.status=69):(n(V,0),n(V,0),n(V,0),n(V,0),n(V,0),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,3),V.status=c);else{var _=N+(V.w_bits-8<<4)<<8;_|=(2<=V.strategy||V.level<2?0:V.level<6?1:V.level===6?2:3)<<6,V.strstart!==0&&(_|=32),_+=31-_%31,V.status=c,o(V,_),V.strstart!==0&&(o(V,R.adler>>>16),o(V,65535&R.adler)),R.adler=1}if(V.status===69)if(V.gzhead.extra){for(X=V.pending;V.gzindex<(65535&V.gzhead.extra.length)&&(V.pending!==V.pending_buf_size||(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending!==V.pending_buf_size));)n(V,255&V.gzhead.extra[V.gzindex]),V.gzindex++;V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),V.gzindex===V.gzhead.extra.length&&(V.gzindex=0,V.status=73)}else V.status=73;if(V.status===73)if(V.gzhead.name){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.gzindex=0,V.status=91)}else V.status=91;if(V.status===91)if(V.gzhead.comment){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.status=103)}else V.status=103;if(V.status===103&&(V.gzhead.hcrc?(V.pending+2>V.pending_buf_size&&r(R),V.pending+2<=V.pending_buf_size&&(n(V,255&R.adler),n(V,R.adler>>8&255),R.adler=0,V.status=c)):V.status=c),V.pending!==0){if(r(R),R.avail_out===0)return V.last_flush=-1,A}else if(R.avail_in===0&&s(p)<=s(k)&&p!==T)return V0(R,-5);if(V.status===666&&R.avail_in!==0)return V0(R,-5);if(R.avail_in!==0||V.lookahead!==0||p!==H&&V.status!==666){var l=V.strategy===2?function(d,Q0){for(var X0;;){if(d.lookahead===0&&(O0(d),d.lookahead===0)){if(Q0===H)return D;break}if(d.match_length=0,X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++,X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):V.strategy===3?function(d,Q0){for(var X0,K0,I0,F0,W0=d.window;;){if(d.lookahead<=a){if(O0(d),d.lookahead<=a&&Q0===H)return D;if(d.lookahead===0)break}if(d.match_length=0,d.lookahead>=w&&0d.lookahead&&(d.match_length=d.lookahead)}if(d.match_length>=w?(X0=J._tr_tally(d,1,d.match_length-w),d.lookahead-=d.match_length,d.strstart+=d.match_length,d.match_length=0):(X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++),X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):K[V.level].func(V,p);if(l!==B0&&l!==i||(V.status=666),l===D||l===B0)return R.avail_out===0&&(V.last_flush=-1),A;if(l===m&&(p===1?J._tr_align(V):p!==5&&(J._tr_stored_block(V,0,0,!1),p===3&&(G0(V.head),V.lookahead===0&&(V.strstart=0,V.block_start=0,V.insert=0))),r(R),R.avail_out===0))return V.last_flush=-1,A}return p!==T?A:V.wrap<=0?1:(V.wrap===2?(n(V,255&R.adler),n(V,R.adler>>8&255),n(V,R.adler>>16&255),n(V,R.adler>>24&255),n(V,255&R.total_in),n(V,R.total_in>>8&255),n(V,R.total_in>>16&255),n(V,R.total_in>>24&255)):(o(V,R.adler>>>16),o(V,65535&R.adler)),r(R),0=k.w_size&&(O===0&&(G0(k.head),k.strstart=0,k.block_start=0,k.insert=0),Q0=new Z.Buf8(k.w_size),Z.arraySet(Q0,p,X0-k.w_size,k.w_size,0),p=Q0,X0=k.w_size),_=R.avail_in,l=R.next_in,d=R.input,R.avail_in=X0,R.next_in=0,R.input=p,O0(k);k.lookahead>=w;){for(V=k.strstart,X=k.lookahead-(w-1);k.ins_h=(k.ins_h<>>=w=x>>>24,v-=w,(w=x>>>16&255)===0)m[I++]=65535&x;else{if(!(16&w)){if((64&w)==0){x=S[(65535&x)+(N&(1<>>=w,v-=w),v<15&&(N+=D[q++]<>>=w=x>>>24,v-=w,!(16&(w=x>>>16&255))){if((64&w)==0){x=F[(65535&x)+(N&(1<>>=w,v-=w,(w=I-H)>3,N&=(1<<(v-=a<<3))-1,K.next_in=q,K.next_out=I,K.avail_in=q>>24&255)+(b>>>8&65280)+((65280&b)<<8)+((255&b)<<24)}function N(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new K.Buf16(320),this.work=new K.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(b){var c;return b&&b.state?(c=b.state,b.total_in=b.total_out=c.total=0,b.msg="",c.wrap&&(b.adler=1&c.wrap),c.mode=P,c.last=0,c.havedict=0,c.dmax=32768,c.head=null,c.hold=0,c.bits=0,c.lencode=c.lendyn=new K.Buf32(j),c.distcode=c.distdyn=new K.Buf32(E),c.sane=1,c.back=-1,T):A}function S(b){var c;return b&&b.state?((c=b.state).wsize=0,c.whave=0,c.wnext=0,v(b)):A}function F(b,c){var D,m;return b&&b.state?(m=b.state,c<0?(D=0,c=-c):(D=1+(c>>4),c<48&&(c&=15)),c&&(c<8||15=i.wsize?(K.arraySet(i.window,c,D-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(m<(B0=i.wsize-i.wnext)&&(B0=m),K.arraySet(i.window,c,D-m,B0,i.wnext),(m-=B0)?(K.arraySet(i.window,c,D-m,m,0),i.wnext=m,i.whave=i.wsize):(i.wnext+=B0,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,D.check=J(D.check,O,2,0),y=r=0,D.mode=2;break}if(D.flags=0,D.head&&(D.head.done=!1),!(1&D.wrap)||(((255&r)<<8)+(r>>8))%31){b.msg="incorrect header check",D.mode=30;break}if((15&r)!=8){b.msg="unknown compression method",D.mode=30;break}if(y-=4,R=8+(15&(r>>>=4)),D.wbits===0)D.wbits=R;else if(R>D.wbits){b.msg="invalid window size",D.mode=30;break}D.dmax=1<>8&1),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=3;case 3:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>8&255,O[2]=r>>>16&255,O[3]=r>>>24&255,D.check=J(D.check,O,4,0)),y=r=0,D.mode=4;case 4:for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>8),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=5;case 5:if(1024&D.flags){for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>>8&255,D.check=J(D.check,O,2,0)),y=r=0}else D.head&&(D.head.extra=null);D.mode=6;case 6:if(1024&D.flags&&(s<(Y0=D.length)&&(Y0=s),Y0&&(D.head&&(R=D.head.extra_len-D.length,D.head.extra||(D.head.extra=Array(D.head.extra_len)),K.arraySet(D.head.extra,m,i,Y0,R)),512&D.flags&&(D.check=J(D.check,m,Y0,i)),s-=Y0,i+=Y0,D.length-=Y0),D.length))break B;D.length=0,D.mode=7;case 7:if(2048&D.flags){if(s===0)break B;for(Y0=0;R=m[i+Y0++],D.head&&R&&D.length<65536&&(D.head.name+=String.fromCharCode(R)),R&&Y0>9&1,D.head.done=!0),b.adler=D.check=0,D.mode=12;break;case 10:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>=7&y,y-=7&y,D.mode=27;break}for(;y<3;){if(s===0)break B;s--,r+=m[i++]<>>=1)){case 0:D.mode=14;break;case 1:if(a(D),D.mode=20,c!==6)break;r>>>=2,y-=2;break B;case 2:D.mode=17;break;case 3:b.msg="invalid block type",D.mode=30}r>>>=2,y-=2;break;case 14:for(r>>>=7&y,y-=7&y;y<32;){if(s===0)break B;s--,r+=m[i++]<>>16^65535)){b.msg="invalid stored block lengths",D.mode=30;break}if(D.length=65535&r,y=r=0,D.mode=15,c===6)break B;case 15:D.mode=16;case 16:if(Y0=D.length){if(s>>=5,y-=5,D.ndist=1+(31&r),r>>>=5,y-=5,D.ncode=4+(15&r),r>>>=4,y-=4,286>>=3,y-=3}for(;D.have<19;)D.lens[_[D.have++]]=0;if(D.lencode=D.lendyn,D.lenbits=7,k={bits:D.lenbits},p=W(0,D.lens,0,19,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid code lengths set",D.mode=30;break}D.have=0,D.mode=19;case 19:for(;D.have>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=L,y-=L,D.lens[D.have++]=h;else{if(h===16){for(V=L+2;y>>=L,y-=L,D.have===0){b.msg="invalid bit length repeat",D.mode=30;break}R=D.lens[D.have-1],Y0=3+(3&r),r>>>=2,y-=2}else if(h===17){for(V=L+3;y>>=L)),r>>>=3,y-=3}else{for(V=L+7;y>>=L)),r>>>=7,y-=7}if(D.have+Y0>D.nlen+D.ndist){b.msg="invalid bit length repeat",D.mode=30;break}for(;Y0--;)D.lens[D.have++]=R}}if(D.mode===30)break;if(D.lens[256]===0){b.msg="invalid code -- missing end-of-block",D.mode=30;break}if(D.lenbits=9,k={bits:D.lenbits},p=W(I,D.lens,0,D.nlen,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid literal/lengths set",D.mode=30;break}if(D.distbits=6,D.distcode=D.distdyn,k={bits:D.distbits},p=W(H,D.lens,D.nlen,D.ndist,D.distcode,0,D.work,k),D.distbits=k.bits,p){b.msg="invalid distances set",D.mode=30;break}if(D.mode=20,c===6)break B;case 20:D.mode=21;case 21:if(6<=s&&258<=G0){b.next_out=V0,b.avail_out=G0,b.next_in=i,b.avail_in=s,D.hold=r,D.bits=y,q(b,o),V0=b.next_out,B0=b.output,G0=b.avail_out,i=b.next_in,m=b.input,s=b.avail_in,r=D.hold,y=D.bits,D.mode===12&&(D.back=-1);break}for(D.back=0;u=(X=D.lencode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,D.length=h,u===0){D.mode=26;break}if(32&u){D.back=-1,D.mode=12;break}if(64&u){b.msg="invalid literal/length code",D.mode=30;break}D.extra=15&u,D.mode=22;case 22:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}D.was=D.length,D.mode=23;case 23:for(;u=(X=D.distcode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,64&u){b.msg="invalid distance code",D.mode=30;break}D.offset=h,D.extra=15&u,D.mode=24;case 24:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}if(D.offset>D.dmax){b.msg="invalid distance too far back",D.mode=30;break}D.mode=25;case 25:if(G0===0)break B;if(Y0=o-G0,D.offset>Y0){if((Y0=D.offset-Y0)>D.whave&&D.sane){b.msg="invalid distance too far back",D.mode=30;break}O0=Y0>D.wnext?(Y0-=D.wnext,D.wsize-Y0):D.wnext-Y0,Y0>D.length&&(Y0=D.length),z=D.window}else z=B0,O0=V0-D.offset,Y0=D.length;for(G0$?(w=O0[z+E[c]],y[n+E[c]]):(w=96,0),N=1<>V0)+(v-=N)]=x<<24|w<<16|a|0,v!==0;);for(N=1<>=1;if(N!==0?(r&=N-1,r+=N):r=0,c++,--o[b]==0){if(b===m)break;b=H[T+E[c]]}if(B0>>7)]}function n(X,O){X.pending_buf[X.pending++]=255&O,X.pending_buf[X.pending++]=O>>>8&255}function o(X,O,_){X.bi_valid>C-_?(X.bi_buf|=O<>C-X.bi_valid,X.bi_valid+=_-C):(X.bi_buf|=O<>>=1,_<<=1,0<--O;);return _>>>1}function z(X,O,_){var l,d,Q0=Array(E+1),X0=0;for(l=1;l<=E;l++)Q0[l]=X0=X0+_[l-1]<<1;for(d=0;d<=O;d++){var K0=X[2*d+1];K0!==0&&(X[2*d]=O0(Q0[K0]++,K0))}}function L(X){var O;for(O=0;O>1;1<=_;_--)Z0(X,Q0,_);for(d=I0;_=X.heap[1],X.heap[1]=X.heap[X.heap_len--],Z0(X,Q0,1),l=X.heap[1],X.heap[--X.heap_max]=_,X.heap[--X.heap_max]=l,Q0[2*d]=Q0[2*_]+Q0[2*l],X.depth[d]=(X.depth[_]>=X.depth[l]?X.depth[_]:X.depth[l])+1,Q0[2*_+1]=Q0[2*l+1]=d,X.heap[1]=d++,Z0(X,Q0,1),2<=X.heap_len;);X.heap[--X.heap_max]=X.heap[1],function(W0,k0){var L2,m0,r2,w0,W1,p1,Y2=k0.dyn_tree,I6=k0.max_code,X5=k0.stat_desc.static_tree,q5=k0.stat_desc.has_stree,M5=k0.stat_desc.extra_bits,O6=k0.stat_desc.extra_base,i2=k0.stat_desc.max_length,P1=0;for(w0=0;w0<=E;w0++)W0.bl_count[w0]=0;for(Y2[2*W0.heap[W0.heap_max]+1]=0,L2=W0.heap_max+1;L2>=7;d>>=1)if(1&F0&&K0.dyn_ltree[2*I0]!==0)return Z;if(K0.dyn_ltree[18]!==0||K0.dyn_ltree[20]!==0||K0.dyn_ltree[26]!==0)return J;for(I0=32;I0>>3,(Q0=X.static_len+3+7>>>3)<=d&&(d=Q0)):d=Q0=_+5,_+4<=d&&O!==-1?V(X,O,_,l):X.strategy===4||Q0===d?(o(X,2+(l?1:0),3),g(X,U0,b)):(o(X,4+(l?1:0),3),function(K0,I0,F0,W0){var k0;for(o(K0,I0-257,5),o(K0,F0-1,5),o(K0,W0-4,4),k0=0;k0>>8&255,X.pending_buf[X.d_buf+2*X.last_lit+1]=255&O,X.pending_buf[X.l_buf+X.last_lit]=255&_,X.last_lit++,O===0?X.dyn_ltree[2*_]++:(X.matches++,O--,X.dyn_ltree[2*(D[_]+H+1)]++,X.dyn_dtree[2*y(O)]++),X.last_lit===X.lit_bufsize-1},Q._tr_align=function(X){o(X,2,3),Y0(X,v,U0),function(O){O.bi_valid===16?(n(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(X)}},{"../utils/common":41}],53:[function(G,Y,Q){Y.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(G,Y,Q){(function(K){(function(Z,J){if(!Z.setImmediate){var q,W,I,H,T=1,A={},P=!1,j=Z.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(Z);E=E&&E.setTimeout?E:Z,q={}.toString.call(Z.process)==="[object process]"?function(S){P0.nextTick(function(){N(S)})}:function(){if(Z.postMessage&&!Z.importScripts){var S=!0,F=Z.onmessage;return Z.onmessage=function(){S=!1},Z.postMessage("","*"),Z.onmessage=F,S}}()?(H="setImmediate$"+Math.random()+"$",Z.addEventListener?Z.addEventListener("message",v,!1):Z.attachEvent("onmessage",v),function(S){Z.postMessage(H+S,"*")}):Z.MessageChannel?((I=new MessageChannel).port1.onmessage=function(S){N(S.data)},function(S){I.port2.postMessage(S)}):j&&("onreadystatechange"in j.createElement("script"))?(W=j.documentElement,function(S){var F=j.createElement("script");F.onreadystatechange=function(){N(S),F.onreadystatechange=null,W.removeChild(F),F=null},W.appendChild(F)}):function(S){setTimeout(N,0,S)},E.setImmediate=function(S){typeof S!="function"&&(S=Function(""+S));for(var F=Array(arguments.length-1),M=0;M"u"?K===void 0?this:K:self)}).call(this,typeof v0<"u"?v0:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}),kK=R0((B,U)=>{var G={"&":"&",'"':""","'":"'","<":"<",">":">"};function Y(Q){return Q&&Q.replace?Q.replace(/([&"<>'])/g,function(K,Z){return G[Z]}):Q}U.exports=Y}),$K=R0((B,U)=>{P2();var G=kK(),Y=x8().Stream,Q=" ";function K(H,T){if(typeof T!=="object")T={indent:T};var A=T.stream?new Y:null,P="",j=!1,E=!T.indent?"":T.indent===!0?Q:T.indent,C=!0;function N($){if(!C)$();else P0.nextTick($)}function v($,x){if(x!==void 0)P+=x;if($&&!j)A=A||new Y,j=!0;if($&&j){var w=P;N(function(){A.emit("data",w)}),P=""}}function S($,x){W(v,q($,E,E?1:0),x)}function F(){if(A){var $=P;N(function(){A.emit("data",$),A.emit("end"),A.readable=!1,A.emit("close")})}}function M($){var x={version:"1.0",encoding:$.encoding||"UTF-8"};if($.standalone)x.standalone=$.standalone;S({"?xml":{_attr:x}}),P=P.replace("/>","?>")}if(N(function(){C=!1}),T.declaration)M(T.declaration);if(H&&H.forEach)H.forEach(function($,x){var w;if(x+1===H.length)w=F;S($,w)});else S(H,F);if(A)return A.readable=!0,A;return P}function Z(){var H={_elem:q(Array.prototype.slice.call(arguments))};return H.push=function(T){if(!this.append)throw Error("not assigned to a parent!");var A=this,P=this._elem.indent;W(this.append,q(T,P,this._elem.icount+(P?1:0)),function(){A.append(!0)})},H.close=function(T){if(T!==void 0)this.push(T);if(this.end)this.end()},H}function J(H,T){return Array(T||0).join(H||"")}function q(H,T,A){A=A||0;var P=J(T,A),j,E=H,C=!1;if(typeof H==="object"){if(j=Object.keys(H)[0],E=H[j],E&&E._elem)return E._elem.name=j,E._elem.icount=A,E._elem.indent=T,E._elem.indents=P,E._elem.interrupt=E,E._elem}var N=[],v=[],S;function F(M){Object.keys(M).forEach(function($){N.push(I($,M[$]))})}switch(typeof E){case"object":if(E===null)break;if(E._attr)F(E._attr);if(E._cdata)v.push(("/g,"]]]]>")+"]]>");if(E.forEach){if(S=!1,v.push(""),E.forEach(function(M){if(typeof M=="object")if(Object.keys(M)[0]=="_attr")F(M._attr);else v.push(q(M,T,A+1));else v.pop(),S=!0,v.push(G(M))}),!S)v.push("")}break;default:v.push(G(E))}return{name:j,interrupt:C,attributes:N,content:v,icount:A,indents:P,indent:T}}function W(H,T,A){if(typeof T!="object")return H(!1,T);var P=T.interrupt?1:T.content.length;function j(){while(T.content.length){var C=T.content.shift();if(C===void 0)continue;if(E(C))return;W(H,C)}if(H(!1,(P>1?T.indents:"")+(T.name?"":"")+(T.indent&&!A?` + */(function(G){if(typeof B=="object"&&typeof U<"u")U.exports=G();else if(typeof define=="function"&&define.amd)define([],G);else(typeof window<"u"?window:typeof v0<"u"?v0:typeof self<"u"?self:this).JSZip=G()})(function(){return function G(Y,Q,K){function Z(W,I){if(!Q[W]){if(!Y[W]){var H=typeof w1=="function"&&w1;if(!I&&H)return H(W,!0);if(J)return J(W,!0);var T=Error("Cannot find module '"+W+"'");throw T.code="MODULE_NOT_FOUND",T}var A=Q[W]={exports:{}};Y[W][0].call(A.exports,function(P){var j=Y[W][1][P];return Z(j||P)},A,A.exports,G,Y,Q,K)}return Q[W].exports}for(var J=typeof w1=="function"&&w1,q=0;q>2,A=(3&W)<<4|I>>4,P=1>6:64,j=2>4,I=(15&T)<<4|(A=J.indexOf(q.charAt(j++)))>>2,H=(3&A)<<6|(P=J.indexOf(q.charAt(j++))),N[E++]=W,A!==64&&(N[E++]=I),P!==64&&(N[E++]=H);return N}},{"./support":30,"./utils":32}],2:[function(G,Y,Q){var K=G("./external"),Z=G("./stream/DataWorker"),J=G("./stream/Crc32Probe"),q=G("./stream/DataLengthProbe");function W(I,H,T,A,P){this.compressedSize=I,this.uncompressedSize=H,this.crc32=T,this.compression=A,this.compressedContent=P}W.prototype={getContentWorker:function(){var I=new Z(K.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new q("data_length")),H=this;return I.on("end",function(){if(this.streamInfo.data_length!==H.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),I},getCompressedWorker:function(){return new Z(K.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},W.createWorkerFrom=function(I,H,T){return I.pipe(new J).pipe(new q("uncompressedSize")).pipe(H.compressWorker(T)).pipe(new q("compressedSize")).withStreamInfo("compression",H)},Y.exports=W},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(G,Y,Q){var K=G("./stream/GenericWorker");Q.STORE={magic:"\x00\x00",compressWorker:function(){return new K("STORE compression")},uncompressWorker:function(){return new K("STORE decompression")}},Q.DEFLATE=G("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(G,Y,Q){var K=G("./utils"),Z=function(){for(var J,q=[],W=0;W<256;W++){J=W;for(var I=0;I<8;I++)J=1&J?3988292384^J>>>1:J>>>1;q[W]=J}return q}();Y.exports=function(J,q){return J!==void 0&&J.length?K.getTypeOf(J)!=="string"?function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I[j])];return-1^W}(0|q,J,J.length,0):function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I.charCodeAt(j))];return-1^W}(0|q,J,J.length,0):0}},{"./utils":32}],5:[function(G,Y,Q){Q.base64=!1,Q.binary=!1,Q.dir=!1,Q.createFolders=!0,Q.date=null,Q.compression=null,Q.compressionOptions=null,Q.comment=null,Q.unixPermissions=null,Q.dosPermissions=null},{}],6:[function(G,Y,Q){var K=null;K=typeof Promise<"u"?Promise:G("lie"),Y.exports={Promise:K}},{lie:37}],7:[function(G,Y,Q){var K=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",Z=G("pako"),J=G("./utils"),q=G("./stream/GenericWorker"),W=K?"uint8array":"array";function I(H,T){q.call(this,"FlateWorker/"+H),this._pako=null,this._pakoAction=H,this._pakoOptions=T,this.meta={}}Q.magic="\b\x00",J.inherits(I,q),I.prototype.processChunk=function(H){this.meta=H.meta,this._pako===null&&this._createPako(),this._pako.push(J.transformTo(W,H.data),!1)},I.prototype.flush=function(){q.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},I.prototype.cleanUp=function(){q.prototype.cleanUp.call(this),this._pako=null},I.prototype._createPako=function(){this._pako=new Z[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var H=this;this._pako.onData=function(T){H.push({data:T,meta:H.meta})}},Q.compressWorker=function(H){return new I("Deflate",H)},Q.uncompressWorker=function(){return new I("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(G,Y,Q){function K(A,P){var j,E="";for(j=0;j>>=8;return E}function Z(A,P,j,E,C,N){var v,S,F=A.file,M=A.compression,$=N!==W.utf8encode,x=J.transformTo("string",N(F.name)),z=J.transformTo("string",W.utf8encode(F.name)),a=F.comment,U0=J.transformTo("string",N(a)),b=J.transformTo("string",W.utf8encode(a)),c=z.length!==F.name.length,D=b.length!==a.length,m="",B0="",i="",V0=F.dir,s=F.date,G0={crc32:0,compressedSize:0,uncompressedSize:0};P&&!j||(G0.crc32=A.crc32,G0.compressedSize=A.compressedSize,G0.uncompressedSize=A.uncompressedSize);var r=0;P&&(r|=8),$||!c&&!D||(r|=2048);var y=0,n=0;V0&&(y|=16),C==="UNIX"?(n=798,y|=function(Y0,O0){var w=Y0;return Y0||(w=O0?16893:33204),(65535&w)<<16}(F.unixPermissions,V0)):(n=20,y|=function(Y0){return 63&(Y0||0)}(F.dosPermissions)),v=s.getUTCHours(),v<<=6,v|=s.getUTCMinutes(),v<<=5,v|=s.getUTCSeconds()/2,S=s.getUTCFullYear()-1980,S<<=4,S|=s.getUTCMonth()+1,S<<=5,S|=s.getUTCDate(),c&&(B0=K(1,1)+K(I(x),4)+z,m+="up"+K(B0.length,2)+B0),D&&(i=K(1,1)+K(I(U0),4)+b,m+="uc"+K(i.length,2)+i);var o="";return o+=` +\x00`,o+=K(r,2),o+=M.magic,o+=K(v,2),o+=K(S,2),o+=K(G0.crc32,4),o+=K(G0.compressedSize,4),o+=K(G0.uncompressedSize,4),o+=K(x.length,2),o+=K(m.length,2),{fileRecord:H.LOCAL_FILE_HEADER+o+x+m,dirRecord:H.CENTRAL_FILE_HEADER+K(n,2)+o+K(U0.length,2)+"\x00\x00\x00\x00"+K(y,4)+K(E,4)+x+m+U0}}var J=G("../utils"),q=G("../stream/GenericWorker"),W=G("../utf8"),I=G("../crc32"),H=G("../signature");function T(A,P,j,E){q.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=j,this.encodeFileName=E,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}J.inherits(T,q),T.prototype.push=function(A){var P=A.meta.percent||0,j=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,q.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:j?(P+100*(j-E-1))/j:100}}))},T.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var P=this.streamFiles&&!A.file.dir;if(P){var j=Z(A,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},T.prototype.closedSource=function(A){this.accumulate=!1;var P=this.streamFiles&&!A.file.dir,j=Z(A,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),P)this.push({data:function(E){return H.DATA_DESCRIPTOR+K(E.crc32,4)+K(E.compressedSize,4)+K(E.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},T.prototype.flush=function(){for(var A=this.bytesWritten,P=0;P=this.index;q--)W=(W<<8)+this.byteAt(q);return this.index+=J,W},readString:function(J){return K.transformTo("string",this.readData(J))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var J=this.readInt(4);return new Date(Date.UTC(1980+(J>>25&127),(J>>21&15)-1,J>>16&31,J>>11&31,J>>5&63,(31&J)<<1))}},Y.exports=Z},{"../utils":32}],19:[function(G,Y,Q){var K=G("./Uint8ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(G,Y,Q){var K=G("./DataReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.byteAt=function(J){return this.data.charCodeAt(this.zero+J)},Z.prototype.lastIndexOfSignature=function(J){return this.data.lastIndexOf(J)-this.zero},Z.prototype.readAndCheckSignature=function(J){return J===this.readData(4)},Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./DataReader":18}],21:[function(G,Y,Q){var K=G("./ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){if(this.checkOffset(J),J===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./ArrayReader":17}],22:[function(G,Y,Q){var K=G("../utils"),Z=G("../support"),J=G("./ArrayReader"),q=G("./StringReader"),W=G("./NodeBufferReader"),I=G("./Uint8ArrayReader");Y.exports=function(H){var T=K.getTypeOf(H);return K.checkSupport(T),T!=="string"||Z.uint8array?T==="nodebuffer"?new W(H):Z.uint8array?new I(K.transformTo("uint8array",H)):new J(K.transformTo("array",H)):new q(H)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(G,Y,Q){Q.LOCAL_FILE_HEADER="PK\x03\x04",Q.CENTRAL_FILE_HEADER="PK\x01\x02",Q.CENTRAL_DIRECTORY_END="PK\x05\x06",Q.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",Q.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",Q.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../utils");function J(q){K.call(this,"ConvertWorker to "+q),this.destType=q}Z.inherits(J,K),J.prototype.processChunk=function(q){this.push({data:Z.transformTo(this.destType,q.data),meta:q.meta})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],25:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../crc32");function J(){K.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}G("../utils").inherits(J,K),J.prototype.processChunk=function(q){this.streamInfo.crc32=Z(q.data,this.streamInfo.crc32||0),this.push(q)},Y.exports=J},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataLengthProbe for "+q),this.propName=q,this.withStreamInfo(q,0)}K.inherits(J,Z),J.prototype.processChunk=function(q){if(q){var W=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=W+q.data.length}Z.prototype.processChunk.call(this,q)},Y.exports=J},{"../utils":32,"./GenericWorker":28}],27:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataWorker");var W=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,q.then(function(I){W.dataIsReady=!0,W.data=I,W.max=I&&I.length||0,W.type=K.getTypeOf(I),W.isPaused||W._tickAndRepeat()},function(I){W.error(I)})}K.inherits(J,Z),J.prototype.cleanUp=function(){Z.prototype.cleanUp.call(this),this.data=null},J.prototype.resume=function(){return!!Z.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,K.delay(this._tickAndRepeat,[],this)),!0)},J.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(K.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},J.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var q=null,W=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":q=this.data.substring(this.index,W);break;case"uint8array":q=this.data.subarray(this.index,W);break;case"array":case"nodebuffer":q=this.data.slice(this.index,W)}return this.index=W,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],28:[function(G,Y,Q){function K(Z){this.name=Z||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}K.prototype={push:function(Z){this.emit("data",Z)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Z){this.emit("error",Z)}return!0},error:function(Z){return!this.isFinished&&(this.isPaused?this.generatedError=Z:(this.isFinished=!0,this.emit("error",Z),this.previous&&this.previous.error(Z),this.cleanUp()),!0)},on:function(Z,J){return this._listeners[Z].push(J),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Z,J){if(this._listeners[Z])for(var q=0;q "+Z:Z}},Y.exports=K},{}],29:[function(G,Y,Q){var K=G("../utils"),Z=G("./ConvertWorker"),J=G("./GenericWorker"),q=G("../base64"),W=G("../support"),I=G("../external"),H=null;if(W.nodestream)try{H=G("../nodejs/NodejsStreamOutputAdapter")}catch(P){}function T(P,j){return new I.Promise(function(E,C){var N=[],v=P._internalType,S=P._outputType,F=P._mimeType;P.on("data",function(M,$){N.push(M),j&&j($)}).on("error",function(M){N=[],C(M)}).on("end",function(){try{E(function(M,$,x){switch(M){case"blob":return K.newBlob(K.transformTo("arraybuffer",$),x);case"base64":return q.encode($);default:return K.transformTo(M,$)}}(S,function(M,$){var x,z=0,a=null,U0=0;for(x=0;x<$.length;x++)U0+=$[x].length;switch(M){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":for(a=new Uint8Array(U0),x=0;x<$.length;x++)a.set($[x],z),z+=$[x].length;return a;case"nodebuffer":return Buffer.concat($);default:throw Error("concat : unsupported type '"+M+"'")}}(v,N),F))}catch(M){C(M)}N=[]}).resume()})}function A(P,j,E){var C=j;switch(j){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=j,this._mimeType=E,K.checkSupport(C),this._worker=P.pipe(new Z(C)),P.lock()}catch(N){this._worker=new J("error"),this._worker.error(N)}}A.prototype={accumulate:function(P){return T(this,P)},on:function(P,j){var E=this;return P==="data"?this._worker.on(P,function(C){j.call(E,C.data,C.meta)}):this._worker.on(P,function(){K.delay(j,arguments,E)}),this},resume:function(){return K.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(P){if(K.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new H(this,{objectMode:this._outputType!=="nodebuffer"},P)}},Y.exports=A},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(G,Y,Q){if(Q.base64=!0,Q.array=!0,Q.string=!0,Q.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Q.nodebuffer=typeof Buffer<"u",Q.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")Q.blob=!1;else{var K=new ArrayBuffer(0);try{Q.blob=new Blob([K],{type:"application/zip"}).size===0}catch(J){try{var Z=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Z.append(K),Q.blob=Z.getBlob("application/zip").size===0}catch(q){Q.blob=!1}}}try{Q.nodestream=!!G("readable-stream").Readable}catch(J){Q.nodestream=!1}},{"readable-stream":16}],31:[function(G,Y,Q){for(var K=G("./utils"),Z=G("./support"),J=G("./nodejsUtils"),q=G("./stream/GenericWorker"),W=Array(256),I=0;I<256;I++)W[I]=252<=I?6:248<=I?5:240<=I?4:224<=I?3:192<=I?2:1;W[254]=W[254]=1;function H(){q.call(this,"utf-8 decode"),this.leftOver=null}function T(){q.call(this,"utf-8 encode")}Q.utf8encode=function(A){return Z.nodebuffer?J.newBufferFrom(A,"utf-8"):function(P){var j,E,C,N,v,S=P.length,F=0;for(N=0;N>>6:(E<65536?j[v++]=224|E>>>12:(j[v++]=240|E>>>18,j[v++]=128|E>>>12&63),j[v++]=128|E>>>6&63),j[v++]=128|63&E);return j}(A)},Q.utf8decode=function(A){return Z.nodebuffer?K.transformTo("nodebuffer",A).toString("utf-8"):function(P){var j,E,C,N,v=P.length,S=Array(2*v);for(j=E=0;j>10&1023,S[E++]=56320|1023&C)}return S.length!==E&&(S.subarray?S=S.subarray(0,E):S.length=E),K.applyFromCharCode(S)}(A=K.transformTo(Z.uint8array?"uint8array":"array",A))},K.inherits(H,q),H.prototype.processChunk=function(A){var P=K.transformTo(Z.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(Z.uint8array){var j=P;(P=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),P.set(j,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var E=function(N,v){var S;for((v=v||N.length)>N.length&&(v=N.length),S=v-1;0<=S&&(192&N[S])==128;)S--;return S<0?v:S===0?v:S+W[N[S]]>v?S:v}(P),C=P;E!==P.length&&(Z.uint8array?(C=P.subarray(0,E),this.leftOver=P.subarray(E,P.length)):(C=P.slice(0,E),this.leftOver=P.slice(E,P.length))),this.push({data:Q.utf8decode(C),meta:A.meta})},H.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:Q.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},Q.Utf8DecodeWorker=H,K.inherits(T,q),T.prototype.processChunk=function(A){this.push({data:Q.utf8encode(A.data),meta:A.meta})},Q.Utf8EncodeWorker=T},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(G,Y,Q){var K=G("./support"),Z=G("./base64"),J=G("./nodejsUtils"),q=G("./external");function W(j){return j}function I(j,E){for(var C=0;C>8;this.dir=!!(16&this.externalFileAttributes),A==0&&(this.dosPermissions=63&this.externalFileAttributes),A==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var A=K(this.extraFields[1].value);this.uncompressedSize===Z.MAX_VALUE_32BITS&&(this.uncompressedSize=A.readInt(8)),this.compressedSize===Z.MAX_VALUE_32BITS&&(this.compressedSize=A.readInt(8)),this.localHeaderOffset===Z.MAX_VALUE_32BITS&&(this.localHeaderOffset=A.readInt(8)),this.diskNumberStart===Z.MAX_VALUE_32BITS&&(this.diskNumberStart=A.readInt(4))}},readExtraFields:function(A){var P,j,E,C=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(A<65536?T[E++]=224|A>>>12:(T[E++]=240|A>>>18,T[E++]=128|A>>>12&63),T[E++]=128|A>>>6&63),T[E++]=128|63&A);return T},Q.buf2binstring=function(H){return I(H,H.length)},Q.binstring2buf=function(H){for(var T=new K.Buf8(H.length),A=0,P=T.length;A>10&1023,N[P++]=56320|1023&j)}return I(N,P)},Q.utf8border=function(H,T){var A;for((T=T||H.length)>H.length&&(T=H.length),A=T-1;0<=A&&(192&H[A])==128;)A--;return A<0?T:A===0?T:A+q[H[A]]>T?A:T}},{"./common":41}],43:[function(G,Y,Q){Y.exports=function(K,Z,J,q){for(var W=65535&K|0,I=K>>>16&65535|0,H=0;J!==0;){for(J-=H=2000>>1:Z>>>1;J[q]=Z}return J}();Y.exports=function(Z,J,q,W){var I=K,H=W+q;Z^=-1;for(var T=W;T>>8^I[255&(Z^J[T])];return-1^Z}},{}],46:[function(G,Y,Q){var K,Z=G("../utils/common"),J=G("./trees"),q=G("./adler32"),W=G("./crc32"),I=G("./messages"),H=0,T=4,A=0,P=-2,j=-1,E=4,C=2,N=8,v=9,S=286,F=30,M=19,$=2*S+1,x=15,z=3,a=258,U0=a+z+1,b=42,c=113,D=1,m=2,B0=3,i=4;function V0(R,p){return R.msg=I[p],p}function s(R){return(R<<1)-(4R.avail_out&&(k=R.avail_out),k!==0&&(Z.arraySet(R.output,p.pending_buf,p.pending_out,k,R.next_out),R.next_out+=k,p.pending_out+=k,R.total_out+=k,R.avail_out-=k,p.pending-=k,p.pending===0&&(p.pending_out=0))}function y(R,p){J._tr_flush_block(R,0<=R.block_start?R.block_start:-1,R.strstart-R.block_start,p),R.block_start=R.strstart,r(R.strm)}function n(R,p){R.pending_buf[R.pending++]=p}function o(R,p){R.pending_buf[R.pending++]=p>>>8&255,R.pending_buf[R.pending++]=255&p}function Y0(R,p){var k,V,X=R.max_chain_length,O=R.strstart,_=R.prev_length,l=R.nice_match,d=R.strstart>R.w_size-U0?R.strstart-(R.w_size-U0):0,Q0=R.window,X0=R.w_mask,K0=R.prev,I0=R.strstart+a,F0=Q0[O+_-1],W0=Q0[O+_];R.prev_length>=R.good_match&&(X>>=2),l>R.lookahead&&(l=R.lookahead);do if(Q0[(k=p)+_]===W0&&Q0[k+_-1]===F0&&Q0[k]===Q0[O]&&Q0[++k]===Q0[O+1]){O+=2,k++;do;while(Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Od&&--X!=0);return _<=R.lookahead?_:R.lookahead}function O0(R){var p,k,V,X,O,_,l,d,Q0,X0,K0=R.w_size;do{if(X=R.window_size-R.lookahead-R.strstart,R.strstart>=K0+(K0-U0)){for(Z.arraySet(R.window,R.window,K0,K0,0),R.match_start-=K0,R.strstart-=K0,R.block_start-=K0,p=k=R.hash_size;V=R.head[--p],R.head[p]=K0<=V?V-K0:0,--k;);for(p=k=K0;V=R.prev[--p],R.prev[p]=K0<=V?V-K0:0,--k;);X+=K0}if(R.strm.avail_in===0)break;if(_=R.strm,l=R.window,d=R.strstart+R.lookahead,Q0=X,X0=void 0,X0=_.avail_in,Q0=z)for(O=R.strstart-R.insert,R.ins_h=R.window[O],R.ins_h=(R.ins_h<=z&&(R.ins_h=(R.ins_h<=z)if(V=J._tr_tally(R,R.strstart-R.match_start,R.match_length-z),R.lookahead-=R.match_length,R.match_length<=R.max_lazy_match&&R.lookahead>=z){for(R.match_length--;R.strstart++,R.ins_h=(R.ins_h<=z&&(R.ins_h=(R.ins_h<=z&&R.match_length<=R.prev_length){for(X=R.strstart+R.lookahead-z,V=J._tr_tally(R,R.strstart-1-R.prev_match,R.prev_length-z),R.lookahead-=R.prev_length-1,R.prev_length-=2;++R.strstart<=X&&(R.ins_h=(R.ins_h<R.pending_buf_size-5&&(k=R.pending_buf_size-5);;){if(R.lookahead<=1){if(O0(R),R.lookahead===0&&p===H)return D;if(R.lookahead===0)break}R.strstart+=R.lookahead,R.lookahead=0;var V=R.block_start+k;if((R.strstart===0||R.strstart>=V)&&(R.lookahead=R.strstart-V,R.strstart=V,y(R,!1),R.strm.avail_out===0))return D;if(R.strstart-R.block_start>=R.w_size-U0&&(y(R,!1),R.strm.avail_out===0))return D}return R.insert=0,p===T?(y(R,!0),R.strm.avail_out===0?B0:i):(R.strstart>R.block_start&&(y(R,!1),R.strm.avail_out),D)}),new u(4,4,8,4,w),new u(4,5,16,8,w),new u(4,6,32,32,w),new u(4,4,16,16,L),new u(8,16,32,32,L),new u(8,16,128,128,L),new u(8,32,128,256,L),new u(32,128,258,1024,L),new u(32,258,258,4096,L)],Q.deflateInit=function(R,p){return f(R,p,N,15,8,0)},Q.deflateInit2=f,Q.deflateReset=g,Q.deflateResetKeep=Z0,Q.deflateSetHeader=function(R,p){return R&&R.state?R.state.wrap!==2?P:(R.state.gzhead=p,A):P},Q.deflate=function(R,p){var k,V,X,O;if(!R||!R.state||5>8&255),n(V,V.gzhead.time>>16&255),n(V,V.gzhead.time>>24&255),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,255&V.gzhead.os),V.gzhead.extra&&V.gzhead.extra.length&&(n(V,255&V.gzhead.extra.length),n(V,V.gzhead.extra.length>>8&255)),V.gzhead.hcrc&&(R.adler=W(R.adler,V.pending_buf,V.pending,0)),V.gzindex=0,V.status=69):(n(V,0),n(V,0),n(V,0),n(V,0),n(V,0),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,3),V.status=c);else{var _=N+(V.w_bits-8<<4)<<8;_|=(2<=V.strategy||V.level<2?0:V.level<6?1:V.level===6?2:3)<<6,V.strstart!==0&&(_|=32),_+=31-_%31,V.status=c,o(V,_),V.strstart!==0&&(o(V,R.adler>>>16),o(V,65535&R.adler)),R.adler=1}if(V.status===69)if(V.gzhead.extra){for(X=V.pending;V.gzindex<(65535&V.gzhead.extra.length)&&(V.pending!==V.pending_buf_size||(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending!==V.pending_buf_size));)n(V,255&V.gzhead.extra[V.gzindex]),V.gzindex++;V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),V.gzindex===V.gzhead.extra.length&&(V.gzindex=0,V.status=73)}else V.status=73;if(V.status===73)if(V.gzhead.name){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.gzindex=0,V.status=91)}else V.status=91;if(V.status===91)if(V.gzhead.comment){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.status=103)}else V.status=103;if(V.status===103&&(V.gzhead.hcrc?(V.pending+2>V.pending_buf_size&&r(R),V.pending+2<=V.pending_buf_size&&(n(V,255&R.adler),n(V,R.adler>>8&255),R.adler=0,V.status=c)):V.status=c),V.pending!==0){if(r(R),R.avail_out===0)return V.last_flush=-1,A}else if(R.avail_in===0&&s(p)<=s(k)&&p!==T)return V0(R,-5);if(V.status===666&&R.avail_in!==0)return V0(R,-5);if(R.avail_in!==0||V.lookahead!==0||p!==H&&V.status!==666){var l=V.strategy===2?function(d,Q0){for(var X0;;){if(d.lookahead===0&&(O0(d),d.lookahead===0)){if(Q0===H)return D;break}if(d.match_length=0,X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++,X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):V.strategy===3?function(d,Q0){for(var X0,K0,I0,F0,W0=d.window;;){if(d.lookahead<=a){if(O0(d),d.lookahead<=a&&Q0===H)return D;if(d.lookahead===0)break}if(d.match_length=0,d.lookahead>=z&&0d.lookahead&&(d.match_length=d.lookahead)}if(d.match_length>=z?(X0=J._tr_tally(d,1,d.match_length-z),d.lookahead-=d.match_length,d.strstart+=d.match_length,d.match_length=0):(X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++),X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):K[V.level].func(V,p);if(l!==B0&&l!==i||(V.status=666),l===D||l===B0)return R.avail_out===0&&(V.last_flush=-1),A;if(l===m&&(p===1?J._tr_align(V):p!==5&&(J._tr_stored_block(V,0,0,!1),p===3&&(G0(V.head),V.lookahead===0&&(V.strstart=0,V.block_start=0,V.insert=0))),r(R),R.avail_out===0))return V.last_flush=-1,A}return p!==T?A:V.wrap<=0?1:(V.wrap===2?(n(V,255&R.adler),n(V,R.adler>>8&255),n(V,R.adler>>16&255),n(V,R.adler>>24&255),n(V,255&R.total_in),n(V,R.total_in>>8&255),n(V,R.total_in>>16&255),n(V,R.total_in>>24&255)):(o(V,R.adler>>>16),o(V,65535&R.adler)),r(R),0=k.w_size&&(O===0&&(G0(k.head),k.strstart=0,k.block_start=0,k.insert=0),Q0=new Z.Buf8(k.w_size),Z.arraySet(Q0,p,X0-k.w_size,k.w_size,0),p=Q0,X0=k.w_size),_=R.avail_in,l=R.next_in,d=R.input,R.avail_in=X0,R.next_in=0,R.input=p,O0(k);k.lookahead>=z;){for(V=k.strstart,X=k.lookahead-(z-1);k.ins_h=(k.ins_h<>>=z=x>>>24,v-=z,(z=x>>>16&255)===0)m[I++]=65535&x;else{if(!(16&z)){if((64&z)==0){x=S[(65535&x)+(N&(1<>>=z,v-=z),v<15&&(N+=D[q++]<>>=z=x>>>24,v-=z,!(16&(z=x>>>16&255))){if((64&z)==0){x=F[(65535&x)+(N&(1<>>=z,v-=z,(z=I-H)>3,N&=(1<<(v-=a<<3))-1,K.next_in=q,K.next_out=I,K.avail_in=q>>24&255)+(b>>>8&65280)+((65280&b)<<8)+((255&b)<<24)}function N(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new K.Buf16(320),this.work=new K.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(b){var c;return b&&b.state?(c=b.state,b.total_in=b.total_out=c.total=0,b.msg="",c.wrap&&(b.adler=1&c.wrap),c.mode=P,c.last=0,c.havedict=0,c.dmax=32768,c.head=null,c.hold=0,c.bits=0,c.lencode=c.lendyn=new K.Buf32(j),c.distcode=c.distdyn=new K.Buf32(E),c.sane=1,c.back=-1,T):A}function S(b){var c;return b&&b.state?((c=b.state).wsize=0,c.whave=0,c.wnext=0,v(b)):A}function F(b,c){var D,m;return b&&b.state?(m=b.state,c<0?(D=0,c=-c):(D=1+(c>>4),c<48&&(c&=15)),c&&(c<8||15=i.wsize?(K.arraySet(i.window,c,D-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(m<(B0=i.wsize-i.wnext)&&(B0=m),K.arraySet(i.window,c,D-m,B0,i.wnext),(m-=B0)?(K.arraySet(i.window,c,D-m,m,0),i.wnext=m,i.whave=i.wsize):(i.wnext+=B0,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,D.check=J(D.check,O,2,0),y=r=0,D.mode=2;break}if(D.flags=0,D.head&&(D.head.done=!1),!(1&D.wrap)||(((255&r)<<8)+(r>>8))%31){b.msg="incorrect header check",D.mode=30;break}if((15&r)!=8){b.msg="unknown compression method",D.mode=30;break}if(y-=4,R=8+(15&(r>>>=4)),D.wbits===0)D.wbits=R;else if(R>D.wbits){b.msg="invalid window size",D.mode=30;break}D.dmax=1<>8&1),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=3;case 3:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>8&255,O[2]=r>>>16&255,O[3]=r>>>24&255,D.check=J(D.check,O,4,0)),y=r=0,D.mode=4;case 4:for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>8),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=5;case 5:if(1024&D.flags){for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>>8&255,D.check=J(D.check,O,2,0)),y=r=0}else D.head&&(D.head.extra=null);D.mode=6;case 6:if(1024&D.flags&&(s<(Y0=D.length)&&(Y0=s),Y0&&(D.head&&(R=D.head.extra_len-D.length,D.head.extra||(D.head.extra=Array(D.head.extra_len)),K.arraySet(D.head.extra,m,i,Y0,R)),512&D.flags&&(D.check=J(D.check,m,Y0,i)),s-=Y0,i+=Y0,D.length-=Y0),D.length))break B;D.length=0,D.mode=7;case 7:if(2048&D.flags){if(s===0)break B;for(Y0=0;R=m[i+Y0++],D.head&&R&&D.length<65536&&(D.head.name+=String.fromCharCode(R)),R&&Y0>9&1,D.head.done=!0),b.adler=D.check=0,D.mode=12;break;case 10:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>=7&y,y-=7&y,D.mode=27;break}for(;y<3;){if(s===0)break B;s--,r+=m[i++]<>>=1)){case 0:D.mode=14;break;case 1:if(a(D),D.mode=20,c!==6)break;r>>>=2,y-=2;break B;case 2:D.mode=17;break;case 3:b.msg="invalid block type",D.mode=30}r>>>=2,y-=2;break;case 14:for(r>>>=7&y,y-=7&y;y<32;){if(s===0)break B;s--,r+=m[i++]<>>16^65535)){b.msg="invalid stored block lengths",D.mode=30;break}if(D.length=65535&r,y=r=0,D.mode=15,c===6)break B;case 15:D.mode=16;case 16:if(Y0=D.length){if(s>>=5,y-=5,D.ndist=1+(31&r),r>>>=5,y-=5,D.ncode=4+(15&r),r>>>=4,y-=4,286>>=3,y-=3}for(;D.have<19;)D.lens[_[D.have++]]=0;if(D.lencode=D.lendyn,D.lenbits=7,k={bits:D.lenbits},p=W(0,D.lens,0,19,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid code lengths set",D.mode=30;break}D.have=0,D.mode=19;case 19:for(;D.have>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=L,y-=L,D.lens[D.have++]=h;else{if(h===16){for(V=L+2;y>>=L,y-=L,D.have===0){b.msg="invalid bit length repeat",D.mode=30;break}R=D.lens[D.have-1],Y0=3+(3&r),r>>>=2,y-=2}else if(h===17){for(V=L+3;y>>=L)),r>>>=3,y-=3}else{for(V=L+7;y>>=L)),r>>>=7,y-=7}if(D.have+Y0>D.nlen+D.ndist){b.msg="invalid bit length repeat",D.mode=30;break}for(;Y0--;)D.lens[D.have++]=R}}if(D.mode===30)break;if(D.lens[256]===0){b.msg="invalid code -- missing end-of-block",D.mode=30;break}if(D.lenbits=9,k={bits:D.lenbits},p=W(I,D.lens,0,D.nlen,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid literal/lengths set",D.mode=30;break}if(D.distbits=6,D.distcode=D.distdyn,k={bits:D.distbits},p=W(H,D.lens,D.nlen,D.ndist,D.distcode,0,D.work,k),D.distbits=k.bits,p){b.msg="invalid distances set",D.mode=30;break}if(D.mode=20,c===6)break B;case 20:D.mode=21;case 21:if(6<=s&&258<=G0){b.next_out=V0,b.avail_out=G0,b.next_in=i,b.avail_in=s,D.hold=r,D.bits=y,q(b,o),V0=b.next_out,B0=b.output,G0=b.avail_out,i=b.next_in,m=b.input,s=b.avail_in,r=D.hold,y=D.bits,D.mode===12&&(D.back=-1);break}for(D.back=0;u=(X=D.lencode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,D.length=h,u===0){D.mode=26;break}if(32&u){D.back=-1,D.mode=12;break}if(64&u){b.msg="invalid literal/length code",D.mode=30;break}D.extra=15&u,D.mode=22;case 22:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}D.was=D.length,D.mode=23;case 23:for(;u=(X=D.distcode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,64&u){b.msg="invalid distance code",D.mode=30;break}D.offset=h,D.extra=15&u,D.mode=24;case 24:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}if(D.offset>D.dmax){b.msg="invalid distance too far back",D.mode=30;break}D.mode=25;case 25:if(G0===0)break B;if(Y0=o-G0,D.offset>Y0){if((Y0=D.offset-Y0)>D.whave&&D.sane){b.msg="invalid distance too far back",D.mode=30;break}O0=Y0>D.wnext?(Y0-=D.wnext,D.wsize-Y0):D.wnext-Y0,Y0>D.length&&(Y0=D.length),w=D.window}else w=B0,O0=V0-D.offset,Y0=D.length;for(G0$?(z=O0[w+E[c]],y[n+E[c]]):(z=96,0),N=1<>V0)+(v-=N)]=x<<24|z<<16|a|0,v!==0;);for(N=1<>=1;if(N!==0?(r&=N-1,r+=N):r=0,c++,--o[b]==0){if(b===m)break;b=H[T+E[c]]}if(B0>>7)]}function n(X,O){X.pending_buf[X.pending++]=255&O,X.pending_buf[X.pending++]=O>>>8&255}function o(X,O,_){X.bi_valid>C-_?(X.bi_buf|=O<>C-X.bi_valid,X.bi_valid+=_-C):(X.bi_buf|=O<>>=1,_<<=1,0<--O;);return _>>>1}function w(X,O,_){var l,d,Q0=Array(E+1),X0=0;for(l=1;l<=E;l++)Q0[l]=X0=X0+_[l-1]<<1;for(d=0;d<=O;d++){var K0=X[2*d+1];K0!==0&&(X[2*d]=O0(Q0[K0]++,K0))}}function L(X){var O;for(O=0;O>1;1<=_;_--)Z0(X,Q0,_);for(d=I0;_=X.heap[1],X.heap[1]=X.heap[X.heap_len--],Z0(X,Q0,1),l=X.heap[1],X.heap[--X.heap_max]=_,X.heap[--X.heap_max]=l,Q0[2*d]=Q0[2*_]+Q0[2*l],X.depth[d]=(X.depth[_]>=X.depth[l]?X.depth[_]:X.depth[l])+1,Q0[2*_+1]=Q0[2*l+1]=d,X.heap[1]=d++,Z0(X,Q0,1),2<=X.heap_len;);X.heap[--X.heap_max]=X.heap[1],function(W0,k0){var L2,m0,r2,z0,W1,p1,Y2=k0.dyn_tree,I6=k0.max_code,X5=k0.stat_desc.static_tree,q5=k0.stat_desc.has_stree,M5=k0.stat_desc.extra_bits,O6=k0.stat_desc.extra_base,i2=k0.stat_desc.max_length,P1=0;for(z0=0;z0<=E;z0++)W0.bl_count[z0]=0;for(Y2[2*W0.heap[W0.heap_max]+1]=0,L2=W0.heap_max+1;L2>=7;d>>=1)if(1&F0&&K0.dyn_ltree[2*I0]!==0)return Z;if(K0.dyn_ltree[18]!==0||K0.dyn_ltree[20]!==0||K0.dyn_ltree[26]!==0)return J;for(I0=32;I0>>3,(Q0=X.static_len+3+7>>>3)<=d&&(d=Q0)):d=Q0=_+5,_+4<=d&&O!==-1?V(X,O,_,l):X.strategy===4||Q0===d?(o(X,2+(l?1:0),3),g(X,U0,b)):(o(X,4+(l?1:0),3),function(K0,I0,F0,W0){var k0;for(o(K0,I0-257,5),o(K0,F0-1,5),o(K0,W0-4,4),k0=0;k0>>8&255,X.pending_buf[X.d_buf+2*X.last_lit+1]=255&O,X.pending_buf[X.l_buf+X.last_lit]=255&_,X.last_lit++,O===0?X.dyn_ltree[2*_]++:(X.matches++,O--,X.dyn_ltree[2*(D[_]+H+1)]++,X.dyn_dtree[2*y(O)]++),X.last_lit===X.lit_bufsize-1},Q._tr_align=function(X){o(X,2,3),Y0(X,v,U0),function(O){O.bi_valid===16?(n(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(X)}},{"../utils/common":41}],53:[function(G,Y,Q){Y.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(G,Y,Q){(function(K){(function(Z,J){if(!Z.setImmediate){var q,W,I,H,T=1,A={},P=!1,j=Z.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(Z);E=E&&E.setTimeout?E:Z,q={}.toString.call(Z.process)==="[object process]"?function(S){P0.nextTick(function(){N(S)})}:function(){if(Z.postMessage&&!Z.importScripts){var S=!0,F=Z.onmessage;return Z.onmessage=function(){S=!1},Z.postMessage("","*"),Z.onmessage=F,S}}()?(H="setImmediate$"+Math.random()+"$",Z.addEventListener?Z.addEventListener("message",v,!1):Z.attachEvent("onmessage",v),function(S){Z.postMessage(H+S,"*")}):Z.MessageChannel?((I=new MessageChannel).port1.onmessage=function(S){N(S.data)},function(S){I.port2.postMessage(S)}):j&&("onreadystatechange"in j.createElement("script"))?(W=j.documentElement,function(S){var F=j.createElement("script");F.onreadystatechange=function(){N(S),F.onreadystatechange=null,W.removeChild(F),F=null},W.appendChild(F)}):function(S){setTimeout(N,0,S)},E.setImmediate=function(S){typeof S!="function"&&(S=Function(""+S));for(var F=Array(arguments.length-1),M=0;M"u"?K===void 0?this:K:self)}).call(this,typeof v0<"u"?v0:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}),kK=R0((B,U)=>{var G={"&":"&",'"':""","'":"'","<":"<",">":">"};function Y(Q){return Q&&Q.replace?Q.replace(/([&"<>'])/g,function(K,Z){return G[Z]}):Q}U.exports=Y}),$K=R0((B,U)=>{P2();var G=kK(),Y=x8().Stream,Q=" ";function K(H,T){if(typeof T!=="object")T={indent:T};var A=T.stream?new Y:null,P="",j=!1,E=!T.indent?"":T.indent===!0?Q:T.indent,C=!0;function N($){if(!C)$();else P0.nextTick($)}function v($,x){if(x!==void 0)P+=x;if($&&!j)A=A||new Y,j=!0;if($&&j){var z=P;N(function(){A.emit("data",z)}),P=""}}function S($,x){W(v,q($,E,E?1:0),x)}function F(){if(A){var $=P;N(function(){A.emit("data",$),A.emit("end"),A.readable=!1,A.emit("close")})}}function M($){var x={version:"1.0",encoding:$.encoding||"UTF-8"};if($.standalone)x.standalone=$.standalone;S({"?xml":{_attr:x}}),P=P.replace("/>","?>")}if(N(function(){C=!1}),T.declaration)M(T.declaration);if(H&&H.forEach)H.forEach(function($,x){var z;if(x+1===H.length)z=F;S($,z)});else S(H,F);if(A)return A.readable=!0,A;return P}function Z(){var H={_elem:q(Array.prototype.slice.call(arguments))};return H.push=function(T){if(!this.append)throw Error("not assigned to a parent!");var A=this,P=this._elem.indent;W(this.append,q(T,P,this._elem.icount+(P?1:0)),function(){A.append(!0)})},H.close=function(T){if(T!==void 0)this.push(T);if(this.end)this.end()},H}function J(H,T){return Array(T||0).join(H||"")}function q(H,T,A){A=A||0;var P=J(T,A),j,E=H,C=!1;if(typeof H==="object"){if(j=Object.keys(H)[0],E=H[j],E&&E._elem)return E._elem.name=j,E._elem.icount=A,E._elem.indent=T,E._elem.indents=P,E._elem.interrupt=E,E._elem}var N=[],v=[],S;function F(M){Object.keys(M).forEach(function($){N.push(I($,M[$]))})}switch(typeof E){case"object":if(E===null)break;if(E._attr)F(E._attr);if(E._cdata)v.push(("/g,"]]]]>")+"]]>");if(E.forEach){if(S=!1,v.push(""),E.forEach(function(M){if(typeof M=="object")if(Object.keys(M)[0]=="_attr")F(M._attr);else v.push(q(M,T,A+1));else v.pop(),S=!0,v.push(G(M))}),!S)v.push("")}break;default:v.push(G(E))}return{name:j,interrupt:C,attributes:N,content:v,icount:A,indents:P,indent:T}}function W(H,T,A){if(typeof T!="object")return H(!1,T);var P=T.interrupt?1:T.content.length;function j(){while(T.content.length){var C=T.content.shift();if(C===void 0)continue;if(E(C))return;W(H,C)}if(H(!1,(P>1?T.indents:"")+(T.name?"":"")+(T.indent&&!A?` `:"")),A)A()}function E(C){if(C.interrupt)return C.interrupt.append=H,C.interrupt.end=j,C.interrupt=!1,H(!0),!0;return!1}if(H(!1,T.indents+(T.name?"<"+T.name:"")+(T.attributes.length?" "+T.attributes.join(" "):"")+(P?T.name?">":"":T.name?"/>":"")+(T.indent&&P>1?` `:"")),!P)return H(!1,T.indent?` -`:"");if(!E(T))j()}function I(H,T){return H+'="'+G(T)+'"'}U.exports=K,U.exports.element=U.exports.Element=Z}),SK=x8(),h2=k8(CK(),1),A0=k8($K(),1),o2=0,R8=32,bK=32,vK=(B,U)=>{let G=U.replace(/-/g,"");if(G.length!==bK)throw Error(`Error: Cannot extract GUID from font filename: ${U}`);let Y=G.replace(/(..)/g,"$1 ").trim().split(" ").map((Z)=>parseInt(Z,16));Y.reverse();let Q=B.slice(o2,R8).map((Z,J)=>Z^Y[J%Y.length]),K=new Uint8Array(o2+Q.length+Math.max(0,B.length-R8));return K.set(B.slice(0,o2)),K.set(Q,o2),K.set(B.slice(R8),o2+Q.length),K},q6=class{format(B,U={stack:[]}){let G=B.prepForXml(U);if(G)return G;else throw Error("XMLComponent did not format correctly")}},U5=class{replace(B,U,G){let Y=B;return U.forEach((Q,K)=>{Y=Y.replace(new RegExp(`{${Q.fileName}}`,"g"),(G+K).toString())}),Y}getMediaData(B,U){return U.Array.filter((G)=>B.search(`{${G.fileName}}`)>0)}},yK=class{replace(B,U){let G=B;for(let Y of U)G=G.replace(new RegExp(`{${Y.reference}-${Y.instance}}`,"g"),Y.numId.toString());return G}},gK=class{constructor(){e(this,"formatter",void 0),e(this,"imageReplacer",void 0),e(this,"numberingReplacer",void 0),this.formatter=new q6,this.imageReplacer=new U5,this.numberingReplacer=new yK}compile(B,U,G=[]){let Y=new h2.default,Q=this.xmlifyFile(B,U),K=new Map(Object.entries(Q));for(let[,Z]of K)if(Array.isArray(Z))for(let J of Z)Y.file(J.path,U1(J.data));else Y.file(Z.path,U1(Z.data));for(let Z of G)Y.file(Z.path,U1(Z.data));for(let Z of B.Media.Array)if(Z.type!=="svg")Y.file(`word/media/${Z.fileName}`,Z.data);else Y.file(`word/media/${Z.fileName}`,Z.data),Y.file(`word/media/${Z.fallback.fileName}`,Z.fallback.data);for(let[Z,{data:J,fontKey:q}]of B.FontTable.fontOptionsWithKey.entries())Y.file(`word/fonts/font${Z+1}.odttf`,vK(J,q));return Y}xmlifyFile(B,U){let G=B.Document.Relationships.RelationshipCount+1,Y=(0,A0.default)(this.formatter.format(B.Document.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Q=B.Comments.Relationships.RelationshipCount+1,K=(0,A0.default)(this.formatter.format(B.Comments,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Z=B.FootNotes.Relationships.RelationshipCount+1,J=(0,A0.default)(this.formatter.format(B.FootNotes.View,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),q=this.imageReplacer.getMediaData(Y,B.Media),W=this.imageReplacer.getMediaData(K,B.Media),I=this.imageReplacer.getMediaData(J,B.Media);return L0(L0({Relationships:{data:(()=>{return q.forEach((H,T)=>{B.Document.Relationships.addRelationship(G+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),B.Document.Relationships.addRelationship(B.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),(0,A0.default)(this.formatter.format(B.Document.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let H=this.imageReplacer.replace(Y,q,G);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let H=(0,A0.default)(this.formatter.format(B.Styles,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:(0,A0.default)(this.formatter.format(B.CoreProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:(0,A0.default)(this.formatter.format(B.Numbering,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:(0,A0.default)(this.formatter.format(B.FileRelationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${T+1}.xml.rels`}}),FooterRelationships:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${T+1}.xml.rels`}}),Headers:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/header${T+1}.xml`}}),Footers:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/footer${T+1}.xml`}}),ContentTypes:{data:(0,A0.default)(this.formatter.format(B.ContentTypes,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:(0,A0.default)(this.formatter.format(B.CustomProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:(0,A0.default)(this.formatter.format(B.AppProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let H=this.imageReplacer.replace(J,I,Z);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{return I.forEach((H,T)=>{B.FootNotes.Relationships.addRelationship(Z+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.FootNotes.Relationships,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(0,A0.default)(this.formatter.format(B.Endnotes.View,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/endnotes.xml"},EndnotesRelationships:{data:(0,A0.default)(this.formatter.format(B.Endnotes.Relationships,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/endnotes.xml.rels"},Settings:{data:(0,A0.default)(this.formatter.format(B.Settings,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{let H=this.imageReplacer.replace(K,W,Q);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{return W.forEach((H,T)=>{B.Comments.Relationships.addRelationship(Q+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.Comments.Relationships,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}},B.CommentsExtended?{CommentsExtended:{data:(0,A0.default)(this.formatter.format(B.CommentsExtended,{viewWrapper:{View:B.CommentsExtended,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),{},{FontTable:{data:(0,A0.default)(this.formatter.format(B.FontTable.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:(0,A0.default)(this.formatter.format(B.FontTable.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}})}};function t6(B,U,G,Y,Q,K,Z){try{var J=B[K](Z),q=J.value}catch(W){G(W);return}J.done?U(q):Promise.resolve(q).then(Y,Q)}function M6(B){return function(){var U=this,G=arguments;return new Promise(function(Y,Q){var K=B.apply(U,G);function Z(q){t6(K,Y,Q,Z,J,"next",q)}function J(q){t6(K,Y,Q,Z,J,"throw",q)}Z(void 0)})}}var G5={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:"\t"},e6=(B)=>B===!0?G5.WITH_2_BLANKS:B===!1?void 0:B,Y5=class B{static pack(U,G,Y){var Q=this;return M6(function*(K,Z,J,q=[]){return Q.compiler.compile(K,e6(J),q).generateAsync({type:Z,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})}).apply(this,arguments)}static toString(U,G,Y=[]){return B.pack(U,"string",G,Y)}static toBuffer(U,G,Y=[]){return B.pack(U,"nodebuffer",G,Y)}static toBase64String(U,G,Y=[]){return B.pack(U,"base64",G,Y)}static toBlob(U,G,Y=[]){return B.pack(U,"blob",G,Y)}static toArrayBuffer(U,G,Y=[]){return B.pack(U,"arraybuffer",G,Y)}static toStream(U,G,Y=[]){let Q=new SK.Stream;return this.compiler.compile(U,e6(G),Y).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then((K)=>{Q.emit("data",K),Q.emit("end")}),Q}};e(Y5,"compiler",new gK);var fK=new q6,a1=(B)=>{return(0,h1.xml2js)(B,{compact:!1,captureSpacesBetweenElements:!0})},Z5=(B)=>{var U;return(U=a1((0,A0.default)(fK.format(new Z1({text:B})))).elements[0].elements)!==null&&U!==void 0?U:[]},Q5=(B)=>L0(L0({},B),{},{attributes:{"xml:space":"preserve"}}),R6=(B,U)=>{var G,Y;return(G=(Y=B.elements)===null||Y===void 0?void 0:Y.filter((Q)=>Q.name===U)[0].elements)!==null&&G!==void 0?G:[]},g2=(B,U,G)=>{let Y=R6(B,"Types");if(Y.some((Q)=>{var K,Z;return Q.type==="element"&&Q.name==="Default"&&(Q===null||Q===void 0||(K=Q.attributes)===null||K===void 0?void 0:K.ContentType)===U&&(Q===null||Q===void 0||(Z=Q.attributes)===null||Z===void 0?void 0:Z.Extension)===G}))return;Y.push({attributes:{ContentType:U,Extension:G},name:"Default",type:"element"})},xK=(B)=>{let U=parseInt(B.substring(3),10);return isNaN(U)?0:U},_K=(B)=>{return R6(B,"Relationships").map((U)=>{var G,Y;return xK((G=(Y=U.attributes)===null||Y===void 0||(Y=Y.Id)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:"")}).reduce((U,G)=>Math.max(U,G),0)+1},BB=(B,U,G,Y,Q)=>{let K=R6(B,"Relationships");return K.push({attributes:{Id:`rId${U}`,Type:G,Target:Y,TargetMode:Q},name:"Relationship",type:"element"}),K},hK=class extends Error{constructor(B){super(`Token ${B} not found`);this.name="TokenNotFoundError"}},uK=(B,U)=>{var G;for(let Z=0;Z<((G=B.elements)!==null&&G!==void 0?G:[]).length;Z++){let J=B.elements[Z];if(J.type==="element"&&J.name==="w:r"){var Y;let q=((Y=J.elements)!==null&&Y!==void 0?Y:[]).filter((W)=>W.type==="element"&&W.name==="w:t");for(let W of q){var Q,K;if(!((Q=W.elements)===null||Q===void 0?void 0:Q[0]))continue;if((K=W.elements[0].text)===null||K===void 0?void 0:K.includes(U))return Z}}}throw new hK(U)},dK=(B,U)=>{var G,Y;let Q=-1,K=(G=(Y=B.elements)===null||Y===void 0?void 0:Y.map((Z,J)=>{if(Q!==-1)return Z;if(Z.type==="element"&&Z.name==="w:t"){var q,W;let I=((q=(W=Z.elements)===null||W===void 0||(W=W[0])===null||W===void 0?void 0:W.text)!==null&&q!==void 0?q:"").split(U),H=I.map((T)=>L0(L0(L0({},Z),Q5(Z)),{},{elements:Z5(T)}));if(I.length>1)Q=J;return H}else return Z}).flat())!==null&&G!==void 0?G:[];return{left:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(0,Q+1)}),right:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(Q+1)})}},t2={START:0,MIDDLE:1,END:2},cK=({paragraphElement:B,renderedParagraph:U,originalText:G,replacementText:Y})=>{let Q=U.text.indexOf(G),K=Q+G.length-1,Z=t2.START;for(let J of U.runs)for(let{text:q,index:W,start:I,end:H}of J.parts)switch(Z){case t2.START:if(Q>=I&&Q<=H){let T=Q-I,A=Math.min(K,H)-I,P=J.text.substring(T,A+1);if(P==="")continue;let j=q.replace(P,Y);L8(B.elements[J.index].elements[W],j),Z=t2.MIDDLE;continue}break;case t2.MIDDLE:if(K<=H){let T=q.substring(K-I+1);L8(B.elements[J.index].elements[W],T);let A=B.elements[J.index].elements[W];B.elements[J.index].elements[W]=Q5(A),Z=t2.END}else L8(B.elements[J.index].elements[W],"");break;default:}return B},L8=(B,U)=>{return B.elements=Z5(U),B},mK=(B)=>{if(B.element.name!=="w:p")throw Error(`Invalid node type: ${B.element.name}`);if(!B.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let U=0,G=B.element.elements.map((Y,Q)=>({element:Y,i:Q})).filter(({element:Y})=>Y.name==="w:r").map(({element:Y,i:Q})=>{let K=lK(Y,Q,U);return U+=K.text.length,K}).filter((Y)=>!!Y);return{text:G.reduce((Y,Q)=>Y+Q.text,""),runs:G,index:B.index,pathToParagraph:J5(B)}},lK=(B,U,G)=>{if(!B.elements)return{text:"",parts:[],index:-1,start:G,end:G};let Y=G,Q=B.elements.map((K,Z)=>{var J,q;return K.name==="w:t"&&K.elements&&K.elements.length>0?{text:(J=(q=K.elements[0].text)===null||q===void 0?void 0:q.toString())!==null&&J!==void 0?J:"",index:Z,start:Y,end:(()=>{var W,I;return Y+=((W=(I=K.elements[0].text)===null||I===void 0?void 0:I.toString())!==null&&W!==void 0?W:"").length-1,Y})()}:void 0}).filter((K)=>!!K).map((K)=>K);return{text:Q.reduce((K,Z)=>K+Z.text,""),parts:Q,index:U,start:G,end:Y}},J5=(B)=>B.parent?[...J5(B.parent),B.index]:[B.index],UB=(B)=>{var U,G;return(U=(G=B.element.elements)===null||G===void 0?void 0:G.map((Y,Q)=>({element:Y,index:Q,parent:B})))!==null&&U!==void 0?U:[]},K5=(B)=>{let U=[],G=[...UB({element:B,index:0,parent:void 0})],Y;while(G.length>0){if(Y=G.shift(),Y.element.name==="w:p")U=[...U,mK(Y)];G.push(...UB(Y))}return U},aK=(B,U)=>K5(B).filter((G)=>G.text.includes(U)),pK=new q6,I8="ɵ",rK=({json:B,patch:U,patchText:G,context:Y,keepOriginalStyles:Q=!0})=>{let K=aK(B,G);if(K.length===0)return{element:B,didFindOccurrence:!1};for(let Z of K){let J=U.children.map((q)=>a1((0,A0.default)(pK.format(q,Y)))).map((q)=>q.elements[0]);switch(U.type){case C8.DOCUMENT:{let q=iK(B,Z.pathToParagraph),W=nK(Z.pathToParagraph);q.elements.splice(W,1,...J);break}case C8.PARAGRAPH:default:{let q=V5(B,Z.pathToParagraph);cK({paragraphElement:q,renderedParagraph:Z,originalText:G,replacementText:I8});let W=uK(q,I8),I=q.elements[W],{left:H,right:T}=dK(I,I8),A=J,P=T;if(Q){let j=I.elements.filter((E)=>E.type==="element"&&E.name==="w:rPr");A=J.map((E)=>{var C;return L0(L0({},E),{},{elements:[...j,...(C=E.elements)!==null&&C!==void 0?C:[]]})}),P=L0(L0({},T),{},{elements:[...j,...T.elements]})}q.elements.splice(W,1,H,...A,P);break}}}return{element:B,didFindOccurrence:!0}},V5=(B,U)=>{let G=B;for(let Y=1;YV5(B,U.slice(0,U.length-1)),nK=(B)=>B[B.length-1],C8={DOCUMENT:"file",PARAGRAPH:"paragraph"},GB=new U5,sK=new Uint8Array([255,254]),oK=new Uint8Array([254,255]),YB=(B,U)=>{if(B.length!==U.length)return!1;for(let G=0;Gw.name==="w:document");if(x&&x.attributes){for(let w of["mc","wp","r","w15","m"])x.attributes[`xmlns:${w}`]=y1[w];x.attributes["mc:Ignorable"]=`${x.attributes["mc:Ignorable"]||""} w15`.trim()}}if(v.startsWith("word/")&&!v.endsWith(".xml.rels")){let x={file:W,viewWrapper:{Relationships:{addRelationship:(b,c,D,m)=>{T.push({key:v,hyperlink:{id:b,link:D}})}}},stack:[]};if(q.set(v,x),!(K===null||K===void 0?void 0:K.start.trim())||!(K===null||K===void 0?void 0:K.end.trim()))throw Error("Both start and end delimiters must be non-empty strings.");let{start:w,end:a}=K;for(let[b,c]of Object.entries(Y)){let D=`${w}${b}${a}`;while(!0){let{didFindOccurrence:m}=rK({json:$,patch:L0(L0({},c),{},{children:c.children.map((B0)=>{if(B0 instanceof t8){let i=new m2(B0.options.children,O1());return T.push({key:v,hyperlink:{id:i.linkId,link:B0.options.link}}),i}else return B0})}),patchText:D,context:x,keepOriginalStyles:Q});if(!Z||!m)break}}let U0=GB.getMediaData(JSON.stringify($),x.file.Media);if(U0.length>0)A=!0,H.push({key:v,mediaDatas:U0})}I.set(v,$)}for(let{key:v,mediaDatas:S}of H){var E;let F=`word/_rels/${v.split("/").pop()}.rels`,M=(E=I.get(F))!==null&&E!==void 0?E:ZB();I.set(F,M);let $=_K(M),x=GB.replace(JSON.stringify(I.get(v)),S,$);I.set(v,JSON.parse(x));for(let w=0;w{return(0,h1.js2xml)(B,{attributeValueFn:(U)=>String(U).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})},ZB=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),B7=function(){var B=M6(function*({data:U}){let G=U instanceof h2.default?U:yield h2.default.loadAsync(U),Y=new Set;for(let[Q,K]of Object.entries(G.files)){if(!Q.endsWith(".xml")&&!Q.endsWith(".rels"))continue;if(Q.startsWith("word/")&&!Q.endsWith(".xml.rels"))K5(a1(yield K.async("text"))).forEach((Z)=>U7(Z.text).forEach((J)=>Y.add(J)))}return Array.from(Y)});return function(G){return B.apply(this,arguments)}}(),U7=(B)=>{var U;let G=new RegExp("(?<=\\{\\{).+?(?=\\}\\})","gs");return(U=B.match(G))!==null&&U!==void 0?U:[]};if(typeof globalThis.Buffer>"u")globalThis.Buffer=J0;if(typeof globalThis.process>"u")globalThis.process=G7;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.docx=L6;})(); +`:"");if(!E(T))j()}function I(H,T){return H+'="'+G(T)+'"'}U.exports=K,U.exports.element=U.exports.Element=Z}),SK=x8(),h2=k8(CK(),1),A0=k8($K(),1),o2=0,R8=32,bK=32,vK=(B,U)=>{let G=U.replace(/-/g,"");if(G.length!==bK)throw Error(`Error: Cannot extract GUID from font filename: ${U}`);let Y=G.replace(/(..)/g,"$1 ").trim().split(" ").map((Z)=>parseInt(Z,16));Y.reverse();let Q=B.slice(o2,R8).map((Z,J)=>Z^Y[J%Y.length]),K=new Uint8Array(o2+Q.length+Math.max(0,B.length-R8));return K.set(B.slice(0,o2)),K.set(Q,o2),K.set(B.slice(R8),o2+Q.length),K},q6=class{format(B,U={stack:[]}){let G=B.prepForXml(U);if(G)return G;else throw Error("XMLComponent did not format correctly")}},U5=class{replace(B,U,G){let Y=B;return U.forEach((Q,K)=>{Y=Y.replace(new RegExp(`{${Q.fileName}}`,"g"),(G+K).toString())}),Y}getMediaData(B,U){return U.Array.filter((G)=>B.search(`{${G.fileName}}`)>0)}},yK=class{replace(B,U){let G=B;for(let Y of U)G=G.replace(new RegExp(`{${Y.reference}-${Y.instance}}`,"g"),Y.numId.toString());return G}},gK=class{constructor(){e(this,"formatter",void 0),e(this,"imageReplacer",void 0),e(this,"numberingReplacer",void 0),this.formatter=new q6,this.imageReplacer=new U5,this.numberingReplacer=new yK}compile(B,U,G=[]){let Y=new h2.default,Q=this.xmlifyFile(B,U),K=new Map(Object.entries(Q));for(let[,Z]of K)if(Array.isArray(Z))for(let J of Z)Y.file(J.path,U1(J.data));else Y.file(Z.path,U1(Z.data));for(let Z of G)Y.file(Z.path,U1(Z.data));for(let Z of B.Media.Array)if(Z.type!=="svg")Y.file(`word/media/${Z.fileName}`,Z.data);else Y.file(`word/media/${Z.fileName}`,Z.data),Y.file(`word/media/${Z.fallback.fileName}`,Z.fallback.data);for(let[Z,{data:J,fontKey:q}]of B.FontTable.fontOptionsWithKey.entries())Y.file(`word/fonts/font${Z+1}.odttf`,vK(J,q));return Y}xmlifyFile(B,U){let G=B.Document.Relationships.RelationshipCount+1,Y=(0,A0.default)(this.formatter.format(B.Document.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Q=B.Comments.Relationships.RelationshipCount+1,K=(0,A0.default)(this.formatter.format(B.Comments,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Z=B.FootNotes.Relationships.RelationshipCount+1,J=(0,A0.default)(this.formatter.format(B.FootNotes.View,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),q=this.imageReplacer.getMediaData(Y,B.Media),W=this.imageReplacer.getMediaData(K,B.Media),I=this.imageReplacer.getMediaData(J,B.Media);return L0(L0({Relationships:{data:(()=>{return q.forEach((H,T)=>{B.Document.Relationships.addRelationship(G+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),B.Document.Relationships.addRelationship(B.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),(0,A0.default)(this.formatter.format(B.Document.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let H=this.imageReplacer.replace(Y,q,G);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let H=(0,A0.default)(this.formatter.format(B.Styles,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:(0,A0.default)(this.formatter.format(B.CoreProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:(0,A0.default)(this.formatter.format(B.Numbering,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:(0,A0.default)(this.formatter.format(B.FileRelationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${T+1}.xml.rels`}}),FooterRelationships:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${T+1}.xml.rels`}}),Headers:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/header${T+1}.xml`}}),Footers:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/footer${T+1}.xml`}}),ContentTypes:{data:(0,A0.default)(this.formatter.format(B.ContentTypes,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:(0,A0.default)(this.formatter.format(B.CustomProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:(0,A0.default)(this.formatter.format(B.AppProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let H=this.imageReplacer.replace(J,I,Z);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{return I.forEach((H,T)=>{B.FootNotes.Relationships.addRelationship(Z+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.FootNotes.Relationships,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(0,A0.default)(this.formatter.format(B.Endnotes.View,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/endnotes.xml"},EndnotesRelationships:{data:(0,A0.default)(this.formatter.format(B.Endnotes.Relationships,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/endnotes.xml.rels"},Settings:{data:(0,A0.default)(this.formatter.format(B.Settings,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{let H=this.imageReplacer.replace(K,W,Q);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{return W.forEach((H,T)=>{B.Comments.Relationships.addRelationship(Q+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.Comments.Relationships,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}},B.CommentsExtended?{CommentsExtended:{data:(0,A0.default)(this.formatter.format(B.CommentsExtended,{viewWrapper:{View:B.CommentsExtended,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),{},{FontTable:{data:(0,A0.default)(this.formatter.format(B.FontTable.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:(0,A0.default)(this.formatter.format(B.FontTable.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}})}};function t6(B,U,G,Y,Q,K,Z){try{var J=B[K](Z),q=J.value}catch(W){G(W);return}J.done?U(q):Promise.resolve(q).then(Y,Q)}function M6(B){return function(){var U=this,G=arguments;return new Promise(function(Y,Q){var K=B.apply(U,G);function Z(q){t6(K,Y,Q,Z,J,"next",q)}function J(q){t6(K,Y,Q,Z,J,"throw",q)}Z(void 0)})}}var G5={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:"\t"},e6=(B)=>B===!0?G5.WITH_2_BLANKS:B===!1?void 0:B,Y5=class B{static pack(U,G,Y){var Q=this;return M6(function*(K,Z,J,q=[]){return Q.compiler.compile(K,e6(J),q).generateAsync({type:Z,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})}).apply(this,arguments)}static toString(U,G,Y=[]){return B.pack(U,"string",G,Y)}static toBuffer(U,G,Y=[]){return B.pack(U,"nodebuffer",G,Y)}static toBase64String(U,G,Y=[]){return B.pack(U,"base64",G,Y)}static toBlob(U,G,Y=[]){return B.pack(U,"blob",G,Y)}static toArrayBuffer(U,G,Y=[]){return B.pack(U,"arraybuffer",G,Y)}static toStream(U,G,Y=[]){let Q=new SK.Stream;return this.compiler.compile(U,e6(G),Y).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then((K)=>{Q.emit("data",K),Q.emit("end")}),Q}};e(Y5,"compiler",new gK);var fK=new q6,a1=(B)=>{return(0,h1.xml2js)(B,{compact:!1,captureSpacesBetweenElements:!0})},Z5=(B)=>{var U;return(U=a1((0,A0.default)(fK.format(new Z1({text:B})))).elements[0].elements)!==null&&U!==void 0?U:[]},Q5=(B)=>L0(L0({},B),{},{attributes:{"xml:space":"preserve"}}),R6=(B,U)=>{var G,Y;return(G=(Y=B.elements)===null||Y===void 0?void 0:Y.filter((Q)=>Q.name===U)[0].elements)!==null&&G!==void 0?G:[]},g2=(B,U,G)=>{let Y=R6(B,"Types");if(Y.some((Q)=>{var K,Z;return Q.type==="element"&&Q.name==="Default"&&(Q===null||Q===void 0||(K=Q.attributes)===null||K===void 0?void 0:K.ContentType)===U&&(Q===null||Q===void 0||(Z=Q.attributes)===null||Z===void 0?void 0:Z.Extension)===G}))return;Y.push({attributes:{ContentType:U,Extension:G},name:"Default",type:"element"})},xK=(B)=>{let U=parseInt(B.substring(3),10);return isNaN(U)?0:U},_K=(B)=>{return R6(B,"Relationships").map((U)=>{var G,Y;return xK((G=(Y=U.attributes)===null||Y===void 0||(Y=Y.Id)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:"")}).reduce((U,G)=>Math.max(U,G),0)+1},BB=(B,U,G,Y,Q)=>{let K=R6(B,"Relationships");return K.push({attributes:{Id:`rId${U}`,Type:G,Target:Y,TargetMode:Q},name:"Relationship",type:"element"}),K},hK=class extends Error{constructor(B){super(`Token ${B} not found`);this.name="TokenNotFoundError"}},uK=(B,U)=>{var G;for(let Z=0;Z<((G=B.elements)!==null&&G!==void 0?G:[]).length;Z++){let J=B.elements[Z];if(J.type==="element"&&J.name==="w:r"){var Y;let q=((Y=J.elements)!==null&&Y!==void 0?Y:[]).filter((W)=>W.type==="element"&&W.name==="w:t");for(let W of q){var Q,K;if(!((Q=W.elements)===null||Q===void 0?void 0:Q[0]))continue;if((K=W.elements[0].text)===null||K===void 0?void 0:K.includes(U))return Z}}}throw new hK(U)},dK=(B,U)=>{var G,Y;let Q=-1,K=(G=(Y=B.elements)===null||Y===void 0?void 0:Y.map((Z,J)=>{if(Q!==-1)return Z;if(Z.type==="element"&&Z.name==="w:t"){var q,W;let I=((q=(W=Z.elements)===null||W===void 0||(W=W[0])===null||W===void 0?void 0:W.text)!==null&&q!==void 0?q:"").split(U),H=I.map((T)=>L0(L0(L0({},Z),Q5(Z)),{},{elements:Z5(T)}));if(I.length>1)Q=J;return H}else return Z}).flat())!==null&&G!==void 0?G:[];return{left:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(0,Q+1)}),right:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(Q+1)})}},t2={START:0,MIDDLE:1,END:2},cK=({paragraphElement:B,renderedParagraph:U,originalText:G,replacementText:Y})=>{let Q=U.text.indexOf(G),K=Q+G.length-1,Z=t2.START;for(let J of U.runs)for(let{text:q,index:W,start:I,end:H}of J.parts)switch(Z){case t2.START:if(Q>=I&&Q<=H){let T=Q-I,A=Math.min(K,H)-I,P=J.text.substring(T,A+1);if(P==="")continue;let j=q.replace(P,Y);L8(B.elements[J.index].elements[W],j),Z=t2.MIDDLE;continue}break;case t2.MIDDLE:if(K<=H){let T=q.substring(K-I+1);L8(B.elements[J.index].elements[W],T);let A=B.elements[J.index].elements[W];B.elements[J.index].elements[W]=Q5(A),Z=t2.END}else L8(B.elements[J.index].elements[W],"");break;default:}return B},L8=(B,U)=>{return B.elements=Z5(U),B},mK=(B)=>{if(B.element.name!=="w:p")throw Error(`Invalid node type: ${B.element.name}`);if(!B.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let U=0,G=B.element.elements.map((Y,Q)=>({element:Y,i:Q})).filter(({element:Y})=>Y.name==="w:r").map(({element:Y,i:Q})=>{let K=lK(Y,Q,U);return U+=K.text.length,K}).filter((Y)=>!!Y);return{text:G.reduce((Y,Q)=>Y+Q.text,""),runs:G,index:B.index,pathToParagraph:J5(B)}},lK=(B,U,G)=>{if(!B.elements)return{text:"",parts:[],index:-1,start:G,end:G};let Y=G,Q=B.elements.map((K,Z)=>{var J,q;return K.name==="w:t"&&K.elements&&K.elements.length>0?{text:(J=(q=K.elements[0].text)===null||q===void 0?void 0:q.toString())!==null&&J!==void 0?J:"",index:Z,start:Y,end:(()=>{var W,I;return Y+=((W=(I=K.elements[0].text)===null||I===void 0?void 0:I.toString())!==null&&W!==void 0?W:"").length-1,Y})()}:void 0}).filter((K)=>!!K).map((K)=>K);return{text:Q.reduce((K,Z)=>K+Z.text,""),parts:Q,index:U,start:G,end:Y}},J5=(B)=>B.parent?[...J5(B.parent),B.index]:[B.index],UB=(B)=>{var U,G;return(U=(G=B.element.elements)===null||G===void 0?void 0:G.map((Y,Q)=>({element:Y,index:Q,parent:B})))!==null&&U!==void 0?U:[]},K5=(B)=>{let U=[],G=[...UB({element:B,index:0,parent:void 0})],Y;while(G.length>0){if(Y=G.shift(),Y.element.name==="w:p")U=[...U,mK(Y)];G.push(...UB(Y))}return U},aK=(B,U)=>K5(B).filter((G)=>G.text.includes(U)),pK=new q6,I8="ɵ",rK=({json:B,patch:U,patchText:G,context:Y,keepOriginalStyles:Q=!0})=>{let K=aK(B,G);if(K.length===0)return{element:B,didFindOccurrence:!1};for(let Z of K){let J=U.children.map((q)=>a1((0,A0.default)(pK.format(q,Y)))).map((q)=>q.elements[0]);switch(U.type){case C8.DOCUMENT:{let q=iK(B,Z.pathToParagraph),W=nK(Z.pathToParagraph);q.elements.splice(W,1,...J);break}case C8.PARAGRAPH:default:{let q=V5(B,Z.pathToParagraph);cK({paragraphElement:q,renderedParagraph:Z,originalText:G,replacementText:I8});let W=uK(q,I8),I=q.elements[W],{left:H,right:T}=dK(I,I8),A=J,P=T;if(Q){let j=I.elements.filter((E)=>E.type==="element"&&E.name==="w:rPr");A=J.map((E)=>{var C;return L0(L0({},E),{},{elements:[...j,...(C=E.elements)!==null&&C!==void 0?C:[]]})}),P=L0(L0({},T),{},{elements:[...j,...T.elements]})}q.elements.splice(W,1,H,...A,P);break}}}return{element:B,didFindOccurrence:!0}},V5=(B,U)=>{let G=B;for(let Y=1;YV5(B,U.slice(0,U.length-1)),nK=(B)=>B[B.length-1],C8={DOCUMENT:"file",PARAGRAPH:"paragraph"},GB=new U5,sK=new Uint8Array([255,254]),oK=new Uint8Array([254,255]),YB=(B,U)=>{if(B.length!==U.length)return!1;for(let G=0;Gz.name==="w:document");if(x&&x.attributes){for(let z of["mc","wp","r","w15","m"])x.attributes[`xmlns:${z}`]=y1[z];x.attributes["mc:Ignorable"]=`${x.attributes["mc:Ignorable"]||""} w15`.trim()}}if(v.startsWith("word/")&&!v.endsWith(".xml.rels")){let x={file:W,viewWrapper:{Relationships:{addRelationship:(b,c,D,m)=>{T.push({key:v,hyperlink:{id:b,link:D}})}}},stack:[]};if(q.set(v,x),!(K===null||K===void 0?void 0:K.start.trim())||!(K===null||K===void 0?void 0:K.end.trim()))throw Error("Both start and end delimiters must be non-empty strings.");let{start:z,end:a}=K;for(let[b,c]of Object.entries(Y)){let D=`${z}${b}${a}`;while(!0){let{didFindOccurrence:m}=rK({json:$,patch:L0(L0({},c),{},{children:c.children.map((B0)=>{if(B0 instanceof t8){let i=new m2(B0.options.children,O1());return T.push({key:v,hyperlink:{id:i.linkId,link:B0.options.link}}),i}else return B0})}),patchText:D,context:x,keepOriginalStyles:Q});if(!Z||!m)break}}let U0=GB.getMediaData(JSON.stringify($),x.file.Media);if(U0.length>0)A=!0,H.push({key:v,mediaDatas:U0})}I.set(v,$)}for(let{key:v,mediaDatas:S}of H){var E;let F=`word/_rels/${v.split("/").pop()}.rels`,M=(E=I.get(F))!==null&&E!==void 0?E:ZB();I.set(F,M);let $=_K(M),x=GB.replace(JSON.stringify(I.get(v)),S,$);I.set(v,JSON.parse(x));for(let z=0;z{return(0,h1.js2xml)(B,{attributeValueFn:(U)=>String(U).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})},ZB=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),B7=function(){var B=M6(function*({data:U}){let G=U instanceof h2.default?U:yield h2.default.loadAsync(U),Y=new Set;for(let[Q,K]of Object.entries(G.files)){if(!Q.endsWith(".xml")&&!Q.endsWith(".rels"))continue;if(Q.startsWith("word/")&&!Q.endsWith(".xml.rels"))K5(a1(yield K.async("text"))).forEach((Z)=>U7(Z.text).forEach((J)=>Y.add(J)))}return Array.from(Y)});return function(G){return B.apply(this,arguments)}}(),U7=(B)=>{var U;let G=new RegExp("(?<=\\{\\{).+?(?=\\}\\})","gs");return(U=B.match(G))!==null&&U!==void 0?U:[]};if(typeof globalThis.Buffer>"u")globalThis.Buffer=J0;if(typeof globalThis.process>"u")globalThis.process=G7;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.docx=L6;})(); diff --git a/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs b/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs index 3368b6a2676..c39925856ee 100644 --- a/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs +++ b/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs @@ -1,9 +1,9 @@ // sandbox bundle: pptxgenjs // generated by apps/sim/lib/execution/sandbox/bundles/build.ts // do not edit by hand. run `bun run build:sandbox-bundles` to regenerate. -(()=>{var fJ=Object.create;var{getPrototypeOf:RJ,defineProperty:X6,getOwnPropertyNames:Q9,getOwnPropertyDescriptor:IJ}=Object,q9=Object.prototype.hasOwnProperty;function K9($){return this[$]}var CJ,jJ,J9=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?CJ??=new WeakMap:jJ??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?fJ(RJ($)):{};let G=q||!$||!$.__esModule?X6(Q,"default",{value:$,enumerable:!0}):Q;for(let W of Q9($))if(!q9.call(G,W))X6(G,W,{get:K9.bind($,W),enumerable:!0});if(K)J.set($,G);return G},X0=($)=>{var q=($9??=new WeakMap).get($),Q;if(q)return q;if(q=X6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var K of Q9($))if(!q9.call(q,K))X6(q,K,{get:K9.bind($,K),enumerable:!(Q=IJ($,K))||Q.enumerable})}return $9.set($,q),q},$9,N0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var gJ=($)=>$;function AJ($,q){this[$]=gJ.bind(null,q)}var c1=($,q)=>{for(var Q in q)X6($,Q,{get:q[Q],enumerable:!0,configurable:!0,set:AJ.bind(q,Q)})};var b1=($,q)=>()=>($&&(q=$($=0)),q);var V9=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(q,Q)=>(typeof require<"u"?require:q)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var K2={};c1(K2,{transcode:()=>MV,resolveObjectURL:()=>BV,kStringMaxLength:()=>w9,kMaxLength:()=>y6,isUtf8:()=>zV,isAscii:()=>FV,default:()=>wV,constants:()=>EJ,btoa:()=>PJ,atob:()=>TJ,INSPECT_MAX_BYTES:()=>M9,File:()=>uJ,Buffer:()=>o,Blob:()=>SJ});function XJ($){var q=$.length;if(q%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=$.indexOf("=");if(Q===-1)Q=q;var K=Q===q?0:4-Q%4;return[Q,K]}function yJ($,q){return($+q)*3/4-q}function hJ($){var q,Q=XJ($),K=Q[0],J=Q[1],Z=new Uint8Array(yJ(K,J)),G=0,W=J>0?K-4:K,B;for(B=0;B>16&255,Z[G++]=q>>8&255,Z[G++]=q&255;if(J===2)q=F2[$.charCodeAt(B)]<<2|F2[$.charCodeAt(B+1)]>>4,Z[G++]=q&255;if(J===1)q=F2[$.charCodeAt(B)]<<10|F2[$.charCodeAt(B+1)]<<4|F2[$.charCodeAt(B+2)]>>2,Z[G++]=q>>8&255,Z[G++]=q&255;return Z}function xJ($){return I2[$>>18&63]+I2[$>>12&63]+I2[$>>6&63]+I2[$&63]}function OJ($,q,Q){var K,J=[];for(var Z=q;ZW?W:G+Z));if(K===1)q=$[Q-1],J.push(I2[q>>2]+I2[q<<4&63]+"==");else if(K===2)q=($[Q-2]<<8)+$[Q-1],J.push(I2[q>>10]+I2[q>>4&63]+I2[q<<2&63]+"=");return J.join("")}function Y8($,q,Q,K,J){var Z,G,W=J*8-K-1,B=(1<>1,U=-7,w=Q?J-1:0,F=Q?-1:1,M=$[q+w];w+=F,Z=M&(1<<-U)-1,M>>=-U,U+=W;for(;U>0;Z=Z*256+$[q+w],w+=F,U-=8);G=Z&(1<<-U)-1,Z>>=-U,U+=K;for(;U>0;G=G*256+$[q+w],w+=F,U-=8);if(Z===0)Z=1-V;else if(Z===B)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,K),Z=Z-V;return(M?-1:1)*G*Math.pow(2,Z-K)}function F9($,q,Q,K,J,Z){var G,W,B,V=Z*8-J-1,U=(1<>1,F=J===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:Z-1,k=K?1:-1,f=q<0||q===0&&1/q<0?1:0;if(q=Math.abs(q),isNaN(q)||q===1/0)W=isNaN(q)?1:0,G=U;else{if(G=Math.floor(Math.log(q)/Math.LN2),q*(B=Math.pow(2,-G))<1)G--,B*=2;if(G+w>=1)q+=F/B;else q+=F*Math.pow(2,1-w);if(q*B>=2)G++,B/=2;if(G+w>=U)W=0,G=U;else if(G+w>=1)W=(q*B-1)*Math.pow(2,J),G=G+w;else W=q*Math.pow(2,w-1)*Math.pow(2,J),G=0}for(;J>=8;$[Q+M]=W&255,M+=k,W/=256,J-=8);G=G<0;$[Q+M]=G&255,M+=k,G/=256,V-=8);$[Q+M-k]|=f*128}function S2($){if($>y6)throw RangeError('The value "'+$+'" is invalid for option "size"');let q=new Uint8Array($);return Object.setPrototypeOf(q,o.prototype),q}function x5($,q,Q){return class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:q.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}function o($,q,Q){if(typeof $==="number"){if(typeof q==="string")throw TypeError('The "string" argument must be of type string. Received type number');return O5($)}return N9($,q,Q)}function N9($,q,Q){if(typeof $==="string")return nJ($,q);if(ArrayBuffer.isView($))return dJ($);if($==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(C2($,ArrayBuffer)||$&&C2($.buffer,ArrayBuffer))return y5($,q,Q);if(typeof SharedArrayBuffer<"u"&&(C2($,SharedArrayBuffer)||$&&C2($.buffer,SharedArrayBuffer)))return y5($,q,Q);if(typeof $==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=$.valueOf&&$.valueOf();if(K!=null&&K!==$)return o.from(K,q,Q);let J=mJ($);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]==="function")return o.from($[Symbol.toPrimitive]("string"),q,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}function Y9($){if(typeof $!=="number")throw TypeError('"size" argument must be of type number');else if($<0)throw RangeError('The value "'+$+'" is invalid for option "size"')}function bJ($,q,Q){if(Y9($),$<=0)return S2($);if(q!==void 0)return typeof Q==="string"?S2($).fill(q,Q):S2($).fill(q);return S2($)}function O5($){return Y9($),S2($<0?0:P5($)|0)}function nJ($,q){if(typeof q!=="string"||q==="")q="utf8";if(!o.isEncoding(q))throw TypeError("Unknown encoding: "+q);let Q=k9($,q)|0,K=S2(Q),J=K.write($,q);if(J!==Q)K=K.slice(0,J);return K}function X5($){let q=$.length<0?0:P5($.length)|0,Q=S2(q);for(let K=0;K=y6)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y6.toString(16)+" bytes");return $|0}function k9($,q){if(o.isBuffer($))return $.length;if(ArrayBuffer.isView($)||C2($,ArrayBuffer))return $.byteLength;if(typeof $!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let Q=$.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&Q===0)return 0;let J=!1;for(;;)switch(q){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return h5($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return j9($).length;default:if(J)return K?-1:h5($).length;q=(""+q).toLowerCase(),J=!0}}function pJ($,q,Q){let K=!1;if(q===void 0||q<0)q=0;if(q>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,q>>>=0,Q<=q)return"";if(!$)$="utf8";while(!0)switch($){case"hex":return QV(this,q,Q);case"utf8":case"utf-8":return L9(this,q,Q);case"ascii":return eJ(this,q,Q);case"latin1":case"binary":return $V(this,q,Q);case"base64":return sJ(this,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qV(this,q,Q);default:if(K)throw TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),K=!0}}function w1($,q,Q){let K=$[q];$[q]=$[Q],$[Q]=K}function D9($,q,Q,K,J){if($.length===0)return-1;if(typeof Q==="string")K=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,Number.isNaN(Q))Q=J?0:$.length-1;if(Q<0)Q=$.length+Q;if(Q>=$.length)if(J)return-1;else Q=$.length-1;else if(Q<0)if(J)Q=0;else return-1;if(typeof q==="string")q=o.from(q,K);if(o.isBuffer(q)){if(q.length===0)return-1;return W9($,q,Q,K,J)}else if(typeof q==="number"){if(q=q&255,typeof Uint8Array.prototype.indexOf==="function")if(J)return Uint8Array.prototype.indexOf.call($,q,Q);else return Uint8Array.prototype.lastIndexOf.call($,q,Q);return W9($,[q],Q,K,J)}throw TypeError("val must be string, number or Buffer")}function W9($,q,Q,K,J){let Z=1,G=$.length,W=q.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if($.length<2||q.length<2)return-1;Z=2,G/=2,W/=2,Q/=2}}function B(U,w){if(Z===1)return U[w];else return U.readUInt16BE(w*Z)}let V;if(J){let U=-1;for(V=Q;VG)Q=G-W;for(V=Q;V>=0;V--){let U=!0;for(let w=0;wJ)K=J;let Z=q.length;if(K>Z/2)K=Z/2;let G;for(G=0;G239?4:Z>223?3:Z>191?2:1;if(J+W<=Q){let B,V,U,w;switch(W){case 1:if(Z<128)G=Z;break;case 2:if(B=$[J+1],(B&192)===128){if(w=(Z&31)<<6|B&63,w>127)G=w}break;case 3:if(B=$[J+1],V=$[J+2],(B&192)===128&&(V&192)===128){if(w=(Z&15)<<12|(B&63)<<6|V&63,w>2047&&(w<55296||w>57343))G=w}break;case 4:if(B=$[J+1],V=$[J+2],U=$[J+3],(B&192)===128&&(V&192)===128&&(U&192)===128){if(w=(Z&15)<<18|(B&63)<<12|(V&63)<<6|U&63,w>65535&&w<1114112)G=w}}}if(G===null)G=65533,W=1;else if(G>65535)G-=65536,K.push(G>>>10&1023|55296),G=56320|G&1023;K.push(G),J+=W}return tJ(K)}function tJ($){let q=$.length;if(q<=B9)return String.fromCharCode.apply(String,$);let Q="",K=0;while(KK)Q=K;let J="";for(let Z=q;ZQ)throw RangeError("Trying to access beyond buffer length")}function s0($,q,Q,K,J,Z){if(!o.isBuffer($))throw TypeError('"buffer" argument must be a Buffer instance');if(q>J||q$.length)throw RangeError("Index out of range")}function H9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,Q}function v9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q+7]=Z,Z=Z>>8,$[Q+6]=Z,Z=Z>>8,$[Q+5]=Z,Z=Z>>8,$[Q+4]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q+3]=G,G=G>>8,$[Q+2]=G,G=G>>8,$[Q+1]=G,G=G>>8,$[Q]=G,Q+8}function f9($,q,Q,K,J,Z){if(Q+K>$.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function R9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return F9($,q,Q,K,23,4),Q+4}function I9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return F9($,q,Q,K,52,8),Q+8}function z9($){let q="",Q=$.length,K=$[0]==="-"?1:0;for(;Q>=K+4;Q-=3)q=`_${$.slice(Q-3,Q)}${q}`;return`${$.slice(0,Q)}${q}`}function KV($,q,Q){if(n1(q,"offset"),$[q]===void 0||$[q+Q]===void 0)h6(q,$.length-(Q+1))}function C9($,q,Q,K,J,Z){if($>Q||$3)if(q===0||q===BigInt(0))W=`>= 0${G} and < 2${G} ** ${(Z+1)*8}${G}`;else W=`>= -(2${G} ** ${(Z+1)*8-1}${G}) and < 2 ** ${(Z+1)*8-1}${G}`;else W=`>= ${q}${G} and <= ${Q}${G}`;throw new A5("value",W,$)}KV(K,J,Z)}function n1($,q){if(typeof $!=="number")throw new cJ(q,"number",$)}function h6($,q,Q){if(Math.floor($)!==$)throw n1($,Q),new A5(Q||"offset","an integer",$);if(q<0)throw new _J;throw new A5(Q||"offset",`>= ${Q?1:0} and <= ${q}`,$)}function VV($){if($=$.split("=")[0],$=$.trim().replace(JV,""),$.length<2)return"";while($.length%4!==0)$=$+"=";return $}function h5($,q){q=q||1/0;let Q,K=$.length,J=null,Z=[];for(let G=0;G55295&&Q<57344){if(!J){if(Q>56319){if((q-=3)>-1)Z.push(239,191,189);continue}else if(G+1===K){if((q-=3)>-1)Z.push(239,191,189);continue}J=Q;continue}if(Q<56320){if((q-=3)>-1)Z.push(239,191,189);J=Q;continue}Q=(J-55296<<10|Q-56320)+65536}else if(J){if((q-=3)>-1)Z.push(239,191,189)}if(J=null,Q<128){if((q-=1)<0)break;Z.push(Q)}else if(Q<2048){if((q-=2)<0)break;Z.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((q-=3)<0)break;Z.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((q-=4)<0)break;Z.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return Z}function UV($){let q=[];for(let Q=0;Q<$.length;++Q)q.push($.charCodeAt(Q)&255);return q}function ZV($,q){let Q,K,J,Z=[];for(let G=0;G<$.length;++G){if((q-=2)<0)break;Q=$.charCodeAt(G),K=Q>>8,J=Q%256,Z.push(J),Z.push(K)}return Z}function j9($){return hJ(VV($))}function k8($,q,Q,K){let J;for(J=0;J=q.length||J>=$.length)break;q[J+Q]=$[J]}return J}function C2($,q){return $ instanceof q||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===q.name}function l2($){return typeof BigInt>"u"?WV:$}function WV(){throw Error("BigInt not supported")}function T5($){return()=>{throw Error($+" is not implemented for node:buffer browser polyfill")}}var I2,F2,g5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M1,U9,G9,M9=50,y6=2147483647,w9=536870888,PJ,TJ,uJ,SJ,EJ,_J,cJ,A5,B9=4096,JV,GV,BV,zV,FV=($)=>{for(let q of $)if(q.charCodeAt(0)>127)return!1;return!0},MV,wV;var t0=b1(()=>{I2=[],F2=[];for(M1=0,U9=g5.length;M14294967296)J=z9(String(Q));else if(typeof Q==="bigint"){if(J=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))J=z9(J);J+="n"}return K+=` It must be ${q}. Received ${J}`,K},RangeError);Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.buffer}});Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.byteOffset}});o.poolSize=8192;o.from=function($,q,Q){return N9($,q,Q)};Object.setPrototypeOf(o.prototype,Uint8Array.prototype);Object.setPrototypeOf(o,Uint8Array);o.alloc=function($,q,Q){return bJ($,q,Q)};o.allocUnsafe=function($){return O5($)};o.allocUnsafeSlow=function($){return O5($)};o.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==o.prototype};o.compare=function($,q){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(C2(q,Uint8Array))q=o.from(q,q.offset,q.byteLength);if(!o.isBuffer($)||!o.isBuffer(q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===q)return 0;let Q=$.length,K=q.length;for(let J=0,Z=Math.min(Q,K);JK.length){if(!o.isBuffer(Z))Z=o.from(Z);Z.copy(K,J)}else Uint8Array.prototype.set.call(K,Z,J);else if(!o.isBuffer(Z))throw TypeError('"list" argument must be an Array of Buffers');else Z.copy(K,J);J+=Z.length}return K};o.byteLength=k9;o.prototype._isBuffer=!0;o.prototype.swap16=function(){let $=this.length;if($%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let q=0;q<$;q+=2)w1(this,q,q+1);return this};o.prototype.swap32=function(){let $=this.length;if($%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let q=0;q<$;q+=4)w1(this,q,q+3),w1(this,q+1,q+2);return this};o.prototype.swap64=function(){let $=this.length;if($%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let q=0;q<$;q+=8)w1(this,q,q+7),w1(this,q+1,q+6),w1(this,q+2,q+5),w1(this,q+3,q+4);return this};o.prototype.toString=function(){let $=this.length;if($===0)return"";if(arguments.length===0)return L9(this,0,$);return pJ.apply(this,arguments)};o.prototype.toLocaleString=o.prototype.toString;o.prototype.equals=function($){if(!o.isBuffer($))throw TypeError("Argument must be a Buffer");if(this===$)return!0;return o.compare(this,$)===0};o.prototype.inspect=function(){let $="",q=M9;if($=this.toString("hex",0,q).replace(/(.{2})/g,"$1 ").trim(),this.length>q)$+=" ... ";return""};if(G9)o.prototype[G9]=o.prototype.inspect;o.prototype.compare=function($,q,Q,K,J){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(!o.isBuffer($))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(q===void 0)q=0;if(Q===void 0)Q=$?$.length:0;if(K===void 0)K=0;if(J===void 0)J=this.length;if(q<0||Q>$.length||K<0||J>this.length)throw RangeError("out of range index");if(K>=J&&q>=Q)return 0;if(K>=J)return-1;if(q>=Q)return 1;if(q>>>=0,Q>>>=0,K>>>=0,J>>>=0,this===$)return 0;let Z=J-K,G=Q-q,W=Math.min(Z,G),B=this.slice(K,J),V=$.slice(q,Q);for(let U=0;U>>0,isFinite(Q)){if(Q=Q>>>0,K===void 0)K="utf8"}else K=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let J=this.length-q;if(Q===void 0||Q>J)Q=J;if($.length>0&&(Q<0||q<0)||q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let Z=!1;for(;;)switch(K){case"hex":return iJ(this,$,q,Q);case"utf8":case"utf-8":return oJ(this,$,q,Q);case"ascii":case"latin1":case"binary":return aJ(this,$,q,Q);case"base64":return lJ(this,$,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rJ(this,$,q,Q);default:if(Z)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),Z=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};o.prototype.slice=function($,q){let Q=this.length;if($=~~$,q=q===void 0?Q:~~q,$<0){if($+=Q,$<0)$=0}else if($>Q)$=Q;if(q<0){if(q+=Q,q<0)q=0}else if(q>Q)q=Q;if(q<$)q=$;let K=this.subarray($,q);return Object.setPrototypeOf(K,o.prototype),K};o.prototype.readUintLE=o.prototype.readUIntLE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$+--q],J=1;while(q>0&&(J*=256))K+=this[$+--q]*J;return K};o.prototype.readUint8=o.prototype.readUInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);return this[$]};o.prototype.readUint16LE=o.prototype.readUInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]|this[$+1]<<8};o.prototype.readUint16BE=o.prototype.readUInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]<<8|this[$+1]};o.prototype.readUint32LE=o.prototype.readUInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216};o.prototype.readUint32BE=o.prototype.readUInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])};o.prototype.readBigUInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q+this[++$]*256+this[++$]*65536+this[++$]*16777216,J=this[++$]+this[++$]*256+this[++$]*65536+Q*16777216;return BigInt(K)+(BigInt(J)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q*16777216+this[++$]*65536+this[++$]*256+this[++$],J=this[++$]*16777216+this[++$]*65536+this[++$]*256+Q;return(BigInt(K)<>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z=J)K-=Math.pow(2,8*q);return K};o.prototype.readIntBE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=q,J=1,Z=this[$+--K];while(K>0&&(J*=256))Z+=this[$+--K]*J;if(J*=128,Z>=J)Z-=Math.pow(2,8*q);return Z};o.prototype.readInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);if(!(this[$]&128))return this[$];return(255-this[$]+1)*-1};o.prototype.readInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$]|this[$+1]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$+1]|this[$]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24};o.prototype.readInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]};o.prototype.readBigInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=this[$+4]+this[$+5]*256+this[$+6]*65536+(Q<<24);return(BigInt(K)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=(q<<24)+this[++$]*65536+this[++$]*256+this[++$];return(BigInt(K)<>>0,!q)b0($,4,this.length);return Y8(this,$,!0,23,4)};o.prototype.readFloatBE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return Y8(this,$,!1,23,4)};o.prototype.readDoubleLE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!0,52,8)};o.prototype.readDoubleBE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!1,52,8)};o.prototype.writeUintLE=o.prototype.writeUIntLE=function($,q,Q,K){if($=+$,q=q>>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=1,Z=0;this[q]=$&255;while(++Z>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=Q-1,Z=1;this[q+J]=$&255;while(--J>=0&&(Z*=256))this[q+J]=$/Z&255;return q+Q};o.prototype.writeUint8=o.prototype.writeUInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,255,0);return this[q]=$&255,q+1};o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q+3]=$>>>24,this[q+2]=$>>>16,this[q+1]=$>>>8,this[q]=$&255,q+4};o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigUInt64LE=l2(function($,q=0){return H9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeBigUInt64BE=l2(function($,q=0){return v9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeIntLE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=0,Z=1,G=0;this[q]=$&255;while(++J>0)-G&255}return q+Q};o.prototype.writeIntBE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=Q-1,Z=1,G=0;this[q+J]=$&255;while(--J>=0&&(Z*=256)){if($<0&&G===0&&this[q+J+1]!==0)G=1;this[q+J]=($/Z>>0)-G&255}return q+Q};o.prototype.writeInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,127,-128);if($<0)$=255+$+1;return this[q]=$&255,q+1};o.prototype.writeInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);return this[q]=$&255,this[q+1]=$>>>8,this[q+2]=$>>>16,this[q+3]=$>>>24,q+4};o.prototype.writeInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);if($<0)$=4294967295+$+1;return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigInt64LE=l2(function($,q=0){return H9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeBigInt64BE=l2(function($,q=0){return v9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeFloatLE=function($,q,Q){return R9(this,$,q,!0,Q)};o.prototype.writeFloatBE=function($,q,Q){return R9(this,$,q,!1,Q)};o.prototype.writeDoubleLE=function($,q,Q){return I9(this,$,q,!0,Q)};o.prototype.writeDoubleBE=function($,q,Q){return I9(this,$,q,!1,Q)};o.prototype.copy=function($,q,Q,K){if(!o.isBuffer($))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!K&&K!==0)K=this.length;if(q>=$.length)q=$.length;if(!q)q=0;if(K>0&&K=this.length)throw RangeError("Index out of range");if(K<0)throw RangeError("sourceEnd out of bounds");if(K>this.length)K=this.length;if($.length-q>>0,Q=Q===void 0?this.length:Q>>>0,!$)$=0;let J;if(typeof $==="number")for(J=q;J{var S0=y9.exports={},j2,g2;function u5(){throw Error("setTimeout has not been defined")}function S5(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")j2=setTimeout;else j2=u5}catch($){j2=u5}try{if(typeof clearTimeout==="function")g2=clearTimeout;else g2=S5}catch($){g2=S5}})();function g9($){if(j2===setTimeout)return setTimeout($,0);if((j2===u5||!j2)&&setTimeout)return j2=setTimeout,setTimeout($,0);try{return j2($,0)}catch(q){try{return j2.call(null,$,0)}catch(Q){return j2.call(this,$,0)}}}function NV($){if(g2===clearTimeout)return clearTimeout($);if((g2===S5||!g2)&&clearTimeout)return g2=clearTimeout,clearTimeout($);try{return g2($)}catch(q){try{return g2.call(null,$)}catch(Q){return g2.call(this,$)}}}var E2=[],d1=!1,N1,D8=-1;function YV(){if(!d1||!N1)return;if(d1=!1,N1.length)E2=N1.concat(E2);else D8=-1;if(E2.length)A9()}function A9(){if(d1)return;var $=g9(YV);d1=!0;var q=E2.length;while(q){N1=E2,E2=[];while(++D81)for(var Q=1;Qn9,once:()=>c9,listenerCount:()=>d9,init:()=>r2,getMaxListeners:()=>p9,getEventListeners:()=>b9,default:()=>CV,captureRejectionSymbol:()=>u9,addAbortListener:()=>i9,EventEmitter:()=>r2});function S9($,q){var{_events:Q}=$;if(q[0]??=Error("Unhandled error."),!Q)throw q[0];var K=Q[T9];if(K)for(var J of O9.call(K))J.apply($,q);var Z=Q.error;if(!Z)throw q[0];for(var J of O9.call(Z))J.apply($,q);return!0}function LV($,q,Q,K){q.then(void 0,function(J){queueMicrotask(()=>HV($,J,Q,K))})}function HV($,q,Q,K){if(typeof $[x9]==="function")$[x9](q,Q,...K);else try{$[Y1]=!1,$.emit("error",q)}finally{$[Y1]=!0}}function E9($,q,Q){Q.warned=!0;let K=Error(`Possible EventEmitter memory leak detected. ${Q.length} ${String(q)} listeners added to [${$.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=$,K.type=q,K.count=Q.length,console.warn(K)}function _9($,q,...Q){this.removeListener($,q),q.apply(this,Q)}function c9($,q,Q){var K=Q?.signal;if(m9(K,"options.signal"),K?.aborted)throw new E5(void 0,{cause:K?.reason});let{resolve:J,reject:Z,promise:G}=$newPromiseCapability(Promise),W=(U)=>{if($.removeListener(q,B),K!=null)L8(K,"abort",V);Z(U)},B=(...U)=>{if(typeof $.removeListener==="function")$.removeListener("error",W);if(K!=null)L8(K,"abort",V);J(U)};if(P9($,q,B,{once:!0}),q!=="error"&&typeof $.once==="function")$.once("error",W);function V(){L8($,q,B),L8($,"error",W),Z(new E5(void 0,{cause:K?.reason}))}if(K!=null)P9(K,"abort",V,{once:!0});return G}function b9($,q){return $.listeners(q)}function n9($,...q){c5($,"setMaxListeners",0);var Q;if(q&&(Q=q.length))for(let K=0;KK||(Q!=null||K!=null)&&Number.isNaN($))throw RV(q,`${Q!=null?`>= ${Q}`:""}${Q!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,$)}function x6($){if(typeof $!=="function")throw TypeError("The listener must be a function")}function IV($,q){if(typeof $!=="boolean")throw m1(q,"boolean",$)}function p9($){return $?._maxListeners??k1}function i9($,q){if($===void 0)throw m1("signal","AbortSignal",$);if(m9($,"signal"),typeof q!=="function")throw m1("listener","function",q);let Q;if($.aborted)queueMicrotask(()=>q());else $.addEventListener("abort",q,{__proto__:null,once:!0}),Q=()=>{$.removeEventListener("abort",q)};return{__proto__:null,[Symbol.dispose](){Q?.()}}}var _5,Y1,T9,kV,DV,x9,u9,O9,k1=10,r2=function($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[Y1]=$?.captureRejections?Boolean($?.captureRejections):y0[Y1])this.emit=fV},y0,vV=function($,...q){if($==="error")return S9(this,q);var{_events:Q}=this;if(Q===void 0)return!1;var K=Q[$];if(K===void 0)return!1;let J=K.length>1?K.slice():K;for(let Z=0,{length:G}=J;Z1?K.slice():K;for(let Z=0,{length:G}=J;Z{_5=Symbol.for,Y1=Symbol("kCapture"),T9=_5("events.errorMonitor"),kV=Symbol("events.maxEventTargetListeners"),DV=Symbol("events.maxEventTargetListenersWarned"),x9=_5("nodejs.rejection"),u9=_5("nodejs.rejection"),O9=Array.prototype.slice,y0=r2.prototype={};y0._events=void 0;y0._eventsCount=0;y0._maxListeners=void 0;y0.setMaxListeners=function($){return c5($,"setMaxListeners",0),this._maxListeners=$,this};y0.constructor=r2;y0.getMaxListeners=function(){return this?._maxListeners??k1};y0.emit=vV;y0.addListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.push(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.on=y0.addListener;y0.prependListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.unshift(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.once=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.addListener($,Q),this};y0.prependOnceListener=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.prependListener($,Q),this};y0.removeListener=function($,q){x6(q);var{_events:Q}=this;if(!Q)return this;var K=Q[$];if(!K)return this;var J=K.length;let Z=-1;for(let G=J-1;G>=0;G--)if(K[G]===q||K[G].listener===q){Z=G;break}if(Z<0)return this;if(Z===0)K.shift();else K.splice(Z,1);if(K.length===0)delete Q[$],this._eventsCount--;return this};y0.off=y0.removeListener;y0.removeAllListeners=function($){var{_events:q}=this;if($&&q){if(q[$])delete q[$],this._eventsCount--}else this._events={__proto__:null};return this};y0.listeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.map((K)=>K.listener??K)};y0.rawListeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.slice()};y0.listenerCount=function($){var{_events:q}=this;if(!q)return 0;return q[$]?.length??0};y0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};y0[Y1]=!1;E5=class E5 extends Error{constructor($="The operation was aborted",q=void 0){if(q!==void 0&&typeof q!=="object")throw m1("options","Object",q);super($,q);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(r2,{captureRejections:{get(){return y0[Y1]},set($){IV($,"EventEmitter.captureRejections"),y0[Y1]=$},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return k1},set:($)=>{c5($,"defaultMaxListeners",0),k1=$}},kMaxEventTargetListeners:{value:kV,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:DV,enumerable:!1,configurable:!1,writable:!1}});Object.assign(r2,{once:c9,getEventListeners:b9,getMaxListeners:p9,setMaxListeners:n9,EventEmitter:r2,usingDomains:!1,captureRejectionSymbol:u9,errorMonitor:T9,addAbortListener:i9,init:r2,listenerCount:d9});CV=r2});var a1=N0((Bz,$$)=>{var g0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),P0=g0(($,q)=>{class Q extends Error{constructor(K){if(!Array.isArray(K))throw TypeError(`Expected input to be an Array, got ${typeof K}`);let J="";for(let Z=0;Z{q.exports={format(Q,...K){return Q.replace(/%([sdifj])/g,function(...[J,Z]){let G=K.shift();if(Z==="f")return G.toFixed(6);else if(Z==="j")return JSON.stringify(G);else if(Z==="s"&&typeof G==="object")return`${G.constructor!==Object?G.constructor.name:""} {}`.trim();else return G.toString()})},inspect(Q){switch(typeof Q){case"string":if(Q.includes("'")){if(!Q.includes('"'))return`"${Q}"`;else if(!Q.includes("`")&&!Q.includes("${"))return`\`${Q}\``}return`'${Q}'`;case"number":if(isNaN(Q))return"NaN";else if(Object.is(Q,-0))return String(Q);return Q;case"bigint":return`${String(Q)}n`;case"boolean":case"undefined":return String(Q);case"object":return"{}"}}}}),a0=g0(($,q)=>{var{format:Q,inspect:K}=o9(),{AggregateError:J}=P0(),Z=globalThis.AggregateError||J,G=Symbol("kIsNodeError"),W=["string","function","number","object","Function","Object","boolean","bigint","symbol"],B=/^([A-Z][a-z0-9]*)+$/,V={};function U(D,z){if(!D)throw new V.ERR_INTERNAL_ASSERTION(z)}function w(D){let z="",N=D.length,H=D[0]==="-"?1:0;for(;N>=H+4;N-=3)z=`_${D.slice(N-3,N)}${z}`;return`${D.slice(0,N)}${z}`}function F(D,z,N){if(typeof z==="function")return U(z.length<=N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${z.length}).`),z(...N);let H=(z.match(/%[dfijoOs]/g)||[]).length;if(U(H===N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${H}).`),N.length===0)return z;return Q(z,...N)}function M(D,z,N){if(!N)N=Error;class H extends N{constructor(...v){super(F(D,z,v))}toString(){return`${this.name} [${D}]: ${this.message}`}}Object.defineProperties(H.prototype,{name:{value:N.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${D}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),H.prototype.code=D,H.prototype[G]=!0,V[D]=H}function k(D){let z="__node_internal_"+D.name;return Object.defineProperty(D,"name",{value:z}),D}function f(D,z){if(D&&z&&D!==z){if(Array.isArray(z.errors))return z.errors.push(D),z;let N=new Z([z,D],z.message);return N.code=z.code,N}return D||z}class L extends Error{constructor(D="The operation was aborted",z=void 0){if(z!==void 0&&typeof z!=="object")throw new V.ERR_INVALID_ARG_TYPE("options","Object",z);super(D,z);this.code="ABORT_ERR",this.name="AbortError"}}M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(D,z,N)=>{if(U(typeof D==="string","'name' must be a string"),!Array.isArray(z))z=[z];let H="The ";if(D.endsWith(" argument"))H+=`${D} `;else H+=`"${D}" ${D.includes(".")?"property":"argument"} `;H+="must be ";let v=[],j=[],n=[];for(let _ of z)if(U(typeof _==="string","All expected entries have to be of type string"),W.includes(_))v.push(_.toLowerCase());else if(B.test(_))j.push(_);else U(_!=="object",'The value "object" should be written as "Object"'),n.push(_);if(j.length>0){let _=v.indexOf("object");if(_!==-1)v.splice(v,_,1),j.push("Object")}if(v.length>0){switch(v.length){case 1:H+=`of type ${v[0]}`;break;case 2:H+=`one of type ${v[0]} or ${v[1]}`;break;default:{let _=v.pop();H+=`one of type ${v.join(", ")}, or ${_}`}}if(j.length>0||n.length>0)H+=" or "}if(j.length>0){switch(j.length){case 1:H+=`an instance of ${j[0]}`;break;case 2:H+=`an instance of ${j[0]} or ${j[1]}`;break;default:{let _=j.pop();H+=`an instance of ${j.join(", ")}, or ${_}`}}if(n.length>0)H+=" or "}switch(n.length){case 0:break;case 1:if(n[0].toLowerCase()!==n[0])H+="an ";H+=`${n[0]}`;break;case 2:H+=`one of ${n[0]} or ${n[1]}`;break;default:{let _=n.pop();H+=`one of ${n.join(", ")}, or ${_}`}}if(N==null)H+=`. Received ${N}`;else if(typeof N==="function"&&N.name)H+=`. Received function ${N.name}`;else if(typeof N==="object"){var d;if((d=N.constructor)!==null&&d!==void 0&&d.name)H+=`. Received an instance of ${N.constructor.name}`;else{let _=K(N,{depth:-1});H+=`. Received ${_}`}}else{let _=K(N,{colors:!1});if(_.length>25)_=`${_.slice(0,25)}...`;H+=`. Received type ${typeof N} (${_})`}return H},TypeError),M("ERR_INVALID_ARG_VALUE",(D,z,N="is invalid")=>{let H=K(z);if(H.length>128)H=H.slice(0,128)+"...";return`The ${D.includes(".")?"property":"argument"} '${D}' ${N}. Received ${H}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(D,z,N)=>{var H;let v=N!==null&&N!==void 0&&(H=N.constructor)!==null&&H!==void 0&&H.name?`instance of ${N.constructor.name}`:`type ${typeof N}`;return`Expected ${D} to be returned from the "${z}" function but got ${v}.`},TypeError),M("ERR_MISSING_ARGS",(...D)=>{U(D.length>0,"At least one arg needs to be specified");let z,N=D.length;switch(D=(Array.isArray(D)?D:[D]).map((H)=>`"${H}"`).join(" or "),N){case 1:z+=`The ${D[0]} argument`;break;case 2:z+=`The ${D[0]} and ${D[1]} arguments`;break;default:{let H=D.pop();z+=`The ${D.join(", ")}, and ${H} arguments`}break}return`${z} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(D,z,N)=>{U(z,'Missing "range" argument');let H;if(Number.isInteger(N)&&Math.abs(N)>4294967296)H=w(String(N));else if(typeof N==="bigint"){H=String(N);let v=BigInt(2)**BigInt(32);if(N>v||N<-v)H=w(H);H+="n"}else H=K(N);return`The value of "${D}" is out of range. It must be ${z}. Received ${H}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),q.exports={AbortError:L,aggregateTwoErrors:k(f),hideStackFrames:k,codes:V}}),jV=g0(($,q)=>{Object.defineProperty($,"__esModule",{value:!0});var Q=new WeakMap,K=new WeakMap;function J(X){let P=Q.get(X);return console.assert(P!=null,"'this' is expected an Event object, but got",X),P}function Z(X){if(X.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",X.passiveListener);return}if(!X.event.cancelable)return;if(X.canceled=!0,typeof X.event.preventDefault==="function")X.event.preventDefault()}function G(X,P){Q.set(this,{eventTarget:X,event:P,eventPhase:2,currentTarget:X,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:P.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let g=Object.keys(P);for(let c=0;c0){let X=Array(arguments.length);for(let P=0;P{Object.defineProperty($,"__esModule",{value:!0});var Q=jV();class K extends Q.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let U=G.get(this);if(typeof U!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return U}}Q.defineEventAttribute(K.prototype,"abort");function J(){let U=Object.create(K.prototype);return Q.EventTarget.call(U),G.set(U,!1),U}function Z(U){if(G.get(U)!==!1)return;G.set(U,!0),U.dispatchEvent({type:"abort"})}var G=new WeakMap;if(Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class W{constructor(){B.set(this,J())}get signal(){return V(this)}abort(){Z(V(this))}}var B=new WeakMap;function V(U){let w=B.get(U);if(w==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${U===null?"null":typeof U}`);return w}if(Object.defineProperties(W.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(W.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});$.AbortController=W,$.AbortSignal=K,$.default=W,q.exports=W,q.exports.AbortController=q.exports.default=W,q.exports.AbortSignal=K}),e0=g0(($,q)=>{var Q=(t0(),X0(K2)),{format:K,inspect:J}=o9(),{codes:{ERR_INVALID_ARG_TYPE:Z}}=a0(),{kResistStopPropagation:G,AggregateError:W,SymbolDispose:B}=P0(),V=globalThis.AbortSignal||O6().AbortSignal,U=globalThis.AbortController||O6().AbortController,w=Object.getPrototypeOf(async function(){}).constructor,F=globalThis.Blob||Q.Blob,M=typeof F<"u"?function(L){return L instanceof F}:function(L){return!1},k=(L,D)=>{if(L!==void 0&&(L===null||typeof L!=="object"||!("aborted"in L)))throw new Z(D,"AbortSignal",L)},f=(L,D)=>{if(typeof L!=="function")throw new Z(D,"Function",L)};q.exports={AggregateError:W,kEmptyObject:Object.freeze({}),once(L){let D=!1;return function(...z){if(D)return;D=!0,L.apply(this,z)}},createDeferredPromise:function(){let L,D;return{promise:new Promise((z,N)=>{L=z,D=N}),resolve:L,reject:D}},promisify(L){return new Promise((D,z)=>{L((N,...H)=>{if(N)return z(N);return D(...H)})})},debuglog(){return function(){}},format:K,inspect:J,types:{isAsyncFunction(L){return L instanceof w},isArrayBufferView(L){return ArrayBuffer.isView(L)}},isBlob:M,deprecate(L,D){return L},addAbortListener:(i1(),X0(p1)).addAbortListener||function(L,D){if(L===void 0)throw new Z("signal","AbortSignal",L);k(L,"signal"),f(D,"listener");let z;if(L.aborted)queueMicrotask(()=>D());else L.addEventListener("abort",D,{__proto__:null,once:!0,[G]:!0}),z=()=>{L.removeEventListener("abort",D)};return{__proto__:null,[B](){var N;(N=z)===null||N===void 0||N()}}},AbortSignalAny:V.any||function(L){if(L.length===1)return L[0];let D=new U,z=()=>D.abort();return L.forEach((N)=>{k(N,"signals"),N.addEventListener("abort",z,{once:!0})}),D.signal.addEventListener("abort",()=>{L.forEach((N)=>N.removeEventListener("abort",z))},{once:!0}),D.signal}},q.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),P6=g0(($,q)=>{var{ArrayIsArray:Q,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:J,ArrayPrototypeMap:Z,NumberIsInteger:G,NumberIsNaN:W,NumberMAX_SAFE_INTEGER:B,NumberMIN_SAFE_INTEGER:V,NumberParseInt:U,ObjectPrototypeHasOwnProperty:w,RegExpPrototypeExec:F,String:M,StringPrototypeToUpperCase:k,StringPrototypeTrim:f}=P0(),{hideStackFrames:L,codes:{ERR_SOCKET_BAD_PORT:D,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:N,ERR_OUT_OF_RANGE:H,ERR_UNKNOWN_SIGNAL:v}}=a0(),{normalizeEncoding:j}=e0(),{isAsyncFunction:n,isArrayBufferView:d}=e0().types,_={};function X(T){return T===(T|0)}function P(T){return T===T>>>0}var g=/^[0-7]+$/,c="must be a 32-bit unsigned integer or an octal string";function h(T,t,G0){if(typeof T>"u")T=G0;if(typeof T==="string"){if(F(g,T)===null)throw new N(t,T,c);T=U(T,8)}return $0(T,t),T}var x=L((T,t,G0=V,Q0=B)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),l=L((T,t,G0=-2147483648,Q0=2147483647)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),$0=L((T,t,G0=!1)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);let Q0=G0?1:0,M0=4294967295;if(TM0)throw new H(t,`>= ${Q0} && <= ${M0}`,T)});function Z0(T,t){if(typeof T!=="string")throw new z(t,"string",T)}function F0(T,t,G0=void 0,Q0){if(typeof T!=="number")throw new z(t,"number",T);if(G0!=null&&TQ0||(G0!=null||Q0!=null)&&W(T))throw new H(t,`${G0!=null?`>= ${G0}`:""}${G0!=null&&Q0!=null?" && ":""}${Q0!=null?`<= ${Q0}`:""}`,T)}var p=L((T,t,G0)=>{if(!K(G0,T)){let Q0="must be one of: "+J(Z(G0,(M0)=>typeof M0==="string"?`'${M0}'`:M(M0)),", ");throw new N(t,T,Q0)}});function W0(T,t){if(typeof T!=="boolean")throw new z(t,"boolean",T)}function y(T,t,G0){return T==null||!w(T,t)?G0:T[t]}var i=L((T,t,G0=null)=>{let Q0=y(G0,"allowArray",!1),M0=y(G0,"allowFunction",!1);if(!y(G0,"nullable",!1)&&T===null||!Q0&&Q(T)||typeof T!=="object"&&(!M0||typeof T!=="function"))throw new z(t,"Object",T)}),U0=L((T,t)=>{if(T!=null&&typeof T!=="object"&&typeof T!=="function")throw new z(t,"a dictionary",T)}),m=L((T,t,G0=0)=>{if(!Q(T))throw new z(t,"Array",T);if(T.length{if(!d(T))throw new z(t,["Buffer","TypedArray","DataView"],T)});function E(T,t){let G0=j(t),Q0=T.length;if(G0==="hex"&&Q0%2!==0)throw new N("encoding",t,`is invalid for data of length ${Q0}`)}function a(T,t="Port",G0=!0){if(typeof T!=="number"&&typeof T!=="string"||typeof T==="string"&&f(T).length===0||+T!==+T>>>0||T>65535||T===0&&!G0)throw new D(t,T,G0);return T|0}var K0=L((T,t)=>{if(T!==void 0&&(T===null||typeof T!=="object"||!("aborted"in T)))throw new z(t,"AbortSignal",T)}),R=L((T,t)=>{if(typeof T!=="function")throw new z(t,"Function",T)}),Y=L((T,t)=>{if(typeof T!=="function"||n(T))throw new z(t,"Function",T)}),C=L((T,t)=>{if(T!==void 0)throw new z(t,"undefined",T)});function u(T,t,G0){if(!K(G0,T))throw new z(t,`('${J(G0,"|")}')`,T)}var e=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function r(T,t){if(typeof T>"u"||!F(e,T))throw new N(t,T,'must be an array or string of format "; rel=preload; as=style"')}function s(T){if(typeof T==="string")return r(T,"hints"),T;else if(Q(T)){let t=T.length,G0="";if(t===0)return G0;for(let Q0=0;Q0; rel=preload; as=style"')}q.exports={isInt32:X,isUint32:P,parseFileMode:h,validateArray:m,validateStringArray:V0,validateBooleanArray:w0,validateAbortSignalArray:S,validateBoolean:W0,validateBuffer:O,validateDictionary:U0,validateEncoding:E,validateFunction:R,validateInt32:l,validateInteger:x,validateNumber:F0,validateObject:i,validateOneOf:p,validatePlainFunction:Y,validatePort:a,validateSignalName:b,validateString:Z0,validateUint32:$0,validateUndefined:C,validateUnion:u,validateAbortSignal:K0,validateLinkHeaderValue:s}}),D1=g0(($,q)=>{q.exports=globalThis.process}),b2=g0(($,q)=>{var{SymbolAsyncIterator:Q,SymbolIterator:K,SymbolFor:J}=P0(),Z=J("nodejs.stream.destroyed"),G=J("nodejs.stream.errored"),W=J("nodejs.stream.readable"),B=J("nodejs.stream.writable"),V=J("nodejs.stream.disturbed"),U=J("nodejs.webstream.isClosedPromise"),w=J("nodejs.webstream.controllerErrorFunction");function F(y,i=!1){var U0;return!!(y&&typeof y.pipe==="function"&&typeof y.on==="function"&&(!i||typeof y.pause==="function"&&typeof y.resume==="function")&&(!y._writableState||((U0=y._readableState)===null||U0===void 0?void 0:U0.readable)!==!1)&&(!y._writableState||y._readableState))}function M(y){var i;return!!(y&&typeof y.write==="function"&&typeof y.on==="function"&&(!y._readableState||((i=y._writableState)===null||i===void 0?void 0:i.writable)!==!1))}function k(y){return!!(y&&typeof y.pipe==="function"&&y._readableState&&typeof y.on==="function"&&typeof y.write==="function")}function f(y){return y&&(y._readableState||y._writableState||typeof y.write==="function"&&typeof y.on==="function"||typeof y.pipe==="function"&&typeof y.on==="function")}function L(y){return!!(y&&!f(y)&&typeof y.pipeThrough==="function"&&typeof y.getReader==="function"&&typeof y.cancel==="function")}function D(y){return!!(y&&!f(y)&&typeof y.getWriter==="function"&&typeof y.abort==="function")}function z(y){return!!(y&&!f(y)&&typeof y.readable==="object"&&typeof y.writable==="object")}function N(y){return L(y)||D(y)||z(y)}function H(y,i){if(y==null)return!1;if(i===!0)return typeof y[Q]==="function";if(i===!1)return typeof y[K]==="function";return typeof y[Q]==="function"||typeof y[K]==="function"}function v(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!!(y.destroyed||y[Z]||m!==null&&m!==void 0&&m.destroyed)}function j(y){if(!M(y))return null;if(y.writableEnded===!0)return!0;let i=y._writableState;if(i!==null&&i!==void 0&&i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function n(y,i){if(!M(y))return null;if(y.writableFinished===!0)return!0;let U0=y._writableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.finished)!=="boolean")return null;return!!(U0.finished||i===!1&&U0.ended===!0&&U0.length===0)}function d(y){if(!F(y))return null;if(y.readableEnded===!0)return!0;let i=y._readableState;if(!i||i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function _(y,i){if(!F(y))return null;let U0=y._readableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.endEmitted)!=="boolean")return null;return!!(U0.endEmitted||i===!1&&U0.ended===!0&&U0.length===0)}function X(y){if(y&&y[W]!=null)return y[W];if(typeof(y===null||y===void 0?void 0:y.readable)!=="boolean")return null;if(v(y))return!1;return F(y)&&y.readable&&!_(y)}function P(y){if(y&&y[B]!=null)return y[B];if(typeof(y===null||y===void 0?void 0:y.writable)!=="boolean")return null;if(v(y))return!1;return M(y)&&y.writable&&!j(y)}function g(y,i){if(!f(y))return null;if(v(y))return!0;if((i===null||i===void 0?void 0:i.readable)!==!1&&X(y))return!1;if((i===null||i===void 0?void 0:i.writable)!==!1&&P(y))return!1;return!0}function c(y){var i,U0;if(!f(y))return null;if(y.writableErrored)return y.writableErrored;return(i=(U0=y._writableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function h(y){var i,U0;if(!f(y))return null;if(y.readableErrored)return y.readableErrored;return(i=(U0=y._readableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function x(y){if(!f(y))return null;if(typeof y.closed==="boolean")return y.closed;let{_writableState:i,_readableState:U0}=y;if(typeof(i===null||i===void 0?void 0:i.closed)==="boolean"||typeof(U0===null||U0===void 0?void 0:U0.closed)==="boolean")return(i===null||i===void 0?void 0:i.closed)||(U0===null||U0===void 0?void 0:U0.closed);if(typeof y._closed==="boolean"&&l(y))return y._closed;return null}function l(y){return typeof y._closed==="boolean"&&typeof y._defaultKeepAlive==="boolean"&&typeof y._removedConnection==="boolean"&&typeof y._removedContLen==="boolean"}function $0(y){return typeof y._sent100==="boolean"&&l(y)}function Z0(y){var i;return typeof y._consuming==="boolean"&&typeof y._dumped==="boolean"&&((i=y.req)===null||i===void 0?void 0:i.upgradeOrConnect)===void 0}function F0(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!m&&$0(y)||!!(m&&m.autoDestroy&&m.emitClose&&m.closed===!1)}function p(y){var i;return!!(y&&((i=y[V])!==null&&i!==void 0?i:y.readableDidRead||y.readableAborted))}function W0(y){var i,U0,m,V0,w0,S,b,O,E,a;return!!(y&&((i=(U0=(m=(V0=(w0=(S=y[G])!==null&&S!==void 0?S:y.readableErrored)!==null&&w0!==void 0?w0:y.writableErrored)!==null&&V0!==void 0?V0:(b=y._readableState)===null||b===void 0?void 0:b.errorEmitted)!==null&&m!==void 0?m:(O=y._writableState)===null||O===void 0?void 0:O.errorEmitted)!==null&&U0!==void 0?U0:(E=y._readableState)===null||E===void 0?void 0:E.errored)!==null&&i!==void 0?i:(a=y._writableState)===null||a===void 0?void 0:a.errored))}q.exports={isDestroyed:v,kIsDestroyed:Z,isDisturbed:p,kIsDisturbed:V,isErrored:W0,kIsErrored:G,isReadable:X,kIsReadable:W,kIsClosedPromise:U,kControllerErrorFunction:w,kIsWritable:B,isClosed:x,isDuplexNodeStream:k,isFinished:g,isIterable:H,isReadableNodeStream:F,isReadableStream:L,isReadableEnded:d,isReadableFinished:_,isReadableErrored:h,isNodeStream:f,isWebStream:N,isWritable:P,isWritableNodeStream:M,isWritableStream:D,isWritableEnded:j,isWritableFinished:n,isWritableErrored:c,isServerRequest:Z0,isServerResponse:$0,willEmitClose:F0,isTransformStream:z}}),s2=g0(($,q)=>{var Q=D1(),{AbortError:K,codes:J}=a0(),{ERR_INVALID_ARG_TYPE:Z,ERR_STREAM_PREMATURE_CLOSE:G}=J,{kEmptyObject:W,once:B}=e0(),{validateAbortSignal:V,validateFunction:U,validateObject:w,validateBoolean:F}=P6(),{Promise:M,PromisePrototypeThen:k,SymbolDispose:f}=P0(),{isClosed:L,isReadable:D,isReadableNodeStream:z,isReadableStream:N,isReadableFinished:H,isReadableErrored:v,isWritable:j,isWritableNodeStream:n,isWritableStream:d,isWritableFinished:_,isWritableErrored:X,isNodeStream:P,willEmitClose:g,kIsClosedPromise:c}=b2(),h;function x(p){return p.setHeader&&typeof p.abort==="function"}var l=()=>{};function $0(p,W0,y){var i,U0;if(arguments.length===2)y=W0,W0=W;else if(W0==null)W0=W;else w(W0,"options");if(U(y,"callback"),V(W0.signal,"options.signal"),y=B(y),N(p)||d(p))return Z0(p,W0,y);if(!P(p))throw new Z("stream",["ReadableStream","WritableStream","Stream"],p);let m=(i=W0.readable)!==null&&i!==void 0?i:z(p),V0=(U0=W0.writable)!==null&&U0!==void 0?U0:n(p),w0=p._writableState,S=p._readableState,b=()=>{if(!p.writable)a()},O=g(p)&&z(p)===m&&n(p)===V0,E=_(p,!1),a=()=>{if(E=!0,p.destroyed)O=!1;if(O&&(!p.readable||m))return;if(!m||K0)y.call(p)},K0=H(p,!1),R=()=>{if(K0=!0,p.destroyed)O=!1;if(O&&(!p.writable||V0))return;if(!V0||E)y.call(p)},Y=(T)=>{y.call(p,T)},C=L(p),u=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);if(m&&!K0&&z(p,!0)){if(!H(p,!1))return y.call(p,new G)}if(V0&&!E){if(!_(p,!1))return y.call(p,new G)}y.call(p)},e=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);y.call(p)},r=()=>{p.req.on("finish",a)};if(x(p)){if(p.on("complete",a),!O)p.on("abort",u);if(p.req)r();else p.on("request",r)}else if(V0&&!w0)p.on("end",b),p.on("close",b);if(!O&&typeof p.aborted==="boolean")p.on("aborted",u);if(p.on("end",R),p.on("finish",a),W0.error!==!1)p.on("error",Y);if(p.on("close",u),C)Q.nextTick(u);else if(w0!==null&&w0!==void 0&&w0.errorEmitted||S!==null&&S!==void 0&&S.errorEmitted){if(!O)Q.nextTick(e)}else if(!m&&(!O||D(p))&&(E||j(p)===!1))Q.nextTick(e);else if(!V0&&(!O||j(p))&&(K0||D(p)===!1))Q.nextTick(e);else if(S&&p.req&&p.aborted)Q.nextTick(e);let s=()=>{if(y=l,p.removeListener("aborted",u),p.removeListener("complete",a),p.removeListener("abort",u),p.removeListener("request",r),p.req)p.req.removeListener("finish",a);p.removeListener("end",b),p.removeListener("close",b),p.removeListener("finish",a),p.removeListener("end",R),p.removeListener("error",Y),p.removeListener("close",u)};if(W0.signal&&!C){let T=()=>{let t=y;s(),t.call(p,new K(void 0,{cause:W0.signal.reason}))};if(W0.signal.aborted)Q.nextTick(T);else{h=h||e0().addAbortListener;let t=h(W0.signal,T),G0=y;y=B((...Q0)=>{t[f](),G0.apply(p,Q0)})}}return s}function Z0(p,W0,y){let i=!1,U0=l;if(W0.signal)if(U0=()=>{i=!0,y.call(p,new K(void 0,{cause:W0.signal.reason}))},W0.signal.aborted)Q.nextTick(U0);else{h=h||e0().addAbortListener;let V0=h(W0.signal,U0),w0=y;y=B((...S)=>{V0[f](),w0.apply(p,S)})}let m=(...V0)=>{if(!i)Q.nextTick(()=>y.apply(p,V0))};return k(p[c].promise,m,m),l}function F0(p,W0){var y;let i=!1;if(W0===null)W0=W;if((y=W0)!==null&&y!==void 0&&y.cleanup)F(W0.cleanup,"cleanup"),i=W0.cleanup;return new M((U0,m)=>{let V0=$0(p,W0,(w0)=>{if(i)V0();if(w0)m(w0);else U0()})})}q.exports=$0,q.exports.finished=F0}),o1=g0(($,q)=>{var Q=D1(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:J},AbortError:Z}=a0(),{Symbol:G}=P0(),{kIsDestroyed:W,isDestroyed:B,isFinished:V,isServerRequest:U}=b2(),w=G("kDestroy"),F=G("kConstruct");function M(g,c,h){if(g){if(g.stack,c&&!c.errored)c.errored=g;if(h&&!h.errored)h.errored=g}}function k(g,c){let h=this._readableState,x=this._writableState,l=x||h;if(x!==null&&x!==void 0&&x.destroyed||h!==null&&h!==void 0&&h.destroyed){if(typeof c==="function")c();return this}if(M(g,x,h),x)x.destroyed=!0;if(h)h.destroyed=!0;if(!l.constructed)this.once(w,function($0){f(this,K($0,g),c)});else f(this,g,c);return this}function f(g,c,h){let x=!1;function l($0){if(x)return;x=!0;let{_readableState:Z0,_writableState:F0}=g;if(M($0,F0,Z0),F0)F0.closed=!0;if(Z0)Z0.closed=!0;if(typeof h==="function")h($0);if($0)Q.nextTick(L,g,$0);else Q.nextTick(D,g)}try{g._destroy(c||null,l)}catch($0){l($0)}}function L(g,c){z(g,c),D(g)}function D(g){let{_readableState:c,_writableState:h}=g;if(h)h.closeEmitted=!0;if(c)c.closeEmitted=!0;if(h!==null&&h!==void 0&&h.emitClose||c!==null&&c!==void 0&&c.emitClose)g.emit("close")}function z(g,c){let{_readableState:h,_writableState:x}=g;if(x!==null&&x!==void 0&&x.errorEmitted||h!==null&&h!==void 0&&h.errorEmitted)return;if(x)x.errorEmitted=!0;if(h)h.errorEmitted=!0;g.emit("error",c)}function N(){let g=this._readableState,c=this._writableState;if(g)g.constructed=!0,g.closed=!1,g.closeEmitted=!1,g.destroyed=!1,g.errored=null,g.errorEmitted=!1,g.reading=!1,g.ended=g.readable===!1,g.endEmitted=g.readable===!1;if(c)c.constructed=!0,c.destroyed=!1,c.closed=!1,c.closeEmitted=!1,c.errored=null,c.errorEmitted=!1,c.finalCalled=!1,c.prefinished=!1,c.ended=c.writable===!1,c.ending=c.writable===!1,c.finished=c.writable===!1}function H(g,c,h){let{_readableState:x,_writableState:l}=g;if(l!==null&&l!==void 0&&l.destroyed||x!==null&&x!==void 0&&x.destroyed)return this;if(x!==null&&x!==void 0&&x.autoDestroy||l!==null&&l!==void 0&&l.autoDestroy)g.destroy(c);else if(c){if(c.stack,l&&!l.errored)l.errored=c;if(x&&!x.errored)x.errored=c;if(h)Q.nextTick(z,g,c);else z(g,c)}}function v(g,c){if(typeof g._construct!=="function")return;let{_readableState:h,_writableState:x}=g;if(h)h.constructed=!1;if(x)x.constructed=!1;if(g.once(F,c),g.listenerCount(F)>1)return;Q.nextTick(j,g)}function j(g){let c=!1;function h(x){if(c){H(g,x!==null&&x!==void 0?x:new J);return}c=!0;let{_readableState:l,_writableState:$0}=g,Z0=$0||l;if(l)l.constructed=!0;if($0)$0.constructed=!0;if(Z0.destroyed)g.emit(w,x);else if(x)H(g,x,!0);else Q.nextTick(n,g)}try{g._construct((x)=>{Q.nextTick(h,x)})}catch(x){Q.nextTick(h,x)}}function n(g){g.emit(F)}function d(g){return(g===null||g===void 0?void 0:g.setHeader)&&typeof g.abort==="function"}function _(g){g.emit("close")}function X(g,c){g.emit("error",c),Q.nextTick(_,g)}function P(g,c){if(!g||B(g))return;if(!c&&!V(g))c=new Z;if(U(g))g.socket=null,g.destroy(c);else if(d(g))g.abort();else if(d(g.req))g.req.abort();else if(typeof g.destroy==="function")g.destroy(c);else if(typeof g.close==="function")g.close();else if(c)Q.nextTick(X,g,c);else Q.nextTick(_,g);if(!g.destroyed)g[W]=!0}q.exports={construct:v,destroyer:P,destroy:k,undestroy:N,errorOrDestroy:H}}),b5=g0(($,q)=>{var{ArrayIsArray:Q,ObjectSetPrototypeOf:K}=P0(),{EventEmitter:J}=(i1(),X0(p1));function Z(W){J.call(this,W)}K(Z.prototype,J.prototype),K(Z,J),Z.prototype.pipe=function(W,B){let V=this;function U(D){if(W.writable&&W.write(D)===!1&&V.pause)V.pause()}V.on("data",U);function w(){if(V.readable&&V.resume)V.resume()}if(W.on("drain",w),!W._isStdio&&(!B||B.end!==!1))V.on("end",M),V.on("close",k);let F=!1;function M(){if(F)return;F=!0,W.end()}function k(){if(F)return;if(F=!0,typeof W.destroy==="function")W.destroy()}function f(D){if(L(),J.listenerCount(this,"error")===0)this.emit("error",D)}G(V,"error",f),G(W,"error",f);function L(){V.removeListener("data",U),W.removeListener("drain",w),V.removeListener("end",M),V.removeListener("close",k),V.removeListener("error",f),W.removeListener("error",f),V.removeListener("end",L),V.removeListener("close",L),W.removeListener("close",L)}return V.on("end",L),V.on("close",L),W.on("close",L),W.emit("pipe",V),W};function G(W,B,V){if(typeof W.prependListener==="function")return W.prependListener(B,V);if(!W._events||!W._events[B])W.on(B,V);else if(Q(W._events[B]))W._events[B].unshift(V);else W._events[B]=[V,W._events[B]]}q.exports={Stream:Z,prependListener:G}}),H8=g0(($,q)=>{var{SymbolDispose:Q}=P0(),{AbortError:K,codes:J}=a0(),{isNodeStream:Z,isWebStream:G,kControllerErrorFunction:W}=b2(),B=s2(),{ERR_INVALID_ARG_TYPE:V}=J,U,w=(F,M)=>{if(typeof F!=="object"||!("aborted"in F))throw new V(M,"AbortSignal",F)};q.exports.addAbortSignal=function(F,M){if(w(F,"signal"),!Z(M)&&!G(M))throw new V("stream",["ReadableStream","WritableStream","Stream"],M);return q.exports.addAbortSignalNoValidate(F,M)},q.exports.addAbortSignalNoValidate=function(F,M){if(typeof F!=="object"||!("aborted"in F))return M;let k=Z(M)?()=>{M.destroy(new K(void 0,{cause:F.reason}))}:()=>{M[W](new K(void 0,{cause:F.reason}))};if(F.aborted)k();else{U=U||e0().addAbortListener;let f=U(F,k);B(M,f[Q])}return M}}),gV=g0(($,q)=>{var{StringPrototypeSlice:Q,SymbolIterator:K,TypedArrayPrototypeSet:J,Uint8Array:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{inspect:W}=e0();q.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(B){let V={data:B,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length}unshift(B){let V={data:B,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length}shift(){if(this.length===0)return;let B=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,B}clear(){this.head=this.tail=null,this.length=0}join(B){if(this.length===0)return"";let V=this.head,U=""+V.data;while((V=V.next)!==null)U+=B+V.data;return U}concat(B){if(this.length===0)return G.alloc(0);let V=G.allocUnsafe(B>>>0),U=this.head,w=0;while(U)J(V,U.data,w),w+=U.data.length,U=U.next;return V}consume(B,V){let U=this.head.data;if(BF.length)V+=F,B-=F.length;else{if(B===F.length)if(V+=F,++w,U.next)this.head=U.next;else this.head=this.tail=null;else V+=Q(F,0,B),this.head=U,U.data=Q(F,B);break}++w}while((U=U.next)!==null);return this.length-=w,V}_getBuffer(B){let V=G.allocUnsafe(B),U=B,w=this.head,F=0;do{let M=w.data;if(B>M.length)J(V,M,U-B),B-=M.length;else{if(B===M.length)if(J(V,M,U-B),++F,w.next)this.head=w.next;else this.head=this.tail=null;else J(V,new Z(M.buffer,M.byteOffset,B),U-B),this.head=w,w.data=M.slice(B);break}++F}while((w=w.next)!==null);return this.length-=F,V}[Symbol.for("nodejs.util.inspect.custom")](B,V){return W(this,{...V,depth:0,customInspect:!1})}}}),v8=g0(($,q)=>{var{MathFloor:Q,NumberIsInteger:K}=P0(),{validateInteger:J}=P6(),{ERR_INVALID_ARG_VALUE:Z}=a0().codes,G=16384,W=16;function B(F,M,k){return F.highWaterMark!=null?F.highWaterMark:M?F[k]:null}function V(F){return F?W:G}function U(F,M){if(J(M,"value",0),F)W=M;else G=M}function w(F,M,k,f){let L=B(M,f,k);if(L!=null){if(!K(L)||L<0){let D=f?`options.${k}`:"options.highWaterMark";throw new Z(D,L)}return Q(L)}return V(F.objectMode)}q.exports={getHighWaterMark:w,getDefaultHighWaterMark:V,setDefaultHighWaterMark:U}}),AV=g0(($,q)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),XV=g0(($)=>{var q=AV().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),a9=g0(($,q)=>{var Q=D1(),{PromisePrototypeThen:K,SymbolAsyncIterator:J,SymbolIterator:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{ERR_INVALID_ARG_TYPE:W,ERR_STREAM_NULL_VALUES:B}=a0().codes;function V(U,w,F){let M;if(typeof w==="string"||w instanceof G)return new U({objectMode:!0,...F,read(){this.push(w),this.push(null)}});let k;if(w&&w[J])k=!0,M=w[J]();else if(w&&w[Z])k=!1,M=w[Z]();else throw new W("iterable",["Iterable"],w);let f=new U({objectMode:!0,highWaterMark:1,...F}),L=!1;f._read=function(){if(!L)L=!0,z()},f._destroy=function(N,H){K(D(N),()=>Q.nextTick(H,N),(v)=>Q.nextTick(H,v||N))};async function D(N){let H=N!==void 0&&N!==null,v=typeof M.throw==="function";if(H&&v){let{value:j,done:n}=await M.throw(N);if(await j,n)return}if(typeof M.return==="function"){let{value:j}=await M.return();await j}}async function z(){for(;;){try{let{value:N,done:H}=k?await M.next():M.next();if(H)f.push(null);else{let v=N&&typeof N.then==="function"?await N:N;if(v===null)throw L=!1,new B;else if(f.push(v))continue;else L=!1}}catch(N){f.destroy(N)}break}}return f}q.exports=V}),f8=g0(($,q)=>{var Q=D1(),{ArrayPrototypeIndexOf:K,NumberIsInteger:J,NumberIsNaN:Z,NumberParseInt:G,ObjectDefineProperties:W,ObjectKeys:B,ObjectSetPrototypeOf:V,Promise:U,SafeSet:w,SymbolAsyncDispose:F,SymbolAsyncIterator:M,Symbol:k}=P0();q.exports=Q0,Q0.ReadableState=G0;var{EventEmitter:f}=(i1(),X0(p1)),{Stream:L,prependListener:D}=b5(),{Buffer:z}=(t0(),X0(K2)),{addAbortSignal:N}=H8(),H=s2(),v=e0().debuglog("stream",(I)=>{v=I}),j=gV(),n=o1(),{getHighWaterMark:d,getDefaultHighWaterMark:_}=v8(),{aggregateTwoErrors:X,codes:{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:g,ERR_OUT_OF_RANGE:c,ERR_STREAM_PUSH_AFTER_EOF:h,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:x},AbortError:l}=a0(),{validateObject:$0}=P6(),Z0=k("kPaused"),{StringDecoder:F0}=XV(),p=a9();V(Q0.prototype,L.prototype),V(Q0,L);var W0=()=>{},{errorOrDestroy:y}=n,i=1,U0=2,m=4,V0=8,w0=16,S=32,b=64,O=128,E=256,a=512,K0=1024,R=2048,Y=4096,C=8192,u=16384,e=32768,r=65536,s=131072,T=262144;function t(I){return{enumerable:!1,get(){return(this.state&I)!==0},set(A){if(A)this.state|=I;else this.state&=~I}}}W(G0.prototype,{objectMode:t(i),ended:t(U0),endEmitted:t(m),reading:t(V0),constructed:t(w0),sync:t(S),needReadable:t(b),emittedReadable:t(O),readableListening:t(E),resumeScheduled:t(a),errorEmitted:t(K0),emitClose:t(R),autoDestroy:t(Y),destroyed:t(C),closed:t(u),closeEmitted:t(e),multiAwaitDrain:t(r),readingMore:t(s),dataEmitted:t(T)});function G0(I,A,J0){if(typeof J0!=="boolean")J0=A instanceof c2();if(this.state=R|Y|w0|S,I&&I.objectMode)this.state|=i;if(J0&&I&&I.readableObjectMode)this.state|=i;if(this.highWaterMark=I?d(this,I,"readableHighWaterMark",J0):_(!1),this.buffer=new j,this.length=0,this.pipes=[],this.flowing=null,this[Z0]=null,I&&I.emitClose===!1)this.state&=~R;if(I&&I.autoDestroy===!1)this.state&=~Y;if(this.errored=null,this.defaultEncoding=I&&I.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,I&&I.encoding)this.decoder=new F0(I.encoding),this.encoding=I.encoding}function Q0(I){if(!(this instanceof Q0))return new Q0(I);let A=this instanceof c2();if(this._readableState=new G0(I,this,A),I){if(typeof I.read==="function")this._read=I.read;if(typeof I.destroy==="function")this._destroy=I.destroy;if(typeof I.construct==="function")this._construct=I.construct;if(I.signal&&!A)N(I.signal,this)}L.call(this,I),n.construct(this,()=>{if(this._readableState.needReadable)_1(this,this._readableState)})}Q0.prototype.destroy=n.destroy,Q0.prototype._undestroy=n.undestroy,Q0.prototype._destroy=function(I,A){A(I)},Q0.prototype[f.captureRejectionSymbol]=function(I){this.destroy(I)},Q0.prototype[F]=function(){let I;if(!this.destroyed)I=this.readableEnded?null:new l,this.destroy(I);return new U((A,J0)=>H(this,(B0)=>B0&&B0!==I?J0(B0):A(null)))},Q0.prototype.push=function(I,A){return M0(this,I,A,!1)},Q0.prototype.unshift=function(I,A){return M0(this,I,A,!0)};function M0(I,A,J0,B0){v("readableAddChunk",A);let z0=I._readableState,i0;if((z0.state&i)===0){if(typeof A==="string"){if(J0=J0||z0.defaultEncoding,z0.encoding!==J0)if(B0&&z0.encoding)A=z.from(A,J0).toString(z0.encoding);else A=z.from(A,J0),J0=""}else if(A instanceof z)J0="";else if(L._isUint8Array(A))A=L._uint8ArrayToBuffer(A),J0="";else if(A!=null)i0=new P("chunk",["string","Buffer","Uint8Array"],A)}if(i0)y(I,i0);else if(A===null)z0.state&=~V0,O0(I,z0);else if((z0.state&i)!==0||A&&A.length>0)if(B0)if((z0.state&m)!==0)y(I,new x);else if(z0.destroyed||z0.errored)return!1;else I0(I,z0,A,!0);else if(z0.ended)y(I,new h);else if(z0.destroyed||z0.errored)return!1;else if(z0.state&=~V0,z0.decoder&&!J0)if(A=z0.decoder.write(A),z0.objectMode||A.length!==0)I0(I,z0,A,!1);else _1(I,z0);else I0(I,z0,A,!1);else if(!B0)z0.state&=~V0,_1(I,z0);return!z0.ended&&(z0.length0){if((A.state&r)!==0)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;A.dataEmitted=!0,I.emit("data",J0)}else{if(A.length+=A.objectMode?1:J0.length,B0)A.buffer.unshift(J0);else A.buffer.push(J0);if((A.state&b)!==0)u0(I)}_1(I,A)}Q0.prototype.isPaused=function(){let I=this._readableState;return I[Z0]===!0||I.flowing===!1},Q0.prototype.setEncoding=function(I){let A=new F0(I);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;let J0=this._readableState.buffer,B0="";for(let z0 of J0)B0+=A.write(z0);if(J0.clear(),B0!=="")J0.push(B0);return this._readableState.length=B0.length,this};var m0=1073741824;function p0(I){if(I>m0)throw new c("size","<= 1GiB",I);else I--,I|=I>>>1,I|=I>>>2,I|=I>>>4,I|=I>>>8,I|=I>>>16,I++;return I}function q2(I,A){if(I<=0||A.length===0&&A.ended)return 0;if((A.state&i)!==0)return 1;if(Z(I)){if(A.flowing&&A.length)return A.buffer.first().length;return A.length}if(I<=A.length)return I;return A.ended?A.length:0}Q0.prototype.read=function(I){if(v("read",I),I===void 0)I=NaN;else if(!J(I))I=G(I,10);let A=this._readableState,J0=I;if(I>A.highWaterMark)A.highWaterMark=p0(I);if(I!==0)A.state&=~O;if(I===0&&A.needReadable&&((A.highWaterMark!==0?A.length>=A.highWaterMark:A.length>0)||A.ended)){if(v("read: emitReadable",A.length,A.ended),A.length===0&&A.ended)f5(this);else u0(this);return null}if(I=q2(I,A),I===0&&A.ended){if(A.length===0)f5(this);return null}let B0=(A.state&b)!==0;if(v("need readable",B0),A.length===0||A.length-I0)z0=l7(I,A);else z0=null;if(z0===null)A.needReadable=A.length<=A.highWaterMark,I=0;else if(A.length-=I,A.multiAwaitDrain)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;if(A.length===0){if(!A.ended)A.needReadable=!0;if(J0!==I&&A.ended)f5(this)}if(z0!==null&&!A.errorEmitted&&!A.closeEmitted)A.dataEmitted=!0,this.emit("data",z0);return z0};function O0(I,A){if(v("onEofChunk"),A.ended)return;if(A.decoder){let J0=A.decoder.end();if(J0&&J0.length)A.buffer.push(J0),A.length+=A.objectMode?1:J0.length}if(A.ended=!0,A.sync)u0(I);else A.needReadable=!1,A.emittedReadable=!0,E1(I)}function u0(I){let A=I._readableState;if(v("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,!A.emittedReadable)v("emitReadable",A.flowing),A.emittedReadable=!0,Q.nextTick(E1,I)}function E1(I){let A=I._readableState;if(v("emitReadable_",A.destroyed,A.length,A.ended),!A.destroyed&&!A.errored&&(A.length||A.ended))I.emit("readable"),A.emittedReadable=!1;A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,o7(I)}function _1(I,A){if(!A.readingMore&&A.constructed)A.readingMore=!0,Q.nextTick(R2,I,A)}function R2(I,A){while(!A.reading&&!A.ended&&(A.length1&&B0.pipes.includes(I))v("false write response, pause",B0.awaitDrainWriters.size),B0.awaitDrainWriters.add(I);J0.pause()}if(!z1)z1=wJ(J0,I),I.on("drain",z1)}J0.on("data",e7);function e7(F1){v("ondata");let u2=I.write(F1);if(v("dest.write",u2),u2===!1)t7()}function I5(F1){if(v("onerror",F1),A6(),I.removeListener("error",I5),I.listenerCount("error")===0){let u2=I._writableState||I._readableState;if(u2&&!u2.errorEmitted)y(I,F1);else I.emit("error",F1)}}D(I,"error",I5);function C5(){I.removeListener("finish",j5),A6()}I.once("close",C5);function j5(){v("onfinish"),I.removeListener("close",C5),A6()}I.once("finish",j5);function A6(){v("unpipe"),J0.unpipe(I)}if(I.emit("pipe",J0),I.writableNeedDrain===!0)t7();else if(!B0.flowing)v("pipe resume"),J0.resume();return I};function wJ(I,A){return function(){let J0=I._readableState;if(J0.awaitDrainWriters===A)v("pipeOnDrain",1),J0.awaitDrainWriters=null;else if(J0.multiAwaitDrain)v("pipeOnDrain",J0.awaitDrainWriters.size),J0.awaitDrainWriters.delete(A);if((!J0.awaitDrainWriters||J0.awaitDrainWriters.size===0)&&I.listenerCount("data"))I.resume()}}Q0.prototype.unpipe=function(I){let A=this._readableState,J0={hasUnpiped:!1};if(A.pipes.length===0)return this;if(!I){let z0=A.pipes;A.pipes=[],this.pause();for(let i0=0;i00,B0.flowing!==!1)this.resume()}else if(I==="readable"){if(!B0.endEmitted&&!B0.readableListening){if(B0.readableListening=B0.needReadable=!0,B0.flowing=!1,B0.emittedReadable=!1,v("on readable",B0.length,B0.reading),B0.length)u0(this);else if(!B0.reading)Q.nextTick(NJ,this)}}return J0},Q0.prototype.addListener=Q0.prototype.on,Q0.prototype.removeListener=function(I,A){let J0=L.prototype.removeListener.call(this,I,A);if(I==="readable")Q.nextTick(i7,this);return J0},Q0.prototype.off=Q0.prototype.removeListener,Q0.prototype.removeAllListeners=function(I){let A=L.prototype.removeAllListeners.apply(this,arguments);if(I==="readable"||I===void 0)Q.nextTick(i7,this);return A};function i7(I){let A=I._readableState;if(A.readableListening=I.listenerCount("readable")>0,A.resumeScheduled&&A[Z0]===!1)A.flowing=!0;else if(I.listenerCount("data")>0)I.resume();else if(!A.readableListening)A.flowing=null}function NJ(I){v("readable nexttick read 0"),I.read(0)}Q0.prototype.resume=function(){let I=this._readableState;if(!I.flowing)v("resume"),I.flowing=!I.readableListening,YJ(this,I);return I[Z0]=!1,this};function YJ(I,A){if(!A.resumeScheduled)A.resumeScheduled=!0,Q.nextTick(kJ,I,A)}function kJ(I,A){if(v("resume",A.reading),!A.reading)I.read(0);if(A.resumeScheduled=!1,I.emit("resume"),o7(I),A.flowing&&!A.reading)I.read(0)}Q0.prototype.pause=function(){if(v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)v("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[Z0]=!0,this};function o7(I){let A=I._readableState;v("flow",A.flowing);while(A.flowing&&I.read()!==null);}Q0.prototype.wrap=function(I){let A=!1;I.on("data",(B0)=>{if(!this.push(B0)&&I.pause)A=!0,I.pause()}),I.on("end",()=>{this.push(null)}),I.on("error",(B0)=>{y(this,B0)}),I.on("close",()=>{this.destroy()}),I.on("destroy",()=>{this.destroy()}),this._read=()=>{if(A&&I.resume)A=!1,I.resume()};let J0=B(I);for(let B0=1;B0{z0=z2?X(z0,z2):null,J0(),J0=W0});try{while(!0){let z2=I.destroyed?null:I.read();if(z2!==null)yield z2;else if(z0)throw z0;else if(z0===null)return;else await new U(B0)}}catch(z2){throw z0=X(z0,z2),z0}finally{if((z0||(A===null||A===void 0?void 0:A.destroyOnReturn)!==!1)&&(z0===void 0||I._readableState.autoDestroy))n.destroyer(I,null);else I.off("readable",B0),i0()}}W(Q0.prototype,{readable:{__proto__:null,get(){let I=this._readableState;return!!I&&I.readable!==!1&&!I.destroyed&&!I.errorEmitted&&!I.endEmitted},set(I){if(this._readableState)this._readableState.readable=!!I}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(I){if(this._readableState)this._readableState.flowing=I}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(I){if(!this._readableState)return;this._readableState.destroyed=I}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),W(G0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Z0]!==!1},set(I){this[Z0]=!!I}}}),Q0._fromList=l7;function l7(I,A){if(A.length===0)return null;let J0;if(A.objectMode)J0=A.buffer.shift();else if(!I||I>=A.length){if(A.decoder)J0=A.buffer.join("");else if(A.buffer.length===1)J0=A.buffer.first();else J0=A.buffer.concat(A.length);A.buffer.clear()}else J0=A.buffer.consume(I,A.decoder);return J0}function f5(I){let A=I._readableState;if(v("endReadable",A.endEmitted),!A.endEmitted)A.ended=!0,Q.nextTick(LJ,A,I)}function LJ(I,A){if(v("endReadableNT",I.endEmitted,I.length),!I.errored&&!I.closeEmitted&&!I.endEmitted&&I.length===0){if(I.endEmitted=!0,A.emit("end"),A.writable&&A.allowHalfOpen===!1)Q.nextTick(HJ,A);else if(I.autoDestroy){let J0=A._writableState;if(!J0||J0.autoDestroy&&(J0.finished||J0.writable===!1))A.destroy()}}}function HJ(I){if(I.writable&&!I.writableEnded&&!I.destroyed)I.end()}Q0.from=function(I,A){return p(Q0,I,A)};var R5;function r7(){if(R5===void 0)R5={};return R5}Q0.fromWeb=function(I,A){return r7().newStreamReadableFromReadableStream(I,A)},Q0.toWeb=function(I,A){return r7().newReadableStreamFromStreamReadable(I,A)},Q0.wrap=function(I,A){var J0,B0;return new Q0({objectMode:(J0=(B0=I.readableObjectMode)!==null&&B0!==void 0?B0:I.objectMode)!==null&&J0!==void 0?J0:!0,...A,destroy(z0,i0){n.destroyer(I,z0),i0(z0)}}).wrap(I)}}),n5=g0(($,q)=>{var Q=D1(),{ArrayPrototypeSlice:K,Error:J,FunctionPrototypeSymbolHasInstance:Z,ObjectDefineProperty:G,ObjectDefineProperties:W,ObjectSetPrototypeOf:B,StringPrototypeToLowerCase:V,Symbol:U,SymbolHasInstance:w}=P0();q.exports=$0,$0.WritableState=x;var{EventEmitter:F}=(i1(),X0(p1)),M=b5().Stream,{Buffer:k}=(t0(),X0(K2)),f=o1(),{addAbortSignal:L}=H8(),{getHighWaterMark:D,getDefaultHighWaterMark:z}=v8(),{ERR_INVALID_ARG_TYPE:N,ERR_METHOD_NOT_IMPLEMENTED:H,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:j,ERR_STREAM_DESTROYED:n,ERR_STREAM_ALREADY_FINISHED:d,ERR_STREAM_NULL_VALUES:_,ERR_STREAM_WRITE_AFTER_END:X,ERR_UNKNOWN_ENCODING:P}=a0().codes,{errorOrDestroy:g}=f;B($0.prototype,M.prototype),B($0,M);function c(){}var h=U("kOnFinished");function x(Y,C,u){if(typeof u!=="boolean")u=C instanceof c2();if(this.objectMode=!!(Y&&Y.objectMode),u)this.objectMode=this.objectMode||!!(Y&&Y.writableObjectMode);this.highWaterMark=Y?D(this,Y,"writableHighWaterMark",u):z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let e=!!(Y&&Y.decodeStrings===!1);this.decodeStrings=!e,this.defaultEncoding=Y&&Y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=y.bind(void 0,C),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,l(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!Y||Y.emitClose!==!1,this.autoDestroy=!Y||Y.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[h]=[]}function l(Y){Y.buffered=[],Y.bufferedIndex=0,Y.allBuffers=!0,Y.allNoop=!0}x.prototype.getBuffer=function(){return K(this.buffered,this.bufferedIndex)},G(x.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function $0(Y){let C=this instanceof c2();if(!C&&!Z($0,this))return new $0(Y);if(this._writableState=new x(Y,this,C),Y){if(typeof Y.write==="function")this._write=Y.write;if(typeof Y.writev==="function")this._writev=Y.writev;if(typeof Y.destroy==="function")this._destroy=Y.destroy;if(typeof Y.final==="function")this._final=Y.final;if(typeof Y.construct==="function")this._construct=Y.construct;if(Y.signal)L(Y.signal,this)}M.call(this,Y),f.construct(this,()=>{let u=this._writableState;if(!u.writing)V0(this,u);O(this,u)})}G($0,w,{__proto__:null,value:function(Y){if(Z(this,Y))return!0;if(this!==$0)return!1;return Y&&Y._writableState instanceof x}}),$0.prototype.pipe=function(){g(this,new j)};function Z0(Y,C,u,e){let r=Y._writableState;if(typeof u==="function")e=u,u=r.defaultEncoding;else{if(!u)u=r.defaultEncoding;else if(u!=="buffer"&&!k.isEncoding(u))throw new P(u);if(typeof e!=="function")e=c}if(C===null)throw new _;else if(!r.objectMode)if(typeof C==="string"){if(r.decodeStrings!==!1)C=k.from(C,u),u="buffer"}else if(C instanceof k)u="buffer";else if(M._isUint8Array(C))C=M._uint8ArrayToBuffer(C),u="buffer";else throw new N("chunk",["string","Buffer","Uint8Array"],C);let s;if(r.ending)s=new X;else if(r.destroyed)s=new n("write");if(s)return Q.nextTick(e,s),g(Y,s,!0),s;return r.pendingcb++,F0(Y,r,C,u,e)}$0.prototype.write=function(Y,C,u){return Z0(this,Y,C,u)===!0},$0.prototype.cork=function(){this._writableState.corked++},$0.prototype.uncork=function(){let Y=this._writableState;if(Y.corked){if(Y.corked--,!Y.writing)V0(this,Y)}},$0.prototype.setDefaultEncoding=function(Y){if(typeof Y==="string")Y=V(Y);if(!k.isEncoding(Y))throw new P(Y);return this._writableState.defaultEncoding=Y,this};function F0(Y,C,u,e,r){let s=C.objectMode?1:u.length;C.length+=s;let T=C.lengthu.bufferedIndex)V0(Y,u);if(e)if(u.afterWriteTickInfo!==null&&u.afterWriteTickInfo.cb===r)u.afterWriteTickInfo.count++;else u.afterWriteTickInfo={count:1,cb:r,stream:Y,state:u},Q.nextTick(i,u.afterWriteTickInfo);else U0(Y,u,1,r)}}function i({stream:Y,state:C,count:u,cb:e}){return C.afterWriteTickInfo=null,U0(Y,C,u,e)}function U0(Y,C,u,e){if(!C.ending&&!Y.destroyed&&C.length===0&&C.needDrain)C.needDrain=!1,Y.emit("drain");while(u-- >0)C.pendingcb--,e();if(C.destroyed)m(C);O(Y,C)}function m(Y){if(Y.writing)return;for(let r=Y.bufferedIndex;r1&&Y._writev){C.pendingcb-=s-1;let t=C.allNoop?c:(Q0)=>{for(let M0=T;M0256)u.splice(0,T),C.bufferedIndex=0;else C.bufferedIndex=T}C.bufferProcessing=!1}$0.prototype._write=function(Y,C,u){if(this._writev)this._writev([{chunk:Y,encoding:C}],u);else throw new H("_write()")},$0.prototype._writev=null,$0.prototype.end=function(Y,C,u){let e=this._writableState;if(typeof Y==="function")u=Y,Y=null,C=null;else if(typeof C==="function")u=C,C=null;let r;if(Y!==null&&Y!==void 0){let s=Z0(this,Y,C);if(s instanceof J)r=s}if(e.corked)e.corked=1,this.uncork();if(r);else if(!e.errored&&!e.ending)e.ending=!0,O(this,e,!0),e.ended=!0;else if(e.finished)r=new d("end");else if(e.destroyed)r=new n("end");if(typeof u==="function")if(r||e.finished)Q.nextTick(u,r);else e[h].push(u);return this};function w0(Y){return Y.ending&&!Y.destroyed&&Y.constructed&&Y.length===0&&!Y.errored&&Y.buffered.length===0&&!Y.finished&&!Y.writing&&!Y.errorEmitted&&!Y.closeEmitted}function S(Y,C){let u=!1;function e(r){if(u){g(Y,r!==null&&r!==void 0?r:v());return}if(u=!0,C.pendingcb--,r){let s=C[h].splice(0);for(let T=0;T{if(w0(r))E(e,r);else r.pendingcb--},Y,C);else if(w0(C))C.pendingcb++,E(Y,C)}}}function E(Y,C){C.pendingcb--,C.finished=!0;let u=C[h].splice(0);for(let e=0;e{var Q=D1(),K=(t0(),X0(K2)),{isReadable:J,isWritable:Z,isIterable:G,isNodeStream:W,isReadableNodeStream:B,isWritableNodeStream:V,isDuplexNodeStream:U,isReadableStream:w,isWritableStream:F}=b2(),M=s2(),{AbortError:k,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:L}}=a0(),{destroyer:D}=o1(),z=c2(),N=f8(),H=n5(),{createDeferredPromise:v}=e0(),j=a9(),n=globalThis.Blob||K.Blob,d=typeof n<"u"?function(h){return h instanceof n}:function(h){return!1},_=globalThis.AbortController||O6().AbortController,{FunctionPrototypeCall:X}=P0();class P extends z{constructor(h){super(h);if((h===null||h===void 0?void 0:h.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((h===null||h===void 0?void 0:h.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}q.exports=function h(x,l){if(U(x))return x;if(B(x))return c({readable:x});if(V(x))return c({writable:x});if(W(x))return c({writable:!1,readable:!1});if(w(x))return c({readable:N.fromWeb(x)});if(F(x))return c({writable:H.fromWeb(x)});if(typeof x==="function"){let{value:Z0,write:F0,final:p,destroy:W0}=g(x);if(G(Z0))return j(P,Z0,{objectMode:!0,write:F0,final:p,destroy:W0});let y=Z0===null||Z0===void 0?void 0:Z0.then;if(typeof y==="function"){let i,U0=X(y,Z0,(m)=>{if(m!=null)throw new L("nully","body",m)},(m)=>{D(i,m)});return i=new P({objectMode:!0,readable:!1,write:F0,final(m){p(async()=>{try{await U0,Q.nextTick(m,null)}catch(V0){Q.nextTick(m,V0)}})},destroy:W0})}throw new L("Iterable, AsyncIterable or AsyncFunction",l,Z0)}if(d(x))return h(x.arrayBuffer());if(G(x))return j(P,x,{objectMode:!0,writable:!1});if(w(x===null||x===void 0?void 0:x.readable)&&F(x===null||x===void 0?void 0:x.writable))return P.fromWeb(x);if(typeof(x===null||x===void 0?void 0:x.writable)==="object"||typeof(x===null||x===void 0?void 0:x.readable)==="object"){let Z0=x!==null&&x!==void 0&&x.readable?B(x===null||x===void 0?void 0:x.readable)?x===null||x===void 0?void 0:x.readable:h(x.readable):void 0,F0=x!==null&&x!==void 0&&x.writable?V(x===null||x===void 0?void 0:x.writable)?x===null||x===void 0?void 0:x.writable:h(x.writable):void 0;return c({readable:Z0,writable:F0})}let $0=x===null||x===void 0?void 0:x.then;if(typeof $0==="function"){let Z0;return X($0,x,(F0)=>{if(F0!=null)Z0.push(F0);Z0.push(null)},(F0)=>{D(Z0,F0)}),Z0=new P({objectMode:!0,writable:!1,read(){}})}throw new f(l,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],x)};function g(h){let{promise:x,resolve:l}=v(),$0=new _,Z0=$0.signal;return{value:h(async function*(){while(!0){let F0=x;x=null;let{chunk:p,done:W0,cb:y}=await F0;if(Q.nextTick(y),W0)return;if(Z0.aborted)throw new k(void 0,{cause:Z0.reason});({promise:x,resolve:l}=v()),yield p}}(),{signal:Z0}),write(F0,p,W0){let y=l;l=null,y({chunk:F0,done:!1,cb:W0})},final(F0){let p=l;l=null,p({done:!0,cb:F0})},destroy(F0,p){$0.abort(),p(F0)}}}function c(h){let x=h.readable&&typeof h.readable.read!=="function"?N.wrap(h.readable):h.readable,l=h.writable,$0=!!J(x),Z0=!!Z(l),F0,p,W0,y,i;function U0(m){let V0=y;if(y=null,V0)V0(m);else if(m)i.destroy(m)}if(i=new P({readableObjectMode:!!(x!==null&&x!==void 0&&x.readableObjectMode),writableObjectMode:!!(l!==null&&l!==void 0&&l.writableObjectMode),readable:$0,writable:Z0}),Z0)M(l,(m)=>{if(Z0=!1,m)D(x,m);U0(m)}),i._write=function(m,V0,w0){if(l.write(m,V0))w0();else F0=w0},i._final=function(m){l.end(),p=m},l.on("drain",function(){if(F0){let m=F0;F0=null,m()}}),l.on("finish",function(){if(p){let m=p;p=null,m()}});if($0)M(x,(m)=>{if($0=!1,m)D(x,m);U0(m)}),x.on("readable",function(){if(W0){let m=W0;W0=null,m()}}),x.on("end",function(){i.push(null)}),i._read=function(){while(!0){let m=x.read();if(m===null){W0=i._read;return}if(!i.push(m))return}};return i._destroy=function(m,V0){if(!m&&y!==null)m=new k;if(W0=null,F0=null,p=null,y===null)V0(m);else y=V0,D(l,m),D(x,m)},i}}),c2=g0(($,q)=>{var{ObjectDefineProperties:Q,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:J,ObjectSetPrototypeOf:Z}=P0();q.exports=B;var G=f8(),W=n5();Z(B.prototype,G.prototype),Z(B,G);{let F=J(W.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:Q,Symbol:K}=P0();q.exports=B;var{ERR_METHOD_NOT_IMPLEMENTED:J}=a0().codes,Z=c2(),{getHighWaterMark:G}=v8();Q(B.prototype,Z.prototype),Q(B,Z);var W=K("kCallback");function B(w){if(!(this instanceof B))return new B(w);let F=w?G(this,w,"readableHighWaterMark",!0):null;if(F===0)w={...w,highWaterMark:null,readableHighWaterMark:F,writableHighWaterMark:w.writableHighWaterMark||0};if(Z.call(this,w),this._readableState.sync=!1,this[W]=null,w){if(typeof w.transform==="function")this._transform=w.transform;if(typeof w.flush==="function")this._flush=w.flush}this.on("prefinish",U)}function V(w){if(typeof this._flush==="function"&&!this.destroyed)this._flush((F,M)=>{if(F){if(w)w(F);else this.destroy(F);return}if(M!=null)this.push(M);if(this.push(null),w)w()});else if(this.push(null),w)w()}function U(){if(this._final!==V)V.call(this)}B.prototype._final=V,B.prototype._transform=function(w,F,M){throw new J("_transform()")},B.prototype._write=function(w,F,M){let k=this._readableState,f=this._writableState,L=k.length;this._transform(w,F,(D,z)=>{if(D){M(D);return}if(z!=null)this.push(z);if(f.ended||L===k.length||k.length{var{ObjectSetPrototypeOf:Q}=P0();q.exports=J;var K=l9();Q(J.prototype,K.prototype),Q(J,K);function J(Z){if(!(this instanceof J))return new J(Z);K.call(this,Z)}J.prototype._transform=function(Z,G,W){W(null,Z)}}),d5=g0(($,q)=>{var Q=D1(),{ArrayIsArray:K,Promise:J,SymbolAsyncIterator:Z,SymbolDispose:G}=P0(),W=s2(),{once:B}=e0(),V=o1(),U=c2(),{aggregateTwoErrors:w,codes:{ERR_INVALID_ARG_TYPE:F,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:k,ERR_STREAM_DESTROYED:f,ERR_STREAM_PREMATURE_CLOSE:L},AbortError:D}=a0(),{validateFunction:z,validateAbortSignal:N}=P6(),{isIterable:H,isReadable:v,isReadableNodeStream:j,isNodeStream:n,isTransformStream:d,isWebStream:_,isReadableStream:X,isReadableFinished:P}=b2(),g=globalThis.AbortController||O6().AbortController,c,h,x;function l(m,V0,w0){let S=!1;m.on("close",()=>{S=!0});let b=W(m,{readable:V0,writable:w0},(O)=>{S=!O});return{destroy:(O)=>{if(S)return;S=!0,V.destroyer(m,O||new f("pipe"))},cleanup:b}}function $0(m){return z(m[m.length-1],"streams[stream.length - 1]"),m.pop()}function Z0(m){if(H(m))return m;else if(j(m))return F0(m);throw new F("val",["Readable","Iterable","AsyncIterable"],m)}async function*F0(m){if(!h)h=f8();yield*h.prototype[Z].call(m)}async function p(m,V0,w0,{end:S}){let b,O=null,E=(R)=>{if(R)b=R;if(O){let Y=O;O=null,Y()}},a=()=>new J((R,Y)=>{if(b)Y(b);else O=()=>{if(b)Y(b);else R()}});V0.on("drain",E);let K0=W(V0,{readable:!1},E);try{if(V0.writableNeedDrain)await a();for await(let R of m)if(!V0.write(R))await a();if(S)V0.end(),await a();w0()}catch(R){w0(b!==R?w(b,R):R)}finally{K0(),V0.off("drain",E)}}async function W0(m,V0,w0,{end:S}){if(d(V0))V0=V0.writable;let b=V0.getWriter();try{for await(let O of m)await b.ready,b.write(O).catch(()=>{});if(await b.ready,S)await b.close();w0()}catch(O){try{await b.abort(O),w0(O)}catch(E){w0(E)}}}function y(...m){return i(m,B($0(m)))}function i(m,V0,w0){if(m.length===1&&K(m[0]))m=m[0];if(m.length<2)throw new k("streams");let S=new g,b=S.signal,O=w0===null||w0===void 0?void 0:w0.signal,E=[];N(O,"options.signal");function a(){r(new D)}x=x||e0().addAbortListener;let K0;if(O)K0=x(O,a);let R,Y,C=[],u=0;function e(Q0){r(Q0,--u===0)}function r(Q0,M0){var I0;if(Q0&&(!R||R.code==="ERR_STREAM_PREMATURE_CLOSE"))R=Q0;if(!R&&!M0)return;while(C.length)C.shift()(R);if((I0=K0)===null||I0===void 0||I0[G](),S.abort(),M0){if(!R)E.forEach((m0)=>m0());Q.nextTick(V0,R,Y)}}let s;for(let Q0=0;Q00,p0=I0||(w0===null||w0===void 0?void 0:w0.end)!==!1,q2=Q0===m.length-1;if(n(M0)){let O0=function(u0){if(u0&&u0.name!=="AbortError"&&u0.code!=="ERR_STREAM_PREMATURE_CLOSE")e(u0)};var T=O0;if(p0){let{destroy:u0,cleanup:E1}=l(M0,I0,m0);if(C.push(u0),v(M0)&&q2)E.push(E1)}if(M0.on("error",O0),v(M0)&&q2)E.push(()=>{M0.removeListener("error",O0)})}if(Q0===0)if(typeof M0==="function"){if(s=M0({signal:b}),!H(s))throw new M("Iterable, AsyncIterable or Stream","source",s)}else if(H(M0)||j(M0)||d(M0))s=M0;else s=U.from(M0);else if(typeof M0==="function"){if(d(s)){var t;s=Z0((t=s)===null||t===void 0?void 0:t.readable)}else s=Z0(s);if(s=M0(s,{signal:b}),I0){if(!H(s,!0))throw new M("AsyncIterable",`transform[${Q0-1}]`,s)}else{var G0;if(!c)c=r9();let O0=new c({objectMode:!0}),u0=(G0=s)===null||G0===void 0?void 0:G0.then;if(typeof u0==="function")u++,u0.call(s,(R2)=>{if(Y=R2,R2!=null)O0.write(R2);if(p0)O0.end();Q.nextTick(e)},(R2)=>{O0.destroy(R2),Q.nextTick(e,R2)});else if(H(s,!0))u++,p(s,O0,e,{end:p0});else if(X(s)||d(s)){let R2=s.readable||s;u++,p(R2,O0,e,{end:p0})}else throw new M("AsyncIterable or Promise","destination",s);s=O0;let{destroy:E1,cleanup:_1}=l(s,!1,!0);if(C.push(E1),q2)E.push(_1)}}else if(n(M0)){if(j(s)){u+=2;let O0=U0(s,M0,e,{end:p0});if(v(M0)&&q2)E.push(O0)}else if(d(s)||X(s)){let O0=s.readable||s;u++,p(O0,M0,e,{end:p0})}else if(H(s))u++,p(s,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else if(_(M0)){if(j(s))u++,W0(Z0(s),M0,e,{end:p0});else if(X(s)||H(s))u++,W0(s,M0,e,{end:p0});else if(d(s))u++,W0(s.readable,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else s=U.from(M0)}if(b!==null&&b!==void 0&&b.aborted||O!==null&&O!==void 0&&O.aborted)Q.nextTick(a);return s}function U0(m,V0,w0,{end:S}){let b=!1;if(V0.on("close",()=>{if(!b)w0(new L)}),m.pipe(V0,{end:!1}),S){let E=function(){b=!0,V0.end()};var O=E;if(P(m))Q.nextTick(E);else m.once("end",E)}else w0();return W(m,{readable:!0,writable:!1},(E)=>{let a=m._readableState;if(E&&E.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted)m.once("end",w0).once("error",w0);else w0(E)}),W(V0,{readable:!1,writable:!0},w0)}q.exports={pipelineImpl:i,pipeline:y}}),s9=g0(($,q)=>{var{pipeline:Q}=d5(),K=c2(),{destroyer:J}=o1(),{isNodeStream:Z,isReadable:G,isWritable:W,isWebStream:B,isTransformStream:V,isWritableStream:U,isReadableStream:w}=b2(),{AbortError:F,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:k}}=a0(),f=s2();q.exports=function(...L){if(L.length===0)throw new k("streams");if(L.length===1)return K.from(L[0]);let D=[...L];if(typeof L[0]==="function")L[0]=K.from(L[0]);if(typeof L[L.length-1]==="function"){let g=L.length-1;L[g]=K.from(L[g])}for(let g=0;g0&&!(W(L[g])||U(L[g])||V(L[g])))throw new M(`streams[${g}]`,D[g],"must be writable")}let z,N,H,v,j;function n(g){let c=v;if(v=null,c)c(g);else if(g)j.destroy(g);else if(!P&&!X)j.destroy()}let d=L[0],_=Q(L,n),X=!!(W(d)||U(d)||V(d)),P=!!(G(_)||w(_)||V(_));if(j=new K({writableObjectMode:!!(d!==null&&d!==void 0&&d.writableObjectMode),readableObjectMode:!!(_!==null&&_!==void 0&&_.readableObjectMode),writable:X,readable:P}),X){if(Z(d))j._write=function(c,h,x){if(d.write(c,h))x();else z=x},j._final=function(c){d.end(),N=c},d.on("drain",function(){if(z){let c=z;z=null,c()}});else if(B(d)){let c=(V(d)?d.writable:d).getWriter();j._write=async function(h,x,l){try{await c.ready,c.write(h).catch(()=>{}),l()}catch($0){l($0)}},j._final=async function(h){try{await c.ready,c.close().catch(()=>{}),N=h}catch(x){h(x)}}}let g=V(_)?_.readable:_;f(g,()=>{if(N){let c=N;N=null,c()}})}if(P){if(Z(_))_.on("readable",function(){if(H){let g=H;H=null,g()}}),_.on("end",function(){j.push(null)}),j._read=function(){while(!0){let g=_.read();if(g===null){H=j._read;return}if(!j.push(g))return}};else if(B(_)){let g=(V(_)?_.readable:_).getReader();j._read=async function(){while(!0)try{let{value:c,done:h}=await g.read();if(!j.push(c))return;if(h){j.push(null);return}}catch{return}}}}return j._destroy=function(g,c){if(!g&&v!==null)g=new F;if(H=null,z=null,N=null,v===null)c(g);else if(v=c,Z(_))J(_,g)},j}}),hV=g0(($,q)=>{var Q=globalThis.AbortController||O6().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:J,ERR_MISSING_ARGS:Z,ERR_OUT_OF_RANGE:G},AbortError:W}=a0(),{validateAbortSignal:B,validateInteger:V,validateObject:U}=P6(),w=P0().Symbol("kWeak"),F=P0().Symbol("kResistStopPropagation"),{finished:M}=s2(),k=s9(),{addAbortSignalNoValidate:f}=H8(),{isWritable:L,isNodeStream:D}=b2(),{deprecate:z}=e0(),{ArrayPrototypePush:N,Boolean:H,MathFloor:v,Number:j,NumberIsNaN:n,Promise:d,PromiseReject:_,PromiseResolve:X,PromisePrototypeThen:P,Symbol:g}=P0(),c=g("kEmpty"),h=g("kEof");function x(O,E){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");if(D(O)&&!L(O))throw new K("stream",O,"must be writable");let a=k(this,O);if(E!==null&&E!==void 0&&E.signal)f(E.signal,a);return a}function l(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");let a=1;if((E===null||E===void 0?void 0:E.concurrency)!=null)a=v(E.concurrency);let K0=a-1;if((E===null||E===void 0?void 0:E.highWaterMark)!=null)K0=v(E.highWaterMark);return V(a,"options.concurrency",1),V(K0,"options.highWaterMark",0),K0+=a,async function*(){let R=e0().AbortSignalAny([E===null||E===void 0?void 0:E.signal].filter(H)),Y=this,C=[],u={signal:R},e,r,s=!1,T=0;function t(){s=!0,G0()}function G0(){T-=1,Q0()}function Q0(){if(r&&!s&&T=K0||T>=a))await new d((m0)=>{r=m0})}C.push(h)}catch(I0){let m0=_(I0);P(m0,G0,t),C.push(m0)}finally{if(s=!0,e)e(),e=null}}M0();try{while(!0){while(C.length>0){let I0=await C[0];if(I0===h)return;if(R.aborted)throw new W;if(I0!==c)yield I0;C.shift(),Q0()}await new d((I0)=>{e=I0})}}finally{if(s=!0,r)r(),r=null}}.call(this)}function $0(O=void 0){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");return async function*(){let E=0;for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W({cause:O.signal.reason});yield[E++,K0]}}.call(this)}async function Z0(O,E=void 0){for await(let a of y.call(this,O,E))return!0;return!1}async function F0(O,E=void 0){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);return!await Z0.call(this,async(...a)=>{return!await O(...a)},E)}async function p(O,E){for await(let a of y.call(this,O,E))return a;return}async function W0(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){return await O(K0,R),c}for await(let K0 of l.call(this,a,E));}function y(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){if(await O(K0,R))return K0;return c}return l.call(this,a,E)}class i extends Z{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function U0(O,E,a){var K0;if(typeof O!=="function")throw new J("reducer",["Function","AsyncFunction"],O);if(a!=null)U(a,"options");if((a===null||a===void 0?void 0:a.signal)!=null)B(a.signal,"options.signal");let R=arguments.length>1;if(a!==null&&a!==void 0&&(K0=a.signal)!==null&&K0!==void 0&&K0.aborted){let r=new W(void 0,{cause:a.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(r)),r}let Y=new Q,C=Y.signal;if(a!==null&&a!==void 0&&a.signal){let r={once:!0,[w]:this,[F]:!0};a.signal.addEventListener("abort",()=>Y.abort(),r)}let u=!1;try{for await(let r of this){var e;if(u=!0,a!==null&&a!==void 0&&(e=a.signal)!==null&&e!==void 0&&e.aborted)throw new W;if(!R)E=r,R=!0;else E=await O(E,r,{signal:C})}if(!u&&!R)throw new i}finally{Y.abort()}return E}async function m(O){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");let E=[];for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W(void 0,{cause:O.signal.reason});N(E,K0)}return E}function V0(O,E){let a=l.call(this,O,E);return async function*(){for await(let K0 of a)yield*K0}.call(this)}function w0(O){if(O=j(O),n(O))return 0;if(O<0)throw new G("number",">= 0",O);return O}function S(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O--<=0)yield R}}.call(this)}function b(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O-- >0)yield R;if(O<=0)return}}.call(this)}q.exports.streamReturningOperators={asIndexedPairs:z($0,"readable.asIndexedPairs will be removed in a future version."),drop:S,filter:y,flatMap:V0,map:l,take:b,compose:x},q.exports.promiseReturningOperators={every:F0,forEach:W0,reduce:U0,toArray:m,some:Z0,find:p}}),t9=g0(($,q)=>{var{ArrayPrototypePop:Q,Promise:K}=P0(),{isIterable:J,isNodeStream:Z,isWebStream:G}=b2(),{pipelineImpl:W}=d5(),{finished:B}=s2();e9();function V(...U){return new K((w,F)=>{let M,k,f=U[U.length-1];if(f&&typeof f==="object"&&!Z(f)&&!J(f)&&!G(f)){let L=Q(U);M=L.signal,k=L.end}W(U,(L,D)=>{if(L)F(L);else w(D)},{signal:M,end:k})})}q.exports={finished:B,pipeline:V}}),e9=g0(($,q)=>{var{Buffer:Q}=(t0(),X0(K2)),{ObjectDefineProperty:K,ObjectKeys:J,ReflectApply:Z}=P0(),{promisify:{custom:G}}=e0(),{streamReturningOperators:W,promiseReturningOperators:B}=hV(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:V}}=a0(),U=s9(),{setDefaultHighWaterMark:w,getDefaultHighWaterMark:F}=v8(),{pipeline:M}=d5(),{destroyer:k}=o1(),f=s2(),L=t9(),D=b2(),z=q.exports=b5().Stream;z.isDestroyed=D.isDestroyed,z.isDisturbed=D.isDisturbed,z.isErrored=D.isErrored,z.isReadable=D.isReadable,z.isWritable=D.isWritable,z.Readable=f8();for(let H of J(W)){let v=function(...n){if(new.target)throw V();return z.Readable.from(Z(j,this,n))},j=W[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(let H of J(B)){let v=function(...n){if(new.target)throw V();return Z(j,this,n)},j=B[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}z.Writable=n5(),z.Duplex=c2(),z.Transform=l9(),z.PassThrough=r9(),z.pipeline=M;var{addAbortSignal:N}=H8();z.addAbortSignal=N,z.finished=f,z.destroy=k,z.compose=U,z.setDefaultHighWaterMark=w,z.getDefaultHighWaterMark=F,K(z,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return L}}),K(M,G,{__proto__:null,enumerable:!0,get(){return L.pipeline}}),K(f,G,{__proto__:null,enumerable:!0,get(){return L.finished}}),z.Stream=z,z._isUint8Array=function(H){return H instanceof Uint8Array},z._uint8ArrayToBuffer=function(H){return Q.from(H.buffer,H.byteOffset,H.byteLength)}}),xV=g0(($,q)=>{var Q=a1();{let K=e9(),J=t9(),Z=K.Readable.destroy;q.exports=K.Readable,q.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,q.exports._isUint8Array=K._isUint8Array,q.exports.isDisturbed=K.isDisturbed,q.exports.isErrored=K.isErrored,q.exports.isReadable=K.isReadable,q.exports.Readable=K.Readable,q.exports.Writable=K.Writable,q.exports.Duplex=K.Duplex,q.exports.Transform=K.Transform,q.exports.PassThrough=K.PassThrough,q.exports.addAbortSignal=K.addAbortSignal,q.exports.finished=K.finished,q.exports.destroy=K.destroy,q.exports.destroy=Z,q.exports.pipeline=K.pipeline,q.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return J}}),q.exports.Stream=K.Stream}q.exports.default=q.exports});$$.exports=xV()});var m5=N0((Fz,Q$)=>{Q$.exports=a1()});var n2=N0((J2)=>{J2.base64=!0;J2.array=!0;J2.string=!0;J2.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";J2.nodebuffer=typeof Buffer<"u";J2.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")J2.blob=!1;else{R8=new ArrayBuffer(0);try{J2.blob=new Blob([R8],{type:"application/zip"}).size===0}catch($){try{p5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,I8=new p5,I8.append(R8),J2.blob=I8.getBlob("application/zip").size===0}catch(q){J2.blob=!1}}}var R8,p5,I8;try{J2.nodestream=!!m5().Readable}catch($){J2.nodestream=!1}});var o5=N0((i5)=>{var OV=T0(),PV=n2(),A2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i5.encode=function($){var q=[],Q,K,J,Z,G,W,B,V=0,U=$.length,w=U,F=OV.getTypeOf($)!=="string";while(V<$.length){if(w=U-V,!F)Q=$.charCodeAt(V++),K=V>2,G=(Q&3)<<4|K>>4,W=w>1?(K&15)<<2|J>>6:64,B=w>2?J&63:64,q.push(A2.charAt(Z)+A2.charAt(G)+A2.charAt(W)+A2.charAt(B))}return q.join("")};i5.decode=function($){var q,Q,K,J,Z,G,W,B=0,V=0,U="data:";if($.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var w=$.length*3/4;if($.charAt($.length-1)===A2.charAt(64))w--;if($.charAt($.length-2)===A2.charAt(64))w--;if(w%1!==0)throw Error("Invalid base64 input, bad content length.");var F;if(PV.uint8array)F=new Uint8Array(w|0);else F=Array(w|0);while(B<$.length){if(J=A2.indexOf($.charAt(B++)),Z=A2.indexOf($.charAt(B++)),G=A2.indexOf($.charAt(B++)),W=A2.indexOf($.charAt(B++)),q=J<<2|Z>>4,Q=(Z&15)<<4|G>>2,K=(G&3)<<6|W,F[V++]=q,G!==64)F[V++]=Q;if(W!==64)F[V++]=K}return F}});var T6=N0((Nz,q$)=>{q$.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var q=new Buffer($);return q.fill(0),q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var V$=N0((Yz,J$)=>{var K$=global.MutationObserver||global.WebKitMutationObserver,u6;if(K$)j8=0,a5=new K$(C8),g8=global.document.createTextNode(""),a5.observe(g8,{characterData:!0}),u6=function(){g8.data=j8=++j8%2};else if(!global.setImmediate&&typeof global.MessageChannel<"u")A8=new global.MessageChannel,A8.port1.onmessage=C8,u6=function(){A8.port2.postMessage(0)};else if("document"in global&&"onreadystatechange"in global.document.createElement("script"))u6=function(){var $=global.document.createElement("script");$.onreadystatechange=function(){C8(),$.onreadystatechange=null,$.parentNode.removeChild($),$=null},global.document.documentElement.appendChild($)};else u6=function(){setTimeout(C8,0)};var j8,a5,g8,A8,l5,S6=[];function C8(){l5=!0;var $,q,Q=S6.length;while(Q){q=S6,S6=[],$=-1;while(++${var uV=V$();function l1(){}var o0={},U$=["REJECTED"],r5=["FULFILLED"],Z$=["PENDING"];B$.exports=t2;function t2($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Z$,this.queue=[],this.outcome=void 0,$!==l1)G$(this,$)}t2.prototype.finally=function($){if(typeof $!=="function")return this;var q=this.constructor;return this.then(Q,K);function Q(J){function Z(){return J}return q.resolve($()).then(Z)}function K(J){function Z(){throw J}return q.resolve($()).then(Z)}};t2.prototype.catch=function($){return this.then(null,$)};t2.prototype.then=function($,q){if(typeof $!=="function"&&this.state===r5||typeof q!=="function"&&this.state===U$)return this;var Q=new this.constructor(l1);if(this.state!==Z$){var K=this.state===r5?$:q;s5(Q,K,this.outcome)}else this.queue.push(new E6(Q,$,q));return Q};function E6($,q,Q){if(this.promise=$,typeof q==="function")this.onFulfilled=q,this.callFulfilled=this.otherCallFulfilled;if(typeof Q==="function")this.onRejected=Q,this.callRejected=this.otherCallRejected}E6.prototype.callFulfilled=function($){o0.resolve(this.promise,$)};E6.prototype.otherCallFulfilled=function($){s5(this.promise,this.onFulfilled,$)};E6.prototype.callRejected=function($){o0.reject(this.promise,$)};E6.prototype.otherCallRejected=function($){s5(this.promise,this.onRejected,$)};function s5($,q,Q){uV(function(){var K;try{K=q(Q)}catch(J){return o0.reject($,J)}if(K===$)o0.reject($,TypeError("Cannot resolve promise with itself"));else o0.resolve($,K)})}o0.resolve=function($,q){var Q=W$(SV,q);if(Q.status==="error")return o0.reject($,Q.value);var K=Q.value;if(K)G$($,K);else{$.state=r5,$.outcome=q;var J=-1,Z=$.queue.length;while(++J{var t5=null;if(typeof Promise<"u")t5=Promise;else t5=z$();F$.exports={Promise:t5}});var w$=N0((M$)=>{(function($,q){if($.setImmediate)return;var Q=1,K={},J=!1,Z=$.document,G;function W(z){if(typeof z!=="function")z=Function(""+z);var N=Array(arguments.length-1);for(var H=0;H"u"?typeof global>"u"?M$:global:self)});var T0=N0((_0)=>{var e2=n2(),nV=o5(),s1=T6(),e5=r1();w$();function dV($){var q=null;if(e2.uint8array)q=new Uint8Array($.length);else q=Array($.length);return y8($,q)}_0.newBlob=function($,q){_0.checkSupport("blob");try{return new Blob([$],{type:q})}catch(J){try{var Q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,K=new Q;return K.append($),K.getBlob(q)}catch(Z){throw Error("Bug : can't construct the Blob.")}}};function _6($){return $}function y8($,q){for(var Q=0;Q<$.length;++Q)q[Q]=$.charCodeAt(Q)&255;return q}var X8={stringifyByChunk:function($,q,Q){var K=[],J=0,Z=$.length;if(Z<=Q)return String.fromCharCode.apply(null,$);while(J1)try{return X8.stringifyByChunk($,Q,q)}catch(J){q=Math.floor(q/2)}return X8.stringifyByChar($)}_0.applyFromCharCode=c6;function h8($,q){for(var Q=0;Q<$.length;Q++)q[Q]=$[Q];return q}var $1={};$1.string={string:_6,array:function($){return y8($,Array($.length))},arraybuffer:function($){return $1.string.uint8array($).buffer},uint8array:function($){return y8($,new Uint8Array($.length))},nodebuffer:function($){return y8($,s1.allocBuffer($.length))}};$1.array={string:c6,array:_6,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom($)}};$1.arraybuffer={string:function($){return c6(new Uint8Array($))},array:function($){return h8(new Uint8Array($),Array($.byteLength))},arraybuffer:_6,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom(new Uint8Array($))}};$1.uint8array={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:_6,nodebuffer:function($){return s1.newBufferFrom($)}};$1.nodebuffer={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $1.nodebuffer.uint8array($).buffer},uint8array:function($){return h8($,new Uint8Array($.length))},nodebuffer:_6};_0.transformTo=function($,q){if(!q)q="";if(!$)return q;_0.checkSupport($);var Q=_0.getTypeOf(q),K=$1[Q][$](q);return K};_0.resolve=function($){var q=$.split("/"),Q=[];for(var K=0;K"u")$[Q]=arguments[q][Q];return $};_0.prepareContent=function($,q,Q,K,J){var Z=e5.Promise.resolve(q).then(function(G){var W=e2.blob&&(G instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(G))!==-1);if(W&&typeof FileReader<"u")return new e5.Promise(function(B,V){var U=new FileReader;U.onload=function(w){B(w.target.result)},U.onerror=function(w){V(w.target.error)},U.readAsArrayBuffer(G)});else return G});return Z.then(function(G){var W=_0.getTypeOf(G);if(!W)return e5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(W==="arraybuffer")G=_0.transformTo("uint8array",G);else if(W==="string"){if(J)G=nV.decode(G);else if(Q){if(K!==!0)G=dV(G)}}return G})}});var V2=N0((vz,Y$)=>{function N$($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}N$.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,q){return this._listeners[$].push(q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,q){if(this._listeners[$])for(var Q=0;Q "+$;else return $}};Y$.exports=N$});var e1=N0((Q1)=>{var t1=T0(),L1=n2(),mV=T6(),x8=V2(),b6=Array(256);for(X2=0;X2<256;X2++)b6[X2]=X2>=252?6:X2>=248?5:X2>=240?4:X2>=224?3:X2>=192?2:1;var X2;b6[254]=b6[254]=1;var pV=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q},iV=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+b6[$[Q]]>q?Q:q},oV=function($){var q,Q,K,J,Z=$.length,G=Array(Z*2);for(Q=0,q=0;q4){G[Q++]=65533,q+=J-1;continue}K&=J===2?31:J===3?15:7;while(J>1&&q1){G[Q++]=65533;continue}if(K<65536)G[Q++]=K;else K-=65536,G[Q++]=55296|K>>10&1023,G[Q++]=56320|K&1023}if(G.length!==Q)if(G.subarray)G=G.subarray(0,Q);else G.length=Q;return t1.applyFromCharCode(G)};Q1.utf8encode=function(q){if(L1.nodebuffer)return mV.newBufferFrom(q,"utf-8");return pV(q)};Q1.utf8decode=function(q){if(L1.nodebuffer)return t1.transformTo("nodebuffer",q).toString("utf-8");return q=t1.transformTo(L1.uint8array?"uint8array":"array",q),oV(q)};function O8(){x8.call(this,"utf-8 decode"),this.leftOver=null}t1.inherits(O8,x8);O8.prototype.processChunk=function($){var q=t1.transformTo(L1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(L1.uint8array){var Q=q;q=new Uint8Array(Q.length+this.leftOver.length),q.set(this.leftOver,0),q.set(Q,this.leftOver.length)}else q=this.leftOver.concat(q);this.leftOver=null}var K=iV(q),J=q;if(K!==q.length)if(L1.uint8array)J=q.subarray(0,K),this.leftOver=q.subarray(K,q.length);else J=q.slice(0,K),this.leftOver=q.slice(K,q.length);this.push({data:Q1.utf8decode(J),meta:$.meta})};O8.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:Q1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};Q1.Utf8DecodeWorker=O8;function $4(){x8.call(this,"utf-8 encode")}t1.inherits($4,x8);$4.prototype.processChunk=function($){this.push({data:Q1.utf8encode($.data),meta:$.meta})};Q1.Utf8EncodeWorker=$4});var H$=N0((Rz,L$)=>{var k$=V2(),D$=T0();function Q4($){k$.call(this,"ConvertWorker to "+$),this.destType=$}D$.inherits(Q4,k$);Q4.prototype.processChunk=function($){this.push({data:D$.transformTo(this.destType,$.data),meta:$.meta})};L$.exports=Q4});var R$=N0((Iz,f$)=>{var v$=m5().Readable,aV=T0();aV.inherits(q4,v$);function q4($,q,Q){v$.call(this,q),this._helper=$;var K=this;$.on("data",function(J,Z){if(!K.push(J))K._helper.pause();if(Q)Q(Z)}).on("error",function(J){K.emit("error",J)}).on("end",function(){K.push(null)})}q4.prototype._read=function(){this._helper.resume()};f$.exports=q4});var K4=N0((Cz,j$)=>{var H1=T0(),lV=H$(),rV=V2(),sV=o5(),tV=n2(),eV=r1(),I$=null;if(tV.nodestream)try{I$=R$()}catch($){}function $U($,q,Q){switch($){case"blob":return H1.newBlob(H1.transformTo("arraybuffer",q),Q);case"base64":return sV.encode(q);default:return H1.transformTo($,q)}}function QU($,q){var Q,K=0,J=null,Z=0;for(Q=0;Q{D2.base64=!1;D2.binary=!1;D2.dir=!1;D2.createFolders=!0;D2.date=null;D2.compression=null;D2.compressionOptions=null;D2.comment=null;D2.unixPermissions=null;D2.dosPermissions=null});var V4=N0((gz,g$)=>{var P8=T0(),T8=V2(),KU=16384;function $6($){T8.call(this,"DataWorker");var q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(Q){if(q.dataIsReady=!0,q.data=Q,q.max=Q&&Q.length||0,q.type=P8.getTypeOf(Q),!q.isPaused)q._tickAndRepeat()},function(Q){q.error(Q)})}P8.inherits($6,T8);$6.prototype.cleanUp=function(){T8.prototype.cleanUp.call(this),this.data=null};$6.prototype.resume=function(){if(!T8.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,P8.delay(this._tickAndRepeat,[],this);return!0};$6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)P8.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};$6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=KU,q=null,Q=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":q=this.data.substring(this.index,Q);break;case"uint8array":q=this.data.subarray(this.index,Q);break;case"array":case"nodebuffer":q=this.data.slice(this.index,Q);break}return this.index=Q,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})}};g$.exports=$6});var u8=N0((Az,X$)=>{var JU=T0();function VU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var A$=VU();function UU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}function ZU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q.charCodeAt(G))&255];return $^-1}X$.exports=function(q,Q){if(typeof q>"u"||!q.length)return 0;var K=JU.getTypeOf(q)!=="string";if(K)return UU(Q|0,q,q.length,0);else return ZU(Q|0,q,q.length,0)}});var Z4=N0((Xz,h$)=>{var y$=V2(),GU=u8(),WU=T0();function U4(){y$.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}WU.inherits(U4,y$);U4.prototype.processChunk=function($){this.streamInfo.crc32=GU($.data,this.streamInfo.crc32||0),this.push($)};h$.exports=U4});var O$=N0((yz,x$)=>{var BU=T0(),G4=V2();function W4($){G4.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}BU.inherits(W4,G4);W4.prototype.processChunk=function($){if($){var q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=q+$.data.length}G4.prototype.processChunk.call(this,$)};x$.exports=W4});var S8=N0((hz,u$)=>{var P$=r1(),T$=V4(),zU=Z4(),B4=O$();function z4($,q,Q,K,J){this.compressedSize=$,this.uncompressedSize=q,this.crc32=Q,this.compression=K,this.compressedContent=J}z4.prototype={getContentWorker:function(){var $=new T$(P$.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new B4("data_length")),q=this;return $.on("end",function(){if(this.streamInfo.data_length!==q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new T$(P$.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};z4.createWorkerFrom=function($,q,Q){return $.pipe(new zU).pipe(new B4("uncompressedSize")).pipe(q.compressWorker(Q)).pipe(new B4("compressedSize")).withStreamInfo("compression",q)};u$.exports=z4});var c$=N0((xz,_$)=>{var FU=K4(),MU=V4(),F4=e1(),M4=S8(),S$=V2(),w4=function($,q,Q){this.name=$,this.dir=Q.dir,this.date=Q.date,this.comment=Q.comment,this.unixPermissions=Q.unixPermissions,this.dosPermissions=Q.dosPermissions,this._data=q,this._dataBinary=Q.binary,this.options={compression:Q.compression,compressionOptions:Q.compressionOptions}};w4.prototype={internalStream:function($){var q=null,Q="string";try{if(!$)throw Error("No output type specified.");Q=$.toLowerCase();var K=Q==="string"||Q==="text";if(Q==="binarystring"||Q==="text")Q="string";q=this._decompressWorker();var J=!this._dataBinary;if(J&&!K)q=q.pipe(new F4.Utf8EncodeWorker);if(!J&&K)q=q.pipe(new F4.Utf8DecodeWorker)}catch(Z){q=new S$("error"),q.error(Z)}return new FU(q,Q,"")},async:function($,q){return this.internalStream($).accumulate(q)},nodeStream:function($,q){return this.internalStream($||"nodebuffer").toNodejsStream(q)},_compressWorker:function($,q){if(this._data instanceof M4&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var Q=this._decompressWorker();if(!this._dataBinary)Q=Q.pipe(new F4.Utf8EncodeWorker);return M4.createWorkerFrom(Q,$,q)}},_decompressWorker:function(){if(this._data instanceof M4)return this._data.getContentWorker();else if(this._data instanceof S$)return this._data;else return new MU(this._data)}};var E$=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],wU=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(n6=0;n6{var NU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function YU($,q){return Object.prototype.hasOwnProperty.call($,q)}l0.assign=function($){var q=Array.prototype.slice.call(arguments,1);while(q.length){var Q=q.shift();if(!Q)continue;if(typeof Q!=="object")throw TypeError(Q+"must be non-object");for(var K in Q)if(YU(Q,K))$[K]=Q[K]}return $};l0.shrinkBuf=function($,q){if($.length===q)return $;if($.subarray)return $.subarray(0,q);return $.length=q,$};var kU={arraySet:function($,q,Q,K,J){if(q.subarray&&$.subarray){$.set(q.subarray(Q,Q+K),J);return}for(var Z=0;Z{var LU=d2(),HU=4,b$=0,n$=1,vU=2;function q6($){var q=$.length;while(--q>=0)$[q]=0}var fU=0,a$=1,RU=2,IU=3,CU=258,v4=29,a6=256,m6=a6+1+v4,Q6=30,f4=19,l$=2*m6+1,v1=15,N4=16,jU=7,R4=256,r$=16,s$=17,t$=18,L4=[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],E8=[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],gU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],AU=512,m2=Array((m6+2)*2);q6(m2);var d6=Array(Q6*2);q6(d6);var p6=Array(AU);q6(p6);var i6=Array(CU-IU+1);q6(i6);var I4=Array(v4);q6(I4);var _8=Array(Q6);q6(_8);function Y4($,q,Q,K,J){this.static_tree=$,this.extra_bits=q,this.extra_base=Q,this.elems=K,this.max_length=J,this.has_stree=$&&$.length}var $Q,QQ,qQ;function k4($,q){this.dyn_tree=$,this.max_code=0,this.stat_desc=q}function KQ($){return $<256?p6[$]:p6[256+($>>>7)]}function o6($,q){$.pending_buf[$.pending++]=q&255,$.pending_buf[$.pending++]=q>>>8&255}function $2($,q,Q){if($.bi_valid>N4-Q)$.bi_buf|=q<<$.bi_valid&65535,o6($,$.bi_buf),$.bi_buf=q>>N4-$.bi_valid,$.bi_valid+=Q-N4;else $.bi_buf|=q<<$.bi_valid&65535,$.bi_valid+=Q}function y2($,q,Q){$2($,Q[q*2],Q[q*2+1])}function JQ($,q){var Q=0;do Q|=$&1,$>>>=1,Q<<=1;while(--q>0);return Q>>>1}function XU($){if($.bi_valid===16)o6($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function yU($,q){var{dyn_tree:Q,max_code:K}=q,J=q.stat_desc.static_tree,Z=q.stat_desc.has_stree,G=q.stat_desc.extra_bits,W=q.stat_desc.extra_base,B=q.stat_desc.max_length,V,U,w,F,M,k,f=0;for(F=0;F<=v1;F++)$.bl_count[F]=0;Q[$.heap[$.heap_max]*2+1]=0;for(V=$.heap_max+1;VB)F=B,f++;if(Q[U*2+1]=F,U>K)continue;if($.bl_count[F]++,M=0,U>=W)M=G[U-W];if(k=Q[U*2],$.opt_len+=k*(F+M),Z)$.static_len+=k*(J[U*2+1]+M)}if(f===0)return;do{F=B-1;while($.bl_count[F]===0)F--;$.bl_count[F]--,$.bl_count[F+1]+=2,$.bl_count[B]--,f-=2}while(f>0);for(F=B;F!==0;F--){U=$.bl_count[F];while(U!==0){if(w=$.heap[--V],w>K)continue;if(Q[w*2+1]!==F)$.opt_len+=(F-Q[w*2+1])*Q[w*2],Q[w*2+1]=F;U--}}}function VQ($,q,Q){var K=Array(v1+1),J=0,Z,G;for(Z=1;Z<=v1;Z++)K[Z]=J=J+Q[Z-1]<<1;for(G=0;G<=q;G++){var W=$[G*2+1];if(W===0)continue;$[G*2]=JQ(K[W]++,W)}}function hU(){var $,q,Q,K,J,Z=Array(v1+1);Q=0;for(K=0;K>=7;for(;K8)o6($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function xU($,q,Q,K){if(ZQ($),K)o6($,Q),o6($,~Q);LU.arraySet($.pending_buf,$.window,q,Q,$.pending),$.pending+=Q}function d$($,q,Q,K){var J=q*2,Z=Q*2;return $[J]<$[Z]||$[J]===$[Z]&&K[q]<=K[Q]}function D4($,q,Q){var K=$.heap[Q],J=Q<<1;while(J<=$.heap_len){if(J<$.heap_len&&d$(q,$.heap[J+1],$.heap[J],$.depth))J++;if(d$(q,K,$.heap[J],$.depth))break;$.heap[Q]=$.heap[J],Q=J,J<<=1}$.heap[Q]=K}function m$($,q,Q){var K,J,Z=0,G,W;if($.last_lit!==0)do if(K=$.pending_buf[$.d_buf+Z*2]<<8|$.pending_buf[$.d_buf+Z*2+1],J=$.pending_buf[$.l_buf+Z],Z++,K===0)y2($,J,q);else{if(G=i6[J],y2($,G+a6+1,q),W=L4[G],W!==0)J-=I4[G],$2($,J,W);if(K--,G=KQ(K),y2($,G,Q),W=E8[G],W!==0)K-=_8[G],$2($,K,W)}while(Z<$.last_lit);y2($,R4,q)}function H4($,q){var Q=q.dyn_tree,K=q.stat_desc.static_tree,J=q.stat_desc.has_stree,Z=q.stat_desc.elems,G,W,B=-1,V;$.heap_len=0,$.heap_max=l$;for(G=0;G>1;G>=1;G--)D4($,Q,G);V=Z;do G=$.heap[1],$.heap[1]=$.heap[$.heap_len--],D4($,Q,1),W=$.heap[1],$.heap[--$.heap_max]=G,$.heap[--$.heap_max]=W,Q[V*2]=Q[G*2]+Q[W*2],$.depth[V]=($.depth[G]>=$.depth[W]?$.depth[G]:$.depth[W])+1,Q[G*2+1]=Q[W*2+1]=V,$.heap[1]=V++,D4($,Q,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],yU($,q),VQ(Q,B,$.bl_count)}function p$($,q,Q){var K,J=-1,Z,G=q[1],W=0,B=7,V=4;if(G===0)B=138,V=3;q[(Q+1)*2+1]=65535;for(K=0;K<=Q;K++){if(Z=G,G=q[(K+1)*2+1],++W=3;q--)if($.bl_tree[e$[q]*2+1]!==0)break;return $.opt_len+=3*(q+1)+5+5+4,q}function PU($,q,Q,K){var J;$2($,q-257,5),$2($,Q-1,5),$2($,K-4,4);for(J=0;J>>=1)if(q&1&&$.dyn_ltree[Q*2]!==0)return b$;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return n$;for(Q=32;Q0){if($.strm.data_type===vU)$.strm.data_type=TU($);if(H4($,$.l_desc),H4($,$.d_desc),G=OU($),J=$.opt_len+3+7>>>3,Z=$.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=Q+5;if(Q+4<=J&&q!==-1)GQ($,q,Q,K);else if($.strategy===HU||Z===J)$2($,(a$<<1)+(K?1:0),3),m$($,m2,d6);else $2($,(RU<<1)+(K?1:0),3),PU($,$.l_desc.max_code+1,$.d_desc.max_code+1,G+1),m$($,$.dyn_ltree,$.dyn_dtree);if(UQ($),K)ZQ($)}function _U($,q,Q){if($.pending_buf[$.d_buf+$.last_lit*2]=q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=q&255,$.pending_buf[$.l_buf+$.last_lit]=Q&255,$.last_lit++,q===0)$.dyn_ltree[Q*2]++;else $.matches++,q--,$.dyn_ltree[(i6[Q]+a6+1)*2]++,$.dyn_dtree[KQ(q)*2]++;return $.last_lit===$.lit_bufsize-1}K6._tr_init=uU;K6._tr_stored_block=GQ;K6._tr_flush_block=EU;K6._tr_tally=_U;K6._tr_align=SU});var C4=N0((Tz,BQ)=>{function cU($,q,Q,K){var J=$&65535|0,Z=$>>>16&65535|0,G=0;while(Q!==0){G=Q>2000?2000:Q,Q-=G;do J=J+q[K++]|0,Z=Z+J|0;while(--G);J%=65521,Z%=65521}return J|Z<<16|0}BQ.exports=cU});var j4=N0((uz,zQ)=>{function bU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var nU=bU();function dU($,q,Q,K){var J=nU,Z=K+Q;$^=-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}zQ.exports=dU});var c8=N0((Sz,FQ)=>{FQ.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var vQ=N0((O2)=>{var r0=d2(),M2=WQ(),YQ=C4(),q1=j4(),mU=c8(),C1=0,pU=1,iU=3,Z1=4,MQ=5,x2=0,wQ=1,w2=-2,oU=-3,g4=-5,aU=-1,lU=1,b8=2,rU=3,sU=4,tU=0,eU=2,p8=8,$Z=9,QZ=15,qZ=8,KZ=29,JZ=256,X4=JZ+1+KZ,VZ=30,UZ=19,ZZ=2*X4+1,GZ=15,f0=3,V1=258,L2=V1+f0+1,WZ=32,i8=42,y4=69,n8=73,d8=91,m8=103,f1=113,r6=666,c0=1,s6=2,R1=3,U6=4,BZ=3;function U1($,q){return $.msg=mU[q],q}function NQ($){return($<<1)-($>4?9:0)}function J1($){var q=$.length;while(--q>=0)$[q]=0}function K1($){var q=$.state,Q=q.pending;if(Q>$.avail_out)Q=$.avail_out;if(Q===0)return;if(r0.arraySet($.output,q.pending_buf,q.pending_out,Q,$.next_out),$.next_out+=Q,q.pending_out+=Q,$.total_out+=Q,$.avail_out-=Q,q.pending-=Q,q.pending===0)q.pending_out=0}function d0($,q){M2._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,q),$.block_start=$.strstart,K1($.strm)}function C0($,q){$.pending_buf[$.pending++]=q}function l6($,q){$.pending_buf[$.pending++]=q>>>8&255,$.pending_buf[$.pending++]=q&255}function zZ($,q,Q,K){var J=$.avail_in;if(J>K)J=K;if(J===0)return 0;if($.avail_in-=J,r0.arraySet(q,$.input,$.next_in,J,Q),$.state.wrap===1)$.adler=YQ($.adler,q,J,Q);else if($.state.wrap===2)$.adler=q1($.adler,q,J,Q);return $.next_in+=J,$.total_in+=J,J}function kQ($,q){var{max_chain_length:Q,strstart:K}=$,J,Z,G=$.prev_length,W=$.nice_match,B=$.strstart>$.w_size-L2?$.strstart-($.w_size-L2):0,V=$.window,U=$.w_mask,w=$.prev,F=$.strstart+V1,M=V[K+G-1],k=V[K+G];if($.prev_length>=$.good_match)Q>>=2;if(W>$.lookahead)W=$.lookahead;do{if(J=q,V[J+G]!==k||V[J+G-1]!==M||V[J]!==V[K]||V[++J]!==V[K+1])continue;K+=2,J++;do;while(V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&KG){if($.match_start=q,G=Z,Z>=W)break;M=V[K+G-1],k=V[K+G]}}while((q=w[q&U])>B&&--Q!==0);if(G<=$.lookahead)return G;return $.lookahead}function I1($){var q=$.w_size,Q,K,J,Z,G;do{if(Z=$.window_size-$.lookahead-$.strstart,$.strstart>=q+(q-L2)){r0.arraySet($.window,$.window,q,q,0),$.match_start-=q,$.strstart-=q,$.block_start-=q,K=$.hash_size,Q=K;do J=$.head[--Q],$.head[Q]=J>=q?J-q:0;while(--K);K=q,Q=K;do J=$.prev[--Q],$.prev[Q]=J>=q?J-q:0;while(--K);Z+=q}if($.strm.avail_in===0)break;if(K=zZ($.strm,$.window,$.strstart+$.lookahead,Z),$.lookahead+=K,$.lookahead+$.insert>=f0){G=$.strstart-$.insert,$.ins_h=$.window[G],$.ins_h=($.ins_h<<$.hash_shift^$.window[G+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[G+f0-1])&$.hash_mask,$.prev[G&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=G,G++,$.insert--,$.lookahead+$.insert$.pending_buf_size-5)Q=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(I1($),$.lookahead===0&&q===C1)return c0;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var K=$.block_start+Q;if($.strstart===0||$.strstart>=K){if($.lookahead=$.strstart-K,$.strstart=K,d0($,!1),$.strm.avail_out===0)return c0}if($.strstart-$.block_start>=$.w_size-L2){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.strstart>$.block_start){if(d0($,!1),$.strm.avail_out===0)return c0}return c0}function A4($,q){var Q,K;for(;;){if($.lookahead=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(Q!==0&&$.strstart-Q<=$.w_size-L2)$.match_length=kQ($,Q);if($.match_length>=f0)if(K=M2._tr_tally($,$.strstart-$.match_start,$.match_length-f0),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=f0){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else K=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(K){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=$.strstart=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=f0-1,Q!==0&&$.prev_length<$.max_lazy_match&&$.strstart-Q<=$.w_size-L2){if($.match_length=kQ($,Q),$.match_length<=5&&($.strategy===lU||$.match_length===f0&&$.strstart-$.match_start>4096))$.match_length=f0-1}if($.prev_length>=f0&&$.match_length<=$.prev_length){J=$.strstart+$.lookahead-f0,K=M2._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-f0),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=J)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=f0-1,$.strstart++,K){if(d0($,!1),$.strm.avail_out===0)return c0}}else if($.match_available){if(K=M2._tr_tally($,0,$.window[$.strstart-1]),K)d0($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return c0}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)K=M2._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart=f0&&$.strstart>0){if(J=$.strstart-1,K=G[J],K===G[++J]&&K===G[++J]&&K===G[++J]){Z=$.strstart+V1;do;while(K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&J$.lookahead)$.match_length=$.lookahead}}if($.match_length>=f0)Q=M2._tr_tally($,1,$.match_length-f0),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function wZ($,q){var Q;for(;;){if($.lookahead===0){if(I1($),$.lookahead===0){if(q===C1)return c0;break}}if($.match_length=0,Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function h2($,q,Q,K,J){this.good_length=$,this.max_lazy=q,this.nice_length=Q,this.max_chain=K,this.func=J}var V6;V6=[new h2(0,0,0,0,FZ),new h2(4,4,8,4,A4),new h2(4,5,16,8,A4),new h2(4,6,32,32,A4),new h2(4,4,16,16,J6),new h2(8,16,32,32,J6),new h2(8,16,128,128,J6),new h2(8,32,128,256,J6),new h2(32,128,258,1024,J6),new h2(32,258,258,4096,J6)];function NZ($){$.window_size=2*$.w_size,J1($.head),$.max_lazy_match=V6[$.level].max_lazy,$.good_match=V6[$.level].good_length,$.nice_match=V6[$.level].nice_length,$.max_chain_length=V6[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=f0-1,$.match_available=0,$.ins_h=0}function YZ(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=p8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r0.Buf16(ZZ*2),this.dyn_dtree=new r0.Buf16((2*VZ+1)*2),this.bl_tree=new r0.Buf16((2*UZ+1)*2),J1(this.dyn_ltree),J1(this.dyn_dtree),J1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r0.Buf16(GZ+1),this.heap=new r0.Buf16(2*X4+1),J1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r0.Buf16(2*X4+1),J1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function DQ($){var q;if(!$||!$.state)return U1($,w2);if($.total_in=$.total_out=0,$.data_type=eU,q=$.state,q.pending=0,q.pending_out=0,q.wrap<0)q.wrap=-q.wrap;return q.status=q.wrap?i8:f1,$.adler=q.wrap===2?0:1,q.last_flush=C1,M2._tr_init(q),x2}function LQ($){var q=DQ($);if(q===x2)NZ($.state);return q}function kZ($,q){if(!$||!$.state)return w2;if($.state.wrap!==2)return w2;return $.state.gzhead=q,x2}function HQ($,q,Q,K,J,Z){if(!$)return w2;var G=1;if(q===aU)q=6;if(K<0)G=0,K=-K;else if(K>15)G=2,K-=16;if(J<1||J>$Z||Q!==p8||K<8||K>15||q<0||q>9||Z<0||Z>sU)return U1($,w2);if(K===8)K=9;var W=new YZ;return $.state=W,W.strm=$,W.wrap=G,W.gzhead=null,W.w_bits=K,W.w_size=1<MQ||q<0)return $?U1($,w2):w2;if(K=$.state,!$.output||!$.input&&$.avail_in!==0||K.status===r6&&q!==Z1)return U1($,$.avail_out===0?g4:w2);if(K.strm=$,Q=K.last_flush,K.last_flush=q,K.status===i8)if(K.wrap===2)if($.adler=0,C0(K,31),C0(K,139),C0(K,8),!K.gzhead)C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,BZ),K.status=f1;else{if(C0(K,(K.gzhead.text?1:0)+(K.gzhead.hcrc?2:0)+(!K.gzhead.extra?0:4)+(!K.gzhead.name?0:8)+(!K.gzhead.comment?0:16)),C0(K,K.gzhead.time&255),C0(K,K.gzhead.time>>8&255),C0(K,K.gzhead.time>>16&255),C0(K,K.gzhead.time>>24&255),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)C0(K,K.gzhead.extra.length&255),C0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)$.adler=q1($.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=y4}else{var G=p8+(K.w_bits-8<<4)<<8,W=-1;if(K.strategy>=b8||K.level<2)W=0;else if(K.level<6)W=1;else if(K.level===6)W=2;else W=3;if(G|=W<<6,K.strstart!==0)G|=WZ;if(G+=31-G%31,K.status=f1,l6(K,G),K.strstart!==0)l6(K,$.adler>>>16),l6(K,$.adler&65535);$.adler=1}if(K.status===y4)if(K.gzhead.extra){J=K.pending;while(K.gzindex<(K.gzhead.extra.length&65535)){if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size)break}C0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=n8}else K.status=n8;if(K.status===n8)if(K.gzhead.name){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.gzindex=0,K.status=d8}else K.status=d8;if(K.status===d8)if(K.gzhead.comment){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.status=m8}else K.status=m8;if(K.status===m8)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)K1($);if(K.pending+2<=K.pending_buf_size)C0(K,$.adler&255),C0(K,$.adler>>8&255),$.adler=0,K.status=f1}else K.status=f1;if(K.pending!==0){if(K1($),$.avail_out===0)return K.last_flush=-1,x2}else if($.avail_in===0&&NQ(q)<=NQ(Q)&&q!==Z1)return U1($,g4);if(K.status===r6&&$.avail_in!==0)return U1($,g4);if($.avail_in!==0||K.lookahead!==0||q!==C1&&K.status!==r6){var B=K.strategy===b8?wZ(K,q):K.strategy===rU?MZ(K,q):V6[K.level].func(K,q);if(B===R1||B===U6)K.status=r6;if(B===c0||B===R1){if($.avail_out===0)K.last_flush=-1;return x2}if(B===s6){if(q===pU)M2._tr_align(K);else if(q!==MQ){if(M2._tr_stored_block(K,0,0,!1),q===iU){if(J1(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(K1($),$.avail_out===0)return K.last_flush=-1,x2}}if(q!==Z1)return x2;if(K.wrap<=0)return wQ;if(K.wrap===2)C0(K,$.adler&255),C0(K,$.adler>>8&255),C0(K,$.adler>>16&255),C0(K,$.adler>>24&255),C0(K,$.total_in&255),C0(K,$.total_in>>8&255),C0(K,$.total_in>>16&255),C0(K,$.total_in>>24&255);else l6(K,$.adler>>>16),l6(K,$.adler&65535);if(K1($),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?x2:wQ}function HZ($){var q;if(!$||!$.state)return w2;if(q=$.state.status,q!==i8&&q!==y4&&q!==n8&&q!==d8&&q!==m8&&q!==f1&&q!==r6)return U1($,w2);return $.state=null,q===f1?U1($,oU):x2}function vZ($,q){var Q=q.length,K,J,Z,G,W,B,V,U;if(!$||!$.state)return w2;if(K=$.state,G=K.wrap,G===2||G===1&&K.status!==i8||K.lookahead)return w2;if(G===1)$.adler=YQ($.adler,q,Q,0);if(K.wrap=0,Q>=K.w_size){if(G===0)J1(K.head),K.strstart=0,K.block_start=0,K.insert=0;U=new r0.Buf8(K.w_size),r0.arraySet(U,q,Q-K.w_size,K.w_size,0),q=U,Q=K.w_size}W=$.avail_in,B=$.next_in,V=$.input,$.avail_in=Q,$.next_in=0,$.input=q,I1(K);while(K.lookahead>=f0){J=K.strstart,Z=K.lookahead-(f0-1);do K.ins_h=(K.ins_h<{var o8=d2(),fQ=!0,RQ=!0;try{String.fromCharCode.apply(null,[0])}catch($){fQ=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){RQ=!1}var t6=new o8.Buf8(256);for(P2=0;P2<256;P2++)t6[P2]=P2>=252?6:P2>=248?5:P2>=240?4:P2>=224?3:P2>=192?2:1;var P2;t6[254]=t6[254]=1;Z6.string2buf=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q};function IQ($,q){if(q<65534){if($.subarray&&RQ||!$.subarray&&fQ)return String.fromCharCode.apply(null,o8.shrinkBuf($,q))}var Q="";for(var K=0;K4){W[K++]=65533,Q+=Z-1;continue}J&=Z===2?31:Z===3?15:7;while(Z>1&&Q1){W[K++]=65533;continue}if(J<65536)W[K++]=J;else J-=65536,W[K++]=55296|J>>10&1023,W[K++]=56320|J&1023}return IQ(W,K)};Z6.utf8border=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+t6[$[Q]]>q?Q:q}});var x4=N0((cz,CQ)=>{function fZ(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}CQ.exports=fZ});var XQ=N0((Q8)=>{var e6=vQ(),$8=d2(),P4=h4(),T4=c8(),RZ=x4(),AQ=Object.prototype.toString,IZ=0,O4=4,G6=0,jQ=1,gQ=2,CZ=-1,jZ=0,gZ=8;function j1($){if(!(this instanceof j1))return new j1($);this.options=$8.assign({level:CZ,method:gZ,chunkSize:16384,windowBits:15,memLevel:8,strategy:jZ,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>0)q.windowBits=-q.windowBits;else if(q.gzip&&q.windowBits>0&&q.windowBits<16)q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new RZ,this.strm.avail_out=0;var Q=e6.deflateInit2(this.strm,q.level,q.method,q.windowBits,q.memLevel,q.strategy);if(Q!==G6)throw Error(T4[Q]);if(q.header)e6.deflateSetHeader(this.strm,q.header);if(q.dictionary){var K;if(typeof q.dictionary==="string")K=P4.string2buf(q.dictionary);else if(AQ.call(q.dictionary)==="[object ArrayBuffer]")K=new Uint8Array(q.dictionary);else K=q.dictionary;if(Q=e6.deflateSetDictionary(this.strm,K),Q!==G6)throw Error(T4[Q]);this._dict_set=!0}}j1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J,Z;if(this.ended)return!1;if(Z=q===~~q?q:q===!0?O4:IZ,typeof $==="string")Q.input=P4.string2buf($);else if(AQ.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new $8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(J=e6.deflate(Q,Z),J!==jQ&&J!==G6)return this.onEnd(J),this.ended=!0,!1;if(Q.avail_out===0||Q.avail_in===0&&(Z===O4||Z===gQ))if(this.options.to==="string")this.onData(P4.buf2binstring($8.shrinkBuf(Q.output,Q.next_out)));else this.onData($8.shrinkBuf(Q.output,Q.next_out))}while((Q.avail_in>0||Q.avail_out===0)&&J!==jQ);if(Z===O4)return J=e6.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===G6;if(Z===gQ)return this.onEnd(G6),Q.avail_out=0,!0;return!0};j1.prototype.onData=function($){this.chunks.push($)};j1.prototype.onEnd=function($){if($===G6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=$8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function u4($,q){var Q=new j1(q);if(Q.push($,!0),Q.err)throw Q.msg||T4[Q.err];return Q.result}function AZ($,q){return q=q||{},q.raw=!0,u4($,q)}function XZ($,q){return q=q||{},q.gzip=!0,u4($,q)}Q8.Deflate=j1;Q8.deflate=u4;Q8.deflateRaw=AZ;Q8.gzip=XZ});var hQ=N0((nz,yQ)=>{var a8=30,yZ=12;yQ.exports=function(q,Q){var K,J,Z,G,W,B,V,U,w,F,M,k,f,L,D,z,N,H,v,j,n,d,_,X,P;K=q.state,J=q.next_in,X=q.input,Z=J+(q.avail_in-5),G=q.next_out,P=q.output,W=G-(Q-q.avail_out),B=G+(q.avail_out-257),V=K.dmax,U=K.wsize,w=K.whave,F=K.wnext,M=K.window,k=K.hold,f=K.bits,L=K.lencode,D=K.distcode,z=(1<>>24,k>>>=v,f-=v,v=H>>>16&255,v===0)P[G++]=H&65535;else if(v&16){if(j=H&65535,v&=15,v){if(f>>=v,f-=v}if(f<15)k+=X[J++]<>>24,k>>>=v,f-=v,v=H>>>16&255,v&16){if(n=H&65535,v&=15,fV){q.msg="invalid distance too far back",K.mode=a8;break $}if(k>>>=v,f-=v,v=G-W,n>v){if(v=n-v,v>w){if(K.sane){q.msg="invalid distance too far back",K.mode=a8;break $}}if(d=0,_=M,F===0){if(d+=U-v,v2)P[G++]=_[d++],P[G++]=_[d++],P[G++]=_[d++],j-=3;if(j){if(P[G++]=_[d++],j>1)P[G++]=_[d++]}}else{d=G-n;do P[G++]=P[d++],P[G++]=P[d++],P[G++]=P[d++],j-=3;while(j>2);if(j){if(P[G++]=P[d++],j>1)P[G++]=P[d++]}}}else if((v&64)===0){H=D[(H&65535)+(k&(1<>3,J-=j,f-=j<<3,k&=(1<{var xQ=d2(),W6=15,OQ=852,PQ=592,TQ=0,S4=1,uQ=2,hZ=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],xZ=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],OZ=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],PZ=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];SQ.exports=function(q,Q,K,J,Z,G,W,B){var V=B.bits,U=0,w=0,F=0,M=0,k=0,f=0,L=0,D=0,z=0,N=0,H,v,j,n,d,_=null,X=0,P,g=new xQ.Buf16(W6+1),c=new xQ.Buf16(W6+1),h=null,x=0,l,$0,Z0;for(U=0;U<=W6;U++)g[U]=0;for(w=0;w=1;M--)if(g[M]!==0)break;if(k>M)k=M;if(M===0)return Z[G++]=20971520,Z[G++]=20971520,B.bits=1,0;for(F=1;F0&&(q===TQ||M!==1))return-1;c[1]=0;for(U=1;UOQ||q===uQ&&z>PQ)return 1;for(;;){if(l=U-L,W[w]P)$0=h[x+W[w]],Z0=_[X+W[w]];else $0=96,Z0=0;H=1<>L)+v]=l<<24|$0<<16|Z0|0;while(v!==0);H=1<>=1;if(H!==0)N&=H-1,N+=H;else N=0;if(w++,--g[U]===0){if(U===M)break;U=Q[K+W[w]]}if(U>k&&(N&n)!==j){if(L===0)L=k;d+=F,f=U-L,D=1<OQ||q===uQ&&z>PQ)return 1;j=N&n,Z[j]=k<<24|f<<16|d-G|0}}if(N!==0)Z[d+N]=U-L<<24|4194304|0;return B.bits=k,0}});var Lq=N0((H2)=>{var U2=d2(),d4=C4(),T2=j4(),TZ=hQ(),q8=EQ(),uZ=0,Bq=1,zq=2,_Q=4,SZ=5,l8=6,g1=0,EZ=1,_Z=2,N2=-2,Fq=-3,m4=-4,cZ=-5,cQ=8,Mq=1,bQ=2,nQ=3,dQ=4,mQ=5,pQ=6,iQ=7,oQ=8,aQ=9,lQ=10,t8=11,p2=12,E4=13,rQ=14,_4=15,sQ=16,tQ=17,eQ=18,$q=19,r8=20,s8=21,Qq=22,qq=23,Kq=24,Jq=25,Vq=26,c4=27,Uq=28,Zq=29,x0=30,p4=31,bZ=32,nZ=852,dZ=592,mZ=15,pZ=mZ;function Gq($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function iZ(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U2.Buf16(320),this.work=new U2.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function wq($){var q;if(!$||!$.state)return N2;if(q=$.state,$.total_in=$.total_out=q.total=0,$.msg="",q.wrap)$.adler=q.wrap&1;return q.mode=Mq,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new U2.Buf32(nZ),q.distcode=q.distdyn=new U2.Buf32(dZ),q.sane=1,q.back=-1,g1}function Nq($){var q;if(!$||!$.state)return N2;return q=$.state,q.wsize=0,q.whave=0,q.wnext=0,wq($)}function Yq($,q){var Q,K;if(!$||!$.state)return N2;if(K=$.state,q<0)Q=0,q=-q;else if(Q=(q>>4)+1,q<48)q&=15;if(q&&(q<8||q>15))return N2;if(K.window!==null&&K.wbits!==q)K.window=null;return K.wrap=Q,K.wbits=q,Nq($)}function kq($,q){var Q,K;if(!$)return N2;if(K=new iZ,$.state=K,K.window=null,Q=Yq($,q),Q!==g1)$.state=null;return Q}function oZ($){return kq($,pZ)}var Wq=!0,b4,n4;function aZ($){if(Wq){var q;b4=new U2.Buf32(512),n4=new U2.Buf32(32),q=0;while(q<144)$.lens[q++]=8;while(q<256)$.lens[q++]=9;while(q<280)$.lens[q++]=7;while(q<288)$.lens[q++]=8;q8(Bq,$.lens,0,288,b4,0,$.work,{bits:9}),q=0;while(q<32)$.lens[q++]=5;q8(zq,$.lens,0,32,n4,0,$.work,{bits:5}),Wq=!1}$.lencode=b4,$.lenbits=9,$.distcode=n4,$.distbits=5}function Dq($,q,Q,K){var J,Z=$.state;if(Z.window===null)Z.wsize=1<=Z.wsize)U2.arraySet(Z.window,q,Q-Z.wsize,Z.wsize,0),Z.wnext=0,Z.whave=Z.wsize;else{if(J=Z.wsize-Z.wnext,J>K)J=K;if(U2.arraySet(Z.window,q,Q-K,J,Z.wnext),K-=J,K)U2.arraySet(Z.window,q,Q-K,K,0),Z.wnext=K,Z.whave=Z.wsize;else{if(Z.wnext+=J,Z.wnext===Z.wsize)Z.wnext=0;if(Z.whave>>8&255,Q.check=T2(Q.check,_,2,0),V=0,U=0,Q.mode=bQ;break}if(Q.flags=0,Q.head)Q.head.done=!1;if(!(Q.wrap&1)||(((V&255)<<8)+(V>>8))%31){$.msg="incorrect header check",Q.mode=x0;break}if((V&15)!==cQ){$.msg="unknown compression method",Q.mode=x0;break}if(V>>>=4,U-=4,n=(V&15)+8,Q.wbits===0)Q.wbits=n;else if(n>Q.wbits){$.msg="invalid window size",Q.mode=x0;break}Q.dmax=1<>8&1;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=nQ;case nQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>8&255,_[2]=V>>>16&255,_[3]=V>>>24&255,Q.check=T2(Q.check,_,4,0);V=0,U=0,Q.mode=dQ;case dQ:while(U<16){if(W===0)break $;W--,V+=K[Z++]<>8;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=mQ;case mQ:if(Q.flags&1024){while(U<16){if(W===0)break $;W--,V+=K[Z++]<>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0}else if(Q.head)Q.head.extra=null;Q.mode=pQ;case pQ:if(Q.flags&1024){if(M=Q.length,M>W)M=W;if(M){if(Q.head){if(n=Q.head.extra_len-Q.length,!Q.head.extra)Q.head.extra=Array(Q.head.extra_len);U2.arraySet(Q.head.extra,K,Z,M,n)}if(Q.flags&512)Q.check=T2(Q.check,K,M,Z);W-=M,Z+=M,Q.length-=M}if(Q.length)break $}Q.length=0,Q.mode=iQ;case iQ:if(Q.flags&2048){if(W===0)break $;M=0;do if(n=K[Z+M++],Q.head&&n&&Q.length<65536)Q.head.name+=String.fromCharCode(n);while(n&&M>9&1,Q.head.done=!0;$.adler=Q.check=0,Q.mode=p2;break;case lQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>=U&7,U-=U&7,Q.mode=c4;break}while(U<3){if(W===0)break $;W--,V+=K[Z++]<>>=1,U-=1,V&3){case 0:Q.mode=rQ;break;case 1:if(aZ(Q),Q.mode=r8,q===l8){V>>>=2,U-=2;break $}break;case 2:Q.mode=tQ;break;case 3:$.msg="invalid block type",Q.mode=x0}V>>>=2,U-=2;break;case rQ:V>>>=U&7,U-=U&7;while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>16^65535)){$.msg="invalid stored block lengths",Q.mode=x0;break}if(Q.length=V&65535,V=0,U=0,Q.mode=_4,q===l8)break $;case _4:Q.mode=sQ;case sQ:if(M=Q.length,M){if(M>W)M=W;if(M>B)M=B;if(M===0)break $;U2.arraySet(J,K,Z,M,G),W-=M,Z+=M,B-=M,G+=M,Q.length-=M;break}Q.mode=p2;break;case tQ:while(U<14){if(W===0)break $;W--,V+=K[Z++]<>>=5,U-=5,Q.ndist=(V&31)+1,V>>>=5,U-=5,Q.ncode=(V&15)+4,V>>>=4,U-=4,Q.nlen>286||Q.ndist>30){$.msg="too many length or distance symbols",Q.mode=x0;break}Q.have=0,Q.mode=eQ;case eQ:while(Q.have>>=3,U-=3}while(Q.have<19)Q.lens[g[Q.have++]]=0;if(Q.lencode=Q.lendyn,Q.lenbits=7,X={bits:Q.lenbits},d=q8(uZ,Q.lens,0,19,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid code lengths set",Q.mode=x0;break}Q.have=0,Q.mode=$q;case $q:while(Q.have>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=D,U-=D,Q.lens[Q.have++]=N;else{if(N===16){P=D+2;while(U>>=D,U-=D,Q.have===0){$.msg="invalid bit length repeat",Q.mode=x0;break}n=Q.lens[Q.have-1],M=3+(V&3),V>>>=2,U-=2}else if(N===17){P=D+3;while(U>>=D,U-=D,n=0,M=3+(V&7),V>>>=3,U-=3}else{P=D+7;while(U>>=D,U-=D,n=0,M=11+(V&127),V>>>=7,U-=7}if(Q.have+M>Q.nlen+Q.ndist){$.msg="invalid bit length repeat",Q.mode=x0;break}while(M--)Q.lens[Q.have++]=n}}if(Q.mode===x0)break;if(Q.lens[256]===0){$.msg="invalid code -- missing end-of-block",Q.mode=x0;break}if(Q.lenbits=9,X={bits:Q.lenbits},d=q8(Bq,Q.lens,0,Q.nlen,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid literal/lengths set",Q.mode=x0;break}if(Q.distbits=6,Q.distcode=Q.distdyn,X={bits:Q.distbits},d=q8(zq,Q.lens,Q.nlen,Q.ndist,Q.distcode,0,Q.work,X),Q.distbits=X.bits,d){$.msg="invalid distances set",Q.mode=x0;break}if(Q.mode=r8,q===l8)break $;case r8:Q.mode=s8;case s8:if(W>=6&&B>=258){if($.next_out=G,$.avail_out=B,$.next_in=Z,$.avail_in=W,Q.hold=V,Q.bits=U,TZ($,F),G=$.next_out,J=$.output,B=$.avail_out,Z=$.next_in,K=$.input,W=$.avail_in,V=Q.hold,U=Q.bits,Q.mode===p2)Q.back=-1;break}Q.back=0;for(;;){if(L=Q.lencode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,Q.length=N,z===0){Q.mode=Vq;break}if(z&32){Q.back=-1,Q.mode=p2;break}if(z&64){$.msg="invalid literal/length code",Q.mode=x0;break}Q.extra=z&15,Q.mode=Qq;case Qq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}Q.was=Q.length,Q.mode=qq;case qq:for(;;){if(L=Q.distcode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,z&64){$.msg="invalid distance code",Q.mode=x0;break}Q.offset=N,Q.extra=z&15,Q.mode=Kq;case Kq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}if(Q.offset>Q.dmax){$.msg="invalid distance too far back",Q.mode=x0;break}Q.mode=Jq;case Jq:if(B===0)break $;if(M=F-B,Q.offset>M){if(M=Q.offset-M,M>Q.whave){if(Q.sane){$.msg="invalid distance too far back",Q.mode=x0;break}}if(M>Q.wnext)M-=Q.wnext,k=Q.wsize-M;else k=Q.wnext-M;if(M>Q.length)M=Q.length;f=Q.window}else f=J,k=G-Q.offset,M=Q.length;if(M>B)M=B;B-=M,Q.length-=M;do J[G++]=f[k++];while(--M);if(Q.length===0)Q.mode=s8;break;case Vq:if(B===0)break $;J[G++]=Q.length,B--,Q.mode=s8;break;case c4:if(Q.wrap){while(U<32){if(W===0)break $;W--,V|=K[Z++]<{Hq.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var fq=N0((iz,vq)=>{function eZ(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}vq.exports=eZ});var Iq=N0((J8)=>{var B6=Lq(),K8=d2(),e8=h4(),E0=i4(),o4=c8(),$G=x4(),QG=fq(),Rq=Object.prototype.toString;function A1($){if(!(this instanceof A1))return new A1($);this.options=K8.assign({chunkSize:16384,windowBits:0,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>=0&&q.windowBits<16){if(q.windowBits=-q.windowBits,q.windowBits===0)q.windowBits=-15}if(q.windowBits>=0&&q.windowBits<16&&!($&&$.windowBits))q.windowBits+=32;if(q.windowBits>15&&q.windowBits<48){if((q.windowBits&15)===0)q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $G,this.strm.avail_out=0;var Q=B6.inflateInit2(this.strm,q.windowBits);if(Q!==E0.Z_OK)throw Error(o4[Q]);if(this.header=new QG,B6.inflateGetHeader(this.strm,this.header),q.dictionary){if(typeof q.dictionary==="string")q.dictionary=e8.string2buf(q.dictionary);else if(Rq.call(q.dictionary)==="[object ArrayBuffer]")q.dictionary=new Uint8Array(q.dictionary);if(q.raw){if(Q=B6.inflateSetDictionary(this.strm,q.dictionary),Q!==E0.Z_OK)throw Error(o4[Q])}}}A1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J=this.options.dictionary,Z,G,W,B,V,U=!1;if(this.ended)return!1;if(G=q===~~q?q:q===!0?E0.Z_FINISH:E0.Z_NO_FLUSH,typeof $==="string")Q.input=e8.binstring2buf($);else if(Rq.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new K8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(Z=B6.inflate(Q,E0.Z_NO_FLUSH),Z===E0.Z_NEED_DICT&&J)Z=B6.inflateSetDictionary(this.strm,J);if(Z===E0.Z_BUF_ERROR&&U===!0)Z=E0.Z_OK,U=!1;if(Z!==E0.Z_STREAM_END&&Z!==E0.Z_OK)return this.onEnd(Z),this.ended=!0,!1;if(Q.next_out){if(Q.avail_out===0||Z===E0.Z_STREAM_END||Q.avail_in===0&&(G===E0.Z_FINISH||G===E0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(W=e8.utf8border(Q.output,Q.next_out),B=Q.next_out-W,V=e8.buf2string(Q.output,W),Q.next_out=B,Q.avail_out=K-B,B)K8.arraySet(Q.output,Q.output,W,B,0);this.onData(V)}else this.onData(K8.shrinkBuf(Q.output,Q.next_out))}if(Q.avail_in===0&&Q.avail_out===0)U=!0}while((Q.avail_in>0||Q.avail_out===0)&&Z!==E0.Z_STREAM_END);if(Z===E0.Z_STREAM_END)G=E0.Z_FINISH;if(G===E0.Z_FINISH)return Z=B6.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===E0.Z_OK;if(G===E0.Z_SYNC_FLUSH)return this.onEnd(E0.Z_OK),Q.avail_out=0,!0;return!0};A1.prototype.onData=function($){this.chunks.push($)};A1.prototype.onEnd=function($){if($===E0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=K8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function a4($,q){var Q=new A1(q);if(Q.push($,!0),Q.err)throw Q.msg||o4[Q.err];return Q.result}function qG($,q){return q=q||{},q.raw=!0,a4($,q)}J8.Inflate=A1;J8.inflate=a4;J8.inflateRaw=qG;J8.ungzip=a4});var gq=N0((az,jq)=>{var KG=d2().assign,JG=XQ(),VG=Iq(),UG=i4(),Cq={};KG(Cq,JG,VG,UG);jq.exports=Cq});var Xq=N0((Q5)=>{var ZG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",GG=gq(),Aq=T0(),$5=V2(),WG=ZG?"uint8array":"array";Q5.magic="\b\x00";function X1($,q){$5.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=q,this.meta={}}Aq.inherits(X1,$5);X1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(Aq.transformTo(WG,$.data),!1)};X1.prototype.flush=function(){if($5.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};X1.prototype.cleanUp=function(){$5.prototype.cleanUp.call(this),this._pako=null};X1.prototype._createPako=function(){this._pako=new GG[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(q){$.push({data:q,meta:$.meta})}};Q5.compressWorker=function($){return new X1("Deflate",$)};Q5.uncompressWorker=function(){return new X1("Inflate",{})}});var r4=N0((l4)=>{var yq=V2();l4.STORE={magic:"\x00\x00",compressWorker:function(){return new yq("STORE compression")},uncompressWorker:function(){return new yq("STORE decompression")}};l4.DEFLATE=Xq()});var s4=N0((y1)=>{y1.LOCAL_FILE_HEADER="PK\x03\x04";y1.CENTRAL_FILE_HEADER="PK\x01\x02";y1.CENTRAL_DIRECTORY_END="PK\x05\x06";y1.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";y1.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";y1.DATA_DESCRIPTOR="PK\x07\b"});var Pq=N0((tz,Oq)=>{var z6=T0(),F6=V2(),t4=e1(),hq=u8(),q5=s4(),A0=function($,q){var Q="",K;for(K=0;K>>8;return Q},BG=function($,q){var Q=$;if(!$)Q=q?16893:33204;return(Q&65535)<<16},zG=function($){return($||0)&63},xq=function($,q,Q,K,J,Z){var{file:G,compression:W}=$,B=Z!==t4.utf8encode,V=z6.transformTo("string",Z(G.name)),U=z6.transformTo("string",t4.utf8encode(G.name)),w=G.comment,F=z6.transformTo("string",Z(w)),M=z6.transformTo("string",t4.utf8encode(w)),k=U.length!==G.name.length,f=M.length!==w.length,L,D,z="",N="",H="",v=G.dir,j=G.date,n={crc32:0,compressedSize:0,uncompressedSize:0};if(!q||Q)n.crc32=$.crc32,n.compressedSize=$.compressedSize,n.uncompressedSize=$.uncompressedSize;var d=0;if(q)d|=8;if(!B&&(k||f))d|=2048;var _=0,X=0;if(v)_|=16;if(J==="UNIX")X=798,_|=BG(G.unixPermissions,v);else X=20,_|=zG(G.dosPermissions,v);if(L=j.getUTCHours(),L=L<<6,L=L|j.getUTCMinutes(),L=L<<5,L=L|j.getUTCSeconds()/2,D=j.getUTCFullYear()-1980,D=D<<4,D=D|j.getUTCMonth()+1,D=D<<5,D=D|j.getUTCDate(),k)N=A0(1,1)+A0(hq(V),4)+U,z+="up"+A0(N.length,2)+N;if(f)H=A0(1,1)+A0(hq(F),4)+M,z+="uc"+A0(H.length,2)+H;var P="";P+=` -\x00`,P+=A0(d,2),P+=W.magic,P+=A0(L,2),P+=A0(D,2),P+=A0(n.crc32,4),P+=A0(n.compressedSize,4),P+=A0(n.uncompressedSize,4),P+=A0(V.length,2),P+=A0(z.length,2);var g=q5.LOCAL_FILE_HEADER+P+V+z,c=q5.CENTRAL_FILE_HEADER+A0(X,2)+P+A0(F.length,2)+"\x00\x00\x00\x00"+A0(_,4)+A0(K,4)+V+z+F;return{fileRecord:g,dirRecord:c}},FG=function($,q,Q,K,J){var Z="",G=z6.transformTo("string",J(K));return Z=q5.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+A0($,2)+A0($,2)+A0(q,4)+A0(Q,4)+A0(G.length,2)+G,Z},MG=function($){var q="";return q=q5.DATA_DESCRIPTOR+A0($.crc32,4)+A0($.compressedSize,4)+A0($.uncompressedSize,4),q};function v2($,q,Q,K){F6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=q,this.zipPlatform=Q,this.encodeFileName=K,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}z6.inherits(v2,F6);v2.prototype.push=function($){var q=$.meta.percent||0,Q=this.entriesCount,K=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,F6.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:Q?(q+100*(Q-K-1))/Q:100}})};v2.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var q=this.streamFiles&&!$.file.dir;if(q){var Q=xq($,q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:Q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};v2.prototype.closedSource=function($){this.accumulate=!1;var q=this.streamFiles&&!$.file.dir,Q=xq($,q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(Q.dirRecord),q)this.push({data:MG($),meta:{percent:100}});else{this.push({data:Q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};v2.prototype.flush=function(){var $=this.bytesWritten;for(var q=0;q{var wG=r4(),NG=Pq(),YG=function($,q){var Q=$||q,K=wG[Q];if(!K)throw Error(Q+" is not a valid compression method !");return K};Tq.generateWorker=function($,q,Q){var K=new NG(q.streamFiles,Q,q.platform,q.encodeFileName),J=0;try{$.forEach(function(Z,G){J++;var W=YG(G.options.compression,q.compression),B=G.options.compressionOptions||q.compressionOptions||{},V=G.dir,U=G.date;G._compressWorker(W,B).withStreamInfo("file",{name:Z,dir:V,date:U,comment:G.comment||"",unixPermissions:G.unixPermissions,dosPermissions:G.dosPermissions}).pipe(K)}),K.entriesCount=J}catch(Z){K.error(Z)}return K}});var Eq=N0(($F,Sq)=>{var kG=T0(),K5=V2();function V8($,q){K5.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(q)}kG.inherits(V8,K5);V8.prototype._bindStream=function($){var q=this;this._stream=$,$.pause(),$.on("data",function(Q){q.push({data:Q,meta:{percent:0}})}).on("error",function(Q){if(q.isPaused)this.generatedError=Q;else q.error(Q)}).on("end",function(){if(q.isPaused)q._upstreamEnded=!0;else q.end()})};V8.prototype.pause=function(){if(!K5.prototype.pause.call(this))return!1;return this._stream.pause(),!0};V8.prototype.resume=function(){if(!K5.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};Sq.exports=V8});var aq=N0((QF,oq)=>{var DG=e1(),U8=T0(),nq=V2(),LG=K4(),dq=J4(),_q=S8(),HG=c$(),vG=uq(),cq=T6(),fG=Eq(),mq=function($,q,Q){var K=U8.getTypeOf(q),J,Z=U8.extend(Q||{},dq);if(Z.date=Z.date||new Date,Z.compression!==null)Z.compression=Z.compression.toUpperCase();if(typeof Z.unixPermissions==="string")Z.unixPermissions=parseInt(Z.unixPermissions,8);if(Z.unixPermissions&&Z.unixPermissions&16384)Z.dir=!0;if(Z.dosPermissions&&Z.dosPermissions&16)Z.dir=!0;if(Z.dir)$=pq($);if(Z.createFolders&&(J=RG($)))iq.call(this,J,!0);var G=K==="string"&&Z.binary===!1&&Z.base64===!1;if(!Q||typeof Q.binary>"u")Z.binary=!G;var W=q instanceof _q&&q.uncompressedSize===0;if(W||Z.dir||!q||q.length===0)Z.base64=!1,Z.binary=!0,q="",Z.compression="STORE",K="string";var B=null;if(q instanceof _q||q instanceof nq)B=q;else if(cq.isNode&&cq.isStream(q))B=new fG($,q);else B=U8.prepareContent($,q,Z.binary,Z.optimizedBinaryString,Z.base64);var V=new HG($,B,Z);this.files[$]=V},RG=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var q=$.lastIndexOf("/");return q>0?$.substring(0,q):""},pq=function($){if($.slice(-1)!=="/")$+="/";return $},iq=function($,q){if(q=typeof q<"u"?q:dq.createFolders,$=pq($),!this.files[$])mq.call(this,$,null,{dir:!0,createFolders:q});return this.files[$]};function bq($){return Object.prototype.toString.call($)==="[object RegExp]"}var IG={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var q,Q,K;for(q in this.files)if(K=this.files[q],Q=q.slice(this.root.length,q.length),Q&&q.slice(0,this.root.length)===this.root)$(Q,K)},filter:function($){var q=[];return this.forEach(function(Q,K){if($(Q,K))q.push(K)}),q},file:function($,q,Q){if(arguments.length===1)if(bq($)){var K=$;return this.filter(function(Z,G){return!G.dir&&K.test(Z)})}else{var J=this.files[this.root+$];if(J&&!J.dir)return J;else return null}else $=this.root+$,mq.call(this,$,q,Q);return this},folder:function($){if(!$)return this;if(bq($))return this.filter(function(J,Z){return Z.dir&&$.test(J)});var q=this.root+$,Q=iq.call(this,q),K=this.clone();return K.root=Q.name,K},remove:function($){$=this.root+$;var q=this.files[$];if(!q){if($.slice(-1)!=="/")$+="/";q=this.files[$]}if(q&&!q.dir)delete this.files[$];else{var Q=this.filter(function(J,Z){return Z.name.slice(0,$.length)===$});for(var K=0;K{var CG=T0();function lq($){this.data=$,this.length=$.length,this.index=0,this.zero=0}lq.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length=this.index;Q--)q=(q<<8)+this.byteAt(Q);return this.index+=$,q},readString:function($){return CG.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};rq.exports=lq});var $7=N0((KF,tq)=>{var sq=e4(),jG=T0();function M6($){sq.call(this,$);for(var q=0;q=0;--Z)if(this.data[Z]===q&&this.data[Z+1]===Q&&this.data[Z+2]===K&&this.data[Z+3]===J)return Z-this.zero;return-1};M6.prototype.readAndCheckSignature=function($){var q=$.charCodeAt(0),Q=$.charCodeAt(1),K=$.charCodeAt(2),J=$.charCodeAt(3),Z=this.readData(4);return q===Z[0]&&Q===Z[1]&&K===Z[2]&&J===Z[3]};M6.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};tq.exports=M6});var QK=N0((JF,$K)=>{var eq=e4(),gG=T0();function w6($){eq.call(this,$)}gG.inherits(w6,eq);w6.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};w6.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};w6.prototype.readAndCheckSignature=function($){var q=this.readData(4);return $===q};w6.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};$K.exports=w6});var q7=N0((VF,KK)=>{var qK=$7(),AG=T0();function Q7($){qK.call(this,$)}AG.inherits(Q7,qK);Q7.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};KK.exports=Q7});var UK=N0((UF,VK)=>{var JK=q7(),XG=T0();function K7($){JK.call(this,$)}XG.inherits(K7,JK);K7.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};VK.exports=K7});var J7=N0((ZF,GK)=>{var J5=T0(),ZK=n2(),yG=$7(),hG=QK(),xG=UK(),OG=q7();GK.exports=function($){var q=J5.getTypeOf($);if(J5.checkSupport(q),q==="string"&&!ZK.uint8array)return new hG($);if(q==="nodebuffer")return new xG($);if(ZK.uint8array)return new OG(J5.transformTo("uint8array",$));return new yG(J5.transformTo("array",$))}});var FK=N0((GF,zK)=>{var V7=J7(),G1=T0(),PG=S8(),WK=u8(),V5=e1(),U5=r4(),TG=n2(),uG=0,SG=3,EG=function($){for(var q in U5){if(!Object.prototype.hasOwnProperty.call(U5,q))continue;if(U5[q].magic===$)return U5[q]}return null};function BK($,q){this.options=$,this.loadOptions=q}BK.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var q,Q;if($.skip(22),this.fileNameLength=$.readInt(2),Q=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(Q),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(q=EG(this.compressionMethod),q===null)throw Error("Corrupted zip : compression "+G1.pretty(this.compressionMethod)+" unknown (inner file : "+G1.transformTo("string",this.fileName)+")");this.decompressed=new PG(this.compressedSize,this.uncompressedSize,this.crc32,q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===uG)this.dosPermissions=this.externalFileAttributes&63;if($===SG)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=V7(this.extraFields[1].value);if(this.uncompressedSize===G1.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G1.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G1.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G1.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var q=$.index+this.extraFieldsLength,Q,K,J;if(!this.extraFields)this.extraFields={};while($.index+4{var _G=J7(),i2=T0(),f2=s4(),cG=FK(),bG=n2();function MK($){this.files=[],this.loadOptions=$}MK.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+i2.pretty(q)+", expected "+i2.pretty($)+")")}},isSignature:function($,q){var Q=this.reader.index;this.reader.setIndex($);var K=this.reader.readString(4),J=K===q;return this.reader.setIndex(Q),J},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),q=bG.uint8array?"uint8array":"array",Q=i2.transformTo(q,$);this.zipComment=this.loadOptions.decodeFileName(Q)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,q=0,Q,K,J;while(q<$)Q=this.reader.readInt(2),K=this.reader.readInt(4),J=this.reader.readData(K),this.zip64ExtensibleData[Q]={id:Q,length:K,value:J}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,q;for($=0;$0)if(this.isSignature(Q,f2.CENTRAL_FILE_HEADER));else this.reader.zero=J;else if(J<0)throw Error("Corrupted zip: missing "+Math.abs(J)+" bytes.")},prepareReader:function($){this.reader=_G($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};wK.exports=MK});var DK=N0((BF,kK)=>{var U7=T0(),Z5=r1(),nG=e1(),dG=NK(),mG=Z4(),YK=T6();function pG($){return new Z5.Promise(function(q,Q){var K=$.decompressed.getContentWorker().pipe(new mG);K.on("error",function(J){Q(J)}).on("end",function(){if(K.streamInfo.crc32!==$.decompressed.crc32)Q(Error("Corrupted zip : CRC32 mismatch"));else q()}).resume()})}kK.exports=function($,q){var Q=this;if(q=U7.extend(q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:nG.utf8decode}),YK.isNode&&YK.isStream($))return Z5.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return U7.prepareContent("the loaded zip file",$,!0,q.optimizedBinaryString,q.base64).then(function(K){var J=new dG(q);return J.load(K),J}).then(function(J){var Z=[Z5.Promise.resolve(J)],G=J.files;if(q.checkCRC32)for(var W=0;W{function Y2(){if(!(this instanceof Y2))return new Y2;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new Y2;for(var q in this)if(typeof this[q]!=="function")$[q]=this[q];return $}}Y2.prototype=aq();Y2.prototype.loadAsync=DK();Y2.support=n2();Y2.defaults=J4();Y2.version="3.10.1";Y2.loadAsync=function($,q){return new Y2().loadAsync($,q)};Y2.external=r1();LK.exports=Y2});var Z8={};c1(Z8,{types:()=>QW,promisify:()=>jK,log:()=>RK,isUndefined:()=>N6,isSymbol:()=>KW,isString:()=>M5,isRegExp:()=>G5,isPrimitive:()=>JW,isObject:()=>Y6,isNumber:()=>fK,isNullOrUndefined:()=>qW,isNull:()=>F5,isFunction:()=>B5,isError:()=>W5,isDate:()=>B7,isBuffer:()=>VW,isBoolean:()=>F7,isArray:()=>vK,inspect:()=>h1,inherits:()=>IK,format:()=>z7,deprecate:()=>oG,default:()=>GW,debuglog:()=>aG,callbackifyOnRejected:()=>N7,callbackify:()=>gK,_extend:()=>w7,TextEncoder:()=>AK,TextDecoder:()=>XK});function z7($,...q){if(!M5($)){var Q=[$];for(var K=0;K=J)return W;switch(W){case"%s":return String(q[K++]);case"%d":return Number(q[K++]);case"%j":try{return JSON.stringify(q[K++])}catch(B){return"[Circular]"}default:return W}});for(var G=q[K];K"u"||process?.noDeprecation===!0)return $;var Q=!1;function K(...J){if(!Q){if(process.throwDeprecation)throw Error(q);else if(process.traceDeprecation)console.trace(q);else console.error(q);Q=!0}return $.apply(this,...J)}return K}function lG($,q){var Q=h1.styles[q];if(Q)return"\x1B["+h1.colors[Q][0]+"m"+$+"\x1B["+h1.colors[Q][1]+"m";else return $}function rG($,q){return $}function sG($){var q={};return $.forEach(function(Q,K){q[Q]=!0}),q}function z5($,q,Q){if($.customInspect&&q&&B5(q.inspect)&&q.inspect!==h1&&!(q.constructor&&q.constructor.prototype===q)){var K=q.inspect(Q,$);if(!M5(K))K=z5($,K,Q);return K}var J=tG($,q);if(J)return J;var Z=Object.keys(q),G=sG(Z);if($.showHidden)Z=Object.getOwnPropertyNames(q);if(W5(q)&&(Z.indexOf("message")>=0||Z.indexOf("description")>=0))return Z7(q);if(Z.length===0){if(B5(q)){var W=q.name?": "+q.name:"";return $.stylize("[Function"+W+"]","special")}if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");if(B7(q))return $.stylize(Date.prototype.toString.call(q),"date");if(W5(q))return Z7(q)}var B="",V=!1,U=["{","}"];if(vK(q))V=!0,U=["[","]"];if(B5(q)){var w=q.name?": "+q.name:"";B=" [Function"+w+"]"}if(G5(q))B=" "+RegExp.prototype.toString.call(q);if(B7(q))B=" "+Date.prototype.toUTCString.call(q);if(W5(q))B=" "+Z7(q);if(Z.length===0&&(!V||q.length==0))return U[0]+B+U[1];if(Q<0)if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");else return $.stylize("[Object]","special");$.seen.push(q);var F;if(V)F=eG($,q,Q,G,Z);else F=Z.map(function(M){return W7($,q,Q,G,M,V)});return $.seen.pop(),$W(F,B,U)}function tG($,q){if(N6(q))return $.stylize("undefined","undefined");if(M5(q)){var Q="'"+JSON.stringify(q).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(Q,"string")}if(fK(q))return $.stylize(""+q,"number");if(F7(q))return $.stylize(""+q,"boolean");if(F5(q))return $.stylize("null","null")}function Z7($){return"["+Error.prototype.toString.call($)+"]"}function eG($,q,Q,K,J){var Z=[];for(var G=0,W=q.length;G{var fJ=Object.create;var{getPrototypeOf:RJ,defineProperty:X6,getOwnPropertyNames:Q9,getOwnPropertyDescriptor:IJ}=Object,q9=Object.prototype.hasOwnProperty;function K9($){return this[$]}var CJ,jJ,J9=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?CJ??=new WeakMap:jJ??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?fJ(RJ($)):{};let G=q||!$||!$.__esModule?X6(Q,"default",{value:$,enumerable:!0}):Q;for(let W of Q9($))if(!q9.call(G,W))X6(G,W,{get:K9.bind($,W),enumerable:!0});if(K)J.set($,G);return G},X0=($)=>{var q=($9??=new WeakMap).get($),Q;if(q)return q;if(q=X6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var K of Q9($))if(!q9.call(q,K))X6(q,K,{get:K9.bind($,K),enumerable:!(Q=IJ($,K))||Q.enumerable})}return $9.set($,q),q},$9,N0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var gJ=($)=>$;function AJ($,q){this[$]=gJ.bind(null,q)}var c1=($,q)=>{for(var Q in q)X6($,Q,{get:q[Q],enumerable:!0,configurable:!0,set:AJ.bind(q,Q)})};var b1=($,q)=>()=>($&&(q=$($=0)),q);var V9=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(q,Q)=>(typeof require<"u"?require:q)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var K2={};c1(K2,{transcode:()=>MV,resolveObjectURL:()=>BV,kStringMaxLength:()=>w9,kMaxLength:()=>y6,isUtf8:()=>zV,isAscii:()=>FV,default:()=>wV,constants:()=>EJ,btoa:()=>PJ,atob:()=>TJ,INSPECT_MAX_BYTES:()=>M9,File:()=>uJ,Buffer:()=>o,Blob:()=>SJ});function XJ($){var q=$.length;if(q%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=$.indexOf("=");if(Q===-1)Q=q;var K=Q===q?0:4-Q%4;return[Q,K]}function yJ($,q){return($+q)*3/4-q}function hJ($){var q,Q=XJ($),K=Q[0],J=Q[1],Z=new Uint8Array(yJ(K,J)),G=0,W=J>0?K-4:K,B;for(B=0;B>16&255,Z[G++]=q>>8&255,Z[G++]=q&255;if(J===2)q=F2[$.charCodeAt(B)]<<2|F2[$.charCodeAt(B+1)]>>4,Z[G++]=q&255;if(J===1)q=F2[$.charCodeAt(B)]<<10|F2[$.charCodeAt(B+1)]<<4|F2[$.charCodeAt(B+2)]>>2,Z[G++]=q>>8&255,Z[G++]=q&255;return Z}function xJ($){return I2[$>>18&63]+I2[$>>12&63]+I2[$>>6&63]+I2[$&63]}function OJ($,q,Q){var K,J=[];for(var Z=q;ZW?W:G+Z));if(K===1)q=$[Q-1],J.push(I2[q>>2]+I2[q<<4&63]+"==");else if(K===2)q=($[Q-2]<<8)+$[Q-1],J.push(I2[q>>10]+I2[q>>4&63]+I2[q<<2&63]+"=");return J.join("")}function Y8($,q,Q,K,J){var Z,G,W=J*8-K-1,B=(1<>1,U=-7,w=Q?J-1:0,F=Q?-1:1,M=$[q+w];w+=F,Z=M&(1<<-U)-1,M>>=-U,U+=W;for(;U>0;Z=Z*256+$[q+w],w+=F,U-=8);G=Z&(1<<-U)-1,Z>>=-U,U+=K;for(;U>0;G=G*256+$[q+w],w+=F,U-=8);if(Z===0)Z=1-V;else if(Z===B)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,K),Z=Z-V;return(M?-1:1)*G*Math.pow(2,Z-K)}function F9($,q,Q,K,J,Z){var G,W,B,V=Z*8-J-1,U=(1<>1,F=J===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:Z-1,k=K?1:-1,f=q<0||q===0&&1/q<0?1:0;if(q=Math.abs(q),isNaN(q)||q===1/0)W=isNaN(q)?1:0,G=U;else{if(G=Math.floor(Math.log(q)/Math.LN2),q*(B=Math.pow(2,-G))<1)G--,B*=2;if(G+w>=1)q+=F/B;else q+=F*Math.pow(2,1-w);if(q*B>=2)G++,B/=2;if(G+w>=U)W=0,G=U;else if(G+w>=1)W=(q*B-1)*Math.pow(2,J),G=G+w;else W=q*Math.pow(2,w-1)*Math.pow(2,J),G=0}for(;J>=8;$[Q+M]=W&255,M+=k,W/=256,J-=8);G=G<0;$[Q+M]=G&255,M+=k,G/=256,V-=8);$[Q+M-k]|=f*128}function S2($){if($>y6)throw RangeError('The value "'+$+'" is invalid for option "size"');let q=new Uint8Array($);return Object.setPrototypeOf(q,o.prototype),q}function x5($,q,Q){return class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:q.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}function o($,q,Q){if(typeof $==="number"){if(typeof q==="string")throw TypeError('The "string" argument must be of type string. Received type number');return O5($)}return N9($,q,Q)}function N9($,q,Q){if(typeof $==="string")return nJ($,q);if(ArrayBuffer.isView($))return dJ($);if($==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(C2($,ArrayBuffer)||$&&C2($.buffer,ArrayBuffer))return y5($,q,Q);if(typeof SharedArrayBuffer<"u"&&(C2($,SharedArrayBuffer)||$&&C2($.buffer,SharedArrayBuffer)))return y5($,q,Q);if(typeof $==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=$.valueOf&&$.valueOf();if(K!=null&&K!==$)return o.from(K,q,Q);let J=mJ($);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]==="function")return o.from($[Symbol.toPrimitive]("string"),q,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}function Y9($){if(typeof $!=="number")throw TypeError('"size" argument must be of type number');else if($<0)throw RangeError('The value "'+$+'" is invalid for option "size"')}function bJ($,q,Q){if(Y9($),$<=0)return S2($);if(q!==void 0)return typeof Q==="string"?S2($).fill(q,Q):S2($).fill(q);return S2($)}function O5($){return Y9($),S2($<0?0:P5($)|0)}function nJ($,q){if(typeof q!=="string"||q==="")q="utf8";if(!o.isEncoding(q))throw TypeError("Unknown encoding: "+q);let Q=k9($,q)|0,K=S2(Q),J=K.write($,q);if(J!==Q)K=K.slice(0,J);return K}function X5($){let q=$.length<0?0:P5($.length)|0,Q=S2(q);for(let K=0;K=y6)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y6.toString(16)+" bytes");return $|0}function k9($,q){if(o.isBuffer($))return $.length;if(ArrayBuffer.isView($)||C2($,ArrayBuffer))return $.byteLength;if(typeof $!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let Q=$.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&Q===0)return 0;let J=!1;for(;;)switch(q){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return h5($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return j9($).length;default:if(J)return K?-1:h5($).length;q=(""+q).toLowerCase(),J=!0}}function pJ($,q,Q){let K=!1;if(q===void 0||q<0)q=0;if(q>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,q>>>=0,Q<=q)return"";if(!$)$="utf8";while(!0)switch($){case"hex":return QV(this,q,Q);case"utf8":case"utf-8":return L9(this,q,Q);case"ascii":return eJ(this,q,Q);case"latin1":case"binary":return $V(this,q,Q);case"base64":return sJ(this,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qV(this,q,Q);default:if(K)throw TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),K=!0}}function w1($,q,Q){let K=$[q];$[q]=$[Q],$[Q]=K}function D9($,q,Q,K,J){if($.length===0)return-1;if(typeof Q==="string")K=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,Number.isNaN(Q))Q=J?0:$.length-1;if(Q<0)Q=$.length+Q;if(Q>=$.length)if(J)return-1;else Q=$.length-1;else if(Q<0)if(J)Q=0;else return-1;if(typeof q==="string")q=o.from(q,K);if(o.isBuffer(q)){if(q.length===0)return-1;return W9($,q,Q,K,J)}else if(typeof q==="number"){if(q=q&255,typeof Uint8Array.prototype.indexOf==="function")if(J)return Uint8Array.prototype.indexOf.call($,q,Q);else return Uint8Array.prototype.lastIndexOf.call($,q,Q);return W9($,[q],Q,K,J)}throw TypeError("val must be string, number or Buffer")}function W9($,q,Q,K,J){let Z=1,G=$.length,W=q.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if($.length<2||q.length<2)return-1;Z=2,G/=2,W/=2,Q/=2}}function B(U,w){if(Z===1)return U[w];else return U.readUInt16BE(w*Z)}let V;if(J){let U=-1;for(V=Q;VG)Q=G-W;for(V=Q;V>=0;V--){let U=!0;for(let w=0;wJ)K=J;let Z=q.length;if(K>Z/2)K=Z/2;let G;for(G=0;G239?4:Z>223?3:Z>191?2:1;if(J+W<=Q){let B,V,U,w;switch(W){case 1:if(Z<128)G=Z;break;case 2:if(B=$[J+1],(B&192)===128){if(w=(Z&31)<<6|B&63,w>127)G=w}break;case 3:if(B=$[J+1],V=$[J+2],(B&192)===128&&(V&192)===128){if(w=(Z&15)<<12|(B&63)<<6|V&63,w>2047&&(w<55296||w>57343))G=w}break;case 4:if(B=$[J+1],V=$[J+2],U=$[J+3],(B&192)===128&&(V&192)===128&&(U&192)===128){if(w=(Z&15)<<18|(B&63)<<12|(V&63)<<6|U&63,w>65535&&w<1114112)G=w}}}if(G===null)G=65533,W=1;else if(G>65535)G-=65536,K.push(G>>>10&1023|55296),G=56320|G&1023;K.push(G),J+=W}return tJ(K)}function tJ($){let q=$.length;if(q<=B9)return String.fromCharCode.apply(String,$);let Q="",K=0;while(KK)Q=K;let J="";for(let Z=q;ZQ)throw RangeError("Trying to access beyond buffer length")}function s0($,q,Q,K,J,Z){if(!o.isBuffer($))throw TypeError('"buffer" argument must be a Buffer instance');if(q>J||q$.length)throw RangeError("Index out of range")}function H9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,Q}function v9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q+7]=Z,Z=Z>>8,$[Q+6]=Z,Z=Z>>8,$[Q+5]=Z,Z=Z>>8,$[Q+4]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q+3]=G,G=G>>8,$[Q+2]=G,G=G>>8,$[Q+1]=G,G=G>>8,$[Q]=G,Q+8}function f9($,q,Q,K,J,Z){if(Q+K>$.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function R9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return F9($,q,Q,K,23,4),Q+4}function I9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return F9($,q,Q,K,52,8),Q+8}function z9($){let q="",Q=$.length,K=$[0]==="-"?1:0;for(;Q>=K+4;Q-=3)q=`_${$.slice(Q-3,Q)}${q}`;return`${$.slice(0,Q)}${q}`}function KV($,q,Q){if(n1(q,"offset"),$[q]===void 0||$[q+Q]===void 0)h6(q,$.length-(Q+1))}function C9($,q,Q,K,J,Z){if($>Q||$3)if(q===0||q===BigInt(0))W=`>= 0${G} and < 2${G} ** ${(Z+1)*8}${G}`;else W=`>= -(2${G} ** ${(Z+1)*8-1}${G}) and < 2 ** ${(Z+1)*8-1}${G}`;else W=`>= ${q}${G} and <= ${Q}${G}`;throw new A5("value",W,$)}KV(K,J,Z)}function n1($,q){if(typeof $!=="number")throw new cJ(q,"number",$)}function h6($,q,Q){if(Math.floor($)!==$)throw n1($,Q),new A5(Q||"offset","an integer",$);if(q<0)throw new _J;throw new A5(Q||"offset",`>= ${Q?1:0} and <= ${q}`,$)}function VV($){if($=$.split("=")[0],$=$.trim().replace(JV,""),$.length<2)return"";while($.length%4!==0)$=$+"=";return $}function h5($,q){q=q||1/0;let Q,K=$.length,J=null,Z=[];for(let G=0;G55295&&Q<57344){if(!J){if(Q>56319){if((q-=3)>-1)Z.push(239,191,189);continue}else if(G+1===K){if((q-=3)>-1)Z.push(239,191,189);continue}J=Q;continue}if(Q<56320){if((q-=3)>-1)Z.push(239,191,189);J=Q;continue}Q=(J-55296<<10|Q-56320)+65536}else if(J){if((q-=3)>-1)Z.push(239,191,189)}if(J=null,Q<128){if((q-=1)<0)break;Z.push(Q)}else if(Q<2048){if((q-=2)<0)break;Z.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((q-=3)<0)break;Z.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((q-=4)<0)break;Z.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return Z}function UV($){let q=[];for(let Q=0;Q<$.length;++Q)q.push($.charCodeAt(Q)&255);return q}function ZV($,q){let Q,K,J,Z=[];for(let G=0;G<$.length;++G){if((q-=2)<0)break;Q=$.charCodeAt(G),K=Q>>8,J=Q%256,Z.push(J),Z.push(K)}return Z}function j9($){return hJ(VV($))}function k8($,q,Q,K){let J;for(J=0;J=q.length||J>=$.length)break;q[J+Q]=$[J]}return J}function C2($,q){return $ instanceof q||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===q.name}function l2($){return typeof BigInt>"u"?WV:$}function WV(){throw Error("BigInt not supported")}function T5($){return()=>{throw Error($+" is not implemented for node:buffer browser polyfill")}}var I2,F2,g5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M1,U9,G9,M9=50,y6=2147483647,w9=536870888,PJ,TJ,uJ,SJ,EJ,_J,cJ,A5,B9=4096,JV,GV,BV,zV,FV=($)=>{for(let q of $)if(q.charCodeAt(0)>127)return!1;return!0},MV,wV;var t0=b1(()=>{I2=[],F2=[];for(M1=0,U9=g5.length;M14294967296)J=z9(String(Q));else if(typeof Q==="bigint"){if(J=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))J=z9(J);J+="n"}return K+=` It must be ${q}. Received ${J}`,K},RangeError);Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.buffer}});Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.byteOffset}});o.poolSize=8192;o.from=function($,q,Q){return N9($,q,Q)};Object.setPrototypeOf(o.prototype,Uint8Array.prototype);Object.setPrototypeOf(o,Uint8Array);o.alloc=function($,q,Q){return bJ($,q,Q)};o.allocUnsafe=function($){return O5($)};o.allocUnsafeSlow=function($){return O5($)};o.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==o.prototype};o.compare=function($,q){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(C2(q,Uint8Array))q=o.from(q,q.offset,q.byteLength);if(!o.isBuffer($)||!o.isBuffer(q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===q)return 0;let Q=$.length,K=q.length;for(let J=0,Z=Math.min(Q,K);JK.length){if(!o.isBuffer(Z))Z=o.from(Z);Z.copy(K,J)}else Uint8Array.prototype.set.call(K,Z,J);else if(!o.isBuffer(Z))throw TypeError('"list" argument must be an Array of Buffers');else Z.copy(K,J);J+=Z.length}return K};o.byteLength=k9;o.prototype._isBuffer=!0;o.prototype.swap16=function(){let $=this.length;if($%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let q=0;q<$;q+=2)w1(this,q,q+1);return this};o.prototype.swap32=function(){let $=this.length;if($%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let q=0;q<$;q+=4)w1(this,q,q+3),w1(this,q+1,q+2);return this};o.prototype.swap64=function(){let $=this.length;if($%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let q=0;q<$;q+=8)w1(this,q,q+7),w1(this,q+1,q+6),w1(this,q+2,q+5),w1(this,q+3,q+4);return this};o.prototype.toString=function(){let $=this.length;if($===0)return"";if(arguments.length===0)return L9(this,0,$);return pJ.apply(this,arguments)};o.prototype.toLocaleString=o.prototype.toString;o.prototype.equals=function($){if(!o.isBuffer($))throw TypeError("Argument must be a Buffer");if(this===$)return!0;return o.compare(this,$)===0};o.prototype.inspect=function(){let $="",q=M9;if($=this.toString("hex",0,q).replace(/(.{2})/g,"$1 ").trim(),this.length>q)$+=" ... ";return""};if(G9)o.prototype[G9]=o.prototype.inspect;o.prototype.compare=function($,q,Q,K,J){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(!o.isBuffer($))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(q===void 0)q=0;if(Q===void 0)Q=$?$.length:0;if(K===void 0)K=0;if(J===void 0)J=this.length;if(q<0||Q>$.length||K<0||J>this.length)throw RangeError("out of range index");if(K>=J&&q>=Q)return 0;if(K>=J)return-1;if(q>=Q)return 1;if(q>>>=0,Q>>>=0,K>>>=0,J>>>=0,this===$)return 0;let Z=J-K,G=Q-q,W=Math.min(Z,G),B=this.slice(K,J),V=$.slice(q,Q);for(let U=0;U>>0,isFinite(Q)){if(Q=Q>>>0,K===void 0)K="utf8"}else K=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let J=this.length-q;if(Q===void 0||Q>J)Q=J;if($.length>0&&(Q<0||q<0)||q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let Z=!1;for(;;)switch(K){case"hex":return iJ(this,$,q,Q);case"utf8":case"utf-8":return oJ(this,$,q,Q);case"ascii":case"latin1":case"binary":return aJ(this,$,q,Q);case"base64":return lJ(this,$,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rJ(this,$,q,Q);default:if(Z)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),Z=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};o.prototype.slice=function($,q){let Q=this.length;if($=~~$,q=q===void 0?Q:~~q,$<0){if($+=Q,$<0)$=0}else if($>Q)$=Q;if(q<0){if(q+=Q,q<0)q=0}else if(q>Q)q=Q;if(q<$)q=$;let K=this.subarray($,q);return Object.setPrototypeOf(K,o.prototype),K};o.prototype.readUintLE=o.prototype.readUIntLE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$+--q],J=1;while(q>0&&(J*=256))K+=this[$+--q]*J;return K};o.prototype.readUint8=o.prototype.readUInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);return this[$]};o.prototype.readUint16LE=o.prototype.readUInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]|this[$+1]<<8};o.prototype.readUint16BE=o.prototype.readUInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]<<8|this[$+1]};o.prototype.readUint32LE=o.prototype.readUInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216};o.prototype.readUint32BE=o.prototype.readUInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])};o.prototype.readBigUInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q+this[++$]*256+this[++$]*65536+this[++$]*16777216,J=this[++$]+this[++$]*256+this[++$]*65536+Q*16777216;return BigInt(K)+(BigInt(J)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q*16777216+this[++$]*65536+this[++$]*256+this[++$],J=this[++$]*16777216+this[++$]*65536+this[++$]*256+Q;return(BigInt(K)<>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z=J)K-=Math.pow(2,8*q);return K};o.prototype.readIntBE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=q,J=1,Z=this[$+--K];while(K>0&&(J*=256))Z+=this[$+--K]*J;if(J*=128,Z>=J)Z-=Math.pow(2,8*q);return Z};o.prototype.readInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);if(!(this[$]&128))return this[$];return(255-this[$]+1)*-1};o.prototype.readInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$]|this[$+1]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$+1]|this[$]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24};o.prototype.readInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]};o.prototype.readBigInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=this[$+4]+this[$+5]*256+this[$+6]*65536+(Q<<24);return(BigInt(K)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=(q<<24)+this[++$]*65536+this[++$]*256+this[++$];return(BigInt(K)<>>0,!q)b0($,4,this.length);return Y8(this,$,!0,23,4)};o.prototype.readFloatBE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return Y8(this,$,!1,23,4)};o.prototype.readDoubleLE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!0,52,8)};o.prototype.readDoubleBE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!1,52,8)};o.prototype.writeUintLE=o.prototype.writeUIntLE=function($,q,Q,K){if($=+$,q=q>>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=1,Z=0;this[q]=$&255;while(++Z>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=Q-1,Z=1;this[q+J]=$&255;while(--J>=0&&(Z*=256))this[q+J]=$/Z&255;return q+Q};o.prototype.writeUint8=o.prototype.writeUInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,255,0);return this[q]=$&255,q+1};o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q+3]=$>>>24,this[q+2]=$>>>16,this[q+1]=$>>>8,this[q]=$&255,q+4};o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigUInt64LE=l2(function($,q=0){return H9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeBigUInt64BE=l2(function($,q=0){return v9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeIntLE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=0,Z=1,G=0;this[q]=$&255;while(++J>0)-G&255}return q+Q};o.prototype.writeIntBE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=Q-1,Z=1,G=0;this[q+J]=$&255;while(--J>=0&&(Z*=256)){if($<0&&G===0&&this[q+J+1]!==0)G=1;this[q+J]=($/Z>>0)-G&255}return q+Q};o.prototype.writeInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,127,-128);if($<0)$=255+$+1;return this[q]=$&255,q+1};o.prototype.writeInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);return this[q]=$&255,this[q+1]=$>>>8,this[q+2]=$>>>16,this[q+3]=$>>>24,q+4};o.prototype.writeInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);if($<0)$=4294967295+$+1;return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigInt64LE=l2(function($,q=0){return H9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeBigInt64BE=l2(function($,q=0){return v9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeFloatLE=function($,q,Q){return R9(this,$,q,!0,Q)};o.prototype.writeFloatBE=function($,q,Q){return R9(this,$,q,!1,Q)};o.prototype.writeDoubleLE=function($,q,Q){return I9(this,$,q,!0,Q)};o.prototype.writeDoubleBE=function($,q,Q){return I9(this,$,q,!1,Q)};o.prototype.copy=function($,q,Q,K){if(!o.isBuffer($))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!K&&K!==0)K=this.length;if(q>=$.length)q=$.length;if(!q)q=0;if(K>0&&K=this.length)throw RangeError("Index out of range");if(K<0)throw RangeError("sourceEnd out of bounds");if(K>this.length)K=this.length;if($.length-q>>0,Q=Q===void 0?this.length:Q>>>0,!$)$=0;let J;if(typeof $==="number")for(J=q;J{var S0=y9.exports={},j2,g2;function u5(){throw Error("setTimeout has not been defined")}function S5(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")j2=setTimeout;else j2=u5}catch($){j2=u5}try{if(typeof clearTimeout==="function")g2=clearTimeout;else g2=S5}catch($){g2=S5}})();function g9($){if(j2===setTimeout)return setTimeout($,0);if((j2===u5||!j2)&&setTimeout)return j2=setTimeout,setTimeout($,0);try{return j2($,0)}catch(q){try{return j2.call(null,$,0)}catch(Q){return j2.call(this,$,0)}}}function NV($){if(g2===clearTimeout)return clearTimeout($);if((g2===S5||!g2)&&clearTimeout)return g2=clearTimeout,clearTimeout($);try{return g2($)}catch(q){try{return g2.call(null,$)}catch(Q){return g2.call(this,$)}}}var E2=[],d1=!1,N1,D8=-1;function YV(){if(!d1||!N1)return;if(d1=!1,N1.length)E2=N1.concat(E2);else D8=-1;if(E2.length)A9()}function A9(){if(d1)return;var $=g9(YV);d1=!0;var q=E2.length;while(q){N1=E2,E2=[];while(++D81)for(var Q=1;Qn9,once:()=>c9,listenerCount:()=>d9,init:()=>r2,getMaxListeners:()=>p9,getEventListeners:()=>b9,default:()=>CV,captureRejectionSymbol:()=>u9,addAbortListener:()=>i9,EventEmitter:()=>r2});function S9($,q){var{_events:Q}=$;if(q[0]??=Error("Unhandled error."),!Q)throw q[0];var K=Q[T9];if(K)for(var J of O9.call(K))J.apply($,q);var Z=Q.error;if(!Z)throw q[0];for(var J of O9.call(Z))J.apply($,q);return!0}function LV($,q,Q,K){q.then(void 0,function(J){queueMicrotask(()=>HV($,J,Q,K))})}function HV($,q,Q,K){if(typeof $[x9]==="function")$[x9](q,Q,...K);else try{$[Y1]=!1,$.emit("error",q)}finally{$[Y1]=!0}}function E9($,q,Q){Q.warned=!0;let K=Error(`Possible EventEmitter memory leak detected. ${Q.length} ${String(q)} listeners added to [${$.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=$,K.type=q,K.count=Q.length,console.warn(K)}function _9($,q,...Q){this.removeListener($,q),q.apply(this,Q)}function c9($,q,Q){var K=Q?.signal;if(m9(K,"options.signal"),K?.aborted)throw new E5(void 0,{cause:K?.reason});let{resolve:J,reject:Z,promise:G}=$newPromiseCapability(Promise),W=(U)=>{if($.removeListener(q,B),K!=null)L8(K,"abort",V);Z(U)},B=(...U)=>{if(typeof $.removeListener==="function")$.removeListener("error",W);if(K!=null)L8(K,"abort",V);J(U)};if(P9($,q,B,{once:!0}),q!=="error"&&typeof $.once==="function")$.once("error",W);function V(){L8($,q,B),L8($,"error",W),Z(new E5(void 0,{cause:K?.reason}))}if(K!=null)P9(K,"abort",V,{once:!0});return G}function b9($,q){return $.listeners(q)}function n9($,...q){c5($,"setMaxListeners",0);var Q;if(q&&(Q=q.length))for(let K=0;KK||(Q!=null||K!=null)&&Number.isNaN($))throw RV(q,`${Q!=null?`>= ${Q}`:""}${Q!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,$)}function x6($){if(typeof $!=="function")throw TypeError("The listener must be a function")}function IV($,q){if(typeof $!=="boolean")throw m1(q,"boolean",$)}function p9($){return $?._maxListeners??k1}function i9($,q){if($===void 0)throw m1("signal","AbortSignal",$);if(m9($,"signal"),typeof q!=="function")throw m1("listener","function",q);let Q;if($.aborted)queueMicrotask(()=>q());else $.addEventListener("abort",q,{__proto__:null,once:!0}),Q=()=>{$.removeEventListener("abort",q)};return{__proto__:null,[Symbol.dispose](){Q?.()}}}var _5,Y1,T9,kV,DV,x9,u9,O9,k1=10,r2=function($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[Y1]=$?.captureRejections?Boolean($?.captureRejections):y0[Y1])this.emit=fV},y0,vV=function($,...q){if($==="error")return S9(this,q);var{_events:Q}=this;if(Q===void 0)return!1;var K=Q[$];if(K===void 0)return!1;let J=K.length>1?K.slice():K;for(let Z=0,{length:G}=J;Z1?K.slice():K;for(let Z=0,{length:G}=J;Z{_5=Symbol.for,Y1=Symbol("kCapture"),T9=_5("events.errorMonitor"),kV=Symbol("events.maxEventTargetListeners"),DV=Symbol("events.maxEventTargetListenersWarned"),x9=_5("nodejs.rejection"),u9=_5("nodejs.rejection"),O9=Array.prototype.slice,y0=r2.prototype={};y0._events=void 0;y0._eventsCount=0;y0._maxListeners=void 0;y0.setMaxListeners=function($){return c5($,"setMaxListeners",0),this._maxListeners=$,this};y0.constructor=r2;y0.getMaxListeners=function(){return this?._maxListeners??k1};y0.emit=vV;y0.addListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.push(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.on=y0.addListener;y0.prependListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.unshift(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.once=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.addListener($,Q),this};y0.prependOnceListener=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.prependListener($,Q),this};y0.removeListener=function($,q){x6(q);var{_events:Q}=this;if(!Q)return this;var K=Q[$];if(!K)return this;var J=K.length;let Z=-1;for(let G=J-1;G>=0;G--)if(K[G]===q||K[G].listener===q){Z=G;break}if(Z<0)return this;if(Z===0)K.shift();else K.splice(Z,1);if(K.length===0)delete Q[$],this._eventsCount--;return this};y0.off=y0.removeListener;y0.removeAllListeners=function($){var{_events:q}=this;if($&&q){if(q[$])delete q[$],this._eventsCount--}else this._events={__proto__:null};return this};y0.listeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.map((K)=>K.listener??K)};y0.rawListeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.slice()};y0.listenerCount=function($){var{_events:q}=this;if(!q)return 0;return q[$]?.length??0};y0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};y0[Y1]=!1;E5=class E5 extends Error{constructor($="The operation was aborted",q=void 0){if(q!==void 0&&typeof q!=="object")throw m1("options","Object",q);super($,q);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(r2,{captureRejections:{get(){return y0[Y1]},set($){IV($,"EventEmitter.captureRejections"),y0[Y1]=$},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return k1},set:($)=>{c5($,"defaultMaxListeners",0),k1=$}},kMaxEventTargetListeners:{value:kV,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:DV,enumerable:!1,configurable:!1,writable:!1}});Object.assign(r2,{once:c9,getEventListeners:b9,getMaxListeners:p9,setMaxListeners:n9,EventEmitter:r2,usingDomains:!1,captureRejectionSymbol:u9,errorMonitor:T9,addAbortListener:i9,init:r2,listenerCount:d9});CV=r2});var a1=N0((Yz,$$)=>{var g0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),P0=g0(($,q)=>{class Q extends Error{constructor(K){if(!Array.isArray(K))throw TypeError(`Expected input to be an Array, got ${typeof K}`);let J="";for(let Z=0;Z{q.exports={format(Q,...K){return Q.replace(/%([sdifj])/g,function(...[J,Z]){let G=K.shift();if(Z==="f")return G.toFixed(6);else if(Z==="j")return JSON.stringify(G);else if(Z==="s"&&typeof G==="object")return`${G.constructor!==Object?G.constructor.name:""} {}`.trim();else return G.toString()})},inspect(Q){switch(typeof Q){case"string":if(Q.includes("'")){if(!Q.includes('"'))return`"${Q}"`;else if(!Q.includes("`")&&!Q.includes("${"))return`\`${Q}\``}return`'${Q}'`;case"number":if(isNaN(Q))return"NaN";else if(Object.is(Q,-0))return String(Q);return Q;case"bigint":return`${String(Q)}n`;case"boolean":case"undefined":return String(Q);case"object":return"{}"}}}}),a0=g0(($,q)=>{var{format:Q,inspect:K}=o9(),{AggregateError:J}=P0(),Z=globalThis.AggregateError||J,G=Symbol("kIsNodeError"),W=["string","function","number","object","Function","Object","boolean","bigint","symbol"],B=/^([A-Z][a-z0-9]*)+$/,V={};function U(D,z){if(!D)throw new V.ERR_INTERNAL_ASSERTION(z)}function w(D){let z="",N=D.length,H=D[0]==="-"?1:0;for(;N>=H+4;N-=3)z=`_${D.slice(N-3,N)}${z}`;return`${D.slice(0,N)}${z}`}function F(D,z,N){if(typeof z==="function")return U(z.length<=N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${z.length}).`),z(...N);let H=(z.match(/%[dfijoOs]/g)||[]).length;if(U(H===N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${H}).`),N.length===0)return z;return Q(z,...N)}function M(D,z,N){if(!N)N=Error;class H extends N{constructor(...v){super(F(D,z,v))}toString(){return`${this.name} [${D}]: ${this.message}`}}Object.defineProperties(H.prototype,{name:{value:N.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${D}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),H.prototype.code=D,H.prototype[G]=!0,V[D]=H}function k(D){let z="__node_internal_"+D.name;return Object.defineProperty(D,"name",{value:z}),D}function f(D,z){if(D&&z&&D!==z){if(Array.isArray(z.errors))return z.errors.push(D),z;let N=new Z([z,D],z.message);return N.code=z.code,N}return D||z}class L extends Error{constructor(D="The operation was aborted",z=void 0){if(z!==void 0&&typeof z!=="object")throw new V.ERR_INVALID_ARG_TYPE("options","Object",z);super(D,z);this.code="ABORT_ERR",this.name="AbortError"}}M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(D,z,N)=>{if(U(typeof D==="string","'name' must be a string"),!Array.isArray(z))z=[z];let H="The ";if(D.endsWith(" argument"))H+=`${D} `;else H+=`"${D}" ${D.includes(".")?"property":"argument"} `;H+="must be ";let v=[],j=[],n=[];for(let _ of z)if(U(typeof _==="string","All expected entries have to be of type string"),W.includes(_))v.push(_.toLowerCase());else if(B.test(_))j.push(_);else U(_!=="object",'The value "object" should be written as "Object"'),n.push(_);if(j.length>0){let _=v.indexOf("object");if(_!==-1)v.splice(v,_,1),j.push("Object")}if(v.length>0){switch(v.length){case 1:H+=`of type ${v[0]}`;break;case 2:H+=`one of type ${v[0]} or ${v[1]}`;break;default:{let _=v.pop();H+=`one of type ${v.join(", ")}, or ${_}`}}if(j.length>0||n.length>0)H+=" or "}if(j.length>0){switch(j.length){case 1:H+=`an instance of ${j[0]}`;break;case 2:H+=`an instance of ${j[0]} or ${j[1]}`;break;default:{let _=j.pop();H+=`an instance of ${j.join(", ")}, or ${_}`}}if(n.length>0)H+=" or "}switch(n.length){case 0:break;case 1:if(n[0].toLowerCase()!==n[0])H+="an ";H+=`${n[0]}`;break;case 2:H+=`one of ${n[0]} or ${n[1]}`;break;default:{let _=n.pop();H+=`one of ${n.join(", ")}, or ${_}`}}if(N==null)H+=`. Received ${N}`;else if(typeof N==="function"&&N.name)H+=`. Received function ${N.name}`;else if(typeof N==="object"){var d;if((d=N.constructor)!==null&&d!==void 0&&d.name)H+=`. Received an instance of ${N.constructor.name}`;else{let _=K(N,{depth:-1});H+=`. Received ${_}`}}else{let _=K(N,{colors:!1});if(_.length>25)_=`${_.slice(0,25)}...`;H+=`. Received type ${typeof N} (${_})`}return H},TypeError),M("ERR_INVALID_ARG_VALUE",(D,z,N="is invalid")=>{let H=K(z);if(H.length>128)H=H.slice(0,128)+"...";return`The ${D.includes(".")?"property":"argument"} '${D}' ${N}. Received ${H}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(D,z,N)=>{var H;let v=N!==null&&N!==void 0&&(H=N.constructor)!==null&&H!==void 0&&H.name?`instance of ${N.constructor.name}`:`type ${typeof N}`;return`Expected ${D} to be returned from the "${z}" function but got ${v}.`},TypeError),M("ERR_MISSING_ARGS",(...D)=>{U(D.length>0,"At least one arg needs to be specified");let z,N=D.length;switch(D=(Array.isArray(D)?D:[D]).map((H)=>`"${H}"`).join(" or "),N){case 1:z+=`The ${D[0]} argument`;break;case 2:z+=`The ${D[0]} and ${D[1]} arguments`;break;default:{let H=D.pop();z+=`The ${D.join(", ")}, and ${H} arguments`}break}return`${z} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(D,z,N)=>{U(z,'Missing "range" argument');let H;if(Number.isInteger(N)&&Math.abs(N)>4294967296)H=w(String(N));else if(typeof N==="bigint"){H=String(N);let v=BigInt(2)**BigInt(32);if(N>v||N<-v)H=w(H);H+="n"}else H=K(N);return`The value of "${D}" is out of range. It must be ${z}. Received ${H}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),q.exports={AbortError:L,aggregateTwoErrors:k(f),hideStackFrames:k,codes:V}}),jV=g0(($,q)=>{Object.defineProperty($,"__esModule",{value:!0});var Q=new WeakMap,K=new WeakMap;function J(X){let P=Q.get(X);return console.assert(P!=null,"'this' is expected an Event object, but got",X),P}function Z(X){if(X.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",X.passiveListener);return}if(!X.event.cancelable)return;if(X.canceled=!0,typeof X.event.preventDefault==="function")X.event.preventDefault()}function G(X,P){Q.set(this,{eventTarget:X,event:P,eventPhase:2,currentTarget:X,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:P.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let g=Object.keys(P);for(let c=0;c0){let X=Array(arguments.length);for(let P=0;P{Object.defineProperty($,"__esModule",{value:!0});var Q=jV();class K extends Q.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let U=G.get(this);if(typeof U!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return U}}Q.defineEventAttribute(K.prototype,"abort");function J(){let U=Object.create(K.prototype);return Q.EventTarget.call(U),G.set(U,!1),U}function Z(U){if(G.get(U)!==!1)return;G.set(U,!0),U.dispatchEvent({type:"abort"})}var G=new WeakMap;if(Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class W{constructor(){B.set(this,J())}get signal(){return V(this)}abort(){Z(V(this))}}var B=new WeakMap;function V(U){let w=B.get(U);if(w==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${U===null?"null":typeof U}`);return w}if(Object.defineProperties(W.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(W.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});$.AbortController=W,$.AbortSignal=K,$.default=W,q.exports=W,q.exports.AbortController=q.exports.default=W,q.exports.AbortSignal=K}),e0=g0(($,q)=>{var Q=(t0(),X0(K2)),{format:K,inspect:J}=o9(),{codes:{ERR_INVALID_ARG_TYPE:Z}}=a0(),{kResistStopPropagation:G,AggregateError:W,SymbolDispose:B}=P0(),V=globalThis.AbortSignal||O6().AbortSignal,U=globalThis.AbortController||O6().AbortController,w=Object.getPrototypeOf(async function(){}).constructor,F=globalThis.Blob||Q.Blob,M=typeof F<"u"?function(L){return L instanceof F}:function(L){return!1},k=(L,D)=>{if(L!==void 0&&(L===null||typeof L!=="object"||!("aborted"in L)))throw new Z(D,"AbortSignal",L)},f=(L,D)=>{if(typeof L!=="function")throw new Z(D,"Function",L)};q.exports={AggregateError:W,kEmptyObject:Object.freeze({}),once(L){let D=!1;return function(...z){if(D)return;D=!0,L.apply(this,z)}},createDeferredPromise:function(){let L,D;return{promise:new Promise((z,N)=>{L=z,D=N}),resolve:L,reject:D}},promisify(L){return new Promise((D,z)=>{L((N,...H)=>{if(N)return z(N);return D(...H)})})},debuglog(){return function(){}},format:K,inspect:J,types:{isAsyncFunction(L){return L instanceof w},isArrayBufferView(L){return ArrayBuffer.isView(L)}},isBlob:M,deprecate(L,D){return L},addAbortListener:(i1(),X0(p1)).addAbortListener||function(L,D){if(L===void 0)throw new Z("signal","AbortSignal",L);k(L,"signal"),f(D,"listener");let z;if(L.aborted)queueMicrotask(()=>D());else L.addEventListener("abort",D,{__proto__:null,once:!0,[G]:!0}),z=()=>{L.removeEventListener("abort",D)};return{__proto__:null,[B](){var N;(N=z)===null||N===void 0||N()}}},AbortSignalAny:V.any||function(L){if(L.length===1)return L[0];let D=new U,z=()=>D.abort();return L.forEach((N)=>{k(N,"signals"),N.addEventListener("abort",z,{once:!0})}),D.signal.addEventListener("abort",()=>{L.forEach((N)=>N.removeEventListener("abort",z))},{once:!0}),D.signal}},q.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),P6=g0(($,q)=>{var{ArrayIsArray:Q,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:J,ArrayPrototypeMap:Z,NumberIsInteger:G,NumberIsNaN:W,NumberMAX_SAFE_INTEGER:B,NumberMIN_SAFE_INTEGER:V,NumberParseInt:U,ObjectPrototypeHasOwnProperty:w,RegExpPrototypeExec:F,String:M,StringPrototypeToUpperCase:k,StringPrototypeTrim:f}=P0(),{hideStackFrames:L,codes:{ERR_SOCKET_BAD_PORT:D,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:N,ERR_OUT_OF_RANGE:H,ERR_UNKNOWN_SIGNAL:v}}=a0(),{normalizeEncoding:j}=e0(),{isAsyncFunction:n,isArrayBufferView:d}=e0().types,_={};function X(T){return T===(T|0)}function P(T){return T===T>>>0}var g=/^[0-7]+$/,c="must be a 32-bit unsigned integer or an octal string";function h(T,t,G0){if(typeof T>"u")T=G0;if(typeof T==="string"){if(F(g,T)===null)throw new N(t,T,c);T=U(T,8)}return $0(T,t),T}var x=L((T,t,G0=V,Q0=B)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),l=L((T,t,G0=-2147483648,Q0=2147483647)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),$0=L((T,t,G0=!1)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);let Q0=G0?1:0,M0=4294967295;if(TM0)throw new H(t,`>= ${Q0} && <= ${M0}`,T)});function Z0(T,t){if(typeof T!=="string")throw new z(t,"string",T)}function F0(T,t,G0=void 0,Q0){if(typeof T!=="number")throw new z(t,"number",T);if(G0!=null&&TQ0||(G0!=null||Q0!=null)&&W(T))throw new H(t,`${G0!=null?`>= ${G0}`:""}${G0!=null&&Q0!=null?" && ":""}${Q0!=null?`<= ${Q0}`:""}`,T)}var p=L((T,t,G0)=>{if(!K(G0,T)){let Q0="must be one of: "+J(Z(G0,(M0)=>typeof M0==="string"?`'${M0}'`:M(M0)),", ");throw new N(t,T,Q0)}});function W0(T,t){if(typeof T!=="boolean")throw new z(t,"boolean",T)}function y(T,t,G0){return T==null||!w(T,t)?G0:T[t]}var i=L((T,t,G0=null)=>{let Q0=y(G0,"allowArray",!1),M0=y(G0,"allowFunction",!1);if(!y(G0,"nullable",!1)&&T===null||!Q0&&Q(T)||typeof T!=="object"&&(!M0||typeof T!=="function"))throw new z(t,"Object",T)}),U0=L((T,t)=>{if(T!=null&&typeof T!=="object"&&typeof T!=="function")throw new z(t,"a dictionary",T)}),m=L((T,t,G0=0)=>{if(!Q(T))throw new z(t,"Array",T);if(T.length{if(!d(T))throw new z(t,["Buffer","TypedArray","DataView"],T)});function E(T,t){let G0=j(t),Q0=T.length;if(G0==="hex"&&Q0%2!==0)throw new N("encoding",t,`is invalid for data of length ${Q0}`)}function a(T,t="Port",G0=!0){if(typeof T!=="number"&&typeof T!=="string"||typeof T==="string"&&f(T).length===0||+T!==+T>>>0||T>65535||T===0&&!G0)throw new D(t,T,G0);return T|0}var K0=L((T,t)=>{if(T!==void 0&&(T===null||typeof T!=="object"||!("aborted"in T)))throw new z(t,"AbortSignal",T)}),R=L((T,t)=>{if(typeof T!=="function")throw new z(t,"Function",T)}),Y=L((T,t)=>{if(typeof T!=="function"||n(T))throw new z(t,"Function",T)}),C=L((T,t)=>{if(T!==void 0)throw new z(t,"undefined",T)});function u(T,t,G0){if(!K(G0,T))throw new z(t,`('${J(G0,"|")}')`,T)}var e=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function r(T,t){if(typeof T>"u"||!F(e,T))throw new N(t,T,'must be an array or string of format "; rel=preload; as=style"')}function s(T){if(typeof T==="string")return r(T,"hints"),T;else if(Q(T)){let t=T.length,G0="";if(t===0)return G0;for(let Q0=0;Q0; rel=preload; as=style"')}q.exports={isInt32:X,isUint32:P,parseFileMode:h,validateArray:m,validateStringArray:V0,validateBooleanArray:w0,validateAbortSignalArray:S,validateBoolean:W0,validateBuffer:O,validateDictionary:U0,validateEncoding:E,validateFunction:R,validateInt32:l,validateInteger:x,validateNumber:F0,validateObject:i,validateOneOf:p,validatePlainFunction:Y,validatePort:a,validateSignalName:b,validateString:Z0,validateUint32:$0,validateUndefined:C,validateUnion:u,validateAbortSignal:K0,validateLinkHeaderValue:s}}),D1=g0(($,q)=>{q.exports=globalThis.process}),b2=g0(($,q)=>{var{SymbolAsyncIterator:Q,SymbolIterator:K,SymbolFor:J}=P0(),Z=J("nodejs.stream.destroyed"),G=J("nodejs.stream.errored"),W=J("nodejs.stream.readable"),B=J("nodejs.stream.writable"),V=J("nodejs.stream.disturbed"),U=J("nodejs.webstream.isClosedPromise"),w=J("nodejs.webstream.controllerErrorFunction");function F(y,i=!1){var U0;return!!(y&&typeof y.pipe==="function"&&typeof y.on==="function"&&(!i||typeof y.pause==="function"&&typeof y.resume==="function")&&(!y._writableState||((U0=y._readableState)===null||U0===void 0?void 0:U0.readable)!==!1)&&(!y._writableState||y._readableState))}function M(y){var i;return!!(y&&typeof y.write==="function"&&typeof y.on==="function"&&(!y._readableState||((i=y._writableState)===null||i===void 0?void 0:i.writable)!==!1))}function k(y){return!!(y&&typeof y.pipe==="function"&&y._readableState&&typeof y.on==="function"&&typeof y.write==="function")}function f(y){return y&&(y._readableState||y._writableState||typeof y.write==="function"&&typeof y.on==="function"||typeof y.pipe==="function"&&typeof y.on==="function")}function L(y){return!!(y&&!f(y)&&typeof y.pipeThrough==="function"&&typeof y.getReader==="function"&&typeof y.cancel==="function")}function D(y){return!!(y&&!f(y)&&typeof y.getWriter==="function"&&typeof y.abort==="function")}function z(y){return!!(y&&!f(y)&&typeof y.readable==="object"&&typeof y.writable==="object")}function N(y){return L(y)||D(y)||z(y)}function H(y,i){if(y==null)return!1;if(i===!0)return typeof y[Q]==="function";if(i===!1)return typeof y[K]==="function";return typeof y[Q]==="function"||typeof y[K]==="function"}function v(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!!(y.destroyed||y[Z]||m!==null&&m!==void 0&&m.destroyed)}function j(y){if(!M(y))return null;if(y.writableEnded===!0)return!0;let i=y._writableState;if(i!==null&&i!==void 0&&i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function n(y,i){if(!M(y))return null;if(y.writableFinished===!0)return!0;let U0=y._writableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.finished)!=="boolean")return null;return!!(U0.finished||i===!1&&U0.ended===!0&&U0.length===0)}function d(y){if(!F(y))return null;if(y.readableEnded===!0)return!0;let i=y._readableState;if(!i||i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function _(y,i){if(!F(y))return null;let U0=y._readableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.endEmitted)!=="boolean")return null;return!!(U0.endEmitted||i===!1&&U0.ended===!0&&U0.length===0)}function X(y){if(y&&y[W]!=null)return y[W];if(typeof(y===null||y===void 0?void 0:y.readable)!=="boolean")return null;if(v(y))return!1;return F(y)&&y.readable&&!_(y)}function P(y){if(y&&y[B]!=null)return y[B];if(typeof(y===null||y===void 0?void 0:y.writable)!=="boolean")return null;if(v(y))return!1;return M(y)&&y.writable&&!j(y)}function g(y,i){if(!f(y))return null;if(v(y))return!0;if((i===null||i===void 0?void 0:i.readable)!==!1&&X(y))return!1;if((i===null||i===void 0?void 0:i.writable)!==!1&&P(y))return!1;return!0}function c(y){var i,U0;if(!f(y))return null;if(y.writableErrored)return y.writableErrored;return(i=(U0=y._writableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function h(y){var i,U0;if(!f(y))return null;if(y.readableErrored)return y.readableErrored;return(i=(U0=y._readableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function x(y){if(!f(y))return null;if(typeof y.closed==="boolean")return y.closed;let{_writableState:i,_readableState:U0}=y;if(typeof(i===null||i===void 0?void 0:i.closed)==="boolean"||typeof(U0===null||U0===void 0?void 0:U0.closed)==="boolean")return(i===null||i===void 0?void 0:i.closed)||(U0===null||U0===void 0?void 0:U0.closed);if(typeof y._closed==="boolean"&&l(y))return y._closed;return null}function l(y){return typeof y._closed==="boolean"&&typeof y._defaultKeepAlive==="boolean"&&typeof y._removedConnection==="boolean"&&typeof y._removedContLen==="boolean"}function $0(y){return typeof y._sent100==="boolean"&&l(y)}function Z0(y){var i;return typeof y._consuming==="boolean"&&typeof y._dumped==="boolean"&&((i=y.req)===null||i===void 0?void 0:i.upgradeOrConnect)===void 0}function F0(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!m&&$0(y)||!!(m&&m.autoDestroy&&m.emitClose&&m.closed===!1)}function p(y){var i;return!!(y&&((i=y[V])!==null&&i!==void 0?i:y.readableDidRead||y.readableAborted))}function W0(y){var i,U0,m,V0,w0,S,b,O,E,a;return!!(y&&((i=(U0=(m=(V0=(w0=(S=y[G])!==null&&S!==void 0?S:y.readableErrored)!==null&&w0!==void 0?w0:y.writableErrored)!==null&&V0!==void 0?V0:(b=y._readableState)===null||b===void 0?void 0:b.errorEmitted)!==null&&m!==void 0?m:(O=y._writableState)===null||O===void 0?void 0:O.errorEmitted)!==null&&U0!==void 0?U0:(E=y._readableState)===null||E===void 0?void 0:E.errored)!==null&&i!==void 0?i:(a=y._writableState)===null||a===void 0?void 0:a.errored))}q.exports={isDestroyed:v,kIsDestroyed:Z,isDisturbed:p,kIsDisturbed:V,isErrored:W0,kIsErrored:G,isReadable:X,kIsReadable:W,kIsClosedPromise:U,kControllerErrorFunction:w,kIsWritable:B,isClosed:x,isDuplexNodeStream:k,isFinished:g,isIterable:H,isReadableNodeStream:F,isReadableStream:L,isReadableEnded:d,isReadableFinished:_,isReadableErrored:h,isNodeStream:f,isWebStream:N,isWritable:P,isWritableNodeStream:M,isWritableStream:D,isWritableEnded:j,isWritableFinished:n,isWritableErrored:c,isServerRequest:Z0,isServerResponse:$0,willEmitClose:F0,isTransformStream:z}}),s2=g0(($,q)=>{var Q=D1(),{AbortError:K,codes:J}=a0(),{ERR_INVALID_ARG_TYPE:Z,ERR_STREAM_PREMATURE_CLOSE:G}=J,{kEmptyObject:W,once:B}=e0(),{validateAbortSignal:V,validateFunction:U,validateObject:w,validateBoolean:F}=P6(),{Promise:M,PromisePrototypeThen:k,SymbolDispose:f}=P0(),{isClosed:L,isReadable:D,isReadableNodeStream:z,isReadableStream:N,isReadableFinished:H,isReadableErrored:v,isWritable:j,isWritableNodeStream:n,isWritableStream:d,isWritableFinished:_,isWritableErrored:X,isNodeStream:P,willEmitClose:g,kIsClosedPromise:c}=b2(),h;function x(p){return p.setHeader&&typeof p.abort==="function"}var l=()=>{};function $0(p,W0,y){var i,U0;if(arguments.length===2)y=W0,W0=W;else if(W0==null)W0=W;else w(W0,"options");if(U(y,"callback"),V(W0.signal,"options.signal"),y=B(y),N(p)||d(p))return Z0(p,W0,y);if(!P(p))throw new Z("stream",["ReadableStream","WritableStream","Stream"],p);let m=(i=W0.readable)!==null&&i!==void 0?i:z(p),V0=(U0=W0.writable)!==null&&U0!==void 0?U0:n(p),w0=p._writableState,S=p._readableState,b=()=>{if(!p.writable)a()},O=g(p)&&z(p)===m&&n(p)===V0,E=_(p,!1),a=()=>{if(E=!0,p.destroyed)O=!1;if(O&&(!p.readable||m))return;if(!m||K0)y.call(p)},K0=H(p,!1),R=()=>{if(K0=!0,p.destroyed)O=!1;if(O&&(!p.writable||V0))return;if(!V0||E)y.call(p)},Y=(T)=>{y.call(p,T)},C=L(p),u=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);if(m&&!K0&&z(p,!0)){if(!H(p,!1))return y.call(p,new G)}if(V0&&!E){if(!_(p,!1))return y.call(p,new G)}y.call(p)},e=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);y.call(p)},r=()=>{p.req.on("finish",a)};if(x(p)){if(p.on("complete",a),!O)p.on("abort",u);if(p.req)r();else p.on("request",r)}else if(V0&&!w0)p.on("end",b),p.on("close",b);if(!O&&typeof p.aborted==="boolean")p.on("aborted",u);if(p.on("end",R),p.on("finish",a),W0.error!==!1)p.on("error",Y);if(p.on("close",u),C)Q.nextTick(u);else if(w0!==null&&w0!==void 0&&w0.errorEmitted||S!==null&&S!==void 0&&S.errorEmitted){if(!O)Q.nextTick(e)}else if(!m&&(!O||D(p))&&(E||j(p)===!1))Q.nextTick(e);else if(!V0&&(!O||j(p))&&(K0||D(p)===!1))Q.nextTick(e);else if(S&&p.req&&p.aborted)Q.nextTick(e);let s=()=>{if(y=l,p.removeListener("aborted",u),p.removeListener("complete",a),p.removeListener("abort",u),p.removeListener("request",r),p.req)p.req.removeListener("finish",a);p.removeListener("end",b),p.removeListener("close",b),p.removeListener("finish",a),p.removeListener("end",R),p.removeListener("error",Y),p.removeListener("close",u)};if(W0.signal&&!C){let T=()=>{let t=y;s(),t.call(p,new K(void 0,{cause:W0.signal.reason}))};if(W0.signal.aborted)Q.nextTick(T);else{h=h||e0().addAbortListener;let t=h(W0.signal,T),G0=y;y=B((...Q0)=>{t[f](),G0.apply(p,Q0)})}}return s}function Z0(p,W0,y){let i=!1,U0=l;if(W0.signal)if(U0=()=>{i=!0,y.call(p,new K(void 0,{cause:W0.signal.reason}))},W0.signal.aborted)Q.nextTick(U0);else{h=h||e0().addAbortListener;let V0=h(W0.signal,U0),w0=y;y=B((...S)=>{V0[f](),w0.apply(p,S)})}let m=(...V0)=>{if(!i)Q.nextTick(()=>y.apply(p,V0))};return k(p[c].promise,m,m),l}function F0(p,W0){var y;let i=!1;if(W0===null)W0=W;if((y=W0)!==null&&y!==void 0&&y.cleanup)F(W0.cleanup,"cleanup"),i=W0.cleanup;return new M((U0,m)=>{let V0=$0(p,W0,(w0)=>{if(i)V0();if(w0)m(w0);else U0()})})}q.exports=$0,q.exports.finished=F0}),o1=g0(($,q)=>{var Q=D1(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:J},AbortError:Z}=a0(),{Symbol:G}=P0(),{kIsDestroyed:W,isDestroyed:B,isFinished:V,isServerRequest:U}=b2(),w=G("kDestroy"),F=G("kConstruct");function M(g,c,h){if(g){if(g.stack,c&&!c.errored)c.errored=g;if(h&&!h.errored)h.errored=g}}function k(g,c){let h=this._readableState,x=this._writableState,l=x||h;if(x!==null&&x!==void 0&&x.destroyed||h!==null&&h!==void 0&&h.destroyed){if(typeof c==="function")c();return this}if(M(g,x,h),x)x.destroyed=!0;if(h)h.destroyed=!0;if(!l.constructed)this.once(w,function($0){f(this,K($0,g),c)});else f(this,g,c);return this}function f(g,c,h){let x=!1;function l($0){if(x)return;x=!0;let{_readableState:Z0,_writableState:F0}=g;if(M($0,F0,Z0),F0)F0.closed=!0;if(Z0)Z0.closed=!0;if(typeof h==="function")h($0);if($0)Q.nextTick(L,g,$0);else Q.nextTick(D,g)}try{g._destroy(c||null,l)}catch($0){l($0)}}function L(g,c){z(g,c),D(g)}function D(g){let{_readableState:c,_writableState:h}=g;if(h)h.closeEmitted=!0;if(c)c.closeEmitted=!0;if(h!==null&&h!==void 0&&h.emitClose||c!==null&&c!==void 0&&c.emitClose)g.emit("close")}function z(g,c){let{_readableState:h,_writableState:x}=g;if(x!==null&&x!==void 0&&x.errorEmitted||h!==null&&h!==void 0&&h.errorEmitted)return;if(x)x.errorEmitted=!0;if(h)h.errorEmitted=!0;g.emit("error",c)}function N(){let g=this._readableState,c=this._writableState;if(g)g.constructed=!0,g.closed=!1,g.closeEmitted=!1,g.destroyed=!1,g.errored=null,g.errorEmitted=!1,g.reading=!1,g.ended=g.readable===!1,g.endEmitted=g.readable===!1;if(c)c.constructed=!0,c.destroyed=!1,c.closed=!1,c.closeEmitted=!1,c.errored=null,c.errorEmitted=!1,c.finalCalled=!1,c.prefinished=!1,c.ended=c.writable===!1,c.ending=c.writable===!1,c.finished=c.writable===!1}function H(g,c,h){let{_readableState:x,_writableState:l}=g;if(l!==null&&l!==void 0&&l.destroyed||x!==null&&x!==void 0&&x.destroyed)return this;if(x!==null&&x!==void 0&&x.autoDestroy||l!==null&&l!==void 0&&l.autoDestroy)g.destroy(c);else if(c){if(c.stack,l&&!l.errored)l.errored=c;if(x&&!x.errored)x.errored=c;if(h)Q.nextTick(z,g,c);else z(g,c)}}function v(g,c){if(typeof g._construct!=="function")return;let{_readableState:h,_writableState:x}=g;if(h)h.constructed=!1;if(x)x.constructed=!1;if(g.once(F,c),g.listenerCount(F)>1)return;Q.nextTick(j,g)}function j(g){let c=!1;function h(x){if(c){H(g,x!==null&&x!==void 0?x:new J);return}c=!0;let{_readableState:l,_writableState:$0}=g,Z0=$0||l;if(l)l.constructed=!0;if($0)$0.constructed=!0;if(Z0.destroyed)g.emit(w,x);else if(x)H(g,x,!0);else Q.nextTick(n,g)}try{g._construct((x)=>{Q.nextTick(h,x)})}catch(x){Q.nextTick(h,x)}}function n(g){g.emit(F)}function d(g){return(g===null||g===void 0?void 0:g.setHeader)&&typeof g.abort==="function"}function _(g){g.emit("close")}function X(g,c){g.emit("error",c),Q.nextTick(_,g)}function P(g,c){if(!g||B(g))return;if(!c&&!V(g))c=new Z;if(U(g))g.socket=null,g.destroy(c);else if(d(g))g.abort();else if(d(g.req))g.req.abort();else if(typeof g.destroy==="function")g.destroy(c);else if(typeof g.close==="function")g.close();else if(c)Q.nextTick(X,g,c);else Q.nextTick(_,g);if(!g.destroyed)g[W]=!0}q.exports={construct:v,destroyer:P,destroy:k,undestroy:N,errorOrDestroy:H}}),b5=g0(($,q)=>{var{ArrayIsArray:Q,ObjectSetPrototypeOf:K}=P0(),{EventEmitter:J}=(i1(),X0(p1));function Z(W){J.call(this,W)}K(Z.prototype,J.prototype),K(Z,J),Z.prototype.pipe=function(W,B){let V=this;function U(D){if(W.writable&&W.write(D)===!1&&V.pause)V.pause()}V.on("data",U);function w(){if(V.readable&&V.resume)V.resume()}if(W.on("drain",w),!W._isStdio&&(!B||B.end!==!1))V.on("end",M),V.on("close",k);let F=!1;function M(){if(F)return;F=!0,W.end()}function k(){if(F)return;if(F=!0,typeof W.destroy==="function")W.destroy()}function f(D){if(L(),J.listenerCount(this,"error")===0)this.emit("error",D)}G(V,"error",f),G(W,"error",f);function L(){V.removeListener("data",U),W.removeListener("drain",w),V.removeListener("end",M),V.removeListener("close",k),V.removeListener("error",f),W.removeListener("error",f),V.removeListener("end",L),V.removeListener("close",L),W.removeListener("close",L)}return V.on("end",L),V.on("close",L),W.on("close",L),W.emit("pipe",V),W};function G(W,B,V){if(typeof W.prependListener==="function")return W.prependListener(B,V);if(!W._events||!W._events[B])W.on(B,V);else if(Q(W._events[B]))W._events[B].unshift(V);else W._events[B]=[V,W._events[B]]}q.exports={Stream:Z,prependListener:G}}),H8=g0(($,q)=>{var{SymbolDispose:Q}=P0(),{AbortError:K,codes:J}=a0(),{isNodeStream:Z,isWebStream:G,kControllerErrorFunction:W}=b2(),B=s2(),{ERR_INVALID_ARG_TYPE:V}=J,U,w=(F,M)=>{if(typeof F!=="object"||!("aborted"in F))throw new V(M,"AbortSignal",F)};q.exports.addAbortSignal=function(F,M){if(w(F,"signal"),!Z(M)&&!G(M))throw new V("stream",["ReadableStream","WritableStream","Stream"],M);return q.exports.addAbortSignalNoValidate(F,M)},q.exports.addAbortSignalNoValidate=function(F,M){if(typeof F!=="object"||!("aborted"in F))return M;let k=Z(M)?()=>{M.destroy(new K(void 0,{cause:F.reason}))}:()=>{M[W](new K(void 0,{cause:F.reason}))};if(F.aborted)k();else{U=U||e0().addAbortListener;let f=U(F,k);B(M,f[Q])}return M}}),gV=g0(($,q)=>{var{StringPrototypeSlice:Q,SymbolIterator:K,TypedArrayPrototypeSet:J,Uint8Array:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{inspect:W}=e0();q.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(B){let V={data:B,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length}unshift(B){let V={data:B,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length}shift(){if(this.length===0)return;let B=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,B}clear(){this.head=this.tail=null,this.length=0}join(B){if(this.length===0)return"";let V=this.head,U=""+V.data;while((V=V.next)!==null)U+=B+V.data;return U}concat(B){if(this.length===0)return G.alloc(0);let V=G.allocUnsafe(B>>>0),U=this.head,w=0;while(U)J(V,U.data,w),w+=U.data.length,U=U.next;return V}consume(B,V){let U=this.head.data;if(BF.length)V+=F,B-=F.length;else{if(B===F.length)if(V+=F,++w,U.next)this.head=U.next;else this.head=this.tail=null;else V+=Q(F,0,B),this.head=U,U.data=Q(F,B);break}++w}while((U=U.next)!==null);return this.length-=w,V}_getBuffer(B){let V=G.allocUnsafe(B),U=B,w=this.head,F=0;do{let M=w.data;if(B>M.length)J(V,M,U-B),B-=M.length;else{if(B===M.length)if(J(V,M,U-B),++F,w.next)this.head=w.next;else this.head=this.tail=null;else J(V,new Z(M.buffer,M.byteOffset,B),U-B),this.head=w,w.data=M.slice(B);break}++F}while((w=w.next)!==null);return this.length-=F,V}[Symbol.for("nodejs.util.inspect.custom")](B,V){return W(this,{...V,depth:0,customInspect:!1})}}}),v8=g0(($,q)=>{var{MathFloor:Q,NumberIsInteger:K}=P0(),{validateInteger:J}=P6(),{ERR_INVALID_ARG_VALUE:Z}=a0().codes,G=16384,W=16;function B(F,M,k){return F.highWaterMark!=null?F.highWaterMark:M?F[k]:null}function V(F){return F?W:G}function U(F,M){if(J(M,"value",0),F)W=M;else G=M}function w(F,M,k,f){let L=B(M,f,k);if(L!=null){if(!K(L)||L<0){let D=f?`options.${k}`:"options.highWaterMark";throw new Z(D,L)}return Q(L)}return V(F.objectMode)}q.exports={getHighWaterMark:w,getDefaultHighWaterMark:V,setDefaultHighWaterMark:U}}),AV=g0(($,q)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),XV=g0(($)=>{var q=AV().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),a9=g0(($,q)=>{var Q=D1(),{PromisePrototypeThen:K,SymbolAsyncIterator:J,SymbolIterator:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{ERR_INVALID_ARG_TYPE:W,ERR_STREAM_NULL_VALUES:B}=a0().codes;function V(U,w,F){let M;if(typeof w==="string"||w instanceof G)return new U({objectMode:!0,...F,read(){this.push(w),this.push(null)}});let k;if(w&&w[J])k=!0,M=w[J]();else if(w&&w[Z])k=!1,M=w[Z]();else throw new W("iterable",["Iterable"],w);let f=new U({objectMode:!0,highWaterMark:1,...F}),L=!1;f._read=function(){if(!L)L=!0,z()},f._destroy=function(N,H){K(D(N),()=>Q.nextTick(H,N),(v)=>Q.nextTick(H,v||N))};async function D(N){let H=N!==void 0&&N!==null,v=typeof M.throw==="function";if(H&&v){let{value:j,done:n}=await M.throw(N);if(await j,n)return}if(typeof M.return==="function"){let{value:j}=await M.return();await j}}async function z(){for(;;){try{let{value:N,done:H}=k?await M.next():M.next();if(H)f.push(null);else{let v=N&&typeof N.then==="function"?await N:N;if(v===null)throw L=!1,new B;else if(f.push(v))continue;else L=!1}}catch(N){f.destroy(N)}break}}return f}q.exports=V}),f8=g0(($,q)=>{var Q=D1(),{ArrayPrototypeIndexOf:K,NumberIsInteger:J,NumberIsNaN:Z,NumberParseInt:G,ObjectDefineProperties:W,ObjectKeys:B,ObjectSetPrototypeOf:V,Promise:U,SafeSet:w,SymbolAsyncDispose:F,SymbolAsyncIterator:M,Symbol:k}=P0();q.exports=Q0,Q0.ReadableState=G0;var{EventEmitter:f}=(i1(),X0(p1)),{Stream:L,prependListener:D}=b5(),{Buffer:z}=(t0(),X0(K2)),{addAbortSignal:N}=H8(),H=s2(),v=e0().debuglog("stream",(I)=>{v=I}),j=gV(),n=o1(),{getHighWaterMark:d,getDefaultHighWaterMark:_}=v8(),{aggregateTwoErrors:X,codes:{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:g,ERR_OUT_OF_RANGE:c,ERR_STREAM_PUSH_AFTER_EOF:h,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:x},AbortError:l}=a0(),{validateObject:$0}=P6(),Z0=k("kPaused"),{StringDecoder:F0}=XV(),p=a9();V(Q0.prototype,L.prototype),V(Q0,L);var W0=()=>{},{errorOrDestroy:y}=n,i=1,U0=2,m=4,V0=8,w0=16,S=32,b=64,O=128,E=256,a=512,K0=1024,R=2048,Y=4096,C=8192,u=16384,e=32768,r=65536,s=131072,T=262144;function t(I){return{enumerable:!1,get(){return(this.state&I)!==0},set(A){if(A)this.state|=I;else this.state&=~I}}}W(G0.prototype,{objectMode:t(i),ended:t(U0),endEmitted:t(m),reading:t(V0),constructed:t(w0),sync:t(S),needReadable:t(b),emittedReadable:t(O),readableListening:t(E),resumeScheduled:t(a),errorEmitted:t(K0),emitClose:t(R),autoDestroy:t(Y),destroyed:t(C),closed:t(u),closeEmitted:t(e),multiAwaitDrain:t(r),readingMore:t(s),dataEmitted:t(T)});function G0(I,A,J0){if(typeof J0!=="boolean")J0=A instanceof c2();if(this.state=R|Y|w0|S,I&&I.objectMode)this.state|=i;if(J0&&I&&I.readableObjectMode)this.state|=i;if(this.highWaterMark=I?d(this,I,"readableHighWaterMark",J0):_(!1),this.buffer=new j,this.length=0,this.pipes=[],this.flowing=null,this[Z0]=null,I&&I.emitClose===!1)this.state&=~R;if(I&&I.autoDestroy===!1)this.state&=~Y;if(this.errored=null,this.defaultEncoding=I&&I.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,I&&I.encoding)this.decoder=new F0(I.encoding),this.encoding=I.encoding}function Q0(I){if(!(this instanceof Q0))return new Q0(I);let A=this instanceof c2();if(this._readableState=new G0(I,this,A),I){if(typeof I.read==="function")this._read=I.read;if(typeof I.destroy==="function")this._destroy=I.destroy;if(typeof I.construct==="function")this._construct=I.construct;if(I.signal&&!A)N(I.signal,this)}L.call(this,I),n.construct(this,()=>{if(this._readableState.needReadable)_1(this,this._readableState)})}Q0.prototype.destroy=n.destroy,Q0.prototype._undestroy=n.undestroy,Q0.prototype._destroy=function(I,A){A(I)},Q0.prototype[f.captureRejectionSymbol]=function(I){this.destroy(I)},Q0.prototype[F]=function(){let I;if(!this.destroyed)I=this.readableEnded?null:new l,this.destroy(I);return new U((A,J0)=>H(this,(B0)=>B0&&B0!==I?J0(B0):A(null)))},Q0.prototype.push=function(I,A){return M0(this,I,A,!1)},Q0.prototype.unshift=function(I,A){return M0(this,I,A,!0)};function M0(I,A,J0,B0){v("readableAddChunk",A);let z0=I._readableState,i0;if((z0.state&i)===0){if(typeof A==="string"){if(J0=J0||z0.defaultEncoding,z0.encoding!==J0)if(B0&&z0.encoding)A=z.from(A,J0).toString(z0.encoding);else A=z.from(A,J0),J0=""}else if(A instanceof z)J0="";else if(L._isUint8Array(A))A=L._uint8ArrayToBuffer(A),J0="";else if(A!=null)i0=new P("chunk",["string","Buffer","Uint8Array"],A)}if(i0)y(I,i0);else if(A===null)z0.state&=~V0,O0(I,z0);else if((z0.state&i)!==0||A&&A.length>0)if(B0)if((z0.state&m)!==0)y(I,new x);else if(z0.destroyed||z0.errored)return!1;else I0(I,z0,A,!0);else if(z0.ended)y(I,new h);else if(z0.destroyed||z0.errored)return!1;else if(z0.state&=~V0,z0.decoder&&!J0)if(A=z0.decoder.write(A),z0.objectMode||A.length!==0)I0(I,z0,A,!1);else _1(I,z0);else I0(I,z0,A,!1);else if(!B0)z0.state&=~V0,_1(I,z0);return!z0.ended&&(z0.length0){if((A.state&r)!==0)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;A.dataEmitted=!0,I.emit("data",J0)}else{if(A.length+=A.objectMode?1:J0.length,B0)A.buffer.unshift(J0);else A.buffer.push(J0);if((A.state&b)!==0)u0(I)}_1(I,A)}Q0.prototype.isPaused=function(){let I=this._readableState;return I[Z0]===!0||I.flowing===!1},Q0.prototype.setEncoding=function(I){let A=new F0(I);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;let J0=this._readableState.buffer,B0="";for(let z0 of J0)B0+=A.write(z0);if(J0.clear(),B0!=="")J0.push(B0);return this._readableState.length=B0.length,this};var m0=1073741824;function p0(I){if(I>m0)throw new c("size","<= 1GiB",I);else I--,I|=I>>>1,I|=I>>>2,I|=I>>>4,I|=I>>>8,I|=I>>>16,I++;return I}function q2(I,A){if(I<=0||A.length===0&&A.ended)return 0;if((A.state&i)!==0)return 1;if(Z(I)){if(A.flowing&&A.length)return A.buffer.first().length;return A.length}if(I<=A.length)return I;return A.ended?A.length:0}Q0.prototype.read=function(I){if(v("read",I),I===void 0)I=NaN;else if(!J(I))I=G(I,10);let A=this._readableState,J0=I;if(I>A.highWaterMark)A.highWaterMark=p0(I);if(I!==0)A.state&=~O;if(I===0&&A.needReadable&&((A.highWaterMark!==0?A.length>=A.highWaterMark:A.length>0)||A.ended)){if(v("read: emitReadable",A.length,A.ended),A.length===0&&A.ended)f5(this);else u0(this);return null}if(I=q2(I,A),I===0&&A.ended){if(A.length===0)f5(this);return null}let B0=(A.state&b)!==0;if(v("need readable",B0),A.length===0||A.length-I0)z0=l7(I,A);else z0=null;if(z0===null)A.needReadable=A.length<=A.highWaterMark,I=0;else if(A.length-=I,A.multiAwaitDrain)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;if(A.length===0){if(!A.ended)A.needReadable=!0;if(J0!==I&&A.ended)f5(this)}if(z0!==null&&!A.errorEmitted&&!A.closeEmitted)A.dataEmitted=!0,this.emit("data",z0);return z0};function O0(I,A){if(v("onEofChunk"),A.ended)return;if(A.decoder){let J0=A.decoder.end();if(J0&&J0.length)A.buffer.push(J0),A.length+=A.objectMode?1:J0.length}if(A.ended=!0,A.sync)u0(I);else A.needReadable=!1,A.emittedReadable=!0,E1(I)}function u0(I){let A=I._readableState;if(v("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,!A.emittedReadable)v("emitReadable",A.flowing),A.emittedReadable=!0,Q.nextTick(E1,I)}function E1(I){let A=I._readableState;if(v("emitReadable_",A.destroyed,A.length,A.ended),!A.destroyed&&!A.errored&&(A.length||A.ended))I.emit("readable"),A.emittedReadable=!1;A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,o7(I)}function _1(I,A){if(!A.readingMore&&A.constructed)A.readingMore=!0,Q.nextTick(R2,I,A)}function R2(I,A){while(!A.reading&&!A.ended&&(A.length1&&B0.pipes.includes(I))v("false write response, pause",B0.awaitDrainWriters.size),B0.awaitDrainWriters.add(I);J0.pause()}if(!z1)z1=wJ(J0,I),I.on("drain",z1)}J0.on("data",e7);function e7(F1){v("ondata");let u2=I.write(F1);if(v("dest.write",u2),u2===!1)t7()}function I5(F1){if(v("onerror",F1),A6(),I.removeListener("error",I5),I.listenerCount("error")===0){let u2=I._writableState||I._readableState;if(u2&&!u2.errorEmitted)y(I,F1);else I.emit("error",F1)}}D(I,"error",I5);function C5(){I.removeListener("finish",j5),A6()}I.once("close",C5);function j5(){v("onfinish"),I.removeListener("close",C5),A6()}I.once("finish",j5);function A6(){v("unpipe"),J0.unpipe(I)}if(I.emit("pipe",J0),I.writableNeedDrain===!0)t7();else if(!B0.flowing)v("pipe resume"),J0.resume();return I};function wJ(I,A){return function(){let J0=I._readableState;if(J0.awaitDrainWriters===A)v("pipeOnDrain",1),J0.awaitDrainWriters=null;else if(J0.multiAwaitDrain)v("pipeOnDrain",J0.awaitDrainWriters.size),J0.awaitDrainWriters.delete(A);if((!J0.awaitDrainWriters||J0.awaitDrainWriters.size===0)&&I.listenerCount("data"))I.resume()}}Q0.prototype.unpipe=function(I){let A=this._readableState,J0={hasUnpiped:!1};if(A.pipes.length===0)return this;if(!I){let z0=A.pipes;A.pipes=[],this.pause();for(let i0=0;i00,B0.flowing!==!1)this.resume()}else if(I==="readable"){if(!B0.endEmitted&&!B0.readableListening){if(B0.readableListening=B0.needReadable=!0,B0.flowing=!1,B0.emittedReadable=!1,v("on readable",B0.length,B0.reading),B0.length)u0(this);else if(!B0.reading)Q.nextTick(NJ,this)}}return J0},Q0.prototype.addListener=Q0.prototype.on,Q0.prototype.removeListener=function(I,A){let J0=L.prototype.removeListener.call(this,I,A);if(I==="readable")Q.nextTick(i7,this);return J0},Q0.prototype.off=Q0.prototype.removeListener,Q0.prototype.removeAllListeners=function(I){let A=L.prototype.removeAllListeners.apply(this,arguments);if(I==="readable"||I===void 0)Q.nextTick(i7,this);return A};function i7(I){let A=I._readableState;if(A.readableListening=I.listenerCount("readable")>0,A.resumeScheduled&&A[Z0]===!1)A.flowing=!0;else if(I.listenerCount("data")>0)I.resume();else if(!A.readableListening)A.flowing=null}function NJ(I){v("readable nexttick read 0"),I.read(0)}Q0.prototype.resume=function(){let I=this._readableState;if(!I.flowing)v("resume"),I.flowing=!I.readableListening,YJ(this,I);return I[Z0]=!1,this};function YJ(I,A){if(!A.resumeScheduled)A.resumeScheduled=!0,Q.nextTick(kJ,I,A)}function kJ(I,A){if(v("resume",A.reading),!A.reading)I.read(0);if(A.resumeScheduled=!1,I.emit("resume"),o7(I),A.flowing&&!A.reading)I.read(0)}Q0.prototype.pause=function(){if(v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)v("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[Z0]=!0,this};function o7(I){let A=I._readableState;v("flow",A.flowing);while(A.flowing&&I.read()!==null);}Q0.prototype.wrap=function(I){let A=!1;I.on("data",(B0)=>{if(!this.push(B0)&&I.pause)A=!0,I.pause()}),I.on("end",()=>{this.push(null)}),I.on("error",(B0)=>{y(this,B0)}),I.on("close",()=>{this.destroy()}),I.on("destroy",()=>{this.destroy()}),this._read=()=>{if(A&&I.resume)A=!1,I.resume()};let J0=B(I);for(let B0=1;B0{z0=z2?X(z0,z2):null,J0(),J0=W0});try{while(!0){let z2=I.destroyed?null:I.read();if(z2!==null)yield z2;else if(z0)throw z0;else if(z0===null)return;else await new U(B0)}}catch(z2){throw z0=X(z0,z2),z0}finally{if((z0||(A===null||A===void 0?void 0:A.destroyOnReturn)!==!1)&&(z0===void 0||I._readableState.autoDestroy))n.destroyer(I,null);else I.off("readable",B0),i0()}}W(Q0.prototype,{readable:{__proto__:null,get(){let I=this._readableState;return!!I&&I.readable!==!1&&!I.destroyed&&!I.errorEmitted&&!I.endEmitted},set(I){if(this._readableState)this._readableState.readable=!!I}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(I){if(this._readableState)this._readableState.flowing=I}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(I){if(!this._readableState)return;this._readableState.destroyed=I}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),W(G0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Z0]!==!1},set(I){this[Z0]=!!I}}}),Q0._fromList=l7;function l7(I,A){if(A.length===0)return null;let J0;if(A.objectMode)J0=A.buffer.shift();else if(!I||I>=A.length){if(A.decoder)J0=A.buffer.join("");else if(A.buffer.length===1)J0=A.buffer.first();else J0=A.buffer.concat(A.length);A.buffer.clear()}else J0=A.buffer.consume(I,A.decoder);return J0}function f5(I){let A=I._readableState;if(v("endReadable",A.endEmitted),!A.endEmitted)A.ended=!0,Q.nextTick(LJ,A,I)}function LJ(I,A){if(v("endReadableNT",I.endEmitted,I.length),!I.errored&&!I.closeEmitted&&!I.endEmitted&&I.length===0){if(I.endEmitted=!0,A.emit("end"),A.writable&&A.allowHalfOpen===!1)Q.nextTick(HJ,A);else if(I.autoDestroy){let J0=A._writableState;if(!J0||J0.autoDestroy&&(J0.finished||J0.writable===!1))A.destroy()}}}function HJ(I){if(I.writable&&!I.writableEnded&&!I.destroyed)I.end()}Q0.from=function(I,A){return p(Q0,I,A)};var R5;function r7(){if(R5===void 0)R5={};return R5}Q0.fromWeb=function(I,A){return r7().newStreamReadableFromReadableStream(I,A)},Q0.toWeb=function(I,A){return r7().newReadableStreamFromStreamReadable(I,A)},Q0.wrap=function(I,A){var J0,B0;return new Q0({objectMode:(J0=(B0=I.readableObjectMode)!==null&&B0!==void 0?B0:I.objectMode)!==null&&J0!==void 0?J0:!0,...A,destroy(z0,i0){n.destroyer(I,z0),i0(z0)}}).wrap(I)}}),n5=g0(($,q)=>{var Q=D1(),{ArrayPrototypeSlice:K,Error:J,FunctionPrototypeSymbolHasInstance:Z,ObjectDefineProperty:G,ObjectDefineProperties:W,ObjectSetPrototypeOf:B,StringPrototypeToLowerCase:V,Symbol:U,SymbolHasInstance:w}=P0();q.exports=$0,$0.WritableState=x;var{EventEmitter:F}=(i1(),X0(p1)),M=b5().Stream,{Buffer:k}=(t0(),X0(K2)),f=o1(),{addAbortSignal:L}=H8(),{getHighWaterMark:D,getDefaultHighWaterMark:z}=v8(),{ERR_INVALID_ARG_TYPE:N,ERR_METHOD_NOT_IMPLEMENTED:H,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:j,ERR_STREAM_DESTROYED:n,ERR_STREAM_ALREADY_FINISHED:d,ERR_STREAM_NULL_VALUES:_,ERR_STREAM_WRITE_AFTER_END:X,ERR_UNKNOWN_ENCODING:P}=a0().codes,{errorOrDestroy:g}=f;B($0.prototype,M.prototype),B($0,M);function c(){}var h=U("kOnFinished");function x(Y,C,u){if(typeof u!=="boolean")u=C instanceof c2();if(this.objectMode=!!(Y&&Y.objectMode),u)this.objectMode=this.objectMode||!!(Y&&Y.writableObjectMode);this.highWaterMark=Y?D(this,Y,"writableHighWaterMark",u):z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let e=!!(Y&&Y.decodeStrings===!1);this.decodeStrings=!e,this.defaultEncoding=Y&&Y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=y.bind(void 0,C),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,l(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!Y||Y.emitClose!==!1,this.autoDestroy=!Y||Y.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[h]=[]}function l(Y){Y.buffered=[],Y.bufferedIndex=0,Y.allBuffers=!0,Y.allNoop=!0}x.prototype.getBuffer=function(){return K(this.buffered,this.bufferedIndex)},G(x.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function $0(Y){let C=this instanceof c2();if(!C&&!Z($0,this))return new $0(Y);if(this._writableState=new x(Y,this,C),Y){if(typeof Y.write==="function")this._write=Y.write;if(typeof Y.writev==="function")this._writev=Y.writev;if(typeof Y.destroy==="function")this._destroy=Y.destroy;if(typeof Y.final==="function")this._final=Y.final;if(typeof Y.construct==="function")this._construct=Y.construct;if(Y.signal)L(Y.signal,this)}M.call(this,Y),f.construct(this,()=>{let u=this._writableState;if(!u.writing)V0(this,u);O(this,u)})}G($0,w,{__proto__:null,value:function(Y){if(Z(this,Y))return!0;if(this!==$0)return!1;return Y&&Y._writableState instanceof x}}),$0.prototype.pipe=function(){g(this,new j)};function Z0(Y,C,u,e){let r=Y._writableState;if(typeof u==="function")e=u,u=r.defaultEncoding;else{if(!u)u=r.defaultEncoding;else if(u!=="buffer"&&!k.isEncoding(u))throw new P(u);if(typeof e!=="function")e=c}if(C===null)throw new _;else if(!r.objectMode)if(typeof C==="string"){if(r.decodeStrings!==!1)C=k.from(C,u),u="buffer"}else if(C instanceof k)u="buffer";else if(M._isUint8Array(C))C=M._uint8ArrayToBuffer(C),u="buffer";else throw new N("chunk",["string","Buffer","Uint8Array"],C);let s;if(r.ending)s=new X;else if(r.destroyed)s=new n("write");if(s)return Q.nextTick(e,s),g(Y,s,!0),s;return r.pendingcb++,F0(Y,r,C,u,e)}$0.prototype.write=function(Y,C,u){return Z0(this,Y,C,u)===!0},$0.prototype.cork=function(){this._writableState.corked++},$0.prototype.uncork=function(){let Y=this._writableState;if(Y.corked){if(Y.corked--,!Y.writing)V0(this,Y)}},$0.prototype.setDefaultEncoding=function(Y){if(typeof Y==="string")Y=V(Y);if(!k.isEncoding(Y))throw new P(Y);return this._writableState.defaultEncoding=Y,this};function F0(Y,C,u,e,r){let s=C.objectMode?1:u.length;C.length+=s;let T=C.lengthu.bufferedIndex)V0(Y,u);if(e)if(u.afterWriteTickInfo!==null&&u.afterWriteTickInfo.cb===r)u.afterWriteTickInfo.count++;else u.afterWriteTickInfo={count:1,cb:r,stream:Y,state:u},Q.nextTick(i,u.afterWriteTickInfo);else U0(Y,u,1,r)}}function i({stream:Y,state:C,count:u,cb:e}){return C.afterWriteTickInfo=null,U0(Y,C,u,e)}function U0(Y,C,u,e){if(!C.ending&&!Y.destroyed&&C.length===0&&C.needDrain)C.needDrain=!1,Y.emit("drain");while(u-- >0)C.pendingcb--,e();if(C.destroyed)m(C);O(Y,C)}function m(Y){if(Y.writing)return;for(let r=Y.bufferedIndex;r1&&Y._writev){C.pendingcb-=s-1;let t=C.allNoop?c:(Q0)=>{for(let M0=T;M0256)u.splice(0,T),C.bufferedIndex=0;else C.bufferedIndex=T}C.bufferProcessing=!1}$0.prototype._write=function(Y,C,u){if(this._writev)this._writev([{chunk:Y,encoding:C}],u);else throw new H("_write()")},$0.prototype._writev=null,$0.prototype.end=function(Y,C,u){let e=this._writableState;if(typeof Y==="function")u=Y,Y=null,C=null;else if(typeof C==="function")u=C,C=null;let r;if(Y!==null&&Y!==void 0){let s=Z0(this,Y,C);if(s instanceof J)r=s}if(e.corked)e.corked=1,this.uncork();if(r);else if(!e.errored&&!e.ending)e.ending=!0,O(this,e,!0),e.ended=!0;else if(e.finished)r=new d("end");else if(e.destroyed)r=new n("end");if(typeof u==="function")if(r||e.finished)Q.nextTick(u,r);else e[h].push(u);return this};function w0(Y){return Y.ending&&!Y.destroyed&&Y.constructed&&Y.length===0&&!Y.errored&&Y.buffered.length===0&&!Y.finished&&!Y.writing&&!Y.errorEmitted&&!Y.closeEmitted}function S(Y,C){let u=!1;function e(r){if(u){g(Y,r!==null&&r!==void 0?r:v());return}if(u=!0,C.pendingcb--,r){let s=C[h].splice(0);for(let T=0;T{if(w0(r))E(e,r);else r.pendingcb--},Y,C);else if(w0(C))C.pendingcb++,E(Y,C)}}}function E(Y,C){C.pendingcb--,C.finished=!0;let u=C[h].splice(0);for(let e=0;e{var Q=D1(),K=(t0(),X0(K2)),{isReadable:J,isWritable:Z,isIterable:G,isNodeStream:W,isReadableNodeStream:B,isWritableNodeStream:V,isDuplexNodeStream:U,isReadableStream:w,isWritableStream:F}=b2(),M=s2(),{AbortError:k,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:L}}=a0(),{destroyer:D}=o1(),z=c2(),N=f8(),H=n5(),{createDeferredPromise:v}=e0(),j=a9(),n=globalThis.Blob||K.Blob,d=typeof n<"u"?function(h){return h instanceof n}:function(h){return!1},_=globalThis.AbortController||O6().AbortController,{FunctionPrototypeCall:X}=P0();class P extends z{constructor(h){super(h);if((h===null||h===void 0?void 0:h.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((h===null||h===void 0?void 0:h.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}q.exports=function h(x,l){if(U(x))return x;if(B(x))return c({readable:x});if(V(x))return c({writable:x});if(W(x))return c({writable:!1,readable:!1});if(w(x))return c({readable:N.fromWeb(x)});if(F(x))return c({writable:H.fromWeb(x)});if(typeof x==="function"){let{value:Z0,write:F0,final:p,destroy:W0}=g(x);if(G(Z0))return j(P,Z0,{objectMode:!0,write:F0,final:p,destroy:W0});let y=Z0===null||Z0===void 0?void 0:Z0.then;if(typeof y==="function"){let i,U0=X(y,Z0,(m)=>{if(m!=null)throw new L("nully","body",m)},(m)=>{D(i,m)});return i=new P({objectMode:!0,readable:!1,write:F0,final(m){p(async()=>{try{await U0,Q.nextTick(m,null)}catch(V0){Q.nextTick(m,V0)}})},destroy:W0})}throw new L("Iterable, AsyncIterable or AsyncFunction",l,Z0)}if(d(x))return h(x.arrayBuffer());if(G(x))return j(P,x,{objectMode:!0,writable:!1});if(w(x===null||x===void 0?void 0:x.readable)&&F(x===null||x===void 0?void 0:x.writable))return P.fromWeb(x);if(typeof(x===null||x===void 0?void 0:x.writable)==="object"||typeof(x===null||x===void 0?void 0:x.readable)==="object"){let Z0=x!==null&&x!==void 0&&x.readable?B(x===null||x===void 0?void 0:x.readable)?x===null||x===void 0?void 0:x.readable:h(x.readable):void 0,F0=x!==null&&x!==void 0&&x.writable?V(x===null||x===void 0?void 0:x.writable)?x===null||x===void 0?void 0:x.writable:h(x.writable):void 0;return c({readable:Z0,writable:F0})}let $0=x===null||x===void 0?void 0:x.then;if(typeof $0==="function"){let Z0;return X($0,x,(F0)=>{if(F0!=null)Z0.push(F0);Z0.push(null)},(F0)=>{D(Z0,F0)}),Z0=new P({objectMode:!0,writable:!1,read(){}})}throw new f(l,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],x)};function g(h){let{promise:x,resolve:l}=v(),$0=new _,Z0=$0.signal;return{value:h(async function*(){while(!0){let F0=x;x=null;let{chunk:p,done:W0,cb:y}=await F0;if(Q.nextTick(y),W0)return;if(Z0.aborted)throw new k(void 0,{cause:Z0.reason});({promise:x,resolve:l}=v()),yield p}}(),{signal:Z0}),write(F0,p,W0){let y=l;l=null,y({chunk:F0,done:!1,cb:W0})},final(F0){let p=l;l=null,p({done:!0,cb:F0})},destroy(F0,p){$0.abort(),p(F0)}}}function c(h){let x=h.readable&&typeof h.readable.read!=="function"?N.wrap(h.readable):h.readable,l=h.writable,$0=!!J(x),Z0=!!Z(l),F0,p,W0,y,i;function U0(m){let V0=y;if(y=null,V0)V0(m);else if(m)i.destroy(m)}if(i=new P({readableObjectMode:!!(x!==null&&x!==void 0&&x.readableObjectMode),writableObjectMode:!!(l!==null&&l!==void 0&&l.writableObjectMode),readable:$0,writable:Z0}),Z0)M(l,(m)=>{if(Z0=!1,m)D(x,m);U0(m)}),i._write=function(m,V0,w0){if(l.write(m,V0))w0();else F0=w0},i._final=function(m){l.end(),p=m},l.on("drain",function(){if(F0){let m=F0;F0=null,m()}}),l.on("finish",function(){if(p){let m=p;p=null,m()}});if($0)M(x,(m)=>{if($0=!1,m)D(x,m);U0(m)}),x.on("readable",function(){if(W0){let m=W0;W0=null,m()}}),x.on("end",function(){i.push(null)}),i._read=function(){while(!0){let m=x.read();if(m===null){W0=i._read;return}if(!i.push(m))return}};return i._destroy=function(m,V0){if(!m&&y!==null)m=new k;if(W0=null,F0=null,p=null,y===null)V0(m);else y=V0,D(l,m),D(x,m)},i}}),c2=g0(($,q)=>{var{ObjectDefineProperties:Q,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:J,ObjectSetPrototypeOf:Z}=P0();q.exports=B;var G=f8(),W=n5();Z(B.prototype,G.prototype),Z(B,G);{let F=J(W.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:Q,Symbol:K}=P0();q.exports=B;var{ERR_METHOD_NOT_IMPLEMENTED:J}=a0().codes,Z=c2(),{getHighWaterMark:G}=v8();Q(B.prototype,Z.prototype),Q(B,Z);var W=K("kCallback");function B(w){if(!(this instanceof B))return new B(w);let F=w?G(this,w,"readableHighWaterMark",!0):null;if(F===0)w={...w,highWaterMark:null,readableHighWaterMark:F,writableHighWaterMark:w.writableHighWaterMark||0};if(Z.call(this,w),this._readableState.sync=!1,this[W]=null,w){if(typeof w.transform==="function")this._transform=w.transform;if(typeof w.flush==="function")this._flush=w.flush}this.on("prefinish",U)}function V(w){if(typeof this._flush==="function"&&!this.destroyed)this._flush((F,M)=>{if(F){if(w)w(F);else this.destroy(F);return}if(M!=null)this.push(M);if(this.push(null),w)w()});else if(this.push(null),w)w()}function U(){if(this._final!==V)V.call(this)}B.prototype._final=V,B.prototype._transform=function(w,F,M){throw new J("_transform()")},B.prototype._write=function(w,F,M){let k=this._readableState,f=this._writableState,L=k.length;this._transform(w,F,(D,z)=>{if(D){M(D);return}if(z!=null)this.push(z);if(f.ended||L===k.length||k.length{var{ObjectSetPrototypeOf:Q}=P0();q.exports=J;var K=l9();Q(J.prototype,K.prototype),Q(J,K);function J(Z){if(!(this instanceof J))return new J(Z);K.call(this,Z)}J.prototype._transform=function(Z,G,W){W(null,Z)}}),d5=g0(($,q)=>{var Q=D1(),{ArrayIsArray:K,Promise:J,SymbolAsyncIterator:Z,SymbolDispose:G}=P0(),W=s2(),{once:B}=e0(),V=o1(),U=c2(),{aggregateTwoErrors:w,codes:{ERR_INVALID_ARG_TYPE:F,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:k,ERR_STREAM_DESTROYED:f,ERR_STREAM_PREMATURE_CLOSE:L},AbortError:D}=a0(),{validateFunction:z,validateAbortSignal:N}=P6(),{isIterable:H,isReadable:v,isReadableNodeStream:j,isNodeStream:n,isTransformStream:d,isWebStream:_,isReadableStream:X,isReadableFinished:P}=b2(),g=globalThis.AbortController||O6().AbortController,c,h,x;function l(m,V0,w0){let S=!1;m.on("close",()=>{S=!0});let b=W(m,{readable:V0,writable:w0},(O)=>{S=!O});return{destroy:(O)=>{if(S)return;S=!0,V.destroyer(m,O||new f("pipe"))},cleanup:b}}function $0(m){return z(m[m.length-1],"streams[stream.length - 1]"),m.pop()}function Z0(m){if(H(m))return m;else if(j(m))return F0(m);throw new F("val",["Readable","Iterable","AsyncIterable"],m)}async function*F0(m){if(!h)h=f8();yield*h.prototype[Z].call(m)}async function p(m,V0,w0,{end:S}){let b,O=null,E=(R)=>{if(R)b=R;if(O){let Y=O;O=null,Y()}},a=()=>new J((R,Y)=>{if(b)Y(b);else O=()=>{if(b)Y(b);else R()}});V0.on("drain",E);let K0=W(V0,{readable:!1},E);try{if(V0.writableNeedDrain)await a();for await(let R of m)if(!V0.write(R))await a();if(S)V0.end(),await a();w0()}catch(R){w0(b!==R?w(b,R):R)}finally{K0(),V0.off("drain",E)}}async function W0(m,V0,w0,{end:S}){if(d(V0))V0=V0.writable;let b=V0.getWriter();try{for await(let O of m)await b.ready,b.write(O).catch(()=>{});if(await b.ready,S)await b.close();w0()}catch(O){try{await b.abort(O),w0(O)}catch(E){w0(E)}}}function y(...m){return i(m,B($0(m)))}function i(m,V0,w0){if(m.length===1&&K(m[0]))m=m[0];if(m.length<2)throw new k("streams");let S=new g,b=S.signal,O=w0===null||w0===void 0?void 0:w0.signal,E=[];N(O,"options.signal");function a(){r(new D)}x=x||e0().addAbortListener;let K0;if(O)K0=x(O,a);let R,Y,C=[],u=0;function e(Q0){r(Q0,--u===0)}function r(Q0,M0){var I0;if(Q0&&(!R||R.code==="ERR_STREAM_PREMATURE_CLOSE"))R=Q0;if(!R&&!M0)return;while(C.length)C.shift()(R);if((I0=K0)===null||I0===void 0||I0[G](),S.abort(),M0){if(!R)E.forEach((m0)=>m0());Q.nextTick(V0,R,Y)}}let s;for(let Q0=0;Q00,p0=I0||(w0===null||w0===void 0?void 0:w0.end)!==!1,q2=Q0===m.length-1;if(n(M0)){let O0=function(u0){if(u0&&u0.name!=="AbortError"&&u0.code!=="ERR_STREAM_PREMATURE_CLOSE")e(u0)};var T=O0;if(p0){let{destroy:u0,cleanup:E1}=l(M0,I0,m0);if(C.push(u0),v(M0)&&q2)E.push(E1)}if(M0.on("error",O0),v(M0)&&q2)E.push(()=>{M0.removeListener("error",O0)})}if(Q0===0)if(typeof M0==="function"){if(s=M0({signal:b}),!H(s))throw new M("Iterable, AsyncIterable or Stream","source",s)}else if(H(M0)||j(M0)||d(M0))s=M0;else s=U.from(M0);else if(typeof M0==="function"){if(d(s)){var t;s=Z0((t=s)===null||t===void 0?void 0:t.readable)}else s=Z0(s);if(s=M0(s,{signal:b}),I0){if(!H(s,!0))throw new M("AsyncIterable",`transform[${Q0-1}]`,s)}else{var G0;if(!c)c=r9();let O0=new c({objectMode:!0}),u0=(G0=s)===null||G0===void 0?void 0:G0.then;if(typeof u0==="function")u++,u0.call(s,(R2)=>{if(Y=R2,R2!=null)O0.write(R2);if(p0)O0.end();Q.nextTick(e)},(R2)=>{O0.destroy(R2),Q.nextTick(e,R2)});else if(H(s,!0))u++,p(s,O0,e,{end:p0});else if(X(s)||d(s)){let R2=s.readable||s;u++,p(R2,O0,e,{end:p0})}else throw new M("AsyncIterable or Promise","destination",s);s=O0;let{destroy:E1,cleanup:_1}=l(s,!1,!0);if(C.push(E1),q2)E.push(_1)}}else if(n(M0)){if(j(s)){u+=2;let O0=U0(s,M0,e,{end:p0});if(v(M0)&&q2)E.push(O0)}else if(d(s)||X(s)){let O0=s.readable||s;u++,p(O0,M0,e,{end:p0})}else if(H(s))u++,p(s,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else if(_(M0)){if(j(s))u++,W0(Z0(s),M0,e,{end:p0});else if(X(s)||H(s))u++,W0(s,M0,e,{end:p0});else if(d(s))u++,W0(s.readable,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else s=U.from(M0)}if(b!==null&&b!==void 0&&b.aborted||O!==null&&O!==void 0&&O.aborted)Q.nextTick(a);return s}function U0(m,V0,w0,{end:S}){let b=!1;if(V0.on("close",()=>{if(!b)w0(new L)}),m.pipe(V0,{end:!1}),S){let E=function(){b=!0,V0.end()};var O=E;if(P(m))Q.nextTick(E);else m.once("end",E)}else w0();return W(m,{readable:!0,writable:!1},(E)=>{let a=m._readableState;if(E&&E.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted)m.once("end",w0).once("error",w0);else w0(E)}),W(V0,{readable:!1,writable:!0},w0)}q.exports={pipelineImpl:i,pipeline:y}}),s9=g0(($,q)=>{var{pipeline:Q}=d5(),K=c2(),{destroyer:J}=o1(),{isNodeStream:Z,isReadable:G,isWritable:W,isWebStream:B,isTransformStream:V,isWritableStream:U,isReadableStream:w}=b2(),{AbortError:F,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:k}}=a0(),f=s2();q.exports=function(...L){if(L.length===0)throw new k("streams");if(L.length===1)return K.from(L[0]);let D=[...L];if(typeof L[0]==="function")L[0]=K.from(L[0]);if(typeof L[L.length-1]==="function"){let g=L.length-1;L[g]=K.from(L[g])}for(let g=0;g0&&!(W(L[g])||U(L[g])||V(L[g])))throw new M(`streams[${g}]`,D[g],"must be writable")}let z,N,H,v,j;function n(g){let c=v;if(v=null,c)c(g);else if(g)j.destroy(g);else if(!P&&!X)j.destroy()}let d=L[0],_=Q(L,n),X=!!(W(d)||U(d)||V(d)),P=!!(G(_)||w(_)||V(_));if(j=new K({writableObjectMode:!!(d!==null&&d!==void 0&&d.writableObjectMode),readableObjectMode:!!(_!==null&&_!==void 0&&_.readableObjectMode),writable:X,readable:P}),X){if(Z(d))j._write=function(c,h,x){if(d.write(c,h))x();else z=x},j._final=function(c){d.end(),N=c},d.on("drain",function(){if(z){let c=z;z=null,c()}});else if(B(d)){let c=(V(d)?d.writable:d).getWriter();j._write=async function(h,x,l){try{await c.ready,c.write(h).catch(()=>{}),l()}catch($0){l($0)}},j._final=async function(h){try{await c.ready,c.close().catch(()=>{}),N=h}catch(x){h(x)}}}let g=V(_)?_.readable:_;f(g,()=>{if(N){let c=N;N=null,c()}})}if(P){if(Z(_))_.on("readable",function(){if(H){let g=H;H=null,g()}}),_.on("end",function(){j.push(null)}),j._read=function(){while(!0){let g=_.read();if(g===null){H=j._read;return}if(!j.push(g))return}};else if(B(_)){let g=(V(_)?_.readable:_).getReader();j._read=async function(){while(!0)try{let{value:c,done:h}=await g.read();if(!j.push(c))return;if(h){j.push(null);return}}catch{return}}}}return j._destroy=function(g,c){if(!g&&v!==null)g=new F;if(H=null,z=null,N=null,v===null)c(g);else if(v=c,Z(_))J(_,g)},j}}),hV=g0(($,q)=>{var Q=globalThis.AbortController||O6().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:J,ERR_MISSING_ARGS:Z,ERR_OUT_OF_RANGE:G},AbortError:W}=a0(),{validateAbortSignal:B,validateInteger:V,validateObject:U}=P6(),w=P0().Symbol("kWeak"),F=P0().Symbol("kResistStopPropagation"),{finished:M}=s2(),k=s9(),{addAbortSignalNoValidate:f}=H8(),{isWritable:L,isNodeStream:D}=b2(),{deprecate:z}=e0(),{ArrayPrototypePush:N,Boolean:H,MathFloor:v,Number:j,NumberIsNaN:n,Promise:d,PromiseReject:_,PromiseResolve:X,PromisePrototypeThen:P,Symbol:g}=P0(),c=g("kEmpty"),h=g("kEof");function x(O,E){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");if(D(O)&&!L(O))throw new K("stream",O,"must be writable");let a=k(this,O);if(E!==null&&E!==void 0&&E.signal)f(E.signal,a);return a}function l(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");let a=1;if((E===null||E===void 0?void 0:E.concurrency)!=null)a=v(E.concurrency);let K0=a-1;if((E===null||E===void 0?void 0:E.highWaterMark)!=null)K0=v(E.highWaterMark);return V(a,"options.concurrency",1),V(K0,"options.highWaterMark",0),K0+=a,async function*(){let R=e0().AbortSignalAny([E===null||E===void 0?void 0:E.signal].filter(H)),Y=this,C=[],u={signal:R},e,r,s=!1,T=0;function t(){s=!0,G0()}function G0(){T-=1,Q0()}function Q0(){if(r&&!s&&T=K0||T>=a))await new d((m0)=>{r=m0})}C.push(h)}catch(I0){let m0=_(I0);P(m0,G0,t),C.push(m0)}finally{if(s=!0,e)e(),e=null}}M0();try{while(!0){while(C.length>0){let I0=await C[0];if(I0===h)return;if(R.aborted)throw new W;if(I0!==c)yield I0;C.shift(),Q0()}await new d((I0)=>{e=I0})}}finally{if(s=!0,r)r(),r=null}}.call(this)}function $0(O=void 0){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");return async function*(){let E=0;for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W({cause:O.signal.reason});yield[E++,K0]}}.call(this)}async function Z0(O,E=void 0){for await(let a of y.call(this,O,E))return!0;return!1}async function F0(O,E=void 0){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);return!await Z0.call(this,async(...a)=>{return!await O(...a)},E)}async function p(O,E){for await(let a of y.call(this,O,E))return a;return}async function W0(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){return await O(K0,R),c}for await(let K0 of l.call(this,a,E));}function y(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){if(await O(K0,R))return K0;return c}return l.call(this,a,E)}class i extends Z{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function U0(O,E,a){var K0;if(typeof O!=="function")throw new J("reducer",["Function","AsyncFunction"],O);if(a!=null)U(a,"options");if((a===null||a===void 0?void 0:a.signal)!=null)B(a.signal,"options.signal");let R=arguments.length>1;if(a!==null&&a!==void 0&&(K0=a.signal)!==null&&K0!==void 0&&K0.aborted){let r=new W(void 0,{cause:a.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(r)),r}let Y=new Q,C=Y.signal;if(a!==null&&a!==void 0&&a.signal){let r={once:!0,[w]:this,[F]:!0};a.signal.addEventListener("abort",()=>Y.abort(),r)}let u=!1;try{for await(let r of this){var e;if(u=!0,a!==null&&a!==void 0&&(e=a.signal)!==null&&e!==void 0&&e.aborted)throw new W;if(!R)E=r,R=!0;else E=await O(E,r,{signal:C})}if(!u&&!R)throw new i}finally{Y.abort()}return E}async function m(O){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");let E=[];for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W(void 0,{cause:O.signal.reason});N(E,K0)}return E}function V0(O,E){let a=l.call(this,O,E);return async function*(){for await(let K0 of a)yield*K0}.call(this)}function w0(O){if(O=j(O),n(O))return 0;if(O<0)throw new G("number",">= 0",O);return O}function S(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O--<=0)yield R}}.call(this)}function b(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O-- >0)yield R;if(O<=0)return}}.call(this)}q.exports.streamReturningOperators={asIndexedPairs:z($0,"readable.asIndexedPairs will be removed in a future version."),drop:S,filter:y,flatMap:V0,map:l,take:b,compose:x},q.exports.promiseReturningOperators={every:F0,forEach:W0,reduce:U0,toArray:m,some:Z0,find:p}}),t9=g0(($,q)=>{var{ArrayPrototypePop:Q,Promise:K}=P0(),{isIterable:J,isNodeStream:Z,isWebStream:G}=b2(),{pipelineImpl:W}=d5(),{finished:B}=s2();e9();function V(...U){return new K((w,F)=>{let M,k,f=U[U.length-1];if(f&&typeof f==="object"&&!Z(f)&&!J(f)&&!G(f)){let L=Q(U);M=L.signal,k=L.end}W(U,(L,D)=>{if(L)F(L);else w(D)},{signal:M,end:k})})}q.exports={finished:B,pipeline:V}}),e9=g0(($,q)=>{var{Buffer:Q}=(t0(),X0(K2)),{ObjectDefineProperty:K,ObjectKeys:J,ReflectApply:Z}=P0(),{promisify:{custom:G}}=e0(),{streamReturningOperators:W,promiseReturningOperators:B}=hV(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:V}}=a0(),U=s9(),{setDefaultHighWaterMark:w,getDefaultHighWaterMark:F}=v8(),{pipeline:M}=d5(),{destroyer:k}=o1(),f=s2(),L=t9(),D=b2(),z=q.exports=b5().Stream;z.isDestroyed=D.isDestroyed,z.isDisturbed=D.isDisturbed,z.isErrored=D.isErrored,z.isReadable=D.isReadable,z.isWritable=D.isWritable,z.Readable=f8();for(let H of J(W)){let v=function(...n){if(new.target)throw V();return z.Readable.from(Z(j,this,n))},j=W[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(let H of J(B)){let v=function(...n){if(new.target)throw V();return Z(j,this,n)},j=B[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}z.Writable=n5(),z.Duplex=c2(),z.Transform=l9(),z.PassThrough=r9(),z.pipeline=M;var{addAbortSignal:N}=H8();z.addAbortSignal=N,z.finished=f,z.destroy=k,z.compose=U,z.setDefaultHighWaterMark=w,z.getDefaultHighWaterMark=F,K(z,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return L}}),K(M,G,{__proto__:null,enumerable:!0,get(){return L.pipeline}}),K(f,G,{__proto__:null,enumerable:!0,get(){return L.finished}}),z.Stream=z,z._isUint8Array=function(H){return H instanceof Uint8Array},z._uint8ArrayToBuffer=function(H){return Q.from(H.buffer,H.byteOffset,H.byteLength)}}),xV=g0(($,q)=>{var Q=a1();{let K=e9(),J=t9(),Z=K.Readable.destroy;q.exports=K.Readable,q.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,q.exports._isUint8Array=K._isUint8Array,q.exports.isDisturbed=K.isDisturbed,q.exports.isErrored=K.isErrored,q.exports.isReadable=K.isReadable,q.exports.Readable=K.Readable,q.exports.Writable=K.Writable,q.exports.Duplex=K.Duplex,q.exports.Transform=K.Transform,q.exports.PassThrough=K.PassThrough,q.exports.addAbortSignal=K.addAbortSignal,q.exports.finished=K.finished,q.exports.destroy=K.destroy,q.exports.destroy=Z,q.exports.pipeline=K.pipeline,q.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return J}}),q.exports.Stream=K.Stream}q.exports.default=q.exports});$$.exports=xV()});var m5=N0((Dz,Q$)=>{Q$.exports=a1()});var n2=N0((J2)=>{J2.base64=!0;J2.array=!0;J2.string=!0;J2.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";J2.nodebuffer=typeof Buffer<"u";J2.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")J2.blob=!1;else{R8=new ArrayBuffer(0);try{J2.blob=new Blob([R8],{type:"application/zip"}).size===0}catch($){try{p5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,I8=new p5,I8.append(R8),J2.blob=I8.getBlob("application/zip").size===0}catch(q){J2.blob=!1}}}var R8,p5,I8;try{J2.nodestream=!!m5().Readable}catch($){J2.nodestream=!1}});var o5=N0((i5)=>{var OV=T0(),PV=n2(),A2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i5.encode=function($){var q=[],Q,K,J,Z,G,W,B,V=0,U=$.length,w=U,F=OV.getTypeOf($)!=="string";while(V<$.length){if(w=U-V,!F)Q=$.charCodeAt(V++),K=V>2,G=(Q&3)<<4|K>>4,W=w>1?(K&15)<<2|J>>6:64,B=w>2?J&63:64,q.push(A2.charAt(Z)+A2.charAt(G)+A2.charAt(W)+A2.charAt(B))}return q.join("")};i5.decode=function($){var q,Q,K,J,Z,G,W,B=0,V=0,U="data:";if($.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var w=$.length*3/4;if($.charAt($.length-1)===A2.charAt(64))w--;if($.charAt($.length-2)===A2.charAt(64))w--;if(w%1!==0)throw Error("Invalid base64 input, bad content length.");var F;if(PV.uint8array)F=new Uint8Array(w|0);else F=Array(w|0);while(B<$.length){if(J=A2.indexOf($.charAt(B++)),Z=A2.indexOf($.charAt(B++)),G=A2.indexOf($.charAt(B++)),W=A2.indexOf($.charAt(B++)),q=J<<2|Z>>4,Q=(Z&15)<<4|G>>2,K=(G&3)<<6|W,F[V++]=q,G!==64)F[V++]=Q;if(W!==64)F[V++]=K}return F}});var T6=N0((vz,q$)=>{q$.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var q=new Buffer($);return q.fill(0),q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var V$=N0((fz,J$)=>{var K$=global.MutationObserver||global.WebKitMutationObserver,u6;if(K$)j8=0,a5=new K$(C8),g8=global.document.createTextNode(""),a5.observe(g8,{characterData:!0}),u6=function(){g8.data=j8=++j8%2};else if(!global.setImmediate&&typeof global.MessageChannel<"u")A8=new global.MessageChannel,A8.port1.onmessage=C8,u6=function(){A8.port2.postMessage(0)};else if("document"in global&&"onreadystatechange"in global.document.createElement("script"))u6=function(){var $=global.document.createElement("script");$.onreadystatechange=function(){C8(),$.onreadystatechange=null,$.parentNode.removeChild($),$=null},global.document.documentElement.appendChild($)};else u6=function(){setTimeout(C8,0)};var j8,a5,g8,A8,l5,S6=[];function C8(){l5=!0;var $,q,Q=S6.length;while(Q){q=S6,S6=[],$=-1;while(++${var uV=V$();function l1(){}var o0={},U$=["REJECTED"],r5=["FULFILLED"],Z$=["PENDING"];B$.exports=t2;function t2($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Z$,this.queue=[],this.outcome=void 0,$!==l1)G$(this,$)}t2.prototype.finally=function($){if(typeof $!=="function")return this;var q=this.constructor;return this.then(Q,K);function Q(J){function Z(){return J}return q.resolve($()).then(Z)}function K(J){function Z(){throw J}return q.resolve($()).then(Z)}};t2.prototype.catch=function($){return this.then(null,$)};t2.prototype.then=function($,q){if(typeof $!=="function"&&this.state===r5||typeof q!=="function"&&this.state===U$)return this;var Q=new this.constructor(l1);if(this.state!==Z$){var K=this.state===r5?$:q;s5(Q,K,this.outcome)}else this.queue.push(new E6(Q,$,q));return Q};function E6($,q,Q){if(this.promise=$,typeof q==="function")this.onFulfilled=q,this.callFulfilled=this.otherCallFulfilled;if(typeof Q==="function")this.onRejected=Q,this.callRejected=this.otherCallRejected}E6.prototype.callFulfilled=function($){o0.resolve(this.promise,$)};E6.prototype.otherCallFulfilled=function($){s5(this.promise,this.onFulfilled,$)};E6.prototype.callRejected=function($){o0.reject(this.promise,$)};E6.prototype.otherCallRejected=function($){s5(this.promise,this.onRejected,$)};function s5($,q,Q){uV(function(){var K;try{K=q(Q)}catch(J){return o0.reject($,J)}if(K===$)o0.reject($,TypeError("Cannot resolve promise with itself"));else o0.resolve($,K)})}o0.resolve=function($,q){var Q=W$(SV,q);if(Q.status==="error")return o0.reject($,Q.value);var K=Q.value;if(K)G$($,K);else{$.state=r5,$.outcome=q;var J=-1,Z=$.queue.length;while(++J{var t5=null;if(typeof Promise<"u")t5=Promise;else t5=z$();F$.exports={Promise:t5}});var w$=N0((M$)=>{(function($,q){if($.setImmediate)return;var Q=1,K={},J=!1,Z=$.document,G;function W(z){if(typeof z!=="function")z=Function(""+z);var N=Array(arguments.length-1);for(var H=0;H"u"?typeof global>"u"?M$:global:self)});var T0=N0((_0)=>{var e2=n2(),nV=o5(),s1=T6(),e5=r1();w$();function dV($){var q=null;if(e2.uint8array)q=new Uint8Array($.length);else q=Array($.length);return y8($,q)}_0.newBlob=function($,q){_0.checkSupport("blob");try{return new Blob([$],{type:q})}catch(J){try{var Q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,K=new Q;return K.append($),K.getBlob(q)}catch(Z){throw Error("Bug : can't construct the Blob.")}}};function _6($){return $}function y8($,q){for(var Q=0;Q<$.length;++Q)q[Q]=$.charCodeAt(Q)&255;return q}var X8={stringifyByChunk:function($,q,Q){var K=[],J=0,Z=$.length;if(Z<=Q)return String.fromCharCode.apply(null,$);while(J1)try{return X8.stringifyByChunk($,Q,q)}catch(J){q=Math.floor(q/2)}return X8.stringifyByChar($)}_0.applyFromCharCode=c6;function h8($,q){for(var Q=0;Q<$.length;Q++)q[Q]=$[Q];return q}var $1={};$1.string={string:_6,array:function($){return y8($,Array($.length))},arraybuffer:function($){return $1.string.uint8array($).buffer},uint8array:function($){return y8($,new Uint8Array($.length))},nodebuffer:function($){return y8($,s1.allocBuffer($.length))}};$1.array={string:c6,array:_6,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom($)}};$1.arraybuffer={string:function($){return c6(new Uint8Array($))},array:function($){return h8(new Uint8Array($),Array($.byteLength))},arraybuffer:_6,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom(new Uint8Array($))}};$1.uint8array={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:_6,nodebuffer:function($){return s1.newBufferFrom($)}};$1.nodebuffer={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $1.nodebuffer.uint8array($).buffer},uint8array:function($){return h8($,new Uint8Array($.length))},nodebuffer:_6};_0.transformTo=function($,q){if(!q)q="";if(!$)return q;_0.checkSupport($);var Q=_0.getTypeOf(q),K=$1[Q][$](q);return K};_0.resolve=function($){var q=$.split("/"),Q=[];for(var K=0;K"u")$[Q]=arguments[q][Q];return $};_0.prepareContent=function($,q,Q,K,J){var Z=e5.Promise.resolve(q).then(function(G){var W=e2.blob&&(G instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(G))!==-1);if(W&&typeof FileReader<"u")return new e5.Promise(function(B,V){var U=new FileReader;U.onload=function(w){B(w.target.result)},U.onerror=function(w){V(w.target.error)},U.readAsArrayBuffer(G)});else return G});return Z.then(function(G){var W=_0.getTypeOf(G);if(!W)return e5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(W==="arraybuffer")G=_0.transformTo("uint8array",G);else if(W==="string"){if(J)G=nV.decode(G);else if(Q){if(K!==!0)G=dV(G)}}return G})}});var V2=N0((gz,Y$)=>{function N$($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}N$.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,q){return this._listeners[$].push(q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,q){if(this._listeners[$])for(var Q=0;Q "+$;else return $}};Y$.exports=N$});var e1=N0((Q1)=>{var t1=T0(),L1=n2(),mV=T6(),x8=V2(),b6=Array(256);for(X2=0;X2<256;X2++)b6[X2]=X2>=252?6:X2>=248?5:X2>=240?4:X2>=224?3:X2>=192?2:1;var X2;b6[254]=b6[254]=1;var pV=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q},iV=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+b6[$[Q]]>q?Q:q},oV=function($){var q,Q,K,J,Z=$.length,G=Array(Z*2);for(Q=0,q=0;q4){G[Q++]=65533,q+=J-1;continue}K&=J===2?31:J===3?15:7;while(J>1&&q1){G[Q++]=65533;continue}if(K<65536)G[Q++]=K;else K-=65536,G[Q++]=55296|K>>10&1023,G[Q++]=56320|K&1023}if(G.length!==Q)if(G.subarray)G=G.subarray(0,Q);else G.length=Q;return t1.applyFromCharCode(G)};Q1.utf8encode=function(q){if(L1.nodebuffer)return mV.newBufferFrom(q,"utf-8");return pV(q)};Q1.utf8decode=function(q){if(L1.nodebuffer)return t1.transformTo("nodebuffer",q).toString("utf-8");return q=t1.transformTo(L1.uint8array?"uint8array":"array",q),oV(q)};function O8(){x8.call(this,"utf-8 decode"),this.leftOver=null}t1.inherits(O8,x8);O8.prototype.processChunk=function($){var q=t1.transformTo(L1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(L1.uint8array){var Q=q;q=new Uint8Array(Q.length+this.leftOver.length),q.set(this.leftOver,0),q.set(Q,this.leftOver.length)}else q=this.leftOver.concat(q);this.leftOver=null}var K=iV(q),J=q;if(K!==q.length)if(L1.uint8array)J=q.subarray(0,K),this.leftOver=q.subarray(K,q.length);else J=q.slice(0,K),this.leftOver=q.slice(K,q.length);this.push({data:Q1.utf8decode(J),meta:$.meta})};O8.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:Q1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};Q1.Utf8DecodeWorker=O8;function $4(){x8.call(this,"utf-8 encode")}t1.inherits($4,x8);$4.prototype.processChunk=function($){this.push({data:Q1.utf8encode($.data),meta:$.meta})};Q1.Utf8EncodeWorker=$4});var H$=N0((Xz,L$)=>{var k$=V2(),D$=T0();function Q4($){k$.call(this,"ConvertWorker to "+$),this.destType=$}D$.inherits(Q4,k$);Q4.prototype.processChunk=function($){this.push({data:D$.transformTo(this.destType,$.data),meta:$.meta})};L$.exports=Q4});var R$=N0((yz,f$)=>{var v$=m5().Readable,aV=T0();aV.inherits(q4,v$);function q4($,q,Q){v$.call(this,q),this._helper=$;var K=this;$.on("data",function(J,Z){if(!K.push(J))K._helper.pause();if(Q)Q(Z)}).on("error",function(J){K.emit("error",J)}).on("end",function(){K.push(null)})}q4.prototype._read=function(){this._helper.resume()};f$.exports=q4});var K4=N0((hz,j$)=>{var H1=T0(),lV=H$(),rV=V2(),sV=o5(),tV=n2(),eV=r1(),I$=null;if(tV.nodestream)try{I$=R$()}catch($){}function $U($,q,Q){switch($){case"blob":return H1.newBlob(H1.transformTo("arraybuffer",q),Q);case"base64":return sV.encode(q);default:return H1.transformTo($,q)}}function QU($,q){var Q,K=0,J=null,Z=0;for(Q=0;Q{D2.base64=!1;D2.binary=!1;D2.dir=!1;D2.createFolders=!0;D2.date=null;D2.compression=null;D2.compressionOptions=null;D2.comment=null;D2.unixPermissions=null;D2.dosPermissions=null});var V4=N0((Oz,g$)=>{var P8=T0(),T8=V2(),KU=16384;function $6($){T8.call(this,"DataWorker");var q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(Q){if(q.dataIsReady=!0,q.data=Q,q.max=Q&&Q.length||0,q.type=P8.getTypeOf(Q),!q.isPaused)q._tickAndRepeat()},function(Q){q.error(Q)})}P8.inherits($6,T8);$6.prototype.cleanUp=function(){T8.prototype.cleanUp.call(this),this.data=null};$6.prototype.resume=function(){if(!T8.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,P8.delay(this._tickAndRepeat,[],this);return!0};$6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)P8.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};$6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=KU,q=null,Q=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":q=this.data.substring(this.index,Q);break;case"uint8array":q=this.data.subarray(this.index,Q);break;case"array":case"nodebuffer":q=this.data.slice(this.index,Q);break}return this.index=Q,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})}};g$.exports=$6});var u8=N0((Pz,X$)=>{var JU=T0();function VU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var A$=VU();function UU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}function ZU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q.charCodeAt(G))&255];return $^-1}X$.exports=function(q,Q){if(typeof q>"u"||!q.length)return 0;var K=JU.getTypeOf(q)!=="string";if(K)return UU(Q|0,q,q.length,0);else return ZU(Q|0,q,q.length,0)}});var Z4=N0((Tz,h$)=>{var y$=V2(),GU=u8(),WU=T0();function U4(){y$.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}WU.inherits(U4,y$);U4.prototype.processChunk=function($){this.streamInfo.crc32=GU($.data,this.streamInfo.crc32||0),this.push($)};h$.exports=U4});var O$=N0((uz,x$)=>{var BU=T0(),G4=V2();function W4($){G4.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}BU.inherits(W4,G4);W4.prototype.processChunk=function($){if($){var q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=q+$.data.length}G4.prototype.processChunk.call(this,$)};x$.exports=W4});var S8=N0((Sz,u$)=>{var P$=r1(),T$=V4(),zU=Z4(),B4=O$();function z4($,q,Q,K,J){this.compressedSize=$,this.uncompressedSize=q,this.crc32=Q,this.compression=K,this.compressedContent=J}z4.prototype={getContentWorker:function(){var $=new T$(P$.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new B4("data_length")),q=this;return $.on("end",function(){if(this.streamInfo.data_length!==q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new T$(P$.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};z4.createWorkerFrom=function($,q,Q){return $.pipe(new zU).pipe(new B4("uncompressedSize")).pipe(q.compressWorker(Q)).pipe(new B4("compressedSize")).withStreamInfo("compression",q)};u$.exports=z4});var c$=N0((Ez,_$)=>{var FU=K4(),MU=V4(),F4=e1(),M4=S8(),S$=V2(),w4=function($,q,Q){this.name=$,this.dir=Q.dir,this.date=Q.date,this.comment=Q.comment,this.unixPermissions=Q.unixPermissions,this.dosPermissions=Q.dosPermissions,this._data=q,this._dataBinary=Q.binary,this.options={compression:Q.compression,compressionOptions:Q.compressionOptions}};w4.prototype={internalStream:function($){var q=null,Q="string";try{if(!$)throw Error("No output type specified.");Q=$.toLowerCase();var K=Q==="string"||Q==="text";if(Q==="binarystring"||Q==="text")Q="string";q=this._decompressWorker();var J=!this._dataBinary;if(J&&!K)q=q.pipe(new F4.Utf8EncodeWorker);if(!J&&K)q=q.pipe(new F4.Utf8DecodeWorker)}catch(Z){q=new S$("error"),q.error(Z)}return new FU(q,Q,"")},async:function($,q){return this.internalStream($).accumulate(q)},nodeStream:function($,q){return this.internalStream($||"nodebuffer").toNodejsStream(q)},_compressWorker:function($,q){if(this._data instanceof M4&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var Q=this._decompressWorker();if(!this._dataBinary)Q=Q.pipe(new F4.Utf8EncodeWorker);return M4.createWorkerFrom(Q,$,q)}},_decompressWorker:function(){if(this._data instanceof M4)return this._data.getContentWorker();else if(this._data instanceof S$)return this._data;else return new MU(this._data)}};var E$=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],wU=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(n6=0;n6{var NU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function YU($,q){return Object.prototype.hasOwnProperty.call($,q)}l0.assign=function($){var q=Array.prototype.slice.call(arguments,1);while(q.length){var Q=q.shift();if(!Q)continue;if(typeof Q!=="object")throw TypeError(Q+"must be non-object");for(var K in Q)if(YU(Q,K))$[K]=Q[K]}return $};l0.shrinkBuf=function($,q){if($.length===q)return $;if($.subarray)return $.subarray(0,q);return $.length=q,$};var kU={arraySet:function($,q,Q,K,J){if(q.subarray&&$.subarray){$.set(q.subarray(Q,Q+K),J);return}for(var Z=0;Z{var LU=d2(),HU=4,b$=0,n$=1,vU=2;function q6($){var q=$.length;while(--q>=0)$[q]=0}var fU=0,a$=1,RU=2,IU=3,CU=258,v4=29,a6=256,m6=a6+1+v4,Q6=30,f4=19,l$=2*m6+1,v1=15,N4=16,jU=7,R4=256,r$=16,s$=17,t$=18,L4=[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],E8=[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],gU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],AU=512,m2=Array((m6+2)*2);q6(m2);var d6=Array(Q6*2);q6(d6);var p6=Array(AU);q6(p6);var i6=Array(CU-IU+1);q6(i6);var I4=Array(v4);q6(I4);var _8=Array(Q6);q6(_8);function Y4($,q,Q,K,J){this.static_tree=$,this.extra_bits=q,this.extra_base=Q,this.elems=K,this.max_length=J,this.has_stree=$&&$.length}var $Q,QQ,qQ;function k4($,q){this.dyn_tree=$,this.max_code=0,this.stat_desc=q}function KQ($){return $<256?p6[$]:p6[256+($>>>7)]}function o6($,q){$.pending_buf[$.pending++]=q&255,$.pending_buf[$.pending++]=q>>>8&255}function $2($,q,Q){if($.bi_valid>N4-Q)$.bi_buf|=q<<$.bi_valid&65535,o6($,$.bi_buf),$.bi_buf=q>>N4-$.bi_valid,$.bi_valid+=Q-N4;else $.bi_buf|=q<<$.bi_valid&65535,$.bi_valid+=Q}function y2($,q,Q){$2($,Q[q*2],Q[q*2+1])}function JQ($,q){var Q=0;do Q|=$&1,$>>>=1,Q<<=1;while(--q>0);return Q>>>1}function XU($){if($.bi_valid===16)o6($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function yU($,q){var{dyn_tree:Q,max_code:K}=q,J=q.stat_desc.static_tree,Z=q.stat_desc.has_stree,G=q.stat_desc.extra_bits,W=q.stat_desc.extra_base,B=q.stat_desc.max_length,V,U,w,F,M,k,f=0;for(F=0;F<=v1;F++)$.bl_count[F]=0;Q[$.heap[$.heap_max]*2+1]=0;for(V=$.heap_max+1;VB)F=B,f++;if(Q[U*2+1]=F,U>K)continue;if($.bl_count[F]++,M=0,U>=W)M=G[U-W];if(k=Q[U*2],$.opt_len+=k*(F+M),Z)$.static_len+=k*(J[U*2+1]+M)}if(f===0)return;do{F=B-1;while($.bl_count[F]===0)F--;$.bl_count[F]--,$.bl_count[F+1]+=2,$.bl_count[B]--,f-=2}while(f>0);for(F=B;F!==0;F--){U=$.bl_count[F];while(U!==0){if(w=$.heap[--V],w>K)continue;if(Q[w*2+1]!==F)$.opt_len+=(F-Q[w*2+1])*Q[w*2],Q[w*2+1]=F;U--}}}function VQ($,q,Q){var K=Array(v1+1),J=0,Z,G;for(Z=1;Z<=v1;Z++)K[Z]=J=J+Q[Z-1]<<1;for(G=0;G<=q;G++){var W=$[G*2+1];if(W===0)continue;$[G*2]=JQ(K[W]++,W)}}function hU(){var $,q,Q,K,J,Z=Array(v1+1);Q=0;for(K=0;K>=7;for(;K8)o6($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function xU($,q,Q,K){if(ZQ($),K)o6($,Q),o6($,~Q);LU.arraySet($.pending_buf,$.window,q,Q,$.pending),$.pending+=Q}function d$($,q,Q,K){var J=q*2,Z=Q*2;return $[J]<$[Z]||$[J]===$[Z]&&K[q]<=K[Q]}function D4($,q,Q){var K=$.heap[Q],J=Q<<1;while(J<=$.heap_len){if(J<$.heap_len&&d$(q,$.heap[J+1],$.heap[J],$.depth))J++;if(d$(q,K,$.heap[J],$.depth))break;$.heap[Q]=$.heap[J],Q=J,J<<=1}$.heap[Q]=K}function m$($,q,Q){var K,J,Z=0,G,W;if($.last_lit!==0)do if(K=$.pending_buf[$.d_buf+Z*2]<<8|$.pending_buf[$.d_buf+Z*2+1],J=$.pending_buf[$.l_buf+Z],Z++,K===0)y2($,J,q);else{if(G=i6[J],y2($,G+a6+1,q),W=L4[G],W!==0)J-=I4[G],$2($,J,W);if(K--,G=KQ(K),y2($,G,Q),W=E8[G],W!==0)K-=_8[G],$2($,K,W)}while(Z<$.last_lit);y2($,R4,q)}function H4($,q){var Q=q.dyn_tree,K=q.stat_desc.static_tree,J=q.stat_desc.has_stree,Z=q.stat_desc.elems,G,W,B=-1,V;$.heap_len=0,$.heap_max=l$;for(G=0;G>1;G>=1;G--)D4($,Q,G);V=Z;do G=$.heap[1],$.heap[1]=$.heap[$.heap_len--],D4($,Q,1),W=$.heap[1],$.heap[--$.heap_max]=G,$.heap[--$.heap_max]=W,Q[V*2]=Q[G*2]+Q[W*2],$.depth[V]=($.depth[G]>=$.depth[W]?$.depth[G]:$.depth[W])+1,Q[G*2+1]=Q[W*2+1]=V,$.heap[1]=V++,D4($,Q,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],yU($,q),VQ(Q,B,$.bl_count)}function p$($,q,Q){var K,J=-1,Z,G=q[1],W=0,B=7,V=4;if(G===0)B=138,V=3;q[(Q+1)*2+1]=65535;for(K=0;K<=Q;K++){if(Z=G,G=q[(K+1)*2+1],++W=3;q--)if($.bl_tree[e$[q]*2+1]!==0)break;return $.opt_len+=3*(q+1)+5+5+4,q}function PU($,q,Q,K){var J;$2($,q-257,5),$2($,Q-1,5),$2($,K-4,4);for(J=0;J>>=1)if(q&1&&$.dyn_ltree[Q*2]!==0)return b$;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return n$;for(Q=32;Q0){if($.strm.data_type===vU)$.strm.data_type=TU($);if(H4($,$.l_desc),H4($,$.d_desc),G=OU($),J=$.opt_len+3+7>>>3,Z=$.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=Q+5;if(Q+4<=J&&q!==-1)GQ($,q,Q,K);else if($.strategy===HU||Z===J)$2($,(a$<<1)+(K?1:0),3),m$($,m2,d6);else $2($,(RU<<1)+(K?1:0),3),PU($,$.l_desc.max_code+1,$.d_desc.max_code+1,G+1),m$($,$.dyn_ltree,$.dyn_dtree);if(UQ($),K)ZQ($)}function _U($,q,Q){if($.pending_buf[$.d_buf+$.last_lit*2]=q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=q&255,$.pending_buf[$.l_buf+$.last_lit]=Q&255,$.last_lit++,q===0)$.dyn_ltree[Q*2]++;else $.matches++,q--,$.dyn_ltree[(i6[Q]+a6+1)*2]++,$.dyn_dtree[KQ(q)*2]++;return $.last_lit===$.lit_bufsize-1}K6._tr_init=uU;K6._tr_stored_block=GQ;K6._tr_flush_block=EU;K6._tr_tally=_U;K6._tr_align=SU});var C4=N0((bz,BQ)=>{function cU($,q,Q,K){var J=$&65535|0,Z=$>>>16&65535|0,G=0;while(Q!==0){G=Q>2000?2000:Q,Q-=G;do J=J+q[K++]|0,Z=Z+J|0;while(--G);J%=65521,Z%=65521}return J|Z<<16|0}BQ.exports=cU});var j4=N0((nz,zQ)=>{function bU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var nU=bU();function dU($,q,Q,K){var J=nU,Z=K+Q;$^=-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}zQ.exports=dU});var c8=N0((dz,FQ)=>{FQ.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var vQ=N0((O2)=>{var r0=d2(),M2=WQ(),YQ=C4(),q1=j4(),mU=c8(),C1=0,pU=1,iU=3,Z1=4,MQ=5,x2=0,wQ=1,w2=-2,oU=-3,g4=-5,aU=-1,lU=1,b8=2,rU=3,sU=4,tU=0,eU=2,p8=8,$Z=9,QZ=15,qZ=8,KZ=29,JZ=256,X4=JZ+1+KZ,VZ=30,UZ=19,ZZ=2*X4+1,GZ=15,f0=3,V1=258,L2=V1+f0+1,WZ=32,i8=42,y4=69,n8=73,d8=91,m8=103,f1=113,r6=666,c0=1,s6=2,R1=3,U6=4,BZ=3;function U1($,q){return $.msg=mU[q],q}function NQ($){return($<<1)-($>4?9:0)}function J1($){var q=$.length;while(--q>=0)$[q]=0}function K1($){var q=$.state,Q=q.pending;if(Q>$.avail_out)Q=$.avail_out;if(Q===0)return;if(r0.arraySet($.output,q.pending_buf,q.pending_out,Q,$.next_out),$.next_out+=Q,q.pending_out+=Q,$.total_out+=Q,$.avail_out-=Q,q.pending-=Q,q.pending===0)q.pending_out=0}function d0($,q){M2._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,q),$.block_start=$.strstart,K1($.strm)}function C0($,q){$.pending_buf[$.pending++]=q}function l6($,q){$.pending_buf[$.pending++]=q>>>8&255,$.pending_buf[$.pending++]=q&255}function zZ($,q,Q,K){var J=$.avail_in;if(J>K)J=K;if(J===0)return 0;if($.avail_in-=J,r0.arraySet(q,$.input,$.next_in,J,Q),$.state.wrap===1)$.adler=YQ($.adler,q,J,Q);else if($.state.wrap===2)$.adler=q1($.adler,q,J,Q);return $.next_in+=J,$.total_in+=J,J}function kQ($,q){var{max_chain_length:Q,strstart:K}=$,J,Z,G=$.prev_length,W=$.nice_match,B=$.strstart>$.w_size-L2?$.strstart-($.w_size-L2):0,V=$.window,U=$.w_mask,w=$.prev,F=$.strstart+V1,M=V[K+G-1],k=V[K+G];if($.prev_length>=$.good_match)Q>>=2;if(W>$.lookahead)W=$.lookahead;do{if(J=q,V[J+G]!==k||V[J+G-1]!==M||V[J]!==V[K]||V[++J]!==V[K+1])continue;K+=2,J++;do;while(V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&KG){if($.match_start=q,G=Z,Z>=W)break;M=V[K+G-1],k=V[K+G]}}while((q=w[q&U])>B&&--Q!==0);if(G<=$.lookahead)return G;return $.lookahead}function I1($){var q=$.w_size,Q,K,J,Z,G;do{if(Z=$.window_size-$.lookahead-$.strstart,$.strstart>=q+(q-L2)){r0.arraySet($.window,$.window,q,q,0),$.match_start-=q,$.strstart-=q,$.block_start-=q,K=$.hash_size,Q=K;do J=$.head[--Q],$.head[Q]=J>=q?J-q:0;while(--K);K=q,Q=K;do J=$.prev[--Q],$.prev[Q]=J>=q?J-q:0;while(--K);Z+=q}if($.strm.avail_in===0)break;if(K=zZ($.strm,$.window,$.strstart+$.lookahead,Z),$.lookahead+=K,$.lookahead+$.insert>=f0){G=$.strstart-$.insert,$.ins_h=$.window[G],$.ins_h=($.ins_h<<$.hash_shift^$.window[G+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[G+f0-1])&$.hash_mask,$.prev[G&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=G,G++,$.insert--,$.lookahead+$.insert$.pending_buf_size-5)Q=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(I1($),$.lookahead===0&&q===C1)return c0;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var K=$.block_start+Q;if($.strstart===0||$.strstart>=K){if($.lookahead=$.strstart-K,$.strstart=K,d0($,!1),$.strm.avail_out===0)return c0}if($.strstart-$.block_start>=$.w_size-L2){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.strstart>$.block_start){if(d0($,!1),$.strm.avail_out===0)return c0}return c0}function A4($,q){var Q,K;for(;;){if($.lookahead=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(Q!==0&&$.strstart-Q<=$.w_size-L2)$.match_length=kQ($,Q);if($.match_length>=f0)if(K=M2._tr_tally($,$.strstart-$.match_start,$.match_length-f0),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=f0){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else K=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(K){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=$.strstart=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=f0-1,Q!==0&&$.prev_length<$.max_lazy_match&&$.strstart-Q<=$.w_size-L2){if($.match_length=kQ($,Q),$.match_length<=5&&($.strategy===lU||$.match_length===f0&&$.strstart-$.match_start>4096))$.match_length=f0-1}if($.prev_length>=f0&&$.match_length<=$.prev_length){J=$.strstart+$.lookahead-f0,K=M2._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-f0),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=J)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=f0-1,$.strstart++,K){if(d0($,!1),$.strm.avail_out===0)return c0}}else if($.match_available){if(K=M2._tr_tally($,0,$.window[$.strstart-1]),K)d0($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return c0}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)K=M2._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart=f0&&$.strstart>0){if(J=$.strstart-1,K=G[J],K===G[++J]&&K===G[++J]&&K===G[++J]){Z=$.strstart+V1;do;while(K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&J$.lookahead)$.match_length=$.lookahead}}if($.match_length>=f0)Q=M2._tr_tally($,1,$.match_length-f0),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function wZ($,q){var Q;for(;;){if($.lookahead===0){if(I1($),$.lookahead===0){if(q===C1)return c0;break}}if($.match_length=0,Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function h2($,q,Q,K,J){this.good_length=$,this.max_lazy=q,this.nice_length=Q,this.max_chain=K,this.func=J}var V6;V6=[new h2(0,0,0,0,FZ),new h2(4,4,8,4,A4),new h2(4,5,16,8,A4),new h2(4,6,32,32,A4),new h2(4,4,16,16,J6),new h2(8,16,32,32,J6),new h2(8,16,128,128,J6),new h2(8,32,128,256,J6),new h2(32,128,258,1024,J6),new h2(32,258,258,4096,J6)];function NZ($){$.window_size=2*$.w_size,J1($.head),$.max_lazy_match=V6[$.level].max_lazy,$.good_match=V6[$.level].good_length,$.nice_match=V6[$.level].nice_length,$.max_chain_length=V6[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=f0-1,$.match_available=0,$.ins_h=0}function YZ(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=p8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r0.Buf16(ZZ*2),this.dyn_dtree=new r0.Buf16((2*VZ+1)*2),this.bl_tree=new r0.Buf16((2*UZ+1)*2),J1(this.dyn_ltree),J1(this.dyn_dtree),J1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r0.Buf16(GZ+1),this.heap=new r0.Buf16(2*X4+1),J1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r0.Buf16(2*X4+1),J1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function DQ($){var q;if(!$||!$.state)return U1($,w2);if($.total_in=$.total_out=0,$.data_type=eU,q=$.state,q.pending=0,q.pending_out=0,q.wrap<0)q.wrap=-q.wrap;return q.status=q.wrap?i8:f1,$.adler=q.wrap===2?0:1,q.last_flush=C1,M2._tr_init(q),x2}function LQ($){var q=DQ($);if(q===x2)NZ($.state);return q}function kZ($,q){if(!$||!$.state)return w2;if($.state.wrap!==2)return w2;return $.state.gzhead=q,x2}function HQ($,q,Q,K,J,Z){if(!$)return w2;var G=1;if(q===aU)q=6;if(K<0)G=0,K=-K;else if(K>15)G=2,K-=16;if(J<1||J>$Z||Q!==p8||K<8||K>15||q<0||q>9||Z<0||Z>sU)return U1($,w2);if(K===8)K=9;var W=new YZ;return $.state=W,W.strm=$,W.wrap=G,W.gzhead=null,W.w_bits=K,W.w_size=1<MQ||q<0)return $?U1($,w2):w2;if(K=$.state,!$.output||!$.input&&$.avail_in!==0||K.status===r6&&q!==Z1)return U1($,$.avail_out===0?g4:w2);if(K.strm=$,Q=K.last_flush,K.last_flush=q,K.status===i8)if(K.wrap===2)if($.adler=0,C0(K,31),C0(K,139),C0(K,8),!K.gzhead)C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,BZ),K.status=f1;else{if(C0(K,(K.gzhead.text?1:0)+(K.gzhead.hcrc?2:0)+(!K.gzhead.extra?0:4)+(!K.gzhead.name?0:8)+(!K.gzhead.comment?0:16)),C0(K,K.gzhead.time&255),C0(K,K.gzhead.time>>8&255),C0(K,K.gzhead.time>>16&255),C0(K,K.gzhead.time>>24&255),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)C0(K,K.gzhead.extra.length&255),C0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)$.adler=q1($.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=y4}else{var G=p8+(K.w_bits-8<<4)<<8,W=-1;if(K.strategy>=b8||K.level<2)W=0;else if(K.level<6)W=1;else if(K.level===6)W=2;else W=3;if(G|=W<<6,K.strstart!==0)G|=WZ;if(G+=31-G%31,K.status=f1,l6(K,G),K.strstart!==0)l6(K,$.adler>>>16),l6(K,$.adler&65535);$.adler=1}if(K.status===y4)if(K.gzhead.extra){J=K.pending;while(K.gzindex<(K.gzhead.extra.length&65535)){if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size)break}C0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=n8}else K.status=n8;if(K.status===n8)if(K.gzhead.name){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.gzindex=0,K.status=d8}else K.status=d8;if(K.status===d8)if(K.gzhead.comment){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.status=m8}else K.status=m8;if(K.status===m8)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)K1($);if(K.pending+2<=K.pending_buf_size)C0(K,$.adler&255),C0(K,$.adler>>8&255),$.adler=0,K.status=f1}else K.status=f1;if(K.pending!==0){if(K1($),$.avail_out===0)return K.last_flush=-1,x2}else if($.avail_in===0&&NQ(q)<=NQ(Q)&&q!==Z1)return U1($,g4);if(K.status===r6&&$.avail_in!==0)return U1($,g4);if($.avail_in!==0||K.lookahead!==0||q!==C1&&K.status!==r6){var B=K.strategy===b8?wZ(K,q):K.strategy===rU?MZ(K,q):V6[K.level].func(K,q);if(B===R1||B===U6)K.status=r6;if(B===c0||B===R1){if($.avail_out===0)K.last_flush=-1;return x2}if(B===s6){if(q===pU)M2._tr_align(K);else if(q!==MQ){if(M2._tr_stored_block(K,0,0,!1),q===iU){if(J1(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(K1($),$.avail_out===0)return K.last_flush=-1,x2}}if(q!==Z1)return x2;if(K.wrap<=0)return wQ;if(K.wrap===2)C0(K,$.adler&255),C0(K,$.adler>>8&255),C0(K,$.adler>>16&255),C0(K,$.adler>>24&255),C0(K,$.total_in&255),C0(K,$.total_in>>8&255),C0(K,$.total_in>>16&255),C0(K,$.total_in>>24&255);else l6(K,$.adler>>>16),l6(K,$.adler&65535);if(K1($),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?x2:wQ}function HZ($){var q;if(!$||!$.state)return w2;if(q=$.state.status,q!==i8&&q!==y4&&q!==n8&&q!==d8&&q!==m8&&q!==f1&&q!==r6)return U1($,w2);return $.state=null,q===f1?U1($,oU):x2}function vZ($,q){var Q=q.length,K,J,Z,G,W,B,V,U;if(!$||!$.state)return w2;if(K=$.state,G=K.wrap,G===2||G===1&&K.status!==i8||K.lookahead)return w2;if(G===1)$.adler=YQ($.adler,q,Q,0);if(K.wrap=0,Q>=K.w_size){if(G===0)J1(K.head),K.strstart=0,K.block_start=0,K.insert=0;U=new r0.Buf8(K.w_size),r0.arraySet(U,q,Q-K.w_size,K.w_size,0),q=U,Q=K.w_size}W=$.avail_in,B=$.next_in,V=$.input,$.avail_in=Q,$.next_in=0,$.input=q,I1(K);while(K.lookahead>=f0){J=K.strstart,Z=K.lookahead-(f0-1);do K.ins_h=(K.ins_h<{var o8=d2(),fQ=!0,RQ=!0;try{String.fromCharCode.apply(null,[0])}catch($){fQ=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){RQ=!1}var t6=new o8.Buf8(256);for(P2=0;P2<256;P2++)t6[P2]=P2>=252?6:P2>=248?5:P2>=240?4:P2>=224?3:P2>=192?2:1;var P2;t6[254]=t6[254]=1;Z6.string2buf=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q};function IQ($,q){if(q<65534){if($.subarray&&RQ||!$.subarray&&fQ)return String.fromCharCode.apply(null,o8.shrinkBuf($,q))}var Q="";for(var K=0;K4){W[K++]=65533,Q+=Z-1;continue}J&=Z===2?31:Z===3?15:7;while(Z>1&&Q1){W[K++]=65533;continue}if(J<65536)W[K++]=J;else J-=65536,W[K++]=55296|J>>10&1023,W[K++]=56320|J&1023}return IQ(W,K)};Z6.utf8border=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+t6[$[Q]]>q?Q:q}});var x4=N0((iz,CQ)=>{function fZ(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}CQ.exports=fZ});var XQ=N0((Q8)=>{var e6=vQ(),$8=d2(),P4=h4(),T4=c8(),RZ=x4(),AQ=Object.prototype.toString,IZ=0,O4=4,G6=0,jQ=1,gQ=2,CZ=-1,jZ=0,gZ=8;function j1($){if(!(this instanceof j1))return new j1($);this.options=$8.assign({level:CZ,method:gZ,chunkSize:16384,windowBits:15,memLevel:8,strategy:jZ,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>0)q.windowBits=-q.windowBits;else if(q.gzip&&q.windowBits>0&&q.windowBits<16)q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new RZ,this.strm.avail_out=0;var Q=e6.deflateInit2(this.strm,q.level,q.method,q.windowBits,q.memLevel,q.strategy);if(Q!==G6)throw Error(T4[Q]);if(q.header)e6.deflateSetHeader(this.strm,q.header);if(q.dictionary){var K;if(typeof q.dictionary==="string")K=P4.string2buf(q.dictionary);else if(AQ.call(q.dictionary)==="[object ArrayBuffer]")K=new Uint8Array(q.dictionary);else K=q.dictionary;if(Q=e6.deflateSetDictionary(this.strm,K),Q!==G6)throw Error(T4[Q]);this._dict_set=!0}}j1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J,Z;if(this.ended)return!1;if(Z=q===~~q?q:q===!0?O4:IZ,typeof $==="string")Q.input=P4.string2buf($);else if(AQ.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new $8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(J=e6.deflate(Q,Z),J!==jQ&&J!==G6)return this.onEnd(J),this.ended=!0,!1;if(Q.avail_out===0||Q.avail_in===0&&(Z===O4||Z===gQ))if(this.options.to==="string")this.onData(P4.buf2binstring($8.shrinkBuf(Q.output,Q.next_out)));else this.onData($8.shrinkBuf(Q.output,Q.next_out))}while((Q.avail_in>0||Q.avail_out===0)&&J!==jQ);if(Z===O4)return J=e6.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===G6;if(Z===gQ)return this.onEnd(G6),Q.avail_out=0,!0;return!0};j1.prototype.onData=function($){this.chunks.push($)};j1.prototype.onEnd=function($){if($===G6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=$8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function u4($,q){var Q=new j1(q);if(Q.push($,!0),Q.err)throw Q.msg||T4[Q.err];return Q.result}function AZ($,q){return q=q||{},q.raw=!0,u4($,q)}function XZ($,q){return q=q||{},q.gzip=!0,u4($,q)}Q8.Deflate=j1;Q8.deflate=u4;Q8.deflateRaw=AZ;Q8.gzip=XZ});var hQ=N0((az,yQ)=>{var a8=30,yZ=12;yQ.exports=function(q,Q){var K,J,Z,G,W,B,V,U,w,F,M,k,f,L,D,z,N,H,v,j,n,d,_,X,P;K=q.state,J=q.next_in,X=q.input,Z=J+(q.avail_in-5),G=q.next_out,P=q.output,W=G-(Q-q.avail_out),B=G+(q.avail_out-257),V=K.dmax,U=K.wsize,w=K.whave,F=K.wnext,M=K.window,k=K.hold,f=K.bits,L=K.lencode,D=K.distcode,z=(1<>>24,k>>>=v,f-=v,v=H>>>16&255,v===0)P[G++]=H&65535;else if(v&16){if(j=H&65535,v&=15,v){if(f>>=v,f-=v}if(f<15)k+=X[J++]<>>24,k>>>=v,f-=v,v=H>>>16&255,v&16){if(n=H&65535,v&=15,fV){q.msg="invalid distance too far back",K.mode=a8;break $}if(k>>>=v,f-=v,v=G-W,n>v){if(v=n-v,v>w){if(K.sane){q.msg="invalid distance too far back",K.mode=a8;break $}}if(d=0,_=M,F===0){if(d+=U-v,v2)P[G++]=_[d++],P[G++]=_[d++],P[G++]=_[d++],j-=3;if(j){if(P[G++]=_[d++],j>1)P[G++]=_[d++]}}else{d=G-n;do P[G++]=P[d++],P[G++]=P[d++],P[G++]=P[d++],j-=3;while(j>2);if(j){if(P[G++]=P[d++],j>1)P[G++]=P[d++]}}}else if((v&64)===0){H=D[(H&65535)+(k&(1<>3,J-=j,f-=j<<3,k&=(1<{var xQ=d2(),W6=15,OQ=852,PQ=592,TQ=0,S4=1,uQ=2,hZ=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],xZ=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],OZ=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],PZ=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];SQ.exports=function(q,Q,K,J,Z,G,W,B){var V=B.bits,U=0,w=0,F=0,M=0,k=0,f=0,L=0,D=0,z=0,N=0,H,v,j,n,d,_=null,X=0,P,g=new xQ.Buf16(W6+1),c=new xQ.Buf16(W6+1),h=null,x=0,l,$0,Z0;for(U=0;U<=W6;U++)g[U]=0;for(w=0;w=1;M--)if(g[M]!==0)break;if(k>M)k=M;if(M===0)return Z[G++]=20971520,Z[G++]=20971520,B.bits=1,0;for(F=1;F0&&(q===TQ||M!==1))return-1;c[1]=0;for(U=1;UOQ||q===uQ&&z>PQ)return 1;for(;;){if(l=U-L,W[w]P)$0=h[x+W[w]],Z0=_[X+W[w]];else $0=96,Z0=0;H=1<>L)+v]=l<<24|$0<<16|Z0|0;while(v!==0);H=1<>=1;if(H!==0)N&=H-1,N+=H;else N=0;if(w++,--g[U]===0){if(U===M)break;U=Q[K+W[w]]}if(U>k&&(N&n)!==j){if(L===0)L=k;d+=F,f=U-L,D=1<OQ||q===uQ&&z>PQ)return 1;j=N&n,Z[j]=k<<24|f<<16|d-G|0}}if(N!==0)Z[d+N]=U-L<<24|4194304|0;return B.bits=k,0}});var Lq=N0((H2)=>{var U2=d2(),d4=C4(),T2=j4(),TZ=hQ(),q8=EQ(),uZ=0,Bq=1,zq=2,_Q=4,SZ=5,l8=6,g1=0,EZ=1,_Z=2,N2=-2,Fq=-3,m4=-4,cZ=-5,cQ=8,Mq=1,bQ=2,nQ=3,dQ=4,mQ=5,pQ=6,iQ=7,oQ=8,aQ=9,lQ=10,t8=11,p2=12,E4=13,rQ=14,_4=15,sQ=16,tQ=17,eQ=18,$q=19,r8=20,s8=21,Qq=22,qq=23,Kq=24,Jq=25,Vq=26,c4=27,Uq=28,Zq=29,x0=30,p4=31,bZ=32,nZ=852,dZ=592,mZ=15,pZ=mZ;function Gq($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function iZ(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U2.Buf16(320),this.work=new U2.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function wq($){var q;if(!$||!$.state)return N2;if(q=$.state,$.total_in=$.total_out=q.total=0,$.msg="",q.wrap)$.adler=q.wrap&1;return q.mode=Mq,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new U2.Buf32(nZ),q.distcode=q.distdyn=new U2.Buf32(dZ),q.sane=1,q.back=-1,g1}function Nq($){var q;if(!$||!$.state)return N2;return q=$.state,q.wsize=0,q.whave=0,q.wnext=0,wq($)}function Yq($,q){var Q,K;if(!$||!$.state)return N2;if(K=$.state,q<0)Q=0,q=-q;else if(Q=(q>>4)+1,q<48)q&=15;if(q&&(q<8||q>15))return N2;if(K.window!==null&&K.wbits!==q)K.window=null;return K.wrap=Q,K.wbits=q,Nq($)}function kq($,q){var Q,K;if(!$)return N2;if(K=new iZ,$.state=K,K.window=null,Q=Yq($,q),Q!==g1)$.state=null;return Q}function oZ($){return kq($,pZ)}var Wq=!0,b4,n4;function aZ($){if(Wq){var q;b4=new U2.Buf32(512),n4=new U2.Buf32(32),q=0;while(q<144)$.lens[q++]=8;while(q<256)$.lens[q++]=9;while(q<280)$.lens[q++]=7;while(q<288)$.lens[q++]=8;q8(Bq,$.lens,0,288,b4,0,$.work,{bits:9}),q=0;while(q<32)$.lens[q++]=5;q8(zq,$.lens,0,32,n4,0,$.work,{bits:5}),Wq=!1}$.lencode=b4,$.lenbits=9,$.distcode=n4,$.distbits=5}function Dq($,q,Q,K){var J,Z=$.state;if(Z.window===null)Z.wsize=1<=Z.wsize)U2.arraySet(Z.window,q,Q-Z.wsize,Z.wsize,0),Z.wnext=0,Z.whave=Z.wsize;else{if(J=Z.wsize-Z.wnext,J>K)J=K;if(U2.arraySet(Z.window,q,Q-K,J,Z.wnext),K-=J,K)U2.arraySet(Z.window,q,Q-K,K,0),Z.wnext=K,Z.whave=Z.wsize;else{if(Z.wnext+=J,Z.wnext===Z.wsize)Z.wnext=0;if(Z.whave>>8&255,Q.check=T2(Q.check,_,2,0),V=0,U=0,Q.mode=bQ;break}if(Q.flags=0,Q.head)Q.head.done=!1;if(!(Q.wrap&1)||(((V&255)<<8)+(V>>8))%31){$.msg="incorrect header check",Q.mode=x0;break}if((V&15)!==cQ){$.msg="unknown compression method",Q.mode=x0;break}if(V>>>=4,U-=4,n=(V&15)+8,Q.wbits===0)Q.wbits=n;else if(n>Q.wbits){$.msg="invalid window size",Q.mode=x0;break}Q.dmax=1<>8&1;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=nQ;case nQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>8&255,_[2]=V>>>16&255,_[3]=V>>>24&255,Q.check=T2(Q.check,_,4,0);V=0,U=0,Q.mode=dQ;case dQ:while(U<16){if(W===0)break $;W--,V+=K[Z++]<>8;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=mQ;case mQ:if(Q.flags&1024){while(U<16){if(W===0)break $;W--,V+=K[Z++]<>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0}else if(Q.head)Q.head.extra=null;Q.mode=pQ;case pQ:if(Q.flags&1024){if(M=Q.length,M>W)M=W;if(M){if(Q.head){if(n=Q.head.extra_len-Q.length,!Q.head.extra)Q.head.extra=Array(Q.head.extra_len);U2.arraySet(Q.head.extra,K,Z,M,n)}if(Q.flags&512)Q.check=T2(Q.check,K,M,Z);W-=M,Z+=M,Q.length-=M}if(Q.length)break $}Q.length=0,Q.mode=iQ;case iQ:if(Q.flags&2048){if(W===0)break $;M=0;do if(n=K[Z+M++],Q.head&&n&&Q.length<65536)Q.head.name+=String.fromCharCode(n);while(n&&M>9&1,Q.head.done=!0;$.adler=Q.check=0,Q.mode=p2;break;case lQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>=U&7,U-=U&7,Q.mode=c4;break}while(U<3){if(W===0)break $;W--,V+=K[Z++]<>>=1,U-=1,V&3){case 0:Q.mode=rQ;break;case 1:if(aZ(Q),Q.mode=r8,q===l8){V>>>=2,U-=2;break $}break;case 2:Q.mode=tQ;break;case 3:$.msg="invalid block type",Q.mode=x0}V>>>=2,U-=2;break;case rQ:V>>>=U&7,U-=U&7;while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>16^65535)){$.msg="invalid stored block lengths",Q.mode=x0;break}if(Q.length=V&65535,V=0,U=0,Q.mode=_4,q===l8)break $;case _4:Q.mode=sQ;case sQ:if(M=Q.length,M){if(M>W)M=W;if(M>B)M=B;if(M===0)break $;U2.arraySet(J,K,Z,M,G),W-=M,Z+=M,B-=M,G+=M,Q.length-=M;break}Q.mode=p2;break;case tQ:while(U<14){if(W===0)break $;W--,V+=K[Z++]<>>=5,U-=5,Q.ndist=(V&31)+1,V>>>=5,U-=5,Q.ncode=(V&15)+4,V>>>=4,U-=4,Q.nlen>286||Q.ndist>30){$.msg="too many length or distance symbols",Q.mode=x0;break}Q.have=0,Q.mode=eQ;case eQ:while(Q.have>>=3,U-=3}while(Q.have<19)Q.lens[g[Q.have++]]=0;if(Q.lencode=Q.lendyn,Q.lenbits=7,X={bits:Q.lenbits},d=q8(uZ,Q.lens,0,19,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid code lengths set",Q.mode=x0;break}Q.have=0,Q.mode=$q;case $q:while(Q.have>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=D,U-=D,Q.lens[Q.have++]=N;else{if(N===16){P=D+2;while(U>>=D,U-=D,Q.have===0){$.msg="invalid bit length repeat",Q.mode=x0;break}n=Q.lens[Q.have-1],M=3+(V&3),V>>>=2,U-=2}else if(N===17){P=D+3;while(U>>=D,U-=D,n=0,M=3+(V&7),V>>>=3,U-=3}else{P=D+7;while(U>>=D,U-=D,n=0,M=11+(V&127),V>>>=7,U-=7}if(Q.have+M>Q.nlen+Q.ndist){$.msg="invalid bit length repeat",Q.mode=x0;break}while(M--)Q.lens[Q.have++]=n}}if(Q.mode===x0)break;if(Q.lens[256]===0){$.msg="invalid code -- missing end-of-block",Q.mode=x0;break}if(Q.lenbits=9,X={bits:Q.lenbits},d=q8(Bq,Q.lens,0,Q.nlen,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid literal/lengths set",Q.mode=x0;break}if(Q.distbits=6,Q.distcode=Q.distdyn,X={bits:Q.distbits},d=q8(zq,Q.lens,Q.nlen,Q.ndist,Q.distcode,0,Q.work,X),Q.distbits=X.bits,d){$.msg="invalid distances set",Q.mode=x0;break}if(Q.mode=r8,q===l8)break $;case r8:Q.mode=s8;case s8:if(W>=6&&B>=258){if($.next_out=G,$.avail_out=B,$.next_in=Z,$.avail_in=W,Q.hold=V,Q.bits=U,TZ($,F),G=$.next_out,J=$.output,B=$.avail_out,Z=$.next_in,K=$.input,W=$.avail_in,V=Q.hold,U=Q.bits,Q.mode===p2)Q.back=-1;break}Q.back=0;for(;;){if(L=Q.lencode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,Q.length=N,z===0){Q.mode=Vq;break}if(z&32){Q.back=-1,Q.mode=p2;break}if(z&64){$.msg="invalid literal/length code",Q.mode=x0;break}Q.extra=z&15,Q.mode=Qq;case Qq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}Q.was=Q.length,Q.mode=qq;case qq:for(;;){if(L=Q.distcode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,z&64){$.msg="invalid distance code",Q.mode=x0;break}Q.offset=N,Q.extra=z&15,Q.mode=Kq;case Kq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}if(Q.offset>Q.dmax){$.msg="invalid distance too far back",Q.mode=x0;break}Q.mode=Jq;case Jq:if(B===0)break $;if(M=F-B,Q.offset>M){if(M=Q.offset-M,M>Q.whave){if(Q.sane){$.msg="invalid distance too far back",Q.mode=x0;break}}if(M>Q.wnext)M-=Q.wnext,k=Q.wsize-M;else k=Q.wnext-M;if(M>Q.length)M=Q.length;f=Q.window}else f=J,k=G-Q.offset,M=Q.length;if(M>B)M=B;B-=M,Q.length-=M;do J[G++]=f[k++];while(--M);if(Q.length===0)Q.mode=s8;break;case Vq:if(B===0)break $;J[G++]=Q.length,B--,Q.mode=s8;break;case c4:if(Q.wrap){while(U<32){if(W===0)break $;W--,V|=K[Z++]<{Hq.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var fq=N0((tz,vq)=>{function eZ(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}vq.exports=eZ});var Iq=N0((J8)=>{var B6=Lq(),K8=d2(),e8=h4(),E0=i4(),o4=c8(),$G=x4(),QG=fq(),Rq=Object.prototype.toString;function A1($){if(!(this instanceof A1))return new A1($);this.options=K8.assign({chunkSize:16384,windowBits:0,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>=0&&q.windowBits<16){if(q.windowBits=-q.windowBits,q.windowBits===0)q.windowBits=-15}if(q.windowBits>=0&&q.windowBits<16&&!($&&$.windowBits))q.windowBits+=32;if(q.windowBits>15&&q.windowBits<48){if((q.windowBits&15)===0)q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $G,this.strm.avail_out=0;var Q=B6.inflateInit2(this.strm,q.windowBits);if(Q!==E0.Z_OK)throw Error(o4[Q]);if(this.header=new QG,B6.inflateGetHeader(this.strm,this.header),q.dictionary){if(typeof q.dictionary==="string")q.dictionary=e8.string2buf(q.dictionary);else if(Rq.call(q.dictionary)==="[object ArrayBuffer]")q.dictionary=new Uint8Array(q.dictionary);if(q.raw){if(Q=B6.inflateSetDictionary(this.strm,q.dictionary),Q!==E0.Z_OK)throw Error(o4[Q])}}}A1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J=this.options.dictionary,Z,G,W,B,V,U=!1;if(this.ended)return!1;if(G=q===~~q?q:q===!0?E0.Z_FINISH:E0.Z_NO_FLUSH,typeof $==="string")Q.input=e8.binstring2buf($);else if(Rq.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new K8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(Z=B6.inflate(Q,E0.Z_NO_FLUSH),Z===E0.Z_NEED_DICT&&J)Z=B6.inflateSetDictionary(this.strm,J);if(Z===E0.Z_BUF_ERROR&&U===!0)Z=E0.Z_OK,U=!1;if(Z!==E0.Z_STREAM_END&&Z!==E0.Z_OK)return this.onEnd(Z),this.ended=!0,!1;if(Q.next_out){if(Q.avail_out===0||Z===E0.Z_STREAM_END||Q.avail_in===0&&(G===E0.Z_FINISH||G===E0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(W=e8.utf8border(Q.output,Q.next_out),B=Q.next_out-W,V=e8.buf2string(Q.output,W),Q.next_out=B,Q.avail_out=K-B,B)K8.arraySet(Q.output,Q.output,W,B,0);this.onData(V)}else this.onData(K8.shrinkBuf(Q.output,Q.next_out))}if(Q.avail_in===0&&Q.avail_out===0)U=!0}while((Q.avail_in>0||Q.avail_out===0)&&Z!==E0.Z_STREAM_END);if(Z===E0.Z_STREAM_END)G=E0.Z_FINISH;if(G===E0.Z_FINISH)return Z=B6.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===E0.Z_OK;if(G===E0.Z_SYNC_FLUSH)return this.onEnd(E0.Z_OK),Q.avail_out=0,!0;return!0};A1.prototype.onData=function($){this.chunks.push($)};A1.prototype.onEnd=function($){if($===E0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=K8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function a4($,q){var Q=new A1(q);if(Q.push($,!0),Q.err)throw Q.msg||o4[Q.err];return Q.result}function qG($,q){return q=q||{},q.raw=!0,a4($,q)}J8.Inflate=A1;J8.inflate=a4;J8.inflateRaw=qG;J8.ungzip=a4});var gq=N0(($F,jq)=>{var KG=d2().assign,JG=XQ(),VG=Iq(),UG=i4(),Cq={};KG(Cq,JG,VG,UG);jq.exports=Cq});var Xq=N0((Q5)=>{var ZG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",GG=gq(),Aq=T0(),$5=V2(),WG=ZG?"uint8array":"array";Q5.magic="\b\x00";function X1($,q){$5.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=q,this.meta={}}Aq.inherits(X1,$5);X1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(Aq.transformTo(WG,$.data),!1)};X1.prototype.flush=function(){if($5.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};X1.prototype.cleanUp=function(){$5.prototype.cleanUp.call(this),this._pako=null};X1.prototype._createPako=function(){this._pako=new GG[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(q){$.push({data:q,meta:$.meta})}};Q5.compressWorker=function($){return new X1("Deflate",$)};Q5.uncompressWorker=function(){return new X1("Inflate",{})}});var r4=N0((l4)=>{var yq=V2();l4.STORE={magic:"\x00\x00",compressWorker:function(){return new yq("STORE compression")},uncompressWorker:function(){return new yq("STORE decompression")}};l4.DEFLATE=Xq()});var s4=N0((y1)=>{y1.LOCAL_FILE_HEADER="PK\x03\x04";y1.CENTRAL_FILE_HEADER="PK\x01\x02";y1.CENTRAL_DIRECTORY_END="PK\x05\x06";y1.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";y1.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";y1.DATA_DESCRIPTOR="PK\x07\b"});var Pq=N0((JF,Oq)=>{var z6=T0(),F6=V2(),t4=e1(),hq=u8(),q5=s4(),A0=function($,q){var Q="",K;for(K=0;K>>8;return Q},BG=function($,q){var Q=$;if(!$)Q=q?16893:33204;return(Q&65535)<<16},zG=function($){return($||0)&63},xq=function($,q,Q,K,J,Z){var{file:G,compression:W}=$,B=Z!==t4.utf8encode,V=z6.transformTo("string",Z(G.name)),U=z6.transformTo("string",t4.utf8encode(G.name)),w=G.comment,F=z6.transformTo("string",Z(w)),M=z6.transformTo("string",t4.utf8encode(w)),k=U.length!==G.name.length,f=M.length!==w.length,L,D,z="",N="",H="",v=G.dir,j=G.date,n={crc32:0,compressedSize:0,uncompressedSize:0};if(!q||Q)n.crc32=$.crc32,n.compressedSize=$.compressedSize,n.uncompressedSize=$.uncompressedSize;var d=0;if(q)d|=8;if(!B&&(k||f))d|=2048;var _=0,X=0;if(v)_|=16;if(J==="UNIX")X=798,_|=BG(G.unixPermissions,v);else X=20,_|=zG(G.dosPermissions,v);if(L=j.getUTCHours(),L=L<<6,L=L|j.getUTCMinutes(),L=L<<5,L=L|j.getUTCSeconds()/2,D=j.getUTCFullYear()-1980,D=D<<4,D=D|j.getUTCMonth()+1,D=D<<5,D=D|j.getUTCDate(),k)N=A0(1,1)+A0(hq(V),4)+U,z+="up"+A0(N.length,2)+N;if(f)H=A0(1,1)+A0(hq(F),4)+M,z+="uc"+A0(H.length,2)+H;var P="";P+=` +\x00`,P+=A0(d,2),P+=W.magic,P+=A0(L,2),P+=A0(D,2),P+=A0(n.crc32,4),P+=A0(n.compressedSize,4),P+=A0(n.uncompressedSize,4),P+=A0(V.length,2),P+=A0(z.length,2);var g=q5.LOCAL_FILE_HEADER+P+V+z,c=q5.CENTRAL_FILE_HEADER+A0(X,2)+P+A0(F.length,2)+"\x00\x00\x00\x00"+A0(_,4)+A0(K,4)+V+z+F;return{fileRecord:g,dirRecord:c}},FG=function($,q,Q,K,J){var Z="",G=z6.transformTo("string",J(K));return Z=q5.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+A0($,2)+A0($,2)+A0(q,4)+A0(Q,4)+A0(G.length,2)+G,Z},MG=function($){var q="";return q=q5.DATA_DESCRIPTOR+A0($.crc32,4)+A0($.compressedSize,4)+A0($.uncompressedSize,4),q};function v2($,q,Q,K){F6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=q,this.zipPlatform=Q,this.encodeFileName=K,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}z6.inherits(v2,F6);v2.prototype.push=function($){var q=$.meta.percent||0,Q=this.entriesCount,K=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,F6.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:Q?(q+100*(Q-K-1))/Q:100}})};v2.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var q=this.streamFiles&&!$.file.dir;if(q){var Q=xq($,q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:Q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};v2.prototype.closedSource=function($){this.accumulate=!1;var q=this.streamFiles&&!$.file.dir,Q=xq($,q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(Q.dirRecord),q)this.push({data:MG($),meta:{percent:100}});else{this.push({data:Q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};v2.prototype.flush=function(){var $=this.bytesWritten;for(var q=0;q{var wG=r4(),NG=Pq(),YG=function($,q){var Q=$||q,K=wG[Q];if(!K)throw Error(Q+" is not a valid compression method !");return K};Tq.generateWorker=function($,q,Q){var K=new NG(q.streamFiles,Q,q.platform,q.encodeFileName),J=0;try{$.forEach(function(Z,G){J++;var W=YG(G.options.compression,q.compression),B=G.options.compressionOptions||q.compressionOptions||{},V=G.dir,U=G.date;G._compressWorker(W,B).withStreamInfo("file",{name:Z,dir:V,date:U,comment:G.comment||"",unixPermissions:G.unixPermissions,dosPermissions:G.dosPermissions}).pipe(K)}),K.entriesCount=J}catch(Z){K.error(Z)}return K}});var Eq=N0((UF,Sq)=>{var kG=T0(),K5=V2();function V8($,q){K5.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(q)}kG.inherits(V8,K5);V8.prototype._bindStream=function($){var q=this;this._stream=$,$.pause(),$.on("data",function(Q){q.push({data:Q,meta:{percent:0}})}).on("error",function(Q){if(q.isPaused)this.generatedError=Q;else q.error(Q)}).on("end",function(){if(q.isPaused)q._upstreamEnded=!0;else q.end()})};V8.prototype.pause=function(){if(!K5.prototype.pause.call(this))return!1;return this._stream.pause(),!0};V8.prototype.resume=function(){if(!K5.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};Sq.exports=V8});var aq=N0((ZF,oq)=>{var DG=e1(),U8=T0(),nq=V2(),LG=K4(),dq=J4(),_q=S8(),HG=c$(),vG=uq(),cq=T6(),fG=Eq(),mq=function($,q,Q){var K=U8.getTypeOf(q),J,Z=U8.extend(Q||{},dq);if(Z.date=Z.date||new Date,Z.compression!==null)Z.compression=Z.compression.toUpperCase();if(typeof Z.unixPermissions==="string")Z.unixPermissions=parseInt(Z.unixPermissions,8);if(Z.unixPermissions&&Z.unixPermissions&16384)Z.dir=!0;if(Z.dosPermissions&&Z.dosPermissions&16)Z.dir=!0;if(Z.dir)$=pq($);if(Z.createFolders&&(J=RG($)))iq.call(this,J,!0);var G=K==="string"&&Z.binary===!1&&Z.base64===!1;if(!Q||typeof Q.binary>"u")Z.binary=!G;var W=q instanceof _q&&q.uncompressedSize===0;if(W||Z.dir||!q||q.length===0)Z.base64=!1,Z.binary=!0,q="",Z.compression="STORE",K="string";var B=null;if(q instanceof _q||q instanceof nq)B=q;else if(cq.isNode&&cq.isStream(q))B=new fG($,q);else B=U8.prepareContent($,q,Z.binary,Z.optimizedBinaryString,Z.base64);var V=new HG($,B,Z);this.files[$]=V},RG=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var q=$.lastIndexOf("/");return q>0?$.substring(0,q):""},pq=function($){if($.slice(-1)!=="/")$+="/";return $},iq=function($,q){if(q=typeof q<"u"?q:dq.createFolders,$=pq($),!this.files[$])mq.call(this,$,null,{dir:!0,createFolders:q});return this.files[$]};function bq($){return Object.prototype.toString.call($)==="[object RegExp]"}var IG={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var q,Q,K;for(q in this.files)if(K=this.files[q],Q=q.slice(this.root.length,q.length),Q&&q.slice(0,this.root.length)===this.root)$(Q,K)},filter:function($){var q=[];return this.forEach(function(Q,K){if($(Q,K))q.push(K)}),q},file:function($,q,Q){if(arguments.length===1)if(bq($)){var K=$;return this.filter(function(Z,G){return!G.dir&&K.test(Z)})}else{var J=this.files[this.root+$];if(J&&!J.dir)return J;else return null}else $=this.root+$,mq.call(this,$,q,Q);return this},folder:function($){if(!$)return this;if(bq($))return this.filter(function(J,Z){return Z.dir&&$.test(J)});var q=this.root+$,Q=iq.call(this,q),K=this.clone();return K.root=Q.name,K},remove:function($){$=this.root+$;var q=this.files[$];if(!q){if($.slice(-1)!=="/")$+="/";q=this.files[$]}if(q&&!q.dir)delete this.files[$];else{var Q=this.filter(function(J,Z){return Z.name.slice(0,$.length)===$});for(var K=0;K{var CG=T0();function lq($){this.data=$,this.length=$.length,this.index=0,this.zero=0}lq.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length=this.index;Q--)q=(q<<8)+this.byteAt(Q);return this.index+=$,q},readString:function($){return CG.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};rq.exports=lq});var $7=N0((WF,tq)=>{var sq=e4(),jG=T0();function M6($){sq.call(this,$);for(var q=0;q=0;--Z)if(this.data[Z]===q&&this.data[Z+1]===Q&&this.data[Z+2]===K&&this.data[Z+3]===J)return Z-this.zero;return-1};M6.prototype.readAndCheckSignature=function($){var q=$.charCodeAt(0),Q=$.charCodeAt(1),K=$.charCodeAt(2),J=$.charCodeAt(3),Z=this.readData(4);return q===Z[0]&&Q===Z[1]&&K===Z[2]&&J===Z[3]};M6.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};tq.exports=M6});var QK=N0((BF,$K)=>{var eq=e4(),gG=T0();function w6($){eq.call(this,$)}gG.inherits(w6,eq);w6.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};w6.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};w6.prototype.readAndCheckSignature=function($){var q=this.readData(4);return $===q};w6.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};$K.exports=w6});var q7=N0((zF,KK)=>{var qK=$7(),AG=T0();function Q7($){qK.call(this,$)}AG.inherits(Q7,qK);Q7.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};KK.exports=Q7});var UK=N0((FF,VK)=>{var JK=q7(),XG=T0();function K7($){JK.call(this,$)}XG.inherits(K7,JK);K7.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};VK.exports=K7});var J7=N0((MF,GK)=>{var J5=T0(),ZK=n2(),yG=$7(),hG=QK(),xG=UK(),OG=q7();GK.exports=function($){var q=J5.getTypeOf($);if(J5.checkSupport(q),q==="string"&&!ZK.uint8array)return new hG($);if(q==="nodebuffer")return new xG($);if(ZK.uint8array)return new OG(J5.transformTo("uint8array",$));return new yG(J5.transformTo("array",$))}});var FK=N0((wF,zK)=>{var V7=J7(),G1=T0(),PG=S8(),WK=u8(),V5=e1(),U5=r4(),TG=n2(),uG=0,SG=3,EG=function($){for(var q in U5){if(!Object.prototype.hasOwnProperty.call(U5,q))continue;if(U5[q].magic===$)return U5[q]}return null};function BK($,q){this.options=$,this.loadOptions=q}BK.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var q,Q;if($.skip(22),this.fileNameLength=$.readInt(2),Q=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(Q),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(q=EG(this.compressionMethod),q===null)throw Error("Corrupted zip : compression "+G1.pretty(this.compressionMethod)+" unknown (inner file : "+G1.transformTo("string",this.fileName)+")");this.decompressed=new PG(this.compressedSize,this.uncompressedSize,this.crc32,q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===uG)this.dosPermissions=this.externalFileAttributes&63;if($===SG)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=V7(this.extraFields[1].value);if(this.uncompressedSize===G1.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G1.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G1.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G1.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var q=$.index+this.extraFieldsLength,Q,K,J;if(!this.extraFields)this.extraFields={};while($.index+4{var _G=J7(),i2=T0(),f2=s4(),cG=FK(),bG=n2();function MK($){this.files=[],this.loadOptions=$}MK.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+i2.pretty(q)+", expected "+i2.pretty($)+")")}},isSignature:function($,q){var Q=this.reader.index;this.reader.setIndex($);var K=this.reader.readString(4),J=K===q;return this.reader.setIndex(Q),J},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),q=bG.uint8array?"uint8array":"array",Q=i2.transformTo(q,$);this.zipComment=this.loadOptions.decodeFileName(Q)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,q=0,Q,K,J;while(q<$)Q=this.reader.readInt(2),K=this.reader.readInt(4),J=this.reader.readData(K),this.zip64ExtensibleData[Q]={id:Q,length:K,value:J}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,q;for($=0;$0)if(this.isSignature(Q,f2.CENTRAL_FILE_HEADER));else this.reader.zero=J;else if(J<0)throw Error("Corrupted zip: missing "+Math.abs(J)+" bytes.")},prepareReader:function($){this.reader=_G($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};wK.exports=MK});var DK=N0((YF,kK)=>{var U7=T0(),Z5=r1(),nG=e1(),dG=NK(),mG=Z4(),YK=T6();function pG($){return new Z5.Promise(function(q,Q){var K=$.decompressed.getContentWorker().pipe(new mG);K.on("error",function(J){Q(J)}).on("end",function(){if(K.streamInfo.crc32!==$.decompressed.crc32)Q(Error("Corrupted zip : CRC32 mismatch"));else q()}).resume()})}kK.exports=function($,q){var Q=this;if(q=U7.extend(q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:nG.utf8decode}),YK.isNode&&YK.isStream($))return Z5.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return U7.prepareContent("the loaded zip file",$,!0,q.optimizedBinaryString,q.base64).then(function(K){var J=new dG(q);return J.load(K),J}).then(function(J){var Z=[Z5.Promise.resolve(J)],G=J.files;if(q.checkCRC32)for(var W=0;W{function Y2(){if(!(this instanceof Y2))return new Y2;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new Y2;for(var q in this)if(typeof this[q]!=="function")$[q]=this[q];return $}}Y2.prototype=aq();Y2.prototype.loadAsync=DK();Y2.support=n2();Y2.defaults=J4();Y2.version="3.10.1";Y2.loadAsync=function($,q){return new Y2().loadAsync($,q)};Y2.external=r1();LK.exports=Y2});var Z8={};c1(Z8,{types:()=>QW,promisify:()=>jK,log:()=>RK,isUndefined:()=>N6,isSymbol:()=>KW,isString:()=>M5,isRegExp:()=>G5,isPrimitive:()=>JW,isObject:()=>Y6,isNumber:()=>fK,isNullOrUndefined:()=>qW,isNull:()=>F5,isFunction:()=>B5,isError:()=>W5,isDate:()=>B7,isBuffer:()=>VW,isBoolean:()=>F7,isArray:()=>vK,inspect:()=>h1,inherits:()=>IK,format:()=>z7,deprecate:()=>oG,default:()=>GW,debuglog:()=>aG,callbackifyOnRejected:()=>N7,callbackify:()=>gK,_extend:()=>w7,TextEncoder:()=>AK,TextDecoder:()=>XK});function z7($,...q){if(!M5($)){var Q=[$];for(var K=0;K=J)return W;switch(W){case"%s":return String(q[K++]);case"%d":return Number(q[K++]);case"%j":try{return JSON.stringify(q[K++])}catch(B){return"[Circular]"}default:return W}});for(var G=q[K];K"u"||process?.noDeprecation===!0)return $;var Q=!1;function K(...J){if(!Q){if(process.throwDeprecation)throw Error(q);else if(process.traceDeprecation)console.trace(q);else console.error(q);Q=!0}return $.apply(this,...J)}return K}function lG($,q){var Q=h1.styles[q];if(Q)return"\x1B["+h1.colors[Q][0]+"m"+$+"\x1B["+h1.colors[Q][1]+"m";else return $}function rG($,q){return $}function sG($){var q={};return $.forEach(function(Q,K){q[Q]=!0}),q}function z5($,q,Q){if($.customInspect&&q&&B5(q.inspect)&&q.inspect!==h1&&!(q.constructor&&q.constructor.prototype===q)){var K=q.inspect(Q,$);if(!M5(K))K=z5($,K,Q);return K}var J=tG($,q);if(J)return J;var Z=Object.keys(q),G=sG(Z);if($.showHidden)Z=Object.getOwnPropertyNames(q);if(W5(q)&&(Z.indexOf("message")>=0||Z.indexOf("description")>=0))return Z7(q);if(Z.length===0){if(B5(q)){var W=q.name?": "+q.name:"";return $.stylize("[Function"+W+"]","special")}if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");if(B7(q))return $.stylize(Date.prototype.toString.call(q),"date");if(W5(q))return Z7(q)}var B="",V=!1,U=["{","}"];if(vK(q))V=!0,U=["[","]"];if(B5(q)){var w=q.name?": "+q.name:"";B=" [Function"+w+"]"}if(G5(q))B=" "+RegExp.prototype.toString.call(q);if(B7(q))B=" "+Date.prototype.toUTCString.call(q);if(W5(q))B=" "+Z7(q);if(Z.length===0&&(!V||q.length==0))return U[0]+B+U[1];if(Q<0)if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");else return $.stylize("[Object]","special");$.seen.push(q);var F;if(V)F=eG($,q,Q,G,Z);else F=Z.map(function(M){return W7($,q,Q,G,M,V)});return $.seen.pop(),$W(F,B,U)}function tG($,q){if(N6(q))return $.stylize("undefined","undefined");if(M5(q)){var Q="'"+JSON.stringify(q).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(Q,"string")}if(fK(q))return $.stylize(""+q,"number");if(F7(q))return $.stylize(""+q,"boolean");if(F5(q))return $.stylize("null","null")}function Z7($){return"["+Error.prototype.toString.call($)+"]"}function eG($,q,Q,K,J){var Z=[];for(var G=0,W=q.length;G-1)if(Z)W=W.split(` `).map(function(V){return" "+V}).join(` `).slice(2);else W=` @@ -13,23 +13,23 @@ `)>=0)K++;return Z+G.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(J>60)return Q[0]+(q===""?"":q+` `)+" "+$.join(`, `)+" "+Q[1];return Q[0]+q+" "+$.join(", ")+" "+Q[1]}function vK($){return Array.isArray($)}function F7($){return typeof $==="boolean"}function F5($){return $===null}function qW($){return $==null}function fK($){return typeof $==="number"}function M5($){return typeof $==="string"}function KW($){return typeof $==="symbol"}function N6($){return $===void 0}function G5($){return Y6($)&&M7($)==="[object RegExp]"}function Y6($){return typeof $==="object"&&$!==null}function B7($){return Y6($)&&M7($)==="[object Date]"}function W5($){return Y6($)&&(M7($)==="[object Error]"||$ instanceof Error)}function B5($){return typeof $==="function"}function JW($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}function VW($){return $ instanceof Buffer}function M7($){return Object.prototype.toString.call($)}function G7($){return $<10?"0"+$.toString(10):$.toString(10)}function ZW(){var $=new Date,q=[G7($.getHours()),G7($.getMinutes()),G7($.getSeconds())].join(":");return[$.getDate(),UW[$.getMonth()],q].join(" ")}function RK(...$){console.log("%s - %s",ZW(),z7.apply(null,$))}function IK($,q){if(q)$.super_=q,$.prototype=Object.create(q.prototype,{constructor:{value:$,enumerable:!1,writable:!0,configurable:!0}})}function w7($,q){if(!q||!Y6(q))return $;var Q=Object.keys(q),K=Q.length;while(K--)$[Q[K]]=q[Q[K]];return $}function CK($,q){return Object.prototype.hasOwnProperty.call($,q)}function N7($,q){if(!$){var Q=Error("Promise was rejected with a falsy value");Q.reason=$,$=Q}return q($)}function gK($){if(typeof $!=="function")throw TypeError('The "original" argument must be of type Function');function q(...Q){var K=Q.pop();if(typeof K!=="function")throw TypeError("The last argument must be of type Function");var J=this,Z=function(...G){return K.apply(J,...G)};$.apply(this,Q).then(function(G){process.nextTick(Z.bind(null,null,G))},function(G){process.nextTick(N7.bind(null,G,Z))})}return Object.setPrototypeOf(q,Object.getPrototypeOf($)),Object.defineProperties(q,Object.getOwnPropertyDescriptors($)),q}var iG,aG,h1,QW=()=>{},UW,jK,AK,XK,GW;var G8=b1(()=>{iG=/%[sdj%]/g;aG=(($={},q={},Q)=>((Q=typeof process<"u"&&!1)&&(Q=Q.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),q=new RegExp("^"+Q+"$","i"),(K)=>{if(K=K.toUpperCase(),!$[K])if(q.test(K))$[K]=function(...J){console.error("%s: %s",K,pid,z7.apply(null,...J))};else $[K]=function(){};return $[K]}))(),h1=(($)=>($.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},$.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},$.custom=Symbol.for("nodejs.util.inspect.custom"),$))(function($,q,...Q){var K={seen:[],stylize:rG};if(Q.length>=1)K.depth=Q[0];if(Q.length>=2)K.colors=Q[1];if(F7(q))K.showHidden=q;else if(q)w7(K,q);if(N6(K.showHidden))K.showHidden=!1;if(N6(K.depth))K.depth=2;if(N6(K.colors))K.colors=!1;if(K.colors)K.stylize=lG;return z5(K,$,K.depth)});UW=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];jK=(($)=>($.custom=Symbol.for("nodejs.util.promisify.custom"),$))(function($){if(typeof $!=="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&$[kCustomPromisifiedSymbol]){var q=$[kCustomPromisifiedSymbol];if(typeof q!=="function")throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(q,kCustomPromisifiedSymbol,{value:q,enumerable:!1,writable:!1,configurable:!0}),q}function q(...Q){var K,J,Z=new Promise(function(G,W){K=G,J=W});Q.push(function(G,W){if(G)J(G);else K(W)});try{$.apply(this,Q)}catch(G){J(G)}return Z}if(Object.setPrototypeOf(q,Object.getPrototypeOf($)),kCustomPromisifiedSymbol)Object.defineProperty(q,kCustomPromisifiedSymbol,{value:q,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(q,Object.getOwnPropertyDescriptors($))});({TextEncoder:AK,TextDecoder:XK}=globalThis),GW={TextEncoder:AK,TextDecoder:XK,promisify:jK,log:RK,inherits:IK,_extend:w7,callbackifyOnRejected:N7,callbackify:gK}});var v7={};c1(v7,{resolveObject:()=>SK,resolve:()=>uK,parse:()=>D6,format:()=>TK,default:()=>DW,Url:()=>Z2,URLSearchParams:()=>OK,URL:()=>L7});function H7($){return typeof $==="string"}function PK($){return typeof $==="object"&&$!==null}function w5($){return $===null}function WW($){return $==null}function Z2(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function D6($,q,Q){if($&&PK($)&&$ instanceof Z2)return $;var K=new Z2;return K.parse($,q,Q),K}function TK($){if(H7($))$=D6($);if(!($ instanceof Z2))return Z2.prototype.format.call($);return $.format()}function uK($,q){return D6($,!1,!0).resolve(q)}function SK($,q){if(!$)return q;return D6($,!1,!0).resolveObject(q)}var L7,OK,BW,zW,FW,MW,wW,Y7,yK,hK,NW=255,xK,YW,kW,k7,k6,D7,DW;var f7=b1(()=>{({URL:L7,URLSearchParams:OK}=globalThis);BW=/^([a-z0-9.+-]+:)/i,zW=/:[0-9]*$/,FW=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,MW=["<",">",'"',"`"," ","\r",` -`,"\t"],wW=["{","}","|","\\","^","`"].concat(MW),Y7=["'"].concat(wW),yK=["%","/","?",";","#"].concat(Y7),hK=["/","?","#"],xK=/^[+a-z0-9A-Z_-]{0,63}$/,YW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kW={javascript:!0,"javascript:":!0},k7={javascript:!0,"javascript:":!0},k6={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},D7={parse($){var q=decodeURIComponent;return($+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(Q,K,J){var Z=K.split("="),G=q(Z[0]||""),W=q(Z[1]||""),B=Q[G];return Q[G]=B===void 0?W:[].concat(B,W),Q},{})},stringify($){var q=encodeURIComponent;return Object.keys($||{}).reduce(function(Q,K){return[].concat($[K]).forEach(function(J){Q.push(q(K)+"="+q(J))}),Q},[]).join("&").replace(/\s/g,"+")}};Z2.prototype.parse=function($,q,Q){if(!H7($))throw TypeError("Parameter 'url' must be a string, not "+typeof $);var K=$.indexOf("?"),J=K!==-1&&K<$.indexOf("#")?"?":"#",Z=$.split(J),G=/\\/g;Z[0]=Z[0].replace(G,"/"),$=Z.join(J);var W=$;if(W=W.trim(),!Q&&$.split("#").length===1){var B=FW.exec(W);if(B){if(this.path=W,this.href=W,this.pathname=B[1],B[2])if(this.search=B[2],q)this.query=D7.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(q)this.search="",this.query={};return this}}var V=BW.exec(W);if(V){V=V[0];var U=V.toLowerCase();this.protocol=U,W=W.substr(V.length)}if(Q||V||W.match(/^\/\/[^@\/]+@[^@\/]+/)){var w=W.substr(0,2)==="//";if(w&&!(V&&k7[V]))W=W.substr(2),this.slashes=!0}if(!k7[V]&&(w||V&&!k6[V])){var F=-1;for(var M=0;M127)v+="x";else v+=H[j];if(!v.match(xK)){var d=z.slice(0,M),_=z.slice(M+1),X=H.match(YW);if(X)d.push(X[1]),_.unshift(X[2]);if(_.length)W="/"+_.join(".")+W;this.hostname=d.join(".");break}}}}if(this.hostname.length>NW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!D)this.hostname=new L7(`https://${this.hostname}`).hostname;var P=this.port?":"+this.port:"",g=this.hostname||"";if(this.host=g+P,this.href+=this.host,D){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),W[0]!=="/")W="/"+W}}if(!kW[U])for(var M=0,N=Y7.length;M0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(Q.search=$.search,Q.query=$.query,!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.href=Q.format(),Q}if(!z.length){if(Q.pathname=null,Q.search)Q.path="/"+Q.search;else Q.path=null;return Q.href=Q.format(),Q}var j=z.slice(-1)[0],n=(Q.host||$.host||z.length>1)&&(j==="."||j==="..")||j==="",d=0;for(var _=z.length;_>=0;_--)if(j=z[_],j===".")z.splice(_,1);else if(j==="..")z.splice(_,1),d++;else if(d)z.splice(_,1),d--;if(!L&&!D)for(;d--;d)z.unshift("..");if(L&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/"))z.unshift("");if(n&&z.join("/").substr(-1)!=="/")z.push("");var X=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){Q.hostname=Q.host=X?"":z.length?z.shift():"";var v=Q.host&&Q.host.indexOf("@")>0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(L=L||Q.host&&z.length,L&&!X)z.unshift("");if(!z.length)Q.pathname=null,Q.path=null;else Q.pathname=z.join("/");if(!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.auth=$.auth||Q.auth,Q.slashes=Q.slashes||$.slashes,Q.href=Q.format(),Q};Z2.prototype.parseHost=function(){var $=this.host,q=zW.exec($);if(q){if(q=q[0],q!==":")this.port=q.substr(1);$=$.substr(0,$.length-q.length)}if($)this.hostname=$};DW={parse:D6,resolve:uK,resolveObject:SK,format:TK,Url:Z2,URL:L7,URLSearchParams:OK}});var I7={};c1(I7,{request:()=>uW,globalAgent:()=>bW,get:()=>SW,default:()=>mW,STATUS_CODES:()=>nW,METHODS:()=>dW,IncomingMessage:()=>_W,ClientRequest:()=>EW,Agent:()=>cW});var LW,HW,EK,vW,fW,RW=($,q,Q)=>{Q=$!=null?LW(HW($)):{};let K=q||!$||!$.__esModule?EK(Q,"default",{value:$,enumerable:!0}):Q;for(let J of vW($))if(!fW.call(K,J))EK(K,J,{get:()=>$[J],enumerable:!0});return K},h0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),cK,IW,x1,CW,bK,O1,nK,jW,dK,L6,gW,_K,R7,AW,XW,mK,pK,yW,hW,iK,oK,xW,OW,PW,TW,aK,uW,SW,EW,_W,cW,bW,nW,dW,mW;var C7=b1(()=>{LW=Object.create,{getPrototypeOf:HW,defineProperty:EK,getOwnPropertyNames:vW}=Object,fW=Object.prototype.hasOwnProperty,cK=h0(($)=>{$.fetch=J(globalThis.fetch)&&J(globalThis.ReadableStream),$.writableStream=J(globalThis.WritableStream),$.abortController=J(globalThis.AbortController);var q;function Q(){if(q!==void 0)return q;if(globalThis.XMLHttpRequest){q=new globalThis.XMLHttpRequest;try{q.open("GET",globalThis.XDomainRequest?"/":"https://example.com")}catch(Z){q=null}}else q=null;return q}function K(Z){var G=Q();if(!G)return!1;try{return G.responseType=Z,G.responseType===Z}catch(W){}return!1}$.arraybuffer=$.fetch||K("arraybuffer"),$.msstream=!$.fetch&&K("ms-stream"),$.mozchunkedarraybuffer=!$.fetch&&K("moz-chunked-arraybuffer"),$.overrideMimeType=$.fetch||(Q()?J(Q().overrideMimeType):!1);function J(Z){return typeof Z==="function"}q=null}),IW=h0(($,q)=>{if(typeof Object.create==="function")q.exports=function(Q,K){if(K)Q.super_=K,Q.prototype=Object.create(K.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else q.exports=function(Q,K){if(K){Q.super_=K;var J=function(){};J.prototype=K.prototype,Q.prototype=new J,Q.prototype.constructor=Q}}}),x1=h0(($,q)=>{try{if(Q=(G8(),X0(Z8)),typeof Q.inherits!=="function")throw"";q.exports=Q.inherits}catch(K){q.exports=IW()}var Q}),CW=h0(($,q)=>{function Q(L,D){var z=Object.keys(L);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(L);D&&(N=N.filter(function(H){return Object.getOwnPropertyDescriptor(L,H).enumerable})),z.push.apply(z,N)}return z}function K(L){for(var D=1;D0)this.tail.next=z;else this.head=z;this.tail=z,++this.length}},{key:"unshift",value:function(D){var z={data:D,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var D=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,D}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(D){if(this.length===0)return"";var z=this.head,N=""+z.data;while(z=z.next)N+=D+z.data;return N}},{key:"concat",value:function(D){if(this.length===0)return w.alloc(0);var z=w.allocUnsafe(D>>>0),N=this.head,H=0;while(N)f(N.data,z,H),H+=N.data.length,N=N.next;return z}},{key:"consume",value:function(D,z){var N;if(Dv.length?v.length:D;if(j===v.length)H+=v;else H+=v.slice(0,D);if(D-=j,D===0){if(j===v.length)if(++N,z.next)this.head=z.next;else this.head=this.tail=null;else this.head=z,z.data=v.slice(j);break}++N}return this.length-=N,H}},{key:"_getBuffer",value:function(D){var z=w.allocUnsafe(D),N=this.head,H=1;N.data.copy(z),D-=N.data.length;while(N=N.next){var v=N.data,j=D>v.length?v.length:D;if(v.copy(z,z.length-D,0,j),D-=j,D===0){if(j===v.length)if(++H,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=v.slice(j);break}++H}return this.length-=H,z}},{key:k,value:function(D,z){return M(this,K(K({},z),{},{depth:0,customInspect:!1}))}}]),L}()}),bK=h0(($,q)=>{function Q(B,V){var U=this,w=this._readableState&&this._readableState.destroyed,F=this._writableState&&this._writableState.destroyed;if(w||F){if(V)V(B);else if(B){if(!this._writableState)process.nextTick(G,this,B);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,process.nextTick(G,this,B)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(B||null,function(M){if(!V&&M)if(!U._writableState)process.nextTick(K,U,M);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,process.nextTick(K,U,M);else process.nextTick(J,U);else if(V)process.nextTick(J,U),V(M);else process.nextTick(J,U)}),this}function K(B,V){G(B,V),J(B)}function J(B){if(B._writableState&&!B._writableState.emitClose)return;if(B._readableState&&!B._readableState.emitClose)return;B.emit("close")}function Z(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function G(B,V){B.emit("error",V)}function W(B,V){var{_readableState:U,_writableState:w}=B;if(U&&U.autoDestroy||w&&w.autoDestroy)B.destroy(V);else B.emit("error",V)}q.exports={destroy:Q,undestroy:Z,errorOrDestroy:W}}),O1=h0(($,q)=>{var Q={};function K(B,V,U){if(!U)U=Error;function w(M,k,f){if(typeof V==="string")return V;else return V(M,k,f)}class F extends U{constructor(M,k,f){super(w(M,k,f))}}F.prototype.name=U.name,F.prototype.code=B,Q[B]=F}function J(B,V){if(Array.isArray(B)){let U=B.length;if(B=B.map((w)=>String(w)),U>2)return`one of ${V} ${B.slice(0,U-1).join(", ")}, or `+B[U-1];else if(U===2)return`one of ${V} ${B[0]} or ${B[1]}`;else return`of ${V} ${B[0]}`}else return`of ${V} ${String(B)}`}function Z(B,V,U){return B.substr(!U||U<0?0:+U,V.length)===V}function G(B,V,U){if(U===void 0||U>B.length)U=B.length;return B.substring(U-V.length,U)===V}function W(B,V,U){if(typeof U!=="number")U=0;if(U+V.length>B.length)return!1;else return B.indexOf(V,U)!==-1}K("ERR_INVALID_OPT_VALUE",function(B,V){return'The value "'+V+'" is invalid for option "'+B+'"'},TypeError),K("ERR_INVALID_ARG_TYPE",function(B,V,U){let w;if(typeof V==="string"&&Z(V,"not "))w="must not be",V=V.replace(/^not /,"");else w="must be";let F;if(G(B," argument"))F=`The ${B} ${w} ${J(V,"type")}`;else{let M=W(B,".")?"property":"argument";F=`The "${B}" ${M} ${w} ${J(V,"type")}`}return F+=`. Received type ${typeof U}`,F},TypeError),K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),K("ERR_METHOD_NOT_IMPLEMENTED",function(B){return"The "+B+" method is not implemented"}),K("ERR_STREAM_PREMATURE_CLOSE","Premature close"),K("ERR_STREAM_DESTROYED",function(B){return"Cannot call "+B+" after a stream was destroyed"}),K("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),K("ERR_STREAM_WRITE_AFTER_END","write after end"),K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),K("ERR_UNKNOWN_ENCODING",function(B){return"Unknown encoding: "+B},TypeError),K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$.codes=Q}),nK=h0(($,q)=>{var Q=O1().codes.ERR_INVALID_OPT_VALUE;function K(Z,G,W){return Z.highWaterMark!=null?Z.highWaterMark:G?Z[W]:null}function J(Z,G,W,B){var V=K(G,B,W);if(V!=null){if(!(isFinite(V)&&Math.floor(V)===V)||V<0){var U=B?W:"highWaterMark";throw new Q(U,V)}return Math.floor(V)}return Z.objectMode?16:16384}q.exports={getHighWaterMark:J}}),jW=h0(($,q)=>{q.exports=(G8(),X0(Z8)).deprecate}),dK=h0(($,q)=>{q.exports=X;function Q(S){var b=this;this.next=null,this.entry=null,this.finish=function(){w0(b,S)}}var K;X.WritableState=d;var J={deprecate:jW()},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(S){return G.from(S)}function V(S){return G.isBuffer(S)||S instanceof W}var U=bK(),w=nK(),F=w.getHighWaterMark,M=O1().codes,k=M.ERR_INVALID_ARG_TYPE,f=M.ERR_METHOD_NOT_IMPLEMENTED,L=M.ERR_MULTIPLE_CALLBACK,D=M.ERR_STREAM_CANNOT_PIPE,z=M.ERR_STREAM_DESTROYED,N=M.ERR_STREAM_NULL_VALUES,H=M.ERR_STREAM_WRITE_AFTER_END,v=M.ERR_UNKNOWN_ENCODING,j=U.errorOrDestroy;x1()(X,Z);function n(){}function d(S,b,O){if(K=K||L6(),S=S||{},typeof O!=="boolean")O=b instanceof K;if(this.objectMode=!!S.objectMode,O)this.objectMode=this.objectMode||!!S.writableObjectMode;this.highWaterMark=F(this,S,"writableHighWaterMark",O),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var E=S.decodeStrings===!1;this.decodeStrings=!E,this.defaultEncoding=S.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){Z0(b,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=S.emitClose!==!1,this.autoDestroy=!!S.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Q(this)}d.prototype.getBuffer=function(){var S=this.bufferedRequest,b=[];while(S)b.push(S),S=S.next;return b},function(){try{Object.defineProperty(d.prototype,"buffer",{get:J.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(S){}}();var _;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")_=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(S){if(_.call(this,S))return!0;if(this!==X)return!1;return S&&S._writableState instanceof d}});else _=function(S){return S instanceof this};function X(S){K=K||L6();var b=this instanceof K;if(!b&&!_.call(X,this))return new X(S);if(this._writableState=new d(S,this,b),this.writable=!0,S){if(typeof S.write==="function")this._write=S.write;if(typeof S.writev==="function")this._writev=S.writev;if(typeof S.destroy==="function")this._destroy=S.destroy;if(typeof S.final==="function")this._final=S.final}Z.call(this)}X.prototype.pipe=function(){j(this,new D)};function P(S,b){var O=new H;j(S,O),process.nextTick(b,O)}function g(S,b,O,E){var a;if(O===null)a=new N;else if(typeof O!=="string"&&!b.objectMode)a=new k("chunk",["string","Buffer"],O);if(a)return j(S,a),process.nextTick(E,a),!1;return!0}X.prototype.write=function(S,b,O){var E=this._writableState,a=!1,K0=!E.objectMode&&V(S);if(K0&&!G.isBuffer(S))S=B(S);if(typeof b==="function")O=b,b=null;if(K0)b="buffer";else if(!b)b=E.defaultEncoding;if(typeof O!=="function")O=n;if(E.ending)P(this,O);else if(K0||g(this,E,S,O))E.pendingcb++,a=h(this,E,K0,S,b,O);return a},X.prototype.cork=function(){this._writableState.corked++},X.prototype.uncork=function(){var S=this._writableState;if(S.corked){if(S.corked--,!S.writing&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest)W0(this,S)}},X.prototype.setDefaultEncoding=function(S){if(typeof S==="string")S=S.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((S+"").toLowerCase())>-1))throw new v(S);return this._writableState.defaultEncoding=S,this},Object.defineProperty(X.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function c(S,b,O){if(!S.objectMode&&S.decodeStrings!==!1&&typeof b==="string")b=G.from(b,O);return b}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function h(S,b,O,E,a,K0){if(!O){var R=c(b,E,a);if(E!==R)O=!0,a="buffer",E=R}var Y=b.objectMode?1:E.length;b.length+=Y;var C=b.length{var Q=Object.keys||function(w){var F=[];for(var M in w)F.push(M);return F};q.exports=B;var K=mK(),J=dK();x1()(B,K);{Z=Q(J.prototype);for(W=0;W{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),_K=h0(($)=>{var q=gW().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),R7=h0(($,q)=>{var Q=O1().codes.ERR_STREAM_PREMATURE_CLOSE;function K(W){var B=!1;return function(){if(B)return;B=!0;for(var V=arguments.length,U=Array(V),w=0;w{var Q;function K(v,j,n){if(j=J(j),j in v)Object.defineProperty(v,j,{value:n,enumerable:!0,configurable:!0,writable:!0});else v[j]=n;return v}function J(v){var j=Z(v,"string");return typeof j==="symbol"?j:String(j)}function Z(v,j){if(typeof v!=="object"||v===null)return v;var n=v[Symbol.toPrimitive];if(n!==void 0){var d=n.call(v,j||"default");if(typeof d!=="object")return d;throw TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(v)}var G=R7(),W=Symbol("lastResolve"),B=Symbol("lastReject"),V=Symbol("error"),U=Symbol("ended"),w=Symbol("lastPromise"),F=Symbol("handlePromise"),M=Symbol("stream");function k(v,j){return{value:v,done:j}}function f(v){var j=v[W];if(j!==null){var n=v[M].read();if(n!==null)v[w]=null,v[W]=null,v[B]=null,j(k(n,!1))}}function L(v){process.nextTick(f,v)}function D(v,j){return function(n,d){v.then(function(){if(j[U]){n(k(void 0,!0));return}j[F](n,d)},d)}}var z=Object.getPrototypeOf(function(){}),N=Object.setPrototypeOf((Q={get stream(){return this[M]},next:function(){var v=this,j=this[V];if(j!==null)return Promise.reject(j);if(this[U])return Promise.resolve(k(void 0,!0));if(this[M].destroyed)return new Promise(function(X,P){process.nextTick(function(){if(v[V])P(v[V]);else X(k(void 0,!0))})});var n=this[w],d;if(n)d=new Promise(D(n,this));else{var _=this[M].read();if(_!==null)return Promise.resolve(k(_,!1));d=new Promise(this[F])}return this[w]=d,d}},K(Q,Symbol.asyncIterator,function(){return this}),K(Q,"return",function(){var v=this;return new Promise(function(j,n){v[M].destroy(null,function(d){if(d){n(d);return}j(k(void 0,!0))})})}),Q),z),H=function(v){var j,n=Object.create(N,(j={},K(j,M,{value:v,writable:!0}),K(j,W,{value:null,writable:!0}),K(j,B,{value:null,writable:!0}),K(j,V,{value:null,writable:!0}),K(j,U,{value:v._readableState.endEmitted,writable:!0}),K(j,F,{value:function(d,_){var X=n[M].read();if(X)n[w]=null,n[W]=null,n[B]=null,d(k(X,!1));else n[W]=d,n[B]=_},writable:!0}),j));return n[w]=null,G(v,function(d){if(d&&d.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=n[B];if(_!==null)n[w]=null,n[W]=null,n[B]=null,_(d);n[V]=d;return}var X=n[W];if(X!==null)n[w]=null,n[W]=null,n[B]=null,X(k(void 0,!0));n[U]=!0}),v.on("readable",L.bind(null,n)),n};q.exports=H}),XW=h0(($,q)=>{function Q(w,F,M,k,f,L,D){try{var z=w[L](D),N=z.value}catch(H){M(H);return}if(z.done)F(N);else Promise.resolve(N).then(k,f)}function K(w){return function(){var F=this,M=arguments;return new Promise(function(k,f){var L=w.apply(F,M);function D(N){Q(L,k,f,D,z,"next",N)}function z(N){Q(L,k,f,D,z,"throw",N)}D(void 0)})}}function J(w,F){var M=Object.keys(w);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(w);F&&(k=k.filter(function(f){return Object.getOwnPropertyDescriptor(w,f).enumerable})),M.push.apply(M,k)}return M}function Z(w){for(var F=1;F{q.exports=g;var Q;g.ReadableState=P;var K=(i1(),X0(p1)).EventEmitter,J=function(R,Y){return R.listeners(Y).length},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(R){return G.from(R)}function V(R){return G.isBuffer(R)||R instanceof W}var U=(G8(),X0(Z8)),w;if(U&&U.debuglog)w=U.debuglog("stream");else w=function(){};var F=CW(),M=bK(),k=nK(),f=k.getHighWaterMark,L=O1().codes,D=L.ERR_INVALID_ARG_TYPE,z=L.ERR_STREAM_PUSH_AFTER_EOF,N=L.ERR_METHOD_NOT_IMPLEMENTED,H=L.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,j,n;x1()(g,Z);var d=M.errorOrDestroy,_=["error","close","destroy","pause","resume"];function X(R,Y,C){if(typeof R.prependListener==="function")return R.prependListener(Y,C);if(!R._events||!R._events[Y])R.on(Y,C);else if(Array.isArray(R._events[Y]))R._events[Y].unshift(C);else R._events[Y]=[C,R._events[Y]]}function P(R,Y,C){if(Q=Q||L6(),R=R||{},typeof C!=="boolean")C=Y instanceof Q;if(this.objectMode=!!R.objectMode,C)this.objectMode=this.objectMode||!!R.readableObjectMode;if(this.highWaterMark=f(this,R,"readableHighWaterMark",C),this.buffer=new F,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.destroyed=!1,this.defaultEncoding=R.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,R.encoding){if(!v)v=_K().StringDecoder;this.decoder=new v(R.encoding),this.encoding=R.encoding}}function g(R){if(Q=Q||L6(),!(this instanceof g))return new g(R);var Y=this instanceof Q;if(this._readableState=new P(R,this,Y),this.readable=!0,R){if(typeof R.read==="function")this._read=R.read;if(typeof R.destroy==="function")this._destroy=R.destroy}Z.call(this)}Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(R){if(!this._readableState)return;this._readableState.destroyed=R}}),g.prototype.destroy=M.destroy,g.prototype._undestroy=M.undestroy,g.prototype._destroy=function(R,Y){Y(R)},g.prototype.push=function(R,Y){var C=this._readableState,u;if(!C.objectMode){if(typeof R==="string"){if(Y=Y||C.defaultEncoding,Y!==C.encoding)R=G.from(R,Y),Y="";u=!0}}else u=!0;return c(this,R,Y,!1,u)},g.prototype.unshift=function(R){return c(this,R,null,!0,!1)};function c(R,Y,C,u,e){w("readableAddChunk",Y);var r=R._readableState;if(Y===null)r.reading=!1,F0(R,r);else{var s;if(!e)s=x(r,Y);if(s)d(R,s);else if(r.objectMode||Y&&Y.length>0){if(typeof Y!=="string"&&!r.objectMode&&Object.getPrototypeOf(Y)!==G.prototype)Y=B(Y);if(u)if(r.endEmitted)d(R,new H);else h(R,r,Y,!0);else if(r.ended)d(R,new z);else if(r.destroyed)return!1;else if(r.reading=!1,r.decoder&&!C)if(Y=r.decoder.write(Y),r.objectMode||Y.length!==0)h(R,r,Y,!1);else y(R,r);else h(R,r,Y,!1)}else if(!u)r.reading=!1,y(R,r)}return!r.ended&&(r.length=l)R=l;else R--,R|=R>>>1,R|=R>>>2,R|=R>>>4,R|=R>>>8,R|=R>>>16,R++;return R}function Z0(R,Y){if(R<=0||Y.length===0&&Y.ended)return 0;if(Y.objectMode)return 1;if(R!==R)if(Y.flowing&&Y.length)return Y.buffer.head.data.length;else return Y.length;if(R>Y.highWaterMark)Y.highWaterMark=$0(R);if(R<=Y.length)return R;if(!Y.ended)return Y.needReadable=!0,0;return Y.length}g.prototype.read=function(R){w("read",R),R=parseInt(R,10);var Y=this._readableState,C=R;if(R!==0)Y.emittedReadable=!1;if(R===0&&Y.needReadable&&((Y.highWaterMark!==0?Y.length>=Y.highWaterMark:Y.length>0)||Y.ended)){if(w("read: emitReadable",Y.length,Y.ended),Y.length===0&&Y.ended)E(this);else p(this);return null}if(R=Z0(R,Y),R===0&&Y.ended){if(Y.length===0)E(this);return null}var u=Y.needReadable;if(w("need readable",u),Y.length===0||Y.length-R0)e=O(R,Y);else e=null;if(e===null)Y.needReadable=Y.length<=Y.highWaterMark,R=0;else Y.length-=R,Y.awaitDrain=0;if(Y.length===0){if(!Y.ended)Y.needReadable=!0;if(C!==R&&Y.ended)E(this)}if(e!==null)this.emit("data",e);return e};function F0(R,Y){if(w("onEofChunk"),Y.ended)return;if(Y.decoder){var C=Y.decoder.end();if(C&&C.length)Y.buffer.push(C),Y.length+=Y.objectMode?1:C.length}if(Y.ended=!0,Y.sync)p(R);else if(Y.needReadable=!1,!Y.emittedReadable)Y.emittedReadable=!0,W0(R)}function p(R){var Y=R._readableState;if(w("emitReadable",Y.needReadable,Y.emittedReadable),Y.needReadable=!1,!Y.emittedReadable)w("emitReadable",Y.flowing),Y.emittedReadable=!0,process.nextTick(W0,R)}function W0(R){var Y=R._readableState;if(w("emitReadable_",Y.destroyed,Y.length,Y.ended),!Y.destroyed&&(Y.length||Y.ended))R.emit("readable"),Y.emittedReadable=!1;Y.needReadable=!Y.flowing&&!Y.ended&&Y.length<=Y.highWaterMark,b(R)}function y(R,Y){if(!Y.readingMore)Y.readingMore=!0,process.nextTick(i,R,Y)}function i(R,Y){while(!Y.reading&&!Y.ended&&(Y.length1&&K0(u.pipes,R)!==-1)&&!G0)w("false write response, pause",u.awaitDrain),u.awaitDrain++;C.pause()}}function I0(O0){if(w("onerror",O0),q2(),R.removeListener("error",I0),J(R,"error")===0)d(R,O0)}X(R,"error",I0);function m0(){R.removeListener("finish",p0),q2()}R.once("close",m0);function p0(){w("onfinish"),R.removeListener("close",m0),q2()}R.once("finish",p0);function q2(){w("unpipe"),C.unpipe(R)}if(R.emit("pipe",C),!u.flowing)w("pipe resume"),C.resume();return R};function U0(R){return function(){var Y=R._readableState;if(w("pipeOnDrain",Y.awaitDrain),Y.awaitDrain)Y.awaitDrain--;if(Y.awaitDrain===0&&J(R,"data"))Y.flowing=!0,b(R)}}g.prototype.unpipe=function(R){var Y=this._readableState,C={hasUnpiped:!1};if(Y.pipesCount===0)return this;if(Y.pipesCount===1){if(R&&R!==Y.pipes)return this;if(!R)R=Y.pipes;if(Y.pipes=null,Y.pipesCount=0,Y.flowing=!1,R)R.emit("unpipe",this,C);return this}if(!R){var{pipes:u,pipesCount:e}=Y;Y.pipes=null,Y.pipesCount=0,Y.flowing=!1;for(var r=0;r0,u.flowing!==!1)this.resume()}else if(R==="readable"){if(!u.endEmitted&&!u.readableListening){if(u.readableListening=u.needReadable=!0,u.flowing=!1,u.emittedReadable=!1,w("on readable",u.length,u.reading),u.length)p(this);else if(!u.reading)process.nextTick(V0,this)}}return C},g.prototype.addListener=g.prototype.on,g.prototype.removeListener=function(R,Y){var C=Z.prototype.removeListener.call(this,R,Y);if(R==="readable")process.nextTick(m,this);return C},g.prototype.removeAllListeners=function(R){var Y=Z.prototype.removeAllListeners.apply(this,arguments);if(R==="readable"||R===void 0)process.nextTick(m,this);return Y};function m(R){var Y=R._readableState;if(Y.readableListening=R.listenerCount("readable")>0,Y.resumeScheduled&&!Y.paused)Y.flowing=!0;else if(R.listenerCount("data")>0)R.resume()}function V0(R){w("readable nexttick read 0"),R.read(0)}g.prototype.resume=function(){var R=this._readableState;if(!R.flowing)w("resume"),R.flowing=!R.readableListening,w0(this,R);return R.paused=!1,this};function w0(R,Y){if(!Y.resumeScheduled)Y.resumeScheduled=!0,process.nextTick(S,R,Y)}function S(R,Y){if(w("resume",Y.reading),!Y.reading)R.read(0);if(Y.resumeScheduled=!1,R.emit("resume"),b(R),Y.flowing&&!Y.reading)R.read(0)}g.prototype.pause=function(){if(w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)w("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function b(R){var Y=R._readableState;w("flow",Y.flowing);while(Y.flowing&&R.read()!==null);}if(g.prototype.wrap=function(R){var Y=this,C=this._readableState,u=!1;R.on("end",function(){if(w("wrapped end"),C.decoder&&!C.ended){var s=C.decoder.end();if(s&&s.length)Y.push(s)}Y.push(null)}),R.on("data",function(s){if(w("wrapped data"),C.decoder)s=C.decoder.write(s);if(C.objectMode&&(s===null||s===void 0))return;else if(!C.objectMode&&(!s||!s.length))return;var T=Y.push(s);if(!T)u=!0,R.pause()});for(var e in R)if(this[e]===void 0&&typeof R[e]==="function")this[e]=function(s){return function(){return R[s].apply(R,arguments)}}(e);for(var r=0;r<_.length;r++)R.on(_[r],this.emit.bind(this,_[r]));return this._read=function(s){if(w("wrapped _read",s),u)u=!1,R.resume()},this},typeof Symbol==="function")g.prototype[Symbol.asyncIterator]=function(){if(j===void 0)j=AW();return j(this)};Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(g.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(g.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){if(this._readableState)this._readableState.flowing=R}}),g._fromList=O,Object.defineProperty(g.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function O(R,Y){if(Y.length===0)return null;var C;if(Y.objectMode)C=Y.buffer.shift();else if(!R||R>=Y.length){if(Y.decoder)C=Y.buffer.join("");else if(Y.buffer.length===1)C=Y.buffer.first();else C=Y.buffer.concat(Y.length);Y.buffer.clear()}else C=Y.buffer.consume(R,Y.decoder);return C}function E(R){var Y=R._readableState;if(w("endReadable",Y.endEmitted),!Y.endEmitted)Y.ended=!0,process.nextTick(a,Y,R)}function a(R,Y){if(w("endReadableNT",R.endEmitted,R.length),!R.endEmitted&&R.length===0){if(R.endEmitted=!0,Y.readable=!1,Y.emit("end"),R.autoDestroy){var C=Y._writableState;if(!C||C.autoDestroy&&C.finished)Y.destroy()}}}if(typeof Symbol==="function")g.from=function(R,Y){if(n===void 0)n=XW();return n(g,R,Y)};function K0(R,Y){for(var C=0,u=R.length;C{q.exports=V;var Q=O1().codes,K=Q.ERR_METHOD_NOT_IMPLEMENTED,J=Q.ERR_MULTIPLE_CALLBACK,Z=Q.ERR_TRANSFORM_ALREADY_TRANSFORMING,G=Q.ERR_TRANSFORM_WITH_LENGTH_0,W=L6();x1()(V,W);function B(F,M){var k=this._transformState;k.transforming=!1;var f=k.writecb;if(f===null)return this.emit("error",new J);if(k.writechunk=null,k.writecb=null,M!=null)this.push(M);f(F);var L=this._readableState;if(L.reading=!1,L.needReadable||L.length{q.exports=K;var Q=pK();x1()(K,Q);function K(J){if(!(this instanceof K))return new K(J);Q.call(this,J)}K.prototype._transform=function(J,Z,G){G(null,J)}}),hW=h0(($,q)=>{var Q;function K(k){var f=!1;return function(){if(f)return;f=!0,k.apply(void 0,arguments)}}var J=O1().codes,Z=J.ERR_MISSING_ARGS,G=J.ERR_STREAM_DESTROYED;function W(k){if(k)throw k}function B(k){return k.setHeader&&typeof k.abort==="function"}function V(k,f,L,D){D=K(D);var z=!1;if(k.on("close",function(){z=!0}),Q===void 0)Q=R7();Q(k,{readable:f,writable:L},function(H){if(H)return D(H);z=!0,D()});var N=!1;return function(H){if(z)return;if(N)return;if(N=!0,B(k))return k.abort();if(typeof k.destroy==="function")return k.destroy();D(H||new G("pipe"))}}function U(k){k()}function w(k,f){return k.pipe(f)}function F(k){if(!k.length)return W;if(typeof k[k.length-1]!=="function")return W;return k.pop()}function M(){for(var k=arguments.length,f=Array(k),L=0;L0;return V(H,j,n,function(d){if(!z)z=d;if(d)N.forEach(U);if(j)return;N.forEach(U),D(z)})});return f.reduce(w)}q.exports=M}),iK=h0(($,q)=>{var Q=a1();$=q.exports=mK(),$.Stream=Q||$,$.Readable=$,$.Writable=dK(),$.Duplex=L6(),$.Transform=pK(),$.PassThrough=yW(),$.finished=R7(),$.pipeline=hW()}),oK=h0(($)=>{var q=cK(),Q=x1(),K=iK(),J=$.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Z=$.IncomingMessage=function(G,W,B,V){var U=this;if(K.Readable.call(U),U._mode=B,U.headers={},U.rawHeaders=[],U.trailers={},U.rawTrailers=[],U.on("end",function(){process.nextTick(function(){U.emit("close")})}),B==="fetch"){let D=function(){M.read().then(function(z){if(U._destroyed)return;if(V(z.done),z.done){U.push(null);return}U.push(Buffer.from(z.value)),D()}).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)})};var w=D;if(U._fetchResponse=W,U.url=W.url,U.statusCode=W.status,U.statusMessage=W.statusText,W.headers.forEach(function(z,N){U.headers[N.toLowerCase()]=z,U.rawHeaders.push(N,z)}),q.writableStream){var F=new WritableStream({write:function(z){return V(!1),new Promise(function(N,H){if(U._destroyed)H();else if(U.push(Buffer.from(z)))N();else U._resumeFetch=N})},close:function(){if(V(!0),!U._destroyed)U.push(null)},abort:function(z){if(V(!0),!U._destroyed)U.emit("error",z)}});try{W.body.pipeTo(F).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)});return}catch(z){}}var M=W.body.getReader();D()}else{U._xhr=G,U._pos=0,U.url=G.responseURL,U.statusCode=G.status,U.statusMessage=G.statusText;var k=G.getAllResponseHeaders().split(/\r?\n/);if(k.forEach(function(D){var z=D.match(/^([^:]+):\s*(.*)/);if(z){var N=z[1].toLowerCase();if(N==="set-cookie"){if(U.headers[N]===void 0)U.headers[N]=[];U.headers[N].push(z[2])}else if(U.headers[N]!==void 0)U.headers[N]+=", "+z[2];else U.headers[N]=z[2];U.rawHeaders.push(z[1],z[2])}}),U._charset="x-user-defined",!q.overrideMimeType){var f=U.rawHeaders["mime-type"];if(f){var L=f.match(/;\s*charset=([^;])(;|$)/);if(L)U._charset=L[1].toLowerCase()}if(!U._charset)U._charset="utf-8"}}};Q(Z,K.Readable),Z.prototype._read=function(){var G=this,W=G._resumeFetch;if(W)G._resumeFetch=null,W()},Z.prototype._onXHRProgress=function(G){var W=this,B=W._xhr,V=null;switch(W._mode){case"text":if(V=B.responseText,V.length>W._pos){var U=V.substr(W._pos);if(W._charset==="x-user-defined"){var w=Buffer.alloc(U.length);for(var F=0;FW._pos)W.push(Buffer.from(new Uint8Array(M.result.slice(W._pos)))),W._pos=M.result.byteLength},M.onload=function(){G(!0),W.push(null)},M.readAsArrayBuffer(V);break}if(W._xhr.readyState===J.DONE&&W._mode!=="ms-stream")G(!0),W.push(null)}}),xW=h0(($,q)=>{var Q=cK(),K=x1(),J=oK(),Z=iK(),G=J.IncomingMessage,W=J.readyStates;function B(F,M){if(Q.fetch&&M)return"fetch";else if(Q.mozchunkedarraybuffer)return"moz-chunked-arraybuffer";else if(Q.msstream)return"ms-stream";else if(Q.arraybuffer&&F)return"arraybuffer";else return"text"}var V=q.exports=function(F){var M=this;if(Z.Writable.call(M),M._opts=F,M._body=[],M._headers={},F.auth)M.setHeader("Authorization","Basic "+Buffer.from(F.auth).toString("base64"));Object.keys(F.headers).forEach(function(L){M.setHeader(L,F.headers[L])});var k,f=!0;if(F.mode==="disable-fetch"||"requestTimeout"in F&&!Q.abortController)f=!1,k=!0;else if(F.mode==="prefer-streaming")k=!1;else if(F.mode==="allow-wrong-content-type")k=!Q.overrideMimeType;else if(!F.mode||F.mode==="default"||F.mode==="prefer-fast")k=!0;else throw Error("Invalid value for opts.mode");M._mode=B(k,f),M._fetchTimer=null,M._socketTimeout=null,M._socketTimer=null,M.on("finish",function(){M._onFinish()})};K(V,Z.Writable),V.prototype.setHeader=function(F,M){var k=this,f=F.toLowerCase();if(w.indexOf(f)!==-1)return;k._headers[f]={name:F,value:M}},V.prototype.getHeader=function(F){var M=this._headers[F.toLowerCase()];if(M)return M.value;return null},V.prototype.removeHeader=function(F){var M=this;delete M._headers[F.toLowerCase()]},V.prototype._onFinish=function(){var F=this;if(F._destroyed)return;var M=F._opts;if("timeout"in M&&M.timeout!==0)F.setTimeout(M.timeout);var k=F._headers,f=null;if(M.method!=="GET"&&M.method!=="HEAD")f=new Blob(F._body,{type:(k["content-type"]||{}).value||""});var L=[];if(Object.keys(k).forEach(function(H){var v=k[H].name,j=k[H].value;if(Array.isArray(j))j.forEach(function(n){L.push([v,n])});else L.push([v,j])}),F._mode==="fetch"){var D=null;if(Q.abortController){var z=new AbortController;if(D=z.signal,F._fetchAbortController=z,"requestTimeout"in M&&M.requestTimeout!==0)F._fetchTimer=globalThis.setTimeout(function(){if(F.emit("requestTimeout"),F._fetchAbortController)F._fetchAbortController.abort()},M.requestTimeout)}globalThis.fetch(F._opts.url,{method:F._opts.method,headers:L,body:f||void 0,mode:"cors",credentials:M.withCredentials?"include":"same-origin",signal:D}).then(function(H){F._fetchResponse=H,F._resetTimers(!1),F._connect()},function(H){if(F._resetTimers(!0),!F._destroyed)F.emit("error",H)})}else{var N=F._xhr=new globalThis.XMLHttpRequest;try{N.open(F._opts.method,F._opts.url,!0)}catch(H){process.nextTick(function(){F.emit("error",H)});return}if("responseType"in N)N.responseType=F._mode;if("withCredentials"in N)N.withCredentials=!!M.withCredentials;if(F._mode==="text"&&"overrideMimeType"in N)N.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in M)N.timeout=M.requestTimeout,N.ontimeout=function(){F.emit("requestTimeout")};if(L.forEach(function(H){N.setRequestHeader(H[0],H[1])}),F._response=null,N.onreadystatechange=function(){switch(N.readyState){case W.LOADING:case W.DONE:F._onXHRProgress();break}},F._mode==="moz-chunked-arraybuffer")N.onprogress=function(){F._onXHRProgress()};N.onerror=function(){if(F._destroyed)return;F._resetTimers(!0),F.emit("error",Error("XHR error"))};try{N.send(f)}catch(H){process.nextTick(function(){F.emit("error",H)});return}}};function U(F){try{var M=F.status;return M!==null&&M!==0}catch(k){return!1}}V.prototype._onXHRProgress=function(){var F=this;if(F._resetTimers(!1),!U(F._xhr)||F._destroyed)return;if(!F._response)F._connect();F._response._onXHRProgress(F._resetTimers.bind(F))},V.prototype._connect=function(){var F=this;if(F._destroyed)return;F._response=new G(F._xhr,F._fetchResponse,F._mode,F._resetTimers.bind(F)),F._response.on("error",function(M){F.emit("error",M)}),F.emit("response",F._response)},V.prototype._write=function(F,M,k){var f=this;f._body.push(F),k()},V.prototype._resetTimers=function(F){var M=this;if(globalThis.clearTimeout(M._socketTimer),M._socketTimer=null,F)globalThis.clearTimeout(M._fetchTimer),M._fetchTimer=null;else if(M._socketTimeout)M._socketTimer=globalThis.setTimeout(function(){M.emit("timeout")},M._socketTimeout)},V.prototype.abort=V.prototype.destroy=function(F){var M=this;if(M._destroyed=!0,M._resetTimers(!0),M._response)M._response._destroyed=!0;if(M._xhr)M._xhr.abort();else if(M._fetchAbortController)M._fetchAbortController.abort();if(F)M.emit("error",F)},V.prototype.end=function(F,M,k){var f=this;if(typeof F==="function")k=F,F=void 0;Z.Writable.prototype.end.call(f,F,M,k)},V.prototype.setTimeout=function(F,M){var k=this;if(M)k.once("timeout",M);k._socketTimeout=F,k._resetTimers(!1)},V.prototype.flushHeaders=function(){},V.prototype.setNoDelay=function(){},V.prototype.setSocketKeepAlive=function(){};var w=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}),OW=h0(($,q)=>{q.exports=K;var Q=Object.prototype.hasOwnProperty;function K(){var J={};for(var Z=0;Z{q.exports=(C7(),X0(I7)).STATUS_CODES}),TW=h0(($)=>{var q=xW(),Q=oK(),K=OW(),J=PW(),Z=(f7(),X0(v7)),G=$;G.request=function(W,B){if(typeof W==="string")W=Z.parse(W);else W=K(W);var V=globalThis.location.protocol.search(/^https?:$/)===-1?"http:":"",U=W.protocol||V,w=W.hostname||W.host,F=W.port,M=W.path||"/";if(w&&w.indexOf(":")!==-1)w="["+w+"]";W.url=(w?U+"//"+w:"")+(F?":"+F:"")+M,W.method=(W.method||"GET").toUpperCase(),W.headers=W.headers||{};var k=new q(W);if(B)k.on("response",B);return k},G.get=function(W,B){var V=G.request(W,B);return V.end(),V},G.ClientRequest=q,G.IncomingMessage=Q.IncomingMessage,G.Agent=function(){},G.Agent.defaultMaxSockets=4,G.globalAgent=new G.Agent,G.STATUS_CODES=J,G.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}),aK=RW(TW(),1),{request:uW,get:SW,ClientRequest:EW,IncomingMessage:_W,Agent:cW,globalAgent:bW,STATUS_CODES:nW,METHODS:dW}=aK.default,mW=aK.default});var sK={};c1(sK,{validateHeaderValue:()=>MB,validateHeaderName:()=>FB,setMaxIdleHTTPParsers:()=>zB,request:()=>BB,maxHeaderSize:()=>WB,globalAgent:()=>GB,get:()=>ZB,default:()=>wB,createServer:()=>UB,ServerResponse:()=>VB,Server:()=>JB,STATUS_CODES:()=>KB,OutgoingMessage:()=>qB,METHODS:()=>QB,IncomingMessage:()=>$B,ClientRequest:()=>eW,Agent:()=>tW});var pW,iW,lK,oW,aW,lW=($,q,Q)=>{Q=$!=null?pW(iW($)):{};let K=q||!$||!$.__esModule?lK(Q,"default",{value:$,enumerable:!0}):Q;for(let J of oW($))if(!aW.call(K,J))lK(K,J,{get:()=>$[J],enumerable:!0});return K},rW=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),sW,rK,tW,eW,$B,QB,qB,KB,JB,VB,UB,ZB,GB,WB,BB,zB,FB,MB,wB;var tK=b1(()=>{pW=Object.create,{getPrototypeOf:iW,defineProperty:lK,getOwnPropertyNames:oW}=Object,aW=Object.prototype.hasOwnProperty,sW=rW(($,q)=>{var Q=(C7(),X0(I7)),K=(f7(),X0(v7)),J=$;for(Z in Q)if(Q.hasOwnProperty(Z))J[Z]=Q[Z];var Z;J.request=function(W,B){return W=G(W),Q.request.call(this,W,B)},J.get=function(W,B){return W=G(W),Q.get.call(this,W,B)};function G(W){if(typeof W==="string")W=K.parse(W);if(!W.protocol)W.protocol="https:";if(W.protocol!=="https:")throw Error('Protocol "'+W.protocol+'" not supported. Expected "https:"');return W}}),rK=lW(sW(),1),{Agent:tW,ClientRequest:eW,IncomingMessage:$B,METHODS:QB,OutgoingMessage:qB,STATUS_CODES:KB,Server:JB,ServerResponse:VB,createServer:UB,get:ZB,globalAgent:GB,maxHeaderSize:WB,request:BB,setMaxIdleHTTPParsers:zB,validateHeaderName:FB,validateHeaderValue:MB}=rK,wB=rK});var N8=globalThis;if(typeof N8.global>"u")N8.global=globalThis;if(typeof N8.__require>"u")N8.__require=($)=>{throw Error(`Dynamic require of "${$}" is not supported in the sandbox`)};t0();var Uz=J9(h9(),1);var c7=J9(HK(),1);function W2($,q,Q,K){function J(Z){return Z instanceof Q?Z:new Q(function(G){G(Z)})}return new(Q||(Q=Promise))(function(Z,G){function W(U){try{V(K.next(U))}catch(w){G(w)}}function B(U){try{V(K.throw(U))}catch(w){G(w)}}function V(U){U.done?Z(U.value):J(U.value).then(W,B)}V((K=K.apply($,q||[])).next())})}var L0=914400,w8=12700,n0=`\r -`,NB=2147483649,j7=/^[0-9a-fA-F]{6}$/,YB=1.67,kB=27,H6={type:"solid",color:"666666",pt:1},JJ=[0.05,0.1,0.05,0.1],v6={color:"363636",pt:1},u1={color:"888888",style:"solid",size:1,cap:"flat"},Q2="000000",k2=12,DB=18,f6="LAYOUT_16x9",x7="DEFAULT",VJ="333333",P1={type:"outer",blur:3,offset:1.811023622047244,angle:90,color:"000000",opacity:0.35,rotateWithShape:!0},M8=[0.5,0.5,0.5,0.5],eK={color:"000000"},LB={size:8,color:"FFFFFF",opacity:0.75},o2="2094734552",Y5="2094734553",B8="2094734554",O7="2094734555",UJ="2094734556",W8="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),z8=["C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360","C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360"],HB=["5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7","5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7"],R6;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(R6||(R6={}));var I6;(function($){$.b="b",$.ctr="ctr",$.t="t"})(I6||(I6={}));var ZJ="{F7021451-1387-4CA6-816F-3879F97B5CBC}",P7;(function($){$.arraybuffer="arraybuffer",$.base64="base64",$.binarystring="binarystring",$.blob="blob",$.nodebuffer="nodebuffer",$.uint8array="uint8array"})(P7||(P7={}));var T7;(function($){$.area="area",$.bar="bar",$.bar3d="bar3D",$.bubble="bubble",$.bubble3d="bubble3D",$.doughnut="doughnut",$.line="line",$.pie="pie",$.radar="radar",$.scatter="scatter"})(T7||(T7={}));var u7;(function($){$.accentBorderCallout1="accentBorderCallout1",$.accentBorderCallout2="accentBorderCallout2",$.accentBorderCallout3="accentBorderCallout3",$.accentCallout1="accentCallout1",$.accentCallout2="accentCallout2",$.accentCallout3="accentCallout3",$.actionButtonBackPrevious="actionButtonBackPrevious",$.actionButtonBeginning="actionButtonBeginning",$.actionButtonBlank="actionButtonBlank",$.actionButtonDocument="actionButtonDocument",$.actionButtonEnd="actionButtonEnd",$.actionButtonForwardNext="actionButtonForwardNext",$.actionButtonHelp="actionButtonHelp",$.actionButtonHome="actionButtonHome",$.actionButtonInformation="actionButtonInformation",$.actionButtonMovie="actionButtonMovie",$.actionButtonReturn="actionButtonReturn",$.actionButtonSound="actionButtonSound",$.arc="arc",$.bentArrow="bentArrow",$.bentUpArrow="bentUpArrow",$.bevel="bevel",$.blockArc="blockArc",$.borderCallout1="borderCallout1",$.borderCallout2="borderCallout2",$.borderCallout3="borderCallout3",$.bracePair="bracePair",$.bracketPair="bracketPair",$.callout1="callout1",$.callout2="callout2",$.callout3="callout3",$.can="can",$.chartPlus="chartPlus",$.chartStar="chartStar",$.chartX="chartX",$.chevron="chevron",$.chord="chord",$.circularArrow="circularArrow",$.cloud="cloud",$.cloudCallout="cloudCallout",$.corner="corner",$.cornerTabs="cornerTabs",$.cube="cube",$.curvedDownArrow="curvedDownArrow",$.curvedLeftArrow="curvedLeftArrow",$.curvedRightArrow="curvedRightArrow",$.curvedUpArrow="curvedUpArrow",$.custGeom="custGeom",$.decagon="decagon",$.diagStripe="diagStripe",$.diamond="diamond",$.dodecagon="dodecagon",$.donut="donut",$.doubleWave="doubleWave",$.downArrow="downArrow",$.downArrowCallout="downArrowCallout",$.ellipse="ellipse",$.ellipseRibbon="ellipseRibbon",$.ellipseRibbon2="ellipseRibbon2",$.flowChartAlternateProcess="flowChartAlternateProcess",$.flowChartCollate="flowChartCollate",$.flowChartConnector="flowChartConnector",$.flowChartDecision="flowChartDecision",$.flowChartDelay="flowChartDelay",$.flowChartDisplay="flowChartDisplay",$.flowChartDocument="flowChartDocument",$.flowChartExtract="flowChartExtract",$.flowChartInputOutput="flowChartInputOutput",$.flowChartInternalStorage="flowChartInternalStorage",$.flowChartMagneticDisk="flowChartMagneticDisk",$.flowChartMagneticDrum="flowChartMagneticDrum",$.flowChartMagneticTape="flowChartMagneticTape",$.flowChartManualInput="flowChartManualInput",$.flowChartManualOperation="flowChartManualOperation",$.flowChartMerge="flowChartMerge",$.flowChartMultidocument="flowChartMultidocument",$.flowChartOfflineStorage="flowChartOfflineStorage",$.flowChartOffpageConnector="flowChartOffpageConnector",$.flowChartOnlineStorage="flowChartOnlineStorage",$.flowChartOr="flowChartOr",$.flowChartPredefinedProcess="flowChartPredefinedProcess",$.flowChartPreparation="flowChartPreparation",$.flowChartProcess="flowChartProcess",$.flowChartPunchedCard="flowChartPunchedCard",$.flowChartPunchedTape="flowChartPunchedTape",$.flowChartSort="flowChartSort",$.flowChartSummingJunction="flowChartSummingJunction",$.flowChartTerminator="flowChartTerminator",$.folderCorner="folderCorner",$.frame="frame",$.funnel="funnel",$.gear6="gear6",$.gear9="gear9",$.halfFrame="halfFrame",$.heart="heart",$.heptagon="heptagon",$.hexagon="hexagon",$.homePlate="homePlate",$.horizontalScroll="horizontalScroll",$.irregularSeal1="irregularSeal1",$.irregularSeal2="irregularSeal2",$.leftArrow="leftArrow",$.leftArrowCallout="leftArrowCallout",$.leftBrace="leftBrace",$.leftBracket="leftBracket",$.leftCircularArrow="leftCircularArrow",$.leftRightArrow="leftRightArrow",$.leftRightArrowCallout="leftRightArrowCallout",$.leftRightCircularArrow="leftRightCircularArrow",$.leftRightRibbon="leftRightRibbon",$.leftRightUpArrow="leftRightUpArrow",$.leftUpArrow="leftUpArrow",$.lightningBolt="lightningBolt",$.line="line",$.lineInv="lineInv",$.mathDivide="mathDivide",$.mathEqual="mathEqual",$.mathMinus="mathMinus",$.mathMultiply="mathMultiply",$.mathNotEqual="mathNotEqual",$.mathPlus="mathPlus",$.moon="moon",$.noSmoking="noSmoking",$.nonIsoscelesTrapezoid="nonIsoscelesTrapezoid",$.notchedRightArrow="notchedRightArrow",$.octagon="octagon",$.parallelogram="parallelogram",$.pentagon="pentagon",$.pie="pie",$.pieWedge="pieWedge",$.plaque="plaque",$.plaqueTabs="plaqueTabs",$.plus="plus",$.quadArrow="quadArrow",$.quadArrowCallout="quadArrowCallout",$.rect="rect",$.ribbon="ribbon",$.ribbon2="ribbon2",$.rightArrow="rightArrow",$.rightArrowCallout="rightArrowCallout",$.rightBrace="rightBrace",$.rightBracket="rightBracket",$.round1Rect="round1Rect",$.round2DiagRect="round2DiagRect",$.round2SameRect="round2SameRect",$.roundRect="roundRect",$.rtTriangle="rtTriangle",$.smileyFace="smileyFace",$.snip1Rect="snip1Rect",$.snip2DiagRect="snip2DiagRect",$.snip2SameRect="snip2SameRect",$.snipRoundRect="snipRoundRect",$.squareTabs="squareTabs",$.star10="star10",$.star12="star12",$.star16="star16",$.star24="star24",$.star32="star32",$.star4="star4",$.star5="star5",$.star6="star6",$.star7="star7",$.star8="star8",$.stripedRightArrow="stripedRightArrow",$.sun="sun",$.swooshArrow="swooshArrow",$.teardrop="teardrop",$.trapezoid="trapezoid",$.triangle="triangle",$.upArrow="upArrow",$.upArrowCallout="upArrowCallout",$.upDownArrow="upDownArrow",$.upDownArrowCallout="upDownArrowCallout",$.uturnArrow="uturnArrow",$.verticalScroll="verticalScroll",$.wave="wave",$.wedgeEllipseCallout="wedgeEllipseCallout",$.wedgeRectCallout="wedgeRectCallout",$.wedgeRoundRectCallout="wedgeRoundRectCallout"})(u7||(u7={}));var G2;(function($){$.text1="tx1",$.text2="tx2",$.background1="bg1",$.background2="bg2",$.accent1="accent1",$.accent2="accent2",$.accent3="accent3",$.accent4="accent4",$.accent5="accent5",$.accent6="accent6"})(G2||(G2={}));var S7;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(S7||(S7={}));var E7;(function($){$.top="top",$.middle="middle",$.bottom="bottom"})(E7||(E7={}));var B1;(function($){$.ACTION_BUTTON_BACK_OR_PREVIOUS="actionButtonBackPrevious",$.ACTION_BUTTON_BEGINNING="actionButtonBeginning",$.ACTION_BUTTON_CUSTOM="actionButtonBlank",$.ACTION_BUTTON_DOCUMENT="actionButtonDocument",$.ACTION_BUTTON_END="actionButtonEnd",$.ACTION_BUTTON_FORWARD_OR_NEXT="actionButtonForwardNext",$.ACTION_BUTTON_HELP="actionButtonHelp",$.ACTION_BUTTON_HOME="actionButtonHome",$.ACTION_BUTTON_INFORMATION="actionButtonInformation",$.ACTION_BUTTON_MOVIE="actionButtonMovie",$.ACTION_BUTTON_RETURN="actionButtonReturn",$.ACTION_BUTTON_SOUND="actionButtonSound",$.ARC="arc",$.BALLOON="wedgeRoundRectCallout",$.BENT_ARROW="bentArrow",$.BENT_UP_ARROW="bentUpArrow",$.BEVEL="bevel",$.BLOCK_ARC="blockArc",$.CAN="can",$.CHART_PLUS="chartPlus",$.CHART_STAR="chartStar",$.CHART_X="chartX",$.CHEVRON="chevron",$.CHORD="chord",$.CIRCULAR_ARROW="circularArrow",$.CLOUD="cloud",$.CLOUD_CALLOUT="cloudCallout",$.CORNER="corner",$.CORNER_TABS="cornerTabs",$.CROSS="plus",$.CUBE="cube",$.CURVED_DOWN_ARROW="curvedDownArrow",$.CURVED_DOWN_RIBBON="ellipseRibbon",$.CURVED_LEFT_ARROW="curvedLeftArrow",$.CURVED_RIGHT_ARROW="curvedRightArrow",$.CURVED_UP_ARROW="curvedUpArrow",$.CURVED_UP_RIBBON="ellipseRibbon2",$.CUSTOM_GEOMETRY="custGeom",$.DECAGON="decagon",$.DIAGONAL_STRIPE="diagStripe",$.DIAMOND="diamond",$.DODECAGON="dodecagon",$.DONUT="donut",$.DOUBLE_BRACE="bracePair",$.DOUBLE_BRACKET="bracketPair",$.DOUBLE_WAVE="doubleWave",$.DOWN_ARROW="downArrow",$.DOWN_ARROW_CALLOUT="downArrowCallout",$.DOWN_RIBBON="ribbon",$.EXPLOSION1="irregularSeal1",$.EXPLOSION2="irregularSeal2",$.FLOWCHART_ALTERNATE_PROCESS="flowChartAlternateProcess",$.FLOWCHART_CARD="flowChartPunchedCard",$.FLOWCHART_COLLATE="flowChartCollate",$.FLOWCHART_CONNECTOR="flowChartConnector",$.FLOWCHART_DATA="flowChartInputOutput",$.FLOWCHART_DECISION="flowChartDecision",$.FLOWCHART_DELAY="flowChartDelay",$.FLOWCHART_DIRECT_ACCESS_STORAGE="flowChartMagneticDrum",$.FLOWCHART_DISPLAY="flowChartDisplay",$.FLOWCHART_DOCUMENT="flowChartDocument",$.FLOWCHART_EXTRACT="flowChartExtract",$.FLOWCHART_INTERNAL_STORAGE="flowChartInternalStorage",$.FLOWCHART_MAGNETIC_DISK="flowChartMagneticDisk",$.FLOWCHART_MANUAL_INPUT="flowChartManualInput",$.FLOWCHART_MANUAL_OPERATION="flowChartManualOperation",$.FLOWCHART_MERGE="flowChartMerge",$.FLOWCHART_MULTIDOCUMENT="flowChartMultidocument",$.FLOWCHART_OFFLINE_STORAGE="flowChartOfflineStorage",$.FLOWCHART_OFFPAGE_CONNECTOR="flowChartOffpageConnector",$.FLOWCHART_OR="flowChartOr",$.FLOWCHART_PREDEFINED_PROCESS="flowChartPredefinedProcess",$.FLOWCHART_PREPARATION="flowChartPreparation",$.FLOWCHART_PROCESS="flowChartProcess",$.FLOWCHART_PUNCHED_TAPE="flowChartPunchedTape",$.FLOWCHART_SEQUENTIAL_ACCESS_STORAGE="flowChartMagneticTape",$.FLOWCHART_SORT="flowChartSort",$.FLOWCHART_STORED_DATA="flowChartOnlineStorage",$.FLOWCHART_SUMMING_JUNCTION="flowChartSummingJunction",$.FLOWCHART_TERMINATOR="flowChartTerminator",$.FOLDED_CORNER="folderCorner",$.FRAME="frame",$.FUNNEL="funnel",$.GEAR_6="gear6",$.GEAR_9="gear9",$.HALF_FRAME="halfFrame",$.HEART="heart",$.HEPTAGON="heptagon",$.HEXAGON="hexagon",$.HORIZONTAL_SCROLL="horizontalScroll",$.ISOSCELES_TRIANGLE="triangle",$.LEFT_ARROW="leftArrow",$.LEFT_ARROW_CALLOUT="leftArrowCallout",$.LEFT_BRACE="leftBrace",$.LEFT_BRACKET="leftBracket",$.LEFT_CIRCULAR_ARROW="leftCircularArrow",$.LEFT_RIGHT_ARROW="leftRightArrow",$.LEFT_RIGHT_ARROW_CALLOUT="leftRightArrowCallout",$.LEFT_RIGHT_CIRCULAR_ARROW="leftRightCircularArrow",$.LEFT_RIGHT_RIBBON="leftRightRibbon",$.LEFT_RIGHT_UP_ARROW="leftRightUpArrow",$.LEFT_UP_ARROW="leftUpArrow",$.LIGHTNING_BOLT="lightningBolt",$.LINE_CALLOUT_1="borderCallout1",$.LINE_CALLOUT_1_ACCENT_BAR="accentCallout1",$.LINE_CALLOUT_1_BORDER_AND_ACCENT_BAR="accentBorderCallout1",$.LINE_CALLOUT_1_NO_BORDER="callout1",$.LINE_CALLOUT_2="borderCallout2",$.LINE_CALLOUT_2_ACCENT_BAR="accentCallout2",$.LINE_CALLOUT_2_BORDER_AND_ACCENT_BAR="accentBorderCallout2",$.LINE_CALLOUT_2_NO_BORDER="callout2",$.LINE_CALLOUT_3="borderCallout3",$.LINE_CALLOUT_3_ACCENT_BAR="accentCallout3",$.LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR="accentBorderCallout3",$.LINE_CALLOUT_3_NO_BORDER="callout3",$.LINE_CALLOUT_4="borderCallout4",$.LINE_CALLOUT_4_ACCENT_BAR="accentCallout3=4",$.LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR="accentBorderCallout4",$.LINE_CALLOUT_4_NO_BORDER="callout4",$.LINE="line",$.LINE_INVERSE="lineInv",$.MATH_DIVIDE="mathDivide",$.MATH_EQUAL="mathEqual",$.MATH_MINUS="mathMinus",$.MATH_MULTIPLY="mathMultiply",$.MATH_NOT_EQUAL="mathNotEqual",$.MATH_PLUS="mathPlus",$.MOON="moon",$.NON_ISOSCELES_TRAPEZOID="nonIsoscelesTrapezoid",$.NOTCHED_RIGHT_ARROW="notchedRightArrow",$.NO_SYMBOL="noSmoking",$.OCTAGON="octagon",$.OVAL="ellipse",$.OVAL_CALLOUT="wedgeEllipseCallout",$.PARALLELOGRAM="parallelogram",$.PENTAGON="homePlate",$.PIE="pie",$.PIE_WEDGE="pieWedge",$.PLAQUE="plaque",$.PLAQUE_TABS="plaqueTabs",$.QUAD_ARROW="quadArrow",$.QUAD_ARROW_CALLOUT="quadArrowCallout",$.RECTANGLE="rect",$.RECTANGULAR_CALLOUT="wedgeRectCallout",$.REGULAR_PENTAGON="pentagon",$.RIGHT_ARROW="rightArrow",$.RIGHT_ARROW_CALLOUT="rightArrowCallout",$.RIGHT_BRACE="rightBrace",$.RIGHT_BRACKET="rightBracket",$.RIGHT_TRIANGLE="rtTriangle",$.ROUNDED_RECTANGLE="roundRect",$.ROUNDED_RECTANGULAR_CALLOUT="wedgeRoundRectCallout",$.ROUND_1_RECTANGLE="round1Rect",$.ROUND_2_DIAG_RECTANGLE="round2DiagRect",$.ROUND_2_SAME_RECTANGLE="round2SameRect",$.SMILEY_FACE="smileyFace",$.SNIP_1_RECTANGLE="snip1Rect",$.SNIP_2_DIAG_RECTANGLE="snip2DiagRect",$.SNIP_2_SAME_RECTANGLE="snip2SameRect",$.SNIP_ROUND_RECTANGLE="snipRoundRect",$.SQUARE_TABS="squareTabs",$.STAR_10_POINT="star10",$.STAR_12_POINT="star12",$.STAR_16_POINT="star16",$.STAR_24_POINT="star24",$.STAR_32_POINT="star32",$.STAR_4_POINT="star4",$.STAR_5_POINT="star5",$.STAR_6_POINT="star6",$.STAR_7_POINT="star7",$.STAR_8_POINT="star8",$.STRIPED_RIGHT_ARROW="stripedRightArrow",$.SUN="sun",$.SWOOSH_ARROW="swooshArrow",$.TEAR="teardrop",$.TRAPEZOID="trapezoid",$.UP_ARROW="upArrow",$.UP_ARROW_CALLOUT="upArrowCallout",$.UP_DOWN_ARROW="upDownArrow",$.UP_DOWN_ARROW_CALLOUT="upDownArrowCallout",$.UP_RIBBON="ribbon2",$.U_TURN_ARROW="uturnArrow",$.VERTICAL_SCROLL="verticalScroll",$.WAVE="wave"})(B1||(B1={}));var q0;(function($){$.AREA="area",$.BAR="bar",$.BAR3D="bar3D",$.BUBBLE="bubble",$.BUBBLE3D="bubble3D",$.DOUGHNUT="doughnut",$.LINE="line",$.PIE="pie",$.RADAR="radar",$.SCATTER="scatter"})(q0||(q0={}));var L5;(function($){$.TEXT1="tx1",$.TEXT2="tx2",$.BACKGROUND1="bg1",$.BACKGROUND2="bg2",$.ACCENT1="accent1",$.ACCENT2="accent2",$.ACCENT3="accent3",$.ACCENT4="accent4",$.ACCENT5="accent5",$.ACCENT6="accent6"})(L5||(L5={}));var W1;(function($){$.chart="chart",$.image="image",$.line="line",$.rect="rect",$.text="text",$.placeholder="placeholder"})(W1||(W1={}));var D0;(function($){$.chart="chart",$.hyperlink="hyperlink",$.image="image",$.media="media",$.online="online",$.placeholder="placeholder",$.table="table",$.tablecell="tablecell",$.text="text",$.notes="notes"})(D0||(D0={}));var F8;(function($){$.title="title",$.body="body",$.image="pic",$.chart="chart",$.table="tbl",$.media="media"})(F8||(F8={}));var C6;(function($){$.DEFAULT="•",$.CHECK="✓",$.STAR="★",$.TRIANGLE="▶"})(C6||(C6={}));var j6="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOVhAAAGAUlEQVR4Xu2dT0xcRRzHf7tAYSsc0EBSIq2xEg8mtTGebVzEqOVIolz0siRE4gGTStqKwdpWsXoyGhMuyAVJOHBgqyvLNgonDkabeCBYW/8kTUr0wsJC+Wfm0bfuvn37Znbem9mR9303mJnf/Pb7ed95M7PDI5JIJPYJV5EC7e3t1N/fT62trdqViQCIu+bVgpIHEo/Hqbe3V/sdYVKHyWSSZmZm8ilVA0oeyNjYmEnaVC2Xvr6+qg5fAOJAz4DU1dURGzFSqZRVqtMpAFIGyMjICC0vL9PExIRWKADiAYTNshYWFrRCARAOEFZcCKWtrY0GBgaUTYkBRACIE4rKZwqACALR5RQAqQCIDqcASIVAVDsFQCSAqHQKgEgCUeUUAPEBRIVTAMQnEBvK5OQkbW9vk991CoAEAMQJxc86BUACAhKUUwAkQCBBOAVAAgbi1ykAogCIH6cAiCIgsk4BEIVAZJwCIIqBVLqiBxANQFgXS0tLND4+zl08AogmIG5OSSQS1gGKwgtANAIRcQqAaAbCe6YASBWA2E6xDyeyDUl7+AKQMkDYYevm5mZHabA/Li4uUiaTsYLau8QA4gLE/hU7wajyYtv1hReDAiAOxQcHBymbzark4BkbQKom/X8dp9Npmpqasn4BIAYAYSnYp+4BBEAMUcCwNOCQsAKZnp62NtQOw8WmwT09PUo+ijaHsOMx7GppaaH6+nolH0Z10K2tLVpdXbW6UfV3mNqBdHd3U1NTk2rtlMRfW1uj2dlZAFGirkRQAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAGHqrm8caPzQ0WC1logbeiC7X3xJm0PvUmRzh45cuki1588FAmVn9BO6P3yF9utrqGH0MtW82S8UN9RA9v/4k7InjhcJFTs/TLVXLwmJV67S7vD7tHF5pKi46fYdosdOcOOGG8j1OcqefbFEJD9Q3GCwDhqT31HklS4A8VRgfYM2Op6k3bt/BQJl58J7lPvwg5JYNccepaMry0LPqFA7hCm39+NNyp2J0172b19QysGINj5CsRtpij57musOViH0QPJQXn6J9u7dlYJSFkbrMYolrwvDAJAC+WWdEpQz7FTgECeUCpzi6YxvvqXoM6eEhqnCSgDikEzUKUE7Aw7xuHctKB5OYU3dZlNR9syQdAaAcAYTC0pXF+39c09o2Ik+3EqxVKqiB7hbYAxZkk4pbBaEM+AQofv+wTrFwylBOQNABIGwavdfe4O2pg5elO+86l99nY58/VUF0byrYsjiSFluNlXYrOHcBar7+EogUADEQ0YRGHbzoKAASBkg2+9cpM1rV0tK2QOcXW7bLEFAARAXIF4w2DrDWoeUWaf4hQIgDiA8GPZ2iNfi0Q8UACkAIgrDbrJ385eDxaPLLrEsFAB5oG6lMPJQPLZZZKAACBGVhcG2Q+bmuLu2nk55e4jqPv1IeEoceiBeX7s2zCa5MAqdstl91vfXwaEGsv/rb5TtOFk6tWXOuJGh6KmnhO9sayrMninPx103JBtXblHkice58cINZP4Hyr5wpkgkdiChEmc4FWazLzenNKa/p0jncwDiqcD6BuWePk07t1asatZGoYQzSqA4nFJ7soNiP/+EUyfc25GI2GG53dHPrKo1g/1Cw4pIXLrzO+1c+/wg7tBbFDle/EbQcjFCPWQJCau5EoBoFpzXHYDwFNJcDiCaBed1ByA8hTSXA4hmwXndAQhPIc3lAKJZcF53AMJTSHM5gGgWnNcdgPAU0lwOIJoF53UHIDyFNJcfSiCdnZ0Ui8U0SxlMd7lcjubn561gh+Y1scFIU/0o/3sgeLO12E2k7UXKYumgFoAYdg8ACIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6ZQ4JB6PKzviYthnNy4d9h+1M5mMlVckkUjsG5dhiBMCEMPg/wuOfrZZ/RSywQAAAABJRU5ErkJggg==",vB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB4AAAAVnCAYAAACzfHDVAAAAYHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjaVcjJDYAwDEXBu6ughBfH+YnLQSwSHVA+Yrkwx7HtPHabHuEWrQ+lBBAZ6TMweBWoCwUH8quZH6VWFXVT696zxp12ARkVFEqn8wB8AAAACXBIWXMAAC4jAAAuIwF4pT92AADZLklEQVR42uzdd5hV9Z0/8M+dmcsUZmDovYOhKCiKYhR7JJuoSTCWGFI0WUxijBoTTXazVlyza4maYm9rTRSJigVsqCDNQhHBAogKCEgRMjMMU+7vj93sL8kqClLmnPt6PY+PeXZM9vP9vO8jZ+Y955xMfJLjorBrRMuSgmiViyjN1Ee2oSCyucbIBAAAAAAAAADbXaYgcoWNUZcrirpMbdRsysa69wbF+rggGrf439vSF7seF12aFUTnxvoosGIAAAAAAACAXacgoqEgF++/VRgr4r5o+Kh/pvD//F8uiII+LaPrum/EXzqui2b1ddHGKgEAAAAAAAB2rVxEQWMmWrQtjHZlA6N2w2tR84//zP8pgHu3ib6NBdG+zdqorK6KVUXZaB85j3sGAAAAAAAAaAoaG6OwIBdtyneP2PBabPzbr/1dAdx3VHRtyESHiIhcYzQrLo7WmVzkcjmPgAYAAAAAAABoSgpy0eIfS+D/LYD7fy3abC6Inn/7X2hsjELlLwAAAAAAAEDT9D8lcM1fHwddFBFxyAVR9M686PVp/gfqayKiJiLqLBMAAAAAAABgh8hGRGlEUekn/6PFEb3ikNgQk6O+KCJi6dzoksv83/cB/1X9xoiaJdmoWxlRV1dk2QAAAAAAAAA7QTZbH9muERX96v7n9t7/q6Exinq3i86LI94pjOOisHUu+uYykfmof7h+Y8Sa6aVRt74gGhs9DRoAAAAAAABgZ2lsLIi69QWxeUUmSjs0/vedwR8hk4uydSfE+wVd6qOyMfMx7/mtj9jwUtbjngEAAAAAAAB2obrqolg7IxtR/9Ffb4wo7P5GtCwobRaVH/c/UvNmNuqqPfIZAAAAAAAAYFerqy6KmjezH/v1ktpoVZBr/PgCeMN7yl8AAAAAAACApmJLHW5jUVQWNDSP+Q3ZeLco4i9/+8X6teHRzwAAAAAAAABNSd3/dLn/oLAoqqIuVhXFxhhSGB/xqGjlLwAAAAAAAECTU1eTjaK/KXSLIv7SWB+bc5ko9YxnAAAAAAAAgATJFv393bz1EeV//c8F1gMAAAAAAACQDgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKREkRUAAACwrUpLSwuGDRvWfMCAAS26du3avKysrLiioqKkZcuWzZs1a1bcvHnz0tLS0rJsNtusuLi4ebNmzUoLCgo+8/eijY2N9Zs3b66pra2tqqur21xTU1NdVVVVs2nTptqNGzdWbdiwoeYvf/nL5hUrVlQtWLBgw6xZs6pqamoaJQYAAEDaKYABAACIiIghQ4aUHnTQQW379u3bql27dq3at2/fpkWLFq2bN29eWVpa2qpZs2bNCwsLm2ez2fLCwsLyoqKi8sLCwtKknK+hoaG6vr6+qqGh4S91dXV/aWhoqNq8eXNVTU3NuqqqqvUbNmxYu2rVqjWrV69e99Zbb6177rnnPpgzZ06NTwYAAABJogAGAADIA8OGDWt+xBFHdBwwYECnLl26dGjdunXHFi1adCgtLe1YUlLSvlmzZq0KCgqK07yDwsLCssLCwrKIaPdp/zuNjY21mzdvXrdp06ZVNTU172/YsGHl2rVr31+2bNnKBQsWrHjyySffnzVrVpVPGAAAAE1Fpuexsd9HfaF+ZcSal0ptCAAAIAE6deqUPf744zvtueeeXbp3796lbdu2XSorKzuXlpZ2KS0t7VBYWFhhSztGQ0PDxpqampU1NTXL169fv+yDDz5Y9s477yybPXv2sj/96U8rVqxYUWdLAAAAbE9t9q6Jog4f/TUFMAAAQEJks9nMt7/97Y4jRozo1bdv397t2rXrXl5e3rWsrKxzcXFx+4gosKUmp7G2tnZVTU3Nso0bNy5btWrV0tdff/2tJ598cvG999672noAAADYFgpgAACAhPne977X6a9Fb/v27Xu1bNmyV1lZWa8kvXOXLauvr9/wl7/8ZdG6desWL1u2bNHChQsX/fGPf1w8derUjbYDAADAliiAAQAAmqhsNps59dRTuxx66KH9+/Tp87n27dv3Ly8v719UVOSRzXlq06ZNKzZu3Pj6+++//8abb775xqOPPvrG3XffvcpmAAAA+CsFMAAAQBNx6qmndvniF784qHfv3v3btWv3uYqKis8VFhaW2wxbUl9fv37Dhg1vfPDBB68vXrz4jccee2z+jTfeuNxmAAAA8pMCGAAAYBc45phjWn/rW9/aq3///kPatGnTv6Kiop9HOLO9NDQ0VG/cuPGtNWvWLFy4cOGcO+6445WHHnporc0AAACknwIYAABgJzjjjDO6f+lLX9qrV69eg1u3bj2orKysR0RkbIadJFddXb103bp18xcvXjz30UcffeXqq69+x1oAAADSRwEMAACwnZWWlhb86le/2u3QQw8d1r17931btmw5qLCwsMxmaEoaGhqqP/zww/nvvPPOzGeeeWbW2LFj36ipqWm0GQAAgGRTAAMAAGwHP/7xj7t+9atf3bdXr15D27Ztu1c2m21jKyRJXV3dmg8++OCVRYsWvfznP/95xh/+8IdltgIAAJA8CmAAAIBtcOKJJ7Y75ZRTDujXr9+w1q1bD81ms61shTSpq6tbt3bt2pfffPPNWbfccsvUe++9d7WtAAAANH0KYAAAgE+hoqKi4IILLhg0YsSI/bp27bpfy5YtB2YymUKbIR/kcrmGDz/8cP6777474/nnn59x4YUXvrZx40aPiwYAAGiCFMAAAAAf4/jjj2/7/e9//8D+/fsf2Lp1630KCgpKbAUiGhsbN61fv37eW2+9NeWGG2545u67715lKwAAAE2DAhgAAOB/ZLPZzAUXXPC5I4888sDu3bsfWFFRsVtEFNgMbFl1dfWSd999d8qsWbNmnnvuuS+vW7euwVYAAAB2DQUwAACQ10pLSwsuvfTSQYcccsjBXbt2HVFWVtbDVmDb1dbWrnr//fdfmDp16uRf/vKXL65evbreVgAAAHYeBTAAAJB3Bg0aVHrBBRd8fs899zywQ4cOBxQVFbWwFdj+Ghsba9euXTtrzpw5T59//vmTX3755WpbAQAA2LEUwAAAQF4YNmxY8/POO+/gIUOGHOZ9vrDz/W0ZfNFFFz07a9asKlsBAADY/hTAAABAarVq1arwyiuv3HfEiBEjO3TocFBhYWGZrcCu19DQUP3+++8/O2XKlIk/+clPZm7cuLHRVgAAALYPBTAAAJAqrVq1Kvztb3+7/3777Xd4x44dRxQWFpbbCjRdDQ0NG99///0pM2bMeOqHP/zhC8pgAACAz0YBDAAApMJZZ53V45vf/OaRvXr1GllaWtrVRiB5ampq3l28ePHEO++8c9LVV1/9jo0AAABsPQUwAACQWMOHDy+/6KKLvjB48OCjW7RoMdBGID0+/PDDV+fNmzfhvPPOe3L69Ol/sREAAIBPRwEMAAAkSqtWrQpvuOGGQ/bbb79/atOmzX6ZTCZrK5BeuVyubs2aNTNmzJjx2JgxYyavW7euwVYAAAA+ngIYAABIhB//+Mddv/e9732lZ8+e/1RcXNzWRiD/1NbWfvD2228/dssttzz029/+9l0bAQAA+L8UwAAAQJNVUVFRcO21137+4IMPPrZ169b7ZTKZAlsBIqJxzZo1M59//vnxp5122hR3BQMAAPx/CmAAAKDJOeWUUzqefvrpx/bu3ftL2Wy2jY0AH6e+vn7j0qVLH/vd7373x+uvv36ZjQAAAPlOAQwAADQJ2Ww2c+uttx5wyCGHnNC6deu9I8LdvsDWaFy7du1L06ZN+/OPfvSjZ1evXl1vJQAAQD5SAAMAALtU//79S6655pp/2nPPPY8tLy/vayPAZ1VTU7NswYIF488999wHp06dutFGAACAfKIABgAAdomf//znPU855ZQTu3btemRhYWGZjQDbW2NjY92KFSuevOWWW+689NJLF9kIAACQDxTAAADATuMxz8Cusn79+rlPP/30f5188slT6+rqcjYCAACklQIYAADY4fr27Vv8hz/84a+Pee5nI8CuUlNT8+68efPu/8EPfvDgwoULN9kIAACQNgpgAABghxkyZEjpNddc89XBgwefWFxc3MFGgKaitrZ21dy5c+/5yU9+8uc5c+bU2AgAAJAWWyqAPYoNAADYJqNHj+4wb968n06ZMuXRYcOGnaH8BZqa4uLi9sOGDTtjypQpj86bN++nJ510UntbAQAA0s4dwAAAwFY599xze33/+9//dufOnY/IZDJZGwGSIpfL1S1fvvzJG2644fbLLrvsbRsBAACSyiOgAQCAz+y8887r+53vfOfbHTt2PDyTyRTaCJBUuVyuYcWKFU/cdNNN//XrX/96sY0AAABJowAGAAC22WWXXTboG9/4xg9at249zDaAtFm7du2su++++9pzzjnnNdsAAACSQgEMAABsNcUvkE8UwQAAQJIogAEAgE9N8Qvks7Vr18665557rvv5z38+3zYAAICmaksFcGHlwOj6UV9orIqoWZG1PQAAyBO/+MUvet9xxx3nHHrooT8pLS3tYiNAPiotLe2y7777HvP973+/X1lZ2ZIpU6assxUAAKCpKetcHwXlH/01BTAAAOS5M844o/u99957zpe//OWflZeX94qIjK0AeS5TXl7e8+CDDx71/e9/v3dEvDVjxowPrQUAAGgqFMAAAMD/ceKJJ7a77777fjJq1Kh/KS8v7xOKX4B/lCkvL+99+OGHj/rWt77VfvXq1Qvnz59fbS0AAMCutqUC2DuAAQAgzwwdOrTs+uuvP6l///4nFRYWltkI20NjY2Ns2rQpqquro6amJurr62PTpk2xefPmqK+vj+rq6qivr4/NmzfHpk2boqGhYZv/fxUWFkZJSUk0a9YsioqKoqysLIqKiqJZs2ZRUlISRUVFUVpa+r9/FRQUCIjtoqGhoeq11167a8yYMffMmTOnxkYAAIBdZUvvAFYAAwBAnujUqVP2nnvuGbXXXnudnM1mK22Ej9PQ0BAbN26MDRs2/J+/Nm7cGBs3boyamprYtGlTbNq0KWpqaqK2trbJnqe4uDhKSkqitLT0f/9eUVERFRUV0aJFi//zV0VFRRQWFvog8LHq6urWvvjii7eceOKJf169enW9jQAAADubAhgAAPLcXXfdddAXv/jF00tLS7vZRn7L5XKxYcOGWLt2baxbty7Wrl37d3+tW7cuNmzYkPd7atGiRbRu3TpatWoVrVu3jjZt2vzvf27dunW0aNHCh4morq5e+sgjj1zzne98Z6ptAAAAO5MCGAAA8tTVV189+MQTTzyzoqJioG3kj8bGxli5cmUsX748Pvjgg1i9evX//n3t2rXR2NhoSZ9RYWFhtGrVKtq1axdt27b937937tw5OnTo4LHTeWbDhg3z77333qvOPPPMebYBAADsDApgAADIM1/72tfaXHrppad27979qIjQRKVUQ0NDrFq1KlasWBHvv//+//595cqVTfqRzGlXXFwcHTp0iI4dO0bnzp2jY8eO0alTp2jXrp1HS6dYLpdrfOeddx76+c9/fv2ECRPW2QgAALAjKYABACBP9OrVq9ldd931jT322OM7hYWFZTaSHh9++GG88847sXTp0njvvfdixYoVsXr16mhoaLCchCgsLIz27dtHp06dolu3btG9e/fo3r27x0mnTENDQ9W8efNu++Y3v/nHJUuWbLYRAABgR1AAAwBAHrjrrrtG/NM//dOZJSUlXWwj2davXx9Lly6Nd955539L3w8//NBiUqqysvJ/y+C//tWqVSuLSbiamppljz322G9Gjx49xTYAAIDtTQEMAAAp9qtf/arPD3/4w5+1atVqL9tIno0bN8aSJUvirbfeikWLFsV7770XmzZtspg8V1JSEl27do0+ffpE3759o3fv3lFeXm4xCbRu3bqXr7322ivGjh27yDYAAIDtRQEMAAApNGjQoNI77rjju7vttttJBQUFWRtJhtWrV8ebb74ZixcvjiVLlsTy5cujsbHRYtiigoKC6Ny5c/Tu3Tt69+4d/fr1i7Zt21pMQjQ2Nta98cYbd33rW9+6ff78+TU2AgAAfFYKYAAASJHS0tKCBx988Jj99tvvn7PZbBsbaboaGhri7bffjrfeeisWLFgQS5YscXcv201FRUX06tUr+vbtG3379o2ePXtGYWGhxTRhdXV1a2bMmHHjV77ylYdqamr85gcAALDNFMAAAJASp59+erdf/vKX51ZWVu5jG03T6tWr47XXXouFCxfGm2++GRs3brQUdooWLVpE3759Y8CAATFw4EB3CDdh69evf/E//uM//vPqq69+xzYAAIBtoQAGAICEGzRoUOm99977w969ex+byWTc4teErF+/PubNmxcLFiyIN954Q+FLk9GiRYvo169fDBgwIPbYY4+orKy0lCYkl8s1LF68eNyJJ554rcdCAwAAW0sBDAAACXbNNdcMOemkk35RVlbWyzZ2vVwuF++++27MnTs3XnvttViyZIl3+NLkFRQURK9evWLQoEExePDg6Natm6U0EdXV1UvuvvvuX//kJz+ZYxsAAMCnpQAGAIAEOuqoo1r99re//VmHDh0Ot41da9OmTTF79uyYO3duLFy4MKqqqiyFRGvevHn0798/Bg8eHHvuuWeUlJRYyi62cuXKp04//fTLJ0yYsM42AACAT6IABgCAhBk3btwRRxxxxFnZbLaNbewaVVVVMXfu3Jg7d27Mnz8/amtrLYVUKi4ujoEDB8bgwYNj8ODBUV5ebim7SF1d3ZqnnnrqqlGjRj1hGwAAwJYogAEAICFOOeWUjhdddNEvW7duvZ9t7HwrV66MWbNmxdy5c+Odd96JXC5nKeSdzp07x9577x3Dhg2LDh06WMgusHbt2hnnnXfepbfccsv7tgEAAHwUBTAAADRxpaWlBU899dQ3Bw8e/L2CggLPYt2JVqxYES+99FK89NJLsXz5cguBv/HXMnjvvfeOTp06WchO1NjYuGnu3Lk3H3744XfV1NR40TgAAPB3FMAAANCEjR49usOll176yzZt2gy3jZ1j/fr18eKLL8bMmTNj6dKlFgKfQs+ePWPfffeNYcOGRYsWLSxkJ1mzZs0L55577q/vvvvuVbYBAAD8lQIYAACaoIqKioKJEyd+c/Dgwd8vKCgotpEda8OGDfHiiy/G9OnTlb7wGfXo0SOGDx8ew4YNi4qKCgvZwdwNDAAA/CMFMAAANDGnnHJKx7Fjx/5rZWXlMNvYcerr6+PVV1+NGTNmxLx586Kurs5SYDvKZrMxZMiQ2HfffWP33XePwsJCS9mB1q5dO+MXv/jFv995550rbQMAAPKbAhgAAJqIbDabeeKJJ47fZ599fuSu3x0jl8vFwoULY/r06TF79uzYtGmTpcBOUFpaGkOGDInhw4fHgAEDLGQHaWhoqJ42bdo1Rx555J9tAwAA8pcCGAAAmoDjjz++7ZVXXvmr1q1be9fvDrBmzZqYNm1azJw5M1audHMc7EodO3aMz3/+87H//vt7X/CO+3fetDPPPPOScePGfWAbAACQfxTAAACwi9100037HXvssf9WXFzc1ja2n1wuF6+99lo8//zzMW/evKivr7cUaEKKiopizz33jBEjRsTnPve5yGQylrId1dbWrvrjH/948Q9+8INZtgEAAPlFAQwAALvIkCFDSu+///5zunTp8k+2sf2sXbs2Jk+eHNOnT48PP/zQQiABKisrY8SIEXHIIYdEeXm5hWxHy5Yte+zrX//6f86ZM6fGNgAAID9sqQAurBwYXT/qC41VETUrsrYHAADb6IILLtjt97///VVt2rQZZhvbx+LFi2P8+PFx9913xxtvvBG1tbWWAgmxadOmeOONN+LZZ5+NtWvXRps2bTweejtp0aJFv5NOOumg0tLSuc8+++xaGwEAgPQr61wfBR/zu7XuAAYAgO0sm81mJk2a9PVhw4b9pKCgwG9VfkZ1dXUxY8aMeOaZZ+K9996zEEiRfv36xSGHHBJDhw6NgoICC/mMGhsbN8+YMeOaL37xi+Pq6upyNgIAAOnlEdAAALCTHH/88W2vuuqqCyorK/exjc9mzZo18dRTT8XUqVNj06ZNFgIpVlFREZ///OfjsMMOi8rKSgv5jNavXz/r9NNPv3DcuHEf2AYAAKSTAhgAAHaC22677fNf+9rXzstms5W2se0WLVoUjz/+eMybNy9yOTewQT4pKiqKIUOGxBFHHBG9e/e2kM+grq5u3QMPPHDRySefPM02AAAgfRTAAACwA1VUVBQ8/fTTpwwcOPCUTCbjGabbIJfLxauvvhpPPvlkLFy40EIgz2UymRgwYEAcccQRMWjQIAvZ9n+3Ns6fP/+Www8//JaNGzc22ggAAKTHlgrgwsqB0fWjvtBYFVGzwuvKAABgS0488cR2EyZMuLx79+5fzmQyGRvZOo2NjTFr1qy49dZb48knn4wPPvC0UuC/rV69OmbMmBFz5syJ0tLS6NSpU/jX7NbJZDKZ9u3bD/3+978/dPny5TNfffXValsBAIB0KOtcHwXlH/O9gDuAAQBg29x66637H3vssRcWFRW1sI2tU1NTE0899VQ8++yzsWHDBgsBPlGLFi3i4IMPjsMPPzxKS/28YmvV19d/OG7cuPNPPvnk6bYBAADJ5xHQAACwHWWz2cyzzz77rSFDhvzAI5+3zqZNm2Ly5Mnx1FNPKX6BbdKiRYs47LDD4pBDDlEEb6VcLtfwyiuvXHfooYfeWVdX5yXrAACQYApgAADYTo455pjW11133cWVlZV728ant2HDhnj88cdjypQpUVtbayHAZ1ZcXBwHHnhgfPGLX4wWLTyIYWusWbNm2re//e3zn3nmGb+JAwAACeUdwAAAsB1cfvnlu1900UW/LS8v72cbn05VVVVMmDAhbrnllnjzzTejoaHBUoDtoqGhIZYsWRLPPfdc1NTURI8ePSKb9XOMT6OsrKzb17/+9SPbtm0774knnlhtIwAAkMDreu8ABgCAz+bhhx/+8qGHHnpOQUFBsW18sk2bNsUzzzwTTzzxRFRVVVkIsMOVl5fHkUceGYccckgUF/tX9afR2Ni46emnn/71Mccc87htAABAsngENAAAbKN27doVTZ48+YxevXodZxufrK6uLp5++umYOHGi4hfYJSoqKuKLX/xiHHzwwe4I/pQWLVr0x4MOOuiadevWeUwDAAAkhEdAAwDANjj22GPbPvzww7/p2LHjobaxZXV1dfHkk0/GddddF3Pnzo26ujpLAXaJzZs3x2uvvRbPPfdcRET06NEjCgsLLWYLWrduvfv3vve9fd9+++1pCxYsqLYRAABo+rb0CGgFMAAAfITLL7989wsuuOB3zZs372UbH6+xsTGmTJkS119/fbzyyiuKX6DJ2Lx5cyxYsCCmT58excXF0a1bt8hkMhbzMUpKSjp8+ctfPrJt27ZzvBcYAACaPu8ABgCArTB+/Pgjv/CFL/xLQUFBiW18vAULFsT48eNj6dKllgE0eT169IivfOUrMWjQIMvYgsbGxpqJEydecuyxxz5pGwAA0HR5BzAAAHwK7dq1K3ruued+1qNHj6/axsdbtGhR3H///bF48WLLABKnV69ecdxxx0WfPn0sYwuWLl3654MOOujy1atX19sGAAA0Pd4BDAAAn2DYsGHNn3766V936tTpC7bx0TZs2BD33Xdf/PGPf4y1a9daCJBI69evj2nTpsW6deuiZ8+eUVLiYQ8fpbKysv+3v/3t/lOmTJmyfPlyz/cHAIAmxjuAAQBgC372s5/1uP76669t0aKF54J+hJqamhg/fnzcfPPN8fbbb0cul7MUINFyuVy888478cwzz0RVVVX07t07slk/A/lHZWVl3U488cTD6+rqZkyfPv1DGwEAgCZ0va4ABgCAj3bFFVfscdZZZ11dXFzcwTb+Xi6XixkzZsR1110XCxYsiMbGRksBUqWxsTGWLFkSM2bMiPLy8ujSpUtkMhmL+RvZbLbFQQcddHibNm1mP/HEE6ttBAAAmoYtFcDeAQwAQN6aNGnSqAMOOODsTCZTaBt/b9GiRXHPPffEu+++axlA3ujWrVucdNJJ0bt3b8v4B7lcrm7y5Mm//vKXv/yIbQAAwK63pXcAK4ABAMg7paWlBTNnzjyzT58+x9vG39uwYUOMGzcuZsyY4VHPQF7KZDKx3377xde//vWoqKiwkH+waNGiP+27775X1dTUeCwEAADsQgpgAAD4H926dctOnjz5V506dRppG/9fLpeLqVOnxp///OfYuHGjhQB5r6KiIkaNGhX777+/x0L/g+XLlz9+6KGHXvLuu+/W2QYAAOwaWyqAvQMYAIC8MXz48PInnnjiynbt2o2wjf/vnXfeiWuvvTaee+652Lx5s4UARMTmzZtjzpw58dprr0XPnj2jRYsWlvI/Kioq+n7rW98aMnXq1Ofee+89f3AAAMAusKV3ACuAAQDIC9/+9rc73n777X9o0aLFANv4b1VVVXHXXXfFvffeG+vXr7cQgI+wbt26eP7552P9+vWx2267RVFRkaVERElJSefjjjvuoA8++GDKK6+88hcbAQCAnUsBDABAXjv//PP7XXzxxX8oKSnpbBv/bfr06XHttdfGokWLLAPgU3jnnXdi2rRp0bp16+jc2R8nERHZbLbyC1/4whElJSUvTp48eY2NAADAzqMABgAgb/3ud7/b60c/+tFVRUVFrWwjYs2aNXHzzTfHpEmTora21kIAtkJtbW289NJL8c4770Tfvn2jtLQ073dSWFhYNnz48C/26dNn4UMPPbTMpwQAAHYOBTAAAHnp1ltv3f+b3/zmfxYWFjbP913kcrl4/vnn4/rrr4/ly5f7cAB8BitXroxp06ZFRUVFdOvWLTKZTF7vo6CgIDto0KBDBw0atOiBBx54xycEAAB2vC0VwJmex8Z+H/WF+pURa17ym6wAACTTww8//KXDDjvsXzKZTN6/rPGDDz6I22+/Pd544w0fDIDtbMCAAfGtb30r2rRpk/e7yOVyjVOmTPn1yJEjH/LJAACAHavN3jVR1OGjv6YABgAgdV555ZXTPve5z30r3/fQ0NAQjz32WDz++ONRV1fngwGwg2Sz2Tj66KPjC1/4QhQUFOT9Pl5//fU79tprr9/7ZAAAwI6jAAYAIC9ks9nMyy+/fFafPn2Oz/ddvPvuu3HbbbfFe++954MBsJN069YtvvOd70S3bt3yfhdLliy5f5999rmypqam0ScDAAC2PwUwAACpV1paWjBr1qyzevfufVw+7yGXy8WTTz4ZDz74oLt+AXaBbDYbxxxzTBxxxBF5fzfw0qVLHxg6dOjlSmAAANj+FMAAAKRar169mk2ePHlsu3btDsrnPaxcuTJuueWWePvtt30oAHaxnj17ximnnBIdOnTI6z2sXr16yiGHHPIvS5Ys2exTAQAA28+WCuDCyoHR9aO+0FgVUbMia3sAADRpQ4cOLXvqqacub9Omzf75uoNcLhfPPPNMXH/99bF27VofCoAmYP369TFlypQoKSmJnj17RiaTycs9NG/evPtJJ500ZPLkyc+sWLHCoykAAGA7KetcHwXlH/01BTAAAIk1ZMiQ0kceeeSKVq1a7Z2vO6iuro7bb789nnjiiWhs9IRNgKaksbEx5s+fH++//34MGDAgstn8/DlLaWlpp6997WuDn3rqqadXrlxZ75MBAACfnQIYAIDUOfTQQ1s8+OCDv2/ZsuUe+bqDOXPmxNVXX+2RzwBN3PLly+OFF16Ijh075u0joUtLSzudcMIJ+7/00ktPv/3227U+FQAA8NkogAEASJVhw4Y1v++++37TsmXLQfl4/vr6+hg/fnz88Y9/jNpaP0MHSILNmzfHiy++GJs3b47ddtstCgoK8m4HxcXFbY866qg9n3vuuaeXL1/ucdAAAPAZKIABAEiNI488snLcuHG/b9GixcB8PP97770XV111VcyZM8eHASCBFi1aFC+//HL069cvWrRokXfnLykp6XDcccftP2fOnGcWLVq0yScCAAC2jQIYAIBUOPLIIyvvvPPO35aXl++Wj+d/+umn48Ybb4wPP/zQhwEgwf7yl7/ECy+8ECUlJdGrV6+8O3+zZs3aHHXUUfspgQEAYNspgAEASLxjjz227W233faH5s2b98m3s1dVVcXNN98cTz31VDQ2NvowAKRAY2NjzJ8/P5YtWxYDBgyIZs2a5dX5mzVr1uaYY4458M0333xm4cKFNT4RAACwdRTAAAAk2qGHHtritttuuzofy9+33347rrnmmli8eLEPAkAKvf/++/HKK69Enz59orKyMq/Ons1mK4888sh9Zs6c+dTSpUs3+zQAAMCnpwAGACCxjjjiiJb33nvvteXl5f3y6dy5XC4mTZoUN998c1RVVfkgAKRYVVVVTJ06NbLZbPTp0ycymUzenL24uLjtV7/61c+/8sorTy1evLjWpwEAAD4dBTAAAIl06KGHtrj33nt/l2/lb3V1ddx0000xefLkyOVyPggAeSCXy8WCBQvi3Xffjd133z2y2fz5mUyzZs1aH3300fvNmDHjSXcCAwDAp6MABgAgcYYOHVo2fvz4qysqKgbk07mXLVsWV111lUc+A+SplStXxiuvvBKf+9znoqKiIm/O3axZszZHH3300GeeeebJFStW1PkkAADAlimAAQBIlCFDhpQ++uij17Rs2XL3fDr31KlT49prr42NGzf6EADksaqqqpg+fXq0bds2unTpkjfnLikpaT9q1KihTz755JMrV66s90kAAICPt6UCuMB6AABoSjp16pSdMGHCv1dWVu6RL2dubGyMcePGxR133BF1dW56AiCitrY2br755hg/fnw0NjbmzbkrKyv3mDBhwr9369bNXQkAALCNFMAAADQZrVq1Kpw+ffolbdq02T9fzlxdXR2/+93vYtKkSd73C8DfyeVy8fjjj8fvf//7qK6uzptzt2nTZv8pU6Zc0qpVq0KfAgAA2HoKYAAAmoSKioqC2bNnX9KuXbuD8uXMS5cujYsuuijmz5/vAwDAx3r11VfjoosuiqVLl+bNmdu1a3fQ7Nmz/72iosLPrgAAYCu5iAYAoEmYOXPmz9q1a3dIvpz35ZdfjiuuuCLWrVsnfAA+0bp16+KKK66Il19+OW/O3K5du4Nnzpz5M+kDAMDWUQADALDLvfjii2N69OgxKh/Omsvl4oEHHogbbrghamtrhQ/Ap1ZbWxs33HBDPPDAA3nz2oAePXqMevHFF8dIHwAAPj0FMAAAu9SkSZO+NnDgwFPy4ax1dXVx8803x8SJE73vF4BtksvlYuLEiXHLLbdEXV1dXpx54MCBJ0+aNOlr0gcAgE9HAQwAwC7z6KOPHnXggQeekw9nXbduXfz617+OWbNmCR6Az2zmzJnx61//Ol9eJZA58MADz3n00UePkjwAAHyywsqB0fWjvtBYFVGzImtDAADsEDfeeOO+Rx999EWZTKYw7Wddvnx5XHXVVbFy5UrBA7DdbNiwIWbPnh0DBw6MioqKtB8307179/179uz56sMPP7xc+gAA5LuyzvVRUP7RX1MAAwCw011xxRV7fPe7372qoKCgWdrPOmfOnPjtb38bGzduFDwA2111dXVMmzYtOnfuHB07dkz1WTOZTOHuu+9+eJs2bV6aNGnSKukDAJDPFMAAADQZZ5xxRvef/exnvy0sLCxP+1knTJgQd999d9TX1wsegB2moaEhXnrppchms9G3b99UnzWTyRTttddeB/3lL395dubMmRukDwBAvlIAAwDQJBx00EEVf/jDH64pLi7ulOZz5nK5eOCBB+Kxxx4TOgA77c+eBQsWRF1dXfTv3z8ymUxqz1pQUFBywAEHDJs+ffqkpUuXbpY+AAD5aEsFcIH1AACwMwwaNKj0vvvuu7qsrKxXms9ZV1cX1113XUyaNEnoAOx0EydOjOuvvz7q6upSfc6ysrJef/rTn67u379/idQBAODvKYABANjhKioqCh577LGLKyoqBqb5nNXV1XHNNdfE7NmzhQ7ALvPKK6/ElVdeGVVVVak+Z4sWLQZOnDhxbEVFhZ9vAQDA33CBDADADjdz5syftW3b9sA0n3HdunVx2WWXxRtvvCFwAHa5xYsXx2WXXRZr165N9TnbtWt34MyZM38mcQAA+P8UwAAA7FBPPvnkqB49eoxK8xlXrVoVV1xxRSxfvlzgADQZK1asiCuuuCJWrlyZ6nP26NFj1KRJk0ZJHAAA/lth5cDo+lFfaKyKqFmRtSEAALbZjTfeuO+XvvSlCzOZTGp/8fDdd9+NK6+8MtatWydwAJqc6urqmDVrVvTv3z8qKytTe85u3boN79mz57yHH37Yb2MBAJAXyjrXR0H5R39NAQwAwA5x3nnn9T311FOvLigoKE7rGV977bW45pprorq6WuAANFmbN2+OGTNmRI8ePaJ9+/apPGMmkykYNGjQIYWFhVOee+45v5UFAEDqKYABANipjjrqqFb/8R//8YdmzZq1SusZX3755bj++uujrq5O4AA0eQ0NDfHSSy9Fp06dolOnTqk8Y0FBQXbYsGGfnz9//qQ33nhjk9QBAEizLRXA3gEMAMB21a1bt+wNN9zwnyUlJR3TesYpU6bEjTfeGPX19QIHIDHq6+vjxhtvjKlTp6b2jCUlJZ1uuOGG/+jWrZu7GgAAyFsKYAAAtqunn376XyorK/dI6/kmTZoUd955ZzQ2NgobgMRpbGyMO+64I5588snUnrGysnLw008//UtpAwCQrxTAAABsN88///w3unTp8k9pPd/EiRNj3LhxkcvlhA1AYuVyubj//vtTXQJ36dLlS88+++yJ0gYAIB95BzAAANvFTTfdNPzII488L5PJZNJ4vsceeyzGjx8vaABS47XXXotmzZpF3759U3m+zp0779urV695Dz/88DJpAwCQNlt6B7ACGACAz+wXv/hF7x/+8IdXFxQUNEvj+R544IF45JFHBA1A6ixYsCDq6upiwIABqTtbJpPJDBo06ODGxsbnpk6dul7aAACkiQIYAIAd5oADDqj43e9+99tmzZq1TeP5xo0bF5MmTRI0AKm1aNGi2Lx5cwwcODB1ZysoKMjut99+w5577rnH33vvvc3SBgAgLbZUAHsHMAAA2yybzWbuvPPOfyktLe2exvNNmDBB+QtAXpg0aVI89NBDqTxbaWlpj3vuuedfstlsRtIAAOQDBTAAANvs+eef/06HDh0OTePZHn744Xj44YeFDEDeeOSRR+LPf/5zKs/WoUOHw5599tlvSxkAgHygAAYAYJvcd999hw8ePPjUNJ7t/vvvjwkTJggZgLzz2GOPxX333ZfKs+25554/+NOf/nSYlAEASDvvAAYAYKudccYZ3ceMGXN5QUFBcdrONnHixHjkkUeEDEDeWrx4cWSz2ejbt2/ajpbp06fPvn/5y18mz5w5c4OkAQBIsi29A1gBDADAVhk2bFjzG2+88Q/NmjVrl7azPfroo6l99CUAbI2FCxdGUVFR9OvXL1XnKigoKD7wwAP3e/LJJx9dsWJFnaQBAEiqLRXAHgENAMBWuffee39ZWlraPW3nevzxx+PBBx8UMAD8jz//+c8xceLE1J2rtLS0x3333fdLCQMAkFYKYAAAPrVJkyaN6tSp0xEpPFeMHz9ewADwD8aPHx+TJ09O3bk6der0hUmTJn1VwgAApJFHQAMA8Kmcd955fU888cR/z2QyRWk618yZM+Puu+8WMAB8jNdeey06duwYnTt3TtW5unbtuk9BQcHzzz333DopAwCQNN4BDADAZ3LEEUe0vOKKK67NZrOVaTrXyy+/HDfffHPkcjkhA8DHyOVyMXv27OjSpUt06tQpNefKZDJF++yzz/CpU6c+9u67726WNAAASeIdwAAAbLNsNpu55ZZb/q2kpKRjms61YMGCuPnmm6OxsVHIAPAJGhsb4+abb44333wzVecqLS3tcvfdd5+fzWYzUgYAIC0UwAAAbNGkSZO+3rZt2wPTdKZly5bFDTfcEPX19QIGgE+prq4urr322li+fHmqztWuXbsDH3/88VESBgAgLTwCGgCAj3XZZZcN+upXvzo2k8mk5hcH33///bjyyiujqqpKwACwlerq6uLll1+OIUOGRHl5eWrO1aVLl31LS0unPvPMM2ukDABAEngENAAAW61///4lJ5988q8ymUxRWs60YcOG+P3vfx8bN24UMABso40bN8bvfve7VP15WlBQkP3hD394ft++fYslDABA4q9vrQAAgI/y4IMPnl1WVtYrLeeprq6O3/zmN7Fq1SrhAsBntGrVqrjyyiujuro6NWcqKyvr8/DDD58lXQAAkk4BDADA/zF+/Pgju3XrdnRazlNfX5/KdxYCwK60fPnyuO6666K+vj41Z+rRo8dXx40bd4R0AQBIMgUwAAB/53vf+16nI4444py0nCeXy8Vtt90Wb7zxhnABYDt7/fXX47bbbotcLpeaMx155JHnfvvb3+4oXQAAkkoBDADA/6qoqCi4+OKLLywsLCxPy5nGjx8fs2bNEi4A7CCzZs2Khx56KDXnKSwsrPj1r399QUVFhZ+bAQCQSC5kAQD4XxMnThxdWVk5OC3nef7552PixImCBYAd7LHHHosXXnghNeeprKzc89FHHz1RsgAAJFFh5cDo+lFfaKyKqFmRtSEAgDxxwQUX7DZq1KgLM5lMYRrO8+qrr8Ytt9ySqkdSAkBT/7O3d+/e0a5du1Scp2PHjkNzudxzU6ZMWSddAACamrLO9VHwMc/wcwcwAADRt2/f4h//+McXZzKZVPwG4HvvvRc33HBDNDY2ChcAdpKGhoa47rrrYtmyZak4T0FBQfbss88e27dv32LpAgCQqGtZKwAAYPz48T8qKyvrkYazbNiwIX7/+99HbW2tYAFgJ9u0aVP8/ve/j40bN6biPGVlZb3GjRs3RrIAACSJAhgAIM/ddNNNw/v06XN8Gs5SX18f1157baxdu1awALCLrFmzJq699tqor69PxXn69ev3jd///vdDJQsAQFIogAEA8thBBx1Uceyxx/5rRGTScJ477rgjFi9eLFgA2MUWLVoUd955Z1qOU/CNb3zj34YNG9ZcsgAAJOIC1goAAPLXzTfffFZxcXG7NJxl4sSJMX36dKECQBMxbdq0mDRpUirOUlJS0unOO+88Q6oAACSBAhgAIE/913/914FdunT5UhrO8tprr8Wf//xnoQJAEzN+/PhYsGBBKs7SrVu3o2+66abhUgUAoKlTAAMA5KEvfelLlV/5yld+lYazrFixIq6//vpobGwULAA0MY2NjXHdddfFihUr0nCczHHHHfergw46qEKyAAA0ZQpgAIA8dPXVV5+ezWYrk36OmpqauPbaa2PTpk1CBYAmatOmTXHttddGTU1N4s+SzWbb3njjjT+RKgAATZkCGAAgz9x6663Du3Tp8uWknyOXy8Utt9wSK1euFCoANHErV66MW2+9NXK5XOLP4lHQAAA0dQpgAIA8MnTo0LKvfvWrv0jDWSZMmBBz584VKgAkxJw5c+Kxxx5LxVlGjRr1i6FDh5ZJFQCApkgBDACQR+64444fFRcXd0z6OV5++eV45JFHBAoACfPQQw+l4he4SkpKOt5xxx0/lCgAAE2RAhgAIE9cfvnlu/fs2XNU0s/xwQcfxB133JGKR0gCQL7J5XJx2223xZo1axJ/lp49ex57+eWX7y5VAACaGgUwAEAe6NatW/a73/3uv2YymURf/9XX18cNN9wQ1dXVQgWAhKqqqoobb7wx6uvrE32OTCZT8N3vfvdX3bp1y0oVAICmRAEMAJAHxo8ff0pZWVmvpJ/jnnvuiaVLlwoUABJuyZIlcd999yX+HGVlZT3Hjx9/ikQBAGhKFMAAACn385//vOeAAQNGJ/0c06dPjylTpggUAFJi8uTJMWPGjMSfY8CAAaN//vOf95QoAABNhQIYACDFstls5qyzzjo3k8kk+tGEK1asiLvvvlugAJAyd911V6xYsSLRZ8hkMtmzzjrr3Gw2m5EoAABNgQIYACDFxo0b98XKysq9knyG2trauOGGG6K2tlagAJAyf/1zfvPmzYk+R2Vl5V7jxo0bKVEAAJoCBTAAQEoNHz68/OCDDz4t6ee4//77Y/ny5QIFgJRavnx5jBs3LvHnGDFixI+HDRvWXKIAAOxqCmAAgJS69dZbT8tms22TfIYZM2bEc889J0wASLnJkyfHzJkzE32G4uLitrfffvtp0gQAYFdTAAMApNBVV121R48ePb6S5DOsXLky7rrrLmECQJ64++6744MPPkj0GXr27PnVK664Yg9pAgCwKymAAQBSprS0tOAb3/jGT5N8rdfY2Bi333679/4CQB6pqamJ2267LRobG5N8jIJvfvObZ5aWlvqZGwAAu+6i1AoAANJlwoQJX6uoqBiQ5DOMHz8+Fi1aJEwAyDNvvvlmPPjgg4k+Q4sWLQY9+OCDx0gTAIBdRQEMAJAiRx55ZOWwYcN+kOQzzJ07N5544glhAkCemjhxYixYsCDRZxg+fPiPjjjiiJbSBABgV1AAAwCkyBVXXHFyUVFRRVLnr6qqijvvvDNyuZwwASBP5XK5uP3226O6ujqxZygqKmrxm9/85mRpAgCwKyiAAQBS4vzzz+/Xu3fv45J8httvvz0+/PBDYQJAnlu3bl3cfvvtiT5D7969jz///PP7SRMAgJ1NAQwAkALZbDZz6qmn/jyTyST2+m769OkxZ84cYQIAERExe/bsmDFjRmLnz2QyBaeeeurPs9lsRpoAAOxMCmAAgBT44x//eERlZeXgpM6/du3auPfeewUJAPyde+65J9atW5fY+SsrKwf/6U9/+oIkAQDYmRTAAAAJ17dv3+JDDjnkR0k+w9133x01NTXCBAD+Tk1NTdx9992JPsPBBx/8o759+xZLEwCAnUUBDACQcHfdddc3S0pKOiV1/smTJ8e8efMECQB8pLlz58azzz6b2PlLSko63nPPPd+SJAAAO4sCGAAgwb70pS9VDhw48KSkzr9mzZoYP368IAGALXrggQdizZo1iZ2/f//+Jx111FGtJAkAwM6gAAYASLArrrji1MLCwvIkzp7L5eK2226LTZs2CRIA2KJNmzbFbbfdFrlcLpHzFxYWll1++eU/kCQAADuDAhgAIKF+8Ytf9O7evftXkjr/s88+G2+88YYgAYBP5Y033ojnn38+sfN369bt6F/96ld9JAkAwI6mAAYASKgf/vCHP8pkMom8nvvggw/igQceECIAsFXGjRsX69atS+TsmUym4NRTT/2xFAEA2NEUwAAACXTdddcNa9eu3YFJnD2Xy8Udd9wRtbW1ggQAtsqmTZvizjvvTOz8bdq02f+mm27aT5IAAOxICmAAgIQpLS0t+NrXvnZ6Uud/4YUXYuHChYIEALbJq6++GjNmzEjs/Mccc8zpFRUVfiYHAMAO42ITACBhbr/99oMrKip2S+LsGzZsiHHjxgkRAPhM7r///qiqqkrk7OXl5X3/67/+6wgpAgCwoyiAAQASpKKiouCwww47Nanz33vvvYn9YS0A0HRs2LAh7r///sTOf9BBB/1zq1atCiUJAMCOoAAGAEiQ+++//+iysrKeSZx9zpw58dJLLwkRANguXnjhhViwYEEiZy8tLe32xz/+8StSBABgR1AAAwAkRN++fYv33Xfff07i7LW1tXHvvfcKEQDYru6+++6oq6tL5Oz77bffKf379y+RIgAA25sCGAAgIW6++eZRxcXFbZM4+yOPPBJr164VIgCwXa1atSoee+yxRM6ezWbb3njjjV+TIgAA25sCGAAgAYYOHVq21157fSeJs7/33nvxxBNPCBEA2CEmTpwYK1asSOTsQ4YM+c7QoUPLpAgAwPakAAYASIBrr732xKKiosqkzZ3L5eKee+6JxsZGIQIAO0R9fX3cddddkcvlEjd7UVFR5bXXXnuCFAEA2J4UwAAATdwBBxxQMWDAgG8kcfYZM2bEW2+9JUQAYId6880348UXX0zk7AMGDPjG8OHDy6UIAMD2ogAGAGjirrrqqhOKiooqkjb3pk2b4oEHHhAgALBT3H///VFbW5u4uYuKilpcffXV7gIGAGC7UQADADRhBx10UEX//v0Teffvww8/HB9++KEQAYCdYv369TFhwoREzj5w4MBvHHDAARVSBABge1AAAwA0Yf/5n/95bGFhYfOkzb1q1aqYPHmyAAGAnerpp5+O1atXJ27uwsLC8ssuu2yUBAEA2B4UwAAATdQBBxxQMWjQoNFJnP3uu++O+vp6IQIAO1V9fX3cddddiZx99913/+bQoUPLpAgAwGelAAYAaKIuv/zyYwsLC8uTNvfcuXNjwYIFAgQAdokFCxbE3LlzEzd3UVFRi9/97ndflyAAAJ+VAhgAoAkaOnRo2aBBgxL37t+6urr405/+JEAAYJf605/+FHV1dYmbe/fdd//mkCFDSiUIAMBnoQAGAGiCfvOb33ylqKioZdLmfu655xL53j0AIF1Wr14dzz33XOLmLioqann11VcfLUEAAD4LBTAAQBPTq1evZoMHD/5m0uaurq6ORx55RIAAQJPwyCOPRHV1deLmHjJkyLe6deuWlSAAANtKAQwA0MTcdNNNxxQXF7dN2twTJkyIqqoqAQIATUJVVVUifzmtuLi43a233uouYAAAtpkCGACgCWnVqlXhXnvtdVLS5l61alU8++yzAgQAmpTJkyfHqlWrEjf30KFDR7dq1apQggAAbAsFMABAE3LLLbccXlJS0jlpcz/44INRX18vQACgSamvr48HH3wwcXOXlJR0vummmw6VIAAA20IBDADQRGSz2cwBBxzw7aTNvWjRonjppZcECAA0SS+99FIsXrw4cXOPGDHiO9lsNiNBAAC2lgIYAKCJuOaaa/YuLy/vm7S5H3roocjlcgIEAJqkXC6XyLuAy8vL+1111VV7SRAAgK2lAAYAaCK+8pWvfDdpM8+bNy8WLlwoPACgSVu4cGG8+uqrrg8BAMgLCmAAgCbgsssuG1RZWblPkmbO5XIxfvx44QEAifDAAw8k7qklrVu33veSSy7pLz0AALaGAhgAoAkYNWrUCUmbefbs2bFs2TLhAQCJsGzZsnjllVcSN/cJJ5xwovQAANgaCmAAgF3sn//5nzt37NjxiCTN3NjYGA888IDwAIBEGT9+fDQ0NCRq5k6dOn1h9OjRHaQHAMCnpQAGANjFfvSjH30tk8kk6rps2rRpsWrVKuEBAImyatWqeOGFFxI1cyaTKfzpT386SnoAAHxaCmAAgF1o0KBBpX369Plqkmaur6+PCRMmCA8ASKQJEyZEXV1dombu27fvV/r27VssPQAAPg0FMADALnTZZZcdXlRUVJGkmadOnRpr164VHgCQSOvXr48pU6YkauaioqLK3/zmN0dIDwCAT0MBDACwi2Sz2cy+++57UpJmrqurc/cvAJB4jz76aOLuAt5///1PymazGekBAPBJFMAAALvI1VdfPbSsrKx3kmaeMmVKbNiwQXgAQKJt2LAhnn/++UTNXFZW1ueqq67aS3oAAHwSBTAAwC7y5S9/+bgkzVtfXx8TJ04UHACQCo8//nji7gL+0pe+dLzkAAD4JApgAIBdYPTo0R3atm07IkkzT5s2LdatWyc8ACAVPvzww5g+fXqiZm7fvv2I0aNHd5AeAABbogAGANgFfvrTn47KZDKFSZm3vr4+HnnkEcEBAKnyyCOPRH19fWLmzWQyhT/96U+/JjkAALZEAQwAsJN16tQp26dPn6OTNLO7fwGANFq3bl1MmzYtUTP36dPnmE6dOmWlBwDAx1EAAwDsZFddddUB2Wy2dVLmbWxsjEmTJgmOVOvYsWN06OCJmgD5aNKkSdHY2JiYebPZbOurrrrqAMkBAPBxFMAAADvZiBEjvp6keV988cVYtWqV4Ei1Ll26xIUXXhinnXZadO3a1UIA8siqVavipZdecj0JAEBqKIABAHaiM844o3tlZeXeSZk3l8vFxIkTBUdeyGQyMXjw4PjVr34VY8aMcUcwQB55/PHHI5fLJWbeysrKvc8444zukgMA4KMogAEAdqJTTjnlqxGRScq8CxYsiPfee09w5JVMJhN77713XHjhhTFmzJho3769pQCk3HvvvRcLFy5M1B9X/3NdCQAA/4cCGABgJ+nVq1ezXr16fTlJM3v3L/nsr0XwBRdcECeffHK0bdvWUgBSLGnXPb169fpyr169mkkOAIB/pAAGANhJrrjiioOLiopaJmXeBN4JAztEYWFhDB8+PC688MIYPXp0VFZWWgpACi1YsCCWLVuWmHmLiopaXnnllYdIDgCAf6QABgDYSYYPH/6VJM2btHfhwY5WVFQUI0aMiEsuuSRGjx4dLVu2tBSAFMnlcvH4448naub99tvvK5IDAOAfKYABAHaC0aNHd6isrByalHnXrl0bL7/8suDgI/y1CL744ovjhBNOiBYtWlgKQEq89NJLsW7dusTMW1lZudfo0aM7SA4AgL+lAAYA2AlOP/30o5J07fXMM89EQ0OD4GALiouL47DDDouxY8fGqFGjoqyszFIAEq6hoSGeeeaZJI1c8D/XmQAA8P8vEq0AAGDHymazmX79+n05KfPW1tbGlClTBAefUnFxcYwcOTIuvfTSGDVqVJSWlloKQII9//zzUVtbm5h5+/Xr9+VsNpuRHAAAf6UABgDYwX7zm9/sWVJS0jkp886YMSOqq6sFB1uppKQkRo4cGZdcckkcffTRUVJSYikACVRdXR0zZ85M0p8/na+44orBkgMA4K8UwAAAO9gXvvCFLyVl1lwuF08//bTQ4DNo3rx5HHXUUXHJJZfEyJEjI5vNWgpAwjz11FORy+USM++RRx75ZakBAPBXCmAAgB1oyJAhpZ07dz4iKfO+/vrrsWLFCsHBdlBeXh6jRo2KSy+9VBEMkDArVqyI119/PTHzdunS5fD+/ft79AQAABGhAAYA2KHGjh17aGFhYWJeCOruX9j+KioqYtSoUXHxxRfH4YcfHkVFRZYC4LpouyosLGz+H//xHwdLDQCACAUwAMAOteeeex6ZlFnXrl0b8+bNExrsIK1atYrjjz8+LrroohgxYkQUFPh2DKApmzdvXqxZsyYx8+61115HSg0AgAgFMADADnPMMce0bt269b5Jmfe5556LxsZGwcEO1qZNmxg9enRcfPHFimCAJqyxsTGee+65JP35MvyYY45pLTkAAPykAQBgBznzzDMPz2Qyibjeqq+vj6lTpwoNdqK2bdvG6NGj47zzzovhw4crggGaoBdeeCHq6+sTMWsmkyk844wzDpUaAAB+wgAAsIP079//C0mZdc6cObFhwwahwS7QqVOnOPnkk+Pf/u3fYu+9945MJmMpAE3Ehg0bYvbs2YmZd8CAAR4DDQCAAhgAYEf43ve+16mysnKPpMybpMcbQlp17tw5xowZE7/61a8UwQBNyPPPP5+YWSsrKwd/73vf6yQ1AID8pgAGANgBTj755CMiIhHtzcqVK+P1118XGjQRXbt2jTFjxsQ555wTgwcPthCAXez111+PlStXJmXczMknn3y41AAA8psCGABgB+jXr19iHv88ZcqUyOVyQoMmpnfv3nHaaafFOeecE/3797cQgF0kl8vFlClTknQd6jHQAAB5TgEMALCdnX766d0qKip2S8Ks9fX1MW3aNKFBE9anT58466yz4pxzzonddtvNQgB2gWnTpkV9fX0iZq2oqNjt9NNP7yY1AID8pQAGANjORo8efURSZp03b15s3LhRaJAAffr0ibPPPjvOPPPM6Nmzp4UA7EQbN26MefPmuR4FACARFMAAANtZr169EvPetSQ9zhD4bwMGDIhf/vKXceaZZ0b37t0tBGAnmTp1apKuRw+TGABA/lIAAwBsR2eccUb38vLyvkmYdf369fHaa68JDRJqwIAB8S//8i9x2mmnRbdunvQJsKPNnz8/Pvzww0TMWl5e3u9HP/pRF6kBAOQnBTAAwHZ03HHHHZSUWWfMmBGNjY1CgwTLZDIxePDg+Nd//dcYM2ZMdOjQwVIAdpDGxsaYMWNGYub9xje+cYjUAADykwIYAGA76tOnz8FJmDOXyyXqMYbAlmUymdh7773jwgsvjDFjxkT79u0tBWAHeOGFF5J0XXqIxAAA8pMCGABgOznppJPat2zZcvckzLpkyZJYuXKl0CBl/loEX3DBBXHyySdH27ZtLQVgO1qxYkW8/fbbiZi1srJy0PHHH+8PAgCAPKQABgDYTr773e8eGBGZJMyapMcXAluvsLAwhg8fHhdeeGGMHj06KisrLQVgO5k+fXpSRi34/ve/f6DEAADyjwIYAGA72X333Q9Nwpz19fUxc+ZMgUEeKCoqihEjRsQll1wSo0ePjpYtW1oKwGc0c+bMqK+vT8SsAwcOPFRiAAD5RwEMALAdHHTQQRUtW7bcKwmzLly4MKqrq4UGeeSvRfDFF18cJ5xwQrRo0cJSALZRVVVVvP7664mYtVWrVkOHDx9eLjUAgPyiAAYA2A7OPvvsz2cymaIkzOrxz5C/iouL47DDDouxY8fGqFGjoqyszFIAtkFSnqaSyWSy55577uclBgCQXxTAAADbwe67735AEuasra2NOXPmCAzyXHFxcYwcOTIuvfRSRTDANpg9e3bU1dUlYtY99tjjAIkBAOQXBTAAwGfUqlWrwnbt2u2fhFnnzZsXtbW1QgMiIqKkpCRGjhwZY8eOjaOPPjpKSkosBeBT2LRpU8ybNy8Rs7Zv337/iooKPwMEAMgjLv4AAD6jCy+8cPeioqKKJMz64osvCgz4P5o3bx5HHXVUXHLJJTFy5MjIZrOWAvAJZs2alYg5i4qKWlx88cWDJAYAkD8UwAAAn9GBBx6YiMfqVVdXJ+ZOFWDXKC8vj1GjRsWll16qCAb4BPPmzYuamppEzHrQQQd5DDQAQB5RAAMAfEZdu3YdnoQ5582bF/X19QIDPlFFRUWMGjUqLr744jj88MOjqKjIUgD+QV1dXbz66quJmLVLly77SwwAIH8ogAEAPoNTTjmlY3l5+W5JmPXll18WGLBVWrVqFccff3xcdNFFMWLEiCgo8C0kwN966aWXEjFnRUXFbieddFJ7iQEA5AffvQMAfAYnnnji55MwZ21tbcyfP19gwDZp06ZNjB49OsaOHasIBvgb8+fPj9ra2iSMmvnud7/7eYkBAOQH37UDAHwGn/vc5/ZLwpwLFy6Muro6gQGfyV+L4PPOOy+GDx+uCAby3ubNm2PhwoWJmLVfv37DJQYAkB98tw4AsI1atWpV2Lp1672TMKvHPwPbU6dOneLkk0+Oc889NwYNGmQhQF6bPXt2IuZs06bN3hUVFX4WCACQB1z0AQBso/PPP39gYWFheVOfs76+PubMmSMwYLvr2bNn/OQnP4nzzjsv9t5778hkMpYC5J3Zs2dHfX19k5+zqKio4vzzzx8oMQCA9FMAAwBso/3333/fJMz5+uuvR01NjcCAHaZLly4xZsyYOOecc2Lw4MEWAuSV6urqeOONNxIx64EHHriPxAAA0k8BDACwjbp27ZqIxz/PnTtXWMBO0bt37zjttNPinHPOif79+1sIkDeScr3VvXv3vaUFAJB+CmAAgG0wZMiQ0srKyj2a+py5XM7jn4Gdrk+fPnHWWWfFOeecE7vttpuFAKk3e/bsyOVyTX7Oli1b7jlo0KBSiQEApJsCGABgG5x55pl7ZjKZbFOfc9myZbFu3TqBAbtEnz594uyzz44zzzwzevbsaSFAaq1bty6WL1/e5OfMZDLZs846a4jEAADSrcgKAAC23tChQ4clYc558+YJC9jlBgwYEAMGDIgFCxbE+PHjY+nSpZYCpM68efOiS5cuTX7OffbZZ5+ImC4xAID0cgcwAMA26Nix4z5JmHP+/PnCApqMAQMGxC9/+cs47bTTolu3bhYCpEpSrrs6deq0j7QAANJNAQwAsJWOOOKIlhUVFf2a+pxVVVWxaNEigQFNSiaTicGDB8e//uu/xpgxY6JDhw6WAqTCW2+9FVVVVU1+zoqKis8deuihLSQGAJBeCmAAgK108sknD46ITFOfc/78+dHY2CgwoEnKZDKx9957x4UXXhhjxoyJ9u3bWwqQaI2NjbFgwYJE/Cv4u9/97h4SAwBILwUwAMBW2n333fdMwpze/wskwV+L4AsuuCBOPvnkaNu2raUAiZWU66/BgwfvKS0AgPQqsgIAgK3Trl27wU19xlwul5Q7UAAiIqKwsDCGDx8e++yzT0ybNi0mTJgQ69evtxggURYsWBC5XC4ymab9sJgOHToMlhYAQHq5AxgAYCsMGjSotGXLlgOa+pzvvfdebNy4UWBA4hQVFcWIESPikksuidGjR0fLli0tBUiMDz/8MJYtW9bk52zZsuXA/v37l0gMACCdFMAAAFvhxz/+8aBMJtPkn6Li7l8g6f5aBI8dOzZOOOGEaNGihaUAibBw4cImP2Mmk8n+5Cc/GSAtAIB0UgADAGyFvffee88kzJmEHzwCfBrNmjWLww47LMaOHRujRo2KsrIySwGatKT8Il5SrmsBANh63gEMALAVunbtOqSpz1hfXx9vvvmmsIBUKS4ujpEjR8bBBx8czz77bDz++ONRXV1tMUCT8+abb0Z9fX0UFTXtH7t16dJlT2kBAKSTO4ABAD6lioqKgoqKikFNfc4lS5bE5s2bBQakUklJSYwcOTLGjh0bRx99dJSUeIUl0LTU1tbG0qVLm/ycLVu2HFRaWupngwAAKeQiDwDgUzr77LP7FhYWNvlnj7722mvCAlKvefPmcdRRR8Ull1wSI0eOjGbNmlkK4HpsKxQWFpafffbZvaQFAJA+CmAAgE9p//3375+EOV9//XVhAXmjvLw8Ro0aFf/+7/8eI0eOjGw2aymA67FP6fOf//xAaQEApI8CGADgU+rRo8fuTX3G2traePvtt4UF5J2KiooYNWpUXHzxxXH44Yc3+XdvAum2ePHiRLySo1evXoOkBQCQPgpgAIBPqXXr1k3+DoklS5ZEQ0ODsIC81apVqzj++OPj4osvjhEjRkRBgW97gZ2voaEhlixZ0uTnbNOmjQIYACCFfCcMAPApDBkypLR58+a9m/qcb775prAAIqJ169YxevToGDt2rCIYcF32MZo3b95n0KBBpdICAEgX3wEDAHwKp556av9MJtPkr53eeustYQH8jTZt2sTo0aPjvPPOi+HDhyuCAddlfyOTyRT84Ac/+Jy0AADSxXe+AACfwuDBg5v84/Hq6+tj0aJFwgL4CJ06dYqTTz45/u3f/i323nvvyGQylgLsUIsXL07Eqzn23HPPgdICAEgXBTAAwKfQpUuXAU19xnfeeSfq6uqEBbAFnTt3jjFjxiiCgR2utrY23n333SRc53oPMABAyiiAAQA+hZYtW/Zv6jN6/DPAp9elS5cYM2ZMnHvuuTF48GALAfL2+iwJ17kAAGwdBTAAwCcYPnx4eUlJSeemPqfHPwNsvV69esVpp50W55xzTvTvrwMB8u/6rLS0tPPw4cPLpQUAkB4KYACAT/Ctb31rt4ho8s8IXbx4sbAAtlGfPn3irLPOinPOOSd22203CwG2i4T8gl7m29/+dj9pAQCkhwIYAOAT7L777k2+CVi7dm1s2LBBWACfUZ8+feLss8+OM888M3r27GkhwGfy4Ycfxrp165r8nAMHDlQAAwCkSJEVAABsWadOnZr8D8TefvttQQFsRwMGDIgBAwbEggULYvz48bF06VJLAbb5Oq1Vq1audwEA2GkUwAAAn6CyslIBDJCnBgwYEP3794958+bFQw89FO+++66lAFtlyZIlsddeezX1613PvgcASBEFMADAFnTq1CnbvHnzXk19ziVLlggLYAfJZDIxePDg2GOPPeLll1+OBx98MFauXGkxQGqu05o3b967Xbt2RatXr66XGABA8nkHMADAFowZM6ZnJpPJNuUZGxsbPZoUYCfIZDKx9957x4UXXhhjxoyJ9u3bWwrwiZYuXRqNjY1NesaCgoLsqaee2kNaAADp4A5gAIAt2Hvvvfs29RlXrlwZtbW1wgLYSf5aBO+5554xa9asmDBhQqxevdpigI9UW1sb77//fnTu3LlJzzls2LC+EbFIYgAAyecOYACALejRo0eTL4DfeecdQQHsAoWFhTF8+PC48MILY/To0VFZWWkpQGKv15Jw3QsAwKejAAYA2ILWrVs3+ff/vvvuu4IC2IUKCwtjxIgRcckll8To0aOjZcuWlgIk7notCde9AAB8Oh4BDQCwBc2bN+/Z1GdUAAM0kW+wi4pixIgRsd9++8WUKVPiscceiw0bNlgMEO+9914SrnsVwAAAKeEOYACAj9G/f/+SkpKSjk19TgUwQNPSrFmzOOyww2Ls2LExatSoKCsrsxTIc0m4XistLe3Ut2/fYmkBACSfAhgA4GOccMIJ3Zr69dK6deuiqqpKWABNUHFxcYwcOTJ+/etfK4Ihz1VVVcX69eub+pgF3/zmN7tLCwAg+RTAAAAfY8iQIT2b+oxJeJwgQL77axE8duzYOProo6OkpMRSIA8l4botCde/AAB8MgUwAMDH6N69e8+mPqPHPwMkR/PmzeOoo46KSy65JEaOHBnNmjWzFMgjSbhuS8L1LwAAn0wBDADwMVq1atWjqc+4bNkyQQEkTHl5eYwaNSr+/d//PUaOHBnZbNZSIA8k4botCde/AAB8MgUwAMDHqKio6NXUZ1y+fLmgAJL750yMGjUqLr744jj88MOjqKjIUiDFknDd1rJly16SAgBIPgUwAMBHyGazmbKysq5NecbGxsZYtWqVsAASrlWrVnH88cfHxRdfHCNGjIiCAt+qQxqtWrUqGhsbm/SMJSUlXbPZbEZaAADJ5rtKAICPcNxxx7UrKCgobsozrl69Ourr64UFkBKtW7eO0aNHx9ixYxXBkEJ1dXXxwQcfNOkZCwoKio877rh20gIASDbfTQIAfITPf/7zXZr6jO+//76gAFKoTZs2MXr06Dj//PNj+PDhimBIkRUrVrgOBgBgh/NdJP+PvTuPr7I888d/nSwEkhD2HUQEUVRAoIiouCtq64Jabd1arVorbqO2tlXbaavTOu38Rqffdmpbu9rWpYogsqgFRXCttAIKArJDgAAJBLKQ5JzfH8WO4+DOcp6T9/v18jWvTv657ut6hNvnk/t+AICd2G+//bL+xVcSXiAC8PF17do1Lr300rj99ttj2LBhkUq5lRWSLgn7tyTsgwEAeH8FWgAA8H917txZAAxAVujevXtceeWVsXr16njiiSdi9uzZkclkNAYSKAn7tyTsgwEAeH8CYACAnWjXrp0roAHIKj169Igrr7wyli5dGpMmTYo5c+ZoCiRMEvZvSdgHAwDw/gTAAAA7UVxc3D3baxQAAzRPffr0ibFjx8aSJUti/PjxsWDBAk2BhEjC/i0J+2AAAN6fbwADAOxESUlJz2yur7q6Ourq6gwKoBnbb7/94l/+5V/ia1/7WhxwwAEaAglQV1cX1dXV9sEAAOxWAmAAgHc5/PDDSwsKCtpmc40VFRUGBUBERPTt2zduvPHGuOGGG2LffffVEMhy2b6PKygoaDt8+PASkwIASC4BMADAu5x44oldsr3GDRs2GBQA/8uAAQPiG9/4Rtxwww3Ru3dvDQH7uE+yH+5qUgAAyeUbwAAA79KvX7+sD4DXr19vUADs1IABA+LAAw+MuXPnxoQJE2LlypWaAlkkCTe5HHDAAV0i4i3TAgBIJgEwAMC7dO/evXO21+gEMADvJ5VKxaBBg2LgwIExe/bsGD9+fKxbt05jwD4uZ/bDAAC8NwEwAMC7tG/fvlO21ygABuDDSKVSMWzYsBg6dGjMnj07HnvsMbdIwF6WhBPASdgPAwDw3gTAAADv0rp166w/8ZCEF4cAZI+3g+BDDz00XnnllZg4caK/S8A+LtH7YQAA3psAGADgXUpKSrL6xENjY2Ns3rzZoAD4yPLz8+Pwww+P4cOHx/PPPx8TJ06MqqoqjYE9aPPmzdHY2BgFBdn7Wi7b98MAALw/ATAAwLu0bNmySzbXV1lZGZlMxqAA+Njy8/Nj1KhRMXLkyHjhhRcEwbAHZTKZqKqqio4dO9oPAwCwWwiAAQDepaioKKuvvKusrDQkAHaJgoKCGDVqVIwYMSJmzpwZkydPji1btmgM7IH9XDYHwNm+HwYA4P3laQEAwP8YPnx4SX5+fkk21ygABmBXa9GiRRx//PFxxx13xNlnnx0lJSWaAs14P5efn18yfPhwfxAAACSUABgA4B2OOOKIDtleo+//ArC7FBUVxejRo+P73/9+nH322VFcXKwpsBsk4cr1JOyLAQDYOQEwAMA79O3bt1221+gEMAC729tB8B133BGnn356tGrVSlOgme3n9ttvv7YmBQCQTAJgAIB36NSpkwAYAHYoKSmJz3zmM3HnnXfG6NGjo0WLFpoCzWQ/l4R9MQAAOycABgB4hw4dOrTN9hqTcGUgALmlpKQkzj777PjOd74To0aNivz8fE2BHN/PJWFfDADAzgmAAQDeoaysrG221ygABmBvad++fVx00UVx5513xgknnBCFhYWaAjm6nysrK3MCGAAgoQTAAADvUFJS0j6b68tkMlFdXW1QAOxV7dq1i/POOy+++93vxqhRoyIvz+sF+CiSsJ8rLS0VAAMAJJT/QgMAeIfi4uK22VxfXV1dNDY2GhQAWeHtE8F33HGHIBg+gsbGxqirq7MvBgBgt/BfZgAA79CqVausPung9C8A2ahDhw5x0UUXxbe//e04/PDDBcGQA/u6oqIiJ4ABABLKf5EBALxDQUGBABgAPqauXbvGpZdeGt/61rdi2LBhkUqlNAUSuq9r0aJFW1MCAEimAi0AAPgfhYWFZdlc39atWw0JgKzXrVu3uPLKK2P16tXxxBNPxOzZsyOTyWgMJGhfl+37YgAA3psAGADgnZujgoLW2VyfE8AAJEmPHj3iyiuvjKVLl8akSZNizpw5mgIJ2ddl+74YAID35gpoAIAdWrdunZefn98ym2sUAAOQRH369ImxY8fGLbfcEgMGDNAQSMC+Lj8/v1WrVq28OwQASCCbOACAHQYNGlQSEVn9scJt27YZFACJtd9++8UNN9wQX/va1+KAAw7QEJq1BOzr8gYPHlxsUgAAySMABgDY4YADDijJ9hpramoMCoDE69u3b9x4441xww03xL777qshNEu1tbVZX2P//v1LTQoAIHl8AxgAYIeePXtm/QuuJLwoBIAPa8CAATFgwICYP39+jBs3LpYvX64pNBtJ2Nf16NGjxKQAAJJHAAwAsEOnTp0EwACwFwwYMCAOPPDAmDt3bkyYMCFWrlypKeS8JOzrunbtKgAGAEggATAAwA5lZWVZ/4Krrq7OoADISalUKgYNGhQDBw6M2bNnx4QJE2Lt2rUaQ85KQgDcpk0bV0ADACSQABgAYIeysjIngAFgL0ulUjFs2LAYOnRozJ49O8aPHx/r1q3TGHKOABgAgN1FAAwAsENJSUlxttfoBDAAzcXbQfCQIUPi5ZdfjokTJ0ZFRYXGkDOSEAAnYX8MAMD/JQAGANihqKioKNtrrKmpMSgAmpW8vLw4/PDDY/jw4fH888/HE088EZWVlRpD4iUhAG7RokWRSQEAJI8AGABgh8LCwhbZXF86nY7t27cbFADNUn5+fowaNSpGjhwZL7zwQkycODGqqqo0hsTavn17ZDKZSKVSWVtjixYtWpgUAEDyCIABAHbI9gC4oaHBkABo9goKCmLUqFExYsSImDlzZkyePDm2bNmiMSROJpOJhoaGyOaMtbCw0AlgAIAk/neTFgAA7NgYFRRk9QuuxsZGQwKAHVq0aBHHH398HHnkkfHMM8/E1KlTY9u2bRpDomR7AJzt+2MAAN5jH6cFAAA7NkZZ/oLL9c8A8H8VFRXF6NGj49hjj41nnnkmpkyZEjU1NRpDImT7DS8FBQWugAYASCABMADA2xujLH/B5QpoAHhvbwfBRx11VEyfPj2efvrpqK2t1RiymgAYAIDdIU8LAAD+QQAMAMlXUlISn/nMZ+LOO++M0aNHZ/X1uiAABgBgdxAAAwDskO1XQAuAAeDDKykpibPPPjv+7d/+LUaPHh2FhYWagv3dR5Sfn9/SlAAAkkcADADw9sYoL88JYADIMa1bt46zzz47vve978UJJ5wgCMb+7iPIz8/3LwwAQAIJgAEAdkilUlm9N2psbDQkAPiY2rVrF+edd15897vfjRNOOCEKCgo0Bfu7D94f55sSAEDyCIABAHbI9gA4nU4bEgB8Qu3bt/9nEDxq1KjIy/NqBPu799kfp0wJACB5/FcOAMAOXnABQPPRoUOHuOiii+J73/ueIJi9JpPJZHuJ/sUAAEggmzgAgP+R1QFwAl4QAkDidOzYMS666KL41re+FYcffnj4fTDs796xOc7yG3IAANg5mzgAgITsjQTAALD7dOvWLS699NL41re+FcOGDRMEs0dk+xXQeXl5/kUAAEigAi0AAPiHbH/BJQAGgN2ve/fuceWVV8ayZcviiSeeiDlz5mgKzXl/5/AIAEACCYABAHbIZDJOAAMAERGx7777xtixY2PJkiUxYcKEmD9/vqZgfwwAQCIIgAEA/ocr7gCA/2W//faLG264Id56660YP358vPnmm5rCLpPtV0Cn3IUOAJBIAmAAgB2y/QVXtr8gBIBc1rdv37jxxhvjrbfeinHjxsWiRYs0hU/MFdAAANjEAQDsXln9Bs4BDADY+/r27Rs333xz3HDDDdG7d28NIdf3d75BAgCQQE4AAwDskO0nMATAAJA9BgwYEAMGDIj58+fHI488EitXrtQUcnF/5woaAIAEcgIYAGCHVCqVzvL6DAkAssyAAQPi1ltvjbFjx0bPnj01hJza32UScEc1AAD/lxPAAAD/QwAMAHysv6MHDRoUBx98cDz//PMxadKk2LRpk8aQ+P1dtv+CJAAAO+cEMADADul0dr/fEgADQHarr6+PioqK2LZtm2aQE/u7dDrtBDAAQAI5AQwA8D+cAAYAPrK6urp4+umnY9q0acJfcm1/5wQwAEACCYABAP6HEw4AwIfW0NAQ06ZNiyeffDK2bt2qIXxkCfgGsAAYACCBBMAAADtkMpmsDoDz8ny9AwCywdvB71NPPRXV1dUaQs7u7wTAAADJJAAGANgh219wCYABYO9qbGyMGTNmxJNPPhmVlZUawieWn5+f9VtkUwIASB4BMADADplMpiGb6yssLDQkANgL0ul0zJo1KyZPnhwbN27UEHaZgoLsfjXX1NTUaEoAAAncZ2oBAMA/NDY2bs/m+gTAALBnpdPpePnll2Py5Mmxdu1aDWGXa9GiRbb/O1BvSgAAySMABgDYoampSQAMAEQmk4nZs2fH448/HuXl5RpCs93fNTY2CoABABJIAAwAsENDQ0NWv+ASAAPA7vV28PvEE0/E6tWrNYTdLtuvgM72G3IAAHiPfaYWAAD8gyugAaD5mjNnTkyaNCmWLl2qGewx2X4FtAAYACCZBMAAADs0NTU5AQwAzcyCBQtiwoQJ8dZbb2kG9nfv0tDQIAAGAEggATAAwA7Z/oJLAAwAu87ChQtj/PjxsXjxYs1gr8n2K6Cz/RckAQB4j32mFgAA/EO2B8AFBQWRl5cX6XTasADgY1q+fHmMGzcu5s+frxnsVXl5eVkfAG/fvt0JYACABBIAAwDs0NDQkPUnHFq1ahXbtm0zLAD4iFauXBmPPPKI4Jes2tclYH8sAAYASCABMADADrW1tXXZXqMAGAA+mnXr1sX48eNj9uzZkclkNISs2tdlu7q6ulqTAgBIHgEwAMAOW7du3ZrtNSbhRSEAZIP169fHY489JvjFvu4TqK6u3mpSAADJIwAGANihqqpKAAwACbdhw4Z4/PHH45VXXommpiYNwb7uE6isrHT1DABAAgmAAQB22LRpU9a/4GrZsqVBAcBOVFVVxcSJE+OFF16IxsZGDSHrJSEA3rRpkxPAAAAJJAAGANhh3bp1WR8AOwEMAP/bli1bYsKECYJfEicJ+7ry8nIBMABAAgmAAQB2WLZsmSugASAhqqurY/LkyTFz5syor6/XEBInCfu6pUuXCoABABJIAAwAsMP8+fOz/gRwcXGxQQHQrNXU1MSUKVPimWeeEfySaEnY173++uu+AQwAkEACYACAHRYsWFCXyWQaUqlUYbbW2Lp1a4MCoFmqq6uLp59+OqZNmxbbtsmkSL5s39el0+mGpUuXbjcpAIDkEQADALxDU1PTtoKCgrbZWp8AGIDmZvv27TF9+vR48sknY+tWt9GSO7J9X9fU1ORfOACAhBIAAwC8Q0NDw9ZsDoBLS0sNCYDm8ndyTJs2LZ566qmorq7WEHJOtu/rGhsb/YsHAJBQAmAAgHeor6+vbNWqVc9src8JYAByXWNjY8yYMSOefPLJqKys1BByVrbv6+rr66tMCQAgmQTAAADv0NDQkNVvmgXAAOSqdDods2bNismTJ8fGjRs1hJyX7fu6bN8XAwDw3gTAAADvUFdXV5XN9ZWWlkYqlYpMJmNYAOSETCYTr732Wjz++OOxatUqDaFZSKVSUVJSktU11tbWVpkUAEAyCYABAN5h27Ztm7K5vvz8/GjVqlXU1NQYFgCJlslkYvbs2fH4449HeXm5htCstGrVKvLz87O6xq1btzoBDACQUAJgAIB3qK6u3pztNZaVlQmAAUist4PfiRMnxpo1azSEZqmsrCzra9y2bVuVSQEAJJMAGADgHaqqqjZle43t2rWLtWvXGhYAiTNnzpyYNGlSLF26VDNo1tq1a5f1NW7atMkJYACALNbQWBgFjQ0REZFKRSavMJre/pkAGADgHSoqKqqyvcYkvDAEgHdasGBBTJgwId566y3NgITs5zZs2CAABgDIYoUFDf9MejMRqab0/+S+AmAAgHdYtWpV1r/oatu2rUEBkAgLFy6M8ePHx+LFizUD3iEJAfDq1aurTAoAIJkEwAAA77BgwYKsD4CdAAYg2y1fvjzGjRsX8+fP1wzYiST8Ql8S9sUAAOycABgA4B2eeOKJjZlMpimVSuVna41OAAOQrVauXBmPPPKI4Bc+QLb/Ql8mk2l64oknNpoUAEAyCYABAN6huro6vX379g1FRUVdsrVGJ4AByDZr166NCRMmxOzZsyOTyWgIJHw/t3379g3V1dVpkwIASCYBMADAu9TV1a0XAAPAB1u/fn089thjgl/Isf1cXV3delMCAEguATAAwLvU1dVVtGnTJmvrKykpiRYtWsT27dsNC4C9oqKiIiZOnBivvPJKNDU1aQh8BEVFRVFcXJz1+2GTAgBILgEwAMC7bN26dV2XLll7ADhSqVR07Ngx1qxZY1gA7FFVVVUxceLEeP755wW/8DF17NgxUqlU1u+HTQoAILkEwAAA71JVVZX1Jx46deokAAZgj9m8eXM8/vjj8cILL0RjY6OGwCfcx9kPAwCwOwmAAQDeZf369Vn/zbMkvDgEIPm2bNkSU6ZMiZkzZ0Z9fb2GwC7QsWNH+2EAAHYrATAAwLusXr066088JOHFIQDJVVNTE1OmTIlnnnlG8Au7WBJ+kW/VqlUCYACABBMAAwC8y9///ves/+aZABiA3aG2tjYmT54czz77bNTV1WkINNN93KuvvioABgBIMAEwAMC7PPzww+t//OMfN6RSqcJsrbFz584GBcAus3379pg+fXpMnTo1tm3bpiGwG2X7CeB0Ot3w8MMPC4ABABJMAAwA8C7V1dXpurq68latWu2TrTV26NAh8vLyIp1OGxgAH1tDQ0NMmzYtnnrqqaiurtYQ2M3y8vKiQ4cOWV1jfX39mtraWptMAIAEEwADAOxEbW3tmmwOgAsKCqJdu3axceNGwwLgI2tsbIwZM2bEk08+GZWVlRoCe0j79u2joCC7X8fV1NSUmxQAQLIJgAEAdmLz5s2r2rdvn9U1duvWTQAMwEeSTqdj1qxZMXnyZH+HwF7av2W7LVu2rDQpAIBkEwADAOzEpk2bVvfp0yera+zWrVvMmzfPsAD4QG8Hv1OmTIkNGzZoCOzF/Vu227BhwxqTAgBINgEwAMBOrFixYvWwYcOyusYkvEAEYO/KZDLx0ksvxZQpU6K83K2usLd17do162tctWrVKpMCAEg2ATAAwE7Mnz9/9ZgxY7K6xiS8QARg78hkMjF79uyYOHFirFnjMB9kiyT8At+8efP8oQEAkHACYACAnRg3btyab37zm5mISGVrjU4AA7Azc+bMiSeeeCKWLVumGZBlEvALfJlx48atNikAgGQTAAMA7MTrr79e29DQsKmwsLBDttZYXFwcZWVlsWXLFgMDIBYsWBDjx4+PJUuWaAZkobKysiguLs7qGhsaGjYuWLCgzrQAAJJNAAwA8B62bt26vF27dh2yucauXbsKgAGauYULF8b48eNj8eLFmgFZLAm3t2zbtm25SQEAJJ8AGADgPVRVVS1t167d0GyusWfPnrFw4ULDAmiGli1bFo899ljMnz9fMyABevbsmfU1VlZWLjUpAIDkEwADALyHdevWLevTp09W15iEF4kA7ForVqyIRx99VPALCZOEfdvatWuXmRQAQPIJgAEA3sPChQuXHX744VldY69evQwKoJlYtWpVjB8/PubOnRuZTEZDIGGSsG9buHDhMpMCAEg+ATAAwHuYNm3a0ksuuSSra+zevXvk5+dHU1OTgQHkqHXr1sX48eNj9uzZgl9IqIKCgkR8A/jpp59eZloAADmw/9QCAICde+ihhzbcd999W/Pz80uzdjNXUBBdunSJNWvWGBhAjqmoqIiJEyfGyy+/HOl0WkMgwbp27RoFBdn9Gq6xsbH6kUce2WBaAADJJwAGAHgf27ZtW15WVnZwNtfYq1cvATBADqmqqoqJEyfG888/74YHyBFJ+P7vtm3blpsUAEBuEAADALyPLVu2LMv2ALhnz57x0ksvGRZAwm3evDkef/zxeOGFF6KxsVFDIIck4fu/W7ZsWWpSAAC5QQAMAPA+1q9fvyzbT2z06NHDoAASbMuWLTFlypSYOXNm1NfXawjkoCTs19avX7/MpAAAcoMAGADgfSxYsGDh0KFDs7rGfffdN1KpVGQyGQMDSJCampqYMmVKPPPMM4JfyGGpVCr23XffrK9z/vz5C00LACA3CIABAN7Ho48++uYFF1yQ1TWWlJRE586dY926dQYGkAC1tbUxefLkePbZZ6Ourk5DIMd17do1WrVqlfV1/vnPf15kWgAAuUEADADwPiZNmlRVX1+/oaioqGM217nvvvsKgAGy3Pbt22P69OkxderU2LZtm4ZAM9GnT5+sr7G+vr7iySefrDItAIDcIAAGAPgAW7duXZTtAXCfPn3ipZdeMiyALNTQ0BDTpk2Lp556KqqrqzUEmpkkXP+8detWp38BAHKIABgA4ANUVFQs7NChw8hsrjEJLxYBmpvGxsaYMWNGPPnkk1FZWakh0EwlYZ9WUVHh+78AADlEAAwA8AGWLl266MADD8zqGnv16hUFBQXR2NhoYAB7WTqdjlmzZsWkSZNi06ZNGgLNWGFhYfTs2TMR+13TAgDIHQJgAIAPMHPmzEWnnnpqdm/qCgqiZ8+esWzZMgMD2EveDn4nT54cGzdu1BAg9tlnn8jPz0/CfnexaQEA5I48LQAAeH+//OUvV6bT6bpsr7NPnz6GBbAXZDKZePHFF+O73/1u3H///cJf4J+ScP1zOp2u++Uvf7nStAAAcocTwAAAH6C6ujpdXV29uE2bNodkc539+vWL6dOnGxjAHpLJZGL27NkxceLEWLNmjYYAO92fJWCvu7i6ujptWgAAuUMADADwIWzYsGFetgfA/fv3NyiAPeTVV1+NSZMmxapVqzQD2KlUKpWI/dmGDRvmmhYAQG4RAAMAfAiLFy9+o2/fvlldY1lZWXTu3DnWr19vYAC7yYIFC2L8+PGxZMkSzQDeV5cuXaK0tDQJ+9z5pgUAkFsEwAAAH8JTTz31+ujRo7O+zv33318ADLAbLFy4MMaPHx+LFy/WDOBD78uSYMqUKa+bFgBAbsnTAgCAD/aLX/xiTWNjY1W215mUF40ASbFs2bK4++674z/+4z+Ev8BHkoTv/zY0NFTee++9q00LACC3OAEMAPAhNDQ0ZDZv3jy/Q4cOI7O5TgEwwK6xYsWKePTRR2P+fDejArm7L9uyZYs/5AAAcpAAGADgQ1q3bl3WB8AdO3aMNm3axObNmw0M4GNYtWpVjB8/PubOnRuZTEZDgI+lbdu20aFDh0Tsb00LACD3CIABAD6kefPmzTvooIOyvs4DDzwwXnrpJQMD+AjWrVsX48ePj9mzZwt+gV2yH0uCuXPnzjMtAIDcIwAGAPiQ/vznP88/77zzsr7OAw44QAAM8CFVVFTEuHHjBL/ALt+PJcHDDz/sBDAAQA4SAAMAfEgTJ06srK2tXdGqVat9srnOgw8+2LAAPkBVVVVMnDgxnn/++WhqatIQYJdKwq0xNTU1yydNmlRlWgAAuUcADADwEWzYsOHvvXr1yuoAuG3bttG1a9dYu3atgQG8y+bNm+Pxxx+PF154IRobGzUE2OW6desWbdu2TcS+1rQAAHKTABgA4CNYuHDha7169Toj2+scMGCAABjgHbZs2RJTpkyJ5557LrZv364hwG6TlO//Lly48O+mBQCQmwTAAAAfwcSJE/9+wgknZH2dBx54YEyfPt3AgGavpqYmpkyZEs8880zU19drCLDbDRgwIBF1jh8//u+mBQCQmwTAAAAfwb333rv6Bz/4wfqioqLO2VznAQccEHl5eZFOpw0NaJZqa2tj8uTJ8eyzz0ZdXZ2GAHtEXl5e9O/fP+vrrK+vX3ffffeVmxgAQG4SAAMAfESVlZVzu3btmtXHgFu1ahX77LNPLFu2zMCAZqWuri6efvrpmDZtWmzbtk1DgD1qn332iVatWmV9nZs2bZpjWgAAuUsADADwES1dunR2tgfAERGDBg0SAAPNRkNDQ0ybNi2eeuqpqK6u1hBgr+2/kuCtt976m2kBAOQuATAAwEc0ffr0v48cOTLr6xw4cGBMmDDBwICc1tDQEM8991w8+eSTUVlZqSHAXt9/JcG0adP+bloAALlLAAwA8BH9x3/8x9JbbrmlOj8/v3U219mrV68oKyuLLVu2GBqQc9LpdMyaNSsmTZoUmzZt0hBgrysrK4tevXplfZ2NjY1b7rnnnmUmBgCQuwTAAAAfUW1tbXrDhg1/7dKly3HZXGcqlYqBAwfGrFmzDA3IGW8Hv5MnT46NGzdqCJA1Bg4cGKlUKuvr3Lhx4yu1tbVpEwMAyF0CYACAj+Gtt956JdsD4IgQAAM5I51Ox8svvxxTpkyJ8vJyDQGyct+VBIsWLXrFtAAAcpsAGADgYxg/fvwrRxxxRNbXedBBB0VBQUE0NjYaGpBImUwmZs+eHRMnTow1a9ZoCJCVCgoK4qCDDkpErY888ogAGAAgx+VpAQDAR/fjH/94ZX19/fpsr7OoqCj69etnYEAivfrqq3HHHXfEz3/+c+EvkNX69esXRUVFWV9nXV1d+b333rvaxAAAcpsTwAAAH9OGDRte6dGjx6ezvc5BgwbFggULDAxIjCVLlsSECRNi/vz5mgEkwuDBgxNR5/r1653+BQBoBgTAAAAf07x5815OQgA8bNiwePjhhyOTyRgakNXefPPNmDBhQixevFgzgMRIpVIxdOjQRNQ6d+7cl0wMACD3CYABAD6m++677+XRo0dnIiKVzXW2bds2evfuHcuWLTM0ICstW7YsHnvsMSd+gUTq06dPtG3bNgmlpu+9996/mhgAQO4TAAMAfEwTJ06s3Lp165LS0tK+2V7rkCFDBMBA1lmxYkU8+uijgl8g0YYMGZKIOqurqxc+/fTTm00MACD3CYABAD6B8vLyl/fff/+sD4AHDx4c48aNMzAgK6xcuTImTJgQc+fOdT09kHhJ+f7vmjVrfP8XAKCZEAADAHwCM2fOfG7//ff/fLbX2a1bt+jWrVuUl5cbGrDXrFu3LsaPHx+zZ88W/AI5oWfPntGlS5dE1DpjxoznTAwAoHkQAAMAfAK33Xbba5dcckl1fn5+62yvdciQIQJgYK9Yv359PPbYY4JfIOck5frnxsbGzbfddts8EwMAaB4EwAAAn0BlZWXThg0b/tqlS5fjsr3WQw89NCZNmmRowJ78MzKeeOKJeP7556OpqUlDgJxz6KGHJqLOioqKV6qrq9MmBgDQPAiAAQA+oXnz5s1MQgDcu3dv10ADe0RVVVVMnDgxXnjhhWhsbNQQICd17949evbsmZT9quufAQCakTwtAAD4ZP77v/97VkQk4kTFpz71KQMDdpstW7bEQw89FLfffns899xzwl8gpw0fPjwRdWYymfTdd9/9gokBADQfTgADAHxCkyZNqtqyZcuCsrKyg7K91uHDh8fjjz9uaMAuVVNTE1OmTIlnnnkm6uvrNQTIealUKg477LBE1Lply5bXp0+fvsXUAACaDwEwAMAusHz58lkDBw7M+gC4S5cu0atXr1i5cqWhAZ9YbW1tTJ48OZ599tmoq6vTEKDZ6N27d3Ts2DEx+1QTAwBoXgTAAAC7wLPPPvvCwIEDr0hCrcOGDRMAA59IXV1dPP300zFt2rTYtm2bhgDNzrBhwxJT61/+8pcXTQwAoHnxDWAAgF3g1ltvnV9fX782CbUefvjhkUqlDA34yBoaGmLq1Klx6623xuOPPy78BZqlJF3/XFdXt/rWW29dYGoAAM2LE8AAALtAQ0NDZs2aNc/16dPns9lea7t27aJPnz6xZMkSgwM+7J9xMW3atHjqqaeiurpaQ4Bmbb/99ou2bdsmotbVq1fPNDEAgOZHAAwAsIs8++yz05IQAEdEHHHEEQJg4AOl0+mYNWtWTJo0KTZt2qQhABFx5JFHJqbW6dOnTzMxAIDmxxXQAAC7yC233PJaQ0NDZRJqHT58eLRo0cLQgJ1Kp9Px3HPPxW233Rb333+/8Bdgh6KiovjUpz6ViFobGho23HLLLXNNDQCg+XECGABgF6murk6Xl5c/t88++5yR7bW2bNkyDj300Hj55ZcNDvindDodL7/8ckyZMiXKy8s1BOBdhgwZEkVFRYmodc2aNc/V1tamTQ0AoPkRAAMA7EIvvvjiM0kIgCMiRo4cKQAGIiIik8nE7NmzY+LEibFmzRoNAXif/VNSzJo161kTAwBongTAAAC70O233/7KOeecszU/P78022sdMGBAtG/f3tWu0My9+uqrMWnSpFi1apVmALyPjh07xgEHHJCIWhsbG6u/8Y1v/NXUAACaJwEwAMAutHLlyob169fP6tat2+hsrzWVSsXhhx8ekyZNMjhohubMmROTJ0+OJUuWaAbAh3D44YdHKpVKRK3r16+fVVFR0WhqAADNU54WAADsWq+++mpirts77LDDDAyamTfffDP+/d//PX7yk58IfwE+pFQqFSNGjEhMva+88sozpgYA0Hw5AQwAsIvddNNNz5166qnV+fn5rbO91m7dukX//v1j4cKFBgc5btmyZfHYY4/F/PnzNQPgIzrggAOic+fOiai1sbFxy4033jjL1AAAmi8BMADALrZy5cqG8vLyGT179vx0Euo9+uijBcCQw5YvXx7jxo0T/AJ8wv1SUpSXlz9TXl7eYGoAAM2XABgAYDeYMWPGUxdccEEiAuAhQ4ZE69ato7q62uAgh6xcuTImTJgQc+fOjUwmoyEAH1ObNm3i0EMPTUy9zz777FOmBgDQvPkGMADAbvDVr371lYaGhk1JqLWgoCCOOOIIQ4McsW7duvj5z38ed955Z8yZM0f4C/AJjRw5MvLz8xNRa0NDw8abbrrpVVMDAGjenAAGANgNKisrm1atWjW9T58+5ySh3qOPPjqefPJJQREk2Pr16+Oxxx6L2bNn+3cZYBdJpVIxatSoxNS7cuXKadXV1WmTAwBo3pwABgDYTaZNm5aY6/c6duwYAwYMMDRIoA0bNsSvf/3r+Nd//dd49dVXhb8Au9CAAQOiY8eOian36aefftLUAAAQAAMA7CZf+9rX5tTX11ckpd6jjjrK0CBBqqqq4v77749vf/vb8eKLL0ZTU5OmAOxiRx55ZGJqra+vX/eNb3zjdVMDAMAV0AAAu0ltbW16xYoVT++///6fT0K9hx56aLRt2zaqqqoMD7LYli1bYsqUKfHcc8/F9u3bNQRgN2nbtm0MGTIkMfUuX778qdraWtc/AwDgBDAAwO70xz/+cUJSas3Pz4/jjjvO0CBL1dTUxKOPPhq33XZb/OUvfxH+Auxmxx57bOTn5yel3Myvf/3rCaYGAECEABgAYLe66667llZXV89PSr1HH310tGjRwuAgi7wd/H7jG9+IqVOnRn19vaYA7GYtWrSIo48+OjH1btmy5Y177rlnhckBABDhCmgAgN3u9ddfn3T44YcPSEKtxcXFcdhhh8XMmTMNDvayurq6ePrpp2PatGmxbds2DQHYgw477LAoKSlJTL3z5s17wtQAAHibE8AAALvZ9773vanpdLohKfWecMIJkUqlDA72koaGhpg6dWrceuut8fjjjwt/AfawVCoVJ5xwQmLqTafT27/73e8+ZXIAALzNCWAAgN1s+vTpWyoqKmZ26dIlER/Y7d69e/Tv3z/efPNNw4M9qKGhIaZNmxZPPfVUVFdXawjAXnLAAQdE9+7dE1NvRUXFczNmzPAXBwAA/+QEMADAHjBr1qxEXcuXpFMvkHTpdDqee+65uP322+PRRx8V/gLsZccff3yi6p0xY8YkUwMA4J2cAAYA2AO++tWvvnT66adXFRYWtk1CvQMHDoyOHTvGhg0bDA92k3Q6HbNmzYrJkyfHxo0bNQQgC3Ts2DEGDhyYmHobGhoqb7755pdMDgCAd3ICGABgDygvL29YsWLF1MRsEvPy4sQTTzQ42A3S6XS8+OKL8Z3vfCfuv/9+4S9AFjnppJMiLy85r8tWrFgxpaKiotHkAAB4JwEwAMAe8qtf/erRiMgkpd6jjjoqysrKDA52kUwmE6+++mp873vfi1//+texdu1aTQHIImVlZXHUUUcl6q+W//7v//6zyQEA8G4CYACAPeQ///M/l1dWVv4tKfUWFhbGMcccY3CwC7wd/P785z+PNWvWaAhAFjruuOOioCA5X0urqqqa/dOf/nS1yQEA8G4CYACAPeill14al6R6jzvuuCgqKjI4+JjmzJkTd911V/z85z+P1au9owfIVkVFRYn7xbcXXnhhnMkBALAzBVoAALDnjB079pkFCxZUFhYWtktCvSUlJXHEEUfE9OnTDQ8+gjfffDPGjx8fb731lmYAJMCRRx4ZJSUliam3oaFh0zXXXPOsyQEAsDMCYACAPai8vLxh6dKlE/v3739xUmo+8cQT49lnn410Om2A8AEWLVoUjz32WCxevFgzABIiLy8vTjzxxETVvGTJkifKy8sbTA8AgJ3ucbUAAGDP+u1vfzsxIjJJqbdjx44xdOhQg4P3sXz58rj77rvjRz/6kfAXIGGGDRsWHTp0SFLJmd/85jePmxwAAO9FAAwAsIf953/+5/JNmza9kqSaTz/99EilUoYH77Jy5cr4yU9+Et///vdj/vz5GgKQMHl5eXHGGWckquZNmza9fM8996wwPQAA3osroAEA9oKXXnpp/KmnnnpYUurt2rVrDBkyJGbPnm14EBHr1q2L8ePHx+zZsyOTyWgIQEINHTo0OnfunKiaX3jhhQkmBwDA+xEAAwDsBZdffvkzS5YsWVdUVNQlKTWfccYZ8be//U3YRbO2fv36eOyxxwS/ADkglUrF6aefnqia6+rq1lx22WXTTQ8AgPcjAAYA2AsqKyub5s+f/8ihhx56dVJq7tatm1PANFsbNmyIxx9/PF555ZVoamrSEIAc8KlPfSq6du2aqJrfeOONcdXV1WnTAwDg/fgGMADAXvL1r399XDqdrktSzb4FTHNTVVUV999/f3z729+OF198UfgLkCNSqVR8+tOfTlTN6XS69pvf/OZjpgcAwAdxAhgAYC+ZMWNG9Zo1a/7Ss2fPxLx97N69ewwcODDmzJljgOS0LVu2xIQJE+KFF16IxsZGDQHIMYceemh069YtUTWvXr36qRkzZlSbHgAAH8QJYACAvejXv/71HyMiUR8SPeuss5wCJmdt27YtHn300bjtttviueeeE/4C5KC8vLwYM2ZM0srO/OpXv/qT6QEA8KH2vFoAALD3fP/733+rqqoqUR/V7dGjR3zqU58yPHJKfX19TJ06Nb71rW/F1KlTo76+XlMActSIESOiS5cuiap506ZNf73rrruWmh4AAB+GABgAYC975plnHkpazWeccUbk5dlKkjvmzZsXjz76aGzdulUzAHJYQUFBnH766Ymre9q0aQ+aHgAAH5a3dgAAe9nYsWNn1tfXr01SzZ07d47DDjvM8ACARBk5cmR06NAhUTXX1dWtHjt27POmBwDAhyUABgDYyyorK5tee+21Pyat7jPPPDMKCgoMEABIhBYtWiTy9O/s2bP/UF1dnTZBAAA+LAEwAEAWuOqqqyY0NjZWJanm9u3bx9FHH214AEAiHHfccdGmTZtE1dzQ0LDxiiuumGh6AAB8FAJgAIAssGDBgrqFCxc+lrS6R48eHYWFhQYIAGS1li1bxsknn5y4uhcuXDhu6dKl200QAICPQgAMAJAlvv71r/8pnU7XJqnmtm3bximnnGJ4AEBWO+2006K0tDRRNTc1NdV+7Wtfe8j0AAD4qATAAABZ4umnn968fPnyxF3xN3r06GjXrp0BAgBZqUOHDnH88ccnru5ly5ZNmD59+hYTBADgoxIAAwBkkbvvvvtPmUymKUk1FxYWxumnn254AEBWOvPMMxP3yYpMJtN41113/dH0AAD4OATAAABZ5Be/+MWatWvXTkta3UcccUT06tXLAAGArNK7d+847LDDEld3eXn5X+6///51JggAwMchAAYAyDIPP/zwn5JWcyqVijPPPNPwAICsMmbMmEilUomr+8EHH/yT6QEA8HEJgAEAsszXv/71NzZs2DAraXUPHDgwDj74YAMEALLCoEGDYsCAAYmru6KiYuatt966wAQBAPi4BMAAAFlo3Lhxv01i3WPGjIm8PFtMAGDvysvLizFjxiSy9j//+c+/NUEAAD7RflgLAACyz/XXXz+nqqrqr0mru1evXnHUUUcZIACwVx1zzDHRvXv3xNW9adOmV2666aa5JggAwCchAAYAyFJ/+tOf7k1i3WPGjInS0lIDBAD2ijZt2sRZZ52VyNofeOCBe00QAIBPSgAMAJClbrrpprlJPAVcXFwcZ555pgECAHvFWWedFS1btkxc3Zs2bXrl5ptvnmeCAAB8UgJgAIAsNm7cuF8lse5Ro0ZF7969DRAA2KP69OkTI0eOTGTtjz322K9MEACAXUEADACQxcaOHTu7qqrqb0mrO5VKxfnnnx+pVMoQAYA9tv/4/Oc/n8j9R2Vl5d+uueaav5kiAAC7ggAYACDLTZ069bdJrLtv374xZMgQAwQA9ojDDjsssTeQTJ48+TcmCADAriIABgDIcpdeeumLVVVVryax9s9//vNRXFxsiADAblVaWhrnn39+Imuvqqr66+WXX/6SKQIAsKsIgAEAEuChhx76WRLrLisri9NPP90AAYDd6qyzzoqSkpIklp753e9+91MTBABgVxIAAwAkwA033DB3w4YNs5JY+3HHHRd9+vQxRABgt+jbt28cddRRiay9oqJi1te//vU3TBEAgF1JAAwAkBA///nPfxoR6aTVnUql4vOf/3zk5dl6AgC7Vn5+flx00UWRSqWSWH76F7/4xX+bIgAAu5q3cAAACXHHHXe8tW7duulJrL13795xzDHHGCIAsEudcMIJ0b1790TWXl5e/pc77rjjLVMEAGBXEwADACTI3XfffW8mk2lKYu1nnXVWtG3b1hABgF2iQ4cOcfrppyey9kwm03T33Xf/3BQBANgdBMAAAAlyzz33rCgvL386ibW3bNkyzj33XEMEAHaJc889N1q0aJHI2tesWTP1xz/+8UpTBABgdxAAAwAkzA9/+MOfZzKZhiTWPnz48Bg0aJAhAgCfyKGHHhpDhw5NZO3pdLrhBz/4wS9MEQCA3UUADACQMPfee+/qRYsWPZDU+i+++OIoKSkxSADgY2ndunVcfPHFia1/4cKFf7jvvvvKTRIAgN1FAAwAkECXXXbZrxsaGjYlsfaysjJXQQMAH9u5554bpaWliay9oaFh4+WXX/47UwQAYHcSAAMAJNDs2bNrXn311V8ntf4jjjgiDj74YIMEAD6SwYMHx+GHH57Y+l955ZX7Zs+eXWOSAADsTgJgAICEOueccx6tqalZmtT6L7roomjZsqVBAgAfSsuWLeNzn/tcYuuvqalZMmbMmMdMEgCA3U0ADACQUJWVlU3Tpk37RVLrb9++fZx++ukGCQB8KGeccUa0b98+sfU/+eST91ZXV6dNEgCA3U0ADACQYOedd960qqqqV5Ja/wknnOAqaADgAx188MFx/PHHJ7b+TZs2vXzBBRc8a5IAAOwJAmAAgIT74x//eG9EZJJYeyqVigsuuMBV0ADAe2rZsmVccMEFkUqlkrqEzP333/8zkwQAYE8RAAMAJNzNN988b9WqVU8ktf6OHTsm+nt+AMDudcEFF0THjh0TW/+KFSse//rXv/6GSQIAsKcIgAEAcsCNN974k6ampq1JrX/kyJExdOhQgwQA/pdPfepTMWLEiMTW39TUVH3zzTf/t0kCALAnCYABAHLAxIkTK//+97//KslruPDCC6OsrMwwAYCIiGjTpk18/vOfT/QaZs+efd/EiRMrTRMAgD1JAAwAkCPOPvvsh2pqapYntf7S0tK46KKLDBIAiFQqFV/84hejtLQ0sWuoqal566yzznrYNAEA2NMEwAAAOaKioqJx0qRJP07yGgYPHhwjR440TABo5o444og46KCDEr2GJ5544qeVlZVNpgkAwJ4mAAYAyCGXXHLJzIqKihlJXsMFF1wQ3bp1M0wAaKZ69uyZ+KufKyoqZnzhC1+YZZoAAOwNAmAAgBzzb//2b/ek0+ntSa2/RYsWceWVV0ZhYaFhAkAzU1hYGF/60pcSvQ9Ip9Pb/+3f/u0e0wQAYG8RAAMA5Jh777139aJFix5M8hq6d+8eZ555pmECQDNzxhlnRPfu3RO9hsWLFz947733rjZNAAD2FgEwAEAO+uxnP/vL2traRL94PPHEE2Pw4MGGCQDNxKBBg+Kkk05K9Bpqa2tXn3vuub80TQAA9iYBMABADlq8eHH9uHHj/j3Ja0ilUnHJJZdE27ZtDRQAclybNm3ikksuiVQqleh1jBs37t8XL15cb6IAAOxNAmAAgBx1+eWXv1RRUTEjyWsoLS2NL3zhC4l/GQwAvLe3f+mrdevWiV5HRUXFM5dffvlLJgoAwN4mAAYAyGE33HDDXU1NTVuTvIaDDjrI94ABIId95jOfiUMOOSTRa2hqaqq+4YYbfmiaAABkAwEwAEAOGzdu3MbZs2cn/jt0p5xyiu8BA0AOOuSQQ+LTn/504tfx17/+9efjxo3baKIAAGQDATAAQI77zGc+81B1dfXCJK8hlUrFF7/4xejQoYOBAkCO6NixY3zpS19K/KceNm/ePO+00057xEQBAMgWAmAAgBxXXV2dfuCBB34UEekkr6O4uDguvfTSyMuzhQWApMvPz4/LLrssiouLk76U9P333/+ftbW1aVMFACBbeHsGANAMXH/99XMWLVr0YNLXsf/++8e5555roACQcOedd1707ds38etYuHDhH7/61a++bqIAAGQTATAAQDNxySWX/Lyurq486es4/vjjfQ8YABJs2LBhccwxxyR+HXV1dWsuvPDC+0wUAIBsIwAGAGgmXnvttdoHHnjguxGRSfI6UqlUfOlLX4oePXoYKgAkTO/evePSSy9N/Hd/IyLzwAMPfO/111+vNVUAALKNABgAoBm5+uqr/7Z06dJHk76OoqKiGDt2bJSWlhoqACRE69at46qrrorCwsLEr2X58uXjrr766r+ZKgAA2UgADADQzJx33nn/r66ubnXS19GhQ4e4/PLLIy/PlhYAsl1eXl5cfvnl0b59+8Svpb6+ft0ll1zyE1MFACBr999aAADQvLz++uu1Dz744Pcj4VdBR0QMGDAgzjrrLEMFgCw3ZsyYOPDAA3NiLY899tgPXnnllW2mCgBAthIAAwA0Q1/5ylf+umbNmqm5sJaTTz45Dj30UEMFgCw1ZMiQOOmkk3JiLWvXrv3LpZde+oKpAgCQzQTAAADN1GWXXfYf9fX1FUlfRyqViksvvTS6d+9uqACQZXr06BFf/OIXI5VKJX4tDQ0Nm6655pofmioAANlOAAwA0EzNmDGj+oEHHvhO5MBV0C1btozrr78+2rZta7AAkCXatWsX1113XbRs2TIXlpN56KGH/nXSpElVJgsAQLYTAAMANGNf+cpX/rpkyZI/58Ja2rZtG1dffXW0aNHCYAFgL2vRokVcffXVOfPLWUuXLn30iiuueNlkAQBIAgEwAEAzd+655/6ktrZ2eS6spXfv3jlzzSQAJNXbn2fYZ599cmI9tbW1y88555wfmywAAEkhAAYAaOYWLFhQ97Of/ezbmUymMRfWM2zYsDjllFMMFgD2kk9/+tMxdOjQnFhLJpNp/NnPfvbtBQsW1JksAABJIQAGACBuvfXWBfPnz78/V9Zz5plnxuDBgw0WAPaw4cOHx2c+85mcWc/8+fN/d+utty4wWQAAkkQADABARESMGTPmvpqamrdyYS2pVCouu+yy6Nmzp8ECwB7Su3fvuPjii3PmUwxbt25ddPrpp//aZAEASBoBMAAAERGxcuXKhh/+8Ie3pdPpnLjisGXLlvEv//Iv0aVLF8MFgN2sS5cucf3110dRUVFOrKepqanmu9/97jfKy8sbTBcAgKQRAAMA8E933XXX0ueff/6eXFlPaWlpXHvttVFWVma4ALCblJWVxXXXXRclJSU5s6aZM2fe/f/+3/9bZboAACSRABgAgP/l5JNPHldeXv50rqynU6dOMXbs2Jw5kQQA2aSoqCiuueaa6NixY86sqby8/MlTTz11gukCAJBUAmAAAP6PSy655K66urq1ubKefffdN6644orIy7P9BYBdJS8vL6688sro3bt3zqyprq6u/JJLLvmh6QIAkOi9uhYAAPBus2bNqn7ooYfujIh0rqxp4MCBcd555xkuAOwi559/fhxyyCG5tKT0gw8+eOesWbOqTRcAgCTLb3tQ9NzpjndbRG15oQ4BADRTEydOXDNmzJi8Tp06Dc2VNfXp0yfy8/PjzTffNGAA+ATOOuusOOmkk3JqTa+//vp9Z5555kTTBQAgCYq7N0Ze6c5/5gQwAADv6dRTT/31li1bXs+lNZ122mlx9NFHGy4AfEzHHntsnHrqqTm1pi1btrxx2mmn/cZ0AQDIBQJgAADeU0VFReONN974jcbGxqpcWtcFF1wQRx55pAEDwEd05JFHxuc+97mcWlNjY2PVzTff/I2KiopGEwYAIBcIgAEAeF9//OMf1z/yyCPfiRz6HnAqlYqLLroohgwZYsAA8CENHTo0LrrookilUrm0rPQjjzzynfvvv3+dCQMAkCsEwAAAfKBLL730hQULFvwupzbCeXnxpS99Kfbff38DBoAPcNBBB8WXvvSlyMvLrVdJCxYs+N2ll176ggkDAJBLBMAAAHwoo0eP/mVVVdXcXFpTYWFhfOUrX4kePXoYMAC8h169esUVV1wRBQUFObWuqqqqOaNHj/6lCQMAkGsEwAAAfCgVFRWNV1111S0NDQ0bcmldJSUlcfPNN8c+++xjyADwLr17946bbropiouLc2pdDQ0NG6666qqv++4vAAC5SAAMAMCHNmHChE3333//tzKZTDqX1lVcXBzXXXdddO/e3ZABYIfu3bvHtddeG61atcqpdWUymfT999//rQkTJmwyZQAAcpEAGACAj2Ts2LGz58+f/9tcW1fr1q3juuuuiw4dOhgyAM1ehw4d4rrrrovWrVvn3Nrmz5//m7Fjx842ZQAAcpUAGACAj+y44477xaZNm17MtXW1a9cubrzxxmjXrp0hA9BstW3bNmf/Pty4ceOLxx13nO/+AgCQ0wTAAAB8ZNXV1emLL774W3V1datzbW0dO3aMG2+8Mdq0aWPQADQ7ZWVlceONN0bHjh1zbm21tbWrL7zwwturq6vTJg0AQC7Lb3tQ9NzZD9LbImrLC3UIAICdWrZsWf327dtfOvbYY0/Ny8trkUtrKykpiaFDh8Zrr70WNTU1hg1As9ChQ4f42te+Fp06dcq5tTU1NW39zne+M/bBBx9cb9IAAOSC4u6NkVe6858JgAEA+NhefPHFzYcccsiyAQMGnBgRqZzaRBcXx5AhQ4TAADQLHTt2jJtuuik6dOiQi8tLjx8//ravfvWrc0waAIBc8X4BsCugAQD4RC688MIZb7zxxm9ycW3t27ePm266KSdPQgHA2zp16pTL4W+88cYbv77wwgufM2kAAJoLATAAAJ/YqFGjfrFhw4aZubi2t0Pgzp07GzQAOadz585x0003Rfv27XNyfRs2bJg5atSo+0waAIDmRAAMAMAnVltbm77sssu+V1dXtzoX19euXbu44YYbomPHjoYNQM7o0KFDXH/99dGuXbtc3Z+s/sIXvvDd2tratGkDANCc+AYwAAC7xJIlS+oj4pVRo0admpeX1yLX1ldcXBxDhw6NuXPnxrZt2wwcgETr0qVL3HjjjTl77XNTU1P1nXfeec0f/vCHdaYNAEAuer9vAAuAAQDYZWbNmlXVo0ePuYceeujoVCqVn2vra9WqVYwYMSIWLVoUlZWVBg5AIu23335x0003RVlZWU6uL51ON/z617++4fbbb3/TtAEAyFUCYAAA9phJkyatPeqoozbsu+++R+fi+goLC2P48OGxbNmy2LBhg4EDkCgDBgyIa6+9Nlq1apWza5w2bdq/XXLJJc+ZNgAAuez9AmDfAAYAYJc77bTTHn/rrbcezNX1FRUVxTXXXBNDhgwxbAASY8iQIXHNNddEUVFRzq5xwYIFvzv99NOfMG0AAJozATAAALvFEUcccc+GDRtm5ur6CgoK4sorr4wjjjjCsAFIwt/LceWVV0ZBQUHOrrG8vPypESNG/LdpAwDQ3AmAAQDYLaqrq9MXXXTRd2pra1fk7GY6Ly8uvvjiOPLIIw0cgKw1atSouPjiiyMvL3dfA23dunXxZz/72e83NDRkTBwAgObON4ABANhtli9fvr2mpuaFY4899uT8/PyWubjGVCoVgwYNikwmE4sWLTJ0ALLK6aefHueee26kUqmcXWN9fX3FDTfccM3UqVOrTBwAgObi/b4BLAAGAGC3evnll7cUFBS8cMQRR4zOy8trkYtrTKVSccABB0SnTp1i7ty5kck4fATA3lVYWBhXXHFFHHPMMTm9zsbGxuo777zzKz/72c9WmzoAAM2JABgAgL1qxowZlb169Xp98ODBJ6dSqfxcXWfPnj2jb9++8fe//z0aGxsNHoC9olWrVnH11VfHwIEDc3qd6XS64be//e2Nt9122wJTBwCguREAAwCw1z3xxBPlw4cPX9OvX79jIyJn76Hs2LFjDBw4MObMmRN1dXUGD8Ae1a5du7jxxhujT58+ub7U9JQpU779xS9+8XlTBwCgOXq/ADhPewAA2FPGjBkz9Y033vh1rq+zZ8+eceONN0bHjh0NHYA9pkuXLnHTTTdF9+7dc36tc+fO/eU555zzF1MHAID/SwAMAMAe9alPfernS5cufTjX19mlS5e49dZb48ADDzR0AHa7gQMHxje/+c3o1KlTzq/1rbfeemjEiBG/MnUAANg5ATAAAHvcsccee8/GjRtfyPV1FhcXx7XXXhsjRowwdAB2m8MPPzyuuuqqaNmyZc6vdePGjc8fffTR95g6AAC8NwEwAAB7XEVFReNxxx339crKyr/l+loLCgrisssui/PPPz9SqZThA7DLpFKpOP/88+PSSy+NgoKCnF/vpk2bXj7ssMNuqaysbDJ9AAB4bwJgAAD2isWLF9efddZZN1dXV7/ZHNZ7/PHHx5e//OUoKioyfAA+sRYtWsSXv/zlOP7445vFequrq98cM2bMN8rLyxtMHwAA3l9+24Oi585+kN4WUVteqEMAAOw2a9asaVi1atWs0aNHH1dQUNA619fbrVu3OOCAA2LevHlRX1/vAQDgYykrK4trrrkmDjrooGax3rq6uvKxY8de89RTT202fQAA+Ifi7o2RV7rznwmAAQDYq+bNm1ezevXqZ04++eTjCwoKSnN9ve3atYuRI0fG8uXLY+PGjR4AAD6S/v37x0033RRdu3ZtFuutr69fd9111335T3/6U4XpAwDA/xAAAwCQ1ebMmbMtlUq9fOSRR56Ul5eX83ckt2jRIkaMGBG1tbWxdOlSDwAAH8rxxx8fX/rSl5rN5wQaGxu33HXXXdf99Kc/XWn6AADwvwmAAQDIejNnzqzs2bPn64MHDz4plUrl5/p6U6lUHHLIIdGqVatYsGBBZDIZDwEAO5WXlxef/exn4/TTT49UKtUs1pxOp7f//ve//+o3vvGN1z0BAADwfwmAAQBIhEmTJpXvs88+8wYOHHhCKpUqaA5r3m+//WLAgAExd+5c3wUG4P8oKyuL6667LoYNG9Zs1pxOp7f/8Y9/vOmqq676qycAAAB2TgAMAEBiTJw4cc3BBx+85MADDzwulUrlNYc1t2/fPoYOHRqLFi2KLVu2eAgAiIiIffbZJ66//vro2bNns1lzJpNpnDBhwm1f/OIXn/cEAADAexMAAwCQKI8++ujy/fff/42DDjrohOZwHXRERHFxcRx11FHR2NgYb731locAoJkbPXp0XHHFFVFSUtJs1pxOpxsefvjhr15yySWzPAEAAPD+BMAAACTO+PHjVw0cOHDpAQcccGxzOQmcSqViwIAB0aVLl3jjjTeiqanJgwDQzBQVFcWll14aJ554YrP53m/EP07+Pv7447dffPHFMz0FAADwwQTAAAAk0iOPPLLs0EMPXbb//vs3mxA4IqJHjx4xZMiQePPNN2Pr1q0eBIBmonv37vEv//IvccABBzSrdWcymaYnnnji9s997nPPeAoAAODDEQADAJBYDz/88NJjjjlmY+/evY+KiGZzFKq0tDSGDx8eq1evjvXr13sQAHLcwIED45prrol27do1t6VnZsyY8YOzzjprqqcAAAA+PAEwAACJdv/99795zDHHVO6zzz5HRDMKgVu0aBGHHXZYtGzZMhYuXBjpdNrDAJBjCgoK4pxzzonzzz8/WrRo0dyWn37uuefuOuWUUyZ4EgAA4KMRAAMAkHi///3v5w8bNmxF3759j2lO10GnUqno27dvDB06NBYvXhxbtmzxMADkiJ49e8YNN9wQgwcPblbf+434x7XPU6ZM+fbpp58+2ZMAAAAfnQAYAICc8OCDDy4ZNmzYin79+jWrEDgionXr1nHEEUdEfX19LF261MMAkGCpVCpOOOGEuOKKK6JNmzbNbv07wt9vnXPOOX/xNAAAwMcjAAYAIGc89NBDS4YNG7a8X79+xza3EDg/Pz8OPvjg6NWrV8yfPz8aGho8EAAJU1JSEpdffnmccMIJkZ+f3+zWn8lkGp944olvffazn53maQAAgI9PAAwAQE556KGHlo4cOXJdnz59RqWa252ZEdG1a9cYNmxYLFu2LCorKz0QAAnRt2/fuO6662K//fZrluvPZDLpp59++rvnnHPO054GAAD4ZATAAADknD/96U+LDj300KX7779/s7sOOiKiuLg4jjzyyCgpKYk333wz0um0hwIgSxUUFMRnP/vZuPDCC6OkpKRZ9iCdTjc88sgjt5x//vnTPREAAPDJCYABAMhJDz/88NId3wQelUqlmt09mqlUKvr06RMHH3xwLFy4MLZt2+ahAMgynTt3jrFjx8bQoUOjGV5aERH/CH+feOKJ2y+88MLnPBEAALBrCIABAMhZDz300JIePXq8NmjQoGPz8vJaNMcetG3bNkaNGhVNTU2xZMkSDwVAFkilUjF69Oi48soro0OHDs22D01NTdt++9vf/stll132oqcCAAB2HQEwAAA5bdKkSeXdu3efM3jw4GYbAufn58eAAQOiV69esWDBgti+fbsHA2Avad26dVx66aVx/PHHR35+frPtQ2NjY/WvfvWrf7nuuute81QAAMCuJQAGACDnTZ48eW1jY+OMI4444uiCgoKS5tqHrl27xqhRo2Lbtm2xcuVKDwbAHpRKpWLUqFExduzY6NWrV7PuRX19/fo77rjjK9/61rcWejIAAGDXEwADANAsPP/881UbNmx45rjjjjuqsLCwrLn2obCwMAYNGhT77bdfLF68OGpraz0cALtZ+/bt44orrogTTzwxCgub9/uU2tralTfffPPVP/nJT1Z7MgAAYPcQAAMA0Gz87W9/27p27doZJ5xwwsjCwsK2zbkXnTp1ipEjR0Z1dbXTwAC70ciRI+Pqq6+OHj16NPte1NTULL/hhhuu/e1vf7vOkwEAALuPABgAgGbltdde2zpv3rynTznllKFFRUWdmnMvCgsL49BDD4399tsvFi1a5DQwwC709qnfk08+udmf+o2I2Lx587yLL774unHjxm30dAAAwO71fgFwat9zYsTOftC4LmLjq610DwCAxOrVq1fhs88++69du3Y9QTciGhoaYurUqTF58uRobGzUEICPqaCgIE499dQYPXq04HeH8vLyp4499tjvrly5skE3AABg9+swrDYKuuz8ZwJgAAByWuvWrfNeeumlm/fdd9+zdeMfVq9eHffff38sWbJEMwA+ov322y8uuugi1z2/w8KFC38/fPjwnzY0NGR0AwAA9gwBMAAAzd7zzz9/8aGHHnp1RKR0IyKTycTMmTPjz3/+c9TV1WkIwAcoKSmJ8847L0aMGBGplL9Kdki//PLL9xx77LEPagUAAOxZ7xcA+wYwAADNwn333Tfn+OOP39yrV6/DQwgcqVQqevfuHcOHD49169ZFRUWFhwTgPRxyyCExduzY6N+/v/B3h0wm0/jMM8/828knnzxONwAAYM97v28AC4ABAGg2fve7370xePDgJf369Ts6lUrl60hEcXFxjBgxInr06BFLly6N2tpaTQHYoUOHDvGFL3whzjzzzCguLtaQHZqammoeeOCBWz73uc9N1w0AANg7BMAAALDDww8/vKygoOC54cOHH1FQUFCqI//QrVu3OO6446K0tDQWL14cTU1NmgI0Wy1btoxzzjknLr300ujevbuGvENtbe2K22677arbbrvtDd0AAIC9RwAMAADv8Oyzz25avHjx0yeddNKQoqKiTjryD3l5edGnT58YOXJkbN26NVatWqUpQLNz+OGHx1e+8pUYMGBA5OXlacg7VFVV/e3CCy+8/oEHHvDdAAAA2MsEwAAA8C7z58+vefbZZ58+44wz+hcXF/fSkf/RsmXLGDJkSOyzzz6xdOnSqKmp0RQg53Xs2DG++MUvximnnBItW7bUkHdZt27dMyeffPI3Xn755W26AQAAe9/7BcCpfc+JETv7QeO6iI2vttI9AAByWmFhYer555//0sEHH3y5bvxfTU1N8fzzz8f48eOjurpaQ4Cc07p16zjzzDPjyCOPdOJ35zJ///vff3rMMcfc39DQkNEOAADIDh2G1UZBl53/TAAMAAARMWnSpM8cc8wxt6RSKdfg7ERNTU1MmTIlpk2bFg0NDRoCJF5hYWGccsopcdJJJ0VRUZGG7EQ6na6fOnXqd88555y/6AYAAGSX9wuAXQENAAAR8Yc//GHhfvvt98aAAQOOysvLkwS8S2FhYQwYMCCGDh0amzZtinXr1mkKkFiDBw+Oq666KoYOHRoFBQUashONjY1Vv//972/5whe+MEs3AAAg+/gGMAAAfAgTJkxYXV1dPf3II4/8VGFhYTsd+b9KS0vjsMMOi/79+8eaNWti8+bNmgIkRu/evePyyy+PU045JUpLSzXkPWzdunXxLbfccs33vve9hboBAADZyTeAAQDgI+jTp0+LJ5988us9evQ4TTfe3/z58+ORRx6JlStXagaQtXr16hXnnHNODBgwQDM+wKpVq5444YQTfrBy5Ur3/QMAQBbzDWAAAPgYnnnmmfOHDx9+fSqVytON95bJZGL27Nkxbty4qKio0BAga3Tu3DnOOuusGDp0aKRSKQ15/z/Lm2bNmvXDk08++THdAACA7OcbwAAA8DH85je/eX3//fd//cADDzzSd4HfWyqViu7du8cxxxwT7dq1i2XLlkV9fb3GAHtN27Zt49xzz42LL744evToIfz9AI2NjdUPPvjgLZ/97Gf/ohsAAJAMvgEMAAAf0/jx41dFxPOHHXbYiMLCwjIdeW95eXnRu3fvOOqoo6KgoCBWrlwZjY2NGgPsMcXFxXHKKafEl770pejbt2/k5bnA4YPU1tau+MEPfnD9LbfcMk83AAAgQf/94xvAAADwyQwePLjVo48++s1u3bqdpBsfTn19fTzzzDMxderU2LZtm4YAu01ZWVmceuqpceSRR0ZRkQsbPqyVK1c+/ulPf/pHixcvdm0DAAAkjG8AAwDALvLkk0+edeSRR96USqVcl/MhCYKB3eXtE7/HHnus4PcjyGQyDbNmzfoP3/sFAIDk8g1gAADYRX7/+98v6NGjx2uHHHLIyPz8fL8x+SEUFBREv3794qijjoq8vLxYtWqVq6GBT6Rly5ZxwgknxBVXXBEHHXRQFBQUaMqH1NDQsOG3v/3t1z7/+c8/oxsAAJBcroAGAIBd7Lzzzut4991339m2bdvBuvHR1NTUxLPPPhvTpk2LLVu2aAjwoZWVlcXxxx8fxxxzTBQXF2vIR1RVVfW3a6+99vZHHnlkg24AAECyuQIaAAB2g06dOhVMmzZtbN++fT8XESkd+WgaGhri+eefjyeffDI2bJBFAO/7522cdNJJccQRR0RhodvKPobMokWL/nTsscf+pLKyskk7AAAg+QTAAACwG/3hD38Ydfrpp99WUFDQRjc+unQ6Ha+++mpMnTo1Vq5cqSHAP/Xq1StOOeWUGDp0aOTl5WnIx9DY2Fg1YcKEOy666KKZugEAALlDAAwAALvZaaed1vbee+/9docOHUbqxse3fPnymDZtWrz88suRTqc1BJqhvLy8OOyww+L444+P3r17a8gnsHHjxue//OUvf3fSpElVugEAALlFAAwAAHtAYWFh6qmnnjpv+PDh16RSKXeUfgIbNmyIGTNmxHPPPRc1NTUaAs1AcXFxjBo1Ko4++ujo2LGjhnwCmUym4ZVXXvl/J5100kMNDQ0ZHQEAgNzzfgFwftuDoufOfpDeFlFb7p0VAAB8WOl0On7zm9+8Xlpa+uLgwYM/VVhYWKYrH09xcXEMGDAgjj322GjTpk2sXbs2amtrNQZyUIcOHeKMM86ISy+9NAYOHBjFxcWa8gnU1tau+slPfnLjxRdf/IybFAAAIHcVd2+MvNKd/8wJYAAA2A1OPPHENvfdd9+tnTp1Olo3PrnGxsb429/+Fs8++2wsWrRIQyAH9OvXL44++ugYNmxYFBQUaMguUFFR8cwXv/jFf5s+ffoW3QAAgNzmCmgAANhLHn744RNGjx799YKCgta6sWusX78+Zs6cGc8//3xUV1drCCRIaWlpHHnkkXHUUUdF586dNWQXaWxs3DJ16tS7PvvZz/5FNwAAoHkQAAMAwF50ySWXdP3+97//rXbt2g3VjV2nsbExXnvttXjuuedi/vz5GgJZbMCAATFq1KgYPHiw0767WFVV1atf//rXv/e73/1urW4AAEDzIQAGAIC9rF27dvlTp0699OCDD740lUrl68iutXz58nj++efj5ZdfjpqaGg2BLFBSUhLDhw+PI444Inr37q0hu1gmk2mcN2/efSeeeOJvq6urfewXAACaGQEwAABkia9//ev73Xjjjf9aWlraXzd2vXQ6HW+++WY899xz8dprr0VjY6OmwB5UUFAQgwcPjlGjRsUBBxwQeXl5mrIbVFdXL/zP//zPf/3BD36wRDcAAKB5EgADAEAWOfjgg1v9+c9/vrZ3795jIiKlI7tHZWVlvPjii/HCCy/EunXrNAR2o65du8bIkSPj8MMPj7Zt22rI7pNZunTpn88888z/t3jx4nrtAACA5ksADAAAWejuu+8eePHFF9/WqlUrd6PuZuXl5fHqq6/GSy+9FOvXr9cQ2AU6d+4cI0aMiGHDhkW3bt00ZDerqalZ9tvf/vbOm266aa5uAAAAAmAAAMhS/fr1K3r44Ycv79+//4WpVMpdqXvA8uXL46WXXoqXX345qqurNQQ+grKyshg+fHiMGDHCd333kEwmk164cOEfzj777F8sXbp0u44AAAARAmAAAMh6P/3pT4d97nOf+2bLli176Mae0dDQEHPnzo2//vWvMXfu3Ni+Xa4CO9OyZcsYNGhQDBs2LA455JAoKCjQlD2ktrZ21R//+Mc7rr322r/rBgAA8E4CYAAASIA+ffq0ePTRR69wGnjPS6fTsXTp0nj11VedDIaIaNu2bQwbNiyGDRsWffr0ibw8fyTtSZlMpuG11177+ZlnnvmnioqKRh0BAADeTQAMAAAJ8uMf//jQCy644JutWrXaRzf2vLdPBs+ePTvmzp0bdXV1mkKzUFZWFoMHD45hw4ZF//79Iz8/X1P2gpqammX333//nTfccINv/QIAAO9JAAwAAAnTrl27/HHjxp37qU996qq8vDwb870kk8nEihUrYu7cuTFnzpxYsWJFZDIZjSEnpFKp6Nu3bwwbNiwGDRoUHTt21JS9qKmpqfbVV1/92ZgxY/5cWVnZpCMAAMD7EQADAEBCffnLX+5x++23f7V9+/aH68bet2XLlnjjjTdizpw5MW/evKivr9cUEqVly5Zx8MEHx6BBg+KQQw6J0tJSTckCGzdufPG73/3uv//iF79YoxsAAMCHIQAGAIAEKywsTE2cOPGMkSNHXlNQUNBaR7JDXV1dvPnmm/HGG2/EG2+8EevXr9cUslKXLl3ioIMOioMOOigOOOCAKCoq0pQs0djYuGXmzJk/PvPMMyc2NDS4XgAAAPjQBMAAAJADjjzyyNY/+9nPrujbt++5EZGnI9mluro6Fi5cGPPnz4958+ZFZWWlprBXtGvXLg455JAYMGBA9O/fP1q39nsjWSj91ltv/fmqq676xaxZs6q1AwAA+KgEwAAAkEN++ctfjhgzZsyNrVq16q0b2SmdTsfKlStj0aJFsXDhwli8eHFs27ZNY9gtSkpKol+/ftG/f//Yf//9o1evXpGX53dEslVNTc3yRx999EdXXnnlK7oBAAB8XAJgAADIMd26dSt8+OGHPzd48ODL8vPzbdyzXCaTiTVr1sTChQtj0aJFsWjRotiyZYvG8LGUlZVF//79/xn6du/ePVKplMZkuaampprXXnvtV2PGjHmgoqKiUUcAAIBPQgAMAAA56rjjjiv7r//6r8tdC508mzdvjuXLl8eKFSti+fLlsXjx4qipqdEY/pfi4uLo169f9O7dO/bZZ5/Yd999o6ysTGMSJJPJpJcsWfLn66677pfTp0/3mx8AAMAuIQAGAIAc99Of/nTIueeee3NpaWlf3UimxsbGWLlyZSxdujSWLVsWy5cvj3Xr1kUmk9GcZiKVSkWXLl1in332iT59+kSfPn2iV69eUVBQoDkJtXXr1sUPPvjgj6699tq/6wYAALArCYABAKAZaNeuXf64cePOGTp06BUFBQWtdST56uvrY+XKlf88KbxixYpYu3ZtpNNpzUm4vLy86Nq1a+yzzz7//KdXr17RsmVLzckBjY2NW/7617/+4pxzznm0srKySUcAAIBdTQAMAADNyIknntjmnnvuuXzfffcdk0qlHB3MMdu3b481a9bEmjVrYu3atbF27dooLy+PDRs2CIazUF5eXnTs2DG6desWXbt2jW7dukW3bt2iR48eUVhYqEE5JpPJNC5ZsuRR1z0DAAC7mwAYAACaoa9+9av7Xnfdddd16NDhCN3IfY2Njf8MhNetWxfr1q2LioqKWLduXWzbtk2DdrPS0tLo3LnzP//p0qVLdO3aNbp27eoK52Ziw4YNM//rv/7rxz/60Y+W6wYAALC7CYABAKAZ++UvfznirLPOuq64uNj3gZupmpqaWL9+/T//qaioiMrKyqisrIxNmzZFY2OjJn2AgoKCaN++fbRr1y7at28fHTt2jC5dukSnTp2ic+fOUVxcrEnN1NatW98aP378PVdcccXLugEAAOwpAmAAAGjm2rVrl//ggw+eOWLEiCsLCwvb6gjvtHnz5n+GwZs2bYrKysqorq6OLVu2xJYtW6K6ujqqq6sjk8nk3NpTqVS0bt06WrduHWVlZdGmTZsoLS39X2Fvu3btok2bNh4U/peGhobKl1566efnnHPO+OrqavevAwAAe5QAGAAAiIiIoUOHFt97770XHHjggRfk5+c7ssiHlk6n/xkEV1dXR01Nzfv+k8lkora2NtLpdNTX10dTU1PU1dXt0u8U5+XlRcuWLSM/Pz+KiooiLy8vWrVqFalUKoqLi3f6T0lJSbRq1eqfgW9paWnk5eUZMB9aU1NTzYIFC/745S9/+Y+zZ8+u0REAAGBvEAADAAD/y2mnndb2rrvuurRPnz5n5+XlFeoIe9LbgfDbtm/f/r7XUBcUFESLFi3++b/fDnxhT8pkMg1LliwZd8stt/xq0qRJVToCAADsTQJgAABgp0477bS2d95554X777//5wTBAP9XJpNpWLhw4QO33nrrHwS/AABAtni/ADi/7UHRc2c/SG+LqC33/gcAAHLZokWL6u69995X0un0swcddFCnkpKS3roC8A8VFRUz/7//7/+77aKLLpq6aNGiOh0BAACyRXH3xsgr3fnPBMAAAEDMnDmz8u67736qqalpWr9+/Ypbt27dN5VKpXQGaG4ymUx6zZo1U+65555/Peeccx6cOXNmpa4AAADZRgAMAAB8KDNnzqz88Y9//Gw6nZ4uCAaak7eD37vvvvtfzz///McEvwAAQDYTAAMAAB+JIBhoLgS/AABAEgmAAQCAj+XtILisrOyFvn37diwuLu4VEYJgIBdkKioqnrv33nu/PWbMmEcEvwAAQJK8XwCc2vecGLGzHzSui9j4aivdAwAA/unqq6/u8ZWvfOX8Pn36nJWXl9dCR4CkSafT9UuXLh3/X//1Xw/84he/WKMjAABAEnUYVhsFXXb+MwEwAADwkZ1xxhntb7/99rMPPPDA8/Pz81vrCJDtmpqaqhcsWPDgd77znUcmTpzotC8AAJBoAmAAAGC3GD58eMkPf/jDzwwePPjioqKijjoCZJv6+voNr7322u9vvPHGx2fPnl2jIwAAQC4QAAMAALvV0KFDi++5556zDjnkkPOKioq66giwt9XV1a19/fXXH7z++uvHC34BAIBcIwAGAAD2iFatWuXdc889w0455ZTzO3bseJSOAHtYZsOGDbOmTJny4PXXX/9qbW1tWksAAIBcJAAGAAD2uH/913/tf/7555/dq1ev0/Ly8lroCLC7pNPp+pUrV05+4IEHHvnOd76zSEcAAIBcJwAGAAD2mjPOOKP97bfffvYBBxzw2YKCgjY6AuwqjY2NVW+++eafv/e97z06YcKETToCAAA0FwJgAABgrxs+fHjJ97///dGDBg0aU1paur+OAB9XdXX1wtdee+3Rr371q1Nfe+21Wh0BAACaGwEwAACQVb761a/ue8EFF3y6b9++ZxUUFLTWEeCDNDY2bnnrrbfG/+EPf5j4ox/9aLmOAAAAzZkAGAAAyEpDhw4t/sEPfnDy4MGDz27dunV/HQHerbq6+s2XX375weuuu+7ppUuXbtcRAAAAATAAAJDlCgsLU3ffffeQ0aNHn9G1a9fj8vLyinQFmq90Ol1XXl4+bcqUKROuvfbav+sIAADA/yYABgAAEqNPnz4t/v3f/33UyJEjz2rfvv2nIiKlK9AsZDZt2vTXF1544bGvfe1rzzntCwAA8N4EwAAAQCJddNFFXa6++uqTDzzwwLNbtmzZTUcg99TV1a1ZsGDBuJ/+9KdP3n///et0BAAA4IMJgAEAgETr1q1b4d13333k4YcffmqHDh2OyMvLK9QVSK50Ot2wcePGWbNmzZp8/fXXz6qoqGjUFQAAgA9PAAwAAOSMo48+uvWtt956/CGHHHJKu3btBkdEnq5AIqQrKytfmzdv3uQ777xz+owZM6q1BAAA4OMRAAMAADnpuOOOK/vGN75x/CGHHHJa27ZtB4bvBUO2yVRVVc2dN2/epO9///vTpk+fvkVLAAAAPjkBMAAAkPNuu+22vmedddZJffr0Oa5Vq1a9dQT2ntra2uXLly+f/uijjz51xx13vKUjAAAAu5YAGAAAaFa+9KUvdbv44ouP7t+//wlOBsMekamqqpq7cOHCv/z+97+fcd9995VrCQAAwO4jAAYAAJqtSy65pOtll112jDAYdrl0VVXVvIULF/7lV7/61bO/+93v1moJAADAniEABgAAiIirr766x/nnnz9q//33P7JNmzZDUqlUga7Ah5fJZBoqKyv/vnjx4uf+9Kc/zbr33ntX6woAAMCeJwAGAAB4l379+hV97WtfGzRy5MhRPXv2PLaoqKizrsD/VV9fv37VqlXPvPDCC8/9+7//+5zFixfX6woAAMDeJQAGAAB4H61bt8678847Bx599NFHde/efURpaen+4apomq/M1q1bF69Zs+bF5557btY3v/nNOdXV1WltAQAAyB4CYAAAgI9g8ODBrcaOHXvI8OHDD+vevfvw1q1bHxACYXJXprq6+s01a9a88sorr7z8k5/8ZN5rr71Wqy0AAADZSwAMAADwCVx//fX7nHHGGYf169dvePv27Yfm5+e31hWSrLGxsXrjxo2vvvXWWy+PHz/+lR//+McrdQUAACA5BMAAAAC70Je//OUe55xzzvA+ffoM7tix45CioqKuukI2q6+vX7t27doXFy9ePGfixImv3Xvvvat1BQAAILkEwAAAALvRl7/85R6f+cxnBvfr129Qly5dDm/ZsqVAmL2qrq5u7bp16wS+AAAAOUoADAAAsIe0atUq75prrtnn2GOPPXi//fY7uH379oeUlpb2TaVS+brDbpKuqalZtnHjxnlvvfXW3GeffXbef/3Xfy2vra1Naw0AAEBuEgADAADsRQceeGDLq6+++oAhQ4Yc3LNnz4Pbtm17sGuj+biampqqq6qqXi8vL583Z86ceb/85S/nvfjii1t1BgAAoPkQAAMAAGSZoUOHFn/xi1/cf9CgQQf26NHjwHbt2h3YqlWr3qlUKk932CFdU1OzvLKycsHq1asXzJkzZ8Gf//znJTNmzKjWGgAAgOZNAAwAAJAAxx13XNkFF1xw4MEHH3xA165dDywtLd23pKRkn1QqVag7uS2TyTRs27ZtRXV19dJ169YtfOONNxZOmDBh4YQJEzbpDgAAAO8mAAYAAEiw8847r+OJJ57Yp3///vt16dKlT5s2bfZr3bp1v/z8/GLdSZampqaa6urqxZs3b16ybt26pQsXLlzy9NNPL33ooYc26A4AAAAflgAYAAAgx7Rr1y7/kksu6TFkyJCe++67b89OnTr1Kisr61VcXNyzZcuW3VKpVL4u7R2ZTKaprq6uvKamZtWWLVtWVlRUrFy6dOnK2bNnr7r//vvXVFZWNukSAAAAn4QAGAAAoBnp1KlTwec+97luQ4cO7bnPPvv0aNeuXafWrVt3Li4u7tqyZcvORUVFnfLy8lro1MeTTqe319fXr6+rq6uoqalZW11dvb6ysnL9ihUrVr/66qurHnzwwbUVFRWNOgUAAMDuIgAGAADgfznjjDPaH3bYYZ369OnTuUuXLp3Kysral5SUtC0uLu5YVFTUrqioqG2LFi065OfnlzaXnjQ1NW3dvn37xvr6+qr6+vrKmpqaDdu2bavasmXLpnXr1lUsXbp0/Ysvvrh+4sSJlZ4gAAAA9iYBMAAAAB9Lr169CkeNGtXuoIMOatexY8ey9u3bl7Zp06Z1SUlJWXFxcetWrVq1btGiRVlRUVHrwsLC1hGRX1hYWBoR+QUFBSV5eXkFeXl5u/0/LtPpdG06nW5sbGzcFhFNDQ0NW3f83+r6+vrq7du3b6mtra2uqamp3rZtW/XmzZurN23aVL1hw4YtCxYsqJo1a1bl0qVLt5s4AAAASSAABgAAYK/q169fUffu3Vvss88+xSUlJQVv//8LCwtT3bp1+8BTxuXl5VsbGhoyb//vbdu2Na5YsaJmzZo12xcvXlyvwwAAADQn7xcAF2gPAAAAu9vixYvrdwS11boBAAAAu0+eFgAAAAAAAADkBgEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4o0AIAAAAAAACA5GhoLIyCxoaIiEilIpNXGE1v/0wADAAAAAAAAJAghQUN/0x6MxGppvT/5L6ugAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAIb/v5272ZHiusM4/FZ1NUkz9sQwOF4EyZJtpJCwysa5jSy4n1xPEqRIuQFvvfGSgIwBOzGRQAQERnx0d1UW0cgWGvKxsMGvnmfVdc7/1OJsf+oCAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoMY3JP//9K8My551lzpAk293a7QAAAAAAAAD8iIw3r+SL7TpPxuSt4/ibJJuz20QDBgAAAAAAAHhzrJPp6NvHYcyyjLl7dJTPbl/Jp6sPLufSsM+5ec7q5YOrF0OeP/SVaAAAAAAAAIA3weH7u6zfm79dWDIMSw6225w785vsx3XyzasOby5ssz69c4sAAAAAAAAAr9n69C6bC9sT93a7rKdnORin5Otxynzi1JQcfiwCAwAAAAAAALxO69O7HH68TaaT98cp85R8vbp3Nfszv8q0LHn7xMF1sjk/ZzUPmZ/MmWefhAYAAAAAAAD4oayPdjn7223Gn7x6ZrXPnetX8mBKkpv3cufDd/Pufn5FL56SzcVtNheT3dNt8tQlAwAAAAAAAHyv1sm0ySv/9XtsNWZ3I/lHkgzHi7/4XY7WYz5yiwAAAAAAAAA/Ivtcv/3nPEyS1fHa42t5+vNLyX7JoRsCAAAAAAAAePPt1/nbV3/KvePn1Xc371/NYxEYAAAAAAAA4M0yTHk2rvNo2WdzvHZqzN9v/SF3vju3evng/at5fPDLPDu1yuGyZHSVAAAAAAAAAK/XOGe4ueSvZ4e8M8xZbVe5ceuPufvy3Oqkw4+v5emDX+fuuTlLhhwsEYIBAAAAAAAAXpclGR8OuXP0TR4cPM/9z/+SRyfNDf/1TZezOp/87KdjzizJZkhO7edMy/w/nAUAAAAAAADg/zaMWcZkP8/ZLsmLacr2/MV8+cnvs/tP5/4FmLjAq1ifcioAAAAASUVORK5CYII=";function H0($,q,Q){if(typeof $==="string"&&!isNaN(Number($)))$=Number($);if(typeof $==="number"&&$<100)return v0($);if(typeof $==="number"&&$>=100)return $;if(typeof $==="string"&&$.includes("%")){if(q&&q==="X")return Math.round(parseFloat($)/100*Q.width);if(q&&q==="Y")return Math.round(parseFloat($)/100*Q.height);return Math.round(parseFloat($)/100*Q.width)}return 0}function k5($){return $.replace(/[xy]/g,function(q){let Q=Math.random()*16|0;return(q==="x"?Q:Q&3|8).toString(16)})}function k0($){if(typeof $>"u"||$==null)return"";return $.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function v0($){if(typeof $==="number"&&$>100)return $;if(typeof $==="string")$=Number($.replace(/in*/gi,""));return Math.round(L0*$)}function Y0($){let q=Number($)||0;return isNaN(q)?0:Math.round(q*w8)}function S1($){return $=$||0,Math.round(($>360?$-360:$)*60000)}function g7($){let q=$.toString(16);return q.length===1?"0"+q:q}function A7($,q,Q){return(g7($)+g7(q)+g7(Q)).toUpperCase()}function R0($,q){let Q=($||"").replace("#","");if(!j7.test(Q)&&Q!==G2.background1&&Q!==G2.background2&&Q!==G2.text1&&Q!==G2.text2&&Q!==G2.accent1&&Q!==G2.accent2&&Q!==G2.accent3&&Q!==G2.accent4&&Q!==G2.accent5&&Q!==G2.accent6)console.warn(`"${Q}" is not a valid scheme color or hex RGB! "${Q2}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`),Q=Q2;let K=j7.test(Q)?"srgbClr":"schemeClr",J='val="'+(j7.test(Q)?Q.toUpperCase():Q)+'"';return q?`${q}`:``}function fB($,q){let Q="",K=Object.assign(Object.assign({},q),$),J=Math.round(K.size*w8),Z=K.color,G=Math.round(K.opacity*1e5);return Q+=``,Q+=R0(Z,``),Q+="",Q}function B2($){let q="solid",Q="",K="",J="";if($){if(typeof $==="string")Q=$;else{if($.type)q=$.type;if($.color)Q=$.color;if($.alpha)K+=``;if($.transparency)K+=``}switch(q){case"solid":J+=`${R0(Q,K)}`;break;default:J+="";break}}return J}function a2($){return $._rels.length+$._relsChart.length+$._relsMedia.length+1}function b7($){if(!$||typeof $!=="object")return;if($.type!=="outer"&&$.type!=="inner"&&$.type!=="none")console.warn("Warning: shadow.type options are `outer`, `inner` or `none`."),$.type="outer";if($.angle){if(isNaN(Number($.angle))||$.angle<0||$.angle>359)console.warn("Warning: shadow.angle can only be 0-359"),$.angle=270;$.angle=Math.round(Number($.angle))}if($.opacity){if(isNaN(Number($.opacity))||$.opacity<0||$.opacity>1)console.warn("Warning: shadow.opacity can only be 0-1"),$.opacity=0.75;$.opacity=Number($.opacity)}if($.color){if($.color.startsWith("#"))console.warn('Warning: shadow.color should not include hash (#) character, , e.g. "FF0000"'),$.color=$.color.replace("#","")}return $}function RB($,q,Q){var K,J;let Z=2.3+(((K=$.options)===null||K===void 0?void 0:K.autoPageCharWeight)?$.options.autoPageCharWeight:0),G=Math.floor(q/w8*L0)/((((J=$.options)===null||J===void 0?void 0:J.fontSize)?$.options.fontSize:k2)/Z),W=[],B=[],V=[],U=[];if($.text&&$.text.toString().trim().length===0)B.push({_type:D0.tablecell,text:" "});else if(typeof $.text==="number"||typeof $.text==="string")B.push({_type:D0.tablecell,text:($.text||"").toString().trim()});else if(Array.isArray($.text))B=$.text;let w=[];return B.forEach((F)=>{var M;if(typeof F.text==="string"){if(F.text.split(` +`,"\t"],wW=["{","}","|","\\","^","`"].concat(MW),Y7=["'"].concat(wW),yK=["%","/","?",";","#"].concat(Y7),hK=["/","?","#"],xK=/^[+a-z0-9A-Z_-]{0,63}$/,YW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kW={javascript:!0,"javascript:":!0},k7={javascript:!0,"javascript:":!0},k6={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},D7={parse($){var q=decodeURIComponent;return($+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(Q,K,J){var Z=K.split("="),G=q(Z[0]||""),W=q(Z[1]||""),B=Q[G];return Q[G]=B===void 0?W:[].concat(B,W),Q},{})},stringify($){var q=encodeURIComponent;return Object.keys($||{}).reduce(function(Q,K){return[].concat($[K]).forEach(function(J){Q.push(q(K)+"="+q(J))}),Q},[]).join("&").replace(/\s/g,"+")}};Z2.prototype.parse=function($,q,Q){if(!H7($))throw TypeError("Parameter 'url' must be a string, not "+typeof $);var K=$.indexOf("?"),J=K!==-1&&K<$.indexOf("#")?"?":"#",Z=$.split(J),G=/\\/g;Z[0]=Z[0].replace(G,"/"),$=Z.join(J);var W=$;if(W=W.trim(),!Q&&$.split("#").length===1){var B=FW.exec(W);if(B){if(this.path=W,this.href=W,this.pathname=B[1],B[2])if(this.search=B[2],q)this.query=D7.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(q)this.search="",this.query={};return this}}var V=BW.exec(W);if(V){V=V[0];var U=V.toLowerCase();this.protocol=U,W=W.substr(V.length)}if(Q||V||W.match(/^\/\/[^@\/]+@[^@\/]+/)){var w=W.substr(0,2)==="//";if(w&&!(V&&k7[V]))W=W.substr(2),this.slashes=!0}if(!k7[V]&&(w||V&&!k6[V])){var F=-1;for(var M=0;M127)v+="x";else v+=H[j];if(!v.match(xK)){var d=z.slice(0,M),_=z.slice(M+1),X=H.match(YW);if(X)d.push(X[1]),_.unshift(X[2]);if(_.length)W="/"+_.join(".")+W;this.hostname=d.join(".");break}}}}if(this.hostname.length>NW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!D)this.hostname=new L7(`https://${this.hostname}`).hostname;var P=this.port?":"+this.port:"",g=this.hostname||"";if(this.host=g+P,this.href+=this.host,D){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),W[0]!=="/")W="/"+W}}if(!kW[U])for(var M=0,N=Y7.length;M0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(Q.search=$.search,Q.query=$.query,!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.href=Q.format(),Q}if(!z.length){if(Q.pathname=null,Q.search)Q.path="/"+Q.search;else Q.path=null;return Q.href=Q.format(),Q}var j=z.slice(-1)[0],n=(Q.host||$.host||z.length>1)&&(j==="."||j==="..")||j==="",d=0;for(var _=z.length;_>=0;_--)if(j=z[_],j===".")z.splice(_,1);else if(j==="..")z.splice(_,1),d++;else if(d)z.splice(_,1),d--;if(!L&&!D)for(;d--;d)z.unshift("..");if(L&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/"))z.unshift("");if(n&&z.join("/").substr(-1)!=="/")z.push("");var X=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){Q.hostname=Q.host=X?"":z.length?z.shift():"";var v=Q.host&&Q.host.indexOf("@")>0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(L=L||Q.host&&z.length,L&&!X)z.unshift("");if(!z.length)Q.pathname=null,Q.path=null;else Q.pathname=z.join("/");if(!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.auth=$.auth||Q.auth,Q.slashes=Q.slashes||$.slashes,Q.href=Q.format(),Q};Z2.prototype.parseHost=function(){var $=this.host,q=zW.exec($);if(q){if(q=q[0],q!==":")this.port=q.substr(1);$=$.substr(0,$.length-q.length)}if($)this.hostname=$};DW={parse:D6,resolve:uK,resolveObject:SK,format:TK,Url:Z2,URL:L7,URLSearchParams:OK}});var I7={};c1(I7,{request:()=>_W,globalAgent:()=>mW,get:()=>cW,default:()=>oW,STATUS_CODES:()=>pW,METHODS:()=>iW,IncomingMessage:()=>nW,ClientRequest:()=>bW,Agent:()=>dW});function RW($){return this[$]}var LW,HW,EK,vW,fW,IW,CW,jW=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?IW??=new WeakMap:CW??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?LW(HW($)):{};let G=q||!$||!$.__esModule?EK(Q,"default",{value:$,enumerable:!0}):Q;for(let W of vW($))if(!fW.call(G,W))EK(G,W,{get:RW.bind($,W),enumerable:!0});if(K)J.set($,G);return G},h0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),cK,gW,x1,AW,bK,O1,nK,XW,dK,L6,yW,_K,R7,hW,xW,mK,pK,OW,PW,iK,oK,TW,uW,SW,EW,aK,_W,cW,bW,nW,dW,mW,pW,iW,oW;var C7=b1(()=>{LW=Object.create,{getPrototypeOf:HW,defineProperty:EK,getOwnPropertyNames:vW}=Object,fW=Object.prototype.hasOwnProperty;cK=h0(($)=>{$.fetch=J(globalThis.fetch)&&J(globalThis.ReadableStream),$.writableStream=J(globalThis.WritableStream),$.abortController=J(globalThis.AbortController);var q;function Q(){if(q!==void 0)return q;if(globalThis.XMLHttpRequest){q=new globalThis.XMLHttpRequest;try{q.open("GET",globalThis.XDomainRequest?"/":"https://example.com")}catch(Z){q=null}}else q=null;return q}function K(Z){var G=Q();if(!G)return!1;try{return G.responseType=Z,G.responseType===Z}catch(W){}return!1}$.arraybuffer=$.fetch||K("arraybuffer"),$.msstream=!$.fetch&&K("ms-stream"),$.mozchunkedarraybuffer=!$.fetch&&K("moz-chunked-arraybuffer"),$.overrideMimeType=$.fetch||(Q()?J(Q().overrideMimeType):!1);function J(Z){return typeof Z==="function"}q=null}),gW=h0(($,q)=>{if(typeof Object.create==="function")q.exports=function(Q,K){if(K)Q.super_=K,Q.prototype=Object.create(K.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else q.exports=function(Q,K){if(K){Q.super_=K;var J=function(){};J.prototype=K.prototype,Q.prototype=new J,Q.prototype.constructor=Q}}}),x1=h0(($,q)=>{try{if(Q=(G8(),X0(Z8)),typeof Q.inherits!=="function")throw"";q.exports=Q.inherits}catch(K){q.exports=gW()}var Q}),AW=h0(($,q)=>{function Q(L,D){var z=Object.keys(L);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(L);D&&(N=N.filter(function(H){return Object.getOwnPropertyDescriptor(L,H).enumerable})),z.push.apply(z,N)}return z}function K(L){for(var D=1;D0)this.tail.next=z;else this.head=z;this.tail=z,++this.length}},{key:"unshift",value:function(D){var z={data:D,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var D=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,D}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(D){if(this.length===0)return"";var z=this.head,N=""+z.data;while(z=z.next)N+=D+z.data;return N}},{key:"concat",value:function(D){if(this.length===0)return w.alloc(0);var z=w.allocUnsafe(D>>>0),N=this.head,H=0;while(N)f(N.data,z,H),H+=N.data.length,N=N.next;return z}},{key:"consume",value:function(D,z){var N;if(Dv.length?v.length:D;if(j===v.length)H+=v;else H+=v.slice(0,D);if(D-=j,D===0){if(j===v.length)if(++N,z.next)this.head=z.next;else this.head=this.tail=null;else this.head=z,z.data=v.slice(j);break}++N}return this.length-=N,H}},{key:"_getBuffer",value:function(D){var z=w.allocUnsafe(D),N=this.head,H=1;N.data.copy(z),D-=N.data.length;while(N=N.next){var v=N.data,j=D>v.length?v.length:D;if(v.copy(z,z.length-D,0,j),D-=j,D===0){if(j===v.length)if(++H,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=v.slice(j);break}++H}return this.length-=H,z}},{key:k,value:function(D,z){return M(this,K(K({},z),{},{depth:0,customInspect:!1}))}}]),L}()}),bK=h0(($,q)=>{function Q(B,V){var U=this,w=this._readableState&&this._readableState.destroyed,F=this._writableState&&this._writableState.destroyed;if(w||F){if(V)V(B);else if(B){if(!this._writableState)process.nextTick(G,this,B);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,process.nextTick(G,this,B)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(B||null,function(M){if(!V&&M)if(!U._writableState)process.nextTick(K,U,M);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,process.nextTick(K,U,M);else process.nextTick(J,U);else if(V)process.nextTick(J,U),V(M);else process.nextTick(J,U)}),this}function K(B,V){G(B,V),J(B)}function J(B){if(B._writableState&&!B._writableState.emitClose)return;if(B._readableState&&!B._readableState.emitClose)return;B.emit("close")}function Z(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function G(B,V){B.emit("error",V)}function W(B,V){var{_readableState:U,_writableState:w}=B;if(U&&U.autoDestroy||w&&w.autoDestroy)B.destroy(V);else B.emit("error",V)}q.exports={destroy:Q,undestroy:Z,errorOrDestroy:W}}),O1=h0(($,q)=>{var Q={};function K(B,V,U){if(!U)U=Error;function w(M,k,f){if(typeof V==="string")return V;else return V(M,k,f)}class F extends U{constructor(M,k,f){super(w(M,k,f))}}F.prototype.name=U.name,F.prototype.code=B,Q[B]=F}function J(B,V){if(Array.isArray(B)){let U=B.length;if(B=B.map((w)=>String(w)),U>2)return`one of ${V} ${B.slice(0,U-1).join(", ")}, or `+B[U-1];else if(U===2)return`one of ${V} ${B[0]} or ${B[1]}`;else return`of ${V} ${B[0]}`}else return`of ${V} ${String(B)}`}function Z(B,V,U){return B.substr(!U||U<0?0:+U,V.length)===V}function G(B,V,U){if(U===void 0||U>B.length)U=B.length;return B.substring(U-V.length,U)===V}function W(B,V,U){if(typeof U!=="number")U=0;if(U+V.length>B.length)return!1;else return B.indexOf(V,U)!==-1}K("ERR_INVALID_OPT_VALUE",function(B,V){return'The value "'+V+'" is invalid for option "'+B+'"'},TypeError),K("ERR_INVALID_ARG_TYPE",function(B,V,U){let w;if(typeof V==="string"&&Z(V,"not "))w="must not be",V=V.replace(/^not /,"");else w="must be";let F;if(G(B," argument"))F=`The ${B} ${w} ${J(V,"type")}`;else{let M=W(B,".")?"property":"argument";F=`The "${B}" ${M} ${w} ${J(V,"type")}`}return F+=`. Received type ${typeof U}`,F},TypeError),K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),K("ERR_METHOD_NOT_IMPLEMENTED",function(B){return"The "+B+" method is not implemented"}),K("ERR_STREAM_PREMATURE_CLOSE","Premature close"),K("ERR_STREAM_DESTROYED",function(B){return"Cannot call "+B+" after a stream was destroyed"}),K("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),K("ERR_STREAM_WRITE_AFTER_END","write after end"),K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),K("ERR_UNKNOWN_ENCODING",function(B){return"Unknown encoding: "+B},TypeError),K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$.codes=Q}),nK=h0(($,q)=>{var Q=O1().codes.ERR_INVALID_OPT_VALUE;function K(Z,G,W){return Z.highWaterMark!=null?Z.highWaterMark:G?Z[W]:null}function J(Z,G,W,B){var V=K(G,B,W);if(V!=null){if(!(isFinite(V)&&Math.floor(V)===V)||V<0){var U=B?W:"highWaterMark";throw new Q(U,V)}return Math.floor(V)}return Z.objectMode?16:16384}q.exports={getHighWaterMark:J}}),XW=h0(($,q)=>{q.exports=(G8(),X0(Z8)).deprecate}),dK=h0(($,q)=>{q.exports=X;function Q(S){var b=this;this.next=null,this.entry=null,this.finish=function(){w0(b,S)}}var K;X.WritableState=d;var J={deprecate:XW()},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(S){return G.from(S)}function V(S){return G.isBuffer(S)||S instanceof W}var U=bK(),w=nK(),F=w.getHighWaterMark,M=O1().codes,k=M.ERR_INVALID_ARG_TYPE,f=M.ERR_METHOD_NOT_IMPLEMENTED,L=M.ERR_MULTIPLE_CALLBACK,D=M.ERR_STREAM_CANNOT_PIPE,z=M.ERR_STREAM_DESTROYED,N=M.ERR_STREAM_NULL_VALUES,H=M.ERR_STREAM_WRITE_AFTER_END,v=M.ERR_UNKNOWN_ENCODING,j=U.errorOrDestroy;x1()(X,Z);function n(){}function d(S,b,O){if(K=K||L6(),S=S||{},typeof O!=="boolean")O=b instanceof K;if(this.objectMode=!!S.objectMode,O)this.objectMode=this.objectMode||!!S.writableObjectMode;this.highWaterMark=F(this,S,"writableHighWaterMark",O),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var E=S.decodeStrings===!1;this.decodeStrings=!E,this.defaultEncoding=S.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){Z0(b,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=S.emitClose!==!1,this.autoDestroy=!!S.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Q(this)}d.prototype.getBuffer=function(){var S=this.bufferedRequest,b=[];while(S)b.push(S),S=S.next;return b},function(){try{Object.defineProperty(d.prototype,"buffer",{get:J.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(S){}}();var _;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")_=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(S){if(_.call(this,S))return!0;if(this!==X)return!1;return S&&S._writableState instanceof d}});else _=function(S){return S instanceof this};function X(S){K=K||L6();var b=this instanceof K;if(!b&&!_.call(X,this))return new X(S);if(this._writableState=new d(S,this,b),this.writable=!0,S){if(typeof S.write==="function")this._write=S.write;if(typeof S.writev==="function")this._writev=S.writev;if(typeof S.destroy==="function")this._destroy=S.destroy;if(typeof S.final==="function")this._final=S.final}Z.call(this)}X.prototype.pipe=function(){j(this,new D)};function P(S,b){var O=new H;j(S,O),process.nextTick(b,O)}function g(S,b,O,E){var a;if(O===null)a=new N;else if(typeof O!=="string"&&!b.objectMode)a=new k("chunk",["string","Buffer"],O);if(a)return j(S,a),process.nextTick(E,a),!1;return!0}X.prototype.write=function(S,b,O){var E=this._writableState,a=!1,K0=!E.objectMode&&V(S);if(K0&&!G.isBuffer(S))S=B(S);if(typeof b==="function")O=b,b=null;if(K0)b="buffer";else if(!b)b=E.defaultEncoding;if(typeof O!=="function")O=n;if(E.ending)P(this,O);else if(K0||g(this,E,S,O))E.pendingcb++,a=h(this,E,K0,S,b,O);return a},X.prototype.cork=function(){this._writableState.corked++},X.prototype.uncork=function(){var S=this._writableState;if(S.corked){if(S.corked--,!S.writing&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest)W0(this,S)}},X.prototype.setDefaultEncoding=function(S){if(typeof S==="string")S=S.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((S+"").toLowerCase())>-1))throw new v(S);return this._writableState.defaultEncoding=S,this},Object.defineProperty(X.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function c(S,b,O){if(!S.objectMode&&S.decodeStrings!==!1&&typeof b==="string")b=G.from(b,O);return b}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function h(S,b,O,E,a,K0){if(!O){var R=c(b,E,a);if(E!==R)O=!0,a="buffer",E=R}var Y=b.objectMode?1:E.length;b.length+=Y;var C=b.length{var Q=Object.keys||function(w){var F=[];for(var M in w)F.push(M);return F};q.exports=B;var K=mK(),J=dK();x1()(B,K);{Z=Q(J.prototype);for(W=0;W{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),_K=h0(($)=>{var q=yW().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),R7=h0(($,q)=>{var Q=O1().codes.ERR_STREAM_PREMATURE_CLOSE;function K(W){var B=!1;return function(){if(B)return;B=!0;for(var V=arguments.length,U=Array(V),w=0;w{var Q;function K(v,j,n){if(j=J(j),j in v)Object.defineProperty(v,j,{value:n,enumerable:!0,configurable:!0,writable:!0});else v[j]=n;return v}function J(v){var j=Z(v,"string");return typeof j==="symbol"?j:String(j)}function Z(v,j){if(typeof v!=="object"||v===null)return v;var n=v[Symbol.toPrimitive];if(n!==void 0){var d=n.call(v,j||"default");if(typeof d!=="object")return d;throw TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(v)}var G=R7(),W=Symbol("lastResolve"),B=Symbol("lastReject"),V=Symbol("error"),U=Symbol("ended"),w=Symbol("lastPromise"),F=Symbol("handlePromise"),M=Symbol("stream");function k(v,j){return{value:v,done:j}}function f(v){var j=v[W];if(j!==null){var n=v[M].read();if(n!==null)v[w]=null,v[W]=null,v[B]=null,j(k(n,!1))}}function L(v){process.nextTick(f,v)}function D(v,j){return function(n,d){v.then(function(){if(j[U]){n(k(void 0,!0));return}j[F](n,d)},d)}}var z=Object.getPrototypeOf(function(){}),N=Object.setPrototypeOf((Q={get stream(){return this[M]},next:function(){var v=this,j=this[V];if(j!==null)return Promise.reject(j);if(this[U])return Promise.resolve(k(void 0,!0));if(this[M].destroyed)return new Promise(function(X,P){process.nextTick(function(){if(v[V])P(v[V]);else X(k(void 0,!0))})});var n=this[w],d;if(n)d=new Promise(D(n,this));else{var _=this[M].read();if(_!==null)return Promise.resolve(k(_,!1));d=new Promise(this[F])}return this[w]=d,d}},K(Q,Symbol.asyncIterator,function(){return this}),K(Q,"return",function(){var v=this;return new Promise(function(j,n){v[M].destroy(null,function(d){if(d){n(d);return}j(k(void 0,!0))})})}),Q),z),H=function(v){var j,n=Object.create(N,(j={},K(j,M,{value:v,writable:!0}),K(j,W,{value:null,writable:!0}),K(j,B,{value:null,writable:!0}),K(j,V,{value:null,writable:!0}),K(j,U,{value:v._readableState.endEmitted,writable:!0}),K(j,F,{value:function(d,_){var X=n[M].read();if(X)n[w]=null,n[W]=null,n[B]=null,d(k(X,!1));else n[W]=d,n[B]=_},writable:!0}),j));return n[w]=null,G(v,function(d){if(d&&d.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=n[B];if(_!==null)n[w]=null,n[W]=null,n[B]=null,_(d);n[V]=d;return}var X=n[W];if(X!==null)n[w]=null,n[W]=null,n[B]=null,X(k(void 0,!0));n[U]=!0}),v.on("readable",L.bind(null,n)),n};q.exports=H}),xW=h0(($,q)=>{function Q(w,F,M,k,f,L,D){try{var z=w[L](D),N=z.value}catch(H){M(H);return}if(z.done)F(N);else Promise.resolve(N).then(k,f)}function K(w){return function(){var F=this,M=arguments;return new Promise(function(k,f){var L=w.apply(F,M);function D(N){Q(L,k,f,D,z,"next",N)}function z(N){Q(L,k,f,D,z,"throw",N)}D(void 0)})}}function J(w,F){var M=Object.keys(w);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(w);F&&(k=k.filter(function(f){return Object.getOwnPropertyDescriptor(w,f).enumerable})),M.push.apply(M,k)}return M}function Z(w){for(var F=1;F{q.exports=g;var Q;g.ReadableState=P;var K=(i1(),X0(p1)).EventEmitter,J=function(R,Y){return R.listeners(Y).length},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(R){return G.from(R)}function V(R){return G.isBuffer(R)||R instanceof W}var U=(G8(),X0(Z8)),w;if(U&&U.debuglog)w=U.debuglog("stream");else w=function(){};var F=AW(),M=bK(),k=nK(),f=k.getHighWaterMark,L=O1().codes,D=L.ERR_INVALID_ARG_TYPE,z=L.ERR_STREAM_PUSH_AFTER_EOF,N=L.ERR_METHOD_NOT_IMPLEMENTED,H=L.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,j,n;x1()(g,Z);var d=M.errorOrDestroy,_=["error","close","destroy","pause","resume"];function X(R,Y,C){if(typeof R.prependListener==="function")return R.prependListener(Y,C);if(!R._events||!R._events[Y])R.on(Y,C);else if(Array.isArray(R._events[Y]))R._events[Y].unshift(C);else R._events[Y]=[C,R._events[Y]]}function P(R,Y,C){if(Q=Q||L6(),R=R||{},typeof C!=="boolean")C=Y instanceof Q;if(this.objectMode=!!R.objectMode,C)this.objectMode=this.objectMode||!!R.readableObjectMode;if(this.highWaterMark=f(this,R,"readableHighWaterMark",C),this.buffer=new F,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.destroyed=!1,this.defaultEncoding=R.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,R.encoding){if(!v)v=_K().StringDecoder;this.decoder=new v(R.encoding),this.encoding=R.encoding}}function g(R){if(Q=Q||L6(),!(this instanceof g))return new g(R);var Y=this instanceof Q;if(this._readableState=new P(R,this,Y),this.readable=!0,R){if(typeof R.read==="function")this._read=R.read;if(typeof R.destroy==="function")this._destroy=R.destroy}Z.call(this)}Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(R){if(!this._readableState)return;this._readableState.destroyed=R}}),g.prototype.destroy=M.destroy,g.prototype._undestroy=M.undestroy,g.prototype._destroy=function(R,Y){Y(R)},g.prototype.push=function(R,Y){var C=this._readableState,u;if(!C.objectMode){if(typeof R==="string"){if(Y=Y||C.defaultEncoding,Y!==C.encoding)R=G.from(R,Y),Y="";u=!0}}else u=!0;return c(this,R,Y,!1,u)},g.prototype.unshift=function(R){return c(this,R,null,!0,!1)};function c(R,Y,C,u,e){w("readableAddChunk",Y);var r=R._readableState;if(Y===null)r.reading=!1,F0(R,r);else{var s;if(!e)s=x(r,Y);if(s)d(R,s);else if(r.objectMode||Y&&Y.length>0){if(typeof Y!=="string"&&!r.objectMode&&Object.getPrototypeOf(Y)!==G.prototype)Y=B(Y);if(u)if(r.endEmitted)d(R,new H);else h(R,r,Y,!0);else if(r.ended)d(R,new z);else if(r.destroyed)return!1;else if(r.reading=!1,r.decoder&&!C)if(Y=r.decoder.write(Y),r.objectMode||Y.length!==0)h(R,r,Y,!1);else y(R,r);else h(R,r,Y,!1)}else if(!u)r.reading=!1,y(R,r)}return!r.ended&&(r.length=l)R=l;else R--,R|=R>>>1,R|=R>>>2,R|=R>>>4,R|=R>>>8,R|=R>>>16,R++;return R}function Z0(R,Y){if(R<=0||Y.length===0&&Y.ended)return 0;if(Y.objectMode)return 1;if(R!==R)if(Y.flowing&&Y.length)return Y.buffer.head.data.length;else return Y.length;if(R>Y.highWaterMark)Y.highWaterMark=$0(R);if(R<=Y.length)return R;if(!Y.ended)return Y.needReadable=!0,0;return Y.length}g.prototype.read=function(R){w("read",R),R=parseInt(R,10);var Y=this._readableState,C=R;if(R!==0)Y.emittedReadable=!1;if(R===0&&Y.needReadable&&((Y.highWaterMark!==0?Y.length>=Y.highWaterMark:Y.length>0)||Y.ended)){if(w("read: emitReadable",Y.length,Y.ended),Y.length===0&&Y.ended)E(this);else p(this);return null}if(R=Z0(R,Y),R===0&&Y.ended){if(Y.length===0)E(this);return null}var u=Y.needReadable;if(w("need readable",u),Y.length===0||Y.length-R0)e=O(R,Y);else e=null;if(e===null)Y.needReadable=Y.length<=Y.highWaterMark,R=0;else Y.length-=R,Y.awaitDrain=0;if(Y.length===0){if(!Y.ended)Y.needReadable=!0;if(C!==R&&Y.ended)E(this)}if(e!==null)this.emit("data",e);return e};function F0(R,Y){if(w("onEofChunk"),Y.ended)return;if(Y.decoder){var C=Y.decoder.end();if(C&&C.length)Y.buffer.push(C),Y.length+=Y.objectMode?1:C.length}if(Y.ended=!0,Y.sync)p(R);else if(Y.needReadable=!1,!Y.emittedReadable)Y.emittedReadable=!0,W0(R)}function p(R){var Y=R._readableState;if(w("emitReadable",Y.needReadable,Y.emittedReadable),Y.needReadable=!1,!Y.emittedReadable)w("emitReadable",Y.flowing),Y.emittedReadable=!0,process.nextTick(W0,R)}function W0(R){var Y=R._readableState;if(w("emitReadable_",Y.destroyed,Y.length,Y.ended),!Y.destroyed&&(Y.length||Y.ended))R.emit("readable"),Y.emittedReadable=!1;Y.needReadable=!Y.flowing&&!Y.ended&&Y.length<=Y.highWaterMark,b(R)}function y(R,Y){if(!Y.readingMore)Y.readingMore=!0,process.nextTick(i,R,Y)}function i(R,Y){while(!Y.reading&&!Y.ended&&(Y.length1&&K0(u.pipes,R)!==-1)&&!G0)w("false write response, pause",u.awaitDrain),u.awaitDrain++;C.pause()}}function I0(O0){if(w("onerror",O0),q2(),R.removeListener("error",I0),J(R,"error")===0)d(R,O0)}X(R,"error",I0);function m0(){R.removeListener("finish",p0),q2()}R.once("close",m0);function p0(){w("onfinish"),R.removeListener("close",m0),q2()}R.once("finish",p0);function q2(){w("unpipe"),C.unpipe(R)}if(R.emit("pipe",C),!u.flowing)w("pipe resume"),C.resume();return R};function U0(R){return function(){var Y=R._readableState;if(w("pipeOnDrain",Y.awaitDrain),Y.awaitDrain)Y.awaitDrain--;if(Y.awaitDrain===0&&J(R,"data"))Y.flowing=!0,b(R)}}g.prototype.unpipe=function(R){var Y=this._readableState,C={hasUnpiped:!1};if(Y.pipesCount===0)return this;if(Y.pipesCount===1){if(R&&R!==Y.pipes)return this;if(!R)R=Y.pipes;if(Y.pipes=null,Y.pipesCount=0,Y.flowing=!1,R)R.emit("unpipe",this,C);return this}if(!R){var{pipes:u,pipesCount:e}=Y;Y.pipes=null,Y.pipesCount=0,Y.flowing=!1;for(var r=0;r0,u.flowing!==!1)this.resume()}else if(R==="readable"){if(!u.endEmitted&&!u.readableListening){if(u.readableListening=u.needReadable=!0,u.flowing=!1,u.emittedReadable=!1,w("on readable",u.length,u.reading),u.length)p(this);else if(!u.reading)process.nextTick(V0,this)}}return C},g.prototype.addListener=g.prototype.on,g.prototype.removeListener=function(R,Y){var C=Z.prototype.removeListener.call(this,R,Y);if(R==="readable")process.nextTick(m,this);return C},g.prototype.removeAllListeners=function(R){var Y=Z.prototype.removeAllListeners.apply(this,arguments);if(R==="readable"||R===void 0)process.nextTick(m,this);return Y};function m(R){var Y=R._readableState;if(Y.readableListening=R.listenerCount("readable")>0,Y.resumeScheduled&&!Y.paused)Y.flowing=!0;else if(R.listenerCount("data")>0)R.resume()}function V0(R){w("readable nexttick read 0"),R.read(0)}g.prototype.resume=function(){var R=this._readableState;if(!R.flowing)w("resume"),R.flowing=!R.readableListening,w0(this,R);return R.paused=!1,this};function w0(R,Y){if(!Y.resumeScheduled)Y.resumeScheduled=!0,process.nextTick(S,R,Y)}function S(R,Y){if(w("resume",Y.reading),!Y.reading)R.read(0);if(Y.resumeScheduled=!1,R.emit("resume"),b(R),Y.flowing&&!Y.reading)R.read(0)}g.prototype.pause=function(){if(w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)w("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function b(R){var Y=R._readableState;w("flow",Y.flowing);while(Y.flowing&&R.read()!==null);}if(g.prototype.wrap=function(R){var Y=this,C=this._readableState,u=!1;R.on("end",function(){if(w("wrapped end"),C.decoder&&!C.ended){var s=C.decoder.end();if(s&&s.length)Y.push(s)}Y.push(null)}),R.on("data",function(s){if(w("wrapped data"),C.decoder)s=C.decoder.write(s);if(C.objectMode&&(s===null||s===void 0))return;else if(!C.objectMode&&(!s||!s.length))return;var T=Y.push(s);if(!T)u=!0,R.pause()});for(var e in R)if(this[e]===void 0&&typeof R[e]==="function")this[e]=function(s){return function(){return R[s].apply(R,arguments)}}(e);for(var r=0;r<_.length;r++)R.on(_[r],this.emit.bind(this,_[r]));return this._read=function(s){if(w("wrapped _read",s),u)u=!1,R.resume()},this},typeof Symbol==="function")g.prototype[Symbol.asyncIterator]=function(){if(j===void 0)j=hW();return j(this)};Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(g.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(g.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){if(this._readableState)this._readableState.flowing=R}}),g._fromList=O,Object.defineProperty(g.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function O(R,Y){if(Y.length===0)return null;var C;if(Y.objectMode)C=Y.buffer.shift();else if(!R||R>=Y.length){if(Y.decoder)C=Y.buffer.join("");else if(Y.buffer.length===1)C=Y.buffer.first();else C=Y.buffer.concat(Y.length);Y.buffer.clear()}else C=Y.buffer.consume(R,Y.decoder);return C}function E(R){var Y=R._readableState;if(w("endReadable",Y.endEmitted),!Y.endEmitted)Y.ended=!0,process.nextTick(a,Y,R)}function a(R,Y){if(w("endReadableNT",R.endEmitted,R.length),!R.endEmitted&&R.length===0){if(R.endEmitted=!0,Y.readable=!1,Y.emit("end"),R.autoDestroy){var C=Y._writableState;if(!C||C.autoDestroy&&C.finished)Y.destroy()}}}if(typeof Symbol==="function")g.from=function(R,Y){if(n===void 0)n=xW();return n(g,R,Y)};function K0(R,Y){for(var C=0,u=R.length;C{q.exports=V;var Q=O1().codes,K=Q.ERR_METHOD_NOT_IMPLEMENTED,J=Q.ERR_MULTIPLE_CALLBACK,Z=Q.ERR_TRANSFORM_ALREADY_TRANSFORMING,G=Q.ERR_TRANSFORM_WITH_LENGTH_0,W=L6();x1()(V,W);function B(F,M){var k=this._transformState;k.transforming=!1;var f=k.writecb;if(f===null)return this.emit("error",new J);if(k.writechunk=null,k.writecb=null,M!=null)this.push(M);f(F);var L=this._readableState;if(L.reading=!1,L.needReadable||L.length{q.exports=K;var Q=pK();x1()(K,Q);function K(J){if(!(this instanceof K))return new K(J);Q.call(this,J)}K.prototype._transform=function(J,Z,G){G(null,J)}}),PW=h0(($,q)=>{var Q;function K(k){var f=!1;return function(){if(f)return;f=!0,k.apply(void 0,arguments)}}var J=O1().codes,Z=J.ERR_MISSING_ARGS,G=J.ERR_STREAM_DESTROYED;function W(k){if(k)throw k}function B(k){return k.setHeader&&typeof k.abort==="function"}function V(k,f,L,D){D=K(D);var z=!1;if(k.on("close",function(){z=!0}),Q===void 0)Q=R7();Q(k,{readable:f,writable:L},function(H){if(H)return D(H);z=!0,D()});var N=!1;return function(H){if(z)return;if(N)return;if(N=!0,B(k))return k.abort();if(typeof k.destroy==="function")return k.destroy();D(H||new G("pipe"))}}function U(k){k()}function w(k,f){return k.pipe(f)}function F(k){if(!k.length)return W;if(typeof k[k.length-1]!=="function")return W;return k.pop()}function M(){for(var k=arguments.length,f=Array(k),L=0;L0;return V(H,j,n,function(d){if(!z)z=d;if(d)N.forEach(U);if(j)return;N.forEach(U),D(z)})});return f.reduce(w)}q.exports=M}),iK=h0(($,q)=>{var Q=a1();$=q.exports=mK(),$.Stream=Q||$,$.Readable=$,$.Writable=dK(),$.Duplex=L6(),$.Transform=pK(),$.PassThrough=OW(),$.finished=R7(),$.pipeline=PW()}),oK=h0(($)=>{var q=cK(),Q=x1(),K=iK(),J=$.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Z=$.IncomingMessage=function(G,W,B,V){var U=this;if(K.Readable.call(U),U._mode=B,U.headers={},U.rawHeaders=[],U.trailers={},U.rawTrailers=[],U.on("end",function(){process.nextTick(function(){U.emit("close")})}),B==="fetch"){let D=function(){M.read().then(function(z){if(U._destroyed)return;if(V(z.done),z.done){U.push(null);return}U.push(Buffer.from(z.value)),D()}).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)})};var w=D;if(U._fetchResponse=W,U.url=W.url,U.statusCode=W.status,U.statusMessage=W.statusText,W.headers.forEach(function(z,N){U.headers[N.toLowerCase()]=z,U.rawHeaders.push(N,z)}),q.writableStream){var F=new WritableStream({write:function(z){return V(!1),new Promise(function(N,H){if(U._destroyed)H();else if(U.push(Buffer.from(z)))N();else U._resumeFetch=N})},close:function(){if(V(!0),!U._destroyed)U.push(null)},abort:function(z){if(V(!0),!U._destroyed)U.emit("error",z)}});try{W.body.pipeTo(F).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)});return}catch(z){}}var M=W.body.getReader();D()}else{U._xhr=G,U._pos=0,U.url=G.responseURL,U.statusCode=G.status,U.statusMessage=G.statusText;var k=G.getAllResponseHeaders().split(/\r?\n/);if(k.forEach(function(D){var z=D.match(/^([^:]+):\s*(.*)/);if(z){var N=z[1].toLowerCase();if(N==="set-cookie"){if(U.headers[N]===void 0)U.headers[N]=[];U.headers[N].push(z[2])}else if(U.headers[N]!==void 0)U.headers[N]+=", "+z[2];else U.headers[N]=z[2];U.rawHeaders.push(z[1],z[2])}}),U._charset="x-user-defined",!q.overrideMimeType){var f=U.rawHeaders["mime-type"];if(f){var L=f.match(/;\s*charset=([^;])(;|$)/);if(L)U._charset=L[1].toLowerCase()}if(!U._charset)U._charset="utf-8"}}};Q(Z,K.Readable),Z.prototype._read=function(){var G=this,W=G._resumeFetch;if(W)G._resumeFetch=null,W()},Z.prototype._onXHRProgress=function(G){var W=this,B=W._xhr,V=null;switch(W._mode){case"text":if(V=B.responseText,V.length>W._pos){var U=V.substr(W._pos);if(W._charset==="x-user-defined"){var w=Buffer.alloc(U.length);for(var F=0;FW._pos)W.push(Buffer.from(new Uint8Array(M.result.slice(W._pos)))),W._pos=M.result.byteLength},M.onload=function(){G(!0),W.push(null)},M.readAsArrayBuffer(V);break}if(W._xhr.readyState===J.DONE&&W._mode!=="ms-stream")G(!0),W.push(null)}}),TW=h0(($,q)=>{var Q=cK(),K=x1(),J=oK(),Z=iK(),G=J.IncomingMessage,W=J.readyStates;function B(F,M){if(Q.fetch&&M)return"fetch";else if(Q.mozchunkedarraybuffer)return"moz-chunked-arraybuffer";else if(Q.msstream)return"ms-stream";else if(Q.arraybuffer&&F)return"arraybuffer";else return"text"}var V=q.exports=function(F){var M=this;if(Z.Writable.call(M),M._opts=F,M._body=[],M._headers={},F.auth)M.setHeader("Authorization","Basic "+Buffer.from(F.auth).toString("base64"));Object.keys(F.headers).forEach(function(L){M.setHeader(L,F.headers[L])});var k,f=!0;if(F.mode==="disable-fetch"||"requestTimeout"in F&&!Q.abortController)f=!1,k=!0;else if(F.mode==="prefer-streaming")k=!1;else if(F.mode==="allow-wrong-content-type")k=!Q.overrideMimeType;else if(!F.mode||F.mode==="default"||F.mode==="prefer-fast")k=!0;else throw Error("Invalid value for opts.mode");M._mode=B(k,f),M._fetchTimer=null,M._socketTimeout=null,M._socketTimer=null,M.on("finish",function(){M._onFinish()})};K(V,Z.Writable),V.prototype.setHeader=function(F,M){var k=this,f=F.toLowerCase();if(w.indexOf(f)!==-1)return;k._headers[f]={name:F,value:M}},V.prototype.getHeader=function(F){var M=this._headers[F.toLowerCase()];if(M)return M.value;return null},V.prototype.removeHeader=function(F){var M=this;delete M._headers[F.toLowerCase()]},V.prototype._onFinish=function(){var F=this;if(F._destroyed)return;var M=F._opts;if("timeout"in M&&M.timeout!==0)F.setTimeout(M.timeout);var k=F._headers,f=null;if(M.method!=="GET"&&M.method!=="HEAD")f=new Blob(F._body,{type:(k["content-type"]||{}).value||""});var L=[];if(Object.keys(k).forEach(function(H){var v=k[H].name,j=k[H].value;if(Array.isArray(j))j.forEach(function(n){L.push([v,n])});else L.push([v,j])}),F._mode==="fetch"){var D=null;if(Q.abortController){var z=new AbortController;if(D=z.signal,F._fetchAbortController=z,"requestTimeout"in M&&M.requestTimeout!==0)F._fetchTimer=globalThis.setTimeout(function(){if(F.emit("requestTimeout"),F._fetchAbortController)F._fetchAbortController.abort()},M.requestTimeout)}globalThis.fetch(F._opts.url,{method:F._opts.method,headers:L,body:f||void 0,mode:"cors",credentials:M.withCredentials?"include":"same-origin",signal:D}).then(function(H){F._fetchResponse=H,F._resetTimers(!1),F._connect()},function(H){if(F._resetTimers(!0),!F._destroyed)F.emit("error",H)})}else{var N=F._xhr=new globalThis.XMLHttpRequest;try{N.open(F._opts.method,F._opts.url,!0)}catch(H){process.nextTick(function(){F.emit("error",H)});return}if("responseType"in N)N.responseType=F._mode;if("withCredentials"in N)N.withCredentials=!!M.withCredentials;if(F._mode==="text"&&"overrideMimeType"in N)N.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in M)N.timeout=M.requestTimeout,N.ontimeout=function(){F.emit("requestTimeout")};if(L.forEach(function(H){N.setRequestHeader(H[0],H[1])}),F._response=null,N.onreadystatechange=function(){switch(N.readyState){case W.LOADING:case W.DONE:F._onXHRProgress();break}},F._mode==="moz-chunked-arraybuffer")N.onprogress=function(){F._onXHRProgress()};N.onerror=function(){if(F._destroyed)return;F._resetTimers(!0),F.emit("error",Error("XHR error"))};try{N.send(f)}catch(H){process.nextTick(function(){F.emit("error",H)});return}}};function U(F){try{var M=F.status;return M!==null&&M!==0}catch(k){return!1}}V.prototype._onXHRProgress=function(){var F=this;if(F._resetTimers(!1),!U(F._xhr)||F._destroyed)return;if(!F._response)F._connect();F._response._onXHRProgress(F._resetTimers.bind(F))},V.prototype._connect=function(){var F=this;if(F._destroyed)return;F._response=new G(F._xhr,F._fetchResponse,F._mode,F._resetTimers.bind(F)),F._response.on("error",function(M){F.emit("error",M)}),F.emit("response",F._response)},V.prototype._write=function(F,M,k){var f=this;f._body.push(F),k()},V.prototype._resetTimers=function(F){var M=this;if(globalThis.clearTimeout(M._socketTimer),M._socketTimer=null,F)globalThis.clearTimeout(M._fetchTimer),M._fetchTimer=null;else if(M._socketTimeout)M._socketTimer=globalThis.setTimeout(function(){M.emit("timeout")},M._socketTimeout)},V.prototype.abort=V.prototype.destroy=function(F){var M=this;if(M._destroyed=!0,M._resetTimers(!0),M._response)M._response._destroyed=!0;if(M._xhr)M._xhr.abort();else if(M._fetchAbortController)M._fetchAbortController.abort();if(F)M.emit("error",F)},V.prototype.end=function(F,M,k){var f=this;if(typeof F==="function")k=F,F=void 0;Z.Writable.prototype.end.call(f,F,M,k)},V.prototype.setTimeout=function(F,M){var k=this;if(M)k.once("timeout",M);k._socketTimeout=F,k._resetTimers(!1)},V.prototype.flushHeaders=function(){},V.prototype.setNoDelay=function(){},V.prototype.setSocketKeepAlive=function(){};var w=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}),uW=h0(($,q)=>{q.exports=K;var Q=Object.prototype.hasOwnProperty;function K(){var J={};for(var Z=0;Z{q.exports=(C7(),X0(I7)).STATUS_CODES}),EW=h0(($)=>{var q=TW(),Q=oK(),K=uW(),J=SW(),Z=(f7(),X0(v7)),G=$;G.request=function(W,B){if(typeof W==="string")W=Z.parse(W);else W=K(W);var V=globalThis.location.protocol.search(/^https?:$/)===-1?"http:":"",U=W.protocol||V,w=W.hostname||W.host,F=W.port,M=W.path||"/";if(w&&w.indexOf(":")!==-1)w="["+w+"]";W.url=(w?U+"//"+w:"")+(F?":"+F:"")+M,W.method=(W.method||"GET").toUpperCase(),W.headers=W.headers||{};var k=new q(W);if(B)k.on("response",B);return k},G.get=function(W,B){var V=G.request(W,B);return V.end(),V},G.ClientRequest=q,G.IncomingMessage=Q.IncomingMessage,G.Agent=function(){},G.Agent.defaultMaxSockets=4,G.globalAgent=new G.Agent,G.STATUS_CODES=J,G.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}),aK=jW(EW(),1),{request:_W,get:cW,ClientRequest:bW,IncomingMessage:nW,Agent:dW,globalAgent:mW,STATUS_CODES:pW,METHODS:iW}=aK.default,oW=aK.default});var sK={};c1(sK,{validateHeaderValue:()=>LB,validateHeaderName:()=>DB,setMaxIdleHTTPParsers:()=>kB,request:()=>YB,maxHeaderSize:()=>NB,globalAgent:()=>wB,get:()=>MB,default:()=>HB,createServer:()=>FB,ServerResponse:()=>zB,Server:()=>BB,STATUS_CODES:()=>WB,OutgoingMessage:()=>GB,METHODS:()=>ZB,IncomingMessage:()=>UB,ClientRequest:()=>VB,Agent:()=>JB});function tW($){return this[$]}var aW,lW,lK,rW,sW,eW,$B,QB=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?eW??=new WeakMap:$B??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?aW(lW($)):{};let G=q||!$||!$.__esModule?lK(Q,"default",{value:$,enumerable:!0}):Q;for(let W of rW($))if(!sW.call(G,W))lK(G,W,{get:tW.bind($,W),enumerable:!0});if(K)J.set($,G);return G},qB=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),KB,rK,JB,VB,UB,ZB,GB,WB,BB,zB,FB,MB,wB,NB,YB,kB,DB,LB,HB;var tK=b1(()=>{aW=Object.create,{getPrototypeOf:lW,defineProperty:lK,getOwnPropertyNames:rW}=Object,sW=Object.prototype.hasOwnProperty;KB=qB(($,q)=>{var Q=(C7(),X0(I7)),K=(f7(),X0(v7)),J=$;for(Z in Q)if(Q.hasOwnProperty(Z))J[Z]=Q[Z];var Z;J.request=function(W,B){return W=G(W),Q.request.call(this,W,B)},J.get=function(W,B){return W=G(W),Q.get.call(this,W,B)};function G(W){if(typeof W==="string")W=K.parse(W);if(!W.protocol)W.protocol="https:";if(W.protocol!=="https:")throw Error('Protocol "'+W.protocol+'" not supported. Expected "https:"');return W}}),rK=QB(KB(),1),{Agent:JB,ClientRequest:VB,IncomingMessage:UB,METHODS:ZB,OutgoingMessage:GB,STATUS_CODES:WB,Server:BB,ServerResponse:zB,createServer:FB,get:MB,globalAgent:wB,maxHeaderSize:NB,request:YB,setMaxIdleHTTPParsers:kB,validateHeaderName:DB,validateHeaderValue:LB}=rK,HB=rK});var N8=globalThis;if(typeof N8.global>"u")N8.global=globalThis;if(typeof N8.__require>"u")N8.__require=($)=>{throw Error(`Dynamic require of "${$}" is not supported in the sandbox`)};t0();var Fz=J9(h9(),1);var c7=J9(HK(),1);function W2($,q,Q,K){function J(Z){return Z instanceof Q?Z:new Q(function(G){G(Z)})}return new(Q||(Q=Promise))(function(Z,G){function W(U){try{V(K.next(U))}catch(w){G(w)}}function B(U){try{V(K.throw(U))}catch(w){G(w)}}function V(U){U.done?Z(U.value):J(U.value).then(W,B)}V((K=K.apply($,q||[])).next())})}var L0=914400,w8=12700,n0=`\r +`,vB=2147483649,j7=/^[0-9a-fA-F]{6}$/,fB=1.67,RB=27,H6={type:"solid",color:"666666",pt:1},JJ=[0.05,0.1,0.05,0.1],v6={color:"363636",pt:1},u1={color:"888888",style:"solid",size:1,cap:"flat"},Q2="000000",k2=12,IB=18,f6="LAYOUT_16x9",x7="DEFAULT",VJ="333333",P1={type:"outer",blur:3,offset:1.811023622047244,angle:90,color:"000000",opacity:0.35,rotateWithShape:!0},M8=[0.5,0.5,0.5,0.5],eK={color:"000000"},CB={size:8,color:"FFFFFF",opacity:0.75},o2="2094734552",Y5="2094734553",B8="2094734554",O7="2094734555",UJ="2094734556",W8="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),z8=["C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360","C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360"],jB=["5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7","5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7"],R6;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(R6||(R6={}));var I6;(function($){$.b="b",$.ctr="ctr",$.t="t"})(I6||(I6={}));var ZJ="{F7021451-1387-4CA6-816F-3879F97B5CBC}",P7;(function($){$.arraybuffer="arraybuffer",$.base64="base64",$.binarystring="binarystring",$.blob="blob",$.nodebuffer="nodebuffer",$.uint8array="uint8array"})(P7||(P7={}));var T7;(function($){$.area="area",$.bar="bar",$.bar3d="bar3D",$.bubble="bubble",$.bubble3d="bubble3D",$.doughnut="doughnut",$.line="line",$.pie="pie",$.radar="radar",$.scatter="scatter"})(T7||(T7={}));var u7;(function($){$.accentBorderCallout1="accentBorderCallout1",$.accentBorderCallout2="accentBorderCallout2",$.accentBorderCallout3="accentBorderCallout3",$.accentCallout1="accentCallout1",$.accentCallout2="accentCallout2",$.accentCallout3="accentCallout3",$.actionButtonBackPrevious="actionButtonBackPrevious",$.actionButtonBeginning="actionButtonBeginning",$.actionButtonBlank="actionButtonBlank",$.actionButtonDocument="actionButtonDocument",$.actionButtonEnd="actionButtonEnd",$.actionButtonForwardNext="actionButtonForwardNext",$.actionButtonHelp="actionButtonHelp",$.actionButtonHome="actionButtonHome",$.actionButtonInformation="actionButtonInformation",$.actionButtonMovie="actionButtonMovie",$.actionButtonReturn="actionButtonReturn",$.actionButtonSound="actionButtonSound",$.arc="arc",$.bentArrow="bentArrow",$.bentUpArrow="bentUpArrow",$.bevel="bevel",$.blockArc="blockArc",$.borderCallout1="borderCallout1",$.borderCallout2="borderCallout2",$.borderCallout3="borderCallout3",$.bracePair="bracePair",$.bracketPair="bracketPair",$.callout1="callout1",$.callout2="callout2",$.callout3="callout3",$.can="can",$.chartPlus="chartPlus",$.chartStar="chartStar",$.chartX="chartX",$.chevron="chevron",$.chord="chord",$.circularArrow="circularArrow",$.cloud="cloud",$.cloudCallout="cloudCallout",$.corner="corner",$.cornerTabs="cornerTabs",$.cube="cube",$.curvedDownArrow="curvedDownArrow",$.curvedLeftArrow="curvedLeftArrow",$.curvedRightArrow="curvedRightArrow",$.curvedUpArrow="curvedUpArrow",$.custGeom="custGeom",$.decagon="decagon",$.diagStripe="diagStripe",$.diamond="diamond",$.dodecagon="dodecagon",$.donut="donut",$.doubleWave="doubleWave",$.downArrow="downArrow",$.downArrowCallout="downArrowCallout",$.ellipse="ellipse",$.ellipseRibbon="ellipseRibbon",$.ellipseRibbon2="ellipseRibbon2",$.flowChartAlternateProcess="flowChartAlternateProcess",$.flowChartCollate="flowChartCollate",$.flowChartConnector="flowChartConnector",$.flowChartDecision="flowChartDecision",$.flowChartDelay="flowChartDelay",$.flowChartDisplay="flowChartDisplay",$.flowChartDocument="flowChartDocument",$.flowChartExtract="flowChartExtract",$.flowChartInputOutput="flowChartInputOutput",$.flowChartInternalStorage="flowChartInternalStorage",$.flowChartMagneticDisk="flowChartMagneticDisk",$.flowChartMagneticDrum="flowChartMagneticDrum",$.flowChartMagneticTape="flowChartMagneticTape",$.flowChartManualInput="flowChartManualInput",$.flowChartManualOperation="flowChartManualOperation",$.flowChartMerge="flowChartMerge",$.flowChartMultidocument="flowChartMultidocument",$.flowChartOfflineStorage="flowChartOfflineStorage",$.flowChartOffpageConnector="flowChartOffpageConnector",$.flowChartOnlineStorage="flowChartOnlineStorage",$.flowChartOr="flowChartOr",$.flowChartPredefinedProcess="flowChartPredefinedProcess",$.flowChartPreparation="flowChartPreparation",$.flowChartProcess="flowChartProcess",$.flowChartPunchedCard="flowChartPunchedCard",$.flowChartPunchedTape="flowChartPunchedTape",$.flowChartSort="flowChartSort",$.flowChartSummingJunction="flowChartSummingJunction",$.flowChartTerminator="flowChartTerminator",$.folderCorner="folderCorner",$.frame="frame",$.funnel="funnel",$.gear6="gear6",$.gear9="gear9",$.halfFrame="halfFrame",$.heart="heart",$.heptagon="heptagon",$.hexagon="hexagon",$.homePlate="homePlate",$.horizontalScroll="horizontalScroll",$.irregularSeal1="irregularSeal1",$.irregularSeal2="irregularSeal2",$.leftArrow="leftArrow",$.leftArrowCallout="leftArrowCallout",$.leftBrace="leftBrace",$.leftBracket="leftBracket",$.leftCircularArrow="leftCircularArrow",$.leftRightArrow="leftRightArrow",$.leftRightArrowCallout="leftRightArrowCallout",$.leftRightCircularArrow="leftRightCircularArrow",$.leftRightRibbon="leftRightRibbon",$.leftRightUpArrow="leftRightUpArrow",$.leftUpArrow="leftUpArrow",$.lightningBolt="lightningBolt",$.line="line",$.lineInv="lineInv",$.mathDivide="mathDivide",$.mathEqual="mathEqual",$.mathMinus="mathMinus",$.mathMultiply="mathMultiply",$.mathNotEqual="mathNotEqual",$.mathPlus="mathPlus",$.moon="moon",$.noSmoking="noSmoking",$.nonIsoscelesTrapezoid="nonIsoscelesTrapezoid",$.notchedRightArrow="notchedRightArrow",$.octagon="octagon",$.parallelogram="parallelogram",$.pentagon="pentagon",$.pie="pie",$.pieWedge="pieWedge",$.plaque="plaque",$.plaqueTabs="plaqueTabs",$.plus="plus",$.quadArrow="quadArrow",$.quadArrowCallout="quadArrowCallout",$.rect="rect",$.ribbon="ribbon",$.ribbon2="ribbon2",$.rightArrow="rightArrow",$.rightArrowCallout="rightArrowCallout",$.rightBrace="rightBrace",$.rightBracket="rightBracket",$.round1Rect="round1Rect",$.round2DiagRect="round2DiagRect",$.round2SameRect="round2SameRect",$.roundRect="roundRect",$.rtTriangle="rtTriangle",$.smileyFace="smileyFace",$.snip1Rect="snip1Rect",$.snip2DiagRect="snip2DiagRect",$.snip2SameRect="snip2SameRect",$.snipRoundRect="snipRoundRect",$.squareTabs="squareTabs",$.star10="star10",$.star12="star12",$.star16="star16",$.star24="star24",$.star32="star32",$.star4="star4",$.star5="star5",$.star6="star6",$.star7="star7",$.star8="star8",$.stripedRightArrow="stripedRightArrow",$.sun="sun",$.swooshArrow="swooshArrow",$.teardrop="teardrop",$.trapezoid="trapezoid",$.triangle="triangle",$.upArrow="upArrow",$.upArrowCallout="upArrowCallout",$.upDownArrow="upDownArrow",$.upDownArrowCallout="upDownArrowCallout",$.uturnArrow="uturnArrow",$.verticalScroll="verticalScroll",$.wave="wave",$.wedgeEllipseCallout="wedgeEllipseCallout",$.wedgeRectCallout="wedgeRectCallout",$.wedgeRoundRectCallout="wedgeRoundRectCallout"})(u7||(u7={}));var G2;(function($){$.text1="tx1",$.text2="tx2",$.background1="bg1",$.background2="bg2",$.accent1="accent1",$.accent2="accent2",$.accent3="accent3",$.accent4="accent4",$.accent5="accent5",$.accent6="accent6"})(G2||(G2={}));var S7;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(S7||(S7={}));var E7;(function($){$.top="top",$.middle="middle",$.bottom="bottom"})(E7||(E7={}));var B1;(function($){$.ACTION_BUTTON_BACK_OR_PREVIOUS="actionButtonBackPrevious",$.ACTION_BUTTON_BEGINNING="actionButtonBeginning",$.ACTION_BUTTON_CUSTOM="actionButtonBlank",$.ACTION_BUTTON_DOCUMENT="actionButtonDocument",$.ACTION_BUTTON_END="actionButtonEnd",$.ACTION_BUTTON_FORWARD_OR_NEXT="actionButtonForwardNext",$.ACTION_BUTTON_HELP="actionButtonHelp",$.ACTION_BUTTON_HOME="actionButtonHome",$.ACTION_BUTTON_INFORMATION="actionButtonInformation",$.ACTION_BUTTON_MOVIE="actionButtonMovie",$.ACTION_BUTTON_RETURN="actionButtonReturn",$.ACTION_BUTTON_SOUND="actionButtonSound",$.ARC="arc",$.BALLOON="wedgeRoundRectCallout",$.BENT_ARROW="bentArrow",$.BENT_UP_ARROW="bentUpArrow",$.BEVEL="bevel",$.BLOCK_ARC="blockArc",$.CAN="can",$.CHART_PLUS="chartPlus",$.CHART_STAR="chartStar",$.CHART_X="chartX",$.CHEVRON="chevron",$.CHORD="chord",$.CIRCULAR_ARROW="circularArrow",$.CLOUD="cloud",$.CLOUD_CALLOUT="cloudCallout",$.CORNER="corner",$.CORNER_TABS="cornerTabs",$.CROSS="plus",$.CUBE="cube",$.CURVED_DOWN_ARROW="curvedDownArrow",$.CURVED_DOWN_RIBBON="ellipseRibbon",$.CURVED_LEFT_ARROW="curvedLeftArrow",$.CURVED_RIGHT_ARROW="curvedRightArrow",$.CURVED_UP_ARROW="curvedUpArrow",$.CURVED_UP_RIBBON="ellipseRibbon2",$.CUSTOM_GEOMETRY="custGeom",$.DECAGON="decagon",$.DIAGONAL_STRIPE="diagStripe",$.DIAMOND="diamond",$.DODECAGON="dodecagon",$.DONUT="donut",$.DOUBLE_BRACE="bracePair",$.DOUBLE_BRACKET="bracketPair",$.DOUBLE_WAVE="doubleWave",$.DOWN_ARROW="downArrow",$.DOWN_ARROW_CALLOUT="downArrowCallout",$.DOWN_RIBBON="ribbon",$.EXPLOSION1="irregularSeal1",$.EXPLOSION2="irregularSeal2",$.FLOWCHART_ALTERNATE_PROCESS="flowChartAlternateProcess",$.FLOWCHART_CARD="flowChartPunchedCard",$.FLOWCHART_COLLATE="flowChartCollate",$.FLOWCHART_CONNECTOR="flowChartConnector",$.FLOWCHART_DATA="flowChartInputOutput",$.FLOWCHART_DECISION="flowChartDecision",$.FLOWCHART_DELAY="flowChartDelay",$.FLOWCHART_DIRECT_ACCESS_STORAGE="flowChartMagneticDrum",$.FLOWCHART_DISPLAY="flowChartDisplay",$.FLOWCHART_DOCUMENT="flowChartDocument",$.FLOWCHART_EXTRACT="flowChartExtract",$.FLOWCHART_INTERNAL_STORAGE="flowChartInternalStorage",$.FLOWCHART_MAGNETIC_DISK="flowChartMagneticDisk",$.FLOWCHART_MANUAL_INPUT="flowChartManualInput",$.FLOWCHART_MANUAL_OPERATION="flowChartManualOperation",$.FLOWCHART_MERGE="flowChartMerge",$.FLOWCHART_MULTIDOCUMENT="flowChartMultidocument",$.FLOWCHART_OFFLINE_STORAGE="flowChartOfflineStorage",$.FLOWCHART_OFFPAGE_CONNECTOR="flowChartOffpageConnector",$.FLOWCHART_OR="flowChartOr",$.FLOWCHART_PREDEFINED_PROCESS="flowChartPredefinedProcess",$.FLOWCHART_PREPARATION="flowChartPreparation",$.FLOWCHART_PROCESS="flowChartProcess",$.FLOWCHART_PUNCHED_TAPE="flowChartPunchedTape",$.FLOWCHART_SEQUENTIAL_ACCESS_STORAGE="flowChartMagneticTape",$.FLOWCHART_SORT="flowChartSort",$.FLOWCHART_STORED_DATA="flowChartOnlineStorage",$.FLOWCHART_SUMMING_JUNCTION="flowChartSummingJunction",$.FLOWCHART_TERMINATOR="flowChartTerminator",$.FOLDED_CORNER="folderCorner",$.FRAME="frame",$.FUNNEL="funnel",$.GEAR_6="gear6",$.GEAR_9="gear9",$.HALF_FRAME="halfFrame",$.HEART="heart",$.HEPTAGON="heptagon",$.HEXAGON="hexagon",$.HORIZONTAL_SCROLL="horizontalScroll",$.ISOSCELES_TRIANGLE="triangle",$.LEFT_ARROW="leftArrow",$.LEFT_ARROW_CALLOUT="leftArrowCallout",$.LEFT_BRACE="leftBrace",$.LEFT_BRACKET="leftBracket",$.LEFT_CIRCULAR_ARROW="leftCircularArrow",$.LEFT_RIGHT_ARROW="leftRightArrow",$.LEFT_RIGHT_ARROW_CALLOUT="leftRightArrowCallout",$.LEFT_RIGHT_CIRCULAR_ARROW="leftRightCircularArrow",$.LEFT_RIGHT_RIBBON="leftRightRibbon",$.LEFT_RIGHT_UP_ARROW="leftRightUpArrow",$.LEFT_UP_ARROW="leftUpArrow",$.LIGHTNING_BOLT="lightningBolt",$.LINE_CALLOUT_1="borderCallout1",$.LINE_CALLOUT_1_ACCENT_BAR="accentCallout1",$.LINE_CALLOUT_1_BORDER_AND_ACCENT_BAR="accentBorderCallout1",$.LINE_CALLOUT_1_NO_BORDER="callout1",$.LINE_CALLOUT_2="borderCallout2",$.LINE_CALLOUT_2_ACCENT_BAR="accentCallout2",$.LINE_CALLOUT_2_BORDER_AND_ACCENT_BAR="accentBorderCallout2",$.LINE_CALLOUT_2_NO_BORDER="callout2",$.LINE_CALLOUT_3="borderCallout3",$.LINE_CALLOUT_3_ACCENT_BAR="accentCallout3",$.LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR="accentBorderCallout3",$.LINE_CALLOUT_3_NO_BORDER="callout3",$.LINE_CALLOUT_4="borderCallout4",$.LINE_CALLOUT_4_ACCENT_BAR="accentCallout3=4",$.LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR="accentBorderCallout4",$.LINE_CALLOUT_4_NO_BORDER="callout4",$.LINE="line",$.LINE_INVERSE="lineInv",$.MATH_DIVIDE="mathDivide",$.MATH_EQUAL="mathEqual",$.MATH_MINUS="mathMinus",$.MATH_MULTIPLY="mathMultiply",$.MATH_NOT_EQUAL="mathNotEqual",$.MATH_PLUS="mathPlus",$.MOON="moon",$.NON_ISOSCELES_TRAPEZOID="nonIsoscelesTrapezoid",$.NOTCHED_RIGHT_ARROW="notchedRightArrow",$.NO_SYMBOL="noSmoking",$.OCTAGON="octagon",$.OVAL="ellipse",$.OVAL_CALLOUT="wedgeEllipseCallout",$.PARALLELOGRAM="parallelogram",$.PENTAGON="homePlate",$.PIE="pie",$.PIE_WEDGE="pieWedge",$.PLAQUE="plaque",$.PLAQUE_TABS="plaqueTabs",$.QUAD_ARROW="quadArrow",$.QUAD_ARROW_CALLOUT="quadArrowCallout",$.RECTANGLE="rect",$.RECTANGULAR_CALLOUT="wedgeRectCallout",$.REGULAR_PENTAGON="pentagon",$.RIGHT_ARROW="rightArrow",$.RIGHT_ARROW_CALLOUT="rightArrowCallout",$.RIGHT_BRACE="rightBrace",$.RIGHT_BRACKET="rightBracket",$.RIGHT_TRIANGLE="rtTriangle",$.ROUNDED_RECTANGLE="roundRect",$.ROUNDED_RECTANGULAR_CALLOUT="wedgeRoundRectCallout",$.ROUND_1_RECTANGLE="round1Rect",$.ROUND_2_DIAG_RECTANGLE="round2DiagRect",$.ROUND_2_SAME_RECTANGLE="round2SameRect",$.SMILEY_FACE="smileyFace",$.SNIP_1_RECTANGLE="snip1Rect",$.SNIP_2_DIAG_RECTANGLE="snip2DiagRect",$.SNIP_2_SAME_RECTANGLE="snip2SameRect",$.SNIP_ROUND_RECTANGLE="snipRoundRect",$.SQUARE_TABS="squareTabs",$.STAR_10_POINT="star10",$.STAR_12_POINT="star12",$.STAR_16_POINT="star16",$.STAR_24_POINT="star24",$.STAR_32_POINT="star32",$.STAR_4_POINT="star4",$.STAR_5_POINT="star5",$.STAR_6_POINT="star6",$.STAR_7_POINT="star7",$.STAR_8_POINT="star8",$.STRIPED_RIGHT_ARROW="stripedRightArrow",$.SUN="sun",$.SWOOSH_ARROW="swooshArrow",$.TEAR="teardrop",$.TRAPEZOID="trapezoid",$.UP_ARROW="upArrow",$.UP_ARROW_CALLOUT="upArrowCallout",$.UP_DOWN_ARROW="upDownArrow",$.UP_DOWN_ARROW_CALLOUT="upDownArrowCallout",$.UP_RIBBON="ribbon2",$.U_TURN_ARROW="uturnArrow",$.VERTICAL_SCROLL="verticalScroll",$.WAVE="wave"})(B1||(B1={}));var q0;(function($){$.AREA="area",$.BAR="bar",$.BAR3D="bar3D",$.BUBBLE="bubble",$.BUBBLE3D="bubble3D",$.DOUGHNUT="doughnut",$.LINE="line",$.PIE="pie",$.RADAR="radar",$.SCATTER="scatter"})(q0||(q0={}));var L5;(function($){$.TEXT1="tx1",$.TEXT2="tx2",$.BACKGROUND1="bg1",$.BACKGROUND2="bg2",$.ACCENT1="accent1",$.ACCENT2="accent2",$.ACCENT3="accent3",$.ACCENT4="accent4",$.ACCENT5="accent5",$.ACCENT6="accent6"})(L5||(L5={}));var W1;(function($){$.chart="chart",$.image="image",$.line="line",$.rect="rect",$.text="text",$.placeholder="placeholder"})(W1||(W1={}));var D0;(function($){$.chart="chart",$.hyperlink="hyperlink",$.image="image",$.media="media",$.online="online",$.placeholder="placeholder",$.table="table",$.tablecell="tablecell",$.text="text",$.notes="notes"})(D0||(D0={}));var F8;(function($){$.title="title",$.body="body",$.image="pic",$.chart="chart",$.table="tbl",$.media="media"})(F8||(F8={}));var C6;(function($){$.DEFAULT="•",$.CHECK="✓",$.STAR="★",$.TRIANGLE="▶"})(C6||(C6={}));var j6="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOVhAAAGAUlEQVR4Xu2dT0xcRRzHf7tAYSsc0EBSIq2xEg8mtTGebVzEqOVIolz0siRE4gGTStqKwdpWsXoyGhMuyAVJOHBgqyvLNgonDkabeCBYW/8kTUr0wsJC+Wfm0bfuvn37Znbem9mR9303mJnf/Pb7ed95M7PDI5JIJPYJV5EC7e3t1N/fT62trdqViQCIu+bVgpIHEo/Hqbe3V/sdYVKHyWSSZmZm8ilVA0oeyNjYmEnaVC2Xvr6+qg5fAOJAz4DU1dURGzFSqZRVqtMpAFIGyMjICC0vL9PExIRWKADiAYTNshYWFrRCARAOEFZcCKWtrY0GBgaUTYkBRACIE4rKZwqACALR5RQAqQCIDqcASIVAVDsFQCSAqHQKgEgCUeUUAPEBRIVTAMQnEBvK5OQkbW9vk991CoAEAMQJxc86BUACAhKUUwAkQCBBOAVAAgbi1ykAogCIH6cAiCIgsk4BEIVAZJwCIIqBVLqiBxANQFgXS0tLND4+zl08AogmIG5OSSQS1gGKwgtANAIRcQqAaAbCe6YASBWA2E6xDyeyDUl7+AKQMkDYYevm5mZHabA/Li4uUiaTsYLau8QA4gLE/hU7wajyYtv1hReDAiAOxQcHBymbzark4BkbQKom/X8dp9Npmpqasn4BIAYAYSnYp+4BBEAMUcCwNOCQsAKZnp62NtQOw8WmwT09PUo+ijaHsOMx7GppaaH6+nolH0Z10K2tLVpdXbW6UfV3mNqBdHd3U1NTk2rtlMRfW1uj2dlZAFGirkRQAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAGHqrm8caPzQ0WC1logbeiC7X3xJm0PvUmRzh45cuki1588FAmVn9BO6P3yF9utrqGH0MtW82S8UN9RA9v/4k7InjhcJFTs/TLVXLwmJV67S7vD7tHF5pKi46fYdosdOcOOGG8j1OcqefbFEJD9Q3GCwDhqT31HklS4A8VRgfYM2Op6k3bt/BQJl58J7lPvwg5JYNccepaMry0LPqFA7hCm39+NNyp2J0172b19QysGINj5CsRtpij57musOViH0QPJQXn6J9u7dlYJSFkbrMYolrwvDAJAC+WWdEpQz7FTgECeUCpzi6YxvvqXoM6eEhqnCSgDikEzUKUE7Aw7xuHctKB5OYU3dZlNR9syQdAaAcAYTC0pXF+39c09o2Ik+3EqxVKqiB7hbYAxZkk4pbBaEM+AQofv+wTrFwylBOQNABIGwavdfe4O2pg5elO+86l99nY58/VUF0byrYsjiSFluNlXYrOHcBar7+EogUADEQ0YRGHbzoKAASBkg2+9cpM1rV0tK2QOcXW7bLEFAARAXIF4w2DrDWoeUWaf4hQIgDiA8GPZ2iNfi0Q8UACkAIgrDbrJ385eDxaPLLrEsFAB5oG6lMPJQPLZZZKAACBGVhcG2Q+bmuLu2nk55e4jqPv1IeEoceiBeX7s2zCa5MAqdstl91vfXwaEGsv/rb5TtOFk6tWXOuJGh6KmnhO9sayrMninPx103JBtXblHkice58cINZP4Hyr5wpkgkdiChEmc4FWazLzenNKa/p0jncwDiqcD6BuWePk07t1asatZGoYQzSqA4nFJ7soNiP/+EUyfc25GI2GG53dHPrKo1g/1Cw4pIXLrzO+1c+/wg7tBbFDle/EbQcjFCPWQJCau5EoBoFpzXHYDwFNJcDiCaBed1ByA8hTSXA4hmwXndAQhPIc3lAKJZcF53AMJTSHM5gGgWnNcdgPAU0lwOIJoF53UHIDyFNJcfSiCdnZ0Ui8U0SxlMd7lcjubn561gh+Y1scFIU/0o/3sgeLO12E2k7UXKYumgFoAYdg8ACIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6ZQ4JB6PKzviYthnNy4d9h+1M5mMlVckkUjsG5dhiBMCEMPg/wuOfrZZ/RSywQAAAABJRU5ErkJggg==",gB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB4AAAAVnCAYAAACzfHDVAAAAYHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjaVcjJDYAwDEXBu6ughBfH+YnLQSwSHVA+Yrkwx7HtPHabHuEWrQ+lBBAZ6TMweBWoCwUH8quZH6VWFXVT696zxp12ARkVFEqn8wB8AAAACXBIWXMAAC4jAAAuIwF4pT92AADZLklEQVR42uzdd5hV9Z0/8M+dmcsUZmDovYOhKCiKYhR7JJuoSTCWGFI0WUxijBoTTXazVlyza4maYm9rTRSJigVsqCDNQhHBAogKCEgRMjMMU+7vj93sL8kqClLmnPt6PY+PeXZM9vP9vO8jZ+Y955xMfJLjorBrRMuSgmiViyjN1Ee2oSCyucbIBAAAAAAAAADbXaYgcoWNUZcrirpMbdRsysa69wbF+rggGrf439vSF7seF12aFUTnxvoosGIAAAAAAACAXacgoqEgF++/VRgr4r5o+Kh/pvD//F8uiII+LaPrum/EXzqui2b1ddHGKgEAAAAAAAB2rVxEQWMmWrQtjHZlA6N2w2tR84//zP8pgHu3ib6NBdG+zdqorK6KVUXZaB85j3sGAAAAAAAAaAoaG6OwIBdtyneP2PBabPzbr/1dAdx3VHRtyESHiIhcYzQrLo7WmVzkcjmPgAYAAAAAAABoSgpy0eIfS+D/LYD7fy3abC6Inn/7X2hsjELlLwAAAAAAAEDT9D8lcM1fHwddFBFxyAVR9M686PVp/gfqayKiJiLqLBMAAAAAAABgh8hGRGlEUekn/6PFEb3ikNgQk6O+KCJi6dzoksv83/cB/1X9xoiaJdmoWxlRV1dk2QAAAAAAAAA7QTZbH9muERX96v7n9t7/q6Exinq3i86LI94pjOOisHUu+uYykfmof7h+Y8Sa6aVRt74gGhs9DRoAAAAAAABgZ2lsLIi69QWxeUUmSjs0/vedwR8hk4uydSfE+wVd6qOyMfMx7/mtj9jwUtbjngEAAAAAAAB2obrqolg7IxtR/9Ffb4wo7P5GtCwobRaVH/c/UvNmNuqqPfIZAAAAAAAAYFerqy6KmjezH/v1ktpoVZBr/PgCeMN7yl8AAAAAAACApmJLHW5jUVQWNDSP+Q3ZeLco4i9/+8X6teHRzwAAAAAAAABNSd3/dLn/oLAoqqIuVhXFxhhSGB/xqGjlLwAAAAAAAECTU1eTjaK/KXSLIv7SWB+bc5ko9YxnAAAAAAAAgATJFv393bz1EeV//c8F1gMAAAAAAACQDgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKREkRUAAACwrUpLSwuGDRvWfMCAAS26du3avKysrLiioqKkZcuWzZs1a1bcvHnz0tLS0rJsNtusuLi4ebNmzUoLCgo+8/eijY2N9Zs3b66pra2tqqur21xTU1NdVVVVs2nTptqNGzdWbdiwoeYvf/nL5hUrVlQtWLBgw6xZs6pqamoaJQYAAEDaKYABAACIiIghQ4aUHnTQQW379u3bql27dq3at2/fpkWLFq2bN29eWVpa2qpZs2bNCwsLm2ez2fLCwsLyoqKi8sLCwtKknK+hoaG6vr6+qqGh4S91dXV/aWhoqNq8eXNVTU3NuqqqqvUbNmxYu2rVqjWrV69e99Zbb6177rnnPpgzZ06NTwYAAABJogAGAADIA8OGDWt+xBFHdBwwYECnLl26dGjdunXHFi1adCgtLe1YUlLSvlmzZq0KCgqK07yDwsLCssLCwrKIaPdp/zuNjY21mzdvXrdp06ZVNTU172/YsGHl2rVr31+2bNnKBQsWrHjyySffnzVrVpVPGAAAAE1Fpuexsd9HfaF+ZcSal0ptCAAAIAE6deqUPf744zvtueeeXbp3796lbdu2XSorKzuXlpZ2KS0t7VBYWFhhSztGQ0PDxpqampU1NTXL169fv+yDDz5Y9s477yybPXv2sj/96U8rVqxYUWdLAAAAbE9t9q6Jog4f/TUFMAAAQEJks9nMt7/97Y4jRozo1bdv397t2rXrXl5e3rWsrKxzcXFx+4gosKUmp7G2tnZVTU3Nso0bNy5btWrV0tdff/2tJ598cvG999672noAAADYFgpgAACAhPne977X6a9Fb/v27Xu1bNmyV1lZWa8kvXOXLauvr9/wl7/8ZdG6desWL1u2bNHChQsX/fGPf1w8derUjbYDAADAliiAAQAAmqhsNps59dRTuxx66KH9+/Tp87n27dv3Ly8v719UVOSRzXlq06ZNKzZu3Pj6+++//8abb775xqOPPvrG3XffvcpmAAAA+CsFMAAAQBNx6qmndvniF784qHfv3v3btWv3uYqKis8VFhaW2wxbUl9fv37Dhg1vfPDBB68vXrz4jccee2z+jTfeuNxmAAAA8pMCGAAAYBc45phjWn/rW9/aq3///kPatGnTv6Kiop9HOLO9NDQ0VG/cuPGtNWvWLFy4cOGcO+6445WHHnporc0AAACknwIYAABgJzjjjDO6f+lLX9qrV69eg1u3bj2orKysR0RkbIadJFddXb103bp18xcvXjz30UcffeXqq69+x1oAAADSRwEMAACwnZWWlhb86le/2u3QQw8d1r17931btmw5qLCwsMxmaEoaGhqqP/zww/nvvPPOzGeeeWbW2LFj36ipqWm0GQAAgGRTAAMAAGwHP/7xj7t+9atf3bdXr15D27Ztu1c2m21jKyRJXV3dmg8++OCVRYsWvfznP/95xh/+8IdltgIAAJA8CmAAAIBtcOKJJ7Y75ZRTDujXr9+w1q1bD81ms61shTSpq6tbt3bt2pfffPPNWbfccsvUe++9d7WtAAAANH0KYAAAgE+hoqKi4IILLhg0YsSI/bp27bpfy5YtB2YymUKbIR/kcrmGDz/8cP6777474/nnn59x4YUXvrZx40aPiwYAAGiCFMAAAAAf4/jjj2/7/e9//8D+/fsf2Lp1630KCgpKbAUiGhsbN61fv37eW2+9NeWGG2545u67715lKwAAAE2DAhgAAOB/ZLPZzAUXXPC5I4888sDu3bsfWFFRsVtEFNgMbFl1dfWSd999d8qsWbNmnnvuuS+vW7euwVYAAAB2DQUwAACQ10pLSwsuvfTSQYcccsjBXbt2HVFWVtbDVmDb1dbWrnr//fdfmDp16uRf/vKXL65evbreVgAAAHYeBTAAAJB3Bg0aVHrBBRd8fs899zywQ4cOBxQVFbWwFdj+Ghsba9euXTtrzpw5T59//vmTX3755WpbAQAA2LEUwAAAQF4YNmxY8/POO+/gIUOGHOZ9vrDz/W0ZfNFFFz07a9asKlsBAADY/hTAAABAarVq1arwyiuv3HfEiBEjO3TocFBhYWGZrcCu19DQUP3+++8/O2XKlIk/+clPZm7cuLHRVgAAALYPBTAAAJAqrVq1Kvztb3+7/3777Xd4x44dRxQWFpbbCjRdDQ0NG99///0pM2bMeOqHP/zhC8pgAACAz0YBDAAApMJZZ53V45vf/OaRvXr1GllaWtrVRiB5ampq3l28ePHEO++8c9LVV1/9jo0AAABsPQUwAACQWMOHDy+/6KKLvjB48OCjW7RoMdBGID0+/PDDV+fNmzfhvPPOe3L69Ol/sREAAIBPRwEMAAAkSqtWrQpvuOGGQ/bbb79/atOmzX6ZTCZrK5BeuVyubs2aNTNmzJjx2JgxYyavW7euwVYAAAA+ngIYAABIhB//+Mddv/e9732lZ8+e/1RcXNzWRiD/1NbWfvD2228/dssttzz029/+9l0bAQAA+L8UwAAAQJNVUVFRcO21137+4IMPPrZ169b7ZTKZAlsBIqJxzZo1M59//vnxp5122hR3BQMAAPx/CmAAAKDJOeWUUzqefvrpx/bu3ftL2Wy2jY0AH6e+vn7j0qVLH/vd7373x+uvv36ZjQAAAPlOAQwAADQJ2Ww2c+uttx5wyCGHnNC6deu9I8LdvsDWaFy7du1L06ZN+/OPfvSjZ1evXl1vJQAAQD5SAAMAALtU//79S6655pp/2nPPPY8tLy/vayPAZ1VTU7NswYIF488999wHp06dutFGAACAfKIABgAAdomf//znPU855ZQTu3btemRhYWGZjQDbW2NjY92KFSuevOWWW+689NJLF9kIAACQDxTAAADATuMxz8Cusn79+rlPP/30f5188slT6+rqcjYCAACklQIYAADY4fr27Vv8hz/84a+Pee5nI8CuUlNT8+68efPu/8EPfvDgwoULN9kIAACQNgpgAABghxkyZEjpNddc89XBgwefWFxc3MFGgKaitrZ21dy5c+/5yU9+8uc5c+bU2AgAAJAWWyqAPYoNAADYJqNHj+4wb968n06ZMuXRYcOGnaH8BZqa4uLi9sOGDTtjypQpj86bN++nJ510UntbAQAA0s4dwAAAwFY599xze33/+9//dufOnY/IZDJZGwGSIpfL1S1fvvzJG2644fbLLrvsbRsBAACSyiOgAQCAz+y8887r+53vfOfbHTt2PDyTyRTaCJBUuVyuYcWKFU/cdNNN//XrX/96sY0AAABJowAGAAC22WWXXTboG9/4xg9at249zDaAtFm7du2su++++9pzzjnnNdsAAACSQgEMAABsNcUvkE8UwQAAQJIogAEAgE9N8Qvks7Vr18665557rvv5z38+3zYAAICmaksFcGHlwOj6UV9orIqoWZG1PQAAyBO/+MUvet9xxx3nHHrooT8pLS3tYiNAPiotLe2y7777HvP973+/X1lZ2ZIpU6assxUAAKCpKetcHwXlH/01BTAAAOS5M844o/u99957zpe//OWflZeX94qIjK0AeS5TXl7e8+CDDx71/e9/v3dEvDVjxowPrQUAAGgqFMAAAMD/ceKJJ7a77777fjJq1Kh/KS8v7xOKX4B/lCkvL+99+OGHj/rWt77VfvXq1Qvnz59fbS0AAMCutqUC2DuAAQAgzwwdOrTs+uuvP6l///4nFRYWltkI20NjY2Ns2rQpqquro6amJurr62PTpk2xefPmqK+vj+rq6qivr4/NmzfHpk2boqGhYZv/fxUWFkZJSUk0a9YsioqKoqysLIqKiqJZs2ZRUlISRUVFUVpa+r9/FRQUCIjtoqGhoeq11167a8yYMffMmTOnxkYAAIBdZUvvAFYAAwBAnujUqVP2nnvuGbXXXnudnM1mK22Ej9PQ0BAbN26MDRs2/J+/Nm7cGBs3boyamprYtGlTbNq0KWpqaqK2trbJnqe4uDhKSkqitLT0f/9eUVERFRUV0aJFi//zV0VFRRQWFvog8LHq6urWvvjii7eceOKJf169enW9jQAAADubAhgAAPLcXXfdddAXv/jF00tLS7vZRn7L5XKxYcOGWLt2baxbty7Wrl37d3+tW7cuNmzYkPd7atGiRbRu3TpatWoVrVu3jjZt2vzvf27dunW0aNHCh4morq5e+sgjj1zzne98Z6ptAAAAO5MCGAAA8tTVV189+MQTTzyzoqJioG3kj8bGxli5cmUsX748Pvjgg1i9evX//n3t2rXR2NhoSZ9RYWFhtGrVKtq1axdt27b937937tw5OnTo4LHTeWbDhg3z77333qvOPPPMebYBAADsDApgAADIM1/72tfaXHrppad27979qIjQRKVUQ0NDrFq1KlasWBHvv//+//595cqVTfqRzGlXXFwcHTp0iI4dO0bnzp2jY8eO0alTp2jXrp1HS6dYLpdrfOeddx76+c9/fv2ECRPW2QgAALAjKYABACBP9OrVq9ldd931jT322OM7hYWFZTaSHh9++GG88847sXTp0njvvfdixYoVsXr16mhoaLCchCgsLIz27dtHp06dolu3btG9e/fo3r27x0mnTENDQ9W8efNu++Y3v/nHJUuWbLYRAABgR1AAAwBAHrjrrrtG/NM//dOZJSUlXWwj2davXx9Lly6Nd955539L3w8//NBiUqqysvJ/y+C//tWqVSuLSbiamppljz322G9Gjx49xTYAAIDtTQEMAAAp9qtf/arPD3/4w5+1atVqL9tIno0bN8aSJUvirbfeikWLFsV7770XmzZtspg8V1JSEl27do0+ffpE3759o3fv3lFeXm4xCbRu3bqXr7322ivGjh27yDYAAIDtRQEMAAApNGjQoNI77rjju7vttttJBQUFWRtJhtWrV8ebb74ZixcvjiVLlsTy5cujsbHRYtiigoKC6Ny5c/Tu3Tt69+4d/fr1i7Zt21pMQjQ2Nta98cYbd33rW9+6ff78+TU2AgAAfFYKYAAASJHS0tKCBx988Jj99tvvn7PZbBsbaboaGhri7bffjrfeeisWLFgQS5YscXcv201FRUX06tUr+vbtG3379o2ePXtGYWGhxTRhdXV1a2bMmHHjV77ylYdqamr85gcAALDNFMAAAJASp59+erdf/vKX51ZWVu5jG03T6tWr47XXXouFCxfGm2++GRs3brQUdooWLVpE3759Y8CAATFw4EB3CDdh69evf/E//uM//vPqq69+xzYAAIBtoQAGAICEGzRoUOm99977w969ex+byWTc4teErF+/PubNmxcLFiyIN954Q+FLk9GiRYvo169fDBgwIPbYY4+orKy0lCYkl8s1LF68eNyJJ554rcdCAwAAW0sBDAAACXbNNdcMOemkk35RVlbWyzZ2vVwuF++++27MnTs3XnvttViyZIl3+NLkFRQURK9evWLQoEExePDg6Natm6U0EdXV1UvuvvvuX//kJz+ZYxsAAMCnpQAGAIAEOuqoo1r99re//VmHDh0Ot41da9OmTTF79uyYO3duLFy4MKqqqiyFRGvevHn0798/Bg8eHHvuuWeUlJRYyi62cuXKp04//fTLJ0yYsM42AACAT6IABgCAhBk3btwRRxxxxFnZbLaNbewaVVVVMXfu3Jg7d27Mnz8/amtrLYVUKi4ujoEDB8bgwYNj8ODBUV5ebim7SF1d3ZqnnnrqqlGjRj1hGwAAwJYogAEAICFOOeWUjhdddNEvW7duvZ9t7HwrV66MWbNmxdy5c+Odd96JXC5nKeSdzp07x9577x3Dhg2LDh06WMgusHbt2hnnnXfepbfccsv7tgEAAHwUBTAAADRxpaWlBU899dQ3Bw8e/L2CggLPYt2JVqxYES+99FK89NJLsXz5cguBv/HXMnjvvfeOTp06WchO1NjYuGnu3Lk3H3744XfV1NR40TgAAPB3FMAAANCEjR49usOll176yzZt2gy3jZ1j/fr18eKLL8bMmTNj6dKlFgKfQs+ePWPfffeNYcOGRYsWLSxkJ1mzZs0L55577q/vvvvuVbYBAAD8lQIYAACaoIqKioKJEyd+c/Dgwd8vKCgotpEda8OGDfHiiy/G9OnTlb7wGfXo0SOGDx8ew4YNi4qKCgvZwdwNDAAA/CMFMAAANDGnnHJKx7Fjx/5rZWXlMNvYcerr6+PVV1+NGTNmxLx586Kurs5SYDvKZrMxZMiQ2HfffWP33XePwsJCS9mB1q5dO+MXv/jFv995550rbQMAAPKbAhgAAJqIbDabeeKJJ47fZ599fuSu3x0jl8vFwoULY/r06TF79uzYtGmTpcBOUFpaGkOGDInhw4fHgAEDLGQHaWhoqJ42bdo1Rx555J9tAwAA8pcCGAAAmoDjjz++7ZVXXvmr1q1be9fvDrBmzZqYNm1azJw5M1audHMc7EodO3aMz3/+87H//vt7X/CO+3fetDPPPPOScePGfWAbAACQfxTAAACwi9100037HXvssf9WXFzc1ja2n1wuF6+99lo8//zzMW/evKivr7cUaEKKiopizz33jBEjRsTnPve5yGQylrId1dbWrvrjH/948Q9+8INZtgEAAPlFAQwAALvIkCFDSu+///5zunTp8k+2sf2sXbs2Jk+eHNOnT48PP/zQQiABKisrY8SIEXHIIYdEeXm5hWxHy5Yte+zrX//6f86ZM6fGNgAAID9sqQAurBwYXT/qC41VETUrsrYHAADb6IILLtjt97///VVt2rQZZhvbx+LFi2P8+PFx9913xxtvvBG1tbWWAgmxadOmeOONN+LZZ5+NtWvXRps2bTweejtp0aJFv5NOOumg0tLSuc8+++xaGwEAgPQr61wfBR/zu7XuAAYAgO0sm81mJk2a9PVhw4b9pKCgwG9VfkZ1dXUxY8aMeOaZZ+K9996zEEiRfv36xSGHHBJDhw6NgoICC/mMGhsbN8+YMeOaL37xi+Pq6upyNgIAAOnlEdAAALCTHH/88W2vuuqqCyorK/exjc9mzZo18dRTT8XUqVNj06ZNFgIpVlFREZ///OfjsMMOi8rKSgv5jNavXz/r9NNPv3DcuHEf2AYAAKSTAhgAAHaC22677fNf+9rXzstms5W2se0WLVoUjz/+eMybNy9yOTewQT4pKiqKIUOGxBFHHBG9e/e2kM+grq5u3QMPPHDRySefPM02AAAgfRTAAACwA1VUVBQ8/fTTpwwcOPCUTCbjGabbIJfLxauvvhpPPvlkLFy40EIgz2UymRgwYEAcccQRMWjQIAvZ9n+3Ns6fP/+Www8//JaNGzc22ggAAKTHlgrgwsqB0fWjvtBYFVGzwuvKAABgS0488cR2EyZMuLx79+5fzmQyGRvZOo2NjTFr1qy49dZb48knn4wPPvC0UuC/rV69OmbMmBFz5syJ0tLS6NSpU/jX7NbJZDKZ9u3bD/3+978/dPny5TNfffXValsBAIB0KOtcHwXlH/O9gDuAAQBg29x66637H3vssRcWFRW1sI2tU1NTE0899VQ8++yzsWHDBgsBPlGLFi3i4IMPjsMPPzxKS/28YmvV19d/OG7cuPNPPvnk6bYBAADJ5xHQAACwHWWz2cyzzz77rSFDhvzAI5+3zqZNm2Ly5Mnx1FNPKX6BbdKiRYs47LDD4pBDDlEEb6VcLtfwyiuvXHfooYfeWVdX5yXrAACQYApgAADYTo455pjW11133cWVlZV728ant2HDhnj88cdjypQpUVtbayHAZ1ZcXBwHHnhgfPGLX4wWLTyIYWusWbNm2re//e3zn3nmGb+JAwAACeUdwAAAsB1cfvnlu1900UW/LS8v72cbn05VVVVMmDAhbrnllnjzzTejoaHBUoDtoqGhIZYsWRLPPfdc1NTURI8ePSKb9XOMT6OsrKzb17/+9SPbtm0774knnlhtIwAAkMDreu8ABgCAz+bhhx/+8qGHHnpOQUFBsW18sk2bNsUzzzwTTzzxRFRVVVkIsMOVl5fHkUceGYccckgUF/tX9afR2Ni46emnn/71Mccc87htAABAsngENAAAbKN27doVTZ48+YxevXodZxufrK6uLp5++umYOHGi4hfYJSoqKuKLX/xiHHzwwe4I/pQWLVr0x4MOOuiadevWeUwDAAAkhEdAAwDANjj22GPbPvzww7/p2LHjobaxZXV1dfHkk0/GddddF3Pnzo26ujpLAXaJzZs3x2uvvRbPPfdcRET06NEjCgsLLWYLWrduvfv3vve9fd9+++1pCxYsqLYRAABo+rb0CGgFMAAAfITLL7989wsuuOB3zZs372UbH6+xsTGmTJkS119/fbzyyiuKX6DJ2Lx5cyxYsCCmT58excXF0a1bt8hkMhbzMUpKSjp8+ctfPrJt27ZzvBcYAACaPu8ABgCArTB+/Pgjv/CFL/xLQUFBiW18vAULFsT48eNj6dKllgE0eT169IivfOUrMWjQIMvYgsbGxpqJEydecuyxxz5pGwAA0HR5BzAAAHwK7dq1K3ruued+1qNHj6/axsdbtGhR3H///bF48WLLABKnV69ecdxxx0WfPn0sYwuWLl3654MOOujy1atX19sGAAA0Pd4BDAAAn2DYsGHNn3766V936tTpC7bx0TZs2BD33Xdf/PGPf4y1a9daCJBI69evj2nTpsW6deuiZ8+eUVLiYQ8fpbKysv+3v/3t/lOmTJmyfPlyz/cHAIAmxjuAAQBgC372s5/1uP76669t0aKF54J+hJqamhg/fnzcfPPN8fbbb0cul7MUINFyuVy888478cwzz0RVVVX07t07slk/A/lHZWVl3U488cTD6+rqZkyfPv1DGwEAgCZ0va4ABgCAj3bFFVfscdZZZ11dXFzcwTb+Xi6XixkzZsR1110XCxYsiMbGRksBUqWxsTGWLFkSM2bMiPLy8ujSpUtkMhmL+RvZbLbFQQcddHibNm1mP/HEE6ttBAAAmoYtFcDeAQwAQN6aNGnSqAMOOODsTCZTaBt/b9GiRXHPPffEu+++axlA3ujWrVucdNJJ0bt3b8v4B7lcrm7y5Mm//vKXv/yIbQAAwK63pXcAK4ABAMg7paWlBTNnzjyzT58+x9vG39uwYUOMGzcuZsyY4VHPQF7KZDKx3377xde//vWoqKiwkH+waNGiP+27775X1dTUeCwEAADsQgpgAAD4H926dctOnjz5V506dRppG/9fLpeLqVOnxp///OfYuHGjhQB5r6KiIkaNGhX777+/x0L/g+XLlz9+6KGHXvLuu+/W2QYAAOwaWyqAvQMYAIC8MXz48PInnnjiynbt2o2wjf/vnXfeiWuvvTaee+652Lx5s4UARMTmzZtjzpw58dprr0XPnj2jRYsWlvI/Kioq+n7rW98aMnXq1Ofee+89f3AAAMAusKV3ACuAAQDIC9/+9rc73n777X9o0aLFANv4b1VVVXHXXXfFvffeG+vXr7cQgI+wbt26eP7552P9+vWx2267RVFRkaVERElJSefjjjvuoA8++GDKK6+88hcbAQCAnUsBDABAXjv//PP7XXzxxX8oKSnpbBv/bfr06XHttdfGokWLLAPgU3jnnXdi2rRp0bp16+jc2R8nERHZbLbyC1/4whElJSUvTp48eY2NAADAzqMABgAgb/3ud7/b60c/+tFVRUVFrWwjYs2aNXHzzTfHpEmTora21kIAtkJtbW289NJL8c4770Tfvn2jtLQ073dSWFhYNnz48C/26dNn4UMPPbTMpwQAAHYOBTAAAHnp1ltv3f+b3/zmfxYWFjbP913kcrl4/vnn4/rrr4/ly5f7cAB8BitXroxp06ZFRUVFdOvWLTKZTF7vo6CgIDto0KBDBw0atOiBBx54xycEAAB2vC0VwJmex8Z+H/WF+pURa17ym6wAACTTww8//KXDDjvsXzKZTN6/rPGDDz6I22+/Pd544w0fDIDtbMCAAfGtb30r2rRpk/e7yOVyjVOmTPn1yJEjH/LJAACAHavN3jVR1OGjv6YABgAgdV555ZXTPve5z30r3/fQ0NAQjz32WDz++ONRV1fngwGwg2Sz2Tj66KPjC1/4QhQUFOT9Pl5//fU79tprr9/7ZAAAwI6jAAYAIC9ks9nMyy+/fFafPn2Oz/ddvPvuu3HbbbfFe++954MBsJN069YtvvOd70S3bt3yfhdLliy5f5999rmypqam0ScDAAC2PwUwAACpV1paWjBr1qyzevfufVw+7yGXy8WTTz4ZDz74oLt+AXaBbDYbxxxzTBxxxBF5fzfw0qVLHxg6dOjlSmAAANj+FMAAAKRar169mk2ePHlsu3btDsrnPaxcuTJuueWWePvtt30oAHaxnj17ximnnBIdOnTI6z2sXr16yiGHHPIvS5Ys2exTAQAA28+WCuDCyoHR9aO+0FgVUbMia3sAADRpQ4cOLXvqqacub9Omzf75uoNcLhfPPPNMXH/99bF27VofCoAmYP369TFlypQoKSmJnj17RiaTycs9NG/evPtJJ500ZPLkyc+sWLHCoykAAGA7KetcHwXlH/01BTAAAIk1ZMiQ0kceeeSKVq1a7Z2vO6iuro7bb789nnjiiWhs9IRNgKaksbEx5s+fH++//34MGDAgstn8/DlLaWlpp6997WuDn3rqqadXrlxZ75MBAACfnQIYAIDUOfTQQ1s8+OCDv2/ZsuUe+bqDOXPmxNVXX+2RzwBN3PLly+OFF16Ijh075u0joUtLSzudcMIJ+7/00ktPv/3227U+FQAA8NkogAEASJVhw4Y1v++++37TsmXLQfl4/vr6+hg/fnz88Y9/jNpaP0MHSILNmzfHiy++GJs3b47ddtstCgoK8m4HxcXFbY866qg9n3vuuaeXL1/ucdAAAPAZKIABAEiNI488snLcuHG/b9GixcB8PP97770XV111VcyZM8eHASCBFi1aFC+//HL069cvWrRokXfnLykp6XDcccftP2fOnGcWLVq0yScCAAC2jQIYAIBUOPLIIyvvvPPO35aXl++Wj+d/+umn48Ybb4wPP/zQhwEgwf7yl7/ECy+8ECUlJdGrV6+8O3+zZs3aHHXUUfspgQEAYNspgAEASLxjjz227W233faH5s2b98m3s1dVVcXNN98cTz31VDQ2NvowAKRAY2NjzJ8/P5YtWxYDBgyIZs2a5dX5mzVr1uaYY4458M0333xm4cKFNT4RAACwdRTAAAAk2qGHHtritttuuzofy9+33347rrnmmli8eLEPAkAKvf/++/HKK69Enz59orKyMq/Ons1mK4888sh9Zs6c+dTSpUs3+zQAAMCnpwAGACCxjjjiiJb33nvvteXl5f3y6dy5XC4mTZoUN998c1RVVfkgAKRYVVVVTJ06NbLZbPTp0ycymUzenL24uLjtV7/61c+/8sorTy1evLjWpwEAAD4dBTAAAIl06KGHtrj33nt/l2/lb3V1ddx0000xefLkyOVyPggAeSCXy8WCBQvi3Xffjd133z2y2fz5mUyzZs1aH3300fvNmDHjSXcCAwDAp6MABgAgcYYOHVo2fvz4qysqKgbk07mXLVsWV111lUc+A+SplStXxiuvvBKf+9znoqKiIm/O3axZszZHH3300GeeeebJFStW1PkkAADAlimAAQBIlCFDhpQ++uij17Rs2XL3fDr31KlT49prr42NGzf6EADksaqqqpg+fXq0bds2unTpkjfnLikpaT9q1KihTz755JMrV66s90kAAICPt6UCuMB6AABoSjp16pSdMGHCv1dWVu6RL2dubGyMcePGxR133BF1dW56AiCitrY2br755hg/fnw0NjbmzbkrKyv3mDBhwr9369bNXQkAALCNFMAAADQZrVq1Kpw+ffolbdq02T9fzlxdXR2/+93vYtKkSd73C8DfyeVy8fjjj8fvf//7qK6uzptzt2nTZv8pU6Zc0qpVq0KfAgAA2HoKYAAAmoSKioqC2bNnX9KuXbuD8uXMS5cujYsuuijmz5/vAwDAx3r11VfjoosuiqVLl+bNmdu1a3fQ7Nmz/72iosLPrgAAYCu5iAYAoEmYOXPmz9q1a3dIvpz35ZdfjiuuuCLWrVsnfAA+0bp16+KKK66Il19+OW/O3K5du4Nnzpz5M+kDAMDWUQADALDLvfjii2N69OgxKh/Omsvl4oEHHogbbrghamtrhQ/Ap1ZbWxs33HBDPPDAA3nz2oAePXqMevHFF8dIHwAAPj0FMAAAu9SkSZO+NnDgwFPy4ax1dXVx8803x8SJE73vF4BtksvlYuLEiXHLLbdEXV1dXpx54MCBJ0+aNOlr0gcAgE9HAQwAwC7z6KOPHnXggQeekw9nXbduXfz617+OWbNmCR6Az2zmzJnx61//Ol9eJZA58MADz3n00UePkjwAAHyywsqB0fWjvtBYFVGzImtDAADsEDfeeOO+Rx999EWZTKYw7Wddvnx5XHXVVbFy5UrBA7DdbNiwIWbPnh0DBw6MioqKtB8307179/179uz56sMPP7xc+gAA5LuyzvVRUP7RX1MAAwCw011xxRV7fPe7372qoKCgWdrPOmfOnPjtb38bGzduFDwA2111dXVMmzYtOnfuHB07dkz1WTOZTOHuu+9+eJs2bV6aNGnSKukDAJDPFMAAADQZZ5xxRvef/exnvy0sLCxP+1knTJgQd999d9TX1wsegB2moaEhXnrppchms9G3b99UnzWTyRTttddeB/3lL395dubMmRukDwBAvlIAAwDQJBx00EEVf/jDH64pLi7ulOZz5nK5eOCBB+Kxxx4TOgA77c+eBQsWRF1dXfTv3z8ymUxqz1pQUFBywAEHDJs+ffqkpUuXbpY+AAD5aEsFcIH1AACwMwwaNKj0vvvuu7qsrKxXms9ZV1cX1113XUyaNEnoAOx0EydOjOuvvz7q6upSfc6ysrJef/rTn67u379/idQBAODvKYABANjhKioqCh577LGLKyoqBqb5nNXV1XHNNdfE7NmzhQ7ALvPKK6/ElVdeGVVVVak+Z4sWLQZOnDhxbEVFhZ9vAQDA33CBDADADjdz5syftW3b9sA0n3HdunVx2WWXxRtvvCFwAHa5xYsXx2WXXRZr165N9TnbtWt34MyZM38mcQAA+P8UwAAA7FBPPvnkqB49eoxK8xlXrVoVV1xxRSxfvlzgADQZK1asiCuuuCJWrlyZ6nP26NFj1KRJk0ZJHAAA/lth5cDo+lFfaKyKqFmRtSEAALbZjTfeuO+XvvSlCzOZTGp/8fDdd9+NK6+8MtatWydwAJqc6urqmDVrVvTv3z8qKytTe85u3boN79mz57yHH37Yb2MBAJAXyjrXR0H5R39NAQwAwA5x3nnn9T311FOvLigoKE7rGV977bW45pprorq6WuAANFmbN2+OGTNmRI8ePaJ9+/apPGMmkykYNGjQIYWFhVOee+45v5UFAEDqKYABANipjjrqqFb/8R//8YdmzZq1SusZX3755bj++uujrq5O4AA0eQ0NDfHSSy9Fp06dolOnTqk8Y0FBQXbYsGGfnz9//qQ33nhjk9QBAEizLRXA3gEMAMB21a1bt+wNN9zwnyUlJR3TesYpU6bEjTfeGPX19QIHIDHq6+vjxhtvjKlTp6b2jCUlJZ1uuOGG/+jWrZu7GgAAyFsKYAAAtqunn376XyorK/dI6/kmTZoUd955ZzQ2NgobgMRpbGyMO+64I5588snUnrGysnLw008//UtpAwCQrxTAAABsN88///w3unTp8k9pPd/EiRNj3LhxkcvlhA1AYuVyubj//vtTXQJ36dLlS88+++yJ0gYAIB95BzAAANvFTTfdNPzII488L5PJZNJ4vsceeyzGjx8vaABS47XXXotmzZpF3759U3m+zp0779urV695Dz/88DJpAwCQNlt6B7ACGACAz+wXv/hF7x/+8IdXFxQUNEvj+R544IF45JFHBA1A6ixYsCDq6upiwIABqTtbJpPJDBo06ODGxsbnpk6dul7aAACkiQIYAIAd5oADDqj43e9+99tmzZq1TeP5xo0bF5MmTRI0AKm1aNGi2Lx5cwwcODB1ZysoKMjut99+w5577rnH33vvvc3SBgAgLbZUAHsHMAAA2yybzWbuvPPOfyktLe2exvNNmDBB+QtAXpg0aVI89NBDqTxbaWlpj3vuuedfstlsRtIAAOQDBTAAANvs+eef/06HDh0OTePZHn744Xj44YeFDEDeeOSRR+LPf/5zKs/WoUOHw5599tlvSxkAgHygAAYAYJvcd999hw8ePPjUNJ7t/vvvjwkTJggZgLzz2GOPxX333ZfKs+25554/+NOf/nSYlAEASDvvAAYAYKudccYZ3ceMGXN5QUFBcdrONnHixHjkkUeEDEDeWrx4cWSz2ejbt2/ajpbp06fPvn/5y18mz5w5c4OkAQBIsi29A1gBDADAVhk2bFjzG2+88Q/NmjVrl7azPfroo6l99CUAbI2FCxdGUVFR9OvXL1XnKigoKD7wwAP3e/LJJx9dsWJFnaQBAEiqLRXAHgENAMBWuffee39ZWlraPW3nevzxx+PBBx8UMAD8jz//+c8xceLE1J2rtLS0x3333fdLCQMAkFYKYAAAPrVJkyaN6tSp0xEpPFeMHz9ewADwD8aPHx+TJ09O3bk6der0hUmTJn1VwgAApJFHQAMA8Kmcd955fU888cR/z2QyRWk618yZM+Puu+8WMAB8jNdeey06duwYnTt3TtW5unbtuk9BQcHzzz333DopAwCQNN4BDADAZ3LEEUe0vOKKK67NZrOVaTrXyy+/HDfffHPkcjkhA8DHyOVyMXv27OjSpUt06tQpNefKZDJF++yzz/CpU6c+9u67726WNAAASeIdwAAAbLNsNpu55ZZb/q2kpKRjms61YMGCuPnmm6OxsVHIAPAJGhsb4+abb44333wzVecqLS3tcvfdd5+fzWYzUgYAIC0UwAAAbNGkSZO+3rZt2wPTdKZly5bFDTfcEPX19QIGgE+prq4urr322li+fHmqztWuXbsDH3/88VESBgAgLTwCGgCAj3XZZZcN+upXvzo2k8mk5hcH33///bjyyiujqqpKwACwlerq6uLll1+OIUOGRHl5eWrO1aVLl31LS0unPvPMM2ukDABAEngENAAAW61///4lJ5988q8ymUxRWs60YcOG+P3vfx8bN24UMABso40bN8bvfve7VP15WlBQkP3hD394ft++fYslDABA4q9vrQAAgI/y4IMPnl1WVtYrLeeprq6O3/zmN7Fq1SrhAsBntGrVqrjyyiujuro6NWcqKyvr8/DDD58lXQAAkk4BDADA/zF+/Pgju3XrdnRazlNfX5/KdxYCwK60fPnyuO6666K+vj41Z+rRo8dXx40bd4R0AQBIMgUwAAB/53vf+16nI4444py0nCeXy8Vtt90Wb7zxhnABYDt7/fXX47bbbotcLpeaMx155JHnfvvb3+4oXQAAkkoBDADA/6qoqCi4+OKLLywsLCxPy5nGjx8fs2bNEi4A7CCzZs2Khx56KDXnKSwsrPj1r399QUVFhZ+bAQCQSC5kAQD4XxMnThxdWVk5OC3nef7552PixImCBYAd7LHHHosXXnghNeeprKzc89FHHz1RsgAAJFFh5cDo+lFfaKyKqFmRtSEAgDxxwQUX7DZq1KgLM5lMYRrO8+qrr8Ytt9ySqkdSAkBT/7O3d+/e0a5du1Scp2PHjkNzudxzU6ZMWSddAACamrLO9VHwMc/wcwcwAADRt2/f4h//+McXZzKZVPwG4HvvvRc33HBDNDY2ChcAdpKGhoa47rrrYtmyZak4T0FBQfbss88e27dv32LpAgCQqGtZKwAAYPz48T8qKyvrkYazbNiwIX7/+99HbW2tYAFgJ9u0aVP8/ve/j40bN6biPGVlZb3GjRs3RrIAACSJAhgAIM/ddNNNw/v06XN8Gs5SX18f1157baxdu1awALCLrFmzJq699tqor69PxXn69ev3jd///vdDJQsAQFIogAEA8thBBx1Uceyxx/5rRGTScJ477rgjFi9eLFgA2MUWLVoUd955Z1qOU/CNb3zj34YNG9ZcsgAAJOIC1goAAPLXzTfffFZxcXG7NJxl4sSJMX36dKECQBMxbdq0mDRpUirOUlJS0unOO+88Q6oAACSBAhgAIE/913/914FdunT5UhrO8tprr8Wf//xnoQJAEzN+/PhYsGBBKs7SrVu3o2+66abhUgUAoKlTAAMA5KEvfelLlV/5yld+lYazrFixIq6//vpobGwULAA0MY2NjXHdddfFihUr0nCczHHHHfergw46qEKyAAA0ZQpgAIA8dPXVV5+ezWYrk36OmpqauPbaa2PTpk1CBYAmatOmTXHttddGTU1N4s+SzWbb3njjjT+RKgAATZkCGAAgz9x6663Du3Tp8uWknyOXy8Utt9wSK1euFCoANHErV66MW2+9NXK5XOLP4lHQAAA0dQpgAIA8MnTo0LKvfvWrv0jDWSZMmBBz584VKgAkxJw5c+Kxxx5LxVlGjRr1i6FDh5ZJFQCApkgBDACQR+64444fFRcXd0z6OV5++eV45JFHBAoACfPQQw+l4he4SkpKOt5xxx0/lCgAAE2RAhgAIE9cfvnlu/fs2XNU0s/xwQcfxB133JGKR0gCQL7J5XJx2223xZo1axJ/lp49ex57+eWX7y5VAACaGgUwAEAe6NatW/a73/3uv2YymURf/9XX18cNN9wQ1dXVQgWAhKqqqoobb7wx6uvrE32OTCZT8N3vfvdX3bp1y0oVAICmRAEMAJAHxo8ff0pZWVmvpJ/jnnvuiaVLlwoUABJuyZIlcd999yX+HGVlZT3Hjx9/ikQBAGhKFMAAACn385//vOeAAQNGJ/0c06dPjylTpggUAFJi8uTJMWPGjMSfY8CAAaN//vOf95QoAABNhQIYACDFstls5qyzzjo3k8kk+tGEK1asiLvvvlugAJAyd911V6xYsSLRZ8hkMtmzzjrr3Gw2m5EoAABNgQIYACDFxo0b98XKysq9knyG2trauOGGG6K2tlagAJAyf/1zfvPmzYk+R2Vl5V7jxo0bKVEAAJoCBTAAQEoNHz68/OCDDz4t6ee4//77Y/ny5QIFgJRavnx5jBs3LvHnGDFixI+HDRvWXKIAAOxqCmAAgJS69dZbT8tms22TfIYZM2bEc889J0wASLnJkyfHzJkzE32G4uLitrfffvtp0gQAYFdTAAMApNBVV121R48ePb6S5DOsXLky7rrrLmECQJ64++6744MPPkj0GXr27PnVK664Yg9pAgCwKymAAQBSprS0tOAb3/jGT5N8rdfY2Bi333679/4CQB6pqamJ2267LRobG5N8jIJvfvObZ5aWlvqZGwAAu+6i1AoAANJlwoQJX6uoqBiQ5DOMHz8+Fi1aJEwAyDNvvvlmPPjgg4k+Q4sWLQY9+OCDx0gTAIBdRQEMAJAiRx55ZOWwYcN+kOQzzJ07N5544glhAkCemjhxYixYsCDRZxg+fPiPjjjiiJbSBABgV1AAAwCkyBVXXHFyUVFRRVLnr6qqijvvvDNyuZwwASBP5XK5uP3226O6ujqxZygqKmrxm9/85mRpAgCwKyiAAQBS4vzzz+/Xu3fv45J8httvvz0+/PBDYQJAnlu3bl3cfvvtiT5D7969jz///PP7SRMAgJ1NAQwAkALZbDZz6qmn/jyTyST2+m769OkxZ84cYQIAERExe/bsmDFjRmLnz2QyBaeeeurPs9lsRpoAAOxMCmAAgBT44x//eERlZeXgpM6/du3auPfeewUJAPyde+65J9atW5fY+SsrKwf/6U9/+oIkAQDYmRTAAAAJ17dv3+JDDjnkR0k+w9133x01NTXCBAD+Tk1NTdx9992JPsPBBx/8o759+xZLEwCAnUUBDACQcHfdddc3S0pKOiV1/smTJ8e8efMECQB8pLlz58azzz6b2PlLSko63nPPPd+SJAAAO4sCGAAgwb70pS9VDhw48KSkzr9mzZoYP368IAGALXrggQdizZo1iZ2/f//+Jx111FGtJAkAwM6gAAYASLArrrji1MLCwvIkzp7L5eK2226LTZs2CRIA2KJNmzbFbbfdFrlcLpHzFxYWll1++eU/kCQAADuDAhgAIKF+8Ytf9O7evftXkjr/s88+G2+88YYgAYBP5Y033ojnn38+sfN369bt6F/96ld9JAkAwI6mAAYASKgf/vCHP8pkMom8nvvggw/igQceECIAsFXGjRsX69atS+TsmUym4NRTT/2xFAEA2NEUwAAACXTdddcNa9eu3YFJnD2Xy8Udd9wRtbW1ggQAtsqmTZvizjvvTOz8bdq02f+mm27aT5IAAOxICmAAgIQpLS0t+NrXvnZ6Uud/4YUXYuHChYIEALbJq6++GjNmzEjs/Mccc8zpFRUVfiYHAMAO42ITACBhbr/99oMrKip2S+LsGzZsiHHjxgkRAPhM7r///qiqqkrk7OXl5X3/67/+6wgpAgCwoyiAAQASpKKiouCwww47Nanz33vvvYn9YS0A0HRs2LAh7r///sTOf9BBB/1zq1atCiUJAMCOoAAGAEiQ+++//+iysrKeSZx9zpw58dJLLwkRANguXnjhhViwYEEiZy8tLe32xz/+8StSBABgR1AAAwAkRN++fYv33Xfff07i7LW1tXHvvfcKEQDYru6+++6oq6tL5Oz77bffKf379y+RIgAA25sCGAAgIW6++eZRxcXFbZM4+yOPPBJr164VIgCwXa1atSoee+yxRM6ezWbb3njjjV+TIgAA25sCGAAgAYYOHVq21157fSeJs7/33nvxxBNPCBEA2CEmTpwYK1asSOTsQ4YM+c7QoUPLpAgAwPakAAYASIBrr732xKKiosqkzZ3L5eKee+6JxsZGIQIAO0R9fX3cddddkcvlEjd7UVFR5bXXXnuCFAEA2J4UwAAATdwBBxxQMWDAgG8kcfYZM2bEW2+9JUQAYId6880348UXX0zk7AMGDPjG8OHDy6UIAMD2ogAGAGjirrrqqhOKiooqkjb3pk2b4oEHHhAgALBT3H///VFbW5u4uYuKilpcffXV7gIGAGC7UQADADRhBx10UEX//v0Teffvww8/HB9++KEQAYCdYv369TFhwoREzj5w4MBvHHDAARVSBABge1AAAwA0Yf/5n/95bGFhYfOkzb1q1aqYPHmyAAGAnerpp5+O1atXJ27uwsLC8ssuu2yUBAEA2B4UwAAATdQBBxxQMWjQoNFJnP3uu++O+vp6IQIAO1V9fX3cddddiZx99913/+bQoUPLpAgAwGelAAYAaKIuv/zyYwsLC8uTNvfcuXNjwYIFAgQAdokFCxbE3LlzEzd3UVFRi9/97ndflyAAAJ+VAhgAoAkaOnRo2aBBgxL37t+6urr405/+JEAAYJf605/+FHV1dYmbe/fdd//mkCFDSiUIAMBnoQAGAGiCfvOb33ylqKioZdLmfu655xL53j0AIF1Wr14dzz33XOLmLioqann11VcfLUEAAD4LBTAAQBPTq1evZoMHD/5m0uaurq6ORx55RIAAQJPwyCOPRHV1deLmHjJkyLe6deuWlSAAANtKAQwA0MTcdNNNxxQXF7dN2twTJkyIqqoqAQIATUJVVVUifzmtuLi43a233uouYAAAtpkCGACgCWnVqlXhXnvtdVLS5l61alU8++yzAgQAmpTJkyfHqlWrEjf30KFDR7dq1apQggAAbAsFMABAE3LLLbccXlJS0jlpcz/44INRX18vQACgSamvr48HH3wwcXOXlJR0vummmw6VIAAA20IBDADQRGSz2cwBBxzw7aTNvWjRonjppZcECAA0SS+99FIsXrw4cXOPGDHiO9lsNiNBAAC2lgIYAKCJuOaaa/YuLy/vm7S5H3roocjlcgIEAJqkXC6XyLuAy8vL+1111VV7SRAAgK2lAAYAaCK+8pWvfDdpM8+bNy8WLlwoPACgSVu4cGG8+uqrrg8BAMgLCmAAgCbgsssuG1RZWblPkmbO5XIxfvx44QEAifDAAw8k7qklrVu33veSSy7pLz0AALaGAhgAoAkYNWrUCUmbefbs2bFs2TLhAQCJsGzZsnjllVcSN/cJJ5xwovQAANgaCmAAgF3sn//5nzt37NjxiCTN3NjYGA888IDwAIBEGT9+fDQ0NCRq5k6dOn1h9OjRHaQHAMCnpQAGANjFfvSjH30tk8kk6rps2rRpsWrVKuEBAImyatWqeOGFFxI1cyaTKfzpT386SnoAAHxaCmAAgF1o0KBBpX369Plqkmaur6+PCRMmCA8ASKQJEyZEXV1dombu27fvV/r27VssPQAAPg0FMADALnTZZZcdXlRUVJGkmadOnRpr164VHgCQSOvXr48pU6YkauaioqLK3/zmN0dIDwCAT0MBDACwi2Sz2cy+++57UpJmrqurc/cvAJB4jz76aOLuAt5///1PymazGekBAPBJFMAAALvI1VdfPbSsrKx3kmaeMmVKbNiwQXgAQKJt2LAhnn/++UTNXFZW1ueqq67aS3oAAHwSBTAAwC7y5S9/+bgkzVtfXx8TJ04UHACQCo8//nji7gL+0pe+dLzkAAD4JApgAIBdYPTo0R3atm07IkkzT5s2LdatWyc8ACAVPvzww5g+fXqiZm7fvv2I0aNHd5AeAABbogAGANgFfvrTn47KZDKFSZm3vr4+HnnkEcEBAKnyyCOPRH19fWLmzWQyhT/96U+/JjkAALZEAQwAsJN16tQp26dPn6OTNLO7fwGANFq3bl1MmzYtUTP36dPnmE6dOmWlBwDAx1EAAwDsZFddddUB2Wy2dVLmbWxsjEmTJgmOVOvYsWN06OCJmgD5aNKkSdHY2JiYebPZbOurrrrqAMkBAPBxFMAAADvZiBEjvp6keV988cVYtWqV4Ei1Ll26xIUXXhinnXZadO3a1UIA8siqVavipZdecj0JAEBqKIABAHaiM844o3tlZeXeSZk3l8vFxIkTBUdeyGQyMXjw4PjVr34VY8aMcUcwQB55/PHHI5fLJWbeysrKvc8444zukgMA4KMogAEAdqJTTjnlqxGRScq8CxYsiPfee09w5JVMJhN77713XHjhhTFmzJho3769pQCk3HvvvRcLFy5M1B9X/3NdCQAA/4cCGABgJ+nVq1ezXr16fTlJM3v3L/nsr0XwBRdcECeffHK0bdvWUgBSLGnXPb169fpyr169mkkOAIB/pAAGANhJrrjiioOLiopaJmXeBN4JAztEYWFhDB8+PC688MIYPXp0VFZWWgpACi1YsCCWLVuWmHmLiopaXnnllYdIDgCAf6QABgDYSYYPH/6VJM2btHfhwY5WVFQUI0aMiEsuuSRGjx4dLVu2tBSAFMnlcvH4448naub99tvvK5IDAOAfKYABAHaC0aNHd6isrByalHnXrl0bL7/8suDgI/y1CL744ovjhBNOiBYtWlgKQEq89NJLsW7dusTMW1lZudfo0aM7SA4AgL+lAAYA2AlOP/30o5J07fXMM89EQ0OD4GALiouL47DDDouxY8fGqFGjoqyszFIAEq6hoSGeeeaZJI1c8D/XmQAA8P8vEq0AAGDHymazmX79+n05KfPW1tbGlClTBAefUnFxcYwcOTIuvfTSGDVqVJSWlloKQII9//zzUVtbm5h5+/Xr9+VsNpuRHAAAf6UABgDYwX7zm9/sWVJS0jkp886YMSOqq6sFB1uppKQkRo4cGZdcckkcffTRUVJSYikACVRdXR0zZ85M0p8/na+44orBkgMA4K8UwAAAO9gXvvCFLyVl1lwuF08//bTQ4DNo3rx5HHXUUXHJJZfEyJEjI5vNWgpAwjz11FORy+USM++RRx75ZakBAPBXCmAAgB1oyJAhpZ07dz4iKfO+/vrrsWLFCsHBdlBeXh6jRo2KSy+9VBEMkDArVqyI119/PTHzdunS5fD+/ft79AQAABGhAAYA2KHGjh17aGFhYWJeCOruX9j+KioqYtSoUXHxxRfH4YcfHkVFRZYC4LpouyosLGz+H//xHwdLDQCACAUwAMAOteeeex6ZlFnXrl0b8+bNExrsIK1atYrjjz8+LrroohgxYkQUFPh2DKApmzdvXqxZsyYx8+61115HSg0AgAgFMADADnPMMce0bt269b5Jmfe5556LxsZGwcEO1qZNmxg9enRcfPHFimCAJqyxsTGee+65JP35MvyYY45pLTkAAPykAQBgBznzzDMPz2Qyibjeqq+vj6lTpwoNdqK2bdvG6NGj47zzzovhw4crggGaoBdeeCHq6+sTMWsmkyk844wzDpUaAAB+wgAAsIP079//C0mZdc6cObFhwwahwS7QqVOnOPnkk+Pf/u3fYu+9945MJmMpAE3Ehg0bYvbs2YmZd8CAAR4DDQCAAhgAYEf43ve+16mysnKPpMybpMcbQlp17tw5xowZE7/61a8UwQBNyPPPP5+YWSsrKwd/73vf6yQ1AID8pgAGANgBTj755CMiIhHtzcqVK+P1118XGjQRXbt2jTFjxsQ555wTgwcPthCAXez111+PlStXJmXczMknn3y41AAA8psCGABgB+jXr19iHv88ZcqUyOVyQoMmpnfv3nHaaafFOeecE/3797cQgF0kl8vFlClTknQd6jHQAAB5TgEMALCdnX766d0qKip2S8Ks9fX1MW3aNKFBE9anT58466yz4pxzzonddtvNQgB2gWnTpkV9fX0iZq2oqNjt9NNP7yY1AID8pQAGANjORo8efURSZp03b15s3LhRaJAAffr0ibPPPjvOPPPM6Nmzp4UA7EQbN26MefPmuR4FACARFMAAANtZr169EvPetSQ9zhD4bwMGDIhf/vKXceaZZ0b37t0tBGAnmTp1apKuRw+TGABA/lIAAwBsR2eccUb38vLyvkmYdf369fHaa68JDRJqwIAB8S//8i9x2mmnRbdunvQJsKPNnz8/Pvzww0TMWl5e3u9HP/pRF6kBAOQnBTAAwHZ03HHHHZSUWWfMmBGNjY1CgwTLZDIxePDg+Nd//dcYM2ZMdOjQwVIAdpDGxsaYMWNGYub9xje+cYjUAADykwIYAGA76tOnz8FJmDOXyyXqMYbAlmUymdh7773jwgsvjDFjxkT79u0tBWAHeOGFF5J0XXqIxAAA8pMCGABgOznppJPat2zZcvckzLpkyZJYuXKl0CBl/loEX3DBBXHyySdH27ZtLQVgO1qxYkW8/fbbiZi1srJy0PHHH+8PAgCAPKQABgDYTr773e8eGBGZJMyapMcXAluvsLAwhg8fHhdeeGGMHj06KisrLQVgO5k+fXpSRi34/ve/f6DEAADyjwIYAGA72X333Q9Nwpz19fUxc+ZMgUEeKCoqihEjRsQll1wSo0ePjpYtW1oKwGc0c+bMqK+vT8SsAwcOPFRiAAD5RwEMALAdHHTQQRUtW7bcKwmzLly4MKqrq4UGeeSvRfDFF18cJ5xwQrRo0cJSALZRVVVVvP7664mYtVWrVkOHDx9eLjUAgPyiAAYA2A7OPvvsz2cymaIkzOrxz5C/iouL47DDDouxY8fGqFGjoqyszFIAtkFSnqaSyWSy55577uclBgCQXxTAAADbwe67735AEuasra2NOXPmCAzyXHFxcYwcOTIuvfRSRTDANpg9e3bU1dUlYtY99tjjAIkBAOQXBTAAwGfUqlWrwnbt2u2fhFnnzZsXtbW1QgMiIqKkpCRGjhwZY8eOjaOPPjpKSkosBeBT2LRpU8ybNy8Rs7Zv337/iooKPwMEAMgjLv4AAD6jCy+8cPeioqKKJMz64osvCgz4P5o3bx5HHXVUXHLJJTFy5MjIZrOWAvAJZs2alYg5i4qKWlx88cWDJAYAkD8UwAAAn9GBBx6YiMfqVVdXJ+ZOFWDXKC8vj1GjRsWll16qCAb4BPPmzYuamppEzHrQQQd5DDQAQB5RAAMAfEZdu3YdnoQ5582bF/X19QIDPlFFRUWMGjUqLr744jj88MOjqKjIUgD+QV1dXbz66quJmLVLly77SwwAIH8ogAEAPoNTTjmlY3l5+W5JmPXll18WGLBVWrVqFccff3xcdNFFMWLEiCgo8C0kwN966aWXEjFnRUXFbieddFJ7iQEA5AffvQMAfAYnnnji55MwZ21tbcyfP19gwDZp06ZNjB49OsaOHasIBvgb8+fPj9ra2iSMmvnud7/7eYkBAOQH37UDAHwGn/vc5/ZLwpwLFy6Muro6gQGfyV+L4PPOOy+GDx+uCAby3ubNm2PhwoWJmLVfv37DJQYAkB98tw4AsI1atWpV2Lp1672TMKvHPwPbU6dOneLkk0+Oc889NwYNGmQhQF6bPXt2IuZs06bN3hUVFX4WCACQB1z0AQBso/PPP39gYWFheVOfs76+PubMmSMwYLvr2bNn/OQnP4nzzjsv9t5778hkMpYC5J3Zs2dHfX19k5+zqKio4vzzzx8oMQCA9FMAAwBso/3333/fJMz5+uuvR01NjcCAHaZLly4xZsyYOOecc2Lw4MEWAuSV6urqeOONNxIx64EHHriPxAAA0k8BDACwjbp27ZqIxz/PnTtXWMBO0bt37zjttNPinHPOif79+1sIkDeScr3VvXv3vaUFAJB+CmAAgG0wZMiQ0srKyj2a+py5XM7jn4Gdrk+fPnHWWWfFOeecE7vttpuFAKk3e/bsyOVyTX7Oli1b7jlo0KBSiQEApJsCGABgG5x55pl7ZjKZbFOfc9myZbFu3TqBAbtEnz594uyzz44zzzwzevbsaSFAaq1bty6WL1/e5OfMZDLZs846a4jEAADSrcgKAAC23tChQ4clYc558+YJC9jlBgwYEAMGDIgFCxbE+PHjY+nSpZYCpM68efOiS5cuTX7OffbZZ5+ImC4xAID0cgcwAMA26Nix4z5JmHP+/PnCApqMAQMGxC9/+cs47bTTolu3bhYCpEpSrrs6deq0j7QAANJNAQwAsJWOOOKIlhUVFf2a+pxVVVWxaNEigQFNSiaTicGDB8e//uu/xpgxY6JDhw6WAqTCW2+9FVVVVU1+zoqKis8deuihLSQGAJBeCmAAgK108sknD46ITFOfc/78+dHY2CgwoEnKZDKx9957x4UXXhhjxoyJ9u3bWwqQaI2NjbFgwYJE/Cv4u9/97h4SAwBILwUwAMBW2n333fdMwpze/wskwV+L4AsuuCBOPvnkaNu2raUAiZWU66/BgwfvKS0AgPQqsgIAgK3Trl27wU19xlwul5Q7UAAiIqKwsDCGDx8e++yzT0ybNi0mTJgQ69evtxggURYsWBC5XC4ymab9sJgOHToMlhYAQHq5AxgAYCsMGjSotGXLlgOa+pzvvfdebNy4UWBA4hQVFcWIESPikksuidGjR0fLli0tBUiMDz/8MJYtW9bk52zZsuXA/v37l0gMACCdFMAAAFvhxz/+8aBMJtPkn6Li7l8g6f5aBI8dOzZOOOGEaNGihaUAibBw4cImP2Mmk8n+5Cc/GSAtAIB0UgADAGyFvffee88kzJmEHzwCfBrNmjWLww47LMaOHRujRo2KsrIySwGatKT8Il5SrmsBANh63gEMALAVunbtOqSpz1hfXx9vvvmmsIBUKS4ujpEjR8bBBx8czz77bDz++ONRXV1tMUCT8+abb0Z9fX0UFTXtH7t16dJlT2kBAKSTO4ABAD6lioqKgoqKikFNfc4lS5bE5s2bBQakUklJSYwcOTLGjh0bRx99dJSUeIUl0LTU1tbG0qVLm/ycLVu2HFRaWupngwAAKeQiDwDgUzr77LP7FhYWNvlnj7722mvCAlKvefPmcdRRR8Ull1wSI0eOjGbNmlkK4HpsKxQWFpafffbZvaQFAJA+CmAAgE9p//3375+EOV9//XVhAXmjvLw8Ro0aFf/+7/8eI0eOjGw2aymA67FP6fOf//xAaQEApI8CGADgU+rRo8fuTX3G2traePvtt4UF5J2KiooYNWpUXHzxxXH44Yc3+XdvAum2ePHiRLySo1evXoOkBQCQPgpgAIBPqXXr1k3+DoklS5ZEQ0ODsIC81apVqzj++OPj4osvjhEjRkRBgW97gZ2voaEhlixZ0uTnbNOmjQIYACCFfCcMAPApDBkypLR58+a9m/qcb775prAAIqJ169YxevToGDt2rCIYcF32MZo3b95n0KBBpdICAEgX3wEDAHwKp556av9MJtPkr53eeustYQH8jTZt2sTo0aPjvPPOi+HDhyuCAddlfyOTyRT84Ac/+Jy0AADSxXe+AACfwuDBg5v84/Hq6+tj0aJFwgL4CJ06dYqTTz45/u3f/i323nvvyGQylgLsUIsXL07Eqzn23HPPgdICAEgXBTAAwKfQpUuXAU19xnfeeSfq6uqEBbAFnTt3jjFjxiiCgR2utrY23n333SRc53oPMABAyiiAAQA+hZYtW/Zv6jN6/DPAp9elS5cYM2ZMnHvuuTF48GALAfL2+iwJ17kAAGwdBTAAwCcYPnx4eUlJSeemPqfHPwNsvV69esVpp50W55xzTvTvrwMB8u/6rLS0tPPw4cPLpQUAkB4KYACAT/Ctb31rt4ho8s8IXbx4sbAAtlGfPn3irLPOinPOOSd22203CwG2i4T8gl7m29/+dj9pAQCkhwIYAOAT7L777k2+CVi7dm1s2LBBWACfUZ8+feLss8+OM888M3r27GkhwGfy4Ycfxrp165r8nAMHDlQAAwCkSJEVAABsWadOnZr8D8TefvttQQFsRwMGDIgBAwbEggULYvz48bF06VJLAbb5Oq1Vq1audwEA2GkUwAAAn6CyslIBDJCnBgwYEP3794958+bFQw89FO+++66lAFtlyZIlsddeezX1613PvgcASBEFMADAFnTq1CnbvHnzXk19ziVLlggLYAfJZDIxePDg2GOPPeLll1+OBx98MFauXGkxQGqu05o3b967Xbt2RatXr66XGABA8nkHMADAFowZM6ZnJpPJNuUZGxsbPZoUYCfIZDKx9957x4UXXhhjxoyJ9u3bWwrwiZYuXRqNjY1NesaCgoLsqaee2kNaAADp4A5gAIAt2Hvvvfs29RlXrlwZtbW1wgLYSf5aBO+5554xa9asmDBhQqxevdpigI9UW1sb77//fnTu3LlJzzls2LC+EbFIYgAAyecOYACALejRo0eTL4DfeecdQQHsAoWFhTF8+PC48MILY/To0VFZWWkpQGKv15Jw3QsAwKejAAYA2ILWrVs3+ff/vvvuu4IC2IUKCwtjxIgRcckll8To0aOjZcuWlgIk7notCde9AAB8Oh4BDQCwBc2bN+/Z1GdUAAM0kW+wi4pixIgRsd9++8WUKVPiscceiw0bNlgMEO+9914SrnsVwAAAKeEOYACAj9G/f/+SkpKSjk19TgUwQNPSrFmzOOyww2Ls2LExatSoKCsrsxTIc0m4XistLe3Ut2/fYmkBACSfAhgA4GOccMIJ3Zr69dK6deuiqqpKWABNUHFxcYwcOTJ+/etfK4Ihz1VVVcX69eub+pgF3/zmN7tLCwAg+RTAAAAfY8iQIT2b+oxJeJwgQL77axE8duzYOProo6OkpMRSIA8l4botCde/AAB8MgUwAMDH6N69e8+mPqPHPwMkR/PmzeOoo46KSy65JEaOHBnNmjWzFMgjSbhuS8L1LwAAn0wBDADwMVq1atWjqc+4bNkyQQEkTHl5eYwaNSr+/d//PUaOHBnZbNZSIA8k4botCde/AAB8MgUwAMDHqKio6NXUZ1y+fLmgAJL750yMGjUqLr744jj88MOjqKjIUiDFknDd1rJly16SAgBIPgUwAMBHyGazmbKysq5NecbGxsZYtWqVsAASrlWrVnH88cfHxRdfHCNGjIiCAt+qQxqtWrUqGhsbm/SMJSUlXbPZbEZaAADJ5rtKAICPcNxxx7UrKCgobsozrl69Ourr64UFkBKtW7eO0aNHx9ixYxXBkEJ1dXXxwQcfNOkZCwoKio877rh20gIASDbfTQIAfITPf/7zXZr6jO+//76gAFKoTZs2MXr06Dj//PNj+PDhimBIkRUrVrgOBgBgh/NdJP+PvTuPr7I888d/nSwEkhD2HUQEUVRAoIiouCtq64Jabd1arVorbqO2tlXbaavTOu38Rqffdmpbu9rWpYogsqgFRXCttAIKArJDgAAJBLKQ5JzfH8WO4+DOcp6T9/v18jWvTv657ut6hNvnk/t+AICd2G+//bL+xVcSXiAC8PF17do1Lr300rj99ttj2LBhkUq5lRWSLgn7tyTsgwEAeH8FWgAA8H917txZAAxAVujevXtceeWVsXr16njiiSdi9uzZkclkNAYSKAn7tyTsgwEAeH8CYACAnWjXrp0roAHIKj169Igrr7wyli5dGpMmTYo5c+ZoCiRMEvZvSdgHAwDw/gTAAAA7UVxc3D3baxQAAzRPffr0ibFjx8aSJUti/PjxsWDBAk2BhEjC/i0J+2AAAN6fbwADAOxESUlJz2yur7q6Ourq6gwKoBnbb7/94l/+5V/ia1/7WhxwwAEaAglQV1cX1dXV9sEAAOxWAmAAgHc5/PDDSwsKCtpmc40VFRUGBUBERPTt2zduvPHGuOGGG2LffffVEMhy2b6PKygoaDt8+PASkwIASC4BMADAu5x44oldsr3GDRs2GBQA/8uAAQPiG9/4Rtxwww3Ru3dvDQH7uE+yH+5qUgAAyeUbwAAA79KvX7+sD4DXr19vUADs1IABA+LAAw+MuXPnxoQJE2LlypWaAlkkCTe5HHDAAV0i4i3TAgBIJgEwAMC7dO/evXO21+gEMADvJ5VKxaBBg2LgwIExe/bsGD9+fKxbt05jwD4uZ/bDAAC8NwEwAMC7tG/fvlO21ygABuDDSKVSMWzYsBg6dGjMnj07HnvsMbdIwF6WhBPASdgPAwDw3gTAAADv0rp166w/8ZCEF4cAZI+3g+BDDz00XnnllZg4caK/S8A+LtH7YQAA3psAGADgXUpKSrL6xENjY2Ns3rzZoAD4yPLz8+Pwww+P4cOHx/PPPx8TJ06MqqoqjYE9aPPmzdHY2BgFBdn7Wi7b98MAALw/ATAAwLu0bNmySzbXV1lZGZlMxqAA+Njy8/Nj1KhRMXLkyHjhhRcEwbAHZTKZqKqqio4dO9oPAwCwWwiAAQDepaioKKuvvKusrDQkAHaJgoKCGDVqVIwYMSJmzpwZkydPji1btmgM7IH9XDYHwNm+HwYA4P3laQEAwP8YPnx4SX5+fkk21ygABmBXa9GiRRx//PFxxx13xNlnnx0lJSWaAs14P5efn18yfPhwfxAAACSUABgA4B2OOOKIDtleo+//ArC7FBUVxejRo+P73/9+nH322VFcXKwpsBsk4cr1JOyLAQDYOQEwAMA79O3bt1221+gEMAC729tB8B133BGnn356tGrVSlOgme3n9ttvv7YmBQCQTAJgAIB36NSpkwAYAHYoKSmJz3zmM3HnnXfG6NGjo0WLFpoCzWQ/l4R9MQAAOycABgB4hw4dOrTN9hqTcGUgALmlpKQkzj777PjOd74To0aNivz8fE2BHN/PJWFfDADAzgmAAQDeoaysrG221ygABmBvad++fVx00UVx5513xgknnBCFhYWaAjm6nysrK3MCGAAgoQTAAADvUFJS0j6b68tkMlFdXW1QAOxV7dq1i/POOy+++93vxqhRoyIvz+sF+CiSsJ8rLS0VAAMAJJT/QgMAeIfi4uK22VxfXV1dNDY2GhQAWeHtE8F33HGHIBg+gsbGxqirq7MvBgBgt/BfZgAA79CqVausPung9C8A2ahDhw5x0UUXxbe//e04/PDDBcGQA/u6oqIiJ4ABABLKf5EBALxDQUGBABgAPqauXbvGpZdeGt/61rdi2LBhkUqlNAUSuq9r0aJFW1MCAEimAi0AAPgfhYWFZdlc39atWw0JgKzXrVu3uPLKK2P16tXxxBNPxOzZsyOTyWgMJGhfl+37YgAA3psAGADgnZujgoLW2VyfE8AAJEmPHj3iyiuvjKVLl8akSZNizpw5mgIJ2ddl+74YAID35gpoAIAdWrdunZefn98ym2sUAAOQRH369ImxY8fGLbfcEgMGDNAQSMC+Lj8/v1WrVq28OwQASCCbOACAHQYNGlQSEVn9scJt27YZFACJtd9++8UNN9wQX/va1+KAAw7QEJq1BOzr8gYPHlxsUgAAySMABgDY4YADDijJ9hpramoMCoDE69u3b9x4441xww03xL777qshNEu1tbVZX2P//v1LTQoAIHl8AxgAYIeePXtm/QuuJLwoBIAPa8CAATFgwICYP39+jBs3LpYvX64pNBtJ2Nf16NGjxKQAAJJHAAwAsEOnTp0EwACwFwwYMCAOPPDAmDt3bkyYMCFWrlypKeS8JOzrunbtKgAGAEggATAAwA5lZWVZ/4Krrq7OoADISalUKgYNGhQDBw6M2bNnx4QJE2Lt2rUaQ85KQgDcpk0bV0ADACSQABgAYIeysjIngAFgL0ulUjFs2LAYOnRozJ49O8aPHx/r1q3TGHKOABgAgN1FAAwAsENJSUlxttfoBDAAzcXbQfCQIUPi5ZdfjokTJ0ZFRYXGkDOSEAAnYX8MAMD/JQAGANihqKioKNtrrKmpMSgAmpW8vLw4/PDDY/jw4fH888/HE088EZWVlRpD4iUhAG7RokWRSQEAJI8AGABgh8LCwhbZXF86nY7t27cbFADNUn5+fowaNSpGjhwZL7zwQkycODGqqqo0hsTavn17ZDKZSKVSWVtjixYtWpgUAEDyCIABAHbI9gC4oaHBkABo9goKCmLUqFExYsSImDlzZkyePDm2bNmiMSROJpOJhoaGyOaMtbCw0AlgAIAk/neTFgAA7NgYFRRk9QuuxsZGQwKAHVq0aBHHH398HHnkkfHMM8/E1KlTY9u2bRpDomR7AJzt+2MAAN5jH6cFAAA7NkZZ/oLL9c8A8H8VFRXF6NGj49hjj41nnnkmpkyZEjU1NRpDImT7DS8FBQWugAYASCABMADA2xujLH/B5QpoAHhvbwfBRx11VEyfPj2efvrpqK2t1RiymgAYAIDdIU8LAAD+QQAMAMlXUlISn/nMZ+LOO++M0aNHZ/X1uiAABgBgdxAAAwDskO1XQAuAAeDDKykpibPPPjv+7d/+LUaPHh2FhYWagv3dR5Sfn9/SlAAAkkcADADw9sYoL88JYADIMa1bt46zzz47vve978UJJ5wgCMb+7iPIz8/3LwwAQAIJgAEAdkilUlm9N2psbDQkAPiY2rVrF+edd15897vfjRNOOCEKCgo0Bfu7D94f55sSAEDyCIABAHbI9gA4nU4bEgB8Qu3bt/9nEDxq1KjIy/NqBPu799kfp0wJACB5/FcOAMAOXnABQPPRoUOHuOiii+J73/ueIJi9JpPJZHuJ/sUAAEggmzgAgP+R1QFwAl4QAkDidOzYMS666KL41re+FYcffnj4fTDs796xOc7yG3IAANg5mzgAgITsjQTAALD7dOvWLS699NL41re+FcOGDRMEs0dk+xXQeXl5/kUAAEigAi0AAPiHbH/BJQAGgN2ve/fuceWVV8ayZcviiSeeiDlz5mgKzXl/5/AIAEACCYABAHbIZDJOAAMAERGx7777xtixY2PJkiUxYcKEmD9/vqZgfwwAQCIIgAEA/ocr7gCA/2W//faLG264Id56660YP358vPnmm5rCLpPtV0Cn3IUOAJBIAmAAgB2y/QVXtr8gBIBc1rdv37jxxhvjrbfeinHjxsWiRYs0hU/MFdAAANjEAQDsXln9Bs4BDADY+/r27Rs333xz3HDDDdG7d28NIdf3d75BAgCQQE4AAwDskO0nMATAAJA9BgwYEAMGDIj58+fHI488EitXrtQUcnF/5woaAIAEcgIYAGCHVCqVzvL6DAkAssyAAQPi1ltvjbFjx0bPnj01hJza32UScEc1AAD/lxPAAAD/QwAMAHysv6MHDRoUBx98cDz//PMxadKk2LRpk8aQ+P1dtv+CJAAAO+cEMADADul0dr/fEgADQHarr6+PioqK2LZtm2aQE/u7dDrtBDAAQAI5AQwA8D+cAAYAPrK6urp4+umnY9q0acJfcm1/5wQwAEACCYABAP6HEw4AwIfW0NAQ06ZNiyeffDK2bt2qIXxkCfgGsAAYACCBBMAAADtkMpmsDoDz8ny9AwCywdvB71NPPRXV1dUaQs7u7wTAAADJJAAGANgh219wCYABYO9qbGyMGTNmxJNPPhmVlZUawieWn5+f9VtkUwIASB4BMADADplMpiGb6yssLDQkANgL0ul0zJo1KyZPnhwbN27UEHaZgoLsfjXX1NTUaEoAAAncZ2oBAMA/NDY2bs/m+gTAALBnpdPpePnll2Py5Mmxdu1aDWGXa9GiRbb/O1BvSgAAySMABgDYoampSQAMAEQmk4nZs2fH448/HuXl5RpCs93fNTY2CoABABJIAAwAsENDQ0NWv+ASAAPA7vV28PvEE0/E6tWrNYTdLtuvgM72G3IAAHiPfaYWAAD8gyugAaD5mjNnTkyaNCmWLl2qGewx2X4FtAAYACCZBMAAADs0NTU5AQwAzcyCBQtiwoQJ8dZbb2kG9nfv0tDQIAAGAEggATAAwA7Z/oJLAAwAu87ChQtj/PjxsXjxYs1gr8n2K6Cz/RckAQB4j32mFgAA/EO2B8AFBQWRl5cX6XTasADgY1q+fHmMGzcu5s+frxnsVXl5eVkfAG/fvt0JYACABBIAAwDs0NDQkPUnHFq1ahXbtm0zLAD4iFauXBmPPPKI4Jes2tclYH8sAAYASCABMADADrW1tXXZXqMAGAA+mnXr1sX48eNj9uzZkclkNISs2tdlu7q6ulqTAgBIHgEwAMAOW7du3ZrtNSbhRSEAZIP169fHY489JvjFvu4TqK6u3mpSAADJIwAGANihqqpKAAwACbdhw4Z4/PHH45VXXommpiYNwb7uE6isrHT1DABAAgmAAQB22LRpU9a/4GrZsqVBAcBOVFVVxcSJE+OFF16IxsZGDSHrJSEA3rRpkxPAAAAJJAAGANhh3bp1WR8AOwEMAP/bli1bYsKECYJfEicJ+7ry8nIBMABAAgmAAQB2WLZsmSugASAhqqurY/LkyTFz5syor6/XEBInCfu6pUuXCoABABJIAAwAsMP8+fOz/gRwcXGxQQHQrNXU1MSUKVPimWeeEfySaEnY173++uu+AQwAkEACYACAHRYsWFCXyWQaUqlUYbbW2Lp1a4MCoFmqq6uLp59+OqZNmxbbtsmkSL5s39el0+mGpUuXbjcpAIDkEQADALxDU1PTtoKCgrbZWp8AGIDmZvv27TF9+vR48sknY+tWt9GSO7J9X9fU1ORfOACAhBIAAwC8Q0NDw9ZsDoBLS0sNCYDm8ndyTJs2LZ566qmorq7WEHJOtu/rGhsb/YsHAJBQAmAAgHeor6+vbNWqVc9src8JYAByXWNjY8yYMSOefPLJqKys1BByVrbv6+rr66tMCQAgmQTAAADv0NDQkNVvmgXAAOSqdDods2bNismTJ8fGjRs1hJyX7fu6bN8XAwDw3gTAAADvUFdXV5XN9ZWWlkYqlYpMJmNYAOSETCYTr732Wjz++OOxatUqDaFZSKVSUVJSktU11tbWVpkUAEAyCYABAN5h27Ztm7K5vvz8/GjVqlXU1NQYFgCJlslkYvbs2fH4449HeXm5htCstGrVKvLz87O6xq1btzoBDACQUAJgAIB3qK6u3pztNZaVlQmAAUist4PfiRMnxpo1azSEZqmsrCzra9y2bVuVSQEAJJMAGADgHaqqqjZle43t2rWLtWvXGhYAiTNnzpyYNGlSLF26VDNo1tq1a5f1NW7atMkJYACALNbQWBgFjQ0REZFKRSavMJre/pkAGADgHSoqKqqyvcYkvDAEgHdasGBBTJgwId566y3NgITs5zZs2CAABgDIYoUFDf9MejMRqab0/+S+AmAAgHdYtWpV1r/oatu2rUEBkAgLFy6M8ePHx+LFizUD3iEJAfDq1aurTAoAIJkEwAAA77BgwYKsD4CdAAYg2y1fvjzGjRsX8+fP1wzYiST8Ql8S9sUAAOycABgA4B2eeOKJjZlMpimVSuVna41OAAOQrVauXBmPPPKI4Bc+QLb/Ql8mk2l64oknNpoUAEAyCYABAN6huro6vX379g1FRUVdsrVGJ4AByDZr166NCRMmxOzZsyOTyWgIJHw/t3379g3V1dVpkwIASCYBMADAu9TV1a0XAAPAB1u/fn089thjgl/Isf1cXV3delMCAEguATAAwLvU1dVVtGnTJmvrKykpiRYtWsT27dsNC4C9oqKiIiZOnBivvPJKNDU1aQh8BEVFRVFcXJz1+2GTAgBILgEwAMC7bN26dV2XLll7ADhSqVR07Ngx1qxZY1gA7FFVVVUxceLEeP755wW/8DF17NgxUqlU1u+HTQoAILkEwAAA71JVVZX1Jx46deokAAZgj9m8eXM8/vjj8cILL0RjY6OGwCfcx9kPAwCwOwmAAQDeZf369Vn/zbMkvDgEIPm2bNkSU6ZMiZkzZ0Z9fb2GwC7QsWNH+2EAAHYrATAAwLusXr066088JOHFIQDJVVNTE1OmTIlnnnlG8Au7WBJ+kW/VqlUCYACABBMAAwC8y9///ves/+aZABiA3aG2tjYmT54czz77bNTV1WkINNN93KuvvioABgBIMAEwAMC7PPzww+t//OMfN6RSqcJsrbFz584GBcAus3379pg+fXpMnTo1tm3bpiGwG2X7CeB0Ot3w8MMPC4ABABJMAAwA8C7V1dXpurq68latWu2TrTV26NAh8vLyIp1OGxgAH1tDQ0NMmzYtnnrqqaiurtYQ2M3y8vKiQ4cOWV1jfX39mtraWptMAIAEEwADAOxEbW3tmmwOgAsKCqJdu3axceNGwwLgI2tsbIwZM2bEk08+GZWVlRoCe0j79u2joCC7X8fV1NSUmxQAQLIJgAEAdmLz5s2r2rdvn9U1duvWTQAMwEeSTqdj1qxZMXnyZH+HwF7av2W7LVu2rDQpAIBkEwADAOzEpk2bVvfp0yera+zWrVvMmzfPsAD4QG8Hv1OmTIkNGzZoCOzF/Vu227BhwxqTAgBINgEwAMBOrFixYvWwYcOyusYkvEAEYO/KZDLx0ksvxZQpU6K83K2usLd17do162tctWrVKpMCAEg2ATAAwE7Mnz9/9ZgxY7K6xiS8QARg78hkMjF79uyYOHFirFnjMB9kiyT8At+8efP8oQEAkHACYACAnRg3btyab37zm5mISGVrjU4AA7Azc+bMiSeeeCKWLVumGZBlEvALfJlx48atNikAgGQTAAMA7MTrr79e29DQsKmwsLBDttZYXFwcZWVlsWXLFgMDIBYsWBDjx4+PJUuWaAZkobKysiguLs7qGhsaGjYuWLCgzrQAAJJNAAwA8B62bt26vF27dh2yucauXbsKgAGauYULF8b48eNj8eLFmgFZLAm3t2zbtm25SQEAJJ8AGADgPVRVVS1t167d0GyusWfPnrFw4ULDAmiGli1bFo899ljMnz9fMyABevbsmfU1VlZWLjUpAIDkEwADALyHdevWLevTp09W15iEF4kA7ForVqyIRx99VPALCZOEfdvatWuXmRQAQPIJgAEA3sPChQuXHX744VldY69evQwKoJlYtWpVjB8/PubOnRuZTEZDIGGSsG9buHDhMpMCAEg+ATAAwHuYNm3a0ksuuSSra+zevXvk5+dHU1OTgQHkqHXr1sX48eNj9uzZgl9IqIKCgkR8A/jpp59eZloAADmw/9QCAICde+ihhzbcd999W/Pz80uzdjNXUBBdunSJNWvWGBhAjqmoqIiJEyfGyy+/HOl0WkMgwbp27RoFBdn9Gq6xsbH6kUce2WBaAADJJwAGAHgf27ZtW15WVnZwNtfYq1cvATBADqmqqoqJEyfG888/74YHyBFJ+P7vtm3blpsUAEBuEAADALyPLVu2LMv2ALhnz57x0ksvGRZAwm3evDkef/zxeOGFF6KxsVFDIIck4fu/W7ZsWWpSAAC5QQAMAPA+1q9fvyzbT2z06NHDoAASbMuWLTFlypSYOXNm1NfXawjkoCTs19avX7/MpAAAcoMAGADgfSxYsGDh0KFDs7rGfffdN1KpVGQyGQMDSJCampqYMmVKPPPMM4JfyGGpVCr23XffrK9z/vz5C00LACA3CIABAN7Ho48++uYFF1yQ1TWWlJRE586dY926dQYGkAC1tbUxefLkePbZZ6Ourk5DIMd17do1WrVqlfV1/vnPf15kWgAAuUEADADwPiZNmlRVX1+/oaioqGM217nvvvsKgAGy3Pbt22P69OkxderU2LZtm4ZAM9GnT5+sr7G+vr7iySefrDItAIDcIAAGAPgAW7duXZTtAXCfPn3ipZdeMiyALNTQ0BDTpk2Lp556KqqrqzUEmpkkXP+8detWp38BAHKIABgA4ANUVFQs7NChw8hsrjEJLxYBmpvGxsaYMWNGPPnkk1FZWakh0EwlYZ9WUVHh+78AADlEAAwA8AGWLl266MADD8zqGnv16hUFBQXR2NhoYAB7WTqdjlmzZsWkSZNi06ZNGgLNWGFhYfTs2TMR+13TAgDIHQJgAIAPMHPmzEWnnnpqdm/qCgqiZ8+esWzZMgMD2EveDn4nT54cGzdu1BAg9tlnn8jPz0/CfnexaQEA5I48LQAAeH+//OUvV6bT6bpsr7NPnz6GBbAXZDKZePHFF+O73/1u3H///cJf4J+ScP1zOp2u++Uvf7nStAAAcocTwAAAH6C6ujpdXV29uE2bNodkc539+vWL6dOnGxjAHpLJZGL27NkxceLEWLNmjYYAO92fJWCvu7i6ujptWgAAuUMADADwIWzYsGFetgfA/fv3NyiAPeTVV1+NSZMmxapVqzQD2KlUKpWI/dmGDRvmmhYAQG4RAAMAfAiLFy9+o2/fvlldY1lZWXTu3DnWr19vYAC7yYIFC2L8+PGxZMkSzQDeV5cuXaK0tDQJ+9z5pgUAkFsEwAAAH8JTTz31+ujRo7O+zv33318ADLAbLFy4MMaPHx+LFy/WDOBD78uSYMqUKa+bFgBAbsnTAgCAD/aLX/xiTWNjY1W215mUF40ASbFs2bK4++674z/+4z+Ev8BHkoTv/zY0NFTee++9q00LACC3OAEMAPAhNDQ0ZDZv3jy/Q4cOI7O5TgEwwK6xYsWKePTRR2P+fDejArm7L9uyZYs/5AAAcpAAGADgQ1q3bl3WB8AdO3aMNm3axObNmw0M4GNYtWpVjB8/PubOnRuZTEZDgI+lbdu20aFDh0Tsb00LACD3CIABAD6kefPmzTvooIOyvs4DDzwwXnrpJQMD+AjWrVsX48ePj9mzZwt+gV2yH0uCuXPnzjMtAIDcIwAGAPiQ/vznP88/77zzsr7OAw44QAAM8CFVVFTEuHHjBL/ALt+PJcHDDz/sBDAAQA4SAAMAfEgTJ06srK2tXdGqVat9srnOgw8+2LAAPkBVVVVMnDgxnn/++WhqatIQYJdKwq0xNTU1yydNmlRlWgAAuUcADADwEWzYsOHvvXr1yuoAuG3bttG1a9dYu3atgQG8y+bNm+Pxxx+PF154IRobGzUE2OW6desWbdu2TcS+1rQAAHKTABgA4CNYuHDha7169Toj2+scMGCAABjgHbZs2RJTpkyJ5557LrZv364hwG6TlO//Lly48O+mBQCQmwTAAAAfwcSJE/9+wgknZH2dBx54YEyfPt3AgGavpqYmpkyZEs8880zU19drCLDbDRgwIBF1jh8//u+mBQCQmwTAAAAfwb333rv6Bz/4wfqioqLO2VznAQccEHl5eZFOpw0NaJZqa2tj8uTJ8eyzz0ZdXZ2GAHtEXl5e9O/fP+vrrK+vX3ffffeVmxgAQG4SAAMAfESVlZVzu3btmtXHgFu1ahX77LNPLFu2zMCAZqWuri6efvrpmDZtWmzbtk1DgD1qn332iVatWmV9nZs2bZpjWgAAuUsADADwES1dunR2tgfAERGDBg0SAAPNRkNDQ0ybNi2eeuqpqK6u1hBgr+2/kuCtt976m2kBAOQuATAAwEc0ffr0v48cOTLr6xw4cGBMmDDBwICc1tDQEM8991w8+eSTUVlZqSHAXt9/JcG0adP+bloAALlLAAwA8BH9x3/8x9JbbrmlOj8/v3U219mrV68oKyuLLVu2GBqQc9LpdMyaNSsmTZoUmzZt0hBgrysrK4tevXplfZ2NjY1b7rnnnmUmBgCQuwTAAAAfUW1tbXrDhg1/7dKly3HZXGcqlYqBAwfGrFmzDA3IGW8Hv5MnT46NGzdqCJA1Bg4cGKlUKuvr3Lhx4yu1tbVpEwMAyF0CYACAj+Gtt956JdsD4IgQAAM5I51Ox8svvxxTpkyJ8vJyDQGyct+VBIsWLXrFtAAAcpsAGADgYxg/fvwrRxxxRNbXedBBB0VBQUE0NjYaGpBImUwmZs+eHRMnTow1a9ZoCJCVCgoK4qCDDkpErY888ogAGAAgx+VpAQDAR/fjH/94ZX19/fpsr7OoqCj69etnYEAivfrqq3HHHXfEz3/+c+EvkNX69esXRUVFWV9nXV1d+b333rvaxAAAcpsTwAAAH9OGDRte6dGjx6ezvc5BgwbFggULDAxIjCVLlsSECRNi/vz5mgEkwuDBgxNR5/r1653+BQBoBgTAAAAf07x5815OQgA8bNiwePjhhyOTyRgakNXefPPNmDBhQixevFgzgMRIpVIxdOjQRNQ6d+7cl0wMACD3CYABAD6m++677+XRo0dnIiKVzXW2bds2evfuHcuWLTM0ICstW7YsHnvsMSd+gUTq06dPtG3bNgmlpu+9996/mhgAQO4TAAMAfEwTJ06s3Lp165LS0tK+2V7rkCFDBMBA1lmxYkU8+uijgl8g0YYMGZKIOqurqxc+/fTTm00MACD3CYABAD6B8vLyl/fff/+sD4AHDx4c48aNMzAgK6xcuTImTJgQc+fOdT09kHhJ+f7vmjVrfP8XAKCZEAADAHwCM2fOfG7//ff/fLbX2a1bt+jWrVuUl5cbGrDXrFu3LsaPHx+zZ88W/AI5oWfPntGlS5dE1DpjxoznTAwAoHkQAAMAfAK33Xbba5dcckl1fn5+62yvdciQIQJgYK9Yv359PPbYY4JfIOck5frnxsbGzbfddts8EwMAaB4EwAAAn0BlZWXThg0b/tqlS5fjsr3WQw89NCZNmmRowJ78MzKeeOKJeP7556OpqUlDgJxz6KGHJqLOioqKV6qrq9MmBgDQPAiAAQA+oXnz5s1MQgDcu3dv10ADe0RVVVVMnDgxXnjhhWhsbNQQICd17949evbsmZT9quufAQCakTwtAAD4ZP77v/97VkQk4kTFpz71KQMDdpstW7bEQw89FLfffns899xzwl8gpw0fPjwRdWYymfTdd9/9gokBADQfTgADAHxCkyZNqtqyZcuCsrKyg7K91uHDh8fjjz9uaMAuVVNTE1OmTIlnnnkm6uvrNQTIealUKg477LBE1Lply5bXp0+fvsXUAACaDwEwAMAusHz58lkDBw7M+gC4S5cu0atXr1i5cqWhAZ9YbW1tTJ48OZ599tmoq6vTEKDZ6N27d3Ts2DEx+1QTAwBoXgTAAAC7wLPPPvvCwIEDr0hCrcOGDRMAA59IXV1dPP300zFt2rTYtm2bhgDNzrBhwxJT61/+8pcXTQwAoHnxDWAAgF3g1ltvnV9fX782CbUefvjhkUqlDA34yBoaGmLq1Klx6623xuOPPy78BZqlJF3/XFdXt/rWW29dYGoAAM2LE8AAALtAQ0NDZs2aNc/16dPns9lea7t27aJPnz6xZMkSgwM+7J9xMW3atHjqqaeiurpaQ4Bmbb/99ou2bdsmotbVq1fPNDEAgOZHAAwAsIs8++yz05IQAEdEHHHEEQJg4AOl0+mYNWtWTJo0KTZt2qQhABFx5JFHJqbW6dOnTzMxAIDmxxXQAAC7yC233PJaQ0NDZRJqHT58eLRo0cLQgJ1Kp9Px3HPPxW233Rb333+/8Bdgh6KiovjUpz6ViFobGho23HLLLXNNDQCg+XECGABgF6murk6Xl5c/t88++5yR7bW2bNkyDj300Hj55ZcNDvindDodL7/8ckyZMiXKy8s1BOBdhgwZEkVFRYmodc2aNc/V1tamTQ0AoPkRAAMA7EIvvvjiM0kIgCMiRo4cKQAGIiIik8nE7NmzY+LEibFmzRoNAXif/VNSzJo161kTAwBongTAAAC70O233/7KOeecszU/P78022sdMGBAtG/f3tWu0My9+uqrMWnSpFi1apVmALyPjh07xgEHHJCIWhsbG6u/8Y1v/NXUAACaJwEwAMAutHLlyob169fP6tat2+hsrzWVSsXhhx8ekyZNMjhohubMmROTJ0+OJUuWaAbAh3D44YdHKpVKRK3r16+fVVFR0WhqAADNU54WAADsWq+++mpirts77LDDDAyamTfffDP+/d//PX7yk58IfwE+pFQqFSNGjEhMva+88sozpgYA0Hw5AQwAsIvddNNNz5166qnV+fn5rbO91m7dukX//v1j4cKFBgc5btmyZfHYY4/F/PnzNQPgIzrggAOic+fOiai1sbFxy4033jjL1AAAmi8BMADALrZy5cqG8vLyGT179vx0Euo9+uijBcCQw5YvXx7jxo0T/AJ8wv1SUpSXlz9TXl7eYGoAAM2XABgAYDeYMWPGUxdccEEiAuAhQ4ZE69ato7q62uAgh6xcuTImTJgQc+fOjUwmoyEAH1ObNm3i0EMPTUy9zz777FOmBgDQvPkGMADAbvDVr371lYaGhk1JqLWgoCCOOOIIQ4McsW7duvj5z38ed955Z8yZM0f4C/AJjRw5MvLz8xNRa0NDw8abbrrpVVMDAGjenAAGANgNKisrm1atWjW9T58+5ySh3qOPPjqefPJJQREk2Pr16+Oxxx6L2bNn+3cZYBdJpVIxatSoxNS7cuXKadXV1WmTAwBo3pwABgDYTaZNm5aY6/c6duwYAwYMMDRIoA0bNsSvf/3r+Nd//dd49dVXhb8Au9CAAQOiY8eOian36aefftLUAAAQAAMA7CZf+9rX5tTX11ckpd6jjjrK0CBBqqqq4v77749vf/vb8eKLL0ZTU5OmAOxiRx55ZGJqra+vX/eNb3zjdVMDAMAV0AAAu0ltbW16xYoVT++///6fT0K9hx56aLRt2zaqqqoMD7LYli1bYsqUKfHcc8/F9u3bNQRgN2nbtm0MGTIkMfUuX778qdraWtc/AwDgBDAAwO70xz/+cUJSas3Pz4/jjjvO0CBL1dTUxKOPPhq33XZb/OUvfxH+Auxmxx57bOTn5yel3Myvf/3rCaYGAECEABgAYLe66667llZXV89PSr1HH310tGjRwuAgi7wd/H7jG9+IqVOnRn19vaYA7GYtWrSIo48+OjH1btmy5Y177rlnhckBABDhCmgAgN3u9ddfn3T44YcPSEKtxcXFcdhhh8XMmTMNDvayurq6ePrpp2PatGmxbds2DQHYgw477LAoKSlJTL3z5s17wtQAAHibE8AAALvZ9773vanpdLohKfWecMIJkUqlDA72koaGhpg6dWrceuut8fjjjwt/AfawVCoVJ5xwQmLqTafT27/73e8+ZXIAALzNCWAAgN1s+vTpWyoqKmZ26dIlER/Y7d69e/Tv3z/efPNNw4M9qKGhIaZNmxZPPfVUVFdXawjAXnLAAQdE9+7dE1NvRUXFczNmzPAXBwAA/+QEMADAHjBr1qxEXcuXpFMvkHTpdDqee+65uP322+PRRx8V/gLsZccff3yi6p0xY8YkUwMA4J2cAAYA2AO++tWvvnT66adXFRYWtk1CvQMHDoyOHTvGhg0bDA92k3Q6HbNmzYrJkyfHxo0bNQQgC3Ts2DEGDhyYmHobGhoqb7755pdMDgCAd3ICGABgDygvL29YsWLF1MRsEvPy4sQTTzQ42A3S6XS8+OKL8Z3vfCfuv/9+4S9AFjnppJMiLy85r8tWrFgxpaKiotHkAAB4JwEwAMAe8qtf/erRiMgkpd6jjjoqysrKDA52kUwmE6+++mp873vfi1//+texdu1aTQHIImVlZXHUUUcl6q+W//7v//6zyQEA8G4CYACAPeQ///M/l1dWVv4tKfUWFhbGMcccY3CwC7wd/P785z+PNWvWaAhAFjruuOOioCA5X0urqqqa/dOf/nS1yQEA8G4CYACAPeill14al6R6jzvuuCgqKjI4+JjmzJkTd911V/z85z+P1au9owfIVkVFRYn7xbcXXnhhnMkBALAzBVoAALDnjB079pkFCxZUFhYWtktCvSUlJXHEEUfE9OnTDQ8+gjfffDPGjx8fb731lmYAJMCRRx4ZJSUliam3oaFh0zXXXPOsyQEAsDMCYACAPai8vLxh6dKlE/v3739xUmo+8cQT49lnn410Om2A8AEWLVoUjz32WCxevFgzABIiLy8vTjzxxETVvGTJkifKy8sbTA8AgJ3ucbUAAGDP+u1vfzsxIjJJqbdjx44xdOhQg4P3sXz58rj77rvjRz/6kfAXIGGGDRsWHTp0SFLJmd/85jePmxwAAO9FAAwAsIf953/+5/JNmza9kqSaTz/99EilUoYH77Jy5cr4yU9+Et///vdj/vz5GgKQMHl5eXHGGWckquZNmza9fM8996wwPQAA3osroAEA9oKXXnpp/KmnnnpYUurt2rVrDBkyJGbPnm14EBHr1q2L8ePHx+zZsyOTyWgIQEINHTo0OnfunKiaX3jhhQkmBwDA+xEAAwDsBZdffvkzS5YsWVdUVNQlKTWfccYZ8be//U3YRbO2fv36eOyxxwS/ADkglUrF6aefnqia6+rq1lx22WXTTQ8AgPcjAAYA2AsqKyub5s+f/8ihhx56dVJq7tatm1PANFsbNmyIxx9/PF555ZVoamrSEIAc8KlPfSq6du2aqJrfeOONcdXV1WnTAwDg/fgGMADAXvL1r399XDqdrktSzb4FTHNTVVUV999/f3z729+OF198UfgLkCNSqVR8+tOfTlTN6XS69pvf/OZjpgcAwAdxAhgAYC+ZMWNG9Zo1a/7Ss2fPxLx97N69ewwcODDmzJljgOS0LVu2xIQJE+KFF16IxsZGDQHIMYceemh069YtUTWvXr36qRkzZlSbHgAAH8QJYACAvejXv/71HyMiUR8SPeuss5wCJmdt27YtHn300bjtttviueeeE/4C5KC8vLwYM2ZM0srO/OpXv/qT6QEA8KH2vFoAALD3fP/733+rqqoqUR/V7dGjR3zqU58yPHJKfX19TJ06Nb71rW/F1KlTo76+XlMActSIESOiS5cuiap506ZNf73rrruWmh4AAB+GABgAYC975plnHkpazWeccUbk5dlKkjvmzZsXjz76aGzdulUzAHJYQUFBnH766Ymre9q0aQ+aHgAAH5a3dgAAe9nYsWNn1tfXr01SzZ07d47DDjvM8ACARBk5cmR06NAhUTXX1dWtHjt27POmBwDAhyUABgDYyyorK5tee+21Pyat7jPPPDMKCgoMEABIhBYtWiTy9O/s2bP/UF1dnTZBAAA+LAEwAEAWuOqqqyY0NjZWJanm9u3bx9FHH214AEAiHHfccdGmTZtE1dzQ0LDxiiuumGh6AAB8FAJgAIAssGDBgrqFCxc+lrS6R48eHYWFhQYIAGS1li1bxsknn5y4uhcuXDhu6dKl200QAICPQgAMAJAlvv71r/8pnU7XJqnmtm3bximnnGJ4AEBWO+2006K0tDRRNTc1NdV+7Wtfe8j0AAD4qATAAABZ4umnn968fPnyxF3xN3r06GjXrp0BAgBZqUOHDnH88ccnru5ly5ZNmD59+hYTBADgoxIAAwBkkbvvvvtPmUymKUk1FxYWxumnn254AEBWOvPMMxP3yYpMJtN41113/dH0AAD4OATAAABZ5Be/+MWatWvXTkta3UcccUT06tXLAAGArNK7d+847LDDEld3eXn5X+6///51JggAwMchAAYAyDIPP/zwn5JWcyqVijPPPNPwAICsMmbMmEilUomr+8EHH/yT6QEA8HEJgAEAsszXv/71NzZs2DAraXUPHDgwDj74YAMEALLCoEGDYsCAAYmru6KiYuatt966wAQBAPi4BMAAAFlo3Lhxv01i3WPGjIm8PFtMAGDvysvLizFjxiSy9j//+c+/NUEAAD7RflgLAACyz/XXXz+nqqrqr0mru1evXnHUUUcZIACwVx1zzDHRvXv3xNW9adOmV2666aa5JggAwCchAAYAyFJ/+tOf7k1i3WPGjInS0lIDBAD2ijZt2sRZZ52VyNofeOCBe00QAIBPSgAMAJClbrrpprlJPAVcXFwcZ555pgECAHvFWWedFS1btkxc3Zs2bXrl5ptvnmeCAAB8UgJgAIAsNm7cuF8lse5Ro0ZF7969DRAA2KP69OkTI0eOTGTtjz322K9MEACAXUEADACQxcaOHTu7qqrqb0mrO5VKxfnnnx+pVMoQAYA9tv/4/Oc/n8j9R2Vl5d+uueaav5kiAAC7ggAYACDLTZ069bdJrLtv374xZMgQAwQA9ojDDjsssTeQTJ48+TcmCADAriIABgDIcpdeeumLVVVVryax9s9//vNRXFxsiADAblVaWhrnn39+Imuvqqr66+WXX/6SKQIAsKsIgAEAEuChhx76WRLrLisri9NPP90AAYDd6qyzzoqSkpIklp753e9+91MTBABgVxIAAwAkwA033DB3w4YNs5JY+3HHHRd9+vQxRABgt+jbt28cddRRiay9oqJi1te//vU3TBEAgF1JAAwAkBA///nPfxoR6aTVnUql4vOf/3zk5dl6AgC7Vn5+flx00UWRSqWSWH76F7/4xX+bIgAAu5q3cAAACXHHHXe8tW7duulJrL13795xzDHHGCIAsEudcMIJ0b1790TWXl5e/pc77rjjLVMEAGBXEwADACTI3XfffW8mk2lKYu1nnXVWtG3b1hABgF2iQ4cOcfrppyey9kwm03T33Xf/3BQBANgdBMAAAAlyzz33rCgvL386ibW3bNkyzj33XEMEAHaJc889N1q0aJHI2tesWTP1xz/+8UpTBABgdxAAAwAkzA9/+MOfZzKZhiTWPnz48Bg0aJAhAgCfyKGHHhpDhw5NZO3pdLrhBz/4wS9MEQCA3UUADACQMPfee+/qRYsWPZDU+i+++OIoKSkxSADgY2ndunVcfPHFia1/4cKFf7jvvvvKTRIAgN1FAAwAkECXXXbZrxsaGjYlsfaysjJXQQMAH9u5554bpaWliay9oaFh4+WXX/47UwQAYHcSAAMAJNDs2bNrXn311V8ntf4jjjgiDj74YIMEAD6SwYMHx+GHH57Y+l955ZX7Zs+eXWOSAADsTgJgAICEOueccx6tqalZmtT6L7roomjZsqVBAgAfSsuWLeNzn/tcYuuvqalZMmbMmMdMEgCA3U0ADACQUJWVlU3Tpk37RVLrb9++fZx++ukGCQB8KGeccUa0b98+sfU/+eST91ZXV6dNEgCA3U0ADACQYOedd960qqqqV5Ja/wknnOAqaADgAx188MFx/PHHJ7b+TZs2vXzBBRc8a5IAAOwJAmAAgIT74x//eG9EZJJYeyqVigsuuMBV0ADAe2rZsmVccMEFkUqlkrqEzP333/8zkwQAYE8RAAMAJNzNN988b9WqVU8ktf6OHTsm+nt+AMDudcEFF0THjh0TW/+KFSse//rXv/6GSQIAsKcIgAEAcsCNN974k6ampq1JrX/kyJExdOhQgwQA/pdPfepTMWLEiMTW39TUVH3zzTf/t0kCALAnCYABAHLAxIkTK//+97//KslruPDCC6OsrMwwAYCIiGjTpk18/vOfT/QaZs+efd/EiRMrTRMAgD1JAAwAkCPOPvvsh2pqapYntf7S0tK46KKLDBIAiFQqFV/84hejtLQ0sWuoqal566yzznrYNAEA2NMEwAAAOaKioqJx0qRJP07yGgYPHhwjR440TABo5o444og46KCDEr2GJ5544qeVlZVNpgkAwJ4mAAYAyCGXXHLJzIqKihlJXsMFF1wQ3bp1M0wAaKZ69uyZ+KufKyoqZnzhC1+YZZoAAOwNAmAAgBzzb//2b/ek0+ntSa2/RYsWceWVV0ZhYaFhAkAzU1hYGF/60pcSvQ9Ip9Pb/+3f/u0e0wQAYG8RAAMA5Jh777139aJFix5M8hq6d+8eZ555pmECQDNzxhlnRPfu3RO9hsWLFz947733rjZNAAD2FgEwAEAO+uxnP/vL2traRL94PPHEE2Pw4MGGCQDNxKBBg+Kkk05K9Bpqa2tXn3vuub80TQAA9iYBMABADlq8eHH9uHHj/j3Ja0ilUnHJJZdE27ZtDRQAclybNm3ikksuiVQqleh1jBs37t8XL15cb6IAAOxNAmAAgBx1+eWXv1RRUTEjyWsoLS2NL3zhC4l/GQwAvLe3f+mrdevWiV5HRUXFM5dffvlLJgoAwN4mAAYAyGE33HDDXU1NTVuTvIaDDjrI94ABIId95jOfiUMOOSTRa2hqaqq+4YYbfmiaAABkAwEwAEAOGzdu3MbZs2cn/jt0p5xyiu8BA0AOOuSQQ+LTn/504tfx17/+9efjxo3baKIAAGQDATAAQI77zGc+81B1dfXCJK8hlUrFF7/4xejQoYOBAkCO6NixY3zpS19K/KceNm/ePO+00057xEQBAMgWAmAAgBxXXV2dfuCBB34UEekkr6O4uDguvfTSyMuzhQWApMvPz4/LLrssiouLk76U9P333/+ftbW1aVMFACBbeHsGANAMXH/99XMWLVr0YNLXsf/++8e5555roACQcOedd1707ds38etYuHDhH7/61a++bqIAAGQTATAAQDNxySWX/Lyurq486es4/vjjfQ8YABJs2LBhccwxxyR+HXV1dWsuvPDC+0wUAIBsIwAGAGgmXnvttdoHHnjguxGRSfI6UqlUfOlLX4oePXoYKgAkTO/evePSSy9N/Hd/IyLzwAMPfO/111+vNVUAALKNABgAoBm5+uqr/7Z06dJHk76OoqKiGDt2bJSWlhoqACRE69at46qrrorCwsLEr2X58uXjrr766r+ZKgAA2UgADADQzJx33nn/r66ubnXS19GhQ4e4/PLLIy/PlhYAsl1eXl5cfvnl0b59+8Svpb6+ft0ll1zyE1MFACBr999aAADQvLz++uu1Dz744Pcj4VdBR0QMGDAgzjrrLEMFgCw3ZsyYOPDAA3NiLY899tgPXnnllW2mCgBAthIAAwA0Q1/5ylf+umbNmqm5sJaTTz45Dj30UEMFgCw1ZMiQOOmkk3JiLWvXrv3LpZde+oKpAgCQzQTAAADN1GWXXfYf9fX1FUlfRyqViksvvTS6d+9uqACQZXr06BFf/OIXI5VKJX4tDQ0Nm6655pofmioAANlOAAwA0EzNmDGj+oEHHvhO5MBV0C1btozrr78+2rZta7AAkCXatWsX1113XbRs2TIXlpN56KGH/nXSpElVJgsAQLYTAAMANGNf+cpX/rpkyZI/58Ja2rZtG1dffXW0aNHCYAFgL2vRokVcffXVOfPLWUuXLn30iiuueNlkAQBIAgEwAEAzd+655/6ktrZ2eS6spXfv3jlzzSQAJNXbn2fYZ599cmI9tbW1y88555wfmywAAEkhAAYAaOYWLFhQ97Of/ezbmUymMRfWM2zYsDjllFMMFgD2kk9/+tMxdOjQnFhLJpNp/NnPfvbtBQsW1JksAABJIQAGACBuvfXWBfPnz78/V9Zz5plnxuDBgw0WAPaw4cOHx2c+85mcWc/8+fN/d+utty4wWQAAkkQADABARESMGTPmvpqamrdyYS2pVCouu+yy6Nmzp8ECwB7Su3fvuPjii3PmUwxbt25ddPrpp//aZAEASBoBMAAAERGxcuXKhh/+8Ie3pdPpnLjisGXLlvEv//Iv0aVLF8MFgN2sS5cucf3110dRUVFOrKepqanmu9/97jfKy8sbTBcAgKQRAAMA8E933XXX0ueff/6eXFlPaWlpXHvttVFWVma4ALCblJWVxXXXXRclJSU5s6aZM2fe/f/+3/9bZboAACSRABgAgP/l5JNPHldeXv50rqynU6dOMXbs2Jw5kQQA2aSoqCiuueaa6NixY86sqby8/MlTTz11gukCAJBUAmAAAP6PSy655K66urq1ubKefffdN6644orIy7P9BYBdJS8vL6688sro3bt3zqyprq6u/JJLLvmh6QIAkOi9uhYAAPBus2bNqn7ooYfujIh0rqxp4MCBcd555xkuAOwi559/fhxyyCG5tKT0gw8+eOesWbOqTRcAgCTLb3tQ9NzpjndbRG15oQ4BADRTEydOXDNmzJi8Tp06Dc2VNfXp0yfy8/PjzTffNGAA+ATOOuusOOmkk3JqTa+//vp9Z5555kTTBQAgCYq7N0Ze6c5/5gQwAADv6dRTT/31li1bXs+lNZ122mlx9NFHGy4AfEzHHntsnHrqqTm1pi1btrxx2mmn/cZ0AQDIBQJgAADeU0VFReONN974jcbGxqpcWtcFF1wQRx55pAEDwEd05JFHxuc+97mcWlNjY2PVzTff/I2KiopGEwYAIBcIgAEAeF9//OMf1z/yyCPfiRz6HnAqlYqLLroohgwZYsAA8CENHTo0LrrookilUrm0rPQjjzzynfvvv3+dCQMAkCsEwAAAfKBLL730hQULFvwupzbCeXnxpS99Kfbff38DBoAPcNBBB8WXvvSlyMvLrVdJCxYs+N2ll176ggkDAJBLBMAAAHwoo0eP/mVVVdXcXFpTYWFhfOUrX4kePXoYMAC8h169esUVV1wRBQUFObWuqqqqOaNHj/6lCQMAkGsEwAAAfCgVFRWNV1111S0NDQ0bcmldJSUlcfPNN8c+++xjyADwLr17946bbropiouLc2pdDQ0NG6666qqv++4vAAC5SAAMAMCHNmHChE3333//tzKZTDqX1lVcXBzXXXdddO/e3ZABYIfu3bvHtddeG61atcqpdWUymfT999//rQkTJmwyZQAAcpEAGACAj2Ts2LGz58+f/9tcW1fr1q3juuuuiw4dOhgyAM1ehw4d4rrrrovWrVvn3Nrmz5//m7Fjx842ZQAAcpUAGACAj+y44477xaZNm17MtXW1a9cubrzxxmjXrp0hA9BstW3bNmf/Pty4ceOLxx13nO/+AgCQ0wTAAAB8ZNXV1emLL774W3V1datzbW0dO3aMG2+8Mdq0aWPQADQ7ZWVlceONN0bHjh1zbm21tbWrL7zwwturq6vTJg0AQC7Lb3tQ9NzZD9LbImrLC3UIAICdWrZsWf327dtfOvbYY0/Ny8trkUtrKykpiaFDh8Zrr70WNTU1hg1As9ChQ4f42te+Fp06dcq5tTU1NW39zne+M/bBBx9cb9IAAOSC4u6NkVe6858JgAEA+NhefPHFzYcccsiyAQMGnBgRqZzaRBcXx5AhQ4TAADQLHTt2jJtuuik6dOiQi8tLjx8//ravfvWrc0waAIBc8X4BsCugAQD4RC688MIZb7zxxm9ycW3t27ePm266KSdPQgHA2zp16pTL4W+88cYbv77wwgufM2kAAJoLATAAAJ/YqFGjfrFhw4aZubi2t0Pgzp07GzQAOadz585x0003Rfv27XNyfRs2bJg5atSo+0waAIDmRAAMAMAnVltbm77sssu+V1dXtzoX19euXbu44YYbomPHjoYNQM7o0KFDXH/99dGuXbtc3Z+s/sIXvvDd2tratGkDANCc+AYwAAC7xJIlS+oj4pVRo0admpeX1yLX1ldcXBxDhw6NuXPnxrZt2wwcgETr0qVL3HjjjTl77XNTU1P1nXfeec0f/vCHdaYNAEAuer9vAAuAAQDYZWbNmlXVo0ePuYceeujoVCqVn2vra9WqVYwYMSIWLVoUlZWVBg5AIu23335x0003RVlZWU6uL51ON/z617++4fbbb3/TtAEAyFUCYAAA9phJkyatPeqoozbsu+++R+fi+goLC2P48OGxbNmy2LBhg4EDkCgDBgyIa6+9Nlq1apWza5w2bdq/XXLJJc+ZNgAAuez9AmDfAAYAYJc77bTTHn/rrbcezNX1FRUVxTXXXBNDhgwxbAASY8iQIXHNNddEUVFRzq5xwYIFvzv99NOfMG0AAJozATAAALvFEUcccc+GDRtm5ur6CgoK4sorr4wjjjjCsAFIwt/LceWVV0ZBQUHOrrG8vPypESNG/LdpAwDQ3AmAAQDYLaqrq9MXXXTRd2pra1fk7GY6Ly8uvvjiOPLIIw0cgKw1atSouPjiiyMvL3dfA23dunXxZz/72e83NDRkTBwAgObON4ABANhtli9fvr2mpuaFY4899uT8/PyWubjGVCoVgwYNikwmE4sWLTJ0ALLK6aefHueee26kUqmcXWN9fX3FDTfccM3UqVOrTBwAgObi/b4BLAAGAGC3evnll7cUFBS8cMQRR4zOy8trkYtrTKVSccABB0SnTp1i7ty5kck4fATA3lVYWBhXXHFFHHPMMTm9zsbGxuo777zzKz/72c9WmzoAAM2JABgAgL1qxowZlb169Xp98ODBJ6dSqfxcXWfPnj2jb9++8fe//z0aGxsNHoC9olWrVnH11VfHwIEDc3qd6XS64be//e2Nt9122wJTBwCguREAAwCw1z3xxBPlw4cPX9OvX79jIyJn76Hs2LFjDBw4MObMmRN1dXUGD8Ae1a5du7jxxhujT58+ub7U9JQpU779xS9+8XlTBwCgOXq/ADhPewAA2FPGjBkz9Y033vh1rq+zZ8+eceONN0bHjh0NHYA9pkuXLnHTTTdF9+7dc36tc+fO/eU555zzF1MHAID/SwAMAMAe9alPfernS5cufTjX19mlS5e49dZb48ADDzR0AHa7gQMHxje/+c3o1KlTzq/1rbfeemjEiBG/MnUAANg5ATAAAHvcsccee8/GjRtfyPV1FhcXx7XXXhsjRowwdAB2m8MPPzyuuuqqaNmyZc6vdePGjc8fffTR95g6AAC8NwEwAAB7XEVFReNxxx339crKyr/l+loLCgrisssui/PPPz9SqZThA7DLpFKpOP/88+PSSy+NgoKCnF/vpk2bXj7ssMNuqaysbDJ9AAB4bwJgAAD2isWLF9efddZZN1dXV7/ZHNZ7/PHHx5e//OUoKioyfAA+sRYtWsSXv/zlOP7445vFequrq98cM2bMN8rLyxtMHwAA3l9+24Oi585+kN4WUVteqEMAAOw2a9asaVi1atWs0aNHH1dQUNA619fbrVu3OOCAA2LevHlRX1/vAQDgYykrK4trrrkmDjrooGax3rq6uvKxY8de89RTT202fQAA+Ifi7o2RV7rznwmAAQDYq+bNm1ezevXqZ04++eTjCwoKSnN9ve3atYuRI0fG8uXLY+PGjR4AAD6S/v37x0033RRdu3ZtFuutr69fd9111335T3/6U4XpAwDA/xAAAwCQ1ebMmbMtlUq9fOSRR56Ul5eX83ckt2jRIkaMGBG1tbWxdOlSDwAAH8rxxx8fX/rSl5rN5wQaGxu33HXXXdf99Kc/XWn6AADwvwmAAQDIejNnzqzs2bPn64MHDz4plUrl5/p6U6lUHHLIIdGqVatYsGBBZDIZDwEAO5WXlxef/exn4/TTT49UKtUs1pxOp7f//ve//+o3vvGN1z0BAADwfwmAAQBIhEmTJpXvs88+8wYOHHhCKpUqaA5r3m+//WLAgAExd+5c3wUG4P8oKyuL6667LoYNG9Zs1pxOp7f/8Y9/vOmqq676qycAAAB2TgAMAEBiTJw4cc3BBx+85MADDzwulUrlNYc1t2/fPoYOHRqLFi2KLVu2eAgAiIiIffbZJ66//vro2bNns1lzJpNpnDBhwm1f/OIXn/cEAADAexMAAwCQKI8++ujy/fff/42DDjrohOZwHXRERHFxcRx11FHR2NgYb731locAoJkbPXp0XHHFFVFSUtJs1pxOpxsefvjhr15yySWzPAEAAPD+BMAAACTO+PHjVw0cOHDpAQcccGxzOQmcSqViwIAB0aVLl3jjjTeiqanJgwDQzBQVFcWll14aJ554YrP53m/EP07+Pv7447dffPHFMz0FAADwwQTAAAAk0iOPPLLs0EMPXbb//vs3mxA4IqJHjx4xZMiQePPNN2Pr1q0eBIBmonv37vEv//IvccABBzSrdWcymaYnnnji9s997nPPeAoAAODDEQADAJBYDz/88NJjjjlmY+/evY+KiGZzFKq0tDSGDx8eq1evjvXr13sQAHLcwIED45prrol27do1t6VnZsyY8YOzzjprqqcAAAA+PAEwAACJdv/99795zDHHVO6zzz5HRDMKgVu0aBGHHXZYtGzZMhYuXBjpdNrDAJBjCgoK4pxzzonzzz8/WrRo0dyWn37uuefuOuWUUyZ4EgAA4KMRAAMAkHi///3v5w8bNmxF3759j2lO10GnUqno27dvDB06NBYvXhxbtmzxMADkiJ49e8YNN9wQgwcPblbf+434x7XPU6ZM+fbpp58+2ZMAAAAfnQAYAICc8OCDDy4ZNmzYin79+jWrEDgionXr1nHEEUdEfX19LF261MMAkGCpVCpOOOGEuOKKK6JNmzbNbv07wt9vnXPOOX/xNAAAwMcjAAYAIGc89NBDS4YNG7a8X79+xza3EDg/Pz8OPvjg6NWrV8yfPz8aGho8EAAJU1JSEpdffnmccMIJkZ+f3+zWn8lkGp944olvffazn53maQAAgI9PAAwAQE556KGHlo4cOXJdnz59RqWa252ZEdG1a9cYNmxYLFu2LCorKz0QAAnRt2/fuO6662K//fZrluvPZDLpp59++rvnnHPO054GAAD4ZATAAADknD/96U+LDj300KX7779/s7sOOiKiuLg4jjzyyCgpKYk333wz0um0hwIgSxUUFMRnP/vZuPDCC6OkpKRZ9iCdTjc88sgjt5x//vnTPREAAPDJCYABAMhJDz/88NId3wQelUqlmt09mqlUKvr06RMHH3xwLFy4MLZt2+ahAMgynTt3jrFjx8bQoUOjGV5aERH/CH+feOKJ2y+88MLnPBEAALBrCIABAMhZDz300JIePXq8NmjQoGPz8vJaNMcetG3bNkaNGhVNTU2xZMkSDwVAFkilUjF69Oi48soro0OHDs22D01NTdt++9vf/stll132oqcCAAB2HQEwAAA5bdKkSeXdu3efM3jw4GYbAufn58eAAQOiV69esWDBgti+fbsHA2Avad26dVx66aVx/PHHR35+frPtQ2NjY/WvfvWrf7nuuute81QAAMCuJQAGACDnTZ48eW1jY+OMI4444uiCgoKS5tqHrl27xqhRo2Lbtm2xcuVKDwbAHpRKpWLUqFExduzY6NWrV7PuRX19/fo77rjjK9/61rcWejIAAGDXEwADANAsPP/881UbNmx45rjjjjuqsLCwrLn2obCwMAYNGhT77bdfLF68OGpraz0cALtZ+/bt44orrogTTzwxCgub9/uU2tralTfffPPVP/nJT1Z7MgAAYPcQAAMA0Gz87W9/27p27doZJ5xwwsjCwsK2zbkXnTp1ipEjR0Z1dbXTwAC70ciRI+Pqq6+OHj16NPte1NTULL/hhhuu/e1vf7vOkwEAALuPABgAgGbltdde2zpv3rynTznllKFFRUWdmnMvCgsL49BDD4399tsvFi1a5DQwwC709qnfk08+udmf+o2I2Lx587yLL774unHjxm30dAAAwO71fgFwat9zYsTOftC4LmLjq610DwCAxOrVq1fhs88++69du3Y9QTciGhoaYurUqTF58uRobGzUEICPqaCgIE499dQYPXq04HeH8vLyp4499tjvrly5skE3AABg9+swrDYKuuz8ZwJgAAByWuvWrfNeeumlm/fdd9+zdeMfVq9eHffff38sWbJEMwA+ov322y8uuugi1z2/w8KFC38/fPjwnzY0NGR0AwAA9gwBMAAAzd7zzz9/8aGHHnp1RKR0IyKTycTMmTPjz3/+c9TV1WkIwAcoKSmJ8847L0aMGBGplL9Kdki//PLL9xx77LEPagUAAOxZ7xcA+wYwAADNwn333Tfn+OOP39yrV6/DQwgcqVQqevfuHcOHD49169ZFRUWFhwTgPRxyyCExduzY6N+/v/B3h0wm0/jMM8/828knnzxONwAAYM97v28AC4ABAGg2fve7370xePDgJf369Ts6lUrl60hEcXFxjBgxInr06BFLly6N2tpaTQHYoUOHDvGFL3whzjzzzCguLtaQHZqammoeeOCBWz73uc9N1w0AANg7BMAAALDDww8/vKygoOC54cOHH1FQUFCqI//QrVu3OO6446K0tDQWL14cTU1NmgI0Wy1btoxzzjknLr300ujevbuGvENtbe2K22677arbbrvtDd0AAIC9RwAMAADv8Oyzz25avHjx0yeddNKQoqKiTjryD3l5edGnT58YOXJkbN26NVatWqUpQLNz+OGHx1e+8pUYMGBA5OXlacg7VFVV/e3CCy+8/oEHHvDdAAAA2MsEwAAA8C7z58+vefbZZ58+44wz+hcXF/fSkf/RsmXLGDJkSOyzzz6xdOnSqKmp0RQg53Xs2DG++MUvximnnBItW7bUkHdZt27dMyeffPI3Xn755W26AQAAe9/7BcCpfc+JETv7QeO6iI2vttI9AAByWmFhYer555//0sEHH3y5bvxfTU1N8fzzz8f48eOjurpaQ4Cc07p16zjzzDPjyCOPdOJ35zJ///vff3rMMcfc39DQkNEOAADIDh2G1UZBl53/TAAMAAARMWnSpM8cc8wxt6RSKdfg7ERNTU1MmTIlpk2bFg0NDRoCJF5hYWGccsopcdJJJ0VRUZGG7EQ6na6fOnXqd88555y/6AYAAGSX9wuAXQENAAAR8Yc//GHhfvvt98aAAQOOysvLkwS8S2FhYQwYMCCGDh0amzZtinXr1mkKkFiDBw+Oq666KoYOHRoFBQUashONjY1Vv//972/5whe+MEs3AAAg+/gGMAAAfAgTJkxYXV1dPf3II4/8VGFhYTsd+b9KS0vjsMMOi/79+8eaNWti8+bNmgIkRu/evePyyy+PU045JUpLSzXkPWzdunXxLbfccs33vve9hboBAADZyTeAAQDgI+jTp0+LJ5988us9evQ4TTfe3/z58+ORRx6JlStXagaQtXr16hXnnHNODBgwQDM+wKpVq5444YQTfrBy5Ur3/QMAQBbzDWAAAPgYnnnmmfOHDx9+fSqVytON95bJZGL27Nkxbty4qKio0BAga3Tu3DnOOuusGDp0aKRSKQ15/z/Lm2bNmvXDk08++THdAACA7OcbwAAA8DH85je/eX3//fd//cADDzzSd4HfWyqViu7du8cxxxwT7dq1i2XLlkV9fb3GAHtN27Zt49xzz42LL744evToIfz9AI2NjdUPPvjgLZ/97Gf/ohsAAJAMvgEMAAAf0/jx41dFxPOHHXbYiMLCwjIdeW95eXnRu3fvOOqoo6KgoCBWrlwZjY2NGgPsMcXFxXHKKafEl770pejbt2/k5bnA4YPU1tau+MEPfnD9LbfcMk83AAAgQf/94xvAAADwyQwePLjVo48++s1u3bqdpBsfTn19fTzzzDMxderU2LZtm4YAu01ZWVmceuqpceSRR0ZRkQsbPqyVK1c+/ulPf/pHixcvdm0DAAAkjG8AAwDALvLkk0+edeSRR96USqVcl/MhCYKB3eXtE7/HHnus4PcjyGQyDbNmzfoP3/sFAIDk8g1gAADYRX7/+98v6NGjx2uHHHLIyPz8fL8x+SEUFBREv3794qijjoq8vLxYtWqVq6GBT6Rly5ZxwgknxBVXXBEHHXRQFBQUaMqH1NDQsOG3v/3t1z7/+c8/oxsAAJBcroAGAIBd7Lzzzut4991339m2bdvBuvHR1NTUxLPPPhvTpk2LLVu2aAjwoZWVlcXxxx8fxxxzTBQXF2vIR1RVVfW3a6+99vZHHnlkg24AAECyuQIaAAB2g06dOhVMmzZtbN++fT8XESkd+WgaGhri+eefjyeffDI2bJBFAO/7522cdNJJccQRR0RhodvKPobMokWL/nTsscf+pLKyskk7AAAg+QTAAACwG/3hD38Ydfrpp99WUFDQRjc+unQ6Ha+++mpMnTo1Vq5cqSHAP/Xq1StOOeWUGDp0aOTl5WnIx9DY2Fg1YcKEOy666KKZugEAALlDAAwAALvZaaed1vbee+/9docOHUbqxse3fPnymDZtWrz88suRTqc1BJqhvLy8OOyww+L444+P3r17a8gnsHHjxue//OUvf3fSpElVugEAALlFAAwAAHtAYWFh6qmnnjpv+PDh16RSKXeUfgIbNmyIGTNmxHPPPRc1NTUaAs1AcXFxjBo1Ko4++ujo2LGjhnwCmUym4ZVXXvl/J5100kMNDQ0ZHQEAgNzzfgFwftuDoufOfpDeFlFb7p0VAAB8WOl0On7zm9+8Xlpa+uLgwYM/VVhYWKYrH09xcXEMGDAgjj322GjTpk2sXbs2amtrNQZyUIcOHeKMM86ISy+9NAYOHBjFxcWa8gnU1tau+slPfnLjxRdf/IybFAAAIHcVd2+MvNKd/8wJYAAA2A1OPPHENvfdd9+tnTp1Olo3PrnGxsb429/+Fs8++2wsWrRIQyAH9OvXL44++ugYNmxYFBQUaMguUFFR8cwXv/jFf5s+ffoW3QAAgNzmCmgAANhLHn744RNGjx799YKCgta6sWusX78+Zs6cGc8//3xUV1drCCRIaWlpHHnkkXHUUUdF586dNWQXaWxs3DJ16tS7PvvZz/5FNwAAoHkQAAMAwF50ySWXdP3+97//rXbt2g3VjV2nsbExXnvttXjuuedi/vz5GgJZbMCAATFq1KgYPHiw0767WFVV1atf//rXv/e73/1urW4AAEDzIQAGAIC9rF27dvlTp0699OCDD740lUrl68iutXz58nj++efj5ZdfjpqaGg2BLFBSUhLDhw+PI444Inr37q0hu1gmk2mcN2/efSeeeOJvq6urfewXAACaGQEwAABkia9//ev73Xjjjf9aWlraXzd2vXQ6HW+++WY899xz8dprr0VjY6OmwB5UUFAQgwcPjlGjRsUBBxwQeXl5mrIbVFdXL/zP//zPf/3BD36wRDcAAKB5EgADAEAWOfjgg1v9+c9/vrZ3795jIiKlI7tHZWVlvPjii/HCCy/EunXrNAR2o65du8bIkSPj8MMPj7Zt22rI7pNZunTpn88888z/t3jx4nrtAACA5ksADAAAWejuu+8eePHFF9/WqlUrd6PuZuXl5fHqq6/GSy+9FOvXr9cQ2AU6d+4cI0aMiGHDhkW3bt00ZDerqalZ9tvf/vbOm266aa5uAAAAAmAAAMhS/fr1K3r44Ycv79+//4WpVMpdqXvA8uXL46WXXoqXX345qqurNQQ+grKyshg+fHiMGDHCd333kEwmk164cOEfzj777F8sXbp0u44AAAARAmAAAMh6P/3pT4d97nOf+2bLli176Mae0dDQEHPnzo2//vWvMXfu3Ni+Xa4CO9OyZcsYNGhQDBs2LA455JAoKCjQlD2ktrZ21R//+Mc7rr322r/rBgAA8E4CYAAASIA+ffq0ePTRR69wGnjPS6fTsXTp0nj11VedDIaIaNu2bQwbNiyGDRsWffr0ibw8fyTtSZlMpuG11177+ZlnnvmnioqKRh0BAADeTQAMAAAJ8uMf//jQCy644JutWrXaRzf2vLdPBs+ePTvmzp0bdXV1mkKzUFZWFoMHD45hw4ZF//79Iz8/X1P2gpqammX333//nTfccINv/QIAAO9JAAwAAAnTrl27/HHjxp37qU996qq8vDwb870kk8nEihUrYu7cuTFnzpxYsWJFZDIZjSEnpFKp6Nu3bwwbNiwGDRoUHTt21JS9qKmpqfbVV1/92ZgxY/5cWVnZpCMAAMD7EQADAEBCffnLX+5x++23f7V9+/aH68bet2XLlnjjjTdizpw5MW/evKivr9cUEqVly5Zx8MEHx6BBg+KQQw6J0tJSTckCGzdufPG73/3uv//iF79YoxsAAMCHIQAGAIAEKywsTE2cOPGMkSNHXlNQUNBaR7JDXV1dvPnmm/HGG2/EG2+8EevXr9cUslKXLl3ioIMOioMOOigOOOCAKCoq0pQs0djYuGXmzJk/PvPMMyc2NDS4XgAAAPjQBMAAAJADjjzyyNY/+9nPrujbt++5EZGnI9mluro6Fi5cGPPnz4958+ZFZWWlprBXtGvXLg455JAYMGBA9O/fP1q39nsjWSj91ltv/fmqq676xaxZs6q1AwAA+KgEwAAAkEN++ctfjhgzZsyNrVq16q0b2SmdTsfKlStj0aJFsXDhwli8eHFs27ZNY9gtSkpKol+/ftG/f//Yf//9o1evXpGX53dEslVNTc3yRx999EdXXnnlK7oBAAB8XAJgAADIMd26dSt8+OGHPzd48ODL8vPzbdyzXCaTiTVr1sTChQtj0aJFsWjRotiyZYvG8LGUlZVF//79/xn6du/ePVKplMZkuaampprXXnvtV2PGjHmgoqKiUUcAAIBPQgAMAAA56rjjjiv7r//6r8tdC508mzdvjuXLl8eKFSti+fLlsXjx4qipqdEY/pfi4uLo169f9O7dO/bZZ5/Yd999o6ysTGMSJJPJpJcsWfLn66677pfTp0/3mx8AAMAuIQAGAIAc99Of/nTIueeee3NpaWlf3UimxsbGWLlyZSxdujSWLVsWy5cvj3Xr1kUmk9GcZiKVSkWXLl1in332iT59+kSfPn2iV69eUVBQoDkJtXXr1sUPPvjgj6699tq/6wYAALArCYABAKAZaNeuXf64cePOGTp06BUFBQWtdST56uvrY+XKlf88KbxixYpYu3ZtpNNpzUm4vLy86Nq1a+yzzz7//KdXr17RsmVLzckBjY2NW/7617/+4pxzznm0srKySUcAAIBdTQAMAADNyIknntjmnnvuuXzfffcdk0qlHB3MMdu3b481a9bEmjVrYu3atbF27dooLy+PDRs2CIazUF5eXnTs2DG6desWXbt2jW7dukW3bt2iR48eUVhYqEE5JpPJNC5ZsuRR1z0DAAC7mwAYAACaoa9+9av7Xnfdddd16NDhCN3IfY2Njf8MhNetWxfr1q2LioqKWLduXWzbtk2DdrPS0tLo3LnzP//p0qVLdO3aNbp27eoK52Ziw4YNM//rv/7rxz/60Y+W6wYAALC7CYABAKAZ++UvfznirLPOuq64uNj3gZupmpqaWL9+/T//qaioiMrKyqisrIxNmzZFY2OjJn2AgoKCaN++fbRr1y7at28fHTt2jC5dukSnTp2ic+fOUVxcrEnN1NatW98aP378PVdcccXLugEAAOwpAmAAAGjm2rVrl//ggw+eOWLEiCsLCwvb6gjvtHnz5n+GwZs2bYrKysqorq6OLVu2xJYtW6K6ujqqq6sjk8nk3NpTqVS0bt06WrduHWVlZdGmTZsoLS39X2Fvu3btok2bNh4U/peGhobKl1566efnnHPO+OrqavevAwAAe5QAGAAAiIiIoUOHFt97770XHHjggRfk5+c7ssiHlk6n/xkEV1dXR01Nzfv+k8lkora2NtLpdNTX10dTU1PU1dXt0u8U5+XlRcuWLSM/Pz+KiooiLy8vWrVqFalUKoqLi3f6T0lJSbRq1eqfgW9paWnk5eUZMB9aU1NTzYIFC/745S9/+Y+zZ8+u0REAAGBvEAADAAD/y2mnndb2rrvuurRPnz5n5+XlFeoIe9LbgfDbtm/f/r7XUBcUFESLFi3++b/fDnxhT8pkMg1LliwZd8stt/xq0qRJVToCAADsTQJgAABgp0477bS2d95554X777//5wTBAP9XJpNpWLhw4QO33nrrHwS/AABAtni/ADi/7UHRc2c/SG+LqC33/gcAAHLZokWL6u69995X0un0swcddFCnkpKS3roC8A8VFRUz/7//7/+77aKLLpq6aNGiOh0BAACyRXH3xsgr3fnPBMAAAEDMnDmz8u67736qqalpWr9+/Ypbt27dN5VKpXQGaG4ymUx6zZo1U+65555/Peeccx6cOXNmpa4AAADZRgAMAAB8KDNnzqz88Y9//Gw6nZ4uCAaak7eD37vvvvtfzz///McEvwAAQDYTAAMAAB+JIBhoLgS/AABAEgmAAQCAj+XtILisrOyFvn37diwuLu4VEYJgIBdkKioqnrv33nu/PWbMmEcEvwAAQJK8XwCc2vecGLGzHzSui9j4aivdAwAA/unqq6/u8ZWvfOX8Pn36nJWXl9dCR4CkSafT9UuXLh3/X//1Xw/84he/WKMjAABAEnUYVhsFXXb+MwEwAADwkZ1xxhntb7/99rMPPPDA8/Pz81vrCJDtmpqaqhcsWPDgd77znUcmTpzotC8AAJBoAmAAAGC3GD58eMkPf/jDzwwePPjioqKijjoCZJv6+voNr7322u9vvPHGx2fPnl2jIwAAQC4QAAMAALvV0KFDi++5556zDjnkkPOKioq66giwt9XV1a19/fXXH7z++uvHC34BAIBcIwAGAAD2iFatWuXdc889w0455ZTzO3bseJSOAHtYZsOGDbOmTJny4PXXX/9qbW1tWksAAIBcJAAGAAD2uH/913/tf/7555/dq1ev0/Ly8lroCLC7pNPp+pUrV05+4IEHHvnOd76zSEcAAIBcJwAGAAD2mjPOOKP97bfffvYBBxzw2YKCgjY6AuwqjY2NVW+++eafv/e97z06YcKETToCAAA0FwJgAABgrxs+fHjJ97///dGDBg0aU1paur+OAB9XdXX1wtdee+3Rr371q1Nfe+21Wh0BAACaGwEwAACQVb761a/ue8EFF3y6b9++ZxUUFLTWEeCDNDY2bnnrrbfG/+EPf5j4ox/9aLmOAAAAzZkAGAAAyEpDhw4t/sEPfnDy4MGDz27dunV/HQHerbq6+s2XX375weuuu+7ppUuXbtcRAAAAATAAAJDlCgsLU3ffffeQ0aNHn9G1a9fj8vLyinQFmq90Ol1XXl4+bcqUKROuvfbav+sIAADA/yYABgAAEqNPnz4t/v3f/33UyJEjz2rfvv2nIiKlK9AsZDZt2vTXF1544bGvfe1rzzntCwAA8N4EwAAAQCJddNFFXa6++uqTDzzwwLNbtmzZTUcg99TV1a1ZsGDBuJ/+9KdP3n///et0BAAA4IMJgAEAgETr1q1b4d13333k4YcffmqHDh2OyMvLK9QVSK50Ot2wcePGWbNmzZp8/fXXz6qoqGjUFQAAgA9PAAwAAOSMo48+uvWtt956/CGHHHJKu3btBkdEnq5AIqQrKytfmzdv3uQ777xz+owZM6q1BAAA4OMRAAMAADnpuOOOK/vGN75x/CGHHHJa27ZtB4bvBUO2yVRVVc2dN2/epO9///vTpk+fvkVLAAAAPjkBMAAAkPNuu+22vmedddZJffr0Oa5Vq1a9dQT2ntra2uXLly+f/uijjz51xx13vKUjAAAAu5YAGAAAaFa+9KUvdbv44ouP7t+//wlOBsMekamqqpq7cOHCv/z+97+fcd9995VrCQAAwO4jAAYAAJqtSy65pOtll112jDAYdrl0VVXVvIULF/7lV7/61bO/+93v1moJAADAniEABgAAiIirr766x/nnnz9q//33P7JNmzZDUqlUga7Ah5fJZBoqKyv/vnjx4uf+9Kc/zbr33ntX6woAAMCeJwAGAAB4l379+hV97WtfGzRy5MhRPXv2PLaoqKizrsD/VV9fv37VqlXPvPDCC8/9+7//+5zFixfX6woAAMDeJQAGAAB4H61bt8678847Bx599NFHde/efURpaen+4apomq/M1q1bF69Zs+bF5557btY3v/nNOdXV1WltAQAAyB4CYAAAgI9g8ODBrcaOHXvI8OHDD+vevfvw1q1bHxACYXJXprq6+s01a9a88sorr7z8k5/8ZN5rr71Wqy0AAADZSwAMAADwCVx//fX7nHHGGYf169dvePv27Yfm5+e31hWSrLGxsXrjxo2vvvXWWy+PHz/+lR//+McrdQUAACA5BMAAAAC70Je//OUe55xzzvA+ffoM7tix45CioqKuukI2q6+vX7t27doXFy9ePGfixImv3Xvvvat1BQAAILkEwAAAALvRl7/85R6f+cxnBvfr129Qly5dDm/ZsqVAmL2qrq5u7bp16wS+AAAAOUoADAAAsIe0atUq75prrtnn2GOPPXi//fY7uH379oeUlpb2TaVS+brDbpKuqalZtnHjxnlvvfXW3GeffXbef/3Xfy2vra1Naw0AAEBuEgADAADsRQceeGDLq6+++oAhQ4Yc3LNnz4Pbtm17sGuj+biampqqq6qqXi8vL583Z86ceb/85S/nvfjii1t1BgAAoPkQAAMAAGSZoUOHFn/xi1/cf9CgQQf26NHjwHbt2h3YqlWr3qlUKk932CFdU1OzvLKycsHq1asXzJkzZ8Gf//znJTNmzKjWGgAAgOZNAAwAAJAAxx13XNkFF1xw4MEHH3xA165dDywtLd23pKRkn1QqVag7uS2TyTRs27ZtRXV19dJ169YtfOONNxZOmDBh4YQJEzbpDgAAAO8mAAYAAEiw8847r+OJJ57Yp3///vt16dKlT5s2bfZr3bp1v/z8/GLdSZampqaa6urqxZs3b16ybt26pQsXLlzy9NNPL33ooYc26A4AAAAflgAYAAAgx7Rr1y7/kksu6TFkyJCe++67b89OnTr1Kisr61VcXNyzZcuW3VKpVL4u7R2ZTKaprq6uvKamZtWWLVtWVlRUrFy6dOnK2bNnr7r//vvXVFZWNukSAAAAn4QAGAAAoBnp1KlTwec+97luQ4cO7bnPPvv0aNeuXafWrVt3Li4u7tqyZcvORUVFnfLy8lro1MeTTqe319fXr6+rq6uoqalZW11dvb6ysnL9ihUrVr/66qurHnzwwbUVFRWNOgUAAMDuIgAGAADgfznjjDPaH3bYYZ369OnTuUuXLp3Kysral5SUtC0uLu5YVFTUrqioqG2LFi065OfnlzaXnjQ1NW3dvn37xvr6+qr6+vrKmpqaDdu2bavasmXLpnXr1lUsXbp0/Ysvvrh+4sSJlZ4gAAAA9iYBMAAAAB9Lr169CkeNGtXuoIMOatexY8ey9u3bl7Zp06Z1SUlJWXFxcetWrVq1btGiRVlRUVHrwsLC1hGRX1hYWBoR+QUFBSV5eXkFeXl5u/0/LtPpdG06nW5sbGzcFhFNDQ0NW3f83+r6+vrq7du3b6mtra2uqamp3rZtW/XmzZurN23aVL1hw4YtCxYsqJo1a1bl0qVLt5s4AAAASSAABgAAYK/q169fUffu3Vvss88+xSUlJQVv//8LCwtT3bp1+8BTxuXl5VsbGhoyb//vbdu2Na5YsaJmzZo12xcvXlyvwwAAADQn7xcAF2gPAAAAu9vixYvrdwS11boBAAAAu0+eFgAAAAAAAADkBgEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4o0AIAAAAAAACA5GhoLIyCxoaIiEilIpNXGE1v/0wADAAAAAAAAJAghQUN/0x6MxGppvT/5L6ugAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAIb/v5272ZHiusM4/FZ1NUkz9sQwOF4EyZJtpJCwysa5jSy4n1xPEqRIuQFvvfGSgIwBOzGRQAQERnx0d1UW0cgWGvKxsMGvnmfVdc7/1OJsf+oCAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoMY3JP//9K8My551lzpAk293a7QAAAAAAAAD8iIw3r+SL7TpPxuSt4/ibJJuz20QDBgAAAAAAAHhzrJPp6NvHYcyyjLl7dJTPbl/Jp6sPLufSsM+5ec7q5YOrF0OeP/SVaAAAAAAAAIA3weH7u6zfm79dWDIMSw6225w785vsx3XyzasOby5ssz69c4sAAAAAAAAAr9n69C6bC9sT93a7rKdnORin5Otxynzi1JQcfiwCAwAAAAAAALxO69O7HH68TaaT98cp85R8vbp3Nfszv8q0LHn7xMF1sjk/ZzUPmZ/MmWefhAYAAAAAAAD4oayPdjn7223Gn7x6ZrXPnetX8mBKkpv3cufDd/Pufn5FL56SzcVtNheT3dNt8tQlAwAAAAAAAHyv1sm0ySv/9XtsNWZ3I/lHkgzHi7/4XY7WYz5yiwAAAAAAAAA/Ivtcv/3nPEyS1fHa42t5+vNLyX7JoRsCAAAAAAAAePPt1/nbV3/KvePn1Xc371/NYxEYAAAAAAAA4M0yTHk2rvNo2WdzvHZqzN9v/SF3vju3evng/at5fPDLPDu1yuGyZHSVAAAAAAAAAK/XOGe4ueSvZ4e8M8xZbVe5ceuPufvy3Oqkw4+v5emDX+fuuTlLhhwsEYIBAAAAAAAAXpclGR8OuXP0TR4cPM/9z/+SRyfNDf/1TZezOp/87KdjzizJZkhO7edMy/w/nAUAAAAAAADg/zaMWcZkP8/ZLsmLacr2/MV8+cnvs/tP5/4FmLjAq1ifcioAAAAASUVORK5CYII=";function H0($,q,Q){if(typeof $==="string"&&!isNaN(Number($)))$=Number($);if(typeof $==="number"&&$<100)return v0($);if(typeof $==="number"&&$>=100)return $;if(typeof $==="string"&&$.includes("%")){if(q&&q==="X")return Math.round(parseFloat($)/100*Q.width);if(q&&q==="Y")return Math.round(parseFloat($)/100*Q.height);return Math.round(parseFloat($)/100*Q.width)}return 0}function k5($){return $.replace(/[xy]/g,function(q){let Q=Math.random()*16|0;return(q==="x"?Q:Q&3|8).toString(16)})}function k0($){if(typeof $>"u"||$==null)return"";return $.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function v0($){if(typeof $==="number"&&$>100)return $;if(typeof $==="string")$=Number($.replace(/in*/gi,""));return Math.round(L0*$)}function Y0($){let q=Number($)||0;return isNaN(q)?0:Math.round(q*w8)}function S1($){return $=$||0,Math.round(($>360?$-360:$)*60000)}function g7($){let q=$.toString(16);return q.length===1?"0"+q:q}function A7($,q,Q){return(g7($)+g7(q)+g7(Q)).toUpperCase()}function R0($,q){let Q=($||"").replace("#","");if(!j7.test(Q)&&Q!==G2.background1&&Q!==G2.background2&&Q!==G2.text1&&Q!==G2.text2&&Q!==G2.accent1&&Q!==G2.accent2&&Q!==G2.accent3&&Q!==G2.accent4&&Q!==G2.accent5&&Q!==G2.accent6)console.warn(`"${Q}" is not a valid scheme color or hex RGB! "${Q2}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`),Q=Q2;let K=j7.test(Q)?"srgbClr":"schemeClr",J='val="'+(j7.test(Q)?Q.toUpperCase():Q)+'"';return q?`${q}`:``}function AB($,q){let Q="",K=Object.assign(Object.assign({},q),$),J=Math.round(K.size*w8),Z=K.color,G=Math.round(K.opacity*1e5);return Q+=``,Q+=R0(Z,``),Q+="",Q}function B2($){let q="solid",Q="",K="",J="";if($){if(typeof $==="string")Q=$;else{if($.type)q=$.type;if($.color)Q=$.color;if($.alpha)K+=``;if($.transparency)K+=``}switch(q){case"solid":J+=`${R0(Q,K)}`;break;default:J+="";break}}return J}function a2($){return $._rels.length+$._relsChart.length+$._relsMedia.length+1}function b7($){if(!$||typeof $!=="object")return;if($.type!=="outer"&&$.type!=="inner"&&$.type!=="none")console.warn("Warning: shadow.type options are `outer`, `inner` or `none`."),$.type="outer";if($.angle){if(isNaN(Number($.angle))||$.angle<0||$.angle>359)console.warn("Warning: shadow.angle can only be 0-359"),$.angle=270;$.angle=Math.round(Number($.angle))}if($.opacity){if(isNaN(Number($.opacity))||$.opacity<0||$.opacity>1)console.warn("Warning: shadow.opacity can only be 0-1"),$.opacity=0.75;$.opacity=Number($.opacity)}if($.color){if($.color.startsWith("#"))console.warn('Warning: shadow.color should not include hash (#) character, , e.g. "FF0000"'),$.color=$.color.replace("#","")}return $}function XB($,q,Q){var K,J;let Z=2.3+(((K=$.options)===null||K===void 0?void 0:K.autoPageCharWeight)?$.options.autoPageCharWeight:0),G=Math.floor(q/w8*L0)/((((J=$.options)===null||J===void 0?void 0:J.fontSize)?$.options.fontSize:k2)/Z),W=[],B=[],V=[],U=[];if($.text&&$.text.toString().trim().length===0)B.push({_type:D0.tablecell,text:" "});else if(typeof $.text==="number"||typeof $.text==="string")B.push({_type:D0.tablecell,text:($.text||"").toString().trim()});else if(Array.isArray($.text))B=$.text;let w=[];return B.forEach((F)=>{var M;if(typeof F.text==="string"){if(F.text.split(` `).length>1)F.text.split(` -`).forEach((k)=>{w.push({_type:D0.tablecell,text:k,options:Object.assign(Object.assign({},F.options),{breakLine:!0})})});else w.push({_type:D0.tablecell,text:F.text.trim(),options:F.options});if((M=F.options)===null||M===void 0?void 0:M.breakLine)V.push(w),w=[]}if(w.length>0)V.push(w),w=[]}),V.forEach((F)=>{F.forEach((M)=>{let k=[],L=String(M.text).split(" ");L.forEach((D,z)=>{let N=Object.assign({},M.options);if(N===null||N===void 0?void 0:N.breakLine)N.breakLine=z+1===L.length;k.push({_type:D0.tablecell,text:D+(z+1{let M=[],k="";if(F.forEach((f)=>{if(k.length+f.text.length>G)W.push(M),M=[],k="";M.push(f),k+=f.text.toString()}),M.length>0)W.push(M)}),W}function GJ($=[],q={},Q,K){let J=M8,Z=L0*1,G=L0*1,W=0,B=0,V=[],U=H0(q.x,"X",Q),w=H0(q.y,"Y",Q),F=H0(q.w,"X",Q),M=H0(q.h,"Y",Q),k=F;function f(){let D=0;if(V.length===0)D=w||v0(J[0]);if(V.length>0)D=v0(q.autoPageSlideStartY||q.newSlideStartY||J[0]);if(G=(M||Q.height)-D-v0(J[2]),V.length>1){if(typeof q.autoPageSlideStartY==="number")G=(M||Q.height)-v0(q.autoPageSlideStartY+J[2]);else if(typeof q.newSlideStartY==="number")G=(M||Q.height)-v0(q.newSlideStartY+J[2]);else if(w){if(G=(M||Q.height)-v0((w/L0{if(!z)z={_type:D0.tablecell};let N=z.options||null;B+=Number((N===null||N===void 0?void 0:N.colspan)?N.colspan:1)}),q.verbose)console.log(`| numCols ......................................... = ${B}`);if(!F&&q.colW){if(k=Array.isArray(q.colW)?q.colW.reduce((D,z)=>D+z)*L0:q.colW*B||0,q.verbose)console.log(`| tableCalcW ...................................... = ${k/L0}`)}if(Z=k||v0((U?U/L0:J[1])+J[3]),q.verbose)console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);if(!q.colW||!Array.isArray(q.colW))if(q.colW&&!isNaN(Number(q.colW))){let D=[];($[0]||[]).forEach(()=>D.push(q.colW)),q.colW=[],D.forEach((N)=>{if(Array.isArray(q.colW))q.colW.push(N)})}else{q.colW=[];for(let D=0;D{let N=[],H=0,v=0,j=[];if(D.forEach((X)=>{var P,g,c,h;if(j.push({_type:D0.tablecell,text:[],options:X.options}),X.options.margin&&X.options.margin[0]>=1){if(((P=X.options)===null||P===void 0?void 0:P.margin)&&X.options.margin[0]&&Y0(X.options.margin[0])>H)H=Y0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&Y0(q.margin[0])>H)H=Y0(q.margin[0]);if(((g=X.options)===null||g===void 0?void 0:g.margin)&&X.options.margin[2]&&Y0(X.options.margin[2])>v)v=Y0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&Y0(q.margin[2])>v)v=Y0(q.margin[2])}else{if(((c=X.options)===null||c===void 0?void 0:c.margin)&&X.options.margin[0]&&v0(X.options.margin[0])>H)H=v0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&v0(q.margin[0])>H)H=v0(q.margin[0]);if(((h=X.options)===null||h===void 0?void 0:h.margin)&&X.options.margin[2]&&v0(X.options.margin[2])>v)v=v0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&v0(q.margin[2])>v)v=v0(q.margin[2])}}),f(),W+=H+v,q.verbose&&z===0)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(D.forEach((X,P)=>{var g;let c={_type:D0.tablecell,_lines:null,_lineHeight:v0((((g=X.options)===null||g===void 0?void 0:g.fontSize)?X.options.fontSize:q.fontSize?q.fontSize:k2)*(YB+(q.autoPageLineWeight?q.autoPageLineWeight:0))/100),text:[],options:X.options};if(c.options.rowspan)c._lineHeight=0;c.options.autoPageCharWeight=q.autoPageCharWeight?q.autoPageCharWeight:null;let h=q.colW[P];if(X.options.colspan&&Array.isArray(q.colW))h=q.colW.filter((x,l)=>l>=P&&lx+l);c._lines=RB(X,h),N.push(c)}),q.verbose)console.log(` +`).forEach((k)=>{w.push({_type:D0.tablecell,text:k,options:Object.assign(Object.assign({},F.options),{breakLine:!0})})});else w.push({_type:D0.tablecell,text:F.text.trim(),options:F.options});if((M=F.options)===null||M===void 0?void 0:M.breakLine)V.push(w),w=[]}if(w.length>0)V.push(w),w=[]}),V.forEach((F)=>{F.forEach((M)=>{let k=[],L=String(M.text).split(" ");L.forEach((D,z)=>{let N=Object.assign({},M.options);if(N===null||N===void 0?void 0:N.breakLine)N.breakLine=z+1===L.length;k.push({_type:D0.tablecell,text:D+(z+1{let M=[],k="";if(F.forEach((f)=>{if(k.length+f.text.length>G)W.push(M),M=[],k="";M.push(f),k+=f.text.toString()}),M.length>0)W.push(M)}),W}function GJ($=[],q={},Q,K){let J=M8,Z=L0*1,G=L0*1,W=0,B=0,V=[],U=H0(q.x,"X",Q),w=H0(q.y,"Y",Q),F=H0(q.w,"X",Q),M=H0(q.h,"Y",Q),k=F;function f(){let D=0;if(V.length===0)D=w||v0(J[0]);if(V.length>0)D=v0(q.autoPageSlideStartY||q.newSlideStartY||J[0]);if(G=(M||Q.height)-D-v0(J[2]),V.length>1){if(typeof q.autoPageSlideStartY==="number")G=(M||Q.height)-v0(q.autoPageSlideStartY+J[2]);else if(typeof q.newSlideStartY==="number")G=(M||Q.height)-v0(q.newSlideStartY+J[2]);else if(w){if(G=(M||Q.height)-v0((w/L0{if(!z)z={_type:D0.tablecell};let N=z.options||null;B+=Number((N===null||N===void 0?void 0:N.colspan)?N.colspan:1)}),q.verbose)console.log(`| numCols ......................................... = ${B}`);if(!F&&q.colW){if(k=Array.isArray(q.colW)?q.colW.reduce((D,z)=>D+z)*L0:q.colW*B||0,q.verbose)console.log(`| tableCalcW ...................................... = ${k/L0}`)}if(Z=k||v0((U?U/L0:J[1])+J[3]),q.verbose)console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);if(!q.colW||!Array.isArray(q.colW))if(q.colW&&!isNaN(Number(q.colW))){let D=[];($[0]||[]).forEach(()=>D.push(q.colW)),q.colW=[],D.forEach((N)=>{if(Array.isArray(q.colW))q.colW.push(N)})}else{q.colW=[];for(let D=0;D{let N=[],H=0,v=0,j=[];if(D.forEach((X)=>{var P,g,c,h;if(j.push({_type:D0.tablecell,text:[],options:X.options}),X.options.margin&&X.options.margin[0]>=1){if(((P=X.options)===null||P===void 0?void 0:P.margin)&&X.options.margin[0]&&Y0(X.options.margin[0])>H)H=Y0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&Y0(q.margin[0])>H)H=Y0(q.margin[0]);if(((g=X.options)===null||g===void 0?void 0:g.margin)&&X.options.margin[2]&&Y0(X.options.margin[2])>v)v=Y0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&Y0(q.margin[2])>v)v=Y0(q.margin[2])}else{if(((c=X.options)===null||c===void 0?void 0:c.margin)&&X.options.margin[0]&&v0(X.options.margin[0])>H)H=v0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&v0(q.margin[0])>H)H=v0(q.margin[0]);if(((h=X.options)===null||h===void 0?void 0:h.margin)&&X.options.margin[2]&&v0(X.options.margin[2])>v)v=v0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&v0(q.margin[2])>v)v=v0(q.margin[2])}}),f(),W+=H+v,q.verbose&&z===0)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(D.forEach((X,P)=>{var g;let c={_type:D0.tablecell,_lines:null,_lineHeight:v0((((g=X.options)===null||g===void 0?void 0:g.fontSize)?X.options.fontSize:q.fontSize?q.fontSize:k2)*(fB+(q.autoPageLineWeight?q.autoPageLineWeight:0))/100),text:[],options:X.options};if(c.options.rowspan)c._lineHeight=0;c.options.autoPageCharWeight=q.autoPageCharWeight?q.autoPageCharWeight:null;let h=q.colW[P];if(X.options.colspan&&Array.isArray(q.colW))h=q.colW.filter((x,l)=>l>=P&&lx+l);c._lines=XB(X,h),N.push(c)}),q.verbose)console.log(` | SLIDE [${V.length}]: ROW [${z}]: START...`);let n=0,d=0,_=!1;while(!_){let X=N[n],P=j[n];if(N.forEach((h)=>{if(h._lineHeight>=d)d=h._lineHeight}),W+d>G){if(q.verbose)console.log(` |-----------------------------------------------------------------------|`),console.log(`|-- NEW SLIDE CREATED (currTabH+currLineH > maxH) => ${(W/L0).toFixed(2)} + ${(X._lineHeight/L0).toFixed(2)} > ${G/L0}`),console.log(`|-----------------------------------------------------------------------| `);if(j.length>0&&j.map((x)=>x.text.length).reduce((x,l)=>x+l)>0)L.rows.push(j);if(V.push(L),L={rows:[]},j=[],D.forEach((x)=>j.push({_type:D0.tablecell,text:[],options:x.options})),f(),W+=H+v,q.verbose)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(W=0,(q.addHeaderToEach||q.autoPageRepeatHeader)&&q._arrObjTabHeadRows)q._arrObjTabHeadRows.forEach((x)=>{let l=[],$0=0;x.forEach((Z0)=>{if(l.push(Z0),Z0._lineHeight>$0)$0=Z0._lineHeight}),L.rows.push(l),W+=$0});P=j[n]}let g=X._lines.shift();if(Array.isArray(P.text)){if(g)P.text=P.text.concat(g);else if(P.text.length===0)P.text=P.text.concat({_type:D0.tablecell,text:""})}if(n===N.length-1)W+=d;if(n=nh._lines.length).reduce((h,x)=>h+x)===0)_=!0}if(j.length>0)L.rows.push(j);if(q.verbose)console.log(`- SLIDE [${V.length}]: ROW [${z}]: ...COMPLETE ...... emuTabCurrH = ${(W/L0).toFixed(2)} ( emuSlideTabH = ${(G/L0).toFixed(2)} )`)}),V.push(L),q.verbose)console.log(` |================================================|`),console.log(`| FINAL: tableRowSlides.length = ${V.length}`),V.forEach((D)=>console.log(D)),console.log(`|================================================| -`);return V}function IB($,q,Q={},K){let J=Q||{};J.slideMargin=J.slideMargin||J.slideMargin===0?J.slideMargin:0.5;let Z=J.w||$.presLayout.width,G=[],W=[],B=[],V=[],U=[],w=[0.5,0.5,0.5,0.5],F=0;if(!document.getElementById(q))throw Error('tableToSlides: Table ID "'+q+'" does not exist!');if(K===null||K===void 0?void 0:K._margin){if(Array.isArray(K._margin))w=K._margin;else if(!isNaN(K._margin))w=[K._margin,K._margin,K._margin,K._margin];J.slideMargin=w}else if(J===null||J===void 0?void 0:J.slideMargin){if(Array.isArray(J.slideMargin))w=J.slideMargin;else if(!isNaN(J.slideMargin))w=[J.slideMargin,J.slideMargin,J.slideMargin,J.slideMargin]}if(Z=(J.w?v0(J.w):$.presLayout.width)-v0(w[1]+w[3]),J.verbose)console.log("[[VERBOSE MODE]]"),console.log("|-- `tableToSlides` ----------------------------------------------------|"),console.log(`| tableProps.h .................................... = ${J.h}`),console.log(`| tableProps.w .................................... = ${J.w}`),console.log(`| pptx.presLayout.width ........................... = ${($.presLayout.width/L0).toFixed(1)}`),console.log(`| pptx.presLayout.height .......................... = ${($.presLayout.height/L0).toFixed(1)}`),console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);let M=document.querySelectorAll(`#${q} tr:first-child th`);if(M.length===0)M=document.querySelectorAll(`#${q} tr:first-child td`);if(M.forEach((f)=>{let L=f;if(L.getAttribute("colspan"))for(let D=0;D{F+=f}),U.forEach((f,L)=>{let D=Number((Number(Z)*(f/F*100)/100/L0).toFixed(2)),z=0,N=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(N)z=Number(N.getAttribute("data-pptx-min-width"));let H=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(H)z=Number(H.getAttribute("data-pptx-width"));V.push(z>D?z:D)}),J.verbose)console.log(`| arrColW ......................................... = [${V.join(", ")}]`);["thead","tbody","tfoot"].forEach((f)=>{document.querySelectorAll(`#${q} ${f} tr`).forEach((L)=>{let D=L,z=[];switch(Array.from(D.cells).forEach((N)=>{let H=window.getComputedStyle(N).getPropertyValue("color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(","),v=window.getComputedStyle(N).getPropertyValue("background-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");if(window.getComputedStyle(N).getPropertyValue("background-color")==="rgba(0, 0, 0, 0)"||window.getComputedStyle(N).getPropertyValue("transparent"))v=["255","255","255"];let j={align:null,bold:window.getComputedStyle(N).getPropertyValue("font-weight")==="bold"||Number(window.getComputedStyle(N).getPropertyValue("font-weight"))>=500,border:null,color:A7(Number(H[0]),Number(H[1]),Number(H[2])),fill:{color:A7(Number(v[0]),Number(v[1]),Number(v[2]))},fontFace:(window.getComputedStyle(N).getPropertyValue("font-family")||"").split(",")[0].replace(/"/g,"").replace("inherit","").replace("initial","")||null,fontSize:Number(window.getComputedStyle(N).getPropertyValue("font-size").replace(/[a-z]/gi,"")),margin:null,colspan:Number(N.getAttribute("colspan"))||null,rowspan:Number(N.getAttribute("rowspan"))||null,valign:null};if(["left","center","right","start","end"].includes(window.getComputedStyle(N).getPropertyValue("text-align"))){let n=window.getComputedStyle(N).getPropertyValue("text-align").replace("start","left").replace("end","right");j.align=n==="center"?"center":n==="left"?"left":n==="right"?"right":null}if(["top","middle","bottom"].includes(window.getComputedStyle(N).getPropertyValue("vertical-align"))){let n=window.getComputedStyle(N).getPropertyValue("vertical-align");j.valign=n==="top"?"top":n==="middle"?"middle":n==="bottom"?"bottom":null}if(window.getComputedStyle(N).getPropertyValue("padding-left"))j.margin=[0,0,0,0],["padding-top","padding-right","padding-bottom","padding-left"].forEach((d,_)=>{j.margin[_]=Math.round(Number(window.getComputedStyle(N).getPropertyValue(d).replace(/\D/gi,"")))});if(window.getComputedStyle(N).getPropertyValue("border-top-width")||window.getComputedStyle(N).getPropertyValue("border-right-width")||window.getComputedStyle(N).getPropertyValue("border-bottom-width")||window.getComputedStyle(N).getPropertyValue("border-left-width"))j.border=[null,null,null,null],["top","right","bottom","left"].forEach((d,_)=>{let X=Math.round(Number(window.getComputedStyle(N).getPropertyValue("border-"+d+"-width").replace("px",""))),P=[];P=window.getComputedStyle(N).getPropertyValue("border-"+d+"-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");let g=A7(Number(P[0]),Number(P[1]),Number(P[2]));j.border[_]={pt:X,color:g}});z.push({_type:D0.tablecell,text:N.innerText,options:j})}),f){case"thead":G.push(z);break;case"tbody":W.push(z);break;case"tfoot":B.push(z);break;default:console.log(`table parsing: unexpected table part: ${f}`);break}})}),J._arrObjTabHeadRows=G||null,J.colW=V,GJ([...G,...W,...B],J,$.presLayout,K).forEach((f,L)=>{let D=$.addSlide({masterName:J.masterSlideName||null});if(L===0)J.y=J.y||w[0];if(L>0)J.y=J.autoPageSlideStartY||J.newSlideStartY||w[0];if(J.verbose)console.log(`| opts.autoPageSlideStartY: ${J.autoPageSlideStartY} / arrInchMargins[0]: ${w[0]} => opts.y = ${J.y}`);if(D.addTable(f.rows,{x:J.x||w[3],y:J.y,w:Number(Z)/L0,colW:V,autoPage:!1}),J.addImage)if(J.addImage.options=J.addImage.options||{},!J.addImage.image||!J.addImage.image.path&&!J.addImage.image.data)console.warn("Warning: tableToSlides.addImage requires either `path` or `data`");else D.addImage({path:J.addImage.image.path,data:J.addImage.image.data,x:J.addImage.options.x,y:J.addImage.options.y,w:J.addImage.options.w,h:J.addImage.options.h});if(J.addShape)D.addShape(J.addShape.shapeName,J.addShape.options||{});if(J.addTable)D.addTable(J.addTable.rows,J.addTable.options||{});if(J.addText)D.addText(J.addText.text,J.addText.options||{})})}var CB=0;function jB($,q){if($.bkgd)q.bkgd=$.bkgd;if($.objects&&Array.isArray($.objects)&&$.objects.length>0)$.objects.forEach((Q,K)=>{let J=Object.keys(Q)[0],Z=q;if(W1[J]&&J==="chart")WJ(Z,Q[J].type,Q[J].data,Q[J].opts);else if(W1[J]&&J==="image")BJ(Z,Q[J]);else if(W1[J]&&J==="line")_7(Z,B1.LINE,Q[J]);else if(W1[J]&&J==="rect")_7(Z,B1.RECTANGLE,Q[J]);else if(W1[J]&&J==="text")H5(Z,[{text:Q[J].text}],Q[J].options,!1);else if(W1[J]&&J==="placeholder")Q[J].options.placeholder=Q[J].options.name,delete Q[J].options.name,Q[J].options._placeholderType=Q[J].options.type,delete Q[J].options.type,Q[J].options._placeholderIdx=100+K,H5(Z,[{text:Q[J].text}],Q[J].options,!0)});if($.slideNumber&&typeof $.slideNumber==="object")q._slideNumberProps=$.slideNumber}function WJ($,q,Q,K){var J;function Z(w){if(!w||w.style==="none")return;if(w.size!==void 0&&(isNaN(Number(w.size))||w.size<=0))console.warn("Warning: chart.gridLine.size must be greater than 0."),delete w.size;if(w.style&&!["solid","dash","dot"].includes(w.style))console.warn("Warning: chart.gridLine.style options: `solid`, `dash`, `dot`."),delete w.style;if(w.cap&&!["flat","square","round"].includes(w.cap))console.warn("Warning: chart.gridLine.cap options: `flat`, `square`, `round`."),delete w.cap}let G=++CB,W={_type:null,text:null,options:null,chartRid:null},B=null,V=[];if(Array.isArray(q))q.forEach((w)=>{V=V.concat(w.data)}),B=Q||K;else V=Q,B=K;V.forEach((w,F)=>{if(w._dataIndex=F,w.labels!==void 0&&!Array.isArray(w.labels[0]))w.labels=[w.labels]});let U=B&&typeof B==="object"?B:{};if(U._type=q,U.x=typeof U.x<"u"&&U.x!=null&&!isNaN(Number(U.x))?U.x:1,U.y=typeof U.y<"u"&&U.y!=null&&!isNaN(Number(U.y))?U.y:1,U.w=U.w||"50%",U.h=U.h||"50%",U.objectName=U.objectName?k0(U.objectName):`Chart ${$._slideObjects.filter((w)=>w._type===D0.chart).length}`,!["bar","col"].includes(U.barDir||""))U.barDir="col";if(U._type===q0.AREA){if(!["stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if(U._type===q0.BAR){if(!["clustered","stacked","percentStacked"].includes(U.barGrouping||""))U.barGrouping="clustered"}if(U._type===q0.BAR3D){if(!["clustered","stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if((J=U.barGrouping)===null||J===void 0?void 0:J.includes("tacked")){if(!U.barGapWidthPct)U.barGapWidthPct=50}if(U.dataLabelPosition){if(U._type===q0.AREA||U._type===q0.BAR3D||U._type===q0.DOUGHNUT||U._type===q0.RADAR)delete U.dataLabelPosition;if(U._type===q0.PIE){if(!["bestFit","ctr","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BUBBLE||U._type===q0.BUBBLE3D||U._type===q0.LINE||U._type===q0.SCATTER){if(!["b","ctr","l","r","t"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BAR){if(!["stacked","percentStacked"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(!["clustered"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}}}if(U.dataLabelBkgrdColors=U.dataLabelBkgrdColors||!U.dataLabelBkgrdColors?U.dataLabelBkgrdColors:!1,!["b","l","r","t","tr"].includes(U.legendPos||""))U.legendPos="r";if(!["cone","coneToMax","box","cylinder","pyramid","pyramidToMax"].includes(U.bar3DShape||""))U.bar3DShape="box";if(!["circle","dash","diamond","dot","none","square","triangle"].includes(U.lineDataSymbol||""))U.lineDataSymbol="circle";if(!["gap","span"].includes(U.displayBlanksAs||""))U.displayBlanksAs="span";if(!["standard","marker","filled"].includes(U.radarStyle||""))U.radarStyle="standard";if(U.lineDataSymbolSize=U.lineDataSymbolSize&&!isNaN(U.lineDataSymbolSize)?U.lineDataSymbolSize:6,U.lineDataSymbolLineSize=U.lineDataSymbolLineSize&&!isNaN(U.lineDataSymbolLineSize)?Y0(U.lineDataSymbolLineSize):Y0(0.75),U.layout)["x","y","w","h"].forEach((w)=>{let F=U.layout[w];if(isNaN(Number(F))||F<0||F>1)console.warn("Warning: chart.layout."+w+" can only be 0-1"),delete U.layout[w]});if(U.catGridLine=U.catGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),U.valGridLine=U.valGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{}),U.serGridLine=U.serGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),Z(U.catGridLine),Z(U.valGridLine),Z(U.serGridLine),b7(U.shadow),U.showDataTable=U.showDataTable||!U.showDataTable?U.showDataTable:!1,U.showDataTableHorzBorder=U.showDataTableHorzBorder||!U.showDataTableHorzBorder?U.showDataTableHorzBorder:!0,U.showDataTableVertBorder=U.showDataTableVertBorder||!U.showDataTableVertBorder?U.showDataTableVertBorder:!0,U.showDataTableOutline=U.showDataTableOutline||!U.showDataTableOutline?U.showDataTableOutline:!0,U.showDataTableKeys=U.showDataTableKeys||!U.showDataTableKeys?U.showDataTableKeys:!0,U.showLabel=U.showLabel||!U.showLabel?U.showLabel:!1,U.showLegend=U.showLegend||!U.showLegend?U.showLegend:!1,U.showPercent=U.showPercent||!U.showPercent?U.showPercent:!0,U.showTitle=U.showTitle||!U.showTitle?U.showTitle:!1,U.showValue=U.showValue||!U.showValue?U.showValue:!1,U.showLeaderLines=U.showLeaderLines||!U.showLeaderLines?U.showLeaderLines:!1,U.catAxisLineShow=typeof U.catAxisLineShow<"u"?U.catAxisLineShow:!0,U.valAxisLineShow=typeof U.valAxisLineShow<"u"?U.valAxisLineShow:!0,U.serAxisLineShow=typeof U.serAxisLineShow<"u"?U.serAxisLineShow:!0,U.v3DRotX=!isNaN(U.v3DRotX)&&U.v3DRotX>=-90&&U.v3DRotX<=90?U.v3DRotX:30,U.v3DRotY=!isNaN(U.v3DRotY)&&U.v3DRotY>=0&&U.v3DRotY<=360?U.v3DRotY:30,U.v3DRAngAx=U.v3DRAngAx||!U.v3DRAngAx?U.v3DRAngAx:!0,U.v3DPerspective=!isNaN(U.v3DPerspective)&&U.v3DPerspective>=0&&U.v3DPerspective<=240?U.v3DPerspective:30,U.barGapWidthPct=!isNaN(U.barGapWidthPct)&&U.barGapWidthPct>=0&&U.barGapWidthPct<=1000?U.barGapWidthPct:150,U.barGapDepthPct=!isNaN(U.barGapDepthPct)&&U.barGapDepthPct>=0&&U.barGapDepthPct<=1000?U.barGapDepthPct:150,U.chartColors=Array.isArray(U.chartColors)?U.chartColors:U._type===q0.PIE||U._type===q0.DOUGHNUT?HB:z8,U.chartColorsOpacity=U.chartColorsOpacity&&!isNaN(U.chartColorsOpacity)?U.chartColorsOpacity:null,U.border=U.border&&typeof U.border==="object"?U.border:null,U.border&&(!U.border.pt||isNaN(U.border.pt)))U.border.pt=v6.pt;if(U.border&&(!U.border.color||typeof U.border.color!=="string"))U.border.color=v6.color;if(U.plotArea=U.plotArea||{},U.plotArea.border=U.plotArea.border&&typeof U.plotArea.border==="object"?U.plotArea.border:null,U.plotArea.border&&(!U.plotArea.border.pt||isNaN(U.plotArea.border.pt)))U.plotArea.border.pt=v6.pt;if(U.plotArea.border&&(!U.plotArea.border.color||typeof U.plotArea.border.color!=="string"))U.plotArea.border.color=v6.color;if(U.border)U.plotArea.border=U.border;if(U.plotArea.fill=U.plotArea.fill||{color:null,transparency:null},U.fill)U.plotArea.fill.color=U.fill;if(U.chartArea=U.chartArea||{},U.chartArea.border=U.chartArea.border&&typeof U.chartArea.border==="object"?U.chartArea.border:null,U.chartArea.border)U.chartArea.border={color:U.chartArea.border.color||v6.color,pt:U.chartArea.border.pt||v6.pt};if(U.chartArea.roundedCorners=typeof U.chartArea.roundedCorners==="boolean"?U.chartArea.roundedCorners:!0,U.dataBorder=U.dataBorder&&typeof U.dataBorder==="object"?U.dataBorder:null,U.dataBorder&&(!U.dataBorder.pt||isNaN(U.dataBorder.pt)))U.dataBorder.pt=0.75;if(U.dataBorder&&U.dataBorder.color){let w=typeof U.dataBorder.color==="string"&&U.dataBorder.color.length===6&&/^[0-9A-Fa-f]{6}$/.test(U.dataBorder.color),F=Object.values(L5).includes(U.dataBorder.color);if(!w&&!F)U.dataBorder.color="F9F9F9"}if(!U.dataLabelFormatCode&&U._type===q0.SCATTER)U.dataLabelFormatCode="General";if(!U.dataLabelFormatCode&&(U._type===q0.PIE||U._type===q0.DOUGHNUT))U.dataLabelFormatCode=U.showPercent?"0%":"General";if(U.dataLabelFormatCode=U.dataLabelFormatCode&&typeof U.dataLabelFormatCode==="string"?U.dataLabelFormatCode:"#,##0",!U.dataLabelFormatScatter&&U._type===q0.SCATTER)U.dataLabelFormatScatter="custom";if(U.lineSize=typeof U.lineSize==="number"?U.lineSize:2,U.valAxisMajorUnit=typeof U.valAxisMajorUnit==="number"?U.valAxisMajorUnit:null,U._type===q0.AREA||U._type===q0.BAR||U._type===q0.BAR3D||U._type===q0.LINE)U.catAxisMultiLevelLabels=!!U.catAxisMultiLevelLabels;else delete U.catAxisMultiLevelLabels;return W._type="chart",W.options=U,W.chartRid=a2($),$._relsChart.push({rId:a2($),data:V,opts:U,type:U._type,globalId:G,fileName:`chart${G}.xml`,Target:`/ppt/charts/chart${G}.xml`}),$._slideObjects.push(W),W}function BJ($,q){let Q={_type:null,text:null,options:null,image:null,imageRid:null,hyperlink:null},K=q.x||0,J=q.y||0,Z=q.w||0,G=q.h||0,W=q.sizing||null,B=q.hyperlink||"",V=q.data||"",U=q.path||"",w=a2($),F=q.objectName?k0(q.objectName):`Image ${$._slideObjects.filter((k)=>k._type===D0.image).length}`;if(!U&&!V)return console.error("ERROR: addImage() requires either 'data' or 'path' parameter!"),null;else if(U&&typeof U!=="string")return console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(U)}`),null;else if(V&&typeof V!=="string")return console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(V)}`),null;else if(V&&typeof V==="string"&&!V.toLowerCase().includes("base64,"))return console.error("ERROR: Image `data` value lacks a base64 header! Ex: 'image/png;base64,NMP[...]')"),null;let M=(U.substring(U.lastIndexOf("/")+1).split("?")[0].split(".").pop().split("#")[0]||"png").toLowerCase();if(V&&/image\/(\w+);/.exec(V)&&/image\/(\w+);/.exec(V).length>0)M=/image\/(\w+);/.exec(V)[1];else if(V===null||V===void 0?void 0:V.toLowerCase().includes("image/svg+xml"))M="svg";if(Q._type=D0.image,Q.image=U||"preencoded.png",Q.options={x:K||0,y:J||0,w:Z||1,h:G||1,altText:q.altText||"",rounding:typeof q.rounding==="boolean"?q.rounding:!1,sizing:W,placeholder:q.placeholder,rotate:q.rotate||0,flipV:q.flipV||!1,flipH:q.flipH||!1,transparency:q.transparency||0,objectName:F,shadow:b7(q.shadow)},M==="svg")$._relsMedia.push({path:U||V+"png",type:"image/png",extn:"png",data:V||"",rId:w,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`,isSvgPng:!0,svgSize:{w:H0(Q.options.w,"X",$._presLayout),h:H0(Q.options.h,"Y",$._presLayout)}}),Q.imageRid=w,$._relsMedia.push({path:U||V,type:"image/svg+xml",extn:M,data:V||"",rId:w+1,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w+1;else{let k=$._relsMedia.filter((f)=>f.path&&f.path===U&&f.type==="image/"+M&&!f.isDuplicate)[0];$._relsMedia.push({path:U||"preencoded."+M,type:"image/"+M,extn:M,data:V||"",rId:w,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w}if(typeof B==="object")if(!B.url&&!B.slide)throw Error("ERROR: `hyperlink` option requires either: `url` or `slide`");else w++,$._rels.push({type:D0.hyperlink,data:B.slide?"slide":"dummy",rId:w,Target:B.url||B.slide.toString()}),B._rId=w,Q.hyperlink=B;$._slideObjects.push(Q)}function gB($,q){let Q=q.x||0,K=q.y||0,J=q.w||2,Z=q.h||2,G=q.data||"",W=q.link||"",B=q.path||"",V=q.type||"audio",U="",w=q.cover||vB,F=q.objectName?k0(q.objectName):`Media ${$._slideObjects.filter((k)=>k._type===D0.media).length}`,M={_type:D0.media};if(!B&&!G&&V!=="online")throw Error("addMedia() error: either `data` or `path` are required!");else if(G&&!G.toLowerCase().includes("base64,"))throw Error("addMedia() error: `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')");else if(!w.toLowerCase().includes("base64,"))throw Error("addMedia() error: `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')");if(V==="online"&&!W)throw Error("addMedia() error: online videos require `link` value");if(U=q.extn||(G?G.split(";")[0].split("/")[1]:B.split(".").pop())||"mp3",M.mtype=V,M.media=B||"preencoded.mov",M.options={},M.options.x=Q,M.options.y=K,M.options.w=J,M.options.h=Z,M.options.objectName=F,V==="online"){let k=a2($);$._relsMedia.push({path:B||"preencoded"+U,data:"dummy",type:"online",extn:U,rId:k,Target:W}),M.mediaRid=k,$._relsMedia.push({path:"preencoded.png",data:w,type:"image/png",extn:"png",rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}else{let k=$._relsMedia.filter((L)=>L.path&&L.path===B&&L.type===V+"/"+U&&!L.isDuplicate)[0],f=a2($);$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:f,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+1}.${U}`}),M.mediaRid=f,$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:a2($),isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+0}.${U}`}),$._relsMedia.push({path:"preencoded.png",type:"image/png",extn:"png",data:w,rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}$._slideObjects.push(M)}function AB($,q){$._slideObjects.push({_type:D0.notes,text:[{text:q}]})}function _7($,q,Q){let K=typeof Q==="object"?Q:{};K.line=K.line||{type:"none"};let J={_type:D0.text,shape:q||B1.RECTANGLE,options:K,text:null};if(!q)throw Error("Missing/Invalid shape parameter! Example: `addShape(pptxgen.shapes.LINE, {x:1, y:1, w:1, h:1});`");let Z={type:K.line.type||"solid",color:K.line.color||VJ,transparency:K.line.transparency||0,width:K.line.width||1,dashType:K.line.dashType||"solid",beginArrowType:K.line.beginArrowType||null,endArrowType:K.line.endArrowType||null};if(typeof K.line==="object"&&K.line.type!=="none")K.line=Z;if(K.x=K.x||(K.x===0?0:1),K.y=K.y||(K.y===0?0:1),K.w=K.w||(K.w===0?0:1),K.h=K.h||(K.h===0?0:1),K.objectName=K.objectName?k0(K.objectName):`Shape ${$._slideObjects.filter((G)=>G._type===D0.text).length}`,typeof K.line==="string"){let G=Z;G.color=String(K.line),K.line=G}if(typeof K.lineSize==="number")K.line.width=K.lineSize;if(typeof K.lineDash==="string")K.line.dashType=K.lineDash;if(typeof K.lineHead==="string")K.line.beginArrowType=K.lineHead;if(typeof K.lineTail==="string")K.line.endArrowType=K.lineTail;g6($,J),$._slideObjects.push(J)}function XB($,q,Q,K,J,Z,G){let W=[$],B=Q&&typeof Q==="object"?Q:{};B.objectName=B.objectName?k0(B.objectName):`Table ${$._slideObjects.filter((F)=>F._type===D0.table).length}`;{if(q===null||q.length===0||!Array.isArray(q))throw Error("addTable: Array expected! EX: 'slide.addTable( [rows], {options} );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)");if(!q[0]||!Array.isArray(q[0]))throw Error("addTable: 'rows' should be an array of cells! EX: 'slide.addTable( [ ['A'], ['B'], {text:'C',options:{align:'center'}} ] );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)")}let V=[];if(q.forEach((F)=>{let M=[];if(Array.isArray(F))F.forEach((k)=>{let f={_type:D0.tablecell,text:"",options:typeof k==="object"&&k.options?k.options:{}};if(typeof k==="string"||typeof k==="number")f.text=k.toString();else if(k.text){if(typeof k.text==="string"||typeof k.text==="number")f.text=k.text.toString();else if(k.text)f.text=k.text;if(k.options&&typeof k.options==="object")f.options=k.options}f.options.border=f.options.border||B.border||[{type:"none"},{type:"none"},{type:"none"},{type:"none"}];let L=f.options.border;if(!Array.isArray(L)&&typeof L==="object")f.options.border=[L,L,L,L];if(!f.options.border[0])f.options.border[0]={type:"none"};if(!f.options.border[1])f.options.border[1]={type:"none"};if(!f.options.border[2])f.options.border[2]={type:"none"};if(!f.options.border[3])f.options.border[3]={type:"none"};[0,1,2,3].forEach((z)=>{f.options.border[z]={type:f.options.border[z].type||H6.type,color:f.options.border[z].color||H6.color,pt:typeof f.options.border[z].pt==="number"?f.options.border[z].pt:H6.pt}}),M.push(f)});else console.log("addTable: tableRows has a bad row. A row should be an array of cells. You provided:"),console.log(F);V.push(M)}),B.x=H0(B.x||(B.x===0?0:L0/2),"X",J),B.y=H0(B.y||(B.y===0?0:L0/2),"Y",J),B.h)B.h=H0(B.h,"Y",J);if(B.fontSize=B.fontSize||k2,B.margin=B.margin===0||B.margin?B.margin:JJ,typeof B.margin==="number")B.margin=[Number(B.margin),Number(B.margin),Number(B.margin),Number(B.margin)];if(JSON.stringify({arrRows:V}).indexOf("hyperlink")===-1){if(!B.color)B.color=B.color||Q2}if(typeof B.border==="string")console.warn("addTable `border` option must be an object. Ex: `{border: {type:'none'}}`"),B.border=null;else if(Array.isArray(B.border))[0,1,2,3].forEach((F)=>{B.border[F]=B.border[F]?{type:B.border[F].type||H6.type,color:B.border[F].color||H6.color,pt:B.border[F].pt||H6.pt}:{type:"none"}});if(B.autoPage=typeof B.autoPage==="boolean"?B.autoPage:!1,B.autoPageRepeatHeader=typeof B.autoPageRepeatHeader==="boolean"?B.autoPageRepeatHeader:!1,B.autoPageHeaderRows=typeof B.autoPageHeaderRows<"u"&&!isNaN(Number(B.autoPageHeaderRows))?Number(B.autoPageHeaderRows):1,B.autoPageLineWeight=typeof B.autoPageLineWeight<"u"&&!isNaN(Number(B.autoPageLineWeight))?Number(B.autoPageLineWeight):0,B.autoPageLineWeight){if(B.autoPageLineWeight>1)B.autoPageLineWeight=1;else if(B.autoPageLineWeight<-1)B.autoPageLineWeight=-1}let U=M8;if(K&&typeof K._margin<"u"){if(Array.isArray(K._margin))U=K._margin;else if(!isNaN(Number(K._margin)))U=[Number(K._margin),Number(K._margin),Number(K._margin),Number(K._margin)]}if(B.colW){let F=V[0].reduce((M,k)=>{var f;if(((f=k===null||k===void 0?void 0:k.options)===null||f===void 0?void 0:f.colspan)&&typeof k.options.colspan==="number")M+=k.options.colspan;else M+=1;return M},0);if(typeof B.colW==="string"||typeof B.colW==="number")B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length===1&&F>1)B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length!==F)console.warn("addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths."),B.colW=null}else if(B.w)B.w=H0(B.w,"X",J);else B.w=Math.floor(J._sizeW/L0-U[1]-U[3]);if(B.x&&B.x<20)B.x=v0(B.x);if(B.y&&B.y<20)B.y=v0(B.y);if(B.w&&typeof B.w==="number"&&B.w<20)B.w=v0(B.w);if(B.h&&typeof B.h==="number"&&B.h<20)B.h=v0(B.h);V.forEach((F)=>{F.forEach((M,k)=>{if(typeof M==="number"||typeof M==="string")F[k]={_type:D0.tablecell,text:String(F[k]),options:B};else if(typeof M==="object"){if(typeof M.text==="number")F[k].text=F[k].text.toString();else if(typeof M.text>"u"||M.text===null)F[k].text="";F[k].options=M.options||{},F[k]._type=D0.tablecell}})});let w=[];if(B&&!B.autoPage)g6($,V),$._slideObjects.push({_type:D0.table,arrTabRows:V,options:Object.assign({},B)});else{if(B.autoPageRepeatHeader)B._arrObjTabHeadRows=V.filter((F,M)=>M{if(!G($._slideNum+M))W.push(Z({masterName:(K===null||K===void 0?void 0:K._name)||null}));if(M>0)B.y=v0(B.autoPageSlideStartY||B.newSlideStartY||U[0]);{let k=G($._slideNum+M);if(B.autoPage=!1,g6(k,F.rows),k.addTable(F.rows,Object.assign({},B)),M>0)w.push(k)}})}return w}function H5($,q,Q,K){let J={_type:K?D0.placeholder:D0.text,shape:(Q===null||Q===void 0?void 0:Q.shape)||B1.RECTANGLE,text:!q||q.length===0?[{text:"",options:null}]:q,options:Q||{}};function Z(G){{if(!G.placeholder)G.color=G.color||J.options.color||$.color||Q2;if(G.placeholder||K)G.bullet=G.bullet||!1;if(G.placeholder&&$._slideLayout&&$._slideLayout._slideObjects){let W=$._slideLayout._slideObjects.filter((B)=>B._type==="placeholder"&&B.options&&B.options.placeholder&&B.options.placeholder===G.placeholder)[0];if(W===null||W===void 0?void 0:W.options)G=Object.assign(Object.assign({},G),W.options)}if(G.objectName=G.objectName?k0(G.objectName):`Text ${$._slideObjects.filter((W)=>W._type===D0.text).length}`,G.shape===B1.LINE){let W={type:G.line.type||"solid",color:G.line.color||VJ,transparency:G.line.transparency||0,width:G.line.width||1,dashType:G.line.dashType||"solid",beginArrowType:G.line.beginArrowType||null,endArrowType:G.line.endArrowType||null};if(typeof G.line==="object")G.line=W;if(typeof G.line==="string"){let B=W;if(typeof G.line==="string")B.color=G.line;G.line=B}if(typeof G.lineSize==="number")G.line.width=G.lineSize;if(typeof G.lineDash==="string")G.line.dashType=G.lineDash;if(typeof G.lineHead==="string")G.line.beginArrowType=G.lineHead;if(typeof G.lineTail==="string")G.line.endArrowType=G.lineTail}if(G.line=G.line||{},G.lineSpacing=G.lineSpacing&&!isNaN(G.lineSpacing)?G.lineSpacing:null,G.lineSpacingMultiple=G.lineSpacingMultiple&&!isNaN(G.lineSpacingMultiple)?G.lineSpacingMultiple:null,G._bodyProp=G._bodyProp||{},G._bodyProp.autoFit=G.autoFit||!1,G._bodyProp.anchor=!G.placeholder?I6.ctr:null,G._bodyProp.vert=G.vert||null,G._bodyProp.wrap=typeof G.wrap==="boolean"?G.wrap:!0,G.inset&&!isNaN(Number(G.inset))||G.inset===0)G._bodyProp.lIns=v0(G.inset),G._bodyProp.rIns=v0(G.inset),G._bodyProp.tIns=v0(G.inset),G._bodyProp.bIns=v0(G.inset);if(typeof G.underline==="boolean"&&G.underline===!0)G.underline={style:"sng"}}{if((G.align||"").toLowerCase().indexOf("c")===0)G._bodyProp.align=R6.center;else if((G.align||"").toLowerCase().indexOf("l")===0)G._bodyProp.align=R6.left;else if((G.align||"").toLowerCase().indexOf("r")===0)G._bodyProp.align=R6.right;else if((G.align||"").toLowerCase().indexOf("j")===0)G._bodyProp.align=R6.justify;if((G.valign||"").toLowerCase().indexOf("b")===0)G._bodyProp.anchor=I6.b;else if((G.valign||"").toLowerCase().indexOf("m")===0)G._bodyProp.anchor=I6.ctr;else if((G.valign||"").toLowerCase().indexOf("t")===0)G._bodyProp.anchor=I6.t}return b7(G.shadow),G}J.options=Z(J.options),J.text.forEach((G)=>G.options=Z(G.options||{})),g6($,J.text||""),$._slideObjects.push(J)}function yB($){($._slideLayout._slideObjects||[]).forEach((q)=>{if(q._type===D0.placeholder){if($._slideObjects.filter((Q)=>Q.options&&Q.options.placeholder===q.options.placeholder).length===0)H5($,[{text:""}],q.options,!1)}})}function zJ($,q){var Q;if(q.bkgd){if(!q.background)q.background={};if(typeof q.bkgd==="string")q.background.color=q.bkgd;else{if(q.bkgd.data)q.background.data=q.bkgd.data;if(q.bkgd.path)q.background.path=q.bkgd.path;if(q.bkgd.src)q.background.path=q.bkgd.src}}if((Q=q.background)===null||Q===void 0?void 0:Q.fill)q.background.color=q.background.fill;if($&&($.path||$.data)){$.path=$.path||"preencoded.png";let K=($.path.split(".").pop()||"png").split("?")[0];if(K==="jpg")K="jpeg";q._relsMedia=q._relsMedia||[];let J=q._relsMedia.length+1;q._relsMedia.push({path:$.path,type:D0.image,extn:K,data:$.data||null,rId:J,Target:`../media/${(q._name||"").replace(/\s+/gi,"-")}-image-${q._relsMedia.length+1}.${K}`}),q._bkgdImgRid=J}}function g6($,q,Q){let K=[];if(typeof q==="string"||typeof q==="number")return;else if(Array.isArray(q))K=q;else if(typeof q==="object")K=[q];K.forEach((J,Z)=>{if(Q&&Q[Z]&&Q[Z].hyperlink)J.options=Object.assign(Object.assign({},J.options),Q[Z]);if(Array.isArray(J)){let G=[];J.forEach((W)=>{if(W.options&&!W.text.options)G.push(W.options)}),g6($,J,G)}else if(Array.isArray(J.text))g6($,J.text,Q&&Q[Z]?[Q[Z]]:void 0);else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&!J.options.hyperlink._rId)if(typeof J.options.hyperlink!=="object")console.log("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:'https://github.com'}` ");else if(!J.options.hyperlink.url&&!J.options.hyperlink.slide)console.log("ERROR: 'hyperlink requires either: `url` or `slide`'");else{let G=a2($);$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:G,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()}),J.options.hyperlink._rId=G}else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&J.options.hyperlink._rId){if($._rels.filter((G)=>G.rId===J.options.hyperlink._rId).length===0)$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:J.options.hyperlink._rId,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()})}})}class FJ{constructor($){var q;this.addSlide=$.addSlide,this.getSlide=$.getSlide,this._name=`Slide ${$.slideNumber}`,this._presLayout=$.presLayout,this._rId=$.slideRId,this._rels=[],this._relsChart=[],this._relsMedia=[],this._setSlideNum=$.setSlideNum,this._slideId=$.slideId,this._slideLayout=$.slideLayout||null,this._slideNum=$.slideNumber,this._slideObjects=[],this._slideNumberProps=((q=this._slideLayout)===null||q===void 0?void 0:q._slideNumberProps)?this._slideLayout._slideNumberProps:null}set bkgd($){if(this._bkgd=$,!this._background||!this._background.color){if(!this._background)this._background={};if(typeof $==="string")this._background.color=$}}get bkgd(){return this._bkgd}set background($){if(this._background=$,$)zJ($,this)}get background(){return this._background}set color($){this._color=$}get color(){return this._color}set hidden($){this._hidden=$}get hidden(){return this._hidden}set slideNumber($){this._slideNumberProps=$,this._setSlideNum($)}get slideNumber(){return this._slideNumberProps}get newAutoPagedSlides(){return this._newAutoPagedSlides}addChart($,q,Q){let K=Q||{};return K._type=$,WJ(this,$,q,Q),this}addImage($){return BJ(this,$),this}addMedia($){return gB(this,$),this}addNotes($){return AB(this,$),this}addShape($,q){return _7(this,$,q),this}addTable($,q){return this._newAutoPagedSlides=XB(this,$,q,this._slideLayout,this._presLayout,this.addSlide,this.getSlide),this}addText($,q){return H5(this,typeof $==="string"||typeof $==="number"?[{text:$,options:q}]:$,q,!1),this}}function hB($,q){return W2(this,void 0,void 0,function*(){let Q=$.data;return yield new Promise((K,J)=>{var Z,G;let W=new c7.default,B=(Q.length-1)*2+1,V=((G=(Z=Q[0])===null||Z===void 0?void 0:Z.labels)===null||G===void 0?void 0:G.length)>1;W.folder("_rels"),W.folder("docProps"),W.folder("xl/_rels"),W.folder("xl/tables"),W.folder("xl/theme"),W.folder("xl/worksheets"),W.folder("xl/worksheets/_rels"),W.file("[Content_Types].xml",' \n'),W.file("_rels/.rels",` +`);return V}function yB($,q,Q={},K){let J=Q||{};J.slideMargin=J.slideMargin||J.slideMargin===0?J.slideMargin:0.5;let Z=J.w||$.presLayout.width,G=[],W=[],B=[],V=[],U=[],w=[0.5,0.5,0.5,0.5],F=0;if(!document.getElementById(q))throw Error('tableToSlides: Table ID "'+q+'" does not exist!');if(K===null||K===void 0?void 0:K._margin){if(Array.isArray(K._margin))w=K._margin;else if(!isNaN(K._margin))w=[K._margin,K._margin,K._margin,K._margin];J.slideMargin=w}else if(J===null||J===void 0?void 0:J.slideMargin){if(Array.isArray(J.slideMargin))w=J.slideMargin;else if(!isNaN(J.slideMargin))w=[J.slideMargin,J.slideMargin,J.slideMargin,J.slideMargin]}if(Z=(J.w?v0(J.w):$.presLayout.width)-v0(w[1]+w[3]),J.verbose)console.log("[[VERBOSE MODE]]"),console.log("|-- `tableToSlides` ----------------------------------------------------|"),console.log(`| tableProps.h .................................... = ${J.h}`),console.log(`| tableProps.w .................................... = ${J.w}`),console.log(`| pptx.presLayout.width ........................... = ${($.presLayout.width/L0).toFixed(1)}`),console.log(`| pptx.presLayout.height .......................... = ${($.presLayout.height/L0).toFixed(1)}`),console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);let M=document.querySelectorAll(`#${q} tr:first-child th`);if(M.length===0)M=document.querySelectorAll(`#${q} tr:first-child td`);if(M.forEach((f)=>{let L=f;if(L.getAttribute("colspan"))for(let D=0;D{F+=f}),U.forEach((f,L)=>{let D=Number((Number(Z)*(f/F*100)/100/L0).toFixed(2)),z=0,N=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(N)z=Number(N.getAttribute("data-pptx-min-width"));let H=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(H)z=Number(H.getAttribute("data-pptx-width"));V.push(z>D?z:D)}),J.verbose)console.log(`| arrColW ......................................... = [${V.join(", ")}]`);["thead","tbody","tfoot"].forEach((f)=>{document.querySelectorAll(`#${q} ${f} tr`).forEach((L)=>{let D=L,z=[];switch(Array.from(D.cells).forEach((N)=>{let H=window.getComputedStyle(N).getPropertyValue("color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(","),v=window.getComputedStyle(N).getPropertyValue("background-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");if(window.getComputedStyle(N).getPropertyValue("background-color")==="rgba(0, 0, 0, 0)"||window.getComputedStyle(N).getPropertyValue("transparent"))v=["255","255","255"];let j={align:null,bold:window.getComputedStyle(N).getPropertyValue("font-weight")==="bold"||Number(window.getComputedStyle(N).getPropertyValue("font-weight"))>=500,border:null,color:A7(Number(H[0]),Number(H[1]),Number(H[2])),fill:{color:A7(Number(v[0]),Number(v[1]),Number(v[2]))},fontFace:(window.getComputedStyle(N).getPropertyValue("font-family")||"").split(",")[0].replace(/"/g,"").replace("inherit","").replace("initial","")||null,fontSize:Number(window.getComputedStyle(N).getPropertyValue("font-size").replace(/[a-z]/gi,"")),margin:null,colspan:Number(N.getAttribute("colspan"))||null,rowspan:Number(N.getAttribute("rowspan"))||null,valign:null};if(["left","center","right","start","end"].includes(window.getComputedStyle(N).getPropertyValue("text-align"))){let n=window.getComputedStyle(N).getPropertyValue("text-align").replace("start","left").replace("end","right");j.align=n==="center"?"center":n==="left"?"left":n==="right"?"right":null}if(["top","middle","bottom"].includes(window.getComputedStyle(N).getPropertyValue("vertical-align"))){let n=window.getComputedStyle(N).getPropertyValue("vertical-align");j.valign=n==="top"?"top":n==="middle"?"middle":n==="bottom"?"bottom":null}if(window.getComputedStyle(N).getPropertyValue("padding-left"))j.margin=[0,0,0,0],["padding-top","padding-right","padding-bottom","padding-left"].forEach((d,_)=>{j.margin[_]=Math.round(Number(window.getComputedStyle(N).getPropertyValue(d).replace(/\D/gi,"")))});if(window.getComputedStyle(N).getPropertyValue("border-top-width")||window.getComputedStyle(N).getPropertyValue("border-right-width")||window.getComputedStyle(N).getPropertyValue("border-bottom-width")||window.getComputedStyle(N).getPropertyValue("border-left-width"))j.border=[null,null,null,null],["top","right","bottom","left"].forEach((d,_)=>{let X=Math.round(Number(window.getComputedStyle(N).getPropertyValue("border-"+d+"-width").replace("px",""))),P=[];P=window.getComputedStyle(N).getPropertyValue("border-"+d+"-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");let g=A7(Number(P[0]),Number(P[1]),Number(P[2]));j.border[_]={pt:X,color:g}});z.push({_type:D0.tablecell,text:N.innerText,options:j})}),f){case"thead":G.push(z);break;case"tbody":W.push(z);break;case"tfoot":B.push(z);break;default:console.log(`table parsing: unexpected table part: ${f}`);break}})}),J._arrObjTabHeadRows=G||null,J.colW=V,GJ([...G,...W,...B],J,$.presLayout,K).forEach((f,L)=>{let D=$.addSlide({masterName:J.masterSlideName||null});if(L===0)J.y=J.y||w[0];if(L>0)J.y=J.autoPageSlideStartY||J.newSlideStartY||w[0];if(J.verbose)console.log(`| opts.autoPageSlideStartY: ${J.autoPageSlideStartY} / arrInchMargins[0]: ${w[0]} => opts.y = ${J.y}`);if(D.addTable(f.rows,{x:J.x||w[3],y:J.y,w:Number(Z)/L0,colW:V,autoPage:!1}),J.addImage)if(J.addImage.options=J.addImage.options||{},!J.addImage.image||!J.addImage.image.path&&!J.addImage.image.data)console.warn("Warning: tableToSlides.addImage requires either `path` or `data`");else D.addImage({path:J.addImage.image.path,data:J.addImage.image.data,x:J.addImage.options.x,y:J.addImage.options.y,w:J.addImage.options.w,h:J.addImage.options.h});if(J.addShape)D.addShape(J.addShape.shapeName,J.addShape.options||{});if(J.addTable)D.addTable(J.addTable.rows,J.addTable.options||{});if(J.addText)D.addText(J.addText.text,J.addText.options||{})})}var hB=0;function xB($,q){if($.bkgd)q.bkgd=$.bkgd;if($.objects&&Array.isArray($.objects)&&$.objects.length>0)$.objects.forEach((Q,K)=>{let J=Object.keys(Q)[0],Z=q;if(W1[J]&&J==="chart")WJ(Z,Q[J].type,Q[J].data,Q[J].opts);else if(W1[J]&&J==="image")BJ(Z,Q[J]);else if(W1[J]&&J==="line")_7(Z,B1.LINE,Q[J]);else if(W1[J]&&J==="rect")_7(Z,B1.RECTANGLE,Q[J]);else if(W1[J]&&J==="text")H5(Z,[{text:Q[J].text}],Q[J].options,!1);else if(W1[J]&&J==="placeholder")Q[J].options.placeholder=Q[J].options.name,delete Q[J].options.name,Q[J].options._placeholderType=Q[J].options.type,delete Q[J].options.type,Q[J].options._placeholderIdx=100+K,H5(Z,[{text:Q[J].text}],Q[J].options,!0)});if($.slideNumber&&typeof $.slideNumber==="object")q._slideNumberProps=$.slideNumber}function WJ($,q,Q,K){var J;function Z(w){if(!w||w.style==="none")return;if(w.size!==void 0&&(isNaN(Number(w.size))||w.size<=0))console.warn("Warning: chart.gridLine.size must be greater than 0."),delete w.size;if(w.style&&!["solid","dash","dot"].includes(w.style))console.warn("Warning: chart.gridLine.style options: `solid`, `dash`, `dot`."),delete w.style;if(w.cap&&!["flat","square","round"].includes(w.cap))console.warn("Warning: chart.gridLine.cap options: `flat`, `square`, `round`."),delete w.cap}let G=++hB,W={_type:null,text:null,options:null,chartRid:null},B=null,V=[];if(Array.isArray(q))q.forEach((w)=>{V=V.concat(w.data)}),B=Q||K;else V=Q,B=K;V.forEach((w,F)=>{if(w._dataIndex=F,w.labels!==void 0&&!Array.isArray(w.labels[0]))w.labels=[w.labels]});let U=B&&typeof B==="object"?B:{};if(U._type=q,U.x=typeof U.x<"u"&&U.x!=null&&!isNaN(Number(U.x))?U.x:1,U.y=typeof U.y<"u"&&U.y!=null&&!isNaN(Number(U.y))?U.y:1,U.w=U.w||"50%",U.h=U.h||"50%",U.objectName=U.objectName?k0(U.objectName):`Chart ${$._slideObjects.filter((w)=>w._type===D0.chart).length}`,!["bar","col"].includes(U.barDir||""))U.barDir="col";if(U._type===q0.AREA){if(!["stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if(U._type===q0.BAR){if(!["clustered","stacked","percentStacked"].includes(U.barGrouping||""))U.barGrouping="clustered"}if(U._type===q0.BAR3D){if(!["clustered","stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if((J=U.barGrouping)===null||J===void 0?void 0:J.includes("tacked")){if(!U.barGapWidthPct)U.barGapWidthPct=50}if(U.dataLabelPosition){if(U._type===q0.AREA||U._type===q0.BAR3D||U._type===q0.DOUGHNUT||U._type===q0.RADAR)delete U.dataLabelPosition;if(U._type===q0.PIE){if(!["bestFit","ctr","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BUBBLE||U._type===q0.BUBBLE3D||U._type===q0.LINE||U._type===q0.SCATTER){if(!["b","ctr","l","r","t"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BAR){if(!["stacked","percentStacked"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(!["clustered"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}}}if(U.dataLabelBkgrdColors=U.dataLabelBkgrdColors||!U.dataLabelBkgrdColors?U.dataLabelBkgrdColors:!1,!["b","l","r","t","tr"].includes(U.legendPos||""))U.legendPos="r";if(!["cone","coneToMax","box","cylinder","pyramid","pyramidToMax"].includes(U.bar3DShape||""))U.bar3DShape="box";if(!["circle","dash","diamond","dot","none","square","triangle"].includes(U.lineDataSymbol||""))U.lineDataSymbol="circle";if(!["gap","span"].includes(U.displayBlanksAs||""))U.displayBlanksAs="span";if(!["standard","marker","filled"].includes(U.radarStyle||""))U.radarStyle="standard";if(U.lineDataSymbolSize=U.lineDataSymbolSize&&!isNaN(U.lineDataSymbolSize)?U.lineDataSymbolSize:6,U.lineDataSymbolLineSize=U.lineDataSymbolLineSize&&!isNaN(U.lineDataSymbolLineSize)?Y0(U.lineDataSymbolLineSize):Y0(0.75),U.layout)["x","y","w","h"].forEach((w)=>{let F=U.layout[w];if(isNaN(Number(F))||F<0||F>1)console.warn("Warning: chart.layout."+w+" can only be 0-1"),delete U.layout[w]});if(U.catGridLine=U.catGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),U.valGridLine=U.valGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{}),U.serGridLine=U.serGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),Z(U.catGridLine),Z(U.valGridLine),Z(U.serGridLine),b7(U.shadow),U.showDataTable=U.showDataTable||!U.showDataTable?U.showDataTable:!1,U.showDataTableHorzBorder=U.showDataTableHorzBorder||!U.showDataTableHorzBorder?U.showDataTableHorzBorder:!0,U.showDataTableVertBorder=U.showDataTableVertBorder||!U.showDataTableVertBorder?U.showDataTableVertBorder:!0,U.showDataTableOutline=U.showDataTableOutline||!U.showDataTableOutline?U.showDataTableOutline:!0,U.showDataTableKeys=U.showDataTableKeys||!U.showDataTableKeys?U.showDataTableKeys:!0,U.showLabel=U.showLabel||!U.showLabel?U.showLabel:!1,U.showLegend=U.showLegend||!U.showLegend?U.showLegend:!1,U.showPercent=U.showPercent||!U.showPercent?U.showPercent:!0,U.showTitle=U.showTitle||!U.showTitle?U.showTitle:!1,U.showValue=U.showValue||!U.showValue?U.showValue:!1,U.showLeaderLines=U.showLeaderLines||!U.showLeaderLines?U.showLeaderLines:!1,U.catAxisLineShow=typeof U.catAxisLineShow<"u"?U.catAxisLineShow:!0,U.valAxisLineShow=typeof U.valAxisLineShow<"u"?U.valAxisLineShow:!0,U.serAxisLineShow=typeof U.serAxisLineShow<"u"?U.serAxisLineShow:!0,U.v3DRotX=!isNaN(U.v3DRotX)&&U.v3DRotX>=-90&&U.v3DRotX<=90?U.v3DRotX:30,U.v3DRotY=!isNaN(U.v3DRotY)&&U.v3DRotY>=0&&U.v3DRotY<=360?U.v3DRotY:30,U.v3DRAngAx=U.v3DRAngAx||!U.v3DRAngAx?U.v3DRAngAx:!0,U.v3DPerspective=!isNaN(U.v3DPerspective)&&U.v3DPerspective>=0&&U.v3DPerspective<=240?U.v3DPerspective:30,U.barGapWidthPct=!isNaN(U.barGapWidthPct)&&U.barGapWidthPct>=0&&U.barGapWidthPct<=1000?U.barGapWidthPct:150,U.barGapDepthPct=!isNaN(U.barGapDepthPct)&&U.barGapDepthPct>=0&&U.barGapDepthPct<=1000?U.barGapDepthPct:150,U.chartColors=Array.isArray(U.chartColors)?U.chartColors:U._type===q0.PIE||U._type===q0.DOUGHNUT?jB:z8,U.chartColorsOpacity=U.chartColorsOpacity&&!isNaN(U.chartColorsOpacity)?U.chartColorsOpacity:null,U.border=U.border&&typeof U.border==="object"?U.border:null,U.border&&(!U.border.pt||isNaN(U.border.pt)))U.border.pt=v6.pt;if(U.border&&(!U.border.color||typeof U.border.color!=="string"))U.border.color=v6.color;if(U.plotArea=U.plotArea||{},U.plotArea.border=U.plotArea.border&&typeof U.plotArea.border==="object"?U.plotArea.border:null,U.plotArea.border&&(!U.plotArea.border.pt||isNaN(U.plotArea.border.pt)))U.plotArea.border.pt=v6.pt;if(U.plotArea.border&&(!U.plotArea.border.color||typeof U.plotArea.border.color!=="string"))U.plotArea.border.color=v6.color;if(U.border)U.plotArea.border=U.border;if(U.plotArea.fill=U.plotArea.fill||{color:null,transparency:null},U.fill)U.plotArea.fill.color=U.fill;if(U.chartArea=U.chartArea||{},U.chartArea.border=U.chartArea.border&&typeof U.chartArea.border==="object"?U.chartArea.border:null,U.chartArea.border)U.chartArea.border={color:U.chartArea.border.color||v6.color,pt:U.chartArea.border.pt||v6.pt};if(U.chartArea.roundedCorners=typeof U.chartArea.roundedCorners==="boolean"?U.chartArea.roundedCorners:!0,U.dataBorder=U.dataBorder&&typeof U.dataBorder==="object"?U.dataBorder:null,U.dataBorder&&(!U.dataBorder.pt||isNaN(U.dataBorder.pt)))U.dataBorder.pt=0.75;if(U.dataBorder&&U.dataBorder.color){let w=typeof U.dataBorder.color==="string"&&U.dataBorder.color.length===6&&/^[0-9A-Fa-f]{6}$/.test(U.dataBorder.color),F=Object.values(L5).includes(U.dataBorder.color);if(!w&&!F)U.dataBorder.color="F9F9F9"}if(!U.dataLabelFormatCode&&U._type===q0.SCATTER)U.dataLabelFormatCode="General";if(!U.dataLabelFormatCode&&(U._type===q0.PIE||U._type===q0.DOUGHNUT))U.dataLabelFormatCode=U.showPercent?"0%":"General";if(U.dataLabelFormatCode=U.dataLabelFormatCode&&typeof U.dataLabelFormatCode==="string"?U.dataLabelFormatCode:"#,##0",!U.dataLabelFormatScatter&&U._type===q0.SCATTER)U.dataLabelFormatScatter="custom";if(U.lineSize=typeof U.lineSize==="number"?U.lineSize:2,U.valAxisMajorUnit=typeof U.valAxisMajorUnit==="number"?U.valAxisMajorUnit:null,U._type===q0.AREA||U._type===q0.BAR||U._type===q0.BAR3D||U._type===q0.LINE)U.catAxisMultiLevelLabels=!!U.catAxisMultiLevelLabels;else delete U.catAxisMultiLevelLabels;return W._type="chart",W.options=U,W.chartRid=a2($),$._relsChart.push({rId:a2($),data:V,opts:U,type:U._type,globalId:G,fileName:`chart${G}.xml`,Target:`/ppt/charts/chart${G}.xml`}),$._slideObjects.push(W),W}function BJ($,q){let Q={_type:null,text:null,options:null,image:null,imageRid:null,hyperlink:null},K=q.x||0,J=q.y||0,Z=q.w||0,G=q.h||0,W=q.sizing||null,B=q.hyperlink||"",V=q.data||"",U=q.path||"",w=a2($),F=q.objectName?k0(q.objectName):`Image ${$._slideObjects.filter((k)=>k._type===D0.image).length}`;if(!U&&!V)return console.error("ERROR: addImage() requires either 'data' or 'path' parameter!"),null;else if(U&&typeof U!=="string")return console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(U)}`),null;else if(V&&typeof V!=="string")return console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(V)}`),null;else if(V&&typeof V==="string"&&!V.toLowerCase().includes("base64,"))return console.error("ERROR: Image `data` value lacks a base64 header! Ex: 'image/png;base64,NMP[...]')"),null;let M=(U.substring(U.lastIndexOf("/")+1).split("?")[0].split(".").pop().split("#")[0]||"png").toLowerCase();if(V&&/image\/(\w+);/.exec(V)&&/image\/(\w+);/.exec(V).length>0)M=/image\/(\w+);/.exec(V)[1];else if(V===null||V===void 0?void 0:V.toLowerCase().includes("image/svg+xml"))M="svg";if(Q._type=D0.image,Q.image=U||"preencoded.png",Q.options={x:K||0,y:J||0,w:Z||1,h:G||1,altText:q.altText||"",rounding:typeof q.rounding==="boolean"?q.rounding:!1,sizing:W,placeholder:q.placeholder,rotate:q.rotate||0,flipV:q.flipV||!1,flipH:q.flipH||!1,transparency:q.transparency||0,objectName:F,shadow:b7(q.shadow)},M==="svg")$._relsMedia.push({path:U||V+"png",type:"image/png",extn:"png",data:V||"",rId:w,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`,isSvgPng:!0,svgSize:{w:H0(Q.options.w,"X",$._presLayout),h:H0(Q.options.h,"Y",$._presLayout)}}),Q.imageRid=w,$._relsMedia.push({path:U||V,type:"image/svg+xml",extn:M,data:V||"",rId:w+1,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w+1;else{let k=$._relsMedia.filter((f)=>f.path&&f.path===U&&f.type==="image/"+M&&!f.isDuplicate)[0];$._relsMedia.push({path:U||"preencoded."+M,type:"image/"+M,extn:M,data:V||"",rId:w,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w}if(typeof B==="object")if(!B.url&&!B.slide)throw Error("ERROR: `hyperlink` option requires either: `url` or `slide`");else w++,$._rels.push({type:D0.hyperlink,data:B.slide?"slide":"dummy",rId:w,Target:B.url||B.slide.toString()}),B._rId=w,Q.hyperlink=B;$._slideObjects.push(Q)}function OB($,q){let Q=q.x||0,K=q.y||0,J=q.w||2,Z=q.h||2,G=q.data||"",W=q.link||"",B=q.path||"",V=q.type||"audio",U="",w=q.cover||gB,F=q.objectName?k0(q.objectName):`Media ${$._slideObjects.filter((k)=>k._type===D0.media).length}`,M={_type:D0.media};if(!B&&!G&&V!=="online")throw Error("addMedia() error: either `data` or `path` are required!");else if(G&&!G.toLowerCase().includes("base64,"))throw Error("addMedia() error: `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')");else if(!w.toLowerCase().includes("base64,"))throw Error("addMedia() error: `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')");if(V==="online"&&!W)throw Error("addMedia() error: online videos require `link` value");if(U=q.extn||(G?G.split(";")[0].split("/")[1]:B.split(".").pop())||"mp3",M.mtype=V,M.media=B||"preencoded.mov",M.options={},M.options.x=Q,M.options.y=K,M.options.w=J,M.options.h=Z,M.options.objectName=F,V==="online"){let k=a2($);$._relsMedia.push({path:B||"preencoded"+U,data:"dummy",type:"online",extn:U,rId:k,Target:W}),M.mediaRid=k,$._relsMedia.push({path:"preencoded.png",data:w,type:"image/png",extn:"png",rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}else{let k=$._relsMedia.filter((L)=>L.path&&L.path===B&&L.type===V+"/"+U&&!L.isDuplicate)[0],f=a2($);$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:f,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+1}.${U}`}),M.mediaRid=f,$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:a2($),isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+0}.${U}`}),$._relsMedia.push({path:"preencoded.png",type:"image/png",extn:"png",data:w,rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}$._slideObjects.push(M)}function PB($,q){$._slideObjects.push({_type:D0.notes,text:[{text:q}]})}function _7($,q,Q){let K=typeof Q==="object"?Q:{};K.line=K.line||{type:"none"};let J={_type:D0.text,shape:q||B1.RECTANGLE,options:K,text:null};if(!q)throw Error("Missing/Invalid shape parameter! Example: `addShape(pptxgen.shapes.LINE, {x:1, y:1, w:1, h:1});`");let Z={type:K.line.type||"solid",color:K.line.color||VJ,transparency:K.line.transparency||0,width:K.line.width||1,dashType:K.line.dashType||"solid",beginArrowType:K.line.beginArrowType||null,endArrowType:K.line.endArrowType||null};if(typeof K.line==="object"&&K.line.type!=="none")K.line=Z;if(K.x=K.x||(K.x===0?0:1),K.y=K.y||(K.y===0?0:1),K.w=K.w||(K.w===0?0:1),K.h=K.h||(K.h===0?0:1),K.objectName=K.objectName?k0(K.objectName):`Shape ${$._slideObjects.filter((G)=>G._type===D0.text).length}`,typeof K.line==="string"){let G=Z;G.color=String(K.line),K.line=G}if(typeof K.lineSize==="number")K.line.width=K.lineSize;if(typeof K.lineDash==="string")K.line.dashType=K.lineDash;if(typeof K.lineHead==="string")K.line.beginArrowType=K.lineHead;if(typeof K.lineTail==="string")K.line.endArrowType=K.lineTail;g6($,J),$._slideObjects.push(J)}function TB($,q,Q,K,J,Z,G){let W=[$],B=Q&&typeof Q==="object"?Q:{};B.objectName=B.objectName?k0(B.objectName):`Table ${$._slideObjects.filter((F)=>F._type===D0.table).length}`;{if(q===null||q.length===0||!Array.isArray(q))throw Error("addTable: Array expected! EX: 'slide.addTable( [rows], {options} );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)");if(!q[0]||!Array.isArray(q[0]))throw Error("addTable: 'rows' should be an array of cells! EX: 'slide.addTable( [ ['A'], ['B'], {text:'C',options:{align:'center'}} ] );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)")}let V=[];if(q.forEach((F)=>{let M=[];if(Array.isArray(F))F.forEach((k)=>{let f={_type:D0.tablecell,text:"",options:typeof k==="object"&&k.options?k.options:{}};if(typeof k==="string"||typeof k==="number")f.text=k.toString();else if(k.text){if(typeof k.text==="string"||typeof k.text==="number")f.text=k.text.toString();else if(k.text)f.text=k.text;if(k.options&&typeof k.options==="object")f.options=k.options}f.options.border=f.options.border||B.border||[{type:"none"},{type:"none"},{type:"none"},{type:"none"}];let L=f.options.border;if(!Array.isArray(L)&&typeof L==="object")f.options.border=[L,L,L,L];if(!f.options.border[0])f.options.border[0]={type:"none"};if(!f.options.border[1])f.options.border[1]={type:"none"};if(!f.options.border[2])f.options.border[2]={type:"none"};if(!f.options.border[3])f.options.border[3]={type:"none"};[0,1,2,3].forEach((z)=>{f.options.border[z]={type:f.options.border[z].type||H6.type,color:f.options.border[z].color||H6.color,pt:typeof f.options.border[z].pt==="number"?f.options.border[z].pt:H6.pt}}),M.push(f)});else console.log("addTable: tableRows has a bad row. A row should be an array of cells. You provided:"),console.log(F);V.push(M)}),B.x=H0(B.x||(B.x===0?0:L0/2),"X",J),B.y=H0(B.y||(B.y===0?0:L0/2),"Y",J),B.h)B.h=H0(B.h,"Y",J);if(B.fontSize=B.fontSize||k2,B.margin=B.margin===0||B.margin?B.margin:JJ,typeof B.margin==="number")B.margin=[Number(B.margin),Number(B.margin),Number(B.margin),Number(B.margin)];if(JSON.stringify({arrRows:V}).indexOf("hyperlink")===-1){if(!B.color)B.color=B.color||Q2}if(typeof B.border==="string")console.warn("addTable `border` option must be an object. Ex: `{border: {type:'none'}}`"),B.border=null;else if(Array.isArray(B.border))[0,1,2,3].forEach((F)=>{B.border[F]=B.border[F]?{type:B.border[F].type||H6.type,color:B.border[F].color||H6.color,pt:B.border[F].pt||H6.pt}:{type:"none"}});if(B.autoPage=typeof B.autoPage==="boolean"?B.autoPage:!1,B.autoPageRepeatHeader=typeof B.autoPageRepeatHeader==="boolean"?B.autoPageRepeatHeader:!1,B.autoPageHeaderRows=typeof B.autoPageHeaderRows<"u"&&!isNaN(Number(B.autoPageHeaderRows))?Number(B.autoPageHeaderRows):1,B.autoPageLineWeight=typeof B.autoPageLineWeight<"u"&&!isNaN(Number(B.autoPageLineWeight))?Number(B.autoPageLineWeight):0,B.autoPageLineWeight){if(B.autoPageLineWeight>1)B.autoPageLineWeight=1;else if(B.autoPageLineWeight<-1)B.autoPageLineWeight=-1}let U=M8;if(K&&typeof K._margin<"u"){if(Array.isArray(K._margin))U=K._margin;else if(!isNaN(Number(K._margin)))U=[Number(K._margin),Number(K._margin),Number(K._margin),Number(K._margin)]}if(B.colW){let F=V[0].reduce((M,k)=>{var f;if(((f=k===null||k===void 0?void 0:k.options)===null||f===void 0?void 0:f.colspan)&&typeof k.options.colspan==="number")M+=k.options.colspan;else M+=1;return M},0);if(typeof B.colW==="string"||typeof B.colW==="number")B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length===1&&F>1)B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length!==F)console.warn("addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths."),B.colW=null}else if(B.w)B.w=H0(B.w,"X",J);else B.w=Math.floor(J._sizeW/L0-U[1]-U[3]);if(B.x&&B.x<20)B.x=v0(B.x);if(B.y&&B.y<20)B.y=v0(B.y);if(B.w&&typeof B.w==="number"&&B.w<20)B.w=v0(B.w);if(B.h&&typeof B.h==="number"&&B.h<20)B.h=v0(B.h);V.forEach((F)=>{F.forEach((M,k)=>{if(typeof M==="number"||typeof M==="string")F[k]={_type:D0.tablecell,text:String(F[k]),options:B};else if(typeof M==="object"){if(typeof M.text==="number")F[k].text=F[k].text.toString();else if(typeof M.text>"u"||M.text===null)F[k].text="";F[k].options=M.options||{},F[k]._type=D0.tablecell}})});let w=[];if(B&&!B.autoPage)g6($,V),$._slideObjects.push({_type:D0.table,arrTabRows:V,options:Object.assign({},B)});else{if(B.autoPageRepeatHeader)B._arrObjTabHeadRows=V.filter((F,M)=>M{if(!G($._slideNum+M))W.push(Z({masterName:(K===null||K===void 0?void 0:K._name)||null}));if(M>0)B.y=v0(B.autoPageSlideStartY||B.newSlideStartY||U[0]);{let k=G($._slideNum+M);if(B.autoPage=!1,g6(k,F.rows),k.addTable(F.rows,Object.assign({},B)),M>0)w.push(k)}})}return w}function H5($,q,Q,K){let J={_type:K?D0.placeholder:D0.text,shape:(Q===null||Q===void 0?void 0:Q.shape)||B1.RECTANGLE,text:!q||q.length===0?[{text:"",options:null}]:q,options:Q||{}};function Z(G){{if(!G.placeholder)G.color=G.color||J.options.color||$.color||Q2;if(G.placeholder||K)G.bullet=G.bullet||!1;if(G.placeholder&&$._slideLayout&&$._slideLayout._slideObjects){let W=$._slideLayout._slideObjects.filter((B)=>B._type==="placeholder"&&B.options&&B.options.placeholder&&B.options.placeholder===G.placeholder)[0];if(W===null||W===void 0?void 0:W.options)G=Object.assign(Object.assign({},G),W.options)}if(G.objectName=G.objectName?k0(G.objectName):`Text ${$._slideObjects.filter((W)=>W._type===D0.text).length}`,G.shape===B1.LINE){let W={type:G.line.type||"solid",color:G.line.color||VJ,transparency:G.line.transparency||0,width:G.line.width||1,dashType:G.line.dashType||"solid",beginArrowType:G.line.beginArrowType||null,endArrowType:G.line.endArrowType||null};if(typeof G.line==="object")G.line=W;if(typeof G.line==="string"){let B=W;if(typeof G.line==="string")B.color=G.line;G.line=B}if(typeof G.lineSize==="number")G.line.width=G.lineSize;if(typeof G.lineDash==="string")G.line.dashType=G.lineDash;if(typeof G.lineHead==="string")G.line.beginArrowType=G.lineHead;if(typeof G.lineTail==="string")G.line.endArrowType=G.lineTail}if(G.line=G.line||{},G.lineSpacing=G.lineSpacing&&!isNaN(G.lineSpacing)?G.lineSpacing:null,G.lineSpacingMultiple=G.lineSpacingMultiple&&!isNaN(G.lineSpacingMultiple)?G.lineSpacingMultiple:null,G._bodyProp=G._bodyProp||{},G._bodyProp.autoFit=G.autoFit||!1,G._bodyProp.anchor=!G.placeholder?I6.ctr:null,G._bodyProp.vert=G.vert||null,G._bodyProp.wrap=typeof G.wrap==="boolean"?G.wrap:!0,G.inset&&!isNaN(Number(G.inset))||G.inset===0)G._bodyProp.lIns=v0(G.inset),G._bodyProp.rIns=v0(G.inset),G._bodyProp.tIns=v0(G.inset),G._bodyProp.bIns=v0(G.inset);if(typeof G.underline==="boolean"&&G.underline===!0)G.underline={style:"sng"}}{if((G.align||"").toLowerCase().indexOf("c")===0)G._bodyProp.align=R6.center;else if((G.align||"").toLowerCase().indexOf("l")===0)G._bodyProp.align=R6.left;else if((G.align||"").toLowerCase().indexOf("r")===0)G._bodyProp.align=R6.right;else if((G.align||"").toLowerCase().indexOf("j")===0)G._bodyProp.align=R6.justify;if((G.valign||"").toLowerCase().indexOf("b")===0)G._bodyProp.anchor=I6.b;else if((G.valign||"").toLowerCase().indexOf("m")===0)G._bodyProp.anchor=I6.ctr;else if((G.valign||"").toLowerCase().indexOf("t")===0)G._bodyProp.anchor=I6.t}return b7(G.shadow),G}J.options=Z(J.options),J.text.forEach((G)=>G.options=Z(G.options||{})),g6($,J.text||""),$._slideObjects.push(J)}function uB($){($._slideLayout._slideObjects||[]).forEach((q)=>{if(q._type===D0.placeholder){if($._slideObjects.filter((Q)=>Q.options&&Q.options.placeholder===q.options.placeholder).length===0)H5($,[{text:""}],q.options,!1)}})}function zJ($,q){var Q;if(q.bkgd){if(!q.background)q.background={};if(typeof q.bkgd==="string")q.background.color=q.bkgd;else{if(q.bkgd.data)q.background.data=q.bkgd.data;if(q.bkgd.path)q.background.path=q.bkgd.path;if(q.bkgd.src)q.background.path=q.bkgd.src}}if((Q=q.background)===null||Q===void 0?void 0:Q.fill)q.background.color=q.background.fill;if($&&($.path||$.data)){$.path=$.path||"preencoded.png";let K=($.path.split(".").pop()||"png").split("?")[0];if(K==="jpg")K="jpeg";q._relsMedia=q._relsMedia||[];let J=q._relsMedia.length+1;q._relsMedia.push({path:$.path,type:D0.image,extn:K,data:$.data||null,rId:J,Target:`../media/${(q._name||"").replace(/\s+/gi,"-")}-image-${q._relsMedia.length+1}.${K}`}),q._bkgdImgRid=J}}function g6($,q,Q){let K=[];if(typeof q==="string"||typeof q==="number")return;else if(Array.isArray(q))K=q;else if(typeof q==="object")K=[q];K.forEach((J,Z)=>{if(Q&&Q[Z]&&Q[Z].hyperlink)J.options=Object.assign(Object.assign({},J.options),Q[Z]);if(Array.isArray(J)){let G=[];J.forEach((W)=>{if(W.options&&!W.text.options)G.push(W.options)}),g6($,J,G)}else if(Array.isArray(J.text))g6($,J.text,Q&&Q[Z]?[Q[Z]]:void 0);else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&!J.options.hyperlink._rId)if(typeof J.options.hyperlink!=="object")console.log("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:'https://github.com'}` ");else if(!J.options.hyperlink.url&&!J.options.hyperlink.slide)console.log("ERROR: 'hyperlink requires either: `url` or `slide`'");else{let G=a2($);$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:G,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()}),J.options.hyperlink._rId=G}else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&J.options.hyperlink._rId){if($._rels.filter((G)=>G.rId===J.options.hyperlink._rId).length===0)$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:J.options.hyperlink._rId,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()})}})}class FJ{constructor($){var q;this.addSlide=$.addSlide,this.getSlide=$.getSlide,this._name=`Slide ${$.slideNumber}`,this._presLayout=$.presLayout,this._rId=$.slideRId,this._rels=[],this._relsChart=[],this._relsMedia=[],this._setSlideNum=$.setSlideNum,this._slideId=$.slideId,this._slideLayout=$.slideLayout||null,this._slideNum=$.slideNumber,this._slideObjects=[],this._slideNumberProps=((q=this._slideLayout)===null||q===void 0?void 0:q._slideNumberProps)?this._slideLayout._slideNumberProps:null}set bkgd($){if(this._bkgd=$,!this._background||!this._background.color){if(!this._background)this._background={};if(typeof $==="string")this._background.color=$}}get bkgd(){return this._bkgd}set background($){if(this._background=$,$)zJ($,this)}get background(){return this._background}set color($){this._color=$}get color(){return this._color}set hidden($){this._hidden=$}get hidden(){return this._hidden}set slideNumber($){this._slideNumberProps=$,this._setSlideNum($)}get slideNumber(){return this._slideNumberProps}get newAutoPagedSlides(){return this._newAutoPagedSlides}addChart($,q,Q){let K=Q||{};return K._type=$,WJ(this,$,q,Q),this}addImage($){return BJ(this,$),this}addMedia($){return OB(this,$),this}addNotes($){return PB(this,$),this}addShape($,q){return _7(this,$,q),this}addTable($,q){return this._newAutoPagedSlides=TB(this,$,q,this._slideLayout,this._presLayout,this.addSlide,this.getSlide),this}addText($,q){return H5(this,typeof $==="string"||typeof $==="number"?[{text:$,options:q}]:$,q,!1),this}}function SB($,q){return W2(this,void 0,void 0,function*(){let Q=$.data;return yield new Promise((K,J)=>{var Z,G;let W=new c7.default,B=(Q.length-1)*2+1,V=((G=(Z=Q[0])===null||Z===void 0?void 0:Z.labels)===null||G===void 0?void 0:G.length)>1;W.folder("_rels"),W.folder("docProps"),W.folder("xl/_rels"),W.folder("xl/tables"),W.folder("xl/theme"),W.folder("xl/worksheets"),W.folder("xl/worksheets/_rels"),W.file("[Content_Types].xml",' \n'),W.file("_rels/.rels",` `),W.file("docProps/app.xml",`Microsoft Macintosh Excel0falseWorksheets1Sheet1falsefalsefalse16.0300 `),W.file("docProps/core.xml",'PptxGenJSPptxGenJS'+new Date().toISOString()+''+new Date().toISOString()+""),W.file("xl/_rels/workbook.xml.rels",''),W.file("xl/styles.xml",'\n'),W.file("xl/theme/theme1.xml",''),W.file("xl/workbook.xml",` `),W.file("xl/worksheets/_rels/sheet1.xml.rels",` `);{let U='';if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)U+=``;else if($.opts._type===q0.SCATTER)U+=``;else if(V){let w=Q.length;Q[0].labels.forEach((F)=>w+=F.filter((M)=>M&&M!=="").length),U+=``,U+=""}else{let w=Q.length+Q[0].labels.length*Q[0].labels[0].length+Q[0].labels.length,F=Q.length+Q[0].labels.length*Q[0].labels[0].length+1;U+=``,U+=''}if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)Q.forEach((w,F)=>{if(F===0)U+="X-Axis";else U+=`${k0(w.name||`Y-Axis${F}`)}`,U+=`${k0(`Size${F}`)}`});else Q.forEach((w)=>{U+=`${k0((w.name||" ").replace("X-Axis","X-Values"))}`});if($.opts._type!==q0.BUBBLE&&$.opts._type!==q0.BUBBLE3D&&$.opts._type!==q0.SCATTER)Q[0].labels.slice().reverse().forEach((w)=>{w.filter((F)=>F&&F!=="").forEach((F)=>{U+=`${k0(F)}`})});U+=` `,W.file("xl/sharedStrings.xml",U)}{let U='';if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D){U+=``,U+=``;let w=1;Q.forEach((F,M)=>{if(M===0)U+=``;else U+=``,w++,U+=``})}else if($.opts._type===q0.SCATTER)U+=`
`,U+=``,Q.forEach((w,F)=>{U+=``});else U+=`
`,U+=``,Q[0].labels.forEach((w,F)=>{U+=``}),Q.forEach((w,F)=>{U+=``});U+="",U+='',U+="
",W.file("xl/tables/table1.xml",U)}{let U='';if(U+='',$.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)U+=``;else if($.opts._type===q0.SCATTER)U+=``;else U+=``;if(U+='',U+='',$.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D){U+="",U+=``,U+='0';for(let w=1;w${w}`;U+="",Q[0].values.forEach((w,F)=>{U+=``,U+=`${w}`;let M=2;for(let k=1;k${Q[k].values[F]||""}`,M++,U+=`${Q[k].sizes[F]||""}`,M++;U+=""})}else if($.opts._type===q0.SCATTER){U+="",U+=``;for(let w=0;w${w}`;U+="",Q[0].values.forEach((w,F)=>{U+=``,U+=`${w}`;for(let M=1;M${Q[M].values[F]||Q[M].values[F]===0?Q[M].values[F]:""}`;U+=""})}else if(U+="",!V){U+=``,Q[0].labels.forEach((w,F)=>{U+=`0`});for(let w=0;w${w+1}`;U+="",Q[0].labels[0].forEach((w,F)=>{U+=``;for(let M=Q[0].labels.length-1;M>=0;M--)U+=``,U+=`${Q.length+F+1}`,U+="";for(let M=0;M${Q[M].values[F]||""}`;U+=""})}else{U+=``;for(let k=0;k0`;for(let k=Q[0].labels.length-1;k${k}`;U+="";let w=Q.length,F=Q[0].labels[0].length,M=Q[0].labels.length;for(let k=0;k`;let f=w,L=Q[0].labels.slice().reverse();L.forEach((D,z)=>{if(D[k]){let H=z===0?1:L[z-1].filter((v)=>v&&v!=="").length;f+=H,U+=`${f}`}});for(let D=0;D${Q[D].values[k]||0}`;U+=""}}U+="",U+='',U+=` -`,W.file("xl/worksheets/sheet1.xml",U)}W.generateAsync({type:"base64"}).then((U)=>{q.file(`ppt/embeddings/Microsoft_Excel_Worksheet${$.globalId}.xlsx`,U,{base64:!0}),q.file("ppt/charts/_rels/"+$.fileName+".rels",``),q.file(`ppt/charts/${$.fileName}`,xB($)),K("")}).catch((U)=>{J(U)})})})}function xB($){var q,Q,K,J;let Z='',G=!1;{if(Z+='',Z+='',Z+=``,Z+="",$.opts.showTitle)Z+=v5({title:$.opts.title||"Chart Title",color:$.opts.titleColor,fontFace:$.opts.titleFontFace,fontSize:$.opts.titleFontSize||DB,titleAlign:$.opts.titleAlign,titleBold:$.opts.titleBold,titlePos:$.opts.titlePos,titleRotate:$.opts.titleRotate},$.opts.x,$.opts.y),Z+='';else Z+='';if($.opts._type===q0.BAR3D)Z+=``;if(Z+="",$.opts.layout)Z+="",Z+=" ",Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+="";else Z+=""}if(Array.isArray($.opts._type))$.opts._type.forEach((W)=>{let B=Object.assign(Object.assign({},$.opts),W.options),V=B.secondaryValAxis?Y5:o2,U=B.secondaryCatAxis?O7:B8;G=G||B.secondaryValAxis,Z+=$J(W.type,W.data,B,V,U)});else Z+=$J($.opts._type,$.data,$.opts,o2,B8);if($.opts._type!==q0.PIE&&$.opts._type!==q0.DOUGHNUT){if($.opts.valAxes&&$.opts.valAxes.length>1&&!G)throw Error("Secondary axis must be used by one of the multiple charts");if($.opts.catAxes){if(!$.opts.valAxes||$.opts.valAxes.length!==$.opts.catAxes.length)throw Error("There must be the same number of value and category axes.");Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[0]),B8,o2)}else Z+=X7($.opts,B8,o2);if($.opts.valAxes){if(Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[0]),o2),$.opts.valAxes[1])Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[1]),Y5)}else if(Z+=y7($.opts,o2),$.opts._type===q0.BAR3D)Z+=OB($.opts,UJ,o2);if(((q=$.opts)===null||q===void 0?void 0:q.catAxes)&&((Q=$.opts)===null||Q===void 0?void 0:Q.catAxes[1]))Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[1]),O7,Y5)}{if($.opts.showDataTable)Z+="",Z+=` `,Z+=` `,Z+=` `,Z+=` `,Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=` `,Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+="";if(Z+=" ",Z+=((K=$.opts.plotArea.fill)===null||K===void 0?void 0:K.color)?B2($.opts.plotArea.fill):"",Z+=$.opts.plotArea.border?`${B2($.opts.plotArea.border.color)}`:"",Z+=" ",Z+=" ",Z+="",$.opts.showLegend){if(Z+="",Z+='',Z+='',$.opts.legendFontFace||$.opts.legendFontSize||$.opts.legendColor){if(Z+="",Z+=" ",Z+=" ",Z+=" ",Z+=" ",Z+=$.opts.legendFontSize?``:"",$.opts.legendColor)Z+=B2($.opts.legendColor);if($.opts.legendFontFace)Z+='';if($.opts.legendFontFace)Z+='';Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=""}Z+=""}}if(Z+=' ',Z+=' ',$.opts._type===q0.SCATTER)Z+='';return Z+="",Z+="",Z+=((J=$.opts.chartArea.fill)===null||J===void 0?void 0:J.color)?B2($.opts.chartArea.fill):"",Z+=$.opts.chartArea.border?`${B2($.opts.chartArea.border.color)}`:"",Z+=" ",Z+="",Z+='',Z+="",Z}function $J($,q,Q,K,J,Z){let G=-1,W=1,B=null,V="";switch($){case q0.AREA:case q0.BAR:case q0.BAR3D:case q0.LINE:case q0.RADAR:if(V+=``,$===q0.AREA&&Q.barGrouping==="stacked")V+='';if($===q0.BAR||$===q0.BAR3D)V+='',V+='';if($===q0.RADAR)V+='';V+='',q.forEach((U)=>{var w;G++,V+="",V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(U._dataIndex+U.labels.length+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";let F=Q.chartColors?Q.chartColors[G%Q.chartColors.length]:null;if(V+=" ",F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,``)+"";else V+=""+R0(F)+"";if($===q0.LINE||$===q0.RADAR)if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+='';else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;if(V+=T1(Q.shadow,P1),V+=" ",V+=' ',$!==q0.RADAR){if(V+="",V+=``,Q.dataLabelBkgrdColors)V+=`${R0(F)}`;if(V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+=``,V+=""}if($===q0.LINE||$===q0.RADAR){if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+=" ",V+=` ${R0(Q.chartColors[U._dataIndex+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):U._dataIndex])}`,V+=` ${R0(Q.lineDataSymbolLineColor||F)}`,V+=" ",V+=" ",V+=""}if(($===q0.BAR||$===q0.BAR3D)&&q.length===1&&(Q.chartColors&&Q.chartColors!==z8&&Q.chartColors.length>1||((w=Q.invertedColors)===null||w===void 0?void 0:w.length)))U.values.forEach((M,k)=>{let f=M<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else if($===q0.BAR)V+="",V+=' ',V+="";else V+="",V+=" ",V+=' ',V+=" ",V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});{if(V+="",Q.catLabelFormatCode)V+=" ",V+=` Sheet1!$A$2:$A$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.catLabelFormatCode||"General")+"",V+=` `,U.labels[0].forEach((M,k)=>V+=`${k0(M)}`),V+=" ",V+=" ";else V+=" ",V+=` Sheet1!$A$2:$${j0(U.labels.length)}$${U.labels[0].length+1}`,V+=" ",V+=` `,U.labels.forEach((M)=>{V+="",M.forEach((k,f)=>V+=`${k0(k)}`),V+=""}),V+=" ",V+=" ";V+=""}if(V+="",V+=" ",V+=`Sheet1!$${j0(U._dataIndex+U.labels.length+1)}$2:$${j0(U._dataIndex+U.labels.length+1)}$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.valLabelFormatCode||Q.dataTableFormatCode||"General")+"",V+=` `,U.values.forEach((M,k)=>V+=`${M||M===0?M:""}`),V+=" ",V+=" ",V+="",$===q0.LINE)V+='';V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+=" "}if($===q0.BAR)V+=` `,V+=` `;else if($===q0.BAR3D)V+=` `,V+=` `,V+=' ';else if($===q0.LINE)V+=' ';V+=``,V+=``;break;case q0.SCATTER:V+="",V+='',V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=` Sheet1!$${j0(w+2)}$1`,V+=' '+k0(U.name)+"",V+=" ",V+=" ",V+=" ";{let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,'')+"";else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1)}V+=" ";{if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+="",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,V+=`${R0(Q.lineDataSymbolLineColor||Q.chartColors[G%Q.chartColors.length])}`,V+="",V+="",V+=""}if(Q.showLabel){let F=k5("-xxxx-xxxx-xxxx-xxxxxxxxxxxx");if(U.labels[0]&&(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"))V+="",U.labels[0].forEach((M,k)=>{if(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"){if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" "+k0(M)+"",V+=" ",Q.dataLabelFormatScatter==="customXY"&&!/^ *$/.test(M))V+=" ",V+=' ',V+=" (",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"",V+=" ",V+=" ",V+=' ',V+=" , ",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"]",V+=" ",V+=" ",V+=' ',V+=" )",V+=" ",V+=' ';if(V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=` `,V+=" ",V+=" ",V+=""}}),V+="";if(Q.dataLabelFormatScatter==="XY"){if(V+="",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=` `,V+=` `,V+=` `,V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=""}}if(q.length===1&&Q.chartColors!==z8)U.values.forEach((F,M)=>{let k=F<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else V+="",V+=' ',V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=` Sheet1!$${j0(w+2)}$2:$${j0(w+2)}$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+='',V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}V+=``,V+="";break;case q0.BUBBLE:case q0.BUBBLE3D:V+="",V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(W+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";{V+="";let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=`${R0(F,'')}`;else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1),V+=""}V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${q[0].values.length+1}`,W++,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${U.sizes.length+1}`,W++,V+=" ",V+=" General",V+=` `,U.sizes.forEach((F,M)=>{V+=`${F||""}`}),V+=" ",V+=" ",V+=" ",V+=' ',V+=""});{if(V+="",V+=``,V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+="",V+=' ',V+=' ',V+=" ",V+="",V+=""}V+=``,V+="";break;case q0.DOUGHNUT:case q0.PIE:if(B=q[0],V+="",V+=' ',V+="",V+=' ',V+=' ',V+=" ",V+=" ",V+=" Sheet1!$B$1",V+=" ",V+=' ',V+=' '+k0(B.name)+"",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=' ',Q.dataNoEffects)V+="";else V+=T1(Q.shadow,P1);if(V+=" ",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=' ',V+=" ",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;V+=T1(Q.shadow,P1),V+=" ",V+=""}),V+="",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=` `,V+=" ",V+=" ",V+=" ",$===q0.PIE&&Q.dataLabelPosition)V+=``;V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}),V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=' ',V+=" ",V+=" ",V+=" ",V+=" ",V+=$===q0.PIE?'':"",V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+="",V+="",V+=" ",V+=` Sheet1!$A$2:$A$${B.labels[0].length+1}`,V+=" ",V+=` `,B.labels[0].forEach((U,w)=>{V+=`${k0(U)}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=` Sheet1!$B$2:$B$${B.labels[0].length+1}`,V+=" ",V+=` `,B.values.forEach((U,w)=>{V+=`${U||U===0?U:""}`}),V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,$===q0.DOUGHNUT)V+=``;V+="";break;default:V+="";break}return V}function X7($,q,Q){let K="";if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";if(K+=' ',K+=" ",K+='',$.catAxisMaxVal||$.catAxisMaxVal===0)K+=``;if($.catAxisMinVal||$.catAxisMinVal===0)K+=``;if(K+="",K+=' ',K+=' ',K+=$.catGridLine.style!=="none"?n7($.catGridLine):"",$.showCatAxisTitle)K+=v5({color:$.catAxisTitleColor,fontFace:$.catAxisTitleFontFace,fontSize:$.catAxisTitleFontSize,titleRotate:$.catAxisTitleRotate,title:$.catAxisTitle||"Axis Title"});if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+=' ';else K+=' ';if($._type===q0.SCATTER)K+=' ',K+=' ',K+=' ';else K+=' ',K+=' ',K+=' ';if(K+=" ",K+=` `,K+=!$.catAxisLineShow?"":""+R0($.catAxisLineColor||u1.color)+"",K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",$.catAxisLabelRotate)K+=``;else K+="";if(K+=" ",K+=" ",K+=" ",K+=` `,K+=" "+R0($.catAxisLabelColor||Q2)+"",K+=' ',K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=` `,K+=' ',K+=' ',K+=` `,$.catAxisLabelFrequency)K+=' ';if($.catLabelFormatCode||$._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D){if($.catLabelFormatCode){if(["catAxisBaseTimeUnit","catAxisMajorTimeUnit","catAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes($[J].toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.catAxisBaseTimeUnit)K+='';if($.catAxisMajorTimeUnit)K+='';if($.catAxisMinorTimeUnit)K+=''}if($.catAxisMajorUnit)K+=``;if($.catAxisMinorUnit)K+=``}if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";return K}function y7($,q){let Q=q===o2?$.barDir==="col"?"l":"b":$.barDir!=="col"?"r":"t";if(q===Y5)Q="r";let K=q===o2?B8:O7,J="";if(J+="",J+=' ',J+=" ",$.valAxisLogScaleBase)J+=``;if(J+='',$.valAxisMaxVal||$.valAxisMaxVal===0)J+=``;if($.valAxisMinVal||$.valAxisMinVal===0)J+=``;if(J+=" ",J+=` `,J+=' ',$.valGridLine.style!=="none")J+=n7($.valGridLine);if($.showValAxisTitle)J+=v5({color:$.valAxisTitleColor,fontFace:$.valAxisTitleFontFace,fontSize:$.valAxisTitleFontSize,titleRotate:$.valAxisTitleRotate,title:$.valAxisTitle||"Axis Title"});if(J+=``,$._type===q0.SCATTER)J+=' ',J+=' ',J+=' ';else J+=' ',J+=' ',J+=' ';if(J+=" ",J+=` `,J+=!$.valAxisLineShow?"":""+R0($.valAxisLineColor||u1.color)+"",J+=' ',J+=" ",J+=" ",J+=" ",J+=" ",J+=` `,J+=" ",J+=" ",J+=" ",J+=` `,J+=" "+R0($.valAxisLabelColor||Q2)+"",J+=' ',J+=" ",J+=" ",J+=' ',J+=" ",J+=" ",J+=' ',typeof $.catAxisCrossesAt==="number")J+=` `;else if(typeof $.catAxisCrossesAt==="string")J+=' ';else J+=' ';if(J+=' ',$.valAxisMajorUnit)J+=` `;if($.valAxisDisplayUnit)J+=`${$.valAxisDisplayUnitLabel?"":""}`;return J+="",J}function OB($,q,Q){let K="";if(K+="",K+=' ',K+=' ',K+=' ',K+=' ',K+=$.serGridLine.style!=="none"?n7($.serGridLine):"",$.showSerAxisTitle)K+=v5({color:$.serAxisTitleColor,fontFace:$.serAxisTitleFontFace,fontSize:$.serAxisTitleFontSize,titleRotate:$.serAxisTitleRotate,title:$.serAxisTitle||"Axis Title"});if(K+=` `,K+=' ',K+=' ',K+=` `,K+=" ",K+=' ',K+=!$.serAxisLineShow?"":`${R0($.serAxisLineColor||u1.color)}`,K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=` `,K+=` ${R0($.serAxisLabelColor||Q2)}`,K+=` `,K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=' ',$.serAxisLabelFrequency)K+=' ';if($.serLabelFormatCode){if(["serAxisBaseTimeUnit","serAxisMajorTimeUnit","serAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes(J.toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.serAxisBaseTimeUnit)K+=` `;if($.serAxisMajorTimeUnit)K+=` `;if($.serAxisMinorTimeUnit)K+=` `;if($.serAxisMajorUnit)K+=` `;if($.serAxisMinorUnit)K+=` `}return K+="",K}function v5($,q,Q){let K=$.titleAlign==="left"||$.titleAlign==="right"?``:"",J=$.titleRotate?``:"",Z=$.fontSize?`sz="${Math.round($.fontSize*100)}"`:"",G=$.titleBold?1:0,W="";if($.titlePos&&typeof $.titlePos.x==="number"&&typeof $.titlePos.y==="number"){let B=$.titlePos.x+q,V=$.titlePos.y+Q,U=B===0?0:B*(B/5)/10;if(U>=1)U=U/10;if(U>=0.1)U=U/10;let w=V===0?0:V*(V/5)/10;if(w>=1)w=w/10;if(w>=0.1)w=w/10;W=``}return` +`,W.file("xl/worksheets/sheet1.xml",U)}W.generateAsync({type:"base64"}).then((U)=>{q.file(`ppt/embeddings/Microsoft_Excel_Worksheet${$.globalId}.xlsx`,U,{base64:!0}),q.file("ppt/charts/_rels/"+$.fileName+".rels",``),q.file(`ppt/charts/${$.fileName}`,EB($)),K("")}).catch((U)=>{J(U)})})})}function EB($){var q,Q,K,J;let Z='',G=!1;{if(Z+='',Z+='',Z+=``,Z+="",$.opts.showTitle)Z+=v5({title:$.opts.title||"Chart Title",color:$.opts.titleColor,fontFace:$.opts.titleFontFace,fontSize:$.opts.titleFontSize||IB,titleAlign:$.opts.titleAlign,titleBold:$.opts.titleBold,titlePos:$.opts.titlePos,titleRotate:$.opts.titleRotate},$.opts.x,$.opts.y),Z+='';else Z+='';if($.opts._type===q0.BAR3D)Z+=``;if(Z+="",$.opts.layout)Z+="",Z+=" ",Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+="";else Z+=""}if(Array.isArray($.opts._type))$.opts._type.forEach((W)=>{let B=Object.assign(Object.assign({},$.opts),W.options),V=B.secondaryValAxis?Y5:o2,U=B.secondaryCatAxis?O7:B8;G=G||B.secondaryValAxis,Z+=$J(W.type,W.data,B,V,U)});else Z+=$J($.opts._type,$.data,$.opts,o2,B8);if($.opts._type!==q0.PIE&&$.opts._type!==q0.DOUGHNUT){if($.opts.valAxes&&$.opts.valAxes.length>1&&!G)throw Error("Secondary axis must be used by one of the multiple charts");if($.opts.catAxes){if(!$.opts.valAxes||$.opts.valAxes.length!==$.opts.catAxes.length)throw Error("There must be the same number of value and category axes.");Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[0]),B8,o2)}else Z+=X7($.opts,B8,o2);if($.opts.valAxes){if(Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[0]),o2),$.opts.valAxes[1])Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[1]),Y5)}else if(Z+=y7($.opts,o2),$.opts._type===q0.BAR3D)Z+=_B($.opts,UJ,o2);if(((q=$.opts)===null||q===void 0?void 0:q.catAxes)&&((Q=$.opts)===null||Q===void 0?void 0:Q.catAxes[1]))Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[1]),O7,Y5)}{if($.opts.showDataTable)Z+="",Z+=` `,Z+=` `,Z+=` `,Z+=` `,Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=` `,Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+="";if(Z+=" ",Z+=((K=$.opts.plotArea.fill)===null||K===void 0?void 0:K.color)?B2($.opts.plotArea.fill):"",Z+=$.opts.plotArea.border?`${B2($.opts.plotArea.border.color)}`:"",Z+=" ",Z+=" ",Z+="",$.opts.showLegend){if(Z+="",Z+='',Z+='',$.opts.legendFontFace||$.opts.legendFontSize||$.opts.legendColor){if(Z+="",Z+=" ",Z+=" ",Z+=" ",Z+=" ",Z+=$.opts.legendFontSize?``:"",$.opts.legendColor)Z+=B2($.opts.legendColor);if($.opts.legendFontFace)Z+='';if($.opts.legendFontFace)Z+='';Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=""}Z+=""}}if(Z+=' ',Z+=' ',$.opts._type===q0.SCATTER)Z+='';return Z+="",Z+="",Z+=((J=$.opts.chartArea.fill)===null||J===void 0?void 0:J.color)?B2($.opts.chartArea.fill):"",Z+=$.opts.chartArea.border?`${B2($.opts.chartArea.border.color)}`:"",Z+=" ",Z+="",Z+='',Z+="",Z}function $J($,q,Q,K,J,Z){let G=-1,W=1,B=null,V="";switch($){case q0.AREA:case q0.BAR:case q0.BAR3D:case q0.LINE:case q0.RADAR:if(V+=``,$===q0.AREA&&Q.barGrouping==="stacked")V+='';if($===q0.BAR||$===q0.BAR3D)V+='',V+='';if($===q0.RADAR)V+='';V+='',q.forEach((U)=>{var w;G++,V+="",V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(U._dataIndex+U.labels.length+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";let F=Q.chartColors?Q.chartColors[G%Q.chartColors.length]:null;if(V+=" ",F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,``)+"";else V+=""+R0(F)+"";if($===q0.LINE||$===q0.RADAR)if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+='';else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;if(V+=T1(Q.shadow,P1),V+=" ",V+=' ',$!==q0.RADAR){if(V+="",V+=``,Q.dataLabelBkgrdColors)V+=`${R0(F)}`;if(V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+=``,V+=""}if($===q0.LINE||$===q0.RADAR){if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+=" ",V+=` ${R0(Q.chartColors[U._dataIndex+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):U._dataIndex])}`,V+=` ${R0(Q.lineDataSymbolLineColor||F)}`,V+=" ",V+=" ",V+=""}if(($===q0.BAR||$===q0.BAR3D)&&q.length===1&&(Q.chartColors&&Q.chartColors!==z8&&Q.chartColors.length>1||((w=Q.invertedColors)===null||w===void 0?void 0:w.length)))U.values.forEach((M,k)=>{let f=M<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else if($===q0.BAR)V+="",V+=' ',V+="";else V+="",V+=" ",V+=' ',V+=" ",V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});{if(V+="",Q.catLabelFormatCode)V+=" ",V+=` Sheet1!$A$2:$A$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.catLabelFormatCode||"General")+"",V+=` `,U.labels[0].forEach((M,k)=>V+=`${k0(M)}`),V+=" ",V+=" ";else V+=" ",V+=` Sheet1!$A$2:$${j0(U.labels.length)}$${U.labels[0].length+1}`,V+=" ",V+=` `,U.labels.forEach((M)=>{V+="",M.forEach((k,f)=>V+=`${k0(k)}`),V+=""}),V+=" ",V+=" ";V+=""}if(V+="",V+=" ",V+=`Sheet1!$${j0(U._dataIndex+U.labels.length+1)}$2:$${j0(U._dataIndex+U.labels.length+1)}$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.valLabelFormatCode||Q.dataTableFormatCode||"General")+"",V+=` `,U.values.forEach((M,k)=>V+=`${M||M===0?M:""}`),V+=" ",V+=" ",V+="",$===q0.LINE)V+='';V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+=" "}if($===q0.BAR)V+=` `,V+=` `;else if($===q0.BAR3D)V+=` `,V+=` `,V+=' ';else if($===q0.LINE)V+=' ';V+=``,V+=``;break;case q0.SCATTER:V+="",V+='',V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=` Sheet1!$${j0(w+2)}$1`,V+=' '+k0(U.name)+"",V+=" ",V+=" ",V+=" ";{let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,'')+"";else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1)}V+=" ";{if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+="",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,V+=`${R0(Q.lineDataSymbolLineColor||Q.chartColors[G%Q.chartColors.length])}`,V+="",V+="",V+=""}if(Q.showLabel){let F=k5("-xxxx-xxxx-xxxx-xxxxxxxxxxxx");if(U.labels[0]&&(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"))V+="",U.labels[0].forEach((M,k)=>{if(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"){if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" "+k0(M)+"",V+=" ",Q.dataLabelFormatScatter==="customXY"&&!/^ *$/.test(M))V+=" ",V+=' ',V+=" (",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"",V+=" ",V+=" ",V+=' ',V+=" , ",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"]",V+=" ",V+=" ",V+=' ',V+=" )",V+=" ",V+=' ';if(V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=` `,V+=" ",V+=" ",V+=""}}),V+="";if(Q.dataLabelFormatScatter==="XY"){if(V+="",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=` `,V+=` `,V+=` `,V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=""}}if(q.length===1&&Q.chartColors!==z8)U.values.forEach((F,M)=>{let k=F<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else V+="",V+=' ',V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=` Sheet1!$${j0(w+2)}$2:$${j0(w+2)}$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+='',V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}V+=``,V+="";break;case q0.BUBBLE:case q0.BUBBLE3D:V+="",V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(W+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";{V+="";let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=`${R0(F,'')}`;else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1),V+=""}V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${q[0].values.length+1}`,W++,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${U.sizes.length+1}`,W++,V+=" ",V+=" General",V+=` `,U.sizes.forEach((F,M)=>{V+=`${F||""}`}),V+=" ",V+=" ",V+=" ",V+=' ',V+=""});{if(V+="",V+=``,V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+="",V+=' ',V+=' ',V+=" ",V+="",V+=""}V+=``,V+="";break;case q0.DOUGHNUT:case q0.PIE:if(B=q[0],V+="",V+=' ',V+="",V+=' ',V+=' ',V+=" ",V+=" ",V+=" Sheet1!$B$1",V+=" ",V+=' ',V+=' '+k0(B.name)+"",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=' ',Q.dataNoEffects)V+="";else V+=T1(Q.shadow,P1);if(V+=" ",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=' ',V+=" ",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;V+=T1(Q.shadow,P1),V+=" ",V+=""}),V+="",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=` `,V+=" ",V+=" ",V+=" ",$===q0.PIE&&Q.dataLabelPosition)V+=``;V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}),V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=' ',V+=" ",V+=" ",V+=" ",V+=" ",V+=$===q0.PIE?'':"",V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+="",V+="",V+=" ",V+=` Sheet1!$A$2:$A$${B.labels[0].length+1}`,V+=" ",V+=` `,B.labels[0].forEach((U,w)=>{V+=`${k0(U)}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=` Sheet1!$B$2:$B$${B.labels[0].length+1}`,V+=" ",V+=` `,B.values.forEach((U,w)=>{V+=`${U||U===0?U:""}`}),V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,$===q0.DOUGHNUT)V+=``;V+="";break;default:V+="";break}return V}function X7($,q,Q){let K="";if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";if(K+=' ',K+=" ",K+='',$.catAxisMaxVal||$.catAxisMaxVal===0)K+=``;if($.catAxisMinVal||$.catAxisMinVal===0)K+=``;if(K+="",K+=' ',K+=' ',K+=$.catGridLine.style!=="none"?n7($.catGridLine):"",$.showCatAxisTitle)K+=v5({color:$.catAxisTitleColor,fontFace:$.catAxisTitleFontFace,fontSize:$.catAxisTitleFontSize,titleRotate:$.catAxisTitleRotate,title:$.catAxisTitle||"Axis Title"});if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+=' ';else K+=' ';if($._type===q0.SCATTER)K+=' ',K+=' ',K+=' ';else K+=' ',K+=' ',K+=' ';if(K+=" ",K+=` `,K+=!$.catAxisLineShow?"":""+R0($.catAxisLineColor||u1.color)+"",K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",$.catAxisLabelRotate)K+=``;else K+="";if(K+=" ",K+=" ",K+=" ",K+=` `,K+=" "+R0($.catAxisLabelColor||Q2)+"",K+=' ',K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=` `,K+=' ',K+=' ',K+=` `,$.catAxisLabelFrequency)K+=' ';if($.catLabelFormatCode||$._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D){if($.catLabelFormatCode){if(["catAxisBaseTimeUnit","catAxisMajorTimeUnit","catAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes($[J].toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.catAxisBaseTimeUnit)K+='';if($.catAxisMajorTimeUnit)K+='';if($.catAxisMinorTimeUnit)K+=''}if($.catAxisMajorUnit)K+=``;if($.catAxisMinorUnit)K+=``}if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";return K}function y7($,q){let Q=q===o2?$.barDir==="col"?"l":"b":$.barDir!=="col"?"r":"t";if(q===Y5)Q="r";let K=q===o2?B8:O7,J="";if(J+="",J+=' ',J+=" ",$.valAxisLogScaleBase)J+=``;if(J+='',$.valAxisMaxVal||$.valAxisMaxVal===0)J+=``;if($.valAxisMinVal||$.valAxisMinVal===0)J+=``;if(J+=" ",J+=` `,J+=' ',$.valGridLine.style!=="none")J+=n7($.valGridLine);if($.showValAxisTitle)J+=v5({color:$.valAxisTitleColor,fontFace:$.valAxisTitleFontFace,fontSize:$.valAxisTitleFontSize,titleRotate:$.valAxisTitleRotate,title:$.valAxisTitle||"Axis Title"});if(J+=``,$._type===q0.SCATTER)J+=' ',J+=' ',J+=' ';else J+=' ',J+=' ',J+=' ';if(J+=" ",J+=` `,J+=!$.valAxisLineShow?"":""+R0($.valAxisLineColor||u1.color)+"",J+=' ',J+=" ",J+=" ",J+=" ",J+=" ",J+=` `,J+=" ",J+=" ",J+=" ",J+=` `,J+=" "+R0($.valAxisLabelColor||Q2)+"",J+=' ',J+=" ",J+=" ",J+=' ',J+=" ",J+=" ",J+=' ',typeof $.catAxisCrossesAt==="number")J+=` `;else if(typeof $.catAxisCrossesAt==="string")J+=' ';else J+=' ';if(J+=' ',$.valAxisMajorUnit)J+=` `;if($.valAxisDisplayUnit)J+=`${$.valAxisDisplayUnitLabel?"":""}`;return J+="",J}function _B($,q,Q){let K="";if(K+="",K+=' ',K+=' ',K+=' ',K+=' ',K+=$.serGridLine.style!=="none"?n7($.serGridLine):"",$.showSerAxisTitle)K+=v5({color:$.serAxisTitleColor,fontFace:$.serAxisTitleFontFace,fontSize:$.serAxisTitleFontSize,titleRotate:$.serAxisTitleRotate,title:$.serAxisTitle||"Axis Title"});if(K+=` `,K+=' ',K+=' ',K+=` `,K+=" ",K+=' ',K+=!$.serAxisLineShow?"":`${R0($.serAxisLineColor||u1.color)}`,K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=` `,K+=` ${R0($.serAxisLabelColor||Q2)}`,K+=` `,K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=' ',$.serAxisLabelFrequency)K+=' ';if($.serLabelFormatCode){if(["serAxisBaseTimeUnit","serAxisMajorTimeUnit","serAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes(J.toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.serAxisBaseTimeUnit)K+=` `;if($.serAxisMajorTimeUnit)K+=` `;if($.serAxisMinorTimeUnit)K+=` `;if($.serAxisMajorUnit)K+=` `;if($.serAxisMinorUnit)K+=` `}return K+="",K}function v5($,q,Q){let K=$.titleAlign==="left"||$.titleAlign==="right"?``:"",J=$.titleRotate?``:"",Z=$.fontSize?`sz="${Math.round($.fontSize*100)}"`:"",G=$.titleBold?1:0,W="";if($.titlePos&&typeof $.titlePos.x==="number"&&typeof $.titlePos.y==="number"){let B=$.titlePos.x+q,V=$.titlePos.y+Q,U=B===0?0:B*(B/5)/10;if(U>=1)U=U/10;if(U>=0.1)U=U/10;let w=V===0?0:V*(V/5)/10;if(w>=1)w=w/10;if(w>=0.1)w=w/10;W=``}return` ${J} @@ -54,22 +54,22 @@ ${W} `}function j0($){let q="",Q=$-1;if(Q<=25)q=W8[Q];else q=`${W8[Math.floor(Q/W8.length-1)]}${W8[Q%W8.length]}`;return q}function T1($,q){if(!$)return"";else if(typeof $!=="object")return console.warn("`shadow` options must be an object. Ex: `{shadow: {type:'none'}}`"),"";let Q="",K=Object.assign(Object.assign({},q),$),J=K.type||"outer",Z=Y0(K.blur),G=Y0(K.offset),W=Math.round(K.angle*60000),B=K.color,V=Math.round(K.opacity*1e5),U=K.rotateWithShape?1:0;return Q+=``,Q+=``,Q+=``,Q+=``,Q+="",Q}function n7($){let q="";return q+=" ",q+=` `,q+=' ',q+=' ',q+=" ",q+=" ",q+="",q}function D5($){if(!$||$==="flat")return"flat";else if($==="square")return"sq";else if($==="round")return"rnd";else throw Error(`Invalid chart line cap: ${$}`)}function h7($){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node",J,Z,G=K?()=>W2(this,void 0,void 0,function*(){({default:J}=yield import("node:fs")),{default:Z}=yield Promise.resolve().then(() => (tK(),sK))}):()=>W2(this,void 0,void 0,function*(){});if(K)G();let W=[],B=$._relsMedia.filter((U)=>U.type!=="online"&&!U.data&&(!U.path||U.path&&!U.path.includes("preencoded"))),V=[];return B.forEach((U)=>{if(!V.includes(U.path))U.isDuplicate=!1,V.push(U.path);else U.isDuplicate=!0}),B.filter((U)=>!U.isDuplicate).forEach((U)=>{W.push((()=>W2(this,void 0,void 0,function*(){if(!Z)yield G();if(K&&J&&U.path.indexOf("http")!==0)try{let w=J.readFileSync(U.path);return U.data=Buffer.from(w).toString("base64"),B.filter((F)=>F.isDuplicate&&F.path===U.path).forEach((F)=>F.data=U.data),"done"}catch(w){throw U.data=j6,B.filter((F)=>F.isDuplicate&&F.path===U.path).forEach((F)=>F.data=U.data),Error(`ERROR: Unable to read media: "${U.path}" -${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F)=>{Z.get(U.path,(M)=>{let k="";M.setEncoding("binary"),M.on("data",(f)=>k+=f),M.on("end",()=>{U.data=Buffer.from(k,"binary").toString("base64"),B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),w("done")}),M.on("error",()=>{U.data=j6,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),F(Error(`ERROR! Unable to load image (https.get): ${U.path}`))})})});return yield new Promise((w,F)=>{let M=new XMLHttpRequest;M.onload=()=>{let k=new FileReader;k.onloadend=()=>{if(U.data=k.result,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),!U.isSvgPng)w("done");else QJ(U).then(()=>w("done")).catch(F)},k.readAsDataURL(M.response)},M.onerror=()=>{U.data=j6,B.filter((k)=>k.isDuplicate&&k.path===U.path).forEach((k)=>k.data=U.data),F(Error(`ERROR! Unable to load image (xhr.onerror): ${U.path}`))},M.open("GET",U.path),M.responseType="blob",M.send()})}))())}),$._relsMedia.filter((U)=>U.isSvgPng&&U.data).forEach((U)=>{(()=>W2(this,void 0,void 0,function*(){if(K&&!J)yield G();if(K&&J)U.data=j6,W.push(Promise.resolve("done"));else W.push(QJ(U))}))()}),W}function QJ($){return W2(this,void 0,void 0,function*(){return yield new Promise((q,Q)=>{let K=new Image;K.onload=()=>{if(K.width+K.height===0)K.onerror("h/w=0");let J=document.createElement("CANVAS"),Z=J.getContext("2d");J.width=K.width,J.height=K.height,Z.drawImage(K,0,0);try{$.data=J.toDataURL($.type),q("done")}catch(G){K.onerror(G.toString())}J=null},K.onerror=()=>{$.data=j6,Q(Error(`ERROR! Unable to load image (image.onerror): ${$.path}`))},K.src=typeof $.data==="string"?$.data:j6})})}var PB={cover:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.h/Q:q.w,G=J?q.h:q.w*Q,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},contain:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.w:q.h/Q,G=J?q.w*Q:q.h,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},crop:function($,q){let Q=q.x,K=$.w-(q.x+q.w),J=q.y,Z=$.h-(q.y+q.h),G=Math.round(1e5*(Q/$.w)),W=Math.round(1e5*(K/$.w)),B=Math.round(1e5*(J/$.h)),V=Math.round(1e5*(Z/$.h));return``}};function d7($){var q;let Q=$._name?'':"",K=1;if($._bkgdImgRid)Q+=``;else if((q=$.background)===null||q===void 0?void 0:q.color)Q+=`${B2($.background)}`;else if(!$.bkgd&&$._name&&$._name===x7)Q+='';if(Q+="",Q+='',Q+='',Q+='',$._slideObjects.forEach((J,Z)=>{var G,W,B,V,U,w,F,M;let k=0,f=0,L=H0("75%","X",$._presLayout),D=0,z,N="",H=null,v=null,j=0,n=0,d=null,_=null,X=(G=J.options)===null||G===void 0?void 0:G.sizing,P=(W=J.options)===null||W===void 0?void 0:W.rounding;if($._slideLayout!==void 0&&$._slideLayout._slideObjects!==void 0&&J.options&&J.options.placeholder)z=$._slideLayout._slideObjects.filter((h)=>h.options.placeholder===J.options.placeholder)[0];if(J.options=J.options||{},typeof J.options.x<"u")k=H0(J.options.x,"X",$._presLayout);if(typeof J.options.y<"u")f=H0(J.options.y,"Y",$._presLayout);if(typeof J.options.w<"u")L=H0(J.options.w,"X",$._presLayout);if(typeof J.options.h<"u")D=H0(J.options.h,"Y",$._presLayout);let g=L,c=D;if(z){if(z.options.x||z.options.x===0)k=H0(z.options.x,"X",$._presLayout);if(z.options.y||z.options.y===0)f=H0(z.options.y,"Y",$._presLayout);if(z.options.w||z.options.w===0)L=H0(z.options.w,"X",$._presLayout);if(z.options.h||z.options.h===0)D=H0(z.options.h,"Y",$._presLayout)}if(J.options.flipH)N+=' flipH="1"';if(J.options.flipV)N+=' flipV="1"';if(J.options.rotate)N+=` rot="${S1(J.options.rotate)}"`;switch(J._type){case D0.table:if(H=J.arrTabRows,v=J.options,j=0,n=0,H[0].forEach((h)=>{d=h.options||null,j+=(d===null||d===void 0?void 0:d.colspan)?Number(d.colspan):1}),_=``,_+=' ',_+=``,_+='',Array.isArray(v.colW)){_+="";for(let h=0;h`}_+=""}else{if(n=v.colW?v.colW:L0,J.options.w&&!v.colW)n=Math.round((typeof J.options.w==="number"?J.options.w:1)/j);_+="";for(let h=0;h`;_+=""}H.forEach((h)=>{var x,l;for(let $0=0;$01){let W0=Array(F0-1).fill(void 0).map(()=>{return{_type:D0.tablecell,options:{rowspan:p},_hmerge:!0}});h.splice($0+1,0,...W0),$0+=F0}else $0+=1}}),H.forEach((h,x)=>{let l=H[x+1];if(!l)return;h.forEach(($0,Z0)=>{var F0,p;let W0=$0._rowContinue||((F0=$0.options)===null||F0===void 0?void 0:F0.rowspan),y=(p=$0.options)===null||p===void 0?void 0:p.colspan,i=$0._hmerge;if(W0&&W0>1){let U0={_type:D0.tablecell,options:{colspan:y},_rowContinue:W0-1,_vmerge:!0,_hmerge:i};l.splice(Z0,0,U0)}})}),H.forEach((h,x)=>{let l=0;if(Array.isArray(v.rowH)&&v.rowH[x])l=v0(Number(v.rowH[x]));else if(v.rowH&&!isNaN(Number(v.rowH)))l=v0(Number(v.rowH));else if(J.options.cy||J.options.h)l=Math.round((J.options.h?v0(J.options.h):typeof J.options.cy==="number"?J.options.cy:1)/H.length);_+=``,h.forEach(($0)=>{var Z0,F0,p,W0,y;let i=$0,U0={rowSpan:((Z0=i.options)===null||Z0===void 0?void 0:Z0.rowspan)>1?i.options.rowspan:void 0,gridSpan:((F0=i.options)===null||F0===void 0?void 0:F0.colspan)>1?i.options.colspan:void 0,vMerge:i._vmerge?1:void 0,hMerge:i._hmerge?1:void 0},m=Object.keys(U0).map((K0)=>[K0,U0[K0]]).filter(([,K0])=>!!K0).map(([K0,R])=>`${String(K0)}="${String(R)}"`).join(" ");if(m)m=" "+m;if(i._hmerge||i._vmerge){_+=``;return}let V0=i.options||{};i.options=V0,["align","bold","border","color","fill","fontFace","fontSize","margin","textDirection","underline","valign"].forEach((K0)=>{if(v[K0]&&!V0[K0]&&V0[K0]!==0)V0[K0]=v[K0]});let w0=V0.valign?` anchor="${V0.valign.replace(/^c$/i,"ctr").replace(/^m$/i,"ctr").replace("center","ctr").replace("middle","ctr").replace("top","t").replace("btm","b").replace("bottom","b")}"`:"",S=V0.textDirection&&V0.textDirection!=="horz"?` vert="${V0.textDirection}"`:"",b=((W0=(p=i._optImp)===null||p===void 0?void 0:p.fill)===null||W0===void 0?void 0:W0.color)?i._optImp.fill.color:((y=i._optImp)===null||y===void 0?void 0:y.fill)&&typeof i._optImp.fill==="string"?i._optImp.fill:"";b=b||V0.fill?V0.fill:"";let O=b?B2(b):"",E=V0.margin===0||V0.margin?V0.margin:JJ;if(!Array.isArray(E)&&typeof E==="number")E=[E,E,E,E];let a="";if(E[0]>=1)a=` marL="${Y0(E[3])}" marR="${Y0(E[1])}" marT="${Y0(E[0])}" marB="${Y0(E[2])}"`;else a=` marL="${v0(E[3])}" marR="${v0(E[1])}" marT="${v0(E[0])}" marB="${v0(E[2])}"`;if(_+=`${KJ(i)}`,V0.border&&Array.isArray(V0.border))[{idx:3,name:"lnL"},{idx:1,name:"lnR"},{idx:0,name:"lnT"},{idx:2,name:"lnB"}].forEach((K0)=>{if(V0.border[K0.idx].type!=="none")_+=``,_+=`${R0(V0.border[K0.idx].color)}`,_+=``,_+=``;else _+=``});_+=O,_+=" ",_+=" "}),_+=""}),_+=" ",_+=" ",_+=" ",_+="",Q+=_,K++;break;case D0.text:case D0.placeholder:if(!J.options.line&&D===0)D=L0*0.3;if(!J.options._bodyProp)J.options._bodyProp={};if(J.options.margin&&Array.isArray(J.options.margin))J.options._bodyProp.lIns=Y0(J.options.margin[0]||0),J.options._bodyProp.rIns=Y0(J.options.margin[1]||0),J.options._bodyProp.bIns=Y0(J.options.margin[2]||0),J.options._bodyProp.tIns=Y0(J.options.margin[3]||0);else if(typeof J.options.margin==="number")J.options._bodyProp.lIns=Y0(J.options.margin),J.options._bodyProp.rIns=Y0(J.options.margin),J.options._bodyProp.bIns=Y0(J.options.margin),J.options._bodyProp.tIns=Y0(J.options.margin);if(Q+="",Q+=``,(B=J.options.hyperlink)===null||B===void 0?void 0:B.url)Q+=``;if((V=J.options.hyperlink)===null||V===void 0?void 0:V.slide)Q+=``;if(Q+="",Q+="':"/>"),Q+=`${J._type==="placeholder"?N5(J):N5(z)}`,Q+="",Q+=``,Q+=``,Q+=``,J.shape==="custGeom")Q+="",Q+="",Q+="",Q+="",Q+="",Q+="",Q+='',Q+="",Q+=``,(w=J.options.points)===null||w===void 0||w.forEach((h,x)=>{if("curve"in h)switch(h.curve.type){case"arc":Q+=``;break;case"cubic":Q+=` +${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F)=>{Z.get(U.path,(M)=>{let k="";M.setEncoding("binary"),M.on("data",(f)=>k+=f),M.on("end",()=>{U.data=Buffer.from(k,"binary").toString("base64"),B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),w("done")}),M.on("error",()=>{U.data=j6,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),F(Error(`ERROR! Unable to load image (https.get): ${U.path}`))})})});return yield new Promise((w,F)=>{let M=new XMLHttpRequest;M.onload=()=>{let k=new FileReader;k.onloadend=()=>{if(U.data=k.result,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),!U.isSvgPng)w("done");else QJ(U).then(()=>w("done")).catch(F)},k.readAsDataURL(M.response)},M.onerror=()=>{U.data=j6,B.filter((k)=>k.isDuplicate&&k.path===U.path).forEach((k)=>k.data=U.data),F(Error(`ERROR! Unable to load image (xhr.onerror): ${U.path}`))},M.open("GET",U.path),M.responseType="blob",M.send()})}))())}),$._relsMedia.filter((U)=>U.isSvgPng&&U.data).forEach((U)=>{(()=>W2(this,void 0,void 0,function*(){if(K&&!J)yield G();if(K&&J)U.data=j6,W.push(Promise.resolve("done"));else W.push(QJ(U))}))()}),W}function QJ($){return W2(this,void 0,void 0,function*(){return yield new Promise((q,Q)=>{let K=new Image;K.onload=()=>{if(K.width+K.height===0)K.onerror("h/w=0");let J=document.createElement("CANVAS"),Z=J.getContext("2d");J.width=K.width,J.height=K.height,Z.drawImage(K,0,0);try{$.data=J.toDataURL($.type),q("done")}catch(G){K.onerror(G.toString())}J=null},K.onerror=()=>{$.data=j6,Q(Error(`ERROR! Unable to load image (image.onerror): ${$.path}`))},K.src=typeof $.data==="string"?$.data:j6})})}var cB={cover:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.h/Q:q.w,G=J?q.h:q.w*Q,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},contain:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.w:q.h/Q,G=J?q.w*Q:q.h,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},crop:function($,q){let Q=q.x,K=$.w-(q.x+q.w),J=q.y,Z=$.h-(q.y+q.h),G=Math.round(1e5*(Q/$.w)),W=Math.round(1e5*(K/$.w)),B=Math.round(1e5*(J/$.h)),V=Math.round(1e5*(Z/$.h));return``}};function d7($){var q;let Q=$._name?'':"",K=1;if($._bkgdImgRid)Q+=``;else if((q=$.background)===null||q===void 0?void 0:q.color)Q+=`${B2($.background)}`;else if(!$.bkgd&&$._name&&$._name===x7)Q+='';if(Q+="",Q+='',Q+='',Q+='',$._slideObjects.forEach((J,Z)=>{var G,W,B,V,U,w,F,M;let k=0,f=0,L=H0("75%","X",$._presLayout),D=0,z,N="",H=null,v=null,j=0,n=0,d=null,_=null,X=(G=J.options)===null||G===void 0?void 0:G.sizing,P=(W=J.options)===null||W===void 0?void 0:W.rounding;if($._slideLayout!==void 0&&$._slideLayout._slideObjects!==void 0&&J.options&&J.options.placeholder)z=$._slideLayout._slideObjects.filter((h)=>h.options.placeholder===J.options.placeholder)[0];if(J.options=J.options||{},typeof J.options.x<"u")k=H0(J.options.x,"X",$._presLayout);if(typeof J.options.y<"u")f=H0(J.options.y,"Y",$._presLayout);if(typeof J.options.w<"u")L=H0(J.options.w,"X",$._presLayout);if(typeof J.options.h<"u")D=H0(J.options.h,"Y",$._presLayout);let g=L,c=D;if(z){if(z.options.x||z.options.x===0)k=H0(z.options.x,"X",$._presLayout);if(z.options.y||z.options.y===0)f=H0(z.options.y,"Y",$._presLayout);if(z.options.w||z.options.w===0)L=H0(z.options.w,"X",$._presLayout);if(z.options.h||z.options.h===0)D=H0(z.options.h,"Y",$._presLayout)}if(J.options.flipH)N+=' flipH="1"';if(J.options.flipV)N+=' flipV="1"';if(J.options.rotate)N+=` rot="${S1(J.options.rotate)}"`;switch(J._type){case D0.table:if(H=J.arrTabRows,v=J.options,j=0,n=0,H[0].forEach((h)=>{d=h.options||null,j+=(d===null||d===void 0?void 0:d.colspan)?Number(d.colspan):1}),_=``,_+=' ',_+=``,_+='',Array.isArray(v.colW)){_+="";for(let h=0;h`}_+=""}else{if(n=v.colW?v.colW:L0,J.options.w&&!v.colW)n=Math.round((typeof J.options.w==="number"?J.options.w:1)/j);_+="";for(let h=0;h`;_+=""}H.forEach((h)=>{var x,l;for(let $0=0;$01){let W0=Array(F0-1).fill(void 0).map(()=>{return{_type:D0.tablecell,options:{rowspan:p},_hmerge:!0}});h.splice($0+1,0,...W0),$0+=F0}else $0+=1}}),H.forEach((h,x)=>{let l=H[x+1];if(!l)return;h.forEach(($0,Z0)=>{var F0,p;let W0=$0._rowContinue||((F0=$0.options)===null||F0===void 0?void 0:F0.rowspan),y=(p=$0.options)===null||p===void 0?void 0:p.colspan,i=$0._hmerge;if(W0&&W0>1){let U0={_type:D0.tablecell,options:{colspan:y},_rowContinue:W0-1,_vmerge:!0,_hmerge:i};l.splice(Z0,0,U0)}})}),H.forEach((h,x)=>{let l=0;if(Array.isArray(v.rowH)&&v.rowH[x])l=v0(Number(v.rowH[x]));else if(v.rowH&&!isNaN(Number(v.rowH)))l=v0(Number(v.rowH));else if(J.options.cy||J.options.h)l=Math.round((J.options.h?v0(J.options.h):typeof J.options.cy==="number"?J.options.cy:1)/H.length);_+=``,h.forEach(($0)=>{var Z0,F0,p,W0,y;let i=$0,U0={rowSpan:((Z0=i.options)===null||Z0===void 0?void 0:Z0.rowspan)>1?i.options.rowspan:void 0,gridSpan:((F0=i.options)===null||F0===void 0?void 0:F0.colspan)>1?i.options.colspan:void 0,vMerge:i._vmerge?1:void 0,hMerge:i._hmerge?1:void 0},m=Object.keys(U0).map((K0)=>[K0,U0[K0]]).filter(([,K0])=>!!K0).map(([K0,R])=>`${String(K0)}="${String(R)}"`).join(" ");if(m)m=" "+m;if(i._hmerge||i._vmerge){_+=``;return}let V0=i.options||{};i.options=V0,["align","bold","border","color","fill","fontFace","fontSize","margin","textDirection","underline","valign"].forEach((K0)=>{if(v[K0]&&!V0[K0]&&V0[K0]!==0)V0[K0]=v[K0]});let w0=V0.valign?` anchor="${V0.valign.replace(/^c$/i,"ctr").replace(/^m$/i,"ctr").replace("center","ctr").replace("middle","ctr").replace("top","t").replace("btm","b").replace("bottom","b")}"`:"",S=V0.textDirection&&V0.textDirection!=="horz"?` vert="${V0.textDirection}"`:"",b=((W0=(p=i._optImp)===null||p===void 0?void 0:p.fill)===null||W0===void 0?void 0:W0.color)?i._optImp.fill.color:((y=i._optImp)===null||y===void 0?void 0:y.fill)&&typeof i._optImp.fill==="string"?i._optImp.fill:"";b=b||V0.fill?V0.fill:"";let O=b?B2(b):"",E=V0.margin===0||V0.margin?V0.margin:JJ;if(!Array.isArray(E)&&typeof E==="number")E=[E,E,E,E];let a="";if(E[0]>=1)a=` marL="${Y0(E[3])}" marR="${Y0(E[1])}" marT="${Y0(E[0])}" marB="${Y0(E[2])}"`;else a=` marL="${v0(E[3])}" marR="${v0(E[1])}" marT="${v0(E[0])}" marB="${v0(E[2])}"`;if(_+=`${KJ(i)}`,V0.border&&Array.isArray(V0.border))[{idx:3,name:"lnL"},{idx:1,name:"lnR"},{idx:0,name:"lnT"},{idx:2,name:"lnB"}].forEach((K0)=>{if(V0.border[K0.idx].type!=="none")_+=``,_+=`${R0(V0.border[K0.idx].color)}`,_+=``,_+=``;else _+=``});_+=O,_+=" ",_+=" "}),_+=""}),_+=" ",_+=" ",_+=" ",_+="",Q+=_,K++;break;case D0.text:case D0.placeholder:if(!J.options.line&&D===0)D=L0*0.3;if(!J.options._bodyProp)J.options._bodyProp={};if(J.options.margin&&Array.isArray(J.options.margin))J.options._bodyProp.lIns=Y0(J.options.margin[0]||0),J.options._bodyProp.rIns=Y0(J.options.margin[1]||0),J.options._bodyProp.bIns=Y0(J.options.margin[2]||0),J.options._bodyProp.tIns=Y0(J.options.margin[3]||0);else if(typeof J.options.margin==="number")J.options._bodyProp.lIns=Y0(J.options.margin),J.options._bodyProp.rIns=Y0(J.options.margin),J.options._bodyProp.bIns=Y0(J.options.margin),J.options._bodyProp.tIns=Y0(J.options.margin);if(Q+="",Q+=``,(B=J.options.hyperlink)===null||B===void 0?void 0:B.url)Q+=``;if((V=J.options.hyperlink)===null||V===void 0?void 0:V.slide)Q+=``;if(Q+="",Q+="':"/>"),Q+=`${J._type==="placeholder"?N5(J):N5(z)}`,Q+="",Q+=``,Q+=``,Q+=``,J.shape==="custGeom")Q+="",Q+="",Q+="",Q+="",Q+="",Q+="",Q+='',Q+="",Q+=``,(w=J.options.points)===null||w===void 0||w.forEach((h,x)=>{if("curve"in h)switch(h.curve.type){case"arc":Q+=``;break;case"cubic":Q+=` `;break;case"quadratic":Q+=` - `;break}else if("close"in h)Q+="";else if(h.moveTo||x===0)Q+=``;else Q+=``}),Q+="",Q+="",Q+="";else{if(Q+='',J.options.rectRadius)Q+=``;else if(J.options.angleRange){for(let h=0;h<2;h++){let x=J.options.angleRange[h];Q+=``}if(J.options.arcThicknessRatio)Q+=``}Q+=""}if(Q+=J.options.fill?B2(J.options.fill):"",J.options.line){if(Q+=J.options.line.width?``:"",J.options.line.color)Q+=B2(J.options.line);if(J.options.line.dashType)Q+=``;if(J.options.line.beginArrowType)Q+=``;if(J.options.line.endArrowType)Q+=``;Q+=""}if(J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=` `,Q+=` `,Q+=` `,Q+=" ",Q+="";Q+="",Q+=KJ(J),Q+="";break;case D0.image:if(Q+="",Q+=" ",Q+=``,(F=J.hyperlink)===null||F===void 0?void 0:F.url)Q+=``;if((M=J.hyperlink)===null||M===void 0?void 0:M.slide)Q+=``;if(Q+=" ",Q+=' ',Q+=" "+N5(z)+"",Q+=" ",Q+="",($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0]&&($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0].extn==="svg")Q+=``,Q+=J.options.transparency?` `:"",Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";else Q+=``,Q+=J.options.transparency?``:"",Q+="";if(X===null||X===void 0?void 0:X.type){let h=X.w?H0(X.w,"X",$._presLayout):L,x=X.h?H0(X.h,"Y",$._presLayout):D,l=H0(X.x||0,"X",$._presLayout),$0=H0(X.y||0,"Y",$._presLayout);Q+=PB[X.type]({w:g,h:c},{w:h,h:x,x:l,y:$0}),g=h,c=x}else Q+=" ";if(Q+="",Q+="",Q+=" ",Q+=` `,Q+=` `,Q+=" ",Q+=` `,J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=``,Q+=``,Q+=``,Q+=``,Q+="";Q+="",Q+="";break;case D0.media:if(J.mtype==="online")Q+="",Q+=" ",Q+=``,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";else Q+="",Q+=" ",Q+=``,Q+=' ',Q+=" ",Q+=` `,Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";break;case D0.chart:Q+="",Q+=" ",Q+=` `,Q+=" ",Q+=` ${N5(z)}`,Q+=" ",Q+=` `,Q+=' ',Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";break;default:Q+="";break}}),$._slideNumberProps){if(!$._slideNumberProps.align)$._slideNumberProps.align="left";if(Q+="",Q+=" ",Q+=' ',Q+=' ',Q+=" ",Q+=" ",Q+=` `,Q+="",Q+="`,$._slideNumberProps.color)Q+=B2($._slideNumberProps.color);if($._slideNumberProps.fontFace)Q+=``;Q+=""}if(Q+="",Q+="",$._slideNumberProps.align.startsWith("l"))Q+='';else if($._slideNumberProps.align.startsWith("c"))Q+='';else if($._slideNumberProps.align.startsWith("r"))Q+='';else Q+='';Q+=``,Q+=`${$._slideNum}`,Q+=""}return Q+="",Q+="",Q}function m7($,q){let Q=0,K=''+n0+'';return $._rels.forEach((J)=>{if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("hyperlink"))if(J.data==="slide")K+=``;else K+=``;else if(J.type.toLowerCase().includes("notesSlide"))K+=``}),($._relsChart||[]).forEach((J)=>{Q=Math.max(Q,J.rId),K+=``}),($._relsMedia||[]).forEach((J)=>{let Z=J.rId.toString();if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("image"))K+='';else if(J.type.toLowerCase().includes("audio"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("video"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("online"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+=''}),q.forEach((J,Z)=>{K+=``}),K+="",K}function qJ($,q){var Q,K;let J="",Z="",G="",W="",B=q?"a:lvl1pPr":"a:pPr",V=Y0(kB),U=`<${B}${$.options.rtlMode?' rtl="1" ':""}`;{if($.options.align)switch($.options.align){case"left":U+=' algn="l"';break;case"right":U+=' algn="r"';break;case"center":U+=' algn="ctr"';break;case"justify":U+=' algn="just"';break;default:U+="";break}if($.options.lineSpacing)Z=``;else if($.options.lineSpacingMultiple)Z=``;if($.options.indentLevel&&!isNaN(Number($.options.indentLevel))&&$.options.indentLevel>0)U+=` lvl="${$.options.indentLevel}"`;if($.options.paraSpaceBefore&&!isNaN(Number($.options.paraSpaceBefore))&&$.options.paraSpaceBefore>0)G+=``;if($.options.paraSpaceAfter&&!isNaN(Number($.options.paraSpaceAfter))&&$.options.paraSpaceAfter>0)G+=``;if(typeof $.options.bullet==="object"){if((K=(Q=$===null||$===void 0?void 0:$.options)===null||Q===void 0?void 0:Q.bullet)===null||K===void 0?void 0:K.indent)V=Y0($.options.bullet.indent);if($.options.bullet.type){if($.options.bullet.type.toString().toLowerCase()==="number")U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet.characterCode){let w=`&#x${$.options.bullet.characterCode};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.characterCode))console.warn("Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else if($.options.bullet.code){let w=`&#x${$.options.bullet.code};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.code))console.warn("Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet)U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``;else if(!$.options.bullet)U+=' indent="0" marL="0"',J="";if($.options.tabStops&&Array.isArray($.options.tabStops))W=`${$.options.tabStops.map((F)=>``).join("")}`;if(U+=">"+Z+G+J+W,q)U+=MJ($.options,!0);U+=""}return U}function MJ($,q){var Q;let K="",J=q?"a:defRPr":"a:rPr";if(K+="<"+J+' lang="'+($.lang?$.lang:"en-US")+'"'+($.lang?' altLang="en-US"':""),K+=$.fontSize?` sz="${Math.round($.fontSize*100)}"`:"",K+=($===null||$===void 0?void 0:$.bold)?` b="${$.bold?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.italic)?` i="${$.italic?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.strike)?` strike="${typeof $.strike==="string"?$.strike:"sngStrike"}"`:"",typeof $.underline==="object"&&((Q=$.underline)===null||Q===void 0?void 0:Q.style))K+=` u="${$.underline.style}"`;else if(typeof $.underline==="string")K+=` u="${String($.underline)}"`;else if($.hyperlink)K+=' u="sng"';if($.baseline)K+=` baseline="${Math.round($.baseline*50)}"`;else if($.subscript)K+=' baseline="-40000"';else if($.superscript)K+=' baseline="30000"';if(K+=$.charSpacing?` spc="${Math.round($.charSpacing*100)}" kern="0"`:"",K+=' dirty="0">',$.color||$.fontFace||$.outline||typeof $.underline==="object"&&$.underline.color){if($.outline&&typeof $.outline==="object")K+=`${B2($.outline.color||"FFFFFF")}`;if($.color)K+=B2({color:$.color,transparency:$.transparency});if($.highlight)K+=`${R0($.highlight)}`;if(typeof $.underline==="object"&&$.underline.color)K+=`${B2($.underline.color)}`;if($.glow)K+=`${fB($.glow,LB)}`;if($.fontFace)K+=``}if($.hyperlink){if(typeof $.hyperlink!=="object")throw Error("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:'https://github.com'}` ");else if(!$.hyperlink.url&&!$.hyperlink.slide)throw Error("ERROR: 'hyperlink requires either `url` or `slide`'");else if($.hyperlink.url)K+=`":"/>"}`;else if($.hyperlink.slide)K+=`":"/>"}`;if($.color)K+=" ",K+=' ',K+=' ',K+=" ",K+=" ",K+=""}return K+=``,K}function TB($){return $.text?`${MJ($.options,!1)}${k0($.text)}`:""}function uB($){let q="";else if($.options.fit==="resize")q+=""}if($.options.shrinkText)q+="";q+=$.options._bodyProp.autoFit?"":"",q+=""}else q+=' wrap="square" rtlCol="0">',q+="";return $._type===D0.tablecell?"":q}function KJ($){let q=$.options||{},Q=[],K=[];if(q&&$._type!==D0.tablecell&&(typeof $.text>"u"||$.text===null))return"";let J=$._type===D0.tablecell?"":"";if(J+=uB($),q.h===0&&q.line&&q.align)J+='';else if($._type==="placeholder")J+=`${qJ($,!0)}`;else J+="";if(typeof $.text==="string"||typeof $.text==="number")Q.push({text:$.text.toString(),options:q||{}});else if($.text&&!Array.isArray($.text)&&typeof $.text==="object"&&Object.keys($.text).includes("text"))Q.push({text:$.text||"",options:$.options||{}});else if(Array.isArray($.text))Q=$.text.map((W)=>({text:W.text,options:W.options}));Q.forEach((W,B)=>{if(!W.text)W.text="";if(W.options=W.options||q||{},B===0&&W.options&&!W.options.bullet&&q.bullet)W.options.bullet=q.bullet;if(typeof W.text==="string"||typeof W.text==="number")W.text=W.text.toString().replace(/\r*\n/g,n0);if(W.text.includes(n0)&&W.text.match(/\n$/g)===null)W.text.split(n0).forEach((V)=>{W.options.breakLine=!0,K.push({text:V,options:W.options})});else K.push(W)});let Z=[],G=[];if(K.forEach((W,B)=>{if(G.length>0&&(W.options.align||q.align)){if(W.options.align!==K[B-1].options.align)Z.push(G),G=[]}else if(G.length>0&&W.options.bullet&&G.length>0)Z.push(G),G=[],W.options.breakLine=!1;if(G.push(W),G.length>0&&W.options.breakLine){if(B+1{var B;let V=!1;J+="";let U=`{if(w.options._lineIdx=F,F>0&&w.options.softBreakBefore)J+="";if(w.options.align=w.options.align||q.align,w.options.lineSpacing=w.options.lineSpacing||q.lineSpacing,w.options.lineSpacingMultiple=w.options.lineSpacingMultiple||q.lineSpacingMultiple,w.options.indentLevel=w.options.indentLevel||q.indentLevel,w.options.paraSpaceBefore=w.options.paraSpaceBefore||q.paraSpaceBefore,w.options.paraSpaceAfter=w.options.paraSpaceAfter||q.paraSpaceAfter,U=qJ(w,!1),J+=U.replace("",""),Object.entries(q).filter(([M])=>!(w.options.hyperlink&&M==="color")).forEach(([M,k])=>{if(M!=="bullet"&&!w.options[M])w.options[M]=k}),J+=TB(w),!w.text&&q.fontSize||w.options.fontSize)V=!0,q.fontSize=q.fontSize||w.options.fontSize}),$._type===D0.tablecell&&(q.fontSize||q.fontFace))if(q.fontFace)J+=`',J+=``,J+=``,J+=``,J+="";else J+=`';else if(V)J+=`';else J+=``;J+=""}),J.indexOf("")===-1)J+="";return J+=$._type===D0.tablecell?"":"",J}function N5($){var q,Q;if(!$)return"";let K=((q=$.options)===null||q===void 0?void 0:q._placeholderIdx)?$.options._placeholderIdx:"",J=((Q=$.options)===null||Q===void 0?void 0:Q._placeholderType)?$.options._placeholderType:"",Z=J&&F8[J]?F8[J].toString():"";return``;break}else if("close"in h)Q+="";else if(h.moveTo||x===0)Q+=``;else Q+=``}),Q+="",Q+="",Q+="";else{if(Q+='',J.options.rectRadius)Q+=``;else if(J.options.angleRange){for(let h=0;h<2;h++){let x=J.options.angleRange[h];Q+=``}if(J.options.arcThicknessRatio)Q+=``}Q+=""}if(Q+=J.options.fill?B2(J.options.fill):"",J.options.line){if(Q+=J.options.line.width?``:"",J.options.line.color)Q+=B2(J.options.line);if(J.options.line.dashType)Q+=``;if(J.options.line.beginArrowType)Q+=``;if(J.options.line.endArrowType)Q+=``;Q+=""}if(J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=` `,Q+=` `,Q+=` `,Q+=" ",Q+="";Q+="",Q+=KJ(J),Q+="";break;case D0.image:if(Q+="",Q+=" ",Q+=``,(F=J.hyperlink)===null||F===void 0?void 0:F.url)Q+=``;if((M=J.hyperlink)===null||M===void 0?void 0:M.slide)Q+=``;if(Q+=" ",Q+=' ',Q+=" "+N5(z)+"",Q+=" ",Q+="",($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0]&&($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0].extn==="svg")Q+=``,Q+=J.options.transparency?` `:"",Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";else Q+=``,Q+=J.options.transparency?``:"",Q+="";if(X===null||X===void 0?void 0:X.type){let h=X.w?H0(X.w,"X",$._presLayout):L,x=X.h?H0(X.h,"Y",$._presLayout):D,l=H0(X.x||0,"X",$._presLayout),$0=H0(X.y||0,"Y",$._presLayout);Q+=cB[X.type]({w:g,h:c},{w:h,h:x,x:l,y:$0}),g=h,c=x}else Q+=" ";if(Q+="",Q+="",Q+=" ",Q+=` `,Q+=` `,Q+=" ",Q+=` `,J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=``,Q+=``,Q+=``,Q+=``,Q+="";Q+="",Q+="";break;case D0.media:if(J.mtype==="online")Q+="",Q+=" ",Q+=``,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";else Q+="",Q+=" ",Q+=``,Q+=' ',Q+=" ",Q+=` `,Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";break;case D0.chart:Q+="",Q+=" ",Q+=` `,Q+=" ",Q+=` ${N5(z)}`,Q+=" ",Q+=` `,Q+=' ',Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";break;default:Q+="";break}}),$._slideNumberProps){if(!$._slideNumberProps.align)$._slideNumberProps.align="left";if(Q+="",Q+=" ",Q+=' ',Q+=' ',Q+=" ",Q+=" ",Q+=` `,Q+="",Q+="`,$._slideNumberProps.color)Q+=B2($._slideNumberProps.color);if($._slideNumberProps.fontFace)Q+=``;Q+=""}if(Q+="",Q+="",$._slideNumberProps.align.startsWith("l"))Q+='';else if($._slideNumberProps.align.startsWith("c"))Q+='';else if($._slideNumberProps.align.startsWith("r"))Q+='';else Q+='';Q+=``,Q+=`${$._slideNum}`,Q+=""}return Q+="",Q+="",Q}function m7($,q){let Q=0,K=''+n0+'';return $._rels.forEach((J)=>{if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("hyperlink"))if(J.data==="slide")K+=``;else K+=``;else if(J.type.toLowerCase().includes("notesSlide"))K+=``}),($._relsChart||[]).forEach((J)=>{Q=Math.max(Q,J.rId),K+=``}),($._relsMedia||[]).forEach((J)=>{let Z=J.rId.toString();if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("image"))K+='';else if(J.type.toLowerCase().includes("audio"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("video"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("online"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+=''}),q.forEach((J,Z)=>{K+=``}),K+="",K}function qJ($,q){var Q,K;let J="",Z="",G="",W="",B=q?"a:lvl1pPr":"a:pPr",V=Y0(RB),U=`<${B}${$.options.rtlMode?' rtl="1" ':""}`;{if($.options.align)switch($.options.align){case"left":U+=' algn="l"';break;case"right":U+=' algn="r"';break;case"center":U+=' algn="ctr"';break;case"justify":U+=' algn="just"';break;default:U+="";break}if($.options.lineSpacing)Z=``;else if($.options.lineSpacingMultiple)Z=``;if($.options.indentLevel&&!isNaN(Number($.options.indentLevel))&&$.options.indentLevel>0)U+=` lvl="${$.options.indentLevel}"`;if($.options.paraSpaceBefore&&!isNaN(Number($.options.paraSpaceBefore))&&$.options.paraSpaceBefore>0)G+=``;if($.options.paraSpaceAfter&&!isNaN(Number($.options.paraSpaceAfter))&&$.options.paraSpaceAfter>0)G+=``;if(typeof $.options.bullet==="object"){if((K=(Q=$===null||$===void 0?void 0:$.options)===null||Q===void 0?void 0:Q.bullet)===null||K===void 0?void 0:K.indent)V=Y0($.options.bullet.indent);if($.options.bullet.type){if($.options.bullet.type.toString().toLowerCase()==="number")U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet.characterCode){let w=`&#x${$.options.bullet.characterCode};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.characterCode))console.warn("Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else if($.options.bullet.code){let w=`&#x${$.options.bullet.code};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.code))console.warn("Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet)U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``;else if(!$.options.bullet)U+=' indent="0" marL="0"',J="";if($.options.tabStops&&Array.isArray($.options.tabStops))W=`${$.options.tabStops.map((F)=>``).join("")}`;if(U+=">"+Z+G+J+W,q)U+=MJ($.options,!0);U+=""}return U}function MJ($,q){var Q;let K="",J=q?"a:defRPr":"a:rPr";if(K+="<"+J+' lang="'+($.lang?$.lang:"en-US")+'"'+($.lang?' altLang="en-US"':""),K+=$.fontSize?` sz="${Math.round($.fontSize*100)}"`:"",K+=($===null||$===void 0?void 0:$.bold)?` b="${$.bold?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.italic)?` i="${$.italic?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.strike)?` strike="${typeof $.strike==="string"?$.strike:"sngStrike"}"`:"",typeof $.underline==="object"&&((Q=$.underline)===null||Q===void 0?void 0:Q.style))K+=` u="${$.underline.style}"`;else if(typeof $.underline==="string")K+=` u="${String($.underline)}"`;else if($.hyperlink)K+=' u="sng"';if($.baseline)K+=` baseline="${Math.round($.baseline*50)}"`;else if($.subscript)K+=' baseline="-40000"';else if($.superscript)K+=' baseline="30000"';if(K+=$.charSpacing?` spc="${Math.round($.charSpacing*100)}" kern="0"`:"",K+=' dirty="0">',$.color||$.fontFace||$.outline||typeof $.underline==="object"&&$.underline.color){if($.outline&&typeof $.outline==="object")K+=`${B2($.outline.color||"FFFFFF")}`;if($.color)K+=B2({color:$.color,transparency:$.transparency});if($.highlight)K+=`${R0($.highlight)}`;if(typeof $.underline==="object"&&$.underline.color)K+=`${B2($.underline.color)}`;if($.glow)K+=`${AB($.glow,CB)}`;if($.fontFace)K+=``}if($.hyperlink){if(typeof $.hyperlink!=="object")throw Error("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:'https://github.com'}` ");else if(!$.hyperlink.url&&!$.hyperlink.slide)throw Error("ERROR: 'hyperlink requires either `url` or `slide`'");else if($.hyperlink.url)K+=`":"/>"}`;else if($.hyperlink.slide)K+=`":"/>"}`;if($.color)K+=" ",K+=' ',K+=' ',K+=" ",K+=" ",K+=""}return K+=``,K}function bB($){return $.text?`${MJ($.options,!1)}${k0($.text)}`:""}function nB($){let q="";else if($.options.fit==="resize")q+=""}if($.options.shrinkText)q+="";q+=$.options._bodyProp.autoFit?"":"",q+=""}else q+=' wrap="square" rtlCol="0">',q+="";return $._type===D0.tablecell?"":q}function KJ($){let q=$.options||{},Q=[],K=[];if(q&&$._type!==D0.tablecell&&(typeof $.text>"u"||$.text===null))return"";let J=$._type===D0.tablecell?"":"";if(J+=nB($),q.h===0&&q.line&&q.align)J+='';else if($._type==="placeholder")J+=`${qJ($,!0)}`;else J+="";if(typeof $.text==="string"||typeof $.text==="number")Q.push({text:$.text.toString(),options:q||{}});else if($.text&&!Array.isArray($.text)&&typeof $.text==="object"&&Object.keys($.text).includes("text"))Q.push({text:$.text||"",options:$.options||{}});else if(Array.isArray($.text))Q=$.text.map((W)=>({text:W.text,options:W.options}));Q.forEach((W,B)=>{if(!W.text)W.text="";if(W.options=W.options||q||{},B===0&&W.options&&!W.options.bullet&&q.bullet)W.options.bullet=q.bullet;if(typeof W.text==="string"||typeof W.text==="number")W.text=W.text.toString().replace(/\r*\n/g,n0);if(W.text.includes(n0)&&W.text.match(/\n$/g)===null)W.text.split(n0).forEach((V)=>{W.options.breakLine=!0,K.push({text:V,options:W.options})});else K.push(W)});let Z=[],G=[];if(K.forEach((W,B)=>{if(G.length>0&&(W.options.align||q.align)){if(W.options.align!==K[B-1].options.align)Z.push(G),G=[]}else if(G.length>0&&W.options.bullet&&G.length>0)Z.push(G),G=[],W.options.breakLine=!1;if(G.push(W),G.length>0&&W.options.breakLine){if(B+1{var B;let V=!1;J+="";let U=`{if(w.options._lineIdx=F,F>0&&w.options.softBreakBefore)J+="";if(w.options.align=w.options.align||q.align,w.options.lineSpacing=w.options.lineSpacing||q.lineSpacing,w.options.lineSpacingMultiple=w.options.lineSpacingMultiple||q.lineSpacingMultiple,w.options.indentLevel=w.options.indentLevel||q.indentLevel,w.options.paraSpaceBefore=w.options.paraSpaceBefore||q.paraSpaceBefore,w.options.paraSpaceAfter=w.options.paraSpaceAfter||q.paraSpaceAfter,U=qJ(w,!1),J+=U.replace("",""),Object.entries(q).filter(([M])=>!(w.options.hyperlink&&M==="color")).forEach(([M,k])=>{if(M!=="bullet"&&!w.options[M])w.options[M]=k}),J+=bB(w),!w.text&&q.fontSize||w.options.fontSize)V=!0,q.fontSize=q.fontSize||w.options.fontSize}),$._type===D0.tablecell&&(q.fontSize||q.fontFace))if(q.fontFace)J+=`',J+=``,J+=``,J+=``,J+="";else J+=`';else if(V)J+=`';else J+=``;J+=""}),J.indexOf("")===-1)J+="";return J+=$._type===D0.tablecell?"":"",J}function N5($){var q,Q;if(!$)return"";let K=((q=$.options)===null||q===void 0?void 0:q._placeholderIdx)?$.options._placeholderIdx:"",J=((Q=$.options)===null||Q===void 0?void 0:Q._placeholderType)?$.options._placeholderType:"",Z=J&&F8[J]?F8[J].toString():"";return`0?' hasCustomPrompt="1"':""} - />`}function SB($,q,Q){let K=''+n0;return K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',$.forEach((J)=>{(J._relsMedia||[]).forEach((Z)=>{if(Z.type!=="image"&&Z.type!=="online"&&Z.type!=="chart"&&Z.extn!=="m4v"&&!K.includes(Z.type))K+=''})}),K+='',K+='',K+='',K+='',$.forEach((J,Z)=>{K+=``,K+=``,J._relsChart.forEach((G)=>{K+=``})}),K+='',K+='',K+='',K+='',q.forEach((J,Z)=>{K+=``,(J._relsChart||[]).forEach((G)=>{K+=' '})}),$.forEach((J,Z)=>{K+=``}),Q._relsChart.forEach((J)=>{K+=' '}),Q._relsMedia.forEach((J)=>{if(J.type!=="image"&&J.type!=="online"&&J.type!=="chart"&&J.extn!=="m4v"&&!K.includes(J.type))K+=' '}),K+=' ',K+=' ',K+="",K}function EB(){return`${n0} + />`}function dB($,q,Q){let K=''+n0;return K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',$.forEach((J)=>{(J._relsMedia||[]).forEach((Z)=>{if(Z.type!=="image"&&Z.type!=="online"&&Z.type!=="chart"&&Z.extn!=="m4v"&&!K.includes(Z.type))K+=''})}),K+='',K+='',K+='',K+='',$.forEach((J,Z)=>{K+=``,K+=``,J._relsChart.forEach((G)=>{K+=``})}),K+='',K+='',K+='',K+='',q.forEach((J,Z)=>{K+=``,(J._relsChart||[]).forEach((G)=>{K+=' '})}),$.forEach((J,Z)=>{K+=``}),Q._relsChart.forEach((J)=>{K+=' '}),Q._relsMedia.forEach((J)=>{if(J.type!=="image"&&J.type!=="online"&&J.type!=="chart"&&J.extn!=="m4v"&&!K.includes(J.type))K+=' '}),K+=' ',K+=' ',K+="",K}function mB(){return`${n0} - `}function _B($,q){return`${n0} + `}function pB($,q){return`${n0} 0 0 Microsoft Office PowerPoint @@ -103,7 +103,7 @@ ${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F) false false 16.0000 - `}function cB($,q,Q,K){return` + `}function iB($,q,Q,K){return` ${k0($)} ${k0(q)} @@ -112,13 +112,13 @@ ${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F) ${K} ${new Date().toISOString().replace(/\.\d\d\dZ/,"Z")} ${new Date().toISOString().replace(/\.\d\d\dZ/,"Z")} - `}function bB($){let q=1,Q=''+n0;Q+='',Q+='';for(let K=1;K<=$.length;K++)Q+=``;return q++,Q+=``,Q}function nB($){return`${n0}${d7($)}`}function dB($){let q="";return $._slideObjects.forEach((Q)=>{if(Q._type===D0.notes)q+=(Q===null||Q===void 0?void 0:Q.text)&&Q.text[0]?Q.text[0].text:""}),q.replace(/\r*\n/g,n0)}function mB(){return`${n0}7/23/19Click to edit Master text stylesSecond levelThird levelFourth levelFifth level‹#›`}function pB($){return`${n0}${k0(dB($))}${$._slideNum}`}function iB($){return` + `}function oB($){let q=1,Q=''+n0;Q+='',Q+='';for(let K=1;K<=$.length;K++)Q+=``;return q++,Q+=``,Q}function aB($){return`${n0}${d7($)}`}function lB($){let q="";return $._slideObjects.forEach((Q)=>{if(Q._type===D0.notes)q+=(Q===null||Q===void 0?void 0:Q.text)&&Q.text[0]?Q.text[0].text:""}),q.replace(/\r*\n/g,n0)}function rB(){return`${n0}7/23/19Click to edit Master text stylesSecond levelThird levelFourth levelFifth level‹#›`}function sB($){return`${n0}${k0(lB($))}${$._slideNum}`}function tB($){return` ${d7($)} - `}function oB($,q){let Q=q.map((J,Z)=>``),K=''+n0;return K+='',K+=d7($),K+='',K+=""+Q.join("")+"",K+='',K+=' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' ',K+="",K}function aB($,q){return m7(q[$-1],[{target:"../slideMasters/slideMaster1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"}])}function lB($,q,Q){return m7($[Q-1],[{target:`../slideLayouts/slideLayout${eB($,q,Q)}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"},{target:`../notesSlides/notesSlide${Q}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"}])}function rB($){return` + `}function eB($,q){let Q=q.map((J,Z)=>``),K=''+n0;return K+='',K+=d7($),K+='',K+=""+Q.join("")+"",K+='',K+=' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' ',K+="",K}function $z($,q){return m7(q[$-1],[{target:"../slideMasters/slideMaster1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"}])}function Qz($,q,Q){return m7($[Q-1],[{target:`../slideLayouts/slideLayout${Vz($,q,Q)}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"},{target:`../notesSlides/notesSlide${Q}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"}])}function qz($){return` - `}function sB($,q){let Q=q.map((K,J)=>({target:`../slideLayouts/slideLayout${J+1}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"}));return Q.push({target:"../theme/theme1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}),m7($,Q)}function tB(){return`${n0} + `}function Kz($,q){let Q=q.map((K,J)=>({target:`../slideLayouts/slideLayout${J+1}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"}));return Q.push({target:"../theme/theme1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}),m7($,Q)}function Jz(){return`${n0} - `}function eB($,q,Q){for(let K=0;K`:'',G=((K=$.theme)===null||K===void 0?void 0:K.bodyFontFace)?``:'';return`${Z}${G}`}function Qz($){let q=`${n0}`;q+='',q+="",$.slides.forEach((Q)=>q+=``),q+="",q+=``,q+=``,q+=``,q+="";for(let Q=1;Q<10;Q++)q+=``;if(q+="",$.sections&&$.sections.length>0)q+='',q+='',$.sections.forEach((Q)=>{q+=``,Q._slides.forEach((K)=>q+=``),q+=""}),q+="",q+='',q+="";return q+="",q}function qz(){return`${n0}`}function Kz(){return`${n0}`}function Jz(){return`${n0}`}var Vz="4.0.1";class p7{set layout($){let q=this.LAYOUTS[$];if(q)this._layout=$,this._presLayout=q;else throw Error("UNKNOWN-LAYOUT")}get layout(){return this._layout}get version(){return this._version}set author($){this._author=$}get author(){return this._author}set company($){this._company=$}get company(){return this._company}set revision($){this._revision=$}get revision(){return this._revision}set subject($){this._subject=$}get subject(){return this._subject}set theme($){this._theme=$}get theme(){return this._theme}set title($){this._title=$}get title(){return this._title}set rtlMode($){this._rtlMode=$}get rtlMode(){return this._rtlMode}get masterSlide(){return this._masterSlide}get slides(){return this._slides}get sections(){return this._sections}get slideLayouts(){return this._slideLayouts}get AlignH(){return this._alignH}get AlignV(){return this._alignV}get ChartType(){return this._chartType}get OutputType(){return this._outputType}get presLayout(){return this._presLayout}get SchemeColor(){return this._schemeColor}get ShapeType(){return this._shapeType}get charts(){return this._charts}get colors(){return this._colors}get shapes(){return this._shapes}constructor(){this._version=Vz,this._alignH=S7,this._alignV=E7,this._chartType=T7,this._outputType=P7,this._schemeColor=G2,this._shapeType=u7,this._charts=q0,this._colors=L5,this._shapes=B1,this.addNewSlide=(J)=>{let Z=this.sections.length>0&&this.sections[this.sections.length-1]._slides.filter((G)=>G._slideNum===this.slides[this.slides.length-1]._slideNum).length>0;return J.sectionTitle=Z?this.sections[this.sections.length-1].title:null,this.addSlide(J)},this.getSlide=(J)=>this.slides.filter((Z)=>Z._slideNum===J)[0],this.setSlideNumber=(J)=>{this.masterSlide._slideNumberProps=J,this.slideLayouts.filter((Z)=>Z._name===x7)[0]._slideNumberProps=J},this.createChartMediaRels=(J,Z,G)=>{J._relsChart.forEach((W)=>G.push(hB(W,Z))),J._relsMedia.forEach((W)=>{if(W.type!=="online"&&W.type!=="hyperlink"){let B=W.data&&typeof W.data==="string"?W.data:"";if(!B.includes(",")&&!B.includes(";"))B="image/png;base64,"+B;else if(!B.includes(","))B="image/png;base64,"+B;else if(!B.includes(";"))B="image/png;"+B;Z.file(W.Target.replace("..","ppt"),B.split(",").pop(),{base64:!0})}})},this.writeFileToBrowser=(J,Z)=>W2(this,void 0,void 0,function*(){let G=document.createElement("a");if(G.setAttribute("style","display:none;"),G.dataset.interception="off",document.body.appendChild(G),window.URL.createObjectURL){let W=window.URL.createObjectURL(new Blob([Z],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}));return G.href=W,G.download=J,G.click(),setTimeout(()=>{window.URL.revokeObjectURL(W),document.body.removeChild(G)},100),yield Promise.resolve(J)}}),this.exportPresentation=(J)=>W2(this,void 0,void 0,function*(){let Z=[],G=[],W=new c7.default;return this.slides.forEach((B)=>{G=G.concat(h7(B))}),this.slideLayouts.forEach((B)=>{G=G.concat(h7(B))}),G=G.concat(h7(this.masterSlide)),yield Promise.all(G).then(()=>W2(this,void 0,void 0,function*(){return this.slides.forEach((B)=>{if(B._slideLayout)yB(B)}),W.folder("_rels"),W.folder("docProps"),W.folder("ppt").folder("_rels"),W.folder("ppt/charts").folder("_rels"),W.folder("ppt/embeddings"),W.folder("ppt/media"),W.folder("ppt/slideLayouts").folder("_rels"),W.folder("ppt/slideMasters").folder("_rels"),W.folder("ppt/slides").folder("_rels"),W.folder("ppt/theme"),W.folder("ppt/notesMasters").folder("_rels"),W.folder("ppt/notesSlides").folder("_rels"),W.file("[Content_Types].xml",SB(this.slides,this.slideLayouts,this.masterSlide)),W.file("_rels/.rels",EB()),W.file("docProps/app.xml",_B(this.slides,this.company)),W.file("docProps/core.xml",cB(this.title,this.subject,this.author,this.revision)),W.file("ppt/_rels/presentation.xml.rels",bB(this.slides)),W.file("ppt/theme/theme1.xml",$z(this)),W.file("ppt/presentation.xml",Qz(this)),W.file("ppt/presProps.xml",qz()),W.file("ppt/tableStyles.xml",Kz()),W.file("ppt/viewProps.xml",Jz()),this.slideLayouts.forEach((B,V)=>{W.file(`ppt/slideLayouts/slideLayout${V+1}.xml`,iB(B)),W.file(`ppt/slideLayouts/_rels/slideLayout${V+1}.xml.rels`,aB(V+1,this.slideLayouts))}),this.slides.forEach((B,V)=>{W.file(`ppt/slides/slide${V+1}.xml`,nB(B)),W.file(`ppt/slides/_rels/slide${V+1}.xml.rels`,lB(this.slides,this.slideLayouts,V+1)),W.file(`ppt/notesSlides/notesSlide${V+1}.xml`,pB(B)),W.file(`ppt/notesSlides/_rels/notesSlide${V+1}.xml.rels`,rB(V+1))}),W.file("ppt/slideMasters/slideMaster1.xml",oB(this.masterSlide,this.slideLayouts)),W.file("ppt/slideMasters/_rels/slideMaster1.xml.rels",sB(this.masterSlide,this.slideLayouts)),W.file("ppt/notesMasters/notesMaster1.xml",mB()),W.file("ppt/notesMasters/_rels/notesMaster1.xml.rels",tB()),this.slideLayouts.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.slides.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.createChartMediaRels(this.masterSlide,W,Z),yield Promise.all(Z).then(()=>W2(this,void 0,void 0,function*(){if(J.outputType==="STREAM")return yield W.generateAsync({type:"nodebuffer",compression:J.compression?"DEFLATE":"STORE"});else if(J.outputType)return yield W.generateAsync({type:J.outputType});else return yield W.generateAsync({type:"blob",compression:J.compression?"DEFLATE":"STORE"})}))}))});let $={name:"screen4x3",width:9144000,height:6858000},q={name:"screen16x9",width:9144000,height:5143500},Q={name:"screen16x10",width:9144000,height:5715000},K={name:"custom",width:12192000,height:6858000};this.LAYOUTS={LAYOUT_4x3:$,LAYOUT_16x9:q,LAYOUT_16x10:Q,LAYOUT_WIDE:K},this._author="PptxGenJS",this._company="PptxGenJS",this._revision="1",this._subject="PptxGenJS Presentation",this._title="PptxGenJS Presentation",this._presLayout={name:this.LAYOUTS[f6].name,_sizeW:this.LAYOUTS[f6].width,_sizeH:this.LAYOUTS[f6].height,width:this.LAYOUTS[f6].width,height:this.LAYOUTS[f6].height},this._rtlMode=!1,this._slideLayouts=[{_margin:M8,_name:x7,_presLayout:this._presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000,_slideNumberProps:null,_slideObjects:[]}],this._slides=[],this._sections=[],this._masterSlide={addChart:null,addImage:null,addMedia:null,addNotes:null,addShape:null,addTable:null,addText:null,_name:null,_presLayout:this._presLayout,_rId:null,_rels:[],_relsChart:[],_relsMedia:[],_slideId:null,_slideLayout:null,_slideNum:null,_slideNumberProps:null,_slideObjects:[]}}stream($){return W2(this,void 0,void 0,function*(){return yield this.exportPresentation({compression:$===null||$===void 0?void 0:$.compression,outputType:"STREAM"})})}write($){return W2(this,void 0,void 0,function*(){let q=typeof $==="object"&&($===null||$===void 0?void 0:$.outputType)?$.outputType:$?$:null,Q=typeof $==="object"&&($===null||$===void 0?void 0:$.compression)?$.compression:!1;return yield this.exportPresentation({compression:Q,outputType:q})})}writeFile($){return W2(this,void 0,void 0,function*(){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node";if(typeof $==="string")console.warn("[WARNING] writeFile(string) is deprecated - pass { fileName } instead."),$={fileName:$};let{fileName:J="Presentation.pptx",compression:Z=!1}=$,G=J.toLowerCase().endsWith(".pptx")?J:`${J}.pptx`,W=K?"nodebuffer":null,B=yield this.exportPresentation({compression:Z,outputType:W});if(K){let{promises:V}=yield import("node:fs"),{writeFile:U}=V;return yield U(G,B),G}return yield this.writeFileToBrowser(G,B),G})}addSection($){if(!$)console.warn("addSection requires an argument");else if(!$.title)console.warn("addSection requires a title");let q={_type:"user",_slides:[],title:$.title};if($.order)this.sections.splice($.order,0,q);else this._sections.push(q)}addSlide($){let q=typeof $==="string"?$:($===null||$===void 0?void 0:$.masterName)?$.masterName:"",Q={_name:this.LAYOUTS[f6].name,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slideNum:this.slides.length+1};if(q){let J=this.slideLayouts.filter((Z)=>Z._name===q)[0];if(J)Q=J}let K=new FJ({addSlide:this.addNewSlide,getSlide:this.getSlide,presLayout:this.presLayout,setSlideNum:this.setSlideNumber,slideId:this.slides.length+256,slideRId:this.slides.length+2,slideNumber:this.slides.length+1,slideLayout:Q});if(this._slides.push(K),$===null||$===void 0?void 0:$.sectionTitle){let J=this.sections.filter((Z)=>Z.title===$.sectionTitle)[0];if(!J)console.warn(`addSlide: unable to find section with title: "${$.sectionTitle}"`);else J._slides.push(K)}else if(this.sections&&this.sections.length>0&&!($===null||$===void 0?void 0:$.sectionTitle)){let J=this._sections[this.sections.length-1];if(J._type==="default")J._slides.push(K);else this._sections.push({title:`Default-${this.sections.filter((Z)=>Z._type==="default").length+1}`,_type:"default",_slides:[K]})}return K}defineLayout($){if(!$)console.warn("defineLayout requires `{name, width, height}`");else if(!$.name)console.warn("defineLayout requires `name`");else if(!$.width)console.warn("defineLayout requires `width`");else if(!$.height)console.warn("defineLayout requires `height`");else if(typeof $.height!=="number")console.warn("defineLayout `height` should be a number (inches)");else if(typeof $.width!=="number")console.warn("defineLayout `width` should be a number (inches)");this.LAYOUTS[$.name]={name:$.name,_sizeW:Math.round(Number($.width)*L0),_sizeH:Math.round(Number($.height)*L0),width:Math.round(Number($.width)*L0),height:Math.round(Number($.height)*L0)}}defineSlideMaster($){let q=JSON.parse(JSON.stringify($));if(!q.title)throw Error("defineSlideMaster() object argument requires a `title` value. (https://gitbrent.github.io/PptxGenJS/docs/masters.html)");let Q={_margin:q.margin||M8,_name:q.title,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000+this.slideLayouts.length+1,_slideNumberProps:q.slideNumber||null,_slideObjects:[],background:q.background||null,bkgd:q.bkgd||null};if(jB(q,Q),this.slideLayouts.push(Q),q.background||q.bkgd)zJ(q.background,Q);if(Q._slideNumberProps&&!this.masterSlide._slideNumberProps)this.masterSlide._slideNumberProps=Q._slideNumberProps}tableToSlides($,q={}){IB(this,$,q,(q===null||q===void 0?void 0:q.masterSlideName)?this.slideLayouts.filter((Q)=>Q._name===q.masterSlideName)[0]:null)}}if(typeof globalThis.Buffer>"u")globalThis.Buffer=o;if(typeof globalThis.process>"u")globalThis.process=Uz;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.pptxgenjs=p7;})(); + `}function Vz($,q,Q){for(let K=0;K`:'',G=((K=$.theme)===null||K===void 0?void 0:K.bodyFontFace)?``:'';return`${Z}${G}`}function Zz($){let q=`${n0}`;q+='',q+="",$.slides.forEach((Q)=>q+=``),q+="",q+=``,q+=``,q+=``,q+="";for(let Q=1;Q<10;Q++)q+=``;if(q+="",$.sections&&$.sections.length>0)q+='',q+='',$.sections.forEach((Q)=>{q+=``,Q._slides.forEach((K)=>q+=``),q+=""}),q+="",q+='',q+="";return q+="",q}function Gz(){return`${n0}`}function Wz(){return`${n0}`}function Bz(){return`${n0}`}var zz="4.0.1";class p7{set layout($){let q=this.LAYOUTS[$];if(q)this._layout=$,this._presLayout=q;else throw Error("UNKNOWN-LAYOUT")}get layout(){return this._layout}get version(){return this._version}set author($){this._author=$}get author(){return this._author}set company($){this._company=$}get company(){return this._company}set revision($){this._revision=$}get revision(){return this._revision}set subject($){this._subject=$}get subject(){return this._subject}set theme($){this._theme=$}get theme(){return this._theme}set title($){this._title=$}get title(){return this._title}set rtlMode($){this._rtlMode=$}get rtlMode(){return this._rtlMode}get masterSlide(){return this._masterSlide}get slides(){return this._slides}get sections(){return this._sections}get slideLayouts(){return this._slideLayouts}get AlignH(){return this._alignH}get AlignV(){return this._alignV}get ChartType(){return this._chartType}get OutputType(){return this._outputType}get presLayout(){return this._presLayout}get SchemeColor(){return this._schemeColor}get ShapeType(){return this._shapeType}get charts(){return this._charts}get colors(){return this._colors}get shapes(){return this._shapes}constructor(){this._version=zz,this._alignH=S7,this._alignV=E7,this._chartType=T7,this._outputType=P7,this._schemeColor=G2,this._shapeType=u7,this._charts=q0,this._colors=L5,this._shapes=B1,this.addNewSlide=(J)=>{let Z=this.sections.length>0&&this.sections[this.sections.length-1]._slides.filter((G)=>G._slideNum===this.slides[this.slides.length-1]._slideNum).length>0;return J.sectionTitle=Z?this.sections[this.sections.length-1].title:null,this.addSlide(J)},this.getSlide=(J)=>this.slides.filter((Z)=>Z._slideNum===J)[0],this.setSlideNumber=(J)=>{this.masterSlide._slideNumberProps=J,this.slideLayouts.filter((Z)=>Z._name===x7)[0]._slideNumberProps=J},this.createChartMediaRels=(J,Z,G)=>{J._relsChart.forEach((W)=>G.push(SB(W,Z))),J._relsMedia.forEach((W)=>{if(W.type!=="online"&&W.type!=="hyperlink"){let B=W.data&&typeof W.data==="string"?W.data:"";if(!B.includes(",")&&!B.includes(";"))B="image/png;base64,"+B;else if(!B.includes(","))B="image/png;base64,"+B;else if(!B.includes(";"))B="image/png;"+B;Z.file(W.Target.replace("..","ppt"),B.split(",").pop(),{base64:!0})}})},this.writeFileToBrowser=(J,Z)=>W2(this,void 0,void 0,function*(){let G=document.createElement("a");if(G.setAttribute("style","display:none;"),G.dataset.interception="off",document.body.appendChild(G),window.URL.createObjectURL){let W=window.URL.createObjectURL(new Blob([Z],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}));return G.href=W,G.download=J,G.click(),setTimeout(()=>{window.URL.revokeObjectURL(W),document.body.removeChild(G)},100),yield Promise.resolve(J)}}),this.exportPresentation=(J)=>W2(this,void 0,void 0,function*(){let Z=[],G=[],W=new c7.default;return this.slides.forEach((B)=>{G=G.concat(h7(B))}),this.slideLayouts.forEach((B)=>{G=G.concat(h7(B))}),G=G.concat(h7(this.masterSlide)),yield Promise.all(G).then(()=>W2(this,void 0,void 0,function*(){return this.slides.forEach((B)=>{if(B._slideLayout)uB(B)}),W.folder("_rels"),W.folder("docProps"),W.folder("ppt").folder("_rels"),W.folder("ppt/charts").folder("_rels"),W.folder("ppt/embeddings"),W.folder("ppt/media"),W.folder("ppt/slideLayouts").folder("_rels"),W.folder("ppt/slideMasters").folder("_rels"),W.folder("ppt/slides").folder("_rels"),W.folder("ppt/theme"),W.folder("ppt/notesMasters").folder("_rels"),W.folder("ppt/notesSlides").folder("_rels"),W.file("[Content_Types].xml",dB(this.slides,this.slideLayouts,this.masterSlide)),W.file("_rels/.rels",mB()),W.file("docProps/app.xml",pB(this.slides,this.company)),W.file("docProps/core.xml",iB(this.title,this.subject,this.author,this.revision)),W.file("ppt/_rels/presentation.xml.rels",oB(this.slides)),W.file("ppt/theme/theme1.xml",Uz(this)),W.file("ppt/presentation.xml",Zz(this)),W.file("ppt/presProps.xml",Gz()),W.file("ppt/tableStyles.xml",Wz()),W.file("ppt/viewProps.xml",Bz()),this.slideLayouts.forEach((B,V)=>{W.file(`ppt/slideLayouts/slideLayout${V+1}.xml`,tB(B)),W.file(`ppt/slideLayouts/_rels/slideLayout${V+1}.xml.rels`,$z(V+1,this.slideLayouts))}),this.slides.forEach((B,V)=>{W.file(`ppt/slides/slide${V+1}.xml`,aB(B)),W.file(`ppt/slides/_rels/slide${V+1}.xml.rels`,Qz(this.slides,this.slideLayouts,V+1)),W.file(`ppt/notesSlides/notesSlide${V+1}.xml`,sB(B)),W.file(`ppt/notesSlides/_rels/notesSlide${V+1}.xml.rels`,qz(V+1))}),W.file("ppt/slideMasters/slideMaster1.xml",eB(this.masterSlide,this.slideLayouts)),W.file("ppt/slideMasters/_rels/slideMaster1.xml.rels",Kz(this.masterSlide,this.slideLayouts)),W.file("ppt/notesMasters/notesMaster1.xml",rB()),W.file("ppt/notesMasters/_rels/notesMaster1.xml.rels",Jz()),this.slideLayouts.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.slides.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.createChartMediaRels(this.masterSlide,W,Z),yield Promise.all(Z).then(()=>W2(this,void 0,void 0,function*(){if(J.outputType==="STREAM")return yield W.generateAsync({type:"nodebuffer",compression:J.compression?"DEFLATE":"STORE"});else if(J.outputType)return yield W.generateAsync({type:J.outputType});else return yield W.generateAsync({type:"blob",compression:J.compression?"DEFLATE":"STORE"})}))}))});let $={name:"screen4x3",width:9144000,height:6858000},q={name:"screen16x9",width:9144000,height:5143500},Q={name:"screen16x10",width:9144000,height:5715000},K={name:"custom",width:12192000,height:6858000};this.LAYOUTS={LAYOUT_4x3:$,LAYOUT_16x9:q,LAYOUT_16x10:Q,LAYOUT_WIDE:K},this._author="PptxGenJS",this._company="PptxGenJS",this._revision="1",this._subject="PptxGenJS Presentation",this._title="PptxGenJS Presentation",this._presLayout={name:this.LAYOUTS[f6].name,_sizeW:this.LAYOUTS[f6].width,_sizeH:this.LAYOUTS[f6].height,width:this.LAYOUTS[f6].width,height:this.LAYOUTS[f6].height},this._rtlMode=!1,this._slideLayouts=[{_margin:M8,_name:x7,_presLayout:this._presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000,_slideNumberProps:null,_slideObjects:[]}],this._slides=[],this._sections=[],this._masterSlide={addChart:null,addImage:null,addMedia:null,addNotes:null,addShape:null,addTable:null,addText:null,_name:null,_presLayout:this._presLayout,_rId:null,_rels:[],_relsChart:[],_relsMedia:[],_slideId:null,_slideLayout:null,_slideNum:null,_slideNumberProps:null,_slideObjects:[]}}stream($){return W2(this,void 0,void 0,function*(){return yield this.exportPresentation({compression:$===null||$===void 0?void 0:$.compression,outputType:"STREAM"})})}write($){return W2(this,void 0,void 0,function*(){let q=typeof $==="object"&&($===null||$===void 0?void 0:$.outputType)?$.outputType:$?$:null,Q=typeof $==="object"&&($===null||$===void 0?void 0:$.compression)?$.compression:!1;return yield this.exportPresentation({compression:Q,outputType:q})})}writeFile($){return W2(this,void 0,void 0,function*(){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node";if(typeof $==="string")console.warn("[WARNING] writeFile(string) is deprecated - pass { fileName } instead."),$={fileName:$};let{fileName:J="Presentation.pptx",compression:Z=!1}=$,G=J.toLowerCase().endsWith(".pptx")?J:`${J}.pptx`,W=K?"nodebuffer":null,B=yield this.exportPresentation({compression:Z,outputType:W});if(K){let{promises:V}=yield import("node:fs"),{writeFile:U}=V;return yield U(G,B),G}return yield this.writeFileToBrowser(G,B),G})}addSection($){if(!$)console.warn("addSection requires an argument");else if(!$.title)console.warn("addSection requires a title");let q={_type:"user",_slides:[],title:$.title};if($.order)this.sections.splice($.order,0,q);else this._sections.push(q)}addSlide($){let q=typeof $==="string"?$:($===null||$===void 0?void 0:$.masterName)?$.masterName:"",Q={_name:this.LAYOUTS[f6].name,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slideNum:this.slides.length+1};if(q){let J=this.slideLayouts.filter((Z)=>Z._name===q)[0];if(J)Q=J}let K=new FJ({addSlide:this.addNewSlide,getSlide:this.getSlide,presLayout:this.presLayout,setSlideNum:this.setSlideNumber,slideId:this.slides.length+256,slideRId:this.slides.length+2,slideNumber:this.slides.length+1,slideLayout:Q});if(this._slides.push(K),$===null||$===void 0?void 0:$.sectionTitle){let J=this.sections.filter((Z)=>Z.title===$.sectionTitle)[0];if(!J)console.warn(`addSlide: unable to find section with title: "${$.sectionTitle}"`);else J._slides.push(K)}else if(this.sections&&this.sections.length>0&&!($===null||$===void 0?void 0:$.sectionTitle)){let J=this._sections[this.sections.length-1];if(J._type==="default")J._slides.push(K);else this._sections.push({title:`Default-${this.sections.filter((Z)=>Z._type==="default").length+1}`,_type:"default",_slides:[K]})}return K}defineLayout($){if(!$)console.warn("defineLayout requires `{name, width, height}`");else if(!$.name)console.warn("defineLayout requires `name`");else if(!$.width)console.warn("defineLayout requires `width`");else if(!$.height)console.warn("defineLayout requires `height`");else if(typeof $.height!=="number")console.warn("defineLayout `height` should be a number (inches)");else if(typeof $.width!=="number")console.warn("defineLayout `width` should be a number (inches)");this.LAYOUTS[$.name]={name:$.name,_sizeW:Math.round(Number($.width)*L0),_sizeH:Math.round(Number($.height)*L0),width:Math.round(Number($.width)*L0),height:Math.round(Number($.height)*L0)}}defineSlideMaster($){let q=JSON.parse(JSON.stringify($));if(!q.title)throw Error("defineSlideMaster() object argument requires a `title` value. (https://gitbrent.github.io/PptxGenJS/docs/masters.html)");let Q={_margin:q.margin||M8,_name:q.title,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000+this.slideLayouts.length+1,_slideNumberProps:q.slideNumber||null,_slideObjects:[],background:q.background||null,bkgd:q.bkgd||null};if(xB(q,Q),this.slideLayouts.push(Q),q.background||q.bkgd)zJ(q.background,Q);if(Q._slideNumberProps&&!this.masterSlide._slideNumberProps)this.masterSlide._slideNumberProps=Q._slideNumberProps}tableToSlides($,q={}){yB(this,$,q,(q===null||q===void 0?void 0:q.masterSlideName)?this.slideLayouts.filter((Q)=>Q._name===q.masterSlideName)[0]:null)}}if(typeof globalThis.Buffer>"u")globalThis.Buffer=o;if(typeof globalThis.process>"u")globalThis.process=Fz;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.pptxgenjs=p7;})(); diff --git a/packages/testing/src/mocks/audit.mock.ts b/packages/testing/src/mocks/audit.mock.ts index f2c6362efb0..5e03b742d36 100644 --- a/packages/testing/src/mocks/audit.mock.ts +++ b/packages/testing/src/mocks/audit.mock.ts @@ -178,6 +178,22 @@ export const auditMock = { WORKSPACE_FORK_ROLLED_BACK: 'workspace.fork_rolled_back', WORKSPACE_FORK_UNLINKED: 'workspace.fork_unlinked', WORKSPACE_EXPORTED: 'workspace.exported', + SCIM_CONNECTION_ENABLED: 'scim_connection.enabled', + SCIM_CONNECTION_DISABLED: 'scim_connection.disabled', + SCIM_CONNECTION_SETTINGS_UPDATED: 'scim_connection.settings_updated', + SCIM_CREDENTIAL_ISSUED: 'scim_credential.issued', + SCIM_CREDENTIAL_REVOKED: 'scim_credential.revoked', + SCIM_USER_PROVISIONED: 'scim_user.provisioned', + SCIM_USER_UPDATED: 'scim_user.updated', + SCIM_USER_DEACTIVATED: 'scim_user.deactivated', + SCIM_USER_REACTIVATED: 'scim_user.reactivated', + SCIM_USER_DEPROVISIONED: 'scim_user.deprovisioned', + SCIM_GROUP_CREATED: 'scim_group.created', + SCIM_GROUP_UPDATED: 'scim_group.updated', + SCIM_GROUP_MEMBERSHIP_CHANGED: 'scim_group.membership_changed', + SCIM_GROUP_DELETED: 'scim_group.deleted', + SCIM_GROUP_MAPPING_UPSERTED: 'scim_group_mapping.upserted', + SCIM_GROUP_MAPPING_DELETED: 'scim_group_mapping.deleted', CREDIT_ISSUED: 'credit.issued', INVOICE_PAYMENT_SUCCEEDED: 'invoice.payment_succeeded', INVOICE_PAYMENT_FAILED: 'invoice.payment_failed', @@ -221,10 +237,13 @@ export const auditMock = { PERMISSION_GROUP: 'permission_group', SANDBOX: 'sandbox', SCHEDULE: 'schedule', + SCIM_CONNECTION: 'scim_connection', + SCIM_GROUP: 'scim_group', SECRET_PROVENANCE: 'secret_provenance', SKILL: 'skill', SUBSCRIPTION: 'subscription', TABLE: 'table', + USER: 'user', WEBHOOK: 'webhook', WORKFLOW: 'workflow', WORKSPACE: 'workspace', From aa695d17ee29a9ac23c80a0fd99d30a2e9eac9ee Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 14:42:44 -0700 Subject: [PATCH 16/31] fix(scim): submit only the changed setting; move settings option lists to a constants module Also stubs the SCIM section in the SSO settings test, which has no QueryClient. Co-Authored-By: Claude Fable 5.1 --- apps/sim/ee/scim/components/scim-section.tsx | 60 ++++--------------- apps/sim/ee/scim/constants.ts | 48 +++++++++++++++ .../ee/sso/components/sso-settings.test.tsx | 5 ++ 3 files changed, 64 insertions(+), 49 deletions(-) create mode 100644 apps/sim/ee/scim/constants.ts diff --git a/apps/sim/ee/scim/components/scim-section.tsx b/apps/sim/ee/scim/components/scim-section.tsx index 291c93671d3..30907bdc26c 100644 --- a/apps/sim/ee/scim/components/scim-section.tsx +++ b/apps/sim/ee/scim/components/scim-section.tsx @@ -34,6 +34,15 @@ import { usePermissionGroups, } from '@/ee/access-control/hooks/permission-groups' import { SettingRow } from '@/ee/components/setting-row' +import { + CREDENTIAL_EXPIRY_OPTIONS, + type CredentialExpiry, + type MappingTargetKind, + PERMISSION_OPTIONS, + SETTING_TOGGLES, + TARGET_KIND_OPTIONS, + type WorkspacePermission, +} from '@/ee/scim/constants' import { useConfigureScimConnection, useDeleteScimGroupMapping, @@ -50,51 +59,6 @@ interface ScimSectionProps { organizationId: string } -type MappingTargetKind = ScimGroupMappingView['targetKind'] -type WorkspacePermission = NonNullable - -const TARGET_KIND_OPTIONS = [ - { value: 'permission_group', label: 'Permission group' }, - { value: 'workspace', label: 'Workspace' }, - { value: 'org_role', label: 'Organization admin' }, -] as const - -const PERMISSION_OPTIONS = [ - { value: 'read', label: 'Read' }, - { value: 'write', label: 'Write' }, - { value: 'admin', label: 'Admin' }, -] as const - -const SETTING_TOGGLES = [ - { - key: 'lockManualMembership', - label: 'Lock managed membership', - description: - 'Refuse invitations, role changes, and manual grants for members the directory provisions. The next sync would revert them anyway.', - }, - { - key: 'disableJit', - label: 'Disable just-in-time provisioning', - description: - 'Refuse membership for someone signing in with SSO who the directory never provisioned. The directory becomes the only way in.', - }, - { - key: 'autoMapPermissionGroupsByName', - label: 'Match permission groups by name', - description: - 'When a pushed group has the same name as one of your permission groups, map them automatically. Nothing is created.', - }, -] as const - -/** Credential lifetimes offered at issue time; `never` matches what Okta and Entra expect by default. */ -const CREDENTIAL_EXPIRY_OPTIONS = [ - { value: 'never', label: 'Never expires' }, - { value: '90', label: 'Expires in 90 days' }, - { value: '365', label: 'Expires in 1 year' }, -] as const - -type CredentialExpiry = (typeof CREDENTIAL_EXPIRY_OPTIONS)[number]['value'] - const RELATIVE_TIME = new Intl.RelativeTimeFormat('en', { numeric: 'auto' }) /** Renders "3 minutes ago" for the activity list and credential rows. */ @@ -367,10 +331,8 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp async function handleToggleSetting(key: (typeof SETTING_TOGGLES)[number]['key'], value: boolean) { try { - await configure.mutateAsync({ - organizationId, - settings: { ...connection.settings, [key]: value }, - }) + /** Only the changed key is sent; the server merges it, so a concurrent edit elsewhere is not reverted. */ + await configure.mutateAsync({ organizationId, settings: { [key]: value } }) } catch (error) { toast.error(getErrorMessage(error, 'Failed to update setting')) } diff --git a/apps/sim/ee/scim/constants.ts b/apps/sim/ee/scim/constants.ts new file mode 100644 index 00000000000..9005a3421a9 --- /dev/null +++ b/apps/sim/ee/scim/constants.ts @@ -0,0 +1,48 @@ +import type { ScimGroupMappingView } from '@/lib/api/contracts/organization-scim' + +/** Option lists and setting descriptions for the directory provisioning settings section. */ + +export type MappingTargetKind = ScimGroupMappingView['targetKind'] +export type WorkspacePermission = NonNullable + +export const TARGET_KIND_OPTIONS = [ + { value: 'permission_group', label: 'Permission group' }, + { value: 'workspace', label: 'Workspace' }, + { value: 'org_role', label: 'Organization admin' }, +] as const + +export const PERMISSION_OPTIONS = [ + { value: 'read', label: 'Read' }, + { value: 'write', label: 'Write' }, + { value: 'admin', label: 'Admin' }, +] as const + +export const SETTING_TOGGLES = [ + { + key: 'lockManualMembership', + label: 'Lock managed membership', + description: + 'Refuse invitations, role changes, and manual grants for members the directory provisions. The next sync would revert them anyway.', + }, + { + key: 'disableJit', + label: 'Disable just-in-time provisioning', + description: + 'Refuse membership for someone signing in with SSO who the directory never provisioned. The directory becomes the only way in.', + }, + { + key: 'autoMapPermissionGroupsByName', + label: 'Match permission groups by name', + description: + 'When a pushed group has the same name as one of your permission groups, map them automatically. Nothing is created.', + }, +] as const + +/** Credential lifetimes offered at issue time; `never` matches what Okta and Entra expect by default. */ +export const CREDENTIAL_EXPIRY_OPTIONS = [ + { value: 'never', label: 'Never expires' }, + { value: '90', label: 'Expires in 90 days' }, + { value: '365', label: 'Expires in 1 year' }, +] as const + +export type CredentialExpiry = (typeof CREDENTIAL_EXPIRY_OPTIONS)[number]['value'] diff --git a/apps/sim/ee/sso/components/sso-settings.test.tsx b/apps/sim/ee/sso/components/sso-settings.test.tsx index bf290898ac1..2c96b29c160 100644 --- a/apps/sim/ee/sso/components/sso-settings.test.tsx +++ b/apps/sim/ee/sso/components/sso-settings.test.tsx @@ -90,6 +90,11 @@ vi.mock('@/ee/sso/components/verified-domains-section', () => ({ VerifiedDomainsSection: () =>
, })) +/** Directory provisioning has its own React Query hooks and its own tests; here it is a sibling section. */ +vi.mock('@/ee/scim/components/scim-section', () => ({ + ScimSection: () =>
, +})) + // Surface the real Save/Update action so submit paths are reachable from tests. vi.mock('@/components/settings/save-discard-actions', () => ({ saveDiscardActions: ({ saveLabel, onSave }: { saveLabel?: string; onSave?: () => void }) => [ From 61a1cad3d28c0c108d9d2fcb3a8d6ecd7ec94e70 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 15:02:25 -0700 Subject: [PATCH 17/31] fix(scim): address cubic's second review round - One entitlement gate: the deployment flag is the outer gate everywhere (authentication, admin API, reconcile job, discovery) - Group PATCH: path-less add contributes members; add without a value is refused; filter booleans only for active; formatted name applied after its parts - Projection: mappings to workspaces that left the organization are ignored and their provenance dropped without touching the other tenant - Update refuses a stale row for someone who left; deprovision serializes on the user locks and scopes account-wide effects to a real removal - Auto-map drops the stale automatic mapping on rename; mapping upserts are conflict-safe and refuse the default group; connection settings merge under the row lock - Relinking keeps email verification when the address is unchanged; addresses are syntax-checked; failed provisioning cleans up through the account-deletion path; inactive provisioning invalidates caches - Reconcile watermark advances only on a completed pass - Wrapped orchestration errors keep their SCIM status; revoke audit names the connection; group members show their display name - UI: error state on the settings read, activity polls; SCIM reachable for admins who did not configure SSO; docs wording on keys and cookies Co-Authored-By: Claude Fable 5.1 --- .../content/docs/platform/enterprise/scim.mdx | 6 +- .../api/workspaces/invitations/batch/route.ts | 12 +-- apps/sim/ee/scim/components/scim-section.tsx | 24 ++++- apps/sim/ee/scim/hooks/scim.ts | 4 +- apps/sim/ee/sso/components/sso-settings.tsx | 9 +- .../lib/api/contracts/organization-scim.ts | 2 +- apps/sim/lib/api/server/routes/scim-route.ts | 3 + .../lib/scim/application/admin/connection.ts | 93 ++++++++++--------- .../lib/scim/application/admin/credentials.ts | 10 +- .../lib/scim/application/admin/mappings.ts | 81 ++++++++++------ .../authorized-scim-admin-use-case.ts | 5 +- .../application/users/deprovision-user.ts | 37 ++++++-- .../scim/application/users/provision-user.ts | 30 +++--- .../lib/scim/application/users/update-user.ts | 16 +++- apps/sim/lib/scim/authenticate.test.ts | 6 +- apps/sim/lib/scim/authenticate.ts | 5 +- apps/sim/lib/scim/entitlement.ts | 16 ++++ .../sim/lib/scim/identity/account-identity.ts | 11 ++- apps/sim/lib/scim/identity/resolve-user.ts | 6 +- apps/sim/lib/scim/projection/auto-map.ts | 39 ++++++-- .../sim/lib/scim/projection/reconcile-user.ts | 61 +++++++----- apps/sim/lib/scim/protocol/errors.ts | 17 ++-- apps/sim/lib/scim/protocol/filter.ts | 6 +- .../sim/lib/scim/protocol/group-patch.test.ts | 12 +++ apps/sim/lib/scim/protocol/group-patch.ts | 7 +- apps/sim/lib/scim/protocol/user-patch.ts | 13 ++- apps/sim/lib/scim/reconcile/job.ts | 48 ++++++---- apps/sim/lib/scim/repository/groups.ts | 9 +- 28 files changed, 394 insertions(+), 194 deletions(-) create mode 100644 apps/sim/lib/scim/entitlement.ts diff --git a/apps/docs/content/docs/platform/enterprise/scim.mdx b/apps/docs/content/docs/platform/enterprise/scim.mdx index 81ea8914ab4..a37f012e1e7 100644 --- a/apps/docs/content/docs/platform/enterprise/scim.mdx +++ b/apps/docs/content/docs/platform/enterprise/scim.mdx @@ -22,7 +22,7 @@ It pairs with [SSO](/platform/enterprise/sso). SSO proves who someone is when th | --- | --- | | Assigns a person to the Sim app | Creates their account and adds them to your organization as a Member | | Updates their name or email | Updates the Sim account, and ends their sessions if the address changed | -| Deactivates them | Blocks sign-in and stops their API keys. Everything they own, and every grant they hold, is left untouched | +| Deactivates them | Blocks sign-in and stops their personal API keys. Everything they own, and every grant they hold, is left untouched; shared workspace keys keep working | | Reactivates them | Restores access exactly as it was | | Removes them from the app | Removes their organization membership and reassigns what they owned | | Adds them to a group | Grants whatever that group maps to | @@ -156,7 +156,7 @@ Sim also re-applies every group mapping on a schedule, so drift cannot persist. { failed.push({ email: error.email ?? normalizedEmail, error: error.message }) continue } + /** A directory-managed address is refused with its reason, like any other per-email refusal. */ + if (error instanceof ForbiddenOperationError) { + failed.push({ email: normalizedEmail, error: error.message }) + continue + } /** * One bad address must not discard the invitations that already diff --git a/apps/sim/ee/scim/components/scim-section.tsx b/apps/sim/ee/scim/components/scim-section.tsx index 30907bdc26c..42312336ef2 100644 --- a/apps/sim/ee/scim/components/scim-section.tsx +++ b/apps/sim/ee/scim/components/scim-section.tsx @@ -26,7 +26,10 @@ import type { } from '@/lib/api/contracts/organization-scim' import { useDeploymentShape } from '@/lib/core/config/deployment-shape' import { RowActionsMenu } from '@/app/workspace/[workspaceId]/settings/components/row-actions-menu' -import { SettingsEmptyState } from '@/app/workspace/[workspaceId]/settings/components/settings-empty-state' +import { + SettingsEmptyState, + SettingsQueryErrorState, +} from '@/app/workspace/[workspaceId]/settings/components/settings-empty-state' import { SettingsResourceRow } from '@/app/workspace/[workspaceId]/settings/components/settings-resource-row' import { SettingsSection } from '@/app/workspace/[workspaceId]/settings/components/settings-section/settings-section' import { @@ -523,11 +526,28 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp */ export function ScimSection({ organizationId }: ScimSectionProps) { const { features } = useDeploymentShape() - const { data, isLoading } = useScimConnection(organizationId, features.scim) + const { data, isLoading, isError, error, isFetching, refetch } = useScimConnection( + organizationId, + features.scim + ) const configure = useConfigureScimConnection() if (!features.scim) return null + if (isError) { + return ( + + void refetch()} + variant='inline' + /> + + ) + } + const connection = data?.connection ?? null const enabled = connection?.status === 'active' diff --git a/apps/sim/ee/scim/hooks/scim.ts b/apps/sim/ee/scim/hooks/scim.ts index 6de69554b41..2f3ef2a8a8b 100644 --- a/apps/sim/ee/scim/hooks/scim.ts +++ b/apps/sim/ee/scim/hooks/scim.ts @@ -16,8 +16,9 @@ import { export const SCIM_CONNECTION_STALE_TIME = 30 * 1000 export const SCIM_MAPPINGS_STALE_TIME = 30 * 1000 -/** Activity is a debugging surface; a short window keeps it close to live. */ +/** Activity is a debugging surface; it polls while mounted so a sync in progress shows up without a reload. */ export const SCIM_ACTIVITY_STALE_TIME = 10 * 1000 +export const SCIM_ACTIVITY_REFETCH_INTERVAL = 15 * 1000 export const scimKeys = { all: ['scim'] as const, @@ -69,6 +70,7 @@ export function useScimActivity(organizationId?: string, enabled = true) { }, enabled: Boolean(organizationId) && enabled, staleTime: SCIM_ACTIVITY_STALE_TIME, + refetchInterval: SCIM_ACTIVITY_REFETCH_INTERVAL, }) } diff --git a/apps/sim/ee/sso/components/sso-settings.tsx b/apps/sim/ee/sso/components/sso-settings.tsx index 551ebaea63b..b75f5c2a0eb 100644 --- a/apps/sim/ee/sso/components/sso-settings.tsx +++ b/apps/sim/ee/sso/components/sso-settings.tsx @@ -327,9 +327,12 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) { } else { if (!isLoadingProviders && isSSOProviderOwner === false && providers.length > 0) { return ( - - Only the user who configured SSO can manage these settings. - + <> + + Only the user who configured SSO can manage these settings. + + + ) } } diff --git a/apps/sim/lib/api/contracts/organization-scim.ts b/apps/sim/lib/api/contracts/organization-scim.ts index df8eaf55ec8..13bb924461c 100644 --- a/apps/sim/lib/api/contracts/organization-scim.ts +++ b/apps/sim/lib/api/contracts/organization-scim.ts @@ -65,7 +65,7 @@ export const configureScimConnectionContract = defineRouteContract({ body: z.object({ status: z.enum(['active', 'disabled']).optional(), settings: scimConnectionSettingsSchema.optional(), - ssoProviderId: z.string().max(128).nullable().optional(), + ssoProviderId: z.string().min(1).max(128).nullable().optional(), }), response: { mode: 'json', schema: z.object({ connection: scimConnectionSchema }) }, }) diff --git a/apps/sim/lib/api/server/routes/scim-route.ts b/apps/sim/lib/api/server/routes/scim-route.ts index 4d00dca2ab9..aafed9cda40 100644 --- a/apps/sim/lib/api/server/routes/scim-route.ts +++ b/apps/sim/lib/api/server/routes/scim-route.ts @@ -4,6 +4,7 @@ import { type NextRequest, NextResponse } from 'next/server' import type { AnyApiRouteContract, ContractJsonResponse } from '@/lib/api/contracts/types' import { type ParsedRequest, parseRequest } from '@/lib/api/server/validation' import type { ApplicationOperation, OperationUseCase } from '@/lib/core/application/operation' +import { isScimEnabled } from '@/lib/core/config/env-flags' import { enforceIpRateLimit, RateLimiter } from '@/lib/core/rate-limiter' import { getBaseUrl } from '@/lib/core/utils/urls' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' @@ -294,6 +295,8 @@ export function defineScimDiscoveryRoute( return withRouteHandler( async (request, context) => { try { + /** A deployment without the feature exposes no provisioning surface, discovery included. */ + if (!isScimEnabled) throw new ScimError(404, undefined, 'Not found') if (request.method !== 'GET') { throw new ScimError(405, undefined, `${request.method} is not supported here`) } diff --git a/apps/sim/lib/scim/application/admin/connection.ts b/apps/sim/lib/scim/application/admin/connection.ts index 4fdaad89fa9..e2b17d60841 100644 --- a/apps/sim/lib/scim/application/admin/connection.ts +++ b/apps/sim/lib/scim/application/admin/connection.ts @@ -73,55 +73,64 @@ export const configureScimConnection = defineAuthorizedScimAdminUseCase({ await assertWorkspaceInOrganization(context.organizationId, grant.workspaceId) } - const [existing] = await db - .select({ - id: scimConnection.id, - settings: scimConnection.settings, - status: scimConnection.status, - }) - .from(scimConnection) - .where(eq(scimConnection.organizationId, context.organizationId)) - .limit(1) - - const nextSettings: ScimConnectionSettings = { - /** - * Locking manual membership defaults on for a new connection. Once a - * directory owns membership, a change made only in Sim is reverted by the - * next sync, so a member edited by hand looks like it worked and then - * silently does not. - */ - lockManualMembership: true, - ...(existing?.settings ?? {}), - ...(input.settings ?? {}), - } + /** + * Read, merge, and write under the row lock, so two administrators changing + * different settings at once both land instead of the later write carrying + * a stale copy of the earlier one's field. + */ + const { created, status } = await db.transaction(async (tx) => { + const [existing] = await tx + .select({ + id: scimConnection.id, + settings: scimConnection.settings, + status: scimConnection.status, + }) + .from(scimConnection) + .where(eq(scimConnection.organizationId, context.organizationId)) + .limit(1) + .for('update') - const connectionId = existing?.id ?? generateId() - const nextStatus = input.status ?? existing?.status ?? 'active' + const nextSettings: ScimConnectionSettings = { + /** + * Locking manual membership defaults on for a new connection. Once a + * directory owns membership, a change made only in Sim is reverted by + * the next sync, so a member edited by hand looks like it worked and + * then silently does not. + */ + lockManualMembership: true, + ...(existing?.settings ?? {}), + ...(input.settings ?? {}), + } + const nextStatus = input.status ?? existing?.status ?? 'active' - if (existing) { - await db - .update(scimConnection) - .set({ + if (existing) { + await tx + .update(scimConnection) + .set({ + status: nextStatus, + settings: nextSettings, + ...(input.ssoProviderId !== undefined ? { ssoProviderId: input.ssoProviderId } : {}), + updatedAt: new Date(), + }) + .where(eq(scimConnection.id, existing.id)) + } else { + await tx.insert(scimConnection).values({ + id: generateId(), + organizationId: context.organizationId, + ssoProviderId: input.ssoProviderId ?? null, status: nextStatus, settings: nextSettings, - ...(input.ssoProviderId !== undefined ? { ssoProviderId: input.ssoProviderId } : {}), - updatedAt: new Date(), + createdBy: context.actorUserId, }) - .where(eq(scimConnection.id, existing.id)) - } else { - await db.insert(scimConnection).values({ - id: connectionId, - organizationId: context.organizationId, - ssoProviderId: input.ssoProviderId ?? null, - status: nextStatus, - settings: nextSettings, - createdBy: context.actorUserId, - }) - } + } + return { created: !existing, status: nextStatus } + }) const view = await loadConnectionView(context.organizationId) - if (!view) throw new OrchestrationError('internal', 'The connection could not be read back') - return { connection: view, created: !existing } + if (!view || view.status !== status) { + throw new OrchestrationError('internal', 'The connection could not be read back') + } + return { connection: view, created } }, projectAudit: ({ result }) => ({ action: diff --git a/apps/sim/lib/scim/application/admin/credentials.ts b/apps/sim/lib/scim/application/admin/credentials.ts index 2849fca68bc..783f35edf56 100644 --- a/apps/sim/lib/scim/application/admin/credentials.ts +++ b/apps/sim/lib/scim/application/admin/credentials.ts @@ -111,7 +111,11 @@ export const revokeScimCredential = defineAuthorizedScimAdminUseCase({ )` ) ) - .returning({ id: scimCredential.id, tokenPrefix: scimCredential.tokenPrefix }) + .returning({ + id: scimCredential.id, + tokenPrefix: scimCredential.tokenPrefix, + connectionId: scimCredential.connectionId, + }) if (!revoked) throw new OrchestrationError('not_found', 'Credential not found') return { success: true as const, revoked } @@ -119,7 +123,7 @@ export const revokeScimCredential = defineAuthorizedScimAdminUseCase({ projectAudit: ({ result }) => ({ action: AuditAction.SCIM_CREDENTIAL_REVOKED, resourceType: AuditResourceType.SCIM_CONNECTION, - resourceId: result.revoked.id, - metadata: { tokenPrefix: result.revoked.tokenPrefix }, + resourceId: result.revoked.connectionId, + metadata: { credentialId: result.revoked.id, tokenPrefix: result.revoked.tokenPrefix }, }), }) diff --git a/apps/sim/lib/scim/application/admin/mappings.ts b/apps/sim/lib/scim/application/admin/mappings.ts index cbdc5e8a374..5dec7c0aaaf 100644 --- a/apps/sim/lib/scim/application/admin/mappings.ts +++ b/apps/sim/lib/scim/application/admin/mappings.ts @@ -12,6 +12,7 @@ import { generateId } from '@sim/utils/id' import { and, count, eq, sql } from 'drizzle-orm' import type { ScimGroupMappingView } from '@/lib/api/contracts/organization-scim' import { OrchestrationError } from '@/lib/core/orchestration/types' +import type { DbOrTx } from '@/lib/db/types' import { assertWorkspaceInOrganization, requireConnection, @@ -143,9 +144,17 @@ async function requireGroup(connectionId: string, groupId: string) { return group } -async function assertPermissionGroupTarget(organizationId: string, permissionGroupId: string) { - const [target] = await db - .select({ id: permissionGroup.id, membershipMode: permissionGroup.membershipMode }) +async function assertPermissionGroupTarget( + tx: DbOrTx, + organizationId: string, + permissionGroupId: string +) { + const [target] = await tx + .select({ + id: permissionGroup.id, + membershipMode: permissionGroup.membershipMode, + isDefault: permissionGroup.isDefault, + }) .from(permissionGroup) .where( and( @@ -160,13 +169,20 @@ async function assertPermissionGroupTarget(organizationId: string, permissionGro 'That permission group does not belong to this organization' ) } + /** The default group governs by not having members; a membership mapping onto it would do nothing. */ + if (target.isDefault) { + throw new OrchestrationError( + 'validation', + 'The organization default permission group cannot be a mapping target' + ) + } /** * A directory-managed group must govern exactly its members. Left in * `inherit` mode, the directory removing the last person would widen it * from "these people" to "everyone in these workspaces". */ if (target.membershipMode !== 'explicit') { - await db + await tx .update(permissionGroup) .set({ membershipMode: 'explicit', updatedAt: new Date() }) .where(eq(permissionGroup.id, target.id)) @@ -189,10 +205,7 @@ export const upsertScimGroupMapping = defineAuthorizedScimAdminUseCase({ async execute({ input, context }: ScimAdminUseCaseArgs) { const connection = await requireConnection(context.organizationId) const group = await requireGroup(connection.id, input.groupId) - - if (input.targetKind === 'permission_group') { - await assertPermissionGroupTarget(context.organizationId, input.permissionGroupId) - } else if (input.targetKind === 'workspace') { + if (input.targetKind === 'workspace') { await assertWorkspaceInOrganization(context.organizationId, input.workspaceId) } @@ -208,31 +221,39 @@ export const upsertScimGroupMapping = defineAuthorizedScimAdminUseCase({ } /** - * Selected, then inserted or updated, rather than an upsert. The uniqueness - * index is on a `coalesce` of the three target columns, which is an - * expression rather than a column list and so cannot be named as a conflict - * target. + * The target check, the insert, and the fallback update commit together, so + * a refused insert cannot leave a permission group switched to explicit + * mode with no mapping. The uniqueness index is on a `coalesce` of the three + * target columns — an expression, not a column list — so it cannot be named + * as a conflict target; a concurrent insert of the same pair loses on the + * index and the row that won is updated instead. */ const targetId = values.permissionGroupId ?? values.workspaceId ?? values.role - const [existingMapping] = await db - .select({ id: scimGroupMapping.id }) - .from(scimGroupMapping) - .where( - and( - eq(scimGroupMapping.groupId, group.id), - eq(scimGroupMapping.targetKind, input.targetKind), - sql`coalesce(${scimGroupMapping.permissionGroupId}, ${scimGroupMapping.workspaceId}, ${scimGroupMapping.role}) = ${targetId}` - ) - ) - .limit(1) + const mapping = await db.transaction(async (tx) => { + if (input.targetKind === 'permission_group') { + await assertPermissionGroupTarget(tx, context.organizationId, input.permissionGroupId) + } + const [inserted] = await tx + .insert(scimGroupMapping) + .values(values) + .onConflictDoNothing() + .returning(MAPPING_COLUMNS) + if (inserted) return inserted - const [mapping] = existingMapping - ? await db - .update(scimGroupMapping) - .set({ permissionType: values.permissionType }) - .where(eq(scimGroupMapping.id, existingMapping.id)) - .returning(MAPPING_COLUMNS) - : await db.insert(scimGroupMapping).values(values).returning(MAPPING_COLUMNS) + const [updated] = await tx + .update(scimGroupMapping) + .set({ permissionType: values.permissionType }) + .where( + and( + eq(scimGroupMapping.groupId, group.id), + eq(scimGroupMapping.targetKind, input.targetKind), + sql`coalesce(${scimGroupMapping.permissionGroupId}, ${scimGroupMapping.workspaceId}, ${scimGroupMapping.role}) = ${targetId}` + ) + ) + .returning(MAPPING_COLUMNS) + if (!updated) throw new OrchestrationError('internal', 'The mapping could not be written') + return updated + }) const reconciledUsers = await reconcileGroupMembers({ connectionId: connection.id, diff --git a/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts b/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts index 757324a0bbe..853d8272bc3 100644 --- a/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts +++ b/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts @@ -3,11 +3,10 @@ import type { Principal } from '@sim/auth/principal' import { db } from '@sim/db' import { member } from '@sim/db/schema' import { and, eq } from 'drizzle-orm' -import { isOrganizationFeatureEntitled } from '@/lib/billing/core/subscription' import { ForbiddenOperationError, type OperationUseCase } from '@/lib/core/application' -import { isScimEnabled } from '@/lib/core/config/env-flags' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' import type { ScimAdminOperation, ScimAdminPrincipal } from '@/lib/scim/application/operations' +import { isScimEntitledForOrganization } from '@/lib/scim/entitlement' /** * The authorized wrapper for administering a connection from the settings UI. @@ -97,7 +96,7 @@ export function defineAuthorizedScimAdminUseCase< 'Organization admin or owner role required' ) } - if (!(await isOrganizationFeatureEntitled(input.organizationId, isScimEnabled))) { + if (!(await isScimEntitledForOrganization(input.organizationId))) { throw new ForbiddenOperationError( 'ENTERPRISE_PLAN_REQUIRED', 'Directory provisioning requires an active enterprise subscription' diff --git a/apps/sim/lib/scim/application/users/deprovision-user.ts b/apps/sim/lib/scim/application/users/deprovision-user.ts index 1207684c65a..ff1d18c22e0 100644 --- a/apps/sim/lib/scim/application/users/deprovision-user.ts +++ b/apps/sim/lib/scim/application/users/deprovision-user.ts @@ -3,7 +3,10 @@ import { db } from '@sim/db' import { member } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { and, eq } from 'drizzle-orm' -import { removeUserFromOrganization } from '@/lib/billing/organizations/membership' +import { + acquireOrganizationUserMutationLocks, + removeUserFromOrganization, +} from '@/lib/billing/organizations/membership' import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' import { invalidateAfterSessionRevocation, @@ -90,13 +93,25 @@ export const deprovisionScimUser = defineAuthorizedScimUseCase({ } await db.transaction(async (tx) => { - await revokeUserSessionsTx(tx, { + /** Serializes with a concurrent PATCH, which re-reads the row under the same locks. */ + await acquireOrganizationUserMutationLocks(tx, { userId: current.userId, - organizationId: context.organizationId, + organizationIds: [context.organizationId], }) - await revokePersonalApiKeysTx(tx, { userId: current.userId }) - /** A suspension the directory applied has no meaning once membership ends. */ - await unsuspendMemberTx(tx, { userId: current.userId, source: 'scim' }) + /** + * Account-wide effects belong only to the removal this request performed. + * A stale row for someone who already left — and may since have joined + * another organization — must not sign them out or revoke their keys there. + */ + if (membership) { + await revokeUserSessionsTx(tx, { + userId: current.userId, + organizationId: context.organizationId, + }) + await revokePersonalApiKeysTx(tx, { userId: current.userId }) + /** A suspension the directory applied has no meaning once membership ends. */ + await unsuspendMemberTx(tx, { userId: current.userId, source: 'scim' }) + } if (current.externalId) { await upsertTombstone(tx, { @@ -136,10 +151,12 @@ export const deprovisionScimUser = defineAuthorizedScimUseCase({ ], afterSuccess: async ({ result, context }) => { - invalidateAfterSessionRevocation({ - userId: result.userId, - organizationId: context.organizationId, - }) + if (result.removedFromOrganization) { + invalidateAfterSessionRevocation({ + userId: result.userId, + organizationId: context.organizationId, + }) + } try { await reconcileOrganizationSeats({ organizationId: context.organizationId, diff --git a/apps/sim/lib/scim/application/users/provision-user.ts b/apps/sim/lib/scim/application/users/provision-user.ts index 0da55002f08..8c5107bf90f 100644 --- a/apps/sim/lib/scim/application/users/provision-user.ts +++ b/apps/sim/lib/scim/application/users/provision-user.ts @@ -1,6 +1,6 @@ import { AuditAction, AuditResourceType } from '@sim/audit' import { db } from '@sim/db' -import { type ScimUserAttributes, subscription, user } from '@sim/db/schema' +import { type ScimUserAttributes, subscription } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { APIError } from 'better-auth/api' import { and, desc, eq, inArray } from 'drizzle-orm' @@ -15,7 +15,10 @@ import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' import { isTeam } from '@/lib/billing/plan-helpers' import { ENTITLED_SUBSCRIPTION_STATUSES } from '@/lib/billing/subscriptions/utils' import type { DbOrTx } from '@/lib/db/types' -import { suspendMemberTx } from '@/lib/organizations/members/lifecycle' +import { + invalidateAfterSessionRevocation, + suspendMemberTx, +} from '@/lib/organizations/members/lifecycle' import { captureServerEvent } from '@/lib/posthog/server' import { defineAuthorizedScimUseCase, @@ -40,6 +43,7 @@ import { insertScimUser, toUserResourceRow, } from '@/lib/scim/repository/users' +import { deleteUserAccount } from '@/lib/users/account-deletion' const logger = createLogger('ScimProvisionUser') @@ -251,15 +255,12 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ * directory's retry starts from a clean slate instead of a half-state. */ if (createdAccount) { - await db - .delete(user) - .where(eq(user.id, userId)) - .catch((cleanupError) => - logger.error('Failed to remove an account after provisioning was refused', { - userId, - cleanupError, - }) - ) + await deleteUserAccount(userId).catch((cleanupError) => + logger.error('Failed to remove an account after provisioning was refused', { + userId, + cleanupError, + }) + ) } throw error } @@ -305,6 +306,13 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ * that is already committed and already correct. */ afterSuccess: async ({ result, context }) => { + /** A member provisioned already inactive had their sessions revoked inside the transaction. */ + if (!result.resource.active) { + invalidateAfterSessionRevocation({ + userId: result.userId, + organizationId: context.organizationId, + }) + } try { await applySessionPolicyToNewMember(result.userId, context.organizationId) } catch (error) { diff --git a/apps/sim/lib/scim/application/users/update-user.ts b/apps/sim/lib/scim/application/users/update-user.ts index 20cd7568bd5..5bc6e3f02df 100644 --- a/apps/sim/lib/scim/application/users/update-user.ts +++ b/apps/sim/lib/scim/application/users/update-user.ts @@ -1,7 +1,8 @@ import { AuditAction, AuditResourceType } from '@sim/audit' import { db } from '@sim/db' -import type { ScimUserAttributes } from '@sim/db/schema' +import { member, type ScimUserAttributes } from '@sim/db/schema' import { normalizeEmail } from '@sim/utils/string' +import { and, eq } from 'drizzle-orm' import type { ScimPatchOperation } from '@/lib/api/contracts/scim' import { acquireOrganizationUserMutationLocks } from '@/lib/billing/organizations/membership' import type { DbOrTx } from '@/lib/db/types' @@ -147,6 +148,19 @@ async function loadUserForUpdate( }) const current = await findScimUserById(tx, context.connection.id, scimUserId) if (!current) throw notFound('SCIM User not found') + /** + * A row can outlive the membership it describes when someone is removed by + * hand. Writing to that account would reach into whichever organization the + * person joined next, so the resource is reported gone instead. + */ + const [membership] = await tx + .select({ id: member.id }) + .from(member) + .where( + and(eq(member.organizationId, context.organizationId), eq(member.userId, current.userId)) + ) + .limit(1) + if (!membership) throw notFound('SCIM User not found') return current } diff --git a/apps/sim/lib/scim/authenticate.test.ts b/apps/sim/lib/scim/authenticate.test.ts index 3ee9a995338..0e40c8bcc30 100644 --- a/apps/sim/lib/scim/authenticate.test.ts +++ b/apps/sim/lib/scim/authenticate.test.ts @@ -9,8 +9,8 @@ import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' const { mockIsEntitled } = vi.hoisted(() => ({ mockIsEntitled: vi.fn() })) -vi.mock('@/lib/billing/core/subscription', () => ({ - isOrganizationFeatureEntitled: mockIsEntitled, +vi.mock('@/lib/scim/entitlement', () => ({ + isScimEntitledForOrganization: mockIsEntitled, })) import { authenticateScimRequest, generateScimToken } from '@/lib/scim/authenticate' @@ -108,7 +108,7 @@ describe('authenticateScimRequest', () => { queueTableRows(scimCredential, [credentialRow()]) mockIsEntitled.mockResolvedValue(false) await expectUnauthorized(requestWithToken('sim_scim_secret')) - expect(mockIsEntitled).toHaveBeenCalledWith('org-1', expect.anything()) + expect(mockIsEntitled).toHaveBeenCalledWith('org-1') }) it('accepts a credential that expires in the future', async () => { diff --git a/apps/sim/lib/scim/authenticate.ts b/apps/sim/lib/scim/authenticate.ts index 2e306f1846a..efd77bc6f9d 100644 --- a/apps/sim/lib/scim/authenticate.ts +++ b/apps/sim/lib/scim/authenticate.ts @@ -6,8 +6,7 @@ import { createLogger } from '@sim/logger' import { generateShortId } from '@sim/utils/id' import { and, eq, isNull, or, sql } from 'drizzle-orm' import type { NextRequest } from 'next/server' -import { isOrganizationFeatureEntitled } from '@/lib/billing/core/subscription' -import { isScimEnabled } from '@/lib/core/config/env-flags' +import { isScimEntitledForOrganization } from '@/lib/scim/entitlement' import { ScimError } from '@/lib/scim/protocol/errors' const logger = createLogger('ScimAuthenticate') @@ -128,7 +127,7 @@ export async function authenticateScimRequest( * created. An organization that lapses stops accepting directory writes rather * than continuing to provision members it is no longer paying for. */ - if (!(await isOrganizationFeatureEntitled(row.organizationId, isScimEnabled))) { + if (!(await isScimEntitledForOrganization(row.organizationId))) { throw unauthorized() } diff --git a/apps/sim/lib/scim/entitlement.ts b/apps/sim/lib/scim/entitlement.ts new file mode 100644 index 00000000000..1b56c041e00 --- /dev/null +++ b/apps/sim/lib/scim/entitlement.ts @@ -0,0 +1,16 @@ +import { isOrganizationFeatureEntitled } from '@/lib/billing/core/subscription' +import { isScimEnabled } from '@/lib/core/config/env-flags' + +/** + * Whether directory provisioning may run for an organization. + * + * The deployment flag is the outer gate on every deployment: hosted or not, a + * deployment that has not turned the feature on serves no SCIM surface, and an + * enterprise subscription cannot override that. Inside the gate, hosted + * deployments require the enterprise plan and self-hosted ones are entitled by + * the flag alone. + */ +export async function isScimEntitledForOrganization(organizationId: string): Promise { + if (!isScimEnabled) return false + return isOrganizationFeatureEntitled(organizationId, true) +} diff --git a/apps/sim/lib/scim/identity/account-identity.ts b/apps/sim/lib/scim/identity/account-identity.ts index 7377e079a16..3b80c191a6b 100644 --- a/apps/sim/lib/scim/identity/account-identity.ts +++ b/apps/sim/lib/scim/identity/account-identity.ts @@ -16,14 +16,21 @@ export async function syncAccountIdentityTx( tx: DbOrTx, params: { userId: string; email?: string; name: string } ): Promise { + let emailChanged = false if (params.email !== undefined) { - await assertEmailAvailable(tx, params.email, params.userId) + const [current] = await tx + .select({ email: user.email }) + .from(user) + .where(eq(user.id, params.userId)) + .limit(1) + emailChanged = normalizeEmail(current?.email ?? '') !== normalizeEmail(params.email) + if (emailChanged) await assertEmailAvailable(tx, params.email, params.userId) } await tx .update(user) .set({ name: params.name, - ...(params.email !== undefined + ...(params.email !== undefined && emailChanged ? { email: params.email, normalizedEmail: normalizeEmail(params.email), diff --git a/apps/sim/lib/scim/identity/resolve-user.ts b/apps/sim/lib/scim/identity/resolve-user.ts index 515bb4b0b5d..9f4e372d741 100644 --- a/apps/sim/lib/scim/identity/resolve-user.ts +++ b/apps/sim/lib/scim/identity/resolve-user.ts @@ -1,7 +1,7 @@ import { member, type ScimUserAttributes, scimUserTombstone, ssoDomain, user } from '@sim/db/schema' import { generateId } from '@sim/utils/id' import { normalizeSSODomain } from '@sim/utils/sso-domain' -import { normalizeEmail } from '@sim/utils/string' +import { isValidEmailSyntax, normalizeEmail } from '@sim/utils/string' import { and, eq, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' import { primaryEmail } from '@/lib/scim/protocol/canonical' @@ -50,7 +50,9 @@ export async function assertDomainOwned( email: string ): Promise { const domain = normalizeSSODomain(email) - if (!domain) throw invalidValue(`${email} is not a usable email address`) + if (!domain || !isValidEmailSyntax(email)) { + throw invalidValue(`${email} is not a usable email address`) + } const verified = await listVerifiedDomains(tx, organizationId) /** * `invalidValue` rather than `uniqueness`. Nothing is duplicated here; the diff --git a/apps/sim/lib/scim/projection/auto-map.ts b/apps/sim/lib/scim/projection/auto-map.ts index 930f8622dd8..c8b9b56484c 100644 --- a/apps/sim/lib/scim/projection/auto-map.ts +++ b/apps/sim/lib/scim/projection/auto-map.ts @@ -1,6 +1,6 @@ import { permissionGroup, scimGroupMapping } from '@sim/db/schema' import { generateId } from '@sim/utils/id' -import { and, eq } from 'drizzle-orm' +import { and, eq, isNull, ne } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' /** @@ -15,6 +15,11 @@ import type { DbOrTx } from '@/lib/db/types' * * The adopted group is moved to explicit membership so the directory removing * its last member narrows it to nobody instead of widening it to everyone. + * + * Automatic mappings are the ones with no author. A rename drops the automatic + * mapping the old name earned, so members do not keep access to a group whose + * name the directory no longer carries; mappings an administrator made by hand + * are theirs and are left alone. */ export async function autoMapPermissionGroupByName( tx: DbOrTx, @@ -31,6 +36,17 @@ export async function autoMapPermissionGroupByName( ) ) .limit(1) + + await tx + .delete(scimGroupMapping) + .where( + and( + eq(scimGroupMapping.groupId, params.scimGroupId), + eq(scimGroupMapping.targetKind, 'permission_group'), + isNull(scimGroupMapping.createdBy), + ...(target ? [ne(scimGroupMapping.permissionGroupId, target.id)] : []) + ) + ) if (!target) return 'no-match' const [existing] = await tx @@ -53,12 +69,17 @@ export async function autoMapPermissionGroupByName( .where(eq(permissionGroup.id, target.id)) } - await tx.insert(scimGroupMapping).values({ - id: generateId(), - groupId: params.scimGroupId, - targetKind: 'permission_group', - permissionGroupId: target.id, - createdBy: null, - }) - return 'mapped' + /** The unique index is the arbiter when an administrator maps the same pair concurrently. */ + const inserted = await tx + .insert(scimGroupMapping) + .values({ + id: generateId(), + groupId: params.scimGroupId, + targetKind: 'permission_group', + permissionGroupId: target.id, + createdBy: null, + }) + .onConflictDoNothing() + .returning({ id: scimGroupMapping.id }) + return inserted.length > 0 ? 'mapped' : 'already-mapped' } diff --git a/apps/sim/lib/scim/projection/reconcile-user.ts b/apps/sim/lib/scim/projection/reconcile-user.ts index ea7f7232485..2418c18cb6a 100644 --- a/apps/sim/lib/scim/projection/reconcile-user.ts +++ b/apps/sim/lib/scim/projection/reconcile-user.ts @@ -11,7 +11,7 @@ import { import { createLogger } from '@sim/logger' import type { PermissionType } from '@sim/platform-authz/workspace' import { generateId } from '@sim/utils/id' -import { and, eq } from 'drizzle-orm' +import { and, eq, inArray } from 'drizzle-orm' import { acquireOrganizationUserMutationLocks } from '@/lib/billing/organizations/membership' import { OrchestrationError } from '@/lib/core/orchestration/types' import type { DbOrTx } from '@/lib/db/types' @@ -107,18 +107,24 @@ async function currentGrants(tx: DbOrTx, scimUserId: string): Promise { - const [row] = await tx +): Promise> { + if (workspaceIds.length === 0) return new Set() + const rows = await tx .select({ id: workspace.id }) .from(workspace) - .where(and(eq(workspace.id, workspaceId), eq(workspace.organizationId, organizationId))) - .limit(1) - return Boolean(row) + .where(and(inArray(workspace.id, workspaceIds), eq(workspace.organizationId, organizationId))) + const owned = new Set(rows.map((row) => row.id)) + return new Set(workspaceIds.filter((id) => !owned.has(id))) } /** Applies one grant. `skipped` means the grant describes nothing this server can apply. */ @@ -136,18 +142,6 @@ async function applyGrant( switch (grant.targetKind) { case 'workspace': { if (!grant.permissionType) return 'skipped' - /** - * A workspace can be moved to another organization after it was mapped. - * The mapping row survives, and following it would hand this - * organization's members access in a tenant the directory does not serve. - */ - if (!(await workspaceBelongsToOrganization(tx, grant.targetId, params.organizationId))) { - logger.warn('Skipped a SCIM mapping whose workspace is no longer in the organization', { - workspaceId: grant.targetId, - organizationId: params.organizationId, - }) - return 'skipped' - } if ( params.previousPermission && permissionRank(params.previousPermission) > permissionRank(grant.permissionType) @@ -229,11 +223,14 @@ async function withdrawGrant( userId: string grant: ProjectionGrant lockManualMembership: boolean + foreignWorkspaceIds: Set } ): Promise { const { grant } = params switch (grant.targetKind) { case 'workspace': { + /** The workspace belongs to another tenant now; its access is theirs to manage. Forget the grant. */ + if (params.foreignWorkspaceIds.has(grant.targetId)) return true /** * A grant raised by hand above what the directory set is left alone. The * directory said "at least write"; someone deliberately made it admin, and @@ -338,11 +335,28 @@ export async function reconcileUserProjection( .limit(1) if (!membership) return EMPTY_DELTA - const desired = resolveDesiredGrants( + const current = await currentGrants(tx, params.scimUserId) + const mapped = resolveDesiredGrants( await loadMappingRows(tx, params.scimUserId), params.settings.defaultWorkspaceGrants ?? [] ) - const plan = planGrantChanges(desired, await currentGrants(tx, params.scimUserId)) + const foreignWorkspaceIds = await findForeignWorkspaces( + tx, + [...mapped, ...current] + .filter((grant) => grant.targetKind === 'workspace') + .map((grant) => grant.targetId), + params.organizationId + ) + if (foreignWorkspaceIds.size > 0) { + logger.warn('Ignoring SCIM workspace mappings whose workspace left the organization', { + connectionId: params.connectionId, + workspaceIds: [...foreignWorkspaceIds], + }) + } + const desired = mapped.filter( + (grant) => grant.targetKind !== 'workspace' || !foreignWorkspaceIds.has(grant.targetId) + ) + const plan = planGrantChanges(desired, current) const delta: ProjectionDelta = { added: [], removed: [], raised: [] } const lockManualMembership = params.settings.lockManualMembership === true @@ -354,6 +368,7 @@ export async function reconcileUserProjection( userId: record.userId, grant, lockManualMembership, + foreignWorkspaceIds, }) if (!withdrawn) continue await tx diff --git a/apps/sim/lib/scim/protocol/errors.ts b/apps/sim/lib/scim/protocol/errors.ts index 22bf45d2421..855d626ef06 100644 --- a/apps/sim/lib/scim/protocol/errors.ts +++ b/apps/sim/lib/scim/protocol/errors.ts @@ -1,4 +1,4 @@ -import { OrchestrationError } from '@/lib/core/orchestration/types' +import { asOrchestrationError } from '@/lib/core/orchestration/types' import { SCIM_ERROR_SCHEMA } from '@/lib/scim/protocol/constants' /** @@ -144,19 +144,20 @@ export function toScimError(error: unknown): ScimError { return new ScimError(409, 'uniqueness', 'A resource with the same identifier already exists') } - if (error instanceof OrchestrationError) { - switch (error.code) { + const orchestration = asOrchestrationError(error) + if (orchestration) { + switch (orchestration.code) { case 'not_found': - return new ScimError(404, undefined, error.message) + return new ScimError(404, undefined, orchestration.message) /** A conflict that is not a duplicate carries no `scimType`; `uniqueness` is reserved for duplicates. */ case 'conflict': - return new ScimError(409, undefined, error.message) + return new ScimError(409, undefined, orchestration.message) case 'forbidden': - return new ScimError(403, undefined, error.message) + return new ScimError(403, undefined, orchestration.message) case 'validation': - return new ScimError(400, 'invalidValue', error.message) + return new ScimError(400, 'invalidValue', orchestration.message) case 'locked': - return new ScimError(503, undefined, error.message, { 'Retry-After': '5' }) + return new ScimError(503, undefined, orchestration.message, { 'Retry-After': '5' }) default: return new ScimError(500, undefined, 'Internal server error') } diff --git a/apps/sim/lib/scim/protocol/filter.ts b/apps/sim/lib/scim/protocol/filter.ts index 240842e33c8..6e6fb34f3c7 100644 --- a/apps/sim/lib/scim/protocol/filter.ts +++ b/apps/sim/lib/scim/protocol/filter.ts @@ -160,8 +160,10 @@ function parseTerm(term: string): { attribute: string; value: string } { } const raw = rawValue.trim() - /** RFC 7644 writes boolean comparisons unquoted: `active eq true`. */ - if (raw === 'true' || raw === 'false') return { attribute, value: raw } + /** RFC 7644 writes boolean comparisons unquoted, and only `active` is boolean here. */ + if (attribute.toLowerCase() === 'active' && (raw === 'true' || raw === 'false')) { + return { attribute, value: raw } + } if (!raw.startsWith('"') || !raw.endsWith('"') || raw.length < 2) { throw invalidFilter('Filter values must be quoted strings') } diff --git a/apps/sim/lib/scim/protocol/group-patch.test.ts b/apps/sim/lib/scim/protocol/group-patch.test.ts index 57ee2d79016..10438318635 100644 --- a/apps/sim/lib/scim/protocol/group-patch.test.ts +++ b/apps/sim/lib/scim/protocol/group-patch.test.ts @@ -28,6 +28,18 @@ describe('parseGroupPatch', () => { ).toEqual({ kind: 'incremental', add: ['u1'], remove: [] }) }) + it('treats a path-less add of members as a delta, not a replacement', () => { + expect(parseGroupPatch([{ op: 'add', value: { members: [{ value: 'u9' }] } }])).toEqual({ + kind: 'full', + addMembers: ['u9'], + removeMembers: [], + }) + }) + + it('refuses an add to members with no value', () => { + expect(() => parseGroupPatch([{ op: 'add', path: 'members' }])).toThrow('requires a value') + }) + it('refuses a non-string externalId instead of clearing it', () => { expect(() => parseGroupPatch([{ op: 'replace', path: 'externalId', value: 42 }])).toThrow( 'externalId must be a string' diff --git a/apps/sim/lib/scim/protocol/group-patch.ts b/apps/sim/lib/scim/protocol/group-patch.ts index dd0fe9595a3..6061d730a20 100644 --- a/apps/sim/lib/scim/protocol/group-patch.ts +++ b/apps/sim/lib/scim/protocol/group-patch.ts @@ -100,7 +100,9 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou } else if (key === 'externalid') { full.externalId = readExternalId(nested) } else if (key === 'members') { - applyFullMembers(readMemberList(nested)) + /** A path-less `add` contributes members; only a `replace` sets the whole list. */ + if (operation.op === 'add') for (const id of readMemberList(nested)) addMember(id) + else applyFullMembers(readMemberList(nested)) } else if (key === 'id' || key === 'schemas' || key.startsWith('meta')) { /** * Okta echoes the group's `id` inside a path-less rename. Read-only @@ -136,6 +138,9 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou applyFullMembers([]) continue } + if (operation.op === 'add' && operation.value === undefined) { + throw invalidValue('An add to members requires a value') + } for (const id of readMemberList(operation.value ?? [])) { if (operation.op === 'add') addMember(id) else removeMember(id) diff --git a/apps/sim/lib/scim/protocol/user-patch.ts b/apps/sim/lib/scim/protocol/user-patch.ts index 393b1e7ba74..64e62a5e9d1 100644 --- a/apps/sim/lib/scim/protocol/user-patch.ts +++ b/apps/sim/lib/scim/protocol/user-patch.ts @@ -286,6 +286,15 @@ export function userAttributesEqual(left: ScimUserAttributes, right: ScimUserAtt return comparisonKey(left) === comparisonKey(right) } +/** + * Orders `name.formatted` after the name parts it would otherwise be derived + * from, so an explicit formatted name wins regardless of JSON property order. + */ +function sortFormattedLast(entries: [string, unknown][]): [string, unknown][] { + const isFormatted = ([key]: [string, unknown]) => key.toLowerCase().endsWith('formatted') + return [...entries.filter((entry) => !isFormatted(entry)), ...entries.filter(isFormatted)] +} + export function applyUserPatch( current: ScimUserAttributes, operations: readonly ScimPatchOperation[] @@ -307,7 +316,7 @@ export function applyUserPatch( * keyed by dotted attribute paths, so each key is dispatched as if it had * arrived as its own operation. */ - for (const [attribute, nested] of Object.entries(value)) { + for (const [attribute, nested] of sortFormattedLast(Object.entries(value))) { /** * RFC 7644's canonical form nests complex attributes — `{"name": {"givenName": …}}` * and the enterprise extension keyed by its URN — so each sub-attribute is @@ -315,7 +324,7 @@ export function applyUserPatch( */ const normalized = normalizeAttributePath(attribute).toLowerCase() if (isRecord(nested) && (normalized === 'name' || normalized === 'enterprise')) { - for (const [sub, subValue] of Object.entries(nested)) { + for (const [sub, subValue] of sortFormattedLast(Object.entries(nested))) { applyOperation(next, operation.op, `${normalized}.${sub}`, subValue) } continue diff --git a/apps/sim/lib/scim/reconcile/job.ts b/apps/sim/lib/scim/reconcile/job.ts index cdac233886e..f0af971a95b 100644 --- a/apps/sim/lib/scim/reconcile/job.ts +++ b/apps/sim/lib/scim/reconcile/job.ts @@ -3,8 +3,7 @@ import { scimConnection } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { and, eq, isNull, lt, or, sql } from 'drizzle-orm' -import { isOrganizationFeatureEntitled } from '@/lib/billing/core/subscription' -import { isScimEnabled } from '@/lib/core/config/env-flags' +import { isScimEntitledForOrganization } from '@/lib/scim/entitlement' import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' import { listScimUserIds } from '@/lib/scim/repository/users' import { pruneScimRequestLog } from '@/lib/scim/request-log' @@ -80,10 +79,19 @@ async function holdsLease(connectionId: string, runId: string): Promise return row?.token === runId } -async function releaseLease(connectionId: string, runId: string): Promise { +/** Releases the lease; the watermark advances only when the pass finished, so a failed batch is retried next hour. */ +async function releaseLease( + connectionId: string, + runId: string, + completed: boolean +): Promise { await db .update(scimConnection) - .set({ reconcileLockToken: null, reconcileLeaseAt: null, reconciledAt: new Date() }) + .set({ + reconcileLockToken: null, + reconcileLeaseAt: null, + ...(completed ? { reconciledAt: new Date() } : {}), + }) .where(and(eq(scimConnection.id, connectionId), eq(scimConnection.reconcileLockToken, runId))) } @@ -122,23 +130,11 @@ export async function reconcileConnection(connection: { * A lapsed organization's credentials are refused at authentication; its * projection must not keep being re-applied by the scheduler either. */ - if (!(await isOrganizationFeatureEntitled(connection.organizationId, isScimEnabled))) return null + if (!(await isScimEntitledForOrganization(connection.organizationId))) return null const runId = generateId() if (!(await acquireLease(connection.id, runId))) return null - /** - * Settings are read after the lease is held, not from the row the due query - * returned: an administrator may have changed them in between, and projecting - * with the old settings would then stamp the connection as reconciled. - */ - const [fresh] = await db - .select({ settings: scimConnection.settings }) - .from(scimConnection) - .where(eq(scimConnection.id, connection.id)) - .limit(1) - const settings = fresh?.settings ?? connection.settings - const report: ScimReconcileReport = { connectionId: connection.id, reconciledUsers: 0, @@ -146,7 +142,20 @@ export async function reconcileConnection(connection: { grantsRemoved: 0, } + let completed = false try { + /** + * Settings are read after the lease is held, not from the row the due query + * returned: an administrator may have changed them in between, and projecting + * with the old settings would then stamp the connection as reconciled. + */ + const [fresh] = await db + .select({ settings: scimConnection.settings }) + .from(scimConnection) + .where(eq(scimConnection.id, connection.id)) + .limit(1) + const settings = fresh?.settings ?? connection.settings + let cursor: string | undefined for (;;) { const page = await listScimUserIds(db, { @@ -159,7 +168,7 @@ export async function reconcileConnection(connection: { logger.warn('Directory reconciliation stopped: the lease was taken over', { connectionId: connection.id, }) - break + return null } await db.transaction(async (tx) => { @@ -178,13 +187,14 @@ export async function reconcileConnection(connection: { cursor = page[page.length - 1].orderKey } + completed = true await pruneScimRequestLog(connection.id) if (report.grantsAdded > 0 || report.grantsRemoved > 0) { logger.warn('Directory reconciliation corrected drift', report) } return report } finally { - await releaseLease(connection.id, runId) + await releaseLease(connection.id, runId, completed) } } diff --git a/apps/sim/lib/scim/repository/groups.ts b/apps/sim/lib/scim/repository/groups.ts index a38bb5fbc10..664c2cf89d6 100644 --- a/apps/sim/lib/scim/repository/groups.ts +++ b/apps/sim/lib/scim/repository/groups.ts @@ -1,6 +1,6 @@ import { scimGroup, scimGroupMember, scimUser } from '@sim/db/schema' import { generateId } from '@sim/utils/id' -import { and, asc, count, eq, inArray, type SQL } from 'drizzle-orm' +import { and, asc, count, eq, inArray, type SQL, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' import { invalidValue } from '@/lib/scim/protocol/errors' import type { ScimFilterTerm, ScimGroupFilterField } from '@/lib/scim/protocol/filter' @@ -8,6 +8,9 @@ import { buildOrderKey } from '@/lib/scim/repository/users' /** Reads and writes of the provisioned Group table, always anchored to a connection. */ +/** What a member is called in a Group response: the same display name the User resource shows. */ +const memberDisplayName = sql`coalesce(${scimUser.attributes} ->> 'displayName', ${scimUser.userName})` + export interface ScimGroupRecord { id: string externalId: string | null @@ -91,7 +94,7 @@ export interface ScimGroupMemberRow { /** Members of one group, ordered so a response is stable between reads. */ export async function loadGroupMembers(tx: DbOrTx, groupId: string): Promise { const rows = await tx - .select({ scimUserId: scimGroupMember.scimUserId, displayName: scimUser.userName }) + .select({ scimUserId: scimGroupMember.scimUserId, displayName: memberDisplayName }) .from(scimGroupMember) .innerJoin(scimUser, eq(scimUser.id, scimGroupMember.scimUserId)) .where(eq(scimGroupMember.groupId, groupId)) @@ -110,7 +113,7 @@ export async function loadGroupMembersForGroups( .select({ groupId: scimGroupMember.groupId, scimUserId: scimGroupMember.scimUserId, - displayName: scimUser.userName, + displayName: memberDisplayName, }) .from(scimGroupMember) .innerJoin(scimUser, eq(scimUser.id, scimGroupMember.scimUserId)) From d6b077b755ab4191d0648c013becfb66ae8a7f92 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 15:13:20 -0700 Subject: [PATCH 18/31] fix(scim): serialize first-time configuration; reconcile members when a rename drops an automatic mapping Co-Authored-By: Claude Fable 5.1 --- apps/sim/lib/scim/application/admin/connection.ts | 10 ++++++---- apps/sim/lib/scim/application/groups/manage-groups.ts | 7 ++++--- apps/sim/lib/scim/projection/auto-map.ts | 8 +++++--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/apps/sim/lib/scim/application/admin/connection.ts b/apps/sim/lib/scim/application/admin/connection.ts index e2b17d60841..a5971228ec2 100644 --- a/apps/sim/lib/scim/application/admin/connection.ts +++ b/apps/sim/lib/scim/application/admin/connection.ts @@ -9,6 +9,7 @@ import { import { generateId } from '@sim/utils/id' import { and, desc, eq } from 'drizzle-orm' import type { ScimConnectionSettingsInput } from '@/lib/api/contracts/organization-scim' +import { acquireOrganizationMutationLock } from '@/lib/billing/organizations/membership' import { OrchestrationError } from '@/lib/core/orchestration/types' import { assertWorkspaceInOrganization, @@ -74,11 +75,13 @@ export const configureScimConnection = defineAuthorizedScimAdminUseCase({ } /** - * Read, merge, and write under the row lock, so two administrators changing - * different settings at once both land instead of the later write carrying - * a stale copy of the earlier one's field. + * Read, merge, and write under the organization lock, so two administrators + * changing different settings at once both land instead of the later write + * carrying a stale copy of the earlier one's field — and two first-time + * enables, where there is no row yet to lock, cannot both insert. */ const { created, status } = await db.transaction(async (tx) => { + await acquireOrganizationMutationLock(tx, context.organizationId) const [existing] = await tx .select({ id: scimConnection.id, @@ -88,7 +91,6 @@ export const configureScimConnection = defineAuthorizedScimAdminUseCase({ .from(scimConnection) .where(eq(scimConnection.organizationId, context.organizationId)) .limit(1) - .for('update') const nextSettings: ScimConnectionSettings = { /** diff --git a/apps/sim/lib/scim/application/groups/manage-groups.ts b/apps/sim/lib/scim/application/groups/manage-groups.ts index a7321f8f2ee..48306586791 100644 --- a/apps/sim/lib/scim/application/groups/manage-groups.ts +++ b/apps/sim/lib/scim/application/groups/manage-groups.ts @@ -267,8 +267,9 @@ export const replaceScimGroup = defineAuthorizedScimUseCase({ scimGroupId: current.id, displayName: input.group.displayName, }) - /** A new mapping applies to everyone already in the group, not only to those moving today. */ - if (mapped === 'mapped') for (const scimUserId of before) touched.add(scimUserId) + /** A mapping gained or lost applies to everyone already in the group, not only to those moving today. */ + if (mapped === 'mapped' || mapped === 'unmapped') + for (const scimUserId of before) touched.add(scimUserId) } for (const scimUserId of before) { @@ -393,7 +394,7 @@ export const patchScimGroup = defineAuthorizedScimUseCase({ scimGroupId: current.id, displayName: patch.displayName, }) - if (mapped === 'mapped') { + if (mapped === 'mapped' || mapped === 'unmapped') { for (const scimUserId of await loadGroupMemberIds(tx, current.id)) { touched.add(scimUserId) } diff --git a/apps/sim/lib/scim/projection/auto-map.ts b/apps/sim/lib/scim/projection/auto-map.ts index c8b9b56484c..7eb9a96b61d 100644 --- a/apps/sim/lib/scim/projection/auto-map.ts +++ b/apps/sim/lib/scim/projection/auto-map.ts @@ -24,7 +24,7 @@ import type { DbOrTx } from '@/lib/db/types' export async function autoMapPermissionGroupByName( tx: DbOrTx, params: { organizationId: string; scimGroupId: string; displayName: string } -): Promise<'mapped' | 'already-mapped' | 'no-match'> { +): Promise<'mapped' | 'already-mapped' | 'unmapped' | 'no-match'> { const [target] = await tx .select({ id: permissionGroup.id, membershipMode: permissionGroup.membershipMode }) .from(permissionGroup) @@ -37,7 +37,7 @@ export async function autoMapPermissionGroupByName( ) .limit(1) - await tx + const removed = await tx .delete(scimGroupMapping) .where( and( @@ -47,7 +47,9 @@ export async function autoMapPermissionGroupByName( ...(target ? [ne(scimGroupMapping.permissionGroupId, target.id)] : []) ) ) - if (!target) return 'no-match' + .returning({ id: scimGroupMapping.id }) + /** `unmapped` tells the caller access changed even though nothing new was mapped. */ + if (!target) return removed.length > 0 ? 'unmapped' : 'no-match' const [existing] = await tx .select({ id: scimGroupMapping.id }) From b2aea8793c9dd4fd47b748b0056c0aa1a3f9ba99 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 15:37:12 -0700 Subject: [PATCH 19/31] fix(scim): mapping provenance column, drop the unused SSO binding, and close the third review round - scim_group_mapping.source ('manual' | 'automatic') carries provenance so a deleted author cannot turn a manual mapping into an automatic one; the unreleased 0323 migration is regenerated from the schema - scim_connection.sso_provider_id removed: nothing read it - Entitlement mirrors SSO access: flag is the outer gate, self-hosted is entitled by the flag, hosted requires the enterprise plan; protected and discovery routes answer 404 when the flag is off - Group PATCH: replace without a value is refused - Deprovision re-checks membership under the lock before account-wide effects; relinking an active identity lifts a lingering suspension; instance-organization deployments refuse a connection for any other org - Lowering a workspace grant that is no longer at the recorded level re-establishes the desired level instead of recording it as applied - Connection audit names the actual transition; update responses render inside the write transaction - Reconcile every hour with settings re-read per batch - UI: error states for groups and activity; default group excluded from the mapping picker Co-Authored-By: Claude Fable 5.1 --- .../app/api/organizations/[id]/scim/route.ts | 1 - apps/sim/ee/scim/components/scim-section.tsx | 44 ++++++++++++++++-- .../lib/api/contracts/organization-scim.ts | 2 - apps/sim/lib/api/server/routes/scim-route.ts | 2 + .../scim/application/admin/connection-view.ts | 1 - .../lib/scim/application/admin/connection.ts | 46 ++++--------------- .../lib/scim/application/admin/mappings.ts | 1 + .../application/users/deprovision-user.ts | 14 +++++- .../scim/application/users/provision-user.ts | 23 ++++++++++ .../lib/scim/application/users/update-user.ts | 36 ++++++--------- apps/sim/lib/scim/entitlement.ts | 16 +++---- apps/sim/lib/scim/projection/auto-map.ts | 12 ++--- .../sim/lib/scim/projection/reconcile-user.ts | 5 +- apps/sim/lib/scim/protocol/filter.ts | 5 +- apps/sim/lib/scim/protocol/group-patch.ts | 6 ++- apps/sim/lib/scim/reconcile/job.ts | 34 +++++++------- .../db/migrations/0323_scim_provisioning.sql | 3 +- .../db/migrations/meta/0323_snapshot.json | 24 ++++------ packages/db/migrations/meta/_journal.json | 2 +- packages/db/schema.ts | 10 ++-- packages/testing/src/mocks/schema.mock.ts | 2 +- 21 files changed, 165 insertions(+), 124 deletions(-) diff --git a/apps/sim/app/api/organizations/[id]/scim/route.ts b/apps/sim/app/api/organizations/[id]/scim/route.ts index 7fe14cbdea9..29c03797f13 100644 --- a/apps/sim/app/api/organizations/[id]/scim/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/route.ts @@ -39,7 +39,6 @@ export const PUT = defineInternalJsonRoute({ organizationId: params.id, ...(body.status !== undefined ? { status: body.status } : {}), ...(body.settings !== undefined ? { settings: body.settings } : {}), - ...(body.ssoProviderId !== undefined ? { ssoProviderId: body.ssoProviderId } : {}), }), useCase: configureScimConnection, present: ({ connection }) => ({ connection }), diff --git a/apps/sim/ee/scim/components/scim-section.tsx b/apps/sim/ee/scim/components/scim-section.tsx index 42312336ef2..5c9b4c8c211 100644 --- a/apps/sim/ee/scim/components/scim-section.tsx +++ b/apps/sim/ee/scim/components/scim-section.tsx @@ -205,8 +205,17 @@ interface GroupMappingsProps { } function GroupMappings({ organizationId }: GroupMappingsProps) { - const { data: groups, isLoading } = useScimGroupMappings(organizationId) - const { data: permissionGroups = [] } = usePermissionGroups(organizationId) + const { + data: groups, + isLoading, + isError, + error, + isFetching, + refetch, + } = useScimGroupMappings(organizationId) + const { data: allPermissionGroups = [] } = usePermissionGroups(organizationId) + /** The default group governs by having no members, so it cannot be a membership target. */ + const permissionGroups = allPermissionGroups.filter((group) => !group.isDefault) const { data: workspaces = [] } = useOrganizationWorkspaces(organizationId) const deleteMapping = useDeleteScimGroupMapping() @@ -227,6 +236,17 @@ function GroupMappings({ organizationId }: GroupMappingsProps) { if (isLoading) { return Loading groups... } + if (isError) { + return ( + void refetch()} + variant='inline' + /> + ) + } if (!groups || groups.length === 0) { return ( @@ -278,11 +298,29 @@ interface ActivityListProps { } function ActivityList({ organizationId }: ActivityListProps) { - const { data: entries, isLoading } = useScimActivity(organizationId) + const { + data: entries, + isLoading, + isError, + error, + isFetching, + refetch, + } = useScimActivity(organizationId) if (isLoading) { return Loading activity... } + if (isError) { + return ( + void refetch()} + variant='inline' + /> + ) + } if (!entries || entries.length === 0) { return No requests yet. } diff --git a/apps/sim/lib/api/contracts/organization-scim.ts b/apps/sim/lib/api/contracts/organization-scim.ts index 13bb924461c..f000e31c67f 100644 --- a/apps/sim/lib/api/contracts/organization-scim.ts +++ b/apps/sim/lib/api/contracts/organization-scim.ts @@ -39,7 +39,6 @@ const scimConnectionSchema = z.object({ status: z.enum(['active', 'disabled']), baseUrl: z.string(), settings: scimConnectionSettingsSchema, - ssoProviderId: z.string().nullable(), lastRequestAt: z.string().nullable(), reconciledAt: z.string().nullable(), createdAt: z.string(), @@ -65,7 +64,6 @@ export const configureScimConnectionContract = defineRouteContract({ body: z.object({ status: z.enum(['active', 'disabled']).optional(), settings: scimConnectionSettingsSchema.optional(), - ssoProviderId: z.string().min(1).max(128).nullable().optional(), }), response: { mode: 'json', schema: z.object({ connection: scimConnectionSchema }) }, }) diff --git a/apps/sim/lib/api/server/routes/scim-route.ts b/apps/sim/lib/api/server/routes/scim-route.ts index aafed9cda40..9bb5ffbff21 100644 --- a/apps/sim/lib/api/server/routes/scim-route.ts +++ b/apps/sim/lib/api/server/routes/scim-route.ts @@ -167,6 +167,8 @@ export function createScimRouteBuilder(dependencies: ScimRouteDependencies) { if (request.method !== options.contract.method) { throw new ScimError(405, undefined, `${request.method} is not supported here`) } + /** A deployment without the feature exposes no provisioning surface at all. */ + if (!isScimEnabled) throw new ScimError(404, undefined, 'Not found') assertAcceptableMediaType(request) /** diff --git a/apps/sim/lib/scim/application/admin/connection-view.ts b/apps/sim/lib/scim/application/admin/connection-view.ts index 0f85254db65..45d1e1b321f 100644 --- a/apps/sim/lib/scim/application/admin/connection-view.ts +++ b/apps/sim/lib/scim/application/admin/connection-view.ts @@ -114,7 +114,6 @@ export async function loadConnectionView( status: row.status === 'disabled' ? 'disabled' : 'active', baseUrl: scimBaseUrl(), settings: row.settings, - ssoProviderId: row.ssoProviderId, lastRequestAt: row.lastRequestAt?.toISOString() ?? null, reconciledAt: row.reconciledAt?.toISOString() ?? null, createdAt: row.createdAt.toISOString(), diff --git a/apps/sim/lib/scim/application/admin/connection.ts b/apps/sim/lib/scim/application/admin/connection.ts index a5971228ec2..cbbb0c2af0d 100644 --- a/apps/sim/lib/scim/application/admin/connection.ts +++ b/apps/sim/lib/scim/application/admin/connection.ts @@ -1,13 +1,8 @@ import { AuditAction, AuditResourceType } from '@sim/audit' import { db } from '@sim/db' -import { - type ScimConnectionSettings, - scimConnection, - scimRequestLog, - ssoProvider, -} from '@sim/db/schema' +import { type ScimConnectionSettings, scimConnection, scimRequestLog } from '@sim/db/schema' import { generateId } from '@sim/utils/id' -import { and, desc, eq } from 'drizzle-orm' +import { desc, eq } from 'drizzle-orm' import type { ScimConnectionSettingsInput } from '@/lib/api/contracts/organization-scim' import { acquireOrganizationMutationLock } from '@/lib/billing/organizations/membership' import { OrchestrationError } from '@/lib/core/orchestration/types' @@ -40,31 +35,11 @@ export interface ConfigureScimConnectionInput { organizationId: string status?: 'active' | 'disabled' settings?: ScimConnectionSettingsInput - ssoProviderId?: string | null } export const configureScimConnection = defineAuthorizedScimAdminUseCase({ operation: scimAdminOperations.configure, async execute({ input, context }: ScimAdminUseCaseArgs) { - if (input.ssoProviderId) { - const [provider] = await db - .select({ id: ssoProvider.id }) - .from(ssoProvider) - .where( - and( - eq(ssoProvider.id, input.ssoProviderId), - eq(ssoProvider.organizationId, context.organizationId) - ) - ) - .limit(1) - if (!provider) { - throw new OrchestrationError( - 'not_found', - 'That SSO provider does not belong to this organization' - ) - } - } - /** * A default grant hands every provisioned member a workspace, so the * workspace must be this organization's — the same check a group mapping @@ -80,7 +55,7 @@ export const configureScimConnection = defineAuthorizedScimAdminUseCase({ * carrying a stale copy of the earlier one's field — and two first-time * enables, where there is no row yet to lock, cannot both insert. */ - const { created, status } = await db.transaction(async (tx) => { + const { created, previousStatus, status } = await db.transaction(async (tx) => { await acquireOrganizationMutationLock(tx, context.organizationId) const [existing] = await tx .select({ @@ -111,7 +86,6 @@ export const configureScimConnection = defineAuthorizedScimAdminUseCase({ .set({ status: nextStatus, settings: nextSettings, - ...(input.ssoProviderId !== undefined ? { ssoProviderId: input.ssoProviderId } : {}), updatedAt: new Date(), }) .where(eq(scimConnection.id, existing.id)) @@ -119,28 +93,28 @@ export const configureScimConnection = defineAuthorizedScimAdminUseCase({ await tx.insert(scimConnection).values({ id: generateId(), organizationId: context.organizationId, - ssoProviderId: input.ssoProviderId ?? null, status: nextStatus, settings: nextSettings, createdBy: context.actorUserId, }) } - return { created: !existing, status: nextStatus } + return { created: !existing, previousStatus: existing?.status ?? null, status: nextStatus } }) const view = await loadConnectionView(context.organizationId) if (!view || view.status !== status) { throw new OrchestrationError('internal', 'The connection could not be read back') } - return { connection: view, created } + return { connection: view, created, previousStatus } }, + /** The action names the transition: enabling (first time or again), disabling, or editing in place. */ projectAudit: ({ result }) => ({ action: - result.connection.status === 'active' - ? result.created + result.connection.status !== result.previousStatus + ? result.connection.status === 'active' ? AuditAction.SCIM_CONNECTION_ENABLED - : AuditAction.SCIM_CONNECTION_SETTINGS_UPDATED - : AuditAction.SCIM_CONNECTION_DISABLED, + : AuditAction.SCIM_CONNECTION_DISABLED + : AuditAction.SCIM_CONNECTION_SETTINGS_UPDATED, resourceType: AuditResourceType.SCIM_CONNECTION, resourceId: result.connection.id, metadata: { status: result.connection.status }, diff --git a/apps/sim/lib/scim/application/admin/mappings.ts b/apps/sim/lib/scim/application/admin/mappings.ts index 5dec7c0aaaf..df6dd65ea46 100644 --- a/apps/sim/lib/scim/application/admin/mappings.ts +++ b/apps/sim/lib/scim/application/admin/mappings.ts @@ -217,6 +217,7 @@ export const upsertScimGroupMapping = defineAuthorizedScimAdminUseCase({ workspaceId: input.targetKind === 'workspace' ? input.workspaceId : null, permissionType: input.targetKind === 'workspace' ? input.permissionType : null, role: input.targetKind === 'org_role' ? input.role : null, + source: 'manual', createdBy: context.actorUserId, } diff --git a/apps/sim/lib/scim/application/users/deprovision-user.ts b/apps/sim/lib/scim/application/users/deprovision-user.ts index ff1d18c22e0..a3fd093b399 100644 --- a/apps/sim/lib/scim/application/users/deprovision-user.ts +++ b/apps/sim/lib/scim/application/users/deprovision-user.ts @@ -103,7 +103,19 @@ export const deprovisionScimUser = defineAuthorizedScimUseCase({ * A stale row for someone who already left — and may since have joined * another organization — must not sign them out or revoke their keys there. */ - if (membership) { + const [rejoined] = membership + ? await tx + .select({ id: member.id }) + .from(member) + .where( + and( + eq(member.organizationId, context.organizationId), + eq(member.userId, current.userId) + ) + ) + .limit(1) + : [] + if (membership && !rejoined) { await revokeUserSessionsTx(tx, { userId: current.userId, organizationId: context.organizationId, diff --git a/apps/sim/lib/scim/application/users/provision-user.ts b/apps/sim/lib/scim/application/users/provision-user.ts index 8c5107bf90f..9186d710f49 100644 --- a/apps/sim/lib/scim/application/users/provision-user.ts +++ b/apps/sim/lib/scim/application/users/provision-user.ts @@ -15,9 +15,14 @@ import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' import { isTeam } from '@/lib/billing/plan-helpers' import { ENTITLED_SUBSCRIPTION_STATUSES } from '@/lib/billing/subscriptions/utils' import type { DbOrTx } from '@/lib/db/types' +import { + getInstanceOrganizationId, + isInstanceOrganizationMode, +} from '@/lib/organizations/instance-org' import { invalidateAfterSessionRevocation, suspendMemberTx, + unsuspendMemberTx, } from '@/lib/organizations/members/lifecycle' import { captureServerEvent } from '@/lib/posthog/server' import { @@ -127,6 +132,22 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ * hang off them. Reimplementing that with a direct insert would skip every * one. */ + /** + * In instance-organization mode every account is placed in the instance + * organization at creation, and an account belongs to one organization. A + * connection for any other organization could never admit anyone. + */ + if (isInstanceOrganizationMode()) { + const instanceOrganizationId = await getInstanceOrganizationId() + if (instanceOrganizationId && instanceOrganizationId !== context.organizationId) { + throw new ScimError( + 409, + undefined, + 'This deployment places every account in its instance organization, so directory provisioning is available only for that organization.' + ) + } + } + const resolution = await resolveProvisionedIdentity(db, { connectionId: context.connection.id, organizationId: context.organizationId, @@ -209,6 +230,8 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ */ if (resolution.action === 'link') { await syncAccountIdentityTx(tx, { userId, email, name: attributes.name.formatted }) + /** A relinked account may still carry the suspension a lost deprovisioning left behind. */ + if (attributes.active) await unsuspendMemberTx(tx, { userId, source: 'scim' }) } const inserted = await insertScimUser(tx, { diff --git a/apps/sim/lib/scim/application/users/update-user.ts b/apps/sim/lib/scim/application/users/update-user.ts index 5bc6e3f02df..ecc09df3abe 100644 --- a/apps/sim/lib/scim/application/users/update-user.ts +++ b/apps/sim/lib/scim/application/users/update-user.ts @@ -164,14 +164,16 @@ async function loadUserForUpdate( return current } +/** Rendered inside the write transaction, so a concurrent delete cannot make a committed update unreadable. */ async function renderUpdated( + tx: DbOrTx, connectionId: string, scimUserId: string, baseUrl: string ): Promise> { - const record = await findScimUserById(db, connectionId, scimUserId) + const record = await findScimUserById(tx, connectionId, scimUserId) if (!record) throw new ScimError(500, undefined, 'The updated user could not be read back') - const groups = (await loadGroupsForScimUsers(db, [record.id])).get(record.id) ?? [] + const groups = (await loadGroupsForScimUsers(tx, [record.id])).get(record.id) ?? [] return toUserResource(toUserResourceRow(record, groups), baseUrl) } @@ -225,7 +227,7 @@ export const replaceScimUser = defineAuthorizedScimUseCase({ input, context, }: ScimUseCaseArgs): Promise { - const { scimUserId, userId, outcome } = await db.transaction(async (tx) => { + return db.transaction(async (tx) => { const current = await loadUserForUpdate(tx, context, input.scimUserId) /** @@ -245,21 +247,16 @@ export const replaceScimUser = defineAuthorizedScimUseCase({ * changes nothing must not write, audit, or re-project, or a 2,000-user * organization produces 2,000 spurious audit rows per sync. */ - if (userAttributesEqual(current.attributes, next)) { - return { scimUserId: current.id, userId: current.userId, outcome: null } - } + const outcome = userAttributesEqual(current.attributes, next) + ? null + : await applyUserUpdate(tx, context, current, next) return { scimUserId: current.id, userId: current.userId, - outcome: await applyUserUpdate(tx, context, current, next), + outcome, + resource: await renderUpdated(tx, context.connection.id, current.id, context.baseUrl), } }) - return { - scimUserId, - userId, - outcome, - resource: await renderUpdated(context.connection.id, scimUserId, context.baseUrl), - } }, projectAudit: ({ result }) => auditEntries(result), afterSuccess: async ({ result, context }) => @@ -277,7 +274,7 @@ export const patchScimUser = defineAuthorizedScimUseCase({ input, context, }: ScimUseCaseArgs): Promise { - const { scimUserId, userId, outcome } = await db.transaction(async (tx) => { + return db.transaction(async (tx) => { const current = await loadUserForUpdate(tx, context, input.scimUserId) const { next, changed } = applyUserPatch(current.attributes, input.operations) @@ -289,19 +286,14 @@ export const patchScimUser = defineAuthorizedScimUseCase({ * projection pass, and a `lastModified` bump for a request that meant * nothing. */ - if (!changed) return { scimUserId: current.id, userId: current.userId, outcome: null } + const outcome = changed ? await applyUserUpdate(tx, context, current, next) : null return { scimUserId: current.id, userId: current.userId, - outcome: await applyUserUpdate(tx, context, current, next), + outcome, + resource: await renderUpdated(tx, context.connection.id, current.id, context.baseUrl), } }) - return { - scimUserId, - userId, - outcome, - resource: await renderUpdated(context.connection.id, scimUserId, context.baseUrl), - } }, projectAudit: ({ result }) => auditEntries(result), afterSuccess: async ({ result, context }) => diff --git a/apps/sim/lib/scim/entitlement.ts b/apps/sim/lib/scim/entitlement.ts index 1b56c041e00..c001ca46e29 100644 --- a/apps/sim/lib/scim/entitlement.ts +++ b/apps/sim/lib/scim/entitlement.ts @@ -1,16 +1,16 @@ -import { isOrganizationFeatureEntitled } from '@/lib/billing/core/subscription' -import { isScimEnabled } from '@/lib/core/config/env-flags' +import { isOrganizationOnEnterprisePlan } from '@/lib/billing/core/subscription' +import { isHosted, isScimEnabled } from '@/lib/core/config/env-flags' /** * Whether directory provisioning may run for an organization. * - * The deployment flag is the outer gate on every deployment: hosted or not, a - * deployment that has not turned the feature on serves no SCIM surface, and an - * enterprise subscription cannot override that. Inside the gate, hosted - * deployments require the enterprise plan and self-hosted ones are entitled by - * the flag alone. + * The deployment flag is the outer gate: a deployment that has not turned the + * feature on serves no SCIM surface, and no subscription overrides that. Inside + * the gate, a self-hosted deployment is entitled by the flag alone and the + * hosted product requires the enterprise plan — the same shape SSO access uses. */ export async function isScimEntitledForOrganization(organizationId: string): Promise { if (!isScimEnabled) return false - return isOrganizationFeatureEntitled(organizationId, true) + if (!isHosted) return true + return isOrganizationOnEnterprisePlan(organizationId) } diff --git a/apps/sim/lib/scim/projection/auto-map.ts b/apps/sim/lib/scim/projection/auto-map.ts index 7eb9a96b61d..178d3f8ace9 100644 --- a/apps/sim/lib/scim/projection/auto-map.ts +++ b/apps/sim/lib/scim/projection/auto-map.ts @@ -1,6 +1,6 @@ import { permissionGroup, scimGroupMapping } from '@sim/db/schema' import { generateId } from '@sim/utils/id' -import { and, eq, isNull, ne } from 'drizzle-orm' +import { and, eq, ne } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' /** @@ -16,10 +16,9 @@ import type { DbOrTx } from '@/lib/db/types' * The adopted group is moved to explicit membership so the directory removing * its last member narrows it to nobody instead of widening it to everyone. * - * Automatic mappings are the ones with no author. A rename drops the automatic - * mapping the old name earned, so members do not keep access to a group whose - * name the directory no longer carries; mappings an administrator made by hand - * are theirs and are left alone. + * A rename drops the automatic mapping the old name earned, so members do not + * keep access to a group whose name the directory no longer carries; mappings an + * administrator made by hand are theirs and are left alone. */ export async function autoMapPermissionGroupByName( tx: DbOrTx, @@ -43,7 +42,7 @@ export async function autoMapPermissionGroupByName( and( eq(scimGroupMapping.groupId, params.scimGroupId), eq(scimGroupMapping.targetKind, 'permission_group'), - isNull(scimGroupMapping.createdBy), + eq(scimGroupMapping.source, 'automatic'), ...(target ? [ne(scimGroupMapping.permissionGroupId, target.id)] : []) ) ) @@ -79,6 +78,7 @@ export async function autoMapPermissionGroupByName( groupId: params.scimGroupId, targetKind: 'permission_group', permissionGroupId: target.id, + source: 'automatic', createdBy: null, }) .onConflictDoNothing() diff --git a/apps/sim/lib/scim/projection/reconcile-user.ts b/apps/sim/lib/scim/projection/reconcile-user.ts index 2418c18cb6a..c6ea527a931 100644 --- a/apps/sim/lib/scim/projection/reconcile-user.ts +++ b/apps/sim/lib/scim/projection/reconcile-user.ts @@ -146,13 +146,14 @@ async function applyGrant( params.previousPermission && permissionRank(params.previousPermission) > permissionRank(grant.permissionType) ) { - await lowerWorkspaceAccessTx(tx, { + const lowered = await lowerWorkspaceAccessTx(tx, { workspaceId: grant.targetId, userId: params.userId, from: params.previousPermission, to: grant.permissionType, }) - return 'applied' + if (lowered === 'lowered') return 'applied' + /** The row is no longer at the level the directory set; ensure at least the desired level. */ } const outcome = await grantWorkspaceAccessTx(tx, { workspaceId: grant.targetId, diff --git a/apps/sim/lib/scim/protocol/filter.ts b/apps/sim/lib/scim/protocol/filter.ts index 6e6fb34f3c7..ed28647f5a6 100644 --- a/apps/sim/lib/scim/protocol/filter.ts +++ b/apps/sim/lib/scim/protocol/filter.ts @@ -161,7 +161,10 @@ function parseTerm(term: string): { attribute: string; value: string } { const raw = rawValue.trim() /** RFC 7644 writes boolean comparisons unquoted, and only `active` is boolean here. */ - if (attribute.toLowerCase() === 'active' && (raw === 'true' || raw === 'false')) { + if ( + normalizeAttributePath(attribute).toLowerCase() === 'active' && + (raw === 'true' || raw === 'false') + ) { return { attribute, value: raw } } if (!raw.startsWith('"') || !raw.endsWith('"') || raw.length < 2) { diff --git a/apps/sim/lib/scim/protocol/group-patch.ts b/apps/sim/lib/scim/protocol/group-patch.ts index 6061d730a20..7d3113d287c 100644 --- a/apps/sim/lib/scim/protocol/group-patch.ts +++ b/apps/sim/lib/scim/protocol/group-patch.ts @@ -130,7 +130,11 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou const key = path.toLowerCase() if (key === 'members') { if (operation.op === 'replace') { - applyFullMembers(readMemberList(operation.value ?? [])) + /** Clearing a group is an explicit `[]` or a value-less remove, never a missing value. */ + if (operation.value === undefined || operation.value === null) { + throw invalidValue('A replace of members requires a value') + } + applyFullMembers(readMemberList(operation.value)) continue } if (operation.op === 'remove' && operation.value === undefined) { diff --git a/apps/sim/lib/scim/reconcile/job.ts b/apps/sim/lib/scim/reconcile/job.ts index f0af971a95b..089f4842bce 100644 --- a/apps/sim/lib/scim/reconcile/job.ts +++ b/apps/sim/lib/scim/reconcile/job.ts @@ -27,12 +27,11 @@ const LEASE_TTL_MS = 15 * 60 * 1000 /** * How often a connection is swept when nothing else triggers it. * - * The cron fires hourly; each connection is picked up once this interval has - * passed since its last sweep, oldest first. Drift is rare and corrected on the - * next membership change anyway, so a few passes a day is plenty without - * re-walking every tenant every hour. + * Matches the cron's cadence: every connection is re-walked once an hour, oldest + * first. A pass over an in-sync tenant is reads only, so the hourly guarantee + * the docs make costs little. */ -const RECONCILE_INTERVAL_MS = 6 * 60 * 60 * 1000 +const RECONCILE_INTERVAL_MS = 60 * 60 * 1000 /** Users reconciled per transaction, so no single one holds locks for long. */ const BATCH_SIZE = 200 @@ -144,18 +143,6 @@ export async function reconcileConnection(connection: { let completed = false try { - /** - * Settings are read after the lease is held, not from the row the due query - * returned: an administrator may have changed them in between, and projecting - * with the old settings would then stamp the connection as reconciled. - */ - const [fresh] = await db - .select({ settings: scimConnection.settings }) - .from(scimConnection) - .where(eq(scimConnection.id, connection.id)) - .limit(1) - const settings = fresh?.settings ?? connection.settings - let cursor: string | undefined for (;;) { const page = await listScimUserIds(db, { @@ -171,6 +158,19 @@ export async function reconcileConnection(connection: { return null } + /** + * Settings are read per batch rather than from the row the due query + * returned: an administrator may change them while a long pass runs, and + * projecting a later batch with the old settings would then stamp the + * connection as reconciled against a policy it no longer has. + */ + const [fresh] = await db + .select({ settings: scimConnection.settings }) + .from(scimConnection) + .where(eq(scimConnection.id, connection.id)) + .limit(1) + const settings = fresh?.settings ?? connection.settings + await db.transaction(async (tx) => { for (const row of page) { const delta = await reconcileUserProjection(tx, { diff --git a/packages/db/migrations/0323_scim_provisioning.sql b/packages/db/migrations/0323_scim_provisioning.sql index a1069c6f42d..0de445d3236 100644 --- a/packages/db/migrations/0323_scim_provisioning.sql +++ b/packages/db/migrations/0323_scim_provisioning.sql @@ -1,7 +1,6 @@ CREATE TABLE "scim_connection" ( "id" text PRIMARY KEY NOT NULL, "organization_id" text NOT NULL, - "sso_provider_id" text, "status" text DEFAULT 'active' NOT NULL, "settings" jsonb DEFAULT '{}'::jsonb NOT NULL, "last_request_at" timestamp, @@ -46,6 +45,7 @@ CREATE TABLE "scim_group_mapping" ( "workspace_id" text, "permission_type" "permission_type", "role" text, + "source" text DEFAULT 'manual' NOT NULL, "created_by" text, "created_at" timestamp DEFAULT now() NOT NULL, CONSTRAINT "scim_group_mapping_target_shape" CHECK (( @@ -112,7 +112,6 @@ ALTER TABLE "permission_group" ADD COLUMN "membership_mode" text DEFAULT 'inheri ALTER TABLE "user" ADD COLUMN "suspended_at" timestamp;--> statement-breakpoint ALTER TABLE "user" ADD COLUMN "suspension_source" text;--> statement-breakpoint ALTER TABLE "scim_connection" ADD CONSTRAINT "scim_connection_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "scim_connection" ADD CONSTRAINT "scim_connection_sso_provider_id_sso_provider_id_fk" FOREIGN KEY ("sso_provider_id") REFERENCES "public"."sso_provider"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint ALTER TABLE "scim_connection" ADD CONSTRAINT "scim_connection_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint ALTER TABLE "scim_credential" ADD CONSTRAINT "scim_credential_connection_id_scim_connection_id_fk" FOREIGN KEY ("connection_id") REFERENCES "public"."scim_connection"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "scim_credential" ADD CONSTRAINT "scim_credential_revoked_by_user_id_fk" FOREIGN KEY ("revoked_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint diff --git a/packages/db/migrations/meta/0323_snapshot.json b/packages/db/migrations/meta/0323_snapshot.json index 32b56a2e58d..370a13ee4b2 100644 --- a/packages/db/migrations/meta/0323_snapshot.json +++ b/packages/db/migrations/meta/0323_snapshot.json @@ -1,5 +1,5 @@ { - "id": "21abba38-933e-49f5-987c-7e2ec982c472", + "id": "cae748d7-69a8-436e-8aac-9dd0f2a894dd", "prevId": "43e7d6af-94da-4f1c-8bfc-568d5937765c", "version": "7", "dialect": "postgresql", @@ -12378,12 +12378,6 @@ "primaryKey": false, "notNull": true }, - "sso_provider_id": { - "name": "sso_provider_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, "status": { "name": "status", "type": "text", @@ -12485,15 +12479,6 @@ "onDelete": "cascade", "onUpdate": "no action" }, - "scim_connection_sso_provider_id_sso_provider_id_fk": { - "name": "scim_connection_sso_provider_id_sso_provider_id_fk", - "tableFrom": "scim_connection", - "tableTo": "sso_provider", - "columnsFrom": ["sso_provider_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - }, "scim_connection_created_by_user_id_fk": { "name": "scim_connection_created_by_user_id_fk", "tableFrom": "scim_connection", @@ -12834,6 +12819,13 @@ "primaryKey": false, "notNull": false }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, "created_by": { "name": "created_by", "type": "text", diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 6acd2cdcf1c..bc8f2ff5cc7 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -2259,7 +2259,7 @@ { "idx": 323, "version": "7", - "when": 1788808514065, + "when": 1788820417176, "tag": "0323_scim_provisioning", "breakpoints": true } diff --git a/packages/db/schema.ts b/packages/db/schema.ts index c7e0a27ad98..aa71640bfb9 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -5920,9 +5920,6 @@ export const scimConnection = pgTable( .notNull() .references(() => organization.id, { onDelete: 'cascade' }), /** The SSO provider this directory pairs with, shown in settings. */ - ssoProviderId: text('sso_provider_id').references(() => ssoProvider.id, { - onDelete: 'set null', - }), /** `active` or `disabled`. Disabling refuses every credential immediately. */ status: text('status').notNull().default('active'), settings: jsonb('settings').$type().notNull().default({}), @@ -6131,6 +6128,13 @@ export const scimGroupMapping = pgTable( permissionType: permissionTypeEnum('permission_type'), /** Organization role granted, for `org_role` targets. Only `admin` is accepted. */ role: text('role'), + /** + * `automatic` mappings were made by name matching and are replaced when the + * group is renamed; `manual` ones were made by an administrator and are + * never removed by a sync. Kept apart from `createdBy`, which goes null when + * its author's account is deleted. + */ + source: text('source').notNull().default('manual'), createdBy: text('created_by').references(() => user.id, { onDelete: 'set null' }), createdAt: timestamp('created_at').notNull().defaultNow(), }, diff --git a/packages/testing/src/mocks/schema.mock.ts b/packages/testing/src/mocks/schema.mock.ts index e68c7977fce..8f936f01a67 100644 --- a/packages/testing/src/mocks/schema.mock.ts +++ b/packages/testing/src/mocks/schema.mock.ts @@ -1167,7 +1167,6 @@ export const schemaMock = { scimConnection: { id: 'scimConnection.id', organizationId: 'scimConnection.organizationId', - ssoProviderId: 'scimConnection.ssoProviderId', status: 'scimConnection.status', settings: 'scimConnection.settings', lastRequestAt: 'scimConnection.lastRequestAt', @@ -1231,6 +1230,7 @@ export const schemaMock = { groupId: 'scimGroupMapping.groupId', targetKind: 'scimGroupMapping.targetKind', permissionGroupId: 'scimGroupMapping.permissionGroupId', + source: 'scimGroupMapping.source', workspaceId: 'scimGroupMapping.workspaceId', permissionType: 'scimGroupMapping.permissionType', role: 'scimGroupMapping.role', From 8441f5ed8739c537c253fff40d7c800cb86ba630 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 15:39:29 -0700 Subject: [PATCH 20/31] docs(auth): sync migration references after staging merge --- apps/sim/lib/auth/oauth-provider.ts | 2 +- packages/sim-cli/src/auth/oauth-flow.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/sim/lib/auth/oauth-provider.ts b/apps/sim/lib/auth/oauth-provider.ts index 1783dc1b1e1..53b7bc4a146 100644 --- a/apps/sim/lib/auth/oauth-provider.ts +++ b/apps/sim/lib/auth/oauth-provider.ts @@ -4,7 +4,7 @@ * "Authorized apps" settings surface. */ -/** The first-party Sim CLI, seeded by migration `0322_oauth_provider` as a public client. */ +/** The first-party Sim CLI, seeded by migration `0323_oauth_provider` as a public client. */ export const SIM_CLI_CLIENT_ID = 'sim-cli' /** diff --git a/packages/sim-cli/src/auth/oauth-flow.ts b/packages/sim-cli/src/auth/oauth-flow.ts index ac16f5346ba..2d70a3f0f15 100644 --- a/packages/sim-cli/src/auth/oauth-flow.ts +++ b/packages/sim-cli/src/auth/oauth-flow.ts @@ -22,7 +22,7 @@ import { USER_AGENT } from '../version' * path for a terminal whose browser cannot reach it (SSH, containers). */ -/** The client id migration `0322_oauth_provider` seeds; a public client, no secret. */ +/** The client id migration `0323_oauth_provider` seeds; a public client, no secret. */ export const OAUTH_CLIENT_ID = 'sim-cli' /** From 670b28849883b8b497abd4c938806628ab48540f Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 16:15:39 -0700 Subject: [PATCH 21/31] refactor(scim): one removal invariant, honest provenance, finished primitive extraction, tests Findings from an independent three-way audit (architecture, correctness, tests) after the review rounds: - Removing a member is one transaction that also revokes sessions and personal keys and retires the directory row into its tombstone, so a member can never be gone while the directory says otherwise. The four defensive re-checks the review rounds had added are gone; deprovision is one path and the settings UI removal gains the same revocation - Every satisfied mapping is recorded; access the person already held is recorded as `adopted` and left alone on withdrawal unless the directory is the source of truth. Reconcile is idempotent again - Permission-group conflict rules live once, in the shared membership primitive; the settings routes and the workspace-member route use the shared primitives; direct workspace grants honor managed-membership lock - Lock order: the permission-group leaf lock precedes every write to its row; deadlocks map to 503 like lock timeouts; credential issue serializes on the organization lock; reconcile batches shrink to 25 - PATCH keeps unmodelled attributes under `extra` as create and replace do, so Entra's default mappings no longer fail whole updates - Unknown group members are dropped with a warning; Entra's legacy User schema marker is tolerated; the directory re-asserts an account address that drifted; relink lifts a lingering suspension; a reconcile pass advances the watermark only when it completes and re-reads settings per batch; instance-organization deployments refuse a connection for any other organization; provisioning cleans up through account deletion - Base URL, credential predicate, request-log type, audit recording, and seat policy each live in one place; `ssoProviderId` and the unused credential scope parameter are removed - Tests for the reconciler, user updates, deprovision, the route builder, entitlement, auto-map, and the shared conflict rules; docs corrected Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01DGXcwsHzYGp6pUDWRtJKpz --- .../content/docs/platform/enterprise/scim.mdx | 6 +- apps/sim/app/api/cron/scim-reconcile/route.ts | 4 +- .../[groupId]/members/bulk/route.ts | 6 +- .../[groupId]/members/route.ts | 10 +- .../[id]/permission-groups/[groupId]/route.ts | 10 +- .../[id]/permission-groups/route.ts | 6 +- .../[id]/permission-groups/utils.test.ts | 117 +------- .../[id]/permission-groups/utils.ts | 135 +-------- .../[id]/scim/credentials/route.ts | 1 - .../app/api/workspaces/members/[id]/route.ts | 48 +--- apps/sim/ee/scim/components/scim-section.tsx | 5 +- .../lib/api/contracts/organization-scim.ts | 3 +- .../lib/api/server/routes/scim-route.test.ts | 195 +++++++++++++ apps/sim/lib/api/server/routes/scim-route.ts | 21 +- .../auth/sso/application/admit-sso-user.ts | 29 +- .../lib/billing/organizations/membership.ts | 22 +- .../lib/billing/organizations/seat-policy.ts | 36 +++ .../lib/execution/sandbox/bundles/docx.cjs | 38 +-- .../execution/sandbox/bundles/pptxgenjs.cjs | 34 +-- apps/sim/lib/invitations/direct-grant.ts | 7 + .../organizations/members/lifecycle.test.ts | 6 +- .../lib/organizations/members/lifecycle.ts | 87 +----- .../lib/organizations/members/revocation.ts | 85 ++++++ .../application/group-membership.test.ts | 120 ++++++++ .../application/group-membership.ts | 251 ++++++++++------- .../scim/application/admin/connection-view.ts | 9 +- .../lib/scim/application/admin/connection.ts | 6 +- .../lib/scim/application/admin/credentials.ts | 18 +- .../lib/scim/application/admin/mappings.ts | 11 +- apps/sim/lib/scim/application/audit.ts | 42 +++ .../authorized-scim-admin-use-case.ts | 22 +- .../application/authorized-scim-use-case.ts | 76 ++---- .../scim/application/groups/manage-groups.ts | 65 ++--- .../users/deprovision-user.test.ts | 144 ++++++++++ .../application/users/deprovision-user.ts | 80 ++---- .../scim/application/users/provision-user.ts | 82 +----- .../application/users/update-user.test.ts | 217 +++++++++++++++ .../lib/scim/application/users/update-user.ts | 47 ++-- apps/sim/lib/scim/authenticate.ts | 11 +- apps/sim/lib/scim/base-url.ts | 7 + apps/sim/lib/scim/entitlement.test.ts | 44 +++ .../scim/identity/end-directory-membership.ts | 69 +++++ apps/sim/lib/scim/projection/auto-map.test.ts | 78 ++++++ apps/sim/lib/scim/projection/auto-map.ts | 5 + apps/sim/lib/scim/projection/grants.ts | 9 + .../scim/projection/reconcile-user.test.ts | 257 ++++++++++++++++++ .../sim/lib/scim/projection/reconcile-user.ts | 39 ++- apps/sim/lib/scim/protocol/canonical.ts | 5 +- apps/sim/lib/scim/protocol/errors.ts | 10 +- apps/sim/lib/scim/protocol/normalize.ts | 11 +- apps/sim/lib/scim/protocol/user-patch.test.ts | 41 ++- apps/sim/lib/scim/protocol/user-patch.ts | 67 ++++- apps/sim/lib/scim/reconcile/job.ts | 7 +- apps/sim/lib/scim/repository/credentials.ts | 11 + apps/sim/lib/scim/repository/groups.ts | 28 +- apps/sim/lib/scim/request-log.ts | 15 +- apps/sim/lib/scim/route.ts | 5 +- .../lib/workspaces/access/workspace-access.ts | 8 +- .../db/migrations/0323_scim_provisioning.sql | 6 +- .../db/migrations/meta/0323_snapshot.json | 54 +++- packages/db/migrations/meta/_journal.json | 2 +- packages/db/schema.ts | 26 +- packages/testing/src/mocks/schema.mock.ts | 1 + 63 files changed, 1982 insertions(+), 935 deletions(-) create mode 100644 apps/sim/lib/api/server/routes/scim-route.test.ts create mode 100644 apps/sim/lib/billing/organizations/seat-policy.ts create mode 100644 apps/sim/lib/organizations/members/revocation.ts create mode 100644 apps/sim/lib/permission-groups/application/group-membership.test.ts create mode 100644 apps/sim/lib/scim/application/audit.ts create mode 100644 apps/sim/lib/scim/application/users/deprovision-user.test.ts create mode 100644 apps/sim/lib/scim/application/users/update-user.test.ts create mode 100644 apps/sim/lib/scim/base-url.ts create mode 100644 apps/sim/lib/scim/entitlement.test.ts create mode 100644 apps/sim/lib/scim/identity/end-directory-membership.ts create mode 100644 apps/sim/lib/scim/projection/auto-map.test.ts create mode 100644 apps/sim/lib/scim/projection/reconcile-user.test.ts create mode 100644 apps/sim/lib/scim/repository/credentials.ts diff --git a/apps/docs/content/docs/platform/enterprise/scim.mdx b/apps/docs/content/docs/platform/enterprise/scim.mdx index a37f012e1e7..afd411c5b09 100644 --- a/apps/docs/content/docs/platform/enterprise/scim.mdx +++ b/apps/docs/content/docs/platform/enterprise/scim.mdx @@ -24,7 +24,7 @@ It pairs with [SSO](/platform/enterprise/sso). SSO proves who someone is when th | Updates their name or email | Updates the Sim account, and ends their sessions if the address changed | | Deactivates them | Blocks sign-in and stops their personal API keys. Everything they own, and every grant they hold, is left untouched; shared workspace keys keep working | | Reactivates them | Restores access exactly as it was | -| Removes them from the app | Removes their organization membership and reassigns what they owned | +| Removes them from the app | Removes their organization membership, ends their sessions, deletes their personal API keys, and reassigns what they owned | | Adds them to a group | Grants whatever that group maps to | Deactivation is reversible and never destructive. Someone on leave keeps their workflows, their credentials, and their workspace history; they simply cannot sign in. @@ -131,7 +131,7 @@ A group can carry several mappings. When two groups grant the same workspace at Sim records every grant it makes on your behalf. When someone leaves a group, only what the directory granted is taken back — access a workspace administrator granted by hand stays. -The one exception is **managed membership locking**, which is on by default. With it on, the directory is the source of truth: Sim refuses invitations, role changes, and manual grants for provisioned members, because the next sync would revert them anyway. Turn it off if you want to layer manual access on top of directory access. +The one exception is **managed membership locking**, which is on by default. With it on, the directory is the source of truth: Sim refuses invitations, workspace grants, and role changes for provisioned members, because the next sync would revert them anyway. Removals stay possible so an administrator can always act in an emergency. Turn it off if you want to layer manual access on top of directory access. ## Provisioning and SSO together @@ -143,7 +143,7 @@ If you want the directory to be the only way in, enable **Disable just-in-time p **Settings → SSO → Directory provisioning → Activity** lists recent requests with their status and, for a failure, what was wrong. Providers report a failed cycle without saying what they sent, so this is usually the fastest way to see the cause. -Sim also re-applies every group mapping on a schedule, so drift cannot persist. You can run it on demand with **Reconcile now**. +Sim also re-applies every group mapping once an hour, so drift cannot persist. You can run it on demand with **Reconcile now**, which is also how a change to the connection settings reaches members before the next sync. ## Reference diff --git a/apps/sim/app/api/cron/scim-reconcile/route.ts b/apps/sim/app/api/cron/scim-reconcile/route.ts index b35e68b1dbc..9bf22f966ca 100644 --- a/apps/sim/app/api/cron/scim-reconcile/route.ts +++ b/apps/sim/app/api/cron/scim-reconcile/route.ts @@ -2,7 +2,7 @@ import { createLogger } from '@sim/logger' import { toError } from '@sim/utils/errors' import { type NextRequest, NextResponse } from 'next/server' import { verifyCronAuth } from '@/lib/auth/internal' -import { isBillingEnabled, isScimEnabled } from '@/lib/core/config/env-flags' +import { isScimEnabled } from '@/lib/core/config/env-flags' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { runScimReconcileSweep } from '@/lib/scim/reconcile/job' @@ -16,7 +16,7 @@ export const GET = withRouteHandler(async (request: NextRequest) => { const authError = verifyCronAuth(request, 'SCIM reconciliation') if (authError) return authError - if (!isBillingEnabled && !isScimEnabled) { + if (!isScimEnabled) { return NextResponse.json({ success: true, connections: 0, skipped: 'disabled' }) } diff --git a/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/members/bulk/route.ts b/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/members/bulk/route.ts index 7cec2121fb2..5f7257295d2 100644 --- a/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/members/bulk/route.ts +++ b/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/members/bulk/route.ts @@ -10,15 +10,17 @@ import { bulkAddPermissionGroupMembersContract } from '@/lib/api/contracts/permi import { getValidationErrorMessage, parseRequest } from '@/lib/api/server' import { getSession } from '@/lib/auth' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' +import { + findScopeConflicts, + type ScopeConflict, +} from '@/lib/permission-groups/application/group-membership' import { PERMISSION_GROUP_MEMBER_CONSTRAINTS } from '@/lib/permission-groups/constraints' import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' import { authorizeOrgAccessControl, - findScopeConflicts, formatScopeConflictError, getGroupWorkspaces, loadGroupInOrganization, - type ScopeConflict, } from '@/app/api/organizations/[id]/permission-groups/utils' const logger = createLogger('OrganizationPermissionGroupBulkMembers') diff --git a/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/members/route.ts b/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/members/route.ts index 1f3fe15f1b5..b2a6ee6fc42 100644 --- a/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/members/route.ts +++ b/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/members/route.ts @@ -10,19 +10,21 @@ import { addPermissionGroupMemberContract } from '@/lib/api/contracts/permission import { getValidationErrorMessage, parseRequest } from '@/lib/api/server' import { getSession } from '@/lib/auth' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' +import { + type AllMembersConflict, + findAllMembersWorkspaceConflict, + findScopeConflicts, + type ScopeConflict, +} from '@/lib/permission-groups/application/group-membership' import { PERMISSION_GROUP_MEMBER_CONSTRAINTS } from '@/lib/permission-groups/constraints' import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' import { isOrganizationMember } from '@/lib/workspaces/permissions/utils' import { - type AllMembersConflict, authorizeOrgAccessControl, - findAllMembersWorkspaceConflict, - findScopeConflicts, formatAllMembersConflictError, formatScopeConflictError, getGroupWorkspaces, loadGroupInOrganization, - type ScopeConflict, } from '@/app/api/organizations/[id]/permission-groups/utils' const logger = createLogger('OrganizationPermissionGroupMembers') diff --git a/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/route.ts b/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/route.ts index fcf5b0ee280..416c1353ee6 100644 --- a/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/permission-groups/[groupId]/route.ts @@ -10,6 +10,12 @@ import { updatePermissionGroupContract } from '@/lib/api/contracts/permission-gr import { getValidationErrorMessage, parseRequest } from '@/lib/api/server' import { getSession } from '@/lib/auth' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' +import { + type AllMembersConflict, + findAllMembersWorkspaceConflict, + findScopeConflicts, + type ScopeConflict, +} from '@/lib/permission-groups/application/group-membership' import { PERMISSION_GROUP_CONSTRAINTS } from '@/lib/permission-groups/constraints' import { type PermissionGroupConfig, @@ -17,16 +23,12 @@ import { } from '@/lib/permission-groups/fields' import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' import { - type AllMembersConflict, authorizeOrgAccessControl, - findAllMembersWorkspaceConflict, - findScopeConflicts, findWorkspacesNotInOrganization, formatAllMembersConflictError, formatScopeConflictError, getGroupWorkspaces, loadGroupInOrganization, - type ScopeConflict, } from '@/app/api/organizations/[id]/permission-groups/utils' const logger = createLogger('OrganizationPermissionGroup') diff --git a/apps/sim/app/api/organizations/[id]/permission-groups/route.ts b/apps/sim/app/api/organizations/[id]/permission-groups/route.ts index dd8e9400fe3..42cfc1ae1a4 100644 --- a/apps/sim/app/api/organizations/[id]/permission-groups/route.ts +++ b/apps/sim/app/api/organizations/[id]/permission-groups/route.ts @@ -15,6 +15,10 @@ import { createPermissionGroupContract } from '@/lib/api/contracts/permission-gr import { getValidationErrorMessage, parseRequest } from '@/lib/api/server' import { getSession } from '@/lib/auth' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' +import { + type AllMembersConflict, + findAllMembersWorkspaceConflict, +} from '@/lib/permission-groups/application/group-membership' import { PERMISSION_GROUP_CONSTRAINTS } from '@/lib/permission-groups/constraints' import { DEFAULT_PERMISSION_GROUP_CONFIG, @@ -23,9 +27,7 @@ import { } from '@/lib/permission-groups/fields' import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' import { - type AllMembersConflict, authorizeOrgAccessControl, - findAllMembersWorkspaceConflict, findWorkspacesNotInOrganization, formatAllMembersConflictError, getWorkspacesForGroups, diff --git a/apps/sim/app/api/organizations/[id]/permission-groups/utils.test.ts b/apps/sim/app/api/organizations/[id]/permission-groups/utils.test.ts index 6e762e3bd2a..62c0ddb18cc 100644 --- a/apps/sim/app/api/organizations/[id]/permission-groups/utils.test.ts +++ b/apps/sim/app/api/organizations/[id]/permission-groups/utils.test.ts @@ -1,8 +1,7 @@ /** * @vitest-environment node */ -import { permissionGroup, permissionGroupMember } from '@sim/db/schema' -import { queueTableRows, resetDbChainMock } from '@sim/testing' +import { resetDbChainMock } from '@sim/testing' import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' const { mockIsOrganizationAdminOrOwner, mockIsOrganizationOnEnterprisePlan } = vi.hoisted(() => ({ @@ -18,11 +17,7 @@ vi.mock('@/lib/workspaces/permissions/utils', () => ({ isOrganizationAdminOrOwner: mockIsOrganizationAdminOrOwner, })) -import { - authorizeOrgAccessControl, - findAllMembersWorkspaceConflict, - findScopeConflicts, -} from '@/app/api/organizations/[id]/permission-groups/utils' +import { authorizeOrgAccessControl } from '@/app/api/organizations/[id]/permission-groups/utils' afterAll(resetDbChainMock) @@ -66,111 +61,3 @@ describe('authorizeOrgAccessControl', () => { expect(response).toBeNull() }) }) - -describe('findScopeConflicts', () => { - beforeEach(() => { - vi.clearAllMocks() - resetDbChainMock() - }) - - const baseParams = { - organizationId: 'org-1', - excludeGroupId: 'group-1', - workspaceIds: ['ws-1'], - candidateUserIds: ['user-1'], - } - - const conflictRow = (userId: string, otherGroupName = 'Marketing') => ({ - userId, - userName: 'User One', - userEmail: `${userId}@example.com`, - otherGroupId: 'group-2', - otherGroupName, - }) - - it('returns no conflicts when there are no candidate users', async () => { - queueTableRows(permissionGroupMember, [conflictRow('user-1')]) - - const conflicts = await findScopeConflicts({ ...baseParams, candidateUserIds: [] }) - - expect(conflicts).toEqual([]) - }) - - it('returns no conflicts when there are no target workspaces', async () => { - queueTableRows(permissionGroupMember, [conflictRow('user-1')]) - - const conflicts = await findScopeConflicts({ ...baseParams, workspaceIds: [] }) - - expect(conflicts).toEqual([]) - }) - - it('flags a candidate already in another group that shares a workspace', async () => { - queueTableRows(permissionGroupMember, [conflictRow('user-1')]) - - const conflicts = await findScopeConflicts(baseParams) - - expect(conflicts.map((c) => c.userId)).toEqual(['user-1']) - expect(conflicts[0].conflictingGroupName).toBe('Marketing') - }) - - it('returns at most one conflict per user', async () => { - queueTableRows(permissionGroupMember, [ - conflictRow('user-1', 'Marketing'), - conflictRow('user-1', 'Sales'), - ]) - - const conflicts = await findScopeConflicts(baseParams) - - expect(conflicts).toHaveLength(1) - expect(conflicts[0].conflictingGroupName).toBe('Marketing') - }) - - it('returns no conflicts when the query finds no overlapping memberships', async () => { - const conflicts = await findScopeConflicts(baseParams) - - expect(conflicts).toEqual([]) - }) -}) - -describe('findAllMembersWorkspaceConflict', () => { - beforeEach(() => { - vi.clearAllMocks() - resetDbChainMock() - }) - - const baseParams = { - organizationId: 'org-1', - excludeGroupId: 'group-1', - workspaceIds: ['ws-1', 'ws-2'], - } - - it('returns null when there are no target workspaces', async () => { - queueTableRows(permissionGroup, [ - { conflictingGroupId: 'group-2', conflictingGroupName: 'Marketing', workspaceName: 'Acme' }, - ]) - - const conflict = await findAllMembersWorkspaceConflict({ ...baseParams, workspaceIds: [] }) - - expect(conflict).toBeNull() - }) - - it('returns the conflicting all-members group sharing a workspace', async () => { - queueTableRows(permissionGroup, [ - { conflictingGroupId: 'group-2', conflictingGroupName: 'Marketing', workspaceName: 'Acme' }, - ]) - - const conflict = await findAllMembersWorkspaceConflict(baseParams) - - expect(conflict).toEqual({ - conflictingGroupId: 'group-2', - conflictingGroupName: 'Marketing', - workspaceName: 'Acme', - }) - }) - - it('returns null when no other all-members group targets the workspaces', async () => { - const conflict = await findAllMembersWorkspaceConflict(baseParams) - - expect(conflict).toBeNull() - }) -}) diff --git a/apps/sim/app/api/organizations/[id]/permission-groups/utils.ts b/apps/sim/app/api/organizations/[id]/permission-groups/utils.ts index d2e664cac0f..f96ac8dacf7 100644 --- a/apps/sim/app/api/organizations/[id]/permission-groups/utils.ts +++ b/apps/sim/app/api/organizations/[id]/permission-groups/utils.ts @@ -1,15 +1,13 @@ import { db } from '@sim/db' -import { - permissionGroup, - permissionGroupMember, - permissionGroupWorkspace, - user, - workspace, -} from '@sim/db/schema' -import { and, asc, eq, inArray, ne, sql } from 'drizzle-orm' +import { permissionGroup, permissionGroupWorkspace, workspace } from '@sim/db/schema' +import { and, asc, eq, inArray } from 'drizzle-orm' import { NextResponse } from 'next/server' import { isOrganizationOnEnterprisePlan } from '@/lib/billing' import type { DbOrTx } from '@/lib/db/types' +import type { + AllMembersConflict, + ScopeConflict, +} from '@/lib/permission-groups/application/group-membership' import { isOrganizationAdminOrOwner } from '@/lib/workspaces/permissions/utils' /** A workspace reference (id + display name). */ @@ -130,127 +128,6 @@ export async function listOrganizationWorkspaces(organizationId: string): Promis } /** A member whose other group membership would conflict with a candidate scope. */ -export interface ScopeConflict { - userId: string - userName: string | null - userEmail: string | null - /** The group the member already belongs to that causes the conflict. */ - conflictingGroupId: string - conflictingGroupName: string -} - -/** - * Which of `candidateUserIds` would be governed by two groups on the same - * workspace: each is already an explicit member of another non-default group - * that shares one of `workspaceIds`. The candidate group (`excludeGroupId`) and - * the org default group are ignored — the default never governs through - * membership. Returns at most one conflict per user. - */ -export async function findScopeConflicts( - params: { - organizationId: string - excludeGroupId: string - workspaceIds: string[] - candidateUserIds: string[] - }, - executor: DbOrTx = db -): Promise { - const { organizationId, excludeGroupId, workspaceIds, candidateUserIds } = params - if (candidateUserIds.length === 0 || workspaceIds.length === 0) return [] - - const rows = await executor - .select({ - userId: permissionGroupMember.userId, - userName: user.name, - userEmail: user.email, - otherGroupId: permissionGroup.id, - otherGroupName: permissionGroup.name, - }) - .from(permissionGroupMember) - .innerJoin(permissionGroup, eq(permissionGroupMember.permissionGroupId, permissionGroup.id)) - .innerJoin( - permissionGroupWorkspace, - eq(permissionGroupWorkspace.permissionGroupId, permissionGroup.id) - ) - .leftJoin(user, eq(permissionGroupMember.userId, user.id)) - .where( - and( - eq(permissionGroupMember.organizationId, organizationId), - inArray(permissionGroupMember.userId, candidateUserIds), - ne(permissionGroupMember.permissionGroupId, excludeGroupId), - eq(permissionGroup.isDefault, false), - inArray(permissionGroupWorkspace.workspaceId, workspaceIds) - ) - ) - - const conflictByUser = new Map() - for (const row of rows) { - if (conflictByUser.has(row.userId)) continue - conflictByUser.set(row.userId, { - userId: row.userId, - userName: row.userName, - userEmail: row.userEmail, - conflictingGroupId: row.otherGroupId, - conflictingGroupName: row.otherGroupName, - }) - } - return Array.from(conflictByUser.values()) -} - -/** An existing all-members group that already governs everyone in a shared workspace. */ -export interface AllMembersConflict { - conflictingGroupId: string - conflictingGroupName: string - workspaceName: string -} - -/** - * For a group that will govern *all members* of `workspaceIds` (a non-default - * group with no explicit members), return the first other non-default - * all-members group already targeting one of those workspaces, or `null`. Two - * all-members groups on one workspace would both claim everyone there, so this - * is rejected at assignment time. The candidate group (`excludeGroupId`) is - * ignored, and so is any group in `explicit` membership mode: empty, it governs - * nobody rather than everyone, so it cannot collide. - */ -export async function findAllMembersWorkspaceConflict( - params: { organizationId: string; excludeGroupId: string; workspaceIds: string[] }, - executor: DbOrTx = db -): Promise { - const { organizationId, excludeGroupId, workspaceIds } = params - if (workspaceIds.length === 0) return null - - const [row] = await executor - .select({ - conflictingGroupId: permissionGroup.id, - conflictingGroupName: permissionGroup.name, - workspaceName: workspace.name, - }) - .from(permissionGroup) - .innerJoin( - permissionGroupWorkspace, - eq(permissionGroupWorkspace.permissionGroupId, permissionGroup.id) - ) - .innerJoin(workspace, eq(permissionGroupWorkspace.workspaceId, workspace.id)) - .where( - and( - eq(permissionGroup.organizationId, organizationId), - eq(permissionGroup.isDefault, false), - eq(permissionGroup.membershipMode, 'inherit'), - ne(permissionGroup.id, excludeGroupId), - inArray(permissionGroupWorkspace.workspaceId, workspaceIds), - sql`not exists ( - select 1 from ${permissionGroupMember} - where ${permissionGroupMember.permissionGroupId} = ${permissionGroup.id} - )` - ) - ) - .orderBy(asc(workspace.name)) - .limit(1) - - return row ?? null -} - /** * Human-readable 409 message for a scope/membership conflict, naming the member * and the group they already belong to that overlaps the requested workspaces. diff --git a/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts b/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts index 6d35b30891a..a657a2c0e8b 100644 --- a/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts @@ -19,7 +19,6 @@ export const POST = defineInternalJsonRoute({ errorPolicy: internalOrchestrationErrorPolicy, mapInput: ({ params, body }) => ({ organizationId: params.id, - ...(body.scopes ? { scopes: body.scopes } : {}), ...(body.expiresInDays !== undefined ? { expiresInDays: body.expiresInDays } : {}), }), useCase: issueScimCredential, diff --git a/apps/sim/app/api/workspaces/members/[id]/route.ts b/apps/sim/app/api/workspaces/members/[id]/route.ts index 1a028d91813..5a35a0721fb 100644 --- a/apps/sim/app/api/workspaces/members/[id]/route.ts +++ b/apps/sim/app/api/workspaces/members/[id]/route.ts @@ -10,18 +10,13 @@ import { getSession } from '@/lib/auth' import { removeUserFromOrganization } from '@/lib/billing/organizations/membership' import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' -import { revokeWorkspaceCredentialMembershipsTx } from '@/lib/credentials/access' import { captureServerEvent } from '@/lib/posthog/server' -import { removeWorkspaceSkillMembershipsTx } from '@/lib/skills/access' +import { revokeWorkspaceAccessTx } from '@/lib/workspaces/access/workspace-access' import { hasWorkspaceAdminAccess, isOrganizationAdminOrOwner, } from '@/lib/workspaces/permissions/utils' -import { - reassignWorkflowOwnershipForWorkspaceMemberRemovalTx, - transferWorkspaceOwnershipToBilledAccountForMemberRemovalTx, - WorkspaceBillingAccountRemovalError, -} from '@/lib/workspaces/utils' +import { WorkspaceBillingAccountRemovalError } from '@/lib/workspaces/utils' const logger = createLogger('WorkspaceMemberAPI') @@ -147,41 +142,11 @@ export const DELETE = withRouteHandler( } } - const { ownershipTransferred, workflowOwnershipReassignment } = await db.transaction( - async (tx) => { - const didTransferOwnership = - await transferWorkspaceOwnershipToBilledAccountForMemberRemovalTx({ - tx, - workspaceId, - departingUserId: userId, - }) - - const workflowOwnershipReassignment = - await reassignWorkflowOwnershipForWorkspaceMemberRemovalTx({ - tx, - workspaceIds: [workspaceId], - departingUserId: userId, - }) - if (workflowOwnershipReassignment.unresolved.length > 0) { - throw new WorkspaceBillingAccountRemovalError() - } - - await tx - .delete(permissions) - .where( - and( - eq(permissions.userId, userId), - eq(permissions.entityType, 'workspace'), - eq(permissions.entityId, workspaceId) - ) - ) - - await revokeWorkspaceCredentialMembershipsTx(tx, workspaceId, userId) - await removeWorkspaceSkillMembershipsTx(tx, workspaceId, userId) - - return { ownershipTransferred: didTransferOwnership, workflowOwnershipReassignment } - } + const revocation = await db.transaction((tx) => + revokeWorkspaceAccessTx(tx, { workspaceId, userId }) ) + if (!revocation.revoked) throw new WorkspaceBillingAccountRemovalError() + const { ownershipTransferred } = revocation /** * Seats are tied to organization membership (one per member), so a @@ -270,7 +235,6 @@ export const DELETE = withRouteHandler( removedUserRole: userPermission?.permissionType ?? 'owner', selfRemoval: isSelf, ownershipTransferred, - workflowOwnershipReassignment, organizationRemoval, seatReduction, }, diff --git a/apps/sim/ee/scim/components/scim-section.tsx b/apps/sim/ee/scim/components/scim-section.tsx index 5c9b4c8c211..c7c32d38393 100644 --- a/apps/sim/ee/scim/components/scim-section.tsx +++ b/apps/sim/ee/scim/components/scim-section.tsx @@ -435,7 +435,8 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp

{connection.userCount} provisioned member{connection.userCount === 1 ? '' : 's'},{' '} {connection.groupCount} group{connection.groupCount === 1 ? '' : 's'}. Last request{' '} - {formatRelative(connection.lastRequestAt)}. + {formatRelative(connection.lastRequestAt)}; last reconciled{' '} + {formatRelative(connection.reconciledAt)}.

@@ -448,7 +449,7 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp > void handleToggleSetting(toggle.key, checked)} disabled={configure.isPending} /> diff --git a/apps/sim/lib/api/contracts/organization-scim.ts b/apps/sim/lib/api/contracts/organization-scim.ts index f000e31c67f..af2f1908884 100644 --- a/apps/sim/lib/api/contracts/organization-scim.ts +++ b/apps/sim/lib/api/contracts/organization-scim.ts @@ -53,7 +53,7 @@ export const getScimConnectionContract = defineRouteContract({ params: organizationParamsSchema, response: { mode: 'json', - schema: z.object({ connection: scimConnectionSchema.nullable(), baseUrl: z.string() }), + schema: z.object({ connection: scimConnectionSchema.nullable() }), }, }) @@ -73,7 +73,6 @@ export const issueScimCredentialContract = defineRouteContract({ path: '/api/organizations/[id]/scim/credentials', params: organizationParamsSchema, body: z.object({ - scopes: z.array(scimScopeSchema).min(1).optional(), /** Days until the credential stops working. Omitted means it does not expire. */ expiresInDays: z.number().int().min(1).max(3650).optional(), }), diff --git a/apps/sim/lib/api/server/routes/scim-route.test.ts b/apps/sim/lib/api/server/routes/scim-route.test.ts new file mode 100644 index 00000000000..cd3109c599b --- /dev/null +++ b/apps/sim/lib/api/server/routes/scim-route.test.ts @@ -0,0 +1,195 @@ +/** + * @vitest-environment node + */ +import { resetEnvFlagsMock, setEnvFlags } from '@sim/testing' +import { NextRequest } from 'next/server' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + checkRateLimitDirect: vi.fn(), + enforceIpRateLimit: vi.fn(), +})) + +vi.mock('@/lib/core/rate-limiter', () => ({ + RateLimiter: class { + checkRateLimitDirect = mocks.checkRateLimitDirect + }, + enforceIpRateLimit: mocks.enforceIpRateLimit, +})) + +import type { ScimConnectionPrincipal } from '@sim/auth/principal' +import { + createScimUserContract, + deleteScimUserContract, + listScimUsersContract, +} from '@/lib/api/contracts/scim' +import { createScimRouteBuilder } from '@/lib/api/server/routes/scim-route' +import { scimOperations } from '@/lib/scim/application/operations' +import { SCIM_MEDIA_TYPE } from '@/lib/scim/protocol/constants' +import { ScimError } from '@/lib/scim/protocol/errors' + +const principal: ScimConnectionPrincipal = { + kind: 'scim_connection', + organizationId: 'org-1', + connectionId: 'conn-1', + credentialId: 'cred-1', + scopes: ['users:read', 'users:write'], +} + +const authenticate = vi.fn() +const recordRequest = vi.fn() +const defineScimRoute = createScimRouteBuilder({ + authenticate, + baseUrl: () => 'https://sim.test/api/scim/v2', + recordRequest, +}) + +const listUsers = defineScimRoute({ + contract: listScimUsersContract, + operation: scimOperations.listUsers, + useCase: { operation: scimOperations.listUsers, execute: vi.fn() }, + mapInput: () => ({}), + present: () => ({ + schemas: ['urn:ietf:params:scim:api:messages:2.0:ListResponse'], + totalResults: 0, + startIndex: 1, + itemsPerPage: 0, + Resources: [], + }), +}) + +const createUser = defineScimRoute({ + contract: createScimUserContract, + operation: scimOperations.provisionUser, + useCase: { operation: scimOperations.provisionUser, execute: vi.fn().mockResolvedValue({}) }, + mapInput: () => ({}), + present: () => ({ + schemas: ['urn:ietf:params:scim:schemas:core:2.0:User'], + id: 'su-1', + meta: { + resourceType: 'User', + created: '2026-01-01T00:00:00.000Z', + lastModified: '2026-01-01T00:00:00.000Z', + location: 'https://sim.test/api/scim/v2/Users/su-1', + version: 'W/"1"', + }, + }), + headers: () => ({ Location: 'https://sim.test/api/scim/v2/Users/su-1' }), +}) + +const deleteUser = defineScimRoute({ + contract: deleteScimUserContract, + operation: scimOperations.deprovisionUser, + useCase: { operation: scimOperations.deprovisionUser, execute: vi.fn().mockResolvedValue({}) }, + mapInput: () => ({}), +}) + +const withParams = { params: Promise.resolve({ id: 'su-1' }) } + +function request(method: string, path: string, init: RequestInit = {}) { + return new NextRequest(`https://sim.test${path}`, { method, ...init }) +} + +afterEach(resetEnvFlagsMock) + +describe('SCIM route builder', () => { + beforeEach(() => { + vi.clearAllMocks() + setEnvFlags({ isScimEnabled: true }) + authenticate.mockResolvedValue(principal) + mocks.checkRateLimitDirect.mockResolvedValue({ allowed: true, resetAt: new Date() }) + mocks.enforceIpRateLimit.mockResolvedValue(null) + }) + + it('hides the whole surface, wrong method included, when the feature is off', async () => { + setEnvFlags({ isScimEnabled: false }) + const response = await listUsers(request('POST', '/api/scim/v2/Users'), undefined) + expect(response.status).toBe(404) + expect(authenticate).not.toHaveBeenCalled() + }) + + it('answers in the SCIM media type with the RFC envelope', async () => { + const response = await listUsers(request('GET', '/api/scim/v2/Users'), undefined) + expect(response.status).toBe(200) + expect(response.headers.get('content-type')).toBe(SCIM_MEDIA_TYPE) + expect(recordRequest).toHaveBeenCalledWith(expect.objectContaining({ status: 200, principal })) + }) + + it('refuses a body without a SCIM or JSON content type before authenticating', async () => { + const response = await createUser( + request('POST', '/api/scim/v2/Users', { + body: '{}', + headers: { 'content-type': 'text/plain' }, + }), + undefined + ) + expect(response.status).toBe(415) + expect(authenticate).not.toHaveBeenCalled() + }) + + it('lets DELETE through with no body and no content type, answering 204', async () => { + const response = await deleteUser(request('DELETE', '/api/scim/v2/Users/su-1'), withParams) + expect(response.status).toBe(204) + expect(await response.text()).toBe('') + }) + + it('adds the Location header on a create', async () => { + const response = await createUser( + request('POST', '/api/scim/v2/Users', { + body: JSON.stringify({ + schemas: ['urn:ietf:params:scim:schemas:core:2.0:User'], + userName: 'ada@acme.test', + }), + headers: { 'content-type': SCIM_MEDIA_TYPE }, + }), + undefined + ) + expect(response.status).toBe(201) + expect(response.headers.get('location')).toBe('https://sim.test/api/scim/v2/Users/su-1') + }) + + it('renders a parse failure in the SCIM envelope', async () => { + const response = await createUser( + request('POST', '/api/scim/v2/Users', { + body: '{not json', + headers: { 'content-type': 'application/json' }, + }), + undefined + ) + expect(response.status).toBe(400) + expect(await response.json()).toMatchObject({ + schemas: ['urn:ietf:params:scim:api:messages:2.0:Error'], + status: '400', + scimType: 'invalidSyntax', + }) + }) + + it('bounds failed authentication per address and renders 401 with the challenge', async () => { + authenticate.mockRejectedValue( + new ScimError(401, undefined, 'Invalid SCIM credential', { + 'WWW-Authenticate': 'Bearer realm="SCIM"', + }) + ) + const refused = await listUsers(request('GET', '/api/scim/v2/Users'), undefined) + expect(refused.status).toBe(401) + expect(refused.headers.get('www-authenticate')).toBe('Bearer realm="SCIM"') + expect(mocks.enforceIpRateLimit).toHaveBeenCalledWith('scim-auth', expect.anything()) + expect(recordRequest).not.toHaveBeenCalled() + + mocks.enforceIpRateLimit.mockResolvedValue(new Response(null, { status: 429 })) + const limited = await listUsers(request('GET', '/api/scim/v2/Users'), undefined) + expect(limited.status).toBe(429) + expect(limited.headers.get('retry-after')).toBe('60') + }) + + it('throttles an authenticated connection with Retry-After', async () => { + mocks.checkRateLimitDirect.mockResolvedValue({ + allowed: false, + resetAt: new Date(Date.now() + 5000), + }) + const response = await listUsers(request('GET', '/api/scim/v2/Users'), undefined) + expect(response.status).toBe(429) + expect(response.headers.get('retry-after')).toBeTruthy() + expect(recordRequest).toHaveBeenCalledWith(expect.objectContaining({ status: 429 })) + }) +}) diff --git a/apps/sim/lib/api/server/routes/scim-route.ts b/apps/sim/lib/api/server/routes/scim-route.ts index 9bb5ffbff21..0c090b17a35 100644 --- a/apps/sim/lib/api/server/routes/scim-route.ts +++ b/apps/sim/lib/api/server/routes/scim-route.ts @@ -6,17 +6,17 @@ import { type ParsedRequest, parseRequest } from '@/lib/api/server/validation' import type { ApplicationOperation, OperationUseCase } from '@/lib/core/application/operation' import { isScimEnabled } from '@/lib/core/config/env-flags' import { enforceIpRateLimit, RateLimiter } from '@/lib/core/rate-limiter' -import { getBaseUrl } from '@/lib/core/utils/urls' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import type { ScimConnectionAuthenticator } from '@/lib/scim/authenticate' +import { scimBaseUrl } from '@/lib/scim/base-url' import { SCIM_ACCEPTED_MEDIA_TYPES, - SCIM_BASE_PATH, SCIM_MAX_BODY_BYTES, SCIM_MEDIA_TYPE, SCIM_RATE_LIMIT, } from '@/lib/scim/protocol/constants' import { ScimError, type ScimType, scimErrorBody, toScimError } from '@/lib/scim/protocol/errors' +import type { ScimRequestLogEntry } from '@/lib/scim/request-log' const logger = createLogger('ScimRoute') const rateLimiter = new RateLimiter() @@ -68,17 +68,6 @@ export interface ScimRouteDependencies { recordRequest(entry: ScimRequestLogEntry): void } -export interface ScimRequestLogEntry { - principal: ScimConnectionPrincipal - method: string - path: string - status: number - scimType?: ScimType - detail?: string - userAgent: string | null - durationMs: number -} - function scimResponse(body: unknown, status: number, headers?: Record): Response { return NextResponse.json(body, { status, @@ -164,11 +153,11 @@ export function createScimRouteBuilder(dependencies: ScimRouteDependencies) { let detail: string | undefined try { + /** A deployment without the feature exposes no provisioning surface at all. */ + if (!isScimEnabled) throw new ScimError(404, undefined, 'Not found') if (request.method !== options.contract.method) { throw new ScimError(405, undefined, `${request.method} is not supported here`) } - /** A deployment without the feature exposes no provisioning surface at all. */ - if (!isScimEnabled) throw new ScimError(404, undefined, 'Not found') assertAcceptableMediaType(request) /** @@ -310,7 +299,7 @@ export function defineScimDiscoveryRoute( }) } const params = context?.params ? await context.params : {} - return scimResponse(build(`${getBaseUrl()}${SCIM_BASE_PATH}`, params), 200) + return scimResponse(build(scimBaseUrl(), params), 200) } catch (error) { return scimErrorResponse(toScimError(error)) } diff --git a/apps/sim/lib/auth/sso/application/admit-sso-user.ts b/apps/sim/lib/auth/sso/application/admit-sso-user.ts index d75e535b8d1..6daff577519 100644 --- a/apps/sim/lib/auth/sso/application/admit-sso-user.ts +++ b/apps/sim/lib/auth/sso/application/admit-sso-user.ts @@ -7,14 +7,13 @@ import { permissions, scimConnection, ssoProvider, - subscription, user, workspace, } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { normalizeSSODomain } from '@sim/utils/sso-domain' import { normalizeEmail } from '@sim/utils/string' -import { and, desc, eq, gt, inArray, isNull, sql } from 'drizzle-orm' +import { and, eq, gt, isNull, sql } from 'drizzle-orm' import { applySessionPolicyToNewMember } from '@/lib/auth/session-policy' import { ssoJitAdmissionOperation } from '@/lib/auth/sso/application/operations' import { syncUsageLimitsFromSubscription } from '@/lib/billing/core/usage' @@ -22,9 +21,8 @@ import { acquireOrganizationUserMutationLocks, ensureUserInOrganizationTx, } from '@/lib/billing/organizations/membership' +import { resolveOrganizationSeatPolicyTx } from '@/lib/billing/organizations/seat-policy' import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' -import { isTeam } from '@/lib/billing/plan-helpers' -import { ENTITLED_SUBSCRIPTION_STATUSES } from '@/lib/billing/subscriptions/utils' import { assertOperationPrincipal, type OperationUseCase } from '@/lib/core/application/operation' import { captureServerEvent } from '@/lib/posthog/server' @@ -248,27 +246,12 @@ async function runAdmissionTransaction( } } - const [organizationSubscription] = await tx - .select({ id: subscription.id, plan: subscription.plan }) - .from(subscription) - .where( - and( - eq(subscription.referenceId, provider.organizationId), - inArray(subscription.status, ENTITLED_SUBSCRIPTION_STATUSES) - ) - ) - .orderBy(desc(subscription.periodStart), desc(subscription.id)) - .limit(1) - + const seatPolicy = await resolveOrganizationSeatPolicyTx(tx, provider.organizationId) const membershipResult = await ensureUserInOrganizationTx(tx, { userId, organizationId: provider.organizationId, role: 'member', - /** Team seats grow to the committed member count; Enterprise remains fixed-capacity. */ - ...(isTeam(organizationSubscription?.plan) ? { skipSeatValidation: true } : {}), - ...(organizationSubscription?.id - ? { organizationSubscriptionId: organizationSubscription.id } - : {}), + ...seatPolicy, }) if (!membershipResult.success || !membershipResult.memberId) { @@ -285,8 +268,8 @@ async function runAdmissionTransaction( return { ...attribution, - ...(organizationSubscription?.id - ? { organizationSubscriptionId: organizationSubscription.id } + ...(seatPolicy.organizationSubscriptionId + ? { organizationSubscriptionId: seatPolicy.organizationSubscriptionId } : {}), result: { kind: membershipResult.alreadyMember ? 'already-member' : 'provisioned', diff --git a/apps/sim/lib/billing/organizations/membership.ts b/apps/sim/lib/billing/organizations/membership.ts index b60cca4b149..884a745b378 100644 --- a/apps/sim/lib/billing/organizations/membership.ts +++ b/apps/sim/lib/billing/organizations/membership.ts @@ -24,7 +24,10 @@ import { getErrorMessage } from '@sim/utils/errors' import { generateId } from '@sim/utils/id' import { normalizeEmail } from '@sim/utils/string' import { and, count, desc, eq, inArray, isNull, ne, or, sql } from 'drizzle-orm' -import { invalidateMembershipCache } from '@/lib/auth/security-policy' +import { + invalidateMembershipCache, + invalidateSecurityPolicyVersionCache, +} from '@/lib/auth/security-policy' import { applySessionPolicyToNewMember } from '@/lib/auth/session-policy' import { syncUsageLimitsFromSubscription } from '@/lib/billing/core/usage' import { @@ -47,6 +50,11 @@ import { enqueueOutboxEvent } from '@/lib/core/outbox/service' import { revokeWorkspaceCredentialMembershipsTx } from '@/lib/credentials/access' import type { DbOrTx } from '@/lib/db/types' import { acquireInvitationMutationLocks } from '@/lib/invitations/locks' +import { + revokePersonalApiKeysTx, + revokeUserSessionsTx, +} from '@/lib/organizations/members/revocation' +import { endDirectoryMembershipTx } from '@/lib/scim/identity/end-directory-membership' import { removeWorkspaceSkillMembershipsTx } from '@/lib/skills/access' import { reassignWorkflowOwnershipForWorkspaceMemberRemovalTx, @@ -1330,6 +1338,17 @@ export async function removeUserFromOrganization( ) ) + /** + * Leaving ends live access at once: sessions and personal API keys go + * with the membership rather than lingering until a cookie cache lapses, + * and any directory row that described this membership is replaced by + * its tombstone in the same commit, so the directory and the + * organization can never disagree about who is a member. + */ + await revokeUserSessionsTx(tx, { userId, organizationId }) + await revokePersonalApiKeysTx(tx, { userId }) + await endDirectoryMembershipTx(tx, { userId, organizationId }) + if (workspaceIds.length === 0) { return { skipped: false as const, @@ -1403,6 +1422,7 @@ export async function removeUserFromOrganization( // The departed member's cookie-version/hook-clamp fallbacks must stop // resolving to this org immediately, not after the membership-cache TTL. invalidateMembershipCache(userId) + invalidateSecurityPolicyVersionCache(organizationId) logger.info('Removed member from organization', { organizationId, diff --git a/apps/sim/lib/billing/organizations/seat-policy.ts b/apps/sim/lib/billing/organizations/seat-policy.ts new file mode 100644 index 00000000000..4ed76960ff1 --- /dev/null +++ b/apps/sim/lib/billing/organizations/seat-policy.ts @@ -0,0 +1,36 @@ +import { subscription } from '@sim/db/schema' +import { and, desc, eq, inArray } from 'drizzle-orm' +import { isTeam } from '@/lib/billing/plan-helpers' +import { ENTITLED_SUBSCRIPTION_STATUSES } from '@/lib/billing/subscriptions/utils' +import type { DbOrTx } from '@/lib/db/types' + +/** + * How admission into an organization treats seats. + * + * Team plans add a seat when someone joins; Enterprise buys a fixed number in + * advance and must refuse beyond it. SSO just-in-time admission and directory + * provisioning share this rule so a first sign-in and a directory push agree on + * who fits, and both hand the same subscription id to the seat reconciliation + * that follows a successful join. + */ +export async function resolveOrganizationSeatPolicyTx( + tx: DbOrTx, + organizationId: string +): Promise<{ skipSeatValidation?: true; organizationSubscriptionId?: string }> { + const [entitled] = await tx + .select({ id: subscription.id, plan: subscription.plan }) + .from(subscription) + .where( + and( + eq(subscription.referenceId, organizationId), + inArray(subscription.status, ENTITLED_SUBSCRIPTION_STATUSES) + ) + ) + .orderBy(desc(subscription.periodStart), desc(subscription.id)) + .limit(1) + + return { + ...(isTeam(entitled?.plan) ? { skipSeatValidation: true as const } : {}), + ...(entitled?.id ? { organizationSubscriptionId: entitled.id } : {}), + } +} diff --git a/apps/sim/lib/execution/sandbox/bundles/docx.cjs b/apps/sim/lib/execution/sandbox/bundles/docx.cjs index 8422580d836..333aef7cdf2 100644 --- a/apps/sim/lib/execution/sandbox/bundles/docx.cjs +++ b/apps/sim/lib/execution/sandbox/bundles/docx.cjs @@ -1,31 +1,31 @@ // sandbox bundle: docx // generated by apps/sim/lib/execution/sandbox/bundles/build.ts // do not edit by hand. run `bun run build:sandbox-bundles` to regenerate. -(()=>{var R5=Object.create;var{getPrototypeOf:L5,defineProperty:r1,getOwnPropertyNames:I5}=Object;var O5=Object.prototype.hasOwnProperty;function H5(B){return this[B]}var F5,W5,P5=(B,U,G)=>{var Y=B!=null&&typeof B==="object";if(Y){var Q=U?F5??=new WeakMap:W5??=new WeakMap,K=Q.get(B);if(K)return K}G=B!=null?R5(L5(B)):{};let Z=U||!B||!B.__esModule?r1(G,"default",{value:B,enumerable:!0}):G;for(let J of I5(B))if(!O5.call(Z,J))r1(Z,J,{get:H5.bind(B,J),enumerable:!0});if(Y)Q.set(B,Z);return Z};var A5=(B,U)=>()=>(U||B((U={exports:{}}).exports,U),U.exports);var j5=(B)=>B;function N5(B,U){this[B]=j5.bind(null,U)}var z5=(B,U)=>{for(var G in U)r1(B,G,{get:U[G],enumerable:!0,configurable:!0,set:N5.bind(U,G)})};var h6=A5((L7,_6)=>{var w0=_6.exports={},p0,r0;function Z8(){throw Error("setTimeout has not been defined")}function Q8(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")p0=setTimeout;else p0=Z8}catch(B){p0=Z8}try{if(typeof clearTimeout==="function")r0=clearTimeout;else r0=Q8}catch(B){r0=Q8}})();function g6(B){if(p0===setTimeout)return setTimeout(B,0);if((p0===Z8||!p0)&&setTimeout)return p0=setTimeout,setTimeout(B,0);try{return p0(B,0)}catch(U){try{return p0.call(null,B,0)}catch(G){return p0.call(this,B,0)}}}function UU(B){if(r0===clearTimeout)return clearTimeout(B);if((r0===Q8||!r0)&&clearTimeout)return r0=clearTimeout,clearTimeout(B);try{return r0(B)}catch(U){try{return r0.call(null,B)}catch(G){return r0.call(this,B)}}}var Q2=[],b2=!1,w2,z1=-1;function GU(){if(!b2||!w2)return;if(b2=!1,w2.length)Q2=w2.concat(Q2);else z1=-1;if(Q2.length)f6()}function f6(){if(b2)return;var B=g6(GU);b2=!0;var U=Q2.length;while(U){w2=Q2,Q2=[];while(++z11)for(var G=1;G"u")A1.global=globalThis;if(typeof A1.__require>"u")A1.__require=(B)=>{throw Error(`Dynamic require of "${B}" is not supported in the sandbox`)};var l0=[],h0=[],i1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(N2=0,H6=i1.length;N20)throw Error("Invalid string. Length must be a multiple of 4");var G=B.indexOf("=");if(G===-1)G=U;var Y=G===U?0:4-G%4;return[G,Y]}function E5(B,U){return(B+U)*3/4-U}function D5(B){var U,G=w5(B),Y=G[0],Q=G[1],K=new Uint8Array(E5(Y,Q)),Z=0,J=Q>0?Y-4:Y,q;for(q=0;q>16&255,K[Z++]=U>>8&255,K[Z++]=U&255;if(Q===2)U=h0[B.charCodeAt(q)]<<2|h0[B.charCodeAt(q+1)]>>4,K[Z++]=U&255;if(Q===1)U=h0[B.charCodeAt(q)]<<10|h0[B.charCodeAt(q+1)]<<4|h0[B.charCodeAt(q+2)]>>2,K[Z++]=U>>8&255,K[Z++]=U&255;return K}function T5(B){return l0[B>>18&63]+l0[B>>12&63]+l0[B>>6&63]+l0[B&63]}function C5(B,U,G){var Y,Q=[];for(var K=U;KJ?J:Z+K));if(Y===1)U=B[G-1],Q.push(l0[U>>2]+l0[U<<4&63]+"==");else if(Y===2)U=(B[G-2]<<8)+B[G-1],Q.push(l0[U>>10]+l0[U>>4&63]+l0[U<<2&63]+"=");return Q.join("")}function j1(B,U,G,Y,Q){var K,Z,J=Q*8-Y-1,q=(1<>1,I=-7,H=G?Q-1:0,T=G?-1:1,A=B[U+H];H+=T,K=A&(1<<-I)-1,A>>=-I,I+=J;for(;I>0;K=K*256+B[U+H],H+=T,I-=8);Z=K&(1<<-I)-1,K>>=-I,I+=Y;for(;I>0;Z=Z*256+B[U+H],H+=T,I-=8);if(K===0)K=1-W;else if(K===q)return Z?NaN:(A?-1:1)*(1/0);else Z=Z+Math.pow(2,Y),K=K-W;return(A?-1:1)*Z*Math.pow(2,K-Y)}function N6(B,U,G,Y,Q,K){var Z,J,q,W=K*8-Q-1,I=(1<>1,T=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=Y?0:K-1,P=Y?1:-1,j=U<0||U===0&&1/U<0?1:0;if(U=Math.abs(U),isNaN(U)||U===1/0)J=isNaN(U)?1:0,Z=I;else{if(Z=Math.floor(Math.log(U)/Math.LN2),U*(q=Math.pow(2,-Z))<1)Z--,q*=2;if(Z+H>=1)U+=T/q;else U+=T*Math.pow(2,1-H);if(U*q>=2)Z++,q/=2;if(Z+H>=I)J=0,Z=I;else if(Z+H>=1)J=(U*q-1)*Math.pow(2,Q),Z=Z+H;else J=U*Math.pow(2,H-1)*Math.pow(2,Q),Z=0}for(;Q>=8;B[G+A]=J&255,A+=P,J/=256,Q-=8);Z=Z<0;B[G+A]=Z&255,A+=P,Z/=256,W-=8);B[G+A-P]|=j*128}var W6=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,k5=50,n1=2147483647;var{btoa:Z7,atob:Q7,File:J7,Blob:K7}=globalThis;function Z2(B){if(B>n1)throw RangeError('The value "'+B+'" is invalid for option "size"');let U=new Uint8Array(B);return Object.setPrototypeOf(U,J0.prototype),U}function B8(B,U,G){return class extends G{constructor(){super();Object.defineProperty(this,"message",{value:U.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}var $5=B8("ERR_BUFFER_OUT_OF_BOUNDS",function(B){if(B)return`${B} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),S5=B8("ERR_INVALID_ARG_TYPE",function(B,U){return`The "${B}" argument must be of type number. Received type ${typeof U}`},TypeError),s1=B8("ERR_OUT_OF_RANGE",function(B,U,G){let Y=`The value of "${B}" is out of range.`,Q=G;if(Number.isInteger(G)&&Math.abs(G)>4294967296)Q=j6(String(G));else if(typeof G==="bigint"){if(Q=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))Q=j6(Q);Q+="n"}return Y+=` It must be ${U}. Received ${Q}`,Y},RangeError);function J0(B,U,G){if(typeof B==="number"){if(typeof U==="string")throw TypeError('The "string" argument must be of type string. Received type number');return U8(B)}return z6(B,U,G)}Object.defineProperty(J0.prototype,"parent",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.buffer}});Object.defineProperty(J0.prototype,"offset",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.byteOffset}});J0.poolSize=8192;function z6(B,U,G){if(typeof B==="string")return v5(B,U);if(ArrayBuffer.isView(B))return y5(B);if(B==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(a0(B,ArrayBuffer)||B&&a0(B.buffer,ArrayBuffer))return t1(B,U,G);if(typeof SharedArrayBuffer<"u"&&(a0(B,SharedArrayBuffer)||B&&a0(B.buffer,SharedArrayBuffer)))return t1(B,U,G);if(typeof B==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Y=B.valueOf&&B.valueOf();if(Y!=null&&Y!==B)return J0.from(Y,U,G);let Q=g5(B);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]==="function")return J0.from(B[Symbol.toPrimitive]("string"),U,G);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}J0.from=function(B,U,G){return z6(B,U,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);function w6(B){if(typeof B!=="number")throw TypeError('"size" argument must be of type number');else if(B<0)throw RangeError('The value "'+B+'" is invalid for option "size"')}function b5(B,U,G){if(w6(B),B<=0)return Z2(B);if(U!==void 0)return typeof G==="string"?Z2(B).fill(U,G):Z2(B).fill(U);return Z2(B)}J0.alloc=function(B,U,G){return b5(B,U,G)};function U8(B){return w6(B),Z2(B<0?0:G8(B)|0)}J0.allocUnsafe=function(B){return U8(B)};J0.allocUnsafeSlow=function(B){return U8(B)};function v5(B,U){if(typeof U!=="string"||U==="")U="utf8";if(!J0.isEncoding(U))throw TypeError("Unknown encoding: "+U);let G=E6(B,U)|0,Y=Z2(G),Q=Y.write(B,U);if(Q!==G)Y=Y.slice(0,Q);return Y}function o1(B){let U=B.length<0?0:G8(B.length)|0,G=Z2(U);for(let Y=0;Y=n1)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n1.toString(16)+" bytes");return B|0}J0.isBuffer=function(B){return B!=null&&B._isBuffer===!0&&B!==J0.prototype};J0.compare=function(B,U){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(a0(U,Uint8Array))U=J0.from(U,U.offset,U.byteLength);if(!J0.isBuffer(B)||!J0.isBuffer(U))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(B===U)return 0;let G=B.length,Y=U.length;for(let Q=0,K=Math.min(G,Y);QY.length){if(!J0.isBuffer(K))K=J0.from(K);K.copy(Y,Q)}else Uint8Array.prototype.set.call(Y,K,Q);else if(!J0.isBuffer(K))throw TypeError('"list" argument must be an Array of Buffers');else K.copy(Y,Q);Q+=K.length}return Y};function E6(B,U){if(J0.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||a0(B,ArrayBuffer))return B.byteLength;if(typeof B!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);let G=B.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&G===0)return 0;let Q=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return e1(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return y6(B).length;default:if(Q)return Y?-1:e1(B).length;U=(""+U).toLowerCase(),Q=!0}}J0.byteLength=E6;function f5(B,U,G){let Y=!1;if(U===void 0||U<0)U=0;if(U>this.length)return"";if(G===void 0||G>this.length)G=this.length;if(G<=0)return"";if(G>>>=0,U>>>=0,G<=U)return"";if(!B)B="utf8";while(!0)switch(B){case"hex":return p5(this,U,G);case"utf8":case"utf-8":return T6(this,U,G);case"ascii":return l5(this,U,G);case"latin1":case"binary":return a5(this,U,G);case"base64":return c5(this,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r5(this,U,G);default:if(Y)throw TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),Y=!0}}J0.prototype._isBuffer=!0;function z2(B,U,G){let Y=B[U];B[U]=B[G],B[G]=Y}J0.prototype.swap16=function(){let B=this.length;if(B%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let U=0;UU)B+=" ... ";return""};if(W6)J0.prototype[W6]=J0.prototype.inspect;J0.prototype.compare=function(B,U,G,Y,Q){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(!J0.isBuffer(B))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof B);if(U===void 0)U=0;if(G===void 0)G=B?B.length:0;if(Y===void 0)Y=0;if(Q===void 0)Q=this.length;if(U<0||G>B.length||Y<0||Q>this.length)throw RangeError("out of range index");if(Y>=Q&&U>=G)return 0;if(Y>=Q)return-1;if(U>=G)return 1;if(U>>>=0,G>>>=0,Y>>>=0,Q>>>=0,this===B)return 0;let K=Q-Y,Z=G-U,J=Math.min(K,Z),q=this.slice(Y,Q),W=B.slice(U,G);for(let I=0;I2147483647)G=2147483647;else if(G<-2147483648)G=-2147483648;if(G=+G,Number.isNaN(G))G=Q?0:B.length-1;if(G<0)G=B.length+G;if(G>=B.length)if(Q)return-1;else G=B.length-1;else if(G<0)if(Q)G=0;else return-1;if(typeof U==="string")U=J0.from(U,Y);if(J0.isBuffer(U)){if(U.length===0)return-1;return P6(B,U,G,Y,Q)}else if(typeof U==="number"){if(U=U&255,typeof Uint8Array.prototype.indexOf==="function")if(Q)return Uint8Array.prototype.indexOf.call(B,U,G);else return Uint8Array.prototype.lastIndexOf.call(B,U,G);return P6(B,[U],G,Y,Q)}throw TypeError("val must be string, number or Buffer")}function P6(B,U,G,Y,Q){let K=1,Z=B.length,J=U.length;if(Y!==void 0){if(Y=String(Y).toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le"){if(B.length<2||U.length<2)return-1;K=2,Z/=2,J/=2,G/=2}}function q(I,H){if(K===1)return I[H];else return I.readUInt16BE(H*K)}let W;if(Q){let I=-1;for(W=G;WZ)G=Z-J;for(W=G;W>=0;W--){let I=!0;for(let H=0;HQ)Y=Q;let K=U.length;if(Y>K/2)Y=K/2;let Z;for(Z=0;Z>>0,isFinite(G)){if(G=G>>>0,Y===void 0)Y="utf8"}else Y=G,G=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-U;if(G===void 0||G>Q)G=Q;if(B.length>0&&(G<0||U<0)||U>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!Y)Y="utf8";let K=!1;for(;;)switch(Y){case"hex":return x5(this,B,U,G);case"utf8":case"utf-8":return _5(this,B,U,G);case"ascii":case"latin1":case"binary":return h5(this,B,U,G);case"base64":return u5(this,B,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d5(this,B,U,G);default:if(K)throw TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),K=!0}};J0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c5(B,U,G){if(U===0&&G===B.length)return F6(B);else return F6(B.slice(U,G))}function T6(B,U,G){G=Math.min(B.length,G);let Y=[],Q=U;while(Q239?4:K>223?3:K>191?2:1;if(Q+J<=G){let q,W,I,H;switch(J){case 1:if(K<128)Z=K;break;case 2:if(q=B[Q+1],(q&192)===128){if(H=(K&31)<<6|q&63,H>127)Z=H}break;case 3:if(q=B[Q+1],W=B[Q+2],(q&192)===128&&(W&192)===128){if(H=(K&15)<<12|(q&63)<<6|W&63,H>2047&&(H<55296||H>57343))Z=H}break;case 4:if(q=B[Q+1],W=B[Q+2],I=B[Q+3],(q&192)===128&&(W&192)===128&&(I&192)===128){if(H=(K&15)<<18|(q&63)<<12|(W&63)<<6|I&63,H>65535&&H<1114112)Z=H}}}if(Z===null)Z=65533,J=1;else if(Z>65535)Z-=65536,Y.push(Z>>>10&1023|55296),Z=56320|Z&1023;Y.push(Z),Q+=J}return m5(Y)}var A6=4096;function m5(B){let U=B.length;if(U<=A6)return String.fromCharCode.apply(String,B);let G="",Y=0;while(YY)G=Y;let Q="";for(let K=U;KG)B=G;if(U<0){if(U+=G,U<0)U=0}else if(U>G)U=G;if(UG)throw RangeError("Trying to access beyond buffer length")}J0.prototype.readUintLE=J0.prototype.readUIntLE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B+--U],Q=1;while(U>0&&(Q*=256))Y+=this[B+--U]*Q;return Y};J0.prototype.readUint8=J0.prototype.readUInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);return this[B]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]|this[B+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]<<8|this[B+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return(this[B]|this[B+1]<<8|this[B+2]<<16)+this[B+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]*16777216+(this[B+1]<<16|this[B+2]<<8|this[B+3])};J0.prototype.readBigUInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U+this[++B]*256+this[++B]*65536+this[++B]*16777216,Q=this[++B]+this[++B]*256+this[++B]*65536+G*16777216;return BigInt(Y)+(BigInt(Q)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U*16777216+this[++B]*65536+this[++B]*256+this[++B],Q=this[++B]*16777216+this[++B]*65536+this[++B]*256+G;return(BigInt(Y)<>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K=Q)Y-=Math.pow(2,8*U);return Y};J0.prototype.readIntBE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=U,Q=1,K=this[B+--Y];while(Y>0&&(Q*=256))K+=this[B+--Y]*Q;if(Q*=128,K>=Q)K-=Math.pow(2,8*U);return K};J0.prototype.readInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);if(!(this[B]&128))return this[B];return(255-this[B]+1)*-1};J0.prototype.readInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B]|this[B+1]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B+1]|this[B]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]|this[B+1]<<8|this[B+2]<<16|this[B+3]<<24};J0.prototype.readInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]<<24|this[B+1]<<16|this[B+2]<<8|this[B+3]};J0.prototype.readBigInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=this[B+4]+this[B+5]*256+this[B+6]*65536+(G<<24);return(BigInt(Y)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=(U<<24)+this[++B]*65536+this[++B]*256+this[++B];return(BigInt(Y)<>>0,!U)$0(B,4,this.length);return j1(this,B,!0,23,4)};J0.prototype.readFloatBE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return j1(this,B,!1,23,4)};J0.prototype.readDoubleLE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!0,52,8)};J0.prototype.readDoubleBE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!1,52,8)};function g0(B,U,G,Y,Q,K){if(!J0.isBuffer(B))throw TypeError('"buffer" argument must be a Buffer instance');if(U>Q||UB.length)throw RangeError("Index out of range")}J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=1,K=0;this[U]=B&255;while(++K>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=G-1,K=1;this[U+Q]=B&255;while(--Q>=0&&(K*=256))this[U+Q]=B/K&255;return U+G};J0.prototype.writeUint8=J0.prototype.writeUInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,255,0);return this[U]=B&255,U+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U+3]=B>>>24,this[U+2]=B>>>16,this[U+1]=B>>>8,this[U]=B&255,U+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};function C6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,G}function k6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G+7]=K,K=K>>8,B[G+6]=K,K=K>>8,B[G+5]=K,K=K>>8,B[G+4]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G+3]=Z,Z=Z>>8,B[G+2]=Z,Z=Z>>8,B[G+1]=Z,Z=Z>>8,B[G]=Z,G+8}J0.prototype.writeBigUInt64LE=I2(function(B,U=0){return C6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=I2(function(B,U=0){return k6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=0,K=1,Z=0;this[U]=B&255;while(++Q>0)-Z&255}return U+G};J0.prototype.writeIntBE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=G-1,K=1,Z=0;this[U+Q]=B&255;while(--Q>=0&&(K*=256)){if(B<0&&Z===0&&this[U+Q+1]!==0)Z=1;this[U+Q]=(B/K>>0)-Z&255}return U+G};J0.prototype.writeInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,127,-128);if(B<0)B=255+B+1;return this[U]=B&255,U+1};J0.prototype.writeInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);return this[U]=B&255,this[U+1]=B>>>8,this[U+2]=B>>>16,this[U+3]=B>>>24,U+4};J0.prototype.writeInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);if(B<0)B=4294967295+B+1;return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};J0.prototype.writeBigInt64LE=I2(function(B,U=0){return C6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=I2(function(B,U=0){return k6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $6(B,U,G,Y,Q,K){if(G+Y>B.length)throw RangeError("Index out of range");if(G<0)throw RangeError("Index out of range")}function S6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return N6(B,U,G,Y,23,4),G+4}J0.prototype.writeFloatLE=function(B,U,G){return S6(this,B,U,!0,G)};J0.prototype.writeFloatBE=function(B,U,G){return S6(this,B,U,!1,G)};function b6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return N6(B,U,G,Y,52,8),G+8}J0.prototype.writeDoubleLE=function(B,U,G){return b6(this,B,U,!0,G)};J0.prototype.writeDoubleBE=function(B,U,G){return b6(this,B,U,!1,G)};J0.prototype.copy=function(B,U,G,Y){if(!J0.isBuffer(B))throw TypeError("argument should be a Buffer");if(!G)G=0;if(!Y&&Y!==0)Y=this.length;if(U>=B.length)U=B.length;if(!U)U=0;if(Y>0&&Y=this.length)throw RangeError("Index out of range");if(Y<0)throw RangeError("sourceEnd out of bounds");if(Y>this.length)Y=this.length;if(B.length-U>>0,G=G===void 0?this.length:G>>>0,!B)B=0;let Q;if(typeof B==="number")for(Q=U;Q=Y+4;G-=3)U=`_${B.slice(G-3,G)}${U}`;return`${B.slice(0,G)}${U}`}function i5(B,U,G){if(S2(U,"offset"),B[U]===void 0||B[U+G]===void 0)n2(U,B.length-(G+1))}function v6(B,U,G,Y,Q,K){if(B>G||B3)if(U===0||U===BigInt(0))J=`>= 0${Z} and < 2${Z} ** ${(K+1)*8}${Z}`;else J=`>= -(2${Z} ** ${(K+1)*8-1}${Z}) and < 2 ** ${(K+1)*8-1}${Z}`;else J=`>= ${U}${Z} and <= ${G}${Z}`;throw new s1("value",J,B)}i5(Y,Q,K)}function S2(B,U){if(typeof B!=="number")throw new S5(U,"number",B)}function n2(B,U,G){if(Math.floor(B)!==B)throw S2(B,G),new s1(G||"offset","an integer",B);if(U<0)throw new $5;throw new s1(G||"offset",`>= ${G?1:0} and <= ${U}`,B)}var n5=/[^+/0-9A-Za-z-_]/g;function s5(B){if(B=B.split("=")[0],B=B.trim().replace(n5,""),B.length<2)return"";while(B.length%4!==0)B=B+"=";return B}function e1(B,U){U=U||1/0;let G,Y=B.length,Q=null,K=[];for(let Z=0;Z55295&&G<57344){if(!Q){if(G>56319){if((U-=3)>-1)K.push(239,191,189);continue}else if(Z+1===Y){if((U-=3)>-1)K.push(239,191,189);continue}Q=G;continue}if(G<56320){if((U-=3)>-1)K.push(239,191,189);Q=G;continue}G=(Q-55296<<10|G-56320)+65536}else if(Q){if((U-=3)>-1)K.push(239,191,189)}if(Q=null,G<128){if((U-=1)<0)break;K.push(G)}else if(G<2048){if((U-=2)<0)break;K.push(G>>6|192,G&63|128)}else if(G<65536){if((U-=3)<0)break;K.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((U-=4)<0)break;K.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw Error("Invalid code point")}return K}function o5(B){let U=[];for(let G=0;G>8,Q=G%256,K.push(Q),K.push(Y)}return K}function y6(B){return D5(s5(B))}function N1(B,U,G,Y){let Q;for(Q=0;Q=U.length||Q>=B.length)break;U[Q+G]=B[Q]}return Q}function a0(B,U){return B instanceof U||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===U.name}var e5=function(){let B=Array(256);for(let U=0;U<16;++U){let G=U*16;for(let Y=0;Y<16;++Y)B[G+Y]="0123456789abcdef"[U]+"0123456789abcdef"[Y]}return B}();function I2(B){return typeof BigInt>"u"?BU:B}function BU(){throw Error("BigInt not supported")}function Y8(B){return()=>{throw Error(B+" is not implemented for node:buffer browser polyfill")}}var V7=Y8("resolveObjectURL"),X7=Y8("isUtf8");var q7=Y8("transcode");var G7=P5(h6(),1);var L6={};z5(L6,{unsignedDecimalNumber:()=>X1,universalMeasureValue:()=>q1,uniqueUuid:()=>eB,uniqueNumericIdCreator:()=>I1,uniqueId:()=>O1,uCharHexNumber:()=>W8,twipsMeasureValue:()=>E0,standardizeData:()=>j4,signedTwipsMeasureValue:()=>t0,signedHpsMeasureValue:()=>VG,shortHexNumber:()=>SB,sectionPageSizeDefaults:()=>$1,sectionMarginDefaults:()=>H2,positiveUniversalMeasureValue:()=>d8,pointMeasureValue:()=>gB,percentageValue:()=>vB,patchDocument:()=>tK,patchDetector:()=>B7,measurementOrPercentValue:()=>c8,longHexNumber:()=>KG,hpsMeasureValue:()=>bB,hexColorValue:()=>C2,hashedId:()=>P8,encodeUtf8:()=>U1,eighthPointMeasureValue:()=>yB,docPropertiesUniqueNumericIdGen:()=>oB,decimalNumber:()=>T0,dateTimeValue:()=>fB,createWrapTopAndBottom:()=>H4,createWrapTight:()=>O4,createWrapSquare:()=>I4,createWrapNone:()=>j8,createVerticalPosition:()=>J4,createVerticalAlign:()=>U6,createUnderline:()=>cB,createTransformation:()=>n8,createTableWidthElement:()=>J1,createTableRowHeight:()=>W9,createTableLook:()=>F9,createTableLayout:()=>O9,createTableFloatProperties:()=>I9,createTabStopItem:()=>b4,createTabStop:()=>v4,createStringElement:()=>f2,createSpacing:()=>S4,createSimplePos:()=>G4,createShading:()=>M1,createSectionType:()=>C9,createRunFonts:()=>T1,createParagraphStyle:()=>x2,createPageSize:()=>D9,createPageNumberType:()=>E9,createPageMargin:()=>w9,createOutlineLevel:()=>_4,createMathSuperScriptProperties:()=>p4,createMathSuperScriptElement:()=>a2,createMathSubSuperScriptProperties:()=>i4,createMathSubScriptProperties:()=>r4,createMathSubScriptElement:()=>l2,createMathPreSubSuperScriptProperties:()=>n4,createMathNAryProperties:()=>e8,createMathLimitLocation:()=>a4,createMathBase:()=>y0,createMathAccentCharacter:()=>l4,createLineNumberType:()=>N9,createIndent:()=>hB,createHorizontalPosition:()=>Q4,createHeaderFooterReference:()=>k1,createFrameProperties:()=>u4,createEmphasisMark:()=>r8,createDotEmphasisMark:()=>AG,createDocumentGrid:()=>j9,createColumns:()=>A9,createBorderElement:()=>j0,createBodyProperties:()=>K4,createAlignment:()=>m8,convertToXmlComponent:()=>u1,convertMillimetersToTwip:()=>dG,convertInchesToTwip:()=>u0,concreteNumUniqueNumericIdGen:()=>sB,commentIdToParaId:()=>z4,bookmarkUniqueNumericIdGen:()=>tB,abstractNumUniqueNumericIdGen:()=>nB,YearShort:()=>oY,YearLong:()=>BZ,XmlComponent:()=>t,XmlAttributeComponent:()=>H0,WpsShapeRun:()=>SY,WpgGroupRun:()=>bY,WidthType:()=>v1,WORKAROUND4:()=>oZ,WORKAROUND3:()=>JG,WORKAROUND2:()=>NJ,VerticalPositionRelativeFrom:()=>U4,VerticalPositionAlign:()=>MG,VerticalMergeType:()=>G6,VerticalMergeRevisionType:()=>FQ,VerticalMerge:()=>w8,VerticalAnchor:()=>cG,VerticalAlignTable:()=>K9,VerticalAlignSection:()=>V9,VerticalAlign:()=>WQ,UnderlineType:()=>i8,ThematicBreak:()=>_B,Textbox:()=>TK,TextWrappingType:()=>e2,TextWrappingSide:()=>L4,TextRun:()=>Q1,TextEffect:()=>CG,TextDirection:()=>zQ,TableRowPropertiesChange:()=>P9,TableRowProperties:()=>J6,TableRow:()=>fQ,TableProperties:()=>Q6,TableOfContents:()=>RK,TableLayoutType:()=>SQ,TableCellBorders:()=>q9,TableCell:()=>Y6,TableBorders:()=>Z6,TableAnchorType:()=>DQ,Table:()=>yQ,TabStopType:()=>z8,TabStopPosition:()=>FZ,Tab:()=>T4,TDirection:()=>R9,SymbolRun:()=>aB,Styles:()=>S1,StyleLevel:()=>LK,StyleForParagraph:()=>p2,StyleForCharacter:()=>$2,StringValueElement:()=>q2,StringEnumValueElement:()=>XG,StringContainer:()=>O2,SpaceType:()=>x0,SoftHyphen:()=>iY,SimpleMailMergeField:()=>fY,SimpleField:()=>s8,ShadingType:()=>FG,SequentialIdentifier:()=>yY,Separator:()=>YZ,SectionType:()=>GJ,SectionPropertiesChange:()=>k9,SectionProperties:()=>K6,RunPropertiesDefaults:()=>a9,RunPropertiesChange:()=>lB,RunProperties:()=>U2,Run:()=>D0,RelativeVerticalPosition:()=>CQ,RelativeHorizontalPosition:()=>TQ,PrettifyType:()=>G5,PositionalTabRelativeTo:()=>XZ,PositionalTabLeader:()=>qZ,PositionalTabAlignment:()=>VZ,PositionalTab:()=>RZ,PatchType:()=>C8,ParagraphRunProperties:()=>mB,ParagraphPropertiesDefaults:()=>l9,ParagraphPropertiesChange:()=>d4,ParagraphProperties:()=>M2,Paragraph:()=>d0,PageTextDirectionType:()=>BJ,PageTextDirection:()=>T9,PageReference:()=>CZ,PageOrientation:()=>g1,PageNumberSeparator:()=>eQ,PageNumberElement:()=>QZ,PageNumber:()=>F2,PageBreakBefore:()=>$4,PageBreak:()=>LZ,PageBorders:()=>z9,PageBorderZOrder:()=>tQ,PageBorderOffsetFrom:()=>oQ,PageBorderDisplay:()=>sQ,Packer:()=>Y5,OverlapType:()=>kQ,OnOffElement:()=>q0,Numbering:()=>d9,NumberedItemReferenceFormat:()=>wZ,NumberedItemReference:()=>DZ,NumberValueElement:()=>_2,NumberProperties:()=>C1,NumberFormat:()=>RG,NoBreakHyphen:()=>rY,NextAttributeComponent:()=>$8,MonthShort:()=>sY,MonthLong:()=>eY,Media:()=>V6,MathSuperScript:()=>rZ,MathSum:()=>mZ,MathSubSuperScript:()=>nZ,MathSubScript:()=>iZ,MathSquareBrackets:()=>QQ,MathRun:()=>hZ,MathRoundBrackets:()=>ZQ,MathRadicalProperties:()=>o4,MathRadical:()=>BQ,MathPreSubSuperScript:()=>sZ,MathNumerator:()=>m4,MathLimitUpper:()=>aZ,MathLimitLower:()=>pZ,MathLimit:()=>B6,MathIntegral:()=>lZ,MathFunctionProperties:()=>e4,MathFunctionName:()=>t4,MathFunction:()=>UQ,MathFraction:()=>uZ,MathDenominator:()=>c4,MathDegree:()=>s4,MathCurlyBrackets:()=>JQ,MathAngledBrackets:()=>KQ,Math:()=>xZ,LineRuleType:()=>k2,LineNumberRestartFormat:()=>nQ,LevelSuffix:()=>TJ,LevelOverride:()=>u9,LevelFormat:()=>i0,LevelForOverride:()=>$J,LevelBase:()=>X6,Level:()=>h9,LeaderType:()=>HZ,LastRenderedPageBreak:()=>KZ,InternalHyperlink:()=>y4,InsertedTextRun:()=>MQ,InsertedTableRow:()=>U9,InsertedTableCell:()=>Y9,InitializableXmlComponent:()=>u8,ImportedXmlComponent:()=>kB,ImportedRootElementAttributes:()=>$B,ImageRun:()=>$Y,IgnoreIfEmptyXmlComponent:()=>R2,HyperlinkType:()=>jZ,HpsMeasureElement:()=>D1,HorizontalPositionRelativeFrom:()=>B4,HorizontalPositionAlign:()=>qG,HighlightColor:()=>kG,HeightRule:()=>gQ,HeadingLevel:()=>OZ,HeaderWrapper:()=>_9,HeaderFooterType:()=>E8,HeaderFooterReferenceType:()=>T2,Header:()=>IK,GridSpan:()=>M9,FrameWrap:()=>fZ,FrameAnchorType:()=>gZ,FootnoteReferenceRun:()=>HK,FootnoteReferenceElement:()=>GZ,FootnoteReference:()=>o9,FooterWrapper:()=>f9,Footer:()=>OK,FootNotes:()=>x9,FootNoteReferenceRunAttributes:()=>s9,FileChild:()=>H1,File:()=>VK,ExternalHyperlink:()=>t8,Endnotes:()=>g9,EndnoteReferenceRunAttributes:()=>t9,EndnoteReferenceRun:()=>FK,EndnoteReference:()=>D4,EndnoteIdReference:()=>e9,EmptyElement:()=>S0,EmphasisMarkType:()=>p8,EMPTY_OBJECT:()=>KB,DropCapType:()=>yZ,Drawing:()=>m1,DocumentGridType:()=>iQ,DocumentDefaults:()=>p9,DocumentBackgroundAttributes:()=>S9,DocumentBackground:()=>b9,DocumentAttributes:()=>F1,DocumentAttributeNamespaces:()=>y1,Document:()=>VK,DeletedTextRun:()=>OQ,DeletedTableRow:()=>G9,DeletedTableCell:()=>Z9,DayShort:()=>nY,DayLong:()=>tY,ContinuationSeparator:()=>ZZ,ConcreteNumbering:()=>T8,ConcreteHyperlink:()=>m2,CommentsExtended:()=>E4,Comments:()=>w4,CommentReference:()=>mY,CommentRangeStart:()=>dY,CommentRangeEnd:()=>cY,Comment:()=>N8,ColumnBreak:()=>IZ,Column:()=>ZJ,CheckBoxUtil:()=>B5,CheckBoxSymbolElement:()=>b1,CheckBox:()=>WK,CharacterSet:()=>kZ,CellMergeAttributes:()=>Q9,CellMerge:()=>J9,CarriageReturn:()=>JZ,BuilderElement:()=>M0,BorderStyle:()=>c1,Border:()=>xB,BookmarkStart:()=>f4,BookmarkEnd:()=>x4,Bookmark:()=>g4,Body:()=>$9,BaseXmlComponent:()=>Y1,Attributes:()=>C0,AnnotationReference:()=>UZ,AlignmentType:()=>c0,AbstractNumbering:()=>D8});var{create:YU,defineProperty:QB,getOwnPropertyDescriptor:ZU,getOwnPropertyNames:QU,getPrototypeOf:JU}=Object,KU=Object.prototype.hasOwnProperty,JB=(B,U)=>()=>(B&&(U=B(B=0)),U),R0=(B,U)=>()=>(U||(B((U={exports:{}}).exports,U),B=null),U.exports),VU=(B,U,G,Y)=>{if(U&&typeof U==="object"||typeof U==="function"){for(var Q=QU(U),K=0,Z=Q.length,J;KU[q]).bind(null,J),enumerable:!(Y=ZU(U,J))||Y.enumerable})}return B},k8=(B,U,G)=>(G=B!=null?YU(JU(B)):{},VU(U||!B||!B.__esModule?QB(G,"default",{value:B,enumerable:!0}):G,B)),w1=((B)=>__require)(function(B){return __require.apply(this,arguments)});function G1(B){return G1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},G1(B)}function XU(B,U){if(G1(B)!="object"||!B)return B;var G=B[Symbol.toPrimitive];if(G!==void 0){var Y=G.call(B,U||"default");if(G1(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return(U==="string"?String:Number)(B)}function qU(B){var U=XU(B,"string");return G1(U)=="symbol"?U:U+""}function e(B,U,G){return(U=qU(U))in B?Object.defineProperty(B,U,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[U]=G,B}var Y1=class{constructor(B){e(this,"rootKey",void 0),this.rootKey=B}},KB=Object.seal({}),t=class extends Y1{constructor(B){super(B);e(this,"root",void 0),this.root=[]}prepForXml(B){var U;B.stack.push(this);let G=this.root.map((Y)=>{if(Y instanceof Y1)return Y.prepForXml(B);return Y}).filter((Y)=>Y!==void 0);return B.stack.pop(),{[this.rootKey]:G.length?G.length===1&&((U=G[0])===null||U===void 0?void 0:U._attr)?G[0]:G:KB}}addChildElement(B){return this.root.push(B),this}},R2=class extends t{constructor(B,U){super(B);e(this,"includeIfEmpty",void 0),this.includeIfEmpty=U}prepForXml(B){let U=super.prepForXml(B);if(this.includeIfEmpty)return U;if(U&&(typeof U[this.rootKey]!=="object"||Object.keys(U[this.rootKey]).length))return U}};function u6(B,U){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);U&&(Y=Y.filter(function(Q){return Object.getOwnPropertyDescriptor(B,Q).enumerable})),G.push.apply(G,Y)}return G}function L0(B){for(var U=1;U{if(Y!==void 0){let Q=this.xmlKeys&&this.xmlKeys[G]||G;U[Q]=Y}}),{_attr:U}}},$8=class extends Y1{constructor(B){super("_attr");e(this,"root",void 0),this.root=B}prepForXml(B){return{_attr:Object.values(this.root).filter(({value:U})=>U!==void 0).reduce((U,{key:G,value:Y})=>L0(L0({},U),{},{[G]:Y}),{})}}},C0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}},S8=R0((B,U)=>{var G=typeof Reflect==="object"?Reflect:null,Y=G&&typeof G.apply==="function"?G.apply:function($,x,z){return Function.prototype.apply.call($,x,z)},Q;if(G&&typeof G.ownKeys==="function")Q=G.ownKeys;else if(Object.getOwnPropertySymbols)Q=function($){return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($))};else Q=function($){return Object.getOwnPropertyNames($)};function K(M){if(console&&console.warn)console.warn(M)}var Z=Number.isNaN||function($){return $!==$};function J(){J.init.call(this)}U.exports=J,U.exports.once=v,J.EventEmitter=J,J.prototype._events=void 0,J.prototype._eventsCount=0,J.prototype._maxListeners=void 0;var q=10;function W(M){if(typeof M!=="function")throw TypeError('The "listener" argument must be of type Function. Received type '+typeof M)}Object.defineProperty(J,"defaultMaxListeners",{enumerable:!0,get:function(){return q},set:function(M){if(typeof M!=="number"||M<0||Z(M))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+M+".");q=M}}),J.init=function(){if(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)this._events=Object.create(null),this._eventsCount=0;this._maxListeners=this._maxListeners||void 0},J.prototype.setMaxListeners=function($){if(typeof $!=="number"||$<0||Z($))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+$+".");return this._maxListeners=$,this};function I(M){if(M._maxListeners===void 0)return J.defaultMaxListeners;return M._maxListeners}J.prototype.getMaxListeners=function(){return I(this)},J.prototype.emit=function($){var x=[];for(var z=1;z0)b=x[0];if(b instanceof Error)throw b;var c=Error("Unhandled error."+(b?" ("+b.message+")":""));throw c.context=b,c}var D=U0[$];if(D===void 0)return!1;if(typeof D==="function")Y(D,this,x);else{var m=D.length,B0=E(D,m);for(var z=0;z0&&b.length>a&&!b.warned){b.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+b.length+" "+String($)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=M,c.type=$,c.count=b.length,K(c)}}return M}J.prototype.addListener=function($,x){return H(this,$,x,!1)},J.prototype.on=J.prototype.addListener,J.prototype.prependListener=function($,x){return H(this,$,x,!0)};function T(){if(!this.fired){if(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0)return this.listener.call(this.target);return this.listener.apply(this.target,arguments)}}function A(M,$,x){var z={fired:!1,wrapFn:void 0,target:M,type:$,listener:x},a=T.bind(z);return a.listener=x,z.wrapFn=a,a}J.prototype.once=function($,x){return W(x),this.on($,A(this,$,x)),this},J.prototype.prependOnceListener=function($,x){return W(x),this.prependListener($,A(this,$,x)),this},J.prototype.removeListener=function($,x){var z,a,U0,b,c;if(W(x),a=this._events,a===void 0)return this;if(z=a[$],z===void 0)return this;if(z===x||z.listener===x){if(--this._eventsCount===0)this._events=Object.create(null);else if(delete a[$],a.removeListener)this.emit("removeListener",$,z.listener||x)}else if(typeof z!=="function"){U0=-1;for(b=z.length-1;b>=0;b--)if(z[b]===x||z[b].listener===x){c=z[b].listener,U0=b;break}if(U0<0)return this;if(U0===0)z.shift();else C(z,U0);if(z.length===1)a[$]=z[0];if(a.removeListener!==void 0)this.emit("removeListener",$,c||x)}return this},J.prototype.off=J.prototype.removeListener,J.prototype.removeAllListeners=function($){var x,z=this._events,a;if(z===void 0)return this;if(z.removeListener===void 0){if(arguments.length===0)this._events=Object.create(null),this._eventsCount=0;else if(z[$]!==void 0)if(--this._eventsCount===0)this._events=Object.create(null);else delete z[$];return this}if(arguments.length===0){var U0=Object.keys(z),b;for(a=0;a=0;a--)this.removeListener($,x[a]);return this};function P(M,$,x){var z=M._events;if(z===void 0)return[];var a=z[$];if(a===void 0)return[];if(typeof a==="function")return x?[a.listener||a]:[a];return x?N(a):E(a,a.length)}J.prototype.listeners=function($){return P(this,$,!0)},J.prototype.rawListeners=function($){return P(this,$,!1)},J.listenerCount=function(M,$){if(typeof M.listenerCount==="function")return M.listenerCount($);else return j.call(M,$)},J.prototype.listenerCount=j;function j(M){var $=this._events;if($!==void 0){var x=$[M];if(typeof x==="function")return 1;else if(x!==void 0)return x.length}return 0}J.prototype.eventNames=function(){return this._eventsCount>0?Q(this._events):[]};function E(M,$){var x=Array($);for(var z=0;z<$;++z)x[z]=M[z];return x}function C(M,$){for(;$+1{if(typeof Object.create==="function")U.exports=function(Y,Q){if(Q)Y.super_=Q,Y.prototype=Object.create(Q.prototype,{constructor:{value:Y,enumerable:!1,writable:!0,configurable:!0}})};else U.exports=function(Y,Q){if(Q){Y.super_=Q;var K=function(){};K.prototype=Q.prototype,Y.prototype=new K,Y.prototype.constructor=Y}}}),v0,d2=JB(()=>{v0=globalThis||self});function MU(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function O8(){throw Error("setTimeout has not been defined")}function H8(){throw Error("clearTimeout has not been defined")}function VB(B){if(n0===setTimeout)return setTimeout(B,0);if((n0===O8||!n0)&&setTimeout)return n0=setTimeout,setTimeout(B,0);try{return n0(B,0)}catch(U){try{return n0.call(null,B,0)}catch(G){return n0.call(this,B,0)}}}function RU(B){if(s0===clearTimeout)return clearTimeout(B);if((s0===H8||!s0)&&clearTimeout)return s0=clearTimeout,clearTimeout(B);try{return s0(B)}catch(U){try{return s0.call(null,B)}catch(G){return s0.call(this,B)}}}function LU(){if(!D2||!E2)return;if(D2=!1,E2.length)o0=E2.concat(o0);else B1=-1;if(o0.length)XB()}function XB(){if(D2)return;var B=VB(LU);D2=!0;var U=o0.length;while(U){E2=o0,o0=[];while(++B1{J8={exports:{}},N0=J8.exports={},function(){try{if(typeof setTimeout==="function")n0=setTimeout;else n0=O8}catch(B){n0=O8}try{if(typeof clearTimeout==="function")s0=clearTimeout;else s0=H8}catch(B){s0=H8}}(),o0=[],D2=!1,B1=-1,N0.nextTick=function(B){var U=Array(arguments.length-1);if(arguments.length>1)for(var G=1;G{U.exports=S8().EventEmitter}),IU=R0((B)=>{B.byteLength=q,B.toByteArray=I,B.fromByteArray=A;var U=[],G=[],Y=typeof Uint8Array<"u"?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var K=0,Z=Q.length;K0)throw Error("Invalid string. Length must be a multiple of 4");var E=P.indexOf("=");if(E===-1)E=j;var C=E===j?0:4-E%4;return[E,C]}function q(P){var j=J(P),E=j[0],C=j[1];return(E+C)*3/4-C}function W(P,j,E){return(j+E)*3/4-E}function I(P){var j,E=J(P),C=E[0],N=E[1],v=new Y(W(P,C,N)),S=0,F=N>0?C-4:C,M;for(M=0;M>16&255,v[S++]=j>>8&255,v[S++]=j&255;if(N===2)j=G[P.charCodeAt(M)]<<2|G[P.charCodeAt(M+1)]>>4,v[S++]=j&255;if(N===1)j=G[P.charCodeAt(M)]<<10|G[P.charCodeAt(M+1)]<<4|G[P.charCodeAt(M+2)]>>2,v[S++]=j>>8&255,v[S++]=j&255;return v}function H(P){return U[P>>18&63]+U[P>>12&63]+U[P>>6&63]+U[P&63]}function T(P,j,E){var C,N=[];for(var v=j;vF?F:S+v));if(C===1)j=P[E-1],N.push(U[j>>2]+U[j<<4&63]+"==");else if(C===2)j=(P[E-2]<<8)+P[E-1],N.push(U[j>>10]+U[j>>4&63]+U[j<<2&63]+"=");return N.join("")}}),OU=R0((B)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */B.read=function(U,G,Y,Q,K){var Z,J,q=K*8-Q-1,W=(1<>1,H=-7,T=Y?K-1:0,A=Y?-1:1,P=U[G+T];T+=A,Z=P&(1<<-H)-1,P>>=-H,H+=q;for(;H>0;Z=Z*256+U[G+T],T+=A,H-=8);J=Z&(1<<-H)-1,Z>>=-H,H+=Q;for(;H>0;J=J*256+U[G+T],T+=A,H-=8);if(Z===0)Z=1-I;else if(Z===W)return J?NaN:(P?-1:1)*(1/0);else J=J+Math.pow(2,Q),Z=Z-I;return(P?-1:1)*J*Math.pow(2,Z-Q)},B.write=function(U,G,Y,Q,K,Z){var J,q,W,I=Z*8-K-1,H=(1<>1,A=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=Q?0:Z-1,j=Q?1:-1,E=G<0||G===0&&1/G<0?1:0;if(G=Math.abs(G),isNaN(G)||G===1/0)q=isNaN(G)?1:0,J=H;else{if(J=Math.floor(Math.log(G)/Math.LN2),G*(W=Math.pow(2,-J))<1)J--,W*=2;if(J+T>=1)G+=A/W;else G+=A*Math.pow(2,1-T);if(G*W>=2)J++,W/=2;if(J+T>=H)q=0,J=H;else if(J+T>=1)q=(G*W-1)*Math.pow(2,K),J=J+T;else q=G*Math.pow(2,T-1)*Math.pow(2,K),J=0}for(;K>=8;U[Y+P]=q&255,P+=j,q/=256,K-=8);J=J<0;U[Y+P]=J&255,P+=j,J/=256,I-=8);U[Y+P-j]|=E*128}});/*! +(()=>{var R5=Object.create;var{getPrototypeOf:L5,defineProperty:r1,getOwnPropertyNames:I5}=Object;var O5=Object.prototype.hasOwnProperty;function H5(B){return this[B]}var F5,W5,P5=(B,U,G)=>{var Y=B!=null&&typeof B==="object";if(Y){var Q=U?F5??=new WeakMap:W5??=new WeakMap,K=Q.get(B);if(K)return K}G=B!=null?R5(L5(B)):{};let Z=U||!B||!B.__esModule?r1(G,"default",{value:B,enumerable:!0}):G;for(let J of I5(B))if(!O5.call(Z,J))r1(Z,J,{get:H5.bind(B,J),enumerable:!0});if(Y)Q.set(B,Z);return Z};var A5=(B,U)=>()=>(U||B((U={exports:{}}).exports,U),U.exports);var j5=(B)=>B;function N5(B,U){this[B]=j5.bind(null,U)}var w5=(B,U)=>{for(var G in U)r1(B,G,{get:U[G],enumerable:!0,configurable:!0,set:N5.bind(U,G)})};var h6=A5((L7,_6)=>{var z0=_6.exports={},p0,r0;function Z8(){throw Error("setTimeout has not been defined")}function Q8(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")p0=setTimeout;else p0=Z8}catch(B){p0=Z8}try{if(typeof clearTimeout==="function")r0=clearTimeout;else r0=Q8}catch(B){r0=Q8}})();function g6(B){if(p0===setTimeout)return setTimeout(B,0);if((p0===Z8||!p0)&&setTimeout)return p0=setTimeout,setTimeout(B,0);try{return p0(B,0)}catch(U){try{return p0.call(null,B,0)}catch(G){return p0.call(this,B,0)}}}function UU(B){if(r0===clearTimeout)return clearTimeout(B);if((r0===Q8||!r0)&&clearTimeout)return r0=clearTimeout,clearTimeout(B);try{return r0(B)}catch(U){try{return r0.call(null,B)}catch(G){return r0.call(this,B)}}}var Q2=[],b2=!1,z2,w1=-1;function GU(){if(!b2||!z2)return;if(b2=!1,z2.length)Q2=z2.concat(Q2);else w1=-1;if(Q2.length)f6()}function f6(){if(b2)return;var B=g6(GU);b2=!0;var U=Q2.length;while(U){z2=Q2,Q2=[];while(++w11)for(var G=1;G"u")A1.global=globalThis;if(typeof A1.__require>"u")A1.__require=(B)=>{throw Error(`Dynamic require of "${B}" is not supported in the sandbox`)};var l0=[],h0=[],i1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(N2=0,H6=i1.length;N20)throw Error("Invalid string. Length must be a multiple of 4");var G=B.indexOf("=");if(G===-1)G=U;var Y=G===U?0:4-G%4;return[G,Y]}function E5(B,U){return(B+U)*3/4-U}function D5(B){var U,G=z5(B),Y=G[0],Q=G[1],K=new Uint8Array(E5(Y,Q)),Z=0,J=Q>0?Y-4:Y,q;for(q=0;q>16&255,K[Z++]=U>>8&255,K[Z++]=U&255;if(Q===2)U=h0[B.charCodeAt(q)]<<2|h0[B.charCodeAt(q+1)]>>4,K[Z++]=U&255;if(Q===1)U=h0[B.charCodeAt(q)]<<10|h0[B.charCodeAt(q+1)]<<4|h0[B.charCodeAt(q+2)]>>2,K[Z++]=U>>8&255,K[Z++]=U&255;return K}function T5(B){return l0[B>>18&63]+l0[B>>12&63]+l0[B>>6&63]+l0[B&63]}function C5(B,U,G){var Y,Q=[];for(var K=U;KJ?J:Z+K));if(Y===1)U=B[G-1],Q.push(l0[U>>2]+l0[U<<4&63]+"==");else if(Y===2)U=(B[G-2]<<8)+B[G-1],Q.push(l0[U>>10]+l0[U>>4&63]+l0[U<<2&63]+"=");return Q.join("")}function j1(B,U,G,Y,Q){var K,Z,J=Q*8-Y-1,q=(1<>1,I=-7,H=G?Q-1:0,T=G?-1:1,A=B[U+H];H+=T,K=A&(1<<-I)-1,A>>=-I,I+=J;for(;I>0;K=K*256+B[U+H],H+=T,I-=8);Z=K&(1<<-I)-1,K>>=-I,I+=Y;for(;I>0;Z=Z*256+B[U+H],H+=T,I-=8);if(K===0)K=1-W;else if(K===q)return Z?NaN:(A?-1:1)*(1/0);else Z=Z+Math.pow(2,Y),K=K-W;return(A?-1:1)*Z*Math.pow(2,K-Y)}function N6(B,U,G,Y,Q,K){var Z,J,q,W=K*8-Q-1,I=(1<>1,T=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=Y?0:K-1,P=Y?1:-1,j=U<0||U===0&&1/U<0?1:0;if(U=Math.abs(U),isNaN(U)||U===1/0)J=isNaN(U)?1:0,Z=I;else{if(Z=Math.floor(Math.log(U)/Math.LN2),U*(q=Math.pow(2,-Z))<1)Z--,q*=2;if(Z+H>=1)U+=T/q;else U+=T*Math.pow(2,1-H);if(U*q>=2)Z++,q/=2;if(Z+H>=I)J=0,Z=I;else if(Z+H>=1)J=(U*q-1)*Math.pow(2,Q),Z=Z+H;else J=U*Math.pow(2,H-1)*Math.pow(2,Q),Z=0}for(;Q>=8;B[G+A]=J&255,A+=P,J/=256,Q-=8);Z=Z<0;B[G+A]=Z&255,A+=P,Z/=256,W-=8);B[G+A-P]|=j*128}var W6=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,k5=50,n1=2147483647;var{btoa:Z7,atob:Q7,File:J7,Blob:K7}=globalThis;function Z2(B){if(B>n1)throw RangeError('The value "'+B+'" is invalid for option "size"');let U=new Uint8Array(B);return Object.setPrototypeOf(U,J0.prototype),U}function B8(B,U,G){return class extends G{constructor(){super();Object.defineProperty(this,"message",{value:U.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}var $5=B8("ERR_BUFFER_OUT_OF_BOUNDS",function(B){if(B)return`${B} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),S5=B8("ERR_INVALID_ARG_TYPE",function(B,U){return`The "${B}" argument must be of type number. Received type ${typeof U}`},TypeError),s1=B8("ERR_OUT_OF_RANGE",function(B,U,G){let Y=`The value of "${B}" is out of range.`,Q=G;if(Number.isInteger(G)&&Math.abs(G)>4294967296)Q=j6(String(G));else if(typeof G==="bigint"){if(Q=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))Q=j6(Q);Q+="n"}return Y+=` It must be ${U}. Received ${Q}`,Y},RangeError);function J0(B,U,G){if(typeof B==="number"){if(typeof U==="string")throw TypeError('The "string" argument must be of type string. Received type number');return U8(B)}return w6(B,U,G)}Object.defineProperty(J0.prototype,"parent",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.buffer}});Object.defineProperty(J0.prototype,"offset",{enumerable:!0,get:function(){if(!J0.isBuffer(this))return;return this.byteOffset}});J0.poolSize=8192;function w6(B,U,G){if(typeof B==="string")return v5(B,U);if(ArrayBuffer.isView(B))return y5(B);if(B==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(a0(B,ArrayBuffer)||B&&a0(B.buffer,ArrayBuffer))return t1(B,U,G);if(typeof SharedArrayBuffer<"u"&&(a0(B,SharedArrayBuffer)||B&&a0(B.buffer,SharedArrayBuffer)))return t1(B,U,G);if(typeof B==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let Y=B.valueOf&&B.valueOf();if(Y!=null&&Y!==B)return J0.from(Y,U,G);let Q=g5(B);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]==="function")return J0.from(B[Symbol.toPrimitive]("string"),U,G);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}J0.from=function(B,U,G){return w6(B,U,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);function z6(B){if(typeof B!=="number")throw TypeError('"size" argument must be of type number');else if(B<0)throw RangeError('The value "'+B+'" is invalid for option "size"')}function b5(B,U,G){if(z6(B),B<=0)return Z2(B);if(U!==void 0)return typeof G==="string"?Z2(B).fill(U,G):Z2(B).fill(U);return Z2(B)}J0.alloc=function(B,U,G){return b5(B,U,G)};function U8(B){return z6(B),Z2(B<0?0:G8(B)|0)}J0.allocUnsafe=function(B){return U8(B)};J0.allocUnsafeSlow=function(B){return U8(B)};function v5(B,U){if(typeof U!=="string"||U==="")U="utf8";if(!J0.isEncoding(U))throw TypeError("Unknown encoding: "+U);let G=E6(B,U)|0,Y=Z2(G),Q=Y.write(B,U);if(Q!==G)Y=Y.slice(0,Q);return Y}function o1(B){let U=B.length<0?0:G8(B.length)|0,G=Z2(U);for(let Y=0;Y=n1)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n1.toString(16)+" bytes");return B|0}J0.isBuffer=function(B){return B!=null&&B._isBuffer===!0&&B!==J0.prototype};J0.compare=function(B,U){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(a0(U,Uint8Array))U=J0.from(U,U.offset,U.byteLength);if(!J0.isBuffer(B)||!J0.isBuffer(U))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(B===U)return 0;let G=B.length,Y=U.length;for(let Q=0,K=Math.min(G,Y);QY.length){if(!J0.isBuffer(K))K=J0.from(K);K.copy(Y,Q)}else Uint8Array.prototype.set.call(Y,K,Q);else if(!J0.isBuffer(K))throw TypeError('"list" argument must be an Array of Buffers');else K.copy(Y,Q);Q+=K.length}return Y};function E6(B,U){if(J0.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||a0(B,ArrayBuffer))return B.byteLength;if(typeof B!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);let G=B.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&G===0)return 0;let Q=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return e1(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return y6(B).length;default:if(Q)return Y?-1:e1(B).length;U=(""+U).toLowerCase(),Q=!0}}J0.byteLength=E6;function f5(B,U,G){let Y=!1;if(U===void 0||U<0)U=0;if(U>this.length)return"";if(G===void 0||G>this.length)G=this.length;if(G<=0)return"";if(G>>>=0,U>>>=0,G<=U)return"";if(!B)B="utf8";while(!0)switch(B){case"hex":return p5(this,U,G);case"utf8":case"utf-8":return T6(this,U,G);case"ascii":return l5(this,U,G);case"latin1":case"binary":return a5(this,U,G);case"base64":return c5(this,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r5(this,U,G);default:if(Y)throw TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),Y=!0}}J0.prototype._isBuffer=!0;function w2(B,U,G){let Y=B[U];B[U]=B[G],B[G]=Y}J0.prototype.swap16=function(){let B=this.length;if(B%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let U=0;UU)B+=" ... ";return""};if(W6)J0.prototype[W6]=J0.prototype.inspect;J0.prototype.compare=function(B,U,G,Y,Q){if(a0(B,Uint8Array))B=J0.from(B,B.offset,B.byteLength);if(!J0.isBuffer(B))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof B);if(U===void 0)U=0;if(G===void 0)G=B?B.length:0;if(Y===void 0)Y=0;if(Q===void 0)Q=this.length;if(U<0||G>B.length||Y<0||Q>this.length)throw RangeError("out of range index");if(Y>=Q&&U>=G)return 0;if(Y>=Q)return-1;if(U>=G)return 1;if(U>>>=0,G>>>=0,Y>>>=0,Q>>>=0,this===B)return 0;let K=Q-Y,Z=G-U,J=Math.min(K,Z),q=this.slice(Y,Q),W=B.slice(U,G);for(let I=0;I2147483647)G=2147483647;else if(G<-2147483648)G=-2147483648;if(G=+G,Number.isNaN(G))G=Q?0:B.length-1;if(G<0)G=B.length+G;if(G>=B.length)if(Q)return-1;else G=B.length-1;else if(G<0)if(Q)G=0;else return-1;if(typeof U==="string")U=J0.from(U,Y);if(J0.isBuffer(U)){if(U.length===0)return-1;return P6(B,U,G,Y,Q)}else if(typeof U==="number"){if(U=U&255,typeof Uint8Array.prototype.indexOf==="function")if(Q)return Uint8Array.prototype.indexOf.call(B,U,G);else return Uint8Array.prototype.lastIndexOf.call(B,U,G);return P6(B,[U],G,Y,Q)}throw TypeError("val must be string, number or Buffer")}function P6(B,U,G,Y,Q){let K=1,Z=B.length,J=U.length;if(Y!==void 0){if(Y=String(Y).toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le"){if(B.length<2||U.length<2)return-1;K=2,Z/=2,J/=2,G/=2}}function q(I,H){if(K===1)return I[H];else return I.readUInt16BE(H*K)}let W;if(Q){let I=-1;for(W=G;WZ)G=Z-J;for(W=G;W>=0;W--){let I=!0;for(let H=0;HQ)Y=Q;let K=U.length;if(Y>K/2)Y=K/2;let Z;for(Z=0;Z>>0,isFinite(G)){if(G=G>>>0,Y===void 0)Y="utf8"}else Y=G,G=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-U;if(G===void 0||G>Q)G=Q;if(B.length>0&&(G<0||U<0)||U>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!Y)Y="utf8";let K=!1;for(;;)switch(Y){case"hex":return x5(this,B,U,G);case"utf8":case"utf-8":return _5(this,B,U,G);case"ascii":case"latin1":case"binary":return h5(this,B,U,G);case"base64":return u5(this,B,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d5(this,B,U,G);default:if(K)throw TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),K=!0}};J0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c5(B,U,G){if(U===0&&G===B.length)return F6(B);else return F6(B.slice(U,G))}function T6(B,U,G){G=Math.min(B.length,G);let Y=[],Q=U;while(Q239?4:K>223?3:K>191?2:1;if(Q+J<=G){let q,W,I,H;switch(J){case 1:if(K<128)Z=K;break;case 2:if(q=B[Q+1],(q&192)===128){if(H=(K&31)<<6|q&63,H>127)Z=H}break;case 3:if(q=B[Q+1],W=B[Q+2],(q&192)===128&&(W&192)===128){if(H=(K&15)<<12|(q&63)<<6|W&63,H>2047&&(H<55296||H>57343))Z=H}break;case 4:if(q=B[Q+1],W=B[Q+2],I=B[Q+3],(q&192)===128&&(W&192)===128&&(I&192)===128){if(H=(K&15)<<18|(q&63)<<12|(W&63)<<6|I&63,H>65535&&H<1114112)Z=H}}}if(Z===null)Z=65533,J=1;else if(Z>65535)Z-=65536,Y.push(Z>>>10&1023|55296),Z=56320|Z&1023;Y.push(Z),Q+=J}return m5(Y)}var A6=4096;function m5(B){let U=B.length;if(U<=A6)return String.fromCharCode.apply(String,B);let G="",Y=0;while(YY)G=Y;let Q="";for(let K=U;KG)B=G;if(U<0){if(U+=G,U<0)U=0}else if(U>G)U=G;if(UG)throw RangeError("Trying to access beyond buffer length")}J0.prototype.readUintLE=J0.prototype.readUIntLE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B+--U],Q=1;while(U>0&&(Q*=256))Y+=this[B+--U]*Q;return Y};J0.prototype.readUint8=J0.prototype.readUInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);return this[B]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]|this[B+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);return this[B]<<8|this[B+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return(this[B]|this[B+1]<<8|this[B+2]<<16)+this[B+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]*16777216+(this[B+1]<<16|this[B+2]<<8|this[B+3])};J0.prototype.readBigUInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U+this[++B]*256+this[++B]*65536+this[++B]*16777216,Q=this[++B]+this[++B]*256+this[++B]*65536+G*16777216;return BigInt(Y)+(BigInt(Q)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=U*16777216+this[++B]*65536+this[++B]*256+this[++B],Q=this[++B]*16777216+this[++B]*65536+this[++B]*256+G;return(BigInt(Y)<>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=this[B],Q=1,K=0;while(++K=Q)Y-=Math.pow(2,8*U);return Y};J0.prototype.readIntBE=function(B,U,G){if(B=B>>>0,U=U>>>0,!G)$0(B,U,this.length);let Y=U,Q=1,K=this[B+--Y];while(Y>0&&(Q*=256))K+=this[B+--Y]*Q;if(Q*=128,K>=Q)K-=Math.pow(2,8*U);return K};J0.prototype.readInt8=function(B,U){if(B=B>>>0,!U)$0(B,1,this.length);if(!(this[B]&128))return this[B];return(255-this[B]+1)*-1};J0.prototype.readInt16LE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B]|this[B+1]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt16BE=function(B,U){if(B=B>>>0,!U)$0(B,2,this.length);let G=this[B+1]|this[B]<<8;return G&32768?G|4294901760:G};J0.prototype.readInt32LE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]|this[B+1]<<8|this[B+2]<<16|this[B+3]<<24};J0.prototype.readInt32BE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return this[B]<<24|this[B+1]<<16|this[B+2]<<8|this[B+3]};J0.prototype.readBigInt64LE=I2(function(B){B=B>>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=this[B+4]+this[B+5]*256+this[B+6]*65536+(G<<24);return(BigInt(Y)<>>0,S2(B,"offset");let U=this[B],G=this[B+7];if(U===void 0||G===void 0)n2(B,this.length-8);let Y=(U<<24)+this[++B]*65536+this[++B]*256+this[++B];return(BigInt(Y)<>>0,!U)$0(B,4,this.length);return j1(this,B,!0,23,4)};J0.prototype.readFloatBE=function(B,U){if(B=B>>>0,!U)$0(B,4,this.length);return j1(this,B,!1,23,4)};J0.prototype.readDoubleLE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!0,52,8)};J0.prototype.readDoubleBE=function(B,U){if(B=B>>>0,!U)$0(B,8,this.length);return j1(this,B,!1,52,8)};function g0(B,U,G,Y,Q,K){if(!J0.isBuffer(B))throw TypeError('"buffer" argument must be a Buffer instance');if(U>Q||UB.length)throw RangeError("Index out of range")}J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=1,K=0;this[U]=B&255;while(++K>>0,G=G>>>0,!Y){let Z=Math.pow(2,8*G)-1;g0(this,B,U,G,Z,0)}let Q=G-1,K=1;this[U+Q]=B&255;while(--Q>=0&&(K*=256))this[U+Q]=B/K&255;return U+G};J0.prototype.writeUint8=J0.prototype.writeUInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,255,0);return this[U]=B&255,U+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,65535,0);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U+3]=B>>>24,this[U+2]=B>>>16,this[U+1]=B>>>8,this[U]=B&255,U+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,4294967295,0);return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};function C6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K,K=K>>8,B[G++]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,Z=Z>>8,B[G++]=Z,G}function k6(B,U,G,Y,Q){v6(U,Y,Q,B,G,7);let K=Number(U&BigInt(4294967295));B[G+7]=K,K=K>>8,B[G+6]=K,K=K>>8,B[G+5]=K,K=K>>8,B[G+4]=K;let Z=Number(U>>BigInt(32)&BigInt(4294967295));return B[G+3]=Z,Z=Z>>8,B[G+2]=Z,Z=Z>>8,B[G+1]=Z,Z=Z>>8,B[G]=Z,G+8}J0.prototype.writeBigUInt64LE=I2(function(B,U=0){return C6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=I2(function(B,U=0){return k6(this,B,U,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=0,K=1,Z=0;this[U]=B&255;while(++Q>0)-Z&255}return U+G};J0.prototype.writeIntBE=function(B,U,G,Y){if(B=+B,U=U>>>0,!Y){let J=Math.pow(2,8*G-1);g0(this,B,U,G,J-1,-J)}let Q=G-1,K=1,Z=0;this[U+Q]=B&255;while(--Q>=0&&(K*=256)){if(B<0&&Z===0&&this[U+Q+1]!==0)Z=1;this[U+Q]=(B/K>>0)-Z&255}return U+G};J0.prototype.writeInt8=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,1,127,-128);if(B<0)B=255+B+1;return this[U]=B&255,U+1};J0.prototype.writeInt16LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B&255,this[U+1]=B>>>8,U+2};J0.prototype.writeInt16BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,2,32767,-32768);return this[U]=B>>>8,this[U+1]=B&255,U+2};J0.prototype.writeInt32LE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);return this[U]=B&255,this[U+1]=B>>>8,this[U+2]=B>>>16,this[U+3]=B>>>24,U+4};J0.prototype.writeInt32BE=function(B,U,G){if(B=+B,U=U>>>0,!G)g0(this,B,U,4,2147483647,-2147483648);if(B<0)B=4294967295+B+1;return this[U]=B>>>24,this[U+1]=B>>>16,this[U+2]=B>>>8,this[U+3]=B&255,U+4};J0.prototype.writeBigInt64LE=I2(function(B,U=0){return C6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=I2(function(B,U=0){return k6(this,B,U,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $6(B,U,G,Y,Q,K){if(G+Y>B.length)throw RangeError("Index out of range");if(G<0)throw RangeError("Index out of range")}function S6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return N6(B,U,G,Y,23,4),G+4}J0.prototype.writeFloatLE=function(B,U,G){return S6(this,B,U,!0,G)};J0.prototype.writeFloatBE=function(B,U,G){return S6(this,B,U,!1,G)};function b6(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$6(B,U,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return N6(B,U,G,Y,52,8),G+8}J0.prototype.writeDoubleLE=function(B,U,G){return b6(this,B,U,!0,G)};J0.prototype.writeDoubleBE=function(B,U,G){return b6(this,B,U,!1,G)};J0.prototype.copy=function(B,U,G,Y){if(!J0.isBuffer(B))throw TypeError("argument should be a Buffer");if(!G)G=0;if(!Y&&Y!==0)Y=this.length;if(U>=B.length)U=B.length;if(!U)U=0;if(Y>0&&Y=this.length)throw RangeError("Index out of range");if(Y<0)throw RangeError("sourceEnd out of bounds");if(Y>this.length)Y=this.length;if(B.length-U>>0,G=G===void 0?this.length:G>>>0,!B)B=0;let Q;if(typeof B==="number")for(Q=U;Q=Y+4;G-=3)U=`_${B.slice(G-3,G)}${U}`;return`${B.slice(0,G)}${U}`}function i5(B,U,G){if(S2(U,"offset"),B[U]===void 0||B[U+G]===void 0)n2(U,B.length-(G+1))}function v6(B,U,G,Y,Q,K){if(B>G||B3)if(U===0||U===BigInt(0))J=`>= 0${Z} and < 2${Z} ** ${(K+1)*8}${Z}`;else J=`>= -(2${Z} ** ${(K+1)*8-1}${Z}) and < 2 ** ${(K+1)*8-1}${Z}`;else J=`>= ${U}${Z} and <= ${G}${Z}`;throw new s1("value",J,B)}i5(Y,Q,K)}function S2(B,U){if(typeof B!=="number")throw new S5(U,"number",B)}function n2(B,U,G){if(Math.floor(B)!==B)throw S2(B,G),new s1(G||"offset","an integer",B);if(U<0)throw new $5;throw new s1(G||"offset",`>= ${G?1:0} and <= ${U}`,B)}var n5=/[^+/0-9A-Za-z-_]/g;function s5(B){if(B=B.split("=")[0],B=B.trim().replace(n5,""),B.length<2)return"";while(B.length%4!==0)B=B+"=";return B}function e1(B,U){U=U||1/0;let G,Y=B.length,Q=null,K=[];for(let Z=0;Z55295&&G<57344){if(!Q){if(G>56319){if((U-=3)>-1)K.push(239,191,189);continue}else if(Z+1===Y){if((U-=3)>-1)K.push(239,191,189);continue}Q=G;continue}if(G<56320){if((U-=3)>-1)K.push(239,191,189);Q=G;continue}G=(Q-55296<<10|G-56320)+65536}else if(Q){if((U-=3)>-1)K.push(239,191,189)}if(Q=null,G<128){if((U-=1)<0)break;K.push(G)}else if(G<2048){if((U-=2)<0)break;K.push(G>>6|192,G&63|128)}else if(G<65536){if((U-=3)<0)break;K.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((U-=4)<0)break;K.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw Error("Invalid code point")}return K}function o5(B){let U=[];for(let G=0;G>8,Q=G%256,K.push(Q),K.push(Y)}return K}function y6(B){return D5(s5(B))}function N1(B,U,G,Y){let Q;for(Q=0;Q=U.length||Q>=B.length)break;U[Q+G]=B[Q]}return Q}function a0(B,U){return B instanceof U||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===U.name}var e5=function(){let B=Array(256);for(let U=0;U<16;++U){let G=U*16;for(let Y=0;Y<16;++Y)B[G+Y]="0123456789abcdef"[U]+"0123456789abcdef"[Y]}return B}();function I2(B){return typeof BigInt>"u"?BU:B}function BU(){throw Error("BigInt not supported")}function Y8(B){return()=>{throw Error(B+" is not implemented for node:buffer browser polyfill")}}var V7=Y8("resolveObjectURL"),X7=Y8("isUtf8");var q7=Y8("transcode");var G7=P5(h6(),1);var L6={};w5(L6,{unsignedDecimalNumber:()=>X1,universalMeasureValue:()=>q1,uniqueUuid:()=>eB,uniqueNumericIdCreator:()=>I1,uniqueId:()=>O1,uCharHexNumber:()=>W8,twipsMeasureValue:()=>E0,standardizeData:()=>j4,signedTwipsMeasureValue:()=>t0,signedHpsMeasureValue:()=>VG,shortHexNumber:()=>SB,sectionPageSizeDefaults:()=>$1,sectionMarginDefaults:()=>H2,positiveUniversalMeasureValue:()=>d8,pointMeasureValue:()=>gB,percentageValue:()=>vB,patchDocument:()=>tK,patchDetector:()=>B7,measurementOrPercentValue:()=>c8,longHexNumber:()=>KG,hpsMeasureValue:()=>bB,hexColorValue:()=>C2,hashedId:()=>P8,encodeUtf8:()=>U1,eighthPointMeasureValue:()=>yB,docPropertiesUniqueNumericIdGen:()=>oB,decimalNumber:()=>T0,dateTimeValue:()=>fB,createWrapTopAndBottom:()=>H4,createWrapTight:()=>O4,createWrapSquare:()=>I4,createWrapNone:()=>j8,createVerticalPosition:()=>J4,createVerticalAlign:()=>U6,createUnderline:()=>cB,createTransformation:()=>n8,createTableWidthElement:()=>J1,createTableRowHeight:()=>W9,createTableLook:()=>F9,createTableLayout:()=>O9,createTableFloatProperties:()=>I9,createTabStopItem:()=>b4,createTabStop:()=>v4,createStringElement:()=>f2,createSpacing:()=>S4,createSimplePos:()=>G4,createShading:()=>M1,createSectionType:()=>C9,createRunFonts:()=>T1,createParagraphStyle:()=>x2,createPageSize:()=>D9,createPageNumberType:()=>E9,createPageMargin:()=>z9,createOutlineLevel:()=>_4,createMathSuperScriptProperties:()=>p4,createMathSuperScriptElement:()=>a2,createMathSubSuperScriptProperties:()=>i4,createMathSubScriptProperties:()=>r4,createMathSubScriptElement:()=>l2,createMathPreSubSuperScriptProperties:()=>n4,createMathNAryProperties:()=>e8,createMathLimitLocation:()=>a4,createMathBase:()=>y0,createMathAccentCharacter:()=>l4,createLineNumberType:()=>N9,createIndent:()=>hB,createHorizontalPosition:()=>Q4,createHeaderFooterReference:()=>k1,createFrameProperties:()=>u4,createEmphasisMark:()=>r8,createDotEmphasisMark:()=>AG,createDocumentGrid:()=>j9,createColumns:()=>A9,createBorderElement:()=>j0,createBodyProperties:()=>K4,createAlignment:()=>m8,convertToXmlComponent:()=>u1,convertMillimetersToTwip:()=>dG,convertInchesToTwip:()=>u0,concreteNumUniqueNumericIdGen:()=>sB,commentIdToParaId:()=>w4,bookmarkUniqueNumericIdGen:()=>tB,abstractNumUniqueNumericIdGen:()=>nB,YearShort:()=>oY,YearLong:()=>BZ,XmlComponent:()=>t,XmlAttributeComponent:()=>H0,WpsShapeRun:()=>SY,WpgGroupRun:()=>bY,WidthType:()=>v1,WORKAROUND4:()=>oZ,WORKAROUND3:()=>JG,WORKAROUND2:()=>NJ,VerticalPositionRelativeFrom:()=>U4,VerticalPositionAlign:()=>MG,VerticalMergeType:()=>G6,VerticalMergeRevisionType:()=>FQ,VerticalMerge:()=>z8,VerticalAnchor:()=>cG,VerticalAlignTable:()=>K9,VerticalAlignSection:()=>V9,VerticalAlign:()=>WQ,UnderlineType:()=>i8,ThematicBreak:()=>_B,Textbox:()=>TK,TextWrappingType:()=>e2,TextWrappingSide:()=>L4,TextRun:()=>Q1,TextEffect:()=>CG,TextDirection:()=>wQ,TableRowPropertiesChange:()=>P9,TableRowProperties:()=>J6,TableRow:()=>fQ,TableProperties:()=>Q6,TableOfContents:()=>RK,TableLayoutType:()=>SQ,TableCellBorders:()=>q9,TableCell:()=>Y6,TableBorders:()=>Z6,TableAnchorType:()=>DQ,Table:()=>yQ,TabStopType:()=>w8,TabStopPosition:()=>FZ,Tab:()=>T4,TDirection:()=>R9,SymbolRun:()=>aB,Styles:()=>S1,StyleLevel:()=>LK,StyleForParagraph:()=>p2,StyleForCharacter:()=>$2,StringValueElement:()=>q2,StringEnumValueElement:()=>XG,StringContainer:()=>O2,SpaceType:()=>x0,SoftHyphen:()=>iY,SimpleMailMergeField:()=>fY,SimpleField:()=>s8,ShadingType:()=>FG,SequentialIdentifier:()=>yY,Separator:()=>YZ,SectionType:()=>GJ,SectionPropertiesChange:()=>k9,SectionProperties:()=>K6,RunPropertiesDefaults:()=>a9,RunPropertiesChange:()=>lB,RunProperties:()=>U2,Run:()=>D0,RelativeVerticalPosition:()=>CQ,RelativeHorizontalPosition:()=>TQ,PrettifyType:()=>G5,PositionalTabRelativeTo:()=>XZ,PositionalTabLeader:()=>qZ,PositionalTabAlignment:()=>VZ,PositionalTab:()=>RZ,PatchType:()=>C8,ParagraphRunProperties:()=>mB,ParagraphPropertiesDefaults:()=>l9,ParagraphPropertiesChange:()=>d4,ParagraphProperties:()=>M2,Paragraph:()=>d0,PageTextDirectionType:()=>BJ,PageTextDirection:()=>T9,PageReference:()=>CZ,PageOrientation:()=>g1,PageNumberSeparator:()=>eQ,PageNumberElement:()=>QZ,PageNumber:()=>F2,PageBreakBefore:()=>$4,PageBreak:()=>LZ,PageBorders:()=>w9,PageBorderZOrder:()=>tQ,PageBorderOffsetFrom:()=>oQ,PageBorderDisplay:()=>sQ,Packer:()=>Y5,OverlapType:()=>kQ,OnOffElement:()=>q0,Numbering:()=>d9,NumberedItemReferenceFormat:()=>zZ,NumberedItemReference:()=>DZ,NumberValueElement:()=>_2,NumberProperties:()=>C1,NumberFormat:()=>RG,NoBreakHyphen:()=>rY,NextAttributeComponent:()=>$8,MonthShort:()=>sY,MonthLong:()=>eY,Media:()=>V6,MathSuperScript:()=>rZ,MathSum:()=>mZ,MathSubSuperScript:()=>nZ,MathSubScript:()=>iZ,MathSquareBrackets:()=>QQ,MathRun:()=>hZ,MathRoundBrackets:()=>ZQ,MathRadicalProperties:()=>o4,MathRadical:()=>BQ,MathPreSubSuperScript:()=>sZ,MathNumerator:()=>m4,MathLimitUpper:()=>aZ,MathLimitLower:()=>pZ,MathLimit:()=>B6,MathIntegral:()=>lZ,MathFunctionProperties:()=>e4,MathFunctionName:()=>t4,MathFunction:()=>UQ,MathFraction:()=>uZ,MathDenominator:()=>c4,MathDegree:()=>s4,MathCurlyBrackets:()=>JQ,MathAngledBrackets:()=>KQ,Math:()=>xZ,LineRuleType:()=>k2,LineNumberRestartFormat:()=>nQ,LevelSuffix:()=>TJ,LevelOverride:()=>u9,LevelFormat:()=>i0,LevelForOverride:()=>$J,LevelBase:()=>X6,Level:()=>h9,LeaderType:()=>HZ,LastRenderedPageBreak:()=>KZ,InternalHyperlink:()=>y4,InsertedTextRun:()=>MQ,InsertedTableRow:()=>U9,InsertedTableCell:()=>Y9,InitializableXmlComponent:()=>u8,ImportedXmlComponent:()=>kB,ImportedRootElementAttributes:()=>$B,ImageRun:()=>$Y,IgnoreIfEmptyXmlComponent:()=>R2,HyperlinkType:()=>jZ,HpsMeasureElement:()=>D1,HorizontalPositionRelativeFrom:()=>B4,HorizontalPositionAlign:()=>qG,HighlightColor:()=>kG,HeightRule:()=>gQ,HeadingLevel:()=>OZ,HeaderWrapper:()=>_9,HeaderFooterType:()=>E8,HeaderFooterReferenceType:()=>T2,Header:()=>IK,GridSpan:()=>M9,FrameWrap:()=>fZ,FrameAnchorType:()=>gZ,FootnoteReferenceRun:()=>HK,FootnoteReferenceElement:()=>GZ,FootnoteReference:()=>o9,FooterWrapper:()=>f9,Footer:()=>OK,FootNotes:()=>x9,FootNoteReferenceRunAttributes:()=>s9,FileChild:()=>H1,File:()=>VK,ExternalHyperlink:()=>t8,Endnotes:()=>g9,EndnoteReferenceRunAttributes:()=>t9,EndnoteReferenceRun:()=>FK,EndnoteReference:()=>D4,EndnoteIdReference:()=>e9,EmptyElement:()=>S0,EmphasisMarkType:()=>p8,EMPTY_OBJECT:()=>KB,DropCapType:()=>yZ,Drawing:()=>m1,DocumentGridType:()=>iQ,DocumentDefaults:()=>p9,DocumentBackgroundAttributes:()=>S9,DocumentBackground:()=>b9,DocumentAttributes:()=>F1,DocumentAttributeNamespaces:()=>y1,Document:()=>VK,DeletedTextRun:()=>OQ,DeletedTableRow:()=>G9,DeletedTableCell:()=>Z9,DayShort:()=>nY,DayLong:()=>tY,ContinuationSeparator:()=>ZZ,ConcreteNumbering:()=>T8,ConcreteHyperlink:()=>m2,CommentsExtended:()=>E4,Comments:()=>z4,CommentReference:()=>mY,CommentRangeStart:()=>dY,CommentRangeEnd:()=>cY,Comment:()=>N8,ColumnBreak:()=>IZ,Column:()=>ZJ,CheckBoxUtil:()=>B5,CheckBoxSymbolElement:()=>b1,CheckBox:()=>WK,CharacterSet:()=>kZ,CellMergeAttributes:()=>Q9,CellMerge:()=>J9,CarriageReturn:()=>JZ,BuilderElement:()=>M0,BorderStyle:()=>c1,Border:()=>xB,BookmarkStart:()=>f4,BookmarkEnd:()=>x4,Bookmark:()=>g4,Body:()=>$9,BaseXmlComponent:()=>Y1,Attributes:()=>C0,AnnotationReference:()=>UZ,AlignmentType:()=>c0,AbstractNumbering:()=>D8});var{create:YU,defineProperty:QB,getOwnPropertyDescriptor:ZU,getOwnPropertyNames:QU,getPrototypeOf:JU}=Object,KU=Object.prototype.hasOwnProperty,JB=(B,U)=>()=>(B&&(U=B(B=0)),U),R0=(B,U)=>()=>(U||(B((U={exports:{}}).exports,U),B=null),U.exports),VU=(B,U,G,Y)=>{if(U&&typeof U==="object"||typeof U==="function"){for(var Q=QU(U),K=0,Z=Q.length,J;KU[q]).bind(null,J),enumerable:!(Y=ZU(U,J))||Y.enumerable})}return B},k8=(B,U,G)=>(G=B!=null?YU(JU(B)):{},VU(U||!B||!B.__esModule?QB(G,"default",{value:B,enumerable:!0}):G,B)),z1=((B)=>__require)(function(B){return __require.apply(this,arguments)});function G1(B){return G1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},G1(B)}function XU(B,U){if(G1(B)!="object"||!B)return B;var G=B[Symbol.toPrimitive];if(G!==void 0){var Y=G.call(B,U||"default");if(G1(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return(U==="string"?String:Number)(B)}function qU(B){var U=XU(B,"string");return G1(U)=="symbol"?U:U+""}function e(B,U,G){return(U=qU(U))in B?Object.defineProperty(B,U,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[U]=G,B}var Y1=class{constructor(B){e(this,"rootKey",void 0),this.rootKey=B}},KB=Object.seal({}),t=class extends Y1{constructor(B){super(B);e(this,"root",void 0),this.root=[]}prepForXml(B){var U;B.stack.push(this);let G=this.root.map((Y)=>{if(Y instanceof Y1)return Y.prepForXml(B);return Y}).filter((Y)=>Y!==void 0);return B.stack.pop(),{[this.rootKey]:G.length?G.length===1&&((U=G[0])===null||U===void 0?void 0:U._attr)?G[0]:G:KB}}addChildElement(B){return this.root.push(B),this}},R2=class extends t{constructor(B,U){super(B);e(this,"includeIfEmpty",void 0),this.includeIfEmpty=U}prepForXml(B){let U=super.prepForXml(B);if(this.includeIfEmpty)return U;if(U&&(typeof U[this.rootKey]!=="object"||Object.keys(U[this.rootKey]).length))return U}};function u6(B,U){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(B);U&&(Y=Y.filter(function(Q){return Object.getOwnPropertyDescriptor(B,Q).enumerable})),G.push.apply(G,Y)}return G}function L0(B){for(var U=1;U{if(Y!==void 0){let Q=this.xmlKeys&&this.xmlKeys[G]||G;U[Q]=Y}}),{_attr:U}}},$8=class extends Y1{constructor(B){super("_attr");e(this,"root",void 0),this.root=B}prepForXml(B){return{_attr:Object.values(this.root).filter(({value:U})=>U!==void 0).reduce((U,{key:G,value:Y})=>L0(L0({},U),{},{[G]:Y}),{})}}},C0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}},S8=R0((B,U)=>{var G=typeof Reflect==="object"?Reflect:null,Y=G&&typeof G.apply==="function"?G.apply:function($,x,w){return Function.prototype.apply.call($,x,w)},Q;if(G&&typeof G.ownKeys==="function")Q=G.ownKeys;else if(Object.getOwnPropertySymbols)Q=function($){return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($))};else Q=function($){return Object.getOwnPropertyNames($)};function K(M){if(console&&console.warn)console.warn(M)}var Z=Number.isNaN||function($){return $!==$};function J(){J.init.call(this)}U.exports=J,U.exports.once=v,J.EventEmitter=J,J.prototype._events=void 0,J.prototype._eventsCount=0,J.prototype._maxListeners=void 0;var q=10;function W(M){if(typeof M!=="function")throw TypeError('The "listener" argument must be of type Function. Received type '+typeof M)}Object.defineProperty(J,"defaultMaxListeners",{enumerable:!0,get:function(){return q},set:function(M){if(typeof M!=="number"||M<0||Z(M))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+M+".");q=M}}),J.init=function(){if(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)this._events=Object.create(null),this._eventsCount=0;this._maxListeners=this._maxListeners||void 0},J.prototype.setMaxListeners=function($){if(typeof $!=="number"||$<0||Z($))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+$+".");return this._maxListeners=$,this};function I(M){if(M._maxListeners===void 0)return J.defaultMaxListeners;return M._maxListeners}J.prototype.getMaxListeners=function(){return I(this)},J.prototype.emit=function($){var x=[];for(var w=1;w0)b=x[0];if(b instanceof Error)throw b;var c=Error("Unhandled error."+(b?" ("+b.message+")":""));throw c.context=b,c}var D=U0[$];if(D===void 0)return!1;if(typeof D==="function")Y(D,this,x);else{var m=D.length,B0=E(D,m);for(var w=0;w0&&b.length>a&&!b.warned){b.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+b.length+" "+String($)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=M,c.type=$,c.count=b.length,K(c)}}return M}J.prototype.addListener=function($,x){return H(this,$,x,!1)},J.prototype.on=J.prototype.addListener,J.prototype.prependListener=function($,x){return H(this,$,x,!0)};function T(){if(!this.fired){if(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0)return this.listener.call(this.target);return this.listener.apply(this.target,arguments)}}function A(M,$,x){var w={fired:!1,wrapFn:void 0,target:M,type:$,listener:x},a=T.bind(w);return a.listener=x,w.wrapFn=a,a}J.prototype.once=function($,x){return W(x),this.on($,A(this,$,x)),this},J.prototype.prependOnceListener=function($,x){return W(x),this.prependListener($,A(this,$,x)),this},J.prototype.removeListener=function($,x){var w,a,U0,b,c;if(W(x),a=this._events,a===void 0)return this;if(w=a[$],w===void 0)return this;if(w===x||w.listener===x){if(--this._eventsCount===0)this._events=Object.create(null);else if(delete a[$],a.removeListener)this.emit("removeListener",$,w.listener||x)}else if(typeof w!=="function"){U0=-1;for(b=w.length-1;b>=0;b--)if(w[b]===x||w[b].listener===x){c=w[b].listener,U0=b;break}if(U0<0)return this;if(U0===0)w.shift();else C(w,U0);if(w.length===1)a[$]=w[0];if(a.removeListener!==void 0)this.emit("removeListener",$,c||x)}return this},J.prototype.off=J.prototype.removeListener,J.prototype.removeAllListeners=function($){var x,w=this._events,a;if(w===void 0)return this;if(w.removeListener===void 0){if(arguments.length===0)this._events=Object.create(null),this._eventsCount=0;else if(w[$]!==void 0)if(--this._eventsCount===0)this._events=Object.create(null);else delete w[$];return this}if(arguments.length===0){var U0=Object.keys(w),b;for(a=0;a=0;a--)this.removeListener($,x[a]);return this};function P(M,$,x){var w=M._events;if(w===void 0)return[];var a=w[$];if(a===void 0)return[];if(typeof a==="function")return x?[a.listener||a]:[a];return x?N(a):E(a,a.length)}J.prototype.listeners=function($){return P(this,$,!0)},J.prototype.rawListeners=function($){return P(this,$,!1)},J.listenerCount=function(M,$){if(typeof M.listenerCount==="function")return M.listenerCount($);else return j.call(M,$)},J.prototype.listenerCount=j;function j(M){var $=this._events;if($!==void 0){var x=$[M];if(typeof x==="function")return 1;else if(x!==void 0)return x.length}return 0}J.prototype.eventNames=function(){return this._eventsCount>0?Q(this._events):[]};function E(M,$){var x=Array($);for(var w=0;w<$;++w)x[w]=M[w];return x}function C(M,$){for(;$+1{if(typeof Object.create==="function")U.exports=function(Y,Q){if(Q)Y.super_=Q,Y.prototype=Object.create(Q.prototype,{constructor:{value:Y,enumerable:!1,writable:!0,configurable:!0}})};else U.exports=function(Y,Q){if(Q){Y.super_=Q;var K=function(){};K.prototype=Q.prototype,Y.prototype=new K,Y.prototype.constructor=Y}}}),v0,d2=JB(()=>{v0=globalThis||self});function MU(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function O8(){throw Error("setTimeout has not been defined")}function H8(){throw Error("clearTimeout has not been defined")}function VB(B){if(n0===setTimeout)return setTimeout(B,0);if((n0===O8||!n0)&&setTimeout)return n0=setTimeout,setTimeout(B,0);try{return n0(B,0)}catch(U){try{return n0.call(null,B,0)}catch(G){return n0.call(this,B,0)}}}function RU(B){if(s0===clearTimeout)return clearTimeout(B);if((s0===H8||!s0)&&clearTimeout)return s0=clearTimeout,clearTimeout(B);try{return s0(B)}catch(U){try{return s0.call(null,B)}catch(G){return s0.call(this,B)}}}function LU(){if(!D2||!E2)return;if(D2=!1,E2.length)o0=E2.concat(o0);else B1=-1;if(o0.length)XB()}function XB(){if(D2)return;var B=VB(LU);D2=!0;var U=o0.length;while(U){E2=o0,o0=[];while(++B1{J8={exports:{}},N0=J8.exports={},function(){try{if(typeof setTimeout==="function")n0=setTimeout;else n0=O8}catch(B){n0=O8}try{if(typeof clearTimeout==="function")s0=clearTimeout;else s0=H8}catch(B){s0=H8}}(),o0=[],D2=!1,B1=-1,N0.nextTick=function(B){var U=Array(arguments.length-1);if(arguments.length>1)for(var G=1;G{U.exports=S8().EventEmitter}),IU=R0((B)=>{B.byteLength=q,B.toByteArray=I,B.fromByteArray=A;var U=[],G=[],Y=typeof Uint8Array<"u"?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var K=0,Z=Q.length;K0)throw Error("Invalid string. Length must be a multiple of 4");var E=P.indexOf("=");if(E===-1)E=j;var C=E===j?0:4-E%4;return[E,C]}function q(P){var j=J(P),E=j[0],C=j[1];return(E+C)*3/4-C}function W(P,j,E){return(j+E)*3/4-E}function I(P){var j,E=J(P),C=E[0],N=E[1],v=new Y(W(P,C,N)),S=0,F=N>0?C-4:C,M;for(M=0;M>16&255,v[S++]=j>>8&255,v[S++]=j&255;if(N===2)j=G[P.charCodeAt(M)]<<2|G[P.charCodeAt(M+1)]>>4,v[S++]=j&255;if(N===1)j=G[P.charCodeAt(M)]<<10|G[P.charCodeAt(M+1)]<<4|G[P.charCodeAt(M+2)]>>2,v[S++]=j>>8&255,v[S++]=j&255;return v}function H(P){return U[P>>18&63]+U[P>>12&63]+U[P>>6&63]+U[P&63]}function T(P,j,E){var C,N=[];for(var v=j;vF?F:S+v));if(C===1)j=P[E-1],N.push(U[j>>2]+U[j<<4&63]+"==");else if(C===2)j=(P[E-2]<<8)+P[E-1],N.push(U[j>>10]+U[j>>4&63]+U[j<<2&63]+"=");return N.join("")}}),OU=R0((B)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */B.read=function(U,G,Y,Q,K){var Z,J,q=K*8-Q-1,W=(1<>1,H=-7,T=Y?K-1:0,A=Y?-1:1,P=U[G+T];T+=A,Z=P&(1<<-H)-1,P>>=-H,H+=q;for(;H>0;Z=Z*256+U[G+T],T+=A,H-=8);J=Z&(1<<-H)-1,Z>>=-H,H+=Q;for(;H>0;J=J*256+U[G+T],T+=A,H-=8);if(Z===0)Z=1-I;else if(Z===W)return J?NaN:(P?-1:1)*(1/0);else J=J+Math.pow(2,Q),Z=Z-I;return(P?-1:1)*J*Math.pow(2,Z-Q)},B.write=function(U,G,Y,Q,K,Z){var J,q,W,I=Z*8-K-1,H=(1<>1,A=K===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=Q?0:Z-1,j=Q?1:-1,E=G<0||G===0&&1/G<0?1:0;if(G=Math.abs(G),isNaN(G)||G===1/0)q=isNaN(G)?1:0,J=H;else{if(J=Math.floor(Math.log(G)/Math.LN2),G*(W=Math.pow(2,-J))<1)J--,W*=2;if(J+T>=1)G+=A/W;else G+=A*Math.pow(2,1-T);if(G*W>=2)J++,W/=2;if(J+T>=H)q=0,J=H;else if(J+T>=1)q=(G*W-1)*Math.pow(2,K),J=J+T;else q=G*Math.pow(2,T-1)*Math.pow(2,K),J=0}for(;K>=8;U[Y+P]=q&255,P+=j,q/=256,K-=8);J=J<0;U[Y+P]=J&255,P+=j,J/=256,I-=8);U[Y+P-j]|=E*128}});/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT -*/var f1=R0((B)=>{var U=IU(),G=OU(),Y=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=J,B.SlowBuffer=N,B.INSPECT_MAX_BYTES=50;var Q=2147483647;if(B.kMaxLength=Q,J.TYPED_ARRAY_SUPPORT=K(),!J.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error==="function")console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function K(){try{var k=new Uint8Array(1),V={foo:function(){return 42}};return Object.setPrototypeOf(V,Uint8Array.prototype),Object.setPrototypeOf(k,V),k.foo()===42}catch(X){return!1}}Object.defineProperty(J.prototype,"parent",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.buffer}}),Object.defineProperty(J.prototype,"offset",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.byteOffset}});function Z(k){if(k>Q)throw RangeError('The value "'+k+'" is invalid for option "size"');var V=new Uint8Array(k);return Object.setPrototypeOf(V,J.prototype),V}function J(k,V,X){if(typeof k==="number"){if(typeof V==="string")throw TypeError('The "string" argument must be of type string. Received type number');return H(k)}return q(k,V,X)}J.poolSize=8192;function q(k,V,X){if(typeof k==="string")return T(k,V);if(ArrayBuffer.isView(k))return P(k);if(k==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(f(k,ArrayBuffer)||k&&f(k.buffer,ArrayBuffer))return j(k,V,X);if(typeof SharedArrayBuffer<"u"&&(f(k,SharedArrayBuffer)||k&&f(k.buffer,SharedArrayBuffer)))return j(k,V,X);if(typeof k==="number")throw TypeError('The "value" argument must not be of type number. Received type number');var O=k.valueOf&&k.valueOf();if(O!=null&&O!==k)return J.from(O,V,X);var _=E(k);if(_)return _;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]==="function")return J.from(k[Symbol.toPrimitive]("string"),V,X);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}J.from=function(k,V,X){return q(k,V,X)},Object.setPrototypeOf(J.prototype,Uint8Array.prototype),Object.setPrototypeOf(J,Uint8Array);function W(k){if(typeof k!=="number")throw TypeError('"size" argument must be of type number');else if(k<0)throw RangeError('The value "'+k+'" is invalid for option "size"')}function I(k,V,X){if(W(k),k<=0)return Z(k);if(V!==void 0)return typeof X==="string"?Z(k).fill(V,X):Z(k).fill(V);return Z(k)}J.alloc=function(k,V,X){return I(k,V,X)};function H(k){return W(k),Z(k<0?0:C(k)|0)}J.allocUnsafe=function(k){return H(k)},J.allocUnsafeSlow=function(k){return H(k)};function T(k,V){if(typeof V!=="string"||V==="")V="utf8";if(!J.isEncoding(V))throw TypeError("Unknown encoding: "+V);var X=v(k,V)|0,O=Z(X),_=O.write(k,V);if(_!==X)O=O.slice(0,_);return O}function A(k){var V=k.length<0?0:C(k.length)|0,X=Z(V);for(var O=0;O=Q)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return k|0}function N(k){if(+k!=k)k=0;return J.alloc(+k)}J.isBuffer=function(V){return V!=null&&V._isBuffer===!0&&V!==J.prototype},J.compare=function(V,X){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(f(X,Uint8Array))X=J.from(X,X.offset,X.byteLength);if(!J.isBuffer(V)||!J.isBuffer(X))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(V===X)return 0;var O=V.length,_=X.length;for(var l=0,d=Math.min(O,_);l_.length)J.from(d).copy(_,l);else Uint8Array.prototype.set.call(_,d,l);else if(!J.isBuffer(d))throw TypeError('"list" argument must be an Array of Buffers');else d.copy(_,l);l+=d.length}return _};function v(k,V){if(J.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||f(k,ArrayBuffer))return k.byteLength;if(typeof k!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);var X=k.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&X===0)return 0;var _=!1;for(;;)switch(V){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return L(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return Z0(k).length;default:if(_)return O?-1:L(k).length;V=(""+V).toLowerCase(),_=!0}}J.byteLength=v;function S(k,V,X){var O=!1;if(V===void 0||V<0)V=0;if(V>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,V>>>=0,X<=V)return"";if(!k)k="utf8";while(!0)switch(k){case"hex":return s(this,V,X);case"utf8":case"utf-8":return D(this,V,X);case"ascii":return i(this,V,X);case"latin1":case"binary":return V0(this,V,X);case"base64":return c(this,V,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G0(this,V,X);default:if(O)throw TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),O=!0}}J.prototype._isBuffer=!0;function F(k,V,X){var O=k[V];k[V]=k[X],k[X]=O}if(J.prototype.swap16=function(){var V=this.length;if(V%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var X=0;XX)V+=" ... ";return""},Y)J.prototype[Y]=J.prototype.inspect;J.prototype.compare=function(V,X,O,_,l){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(!J.isBuffer(V))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof V);if(X===void 0)X=0;if(O===void 0)O=V?V.length:0;if(_===void 0)_=0;if(l===void 0)l=this.length;if(X<0||O>V.length||_<0||l>this.length)throw RangeError("out of range index");if(_>=l&&X>=O)return 0;if(_>=l)return-1;if(X>=O)return 1;if(X>>>=0,O>>>=0,_>>>=0,l>>>=0,this===V)return 0;var d=l-_,Q0=O-X,X0=Math.min(d,Q0),K0=this.slice(_,l),I0=V.slice(X,O);for(var F0=0;F02147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,R(X))X=_?0:k.length-1;if(X<0)X=k.length+X;if(X>=k.length)if(_)return-1;else X=k.length-1;else if(X<0)if(_)X=0;else return-1;if(typeof V==="string")V=J.from(V,O);if(J.isBuffer(V)){if(V.length===0)return-1;return $(k,V,X,O,_)}else if(typeof V==="number"){if(V=V&255,typeof Uint8Array.prototype.indexOf==="function")if(_)return Uint8Array.prototype.indexOf.call(k,V,X);else return Uint8Array.prototype.lastIndexOf.call(k,V,X);return $(k,[V],X,O,_)}throw TypeError("val must be string, number or Buffer")}function $(k,V,X,O,_){var l=1,d=k.length,Q0=V.length;if(O!==void 0){if(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le"){if(k.length<2||V.length<2)return-1;l=2,d/=2,Q0/=2,X/=2}}function X0(k0,L2){if(l===1)return k0[L2];else return k0.readUInt16BE(L2*l)}var K0;if(_){var I0=-1;for(K0=X;K0d)X=d-Q0;for(K0=X;K0>=0;K0--){var F0=!0;for(var W0=0;W0_)O=_;var l=V.length;if(O>l/2)O=l/2;for(var d=0;d>>0,isFinite(O)){if(O=O>>>0,_===void 0)_="utf8"}else _=O,O=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-X;if(O===void 0||O>l)O=l;if(V.length>0&&(O<0||X<0)||X>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!_)_="utf8";var d=!1;for(;;)switch(_){case"hex":return x(this,V,X,O);case"utf8":case"utf-8":return z(this,V,X,O);case"ascii":case"latin1":case"binary":return a(this,V,X,O);case"base64":return U0(this,V,X,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,V,X,O);default:if(d)throw TypeError("Unknown encoding: "+_);_=(""+_).toLowerCase(),d=!0}},J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c(k,V,X){if(V===0&&X===k.length)return U.fromByteArray(k);else return U.fromByteArray(k.slice(V,X))}function D(k,V,X){X=Math.min(k.length,X);var O=[],_=V;while(_239?4:l>223?3:l>191?2:1;if(_+Q0<=X){var X0,K0,I0,F0;switch(Q0){case 1:if(l<128)d=l;break;case 2:if(X0=k[_+1],(X0&192)===128){if(F0=(l&31)<<6|X0&63,F0>127)d=F0}break;case 3:if(X0=k[_+1],K0=k[_+2],(X0&192)===128&&(K0&192)===128){if(F0=(l&15)<<12|(X0&63)<<6|K0&63,F0>2047&&(F0<55296||F0>57343))d=F0}break;case 4:if(X0=k[_+1],K0=k[_+2],I0=k[_+3],(X0&192)===128&&(K0&192)===128&&(I0&192)===128){if(F0=(l&15)<<18|(X0&63)<<12|(K0&63)<<6|I0&63,F0>65535&&F0<1114112)d=F0}}}if(d===null)d=65533,Q0=1;else if(d>65535)d-=65536,O.push(d>>>10&1023|55296),d=56320|d&1023;O.push(d),_+=Q0}return B0(O)}var m=4096;function B0(k){var V=k.length;if(V<=m)return String.fromCharCode.apply(String,k);var X="",O=0;while(OO)X=O;var _="";for(var l=V;lO)V=O;if(X<0){if(X+=O,X<0)X=0}else if(X>O)X=O;if(XX)throw RangeError("Trying to access beyond buffer length")}J.prototype.readUintLE=J.prototype.readUIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V+--X],l=1;while(X>0&&(l*=256))_+=this[V+--X]*l;return _},J.prototype.readUint8=J.prototype.readUInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);return this[V]},J.prototype.readUint16LE=J.prototype.readUInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]|this[V+1]<<8},J.prototype.readUint16BE=J.prototype.readUInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]<<8|this[V+1]},J.prototype.readUint32LE=J.prototype.readUInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return(this[V]|this[V+1]<<8|this[V+2]<<16)+this[V+3]*16777216},J.prototype.readUint32BE=J.prototype.readUInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]*16777216+(this[V+1]<<16|this[V+2]<<8|this[V+3])},J.prototype.readIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d=l)_-=Math.pow(2,8*X);return _},J.prototype.readIntBE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=X,l=1,d=this[V+--_];while(_>0&&(l*=256))d+=this[V+--_]*l;if(l*=128,d>=l)d-=Math.pow(2,8*X);return d},J.prototype.readInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);if(!(this[V]&128))return this[V];return(255-this[V]+1)*-1},J.prototype.readInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V]|this[V+1]<<8;return O&32768?O|4294901760:O},J.prototype.readInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V+1]|this[V]<<8;return O&32768?O|4294901760:O},J.prototype.readInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]|this[V+1]<<8|this[V+2]<<16|this[V+3]<<24},J.prototype.readInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]<<24|this[V+1]<<16|this[V+2]<<8|this[V+3]},J.prototype.readFloatLE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!0,23,4)},J.prototype.readFloatBE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!1,23,4)},J.prototype.readDoubleLE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!0,52,8)},J.prototype.readDoubleBE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!1,52,8)};function y(k,V,X,O,_,l){if(!J.isBuffer(k))throw TypeError('"buffer" argument must be a Buffer instance');if(V>_||Vk.length)throw RangeError("Index out of range")}J.prototype.writeUintLE=J.prototype.writeUIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=1,Q0=0;this[X]=V&255;while(++Q0>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=O-1,Q0=1;this[X+d]=V&255;while(--d>=0&&(Q0*=256))this[X+d]=V/Q0&255;return X+O},J.prototype.writeUint8=J.prototype.writeUInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,255,0);return this[X]=V&255,X+1},J.prototype.writeUint16LE=J.prototype.writeUInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeUint16BE=J.prototype.writeUInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeUint32LE=J.prototype.writeUInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X+3]=V>>>24,this[X+2]=V>>>16,this[X+1]=V>>>8,this[X]=V&255,X+4},J.prototype.writeUint32BE=J.prototype.writeUInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4},J.prototype.writeIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=0,Q0=1,X0=0;this[X]=V&255;while(++d>0)-X0&255}return X+O},J.prototype.writeIntBE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=O-1,Q0=1,X0=0;this[X+d]=V&255;while(--d>=0&&(Q0*=256)){if(V<0&&X0===0&&this[X+d+1]!==0)X0=1;this[X+d]=(V/Q0>>0)-X0&255}return X+O},J.prototype.writeInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,127,-128);if(V<0)V=255+V+1;return this[X]=V&255,X+1},J.prototype.writeInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);return this[X]=V&255,this[X+1]=V>>>8,this[X+2]=V>>>16,this[X+3]=V>>>24,X+4},J.prototype.writeInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);if(V<0)V=4294967295+V+1;return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4};function n(k,V,X,O,_,l){if(X+O>k.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function o(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return G.write(k,V,X,O,23,4),X+4}J.prototype.writeFloatLE=function(V,X,O){return o(this,V,X,!0,O)},J.prototype.writeFloatBE=function(V,X,O){return o(this,V,X,!1,O)};function Y0(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return G.write(k,V,X,O,52,8),X+8}J.prototype.writeDoubleLE=function(V,X,O){return Y0(this,V,X,!0,O)},J.prototype.writeDoubleBE=function(V,X,O){return Y0(this,V,X,!1,O)},J.prototype.copy=function(V,X,O,_){if(!J.isBuffer(V))throw TypeError("argument should be a Buffer");if(!O)O=0;if(!_&&_!==0)_=this.length;if(X>=V.length)X=V.length;if(!X)X=0;if(_>0&&_=this.length)throw RangeError("Index out of range");if(_<0)throw RangeError("sourceEnd out of bounds");if(_>this.length)_=this.length;if(V.length-X<_-O)_=V.length-X+O;var l=_-O;if(this===V&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(X,O,_);else Uint8Array.prototype.set.call(V,this.subarray(O,_),X);return l},J.prototype.fill=function(V,X,O,_){if(typeof V==="string"){if(typeof X==="string")_=X,X=0,O=this.length;else if(typeof O==="string")_=O,O=this.length;if(_!==void 0&&typeof _!=="string")throw TypeError("encoding must be a string");if(typeof _==="string"&&!J.isEncoding(_))throw TypeError("Unknown encoding: "+_);if(V.length===1){var l=V.charCodeAt(0);if(_==="utf8"&&l<128||_==="latin1")V=l}}else if(typeof V==="number")V=V&255;else if(typeof V==="boolean")V=Number(V);if(X<0||this.length>>0,O=O===void 0?this.length:O>>>0,!V)V=0;var d;if(typeof V==="number")for(d=X;d55295&&X<57344){if(!_){if(X>56319){if((V-=3)>-1)l.push(239,191,189);continue}else if(d+1===O){if((V-=3)>-1)l.push(239,191,189);continue}_=X;continue}if(X<56320){if((V-=3)>-1)l.push(239,191,189);_=X;continue}X=(_-55296<<10|X-56320)+65536}else if(_){if((V-=3)>-1)l.push(239,191,189)}if(_=null,X<128){if((V-=1)<0)break;l.push(X)}else if(X<2048){if((V-=2)<0)break;l.push(X>>6|192,X&63|128)}else if(X<65536){if((V-=3)<0)break;l.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((V-=4)<0)break;l.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw Error("Invalid code point")}return l}function u(k){var V=[];for(var X=0;X>8,_=X%256,l.push(_),l.push(O)}return l}function Z0(k){return U.toByteArray(w(k))}function g(k,V,X,O){for(var _=0;_=V.length||_>=k.length)break;V[_+X]=k[_]}return _}function f(k,V){return k instanceof V||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===V.name}function R(k){return k!==k}var p=function(){var k="0123456789abcdef",V=Array(256);for(var X=0;X<16;++X){var O=X*16;for(var _=0;_<16;++_)V[O+_]=k[X]+k[_]}return V}()}),MB=R0((B,U)=>{U.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var Y={},Q=Symbol("test"),K=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var Z=42;Y[Q]=Z;for(var J in Y)return!1;if(typeof Object.keys==="function"&&Object.keys(Y).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(Y).length!==0)return!1;var q=Object.getOwnPropertySymbols(Y);if(q.length!==1||q[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(Y,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var W=Object.getOwnPropertyDescriptor(Y,Q);if(W.value!==Z||W.enumerable!==!0)return!1}return!0}}),b8=R0((B,U)=>{var G=MB();U.exports=function(){return G()&&!!Symbol.toStringTag}}),RB=R0((B,U)=>{U.exports=Object}),HU=R0((B,U)=>{U.exports=Error}),FU=R0((B,U)=>{U.exports=EvalError}),WU=R0((B,U)=>{U.exports=RangeError}),PU=R0((B,U)=>{U.exports=ReferenceError}),LB=R0((B,U)=>{U.exports=SyntaxError}),x1=R0((B,U)=>{U.exports=TypeError}),AU=R0((B,U)=>{U.exports=URIError}),jU=R0((B,U)=>{U.exports=Math.abs}),NU=R0((B,U)=>{U.exports=Math.floor}),zU=R0((B,U)=>{U.exports=Math.max}),wU=R0((B,U)=>{U.exports=Math.min}),EU=R0((B,U)=>{U.exports=Math.pow}),DU=R0((B,U)=>{U.exports=Math.round}),TU=R0((B,U)=>{U.exports=Number.isNaN||function(Y){return Y!==Y}}),CU=R0((B,U)=>{var G=TU();U.exports=function(Q){if(G(Q)||Q===0)return Q;return Q<0?-1:1}}),kU=R0((B,U)=>{U.exports=Object.getOwnPropertyDescriptor}),K1=R0((B,U)=>{var G=kU();if(G)try{G([],"length")}catch(Y){G=null}U.exports=G}),_1=R0((B,U)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(Y){G=!1}U.exports=G}),$U=R0((B,U)=>{var G=typeof Symbol<"u"&&Symbol,Y=MB();U.exports=function(){if(typeof G!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof G("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return Y()}}),IB=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),OB=R0((B,U)=>{U.exports=RB().getPrototypeOf||null}),SU=R0((B,U)=>{var G="Function.prototype.bind called on incompatible ",Y=Object.prototype.toString,Q=Math.max,K="[object Function]",Z=function(I,H){var T=[];for(var A=0;A{var G=SU();U.exports=Function.prototype.bind||G}),v8=R0((B,U)=>{U.exports=Function.prototype.call}),y8=R0((B,U)=>{U.exports=Function.prototype.apply}),bU=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),HB=R0((B,U)=>{var G=V1(),Y=y8(),Q=v8();U.exports=bU()||G.call(Q,Y)}),g8=R0((B,U)=>{var G=V1(),Y=x1(),Q=v8(),K=HB();U.exports=function(J){if(J.length<1||typeof J[0]!=="function")throw new Y("a function is required");return K(G,Q,J)}}),vU=R0((B,U)=>{var G=g8(),Y=K1(),Q;try{Q=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var K=!!Q&&Y&&Y(Object.prototype,"__proto__"),Z=Object,J=Z.getPrototypeOf;U.exports=K&&typeof K.get==="function"?G([K.get]):typeof J==="function"?function(W){return J(W==null?W:Z(W))}:!1}),FB=R0((B,U)=>{var G=IB(),Y=OB(),Q=vU();U.exports=G?function(Z){return G(Z)}:Y?function(Z){if(!Z||typeof Z!=="object"&&typeof Z!=="function")throw TypeError("getProto: not an object");return Y(Z)}:Q?function(Z){return Q(Z)}:null}),yU=R0((B,U)=>{var G=Function.prototype.call,Y=Object.prototype.hasOwnProperty;U.exports=V1().call(G,Y)}),WB=R0((B,U)=>{var G,Y=RB(),Q=HU(),K=FU(),Z=WU(),J=PU(),q=LB(),W=x1(),I=AU(),H=jU(),T=NU(),A=zU(),P=wU(),j=EU(),E=DU(),C=CU(),N=Function,v=function(h){try{return N('"use strict"; return ('+h+").constructor;")()}catch(Z0){}},S=K1(),F=_1(),M=function(){throw new W},$=S?function(){try{return arguments.callee,M}catch(h){try{return S(arguments,"callee").get}catch(Z0){return M}}}():M,x=$U()(),z=FB(),a=OB(),U0=IB(),b=y8(),c=v8(),D={},m=typeof Uint8Array>"u"||!z?G:z(Uint8Array),B0={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":x&&z?z([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":D,"%AsyncGenerator%":D,"%AsyncGeneratorFunction%":D,"%AsyncIteratorPrototype%":D,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q,"%eval%":eval,"%EvalError%":K,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":N,"%GeneratorFunction%":D,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":x&&z?z(z([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!x||!z?G:z(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Y,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Z,"%ReferenceError%":J,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!x||!z?G:z(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":x&&z?z(""[Symbol.iterator]()):G,"%Symbol%":x?Symbol:G,"%SyntaxError%":q,"%ThrowTypeError%":$,"%TypedArray%":m,"%TypeError%":W,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":I,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":c,"%Function.prototype.apply%":b,"%Object.defineProperty%":F,"%Object.getPrototypeOf%":a,"%Math.abs%":H,"%Math.floor%":T,"%Math.max%":A,"%Math.min%":P,"%Math.pow%":j,"%Math.round%":E,"%Math.sign%":C,"%Reflect.getPrototypeOf%":U0};if(z)try{null.error}catch(h){B0["%Error.prototype%"]=z(z(h))}var i=function h(Z0){var g;if(Z0==="%AsyncFunction%")g=v("async function () {}");else if(Z0==="%GeneratorFunction%")g=v("function* () {}");else if(Z0==="%AsyncGeneratorFunction%")g=v("async function* () {}");else if(Z0==="%AsyncGenerator%"){var f=h("%AsyncGeneratorFunction%");if(f)g=f.prototype}else if(Z0==="%AsyncIteratorPrototype%"){var R=h("%AsyncGenerator%");if(R&&z)g=z(R.prototype)}return B0[Z0]=g,g},V0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},s=V1(),G0=yU(),r=s.call(c,Array.prototype.concat),y=s.call(b,Array.prototype.splice),n=s.call(c,String.prototype.replace),o=s.call(c,String.prototype.slice),Y0=s.call(c,RegExp.prototype.exec),O0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,L=function(Z0){var g=o(Z0,0,1),f=o(Z0,-1);if(g==="%"&&f!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(f==="%"&&g!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var R=[];return n(Z0,O0,function(p,k,V,X){R[R.length]=V?n(X,w,"$1"):k||p}),R},u=function(Z0,g){var f=Z0,R;if(G0(V0,f))R=V0[f],f="%"+R[0]+"%";if(G0(B0,f)){var p=B0[f];if(p===D)p=i(f);if(typeof p>"u"&&!g)throw new W("intrinsic "+Z0+" exists, but is not available. Please file an issue!");return{alias:R,name:f,value:p}}throw new q("intrinsic "+Z0+" does not exist!")};U.exports=function(Z0,g){if(typeof Z0!=="string"||Z0.length===0)throw new W("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof g!=="boolean")throw new W('"allowMissing" argument must be a boolean');if(Y0(/^%?[^%]*%?$/,Z0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=L(Z0),R=f.length>0?f[0]:"",p=u("%"+R+"%",g),k=p.name,V=p.value,X=!1,O=p.alias;if(O)R=O[0],y(f,r([0,1],O));for(var _=1,l=!0;_=f.length){var K0=S(V,d);if(l=!!K0,l&&"get"in K0&&!("originalValue"in K0.get))V=K0.get;else V=V[d]}else l=G0(V,d),V=V[d];if(l&&!X)B0[k]=V}}return V}}),PB=R0((B,U)=>{var G=WB(),Y=g8(),Q=Y([G("%String.prototype.indexOf%")]);U.exports=function(Z,J){var q=G(Z,!!J);if(typeof q==="function"&&Q(Z,".prototype.")>-1)return Y([q]);return q}}),gU=R0((B,U)=>{var G=b8()(),Y=PB()("Object.prototype.toString"),Q=function(q){if(G&&q&&typeof q==="object"&&Symbol.toStringTag in q)return!1;return Y(q)==="[object Arguments]"},K=function(q){if(Q(q))return!0;return q!==null&&typeof q==="object"&&"length"in q&&typeof q.length==="number"&&q.length>=0&&Y(q)!=="[object Array]"&&"callee"in q&&Y(q.callee)==="[object Function]"},Z=function(){return Q(arguments)}();Q.isLegacyArguments=K,U.exports=Z?Q:K}),fU=R0((B,U)=>{var G=Object.prototype.toString,Y=Function.prototype.toString,Q=/^\s*(?:function)?\*/,K=b8()(),Z=Object.getPrototypeOf,J=function(){if(!K)return!1;try{return Function("return function*() {}")()}catch(W){}},q;U.exports=function(I){if(typeof I!=="function")return!1;if(Q.test(Y.call(I)))return!0;if(!K)return G.call(I)==="[object GeneratorFunction]";if(!Z)return!1;if(typeof q>"u"){var H=J();q=H?Z(H):!1}return Z(I)===q}}),xU=R0((B,U)=>{var G=Function.prototype.toString,Y=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,Q,K;if(typeof Y==="function"&&typeof Object.defineProperty==="function")try{Q=Object.defineProperty({},"length",{get:function(){throw K}}),K={},Y(function(){throw 42},null,Q)}catch(S){if(S!==K)Y=null}else Y=null;var Z=/^\s*class\b/,J=function(F){try{var M=G.call(F);return Z.test(M)}catch($){return!1}},q=function(F){try{if(J(F))return!1;return G.call(F),!0}catch(M){return!1}},W=Object.prototype.toString,I="[object Object]",H="[object Function]",T="[object GeneratorFunction]",A="[object HTMLAllCollection]",P="[object HTML document.all class]",j="[object HTMLCollection]",E=typeof Symbol==="function"&&!!Symbol.toStringTag,C=!(0 in[,]),N=function(){return!1};if(typeof document==="object"){var v=document.all;if(W.call(v)===W.call(document.all))N=function(F){if((C||!F)&&(typeof F>"u"||typeof F==="object"))try{var M=W.call(F);return(M===A||M===P||M===j||M===I)&&F("")==null}catch($){}return!1}}U.exports=Y?function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;try{Y(F,null,Q)}catch(M){if(M!==K)return!1}return!J(F)&&q(F)}:function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;if(E)return q(F);if(J(F))return!1;var M=W.call(F);if(M!==H&&M!==T&&!/^\[object HTML/.test(M))return!1;return q(F)}}),_U=R0((B,U)=>{var G=xU(),Y=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,K=function(I,H,T){for(var A=0,P=I.length;A=3)A=T;if(q(I))K(I,H,A);else if(typeof I==="string")Z(I,H,A);else J(I,H,A)}}),hU=R0((B,U)=>{U.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),uU=R0((B,U)=>{d2();var G=hU(),Y=typeof globalThis>"u"?v0:globalThis;U.exports=function(){var K=[];for(var Z=0;Z{var G=_1(),Y=LB(),Q=x1(),K=K1();U.exports=function(J,q,W){if(!J||typeof J!=="object"&&typeof J!=="function")throw new Q("`obj` must be an object or a function`");if(typeof q!=="string"&&typeof q!=="symbol")throw new Q("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new Q("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new Q("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new Q("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new Q("`loose`, if provided, must be a boolean");var I=arguments.length>3?arguments[3]:null,H=arguments.length>4?arguments[4]:null,T=arguments.length>5?arguments[5]:null,A=arguments.length>6?arguments[6]:!1,P=!!K&&K(J,q);if(G)G(J,q,{configurable:T===null&&P?P.configurable:!T,enumerable:I===null&&P?P.enumerable:!I,value:W,writable:H===null&&P?P.writable:!H});else if(A||!I&&!H&&!T)J[q]=W;else throw new Y("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),cU=R0((B,U)=>{var G=_1(),Y=function(){return!!G};Y.hasArrayLengthDefineBug=function(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(K){return!0}},U.exports=Y}),mU=R0((B,U)=>{var G=WB(),Y=dU(),Q=cU()(),K=K1(),Z=x1(),J=G("%Math.floor%");U.exports=function(W,I){if(typeof W!=="function")throw new Z("`fn` is not a function");if(typeof I!=="number"||I<0||I>4294967295||J(I)!==I)throw new Z("`length` must be a positive 32-bit integer");var H=arguments.length>2&&!!arguments[2],T=!0,A=!0;if("length"in W&&K){var P=K(W,"length");if(P&&!P.configurable)T=!1;if(P&&!P.writable)A=!1}if(T||A||!H)if(Q)Y(W,"length",I,!0,!0);else Y(W,"length",I);return W}}),lU=R0((B,U)=>{var G=V1(),Y=y8(),Q=HB();U.exports=function(){return Q(G,Y,arguments)}}),aU=R0((B,U)=>{var G=mU(),Y=_1(),Q=g8(),K=lU();if(U.exports=function(J){var q=Q(arguments),W=J.length-(arguments.length-1);return G(q,1+(W>0?W:0),!0)},Y)Y(U.exports,"apply",{value:K});else U.exports.apply=K}),AB=R0((B,U)=>{d2();var G=_U(),Y=uU(),Q=aU(),K=PB(),Z=K1(),J=FB(),q=K("Object.prototype.toString"),W=b8()(),I=typeof globalThis>"u"?v0:globalThis,H=Y(),T=K("String.prototype.slice"),A=K("Array.prototype.indexOf",!0)||function(N,v){for(var S=0;S-1)return v;if(v!=="Object")return!1;return E(N)}if(!Z)return null;return j(N)}}),pU=R0((B,U)=>{var G=AB();U.exports=function(Q){return!!G(Q)}}),rU=R0((B)=>{var U=gU(),G=fU(),Y=AB(),Q=pU();function K(O){return O.call.bind(O)}var Z=typeof BigInt<"u",J=typeof Symbol<"u",q=K(Object.prototype.toString),W=K(Number.prototype.valueOf),I=K(String.prototype.valueOf),H=K(Boolean.prototype.valueOf);if(Z)var T=K(BigInt.prototype.valueOf);if(J)var A=K(Symbol.prototype.valueOf);function P(O,_){if(typeof O!=="object")return!1;try{return _(O),!0}catch(l){return!1}}B.isArgumentsObject=U,B.isGeneratorFunction=G,B.isTypedArray=Q;function j(O){return typeof Promise<"u"&&O instanceof Promise||O!==null&&typeof O==="object"&&typeof O.then==="function"&&typeof O.catch==="function"}B.isPromise=j;function E(O){if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)return ArrayBuffer.isView(O);return Q(O)||n(O)}B.isArrayBufferView=E;function C(O){return Y(O)==="Uint8Array"}B.isUint8Array=C;function N(O){return Y(O)==="Uint8ClampedArray"}B.isUint8ClampedArray=N;function v(O){return Y(O)==="Uint16Array"}B.isUint16Array=v;function S(O){return Y(O)==="Uint32Array"}B.isUint32Array=S;function F(O){return Y(O)==="Int8Array"}B.isInt8Array=F;function M(O){return Y(O)==="Int16Array"}B.isInt16Array=M;function $(O){return Y(O)==="Int32Array"}B.isInt32Array=$;function x(O){return Y(O)==="Float32Array"}B.isFloat32Array=x;function z(O){return Y(O)==="Float64Array"}B.isFloat64Array=z;function a(O){return Y(O)==="BigInt64Array"}B.isBigInt64Array=a;function U0(O){return Y(O)==="BigUint64Array"}B.isBigUint64Array=U0;function b(O){return q(O)==="[object Map]"}b.working=typeof Map<"u"&&b(new Map);function c(O){if(typeof Map>"u")return!1;return b.working?b(O):O instanceof Map}B.isMap=c;function D(O){return q(O)==="[object Set]"}D.working=typeof Set<"u"&&D(new Set);function m(O){if(typeof Set>"u")return!1;return D.working?D(O):O instanceof Set}B.isSet=m;function B0(O){return q(O)==="[object WeakMap]"}B0.working=typeof WeakMap<"u"&&B0(new WeakMap);function i(O){if(typeof WeakMap>"u")return!1;return B0.working?B0(O):O instanceof WeakMap}B.isWeakMap=i;function V0(O){return q(O)==="[object WeakSet]"}V0.working=typeof WeakSet<"u"&&V0(new WeakSet);function s(O){return V0(O)}B.isWeakSet=s;function G0(O){return q(O)==="[object ArrayBuffer]"}G0.working=typeof ArrayBuffer<"u"&&G0(new ArrayBuffer);function r(O){if(typeof ArrayBuffer>"u")return!1;return G0.working?G0(O):O instanceof ArrayBuffer}B.isArrayBuffer=r;function y(O){return q(O)==="[object DataView]"}y.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&y(new DataView(new ArrayBuffer(1),0,1));function n(O){if(typeof DataView>"u")return!1;return y.working?y(O):O instanceof DataView}B.isDataView=n;var o=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Y0(O){return q(O)==="[object SharedArrayBuffer]"}function O0(O){if(typeof o>"u")return!1;if(typeof Y0.working>"u")Y0.working=Y0(new o);return Y0.working?Y0(O):O instanceof o}B.isSharedArrayBuffer=O0;function w(O){return q(O)==="[object AsyncFunction]"}B.isAsyncFunction=w;function L(O){return q(O)==="[object Map Iterator]"}B.isMapIterator=L;function u(O){return q(O)==="[object Set Iterator]"}B.isSetIterator=u;function h(O){return q(O)==="[object Generator]"}B.isGeneratorObject=h;function Z0(O){return q(O)==="[object WebAssembly.Module]"}B.isWebAssemblyCompiledModule=Z0;function g(O){return P(O,W)}B.isNumberObject=g;function f(O){return P(O,I)}B.isStringObject=f;function R(O){return P(O,H)}B.isBooleanObject=R;function p(O){return Z&&P(O,T)}B.isBigIntObject=p;function k(O){return J&&P(O,A)}B.isSymbolObject=k;function V(O){return g(O)||f(O)||R(O)||p(O)||k(O)}B.isBoxedPrimitive=V;function X(O){return typeof Uint8Array<"u"&&(r(O)||O0(O))}B.isAnyArrayBuffer=X,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(O){Object.defineProperty(B,O,{enumerable:!1,value:function(){throw Error(O+" is not supported in userland")}})})}),iU=R0((B,U)=>{U.exports=function(Y){return Y&&typeof Y==="object"&&typeof Y.copy==="function"&&typeof Y.fill==="function"&&typeof Y.readUInt8==="function"}}),jB=R0((B)=>{P2();var U=Object.getOwnPropertyDescriptors||function(n){var o=Object.keys(n),Y0={};for(var O0=0;O0=O0)return u;switch(u){case"%s":return String(Y0[o++]);case"%d":return Number(Y0[o++]);case"%j":try{return JSON.stringify(Y0[o++])}catch(h){return"[Circular]"}default:return u}});for(var L=Y0[o];o"u")return function(){return B.deprecate(y,n).apply(this,arguments)};var o=!1;function Y0(){if(!o){if(P0.throwDeprecation)throw Error(n);else if(P0.traceDeprecation)console.trace(n);else console.error(n);o=!0}return y.apply(this,arguments)}return Y0};var Y={},Q=/^$/;if(P0.env.NODE_DEBUG){var K=P0.env.NODE_DEBUG;K=K.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Q=new RegExp("^"+K+"$","i")}B.debuglog=function(y){if(y=y.toUpperCase(),!Y[y])if(Q.test(y)){var n=P0.pid;Y[y]=function(){var o=B.format.apply(B,arguments);console.error("%s %d: %s",y,n,o)}}else Y[y]=function(){};return Y[y]};function Z(y,n){var o={seen:[],stylize:q};if(arguments.length>=3)o.depth=arguments[2];if(arguments.length>=4)o.colors=arguments[3];if(C(n))o.showHidden=n;else if(n)B._extend(o,n);if($(o.showHidden))o.showHidden=!1;if($(o.depth))o.depth=2;if($(o.colors))o.colors=!1;if($(o.customInspect))o.customInspect=!0;if(o.colors)o.stylize=J;return I(o,y,o.depth)}B.inspect=Z,Z.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Z.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function J(y,n){var o=Z.styles[n];if(o)return"\x1B["+Z.colors[o][0]+"m"+y+"\x1B["+Z.colors[o][1]+"m";else return y}function q(y,n){return y}function W(y){var n={};return y.forEach(function(o,Y0){n[o]=!0}),n}function I(y,n,o){if(y.customInspect&&n&&b(n.inspect)&&n.inspect!==B.inspect&&!(n.constructor&&n.constructor.prototype===n)){var Y0=n.inspect(o,y);if(!F(Y0))Y0=I(y,Y0,o);return Y0}var O0=H(y,n);if(O0)return O0;var w=Object.keys(n),L=W(w);if(y.showHidden)w=Object.getOwnPropertyNames(n);if(U0(n)&&(w.indexOf("message")>=0||w.indexOf("description")>=0))return T(n);if(w.length===0){if(b(n)){var u=n.name?": "+n.name:"";return y.stylize("[Function"+u+"]","special")}if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");if(a(n))return y.stylize(Date.prototype.toString.call(n),"date");if(U0(n))return T(n)}var h="",Z0=!1,g=["{","}"];if(E(n))Z0=!0,g=["[","]"];if(b(n))h=" [Function"+(n.name?": "+n.name:"")+"]";if(x(n))h=" "+RegExp.prototype.toString.call(n);if(a(n))h=" "+Date.prototype.toUTCString.call(n);if(U0(n))h=" "+T(n);if(w.length===0&&(!Z0||n.length==0))return g[0]+h+g[1];if(o<0)if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");else return y.stylize("[Object]","special");y.seen.push(n);var f;if(Z0)f=A(y,n,o,L,w);else f=w.map(function(R){return P(y,n,o,L,R,Z0)});return y.seen.pop(),j(f,h,g)}function H(y,n){if($(n))return y.stylize("undefined","undefined");if(F(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return y.stylize(o,"string")}if(S(n))return y.stylize(""+n,"number");if(C(n))return y.stylize(""+n,"boolean");if(N(n))return y.stylize("null","null")}function T(y){return"["+Error.prototype.toString.call(y)+"]"}function A(y,n,o,Y0,O0){var w=[];for(var L=0,u=n.length;L-1)if(w)u=u.split(` +*/var f1=R0((B)=>{var U=IU(),G=OU(),Y=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=J,B.SlowBuffer=N,B.INSPECT_MAX_BYTES=50;var Q=2147483647;if(B.kMaxLength=Q,J.TYPED_ARRAY_SUPPORT=K(),!J.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error==="function")console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function K(){try{var k=new Uint8Array(1),V={foo:function(){return 42}};return Object.setPrototypeOf(V,Uint8Array.prototype),Object.setPrototypeOf(k,V),k.foo()===42}catch(X){return!1}}Object.defineProperty(J.prototype,"parent",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.buffer}}),Object.defineProperty(J.prototype,"offset",{enumerable:!0,get:function(){if(!J.isBuffer(this))return;return this.byteOffset}});function Z(k){if(k>Q)throw RangeError('The value "'+k+'" is invalid for option "size"');var V=new Uint8Array(k);return Object.setPrototypeOf(V,J.prototype),V}function J(k,V,X){if(typeof k==="number"){if(typeof V==="string")throw TypeError('The "string" argument must be of type string. Received type number');return H(k)}return q(k,V,X)}J.poolSize=8192;function q(k,V,X){if(typeof k==="string")return T(k,V);if(ArrayBuffer.isView(k))return P(k);if(k==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(f(k,ArrayBuffer)||k&&f(k.buffer,ArrayBuffer))return j(k,V,X);if(typeof SharedArrayBuffer<"u"&&(f(k,SharedArrayBuffer)||k&&f(k.buffer,SharedArrayBuffer)))return j(k,V,X);if(typeof k==="number")throw TypeError('The "value" argument must not be of type number. Received type number');var O=k.valueOf&&k.valueOf();if(O!=null&&O!==k)return J.from(O,V,X);var _=E(k);if(_)return _;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]==="function")return J.from(k[Symbol.toPrimitive]("string"),V,X);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}J.from=function(k,V,X){return q(k,V,X)},Object.setPrototypeOf(J.prototype,Uint8Array.prototype),Object.setPrototypeOf(J,Uint8Array);function W(k){if(typeof k!=="number")throw TypeError('"size" argument must be of type number');else if(k<0)throw RangeError('The value "'+k+'" is invalid for option "size"')}function I(k,V,X){if(W(k),k<=0)return Z(k);if(V!==void 0)return typeof X==="string"?Z(k).fill(V,X):Z(k).fill(V);return Z(k)}J.alloc=function(k,V,X){return I(k,V,X)};function H(k){return W(k),Z(k<0?0:C(k)|0)}J.allocUnsafe=function(k){return H(k)},J.allocUnsafeSlow=function(k){return H(k)};function T(k,V){if(typeof V!=="string"||V==="")V="utf8";if(!J.isEncoding(V))throw TypeError("Unknown encoding: "+V);var X=v(k,V)|0,O=Z(X),_=O.write(k,V);if(_!==X)O=O.slice(0,_);return O}function A(k){var V=k.length<0?0:C(k.length)|0,X=Z(V);for(var O=0;O=Q)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return k|0}function N(k){if(+k!=k)k=0;return J.alloc(+k)}J.isBuffer=function(V){return V!=null&&V._isBuffer===!0&&V!==J.prototype},J.compare=function(V,X){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(f(X,Uint8Array))X=J.from(X,X.offset,X.byteLength);if(!J.isBuffer(V)||!J.isBuffer(X))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(V===X)return 0;var O=V.length,_=X.length;for(var l=0,d=Math.min(O,_);l_.length)J.from(d).copy(_,l);else Uint8Array.prototype.set.call(_,d,l);else if(!J.isBuffer(d))throw TypeError('"list" argument must be an Array of Buffers');else d.copy(_,l);l+=d.length}return _};function v(k,V){if(J.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||f(k,ArrayBuffer))return k.byteLength;if(typeof k!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);var X=k.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&X===0)return 0;var _=!1;for(;;)switch(V){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return L(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return Z0(k).length;default:if(_)return O?-1:L(k).length;V=(""+V).toLowerCase(),_=!0}}J.byteLength=v;function S(k,V,X){var O=!1;if(V===void 0||V<0)V=0;if(V>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,V>>>=0,X<=V)return"";if(!k)k="utf8";while(!0)switch(k){case"hex":return s(this,V,X);case"utf8":case"utf-8":return D(this,V,X);case"ascii":return i(this,V,X);case"latin1":case"binary":return V0(this,V,X);case"base64":return c(this,V,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G0(this,V,X);default:if(O)throw TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),O=!0}}J.prototype._isBuffer=!0;function F(k,V,X){var O=k[V];k[V]=k[X],k[X]=O}if(J.prototype.swap16=function(){var V=this.length;if(V%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var X=0;XX)V+=" ... ";return""},Y)J.prototype[Y]=J.prototype.inspect;J.prototype.compare=function(V,X,O,_,l){if(f(V,Uint8Array))V=J.from(V,V.offset,V.byteLength);if(!J.isBuffer(V))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof V);if(X===void 0)X=0;if(O===void 0)O=V?V.length:0;if(_===void 0)_=0;if(l===void 0)l=this.length;if(X<0||O>V.length||_<0||l>this.length)throw RangeError("out of range index");if(_>=l&&X>=O)return 0;if(_>=l)return-1;if(X>=O)return 1;if(X>>>=0,O>>>=0,_>>>=0,l>>>=0,this===V)return 0;var d=l-_,Q0=O-X,X0=Math.min(d,Q0),K0=this.slice(_,l),I0=V.slice(X,O);for(var F0=0;F02147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,R(X))X=_?0:k.length-1;if(X<0)X=k.length+X;if(X>=k.length)if(_)return-1;else X=k.length-1;else if(X<0)if(_)X=0;else return-1;if(typeof V==="string")V=J.from(V,O);if(J.isBuffer(V)){if(V.length===0)return-1;return $(k,V,X,O,_)}else if(typeof V==="number"){if(V=V&255,typeof Uint8Array.prototype.indexOf==="function")if(_)return Uint8Array.prototype.indexOf.call(k,V,X);else return Uint8Array.prototype.lastIndexOf.call(k,V,X);return $(k,[V],X,O,_)}throw TypeError("val must be string, number or Buffer")}function $(k,V,X,O,_){var l=1,d=k.length,Q0=V.length;if(O!==void 0){if(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le"){if(k.length<2||V.length<2)return-1;l=2,d/=2,Q0/=2,X/=2}}function X0(k0,L2){if(l===1)return k0[L2];else return k0.readUInt16BE(L2*l)}var K0;if(_){var I0=-1;for(K0=X;K0d)X=d-Q0;for(K0=X;K0>=0;K0--){var F0=!0;for(var W0=0;W0_)O=_;var l=V.length;if(O>l/2)O=l/2;for(var d=0;d>>0,isFinite(O)){if(O=O>>>0,_===void 0)_="utf8"}else _=O,O=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-X;if(O===void 0||O>l)O=l;if(V.length>0&&(O<0||X<0)||X>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!_)_="utf8";var d=!1;for(;;)switch(_){case"hex":return x(this,V,X,O);case"utf8":case"utf-8":return w(this,V,X,O);case"ascii":case"latin1":case"binary":return a(this,V,X,O);case"base64":return U0(this,V,X,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,V,X,O);default:if(d)throw TypeError("Unknown encoding: "+_);_=(""+_).toLowerCase(),d=!0}},J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c(k,V,X){if(V===0&&X===k.length)return U.fromByteArray(k);else return U.fromByteArray(k.slice(V,X))}function D(k,V,X){X=Math.min(k.length,X);var O=[],_=V;while(_239?4:l>223?3:l>191?2:1;if(_+Q0<=X){var X0,K0,I0,F0;switch(Q0){case 1:if(l<128)d=l;break;case 2:if(X0=k[_+1],(X0&192)===128){if(F0=(l&31)<<6|X0&63,F0>127)d=F0}break;case 3:if(X0=k[_+1],K0=k[_+2],(X0&192)===128&&(K0&192)===128){if(F0=(l&15)<<12|(X0&63)<<6|K0&63,F0>2047&&(F0<55296||F0>57343))d=F0}break;case 4:if(X0=k[_+1],K0=k[_+2],I0=k[_+3],(X0&192)===128&&(K0&192)===128&&(I0&192)===128){if(F0=(l&15)<<18|(X0&63)<<12|(K0&63)<<6|I0&63,F0>65535&&F0<1114112)d=F0}}}if(d===null)d=65533,Q0=1;else if(d>65535)d-=65536,O.push(d>>>10&1023|55296),d=56320|d&1023;O.push(d),_+=Q0}return B0(O)}var m=4096;function B0(k){var V=k.length;if(V<=m)return String.fromCharCode.apply(String,k);var X="",O=0;while(OO)X=O;var _="";for(var l=V;lO)V=O;if(X<0){if(X+=O,X<0)X=0}else if(X>O)X=O;if(XX)throw RangeError("Trying to access beyond buffer length")}J.prototype.readUintLE=J.prototype.readUIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V+--X],l=1;while(X>0&&(l*=256))_+=this[V+--X]*l;return _},J.prototype.readUint8=J.prototype.readUInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);return this[V]},J.prototype.readUint16LE=J.prototype.readUInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]|this[V+1]<<8},J.prototype.readUint16BE=J.prototype.readUInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);return this[V]<<8|this[V+1]},J.prototype.readUint32LE=J.prototype.readUInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return(this[V]|this[V+1]<<8|this[V+2]<<16)+this[V+3]*16777216},J.prototype.readUint32BE=J.prototype.readUInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]*16777216+(this[V+1]<<16|this[V+2]<<8|this[V+3])},J.prototype.readIntLE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=this[V],l=1,d=0;while(++d=l)_-=Math.pow(2,8*X);return _},J.prototype.readIntBE=function(V,X,O){if(V=V>>>0,X=X>>>0,!O)r(V,X,this.length);var _=X,l=1,d=this[V+--_];while(_>0&&(l*=256))d+=this[V+--_]*l;if(l*=128,d>=l)d-=Math.pow(2,8*X);return d},J.prototype.readInt8=function(V,X){if(V=V>>>0,!X)r(V,1,this.length);if(!(this[V]&128))return this[V];return(255-this[V]+1)*-1},J.prototype.readInt16LE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V]|this[V+1]<<8;return O&32768?O|4294901760:O},J.prototype.readInt16BE=function(V,X){if(V=V>>>0,!X)r(V,2,this.length);var O=this[V+1]|this[V]<<8;return O&32768?O|4294901760:O},J.prototype.readInt32LE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]|this[V+1]<<8|this[V+2]<<16|this[V+3]<<24},J.prototype.readInt32BE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return this[V]<<24|this[V+1]<<16|this[V+2]<<8|this[V+3]},J.prototype.readFloatLE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!0,23,4)},J.prototype.readFloatBE=function(V,X){if(V=V>>>0,!X)r(V,4,this.length);return G.read(this,V,!1,23,4)},J.prototype.readDoubleLE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!0,52,8)},J.prototype.readDoubleBE=function(V,X){if(V=V>>>0,!X)r(V,8,this.length);return G.read(this,V,!1,52,8)};function y(k,V,X,O,_,l){if(!J.isBuffer(k))throw TypeError('"buffer" argument must be a Buffer instance');if(V>_||Vk.length)throw RangeError("Index out of range")}J.prototype.writeUintLE=J.prototype.writeUIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=1,Q0=0;this[X]=V&255;while(++Q0>>0,O=O>>>0,!_){var l=Math.pow(2,8*O)-1;y(this,V,X,O,l,0)}var d=O-1,Q0=1;this[X+d]=V&255;while(--d>=0&&(Q0*=256))this[X+d]=V/Q0&255;return X+O},J.prototype.writeUint8=J.prototype.writeUInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,255,0);return this[X]=V&255,X+1},J.prototype.writeUint16LE=J.prototype.writeUInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeUint16BE=J.prototype.writeUInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,65535,0);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeUint32LE=J.prototype.writeUInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X+3]=V>>>24,this[X+2]=V>>>16,this[X+1]=V>>>8,this[X]=V&255,X+4},J.prototype.writeUint32BE=J.prototype.writeUInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,4294967295,0);return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4},J.prototype.writeIntLE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=0,Q0=1,X0=0;this[X]=V&255;while(++d>0)-X0&255}return X+O},J.prototype.writeIntBE=function(V,X,O,_){if(V=+V,X=X>>>0,!_){var l=Math.pow(2,8*O-1);y(this,V,X,O,l-1,-l)}var d=O-1,Q0=1,X0=0;this[X+d]=V&255;while(--d>=0&&(Q0*=256)){if(V<0&&X0===0&&this[X+d+1]!==0)X0=1;this[X+d]=(V/Q0>>0)-X0&255}return X+O},J.prototype.writeInt8=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,1,127,-128);if(V<0)V=255+V+1;return this[X]=V&255,X+1},J.prototype.writeInt16LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V&255,this[X+1]=V>>>8,X+2},J.prototype.writeInt16BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,2,32767,-32768);return this[X]=V>>>8,this[X+1]=V&255,X+2},J.prototype.writeInt32LE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);return this[X]=V&255,this[X+1]=V>>>8,this[X+2]=V>>>16,this[X+3]=V>>>24,X+4},J.prototype.writeInt32BE=function(V,X,O){if(V=+V,X=X>>>0,!O)y(this,V,X,4,2147483647,-2147483648);if(V<0)V=4294967295+V+1;return this[X]=V>>>24,this[X+1]=V>>>16,this[X+2]=V>>>8,this[X+3]=V&255,X+4};function n(k,V,X,O,_,l){if(X+O>k.length)throw RangeError("Index out of range");if(X<0)throw RangeError("Index out of range")}function o(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return G.write(k,V,X,O,23,4),X+4}J.prototype.writeFloatLE=function(V,X,O){return o(this,V,X,!0,O)},J.prototype.writeFloatBE=function(V,X,O){return o(this,V,X,!1,O)};function Y0(k,V,X,O,_){if(V=+V,X=X>>>0,!_)n(k,V,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return G.write(k,V,X,O,52,8),X+8}J.prototype.writeDoubleLE=function(V,X,O){return Y0(this,V,X,!0,O)},J.prototype.writeDoubleBE=function(V,X,O){return Y0(this,V,X,!1,O)},J.prototype.copy=function(V,X,O,_){if(!J.isBuffer(V))throw TypeError("argument should be a Buffer");if(!O)O=0;if(!_&&_!==0)_=this.length;if(X>=V.length)X=V.length;if(!X)X=0;if(_>0&&_=this.length)throw RangeError("Index out of range");if(_<0)throw RangeError("sourceEnd out of bounds");if(_>this.length)_=this.length;if(V.length-X<_-O)_=V.length-X+O;var l=_-O;if(this===V&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(X,O,_);else Uint8Array.prototype.set.call(V,this.subarray(O,_),X);return l},J.prototype.fill=function(V,X,O,_){if(typeof V==="string"){if(typeof X==="string")_=X,X=0,O=this.length;else if(typeof O==="string")_=O,O=this.length;if(_!==void 0&&typeof _!=="string")throw TypeError("encoding must be a string");if(typeof _==="string"&&!J.isEncoding(_))throw TypeError("Unknown encoding: "+_);if(V.length===1){var l=V.charCodeAt(0);if(_==="utf8"&&l<128||_==="latin1")V=l}}else if(typeof V==="number")V=V&255;else if(typeof V==="boolean")V=Number(V);if(X<0||this.length>>0,O=O===void 0?this.length:O>>>0,!V)V=0;var d;if(typeof V==="number")for(d=X;d55295&&X<57344){if(!_){if(X>56319){if((V-=3)>-1)l.push(239,191,189);continue}else if(d+1===O){if((V-=3)>-1)l.push(239,191,189);continue}_=X;continue}if(X<56320){if((V-=3)>-1)l.push(239,191,189);_=X;continue}X=(_-55296<<10|X-56320)+65536}else if(_){if((V-=3)>-1)l.push(239,191,189)}if(_=null,X<128){if((V-=1)<0)break;l.push(X)}else if(X<2048){if((V-=2)<0)break;l.push(X>>6|192,X&63|128)}else if(X<65536){if((V-=3)<0)break;l.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((V-=4)<0)break;l.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw Error("Invalid code point")}return l}function u(k){var V=[];for(var X=0;X>8,_=X%256,l.push(_),l.push(O)}return l}function Z0(k){return U.toByteArray(z(k))}function g(k,V,X,O){for(var _=0;_=V.length||_>=k.length)break;V[_+X]=k[_]}return _}function f(k,V){return k instanceof V||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===V.name}function R(k){return k!==k}var p=function(){var k="0123456789abcdef",V=Array(256);for(var X=0;X<16;++X){var O=X*16;for(var _=0;_<16;++_)V[O+_]=k[X]+k[_]}return V}()}),MB=R0((B,U)=>{U.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var Y={},Q=Symbol("test"),K=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(K)!=="[object Symbol]")return!1;var Z=42;Y[Q]=Z;for(var J in Y)return!1;if(typeof Object.keys==="function"&&Object.keys(Y).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(Y).length!==0)return!1;var q=Object.getOwnPropertySymbols(Y);if(q.length!==1||q[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(Y,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var W=Object.getOwnPropertyDescriptor(Y,Q);if(W.value!==Z||W.enumerable!==!0)return!1}return!0}}),b8=R0((B,U)=>{var G=MB();U.exports=function(){return G()&&!!Symbol.toStringTag}}),RB=R0((B,U)=>{U.exports=Object}),HU=R0((B,U)=>{U.exports=Error}),FU=R0((B,U)=>{U.exports=EvalError}),WU=R0((B,U)=>{U.exports=RangeError}),PU=R0((B,U)=>{U.exports=ReferenceError}),LB=R0((B,U)=>{U.exports=SyntaxError}),x1=R0((B,U)=>{U.exports=TypeError}),AU=R0((B,U)=>{U.exports=URIError}),jU=R0((B,U)=>{U.exports=Math.abs}),NU=R0((B,U)=>{U.exports=Math.floor}),wU=R0((B,U)=>{U.exports=Math.max}),zU=R0((B,U)=>{U.exports=Math.min}),EU=R0((B,U)=>{U.exports=Math.pow}),DU=R0((B,U)=>{U.exports=Math.round}),TU=R0((B,U)=>{U.exports=Number.isNaN||function(Y){return Y!==Y}}),CU=R0((B,U)=>{var G=TU();U.exports=function(Q){if(G(Q)||Q===0)return Q;return Q<0?-1:1}}),kU=R0((B,U)=>{U.exports=Object.getOwnPropertyDescriptor}),K1=R0((B,U)=>{var G=kU();if(G)try{G([],"length")}catch(Y){G=null}U.exports=G}),_1=R0((B,U)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(Y){G=!1}U.exports=G}),$U=R0((B,U)=>{var G=typeof Symbol<"u"&&Symbol,Y=MB();U.exports=function(){if(typeof G!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof G("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return Y()}}),IB=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),OB=R0((B,U)=>{U.exports=RB().getPrototypeOf||null}),SU=R0((B,U)=>{var G="Function.prototype.bind called on incompatible ",Y=Object.prototype.toString,Q=Math.max,K="[object Function]",Z=function(I,H){var T=[];for(var A=0;A{var G=SU();U.exports=Function.prototype.bind||G}),v8=R0((B,U)=>{U.exports=Function.prototype.call}),y8=R0((B,U)=>{U.exports=Function.prototype.apply}),bU=R0((B,U)=>{U.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),HB=R0((B,U)=>{var G=V1(),Y=y8(),Q=v8();U.exports=bU()||G.call(Q,Y)}),g8=R0((B,U)=>{var G=V1(),Y=x1(),Q=v8(),K=HB();U.exports=function(J){if(J.length<1||typeof J[0]!=="function")throw new Y("a function is required");return K(G,Q,J)}}),vU=R0((B,U)=>{var G=g8(),Y=K1(),Q;try{Q=[].__proto__===Array.prototype}catch(q){if(!q||typeof q!=="object"||!("code"in q)||q.code!=="ERR_PROTO_ACCESS")throw q}var K=!!Q&&Y&&Y(Object.prototype,"__proto__"),Z=Object,J=Z.getPrototypeOf;U.exports=K&&typeof K.get==="function"?G([K.get]):typeof J==="function"?function(W){return J(W==null?W:Z(W))}:!1}),FB=R0((B,U)=>{var G=IB(),Y=OB(),Q=vU();U.exports=G?function(Z){return G(Z)}:Y?function(Z){if(!Z||typeof Z!=="object"&&typeof Z!=="function")throw TypeError("getProto: not an object");return Y(Z)}:Q?function(Z){return Q(Z)}:null}),yU=R0((B,U)=>{var G=Function.prototype.call,Y=Object.prototype.hasOwnProperty;U.exports=V1().call(G,Y)}),WB=R0((B,U)=>{var G,Y=RB(),Q=HU(),K=FU(),Z=WU(),J=PU(),q=LB(),W=x1(),I=AU(),H=jU(),T=NU(),A=wU(),P=zU(),j=EU(),E=DU(),C=CU(),N=Function,v=function(h){try{return N('"use strict"; return ('+h+").constructor;")()}catch(Z0){}},S=K1(),F=_1(),M=function(){throw new W},$=S?function(){try{return arguments.callee,M}catch(h){try{return S(arguments,"callee").get}catch(Z0){return M}}}():M,x=$U()(),w=FB(),a=OB(),U0=IB(),b=y8(),c=v8(),D={},m=typeof Uint8Array>"u"||!w?G:w(Uint8Array),B0={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?G:ArrayBuffer,"%ArrayIteratorPrototype%":x&&w?w([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":D,"%AsyncGenerator%":D,"%AsyncGeneratorFunction%":D,"%AsyncIteratorPrototype%":D,"%Atomics%":typeof Atomics>"u"?G:Atomics,"%BigInt%":typeof BigInt>"u"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q,"%eval%":eval,"%EvalError%":K,"%Float16Array%":typeof Float16Array>"u"?G:Float16Array,"%Float32Array%":typeof Float32Array>"u"?G:Float32Array,"%Float64Array%":typeof Float64Array>"u"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?G:FinalizationRegistry,"%Function%":N,"%GeneratorFunction%":D,"%Int8Array%":typeof Int8Array>"u"?G:Int8Array,"%Int16Array%":typeof Int16Array>"u"?G:Int16Array,"%Int32Array%":typeof Int32Array>"u"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":x&&w?w(w([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map>"u"?G:Map,"%MapIteratorPrototype%":typeof Map>"u"||!x||!w?G:w(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Y,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?G:Promise,"%Proxy%":typeof Proxy>"u"?G:Proxy,"%RangeError%":Z,"%ReferenceError%":J,"%Reflect%":typeof Reflect>"u"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?G:Set,"%SetIteratorPrototype%":typeof Set>"u"||!x||!w?G:w(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":x&&w?w(""[Symbol.iterator]()):G,"%Symbol%":x?Symbol:G,"%SyntaxError%":q,"%ThrowTypeError%":$,"%TypedArray%":m,"%TypeError%":W,"%Uint8Array%":typeof Uint8Array>"u"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?G:Uint32Array,"%URIError%":I,"%WeakMap%":typeof WeakMap>"u"?G:WeakMap,"%WeakRef%":typeof WeakRef>"u"?G:WeakRef,"%WeakSet%":typeof WeakSet>"u"?G:WeakSet,"%Function.prototype.call%":c,"%Function.prototype.apply%":b,"%Object.defineProperty%":F,"%Object.getPrototypeOf%":a,"%Math.abs%":H,"%Math.floor%":T,"%Math.max%":A,"%Math.min%":P,"%Math.pow%":j,"%Math.round%":E,"%Math.sign%":C,"%Reflect.getPrototypeOf%":U0};if(w)try{null.error}catch(h){B0["%Error.prototype%"]=w(w(h))}var i=function h(Z0){var g;if(Z0==="%AsyncFunction%")g=v("async function () {}");else if(Z0==="%GeneratorFunction%")g=v("function* () {}");else if(Z0==="%AsyncGeneratorFunction%")g=v("async function* () {}");else if(Z0==="%AsyncGenerator%"){var f=h("%AsyncGeneratorFunction%");if(f)g=f.prototype}else if(Z0==="%AsyncIteratorPrototype%"){var R=h("%AsyncGenerator%");if(R&&w)g=w(R.prototype)}return B0[Z0]=g,g},V0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},s=V1(),G0=yU(),r=s.call(c,Array.prototype.concat),y=s.call(b,Array.prototype.splice),n=s.call(c,String.prototype.replace),o=s.call(c,String.prototype.slice),Y0=s.call(c,RegExp.prototype.exec),O0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,z=/\\(\\)?/g,L=function(Z0){var g=o(Z0,0,1),f=o(Z0,-1);if(g==="%"&&f!=="%")throw new q("invalid intrinsic syntax, expected closing `%`");else if(f==="%"&&g!=="%")throw new q("invalid intrinsic syntax, expected opening `%`");var R=[];return n(Z0,O0,function(p,k,V,X){R[R.length]=V?n(X,z,"$1"):k||p}),R},u=function(Z0,g){var f=Z0,R;if(G0(V0,f))R=V0[f],f="%"+R[0]+"%";if(G0(B0,f)){var p=B0[f];if(p===D)p=i(f);if(typeof p>"u"&&!g)throw new W("intrinsic "+Z0+" exists, but is not available. Please file an issue!");return{alias:R,name:f,value:p}}throw new q("intrinsic "+Z0+" does not exist!")};U.exports=function(Z0,g){if(typeof Z0!=="string"||Z0.length===0)throw new W("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof g!=="boolean")throw new W('"allowMissing" argument must be a boolean');if(Y0(/^%?[^%]*%?$/,Z0)===null)throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=L(Z0),R=f.length>0?f[0]:"",p=u("%"+R+"%",g),k=p.name,V=p.value,X=!1,O=p.alias;if(O)R=O[0],y(f,r([0,1],O));for(var _=1,l=!0;_=f.length){var K0=S(V,d);if(l=!!K0,l&&"get"in K0&&!("originalValue"in K0.get))V=K0.get;else V=V[d]}else l=G0(V,d),V=V[d];if(l&&!X)B0[k]=V}}return V}}),PB=R0((B,U)=>{var G=WB(),Y=g8(),Q=Y([G("%String.prototype.indexOf%")]);U.exports=function(Z,J){var q=G(Z,!!J);if(typeof q==="function"&&Q(Z,".prototype.")>-1)return Y([q]);return q}}),gU=R0((B,U)=>{var G=b8()(),Y=PB()("Object.prototype.toString"),Q=function(q){if(G&&q&&typeof q==="object"&&Symbol.toStringTag in q)return!1;return Y(q)==="[object Arguments]"},K=function(q){if(Q(q))return!0;return q!==null&&typeof q==="object"&&"length"in q&&typeof q.length==="number"&&q.length>=0&&Y(q)!=="[object Array]"&&"callee"in q&&Y(q.callee)==="[object Function]"},Z=function(){return Q(arguments)}();Q.isLegacyArguments=K,U.exports=Z?Q:K}),fU=R0((B,U)=>{var G=Object.prototype.toString,Y=Function.prototype.toString,Q=/^\s*(?:function)?\*/,K=b8()(),Z=Object.getPrototypeOf,J=function(){if(!K)return!1;try{return Function("return function*() {}")()}catch(W){}},q;U.exports=function(I){if(typeof I!=="function")return!1;if(Q.test(Y.call(I)))return!0;if(!K)return G.call(I)==="[object GeneratorFunction]";if(!Z)return!1;if(typeof q>"u"){var H=J();q=H?Z(H):!1}return Z(I)===q}}),xU=R0((B,U)=>{var G=Function.prototype.toString,Y=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,Q,K;if(typeof Y==="function"&&typeof Object.defineProperty==="function")try{Q=Object.defineProperty({},"length",{get:function(){throw K}}),K={},Y(function(){throw 42},null,Q)}catch(S){if(S!==K)Y=null}else Y=null;var Z=/^\s*class\b/,J=function(F){try{var M=G.call(F);return Z.test(M)}catch($){return!1}},q=function(F){try{if(J(F))return!1;return G.call(F),!0}catch(M){return!1}},W=Object.prototype.toString,I="[object Object]",H="[object Function]",T="[object GeneratorFunction]",A="[object HTMLAllCollection]",P="[object HTML document.all class]",j="[object HTMLCollection]",E=typeof Symbol==="function"&&!!Symbol.toStringTag,C=!(0 in[,]),N=function(){return!1};if(typeof document==="object"){var v=document.all;if(W.call(v)===W.call(document.all))N=function(F){if((C||!F)&&(typeof F>"u"||typeof F==="object"))try{var M=W.call(F);return(M===A||M===P||M===j||M===I)&&F("")==null}catch($){}return!1}}U.exports=Y?function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;try{Y(F,null,Q)}catch(M){if(M!==K)return!1}return!J(F)&&q(F)}:function(F){if(N(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;if(E)return q(F);if(J(F))return!1;var M=W.call(F);if(M!==H&&M!==T&&!/^\[object HTML/.test(M))return!1;return q(F)}}),_U=R0((B,U)=>{var G=xU(),Y=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,K=function(I,H,T){for(var A=0,P=I.length;A=3)A=T;if(q(I))K(I,H,A);else if(typeof I==="string")Z(I,H,A);else J(I,H,A)}}),hU=R0((B,U)=>{U.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),uU=R0((B,U)=>{d2();var G=hU(),Y=typeof globalThis>"u"?v0:globalThis;U.exports=function(){var K=[];for(var Z=0;Z{var G=_1(),Y=LB(),Q=x1(),K=K1();U.exports=function(J,q,W){if(!J||typeof J!=="object"&&typeof J!=="function")throw new Q("`obj` must be an object or a function`");if(typeof q!=="string"&&typeof q!=="symbol")throw new Q("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new Q("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new Q("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new Q("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new Q("`loose`, if provided, must be a boolean");var I=arguments.length>3?arguments[3]:null,H=arguments.length>4?arguments[4]:null,T=arguments.length>5?arguments[5]:null,A=arguments.length>6?arguments[6]:!1,P=!!K&&K(J,q);if(G)G(J,q,{configurable:T===null&&P?P.configurable:!T,enumerable:I===null&&P?P.enumerable:!I,value:W,writable:H===null&&P?P.writable:!H});else if(A||!I&&!H&&!T)J[q]=W;else throw new Y("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),cU=R0((B,U)=>{var G=_1(),Y=function(){return!!G};Y.hasArrayLengthDefineBug=function(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(K){return!0}},U.exports=Y}),mU=R0((B,U)=>{var G=WB(),Y=dU(),Q=cU()(),K=K1(),Z=x1(),J=G("%Math.floor%");U.exports=function(W,I){if(typeof W!=="function")throw new Z("`fn` is not a function");if(typeof I!=="number"||I<0||I>4294967295||J(I)!==I)throw new Z("`length` must be a positive 32-bit integer");var H=arguments.length>2&&!!arguments[2],T=!0,A=!0;if("length"in W&&K){var P=K(W,"length");if(P&&!P.configurable)T=!1;if(P&&!P.writable)A=!1}if(T||A||!H)if(Q)Y(W,"length",I,!0,!0);else Y(W,"length",I);return W}}),lU=R0((B,U)=>{var G=V1(),Y=y8(),Q=HB();U.exports=function(){return Q(G,Y,arguments)}}),aU=R0((B,U)=>{var G=mU(),Y=_1(),Q=g8(),K=lU();if(U.exports=function(J){var q=Q(arguments),W=J.length-(arguments.length-1);return G(q,1+(W>0?W:0),!0)},Y)Y(U.exports,"apply",{value:K});else U.exports.apply=K}),AB=R0((B,U)=>{d2();var G=_U(),Y=uU(),Q=aU(),K=PB(),Z=K1(),J=FB(),q=K("Object.prototype.toString"),W=b8()(),I=typeof globalThis>"u"?v0:globalThis,H=Y(),T=K("String.prototype.slice"),A=K("Array.prototype.indexOf",!0)||function(N,v){for(var S=0;S-1)return v;if(v!=="Object")return!1;return E(N)}if(!Z)return null;return j(N)}}),pU=R0((B,U)=>{var G=AB();U.exports=function(Q){return!!G(Q)}}),rU=R0((B)=>{var U=gU(),G=fU(),Y=AB(),Q=pU();function K(O){return O.call.bind(O)}var Z=typeof BigInt<"u",J=typeof Symbol<"u",q=K(Object.prototype.toString),W=K(Number.prototype.valueOf),I=K(String.prototype.valueOf),H=K(Boolean.prototype.valueOf);if(Z)var T=K(BigInt.prototype.valueOf);if(J)var A=K(Symbol.prototype.valueOf);function P(O,_){if(typeof O!=="object")return!1;try{return _(O),!0}catch(l){return!1}}B.isArgumentsObject=U,B.isGeneratorFunction=G,B.isTypedArray=Q;function j(O){return typeof Promise<"u"&&O instanceof Promise||O!==null&&typeof O==="object"&&typeof O.then==="function"&&typeof O.catch==="function"}B.isPromise=j;function E(O){if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView)return ArrayBuffer.isView(O);return Q(O)||n(O)}B.isArrayBufferView=E;function C(O){return Y(O)==="Uint8Array"}B.isUint8Array=C;function N(O){return Y(O)==="Uint8ClampedArray"}B.isUint8ClampedArray=N;function v(O){return Y(O)==="Uint16Array"}B.isUint16Array=v;function S(O){return Y(O)==="Uint32Array"}B.isUint32Array=S;function F(O){return Y(O)==="Int8Array"}B.isInt8Array=F;function M(O){return Y(O)==="Int16Array"}B.isInt16Array=M;function $(O){return Y(O)==="Int32Array"}B.isInt32Array=$;function x(O){return Y(O)==="Float32Array"}B.isFloat32Array=x;function w(O){return Y(O)==="Float64Array"}B.isFloat64Array=w;function a(O){return Y(O)==="BigInt64Array"}B.isBigInt64Array=a;function U0(O){return Y(O)==="BigUint64Array"}B.isBigUint64Array=U0;function b(O){return q(O)==="[object Map]"}b.working=typeof Map<"u"&&b(new Map);function c(O){if(typeof Map>"u")return!1;return b.working?b(O):O instanceof Map}B.isMap=c;function D(O){return q(O)==="[object Set]"}D.working=typeof Set<"u"&&D(new Set);function m(O){if(typeof Set>"u")return!1;return D.working?D(O):O instanceof Set}B.isSet=m;function B0(O){return q(O)==="[object WeakMap]"}B0.working=typeof WeakMap<"u"&&B0(new WeakMap);function i(O){if(typeof WeakMap>"u")return!1;return B0.working?B0(O):O instanceof WeakMap}B.isWeakMap=i;function V0(O){return q(O)==="[object WeakSet]"}V0.working=typeof WeakSet<"u"&&V0(new WeakSet);function s(O){return V0(O)}B.isWeakSet=s;function G0(O){return q(O)==="[object ArrayBuffer]"}G0.working=typeof ArrayBuffer<"u"&&G0(new ArrayBuffer);function r(O){if(typeof ArrayBuffer>"u")return!1;return G0.working?G0(O):O instanceof ArrayBuffer}B.isArrayBuffer=r;function y(O){return q(O)==="[object DataView]"}y.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&y(new DataView(new ArrayBuffer(1),0,1));function n(O){if(typeof DataView>"u")return!1;return y.working?y(O):O instanceof DataView}B.isDataView=n;var o=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Y0(O){return q(O)==="[object SharedArrayBuffer]"}function O0(O){if(typeof o>"u")return!1;if(typeof Y0.working>"u")Y0.working=Y0(new o);return Y0.working?Y0(O):O instanceof o}B.isSharedArrayBuffer=O0;function z(O){return q(O)==="[object AsyncFunction]"}B.isAsyncFunction=z;function L(O){return q(O)==="[object Map Iterator]"}B.isMapIterator=L;function u(O){return q(O)==="[object Set Iterator]"}B.isSetIterator=u;function h(O){return q(O)==="[object Generator]"}B.isGeneratorObject=h;function Z0(O){return q(O)==="[object WebAssembly.Module]"}B.isWebAssemblyCompiledModule=Z0;function g(O){return P(O,W)}B.isNumberObject=g;function f(O){return P(O,I)}B.isStringObject=f;function R(O){return P(O,H)}B.isBooleanObject=R;function p(O){return Z&&P(O,T)}B.isBigIntObject=p;function k(O){return J&&P(O,A)}B.isSymbolObject=k;function V(O){return g(O)||f(O)||R(O)||p(O)||k(O)}B.isBoxedPrimitive=V;function X(O){return typeof Uint8Array<"u"&&(r(O)||O0(O))}B.isAnyArrayBuffer=X,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(O){Object.defineProperty(B,O,{enumerable:!1,value:function(){throw Error(O+" is not supported in userland")}})})}),iU=R0((B,U)=>{U.exports=function(Y){return Y&&typeof Y==="object"&&typeof Y.copy==="function"&&typeof Y.fill==="function"&&typeof Y.readUInt8==="function"}}),jB=R0((B)=>{P2();var U=Object.getOwnPropertyDescriptors||function(n){var o=Object.keys(n),Y0={};for(var O0=0;O0=O0)return u;switch(u){case"%s":return String(Y0[o++]);case"%d":return Number(Y0[o++]);case"%j":try{return JSON.stringify(Y0[o++])}catch(h){return"[Circular]"}default:return u}});for(var L=Y0[o];o"u")return function(){return B.deprecate(y,n).apply(this,arguments)};var o=!1;function Y0(){if(!o){if(P0.throwDeprecation)throw Error(n);else if(P0.traceDeprecation)console.trace(n);else console.error(n);o=!0}return y.apply(this,arguments)}return Y0};var Y={},Q=/^$/;if(P0.env.NODE_DEBUG){var K=P0.env.NODE_DEBUG;K=K.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Q=new RegExp("^"+K+"$","i")}B.debuglog=function(y){if(y=y.toUpperCase(),!Y[y])if(Q.test(y)){var n=P0.pid;Y[y]=function(){var o=B.format.apply(B,arguments);console.error("%s %d: %s",y,n,o)}}else Y[y]=function(){};return Y[y]};function Z(y,n){var o={seen:[],stylize:q};if(arguments.length>=3)o.depth=arguments[2];if(arguments.length>=4)o.colors=arguments[3];if(C(n))o.showHidden=n;else if(n)B._extend(o,n);if($(o.showHidden))o.showHidden=!1;if($(o.depth))o.depth=2;if($(o.colors))o.colors=!1;if($(o.customInspect))o.customInspect=!0;if(o.colors)o.stylize=J;return I(o,y,o.depth)}B.inspect=Z,Z.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Z.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function J(y,n){var o=Z.styles[n];if(o)return"\x1B["+Z.colors[o][0]+"m"+y+"\x1B["+Z.colors[o][1]+"m";else return y}function q(y,n){return y}function W(y){var n={};return y.forEach(function(o,Y0){n[o]=!0}),n}function I(y,n,o){if(y.customInspect&&n&&b(n.inspect)&&n.inspect!==B.inspect&&!(n.constructor&&n.constructor.prototype===n)){var Y0=n.inspect(o,y);if(!F(Y0))Y0=I(y,Y0,o);return Y0}var O0=H(y,n);if(O0)return O0;var z=Object.keys(n),L=W(z);if(y.showHidden)z=Object.getOwnPropertyNames(n);if(U0(n)&&(z.indexOf("message")>=0||z.indexOf("description")>=0))return T(n);if(z.length===0){if(b(n)){var u=n.name?": "+n.name:"";return y.stylize("[Function"+u+"]","special")}if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");if(a(n))return y.stylize(Date.prototype.toString.call(n),"date");if(U0(n))return T(n)}var h="",Z0=!1,g=["{","}"];if(E(n))Z0=!0,g=["[","]"];if(b(n))h=" [Function"+(n.name?": "+n.name:"")+"]";if(x(n))h=" "+RegExp.prototype.toString.call(n);if(a(n))h=" "+Date.prototype.toUTCString.call(n);if(U0(n))h=" "+T(n);if(z.length===0&&(!Z0||n.length==0))return g[0]+h+g[1];if(o<0)if(x(n))return y.stylize(RegExp.prototype.toString.call(n),"regexp");else return y.stylize("[Object]","special");y.seen.push(n);var f;if(Z0)f=A(y,n,o,L,z);else f=z.map(function(R){return P(y,n,o,L,R,Z0)});return y.seen.pop(),j(f,h,g)}function H(y,n){if($(n))return y.stylize("undefined","undefined");if(F(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return y.stylize(o,"string")}if(S(n))return y.stylize(""+n,"number");if(C(n))return y.stylize(""+n,"boolean");if(N(n))return y.stylize("null","null")}function T(y){return"["+Error.prototype.toString.call(y)+"]"}function A(y,n,o,Y0,O0){var z=[];for(var L=0,u=n.length;L-1)if(z)u=u.split(` `).map(function(Z0){return" "+Z0}).join(` `).slice(2);else u=` `+u.split(` `).map(function(Z0){return" "+Z0}).join(` -`)}else u=y.stylize("[Circular]","special");if($(L)){if(w&&O0.match(/^\d+$/))return u;if(L=JSON.stringify(""+O0),L.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))L=L.slice(1,-1),L=y.stylize(L,"name");else L=L.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),L=y.stylize(L,"string")}return L+": "+u}function j(y,n,o){var Y0=0;if(y.reduce(function(O0,w){if(Y0++,w.indexOf(` -`)>=0)Y0++;return O0+w.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return o[0]+(n===""?"":n+` +`)}else u=y.stylize("[Circular]","special");if($(L)){if(z&&O0.match(/^\d+$/))return u;if(L=JSON.stringify(""+O0),L.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))L=L.slice(1,-1),L=y.stylize(L,"name");else L=L.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),L=y.stylize(L,"string")}return L+": "+u}function j(y,n,o){var Y0=0;if(y.reduce(function(O0,z){if(Y0++,z.indexOf(` +`)>=0)Y0++;return O0+z.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return o[0]+(n===""?"":n+` `)+" "+y.join(`, - `)+" "+o[1];return o[0]+n+" "+y.join(", ")+" "+o[1]}B.types=rU();function E(y){return Array.isArray(y)}B.isArray=E;function C(y){return typeof y==="boolean"}B.isBoolean=C;function N(y){return y===null}B.isNull=N;function v(y){return y==null}B.isNullOrUndefined=v;function S(y){return typeof y==="number"}B.isNumber=S;function F(y){return typeof y==="string"}B.isString=F;function M(y){return typeof y==="symbol"}B.isSymbol=M;function $(y){return y===void 0}B.isUndefined=$;function x(y){return z(y)&&D(y)==="[object RegExp]"}B.isRegExp=x,B.types.isRegExp=x;function z(y){return typeof y==="object"&&y!==null}B.isObject=z;function a(y){return z(y)&&D(y)==="[object Date]"}B.isDate=a,B.types.isDate=a;function U0(y){return z(y)&&(D(y)==="[object Error]"||y instanceof Error)}B.isError=U0,B.types.isNativeError=U0;function b(y){return typeof y==="function"}B.isFunction=b;function c(y){return y===null||typeof y==="boolean"||typeof y==="number"||typeof y==="string"||typeof y==="symbol"||typeof y>"u"}B.isPrimitive=c,B.isBuffer=iU();function D(y){return Object.prototype.toString.call(y)}function m(y){return y<10?"0"+y.toString(10):y.toString(10)}var B0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function i(){var y=new Date,n=[m(y.getHours()),m(y.getMinutes()),m(y.getSeconds())].join(":");return[y.getDate(),B0[y.getMonth()],n].join(" ")}B.log=function(){console.log("%s - %s",i(),B.format.apply(B,arguments))},B.inherits=W2(),B._extend=function(y,n){if(!n||!z(n))return y;var o=Object.keys(n),Y0=o.length;while(Y0--)y[o[Y0]]=n[o[Y0]];return y};function V0(y,n){return Object.prototype.hasOwnProperty.call(y,n)}var s=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;B.promisify=function(n){if(typeof n!=="function")throw TypeError('The "original" argument must be of type Function');if(s&&n[s]){var o=n[s];if(typeof o!=="function")throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(o,s,{value:o,enumerable:!1,writable:!1,configurable:!0}),o}function o(){var Y0,O0,w=new Promise(function(h,Z0){Y0=h,O0=Z0}),L=[];for(var u=0;u{function G(P,j){var E=Object.keys(P);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(P);j&&(C=C.filter(function(N){return Object.getOwnPropertyDescriptor(P,N).enumerable})),E.push.apply(E,C)}return E}function Y(P){for(var j=1;j0)this.tail.next=C;else this.head=C;this.tail=C,++this.length}},{key:"unshift",value:function(E){var C={data:E,next:this.head};if(this.length===0)this.tail=C;this.head=C,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var E=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,E}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";var C=this.head,N=""+C.data;while(C=C.next)N+=E+C.data;return N}},{key:"concat",value:function(E){if(this.length===0)return I.alloc(0);var C=I.allocUnsafe(E>>>0),N=this.head,v=0;while(N)A(N.data,C,v),v+=N.data.length,N=N.next;return C}},{key:"consume",value:function(E,C){var N;if(ES.length?S.length:E;if(F===S.length)v+=S;else v+=S.slice(0,E);if(E-=F,E===0){if(F===S.length)if(++N,C.next)this.head=C.next;else this.head=this.tail=null;else this.head=C,C.data=S.slice(F);break}++N}return this.length-=N,v}},{key:"_getBuffer",value:function(E){var C=I.allocUnsafe(E),N=this.head,v=1;N.data.copy(C),E-=N.data.length;while(N=N.next){var S=N.data,F=E>S.length?S.length:E;if(S.copy(C,C.length-E,0,F),E-=F,E===0){if(F===S.length)if(++v,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=S.slice(F);break}++v}return this.length-=v,C}},{key:T,value:function(E,C){return H(this,Y(Y({},C),{},{depth:0,customInspect:!1}))}}]),P}()}),NB=R0((B,U)=>{P2();function G(q,W){var I=this,H=this._readableState&&this._readableState.destroyed,T=this._writableState&&this._writableState.destroyed;if(H||T){if(W)W(q);else if(q){if(!this._writableState)P0.nextTick(Z,this,q);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,P0.nextTick(Z,this,q)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(q||null,function(A){if(!W&&A)if(!I._writableState)P0.nextTick(Y,I,A);else if(!I._writableState.errorEmitted)I._writableState.errorEmitted=!0,P0.nextTick(Y,I,A);else P0.nextTick(Q,I);else if(W)P0.nextTick(Q,I),W(A);else P0.nextTick(Q,I)}),this}function Y(q,W){Z(q,W),Q(q)}function Q(q){if(q._writableState&&!q._writableState.emitClose)return;if(q._readableState&&!q._readableState.emitClose)return;q.emit("close")}function K(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function Z(q,W){q.emit("error",W)}function J(q,W){var{_readableState:I,_writableState:H}=q;if(I&&I.autoDestroy||H&&H.autoDestroy)q.destroy(W);else q.emit("error",W)}U.exports={destroy:G,undestroy:K,errorOrDestroy:J}}),c2=R0((B,U)=>{function G(W,I){W.prototype=Object.create(I.prototype),W.prototype.constructor=W,W.__proto__=I}var Y={};function Q(W,I,H){if(!H)H=Error;function T(P,j,E){if(typeof I==="string")return I;else return I(P,j,E)}var A=function(P){G(j,P);function j(E,C,N){return P.call(this,T(E,C,N))||this}return j}(H);A.prototype.name=H.name,A.prototype.code=W,Y[W]=A}function K(W,I){if(Array.isArray(W)){var H=W.length;if(W=W.map(function(T){return String(T)}),H>2)return"one of ".concat(I," ").concat(W.slice(0,H-1).join(", "),", or ")+W[H-1];else if(H===2)return"one of ".concat(I," ").concat(W[0]," or ").concat(W[1]);else return"of ".concat(I," ").concat(W[0])}else return"of ".concat(I," ").concat(String(W))}function Z(W,I,H){return W.substr(!H||H<0?0:+H,I.length)===I}function J(W,I,H){if(H===void 0||H>W.length)H=W.length;return W.substring(H-I.length,H)===I}function q(W,I,H){if(typeof H!=="number")H=0;if(H+I.length>W.length)return!1;else return W.indexOf(I,H)!==-1}Q("ERR_INVALID_OPT_VALUE",function(W,I){return'The value "'+I+'" is invalid for option "'+W+'"'},TypeError),Q("ERR_INVALID_ARG_TYPE",function(W,I,H){var T;if(typeof I==="string"&&Z(I,"not "))T="must not be",I=I.replace(/^not /,"");else T="must be";var A;if(J(W," argument"))A="The ".concat(W," ").concat(T," ").concat(K(I,"type"));else{var P=q(W,".")?"property":"argument";A='The "'.concat(W,'" ').concat(P," ").concat(T," ").concat(K(I,"type"))}return A+=". Received type ".concat(typeof H),A},TypeError),Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Q("ERR_METHOD_NOT_IMPLEMENTED",function(W){return"The "+W+" method is not implemented"}),Q("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Q("ERR_STREAM_DESTROYED",function(W){return"Cannot call "+W+" after a stream was destroyed"}),Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Q("ERR_STREAM_WRITE_AFTER_END","write after end"),Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Q("ERR_UNKNOWN_ENCODING",function(W){return"Unknown encoding: "+W},TypeError),Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),U.exports.codes=Y}),zB=R0((B,U)=>{var G=c2().codes.ERR_INVALID_OPT_VALUE;function Y(K,Z,J){return K.highWaterMark!=null?K.highWaterMark:Z?K[J]:null}function Q(K,Z,J,q){var W=Y(Z,q,J);if(W!=null){if(!(isFinite(W)&&Math.floor(W)===W)||W<0)throw new G(q?J:"highWaterMark",W);return Math.floor(W)}return K.objectMode?16:16384}U.exports={getHighWaterMark:Q}}),sU=R0((B,U)=>{d2(),U.exports=G;function G(Q,K){if(Y("noDeprecation"))return Q;var Z=!1;function J(){if(!Z){if(Y("throwDeprecation"))throw Error(K);else if(Y("traceDeprecation"))console.trace(K);else console.warn(K);Z=!0}return Q.apply(this,arguments)}return J}function Y(Q){try{if(!v0.localStorage)return!1}catch(Z){return!1}var K=v0.localStorage[Q];if(K==null)return!1;return String(K).toLowerCase()==="true"}}),wB=R0((B,U)=>{d2(),P2(),U.exports=z;function G(w){var L=this;this.next=null,this.entry=null,this.finish=function(){O0(L,w)}}var Y;z.WritableState=$;var Q={deprecate:sU()},K=qB(),Z=f1().Buffer,J=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function q(w){return Z.from(w)}function W(w){return Z.isBuffer(w)||w instanceof J}var I=NB(),H=zB().getHighWaterMark,T=c2().codes,A=T.ERR_INVALID_ARG_TYPE,P=T.ERR_METHOD_NOT_IMPLEMENTED,j=T.ERR_MULTIPLE_CALLBACK,E=T.ERR_STREAM_CANNOT_PIPE,C=T.ERR_STREAM_DESTROYED,N=T.ERR_STREAM_NULL_VALUES,v=T.ERR_STREAM_WRITE_AFTER_END,S=T.ERR_UNKNOWN_ENCODING,F=I.errorOrDestroy;W2()(z,K);function M(){}function $(w,L,u){if(Y=Y||u2(),w=w||{},typeof u!=="boolean")u=L instanceof Y;if(this.objectMode=!!w.objectMode,u)this.objectMode=this.objectMode||!!w.writableObjectMode;this.highWaterMark=H(this,w,"writableHighWaterMark",u),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=w.decodeStrings===!1;this.decodeStrings=!h,this.defaultEncoding=w.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z0){i(L,Z0)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=w.emitClose!==!1,this.autoDestroy=!!w.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new G(this)}$.prototype.getBuffer=function(){var L=this.bufferedRequest,u=[];while(L)u.push(L),L=L.next;return u},function(){try{Object.defineProperty($.prototype,"buffer",{get:Q.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(w){}}();var x;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")x=Function.prototype[Symbol.hasInstance],Object.defineProperty(z,Symbol.hasInstance,{value:function(L){if(x.call(this,L))return!0;if(this!==z)return!1;return L&&L._writableState instanceof $}});else x=function(L){return L instanceof this};function z(w){Y=Y||u2();var L=this instanceof Y;if(!L&&!x.call(z,this))return new z(w);if(this._writableState=new $(w,this,L),this.writable=!0,w){if(typeof w.write==="function")this._write=w.write;if(typeof w.writev==="function")this._writev=w.writev;if(typeof w.destroy==="function")this._destroy=w.destroy;if(typeof w.final==="function")this._final=w.final}K.call(this)}z.prototype.pipe=function(){F(this,new E)};function a(w,L){var u=new v;F(w,u),P0.nextTick(L,u)}function U0(w,L,u,h){var Z0;if(u===null)Z0=new N;else if(typeof u!=="string"&&!L.objectMode)Z0=new A("chunk",["string","Buffer"],u);if(Z0)return F(w,Z0),P0.nextTick(h,Z0),!1;return!0}z.prototype.write=function(w,L,u){var h=this._writableState,Z0=!1,g=!h.objectMode&&W(w);if(g&&!Z.isBuffer(w))w=q(w);if(typeof L==="function")u=L,L=null;if(g)L="buffer";else if(!L)L=h.defaultEncoding;if(typeof u!=="function")u=M;if(h.ending)a(this,u);else if(g||U0(this,h,w,u))h.pendingcb++,Z0=c(this,h,g,w,L,u);return Z0},z.prototype.cork=function(){this._writableState.corked++},z.prototype.uncork=function(){var w=this._writableState;if(w.corked){if(w.corked--,!w.writing&&!w.corked&&!w.bufferProcessing&&w.bufferedRequest)G0(this,w)}},z.prototype.setDefaultEncoding=function(L){if(typeof L==="string")L=L.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((L+"").toLowerCase())>-1))throw new S(L);return this._writableState.defaultEncoding=L,this},Object.defineProperty(z.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function b(w,L,u){if(!w.objectMode&&w.decodeStrings!==!1&&typeof L==="string")L=Z.from(L,u);return L}Object.defineProperty(z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function c(w,L,u,h,Z0,g){if(!u){var f=b(L,h,Z0);if(h!==f)u=!0,Z0="buffer",h=f}var R=L.objectMode?1:h.length;L.length+=R;var p=L.length{P2();var G=Object.keys||function(H){var T=[];for(var A in H)T.push(A);return T};U.exports=q;var Y=EB(),Q=wB();W2()(q,Y);var K=G(Q.prototype);for(var Z=0;Z{var G=f1(),Y=G.Buffer;function Q(Z,J){for(var q in Z)J[q]=Z[q]}if(Y.from&&Y.alloc&&Y.allocUnsafe&&Y.allocUnsafeSlow)U.exports=G;else Q(G,B),B.Buffer=K;function K(Z,J,q){return Y(Z,J,q)}Q(Y,K),K.from=function(Z,J,q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return Y(Z,J,q)},K.alloc=function(Z,J,q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var W=Y(Z);if(J!==void 0)if(typeof q==="string")W.fill(J,q);else W.fill(J);else W.fill(0);return W},K.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return Y(Z)},K.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),F8=R0((B)=>{var U=oU().Buffer,G=U.isEncoding||function(N){switch(N=""+N,N&&N.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Y(N){if(!N)return"utf8";var v;while(!0)switch(N){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return N;default:if(v)return;N=(""+N).toLowerCase(),v=!0}}function Q(N){var v=Y(N);if(typeof v!=="string"&&(U.isEncoding===G||!G(N)))throw Error("Unknown encoding: "+N);return v||N}B.StringDecoder=K;function K(N){this.encoding=Q(N);var v;switch(this.encoding){case"utf16le":this.text=T,this.end=A,v=4;break;case"utf8":this.fillLast=W,v=4;break;case"base64":this.text=P,this.end=j,v=3;break;default:this.write=E,this.end=C;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=U.allocUnsafe(v)}K.prototype.write=function(N){if(N.length===0)return"";var v,S;if(this.lastNeed){if(v=this.fillLast(N),v===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;if(S>5===6)return 2;else if(N>>4===14)return 3;else if(N>>3===30)return 4;return N>>6===2?-1:-2}function J(N,v,S){var F=v.length-1;if(F=0){if(M>0)N.lastNeed=M-1;return M}if(--F=0){if(M>0)N.lastNeed=M-2;return M}if(--F=0){if(M>0)if(M===2)M=0;else N.lastNeed=M-3;return M}return 0}function q(N,v,S){if((v[0]&192)!==128)return N.lastNeed=0,"�";if(N.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return N.lastNeed=1,"�";if(N.lastNeed>2&&v.length>2){if((v[2]&192)!==128)return N.lastNeed=2,"�"}}}function W(N){var v=this.lastTotal-this.lastNeed,S=q(this,N,v);if(S!==void 0)return S;if(this.lastNeed<=N.length)return N.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);N.copy(this.lastChar,v,0,N.length),this.lastNeed-=N.length}function I(N,v){var S=J(this,N,v);if(!this.lastNeed)return N.toString("utf8",v);this.lastTotal=S;var F=N.length-(S-this.lastNeed);return N.copy(this.lastChar,0,F),N.toString("utf8",v,F)}function H(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+"�";return v}function T(N,v){if((N.length-v)%2===0){var S=N.toString("utf16le",v);if(S){var F=S.charCodeAt(S.length-1);if(F>=55296&&F<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=N[N.length-1],N.toString("utf16le",v,N.length-1)}function A(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,S)}return v}function P(N,v){var S=(N.length-v)%3;if(S===0)return N.toString("base64",v);if(this.lastNeed=3-S,this.lastTotal=3,S===1)this.lastChar[0]=N[N.length-1];else this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1];return N.toString("base64",v,N.length-S)}function j(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+this.lastChar.toString("base64",0,3-this.lastNeed);return v}function E(N){return N.toString(this.encoding)}function C(N){return N&&N.length?this.write(N):""}}),f8=R0((B,U)=>{var G=c2().codes.ERR_STREAM_PREMATURE_CLOSE;function Y(J){var q=!1;return function(){if(q)return;q=!0;for(var W=arguments.length,I=Array(W),H=0;H{P2();var G;function Y(S,F,M){if(F=Q(F),F in S)Object.defineProperty(S,F,{value:M,enumerable:!0,configurable:!0,writable:!0});else S[F]=M;return S}function Q(S){var F=K(S,"string");return typeof F==="symbol"?F:String(F)}function K(S,F){if(typeof S!=="object"||S===null)return S;var M=S[Symbol.toPrimitive];if(M!==void 0){var $=M.call(S,F||"default");if(typeof $!=="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(F==="string"?String:Number)(S)}var Z=f8(),J=Symbol("lastResolve"),q=Symbol("lastReject"),W=Symbol("error"),I=Symbol("ended"),H=Symbol("lastPromise"),T=Symbol("handlePromise"),A=Symbol("stream");function P(S,F){return{value:S,done:F}}function j(S){var F=S[J];if(F!==null){var M=S[A].read();if(M!==null)S[H]=null,S[J]=null,S[q]=null,F(P(M,!1))}}function E(S){P0.nextTick(j,S)}function C(S,F){return function(M,$){S.then(function(){if(F[I]){M(P(void 0,!0));return}F[T](M,$)},$)}}var N=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((G={get stream(){return this[A]},next:function(){var F=this,M=this[W];if(M!==null)return Promise.reject(M);if(this[I])return Promise.resolve(P(void 0,!0));if(this[A].destroyed)return new Promise(function(a,U0){P0.nextTick(function(){if(F[W])U0(F[W]);else a(P(void 0,!0))})});var $=this[H],x;if($)x=new Promise(C($,this));else{var z=this[A].read();if(z!==null)return Promise.resolve(P(z,!1));x=new Promise(this[T])}return this[H]=x,x}},Y(G,Symbol.asyncIterator,function(){return this}),Y(G,"return",function(){var F=this;return new Promise(function(M,$){F[A].destroy(null,function(x){if(x){$(x);return}M(P(void 0,!0))})})}),G),N);U.exports=function(F){var M,$=Object.create(v,(M={},Y(M,A,{value:F,writable:!0}),Y(M,J,{value:null,writable:!0}),Y(M,q,{value:null,writable:!0}),Y(M,W,{value:null,writable:!0}),Y(M,I,{value:F._readableState.endEmitted,writable:!0}),Y(M,T,{value:function(z,a){var U0=$[A].read();if(U0)$[H]=null,$[J]=null,$[q]=null,z(P(U0,!1));else $[J]=z,$[q]=a},writable:!0}),M));return $[H]=null,Z(F,function(x){if(x&&x.code!=="ERR_STREAM_PREMATURE_CLOSE"){var z=$[q];if(z!==null)$[H]=null,$[J]=null,$[q]=null,z(x);$[W]=x;return}var a=$[J];if(a!==null)$[H]=null,$[J]=null,$[q]=null,a(P(void 0,!0));$[I]=!0}),F.on("readable",E.bind(null,$)),$}}),eU=R0((B,U)=>{U.exports=function(){throw Error("Readable.from is not available in the browser")}}),EB=R0((B,U)=>{d2(),P2(),U.exports=a;var G;a.ReadableState=z,S8().EventEmitter;var Y=function(f,R){return f.listeners(R).length},Q=qB(),K=f1().Buffer,Z=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function J(g){return K.from(g)}function q(g){return K.isBuffer(g)||g instanceof Z}var W=jB(),I;if(W&&W.debuglog)I=W.debuglog("stream");else I=function(){};var H=nU(),T=NB(),A=zB().getHighWaterMark,P=c2().codes,j=P.ERR_INVALID_ARG_TYPE,E=P.ERR_STREAM_PUSH_AFTER_EOF,C=P.ERR_METHOD_NOT_IMPLEMENTED,N=P.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,S,F;W2()(a,Q);var M=T.errorOrDestroy,$=["error","close","destroy","pause","resume"];function x(g,f,R){if(typeof g.prependListener==="function")return g.prependListener(f,R);if(!g._events||!g._events[f])g.on(f,R);else if(Array.isArray(g._events[f]))g._events[f].unshift(R);else g._events[f]=[R,g._events[f]]}function z(g,f,R){if(G=G||u2(),g=g||{},typeof R!=="boolean")R=f instanceof G;if(this.objectMode=!!g.objectMode,R)this.objectMode=this.objectMode||!!g.readableObjectMode;if(this.highWaterMark=A(this,g,"readableHighWaterMark",R),this.buffer=new H,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=g.emitClose!==!1,this.autoDestroy=!!g.autoDestroy,this.destroyed=!1,this.defaultEncoding=g.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,g.encoding){if(!v)v=F8().StringDecoder;this.decoder=new v(g.encoding),this.encoding=g.encoding}}function a(g){if(G=G||u2(),!(this instanceof a))return new a(g);var f=this instanceof G;if(this._readableState=new z(g,this,f),this.readable=!0,g){if(typeof g.read==="function")this._read=g.read;if(typeof g.destroy==="function")this._destroy=g.destroy}Q.call(this)}Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(f){if(!this._readableState)return;this._readableState.destroyed=f}}),a.prototype.destroy=T.destroy,a.prototype._undestroy=T.undestroy,a.prototype._destroy=function(g,f){f(g)},a.prototype.push=function(g,f){var R=this._readableState,p;if(!R.objectMode){if(typeof g==="string"){if(f=f||R.defaultEncoding,f!==R.encoding)g=K.from(g,f),f="";p=!0}}else p=!0;return U0(this,g,f,!1,p)},a.prototype.unshift=function(g){return U0(this,g,null,!0,!1)};function U0(g,f,R,p,k){I("readableAddChunk",f);var V=g._readableState;if(f===null)V.reading=!1,i(g,V);else{var X;if(!k)X=c(V,f);if(X)M(g,X);else if(V.objectMode||f&&f.length>0){if(typeof f!=="string"&&!V.objectMode&&Object.getPrototypeOf(f)!==K.prototype)f=J(f);if(p)if(V.endEmitted)M(g,new N);else b(g,V,f,!0);else if(V.ended)M(g,new E);else if(V.destroyed)return!1;else if(V.reading=!1,V.decoder&&!R)if(f=V.decoder.write(f),V.objectMode||f.length!==0)b(g,V,f,!1);else G0(g,V);else b(g,V,f,!1)}else if(!p)V.reading=!1,G0(g,V)}return!V.ended&&(V.length=D)g=D;else g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++;return g}function B0(g,f){if(g<=0||f.length===0&&f.ended)return 0;if(f.objectMode)return 1;if(g!==g)if(f.flowing&&f.length)return f.buffer.head.data.length;else return f.length;if(g>f.highWaterMark)f.highWaterMark=m(g);if(g<=f.length)return g;if(!f.ended)return f.needReadable=!0,0;return f.length}a.prototype.read=function(g){I("read",g),g=parseInt(g,10);var f=this._readableState,R=g;if(g!==0)f.emittedReadable=!1;if(g===0&&f.needReadable&&((f.highWaterMark!==0?f.length>=f.highWaterMark:f.length>0)||f.ended)){if(I("read: emitReadable",f.length,f.ended),f.length===0&&f.ended)u(this);else V0(this);return null}if(g=B0(g,f),g===0&&f.ended){if(f.length===0)u(this);return null}var p=f.needReadable;if(I("need readable",p),f.length===0||f.length-g0)k=L(g,f);else k=null;if(k===null)f.needReadable=f.length<=f.highWaterMark,g=0;else f.length-=g,f.awaitDrain=0;if(f.length===0){if(!f.ended)f.needReadable=!0;if(R!==g&&f.ended)u(this)}if(k!==null)this.emit("data",k);return k};function i(g,f){if(I("onEofChunk"),f.ended)return;if(f.decoder){var R=f.decoder.end();if(R&&R.length)f.buffer.push(R),f.length+=f.objectMode?1:R.length}if(f.ended=!0,f.sync)V0(g);else if(f.needReadable=!1,!f.emittedReadable)f.emittedReadable=!0,s(g)}function V0(g){var f=g._readableState;if(I("emitReadable",f.needReadable,f.emittedReadable),f.needReadable=!1,!f.emittedReadable)I("emitReadable",f.flowing),f.emittedReadable=!0,P0.nextTick(s,g)}function s(g){var f=g._readableState;if(I("emitReadable_",f.destroyed,f.length,f.ended),!f.destroyed&&(f.length||f.ended))g.emit("readable"),f.emittedReadable=!1;f.needReadable=!f.flowing&&!f.ended&&f.length<=f.highWaterMark,w(g)}function G0(g,f){if(!f.readingMore)f.readingMore=!0,P0.nextTick(r,g,f)}function r(g,f){while(!f.reading&&!f.ended&&(f.length1&&Z0(p.pipes,g)!==-1)&&!_)I("false write response, pause",p.awaitDrain),p.awaitDrain++;R.pause()}}function Q0(F0){if(I("onerror",F0),I0(),g.removeListener("error",Q0),Y(g,"error")===0)M(g,F0)}x(g,"error",Q0);function X0(){g.removeListener("finish",K0),I0()}g.once("close",X0);function K0(){I("onfinish"),g.removeListener("close",X0),I0()}g.once("finish",K0);function I0(){I("unpipe"),R.unpipe(g)}if(g.emit("pipe",R),!p.flowing)I("pipe resume"),R.resume();return g};function y(g){return function(){var R=g._readableState;if(I("pipeOnDrain",R.awaitDrain),R.awaitDrain)R.awaitDrain--;if(R.awaitDrain===0&&Y(g,"data"))R.flowing=!0,w(g)}}a.prototype.unpipe=function(g){var f=this._readableState,R={hasUnpiped:!1};if(f.pipesCount===0)return this;if(f.pipesCount===1){if(g&&g!==f.pipes)return this;if(!g)g=f.pipes;if(f.pipes=null,f.pipesCount=0,f.flowing=!1,g)g.emit("unpipe",this,R);return this}if(!g){var{pipes:p,pipesCount:k}=f;f.pipes=null,f.pipesCount=0,f.flowing=!1;for(var V=0;V0,p.flowing!==!1)this.resume()}else if(g==="readable"){if(!p.endEmitted&&!p.readableListening){if(p.readableListening=p.needReadable=!0,p.flowing=!1,p.emittedReadable=!1,I("on readable",p.length,p.reading),p.length)V0(this);else if(!p.reading)P0.nextTick(o,this)}}return R},a.prototype.addListener=a.prototype.on,a.prototype.removeListener=function(g,f){var R=Q.prototype.removeListener.call(this,g,f);if(g==="readable")P0.nextTick(n,this);return R},a.prototype.removeAllListeners=function(g){var f=Q.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)P0.nextTick(n,this);return f};function n(g){var f=g._readableState;if(f.readableListening=g.listenerCount("readable")>0,f.resumeScheduled&&!f.paused)f.flowing=!0;else if(g.listenerCount("data")>0)g.resume()}function o(g){I("readable nexttick read 0"),g.read(0)}a.prototype.resume=function(){var g=this._readableState;if(!g.flowing)I("resume"),g.flowing=!g.readableListening,Y0(this,g);return g.paused=!1,this};function Y0(g,f){if(!f.resumeScheduled)f.resumeScheduled=!0,P0.nextTick(O0,g,f)}function O0(g,f){if(I("resume",f.reading),!f.reading)g.read(0);if(f.resumeScheduled=!1,g.emit("resume"),w(g),f.flowing&&!f.reading)g.read(0)}a.prototype.pause=function(){if(I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)I("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function w(g){var f=g._readableState;I("flow",f.flowing);while(f.flowing&&g.read()!==null);}if(a.prototype.wrap=function(g){var f=this,R=this._readableState,p=!1;g.on("end",function(){if(I("wrapped end"),R.decoder&&!R.ended){var X=R.decoder.end();if(X&&X.length)f.push(X)}f.push(null)}),g.on("data",function(X){if(I("wrapped data"),R.decoder)X=R.decoder.write(X);if(R.objectMode&&(X===null||X===void 0))return;else if(!R.objectMode&&(!X||!X.length))return;if(!f.push(X))p=!0,g.pause()});for(var k in g)if(this[k]===void 0&&typeof g[k]==="function")this[k]=function(O){return function(){return g[O].apply(g,arguments)}}(k);for(var V=0;V<$.length;V++)g.on($[V],this.emit.bind(this,$[V]));return this._read=function(X){if(I("wrapped _read",X),p)p=!1,g.resume()},this},typeof Symbol==="function")a.prototype[Symbol.asyncIterator]=function(){if(S===void 0)S=tU();return S(this)};Object.defineProperty(a.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(a.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(a.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(f){if(this._readableState)this._readableState.flowing=f}}),a._fromList=L,Object.defineProperty(a.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function L(g,f){if(f.length===0)return null;var R;if(f.objectMode)R=f.buffer.shift();else if(!g||g>=f.length){if(f.decoder)R=f.buffer.join("");else if(f.buffer.length===1)R=f.buffer.first();else R=f.buffer.concat(f.length);f.buffer.clear()}else R=f.buffer.consume(g,f.decoder);return R}function u(g){var f=g._readableState;if(I("endReadable",f.endEmitted),!f.endEmitted)f.ended=!0,P0.nextTick(h,f,g)}function h(g,f){if(I("endReadableNT",g.endEmitted,g.length),!g.endEmitted&&g.length===0){if(g.endEmitted=!0,f.readable=!1,f.emit("end"),g.autoDestroy){var R=f._writableState;if(!R||R.autoDestroy&&R.finished)f.destroy()}}}if(typeof Symbol==="function")a.from=function(g,f){if(F===void 0)F=eU();return F(a,g,f)};function Z0(g,f){for(var R=0,p=g.length;R{U.exports=W;var G=c2().codes,Y=G.ERR_METHOD_NOT_IMPLEMENTED,Q=G.ERR_MULTIPLE_CALLBACK,K=G.ERR_TRANSFORM_ALREADY_TRANSFORMING,Z=G.ERR_TRANSFORM_WITH_LENGTH_0,J=u2();W2()(W,J);function q(T,A){var P=this._transformState;P.transforming=!1;var j=P.writecb;if(j===null)return this.emit("error",new Q);if(P.writechunk=null,P.writecb=null,A!=null)this.push(A);j(T);var E=this._readableState;if(E.reading=!1,E.needReadable||E.length{U.exports=Y;var G=DB();W2()(Y,G);function Y(Q){if(!(this instanceof Y))return new Y(Q);G.call(this,Q)}Y.prototype._transform=function(Q,K,Z){Z(null,Q)}}),UG=R0((B,U)=>{var G;function Y(P){var j=!1;return function(){if(j)return;j=!0,P.apply(void 0,arguments)}}var Q=c2().codes,K=Q.ERR_MISSING_ARGS,Z=Q.ERR_STREAM_DESTROYED;function J(P){if(P)throw P}function q(P){return P.setHeader&&typeof P.abort==="function"}function W(P,j,E,C){C=Y(C);var N=!1;if(P.on("close",function(){N=!0}),G===void 0)G=f8();G(P,{readable:j,writable:E},function(S){if(S)return C(S);N=!0,C()});var v=!1;return function(S){if(N)return;if(v)return;if(v=!0,q(P))return P.abort();if(typeof P.destroy==="function")return P.destroy();C(S||new Z("pipe"))}}function I(P){P()}function H(P,j){return P.pipe(j)}function T(P){if(!P.length)return J;if(typeof P[P.length-1]!=="function")return J;return P.pop()}function A(){for(var P=arguments.length,j=Array(P),E=0;E0,function($){if(!N)N=$;if($)v.forEach(I);if(M)return;v.forEach(I),C(N)})});return j.reduce(H)}U.exports=A}),x8=R0((B,U)=>{U.exports=Y;var G=S8().EventEmitter;W2()(Y,G),Y.Readable=EB(),Y.Writable=wB(),Y.Duplex=u2(),Y.Transform=DB(),Y.PassThrough=BG(),Y.finished=f8(),Y.pipeline=UG(),Y.Stream=Y;function Y(){G.call(this)}Y.prototype.pipe=function(Q,K){var Z=this;function J(P){if(Q.writable){if(Q.write(P)===!1&&Z.pause)Z.pause()}}Z.on("data",J);function q(){if(Z.readable&&Z.resume)Z.resume()}if(Q.on("drain",q),!Q._isStdio&&(!K||K.end!==!1))Z.on("end",I),Z.on("close",H);var W=!1;function I(){if(W)return;W=!0,Q.end()}function H(){if(W)return;if(W=!0,typeof Q.destroy==="function")Q.destroy()}function T(P){if(A(),G.listenerCount(this,"error")===0)throw P}Z.on("error",T),Q.on("error",T);function A(){Z.removeListener("data",J),Q.removeListener("drain",q),Z.removeListener("end",I),Z.removeListener("close",H),Z.removeListener("error",T),Q.removeListener("error",T),Z.removeListener("end",A),Z.removeListener("close",A),Q.removeListener("close",A)}return Z.on("end",A),Z.on("close",A),Q.on("close",A),Q.emit("pipe",Z),Q}}),GG=R0((B)=>{(function(U){U.parser=function(w,L){return new Y(w,L)},U.SAXParser=Y,U.SAXStream=I,U.createStream=W,U.MAX_BUFFER_LENGTH=65536;var G=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];U.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Y(w,L){if(!(this instanceof Y))return new Y(w,L);var u=this;if(K(u),u.q=u.c="",u.bufferCheckPosition=U.MAX_BUFFER_LENGTH,u.opt=L||{},u.opt.lowercase=u.opt.lowercase||u.opt.lowercasetags,u.looseCase=u.opt.lowercase?"toLowerCase":"toUpperCase",u.tags=[],u.closed=u.closedRoot=u.sawRoot=!1,u.tag=u.error=null,u.strict=!!w,u.noscript=!!(w||u.opt.noscript),u.state=z.BEGIN,u.strictEntities=u.opt.strictEntities,u.ENTITIES=u.strictEntities?Object.create(U.XML_ENTITIES):Object.create(U.ENTITIES),u.attribList=[],u.opt.xmlns)u.ns=Object.create(j);if(u.trackPosition=u.opt.position!==!1,u.trackPosition)u.position=u.line=u.column=0;U0(u,"onready")}if(!Object.create)Object.create=function(w){function L(){}return L.prototype=w,new L};if(!Object.keys)Object.keys=function(w){var L=[];for(var u in w)if(w.hasOwnProperty(u))L.push(u);return L};function Q(w){var L=Math.max(U.MAX_BUFFER_LENGTH,10),u=0;for(var h=0,Z0=G.length;hL)switch(G[h]){case"textNode":c(w);break;case"cdata":b(w,"oncdata",w.cdata),w.cdata="";break;case"script":b(w,"onscript",w.script),w.script="";break;default:m(w,"Max buffer length exceeded: "+G[h])}u=Math.max(u,g)}w.bufferCheckPosition=U.MAX_BUFFER_LENGTH-u+w.position}function K(w){for(var L=0,u=G.length;L"||S(w)}function $(w,L){return w.test(L)}function x(w,L){return!$(w,L)}var z=0;U.STATE={BEGIN:z++,BEGIN_WHITESPACE:z++,TEXT:z++,TEXT_ENTITY:z++,OPEN_WAKA:z++,SGML_DECL:z++,SGML_DECL_QUOTED:z++,DOCTYPE:z++,DOCTYPE_QUOTED:z++,DOCTYPE_DTD:z++,DOCTYPE_DTD_QUOTED:z++,COMMENT_STARTING:z++,COMMENT:z++,COMMENT_ENDING:z++,COMMENT_ENDED:z++,CDATA:z++,CDATA_ENDING:z++,CDATA_ENDING_2:z++,PROC_INST:z++,PROC_INST_BODY:z++,PROC_INST_ENDING:z++,OPEN_TAG:z++,OPEN_TAG_SLASH:z++,ATTRIB:z++,ATTRIB_NAME:z++,ATTRIB_NAME_SAW_WHITE:z++,ATTRIB_VALUE:z++,ATTRIB_VALUE_QUOTED:z++,ATTRIB_VALUE_CLOSED:z++,ATTRIB_VALUE_UNQUOTED:z++,ATTRIB_VALUE_ENTITY_Q:z++,ATTRIB_VALUE_ENTITY_U:z++,CLOSE_TAG:z++,CLOSE_TAG_SAW_WHITE:z++,SCRIPT:z++,SCRIPT_ENDING:z++},U.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},U.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(U.ENTITIES).forEach(function(w){var L=U.ENTITIES[w],u=typeof L==="number"?String.fromCharCode(L):L;U.ENTITIES[w]=u});for(var a in U.STATE)U.STATE[U.STATE[a]]=a;z=U.STATE;function U0(w,L,u){w[L]&&w[L](u)}function b(w,L,u){if(w.textNode)c(w);U0(w,L,u)}function c(w){if(w.textNode=D(w.opt,w.textNode),w.textNode)U0(w,"ontext",w.textNode);w.textNode=""}function D(w,L){if(w.trim)L=L.trim();if(w.normalize)L=L.replace(/\s+/g," ");return L}function m(w,L){if(c(w),w.trackPosition)L+=` -Line: `+w.line+` -Column: `+w.column+` -Char: `+w.c;return L=Error(L),w.error=L,U0(w,"onerror",L),w}function B0(w){if(w.sawRoot&&!w.closedRoot)i(w,"Unclosed root tag");if(w.state!==z.BEGIN&&w.state!==z.BEGIN_WHITESPACE&&w.state!==z.TEXT)m(w,"Unexpected end");return c(w),w.c="",w.closed=!0,U0(w,"onend"),Y.call(w,w.strict,w.opt),w}function i(w,L){if(typeof w!=="object"||!(w instanceof Y))throw Error("bad call to strictFail");if(w.strict)m(w,L)}function V0(w){if(!w.strict)w.tagName=w.tagName[w.looseCase]();var L=w.tags[w.tags.length-1]||w,u=w.tag={name:w.tagName,attributes:{}};if(w.opt.xmlns)u.ns=L.ns;w.attribList.length=0,b(w,"onopentagstart",u)}function s(w,L){var u=w.indexOf(":")<0?["",w]:w.split(":"),h=u[0],Z0=u[1];if(L&&w==="xmlns")h="xmlns",Z0="";return{prefix:h,local:Z0}}function G0(w){if(!w.strict)w.attribName=w.attribName[w.looseCase]();if(w.attribList.indexOf(w.attribName)!==-1||w.tag.attributes.hasOwnProperty(w.attribName)){w.attribName=w.attribValue="";return}if(w.opt.xmlns){var L=s(w.attribName,!0),u=L.prefix,h=L.local;if(u==="xmlns")if(h==="xml"&&w.attribValue!==A)i(w,"xml: prefix must be bound to "+A+` -Actual: `+w.attribValue);else if(h==="xmlns"&&w.attribValue!==P)i(w,"xmlns: prefix must be bound to "+P+` -Actual: `+w.attribValue);else{var Z0=w.tag,g=w.tags[w.tags.length-1]||w;if(Z0.ns===g.ns)Z0.ns=Object.create(g.ns);Z0.ns[h]=w.attribValue}w.attribList.push([w.attribName,w.attribValue])}else w.tag.attributes[w.attribName]=w.attribValue,b(w,"onattribute",{name:w.attribName,value:w.attribValue});w.attribName=w.attribValue=""}function r(w,L){if(w.opt.xmlns){var u=w.tag,h=s(w.tagName);if(u.prefix=h.prefix,u.local=h.local,u.uri=u.ns[h.prefix]||"",u.prefix&&!u.uri)i(w,"Unbound namespace prefix: "+JSON.stringify(w.tagName)),u.uri=h.prefix;var Z0=w.tags[w.tags.length-1]||w;if(u.ns&&Z0.ns!==u.ns)Object.keys(u.ns).forEach(function(d){b(w,"onopennamespace",{prefix:d,uri:u.ns[d]})});for(var g=0,f=w.attribList.length;g",w.tagName="",w.state=z.SCRIPT;return}b(w,"onscript",w.script),w.script=""}var L=w.tags.length,u=w.tagName;if(!w.strict)u=u[w.looseCase]();var h=u;while(L--)if(w.tags[L].name!==h)i(w,"Unexpected close tag");else break;if(L<0){i(w,"Unmatched closing tag: "+w.tagName),w.textNode+="",w.state=z.TEXT;return}w.tagName=u;var Z0=w.tags.length;while(Z0-- >L){var g=w.tag=w.tags.pop();w.tagName=w.tag.name,b(w,"onclosetag",w.tagName);var f={};for(var R in g.ns)f[R]=g.ns[R];var p=w.tags[w.tags.length-1]||w;if(w.opt.xmlns&&g.ns!==p.ns)Object.keys(g.ns).forEach(function(k){var V=g.ns[k];b(w,"onclosenamespace",{prefix:k,uri:V})})}if(L===0)w.closedRoot=!0;w.tagName=w.attribValue=w.attribName="",w.attribList.length=0,w.state=z.TEXT}function n(w){var L=w.entity,u=L.toLowerCase(),h,Z0="";if(w.ENTITIES[L])return w.ENTITIES[L];if(w.ENTITIES[u])return w.ENTITIES[u];if(L=u,L.charAt(0)==="#")if(L.charAt(1)==="x")L=L.slice(2),h=parseInt(L,16),Z0=h.toString(16);else L=L.slice(1),h=parseInt(L,10),Z0=h.toString(10);if(L=L.replace(/^0+/,""),isNaN(h)||Z0.toLowerCase()!==L)return i(w,"Invalid character entity"),"&"+w.entity+";";return String.fromCodePoint(h)}function o(w,L){if(L==="<")w.state=z.OPEN_WAKA,w.startTagPosition=w.position;else if(!S(L))i(w,"Non-whitespace before first tag."),w.textNode=L,w.state=z.TEXT}function Y0(w,L){var u="";if(L")b(L,"onsgmldeclaration",L.sgmlDecl),L.sgmlDecl="",L.state=z.TEXT;else if(F(h))L.state=z.SGML_DECL_QUOTED,L.sgmlDecl+=h;else L.sgmlDecl+=h;continue;case z.SGML_DECL_QUOTED:if(h===L.q)L.state=z.SGML_DECL,L.q="";L.sgmlDecl+=h;continue;case z.DOCTYPE:if(h===">")L.state=z.TEXT,b(L,"ondoctype",L.doctype),L.doctype=!0;else if(L.doctype+=h,h==="[")L.state=z.DOCTYPE_DTD;else if(F(h))L.state=z.DOCTYPE_QUOTED,L.q=h;continue;case z.DOCTYPE_QUOTED:if(L.doctype+=h,h===L.q)L.q="",L.state=z.DOCTYPE;continue;case z.DOCTYPE_DTD:if(L.doctype+=h,h==="]")L.state=z.DOCTYPE;else if(F(h))L.state=z.DOCTYPE_DTD_QUOTED,L.q=h;continue;case z.DOCTYPE_DTD_QUOTED:if(L.doctype+=h,h===L.q)L.state=z.DOCTYPE_DTD,L.q="";continue;case z.COMMENT:if(h==="-")L.state=z.COMMENT_ENDING;else L.comment+=h;continue;case z.COMMENT_ENDING:if(h==="-"){if(L.state=z.COMMENT_ENDED,L.comment=D(L.opt,L.comment),L.comment)b(L,"oncomment",L.comment);L.comment=""}else L.comment+="-"+h,L.state=z.COMMENT;continue;case z.COMMENT_ENDED:if(h!==">")i(L,"Malformed comment"),L.comment+="--"+h,L.state=z.COMMENT;else L.state=z.TEXT;continue;case z.CDATA:if(h==="]")L.state=z.CDATA_ENDING;else L.cdata+=h;continue;case z.CDATA_ENDING:if(h==="]")L.state=z.CDATA_ENDING_2;else L.cdata+="]"+h,L.state=z.CDATA;continue;case z.CDATA_ENDING_2:if(h===">"){if(L.cdata)b(L,"oncdata",L.cdata);b(L,"onclosecdata"),L.cdata="",L.state=z.TEXT}else if(h==="]")L.cdata+="]";else L.cdata+="]]"+h,L.state=z.CDATA;continue;case z.PROC_INST:if(h==="?")L.state=z.PROC_INST_ENDING;else if(S(h))L.state=z.PROC_INST_BODY;else L.procInstName+=h;continue;case z.PROC_INST_BODY:if(!L.procInstBody&&S(h))continue;else if(h==="?")L.state=z.PROC_INST_ENDING;else L.procInstBody+=h;continue;case z.PROC_INST_ENDING:if(h===">")b(L,"onprocessinginstruction",{name:L.procInstName,body:L.procInstBody}),L.procInstName=L.procInstBody="",L.state=z.TEXT;else L.procInstBody+="?"+h,L.state=z.PROC_INST_BODY;continue;case z.OPEN_TAG:if($(C,h))L.tagName+=h;else if(V0(L),h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else{if(!S(h))i(L,"Invalid character in tag name");L.state=z.ATTRIB}continue;case z.OPEN_TAG_SLASH:if(h===">")r(L,!0),y(L);else i(L,"Forward-slash in opening tag not followed by >"),L.state=z.ATTRIB;continue;case z.ATTRIB:if(S(h))continue;else if(h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else if($(E,h))L.attribName=h,L.attribValue="",L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case z.ATTRIB_NAME:if(h==="=")L.state=z.ATTRIB_VALUE;else if(h===">")i(L,"Attribute without value"),L.attribValue=L.attribName,G0(L),r(L);else if(S(h))L.state=z.ATTRIB_NAME_SAW_WHITE;else if($(C,h))L.attribName+=h;else i(L,"Invalid attribute name");continue;case z.ATTRIB_NAME_SAW_WHITE:if(h==="=")L.state=z.ATTRIB_VALUE;else if(S(h))continue;else if(i(L,"Attribute without value"),L.tag.attributes[L.attribName]="",L.attribValue="",b(L,"onattribute",{name:L.attribName,value:""}),L.attribName="",h===">")r(L);else if($(E,h))L.attribName=h,L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name"),L.state=z.ATTRIB;continue;case z.ATTRIB_VALUE:if(S(h))continue;else if(F(h))L.q=h,L.state=z.ATTRIB_VALUE_QUOTED;else i(L,"Unquoted attribute value"),L.state=z.ATTRIB_VALUE_UNQUOTED,L.attribValue=h;continue;case z.ATTRIB_VALUE_QUOTED:if(h!==L.q){if(h==="&")L.state=z.ATTRIB_VALUE_ENTITY_Q;else L.attribValue+=h;continue}G0(L),L.q="",L.state=z.ATTRIB_VALUE_CLOSED;continue;case z.ATTRIB_VALUE_CLOSED:if(S(h))L.state=z.ATTRIB;else if(h===">")r(L);else if(h==="/")L.state=z.OPEN_TAG_SLASH;else if($(E,h))i(L,"No whitespace between attributes"),L.attribName=h,L.attribValue="",L.state=z.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case z.ATTRIB_VALUE_UNQUOTED:if(!M(h)){if(h==="&")L.state=z.ATTRIB_VALUE_ENTITY_U;else L.attribValue+=h;continue}if(G0(L),h===">")r(L);else L.state=z.ATTRIB;continue;case z.CLOSE_TAG:if(!L.tagName)if(S(h))continue;else if(x(E,h))if(L.script)L.script+="")y(L);else if($(C,h))L.tagName+=h;else if(L.script)L.script+="")y(L);else i(L,"Invalid characters in closing tag");continue;case z.TEXT_ENTITY:case z.ATTRIB_VALUE_ENTITY_Q:case z.ATTRIB_VALUE_ENTITY_U:var f,R;switch(L.state){case z.TEXT_ENTITY:f=z.TEXT,R="textNode";break;case z.ATTRIB_VALUE_ENTITY_Q:f=z.ATTRIB_VALUE_QUOTED,R="attribValue";break;case z.ATTRIB_VALUE_ENTITY_U:f=z.ATTRIB_VALUE_UNQUOTED,R="attribValue";break}if(h===";")L[R]+=n(L),L.entity="",L.state=f;else if($(L.entity.length?v:N,h))L.entity+=h;else i(L,"Invalid character in entity name"),L[R]+="&"+L.entity+h,L.entity="",L.state=f;continue;default:throw Error(L,"Unknown state: "+L.state)}}if(L.position>=L.bufferCheckPosition)Q(L);return L}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint)(function(){var w=String.fromCharCode,L=Math.floor,u=function(){var h=16384,Z0=[],g,f,R=-1,p=arguments.length;if(!p)return"";var k="";while(++R1114111||L(V)!==V)throw RangeError("Invalid code point: "+V);if(V<=65535)Z0.push(V);else V-=65536,g=(V>>10)+55296,f=V%1024+56320,Z0.push(g,f);if(R+1===p||Z0.length>h)k+=w.apply(null,Z0),Z0.length=0}return k};if(Object.defineProperty)Object.defineProperty(String,"fromCodePoint",{value:u,configurable:!0,writable:!0});else String.fromCodePoint=u})()})(typeof B>"u"?B.sax={}:B)}),_8=R0((B,U)=>{U.exports={isArray:function(G){if(Array.isArray)return Array.isArray(G);return Object.prototype.toString.call(G)==="[object Array]"}}}),h8=R0((B,U)=>{var G=_8().isArray;U.exports={copyOptions:function(Y){var Q,K={};for(Q in Y)if(Y.hasOwnProperty(Q))K[Q]=Y[Q];return K},ensureFlagExists:function(Y,Q){if(!(Y in Q)||typeof Q[Y]!=="boolean")Q[Y]=!1},ensureSpacesExists:function(Y){if(!("spaces"in Y)||typeof Y.spaces!=="number"&&typeof Y.spaces!=="string")Y.spaces=0},ensureAlwaysArrayExists:function(Y){if(!("alwaysArray"in Y)||typeof Y.alwaysArray!=="boolean"&&!G(Y.alwaysArray))Y.alwaysArray=!1},ensureKeyExists:function(Y,Q){if(!(Y+"Key"in Q)||typeof Q[Y+"Key"]!=="string")Q[Y+"Key"]=Q.compact?"_"+Y:Y},checkFnExists:function(Y,Q){return Y+"Fn"in Q}}}),TB=R0((B,U)=>{var G=GG(),Y={on:function(){},parse:function(){}},Q=h8(),K=_8().isArray,Z,J=!0,q;function W(F){return Z=Q.copyOptions(F),Q.ensureFlagExists("ignoreDeclaration",Z),Q.ensureFlagExists("ignoreInstruction",Z),Q.ensureFlagExists("ignoreAttributes",Z),Q.ensureFlagExists("ignoreText",Z),Q.ensureFlagExists("ignoreComment",Z),Q.ensureFlagExists("ignoreCdata",Z),Q.ensureFlagExists("ignoreDoctype",Z),Q.ensureFlagExists("compact",Z),Q.ensureFlagExists("alwaysChildren",Z),Q.ensureFlagExists("addParent",Z),Q.ensureFlagExists("trim",Z),Q.ensureFlagExists("nativeType",Z),Q.ensureFlagExists("nativeTypeAttributes",Z),Q.ensureFlagExists("sanitize",Z),Q.ensureFlagExists("instructionHasAttributes",Z),Q.ensureFlagExists("captureSpacesBetweenElements",Z),Q.ensureAlwaysArrayExists(Z),Q.ensureKeyExists("declaration",Z),Q.ensureKeyExists("instruction",Z),Q.ensureKeyExists("attributes",Z),Q.ensureKeyExists("text",Z),Q.ensureKeyExists("comment",Z),Q.ensureKeyExists("cdata",Z),Q.ensureKeyExists("doctype",Z),Q.ensureKeyExists("type",Z),Q.ensureKeyExists("name",Z),Q.ensureKeyExists("elements",Z),Q.ensureKeyExists("parent",Z),Q.checkFnExists("doctype",Z),Q.checkFnExists("instruction",Z),Q.checkFnExists("cdata",Z),Q.checkFnExists("comment",Z),Q.checkFnExists("text",Z),Q.checkFnExists("instructionName",Z),Q.checkFnExists("elementName",Z),Q.checkFnExists("attributeName",Z),Q.checkFnExists("attributeValue",Z),Q.checkFnExists("attributes",Z),Z}function I(F){var M=Number(F);if(!isNaN(M))return M;var $=F.toLowerCase();if($==="true")return!0;else if($==="false")return!1;return F}function H(F,M){var $;if(Z.compact){if(!q[Z[F+"Key"]]&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(Z[F+"Key"])!==-1:Z.alwaysArray))q[Z[F+"Key"]]=[];if(q[Z[F+"Key"]]&&!K(q[Z[F+"Key"]]))q[Z[F+"Key"]]=[q[Z[F+"Key"]]];if(F+"Fn"in Z&&typeof M==="string")M=Z[F+"Fn"](M,q);if(F==="instruction"&&(("instructionFn"in Z)||("instructionNameFn"in Z))){for($ in M)if(M.hasOwnProperty($))if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);else{var x=M[$];delete M[$],M[Z.instructionNameFn($,x,q)]=x}}if(K(q[Z[F+"Key"]]))q[Z[F+"Key"]].push(M);else q[Z[F+"Key"]]=M}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];var z={};if(z[Z.typeKey]=F,F==="instruction"){for($ in M)if(M.hasOwnProperty($))break;if(z[Z.nameKey]="instructionNameFn"in Z?Z.instructionNameFn($,M,q):$,Z.instructionHasAttributes){if(z[Z.attributesKey]=M[$][Z.attributesKey],"instructionFn"in Z)z[Z.attributesKey]=Z.instructionFn(z[Z.attributesKey],$,q)}else{if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);z[Z.instructionKey]=M[$]}}else{if(F+"Fn"in Z)M=Z[F+"Fn"](M,q);z[Z[F+"Key"]]=M}if(Z.addParent)z[Z.parentKey]=q;q[Z.elementsKey].push(z)}}function T(F){if("attributesFn"in Z&&F)F=Z.attributesFn(F,q);if((Z.trim||("attributeValueFn"in Z)||("attributeNameFn"in Z)||Z.nativeTypeAttributes)&&F){var M;for(M in F)if(F.hasOwnProperty(M)){if(Z.trim)F[M]=F[M].trim();if(Z.nativeTypeAttributes)F[M]=I(F[M]);if("attributeValueFn"in Z)F[M]=Z.attributeValueFn(F[M],M,q);if("attributeNameFn"in Z){var $=F[M];delete F[M],F[Z.attributeNameFn(M,F[M],q)]=$}}}return F}function A(F){var M={};if(F.body&&(F.name.toLowerCase()==="xml"||Z.instructionHasAttributes)){var $=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,x;while((x=$.exec(F.body))!==null)M[x[1]]=x[2]||x[3]||x[4];M=T(M)}if(F.name.toLowerCase()==="xml"){if(Z.ignoreDeclaration)return;if(q[Z.declarationKey]={},Object.keys(M).length)q[Z.declarationKey][Z.attributesKey]=M;if(Z.addParent)q[Z.declarationKey][Z.parentKey]=q}else{if(Z.ignoreInstruction)return;if(Z.trim)F.body=F.body.trim();var z={};if(Z.instructionHasAttributes&&Object.keys(M).length)z[F.name]={},z[F.name][Z.attributesKey]=M;else z[F.name]=F.body;H("instruction",z)}}function P(F,M){var $;if(typeof F==="object")M=F.attributes,F=F.name;if(M=T(M),"elementNameFn"in Z)F=Z.elementNameFn(F,q);if(Z.compact){if($={},!Z.ignoreAttributes&&M&&Object.keys(M).length){$[Z.attributesKey]={};var x;for(x in M)if(M.hasOwnProperty(x))$[Z.attributesKey][x]=M[x]}if(!(F in q)&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(F)!==-1:Z.alwaysArray))q[F]=[];if(q[F]&&!K(q[F]))q[F]=[q[F]];if(K(q[F]))q[F].push($);else q[F]=$}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];if($={},$[Z.typeKey]="element",$[Z.nameKey]=F,!Z.ignoreAttributes&&M&&Object.keys(M).length)$[Z.attributesKey]=M;if(Z.alwaysChildren)$[Z.elementsKey]=[];q[Z.elementsKey].push($)}$[Z.parentKey]=q,q=$}function j(F){if(Z.ignoreText)return;if(!F.trim()&&!Z.captureSpacesBetweenElements)return;if(Z.trim)F=F.trim();if(Z.nativeType)F=I(F);if(Z.sanitize)F=F.replace(/&/g,"&").replace(//g,">");H("text",F)}function E(F){if(Z.ignoreComment)return;if(Z.trim)F=F.trim();H("comment",F)}function C(F){var M=q[Z.parentKey];if(!Z.addParent)delete q[Z.parentKey];q=M}function N(F){if(Z.ignoreCdata)return;if(Z.trim)F=F.trim();H("cdata",F)}function v(F){if(Z.ignoreDoctype)return;if(F=F.replace(/^ /,""),Z.trim)F=F.trim();H("doctype",F)}function S(F){F.note=F}U.exports=function(F,M){var $=J?G.parser(!0,{}):$=new Y.Parser("UTF-8"),x={};if(q=x,Z=W(M),J)$.opt={strictEntities:!0},$.onopentag=P,$.ontext=j,$.oncomment=E,$.onclosetag=C,$.onerror=S,$.oncdata=N,$.ondoctype=v,$.onprocessinginstruction=A;else $.on("startElement",P),$.on("text",j),$.on("comment",E),$.on("endElement",C),$.on("error",S);if(J)$.write(F).close();else if(!$.parse(F))throw Error("XML parsing error: "+$.getError());if(x[Z.elementsKey]){var z=x[Z.elementsKey];delete x[Z.elementsKey],x[Z.elementsKey]=z,delete x.text}return x}}),YG=R0((B,U)=>{var G=h8(),Y=TB();function Q(K){var Z=G.copyOptions(K);return G.ensureSpacesExists(Z),Z}U.exports=function(K,Z){var J=Q(Z),q=Y(K,J),W,I="compact"in J&&J.compact?"_parent":"parent";if("addParent"in J&&J.addParent)W=JSON.stringify(q,function(H,T){return H===I?"_":T},J.spaces);else W=JSON.stringify(q,null,J.spaces);return W.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}}),CB=R0((B,U)=>{var G=h8(),Y=_8().isArray,Q,K;function Z(F){var M=G.copyOptions(F);if(G.ensureFlagExists("ignoreDeclaration",M),G.ensureFlagExists("ignoreInstruction",M),G.ensureFlagExists("ignoreAttributes",M),G.ensureFlagExists("ignoreText",M),G.ensureFlagExists("ignoreComment",M),G.ensureFlagExists("ignoreCdata",M),G.ensureFlagExists("ignoreDoctype",M),G.ensureFlagExists("compact",M),G.ensureFlagExists("indentText",M),G.ensureFlagExists("indentCdata",M),G.ensureFlagExists("indentAttributes",M),G.ensureFlagExists("indentInstruction",M),G.ensureFlagExists("fullTagEmptyElement",M),G.ensureFlagExists("noQuotesForNativeAttributes",M),G.ensureSpacesExists(M),typeof M.spaces==="number")M.spaces=Array(M.spaces+1).join(" ");return G.ensureKeyExists("declaration",M),G.ensureKeyExists("instruction",M),G.ensureKeyExists("attributes",M),G.ensureKeyExists("text",M),G.ensureKeyExists("comment",M),G.ensureKeyExists("cdata",M),G.ensureKeyExists("doctype",M),G.ensureKeyExists("type",M),G.ensureKeyExists("name",M),G.ensureKeyExists("elements",M),G.checkFnExists("doctype",M),G.checkFnExists("instruction",M),G.checkFnExists("cdata",M),G.checkFnExists("comment",M),G.checkFnExists("text",M),G.checkFnExists("instructionName",M),G.checkFnExists("elementName",M),G.checkFnExists("attributeName",M),G.checkFnExists("attributeValue",M),G.checkFnExists("attributes",M),G.checkFnExists("fullTagEmptyElement",M),M}function J(F,M,$){return(!$&&F.spaces?` -`:"")+Array(M+1).join(F.spaces)}function q(F,M,$){if(M.ignoreAttributes)return"";if("attributesFn"in M)F=M.attributesFn(F,K,Q);var x,z,a,U0,b=[];for(x in F)if(F.hasOwnProperty(x)&&F[x]!==null&&F[x]!==void 0)U0=M.noQuotesForNativeAttributes&&typeof F[x]!=="string"?"":'"',z=""+F[x],z=z.replace(/"/g,"""),a="attributeNameFn"in M?M.attributeNameFn(x,z,K,Q):x,b.push(M.spaces&&M.indentAttributes?J(M,$+1,!1):" "),b.push(a+"="+U0+("attributeValueFn"in M?M.attributeValueFn(z,x,K,Q):z)+U0);if(F&&Object.keys(F).length&&M.spaces&&M.indentAttributes)b.push(J(M,$,!1));return b.join("")}function W(F,M,$){return Q=F,K="xml",M.ignoreDeclaration?"":""}function I(F,M,$){if(M.ignoreInstruction)return"";var x;for(x in F)if(F.hasOwnProperty(x))break;var z="instructionNameFn"in M?M.instructionNameFn(x,F[x],K,Q):x;if(typeof F[x]==="object")return Q=F,K=z,"";else{var a=F[x]?F[x]:"";if("instructionFn"in M)a=M.instructionFn(a,x,K,Q);return""}}function H(F,M){return M.ignoreComment?"":""}function T(F,M){return M.ignoreCdata?"":"","]]]]>"))+"]]>"}function A(F,M){return M.ignoreDoctype?"":""}function P(F,M){if(M.ignoreText)return"";return F=""+F,F=F.replace(/&/g,"&"),F=F.replace(/&/g,"&").replace(//g,">"),"textFn"in M?M.textFn(F,K,Q):F}function j(F,M){var $;if(F.elements&&F.elements.length)for($=0;$"),F[M.elementsKey]&&F[M.elementsKey].length)x.push(C(F[M.elementsKey],M,$+1)),Q=F,K=F.name;x.push(M.spaces&&j(F,M)?` -`+Array($+1).join(M.spaces):""),x.push("")}else x.push("/>");return x.join("")}function C(F,M,$,x){return F.reduce(function(z,a){var U0=J(M,$,x&&!z);switch(a.type){case"element":return z+U0+E(a,M,$);case"comment":return z+U0+H(a[M.commentKey],M);case"doctype":return z+U0+A(a[M.doctypeKey],M);case"cdata":return z+(M.indentCdata?U0:"")+T(a[M.cdataKey],M);case"text":return z+(M.indentText?U0:"")+P(a[M.textKey],M);case"instruction":var b={};return b[a[M.nameKey]]=a[M.attributesKey]?a:a[M.instructionKey],z+(M.indentInstruction?U0:"")+I(b,M,$)}},"")}function N(F,M,$){var x;for(x in F)if(F.hasOwnProperty(x))switch(x){case M.parentKey:case M.attributesKey:break;case M.textKey:if(M.indentText||$)return!0;break;case M.cdataKey:if(M.indentCdata||$)return!0;break;case M.instructionKey:if(M.indentInstruction||$)return!0;break;case M.doctypeKey:case M.commentKey:return!0;default:return!0}return!1}function v(F,M,$,x,z){Q=F,K=M;var a="elementNameFn"in $?$.elementNameFn(M,F):M;if(typeof F>"u"||F===null||F==="")return"fullTagEmptyElementFn"in $&&$.fullTagEmptyElementFn(M,F)||$.fullTagEmptyElement?"<"+a+">":"<"+a+"/>";var U0=[];if(M){if(U0.push("<"+a),typeof F!=="object")return U0.push(">"+P(F,$)+""),U0.join("");if(F[$.attributesKey])U0.push(q(F[$.attributesKey],$,x));var b=N(F,$,!0)||F[$.attributesKey]&&F[$.attributesKey]["xml:space"]==="preserve";if(!b)if("fullTagEmptyElementFn"in $)b=$.fullTagEmptyElementFn(M,F);else b=$.fullTagEmptyElement;if(b)U0.push(">");else return U0.push("/>"),U0.join("")}if(U0.push(S(F,$,x+1,!1)),Q=F,K=M,M)U0.push((z?J($,x,!1):"")+"");return U0.join("")}function S(F,M,$,x){var z,a,U0,b=[];for(a in F)if(F.hasOwnProperty(a)){U0=Y(F[a])?F[a]:[F[a]];for(z=0;z{var G=CB();U.exports=function(Y,Q){if(Y instanceof Buffer)Y=Y.toString();var K=null;if(typeof Y==="string")try{K=JSON.parse(Y)}catch(Z){throw Error("The JSON structure is invalid")}else K=Y;return G(K,Q)}}),h1=R0((B,U)=>{U.exports={xml2js:TB(),xml2json:YG(),js2xml:CB(),json2xml:ZG()}})(),u1=(B)=>{switch(B.type){case void 0:case"element":let U=new kB(B.name,B.attributes),G=B.elements||[];for(let Y of G){let Q=u1(Y);if(Q!==void 0)U.push(Q)}return U;case"text":return B.text;default:return}},QG=class extends H0{},kB=class extends t{static fromXmlString(B){return u1((0,h1.xml2js)(B,{compact:!1}))}constructor(B,U){super(B);if(U)this.root.push(new QG(U))}push(B){this.root.push(B)}},$B=class extends t{constructor(B){super("");e(this,"_attr",void 0),this._attr=B}prepForXml(B){return{_attr:this._attr}}},JG="",u8=class extends t{constructor(B,U){super(B);if(U)this.root=U.root}},T0=(B)=>{if(isNaN(B))throw Error(`Invalid value '${B}' specified. Must be an integer.`);return Math.floor(B)},X1=(B)=>{let U=T0(B);if(U<0)throw Error(`Invalid value '${B}' specified. Must be a positive integer.`);return U},d1=(B,U)=>{let G=U*2;if(B.length!==G||isNaN(Number(`0x${B}`)))throw Error(`Invalid hex value '${B}'. Expected ${G} digit hex value`);return B},KG=(B)=>d1(B,4),SB=(B)=>d1(B,2),W8=(B)=>d1(B,1),q1=(B)=>{let U=B.slice(-2),G=B.substring(0,B.length-2);return`${Number(G)}${U}`},d8=(B)=>{let U=q1(B);if(parseFloat(U)<0)throw Error(`Invalid value '${U}' specified. Expected a positive number.`);return U},C2=(B)=>{if(B==="auto")return B;return d1(B.charAt(0)==="#"?B.substring(1):B,3)},t0=(B)=>typeof B==="string"?q1(B):T0(B),bB=(B)=>typeof B==="string"?d8(B):X1(B),VG=(B)=>typeof B==="string"?q1(B):T0(B),E0=(B)=>typeof B==="string"?d8(B):X1(B),vB=(B)=>{let U=B.substring(0,B.length-1);return`${Number(U)}%`},c8=(B)=>{if(typeof B==="number")return T0(B);if(B.slice(-1)==="%")return vB(B);return q1(B)},yB=X1,gB=X1,fB=(B)=>B.toISOString(),q0=class extends t{constructor(B,U=!0){super(B);if(U!==!0)this.root.push(new C0({val:U}))}},D1=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:bB(U)}))}},S0=class extends t{},q2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},f2=(B,U)=>new M0({name:B,attributes:{value:{key:"w:val",value:U}}}),_2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},XG=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},O2=class extends t{constructor(B,U){super(B);this.root.push(U)}},M0=class extends t{constructor({name:B,attributes:U,children:G}){super(B);if(U)this.root.push(new $8(U));if(G)this.root.push(...G)}},c0={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},m8=(B)=>new M0({name:"w:jc",attributes:{val:{key:"w:val",value:B}}}),j0=(B,{color:U,size:G,space:Y,style:Q})=>new M0({name:B,attributes:{style:{key:"w:val",value:Q},color:{key:"w:color",value:U===void 0?void 0:C2(U)},size:{key:"w:sz",value:G===void 0?void 0:yB(G)},space:{key:"w:space",value:Y===void 0?void 0:gB(Y)}}}),c1={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},xB=class extends R2{constructor(B){super("w:pBdr");if(B.top)this.root.push(j0("w:top",B.top));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.left)this.root.push(j0("w:left",B.left));if(B.right)this.root.push(j0("w:right",B.right));if(B.between)this.root.push(j0("w:between",B.between))}},_B=class extends t{constructor(){super("w:pBdr");let B=j0("w:bottom",{color:"auto",space:1,style:c1.SINGLE,size:6});this.root.push(B)}},hB=({start:B,end:U,left:G,right:Y,hanging:Q,firstLine:K,firstLineChars:Z})=>new M0({name:"w:ind",attributes:{start:{key:"w:start",value:B===void 0?void 0:t0(B)},end:{key:"w:end",value:U===void 0?void 0:t0(U)},left:{key:"w:left",value:G===void 0?void 0:t0(G)},right:{key:"w:right",value:Y===void 0?void 0:t0(Y)},hanging:{key:"w:hanging",value:Q===void 0?void 0:E0(Q)},firstLine:{key:"w:firstLine",value:K===void 0?void 0:E0(K)},firstLineChars:{key:"w:firstLineChars",value:Z===void 0?void 0:T0(Z)}}}),uB=()=>new M0({name:"w:br"}),l8={BEGIN:"begin",END:"end",SEPARATE:"separate"},a8=(B,U)=>new M0({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:B},dirty:{key:"w:dirty",value:U}}}),e0=(B)=>a8(l8.BEGIN,B),X2=(B)=>a8(l8.SEPARATE,B),B2=(B)=>a8(l8.END,B),qG={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},MG={BOTTOM:"bottom",CENTER:"center",INSIDE:"inside",OUTSIDE:"outside",TOP:"top"},RG={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},x0={DEFAULT:"default",PRESERVE:"preserve"},_0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{space:"xml:space"})}},LG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},IG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},OG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},HG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTION")}},M1=({fill:B,color:U,type:G})=>new M0({name:"w:shd",attributes:{fill:{key:"w:fill",value:B===void 0?void 0:C2(B)},color:{key:"w:color",value:U===void 0?void 0:C2(U)},type:{key:"w:val",value:G}}}),FG={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},b0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},WG=class extends t{constructor(B){super("w:del");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},PG=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},p8={DOT:"dot"},r8=(B=p8.DOT)=>new M0({name:"w:em",attributes:{val:{key:"w:val",value:B}}}),AG=()=>r8(p8.DOT),jG=class extends t{constructor(B){super("w:spacing");this.root.push(new C0({val:t0(B)}))}},NG=class extends t{constructor(B){super("w:color");this.root.push(new C0({val:C2(B)}))}},zG=class extends t{constructor(B){super("w:highlight");this.root.push(new C0({val:B}))}},wG=class extends t{constructor(B){super("w:highlightCs");this.root.push(new C0({val:B}))}},EG=(B)=>new M0({name:"w:lang",attributes:{value:{key:"w:val",value:B.value},eastAsia:{key:"w:eastAsia",value:B.eastAsia},bidirectional:{key:"w:bidi",value:B.bidirectional}}}),T1=(B,U)=>{if(typeof B==="string"){let Y=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:Y},cs:{key:"w:cs",value:Y},eastAsia:{key:"w:eastAsia",value:Y},hAnsi:{key:"w:hAnsi",value:Y},hint:{key:"w:hint",value:U}}})}let G=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:G.ascii},cs:{key:"w:cs",value:G.cs},eastAsia:{key:"w:eastAsia",value:G.eastAsia},hAnsi:{key:"w:hAnsi",value:G.hAnsi},hint:{key:"w:hint",value:G.hint}}})},dB=(B)=>new M0({name:"w:vertAlign",attributes:{val:{key:"w:val",value:B}}}),DG=()=>dB("superscript"),TG=()=>dB("subscript"),i8={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},cB=(B=i8.SINGLE,U)=>new M0({name:"w:u",attributes:{val:{key:"w:val",value:B},color:{key:"w:color",value:U===void 0?void 0:C2(U)}}}),CG={BLINK_BACKGROUND:"blinkBackground",LIGHTS:"lights",ANTS_BLACK:"antsBlack",ANTS_RED:"antsRed",SHIMMER:"shimmer",SPARKLE:"sparkle",NONE:"none"},kG={BLACK:"black",BLUE:"blue",CYAN:"cyan",DARK_BLUE:"darkBlue",DARK_CYAN:"darkCyan",DARK_GRAY:"darkGray",DARK_GREEN:"darkGreen",DARK_MAGENTA:"darkMagenta",DARK_RED:"darkRed",DARK_YELLOW:"darkYellow",GREEN:"green",LIGHT_GRAY:"lightGray",MAGENTA:"magenta",NONE:"none",RED:"red",WHITE:"white",YELLOW:"yellow"},U2=class extends R2{constructor(B){super("w:rPr");if(!B)return;if(B.style)this.push(new q2("w:rStyle",B.style));if(B.font)if(typeof B.font==="string")this.push(T1(B.font));else if("name"in B.font)this.push(T1(B.font.name,B.font.hint));else this.push(T1(B.font));if(B.bold!==void 0)this.push(new q0("w:b",B.bold));if(B.boldComplexScript===void 0&&B.bold!==void 0||B.boldComplexScript){var U;this.push(new q0("w:bCs",(U=B.boldComplexScript)!==null&&U!==void 0?U:B.bold))}if(B.italics!==void 0)this.push(new q0("w:i",B.italics));if(B.italicsComplexScript===void 0&&B.italics!==void 0||B.italicsComplexScript){var G;this.push(new q0("w:iCs",(G=B.italicsComplexScript)!==null&&G!==void 0?G:B.italics))}if(B.smallCaps!==void 0)this.push(new q0("w:smallCaps",B.smallCaps));else if(B.allCaps!==void 0)this.push(new q0("w:caps",B.allCaps));if(B.strike!==void 0)this.push(new q0("w:strike",B.strike));if(B.doubleStrike!==void 0)this.push(new q0("w:dstrike",B.doubleStrike));if(B.emboss!==void 0)this.push(new q0("w:emboss",B.emboss));if(B.imprint!==void 0)this.push(new q0("w:imprint",B.imprint));if(B.noProof!==void 0)this.push(new q0("w:noProof",B.noProof));if(B.snapToGrid!==void 0)this.push(new q0("w:snapToGrid",B.snapToGrid));if(B.vanish)this.push(new q0("w:vanish",B.vanish));if(B.color)this.push(new NG(B.color));if(B.characterSpacing)this.push(new jG(B.characterSpacing));if(B.scale!==void 0)this.push(new _2("w:w",B.scale));if(B.kern)this.push(new D1("w:kern",B.kern));if(B.position)this.push(new q2("w:position",B.position));if(B.size!==void 0)this.push(new D1("w:sz",B.size));let Y=B.sizeComplexScript===void 0||B.sizeComplexScript===!0?B.size:B.sizeComplexScript;if(Y)this.push(new D1("w:szCs",Y));if(B.highlight)this.push(new zG(B.highlight));let Q=B.highlightComplexScript===void 0||B.highlightComplexScript===!0?B.highlight:B.highlightComplexScript;if(Q)this.push(new wG(Q));if(B.underline)this.push(cB(B.underline.type,B.underline.color));if(B.effect)this.push(new q2("w:effect",B.effect));if(B.border)this.push(j0("w:bdr",B.border));if(B.shading)this.push(M1(B.shading));if(B.subScript)this.push(TG());if(B.superScript)this.push(DG());if(B.rightToLeft!==void 0)this.push(new q0("w:rtl",B.rightToLeft));if(B.emphasisMark)this.push(r8(B.emphasisMark.type));if(B.language)this.push(EG(B.language));if(B.specVanish)this.push(new q0("w:specVanish",B.vanish));if(B.math)this.push(new q0("w:oMath",B.math));if(B.revision)this.push(new lB(B.revision))}push(B){this.root.push(B)}},mB=class extends U2{constructor(B){super(B);if(B===null||B===void 0?void 0:B.insertion)this.push(new PG(B.insertion));if(B===null||B===void 0?void 0:B.deletion)this.push(new WG(B.deletion))}},lB=class extends t{constructor(B){super("w:rPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new U2(B))}},Z1=class extends t{constructor(B){super("w:t");if(typeof B==="string")this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B);else{var U;this.root.push(new _0({space:(U=B.space)!==null&&U!==void 0?U:x0.DEFAULT})),this.root.push(B.text)}}},F2={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},D0=class extends t{constructor(B){super("w:r");if(e(this,"properties",void 0),this.properties=new U2(B),this.root.push(this.properties),B.break)for(let U=0;U{U.exports=G;function G(Y,Q){if(!Y)throw Error(Q||"Assertion failed")}G.equal=function(Q,K,Z){if(Q!=K)throw Error(Z||"Assertion failed: "+Q+" != "+K)}}),G2=R0((B)=>{var U=R1();B.inherits=W2();function G(b,c){if((b.charCodeAt(c)&64512)!==55296)return!1;if(c<0||c+1>=b.length)return!1;return(b.charCodeAt(c+1)&64512)===56320}function Y(b,c){if(Array.isArray(b))return b.slice();if(!b)return[];var D=[];if(typeof b==="string"){if(!c){var m=0;for(var B0=0;B0>6|192,D[m++]=i&63|128;else if(G(b,B0))i=65536+((i&1023)<<10)+(b.charCodeAt(++B0)&1023),D[m++]=i>>18|240,D[m++]=i>>12&63|128,D[m++]=i>>6&63|128,D[m++]=i&63|128;else D[m++]=i>>12|224,D[m++]=i>>6&63|128,D[m++]=i&63|128}}else if(c==="hex"){if(b=b.replace(/[^a-z0-9]+/gi,""),b.length%2!==0)b="0"+b;for(B0=0;B0>>24|b>>>8&65280|b<<8&16711680|(b&255)<<24)>>>0}B.htonl=K;function Z(b,c){var D="";for(var m=0;m>>0}return i}B.join32=W;function I(b,c){var D=Array(b.length*4);for(var m=0,B0=0;m>>24,D[B0+1]=i>>>16&255,D[B0+2]=i>>>8&255,D[B0+3]=i&255;else D[B0+3]=i>>>24,D[B0+2]=i>>>16&255,D[B0+1]=i>>>8&255,D[B0]=i&255}return D}B.split32=I;function H(b,c){return b>>>c|b<<32-c}B.rotr32=H;function T(b,c){return b<>>32-c}B.rotl32=T;function A(b,c){return b+c>>>0}B.sum32=A;function P(b,c,D){return b+c+D>>>0}B.sum32_3=P;function j(b,c,D,m){return b+c+D+m>>>0}B.sum32_4=j;function E(b,c,D,m,B0){return b+c+D+m+B0>>>0}B.sum32_5=E;function C(b,c,D,m){var B0=b[c],i=m+b[c+1]>>>0;b[c]=(i>>0,b[c+1]=i}B.sum64=C;function N(b,c,D,m){return(c+m>>>0>>0}B.sum64_hi=N;function v(b,c,D,m){return c+m>>>0}B.sum64_lo=v;function S(b,c,D,m,B0,i,V0,s){var G0=0,r=c;return r=r+m>>>0,G0+=r>>0,G0+=r>>0,G0+=r>>0}B.sum64_4_hi=S;function F(b,c,D,m,B0,i,V0,s){return c+m+i+s>>>0}B.sum64_4_lo=F;function M(b,c,D,m,B0,i,V0,s,G0,r){var y=0,n=c;return n=n+m>>>0,y+=n>>0,y+=n>>0,y+=n>>0,y+=n>>0}B.sum64_5_hi=M;function $(b,c,D,m,B0,i,V0,s,G0,r){return c+m+i+s+r>>>0}B.sum64_5_lo=$;function x(b,c,D){return(c<<32-D|b>>>D)>>>0}B.rotr64_hi=x;function z(b,c,D){return(b<<32-D|c>>>D)>>>0}B.rotr64_lo=z;function a(b,c,D){return b>>>D}B.shr64_hi=a;function U0(b,c,D){return(b<<32-D|c>>>D)>>>0}B.shr64_lo=U0}),L1=R0((B)=>{var U=G2(),G=R1();function Y(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}B.BlockHash=Y,Y.prototype.update=function(K,Z){if(K=U.toArray(K,Z),!this.pending)this.pending=K;else this.pending=this.pending.concat(K);if(this.pendingTotal+=K.length,this.pending.length>=this._delta8){K=this.pending;var J=K.length%this._delta8;if(this.pending=K.slice(K.length-J,K.length),this.pending.length===0)this.pending=null;K=U.join32(K,0,K.length-J,this.endian);for(var q=0;q>>24&255,q[W++]=K>>>16&255,q[W++]=K>>>8&255,q[W++]=K&255}else{q[W++]=K&255,q[W++]=K>>>8&255,q[W++]=K>>>16&255,q[W++]=K>>>24&255,q[W++]=0,q[W++]=0,q[W++]=0,q[W++]=0;for(I=8;I{var U=G2().rotr32;function G(I,H,T,A){if(I===0)return Y(H,T,A);if(I===1||I===3)return K(H,T,A);if(I===2)return Q(H,T,A)}B.ft_1=G;function Y(I,H,T){return I&H^~I&T}B.ch32=Y;function Q(I,H,T){return I&H^I&T^H&T}B.maj32=Q;function K(I,H,T){return I^H^T}B.p32=K;function Z(I){return U(I,2)^U(I,13)^U(I,22)}B.s0_256=Z;function J(I){return U(I,6)^U(I,11)^U(I,25)}B.s1_256=J;function q(I){return U(I,7)^U(I,18)^I>>>3}B.g0_256=q;function W(I){return U(I,17)^U(I,19)^I>>>10}B.g1_256=W}),SG=R0((B,U)=>{var G=G2(),Y=L1(),Q=pB(),K=G.rotl32,Z=G.sum32,J=G.sum32_5,q=Q.ft_1,W=Y.BlockHash,I=[1518500249,1859775393,2400959708,3395469782];function H(){if(!(this instanceof H))return new H;W.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}G.inherits(H,W),U.exports=H,H.blockSize=512,H.outSize=160,H.hmacStrength=80,H.padLength=64,H.prototype._update=function(A,P){var j=this.W;for(var E=0;E<16;E++)j[E]=A[P+E];for(;E{var G=G2(),Y=L1(),Q=pB(),K=R1(),Z=G.sum32,J=G.sum32_4,q=G.sum32_5,W=Q.ch32,I=Q.maj32,H=Q.s0_256,T=Q.s1_256,A=Q.g0_256,P=Q.g1_256,j=Y.BlockHash,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function C(){if(!(this instanceof C))return new C;j.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=Array(64)}G.inherits(C,j),U.exports=C,C.blockSize=512,C.outSize=256,C.hmacStrength=192,C.padLength=64,C.prototype._update=function(v,S){var F=this.W;for(var M=0;M<16;M++)F[M]=v[S+M];for(;M{var G=G2(),Y=rB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=512,Q.outSize=224,Q.hmacStrength=192,Q.padLength=64,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),iB=R0((B,U)=>{var G=G2(),Y=L1(),Q=R1(),K=G.rotr64_hi,Z=G.rotr64_lo,J=G.shr64_hi,q=G.shr64_lo,W=G.sum64,I=G.sum64_hi,H=G.sum64_lo,T=G.sum64_4_hi,A=G.sum64_4_lo,P=G.sum64_5_hi,j=G.sum64_5_lo,E=Y.BlockHash,C=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function N(){if(!(this instanceof N))return new N;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=C,this.W=Array(160)}G.inherits(N,E),U.exports=N,N.blockSize=1024,N.outSize=512,N.hmacStrength=192,N.padLength=128,N.prototype._prepareBlock=function(B0,i){var V0=this.W;for(var s=0;s<32;s++)V0[s]=B0[i+s];for(;s{var G=G2(),Y=iB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=1024,Q.outSize=384,Q.hmacStrength=192,Q.padLength=128,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),yG=R0((B)=>{B.sha1=SG(),B.sha224=bG(),B.sha256=rB(),B.sha384=vG(),B.sha512=iB()}),gG=R0((B)=>{var U=G2(),G=L1(),Y=U.rotl32,Q=U.sum32,K=U.sum32_3,Z=U.sum32_4,J=G.BlockHash;function q(){if(!(this instanceof q))return new q;J.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}U.inherits(q,J),B.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(C,N){var v=this.h[0],S=this.h[1],F=this.h[2],M=this.h[3],$=this.h[4],x=v,z=S,a=F,U0=M,b=$;for(var c=0;c<80;c++){var D=Q(Y(Z(v,W(c,S,F,M),C[T[c]+N],I(c)),P[c]),$);v=$,$=M,M=Y(F,10),F=S,S=D,D=Q(Y(Z(x,W(79-c,z,a,U0),C[A[c]+N],H(c)),j[c]),b),x=b,b=U0,U0=Y(a,10),a=z,z=D}D=K(this.h[1],F,U0),this.h[1]=K(this.h[2],M,b),this.h[2]=K(this.h[3],$,x),this.h[3]=K(this.h[4],v,z),this.h[4]=K(this.h[0],S,a),this.h[0]=D},q.prototype._digest=function(C){if(C==="hex")return U.toHex32(this.h,"little");else return U.split32(this.h,"little")};function W(E,C,N,v){if(E<=15)return C^N^v;else if(E<=31)return C&N|~C&v;else if(E<=47)return(C|~N)^v;else if(E<=63)return C&v|N&~v;else return C^(N|~v)}function I(E){if(E<=15)return 0;else if(E<=31)return 1518500249;else if(E<=47)return 1859775393;else if(E<=63)return 2400959708;else return 2840853838}function H(E){if(E<=15)return 1352829926;else if(E<=31)return 1548603684;else if(E<=47)return 1836072691;else if(E<=63)return 2053994217;else return 0}var T=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],A=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],P=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],j=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),fG=R0((B,U)=>{var G=G2(),Y=R1();function Q(K,Z,J){if(!(this instanceof Q))return new Q(K,Z,J);this.Hash=K,this.blockSize=K.blockSize/8,this.outSize=K.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(Z,J))}U.exports=Q,Q.prototype._init=function(Z){if(Z.length>this.blockSize)Z=new this.Hash().update(Z).digest();Y(Z.length<=this.blockSize);for(var J=Z.length;J{var U=B;U.utils=G2(),U.common=L1(),U.sha=yG(),U.ripemd=gG(),U.hmac=fG(),U.sha1=U.sha.sha1,U.sha256=U.sha.sha256,U.sha224=U.sha.sha224,U.sha384=U.sha.sha384,U.sha512=U.sha.sha512,U.ripemd160=U.ripemd.ripemd160})(),1),_G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",hG=(B,U=21)=>{return(G=U)=>{let Y="",Q=G|0;while(Q--)Y+=B[Math.random()*B.length|0];return Y}},uG=(B=21)=>{let U="",G=B|0;while(G--)U+=_G[Math.random()*64|0];return U},dG=(B)=>Math.floor(B/25.4*72*20),u0=(B)=>Math.floor(B*72*20),I1=(B=0)=>{let U=B;return()=>++U},nB=()=>I1(),sB=()=>I1(1),oB=()=>I1(),tB=()=>I1(),O1=()=>uG().toLowerCase(),P8=(B)=>xG.default.sha1().update(B instanceof ArrayBuffer?new Uint8Array(B):B).digest("hex"),s2=(B)=>hG("1234567890abcdef",B)(),eB=()=>`${s2(8)}-${s2(4)}-${s2(4)}-${s2(4)}-${s2(12)}`,U1=(B)=>new Uint8Array(new TextEncoder().encode(B)),B4={CHARACTER:"character",COLUMN:"column",INSIDE_MARGIN:"insideMargin",LEFT_MARGIN:"leftMargin",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",RIGHT_MARGIN:"rightMargin"},U4={BOTTOM_MARGIN:"bottomMargin",INSIDE_MARGIN:"insideMargin",LINE:"line",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",PARAGRAPH:"paragraph",TOP_MARGIN:"topMargin"},G4=()=>new M0({name:"wp:simplePos",attributes:{x:{key:"x",value:0},y:{key:"y",value:0}}}),Y4=(B)=>new M0({name:"wp:align",children:[B]}),Z4=(B)=>new M0({name:"wp:posOffset",children:[B.toString()]}),Q4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionH",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:B4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),J4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionV",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:U4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),cG=function(B){return B.CENTER="ctr",B.TOP="t",B.BOTTOM="b",B}({}),K4=(B={})=>{var U,G,Y,Q;return new M0({name:"wps:bodyPr",attributes:{lIns:{key:"lIns",value:(U=B.margins)===null||U===void 0?void 0:U.left},rIns:{key:"rIns",value:(G=B.margins)===null||G===void 0?void 0:G.right},tIns:{key:"tIns",value:(Y=B.margins)===null||Y===void 0?void 0:Y.top},bIns:{key:"bIns",value:(Q=B.margins)===null||Q===void 0?void 0:Q.bottom},anchor:{key:"anchor",value:B.verticalAnchor}},children:[...B.noAutoFit?[new q0("a:noAutofit",B.noAutoFit)]:[]]})},mG=(B={txBox:"1"})=>new M0({name:"wps:cNvSpPr",attributes:{txBox:{key:"txBox",value:B.txBox}}}),lG=(B)=>new M0({name:"w:txbxContent",children:[...B]}),aG=(B)=>new M0({name:"wps:txbx",children:[lG(B)]}),pG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{cx:"cx",cy:"cy"})}},rG=class extends t{constructor(B,U){super("a:ext");e(this,"attributes",void 0),this.attributes=new pG({cx:B,cy:U}),this.root.push(this.attributes)}},iG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{x:"x",y:"y"})}},nG=class extends t{constructor(B,U){super("a:off");this.root.push(new iG({x:B!==null&&B!==void 0?B:0,y:U!==null&&U!==void 0?U:0}))}},sG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{flipVertical:"flipV",flipHorizontal:"flipH",rotation:"rot"})}},V4=class extends t{constructor(B){var U,G,Y,Q;super("a:xfrm");e(this,"extents",void 0),e(this,"offset",void 0),this.root.push(new sG({flipVertical:(U=B.flip)===null||U===void 0?void 0:U.vertical,flipHorizontal:(G=B.flip)===null||G===void 0?void 0:G.horizontal,rotation:B.rotation})),this.offset=new nG((Y=B.offset)===null||Y===void 0||(Y=Y.emus)===null||Y===void 0?void 0:Y.x,(Q=B.offset)===null||Q===void 0||(Q=Q.emus)===null||Q===void 0?void 0:Q.y),this.extents=new rG(B.emus.x,B.emus.y),this.root.push(this.offset),this.root.push(this.extents)}},X4=()=>new M0({name:"a:noFill"}),oG=(B)=>new M0({name:"a:srgbClr",attributes:{value:{key:"val",value:B.value}}}),tG=(B)=>new M0({name:"a:schemeClr",attributes:{value:{key:"val",value:B.value}}}),A8=(B)=>new M0({name:"a:solidFill",children:[B.type==="rgb"?oG(B):tG(B)]}),eG=(B)=>new M0({name:"a:ln",attributes:{width:{key:"w",value:B.width},cap:{key:"cap",value:B.cap},compoundLine:{key:"cmpd",value:B.compoundLine},align:{key:"algn",value:B.align}},children:[B.type==="noFill"?X4():B.solidFillType==="rgb"?A8({type:"rgb",value:B.value}):A8({type:"scheme",value:B.value})]}),BY=class extends t{constructor(){super("a:avLst")}},UY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{prst:"prst"})}},GY=class extends t{constructor(){super("a:prstGeom");this.root.push(new UY({prst:"rect"})),this.root.push(new BY)}},YY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{bwMode:"bwMode"})}},q4=class extends t{constructor({element:B,outline:U,solidFill:G,transform:Y}){super(`${B}:spPr`);if(e(this,"form",void 0),this.root.push(new YY({bwMode:"auto"})),this.form=new V4(Y),this.root.push(this.form),this.root.push(new GY),U)this.root.push(X4()),this.root.push(eG(U));if(G)this.root.push(A8(G))}},l6=(B)=>new M0({name:"wps:wsp",children:[mG(B.nonVisualProperties),new q4({element:"wps",transform:B.transformation,outline:B.outline,solidFill:B.solidFill}),aG(B.children),K4(B.bodyProperties)]}),K8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{uri:"uri"})}},ZY=(B)=>new M0({name:"asvg:svgBlip",attributes:{asvg:{key:"xmlns:asvg",value:"http://schemas.microsoft.com/office/drawing/2016/SVG/main"},embed:{key:"r:embed",value:`rId{${B.fileName}}`}}}),QY=(B)=>new M0({name:"a:ext",attributes:{uri:{key:"uri",value:"{96DAC541-7B7A-43D3-8B79-37D633B846F1}"}},children:[ZY(B)]}),JY=(B)=>new M0({name:"a:extLst",children:[QY(B)]}),KY=(B)=>new M0({name:"a:blip",attributes:{embed:{key:"r:embed",value:`rId{${B.type==="svg"?B.fallback.fileName:B.fileName}}`},cstate:{key:"cstate",value:"none"}},children:B.type==="svg"?[JY(B)]:[]}),VY=class extends t{constructor(){super("a:srcRect")}},XY=class extends t{constructor(){super("a:fillRect")}},qY=class extends t{constructor(){super("a:stretch");this.root.push(new XY)}},MY=class extends t{constructor(B){super("pic:blipFill");this.root.push(KY(B)),this.root.push(new VY),this.root.push(new qY)}},RY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{noChangeAspect:"noChangeAspect",noChangeArrowheads:"noChangeArrowheads"})}},LY=class extends t{constructor(){super("a:picLocks");this.root.push(new RY({noChangeAspect:1,noChangeArrowheads:1}))}},IY=class extends t{constructor(){super("pic:cNvPicPr");this.root.push(new LY)}},M4=(B,U)=>new M0({name:"a:hlinkClick",attributes:L0(L0({},U?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${B}`}})}),OY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"id",name:"name",descr:"descr"})}},HY=class extends t{constructor(){super("pic:cNvPr");this.root.push(new OY({id:0,name:"",descr:""}))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!1));break}return super.prepForXml(B)}},FY=class extends t{constructor(){super("pic:nvPicPr");this.root.push(new HY),this.root.push(new IY)}},WY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:pic"})}},a6=class extends t{constructor({mediaData:B,transform:U,outline:G}){super("pic:pic");this.root.push(new WY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/picture"})),this.root.push(new FY),this.root.push(new MY(B)),this.root.push(new q4({element:"pic",transform:U,outline:G}))}},PY=(B)=>new M0({name:"wpg:grpSpPr",children:[new V4(B)]}),AY=()=>new M0({name:"wpg:cNvGrpSpPr"}),jY=(B)=>new M0({name:"wpg:wgp",children:[AY(),PY(B.transformation),...B.children]}),NY=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphicData");if(B.type==="wps"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));let Q=l6(L0(L0({},B.data),{},{transformation:U,outline:G,solidFill:Y}));this.root.push(Q)}else if(B.type==="wpg"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"}));let Q=jY({children:B.children.map((K)=>{if(K.type==="wps")return l6(L0(L0({},K.data),{},{transformation:K.transformation,outline:K.outline,solidFill:K.solidFill}));else return new a6({mediaData:K,transform:K.transformation,outline:K.outline})}),transformation:U});this.root.push(Q)}else{this.root.push(new K8({uri:"http://schemas.openxmlformats.org/drawingml/2006/picture"}));let Q=new a6({mediaData:B,transform:U,outline:G});this.root.push(Q)}}},zY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{a:"xmlns:a"})}},R4=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphic");e(this,"data",void 0),this.root.push(new zY({a:"http://schemas.openxmlformats.org/drawingml/2006/main"})),this.data=new NY({mediaData:B,transform:U,outline:G,solidFill:Y}),this.root.push(this.data)}},e2={NONE:0,SQUARE:1,TIGHT:2,TOP_AND_BOTTOM:3},L4={BOTH_SIDES:"bothSides",LEFT:"left",RIGHT:"right",LARGEST:"largest"},j8=()=>new M0({name:"wp:wrapNone"}),I4=(B,U={top:0,bottom:0,left:0,right:0})=>new M0({name:"wp:wrapSquare",attributes:{wrapText:{key:"wrapText",value:B.side||L4.BOTH_SIDES},distT:{key:"distT",value:U.top},distB:{key:"distB",value:U.bottom},distL:{key:"distL",value:U.left},distR:{key:"distR",value:U.right}}}),O4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTight",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),H4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTopAndBottom",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),F4=class extends t{constructor({name:B,description:U,title:G,id:Y}={name:"",description:"",title:""}){super("wp:docPr");e(this,"docPropertiesUniqueNumericId",oB());let Q={id:{key:"id",value:Y!==null&&Y!==void 0?Y:this.docPropertiesUniqueNumericId()},name:{key:"name",value:B}};if(U!==null&&U!==void 0)Q.description={key:"descr",value:U};if(G!==null&&G!==void 0)Q.title={key:"title",value:G};this.root.push(new $8(Q))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!0));break}return super.prepForXml(B)}},W4=({top:B,right:U,bottom:G,left:Y})=>new M0({name:"wp:effectExtent",attributes:{top:{key:"t",value:B},right:{key:"r",value:U},bottom:{key:"b",value:G},left:{key:"l",value:Y}}}),P4=({x:B,y:U})=>new M0({name:"wp:extent",attributes:{x:{key:"cx",value:B},y:{key:"cy",value:U}}}),wY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:a",noChangeAspect:"noChangeAspect"})}},EY=class extends t{constructor(){super("a:graphicFrameLocks");this.root.push(new wY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/main",noChangeAspect:1}))}},A4=()=>new M0({name:"wp:cNvGraphicFramePr",children:[new EY]}),DY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{distT:"distT",distB:"distB",distL:"distL",distR:"distR",allowOverlap:"allowOverlap",behindDoc:"behindDoc",layoutInCell:"layoutInCell",locked:"locked",relativeHeight:"relativeHeight",simplePos:"simplePos"})}},TY=class extends t{constructor({mediaData:B,transform:U,drawingOptions:G}){super("wp:anchor");let Y=L0({allowOverlap:!0,behindDocument:!1,lockAnchor:!1,layoutInCell:!0,verticalPosition:{},horizontalPosition:{}},G.floating);if(this.root.push(new DY({distT:Y.margins?Y.margins.top||0:0,distB:Y.margins?Y.margins.bottom||0:0,distL:Y.margins?Y.margins.left||0:0,distR:Y.margins?Y.margins.right||0:0,simplePos:"0",allowOverlap:Y.allowOverlap===!0?"1":"0",behindDoc:Y.behindDocument===!0?"1":"0",locked:Y.lockAnchor===!0?"1":"0",layoutInCell:Y.layoutInCell===!0?"1":"0",relativeHeight:Y.zIndex?Y.zIndex:U.emus.y})),this.root.push(G4()),this.root.push(Q4(Y.horizontalPosition)),this.root.push(J4(Y.verticalPosition)),this.root.push(P4({x:U.emus.x,y:U.emus.y})),this.root.push(W4({top:0,right:0,bottom:0,left:0})),G.floating!==void 0&&G.floating.wrap!==void 0)switch(G.floating.wrap.type){case e2.SQUARE:this.root.push(I4(G.floating.wrap,G.floating.margins));break;case e2.TIGHT:this.root.push(O4(G.floating.margins));break;case e2.TOP_AND_BOTTOM:this.root.push(H4(G.floating.margins));break;case e2.NONE:default:this.root.push(j8())}else this.root.push(j8());this.root.push(new F4(G.docProperties)),this.root.push(A4()),this.root.push(new R4({mediaData:B,transform:U,outline:G.outline,solidFill:G.solidFill}))}},CY=({mediaData:B,transform:U,docProperties:G,outline:Y,solidFill:Q})=>{var K,Z,J,q;return new M0({name:"wp:inline",attributes:{distanceTop:{key:"distT",value:0},distanceBottom:{key:"distB",value:0},distanceLeft:{key:"distL",value:0},distanceRight:{key:"distR",value:0}},children:[P4({x:U.emus.x,y:U.emus.y}),W4(Y?{top:((K=Y.width)!==null&&K!==void 0?K:9525)*2,right:((Z=Y.width)!==null&&Z!==void 0?Z:9525)*2,bottom:((J=Y.width)!==null&&J!==void 0?J:9525)*2,left:((q=Y.width)!==null&&q!==void 0?q:9525)*2}:{top:0,right:0,bottom:0,left:0}),new F4(G),A4(),new R4({mediaData:B,transform:U,outline:Y,solidFill:Q})]})},m1=class extends t{constructor(B,U={}){super("w:drawing");if(!U.floating)this.root.push(CY({mediaData:B,transform:B.transformation,docProperties:U.docProperties,outline:U.outline,solidFill:U.solidFill}));else this.root.push(new TY({mediaData:B,transform:B.transformation,drawingOptions:U}))}},kY=(B)=>{let U=B.indexOf(";base64,"),G=U===-1?0:U+8;return new Uint8Array(atob(B.substring(G)).split("").map((Y)=>Y.charCodeAt(0)))},j4=(B)=>typeof B==="string"?kY(B):B,V8=(B,U)=>({data:j4(B.data),fileName:U,transformation:{pixels:{x:Math.round(B.transformation.width),y:Math.round(B.transformation.height)},emus:{x:Math.round(B.transformation.width*9525),y:Math.round(B.transformation.height*9525)},flip:B.transformation.flip,rotation:B.transformation.rotation?B.transformation.rotation*60000:void 0}}),$Y=class extends t{constructor(B){var U=(...Z)=>(super(...Z),e(this,"imageData",void 0),this);let G=`${P8(B.data)}.${B.type}`,Y=B.type==="svg"?L0(L0({type:B.type},V8(B,G)),{},{fallback:L0({type:B.fallback.type},V8(L0(L0({},B.fallback),{},{transformation:B.transformation}),`${P8(B.fallback.data)}.${B.fallback.type}`))}):L0({type:B.type},V8(B,G)),Q=new m1(Y,{floating:B.floating,docProperties:B.altText,outline:B.outline}),K=new D0({children:[Q]});if(B.insertion)U("w:ins"),this.root.push(new b0({id:B.insertion.id,author:B.insertion.author,date:B.insertion.date})),this.addChildElement(K);else if(B.deletion)U("w:del"),this.root.push(new b0({id:B.deletion.id,author:B.deletion.author,date:B.deletion.date})),this.addChildElement(K);else U("w:r"),this.root.push(new U2({})),this.root.push(Q);this.imageData=Y}prepForXml(B){if(B.file.Media.addImage(this.imageData.fileName,this.imageData),this.imageData.type==="svg")B.file.Media.addImage(this.imageData.fallback.fileName,this.imageData.fallback);return super.prepForXml(B)}},n8=(B)=>{var U,G,Y,Q,K,Z,J,q;return{offset:{pixels:{x:Math.round((U=(G=B.offset)===null||G===void 0?void 0:G.left)!==null&&U!==void 0?U:0),y:Math.round((Y=(Q=B.offset)===null||Q===void 0?void 0:Q.top)!==null&&Y!==void 0?Y:0)},emus:{x:Math.round(((K=(Z=B.offset)===null||Z===void 0?void 0:Z.left)!==null&&K!==void 0?K:0)*9525),y:Math.round(((J=(q=B.offset)===null||q===void 0?void 0:q.top)!==null&&J!==void 0?J:0)*9525)}},pixels:{x:Math.round(B.width),y:Math.round(B.height)},emus:{x:Math.round(B.width*9525),y:Math.round(B.height*9525)},flip:B.flip,rotation:B.rotation?B.rotation*60000:void 0}},SY=class extends D0{constructor(B){super({});e(this,"wpsShapeData",void 0),this.wpsShapeData={type:B.type,transformation:n8(B.transformation),data:L0({},B)};let U=new m1(this.wpsShapeData,{floating:B.floating,docProperties:B.altText,outline:B.outline,solidFill:B.solidFill});this.root.push(U)}},bY=class extends D0{constructor(B){super({});e(this,"wpgGroupData",void 0),e(this,"mediaDatas",void 0),this.wpgGroupData={type:B.type,transformation:n8(B.transformation),children:B.children};let U=new m1(this.wpgGroupData,{floating:B.floating,docProperties:B.altText});this.mediaDatas=B.children.filter((G)=>G.type!=="wps").map((G)=>G),this.root.push(U)}prepForXml(B){return this.mediaDatas.forEach((U)=>{if(B.file.Media.addImage(U.fileName,U),U.type==="svg")B.file.Media.addImage(U.fallback.fileName,U.fallback)}),super.prepForXml(B)}},vY=class extends t{constructor(B){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(`SEQ ${B}`)}},yY=class extends D0{constructor(B){super({});this.root.push(e0(!0)),this.root.push(new vY(B)),this.root.push(X2()),this.root.push(B2())}},gY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{instr:"w:instr"})}},s8=class extends t{constructor(B,U){super("w:fldSimple");if(this.root.push(new gY({instr:B})),U!==void 0)this.root.push(new Q1(U))}},fY=class extends s8{constructor(B){super(` MERGEFIELD ${B} `,`«${B}»`)}},xY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},N4={EXTERNAL:"External"},_Y=(B,U,G,Y)=>new M0({name:"Relationship",attributes:{id:{key:"Id",value:B},type:{key:"Type",value:U},target:{key:"Target",value:G},targetMode:{key:"TargetMode",value:Y}}}),A2=class extends t{constructor(){super("Relationships");this.root.push(new xY({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(B,U,G,Y){this.root.push(_Y(`rId${B}`,U,G,Y))}get RelationshipCount(){return this.root.length-1}},hY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},o8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},uY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}},dY=class extends t{constructor(B){super("w:commentRangeStart");this.root.push(new o8({id:B}))}},cY=class extends t{constructor(B){super("w:commentRangeEnd");this.root.push(new o8({id:B}))}},mY=class extends t{constructor(B){super("w:commentReference");this.root.push(new o8({id:B}))}},N8=class extends t{constructor({id:B,initials:U,author:G,date:Y=new Date,children:Q},K){super("w:comment");e(this,"paraId",void 0),this.paraId=K,this.root.push(new hY({id:B,initials:U,author:G,date:Y.toISOString()}));for(let Z of Q)this.root.push(Z)}prepForXml(B){let U=super.prepForXml(B);if(!U||!this.paraId)return U;let G=U["w:comment"];if(!Array.isArray(G))return U;for(let Y=G.length-1;Y>=0;Y--){let Q=G[Y];if(Q&&typeof Q==="object"&&"w:p"in Q){let K=Q["w:p"];if(Array.isArray(K))K.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return U}},z4=(B)=>(B+1).toString(16).toUpperCase().padStart(8,"0"),w4=class extends t{constructor({children:B}){super("w:comments");if(e(this,"relationships",void 0),e(this,"threadData",void 0),this.root.push(new uY({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"})),B.some((U)=>U.parentId!==void 0)){let U=new Map(B.map((G)=>[G.id,z4(G.id)]));for(let G of B)this.root.push(new N8(G,U.get(G.id)));this.threadData=B.map((G)=>({paraId:U.get(G.id),parentParaId:G.parentId!==void 0?U.get(G.parentId):void 0,done:G.resolved}))}else for(let U of B)this.root.push(new N8(U));this.relationships=new A2}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}},lY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},aY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},pY=class extends t{constructor(B){super("w15:commentEx");this.root.push(new aY({paraId:B.paraId,paraIdParent:B.parentParaId,done:B.done!==void 0?B.done?"1":"0":void 0}))}},E4=class extends t{constructor(B){super("w15:commentsEx");this.root.push(new lY({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let U of B)this.root.push(new pY(U))}},rY=class extends S0{constructor(){super("w:noBreakHyphen")}},iY=class extends S0{constructor(){super("w:softHyphen")}},nY=class extends S0{constructor(){super("w:dayShort")}},sY=class extends S0{constructor(){super("w:monthShort")}},oY=class extends S0{constructor(){super("w:yearShort")}},tY=class extends S0{constructor(){super("w:dayLong")}},eY=class extends S0{constructor(){super("w:monthLong")}},BZ=class extends S0{constructor(){super("w:yearLong")}},UZ=class extends S0{constructor(){super("w:annotationRef")}},GZ=class extends S0{constructor(){super("w:footnoteRef")}},D4=class extends S0{constructor(){super("w:endnoteRef")}},YZ=class extends S0{constructor(){super("w:separator")}},ZZ=class extends S0{constructor(){super("w:continuationSeparator")}},QZ=class extends S0{constructor(){super("w:pgNum")}},JZ=class extends S0{constructor(){super("w:cr")}},T4=class extends S0{constructor(){super("w:tab")}},KZ=class extends S0{constructor(){super("w:lastRenderedPageBreak")}},VZ={LEFT:"left",CENTER:"center",RIGHT:"right"},XZ={MARGIN:"margin",INDENT:"indent"},qZ={NONE:"none",DOT:"dot",HYPHEN:"hyphen",UNDERSCORE:"underscore",MIDDLE_DOT:"middleDot"},MZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{alignment:"w:alignment",relativeTo:"w:relativeTo",leader:"w:leader"})}},RZ=class extends t{constructor(B){super("w:ptab");this.root.push(new MZ({alignment:B.alignment,relativeTo:B.relativeTo,leader:B.leader}))}},C4={COLUMN:"column",PAGE:"page"},k4=class extends t{constructor(B){super("w:br");this.root.push(new C0({type:B}))}},LZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.PAGE))}},IZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.COLUMN))}},$4=class extends t{constructor(){super("w:pageBreakBefore")}},k2={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},S4=({after:B,before:U,line:G,lineRule:Y,beforeAutoSpacing:Q,afterAutoSpacing:K})=>new M0({name:"w:spacing",attributes:{after:{key:"w:after",value:B},before:{key:"w:before",value:U},line:{key:"w:line",value:G},lineRule:{key:"w:lineRule",value:Y},beforeAutoSpacing:{key:"w:beforeAutospacing",value:Q},afterAutoSpacing:{key:"w:afterAutospacing",value:K}}}),OZ={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},x2=(B)=>new M0({name:"w:pStyle",attributes:{val:{key:"w:val",value:B}}}),z8={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},HZ={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},FZ={MAX:9026},b4=({type:B,position:U,leader:G})=>new M0({name:"w:tab",attributes:{val:{key:"w:val",value:B},pos:{key:"w:pos",value:U},leader:{key:"w:leader",value:G}}}),v4=(B)=>new M0({name:"w:tabs",children:B.map((U)=>b4(U))}),C1=class extends t{constructor(B,U){super("w:numPr");this.root.push(new WZ(U)),this.root.push(new PZ(B))}},WZ=class extends t{constructor(B){super("w:ilvl");if(B>9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new C0({val:B}))}},PZ=class extends t{constructor(B){super("w:numId");this.root.push(new C0({val:typeof B==="string"?`{${B}}`:B}))}},H1=class extends t{constructor(...B){super(...B);e(this,"fileChild",Symbol())}},AZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},jZ={INTERNAL:"INTERNAL",EXTERNAL:"EXTERNAL"},m2=class extends t{constructor(B,U,G){super("w:hyperlink");e(this,"linkId",void 0),this.linkId=U;let Y=new AZ({history:1,anchor:G?G:void 0,id:!G?`rId${this.linkId}`:void 0});this.root.push(Y),B.forEach((Q)=>{this.root.push(Q)})}},y4=class extends m2{constructor(B){super(B.children,O1(),B.anchor)}},t8=class extends t{constructor(B){super("w:externalHyperlink");e(this,"options",void 0),this.options=B}},NZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",name:"w:name"})}},zZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},g4=class{constructor(B){e(this,"bookmarkUniqueNumericId",tB()),e(this,"start",void 0),e(this,"children",void 0),e(this,"end",void 0);let U=this.bookmarkUniqueNumericId();this.start=new f4(B.id,U),this.children=B.children,this.end=new x4(U)}},f4=class extends t{constructor(B,U){super("w:bookmarkStart");let G=new NZ({name:B,id:U});this.root.push(G)}},x4=class extends t{constructor(B){super("w:bookmarkEnd");let U=new zZ({id:B});this.root.push(U)}},wZ=function(B){return B.NONE="none",B.RELATIVE="relative",B.NO_CONTEXT="no_context",B.FULL_CONTEXT="full_context",B}({}),EZ={["relative"]:"\\r",["no_context"]:"\\n",["full_context"]:"\\w",["none"]:void 0},DZ=class extends s8{constructor(B,U,G={}){let{hyperlink:Y=!0,referenceFormat:Q="full_context"}=G,K=`${`REF ${B}`} ${[...Y?["\\h"]:[],...[EZ[Q]].filter((Z)=>!!Z)].join(" ")}`;super(K,U)}},_4=(B)=>new M0({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:B}}}),TZ=class extends t{constructor(B,U={}){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE}));let G=`PAGEREF ${B}`;if(U.hyperlink)G=`${G} \\h`;if(U.useRelativePosition)G=`${G} \\p`;this.root.push(G)}},CZ=class extends D0{constructor(B,U={}){super({children:[e0(!0),new TZ(B,U),B2()]})}},kZ={ANSI:"00",DEFAULT:"01",SYMBOL:"02",MAC:"4D",JIS:"80",HANGUL:"81",JOHAB:"82",GB_2312:"86",CHINESEBIG5:"88",GREEK:"A1",TURKISH:"A2",VIETNAMESE:"A3",HEBREW:"B1",ARABIC:"B2",BALTIC:"BA",RUSSIAN:"CC",THAI:"DE",EASTEUROPE:"EE",OEM:"FF"},E1=({id:B,fontKey:U,subsetted:G},Y)=>new M0({name:Y,attributes:L0({id:{key:"r:id",value:B}},U?{fontKey:{key:"w:fontKey",value:`{${U}}`}}:{}),children:[...G?[new q0("w:subsetted",G)]:[]]}),$Z=({name:B,altName:U,panose1:G,charset:Y,family:Q,notTrueType:K,pitch:Z,sig:J,embedRegular:q,embedBold:W,embedItalic:I,embedBoldItalic:H})=>new M0({name:"w:font",attributes:{name:{key:"w:name",value:B}},children:[...U?[f2("w:altName",U)]:[],...G?[f2("w:panose1",G)]:[],...Y?[f2("w:charset",Y)]:[],...Q?[f2("w:family",Q)]:[],...K?[new q0("w:notTrueType",K)]:[],...Z?[f2("w:pitch",Z)]:[],...J?[new M0({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:J.usb0},usb1:{key:"w:usb1",value:J.usb1},usb2:{key:"w:usb2",value:J.usb2},usb3:{key:"w:usb3",value:J.usb3},csb0:{key:"w:csb0",value:J.csb0},csb1:{key:"w:csb1",value:J.csb1}}})]:[],...q?[E1(q,"w:embedRegular")]:[],...W?[E1(W,"w:embedBold")]:[],...I?[E1(I,"w:embedItalic")]:[],...H?[E1(H,"w:embedBoldItalic")]:[]]}),SZ=({name:B,index:U,fontKey:G,characterSet:Y})=>$Z({name:B,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:Y,family:"auto",pitch:"variable",embedRegular:{fontKey:G,id:`rId${U}`}}),bZ=(B)=>new M0({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:B.map((U,G)=>SZ({name:U.name,index:G+1,fontKey:U.fontKey,characterSet:U.characterSet}))}),h4=class{constructor(B){e(this,"options",void 0),e(this,"fontTable",void 0),e(this,"relationships",void 0),e(this,"fontOptionsWithKey",[]),this.options=B,this.fontOptionsWithKey=B.map((U)=>L0(L0({},U),{},{fontKey:eB()})),this.fontTable=bZ(this.fontOptionsWithKey),this.relationships=new A2;for(let U=0;Unew M0({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),yZ={NONE:"none",DROP:"drop",MARGIN:"margin"},gZ={MARGIN:"margin",PAGE:"page",TEXT:"text"},fZ={AROUND:"around",AUTO:"auto",NONE:"none",NOT_BESIDE:"notBeside",THROUGH:"through",TIGHT:"tight"},u4=(B)=>{var U,G;return new M0({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:B.anchorLock},dropCap:{key:"w:dropCap",value:B.dropCap},width:{key:"w:w",value:B.width},height:{key:"w:h",value:B.height},x:{key:"w:x",value:B.position?B.position.x:void 0},y:{key:"w:y",value:B.position?B.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:B.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:B.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(U=B.space)===null||U===void 0?void 0:U.horizontal},spaceVertical:{key:"w:vSpace",value:(G=B.space)===null||G===void 0?void 0:G.vertical},rule:{key:"w:hRule",value:B.rule},alignmentX:{key:"w:xAlign",value:B.alignment?B.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:B.alignment?B.alignment.y:void 0},lines:{key:"w:lines",value:B.lines},wrap:{key:"w:wrap",value:B.wrap}}})},M2=class extends R2{constructor(B){super("w:pPr",B===null||B===void 0?void 0:B.includeIfEmpty);if(e(this,"numberingReferences",[]),!B)return this;if(B.heading)this.push(x2(B.heading));if(B.bullet)this.push(x2("ListParagraph"));if(B.numbering){if(!B.style&&!B.heading){if(!B.numbering.custom)this.push(x2("ListParagraph"))}}if(B.style)this.push(x2(B.style));if(B.keepNext!==void 0)this.push(new q0("w:keepNext",B.keepNext));if(B.keepLines!==void 0)this.push(new q0("w:keepLines",B.keepLines));if(B.pageBreakBefore)this.push(new $4);if(B.frame)this.push(u4(B.frame));if(B.widowControl!==void 0)this.push(new q0("w:widowControl",B.widowControl));if(B.bullet)this.push(new C1(1,B.bullet.level));if(B.numbering){var U,G;this.numberingReferences.push({reference:B.numbering.reference,instance:(U=B.numbering.instance)!==null&&U!==void 0?U:0}),this.push(new C1(`${B.numbering.reference}-${(G=B.numbering.instance)!==null&&G!==void 0?G:0}`,B.numbering.level))}else if(B.numbering===!1)this.push(new C1(0,0));if(B.border)this.push(new xB(B.border));if(B.thematicBreak)this.push(new _B);if(B.shading)this.push(M1(B.shading));if(B.wordWrap)this.push(vZ());if(B.overflowPunctuation)this.push(new q0("w:overflowPunct",B.overflowPunctuation));let Y=[...B.rightTabStop!==void 0?[{type:z8.RIGHT,position:B.rightTabStop}]:[],...B.tabStops?B.tabStops:[],...B.leftTabStop!==void 0?[{type:z8.LEFT,position:B.leftTabStop}]:[]];if(Y.length>0)this.push(v4(Y));if(B.bidirectional!==void 0)this.push(new q0("w:bidi",B.bidirectional));if(B.spacing)this.push(S4(B.spacing));if(B.indent)this.push(hB(B.indent));if(B.contextualSpacing!==void 0)this.push(new q0("w:contextualSpacing",B.contextualSpacing));if(B.alignment)this.push(m8(B.alignment));if(B.outlineLevel!==void 0)this.push(_4(B.outlineLevel));if(B.suppressLineNumbers!==void 0)this.push(new q0("w:suppressLineNumbers",B.suppressLineNumbers));if(B.autoSpaceEastAsianText!==void 0)this.push(new q0("w:autoSpaceDN",B.autoSpaceEastAsianText));if(B.run)this.push(new mB(B.run));if(B.revision)this.push(new d4(B.revision))}push(B){this.root.push(B)}prepForXml(B){if(!(B.viewWrapper instanceof h4))for(let U of this.numberingReferences)B.file.Numbering.createConcreteNumberingInstance(U.reference,U.instance);return super.prepForXml(B)}},d4=class extends t{constructor(B){super("w:pPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new M2(L0(L0({},B),{},{includeIfEmpty:!0})))}},d0=class extends H1{constructor(B){super("w:p");if(e(this,"properties",void 0),typeof B==="string")return this.properties=new M2({}),this.root.push(this.properties),this.root.push(new Q1(B)),this;if(this.properties=new M2(B),this.root.push(this.properties),B.text)this.root.push(new Q1(B.text));if(B.children)for(let U of B.children){if(U instanceof g4){this.root.push(U.start);for(let G of U.children)this.root.push(G);this.root.push(U.end);continue}this.root.push(U)}}prepForXml(B){for(let U of this.root)if(U instanceof t8){let G=this.root.indexOf(U),Y=new m2(U.options.children,O1());B.viewWrapper.Relationships.addRelationship(Y.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",U.options.link,N4.EXTERNAL),this.root[G]=Y}return super.prepForXml(B)}addRunToFront(B){return this.root.splice(1,0,B),this}},xZ=class extends t{constructor(B){super("m:oMath");for(let U of B.children)this.root.push(U)}},_Z=class extends t{constructor(B){super("m:t");this.root.push(B)}},hZ=class extends t{constructor(B){super("m:r");this.root.push(new _Z(B))}},c4=class extends t{constructor(B){super("m:den");for(let U of B)this.root.push(U)}},m4=class extends t{constructor(B){super("m:num");for(let U of B)this.root.push(U)}},uZ=class extends t{constructor(B){super("m:f");this.root.push(new m4(B.numerator)),this.root.push(new c4(B.denominator))}},l4=({accent:B})=>new M0({name:"m:chr",attributes:{accent:{key:"m:val",value:B}}}),y0=({children:B})=>new M0({name:"m:e",children:B}),a4=({value:B})=>new M0({name:"m:limLoc",attributes:{value:{key:"m:val",value:B||"undOvr"}}}),dZ=()=>new M0({name:"m:subHide",attributes:{hide:{key:"m:val",value:1}}}),cZ=()=>new M0({name:"m:supHide",attributes:{hide:{key:"m:val",value:1}}}),e8=({accent:B,hasSuperScript:U,hasSubScript:G,limitLocationVal:Y})=>new M0({name:"m:naryPr",children:[...B?[l4({accent:B})]:[],a4({value:Y}),...!U?[cZ()]:[],...!G?[dZ()]:[]]}),l2=({children:B})=>new M0({name:"m:sub",children:B}),a2=({children:B})=>new M0({name:"m:sup",children:B}),mZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"∑",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},lZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript,limitLocationVal:"subSup"})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},B6=class extends t{constructor(B){super("m:lim");for(let U of B)this.root.push(U)}},aZ=class extends t{constructor(B){super("m:limUpp");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},pZ=class extends t{constructor(B){super("m:limLow");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},p4=()=>new M0({name:"m:sSupPr"}),rZ=class extends t{constructor(B){super("m:sSup");this.root.push(p4()),this.root.push(y0({children:B.children})),this.root.push(a2({children:B.superScript}))}},r4=()=>new M0({name:"m:sSubPr"}),iZ=class extends t{constructor(B){super("m:sSub");this.root.push(r4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript}))}},i4=()=>new M0({name:"m:sSubSupPr"}),nZ=class extends t{constructor(B){super("m:sSubSup");this.root.push(i4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript})),this.root.push(a2({children:B.superScript}))}},n4=()=>new M0({name:"m:sPrePr"}),sZ=class extends M0{constructor({children:B,subScript:U,superScript:G}){super({name:"m:sPre",children:[n4(),y0({children:B}),l2({children:U}),a2({children:G})]})}},oZ="",s4=class extends t{constructor(B){super("m:deg");if(B)for(let U of B)this.root.push(U)}},tZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{hide:"m:val"})}},eZ=class extends t{constructor(){super("m:degHide");this.root.push(new tZ({hide:1}))}},o4=class extends t{constructor(B){super("m:radPr");if(!B)this.root.push(new eZ)}},BQ=class extends t{constructor(B){super("m:rad");this.root.push(new o4(!!B.degree)),this.root.push(new s4(B.degree)),this.root.push(y0({children:B.children}))}},t4=class extends t{constructor(B){super("m:fName");for(let U of B)this.root.push(U)}},e4=class extends t{constructor(){super("m:funcPr")}},UQ=class extends t{constructor(B){super("m:func");this.root.push(new e4),this.root.push(new t4(B.name)),this.root.push(y0({children:B.children}))}},GQ=({character:B})=>new M0({name:"m:begChr",attributes:{character:{key:"m:val",value:B}}}),YQ=({character:B})=>new M0({name:"m:endChr",attributes:{character:{key:"m:val",value:B}}}),l1=({characters:B})=>new M0({name:"m:dPr",children:B?[GQ({character:B.beginningCharacter}),YQ({character:B.endingCharacter})]:[]}),ZQ=class extends t{constructor(B){super("m:d");this.root.push(l1({})),this.root.push(y0({children:B.children}))}},QQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"[",endingCharacter:"]"}})),this.root.push(y0({children:B.children}))}},JQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"{",endingCharacter:"}"}})),this.root.push(y0({children:B.children}))}},KQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"〈",endingCharacter:"〉"}})),this.root.push(y0({children:B.children}))}},VQ=(B)=>new M0({name:"w:gridCol",attributes:B!==void 0?{width:{key:"w:w",value:E0(B)}}:void 0}),B9=class extends t{constructor(B,U){super("w:tblGrid");for(let G of B)this.root.push(VQ(G));if(U)this.root.push(new qQ(U))}},XQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},qQ=class extends t{constructor(B){super("w:tblGridChange");this.root.push(new XQ({id:B.id})),this.root.push(new B9(B.columnWidths))}},MQ=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new Q1(B))}},RQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},LQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},IQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},p6=class extends t{constructor(B){super("w:delText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B)}},OQ=class extends t{constructor(B){super("w:del");e(this,"deletedTextRunWrapper",void 0),this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.deletedTextRunWrapper=new HQ(B),this.addChildElement(this.deletedTextRunWrapper)}},HQ=class extends t{constructor(B){super("w:r");if(this.root.push(new U2(B)),B.children)for(let U of B.children){if(typeof U==="string"){switch(U){case F2.CURRENT:this.root.push(e0()),this.root.push(new RQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES:this.root.push(e0()),this.root.push(new LQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES_IN_SECTION:this.root.push(e0()),this.root.push(new IQ),this.root.push(X2()),this.root.push(B2());break;default:this.root.push(new p6(U));break}continue}this.root.push(U)}else if(B.text)this.root.push(new p6(B.text));if(B.break)for(let U=0;Unew M0({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:B}}}),X9=({marginUnitType:B=v1.DXA,top:U,left:G,bottom:Y,right:Q})=>[{name:"w:top",size:U},{name:"w:left",size:G},{name:"w:bottom",size:Y},{name:"w:right",size:Q}].filter((K)=>K.size!==void 0).map(({name:K,size:Z})=>J1(K,{type:B,size:Z})),PQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tblCellMar",children:U})},AQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tcMar",children:U})},v1={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},J1=(B,{type:U=v1.AUTO,size:G})=>{let Y=G;if(U===v1.PERCENTAGE&&typeof G==="number")Y=`${G}%`;return new M0({name:B,attributes:{type:{key:"w:type",value:U},size:{key:"w:w",value:c8(Y)}}})},q9=class extends R2{constructor(B){super("w:tcBorders");if(B.top)this.root.push(j0("w:top",B.top));if(B.start)this.root.push(j0("w:start",B.start));if(B.left)this.root.push(j0("w:left",B.left));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.end)this.root.push(j0("w:end",B.end));if(B.right)this.root.push(j0("w:right",B.right))}},jQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},M9=class extends t{constructor(B){super("w:gridSpan");this.root.push(new jQ({val:T0(B)}))}},G6={CONTINUE:"continue",RESTART:"restart"},NQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},w8=class extends t{constructor(B){super("w:vMerge");this.root.push(new NQ({val:B}))}},zQ={BOTTOM_TO_TOP_LEFT_TO_RIGHT:"btLr",LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},wQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},R9=class extends t{constructor(B){super("w:textDirection");this.root.push(new wQ({val:B}))}},L9=class extends R2{constructor(B){super("w:tcPr",B.includeIfEmpty);if(B.width)this.root.push(J1("w:tcW",B.width));if(B.columnSpan)this.root.push(new M9(B.columnSpan));if(B.verticalMerge)this.root.push(new w8(B.verticalMerge));else if(B.rowSpan&&B.rowSpan>1)this.root.push(new w8(G6.RESTART));if(B.borders)this.root.push(new q9(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.margins){let U=AQ(B.margins);if(U)this.root.push(U)}if(B.textDirection)this.root.push(new R9(B.textDirection));if(B.verticalAlign)this.root.push(U6(B.verticalAlign));if(B.insertion)this.root.push(new Y9(B.insertion));if(B.deletion)this.root.push(new Z9(B.deletion));if(B.revision)this.root.push(new EQ(B.revision));if(B.cellMerge)this.root.push(new J9(B.cellMerge))}},EQ=class extends t{constructor(B){super("w:tcPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new L9(L0(L0({},B),{},{includeIfEmpty:!0})))}},Y6=class extends t{constructor(B){super("w:tc");e(this,"options",void 0),this.options=B,this.root.push(new L9(B));for(let U of B.children)this.root.push(U)}prepForXml(B){if(!(this.root[this.root.length-1]instanceof d0))this.root.push(new d0({}));return super.prepForXml(B)}},v2={style:c1.NONE,size:0,color:"auto"},y2={style:c1.SINGLE,size:4,color:"auto"},Z6=class extends t{constructor(B){var U,G,Y,Q,K,Z;super("w:tblBorders");this.root.push(j0("w:top",(U=B.top)!==null&&U!==void 0?U:y2)),this.root.push(j0("w:left",(G=B.left)!==null&&G!==void 0?G:y2)),this.root.push(j0("w:bottom",(Y=B.bottom)!==null&&Y!==void 0?Y:y2)),this.root.push(j0("w:right",(Q=B.right)!==null&&Q!==void 0?Q:y2)),this.root.push(j0("w:insideH",(K=B.insideHorizontal)!==null&&K!==void 0?K:y2)),this.root.push(j0("w:insideV",(Z=B.insideVertical)!==null&&Z!==void 0?Z:y2))}};e(Z6,"NONE",{top:v2,bottom:v2,left:v2,right:v2,insideHorizontal:v2,insideVertical:v2});var DQ={MARGIN:"margin",PAGE:"page",TEXT:"text"},TQ={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},CQ={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},kQ={NEVER:"never",OVERLAP:"overlap"},$Q=(B)=>new M0({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:B}}}),I9=({horizontalAnchor:B,verticalAnchor:U,absoluteHorizontalPosition:G,relativeHorizontalPosition:Y,absoluteVerticalPosition:Q,relativeVerticalPosition:K,bottomFromText:Z,topFromText:J,leftFromText:q,rightFromText:W,overlap:I})=>new M0({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:q===void 0?void 0:E0(q)},rightFromText:{key:"w:rightFromText",value:W===void 0?void 0:E0(W)},topFromText:{key:"w:topFromText",value:J===void 0?void 0:E0(J)},bottomFromText:{key:"w:bottomFromText",value:Z===void 0?void 0:E0(Z)},absoluteHorizontalPosition:{key:"w:tblpX",value:G===void 0?void 0:t0(G)},absoluteVerticalPosition:{key:"w:tblpY",value:Q===void 0?void 0:t0(Q)},horizontalAnchor:{key:"w:horzAnchor",value:B},relativeHorizontalPosition:{key:"w:tblpXSpec",value:Y},relativeVerticalPosition:{key:"w:tblpYSpec",value:K},verticalAnchor:{key:"w:vertAnchor",value:U}},children:I?[$Q(I)]:void 0}),SQ={AUTOFIT:"autofit",FIXED:"fixed"},O9=(B)=>new M0({name:"w:tblLayout",attributes:{type:{key:"w:type",value:B}}}),bQ={DXA:"dxa",NIL:"nil"},H9=({type:B=bQ.DXA,value:U})=>new M0({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:B},value:{key:"w:w",value:c8(U)}}}),F9=({firstRow:B,lastRow:U,firstColumn:G,lastColumn:Y,noHBand:Q,noVBand:K})=>new M0({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:B},lastRow:{key:"w:lastRow",value:U},firstColumn:{key:"w:firstColumn",value:G},lastColumn:{key:"w:lastColumn",value:Y},noHBand:{key:"w:noHBand",value:Q},noVBand:{key:"w:noVBand",value:K}}}),Q6=class extends R2{constructor(B){super("w:tblPr",B.includeIfEmpty);if(B.style)this.root.push(new q2("w:tblStyle",B.style));if(B.float)this.root.push(I9(B.float));if(B.visuallyRightToLeft!==void 0)this.root.push(new q0("w:bidiVisual",B.visuallyRightToLeft));if(B.width)this.root.push(J1("w:tblW",B.width));if(B.alignment)this.root.push(m8(B.alignment));if(B.indent)this.root.push(J1("w:tblInd",B.indent));if(B.borders)this.root.push(new Z6(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.layout)this.root.push(O9(B.layout));if(B.cellMargin){let U=PQ(B.cellMargin);if(U)this.root.push(U)}if(B.tableLook)this.root.push(F9(B.tableLook));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.revision)this.root.push(new vQ(B.revision))}},vQ=class extends t{constructor(B){super("w:tblPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new Q6(L0(L0({},B),{},{includeIfEmpty:!0})))}},yQ=class extends H1{constructor({rows:B,width:U,columnWidths:G=Array(Math.max(...B.map((j)=>j.CellCount))).fill(100),columnWidthsRevision:Y,margins:Q,indent:K,float:Z,layout:J,style:q,borders:W,alignment:I,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P}){super("w:tbl");this.root.push(new Q6({borders:W!==null&&W!==void 0?W:{},width:U!==null&&U!==void 0?U:{size:100},indent:K,float:Z,layout:J,style:q,alignment:I,cellMargin:Q,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P})),this.root.push(new B9(G,Y));for(let j of B)this.root.push(j);B.forEach((j,E)=>{if(E===B.length-1)return;let C=0;j.cells.forEach((N)=>{if(N.options.rowSpan&&N.options.rowSpan>1){let v=new Y6({rowSpan:N.options.rowSpan-1,columnSpan:N.options.columnSpan,borders:N.options.borders,children:[],verticalMerge:G6.CONTINUE});B[E+1].addCellToColumnIndex(v,C)}C+=N.options.columnSpan||1})})}},gQ={AUTO:"auto",ATLEAST:"atLeast",EXACT:"exact"},W9=(B,U)=>new M0({name:"w:trHeight",attributes:{value:{key:"w:val",value:E0(B)},rule:{key:"w:hRule",value:U}}}),J6=class extends R2{constructor(B){super("w:trPr",B.includeIfEmpty);if(B.cantSplit!==void 0)this.root.push(new q0("w:cantSplit",B.cantSplit));if(B.tableHeader!==void 0)this.root.push(new q0("w:tblHeader",B.tableHeader));if(B.height)this.root.push(W9(B.height.value,B.height.rule));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.insertion)this.root.push(new U9(B.insertion));if(B.deletion)this.root.push(new G9(B.deletion));if(B.revision)this.root.push(new P9(B.revision))}},P9=class extends t{constructor(B){super("w:trPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new J6(L0(L0({},B),{},{includeIfEmpty:!0})))}},fQ=class extends t{constructor(B){super("w:tr");e(this,"options",void 0),this.options=B,this.root.push(new J6(B));for(let U of B.children)this.root.push(U)}get CellCount(){return this.options.children.length}get cells(){return this.root.filter((B)=>B instanceof Y6)}addCellToIndex(B,U){this.root.splice(U+1,0,B)}addCellToColumnIndex(B,U){let G=this.columnIndexToRootIndex(U,!0);this.addCellToIndex(B,G-1)}rootIndexToColumnIndex(B){if(B<1||B>=this.root.length)throw Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let U=0;for(let G=1;G=this.root.length)if(U)return this.root.length;else throw Error(`cell 'columnIndex' should not great than ${G-1}`);let Q=this.root[Y];Y+=1,G+=Q&&Q.options.columnSpan||1}return Y-1}},xQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},_Q=class extends t{constructor(){super("Properties");this.root.push(new xQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},hQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},V2=(B,U)=>new M0({name:"Default",attributes:{contentType:{key:"ContentType",value:B},extension:{key:"Extension",value:U}}}),f0=(B,U)=>new M0({name:"Override",attributes:{contentType:{key:"ContentType",value:B},partName:{key:"PartName",value:U}}}),uQ=class extends t{constructor(){super("Types");this.root.push(new hQ({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(V2("image/png","png")),this.root.push(V2("image/jpeg","jpeg")),this.root.push(V2("image/jpeg","jpg")),this.root.push(V2("image/bmp","bmp")),this.root.push(V2("image/gif","gif")),this.root.push(V2("image/svg+xml","svg")),this.root.push(V2("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(V2("application/xml","xml")),this.root.push(V2("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(f0("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addCommentsExtended(){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addFooter(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${B}.xml`))}addHeader(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${B}.xml`))}},y1={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},F1=class extends H0{constructor(B,U){super(L0({Ignorable:U},Object.fromEntries(B.map((G)=>[G,y1[G]]))));e(this,"xmlKeys",L0({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(y1).map((G)=>[G,`xmlns:${G}`]))))}},dQ=class extends t{constructor(B){super("cp:coreProperties");if(this.root.push(new F1(["cp","dc","dcterms","dcmitype","xsi"])),B.title)this.root.push(new O2("dc:title",B.title));if(B.subject)this.root.push(new O2("dc:subject",B.subject));if(B.creator)this.root.push(new O2("dc:creator",B.creator));if(B.keywords)this.root.push(new O2("cp:keywords",B.keywords));if(B.description)this.root.push(new O2("dc:description",B.description));if(B.lastModifiedBy)this.root.push(new O2("cp:lastModifiedBy",B.lastModifiedBy));if(B.revision)this.root.push(new O2("cp:revision",String(B.revision)));this.root.push(new r6("dcterms:created")),this.root.push(new r6("dcterms:modified"))}},cQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"xsi:type"})}},r6=class extends t{constructor(B){super(B);this.root.push(new cQ({type:"dcterms:W3CDTF"})),this.root.push(fB(new Date))}},mQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},lQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},aQ=class extends t{constructor(B,U){super("property");this.root.push(new lQ({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:B.toString(),name:U.name})),this.root.push(new pQ(U.value))}},pQ=class extends t{constructor(B){super("vt:lpwstr");this.root.push(B)}},rQ=class extends t{constructor(B){super("Properties");e(this,"nextId",void 0),e(this,"properties",[]),this.root.push(new mQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let U of B)this.addCustomProperty(U)}prepForXml(B){return this.properties.forEach((U)=>this.root.push(U)),super.prepForXml(B)}addCustomProperty(B){this.properties.push(new aQ(this.nextId++,B))}},A9=({space:B,count:U,separate:G,equalWidth:Y,children:Q})=>new M0({name:"w:cols",attributes:{space:{key:"w:space",value:B===void 0?void 0:E0(B)},count:{key:"w:num",value:U===void 0?void 0:T0(U)},separate:{key:"w:sep",value:G},equalWidth:{key:"w:equalWidth",value:Y}},children:!Y&&Q?Q:void 0}),iQ={DEFAULT:"default",LINES:"lines",LINES_AND_CHARS:"linesAndChars",SNAP_TO_CHARS:"snapToChars"},j9=({type:B,linePitch:U,charSpace:G})=>new M0({name:"w:docGrid",attributes:{type:{key:"w:type",value:B},linePitch:{key:"w:linePitch",value:T0(U)},charSpace:{key:"w:charSpace",value:G?T0(G):void 0}}}),T2={DEFAULT:"default",FIRST:"first",EVEN:"even"},E8={HEADER:"w:headerReference",FOOTER:"w:footerReference"},k1=(B,U)=>new M0({name:B,attributes:{type:{key:"w:type",value:U.type||T2.DEFAULT},id:{key:"r:id",value:`rId${U.id}`}}}),nQ={NEW_PAGE:"newPage",NEW_SECTION:"newSection",CONTINUOUS:"continuous"},N9=({countBy:B,start:U,restart:G,distance:Y})=>new M0({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:B===void 0?void 0:T0(B)},start:{key:"w:start",value:U===void 0?void 0:T0(U)},restart:{key:"w:restart",value:G},distance:{key:"w:distance",value:Y===void 0?void 0:E0(Y)}}}),sQ={ALL_PAGES:"allPages",FIRST_PAGE:"firstPage",NOT_FIRST_PAGE:"notFirstPage"},oQ={PAGE:"page",TEXT:"text"},tQ={BACK:"back",FRONT:"front"},i6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},z9=class extends R2{constructor(B){super("w:pgBorders");if(!B)return this;if(B.pageBorders)this.root.push(new i6({display:B.pageBorders.display,offsetFrom:B.pageBorders.offsetFrom,zOrder:B.pageBorders.zOrder}));else this.root.push(new i6({}));if(B.pageBorderTop)this.root.push(j0("w:top",B.pageBorderTop));if(B.pageBorderLeft)this.root.push(j0("w:left",B.pageBorderLeft));if(B.pageBorderBottom)this.root.push(j0("w:bottom",B.pageBorderBottom));if(B.pageBorderRight)this.root.push(j0("w:right",B.pageBorderRight))}},w9=(B,U,G,Y,Q,K,Z)=>new M0({name:"w:pgMar",attributes:{top:{key:"w:top",value:t0(B)},right:{key:"w:right",value:E0(U)},bottom:{key:"w:bottom",value:t0(G)},left:{key:"w:left",value:E0(Y)},header:{key:"w:header",value:E0(Q)},footer:{key:"w:footer",value:E0(K)},gutter:{key:"w:gutter",value:E0(Z)}}}),eQ={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},E9=({start:B,formatType:U,separator:G})=>new M0({name:"w:pgNumType",attributes:{start:{key:"w:start",value:B===void 0?void 0:T0(B)},formatType:{key:"w:fmt",value:U},separator:{key:"w:chapSep",value:G}}}),g1={PORTRAIT:"portrait",LANDSCAPE:"landscape"},D9=({width:B,height:U,orientation:G,code:Y})=>{let Q=E0(B),K=E0(U);return new M0({name:"w:pgSz",attributes:{width:{key:"w:w",value:G===g1.LANDSCAPE?K:Q},height:{key:"w:h",value:G===g1.LANDSCAPE?Q:K},orientation:{key:"w:orient",value:G},code:{key:"w:code",value:Y}}})},BJ={LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},UJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},T9=class extends t{constructor(B){super("w:textDirection");this.root.push(new UJ({val:B}))}},GJ={NEXT_PAGE:"nextPage",NEXT_COLUMN:"nextColumn",CONTINUOUS:"continuous",EVEN_PAGE:"evenPage",ODD_PAGE:"oddPage"},C9=(B)=>new M0({name:"w:type",attributes:{val:{key:"w:val",value:B}}}),H2={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},$1={WIDTH:11906,HEIGHT:16838,ORIENTATION:g1.PORTRAIT},K6=class extends t{constructor({page:{size:{width:B=$1.WIDTH,height:U=$1.HEIGHT,orientation:G=$1.ORIENTATION,code:Y}={},margin:{top:Q=H2.TOP,right:K=H2.RIGHT,bottom:Z=H2.BOTTOM,left:J=H2.LEFT,header:q=H2.HEADER,footer:W=H2.FOOTER,gutter:I=H2.GUTTER}={},pageNumbers:H={},borders:T,textDirection:A}={},grid:{linePitch:P=360,charSpace:j,type:E}={},headerWrapperGroup:C={},footerWrapperGroup:N={},lineNumbers:v,titlePage:S,verticalAlign:F,column:M,type:$,revision:x}={}){super("w:sectPr");if(this.addHeaderFooterGroup(E8.HEADER,C),this.addHeaderFooterGroup(E8.FOOTER,N),$)this.root.push(C9($));if(this.root.push(D9({width:B,height:U,orientation:G,code:Y})),this.root.push(w9(Q,K,Z,J,q,W,I)),T)this.root.push(new z9(T));if(v)this.root.push(N9(v));if(this.root.push(E9(H)),M)this.root.push(A9(M));if(F)this.root.push(U6(F));if(S!==void 0)this.root.push(new q0("w:titlePg",S));if(A)this.root.push(new T9(A));if(x)this.root.push(new k9(x));this.root.push(j9({linePitch:P,charSpace:j,type:E}))}addHeaderFooterGroup(B,U){if(U.default)this.root.push(k1(B,{type:T2.DEFAULT,id:U.default.View.ReferenceId}));if(U.first)this.root.push(k1(B,{type:T2.FIRST,id:U.first.View.ReferenceId}));if(U.even)this.root.push(k1(B,{type:T2.EVEN,id:U.even.View.ReferenceId}))}},k9=class extends t{constructor(B){super("w:sectPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new K6(B))}},YJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{width:"w:w",space:"w:space"})}},ZJ=class extends t{constructor(B){super("w:col");this.root.push(new YJ({width:E0(B.width),space:B.space===void 0?void 0:E0(B.space)}))}},$9=class extends t{constructor(){super("w:body");e(this,"sections",[])}addSection(B){let U=this.sections.pop();this.root.push(this.createSectionParagraph(U)),this.sections.push(new K6(B))}prepForXml(B){if(this.sections.length===1)this.root.splice(0,1),this.root.push(this.sections.pop());return super.prepForXml(B)}push(B){this.root.push(B)}createSectionParagraph(B){let U=new d0({}),G=new M2({});return G.push(B),U.addChildElement(G),U}},S9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}},b9=class extends t{constructor(B){super("w:background");this.root.push(new S9({color:B.color===void 0?void 0:C2(B.color),themeColor:B.themeColor,themeShade:B.themeShade===void 0?void 0:W8(B.themeShade),themeTint:B.themeTint===void 0?void 0:W8(B.themeTint)}))}},QJ=class extends t{constructor(B){super("w:document");if(e(this,"body",void 0),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new $9,B.background)this.root.push(new b9(B.background));this.root.push(this.body)}add(B){return this.body.push(B),this}get Body(){return this.body}},JJ=class{constructor(B){e(this,"document",void 0),e(this,"relationships",void 0),this.document=new QJ(B),this.relationships=new A2}get View(){return this.document}get Relationships(){return this.relationships}},KJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},VJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",id:"w:id"})}},XJ=class extends D0{constructor(){super({style:"EndnoteReference"});this.root.push(new D4)}},n6={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},X8=class extends t{constructor(B){super("w:endnote");this.root.push(new VJ({type:B.type,id:B.id}));for(let U=0;U9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new zJ({ilvl:T0(B),tentative:1}))}},h9=class extends X6{},$J=class extends X6{},SJ=class extends t{constructor(B){super("w:multiLevelType");this.root.push(new C0({val:B}))}},bJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},D8=class extends t{constructor(B,U){super("w:abstractNum");e(this,"id",void 0),this.root.push(new bJ({abstractNumId:T0(B),restartNumberingAfterBreak:0})),this.root.push(new SJ("hybridMultilevel")),this.id=B;for(let G of U)this.root.push(new h9(G))}},vJ=class extends t{constructor(B){super("w:abstractNumId");this.root.push(new C0({val:B}))}},yJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{numId:"w:numId"})}},T8=class extends t{constructor(B){super("w:num");if(e(this,"numId",void 0),e(this,"reference",void 0),e(this,"instance",void 0),this.numId=B.numId,this.reference=B.reference,this.instance=B.instance,this.root.push(new yJ({numId:T0(B.numId)})),this.root.push(new vJ(T0(B.abstractNumId))),B.overrideLevels&&B.overrideLevels.length)for(let U of B.overrideLevels)this.root.push(new u9(U.num,U.start))}},gJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{ilvl:"w:ilvl"})}},u9=class extends t{constructor(B,U){super("w:lvlOverride");if(this.root.push(new gJ({ilvl:B})),U!==void 0)this.root.push(new xJ(U))}},fJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},xJ=class extends t{constructor(B){super("w:startOverride");this.root.push(new fJ({val:B}))}},d9=class extends t{constructor(B){super("w:numbering");e(this,"abstractNumberingMap",new Map),e(this,"concreteNumberingMap",new Map),e(this,"referenceConfigMap",new Map),e(this,"abstractNumUniqueNumericId",nB()),e(this,"concreteNumUniqueNumericId",sB()),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let U=new D8(this.abstractNumUniqueNumericId(),[{level:0,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(0.5),hanging:u0(0.25)}}}},{level:1,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(1),hanging:u0(0.25)}}}},{level:2,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:2160,hanging:u0(0.25)}}}},{level:3,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:2880,hanging:u0(0.25)}}}},{level:4,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:3600,hanging:u0(0.25)}}}},{level:5,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:4320,hanging:u0(0.25)}}}},{level:6,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5040,hanging:u0(0.25)}}}},{level:7,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5760,hanging:u0(0.25)}}}},{level:8,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:6480,hanging:u0(0.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new T8({numId:1,abstractNumId:U.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",U);for(let G of B.config)this.abstractNumberingMap.set(G.reference,new D8(this.abstractNumUniqueNumericId(),G.levels)),this.referenceConfigMap.set(G.reference,G.levels)}prepForXml(B){for(let U of this.abstractNumberingMap.values())this.root.push(U);for(let U of this.concreteNumberingMap.values())this.root.push(U);return super.prepForXml(B)}createConcreteNumberingInstance(B,U){let G=this.abstractNumberingMap.get(B);if(!G)return;let Y=`${B}-${U}`;if(this.concreteNumberingMap.has(Y))return;let Q=this.referenceConfigMap.get(B),K=Q&&Q[0].start,Z={numId:this.concreteNumUniqueNumericId(),abstractNumId:G.id,reference:B,instance:U,overrideLevels:[typeof K==="number"&&Number.isInteger(K)?{num:0,start:K}:{num:0,start:1}]};this.concreteNumberingMap.set(Y,new T8(Z))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},_J=(B)=>new M0({name:"w:compatSetting",attributes:{version:{key:"w:val",value:B},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),hJ=class extends t{constructor(B){super("w:compat");if(B.version)this.root.push(_J(B.version));if(B.useSingleBorderforContiguousCells)this.root.push(new q0("w:useSingleBorderforContiguousCells",B.useSingleBorderforContiguousCells));if(B.wordPerfectJustification)this.root.push(new q0("w:wpJustification",B.wordPerfectJustification));if(B.noTabStopForHangingIndent)this.root.push(new q0("w:noTabHangInd",B.noTabStopForHangingIndent));if(B.noLeading)this.root.push(new q0("w:noLeading",B.noLeading));if(B.spaceForUnderline)this.root.push(new q0("w:spaceForUL",B.spaceForUnderline));if(B.noColumnBalance)this.root.push(new q0("w:noColumnBalance",B.noColumnBalance));if(B.balanceSingleByteDoubleByteWidth)this.root.push(new q0("w:balanceSingleByteDoubleByteWidth",B.balanceSingleByteDoubleByteWidth));if(B.noExtraLineSpacing)this.root.push(new q0("w:noExtraLineSpacing",B.noExtraLineSpacing));if(B.doNotLeaveBackslashAlone)this.root.push(new q0("w:doNotLeaveBackslashAlone",B.doNotLeaveBackslashAlone));if(B.underlineTrailingSpaces)this.root.push(new q0("w:ulTrailSpace",B.underlineTrailingSpaces));if(B.doNotExpandShiftReturn)this.root.push(new q0("w:doNotExpandShiftReturn",B.doNotExpandShiftReturn));if(B.spacingInWholePoints)this.root.push(new q0("w:spacingInWholePoints",B.spacingInWholePoints));if(B.lineWrapLikeWord6)this.root.push(new q0("w:lineWrapLikeWord6",B.lineWrapLikeWord6));if(B.printBodyTextBeforeHeader)this.root.push(new q0("w:printBodyTextBeforeHeader",B.printBodyTextBeforeHeader));if(B.printColorsBlack)this.root.push(new q0("w:printColBlack",B.printColorsBlack));if(B.spaceWidth)this.root.push(new q0("w:wpSpaceWidth",B.spaceWidth));if(B.showBreaksInFrames)this.root.push(new q0("w:showBreaksInFrames",B.showBreaksInFrames));if(B.subFontBySize)this.root.push(new q0("w:subFontBySize",B.subFontBySize));if(B.suppressBottomSpacing)this.root.push(new q0("w:suppressBottomSpacing",B.suppressBottomSpacing));if(B.suppressTopSpacing)this.root.push(new q0("w:suppressTopSpacing",B.suppressTopSpacing));if(B.suppressSpacingAtTopOfPage)this.root.push(new q0("w:suppressSpacingAtTopOfPage",B.suppressSpacingAtTopOfPage));if(B.suppressTopSpacingWP)this.root.push(new q0("w:suppressTopSpacingWP",B.suppressTopSpacingWP));if(B.suppressSpBfAfterPgBrk)this.root.push(new q0("w:suppressSpBfAfterPgBrk",B.suppressSpBfAfterPgBrk));if(B.swapBordersFacingPages)this.root.push(new q0("w:swapBordersFacingPages",B.swapBordersFacingPages));if(B.convertMailMergeEsc)this.root.push(new q0("w:convMailMergeEsc",B.convertMailMergeEsc));if(B.truncateFontHeightsLikeWP6)this.root.push(new q0("w:truncateFontHeightsLikeWP6",B.truncateFontHeightsLikeWP6));if(B.macWordSmallCaps)this.root.push(new q0("w:mwSmallCaps",B.macWordSmallCaps));if(B.usePrinterMetrics)this.root.push(new q0("w:usePrinterMetrics",B.usePrinterMetrics));if(B.doNotSuppressParagraphBorders)this.root.push(new q0("w:doNotSuppressParagraphBorders",B.doNotSuppressParagraphBorders));if(B.wrapTrailSpaces)this.root.push(new q0("w:wrapTrailSpaces",B.wrapTrailSpaces));if(B.footnoteLayoutLikeWW8)this.root.push(new q0("w:footnoteLayoutLikeWW8",B.footnoteLayoutLikeWW8));if(B.shapeLayoutLikeWW8)this.root.push(new q0("w:shapeLayoutLikeWW8",B.shapeLayoutLikeWW8));if(B.alignTablesRowByRow)this.root.push(new q0("w:alignTablesRowByRow",B.alignTablesRowByRow));if(B.forgetLastTabAlignment)this.root.push(new q0("w:forgetLastTabAlignment",B.forgetLastTabAlignment));if(B.adjustLineHeightInTable)this.root.push(new q0("w:adjustLineHeightInTable",B.adjustLineHeightInTable));if(B.autoSpaceLikeWord95)this.root.push(new q0("w:autoSpaceLikeWord95",B.autoSpaceLikeWord95));if(B.noSpaceRaiseLower)this.root.push(new q0("w:noSpaceRaiseLower",B.noSpaceRaiseLower));if(B.doNotUseHTMLParagraphAutoSpacing)this.root.push(new q0("w:doNotUseHTMLParagraphAutoSpacing",B.doNotUseHTMLParagraphAutoSpacing));if(B.layoutRawTableWidth)this.root.push(new q0("w:layoutRawTableWidth",B.layoutRawTableWidth));if(B.layoutTableRowsApart)this.root.push(new q0("w:layoutTableRowsApart",B.layoutTableRowsApart));if(B.useWord97LineBreakRules)this.root.push(new q0("w:useWord97LineBreakRules",B.useWord97LineBreakRules));if(B.doNotBreakWrappedTables)this.root.push(new q0("w:doNotBreakWrappedTables",B.doNotBreakWrappedTables));if(B.doNotSnapToGridInCell)this.root.push(new q0("w:doNotSnapToGridInCell",B.doNotSnapToGridInCell));if(B.selectFieldWithFirstOrLastCharacter)this.root.push(new q0("w:selectFldWithFirstOrLastChar",B.selectFieldWithFirstOrLastCharacter));if(B.applyBreakingRules)this.root.push(new q0("w:applyBreakingRules",B.applyBreakingRules));if(B.doNotWrapTextWithPunctuation)this.root.push(new q0("w:doNotWrapTextWithPunct",B.doNotWrapTextWithPunctuation));if(B.doNotUseEastAsianBreakRules)this.root.push(new q0("w:doNotUseEastAsianBreakRules",B.doNotUseEastAsianBreakRules));if(B.useWord2002TableStyleRules)this.root.push(new q0("w:useWord2002TableStyleRules",B.useWord2002TableStyleRules));if(B.growAutofit)this.root.push(new q0("w:growAutofit",B.growAutofit));if(B.useFELayout)this.root.push(new q0("w:useFELayout",B.useFELayout));if(B.useNormalStyleForList)this.root.push(new q0("w:useNormalStyleForList",B.useNormalStyleForList));if(B.doNotUseIndentAsNumberingTabStop)this.root.push(new q0("w:doNotUseIndentAsNumberingTabStop",B.doNotUseIndentAsNumberingTabStop));if(B.useAlternateEastAsianLineBreakRules)this.root.push(new q0("w:useAltKinsokuLineBreakRules",B.useAlternateEastAsianLineBreakRules));if(B.allowSpaceOfSameStyleInTable)this.root.push(new q0("w:allowSpaceOfSameStyleInTable",B.allowSpaceOfSameStyleInTable));if(B.doNotSuppressIndentation)this.root.push(new q0("w:doNotSuppressIndentation",B.doNotSuppressIndentation));if(B.doNotAutofitConstrainedTables)this.root.push(new q0("w:doNotAutofitConstrainedTables",B.doNotAutofitConstrainedTables));if(B.autofitToFirstFixedWidthCell)this.root.push(new q0("w:autofitToFirstFixedWidthCell",B.autofitToFirstFixedWidthCell));if(B.underlineTabInNumberingList)this.root.push(new q0("w:underlineTabInNumList",B.underlineTabInNumberingList));if(B.displayHangulFixedWidth)this.root.push(new q0("w:displayHangulFixedWidth",B.displayHangulFixedWidth));if(B.splitPgBreakAndParaMark)this.root.push(new q0("w:splitPgBreakAndParaMark",B.splitPgBreakAndParaMark));if(B.doNotVerticallyAlignCellWithSp)this.root.push(new q0("w:doNotVertAlignCellWithSp",B.doNotVerticallyAlignCellWithSp));if(B.doNotBreakConstrainedForcedTable)this.root.push(new q0("w:doNotBreakConstrainedForcedTable",B.doNotBreakConstrainedForcedTable));if(B.ignoreVerticalAlignmentInTextboxes)this.root.push(new q0("w:doNotVertAlignInTxbx",B.ignoreVerticalAlignmentInTextboxes));if(B.useAnsiKerningPairs)this.root.push(new q0("w:useAnsiKerningPairs",B.useAnsiKerningPairs));if(B.cachedColumnBalance)this.root.push(new q0("w:cachedColBalance",B.cachedColumnBalance))}},uJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},dJ=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w:settings");if(this.root.push(new uJ({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new q0("w:displayBackgroundShape",!0)),B.trackRevisions!==void 0)this.root.push(new q0("w:trackRevisions",B.trackRevisions));if(B.evenAndOddHeaders!==void 0)this.root.push(new q0("w:evenAndOddHeaders",B.evenAndOddHeaders));if(B.updateFields!==void 0)this.root.push(new q0("w:updateFields",B.updateFields));if(B.defaultTabStop!==void 0)this.root.push(new _2("w:defaultTabStop",B.defaultTabStop));if(((U=B.hyphenation)===null||U===void 0?void 0:U.autoHyphenation)!==void 0)this.root.push(new q0("w:autoHyphenation",B.hyphenation.autoHyphenation));if(((G=B.hyphenation)===null||G===void 0?void 0:G.hyphenationZone)!==void 0)this.root.push(new _2("w:hyphenationZone",B.hyphenation.hyphenationZone));if(((Y=B.hyphenation)===null||Y===void 0?void 0:Y.consecutiveHyphenLimit)!==void 0)this.root.push(new _2("w:consecutiveHyphenLimit",B.hyphenation.consecutiveHyphenLimit));if(((Q=B.hyphenation)===null||Q===void 0?void 0:Q.doNotHyphenateCaps)!==void 0)this.root.push(new q0("w:doNotHyphenateCaps",B.hyphenation.doNotHyphenateCaps));this.root.push(new hJ(L0(L0({},(K=B.compatibility)!==null&&K!==void 0?K:{}),{},{version:(Z=(J=(q=B.compatibility)===null||q===void 0?void 0:q.version)!==null&&J!==void 0?J:B.compatibilityModeVersion)!==null&&Z!==void 0?Z:15})))}},c9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},cJ=class extends t{constructor(B){super("w:name");this.root.push(new c9({val:B}))}},mJ=class extends t{constructor(B){super("w:uiPriority");this.root.push(new c9({val:T0(B)}))}},lJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},m9=class extends t{constructor(B,U){super("w:style");if(this.root.push(new lJ(B)),U.name)this.root.push(new cJ(U.name));if(U.basedOn)this.root.push(new q2("w:basedOn",U.basedOn));if(U.next)this.root.push(new q2("w:next",U.next));if(U.link)this.root.push(new q2("w:link",U.link));if(U.uiPriority!==void 0)this.root.push(new mJ(U.uiPriority));if(U.semiHidden!==void 0)this.root.push(new q0("w:semiHidden",U.semiHidden));if(U.unhideWhenUsed!==void 0)this.root.push(new q0("w:unhideWhenUsed",U.unhideWhenUsed));if(U.quickFormat!==void 0)this.root.push(new q0("w:qFormat",U.quickFormat))}},p2=class extends m9{constructor(B){super({type:"paragraph",styleId:B.id},B);e(this,"paragraphProperties",void 0),e(this,"runProperties",void 0),this.paragraphProperties=new M2(B.paragraph),this.runProperties=new U2(B.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},$2=class extends m9{constructor(B){super({type:"character",styleId:B.id},L0({uiPriority:99,unhideWhenUsed:!0},B));e(this,"runProperties",void 0),this.runProperties=new U2(B.run),this.root.push(this.runProperties)}},j2=class extends p2{constructor(B){super(L0({basedOn:"Normal",next:"Normal",quickFormat:!0},B))}},aJ=class extends j2{constructor(B){super(L0({id:"Title",name:"Title"},B))}},pJ=class extends j2{constructor(B){super(L0({id:"Heading1",name:"Heading 1"},B))}},rJ=class extends j2{constructor(B){super(L0({id:"Heading2",name:"Heading 2"},B))}},iJ=class extends j2{constructor(B){super(L0({id:"Heading3",name:"Heading 3"},B))}},nJ=class extends j2{constructor(B){super(L0({id:"Heading4",name:"Heading 4"},B))}},sJ=class extends j2{constructor(B){super(L0({id:"Heading5",name:"Heading 5"},B))}},oJ=class extends j2{constructor(B){super(L0({id:"Heading6",name:"Heading 6"},B))}},tJ=class extends j2{constructor(B){super(L0({id:"Strong",name:"Strong"},B))}},eJ=class extends p2{constructor(B){super(L0({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},B))}},BK=class extends p2{constructor(B){super(L0({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},UK=class extends $2{constructor(B){super(L0({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},GK=class extends $2{constructor(B){super(L0({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},B))}},YK=class extends p2{constructor(B){super(L0({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},ZK=class extends $2{constructor(B){super(L0({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},QK=class extends $2{constructor(B){super(L0({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},B))}},JK=class extends $2{constructor(B){super(L0({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:i8.SINGLE}}},B))}},S1=class extends t{constructor(B){super("w:styles");if(B.initialStyles)this.root.push(B.initialStyles);if(B.importedStyles)for(let U of B.importedStyles)this.root.push(U);if(B.paragraphStyles)for(let U of B.paragraphStyles)this.root.push(new p2(U));if(B.characterStyles)for(let U of B.characterStyles)this.root.push(new $2(U))}},l9=class extends t{constructor(B){super("w:pPrDefault");this.root.push(new M2(B))}},a9=class extends t{constructor(B){super("w:rPrDefault");this.root.push(new U2(B))}},p9=class extends t{constructor(B){super("w:docDefaults");e(this,"runPropertiesDefaults",void 0),e(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new a9(B.run),this.paragraphPropertiesDefaults=new l9(B.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},KK=class{newInstance(B){let U=(0,h1.xml2js)(B,{compact:!1}),G;for(let Q of U.elements||[])if(Q.name==="w:styles")G=Q;if(G===void 0)throw Error("can not find styles element");let Y=G.elements||[];return{initialStyles:new $B(G.attributes),importedStyles:Y.map((Q)=>u1(Q))}}},M8=class{newInstance(B={}){var U;return{initialStyles:new F1(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new p9((U=B.document)!==null&&U!==void 0?U:{}),new aJ(L0({run:{size:56}},B.title)),new pJ(L0({run:{color:"2E74B5",size:32}},B.heading1)),new rJ(L0({run:{color:"2E74B5",size:26}},B.heading2)),new iJ(L0({run:{color:"1F4D78",size:24}},B.heading3)),new nJ(L0({run:{color:"2E74B5",italics:!0}},B.heading4)),new sJ(L0({run:{color:"2E74B5"}},B.heading5)),new oJ(L0({run:{color:"1F4D78"}},B.heading6)),new tJ(L0({run:{bold:!0}},B.strong)),new eJ(B.listParagraph||{}),new JK(B.hyperlink||{}),new UK(B.footnoteReference||{}),new BK(B.footnoteText||{}),new GK(B.footnoteTextChar||{}),new ZK(B.endnoteReference||{}),new YK(B.endnoteText||{}),new QK(B.endnoteTextChar||{})]}}},VK=class{constructor(B){var U,G,Y,Q,K,Z,J,q,W,I,H,T;if(e(this,"currentRelationshipId",1),e(this,"documentWrapper",void 0),e(this,"headers",[]),e(this,"footers",[]),e(this,"coreProperties",void 0),e(this,"numbering",void 0),e(this,"media",void 0),e(this,"fileRelationships",void 0),e(this,"footnotesWrapper",void 0),e(this,"endnotesWrapper",void 0),e(this,"settings",void 0),e(this,"contentTypes",void 0),e(this,"customProperties",void 0),e(this,"appProperties",void 0),e(this,"styles",void 0),e(this,"comments",void 0),e(this,"commentsExtended",void 0),e(this,"fontWrapper",void 0),this.coreProperties=new dQ(L0(L0({},B),{},{creator:(U=B.creator)!==null&&U!==void 0?U:"Un-named",revision:(G=B.revision)!==null&&G!==void 0?G:1,lastModifiedBy:(Y=B.lastModifiedBy)!==null&&Y!==void 0?Y:"Un-named"})),this.numbering=new d9(B.numbering?B.numbering:{config:[]}),this.comments=new w4((Q=B.comments)!==null&&Q!==void 0?Q:{children:[]}),this.comments.ThreadData)this.commentsExtended=new E4(this.comments.ThreadData);if(this.fileRelationships=new A2,this.customProperties=new rQ((K=B.customProperties)!==null&&K!==void 0?K:[]),this.appProperties=new _Q,this.footnotesWrapper=new PJ,this.endnotesWrapper=new RJ,this.contentTypes=new uQ,this.documentWrapper=new JJ({background:B.background}),this.settings=new dJ({compatibilityModeVersion:B.compatabilityModeVersion,compatibility:B.compatibility,evenAndOddHeaders:B.evenAndOddHeaderAndFooters?!0:!1,trackRevisions:(Z=B.features)===null||Z===void 0?void 0:Z.trackRevisions,updateFields:(J=B.features)===null||J===void 0?void 0:J.updateFields,defaultTabStop:B.defaultTabStop,hyphenation:{autoHyphenation:(q=B.hyphenation)===null||q===void 0?void 0:q.autoHyphenation,hyphenationZone:(W=B.hyphenation)===null||W===void 0?void 0:W.hyphenationZone,consecutiveHyphenLimit:(I=B.hyphenation)===null||I===void 0?void 0:I.consecutiveHyphenLimit,doNotHyphenateCaps:(H=B.hyphenation)===null||H===void 0?void 0:H.doNotHyphenateCaps}}),this.media=new V6,B.externalStyles!==void 0){var A;let P=new M8().newInstance((A=B.styles)===null||A===void 0?void 0:A.default),j=new KK().newInstance(B.externalStyles);this.styles=new S1(L0(L0({},j),{},{importedStyles:[...P.importedStyles,...j.importedStyles]}))}else if(B.styles){let P=new M8().newInstance(B.styles.default);this.styles=new S1(L0(L0({},P),B.styles))}else{let P=new M8;this.styles=new S1(P.newInstance())}this.addDefaultRelationships();for(let P of B.sections)this.addSection(P);if(B.footnotes)for(let P in B.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(P),B.footnotes[P].children);if(B.endnotes)for(let P in B.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(P),B.endnotes[P].children);this.fontWrapper=new h4((T=B.fonts)!==null&&T!==void 0?T:[])}addSection({headers:B={},footers:U={},children:G,properties:Y}){this.documentWrapper.View.Body.addSection(L0(L0({},Y),{},{headerWrapperGroup:{default:B.default?this.createHeader(B.default):void 0,first:B.first?this.createHeader(B.first):void 0,even:B.even?this.createHeader(B.even):void 0},footerWrapperGroup:{default:U.default?this.createFooter(U.default):void 0,first:U.first?this.createFooter(U.first):void 0,even:U.even?this.createFooter(U.even):void 0}}));for(let Q of G)this.documentWrapper.View.add(Q)}createHeader(B){let U=new _9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addHeaderToDocument(U),U}createFooter(B){let U=new f9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addFooterToDocument(U),U}addHeaderToDocument(B,U=T2.DEFAULT){this.headers.push({header:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(B,U=T2.DEFAULT){this.footers.push({footer:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){if(this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.commentsExtended)this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map((B)=>B.header)}get Footers(){return this.footers.map((B)=>B.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get FontTable(){return this.fontWrapper}},XK=class extends t{constructor(B={}){super("w:instrText");e(this,"properties",void 0),this.properties=B,this.root.push(new _0({space:x0.PRESERVE}));let U="TOC";if(this.properties.captionLabel)U=`${U} \\a "${this.properties.captionLabel}"`;if(this.properties.entriesFromBookmark)U=`${U} \\b "${this.properties.entriesFromBookmark}"`;if(this.properties.captionLabelIncludingNumbers)U=`${U} \\c "${this.properties.captionLabelIncludingNumbers}"`;if(this.properties.sequenceAndPageNumbersSeparator)U=`${U} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`;if(this.properties.tcFieldIdentifier)U=`${U} \\f "${this.properties.tcFieldIdentifier}"`;if(this.properties.hyperlink)U=`${U} \\h`;if(this.properties.tcFieldLevelRange)U=`${U} \\l "${this.properties.tcFieldLevelRange}"`;if(this.properties.pageNumbersEntryLevelsRange)U=`${U} \\n "${this.properties.pageNumbersEntryLevelsRange}"`;if(this.properties.headingStyleRange)U=`${U} \\o "${this.properties.headingStyleRange}"`;if(this.properties.entryAndPageNumberSeparator)U=`${U} \\p "${this.properties.entryAndPageNumberSeparator}"`;if(this.properties.seqFieldIdentifierForPrefix)U=`${U} \\s "${this.properties.seqFieldIdentifierForPrefix}"`;if(this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let G=this.properties.stylesWithLevels.map((Y)=>`${Y.styleName},${Y.level}`).join(",");U=`${U} \\t "${G}"`}if(this.properties.useAppliedParagraphOutlineLevel)U=`${U} \\u`;if(this.properties.preserveTabInEntries)U=`${U} \\w`;if(this.properties.preserveNewLineInEntries)U=`${U} \\x`;if(this.properties.hideTabAndPageNumbersInWebView)U=`${U} \\z`;this.root.push(U)}},r9=class extends t{constructor(){super("w:sdtContent")}},i9=class extends t{constructor(B){super("w:sdtPr");if(B)this.root.push(new q2("w:alias",B))}};function qK(B,U){if(B==null)return{};var G={};for(var Y in B)if({}.hasOwnProperty.call(B,Y)){if(U.includes(Y))continue;G[Y]=B[Y]}return G}function n9(B,U){if(B==null)return{};var G,Y,Q=qK(B,U);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(B);for(Y=0;Y0){let{stylesWithLevels:W}=K,I=Y.map((T,A)=>{var P,j;let E=this.buildCachedContentParagraphChild(T,K),C=(P=W===null||W===void 0||(j=W.find((v)=>v.level===T.level))===null||j===void 0?void 0:j.styleName)!==null&&P!==void 0?P:`TOC${T.level}`,N=A===0?[...J,E]:A===Y.length-1?[E,...q]:[E];return new d0({style:C,tabStops:this.getTabStopsForLevel(T.level),children:N})}),H=I;if(Y.length<=1)H=[...I,new d0({children:q})];for(let T of H)Z.addChildElement(T)}else{let W=new d0({children:J});Z.addChildElement(W);for(let H of G)Z.addChildElement(H);let I=new d0({children:q});Z.addChildElement(I)}this.root.push(Z)}getTabStopsForLevel(B,U=9025){return[{type:"clear",position:U+1-(B-1)*240},{type:"right",position:U,leader:"dot"}]}buildCachedContentRun(B,U){var G,Y;return new D0({style:(U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0?"IndexLink":void 0,children:[new Z1({text:B.title}),new T4,new Z1({text:(G=(Y=B.page)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:""})]})}buildCachedContentParagraphChild(B,U){let G=this.buildCachedContentRun(B,U);if((U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0)return new y4({anchor:B.href,children:[G]});return G}},LK=class{constructor(B,U){e(this,"styleName",void 0),e(this,"level",void 0),this.styleName=B,this.level=U}},IK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},OK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},s9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},o9=class extends t{constructor(B){super("w:footnoteReference");this.root.push(new s9({id:B}))}},HK=class extends D0{constructor(B){super({style:"FootnoteReference"});this.root.push(new o9(B))}},t9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},e9=class extends t{constructor(B){super("w:endnoteReference");this.root.push(new t9({id:B}))}},FK=class extends D0{constructor(B){super({style:"EndnoteReference"});this.root.push(new e9(B))}},o6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w14:val",symbolfont:"w14:font"})}},b1=class extends t{constructor(B,U,G){super(B);if(G)this.root.push(new o6({val:SB(U),symbolfont:G}));else this.root.push(new o6({val:U}))}},B5=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w14:checkbox");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let W=(B===null||B===void 0?void 0:B.checked)?"1":"0",I,H;this.root.push(new b1("w14:checked",W)),I=(B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.value)?B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value:this.DEFAULT_CHECKED_SYMBOL,H=(B===null||B===void 0||(Y=B.checkedState)===null||Y===void 0?void 0:Y.font)?B===null||B===void 0||(Q=B.checkedState)===null||Q===void 0?void 0:Q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:checkedState",I,H)),I=(B===null||B===void 0||(K=B.uncheckedState)===null||K===void 0?void 0:K.value)?B===null||B===void 0||(Z=B.uncheckedState)===null||Z===void 0?void 0:Z.value:this.DEFAULT_UNCHECKED_SYMBOL,H=(B===null||B===void 0||(J=B.uncheckedState)===null||J===void 0?void 0:J.font)?B===null||B===void 0||(q=B.uncheckedState)===null||q===void 0?void 0:q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:uncheckedState",I,H))}},WK=class extends t{constructor(B){var U,G,Y,Q;super("w:sdt");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let K=new i9(B===null||B===void 0?void 0:B.alias);K.addChildElement(new B5(B)),this.root.push(K);let Z=new r9,J=B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.font,q=B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value,W=B===null||B===void 0||(Y=B.uncheckedState)===null||Y===void 0?void 0:Y.font,I=B===null||B===void 0||(Q=B.uncheckedState)===null||Q===void 0?void 0:Q.value,H,T;if(B===null||B===void 0?void 0:B.checked)H=J?J:this.DEFAULT_FONT,T=q?q:this.DEFAULT_CHECKED_SYMBOL;else H=W?W:this.DEFAULT_FONT,T=I?I:this.DEFAULT_UNCHECKED_SYMBOL;let A=new aB({char:T,symbolfont:H});Z.addChildElement(A),this.root.push(Z)}},PK=({shape:B})=>new M0({name:"w:pict",children:[B]}),AK=({children:B=[]})=>new M0({name:"w:txbxContent",children:B}),jK=({style:B,children:U,inset:G})=>new M0({name:"v:textbox",attributes:{style:{key:"style",value:B},insetMode:{key:"insetmode",value:G?"custom":"auto"},inset:{key:"inset",value:G?`${G.left}, ${G.top}, ${G.right}, ${G.bottom}`:void 0}},children:[AK({children:U})]}),NK="#_x0000_t202",zK={flip:"flip",height:"height",left:"left",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",positionHorizontal:"mso-position-horizontal",positionHorizontalRelative:"mso-position-horizontal-relative",positionVertical:"mso-position-vertical",positionVerticalRelative:"mso-position-vertical-relative",wrapDistanceBottom:"mso-wrap-distance-bottom",wrapDistanceLeft:"mso-wrap-distance-left",wrapDistanceRight:"mso-wrap-distance-right",wrapDistanceTop:"mso-wrap-distance-top",wrapEdited:"mso-wrap-edited",wrapStyle:"mso-wrap-style",position:"position",rotation:"rotation",top:"top",visibility:"visibility",width:"width",zIndex:"z-index"},wK=(B)=>B?Object.entries(B).map(([U,G])=>`${zK[U]}:${G}`).join(";"):void 0,EK=({id:B,children:U,type:G=NK,style:Y})=>new M0({name:"v:shape",attributes:{id:{key:"id",value:B},type:{key:"type",value:G},style:{key:"style",value:wK(Y)}},children:[jK({style:"mso-fit-shape-to-text:t;",children:U})]}),DK=["style","children"],TK=class extends H1{constructor(B){let{style:U,children:G}=B,Y=n9(B,DK);super("w:p");this.root.push(new M2(Y)),this.root.push(PK({shape:EK({children:G,id:O1(),style:U})}))}},CK=R0((B,U)=>{d2(),P2();/*! + `)+" "+o[1];return o[0]+n+" "+y.join(", ")+" "+o[1]}B.types=rU();function E(y){return Array.isArray(y)}B.isArray=E;function C(y){return typeof y==="boolean"}B.isBoolean=C;function N(y){return y===null}B.isNull=N;function v(y){return y==null}B.isNullOrUndefined=v;function S(y){return typeof y==="number"}B.isNumber=S;function F(y){return typeof y==="string"}B.isString=F;function M(y){return typeof y==="symbol"}B.isSymbol=M;function $(y){return y===void 0}B.isUndefined=$;function x(y){return w(y)&&D(y)==="[object RegExp]"}B.isRegExp=x,B.types.isRegExp=x;function w(y){return typeof y==="object"&&y!==null}B.isObject=w;function a(y){return w(y)&&D(y)==="[object Date]"}B.isDate=a,B.types.isDate=a;function U0(y){return w(y)&&(D(y)==="[object Error]"||y instanceof Error)}B.isError=U0,B.types.isNativeError=U0;function b(y){return typeof y==="function"}B.isFunction=b;function c(y){return y===null||typeof y==="boolean"||typeof y==="number"||typeof y==="string"||typeof y==="symbol"||typeof y>"u"}B.isPrimitive=c,B.isBuffer=iU();function D(y){return Object.prototype.toString.call(y)}function m(y){return y<10?"0"+y.toString(10):y.toString(10)}var B0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function i(){var y=new Date,n=[m(y.getHours()),m(y.getMinutes()),m(y.getSeconds())].join(":");return[y.getDate(),B0[y.getMonth()],n].join(" ")}B.log=function(){console.log("%s - %s",i(),B.format.apply(B,arguments))},B.inherits=W2(),B._extend=function(y,n){if(!n||!w(n))return y;var o=Object.keys(n),Y0=o.length;while(Y0--)y[o[Y0]]=n[o[Y0]];return y};function V0(y,n){return Object.prototype.hasOwnProperty.call(y,n)}var s=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;B.promisify=function(n){if(typeof n!=="function")throw TypeError('The "original" argument must be of type Function');if(s&&n[s]){var o=n[s];if(typeof o!=="function")throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(o,s,{value:o,enumerable:!1,writable:!1,configurable:!0}),o}function o(){var Y0,O0,z=new Promise(function(h,Z0){Y0=h,O0=Z0}),L=[];for(var u=0;u{function G(P,j){var E=Object.keys(P);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(P);j&&(C=C.filter(function(N){return Object.getOwnPropertyDescriptor(P,N).enumerable})),E.push.apply(E,C)}return E}function Y(P){for(var j=1;j0)this.tail.next=C;else this.head=C;this.tail=C,++this.length}},{key:"unshift",value:function(E){var C={data:E,next:this.head};if(this.length===0)this.tail=C;this.head=C,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var E=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,E}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";var C=this.head,N=""+C.data;while(C=C.next)N+=E+C.data;return N}},{key:"concat",value:function(E){if(this.length===0)return I.alloc(0);var C=I.allocUnsafe(E>>>0),N=this.head,v=0;while(N)A(N.data,C,v),v+=N.data.length,N=N.next;return C}},{key:"consume",value:function(E,C){var N;if(ES.length?S.length:E;if(F===S.length)v+=S;else v+=S.slice(0,E);if(E-=F,E===0){if(F===S.length)if(++N,C.next)this.head=C.next;else this.head=this.tail=null;else this.head=C,C.data=S.slice(F);break}++N}return this.length-=N,v}},{key:"_getBuffer",value:function(E){var C=I.allocUnsafe(E),N=this.head,v=1;N.data.copy(C),E-=N.data.length;while(N=N.next){var S=N.data,F=E>S.length?S.length:E;if(S.copy(C,C.length-E,0,F),E-=F,E===0){if(F===S.length)if(++v,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=S.slice(F);break}++v}return this.length-=v,C}},{key:T,value:function(E,C){return H(this,Y(Y({},C),{},{depth:0,customInspect:!1}))}}]),P}()}),NB=R0((B,U)=>{P2();function G(q,W){var I=this,H=this._readableState&&this._readableState.destroyed,T=this._writableState&&this._writableState.destroyed;if(H||T){if(W)W(q);else if(q){if(!this._writableState)P0.nextTick(Z,this,q);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,P0.nextTick(Z,this,q)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(q||null,function(A){if(!W&&A)if(!I._writableState)P0.nextTick(Y,I,A);else if(!I._writableState.errorEmitted)I._writableState.errorEmitted=!0,P0.nextTick(Y,I,A);else P0.nextTick(Q,I);else if(W)P0.nextTick(Q,I),W(A);else P0.nextTick(Q,I)}),this}function Y(q,W){Z(q,W),Q(q)}function Q(q){if(q._writableState&&!q._writableState.emitClose)return;if(q._readableState&&!q._readableState.emitClose)return;q.emit("close")}function K(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function Z(q,W){q.emit("error",W)}function J(q,W){var{_readableState:I,_writableState:H}=q;if(I&&I.autoDestroy||H&&H.autoDestroy)q.destroy(W);else q.emit("error",W)}U.exports={destroy:G,undestroy:K,errorOrDestroy:J}}),c2=R0((B,U)=>{function G(W,I){W.prototype=Object.create(I.prototype),W.prototype.constructor=W,W.__proto__=I}var Y={};function Q(W,I,H){if(!H)H=Error;function T(P,j,E){if(typeof I==="string")return I;else return I(P,j,E)}var A=function(P){G(j,P);function j(E,C,N){return P.call(this,T(E,C,N))||this}return j}(H);A.prototype.name=H.name,A.prototype.code=W,Y[W]=A}function K(W,I){if(Array.isArray(W)){var H=W.length;if(W=W.map(function(T){return String(T)}),H>2)return"one of ".concat(I," ").concat(W.slice(0,H-1).join(", "),", or ")+W[H-1];else if(H===2)return"one of ".concat(I," ").concat(W[0]," or ").concat(W[1]);else return"of ".concat(I," ").concat(W[0])}else return"of ".concat(I," ").concat(String(W))}function Z(W,I,H){return W.substr(!H||H<0?0:+H,I.length)===I}function J(W,I,H){if(H===void 0||H>W.length)H=W.length;return W.substring(H-I.length,H)===I}function q(W,I,H){if(typeof H!=="number")H=0;if(H+I.length>W.length)return!1;else return W.indexOf(I,H)!==-1}Q("ERR_INVALID_OPT_VALUE",function(W,I){return'The value "'+I+'" is invalid for option "'+W+'"'},TypeError),Q("ERR_INVALID_ARG_TYPE",function(W,I,H){var T;if(typeof I==="string"&&Z(I,"not "))T="must not be",I=I.replace(/^not /,"");else T="must be";var A;if(J(W," argument"))A="The ".concat(W," ").concat(T," ").concat(K(I,"type"));else{var P=q(W,".")?"property":"argument";A='The "'.concat(W,'" ').concat(P," ").concat(T," ").concat(K(I,"type"))}return A+=". Received type ".concat(typeof H),A},TypeError),Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Q("ERR_METHOD_NOT_IMPLEMENTED",function(W){return"The "+W+" method is not implemented"}),Q("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Q("ERR_STREAM_DESTROYED",function(W){return"Cannot call "+W+" after a stream was destroyed"}),Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Q("ERR_STREAM_WRITE_AFTER_END","write after end"),Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Q("ERR_UNKNOWN_ENCODING",function(W){return"Unknown encoding: "+W},TypeError),Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),U.exports.codes=Y}),wB=R0((B,U)=>{var G=c2().codes.ERR_INVALID_OPT_VALUE;function Y(K,Z,J){return K.highWaterMark!=null?K.highWaterMark:Z?K[J]:null}function Q(K,Z,J,q){var W=Y(Z,q,J);if(W!=null){if(!(isFinite(W)&&Math.floor(W)===W)||W<0)throw new G(q?J:"highWaterMark",W);return Math.floor(W)}return K.objectMode?16:16384}U.exports={getHighWaterMark:Q}}),sU=R0((B,U)=>{d2(),U.exports=G;function G(Q,K){if(Y("noDeprecation"))return Q;var Z=!1;function J(){if(!Z){if(Y("throwDeprecation"))throw Error(K);else if(Y("traceDeprecation"))console.trace(K);else console.warn(K);Z=!0}return Q.apply(this,arguments)}return J}function Y(Q){try{if(!v0.localStorage)return!1}catch(Z){return!1}var K=v0.localStorage[Q];if(K==null)return!1;return String(K).toLowerCase()==="true"}}),zB=R0((B,U)=>{d2(),P2(),U.exports=w;function G(z){var L=this;this.next=null,this.entry=null,this.finish=function(){O0(L,z)}}var Y;w.WritableState=$;var Q={deprecate:sU()},K=qB(),Z=f1().Buffer,J=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function q(z){return Z.from(z)}function W(z){return Z.isBuffer(z)||z instanceof J}var I=NB(),H=wB().getHighWaterMark,T=c2().codes,A=T.ERR_INVALID_ARG_TYPE,P=T.ERR_METHOD_NOT_IMPLEMENTED,j=T.ERR_MULTIPLE_CALLBACK,E=T.ERR_STREAM_CANNOT_PIPE,C=T.ERR_STREAM_DESTROYED,N=T.ERR_STREAM_NULL_VALUES,v=T.ERR_STREAM_WRITE_AFTER_END,S=T.ERR_UNKNOWN_ENCODING,F=I.errorOrDestroy;W2()(w,K);function M(){}function $(z,L,u){if(Y=Y||u2(),z=z||{},typeof u!=="boolean")u=L instanceof Y;if(this.objectMode=!!z.objectMode,u)this.objectMode=this.objectMode||!!z.writableObjectMode;this.highWaterMark=H(this,z,"writableHighWaterMark",u),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=z.decodeStrings===!1;this.decodeStrings=!h,this.defaultEncoding=z.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z0){i(L,Z0)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=z.emitClose!==!1,this.autoDestroy=!!z.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new G(this)}$.prototype.getBuffer=function(){var L=this.bufferedRequest,u=[];while(L)u.push(L),L=L.next;return u},function(){try{Object.defineProperty($.prototype,"buffer",{get:Q.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(z){}}();var x;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")x=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(L){if(x.call(this,L))return!0;if(this!==w)return!1;return L&&L._writableState instanceof $}});else x=function(L){return L instanceof this};function w(z){Y=Y||u2();var L=this instanceof Y;if(!L&&!x.call(w,this))return new w(z);if(this._writableState=new $(z,this,L),this.writable=!0,z){if(typeof z.write==="function")this._write=z.write;if(typeof z.writev==="function")this._writev=z.writev;if(typeof z.destroy==="function")this._destroy=z.destroy;if(typeof z.final==="function")this._final=z.final}K.call(this)}w.prototype.pipe=function(){F(this,new E)};function a(z,L){var u=new v;F(z,u),P0.nextTick(L,u)}function U0(z,L,u,h){var Z0;if(u===null)Z0=new N;else if(typeof u!=="string"&&!L.objectMode)Z0=new A("chunk",["string","Buffer"],u);if(Z0)return F(z,Z0),P0.nextTick(h,Z0),!1;return!0}w.prototype.write=function(z,L,u){var h=this._writableState,Z0=!1,g=!h.objectMode&&W(z);if(g&&!Z.isBuffer(z))z=q(z);if(typeof L==="function")u=L,L=null;if(g)L="buffer";else if(!L)L=h.defaultEncoding;if(typeof u!=="function")u=M;if(h.ending)a(this,u);else if(g||U0(this,h,z,u))h.pendingcb++,Z0=c(this,h,g,z,L,u);return Z0},w.prototype.cork=function(){this._writableState.corked++},w.prototype.uncork=function(){var z=this._writableState;if(z.corked){if(z.corked--,!z.writing&&!z.corked&&!z.bufferProcessing&&z.bufferedRequest)G0(this,z)}},w.prototype.setDefaultEncoding=function(L){if(typeof L==="string")L=L.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((L+"").toLowerCase())>-1))throw new S(L);return this._writableState.defaultEncoding=L,this},Object.defineProperty(w.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function b(z,L,u){if(!z.objectMode&&z.decodeStrings!==!1&&typeof L==="string")L=Z.from(L,u);return L}Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function c(z,L,u,h,Z0,g){if(!u){var f=b(L,h,Z0);if(h!==f)u=!0,Z0="buffer",h=f}var R=L.objectMode?1:h.length;L.length+=R;var p=L.length{P2();var G=Object.keys||function(H){var T=[];for(var A in H)T.push(A);return T};U.exports=q;var Y=EB(),Q=zB();W2()(q,Y);var K=G(Q.prototype);for(var Z=0;Z{var G=f1(),Y=G.Buffer;function Q(Z,J){for(var q in Z)J[q]=Z[q]}if(Y.from&&Y.alloc&&Y.allocUnsafe&&Y.allocUnsafeSlow)U.exports=G;else Q(G,B),B.Buffer=K;function K(Z,J,q){return Y(Z,J,q)}Q(Y,K),K.from=function(Z,J,q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return Y(Z,J,q)},K.alloc=function(Z,J,q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var W=Y(Z);if(J!==void 0)if(typeof q==="string")W.fill(J,q);else W.fill(J);else W.fill(0);return W},K.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return Y(Z)},K.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),F8=R0((B)=>{var U=oU().Buffer,G=U.isEncoding||function(N){switch(N=""+N,N&&N.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Y(N){if(!N)return"utf8";var v;while(!0)switch(N){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return N;default:if(v)return;N=(""+N).toLowerCase(),v=!0}}function Q(N){var v=Y(N);if(typeof v!=="string"&&(U.isEncoding===G||!G(N)))throw Error("Unknown encoding: "+N);return v||N}B.StringDecoder=K;function K(N){this.encoding=Q(N);var v;switch(this.encoding){case"utf16le":this.text=T,this.end=A,v=4;break;case"utf8":this.fillLast=W,v=4;break;case"base64":this.text=P,this.end=j,v=3;break;default:this.write=E,this.end=C;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=U.allocUnsafe(v)}K.prototype.write=function(N){if(N.length===0)return"";var v,S;if(this.lastNeed){if(v=this.fillLast(N),v===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;if(S>5===6)return 2;else if(N>>4===14)return 3;else if(N>>3===30)return 4;return N>>6===2?-1:-2}function J(N,v,S){var F=v.length-1;if(F=0){if(M>0)N.lastNeed=M-1;return M}if(--F=0){if(M>0)N.lastNeed=M-2;return M}if(--F=0){if(M>0)if(M===2)M=0;else N.lastNeed=M-3;return M}return 0}function q(N,v,S){if((v[0]&192)!==128)return N.lastNeed=0,"�";if(N.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return N.lastNeed=1,"�";if(N.lastNeed>2&&v.length>2){if((v[2]&192)!==128)return N.lastNeed=2,"�"}}}function W(N){var v=this.lastTotal-this.lastNeed,S=q(this,N,v);if(S!==void 0)return S;if(this.lastNeed<=N.length)return N.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);N.copy(this.lastChar,v,0,N.length),this.lastNeed-=N.length}function I(N,v){var S=J(this,N,v);if(!this.lastNeed)return N.toString("utf8",v);this.lastTotal=S;var F=N.length-(S-this.lastNeed);return N.copy(this.lastChar,0,F),N.toString("utf8",v,F)}function H(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+"�";return v}function T(N,v){if((N.length-v)%2===0){var S=N.toString("utf16le",v);if(S){var F=S.charCodeAt(S.length-1);if(F>=55296&&F<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=N[N.length-1],N.toString("utf16le",v,N.length-1)}function A(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,S)}return v}function P(N,v){var S=(N.length-v)%3;if(S===0)return N.toString("base64",v);if(this.lastNeed=3-S,this.lastTotal=3,S===1)this.lastChar[0]=N[N.length-1];else this.lastChar[0]=N[N.length-2],this.lastChar[1]=N[N.length-1];return N.toString("base64",v,N.length-S)}function j(N){var v=N&&N.length?this.write(N):"";if(this.lastNeed)return v+this.lastChar.toString("base64",0,3-this.lastNeed);return v}function E(N){return N.toString(this.encoding)}function C(N){return N&&N.length?this.write(N):""}}),f8=R0((B,U)=>{var G=c2().codes.ERR_STREAM_PREMATURE_CLOSE;function Y(J){var q=!1;return function(){if(q)return;q=!0;for(var W=arguments.length,I=Array(W),H=0;H{P2();var G;function Y(S,F,M){if(F=Q(F),F in S)Object.defineProperty(S,F,{value:M,enumerable:!0,configurable:!0,writable:!0});else S[F]=M;return S}function Q(S){var F=K(S,"string");return typeof F==="symbol"?F:String(F)}function K(S,F){if(typeof S!=="object"||S===null)return S;var M=S[Symbol.toPrimitive];if(M!==void 0){var $=M.call(S,F||"default");if(typeof $!=="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(F==="string"?String:Number)(S)}var Z=f8(),J=Symbol("lastResolve"),q=Symbol("lastReject"),W=Symbol("error"),I=Symbol("ended"),H=Symbol("lastPromise"),T=Symbol("handlePromise"),A=Symbol("stream");function P(S,F){return{value:S,done:F}}function j(S){var F=S[J];if(F!==null){var M=S[A].read();if(M!==null)S[H]=null,S[J]=null,S[q]=null,F(P(M,!1))}}function E(S){P0.nextTick(j,S)}function C(S,F){return function(M,$){S.then(function(){if(F[I]){M(P(void 0,!0));return}F[T](M,$)},$)}}var N=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((G={get stream(){return this[A]},next:function(){var F=this,M=this[W];if(M!==null)return Promise.reject(M);if(this[I])return Promise.resolve(P(void 0,!0));if(this[A].destroyed)return new Promise(function(a,U0){P0.nextTick(function(){if(F[W])U0(F[W]);else a(P(void 0,!0))})});var $=this[H],x;if($)x=new Promise(C($,this));else{var w=this[A].read();if(w!==null)return Promise.resolve(P(w,!1));x=new Promise(this[T])}return this[H]=x,x}},Y(G,Symbol.asyncIterator,function(){return this}),Y(G,"return",function(){var F=this;return new Promise(function(M,$){F[A].destroy(null,function(x){if(x){$(x);return}M(P(void 0,!0))})})}),G),N);U.exports=function(F){var M,$=Object.create(v,(M={},Y(M,A,{value:F,writable:!0}),Y(M,J,{value:null,writable:!0}),Y(M,q,{value:null,writable:!0}),Y(M,W,{value:null,writable:!0}),Y(M,I,{value:F._readableState.endEmitted,writable:!0}),Y(M,T,{value:function(w,a){var U0=$[A].read();if(U0)$[H]=null,$[J]=null,$[q]=null,w(P(U0,!1));else $[J]=w,$[q]=a},writable:!0}),M));return $[H]=null,Z(F,function(x){if(x&&x.code!=="ERR_STREAM_PREMATURE_CLOSE"){var w=$[q];if(w!==null)$[H]=null,$[J]=null,$[q]=null,w(x);$[W]=x;return}var a=$[J];if(a!==null)$[H]=null,$[J]=null,$[q]=null,a(P(void 0,!0));$[I]=!0}),F.on("readable",E.bind(null,$)),$}}),eU=R0((B,U)=>{U.exports=function(){throw Error("Readable.from is not available in the browser")}}),EB=R0((B,U)=>{d2(),P2(),U.exports=a;var G;a.ReadableState=w,S8().EventEmitter;var Y=function(f,R){return f.listeners(R).length},Q=qB(),K=f1().Buffer,Z=(typeof v0<"u"?v0:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function J(g){return K.from(g)}function q(g){return K.isBuffer(g)||g instanceof Z}var W=jB(),I;if(W&&W.debuglog)I=W.debuglog("stream");else I=function(){};var H=nU(),T=NB(),A=wB().getHighWaterMark,P=c2().codes,j=P.ERR_INVALID_ARG_TYPE,E=P.ERR_STREAM_PUSH_AFTER_EOF,C=P.ERR_METHOD_NOT_IMPLEMENTED,N=P.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,S,F;W2()(a,Q);var M=T.errorOrDestroy,$=["error","close","destroy","pause","resume"];function x(g,f,R){if(typeof g.prependListener==="function")return g.prependListener(f,R);if(!g._events||!g._events[f])g.on(f,R);else if(Array.isArray(g._events[f]))g._events[f].unshift(R);else g._events[f]=[R,g._events[f]]}function w(g,f,R){if(G=G||u2(),g=g||{},typeof R!=="boolean")R=f instanceof G;if(this.objectMode=!!g.objectMode,R)this.objectMode=this.objectMode||!!g.readableObjectMode;if(this.highWaterMark=A(this,g,"readableHighWaterMark",R),this.buffer=new H,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=g.emitClose!==!1,this.autoDestroy=!!g.autoDestroy,this.destroyed=!1,this.defaultEncoding=g.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,g.encoding){if(!v)v=F8().StringDecoder;this.decoder=new v(g.encoding),this.encoding=g.encoding}}function a(g){if(G=G||u2(),!(this instanceof a))return new a(g);var f=this instanceof G;if(this._readableState=new w(g,this,f),this.readable=!0,g){if(typeof g.read==="function")this._read=g.read;if(typeof g.destroy==="function")this._destroy=g.destroy}Q.call(this)}Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(f){if(!this._readableState)return;this._readableState.destroyed=f}}),a.prototype.destroy=T.destroy,a.prototype._undestroy=T.undestroy,a.prototype._destroy=function(g,f){f(g)},a.prototype.push=function(g,f){var R=this._readableState,p;if(!R.objectMode){if(typeof g==="string"){if(f=f||R.defaultEncoding,f!==R.encoding)g=K.from(g,f),f="";p=!0}}else p=!0;return U0(this,g,f,!1,p)},a.prototype.unshift=function(g){return U0(this,g,null,!0,!1)};function U0(g,f,R,p,k){I("readableAddChunk",f);var V=g._readableState;if(f===null)V.reading=!1,i(g,V);else{var X;if(!k)X=c(V,f);if(X)M(g,X);else if(V.objectMode||f&&f.length>0){if(typeof f!=="string"&&!V.objectMode&&Object.getPrototypeOf(f)!==K.prototype)f=J(f);if(p)if(V.endEmitted)M(g,new N);else b(g,V,f,!0);else if(V.ended)M(g,new E);else if(V.destroyed)return!1;else if(V.reading=!1,V.decoder&&!R)if(f=V.decoder.write(f),V.objectMode||f.length!==0)b(g,V,f,!1);else G0(g,V);else b(g,V,f,!1)}else if(!p)V.reading=!1,G0(g,V)}return!V.ended&&(V.length=D)g=D;else g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++;return g}function B0(g,f){if(g<=0||f.length===0&&f.ended)return 0;if(f.objectMode)return 1;if(g!==g)if(f.flowing&&f.length)return f.buffer.head.data.length;else return f.length;if(g>f.highWaterMark)f.highWaterMark=m(g);if(g<=f.length)return g;if(!f.ended)return f.needReadable=!0,0;return f.length}a.prototype.read=function(g){I("read",g),g=parseInt(g,10);var f=this._readableState,R=g;if(g!==0)f.emittedReadable=!1;if(g===0&&f.needReadable&&((f.highWaterMark!==0?f.length>=f.highWaterMark:f.length>0)||f.ended)){if(I("read: emitReadable",f.length,f.ended),f.length===0&&f.ended)u(this);else V0(this);return null}if(g=B0(g,f),g===0&&f.ended){if(f.length===0)u(this);return null}var p=f.needReadable;if(I("need readable",p),f.length===0||f.length-g0)k=L(g,f);else k=null;if(k===null)f.needReadable=f.length<=f.highWaterMark,g=0;else f.length-=g,f.awaitDrain=0;if(f.length===0){if(!f.ended)f.needReadable=!0;if(R!==g&&f.ended)u(this)}if(k!==null)this.emit("data",k);return k};function i(g,f){if(I("onEofChunk"),f.ended)return;if(f.decoder){var R=f.decoder.end();if(R&&R.length)f.buffer.push(R),f.length+=f.objectMode?1:R.length}if(f.ended=!0,f.sync)V0(g);else if(f.needReadable=!1,!f.emittedReadable)f.emittedReadable=!0,s(g)}function V0(g){var f=g._readableState;if(I("emitReadable",f.needReadable,f.emittedReadable),f.needReadable=!1,!f.emittedReadable)I("emitReadable",f.flowing),f.emittedReadable=!0,P0.nextTick(s,g)}function s(g){var f=g._readableState;if(I("emitReadable_",f.destroyed,f.length,f.ended),!f.destroyed&&(f.length||f.ended))g.emit("readable"),f.emittedReadable=!1;f.needReadable=!f.flowing&&!f.ended&&f.length<=f.highWaterMark,z(g)}function G0(g,f){if(!f.readingMore)f.readingMore=!0,P0.nextTick(r,g,f)}function r(g,f){while(!f.reading&&!f.ended&&(f.length1&&Z0(p.pipes,g)!==-1)&&!_)I("false write response, pause",p.awaitDrain),p.awaitDrain++;R.pause()}}function Q0(F0){if(I("onerror",F0),I0(),g.removeListener("error",Q0),Y(g,"error")===0)M(g,F0)}x(g,"error",Q0);function X0(){g.removeListener("finish",K0),I0()}g.once("close",X0);function K0(){I("onfinish"),g.removeListener("close",X0),I0()}g.once("finish",K0);function I0(){I("unpipe"),R.unpipe(g)}if(g.emit("pipe",R),!p.flowing)I("pipe resume"),R.resume();return g};function y(g){return function(){var R=g._readableState;if(I("pipeOnDrain",R.awaitDrain),R.awaitDrain)R.awaitDrain--;if(R.awaitDrain===0&&Y(g,"data"))R.flowing=!0,z(g)}}a.prototype.unpipe=function(g){var f=this._readableState,R={hasUnpiped:!1};if(f.pipesCount===0)return this;if(f.pipesCount===1){if(g&&g!==f.pipes)return this;if(!g)g=f.pipes;if(f.pipes=null,f.pipesCount=0,f.flowing=!1,g)g.emit("unpipe",this,R);return this}if(!g){var{pipes:p,pipesCount:k}=f;f.pipes=null,f.pipesCount=0,f.flowing=!1;for(var V=0;V0,p.flowing!==!1)this.resume()}else if(g==="readable"){if(!p.endEmitted&&!p.readableListening){if(p.readableListening=p.needReadable=!0,p.flowing=!1,p.emittedReadable=!1,I("on readable",p.length,p.reading),p.length)V0(this);else if(!p.reading)P0.nextTick(o,this)}}return R},a.prototype.addListener=a.prototype.on,a.prototype.removeListener=function(g,f){var R=Q.prototype.removeListener.call(this,g,f);if(g==="readable")P0.nextTick(n,this);return R},a.prototype.removeAllListeners=function(g){var f=Q.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)P0.nextTick(n,this);return f};function n(g){var f=g._readableState;if(f.readableListening=g.listenerCount("readable")>0,f.resumeScheduled&&!f.paused)f.flowing=!0;else if(g.listenerCount("data")>0)g.resume()}function o(g){I("readable nexttick read 0"),g.read(0)}a.prototype.resume=function(){var g=this._readableState;if(!g.flowing)I("resume"),g.flowing=!g.readableListening,Y0(this,g);return g.paused=!1,this};function Y0(g,f){if(!f.resumeScheduled)f.resumeScheduled=!0,P0.nextTick(O0,g,f)}function O0(g,f){if(I("resume",f.reading),!f.reading)g.read(0);if(f.resumeScheduled=!1,g.emit("resume"),z(g),f.flowing&&!f.reading)g.read(0)}a.prototype.pause=function(){if(I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)I("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function z(g){var f=g._readableState;I("flow",f.flowing);while(f.flowing&&g.read()!==null);}if(a.prototype.wrap=function(g){var f=this,R=this._readableState,p=!1;g.on("end",function(){if(I("wrapped end"),R.decoder&&!R.ended){var X=R.decoder.end();if(X&&X.length)f.push(X)}f.push(null)}),g.on("data",function(X){if(I("wrapped data"),R.decoder)X=R.decoder.write(X);if(R.objectMode&&(X===null||X===void 0))return;else if(!R.objectMode&&(!X||!X.length))return;if(!f.push(X))p=!0,g.pause()});for(var k in g)if(this[k]===void 0&&typeof g[k]==="function")this[k]=function(O){return function(){return g[O].apply(g,arguments)}}(k);for(var V=0;V<$.length;V++)g.on($[V],this.emit.bind(this,$[V]));return this._read=function(X){if(I("wrapped _read",X),p)p=!1,g.resume()},this},typeof Symbol==="function")a.prototype[Symbol.asyncIterator]=function(){if(S===void 0)S=tU();return S(this)};Object.defineProperty(a.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(a.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(a.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(f){if(this._readableState)this._readableState.flowing=f}}),a._fromList=L,Object.defineProperty(a.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function L(g,f){if(f.length===0)return null;var R;if(f.objectMode)R=f.buffer.shift();else if(!g||g>=f.length){if(f.decoder)R=f.buffer.join("");else if(f.buffer.length===1)R=f.buffer.first();else R=f.buffer.concat(f.length);f.buffer.clear()}else R=f.buffer.consume(g,f.decoder);return R}function u(g){var f=g._readableState;if(I("endReadable",f.endEmitted),!f.endEmitted)f.ended=!0,P0.nextTick(h,f,g)}function h(g,f){if(I("endReadableNT",g.endEmitted,g.length),!g.endEmitted&&g.length===0){if(g.endEmitted=!0,f.readable=!1,f.emit("end"),g.autoDestroy){var R=f._writableState;if(!R||R.autoDestroy&&R.finished)f.destroy()}}}if(typeof Symbol==="function")a.from=function(g,f){if(F===void 0)F=eU();return F(a,g,f)};function Z0(g,f){for(var R=0,p=g.length;R{U.exports=W;var G=c2().codes,Y=G.ERR_METHOD_NOT_IMPLEMENTED,Q=G.ERR_MULTIPLE_CALLBACK,K=G.ERR_TRANSFORM_ALREADY_TRANSFORMING,Z=G.ERR_TRANSFORM_WITH_LENGTH_0,J=u2();W2()(W,J);function q(T,A){var P=this._transformState;P.transforming=!1;var j=P.writecb;if(j===null)return this.emit("error",new Q);if(P.writechunk=null,P.writecb=null,A!=null)this.push(A);j(T);var E=this._readableState;if(E.reading=!1,E.needReadable||E.length{U.exports=Y;var G=DB();W2()(Y,G);function Y(Q){if(!(this instanceof Y))return new Y(Q);G.call(this,Q)}Y.prototype._transform=function(Q,K,Z){Z(null,Q)}}),UG=R0((B,U)=>{var G;function Y(P){var j=!1;return function(){if(j)return;j=!0,P.apply(void 0,arguments)}}var Q=c2().codes,K=Q.ERR_MISSING_ARGS,Z=Q.ERR_STREAM_DESTROYED;function J(P){if(P)throw P}function q(P){return P.setHeader&&typeof P.abort==="function"}function W(P,j,E,C){C=Y(C);var N=!1;if(P.on("close",function(){N=!0}),G===void 0)G=f8();G(P,{readable:j,writable:E},function(S){if(S)return C(S);N=!0,C()});var v=!1;return function(S){if(N)return;if(v)return;if(v=!0,q(P))return P.abort();if(typeof P.destroy==="function")return P.destroy();C(S||new Z("pipe"))}}function I(P){P()}function H(P,j){return P.pipe(j)}function T(P){if(!P.length)return J;if(typeof P[P.length-1]!=="function")return J;return P.pop()}function A(){for(var P=arguments.length,j=Array(P),E=0;E0,function($){if(!N)N=$;if($)v.forEach(I);if(M)return;v.forEach(I),C(N)})});return j.reduce(H)}U.exports=A}),x8=R0((B,U)=>{U.exports=Y;var G=S8().EventEmitter;W2()(Y,G),Y.Readable=EB(),Y.Writable=zB(),Y.Duplex=u2(),Y.Transform=DB(),Y.PassThrough=BG(),Y.finished=f8(),Y.pipeline=UG(),Y.Stream=Y;function Y(){G.call(this)}Y.prototype.pipe=function(Q,K){var Z=this;function J(P){if(Q.writable){if(Q.write(P)===!1&&Z.pause)Z.pause()}}Z.on("data",J);function q(){if(Z.readable&&Z.resume)Z.resume()}if(Q.on("drain",q),!Q._isStdio&&(!K||K.end!==!1))Z.on("end",I),Z.on("close",H);var W=!1;function I(){if(W)return;W=!0,Q.end()}function H(){if(W)return;if(W=!0,typeof Q.destroy==="function")Q.destroy()}function T(P){if(A(),G.listenerCount(this,"error")===0)throw P}Z.on("error",T),Q.on("error",T);function A(){Z.removeListener("data",J),Q.removeListener("drain",q),Z.removeListener("end",I),Z.removeListener("close",H),Z.removeListener("error",T),Q.removeListener("error",T),Z.removeListener("end",A),Z.removeListener("close",A),Q.removeListener("close",A)}return Z.on("end",A),Z.on("close",A),Q.on("close",A),Q.emit("pipe",Z),Q}}),GG=R0((B)=>{(function(U){U.parser=function(z,L){return new Y(z,L)},U.SAXParser=Y,U.SAXStream=I,U.createStream=W,U.MAX_BUFFER_LENGTH=65536;var G=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];U.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Y(z,L){if(!(this instanceof Y))return new Y(z,L);var u=this;if(K(u),u.q=u.c="",u.bufferCheckPosition=U.MAX_BUFFER_LENGTH,u.opt=L||{},u.opt.lowercase=u.opt.lowercase||u.opt.lowercasetags,u.looseCase=u.opt.lowercase?"toLowerCase":"toUpperCase",u.tags=[],u.closed=u.closedRoot=u.sawRoot=!1,u.tag=u.error=null,u.strict=!!z,u.noscript=!!(z||u.opt.noscript),u.state=w.BEGIN,u.strictEntities=u.opt.strictEntities,u.ENTITIES=u.strictEntities?Object.create(U.XML_ENTITIES):Object.create(U.ENTITIES),u.attribList=[],u.opt.xmlns)u.ns=Object.create(j);if(u.trackPosition=u.opt.position!==!1,u.trackPosition)u.position=u.line=u.column=0;U0(u,"onready")}if(!Object.create)Object.create=function(z){function L(){}return L.prototype=z,new L};if(!Object.keys)Object.keys=function(z){var L=[];for(var u in z)if(z.hasOwnProperty(u))L.push(u);return L};function Q(z){var L=Math.max(U.MAX_BUFFER_LENGTH,10),u=0;for(var h=0,Z0=G.length;hL)switch(G[h]){case"textNode":c(z);break;case"cdata":b(z,"oncdata",z.cdata),z.cdata="";break;case"script":b(z,"onscript",z.script),z.script="";break;default:m(z,"Max buffer length exceeded: "+G[h])}u=Math.max(u,g)}z.bufferCheckPosition=U.MAX_BUFFER_LENGTH-u+z.position}function K(z){for(var L=0,u=G.length;L"||S(z)}function $(z,L){return z.test(L)}function x(z,L){return!$(z,L)}var w=0;U.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},U.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},U.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(U.ENTITIES).forEach(function(z){var L=U.ENTITIES[z],u=typeof L==="number"?String.fromCharCode(L):L;U.ENTITIES[z]=u});for(var a in U.STATE)U.STATE[U.STATE[a]]=a;w=U.STATE;function U0(z,L,u){z[L]&&z[L](u)}function b(z,L,u){if(z.textNode)c(z);U0(z,L,u)}function c(z){if(z.textNode=D(z.opt,z.textNode),z.textNode)U0(z,"ontext",z.textNode);z.textNode=""}function D(z,L){if(z.trim)L=L.trim();if(z.normalize)L=L.replace(/\s+/g," ");return L}function m(z,L){if(c(z),z.trackPosition)L+=` +Line: `+z.line+` +Column: `+z.column+` +Char: `+z.c;return L=Error(L),z.error=L,U0(z,"onerror",L),z}function B0(z){if(z.sawRoot&&!z.closedRoot)i(z,"Unclosed root tag");if(z.state!==w.BEGIN&&z.state!==w.BEGIN_WHITESPACE&&z.state!==w.TEXT)m(z,"Unexpected end");return c(z),z.c="",z.closed=!0,U0(z,"onend"),Y.call(z,z.strict,z.opt),z}function i(z,L){if(typeof z!=="object"||!(z instanceof Y))throw Error("bad call to strictFail");if(z.strict)m(z,L)}function V0(z){if(!z.strict)z.tagName=z.tagName[z.looseCase]();var L=z.tags[z.tags.length-1]||z,u=z.tag={name:z.tagName,attributes:{}};if(z.opt.xmlns)u.ns=L.ns;z.attribList.length=0,b(z,"onopentagstart",u)}function s(z,L){var u=z.indexOf(":")<0?["",z]:z.split(":"),h=u[0],Z0=u[1];if(L&&z==="xmlns")h="xmlns",Z0="";return{prefix:h,local:Z0}}function G0(z){if(!z.strict)z.attribName=z.attribName[z.looseCase]();if(z.attribList.indexOf(z.attribName)!==-1||z.tag.attributes.hasOwnProperty(z.attribName)){z.attribName=z.attribValue="";return}if(z.opt.xmlns){var L=s(z.attribName,!0),u=L.prefix,h=L.local;if(u==="xmlns")if(h==="xml"&&z.attribValue!==A)i(z,"xml: prefix must be bound to "+A+` +Actual: `+z.attribValue);else if(h==="xmlns"&&z.attribValue!==P)i(z,"xmlns: prefix must be bound to "+P+` +Actual: `+z.attribValue);else{var Z0=z.tag,g=z.tags[z.tags.length-1]||z;if(Z0.ns===g.ns)Z0.ns=Object.create(g.ns);Z0.ns[h]=z.attribValue}z.attribList.push([z.attribName,z.attribValue])}else z.tag.attributes[z.attribName]=z.attribValue,b(z,"onattribute",{name:z.attribName,value:z.attribValue});z.attribName=z.attribValue=""}function r(z,L){if(z.opt.xmlns){var u=z.tag,h=s(z.tagName);if(u.prefix=h.prefix,u.local=h.local,u.uri=u.ns[h.prefix]||"",u.prefix&&!u.uri)i(z,"Unbound namespace prefix: "+JSON.stringify(z.tagName)),u.uri=h.prefix;var Z0=z.tags[z.tags.length-1]||z;if(u.ns&&Z0.ns!==u.ns)Object.keys(u.ns).forEach(function(d){b(z,"onopennamespace",{prefix:d,uri:u.ns[d]})});for(var g=0,f=z.attribList.length;g",z.tagName="",z.state=w.SCRIPT;return}b(z,"onscript",z.script),z.script=""}var L=z.tags.length,u=z.tagName;if(!z.strict)u=u[z.looseCase]();var h=u;while(L--)if(z.tags[L].name!==h)i(z,"Unexpected close tag");else break;if(L<0){i(z,"Unmatched closing tag: "+z.tagName),z.textNode+="",z.state=w.TEXT;return}z.tagName=u;var Z0=z.tags.length;while(Z0-- >L){var g=z.tag=z.tags.pop();z.tagName=z.tag.name,b(z,"onclosetag",z.tagName);var f={};for(var R in g.ns)f[R]=g.ns[R];var p=z.tags[z.tags.length-1]||z;if(z.opt.xmlns&&g.ns!==p.ns)Object.keys(g.ns).forEach(function(k){var V=g.ns[k];b(z,"onclosenamespace",{prefix:k,uri:V})})}if(L===0)z.closedRoot=!0;z.tagName=z.attribValue=z.attribName="",z.attribList.length=0,z.state=w.TEXT}function n(z){var L=z.entity,u=L.toLowerCase(),h,Z0="";if(z.ENTITIES[L])return z.ENTITIES[L];if(z.ENTITIES[u])return z.ENTITIES[u];if(L=u,L.charAt(0)==="#")if(L.charAt(1)==="x")L=L.slice(2),h=parseInt(L,16),Z0=h.toString(16);else L=L.slice(1),h=parseInt(L,10),Z0=h.toString(10);if(L=L.replace(/^0+/,""),isNaN(h)||Z0.toLowerCase()!==L)return i(z,"Invalid character entity"),"&"+z.entity+";";return String.fromCodePoint(h)}function o(z,L){if(L==="<")z.state=w.OPEN_WAKA,z.startTagPosition=z.position;else if(!S(L))i(z,"Non-whitespace before first tag."),z.textNode=L,z.state=w.TEXT}function Y0(z,L){var u="";if(L")b(L,"onsgmldeclaration",L.sgmlDecl),L.sgmlDecl="",L.state=w.TEXT;else if(F(h))L.state=w.SGML_DECL_QUOTED,L.sgmlDecl+=h;else L.sgmlDecl+=h;continue;case w.SGML_DECL_QUOTED:if(h===L.q)L.state=w.SGML_DECL,L.q="";L.sgmlDecl+=h;continue;case w.DOCTYPE:if(h===">")L.state=w.TEXT,b(L,"ondoctype",L.doctype),L.doctype=!0;else if(L.doctype+=h,h==="[")L.state=w.DOCTYPE_DTD;else if(F(h))L.state=w.DOCTYPE_QUOTED,L.q=h;continue;case w.DOCTYPE_QUOTED:if(L.doctype+=h,h===L.q)L.q="",L.state=w.DOCTYPE;continue;case w.DOCTYPE_DTD:if(L.doctype+=h,h==="]")L.state=w.DOCTYPE;else if(F(h))L.state=w.DOCTYPE_DTD_QUOTED,L.q=h;continue;case w.DOCTYPE_DTD_QUOTED:if(L.doctype+=h,h===L.q)L.state=w.DOCTYPE_DTD,L.q="";continue;case w.COMMENT:if(h==="-")L.state=w.COMMENT_ENDING;else L.comment+=h;continue;case w.COMMENT_ENDING:if(h==="-"){if(L.state=w.COMMENT_ENDED,L.comment=D(L.opt,L.comment),L.comment)b(L,"oncomment",L.comment);L.comment=""}else L.comment+="-"+h,L.state=w.COMMENT;continue;case w.COMMENT_ENDED:if(h!==">")i(L,"Malformed comment"),L.comment+="--"+h,L.state=w.COMMENT;else L.state=w.TEXT;continue;case w.CDATA:if(h==="]")L.state=w.CDATA_ENDING;else L.cdata+=h;continue;case w.CDATA_ENDING:if(h==="]")L.state=w.CDATA_ENDING_2;else L.cdata+="]"+h,L.state=w.CDATA;continue;case w.CDATA_ENDING_2:if(h===">"){if(L.cdata)b(L,"oncdata",L.cdata);b(L,"onclosecdata"),L.cdata="",L.state=w.TEXT}else if(h==="]")L.cdata+="]";else L.cdata+="]]"+h,L.state=w.CDATA;continue;case w.PROC_INST:if(h==="?")L.state=w.PROC_INST_ENDING;else if(S(h))L.state=w.PROC_INST_BODY;else L.procInstName+=h;continue;case w.PROC_INST_BODY:if(!L.procInstBody&&S(h))continue;else if(h==="?")L.state=w.PROC_INST_ENDING;else L.procInstBody+=h;continue;case w.PROC_INST_ENDING:if(h===">")b(L,"onprocessinginstruction",{name:L.procInstName,body:L.procInstBody}),L.procInstName=L.procInstBody="",L.state=w.TEXT;else L.procInstBody+="?"+h,L.state=w.PROC_INST_BODY;continue;case w.OPEN_TAG:if($(C,h))L.tagName+=h;else if(V0(L),h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else{if(!S(h))i(L,"Invalid character in tag name");L.state=w.ATTRIB}continue;case w.OPEN_TAG_SLASH:if(h===">")r(L,!0),y(L);else i(L,"Forward-slash in opening tag not followed by >"),L.state=w.ATTRIB;continue;case w.ATTRIB:if(S(h))continue;else if(h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else if($(E,h))L.attribName=h,L.attribValue="",L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case w.ATTRIB_NAME:if(h==="=")L.state=w.ATTRIB_VALUE;else if(h===">")i(L,"Attribute without value"),L.attribValue=L.attribName,G0(L),r(L);else if(S(h))L.state=w.ATTRIB_NAME_SAW_WHITE;else if($(C,h))L.attribName+=h;else i(L,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if(h==="=")L.state=w.ATTRIB_VALUE;else if(S(h))continue;else if(i(L,"Attribute without value"),L.tag.attributes[L.attribName]="",L.attribValue="",b(L,"onattribute",{name:L.attribName,value:""}),L.attribName="",h===">")r(L);else if($(E,h))L.attribName=h,L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name"),L.state=w.ATTRIB;continue;case w.ATTRIB_VALUE:if(S(h))continue;else if(F(h))L.q=h,L.state=w.ATTRIB_VALUE_QUOTED;else i(L,"Unquoted attribute value"),L.state=w.ATTRIB_VALUE_UNQUOTED,L.attribValue=h;continue;case w.ATTRIB_VALUE_QUOTED:if(h!==L.q){if(h==="&")L.state=w.ATTRIB_VALUE_ENTITY_Q;else L.attribValue+=h;continue}G0(L),L.q="",L.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:if(S(h))L.state=w.ATTRIB;else if(h===">")r(L);else if(h==="/")L.state=w.OPEN_TAG_SLASH;else if($(E,h))i(L,"No whitespace between attributes"),L.attribName=h,L.attribValue="",L.state=w.ATTRIB_NAME;else i(L,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!M(h)){if(h==="&")L.state=w.ATTRIB_VALUE_ENTITY_U;else L.attribValue+=h;continue}if(G0(L),h===">")r(L);else L.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(!L.tagName)if(S(h))continue;else if(x(E,h))if(L.script)L.script+="")y(L);else if($(C,h))L.tagName+=h;else if(L.script)L.script+="")y(L);else i(L,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var f,R;switch(L.state){case w.TEXT_ENTITY:f=w.TEXT,R="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:f=w.ATTRIB_VALUE_QUOTED,R="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:f=w.ATTRIB_VALUE_UNQUOTED,R="attribValue";break}if(h===";")L[R]+=n(L),L.entity="",L.state=f;else if($(L.entity.length?v:N,h))L.entity+=h;else i(L,"Invalid character in entity name"),L[R]+="&"+L.entity+h,L.entity="",L.state=f;continue;default:throw Error(L,"Unknown state: "+L.state)}}if(L.position>=L.bufferCheckPosition)Q(L);return L}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint)(function(){var z=String.fromCharCode,L=Math.floor,u=function(){var h=16384,Z0=[],g,f,R=-1,p=arguments.length;if(!p)return"";var k="";while(++R1114111||L(V)!==V)throw RangeError("Invalid code point: "+V);if(V<=65535)Z0.push(V);else V-=65536,g=(V>>10)+55296,f=V%1024+56320,Z0.push(g,f);if(R+1===p||Z0.length>h)k+=z.apply(null,Z0),Z0.length=0}return k};if(Object.defineProperty)Object.defineProperty(String,"fromCodePoint",{value:u,configurable:!0,writable:!0});else String.fromCodePoint=u})()})(typeof B>"u"?B.sax={}:B)}),_8=R0((B,U)=>{U.exports={isArray:function(G){if(Array.isArray)return Array.isArray(G);return Object.prototype.toString.call(G)==="[object Array]"}}}),h8=R0((B,U)=>{var G=_8().isArray;U.exports={copyOptions:function(Y){var Q,K={};for(Q in Y)if(Y.hasOwnProperty(Q))K[Q]=Y[Q];return K},ensureFlagExists:function(Y,Q){if(!(Y in Q)||typeof Q[Y]!=="boolean")Q[Y]=!1},ensureSpacesExists:function(Y){if(!("spaces"in Y)||typeof Y.spaces!=="number"&&typeof Y.spaces!=="string")Y.spaces=0},ensureAlwaysArrayExists:function(Y){if(!("alwaysArray"in Y)||typeof Y.alwaysArray!=="boolean"&&!G(Y.alwaysArray))Y.alwaysArray=!1},ensureKeyExists:function(Y,Q){if(!(Y+"Key"in Q)||typeof Q[Y+"Key"]!=="string")Q[Y+"Key"]=Q.compact?"_"+Y:Y},checkFnExists:function(Y,Q){return Y+"Fn"in Q}}}),TB=R0((B,U)=>{var G=GG(),Y={on:function(){},parse:function(){}},Q=h8(),K=_8().isArray,Z,J=!0,q;function W(F){return Z=Q.copyOptions(F),Q.ensureFlagExists("ignoreDeclaration",Z),Q.ensureFlagExists("ignoreInstruction",Z),Q.ensureFlagExists("ignoreAttributes",Z),Q.ensureFlagExists("ignoreText",Z),Q.ensureFlagExists("ignoreComment",Z),Q.ensureFlagExists("ignoreCdata",Z),Q.ensureFlagExists("ignoreDoctype",Z),Q.ensureFlagExists("compact",Z),Q.ensureFlagExists("alwaysChildren",Z),Q.ensureFlagExists("addParent",Z),Q.ensureFlagExists("trim",Z),Q.ensureFlagExists("nativeType",Z),Q.ensureFlagExists("nativeTypeAttributes",Z),Q.ensureFlagExists("sanitize",Z),Q.ensureFlagExists("instructionHasAttributes",Z),Q.ensureFlagExists("captureSpacesBetweenElements",Z),Q.ensureAlwaysArrayExists(Z),Q.ensureKeyExists("declaration",Z),Q.ensureKeyExists("instruction",Z),Q.ensureKeyExists("attributes",Z),Q.ensureKeyExists("text",Z),Q.ensureKeyExists("comment",Z),Q.ensureKeyExists("cdata",Z),Q.ensureKeyExists("doctype",Z),Q.ensureKeyExists("type",Z),Q.ensureKeyExists("name",Z),Q.ensureKeyExists("elements",Z),Q.ensureKeyExists("parent",Z),Q.checkFnExists("doctype",Z),Q.checkFnExists("instruction",Z),Q.checkFnExists("cdata",Z),Q.checkFnExists("comment",Z),Q.checkFnExists("text",Z),Q.checkFnExists("instructionName",Z),Q.checkFnExists("elementName",Z),Q.checkFnExists("attributeName",Z),Q.checkFnExists("attributeValue",Z),Q.checkFnExists("attributes",Z),Z}function I(F){var M=Number(F);if(!isNaN(M))return M;var $=F.toLowerCase();if($==="true")return!0;else if($==="false")return!1;return F}function H(F,M){var $;if(Z.compact){if(!q[Z[F+"Key"]]&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(Z[F+"Key"])!==-1:Z.alwaysArray))q[Z[F+"Key"]]=[];if(q[Z[F+"Key"]]&&!K(q[Z[F+"Key"]]))q[Z[F+"Key"]]=[q[Z[F+"Key"]]];if(F+"Fn"in Z&&typeof M==="string")M=Z[F+"Fn"](M,q);if(F==="instruction"&&(("instructionFn"in Z)||("instructionNameFn"in Z))){for($ in M)if(M.hasOwnProperty($))if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);else{var x=M[$];delete M[$],M[Z.instructionNameFn($,x,q)]=x}}if(K(q[Z[F+"Key"]]))q[Z[F+"Key"]].push(M);else q[Z[F+"Key"]]=M}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];var w={};if(w[Z.typeKey]=F,F==="instruction"){for($ in M)if(M.hasOwnProperty($))break;if(w[Z.nameKey]="instructionNameFn"in Z?Z.instructionNameFn($,M,q):$,Z.instructionHasAttributes){if(w[Z.attributesKey]=M[$][Z.attributesKey],"instructionFn"in Z)w[Z.attributesKey]=Z.instructionFn(w[Z.attributesKey],$,q)}else{if("instructionFn"in Z)M[$]=Z.instructionFn(M[$],$,q);w[Z.instructionKey]=M[$]}}else{if(F+"Fn"in Z)M=Z[F+"Fn"](M,q);w[Z[F+"Key"]]=M}if(Z.addParent)w[Z.parentKey]=q;q[Z.elementsKey].push(w)}}function T(F){if("attributesFn"in Z&&F)F=Z.attributesFn(F,q);if((Z.trim||("attributeValueFn"in Z)||("attributeNameFn"in Z)||Z.nativeTypeAttributes)&&F){var M;for(M in F)if(F.hasOwnProperty(M)){if(Z.trim)F[M]=F[M].trim();if(Z.nativeTypeAttributes)F[M]=I(F[M]);if("attributeValueFn"in Z)F[M]=Z.attributeValueFn(F[M],M,q);if("attributeNameFn"in Z){var $=F[M];delete F[M],F[Z.attributeNameFn(M,F[M],q)]=$}}}return F}function A(F){var M={};if(F.body&&(F.name.toLowerCase()==="xml"||Z.instructionHasAttributes)){var $=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,x;while((x=$.exec(F.body))!==null)M[x[1]]=x[2]||x[3]||x[4];M=T(M)}if(F.name.toLowerCase()==="xml"){if(Z.ignoreDeclaration)return;if(q[Z.declarationKey]={},Object.keys(M).length)q[Z.declarationKey][Z.attributesKey]=M;if(Z.addParent)q[Z.declarationKey][Z.parentKey]=q}else{if(Z.ignoreInstruction)return;if(Z.trim)F.body=F.body.trim();var w={};if(Z.instructionHasAttributes&&Object.keys(M).length)w[F.name]={},w[F.name][Z.attributesKey]=M;else w[F.name]=F.body;H("instruction",w)}}function P(F,M){var $;if(typeof F==="object")M=F.attributes,F=F.name;if(M=T(M),"elementNameFn"in Z)F=Z.elementNameFn(F,q);if(Z.compact){if($={},!Z.ignoreAttributes&&M&&Object.keys(M).length){$[Z.attributesKey]={};var x;for(x in M)if(M.hasOwnProperty(x))$[Z.attributesKey][x]=M[x]}if(!(F in q)&&(K(Z.alwaysArray)?Z.alwaysArray.indexOf(F)!==-1:Z.alwaysArray))q[F]=[];if(q[F]&&!K(q[F]))q[F]=[q[F]];if(K(q[F]))q[F].push($);else q[F]=$}else{if(!q[Z.elementsKey])q[Z.elementsKey]=[];if($={},$[Z.typeKey]="element",$[Z.nameKey]=F,!Z.ignoreAttributes&&M&&Object.keys(M).length)$[Z.attributesKey]=M;if(Z.alwaysChildren)$[Z.elementsKey]=[];q[Z.elementsKey].push($)}$[Z.parentKey]=q,q=$}function j(F){if(Z.ignoreText)return;if(!F.trim()&&!Z.captureSpacesBetweenElements)return;if(Z.trim)F=F.trim();if(Z.nativeType)F=I(F);if(Z.sanitize)F=F.replace(/&/g,"&").replace(//g,">");H("text",F)}function E(F){if(Z.ignoreComment)return;if(Z.trim)F=F.trim();H("comment",F)}function C(F){var M=q[Z.parentKey];if(!Z.addParent)delete q[Z.parentKey];q=M}function N(F){if(Z.ignoreCdata)return;if(Z.trim)F=F.trim();H("cdata",F)}function v(F){if(Z.ignoreDoctype)return;if(F=F.replace(/^ /,""),Z.trim)F=F.trim();H("doctype",F)}function S(F){F.note=F}U.exports=function(F,M){var $=J?G.parser(!0,{}):$=new Y.Parser("UTF-8"),x={};if(q=x,Z=W(M),J)$.opt={strictEntities:!0},$.onopentag=P,$.ontext=j,$.oncomment=E,$.onclosetag=C,$.onerror=S,$.oncdata=N,$.ondoctype=v,$.onprocessinginstruction=A;else $.on("startElement",P),$.on("text",j),$.on("comment",E),$.on("endElement",C),$.on("error",S);if(J)$.write(F).close();else if(!$.parse(F))throw Error("XML parsing error: "+$.getError());if(x[Z.elementsKey]){var w=x[Z.elementsKey];delete x[Z.elementsKey],x[Z.elementsKey]=w,delete x.text}return x}}),YG=R0((B,U)=>{var G=h8(),Y=TB();function Q(K){var Z=G.copyOptions(K);return G.ensureSpacesExists(Z),Z}U.exports=function(K,Z){var J=Q(Z),q=Y(K,J),W,I="compact"in J&&J.compact?"_parent":"parent";if("addParent"in J&&J.addParent)W=JSON.stringify(q,function(H,T){return H===I?"_":T},J.spaces);else W=JSON.stringify(q,null,J.spaces);return W.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}}),CB=R0((B,U)=>{var G=h8(),Y=_8().isArray,Q,K;function Z(F){var M=G.copyOptions(F);if(G.ensureFlagExists("ignoreDeclaration",M),G.ensureFlagExists("ignoreInstruction",M),G.ensureFlagExists("ignoreAttributes",M),G.ensureFlagExists("ignoreText",M),G.ensureFlagExists("ignoreComment",M),G.ensureFlagExists("ignoreCdata",M),G.ensureFlagExists("ignoreDoctype",M),G.ensureFlagExists("compact",M),G.ensureFlagExists("indentText",M),G.ensureFlagExists("indentCdata",M),G.ensureFlagExists("indentAttributes",M),G.ensureFlagExists("indentInstruction",M),G.ensureFlagExists("fullTagEmptyElement",M),G.ensureFlagExists("noQuotesForNativeAttributes",M),G.ensureSpacesExists(M),typeof M.spaces==="number")M.spaces=Array(M.spaces+1).join(" ");return G.ensureKeyExists("declaration",M),G.ensureKeyExists("instruction",M),G.ensureKeyExists("attributes",M),G.ensureKeyExists("text",M),G.ensureKeyExists("comment",M),G.ensureKeyExists("cdata",M),G.ensureKeyExists("doctype",M),G.ensureKeyExists("type",M),G.ensureKeyExists("name",M),G.ensureKeyExists("elements",M),G.checkFnExists("doctype",M),G.checkFnExists("instruction",M),G.checkFnExists("cdata",M),G.checkFnExists("comment",M),G.checkFnExists("text",M),G.checkFnExists("instructionName",M),G.checkFnExists("elementName",M),G.checkFnExists("attributeName",M),G.checkFnExists("attributeValue",M),G.checkFnExists("attributes",M),G.checkFnExists("fullTagEmptyElement",M),M}function J(F,M,$){return(!$&&F.spaces?` +`:"")+Array(M+1).join(F.spaces)}function q(F,M,$){if(M.ignoreAttributes)return"";if("attributesFn"in M)F=M.attributesFn(F,K,Q);var x,w,a,U0,b=[];for(x in F)if(F.hasOwnProperty(x)&&F[x]!==null&&F[x]!==void 0)U0=M.noQuotesForNativeAttributes&&typeof F[x]!=="string"?"":'"',w=""+F[x],w=w.replace(/"/g,"""),a="attributeNameFn"in M?M.attributeNameFn(x,w,K,Q):x,b.push(M.spaces&&M.indentAttributes?J(M,$+1,!1):" "),b.push(a+"="+U0+("attributeValueFn"in M?M.attributeValueFn(w,x,K,Q):w)+U0);if(F&&Object.keys(F).length&&M.spaces&&M.indentAttributes)b.push(J(M,$,!1));return b.join("")}function W(F,M,$){return Q=F,K="xml",M.ignoreDeclaration?"":""}function I(F,M,$){if(M.ignoreInstruction)return"";var x;for(x in F)if(F.hasOwnProperty(x))break;var w="instructionNameFn"in M?M.instructionNameFn(x,F[x],K,Q):x;if(typeof F[x]==="object")return Q=F,K=w,"";else{var a=F[x]?F[x]:"";if("instructionFn"in M)a=M.instructionFn(a,x,K,Q);return""}}function H(F,M){return M.ignoreComment?"":""}function T(F,M){return M.ignoreCdata?"":"","]]]]>"))+"]]>"}function A(F,M){return M.ignoreDoctype?"":""}function P(F,M){if(M.ignoreText)return"";return F=""+F,F=F.replace(/&/g,"&"),F=F.replace(/&/g,"&").replace(//g,">"),"textFn"in M?M.textFn(F,K,Q):F}function j(F,M){var $;if(F.elements&&F.elements.length)for($=0;$"),F[M.elementsKey]&&F[M.elementsKey].length)x.push(C(F[M.elementsKey],M,$+1)),Q=F,K=F.name;x.push(M.spaces&&j(F,M)?` +`+Array($+1).join(M.spaces):""),x.push("")}else x.push("/>");return x.join("")}function C(F,M,$,x){return F.reduce(function(w,a){var U0=J(M,$,x&&!w);switch(a.type){case"element":return w+U0+E(a,M,$);case"comment":return w+U0+H(a[M.commentKey],M);case"doctype":return w+U0+A(a[M.doctypeKey],M);case"cdata":return w+(M.indentCdata?U0:"")+T(a[M.cdataKey],M);case"text":return w+(M.indentText?U0:"")+P(a[M.textKey],M);case"instruction":var b={};return b[a[M.nameKey]]=a[M.attributesKey]?a:a[M.instructionKey],w+(M.indentInstruction?U0:"")+I(b,M,$)}},"")}function N(F,M,$){var x;for(x in F)if(F.hasOwnProperty(x))switch(x){case M.parentKey:case M.attributesKey:break;case M.textKey:if(M.indentText||$)return!0;break;case M.cdataKey:if(M.indentCdata||$)return!0;break;case M.instructionKey:if(M.indentInstruction||$)return!0;break;case M.doctypeKey:case M.commentKey:return!0;default:return!0}return!1}function v(F,M,$,x,w){Q=F,K=M;var a="elementNameFn"in $?$.elementNameFn(M,F):M;if(typeof F>"u"||F===null||F==="")return"fullTagEmptyElementFn"in $&&$.fullTagEmptyElementFn(M,F)||$.fullTagEmptyElement?"<"+a+">":"<"+a+"/>";var U0=[];if(M){if(U0.push("<"+a),typeof F!=="object")return U0.push(">"+P(F,$)+""),U0.join("");if(F[$.attributesKey])U0.push(q(F[$.attributesKey],$,x));var b=N(F,$,!0)||F[$.attributesKey]&&F[$.attributesKey]["xml:space"]==="preserve";if(!b)if("fullTagEmptyElementFn"in $)b=$.fullTagEmptyElementFn(M,F);else b=$.fullTagEmptyElement;if(b)U0.push(">");else return U0.push("/>"),U0.join("")}if(U0.push(S(F,$,x+1,!1)),Q=F,K=M,M)U0.push((w?J($,x,!1):"")+"");return U0.join("")}function S(F,M,$,x){var w,a,U0,b=[];for(a in F)if(F.hasOwnProperty(a)){U0=Y(F[a])?F[a]:[F[a]];for(w=0;w{var G=CB();U.exports=function(Y,Q){if(Y instanceof Buffer)Y=Y.toString();var K=null;if(typeof Y==="string")try{K=JSON.parse(Y)}catch(Z){throw Error("The JSON structure is invalid")}else K=Y;return G(K,Q)}}),h1=R0((B,U)=>{U.exports={xml2js:TB(),xml2json:YG(),js2xml:CB(),json2xml:ZG()}})(),u1=(B)=>{switch(B.type){case void 0:case"element":let U=new kB(B.name,B.attributes),G=B.elements||[];for(let Y of G){let Q=u1(Y);if(Q!==void 0)U.push(Q)}return U;case"text":return B.text;default:return}},QG=class extends H0{},kB=class extends t{static fromXmlString(B){return u1((0,h1.xml2js)(B,{compact:!1}))}constructor(B,U){super(B);if(U)this.root.push(new QG(U))}push(B){this.root.push(B)}},$B=class extends t{constructor(B){super("");e(this,"_attr",void 0),this._attr=B}prepForXml(B){return{_attr:this._attr}}},JG="",u8=class extends t{constructor(B,U){super(B);if(U)this.root=U.root}},T0=(B)=>{if(isNaN(B))throw Error(`Invalid value '${B}' specified. Must be an integer.`);return Math.floor(B)},X1=(B)=>{let U=T0(B);if(U<0)throw Error(`Invalid value '${B}' specified. Must be a positive integer.`);return U},d1=(B,U)=>{let G=U*2;if(B.length!==G||isNaN(Number(`0x${B}`)))throw Error(`Invalid hex value '${B}'. Expected ${G} digit hex value`);return B},KG=(B)=>d1(B,4),SB=(B)=>d1(B,2),W8=(B)=>d1(B,1),q1=(B)=>{let U=B.slice(-2),G=B.substring(0,B.length-2);return`${Number(G)}${U}`},d8=(B)=>{let U=q1(B);if(parseFloat(U)<0)throw Error(`Invalid value '${U}' specified. Expected a positive number.`);return U},C2=(B)=>{if(B==="auto")return B;return d1(B.charAt(0)==="#"?B.substring(1):B,3)},t0=(B)=>typeof B==="string"?q1(B):T0(B),bB=(B)=>typeof B==="string"?d8(B):X1(B),VG=(B)=>typeof B==="string"?q1(B):T0(B),E0=(B)=>typeof B==="string"?d8(B):X1(B),vB=(B)=>{let U=B.substring(0,B.length-1);return`${Number(U)}%`},c8=(B)=>{if(typeof B==="number")return T0(B);if(B.slice(-1)==="%")return vB(B);return q1(B)},yB=X1,gB=X1,fB=(B)=>B.toISOString(),q0=class extends t{constructor(B,U=!0){super(B);if(U!==!0)this.root.push(new C0({val:U}))}},D1=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:bB(U)}))}},S0=class extends t{},q2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},f2=(B,U)=>new M0({name:B,attributes:{value:{key:"w:val",value:U}}}),_2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},XG=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},O2=class extends t{constructor(B,U){super(B);this.root.push(U)}},M0=class extends t{constructor({name:B,attributes:U,children:G}){super(B);if(U)this.root.push(new $8(U));if(G)this.root.push(...G)}},c0={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},m8=(B)=>new M0({name:"w:jc",attributes:{val:{key:"w:val",value:B}}}),j0=(B,{color:U,size:G,space:Y,style:Q})=>new M0({name:B,attributes:{style:{key:"w:val",value:Q},color:{key:"w:color",value:U===void 0?void 0:C2(U)},size:{key:"w:sz",value:G===void 0?void 0:yB(G)},space:{key:"w:space",value:Y===void 0?void 0:gB(Y)}}}),c1={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},xB=class extends R2{constructor(B){super("w:pBdr");if(B.top)this.root.push(j0("w:top",B.top));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.left)this.root.push(j0("w:left",B.left));if(B.right)this.root.push(j0("w:right",B.right));if(B.between)this.root.push(j0("w:between",B.between))}},_B=class extends t{constructor(){super("w:pBdr");let B=j0("w:bottom",{color:"auto",space:1,style:c1.SINGLE,size:6});this.root.push(B)}},hB=({start:B,end:U,left:G,right:Y,hanging:Q,firstLine:K,firstLineChars:Z})=>new M0({name:"w:ind",attributes:{start:{key:"w:start",value:B===void 0?void 0:t0(B)},end:{key:"w:end",value:U===void 0?void 0:t0(U)},left:{key:"w:left",value:G===void 0?void 0:t0(G)},right:{key:"w:right",value:Y===void 0?void 0:t0(Y)},hanging:{key:"w:hanging",value:Q===void 0?void 0:E0(Q)},firstLine:{key:"w:firstLine",value:K===void 0?void 0:E0(K)},firstLineChars:{key:"w:firstLineChars",value:Z===void 0?void 0:T0(Z)}}}),uB=()=>new M0({name:"w:br"}),l8={BEGIN:"begin",END:"end",SEPARATE:"separate"},a8=(B,U)=>new M0({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:B},dirty:{key:"w:dirty",value:U}}}),e0=(B)=>a8(l8.BEGIN,B),X2=(B)=>a8(l8.SEPARATE,B),B2=(B)=>a8(l8.END,B),qG={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},MG={BOTTOM:"bottom",CENTER:"center",INSIDE:"inside",OUTSIDE:"outside",TOP:"top"},RG={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},x0={DEFAULT:"default",PRESERVE:"preserve"},_0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{space:"xml:space"})}},LG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},IG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},OG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},HG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTION")}},M1=({fill:B,color:U,type:G})=>new M0({name:"w:shd",attributes:{fill:{key:"w:fill",value:B===void 0?void 0:C2(B)},color:{key:"w:color",value:U===void 0?void 0:C2(U)},type:{key:"w:val",value:G}}}),FG={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},b0=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},WG=class extends t{constructor(B){super("w:del");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},PG=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},p8={DOT:"dot"},r8=(B=p8.DOT)=>new M0({name:"w:em",attributes:{val:{key:"w:val",value:B}}}),AG=()=>r8(p8.DOT),jG=class extends t{constructor(B){super("w:spacing");this.root.push(new C0({val:t0(B)}))}},NG=class extends t{constructor(B){super("w:color");this.root.push(new C0({val:C2(B)}))}},wG=class extends t{constructor(B){super("w:highlight");this.root.push(new C0({val:B}))}},zG=class extends t{constructor(B){super("w:highlightCs");this.root.push(new C0({val:B}))}},EG=(B)=>new M0({name:"w:lang",attributes:{value:{key:"w:val",value:B.value},eastAsia:{key:"w:eastAsia",value:B.eastAsia},bidirectional:{key:"w:bidi",value:B.bidirectional}}}),T1=(B,U)=>{if(typeof B==="string"){let Y=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:Y},cs:{key:"w:cs",value:Y},eastAsia:{key:"w:eastAsia",value:Y},hAnsi:{key:"w:hAnsi",value:Y},hint:{key:"w:hint",value:U}}})}let G=B;return new M0({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:G.ascii},cs:{key:"w:cs",value:G.cs},eastAsia:{key:"w:eastAsia",value:G.eastAsia},hAnsi:{key:"w:hAnsi",value:G.hAnsi},hint:{key:"w:hint",value:G.hint}}})},dB=(B)=>new M0({name:"w:vertAlign",attributes:{val:{key:"w:val",value:B}}}),DG=()=>dB("superscript"),TG=()=>dB("subscript"),i8={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},cB=(B=i8.SINGLE,U)=>new M0({name:"w:u",attributes:{val:{key:"w:val",value:B},color:{key:"w:color",value:U===void 0?void 0:C2(U)}}}),CG={BLINK_BACKGROUND:"blinkBackground",LIGHTS:"lights",ANTS_BLACK:"antsBlack",ANTS_RED:"antsRed",SHIMMER:"shimmer",SPARKLE:"sparkle",NONE:"none"},kG={BLACK:"black",BLUE:"blue",CYAN:"cyan",DARK_BLUE:"darkBlue",DARK_CYAN:"darkCyan",DARK_GRAY:"darkGray",DARK_GREEN:"darkGreen",DARK_MAGENTA:"darkMagenta",DARK_RED:"darkRed",DARK_YELLOW:"darkYellow",GREEN:"green",LIGHT_GRAY:"lightGray",MAGENTA:"magenta",NONE:"none",RED:"red",WHITE:"white",YELLOW:"yellow"},U2=class extends R2{constructor(B){super("w:rPr");if(!B)return;if(B.style)this.push(new q2("w:rStyle",B.style));if(B.font)if(typeof B.font==="string")this.push(T1(B.font));else if("name"in B.font)this.push(T1(B.font.name,B.font.hint));else this.push(T1(B.font));if(B.bold!==void 0)this.push(new q0("w:b",B.bold));if(B.boldComplexScript===void 0&&B.bold!==void 0||B.boldComplexScript){var U;this.push(new q0("w:bCs",(U=B.boldComplexScript)!==null&&U!==void 0?U:B.bold))}if(B.italics!==void 0)this.push(new q0("w:i",B.italics));if(B.italicsComplexScript===void 0&&B.italics!==void 0||B.italicsComplexScript){var G;this.push(new q0("w:iCs",(G=B.italicsComplexScript)!==null&&G!==void 0?G:B.italics))}if(B.smallCaps!==void 0)this.push(new q0("w:smallCaps",B.smallCaps));else if(B.allCaps!==void 0)this.push(new q0("w:caps",B.allCaps));if(B.strike!==void 0)this.push(new q0("w:strike",B.strike));if(B.doubleStrike!==void 0)this.push(new q0("w:dstrike",B.doubleStrike));if(B.emboss!==void 0)this.push(new q0("w:emboss",B.emboss));if(B.imprint!==void 0)this.push(new q0("w:imprint",B.imprint));if(B.noProof!==void 0)this.push(new q0("w:noProof",B.noProof));if(B.snapToGrid!==void 0)this.push(new q0("w:snapToGrid",B.snapToGrid));if(B.vanish)this.push(new q0("w:vanish",B.vanish));if(B.color)this.push(new NG(B.color));if(B.characterSpacing)this.push(new jG(B.characterSpacing));if(B.scale!==void 0)this.push(new _2("w:w",B.scale));if(B.kern)this.push(new D1("w:kern",B.kern));if(B.position)this.push(new q2("w:position",B.position));if(B.size!==void 0)this.push(new D1("w:sz",B.size));let Y=B.sizeComplexScript===void 0||B.sizeComplexScript===!0?B.size:B.sizeComplexScript;if(Y)this.push(new D1("w:szCs",Y));if(B.highlight)this.push(new wG(B.highlight));let Q=B.highlightComplexScript===void 0||B.highlightComplexScript===!0?B.highlight:B.highlightComplexScript;if(Q)this.push(new zG(Q));if(B.underline)this.push(cB(B.underline.type,B.underline.color));if(B.effect)this.push(new q2("w:effect",B.effect));if(B.border)this.push(j0("w:bdr",B.border));if(B.shading)this.push(M1(B.shading));if(B.subScript)this.push(TG());if(B.superScript)this.push(DG());if(B.rightToLeft!==void 0)this.push(new q0("w:rtl",B.rightToLeft));if(B.emphasisMark)this.push(r8(B.emphasisMark.type));if(B.language)this.push(EG(B.language));if(B.specVanish)this.push(new q0("w:specVanish",B.vanish));if(B.math)this.push(new q0("w:oMath",B.math));if(B.revision)this.push(new lB(B.revision))}push(B){this.root.push(B)}},mB=class extends U2{constructor(B){super(B);if(B===null||B===void 0?void 0:B.insertion)this.push(new PG(B.insertion));if(B===null||B===void 0?void 0:B.deletion)this.push(new WG(B.deletion))}},lB=class extends t{constructor(B){super("w:rPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new U2(B))}},Z1=class extends t{constructor(B){super("w:t");if(typeof B==="string")this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B);else{var U;this.root.push(new _0({space:(U=B.space)!==null&&U!==void 0?U:x0.DEFAULT})),this.root.push(B.text)}}},F2={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},D0=class extends t{constructor(B){super("w:r");if(e(this,"properties",void 0),this.properties=new U2(B),this.root.push(this.properties),B.break)for(let U=0;U{U.exports=G;function G(Y,Q){if(!Y)throw Error(Q||"Assertion failed")}G.equal=function(Q,K,Z){if(Q!=K)throw Error(Z||"Assertion failed: "+Q+" != "+K)}}),G2=R0((B)=>{var U=R1();B.inherits=W2();function G(b,c){if((b.charCodeAt(c)&64512)!==55296)return!1;if(c<0||c+1>=b.length)return!1;return(b.charCodeAt(c+1)&64512)===56320}function Y(b,c){if(Array.isArray(b))return b.slice();if(!b)return[];var D=[];if(typeof b==="string"){if(!c){var m=0;for(var B0=0;B0>6|192,D[m++]=i&63|128;else if(G(b,B0))i=65536+((i&1023)<<10)+(b.charCodeAt(++B0)&1023),D[m++]=i>>18|240,D[m++]=i>>12&63|128,D[m++]=i>>6&63|128,D[m++]=i&63|128;else D[m++]=i>>12|224,D[m++]=i>>6&63|128,D[m++]=i&63|128}}else if(c==="hex"){if(b=b.replace(/[^a-z0-9]+/gi,""),b.length%2!==0)b="0"+b;for(B0=0;B0>>24|b>>>8&65280|b<<8&16711680|(b&255)<<24)>>>0}B.htonl=K;function Z(b,c){var D="";for(var m=0;m>>0}return i}B.join32=W;function I(b,c){var D=Array(b.length*4);for(var m=0,B0=0;m>>24,D[B0+1]=i>>>16&255,D[B0+2]=i>>>8&255,D[B0+3]=i&255;else D[B0+3]=i>>>24,D[B0+2]=i>>>16&255,D[B0+1]=i>>>8&255,D[B0]=i&255}return D}B.split32=I;function H(b,c){return b>>>c|b<<32-c}B.rotr32=H;function T(b,c){return b<>>32-c}B.rotl32=T;function A(b,c){return b+c>>>0}B.sum32=A;function P(b,c,D){return b+c+D>>>0}B.sum32_3=P;function j(b,c,D,m){return b+c+D+m>>>0}B.sum32_4=j;function E(b,c,D,m,B0){return b+c+D+m+B0>>>0}B.sum32_5=E;function C(b,c,D,m){var B0=b[c],i=m+b[c+1]>>>0;b[c]=(i>>0,b[c+1]=i}B.sum64=C;function N(b,c,D,m){return(c+m>>>0>>0}B.sum64_hi=N;function v(b,c,D,m){return c+m>>>0}B.sum64_lo=v;function S(b,c,D,m,B0,i,V0,s){var G0=0,r=c;return r=r+m>>>0,G0+=r>>0,G0+=r>>0,G0+=r>>0}B.sum64_4_hi=S;function F(b,c,D,m,B0,i,V0,s){return c+m+i+s>>>0}B.sum64_4_lo=F;function M(b,c,D,m,B0,i,V0,s,G0,r){var y=0,n=c;return n=n+m>>>0,y+=n>>0,y+=n>>0,y+=n>>0,y+=n>>0}B.sum64_5_hi=M;function $(b,c,D,m,B0,i,V0,s,G0,r){return c+m+i+s+r>>>0}B.sum64_5_lo=$;function x(b,c,D){return(c<<32-D|b>>>D)>>>0}B.rotr64_hi=x;function w(b,c,D){return(b<<32-D|c>>>D)>>>0}B.rotr64_lo=w;function a(b,c,D){return b>>>D}B.shr64_hi=a;function U0(b,c,D){return(b<<32-D|c>>>D)>>>0}B.shr64_lo=U0}),L1=R0((B)=>{var U=G2(),G=R1();function Y(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}B.BlockHash=Y,Y.prototype.update=function(K,Z){if(K=U.toArray(K,Z),!this.pending)this.pending=K;else this.pending=this.pending.concat(K);if(this.pendingTotal+=K.length,this.pending.length>=this._delta8){K=this.pending;var J=K.length%this._delta8;if(this.pending=K.slice(K.length-J,K.length),this.pending.length===0)this.pending=null;K=U.join32(K,0,K.length-J,this.endian);for(var q=0;q>>24&255,q[W++]=K>>>16&255,q[W++]=K>>>8&255,q[W++]=K&255}else{q[W++]=K&255,q[W++]=K>>>8&255,q[W++]=K>>>16&255,q[W++]=K>>>24&255,q[W++]=0,q[W++]=0,q[W++]=0,q[W++]=0;for(I=8;I{var U=G2().rotr32;function G(I,H,T,A){if(I===0)return Y(H,T,A);if(I===1||I===3)return K(H,T,A);if(I===2)return Q(H,T,A)}B.ft_1=G;function Y(I,H,T){return I&H^~I&T}B.ch32=Y;function Q(I,H,T){return I&H^I&T^H&T}B.maj32=Q;function K(I,H,T){return I^H^T}B.p32=K;function Z(I){return U(I,2)^U(I,13)^U(I,22)}B.s0_256=Z;function J(I){return U(I,6)^U(I,11)^U(I,25)}B.s1_256=J;function q(I){return U(I,7)^U(I,18)^I>>>3}B.g0_256=q;function W(I){return U(I,17)^U(I,19)^I>>>10}B.g1_256=W}),SG=R0((B,U)=>{var G=G2(),Y=L1(),Q=pB(),K=G.rotl32,Z=G.sum32,J=G.sum32_5,q=Q.ft_1,W=Y.BlockHash,I=[1518500249,1859775393,2400959708,3395469782];function H(){if(!(this instanceof H))return new H;W.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}G.inherits(H,W),U.exports=H,H.blockSize=512,H.outSize=160,H.hmacStrength=80,H.padLength=64,H.prototype._update=function(A,P){var j=this.W;for(var E=0;E<16;E++)j[E]=A[P+E];for(;E{var G=G2(),Y=L1(),Q=pB(),K=R1(),Z=G.sum32,J=G.sum32_4,q=G.sum32_5,W=Q.ch32,I=Q.maj32,H=Q.s0_256,T=Q.s1_256,A=Q.g0_256,P=Q.g1_256,j=Y.BlockHash,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function C(){if(!(this instanceof C))return new C;j.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=Array(64)}G.inherits(C,j),U.exports=C,C.blockSize=512,C.outSize=256,C.hmacStrength=192,C.padLength=64,C.prototype._update=function(v,S){var F=this.W;for(var M=0;M<16;M++)F[M]=v[S+M];for(;M{var G=G2(),Y=rB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=512,Q.outSize=224,Q.hmacStrength=192,Q.padLength=64,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),iB=R0((B,U)=>{var G=G2(),Y=L1(),Q=R1(),K=G.rotr64_hi,Z=G.rotr64_lo,J=G.shr64_hi,q=G.shr64_lo,W=G.sum64,I=G.sum64_hi,H=G.sum64_lo,T=G.sum64_4_hi,A=G.sum64_4_lo,P=G.sum64_5_hi,j=G.sum64_5_lo,E=Y.BlockHash,C=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function N(){if(!(this instanceof N))return new N;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=C,this.W=Array(160)}G.inherits(N,E),U.exports=N,N.blockSize=1024,N.outSize=512,N.hmacStrength=192,N.padLength=128,N.prototype._prepareBlock=function(B0,i){var V0=this.W;for(var s=0;s<32;s++)V0[s]=B0[i+s];for(;s{var G=G2(),Y=iB();function Q(){if(!(this instanceof Q))return new Q;Y.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}G.inherits(Q,Y),U.exports=Q,Q.blockSize=1024,Q.outSize=384,Q.hmacStrength=192,Q.padLength=128,Q.prototype._digest=function(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),yG=R0((B)=>{B.sha1=SG(),B.sha224=bG(),B.sha256=rB(),B.sha384=vG(),B.sha512=iB()}),gG=R0((B)=>{var U=G2(),G=L1(),Y=U.rotl32,Q=U.sum32,K=U.sum32_3,Z=U.sum32_4,J=G.BlockHash;function q(){if(!(this instanceof q))return new q;J.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}U.inherits(q,J),B.ripemd160=q,q.blockSize=512,q.outSize=160,q.hmacStrength=192,q.padLength=64,q.prototype._update=function(C,N){var v=this.h[0],S=this.h[1],F=this.h[2],M=this.h[3],$=this.h[4],x=v,w=S,a=F,U0=M,b=$;for(var c=0;c<80;c++){var D=Q(Y(Z(v,W(c,S,F,M),C[T[c]+N],I(c)),P[c]),$);v=$,$=M,M=Y(F,10),F=S,S=D,D=Q(Y(Z(x,W(79-c,w,a,U0),C[A[c]+N],H(c)),j[c]),b),x=b,b=U0,U0=Y(a,10),a=w,w=D}D=K(this.h[1],F,U0),this.h[1]=K(this.h[2],M,b),this.h[2]=K(this.h[3],$,x),this.h[3]=K(this.h[4],v,w),this.h[4]=K(this.h[0],S,a),this.h[0]=D},q.prototype._digest=function(C){if(C==="hex")return U.toHex32(this.h,"little");else return U.split32(this.h,"little")};function W(E,C,N,v){if(E<=15)return C^N^v;else if(E<=31)return C&N|~C&v;else if(E<=47)return(C|~N)^v;else if(E<=63)return C&v|N&~v;else return C^(N|~v)}function I(E){if(E<=15)return 0;else if(E<=31)return 1518500249;else if(E<=47)return 1859775393;else if(E<=63)return 2400959708;else return 2840853838}function H(E){if(E<=15)return 1352829926;else if(E<=31)return 1548603684;else if(E<=47)return 1836072691;else if(E<=63)return 2053994217;else return 0}var T=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],A=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],P=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],j=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),fG=R0((B,U)=>{var G=G2(),Y=R1();function Q(K,Z,J){if(!(this instanceof Q))return new Q(K,Z,J);this.Hash=K,this.blockSize=K.blockSize/8,this.outSize=K.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(Z,J))}U.exports=Q,Q.prototype._init=function(Z){if(Z.length>this.blockSize)Z=new this.Hash().update(Z).digest();Y(Z.length<=this.blockSize);for(var J=Z.length;J{var U=B;U.utils=G2(),U.common=L1(),U.sha=yG(),U.ripemd=gG(),U.hmac=fG(),U.sha1=U.sha.sha1,U.sha256=U.sha.sha256,U.sha224=U.sha.sha224,U.sha384=U.sha.sha384,U.sha512=U.sha.sha512,U.ripemd160=U.ripemd.ripemd160})(),1),_G="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",hG=(B,U=21)=>{return(G=U)=>{let Y="",Q=G|0;while(Q--)Y+=B[Math.random()*B.length|0];return Y}},uG=(B=21)=>{let U="",G=B|0;while(G--)U+=_G[Math.random()*64|0];return U},dG=(B)=>Math.floor(B/25.4*72*20),u0=(B)=>Math.floor(B*72*20),I1=(B=0)=>{let U=B;return()=>++U},nB=()=>I1(),sB=()=>I1(1),oB=()=>I1(),tB=()=>I1(),O1=()=>uG().toLowerCase(),P8=(B)=>xG.default.sha1().update(B instanceof ArrayBuffer?new Uint8Array(B):B).digest("hex"),s2=(B)=>hG("1234567890abcdef",B)(),eB=()=>`${s2(8)}-${s2(4)}-${s2(4)}-${s2(4)}-${s2(12)}`,U1=(B)=>new Uint8Array(new TextEncoder().encode(B)),B4={CHARACTER:"character",COLUMN:"column",INSIDE_MARGIN:"insideMargin",LEFT_MARGIN:"leftMargin",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",RIGHT_MARGIN:"rightMargin"},U4={BOTTOM_MARGIN:"bottomMargin",INSIDE_MARGIN:"insideMargin",LINE:"line",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",PARAGRAPH:"paragraph",TOP_MARGIN:"topMargin"},G4=()=>new M0({name:"wp:simplePos",attributes:{x:{key:"x",value:0},y:{key:"y",value:0}}}),Y4=(B)=>new M0({name:"wp:align",children:[B]}),Z4=(B)=>new M0({name:"wp:posOffset",children:[B.toString()]}),Q4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionH",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:B4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),J4=({relative:B,align:U,offset:G})=>new M0({name:"wp:positionV",attributes:{relativeFrom:{key:"relativeFrom",value:B!==null&&B!==void 0?B:U4.PAGE}},children:[(()=>{if(U)return Y4(U);else if(G!==void 0)return Z4(G);else throw Error("There is no configuration provided for floating position (Align or offset)")})()]}),cG=function(B){return B.CENTER="ctr",B.TOP="t",B.BOTTOM="b",B}({}),K4=(B={})=>{var U,G,Y,Q;return new M0({name:"wps:bodyPr",attributes:{lIns:{key:"lIns",value:(U=B.margins)===null||U===void 0?void 0:U.left},rIns:{key:"rIns",value:(G=B.margins)===null||G===void 0?void 0:G.right},tIns:{key:"tIns",value:(Y=B.margins)===null||Y===void 0?void 0:Y.top},bIns:{key:"bIns",value:(Q=B.margins)===null||Q===void 0?void 0:Q.bottom},anchor:{key:"anchor",value:B.verticalAnchor}},children:[...B.noAutoFit?[new q0("a:noAutofit",B.noAutoFit)]:[]]})},mG=(B={txBox:"1"})=>new M0({name:"wps:cNvSpPr",attributes:{txBox:{key:"txBox",value:B.txBox}}}),lG=(B)=>new M0({name:"w:txbxContent",children:[...B]}),aG=(B)=>new M0({name:"wps:txbx",children:[lG(B)]}),pG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{cx:"cx",cy:"cy"})}},rG=class extends t{constructor(B,U){super("a:ext");e(this,"attributes",void 0),this.attributes=new pG({cx:B,cy:U}),this.root.push(this.attributes)}},iG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{x:"x",y:"y"})}},nG=class extends t{constructor(B,U){super("a:off");this.root.push(new iG({x:B!==null&&B!==void 0?B:0,y:U!==null&&U!==void 0?U:0}))}},sG=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{flipVertical:"flipV",flipHorizontal:"flipH",rotation:"rot"})}},V4=class extends t{constructor(B){var U,G,Y,Q;super("a:xfrm");e(this,"extents",void 0),e(this,"offset",void 0),this.root.push(new sG({flipVertical:(U=B.flip)===null||U===void 0?void 0:U.vertical,flipHorizontal:(G=B.flip)===null||G===void 0?void 0:G.horizontal,rotation:B.rotation})),this.offset=new nG((Y=B.offset)===null||Y===void 0||(Y=Y.emus)===null||Y===void 0?void 0:Y.x,(Q=B.offset)===null||Q===void 0||(Q=Q.emus)===null||Q===void 0?void 0:Q.y),this.extents=new rG(B.emus.x,B.emus.y),this.root.push(this.offset),this.root.push(this.extents)}},X4=()=>new M0({name:"a:noFill"}),oG=(B)=>new M0({name:"a:srgbClr",attributes:{value:{key:"val",value:B.value}}}),tG=(B)=>new M0({name:"a:schemeClr",attributes:{value:{key:"val",value:B.value}}}),A8=(B)=>new M0({name:"a:solidFill",children:[B.type==="rgb"?oG(B):tG(B)]}),eG=(B)=>new M0({name:"a:ln",attributes:{width:{key:"w",value:B.width},cap:{key:"cap",value:B.cap},compoundLine:{key:"cmpd",value:B.compoundLine},align:{key:"algn",value:B.align}},children:[B.type==="noFill"?X4():B.solidFillType==="rgb"?A8({type:"rgb",value:B.value}):A8({type:"scheme",value:B.value})]}),BY=class extends t{constructor(){super("a:avLst")}},UY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{prst:"prst"})}},GY=class extends t{constructor(){super("a:prstGeom");this.root.push(new UY({prst:"rect"})),this.root.push(new BY)}},YY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{bwMode:"bwMode"})}},q4=class extends t{constructor({element:B,outline:U,solidFill:G,transform:Y}){super(`${B}:spPr`);if(e(this,"form",void 0),this.root.push(new YY({bwMode:"auto"})),this.form=new V4(Y),this.root.push(this.form),this.root.push(new GY),U)this.root.push(X4()),this.root.push(eG(U));if(G)this.root.push(A8(G))}},l6=(B)=>new M0({name:"wps:wsp",children:[mG(B.nonVisualProperties),new q4({element:"wps",transform:B.transformation,outline:B.outline,solidFill:B.solidFill}),aG(B.children),K4(B.bodyProperties)]}),K8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{uri:"uri"})}},ZY=(B)=>new M0({name:"asvg:svgBlip",attributes:{asvg:{key:"xmlns:asvg",value:"http://schemas.microsoft.com/office/drawing/2016/SVG/main"},embed:{key:"r:embed",value:`rId{${B.fileName}}`}}}),QY=(B)=>new M0({name:"a:ext",attributes:{uri:{key:"uri",value:"{96DAC541-7B7A-43D3-8B79-37D633B846F1}"}},children:[ZY(B)]}),JY=(B)=>new M0({name:"a:extLst",children:[QY(B)]}),KY=(B)=>new M0({name:"a:blip",attributes:{embed:{key:"r:embed",value:`rId{${B.type==="svg"?B.fallback.fileName:B.fileName}}`},cstate:{key:"cstate",value:"none"}},children:B.type==="svg"?[JY(B)]:[]}),VY=class extends t{constructor(){super("a:srcRect")}},XY=class extends t{constructor(){super("a:fillRect")}},qY=class extends t{constructor(){super("a:stretch");this.root.push(new XY)}},MY=class extends t{constructor(B){super("pic:blipFill");this.root.push(KY(B)),this.root.push(new VY),this.root.push(new qY)}},RY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{noChangeAspect:"noChangeAspect",noChangeArrowheads:"noChangeArrowheads"})}},LY=class extends t{constructor(){super("a:picLocks");this.root.push(new RY({noChangeAspect:1,noChangeArrowheads:1}))}},IY=class extends t{constructor(){super("pic:cNvPicPr");this.root.push(new LY)}},M4=(B,U)=>new M0({name:"a:hlinkClick",attributes:L0(L0({},U?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${B}`}})}),OY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"id",name:"name",descr:"descr"})}},HY=class extends t{constructor(){super("pic:cNvPr");this.root.push(new OY({id:0,name:"",descr:""}))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!1));break}return super.prepForXml(B)}},FY=class extends t{constructor(){super("pic:nvPicPr");this.root.push(new HY),this.root.push(new IY)}},WY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:pic"})}},a6=class extends t{constructor({mediaData:B,transform:U,outline:G}){super("pic:pic");this.root.push(new WY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/picture"})),this.root.push(new FY),this.root.push(new MY(B)),this.root.push(new q4({element:"pic",transform:U,outline:G}))}},PY=(B)=>new M0({name:"wpg:grpSpPr",children:[new V4(B)]}),AY=()=>new M0({name:"wpg:cNvGrpSpPr"}),jY=(B)=>new M0({name:"wpg:wgp",children:[AY(),PY(B.transformation),...B.children]}),NY=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphicData");if(B.type==="wps"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));let Q=l6(L0(L0({},B.data),{},{transformation:U,outline:G,solidFill:Y}));this.root.push(Q)}else if(B.type==="wpg"){this.root.push(new K8({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"}));let Q=jY({children:B.children.map((K)=>{if(K.type==="wps")return l6(L0(L0({},K.data),{},{transformation:K.transformation,outline:K.outline,solidFill:K.solidFill}));else return new a6({mediaData:K,transform:K.transformation,outline:K.outline})}),transformation:U});this.root.push(Q)}else{this.root.push(new K8({uri:"http://schemas.openxmlformats.org/drawingml/2006/picture"}));let Q=new a6({mediaData:B,transform:U,outline:G});this.root.push(Q)}}},wY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{a:"xmlns:a"})}},R4=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphic");e(this,"data",void 0),this.root.push(new wY({a:"http://schemas.openxmlformats.org/drawingml/2006/main"})),this.data=new NY({mediaData:B,transform:U,outline:G,solidFill:Y}),this.root.push(this.data)}},e2={NONE:0,SQUARE:1,TIGHT:2,TOP_AND_BOTTOM:3},L4={BOTH_SIDES:"bothSides",LEFT:"left",RIGHT:"right",LARGEST:"largest"},j8=()=>new M0({name:"wp:wrapNone"}),I4=(B,U={top:0,bottom:0,left:0,right:0})=>new M0({name:"wp:wrapSquare",attributes:{wrapText:{key:"wrapText",value:B.side||L4.BOTH_SIDES},distT:{key:"distT",value:U.top},distB:{key:"distB",value:U.bottom},distL:{key:"distL",value:U.left},distR:{key:"distR",value:U.right}}}),O4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTight",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),H4=(B={top:0,bottom:0})=>new M0({name:"wp:wrapTopAndBottom",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),F4=class extends t{constructor({name:B,description:U,title:G,id:Y}={name:"",description:"",title:""}){super("wp:docPr");e(this,"docPropertiesUniqueNumericId",oB());let Q={id:{key:"id",value:Y!==null&&Y!==void 0?Y:this.docPropertiesUniqueNumericId()},name:{key:"name",value:B}};if(U!==null&&U!==void 0)Q.description={key:"descr",value:U};if(G!==null&&G!==void 0)Q.title={key:"title",value:G};this.root.push(new $8(Q))}prepForXml(B){for(let U=B.stack.length-1;U>=0;U--){let G=B.stack[U];if(!(G instanceof m2))continue;this.root.push(M4(G.linkId,!0));break}return super.prepForXml(B)}},W4=({top:B,right:U,bottom:G,left:Y})=>new M0({name:"wp:effectExtent",attributes:{top:{key:"t",value:B},right:{key:"r",value:U},bottom:{key:"b",value:G},left:{key:"l",value:Y}}}),P4=({x:B,y:U})=>new M0({name:"wp:extent",attributes:{x:{key:"cx",value:B},y:{key:"cy",value:U}}}),zY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:a",noChangeAspect:"noChangeAspect"})}},EY=class extends t{constructor(){super("a:graphicFrameLocks");this.root.push(new zY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/main",noChangeAspect:1}))}},A4=()=>new M0({name:"wp:cNvGraphicFramePr",children:[new EY]}),DY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{distT:"distT",distB:"distB",distL:"distL",distR:"distR",allowOverlap:"allowOverlap",behindDoc:"behindDoc",layoutInCell:"layoutInCell",locked:"locked",relativeHeight:"relativeHeight",simplePos:"simplePos"})}},TY=class extends t{constructor({mediaData:B,transform:U,drawingOptions:G}){super("wp:anchor");let Y=L0({allowOverlap:!0,behindDocument:!1,lockAnchor:!1,layoutInCell:!0,verticalPosition:{},horizontalPosition:{}},G.floating);if(this.root.push(new DY({distT:Y.margins?Y.margins.top||0:0,distB:Y.margins?Y.margins.bottom||0:0,distL:Y.margins?Y.margins.left||0:0,distR:Y.margins?Y.margins.right||0:0,simplePos:"0",allowOverlap:Y.allowOverlap===!0?"1":"0",behindDoc:Y.behindDocument===!0?"1":"0",locked:Y.lockAnchor===!0?"1":"0",layoutInCell:Y.layoutInCell===!0?"1":"0",relativeHeight:Y.zIndex?Y.zIndex:U.emus.y})),this.root.push(G4()),this.root.push(Q4(Y.horizontalPosition)),this.root.push(J4(Y.verticalPosition)),this.root.push(P4({x:U.emus.x,y:U.emus.y})),this.root.push(W4({top:0,right:0,bottom:0,left:0})),G.floating!==void 0&&G.floating.wrap!==void 0)switch(G.floating.wrap.type){case e2.SQUARE:this.root.push(I4(G.floating.wrap,G.floating.margins));break;case e2.TIGHT:this.root.push(O4(G.floating.margins));break;case e2.TOP_AND_BOTTOM:this.root.push(H4(G.floating.margins));break;case e2.NONE:default:this.root.push(j8())}else this.root.push(j8());this.root.push(new F4(G.docProperties)),this.root.push(A4()),this.root.push(new R4({mediaData:B,transform:U,outline:G.outline,solidFill:G.solidFill}))}},CY=({mediaData:B,transform:U,docProperties:G,outline:Y,solidFill:Q})=>{var K,Z,J,q;return new M0({name:"wp:inline",attributes:{distanceTop:{key:"distT",value:0},distanceBottom:{key:"distB",value:0},distanceLeft:{key:"distL",value:0},distanceRight:{key:"distR",value:0}},children:[P4({x:U.emus.x,y:U.emus.y}),W4(Y?{top:((K=Y.width)!==null&&K!==void 0?K:9525)*2,right:((Z=Y.width)!==null&&Z!==void 0?Z:9525)*2,bottom:((J=Y.width)!==null&&J!==void 0?J:9525)*2,left:((q=Y.width)!==null&&q!==void 0?q:9525)*2}:{top:0,right:0,bottom:0,left:0}),new F4(G),A4(),new R4({mediaData:B,transform:U,outline:Y,solidFill:Q})]})},m1=class extends t{constructor(B,U={}){super("w:drawing");if(!U.floating)this.root.push(CY({mediaData:B,transform:B.transformation,docProperties:U.docProperties,outline:U.outline,solidFill:U.solidFill}));else this.root.push(new TY({mediaData:B,transform:B.transformation,drawingOptions:U}))}},kY=(B)=>{let U=B.indexOf(";base64,"),G=U===-1?0:U+8;return new Uint8Array(atob(B.substring(G)).split("").map((Y)=>Y.charCodeAt(0)))},j4=(B)=>typeof B==="string"?kY(B):B,V8=(B,U)=>({data:j4(B.data),fileName:U,transformation:{pixels:{x:Math.round(B.transformation.width),y:Math.round(B.transformation.height)},emus:{x:Math.round(B.transformation.width*9525),y:Math.round(B.transformation.height*9525)},flip:B.transformation.flip,rotation:B.transformation.rotation?B.transformation.rotation*60000:void 0}}),$Y=class extends t{constructor(B){var U=(...Z)=>(super(...Z),e(this,"imageData",void 0),this);let G=`${P8(B.data)}.${B.type}`,Y=B.type==="svg"?L0(L0({type:B.type},V8(B,G)),{},{fallback:L0({type:B.fallback.type},V8(L0(L0({},B.fallback),{},{transformation:B.transformation}),`${P8(B.fallback.data)}.${B.fallback.type}`))}):L0({type:B.type},V8(B,G)),Q=new m1(Y,{floating:B.floating,docProperties:B.altText,outline:B.outline}),K=new D0({children:[Q]});if(B.insertion)U("w:ins"),this.root.push(new b0({id:B.insertion.id,author:B.insertion.author,date:B.insertion.date})),this.addChildElement(K);else if(B.deletion)U("w:del"),this.root.push(new b0({id:B.deletion.id,author:B.deletion.author,date:B.deletion.date})),this.addChildElement(K);else U("w:r"),this.root.push(new U2({})),this.root.push(Q);this.imageData=Y}prepForXml(B){if(B.file.Media.addImage(this.imageData.fileName,this.imageData),this.imageData.type==="svg")B.file.Media.addImage(this.imageData.fallback.fileName,this.imageData.fallback);return super.prepForXml(B)}},n8=(B)=>{var U,G,Y,Q,K,Z,J,q;return{offset:{pixels:{x:Math.round((U=(G=B.offset)===null||G===void 0?void 0:G.left)!==null&&U!==void 0?U:0),y:Math.round((Y=(Q=B.offset)===null||Q===void 0?void 0:Q.top)!==null&&Y!==void 0?Y:0)},emus:{x:Math.round(((K=(Z=B.offset)===null||Z===void 0?void 0:Z.left)!==null&&K!==void 0?K:0)*9525),y:Math.round(((J=(q=B.offset)===null||q===void 0?void 0:q.top)!==null&&J!==void 0?J:0)*9525)}},pixels:{x:Math.round(B.width),y:Math.round(B.height)},emus:{x:Math.round(B.width*9525),y:Math.round(B.height*9525)},flip:B.flip,rotation:B.rotation?B.rotation*60000:void 0}},SY=class extends D0{constructor(B){super({});e(this,"wpsShapeData",void 0),this.wpsShapeData={type:B.type,transformation:n8(B.transformation),data:L0({},B)};let U=new m1(this.wpsShapeData,{floating:B.floating,docProperties:B.altText,outline:B.outline,solidFill:B.solidFill});this.root.push(U)}},bY=class extends D0{constructor(B){super({});e(this,"wpgGroupData",void 0),e(this,"mediaDatas",void 0),this.wpgGroupData={type:B.type,transformation:n8(B.transformation),children:B.children};let U=new m1(this.wpgGroupData,{floating:B.floating,docProperties:B.altText});this.mediaDatas=B.children.filter((G)=>G.type!=="wps").map((G)=>G),this.root.push(U)}prepForXml(B){return this.mediaDatas.forEach((U)=>{if(B.file.Media.addImage(U.fileName,U),U.type==="svg")B.file.Media.addImage(U.fallback.fileName,U.fallback)}),super.prepForXml(B)}},vY=class extends t{constructor(B){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(`SEQ ${B}`)}},yY=class extends D0{constructor(B){super({});this.root.push(e0(!0)),this.root.push(new vY(B)),this.root.push(X2()),this.root.push(B2())}},gY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{instr:"w:instr"})}},s8=class extends t{constructor(B,U){super("w:fldSimple");if(this.root.push(new gY({instr:B})),U!==void 0)this.root.push(new Q1(U))}},fY=class extends s8{constructor(B){super(` MERGEFIELD ${B} `,`«${B}»`)}},xY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},N4={EXTERNAL:"External"},_Y=(B,U,G,Y)=>new M0({name:"Relationship",attributes:{id:{key:"Id",value:B},type:{key:"Type",value:U},target:{key:"Target",value:G},targetMode:{key:"TargetMode",value:Y}}}),A2=class extends t{constructor(){super("Relationships");this.root.push(new xY({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(B,U,G,Y){this.root.push(_Y(`rId${B}`,U,G,Y))}get RelationshipCount(){return this.root.length-1}},hY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},o8=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},uY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}},dY=class extends t{constructor(B){super("w:commentRangeStart");this.root.push(new o8({id:B}))}},cY=class extends t{constructor(B){super("w:commentRangeEnd");this.root.push(new o8({id:B}))}},mY=class extends t{constructor(B){super("w:commentReference");this.root.push(new o8({id:B}))}},N8=class extends t{constructor({id:B,initials:U,author:G,date:Y=new Date,children:Q},K){super("w:comment");e(this,"paraId",void 0),this.paraId=K,this.root.push(new hY({id:B,initials:U,author:G,date:Y.toISOString()}));for(let Z of Q)this.root.push(Z)}prepForXml(B){let U=super.prepForXml(B);if(!U||!this.paraId)return U;let G=U["w:comment"];if(!Array.isArray(G))return U;for(let Y=G.length-1;Y>=0;Y--){let Q=G[Y];if(Q&&typeof Q==="object"&&"w:p"in Q){let K=Q["w:p"];if(Array.isArray(K))K.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return U}},w4=(B)=>(B+1).toString(16).toUpperCase().padStart(8,"0"),z4=class extends t{constructor({children:B}){super("w:comments");if(e(this,"relationships",void 0),e(this,"threadData",void 0),this.root.push(new uY({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"})),B.some((U)=>U.parentId!==void 0)){let U=new Map(B.map((G)=>[G.id,w4(G.id)]));for(let G of B)this.root.push(new N8(G,U.get(G.id)));this.threadData=B.map((G)=>({paraId:U.get(G.id),parentParaId:G.parentId!==void 0?U.get(G.parentId):void 0,done:G.resolved}))}else for(let U of B)this.root.push(new N8(U));this.relationships=new A2}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}},lY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},aY=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},pY=class extends t{constructor(B){super("w15:commentEx");this.root.push(new aY({paraId:B.paraId,paraIdParent:B.parentParaId,done:B.done!==void 0?B.done?"1":"0":void 0}))}},E4=class extends t{constructor(B){super("w15:commentsEx");this.root.push(new lY({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let U of B)this.root.push(new pY(U))}},rY=class extends S0{constructor(){super("w:noBreakHyphen")}},iY=class extends S0{constructor(){super("w:softHyphen")}},nY=class extends S0{constructor(){super("w:dayShort")}},sY=class extends S0{constructor(){super("w:monthShort")}},oY=class extends S0{constructor(){super("w:yearShort")}},tY=class extends S0{constructor(){super("w:dayLong")}},eY=class extends S0{constructor(){super("w:monthLong")}},BZ=class extends S0{constructor(){super("w:yearLong")}},UZ=class extends S0{constructor(){super("w:annotationRef")}},GZ=class extends S0{constructor(){super("w:footnoteRef")}},D4=class extends S0{constructor(){super("w:endnoteRef")}},YZ=class extends S0{constructor(){super("w:separator")}},ZZ=class extends S0{constructor(){super("w:continuationSeparator")}},QZ=class extends S0{constructor(){super("w:pgNum")}},JZ=class extends S0{constructor(){super("w:cr")}},T4=class extends S0{constructor(){super("w:tab")}},KZ=class extends S0{constructor(){super("w:lastRenderedPageBreak")}},VZ={LEFT:"left",CENTER:"center",RIGHT:"right"},XZ={MARGIN:"margin",INDENT:"indent"},qZ={NONE:"none",DOT:"dot",HYPHEN:"hyphen",UNDERSCORE:"underscore",MIDDLE_DOT:"middleDot"},MZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{alignment:"w:alignment",relativeTo:"w:relativeTo",leader:"w:leader"})}},RZ=class extends t{constructor(B){super("w:ptab");this.root.push(new MZ({alignment:B.alignment,relativeTo:B.relativeTo,leader:B.leader}))}},C4={COLUMN:"column",PAGE:"page"},k4=class extends t{constructor(B){super("w:br");this.root.push(new C0({type:B}))}},LZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.PAGE))}},IZ=class extends D0{constructor(){super({});this.root.push(new k4(C4.COLUMN))}},$4=class extends t{constructor(){super("w:pageBreakBefore")}},k2={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},S4=({after:B,before:U,line:G,lineRule:Y,beforeAutoSpacing:Q,afterAutoSpacing:K})=>new M0({name:"w:spacing",attributes:{after:{key:"w:after",value:B},before:{key:"w:before",value:U},line:{key:"w:line",value:G},lineRule:{key:"w:lineRule",value:Y},beforeAutoSpacing:{key:"w:beforeAutospacing",value:Q},afterAutoSpacing:{key:"w:afterAutospacing",value:K}}}),OZ={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},x2=(B)=>new M0({name:"w:pStyle",attributes:{val:{key:"w:val",value:B}}}),w8={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},HZ={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},FZ={MAX:9026},b4=({type:B,position:U,leader:G})=>new M0({name:"w:tab",attributes:{val:{key:"w:val",value:B},pos:{key:"w:pos",value:U},leader:{key:"w:leader",value:G}}}),v4=(B)=>new M0({name:"w:tabs",children:B.map((U)=>b4(U))}),C1=class extends t{constructor(B,U){super("w:numPr");this.root.push(new WZ(U)),this.root.push(new PZ(B))}},WZ=class extends t{constructor(B){super("w:ilvl");if(B>9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new C0({val:B}))}},PZ=class extends t{constructor(B){super("w:numId");this.root.push(new C0({val:typeof B==="string"?`{${B}}`:B}))}},H1=class extends t{constructor(...B){super(...B);e(this,"fileChild",Symbol())}},AZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},jZ={INTERNAL:"INTERNAL",EXTERNAL:"EXTERNAL"},m2=class extends t{constructor(B,U,G){super("w:hyperlink");e(this,"linkId",void 0),this.linkId=U;let Y=new AZ({history:1,anchor:G?G:void 0,id:!G?`rId${this.linkId}`:void 0});this.root.push(Y),B.forEach((Q)=>{this.root.push(Q)})}},y4=class extends m2{constructor(B){super(B.children,O1(),B.anchor)}},t8=class extends t{constructor(B){super("w:externalHyperlink");e(this,"options",void 0),this.options=B}},NZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",name:"w:name"})}},wZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},g4=class{constructor(B){e(this,"bookmarkUniqueNumericId",tB()),e(this,"start",void 0),e(this,"children",void 0),e(this,"end",void 0);let U=this.bookmarkUniqueNumericId();this.start=new f4(B.id,U),this.children=B.children,this.end=new x4(U)}},f4=class extends t{constructor(B,U){super("w:bookmarkStart");let G=new NZ({name:B,id:U});this.root.push(G)}},x4=class extends t{constructor(B){super("w:bookmarkEnd");let U=new wZ({id:B});this.root.push(U)}},zZ=function(B){return B.NONE="none",B.RELATIVE="relative",B.NO_CONTEXT="no_context",B.FULL_CONTEXT="full_context",B}({}),EZ={["relative"]:"\\r",["no_context"]:"\\n",["full_context"]:"\\w",["none"]:void 0},DZ=class extends s8{constructor(B,U,G={}){let{hyperlink:Y=!0,referenceFormat:Q="full_context"}=G,K=`${`REF ${B}`} ${[...Y?["\\h"]:[],...[EZ[Q]].filter((Z)=>!!Z)].join(" ")}`;super(K,U)}},_4=(B)=>new M0({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:B}}}),TZ=class extends t{constructor(B,U={}){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE}));let G=`PAGEREF ${B}`;if(U.hyperlink)G=`${G} \\h`;if(U.useRelativePosition)G=`${G} \\p`;this.root.push(G)}},CZ=class extends D0{constructor(B,U={}){super({children:[e0(!0),new TZ(B,U),B2()]})}},kZ={ANSI:"00",DEFAULT:"01",SYMBOL:"02",MAC:"4D",JIS:"80",HANGUL:"81",JOHAB:"82",GB_2312:"86",CHINESEBIG5:"88",GREEK:"A1",TURKISH:"A2",VIETNAMESE:"A3",HEBREW:"B1",ARABIC:"B2",BALTIC:"BA",RUSSIAN:"CC",THAI:"DE",EASTEUROPE:"EE",OEM:"FF"},E1=({id:B,fontKey:U,subsetted:G},Y)=>new M0({name:Y,attributes:L0({id:{key:"r:id",value:B}},U?{fontKey:{key:"w:fontKey",value:`{${U}}`}}:{}),children:[...G?[new q0("w:subsetted",G)]:[]]}),$Z=({name:B,altName:U,panose1:G,charset:Y,family:Q,notTrueType:K,pitch:Z,sig:J,embedRegular:q,embedBold:W,embedItalic:I,embedBoldItalic:H})=>new M0({name:"w:font",attributes:{name:{key:"w:name",value:B}},children:[...U?[f2("w:altName",U)]:[],...G?[f2("w:panose1",G)]:[],...Y?[f2("w:charset",Y)]:[],...Q?[f2("w:family",Q)]:[],...K?[new q0("w:notTrueType",K)]:[],...Z?[f2("w:pitch",Z)]:[],...J?[new M0({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:J.usb0},usb1:{key:"w:usb1",value:J.usb1},usb2:{key:"w:usb2",value:J.usb2},usb3:{key:"w:usb3",value:J.usb3},csb0:{key:"w:csb0",value:J.csb0},csb1:{key:"w:csb1",value:J.csb1}}})]:[],...q?[E1(q,"w:embedRegular")]:[],...W?[E1(W,"w:embedBold")]:[],...I?[E1(I,"w:embedItalic")]:[],...H?[E1(H,"w:embedBoldItalic")]:[]]}),SZ=({name:B,index:U,fontKey:G,characterSet:Y})=>$Z({name:B,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:Y,family:"auto",pitch:"variable",embedRegular:{fontKey:G,id:`rId${U}`}}),bZ=(B)=>new M0({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:B.map((U,G)=>SZ({name:U.name,index:G+1,fontKey:U.fontKey,characterSet:U.characterSet}))}),h4=class{constructor(B){e(this,"options",void 0),e(this,"fontTable",void 0),e(this,"relationships",void 0),e(this,"fontOptionsWithKey",[]),this.options=B,this.fontOptionsWithKey=B.map((U)=>L0(L0({},U),{},{fontKey:eB()})),this.fontTable=bZ(this.fontOptionsWithKey),this.relationships=new A2;for(let U=0;Unew M0({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),yZ={NONE:"none",DROP:"drop",MARGIN:"margin"},gZ={MARGIN:"margin",PAGE:"page",TEXT:"text"},fZ={AROUND:"around",AUTO:"auto",NONE:"none",NOT_BESIDE:"notBeside",THROUGH:"through",TIGHT:"tight"},u4=(B)=>{var U,G;return new M0({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:B.anchorLock},dropCap:{key:"w:dropCap",value:B.dropCap},width:{key:"w:w",value:B.width},height:{key:"w:h",value:B.height},x:{key:"w:x",value:B.position?B.position.x:void 0},y:{key:"w:y",value:B.position?B.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:B.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:B.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(U=B.space)===null||U===void 0?void 0:U.horizontal},spaceVertical:{key:"w:vSpace",value:(G=B.space)===null||G===void 0?void 0:G.vertical},rule:{key:"w:hRule",value:B.rule},alignmentX:{key:"w:xAlign",value:B.alignment?B.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:B.alignment?B.alignment.y:void 0},lines:{key:"w:lines",value:B.lines},wrap:{key:"w:wrap",value:B.wrap}}})},M2=class extends R2{constructor(B){super("w:pPr",B===null||B===void 0?void 0:B.includeIfEmpty);if(e(this,"numberingReferences",[]),!B)return this;if(B.heading)this.push(x2(B.heading));if(B.bullet)this.push(x2("ListParagraph"));if(B.numbering){if(!B.style&&!B.heading){if(!B.numbering.custom)this.push(x2("ListParagraph"))}}if(B.style)this.push(x2(B.style));if(B.keepNext!==void 0)this.push(new q0("w:keepNext",B.keepNext));if(B.keepLines!==void 0)this.push(new q0("w:keepLines",B.keepLines));if(B.pageBreakBefore)this.push(new $4);if(B.frame)this.push(u4(B.frame));if(B.widowControl!==void 0)this.push(new q0("w:widowControl",B.widowControl));if(B.bullet)this.push(new C1(1,B.bullet.level));if(B.numbering){var U,G;this.numberingReferences.push({reference:B.numbering.reference,instance:(U=B.numbering.instance)!==null&&U!==void 0?U:0}),this.push(new C1(`${B.numbering.reference}-${(G=B.numbering.instance)!==null&&G!==void 0?G:0}`,B.numbering.level))}else if(B.numbering===!1)this.push(new C1(0,0));if(B.border)this.push(new xB(B.border));if(B.thematicBreak)this.push(new _B);if(B.shading)this.push(M1(B.shading));if(B.wordWrap)this.push(vZ());if(B.overflowPunctuation)this.push(new q0("w:overflowPunct",B.overflowPunctuation));let Y=[...B.rightTabStop!==void 0?[{type:w8.RIGHT,position:B.rightTabStop}]:[],...B.tabStops?B.tabStops:[],...B.leftTabStop!==void 0?[{type:w8.LEFT,position:B.leftTabStop}]:[]];if(Y.length>0)this.push(v4(Y));if(B.bidirectional!==void 0)this.push(new q0("w:bidi",B.bidirectional));if(B.spacing)this.push(S4(B.spacing));if(B.indent)this.push(hB(B.indent));if(B.contextualSpacing!==void 0)this.push(new q0("w:contextualSpacing",B.contextualSpacing));if(B.alignment)this.push(m8(B.alignment));if(B.outlineLevel!==void 0)this.push(_4(B.outlineLevel));if(B.suppressLineNumbers!==void 0)this.push(new q0("w:suppressLineNumbers",B.suppressLineNumbers));if(B.autoSpaceEastAsianText!==void 0)this.push(new q0("w:autoSpaceDN",B.autoSpaceEastAsianText));if(B.run)this.push(new mB(B.run));if(B.revision)this.push(new d4(B.revision))}push(B){this.root.push(B)}prepForXml(B){if(!(B.viewWrapper instanceof h4))for(let U of this.numberingReferences)B.file.Numbering.createConcreteNumberingInstance(U.reference,U.instance);return super.prepForXml(B)}},d4=class extends t{constructor(B){super("w:pPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new M2(L0(L0({},B),{},{includeIfEmpty:!0})))}},d0=class extends H1{constructor(B){super("w:p");if(e(this,"properties",void 0),typeof B==="string")return this.properties=new M2({}),this.root.push(this.properties),this.root.push(new Q1(B)),this;if(this.properties=new M2(B),this.root.push(this.properties),B.text)this.root.push(new Q1(B.text));if(B.children)for(let U of B.children){if(U instanceof g4){this.root.push(U.start);for(let G of U.children)this.root.push(G);this.root.push(U.end);continue}this.root.push(U)}}prepForXml(B){for(let U of this.root)if(U instanceof t8){let G=this.root.indexOf(U),Y=new m2(U.options.children,O1());B.viewWrapper.Relationships.addRelationship(Y.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",U.options.link,N4.EXTERNAL),this.root[G]=Y}return super.prepForXml(B)}addRunToFront(B){return this.root.splice(1,0,B),this}},xZ=class extends t{constructor(B){super("m:oMath");for(let U of B.children)this.root.push(U)}},_Z=class extends t{constructor(B){super("m:t");this.root.push(B)}},hZ=class extends t{constructor(B){super("m:r");this.root.push(new _Z(B))}},c4=class extends t{constructor(B){super("m:den");for(let U of B)this.root.push(U)}},m4=class extends t{constructor(B){super("m:num");for(let U of B)this.root.push(U)}},uZ=class extends t{constructor(B){super("m:f");this.root.push(new m4(B.numerator)),this.root.push(new c4(B.denominator))}},l4=({accent:B})=>new M0({name:"m:chr",attributes:{accent:{key:"m:val",value:B}}}),y0=({children:B})=>new M0({name:"m:e",children:B}),a4=({value:B})=>new M0({name:"m:limLoc",attributes:{value:{key:"m:val",value:B||"undOvr"}}}),dZ=()=>new M0({name:"m:subHide",attributes:{hide:{key:"m:val",value:1}}}),cZ=()=>new M0({name:"m:supHide",attributes:{hide:{key:"m:val",value:1}}}),e8=({accent:B,hasSuperScript:U,hasSubScript:G,limitLocationVal:Y})=>new M0({name:"m:naryPr",children:[...B?[l4({accent:B})]:[],a4({value:Y}),...!U?[cZ()]:[],...!G?[dZ()]:[]]}),l2=({children:B})=>new M0({name:"m:sub",children:B}),a2=({children:B})=>new M0({name:"m:sup",children:B}),mZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"∑",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},lZ=class extends t{constructor(B){super("m:nary");if(this.root.push(e8({accent:"",hasSuperScript:!!B.superScript,hasSubScript:!!B.subScript,limitLocationVal:"subSup"})),B.subScript)this.root.push(l2({children:B.subScript}));if(B.superScript)this.root.push(a2({children:B.superScript}));this.root.push(y0({children:B.children}))}},B6=class extends t{constructor(B){super("m:lim");for(let U of B)this.root.push(U)}},aZ=class extends t{constructor(B){super("m:limUpp");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},pZ=class extends t{constructor(B){super("m:limLow");this.root.push(y0({children:B.children})),this.root.push(new B6(B.limit))}},p4=()=>new M0({name:"m:sSupPr"}),rZ=class extends t{constructor(B){super("m:sSup");this.root.push(p4()),this.root.push(y0({children:B.children})),this.root.push(a2({children:B.superScript}))}},r4=()=>new M0({name:"m:sSubPr"}),iZ=class extends t{constructor(B){super("m:sSub");this.root.push(r4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript}))}},i4=()=>new M0({name:"m:sSubSupPr"}),nZ=class extends t{constructor(B){super("m:sSubSup");this.root.push(i4()),this.root.push(y0({children:B.children})),this.root.push(l2({children:B.subScript})),this.root.push(a2({children:B.superScript}))}},n4=()=>new M0({name:"m:sPrePr"}),sZ=class extends M0{constructor({children:B,subScript:U,superScript:G}){super({name:"m:sPre",children:[n4(),y0({children:B}),l2({children:U}),a2({children:G})]})}},oZ="",s4=class extends t{constructor(B){super("m:deg");if(B)for(let U of B)this.root.push(U)}},tZ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{hide:"m:val"})}},eZ=class extends t{constructor(){super("m:degHide");this.root.push(new tZ({hide:1}))}},o4=class extends t{constructor(B){super("m:radPr");if(!B)this.root.push(new eZ)}},BQ=class extends t{constructor(B){super("m:rad");this.root.push(new o4(!!B.degree)),this.root.push(new s4(B.degree)),this.root.push(y0({children:B.children}))}},t4=class extends t{constructor(B){super("m:fName");for(let U of B)this.root.push(U)}},e4=class extends t{constructor(){super("m:funcPr")}},UQ=class extends t{constructor(B){super("m:func");this.root.push(new e4),this.root.push(new t4(B.name)),this.root.push(y0({children:B.children}))}},GQ=({character:B})=>new M0({name:"m:begChr",attributes:{character:{key:"m:val",value:B}}}),YQ=({character:B})=>new M0({name:"m:endChr",attributes:{character:{key:"m:val",value:B}}}),l1=({characters:B})=>new M0({name:"m:dPr",children:B?[GQ({character:B.beginningCharacter}),YQ({character:B.endingCharacter})]:[]}),ZQ=class extends t{constructor(B){super("m:d");this.root.push(l1({})),this.root.push(y0({children:B.children}))}},QQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"[",endingCharacter:"]"}})),this.root.push(y0({children:B.children}))}},JQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"{",endingCharacter:"}"}})),this.root.push(y0({children:B.children}))}},KQ=class extends t{constructor(B){super("m:d");this.root.push(l1({characters:{beginningCharacter:"〈",endingCharacter:"〉"}})),this.root.push(y0({children:B.children}))}},VQ=(B)=>new M0({name:"w:gridCol",attributes:B!==void 0?{width:{key:"w:w",value:E0(B)}}:void 0}),B9=class extends t{constructor(B,U){super("w:tblGrid");for(let G of B)this.root.push(VQ(G));if(U)this.root.push(new qQ(U))}},XQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},qQ=class extends t{constructor(B){super("w:tblGridChange");this.root.push(new XQ({id:B.id})),this.root.push(new B9(B.columnWidths))}},MQ=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.addChildElement(new Q1(B))}},RQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},LQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("NUMPAGES")}},IQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},p6=class extends t{constructor(B){super("w:delText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B)}},OQ=class extends t{constructor(B){super("w:del");e(this,"deletedTextRunWrapper",void 0),this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.deletedTextRunWrapper=new HQ(B),this.addChildElement(this.deletedTextRunWrapper)}},HQ=class extends t{constructor(B){super("w:r");if(this.root.push(new U2(B)),B.children)for(let U of B.children){if(typeof U==="string"){switch(U){case F2.CURRENT:this.root.push(e0()),this.root.push(new RQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES:this.root.push(e0()),this.root.push(new LQ),this.root.push(X2()),this.root.push(B2());break;case F2.TOTAL_PAGES_IN_SECTION:this.root.push(e0()),this.root.push(new IQ),this.root.push(X2()),this.root.push(B2());break;default:this.root.push(new p6(U));break}continue}this.root.push(U)}else if(B.text)this.root.push(new p6(B.text));if(B.break)for(let U=0;Unew M0({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:B}}}),X9=({marginUnitType:B=v1.DXA,top:U,left:G,bottom:Y,right:Q})=>[{name:"w:top",size:U},{name:"w:left",size:G},{name:"w:bottom",size:Y},{name:"w:right",size:Q}].filter((K)=>K.size!==void 0).map(({name:K,size:Z})=>J1(K,{type:B,size:Z})),PQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tblCellMar",children:U})},AQ=(B)=>{let U=X9(B);if(U.length===0)return;return new M0({name:"w:tcMar",children:U})},v1={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},J1=(B,{type:U=v1.AUTO,size:G})=>{let Y=G;if(U===v1.PERCENTAGE&&typeof G==="number")Y=`${G}%`;return new M0({name:B,attributes:{type:{key:"w:type",value:U},size:{key:"w:w",value:c8(Y)}}})},q9=class extends R2{constructor(B){super("w:tcBorders");if(B.top)this.root.push(j0("w:top",B.top));if(B.start)this.root.push(j0("w:start",B.start));if(B.left)this.root.push(j0("w:left",B.left));if(B.bottom)this.root.push(j0("w:bottom",B.bottom));if(B.end)this.root.push(j0("w:end",B.end));if(B.right)this.root.push(j0("w:right",B.right))}},jQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},M9=class extends t{constructor(B){super("w:gridSpan");this.root.push(new jQ({val:T0(B)}))}},G6={CONTINUE:"continue",RESTART:"restart"},NQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},z8=class extends t{constructor(B){super("w:vMerge");this.root.push(new NQ({val:B}))}},wQ={BOTTOM_TO_TOP_LEFT_TO_RIGHT:"btLr",LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},zQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},R9=class extends t{constructor(B){super("w:textDirection");this.root.push(new zQ({val:B}))}},L9=class extends R2{constructor(B){super("w:tcPr",B.includeIfEmpty);if(B.width)this.root.push(J1("w:tcW",B.width));if(B.columnSpan)this.root.push(new M9(B.columnSpan));if(B.verticalMerge)this.root.push(new z8(B.verticalMerge));else if(B.rowSpan&&B.rowSpan>1)this.root.push(new z8(G6.RESTART));if(B.borders)this.root.push(new q9(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.margins){let U=AQ(B.margins);if(U)this.root.push(U)}if(B.textDirection)this.root.push(new R9(B.textDirection));if(B.verticalAlign)this.root.push(U6(B.verticalAlign));if(B.insertion)this.root.push(new Y9(B.insertion));if(B.deletion)this.root.push(new Z9(B.deletion));if(B.revision)this.root.push(new EQ(B.revision));if(B.cellMerge)this.root.push(new J9(B.cellMerge))}},EQ=class extends t{constructor(B){super("w:tcPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new L9(L0(L0({},B),{},{includeIfEmpty:!0})))}},Y6=class extends t{constructor(B){super("w:tc");e(this,"options",void 0),this.options=B,this.root.push(new L9(B));for(let U of B.children)this.root.push(U)}prepForXml(B){if(!(this.root[this.root.length-1]instanceof d0))this.root.push(new d0({}));return super.prepForXml(B)}},v2={style:c1.NONE,size:0,color:"auto"},y2={style:c1.SINGLE,size:4,color:"auto"},Z6=class extends t{constructor(B){var U,G,Y,Q,K,Z;super("w:tblBorders");this.root.push(j0("w:top",(U=B.top)!==null&&U!==void 0?U:y2)),this.root.push(j0("w:left",(G=B.left)!==null&&G!==void 0?G:y2)),this.root.push(j0("w:bottom",(Y=B.bottom)!==null&&Y!==void 0?Y:y2)),this.root.push(j0("w:right",(Q=B.right)!==null&&Q!==void 0?Q:y2)),this.root.push(j0("w:insideH",(K=B.insideHorizontal)!==null&&K!==void 0?K:y2)),this.root.push(j0("w:insideV",(Z=B.insideVertical)!==null&&Z!==void 0?Z:y2))}};e(Z6,"NONE",{top:v2,bottom:v2,left:v2,right:v2,insideHorizontal:v2,insideVertical:v2});var DQ={MARGIN:"margin",PAGE:"page",TEXT:"text"},TQ={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},CQ={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},kQ={NEVER:"never",OVERLAP:"overlap"},$Q=(B)=>new M0({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:B}}}),I9=({horizontalAnchor:B,verticalAnchor:U,absoluteHorizontalPosition:G,relativeHorizontalPosition:Y,absoluteVerticalPosition:Q,relativeVerticalPosition:K,bottomFromText:Z,topFromText:J,leftFromText:q,rightFromText:W,overlap:I})=>new M0({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:q===void 0?void 0:E0(q)},rightFromText:{key:"w:rightFromText",value:W===void 0?void 0:E0(W)},topFromText:{key:"w:topFromText",value:J===void 0?void 0:E0(J)},bottomFromText:{key:"w:bottomFromText",value:Z===void 0?void 0:E0(Z)},absoluteHorizontalPosition:{key:"w:tblpX",value:G===void 0?void 0:t0(G)},absoluteVerticalPosition:{key:"w:tblpY",value:Q===void 0?void 0:t0(Q)},horizontalAnchor:{key:"w:horzAnchor",value:B},relativeHorizontalPosition:{key:"w:tblpXSpec",value:Y},relativeVerticalPosition:{key:"w:tblpYSpec",value:K},verticalAnchor:{key:"w:vertAnchor",value:U}},children:I?[$Q(I)]:void 0}),SQ={AUTOFIT:"autofit",FIXED:"fixed"},O9=(B)=>new M0({name:"w:tblLayout",attributes:{type:{key:"w:type",value:B}}}),bQ={DXA:"dxa",NIL:"nil"},H9=({type:B=bQ.DXA,value:U})=>new M0({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:B},value:{key:"w:w",value:c8(U)}}}),F9=({firstRow:B,lastRow:U,firstColumn:G,lastColumn:Y,noHBand:Q,noVBand:K})=>new M0({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:B},lastRow:{key:"w:lastRow",value:U},firstColumn:{key:"w:firstColumn",value:G},lastColumn:{key:"w:lastColumn",value:Y},noHBand:{key:"w:noHBand",value:Q},noVBand:{key:"w:noVBand",value:K}}}),Q6=class extends R2{constructor(B){super("w:tblPr",B.includeIfEmpty);if(B.style)this.root.push(new q2("w:tblStyle",B.style));if(B.float)this.root.push(I9(B.float));if(B.visuallyRightToLeft!==void 0)this.root.push(new q0("w:bidiVisual",B.visuallyRightToLeft));if(B.width)this.root.push(J1("w:tblW",B.width));if(B.alignment)this.root.push(m8(B.alignment));if(B.indent)this.root.push(J1("w:tblInd",B.indent));if(B.borders)this.root.push(new Z6(B.borders));if(B.shading)this.root.push(M1(B.shading));if(B.layout)this.root.push(O9(B.layout));if(B.cellMargin){let U=PQ(B.cellMargin);if(U)this.root.push(U)}if(B.tableLook)this.root.push(F9(B.tableLook));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.revision)this.root.push(new vQ(B.revision))}},vQ=class extends t{constructor(B){super("w:tblPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new Q6(L0(L0({},B),{},{includeIfEmpty:!0})))}},yQ=class extends H1{constructor({rows:B,width:U,columnWidths:G=Array(Math.max(...B.map((j)=>j.CellCount))).fill(100),columnWidthsRevision:Y,margins:Q,indent:K,float:Z,layout:J,style:q,borders:W,alignment:I,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P}){super("w:tbl");this.root.push(new Q6({borders:W!==null&&W!==void 0?W:{},width:U!==null&&U!==void 0?U:{size:100},indent:K,float:Z,layout:J,style:q,alignment:I,cellMargin:Q,visuallyRightToLeft:H,tableLook:T,cellSpacing:A,revision:P})),this.root.push(new B9(G,Y));for(let j of B)this.root.push(j);B.forEach((j,E)=>{if(E===B.length-1)return;let C=0;j.cells.forEach((N)=>{if(N.options.rowSpan&&N.options.rowSpan>1){let v=new Y6({rowSpan:N.options.rowSpan-1,columnSpan:N.options.columnSpan,borders:N.options.borders,children:[],verticalMerge:G6.CONTINUE});B[E+1].addCellToColumnIndex(v,C)}C+=N.options.columnSpan||1})})}},gQ={AUTO:"auto",ATLEAST:"atLeast",EXACT:"exact"},W9=(B,U)=>new M0({name:"w:trHeight",attributes:{value:{key:"w:val",value:E0(B)},rule:{key:"w:hRule",value:U}}}),J6=class extends R2{constructor(B){super("w:trPr",B.includeIfEmpty);if(B.cantSplit!==void 0)this.root.push(new q0("w:cantSplit",B.cantSplit));if(B.tableHeader!==void 0)this.root.push(new q0("w:tblHeader",B.tableHeader));if(B.height)this.root.push(W9(B.height.value,B.height.rule));if(B.cellSpacing)this.root.push(H9(B.cellSpacing));if(B.insertion)this.root.push(new U9(B.insertion));if(B.deletion)this.root.push(new G9(B.deletion));if(B.revision)this.root.push(new P9(B.revision))}},P9=class extends t{constructor(B){super("w:trPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new J6(L0(L0({},B),{},{includeIfEmpty:!0})))}},fQ=class extends t{constructor(B){super("w:tr");e(this,"options",void 0),this.options=B,this.root.push(new J6(B));for(let U of B.children)this.root.push(U)}get CellCount(){return this.options.children.length}get cells(){return this.root.filter((B)=>B instanceof Y6)}addCellToIndex(B,U){this.root.splice(U+1,0,B)}addCellToColumnIndex(B,U){let G=this.columnIndexToRootIndex(U,!0);this.addCellToIndex(B,G-1)}rootIndexToColumnIndex(B){if(B<1||B>=this.root.length)throw Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let U=0;for(let G=1;G=this.root.length)if(U)return this.root.length;else throw Error(`cell 'columnIndex' should not great than ${G-1}`);let Q=this.root[Y];Y+=1,G+=Q&&Q.options.columnSpan||1}return Y-1}},xQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},_Q=class extends t{constructor(){super("Properties");this.root.push(new xQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},hQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},V2=(B,U)=>new M0({name:"Default",attributes:{contentType:{key:"ContentType",value:B},extension:{key:"Extension",value:U}}}),f0=(B,U)=>new M0({name:"Override",attributes:{contentType:{key:"ContentType",value:B},partName:{key:"PartName",value:U}}}),uQ=class extends t{constructor(){super("Types");this.root.push(new hQ({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(V2("image/png","png")),this.root.push(V2("image/jpeg","jpeg")),this.root.push(V2("image/jpeg","jpg")),this.root.push(V2("image/bmp","bmp")),this.root.push(V2("image/gif","gif")),this.root.push(V2("image/svg+xml","svg")),this.root.push(V2("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(V2("application/xml","xml")),this.root.push(V2("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(f0("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addCommentsExtended(){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addFooter(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${B}.xml`))}addHeader(B){this.root.push(f0("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${B}.xml`))}},y1={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},F1=class extends H0{constructor(B,U){super(L0({Ignorable:U},Object.fromEntries(B.map((G)=>[G,y1[G]]))));e(this,"xmlKeys",L0({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(y1).map((G)=>[G,`xmlns:${G}`]))))}},dQ=class extends t{constructor(B){super("cp:coreProperties");if(this.root.push(new F1(["cp","dc","dcterms","dcmitype","xsi"])),B.title)this.root.push(new O2("dc:title",B.title));if(B.subject)this.root.push(new O2("dc:subject",B.subject));if(B.creator)this.root.push(new O2("dc:creator",B.creator));if(B.keywords)this.root.push(new O2("cp:keywords",B.keywords));if(B.description)this.root.push(new O2("dc:description",B.description));if(B.lastModifiedBy)this.root.push(new O2("cp:lastModifiedBy",B.lastModifiedBy));if(B.revision)this.root.push(new O2("cp:revision",String(B.revision)));this.root.push(new r6("dcterms:created")),this.root.push(new r6("dcterms:modified"))}},cQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"xsi:type"})}},r6=class extends t{constructor(B){super(B);this.root.push(new cQ({type:"dcterms:W3CDTF"})),this.root.push(fB(new Date))}},mQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},lQ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},aQ=class extends t{constructor(B,U){super("property");this.root.push(new lQ({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:B.toString(),name:U.name})),this.root.push(new pQ(U.value))}},pQ=class extends t{constructor(B){super("vt:lpwstr");this.root.push(B)}},rQ=class extends t{constructor(B){super("Properties");e(this,"nextId",void 0),e(this,"properties",[]),this.root.push(new mQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let U of B)this.addCustomProperty(U)}prepForXml(B){return this.properties.forEach((U)=>this.root.push(U)),super.prepForXml(B)}addCustomProperty(B){this.properties.push(new aQ(this.nextId++,B))}},A9=({space:B,count:U,separate:G,equalWidth:Y,children:Q})=>new M0({name:"w:cols",attributes:{space:{key:"w:space",value:B===void 0?void 0:E0(B)},count:{key:"w:num",value:U===void 0?void 0:T0(U)},separate:{key:"w:sep",value:G},equalWidth:{key:"w:equalWidth",value:Y}},children:!Y&&Q?Q:void 0}),iQ={DEFAULT:"default",LINES:"lines",LINES_AND_CHARS:"linesAndChars",SNAP_TO_CHARS:"snapToChars"},j9=({type:B,linePitch:U,charSpace:G})=>new M0({name:"w:docGrid",attributes:{type:{key:"w:type",value:B},linePitch:{key:"w:linePitch",value:T0(U)},charSpace:{key:"w:charSpace",value:G?T0(G):void 0}}}),T2={DEFAULT:"default",FIRST:"first",EVEN:"even"},E8={HEADER:"w:headerReference",FOOTER:"w:footerReference"},k1=(B,U)=>new M0({name:B,attributes:{type:{key:"w:type",value:U.type||T2.DEFAULT},id:{key:"r:id",value:`rId${U.id}`}}}),nQ={NEW_PAGE:"newPage",NEW_SECTION:"newSection",CONTINUOUS:"continuous"},N9=({countBy:B,start:U,restart:G,distance:Y})=>new M0({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:B===void 0?void 0:T0(B)},start:{key:"w:start",value:U===void 0?void 0:T0(U)},restart:{key:"w:restart",value:G},distance:{key:"w:distance",value:Y===void 0?void 0:E0(Y)}}}),sQ={ALL_PAGES:"allPages",FIRST_PAGE:"firstPage",NOT_FIRST_PAGE:"notFirstPage"},oQ={PAGE:"page",TEXT:"text"},tQ={BACK:"back",FRONT:"front"},i6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},w9=class extends R2{constructor(B){super("w:pgBorders");if(!B)return this;if(B.pageBorders)this.root.push(new i6({display:B.pageBorders.display,offsetFrom:B.pageBorders.offsetFrom,zOrder:B.pageBorders.zOrder}));else this.root.push(new i6({}));if(B.pageBorderTop)this.root.push(j0("w:top",B.pageBorderTop));if(B.pageBorderLeft)this.root.push(j0("w:left",B.pageBorderLeft));if(B.pageBorderBottom)this.root.push(j0("w:bottom",B.pageBorderBottom));if(B.pageBorderRight)this.root.push(j0("w:right",B.pageBorderRight))}},z9=(B,U,G,Y,Q,K,Z)=>new M0({name:"w:pgMar",attributes:{top:{key:"w:top",value:t0(B)},right:{key:"w:right",value:E0(U)},bottom:{key:"w:bottom",value:t0(G)},left:{key:"w:left",value:E0(Y)},header:{key:"w:header",value:E0(Q)},footer:{key:"w:footer",value:E0(K)},gutter:{key:"w:gutter",value:E0(Z)}}}),eQ={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},E9=({start:B,formatType:U,separator:G})=>new M0({name:"w:pgNumType",attributes:{start:{key:"w:start",value:B===void 0?void 0:T0(B)},formatType:{key:"w:fmt",value:U},separator:{key:"w:chapSep",value:G}}}),g1={PORTRAIT:"portrait",LANDSCAPE:"landscape"},D9=({width:B,height:U,orientation:G,code:Y})=>{let Q=E0(B),K=E0(U);return new M0({name:"w:pgSz",attributes:{width:{key:"w:w",value:G===g1.LANDSCAPE?K:Q},height:{key:"w:h",value:G===g1.LANDSCAPE?Q:K},orientation:{key:"w:orient",value:G},code:{key:"w:code",value:Y}}})},BJ={LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},UJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},T9=class extends t{constructor(B){super("w:textDirection");this.root.push(new UJ({val:B}))}},GJ={NEXT_PAGE:"nextPage",NEXT_COLUMN:"nextColumn",CONTINUOUS:"continuous",EVEN_PAGE:"evenPage",ODD_PAGE:"oddPage"},C9=(B)=>new M0({name:"w:type",attributes:{val:{key:"w:val",value:B}}}),H2={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},$1={WIDTH:11906,HEIGHT:16838,ORIENTATION:g1.PORTRAIT},K6=class extends t{constructor({page:{size:{width:B=$1.WIDTH,height:U=$1.HEIGHT,orientation:G=$1.ORIENTATION,code:Y}={},margin:{top:Q=H2.TOP,right:K=H2.RIGHT,bottom:Z=H2.BOTTOM,left:J=H2.LEFT,header:q=H2.HEADER,footer:W=H2.FOOTER,gutter:I=H2.GUTTER}={},pageNumbers:H={},borders:T,textDirection:A}={},grid:{linePitch:P=360,charSpace:j,type:E}={},headerWrapperGroup:C={},footerWrapperGroup:N={},lineNumbers:v,titlePage:S,verticalAlign:F,column:M,type:$,revision:x}={}){super("w:sectPr");if(this.addHeaderFooterGroup(E8.HEADER,C),this.addHeaderFooterGroup(E8.FOOTER,N),$)this.root.push(C9($));if(this.root.push(D9({width:B,height:U,orientation:G,code:Y})),this.root.push(z9(Q,K,Z,J,q,W,I)),T)this.root.push(new w9(T));if(v)this.root.push(N9(v));if(this.root.push(E9(H)),M)this.root.push(A9(M));if(F)this.root.push(U6(F));if(S!==void 0)this.root.push(new q0("w:titlePg",S));if(A)this.root.push(new T9(A));if(x)this.root.push(new k9(x));this.root.push(j9({linePitch:P,charSpace:j,type:E}))}addHeaderFooterGroup(B,U){if(U.default)this.root.push(k1(B,{type:T2.DEFAULT,id:U.default.View.ReferenceId}));if(U.first)this.root.push(k1(B,{type:T2.FIRST,id:U.first.View.ReferenceId}));if(U.even)this.root.push(k1(B,{type:T2.EVEN,id:U.even.View.ReferenceId}))}},k9=class extends t{constructor(B){super("w:sectPrChange");this.root.push(new b0({id:B.id,author:B.author,date:B.date})),this.root.push(new K6(B))}},YJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{width:"w:w",space:"w:space"})}},ZJ=class extends t{constructor(B){super("w:col");this.root.push(new YJ({width:E0(B.width),space:B.space===void 0?void 0:E0(B.space)}))}},$9=class extends t{constructor(){super("w:body");e(this,"sections",[])}addSection(B){let U=this.sections.pop();this.root.push(this.createSectionParagraph(U)),this.sections.push(new K6(B))}prepForXml(B){if(this.sections.length===1)this.root.splice(0,1),this.root.push(this.sections.pop());return super.prepForXml(B)}push(B){this.root.push(B)}createSectionParagraph(B){let U=new d0({}),G=new M2({});return G.push(B),U.addChildElement(G),U}},S9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}},b9=class extends t{constructor(B){super("w:background");this.root.push(new S9({color:B.color===void 0?void 0:C2(B.color),themeColor:B.themeColor,themeShade:B.themeShade===void 0?void 0:W8(B.themeShade),themeTint:B.themeTint===void 0?void 0:W8(B.themeTint)}))}},QJ=class extends t{constructor(B){super("w:document");if(e(this,"body",void 0),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new $9,B.background)this.root.push(new b9(B.background));this.root.push(this.body)}add(B){return this.body.push(B),this}get Body(){return this.body}},JJ=class{constructor(B){e(this,"document",void 0),e(this,"relationships",void 0),this.document=new QJ(B),this.relationships=new A2}get View(){return this.document}get Relationships(){return this.relationships}},KJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},VJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",id:"w:id"})}},XJ=class extends D0{constructor(){super({style:"EndnoteReference"});this.root.push(new D4)}},n6={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},X8=class extends t{constructor(B){super("w:endnote");this.root.push(new VJ({type:B.type,id:B.id}));for(let U=0;U9)throw Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new wJ({ilvl:T0(B),tentative:1}))}},h9=class extends X6{},$J=class extends X6{},SJ=class extends t{constructor(B){super("w:multiLevelType");this.root.push(new C0({val:B}))}},bJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},D8=class extends t{constructor(B,U){super("w:abstractNum");e(this,"id",void 0),this.root.push(new bJ({abstractNumId:T0(B),restartNumberingAfterBreak:0})),this.root.push(new SJ("hybridMultilevel")),this.id=B;for(let G of U)this.root.push(new h9(G))}},vJ=class extends t{constructor(B){super("w:abstractNumId");this.root.push(new C0({val:B}))}},yJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{numId:"w:numId"})}},T8=class extends t{constructor(B){super("w:num");if(e(this,"numId",void 0),e(this,"reference",void 0),e(this,"instance",void 0),this.numId=B.numId,this.reference=B.reference,this.instance=B.instance,this.root.push(new yJ({numId:T0(B.numId)})),this.root.push(new vJ(T0(B.abstractNumId))),B.overrideLevels&&B.overrideLevels.length)for(let U of B.overrideLevels)this.root.push(new u9(U.num,U.start))}},gJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{ilvl:"w:ilvl"})}},u9=class extends t{constructor(B,U){super("w:lvlOverride");if(this.root.push(new gJ({ilvl:B})),U!==void 0)this.root.push(new xJ(U))}},fJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},xJ=class extends t{constructor(B){super("w:startOverride");this.root.push(new fJ({val:B}))}},d9=class extends t{constructor(B){super("w:numbering");e(this,"abstractNumberingMap",new Map),e(this,"concreteNumberingMap",new Map),e(this,"referenceConfigMap",new Map),e(this,"abstractNumUniqueNumericId",nB()),e(this,"concreteNumUniqueNumericId",sB()),this.root.push(new F1(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let U=new D8(this.abstractNumUniqueNumericId(),[{level:0,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(0.5),hanging:u0(0.25)}}}},{level:1,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:u0(1),hanging:u0(0.25)}}}},{level:2,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:2160,hanging:u0(0.25)}}}},{level:3,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:2880,hanging:u0(0.25)}}}},{level:4,format:i0.BULLET,text:"○",alignment:c0.LEFT,style:{paragraph:{indent:{left:3600,hanging:u0(0.25)}}}},{level:5,format:i0.BULLET,text:"■",alignment:c0.LEFT,style:{paragraph:{indent:{left:4320,hanging:u0(0.25)}}}},{level:6,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5040,hanging:u0(0.25)}}}},{level:7,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:5760,hanging:u0(0.25)}}}},{level:8,format:i0.BULLET,text:"●",alignment:c0.LEFT,style:{paragraph:{indent:{left:6480,hanging:u0(0.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new T8({numId:1,abstractNumId:U.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",U);for(let G of B.config)this.abstractNumberingMap.set(G.reference,new D8(this.abstractNumUniqueNumericId(),G.levels)),this.referenceConfigMap.set(G.reference,G.levels)}prepForXml(B){for(let U of this.abstractNumberingMap.values())this.root.push(U);for(let U of this.concreteNumberingMap.values())this.root.push(U);return super.prepForXml(B)}createConcreteNumberingInstance(B,U){let G=this.abstractNumberingMap.get(B);if(!G)return;let Y=`${B}-${U}`;if(this.concreteNumberingMap.has(Y))return;let Q=this.referenceConfigMap.get(B),K=Q&&Q[0].start,Z={numId:this.concreteNumUniqueNumericId(),abstractNumId:G.id,reference:B,instance:U,overrideLevels:[typeof K==="number"&&Number.isInteger(K)?{num:0,start:K}:{num:0,start:1}]};this.concreteNumberingMap.set(Y,new T8(Z))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},_J=(B)=>new M0({name:"w:compatSetting",attributes:{version:{key:"w:val",value:B},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),hJ=class extends t{constructor(B){super("w:compat");if(B.version)this.root.push(_J(B.version));if(B.useSingleBorderforContiguousCells)this.root.push(new q0("w:useSingleBorderforContiguousCells",B.useSingleBorderforContiguousCells));if(B.wordPerfectJustification)this.root.push(new q0("w:wpJustification",B.wordPerfectJustification));if(B.noTabStopForHangingIndent)this.root.push(new q0("w:noTabHangInd",B.noTabStopForHangingIndent));if(B.noLeading)this.root.push(new q0("w:noLeading",B.noLeading));if(B.spaceForUnderline)this.root.push(new q0("w:spaceForUL",B.spaceForUnderline));if(B.noColumnBalance)this.root.push(new q0("w:noColumnBalance",B.noColumnBalance));if(B.balanceSingleByteDoubleByteWidth)this.root.push(new q0("w:balanceSingleByteDoubleByteWidth",B.balanceSingleByteDoubleByteWidth));if(B.noExtraLineSpacing)this.root.push(new q0("w:noExtraLineSpacing",B.noExtraLineSpacing));if(B.doNotLeaveBackslashAlone)this.root.push(new q0("w:doNotLeaveBackslashAlone",B.doNotLeaveBackslashAlone));if(B.underlineTrailingSpaces)this.root.push(new q0("w:ulTrailSpace",B.underlineTrailingSpaces));if(B.doNotExpandShiftReturn)this.root.push(new q0("w:doNotExpandShiftReturn",B.doNotExpandShiftReturn));if(B.spacingInWholePoints)this.root.push(new q0("w:spacingInWholePoints",B.spacingInWholePoints));if(B.lineWrapLikeWord6)this.root.push(new q0("w:lineWrapLikeWord6",B.lineWrapLikeWord6));if(B.printBodyTextBeforeHeader)this.root.push(new q0("w:printBodyTextBeforeHeader",B.printBodyTextBeforeHeader));if(B.printColorsBlack)this.root.push(new q0("w:printColBlack",B.printColorsBlack));if(B.spaceWidth)this.root.push(new q0("w:wpSpaceWidth",B.spaceWidth));if(B.showBreaksInFrames)this.root.push(new q0("w:showBreaksInFrames",B.showBreaksInFrames));if(B.subFontBySize)this.root.push(new q0("w:subFontBySize",B.subFontBySize));if(B.suppressBottomSpacing)this.root.push(new q0("w:suppressBottomSpacing",B.suppressBottomSpacing));if(B.suppressTopSpacing)this.root.push(new q0("w:suppressTopSpacing",B.suppressTopSpacing));if(B.suppressSpacingAtTopOfPage)this.root.push(new q0("w:suppressSpacingAtTopOfPage",B.suppressSpacingAtTopOfPage));if(B.suppressTopSpacingWP)this.root.push(new q0("w:suppressTopSpacingWP",B.suppressTopSpacingWP));if(B.suppressSpBfAfterPgBrk)this.root.push(new q0("w:suppressSpBfAfterPgBrk",B.suppressSpBfAfterPgBrk));if(B.swapBordersFacingPages)this.root.push(new q0("w:swapBordersFacingPages",B.swapBordersFacingPages));if(B.convertMailMergeEsc)this.root.push(new q0("w:convMailMergeEsc",B.convertMailMergeEsc));if(B.truncateFontHeightsLikeWP6)this.root.push(new q0("w:truncateFontHeightsLikeWP6",B.truncateFontHeightsLikeWP6));if(B.macWordSmallCaps)this.root.push(new q0("w:mwSmallCaps",B.macWordSmallCaps));if(B.usePrinterMetrics)this.root.push(new q0("w:usePrinterMetrics",B.usePrinterMetrics));if(B.doNotSuppressParagraphBorders)this.root.push(new q0("w:doNotSuppressParagraphBorders",B.doNotSuppressParagraphBorders));if(B.wrapTrailSpaces)this.root.push(new q0("w:wrapTrailSpaces",B.wrapTrailSpaces));if(B.footnoteLayoutLikeWW8)this.root.push(new q0("w:footnoteLayoutLikeWW8",B.footnoteLayoutLikeWW8));if(B.shapeLayoutLikeWW8)this.root.push(new q0("w:shapeLayoutLikeWW8",B.shapeLayoutLikeWW8));if(B.alignTablesRowByRow)this.root.push(new q0("w:alignTablesRowByRow",B.alignTablesRowByRow));if(B.forgetLastTabAlignment)this.root.push(new q0("w:forgetLastTabAlignment",B.forgetLastTabAlignment));if(B.adjustLineHeightInTable)this.root.push(new q0("w:adjustLineHeightInTable",B.adjustLineHeightInTable));if(B.autoSpaceLikeWord95)this.root.push(new q0("w:autoSpaceLikeWord95",B.autoSpaceLikeWord95));if(B.noSpaceRaiseLower)this.root.push(new q0("w:noSpaceRaiseLower",B.noSpaceRaiseLower));if(B.doNotUseHTMLParagraphAutoSpacing)this.root.push(new q0("w:doNotUseHTMLParagraphAutoSpacing",B.doNotUseHTMLParagraphAutoSpacing));if(B.layoutRawTableWidth)this.root.push(new q0("w:layoutRawTableWidth",B.layoutRawTableWidth));if(B.layoutTableRowsApart)this.root.push(new q0("w:layoutTableRowsApart",B.layoutTableRowsApart));if(B.useWord97LineBreakRules)this.root.push(new q0("w:useWord97LineBreakRules",B.useWord97LineBreakRules));if(B.doNotBreakWrappedTables)this.root.push(new q0("w:doNotBreakWrappedTables",B.doNotBreakWrappedTables));if(B.doNotSnapToGridInCell)this.root.push(new q0("w:doNotSnapToGridInCell",B.doNotSnapToGridInCell));if(B.selectFieldWithFirstOrLastCharacter)this.root.push(new q0("w:selectFldWithFirstOrLastChar",B.selectFieldWithFirstOrLastCharacter));if(B.applyBreakingRules)this.root.push(new q0("w:applyBreakingRules",B.applyBreakingRules));if(B.doNotWrapTextWithPunctuation)this.root.push(new q0("w:doNotWrapTextWithPunct",B.doNotWrapTextWithPunctuation));if(B.doNotUseEastAsianBreakRules)this.root.push(new q0("w:doNotUseEastAsianBreakRules",B.doNotUseEastAsianBreakRules));if(B.useWord2002TableStyleRules)this.root.push(new q0("w:useWord2002TableStyleRules",B.useWord2002TableStyleRules));if(B.growAutofit)this.root.push(new q0("w:growAutofit",B.growAutofit));if(B.useFELayout)this.root.push(new q0("w:useFELayout",B.useFELayout));if(B.useNormalStyleForList)this.root.push(new q0("w:useNormalStyleForList",B.useNormalStyleForList));if(B.doNotUseIndentAsNumberingTabStop)this.root.push(new q0("w:doNotUseIndentAsNumberingTabStop",B.doNotUseIndentAsNumberingTabStop));if(B.useAlternateEastAsianLineBreakRules)this.root.push(new q0("w:useAltKinsokuLineBreakRules",B.useAlternateEastAsianLineBreakRules));if(B.allowSpaceOfSameStyleInTable)this.root.push(new q0("w:allowSpaceOfSameStyleInTable",B.allowSpaceOfSameStyleInTable));if(B.doNotSuppressIndentation)this.root.push(new q0("w:doNotSuppressIndentation",B.doNotSuppressIndentation));if(B.doNotAutofitConstrainedTables)this.root.push(new q0("w:doNotAutofitConstrainedTables",B.doNotAutofitConstrainedTables));if(B.autofitToFirstFixedWidthCell)this.root.push(new q0("w:autofitToFirstFixedWidthCell",B.autofitToFirstFixedWidthCell));if(B.underlineTabInNumberingList)this.root.push(new q0("w:underlineTabInNumList",B.underlineTabInNumberingList));if(B.displayHangulFixedWidth)this.root.push(new q0("w:displayHangulFixedWidth",B.displayHangulFixedWidth));if(B.splitPgBreakAndParaMark)this.root.push(new q0("w:splitPgBreakAndParaMark",B.splitPgBreakAndParaMark));if(B.doNotVerticallyAlignCellWithSp)this.root.push(new q0("w:doNotVertAlignCellWithSp",B.doNotVerticallyAlignCellWithSp));if(B.doNotBreakConstrainedForcedTable)this.root.push(new q0("w:doNotBreakConstrainedForcedTable",B.doNotBreakConstrainedForcedTable));if(B.ignoreVerticalAlignmentInTextboxes)this.root.push(new q0("w:doNotVertAlignInTxbx",B.ignoreVerticalAlignmentInTextboxes));if(B.useAnsiKerningPairs)this.root.push(new q0("w:useAnsiKerningPairs",B.useAnsiKerningPairs));if(B.cachedColumnBalance)this.root.push(new q0("w:cachedColBalance",B.cachedColumnBalance))}},uJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},dJ=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w:settings");if(this.root.push(new uJ({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new q0("w:displayBackgroundShape",!0)),B.trackRevisions!==void 0)this.root.push(new q0("w:trackRevisions",B.trackRevisions));if(B.evenAndOddHeaders!==void 0)this.root.push(new q0("w:evenAndOddHeaders",B.evenAndOddHeaders));if(B.updateFields!==void 0)this.root.push(new q0("w:updateFields",B.updateFields));if(B.defaultTabStop!==void 0)this.root.push(new _2("w:defaultTabStop",B.defaultTabStop));if(((U=B.hyphenation)===null||U===void 0?void 0:U.autoHyphenation)!==void 0)this.root.push(new q0("w:autoHyphenation",B.hyphenation.autoHyphenation));if(((G=B.hyphenation)===null||G===void 0?void 0:G.hyphenationZone)!==void 0)this.root.push(new _2("w:hyphenationZone",B.hyphenation.hyphenationZone));if(((Y=B.hyphenation)===null||Y===void 0?void 0:Y.consecutiveHyphenLimit)!==void 0)this.root.push(new _2("w:consecutiveHyphenLimit",B.hyphenation.consecutiveHyphenLimit));if(((Q=B.hyphenation)===null||Q===void 0?void 0:Q.doNotHyphenateCaps)!==void 0)this.root.push(new q0("w:doNotHyphenateCaps",B.hyphenation.doNotHyphenateCaps));this.root.push(new hJ(L0(L0({},(K=B.compatibility)!==null&&K!==void 0?K:{}),{},{version:(Z=(J=(q=B.compatibility)===null||q===void 0?void 0:q.version)!==null&&J!==void 0?J:B.compatibilityModeVersion)!==null&&Z!==void 0?Z:15})))}},c9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},cJ=class extends t{constructor(B){super("w:name");this.root.push(new c9({val:B}))}},mJ=class extends t{constructor(B){super("w:uiPriority");this.root.push(new c9({val:T0(B)}))}},lJ=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},m9=class extends t{constructor(B,U){super("w:style");if(this.root.push(new lJ(B)),U.name)this.root.push(new cJ(U.name));if(U.basedOn)this.root.push(new q2("w:basedOn",U.basedOn));if(U.next)this.root.push(new q2("w:next",U.next));if(U.link)this.root.push(new q2("w:link",U.link));if(U.uiPriority!==void 0)this.root.push(new mJ(U.uiPriority));if(U.semiHidden!==void 0)this.root.push(new q0("w:semiHidden",U.semiHidden));if(U.unhideWhenUsed!==void 0)this.root.push(new q0("w:unhideWhenUsed",U.unhideWhenUsed));if(U.quickFormat!==void 0)this.root.push(new q0("w:qFormat",U.quickFormat))}},p2=class extends m9{constructor(B){super({type:"paragraph",styleId:B.id},B);e(this,"paragraphProperties",void 0),e(this,"runProperties",void 0),this.paragraphProperties=new M2(B.paragraph),this.runProperties=new U2(B.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},$2=class extends m9{constructor(B){super({type:"character",styleId:B.id},L0({uiPriority:99,unhideWhenUsed:!0},B));e(this,"runProperties",void 0),this.runProperties=new U2(B.run),this.root.push(this.runProperties)}},j2=class extends p2{constructor(B){super(L0({basedOn:"Normal",next:"Normal",quickFormat:!0},B))}},aJ=class extends j2{constructor(B){super(L0({id:"Title",name:"Title"},B))}},pJ=class extends j2{constructor(B){super(L0({id:"Heading1",name:"Heading 1"},B))}},rJ=class extends j2{constructor(B){super(L0({id:"Heading2",name:"Heading 2"},B))}},iJ=class extends j2{constructor(B){super(L0({id:"Heading3",name:"Heading 3"},B))}},nJ=class extends j2{constructor(B){super(L0({id:"Heading4",name:"Heading 4"},B))}},sJ=class extends j2{constructor(B){super(L0({id:"Heading5",name:"Heading 5"},B))}},oJ=class extends j2{constructor(B){super(L0({id:"Heading6",name:"Heading 6"},B))}},tJ=class extends j2{constructor(B){super(L0({id:"Strong",name:"Strong"},B))}},eJ=class extends p2{constructor(B){super(L0({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},B))}},BK=class extends p2{constructor(B){super(L0({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},UK=class extends $2{constructor(B){super(L0({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},GK=class extends $2{constructor(B){super(L0({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},B))}},YK=class extends p2{constructor(B){super(L0({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:k2.AUTO}},run:{size:20}},B))}},ZK=class extends $2{constructor(B){super(L0({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},QK=class extends $2{constructor(B){super(L0({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},B))}},JK=class extends $2{constructor(B){super(L0({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:i8.SINGLE}}},B))}},S1=class extends t{constructor(B){super("w:styles");if(B.initialStyles)this.root.push(B.initialStyles);if(B.importedStyles)for(let U of B.importedStyles)this.root.push(U);if(B.paragraphStyles)for(let U of B.paragraphStyles)this.root.push(new p2(U));if(B.characterStyles)for(let U of B.characterStyles)this.root.push(new $2(U))}},l9=class extends t{constructor(B){super("w:pPrDefault");this.root.push(new M2(B))}},a9=class extends t{constructor(B){super("w:rPrDefault");this.root.push(new U2(B))}},p9=class extends t{constructor(B){super("w:docDefaults");e(this,"runPropertiesDefaults",void 0),e(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new a9(B.run),this.paragraphPropertiesDefaults=new l9(B.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},KK=class{newInstance(B){let U=(0,h1.xml2js)(B,{compact:!1}),G;for(let Q of U.elements||[])if(Q.name==="w:styles")G=Q;if(G===void 0)throw Error("can not find styles element");let Y=G.elements||[];return{initialStyles:new $B(G.attributes),importedStyles:Y.map((Q)=>u1(Q))}}},M8=class{newInstance(B={}){var U;return{initialStyles:new F1(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new p9((U=B.document)!==null&&U!==void 0?U:{}),new aJ(L0({run:{size:56}},B.title)),new pJ(L0({run:{color:"2E74B5",size:32}},B.heading1)),new rJ(L0({run:{color:"2E74B5",size:26}},B.heading2)),new iJ(L0({run:{color:"1F4D78",size:24}},B.heading3)),new nJ(L0({run:{color:"2E74B5",italics:!0}},B.heading4)),new sJ(L0({run:{color:"2E74B5"}},B.heading5)),new oJ(L0({run:{color:"1F4D78"}},B.heading6)),new tJ(L0({run:{bold:!0}},B.strong)),new eJ(B.listParagraph||{}),new JK(B.hyperlink||{}),new UK(B.footnoteReference||{}),new BK(B.footnoteText||{}),new GK(B.footnoteTextChar||{}),new ZK(B.endnoteReference||{}),new YK(B.endnoteText||{}),new QK(B.endnoteTextChar||{})]}}},VK=class{constructor(B){var U,G,Y,Q,K,Z,J,q,W,I,H,T;if(e(this,"currentRelationshipId",1),e(this,"documentWrapper",void 0),e(this,"headers",[]),e(this,"footers",[]),e(this,"coreProperties",void 0),e(this,"numbering",void 0),e(this,"media",void 0),e(this,"fileRelationships",void 0),e(this,"footnotesWrapper",void 0),e(this,"endnotesWrapper",void 0),e(this,"settings",void 0),e(this,"contentTypes",void 0),e(this,"customProperties",void 0),e(this,"appProperties",void 0),e(this,"styles",void 0),e(this,"comments",void 0),e(this,"commentsExtended",void 0),e(this,"fontWrapper",void 0),this.coreProperties=new dQ(L0(L0({},B),{},{creator:(U=B.creator)!==null&&U!==void 0?U:"Un-named",revision:(G=B.revision)!==null&&G!==void 0?G:1,lastModifiedBy:(Y=B.lastModifiedBy)!==null&&Y!==void 0?Y:"Un-named"})),this.numbering=new d9(B.numbering?B.numbering:{config:[]}),this.comments=new z4((Q=B.comments)!==null&&Q!==void 0?Q:{children:[]}),this.comments.ThreadData)this.commentsExtended=new E4(this.comments.ThreadData);if(this.fileRelationships=new A2,this.customProperties=new rQ((K=B.customProperties)!==null&&K!==void 0?K:[]),this.appProperties=new _Q,this.footnotesWrapper=new PJ,this.endnotesWrapper=new RJ,this.contentTypes=new uQ,this.documentWrapper=new JJ({background:B.background}),this.settings=new dJ({compatibilityModeVersion:B.compatabilityModeVersion,compatibility:B.compatibility,evenAndOddHeaders:B.evenAndOddHeaderAndFooters?!0:!1,trackRevisions:(Z=B.features)===null||Z===void 0?void 0:Z.trackRevisions,updateFields:(J=B.features)===null||J===void 0?void 0:J.updateFields,defaultTabStop:B.defaultTabStop,hyphenation:{autoHyphenation:(q=B.hyphenation)===null||q===void 0?void 0:q.autoHyphenation,hyphenationZone:(W=B.hyphenation)===null||W===void 0?void 0:W.hyphenationZone,consecutiveHyphenLimit:(I=B.hyphenation)===null||I===void 0?void 0:I.consecutiveHyphenLimit,doNotHyphenateCaps:(H=B.hyphenation)===null||H===void 0?void 0:H.doNotHyphenateCaps}}),this.media=new V6,B.externalStyles!==void 0){var A;let P=new M8().newInstance((A=B.styles)===null||A===void 0?void 0:A.default),j=new KK().newInstance(B.externalStyles);this.styles=new S1(L0(L0({},j),{},{importedStyles:[...P.importedStyles,...j.importedStyles]}))}else if(B.styles){let P=new M8().newInstance(B.styles.default);this.styles=new S1(L0(L0({},P),B.styles))}else{let P=new M8;this.styles=new S1(P.newInstance())}this.addDefaultRelationships();for(let P of B.sections)this.addSection(P);if(B.footnotes)for(let P in B.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(P),B.footnotes[P].children);if(B.endnotes)for(let P in B.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(P),B.endnotes[P].children);this.fontWrapper=new h4((T=B.fonts)!==null&&T!==void 0?T:[])}addSection({headers:B={},footers:U={},children:G,properties:Y}){this.documentWrapper.View.Body.addSection(L0(L0({},Y),{},{headerWrapperGroup:{default:B.default?this.createHeader(B.default):void 0,first:B.first?this.createHeader(B.first):void 0,even:B.even?this.createHeader(B.even):void 0},footerWrapperGroup:{default:U.default?this.createFooter(U.default):void 0,first:U.first?this.createFooter(U.first):void 0,even:U.even?this.createFooter(U.even):void 0}}));for(let Q of G)this.documentWrapper.View.add(Q)}createHeader(B){let U=new _9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addHeaderToDocument(U),U}createFooter(B){let U=new f9(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addFooterToDocument(U),U}addHeaderToDocument(B,U=T2.DEFAULT){this.headers.push({header:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(B,U=T2.DEFAULT){this.footers.push({footer:B,type:U}),this.documentWrapper.Relationships.addRelationship(B.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){if(this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.commentsExtended)this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map((B)=>B.header)}get Footers(){return this.footers.map((B)=>B.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get FontTable(){return this.fontWrapper}},XK=class extends t{constructor(B={}){super("w:instrText");e(this,"properties",void 0),this.properties=B,this.root.push(new _0({space:x0.PRESERVE}));let U="TOC";if(this.properties.captionLabel)U=`${U} \\a "${this.properties.captionLabel}"`;if(this.properties.entriesFromBookmark)U=`${U} \\b "${this.properties.entriesFromBookmark}"`;if(this.properties.captionLabelIncludingNumbers)U=`${U} \\c "${this.properties.captionLabelIncludingNumbers}"`;if(this.properties.sequenceAndPageNumbersSeparator)U=`${U} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`;if(this.properties.tcFieldIdentifier)U=`${U} \\f "${this.properties.tcFieldIdentifier}"`;if(this.properties.hyperlink)U=`${U} \\h`;if(this.properties.tcFieldLevelRange)U=`${U} \\l "${this.properties.tcFieldLevelRange}"`;if(this.properties.pageNumbersEntryLevelsRange)U=`${U} \\n "${this.properties.pageNumbersEntryLevelsRange}"`;if(this.properties.headingStyleRange)U=`${U} \\o "${this.properties.headingStyleRange}"`;if(this.properties.entryAndPageNumberSeparator)U=`${U} \\p "${this.properties.entryAndPageNumberSeparator}"`;if(this.properties.seqFieldIdentifierForPrefix)U=`${U} \\s "${this.properties.seqFieldIdentifierForPrefix}"`;if(this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let G=this.properties.stylesWithLevels.map((Y)=>`${Y.styleName},${Y.level}`).join(",");U=`${U} \\t "${G}"`}if(this.properties.useAppliedParagraphOutlineLevel)U=`${U} \\u`;if(this.properties.preserveTabInEntries)U=`${U} \\w`;if(this.properties.preserveNewLineInEntries)U=`${U} \\x`;if(this.properties.hideTabAndPageNumbersInWebView)U=`${U} \\z`;this.root.push(U)}},r9=class extends t{constructor(){super("w:sdtContent")}},i9=class extends t{constructor(B){super("w:sdtPr");if(B)this.root.push(new q2("w:alias",B))}};function qK(B,U){if(B==null)return{};var G={};for(var Y in B)if({}.hasOwnProperty.call(B,Y)){if(U.includes(Y))continue;G[Y]=B[Y]}return G}function n9(B,U){if(B==null)return{};var G,Y,Q=qK(B,U);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(B);for(Y=0;Y0){let{stylesWithLevels:W}=K,I=Y.map((T,A)=>{var P,j;let E=this.buildCachedContentParagraphChild(T,K),C=(P=W===null||W===void 0||(j=W.find((v)=>v.level===T.level))===null||j===void 0?void 0:j.styleName)!==null&&P!==void 0?P:`TOC${T.level}`,N=A===0?[...J,E]:A===Y.length-1?[E,...q]:[E];return new d0({style:C,tabStops:this.getTabStopsForLevel(T.level),children:N})}),H=I;if(Y.length<=1)H=[...I,new d0({children:q})];for(let T of H)Z.addChildElement(T)}else{let W=new d0({children:J});Z.addChildElement(W);for(let H of G)Z.addChildElement(H);let I=new d0({children:q});Z.addChildElement(I)}this.root.push(Z)}getTabStopsForLevel(B,U=9025){return[{type:"clear",position:U+1-(B-1)*240},{type:"right",position:U,leader:"dot"}]}buildCachedContentRun(B,U){var G,Y;return new D0({style:(U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0?"IndexLink":void 0,children:[new Z1({text:B.title}),new T4,new Z1({text:(G=(Y=B.page)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:""})]})}buildCachedContentParagraphChild(B,U){let G=this.buildCachedContentRun(B,U);if((U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0)return new y4({anchor:B.href,children:[G]});return G}},LK=class{constructor(B,U){e(this,"styleName",void 0),e(this,"level",void 0),this.styleName=B,this.level=U}},IK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},OK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},s9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},o9=class extends t{constructor(B){super("w:footnoteReference");this.root.push(new s9({id:B}))}},HK=class extends D0{constructor(B){super({style:"FootnoteReference"});this.root.push(new o9(B))}},t9=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},e9=class extends t{constructor(B){super("w:endnoteReference");this.root.push(new t9({id:B}))}},FK=class extends D0{constructor(B){super({style:"EndnoteReference"});this.root.push(new e9(B))}},o6=class extends H0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w14:val",symbolfont:"w14:font"})}},b1=class extends t{constructor(B,U,G){super(B);if(G)this.root.push(new o6({val:SB(U),symbolfont:G}));else this.root.push(new o6({val:U}))}},B5=class extends t{constructor(B){var U,G,Y,Q,K,Z,J,q;super("w14:checkbox");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let W=(B===null||B===void 0?void 0:B.checked)?"1":"0",I,H;this.root.push(new b1("w14:checked",W)),I=(B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.value)?B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value:this.DEFAULT_CHECKED_SYMBOL,H=(B===null||B===void 0||(Y=B.checkedState)===null||Y===void 0?void 0:Y.font)?B===null||B===void 0||(Q=B.checkedState)===null||Q===void 0?void 0:Q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:checkedState",I,H)),I=(B===null||B===void 0||(K=B.uncheckedState)===null||K===void 0?void 0:K.value)?B===null||B===void 0||(Z=B.uncheckedState)===null||Z===void 0?void 0:Z.value:this.DEFAULT_UNCHECKED_SYMBOL,H=(B===null||B===void 0||(J=B.uncheckedState)===null||J===void 0?void 0:J.font)?B===null||B===void 0||(q=B.uncheckedState)===null||q===void 0?void 0:q.font:this.DEFAULT_FONT,this.root.push(new b1("w14:uncheckedState",I,H))}},WK=class extends t{constructor(B){var U,G,Y,Q;super("w:sdt");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let K=new i9(B===null||B===void 0?void 0:B.alias);K.addChildElement(new B5(B)),this.root.push(K);let Z=new r9,J=B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.font,q=B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value,W=B===null||B===void 0||(Y=B.uncheckedState)===null||Y===void 0?void 0:Y.font,I=B===null||B===void 0||(Q=B.uncheckedState)===null||Q===void 0?void 0:Q.value,H,T;if(B===null||B===void 0?void 0:B.checked)H=J?J:this.DEFAULT_FONT,T=q?q:this.DEFAULT_CHECKED_SYMBOL;else H=W?W:this.DEFAULT_FONT,T=I?I:this.DEFAULT_UNCHECKED_SYMBOL;let A=new aB({char:T,symbolfont:H});Z.addChildElement(A),this.root.push(Z)}},PK=({shape:B})=>new M0({name:"w:pict",children:[B]}),AK=({children:B=[]})=>new M0({name:"w:txbxContent",children:B}),jK=({style:B,children:U,inset:G})=>new M0({name:"v:textbox",attributes:{style:{key:"style",value:B},insetMode:{key:"insetmode",value:G?"custom":"auto"},inset:{key:"inset",value:G?`${G.left}, ${G.top}, ${G.right}, ${G.bottom}`:void 0}},children:[AK({children:U})]}),NK="#_x0000_t202",wK={flip:"flip",height:"height",left:"left",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",positionHorizontal:"mso-position-horizontal",positionHorizontalRelative:"mso-position-horizontal-relative",positionVertical:"mso-position-vertical",positionVerticalRelative:"mso-position-vertical-relative",wrapDistanceBottom:"mso-wrap-distance-bottom",wrapDistanceLeft:"mso-wrap-distance-left",wrapDistanceRight:"mso-wrap-distance-right",wrapDistanceTop:"mso-wrap-distance-top",wrapEdited:"mso-wrap-edited",wrapStyle:"mso-wrap-style",position:"position",rotation:"rotation",top:"top",visibility:"visibility",width:"width",zIndex:"z-index"},zK=(B)=>B?Object.entries(B).map(([U,G])=>`${wK[U]}:${G}`).join(";"):void 0,EK=({id:B,children:U,type:G=NK,style:Y})=>new M0({name:"v:shape",attributes:{id:{key:"id",value:B},type:{key:"type",value:G},style:{key:"style",value:zK(Y)}},children:[jK({style:"mso-fit-shape-to-text:t;",children:U})]}),DK=["style","children"],TK=class extends H1{constructor(B){let{style:U,children:G}=B,Y=n9(B,DK);super("w:p");this.root.push(new M2(Y)),this.root.push(PK({shape:EK({children:G,id:O1(),style:U})}))}},CK=R0((B,U)=>{d2(),P2();/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -35,8 +35,8 @@ Actual: `+w.attribValue);else{var Z0=w.tag,g=w.tags[w.tags.length-1]||w;if(Z0.ns JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE - */(function(G){if(typeof B=="object"&&typeof U<"u")U.exports=G();else if(typeof define=="function"&&define.amd)define([],G);else(typeof window<"u"?window:typeof v0<"u"?v0:typeof self<"u"?self:this).JSZip=G()})(function(){return function G(Y,Q,K){function Z(W,I){if(!Q[W]){if(!Y[W]){var H=typeof w1=="function"&&w1;if(!I&&H)return H(W,!0);if(J)return J(W,!0);var T=Error("Cannot find module '"+W+"'");throw T.code="MODULE_NOT_FOUND",T}var A=Q[W]={exports:{}};Y[W][0].call(A.exports,function(P){var j=Y[W][1][P];return Z(j||P)},A,A.exports,G,Y,Q,K)}return Q[W].exports}for(var J=typeof w1=="function"&&w1,q=0;q>2,A=(3&W)<<4|I>>4,P=1>6:64,j=2>4,I=(15&T)<<4|(A=J.indexOf(q.charAt(j++)))>>2,H=(3&A)<<6|(P=J.indexOf(q.charAt(j++))),N[E++]=W,A!==64&&(N[E++]=I),P!==64&&(N[E++]=H);return N}},{"./support":30,"./utils":32}],2:[function(G,Y,Q){var K=G("./external"),Z=G("./stream/DataWorker"),J=G("./stream/Crc32Probe"),q=G("./stream/DataLengthProbe");function W(I,H,T,A,P){this.compressedSize=I,this.uncompressedSize=H,this.crc32=T,this.compression=A,this.compressedContent=P}W.prototype={getContentWorker:function(){var I=new Z(K.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new q("data_length")),H=this;return I.on("end",function(){if(this.streamInfo.data_length!==H.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),I},getCompressedWorker:function(){return new Z(K.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},W.createWorkerFrom=function(I,H,T){return I.pipe(new J).pipe(new q("uncompressedSize")).pipe(H.compressWorker(T)).pipe(new q("compressedSize")).withStreamInfo("compression",H)},Y.exports=W},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(G,Y,Q){var K=G("./stream/GenericWorker");Q.STORE={magic:"\x00\x00",compressWorker:function(){return new K("STORE compression")},uncompressWorker:function(){return new K("STORE decompression")}},Q.DEFLATE=G("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(G,Y,Q){var K=G("./utils"),Z=function(){for(var J,q=[],W=0;W<256;W++){J=W;for(var I=0;I<8;I++)J=1&J?3988292384^J>>>1:J>>>1;q[W]=J}return q}();Y.exports=function(J,q){return J!==void 0&&J.length?K.getTypeOf(J)!=="string"?function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I[j])];return-1^W}(0|q,J,J.length,0):function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I.charCodeAt(j))];return-1^W}(0|q,J,J.length,0):0}},{"./utils":32}],5:[function(G,Y,Q){Q.base64=!1,Q.binary=!1,Q.dir=!1,Q.createFolders=!0,Q.date=null,Q.compression=null,Q.compressionOptions=null,Q.comment=null,Q.unixPermissions=null,Q.dosPermissions=null},{}],6:[function(G,Y,Q){var K=null;K=typeof Promise<"u"?Promise:G("lie"),Y.exports={Promise:K}},{lie:37}],7:[function(G,Y,Q){var K=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",Z=G("pako"),J=G("./utils"),q=G("./stream/GenericWorker"),W=K?"uint8array":"array";function I(H,T){q.call(this,"FlateWorker/"+H),this._pako=null,this._pakoAction=H,this._pakoOptions=T,this.meta={}}Q.magic="\b\x00",J.inherits(I,q),I.prototype.processChunk=function(H){this.meta=H.meta,this._pako===null&&this._createPako(),this._pako.push(J.transformTo(W,H.data),!1)},I.prototype.flush=function(){q.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},I.prototype.cleanUp=function(){q.prototype.cleanUp.call(this),this._pako=null},I.prototype._createPako=function(){this._pako=new Z[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var H=this;this._pako.onData=function(T){H.push({data:T,meta:H.meta})}},Q.compressWorker=function(H){return new I("Deflate",H)},Q.uncompressWorker=function(){return new I("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(G,Y,Q){function K(A,P){var j,E="";for(j=0;j>>=8;return E}function Z(A,P,j,E,C,N){var v,S,F=A.file,M=A.compression,$=N!==W.utf8encode,x=J.transformTo("string",N(F.name)),z=J.transformTo("string",W.utf8encode(F.name)),a=F.comment,U0=J.transformTo("string",N(a)),b=J.transformTo("string",W.utf8encode(a)),c=z.length!==F.name.length,D=b.length!==a.length,m="",B0="",i="",V0=F.dir,s=F.date,G0={crc32:0,compressedSize:0,uncompressedSize:0};P&&!j||(G0.crc32=A.crc32,G0.compressedSize=A.compressedSize,G0.uncompressedSize=A.uncompressedSize);var r=0;P&&(r|=8),$||!c&&!D||(r|=2048);var y=0,n=0;V0&&(y|=16),C==="UNIX"?(n=798,y|=function(Y0,O0){var w=Y0;return Y0||(w=O0?16893:33204),(65535&w)<<16}(F.unixPermissions,V0)):(n=20,y|=function(Y0){return 63&(Y0||0)}(F.dosPermissions)),v=s.getUTCHours(),v<<=6,v|=s.getUTCMinutes(),v<<=5,v|=s.getUTCSeconds()/2,S=s.getUTCFullYear()-1980,S<<=4,S|=s.getUTCMonth()+1,S<<=5,S|=s.getUTCDate(),c&&(B0=K(1,1)+K(I(x),4)+z,m+="up"+K(B0.length,2)+B0),D&&(i=K(1,1)+K(I(U0),4)+b,m+="uc"+K(i.length,2)+i);var o="";return o+=` -\x00`,o+=K(r,2),o+=M.magic,o+=K(v,2),o+=K(S,2),o+=K(G0.crc32,4),o+=K(G0.compressedSize,4),o+=K(G0.uncompressedSize,4),o+=K(x.length,2),o+=K(m.length,2),{fileRecord:H.LOCAL_FILE_HEADER+o+x+m,dirRecord:H.CENTRAL_FILE_HEADER+K(n,2)+o+K(U0.length,2)+"\x00\x00\x00\x00"+K(y,4)+K(E,4)+x+m+U0}}var J=G("../utils"),q=G("../stream/GenericWorker"),W=G("../utf8"),I=G("../crc32"),H=G("../signature");function T(A,P,j,E){q.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=j,this.encodeFileName=E,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}J.inherits(T,q),T.prototype.push=function(A){var P=A.meta.percent||0,j=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,q.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:j?(P+100*(j-E-1))/j:100}}))},T.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var P=this.streamFiles&&!A.file.dir;if(P){var j=Z(A,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},T.prototype.closedSource=function(A){this.accumulate=!1;var P=this.streamFiles&&!A.file.dir,j=Z(A,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),P)this.push({data:function(E){return H.DATA_DESCRIPTOR+K(E.crc32,4)+K(E.compressedSize,4)+K(E.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},T.prototype.flush=function(){for(var A=this.bytesWritten,P=0;P=this.index;q--)W=(W<<8)+this.byteAt(q);return this.index+=J,W},readString:function(J){return K.transformTo("string",this.readData(J))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var J=this.readInt(4);return new Date(Date.UTC(1980+(J>>25&127),(J>>21&15)-1,J>>16&31,J>>11&31,J>>5&63,(31&J)<<1))}},Y.exports=Z},{"../utils":32}],19:[function(G,Y,Q){var K=G("./Uint8ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(G,Y,Q){var K=G("./DataReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.byteAt=function(J){return this.data.charCodeAt(this.zero+J)},Z.prototype.lastIndexOfSignature=function(J){return this.data.lastIndexOf(J)-this.zero},Z.prototype.readAndCheckSignature=function(J){return J===this.readData(4)},Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./DataReader":18}],21:[function(G,Y,Q){var K=G("./ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){if(this.checkOffset(J),J===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./ArrayReader":17}],22:[function(G,Y,Q){var K=G("../utils"),Z=G("../support"),J=G("./ArrayReader"),q=G("./StringReader"),W=G("./NodeBufferReader"),I=G("./Uint8ArrayReader");Y.exports=function(H){var T=K.getTypeOf(H);return K.checkSupport(T),T!=="string"||Z.uint8array?T==="nodebuffer"?new W(H):Z.uint8array?new I(K.transformTo("uint8array",H)):new J(K.transformTo("array",H)):new q(H)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(G,Y,Q){Q.LOCAL_FILE_HEADER="PK\x03\x04",Q.CENTRAL_FILE_HEADER="PK\x01\x02",Q.CENTRAL_DIRECTORY_END="PK\x05\x06",Q.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",Q.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",Q.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../utils");function J(q){K.call(this,"ConvertWorker to "+q),this.destType=q}Z.inherits(J,K),J.prototype.processChunk=function(q){this.push({data:Z.transformTo(this.destType,q.data),meta:q.meta})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],25:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../crc32");function J(){K.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}G("../utils").inherits(J,K),J.prototype.processChunk=function(q){this.streamInfo.crc32=Z(q.data,this.streamInfo.crc32||0),this.push(q)},Y.exports=J},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataLengthProbe for "+q),this.propName=q,this.withStreamInfo(q,0)}K.inherits(J,Z),J.prototype.processChunk=function(q){if(q){var W=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=W+q.data.length}Z.prototype.processChunk.call(this,q)},Y.exports=J},{"../utils":32,"./GenericWorker":28}],27:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataWorker");var W=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,q.then(function(I){W.dataIsReady=!0,W.data=I,W.max=I&&I.length||0,W.type=K.getTypeOf(I),W.isPaused||W._tickAndRepeat()},function(I){W.error(I)})}K.inherits(J,Z),J.prototype.cleanUp=function(){Z.prototype.cleanUp.call(this),this.data=null},J.prototype.resume=function(){return!!Z.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,K.delay(this._tickAndRepeat,[],this)),!0)},J.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(K.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},J.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var q=null,W=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":q=this.data.substring(this.index,W);break;case"uint8array":q=this.data.subarray(this.index,W);break;case"array":case"nodebuffer":q=this.data.slice(this.index,W)}return this.index=W,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],28:[function(G,Y,Q){function K(Z){this.name=Z||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}K.prototype={push:function(Z){this.emit("data",Z)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Z){this.emit("error",Z)}return!0},error:function(Z){return!this.isFinished&&(this.isPaused?this.generatedError=Z:(this.isFinished=!0,this.emit("error",Z),this.previous&&this.previous.error(Z),this.cleanUp()),!0)},on:function(Z,J){return this._listeners[Z].push(J),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Z,J){if(this._listeners[Z])for(var q=0;q "+Z:Z}},Y.exports=K},{}],29:[function(G,Y,Q){var K=G("../utils"),Z=G("./ConvertWorker"),J=G("./GenericWorker"),q=G("../base64"),W=G("../support"),I=G("../external"),H=null;if(W.nodestream)try{H=G("../nodejs/NodejsStreamOutputAdapter")}catch(P){}function T(P,j){return new I.Promise(function(E,C){var N=[],v=P._internalType,S=P._outputType,F=P._mimeType;P.on("data",function(M,$){N.push(M),j&&j($)}).on("error",function(M){N=[],C(M)}).on("end",function(){try{E(function(M,$,x){switch(M){case"blob":return K.newBlob(K.transformTo("arraybuffer",$),x);case"base64":return q.encode($);default:return K.transformTo(M,$)}}(S,function(M,$){var x,z=0,a=null,U0=0;for(x=0;x<$.length;x++)U0+=$[x].length;switch(M){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":for(a=new Uint8Array(U0),x=0;x<$.length;x++)a.set($[x],z),z+=$[x].length;return a;case"nodebuffer":return Buffer.concat($);default:throw Error("concat : unsupported type '"+M+"'")}}(v,N),F))}catch(M){C(M)}N=[]}).resume()})}function A(P,j,E){var C=j;switch(j){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=j,this._mimeType=E,K.checkSupport(C),this._worker=P.pipe(new Z(C)),P.lock()}catch(N){this._worker=new J("error"),this._worker.error(N)}}A.prototype={accumulate:function(P){return T(this,P)},on:function(P,j){var E=this;return P==="data"?this._worker.on(P,function(C){j.call(E,C.data,C.meta)}):this._worker.on(P,function(){K.delay(j,arguments,E)}),this},resume:function(){return K.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(P){if(K.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new H(this,{objectMode:this._outputType!=="nodebuffer"},P)}},Y.exports=A},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(G,Y,Q){if(Q.base64=!0,Q.array=!0,Q.string=!0,Q.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Q.nodebuffer=typeof Buffer<"u",Q.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")Q.blob=!1;else{var K=new ArrayBuffer(0);try{Q.blob=new Blob([K],{type:"application/zip"}).size===0}catch(J){try{var Z=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Z.append(K),Q.blob=Z.getBlob("application/zip").size===0}catch(q){Q.blob=!1}}}try{Q.nodestream=!!G("readable-stream").Readable}catch(J){Q.nodestream=!1}},{"readable-stream":16}],31:[function(G,Y,Q){for(var K=G("./utils"),Z=G("./support"),J=G("./nodejsUtils"),q=G("./stream/GenericWorker"),W=Array(256),I=0;I<256;I++)W[I]=252<=I?6:248<=I?5:240<=I?4:224<=I?3:192<=I?2:1;W[254]=W[254]=1;function H(){q.call(this,"utf-8 decode"),this.leftOver=null}function T(){q.call(this,"utf-8 encode")}Q.utf8encode=function(A){return Z.nodebuffer?J.newBufferFrom(A,"utf-8"):function(P){var j,E,C,N,v,S=P.length,F=0;for(N=0;N>>6:(E<65536?j[v++]=224|E>>>12:(j[v++]=240|E>>>18,j[v++]=128|E>>>12&63),j[v++]=128|E>>>6&63),j[v++]=128|63&E);return j}(A)},Q.utf8decode=function(A){return Z.nodebuffer?K.transformTo("nodebuffer",A).toString("utf-8"):function(P){var j,E,C,N,v=P.length,S=Array(2*v);for(j=E=0;j>10&1023,S[E++]=56320|1023&C)}return S.length!==E&&(S.subarray?S=S.subarray(0,E):S.length=E),K.applyFromCharCode(S)}(A=K.transformTo(Z.uint8array?"uint8array":"array",A))},K.inherits(H,q),H.prototype.processChunk=function(A){var P=K.transformTo(Z.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(Z.uint8array){var j=P;(P=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),P.set(j,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var E=function(N,v){var S;for((v=v||N.length)>N.length&&(v=N.length),S=v-1;0<=S&&(192&N[S])==128;)S--;return S<0?v:S===0?v:S+W[N[S]]>v?S:v}(P),C=P;E!==P.length&&(Z.uint8array?(C=P.subarray(0,E),this.leftOver=P.subarray(E,P.length)):(C=P.slice(0,E),this.leftOver=P.slice(E,P.length))),this.push({data:Q.utf8decode(C),meta:A.meta})},H.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:Q.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},Q.Utf8DecodeWorker=H,K.inherits(T,q),T.prototype.processChunk=function(A){this.push({data:Q.utf8encode(A.data),meta:A.meta})},Q.Utf8EncodeWorker=T},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(G,Y,Q){var K=G("./support"),Z=G("./base64"),J=G("./nodejsUtils"),q=G("./external");function W(j){return j}function I(j,E){for(var C=0;C>8;this.dir=!!(16&this.externalFileAttributes),A==0&&(this.dosPermissions=63&this.externalFileAttributes),A==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var A=K(this.extraFields[1].value);this.uncompressedSize===Z.MAX_VALUE_32BITS&&(this.uncompressedSize=A.readInt(8)),this.compressedSize===Z.MAX_VALUE_32BITS&&(this.compressedSize=A.readInt(8)),this.localHeaderOffset===Z.MAX_VALUE_32BITS&&(this.localHeaderOffset=A.readInt(8)),this.diskNumberStart===Z.MAX_VALUE_32BITS&&(this.diskNumberStart=A.readInt(4))}},readExtraFields:function(A){var P,j,E,C=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(A<65536?T[E++]=224|A>>>12:(T[E++]=240|A>>>18,T[E++]=128|A>>>12&63),T[E++]=128|A>>>6&63),T[E++]=128|63&A);return T},Q.buf2binstring=function(H){return I(H,H.length)},Q.binstring2buf=function(H){for(var T=new K.Buf8(H.length),A=0,P=T.length;A>10&1023,N[P++]=56320|1023&j)}return I(N,P)},Q.utf8border=function(H,T){var A;for((T=T||H.length)>H.length&&(T=H.length),A=T-1;0<=A&&(192&H[A])==128;)A--;return A<0?T:A===0?T:A+q[H[A]]>T?A:T}},{"./common":41}],43:[function(G,Y,Q){Y.exports=function(K,Z,J,q){for(var W=65535&K|0,I=K>>>16&65535|0,H=0;J!==0;){for(J-=H=2000>>1:Z>>>1;J[q]=Z}return J}();Y.exports=function(Z,J,q,W){var I=K,H=W+q;Z^=-1;for(var T=W;T>>8^I[255&(Z^J[T])];return-1^Z}},{}],46:[function(G,Y,Q){var K,Z=G("../utils/common"),J=G("./trees"),q=G("./adler32"),W=G("./crc32"),I=G("./messages"),H=0,T=4,A=0,P=-2,j=-1,E=4,C=2,N=8,v=9,S=286,F=30,M=19,$=2*S+1,x=15,z=3,a=258,U0=a+z+1,b=42,c=113,D=1,m=2,B0=3,i=4;function V0(R,p){return R.msg=I[p],p}function s(R){return(R<<1)-(4R.avail_out&&(k=R.avail_out),k!==0&&(Z.arraySet(R.output,p.pending_buf,p.pending_out,k,R.next_out),R.next_out+=k,p.pending_out+=k,R.total_out+=k,R.avail_out-=k,p.pending-=k,p.pending===0&&(p.pending_out=0))}function y(R,p){J._tr_flush_block(R,0<=R.block_start?R.block_start:-1,R.strstart-R.block_start,p),R.block_start=R.strstart,r(R.strm)}function n(R,p){R.pending_buf[R.pending++]=p}function o(R,p){R.pending_buf[R.pending++]=p>>>8&255,R.pending_buf[R.pending++]=255&p}function Y0(R,p){var k,V,X=R.max_chain_length,O=R.strstart,_=R.prev_length,l=R.nice_match,d=R.strstart>R.w_size-U0?R.strstart-(R.w_size-U0):0,Q0=R.window,X0=R.w_mask,K0=R.prev,I0=R.strstart+a,F0=Q0[O+_-1],W0=Q0[O+_];R.prev_length>=R.good_match&&(X>>=2),l>R.lookahead&&(l=R.lookahead);do if(Q0[(k=p)+_]===W0&&Q0[k+_-1]===F0&&Q0[k]===Q0[O]&&Q0[++k]===Q0[O+1]){O+=2,k++;do;while(Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Od&&--X!=0);return _<=R.lookahead?_:R.lookahead}function O0(R){var p,k,V,X,O,_,l,d,Q0,X0,K0=R.w_size;do{if(X=R.window_size-R.lookahead-R.strstart,R.strstart>=K0+(K0-U0)){for(Z.arraySet(R.window,R.window,K0,K0,0),R.match_start-=K0,R.strstart-=K0,R.block_start-=K0,p=k=R.hash_size;V=R.head[--p],R.head[p]=K0<=V?V-K0:0,--k;);for(p=k=K0;V=R.prev[--p],R.prev[p]=K0<=V?V-K0:0,--k;);X+=K0}if(R.strm.avail_in===0)break;if(_=R.strm,l=R.window,d=R.strstart+R.lookahead,Q0=X,X0=void 0,X0=_.avail_in,Q0=z)for(O=R.strstart-R.insert,R.ins_h=R.window[O],R.ins_h=(R.ins_h<=z&&(R.ins_h=(R.ins_h<=z)if(V=J._tr_tally(R,R.strstart-R.match_start,R.match_length-z),R.lookahead-=R.match_length,R.match_length<=R.max_lazy_match&&R.lookahead>=z){for(R.match_length--;R.strstart++,R.ins_h=(R.ins_h<=z&&(R.ins_h=(R.ins_h<=z&&R.match_length<=R.prev_length){for(X=R.strstart+R.lookahead-z,V=J._tr_tally(R,R.strstart-1-R.prev_match,R.prev_length-z),R.lookahead-=R.prev_length-1,R.prev_length-=2;++R.strstart<=X&&(R.ins_h=(R.ins_h<R.pending_buf_size-5&&(k=R.pending_buf_size-5);;){if(R.lookahead<=1){if(O0(R),R.lookahead===0&&p===H)return D;if(R.lookahead===0)break}R.strstart+=R.lookahead,R.lookahead=0;var V=R.block_start+k;if((R.strstart===0||R.strstart>=V)&&(R.lookahead=R.strstart-V,R.strstart=V,y(R,!1),R.strm.avail_out===0))return D;if(R.strstart-R.block_start>=R.w_size-U0&&(y(R,!1),R.strm.avail_out===0))return D}return R.insert=0,p===T?(y(R,!0),R.strm.avail_out===0?B0:i):(R.strstart>R.block_start&&(y(R,!1),R.strm.avail_out),D)}),new u(4,4,8,4,w),new u(4,5,16,8,w),new u(4,6,32,32,w),new u(4,4,16,16,L),new u(8,16,32,32,L),new u(8,16,128,128,L),new u(8,32,128,256,L),new u(32,128,258,1024,L),new u(32,258,258,4096,L)],Q.deflateInit=function(R,p){return f(R,p,N,15,8,0)},Q.deflateInit2=f,Q.deflateReset=g,Q.deflateResetKeep=Z0,Q.deflateSetHeader=function(R,p){return R&&R.state?R.state.wrap!==2?P:(R.state.gzhead=p,A):P},Q.deflate=function(R,p){var k,V,X,O;if(!R||!R.state||5>8&255),n(V,V.gzhead.time>>16&255),n(V,V.gzhead.time>>24&255),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,255&V.gzhead.os),V.gzhead.extra&&V.gzhead.extra.length&&(n(V,255&V.gzhead.extra.length),n(V,V.gzhead.extra.length>>8&255)),V.gzhead.hcrc&&(R.adler=W(R.adler,V.pending_buf,V.pending,0)),V.gzindex=0,V.status=69):(n(V,0),n(V,0),n(V,0),n(V,0),n(V,0),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,3),V.status=c);else{var _=N+(V.w_bits-8<<4)<<8;_|=(2<=V.strategy||V.level<2?0:V.level<6?1:V.level===6?2:3)<<6,V.strstart!==0&&(_|=32),_+=31-_%31,V.status=c,o(V,_),V.strstart!==0&&(o(V,R.adler>>>16),o(V,65535&R.adler)),R.adler=1}if(V.status===69)if(V.gzhead.extra){for(X=V.pending;V.gzindex<(65535&V.gzhead.extra.length)&&(V.pending!==V.pending_buf_size||(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending!==V.pending_buf_size));)n(V,255&V.gzhead.extra[V.gzindex]),V.gzindex++;V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),V.gzindex===V.gzhead.extra.length&&(V.gzindex=0,V.status=73)}else V.status=73;if(V.status===73)if(V.gzhead.name){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.gzindex=0,V.status=91)}else V.status=91;if(V.status===91)if(V.gzhead.comment){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.status=103)}else V.status=103;if(V.status===103&&(V.gzhead.hcrc?(V.pending+2>V.pending_buf_size&&r(R),V.pending+2<=V.pending_buf_size&&(n(V,255&R.adler),n(V,R.adler>>8&255),R.adler=0,V.status=c)):V.status=c),V.pending!==0){if(r(R),R.avail_out===0)return V.last_flush=-1,A}else if(R.avail_in===0&&s(p)<=s(k)&&p!==T)return V0(R,-5);if(V.status===666&&R.avail_in!==0)return V0(R,-5);if(R.avail_in!==0||V.lookahead!==0||p!==H&&V.status!==666){var l=V.strategy===2?function(d,Q0){for(var X0;;){if(d.lookahead===0&&(O0(d),d.lookahead===0)){if(Q0===H)return D;break}if(d.match_length=0,X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++,X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):V.strategy===3?function(d,Q0){for(var X0,K0,I0,F0,W0=d.window;;){if(d.lookahead<=a){if(O0(d),d.lookahead<=a&&Q0===H)return D;if(d.lookahead===0)break}if(d.match_length=0,d.lookahead>=z&&0d.lookahead&&(d.match_length=d.lookahead)}if(d.match_length>=z?(X0=J._tr_tally(d,1,d.match_length-z),d.lookahead-=d.match_length,d.strstart+=d.match_length,d.match_length=0):(X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++),X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):K[V.level].func(V,p);if(l!==B0&&l!==i||(V.status=666),l===D||l===B0)return R.avail_out===0&&(V.last_flush=-1),A;if(l===m&&(p===1?J._tr_align(V):p!==5&&(J._tr_stored_block(V,0,0,!1),p===3&&(G0(V.head),V.lookahead===0&&(V.strstart=0,V.block_start=0,V.insert=0))),r(R),R.avail_out===0))return V.last_flush=-1,A}return p!==T?A:V.wrap<=0?1:(V.wrap===2?(n(V,255&R.adler),n(V,R.adler>>8&255),n(V,R.adler>>16&255),n(V,R.adler>>24&255),n(V,255&R.total_in),n(V,R.total_in>>8&255),n(V,R.total_in>>16&255),n(V,R.total_in>>24&255)):(o(V,R.adler>>>16),o(V,65535&R.adler)),r(R),0=k.w_size&&(O===0&&(G0(k.head),k.strstart=0,k.block_start=0,k.insert=0),Q0=new Z.Buf8(k.w_size),Z.arraySet(Q0,p,X0-k.w_size,k.w_size,0),p=Q0,X0=k.w_size),_=R.avail_in,l=R.next_in,d=R.input,R.avail_in=X0,R.next_in=0,R.input=p,O0(k);k.lookahead>=z;){for(V=k.strstart,X=k.lookahead-(z-1);k.ins_h=(k.ins_h<>>=z=x>>>24,v-=z,(z=x>>>16&255)===0)m[I++]=65535&x;else{if(!(16&z)){if((64&z)==0){x=S[(65535&x)+(N&(1<>>=z,v-=z),v<15&&(N+=D[q++]<>>=z=x>>>24,v-=z,!(16&(z=x>>>16&255))){if((64&z)==0){x=F[(65535&x)+(N&(1<>>=z,v-=z,(z=I-H)>3,N&=(1<<(v-=a<<3))-1,K.next_in=q,K.next_out=I,K.avail_in=q>>24&255)+(b>>>8&65280)+((65280&b)<<8)+((255&b)<<24)}function N(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new K.Buf16(320),this.work=new K.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(b){var c;return b&&b.state?(c=b.state,b.total_in=b.total_out=c.total=0,b.msg="",c.wrap&&(b.adler=1&c.wrap),c.mode=P,c.last=0,c.havedict=0,c.dmax=32768,c.head=null,c.hold=0,c.bits=0,c.lencode=c.lendyn=new K.Buf32(j),c.distcode=c.distdyn=new K.Buf32(E),c.sane=1,c.back=-1,T):A}function S(b){var c;return b&&b.state?((c=b.state).wsize=0,c.whave=0,c.wnext=0,v(b)):A}function F(b,c){var D,m;return b&&b.state?(m=b.state,c<0?(D=0,c=-c):(D=1+(c>>4),c<48&&(c&=15)),c&&(c<8||15=i.wsize?(K.arraySet(i.window,c,D-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(m<(B0=i.wsize-i.wnext)&&(B0=m),K.arraySet(i.window,c,D-m,B0,i.wnext),(m-=B0)?(K.arraySet(i.window,c,D-m,m,0),i.wnext=m,i.whave=i.wsize):(i.wnext+=B0,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,D.check=J(D.check,O,2,0),y=r=0,D.mode=2;break}if(D.flags=0,D.head&&(D.head.done=!1),!(1&D.wrap)||(((255&r)<<8)+(r>>8))%31){b.msg="incorrect header check",D.mode=30;break}if((15&r)!=8){b.msg="unknown compression method",D.mode=30;break}if(y-=4,R=8+(15&(r>>>=4)),D.wbits===0)D.wbits=R;else if(R>D.wbits){b.msg="invalid window size",D.mode=30;break}D.dmax=1<>8&1),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=3;case 3:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>8&255,O[2]=r>>>16&255,O[3]=r>>>24&255,D.check=J(D.check,O,4,0)),y=r=0,D.mode=4;case 4:for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>8),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=5;case 5:if(1024&D.flags){for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>>8&255,D.check=J(D.check,O,2,0)),y=r=0}else D.head&&(D.head.extra=null);D.mode=6;case 6:if(1024&D.flags&&(s<(Y0=D.length)&&(Y0=s),Y0&&(D.head&&(R=D.head.extra_len-D.length,D.head.extra||(D.head.extra=Array(D.head.extra_len)),K.arraySet(D.head.extra,m,i,Y0,R)),512&D.flags&&(D.check=J(D.check,m,Y0,i)),s-=Y0,i+=Y0,D.length-=Y0),D.length))break B;D.length=0,D.mode=7;case 7:if(2048&D.flags){if(s===0)break B;for(Y0=0;R=m[i+Y0++],D.head&&R&&D.length<65536&&(D.head.name+=String.fromCharCode(R)),R&&Y0>9&1,D.head.done=!0),b.adler=D.check=0,D.mode=12;break;case 10:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>=7&y,y-=7&y,D.mode=27;break}for(;y<3;){if(s===0)break B;s--,r+=m[i++]<>>=1)){case 0:D.mode=14;break;case 1:if(a(D),D.mode=20,c!==6)break;r>>>=2,y-=2;break B;case 2:D.mode=17;break;case 3:b.msg="invalid block type",D.mode=30}r>>>=2,y-=2;break;case 14:for(r>>>=7&y,y-=7&y;y<32;){if(s===0)break B;s--,r+=m[i++]<>>16^65535)){b.msg="invalid stored block lengths",D.mode=30;break}if(D.length=65535&r,y=r=0,D.mode=15,c===6)break B;case 15:D.mode=16;case 16:if(Y0=D.length){if(s>>=5,y-=5,D.ndist=1+(31&r),r>>>=5,y-=5,D.ncode=4+(15&r),r>>>=4,y-=4,286>>=3,y-=3}for(;D.have<19;)D.lens[_[D.have++]]=0;if(D.lencode=D.lendyn,D.lenbits=7,k={bits:D.lenbits},p=W(0,D.lens,0,19,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid code lengths set",D.mode=30;break}D.have=0,D.mode=19;case 19:for(;D.have>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=L,y-=L,D.lens[D.have++]=h;else{if(h===16){for(V=L+2;y>>=L,y-=L,D.have===0){b.msg="invalid bit length repeat",D.mode=30;break}R=D.lens[D.have-1],Y0=3+(3&r),r>>>=2,y-=2}else if(h===17){for(V=L+3;y>>=L)),r>>>=3,y-=3}else{for(V=L+7;y>>=L)),r>>>=7,y-=7}if(D.have+Y0>D.nlen+D.ndist){b.msg="invalid bit length repeat",D.mode=30;break}for(;Y0--;)D.lens[D.have++]=R}}if(D.mode===30)break;if(D.lens[256]===0){b.msg="invalid code -- missing end-of-block",D.mode=30;break}if(D.lenbits=9,k={bits:D.lenbits},p=W(I,D.lens,0,D.nlen,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid literal/lengths set",D.mode=30;break}if(D.distbits=6,D.distcode=D.distdyn,k={bits:D.distbits},p=W(H,D.lens,D.nlen,D.ndist,D.distcode,0,D.work,k),D.distbits=k.bits,p){b.msg="invalid distances set",D.mode=30;break}if(D.mode=20,c===6)break B;case 20:D.mode=21;case 21:if(6<=s&&258<=G0){b.next_out=V0,b.avail_out=G0,b.next_in=i,b.avail_in=s,D.hold=r,D.bits=y,q(b,o),V0=b.next_out,B0=b.output,G0=b.avail_out,i=b.next_in,m=b.input,s=b.avail_in,r=D.hold,y=D.bits,D.mode===12&&(D.back=-1);break}for(D.back=0;u=(X=D.lencode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,D.length=h,u===0){D.mode=26;break}if(32&u){D.back=-1,D.mode=12;break}if(64&u){b.msg="invalid literal/length code",D.mode=30;break}D.extra=15&u,D.mode=22;case 22:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}D.was=D.length,D.mode=23;case 23:for(;u=(X=D.distcode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,64&u){b.msg="invalid distance code",D.mode=30;break}D.offset=h,D.extra=15&u,D.mode=24;case 24:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}if(D.offset>D.dmax){b.msg="invalid distance too far back",D.mode=30;break}D.mode=25;case 25:if(G0===0)break B;if(Y0=o-G0,D.offset>Y0){if((Y0=D.offset-Y0)>D.whave&&D.sane){b.msg="invalid distance too far back",D.mode=30;break}O0=Y0>D.wnext?(Y0-=D.wnext,D.wsize-Y0):D.wnext-Y0,Y0>D.length&&(Y0=D.length),w=D.window}else w=B0,O0=V0-D.offset,Y0=D.length;for(G0$?(z=O0[w+E[c]],y[n+E[c]]):(z=96,0),N=1<>V0)+(v-=N)]=x<<24|z<<16|a|0,v!==0;);for(N=1<>=1;if(N!==0?(r&=N-1,r+=N):r=0,c++,--o[b]==0){if(b===m)break;b=H[T+E[c]]}if(B0>>7)]}function n(X,O){X.pending_buf[X.pending++]=255&O,X.pending_buf[X.pending++]=O>>>8&255}function o(X,O,_){X.bi_valid>C-_?(X.bi_buf|=O<>C-X.bi_valid,X.bi_valid+=_-C):(X.bi_buf|=O<>>=1,_<<=1,0<--O;);return _>>>1}function w(X,O,_){var l,d,Q0=Array(E+1),X0=0;for(l=1;l<=E;l++)Q0[l]=X0=X0+_[l-1]<<1;for(d=0;d<=O;d++){var K0=X[2*d+1];K0!==0&&(X[2*d]=O0(Q0[K0]++,K0))}}function L(X){var O;for(O=0;O>1;1<=_;_--)Z0(X,Q0,_);for(d=I0;_=X.heap[1],X.heap[1]=X.heap[X.heap_len--],Z0(X,Q0,1),l=X.heap[1],X.heap[--X.heap_max]=_,X.heap[--X.heap_max]=l,Q0[2*d]=Q0[2*_]+Q0[2*l],X.depth[d]=(X.depth[_]>=X.depth[l]?X.depth[_]:X.depth[l])+1,Q0[2*_+1]=Q0[2*l+1]=d,X.heap[1]=d++,Z0(X,Q0,1),2<=X.heap_len;);X.heap[--X.heap_max]=X.heap[1],function(W0,k0){var L2,m0,r2,z0,W1,p1,Y2=k0.dyn_tree,I6=k0.max_code,X5=k0.stat_desc.static_tree,q5=k0.stat_desc.has_stree,M5=k0.stat_desc.extra_bits,O6=k0.stat_desc.extra_base,i2=k0.stat_desc.max_length,P1=0;for(z0=0;z0<=E;z0++)W0.bl_count[z0]=0;for(Y2[2*W0.heap[W0.heap_max]+1]=0,L2=W0.heap_max+1;L2>=7;d>>=1)if(1&F0&&K0.dyn_ltree[2*I0]!==0)return Z;if(K0.dyn_ltree[18]!==0||K0.dyn_ltree[20]!==0||K0.dyn_ltree[26]!==0)return J;for(I0=32;I0>>3,(Q0=X.static_len+3+7>>>3)<=d&&(d=Q0)):d=Q0=_+5,_+4<=d&&O!==-1?V(X,O,_,l):X.strategy===4||Q0===d?(o(X,2+(l?1:0),3),g(X,U0,b)):(o(X,4+(l?1:0),3),function(K0,I0,F0,W0){var k0;for(o(K0,I0-257,5),o(K0,F0-1,5),o(K0,W0-4,4),k0=0;k0>>8&255,X.pending_buf[X.d_buf+2*X.last_lit+1]=255&O,X.pending_buf[X.l_buf+X.last_lit]=255&_,X.last_lit++,O===0?X.dyn_ltree[2*_]++:(X.matches++,O--,X.dyn_ltree[2*(D[_]+H+1)]++,X.dyn_dtree[2*y(O)]++),X.last_lit===X.lit_bufsize-1},Q._tr_align=function(X){o(X,2,3),Y0(X,v,U0),function(O){O.bi_valid===16?(n(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(X)}},{"../utils/common":41}],53:[function(G,Y,Q){Y.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(G,Y,Q){(function(K){(function(Z,J){if(!Z.setImmediate){var q,W,I,H,T=1,A={},P=!1,j=Z.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(Z);E=E&&E.setTimeout?E:Z,q={}.toString.call(Z.process)==="[object process]"?function(S){P0.nextTick(function(){N(S)})}:function(){if(Z.postMessage&&!Z.importScripts){var S=!0,F=Z.onmessage;return Z.onmessage=function(){S=!1},Z.postMessage("","*"),Z.onmessage=F,S}}()?(H="setImmediate$"+Math.random()+"$",Z.addEventListener?Z.addEventListener("message",v,!1):Z.attachEvent("onmessage",v),function(S){Z.postMessage(H+S,"*")}):Z.MessageChannel?((I=new MessageChannel).port1.onmessage=function(S){N(S.data)},function(S){I.port2.postMessage(S)}):j&&("onreadystatechange"in j.createElement("script"))?(W=j.documentElement,function(S){var F=j.createElement("script");F.onreadystatechange=function(){N(S),F.onreadystatechange=null,W.removeChild(F),F=null},W.appendChild(F)}):function(S){setTimeout(N,0,S)},E.setImmediate=function(S){typeof S!="function"&&(S=Function(""+S));for(var F=Array(arguments.length-1),M=0;M"u"?K===void 0?this:K:self)}).call(this,typeof v0<"u"?v0:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}),kK=R0((B,U)=>{var G={"&":"&",'"':""","'":"'","<":"<",">":">"};function Y(Q){return Q&&Q.replace?Q.replace(/([&"<>'])/g,function(K,Z){return G[Z]}):Q}U.exports=Y}),$K=R0((B,U)=>{P2();var G=kK(),Y=x8().Stream,Q=" ";function K(H,T){if(typeof T!=="object")T={indent:T};var A=T.stream?new Y:null,P="",j=!1,E=!T.indent?"":T.indent===!0?Q:T.indent,C=!0;function N($){if(!C)$();else P0.nextTick($)}function v($,x){if(x!==void 0)P+=x;if($&&!j)A=A||new Y,j=!0;if($&&j){var z=P;N(function(){A.emit("data",z)}),P=""}}function S($,x){W(v,q($,E,E?1:0),x)}function F(){if(A){var $=P;N(function(){A.emit("data",$),A.emit("end"),A.readable=!1,A.emit("close")})}}function M($){var x={version:"1.0",encoding:$.encoding||"UTF-8"};if($.standalone)x.standalone=$.standalone;S({"?xml":{_attr:x}}),P=P.replace("/>","?>")}if(N(function(){C=!1}),T.declaration)M(T.declaration);if(H&&H.forEach)H.forEach(function($,x){var z;if(x+1===H.length)z=F;S($,z)});else S(H,F);if(A)return A.readable=!0,A;return P}function Z(){var H={_elem:q(Array.prototype.slice.call(arguments))};return H.push=function(T){if(!this.append)throw Error("not assigned to a parent!");var A=this,P=this._elem.indent;W(this.append,q(T,P,this._elem.icount+(P?1:0)),function(){A.append(!0)})},H.close=function(T){if(T!==void 0)this.push(T);if(this.end)this.end()},H}function J(H,T){return Array(T||0).join(H||"")}function q(H,T,A){A=A||0;var P=J(T,A),j,E=H,C=!1;if(typeof H==="object"){if(j=Object.keys(H)[0],E=H[j],E&&E._elem)return E._elem.name=j,E._elem.icount=A,E._elem.indent=T,E._elem.indents=P,E._elem.interrupt=E,E._elem}var N=[],v=[],S;function F(M){Object.keys(M).forEach(function($){N.push(I($,M[$]))})}switch(typeof E){case"object":if(E===null)break;if(E._attr)F(E._attr);if(E._cdata)v.push(("/g,"]]]]>")+"]]>");if(E.forEach){if(S=!1,v.push(""),E.forEach(function(M){if(typeof M=="object")if(Object.keys(M)[0]=="_attr")F(M._attr);else v.push(q(M,T,A+1));else v.pop(),S=!0,v.push(G(M))}),!S)v.push("")}break;default:v.push(G(E))}return{name:j,interrupt:C,attributes:N,content:v,icount:A,indents:P,indent:T}}function W(H,T,A){if(typeof T!="object")return H(!1,T);var P=T.interrupt?1:T.content.length;function j(){while(T.content.length){var C=T.content.shift();if(C===void 0)continue;if(E(C))return;W(H,C)}if(H(!1,(P>1?T.indents:"")+(T.name?"":"")+(T.indent&&!A?` + */(function(G){if(typeof B=="object"&&typeof U<"u")U.exports=G();else if(typeof define=="function"&&define.amd)define([],G);else(typeof window<"u"?window:typeof v0<"u"?v0:typeof self<"u"?self:this).JSZip=G()})(function(){return function G(Y,Q,K){function Z(W,I){if(!Q[W]){if(!Y[W]){var H=typeof z1=="function"&&z1;if(!I&&H)return H(W,!0);if(J)return J(W,!0);var T=Error("Cannot find module '"+W+"'");throw T.code="MODULE_NOT_FOUND",T}var A=Q[W]={exports:{}};Y[W][0].call(A.exports,function(P){var j=Y[W][1][P];return Z(j||P)},A,A.exports,G,Y,Q,K)}return Q[W].exports}for(var J=typeof z1=="function"&&z1,q=0;q>2,A=(3&W)<<4|I>>4,P=1>6:64,j=2>4,I=(15&T)<<4|(A=J.indexOf(q.charAt(j++)))>>2,H=(3&A)<<6|(P=J.indexOf(q.charAt(j++))),N[E++]=W,A!==64&&(N[E++]=I),P!==64&&(N[E++]=H);return N}},{"./support":30,"./utils":32}],2:[function(G,Y,Q){var K=G("./external"),Z=G("./stream/DataWorker"),J=G("./stream/Crc32Probe"),q=G("./stream/DataLengthProbe");function W(I,H,T,A,P){this.compressedSize=I,this.uncompressedSize=H,this.crc32=T,this.compression=A,this.compressedContent=P}W.prototype={getContentWorker:function(){var I=new Z(K.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new q("data_length")),H=this;return I.on("end",function(){if(this.streamInfo.data_length!==H.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),I},getCompressedWorker:function(){return new Z(K.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},W.createWorkerFrom=function(I,H,T){return I.pipe(new J).pipe(new q("uncompressedSize")).pipe(H.compressWorker(T)).pipe(new q("compressedSize")).withStreamInfo("compression",H)},Y.exports=W},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(G,Y,Q){var K=G("./stream/GenericWorker");Q.STORE={magic:"\x00\x00",compressWorker:function(){return new K("STORE compression")},uncompressWorker:function(){return new K("STORE decompression")}},Q.DEFLATE=G("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(G,Y,Q){var K=G("./utils"),Z=function(){for(var J,q=[],W=0;W<256;W++){J=W;for(var I=0;I<8;I++)J=1&J?3988292384^J>>>1:J>>>1;q[W]=J}return q}();Y.exports=function(J,q){return J!==void 0&&J.length?K.getTypeOf(J)!=="string"?function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I[j])];return-1^W}(0|q,J,J.length,0):function(W,I,H,T){var A=Z,P=T+H;W^=-1;for(var j=T;j>>8^A[255&(W^I.charCodeAt(j))];return-1^W}(0|q,J,J.length,0):0}},{"./utils":32}],5:[function(G,Y,Q){Q.base64=!1,Q.binary=!1,Q.dir=!1,Q.createFolders=!0,Q.date=null,Q.compression=null,Q.compressionOptions=null,Q.comment=null,Q.unixPermissions=null,Q.dosPermissions=null},{}],6:[function(G,Y,Q){var K=null;K=typeof Promise<"u"?Promise:G("lie"),Y.exports={Promise:K}},{lie:37}],7:[function(G,Y,Q){var K=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",Z=G("pako"),J=G("./utils"),q=G("./stream/GenericWorker"),W=K?"uint8array":"array";function I(H,T){q.call(this,"FlateWorker/"+H),this._pako=null,this._pakoAction=H,this._pakoOptions=T,this.meta={}}Q.magic="\b\x00",J.inherits(I,q),I.prototype.processChunk=function(H){this.meta=H.meta,this._pako===null&&this._createPako(),this._pako.push(J.transformTo(W,H.data),!1)},I.prototype.flush=function(){q.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},I.prototype.cleanUp=function(){q.prototype.cleanUp.call(this),this._pako=null},I.prototype._createPako=function(){this._pako=new Z[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var H=this;this._pako.onData=function(T){H.push({data:T,meta:H.meta})}},Q.compressWorker=function(H){return new I("Deflate",H)},Q.uncompressWorker=function(){return new I("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(G,Y,Q){function K(A,P){var j,E="";for(j=0;j>>=8;return E}function Z(A,P,j,E,C,N){var v,S,F=A.file,M=A.compression,$=N!==W.utf8encode,x=J.transformTo("string",N(F.name)),w=J.transformTo("string",W.utf8encode(F.name)),a=F.comment,U0=J.transformTo("string",N(a)),b=J.transformTo("string",W.utf8encode(a)),c=w.length!==F.name.length,D=b.length!==a.length,m="",B0="",i="",V0=F.dir,s=F.date,G0={crc32:0,compressedSize:0,uncompressedSize:0};P&&!j||(G0.crc32=A.crc32,G0.compressedSize=A.compressedSize,G0.uncompressedSize=A.uncompressedSize);var r=0;P&&(r|=8),$||!c&&!D||(r|=2048);var y=0,n=0;V0&&(y|=16),C==="UNIX"?(n=798,y|=function(Y0,O0){var z=Y0;return Y0||(z=O0?16893:33204),(65535&z)<<16}(F.unixPermissions,V0)):(n=20,y|=function(Y0){return 63&(Y0||0)}(F.dosPermissions)),v=s.getUTCHours(),v<<=6,v|=s.getUTCMinutes(),v<<=5,v|=s.getUTCSeconds()/2,S=s.getUTCFullYear()-1980,S<<=4,S|=s.getUTCMonth()+1,S<<=5,S|=s.getUTCDate(),c&&(B0=K(1,1)+K(I(x),4)+w,m+="up"+K(B0.length,2)+B0),D&&(i=K(1,1)+K(I(U0),4)+b,m+="uc"+K(i.length,2)+i);var o="";return o+=` +\x00`,o+=K(r,2),o+=M.magic,o+=K(v,2),o+=K(S,2),o+=K(G0.crc32,4),o+=K(G0.compressedSize,4),o+=K(G0.uncompressedSize,4),o+=K(x.length,2),o+=K(m.length,2),{fileRecord:H.LOCAL_FILE_HEADER+o+x+m,dirRecord:H.CENTRAL_FILE_HEADER+K(n,2)+o+K(U0.length,2)+"\x00\x00\x00\x00"+K(y,4)+K(E,4)+x+m+U0}}var J=G("../utils"),q=G("../stream/GenericWorker"),W=G("../utf8"),I=G("../crc32"),H=G("../signature");function T(A,P,j,E){q.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=j,this.encodeFileName=E,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}J.inherits(T,q),T.prototype.push=function(A){var P=A.meta.percent||0,j=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,q.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:j?(P+100*(j-E-1))/j:100}}))},T.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var P=this.streamFiles&&!A.file.dir;if(P){var j=Z(A,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},T.prototype.closedSource=function(A){this.accumulate=!1;var P=this.streamFiles&&!A.file.dir,j=Z(A,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),P)this.push({data:function(E){return H.DATA_DESCRIPTOR+K(E.crc32,4)+K(E.compressedSize,4)+K(E.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},T.prototype.flush=function(){for(var A=this.bytesWritten,P=0;P=this.index;q--)W=(W<<8)+this.byteAt(q);return this.index+=J,W},readString:function(J){return K.transformTo("string",this.readData(J))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var J=this.readInt(4);return new Date(Date.UTC(1980+(J>>25&127),(J>>21&15)-1,J>>16&31,J>>11&31,J>>5&63,(31&J)<<1))}},Y.exports=Z},{"../utils":32}],19:[function(G,Y,Q){var K=G("./Uint8ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(G,Y,Q){var K=G("./DataReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.byteAt=function(J){return this.data.charCodeAt(this.zero+J)},Z.prototype.lastIndexOfSignature=function(J){return this.data.lastIndexOf(J)-this.zero},Z.prototype.readAndCheckSignature=function(J){return J===this.readData(4)},Z.prototype.readData=function(J){this.checkOffset(J);var q=this.data.slice(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./DataReader":18}],21:[function(G,Y,Q){var K=G("./ArrayReader");function Z(J){K.call(this,J)}G("../utils").inherits(Z,K),Z.prototype.readData=function(J){if(this.checkOffset(J),J===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+J);return this.index+=J,q},Y.exports=Z},{"../utils":32,"./ArrayReader":17}],22:[function(G,Y,Q){var K=G("../utils"),Z=G("../support"),J=G("./ArrayReader"),q=G("./StringReader"),W=G("./NodeBufferReader"),I=G("./Uint8ArrayReader");Y.exports=function(H){var T=K.getTypeOf(H);return K.checkSupport(T),T!=="string"||Z.uint8array?T==="nodebuffer"?new W(H):Z.uint8array?new I(K.transformTo("uint8array",H)):new J(K.transformTo("array",H)):new q(H)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(G,Y,Q){Q.LOCAL_FILE_HEADER="PK\x03\x04",Q.CENTRAL_FILE_HEADER="PK\x01\x02",Q.CENTRAL_DIRECTORY_END="PK\x05\x06",Q.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",Q.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",Q.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../utils");function J(q){K.call(this,"ConvertWorker to "+q),this.destType=q}Z.inherits(J,K),J.prototype.processChunk=function(q){this.push({data:Z.transformTo(this.destType,q.data),meta:q.meta})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],25:[function(G,Y,Q){var K=G("./GenericWorker"),Z=G("../crc32");function J(){K.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}G("../utils").inherits(J,K),J.prototype.processChunk=function(q){this.streamInfo.crc32=Z(q.data,this.streamInfo.crc32||0),this.push(q)},Y.exports=J},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataLengthProbe for "+q),this.propName=q,this.withStreamInfo(q,0)}K.inherits(J,Z),J.prototype.processChunk=function(q){if(q){var W=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=W+q.data.length}Z.prototype.processChunk.call(this,q)},Y.exports=J},{"../utils":32,"./GenericWorker":28}],27:[function(G,Y,Q){var K=G("../utils"),Z=G("./GenericWorker");function J(q){Z.call(this,"DataWorker");var W=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,q.then(function(I){W.dataIsReady=!0,W.data=I,W.max=I&&I.length||0,W.type=K.getTypeOf(I),W.isPaused||W._tickAndRepeat()},function(I){W.error(I)})}K.inherits(J,Z),J.prototype.cleanUp=function(){Z.prototype.cleanUp.call(this),this.data=null},J.prototype.resume=function(){return!!Z.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,K.delay(this._tickAndRepeat,[],this)),!0)},J.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(K.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},J.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var q=null,W=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":q=this.data.substring(this.index,W);break;case"uint8array":q=this.data.subarray(this.index,W);break;case"array":case"nodebuffer":q=this.data.slice(this.index,W)}return this.index=W,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})},Y.exports=J},{"../utils":32,"./GenericWorker":28}],28:[function(G,Y,Q){function K(Z){this.name=Z||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}K.prototype={push:function(Z){this.emit("data",Z)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Z){this.emit("error",Z)}return!0},error:function(Z){return!this.isFinished&&(this.isPaused?this.generatedError=Z:(this.isFinished=!0,this.emit("error",Z),this.previous&&this.previous.error(Z),this.cleanUp()),!0)},on:function(Z,J){return this._listeners[Z].push(J),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Z,J){if(this._listeners[Z])for(var q=0;q "+Z:Z}},Y.exports=K},{}],29:[function(G,Y,Q){var K=G("../utils"),Z=G("./ConvertWorker"),J=G("./GenericWorker"),q=G("../base64"),W=G("../support"),I=G("../external"),H=null;if(W.nodestream)try{H=G("../nodejs/NodejsStreamOutputAdapter")}catch(P){}function T(P,j){return new I.Promise(function(E,C){var N=[],v=P._internalType,S=P._outputType,F=P._mimeType;P.on("data",function(M,$){N.push(M),j&&j($)}).on("error",function(M){N=[],C(M)}).on("end",function(){try{E(function(M,$,x){switch(M){case"blob":return K.newBlob(K.transformTo("arraybuffer",$),x);case"base64":return q.encode($);default:return K.transformTo(M,$)}}(S,function(M,$){var x,w=0,a=null,U0=0;for(x=0;x<$.length;x++)U0+=$[x].length;switch(M){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":for(a=new Uint8Array(U0),x=0;x<$.length;x++)a.set($[x],w),w+=$[x].length;return a;case"nodebuffer":return Buffer.concat($);default:throw Error("concat : unsupported type '"+M+"'")}}(v,N),F))}catch(M){C(M)}N=[]}).resume()})}function A(P,j,E){var C=j;switch(j){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=j,this._mimeType=E,K.checkSupport(C),this._worker=P.pipe(new Z(C)),P.lock()}catch(N){this._worker=new J("error"),this._worker.error(N)}}A.prototype={accumulate:function(P){return T(this,P)},on:function(P,j){var E=this;return P==="data"?this._worker.on(P,function(C){j.call(E,C.data,C.meta)}):this._worker.on(P,function(){K.delay(j,arguments,E)}),this},resume:function(){return K.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(P){if(K.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new H(this,{objectMode:this._outputType!=="nodebuffer"},P)}},Y.exports=A},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(G,Y,Q){if(Q.base64=!0,Q.array=!0,Q.string=!0,Q.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Q.nodebuffer=typeof Buffer<"u",Q.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")Q.blob=!1;else{var K=new ArrayBuffer(0);try{Q.blob=new Blob([K],{type:"application/zip"}).size===0}catch(J){try{var Z=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Z.append(K),Q.blob=Z.getBlob("application/zip").size===0}catch(q){Q.blob=!1}}}try{Q.nodestream=!!G("readable-stream").Readable}catch(J){Q.nodestream=!1}},{"readable-stream":16}],31:[function(G,Y,Q){for(var K=G("./utils"),Z=G("./support"),J=G("./nodejsUtils"),q=G("./stream/GenericWorker"),W=Array(256),I=0;I<256;I++)W[I]=252<=I?6:248<=I?5:240<=I?4:224<=I?3:192<=I?2:1;W[254]=W[254]=1;function H(){q.call(this,"utf-8 decode"),this.leftOver=null}function T(){q.call(this,"utf-8 encode")}Q.utf8encode=function(A){return Z.nodebuffer?J.newBufferFrom(A,"utf-8"):function(P){var j,E,C,N,v,S=P.length,F=0;for(N=0;N>>6:(E<65536?j[v++]=224|E>>>12:(j[v++]=240|E>>>18,j[v++]=128|E>>>12&63),j[v++]=128|E>>>6&63),j[v++]=128|63&E);return j}(A)},Q.utf8decode=function(A){return Z.nodebuffer?K.transformTo("nodebuffer",A).toString("utf-8"):function(P){var j,E,C,N,v=P.length,S=Array(2*v);for(j=E=0;j>10&1023,S[E++]=56320|1023&C)}return S.length!==E&&(S.subarray?S=S.subarray(0,E):S.length=E),K.applyFromCharCode(S)}(A=K.transformTo(Z.uint8array?"uint8array":"array",A))},K.inherits(H,q),H.prototype.processChunk=function(A){var P=K.transformTo(Z.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(Z.uint8array){var j=P;(P=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),P.set(j,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var E=function(N,v){var S;for((v=v||N.length)>N.length&&(v=N.length),S=v-1;0<=S&&(192&N[S])==128;)S--;return S<0?v:S===0?v:S+W[N[S]]>v?S:v}(P),C=P;E!==P.length&&(Z.uint8array?(C=P.subarray(0,E),this.leftOver=P.subarray(E,P.length)):(C=P.slice(0,E),this.leftOver=P.slice(E,P.length))),this.push({data:Q.utf8decode(C),meta:A.meta})},H.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:Q.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},Q.Utf8DecodeWorker=H,K.inherits(T,q),T.prototype.processChunk=function(A){this.push({data:Q.utf8encode(A.data),meta:A.meta})},Q.Utf8EncodeWorker=T},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(G,Y,Q){var K=G("./support"),Z=G("./base64"),J=G("./nodejsUtils"),q=G("./external");function W(j){return j}function I(j,E){for(var C=0;C>8;this.dir=!!(16&this.externalFileAttributes),A==0&&(this.dosPermissions=63&this.externalFileAttributes),A==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var A=K(this.extraFields[1].value);this.uncompressedSize===Z.MAX_VALUE_32BITS&&(this.uncompressedSize=A.readInt(8)),this.compressedSize===Z.MAX_VALUE_32BITS&&(this.compressedSize=A.readInt(8)),this.localHeaderOffset===Z.MAX_VALUE_32BITS&&(this.localHeaderOffset=A.readInt(8)),this.diskNumberStart===Z.MAX_VALUE_32BITS&&(this.diskNumberStart=A.readInt(4))}},readExtraFields:function(A){var P,j,E,C=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(A<65536?T[E++]=224|A>>>12:(T[E++]=240|A>>>18,T[E++]=128|A>>>12&63),T[E++]=128|A>>>6&63),T[E++]=128|63&A);return T},Q.buf2binstring=function(H){return I(H,H.length)},Q.binstring2buf=function(H){for(var T=new K.Buf8(H.length),A=0,P=T.length;A>10&1023,N[P++]=56320|1023&j)}return I(N,P)},Q.utf8border=function(H,T){var A;for((T=T||H.length)>H.length&&(T=H.length),A=T-1;0<=A&&(192&H[A])==128;)A--;return A<0?T:A===0?T:A+q[H[A]]>T?A:T}},{"./common":41}],43:[function(G,Y,Q){Y.exports=function(K,Z,J,q){for(var W=65535&K|0,I=K>>>16&65535|0,H=0;J!==0;){for(J-=H=2000>>1:Z>>>1;J[q]=Z}return J}();Y.exports=function(Z,J,q,W){var I=K,H=W+q;Z^=-1;for(var T=W;T>>8^I[255&(Z^J[T])];return-1^Z}},{}],46:[function(G,Y,Q){var K,Z=G("../utils/common"),J=G("./trees"),q=G("./adler32"),W=G("./crc32"),I=G("./messages"),H=0,T=4,A=0,P=-2,j=-1,E=4,C=2,N=8,v=9,S=286,F=30,M=19,$=2*S+1,x=15,w=3,a=258,U0=a+w+1,b=42,c=113,D=1,m=2,B0=3,i=4;function V0(R,p){return R.msg=I[p],p}function s(R){return(R<<1)-(4R.avail_out&&(k=R.avail_out),k!==0&&(Z.arraySet(R.output,p.pending_buf,p.pending_out,k,R.next_out),R.next_out+=k,p.pending_out+=k,R.total_out+=k,R.avail_out-=k,p.pending-=k,p.pending===0&&(p.pending_out=0))}function y(R,p){J._tr_flush_block(R,0<=R.block_start?R.block_start:-1,R.strstart-R.block_start,p),R.block_start=R.strstart,r(R.strm)}function n(R,p){R.pending_buf[R.pending++]=p}function o(R,p){R.pending_buf[R.pending++]=p>>>8&255,R.pending_buf[R.pending++]=255&p}function Y0(R,p){var k,V,X=R.max_chain_length,O=R.strstart,_=R.prev_length,l=R.nice_match,d=R.strstart>R.w_size-U0?R.strstart-(R.w_size-U0):0,Q0=R.window,X0=R.w_mask,K0=R.prev,I0=R.strstart+a,F0=Q0[O+_-1],W0=Q0[O+_];R.prev_length>=R.good_match&&(X>>=2),l>R.lookahead&&(l=R.lookahead);do if(Q0[(k=p)+_]===W0&&Q0[k+_-1]===F0&&Q0[k]===Q0[O]&&Q0[++k]===Q0[O+1]){O+=2,k++;do;while(Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Q0[++O]===Q0[++k]&&Od&&--X!=0);return _<=R.lookahead?_:R.lookahead}function O0(R){var p,k,V,X,O,_,l,d,Q0,X0,K0=R.w_size;do{if(X=R.window_size-R.lookahead-R.strstart,R.strstart>=K0+(K0-U0)){for(Z.arraySet(R.window,R.window,K0,K0,0),R.match_start-=K0,R.strstart-=K0,R.block_start-=K0,p=k=R.hash_size;V=R.head[--p],R.head[p]=K0<=V?V-K0:0,--k;);for(p=k=K0;V=R.prev[--p],R.prev[p]=K0<=V?V-K0:0,--k;);X+=K0}if(R.strm.avail_in===0)break;if(_=R.strm,l=R.window,d=R.strstart+R.lookahead,Q0=X,X0=void 0,X0=_.avail_in,Q0=w)for(O=R.strstart-R.insert,R.ins_h=R.window[O],R.ins_h=(R.ins_h<=w&&(R.ins_h=(R.ins_h<=w)if(V=J._tr_tally(R,R.strstart-R.match_start,R.match_length-w),R.lookahead-=R.match_length,R.match_length<=R.max_lazy_match&&R.lookahead>=w){for(R.match_length--;R.strstart++,R.ins_h=(R.ins_h<=w&&(R.ins_h=(R.ins_h<=w&&R.match_length<=R.prev_length){for(X=R.strstart+R.lookahead-w,V=J._tr_tally(R,R.strstart-1-R.prev_match,R.prev_length-w),R.lookahead-=R.prev_length-1,R.prev_length-=2;++R.strstart<=X&&(R.ins_h=(R.ins_h<R.pending_buf_size-5&&(k=R.pending_buf_size-5);;){if(R.lookahead<=1){if(O0(R),R.lookahead===0&&p===H)return D;if(R.lookahead===0)break}R.strstart+=R.lookahead,R.lookahead=0;var V=R.block_start+k;if((R.strstart===0||R.strstart>=V)&&(R.lookahead=R.strstart-V,R.strstart=V,y(R,!1),R.strm.avail_out===0))return D;if(R.strstart-R.block_start>=R.w_size-U0&&(y(R,!1),R.strm.avail_out===0))return D}return R.insert=0,p===T?(y(R,!0),R.strm.avail_out===0?B0:i):(R.strstart>R.block_start&&(y(R,!1),R.strm.avail_out),D)}),new u(4,4,8,4,z),new u(4,5,16,8,z),new u(4,6,32,32,z),new u(4,4,16,16,L),new u(8,16,32,32,L),new u(8,16,128,128,L),new u(8,32,128,256,L),new u(32,128,258,1024,L),new u(32,258,258,4096,L)],Q.deflateInit=function(R,p){return f(R,p,N,15,8,0)},Q.deflateInit2=f,Q.deflateReset=g,Q.deflateResetKeep=Z0,Q.deflateSetHeader=function(R,p){return R&&R.state?R.state.wrap!==2?P:(R.state.gzhead=p,A):P},Q.deflate=function(R,p){var k,V,X,O;if(!R||!R.state||5>8&255),n(V,V.gzhead.time>>16&255),n(V,V.gzhead.time>>24&255),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,255&V.gzhead.os),V.gzhead.extra&&V.gzhead.extra.length&&(n(V,255&V.gzhead.extra.length),n(V,V.gzhead.extra.length>>8&255)),V.gzhead.hcrc&&(R.adler=W(R.adler,V.pending_buf,V.pending,0)),V.gzindex=0,V.status=69):(n(V,0),n(V,0),n(V,0),n(V,0),n(V,0),n(V,V.level===9?2:2<=V.strategy||V.level<2?4:0),n(V,3),V.status=c);else{var _=N+(V.w_bits-8<<4)<<8;_|=(2<=V.strategy||V.level<2?0:V.level<6?1:V.level===6?2:3)<<6,V.strstart!==0&&(_|=32),_+=31-_%31,V.status=c,o(V,_),V.strstart!==0&&(o(V,R.adler>>>16),o(V,65535&R.adler)),R.adler=1}if(V.status===69)if(V.gzhead.extra){for(X=V.pending;V.gzindex<(65535&V.gzhead.extra.length)&&(V.pending!==V.pending_buf_size||(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending!==V.pending_buf_size));)n(V,255&V.gzhead.extra[V.gzindex]),V.gzindex++;V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),V.gzindex===V.gzhead.extra.length&&(V.gzindex=0,V.status=73)}else V.status=73;if(V.status===73)if(V.gzhead.name){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.gzindex=0,V.status=91)}else V.status=91;if(V.status===91)if(V.gzhead.comment){X=V.pending;do{if(V.pending===V.pending_buf_size&&(V.gzhead.hcrc&&V.pending>X&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),r(R),X=V.pending,V.pending===V.pending_buf_size)){O=1;break}O=V.gzindexX&&(R.adler=W(R.adler,V.pending_buf,V.pending-X,X)),O===0&&(V.status=103)}else V.status=103;if(V.status===103&&(V.gzhead.hcrc?(V.pending+2>V.pending_buf_size&&r(R),V.pending+2<=V.pending_buf_size&&(n(V,255&R.adler),n(V,R.adler>>8&255),R.adler=0,V.status=c)):V.status=c),V.pending!==0){if(r(R),R.avail_out===0)return V.last_flush=-1,A}else if(R.avail_in===0&&s(p)<=s(k)&&p!==T)return V0(R,-5);if(V.status===666&&R.avail_in!==0)return V0(R,-5);if(R.avail_in!==0||V.lookahead!==0||p!==H&&V.status!==666){var l=V.strategy===2?function(d,Q0){for(var X0;;){if(d.lookahead===0&&(O0(d),d.lookahead===0)){if(Q0===H)return D;break}if(d.match_length=0,X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++,X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):V.strategy===3?function(d,Q0){for(var X0,K0,I0,F0,W0=d.window;;){if(d.lookahead<=a){if(O0(d),d.lookahead<=a&&Q0===H)return D;if(d.lookahead===0)break}if(d.match_length=0,d.lookahead>=w&&0d.lookahead&&(d.match_length=d.lookahead)}if(d.match_length>=w?(X0=J._tr_tally(d,1,d.match_length-w),d.lookahead-=d.match_length,d.strstart+=d.match_length,d.match_length=0):(X0=J._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++),X0&&(y(d,!1),d.strm.avail_out===0))return D}return d.insert=0,Q0===T?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?D:m}(V,p):K[V.level].func(V,p);if(l!==B0&&l!==i||(V.status=666),l===D||l===B0)return R.avail_out===0&&(V.last_flush=-1),A;if(l===m&&(p===1?J._tr_align(V):p!==5&&(J._tr_stored_block(V,0,0,!1),p===3&&(G0(V.head),V.lookahead===0&&(V.strstart=0,V.block_start=0,V.insert=0))),r(R),R.avail_out===0))return V.last_flush=-1,A}return p!==T?A:V.wrap<=0?1:(V.wrap===2?(n(V,255&R.adler),n(V,R.adler>>8&255),n(V,R.adler>>16&255),n(V,R.adler>>24&255),n(V,255&R.total_in),n(V,R.total_in>>8&255),n(V,R.total_in>>16&255),n(V,R.total_in>>24&255)):(o(V,R.adler>>>16),o(V,65535&R.adler)),r(R),0=k.w_size&&(O===0&&(G0(k.head),k.strstart=0,k.block_start=0,k.insert=0),Q0=new Z.Buf8(k.w_size),Z.arraySet(Q0,p,X0-k.w_size,k.w_size,0),p=Q0,X0=k.w_size),_=R.avail_in,l=R.next_in,d=R.input,R.avail_in=X0,R.next_in=0,R.input=p,O0(k);k.lookahead>=w;){for(V=k.strstart,X=k.lookahead-(w-1);k.ins_h=(k.ins_h<>>=w=x>>>24,v-=w,(w=x>>>16&255)===0)m[I++]=65535&x;else{if(!(16&w)){if((64&w)==0){x=S[(65535&x)+(N&(1<>>=w,v-=w),v<15&&(N+=D[q++]<>>=w=x>>>24,v-=w,!(16&(w=x>>>16&255))){if((64&w)==0){x=F[(65535&x)+(N&(1<>>=w,v-=w,(w=I-H)>3,N&=(1<<(v-=a<<3))-1,K.next_in=q,K.next_out=I,K.avail_in=q>>24&255)+(b>>>8&65280)+((65280&b)<<8)+((255&b)<<24)}function N(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new K.Buf16(320),this.work=new K.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(b){var c;return b&&b.state?(c=b.state,b.total_in=b.total_out=c.total=0,b.msg="",c.wrap&&(b.adler=1&c.wrap),c.mode=P,c.last=0,c.havedict=0,c.dmax=32768,c.head=null,c.hold=0,c.bits=0,c.lencode=c.lendyn=new K.Buf32(j),c.distcode=c.distdyn=new K.Buf32(E),c.sane=1,c.back=-1,T):A}function S(b){var c;return b&&b.state?((c=b.state).wsize=0,c.whave=0,c.wnext=0,v(b)):A}function F(b,c){var D,m;return b&&b.state?(m=b.state,c<0?(D=0,c=-c):(D=1+(c>>4),c<48&&(c&=15)),c&&(c<8||15=i.wsize?(K.arraySet(i.window,c,D-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(m<(B0=i.wsize-i.wnext)&&(B0=m),K.arraySet(i.window,c,D-m,B0,i.wnext),(m-=B0)?(K.arraySet(i.window,c,D-m,m,0),i.wnext=m,i.whave=i.wsize):(i.wnext+=B0,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,D.check=J(D.check,O,2,0),y=r=0,D.mode=2;break}if(D.flags=0,D.head&&(D.head.done=!1),!(1&D.wrap)||(((255&r)<<8)+(r>>8))%31){b.msg="incorrect header check",D.mode=30;break}if((15&r)!=8){b.msg="unknown compression method",D.mode=30;break}if(y-=4,R=8+(15&(r>>>=4)),D.wbits===0)D.wbits=R;else if(R>D.wbits){b.msg="invalid window size",D.mode=30;break}D.dmax=1<>8&1),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=3;case 3:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>8&255,O[2]=r>>>16&255,O[3]=r>>>24&255,D.check=J(D.check,O,4,0)),y=r=0,D.mode=4;case 4:for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>8),512&D.flags&&(O[0]=255&r,O[1]=r>>>8&255,D.check=J(D.check,O,2,0)),y=r=0,D.mode=5;case 5:if(1024&D.flags){for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>>8&255,D.check=J(D.check,O,2,0)),y=r=0}else D.head&&(D.head.extra=null);D.mode=6;case 6:if(1024&D.flags&&(s<(Y0=D.length)&&(Y0=s),Y0&&(D.head&&(R=D.head.extra_len-D.length,D.head.extra||(D.head.extra=Array(D.head.extra_len)),K.arraySet(D.head.extra,m,i,Y0,R)),512&D.flags&&(D.check=J(D.check,m,Y0,i)),s-=Y0,i+=Y0,D.length-=Y0),D.length))break B;D.length=0,D.mode=7;case 7:if(2048&D.flags){if(s===0)break B;for(Y0=0;R=m[i+Y0++],D.head&&R&&D.length<65536&&(D.head.name+=String.fromCharCode(R)),R&&Y0>9&1,D.head.done=!0),b.adler=D.check=0,D.mode=12;break;case 10:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>=7&y,y-=7&y,D.mode=27;break}for(;y<3;){if(s===0)break B;s--,r+=m[i++]<>>=1)){case 0:D.mode=14;break;case 1:if(a(D),D.mode=20,c!==6)break;r>>>=2,y-=2;break B;case 2:D.mode=17;break;case 3:b.msg="invalid block type",D.mode=30}r>>>=2,y-=2;break;case 14:for(r>>>=7&y,y-=7&y;y<32;){if(s===0)break B;s--,r+=m[i++]<>>16^65535)){b.msg="invalid stored block lengths",D.mode=30;break}if(D.length=65535&r,y=r=0,D.mode=15,c===6)break B;case 15:D.mode=16;case 16:if(Y0=D.length){if(s>>=5,y-=5,D.ndist=1+(31&r),r>>>=5,y-=5,D.ncode=4+(15&r),r>>>=4,y-=4,286>>=3,y-=3}for(;D.have<19;)D.lens[_[D.have++]]=0;if(D.lencode=D.lendyn,D.lenbits=7,k={bits:D.lenbits},p=W(0,D.lens,0,19,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid code lengths set",D.mode=30;break}D.have=0,D.mode=19;case 19:for(;D.have>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=L,y-=L,D.lens[D.have++]=h;else{if(h===16){for(V=L+2;y>>=L,y-=L,D.have===0){b.msg="invalid bit length repeat",D.mode=30;break}R=D.lens[D.have-1],Y0=3+(3&r),r>>>=2,y-=2}else if(h===17){for(V=L+3;y>>=L)),r>>>=3,y-=3}else{for(V=L+7;y>>=L)),r>>>=7,y-=7}if(D.have+Y0>D.nlen+D.ndist){b.msg="invalid bit length repeat",D.mode=30;break}for(;Y0--;)D.lens[D.have++]=R}}if(D.mode===30)break;if(D.lens[256]===0){b.msg="invalid code -- missing end-of-block",D.mode=30;break}if(D.lenbits=9,k={bits:D.lenbits},p=W(I,D.lens,0,D.nlen,D.lencode,0,D.work,k),D.lenbits=k.bits,p){b.msg="invalid literal/lengths set",D.mode=30;break}if(D.distbits=6,D.distcode=D.distdyn,k={bits:D.distbits},p=W(H,D.lens,D.nlen,D.ndist,D.distcode,0,D.work,k),D.distbits=k.bits,p){b.msg="invalid distances set",D.mode=30;break}if(D.mode=20,c===6)break B;case 20:D.mode=21;case 21:if(6<=s&&258<=G0){b.next_out=V0,b.avail_out=G0,b.next_in=i,b.avail_in=s,D.hold=r,D.bits=y,q(b,o),V0=b.next_out,B0=b.output,G0=b.avail_out,i=b.next_in,m=b.input,s=b.avail_in,r=D.hold,y=D.bits,D.mode===12&&(D.back=-1);break}for(D.back=0;u=(X=D.lencode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,D.length=h,u===0){D.mode=26;break}if(32&u){D.back=-1,D.mode=12;break}if(64&u){b.msg="invalid literal/length code",D.mode=30;break}D.extra=15&u,D.mode=22;case 22:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}D.was=D.length,D.mode=23;case 23:for(;u=(X=D.distcode[r&(1<>>16&255,h=65535&X,!((L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&X,!(Z0+(L=X>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,D.back+=Z0}if(r>>>=L,y-=L,D.back+=L,64&u){b.msg="invalid distance code",D.mode=30;break}D.offset=h,D.extra=15&u,D.mode=24;case 24:if(D.extra){for(V=D.extra;y>>=D.extra,y-=D.extra,D.back+=D.extra}if(D.offset>D.dmax){b.msg="invalid distance too far back",D.mode=30;break}D.mode=25;case 25:if(G0===0)break B;if(Y0=o-G0,D.offset>Y0){if((Y0=D.offset-Y0)>D.whave&&D.sane){b.msg="invalid distance too far back",D.mode=30;break}O0=Y0>D.wnext?(Y0-=D.wnext,D.wsize-Y0):D.wnext-Y0,Y0>D.length&&(Y0=D.length),z=D.window}else z=B0,O0=V0-D.offset,Y0=D.length;for(G0$?(w=O0[z+E[c]],y[n+E[c]]):(w=96,0),N=1<>V0)+(v-=N)]=x<<24|w<<16|a|0,v!==0;);for(N=1<>=1;if(N!==0?(r&=N-1,r+=N):r=0,c++,--o[b]==0){if(b===m)break;b=H[T+E[c]]}if(B0>>7)]}function n(X,O){X.pending_buf[X.pending++]=255&O,X.pending_buf[X.pending++]=O>>>8&255}function o(X,O,_){X.bi_valid>C-_?(X.bi_buf|=O<>C-X.bi_valid,X.bi_valid+=_-C):(X.bi_buf|=O<>>=1,_<<=1,0<--O;);return _>>>1}function z(X,O,_){var l,d,Q0=Array(E+1),X0=0;for(l=1;l<=E;l++)Q0[l]=X0=X0+_[l-1]<<1;for(d=0;d<=O;d++){var K0=X[2*d+1];K0!==0&&(X[2*d]=O0(Q0[K0]++,K0))}}function L(X){var O;for(O=0;O>1;1<=_;_--)Z0(X,Q0,_);for(d=I0;_=X.heap[1],X.heap[1]=X.heap[X.heap_len--],Z0(X,Q0,1),l=X.heap[1],X.heap[--X.heap_max]=_,X.heap[--X.heap_max]=l,Q0[2*d]=Q0[2*_]+Q0[2*l],X.depth[d]=(X.depth[_]>=X.depth[l]?X.depth[_]:X.depth[l])+1,Q0[2*_+1]=Q0[2*l+1]=d,X.heap[1]=d++,Z0(X,Q0,1),2<=X.heap_len;);X.heap[--X.heap_max]=X.heap[1],function(W0,k0){var L2,m0,r2,w0,W1,p1,Y2=k0.dyn_tree,I6=k0.max_code,X5=k0.stat_desc.static_tree,q5=k0.stat_desc.has_stree,M5=k0.stat_desc.extra_bits,O6=k0.stat_desc.extra_base,i2=k0.stat_desc.max_length,P1=0;for(w0=0;w0<=E;w0++)W0.bl_count[w0]=0;for(Y2[2*W0.heap[W0.heap_max]+1]=0,L2=W0.heap_max+1;L2>=7;d>>=1)if(1&F0&&K0.dyn_ltree[2*I0]!==0)return Z;if(K0.dyn_ltree[18]!==0||K0.dyn_ltree[20]!==0||K0.dyn_ltree[26]!==0)return J;for(I0=32;I0>>3,(Q0=X.static_len+3+7>>>3)<=d&&(d=Q0)):d=Q0=_+5,_+4<=d&&O!==-1?V(X,O,_,l):X.strategy===4||Q0===d?(o(X,2+(l?1:0),3),g(X,U0,b)):(o(X,4+(l?1:0),3),function(K0,I0,F0,W0){var k0;for(o(K0,I0-257,5),o(K0,F0-1,5),o(K0,W0-4,4),k0=0;k0>>8&255,X.pending_buf[X.d_buf+2*X.last_lit+1]=255&O,X.pending_buf[X.l_buf+X.last_lit]=255&_,X.last_lit++,O===0?X.dyn_ltree[2*_]++:(X.matches++,O--,X.dyn_ltree[2*(D[_]+H+1)]++,X.dyn_dtree[2*y(O)]++),X.last_lit===X.lit_bufsize-1},Q._tr_align=function(X){o(X,2,3),Y0(X,v,U0),function(O){O.bi_valid===16?(n(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(X)}},{"../utils/common":41}],53:[function(G,Y,Q){Y.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(G,Y,Q){(function(K){(function(Z,J){if(!Z.setImmediate){var q,W,I,H,T=1,A={},P=!1,j=Z.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(Z);E=E&&E.setTimeout?E:Z,q={}.toString.call(Z.process)==="[object process]"?function(S){P0.nextTick(function(){N(S)})}:function(){if(Z.postMessage&&!Z.importScripts){var S=!0,F=Z.onmessage;return Z.onmessage=function(){S=!1},Z.postMessage("","*"),Z.onmessage=F,S}}()?(H="setImmediate$"+Math.random()+"$",Z.addEventListener?Z.addEventListener("message",v,!1):Z.attachEvent("onmessage",v),function(S){Z.postMessage(H+S,"*")}):Z.MessageChannel?((I=new MessageChannel).port1.onmessage=function(S){N(S.data)},function(S){I.port2.postMessage(S)}):j&&("onreadystatechange"in j.createElement("script"))?(W=j.documentElement,function(S){var F=j.createElement("script");F.onreadystatechange=function(){N(S),F.onreadystatechange=null,W.removeChild(F),F=null},W.appendChild(F)}):function(S){setTimeout(N,0,S)},E.setImmediate=function(S){typeof S!="function"&&(S=Function(""+S));for(var F=Array(arguments.length-1),M=0;M"u"?K===void 0?this:K:self)}).call(this,typeof v0<"u"?v0:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}),kK=R0((B,U)=>{var G={"&":"&",'"':""","'":"'","<":"<",">":">"};function Y(Q){return Q&&Q.replace?Q.replace(/([&"<>'])/g,function(K,Z){return G[Z]}):Q}U.exports=Y}),$K=R0((B,U)=>{P2();var G=kK(),Y=x8().Stream,Q=" ";function K(H,T){if(typeof T!=="object")T={indent:T};var A=T.stream?new Y:null,P="",j=!1,E=!T.indent?"":T.indent===!0?Q:T.indent,C=!0;function N($){if(!C)$();else P0.nextTick($)}function v($,x){if(x!==void 0)P+=x;if($&&!j)A=A||new Y,j=!0;if($&&j){var w=P;N(function(){A.emit("data",w)}),P=""}}function S($,x){W(v,q($,E,E?1:0),x)}function F(){if(A){var $=P;N(function(){A.emit("data",$),A.emit("end"),A.readable=!1,A.emit("close")})}}function M($){var x={version:"1.0",encoding:$.encoding||"UTF-8"};if($.standalone)x.standalone=$.standalone;S({"?xml":{_attr:x}}),P=P.replace("/>","?>")}if(N(function(){C=!1}),T.declaration)M(T.declaration);if(H&&H.forEach)H.forEach(function($,x){var w;if(x+1===H.length)w=F;S($,w)});else S(H,F);if(A)return A.readable=!0,A;return P}function Z(){var H={_elem:q(Array.prototype.slice.call(arguments))};return H.push=function(T){if(!this.append)throw Error("not assigned to a parent!");var A=this,P=this._elem.indent;W(this.append,q(T,P,this._elem.icount+(P?1:0)),function(){A.append(!0)})},H.close=function(T){if(T!==void 0)this.push(T);if(this.end)this.end()},H}function J(H,T){return Array(T||0).join(H||"")}function q(H,T,A){A=A||0;var P=J(T,A),j,E=H,C=!1;if(typeof H==="object"){if(j=Object.keys(H)[0],E=H[j],E&&E._elem)return E._elem.name=j,E._elem.icount=A,E._elem.indent=T,E._elem.indents=P,E._elem.interrupt=E,E._elem}var N=[],v=[],S;function F(M){Object.keys(M).forEach(function($){N.push(I($,M[$]))})}switch(typeof E){case"object":if(E===null)break;if(E._attr)F(E._attr);if(E._cdata)v.push(("/g,"]]]]>")+"]]>");if(E.forEach){if(S=!1,v.push(""),E.forEach(function(M){if(typeof M=="object")if(Object.keys(M)[0]=="_attr")F(M._attr);else v.push(q(M,T,A+1));else v.pop(),S=!0,v.push(G(M))}),!S)v.push("")}break;default:v.push(G(E))}return{name:j,interrupt:C,attributes:N,content:v,icount:A,indents:P,indent:T}}function W(H,T,A){if(typeof T!="object")return H(!1,T);var P=T.interrupt?1:T.content.length;function j(){while(T.content.length){var C=T.content.shift();if(C===void 0)continue;if(E(C))return;W(H,C)}if(H(!1,(P>1?T.indents:"")+(T.name?"":"")+(T.indent&&!A?` `:"")),A)A()}function E(C){if(C.interrupt)return C.interrupt.append=H,C.interrupt.end=j,C.interrupt=!1,H(!0),!0;return!1}if(H(!1,T.indents+(T.name?"<"+T.name:"")+(T.attributes.length?" "+T.attributes.join(" "):"")+(P?T.name?">":"":T.name?"/>":"")+(T.indent&&P>1?` `:"")),!P)return H(!1,T.indent?` -`:"");if(!E(T))j()}function I(H,T){return H+'="'+G(T)+'"'}U.exports=K,U.exports.element=U.exports.Element=Z}),SK=x8(),h2=k8(CK(),1),A0=k8($K(),1),o2=0,R8=32,bK=32,vK=(B,U)=>{let G=U.replace(/-/g,"");if(G.length!==bK)throw Error(`Error: Cannot extract GUID from font filename: ${U}`);let Y=G.replace(/(..)/g,"$1 ").trim().split(" ").map((Z)=>parseInt(Z,16));Y.reverse();let Q=B.slice(o2,R8).map((Z,J)=>Z^Y[J%Y.length]),K=new Uint8Array(o2+Q.length+Math.max(0,B.length-R8));return K.set(B.slice(0,o2)),K.set(Q,o2),K.set(B.slice(R8),o2+Q.length),K},q6=class{format(B,U={stack:[]}){let G=B.prepForXml(U);if(G)return G;else throw Error("XMLComponent did not format correctly")}},U5=class{replace(B,U,G){let Y=B;return U.forEach((Q,K)=>{Y=Y.replace(new RegExp(`{${Q.fileName}}`,"g"),(G+K).toString())}),Y}getMediaData(B,U){return U.Array.filter((G)=>B.search(`{${G.fileName}}`)>0)}},yK=class{replace(B,U){let G=B;for(let Y of U)G=G.replace(new RegExp(`{${Y.reference}-${Y.instance}}`,"g"),Y.numId.toString());return G}},gK=class{constructor(){e(this,"formatter",void 0),e(this,"imageReplacer",void 0),e(this,"numberingReplacer",void 0),this.formatter=new q6,this.imageReplacer=new U5,this.numberingReplacer=new yK}compile(B,U,G=[]){let Y=new h2.default,Q=this.xmlifyFile(B,U),K=new Map(Object.entries(Q));for(let[,Z]of K)if(Array.isArray(Z))for(let J of Z)Y.file(J.path,U1(J.data));else Y.file(Z.path,U1(Z.data));for(let Z of G)Y.file(Z.path,U1(Z.data));for(let Z of B.Media.Array)if(Z.type!=="svg")Y.file(`word/media/${Z.fileName}`,Z.data);else Y.file(`word/media/${Z.fileName}`,Z.data),Y.file(`word/media/${Z.fallback.fileName}`,Z.fallback.data);for(let[Z,{data:J,fontKey:q}]of B.FontTable.fontOptionsWithKey.entries())Y.file(`word/fonts/font${Z+1}.odttf`,vK(J,q));return Y}xmlifyFile(B,U){let G=B.Document.Relationships.RelationshipCount+1,Y=(0,A0.default)(this.formatter.format(B.Document.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Q=B.Comments.Relationships.RelationshipCount+1,K=(0,A0.default)(this.formatter.format(B.Comments,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Z=B.FootNotes.Relationships.RelationshipCount+1,J=(0,A0.default)(this.formatter.format(B.FootNotes.View,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),q=this.imageReplacer.getMediaData(Y,B.Media),W=this.imageReplacer.getMediaData(K,B.Media),I=this.imageReplacer.getMediaData(J,B.Media);return L0(L0({Relationships:{data:(()=>{return q.forEach((H,T)=>{B.Document.Relationships.addRelationship(G+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),B.Document.Relationships.addRelationship(B.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),(0,A0.default)(this.formatter.format(B.Document.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let H=this.imageReplacer.replace(Y,q,G);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let H=(0,A0.default)(this.formatter.format(B.Styles,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:(0,A0.default)(this.formatter.format(B.CoreProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:(0,A0.default)(this.formatter.format(B.Numbering,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:(0,A0.default)(this.formatter.format(B.FileRelationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${T+1}.xml.rels`}}),FooterRelationships:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${T+1}.xml.rels`}}),Headers:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/header${T+1}.xml`}}),Footers:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/footer${T+1}.xml`}}),ContentTypes:{data:(0,A0.default)(this.formatter.format(B.ContentTypes,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:(0,A0.default)(this.formatter.format(B.CustomProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:(0,A0.default)(this.formatter.format(B.AppProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let H=this.imageReplacer.replace(J,I,Z);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{return I.forEach((H,T)=>{B.FootNotes.Relationships.addRelationship(Z+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.FootNotes.Relationships,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(0,A0.default)(this.formatter.format(B.Endnotes.View,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/endnotes.xml"},EndnotesRelationships:{data:(0,A0.default)(this.formatter.format(B.Endnotes.Relationships,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/endnotes.xml.rels"},Settings:{data:(0,A0.default)(this.formatter.format(B.Settings,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{let H=this.imageReplacer.replace(K,W,Q);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{return W.forEach((H,T)=>{B.Comments.Relationships.addRelationship(Q+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.Comments.Relationships,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}},B.CommentsExtended?{CommentsExtended:{data:(0,A0.default)(this.formatter.format(B.CommentsExtended,{viewWrapper:{View:B.CommentsExtended,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),{},{FontTable:{data:(0,A0.default)(this.formatter.format(B.FontTable.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:(0,A0.default)(this.formatter.format(B.FontTable.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}})}};function t6(B,U,G,Y,Q,K,Z){try{var J=B[K](Z),q=J.value}catch(W){G(W);return}J.done?U(q):Promise.resolve(q).then(Y,Q)}function M6(B){return function(){var U=this,G=arguments;return new Promise(function(Y,Q){var K=B.apply(U,G);function Z(q){t6(K,Y,Q,Z,J,"next",q)}function J(q){t6(K,Y,Q,Z,J,"throw",q)}Z(void 0)})}}var G5={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:"\t"},e6=(B)=>B===!0?G5.WITH_2_BLANKS:B===!1?void 0:B,Y5=class B{static pack(U,G,Y){var Q=this;return M6(function*(K,Z,J,q=[]){return Q.compiler.compile(K,e6(J),q).generateAsync({type:Z,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})}).apply(this,arguments)}static toString(U,G,Y=[]){return B.pack(U,"string",G,Y)}static toBuffer(U,G,Y=[]){return B.pack(U,"nodebuffer",G,Y)}static toBase64String(U,G,Y=[]){return B.pack(U,"base64",G,Y)}static toBlob(U,G,Y=[]){return B.pack(U,"blob",G,Y)}static toArrayBuffer(U,G,Y=[]){return B.pack(U,"arraybuffer",G,Y)}static toStream(U,G,Y=[]){let Q=new SK.Stream;return this.compiler.compile(U,e6(G),Y).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then((K)=>{Q.emit("data",K),Q.emit("end")}),Q}};e(Y5,"compiler",new gK);var fK=new q6,a1=(B)=>{return(0,h1.xml2js)(B,{compact:!1,captureSpacesBetweenElements:!0})},Z5=(B)=>{var U;return(U=a1((0,A0.default)(fK.format(new Z1({text:B})))).elements[0].elements)!==null&&U!==void 0?U:[]},Q5=(B)=>L0(L0({},B),{},{attributes:{"xml:space":"preserve"}}),R6=(B,U)=>{var G,Y;return(G=(Y=B.elements)===null||Y===void 0?void 0:Y.filter((Q)=>Q.name===U)[0].elements)!==null&&G!==void 0?G:[]},g2=(B,U,G)=>{let Y=R6(B,"Types");if(Y.some((Q)=>{var K,Z;return Q.type==="element"&&Q.name==="Default"&&(Q===null||Q===void 0||(K=Q.attributes)===null||K===void 0?void 0:K.ContentType)===U&&(Q===null||Q===void 0||(Z=Q.attributes)===null||Z===void 0?void 0:Z.Extension)===G}))return;Y.push({attributes:{ContentType:U,Extension:G},name:"Default",type:"element"})},xK=(B)=>{let U=parseInt(B.substring(3),10);return isNaN(U)?0:U},_K=(B)=>{return R6(B,"Relationships").map((U)=>{var G,Y;return xK((G=(Y=U.attributes)===null||Y===void 0||(Y=Y.Id)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:"")}).reduce((U,G)=>Math.max(U,G),0)+1},BB=(B,U,G,Y,Q)=>{let K=R6(B,"Relationships");return K.push({attributes:{Id:`rId${U}`,Type:G,Target:Y,TargetMode:Q},name:"Relationship",type:"element"}),K},hK=class extends Error{constructor(B){super(`Token ${B} not found`);this.name="TokenNotFoundError"}},uK=(B,U)=>{var G;for(let Z=0;Z<((G=B.elements)!==null&&G!==void 0?G:[]).length;Z++){let J=B.elements[Z];if(J.type==="element"&&J.name==="w:r"){var Y;let q=((Y=J.elements)!==null&&Y!==void 0?Y:[]).filter((W)=>W.type==="element"&&W.name==="w:t");for(let W of q){var Q,K;if(!((Q=W.elements)===null||Q===void 0?void 0:Q[0]))continue;if((K=W.elements[0].text)===null||K===void 0?void 0:K.includes(U))return Z}}}throw new hK(U)},dK=(B,U)=>{var G,Y;let Q=-1,K=(G=(Y=B.elements)===null||Y===void 0?void 0:Y.map((Z,J)=>{if(Q!==-1)return Z;if(Z.type==="element"&&Z.name==="w:t"){var q,W;let I=((q=(W=Z.elements)===null||W===void 0||(W=W[0])===null||W===void 0?void 0:W.text)!==null&&q!==void 0?q:"").split(U),H=I.map((T)=>L0(L0(L0({},Z),Q5(Z)),{},{elements:Z5(T)}));if(I.length>1)Q=J;return H}else return Z}).flat())!==null&&G!==void 0?G:[];return{left:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(0,Q+1)}),right:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(Q+1)})}},t2={START:0,MIDDLE:1,END:2},cK=({paragraphElement:B,renderedParagraph:U,originalText:G,replacementText:Y})=>{let Q=U.text.indexOf(G),K=Q+G.length-1,Z=t2.START;for(let J of U.runs)for(let{text:q,index:W,start:I,end:H}of J.parts)switch(Z){case t2.START:if(Q>=I&&Q<=H){let T=Q-I,A=Math.min(K,H)-I,P=J.text.substring(T,A+1);if(P==="")continue;let j=q.replace(P,Y);L8(B.elements[J.index].elements[W],j),Z=t2.MIDDLE;continue}break;case t2.MIDDLE:if(K<=H){let T=q.substring(K-I+1);L8(B.elements[J.index].elements[W],T);let A=B.elements[J.index].elements[W];B.elements[J.index].elements[W]=Q5(A),Z=t2.END}else L8(B.elements[J.index].elements[W],"");break;default:}return B},L8=(B,U)=>{return B.elements=Z5(U),B},mK=(B)=>{if(B.element.name!=="w:p")throw Error(`Invalid node type: ${B.element.name}`);if(!B.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let U=0,G=B.element.elements.map((Y,Q)=>({element:Y,i:Q})).filter(({element:Y})=>Y.name==="w:r").map(({element:Y,i:Q})=>{let K=lK(Y,Q,U);return U+=K.text.length,K}).filter((Y)=>!!Y);return{text:G.reduce((Y,Q)=>Y+Q.text,""),runs:G,index:B.index,pathToParagraph:J5(B)}},lK=(B,U,G)=>{if(!B.elements)return{text:"",parts:[],index:-1,start:G,end:G};let Y=G,Q=B.elements.map((K,Z)=>{var J,q;return K.name==="w:t"&&K.elements&&K.elements.length>0?{text:(J=(q=K.elements[0].text)===null||q===void 0?void 0:q.toString())!==null&&J!==void 0?J:"",index:Z,start:Y,end:(()=>{var W,I;return Y+=((W=(I=K.elements[0].text)===null||I===void 0?void 0:I.toString())!==null&&W!==void 0?W:"").length-1,Y})()}:void 0}).filter((K)=>!!K).map((K)=>K);return{text:Q.reduce((K,Z)=>K+Z.text,""),parts:Q,index:U,start:G,end:Y}},J5=(B)=>B.parent?[...J5(B.parent),B.index]:[B.index],UB=(B)=>{var U,G;return(U=(G=B.element.elements)===null||G===void 0?void 0:G.map((Y,Q)=>({element:Y,index:Q,parent:B})))!==null&&U!==void 0?U:[]},K5=(B)=>{let U=[],G=[...UB({element:B,index:0,parent:void 0})],Y;while(G.length>0){if(Y=G.shift(),Y.element.name==="w:p")U=[...U,mK(Y)];G.push(...UB(Y))}return U},aK=(B,U)=>K5(B).filter((G)=>G.text.includes(U)),pK=new q6,I8="ɵ",rK=({json:B,patch:U,patchText:G,context:Y,keepOriginalStyles:Q=!0})=>{let K=aK(B,G);if(K.length===0)return{element:B,didFindOccurrence:!1};for(let Z of K){let J=U.children.map((q)=>a1((0,A0.default)(pK.format(q,Y)))).map((q)=>q.elements[0]);switch(U.type){case C8.DOCUMENT:{let q=iK(B,Z.pathToParagraph),W=nK(Z.pathToParagraph);q.elements.splice(W,1,...J);break}case C8.PARAGRAPH:default:{let q=V5(B,Z.pathToParagraph);cK({paragraphElement:q,renderedParagraph:Z,originalText:G,replacementText:I8});let W=uK(q,I8),I=q.elements[W],{left:H,right:T}=dK(I,I8),A=J,P=T;if(Q){let j=I.elements.filter((E)=>E.type==="element"&&E.name==="w:rPr");A=J.map((E)=>{var C;return L0(L0({},E),{},{elements:[...j,...(C=E.elements)!==null&&C!==void 0?C:[]]})}),P=L0(L0({},T),{},{elements:[...j,...T.elements]})}q.elements.splice(W,1,H,...A,P);break}}}return{element:B,didFindOccurrence:!0}},V5=(B,U)=>{let G=B;for(let Y=1;YV5(B,U.slice(0,U.length-1)),nK=(B)=>B[B.length-1],C8={DOCUMENT:"file",PARAGRAPH:"paragraph"},GB=new U5,sK=new Uint8Array([255,254]),oK=new Uint8Array([254,255]),YB=(B,U)=>{if(B.length!==U.length)return!1;for(let G=0;Gz.name==="w:document");if(x&&x.attributes){for(let z of["mc","wp","r","w15","m"])x.attributes[`xmlns:${z}`]=y1[z];x.attributes["mc:Ignorable"]=`${x.attributes["mc:Ignorable"]||""} w15`.trim()}}if(v.startsWith("word/")&&!v.endsWith(".xml.rels")){let x={file:W,viewWrapper:{Relationships:{addRelationship:(b,c,D,m)=>{T.push({key:v,hyperlink:{id:b,link:D}})}}},stack:[]};if(q.set(v,x),!(K===null||K===void 0?void 0:K.start.trim())||!(K===null||K===void 0?void 0:K.end.trim()))throw Error("Both start and end delimiters must be non-empty strings.");let{start:z,end:a}=K;for(let[b,c]of Object.entries(Y)){let D=`${z}${b}${a}`;while(!0){let{didFindOccurrence:m}=rK({json:$,patch:L0(L0({},c),{},{children:c.children.map((B0)=>{if(B0 instanceof t8){let i=new m2(B0.options.children,O1());return T.push({key:v,hyperlink:{id:i.linkId,link:B0.options.link}}),i}else return B0})}),patchText:D,context:x,keepOriginalStyles:Q});if(!Z||!m)break}}let U0=GB.getMediaData(JSON.stringify($),x.file.Media);if(U0.length>0)A=!0,H.push({key:v,mediaDatas:U0})}I.set(v,$)}for(let{key:v,mediaDatas:S}of H){var E;let F=`word/_rels/${v.split("/").pop()}.rels`,M=(E=I.get(F))!==null&&E!==void 0?E:ZB();I.set(F,M);let $=_K(M),x=GB.replace(JSON.stringify(I.get(v)),S,$);I.set(v,JSON.parse(x));for(let z=0;z{return(0,h1.js2xml)(B,{attributeValueFn:(U)=>String(U).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})},ZB=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),B7=function(){var B=M6(function*({data:U}){let G=U instanceof h2.default?U:yield h2.default.loadAsync(U),Y=new Set;for(let[Q,K]of Object.entries(G.files)){if(!Q.endsWith(".xml")&&!Q.endsWith(".rels"))continue;if(Q.startsWith("word/")&&!Q.endsWith(".xml.rels"))K5(a1(yield K.async("text"))).forEach((Z)=>U7(Z.text).forEach((J)=>Y.add(J)))}return Array.from(Y)});return function(G){return B.apply(this,arguments)}}(),U7=(B)=>{var U;let G=new RegExp("(?<=\\{\\{).+?(?=\\}\\})","gs");return(U=B.match(G))!==null&&U!==void 0?U:[]};if(typeof globalThis.Buffer>"u")globalThis.Buffer=J0;if(typeof globalThis.process>"u")globalThis.process=G7;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.docx=L6;})(); +`:"");if(!E(T))j()}function I(H,T){return H+'="'+G(T)+'"'}U.exports=K,U.exports.element=U.exports.Element=Z}),SK=x8(),h2=k8(CK(),1),A0=k8($K(),1),o2=0,R8=32,bK=32,vK=(B,U)=>{let G=U.replace(/-/g,"");if(G.length!==bK)throw Error(`Error: Cannot extract GUID from font filename: ${U}`);let Y=G.replace(/(..)/g,"$1 ").trim().split(" ").map((Z)=>parseInt(Z,16));Y.reverse();let Q=B.slice(o2,R8).map((Z,J)=>Z^Y[J%Y.length]),K=new Uint8Array(o2+Q.length+Math.max(0,B.length-R8));return K.set(B.slice(0,o2)),K.set(Q,o2),K.set(B.slice(R8),o2+Q.length),K},q6=class{format(B,U={stack:[]}){let G=B.prepForXml(U);if(G)return G;else throw Error("XMLComponent did not format correctly")}},U5=class{replace(B,U,G){let Y=B;return U.forEach((Q,K)=>{Y=Y.replace(new RegExp(`{${Q.fileName}}`,"g"),(G+K).toString())}),Y}getMediaData(B,U){return U.Array.filter((G)=>B.search(`{${G.fileName}}`)>0)}},yK=class{replace(B,U){let G=B;for(let Y of U)G=G.replace(new RegExp(`{${Y.reference}-${Y.instance}}`,"g"),Y.numId.toString());return G}},gK=class{constructor(){e(this,"formatter",void 0),e(this,"imageReplacer",void 0),e(this,"numberingReplacer",void 0),this.formatter=new q6,this.imageReplacer=new U5,this.numberingReplacer=new yK}compile(B,U,G=[]){let Y=new h2.default,Q=this.xmlifyFile(B,U),K=new Map(Object.entries(Q));for(let[,Z]of K)if(Array.isArray(Z))for(let J of Z)Y.file(J.path,U1(J.data));else Y.file(Z.path,U1(Z.data));for(let Z of G)Y.file(Z.path,U1(Z.data));for(let Z of B.Media.Array)if(Z.type!=="svg")Y.file(`word/media/${Z.fileName}`,Z.data);else Y.file(`word/media/${Z.fileName}`,Z.data),Y.file(`word/media/${Z.fallback.fileName}`,Z.fallback.data);for(let[Z,{data:J,fontKey:q}]of B.FontTable.fontOptionsWithKey.entries())Y.file(`word/fonts/font${Z+1}.odttf`,vK(J,q));return Y}xmlifyFile(B,U){let G=B.Document.Relationships.RelationshipCount+1,Y=(0,A0.default)(this.formatter.format(B.Document.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Q=B.Comments.Relationships.RelationshipCount+1,K=(0,A0.default)(this.formatter.format(B.Comments,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),Z=B.FootNotes.Relationships.RelationshipCount+1,J=(0,A0.default)(this.formatter.format(B.FootNotes.View,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),q=this.imageReplacer.getMediaData(Y,B.Media),W=this.imageReplacer.getMediaData(K,B.Media),I=this.imageReplacer.getMediaData(J,B.Media);return L0(L0({Relationships:{data:(()=>{return q.forEach((H,T)=>{B.Document.Relationships.addRelationship(G+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),B.Document.Relationships.addRelationship(B.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),(0,A0.default)(this.formatter.format(B.Document.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let H=this.imageReplacer.replace(Y,q,G);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let H=(0,A0.default)(this.formatter.format(B.Styles,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:(0,A0.default)(this.formatter.format(B.CoreProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:(0,A0.default)(this.formatter.format(B.Numbering,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:(0,A0.default)(this.formatter.format(B.FileRelationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${T+1}.xml.rels`}}),FooterRelationships:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(A,B.Media).forEach((P,j)=>{H.Relationships.addRelationship(j,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${P.fileName}`)}),{data:(0,A0.default)(this.formatter.format(H.Relationships,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${T+1}.xml.rels`}}),Headers:B.Headers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/header${T+1}.xml`}}),Footers:B.Footers.map((H,T)=>{let A=(0,A0.default)(this.formatter.format(H.View,{viewWrapper:H,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),P=this.imageReplacer.getMediaData(A,B.Media),j=this.imageReplacer.replace(A,P,0);return{data:this.numberingReplacer.replace(j,B.Numbering.ConcreteNumbering),path:`word/footer${T+1}.xml`}}),ContentTypes:{data:(0,A0.default)(this.formatter.format(B.ContentTypes,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:(0,A0.default)(this.formatter.format(B.CustomProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:(0,A0.default)(this.formatter.format(B.AppProperties,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let H=this.imageReplacer.replace(J,I,Z);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{return I.forEach((H,T)=>{B.FootNotes.Relationships.addRelationship(Z+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.FootNotes.Relationships,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(0,A0.default)(this.formatter.format(B.Endnotes.View,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/endnotes.xml"},EndnotesRelationships:{data:(0,A0.default)(this.formatter.format(B.Endnotes.Relationships,{viewWrapper:B.Endnotes,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/endnotes.xml.rels"},Settings:{data:(0,A0.default)(this.formatter.format(B.Settings,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{let H=this.imageReplacer.replace(K,W,Q);return this.numberingReplacer.replace(H,B.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{return W.forEach((H,T)=>{B.Comments.Relationships.addRelationship(Q+T,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${H.fileName}`)}),(0,A0.default)(this.formatter.format(B.Comments.Relationships,{viewWrapper:{View:B.Comments,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}},B.CommentsExtended?{CommentsExtended:{data:(0,A0.default)(this.formatter.format(B.CommentsExtended,{viewWrapper:{View:B.CommentsExtended,Relationships:B.Comments.Relationships},file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),{},{FontTable:{data:(0,A0.default)(this.formatter.format(B.FontTable.View,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:(0,A0.default)(this.formatter.format(B.FontTable.Relationships,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}})}};function t6(B,U,G,Y,Q,K,Z){try{var J=B[K](Z),q=J.value}catch(W){G(W);return}J.done?U(q):Promise.resolve(q).then(Y,Q)}function M6(B){return function(){var U=this,G=arguments;return new Promise(function(Y,Q){var K=B.apply(U,G);function Z(q){t6(K,Y,Q,Z,J,"next",q)}function J(q){t6(K,Y,Q,Z,J,"throw",q)}Z(void 0)})}}var G5={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:"\t"},e6=(B)=>B===!0?G5.WITH_2_BLANKS:B===!1?void 0:B,Y5=class B{static pack(U,G,Y){var Q=this;return M6(function*(K,Z,J,q=[]){return Q.compiler.compile(K,e6(J),q).generateAsync({type:Z,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})}).apply(this,arguments)}static toString(U,G,Y=[]){return B.pack(U,"string",G,Y)}static toBuffer(U,G,Y=[]){return B.pack(U,"nodebuffer",G,Y)}static toBase64String(U,G,Y=[]){return B.pack(U,"base64",G,Y)}static toBlob(U,G,Y=[]){return B.pack(U,"blob",G,Y)}static toArrayBuffer(U,G,Y=[]){return B.pack(U,"arraybuffer",G,Y)}static toStream(U,G,Y=[]){let Q=new SK.Stream;return this.compiler.compile(U,e6(G),Y).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then((K)=>{Q.emit("data",K),Q.emit("end")}),Q}};e(Y5,"compiler",new gK);var fK=new q6,a1=(B)=>{return(0,h1.xml2js)(B,{compact:!1,captureSpacesBetweenElements:!0})},Z5=(B)=>{var U;return(U=a1((0,A0.default)(fK.format(new Z1({text:B})))).elements[0].elements)!==null&&U!==void 0?U:[]},Q5=(B)=>L0(L0({},B),{},{attributes:{"xml:space":"preserve"}}),R6=(B,U)=>{var G,Y;return(G=(Y=B.elements)===null||Y===void 0?void 0:Y.filter((Q)=>Q.name===U)[0].elements)!==null&&G!==void 0?G:[]},g2=(B,U,G)=>{let Y=R6(B,"Types");if(Y.some((Q)=>{var K,Z;return Q.type==="element"&&Q.name==="Default"&&(Q===null||Q===void 0||(K=Q.attributes)===null||K===void 0?void 0:K.ContentType)===U&&(Q===null||Q===void 0||(Z=Q.attributes)===null||Z===void 0?void 0:Z.Extension)===G}))return;Y.push({attributes:{ContentType:U,Extension:G},name:"Default",type:"element"})},xK=(B)=>{let U=parseInt(B.substring(3),10);return isNaN(U)?0:U},_K=(B)=>{return R6(B,"Relationships").map((U)=>{var G,Y;return xK((G=(Y=U.attributes)===null||Y===void 0||(Y=Y.Id)===null||Y===void 0?void 0:Y.toString())!==null&&G!==void 0?G:"")}).reduce((U,G)=>Math.max(U,G),0)+1},BB=(B,U,G,Y,Q)=>{let K=R6(B,"Relationships");return K.push({attributes:{Id:`rId${U}`,Type:G,Target:Y,TargetMode:Q},name:"Relationship",type:"element"}),K},hK=class extends Error{constructor(B){super(`Token ${B} not found`);this.name="TokenNotFoundError"}},uK=(B,U)=>{var G;for(let Z=0;Z<((G=B.elements)!==null&&G!==void 0?G:[]).length;Z++){let J=B.elements[Z];if(J.type==="element"&&J.name==="w:r"){var Y;let q=((Y=J.elements)!==null&&Y!==void 0?Y:[]).filter((W)=>W.type==="element"&&W.name==="w:t");for(let W of q){var Q,K;if(!((Q=W.elements)===null||Q===void 0?void 0:Q[0]))continue;if((K=W.elements[0].text)===null||K===void 0?void 0:K.includes(U))return Z}}}throw new hK(U)},dK=(B,U)=>{var G,Y;let Q=-1,K=(G=(Y=B.elements)===null||Y===void 0?void 0:Y.map((Z,J)=>{if(Q!==-1)return Z;if(Z.type==="element"&&Z.name==="w:t"){var q,W;let I=((q=(W=Z.elements)===null||W===void 0||(W=W[0])===null||W===void 0?void 0:W.text)!==null&&q!==void 0?q:"").split(U),H=I.map((T)=>L0(L0(L0({},Z),Q5(Z)),{},{elements:Z5(T)}));if(I.length>1)Q=J;return H}else return Z}).flat())!==null&&G!==void 0?G:[];return{left:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(0,Q+1)}),right:L0(L0({},JSON.parse(JSON.stringify(B))),{},{elements:K.slice(Q+1)})}},t2={START:0,MIDDLE:1,END:2},cK=({paragraphElement:B,renderedParagraph:U,originalText:G,replacementText:Y})=>{let Q=U.text.indexOf(G),K=Q+G.length-1,Z=t2.START;for(let J of U.runs)for(let{text:q,index:W,start:I,end:H}of J.parts)switch(Z){case t2.START:if(Q>=I&&Q<=H){let T=Q-I,A=Math.min(K,H)-I,P=J.text.substring(T,A+1);if(P==="")continue;let j=q.replace(P,Y);L8(B.elements[J.index].elements[W],j),Z=t2.MIDDLE;continue}break;case t2.MIDDLE:if(K<=H){let T=q.substring(K-I+1);L8(B.elements[J.index].elements[W],T);let A=B.elements[J.index].elements[W];B.elements[J.index].elements[W]=Q5(A),Z=t2.END}else L8(B.elements[J.index].elements[W],"");break;default:}return B},L8=(B,U)=>{return B.elements=Z5(U),B},mK=(B)=>{if(B.element.name!=="w:p")throw Error(`Invalid node type: ${B.element.name}`);if(!B.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let U=0,G=B.element.elements.map((Y,Q)=>({element:Y,i:Q})).filter(({element:Y})=>Y.name==="w:r").map(({element:Y,i:Q})=>{let K=lK(Y,Q,U);return U+=K.text.length,K}).filter((Y)=>!!Y);return{text:G.reduce((Y,Q)=>Y+Q.text,""),runs:G,index:B.index,pathToParagraph:J5(B)}},lK=(B,U,G)=>{if(!B.elements)return{text:"",parts:[],index:-1,start:G,end:G};let Y=G,Q=B.elements.map((K,Z)=>{var J,q;return K.name==="w:t"&&K.elements&&K.elements.length>0?{text:(J=(q=K.elements[0].text)===null||q===void 0?void 0:q.toString())!==null&&J!==void 0?J:"",index:Z,start:Y,end:(()=>{var W,I;return Y+=((W=(I=K.elements[0].text)===null||I===void 0?void 0:I.toString())!==null&&W!==void 0?W:"").length-1,Y})()}:void 0}).filter((K)=>!!K).map((K)=>K);return{text:Q.reduce((K,Z)=>K+Z.text,""),parts:Q,index:U,start:G,end:Y}},J5=(B)=>B.parent?[...J5(B.parent),B.index]:[B.index],UB=(B)=>{var U,G;return(U=(G=B.element.elements)===null||G===void 0?void 0:G.map((Y,Q)=>({element:Y,index:Q,parent:B})))!==null&&U!==void 0?U:[]},K5=(B)=>{let U=[],G=[...UB({element:B,index:0,parent:void 0})],Y;while(G.length>0){if(Y=G.shift(),Y.element.name==="w:p")U=[...U,mK(Y)];G.push(...UB(Y))}return U},aK=(B,U)=>K5(B).filter((G)=>G.text.includes(U)),pK=new q6,I8="ɵ",rK=({json:B,patch:U,patchText:G,context:Y,keepOriginalStyles:Q=!0})=>{let K=aK(B,G);if(K.length===0)return{element:B,didFindOccurrence:!1};for(let Z of K){let J=U.children.map((q)=>a1((0,A0.default)(pK.format(q,Y)))).map((q)=>q.elements[0]);switch(U.type){case C8.DOCUMENT:{let q=iK(B,Z.pathToParagraph),W=nK(Z.pathToParagraph);q.elements.splice(W,1,...J);break}case C8.PARAGRAPH:default:{let q=V5(B,Z.pathToParagraph);cK({paragraphElement:q,renderedParagraph:Z,originalText:G,replacementText:I8});let W=uK(q,I8),I=q.elements[W],{left:H,right:T}=dK(I,I8),A=J,P=T;if(Q){let j=I.elements.filter((E)=>E.type==="element"&&E.name==="w:rPr");A=J.map((E)=>{var C;return L0(L0({},E),{},{elements:[...j,...(C=E.elements)!==null&&C!==void 0?C:[]]})}),P=L0(L0({},T),{},{elements:[...j,...T.elements]})}q.elements.splice(W,1,H,...A,P);break}}}return{element:B,didFindOccurrence:!0}},V5=(B,U)=>{let G=B;for(let Y=1;YV5(B,U.slice(0,U.length-1)),nK=(B)=>B[B.length-1],C8={DOCUMENT:"file",PARAGRAPH:"paragraph"},GB=new U5,sK=new Uint8Array([255,254]),oK=new Uint8Array([254,255]),YB=(B,U)=>{if(B.length!==U.length)return!1;for(let G=0;Gw.name==="w:document");if(x&&x.attributes){for(let w of["mc","wp","r","w15","m"])x.attributes[`xmlns:${w}`]=y1[w];x.attributes["mc:Ignorable"]=`${x.attributes["mc:Ignorable"]||""} w15`.trim()}}if(v.startsWith("word/")&&!v.endsWith(".xml.rels")){let x={file:W,viewWrapper:{Relationships:{addRelationship:(b,c,D,m)=>{T.push({key:v,hyperlink:{id:b,link:D}})}}},stack:[]};if(q.set(v,x),!(K===null||K===void 0?void 0:K.start.trim())||!(K===null||K===void 0?void 0:K.end.trim()))throw Error("Both start and end delimiters must be non-empty strings.");let{start:w,end:a}=K;for(let[b,c]of Object.entries(Y)){let D=`${w}${b}${a}`;while(!0){let{didFindOccurrence:m}=rK({json:$,patch:L0(L0({},c),{},{children:c.children.map((B0)=>{if(B0 instanceof t8){let i=new m2(B0.options.children,O1());return T.push({key:v,hyperlink:{id:i.linkId,link:B0.options.link}}),i}else return B0})}),patchText:D,context:x,keepOriginalStyles:Q});if(!Z||!m)break}}let U0=GB.getMediaData(JSON.stringify($),x.file.Media);if(U0.length>0)A=!0,H.push({key:v,mediaDatas:U0})}I.set(v,$)}for(let{key:v,mediaDatas:S}of H){var E;let F=`word/_rels/${v.split("/").pop()}.rels`,M=(E=I.get(F))!==null&&E!==void 0?E:ZB();I.set(F,M);let $=_K(M),x=GB.replace(JSON.stringify(I.get(v)),S,$);I.set(v,JSON.parse(x));for(let w=0;w{return(0,h1.js2xml)(B,{attributeValueFn:(U)=>String(U).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})},ZB=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),B7=function(){var B=M6(function*({data:U}){let G=U instanceof h2.default?U:yield h2.default.loadAsync(U),Y=new Set;for(let[Q,K]of Object.entries(G.files)){if(!Q.endsWith(".xml")&&!Q.endsWith(".rels"))continue;if(Q.startsWith("word/")&&!Q.endsWith(".xml.rels"))K5(a1(yield K.async("text"))).forEach((Z)=>U7(Z.text).forEach((J)=>Y.add(J)))}return Array.from(Y)});return function(G){return B.apply(this,arguments)}}(),U7=(B)=>{var U;let G=new RegExp("(?<=\\{\\{).+?(?=\\}\\})","gs");return(U=B.match(G))!==null&&U!==void 0?U:[]};if(typeof globalThis.Buffer>"u")globalThis.Buffer=J0;if(typeof globalThis.process>"u")globalThis.process=G7;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.docx=L6;})(); diff --git a/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs b/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs index c39925856ee..3368b6a2676 100644 --- a/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs +++ b/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs @@ -1,9 +1,9 @@ // sandbox bundle: pptxgenjs // generated by apps/sim/lib/execution/sandbox/bundles/build.ts // do not edit by hand. run `bun run build:sandbox-bundles` to regenerate. -(()=>{var fJ=Object.create;var{getPrototypeOf:RJ,defineProperty:X6,getOwnPropertyNames:Q9,getOwnPropertyDescriptor:IJ}=Object,q9=Object.prototype.hasOwnProperty;function K9($){return this[$]}var CJ,jJ,J9=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?CJ??=new WeakMap:jJ??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?fJ(RJ($)):{};let G=q||!$||!$.__esModule?X6(Q,"default",{value:$,enumerable:!0}):Q;for(let W of Q9($))if(!q9.call(G,W))X6(G,W,{get:K9.bind($,W),enumerable:!0});if(K)J.set($,G);return G},X0=($)=>{var q=($9??=new WeakMap).get($),Q;if(q)return q;if(q=X6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var K of Q9($))if(!q9.call(q,K))X6(q,K,{get:K9.bind($,K),enumerable:!(Q=IJ($,K))||Q.enumerable})}return $9.set($,q),q},$9,N0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var gJ=($)=>$;function AJ($,q){this[$]=gJ.bind(null,q)}var c1=($,q)=>{for(var Q in q)X6($,Q,{get:q[Q],enumerable:!0,configurable:!0,set:AJ.bind(q,Q)})};var b1=($,q)=>()=>($&&(q=$($=0)),q);var V9=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(q,Q)=>(typeof require<"u"?require:q)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var K2={};c1(K2,{transcode:()=>MV,resolveObjectURL:()=>BV,kStringMaxLength:()=>w9,kMaxLength:()=>y6,isUtf8:()=>zV,isAscii:()=>FV,default:()=>wV,constants:()=>EJ,btoa:()=>PJ,atob:()=>TJ,INSPECT_MAX_BYTES:()=>M9,File:()=>uJ,Buffer:()=>o,Blob:()=>SJ});function XJ($){var q=$.length;if(q%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=$.indexOf("=");if(Q===-1)Q=q;var K=Q===q?0:4-Q%4;return[Q,K]}function yJ($,q){return($+q)*3/4-q}function hJ($){var q,Q=XJ($),K=Q[0],J=Q[1],Z=new Uint8Array(yJ(K,J)),G=0,W=J>0?K-4:K,B;for(B=0;B>16&255,Z[G++]=q>>8&255,Z[G++]=q&255;if(J===2)q=F2[$.charCodeAt(B)]<<2|F2[$.charCodeAt(B+1)]>>4,Z[G++]=q&255;if(J===1)q=F2[$.charCodeAt(B)]<<10|F2[$.charCodeAt(B+1)]<<4|F2[$.charCodeAt(B+2)]>>2,Z[G++]=q>>8&255,Z[G++]=q&255;return Z}function xJ($){return I2[$>>18&63]+I2[$>>12&63]+I2[$>>6&63]+I2[$&63]}function OJ($,q,Q){var K,J=[];for(var Z=q;ZW?W:G+Z));if(K===1)q=$[Q-1],J.push(I2[q>>2]+I2[q<<4&63]+"==");else if(K===2)q=($[Q-2]<<8)+$[Q-1],J.push(I2[q>>10]+I2[q>>4&63]+I2[q<<2&63]+"=");return J.join("")}function Y8($,q,Q,K,J){var Z,G,W=J*8-K-1,B=(1<>1,U=-7,w=Q?J-1:0,F=Q?-1:1,M=$[q+w];w+=F,Z=M&(1<<-U)-1,M>>=-U,U+=W;for(;U>0;Z=Z*256+$[q+w],w+=F,U-=8);G=Z&(1<<-U)-1,Z>>=-U,U+=K;for(;U>0;G=G*256+$[q+w],w+=F,U-=8);if(Z===0)Z=1-V;else if(Z===B)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,K),Z=Z-V;return(M?-1:1)*G*Math.pow(2,Z-K)}function F9($,q,Q,K,J,Z){var G,W,B,V=Z*8-J-1,U=(1<>1,F=J===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:Z-1,k=K?1:-1,f=q<0||q===0&&1/q<0?1:0;if(q=Math.abs(q),isNaN(q)||q===1/0)W=isNaN(q)?1:0,G=U;else{if(G=Math.floor(Math.log(q)/Math.LN2),q*(B=Math.pow(2,-G))<1)G--,B*=2;if(G+w>=1)q+=F/B;else q+=F*Math.pow(2,1-w);if(q*B>=2)G++,B/=2;if(G+w>=U)W=0,G=U;else if(G+w>=1)W=(q*B-1)*Math.pow(2,J),G=G+w;else W=q*Math.pow(2,w-1)*Math.pow(2,J),G=0}for(;J>=8;$[Q+M]=W&255,M+=k,W/=256,J-=8);G=G<0;$[Q+M]=G&255,M+=k,G/=256,V-=8);$[Q+M-k]|=f*128}function S2($){if($>y6)throw RangeError('The value "'+$+'" is invalid for option "size"');let q=new Uint8Array($);return Object.setPrototypeOf(q,o.prototype),q}function x5($,q,Q){return class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:q.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}function o($,q,Q){if(typeof $==="number"){if(typeof q==="string")throw TypeError('The "string" argument must be of type string. Received type number');return O5($)}return N9($,q,Q)}function N9($,q,Q){if(typeof $==="string")return nJ($,q);if(ArrayBuffer.isView($))return dJ($);if($==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(C2($,ArrayBuffer)||$&&C2($.buffer,ArrayBuffer))return y5($,q,Q);if(typeof SharedArrayBuffer<"u"&&(C2($,SharedArrayBuffer)||$&&C2($.buffer,SharedArrayBuffer)))return y5($,q,Q);if(typeof $==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=$.valueOf&&$.valueOf();if(K!=null&&K!==$)return o.from(K,q,Q);let J=mJ($);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]==="function")return o.from($[Symbol.toPrimitive]("string"),q,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}function Y9($){if(typeof $!=="number")throw TypeError('"size" argument must be of type number');else if($<0)throw RangeError('The value "'+$+'" is invalid for option "size"')}function bJ($,q,Q){if(Y9($),$<=0)return S2($);if(q!==void 0)return typeof Q==="string"?S2($).fill(q,Q):S2($).fill(q);return S2($)}function O5($){return Y9($),S2($<0?0:P5($)|0)}function nJ($,q){if(typeof q!=="string"||q==="")q="utf8";if(!o.isEncoding(q))throw TypeError("Unknown encoding: "+q);let Q=k9($,q)|0,K=S2(Q),J=K.write($,q);if(J!==Q)K=K.slice(0,J);return K}function X5($){let q=$.length<0?0:P5($.length)|0,Q=S2(q);for(let K=0;K=y6)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y6.toString(16)+" bytes");return $|0}function k9($,q){if(o.isBuffer($))return $.length;if(ArrayBuffer.isView($)||C2($,ArrayBuffer))return $.byteLength;if(typeof $!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let Q=$.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&Q===0)return 0;let J=!1;for(;;)switch(q){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return h5($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return j9($).length;default:if(J)return K?-1:h5($).length;q=(""+q).toLowerCase(),J=!0}}function pJ($,q,Q){let K=!1;if(q===void 0||q<0)q=0;if(q>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,q>>>=0,Q<=q)return"";if(!$)$="utf8";while(!0)switch($){case"hex":return QV(this,q,Q);case"utf8":case"utf-8":return L9(this,q,Q);case"ascii":return eJ(this,q,Q);case"latin1":case"binary":return $V(this,q,Q);case"base64":return sJ(this,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qV(this,q,Q);default:if(K)throw TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),K=!0}}function w1($,q,Q){let K=$[q];$[q]=$[Q],$[Q]=K}function D9($,q,Q,K,J){if($.length===0)return-1;if(typeof Q==="string")K=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,Number.isNaN(Q))Q=J?0:$.length-1;if(Q<0)Q=$.length+Q;if(Q>=$.length)if(J)return-1;else Q=$.length-1;else if(Q<0)if(J)Q=0;else return-1;if(typeof q==="string")q=o.from(q,K);if(o.isBuffer(q)){if(q.length===0)return-1;return W9($,q,Q,K,J)}else if(typeof q==="number"){if(q=q&255,typeof Uint8Array.prototype.indexOf==="function")if(J)return Uint8Array.prototype.indexOf.call($,q,Q);else return Uint8Array.prototype.lastIndexOf.call($,q,Q);return W9($,[q],Q,K,J)}throw TypeError("val must be string, number or Buffer")}function W9($,q,Q,K,J){let Z=1,G=$.length,W=q.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if($.length<2||q.length<2)return-1;Z=2,G/=2,W/=2,Q/=2}}function B(U,w){if(Z===1)return U[w];else return U.readUInt16BE(w*Z)}let V;if(J){let U=-1;for(V=Q;VG)Q=G-W;for(V=Q;V>=0;V--){let U=!0;for(let w=0;wJ)K=J;let Z=q.length;if(K>Z/2)K=Z/2;let G;for(G=0;G239?4:Z>223?3:Z>191?2:1;if(J+W<=Q){let B,V,U,w;switch(W){case 1:if(Z<128)G=Z;break;case 2:if(B=$[J+1],(B&192)===128){if(w=(Z&31)<<6|B&63,w>127)G=w}break;case 3:if(B=$[J+1],V=$[J+2],(B&192)===128&&(V&192)===128){if(w=(Z&15)<<12|(B&63)<<6|V&63,w>2047&&(w<55296||w>57343))G=w}break;case 4:if(B=$[J+1],V=$[J+2],U=$[J+3],(B&192)===128&&(V&192)===128&&(U&192)===128){if(w=(Z&15)<<18|(B&63)<<12|(V&63)<<6|U&63,w>65535&&w<1114112)G=w}}}if(G===null)G=65533,W=1;else if(G>65535)G-=65536,K.push(G>>>10&1023|55296),G=56320|G&1023;K.push(G),J+=W}return tJ(K)}function tJ($){let q=$.length;if(q<=B9)return String.fromCharCode.apply(String,$);let Q="",K=0;while(KK)Q=K;let J="";for(let Z=q;ZQ)throw RangeError("Trying to access beyond buffer length")}function s0($,q,Q,K,J,Z){if(!o.isBuffer($))throw TypeError('"buffer" argument must be a Buffer instance');if(q>J||q$.length)throw RangeError("Index out of range")}function H9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,Q}function v9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q+7]=Z,Z=Z>>8,$[Q+6]=Z,Z=Z>>8,$[Q+5]=Z,Z=Z>>8,$[Q+4]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q+3]=G,G=G>>8,$[Q+2]=G,G=G>>8,$[Q+1]=G,G=G>>8,$[Q]=G,Q+8}function f9($,q,Q,K,J,Z){if(Q+K>$.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function R9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return F9($,q,Q,K,23,4),Q+4}function I9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return F9($,q,Q,K,52,8),Q+8}function z9($){let q="",Q=$.length,K=$[0]==="-"?1:0;for(;Q>=K+4;Q-=3)q=`_${$.slice(Q-3,Q)}${q}`;return`${$.slice(0,Q)}${q}`}function KV($,q,Q){if(n1(q,"offset"),$[q]===void 0||$[q+Q]===void 0)h6(q,$.length-(Q+1))}function C9($,q,Q,K,J,Z){if($>Q||$3)if(q===0||q===BigInt(0))W=`>= 0${G} and < 2${G} ** ${(Z+1)*8}${G}`;else W=`>= -(2${G} ** ${(Z+1)*8-1}${G}) and < 2 ** ${(Z+1)*8-1}${G}`;else W=`>= ${q}${G} and <= ${Q}${G}`;throw new A5("value",W,$)}KV(K,J,Z)}function n1($,q){if(typeof $!=="number")throw new cJ(q,"number",$)}function h6($,q,Q){if(Math.floor($)!==$)throw n1($,Q),new A5(Q||"offset","an integer",$);if(q<0)throw new _J;throw new A5(Q||"offset",`>= ${Q?1:0} and <= ${q}`,$)}function VV($){if($=$.split("=")[0],$=$.trim().replace(JV,""),$.length<2)return"";while($.length%4!==0)$=$+"=";return $}function h5($,q){q=q||1/0;let Q,K=$.length,J=null,Z=[];for(let G=0;G55295&&Q<57344){if(!J){if(Q>56319){if((q-=3)>-1)Z.push(239,191,189);continue}else if(G+1===K){if((q-=3)>-1)Z.push(239,191,189);continue}J=Q;continue}if(Q<56320){if((q-=3)>-1)Z.push(239,191,189);J=Q;continue}Q=(J-55296<<10|Q-56320)+65536}else if(J){if((q-=3)>-1)Z.push(239,191,189)}if(J=null,Q<128){if((q-=1)<0)break;Z.push(Q)}else if(Q<2048){if((q-=2)<0)break;Z.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((q-=3)<0)break;Z.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((q-=4)<0)break;Z.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return Z}function UV($){let q=[];for(let Q=0;Q<$.length;++Q)q.push($.charCodeAt(Q)&255);return q}function ZV($,q){let Q,K,J,Z=[];for(let G=0;G<$.length;++G){if((q-=2)<0)break;Q=$.charCodeAt(G),K=Q>>8,J=Q%256,Z.push(J),Z.push(K)}return Z}function j9($){return hJ(VV($))}function k8($,q,Q,K){let J;for(J=0;J=q.length||J>=$.length)break;q[J+Q]=$[J]}return J}function C2($,q){return $ instanceof q||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===q.name}function l2($){return typeof BigInt>"u"?WV:$}function WV(){throw Error("BigInt not supported")}function T5($){return()=>{throw Error($+" is not implemented for node:buffer browser polyfill")}}var I2,F2,g5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M1,U9,G9,M9=50,y6=2147483647,w9=536870888,PJ,TJ,uJ,SJ,EJ,_J,cJ,A5,B9=4096,JV,GV,BV,zV,FV=($)=>{for(let q of $)if(q.charCodeAt(0)>127)return!1;return!0},MV,wV;var t0=b1(()=>{I2=[],F2=[];for(M1=0,U9=g5.length;M14294967296)J=z9(String(Q));else if(typeof Q==="bigint"){if(J=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))J=z9(J);J+="n"}return K+=` It must be ${q}. Received ${J}`,K},RangeError);Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.buffer}});Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.byteOffset}});o.poolSize=8192;o.from=function($,q,Q){return N9($,q,Q)};Object.setPrototypeOf(o.prototype,Uint8Array.prototype);Object.setPrototypeOf(o,Uint8Array);o.alloc=function($,q,Q){return bJ($,q,Q)};o.allocUnsafe=function($){return O5($)};o.allocUnsafeSlow=function($){return O5($)};o.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==o.prototype};o.compare=function($,q){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(C2(q,Uint8Array))q=o.from(q,q.offset,q.byteLength);if(!o.isBuffer($)||!o.isBuffer(q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===q)return 0;let Q=$.length,K=q.length;for(let J=0,Z=Math.min(Q,K);JK.length){if(!o.isBuffer(Z))Z=o.from(Z);Z.copy(K,J)}else Uint8Array.prototype.set.call(K,Z,J);else if(!o.isBuffer(Z))throw TypeError('"list" argument must be an Array of Buffers');else Z.copy(K,J);J+=Z.length}return K};o.byteLength=k9;o.prototype._isBuffer=!0;o.prototype.swap16=function(){let $=this.length;if($%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let q=0;q<$;q+=2)w1(this,q,q+1);return this};o.prototype.swap32=function(){let $=this.length;if($%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let q=0;q<$;q+=4)w1(this,q,q+3),w1(this,q+1,q+2);return this};o.prototype.swap64=function(){let $=this.length;if($%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let q=0;q<$;q+=8)w1(this,q,q+7),w1(this,q+1,q+6),w1(this,q+2,q+5),w1(this,q+3,q+4);return this};o.prototype.toString=function(){let $=this.length;if($===0)return"";if(arguments.length===0)return L9(this,0,$);return pJ.apply(this,arguments)};o.prototype.toLocaleString=o.prototype.toString;o.prototype.equals=function($){if(!o.isBuffer($))throw TypeError("Argument must be a Buffer");if(this===$)return!0;return o.compare(this,$)===0};o.prototype.inspect=function(){let $="",q=M9;if($=this.toString("hex",0,q).replace(/(.{2})/g,"$1 ").trim(),this.length>q)$+=" ... ";return""};if(G9)o.prototype[G9]=o.prototype.inspect;o.prototype.compare=function($,q,Q,K,J){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(!o.isBuffer($))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(q===void 0)q=0;if(Q===void 0)Q=$?$.length:0;if(K===void 0)K=0;if(J===void 0)J=this.length;if(q<0||Q>$.length||K<0||J>this.length)throw RangeError("out of range index");if(K>=J&&q>=Q)return 0;if(K>=J)return-1;if(q>=Q)return 1;if(q>>>=0,Q>>>=0,K>>>=0,J>>>=0,this===$)return 0;let Z=J-K,G=Q-q,W=Math.min(Z,G),B=this.slice(K,J),V=$.slice(q,Q);for(let U=0;U>>0,isFinite(Q)){if(Q=Q>>>0,K===void 0)K="utf8"}else K=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let J=this.length-q;if(Q===void 0||Q>J)Q=J;if($.length>0&&(Q<0||q<0)||q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let Z=!1;for(;;)switch(K){case"hex":return iJ(this,$,q,Q);case"utf8":case"utf-8":return oJ(this,$,q,Q);case"ascii":case"latin1":case"binary":return aJ(this,$,q,Q);case"base64":return lJ(this,$,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rJ(this,$,q,Q);default:if(Z)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),Z=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};o.prototype.slice=function($,q){let Q=this.length;if($=~~$,q=q===void 0?Q:~~q,$<0){if($+=Q,$<0)$=0}else if($>Q)$=Q;if(q<0){if(q+=Q,q<0)q=0}else if(q>Q)q=Q;if(q<$)q=$;let K=this.subarray($,q);return Object.setPrototypeOf(K,o.prototype),K};o.prototype.readUintLE=o.prototype.readUIntLE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$+--q],J=1;while(q>0&&(J*=256))K+=this[$+--q]*J;return K};o.prototype.readUint8=o.prototype.readUInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);return this[$]};o.prototype.readUint16LE=o.prototype.readUInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]|this[$+1]<<8};o.prototype.readUint16BE=o.prototype.readUInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]<<8|this[$+1]};o.prototype.readUint32LE=o.prototype.readUInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216};o.prototype.readUint32BE=o.prototype.readUInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])};o.prototype.readBigUInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q+this[++$]*256+this[++$]*65536+this[++$]*16777216,J=this[++$]+this[++$]*256+this[++$]*65536+Q*16777216;return BigInt(K)+(BigInt(J)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q*16777216+this[++$]*65536+this[++$]*256+this[++$],J=this[++$]*16777216+this[++$]*65536+this[++$]*256+Q;return(BigInt(K)<>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z=J)K-=Math.pow(2,8*q);return K};o.prototype.readIntBE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=q,J=1,Z=this[$+--K];while(K>0&&(J*=256))Z+=this[$+--K]*J;if(J*=128,Z>=J)Z-=Math.pow(2,8*q);return Z};o.prototype.readInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);if(!(this[$]&128))return this[$];return(255-this[$]+1)*-1};o.prototype.readInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$]|this[$+1]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$+1]|this[$]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24};o.prototype.readInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]};o.prototype.readBigInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=this[$+4]+this[$+5]*256+this[$+6]*65536+(Q<<24);return(BigInt(K)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=(q<<24)+this[++$]*65536+this[++$]*256+this[++$];return(BigInt(K)<>>0,!q)b0($,4,this.length);return Y8(this,$,!0,23,4)};o.prototype.readFloatBE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return Y8(this,$,!1,23,4)};o.prototype.readDoubleLE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!0,52,8)};o.prototype.readDoubleBE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!1,52,8)};o.prototype.writeUintLE=o.prototype.writeUIntLE=function($,q,Q,K){if($=+$,q=q>>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=1,Z=0;this[q]=$&255;while(++Z>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=Q-1,Z=1;this[q+J]=$&255;while(--J>=0&&(Z*=256))this[q+J]=$/Z&255;return q+Q};o.prototype.writeUint8=o.prototype.writeUInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,255,0);return this[q]=$&255,q+1};o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q+3]=$>>>24,this[q+2]=$>>>16,this[q+1]=$>>>8,this[q]=$&255,q+4};o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigUInt64LE=l2(function($,q=0){return H9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeBigUInt64BE=l2(function($,q=0){return v9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeIntLE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=0,Z=1,G=0;this[q]=$&255;while(++J>0)-G&255}return q+Q};o.prototype.writeIntBE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=Q-1,Z=1,G=0;this[q+J]=$&255;while(--J>=0&&(Z*=256)){if($<0&&G===0&&this[q+J+1]!==0)G=1;this[q+J]=($/Z>>0)-G&255}return q+Q};o.prototype.writeInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,127,-128);if($<0)$=255+$+1;return this[q]=$&255,q+1};o.prototype.writeInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);return this[q]=$&255,this[q+1]=$>>>8,this[q+2]=$>>>16,this[q+3]=$>>>24,q+4};o.prototype.writeInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);if($<0)$=4294967295+$+1;return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigInt64LE=l2(function($,q=0){return H9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeBigInt64BE=l2(function($,q=0){return v9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeFloatLE=function($,q,Q){return R9(this,$,q,!0,Q)};o.prototype.writeFloatBE=function($,q,Q){return R9(this,$,q,!1,Q)};o.prototype.writeDoubleLE=function($,q,Q){return I9(this,$,q,!0,Q)};o.prototype.writeDoubleBE=function($,q,Q){return I9(this,$,q,!1,Q)};o.prototype.copy=function($,q,Q,K){if(!o.isBuffer($))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!K&&K!==0)K=this.length;if(q>=$.length)q=$.length;if(!q)q=0;if(K>0&&K=this.length)throw RangeError("Index out of range");if(K<0)throw RangeError("sourceEnd out of bounds");if(K>this.length)K=this.length;if($.length-q>>0,Q=Q===void 0?this.length:Q>>>0,!$)$=0;let J;if(typeof $==="number")for(J=q;J{var S0=y9.exports={},j2,g2;function u5(){throw Error("setTimeout has not been defined")}function S5(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")j2=setTimeout;else j2=u5}catch($){j2=u5}try{if(typeof clearTimeout==="function")g2=clearTimeout;else g2=S5}catch($){g2=S5}})();function g9($){if(j2===setTimeout)return setTimeout($,0);if((j2===u5||!j2)&&setTimeout)return j2=setTimeout,setTimeout($,0);try{return j2($,0)}catch(q){try{return j2.call(null,$,0)}catch(Q){return j2.call(this,$,0)}}}function NV($){if(g2===clearTimeout)return clearTimeout($);if((g2===S5||!g2)&&clearTimeout)return g2=clearTimeout,clearTimeout($);try{return g2($)}catch(q){try{return g2.call(null,$)}catch(Q){return g2.call(this,$)}}}var E2=[],d1=!1,N1,D8=-1;function YV(){if(!d1||!N1)return;if(d1=!1,N1.length)E2=N1.concat(E2);else D8=-1;if(E2.length)A9()}function A9(){if(d1)return;var $=g9(YV);d1=!0;var q=E2.length;while(q){N1=E2,E2=[];while(++D81)for(var Q=1;Qn9,once:()=>c9,listenerCount:()=>d9,init:()=>r2,getMaxListeners:()=>p9,getEventListeners:()=>b9,default:()=>CV,captureRejectionSymbol:()=>u9,addAbortListener:()=>i9,EventEmitter:()=>r2});function S9($,q){var{_events:Q}=$;if(q[0]??=Error("Unhandled error."),!Q)throw q[0];var K=Q[T9];if(K)for(var J of O9.call(K))J.apply($,q);var Z=Q.error;if(!Z)throw q[0];for(var J of O9.call(Z))J.apply($,q);return!0}function LV($,q,Q,K){q.then(void 0,function(J){queueMicrotask(()=>HV($,J,Q,K))})}function HV($,q,Q,K){if(typeof $[x9]==="function")$[x9](q,Q,...K);else try{$[Y1]=!1,$.emit("error",q)}finally{$[Y1]=!0}}function E9($,q,Q){Q.warned=!0;let K=Error(`Possible EventEmitter memory leak detected. ${Q.length} ${String(q)} listeners added to [${$.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=$,K.type=q,K.count=Q.length,console.warn(K)}function _9($,q,...Q){this.removeListener($,q),q.apply(this,Q)}function c9($,q,Q){var K=Q?.signal;if(m9(K,"options.signal"),K?.aborted)throw new E5(void 0,{cause:K?.reason});let{resolve:J,reject:Z,promise:G}=$newPromiseCapability(Promise),W=(U)=>{if($.removeListener(q,B),K!=null)L8(K,"abort",V);Z(U)},B=(...U)=>{if(typeof $.removeListener==="function")$.removeListener("error",W);if(K!=null)L8(K,"abort",V);J(U)};if(P9($,q,B,{once:!0}),q!=="error"&&typeof $.once==="function")$.once("error",W);function V(){L8($,q,B),L8($,"error",W),Z(new E5(void 0,{cause:K?.reason}))}if(K!=null)P9(K,"abort",V,{once:!0});return G}function b9($,q){return $.listeners(q)}function n9($,...q){c5($,"setMaxListeners",0);var Q;if(q&&(Q=q.length))for(let K=0;KK||(Q!=null||K!=null)&&Number.isNaN($))throw RV(q,`${Q!=null?`>= ${Q}`:""}${Q!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,$)}function x6($){if(typeof $!=="function")throw TypeError("The listener must be a function")}function IV($,q){if(typeof $!=="boolean")throw m1(q,"boolean",$)}function p9($){return $?._maxListeners??k1}function i9($,q){if($===void 0)throw m1("signal","AbortSignal",$);if(m9($,"signal"),typeof q!=="function")throw m1("listener","function",q);let Q;if($.aborted)queueMicrotask(()=>q());else $.addEventListener("abort",q,{__proto__:null,once:!0}),Q=()=>{$.removeEventListener("abort",q)};return{__proto__:null,[Symbol.dispose](){Q?.()}}}var _5,Y1,T9,kV,DV,x9,u9,O9,k1=10,r2=function($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[Y1]=$?.captureRejections?Boolean($?.captureRejections):y0[Y1])this.emit=fV},y0,vV=function($,...q){if($==="error")return S9(this,q);var{_events:Q}=this;if(Q===void 0)return!1;var K=Q[$];if(K===void 0)return!1;let J=K.length>1?K.slice():K;for(let Z=0,{length:G}=J;Z1?K.slice():K;for(let Z=0,{length:G}=J;Z{_5=Symbol.for,Y1=Symbol("kCapture"),T9=_5("events.errorMonitor"),kV=Symbol("events.maxEventTargetListeners"),DV=Symbol("events.maxEventTargetListenersWarned"),x9=_5("nodejs.rejection"),u9=_5("nodejs.rejection"),O9=Array.prototype.slice,y0=r2.prototype={};y0._events=void 0;y0._eventsCount=0;y0._maxListeners=void 0;y0.setMaxListeners=function($){return c5($,"setMaxListeners",0),this._maxListeners=$,this};y0.constructor=r2;y0.getMaxListeners=function(){return this?._maxListeners??k1};y0.emit=vV;y0.addListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.push(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.on=y0.addListener;y0.prependListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.unshift(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.once=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.addListener($,Q),this};y0.prependOnceListener=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.prependListener($,Q),this};y0.removeListener=function($,q){x6(q);var{_events:Q}=this;if(!Q)return this;var K=Q[$];if(!K)return this;var J=K.length;let Z=-1;for(let G=J-1;G>=0;G--)if(K[G]===q||K[G].listener===q){Z=G;break}if(Z<0)return this;if(Z===0)K.shift();else K.splice(Z,1);if(K.length===0)delete Q[$],this._eventsCount--;return this};y0.off=y0.removeListener;y0.removeAllListeners=function($){var{_events:q}=this;if($&&q){if(q[$])delete q[$],this._eventsCount--}else this._events={__proto__:null};return this};y0.listeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.map((K)=>K.listener??K)};y0.rawListeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.slice()};y0.listenerCount=function($){var{_events:q}=this;if(!q)return 0;return q[$]?.length??0};y0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};y0[Y1]=!1;E5=class E5 extends Error{constructor($="The operation was aborted",q=void 0){if(q!==void 0&&typeof q!=="object")throw m1("options","Object",q);super($,q);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(r2,{captureRejections:{get(){return y0[Y1]},set($){IV($,"EventEmitter.captureRejections"),y0[Y1]=$},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return k1},set:($)=>{c5($,"defaultMaxListeners",0),k1=$}},kMaxEventTargetListeners:{value:kV,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:DV,enumerable:!1,configurable:!1,writable:!1}});Object.assign(r2,{once:c9,getEventListeners:b9,getMaxListeners:p9,setMaxListeners:n9,EventEmitter:r2,usingDomains:!1,captureRejectionSymbol:u9,errorMonitor:T9,addAbortListener:i9,init:r2,listenerCount:d9});CV=r2});var a1=N0((Yz,$$)=>{var g0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),P0=g0(($,q)=>{class Q extends Error{constructor(K){if(!Array.isArray(K))throw TypeError(`Expected input to be an Array, got ${typeof K}`);let J="";for(let Z=0;Z{q.exports={format(Q,...K){return Q.replace(/%([sdifj])/g,function(...[J,Z]){let G=K.shift();if(Z==="f")return G.toFixed(6);else if(Z==="j")return JSON.stringify(G);else if(Z==="s"&&typeof G==="object")return`${G.constructor!==Object?G.constructor.name:""} {}`.trim();else return G.toString()})},inspect(Q){switch(typeof Q){case"string":if(Q.includes("'")){if(!Q.includes('"'))return`"${Q}"`;else if(!Q.includes("`")&&!Q.includes("${"))return`\`${Q}\``}return`'${Q}'`;case"number":if(isNaN(Q))return"NaN";else if(Object.is(Q,-0))return String(Q);return Q;case"bigint":return`${String(Q)}n`;case"boolean":case"undefined":return String(Q);case"object":return"{}"}}}}),a0=g0(($,q)=>{var{format:Q,inspect:K}=o9(),{AggregateError:J}=P0(),Z=globalThis.AggregateError||J,G=Symbol("kIsNodeError"),W=["string","function","number","object","Function","Object","boolean","bigint","symbol"],B=/^([A-Z][a-z0-9]*)+$/,V={};function U(D,z){if(!D)throw new V.ERR_INTERNAL_ASSERTION(z)}function w(D){let z="",N=D.length,H=D[0]==="-"?1:0;for(;N>=H+4;N-=3)z=`_${D.slice(N-3,N)}${z}`;return`${D.slice(0,N)}${z}`}function F(D,z,N){if(typeof z==="function")return U(z.length<=N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${z.length}).`),z(...N);let H=(z.match(/%[dfijoOs]/g)||[]).length;if(U(H===N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${H}).`),N.length===0)return z;return Q(z,...N)}function M(D,z,N){if(!N)N=Error;class H extends N{constructor(...v){super(F(D,z,v))}toString(){return`${this.name} [${D}]: ${this.message}`}}Object.defineProperties(H.prototype,{name:{value:N.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${D}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),H.prototype.code=D,H.prototype[G]=!0,V[D]=H}function k(D){let z="__node_internal_"+D.name;return Object.defineProperty(D,"name",{value:z}),D}function f(D,z){if(D&&z&&D!==z){if(Array.isArray(z.errors))return z.errors.push(D),z;let N=new Z([z,D],z.message);return N.code=z.code,N}return D||z}class L extends Error{constructor(D="The operation was aborted",z=void 0){if(z!==void 0&&typeof z!=="object")throw new V.ERR_INVALID_ARG_TYPE("options","Object",z);super(D,z);this.code="ABORT_ERR",this.name="AbortError"}}M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(D,z,N)=>{if(U(typeof D==="string","'name' must be a string"),!Array.isArray(z))z=[z];let H="The ";if(D.endsWith(" argument"))H+=`${D} `;else H+=`"${D}" ${D.includes(".")?"property":"argument"} `;H+="must be ";let v=[],j=[],n=[];for(let _ of z)if(U(typeof _==="string","All expected entries have to be of type string"),W.includes(_))v.push(_.toLowerCase());else if(B.test(_))j.push(_);else U(_!=="object",'The value "object" should be written as "Object"'),n.push(_);if(j.length>0){let _=v.indexOf("object");if(_!==-1)v.splice(v,_,1),j.push("Object")}if(v.length>0){switch(v.length){case 1:H+=`of type ${v[0]}`;break;case 2:H+=`one of type ${v[0]} or ${v[1]}`;break;default:{let _=v.pop();H+=`one of type ${v.join(", ")}, or ${_}`}}if(j.length>0||n.length>0)H+=" or "}if(j.length>0){switch(j.length){case 1:H+=`an instance of ${j[0]}`;break;case 2:H+=`an instance of ${j[0]} or ${j[1]}`;break;default:{let _=j.pop();H+=`an instance of ${j.join(", ")}, or ${_}`}}if(n.length>0)H+=" or "}switch(n.length){case 0:break;case 1:if(n[0].toLowerCase()!==n[0])H+="an ";H+=`${n[0]}`;break;case 2:H+=`one of ${n[0]} or ${n[1]}`;break;default:{let _=n.pop();H+=`one of ${n.join(", ")}, or ${_}`}}if(N==null)H+=`. Received ${N}`;else if(typeof N==="function"&&N.name)H+=`. Received function ${N.name}`;else if(typeof N==="object"){var d;if((d=N.constructor)!==null&&d!==void 0&&d.name)H+=`. Received an instance of ${N.constructor.name}`;else{let _=K(N,{depth:-1});H+=`. Received ${_}`}}else{let _=K(N,{colors:!1});if(_.length>25)_=`${_.slice(0,25)}...`;H+=`. Received type ${typeof N} (${_})`}return H},TypeError),M("ERR_INVALID_ARG_VALUE",(D,z,N="is invalid")=>{let H=K(z);if(H.length>128)H=H.slice(0,128)+"...";return`The ${D.includes(".")?"property":"argument"} '${D}' ${N}. Received ${H}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(D,z,N)=>{var H;let v=N!==null&&N!==void 0&&(H=N.constructor)!==null&&H!==void 0&&H.name?`instance of ${N.constructor.name}`:`type ${typeof N}`;return`Expected ${D} to be returned from the "${z}" function but got ${v}.`},TypeError),M("ERR_MISSING_ARGS",(...D)=>{U(D.length>0,"At least one arg needs to be specified");let z,N=D.length;switch(D=(Array.isArray(D)?D:[D]).map((H)=>`"${H}"`).join(" or "),N){case 1:z+=`The ${D[0]} argument`;break;case 2:z+=`The ${D[0]} and ${D[1]} arguments`;break;default:{let H=D.pop();z+=`The ${D.join(", ")}, and ${H} arguments`}break}return`${z} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(D,z,N)=>{U(z,'Missing "range" argument');let H;if(Number.isInteger(N)&&Math.abs(N)>4294967296)H=w(String(N));else if(typeof N==="bigint"){H=String(N);let v=BigInt(2)**BigInt(32);if(N>v||N<-v)H=w(H);H+="n"}else H=K(N);return`The value of "${D}" is out of range. It must be ${z}. Received ${H}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),q.exports={AbortError:L,aggregateTwoErrors:k(f),hideStackFrames:k,codes:V}}),jV=g0(($,q)=>{Object.defineProperty($,"__esModule",{value:!0});var Q=new WeakMap,K=new WeakMap;function J(X){let P=Q.get(X);return console.assert(P!=null,"'this' is expected an Event object, but got",X),P}function Z(X){if(X.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",X.passiveListener);return}if(!X.event.cancelable)return;if(X.canceled=!0,typeof X.event.preventDefault==="function")X.event.preventDefault()}function G(X,P){Q.set(this,{eventTarget:X,event:P,eventPhase:2,currentTarget:X,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:P.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let g=Object.keys(P);for(let c=0;c0){let X=Array(arguments.length);for(let P=0;P{Object.defineProperty($,"__esModule",{value:!0});var Q=jV();class K extends Q.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let U=G.get(this);if(typeof U!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return U}}Q.defineEventAttribute(K.prototype,"abort");function J(){let U=Object.create(K.prototype);return Q.EventTarget.call(U),G.set(U,!1),U}function Z(U){if(G.get(U)!==!1)return;G.set(U,!0),U.dispatchEvent({type:"abort"})}var G=new WeakMap;if(Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class W{constructor(){B.set(this,J())}get signal(){return V(this)}abort(){Z(V(this))}}var B=new WeakMap;function V(U){let w=B.get(U);if(w==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${U===null?"null":typeof U}`);return w}if(Object.defineProperties(W.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(W.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});$.AbortController=W,$.AbortSignal=K,$.default=W,q.exports=W,q.exports.AbortController=q.exports.default=W,q.exports.AbortSignal=K}),e0=g0(($,q)=>{var Q=(t0(),X0(K2)),{format:K,inspect:J}=o9(),{codes:{ERR_INVALID_ARG_TYPE:Z}}=a0(),{kResistStopPropagation:G,AggregateError:W,SymbolDispose:B}=P0(),V=globalThis.AbortSignal||O6().AbortSignal,U=globalThis.AbortController||O6().AbortController,w=Object.getPrototypeOf(async function(){}).constructor,F=globalThis.Blob||Q.Blob,M=typeof F<"u"?function(L){return L instanceof F}:function(L){return!1},k=(L,D)=>{if(L!==void 0&&(L===null||typeof L!=="object"||!("aborted"in L)))throw new Z(D,"AbortSignal",L)},f=(L,D)=>{if(typeof L!=="function")throw new Z(D,"Function",L)};q.exports={AggregateError:W,kEmptyObject:Object.freeze({}),once(L){let D=!1;return function(...z){if(D)return;D=!0,L.apply(this,z)}},createDeferredPromise:function(){let L,D;return{promise:new Promise((z,N)=>{L=z,D=N}),resolve:L,reject:D}},promisify(L){return new Promise((D,z)=>{L((N,...H)=>{if(N)return z(N);return D(...H)})})},debuglog(){return function(){}},format:K,inspect:J,types:{isAsyncFunction(L){return L instanceof w},isArrayBufferView(L){return ArrayBuffer.isView(L)}},isBlob:M,deprecate(L,D){return L},addAbortListener:(i1(),X0(p1)).addAbortListener||function(L,D){if(L===void 0)throw new Z("signal","AbortSignal",L);k(L,"signal"),f(D,"listener");let z;if(L.aborted)queueMicrotask(()=>D());else L.addEventListener("abort",D,{__proto__:null,once:!0,[G]:!0}),z=()=>{L.removeEventListener("abort",D)};return{__proto__:null,[B](){var N;(N=z)===null||N===void 0||N()}}},AbortSignalAny:V.any||function(L){if(L.length===1)return L[0];let D=new U,z=()=>D.abort();return L.forEach((N)=>{k(N,"signals"),N.addEventListener("abort",z,{once:!0})}),D.signal.addEventListener("abort",()=>{L.forEach((N)=>N.removeEventListener("abort",z))},{once:!0}),D.signal}},q.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),P6=g0(($,q)=>{var{ArrayIsArray:Q,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:J,ArrayPrototypeMap:Z,NumberIsInteger:G,NumberIsNaN:W,NumberMAX_SAFE_INTEGER:B,NumberMIN_SAFE_INTEGER:V,NumberParseInt:U,ObjectPrototypeHasOwnProperty:w,RegExpPrototypeExec:F,String:M,StringPrototypeToUpperCase:k,StringPrototypeTrim:f}=P0(),{hideStackFrames:L,codes:{ERR_SOCKET_BAD_PORT:D,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:N,ERR_OUT_OF_RANGE:H,ERR_UNKNOWN_SIGNAL:v}}=a0(),{normalizeEncoding:j}=e0(),{isAsyncFunction:n,isArrayBufferView:d}=e0().types,_={};function X(T){return T===(T|0)}function P(T){return T===T>>>0}var g=/^[0-7]+$/,c="must be a 32-bit unsigned integer or an octal string";function h(T,t,G0){if(typeof T>"u")T=G0;if(typeof T==="string"){if(F(g,T)===null)throw new N(t,T,c);T=U(T,8)}return $0(T,t),T}var x=L((T,t,G0=V,Q0=B)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),l=L((T,t,G0=-2147483648,Q0=2147483647)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),$0=L((T,t,G0=!1)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);let Q0=G0?1:0,M0=4294967295;if(TM0)throw new H(t,`>= ${Q0} && <= ${M0}`,T)});function Z0(T,t){if(typeof T!=="string")throw new z(t,"string",T)}function F0(T,t,G0=void 0,Q0){if(typeof T!=="number")throw new z(t,"number",T);if(G0!=null&&TQ0||(G0!=null||Q0!=null)&&W(T))throw new H(t,`${G0!=null?`>= ${G0}`:""}${G0!=null&&Q0!=null?" && ":""}${Q0!=null?`<= ${Q0}`:""}`,T)}var p=L((T,t,G0)=>{if(!K(G0,T)){let Q0="must be one of: "+J(Z(G0,(M0)=>typeof M0==="string"?`'${M0}'`:M(M0)),", ");throw new N(t,T,Q0)}});function W0(T,t){if(typeof T!=="boolean")throw new z(t,"boolean",T)}function y(T,t,G0){return T==null||!w(T,t)?G0:T[t]}var i=L((T,t,G0=null)=>{let Q0=y(G0,"allowArray",!1),M0=y(G0,"allowFunction",!1);if(!y(G0,"nullable",!1)&&T===null||!Q0&&Q(T)||typeof T!=="object"&&(!M0||typeof T!=="function"))throw new z(t,"Object",T)}),U0=L((T,t)=>{if(T!=null&&typeof T!=="object"&&typeof T!=="function")throw new z(t,"a dictionary",T)}),m=L((T,t,G0=0)=>{if(!Q(T))throw new z(t,"Array",T);if(T.length{if(!d(T))throw new z(t,["Buffer","TypedArray","DataView"],T)});function E(T,t){let G0=j(t),Q0=T.length;if(G0==="hex"&&Q0%2!==0)throw new N("encoding",t,`is invalid for data of length ${Q0}`)}function a(T,t="Port",G0=!0){if(typeof T!=="number"&&typeof T!=="string"||typeof T==="string"&&f(T).length===0||+T!==+T>>>0||T>65535||T===0&&!G0)throw new D(t,T,G0);return T|0}var K0=L((T,t)=>{if(T!==void 0&&(T===null||typeof T!=="object"||!("aborted"in T)))throw new z(t,"AbortSignal",T)}),R=L((T,t)=>{if(typeof T!=="function")throw new z(t,"Function",T)}),Y=L((T,t)=>{if(typeof T!=="function"||n(T))throw new z(t,"Function",T)}),C=L((T,t)=>{if(T!==void 0)throw new z(t,"undefined",T)});function u(T,t,G0){if(!K(G0,T))throw new z(t,`('${J(G0,"|")}')`,T)}var e=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function r(T,t){if(typeof T>"u"||!F(e,T))throw new N(t,T,'must be an array or string of format "; rel=preload; as=style"')}function s(T){if(typeof T==="string")return r(T,"hints"),T;else if(Q(T)){let t=T.length,G0="";if(t===0)return G0;for(let Q0=0;Q0; rel=preload; as=style"')}q.exports={isInt32:X,isUint32:P,parseFileMode:h,validateArray:m,validateStringArray:V0,validateBooleanArray:w0,validateAbortSignalArray:S,validateBoolean:W0,validateBuffer:O,validateDictionary:U0,validateEncoding:E,validateFunction:R,validateInt32:l,validateInteger:x,validateNumber:F0,validateObject:i,validateOneOf:p,validatePlainFunction:Y,validatePort:a,validateSignalName:b,validateString:Z0,validateUint32:$0,validateUndefined:C,validateUnion:u,validateAbortSignal:K0,validateLinkHeaderValue:s}}),D1=g0(($,q)=>{q.exports=globalThis.process}),b2=g0(($,q)=>{var{SymbolAsyncIterator:Q,SymbolIterator:K,SymbolFor:J}=P0(),Z=J("nodejs.stream.destroyed"),G=J("nodejs.stream.errored"),W=J("nodejs.stream.readable"),B=J("nodejs.stream.writable"),V=J("nodejs.stream.disturbed"),U=J("nodejs.webstream.isClosedPromise"),w=J("nodejs.webstream.controllerErrorFunction");function F(y,i=!1){var U0;return!!(y&&typeof y.pipe==="function"&&typeof y.on==="function"&&(!i||typeof y.pause==="function"&&typeof y.resume==="function")&&(!y._writableState||((U0=y._readableState)===null||U0===void 0?void 0:U0.readable)!==!1)&&(!y._writableState||y._readableState))}function M(y){var i;return!!(y&&typeof y.write==="function"&&typeof y.on==="function"&&(!y._readableState||((i=y._writableState)===null||i===void 0?void 0:i.writable)!==!1))}function k(y){return!!(y&&typeof y.pipe==="function"&&y._readableState&&typeof y.on==="function"&&typeof y.write==="function")}function f(y){return y&&(y._readableState||y._writableState||typeof y.write==="function"&&typeof y.on==="function"||typeof y.pipe==="function"&&typeof y.on==="function")}function L(y){return!!(y&&!f(y)&&typeof y.pipeThrough==="function"&&typeof y.getReader==="function"&&typeof y.cancel==="function")}function D(y){return!!(y&&!f(y)&&typeof y.getWriter==="function"&&typeof y.abort==="function")}function z(y){return!!(y&&!f(y)&&typeof y.readable==="object"&&typeof y.writable==="object")}function N(y){return L(y)||D(y)||z(y)}function H(y,i){if(y==null)return!1;if(i===!0)return typeof y[Q]==="function";if(i===!1)return typeof y[K]==="function";return typeof y[Q]==="function"||typeof y[K]==="function"}function v(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!!(y.destroyed||y[Z]||m!==null&&m!==void 0&&m.destroyed)}function j(y){if(!M(y))return null;if(y.writableEnded===!0)return!0;let i=y._writableState;if(i!==null&&i!==void 0&&i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function n(y,i){if(!M(y))return null;if(y.writableFinished===!0)return!0;let U0=y._writableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.finished)!=="boolean")return null;return!!(U0.finished||i===!1&&U0.ended===!0&&U0.length===0)}function d(y){if(!F(y))return null;if(y.readableEnded===!0)return!0;let i=y._readableState;if(!i||i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function _(y,i){if(!F(y))return null;let U0=y._readableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.endEmitted)!=="boolean")return null;return!!(U0.endEmitted||i===!1&&U0.ended===!0&&U0.length===0)}function X(y){if(y&&y[W]!=null)return y[W];if(typeof(y===null||y===void 0?void 0:y.readable)!=="boolean")return null;if(v(y))return!1;return F(y)&&y.readable&&!_(y)}function P(y){if(y&&y[B]!=null)return y[B];if(typeof(y===null||y===void 0?void 0:y.writable)!=="boolean")return null;if(v(y))return!1;return M(y)&&y.writable&&!j(y)}function g(y,i){if(!f(y))return null;if(v(y))return!0;if((i===null||i===void 0?void 0:i.readable)!==!1&&X(y))return!1;if((i===null||i===void 0?void 0:i.writable)!==!1&&P(y))return!1;return!0}function c(y){var i,U0;if(!f(y))return null;if(y.writableErrored)return y.writableErrored;return(i=(U0=y._writableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function h(y){var i,U0;if(!f(y))return null;if(y.readableErrored)return y.readableErrored;return(i=(U0=y._readableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function x(y){if(!f(y))return null;if(typeof y.closed==="boolean")return y.closed;let{_writableState:i,_readableState:U0}=y;if(typeof(i===null||i===void 0?void 0:i.closed)==="boolean"||typeof(U0===null||U0===void 0?void 0:U0.closed)==="boolean")return(i===null||i===void 0?void 0:i.closed)||(U0===null||U0===void 0?void 0:U0.closed);if(typeof y._closed==="boolean"&&l(y))return y._closed;return null}function l(y){return typeof y._closed==="boolean"&&typeof y._defaultKeepAlive==="boolean"&&typeof y._removedConnection==="boolean"&&typeof y._removedContLen==="boolean"}function $0(y){return typeof y._sent100==="boolean"&&l(y)}function Z0(y){var i;return typeof y._consuming==="boolean"&&typeof y._dumped==="boolean"&&((i=y.req)===null||i===void 0?void 0:i.upgradeOrConnect)===void 0}function F0(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!m&&$0(y)||!!(m&&m.autoDestroy&&m.emitClose&&m.closed===!1)}function p(y){var i;return!!(y&&((i=y[V])!==null&&i!==void 0?i:y.readableDidRead||y.readableAborted))}function W0(y){var i,U0,m,V0,w0,S,b,O,E,a;return!!(y&&((i=(U0=(m=(V0=(w0=(S=y[G])!==null&&S!==void 0?S:y.readableErrored)!==null&&w0!==void 0?w0:y.writableErrored)!==null&&V0!==void 0?V0:(b=y._readableState)===null||b===void 0?void 0:b.errorEmitted)!==null&&m!==void 0?m:(O=y._writableState)===null||O===void 0?void 0:O.errorEmitted)!==null&&U0!==void 0?U0:(E=y._readableState)===null||E===void 0?void 0:E.errored)!==null&&i!==void 0?i:(a=y._writableState)===null||a===void 0?void 0:a.errored))}q.exports={isDestroyed:v,kIsDestroyed:Z,isDisturbed:p,kIsDisturbed:V,isErrored:W0,kIsErrored:G,isReadable:X,kIsReadable:W,kIsClosedPromise:U,kControllerErrorFunction:w,kIsWritable:B,isClosed:x,isDuplexNodeStream:k,isFinished:g,isIterable:H,isReadableNodeStream:F,isReadableStream:L,isReadableEnded:d,isReadableFinished:_,isReadableErrored:h,isNodeStream:f,isWebStream:N,isWritable:P,isWritableNodeStream:M,isWritableStream:D,isWritableEnded:j,isWritableFinished:n,isWritableErrored:c,isServerRequest:Z0,isServerResponse:$0,willEmitClose:F0,isTransformStream:z}}),s2=g0(($,q)=>{var Q=D1(),{AbortError:K,codes:J}=a0(),{ERR_INVALID_ARG_TYPE:Z,ERR_STREAM_PREMATURE_CLOSE:G}=J,{kEmptyObject:W,once:B}=e0(),{validateAbortSignal:V,validateFunction:U,validateObject:w,validateBoolean:F}=P6(),{Promise:M,PromisePrototypeThen:k,SymbolDispose:f}=P0(),{isClosed:L,isReadable:D,isReadableNodeStream:z,isReadableStream:N,isReadableFinished:H,isReadableErrored:v,isWritable:j,isWritableNodeStream:n,isWritableStream:d,isWritableFinished:_,isWritableErrored:X,isNodeStream:P,willEmitClose:g,kIsClosedPromise:c}=b2(),h;function x(p){return p.setHeader&&typeof p.abort==="function"}var l=()=>{};function $0(p,W0,y){var i,U0;if(arguments.length===2)y=W0,W0=W;else if(W0==null)W0=W;else w(W0,"options");if(U(y,"callback"),V(W0.signal,"options.signal"),y=B(y),N(p)||d(p))return Z0(p,W0,y);if(!P(p))throw new Z("stream",["ReadableStream","WritableStream","Stream"],p);let m=(i=W0.readable)!==null&&i!==void 0?i:z(p),V0=(U0=W0.writable)!==null&&U0!==void 0?U0:n(p),w0=p._writableState,S=p._readableState,b=()=>{if(!p.writable)a()},O=g(p)&&z(p)===m&&n(p)===V0,E=_(p,!1),a=()=>{if(E=!0,p.destroyed)O=!1;if(O&&(!p.readable||m))return;if(!m||K0)y.call(p)},K0=H(p,!1),R=()=>{if(K0=!0,p.destroyed)O=!1;if(O&&(!p.writable||V0))return;if(!V0||E)y.call(p)},Y=(T)=>{y.call(p,T)},C=L(p),u=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);if(m&&!K0&&z(p,!0)){if(!H(p,!1))return y.call(p,new G)}if(V0&&!E){if(!_(p,!1))return y.call(p,new G)}y.call(p)},e=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);y.call(p)},r=()=>{p.req.on("finish",a)};if(x(p)){if(p.on("complete",a),!O)p.on("abort",u);if(p.req)r();else p.on("request",r)}else if(V0&&!w0)p.on("end",b),p.on("close",b);if(!O&&typeof p.aborted==="boolean")p.on("aborted",u);if(p.on("end",R),p.on("finish",a),W0.error!==!1)p.on("error",Y);if(p.on("close",u),C)Q.nextTick(u);else if(w0!==null&&w0!==void 0&&w0.errorEmitted||S!==null&&S!==void 0&&S.errorEmitted){if(!O)Q.nextTick(e)}else if(!m&&(!O||D(p))&&(E||j(p)===!1))Q.nextTick(e);else if(!V0&&(!O||j(p))&&(K0||D(p)===!1))Q.nextTick(e);else if(S&&p.req&&p.aborted)Q.nextTick(e);let s=()=>{if(y=l,p.removeListener("aborted",u),p.removeListener("complete",a),p.removeListener("abort",u),p.removeListener("request",r),p.req)p.req.removeListener("finish",a);p.removeListener("end",b),p.removeListener("close",b),p.removeListener("finish",a),p.removeListener("end",R),p.removeListener("error",Y),p.removeListener("close",u)};if(W0.signal&&!C){let T=()=>{let t=y;s(),t.call(p,new K(void 0,{cause:W0.signal.reason}))};if(W0.signal.aborted)Q.nextTick(T);else{h=h||e0().addAbortListener;let t=h(W0.signal,T),G0=y;y=B((...Q0)=>{t[f](),G0.apply(p,Q0)})}}return s}function Z0(p,W0,y){let i=!1,U0=l;if(W0.signal)if(U0=()=>{i=!0,y.call(p,new K(void 0,{cause:W0.signal.reason}))},W0.signal.aborted)Q.nextTick(U0);else{h=h||e0().addAbortListener;let V0=h(W0.signal,U0),w0=y;y=B((...S)=>{V0[f](),w0.apply(p,S)})}let m=(...V0)=>{if(!i)Q.nextTick(()=>y.apply(p,V0))};return k(p[c].promise,m,m),l}function F0(p,W0){var y;let i=!1;if(W0===null)W0=W;if((y=W0)!==null&&y!==void 0&&y.cleanup)F(W0.cleanup,"cleanup"),i=W0.cleanup;return new M((U0,m)=>{let V0=$0(p,W0,(w0)=>{if(i)V0();if(w0)m(w0);else U0()})})}q.exports=$0,q.exports.finished=F0}),o1=g0(($,q)=>{var Q=D1(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:J},AbortError:Z}=a0(),{Symbol:G}=P0(),{kIsDestroyed:W,isDestroyed:B,isFinished:V,isServerRequest:U}=b2(),w=G("kDestroy"),F=G("kConstruct");function M(g,c,h){if(g){if(g.stack,c&&!c.errored)c.errored=g;if(h&&!h.errored)h.errored=g}}function k(g,c){let h=this._readableState,x=this._writableState,l=x||h;if(x!==null&&x!==void 0&&x.destroyed||h!==null&&h!==void 0&&h.destroyed){if(typeof c==="function")c();return this}if(M(g,x,h),x)x.destroyed=!0;if(h)h.destroyed=!0;if(!l.constructed)this.once(w,function($0){f(this,K($0,g),c)});else f(this,g,c);return this}function f(g,c,h){let x=!1;function l($0){if(x)return;x=!0;let{_readableState:Z0,_writableState:F0}=g;if(M($0,F0,Z0),F0)F0.closed=!0;if(Z0)Z0.closed=!0;if(typeof h==="function")h($0);if($0)Q.nextTick(L,g,$0);else Q.nextTick(D,g)}try{g._destroy(c||null,l)}catch($0){l($0)}}function L(g,c){z(g,c),D(g)}function D(g){let{_readableState:c,_writableState:h}=g;if(h)h.closeEmitted=!0;if(c)c.closeEmitted=!0;if(h!==null&&h!==void 0&&h.emitClose||c!==null&&c!==void 0&&c.emitClose)g.emit("close")}function z(g,c){let{_readableState:h,_writableState:x}=g;if(x!==null&&x!==void 0&&x.errorEmitted||h!==null&&h!==void 0&&h.errorEmitted)return;if(x)x.errorEmitted=!0;if(h)h.errorEmitted=!0;g.emit("error",c)}function N(){let g=this._readableState,c=this._writableState;if(g)g.constructed=!0,g.closed=!1,g.closeEmitted=!1,g.destroyed=!1,g.errored=null,g.errorEmitted=!1,g.reading=!1,g.ended=g.readable===!1,g.endEmitted=g.readable===!1;if(c)c.constructed=!0,c.destroyed=!1,c.closed=!1,c.closeEmitted=!1,c.errored=null,c.errorEmitted=!1,c.finalCalled=!1,c.prefinished=!1,c.ended=c.writable===!1,c.ending=c.writable===!1,c.finished=c.writable===!1}function H(g,c,h){let{_readableState:x,_writableState:l}=g;if(l!==null&&l!==void 0&&l.destroyed||x!==null&&x!==void 0&&x.destroyed)return this;if(x!==null&&x!==void 0&&x.autoDestroy||l!==null&&l!==void 0&&l.autoDestroy)g.destroy(c);else if(c){if(c.stack,l&&!l.errored)l.errored=c;if(x&&!x.errored)x.errored=c;if(h)Q.nextTick(z,g,c);else z(g,c)}}function v(g,c){if(typeof g._construct!=="function")return;let{_readableState:h,_writableState:x}=g;if(h)h.constructed=!1;if(x)x.constructed=!1;if(g.once(F,c),g.listenerCount(F)>1)return;Q.nextTick(j,g)}function j(g){let c=!1;function h(x){if(c){H(g,x!==null&&x!==void 0?x:new J);return}c=!0;let{_readableState:l,_writableState:$0}=g,Z0=$0||l;if(l)l.constructed=!0;if($0)$0.constructed=!0;if(Z0.destroyed)g.emit(w,x);else if(x)H(g,x,!0);else Q.nextTick(n,g)}try{g._construct((x)=>{Q.nextTick(h,x)})}catch(x){Q.nextTick(h,x)}}function n(g){g.emit(F)}function d(g){return(g===null||g===void 0?void 0:g.setHeader)&&typeof g.abort==="function"}function _(g){g.emit("close")}function X(g,c){g.emit("error",c),Q.nextTick(_,g)}function P(g,c){if(!g||B(g))return;if(!c&&!V(g))c=new Z;if(U(g))g.socket=null,g.destroy(c);else if(d(g))g.abort();else if(d(g.req))g.req.abort();else if(typeof g.destroy==="function")g.destroy(c);else if(typeof g.close==="function")g.close();else if(c)Q.nextTick(X,g,c);else Q.nextTick(_,g);if(!g.destroyed)g[W]=!0}q.exports={construct:v,destroyer:P,destroy:k,undestroy:N,errorOrDestroy:H}}),b5=g0(($,q)=>{var{ArrayIsArray:Q,ObjectSetPrototypeOf:K}=P0(),{EventEmitter:J}=(i1(),X0(p1));function Z(W){J.call(this,W)}K(Z.prototype,J.prototype),K(Z,J),Z.prototype.pipe=function(W,B){let V=this;function U(D){if(W.writable&&W.write(D)===!1&&V.pause)V.pause()}V.on("data",U);function w(){if(V.readable&&V.resume)V.resume()}if(W.on("drain",w),!W._isStdio&&(!B||B.end!==!1))V.on("end",M),V.on("close",k);let F=!1;function M(){if(F)return;F=!0,W.end()}function k(){if(F)return;if(F=!0,typeof W.destroy==="function")W.destroy()}function f(D){if(L(),J.listenerCount(this,"error")===0)this.emit("error",D)}G(V,"error",f),G(W,"error",f);function L(){V.removeListener("data",U),W.removeListener("drain",w),V.removeListener("end",M),V.removeListener("close",k),V.removeListener("error",f),W.removeListener("error",f),V.removeListener("end",L),V.removeListener("close",L),W.removeListener("close",L)}return V.on("end",L),V.on("close",L),W.on("close",L),W.emit("pipe",V),W};function G(W,B,V){if(typeof W.prependListener==="function")return W.prependListener(B,V);if(!W._events||!W._events[B])W.on(B,V);else if(Q(W._events[B]))W._events[B].unshift(V);else W._events[B]=[V,W._events[B]]}q.exports={Stream:Z,prependListener:G}}),H8=g0(($,q)=>{var{SymbolDispose:Q}=P0(),{AbortError:K,codes:J}=a0(),{isNodeStream:Z,isWebStream:G,kControllerErrorFunction:W}=b2(),B=s2(),{ERR_INVALID_ARG_TYPE:V}=J,U,w=(F,M)=>{if(typeof F!=="object"||!("aborted"in F))throw new V(M,"AbortSignal",F)};q.exports.addAbortSignal=function(F,M){if(w(F,"signal"),!Z(M)&&!G(M))throw new V("stream",["ReadableStream","WritableStream","Stream"],M);return q.exports.addAbortSignalNoValidate(F,M)},q.exports.addAbortSignalNoValidate=function(F,M){if(typeof F!=="object"||!("aborted"in F))return M;let k=Z(M)?()=>{M.destroy(new K(void 0,{cause:F.reason}))}:()=>{M[W](new K(void 0,{cause:F.reason}))};if(F.aborted)k();else{U=U||e0().addAbortListener;let f=U(F,k);B(M,f[Q])}return M}}),gV=g0(($,q)=>{var{StringPrototypeSlice:Q,SymbolIterator:K,TypedArrayPrototypeSet:J,Uint8Array:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{inspect:W}=e0();q.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(B){let V={data:B,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length}unshift(B){let V={data:B,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length}shift(){if(this.length===0)return;let B=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,B}clear(){this.head=this.tail=null,this.length=0}join(B){if(this.length===0)return"";let V=this.head,U=""+V.data;while((V=V.next)!==null)U+=B+V.data;return U}concat(B){if(this.length===0)return G.alloc(0);let V=G.allocUnsafe(B>>>0),U=this.head,w=0;while(U)J(V,U.data,w),w+=U.data.length,U=U.next;return V}consume(B,V){let U=this.head.data;if(BF.length)V+=F,B-=F.length;else{if(B===F.length)if(V+=F,++w,U.next)this.head=U.next;else this.head=this.tail=null;else V+=Q(F,0,B),this.head=U,U.data=Q(F,B);break}++w}while((U=U.next)!==null);return this.length-=w,V}_getBuffer(B){let V=G.allocUnsafe(B),U=B,w=this.head,F=0;do{let M=w.data;if(B>M.length)J(V,M,U-B),B-=M.length;else{if(B===M.length)if(J(V,M,U-B),++F,w.next)this.head=w.next;else this.head=this.tail=null;else J(V,new Z(M.buffer,M.byteOffset,B),U-B),this.head=w,w.data=M.slice(B);break}++F}while((w=w.next)!==null);return this.length-=F,V}[Symbol.for("nodejs.util.inspect.custom")](B,V){return W(this,{...V,depth:0,customInspect:!1})}}}),v8=g0(($,q)=>{var{MathFloor:Q,NumberIsInteger:K}=P0(),{validateInteger:J}=P6(),{ERR_INVALID_ARG_VALUE:Z}=a0().codes,G=16384,W=16;function B(F,M,k){return F.highWaterMark!=null?F.highWaterMark:M?F[k]:null}function V(F){return F?W:G}function U(F,M){if(J(M,"value",0),F)W=M;else G=M}function w(F,M,k,f){let L=B(M,f,k);if(L!=null){if(!K(L)||L<0){let D=f?`options.${k}`:"options.highWaterMark";throw new Z(D,L)}return Q(L)}return V(F.objectMode)}q.exports={getHighWaterMark:w,getDefaultHighWaterMark:V,setDefaultHighWaterMark:U}}),AV=g0(($,q)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),XV=g0(($)=>{var q=AV().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),a9=g0(($,q)=>{var Q=D1(),{PromisePrototypeThen:K,SymbolAsyncIterator:J,SymbolIterator:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{ERR_INVALID_ARG_TYPE:W,ERR_STREAM_NULL_VALUES:B}=a0().codes;function V(U,w,F){let M;if(typeof w==="string"||w instanceof G)return new U({objectMode:!0,...F,read(){this.push(w),this.push(null)}});let k;if(w&&w[J])k=!0,M=w[J]();else if(w&&w[Z])k=!1,M=w[Z]();else throw new W("iterable",["Iterable"],w);let f=new U({objectMode:!0,highWaterMark:1,...F}),L=!1;f._read=function(){if(!L)L=!0,z()},f._destroy=function(N,H){K(D(N),()=>Q.nextTick(H,N),(v)=>Q.nextTick(H,v||N))};async function D(N){let H=N!==void 0&&N!==null,v=typeof M.throw==="function";if(H&&v){let{value:j,done:n}=await M.throw(N);if(await j,n)return}if(typeof M.return==="function"){let{value:j}=await M.return();await j}}async function z(){for(;;){try{let{value:N,done:H}=k?await M.next():M.next();if(H)f.push(null);else{let v=N&&typeof N.then==="function"?await N:N;if(v===null)throw L=!1,new B;else if(f.push(v))continue;else L=!1}}catch(N){f.destroy(N)}break}}return f}q.exports=V}),f8=g0(($,q)=>{var Q=D1(),{ArrayPrototypeIndexOf:K,NumberIsInteger:J,NumberIsNaN:Z,NumberParseInt:G,ObjectDefineProperties:W,ObjectKeys:B,ObjectSetPrototypeOf:V,Promise:U,SafeSet:w,SymbolAsyncDispose:F,SymbolAsyncIterator:M,Symbol:k}=P0();q.exports=Q0,Q0.ReadableState=G0;var{EventEmitter:f}=(i1(),X0(p1)),{Stream:L,prependListener:D}=b5(),{Buffer:z}=(t0(),X0(K2)),{addAbortSignal:N}=H8(),H=s2(),v=e0().debuglog("stream",(I)=>{v=I}),j=gV(),n=o1(),{getHighWaterMark:d,getDefaultHighWaterMark:_}=v8(),{aggregateTwoErrors:X,codes:{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:g,ERR_OUT_OF_RANGE:c,ERR_STREAM_PUSH_AFTER_EOF:h,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:x},AbortError:l}=a0(),{validateObject:$0}=P6(),Z0=k("kPaused"),{StringDecoder:F0}=XV(),p=a9();V(Q0.prototype,L.prototype),V(Q0,L);var W0=()=>{},{errorOrDestroy:y}=n,i=1,U0=2,m=4,V0=8,w0=16,S=32,b=64,O=128,E=256,a=512,K0=1024,R=2048,Y=4096,C=8192,u=16384,e=32768,r=65536,s=131072,T=262144;function t(I){return{enumerable:!1,get(){return(this.state&I)!==0},set(A){if(A)this.state|=I;else this.state&=~I}}}W(G0.prototype,{objectMode:t(i),ended:t(U0),endEmitted:t(m),reading:t(V0),constructed:t(w0),sync:t(S),needReadable:t(b),emittedReadable:t(O),readableListening:t(E),resumeScheduled:t(a),errorEmitted:t(K0),emitClose:t(R),autoDestroy:t(Y),destroyed:t(C),closed:t(u),closeEmitted:t(e),multiAwaitDrain:t(r),readingMore:t(s),dataEmitted:t(T)});function G0(I,A,J0){if(typeof J0!=="boolean")J0=A instanceof c2();if(this.state=R|Y|w0|S,I&&I.objectMode)this.state|=i;if(J0&&I&&I.readableObjectMode)this.state|=i;if(this.highWaterMark=I?d(this,I,"readableHighWaterMark",J0):_(!1),this.buffer=new j,this.length=0,this.pipes=[],this.flowing=null,this[Z0]=null,I&&I.emitClose===!1)this.state&=~R;if(I&&I.autoDestroy===!1)this.state&=~Y;if(this.errored=null,this.defaultEncoding=I&&I.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,I&&I.encoding)this.decoder=new F0(I.encoding),this.encoding=I.encoding}function Q0(I){if(!(this instanceof Q0))return new Q0(I);let A=this instanceof c2();if(this._readableState=new G0(I,this,A),I){if(typeof I.read==="function")this._read=I.read;if(typeof I.destroy==="function")this._destroy=I.destroy;if(typeof I.construct==="function")this._construct=I.construct;if(I.signal&&!A)N(I.signal,this)}L.call(this,I),n.construct(this,()=>{if(this._readableState.needReadable)_1(this,this._readableState)})}Q0.prototype.destroy=n.destroy,Q0.prototype._undestroy=n.undestroy,Q0.prototype._destroy=function(I,A){A(I)},Q0.prototype[f.captureRejectionSymbol]=function(I){this.destroy(I)},Q0.prototype[F]=function(){let I;if(!this.destroyed)I=this.readableEnded?null:new l,this.destroy(I);return new U((A,J0)=>H(this,(B0)=>B0&&B0!==I?J0(B0):A(null)))},Q0.prototype.push=function(I,A){return M0(this,I,A,!1)},Q0.prototype.unshift=function(I,A){return M0(this,I,A,!0)};function M0(I,A,J0,B0){v("readableAddChunk",A);let z0=I._readableState,i0;if((z0.state&i)===0){if(typeof A==="string"){if(J0=J0||z0.defaultEncoding,z0.encoding!==J0)if(B0&&z0.encoding)A=z.from(A,J0).toString(z0.encoding);else A=z.from(A,J0),J0=""}else if(A instanceof z)J0="";else if(L._isUint8Array(A))A=L._uint8ArrayToBuffer(A),J0="";else if(A!=null)i0=new P("chunk",["string","Buffer","Uint8Array"],A)}if(i0)y(I,i0);else if(A===null)z0.state&=~V0,O0(I,z0);else if((z0.state&i)!==0||A&&A.length>0)if(B0)if((z0.state&m)!==0)y(I,new x);else if(z0.destroyed||z0.errored)return!1;else I0(I,z0,A,!0);else if(z0.ended)y(I,new h);else if(z0.destroyed||z0.errored)return!1;else if(z0.state&=~V0,z0.decoder&&!J0)if(A=z0.decoder.write(A),z0.objectMode||A.length!==0)I0(I,z0,A,!1);else _1(I,z0);else I0(I,z0,A,!1);else if(!B0)z0.state&=~V0,_1(I,z0);return!z0.ended&&(z0.length0){if((A.state&r)!==0)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;A.dataEmitted=!0,I.emit("data",J0)}else{if(A.length+=A.objectMode?1:J0.length,B0)A.buffer.unshift(J0);else A.buffer.push(J0);if((A.state&b)!==0)u0(I)}_1(I,A)}Q0.prototype.isPaused=function(){let I=this._readableState;return I[Z0]===!0||I.flowing===!1},Q0.prototype.setEncoding=function(I){let A=new F0(I);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;let J0=this._readableState.buffer,B0="";for(let z0 of J0)B0+=A.write(z0);if(J0.clear(),B0!=="")J0.push(B0);return this._readableState.length=B0.length,this};var m0=1073741824;function p0(I){if(I>m0)throw new c("size","<= 1GiB",I);else I--,I|=I>>>1,I|=I>>>2,I|=I>>>4,I|=I>>>8,I|=I>>>16,I++;return I}function q2(I,A){if(I<=0||A.length===0&&A.ended)return 0;if((A.state&i)!==0)return 1;if(Z(I)){if(A.flowing&&A.length)return A.buffer.first().length;return A.length}if(I<=A.length)return I;return A.ended?A.length:0}Q0.prototype.read=function(I){if(v("read",I),I===void 0)I=NaN;else if(!J(I))I=G(I,10);let A=this._readableState,J0=I;if(I>A.highWaterMark)A.highWaterMark=p0(I);if(I!==0)A.state&=~O;if(I===0&&A.needReadable&&((A.highWaterMark!==0?A.length>=A.highWaterMark:A.length>0)||A.ended)){if(v("read: emitReadable",A.length,A.ended),A.length===0&&A.ended)f5(this);else u0(this);return null}if(I=q2(I,A),I===0&&A.ended){if(A.length===0)f5(this);return null}let B0=(A.state&b)!==0;if(v("need readable",B0),A.length===0||A.length-I0)z0=l7(I,A);else z0=null;if(z0===null)A.needReadable=A.length<=A.highWaterMark,I=0;else if(A.length-=I,A.multiAwaitDrain)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;if(A.length===0){if(!A.ended)A.needReadable=!0;if(J0!==I&&A.ended)f5(this)}if(z0!==null&&!A.errorEmitted&&!A.closeEmitted)A.dataEmitted=!0,this.emit("data",z0);return z0};function O0(I,A){if(v("onEofChunk"),A.ended)return;if(A.decoder){let J0=A.decoder.end();if(J0&&J0.length)A.buffer.push(J0),A.length+=A.objectMode?1:J0.length}if(A.ended=!0,A.sync)u0(I);else A.needReadable=!1,A.emittedReadable=!0,E1(I)}function u0(I){let A=I._readableState;if(v("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,!A.emittedReadable)v("emitReadable",A.flowing),A.emittedReadable=!0,Q.nextTick(E1,I)}function E1(I){let A=I._readableState;if(v("emitReadable_",A.destroyed,A.length,A.ended),!A.destroyed&&!A.errored&&(A.length||A.ended))I.emit("readable"),A.emittedReadable=!1;A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,o7(I)}function _1(I,A){if(!A.readingMore&&A.constructed)A.readingMore=!0,Q.nextTick(R2,I,A)}function R2(I,A){while(!A.reading&&!A.ended&&(A.length1&&B0.pipes.includes(I))v("false write response, pause",B0.awaitDrainWriters.size),B0.awaitDrainWriters.add(I);J0.pause()}if(!z1)z1=wJ(J0,I),I.on("drain",z1)}J0.on("data",e7);function e7(F1){v("ondata");let u2=I.write(F1);if(v("dest.write",u2),u2===!1)t7()}function I5(F1){if(v("onerror",F1),A6(),I.removeListener("error",I5),I.listenerCount("error")===0){let u2=I._writableState||I._readableState;if(u2&&!u2.errorEmitted)y(I,F1);else I.emit("error",F1)}}D(I,"error",I5);function C5(){I.removeListener("finish",j5),A6()}I.once("close",C5);function j5(){v("onfinish"),I.removeListener("close",C5),A6()}I.once("finish",j5);function A6(){v("unpipe"),J0.unpipe(I)}if(I.emit("pipe",J0),I.writableNeedDrain===!0)t7();else if(!B0.flowing)v("pipe resume"),J0.resume();return I};function wJ(I,A){return function(){let J0=I._readableState;if(J0.awaitDrainWriters===A)v("pipeOnDrain",1),J0.awaitDrainWriters=null;else if(J0.multiAwaitDrain)v("pipeOnDrain",J0.awaitDrainWriters.size),J0.awaitDrainWriters.delete(A);if((!J0.awaitDrainWriters||J0.awaitDrainWriters.size===0)&&I.listenerCount("data"))I.resume()}}Q0.prototype.unpipe=function(I){let A=this._readableState,J0={hasUnpiped:!1};if(A.pipes.length===0)return this;if(!I){let z0=A.pipes;A.pipes=[],this.pause();for(let i0=0;i00,B0.flowing!==!1)this.resume()}else if(I==="readable"){if(!B0.endEmitted&&!B0.readableListening){if(B0.readableListening=B0.needReadable=!0,B0.flowing=!1,B0.emittedReadable=!1,v("on readable",B0.length,B0.reading),B0.length)u0(this);else if(!B0.reading)Q.nextTick(NJ,this)}}return J0},Q0.prototype.addListener=Q0.prototype.on,Q0.prototype.removeListener=function(I,A){let J0=L.prototype.removeListener.call(this,I,A);if(I==="readable")Q.nextTick(i7,this);return J0},Q0.prototype.off=Q0.prototype.removeListener,Q0.prototype.removeAllListeners=function(I){let A=L.prototype.removeAllListeners.apply(this,arguments);if(I==="readable"||I===void 0)Q.nextTick(i7,this);return A};function i7(I){let A=I._readableState;if(A.readableListening=I.listenerCount("readable")>0,A.resumeScheduled&&A[Z0]===!1)A.flowing=!0;else if(I.listenerCount("data")>0)I.resume();else if(!A.readableListening)A.flowing=null}function NJ(I){v("readable nexttick read 0"),I.read(0)}Q0.prototype.resume=function(){let I=this._readableState;if(!I.flowing)v("resume"),I.flowing=!I.readableListening,YJ(this,I);return I[Z0]=!1,this};function YJ(I,A){if(!A.resumeScheduled)A.resumeScheduled=!0,Q.nextTick(kJ,I,A)}function kJ(I,A){if(v("resume",A.reading),!A.reading)I.read(0);if(A.resumeScheduled=!1,I.emit("resume"),o7(I),A.flowing&&!A.reading)I.read(0)}Q0.prototype.pause=function(){if(v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)v("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[Z0]=!0,this};function o7(I){let A=I._readableState;v("flow",A.flowing);while(A.flowing&&I.read()!==null);}Q0.prototype.wrap=function(I){let A=!1;I.on("data",(B0)=>{if(!this.push(B0)&&I.pause)A=!0,I.pause()}),I.on("end",()=>{this.push(null)}),I.on("error",(B0)=>{y(this,B0)}),I.on("close",()=>{this.destroy()}),I.on("destroy",()=>{this.destroy()}),this._read=()=>{if(A&&I.resume)A=!1,I.resume()};let J0=B(I);for(let B0=1;B0{z0=z2?X(z0,z2):null,J0(),J0=W0});try{while(!0){let z2=I.destroyed?null:I.read();if(z2!==null)yield z2;else if(z0)throw z0;else if(z0===null)return;else await new U(B0)}}catch(z2){throw z0=X(z0,z2),z0}finally{if((z0||(A===null||A===void 0?void 0:A.destroyOnReturn)!==!1)&&(z0===void 0||I._readableState.autoDestroy))n.destroyer(I,null);else I.off("readable",B0),i0()}}W(Q0.prototype,{readable:{__proto__:null,get(){let I=this._readableState;return!!I&&I.readable!==!1&&!I.destroyed&&!I.errorEmitted&&!I.endEmitted},set(I){if(this._readableState)this._readableState.readable=!!I}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(I){if(this._readableState)this._readableState.flowing=I}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(I){if(!this._readableState)return;this._readableState.destroyed=I}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),W(G0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Z0]!==!1},set(I){this[Z0]=!!I}}}),Q0._fromList=l7;function l7(I,A){if(A.length===0)return null;let J0;if(A.objectMode)J0=A.buffer.shift();else if(!I||I>=A.length){if(A.decoder)J0=A.buffer.join("");else if(A.buffer.length===1)J0=A.buffer.first();else J0=A.buffer.concat(A.length);A.buffer.clear()}else J0=A.buffer.consume(I,A.decoder);return J0}function f5(I){let A=I._readableState;if(v("endReadable",A.endEmitted),!A.endEmitted)A.ended=!0,Q.nextTick(LJ,A,I)}function LJ(I,A){if(v("endReadableNT",I.endEmitted,I.length),!I.errored&&!I.closeEmitted&&!I.endEmitted&&I.length===0){if(I.endEmitted=!0,A.emit("end"),A.writable&&A.allowHalfOpen===!1)Q.nextTick(HJ,A);else if(I.autoDestroy){let J0=A._writableState;if(!J0||J0.autoDestroy&&(J0.finished||J0.writable===!1))A.destroy()}}}function HJ(I){if(I.writable&&!I.writableEnded&&!I.destroyed)I.end()}Q0.from=function(I,A){return p(Q0,I,A)};var R5;function r7(){if(R5===void 0)R5={};return R5}Q0.fromWeb=function(I,A){return r7().newStreamReadableFromReadableStream(I,A)},Q0.toWeb=function(I,A){return r7().newReadableStreamFromStreamReadable(I,A)},Q0.wrap=function(I,A){var J0,B0;return new Q0({objectMode:(J0=(B0=I.readableObjectMode)!==null&&B0!==void 0?B0:I.objectMode)!==null&&J0!==void 0?J0:!0,...A,destroy(z0,i0){n.destroyer(I,z0),i0(z0)}}).wrap(I)}}),n5=g0(($,q)=>{var Q=D1(),{ArrayPrototypeSlice:K,Error:J,FunctionPrototypeSymbolHasInstance:Z,ObjectDefineProperty:G,ObjectDefineProperties:W,ObjectSetPrototypeOf:B,StringPrototypeToLowerCase:V,Symbol:U,SymbolHasInstance:w}=P0();q.exports=$0,$0.WritableState=x;var{EventEmitter:F}=(i1(),X0(p1)),M=b5().Stream,{Buffer:k}=(t0(),X0(K2)),f=o1(),{addAbortSignal:L}=H8(),{getHighWaterMark:D,getDefaultHighWaterMark:z}=v8(),{ERR_INVALID_ARG_TYPE:N,ERR_METHOD_NOT_IMPLEMENTED:H,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:j,ERR_STREAM_DESTROYED:n,ERR_STREAM_ALREADY_FINISHED:d,ERR_STREAM_NULL_VALUES:_,ERR_STREAM_WRITE_AFTER_END:X,ERR_UNKNOWN_ENCODING:P}=a0().codes,{errorOrDestroy:g}=f;B($0.prototype,M.prototype),B($0,M);function c(){}var h=U("kOnFinished");function x(Y,C,u){if(typeof u!=="boolean")u=C instanceof c2();if(this.objectMode=!!(Y&&Y.objectMode),u)this.objectMode=this.objectMode||!!(Y&&Y.writableObjectMode);this.highWaterMark=Y?D(this,Y,"writableHighWaterMark",u):z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let e=!!(Y&&Y.decodeStrings===!1);this.decodeStrings=!e,this.defaultEncoding=Y&&Y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=y.bind(void 0,C),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,l(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!Y||Y.emitClose!==!1,this.autoDestroy=!Y||Y.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[h]=[]}function l(Y){Y.buffered=[],Y.bufferedIndex=0,Y.allBuffers=!0,Y.allNoop=!0}x.prototype.getBuffer=function(){return K(this.buffered,this.bufferedIndex)},G(x.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function $0(Y){let C=this instanceof c2();if(!C&&!Z($0,this))return new $0(Y);if(this._writableState=new x(Y,this,C),Y){if(typeof Y.write==="function")this._write=Y.write;if(typeof Y.writev==="function")this._writev=Y.writev;if(typeof Y.destroy==="function")this._destroy=Y.destroy;if(typeof Y.final==="function")this._final=Y.final;if(typeof Y.construct==="function")this._construct=Y.construct;if(Y.signal)L(Y.signal,this)}M.call(this,Y),f.construct(this,()=>{let u=this._writableState;if(!u.writing)V0(this,u);O(this,u)})}G($0,w,{__proto__:null,value:function(Y){if(Z(this,Y))return!0;if(this!==$0)return!1;return Y&&Y._writableState instanceof x}}),$0.prototype.pipe=function(){g(this,new j)};function Z0(Y,C,u,e){let r=Y._writableState;if(typeof u==="function")e=u,u=r.defaultEncoding;else{if(!u)u=r.defaultEncoding;else if(u!=="buffer"&&!k.isEncoding(u))throw new P(u);if(typeof e!=="function")e=c}if(C===null)throw new _;else if(!r.objectMode)if(typeof C==="string"){if(r.decodeStrings!==!1)C=k.from(C,u),u="buffer"}else if(C instanceof k)u="buffer";else if(M._isUint8Array(C))C=M._uint8ArrayToBuffer(C),u="buffer";else throw new N("chunk",["string","Buffer","Uint8Array"],C);let s;if(r.ending)s=new X;else if(r.destroyed)s=new n("write");if(s)return Q.nextTick(e,s),g(Y,s,!0),s;return r.pendingcb++,F0(Y,r,C,u,e)}$0.prototype.write=function(Y,C,u){return Z0(this,Y,C,u)===!0},$0.prototype.cork=function(){this._writableState.corked++},$0.prototype.uncork=function(){let Y=this._writableState;if(Y.corked){if(Y.corked--,!Y.writing)V0(this,Y)}},$0.prototype.setDefaultEncoding=function(Y){if(typeof Y==="string")Y=V(Y);if(!k.isEncoding(Y))throw new P(Y);return this._writableState.defaultEncoding=Y,this};function F0(Y,C,u,e,r){let s=C.objectMode?1:u.length;C.length+=s;let T=C.lengthu.bufferedIndex)V0(Y,u);if(e)if(u.afterWriteTickInfo!==null&&u.afterWriteTickInfo.cb===r)u.afterWriteTickInfo.count++;else u.afterWriteTickInfo={count:1,cb:r,stream:Y,state:u},Q.nextTick(i,u.afterWriteTickInfo);else U0(Y,u,1,r)}}function i({stream:Y,state:C,count:u,cb:e}){return C.afterWriteTickInfo=null,U0(Y,C,u,e)}function U0(Y,C,u,e){if(!C.ending&&!Y.destroyed&&C.length===0&&C.needDrain)C.needDrain=!1,Y.emit("drain");while(u-- >0)C.pendingcb--,e();if(C.destroyed)m(C);O(Y,C)}function m(Y){if(Y.writing)return;for(let r=Y.bufferedIndex;r1&&Y._writev){C.pendingcb-=s-1;let t=C.allNoop?c:(Q0)=>{for(let M0=T;M0256)u.splice(0,T),C.bufferedIndex=0;else C.bufferedIndex=T}C.bufferProcessing=!1}$0.prototype._write=function(Y,C,u){if(this._writev)this._writev([{chunk:Y,encoding:C}],u);else throw new H("_write()")},$0.prototype._writev=null,$0.prototype.end=function(Y,C,u){let e=this._writableState;if(typeof Y==="function")u=Y,Y=null,C=null;else if(typeof C==="function")u=C,C=null;let r;if(Y!==null&&Y!==void 0){let s=Z0(this,Y,C);if(s instanceof J)r=s}if(e.corked)e.corked=1,this.uncork();if(r);else if(!e.errored&&!e.ending)e.ending=!0,O(this,e,!0),e.ended=!0;else if(e.finished)r=new d("end");else if(e.destroyed)r=new n("end");if(typeof u==="function")if(r||e.finished)Q.nextTick(u,r);else e[h].push(u);return this};function w0(Y){return Y.ending&&!Y.destroyed&&Y.constructed&&Y.length===0&&!Y.errored&&Y.buffered.length===0&&!Y.finished&&!Y.writing&&!Y.errorEmitted&&!Y.closeEmitted}function S(Y,C){let u=!1;function e(r){if(u){g(Y,r!==null&&r!==void 0?r:v());return}if(u=!0,C.pendingcb--,r){let s=C[h].splice(0);for(let T=0;T{if(w0(r))E(e,r);else r.pendingcb--},Y,C);else if(w0(C))C.pendingcb++,E(Y,C)}}}function E(Y,C){C.pendingcb--,C.finished=!0;let u=C[h].splice(0);for(let e=0;e{var Q=D1(),K=(t0(),X0(K2)),{isReadable:J,isWritable:Z,isIterable:G,isNodeStream:W,isReadableNodeStream:B,isWritableNodeStream:V,isDuplexNodeStream:U,isReadableStream:w,isWritableStream:F}=b2(),M=s2(),{AbortError:k,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:L}}=a0(),{destroyer:D}=o1(),z=c2(),N=f8(),H=n5(),{createDeferredPromise:v}=e0(),j=a9(),n=globalThis.Blob||K.Blob,d=typeof n<"u"?function(h){return h instanceof n}:function(h){return!1},_=globalThis.AbortController||O6().AbortController,{FunctionPrototypeCall:X}=P0();class P extends z{constructor(h){super(h);if((h===null||h===void 0?void 0:h.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((h===null||h===void 0?void 0:h.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}q.exports=function h(x,l){if(U(x))return x;if(B(x))return c({readable:x});if(V(x))return c({writable:x});if(W(x))return c({writable:!1,readable:!1});if(w(x))return c({readable:N.fromWeb(x)});if(F(x))return c({writable:H.fromWeb(x)});if(typeof x==="function"){let{value:Z0,write:F0,final:p,destroy:W0}=g(x);if(G(Z0))return j(P,Z0,{objectMode:!0,write:F0,final:p,destroy:W0});let y=Z0===null||Z0===void 0?void 0:Z0.then;if(typeof y==="function"){let i,U0=X(y,Z0,(m)=>{if(m!=null)throw new L("nully","body",m)},(m)=>{D(i,m)});return i=new P({objectMode:!0,readable:!1,write:F0,final(m){p(async()=>{try{await U0,Q.nextTick(m,null)}catch(V0){Q.nextTick(m,V0)}})},destroy:W0})}throw new L("Iterable, AsyncIterable or AsyncFunction",l,Z0)}if(d(x))return h(x.arrayBuffer());if(G(x))return j(P,x,{objectMode:!0,writable:!1});if(w(x===null||x===void 0?void 0:x.readable)&&F(x===null||x===void 0?void 0:x.writable))return P.fromWeb(x);if(typeof(x===null||x===void 0?void 0:x.writable)==="object"||typeof(x===null||x===void 0?void 0:x.readable)==="object"){let Z0=x!==null&&x!==void 0&&x.readable?B(x===null||x===void 0?void 0:x.readable)?x===null||x===void 0?void 0:x.readable:h(x.readable):void 0,F0=x!==null&&x!==void 0&&x.writable?V(x===null||x===void 0?void 0:x.writable)?x===null||x===void 0?void 0:x.writable:h(x.writable):void 0;return c({readable:Z0,writable:F0})}let $0=x===null||x===void 0?void 0:x.then;if(typeof $0==="function"){let Z0;return X($0,x,(F0)=>{if(F0!=null)Z0.push(F0);Z0.push(null)},(F0)=>{D(Z0,F0)}),Z0=new P({objectMode:!0,writable:!1,read(){}})}throw new f(l,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],x)};function g(h){let{promise:x,resolve:l}=v(),$0=new _,Z0=$0.signal;return{value:h(async function*(){while(!0){let F0=x;x=null;let{chunk:p,done:W0,cb:y}=await F0;if(Q.nextTick(y),W0)return;if(Z0.aborted)throw new k(void 0,{cause:Z0.reason});({promise:x,resolve:l}=v()),yield p}}(),{signal:Z0}),write(F0,p,W0){let y=l;l=null,y({chunk:F0,done:!1,cb:W0})},final(F0){let p=l;l=null,p({done:!0,cb:F0})},destroy(F0,p){$0.abort(),p(F0)}}}function c(h){let x=h.readable&&typeof h.readable.read!=="function"?N.wrap(h.readable):h.readable,l=h.writable,$0=!!J(x),Z0=!!Z(l),F0,p,W0,y,i;function U0(m){let V0=y;if(y=null,V0)V0(m);else if(m)i.destroy(m)}if(i=new P({readableObjectMode:!!(x!==null&&x!==void 0&&x.readableObjectMode),writableObjectMode:!!(l!==null&&l!==void 0&&l.writableObjectMode),readable:$0,writable:Z0}),Z0)M(l,(m)=>{if(Z0=!1,m)D(x,m);U0(m)}),i._write=function(m,V0,w0){if(l.write(m,V0))w0();else F0=w0},i._final=function(m){l.end(),p=m},l.on("drain",function(){if(F0){let m=F0;F0=null,m()}}),l.on("finish",function(){if(p){let m=p;p=null,m()}});if($0)M(x,(m)=>{if($0=!1,m)D(x,m);U0(m)}),x.on("readable",function(){if(W0){let m=W0;W0=null,m()}}),x.on("end",function(){i.push(null)}),i._read=function(){while(!0){let m=x.read();if(m===null){W0=i._read;return}if(!i.push(m))return}};return i._destroy=function(m,V0){if(!m&&y!==null)m=new k;if(W0=null,F0=null,p=null,y===null)V0(m);else y=V0,D(l,m),D(x,m)},i}}),c2=g0(($,q)=>{var{ObjectDefineProperties:Q,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:J,ObjectSetPrototypeOf:Z}=P0();q.exports=B;var G=f8(),W=n5();Z(B.prototype,G.prototype),Z(B,G);{let F=J(W.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:Q,Symbol:K}=P0();q.exports=B;var{ERR_METHOD_NOT_IMPLEMENTED:J}=a0().codes,Z=c2(),{getHighWaterMark:G}=v8();Q(B.prototype,Z.prototype),Q(B,Z);var W=K("kCallback");function B(w){if(!(this instanceof B))return new B(w);let F=w?G(this,w,"readableHighWaterMark",!0):null;if(F===0)w={...w,highWaterMark:null,readableHighWaterMark:F,writableHighWaterMark:w.writableHighWaterMark||0};if(Z.call(this,w),this._readableState.sync=!1,this[W]=null,w){if(typeof w.transform==="function")this._transform=w.transform;if(typeof w.flush==="function")this._flush=w.flush}this.on("prefinish",U)}function V(w){if(typeof this._flush==="function"&&!this.destroyed)this._flush((F,M)=>{if(F){if(w)w(F);else this.destroy(F);return}if(M!=null)this.push(M);if(this.push(null),w)w()});else if(this.push(null),w)w()}function U(){if(this._final!==V)V.call(this)}B.prototype._final=V,B.prototype._transform=function(w,F,M){throw new J("_transform()")},B.prototype._write=function(w,F,M){let k=this._readableState,f=this._writableState,L=k.length;this._transform(w,F,(D,z)=>{if(D){M(D);return}if(z!=null)this.push(z);if(f.ended||L===k.length||k.length{var{ObjectSetPrototypeOf:Q}=P0();q.exports=J;var K=l9();Q(J.prototype,K.prototype),Q(J,K);function J(Z){if(!(this instanceof J))return new J(Z);K.call(this,Z)}J.prototype._transform=function(Z,G,W){W(null,Z)}}),d5=g0(($,q)=>{var Q=D1(),{ArrayIsArray:K,Promise:J,SymbolAsyncIterator:Z,SymbolDispose:G}=P0(),W=s2(),{once:B}=e0(),V=o1(),U=c2(),{aggregateTwoErrors:w,codes:{ERR_INVALID_ARG_TYPE:F,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:k,ERR_STREAM_DESTROYED:f,ERR_STREAM_PREMATURE_CLOSE:L},AbortError:D}=a0(),{validateFunction:z,validateAbortSignal:N}=P6(),{isIterable:H,isReadable:v,isReadableNodeStream:j,isNodeStream:n,isTransformStream:d,isWebStream:_,isReadableStream:X,isReadableFinished:P}=b2(),g=globalThis.AbortController||O6().AbortController,c,h,x;function l(m,V0,w0){let S=!1;m.on("close",()=>{S=!0});let b=W(m,{readable:V0,writable:w0},(O)=>{S=!O});return{destroy:(O)=>{if(S)return;S=!0,V.destroyer(m,O||new f("pipe"))},cleanup:b}}function $0(m){return z(m[m.length-1],"streams[stream.length - 1]"),m.pop()}function Z0(m){if(H(m))return m;else if(j(m))return F0(m);throw new F("val",["Readable","Iterable","AsyncIterable"],m)}async function*F0(m){if(!h)h=f8();yield*h.prototype[Z].call(m)}async function p(m,V0,w0,{end:S}){let b,O=null,E=(R)=>{if(R)b=R;if(O){let Y=O;O=null,Y()}},a=()=>new J((R,Y)=>{if(b)Y(b);else O=()=>{if(b)Y(b);else R()}});V0.on("drain",E);let K0=W(V0,{readable:!1},E);try{if(V0.writableNeedDrain)await a();for await(let R of m)if(!V0.write(R))await a();if(S)V0.end(),await a();w0()}catch(R){w0(b!==R?w(b,R):R)}finally{K0(),V0.off("drain",E)}}async function W0(m,V0,w0,{end:S}){if(d(V0))V0=V0.writable;let b=V0.getWriter();try{for await(let O of m)await b.ready,b.write(O).catch(()=>{});if(await b.ready,S)await b.close();w0()}catch(O){try{await b.abort(O),w0(O)}catch(E){w0(E)}}}function y(...m){return i(m,B($0(m)))}function i(m,V0,w0){if(m.length===1&&K(m[0]))m=m[0];if(m.length<2)throw new k("streams");let S=new g,b=S.signal,O=w0===null||w0===void 0?void 0:w0.signal,E=[];N(O,"options.signal");function a(){r(new D)}x=x||e0().addAbortListener;let K0;if(O)K0=x(O,a);let R,Y,C=[],u=0;function e(Q0){r(Q0,--u===0)}function r(Q0,M0){var I0;if(Q0&&(!R||R.code==="ERR_STREAM_PREMATURE_CLOSE"))R=Q0;if(!R&&!M0)return;while(C.length)C.shift()(R);if((I0=K0)===null||I0===void 0||I0[G](),S.abort(),M0){if(!R)E.forEach((m0)=>m0());Q.nextTick(V0,R,Y)}}let s;for(let Q0=0;Q00,p0=I0||(w0===null||w0===void 0?void 0:w0.end)!==!1,q2=Q0===m.length-1;if(n(M0)){let O0=function(u0){if(u0&&u0.name!=="AbortError"&&u0.code!=="ERR_STREAM_PREMATURE_CLOSE")e(u0)};var T=O0;if(p0){let{destroy:u0,cleanup:E1}=l(M0,I0,m0);if(C.push(u0),v(M0)&&q2)E.push(E1)}if(M0.on("error",O0),v(M0)&&q2)E.push(()=>{M0.removeListener("error",O0)})}if(Q0===0)if(typeof M0==="function"){if(s=M0({signal:b}),!H(s))throw new M("Iterable, AsyncIterable or Stream","source",s)}else if(H(M0)||j(M0)||d(M0))s=M0;else s=U.from(M0);else if(typeof M0==="function"){if(d(s)){var t;s=Z0((t=s)===null||t===void 0?void 0:t.readable)}else s=Z0(s);if(s=M0(s,{signal:b}),I0){if(!H(s,!0))throw new M("AsyncIterable",`transform[${Q0-1}]`,s)}else{var G0;if(!c)c=r9();let O0=new c({objectMode:!0}),u0=(G0=s)===null||G0===void 0?void 0:G0.then;if(typeof u0==="function")u++,u0.call(s,(R2)=>{if(Y=R2,R2!=null)O0.write(R2);if(p0)O0.end();Q.nextTick(e)},(R2)=>{O0.destroy(R2),Q.nextTick(e,R2)});else if(H(s,!0))u++,p(s,O0,e,{end:p0});else if(X(s)||d(s)){let R2=s.readable||s;u++,p(R2,O0,e,{end:p0})}else throw new M("AsyncIterable or Promise","destination",s);s=O0;let{destroy:E1,cleanup:_1}=l(s,!1,!0);if(C.push(E1),q2)E.push(_1)}}else if(n(M0)){if(j(s)){u+=2;let O0=U0(s,M0,e,{end:p0});if(v(M0)&&q2)E.push(O0)}else if(d(s)||X(s)){let O0=s.readable||s;u++,p(O0,M0,e,{end:p0})}else if(H(s))u++,p(s,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else if(_(M0)){if(j(s))u++,W0(Z0(s),M0,e,{end:p0});else if(X(s)||H(s))u++,W0(s,M0,e,{end:p0});else if(d(s))u++,W0(s.readable,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else s=U.from(M0)}if(b!==null&&b!==void 0&&b.aborted||O!==null&&O!==void 0&&O.aborted)Q.nextTick(a);return s}function U0(m,V0,w0,{end:S}){let b=!1;if(V0.on("close",()=>{if(!b)w0(new L)}),m.pipe(V0,{end:!1}),S){let E=function(){b=!0,V0.end()};var O=E;if(P(m))Q.nextTick(E);else m.once("end",E)}else w0();return W(m,{readable:!0,writable:!1},(E)=>{let a=m._readableState;if(E&&E.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted)m.once("end",w0).once("error",w0);else w0(E)}),W(V0,{readable:!1,writable:!0},w0)}q.exports={pipelineImpl:i,pipeline:y}}),s9=g0(($,q)=>{var{pipeline:Q}=d5(),K=c2(),{destroyer:J}=o1(),{isNodeStream:Z,isReadable:G,isWritable:W,isWebStream:B,isTransformStream:V,isWritableStream:U,isReadableStream:w}=b2(),{AbortError:F,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:k}}=a0(),f=s2();q.exports=function(...L){if(L.length===0)throw new k("streams");if(L.length===1)return K.from(L[0]);let D=[...L];if(typeof L[0]==="function")L[0]=K.from(L[0]);if(typeof L[L.length-1]==="function"){let g=L.length-1;L[g]=K.from(L[g])}for(let g=0;g0&&!(W(L[g])||U(L[g])||V(L[g])))throw new M(`streams[${g}]`,D[g],"must be writable")}let z,N,H,v,j;function n(g){let c=v;if(v=null,c)c(g);else if(g)j.destroy(g);else if(!P&&!X)j.destroy()}let d=L[0],_=Q(L,n),X=!!(W(d)||U(d)||V(d)),P=!!(G(_)||w(_)||V(_));if(j=new K({writableObjectMode:!!(d!==null&&d!==void 0&&d.writableObjectMode),readableObjectMode:!!(_!==null&&_!==void 0&&_.readableObjectMode),writable:X,readable:P}),X){if(Z(d))j._write=function(c,h,x){if(d.write(c,h))x();else z=x},j._final=function(c){d.end(),N=c},d.on("drain",function(){if(z){let c=z;z=null,c()}});else if(B(d)){let c=(V(d)?d.writable:d).getWriter();j._write=async function(h,x,l){try{await c.ready,c.write(h).catch(()=>{}),l()}catch($0){l($0)}},j._final=async function(h){try{await c.ready,c.close().catch(()=>{}),N=h}catch(x){h(x)}}}let g=V(_)?_.readable:_;f(g,()=>{if(N){let c=N;N=null,c()}})}if(P){if(Z(_))_.on("readable",function(){if(H){let g=H;H=null,g()}}),_.on("end",function(){j.push(null)}),j._read=function(){while(!0){let g=_.read();if(g===null){H=j._read;return}if(!j.push(g))return}};else if(B(_)){let g=(V(_)?_.readable:_).getReader();j._read=async function(){while(!0)try{let{value:c,done:h}=await g.read();if(!j.push(c))return;if(h){j.push(null);return}}catch{return}}}}return j._destroy=function(g,c){if(!g&&v!==null)g=new F;if(H=null,z=null,N=null,v===null)c(g);else if(v=c,Z(_))J(_,g)},j}}),hV=g0(($,q)=>{var Q=globalThis.AbortController||O6().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:J,ERR_MISSING_ARGS:Z,ERR_OUT_OF_RANGE:G},AbortError:W}=a0(),{validateAbortSignal:B,validateInteger:V,validateObject:U}=P6(),w=P0().Symbol("kWeak"),F=P0().Symbol("kResistStopPropagation"),{finished:M}=s2(),k=s9(),{addAbortSignalNoValidate:f}=H8(),{isWritable:L,isNodeStream:D}=b2(),{deprecate:z}=e0(),{ArrayPrototypePush:N,Boolean:H,MathFloor:v,Number:j,NumberIsNaN:n,Promise:d,PromiseReject:_,PromiseResolve:X,PromisePrototypeThen:P,Symbol:g}=P0(),c=g("kEmpty"),h=g("kEof");function x(O,E){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");if(D(O)&&!L(O))throw new K("stream",O,"must be writable");let a=k(this,O);if(E!==null&&E!==void 0&&E.signal)f(E.signal,a);return a}function l(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");let a=1;if((E===null||E===void 0?void 0:E.concurrency)!=null)a=v(E.concurrency);let K0=a-1;if((E===null||E===void 0?void 0:E.highWaterMark)!=null)K0=v(E.highWaterMark);return V(a,"options.concurrency",1),V(K0,"options.highWaterMark",0),K0+=a,async function*(){let R=e0().AbortSignalAny([E===null||E===void 0?void 0:E.signal].filter(H)),Y=this,C=[],u={signal:R},e,r,s=!1,T=0;function t(){s=!0,G0()}function G0(){T-=1,Q0()}function Q0(){if(r&&!s&&T=K0||T>=a))await new d((m0)=>{r=m0})}C.push(h)}catch(I0){let m0=_(I0);P(m0,G0,t),C.push(m0)}finally{if(s=!0,e)e(),e=null}}M0();try{while(!0){while(C.length>0){let I0=await C[0];if(I0===h)return;if(R.aborted)throw new W;if(I0!==c)yield I0;C.shift(),Q0()}await new d((I0)=>{e=I0})}}finally{if(s=!0,r)r(),r=null}}.call(this)}function $0(O=void 0){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");return async function*(){let E=0;for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W({cause:O.signal.reason});yield[E++,K0]}}.call(this)}async function Z0(O,E=void 0){for await(let a of y.call(this,O,E))return!0;return!1}async function F0(O,E=void 0){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);return!await Z0.call(this,async(...a)=>{return!await O(...a)},E)}async function p(O,E){for await(let a of y.call(this,O,E))return a;return}async function W0(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){return await O(K0,R),c}for await(let K0 of l.call(this,a,E));}function y(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){if(await O(K0,R))return K0;return c}return l.call(this,a,E)}class i extends Z{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function U0(O,E,a){var K0;if(typeof O!=="function")throw new J("reducer",["Function","AsyncFunction"],O);if(a!=null)U(a,"options");if((a===null||a===void 0?void 0:a.signal)!=null)B(a.signal,"options.signal");let R=arguments.length>1;if(a!==null&&a!==void 0&&(K0=a.signal)!==null&&K0!==void 0&&K0.aborted){let r=new W(void 0,{cause:a.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(r)),r}let Y=new Q,C=Y.signal;if(a!==null&&a!==void 0&&a.signal){let r={once:!0,[w]:this,[F]:!0};a.signal.addEventListener("abort",()=>Y.abort(),r)}let u=!1;try{for await(let r of this){var e;if(u=!0,a!==null&&a!==void 0&&(e=a.signal)!==null&&e!==void 0&&e.aborted)throw new W;if(!R)E=r,R=!0;else E=await O(E,r,{signal:C})}if(!u&&!R)throw new i}finally{Y.abort()}return E}async function m(O){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");let E=[];for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W(void 0,{cause:O.signal.reason});N(E,K0)}return E}function V0(O,E){let a=l.call(this,O,E);return async function*(){for await(let K0 of a)yield*K0}.call(this)}function w0(O){if(O=j(O),n(O))return 0;if(O<0)throw new G("number",">= 0",O);return O}function S(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O--<=0)yield R}}.call(this)}function b(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O-- >0)yield R;if(O<=0)return}}.call(this)}q.exports.streamReturningOperators={asIndexedPairs:z($0,"readable.asIndexedPairs will be removed in a future version."),drop:S,filter:y,flatMap:V0,map:l,take:b,compose:x},q.exports.promiseReturningOperators={every:F0,forEach:W0,reduce:U0,toArray:m,some:Z0,find:p}}),t9=g0(($,q)=>{var{ArrayPrototypePop:Q,Promise:K}=P0(),{isIterable:J,isNodeStream:Z,isWebStream:G}=b2(),{pipelineImpl:W}=d5(),{finished:B}=s2();e9();function V(...U){return new K((w,F)=>{let M,k,f=U[U.length-1];if(f&&typeof f==="object"&&!Z(f)&&!J(f)&&!G(f)){let L=Q(U);M=L.signal,k=L.end}W(U,(L,D)=>{if(L)F(L);else w(D)},{signal:M,end:k})})}q.exports={finished:B,pipeline:V}}),e9=g0(($,q)=>{var{Buffer:Q}=(t0(),X0(K2)),{ObjectDefineProperty:K,ObjectKeys:J,ReflectApply:Z}=P0(),{promisify:{custom:G}}=e0(),{streamReturningOperators:W,promiseReturningOperators:B}=hV(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:V}}=a0(),U=s9(),{setDefaultHighWaterMark:w,getDefaultHighWaterMark:F}=v8(),{pipeline:M}=d5(),{destroyer:k}=o1(),f=s2(),L=t9(),D=b2(),z=q.exports=b5().Stream;z.isDestroyed=D.isDestroyed,z.isDisturbed=D.isDisturbed,z.isErrored=D.isErrored,z.isReadable=D.isReadable,z.isWritable=D.isWritable,z.Readable=f8();for(let H of J(W)){let v=function(...n){if(new.target)throw V();return z.Readable.from(Z(j,this,n))},j=W[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(let H of J(B)){let v=function(...n){if(new.target)throw V();return Z(j,this,n)},j=B[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}z.Writable=n5(),z.Duplex=c2(),z.Transform=l9(),z.PassThrough=r9(),z.pipeline=M;var{addAbortSignal:N}=H8();z.addAbortSignal=N,z.finished=f,z.destroy=k,z.compose=U,z.setDefaultHighWaterMark=w,z.getDefaultHighWaterMark=F,K(z,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return L}}),K(M,G,{__proto__:null,enumerable:!0,get(){return L.pipeline}}),K(f,G,{__proto__:null,enumerable:!0,get(){return L.finished}}),z.Stream=z,z._isUint8Array=function(H){return H instanceof Uint8Array},z._uint8ArrayToBuffer=function(H){return Q.from(H.buffer,H.byteOffset,H.byteLength)}}),xV=g0(($,q)=>{var Q=a1();{let K=e9(),J=t9(),Z=K.Readable.destroy;q.exports=K.Readable,q.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,q.exports._isUint8Array=K._isUint8Array,q.exports.isDisturbed=K.isDisturbed,q.exports.isErrored=K.isErrored,q.exports.isReadable=K.isReadable,q.exports.Readable=K.Readable,q.exports.Writable=K.Writable,q.exports.Duplex=K.Duplex,q.exports.Transform=K.Transform,q.exports.PassThrough=K.PassThrough,q.exports.addAbortSignal=K.addAbortSignal,q.exports.finished=K.finished,q.exports.destroy=K.destroy,q.exports.destroy=Z,q.exports.pipeline=K.pipeline,q.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return J}}),q.exports.Stream=K.Stream}q.exports.default=q.exports});$$.exports=xV()});var m5=N0((Dz,Q$)=>{Q$.exports=a1()});var n2=N0((J2)=>{J2.base64=!0;J2.array=!0;J2.string=!0;J2.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";J2.nodebuffer=typeof Buffer<"u";J2.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")J2.blob=!1;else{R8=new ArrayBuffer(0);try{J2.blob=new Blob([R8],{type:"application/zip"}).size===0}catch($){try{p5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,I8=new p5,I8.append(R8),J2.blob=I8.getBlob("application/zip").size===0}catch(q){J2.blob=!1}}}var R8,p5,I8;try{J2.nodestream=!!m5().Readable}catch($){J2.nodestream=!1}});var o5=N0((i5)=>{var OV=T0(),PV=n2(),A2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i5.encode=function($){var q=[],Q,K,J,Z,G,W,B,V=0,U=$.length,w=U,F=OV.getTypeOf($)!=="string";while(V<$.length){if(w=U-V,!F)Q=$.charCodeAt(V++),K=V>2,G=(Q&3)<<4|K>>4,W=w>1?(K&15)<<2|J>>6:64,B=w>2?J&63:64,q.push(A2.charAt(Z)+A2.charAt(G)+A2.charAt(W)+A2.charAt(B))}return q.join("")};i5.decode=function($){var q,Q,K,J,Z,G,W,B=0,V=0,U="data:";if($.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var w=$.length*3/4;if($.charAt($.length-1)===A2.charAt(64))w--;if($.charAt($.length-2)===A2.charAt(64))w--;if(w%1!==0)throw Error("Invalid base64 input, bad content length.");var F;if(PV.uint8array)F=new Uint8Array(w|0);else F=Array(w|0);while(B<$.length){if(J=A2.indexOf($.charAt(B++)),Z=A2.indexOf($.charAt(B++)),G=A2.indexOf($.charAt(B++)),W=A2.indexOf($.charAt(B++)),q=J<<2|Z>>4,Q=(Z&15)<<4|G>>2,K=(G&3)<<6|W,F[V++]=q,G!==64)F[V++]=Q;if(W!==64)F[V++]=K}return F}});var T6=N0((vz,q$)=>{q$.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var q=new Buffer($);return q.fill(0),q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var V$=N0((fz,J$)=>{var K$=global.MutationObserver||global.WebKitMutationObserver,u6;if(K$)j8=0,a5=new K$(C8),g8=global.document.createTextNode(""),a5.observe(g8,{characterData:!0}),u6=function(){g8.data=j8=++j8%2};else if(!global.setImmediate&&typeof global.MessageChannel<"u")A8=new global.MessageChannel,A8.port1.onmessage=C8,u6=function(){A8.port2.postMessage(0)};else if("document"in global&&"onreadystatechange"in global.document.createElement("script"))u6=function(){var $=global.document.createElement("script");$.onreadystatechange=function(){C8(),$.onreadystatechange=null,$.parentNode.removeChild($),$=null},global.document.documentElement.appendChild($)};else u6=function(){setTimeout(C8,0)};var j8,a5,g8,A8,l5,S6=[];function C8(){l5=!0;var $,q,Q=S6.length;while(Q){q=S6,S6=[],$=-1;while(++${var uV=V$();function l1(){}var o0={},U$=["REJECTED"],r5=["FULFILLED"],Z$=["PENDING"];B$.exports=t2;function t2($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Z$,this.queue=[],this.outcome=void 0,$!==l1)G$(this,$)}t2.prototype.finally=function($){if(typeof $!=="function")return this;var q=this.constructor;return this.then(Q,K);function Q(J){function Z(){return J}return q.resolve($()).then(Z)}function K(J){function Z(){throw J}return q.resolve($()).then(Z)}};t2.prototype.catch=function($){return this.then(null,$)};t2.prototype.then=function($,q){if(typeof $!=="function"&&this.state===r5||typeof q!=="function"&&this.state===U$)return this;var Q=new this.constructor(l1);if(this.state!==Z$){var K=this.state===r5?$:q;s5(Q,K,this.outcome)}else this.queue.push(new E6(Q,$,q));return Q};function E6($,q,Q){if(this.promise=$,typeof q==="function")this.onFulfilled=q,this.callFulfilled=this.otherCallFulfilled;if(typeof Q==="function")this.onRejected=Q,this.callRejected=this.otherCallRejected}E6.prototype.callFulfilled=function($){o0.resolve(this.promise,$)};E6.prototype.otherCallFulfilled=function($){s5(this.promise,this.onFulfilled,$)};E6.prototype.callRejected=function($){o0.reject(this.promise,$)};E6.prototype.otherCallRejected=function($){s5(this.promise,this.onRejected,$)};function s5($,q,Q){uV(function(){var K;try{K=q(Q)}catch(J){return o0.reject($,J)}if(K===$)o0.reject($,TypeError("Cannot resolve promise with itself"));else o0.resolve($,K)})}o0.resolve=function($,q){var Q=W$(SV,q);if(Q.status==="error")return o0.reject($,Q.value);var K=Q.value;if(K)G$($,K);else{$.state=r5,$.outcome=q;var J=-1,Z=$.queue.length;while(++J{var t5=null;if(typeof Promise<"u")t5=Promise;else t5=z$();F$.exports={Promise:t5}});var w$=N0((M$)=>{(function($,q){if($.setImmediate)return;var Q=1,K={},J=!1,Z=$.document,G;function W(z){if(typeof z!=="function")z=Function(""+z);var N=Array(arguments.length-1);for(var H=0;H"u"?typeof global>"u"?M$:global:self)});var T0=N0((_0)=>{var e2=n2(),nV=o5(),s1=T6(),e5=r1();w$();function dV($){var q=null;if(e2.uint8array)q=new Uint8Array($.length);else q=Array($.length);return y8($,q)}_0.newBlob=function($,q){_0.checkSupport("blob");try{return new Blob([$],{type:q})}catch(J){try{var Q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,K=new Q;return K.append($),K.getBlob(q)}catch(Z){throw Error("Bug : can't construct the Blob.")}}};function _6($){return $}function y8($,q){for(var Q=0;Q<$.length;++Q)q[Q]=$.charCodeAt(Q)&255;return q}var X8={stringifyByChunk:function($,q,Q){var K=[],J=0,Z=$.length;if(Z<=Q)return String.fromCharCode.apply(null,$);while(J1)try{return X8.stringifyByChunk($,Q,q)}catch(J){q=Math.floor(q/2)}return X8.stringifyByChar($)}_0.applyFromCharCode=c6;function h8($,q){for(var Q=0;Q<$.length;Q++)q[Q]=$[Q];return q}var $1={};$1.string={string:_6,array:function($){return y8($,Array($.length))},arraybuffer:function($){return $1.string.uint8array($).buffer},uint8array:function($){return y8($,new Uint8Array($.length))},nodebuffer:function($){return y8($,s1.allocBuffer($.length))}};$1.array={string:c6,array:_6,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom($)}};$1.arraybuffer={string:function($){return c6(new Uint8Array($))},array:function($){return h8(new Uint8Array($),Array($.byteLength))},arraybuffer:_6,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom(new Uint8Array($))}};$1.uint8array={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:_6,nodebuffer:function($){return s1.newBufferFrom($)}};$1.nodebuffer={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $1.nodebuffer.uint8array($).buffer},uint8array:function($){return h8($,new Uint8Array($.length))},nodebuffer:_6};_0.transformTo=function($,q){if(!q)q="";if(!$)return q;_0.checkSupport($);var Q=_0.getTypeOf(q),K=$1[Q][$](q);return K};_0.resolve=function($){var q=$.split("/"),Q=[];for(var K=0;K"u")$[Q]=arguments[q][Q];return $};_0.prepareContent=function($,q,Q,K,J){var Z=e5.Promise.resolve(q).then(function(G){var W=e2.blob&&(G instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(G))!==-1);if(W&&typeof FileReader<"u")return new e5.Promise(function(B,V){var U=new FileReader;U.onload=function(w){B(w.target.result)},U.onerror=function(w){V(w.target.error)},U.readAsArrayBuffer(G)});else return G});return Z.then(function(G){var W=_0.getTypeOf(G);if(!W)return e5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(W==="arraybuffer")G=_0.transformTo("uint8array",G);else if(W==="string"){if(J)G=nV.decode(G);else if(Q){if(K!==!0)G=dV(G)}}return G})}});var V2=N0((gz,Y$)=>{function N$($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}N$.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,q){return this._listeners[$].push(q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,q){if(this._listeners[$])for(var Q=0;Q "+$;else return $}};Y$.exports=N$});var e1=N0((Q1)=>{var t1=T0(),L1=n2(),mV=T6(),x8=V2(),b6=Array(256);for(X2=0;X2<256;X2++)b6[X2]=X2>=252?6:X2>=248?5:X2>=240?4:X2>=224?3:X2>=192?2:1;var X2;b6[254]=b6[254]=1;var pV=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q},iV=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+b6[$[Q]]>q?Q:q},oV=function($){var q,Q,K,J,Z=$.length,G=Array(Z*2);for(Q=0,q=0;q4){G[Q++]=65533,q+=J-1;continue}K&=J===2?31:J===3?15:7;while(J>1&&q1){G[Q++]=65533;continue}if(K<65536)G[Q++]=K;else K-=65536,G[Q++]=55296|K>>10&1023,G[Q++]=56320|K&1023}if(G.length!==Q)if(G.subarray)G=G.subarray(0,Q);else G.length=Q;return t1.applyFromCharCode(G)};Q1.utf8encode=function(q){if(L1.nodebuffer)return mV.newBufferFrom(q,"utf-8");return pV(q)};Q1.utf8decode=function(q){if(L1.nodebuffer)return t1.transformTo("nodebuffer",q).toString("utf-8");return q=t1.transformTo(L1.uint8array?"uint8array":"array",q),oV(q)};function O8(){x8.call(this,"utf-8 decode"),this.leftOver=null}t1.inherits(O8,x8);O8.prototype.processChunk=function($){var q=t1.transformTo(L1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(L1.uint8array){var Q=q;q=new Uint8Array(Q.length+this.leftOver.length),q.set(this.leftOver,0),q.set(Q,this.leftOver.length)}else q=this.leftOver.concat(q);this.leftOver=null}var K=iV(q),J=q;if(K!==q.length)if(L1.uint8array)J=q.subarray(0,K),this.leftOver=q.subarray(K,q.length);else J=q.slice(0,K),this.leftOver=q.slice(K,q.length);this.push({data:Q1.utf8decode(J),meta:$.meta})};O8.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:Q1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};Q1.Utf8DecodeWorker=O8;function $4(){x8.call(this,"utf-8 encode")}t1.inherits($4,x8);$4.prototype.processChunk=function($){this.push({data:Q1.utf8encode($.data),meta:$.meta})};Q1.Utf8EncodeWorker=$4});var H$=N0((Xz,L$)=>{var k$=V2(),D$=T0();function Q4($){k$.call(this,"ConvertWorker to "+$),this.destType=$}D$.inherits(Q4,k$);Q4.prototype.processChunk=function($){this.push({data:D$.transformTo(this.destType,$.data),meta:$.meta})};L$.exports=Q4});var R$=N0((yz,f$)=>{var v$=m5().Readable,aV=T0();aV.inherits(q4,v$);function q4($,q,Q){v$.call(this,q),this._helper=$;var K=this;$.on("data",function(J,Z){if(!K.push(J))K._helper.pause();if(Q)Q(Z)}).on("error",function(J){K.emit("error",J)}).on("end",function(){K.push(null)})}q4.prototype._read=function(){this._helper.resume()};f$.exports=q4});var K4=N0((hz,j$)=>{var H1=T0(),lV=H$(),rV=V2(),sV=o5(),tV=n2(),eV=r1(),I$=null;if(tV.nodestream)try{I$=R$()}catch($){}function $U($,q,Q){switch($){case"blob":return H1.newBlob(H1.transformTo("arraybuffer",q),Q);case"base64":return sV.encode(q);default:return H1.transformTo($,q)}}function QU($,q){var Q,K=0,J=null,Z=0;for(Q=0;Q{D2.base64=!1;D2.binary=!1;D2.dir=!1;D2.createFolders=!0;D2.date=null;D2.compression=null;D2.compressionOptions=null;D2.comment=null;D2.unixPermissions=null;D2.dosPermissions=null});var V4=N0((Oz,g$)=>{var P8=T0(),T8=V2(),KU=16384;function $6($){T8.call(this,"DataWorker");var q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(Q){if(q.dataIsReady=!0,q.data=Q,q.max=Q&&Q.length||0,q.type=P8.getTypeOf(Q),!q.isPaused)q._tickAndRepeat()},function(Q){q.error(Q)})}P8.inherits($6,T8);$6.prototype.cleanUp=function(){T8.prototype.cleanUp.call(this),this.data=null};$6.prototype.resume=function(){if(!T8.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,P8.delay(this._tickAndRepeat,[],this);return!0};$6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)P8.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};$6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=KU,q=null,Q=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":q=this.data.substring(this.index,Q);break;case"uint8array":q=this.data.subarray(this.index,Q);break;case"array":case"nodebuffer":q=this.data.slice(this.index,Q);break}return this.index=Q,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})}};g$.exports=$6});var u8=N0((Pz,X$)=>{var JU=T0();function VU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var A$=VU();function UU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}function ZU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q.charCodeAt(G))&255];return $^-1}X$.exports=function(q,Q){if(typeof q>"u"||!q.length)return 0;var K=JU.getTypeOf(q)!=="string";if(K)return UU(Q|0,q,q.length,0);else return ZU(Q|0,q,q.length,0)}});var Z4=N0((Tz,h$)=>{var y$=V2(),GU=u8(),WU=T0();function U4(){y$.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}WU.inherits(U4,y$);U4.prototype.processChunk=function($){this.streamInfo.crc32=GU($.data,this.streamInfo.crc32||0),this.push($)};h$.exports=U4});var O$=N0((uz,x$)=>{var BU=T0(),G4=V2();function W4($){G4.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}BU.inherits(W4,G4);W4.prototype.processChunk=function($){if($){var q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=q+$.data.length}G4.prototype.processChunk.call(this,$)};x$.exports=W4});var S8=N0((Sz,u$)=>{var P$=r1(),T$=V4(),zU=Z4(),B4=O$();function z4($,q,Q,K,J){this.compressedSize=$,this.uncompressedSize=q,this.crc32=Q,this.compression=K,this.compressedContent=J}z4.prototype={getContentWorker:function(){var $=new T$(P$.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new B4("data_length")),q=this;return $.on("end",function(){if(this.streamInfo.data_length!==q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new T$(P$.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};z4.createWorkerFrom=function($,q,Q){return $.pipe(new zU).pipe(new B4("uncompressedSize")).pipe(q.compressWorker(Q)).pipe(new B4("compressedSize")).withStreamInfo("compression",q)};u$.exports=z4});var c$=N0((Ez,_$)=>{var FU=K4(),MU=V4(),F4=e1(),M4=S8(),S$=V2(),w4=function($,q,Q){this.name=$,this.dir=Q.dir,this.date=Q.date,this.comment=Q.comment,this.unixPermissions=Q.unixPermissions,this.dosPermissions=Q.dosPermissions,this._data=q,this._dataBinary=Q.binary,this.options={compression:Q.compression,compressionOptions:Q.compressionOptions}};w4.prototype={internalStream:function($){var q=null,Q="string";try{if(!$)throw Error("No output type specified.");Q=$.toLowerCase();var K=Q==="string"||Q==="text";if(Q==="binarystring"||Q==="text")Q="string";q=this._decompressWorker();var J=!this._dataBinary;if(J&&!K)q=q.pipe(new F4.Utf8EncodeWorker);if(!J&&K)q=q.pipe(new F4.Utf8DecodeWorker)}catch(Z){q=new S$("error"),q.error(Z)}return new FU(q,Q,"")},async:function($,q){return this.internalStream($).accumulate(q)},nodeStream:function($,q){return this.internalStream($||"nodebuffer").toNodejsStream(q)},_compressWorker:function($,q){if(this._data instanceof M4&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var Q=this._decompressWorker();if(!this._dataBinary)Q=Q.pipe(new F4.Utf8EncodeWorker);return M4.createWorkerFrom(Q,$,q)}},_decompressWorker:function(){if(this._data instanceof M4)return this._data.getContentWorker();else if(this._data instanceof S$)return this._data;else return new MU(this._data)}};var E$=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],wU=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(n6=0;n6{var NU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function YU($,q){return Object.prototype.hasOwnProperty.call($,q)}l0.assign=function($){var q=Array.prototype.slice.call(arguments,1);while(q.length){var Q=q.shift();if(!Q)continue;if(typeof Q!=="object")throw TypeError(Q+"must be non-object");for(var K in Q)if(YU(Q,K))$[K]=Q[K]}return $};l0.shrinkBuf=function($,q){if($.length===q)return $;if($.subarray)return $.subarray(0,q);return $.length=q,$};var kU={arraySet:function($,q,Q,K,J){if(q.subarray&&$.subarray){$.set(q.subarray(Q,Q+K),J);return}for(var Z=0;Z{var LU=d2(),HU=4,b$=0,n$=1,vU=2;function q6($){var q=$.length;while(--q>=0)$[q]=0}var fU=0,a$=1,RU=2,IU=3,CU=258,v4=29,a6=256,m6=a6+1+v4,Q6=30,f4=19,l$=2*m6+1,v1=15,N4=16,jU=7,R4=256,r$=16,s$=17,t$=18,L4=[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],E8=[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],gU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],AU=512,m2=Array((m6+2)*2);q6(m2);var d6=Array(Q6*2);q6(d6);var p6=Array(AU);q6(p6);var i6=Array(CU-IU+1);q6(i6);var I4=Array(v4);q6(I4);var _8=Array(Q6);q6(_8);function Y4($,q,Q,K,J){this.static_tree=$,this.extra_bits=q,this.extra_base=Q,this.elems=K,this.max_length=J,this.has_stree=$&&$.length}var $Q,QQ,qQ;function k4($,q){this.dyn_tree=$,this.max_code=0,this.stat_desc=q}function KQ($){return $<256?p6[$]:p6[256+($>>>7)]}function o6($,q){$.pending_buf[$.pending++]=q&255,$.pending_buf[$.pending++]=q>>>8&255}function $2($,q,Q){if($.bi_valid>N4-Q)$.bi_buf|=q<<$.bi_valid&65535,o6($,$.bi_buf),$.bi_buf=q>>N4-$.bi_valid,$.bi_valid+=Q-N4;else $.bi_buf|=q<<$.bi_valid&65535,$.bi_valid+=Q}function y2($,q,Q){$2($,Q[q*2],Q[q*2+1])}function JQ($,q){var Q=0;do Q|=$&1,$>>>=1,Q<<=1;while(--q>0);return Q>>>1}function XU($){if($.bi_valid===16)o6($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function yU($,q){var{dyn_tree:Q,max_code:K}=q,J=q.stat_desc.static_tree,Z=q.stat_desc.has_stree,G=q.stat_desc.extra_bits,W=q.stat_desc.extra_base,B=q.stat_desc.max_length,V,U,w,F,M,k,f=0;for(F=0;F<=v1;F++)$.bl_count[F]=0;Q[$.heap[$.heap_max]*2+1]=0;for(V=$.heap_max+1;VB)F=B,f++;if(Q[U*2+1]=F,U>K)continue;if($.bl_count[F]++,M=0,U>=W)M=G[U-W];if(k=Q[U*2],$.opt_len+=k*(F+M),Z)$.static_len+=k*(J[U*2+1]+M)}if(f===0)return;do{F=B-1;while($.bl_count[F]===0)F--;$.bl_count[F]--,$.bl_count[F+1]+=2,$.bl_count[B]--,f-=2}while(f>0);for(F=B;F!==0;F--){U=$.bl_count[F];while(U!==0){if(w=$.heap[--V],w>K)continue;if(Q[w*2+1]!==F)$.opt_len+=(F-Q[w*2+1])*Q[w*2],Q[w*2+1]=F;U--}}}function VQ($,q,Q){var K=Array(v1+1),J=0,Z,G;for(Z=1;Z<=v1;Z++)K[Z]=J=J+Q[Z-1]<<1;for(G=0;G<=q;G++){var W=$[G*2+1];if(W===0)continue;$[G*2]=JQ(K[W]++,W)}}function hU(){var $,q,Q,K,J,Z=Array(v1+1);Q=0;for(K=0;K>=7;for(;K8)o6($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function xU($,q,Q,K){if(ZQ($),K)o6($,Q),o6($,~Q);LU.arraySet($.pending_buf,$.window,q,Q,$.pending),$.pending+=Q}function d$($,q,Q,K){var J=q*2,Z=Q*2;return $[J]<$[Z]||$[J]===$[Z]&&K[q]<=K[Q]}function D4($,q,Q){var K=$.heap[Q],J=Q<<1;while(J<=$.heap_len){if(J<$.heap_len&&d$(q,$.heap[J+1],$.heap[J],$.depth))J++;if(d$(q,K,$.heap[J],$.depth))break;$.heap[Q]=$.heap[J],Q=J,J<<=1}$.heap[Q]=K}function m$($,q,Q){var K,J,Z=0,G,W;if($.last_lit!==0)do if(K=$.pending_buf[$.d_buf+Z*2]<<8|$.pending_buf[$.d_buf+Z*2+1],J=$.pending_buf[$.l_buf+Z],Z++,K===0)y2($,J,q);else{if(G=i6[J],y2($,G+a6+1,q),W=L4[G],W!==0)J-=I4[G],$2($,J,W);if(K--,G=KQ(K),y2($,G,Q),W=E8[G],W!==0)K-=_8[G],$2($,K,W)}while(Z<$.last_lit);y2($,R4,q)}function H4($,q){var Q=q.dyn_tree,K=q.stat_desc.static_tree,J=q.stat_desc.has_stree,Z=q.stat_desc.elems,G,W,B=-1,V;$.heap_len=0,$.heap_max=l$;for(G=0;G>1;G>=1;G--)D4($,Q,G);V=Z;do G=$.heap[1],$.heap[1]=$.heap[$.heap_len--],D4($,Q,1),W=$.heap[1],$.heap[--$.heap_max]=G,$.heap[--$.heap_max]=W,Q[V*2]=Q[G*2]+Q[W*2],$.depth[V]=($.depth[G]>=$.depth[W]?$.depth[G]:$.depth[W])+1,Q[G*2+1]=Q[W*2+1]=V,$.heap[1]=V++,D4($,Q,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],yU($,q),VQ(Q,B,$.bl_count)}function p$($,q,Q){var K,J=-1,Z,G=q[1],W=0,B=7,V=4;if(G===0)B=138,V=3;q[(Q+1)*2+1]=65535;for(K=0;K<=Q;K++){if(Z=G,G=q[(K+1)*2+1],++W=3;q--)if($.bl_tree[e$[q]*2+1]!==0)break;return $.opt_len+=3*(q+1)+5+5+4,q}function PU($,q,Q,K){var J;$2($,q-257,5),$2($,Q-1,5),$2($,K-4,4);for(J=0;J>>=1)if(q&1&&$.dyn_ltree[Q*2]!==0)return b$;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return n$;for(Q=32;Q0){if($.strm.data_type===vU)$.strm.data_type=TU($);if(H4($,$.l_desc),H4($,$.d_desc),G=OU($),J=$.opt_len+3+7>>>3,Z=$.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=Q+5;if(Q+4<=J&&q!==-1)GQ($,q,Q,K);else if($.strategy===HU||Z===J)$2($,(a$<<1)+(K?1:0),3),m$($,m2,d6);else $2($,(RU<<1)+(K?1:0),3),PU($,$.l_desc.max_code+1,$.d_desc.max_code+1,G+1),m$($,$.dyn_ltree,$.dyn_dtree);if(UQ($),K)ZQ($)}function _U($,q,Q){if($.pending_buf[$.d_buf+$.last_lit*2]=q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=q&255,$.pending_buf[$.l_buf+$.last_lit]=Q&255,$.last_lit++,q===0)$.dyn_ltree[Q*2]++;else $.matches++,q--,$.dyn_ltree[(i6[Q]+a6+1)*2]++,$.dyn_dtree[KQ(q)*2]++;return $.last_lit===$.lit_bufsize-1}K6._tr_init=uU;K6._tr_stored_block=GQ;K6._tr_flush_block=EU;K6._tr_tally=_U;K6._tr_align=SU});var C4=N0((bz,BQ)=>{function cU($,q,Q,K){var J=$&65535|0,Z=$>>>16&65535|0,G=0;while(Q!==0){G=Q>2000?2000:Q,Q-=G;do J=J+q[K++]|0,Z=Z+J|0;while(--G);J%=65521,Z%=65521}return J|Z<<16|0}BQ.exports=cU});var j4=N0((nz,zQ)=>{function bU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var nU=bU();function dU($,q,Q,K){var J=nU,Z=K+Q;$^=-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}zQ.exports=dU});var c8=N0((dz,FQ)=>{FQ.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var vQ=N0((O2)=>{var r0=d2(),M2=WQ(),YQ=C4(),q1=j4(),mU=c8(),C1=0,pU=1,iU=3,Z1=4,MQ=5,x2=0,wQ=1,w2=-2,oU=-3,g4=-5,aU=-1,lU=1,b8=2,rU=3,sU=4,tU=0,eU=2,p8=8,$Z=9,QZ=15,qZ=8,KZ=29,JZ=256,X4=JZ+1+KZ,VZ=30,UZ=19,ZZ=2*X4+1,GZ=15,f0=3,V1=258,L2=V1+f0+1,WZ=32,i8=42,y4=69,n8=73,d8=91,m8=103,f1=113,r6=666,c0=1,s6=2,R1=3,U6=4,BZ=3;function U1($,q){return $.msg=mU[q],q}function NQ($){return($<<1)-($>4?9:0)}function J1($){var q=$.length;while(--q>=0)$[q]=0}function K1($){var q=$.state,Q=q.pending;if(Q>$.avail_out)Q=$.avail_out;if(Q===0)return;if(r0.arraySet($.output,q.pending_buf,q.pending_out,Q,$.next_out),$.next_out+=Q,q.pending_out+=Q,$.total_out+=Q,$.avail_out-=Q,q.pending-=Q,q.pending===0)q.pending_out=0}function d0($,q){M2._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,q),$.block_start=$.strstart,K1($.strm)}function C0($,q){$.pending_buf[$.pending++]=q}function l6($,q){$.pending_buf[$.pending++]=q>>>8&255,$.pending_buf[$.pending++]=q&255}function zZ($,q,Q,K){var J=$.avail_in;if(J>K)J=K;if(J===0)return 0;if($.avail_in-=J,r0.arraySet(q,$.input,$.next_in,J,Q),$.state.wrap===1)$.adler=YQ($.adler,q,J,Q);else if($.state.wrap===2)$.adler=q1($.adler,q,J,Q);return $.next_in+=J,$.total_in+=J,J}function kQ($,q){var{max_chain_length:Q,strstart:K}=$,J,Z,G=$.prev_length,W=$.nice_match,B=$.strstart>$.w_size-L2?$.strstart-($.w_size-L2):0,V=$.window,U=$.w_mask,w=$.prev,F=$.strstart+V1,M=V[K+G-1],k=V[K+G];if($.prev_length>=$.good_match)Q>>=2;if(W>$.lookahead)W=$.lookahead;do{if(J=q,V[J+G]!==k||V[J+G-1]!==M||V[J]!==V[K]||V[++J]!==V[K+1])continue;K+=2,J++;do;while(V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&KG){if($.match_start=q,G=Z,Z>=W)break;M=V[K+G-1],k=V[K+G]}}while((q=w[q&U])>B&&--Q!==0);if(G<=$.lookahead)return G;return $.lookahead}function I1($){var q=$.w_size,Q,K,J,Z,G;do{if(Z=$.window_size-$.lookahead-$.strstart,$.strstart>=q+(q-L2)){r0.arraySet($.window,$.window,q,q,0),$.match_start-=q,$.strstart-=q,$.block_start-=q,K=$.hash_size,Q=K;do J=$.head[--Q],$.head[Q]=J>=q?J-q:0;while(--K);K=q,Q=K;do J=$.prev[--Q],$.prev[Q]=J>=q?J-q:0;while(--K);Z+=q}if($.strm.avail_in===0)break;if(K=zZ($.strm,$.window,$.strstart+$.lookahead,Z),$.lookahead+=K,$.lookahead+$.insert>=f0){G=$.strstart-$.insert,$.ins_h=$.window[G],$.ins_h=($.ins_h<<$.hash_shift^$.window[G+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[G+f0-1])&$.hash_mask,$.prev[G&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=G,G++,$.insert--,$.lookahead+$.insert$.pending_buf_size-5)Q=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(I1($),$.lookahead===0&&q===C1)return c0;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var K=$.block_start+Q;if($.strstart===0||$.strstart>=K){if($.lookahead=$.strstart-K,$.strstart=K,d0($,!1),$.strm.avail_out===0)return c0}if($.strstart-$.block_start>=$.w_size-L2){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.strstart>$.block_start){if(d0($,!1),$.strm.avail_out===0)return c0}return c0}function A4($,q){var Q,K;for(;;){if($.lookahead=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(Q!==0&&$.strstart-Q<=$.w_size-L2)$.match_length=kQ($,Q);if($.match_length>=f0)if(K=M2._tr_tally($,$.strstart-$.match_start,$.match_length-f0),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=f0){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else K=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(K){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=$.strstart=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=f0-1,Q!==0&&$.prev_length<$.max_lazy_match&&$.strstart-Q<=$.w_size-L2){if($.match_length=kQ($,Q),$.match_length<=5&&($.strategy===lU||$.match_length===f0&&$.strstart-$.match_start>4096))$.match_length=f0-1}if($.prev_length>=f0&&$.match_length<=$.prev_length){J=$.strstart+$.lookahead-f0,K=M2._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-f0),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=J)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=f0-1,$.strstart++,K){if(d0($,!1),$.strm.avail_out===0)return c0}}else if($.match_available){if(K=M2._tr_tally($,0,$.window[$.strstart-1]),K)d0($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return c0}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)K=M2._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart=f0&&$.strstart>0){if(J=$.strstart-1,K=G[J],K===G[++J]&&K===G[++J]&&K===G[++J]){Z=$.strstart+V1;do;while(K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&J$.lookahead)$.match_length=$.lookahead}}if($.match_length>=f0)Q=M2._tr_tally($,1,$.match_length-f0),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function wZ($,q){var Q;for(;;){if($.lookahead===0){if(I1($),$.lookahead===0){if(q===C1)return c0;break}}if($.match_length=0,Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function h2($,q,Q,K,J){this.good_length=$,this.max_lazy=q,this.nice_length=Q,this.max_chain=K,this.func=J}var V6;V6=[new h2(0,0,0,0,FZ),new h2(4,4,8,4,A4),new h2(4,5,16,8,A4),new h2(4,6,32,32,A4),new h2(4,4,16,16,J6),new h2(8,16,32,32,J6),new h2(8,16,128,128,J6),new h2(8,32,128,256,J6),new h2(32,128,258,1024,J6),new h2(32,258,258,4096,J6)];function NZ($){$.window_size=2*$.w_size,J1($.head),$.max_lazy_match=V6[$.level].max_lazy,$.good_match=V6[$.level].good_length,$.nice_match=V6[$.level].nice_length,$.max_chain_length=V6[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=f0-1,$.match_available=0,$.ins_h=0}function YZ(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=p8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r0.Buf16(ZZ*2),this.dyn_dtree=new r0.Buf16((2*VZ+1)*2),this.bl_tree=new r0.Buf16((2*UZ+1)*2),J1(this.dyn_ltree),J1(this.dyn_dtree),J1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r0.Buf16(GZ+1),this.heap=new r0.Buf16(2*X4+1),J1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r0.Buf16(2*X4+1),J1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function DQ($){var q;if(!$||!$.state)return U1($,w2);if($.total_in=$.total_out=0,$.data_type=eU,q=$.state,q.pending=0,q.pending_out=0,q.wrap<0)q.wrap=-q.wrap;return q.status=q.wrap?i8:f1,$.adler=q.wrap===2?0:1,q.last_flush=C1,M2._tr_init(q),x2}function LQ($){var q=DQ($);if(q===x2)NZ($.state);return q}function kZ($,q){if(!$||!$.state)return w2;if($.state.wrap!==2)return w2;return $.state.gzhead=q,x2}function HQ($,q,Q,K,J,Z){if(!$)return w2;var G=1;if(q===aU)q=6;if(K<0)G=0,K=-K;else if(K>15)G=2,K-=16;if(J<1||J>$Z||Q!==p8||K<8||K>15||q<0||q>9||Z<0||Z>sU)return U1($,w2);if(K===8)K=9;var W=new YZ;return $.state=W,W.strm=$,W.wrap=G,W.gzhead=null,W.w_bits=K,W.w_size=1<MQ||q<0)return $?U1($,w2):w2;if(K=$.state,!$.output||!$.input&&$.avail_in!==0||K.status===r6&&q!==Z1)return U1($,$.avail_out===0?g4:w2);if(K.strm=$,Q=K.last_flush,K.last_flush=q,K.status===i8)if(K.wrap===2)if($.adler=0,C0(K,31),C0(K,139),C0(K,8),!K.gzhead)C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,BZ),K.status=f1;else{if(C0(K,(K.gzhead.text?1:0)+(K.gzhead.hcrc?2:0)+(!K.gzhead.extra?0:4)+(!K.gzhead.name?0:8)+(!K.gzhead.comment?0:16)),C0(K,K.gzhead.time&255),C0(K,K.gzhead.time>>8&255),C0(K,K.gzhead.time>>16&255),C0(K,K.gzhead.time>>24&255),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)C0(K,K.gzhead.extra.length&255),C0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)$.adler=q1($.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=y4}else{var G=p8+(K.w_bits-8<<4)<<8,W=-1;if(K.strategy>=b8||K.level<2)W=0;else if(K.level<6)W=1;else if(K.level===6)W=2;else W=3;if(G|=W<<6,K.strstart!==0)G|=WZ;if(G+=31-G%31,K.status=f1,l6(K,G),K.strstart!==0)l6(K,$.adler>>>16),l6(K,$.adler&65535);$.adler=1}if(K.status===y4)if(K.gzhead.extra){J=K.pending;while(K.gzindex<(K.gzhead.extra.length&65535)){if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size)break}C0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=n8}else K.status=n8;if(K.status===n8)if(K.gzhead.name){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.gzindex=0,K.status=d8}else K.status=d8;if(K.status===d8)if(K.gzhead.comment){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.status=m8}else K.status=m8;if(K.status===m8)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)K1($);if(K.pending+2<=K.pending_buf_size)C0(K,$.adler&255),C0(K,$.adler>>8&255),$.adler=0,K.status=f1}else K.status=f1;if(K.pending!==0){if(K1($),$.avail_out===0)return K.last_flush=-1,x2}else if($.avail_in===0&&NQ(q)<=NQ(Q)&&q!==Z1)return U1($,g4);if(K.status===r6&&$.avail_in!==0)return U1($,g4);if($.avail_in!==0||K.lookahead!==0||q!==C1&&K.status!==r6){var B=K.strategy===b8?wZ(K,q):K.strategy===rU?MZ(K,q):V6[K.level].func(K,q);if(B===R1||B===U6)K.status=r6;if(B===c0||B===R1){if($.avail_out===0)K.last_flush=-1;return x2}if(B===s6){if(q===pU)M2._tr_align(K);else if(q!==MQ){if(M2._tr_stored_block(K,0,0,!1),q===iU){if(J1(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(K1($),$.avail_out===0)return K.last_flush=-1,x2}}if(q!==Z1)return x2;if(K.wrap<=0)return wQ;if(K.wrap===2)C0(K,$.adler&255),C0(K,$.adler>>8&255),C0(K,$.adler>>16&255),C0(K,$.adler>>24&255),C0(K,$.total_in&255),C0(K,$.total_in>>8&255),C0(K,$.total_in>>16&255),C0(K,$.total_in>>24&255);else l6(K,$.adler>>>16),l6(K,$.adler&65535);if(K1($),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?x2:wQ}function HZ($){var q;if(!$||!$.state)return w2;if(q=$.state.status,q!==i8&&q!==y4&&q!==n8&&q!==d8&&q!==m8&&q!==f1&&q!==r6)return U1($,w2);return $.state=null,q===f1?U1($,oU):x2}function vZ($,q){var Q=q.length,K,J,Z,G,W,B,V,U;if(!$||!$.state)return w2;if(K=$.state,G=K.wrap,G===2||G===1&&K.status!==i8||K.lookahead)return w2;if(G===1)$.adler=YQ($.adler,q,Q,0);if(K.wrap=0,Q>=K.w_size){if(G===0)J1(K.head),K.strstart=0,K.block_start=0,K.insert=0;U=new r0.Buf8(K.w_size),r0.arraySet(U,q,Q-K.w_size,K.w_size,0),q=U,Q=K.w_size}W=$.avail_in,B=$.next_in,V=$.input,$.avail_in=Q,$.next_in=0,$.input=q,I1(K);while(K.lookahead>=f0){J=K.strstart,Z=K.lookahead-(f0-1);do K.ins_h=(K.ins_h<{var o8=d2(),fQ=!0,RQ=!0;try{String.fromCharCode.apply(null,[0])}catch($){fQ=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){RQ=!1}var t6=new o8.Buf8(256);for(P2=0;P2<256;P2++)t6[P2]=P2>=252?6:P2>=248?5:P2>=240?4:P2>=224?3:P2>=192?2:1;var P2;t6[254]=t6[254]=1;Z6.string2buf=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q};function IQ($,q){if(q<65534){if($.subarray&&RQ||!$.subarray&&fQ)return String.fromCharCode.apply(null,o8.shrinkBuf($,q))}var Q="";for(var K=0;K4){W[K++]=65533,Q+=Z-1;continue}J&=Z===2?31:Z===3?15:7;while(Z>1&&Q1){W[K++]=65533;continue}if(J<65536)W[K++]=J;else J-=65536,W[K++]=55296|J>>10&1023,W[K++]=56320|J&1023}return IQ(W,K)};Z6.utf8border=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+t6[$[Q]]>q?Q:q}});var x4=N0((iz,CQ)=>{function fZ(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}CQ.exports=fZ});var XQ=N0((Q8)=>{var e6=vQ(),$8=d2(),P4=h4(),T4=c8(),RZ=x4(),AQ=Object.prototype.toString,IZ=0,O4=4,G6=0,jQ=1,gQ=2,CZ=-1,jZ=0,gZ=8;function j1($){if(!(this instanceof j1))return new j1($);this.options=$8.assign({level:CZ,method:gZ,chunkSize:16384,windowBits:15,memLevel:8,strategy:jZ,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>0)q.windowBits=-q.windowBits;else if(q.gzip&&q.windowBits>0&&q.windowBits<16)q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new RZ,this.strm.avail_out=0;var Q=e6.deflateInit2(this.strm,q.level,q.method,q.windowBits,q.memLevel,q.strategy);if(Q!==G6)throw Error(T4[Q]);if(q.header)e6.deflateSetHeader(this.strm,q.header);if(q.dictionary){var K;if(typeof q.dictionary==="string")K=P4.string2buf(q.dictionary);else if(AQ.call(q.dictionary)==="[object ArrayBuffer]")K=new Uint8Array(q.dictionary);else K=q.dictionary;if(Q=e6.deflateSetDictionary(this.strm,K),Q!==G6)throw Error(T4[Q]);this._dict_set=!0}}j1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J,Z;if(this.ended)return!1;if(Z=q===~~q?q:q===!0?O4:IZ,typeof $==="string")Q.input=P4.string2buf($);else if(AQ.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new $8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(J=e6.deflate(Q,Z),J!==jQ&&J!==G6)return this.onEnd(J),this.ended=!0,!1;if(Q.avail_out===0||Q.avail_in===0&&(Z===O4||Z===gQ))if(this.options.to==="string")this.onData(P4.buf2binstring($8.shrinkBuf(Q.output,Q.next_out)));else this.onData($8.shrinkBuf(Q.output,Q.next_out))}while((Q.avail_in>0||Q.avail_out===0)&&J!==jQ);if(Z===O4)return J=e6.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===G6;if(Z===gQ)return this.onEnd(G6),Q.avail_out=0,!0;return!0};j1.prototype.onData=function($){this.chunks.push($)};j1.prototype.onEnd=function($){if($===G6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=$8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function u4($,q){var Q=new j1(q);if(Q.push($,!0),Q.err)throw Q.msg||T4[Q.err];return Q.result}function AZ($,q){return q=q||{},q.raw=!0,u4($,q)}function XZ($,q){return q=q||{},q.gzip=!0,u4($,q)}Q8.Deflate=j1;Q8.deflate=u4;Q8.deflateRaw=AZ;Q8.gzip=XZ});var hQ=N0((az,yQ)=>{var a8=30,yZ=12;yQ.exports=function(q,Q){var K,J,Z,G,W,B,V,U,w,F,M,k,f,L,D,z,N,H,v,j,n,d,_,X,P;K=q.state,J=q.next_in,X=q.input,Z=J+(q.avail_in-5),G=q.next_out,P=q.output,W=G-(Q-q.avail_out),B=G+(q.avail_out-257),V=K.dmax,U=K.wsize,w=K.whave,F=K.wnext,M=K.window,k=K.hold,f=K.bits,L=K.lencode,D=K.distcode,z=(1<>>24,k>>>=v,f-=v,v=H>>>16&255,v===0)P[G++]=H&65535;else if(v&16){if(j=H&65535,v&=15,v){if(f>>=v,f-=v}if(f<15)k+=X[J++]<>>24,k>>>=v,f-=v,v=H>>>16&255,v&16){if(n=H&65535,v&=15,fV){q.msg="invalid distance too far back",K.mode=a8;break $}if(k>>>=v,f-=v,v=G-W,n>v){if(v=n-v,v>w){if(K.sane){q.msg="invalid distance too far back",K.mode=a8;break $}}if(d=0,_=M,F===0){if(d+=U-v,v2)P[G++]=_[d++],P[G++]=_[d++],P[G++]=_[d++],j-=3;if(j){if(P[G++]=_[d++],j>1)P[G++]=_[d++]}}else{d=G-n;do P[G++]=P[d++],P[G++]=P[d++],P[G++]=P[d++],j-=3;while(j>2);if(j){if(P[G++]=P[d++],j>1)P[G++]=P[d++]}}}else if((v&64)===0){H=D[(H&65535)+(k&(1<>3,J-=j,f-=j<<3,k&=(1<{var xQ=d2(),W6=15,OQ=852,PQ=592,TQ=0,S4=1,uQ=2,hZ=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],xZ=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],OZ=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],PZ=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];SQ.exports=function(q,Q,K,J,Z,G,W,B){var V=B.bits,U=0,w=0,F=0,M=0,k=0,f=0,L=0,D=0,z=0,N=0,H,v,j,n,d,_=null,X=0,P,g=new xQ.Buf16(W6+1),c=new xQ.Buf16(W6+1),h=null,x=0,l,$0,Z0;for(U=0;U<=W6;U++)g[U]=0;for(w=0;w=1;M--)if(g[M]!==0)break;if(k>M)k=M;if(M===0)return Z[G++]=20971520,Z[G++]=20971520,B.bits=1,0;for(F=1;F0&&(q===TQ||M!==1))return-1;c[1]=0;for(U=1;UOQ||q===uQ&&z>PQ)return 1;for(;;){if(l=U-L,W[w]P)$0=h[x+W[w]],Z0=_[X+W[w]];else $0=96,Z0=0;H=1<>L)+v]=l<<24|$0<<16|Z0|0;while(v!==0);H=1<>=1;if(H!==0)N&=H-1,N+=H;else N=0;if(w++,--g[U]===0){if(U===M)break;U=Q[K+W[w]]}if(U>k&&(N&n)!==j){if(L===0)L=k;d+=F,f=U-L,D=1<OQ||q===uQ&&z>PQ)return 1;j=N&n,Z[j]=k<<24|f<<16|d-G|0}}if(N!==0)Z[d+N]=U-L<<24|4194304|0;return B.bits=k,0}});var Lq=N0((H2)=>{var U2=d2(),d4=C4(),T2=j4(),TZ=hQ(),q8=EQ(),uZ=0,Bq=1,zq=2,_Q=4,SZ=5,l8=6,g1=0,EZ=1,_Z=2,N2=-2,Fq=-3,m4=-4,cZ=-5,cQ=8,Mq=1,bQ=2,nQ=3,dQ=4,mQ=5,pQ=6,iQ=7,oQ=8,aQ=9,lQ=10,t8=11,p2=12,E4=13,rQ=14,_4=15,sQ=16,tQ=17,eQ=18,$q=19,r8=20,s8=21,Qq=22,qq=23,Kq=24,Jq=25,Vq=26,c4=27,Uq=28,Zq=29,x0=30,p4=31,bZ=32,nZ=852,dZ=592,mZ=15,pZ=mZ;function Gq($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function iZ(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U2.Buf16(320),this.work=new U2.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function wq($){var q;if(!$||!$.state)return N2;if(q=$.state,$.total_in=$.total_out=q.total=0,$.msg="",q.wrap)$.adler=q.wrap&1;return q.mode=Mq,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new U2.Buf32(nZ),q.distcode=q.distdyn=new U2.Buf32(dZ),q.sane=1,q.back=-1,g1}function Nq($){var q;if(!$||!$.state)return N2;return q=$.state,q.wsize=0,q.whave=0,q.wnext=0,wq($)}function Yq($,q){var Q,K;if(!$||!$.state)return N2;if(K=$.state,q<0)Q=0,q=-q;else if(Q=(q>>4)+1,q<48)q&=15;if(q&&(q<8||q>15))return N2;if(K.window!==null&&K.wbits!==q)K.window=null;return K.wrap=Q,K.wbits=q,Nq($)}function kq($,q){var Q,K;if(!$)return N2;if(K=new iZ,$.state=K,K.window=null,Q=Yq($,q),Q!==g1)$.state=null;return Q}function oZ($){return kq($,pZ)}var Wq=!0,b4,n4;function aZ($){if(Wq){var q;b4=new U2.Buf32(512),n4=new U2.Buf32(32),q=0;while(q<144)$.lens[q++]=8;while(q<256)$.lens[q++]=9;while(q<280)$.lens[q++]=7;while(q<288)$.lens[q++]=8;q8(Bq,$.lens,0,288,b4,0,$.work,{bits:9}),q=0;while(q<32)$.lens[q++]=5;q8(zq,$.lens,0,32,n4,0,$.work,{bits:5}),Wq=!1}$.lencode=b4,$.lenbits=9,$.distcode=n4,$.distbits=5}function Dq($,q,Q,K){var J,Z=$.state;if(Z.window===null)Z.wsize=1<=Z.wsize)U2.arraySet(Z.window,q,Q-Z.wsize,Z.wsize,0),Z.wnext=0,Z.whave=Z.wsize;else{if(J=Z.wsize-Z.wnext,J>K)J=K;if(U2.arraySet(Z.window,q,Q-K,J,Z.wnext),K-=J,K)U2.arraySet(Z.window,q,Q-K,K,0),Z.wnext=K,Z.whave=Z.wsize;else{if(Z.wnext+=J,Z.wnext===Z.wsize)Z.wnext=0;if(Z.whave>>8&255,Q.check=T2(Q.check,_,2,0),V=0,U=0,Q.mode=bQ;break}if(Q.flags=0,Q.head)Q.head.done=!1;if(!(Q.wrap&1)||(((V&255)<<8)+(V>>8))%31){$.msg="incorrect header check",Q.mode=x0;break}if((V&15)!==cQ){$.msg="unknown compression method",Q.mode=x0;break}if(V>>>=4,U-=4,n=(V&15)+8,Q.wbits===0)Q.wbits=n;else if(n>Q.wbits){$.msg="invalid window size",Q.mode=x0;break}Q.dmax=1<>8&1;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=nQ;case nQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>8&255,_[2]=V>>>16&255,_[3]=V>>>24&255,Q.check=T2(Q.check,_,4,0);V=0,U=0,Q.mode=dQ;case dQ:while(U<16){if(W===0)break $;W--,V+=K[Z++]<>8;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=mQ;case mQ:if(Q.flags&1024){while(U<16){if(W===0)break $;W--,V+=K[Z++]<>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0}else if(Q.head)Q.head.extra=null;Q.mode=pQ;case pQ:if(Q.flags&1024){if(M=Q.length,M>W)M=W;if(M){if(Q.head){if(n=Q.head.extra_len-Q.length,!Q.head.extra)Q.head.extra=Array(Q.head.extra_len);U2.arraySet(Q.head.extra,K,Z,M,n)}if(Q.flags&512)Q.check=T2(Q.check,K,M,Z);W-=M,Z+=M,Q.length-=M}if(Q.length)break $}Q.length=0,Q.mode=iQ;case iQ:if(Q.flags&2048){if(W===0)break $;M=0;do if(n=K[Z+M++],Q.head&&n&&Q.length<65536)Q.head.name+=String.fromCharCode(n);while(n&&M>9&1,Q.head.done=!0;$.adler=Q.check=0,Q.mode=p2;break;case lQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>=U&7,U-=U&7,Q.mode=c4;break}while(U<3){if(W===0)break $;W--,V+=K[Z++]<>>=1,U-=1,V&3){case 0:Q.mode=rQ;break;case 1:if(aZ(Q),Q.mode=r8,q===l8){V>>>=2,U-=2;break $}break;case 2:Q.mode=tQ;break;case 3:$.msg="invalid block type",Q.mode=x0}V>>>=2,U-=2;break;case rQ:V>>>=U&7,U-=U&7;while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>16^65535)){$.msg="invalid stored block lengths",Q.mode=x0;break}if(Q.length=V&65535,V=0,U=0,Q.mode=_4,q===l8)break $;case _4:Q.mode=sQ;case sQ:if(M=Q.length,M){if(M>W)M=W;if(M>B)M=B;if(M===0)break $;U2.arraySet(J,K,Z,M,G),W-=M,Z+=M,B-=M,G+=M,Q.length-=M;break}Q.mode=p2;break;case tQ:while(U<14){if(W===0)break $;W--,V+=K[Z++]<>>=5,U-=5,Q.ndist=(V&31)+1,V>>>=5,U-=5,Q.ncode=(V&15)+4,V>>>=4,U-=4,Q.nlen>286||Q.ndist>30){$.msg="too many length or distance symbols",Q.mode=x0;break}Q.have=0,Q.mode=eQ;case eQ:while(Q.have>>=3,U-=3}while(Q.have<19)Q.lens[g[Q.have++]]=0;if(Q.lencode=Q.lendyn,Q.lenbits=7,X={bits:Q.lenbits},d=q8(uZ,Q.lens,0,19,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid code lengths set",Q.mode=x0;break}Q.have=0,Q.mode=$q;case $q:while(Q.have>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=D,U-=D,Q.lens[Q.have++]=N;else{if(N===16){P=D+2;while(U>>=D,U-=D,Q.have===0){$.msg="invalid bit length repeat",Q.mode=x0;break}n=Q.lens[Q.have-1],M=3+(V&3),V>>>=2,U-=2}else if(N===17){P=D+3;while(U>>=D,U-=D,n=0,M=3+(V&7),V>>>=3,U-=3}else{P=D+7;while(U>>=D,U-=D,n=0,M=11+(V&127),V>>>=7,U-=7}if(Q.have+M>Q.nlen+Q.ndist){$.msg="invalid bit length repeat",Q.mode=x0;break}while(M--)Q.lens[Q.have++]=n}}if(Q.mode===x0)break;if(Q.lens[256]===0){$.msg="invalid code -- missing end-of-block",Q.mode=x0;break}if(Q.lenbits=9,X={bits:Q.lenbits},d=q8(Bq,Q.lens,0,Q.nlen,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid literal/lengths set",Q.mode=x0;break}if(Q.distbits=6,Q.distcode=Q.distdyn,X={bits:Q.distbits},d=q8(zq,Q.lens,Q.nlen,Q.ndist,Q.distcode,0,Q.work,X),Q.distbits=X.bits,d){$.msg="invalid distances set",Q.mode=x0;break}if(Q.mode=r8,q===l8)break $;case r8:Q.mode=s8;case s8:if(W>=6&&B>=258){if($.next_out=G,$.avail_out=B,$.next_in=Z,$.avail_in=W,Q.hold=V,Q.bits=U,TZ($,F),G=$.next_out,J=$.output,B=$.avail_out,Z=$.next_in,K=$.input,W=$.avail_in,V=Q.hold,U=Q.bits,Q.mode===p2)Q.back=-1;break}Q.back=0;for(;;){if(L=Q.lencode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,Q.length=N,z===0){Q.mode=Vq;break}if(z&32){Q.back=-1,Q.mode=p2;break}if(z&64){$.msg="invalid literal/length code",Q.mode=x0;break}Q.extra=z&15,Q.mode=Qq;case Qq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}Q.was=Q.length,Q.mode=qq;case qq:for(;;){if(L=Q.distcode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,z&64){$.msg="invalid distance code",Q.mode=x0;break}Q.offset=N,Q.extra=z&15,Q.mode=Kq;case Kq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}if(Q.offset>Q.dmax){$.msg="invalid distance too far back",Q.mode=x0;break}Q.mode=Jq;case Jq:if(B===0)break $;if(M=F-B,Q.offset>M){if(M=Q.offset-M,M>Q.whave){if(Q.sane){$.msg="invalid distance too far back",Q.mode=x0;break}}if(M>Q.wnext)M-=Q.wnext,k=Q.wsize-M;else k=Q.wnext-M;if(M>Q.length)M=Q.length;f=Q.window}else f=J,k=G-Q.offset,M=Q.length;if(M>B)M=B;B-=M,Q.length-=M;do J[G++]=f[k++];while(--M);if(Q.length===0)Q.mode=s8;break;case Vq:if(B===0)break $;J[G++]=Q.length,B--,Q.mode=s8;break;case c4:if(Q.wrap){while(U<32){if(W===0)break $;W--,V|=K[Z++]<{Hq.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var fq=N0((tz,vq)=>{function eZ(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}vq.exports=eZ});var Iq=N0((J8)=>{var B6=Lq(),K8=d2(),e8=h4(),E0=i4(),o4=c8(),$G=x4(),QG=fq(),Rq=Object.prototype.toString;function A1($){if(!(this instanceof A1))return new A1($);this.options=K8.assign({chunkSize:16384,windowBits:0,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>=0&&q.windowBits<16){if(q.windowBits=-q.windowBits,q.windowBits===0)q.windowBits=-15}if(q.windowBits>=0&&q.windowBits<16&&!($&&$.windowBits))q.windowBits+=32;if(q.windowBits>15&&q.windowBits<48){if((q.windowBits&15)===0)q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $G,this.strm.avail_out=0;var Q=B6.inflateInit2(this.strm,q.windowBits);if(Q!==E0.Z_OK)throw Error(o4[Q]);if(this.header=new QG,B6.inflateGetHeader(this.strm,this.header),q.dictionary){if(typeof q.dictionary==="string")q.dictionary=e8.string2buf(q.dictionary);else if(Rq.call(q.dictionary)==="[object ArrayBuffer]")q.dictionary=new Uint8Array(q.dictionary);if(q.raw){if(Q=B6.inflateSetDictionary(this.strm,q.dictionary),Q!==E0.Z_OK)throw Error(o4[Q])}}}A1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J=this.options.dictionary,Z,G,W,B,V,U=!1;if(this.ended)return!1;if(G=q===~~q?q:q===!0?E0.Z_FINISH:E0.Z_NO_FLUSH,typeof $==="string")Q.input=e8.binstring2buf($);else if(Rq.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new K8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(Z=B6.inflate(Q,E0.Z_NO_FLUSH),Z===E0.Z_NEED_DICT&&J)Z=B6.inflateSetDictionary(this.strm,J);if(Z===E0.Z_BUF_ERROR&&U===!0)Z=E0.Z_OK,U=!1;if(Z!==E0.Z_STREAM_END&&Z!==E0.Z_OK)return this.onEnd(Z),this.ended=!0,!1;if(Q.next_out){if(Q.avail_out===0||Z===E0.Z_STREAM_END||Q.avail_in===0&&(G===E0.Z_FINISH||G===E0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(W=e8.utf8border(Q.output,Q.next_out),B=Q.next_out-W,V=e8.buf2string(Q.output,W),Q.next_out=B,Q.avail_out=K-B,B)K8.arraySet(Q.output,Q.output,W,B,0);this.onData(V)}else this.onData(K8.shrinkBuf(Q.output,Q.next_out))}if(Q.avail_in===0&&Q.avail_out===0)U=!0}while((Q.avail_in>0||Q.avail_out===0)&&Z!==E0.Z_STREAM_END);if(Z===E0.Z_STREAM_END)G=E0.Z_FINISH;if(G===E0.Z_FINISH)return Z=B6.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===E0.Z_OK;if(G===E0.Z_SYNC_FLUSH)return this.onEnd(E0.Z_OK),Q.avail_out=0,!0;return!0};A1.prototype.onData=function($){this.chunks.push($)};A1.prototype.onEnd=function($){if($===E0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=K8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function a4($,q){var Q=new A1(q);if(Q.push($,!0),Q.err)throw Q.msg||o4[Q.err];return Q.result}function qG($,q){return q=q||{},q.raw=!0,a4($,q)}J8.Inflate=A1;J8.inflate=a4;J8.inflateRaw=qG;J8.ungzip=a4});var gq=N0(($F,jq)=>{var KG=d2().assign,JG=XQ(),VG=Iq(),UG=i4(),Cq={};KG(Cq,JG,VG,UG);jq.exports=Cq});var Xq=N0((Q5)=>{var ZG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",GG=gq(),Aq=T0(),$5=V2(),WG=ZG?"uint8array":"array";Q5.magic="\b\x00";function X1($,q){$5.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=q,this.meta={}}Aq.inherits(X1,$5);X1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(Aq.transformTo(WG,$.data),!1)};X1.prototype.flush=function(){if($5.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};X1.prototype.cleanUp=function(){$5.prototype.cleanUp.call(this),this._pako=null};X1.prototype._createPako=function(){this._pako=new GG[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(q){$.push({data:q,meta:$.meta})}};Q5.compressWorker=function($){return new X1("Deflate",$)};Q5.uncompressWorker=function(){return new X1("Inflate",{})}});var r4=N0((l4)=>{var yq=V2();l4.STORE={magic:"\x00\x00",compressWorker:function(){return new yq("STORE compression")},uncompressWorker:function(){return new yq("STORE decompression")}};l4.DEFLATE=Xq()});var s4=N0((y1)=>{y1.LOCAL_FILE_HEADER="PK\x03\x04";y1.CENTRAL_FILE_HEADER="PK\x01\x02";y1.CENTRAL_DIRECTORY_END="PK\x05\x06";y1.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";y1.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";y1.DATA_DESCRIPTOR="PK\x07\b"});var Pq=N0((JF,Oq)=>{var z6=T0(),F6=V2(),t4=e1(),hq=u8(),q5=s4(),A0=function($,q){var Q="",K;for(K=0;K>>8;return Q},BG=function($,q){var Q=$;if(!$)Q=q?16893:33204;return(Q&65535)<<16},zG=function($){return($||0)&63},xq=function($,q,Q,K,J,Z){var{file:G,compression:W}=$,B=Z!==t4.utf8encode,V=z6.transformTo("string",Z(G.name)),U=z6.transformTo("string",t4.utf8encode(G.name)),w=G.comment,F=z6.transformTo("string",Z(w)),M=z6.transformTo("string",t4.utf8encode(w)),k=U.length!==G.name.length,f=M.length!==w.length,L,D,z="",N="",H="",v=G.dir,j=G.date,n={crc32:0,compressedSize:0,uncompressedSize:0};if(!q||Q)n.crc32=$.crc32,n.compressedSize=$.compressedSize,n.uncompressedSize=$.uncompressedSize;var d=0;if(q)d|=8;if(!B&&(k||f))d|=2048;var _=0,X=0;if(v)_|=16;if(J==="UNIX")X=798,_|=BG(G.unixPermissions,v);else X=20,_|=zG(G.dosPermissions,v);if(L=j.getUTCHours(),L=L<<6,L=L|j.getUTCMinutes(),L=L<<5,L=L|j.getUTCSeconds()/2,D=j.getUTCFullYear()-1980,D=D<<4,D=D|j.getUTCMonth()+1,D=D<<5,D=D|j.getUTCDate(),k)N=A0(1,1)+A0(hq(V),4)+U,z+="up"+A0(N.length,2)+N;if(f)H=A0(1,1)+A0(hq(F),4)+M,z+="uc"+A0(H.length,2)+H;var P="";P+=` -\x00`,P+=A0(d,2),P+=W.magic,P+=A0(L,2),P+=A0(D,2),P+=A0(n.crc32,4),P+=A0(n.compressedSize,4),P+=A0(n.uncompressedSize,4),P+=A0(V.length,2),P+=A0(z.length,2);var g=q5.LOCAL_FILE_HEADER+P+V+z,c=q5.CENTRAL_FILE_HEADER+A0(X,2)+P+A0(F.length,2)+"\x00\x00\x00\x00"+A0(_,4)+A0(K,4)+V+z+F;return{fileRecord:g,dirRecord:c}},FG=function($,q,Q,K,J){var Z="",G=z6.transformTo("string",J(K));return Z=q5.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+A0($,2)+A0($,2)+A0(q,4)+A0(Q,4)+A0(G.length,2)+G,Z},MG=function($){var q="";return q=q5.DATA_DESCRIPTOR+A0($.crc32,4)+A0($.compressedSize,4)+A0($.uncompressedSize,4),q};function v2($,q,Q,K){F6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=q,this.zipPlatform=Q,this.encodeFileName=K,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}z6.inherits(v2,F6);v2.prototype.push=function($){var q=$.meta.percent||0,Q=this.entriesCount,K=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,F6.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:Q?(q+100*(Q-K-1))/Q:100}})};v2.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var q=this.streamFiles&&!$.file.dir;if(q){var Q=xq($,q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:Q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};v2.prototype.closedSource=function($){this.accumulate=!1;var q=this.streamFiles&&!$.file.dir,Q=xq($,q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(Q.dirRecord),q)this.push({data:MG($),meta:{percent:100}});else{this.push({data:Q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};v2.prototype.flush=function(){var $=this.bytesWritten;for(var q=0;q{var wG=r4(),NG=Pq(),YG=function($,q){var Q=$||q,K=wG[Q];if(!K)throw Error(Q+" is not a valid compression method !");return K};Tq.generateWorker=function($,q,Q){var K=new NG(q.streamFiles,Q,q.platform,q.encodeFileName),J=0;try{$.forEach(function(Z,G){J++;var W=YG(G.options.compression,q.compression),B=G.options.compressionOptions||q.compressionOptions||{},V=G.dir,U=G.date;G._compressWorker(W,B).withStreamInfo("file",{name:Z,dir:V,date:U,comment:G.comment||"",unixPermissions:G.unixPermissions,dosPermissions:G.dosPermissions}).pipe(K)}),K.entriesCount=J}catch(Z){K.error(Z)}return K}});var Eq=N0((UF,Sq)=>{var kG=T0(),K5=V2();function V8($,q){K5.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(q)}kG.inherits(V8,K5);V8.prototype._bindStream=function($){var q=this;this._stream=$,$.pause(),$.on("data",function(Q){q.push({data:Q,meta:{percent:0}})}).on("error",function(Q){if(q.isPaused)this.generatedError=Q;else q.error(Q)}).on("end",function(){if(q.isPaused)q._upstreamEnded=!0;else q.end()})};V8.prototype.pause=function(){if(!K5.prototype.pause.call(this))return!1;return this._stream.pause(),!0};V8.prototype.resume=function(){if(!K5.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};Sq.exports=V8});var aq=N0((ZF,oq)=>{var DG=e1(),U8=T0(),nq=V2(),LG=K4(),dq=J4(),_q=S8(),HG=c$(),vG=uq(),cq=T6(),fG=Eq(),mq=function($,q,Q){var K=U8.getTypeOf(q),J,Z=U8.extend(Q||{},dq);if(Z.date=Z.date||new Date,Z.compression!==null)Z.compression=Z.compression.toUpperCase();if(typeof Z.unixPermissions==="string")Z.unixPermissions=parseInt(Z.unixPermissions,8);if(Z.unixPermissions&&Z.unixPermissions&16384)Z.dir=!0;if(Z.dosPermissions&&Z.dosPermissions&16)Z.dir=!0;if(Z.dir)$=pq($);if(Z.createFolders&&(J=RG($)))iq.call(this,J,!0);var G=K==="string"&&Z.binary===!1&&Z.base64===!1;if(!Q||typeof Q.binary>"u")Z.binary=!G;var W=q instanceof _q&&q.uncompressedSize===0;if(W||Z.dir||!q||q.length===0)Z.base64=!1,Z.binary=!0,q="",Z.compression="STORE",K="string";var B=null;if(q instanceof _q||q instanceof nq)B=q;else if(cq.isNode&&cq.isStream(q))B=new fG($,q);else B=U8.prepareContent($,q,Z.binary,Z.optimizedBinaryString,Z.base64);var V=new HG($,B,Z);this.files[$]=V},RG=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var q=$.lastIndexOf("/");return q>0?$.substring(0,q):""},pq=function($){if($.slice(-1)!=="/")$+="/";return $},iq=function($,q){if(q=typeof q<"u"?q:dq.createFolders,$=pq($),!this.files[$])mq.call(this,$,null,{dir:!0,createFolders:q});return this.files[$]};function bq($){return Object.prototype.toString.call($)==="[object RegExp]"}var IG={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var q,Q,K;for(q in this.files)if(K=this.files[q],Q=q.slice(this.root.length,q.length),Q&&q.slice(0,this.root.length)===this.root)$(Q,K)},filter:function($){var q=[];return this.forEach(function(Q,K){if($(Q,K))q.push(K)}),q},file:function($,q,Q){if(arguments.length===1)if(bq($)){var K=$;return this.filter(function(Z,G){return!G.dir&&K.test(Z)})}else{var J=this.files[this.root+$];if(J&&!J.dir)return J;else return null}else $=this.root+$,mq.call(this,$,q,Q);return this},folder:function($){if(!$)return this;if(bq($))return this.filter(function(J,Z){return Z.dir&&$.test(J)});var q=this.root+$,Q=iq.call(this,q),K=this.clone();return K.root=Q.name,K},remove:function($){$=this.root+$;var q=this.files[$];if(!q){if($.slice(-1)!=="/")$+="/";q=this.files[$]}if(q&&!q.dir)delete this.files[$];else{var Q=this.filter(function(J,Z){return Z.name.slice(0,$.length)===$});for(var K=0;K{var CG=T0();function lq($){this.data=$,this.length=$.length,this.index=0,this.zero=0}lq.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length=this.index;Q--)q=(q<<8)+this.byteAt(Q);return this.index+=$,q},readString:function($){return CG.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};rq.exports=lq});var $7=N0((WF,tq)=>{var sq=e4(),jG=T0();function M6($){sq.call(this,$);for(var q=0;q=0;--Z)if(this.data[Z]===q&&this.data[Z+1]===Q&&this.data[Z+2]===K&&this.data[Z+3]===J)return Z-this.zero;return-1};M6.prototype.readAndCheckSignature=function($){var q=$.charCodeAt(0),Q=$.charCodeAt(1),K=$.charCodeAt(2),J=$.charCodeAt(3),Z=this.readData(4);return q===Z[0]&&Q===Z[1]&&K===Z[2]&&J===Z[3]};M6.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};tq.exports=M6});var QK=N0((BF,$K)=>{var eq=e4(),gG=T0();function w6($){eq.call(this,$)}gG.inherits(w6,eq);w6.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};w6.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};w6.prototype.readAndCheckSignature=function($){var q=this.readData(4);return $===q};w6.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};$K.exports=w6});var q7=N0((zF,KK)=>{var qK=$7(),AG=T0();function Q7($){qK.call(this,$)}AG.inherits(Q7,qK);Q7.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};KK.exports=Q7});var UK=N0((FF,VK)=>{var JK=q7(),XG=T0();function K7($){JK.call(this,$)}XG.inherits(K7,JK);K7.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};VK.exports=K7});var J7=N0((MF,GK)=>{var J5=T0(),ZK=n2(),yG=$7(),hG=QK(),xG=UK(),OG=q7();GK.exports=function($){var q=J5.getTypeOf($);if(J5.checkSupport(q),q==="string"&&!ZK.uint8array)return new hG($);if(q==="nodebuffer")return new xG($);if(ZK.uint8array)return new OG(J5.transformTo("uint8array",$));return new yG(J5.transformTo("array",$))}});var FK=N0((wF,zK)=>{var V7=J7(),G1=T0(),PG=S8(),WK=u8(),V5=e1(),U5=r4(),TG=n2(),uG=0,SG=3,EG=function($){for(var q in U5){if(!Object.prototype.hasOwnProperty.call(U5,q))continue;if(U5[q].magic===$)return U5[q]}return null};function BK($,q){this.options=$,this.loadOptions=q}BK.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var q,Q;if($.skip(22),this.fileNameLength=$.readInt(2),Q=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(Q),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(q=EG(this.compressionMethod),q===null)throw Error("Corrupted zip : compression "+G1.pretty(this.compressionMethod)+" unknown (inner file : "+G1.transformTo("string",this.fileName)+")");this.decompressed=new PG(this.compressedSize,this.uncompressedSize,this.crc32,q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===uG)this.dosPermissions=this.externalFileAttributes&63;if($===SG)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=V7(this.extraFields[1].value);if(this.uncompressedSize===G1.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G1.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G1.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G1.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var q=$.index+this.extraFieldsLength,Q,K,J;if(!this.extraFields)this.extraFields={};while($.index+4{var _G=J7(),i2=T0(),f2=s4(),cG=FK(),bG=n2();function MK($){this.files=[],this.loadOptions=$}MK.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+i2.pretty(q)+", expected "+i2.pretty($)+")")}},isSignature:function($,q){var Q=this.reader.index;this.reader.setIndex($);var K=this.reader.readString(4),J=K===q;return this.reader.setIndex(Q),J},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),q=bG.uint8array?"uint8array":"array",Q=i2.transformTo(q,$);this.zipComment=this.loadOptions.decodeFileName(Q)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,q=0,Q,K,J;while(q<$)Q=this.reader.readInt(2),K=this.reader.readInt(4),J=this.reader.readData(K),this.zip64ExtensibleData[Q]={id:Q,length:K,value:J}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,q;for($=0;$0)if(this.isSignature(Q,f2.CENTRAL_FILE_HEADER));else this.reader.zero=J;else if(J<0)throw Error("Corrupted zip: missing "+Math.abs(J)+" bytes.")},prepareReader:function($){this.reader=_G($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};wK.exports=MK});var DK=N0((YF,kK)=>{var U7=T0(),Z5=r1(),nG=e1(),dG=NK(),mG=Z4(),YK=T6();function pG($){return new Z5.Promise(function(q,Q){var K=$.decompressed.getContentWorker().pipe(new mG);K.on("error",function(J){Q(J)}).on("end",function(){if(K.streamInfo.crc32!==$.decompressed.crc32)Q(Error("Corrupted zip : CRC32 mismatch"));else q()}).resume()})}kK.exports=function($,q){var Q=this;if(q=U7.extend(q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:nG.utf8decode}),YK.isNode&&YK.isStream($))return Z5.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return U7.prepareContent("the loaded zip file",$,!0,q.optimizedBinaryString,q.base64).then(function(K){var J=new dG(q);return J.load(K),J}).then(function(J){var Z=[Z5.Promise.resolve(J)],G=J.files;if(q.checkCRC32)for(var W=0;W{function Y2(){if(!(this instanceof Y2))return new Y2;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new Y2;for(var q in this)if(typeof this[q]!=="function")$[q]=this[q];return $}}Y2.prototype=aq();Y2.prototype.loadAsync=DK();Y2.support=n2();Y2.defaults=J4();Y2.version="3.10.1";Y2.loadAsync=function($,q){return new Y2().loadAsync($,q)};Y2.external=r1();LK.exports=Y2});var Z8={};c1(Z8,{types:()=>QW,promisify:()=>jK,log:()=>RK,isUndefined:()=>N6,isSymbol:()=>KW,isString:()=>M5,isRegExp:()=>G5,isPrimitive:()=>JW,isObject:()=>Y6,isNumber:()=>fK,isNullOrUndefined:()=>qW,isNull:()=>F5,isFunction:()=>B5,isError:()=>W5,isDate:()=>B7,isBuffer:()=>VW,isBoolean:()=>F7,isArray:()=>vK,inspect:()=>h1,inherits:()=>IK,format:()=>z7,deprecate:()=>oG,default:()=>GW,debuglog:()=>aG,callbackifyOnRejected:()=>N7,callbackify:()=>gK,_extend:()=>w7,TextEncoder:()=>AK,TextDecoder:()=>XK});function z7($,...q){if(!M5($)){var Q=[$];for(var K=0;K=J)return W;switch(W){case"%s":return String(q[K++]);case"%d":return Number(q[K++]);case"%j":try{return JSON.stringify(q[K++])}catch(B){return"[Circular]"}default:return W}});for(var G=q[K];K"u"||process?.noDeprecation===!0)return $;var Q=!1;function K(...J){if(!Q){if(process.throwDeprecation)throw Error(q);else if(process.traceDeprecation)console.trace(q);else console.error(q);Q=!0}return $.apply(this,...J)}return K}function lG($,q){var Q=h1.styles[q];if(Q)return"\x1B["+h1.colors[Q][0]+"m"+$+"\x1B["+h1.colors[Q][1]+"m";else return $}function rG($,q){return $}function sG($){var q={};return $.forEach(function(Q,K){q[Q]=!0}),q}function z5($,q,Q){if($.customInspect&&q&&B5(q.inspect)&&q.inspect!==h1&&!(q.constructor&&q.constructor.prototype===q)){var K=q.inspect(Q,$);if(!M5(K))K=z5($,K,Q);return K}var J=tG($,q);if(J)return J;var Z=Object.keys(q),G=sG(Z);if($.showHidden)Z=Object.getOwnPropertyNames(q);if(W5(q)&&(Z.indexOf("message")>=0||Z.indexOf("description")>=0))return Z7(q);if(Z.length===0){if(B5(q)){var W=q.name?": "+q.name:"";return $.stylize("[Function"+W+"]","special")}if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");if(B7(q))return $.stylize(Date.prototype.toString.call(q),"date");if(W5(q))return Z7(q)}var B="",V=!1,U=["{","}"];if(vK(q))V=!0,U=["[","]"];if(B5(q)){var w=q.name?": "+q.name:"";B=" [Function"+w+"]"}if(G5(q))B=" "+RegExp.prototype.toString.call(q);if(B7(q))B=" "+Date.prototype.toUTCString.call(q);if(W5(q))B=" "+Z7(q);if(Z.length===0&&(!V||q.length==0))return U[0]+B+U[1];if(Q<0)if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");else return $.stylize("[Object]","special");$.seen.push(q);var F;if(V)F=eG($,q,Q,G,Z);else F=Z.map(function(M){return W7($,q,Q,G,M,V)});return $.seen.pop(),$W(F,B,U)}function tG($,q){if(N6(q))return $.stylize("undefined","undefined");if(M5(q)){var Q="'"+JSON.stringify(q).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(Q,"string")}if(fK(q))return $.stylize(""+q,"number");if(F7(q))return $.stylize(""+q,"boolean");if(F5(q))return $.stylize("null","null")}function Z7($){return"["+Error.prototype.toString.call($)+"]"}function eG($,q,Q,K,J){var Z=[];for(var G=0,W=q.length;G{var fJ=Object.create;var{getPrototypeOf:RJ,defineProperty:X6,getOwnPropertyNames:Q9,getOwnPropertyDescriptor:IJ}=Object,q9=Object.prototype.hasOwnProperty;function K9($){return this[$]}var CJ,jJ,J9=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?CJ??=new WeakMap:jJ??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?fJ(RJ($)):{};let G=q||!$||!$.__esModule?X6(Q,"default",{value:$,enumerable:!0}):Q;for(let W of Q9($))if(!q9.call(G,W))X6(G,W,{get:K9.bind($,W),enumerable:!0});if(K)J.set($,G);return G},X0=($)=>{var q=($9??=new WeakMap).get($),Q;if(q)return q;if(q=X6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var K of Q9($))if(!q9.call(q,K))X6(q,K,{get:K9.bind($,K),enumerable:!(Q=IJ($,K))||Q.enumerable})}return $9.set($,q),q},$9,N0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var gJ=($)=>$;function AJ($,q){this[$]=gJ.bind(null,q)}var c1=($,q)=>{for(var Q in q)X6($,Q,{get:q[Q],enumerable:!0,configurable:!0,set:AJ.bind(q,Q)})};var b1=($,q)=>()=>($&&(q=$($=0)),q);var V9=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(q,Q)=>(typeof require<"u"?require:q)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var K2={};c1(K2,{transcode:()=>MV,resolveObjectURL:()=>BV,kStringMaxLength:()=>w9,kMaxLength:()=>y6,isUtf8:()=>zV,isAscii:()=>FV,default:()=>wV,constants:()=>EJ,btoa:()=>PJ,atob:()=>TJ,INSPECT_MAX_BYTES:()=>M9,File:()=>uJ,Buffer:()=>o,Blob:()=>SJ});function XJ($){var q=$.length;if(q%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=$.indexOf("=");if(Q===-1)Q=q;var K=Q===q?0:4-Q%4;return[Q,K]}function yJ($,q){return($+q)*3/4-q}function hJ($){var q,Q=XJ($),K=Q[0],J=Q[1],Z=new Uint8Array(yJ(K,J)),G=0,W=J>0?K-4:K,B;for(B=0;B>16&255,Z[G++]=q>>8&255,Z[G++]=q&255;if(J===2)q=F2[$.charCodeAt(B)]<<2|F2[$.charCodeAt(B+1)]>>4,Z[G++]=q&255;if(J===1)q=F2[$.charCodeAt(B)]<<10|F2[$.charCodeAt(B+1)]<<4|F2[$.charCodeAt(B+2)]>>2,Z[G++]=q>>8&255,Z[G++]=q&255;return Z}function xJ($){return I2[$>>18&63]+I2[$>>12&63]+I2[$>>6&63]+I2[$&63]}function OJ($,q,Q){var K,J=[];for(var Z=q;ZW?W:G+Z));if(K===1)q=$[Q-1],J.push(I2[q>>2]+I2[q<<4&63]+"==");else if(K===2)q=($[Q-2]<<8)+$[Q-1],J.push(I2[q>>10]+I2[q>>4&63]+I2[q<<2&63]+"=");return J.join("")}function Y8($,q,Q,K,J){var Z,G,W=J*8-K-1,B=(1<>1,U=-7,w=Q?J-1:0,F=Q?-1:1,M=$[q+w];w+=F,Z=M&(1<<-U)-1,M>>=-U,U+=W;for(;U>0;Z=Z*256+$[q+w],w+=F,U-=8);G=Z&(1<<-U)-1,Z>>=-U,U+=K;for(;U>0;G=G*256+$[q+w],w+=F,U-=8);if(Z===0)Z=1-V;else if(Z===B)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,K),Z=Z-V;return(M?-1:1)*G*Math.pow(2,Z-K)}function F9($,q,Q,K,J,Z){var G,W,B,V=Z*8-J-1,U=(1<>1,F=J===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:Z-1,k=K?1:-1,f=q<0||q===0&&1/q<0?1:0;if(q=Math.abs(q),isNaN(q)||q===1/0)W=isNaN(q)?1:0,G=U;else{if(G=Math.floor(Math.log(q)/Math.LN2),q*(B=Math.pow(2,-G))<1)G--,B*=2;if(G+w>=1)q+=F/B;else q+=F*Math.pow(2,1-w);if(q*B>=2)G++,B/=2;if(G+w>=U)W=0,G=U;else if(G+w>=1)W=(q*B-1)*Math.pow(2,J),G=G+w;else W=q*Math.pow(2,w-1)*Math.pow(2,J),G=0}for(;J>=8;$[Q+M]=W&255,M+=k,W/=256,J-=8);G=G<0;$[Q+M]=G&255,M+=k,G/=256,V-=8);$[Q+M-k]|=f*128}function S2($){if($>y6)throw RangeError('The value "'+$+'" is invalid for option "size"');let q=new Uint8Array($);return Object.setPrototypeOf(q,o.prototype),q}function x5($,q,Q){return class extends Q{constructor(){super();Object.defineProperty(this,"message",{value:q.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}function o($,q,Q){if(typeof $==="number"){if(typeof q==="string")throw TypeError('The "string" argument must be of type string. Received type number');return O5($)}return N9($,q,Q)}function N9($,q,Q){if(typeof $==="string")return nJ($,q);if(ArrayBuffer.isView($))return dJ($);if($==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(C2($,ArrayBuffer)||$&&C2($.buffer,ArrayBuffer))return y5($,q,Q);if(typeof SharedArrayBuffer<"u"&&(C2($,SharedArrayBuffer)||$&&C2($.buffer,SharedArrayBuffer)))return y5($,q,Q);if(typeof $==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=$.valueOf&&$.valueOf();if(K!=null&&K!==$)return o.from(K,q,Q);let J=mJ($);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]==="function")return o.from($[Symbol.toPrimitive]("string"),q,Q);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}function Y9($){if(typeof $!=="number")throw TypeError('"size" argument must be of type number');else if($<0)throw RangeError('The value "'+$+'" is invalid for option "size"')}function bJ($,q,Q){if(Y9($),$<=0)return S2($);if(q!==void 0)return typeof Q==="string"?S2($).fill(q,Q):S2($).fill(q);return S2($)}function O5($){return Y9($),S2($<0?0:P5($)|0)}function nJ($,q){if(typeof q!=="string"||q==="")q="utf8";if(!o.isEncoding(q))throw TypeError("Unknown encoding: "+q);let Q=k9($,q)|0,K=S2(Q),J=K.write($,q);if(J!==Q)K=K.slice(0,J);return K}function X5($){let q=$.length<0?0:P5($.length)|0,Q=S2(q);for(let K=0;K=y6)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y6.toString(16)+" bytes");return $|0}function k9($,q){if(o.isBuffer($))return $.length;if(ArrayBuffer.isView($)||C2($,ArrayBuffer))return $.byteLength;if(typeof $!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let Q=$.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&Q===0)return 0;let J=!1;for(;;)switch(q){case"ascii":case"latin1":case"binary":return Q;case"utf8":case"utf-8":return h5($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q*2;case"hex":return Q>>>1;case"base64":return j9($).length;default:if(J)return K?-1:h5($).length;q=(""+q).toLowerCase(),J=!0}}function pJ($,q,Q){let K=!1;if(q===void 0||q<0)q=0;if(q>this.length)return"";if(Q===void 0||Q>this.length)Q=this.length;if(Q<=0)return"";if(Q>>>=0,q>>>=0,Q<=q)return"";if(!$)$="utf8";while(!0)switch($){case"hex":return QV(this,q,Q);case"utf8":case"utf-8":return L9(this,q,Q);case"ascii":return eJ(this,q,Q);case"latin1":case"binary":return $V(this,q,Q);case"base64":return sJ(this,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qV(this,q,Q);default:if(K)throw TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),K=!0}}function w1($,q,Q){let K=$[q];$[q]=$[Q],$[Q]=K}function D9($,q,Q,K,J){if($.length===0)return-1;if(typeof Q==="string")K=Q,Q=0;else if(Q>2147483647)Q=2147483647;else if(Q<-2147483648)Q=-2147483648;if(Q=+Q,Number.isNaN(Q))Q=J?0:$.length-1;if(Q<0)Q=$.length+Q;if(Q>=$.length)if(J)return-1;else Q=$.length-1;else if(Q<0)if(J)Q=0;else return-1;if(typeof q==="string")q=o.from(q,K);if(o.isBuffer(q)){if(q.length===0)return-1;return W9($,q,Q,K,J)}else if(typeof q==="number"){if(q=q&255,typeof Uint8Array.prototype.indexOf==="function")if(J)return Uint8Array.prototype.indexOf.call($,q,Q);else return Uint8Array.prototype.lastIndexOf.call($,q,Q);return W9($,[q],Q,K,J)}throw TypeError("val must be string, number or Buffer")}function W9($,q,Q,K,J){let Z=1,G=$.length,W=q.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if($.length<2||q.length<2)return-1;Z=2,G/=2,W/=2,Q/=2}}function B(U,w){if(Z===1)return U[w];else return U.readUInt16BE(w*Z)}let V;if(J){let U=-1;for(V=Q;VG)Q=G-W;for(V=Q;V>=0;V--){let U=!0;for(let w=0;wJ)K=J;let Z=q.length;if(K>Z/2)K=Z/2;let G;for(G=0;G239?4:Z>223?3:Z>191?2:1;if(J+W<=Q){let B,V,U,w;switch(W){case 1:if(Z<128)G=Z;break;case 2:if(B=$[J+1],(B&192)===128){if(w=(Z&31)<<6|B&63,w>127)G=w}break;case 3:if(B=$[J+1],V=$[J+2],(B&192)===128&&(V&192)===128){if(w=(Z&15)<<12|(B&63)<<6|V&63,w>2047&&(w<55296||w>57343))G=w}break;case 4:if(B=$[J+1],V=$[J+2],U=$[J+3],(B&192)===128&&(V&192)===128&&(U&192)===128){if(w=(Z&15)<<18|(B&63)<<12|(V&63)<<6|U&63,w>65535&&w<1114112)G=w}}}if(G===null)G=65533,W=1;else if(G>65535)G-=65536,K.push(G>>>10&1023|55296),G=56320|G&1023;K.push(G),J+=W}return tJ(K)}function tJ($){let q=$.length;if(q<=B9)return String.fromCharCode.apply(String,$);let Q="",K=0;while(KK)Q=K;let J="";for(let Z=q;ZQ)throw RangeError("Trying to access beyond buffer length")}function s0($,q,Q,K,J,Z){if(!o.isBuffer($))throw TypeError('"buffer" argument must be a Buffer instance');if(q>J||q$.length)throw RangeError("Index out of range")}function H9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z,Z=Z>>8,$[Q++]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,G=G>>8,$[Q++]=G,Q}function v9($,q,Q,K,J){C9(q,K,J,$,Q,7);let Z=Number(q&BigInt(4294967295));$[Q+7]=Z,Z=Z>>8,$[Q+6]=Z,Z=Z>>8,$[Q+5]=Z,Z=Z>>8,$[Q+4]=Z;let G=Number(q>>BigInt(32)&BigInt(4294967295));return $[Q+3]=G,G=G>>8,$[Q+2]=G,G=G>>8,$[Q+1]=G,G=G>>8,$[Q]=G,Q+8}function f9($,q,Q,K,J,Z){if(Q+K>$.length)throw RangeError("Index out of range");if(Q<0)throw RangeError("Index out of range")}function R9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return F9($,q,Q,K,23,4),Q+4}function I9($,q,Q,K,J){if(q=+q,Q=Q>>>0,!J)f9($,q,Q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return F9($,q,Q,K,52,8),Q+8}function z9($){let q="",Q=$.length,K=$[0]==="-"?1:0;for(;Q>=K+4;Q-=3)q=`_${$.slice(Q-3,Q)}${q}`;return`${$.slice(0,Q)}${q}`}function KV($,q,Q){if(n1(q,"offset"),$[q]===void 0||$[q+Q]===void 0)h6(q,$.length-(Q+1))}function C9($,q,Q,K,J,Z){if($>Q||$3)if(q===0||q===BigInt(0))W=`>= 0${G} and < 2${G} ** ${(Z+1)*8}${G}`;else W=`>= -(2${G} ** ${(Z+1)*8-1}${G}) and < 2 ** ${(Z+1)*8-1}${G}`;else W=`>= ${q}${G} and <= ${Q}${G}`;throw new A5("value",W,$)}KV(K,J,Z)}function n1($,q){if(typeof $!=="number")throw new cJ(q,"number",$)}function h6($,q,Q){if(Math.floor($)!==$)throw n1($,Q),new A5(Q||"offset","an integer",$);if(q<0)throw new _J;throw new A5(Q||"offset",`>= ${Q?1:0} and <= ${q}`,$)}function VV($){if($=$.split("=")[0],$=$.trim().replace(JV,""),$.length<2)return"";while($.length%4!==0)$=$+"=";return $}function h5($,q){q=q||1/0;let Q,K=$.length,J=null,Z=[];for(let G=0;G55295&&Q<57344){if(!J){if(Q>56319){if((q-=3)>-1)Z.push(239,191,189);continue}else if(G+1===K){if((q-=3)>-1)Z.push(239,191,189);continue}J=Q;continue}if(Q<56320){if((q-=3)>-1)Z.push(239,191,189);J=Q;continue}Q=(J-55296<<10|Q-56320)+65536}else if(J){if((q-=3)>-1)Z.push(239,191,189)}if(J=null,Q<128){if((q-=1)<0)break;Z.push(Q)}else if(Q<2048){if((q-=2)<0)break;Z.push(Q>>6|192,Q&63|128)}else if(Q<65536){if((q-=3)<0)break;Z.push(Q>>12|224,Q>>6&63|128,Q&63|128)}else if(Q<1114112){if((q-=4)<0)break;Z.push(Q>>18|240,Q>>12&63|128,Q>>6&63|128,Q&63|128)}else throw Error("Invalid code point")}return Z}function UV($){let q=[];for(let Q=0;Q<$.length;++Q)q.push($.charCodeAt(Q)&255);return q}function ZV($,q){let Q,K,J,Z=[];for(let G=0;G<$.length;++G){if((q-=2)<0)break;Q=$.charCodeAt(G),K=Q>>8,J=Q%256,Z.push(J),Z.push(K)}return Z}function j9($){return hJ(VV($))}function k8($,q,Q,K){let J;for(J=0;J=q.length||J>=$.length)break;q[J+Q]=$[J]}return J}function C2($,q){return $ instanceof q||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===q.name}function l2($){return typeof BigInt>"u"?WV:$}function WV(){throw Error("BigInt not supported")}function T5($){return()=>{throw Error($+" is not implemented for node:buffer browser polyfill")}}var I2,F2,g5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M1,U9,G9,M9=50,y6=2147483647,w9=536870888,PJ,TJ,uJ,SJ,EJ,_J,cJ,A5,B9=4096,JV,GV,BV,zV,FV=($)=>{for(let q of $)if(q.charCodeAt(0)>127)return!1;return!0},MV,wV;var t0=b1(()=>{I2=[],F2=[];for(M1=0,U9=g5.length;M14294967296)J=z9(String(Q));else if(typeof Q==="bigint"){if(J=String(Q),Q>BigInt(2)**BigInt(32)||Q<-(BigInt(2)**BigInt(32)))J=z9(J);J+="n"}return K+=` It must be ${q}. Received ${J}`,K},RangeError);Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.buffer}});Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(!o.isBuffer(this))return;return this.byteOffset}});o.poolSize=8192;o.from=function($,q,Q){return N9($,q,Q)};Object.setPrototypeOf(o.prototype,Uint8Array.prototype);Object.setPrototypeOf(o,Uint8Array);o.alloc=function($,q,Q){return bJ($,q,Q)};o.allocUnsafe=function($){return O5($)};o.allocUnsafeSlow=function($){return O5($)};o.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==o.prototype};o.compare=function($,q){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(C2(q,Uint8Array))q=o.from(q,q.offset,q.byteLength);if(!o.isBuffer($)||!o.isBuffer(q))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===q)return 0;let Q=$.length,K=q.length;for(let J=0,Z=Math.min(Q,K);JK.length){if(!o.isBuffer(Z))Z=o.from(Z);Z.copy(K,J)}else Uint8Array.prototype.set.call(K,Z,J);else if(!o.isBuffer(Z))throw TypeError('"list" argument must be an Array of Buffers');else Z.copy(K,J);J+=Z.length}return K};o.byteLength=k9;o.prototype._isBuffer=!0;o.prototype.swap16=function(){let $=this.length;if($%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let q=0;q<$;q+=2)w1(this,q,q+1);return this};o.prototype.swap32=function(){let $=this.length;if($%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let q=0;q<$;q+=4)w1(this,q,q+3),w1(this,q+1,q+2);return this};o.prototype.swap64=function(){let $=this.length;if($%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let q=0;q<$;q+=8)w1(this,q,q+7),w1(this,q+1,q+6),w1(this,q+2,q+5),w1(this,q+3,q+4);return this};o.prototype.toString=function(){let $=this.length;if($===0)return"";if(arguments.length===0)return L9(this,0,$);return pJ.apply(this,arguments)};o.prototype.toLocaleString=o.prototype.toString;o.prototype.equals=function($){if(!o.isBuffer($))throw TypeError("Argument must be a Buffer");if(this===$)return!0;return o.compare(this,$)===0};o.prototype.inspect=function(){let $="",q=M9;if($=this.toString("hex",0,q).replace(/(.{2})/g,"$1 ").trim(),this.length>q)$+=" ... ";return""};if(G9)o.prototype[G9]=o.prototype.inspect;o.prototype.compare=function($,q,Q,K,J){if(C2($,Uint8Array))$=o.from($,$.offset,$.byteLength);if(!o.isBuffer($))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(q===void 0)q=0;if(Q===void 0)Q=$?$.length:0;if(K===void 0)K=0;if(J===void 0)J=this.length;if(q<0||Q>$.length||K<0||J>this.length)throw RangeError("out of range index");if(K>=J&&q>=Q)return 0;if(K>=J)return-1;if(q>=Q)return 1;if(q>>>=0,Q>>>=0,K>>>=0,J>>>=0,this===$)return 0;let Z=J-K,G=Q-q,W=Math.min(Z,G),B=this.slice(K,J),V=$.slice(q,Q);for(let U=0;U>>0,isFinite(Q)){if(Q=Q>>>0,K===void 0)K="utf8"}else K=Q,Q=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let J=this.length-q;if(Q===void 0||Q>J)Q=J;if($.length>0&&(Q<0||q<0)||q>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let Z=!1;for(;;)switch(K){case"hex":return iJ(this,$,q,Q);case"utf8":case"utf-8":return oJ(this,$,q,Q);case"ascii":case"latin1":case"binary":return aJ(this,$,q,Q);case"base64":return lJ(this,$,q,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rJ(this,$,q,Q);default:if(Z)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),Z=!0}};o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};o.prototype.slice=function($,q){let Q=this.length;if($=~~$,q=q===void 0?Q:~~q,$<0){if($+=Q,$<0)$=0}else if($>Q)$=Q;if(q<0){if(q+=Q,q<0)q=0}else if(q>Q)q=Q;if(q<$)q=$;let K=this.subarray($,q);return Object.setPrototypeOf(K,o.prototype),K};o.prototype.readUintLE=o.prototype.readUIntLE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$+--q],J=1;while(q>0&&(J*=256))K+=this[$+--q]*J;return K};o.prototype.readUint8=o.prototype.readUInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);return this[$]};o.prototype.readUint16LE=o.prototype.readUInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]|this[$+1]<<8};o.prototype.readUint16BE=o.prototype.readUInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);return this[$]<<8|this[$+1]};o.prototype.readUint32LE=o.prototype.readUInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216};o.prototype.readUint32BE=o.prototype.readUInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])};o.prototype.readBigUInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q+this[++$]*256+this[++$]*65536+this[++$]*16777216,J=this[++$]+this[++$]*256+this[++$]*65536+Q*16777216;return BigInt(K)+(BigInt(J)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=q*16777216+this[++$]*65536+this[++$]*256+this[++$],J=this[++$]*16777216+this[++$]*65536+this[++$]*256+Q;return(BigInt(K)<>>0,q=q>>>0,!Q)b0($,q,this.length);let K=this[$],J=1,Z=0;while(++Z=J)K-=Math.pow(2,8*q);return K};o.prototype.readIntBE=function($,q,Q){if($=$>>>0,q=q>>>0,!Q)b0($,q,this.length);let K=q,J=1,Z=this[$+--K];while(K>0&&(J*=256))Z+=this[$+--K]*J;if(J*=128,Z>=J)Z-=Math.pow(2,8*q);return Z};o.prototype.readInt8=function($,q){if($=$>>>0,!q)b0($,1,this.length);if(!(this[$]&128))return this[$];return(255-this[$]+1)*-1};o.prototype.readInt16LE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$]|this[$+1]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt16BE=function($,q){if($=$>>>0,!q)b0($,2,this.length);let Q=this[$+1]|this[$]<<8;return Q&32768?Q|4294901760:Q};o.prototype.readInt32LE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24};o.prototype.readInt32BE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]};o.prototype.readBigInt64LE=l2(function($){$=$>>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=this[$+4]+this[$+5]*256+this[$+6]*65536+(Q<<24);return(BigInt(K)<>>0,n1($,"offset");let q=this[$],Q=this[$+7];if(q===void 0||Q===void 0)h6($,this.length-8);let K=(q<<24)+this[++$]*65536+this[++$]*256+this[++$];return(BigInt(K)<>>0,!q)b0($,4,this.length);return Y8(this,$,!0,23,4)};o.prototype.readFloatBE=function($,q){if($=$>>>0,!q)b0($,4,this.length);return Y8(this,$,!1,23,4)};o.prototype.readDoubleLE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!0,52,8)};o.prototype.readDoubleBE=function($,q){if($=$>>>0,!q)b0($,8,this.length);return Y8(this,$,!1,52,8)};o.prototype.writeUintLE=o.prototype.writeUIntLE=function($,q,Q,K){if($=+$,q=q>>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=1,Z=0;this[q]=$&255;while(++Z>>0,Q=Q>>>0,!K){let G=Math.pow(2,8*Q)-1;s0(this,$,q,Q,G,0)}let J=Q-1,Z=1;this[q+J]=$&255;while(--J>=0&&(Z*=256))this[q+J]=$/Z&255;return q+Q};o.prototype.writeUint8=o.prototype.writeUInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,255,0);return this[q]=$&255,q+1};o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,65535,0);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q+3]=$>>>24,this[q+2]=$>>>16,this[q+1]=$>>>8,this[q]=$&255,q+4};o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,4294967295,0);return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigUInt64LE=l2(function($,q=0){return H9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeBigUInt64BE=l2(function($,q=0){return v9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});o.prototype.writeIntLE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=0,Z=1,G=0;this[q]=$&255;while(++J>0)-G&255}return q+Q};o.prototype.writeIntBE=function($,q,Q,K){if($=+$,q=q>>>0,!K){let W=Math.pow(2,8*Q-1);s0(this,$,q,Q,W-1,-W)}let J=Q-1,Z=1,G=0;this[q+J]=$&255;while(--J>=0&&(Z*=256)){if($<0&&G===0&&this[q+J+1]!==0)G=1;this[q+J]=($/Z>>0)-G&255}return q+Q};o.prototype.writeInt8=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,1,127,-128);if($<0)$=255+$+1;return this[q]=$&255,q+1};o.prototype.writeInt16LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$&255,this[q+1]=$>>>8,q+2};o.prototype.writeInt16BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,2,32767,-32768);return this[q]=$>>>8,this[q+1]=$&255,q+2};o.prototype.writeInt32LE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);return this[q]=$&255,this[q+1]=$>>>8,this[q+2]=$>>>16,this[q+3]=$>>>24,q+4};o.prototype.writeInt32BE=function($,q,Q){if($=+$,q=q>>>0,!Q)s0(this,$,q,4,2147483647,-2147483648);if($<0)$=4294967295+$+1;return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};o.prototype.writeBigInt64LE=l2(function($,q=0){return H9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeBigInt64BE=l2(function($,q=0){return v9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});o.prototype.writeFloatLE=function($,q,Q){return R9(this,$,q,!0,Q)};o.prototype.writeFloatBE=function($,q,Q){return R9(this,$,q,!1,Q)};o.prototype.writeDoubleLE=function($,q,Q){return I9(this,$,q,!0,Q)};o.prototype.writeDoubleBE=function($,q,Q){return I9(this,$,q,!1,Q)};o.prototype.copy=function($,q,Q,K){if(!o.isBuffer($))throw TypeError("argument should be a Buffer");if(!Q)Q=0;if(!K&&K!==0)K=this.length;if(q>=$.length)q=$.length;if(!q)q=0;if(K>0&&K=this.length)throw RangeError("Index out of range");if(K<0)throw RangeError("sourceEnd out of bounds");if(K>this.length)K=this.length;if($.length-q>>0,Q=Q===void 0?this.length:Q>>>0,!$)$=0;let J;if(typeof $==="number")for(J=q;J{var S0=y9.exports={},j2,g2;function u5(){throw Error("setTimeout has not been defined")}function S5(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")j2=setTimeout;else j2=u5}catch($){j2=u5}try{if(typeof clearTimeout==="function")g2=clearTimeout;else g2=S5}catch($){g2=S5}})();function g9($){if(j2===setTimeout)return setTimeout($,0);if((j2===u5||!j2)&&setTimeout)return j2=setTimeout,setTimeout($,0);try{return j2($,0)}catch(q){try{return j2.call(null,$,0)}catch(Q){return j2.call(this,$,0)}}}function NV($){if(g2===clearTimeout)return clearTimeout($);if((g2===S5||!g2)&&clearTimeout)return g2=clearTimeout,clearTimeout($);try{return g2($)}catch(q){try{return g2.call(null,$)}catch(Q){return g2.call(this,$)}}}var E2=[],d1=!1,N1,D8=-1;function YV(){if(!d1||!N1)return;if(d1=!1,N1.length)E2=N1.concat(E2);else D8=-1;if(E2.length)A9()}function A9(){if(d1)return;var $=g9(YV);d1=!0;var q=E2.length;while(q){N1=E2,E2=[];while(++D81)for(var Q=1;Qn9,once:()=>c9,listenerCount:()=>d9,init:()=>r2,getMaxListeners:()=>p9,getEventListeners:()=>b9,default:()=>CV,captureRejectionSymbol:()=>u9,addAbortListener:()=>i9,EventEmitter:()=>r2});function S9($,q){var{_events:Q}=$;if(q[0]??=Error("Unhandled error."),!Q)throw q[0];var K=Q[T9];if(K)for(var J of O9.call(K))J.apply($,q);var Z=Q.error;if(!Z)throw q[0];for(var J of O9.call(Z))J.apply($,q);return!0}function LV($,q,Q,K){q.then(void 0,function(J){queueMicrotask(()=>HV($,J,Q,K))})}function HV($,q,Q,K){if(typeof $[x9]==="function")$[x9](q,Q,...K);else try{$[Y1]=!1,$.emit("error",q)}finally{$[Y1]=!0}}function E9($,q,Q){Q.warned=!0;let K=Error(`Possible EventEmitter memory leak detected. ${Q.length} ${String(q)} listeners added to [${$.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=$,K.type=q,K.count=Q.length,console.warn(K)}function _9($,q,...Q){this.removeListener($,q),q.apply(this,Q)}function c9($,q,Q){var K=Q?.signal;if(m9(K,"options.signal"),K?.aborted)throw new E5(void 0,{cause:K?.reason});let{resolve:J,reject:Z,promise:G}=$newPromiseCapability(Promise),W=(U)=>{if($.removeListener(q,B),K!=null)L8(K,"abort",V);Z(U)},B=(...U)=>{if(typeof $.removeListener==="function")$.removeListener("error",W);if(K!=null)L8(K,"abort",V);J(U)};if(P9($,q,B,{once:!0}),q!=="error"&&typeof $.once==="function")$.once("error",W);function V(){L8($,q,B),L8($,"error",W),Z(new E5(void 0,{cause:K?.reason}))}if(K!=null)P9(K,"abort",V,{once:!0});return G}function b9($,q){return $.listeners(q)}function n9($,...q){c5($,"setMaxListeners",0);var Q;if(q&&(Q=q.length))for(let K=0;KK||(Q!=null||K!=null)&&Number.isNaN($))throw RV(q,`${Q!=null?`>= ${Q}`:""}${Q!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,$)}function x6($){if(typeof $!=="function")throw TypeError("The listener must be a function")}function IV($,q){if(typeof $!=="boolean")throw m1(q,"boolean",$)}function p9($){return $?._maxListeners??k1}function i9($,q){if($===void 0)throw m1("signal","AbortSignal",$);if(m9($,"signal"),typeof q!=="function")throw m1("listener","function",q);let Q;if($.aborted)queueMicrotask(()=>q());else $.addEventListener("abort",q,{__proto__:null,once:!0}),Q=()=>{$.removeEventListener("abort",q)};return{__proto__:null,[Symbol.dispose](){Q?.()}}}var _5,Y1,T9,kV,DV,x9,u9,O9,k1=10,r2=function($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[Y1]=$?.captureRejections?Boolean($?.captureRejections):y0[Y1])this.emit=fV},y0,vV=function($,...q){if($==="error")return S9(this,q);var{_events:Q}=this;if(Q===void 0)return!1;var K=Q[$];if(K===void 0)return!1;let J=K.length>1?K.slice():K;for(let Z=0,{length:G}=J;Z1?K.slice():K;for(let Z=0,{length:G}=J;Z{_5=Symbol.for,Y1=Symbol("kCapture"),T9=_5("events.errorMonitor"),kV=Symbol("events.maxEventTargetListeners"),DV=Symbol("events.maxEventTargetListenersWarned"),x9=_5("nodejs.rejection"),u9=_5("nodejs.rejection"),O9=Array.prototype.slice,y0=r2.prototype={};y0._events=void 0;y0._eventsCount=0;y0._maxListeners=void 0;y0.setMaxListeners=function($){return c5($,"setMaxListeners",0),this._maxListeners=$,this};y0.constructor=r2;y0.getMaxListeners=function(){return this?._maxListeners??k1};y0.emit=vV;y0.addListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.push(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.on=y0.addListener;y0.prependListener=function($,q){x6(q);var Q=this._events;if(!Q)Q=this._events={__proto__:null},this._eventsCount=0;else if(Q.newListener)this.emit("newListener",$,q.listener??q);var K=Q[$];if(!K)Q[$]=[q],this._eventsCount++;else{K.unshift(q);var J=this._maxListeners??k1;if(J>0&&K.length>J&&!K.warned)E9(this,$,K)}return this};y0.once=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.addListener($,Q),this};y0.prependOnceListener=function($,q){x6(q);let Q=_9.bind(this,$,q);return Q.listener=q,this.prependListener($,Q),this};y0.removeListener=function($,q){x6(q);var{_events:Q}=this;if(!Q)return this;var K=Q[$];if(!K)return this;var J=K.length;let Z=-1;for(let G=J-1;G>=0;G--)if(K[G]===q||K[G].listener===q){Z=G;break}if(Z<0)return this;if(Z===0)K.shift();else K.splice(Z,1);if(K.length===0)delete Q[$],this._eventsCount--;return this};y0.off=y0.removeListener;y0.removeAllListeners=function($){var{_events:q}=this;if($&&q){if(q[$])delete q[$],this._eventsCount--}else this._events={__proto__:null};return this};y0.listeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.map((K)=>K.listener??K)};y0.rawListeners=function($){var{_events:q}=this;if(!q)return[];var Q=q[$];if(!Q)return[];return Q.slice()};y0.listenerCount=function($){var{_events:q}=this;if(!q)return 0;return q[$]?.length??0};y0.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};y0[Y1]=!1;E5=class E5 extends Error{constructor($="The operation was aborted",q=void 0){if(q!==void 0&&typeof q!=="object")throw m1("options","Object",q);super($,q);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(r2,{captureRejections:{get(){return y0[Y1]},set($){IV($,"EventEmitter.captureRejections"),y0[Y1]=$},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return k1},set:($)=>{c5($,"defaultMaxListeners",0),k1=$}},kMaxEventTargetListeners:{value:kV,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:DV,enumerable:!1,configurable:!1,writable:!1}});Object.assign(r2,{once:c9,getEventListeners:b9,getMaxListeners:p9,setMaxListeners:n9,EventEmitter:r2,usingDomains:!1,captureRejectionSymbol:u9,errorMonitor:T9,addAbortListener:i9,init:r2,listenerCount:d9});CV=r2});var a1=N0((Bz,$$)=>{var g0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),P0=g0(($,q)=>{class Q extends Error{constructor(K){if(!Array.isArray(K))throw TypeError(`Expected input to be an Array, got ${typeof K}`);let J="";for(let Z=0;Z{q.exports={format(Q,...K){return Q.replace(/%([sdifj])/g,function(...[J,Z]){let G=K.shift();if(Z==="f")return G.toFixed(6);else if(Z==="j")return JSON.stringify(G);else if(Z==="s"&&typeof G==="object")return`${G.constructor!==Object?G.constructor.name:""} {}`.trim();else return G.toString()})},inspect(Q){switch(typeof Q){case"string":if(Q.includes("'")){if(!Q.includes('"'))return`"${Q}"`;else if(!Q.includes("`")&&!Q.includes("${"))return`\`${Q}\``}return`'${Q}'`;case"number":if(isNaN(Q))return"NaN";else if(Object.is(Q,-0))return String(Q);return Q;case"bigint":return`${String(Q)}n`;case"boolean":case"undefined":return String(Q);case"object":return"{}"}}}}),a0=g0(($,q)=>{var{format:Q,inspect:K}=o9(),{AggregateError:J}=P0(),Z=globalThis.AggregateError||J,G=Symbol("kIsNodeError"),W=["string","function","number","object","Function","Object","boolean","bigint","symbol"],B=/^([A-Z][a-z0-9]*)+$/,V={};function U(D,z){if(!D)throw new V.ERR_INTERNAL_ASSERTION(z)}function w(D){let z="",N=D.length,H=D[0]==="-"?1:0;for(;N>=H+4;N-=3)z=`_${D.slice(N-3,N)}${z}`;return`${D.slice(0,N)}${z}`}function F(D,z,N){if(typeof z==="function")return U(z.length<=N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${z.length}).`),z(...N);let H=(z.match(/%[dfijoOs]/g)||[]).length;if(U(H===N.length,`Code: ${D}; The provided arguments length (${N.length}) does not match the required ones (${H}).`),N.length===0)return z;return Q(z,...N)}function M(D,z,N){if(!N)N=Error;class H extends N{constructor(...v){super(F(D,z,v))}toString(){return`${this.name} [${D}]: ${this.message}`}}Object.defineProperties(H.prototype,{name:{value:N.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${D}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),H.prototype.code=D,H.prototype[G]=!0,V[D]=H}function k(D){let z="__node_internal_"+D.name;return Object.defineProperty(D,"name",{value:z}),D}function f(D,z){if(D&&z&&D!==z){if(Array.isArray(z.errors))return z.errors.push(D),z;let N=new Z([z,D],z.message);return N.code=z.code,N}return D||z}class L extends Error{constructor(D="The operation was aborted",z=void 0){if(z!==void 0&&typeof z!=="object")throw new V.ERR_INVALID_ARG_TYPE("options","Object",z);super(D,z);this.code="ABORT_ERR",this.name="AbortError"}}M("ERR_ASSERTION","%s",Error),M("ERR_INVALID_ARG_TYPE",(D,z,N)=>{if(U(typeof D==="string","'name' must be a string"),!Array.isArray(z))z=[z];let H="The ";if(D.endsWith(" argument"))H+=`${D} `;else H+=`"${D}" ${D.includes(".")?"property":"argument"} `;H+="must be ";let v=[],j=[],n=[];for(let _ of z)if(U(typeof _==="string","All expected entries have to be of type string"),W.includes(_))v.push(_.toLowerCase());else if(B.test(_))j.push(_);else U(_!=="object",'The value "object" should be written as "Object"'),n.push(_);if(j.length>0){let _=v.indexOf("object");if(_!==-1)v.splice(v,_,1),j.push("Object")}if(v.length>0){switch(v.length){case 1:H+=`of type ${v[0]}`;break;case 2:H+=`one of type ${v[0]} or ${v[1]}`;break;default:{let _=v.pop();H+=`one of type ${v.join(", ")}, or ${_}`}}if(j.length>0||n.length>0)H+=" or "}if(j.length>0){switch(j.length){case 1:H+=`an instance of ${j[0]}`;break;case 2:H+=`an instance of ${j[0]} or ${j[1]}`;break;default:{let _=j.pop();H+=`an instance of ${j.join(", ")}, or ${_}`}}if(n.length>0)H+=" or "}switch(n.length){case 0:break;case 1:if(n[0].toLowerCase()!==n[0])H+="an ";H+=`${n[0]}`;break;case 2:H+=`one of ${n[0]} or ${n[1]}`;break;default:{let _=n.pop();H+=`one of ${n.join(", ")}, or ${_}`}}if(N==null)H+=`. Received ${N}`;else if(typeof N==="function"&&N.name)H+=`. Received function ${N.name}`;else if(typeof N==="object"){var d;if((d=N.constructor)!==null&&d!==void 0&&d.name)H+=`. Received an instance of ${N.constructor.name}`;else{let _=K(N,{depth:-1});H+=`. Received ${_}`}}else{let _=K(N,{colors:!1});if(_.length>25)_=`${_.slice(0,25)}...`;H+=`. Received type ${typeof N} (${_})`}return H},TypeError),M("ERR_INVALID_ARG_VALUE",(D,z,N="is invalid")=>{let H=K(z);if(H.length>128)H=H.slice(0,128)+"...";return`The ${D.includes(".")?"property":"argument"} '${D}' ${N}. Received ${H}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(D,z,N)=>{var H;let v=N!==null&&N!==void 0&&(H=N.constructor)!==null&&H!==void 0&&H.name?`instance of ${N.constructor.name}`:`type ${typeof N}`;return`Expected ${D} to be returned from the "${z}" function but got ${v}.`},TypeError),M("ERR_MISSING_ARGS",(...D)=>{U(D.length>0,"At least one arg needs to be specified");let z,N=D.length;switch(D=(Array.isArray(D)?D:[D]).map((H)=>`"${H}"`).join(" or "),N){case 1:z+=`The ${D[0]} argument`;break;case 2:z+=`The ${D[0]} and ${D[1]} arguments`;break;default:{let H=D.pop();z+=`The ${D.join(", ")}, and ${H} arguments`}break}return`${z} must be specified`},TypeError),M("ERR_OUT_OF_RANGE",(D,z,N)=>{U(z,'Missing "range" argument');let H;if(Number.isInteger(N)&&Math.abs(N)>4294967296)H=w(String(N));else if(typeof N==="bigint"){H=String(N);let v=BigInt(2)**BigInt(32);if(N>v||N<-v)H=w(H);H+="n"}else H=K(N);return`The value of "${D}" is out of range. It must be ${z}. Received ${H}`},RangeError),M("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),M("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),M("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),M("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),M("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),M("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),M("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),M("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),M("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),M("ERR_STREAM_WRITE_AFTER_END","write after end",Error),M("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),q.exports={AbortError:L,aggregateTwoErrors:k(f),hideStackFrames:k,codes:V}}),jV=g0(($,q)=>{Object.defineProperty($,"__esModule",{value:!0});var Q=new WeakMap,K=new WeakMap;function J(X){let P=Q.get(X);return console.assert(P!=null,"'this' is expected an Event object, but got",X),P}function Z(X){if(X.passiveListener!=null){if(typeof console<"u"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",X.passiveListener);return}if(!X.event.cancelable)return;if(X.canceled=!0,typeof X.event.preventDefault==="function")X.event.preventDefault()}function G(X,P){Q.set(this,{eventTarget:X,event:P,eventPhase:2,currentTarget:X,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:P.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let g=Object.keys(P);for(let c=0;c0){let X=Array(arguments.length);for(let P=0;P{Object.defineProperty($,"__esModule",{value:!0});var Q=jV();class K extends Q.EventTarget{constructor(){super();throw TypeError("AbortSignal cannot be constructed directly")}get aborted(){let U=G.get(this);if(typeof U!=="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return U}}Q.defineEventAttribute(K.prototype,"abort");function J(){let U=Object.create(K.prototype);return Q.EventTarget.call(U),G.set(U,!1),U}function Z(U){if(G.get(U)!==!1)return;G.set(U,!0),U.dispatchEvent({type:"abort"})}var G=new WeakMap;if(Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class W{constructor(){B.set(this,J())}get signal(){return V(this)}abort(){Z(V(this))}}var B=new WeakMap;function V(U){let w=B.get(U);if(w==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${U===null?"null":typeof U}`);return w}if(Object.defineProperties(W.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(W.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});$.AbortController=W,$.AbortSignal=K,$.default=W,q.exports=W,q.exports.AbortController=q.exports.default=W,q.exports.AbortSignal=K}),e0=g0(($,q)=>{var Q=(t0(),X0(K2)),{format:K,inspect:J}=o9(),{codes:{ERR_INVALID_ARG_TYPE:Z}}=a0(),{kResistStopPropagation:G,AggregateError:W,SymbolDispose:B}=P0(),V=globalThis.AbortSignal||O6().AbortSignal,U=globalThis.AbortController||O6().AbortController,w=Object.getPrototypeOf(async function(){}).constructor,F=globalThis.Blob||Q.Blob,M=typeof F<"u"?function(L){return L instanceof F}:function(L){return!1},k=(L,D)=>{if(L!==void 0&&(L===null||typeof L!=="object"||!("aborted"in L)))throw new Z(D,"AbortSignal",L)},f=(L,D)=>{if(typeof L!=="function")throw new Z(D,"Function",L)};q.exports={AggregateError:W,kEmptyObject:Object.freeze({}),once(L){let D=!1;return function(...z){if(D)return;D=!0,L.apply(this,z)}},createDeferredPromise:function(){let L,D;return{promise:new Promise((z,N)=>{L=z,D=N}),resolve:L,reject:D}},promisify(L){return new Promise((D,z)=>{L((N,...H)=>{if(N)return z(N);return D(...H)})})},debuglog(){return function(){}},format:K,inspect:J,types:{isAsyncFunction(L){return L instanceof w},isArrayBufferView(L){return ArrayBuffer.isView(L)}},isBlob:M,deprecate(L,D){return L},addAbortListener:(i1(),X0(p1)).addAbortListener||function(L,D){if(L===void 0)throw new Z("signal","AbortSignal",L);k(L,"signal"),f(D,"listener");let z;if(L.aborted)queueMicrotask(()=>D());else L.addEventListener("abort",D,{__proto__:null,once:!0,[G]:!0}),z=()=>{L.removeEventListener("abort",D)};return{__proto__:null,[B](){var N;(N=z)===null||N===void 0||N()}}},AbortSignalAny:V.any||function(L){if(L.length===1)return L[0];let D=new U,z=()=>D.abort();return L.forEach((N)=>{k(N,"signals"),N.addEventListener("abort",z,{once:!0})}),D.signal.addEventListener("abort",()=>{L.forEach((N)=>N.removeEventListener("abort",z))},{once:!0}),D.signal}},q.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),P6=g0(($,q)=>{var{ArrayIsArray:Q,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:J,ArrayPrototypeMap:Z,NumberIsInteger:G,NumberIsNaN:W,NumberMAX_SAFE_INTEGER:B,NumberMIN_SAFE_INTEGER:V,NumberParseInt:U,ObjectPrototypeHasOwnProperty:w,RegExpPrototypeExec:F,String:M,StringPrototypeToUpperCase:k,StringPrototypeTrim:f}=P0(),{hideStackFrames:L,codes:{ERR_SOCKET_BAD_PORT:D,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:N,ERR_OUT_OF_RANGE:H,ERR_UNKNOWN_SIGNAL:v}}=a0(),{normalizeEncoding:j}=e0(),{isAsyncFunction:n,isArrayBufferView:d}=e0().types,_={};function X(T){return T===(T|0)}function P(T){return T===T>>>0}var g=/^[0-7]+$/,c="must be a 32-bit unsigned integer or an octal string";function h(T,t,G0){if(typeof T>"u")T=G0;if(typeof T==="string"){if(F(g,T)===null)throw new N(t,T,c);T=U(T,8)}return $0(T,t),T}var x=L((T,t,G0=V,Q0=B)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),l=L((T,t,G0=-2147483648,Q0=2147483647)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);if(TQ0)throw new H(t,`>= ${G0} && <= ${Q0}`,T)}),$0=L((T,t,G0=!1)=>{if(typeof T!=="number")throw new z(t,"number",T);if(!G(T))throw new H(t,"an integer",T);let Q0=G0?1:0,M0=4294967295;if(TM0)throw new H(t,`>= ${Q0} && <= ${M0}`,T)});function Z0(T,t){if(typeof T!=="string")throw new z(t,"string",T)}function F0(T,t,G0=void 0,Q0){if(typeof T!=="number")throw new z(t,"number",T);if(G0!=null&&TQ0||(G0!=null||Q0!=null)&&W(T))throw new H(t,`${G0!=null?`>= ${G0}`:""}${G0!=null&&Q0!=null?" && ":""}${Q0!=null?`<= ${Q0}`:""}`,T)}var p=L((T,t,G0)=>{if(!K(G0,T)){let Q0="must be one of: "+J(Z(G0,(M0)=>typeof M0==="string"?`'${M0}'`:M(M0)),", ");throw new N(t,T,Q0)}});function W0(T,t){if(typeof T!=="boolean")throw new z(t,"boolean",T)}function y(T,t,G0){return T==null||!w(T,t)?G0:T[t]}var i=L((T,t,G0=null)=>{let Q0=y(G0,"allowArray",!1),M0=y(G0,"allowFunction",!1);if(!y(G0,"nullable",!1)&&T===null||!Q0&&Q(T)||typeof T!=="object"&&(!M0||typeof T!=="function"))throw new z(t,"Object",T)}),U0=L((T,t)=>{if(T!=null&&typeof T!=="object"&&typeof T!=="function")throw new z(t,"a dictionary",T)}),m=L((T,t,G0=0)=>{if(!Q(T))throw new z(t,"Array",T);if(T.length{if(!d(T))throw new z(t,["Buffer","TypedArray","DataView"],T)});function E(T,t){let G0=j(t),Q0=T.length;if(G0==="hex"&&Q0%2!==0)throw new N("encoding",t,`is invalid for data of length ${Q0}`)}function a(T,t="Port",G0=!0){if(typeof T!=="number"&&typeof T!=="string"||typeof T==="string"&&f(T).length===0||+T!==+T>>>0||T>65535||T===0&&!G0)throw new D(t,T,G0);return T|0}var K0=L((T,t)=>{if(T!==void 0&&(T===null||typeof T!=="object"||!("aborted"in T)))throw new z(t,"AbortSignal",T)}),R=L((T,t)=>{if(typeof T!=="function")throw new z(t,"Function",T)}),Y=L((T,t)=>{if(typeof T!=="function"||n(T))throw new z(t,"Function",T)}),C=L((T,t)=>{if(T!==void 0)throw new z(t,"undefined",T)});function u(T,t,G0){if(!K(G0,T))throw new z(t,`('${J(G0,"|")}')`,T)}var e=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function r(T,t){if(typeof T>"u"||!F(e,T))throw new N(t,T,'must be an array or string of format "; rel=preload; as=style"')}function s(T){if(typeof T==="string")return r(T,"hints"),T;else if(Q(T)){let t=T.length,G0="";if(t===0)return G0;for(let Q0=0;Q0; rel=preload; as=style"')}q.exports={isInt32:X,isUint32:P,parseFileMode:h,validateArray:m,validateStringArray:V0,validateBooleanArray:w0,validateAbortSignalArray:S,validateBoolean:W0,validateBuffer:O,validateDictionary:U0,validateEncoding:E,validateFunction:R,validateInt32:l,validateInteger:x,validateNumber:F0,validateObject:i,validateOneOf:p,validatePlainFunction:Y,validatePort:a,validateSignalName:b,validateString:Z0,validateUint32:$0,validateUndefined:C,validateUnion:u,validateAbortSignal:K0,validateLinkHeaderValue:s}}),D1=g0(($,q)=>{q.exports=globalThis.process}),b2=g0(($,q)=>{var{SymbolAsyncIterator:Q,SymbolIterator:K,SymbolFor:J}=P0(),Z=J("nodejs.stream.destroyed"),G=J("nodejs.stream.errored"),W=J("nodejs.stream.readable"),B=J("nodejs.stream.writable"),V=J("nodejs.stream.disturbed"),U=J("nodejs.webstream.isClosedPromise"),w=J("nodejs.webstream.controllerErrorFunction");function F(y,i=!1){var U0;return!!(y&&typeof y.pipe==="function"&&typeof y.on==="function"&&(!i||typeof y.pause==="function"&&typeof y.resume==="function")&&(!y._writableState||((U0=y._readableState)===null||U0===void 0?void 0:U0.readable)!==!1)&&(!y._writableState||y._readableState))}function M(y){var i;return!!(y&&typeof y.write==="function"&&typeof y.on==="function"&&(!y._readableState||((i=y._writableState)===null||i===void 0?void 0:i.writable)!==!1))}function k(y){return!!(y&&typeof y.pipe==="function"&&y._readableState&&typeof y.on==="function"&&typeof y.write==="function")}function f(y){return y&&(y._readableState||y._writableState||typeof y.write==="function"&&typeof y.on==="function"||typeof y.pipe==="function"&&typeof y.on==="function")}function L(y){return!!(y&&!f(y)&&typeof y.pipeThrough==="function"&&typeof y.getReader==="function"&&typeof y.cancel==="function")}function D(y){return!!(y&&!f(y)&&typeof y.getWriter==="function"&&typeof y.abort==="function")}function z(y){return!!(y&&!f(y)&&typeof y.readable==="object"&&typeof y.writable==="object")}function N(y){return L(y)||D(y)||z(y)}function H(y,i){if(y==null)return!1;if(i===!0)return typeof y[Q]==="function";if(i===!1)return typeof y[K]==="function";return typeof y[Q]==="function"||typeof y[K]==="function"}function v(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!!(y.destroyed||y[Z]||m!==null&&m!==void 0&&m.destroyed)}function j(y){if(!M(y))return null;if(y.writableEnded===!0)return!0;let i=y._writableState;if(i!==null&&i!==void 0&&i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function n(y,i){if(!M(y))return null;if(y.writableFinished===!0)return!0;let U0=y._writableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.finished)!=="boolean")return null;return!!(U0.finished||i===!1&&U0.ended===!0&&U0.length===0)}function d(y){if(!F(y))return null;if(y.readableEnded===!0)return!0;let i=y._readableState;if(!i||i.errored)return!1;if(typeof(i===null||i===void 0?void 0:i.ended)!=="boolean")return null;return i.ended}function _(y,i){if(!F(y))return null;let U0=y._readableState;if(U0!==null&&U0!==void 0&&U0.errored)return!1;if(typeof(U0===null||U0===void 0?void 0:U0.endEmitted)!=="boolean")return null;return!!(U0.endEmitted||i===!1&&U0.ended===!0&&U0.length===0)}function X(y){if(y&&y[W]!=null)return y[W];if(typeof(y===null||y===void 0?void 0:y.readable)!=="boolean")return null;if(v(y))return!1;return F(y)&&y.readable&&!_(y)}function P(y){if(y&&y[B]!=null)return y[B];if(typeof(y===null||y===void 0?void 0:y.writable)!=="boolean")return null;if(v(y))return!1;return M(y)&&y.writable&&!j(y)}function g(y,i){if(!f(y))return null;if(v(y))return!0;if((i===null||i===void 0?void 0:i.readable)!==!1&&X(y))return!1;if((i===null||i===void 0?void 0:i.writable)!==!1&&P(y))return!1;return!0}function c(y){var i,U0;if(!f(y))return null;if(y.writableErrored)return y.writableErrored;return(i=(U0=y._writableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function h(y){var i,U0;if(!f(y))return null;if(y.readableErrored)return y.readableErrored;return(i=(U0=y._readableState)===null||U0===void 0?void 0:U0.errored)!==null&&i!==void 0?i:null}function x(y){if(!f(y))return null;if(typeof y.closed==="boolean")return y.closed;let{_writableState:i,_readableState:U0}=y;if(typeof(i===null||i===void 0?void 0:i.closed)==="boolean"||typeof(U0===null||U0===void 0?void 0:U0.closed)==="boolean")return(i===null||i===void 0?void 0:i.closed)||(U0===null||U0===void 0?void 0:U0.closed);if(typeof y._closed==="boolean"&&l(y))return y._closed;return null}function l(y){return typeof y._closed==="boolean"&&typeof y._defaultKeepAlive==="boolean"&&typeof y._removedConnection==="boolean"&&typeof y._removedContLen==="boolean"}function $0(y){return typeof y._sent100==="boolean"&&l(y)}function Z0(y){var i;return typeof y._consuming==="boolean"&&typeof y._dumped==="boolean"&&((i=y.req)===null||i===void 0?void 0:i.upgradeOrConnect)===void 0}function F0(y){if(!f(y))return null;let{_writableState:i,_readableState:U0}=y,m=i||U0;return!m&&$0(y)||!!(m&&m.autoDestroy&&m.emitClose&&m.closed===!1)}function p(y){var i;return!!(y&&((i=y[V])!==null&&i!==void 0?i:y.readableDidRead||y.readableAborted))}function W0(y){var i,U0,m,V0,w0,S,b,O,E,a;return!!(y&&((i=(U0=(m=(V0=(w0=(S=y[G])!==null&&S!==void 0?S:y.readableErrored)!==null&&w0!==void 0?w0:y.writableErrored)!==null&&V0!==void 0?V0:(b=y._readableState)===null||b===void 0?void 0:b.errorEmitted)!==null&&m!==void 0?m:(O=y._writableState)===null||O===void 0?void 0:O.errorEmitted)!==null&&U0!==void 0?U0:(E=y._readableState)===null||E===void 0?void 0:E.errored)!==null&&i!==void 0?i:(a=y._writableState)===null||a===void 0?void 0:a.errored))}q.exports={isDestroyed:v,kIsDestroyed:Z,isDisturbed:p,kIsDisturbed:V,isErrored:W0,kIsErrored:G,isReadable:X,kIsReadable:W,kIsClosedPromise:U,kControllerErrorFunction:w,kIsWritable:B,isClosed:x,isDuplexNodeStream:k,isFinished:g,isIterable:H,isReadableNodeStream:F,isReadableStream:L,isReadableEnded:d,isReadableFinished:_,isReadableErrored:h,isNodeStream:f,isWebStream:N,isWritable:P,isWritableNodeStream:M,isWritableStream:D,isWritableEnded:j,isWritableFinished:n,isWritableErrored:c,isServerRequest:Z0,isServerResponse:$0,willEmitClose:F0,isTransformStream:z}}),s2=g0(($,q)=>{var Q=D1(),{AbortError:K,codes:J}=a0(),{ERR_INVALID_ARG_TYPE:Z,ERR_STREAM_PREMATURE_CLOSE:G}=J,{kEmptyObject:W,once:B}=e0(),{validateAbortSignal:V,validateFunction:U,validateObject:w,validateBoolean:F}=P6(),{Promise:M,PromisePrototypeThen:k,SymbolDispose:f}=P0(),{isClosed:L,isReadable:D,isReadableNodeStream:z,isReadableStream:N,isReadableFinished:H,isReadableErrored:v,isWritable:j,isWritableNodeStream:n,isWritableStream:d,isWritableFinished:_,isWritableErrored:X,isNodeStream:P,willEmitClose:g,kIsClosedPromise:c}=b2(),h;function x(p){return p.setHeader&&typeof p.abort==="function"}var l=()=>{};function $0(p,W0,y){var i,U0;if(arguments.length===2)y=W0,W0=W;else if(W0==null)W0=W;else w(W0,"options");if(U(y,"callback"),V(W0.signal,"options.signal"),y=B(y),N(p)||d(p))return Z0(p,W0,y);if(!P(p))throw new Z("stream",["ReadableStream","WritableStream","Stream"],p);let m=(i=W0.readable)!==null&&i!==void 0?i:z(p),V0=(U0=W0.writable)!==null&&U0!==void 0?U0:n(p),w0=p._writableState,S=p._readableState,b=()=>{if(!p.writable)a()},O=g(p)&&z(p)===m&&n(p)===V0,E=_(p,!1),a=()=>{if(E=!0,p.destroyed)O=!1;if(O&&(!p.readable||m))return;if(!m||K0)y.call(p)},K0=H(p,!1),R=()=>{if(K0=!0,p.destroyed)O=!1;if(O&&(!p.writable||V0))return;if(!V0||E)y.call(p)},Y=(T)=>{y.call(p,T)},C=L(p),u=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);if(m&&!K0&&z(p,!0)){if(!H(p,!1))return y.call(p,new G)}if(V0&&!E){if(!_(p,!1))return y.call(p,new G)}y.call(p)},e=()=>{C=!0;let T=X(p)||v(p);if(T&&typeof T!=="boolean")return y.call(p,T);y.call(p)},r=()=>{p.req.on("finish",a)};if(x(p)){if(p.on("complete",a),!O)p.on("abort",u);if(p.req)r();else p.on("request",r)}else if(V0&&!w0)p.on("end",b),p.on("close",b);if(!O&&typeof p.aborted==="boolean")p.on("aborted",u);if(p.on("end",R),p.on("finish",a),W0.error!==!1)p.on("error",Y);if(p.on("close",u),C)Q.nextTick(u);else if(w0!==null&&w0!==void 0&&w0.errorEmitted||S!==null&&S!==void 0&&S.errorEmitted){if(!O)Q.nextTick(e)}else if(!m&&(!O||D(p))&&(E||j(p)===!1))Q.nextTick(e);else if(!V0&&(!O||j(p))&&(K0||D(p)===!1))Q.nextTick(e);else if(S&&p.req&&p.aborted)Q.nextTick(e);let s=()=>{if(y=l,p.removeListener("aborted",u),p.removeListener("complete",a),p.removeListener("abort",u),p.removeListener("request",r),p.req)p.req.removeListener("finish",a);p.removeListener("end",b),p.removeListener("close",b),p.removeListener("finish",a),p.removeListener("end",R),p.removeListener("error",Y),p.removeListener("close",u)};if(W0.signal&&!C){let T=()=>{let t=y;s(),t.call(p,new K(void 0,{cause:W0.signal.reason}))};if(W0.signal.aborted)Q.nextTick(T);else{h=h||e0().addAbortListener;let t=h(W0.signal,T),G0=y;y=B((...Q0)=>{t[f](),G0.apply(p,Q0)})}}return s}function Z0(p,W0,y){let i=!1,U0=l;if(W0.signal)if(U0=()=>{i=!0,y.call(p,new K(void 0,{cause:W0.signal.reason}))},W0.signal.aborted)Q.nextTick(U0);else{h=h||e0().addAbortListener;let V0=h(W0.signal,U0),w0=y;y=B((...S)=>{V0[f](),w0.apply(p,S)})}let m=(...V0)=>{if(!i)Q.nextTick(()=>y.apply(p,V0))};return k(p[c].promise,m,m),l}function F0(p,W0){var y;let i=!1;if(W0===null)W0=W;if((y=W0)!==null&&y!==void 0&&y.cleanup)F(W0.cleanup,"cleanup"),i=W0.cleanup;return new M((U0,m)=>{let V0=$0(p,W0,(w0)=>{if(i)V0();if(w0)m(w0);else U0()})})}q.exports=$0,q.exports.finished=F0}),o1=g0(($,q)=>{var Q=D1(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:J},AbortError:Z}=a0(),{Symbol:G}=P0(),{kIsDestroyed:W,isDestroyed:B,isFinished:V,isServerRequest:U}=b2(),w=G("kDestroy"),F=G("kConstruct");function M(g,c,h){if(g){if(g.stack,c&&!c.errored)c.errored=g;if(h&&!h.errored)h.errored=g}}function k(g,c){let h=this._readableState,x=this._writableState,l=x||h;if(x!==null&&x!==void 0&&x.destroyed||h!==null&&h!==void 0&&h.destroyed){if(typeof c==="function")c();return this}if(M(g,x,h),x)x.destroyed=!0;if(h)h.destroyed=!0;if(!l.constructed)this.once(w,function($0){f(this,K($0,g),c)});else f(this,g,c);return this}function f(g,c,h){let x=!1;function l($0){if(x)return;x=!0;let{_readableState:Z0,_writableState:F0}=g;if(M($0,F0,Z0),F0)F0.closed=!0;if(Z0)Z0.closed=!0;if(typeof h==="function")h($0);if($0)Q.nextTick(L,g,$0);else Q.nextTick(D,g)}try{g._destroy(c||null,l)}catch($0){l($0)}}function L(g,c){z(g,c),D(g)}function D(g){let{_readableState:c,_writableState:h}=g;if(h)h.closeEmitted=!0;if(c)c.closeEmitted=!0;if(h!==null&&h!==void 0&&h.emitClose||c!==null&&c!==void 0&&c.emitClose)g.emit("close")}function z(g,c){let{_readableState:h,_writableState:x}=g;if(x!==null&&x!==void 0&&x.errorEmitted||h!==null&&h!==void 0&&h.errorEmitted)return;if(x)x.errorEmitted=!0;if(h)h.errorEmitted=!0;g.emit("error",c)}function N(){let g=this._readableState,c=this._writableState;if(g)g.constructed=!0,g.closed=!1,g.closeEmitted=!1,g.destroyed=!1,g.errored=null,g.errorEmitted=!1,g.reading=!1,g.ended=g.readable===!1,g.endEmitted=g.readable===!1;if(c)c.constructed=!0,c.destroyed=!1,c.closed=!1,c.closeEmitted=!1,c.errored=null,c.errorEmitted=!1,c.finalCalled=!1,c.prefinished=!1,c.ended=c.writable===!1,c.ending=c.writable===!1,c.finished=c.writable===!1}function H(g,c,h){let{_readableState:x,_writableState:l}=g;if(l!==null&&l!==void 0&&l.destroyed||x!==null&&x!==void 0&&x.destroyed)return this;if(x!==null&&x!==void 0&&x.autoDestroy||l!==null&&l!==void 0&&l.autoDestroy)g.destroy(c);else if(c){if(c.stack,l&&!l.errored)l.errored=c;if(x&&!x.errored)x.errored=c;if(h)Q.nextTick(z,g,c);else z(g,c)}}function v(g,c){if(typeof g._construct!=="function")return;let{_readableState:h,_writableState:x}=g;if(h)h.constructed=!1;if(x)x.constructed=!1;if(g.once(F,c),g.listenerCount(F)>1)return;Q.nextTick(j,g)}function j(g){let c=!1;function h(x){if(c){H(g,x!==null&&x!==void 0?x:new J);return}c=!0;let{_readableState:l,_writableState:$0}=g,Z0=$0||l;if(l)l.constructed=!0;if($0)$0.constructed=!0;if(Z0.destroyed)g.emit(w,x);else if(x)H(g,x,!0);else Q.nextTick(n,g)}try{g._construct((x)=>{Q.nextTick(h,x)})}catch(x){Q.nextTick(h,x)}}function n(g){g.emit(F)}function d(g){return(g===null||g===void 0?void 0:g.setHeader)&&typeof g.abort==="function"}function _(g){g.emit("close")}function X(g,c){g.emit("error",c),Q.nextTick(_,g)}function P(g,c){if(!g||B(g))return;if(!c&&!V(g))c=new Z;if(U(g))g.socket=null,g.destroy(c);else if(d(g))g.abort();else if(d(g.req))g.req.abort();else if(typeof g.destroy==="function")g.destroy(c);else if(typeof g.close==="function")g.close();else if(c)Q.nextTick(X,g,c);else Q.nextTick(_,g);if(!g.destroyed)g[W]=!0}q.exports={construct:v,destroyer:P,destroy:k,undestroy:N,errorOrDestroy:H}}),b5=g0(($,q)=>{var{ArrayIsArray:Q,ObjectSetPrototypeOf:K}=P0(),{EventEmitter:J}=(i1(),X0(p1));function Z(W){J.call(this,W)}K(Z.prototype,J.prototype),K(Z,J),Z.prototype.pipe=function(W,B){let V=this;function U(D){if(W.writable&&W.write(D)===!1&&V.pause)V.pause()}V.on("data",U);function w(){if(V.readable&&V.resume)V.resume()}if(W.on("drain",w),!W._isStdio&&(!B||B.end!==!1))V.on("end",M),V.on("close",k);let F=!1;function M(){if(F)return;F=!0,W.end()}function k(){if(F)return;if(F=!0,typeof W.destroy==="function")W.destroy()}function f(D){if(L(),J.listenerCount(this,"error")===0)this.emit("error",D)}G(V,"error",f),G(W,"error",f);function L(){V.removeListener("data",U),W.removeListener("drain",w),V.removeListener("end",M),V.removeListener("close",k),V.removeListener("error",f),W.removeListener("error",f),V.removeListener("end",L),V.removeListener("close",L),W.removeListener("close",L)}return V.on("end",L),V.on("close",L),W.on("close",L),W.emit("pipe",V),W};function G(W,B,V){if(typeof W.prependListener==="function")return W.prependListener(B,V);if(!W._events||!W._events[B])W.on(B,V);else if(Q(W._events[B]))W._events[B].unshift(V);else W._events[B]=[V,W._events[B]]}q.exports={Stream:Z,prependListener:G}}),H8=g0(($,q)=>{var{SymbolDispose:Q}=P0(),{AbortError:K,codes:J}=a0(),{isNodeStream:Z,isWebStream:G,kControllerErrorFunction:W}=b2(),B=s2(),{ERR_INVALID_ARG_TYPE:V}=J,U,w=(F,M)=>{if(typeof F!=="object"||!("aborted"in F))throw new V(M,"AbortSignal",F)};q.exports.addAbortSignal=function(F,M){if(w(F,"signal"),!Z(M)&&!G(M))throw new V("stream",["ReadableStream","WritableStream","Stream"],M);return q.exports.addAbortSignalNoValidate(F,M)},q.exports.addAbortSignalNoValidate=function(F,M){if(typeof F!=="object"||!("aborted"in F))return M;let k=Z(M)?()=>{M.destroy(new K(void 0,{cause:F.reason}))}:()=>{M[W](new K(void 0,{cause:F.reason}))};if(F.aborted)k();else{U=U||e0().addAbortListener;let f=U(F,k);B(M,f[Q])}return M}}),gV=g0(($,q)=>{var{StringPrototypeSlice:Q,SymbolIterator:K,TypedArrayPrototypeSet:J,Uint8Array:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{inspect:W}=e0();q.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(B){let V={data:B,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length}unshift(B){let V={data:B,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length}shift(){if(this.length===0)return;let B=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,B}clear(){this.head=this.tail=null,this.length=0}join(B){if(this.length===0)return"";let V=this.head,U=""+V.data;while((V=V.next)!==null)U+=B+V.data;return U}concat(B){if(this.length===0)return G.alloc(0);let V=G.allocUnsafe(B>>>0),U=this.head,w=0;while(U)J(V,U.data,w),w+=U.data.length,U=U.next;return V}consume(B,V){let U=this.head.data;if(BF.length)V+=F,B-=F.length;else{if(B===F.length)if(V+=F,++w,U.next)this.head=U.next;else this.head=this.tail=null;else V+=Q(F,0,B),this.head=U,U.data=Q(F,B);break}++w}while((U=U.next)!==null);return this.length-=w,V}_getBuffer(B){let V=G.allocUnsafe(B),U=B,w=this.head,F=0;do{let M=w.data;if(B>M.length)J(V,M,U-B),B-=M.length;else{if(B===M.length)if(J(V,M,U-B),++F,w.next)this.head=w.next;else this.head=this.tail=null;else J(V,new Z(M.buffer,M.byteOffset,B),U-B),this.head=w,w.data=M.slice(B);break}++F}while((w=w.next)!==null);return this.length-=F,V}[Symbol.for("nodejs.util.inspect.custom")](B,V){return W(this,{...V,depth:0,customInspect:!1})}}}),v8=g0(($,q)=>{var{MathFloor:Q,NumberIsInteger:K}=P0(),{validateInteger:J}=P6(),{ERR_INVALID_ARG_VALUE:Z}=a0().codes,G=16384,W=16;function B(F,M,k){return F.highWaterMark!=null?F.highWaterMark:M?F[k]:null}function V(F){return F?W:G}function U(F,M){if(J(M,"value",0),F)W=M;else G=M}function w(F,M,k,f){let L=B(M,f,k);if(L!=null){if(!K(L)||L<0){let D=f?`options.${k}`:"options.highWaterMark";throw new Z(D,L)}return Q(L)}return V(F.objectMode)}q.exports={getHighWaterMark:w,getDefaultHighWaterMark:V,setDefaultHighWaterMark:U}}),AV=g0(($,q)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),XV=g0(($)=>{var q=AV().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),a9=g0(($,q)=>{var Q=D1(),{PromisePrototypeThen:K,SymbolAsyncIterator:J,SymbolIterator:Z}=P0(),{Buffer:G}=(t0(),X0(K2)),{ERR_INVALID_ARG_TYPE:W,ERR_STREAM_NULL_VALUES:B}=a0().codes;function V(U,w,F){let M;if(typeof w==="string"||w instanceof G)return new U({objectMode:!0,...F,read(){this.push(w),this.push(null)}});let k;if(w&&w[J])k=!0,M=w[J]();else if(w&&w[Z])k=!1,M=w[Z]();else throw new W("iterable",["Iterable"],w);let f=new U({objectMode:!0,highWaterMark:1,...F}),L=!1;f._read=function(){if(!L)L=!0,z()},f._destroy=function(N,H){K(D(N),()=>Q.nextTick(H,N),(v)=>Q.nextTick(H,v||N))};async function D(N){let H=N!==void 0&&N!==null,v=typeof M.throw==="function";if(H&&v){let{value:j,done:n}=await M.throw(N);if(await j,n)return}if(typeof M.return==="function"){let{value:j}=await M.return();await j}}async function z(){for(;;){try{let{value:N,done:H}=k?await M.next():M.next();if(H)f.push(null);else{let v=N&&typeof N.then==="function"?await N:N;if(v===null)throw L=!1,new B;else if(f.push(v))continue;else L=!1}}catch(N){f.destroy(N)}break}}return f}q.exports=V}),f8=g0(($,q)=>{var Q=D1(),{ArrayPrototypeIndexOf:K,NumberIsInteger:J,NumberIsNaN:Z,NumberParseInt:G,ObjectDefineProperties:W,ObjectKeys:B,ObjectSetPrototypeOf:V,Promise:U,SafeSet:w,SymbolAsyncDispose:F,SymbolAsyncIterator:M,Symbol:k}=P0();q.exports=Q0,Q0.ReadableState=G0;var{EventEmitter:f}=(i1(),X0(p1)),{Stream:L,prependListener:D}=b5(),{Buffer:z}=(t0(),X0(K2)),{addAbortSignal:N}=H8(),H=s2(),v=e0().debuglog("stream",(I)=>{v=I}),j=gV(),n=o1(),{getHighWaterMark:d,getDefaultHighWaterMark:_}=v8(),{aggregateTwoErrors:X,codes:{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:g,ERR_OUT_OF_RANGE:c,ERR_STREAM_PUSH_AFTER_EOF:h,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:x},AbortError:l}=a0(),{validateObject:$0}=P6(),Z0=k("kPaused"),{StringDecoder:F0}=XV(),p=a9();V(Q0.prototype,L.prototype),V(Q0,L);var W0=()=>{},{errorOrDestroy:y}=n,i=1,U0=2,m=4,V0=8,w0=16,S=32,b=64,O=128,E=256,a=512,K0=1024,R=2048,Y=4096,C=8192,u=16384,e=32768,r=65536,s=131072,T=262144;function t(I){return{enumerable:!1,get(){return(this.state&I)!==0},set(A){if(A)this.state|=I;else this.state&=~I}}}W(G0.prototype,{objectMode:t(i),ended:t(U0),endEmitted:t(m),reading:t(V0),constructed:t(w0),sync:t(S),needReadable:t(b),emittedReadable:t(O),readableListening:t(E),resumeScheduled:t(a),errorEmitted:t(K0),emitClose:t(R),autoDestroy:t(Y),destroyed:t(C),closed:t(u),closeEmitted:t(e),multiAwaitDrain:t(r),readingMore:t(s),dataEmitted:t(T)});function G0(I,A,J0){if(typeof J0!=="boolean")J0=A instanceof c2();if(this.state=R|Y|w0|S,I&&I.objectMode)this.state|=i;if(J0&&I&&I.readableObjectMode)this.state|=i;if(this.highWaterMark=I?d(this,I,"readableHighWaterMark",J0):_(!1),this.buffer=new j,this.length=0,this.pipes=[],this.flowing=null,this[Z0]=null,I&&I.emitClose===!1)this.state&=~R;if(I&&I.autoDestroy===!1)this.state&=~Y;if(this.errored=null,this.defaultEncoding=I&&I.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,I&&I.encoding)this.decoder=new F0(I.encoding),this.encoding=I.encoding}function Q0(I){if(!(this instanceof Q0))return new Q0(I);let A=this instanceof c2();if(this._readableState=new G0(I,this,A),I){if(typeof I.read==="function")this._read=I.read;if(typeof I.destroy==="function")this._destroy=I.destroy;if(typeof I.construct==="function")this._construct=I.construct;if(I.signal&&!A)N(I.signal,this)}L.call(this,I),n.construct(this,()=>{if(this._readableState.needReadable)_1(this,this._readableState)})}Q0.prototype.destroy=n.destroy,Q0.prototype._undestroy=n.undestroy,Q0.prototype._destroy=function(I,A){A(I)},Q0.prototype[f.captureRejectionSymbol]=function(I){this.destroy(I)},Q0.prototype[F]=function(){let I;if(!this.destroyed)I=this.readableEnded?null:new l,this.destroy(I);return new U((A,J0)=>H(this,(B0)=>B0&&B0!==I?J0(B0):A(null)))},Q0.prototype.push=function(I,A){return M0(this,I,A,!1)},Q0.prototype.unshift=function(I,A){return M0(this,I,A,!0)};function M0(I,A,J0,B0){v("readableAddChunk",A);let z0=I._readableState,i0;if((z0.state&i)===0){if(typeof A==="string"){if(J0=J0||z0.defaultEncoding,z0.encoding!==J0)if(B0&&z0.encoding)A=z.from(A,J0).toString(z0.encoding);else A=z.from(A,J0),J0=""}else if(A instanceof z)J0="";else if(L._isUint8Array(A))A=L._uint8ArrayToBuffer(A),J0="";else if(A!=null)i0=new P("chunk",["string","Buffer","Uint8Array"],A)}if(i0)y(I,i0);else if(A===null)z0.state&=~V0,O0(I,z0);else if((z0.state&i)!==0||A&&A.length>0)if(B0)if((z0.state&m)!==0)y(I,new x);else if(z0.destroyed||z0.errored)return!1;else I0(I,z0,A,!0);else if(z0.ended)y(I,new h);else if(z0.destroyed||z0.errored)return!1;else if(z0.state&=~V0,z0.decoder&&!J0)if(A=z0.decoder.write(A),z0.objectMode||A.length!==0)I0(I,z0,A,!1);else _1(I,z0);else I0(I,z0,A,!1);else if(!B0)z0.state&=~V0,_1(I,z0);return!z0.ended&&(z0.length0){if((A.state&r)!==0)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;A.dataEmitted=!0,I.emit("data",J0)}else{if(A.length+=A.objectMode?1:J0.length,B0)A.buffer.unshift(J0);else A.buffer.push(J0);if((A.state&b)!==0)u0(I)}_1(I,A)}Q0.prototype.isPaused=function(){let I=this._readableState;return I[Z0]===!0||I.flowing===!1},Q0.prototype.setEncoding=function(I){let A=new F0(I);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;let J0=this._readableState.buffer,B0="";for(let z0 of J0)B0+=A.write(z0);if(J0.clear(),B0!=="")J0.push(B0);return this._readableState.length=B0.length,this};var m0=1073741824;function p0(I){if(I>m0)throw new c("size","<= 1GiB",I);else I--,I|=I>>>1,I|=I>>>2,I|=I>>>4,I|=I>>>8,I|=I>>>16,I++;return I}function q2(I,A){if(I<=0||A.length===0&&A.ended)return 0;if((A.state&i)!==0)return 1;if(Z(I)){if(A.flowing&&A.length)return A.buffer.first().length;return A.length}if(I<=A.length)return I;return A.ended?A.length:0}Q0.prototype.read=function(I){if(v("read",I),I===void 0)I=NaN;else if(!J(I))I=G(I,10);let A=this._readableState,J0=I;if(I>A.highWaterMark)A.highWaterMark=p0(I);if(I!==0)A.state&=~O;if(I===0&&A.needReadable&&((A.highWaterMark!==0?A.length>=A.highWaterMark:A.length>0)||A.ended)){if(v("read: emitReadable",A.length,A.ended),A.length===0&&A.ended)f5(this);else u0(this);return null}if(I=q2(I,A),I===0&&A.ended){if(A.length===0)f5(this);return null}let B0=(A.state&b)!==0;if(v("need readable",B0),A.length===0||A.length-I0)z0=l7(I,A);else z0=null;if(z0===null)A.needReadable=A.length<=A.highWaterMark,I=0;else if(A.length-=I,A.multiAwaitDrain)A.awaitDrainWriters.clear();else A.awaitDrainWriters=null;if(A.length===0){if(!A.ended)A.needReadable=!0;if(J0!==I&&A.ended)f5(this)}if(z0!==null&&!A.errorEmitted&&!A.closeEmitted)A.dataEmitted=!0,this.emit("data",z0);return z0};function O0(I,A){if(v("onEofChunk"),A.ended)return;if(A.decoder){let J0=A.decoder.end();if(J0&&J0.length)A.buffer.push(J0),A.length+=A.objectMode?1:J0.length}if(A.ended=!0,A.sync)u0(I);else A.needReadable=!1,A.emittedReadable=!0,E1(I)}function u0(I){let A=I._readableState;if(v("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,!A.emittedReadable)v("emitReadable",A.flowing),A.emittedReadable=!0,Q.nextTick(E1,I)}function E1(I){let A=I._readableState;if(v("emitReadable_",A.destroyed,A.length,A.ended),!A.destroyed&&!A.errored&&(A.length||A.ended))I.emit("readable"),A.emittedReadable=!1;A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,o7(I)}function _1(I,A){if(!A.readingMore&&A.constructed)A.readingMore=!0,Q.nextTick(R2,I,A)}function R2(I,A){while(!A.reading&&!A.ended&&(A.length1&&B0.pipes.includes(I))v("false write response, pause",B0.awaitDrainWriters.size),B0.awaitDrainWriters.add(I);J0.pause()}if(!z1)z1=wJ(J0,I),I.on("drain",z1)}J0.on("data",e7);function e7(F1){v("ondata");let u2=I.write(F1);if(v("dest.write",u2),u2===!1)t7()}function I5(F1){if(v("onerror",F1),A6(),I.removeListener("error",I5),I.listenerCount("error")===0){let u2=I._writableState||I._readableState;if(u2&&!u2.errorEmitted)y(I,F1);else I.emit("error",F1)}}D(I,"error",I5);function C5(){I.removeListener("finish",j5),A6()}I.once("close",C5);function j5(){v("onfinish"),I.removeListener("close",C5),A6()}I.once("finish",j5);function A6(){v("unpipe"),J0.unpipe(I)}if(I.emit("pipe",J0),I.writableNeedDrain===!0)t7();else if(!B0.flowing)v("pipe resume"),J0.resume();return I};function wJ(I,A){return function(){let J0=I._readableState;if(J0.awaitDrainWriters===A)v("pipeOnDrain",1),J0.awaitDrainWriters=null;else if(J0.multiAwaitDrain)v("pipeOnDrain",J0.awaitDrainWriters.size),J0.awaitDrainWriters.delete(A);if((!J0.awaitDrainWriters||J0.awaitDrainWriters.size===0)&&I.listenerCount("data"))I.resume()}}Q0.prototype.unpipe=function(I){let A=this._readableState,J0={hasUnpiped:!1};if(A.pipes.length===0)return this;if(!I){let z0=A.pipes;A.pipes=[],this.pause();for(let i0=0;i00,B0.flowing!==!1)this.resume()}else if(I==="readable"){if(!B0.endEmitted&&!B0.readableListening){if(B0.readableListening=B0.needReadable=!0,B0.flowing=!1,B0.emittedReadable=!1,v("on readable",B0.length,B0.reading),B0.length)u0(this);else if(!B0.reading)Q.nextTick(NJ,this)}}return J0},Q0.prototype.addListener=Q0.prototype.on,Q0.prototype.removeListener=function(I,A){let J0=L.prototype.removeListener.call(this,I,A);if(I==="readable")Q.nextTick(i7,this);return J0},Q0.prototype.off=Q0.prototype.removeListener,Q0.prototype.removeAllListeners=function(I){let A=L.prototype.removeAllListeners.apply(this,arguments);if(I==="readable"||I===void 0)Q.nextTick(i7,this);return A};function i7(I){let A=I._readableState;if(A.readableListening=I.listenerCount("readable")>0,A.resumeScheduled&&A[Z0]===!1)A.flowing=!0;else if(I.listenerCount("data")>0)I.resume();else if(!A.readableListening)A.flowing=null}function NJ(I){v("readable nexttick read 0"),I.read(0)}Q0.prototype.resume=function(){let I=this._readableState;if(!I.flowing)v("resume"),I.flowing=!I.readableListening,YJ(this,I);return I[Z0]=!1,this};function YJ(I,A){if(!A.resumeScheduled)A.resumeScheduled=!0,Q.nextTick(kJ,I,A)}function kJ(I,A){if(v("resume",A.reading),!A.reading)I.read(0);if(A.resumeScheduled=!1,I.emit("resume"),o7(I),A.flowing&&!A.reading)I.read(0)}Q0.prototype.pause=function(){if(v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)v("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[Z0]=!0,this};function o7(I){let A=I._readableState;v("flow",A.flowing);while(A.flowing&&I.read()!==null);}Q0.prototype.wrap=function(I){let A=!1;I.on("data",(B0)=>{if(!this.push(B0)&&I.pause)A=!0,I.pause()}),I.on("end",()=>{this.push(null)}),I.on("error",(B0)=>{y(this,B0)}),I.on("close",()=>{this.destroy()}),I.on("destroy",()=>{this.destroy()}),this._read=()=>{if(A&&I.resume)A=!1,I.resume()};let J0=B(I);for(let B0=1;B0{z0=z2?X(z0,z2):null,J0(),J0=W0});try{while(!0){let z2=I.destroyed?null:I.read();if(z2!==null)yield z2;else if(z0)throw z0;else if(z0===null)return;else await new U(B0)}}catch(z2){throw z0=X(z0,z2),z0}finally{if((z0||(A===null||A===void 0?void 0:A.destroyOnReturn)!==!1)&&(z0===void 0||I._readableState.autoDestroy))n.destroyer(I,null);else I.off("readable",B0),i0()}}W(Q0.prototype,{readable:{__proto__:null,get(){let I=this._readableState;return!!I&&I.readable!==!1&&!I.destroyed&&!I.errorEmitted&&!I.endEmitted},set(I){if(this._readableState)this._readableState.readable=!!I}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(I){if(this._readableState)this._readableState.flowing=I}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(I){if(!this._readableState)return;this._readableState.destroyed=I}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),W(G0.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Z0]!==!1},set(I){this[Z0]=!!I}}}),Q0._fromList=l7;function l7(I,A){if(A.length===0)return null;let J0;if(A.objectMode)J0=A.buffer.shift();else if(!I||I>=A.length){if(A.decoder)J0=A.buffer.join("");else if(A.buffer.length===1)J0=A.buffer.first();else J0=A.buffer.concat(A.length);A.buffer.clear()}else J0=A.buffer.consume(I,A.decoder);return J0}function f5(I){let A=I._readableState;if(v("endReadable",A.endEmitted),!A.endEmitted)A.ended=!0,Q.nextTick(LJ,A,I)}function LJ(I,A){if(v("endReadableNT",I.endEmitted,I.length),!I.errored&&!I.closeEmitted&&!I.endEmitted&&I.length===0){if(I.endEmitted=!0,A.emit("end"),A.writable&&A.allowHalfOpen===!1)Q.nextTick(HJ,A);else if(I.autoDestroy){let J0=A._writableState;if(!J0||J0.autoDestroy&&(J0.finished||J0.writable===!1))A.destroy()}}}function HJ(I){if(I.writable&&!I.writableEnded&&!I.destroyed)I.end()}Q0.from=function(I,A){return p(Q0,I,A)};var R5;function r7(){if(R5===void 0)R5={};return R5}Q0.fromWeb=function(I,A){return r7().newStreamReadableFromReadableStream(I,A)},Q0.toWeb=function(I,A){return r7().newReadableStreamFromStreamReadable(I,A)},Q0.wrap=function(I,A){var J0,B0;return new Q0({objectMode:(J0=(B0=I.readableObjectMode)!==null&&B0!==void 0?B0:I.objectMode)!==null&&J0!==void 0?J0:!0,...A,destroy(z0,i0){n.destroyer(I,z0),i0(z0)}}).wrap(I)}}),n5=g0(($,q)=>{var Q=D1(),{ArrayPrototypeSlice:K,Error:J,FunctionPrototypeSymbolHasInstance:Z,ObjectDefineProperty:G,ObjectDefineProperties:W,ObjectSetPrototypeOf:B,StringPrototypeToLowerCase:V,Symbol:U,SymbolHasInstance:w}=P0();q.exports=$0,$0.WritableState=x;var{EventEmitter:F}=(i1(),X0(p1)),M=b5().Stream,{Buffer:k}=(t0(),X0(K2)),f=o1(),{addAbortSignal:L}=H8(),{getHighWaterMark:D,getDefaultHighWaterMark:z}=v8(),{ERR_INVALID_ARG_TYPE:N,ERR_METHOD_NOT_IMPLEMENTED:H,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:j,ERR_STREAM_DESTROYED:n,ERR_STREAM_ALREADY_FINISHED:d,ERR_STREAM_NULL_VALUES:_,ERR_STREAM_WRITE_AFTER_END:X,ERR_UNKNOWN_ENCODING:P}=a0().codes,{errorOrDestroy:g}=f;B($0.prototype,M.prototype),B($0,M);function c(){}var h=U("kOnFinished");function x(Y,C,u){if(typeof u!=="boolean")u=C instanceof c2();if(this.objectMode=!!(Y&&Y.objectMode),u)this.objectMode=this.objectMode||!!(Y&&Y.writableObjectMode);this.highWaterMark=Y?D(this,Y,"writableHighWaterMark",u):z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let e=!!(Y&&Y.decodeStrings===!1);this.decodeStrings=!e,this.defaultEncoding=Y&&Y.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=y.bind(void 0,C),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,l(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!Y||Y.emitClose!==!1,this.autoDestroy=!Y||Y.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[h]=[]}function l(Y){Y.buffered=[],Y.bufferedIndex=0,Y.allBuffers=!0,Y.allNoop=!0}x.prototype.getBuffer=function(){return K(this.buffered,this.bufferedIndex)},G(x.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function $0(Y){let C=this instanceof c2();if(!C&&!Z($0,this))return new $0(Y);if(this._writableState=new x(Y,this,C),Y){if(typeof Y.write==="function")this._write=Y.write;if(typeof Y.writev==="function")this._writev=Y.writev;if(typeof Y.destroy==="function")this._destroy=Y.destroy;if(typeof Y.final==="function")this._final=Y.final;if(typeof Y.construct==="function")this._construct=Y.construct;if(Y.signal)L(Y.signal,this)}M.call(this,Y),f.construct(this,()=>{let u=this._writableState;if(!u.writing)V0(this,u);O(this,u)})}G($0,w,{__proto__:null,value:function(Y){if(Z(this,Y))return!0;if(this!==$0)return!1;return Y&&Y._writableState instanceof x}}),$0.prototype.pipe=function(){g(this,new j)};function Z0(Y,C,u,e){let r=Y._writableState;if(typeof u==="function")e=u,u=r.defaultEncoding;else{if(!u)u=r.defaultEncoding;else if(u!=="buffer"&&!k.isEncoding(u))throw new P(u);if(typeof e!=="function")e=c}if(C===null)throw new _;else if(!r.objectMode)if(typeof C==="string"){if(r.decodeStrings!==!1)C=k.from(C,u),u="buffer"}else if(C instanceof k)u="buffer";else if(M._isUint8Array(C))C=M._uint8ArrayToBuffer(C),u="buffer";else throw new N("chunk",["string","Buffer","Uint8Array"],C);let s;if(r.ending)s=new X;else if(r.destroyed)s=new n("write");if(s)return Q.nextTick(e,s),g(Y,s,!0),s;return r.pendingcb++,F0(Y,r,C,u,e)}$0.prototype.write=function(Y,C,u){return Z0(this,Y,C,u)===!0},$0.prototype.cork=function(){this._writableState.corked++},$0.prototype.uncork=function(){let Y=this._writableState;if(Y.corked){if(Y.corked--,!Y.writing)V0(this,Y)}},$0.prototype.setDefaultEncoding=function(Y){if(typeof Y==="string")Y=V(Y);if(!k.isEncoding(Y))throw new P(Y);return this._writableState.defaultEncoding=Y,this};function F0(Y,C,u,e,r){let s=C.objectMode?1:u.length;C.length+=s;let T=C.lengthu.bufferedIndex)V0(Y,u);if(e)if(u.afterWriteTickInfo!==null&&u.afterWriteTickInfo.cb===r)u.afterWriteTickInfo.count++;else u.afterWriteTickInfo={count:1,cb:r,stream:Y,state:u},Q.nextTick(i,u.afterWriteTickInfo);else U0(Y,u,1,r)}}function i({stream:Y,state:C,count:u,cb:e}){return C.afterWriteTickInfo=null,U0(Y,C,u,e)}function U0(Y,C,u,e){if(!C.ending&&!Y.destroyed&&C.length===0&&C.needDrain)C.needDrain=!1,Y.emit("drain");while(u-- >0)C.pendingcb--,e();if(C.destroyed)m(C);O(Y,C)}function m(Y){if(Y.writing)return;for(let r=Y.bufferedIndex;r1&&Y._writev){C.pendingcb-=s-1;let t=C.allNoop?c:(Q0)=>{for(let M0=T;M0256)u.splice(0,T),C.bufferedIndex=0;else C.bufferedIndex=T}C.bufferProcessing=!1}$0.prototype._write=function(Y,C,u){if(this._writev)this._writev([{chunk:Y,encoding:C}],u);else throw new H("_write()")},$0.prototype._writev=null,$0.prototype.end=function(Y,C,u){let e=this._writableState;if(typeof Y==="function")u=Y,Y=null,C=null;else if(typeof C==="function")u=C,C=null;let r;if(Y!==null&&Y!==void 0){let s=Z0(this,Y,C);if(s instanceof J)r=s}if(e.corked)e.corked=1,this.uncork();if(r);else if(!e.errored&&!e.ending)e.ending=!0,O(this,e,!0),e.ended=!0;else if(e.finished)r=new d("end");else if(e.destroyed)r=new n("end");if(typeof u==="function")if(r||e.finished)Q.nextTick(u,r);else e[h].push(u);return this};function w0(Y){return Y.ending&&!Y.destroyed&&Y.constructed&&Y.length===0&&!Y.errored&&Y.buffered.length===0&&!Y.finished&&!Y.writing&&!Y.errorEmitted&&!Y.closeEmitted}function S(Y,C){let u=!1;function e(r){if(u){g(Y,r!==null&&r!==void 0?r:v());return}if(u=!0,C.pendingcb--,r){let s=C[h].splice(0);for(let T=0;T{if(w0(r))E(e,r);else r.pendingcb--},Y,C);else if(w0(C))C.pendingcb++,E(Y,C)}}}function E(Y,C){C.pendingcb--,C.finished=!0;let u=C[h].splice(0);for(let e=0;e{var Q=D1(),K=(t0(),X0(K2)),{isReadable:J,isWritable:Z,isIterable:G,isNodeStream:W,isReadableNodeStream:B,isWritableNodeStream:V,isDuplexNodeStream:U,isReadableStream:w,isWritableStream:F}=b2(),M=s2(),{AbortError:k,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:L}}=a0(),{destroyer:D}=o1(),z=c2(),N=f8(),H=n5(),{createDeferredPromise:v}=e0(),j=a9(),n=globalThis.Blob||K.Blob,d=typeof n<"u"?function(h){return h instanceof n}:function(h){return!1},_=globalThis.AbortController||O6().AbortController,{FunctionPrototypeCall:X}=P0();class P extends z{constructor(h){super(h);if((h===null||h===void 0?void 0:h.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((h===null||h===void 0?void 0:h.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}q.exports=function h(x,l){if(U(x))return x;if(B(x))return c({readable:x});if(V(x))return c({writable:x});if(W(x))return c({writable:!1,readable:!1});if(w(x))return c({readable:N.fromWeb(x)});if(F(x))return c({writable:H.fromWeb(x)});if(typeof x==="function"){let{value:Z0,write:F0,final:p,destroy:W0}=g(x);if(G(Z0))return j(P,Z0,{objectMode:!0,write:F0,final:p,destroy:W0});let y=Z0===null||Z0===void 0?void 0:Z0.then;if(typeof y==="function"){let i,U0=X(y,Z0,(m)=>{if(m!=null)throw new L("nully","body",m)},(m)=>{D(i,m)});return i=new P({objectMode:!0,readable:!1,write:F0,final(m){p(async()=>{try{await U0,Q.nextTick(m,null)}catch(V0){Q.nextTick(m,V0)}})},destroy:W0})}throw new L("Iterable, AsyncIterable or AsyncFunction",l,Z0)}if(d(x))return h(x.arrayBuffer());if(G(x))return j(P,x,{objectMode:!0,writable:!1});if(w(x===null||x===void 0?void 0:x.readable)&&F(x===null||x===void 0?void 0:x.writable))return P.fromWeb(x);if(typeof(x===null||x===void 0?void 0:x.writable)==="object"||typeof(x===null||x===void 0?void 0:x.readable)==="object"){let Z0=x!==null&&x!==void 0&&x.readable?B(x===null||x===void 0?void 0:x.readable)?x===null||x===void 0?void 0:x.readable:h(x.readable):void 0,F0=x!==null&&x!==void 0&&x.writable?V(x===null||x===void 0?void 0:x.writable)?x===null||x===void 0?void 0:x.writable:h(x.writable):void 0;return c({readable:Z0,writable:F0})}let $0=x===null||x===void 0?void 0:x.then;if(typeof $0==="function"){let Z0;return X($0,x,(F0)=>{if(F0!=null)Z0.push(F0);Z0.push(null)},(F0)=>{D(Z0,F0)}),Z0=new P({objectMode:!0,writable:!1,read(){}})}throw new f(l,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],x)};function g(h){let{promise:x,resolve:l}=v(),$0=new _,Z0=$0.signal;return{value:h(async function*(){while(!0){let F0=x;x=null;let{chunk:p,done:W0,cb:y}=await F0;if(Q.nextTick(y),W0)return;if(Z0.aborted)throw new k(void 0,{cause:Z0.reason});({promise:x,resolve:l}=v()),yield p}}(),{signal:Z0}),write(F0,p,W0){let y=l;l=null,y({chunk:F0,done:!1,cb:W0})},final(F0){let p=l;l=null,p({done:!0,cb:F0})},destroy(F0,p){$0.abort(),p(F0)}}}function c(h){let x=h.readable&&typeof h.readable.read!=="function"?N.wrap(h.readable):h.readable,l=h.writable,$0=!!J(x),Z0=!!Z(l),F0,p,W0,y,i;function U0(m){let V0=y;if(y=null,V0)V0(m);else if(m)i.destroy(m)}if(i=new P({readableObjectMode:!!(x!==null&&x!==void 0&&x.readableObjectMode),writableObjectMode:!!(l!==null&&l!==void 0&&l.writableObjectMode),readable:$0,writable:Z0}),Z0)M(l,(m)=>{if(Z0=!1,m)D(x,m);U0(m)}),i._write=function(m,V0,w0){if(l.write(m,V0))w0();else F0=w0},i._final=function(m){l.end(),p=m},l.on("drain",function(){if(F0){let m=F0;F0=null,m()}}),l.on("finish",function(){if(p){let m=p;p=null,m()}});if($0)M(x,(m)=>{if($0=!1,m)D(x,m);U0(m)}),x.on("readable",function(){if(W0){let m=W0;W0=null,m()}}),x.on("end",function(){i.push(null)}),i._read=function(){while(!0){let m=x.read();if(m===null){W0=i._read;return}if(!i.push(m))return}};return i._destroy=function(m,V0){if(!m&&y!==null)m=new k;if(W0=null,F0=null,p=null,y===null)V0(m);else y=V0,D(l,m),D(x,m)},i}}),c2=g0(($,q)=>{var{ObjectDefineProperties:Q,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:J,ObjectSetPrototypeOf:Z}=P0();q.exports=B;var G=f8(),W=n5();Z(B.prototype,G.prototype),Z(B,G);{let F=J(W.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:Q,Symbol:K}=P0();q.exports=B;var{ERR_METHOD_NOT_IMPLEMENTED:J}=a0().codes,Z=c2(),{getHighWaterMark:G}=v8();Q(B.prototype,Z.prototype),Q(B,Z);var W=K("kCallback");function B(w){if(!(this instanceof B))return new B(w);let F=w?G(this,w,"readableHighWaterMark",!0):null;if(F===0)w={...w,highWaterMark:null,readableHighWaterMark:F,writableHighWaterMark:w.writableHighWaterMark||0};if(Z.call(this,w),this._readableState.sync=!1,this[W]=null,w){if(typeof w.transform==="function")this._transform=w.transform;if(typeof w.flush==="function")this._flush=w.flush}this.on("prefinish",U)}function V(w){if(typeof this._flush==="function"&&!this.destroyed)this._flush((F,M)=>{if(F){if(w)w(F);else this.destroy(F);return}if(M!=null)this.push(M);if(this.push(null),w)w()});else if(this.push(null),w)w()}function U(){if(this._final!==V)V.call(this)}B.prototype._final=V,B.prototype._transform=function(w,F,M){throw new J("_transform()")},B.prototype._write=function(w,F,M){let k=this._readableState,f=this._writableState,L=k.length;this._transform(w,F,(D,z)=>{if(D){M(D);return}if(z!=null)this.push(z);if(f.ended||L===k.length||k.length{var{ObjectSetPrototypeOf:Q}=P0();q.exports=J;var K=l9();Q(J.prototype,K.prototype),Q(J,K);function J(Z){if(!(this instanceof J))return new J(Z);K.call(this,Z)}J.prototype._transform=function(Z,G,W){W(null,Z)}}),d5=g0(($,q)=>{var Q=D1(),{ArrayIsArray:K,Promise:J,SymbolAsyncIterator:Z,SymbolDispose:G}=P0(),W=s2(),{once:B}=e0(),V=o1(),U=c2(),{aggregateTwoErrors:w,codes:{ERR_INVALID_ARG_TYPE:F,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:k,ERR_STREAM_DESTROYED:f,ERR_STREAM_PREMATURE_CLOSE:L},AbortError:D}=a0(),{validateFunction:z,validateAbortSignal:N}=P6(),{isIterable:H,isReadable:v,isReadableNodeStream:j,isNodeStream:n,isTransformStream:d,isWebStream:_,isReadableStream:X,isReadableFinished:P}=b2(),g=globalThis.AbortController||O6().AbortController,c,h,x;function l(m,V0,w0){let S=!1;m.on("close",()=>{S=!0});let b=W(m,{readable:V0,writable:w0},(O)=>{S=!O});return{destroy:(O)=>{if(S)return;S=!0,V.destroyer(m,O||new f("pipe"))},cleanup:b}}function $0(m){return z(m[m.length-1],"streams[stream.length - 1]"),m.pop()}function Z0(m){if(H(m))return m;else if(j(m))return F0(m);throw new F("val",["Readable","Iterable","AsyncIterable"],m)}async function*F0(m){if(!h)h=f8();yield*h.prototype[Z].call(m)}async function p(m,V0,w0,{end:S}){let b,O=null,E=(R)=>{if(R)b=R;if(O){let Y=O;O=null,Y()}},a=()=>new J((R,Y)=>{if(b)Y(b);else O=()=>{if(b)Y(b);else R()}});V0.on("drain",E);let K0=W(V0,{readable:!1},E);try{if(V0.writableNeedDrain)await a();for await(let R of m)if(!V0.write(R))await a();if(S)V0.end(),await a();w0()}catch(R){w0(b!==R?w(b,R):R)}finally{K0(),V0.off("drain",E)}}async function W0(m,V0,w0,{end:S}){if(d(V0))V0=V0.writable;let b=V0.getWriter();try{for await(let O of m)await b.ready,b.write(O).catch(()=>{});if(await b.ready,S)await b.close();w0()}catch(O){try{await b.abort(O),w0(O)}catch(E){w0(E)}}}function y(...m){return i(m,B($0(m)))}function i(m,V0,w0){if(m.length===1&&K(m[0]))m=m[0];if(m.length<2)throw new k("streams");let S=new g,b=S.signal,O=w0===null||w0===void 0?void 0:w0.signal,E=[];N(O,"options.signal");function a(){r(new D)}x=x||e0().addAbortListener;let K0;if(O)K0=x(O,a);let R,Y,C=[],u=0;function e(Q0){r(Q0,--u===0)}function r(Q0,M0){var I0;if(Q0&&(!R||R.code==="ERR_STREAM_PREMATURE_CLOSE"))R=Q0;if(!R&&!M0)return;while(C.length)C.shift()(R);if((I0=K0)===null||I0===void 0||I0[G](),S.abort(),M0){if(!R)E.forEach((m0)=>m0());Q.nextTick(V0,R,Y)}}let s;for(let Q0=0;Q00,p0=I0||(w0===null||w0===void 0?void 0:w0.end)!==!1,q2=Q0===m.length-1;if(n(M0)){let O0=function(u0){if(u0&&u0.name!=="AbortError"&&u0.code!=="ERR_STREAM_PREMATURE_CLOSE")e(u0)};var T=O0;if(p0){let{destroy:u0,cleanup:E1}=l(M0,I0,m0);if(C.push(u0),v(M0)&&q2)E.push(E1)}if(M0.on("error",O0),v(M0)&&q2)E.push(()=>{M0.removeListener("error",O0)})}if(Q0===0)if(typeof M0==="function"){if(s=M0({signal:b}),!H(s))throw new M("Iterable, AsyncIterable or Stream","source",s)}else if(H(M0)||j(M0)||d(M0))s=M0;else s=U.from(M0);else if(typeof M0==="function"){if(d(s)){var t;s=Z0((t=s)===null||t===void 0?void 0:t.readable)}else s=Z0(s);if(s=M0(s,{signal:b}),I0){if(!H(s,!0))throw new M("AsyncIterable",`transform[${Q0-1}]`,s)}else{var G0;if(!c)c=r9();let O0=new c({objectMode:!0}),u0=(G0=s)===null||G0===void 0?void 0:G0.then;if(typeof u0==="function")u++,u0.call(s,(R2)=>{if(Y=R2,R2!=null)O0.write(R2);if(p0)O0.end();Q.nextTick(e)},(R2)=>{O0.destroy(R2),Q.nextTick(e,R2)});else if(H(s,!0))u++,p(s,O0,e,{end:p0});else if(X(s)||d(s)){let R2=s.readable||s;u++,p(R2,O0,e,{end:p0})}else throw new M("AsyncIterable or Promise","destination",s);s=O0;let{destroy:E1,cleanup:_1}=l(s,!1,!0);if(C.push(E1),q2)E.push(_1)}}else if(n(M0)){if(j(s)){u+=2;let O0=U0(s,M0,e,{end:p0});if(v(M0)&&q2)E.push(O0)}else if(d(s)||X(s)){let O0=s.readable||s;u++,p(O0,M0,e,{end:p0})}else if(H(s))u++,p(s,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else if(_(M0)){if(j(s))u++,W0(Z0(s),M0,e,{end:p0});else if(X(s)||H(s))u++,W0(s,M0,e,{end:p0});else if(d(s))u++,W0(s.readable,M0,e,{end:p0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],s);s=M0}else s=U.from(M0)}if(b!==null&&b!==void 0&&b.aborted||O!==null&&O!==void 0&&O.aborted)Q.nextTick(a);return s}function U0(m,V0,w0,{end:S}){let b=!1;if(V0.on("close",()=>{if(!b)w0(new L)}),m.pipe(V0,{end:!1}),S){let E=function(){b=!0,V0.end()};var O=E;if(P(m))Q.nextTick(E);else m.once("end",E)}else w0();return W(m,{readable:!0,writable:!1},(E)=>{let a=m._readableState;if(E&&E.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted)m.once("end",w0).once("error",w0);else w0(E)}),W(V0,{readable:!1,writable:!0},w0)}q.exports={pipelineImpl:i,pipeline:y}}),s9=g0(($,q)=>{var{pipeline:Q}=d5(),K=c2(),{destroyer:J}=o1(),{isNodeStream:Z,isReadable:G,isWritable:W,isWebStream:B,isTransformStream:V,isWritableStream:U,isReadableStream:w}=b2(),{AbortError:F,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:k}}=a0(),f=s2();q.exports=function(...L){if(L.length===0)throw new k("streams");if(L.length===1)return K.from(L[0]);let D=[...L];if(typeof L[0]==="function")L[0]=K.from(L[0]);if(typeof L[L.length-1]==="function"){let g=L.length-1;L[g]=K.from(L[g])}for(let g=0;g0&&!(W(L[g])||U(L[g])||V(L[g])))throw new M(`streams[${g}]`,D[g],"must be writable")}let z,N,H,v,j;function n(g){let c=v;if(v=null,c)c(g);else if(g)j.destroy(g);else if(!P&&!X)j.destroy()}let d=L[0],_=Q(L,n),X=!!(W(d)||U(d)||V(d)),P=!!(G(_)||w(_)||V(_));if(j=new K({writableObjectMode:!!(d!==null&&d!==void 0&&d.writableObjectMode),readableObjectMode:!!(_!==null&&_!==void 0&&_.readableObjectMode),writable:X,readable:P}),X){if(Z(d))j._write=function(c,h,x){if(d.write(c,h))x();else z=x},j._final=function(c){d.end(),N=c},d.on("drain",function(){if(z){let c=z;z=null,c()}});else if(B(d)){let c=(V(d)?d.writable:d).getWriter();j._write=async function(h,x,l){try{await c.ready,c.write(h).catch(()=>{}),l()}catch($0){l($0)}},j._final=async function(h){try{await c.ready,c.close().catch(()=>{}),N=h}catch(x){h(x)}}}let g=V(_)?_.readable:_;f(g,()=>{if(N){let c=N;N=null,c()}})}if(P){if(Z(_))_.on("readable",function(){if(H){let g=H;H=null,g()}}),_.on("end",function(){j.push(null)}),j._read=function(){while(!0){let g=_.read();if(g===null){H=j._read;return}if(!j.push(g))return}};else if(B(_)){let g=(V(_)?_.readable:_).getReader();j._read=async function(){while(!0)try{let{value:c,done:h}=await g.read();if(!j.push(c))return;if(h){j.push(null);return}}catch{return}}}}return j._destroy=function(g,c){if(!g&&v!==null)g=new F;if(H=null,z=null,N=null,v===null)c(g);else if(v=c,Z(_))J(_,g)},j}}),hV=g0(($,q)=>{var Q=globalThis.AbortController||O6().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:J,ERR_MISSING_ARGS:Z,ERR_OUT_OF_RANGE:G},AbortError:W}=a0(),{validateAbortSignal:B,validateInteger:V,validateObject:U}=P6(),w=P0().Symbol("kWeak"),F=P0().Symbol("kResistStopPropagation"),{finished:M}=s2(),k=s9(),{addAbortSignalNoValidate:f}=H8(),{isWritable:L,isNodeStream:D}=b2(),{deprecate:z}=e0(),{ArrayPrototypePush:N,Boolean:H,MathFloor:v,Number:j,NumberIsNaN:n,Promise:d,PromiseReject:_,PromiseResolve:X,PromisePrototypeThen:P,Symbol:g}=P0(),c=g("kEmpty"),h=g("kEof");function x(O,E){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");if(D(O)&&!L(O))throw new K("stream",O,"must be writable");let a=k(this,O);if(E!==null&&E!==void 0&&E.signal)f(E.signal,a);return a}function l(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");let a=1;if((E===null||E===void 0?void 0:E.concurrency)!=null)a=v(E.concurrency);let K0=a-1;if((E===null||E===void 0?void 0:E.highWaterMark)!=null)K0=v(E.highWaterMark);return V(a,"options.concurrency",1),V(K0,"options.highWaterMark",0),K0+=a,async function*(){let R=e0().AbortSignalAny([E===null||E===void 0?void 0:E.signal].filter(H)),Y=this,C=[],u={signal:R},e,r,s=!1,T=0;function t(){s=!0,G0()}function G0(){T-=1,Q0()}function Q0(){if(r&&!s&&T=K0||T>=a))await new d((m0)=>{r=m0})}C.push(h)}catch(I0){let m0=_(I0);P(m0,G0,t),C.push(m0)}finally{if(s=!0,e)e(),e=null}}M0();try{while(!0){while(C.length>0){let I0=await C[0];if(I0===h)return;if(R.aborted)throw new W;if(I0!==c)yield I0;C.shift(),Q0()}await new d((I0)=>{e=I0})}}finally{if(s=!0,r)r(),r=null}}.call(this)}function $0(O=void 0){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");return async function*(){let E=0;for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W({cause:O.signal.reason});yield[E++,K0]}}.call(this)}async function Z0(O,E=void 0){for await(let a of y.call(this,O,E))return!0;return!1}async function F0(O,E=void 0){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);return!await Z0.call(this,async(...a)=>{return!await O(...a)},E)}async function p(O,E){for await(let a of y.call(this,O,E))return a;return}async function W0(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){return await O(K0,R),c}for await(let K0 of l.call(this,a,E));}function y(O,E){if(typeof O!=="function")throw new J("fn",["Function","AsyncFunction"],O);async function a(K0,R){if(await O(K0,R))return K0;return c}return l.call(this,a,E)}class i extends Z{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function U0(O,E,a){var K0;if(typeof O!=="function")throw new J("reducer",["Function","AsyncFunction"],O);if(a!=null)U(a,"options");if((a===null||a===void 0?void 0:a.signal)!=null)B(a.signal,"options.signal");let R=arguments.length>1;if(a!==null&&a!==void 0&&(K0=a.signal)!==null&&K0!==void 0&&K0.aborted){let r=new W(void 0,{cause:a.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(r)),r}let Y=new Q,C=Y.signal;if(a!==null&&a!==void 0&&a.signal){let r={once:!0,[w]:this,[F]:!0};a.signal.addEventListener("abort",()=>Y.abort(),r)}let u=!1;try{for await(let r of this){var e;if(u=!0,a!==null&&a!==void 0&&(e=a.signal)!==null&&e!==void 0&&e.aborted)throw new W;if(!R)E=r,R=!0;else E=await O(E,r,{signal:C})}if(!u&&!R)throw new i}finally{Y.abort()}return E}async function m(O){if(O!=null)U(O,"options");if((O===null||O===void 0?void 0:O.signal)!=null)B(O.signal,"options.signal");let E=[];for await(let K0 of this){var a;if(O!==null&&O!==void 0&&(a=O.signal)!==null&&a!==void 0&&a.aborted)throw new W(void 0,{cause:O.signal.reason});N(E,K0)}return E}function V0(O,E){let a=l.call(this,O,E);return async function*(){for await(let K0 of a)yield*K0}.call(this)}function w0(O){if(O=j(O),n(O))return 0;if(O<0)throw new G("number",">= 0",O);return O}function S(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O--<=0)yield R}}.call(this)}function b(O,E=void 0){if(E!=null)U(E,"options");if((E===null||E===void 0?void 0:E.signal)!=null)B(E.signal,"options.signal");return O=w0(O),async function*(){var a;if(E!==null&&E!==void 0&&(a=E.signal)!==null&&a!==void 0&&a.aborted)throw new W;for await(let R of this){var K0;if(E!==null&&E!==void 0&&(K0=E.signal)!==null&&K0!==void 0&&K0.aborted)throw new W;if(O-- >0)yield R;if(O<=0)return}}.call(this)}q.exports.streamReturningOperators={asIndexedPairs:z($0,"readable.asIndexedPairs will be removed in a future version."),drop:S,filter:y,flatMap:V0,map:l,take:b,compose:x},q.exports.promiseReturningOperators={every:F0,forEach:W0,reduce:U0,toArray:m,some:Z0,find:p}}),t9=g0(($,q)=>{var{ArrayPrototypePop:Q,Promise:K}=P0(),{isIterable:J,isNodeStream:Z,isWebStream:G}=b2(),{pipelineImpl:W}=d5(),{finished:B}=s2();e9();function V(...U){return new K((w,F)=>{let M,k,f=U[U.length-1];if(f&&typeof f==="object"&&!Z(f)&&!J(f)&&!G(f)){let L=Q(U);M=L.signal,k=L.end}W(U,(L,D)=>{if(L)F(L);else w(D)},{signal:M,end:k})})}q.exports={finished:B,pipeline:V}}),e9=g0(($,q)=>{var{Buffer:Q}=(t0(),X0(K2)),{ObjectDefineProperty:K,ObjectKeys:J,ReflectApply:Z}=P0(),{promisify:{custom:G}}=e0(),{streamReturningOperators:W,promiseReturningOperators:B}=hV(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:V}}=a0(),U=s9(),{setDefaultHighWaterMark:w,getDefaultHighWaterMark:F}=v8(),{pipeline:M}=d5(),{destroyer:k}=o1(),f=s2(),L=t9(),D=b2(),z=q.exports=b5().Stream;z.isDestroyed=D.isDestroyed,z.isDisturbed=D.isDisturbed,z.isErrored=D.isErrored,z.isReadable=D.isReadable,z.isWritable=D.isWritable,z.Readable=f8();for(let H of J(W)){let v=function(...n){if(new.target)throw V();return z.Readable.from(Z(j,this,n))},j=W[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(let H of J(B)){let v=function(...n){if(new.target)throw V();return Z(j,this,n)},j=B[H];K(v,"name",{__proto__:null,value:j.name}),K(v,"length",{__proto__:null,value:j.length}),K(z.Readable.prototype,H,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}z.Writable=n5(),z.Duplex=c2(),z.Transform=l9(),z.PassThrough=r9(),z.pipeline=M;var{addAbortSignal:N}=H8();z.addAbortSignal=N,z.finished=f,z.destroy=k,z.compose=U,z.setDefaultHighWaterMark=w,z.getDefaultHighWaterMark=F,K(z,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return L}}),K(M,G,{__proto__:null,enumerable:!0,get(){return L.pipeline}}),K(f,G,{__proto__:null,enumerable:!0,get(){return L.finished}}),z.Stream=z,z._isUint8Array=function(H){return H instanceof Uint8Array},z._uint8ArrayToBuffer=function(H){return Q.from(H.buffer,H.byteOffset,H.byteLength)}}),xV=g0(($,q)=>{var Q=a1();{let K=e9(),J=t9(),Z=K.Readable.destroy;q.exports=K.Readable,q.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,q.exports._isUint8Array=K._isUint8Array,q.exports.isDisturbed=K.isDisturbed,q.exports.isErrored=K.isErrored,q.exports.isReadable=K.isReadable,q.exports.Readable=K.Readable,q.exports.Writable=K.Writable,q.exports.Duplex=K.Duplex,q.exports.Transform=K.Transform,q.exports.PassThrough=K.PassThrough,q.exports.addAbortSignal=K.addAbortSignal,q.exports.finished=K.finished,q.exports.destroy=K.destroy,q.exports.destroy=Z,q.exports.pipeline=K.pipeline,q.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return J}}),q.exports.Stream=K.Stream}q.exports.default=q.exports});$$.exports=xV()});var m5=N0((Fz,Q$)=>{Q$.exports=a1()});var n2=N0((J2)=>{J2.base64=!0;J2.array=!0;J2.string=!0;J2.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";J2.nodebuffer=typeof Buffer<"u";J2.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")J2.blob=!1;else{R8=new ArrayBuffer(0);try{J2.blob=new Blob([R8],{type:"application/zip"}).size===0}catch($){try{p5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,I8=new p5,I8.append(R8),J2.blob=I8.getBlob("application/zip").size===0}catch(q){J2.blob=!1}}}var R8,p5,I8;try{J2.nodestream=!!m5().Readable}catch($){J2.nodestream=!1}});var o5=N0((i5)=>{var OV=T0(),PV=n2(),A2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i5.encode=function($){var q=[],Q,K,J,Z,G,W,B,V=0,U=$.length,w=U,F=OV.getTypeOf($)!=="string";while(V<$.length){if(w=U-V,!F)Q=$.charCodeAt(V++),K=V>2,G=(Q&3)<<4|K>>4,W=w>1?(K&15)<<2|J>>6:64,B=w>2?J&63:64,q.push(A2.charAt(Z)+A2.charAt(G)+A2.charAt(W)+A2.charAt(B))}return q.join("")};i5.decode=function($){var q,Q,K,J,Z,G,W,B=0,V=0,U="data:";if($.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var w=$.length*3/4;if($.charAt($.length-1)===A2.charAt(64))w--;if($.charAt($.length-2)===A2.charAt(64))w--;if(w%1!==0)throw Error("Invalid base64 input, bad content length.");var F;if(PV.uint8array)F=new Uint8Array(w|0);else F=Array(w|0);while(B<$.length){if(J=A2.indexOf($.charAt(B++)),Z=A2.indexOf($.charAt(B++)),G=A2.indexOf($.charAt(B++)),W=A2.indexOf($.charAt(B++)),q=J<<2|Z>>4,Q=(Z&15)<<4|G>>2,K=(G&3)<<6|W,F[V++]=q,G!==64)F[V++]=Q;if(W!==64)F[V++]=K}return F}});var T6=N0((Nz,q$)=>{q$.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var q=new Buffer($);return q.fill(0),q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var V$=N0((Yz,J$)=>{var K$=global.MutationObserver||global.WebKitMutationObserver,u6;if(K$)j8=0,a5=new K$(C8),g8=global.document.createTextNode(""),a5.observe(g8,{characterData:!0}),u6=function(){g8.data=j8=++j8%2};else if(!global.setImmediate&&typeof global.MessageChannel<"u")A8=new global.MessageChannel,A8.port1.onmessage=C8,u6=function(){A8.port2.postMessage(0)};else if("document"in global&&"onreadystatechange"in global.document.createElement("script"))u6=function(){var $=global.document.createElement("script");$.onreadystatechange=function(){C8(),$.onreadystatechange=null,$.parentNode.removeChild($),$=null},global.document.documentElement.appendChild($)};else u6=function(){setTimeout(C8,0)};var j8,a5,g8,A8,l5,S6=[];function C8(){l5=!0;var $,q,Q=S6.length;while(Q){q=S6,S6=[],$=-1;while(++${var uV=V$();function l1(){}var o0={},U$=["REJECTED"],r5=["FULFILLED"],Z$=["PENDING"];B$.exports=t2;function t2($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Z$,this.queue=[],this.outcome=void 0,$!==l1)G$(this,$)}t2.prototype.finally=function($){if(typeof $!=="function")return this;var q=this.constructor;return this.then(Q,K);function Q(J){function Z(){return J}return q.resolve($()).then(Z)}function K(J){function Z(){throw J}return q.resolve($()).then(Z)}};t2.prototype.catch=function($){return this.then(null,$)};t2.prototype.then=function($,q){if(typeof $!=="function"&&this.state===r5||typeof q!=="function"&&this.state===U$)return this;var Q=new this.constructor(l1);if(this.state!==Z$){var K=this.state===r5?$:q;s5(Q,K,this.outcome)}else this.queue.push(new E6(Q,$,q));return Q};function E6($,q,Q){if(this.promise=$,typeof q==="function")this.onFulfilled=q,this.callFulfilled=this.otherCallFulfilled;if(typeof Q==="function")this.onRejected=Q,this.callRejected=this.otherCallRejected}E6.prototype.callFulfilled=function($){o0.resolve(this.promise,$)};E6.prototype.otherCallFulfilled=function($){s5(this.promise,this.onFulfilled,$)};E6.prototype.callRejected=function($){o0.reject(this.promise,$)};E6.prototype.otherCallRejected=function($){s5(this.promise,this.onRejected,$)};function s5($,q,Q){uV(function(){var K;try{K=q(Q)}catch(J){return o0.reject($,J)}if(K===$)o0.reject($,TypeError("Cannot resolve promise with itself"));else o0.resolve($,K)})}o0.resolve=function($,q){var Q=W$(SV,q);if(Q.status==="error")return o0.reject($,Q.value);var K=Q.value;if(K)G$($,K);else{$.state=r5,$.outcome=q;var J=-1,Z=$.queue.length;while(++J{var t5=null;if(typeof Promise<"u")t5=Promise;else t5=z$();F$.exports={Promise:t5}});var w$=N0((M$)=>{(function($,q){if($.setImmediate)return;var Q=1,K={},J=!1,Z=$.document,G;function W(z){if(typeof z!=="function")z=Function(""+z);var N=Array(arguments.length-1);for(var H=0;H"u"?typeof global>"u"?M$:global:self)});var T0=N0((_0)=>{var e2=n2(),nV=o5(),s1=T6(),e5=r1();w$();function dV($){var q=null;if(e2.uint8array)q=new Uint8Array($.length);else q=Array($.length);return y8($,q)}_0.newBlob=function($,q){_0.checkSupport("blob");try{return new Blob([$],{type:q})}catch(J){try{var Q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,K=new Q;return K.append($),K.getBlob(q)}catch(Z){throw Error("Bug : can't construct the Blob.")}}};function _6($){return $}function y8($,q){for(var Q=0;Q<$.length;++Q)q[Q]=$.charCodeAt(Q)&255;return q}var X8={stringifyByChunk:function($,q,Q){var K=[],J=0,Z=$.length;if(Z<=Q)return String.fromCharCode.apply(null,$);while(J1)try{return X8.stringifyByChunk($,Q,q)}catch(J){q=Math.floor(q/2)}return X8.stringifyByChar($)}_0.applyFromCharCode=c6;function h8($,q){for(var Q=0;Q<$.length;Q++)q[Q]=$[Q];return q}var $1={};$1.string={string:_6,array:function($){return y8($,Array($.length))},arraybuffer:function($){return $1.string.uint8array($).buffer},uint8array:function($){return y8($,new Uint8Array($.length))},nodebuffer:function($){return y8($,s1.allocBuffer($.length))}};$1.array={string:c6,array:_6,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom($)}};$1.arraybuffer={string:function($){return c6(new Uint8Array($))},array:function($){return h8(new Uint8Array($),Array($.byteLength))},arraybuffer:_6,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return s1.newBufferFrom(new Uint8Array($))}};$1.uint8array={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:_6,nodebuffer:function($){return s1.newBufferFrom($)}};$1.nodebuffer={string:c6,array:function($){return h8($,Array($.length))},arraybuffer:function($){return $1.nodebuffer.uint8array($).buffer},uint8array:function($){return h8($,new Uint8Array($.length))},nodebuffer:_6};_0.transformTo=function($,q){if(!q)q="";if(!$)return q;_0.checkSupport($);var Q=_0.getTypeOf(q),K=$1[Q][$](q);return K};_0.resolve=function($){var q=$.split("/"),Q=[];for(var K=0;K"u")$[Q]=arguments[q][Q];return $};_0.prepareContent=function($,q,Q,K,J){var Z=e5.Promise.resolve(q).then(function(G){var W=e2.blob&&(G instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(G))!==-1);if(W&&typeof FileReader<"u")return new e5.Promise(function(B,V){var U=new FileReader;U.onload=function(w){B(w.target.result)},U.onerror=function(w){V(w.target.error)},U.readAsArrayBuffer(G)});else return G});return Z.then(function(G){var W=_0.getTypeOf(G);if(!W)return e5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(W==="arraybuffer")G=_0.transformTo("uint8array",G);else if(W==="string"){if(J)G=nV.decode(G);else if(Q){if(K!==!0)G=dV(G)}}return G})}});var V2=N0((vz,Y$)=>{function N$($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}N$.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,q){return this._listeners[$].push(q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,q){if(this._listeners[$])for(var Q=0;Q "+$;else return $}};Y$.exports=N$});var e1=N0((Q1)=>{var t1=T0(),L1=n2(),mV=T6(),x8=V2(),b6=Array(256);for(X2=0;X2<256;X2++)b6[X2]=X2>=252?6:X2>=248?5:X2>=240?4:X2>=224?3:X2>=192?2:1;var X2;b6[254]=b6[254]=1;var pV=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q},iV=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+b6[$[Q]]>q?Q:q},oV=function($){var q,Q,K,J,Z=$.length,G=Array(Z*2);for(Q=0,q=0;q4){G[Q++]=65533,q+=J-1;continue}K&=J===2?31:J===3?15:7;while(J>1&&q1){G[Q++]=65533;continue}if(K<65536)G[Q++]=K;else K-=65536,G[Q++]=55296|K>>10&1023,G[Q++]=56320|K&1023}if(G.length!==Q)if(G.subarray)G=G.subarray(0,Q);else G.length=Q;return t1.applyFromCharCode(G)};Q1.utf8encode=function(q){if(L1.nodebuffer)return mV.newBufferFrom(q,"utf-8");return pV(q)};Q1.utf8decode=function(q){if(L1.nodebuffer)return t1.transformTo("nodebuffer",q).toString("utf-8");return q=t1.transformTo(L1.uint8array?"uint8array":"array",q),oV(q)};function O8(){x8.call(this,"utf-8 decode"),this.leftOver=null}t1.inherits(O8,x8);O8.prototype.processChunk=function($){var q=t1.transformTo(L1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(L1.uint8array){var Q=q;q=new Uint8Array(Q.length+this.leftOver.length),q.set(this.leftOver,0),q.set(Q,this.leftOver.length)}else q=this.leftOver.concat(q);this.leftOver=null}var K=iV(q),J=q;if(K!==q.length)if(L1.uint8array)J=q.subarray(0,K),this.leftOver=q.subarray(K,q.length);else J=q.slice(0,K),this.leftOver=q.slice(K,q.length);this.push({data:Q1.utf8decode(J),meta:$.meta})};O8.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:Q1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};Q1.Utf8DecodeWorker=O8;function $4(){x8.call(this,"utf-8 encode")}t1.inherits($4,x8);$4.prototype.processChunk=function($){this.push({data:Q1.utf8encode($.data),meta:$.meta})};Q1.Utf8EncodeWorker=$4});var H$=N0((Rz,L$)=>{var k$=V2(),D$=T0();function Q4($){k$.call(this,"ConvertWorker to "+$),this.destType=$}D$.inherits(Q4,k$);Q4.prototype.processChunk=function($){this.push({data:D$.transformTo(this.destType,$.data),meta:$.meta})};L$.exports=Q4});var R$=N0((Iz,f$)=>{var v$=m5().Readable,aV=T0();aV.inherits(q4,v$);function q4($,q,Q){v$.call(this,q),this._helper=$;var K=this;$.on("data",function(J,Z){if(!K.push(J))K._helper.pause();if(Q)Q(Z)}).on("error",function(J){K.emit("error",J)}).on("end",function(){K.push(null)})}q4.prototype._read=function(){this._helper.resume()};f$.exports=q4});var K4=N0((Cz,j$)=>{var H1=T0(),lV=H$(),rV=V2(),sV=o5(),tV=n2(),eV=r1(),I$=null;if(tV.nodestream)try{I$=R$()}catch($){}function $U($,q,Q){switch($){case"blob":return H1.newBlob(H1.transformTo("arraybuffer",q),Q);case"base64":return sV.encode(q);default:return H1.transformTo($,q)}}function QU($,q){var Q,K=0,J=null,Z=0;for(Q=0;Q{D2.base64=!1;D2.binary=!1;D2.dir=!1;D2.createFolders=!0;D2.date=null;D2.compression=null;D2.compressionOptions=null;D2.comment=null;D2.unixPermissions=null;D2.dosPermissions=null});var V4=N0((gz,g$)=>{var P8=T0(),T8=V2(),KU=16384;function $6($){T8.call(this,"DataWorker");var q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(Q){if(q.dataIsReady=!0,q.data=Q,q.max=Q&&Q.length||0,q.type=P8.getTypeOf(Q),!q.isPaused)q._tickAndRepeat()},function(Q){q.error(Q)})}P8.inherits($6,T8);$6.prototype.cleanUp=function(){T8.prototype.cleanUp.call(this),this.data=null};$6.prototype.resume=function(){if(!T8.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,P8.delay(this._tickAndRepeat,[],this);return!0};$6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)P8.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};$6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=KU,q=null,Q=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":q=this.data.substring(this.index,Q);break;case"uint8array":q=this.data.subarray(this.index,Q);break;case"array":case"nodebuffer":q=this.data.slice(this.index,Q);break}return this.index=Q,this.push({data:q,meta:{percent:this.max?this.index/this.max*100:0}})}};g$.exports=$6});var u8=N0((Az,X$)=>{var JU=T0();function VU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var A$=VU();function UU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}function ZU($,q,Q,K){var J=A$,Z=K+Q;$=$^-1;for(var G=K;G>>8^J[($^q.charCodeAt(G))&255];return $^-1}X$.exports=function(q,Q){if(typeof q>"u"||!q.length)return 0;var K=JU.getTypeOf(q)!=="string";if(K)return UU(Q|0,q,q.length,0);else return ZU(Q|0,q,q.length,0)}});var Z4=N0((Xz,h$)=>{var y$=V2(),GU=u8(),WU=T0();function U4(){y$.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}WU.inherits(U4,y$);U4.prototype.processChunk=function($){this.streamInfo.crc32=GU($.data,this.streamInfo.crc32||0),this.push($)};h$.exports=U4});var O$=N0((yz,x$)=>{var BU=T0(),G4=V2();function W4($){G4.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}BU.inherits(W4,G4);W4.prototype.processChunk=function($){if($){var q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=q+$.data.length}G4.prototype.processChunk.call(this,$)};x$.exports=W4});var S8=N0((hz,u$)=>{var P$=r1(),T$=V4(),zU=Z4(),B4=O$();function z4($,q,Q,K,J){this.compressedSize=$,this.uncompressedSize=q,this.crc32=Q,this.compression=K,this.compressedContent=J}z4.prototype={getContentWorker:function(){var $=new T$(P$.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new B4("data_length")),q=this;return $.on("end",function(){if(this.streamInfo.data_length!==q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new T$(P$.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};z4.createWorkerFrom=function($,q,Q){return $.pipe(new zU).pipe(new B4("uncompressedSize")).pipe(q.compressWorker(Q)).pipe(new B4("compressedSize")).withStreamInfo("compression",q)};u$.exports=z4});var c$=N0((xz,_$)=>{var FU=K4(),MU=V4(),F4=e1(),M4=S8(),S$=V2(),w4=function($,q,Q){this.name=$,this.dir=Q.dir,this.date=Q.date,this.comment=Q.comment,this.unixPermissions=Q.unixPermissions,this.dosPermissions=Q.dosPermissions,this._data=q,this._dataBinary=Q.binary,this.options={compression:Q.compression,compressionOptions:Q.compressionOptions}};w4.prototype={internalStream:function($){var q=null,Q="string";try{if(!$)throw Error("No output type specified.");Q=$.toLowerCase();var K=Q==="string"||Q==="text";if(Q==="binarystring"||Q==="text")Q="string";q=this._decompressWorker();var J=!this._dataBinary;if(J&&!K)q=q.pipe(new F4.Utf8EncodeWorker);if(!J&&K)q=q.pipe(new F4.Utf8DecodeWorker)}catch(Z){q=new S$("error"),q.error(Z)}return new FU(q,Q,"")},async:function($,q){return this.internalStream($).accumulate(q)},nodeStream:function($,q){return this.internalStream($||"nodebuffer").toNodejsStream(q)},_compressWorker:function($,q){if(this._data instanceof M4&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var Q=this._decompressWorker();if(!this._dataBinary)Q=Q.pipe(new F4.Utf8EncodeWorker);return M4.createWorkerFrom(Q,$,q)}},_decompressWorker:function(){if(this._data instanceof M4)return this._data.getContentWorker();else if(this._data instanceof S$)return this._data;else return new MU(this._data)}};var E$=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],wU=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(n6=0;n6{var NU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function YU($,q){return Object.prototype.hasOwnProperty.call($,q)}l0.assign=function($){var q=Array.prototype.slice.call(arguments,1);while(q.length){var Q=q.shift();if(!Q)continue;if(typeof Q!=="object")throw TypeError(Q+"must be non-object");for(var K in Q)if(YU(Q,K))$[K]=Q[K]}return $};l0.shrinkBuf=function($,q){if($.length===q)return $;if($.subarray)return $.subarray(0,q);return $.length=q,$};var kU={arraySet:function($,q,Q,K,J){if(q.subarray&&$.subarray){$.set(q.subarray(Q,Q+K),J);return}for(var Z=0;Z{var LU=d2(),HU=4,b$=0,n$=1,vU=2;function q6($){var q=$.length;while(--q>=0)$[q]=0}var fU=0,a$=1,RU=2,IU=3,CU=258,v4=29,a6=256,m6=a6+1+v4,Q6=30,f4=19,l$=2*m6+1,v1=15,N4=16,jU=7,R4=256,r$=16,s$=17,t$=18,L4=[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],E8=[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],gU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],e$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],AU=512,m2=Array((m6+2)*2);q6(m2);var d6=Array(Q6*2);q6(d6);var p6=Array(AU);q6(p6);var i6=Array(CU-IU+1);q6(i6);var I4=Array(v4);q6(I4);var _8=Array(Q6);q6(_8);function Y4($,q,Q,K,J){this.static_tree=$,this.extra_bits=q,this.extra_base=Q,this.elems=K,this.max_length=J,this.has_stree=$&&$.length}var $Q,QQ,qQ;function k4($,q){this.dyn_tree=$,this.max_code=0,this.stat_desc=q}function KQ($){return $<256?p6[$]:p6[256+($>>>7)]}function o6($,q){$.pending_buf[$.pending++]=q&255,$.pending_buf[$.pending++]=q>>>8&255}function $2($,q,Q){if($.bi_valid>N4-Q)$.bi_buf|=q<<$.bi_valid&65535,o6($,$.bi_buf),$.bi_buf=q>>N4-$.bi_valid,$.bi_valid+=Q-N4;else $.bi_buf|=q<<$.bi_valid&65535,$.bi_valid+=Q}function y2($,q,Q){$2($,Q[q*2],Q[q*2+1])}function JQ($,q){var Q=0;do Q|=$&1,$>>>=1,Q<<=1;while(--q>0);return Q>>>1}function XU($){if($.bi_valid===16)o6($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function yU($,q){var{dyn_tree:Q,max_code:K}=q,J=q.stat_desc.static_tree,Z=q.stat_desc.has_stree,G=q.stat_desc.extra_bits,W=q.stat_desc.extra_base,B=q.stat_desc.max_length,V,U,w,F,M,k,f=0;for(F=0;F<=v1;F++)$.bl_count[F]=0;Q[$.heap[$.heap_max]*2+1]=0;for(V=$.heap_max+1;VB)F=B,f++;if(Q[U*2+1]=F,U>K)continue;if($.bl_count[F]++,M=0,U>=W)M=G[U-W];if(k=Q[U*2],$.opt_len+=k*(F+M),Z)$.static_len+=k*(J[U*2+1]+M)}if(f===0)return;do{F=B-1;while($.bl_count[F]===0)F--;$.bl_count[F]--,$.bl_count[F+1]+=2,$.bl_count[B]--,f-=2}while(f>0);for(F=B;F!==0;F--){U=$.bl_count[F];while(U!==0){if(w=$.heap[--V],w>K)continue;if(Q[w*2+1]!==F)$.opt_len+=(F-Q[w*2+1])*Q[w*2],Q[w*2+1]=F;U--}}}function VQ($,q,Q){var K=Array(v1+1),J=0,Z,G;for(Z=1;Z<=v1;Z++)K[Z]=J=J+Q[Z-1]<<1;for(G=0;G<=q;G++){var W=$[G*2+1];if(W===0)continue;$[G*2]=JQ(K[W]++,W)}}function hU(){var $,q,Q,K,J,Z=Array(v1+1);Q=0;for(K=0;K>=7;for(;K8)o6($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function xU($,q,Q,K){if(ZQ($),K)o6($,Q),o6($,~Q);LU.arraySet($.pending_buf,$.window,q,Q,$.pending),$.pending+=Q}function d$($,q,Q,K){var J=q*2,Z=Q*2;return $[J]<$[Z]||$[J]===$[Z]&&K[q]<=K[Q]}function D4($,q,Q){var K=$.heap[Q],J=Q<<1;while(J<=$.heap_len){if(J<$.heap_len&&d$(q,$.heap[J+1],$.heap[J],$.depth))J++;if(d$(q,K,$.heap[J],$.depth))break;$.heap[Q]=$.heap[J],Q=J,J<<=1}$.heap[Q]=K}function m$($,q,Q){var K,J,Z=0,G,W;if($.last_lit!==0)do if(K=$.pending_buf[$.d_buf+Z*2]<<8|$.pending_buf[$.d_buf+Z*2+1],J=$.pending_buf[$.l_buf+Z],Z++,K===0)y2($,J,q);else{if(G=i6[J],y2($,G+a6+1,q),W=L4[G],W!==0)J-=I4[G],$2($,J,W);if(K--,G=KQ(K),y2($,G,Q),W=E8[G],W!==0)K-=_8[G],$2($,K,W)}while(Z<$.last_lit);y2($,R4,q)}function H4($,q){var Q=q.dyn_tree,K=q.stat_desc.static_tree,J=q.stat_desc.has_stree,Z=q.stat_desc.elems,G,W,B=-1,V;$.heap_len=0,$.heap_max=l$;for(G=0;G>1;G>=1;G--)D4($,Q,G);V=Z;do G=$.heap[1],$.heap[1]=$.heap[$.heap_len--],D4($,Q,1),W=$.heap[1],$.heap[--$.heap_max]=G,$.heap[--$.heap_max]=W,Q[V*2]=Q[G*2]+Q[W*2],$.depth[V]=($.depth[G]>=$.depth[W]?$.depth[G]:$.depth[W])+1,Q[G*2+1]=Q[W*2+1]=V,$.heap[1]=V++,D4($,Q,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],yU($,q),VQ(Q,B,$.bl_count)}function p$($,q,Q){var K,J=-1,Z,G=q[1],W=0,B=7,V=4;if(G===0)B=138,V=3;q[(Q+1)*2+1]=65535;for(K=0;K<=Q;K++){if(Z=G,G=q[(K+1)*2+1],++W=3;q--)if($.bl_tree[e$[q]*2+1]!==0)break;return $.opt_len+=3*(q+1)+5+5+4,q}function PU($,q,Q,K){var J;$2($,q-257,5),$2($,Q-1,5),$2($,K-4,4);for(J=0;J>>=1)if(q&1&&$.dyn_ltree[Q*2]!==0)return b$;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return n$;for(Q=32;Q0){if($.strm.data_type===vU)$.strm.data_type=TU($);if(H4($,$.l_desc),H4($,$.d_desc),G=OU($),J=$.opt_len+3+7>>>3,Z=$.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=Q+5;if(Q+4<=J&&q!==-1)GQ($,q,Q,K);else if($.strategy===HU||Z===J)$2($,(a$<<1)+(K?1:0),3),m$($,m2,d6);else $2($,(RU<<1)+(K?1:0),3),PU($,$.l_desc.max_code+1,$.d_desc.max_code+1,G+1),m$($,$.dyn_ltree,$.dyn_dtree);if(UQ($),K)ZQ($)}function _U($,q,Q){if($.pending_buf[$.d_buf+$.last_lit*2]=q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=q&255,$.pending_buf[$.l_buf+$.last_lit]=Q&255,$.last_lit++,q===0)$.dyn_ltree[Q*2]++;else $.matches++,q--,$.dyn_ltree[(i6[Q]+a6+1)*2]++,$.dyn_dtree[KQ(q)*2]++;return $.last_lit===$.lit_bufsize-1}K6._tr_init=uU;K6._tr_stored_block=GQ;K6._tr_flush_block=EU;K6._tr_tally=_U;K6._tr_align=SU});var C4=N0((Tz,BQ)=>{function cU($,q,Q,K){var J=$&65535|0,Z=$>>>16&65535|0,G=0;while(Q!==0){G=Q>2000?2000:Q,Q-=G;do J=J+q[K++]|0,Z=Z+J|0;while(--G);J%=65521,Z%=65521}return J|Z<<16|0}BQ.exports=cU});var j4=N0((uz,zQ)=>{function bU(){var $,q=[];for(var Q=0;Q<256;Q++){$=Q;for(var K=0;K<8;K++)$=$&1?3988292384^$>>>1:$>>>1;q[Q]=$}return q}var nU=bU();function dU($,q,Q,K){var J=nU,Z=K+Q;$^=-1;for(var G=K;G>>8^J[($^q[G])&255];return $^-1}zQ.exports=dU});var c8=N0((Sz,FQ)=>{FQ.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var vQ=N0((O2)=>{var r0=d2(),M2=WQ(),YQ=C4(),q1=j4(),mU=c8(),C1=0,pU=1,iU=3,Z1=4,MQ=5,x2=0,wQ=1,w2=-2,oU=-3,g4=-5,aU=-1,lU=1,b8=2,rU=3,sU=4,tU=0,eU=2,p8=8,$Z=9,QZ=15,qZ=8,KZ=29,JZ=256,X4=JZ+1+KZ,VZ=30,UZ=19,ZZ=2*X4+1,GZ=15,f0=3,V1=258,L2=V1+f0+1,WZ=32,i8=42,y4=69,n8=73,d8=91,m8=103,f1=113,r6=666,c0=1,s6=2,R1=3,U6=4,BZ=3;function U1($,q){return $.msg=mU[q],q}function NQ($){return($<<1)-($>4?9:0)}function J1($){var q=$.length;while(--q>=0)$[q]=0}function K1($){var q=$.state,Q=q.pending;if(Q>$.avail_out)Q=$.avail_out;if(Q===0)return;if(r0.arraySet($.output,q.pending_buf,q.pending_out,Q,$.next_out),$.next_out+=Q,q.pending_out+=Q,$.total_out+=Q,$.avail_out-=Q,q.pending-=Q,q.pending===0)q.pending_out=0}function d0($,q){M2._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,q),$.block_start=$.strstart,K1($.strm)}function C0($,q){$.pending_buf[$.pending++]=q}function l6($,q){$.pending_buf[$.pending++]=q>>>8&255,$.pending_buf[$.pending++]=q&255}function zZ($,q,Q,K){var J=$.avail_in;if(J>K)J=K;if(J===0)return 0;if($.avail_in-=J,r0.arraySet(q,$.input,$.next_in,J,Q),$.state.wrap===1)$.adler=YQ($.adler,q,J,Q);else if($.state.wrap===2)$.adler=q1($.adler,q,J,Q);return $.next_in+=J,$.total_in+=J,J}function kQ($,q){var{max_chain_length:Q,strstart:K}=$,J,Z,G=$.prev_length,W=$.nice_match,B=$.strstart>$.w_size-L2?$.strstart-($.w_size-L2):0,V=$.window,U=$.w_mask,w=$.prev,F=$.strstart+V1,M=V[K+G-1],k=V[K+G];if($.prev_length>=$.good_match)Q>>=2;if(W>$.lookahead)W=$.lookahead;do{if(J=q,V[J+G]!==k||V[J+G-1]!==M||V[J]!==V[K]||V[++J]!==V[K+1])continue;K+=2,J++;do;while(V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&V[++K]===V[++J]&&KG){if($.match_start=q,G=Z,Z>=W)break;M=V[K+G-1],k=V[K+G]}}while((q=w[q&U])>B&&--Q!==0);if(G<=$.lookahead)return G;return $.lookahead}function I1($){var q=$.w_size,Q,K,J,Z,G;do{if(Z=$.window_size-$.lookahead-$.strstart,$.strstart>=q+(q-L2)){r0.arraySet($.window,$.window,q,q,0),$.match_start-=q,$.strstart-=q,$.block_start-=q,K=$.hash_size,Q=K;do J=$.head[--Q],$.head[Q]=J>=q?J-q:0;while(--K);K=q,Q=K;do J=$.prev[--Q],$.prev[Q]=J>=q?J-q:0;while(--K);Z+=q}if($.strm.avail_in===0)break;if(K=zZ($.strm,$.window,$.strstart+$.lookahead,Z),$.lookahead+=K,$.lookahead+$.insert>=f0){G=$.strstart-$.insert,$.ins_h=$.window[G],$.ins_h=($.ins_h<<$.hash_shift^$.window[G+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[G+f0-1])&$.hash_mask,$.prev[G&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=G,G++,$.insert--,$.lookahead+$.insert$.pending_buf_size-5)Q=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(I1($),$.lookahead===0&&q===C1)return c0;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var K=$.block_start+Q;if($.strstart===0||$.strstart>=K){if($.lookahead=$.strstart-K,$.strstart=K,d0($,!1),$.strm.avail_out===0)return c0}if($.strstart-$.block_start>=$.w_size-L2){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.strstart>$.block_start){if(d0($,!1),$.strm.avail_out===0)return c0}return c0}function A4($,q){var Q,K;for(;;){if($.lookahead=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(Q!==0&&$.strstart-Q<=$.w_size-L2)$.match_length=kQ($,Q);if($.match_length>=f0)if(K=M2._tr_tally($,$.strstart-$.match_start,$.match_length-f0),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=f0){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else K=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(K){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=$.strstart=f0)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=f0-1,Q!==0&&$.prev_length<$.max_lazy_match&&$.strstart-Q<=$.w_size-L2){if($.match_length=kQ($,Q),$.match_length<=5&&($.strategy===lU||$.match_length===f0&&$.strstart-$.match_start>4096))$.match_length=f0-1}if($.prev_length>=f0&&$.match_length<=$.prev_length){J=$.strstart+$.lookahead-f0,K=M2._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-f0),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=J)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+f0-1])&$.hash_mask,Q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=f0-1,$.strstart++,K){if(d0($,!1),$.strm.avail_out===0)return c0}}else if($.match_available){if(K=M2._tr_tally($,0,$.window[$.strstart-1]),K)d0($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return c0}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)K=M2._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart=f0&&$.strstart>0){if(J=$.strstart-1,K=G[J],K===G[++J]&&K===G[++J]&&K===G[++J]){Z=$.strstart+V1;do;while(K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&K===G[++J]&&J$.lookahead)$.match_length=$.lookahead}}if($.match_length>=f0)Q=M2._tr_tally($,1,$.match_length-f0),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function wZ($,q){var Q;for(;;){if($.lookahead===0){if(I1($),$.lookahead===0){if(q===C1)return c0;break}}if($.match_length=0,Q=M2._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,Q){if(d0($,!1),$.strm.avail_out===0)return c0}}if($.insert=0,q===Z1){if(d0($,!0),$.strm.avail_out===0)return R1;return U6}if($.last_lit){if(d0($,!1),$.strm.avail_out===0)return c0}return s6}function h2($,q,Q,K,J){this.good_length=$,this.max_lazy=q,this.nice_length=Q,this.max_chain=K,this.func=J}var V6;V6=[new h2(0,0,0,0,FZ),new h2(4,4,8,4,A4),new h2(4,5,16,8,A4),new h2(4,6,32,32,A4),new h2(4,4,16,16,J6),new h2(8,16,32,32,J6),new h2(8,16,128,128,J6),new h2(8,32,128,256,J6),new h2(32,128,258,1024,J6),new h2(32,258,258,4096,J6)];function NZ($){$.window_size=2*$.w_size,J1($.head),$.max_lazy_match=V6[$.level].max_lazy,$.good_match=V6[$.level].good_length,$.nice_match=V6[$.level].nice_length,$.max_chain_length=V6[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=f0-1,$.match_available=0,$.ins_h=0}function YZ(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=p8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r0.Buf16(ZZ*2),this.dyn_dtree=new r0.Buf16((2*VZ+1)*2),this.bl_tree=new r0.Buf16((2*UZ+1)*2),J1(this.dyn_ltree),J1(this.dyn_dtree),J1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r0.Buf16(GZ+1),this.heap=new r0.Buf16(2*X4+1),J1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r0.Buf16(2*X4+1),J1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function DQ($){var q;if(!$||!$.state)return U1($,w2);if($.total_in=$.total_out=0,$.data_type=eU,q=$.state,q.pending=0,q.pending_out=0,q.wrap<0)q.wrap=-q.wrap;return q.status=q.wrap?i8:f1,$.adler=q.wrap===2?0:1,q.last_flush=C1,M2._tr_init(q),x2}function LQ($){var q=DQ($);if(q===x2)NZ($.state);return q}function kZ($,q){if(!$||!$.state)return w2;if($.state.wrap!==2)return w2;return $.state.gzhead=q,x2}function HQ($,q,Q,K,J,Z){if(!$)return w2;var G=1;if(q===aU)q=6;if(K<0)G=0,K=-K;else if(K>15)G=2,K-=16;if(J<1||J>$Z||Q!==p8||K<8||K>15||q<0||q>9||Z<0||Z>sU)return U1($,w2);if(K===8)K=9;var W=new YZ;return $.state=W,W.strm=$,W.wrap=G,W.gzhead=null,W.w_bits=K,W.w_size=1<MQ||q<0)return $?U1($,w2):w2;if(K=$.state,!$.output||!$.input&&$.avail_in!==0||K.status===r6&&q!==Z1)return U1($,$.avail_out===0?g4:w2);if(K.strm=$,Q=K.last_flush,K.last_flush=q,K.status===i8)if(K.wrap===2)if($.adler=0,C0(K,31),C0(K,139),C0(K,8),!K.gzhead)C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,0),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,BZ),K.status=f1;else{if(C0(K,(K.gzhead.text?1:0)+(K.gzhead.hcrc?2:0)+(!K.gzhead.extra?0:4)+(!K.gzhead.name?0:8)+(!K.gzhead.comment?0:16)),C0(K,K.gzhead.time&255),C0(K,K.gzhead.time>>8&255),C0(K,K.gzhead.time>>16&255),C0(K,K.gzhead.time>>24&255),C0(K,K.level===9?2:K.strategy>=b8||K.level<2?4:0),C0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)C0(K,K.gzhead.extra.length&255),C0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)$.adler=q1($.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=y4}else{var G=p8+(K.w_bits-8<<4)<<8,W=-1;if(K.strategy>=b8||K.level<2)W=0;else if(K.level<6)W=1;else if(K.level===6)W=2;else W=3;if(G|=W<<6,K.strstart!==0)G|=WZ;if(G+=31-G%31,K.status=f1,l6(K,G),K.strstart!==0)l6(K,$.adler>>>16),l6(K,$.adler&65535);$.adler=1}if(K.status===y4)if(K.gzhead.extra){J=K.pending;while(K.gzindex<(K.gzhead.extra.length&65535)){if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size)break}C0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=n8}else K.status=n8;if(K.status===n8)if(K.gzhead.name){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.gzindex=0,K.status=d8}else K.status=d8;if(K.status===d8)if(K.gzhead.comment){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(K1($),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)$.adler=q1($.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.status=m8}else K.status=m8;if(K.status===m8)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)K1($);if(K.pending+2<=K.pending_buf_size)C0(K,$.adler&255),C0(K,$.adler>>8&255),$.adler=0,K.status=f1}else K.status=f1;if(K.pending!==0){if(K1($),$.avail_out===0)return K.last_flush=-1,x2}else if($.avail_in===0&&NQ(q)<=NQ(Q)&&q!==Z1)return U1($,g4);if(K.status===r6&&$.avail_in!==0)return U1($,g4);if($.avail_in!==0||K.lookahead!==0||q!==C1&&K.status!==r6){var B=K.strategy===b8?wZ(K,q):K.strategy===rU?MZ(K,q):V6[K.level].func(K,q);if(B===R1||B===U6)K.status=r6;if(B===c0||B===R1){if($.avail_out===0)K.last_flush=-1;return x2}if(B===s6){if(q===pU)M2._tr_align(K);else if(q!==MQ){if(M2._tr_stored_block(K,0,0,!1),q===iU){if(J1(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(K1($),$.avail_out===0)return K.last_flush=-1,x2}}if(q!==Z1)return x2;if(K.wrap<=0)return wQ;if(K.wrap===2)C0(K,$.adler&255),C0(K,$.adler>>8&255),C0(K,$.adler>>16&255),C0(K,$.adler>>24&255),C0(K,$.total_in&255),C0(K,$.total_in>>8&255),C0(K,$.total_in>>16&255),C0(K,$.total_in>>24&255);else l6(K,$.adler>>>16),l6(K,$.adler&65535);if(K1($),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?x2:wQ}function HZ($){var q;if(!$||!$.state)return w2;if(q=$.state.status,q!==i8&&q!==y4&&q!==n8&&q!==d8&&q!==m8&&q!==f1&&q!==r6)return U1($,w2);return $.state=null,q===f1?U1($,oU):x2}function vZ($,q){var Q=q.length,K,J,Z,G,W,B,V,U;if(!$||!$.state)return w2;if(K=$.state,G=K.wrap,G===2||G===1&&K.status!==i8||K.lookahead)return w2;if(G===1)$.adler=YQ($.adler,q,Q,0);if(K.wrap=0,Q>=K.w_size){if(G===0)J1(K.head),K.strstart=0,K.block_start=0,K.insert=0;U=new r0.Buf8(K.w_size),r0.arraySet(U,q,Q-K.w_size,K.w_size,0),q=U,Q=K.w_size}W=$.avail_in,B=$.next_in,V=$.input,$.avail_in=Q,$.next_in=0,$.input=q,I1(K);while(K.lookahead>=f0){J=K.strstart,Z=K.lookahead-(f0-1);do K.ins_h=(K.ins_h<{var o8=d2(),fQ=!0,RQ=!0;try{String.fromCharCode.apply(null,[0])}catch($){fQ=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){RQ=!1}var t6=new o8.Buf8(256);for(P2=0;P2<256;P2++)t6[P2]=P2>=252?6:P2>=248?5:P2>=240?4:P2>=224?3:P2>=192?2:1;var P2;t6[254]=t6[254]=1;Z6.string2buf=function($){var q,Q,K,J,Z,G=$.length,W=0;for(J=0;J>>6,q[Z++]=128|Q&63;else if(Q<65536)q[Z++]=224|Q>>>12,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63;else q[Z++]=240|Q>>>18,q[Z++]=128|Q>>>12&63,q[Z++]=128|Q>>>6&63,q[Z++]=128|Q&63}return q};function IQ($,q){if(q<65534){if($.subarray&&RQ||!$.subarray&&fQ)return String.fromCharCode.apply(null,o8.shrinkBuf($,q))}var Q="";for(var K=0;K4){W[K++]=65533,Q+=Z-1;continue}J&=Z===2?31:Z===3?15:7;while(Z>1&&Q1){W[K++]=65533;continue}if(J<65536)W[K++]=J;else J-=65536,W[K++]=55296|J>>10&1023,W[K++]=56320|J&1023}return IQ(W,K)};Z6.utf8border=function($,q){var Q;if(q=q||$.length,q>$.length)q=$.length;Q=q-1;while(Q>=0&&($[Q]&192)===128)Q--;if(Q<0)return q;if(Q===0)return q;return Q+t6[$[Q]]>q?Q:q}});var x4=N0((cz,CQ)=>{function fZ(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}CQ.exports=fZ});var XQ=N0((Q8)=>{var e6=vQ(),$8=d2(),P4=h4(),T4=c8(),RZ=x4(),AQ=Object.prototype.toString,IZ=0,O4=4,G6=0,jQ=1,gQ=2,CZ=-1,jZ=0,gZ=8;function j1($){if(!(this instanceof j1))return new j1($);this.options=$8.assign({level:CZ,method:gZ,chunkSize:16384,windowBits:15,memLevel:8,strategy:jZ,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>0)q.windowBits=-q.windowBits;else if(q.gzip&&q.windowBits>0&&q.windowBits<16)q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new RZ,this.strm.avail_out=0;var Q=e6.deflateInit2(this.strm,q.level,q.method,q.windowBits,q.memLevel,q.strategy);if(Q!==G6)throw Error(T4[Q]);if(q.header)e6.deflateSetHeader(this.strm,q.header);if(q.dictionary){var K;if(typeof q.dictionary==="string")K=P4.string2buf(q.dictionary);else if(AQ.call(q.dictionary)==="[object ArrayBuffer]")K=new Uint8Array(q.dictionary);else K=q.dictionary;if(Q=e6.deflateSetDictionary(this.strm,K),Q!==G6)throw Error(T4[Q]);this._dict_set=!0}}j1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J,Z;if(this.ended)return!1;if(Z=q===~~q?q:q===!0?O4:IZ,typeof $==="string")Q.input=P4.string2buf($);else if(AQ.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new $8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(J=e6.deflate(Q,Z),J!==jQ&&J!==G6)return this.onEnd(J),this.ended=!0,!1;if(Q.avail_out===0||Q.avail_in===0&&(Z===O4||Z===gQ))if(this.options.to==="string")this.onData(P4.buf2binstring($8.shrinkBuf(Q.output,Q.next_out)));else this.onData($8.shrinkBuf(Q.output,Q.next_out))}while((Q.avail_in>0||Q.avail_out===0)&&J!==jQ);if(Z===O4)return J=e6.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===G6;if(Z===gQ)return this.onEnd(G6),Q.avail_out=0,!0;return!0};j1.prototype.onData=function($){this.chunks.push($)};j1.prototype.onEnd=function($){if($===G6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=$8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function u4($,q){var Q=new j1(q);if(Q.push($,!0),Q.err)throw Q.msg||T4[Q.err];return Q.result}function AZ($,q){return q=q||{},q.raw=!0,u4($,q)}function XZ($,q){return q=q||{},q.gzip=!0,u4($,q)}Q8.Deflate=j1;Q8.deflate=u4;Q8.deflateRaw=AZ;Q8.gzip=XZ});var hQ=N0((nz,yQ)=>{var a8=30,yZ=12;yQ.exports=function(q,Q){var K,J,Z,G,W,B,V,U,w,F,M,k,f,L,D,z,N,H,v,j,n,d,_,X,P;K=q.state,J=q.next_in,X=q.input,Z=J+(q.avail_in-5),G=q.next_out,P=q.output,W=G-(Q-q.avail_out),B=G+(q.avail_out-257),V=K.dmax,U=K.wsize,w=K.whave,F=K.wnext,M=K.window,k=K.hold,f=K.bits,L=K.lencode,D=K.distcode,z=(1<>>24,k>>>=v,f-=v,v=H>>>16&255,v===0)P[G++]=H&65535;else if(v&16){if(j=H&65535,v&=15,v){if(f>>=v,f-=v}if(f<15)k+=X[J++]<>>24,k>>>=v,f-=v,v=H>>>16&255,v&16){if(n=H&65535,v&=15,fV){q.msg="invalid distance too far back",K.mode=a8;break $}if(k>>>=v,f-=v,v=G-W,n>v){if(v=n-v,v>w){if(K.sane){q.msg="invalid distance too far back",K.mode=a8;break $}}if(d=0,_=M,F===0){if(d+=U-v,v2)P[G++]=_[d++],P[G++]=_[d++],P[G++]=_[d++],j-=3;if(j){if(P[G++]=_[d++],j>1)P[G++]=_[d++]}}else{d=G-n;do P[G++]=P[d++],P[G++]=P[d++],P[G++]=P[d++],j-=3;while(j>2);if(j){if(P[G++]=P[d++],j>1)P[G++]=P[d++]}}}else if((v&64)===0){H=D[(H&65535)+(k&(1<>3,J-=j,f-=j<<3,k&=(1<{var xQ=d2(),W6=15,OQ=852,PQ=592,TQ=0,S4=1,uQ=2,hZ=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],xZ=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],OZ=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],PZ=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];SQ.exports=function(q,Q,K,J,Z,G,W,B){var V=B.bits,U=0,w=0,F=0,M=0,k=0,f=0,L=0,D=0,z=0,N=0,H,v,j,n,d,_=null,X=0,P,g=new xQ.Buf16(W6+1),c=new xQ.Buf16(W6+1),h=null,x=0,l,$0,Z0;for(U=0;U<=W6;U++)g[U]=0;for(w=0;w=1;M--)if(g[M]!==0)break;if(k>M)k=M;if(M===0)return Z[G++]=20971520,Z[G++]=20971520,B.bits=1,0;for(F=1;F0&&(q===TQ||M!==1))return-1;c[1]=0;for(U=1;UOQ||q===uQ&&z>PQ)return 1;for(;;){if(l=U-L,W[w]P)$0=h[x+W[w]],Z0=_[X+W[w]];else $0=96,Z0=0;H=1<>L)+v]=l<<24|$0<<16|Z0|0;while(v!==0);H=1<>=1;if(H!==0)N&=H-1,N+=H;else N=0;if(w++,--g[U]===0){if(U===M)break;U=Q[K+W[w]]}if(U>k&&(N&n)!==j){if(L===0)L=k;d+=F,f=U-L,D=1<OQ||q===uQ&&z>PQ)return 1;j=N&n,Z[j]=k<<24|f<<16|d-G|0}}if(N!==0)Z[d+N]=U-L<<24|4194304|0;return B.bits=k,0}});var Lq=N0((H2)=>{var U2=d2(),d4=C4(),T2=j4(),TZ=hQ(),q8=EQ(),uZ=0,Bq=1,zq=2,_Q=4,SZ=5,l8=6,g1=0,EZ=1,_Z=2,N2=-2,Fq=-3,m4=-4,cZ=-5,cQ=8,Mq=1,bQ=2,nQ=3,dQ=4,mQ=5,pQ=6,iQ=7,oQ=8,aQ=9,lQ=10,t8=11,p2=12,E4=13,rQ=14,_4=15,sQ=16,tQ=17,eQ=18,$q=19,r8=20,s8=21,Qq=22,qq=23,Kq=24,Jq=25,Vq=26,c4=27,Uq=28,Zq=29,x0=30,p4=31,bZ=32,nZ=852,dZ=592,mZ=15,pZ=mZ;function Gq($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function iZ(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U2.Buf16(320),this.work=new U2.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function wq($){var q;if(!$||!$.state)return N2;if(q=$.state,$.total_in=$.total_out=q.total=0,$.msg="",q.wrap)$.adler=q.wrap&1;return q.mode=Mq,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new U2.Buf32(nZ),q.distcode=q.distdyn=new U2.Buf32(dZ),q.sane=1,q.back=-1,g1}function Nq($){var q;if(!$||!$.state)return N2;return q=$.state,q.wsize=0,q.whave=0,q.wnext=0,wq($)}function Yq($,q){var Q,K;if(!$||!$.state)return N2;if(K=$.state,q<0)Q=0,q=-q;else if(Q=(q>>4)+1,q<48)q&=15;if(q&&(q<8||q>15))return N2;if(K.window!==null&&K.wbits!==q)K.window=null;return K.wrap=Q,K.wbits=q,Nq($)}function kq($,q){var Q,K;if(!$)return N2;if(K=new iZ,$.state=K,K.window=null,Q=Yq($,q),Q!==g1)$.state=null;return Q}function oZ($){return kq($,pZ)}var Wq=!0,b4,n4;function aZ($){if(Wq){var q;b4=new U2.Buf32(512),n4=new U2.Buf32(32),q=0;while(q<144)$.lens[q++]=8;while(q<256)$.lens[q++]=9;while(q<280)$.lens[q++]=7;while(q<288)$.lens[q++]=8;q8(Bq,$.lens,0,288,b4,0,$.work,{bits:9}),q=0;while(q<32)$.lens[q++]=5;q8(zq,$.lens,0,32,n4,0,$.work,{bits:5}),Wq=!1}$.lencode=b4,$.lenbits=9,$.distcode=n4,$.distbits=5}function Dq($,q,Q,K){var J,Z=$.state;if(Z.window===null)Z.wsize=1<=Z.wsize)U2.arraySet(Z.window,q,Q-Z.wsize,Z.wsize,0),Z.wnext=0,Z.whave=Z.wsize;else{if(J=Z.wsize-Z.wnext,J>K)J=K;if(U2.arraySet(Z.window,q,Q-K,J,Z.wnext),K-=J,K)U2.arraySet(Z.window,q,Q-K,K,0),Z.wnext=K,Z.whave=Z.wsize;else{if(Z.wnext+=J,Z.wnext===Z.wsize)Z.wnext=0;if(Z.whave>>8&255,Q.check=T2(Q.check,_,2,0),V=0,U=0,Q.mode=bQ;break}if(Q.flags=0,Q.head)Q.head.done=!1;if(!(Q.wrap&1)||(((V&255)<<8)+(V>>8))%31){$.msg="incorrect header check",Q.mode=x0;break}if((V&15)!==cQ){$.msg="unknown compression method",Q.mode=x0;break}if(V>>>=4,U-=4,n=(V&15)+8,Q.wbits===0)Q.wbits=n;else if(n>Q.wbits){$.msg="invalid window size",Q.mode=x0;break}Q.dmax=1<>8&1;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=nQ;case nQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>8&255,_[2]=V>>>16&255,_[3]=V>>>24&255,Q.check=T2(Q.check,_,4,0);V=0,U=0,Q.mode=dQ;case dQ:while(U<16){if(W===0)break $;W--,V+=K[Z++]<>8;if(Q.flags&512)_[0]=V&255,_[1]=V>>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0,Q.mode=mQ;case mQ:if(Q.flags&1024){while(U<16){if(W===0)break $;W--,V+=K[Z++]<>>8&255,Q.check=T2(Q.check,_,2,0);V=0,U=0}else if(Q.head)Q.head.extra=null;Q.mode=pQ;case pQ:if(Q.flags&1024){if(M=Q.length,M>W)M=W;if(M){if(Q.head){if(n=Q.head.extra_len-Q.length,!Q.head.extra)Q.head.extra=Array(Q.head.extra_len);U2.arraySet(Q.head.extra,K,Z,M,n)}if(Q.flags&512)Q.check=T2(Q.check,K,M,Z);W-=M,Z+=M,Q.length-=M}if(Q.length)break $}Q.length=0,Q.mode=iQ;case iQ:if(Q.flags&2048){if(W===0)break $;M=0;do if(n=K[Z+M++],Q.head&&n&&Q.length<65536)Q.head.name+=String.fromCharCode(n);while(n&&M>9&1,Q.head.done=!0;$.adler=Q.check=0,Q.mode=p2;break;case lQ:while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>=U&7,U-=U&7,Q.mode=c4;break}while(U<3){if(W===0)break $;W--,V+=K[Z++]<>>=1,U-=1,V&3){case 0:Q.mode=rQ;break;case 1:if(aZ(Q),Q.mode=r8,q===l8){V>>>=2,U-=2;break $}break;case 2:Q.mode=tQ;break;case 3:$.msg="invalid block type",Q.mode=x0}V>>>=2,U-=2;break;case rQ:V>>>=U&7,U-=U&7;while(U<32){if(W===0)break $;W--,V+=K[Z++]<>>16^65535)){$.msg="invalid stored block lengths",Q.mode=x0;break}if(Q.length=V&65535,V=0,U=0,Q.mode=_4,q===l8)break $;case _4:Q.mode=sQ;case sQ:if(M=Q.length,M){if(M>W)M=W;if(M>B)M=B;if(M===0)break $;U2.arraySet(J,K,Z,M,G),W-=M,Z+=M,B-=M,G+=M,Q.length-=M;break}Q.mode=p2;break;case tQ:while(U<14){if(W===0)break $;W--,V+=K[Z++]<>>=5,U-=5,Q.ndist=(V&31)+1,V>>>=5,U-=5,Q.ncode=(V&15)+4,V>>>=4,U-=4,Q.nlen>286||Q.ndist>30){$.msg="too many length or distance symbols",Q.mode=x0;break}Q.have=0,Q.mode=eQ;case eQ:while(Q.have>>=3,U-=3}while(Q.have<19)Q.lens[g[Q.have++]]=0;if(Q.lencode=Q.lendyn,Q.lenbits=7,X={bits:Q.lenbits},d=q8(uZ,Q.lens,0,19,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid code lengths set",Q.mode=x0;break}Q.have=0,Q.mode=$q;case $q:while(Q.have>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=D,U-=D,Q.lens[Q.have++]=N;else{if(N===16){P=D+2;while(U>>=D,U-=D,Q.have===0){$.msg="invalid bit length repeat",Q.mode=x0;break}n=Q.lens[Q.have-1],M=3+(V&3),V>>>=2,U-=2}else if(N===17){P=D+3;while(U>>=D,U-=D,n=0,M=3+(V&7),V>>>=3,U-=3}else{P=D+7;while(U>>=D,U-=D,n=0,M=11+(V&127),V>>>=7,U-=7}if(Q.have+M>Q.nlen+Q.ndist){$.msg="invalid bit length repeat",Q.mode=x0;break}while(M--)Q.lens[Q.have++]=n}}if(Q.mode===x0)break;if(Q.lens[256]===0){$.msg="invalid code -- missing end-of-block",Q.mode=x0;break}if(Q.lenbits=9,X={bits:Q.lenbits},d=q8(Bq,Q.lens,0,Q.nlen,Q.lencode,0,Q.work,X),Q.lenbits=X.bits,d){$.msg="invalid literal/lengths set",Q.mode=x0;break}if(Q.distbits=6,Q.distcode=Q.distdyn,X={bits:Q.distbits},d=q8(zq,Q.lens,Q.nlen,Q.ndist,Q.distcode,0,Q.work,X),Q.distbits=X.bits,d){$.msg="invalid distances set",Q.mode=x0;break}if(Q.mode=r8,q===l8)break $;case r8:Q.mode=s8;case s8:if(W>=6&&B>=258){if($.next_out=G,$.avail_out=B,$.next_in=Z,$.avail_in=W,Q.hold=V,Q.bits=U,TZ($,F),G=$.next_out,J=$.output,B=$.avail_out,Z=$.next_in,K=$.input,W=$.avail_in,V=Q.hold,U=Q.bits,Q.mode===p2)Q.back=-1;break}Q.back=0;for(;;){if(L=Q.lencode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,Q.length=N,z===0){Q.mode=Vq;break}if(z&32){Q.back=-1,Q.mode=p2;break}if(z&64){$.msg="invalid literal/length code",Q.mode=x0;break}Q.extra=z&15,Q.mode=Qq;case Qq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}Q.was=Q.length,Q.mode=qq;case qq:for(;;){if(L=Q.distcode[V&(1<>>24,z=L>>>16&255,N=L&65535,D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>H)],D=L>>>24,z=L>>>16&255,N=L&65535,H+D<=U)break;if(W===0)break $;W--,V+=K[Z++]<>>=H,U-=H,Q.back+=H}if(V>>>=D,U-=D,Q.back+=D,z&64){$.msg="invalid distance code",Q.mode=x0;break}Q.offset=N,Q.extra=z&15,Q.mode=Kq;case Kq:if(Q.extra){P=Q.extra;while(U>>=Q.extra,U-=Q.extra,Q.back+=Q.extra}if(Q.offset>Q.dmax){$.msg="invalid distance too far back",Q.mode=x0;break}Q.mode=Jq;case Jq:if(B===0)break $;if(M=F-B,Q.offset>M){if(M=Q.offset-M,M>Q.whave){if(Q.sane){$.msg="invalid distance too far back",Q.mode=x0;break}}if(M>Q.wnext)M-=Q.wnext,k=Q.wsize-M;else k=Q.wnext-M;if(M>Q.length)M=Q.length;f=Q.window}else f=J,k=G-Q.offset,M=Q.length;if(M>B)M=B;B-=M,Q.length-=M;do J[G++]=f[k++];while(--M);if(Q.length===0)Q.mode=s8;break;case Vq:if(B===0)break $;J[G++]=Q.length,B--,Q.mode=s8;break;case c4:if(Q.wrap){while(U<32){if(W===0)break $;W--,V|=K[Z++]<{Hq.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var fq=N0((iz,vq)=>{function eZ(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}vq.exports=eZ});var Iq=N0((J8)=>{var B6=Lq(),K8=d2(),e8=h4(),E0=i4(),o4=c8(),$G=x4(),QG=fq(),Rq=Object.prototype.toString;function A1($){if(!(this instanceof A1))return new A1($);this.options=K8.assign({chunkSize:16384,windowBits:0,to:""},$||{});var q=this.options;if(q.raw&&q.windowBits>=0&&q.windowBits<16){if(q.windowBits=-q.windowBits,q.windowBits===0)q.windowBits=-15}if(q.windowBits>=0&&q.windowBits<16&&!($&&$.windowBits))q.windowBits+=32;if(q.windowBits>15&&q.windowBits<48){if((q.windowBits&15)===0)q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $G,this.strm.avail_out=0;var Q=B6.inflateInit2(this.strm,q.windowBits);if(Q!==E0.Z_OK)throw Error(o4[Q]);if(this.header=new QG,B6.inflateGetHeader(this.strm,this.header),q.dictionary){if(typeof q.dictionary==="string")q.dictionary=e8.string2buf(q.dictionary);else if(Rq.call(q.dictionary)==="[object ArrayBuffer]")q.dictionary=new Uint8Array(q.dictionary);if(q.raw){if(Q=B6.inflateSetDictionary(this.strm,q.dictionary),Q!==E0.Z_OK)throw Error(o4[Q])}}}A1.prototype.push=function($,q){var Q=this.strm,K=this.options.chunkSize,J=this.options.dictionary,Z,G,W,B,V,U=!1;if(this.ended)return!1;if(G=q===~~q?q:q===!0?E0.Z_FINISH:E0.Z_NO_FLUSH,typeof $==="string")Q.input=e8.binstring2buf($);else if(Rq.call($)==="[object ArrayBuffer]")Q.input=new Uint8Array($);else Q.input=$;Q.next_in=0,Q.avail_in=Q.input.length;do{if(Q.avail_out===0)Q.output=new K8.Buf8(K),Q.next_out=0,Q.avail_out=K;if(Z=B6.inflate(Q,E0.Z_NO_FLUSH),Z===E0.Z_NEED_DICT&&J)Z=B6.inflateSetDictionary(this.strm,J);if(Z===E0.Z_BUF_ERROR&&U===!0)Z=E0.Z_OK,U=!1;if(Z!==E0.Z_STREAM_END&&Z!==E0.Z_OK)return this.onEnd(Z),this.ended=!0,!1;if(Q.next_out){if(Q.avail_out===0||Z===E0.Z_STREAM_END||Q.avail_in===0&&(G===E0.Z_FINISH||G===E0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(W=e8.utf8border(Q.output,Q.next_out),B=Q.next_out-W,V=e8.buf2string(Q.output,W),Q.next_out=B,Q.avail_out=K-B,B)K8.arraySet(Q.output,Q.output,W,B,0);this.onData(V)}else this.onData(K8.shrinkBuf(Q.output,Q.next_out))}if(Q.avail_in===0&&Q.avail_out===0)U=!0}while((Q.avail_in>0||Q.avail_out===0)&&Z!==E0.Z_STREAM_END);if(Z===E0.Z_STREAM_END)G=E0.Z_FINISH;if(G===E0.Z_FINISH)return Z=B6.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===E0.Z_OK;if(G===E0.Z_SYNC_FLUSH)return this.onEnd(E0.Z_OK),Q.avail_out=0,!0;return!0};A1.prototype.onData=function($){this.chunks.push($)};A1.prototype.onEnd=function($){if($===E0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=K8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function a4($,q){var Q=new A1(q);if(Q.push($,!0),Q.err)throw Q.msg||o4[Q.err];return Q.result}function qG($,q){return q=q||{},q.raw=!0,a4($,q)}J8.Inflate=A1;J8.inflate=a4;J8.inflateRaw=qG;J8.ungzip=a4});var gq=N0((az,jq)=>{var KG=d2().assign,JG=XQ(),VG=Iq(),UG=i4(),Cq={};KG(Cq,JG,VG,UG);jq.exports=Cq});var Xq=N0((Q5)=>{var ZG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",GG=gq(),Aq=T0(),$5=V2(),WG=ZG?"uint8array":"array";Q5.magic="\b\x00";function X1($,q){$5.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=q,this.meta={}}Aq.inherits(X1,$5);X1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(Aq.transformTo(WG,$.data),!1)};X1.prototype.flush=function(){if($5.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};X1.prototype.cleanUp=function(){$5.prototype.cleanUp.call(this),this._pako=null};X1.prototype._createPako=function(){this._pako=new GG[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(q){$.push({data:q,meta:$.meta})}};Q5.compressWorker=function($){return new X1("Deflate",$)};Q5.uncompressWorker=function(){return new X1("Inflate",{})}});var r4=N0((l4)=>{var yq=V2();l4.STORE={magic:"\x00\x00",compressWorker:function(){return new yq("STORE compression")},uncompressWorker:function(){return new yq("STORE decompression")}};l4.DEFLATE=Xq()});var s4=N0((y1)=>{y1.LOCAL_FILE_HEADER="PK\x03\x04";y1.CENTRAL_FILE_HEADER="PK\x01\x02";y1.CENTRAL_DIRECTORY_END="PK\x05\x06";y1.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";y1.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";y1.DATA_DESCRIPTOR="PK\x07\b"});var Pq=N0((tz,Oq)=>{var z6=T0(),F6=V2(),t4=e1(),hq=u8(),q5=s4(),A0=function($,q){var Q="",K;for(K=0;K>>8;return Q},BG=function($,q){var Q=$;if(!$)Q=q?16893:33204;return(Q&65535)<<16},zG=function($){return($||0)&63},xq=function($,q,Q,K,J,Z){var{file:G,compression:W}=$,B=Z!==t4.utf8encode,V=z6.transformTo("string",Z(G.name)),U=z6.transformTo("string",t4.utf8encode(G.name)),w=G.comment,F=z6.transformTo("string",Z(w)),M=z6.transformTo("string",t4.utf8encode(w)),k=U.length!==G.name.length,f=M.length!==w.length,L,D,z="",N="",H="",v=G.dir,j=G.date,n={crc32:0,compressedSize:0,uncompressedSize:0};if(!q||Q)n.crc32=$.crc32,n.compressedSize=$.compressedSize,n.uncompressedSize=$.uncompressedSize;var d=0;if(q)d|=8;if(!B&&(k||f))d|=2048;var _=0,X=0;if(v)_|=16;if(J==="UNIX")X=798,_|=BG(G.unixPermissions,v);else X=20,_|=zG(G.dosPermissions,v);if(L=j.getUTCHours(),L=L<<6,L=L|j.getUTCMinutes(),L=L<<5,L=L|j.getUTCSeconds()/2,D=j.getUTCFullYear()-1980,D=D<<4,D=D|j.getUTCMonth()+1,D=D<<5,D=D|j.getUTCDate(),k)N=A0(1,1)+A0(hq(V),4)+U,z+="up"+A0(N.length,2)+N;if(f)H=A0(1,1)+A0(hq(F),4)+M,z+="uc"+A0(H.length,2)+H;var P="";P+=` +\x00`,P+=A0(d,2),P+=W.magic,P+=A0(L,2),P+=A0(D,2),P+=A0(n.crc32,4),P+=A0(n.compressedSize,4),P+=A0(n.uncompressedSize,4),P+=A0(V.length,2),P+=A0(z.length,2);var g=q5.LOCAL_FILE_HEADER+P+V+z,c=q5.CENTRAL_FILE_HEADER+A0(X,2)+P+A0(F.length,2)+"\x00\x00\x00\x00"+A0(_,4)+A0(K,4)+V+z+F;return{fileRecord:g,dirRecord:c}},FG=function($,q,Q,K,J){var Z="",G=z6.transformTo("string",J(K));return Z=q5.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+A0($,2)+A0($,2)+A0(q,4)+A0(Q,4)+A0(G.length,2)+G,Z},MG=function($){var q="";return q=q5.DATA_DESCRIPTOR+A0($.crc32,4)+A0($.compressedSize,4)+A0($.uncompressedSize,4),q};function v2($,q,Q,K){F6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=q,this.zipPlatform=Q,this.encodeFileName=K,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}z6.inherits(v2,F6);v2.prototype.push=function($){var q=$.meta.percent||0,Q=this.entriesCount,K=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,F6.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:Q?(q+100*(Q-K-1))/Q:100}})};v2.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var q=this.streamFiles&&!$.file.dir;if(q){var Q=xq($,q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:Q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};v2.prototype.closedSource=function($){this.accumulate=!1;var q=this.streamFiles&&!$.file.dir,Q=xq($,q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(Q.dirRecord),q)this.push({data:MG($),meta:{percent:100}});else{this.push({data:Q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};v2.prototype.flush=function(){var $=this.bytesWritten;for(var q=0;q{var wG=r4(),NG=Pq(),YG=function($,q){var Q=$||q,K=wG[Q];if(!K)throw Error(Q+" is not a valid compression method !");return K};Tq.generateWorker=function($,q,Q){var K=new NG(q.streamFiles,Q,q.platform,q.encodeFileName),J=0;try{$.forEach(function(Z,G){J++;var W=YG(G.options.compression,q.compression),B=G.options.compressionOptions||q.compressionOptions||{},V=G.dir,U=G.date;G._compressWorker(W,B).withStreamInfo("file",{name:Z,dir:V,date:U,comment:G.comment||"",unixPermissions:G.unixPermissions,dosPermissions:G.dosPermissions}).pipe(K)}),K.entriesCount=J}catch(Z){K.error(Z)}return K}});var Eq=N0(($F,Sq)=>{var kG=T0(),K5=V2();function V8($,q){K5.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(q)}kG.inherits(V8,K5);V8.prototype._bindStream=function($){var q=this;this._stream=$,$.pause(),$.on("data",function(Q){q.push({data:Q,meta:{percent:0}})}).on("error",function(Q){if(q.isPaused)this.generatedError=Q;else q.error(Q)}).on("end",function(){if(q.isPaused)q._upstreamEnded=!0;else q.end()})};V8.prototype.pause=function(){if(!K5.prototype.pause.call(this))return!1;return this._stream.pause(),!0};V8.prototype.resume=function(){if(!K5.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};Sq.exports=V8});var aq=N0((QF,oq)=>{var DG=e1(),U8=T0(),nq=V2(),LG=K4(),dq=J4(),_q=S8(),HG=c$(),vG=uq(),cq=T6(),fG=Eq(),mq=function($,q,Q){var K=U8.getTypeOf(q),J,Z=U8.extend(Q||{},dq);if(Z.date=Z.date||new Date,Z.compression!==null)Z.compression=Z.compression.toUpperCase();if(typeof Z.unixPermissions==="string")Z.unixPermissions=parseInt(Z.unixPermissions,8);if(Z.unixPermissions&&Z.unixPermissions&16384)Z.dir=!0;if(Z.dosPermissions&&Z.dosPermissions&16)Z.dir=!0;if(Z.dir)$=pq($);if(Z.createFolders&&(J=RG($)))iq.call(this,J,!0);var G=K==="string"&&Z.binary===!1&&Z.base64===!1;if(!Q||typeof Q.binary>"u")Z.binary=!G;var W=q instanceof _q&&q.uncompressedSize===0;if(W||Z.dir||!q||q.length===0)Z.base64=!1,Z.binary=!0,q="",Z.compression="STORE",K="string";var B=null;if(q instanceof _q||q instanceof nq)B=q;else if(cq.isNode&&cq.isStream(q))B=new fG($,q);else B=U8.prepareContent($,q,Z.binary,Z.optimizedBinaryString,Z.base64);var V=new HG($,B,Z);this.files[$]=V},RG=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var q=$.lastIndexOf("/");return q>0?$.substring(0,q):""},pq=function($){if($.slice(-1)!=="/")$+="/";return $},iq=function($,q){if(q=typeof q<"u"?q:dq.createFolders,$=pq($),!this.files[$])mq.call(this,$,null,{dir:!0,createFolders:q});return this.files[$]};function bq($){return Object.prototype.toString.call($)==="[object RegExp]"}var IG={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var q,Q,K;for(q in this.files)if(K=this.files[q],Q=q.slice(this.root.length,q.length),Q&&q.slice(0,this.root.length)===this.root)$(Q,K)},filter:function($){var q=[];return this.forEach(function(Q,K){if($(Q,K))q.push(K)}),q},file:function($,q,Q){if(arguments.length===1)if(bq($)){var K=$;return this.filter(function(Z,G){return!G.dir&&K.test(Z)})}else{var J=this.files[this.root+$];if(J&&!J.dir)return J;else return null}else $=this.root+$,mq.call(this,$,q,Q);return this},folder:function($){if(!$)return this;if(bq($))return this.filter(function(J,Z){return Z.dir&&$.test(J)});var q=this.root+$,Q=iq.call(this,q),K=this.clone();return K.root=Q.name,K},remove:function($){$=this.root+$;var q=this.files[$];if(!q){if($.slice(-1)!=="/")$+="/";q=this.files[$]}if(q&&!q.dir)delete this.files[$];else{var Q=this.filter(function(J,Z){return Z.name.slice(0,$.length)===$});for(var K=0;K{var CG=T0();function lq($){this.data=$,this.length=$.length,this.index=0,this.zero=0}lq.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length=this.index;Q--)q=(q<<8)+this.byteAt(Q);return this.index+=$,q},readString:function($){return CG.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};rq.exports=lq});var $7=N0((KF,tq)=>{var sq=e4(),jG=T0();function M6($){sq.call(this,$);for(var q=0;q=0;--Z)if(this.data[Z]===q&&this.data[Z+1]===Q&&this.data[Z+2]===K&&this.data[Z+3]===J)return Z-this.zero;return-1};M6.prototype.readAndCheckSignature=function($){var q=$.charCodeAt(0),Q=$.charCodeAt(1),K=$.charCodeAt(2),J=$.charCodeAt(3),Z=this.readData(4);return q===Z[0]&&Q===Z[1]&&K===Z[2]&&J===Z[3]};M6.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};tq.exports=M6});var QK=N0((JF,$K)=>{var eq=e4(),gG=T0();function w6($){eq.call(this,$)}gG.inherits(w6,eq);w6.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};w6.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};w6.prototype.readAndCheckSignature=function($){var q=this.readData(4);return $===q};w6.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};$K.exports=w6});var q7=N0((VF,KK)=>{var qK=$7(),AG=T0();function Q7($){qK.call(this,$)}AG.inherits(Q7,qK);Q7.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};KK.exports=Q7});var UK=N0((UF,VK)=>{var JK=q7(),XG=T0();function K7($){JK.call(this,$)}XG.inherits(K7,JK);K7.prototype.readData=function($){this.checkOffset($);var q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,q};VK.exports=K7});var J7=N0((ZF,GK)=>{var J5=T0(),ZK=n2(),yG=$7(),hG=QK(),xG=UK(),OG=q7();GK.exports=function($){var q=J5.getTypeOf($);if(J5.checkSupport(q),q==="string"&&!ZK.uint8array)return new hG($);if(q==="nodebuffer")return new xG($);if(ZK.uint8array)return new OG(J5.transformTo("uint8array",$));return new yG(J5.transformTo("array",$))}});var FK=N0((GF,zK)=>{var V7=J7(),G1=T0(),PG=S8(),WK=u8(),V5=e1(),U5=r4(),TG=n2(),uG=0,SG=3,EG=function($){for(var q in U5){if(!Object.prototype.hasOwnProperty.call(U5,q))continue;if(U5[q].magic===$)return U5[q]}return null};function BK($,q){this.options=$,this.loadOptions=q}BK.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var q,Q;if($.skip(22),this.fileNameLength=$.readInt(2),Q=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(Q),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(q=EG(this.compressionMethod),q===null)throw Error("Corrupted zip : compression "+G1.pretty(this.compressionMethod)+" unknown (inner file : "+G1.transformTo("string",this.fileName)+")");this.decompressed=new PG(this.compressedSize,this.uncompressedSize,this.crc32,q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===uG)this.dosPermissions=this.externalFileAttributes&63;if($===SG)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=V7(this.extraFields[1].value);if(this.uncompressedSize===G1.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G1.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G1.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G1.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var q=$.index+this.extraFieldsLength,Q,K,J;if(!this.extraFields)this.extraFields={};while($.index+4{var _G=J7(),i2=T0(),f2=s4(),cG=FK(),bG=n2();function MK($){this.files=[],this.loadOptions=$}MK.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+i2.pretty(q)+", expected "+i2.pretty($)+")")}},isSignature:function($,q){var Q=this.reader.index;this.reader.setIndex($);var K=this.reader.readString(4),J=K===q;return this.reader.setIndex(Q),J},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),q=bG.uint8array?"uint8array":"array",Q=i2.transformTo(q,$);this.zipComment=this.loadOptions.decodeFileName(Q)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,q=0,Q,K,J;while(q<$)Q=this.reader.readInt(2),K=this.reader.readInt(4),J=this.reader.readData(K),this.zip64ExtensibleData[Q]={id:Q,length:K,value:J}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,q;for($=0;$0)if(this.isSignature(Q,f2.CENTRAL_FILE_HEADER));else this.reader.zero=J;else if(J<0)throw Error("Corrupted zip: missing "+Math.abs(J)+" bytes.")},prepareReader:function($){this.reader=_G($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};wK.exports=MK});var DK=N0((BF,kK)=>{var U7=T0(),Z5=r1(),nG=e1(),dG=NK(),mG=Z4(),YK=T6();function pG($){return new Z5.Promise(function(q,Q){var K=$.decompressed.getContentWorker().pipe(new mG);K.on("error",function(J){Q(J)}).on("end",function(){if(K.streamInfo.crc32!==$.decompressed.crc32)Q(Error("Corrupted zip : CRC32 mismatch"));else q()}).resume()})}kK.exports=function($,q){var Q=this;if(q=U7.extend(q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:nG.utf8decode}),YK.isNode&&YK.isStream($))return Z5.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return U7.prepareContent("the loaded zip file",$,!0,q.optimizedBinaryString,q.base64).then(function(K){var J=new dG(q);return J.load(K),J}).then(function(J){var Z=[Z5.Promise.resolve(J)],G=J.files;if(q.checkCRC32)for(var W=0;W{function Y2(){if(!(this instanceof Y2))return new Y2;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new Y2;for(var q in this)if(typeof this[q]!=="function")$[q]=this[q];return $}}Y2.prototype=aq();Y2.prototype.loadAsync=DK();Y2.support=n2();Y2.defaults=J4();Y2.version="3.10.1";Y2.loadAsync=function($,q){return new Y2().loadAsync($,q)};Y2.external=r1();LK.exports=Y2});var Z8={};c1(Z8,{types:()=>QW,promisify:()=>jK,log:()=>RK,isUndefined:()=>N6,isSymbol:()=>KW,isString:()=>M5,isRegExp:()=>G5,isPrimitive:()=>JW,isObject:()=>Y6,isNumber:()=>fK,isNullOrUndefined:()=>qW,isNull:()=>F5,isFunction:()=>B5,isError:()=>W5,isDate:()=>B7,isBuffer:()=>VW,isBoolean:()=>F7,isArray:()=>vK,inspect:()=>h1,inherits:()=>IK,format:()=>z7,deprecate:()=>oG,default:()=>GW,debuglog:()=>aG,callbackifyOnRejected:()=>N7,callbackify:()=>gK,_extend:()=>w7,TextEncoder:()=>AK,TextDecoder:()=>XK});function z7($,...q){if(!M5($)){var Q=[$];for(var K=0;K=J)return W;switch(W){case"%s":return String(q[K++]);case"%d":return Number(q[K++]);case"%j":try{return JSON.stringify(q[K++])}catch(B){return"[Circular]"}default:return W}});for(var G=q[K];K"u"||process?.noDeprecation===!0)return $;var Q=!1;function K(...J){if(!Q){if(process.throwDeprecation)throw Error(q);else if(process.traceDeprecation)console.trace(q);else console.error(q);Q=!0}return $.apply(this,...J)}return K}function lG($,q){var Q=h1.styles[q];if(Q)return"\x1B["+h1.colors[Q][0]+"m"+$+"\x1B["+h1.colors[Q][1]+"m";else return $}function rG($,q){return $}function sG($){var q={};return $.forEach(function(Q,K){q[Q]=!0}),q}function z5($,q,Q){if($.customInspect&&q&&B5(q.inspect)&&q.inspect!==h1&&!(q.constructor&&q.constructor.prototype===q)){var K=q.inspect(Q,$);if(!M5(K))K=z5($,K,Q);return K}var J=tG($,q);if(J)return J;var Z=Object.keys(q),G=sG(Z);if($.showHidden)Z=Object.getOwnPropertyNames(q);if(W5(q)&&(Z.indexOf("message")>=0||Z.indexOf("description")>=0))return Z7(q);if(Z.length===0){if(B5(q)){var W=q.name?": "+q.name:"";return $.stylize("[Function"+W+"]","special")}if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");if(B7(q))return $.stylize(Date.prototype.toString.call(q),"date");if(W5(q))return Z7(q)}var B="",V=!1,U=["{","}"];if(vK(q))V=!0,U=["[","]"];if(B5(q)){var w=q.name?": "+q.name:"";B=" [Function"+w+"]"}if(G5(q))B=" "+RegExp.prototype.toString.call(q);if(B7(q))B=" "+Date.prototype.toUTCString.call(q);if(W5(q))B=" "+Z7(q);if(Z.length===0&&(!V||q.length==0))return U[0]+B+U[1];if(Q<0)if(G5(q))return $.stylize(RegExp.prototype.toString.call(q),"regexp");else return $.stylize("[Object]","special");$.seen.push(q);var F;if(V)F=eG($,q,Q,G,Z);else F=Z.map(function(M){return W7($,q,Q,G,M,V)});return $.seen.pop(),$W(F,B,U)}function tG($,q){if(N6(q))return $.stylize("undefined","undefined");if(M5(q)){var Q="'"+JSON.stringify(q).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return $.stylize(Q,"string")}if(fK(q))return $.stylize(""+q,"number");if(F7(q))return $.stylize(""+q,"boolean");if(F5(q))return $.stylize("null","null")}function Z7($){return"["+Error.prototype.toString.call($)+"]"}function eG($,q,Q,K,J){var Z=[];for(var G=0,W=q.length;G-1)if(Z)W=W.split(` `).map(function(V){return" "+V}).join(` `).slice(2);else W=` @@ -13,23 +13,23 @@ `)>=0)K++;return Z+G.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(J>60)return Q[0]+(q===""?"":q+` `)+" "+$.join(`, `)+" "+Q[1];return Q[0]+q+" "+$.join(", ")+" "+Q[1]}function vK($){return Array.isArray($)}function F7($){return typeof $==="boolean"}function F5($){return $===null}function qW($){return $==null}function fK($){return typeof $==="number"}function M5($){return typeof $==="string"}function KW($){return typeof $==="symbol"}function N6($){return $===void 0}function G5($){return Y6($)&&M7($)==="[object RegExp]"}function Y6($){return typeof $==="object"&&$!==null}function B7($){return Y6($)&&M7($)==="[object Date]"}function W5($){return Y6($)&&(M7($)==="[object Error]"||$ instanceof Error)}function B5($){return typeof $==="function"}function JW($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}function VW($){return $ instanceof Buffer}function M7($){return Object.prototype.toString.call($)}function G7($){return $<10?"0"+$.toString(10):$.toString(10)}function ZW(){var $=new Date,q=[G7($.getHours()),G7($.getMinutes()),G7($.getSeconds())].join(":");return[$.getDate(),UW[$.getMonth()],q].join(" ")}function RK(...$){console.log("%s - %s",ZW(),z7.apply(null,$))}function IK($,q){if(q)$.super_=q,$.prototype=Object.create(q.prototype,{constructor:{value:$,enumerable:!1,writable:!0,configurable:!0}})}function w7($,q){if(!q||!Y6(q))return $;var Q=Object.keys(q),K=Q.length;while(K--)$[Q[K]]=q[Q[K]];return $}function CK($,q){return Object.prototype.hasOwnProperty.call($,q)}function N7($,q){if(!$){var Q=Error("Promise was rejected with a falsy value");Q.reason=$,$=Q}return q($)}function gK($){if(typeof $!=="function")throw TypeError('The "original" argument must be of type Function');function q(...Q){var K=Q.pop();if(typeof K!=="function")throw TypeError("The last argument must be of type Function");var J=this,Z=function(...G){return K.apply(J,...G)};$.apply(this,Q).then(function(G){process.nextTick(Z.bind(null,null,G))},function(G){process.nextTick(N7.bind(null,G,Z))})}return Object.setPrototypeOf(q,Object.getPrototypeOf($)),Object.defineProperties(q,Object.getOwnPropertyDescriptors($)),q}var iG,aG,h1,QW=()=>{},UW,jK,AK,XK,GW;var G8=b1(()=>{iG=/%[sdj%]/g;aG=(($={},q={},Q)=>((Q=typeof process<"u"&&!1)&&(Q=Q.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),q=new RegExp("^"+Q+"$","i"),(K)=>{if(K=K.toUpperCase(),!$[K])if(q.test(K))$[K]=function(...J){console.error("%s: %s",K,pid,z7.apply(null,...J))};else $[K]=function(){};return $[K]}))(),h1=(($)=>($.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},$.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},$.custom=Symbol.for("nodejs.util.inspect.custom"),$))(function($,q,...Q){var K={seen:[],stylize:rG};if(Q.length>=1)K.depth=Q[0];if(Q.length>=2)K.colors=Q[1];if(F7(q))K.showHidden=q;else if(q)w7(K,q);if(N6(K.showHidden))K.showHidden=!1;if(N6(K.depth))K.depth=2;if(N6(K.colors))K.colors=!1;if(K.colors)K.stylize=lG;return z5(K,$,K.depth)});UW=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];jK=(($)=>($.custom=Symbol.for("nodejs.util.promisify.custom"),$))(function($){if(typeof $!=="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&$[kCustomPromisifiedSymbol]){var q=$[kCustomPromisifiedSymbol];if(typeof q!=="function")throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(q,kCustomPromisifiedSymbol,{value:q,enumerable:!1,writable:!1,configurable:!0}),q}function q(...Q){var K,J,Z=new Promise(function(G,W){K=G,J=W});Q.push(function(G,W){if(G)J(G);else K(W)});try{$.apply(this,Q)}catch(G){J(G)}return Z}if(Object.setPrototypeOf(q,Object.getPrototypeOf($)),kCustomPromisifiedSymbol)Object.defineProperty(q,kCustomPromisifiedSymbol,{value:q,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(q,Object.getOwnPropertyDescriptors($))});({TextEncoder:AK,TextDecoder:XK}=globalThis),GW={TextEncoder:AK,TextDecoder:XK,promisify:jK,log:RK,inherits:IK,_extend:w7,callbackifyOnRejected:N7,callbackify:gK}});var v7={};c1(v7,{resolveObject:()=>SK,resolve:()=>uK,parse:()=>D6,format:()=>TK,default:()=>DW,Url:()=>Z2,URLSearchParams:()=>OK,URL:()=>L7});function H7($){return typeof $==="string"}function PK($){return typeof $==="object"&&$!==null}function w5($){return $===null}function WW($){return $==null}function Z2(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function D6($,q,Q){if($&&PK($)&&$ instanceof Z2)return $;var K=new Z2;return K.parse($,q,Q),K}function TK($){if(H7($))$=D6($);if(!($ instanceof Z2))return Z2.prototype.format.call($);return $.format()}function uK($,q){return D6($,!1,!0).resolve(q)}function SK($,q){if(!$)return q;return D6($,!1,!0).resolveObject(q)}var L7,OK,BW,zW,FW,MW,wW,Y7,yK,hK,NW=255,xK,YW,kW,k7,k6,D7,DW;var f7=b1(()=>{({URL:L7,URLSearchParams:OK}=globalThis);BW=/^([a-z0-9.+-]+:)/i,zW=/:[0-9]*$/,FW=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,MW=["<",">",'"',"`"," ","\r",` -`,"\t"],wW=["{","}","|","\\","^","`"].concat(MW),Y7=["'"].concat(wW),yK=["%","/","?",";","#"].concat(Y7),hK=["/","?","#"],xK=/^[+a-z0-9A-Z_-]{0,63}$/,YW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kW={javascript:!0,"javascript:":!0},k7={javascript:!0,"javascript:":!0},k6={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},D7={parse($){var q=decodeURIComponent;return($+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(Q,K,J){var Z=K.split("="),G=q(Z[0]||""),W=q(Z[1]||""),B=Q[G];return Q[G]=B===void 0?W:[].concat(B,W),Q},{})},stringify($){var q=encodeURIComponent;return Object.keys($||{}).reduce(function(Q,K){return[].concat($[K]).forEach(function(J){Q.push(q(K)+"="+q(J))}),Q},[]).join("&").replace(/\s/g,"+")}};Z2.prototype.parse=function($,q,Q){if(!H7($))throw TypeError("Parameter 'url' must be a string, not "+typeof $);var K=$.indexOf("?"),J=K!==-1&&K<$.indexOf("#")?"?":"#",Z=$.split(J),G=/\\/g;Z[0]=Z[0].replace(G,"/"),$=Z.join(J);var W=$;if(W=W.trim(),!Q&&$.split("#").length===1){var B=FW.exec(W);if(B){if(this.path=W,this.href=W,this.pathname=B[1],B[2])if(this.search=B[2],q)this.query=D7.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(q)this.search="",this.query={};return this}}var V=BW.exec(W);if(V){V=V[0];var U=V.toLowerCase();this.protocol=U,W=W.substr(V.length)}if(Q||V||W.match(/^\/\/[^@\/]+@[^@\/]+/)){var w=W.substr(0,2)==="//";if(w&&!(V&&k7[V]))W=W.substr(2),this.slashes=!0}if(!k7[V]&&(w||V&&!k6[V])){var F=-1;for(var M=0;M127)v+="x";else v+=H[j];if(!v.match(xK)){var d=z.slice(0,M),_=z.slice(M+1),X=H.match(YW);if(X)d.push(X[1]),_.unshift(X[2]);if(_.length)W="/"+_.join(".")+W;this.hostname=d.join(".");break}}}}if(this.hostname.length>NW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!D)this.hostname=new L7(`https://${this.hostname}`).hostname;var P=this.port?":"+this.port:"",g=this.hostname||"";if(this.host=g+P,this.href+=this.host,D){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),W[0]!=="/")W="/"+W}}if(!kW[U])for(var M=0,N=Y7.length;M0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(Q.search=$.search,Q.query=$.query,!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.href=Q.format(),Q}if(!z.length){if(Q.pathname=null,Q.search)Q.path="/"+Q.search;else Q.path=null;return Q.href=Q.format(),Q}var j=z.slice(-1)[0],n=(Q.host||$.host||z.length>1)&&(j==="."||j==="..")||j==="",d=0;for(var _=z.length;_>=0;_--)if(j=z[_],j===".")z.splice(_,1);else if(j==="..")z.splice(_,1),d++;else if(d)z.splice(_,1),d--;if(!L&&!D)for(;d--;d)z.unshift("..");if(L&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/"))z.unshift("");if(n&&z.join("/").substr(-1)!=="/")z.push("");var X=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){Q.hostname=Q.host=X?"":z.length?z.shift():"";var v=Q.host&&Q.host.indexOf("@")>0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(L=L||Q.host&&z.length,L&&!X)z.unshift("");if(!z.length)Q.pathname=null,Q.path=null;else Q.pathname=z.join("/");if(!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.auth=$.auth||Q.auth,Q.slashes=Q.slashes||$.slashes,Q.href=Q.format(),Q};Z2.prototype.parseHost=function(){var $=this.host,q=zW.exec($);if(q){if(q=q[0],q!==":")this.port=q.substr(1);$=$.substr(0,$.length-q.length)}if($)this.hostname=$};DW={parse:D6,resolve:uK,resolveObject:SK,format:TK,Url:Z2,URL:L7,URLSearchParams:OK}});var I7={};c1(I7,{request:()=>_W,globalAgent:()=>mW,get:()=>cW,default:()=>oW,STATUS_CODES:()=>pW,METHODS:()=>iW,IncomingMessage:()=>nW,ClientRequest:()=>bW,Agent:()=>dW});function RW($){return this[$]}var LW,HW,EK,vW,fW,IW,CW,jW=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?IW??=new WeakMap:CW??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?LW(HW($)):{};let G=q||!$||!$.__esModule?EK(Q,"default",{value:$,enumerable:!0}):Q;for(let W of vW($))if(!fW.call(G,W))EK(G,W,{get:RW.bind($,W),enumerable:!0});if(K)J.set($,G);return G},h0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),cK,gW,x1,AW,bK,O1,nK,XW,dK,L6,yW,_K,R7,hW,xW,mK,pK,OW,PW,iK,oK,TW,uW,SW,EW,aK,_W,cW,bW,nW,dW,mW,pW,iW,oW;var C7=b1(()=>{LW=Object.create,{getPrototypeOf:HW,defineProperty:EK,getOwnPropertyNames:vW}=Object,fW=Object.prototype.hasOwnProperty;cK=h0(($)=>{$.fetch=J(globalThis.fetch)&&J(globalThis.ReadableStream),$.writableStream=J(globalThis.WritableStream),$.abortController=J(globalThis.AbortController);var q;function Q(){if(q!==void 0)return q;if(globalThis.XMLHttpRequest){q=new globalThis.XMLHttpRequest;try{q.open("GET",globalThis.XDomainRequest?"/":"https://example.com")}catch(Z){q=null}}else q=null;return q}function K(Z){var G=Q();if(!G)return!1;try{return G.responseType=Z,G.responseType===Z}catch(W){}return!1}$.arraybuffer=$.fetch||K("arraybuffer"),$.msstream=!$.fetch&&K("ms-stream"),$.mozchunkedarraybuffer=!$.fetch&&K("moz-chunked-arraybuffer"),$.overrideMimeType=$.fetch||(Q()?J(Q().overrideMimeType):!1);function J(Z){return typeof Z==="function"}q=null}),gW=h0(($,q)=>{if(typeof Object.create==="function")q.exports=function(Q,K){if(K)Q.super_=K,Q.prototype=Object.create(K.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else q.exports=function(Q,K){if(K){Q.super_=K;var J=function(){};J.prototype=K.prototype,Q.prototype=new J,Q.prototype.constructor=Q}}}),x1=h0(($,q)=>{try{if(Q=(G8(),X0(Z8)),typeof Q.inherits!=="function")throw"";q.exports=Q.inherits}catch(K){q.exports=gW()}var Q}),AW=h0(($,q)=>{function Q(L,D){var z=Object.keys(L);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(L);D&&(N=N.filter(function(H){return Object.getOwnPropertyDescriptor(L,H).enumerable})),z.push.apply(z,N)}return z}function K(L){for(var D=1;D0)this.tail.next=z;else this.head=z;this.tail=z,++this.length}},{key:"unshift",value:function(D){var z={data:D,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var D=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,D}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(D){if(this.length===0)return"";var z=this.head,N=""+z.data;while(z=z.next)N+=D+z.data;return N}},{key:"concat",value:function(D){if(this.length===0)return w.alloc(0);var z=w.allocUnsafe(D>>>0),N=this.head,H=0;while(N)f(N.data,z,H),H+=N.data.length,N=N.next;return z}},{key:"consume",value:function(D,z){var N;if(Dv.length?v.length:D;if(j===v.length)H+=v;else H+=v.slice(0,D);if(D-=j,D===0){if(j===v.length)if(++N,z.next)this.head=z.next;else this.head=this.tail=null;else this.head=z,z.data=v.slice(j);break}++N}return this.length-=N,H}},{key:"_getBuffer",value:function(D){var z=w.allocUnsafe(D),N=this.head,H=1;N.data.copy(z),D-=N.data.length;while(N=N.next){var v=N.data,j=D>v.length?v.length:D;if(v.copy(z,z.length-D,0,j),D-=j,D===0){if(j===v.length)if(++H,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=v.slice(j);break}++H}return this.length-=H,z}},{key:k,value:function(D,z){return M(this,K(K({},z),{},{depth:0,customInspect:!1}))}}]),L}()}),bK=h0(($,q)=>{function Q(B,V){var U=this,w=this._readableState&&this._readableState.destroyed,F=this._writableState&&this._writableState.destroyed;if(w||F){if(V)V(B);else if(B){if(!this._writableState)process.nextTick(G,this,B);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,process.nextTick(G,this,B)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(B||null,function(M){if(!V&&M)if(!U._writableState)process.nextTick(K,U,M);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,process.nextTick(K,U,M);else process.nextTick(J,U);else if(V)process.nextTick(J,U),V(M);else process.nextTick(J,U)}),this}function K(B,V){G(B,V),J(B)}function J(B){if(B._writableState&&!B._writableState.emitClose)return;if(B._readableState&&!B._readableState.emitClose)return;B.emit("close")}function Z(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function G(B,V){B.emit("error",V)}function W(B,V){var{_readableState:U,_writableState:w}=B;if(U&&U.autoDestroy||w&&w.autoDestroy)B.destroy(V);else B.emit("error",V)}q.exports={destroy:Q,undestroy:Z,errorOrDestroy:W}}),O1=h0(($,q)=>{var Q={};function K(B,V,U){if(!U)U=Error;function w(M,k,f){if(typeof V==="string")return V;else return V(M,k,f)}class F extends U{constructor(M,k,f){super(w(M,k,f))}}F.prototype.name=U.name,F.prototype.code=B,Q[B]=F}function J(B,V){if(Array.isArray(B)){let U=B.length;if(B=B.map((w)=>String(w)),U>2)return`one of ${V} ${B.slice(0,U-1).join(", ")}, or `+B[U-1];else if(U===2)return`one of ${V} ${B[0]} or ${B[1]}`;else return`of ${V} ${B[0]}`}else return`of ${V} ${String(B)}`}function Z(B,V,U){return B.substr(!U||U<0?0:+U,V.length)===V}function G(B,V,U){if(U===void 0||U>B.length)U=B.length;return B.substring(U-V.length,U)===V}function W(B,V,U){if(typeof U!=="number")U=0;if(U+V.length>B.length)return!1;else return B.indexOf(V,U)!==-1}K("ERR_INVALID_OPT_VALUE",function(B,V){return'The value "'+V+'" is invalid for option "'+B+'"'},TypeError),K("ERR_INVALID_ARG_TYPE",function(B,V,U){let w;if(typeof V==="string"&&Z(V,"not "))w="must not be",V=V.replace(/^not /,"");else w="must be";let F;if(G(B," argument"))F=`The ${B} ${w} ${J(V,"type")}`;else{let M=W(B,".")?"property":"argument";F=`The "${B}" ${M} ${w} ${J(V,"type")}`}return F+=`. Received type ${typeof U}`,F},TypeError),K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),K("ERR_METHOD_NOT_IMPLEMENTED",function(B){return"The "+B+" method is not implemented"}),K("ERR_STREAM_PREMATURE_CLOSE","Premature close"),K("ERR_STREAM_DESTROYED",function(B){return"Cannot call "+B+" after a stream was destroyed"}),K("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),K("ERR_STREAM_WRITE_AFTER_END","write after end"),K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),K("ERR_UNKNOWN_ENCODING",function(B){return"Unknown encoding: "+B},TypeError),K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$.codes=Q}),nK=h0(($,q)=>{var Q=O1().codes.ERR_INVALID_OPT_VALUE;function K(Z,G,W){return Z.highWaterMark!=null?Z.highWaterMark:G?Z[W]:null}function J(Z,G,W,B){var V=K(G,B,W);if(V!=null){if(!(isFinite(V)&&Math.floor(V)===V)||V<0){var U=B?W:"highWaterMark";throw new Q(U,V)}return Math.floor(V)}return Z.objectMode?16:16384}q.exports={getHighWaterMark:J}}),XW=h0(($,q)=>{q.exports=(G8(),X0(Z8)).deprecate}),dK=h0(($,q)=>{q.exports=X;function Q(S){var b=this;this.next=null,this.entry=null,this.finish=function(){w0(b,S)}}var K;X.WritableState=d;var J={deprecate:XW()},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(S){return G.from(S)}function V(S){return G.isBuffer(S)||S instanceof W}var U=bK(),w=nK(),F=w.getHighWaterMark,M=O1().codes,k=M.ERR_INVALID_ARG_TYPE,f=M.ERR_METHOD_NOT_IMPLEMENTED,L=M.ERR_MULTIPLE_CALLBACK,D=M.ERR_STREAM_CANNOT_PIPE,z=M.ERR_STREAM_DESTROYED,N=M.ERR_STREAM_NULL_VALUES,H=M.ERR_STREAM_WRITE_AFTER_END,v=M.ERR_UNKNOWN_ENCODING,j=U.errorOrDestroy;x1()(X,Z);function n(){}function d(S,b,O){if(K=K||L6(),S=S||{},typeof O!=="boolean")O=b instanceof K;if(this.objectMode=!!S.objectMode,O)this.objectMode=this.objectMode||!!S.writableObjectMode;this.highWaterMark=F(this,S,"writableHighWaterMark",O),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var E=S.decodeStrings===!1;this.decodeStrings=!E,this.defaultEncoding=S.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){Z0(b,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=S.emitClose!==!1,this.autoDestroy=!!S.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Q(this)}d.prototype.getBuffer=function(){var S=this.bufferedRequest,b=[];while(S)b.push(S),S=S.next;return b},function(){try{Object.defineProperty(d.prototype,"buffer",{get:J.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(S){}}();var _;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")_=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(S){if(_.call(this,S))return!0;if(this!==X)return!1;return S&&S._writableState instanceof d}});else _=function(S){return S instanceof this};function X(S){K=K||L6();var b=this instanceof K;if(!b&&!_.call(X,this))return new X(S);if(this._writableState=new d(S,this,b),this.writable=!0,S){if(typeof S.write==="function")this._write=S.write;if(typeof S.writev==="function")this._writev=S.writev;if(typeof S.destroy==="function")this._destroy=S.destroy;if(typeof S.final==="function")this._final=S.final}Z.call(this)}X.prototype.pipe=function(){j(this,new D)};function P(S,b){var O=new H;j(S,O),process.nextTick(b,O)}function g(S,b,O,E){var a;if(O===null)a=new N;else if(typeof O!=="string"&&!b.objectMode)a=new k("chunk",["string","Buffer"],O);if(a)return j(S,a),process.nextTick(E,a),!1;return!0}X.prototype.write=function(S,b,O){var E=this._writableState,a=!1,K0=!E.objectMode&&V(S);if(K0&&!G.isBuffer(S))S=B(S);if(typeof b==="function")O=b,b=null;if(K0)b="buffer";else if(!b)b=E.defaultEncoding;if(typeof O!=="function")O=n;if(E.ending)P(this,O);else if(K0||g(this,E,S,O))E.pendingcb++,a=h(this,E,K0,S,b,O);return a},X.prototype.cork=function(){this._writableState.corked++},X.prototype.uncork=function(){var S=this._writableState;if(S.corked){if(S.corked--,!S.writing&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest)W0(this,S)}},X.prototype.setDefaultEncoding=function(S){if(typeof S==="string")S=S.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((S+"").toLowerCase())>-1))throw new v(S);return this._writableState.defaultEncoding=S,this},Object.defineProperty(X.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function c(S,b,O){if(!S.objectMode&&S.decodeStrings!==!1&&typeof b==="string")b=G.from(b,O);return b}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function h(S,b,O,E,a,K0){if(!O){var R=c(b,E,a);if(E!==R)O=!0,a="buffer",E=R}var Y=b.objectMode?1:E.length;b.length+=Y;var C=b.length{var Q=Object.keys||function(w){var F=[];for(var M in w)F.push(M);return F};q.exports=B;var K=mK(),J=dK();x1()(B,K);{Z=Q(J.prototype);for(W=0;W{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),_K=h0(($)=>{var q=yW().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),R7=h0(($,q)=>{var Q=O1().codes.ERR_STREAM_PREMATURE_CLOSE;function K(W){var B=!1;return function(){if(B)return;B=!0;for(var V=arguments.length,U=Array(V),w=0;w{var Q;function K(v,j,n){if(j=J(j),j in v)Object.defineProperty(v,j,{value:n,enumerable:!0,configurable:!0,writable:!0});else v[j]=n;return v}function J(v){var j=Z(v,"string");return typeof j==="symbol"?j:String(j)}function Z(v,j){if(typeof v!=="object"||v===null)return v;var n=v[Symbol.toPrimitive];if(n!==void 0){var d=n.call(v,j||"default");if(typeof d!=="object")return d;throw TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(v)}var G=R7(),W=Symbol("lastResolve"),B=Symbol("lastReject"),V=Symbol("error"),U=Symbol("ended"),w=Symbol("lastPromise"),F=Symbol("handlePromise"),M=Symbol("stream");function k(v,j){return{value:v,done:j}}function f(v){var j=v[W];if(j!==null){var n=v[M].read();if(n!==null)v[w]=null,v[W]=null,v[B]=null,j(k(n,!1))}}function L(v){process.nextTick(f,v)}function D(v,j){return function(n,d){v.then(function(){if(j[U]){n(k(void 0,!0));return}j[F](n,d)},d)}}var z=Object.getPrototypeOf(function(){}),N=Object.setPrototypeOf((Q={get stream(){return this[M]},next:function(){var v=this,j=this[V];if(j!==null)return Promise.reject(j);if(this[U])return Promise.resolve(k(void 0,!0));if(this[M].destroyed)return new Promise(function(X,P){process.nextTick(function(){if(v[V])P(v[V]);else X(k(void 0,!0))})});var n=this[w],d;if(n)d=new Promise(D(n,this));else{var _=this[M].read();if(_!==null)return Promise.resolve(k(_,!1));d=new Promise(this[F])}return this[w]=d,d}},K(Q,Symbol.asyncIterator,function(){return this}),K(Q,"return",function(){var v=this;return new Promise(function(j,n){v[M].destroy(null,function(d){if(d){n(d);return}j(k(void 0,!0))})})}),Q),z),H=function(v){var j,n=Object.create(N,(j={},K(j,M,{value:v,writable:!0}),K(j,W,{value:null,writable:!0}),K(j,B,{value:null,writable:!0}),K(j,V,{value:null,writable:!0}),K(j,U,{value:v._readableState.endEmitted,writable:!0}),K(j,F,{value:function(d,_){var X=n[M].read();if(X)n[w]=null,n[W]=null,n[B]=null,d(k(X,!1));else n[W]=d,n[B]=_},writable:!0}),j));return n[w]=null,G(v,function(d){if(d&&d.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=n[B];if(_!==null)n[w]=null,n[W]=null,n[B]=null,_(d);n[V]=d;return}var X=n[W];if(X!==null)n[w]=null,n[W]=null,n[B]=null,X(k(void 0,!0));n[U]=!0}),v.on("readable",L.bind(null,n)),n};q.exports=H}),xW=h0(($,q)=>{function Q(w,F,M,k,f,L,D){try{var z=w[L](D),N=z.value}catch(H){M(H);return}if(z.done)F(N);else Promise.resolve(N).then(k,f)}function K(w){return function(){var F=this,M=arguments;return new Promise(function(k,f){var L=w.apply(F,M);function D(N){Q(L,k,f,D,z,"next",N)}function z(N){Q(L,k,f,D,z,"throw",N)}D(void 0)})}}function J(w,F){var M=Object.keys(w);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(w);F&&(k=k.filter(function(f){return Object.getOwnPropertyDescriptor(w,f).enumerable})),M.push.apply(M,k)}return M}function Z(w){for(var F=1;F{q.exports=g;var Q;g.ReadableState=P;var K=(i1(),X0(p1)).EventEmitter,J=function(R,Y){return R.listeners(Y).length},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(R){return G.from(R)}function V(R){return G.isBuffer(R)||R instanceof W}var U=(G8(),X0(Z8)),w;if(U&&U.debuglog)w=U.debuglog("stream");else w=function(){};var F=AW(),M=bK(),k=nK(),f=k.getHighWaterMark,L=O1().codes,D=L.ERR_INVALID_ARG_TYPE,z=L.ERR_STREAM_PUSH_AFTER_EOF,N=L.ERR_METHOD_NOT_IMPLEMENTED,H=L.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,j,n;x1()(g,Z);var d=M.errorOrDestroy,_=["error","close","destroy","pause","resume"];function X(R,Y,C){if(typeof R.prependListener==="function")return R.prependListener(Y,C);if(!R._events||!R._events[Y])R.on(Y,C);else if(Array.isArray(R._events[Y]))R._events[Y].unshift(C);else R._events[Y]=[C,R._events[Y]]}function P(R,Y,C){if(Q=Q||L6(),R=R||{},typeof C!=="boolean")C=Y instanceof Q;if(this.objectMode=!!R.objectMode,C)this.objectMode=this.objectMode||!!R.readableObjectMode;if(this.highWaterMark=f(this,R,"readableHighWaterMark",C),this.buffer=new F,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.destroyed=!1,this.defaultEncoding=R.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,R.encoding){if(!v)v=_K().StringDecoder;this.decoder=new v(R.encoding),this.encoding=R.encoding}}function g(R){if(Q=Q||L6(),!(this instanceof g))return new g(R);var Y=this instanceof Q;if(this._readableState=new P(R,this,Y),this.readable=!0,R){if(typeof R.read==="function")this._read=R.read;if(typeof R.destroy==="function")this._destroy=R.destroy}Z.call(this)}Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(R){if(!this._readableState)return;this._readableState.destroyed=R}}),g.prototype.destroy=M.destroy,g.prototype._undestroy=M.undestroy,g.prototype._destroy=function(R,Y){Y(R)},g.prototype.push=function(R,Y){var C=this._readableState,u;if(!C.objectMode){if(typeof R==="string"){if(Y=Y||C.defaultEncoding,Y!==C.encoding)R=G.from(R,Y),Y="";u=!0}}else u=!0;return c(this,R,Y,!1,u)},g.prototype.unshift=function(R){return c(this,R,null,!0,!1)};function c(R,Y,C,u,e){w("readableAddChunk",Y);var r=R._readableState;if(Y===null)r.reading=!1,F0(R,r);else{var s;if(!e)s=x(r,Y);if(s)d(R,s);else if(r.objectMode||Y&&Y.length>0){if(typeof Y!=="string"&&!r.objectMode&&Object.getPrototypeOf(Y)!==G.prototype)Y=B(Y);if(u)if(r.endEmitted)d(R,new H);else h(R,r,Y,!0);else if(r.ended)d(R,new z);else if(r.destroyed)return!1;else if(r.reading=!1,r.decoder&&!C)if(Y=r.decoder.write(Y),r.objectMode||Y.length!==0)h(R,r,Y,!1);else y(R,r);else h(R,r,Y,!1)}else if(!u)r.reading=!1,y(R,r)}return!r.ended&&(r.length=l)R=l;else R--,R|=R>>>1,R|=R>>>2,R|=R>>>4,R|=R>>>8,R|=R>>>16,R++;return R}function Z0(R,Y){if(R<=0||Y.length===0&&Y.ended)return 0;if(Y.objectMode)return 1;if(R!==R)if(Y.flowing&&Y.length)return Y.buffer.head.data.length;else return Y.length;if(R>Y.highWaterMark)Y.highWaterMark=$0(R);if(R<=Y.length)return R;if(!Y.ended)return Y.needReadable=!0,0;return Y.length}g.prototype.read=function(R){w("read",R),R=parseInt(R,10);var Y=this._readableState,C=R;if(R!==0)Y.emittedReadable=!1;if(R===0&&Y.needReadable&&((Y.highWaterMark!==0?Y.length>=Y.highWaterMark:Y.length>0)||Y.ended)){if(w("read: emitReadable",Y.length,Y.ended),Y.length===0&&Y.ended)E(this);else p(this);return null}if(R=Z0(R,Y),R===0&&Y.ended){if(Y.length===0)E(this);return null}var u=Y.needReadable;if(w("need readable",u),Y.length===0||Y.length-R0)e=O(R,Y);else e=null;if(e===null)Y.needReadable=Y.length<=Y.highWaterMark,R=0;else Y.length-=R,Y.awaitDrain=0;if(Y.length===0){if(!Y.ended)Y.needReadable=!0;if(C!==R&&Y.ended)E(this)}if(e!==null)this.emit("data",e);return e};function F0(R,Y){if(w("onEofChunk"),Y.ended)return;if(Y.decoder){var C=Y.decoder.end();if(C&&C.length)Y.buffer.push(C),Y.length+=Y.objectMode?1:C.length}if(Y.ended=!0,Y.sync)p(R);else if(Y.needReadable=!1,!Y.emittedReadable)Y.emittedReadable=!0,W0(R)}function p(R){var Y=R._readableState;if(w("emitReadable",Y.needReadable,Y.emittedReadable),Y.needReadable=!1,!Y.emittedReadable)w("emitReadable",Y.flowing),Y.emittedReadable=!0,process.nextTick(W0,R)}function W0(R){var Y=R._readableState;if(w("emitReadable_",Y.destroyed,Y.length,Y.ended),!Y.destroyed&&(Y.length||Y.ended))R.emit("readable"),Y.emittedReadable=!1;Y.needReadable=!Y.flowing&&!Y.ended&&Y.length<=Y.highWaterMark,b(R)}function y(R,Y){if(!Y.readingMore)Y.readingMore=!0,process.nextTick(i,R,Y)}function i(R,Y){while(!Y.reading&&!Y.ended&&(Y.length1&&K0(u.pipes,R)!==-1)&&!G0)w("false write response, pause",u.awaitDrain),u.awaitDrain++;C.pause()}}function I0(O0){if(w("onerror",O0),q2(),R.removeListener("error",I0),J(R,"error")===0)d(R,O0)}X(R,"error",I0);function m0(){R.removeListener("finish",p0),q2()}R.once("close",m0);function p0(){w("onfinish"),R.removeListener("close",m0),q2()}R.once("finish",p0);function q2(){w("unpipe"),C.unpipe(R)}if(R.emit("pipe",C),!u.flowing)w("pipe resume"),C.resume();return R};function U0(R){return function(){var Y=R._readableState;if(w("pipeOnDrain",Y.awaitDrain),Y.awaitDrain)Y.awaitDrain--;if(Y.awaitDrain===0&&J(R,"data"))Y.flowing=!0,b(R)}}g.prototype.unpipe=function(R){var Y=this._readableState,C={hasUnpiped:!1};if(Y.pipesCount===0)return this;if(Y.pipesCount===1){if(R&&R!==Y.pipes)return this;if(!R)R=Y.pipes;if(Y.pipes=null,Y.pipesCount=0,Y.flowing=!1,R)R.emit("unpipe",this,C);return this}if(!R){var{pipes:u,pipesCount:e}=Y;Y.pipes=null,Y.pipesCount=0,Y.flowing=!1;for(var r=0;r0,u.flowing!==!1)this.resume()}else if(R==="readable"){if(!u.endEmitted&&!u.readableListening){if(u.readableListening=u.needReadable=!0,u.flowing=!1,u.emittedReadable=!1,w("on readable",u.length,u.reading),u.length)p(this);else if(!u.reading)process.nextTick(V0,this)}}return C},g.prototype.addListener=g.prototype.on,g.prototype.removeListener=function(R,Y){var C=Z.prototype.removeListener.call(this,R,Y);if(R==="readable")process.nextTick(m,this);return C},g.prototype.removeAllListeners=function(R){var Y=Z.prototype.removeAllListeners.apply(this,arguments);if(R==="readable"||R===void 0)process.nextTick(m,this);return Y};function m(R){var Y=R._readableState;if(Y.readableListening=R.listenerCount("readable")>0,Y.resumeScheduled&&!Y.paused)Y.flowing=!0;else if(R.listenerCount("data")>0)R.resume()}function V0(R){w("readable nexttick read 0"),R.read(0)}g.prototype.resume=function(){var R=this._readableState;if(!R.flowing)w("resume"),R.flowing=!R.readableListening,w0(this,R);return R.paused=!1,this};function w0(R,Y){if(!Y.resumeScheduled)Y.resumeScheduled=!0,process.nextTick(S,R,Y)}function S(R,Y){if(w("resume",Y.reading),!Y.reading)R.read(0);if(Y.resumeScheduled=!1,R.emit("resume"),b(R),Y.flowing&&!Y.reading)R.read(0)}g.prototype.pause=function(){if(w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)w("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function b(R){var Y=R._readableState;w("flow",Y.flowing);while(Y.flowing&&R.read()!==null);}if(g.prototype.wrap=function(R){var Y=this,C=this._readableState,u=!1;R.on("end",function(){if(w("wrapped end"),C.decoder&&!C.ended){var s=C.decoder.end();if(s&&s.length)Y.push(s)}Y.push(null)}),R.on("data",function(s){if(w("wrapped data"),C.decoder)s=C.decoder.write(s);if(C.objectMode&&(s===null||s===void 0))return;else if(!C.objectMode&&(!s||!s.length))return;var T=Y.push(s);if(!T)u=!0,R.pause()});for(var e in R)if(this[e]===void 0&&typeof R[e]==="function")this[e]=function(s){return function(){return R[s].apply(R,arguments)}}(e);for(var r=0;r<_.length;r++)R.on(_[r],this.emit.bind(this,_[r]));return this._read=function(s){if(w("wrapped _read",s),u)u=!1,R.resume()},this},typeof Symbol==="function")g.prototype[Symbol.asyncIterator]=function(){if(j===void 0)j=hW();return j(this)};Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(g.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(g.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){if(this._readableState)this._readableState.flowing=R}}),g._fromList=O,Object.defineProperty(g.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function O(R,Y){if(Y.length===0)return null;var C;if(Y.objectMode)C=Y.buffer.shift();else if(!R||R>=Y.length){if(Y.decoder)C=Y.buffer.join("");else if(Y.buffer.length===1)C=Y.buffer.first();else C=Y.buffer.concat(Y.length);Y.buffer.clear()}else C=Y.buffer.consume(R,Y.decoder);return C}function E(R){var Y=R._readableState;if(w("endReadable",Y.endEmitted),!Y.endEmitted)Y.ended=!0,process.nextTick(a,Y,R)}function a(R,Y){if(w("endReadableNT",R.endEmitted,R.length),!R.endEmitted&&R.length===0){if(R.endEmitted=!0,Y.readable=!1,Y.emit("end"),R.autoDestroy){var C=Y._writableState;if(!C||C.autoDestroy&&C.finished)Y.destroy()}}}if(typeof Symbol==="function")g.from=function(R,Y){if(n===void 0)n=xW();return n(g,R,Y)};function K0(R,Y){for(var C=0,u=R.length;C{q.exports=V;var Q=O1().codes,K=Q.ERR_METHOD_NOT_IMPLEMENTED,J=Q.ERR_MULTIPLE_CALLBACK,Z=Q.ERR_TRANSFORM_ALREADY_TRANSFORMING,G=Q.ERR_TRANSFORM_WITH_LENGTH_0,W=L6();x1()(V,W);function B(F,M){var k=this._transformState;k.transforming=!1;var f=k.writecb;if(f===null)return this.emit("error",new J);if(k.writechunk=null,k.writecb=null,M!=null)this.push(M);f(F);var L=this._readableState;if(L.reading=!1,L.needReadable||L.length{q.exports=K;var Q=pK();x1()(K,Q);function K(J){if(!(this instanceof K))return new K(J);Q.call(this,J)}K.prototype._transform=function(J,Z,G){G(null,J)}}),PW=h0(($,q)=>{var Q;function K(k){var f=!1;return function(){if(f)return;f=!0,k.apply(void 0,arguments)}}var J=O1().codes,Z=J.ERR_MISSING_ARGS,G=J.ERR_STREAM_DESTROYED;function W(k){if(k)throw k}function B(k){return k.setHeader&&typeof k.abort==="function"}function V(k,f,L,D){D=K(D);var z=!1;if(k.on("close",function(){z=!0}),Q===void 0)Q=R7();Q(k,{readable:f,writable:L},function(H){if(H)return D(H);z=!0,D()});var N=!1;return function(H){if(z)return;if(N)return;if(N=!0,B(k))return k.abort();if(typeof k.destroy==="function")return k.destroy();D(H||new G("pipe"))}}function U(k){k()}function w(k,f){return k.pipe(f)}function F(k){if(!k.length)return W;if(typeof k[k.length-1]!=="function")return W;return k.pop()}function M(){for(var k=arguments.length,f=Array(k),L=0;L0;return V(H,j,n,function(d){if(!z)z=d;if(d)N.forEach(U);if(j)return;N.forEach(U),D(z)})});return f.reduce(w)}q.exports=M}),iK=h0(($,q)=>{var Q=a1();$=q.exports=mK(),$.Stream=Q||$,$.Readable=$,$.Writable=dK(),$.Duplex=L6(),$.Transform=pK(),$.PassThrough=OW(),$.finished=R7(),$.pipeline=PW()}),oK=h0(($)=>{var q=cK(),Q=x1(),K=iK(),J=$.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Z=$.IncomingMessage=function(G,W,B,V){var U=this;if(K.Readable.call(U),U._mode=B,U.headers={},U.rawHeaders=[],U.trailers={},U.rawTrailers=[],U.on("end",function(){process.nextTick(function(){U.emit("close")})}),B==="fetch"){let D=function(){M.read().then(function(z){if(U._destroyed)return;if(V(z.done),z.done){U.push(null);return}U.push(Buffer.from(z.value)),D()}).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)})};var w=D;if(U._fetchResponse=W,U.url=W.url,U.statusCode=W.status,U.statusMessage=W.statusText,W.headers.forEach(function(z,N){U.headers[N.toLowerCase()]=z,U.rawHeaders.push(N,z)}),q.writableStream){var F=new WritableStream({write:function(z){return V(!1),new Promise(function(N,H){if(U._destroyed)H();else if(U.push(Buffer.from(z)))N();else U._resumeFetch=N})},close:function(){if(V(!0),!U._destroyed)U.push(null)},abort:function(z){if(V(!0),!U._destroyed)U.emit("error",z)}});try{W.body.pipeTo(F).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)});return}catch(z){}}var M=W.body.getReader();D()}else{U._xhr=G,U._pos=0,U.url=G.responseURL,U.statusCode=G.status,U.statusMessage=G.statusText;var k=G.getAllResponseHeaders().split(/\r?\n/);if(k.forEach(function(D){var z=D.match(/^([^:]+):\s*(.*)/);if(z){var N=z[1].toLowerCase();if(N==="set-cookie"){if(U.headers[N]===void 0)U.headers[N]=[];U.headers[N].push(z[2])}else if(U.headers[N]!==void 0)U.headers[N]+=", "+z[2];else U.headers[N]=z[2];U.rawHeaders.push(z[1],z[2])}}),U._charset="x-user-defined",!q.overrideMimeType){var f=U.rawHeaders["mime-type"];if(f){var L=f.match(/;\s*charset=([^;])(;|$)/);if(L)U._charset=L[1].toLowerCase()}if(!U._charset)U._charset="utf-8"}}};Q(Z,K.Readable),Z.prototype._read=function(){var G=this,W=G._resumeFetch;if(W)G._resumeFetch=null,W()},Z.prototype._onXHRProgress=function(G){var W=this,B=W._xhr,V=null;switch(W._mode){case"text":if(V=B.responseText,V.length>W._pos){var U=V.substr(W._pos);if(W._charset==="x-user-defined"){var w=Buffer.alloc(U.length);for(var F=0;FW._pos)W.push(Buffer.from(new Uint8Array(M.result.slice(W._pos)))),W._pos=M.result.byteLength},M.onload=function(){G(!0),W.push(null)},M.readAsArrayBuffer(V);break}if(W._xhr.readyState===J.DONE&&W._mode!=="ms-stream")G(!0),W.push(null)}}),TW=h0(($,q)=>{var Q=cK(),K=x1(),J=oK(),Z=iK(),G=J.IncomingMessage,W=J.readyStates;function B(F,M){if(Q.fetch&&M)return"fetch";else if(Q.mozchunkedarraybuffer)return"moz-chunked-arraybuffer";else if(Q.msstream)return"ms-stream";else if(Q.arraybuffer&&F)return"arraybuffer";else return"text"}var V=q.exports=function(F){var M=this;if(Z.Writable.call(M),M._opts=F,M._body=[],M._headers={},F.auth)M.setHeader("Authorization","Basic "+Buffer.from(F.auth).toString("base64"));Object.keys(F.headers).forEach(function(L){M.setHeader(L,F.headers[L])});var k,f=!0;if(F.mode==="disable-fetch"||"requestTimeout"in F&&!Q.abortController)f=!1,k=!0;else if(F.mode==="prefer-streaming")k=!1;else if(F.mode==="allow-wrong-content-type")k=!Q.overrideMimeType;else if(!F.mode||F.mode==="default"||F.mode==="prefer-fast")k=!0;else throw Error("Invalid value for opts.mode");M._mode=B(k,f),M._fetchTimer=null,M._socketTimeout=null,M._socketTimer=null,M.on("finish",function(){M._onFinish()})};K(V,Z.Writable),V.prototype.setHeader=function(F,M){var k=this,f=F.toLowerCase();if(w.indexOf(f)!==-1)return;k._headers[f]={name:F,value:M}},V.prototype.getHeader=function(F){var M=this._headers[F.toLowerCase()];if(M)return M.value;return null},V.prototype.removeHeader=function(F){var M=this;delete M._headers[F.toLowerCase()]},V.prototype._onFinish=function(){var F=this;if(F._destroyed)return;var M=F._opts;if("timeout"in M&&M.timeout!==0)F.setTimeout(M.timeout);var k=F._headers,f=null;if(M.method!=="GET"&&M.method!=="HEAD")f=new Blob(F._body,{type:(k["content-type"]||{}).value||""});var L=[];if(Object.keys(k).forEach(function(H){var v=k[H].name,j=k[H].value;if(Array.isArray(j))j.forEach(function(n){L.push([v,n])});else L.push([v,j])}),F._mode==="fetch"){var D=null;if(Q.abortController){var z=new AbortController;if(D=z.signal,F._fetchAbortController=z,"requestTimeout"in M&&M.requestTimeout!==0)F._fetchTimer=globalThis.setTimeout(function(){if(F.emit("requestTimeout"),F._fetchAbortController)F._fetchAbortController.abort()},M.requestTimeout)}globalThis.fetch(F._opts.url,{method:F._opts.method,headers:L,body:f||void 0,mode:"cors",credentials:M.withCredentials?"include":"same-origin",signal:D}).then(function(H){F._fetchResponse=H,F._resetTimers(!1),F._connect()},function(H){if(F._resetTimers(!0),!F._destroyed)F.emit("error",H)})}else{var N=F._xhr=new globalThis.XMLHttpRequest;try{N.open(F._opts.method,F._opts.url,!0)}catch(H){process.nextTick(function(){F.emit("error",H)});return}if("responseType"in N)N.responseType=F._mode;if("withCredentials"in N)N.withCredentials=!!M.withCredentials;if(F._mode==="text"&&"overrideMimeType"in N)N.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in M)N.timeout=M.requestTimeout,N.ontimeout=function(){F.emit("requestTimeout")};if(L.forEach(function(H){N.setRequestHeader(H[0],H[1])}),F._response=null,N.onreadystatechange=function(){switch(N.readyState){case W.LOADING:case W.DONE:F._onXHRProgress();break}},F._mode==="moz-chunked-arraybuffer")N.onprogress=function(){F._onXHRProgress()};N.onerror=function(){if(F._destroyed)return;F._resetTimers(!0),F.emit("error",Error("XHR error"))};try{N.send(f)}catch(H){process.nextTick(function(){F.emit("error",H)});return}}};function U(F){try{var M=F.status;return M!==null&&M!==0}catch(k){return!1}}V.prototype._onXHRProgress=function(){var F=this;if(F._resetTimers(!1),!U(F._xhr)||F._destroyed)return;if(!F._response)F._connect();F._response._onXHRProgress(F._resetTimers.bind(F))},V.prototype._connect=function(){var F=this;if(F._destroyed)return;F._response=new G(F._xhr,F._fetchResponse,F._mode,F._resetTimers.bind(F)),F._response.on("error",function(M){F.emit("error",M)}),F.emit("response",F._response)},V.prototype._write=function(F,M,k){var f=this;f._body.push(F),k()},V.prototype._resetTimers=function(F){var M=this;if(globalThis.clearTimeout(M._socketTimer),M._socketTimer=null,F)globalThis.clearTimeout(M._fetchTimer),M._fetchTimer=null;else if(M._socketTimeout)M._socketTimer=globalThis.setTimeout(function(){M.emit("timeout")},M._socketTimeout)},V.prototype.abort=V.prototype.destroy=function(F){var M=this;if(M._destroyed=!0,M._resetTimers(!0),M._response)M._response._destroyed=!0;if(M._xhr)M._xhr.abort();else if(M._fetchAbortController)M._fetchAbortController.abort();if(F)M.emit("error",F)},V.prototype.end=function(F,M,k){var f=this;if(typeof F==="function")k=F,F=void 0;Z.Writable.prototype.end.call(f,F,M,k)},V.prototype.setTimeout=function(F,M){var k=this;if(M)k.once("timeout",M);k._socketTimeout=F,k._resetTimers(!1)},V.prototype.flushHeaders=function(){},V.prototype.setNoDelay=function(){},V.prototype.setSocketKeepAlive=function(){};var w=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}),uW=h0(($,q)=>{q.exports=K;var Q=Object.prototype.hasOwnProperty;function K(){var J={};for(var Z=0;Z{q.exports=(C7(),X0(I7)).STATUS_CODES}),EW=h0(($)=>{var q=TW(),Q=oK(),K=uW(),J=SW(),Z=(f7(),X0(v7)),G=$;G.request=function(W,B){if(typeof W==="string")W=Z.parse(W);else W=K(W);var V=globalThis.location.protocol.search(/^https?:$/)===-1?"http:":"",U=W.protocol||V,w=W.hostname||W.host,F=W.port,M=W.path||"/";if(w&&w.indexOf(":")!==-1)w="["+w+"]";W.url=(w?U+"//"+w:"")+(F?":"+F:"")+M,W.method=(W.method||"GET").toUpperCase(),W.headers=W.headers||{};var k=new q(W);if(B)k.on("response",B);return k},G.get=function(W,B){var V=G.request(W,B);return V.end(),V},G.ClientRequest=q,G.IncomingMessage=Q.IncomingMessage,G.Agent=function(){},G.Agent.defaultMaxSockets=4,G.globalAgent=new G.Agent,G.STATUS_CODES=J,G.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}),aK=jW(EW(),1),{request:_W,get:cW,ClientRequest:bW,IncomingMessage:nW,Agent:dW,globalAgent:mW,STATUS_CODES:pW,METHODS:iW}=aK.default,oW=aK.default});var sK={};c1(sK,{validateHeaderValue:()=>LB,validateHeaderName:()=>DB,setMaxIdleHTTPParsers:()=>kB,request:()=>YB,maxHeaderSize:()=>NB,globalAgent:()=>wB,get:()=>MB,default:()=>HB,createServer:()=>FB,ServerResponse:()=>zB,Server:()=>BB,STATUS_CODES:()=>WB,OutgoingMessage:()=>GB,METHODS:()=>ZB,IncomingMessage:()=>UB,ClientRequest:()=>VB,Agent:()=>JB});function tW($){return this[$]}var aW,lW,lK,rW,sW,eW,$B,QB=($,q,Q)=>{var K=$!=null&&typeof $==="object";if(K){var J=q?eW??=new WeakMap:$B??=new WeakMap,Z=J.get($);if(Z)return Z}Q=$!=null?aW(lW($)):{};let G=q||!$||!$.__esModule?lK(Q,"default",{value:$,enumerable:!0}):Q;for(let W of rW($))if(!sW.call(G,W))lK(G,W,{get:tW.bind($,W),enumerable:!0});if(K)J.set($,G);return G},qB=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),KB,rK,JB,VB,UB,ZB,GB,WB,BB,zB,FB,MB,wB,NB,YB,kB,DB,LB,HB;var tK=b1(()=>{aW=Object.create,{getPrototypeOf:lW,defineProperty:lK,getOwnPropertyNames:rW}=Object,sW=Object.prototype.hasOwnProperty;KB=qB(($,q)=>{var Q=(C7(),X0(I7)),K=(f7(),X0(v7)),J=$;for(Z in Q)if(Q.hasOwnProperty(Z))J[Z]=Q[Z];var Z;J.request=function(W,B){return W=G(W),Q.request.call(this,W,B)},J.get=function(W,B){return W=G(W),Q.get.call(this,W,B)};function G(W){if(typeof W==="string")W=K.parse(W);if(!W.protocol)W.protocol="https:";if(W.protocol!=="https:")throw Error('Protocol "'+W.protocol+'" not supported. Expected "https:"');return W}}),rK=QB(KB(),1),{Agent:JB,ClientRequest:VB,IncomingMessage:UB,METHODS:ZB,OutgoingMessage:GB,STATUS_CODES:WB,Server:BB,ServerResponse:zB,createServer:FB,get:MB,globalAgent:wB,maxHeaderSize:NB,request:YB,setMaxIdleHTTPParsers:kB,validateHeaderName:DB,validateHeaderValue:LB}=rK,HB=rK});var N8=globalThis;if(typeof N8.global>"u")N8.global=globalThis;if(typeof N8.__require>"u")N8.__require=($)=>{throw Error(`Dynamic require of "${$}" is not supported in the sandbox`)};t0();var Fz=J9(h9(),1);var c7=J9(HK(),1);function W2($,q,Q,K){function J(Z){return Z instanceof Q?Z:new Q(function(G){G(Z)})}return new(Q||(Q=Promise))(function(Z,G){function W(U){try{V(K.next(U))}catch(w){G(w)}}function B(U){try{V(K.throw(U))}catch(w){G(w)}}function V(U){U.done?Z(U.value):J(U.value).then(W,B)}V((K=K.apply($,q||[])).next())})}var L0=914400,w8=12700,n0=`\r -`,vB=2147483649,j7=/^[0-9a-fA-F]{6}$/,fB=1.67,RB=27,H6={type:"solid",color:"666666",pt:1},JJ=[0.05,0.1,0.05,0.1],v6={color:"363636",pt:1},u1={color:"888888",style:"solid",size:1,cap:"flat"},Q2="000000",k2=12,IB=18,f6="LAYOUT_16x9",x7="DEFAULT",VJ="333333",P1={type:"outer",blur:3,offset:1.811023622047244,angle:90,color:"000000",opacity:0.35,rotateWithShape:!0},M8=[0.5,0.5,0.5,0.5],eK={color:"000000"},CB={size:8,color:"FFFFFF",opacity:0.75},o2="2094734552",Y5="2094734553",B8="2094734554",O7="2094734555",UJ="2094734556",W8="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),z8=["C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360","C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360"],jB=["5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7","5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7"],R6;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(R6||(R6={}));var I6;(function($){$.b="b",$.ctr="ctr",$.t="t"})(I6||(I6={}));var ZJ="{F7021451-1387-4CA6-816F-3879F97B5CBC}",P7;(function($){$.arraybuffer="arraybuffer",$.base64="base64",$.binarystring="binarystring",$.blob="blob",$.nodebuffer="nodebuffer",$.uint8array="uint8array"})(P7||(P7={}));var T7;(function($){$.area="area",$.bar="bar",$.bar3d="bar3D",$.bubble="bubble",$.bubble3d="bubble3D",$.doughnut="doughnut",$.line="line",$.pie="pie",$.radar="radar",$.scatter="scatter"})(T7||(T7={}));var u7;(function($){$.accentBorderCallout1="accentBorderCallout1",$.accentBorderCallout2="accentBorderCallout2",$.accentBorderCallout3="accentBorderCallout3",$.accentCallout1="accentCallout1",$.accentCallout2="accentCallout2",$.accentCallout3="accentCallout3",$.actionButtonBackPrevious="actionButtonBackPrevious",$.actionButtonBeginning="actionButtonBeginning",$.actionButtonBlank="actionButtonBlank",$.actionButtonDocument="actionButtonDocument",$.actionButtonEnd="actionButtonEnd",$.actionButtonForwardNext="actionButtonForwardNext",$.actionButtonHelp="actionButtonHelp",$.actionButtonHome="actionButtonHome",$.actionButtonInformation="actionButtonInformation",$.actionButtonMovie="actionButtonMovie",$.actionButtonReturn="actionButtonReturn",$.actionButtonSound="actionButtonSound",$.arc="arc",$.bentArrow="bentArrow",$.bentUpArrow="bentUpArrow",$.bevel="bevel",$.blockArc="blockArc",$.borderCallout1="borderCallout1",$.borderCallout2="borderCallout2",$.borderCallout3="borderCallout3",$.bracePair="bracePair",$.bracketPair="bracketPair",$.callout1="callout1",$.callout2="callout2",$.callout3="callout3",$.can="can",$.chartPlus="chartPlus",$.chartStar="chartStar",$.chartX="chartX",$.chevron="chevron",$.chord="chord",$.circularArrow="circularArrow",$.cloud="cloud",$.cloudCallout="cloudCallout",$.corner="corner",$.cornerTabs="cornerTabs",$.cube="cube",$.curvedDownArrow="curvedDownArrow",$.curvedLeftArrow="curvedLeftArrow",$.curvedRightArrow="curvedRightArrow",$.curvedUpArrow="curvedUpArrow",$.custGeom="custGeom",$.decagon="decagon",$.diagStripe="diagStripe",$.diamond="diamond",$.dodecagon="dodecagon",$.donut="donut",$.doubleWave="doubleWave",$.downArrow="downArrow",$.downArrowCallout="downArrowCallout",$.ellipse="ellipse",$.ellipseRibbon="ellipseRibbon",$.ellipseRibbon2="ellipseRibbon2",$.flowChartAlternateProcess="flowChartAlternateProcess",$.flowChartCollate="flowChartCollate",$.flowChartConnector="flowChartConnector",$.flowChartDecision="flowChartDecision",$.flowChartDelay="flowChartDelay",$.flowChartDisplay="flowChartDisplay",$.flowChartDocument="flowChartDocument",$.flowChartExtract="flowChartExtract",$.flowChartInputOutput="flowChartInputOutput",$.flowChartInternalStorage="flowChartInternalStorage",$.flowChartMagneticDisk="flowChartMagneticDisk",$.flowChartMagneticDrum="flowChartMagneticDrum",$.flowChartMagneticTape="flowChartMagneticTape",$.flowChartManualInput="flowChartManualInput",$.flowChartManualOperation="flowChartManualOperation",$.flowChartMerge="flowChartMerge",$.flowChartMultidocument="flowChartMultidocument",$.flowChartOfflineStorage="flowChartOfflineStorage",$.flowChartOffpageConnector="flowChartOffpageConnector",$.flowChartOnlineStorage="flowChartOnlineStorage",$.flowChartOr="flowChartOr",$.flowChartPredefinedProcess="flowChartPredefinedProcess",$.flowChartPreparation="flowChartPreparation",$.flowChartProcess="flowChartProcess",$.flowChartPunchedCard="flowChartPunchedCard",$.flowChartPunchedTape="flowChartPunchedTape",$.flowChartSort="flowChartSort",$.flowChartSummingJunction="flowChartSummingJunction",$.flowChartTerminator="flowChartTerminator",$.folderCorner="folderCorner",$.frame="frame",$.funnel="funnel",$.gear6="gear6",$.gear9="gear9",$.halfFrame="halfFrame",$.heart="heart",$.heptagon="heptagon",$.hexagon="hexagon",$.homePlate="homePlate",$.horizontalScroll="horizontalScroll",$.irregularSeal1="irregularSeal1",$.irregularSeal2="irregularSeal2",$.leftArrow="leftArrow",$.leftArrowCallout="leftArrowCallout",$.leftBrace="leftBrace",$.leftBracket="leftBracket",$.leftCircularArrow="leftCircularArrow",$.leftRightArrow="leftRightArrow",$.leftRightArrowCallout="leftRightArrowCallout",$.leftRightCircularArrow="leftRightCircularArrow",$.leftRightRibbon="leftRightRibbon",$.leftRightUpArrow="leftRightUpArrow",$.leftUpArrow="leftUpArrow",$.lightningBolt="lightningBolt",$.line="line",$.lineInv="lineInv",$.mathDivide="mathDivide",$.mathEqual="mathEqual",$.mathMinus="mathMinus",$.mathMultiply="mathMultiply",$.mathNotEqual="mathNotEqual",$.mathPlus="mathPlus",$.moon="moon",$.noSmoking="noSmoking",$.nonIsoscelesTrapezoid="nonIsoscelesTrapezoid",$.notchedRightArrow="notchedRightArrow",$.octagon="octagon",$.parallelogram="parallelogram",$.pentagon="pentagon",$.pie="pie",$.pieWedge="pieWedge",$.plaque="plaque",$.plaqueTabs="plaqueTabs",$.plus="plus",$.quadArrow="quadArrow",$.quadArrowCallout="quadArrowCallout",$.rect="rect",$.ribbon="ribbon",$.ribbon2="ribbon2",$.rightArrow="rightArrow",$.rightArrowCallout="rightArrowCallout",$.rightBrace="rightBrace",$.rightBracket="rightBracket",$.round1Rect="round1Rect",$.round2DiagRect="round2DiagRect",$.round2SameRect="round2SameRect",$.roundRect="roundRect",$.rtTriangle="rtTriangle",$.smileyFace="smileyFace",$.snip1Rect="snip1Rect",$.snip2DiagRect="snip2DiagRect",$.snip2SameRect="snip2SameRect",$.snipRoundRect="snipRoundRect",$.squareTabs="squareTabs",$.star10="star10",$.star12="star12",$.star16="star16",$.star24="star24",$.star32="star32",$.star4="star4",$.star5="star5",$.star6="star6",$.star7="star7",$.star8="star8",$.stripedRightArrow="stripedRightArrow",$.sun="sun",$.swooshArrow="swooshArrow",$.teardrop="teardrop",$.trapezoid="trapezoid",$.triangle="triangle",$.upArrow="upArrow",$.upArrowCallout="upArrowCallout",$.upDownArrow="upDownArrow",$.upDownArrowCallout="upDownArrowCallout",$.uturnArrow="uturnArrow",$.verticalScroll="verticalScroll",$.wave="wave",$.wedgeEllipseCallout="wedgeEllipseCallout",$.wedgeRectCallout="wedgeRectCallout",$.wedgeRoundRectCallout="wedgeRoundRectCallout"})(u7||(u7={}));var G2;(function($){$.text1="tx1",$.text2="tx2",$.background1="bg1",$.background2="bg2",$.accent1="accent1",$.accent2="accent2",$.accent3="accent3",$.accent4="accent4",$.accent5="accent5",$.accent6="accent6"})(G2||(G2={}));var S7;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(S7||(S7={}));var E7;(function($){$.top="top",$.middle="middle",$.bottom="bottom"})(E7||(E7={}));var B1;(function($){$.ACTION_BUTTON_BACK_OR_PREVIOUS="actionButtonBackPrevious",$.ACTION_BUTTON_BEGINNING="actionButtonBeginning",$.ACTION_BUTTON_CUSTOM="actionButtonBlank",$.ACTION_BUTTON_DOCUMENT="actionButtonDocument",$.ACTION_BUTTON_END="actionButtonEnd",$.ACTION_BUTTON_FORWARD_OR_NEXT="actionButtonForwardNext",$.ACTION_BUTTON_HELP="actionButtonHelp",$.ACTION_BUTTON_HOME="actionButtonHome",$.ACTION_BUTTON_INFORMATION="actionButtonInformation",$.ACTION_BUTTON_MOVIE="actionButtonMovie",$.ACTION_BUTTON_RETURN="actionButtonReturn",$.ACTION_BUTTON_SOUND="actionButtonSound",$.ARC="arc",$.BALLOON="wedgeRoundRectCallout",$.BENT_ARROW="bentArrow",$.BENT_UP_ARROW="bentUpArrow",$.BEVEL="bevel",$.BLOCK_ARC="blockArc",$.CAN="can",$.CHART_PLUS="chartPlus",$.CHART_STAR="chartStar",$.CHART_X="chartX",$.CHEVRON="chevron",$.CHORD="chord",$.CIRCULAR_ARROW="circularArrow",$.CLOUD="cloud",$.CLOUD_CALLOUT="cloudCallout",$.CORNER="corner",$.CORNER_TABS="cornerTabs",$.CROSS="plus",$.CUBE="cube",$.CURVED_DOWN_ARROW="curvedDownArrow",$.CURVED_DOWN_RIBBON="ellipseRibbon",$.CURVED_LEFT_ARROW="curvedLeftArrow",$.CURVED_RIGHT_ARROW="curvedRightArrow",$.CURVED_UP_ARROW="curvedUpArrow",$.CURVED_UP_RIBBON="ellipseRibbon2",$.CUSTOM_GEOMETRY="custGeom",$.DECAGON="decagon",$.DIAGONAL_STRIPE="diagStripe",$.DIAMOND="diamond",$.DODECAGON="dodecagon",$.DONUT="donut",$.DOUBLE_BRACE="bracePair",$.DOUBLE_BRACKET="bracketPair",$.DOUBLE_WAVE="doubleWave",$.DOWN_ARROW="downArrow",$.DOWN_ARROW_CALLOUT="downArrowCallout",$.DOWN_RIBBON="ribbon",$.EXPLOSION1="irregularSeal1",$.EXPLOSION2="irregularSeal2",$.FLOWCHART_ALTERNATE_PROCESS="flowChartAlternateProcess",$.FLOWCHART_CARD="flowChartPunchedCard",$.FLOWCHART_COLLATE="flowChartCollate",$.FLOWCHART_CONNECTOR="flowChartConnector",$.FLOWCHART_DATA="flowChartInputOutput",$.FLOWCHART_DECISION="flowChartDecision",$.FLOWCHART_DELAY="flowChartDelay",$.FLOWCHART_DIRECT_ACCESS_STORAGE="flowChartMagneticDrum",$.FLOWCHART_DISPLAY="flowChartDisplay",$.FLOWCHART_DOCUMENT="flowChartDocument",$.FLOWCHART_EXTRACT="flowChartExtract",$.FLOWCHART_INTERNAL_STORAGE="flowChartInternalStorage",$.FLOWCHART_MAGNETIC_DISK="flowChartMagneticDisk",$.FLOWCHART_MANUAL_INPUT="flowChartManualInput",$.FLOWCHART_MANUAL_OPERATION="flowChartManualOperation",$.FLOWCHART_MERGE="flowChartMerge",$.FLOWCHART_MULTIDOCUMENT="flowChartMultidocument",$.FLOWCHART_OFFLINE_STORAGE="flowChartOfflineStorage",$.FLOWCHART_OFFPAGE_CONNECTOR="flowChartOffpageConnector",$.FLOWCHART_OR="flowChartOr",$.FLOWCHART_PREDEFINED_PROCESS="flowChartPredefinedProcess",$.FLOWCHART_PREPARATION="flowChartPreparation",$.FLOWCHART_PROCESS="flowChartProcess",$.FLOWCHART_PUNCHED_TAPE="flowChartPunchedTape",$.FLOWCHART_SEQUENTIAL_ACCESS_STORAGE="flowChartMagneticTape",$.FLOWCHART_SORT="flowChartSort",$.FLOWCHART_STORED_DATA="flowChartOnlineStorage",$.FLOWCHART_SUMMING_JUNCTION="flowChartSummingJunction",$.FLOWCHART_TERMINATOR="flowChartTerminator",$.FOLDED_CORNER="folderCorner",$.FRAME="frame",$.FUNNEL="funnel",$.GEAR_6="gear6",$.GEAR_9="gear9",$.HALF_FRAME="halfFrame",$.HEART="heart",$.HEPTAGON="heptagon",$.HEXAGON="hexagon",$.HORIZONTAL_SCROLL="horizontalScroll",$.ISOSCELES_TRIANGLE="triangle",$.LEFT_ARROW="leftArrow",$.LEFT_ARROW_CALLOUT="leftArrowCallout",$.LEFT_BRACE="leftBrace",$.LEFT_BRACKET="leftBracket",$.LEFT_CIRCULAR_ARROW="leftCircularArrow",$.LEFT_RIGHT_ARROW="leftRightArrow",$.LEFT_RIGHT_ARROW_CALLOUT="leftRightArrowCallout",$.LEFT_RIGHT_CIRCULAR_ARROW="leftRightCircularArrow",$.LEFT_RIGHT_RIBBON="leftRightRibbon",$.LEFT_RIGHT_UP_ARROW="leftRightUpArrow",$.LEFT_UP_ARROW="leftUpArrow",$.LIGHTNING_BOLT="lightningBolt",$.LINE_CALLOUT_1="borderCallout1",$.LINE_CALLOUT_1_ACCENT_BAR="accentCallout1",$.LINE_CALLOUT_1_BORDER_AND_ACCENT_BAR="accentBorderCallout1",$.LINE_CALLOUT_1_NO_BORDER="callout1",$.LINE_CALLOUT_2="borderCallout2",$.LINE_CALLOUT_2_ACCENT_BAR="accentCallout2",$.LINE_CALLOUT_2_BORDER_AND_ACCENT_BAR="accentBorderCallout2",$.LINE_CALLOUT_2_NO_BORDER="callout2",$.LINE_CALLOUT_3="borderCallout3",$.LINE_CALLOUT_3_ACCENT_BAR="accentCallout3",$.LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR="accentBorderCallout3",$.LINE_CALLOUT_3_NO_BORDER="callout3",$.LINE_CALLOUT_4="borderCallout4",$.LINE_CALLOUT_4_ACCENT_BAR="accentCallout3=4",$.LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR="accentBorderCallout4",$.LINE_CALLOUT_4_NO_BORDER="callout4",$.LINE="line",$.LINE_INVERSE="lineInv",$.MATH_DIVIDE="mathDivide",$.MATH_EQUAL="mathEqual",$.MATH_MINUS="mathMinus",$.MATH_MULTIPLY="mathMultiply",$.MATH_NOT_EQUAL="mathNotEqual",$.MATH_PLUS="mathPlus",$.MOON="moon",$.NON_ISOSCELES_TRAPEZOID="nonIsoscelesTrapezoid",$.NOTCHED_RIGHT_ARROW="notchedRightArrow",$.NO_SYMBOL="noSmoking",$.OCTAGON="octagon",$.OVAL="ellipse",$.OVAL_CALLOUT="wedgeEllipseCallout",$.PARALLELOGRAM="parallelogram",$.PENTAGON="homePlate",$.PIE="pie",$.PIE_WEDGE="pieWedge",$.PLAQUE="plaque",$.PLAQUE_TABS="plaqueTabs",$.QUAD_ARROW="quadArrow",$.QUAD_ARROW_CALLOUT="quadArrowCallout",$.RECTANGLE="rect",$.RECTANGULAR_CALLOUT="wedgeRectCallout",$.REGULAR_PENTAGON="pentagon",$.RIGHT_ARROW="rightArrow",$.RIGHT_ARROW_CALLOUT="rightArrowCallout",$.RIGHT_BRACE="rightBrace",$.RIGHT_BRACKET="rightBracket",$.RIGHT_TRIANGLE="rtTriangle",$.ROUNDED_RECTANGLE="roundRect",$.ROUNDED_RECTANGULAR_CALLOUT="wedgeRoundRectCallout",$.ROUND_1_RECTANGLE="round1Rect",$.ROUND_2_DIAG_RECTANGLE="round2DiagRect",$.ROUND_2_SAME_RECTANGLE="round2SameRect",$.SMILEY_FACE="smileyFace",$.SNIP_1_RECTANGLE="snip1Rect",$.SNIP_2_DIAG_RECTANGLE="snip2DiagRect",$.SNIP_2_SAME_RECTANGLE="snip2SameRect",$.SNIP_ROUND_RECTANGLE="snipRoundRect",$.SQUARE_TABS="squareTabs",$.STAR_10_POINT="star10",$.STAR_12_POINT="star12",$.STAR_16_POINT="star16",$.STAR_24_POINT="star24",$.STAR_32_POINT="star32",$.STAR_4_POINT="star4",$.STAR_5_POINT="star5",$.STAR_6_POINT="star6",$.STAR_7_POINT="star7",$.STAR_8_POINT="star8",$.STRIPED_RIGHT_ARROW="stripedRightArrow",$.SUN="sun",$.SWOOSH_ARROW="swooshArrow",$.TEAR="teardrop",$.TRAPEZOID="trapezoid",$.UP_ARROW="upArrow",$.UP_ARROW_CALLOUT="upArrowCallout",$.UP_DOWN_ARROW="upDownArrow",$.UP_DOWN_ARROW_CALLOUT="upDownArrowCallout",$.UP_RIBBON="ribbon2",$.U_TURN_ARROW="uturnArrow",$.VERTICAL_SCROLL="verticalScroll",$.WAVE="wave"})(B1||(B1={}));var q0;(function($){$.AREA="area",$.BAR="bar",$.BAR3D="bar3D",$.BUBBLE="bubble",$.BUBBLE3D="bubble3D",$.DOUGHNUT="doughnut",$.LINE="line",$.PIE="pie",$.RADAR="radar",$.SCATTER="scatter"})(q0||(q0={}));var L5;(function($){$.TEXT1="tx1",$.TEXT2="tx2",$.BACKGROUND1="bg1",$.BACKGROUND2="bg2",$.ACCENT1="accent1",$.ACCENT2="accent2",$.ACCENT3="accent3",$.ACCENT4="accent4",$.ACCENT5="accent5",$.ACCENT6="accent6"})(L5||(L5={}));var W1;(function($){$.chart="chart",$.image="image",$.line="line",$.rect="rect",$.text="text",$.placeholder="placeholder"})(W1||(W1={}));var D0;(function($){$.chart="chart",$.hyperlink="hyperlink",$.image="image",$.media="media",$.online="online",$.placeholder="placeholder",$.table="table",$.tablecell="tablecell",$.text="text",$.notes="notes"})(D0||(D0={}));var F8;(function($){$.title="title",$.body="body",$.image="pic",$.chart="chart",$.table="tbl",$.media="media"})(F8||(F8={}));var C6;(function($){$.DEFAULT="•",$.CHECK="✓",$.STAR="★",$.TRIANGLE="▶"})(C6||(C6={}));var j6="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOVhAAAGAUlEQVR4Xu2dT0xcRRzHf7tAYSsc0EBSIq2xEg8mtTGebVzEqOVIolz0siRE4gGTStqKwdpWsXoyGhMuyAVJOHBgqyvLNgonDkabeCBYW/8kTUr0wsJC+Wfm0bfuvn37Znbem9mR9303mJnf/Pb7ed95M7PDI5JIJPYJV5EC7e3t1N/fT62trdqViQCIu+bVgpIHEo/Hqbe3V/sdYVKHyWSSZmZm8ilVA0oeyNjYmEnaVC2Xvr6+qg5fAOJAz4DU1dURGzFSqZRVqtMpAFIGyMjICC0vL9PExIRWKADiAYTNshYWFrRCARAOEFZcCKWtrY0GBgaUTYkBRACIE4rKZwqACALR5RQAqQCIDqcASIVAVDsFQCSAqHQKgEgCUeUUAPEBRIVTAMQnEBvK5OQkbW9vk991CoAEAMQJxc86BUACAhKUUwAkQCBBOAVAAgbi1ykAogCIH6cAiCIgsk4BEIVAZJwCIIqBVLqiBxANQFgXS0tLND4+zl08AogmIG5OSSQS1gGKwgtANAIRcQqAaAbCe6YASBWA2E6xDyeyDUl7+AKQMkDYYevm5mZHabA/Li4uUiaTsYLau8QA4gLE/hU7wajyYtv1hReDAiAOxQcHBymbzark4BkbQKom/X8dp9Npmpqasn4BIAYAYSnYp+4BBEAMUcCwNOCQsAKZnp62NtQOw8WmwT09PUo+ijaHsOMx7GppaaH6+nolH0Z10K2tLVpdXbW6UfV3mNqBdHd3U1NTk2rtlMRfW1uj2dlZAFGirkRQAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAGHqrm8caPzQ0WC1logbeiC7X3xJm0PvUmRzh45cuki1588FAmVn9BO6P3yF9utrqGH0MtW82S8UN9RA9v/4k7InjhcJFTs/TLVXLwmJV67S7vD7tHF5pKi46fYdosdOcOOGG8j1OcqefbFEJD9Q3GCwDhqT31HklS4A8VRgfYM2Op6k3bt/BQJl58J7lPvwg5JYNccepaMry0LPqFA7hCm39+NNyp2J0172b19QysGINj5CsRtpij57musOViH0QPJQXn6J9u7dlYJSFkbrMYolrwvDAJAC+WWdEpQz7FTgECeUCpzi6YxvvqXoM6eEhqnCSgDikEzUKUE7Aw7xuHctKB5OYU3dZlNR9syQdAaAcAYTC0pXF+39c09o2Ik+3EqxVKqiB7hbYAxZkk4pbBaEM+AQofv+wTrFwylBOQNABIGwavdfe4O2pg5elO+86l99nY58/VUF0byrYsjiSFluNlXYrOHcBar7+EogUADEQ0YRGHbzoKAASBkg2+9cpM1rV0tK2QOcXW7bLEFAARAXIF4w2DrDWoeUWaf4hQIgDiA8GPZ2iNfi0Q8UACkAIgrDbrJ385eDxaPLLrEsFAB5oG6lMPJQPLZZZKAACBGVhcG2Q+bmuLu2nk55e4jqPv1IeEoceiBeX7s2zCa5MAqdstl91vfXwaEGsv/rb5TtOFk6tWXOuJGh6KmnhO9sayrMninPx103JBtXblHkice58cINZP4Hyr5wpkgkdiChEmc4FWazLzenNKa/p0jncwDiqcD6BuWePk07t1asatZGoYQzSqA4nFJ7soNiP/+EUyfc25GI2GG53dHPrKo1g/1Cw4pIXLrzO+1c+/wg7tBbFDle/EbQcjFCPWQJCau5EoBoFpzXHYDwFNJcDiCaBed1ByA8hTSXA4hmwXndAQhPIc3lAKJZcF53AMJTSHM5gGgWnNcdgPAU0lwOIJoF53UHIDyFNJcfSiCdnZ0Ui8U0SxlMd7lcjubn561gh+Y1scFIU/0o/3sgeLO12E2k7UXKYumgFoAYdg8ACIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6ZQ4JB6PKzviYthnNy4d9h+1M5mMlVckkUjsG5dhiBMCEMPg/wuOfrZZ/RSywQAAAABJRU5ErkJggg==",gB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB4AAAAVnCAYAAACzfHDVAAAAYHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjaVcjJDYAwDEXBu6ughBfH+YnLQSwSHVA+Yrkwx7HtPHabHuEWrQ+lBBAZ6TMweBWoCwUH8quZH6VWFXVT696zxp12ARkVFEqn8wB8AAAACXBIWXMAAC4jAAAuIwF4pT92AADZLklEQVR42uzdd5hV9Z0/8M+dmcsUZmDovYOhKCiKYhR7JJuoSTCWGFI0WUxijBoTTXazVlyza4maYm9rTRSJigVsqCDNQhHBAogKCEgRMjMMU+7vj93sL8kqClLmnPt6PY+PeXZM9vP9vO8jZ+Y955xMfJLjorBrRMuSgmiViyjN1Ee2oSCyucbIBAAAAAAAAADbXaYgcoWNUZcrirpMbdRsysa69wbF+rggGrf439vSF7seF12aFUTnxvoosGIAAAAAAACAXacgoqEgF++/VRgr4r5o+Kh/pvD//F8uiII+LaPrum/EXzqui2b1ddHGKgEAAAAAAAB2rVxEQWMmWrQtjHZlA6N2w2tR84//zP8pgHu3ib6NBdG+zdqorK6KVUXZaB85j3sGAAAAAAAAaAoaG6OwIBdtyneP2PBabPzbr/1dAdx3VHRtyESHiIhcYzQrLo7WmVzkcjmPgAYAAAAAAABoSgpy0eIfS+D/LYD7fy3abC6Inn/7X2hsjELlLwAAAAAAAEDT9D8lcM1fHwddFBFxyAVR9M686PVp/gfqayKiJiLqLBMAAAAAAABgh8hGRGlEUekn/6PFEb3ikNgQk6O+KCJi6dzoksv83/cB/1X9xoiaJdmoWxlRV1dk2QAAAAAAAAA7QTZbH9muERX96v7n9t7/q6Exinq3i86LI94pjOOisHUu+uYykfmof7h+Y8Sa6aVRt74gGhs9DRoAAAAAAABgZ2lsLIi69QWxeUUmSjs0/vedwR8hk4uydSfE+wVd6qOyMfMx7/mtj9jwUtbjngEAAAAAAAB2obrqolg7IxtR/9Ffb4wo7P5GtCwobRaVH/c/UvNmNuqqPfIZAAAAAAAAYFerqy6KmjezH/v1ktpoVZBr/PgCeMN7yl8AAAAAAACApmJLHW5jUVQWNDSP+Q3ZeLco4i9/+8X6teHRzwAAAAAAAABNSd3/dLn/oLAoqqIuVhXFxhhSGB/xqGjlLwAAAAAAAECTU1eTjaK/KXSLIv7SWB+bc5ko9YxnAAAAAAAAgATJFv393bz1EeV//c8F1gMAAAAAAACQDgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKREkRUAAACwrUpLSwuGDRvWfMCAAS26du3avKysrLiioqKkZcuWzZs1a1bcvHnz0tLS0rJsNtusuLi4ebNmzUoLCgo+8/eijY2N9Zs3b66pra2tqqur21xTU1NdVVVVs2nTptqNGzdWbdiwoeYvf/nL5hUrVlQtWLBgw6xZs6pqamoaJQYAAEDaKYABAACIiIghQ4aUHnTQQW379u3bql27dq3at2/fpkWLFq2bN29eWVpa2qpZs2bNCwsLm2ez2fLCwsLyoqKi8sLCwtKknK+hoaG6vr6+qqGh4S91dXV/aWhoqNq8eXNVTU3NuqqqqvUbNmxYu2rVqjWrV69e99Zbb6177rnnPpgzZ06NTwYAAABJogAGAADIA8OGDWt+xBFHdBwwYECnLl26dGjdunXHFi1adCgtLe1YUlLSvlmzZq0KCgqK07yDwsLCssLCwrKIaPdp/zuNjY21mzdvXrdp06ZVNTU172/YsGHl2rVr31+2bNnKBQsWrHjyySffnzVrVpVPGAAAAE1Fpuexsd9HfaF+ZcSal0ptCAAAIAE6deqUPf744zvtueeeXbp3796lbdu2XSorKzuXlpZ2KS0t7VBYWFhhSztGQ0PDxpqampU1NTXL169fv+yDDz5Y9s477yybPXv2sj/96U8rVqxYUWdLAAAAbE9t9q6Jog4f/TUFMAAAQEJks9nMt7/97Y4jRozo1bdv397t2rXrXl5e3rWsrKxzcXFx+4gosKUmp7G2tnZVTU3Nso0bNy5btWrV0tdff/2tJ598cvG999672noAAADYFgpgAACAhPne977X6a9Fb/v27Xu1bNmyV1lZWa8kvXOXLauvr9/wl7/8ZdG6desWL1u2bNHChQsX/fGPf1w8derUjbYDAADAliiAAQAAmqhsNps59dRTuxx66KH9+/Tp87n27dv3Ly8v719UVOSRzXlq06ZNKzZu3Pj6+++//8abb775xqOPPvrG3XffvcpmAAAA+CsFMAAAQBNx6qmndvniF784qHfv3v3btWv3uYqKis8VFhaW2wxbUl9fv37Dhg1vfPDBB68vXrz4jccee2z+jTfeuNxmAAAA8pMCGAAAYBc45phjWn/rW9/aq3///kPatGnTv6Kiop9HOLO9NDQ0VG/cuPGtNWvWLFy4cOGcO+6445WHHnporc0AAACknwIYAABgJzjjjDO6f+lLX9qrV69eg1u3bj2orKysR0RkbIadJFddXb103bp18xcvXjz30UcffeXqq69+x1oAAADSRwEMAACwnZWWlhb86le/2u3QQw8d1r17931btmw5qLCwsMxmaEoaGhqqP/zww/nvvPPOzGeeeWbW2LFj36ipqWm0GQAAgGRTAAMAAGwHP/7xj7t+9atf3bdXr15D27Ztu1c2m21jKyRJXV3dmg8++OCVRYsWvfznP/95xh/+8IdltgIAAJA8CmAAAIBtcOKJJ7Y75ZRTDujXr9+w1q1bD81ms61shTSpq6tbt3bt2pfffPPNWbfccsvUe++9d7WtAAAANH0KYAAAgE+hoqKi4IILLhg0YsSI/bp27bpfy5YtB2YymUKbIR/kcrmGDz/8cP6777474/nnn59x4YUXvrZx40aPiwYAAGiCFMAAAAAf4/jjj2/7/e9//8D+/fsf2Lp1630KCgpKbAUiGhsbN61fv37eW2+9NeWGG2545u67715lKwAAAE2DAhgAAOB/ZLPZzAUXXPC5I4888sDu3bsfWFFRsVtEFNgMbFl1dfWSd999d8qsWbNmnnvuuS+vW7euwVYAAAB2DQUwAACQ10pLSwsuvfTSQYcccsjBXbt2HVFWVtbDVmDb1dbWrnr//fdfmDp16uRf/vKXL65evbreVgAAAHYeBTAAAJB3Bg0aVHrBBRd8fs899zywQ4cOBxQVFbWwFdj+Ghsba9euXTtrzpw5T59//vmTX3755WpbAQAA2LEUwAAAQF4YNmxY8/POO+/gIUOGHOZ9vrDz/W0ZfNFFFz07a9asKlsBAADY/hTAAABAarVq1arwyiuv3HfEiBEjO3TocFBhYWGZrcCu19DQUP3+++8/O2XKlIk/+clPZm7cuLHRVgAAALYPBTAAAJAqrVq1Kvztb3+7/3777Xd4x44dRxQWFpbbCjRdDQ0NG99///0pM2bMeOqHP/zhC8pgAACAz0YBDAAApMJZZ53V45vf/OaRvXr1GllaWtrVRiB5ampq3l28ePHEO++8c9LVV1/9jo0AAABsPQUwAACQWMOHDy+/6KKLvjB48OCjW7RoMdBGID0+/PDDV+fNmzfhvPPOe3L69Ol/sREAAIBPRwEMAAAkSqtWrQpvuOGGQ/bbb79/atOmzX6ZTCZrK5BeuVyubs2aNTNmzJjx2JgxYyavW7euwVYAAAA+ngIYAABIhB//+Mddv/e9732lZ8+e/1RcXNzWRiD/1NbWfvD2228/dssttzz029/+9l0bAQAA+L8UwAAAQJNVUVFRcO21137+4IMPPrZ169b7ZTKZAlsBIqJxzZo1M59//vnxp5122hR3BQMAAPx/CmAAAKDJOeWUUzqefvrpx/bu3ftL2Wy2jY0AH6e+vn7j0qVLH/vd7373x+uvv36ZjQAAAPlOAQwAADQJ2Ww2c+uttx5wyCGHnNC6deu9I8LdvsDWaFy7du1L06ZN+/OPfvSjZ1evXl1vJQAAQD5SAAMAALtU//79S6655pp/2nPPPY8tLy/vayPAZ1VTU7NswYIF488999wHp06dutFGAACAfKIABgAAdomf//znPU855ZQTu3btemRhYWGZjQDbW2NjY92KFSuevOWWW+689NJLF9kIAACQDxTAAADATuMxz8Cusn79+rlPP/30f5188slT6+rqcjYCAACklQIYAADY4fr27Vv8hz/84a+Pee5nI8CuUlNT8+68efPu/8EPfvDgwoULN9kIAACQNgpgAABghxkyZEjpNddc89XBgwefWFxc3MFGgKaitrZ21dy5c+/5yU9+8uc5c+bU2AgAAJAWWyqAPYoNAADYJqNHj+4wb968n06ZMuXRYcOGnaH8BZqa4uLi9sOGDTtjypQpj86bN++nJ510UntbAQAA0s4dwAAAwFY599xze33/+9//dufOnY/IZDJZGwGSIpfL1S1fvvzJG2644fbLLrvsbRsBAACSyiOgAQCAz+y8887r+53vfOfbHTt2PDyTyRTaCJBUuVyuYcWKFU/cdNNN//XrX/96sY0AAABJowAGAAC22WWXXTboG9/4xg9at249zDaAtFm7du2su++++9pzzjnnNdsAAACSQgEMAABsNcUvkE8UwQAAQJIogAEAgE9N8Qvks7Vr18665557rvv5z38+3zYAAICmaksFcGHlwOj6UV9orIqoWZG1PQAAyBO/+MUvet9xxx3nHHrooT8pLS3tYiNAPiotLe2y7777HvP973+/X1lZ2ZIpU6assxUAAKCpKetcHwXlH/01BTAAAOS5M844o/u99957zpe//OWflZeX94qIjK0AeS5TXl7e8+CDDx71/e9/v3dEvDVjxowPrQUAAGgqFMAAAMD/ceKJJ7a77777fjJq1Kh/KS8v7xOKX4B/lCkvL+99+OGHj/rWt77VfvXq1Qvnz59fbS0AAMCutqUC2DuAAQAgzwwdOrTs+uuvP6l///4nFRYWltkI20NjY2Ns2rQpqquro6amJurr62PTpk2xefPmqK+vj+rq6qivr4/NmzfHpk2boqGhYZv/fxUWFkZJSUk0a9YsioqKoqysLIqKiqJZs2ZRUlISRUVFUVpa+r9/FRQUCIjtoqGhoeq11167a8yYMffMmTOnxkYAAIBdZUvvAFYAAwBAnujUqVP2nnvuGbXXXnudnM1mK22Ej9PQ0BAbN26MDRs2/J+/Nm7cGBs3boyamprYtGlTbNq0KWpqaqK2trbJnqe4uDhKSkqitLT0f/9eUVERFRUV0aJFi//zV0VFRRQWFvog8LHq6urWvvjii7eceOKJf169enW9jQAAADubAhgAAPLcXXfdddAXv/jF00tLS7vZRn7L5XKxYcOGWLt2baxbty7Wrl37d3+tW7cuNmzYkPd7atGiRbRu3TpatWoVrVu3jjZt2vzvf27dunW0aNHCh4morq5e+sgjj1zzne98Z6ptAAAAO5MCGAAA8tTVV189+MQTTzyzoqJioG3kj8bGxli5cmUsX748Pvjgg1i9evX//n3t2rXR2NhoSZ9RYWFhtGrVKtq1axdt27b937937tw5OnTo4LHTeWbDhg3z77333qvOPPPMebYBAADsDApgAADIM1/72tfaXHrppad27979qIjQRKVUQ0NDrFq1KlasWBHvv//+//595cqVTfqRzGlXXFwcHTp0iI4dO0bnzp2jY8eO0alTp2jXrp1HS6dYLpdrfOeddx76+c9/fv2ECRPW2QgAALAjKYABACBP9OrVq9ldd931jT322OM7hYWFZTaSHh9++GG88847sXTp0njvvfdixYoVsXr16mhoaLCchCgsLIz27dtHp06dolu3btG9e/fo3r27x0mnTENDQ9W8efNu++Y3v/nHJUuWbLYRAABgR1AAAwBAHrjrrrtG/NM//dOZJSUlXWwj2davXx9Lly6Nd955539L3w8//NBiUqqysvJ/y+C//tWqVSuLSbiamppljz322G9Gjx49xTYAAIDtTQEMAAAp9qtf/arPD3/4w5+1atVqL9tIno0bN8aSJUvirbfeikWLFsV7770XmzZtspg8V1JSEl27do0+ffpE3759o3fv3lFeXm4xCbRu3bqXr7322ivGjh27yDYAAIDtRQEMAAApNGjQoNI77rjju7vttttJBQUFWRtJhtWrV8ebb74ZixcvjiVLlsTy5cujsbHRYtiigoKC6Ny5c/Tu3Tt69+4d/fr1i7Zt21pMQjQ2Nta98cYbd33rW9+6ff78+TU2AgAAfFYKYAAASJHS0tKCBx988Jj99tvvn7PZbBsbaboaGhri7bffjrfeeisWLFgQS5YscXcv201FRUX06tUr+vbtG3379o2ePXtGYWGhxTRhdXV1a2bMmHHjV77ylYdqamr85gcAALDNFMAAAJASp59+erdf/vKX51ZWVu5jG03T6tWr47XXXouFCxfGm2++GRs3brQUdooWLVpE3759Y8CAATFw4EB3CDdh69evf/E//uM//vPqq69+xzYAAIBtoQAGAICEGzRoUOm99977w969ex+byWTc4teErF+/PubNmxcLFiyIN954Q+FLk9GiRYvo169fDBgwIPbYY4+orKy0lCYkl8s1LF68eNyJJ554rcdCAwAAW0sBDAAACXbNNdcMOemkk35RVlbWyzZ2vVwuF++++27MnTs3XnvttViyZIl3+NLkFRQURK9evWLQoEExePDg6Natm6U0EdXV1UvuvvvuX//kJz+ZYxsAAMCnpQAGAIAEOuqoo1r99re//VmHDh0Ot41da9OmTTF79uyYO3duLFy4MKqqqiyFRGvevHn0798/Bg8eHHvuuWeUlJRYyi62cuXKp04//fTLJ0yYsM42AACAT6IABgCAhBk3btwRRxxxxFnZbLaNbewaVVVVMXfu3Jg7d27Mnz8/amtrLYVUKi4ujoEDB8bgwYNj8ODBUV5ebim7SF1d3ZqnnnrqqlGjRj1hGwAAwJYogAEAICFOOeWUjhdddNEvW7duvZ9t7HwrV66MWbNmxdy5c+Odd96JXC5nKeSdzp07x9577x3Dhg2LDh06WMgusHbt2hnnnXfepbfccsv7tgEAAHwUBTAAADRxpaWlBU899dQ3Bw8e/L2CggLPYt2JVqxYES+99FK89NJLsXz5cguBv/HXMnjvvfeOTp06WchO1NjYuGnu3Lk3H3744XfV1NR40TgAAPB3FMAAANCEjR49usOll176yzZt2gy3jZ1j/fr18eKLL8bMmTNj6dKlFgKfQs+ePWPfffeNYcOGRYsWLSxkJ1mzZs0L55577q/vvvvuVbYBAAD8lQIYAACaoIqKioKJEyd+c/Dgwd8vKCgotpEda8OGDfHiiy/G9OnTlb7wGfXo0SOGDx8ew4YNi4qKCgvZwdwNDAAA/CMFMAAANDGnnHJKx7Fjx/5rZWXlMNvYcerr6+PVV1+NGTNmxLx586Kurs5SYDvKZrMxZMiQ2HfffWP33XePwsJCS9mB1q5dO+MXv/jFv995550rbQMAAPKbAhgAAJqIbDabeeKJJ47fZ599fuSu3x0jl8vFwoULY/r06TF79uzYtGmTpcBOUFpaGkOGDInhw4fHgAEDLGQHaWhoqJ42bdo1Rx555J9tAwAA8pcCGAAAmoDjjz++7ZVXXvmr1q1be9fvDrBmzZqYNm1azJw5M1audHMc7EodO3aMz3/+87H//vt7X/CO+3fetDPPPPOScePGfWAbAACQfxTAAACwi9100037HXvssf9WXFzc1ja2n1wuF6+99lo8//zzMW/evKivr7cUaEKKiopizz33jBEjRsTnPve5yGQylrId1dbWrvrjH/948Q9+8INZtgEAAPlFAQwAALvIkCFDSu+///5zunTp8k+2sf2sXbs2Jk+eHNOnT48PP/zQQiABKisrY8SIEXHIIYdEeXm5hWxHy5Yte+zrX//6f86ZM6fGNgAAID9sqQAurBwYXT/qC41VETUrsrYHAADb6IILLtjt97///VVt2rQZZhvbx+LFi2P8+PFx9913xxtvvBG1tbWWAgmxadOmeOONN+LZZ5+NtWvXRps2bTweejtp0aJFv5NOOumg0tLSuc8+++xaGwEAgPQr61wfBR/zu7XuAAYAgO0sm81mJk2a9PVhw4b9pKCgwG9VfkZ1dXUxY8aMeOaZZ+K9996zEEiRfv36xSGHHBJDhw6NgoICC/mMGhsbN8+YMeOaL37xi+Pq6upyNgIAAOnlEdAAALCTHH/88W2vuuqqCyorK/exjc9mzZo18dRTT8XUqVNj06ZNFgIpVlFREZ///OfjsMMOi8rKSgv5jNavXz/r9NNPv3DcuHEf2AYAAKSTAhgAAHaC22677fNf+9rXzstms5W2se0WLVoUjz/+eMybNy9yOTewQT4pKiqKIUOGxBFHHBG9e/e2kM+grq5u3QMPPHDRySefPM02AAAgfRTAAACwA1VUVBQ8/fTTpwwcOPCUTCbjGabbIJfLxauvvhpPPvlkLFy40EIgz2UymRgwYEAcccQRMWjQIAvZ9n+3Ns6fP/+Www8//JaNGzc22ggAAKTHlgrgwsqB0fWjvtBYFVGzwuvKAABgS0488cR2EyZMuLx79+5fzmQyGRvZOo2NjTFr1qy49dZb48knn4wPPvC0UuC/rV69OmbMmBFz5syJ0tLS6NSpU/jX7NbJZDKZ9u3bD/3+978/dPny5TNfffXValsBAIB0KOtcHwXlH/O9gDuAAQBg29x66637H3vssRcWFRW1sI2tU1NTE0899VQ8++yzsWHDBgsBPlGLFi3i4IMPjsMPPzxKS/28YmvV19d/OG7cuPNPPvnk6bYBAADJ5xHQAACwHWWz2cyzzz77rSFDhvzAI5+3zqZNm2Ly5Mnx1FNPKX6BbdKiRYs47LDD4pBDDlEEb6VcLtfwyiuvXHfooYfeWVdX5yXrAACQYApgAADYTo455pjW11133cWVlZV728ant2HDhnj88cdjypQpUVtbayHAZ1ZcXBwHHnhgfPGLX4wWLTyIYWusWbNm2re//e3zn3nmGb+JAwAACeUdwAAAsB1cfvnlu1900UW/LS8v72cbn05VVVVMmDAhbrnllnjzzTejoaHBUoDtoqGhIZYsWRLPPfdc1NTURI8ePSKb9XOMT6OsrKzb17/+9SPbtm0774knnlhtIwAAkMDreu8ABgCAz+bhhx/+8qGHHnpOQUFBsW18sk2bNsUzzzwTTzzxRFRVVVkIsMOVl5fHkUceGYccckgUF/tX9afR2Ni46emnn/71Mccc87htAABAsngENAAAbKN27doVTZ48+YxevXodZxufrK6uLp5++umYOHGi4hfYJSoqKuKLX/xiHHzwwe4I/pQWLVr0x4MOOuiadevWeUwDAAAkhEdAAwDANjj22GPbPvzww7/p2LHjobaxZXV1dfHkk0/GddddF3Pnzo26ujpLAXaJzZs3x2uvvRbPPfdcRET06NEjCgsLLWYLWrduvfv3vve9fd9+++1pCxYsqLYRAABo+rb0CGgFMAAAfITLL7989wsuuOB3zZs372UbH6+xsTGmTJkS119/fbzyyiuKX6DJ2Lx5cyxYsCCmT58excXF0a1bt8hkMhbzMUpKSjp8+ctfPrJt27ZzvBcYAACaPu8ABgCArTB+/Pgjv/CFL/xLQUFBiW18vAULFsT48eNj6dKllgE0eT169IivfOUrMWjQIMvYgsbGxpqJEydecuyxxz5pGwAA0HR5BzAAAHwK7dq1K3ruued+1qNHj6/axsdbtGhR3H///bF48WLLABKnV69ecdxxx0WfPn0sYwuWLl3654MOOujy1atX19sGAAA0Pd4BDAAAn2DYsGHNn3766V936tTpC7bx0TZs2BD33Xdf/PGPf4y1a9daCJBI69evj2nTpsW6deuiZ8+eUVLiYQ8fpbKysv+3v/3t/lOmTJmyfPlyz/cHAIAmxjuAAQBgC372s5/1uP76669t0aKF54J+hJqamhg/fnzcfPPN8fbbb0cul7MUINFyuVy888478cwzz0RVVVX07t07slk/A/lHZWVl3U488cTD6+rqZkyfPv1DGwEAgCZ0va4ABgCAj3bFFVfscdZZZ11dXFzcwTb+Xi6XixkzZsR1110XCxYsiMbGRksBUqWxsTGWLFkSM2bMiPLy8ujSpUtkMhmL+RvZbLbFQQcddHibNm1mP/HEE6ttBAAAmoYtFcDeAQwAQN6aNGnSqAMOOODsTCZTaBt/b9GiRXHPPffEu+++axlA3ujWrVucdNJJ0bt3b8v4B7lcrm7y5Mm//vKXv/yIbQAAwK63pXcAK4ABAMg7paWlBTNnzjyzT58+x9vG39uwYUOMGzcuZsyY4VHPQF7KZDKx3377xde//vWoqKiwkH+waNGiP+27775X1dTUeCwEAADsQgpgAAD4H926dctOnjz5V506dRppG/9fLpeLqVOnxp///OfYuHGjhQB5r6KiIkaNGhX777+/x0L/g+XLlz9+6KGHXvLuu+/W2QYAAOwaWyqAvQMYAIC8MXz48PInnnjiynbt2o2wjf/vnXfeiWuvvTaee+652Lx5s4UARMTmzZtjzpw58dprr0XPnj2jRYsWlvI/Kioq+n7rW98aMnXq1Ofee+89f3AAAMAusKV3ACuAAQDIC9/+9rc73n777X9o0aLFANv4b1VVVXHXXXfFvffeG+vXr7cQgI+wbt26eP7552P9+vWx2267RVFRkaVERElJSefjjjvuoA8++GDKK6+88hcbAQCAnUsBDABAXjv//PP7XXzxxX8oKSnpbBv/bfr06XHttdfGokWLLAPgU3jnnXdi2rRp0bp16+jc2R8nERHZbLbyC1/4whElJSUvTp48eY2NAADAzqMABgAgb/3ud7/b60c/+tFVRUVFrWwjYs2aNXHzzTfHpEmTora21kIAtkJtbW289NJL8c4770Tfvn2jtLQ073dSWFhYNnz48C/26dNn4UMPPbTMpwQAAHYOBTAAAHnp1ltv3f+b3/zmfxYWFjbP913kcrl4/vnn4/rrr4/ly5f7cAB8BitXroxp06ZFRUVFdOvWLTKZTF7vo6CgIDto0KBDBw0atOiBBx54xycEAAB2vC0VwJmex8Z+H/WF+pURa17ym6wAACTTww8//KXDDjvsXzKZTN6/rPGDDz6I22+/Pd544w0fDIDtbMCAAfGtb30r2rRpk/e7yOVyjVOmTPn1yJEjH/LJAACAHavN3jVR1OGjv6YABgAgdV555ZXTPve5z30r3/fQ0NAQjz32WDz++ONRV1fngwGwg2Sz2Tj66KPjC1/4QhQUFOT9Pl5//fU79tprr9/7ZAAAwI6jAAYAIC9ks9nMyy+/fFafPn2Oz/ddvPvuu3HbbbfFe++954MBsJN069YtvvOd70S3bt3yfhdLliy5f5999rmypqam0ScDAAC2PwUwAACpV1paWjBr1qyzevfufVw+7yGXy8WTTz4ZDz74oLt+AXaBbDYbxxxzTBxxxBF5fzfw0qVLHxg6dOjlSmAAANj+FMAAAKRar169mk2ePHlsu3btDsrnPaxcuTJuueWWePvtt30oAHaxnj17ximnnBIdOnTI6z2sXr16yiGHHPIvS5Ys2exTAQAA28+WCuDCyoHR9aO+0FgVUbMia3sAADRpQ4cOLXvqqacub9Omzf75uoNcLhfPPPNMXH/99bF27VofCoAmYP369TFlypQoKSmJnj17RiaTycs9NG/evPtJJ500ZPLkyc+sWLHCoykAAGA7KetcHwXlH/01BTAAAIk1ZMiQ0kceeeSKVq1a7Z2vO6iuro7bb789nnjiiWhs9IRNgKaksbEx5s+fH++//34MGDAgstn8/DlLaWlpp6997WuDn3rqqadXrlxZ75MBAACfnQIYAIDUOfTQQ1s8+OCDv2/ZsuUe+bqDOXPmxNVXX+2RzwBN3PLly+OFF16Ijh075u0joUtLSzudcMIJ+7/00ktPv/3227U+FQAA8NkogAEASJVhw4Y1v++++37TsmXLQfl4/vr6+hg/fnz88Y9/jNpaP0MHSILNmzfHiy++GJs3b47ddtstCgoK8m4HxcXFbY866qg9n3vuuaeXL1/ucdAAAPAZKIABAEiNI488snLcuHG/b9GixcB8PP97770XV111VcyZM8eHASCBFi1aFC+//HL069cvWrRokXfnLykp6XDcccftP2fOnGcWLVq0yScCAAC2jQIYAIBUOPLIIyvvvPPO35aXl++Wj+d/+umn48Ybb4wPP/zQhwEgwf7yl7/ECy+8ECUlJdGrV6+8O3+zZs3aHHXUUfspgQEAYNspgAEASLxjjz227W233faH5s2b98m3s1dVVcXNN98cTz31VDQ2NvowAKRAY2NjzJ8/P5YtWxYDBgyIZs2a5dX5mzVr1uaYY4458M0333xm4cKFNT4RAACwdRTAAAAk2qGHHtritttuuzofy9+33347rrnmmli8eLEPAkAKvf/++/HKK69Enz59orKyMq/Ons1mK4888sh9Zs6c+dTSpUs3+zQAAMCnpwAGACCxjjjiiJb33nvvteXl5f3y6dy5XC4mTZoUN998c1RVVfkgAKRYVVVVTJ06NbLZbPTp0ycymUzenL24uLjtV7/61c+/8sorTy1evLjWpwEAAD4dBTAAAIl06KGHtrj33nt/l2/lb3V1ddx0000xefLkyOVyPggAeSCXy8WCBQvi3Xffjd133z2y2fz5mUyzZs1aH3300fvNmDHjSXcCAwDAp6MABgAgcYYOHVo2fvz4qysqKgbk07mXLVsWV111lUc+A+SplStXxiuvvBKf+9znoqKiIm/O3axZszZHH3300GeeeebJFStW1PkkAADAlimAAQBIlCFDhpQ++uij17Rs2XL3fDr31KlT49prr42NGzf6EADksaqqqpg+fXq0bds2unTpkjfnLikpaT9q1KihTz755JMrV66s90kAAICPt6UCuMB6AABoSjp16pSdMGHCv1dWVu6RL2dubGyMcePGxR133BF1dW56AiCitrY2br755hg/fnw0NjbmzbkrKyv3mDBhwr9369bNXQkAALCNFMAAADQZrVq1Kpw+ffolbdq02T9fzlxdXR2/+93vYtKkSd73C8DfyeVy8fjjj8fvf//7qK6uzptzt2nTZv8pU6Zc0qpVq0KfAgAA2HoKYAAAmoSKioqC2bNnX9KuXbuD8uXMS5cujYsuuijmz5/vAwDAx3r11VfjoosuiqVLl+bNmdu1a3fQ7Nmz/72iosLPrgAAYCu5iAYAoEmYOXPmz9q1a3dIvpz35ZdfjiuuuCLWrVsnfAA+0bp16+KKK66Il19+OW/O3K5du4Nnzpz5M+kDAMDWUQADALDLvfjii2N69OgxKh/Omsvl4oEHHogbbrghamtrhQ/Ap1ZbWxs33HBDPPDAA3nz2oAePXqMevHFF8dIHwAAPj0FMAAAu9SkSZO+NnDgwFPy4ax1dXVx8803x8SJE73vF4BtksvlYuLEiXHLLbdEXV1dXpx54MCBJ0+aNOlr0gcAgE9HAQwAwC7z6KOPHnXggQeekw9nXbduXfz617+OWbNmCR6Az2zmzJnx61//Ol9eJZA58MADz3n00UePkjwAAHyywsqB0fWjvtBYFVGzImtDAADsEDfeeOO+Rx999EWZTKYw7Wddvnx5XHXVVbFy5UrBA7DdbNiwIWbPnh0DBw6MioqKtB8307179/179uz56sMPP7xc+gAA5LuyzvVRUP7RX1MAAwCw011xxRV7fPe7372qoKCgWdrPOmfOnPjtb38bGzduFDwA2111dXVMmzYtOnfuHB07dkz1WTOZTOHuu+9+eJs2bV6aNGnSKukDAJDPFMAAADQZZ5xxRvef/exnvy0sLCxP+1knTJgQd999d9TX1wsegB2moaEhXnrppchms9G3b99UnzWTyRTttddeB/3lL395dubMmRukDwBAvlIAAwDQJBx00EEVf/jDH64pLi7ulOZz5nK5eOCBB+Kxxx4TOgA77c+eBQsWRF1dXfTv3z8ymUxqz1pQUFBywAEHDJs+ffqkpUuXbpY+AAD5aEsFcIH1AACwMwwaNKj0vvvuu7qsrKxXms9ZV1cX1113XUyaNEnoAOx0EydOjOuvvz7q6upSfc6ysrJef/rTn67u379/idQBAODvKYABANjhKioqCh577LGLKyoqBqb5nNXV1XHNNdfE7NmzhQ7ALvPKK6/ElVdeGVVVVak+Z4sWLQZOnDhxbEVFhZ9vAQDA33CBDADADjdz5syftW3b9sA0n3HdunVx2WWXxRtvvCFwAHa5xYsXx2WXXRZr165N9TnbtWt34MyZM38mcQAA+P8UwAAA7FBPPvnkqB49eoxK8xlXrVoVV1xxRSxfvlzgADQZK1asiCuuuCJWrlyZ6nP26NFj1KRJk0ZJHAAA/lth5cDo+lFfaKyKqFmRtSEAALbZjTfeuO+XvvSlCzOZTGp/8fDdd9+NK6+8MtatWydwAJqc6urqmDVrVvTv3z8qKytTe85u3boN79mz57yHH37Yb2MBAJAXyjrXR0H5R39NAQwAwA5x3nnn9T311FOvLigoKE7rGV977bW45pprorq6WuAANFmbN2+OGTNmRI8ePaJ9+/apPGMmkykYNGjQIYWFhVOee+45v5UFAEDqKYABANipjjrqqFb/8R//8YdmzZq1SusZX3755bj++uujrq5O4AA0eQ0NDfHSSy9Fp06dolOnTqk8Y0FBQXbYsGGfnz9//qQ33nhjk9QBAEizLRXA3gEMAMB21a1bt+wNN9zwnyUlJR3TesYpU6bEjTfeGPX19QIHIDHq6+vjxhtvjKlTp6b2jCUlJZ1uuOGG/+jWrZu7GgAAyFsKYAAAtqunn376XyorK/dI6/kmTZoUd955ZzQ2NgobgMRpbGyMO+64I5588snUnrGysnLw008//UtpAwCQrxTAAABsN88///w3unTp8k9pPd/EiRNj3LhxkcvlhA1AYuVyubj//vtTXQJ36dLlS88+++yJ0gYAIB95BzAAANvFTTfdNPzII488L5PJZNJ4vsceeyzGjx8vaABS47XXXotmzZpF3759U3m+zp0779urV695Dz/88DJpAwCQNlt6B7ACGACAz+wXv/hF7x/+8IdXFxQUNEvj+R544IF45JFHBA1A6ixYsCDq6upiwIABqTtbJpPJDBo06ODGxsbnpk6dul7aAACkiQIYAIAd5oADDqj43e9+99tmzZq1TeP5xo0bF5MmTRI0AKm1aNGi2Lx5cwwcODB1ZysoKMjut99+w5577rnH33vvvc3SBgAgLbZUAHsHMAAA2yybzWbuvPPOfyktLe2exvNNmDBB+QtAXpg0aVI89NBDqTxbaWlpj3vuuedfstlsRtIAAOQDBTAAANvs+eef/06HDh0OTePZHn744Xj44YeFDEDeeOSRR+LPf/5zKs/WoUOHw5599tlvSxkAgHygAAYAYJvcd999hw8ePPjUNJ7t/vvvjwkTJggZgLzz2GOPxX333ZfKs+25554/+NOf/nSYlAEASDvvAAYAYKudccYZ3ceMGXN5QUFBcdrONnHixHjkkUeEDEDeWrx4cWSz2ejbt2/ajpbp06fPvn/5y18mz5w5c4OkAQBIsi29A1gBDADAVhk2bFjzG2+88Q/NmjVrl7azPfroo6l99CUAbI2FCxdGUVFR9OvXL1XnKigoKD7wwAP3e/LJJx9dsWJFnaQBAEiqLRXAHgENAMBWuffee39ZWlraPW3nevzxx+PBBx8UMAD8jz//+c8xceLE1J2rtLS0x3333fdLCQMAkFYKYAAAPrVJkyaN6tSp0xEpPFeMHz9ewADwD8aPHx+TJ09O3bk6der0hUmTJn1VwgAApJFHQAMA8Kmcd955fU888cR/z2QyRWk618yZM+Puu+8WMAB8jNdeey06duwYnTt3TtW5unbtuk9BQcHzzz333DopAwCQNN4BDADAZ3LEEUe0vOKKK67NZrOVaTrXyy+/HDfffHPkcjkhA8DHyOVyMXv27OjSpUt06tQpNefKZDJF++yzz/CpU6c+9u67726WNAAASeIdwAAAbLNsNpu55ZZb/q2kpKRjms61YMGCuPnmm6OxsVHIAPAJGhsb4+abb44333wzVecqLS3tcvfdd5+fzWYzUgYAIC0UwAAAbNGkSZO+3rZt2wPTdKZly5bFDTfcEPX19QIGgE+prq4urr322li+fHmqztWuXbsDH3/88VESBgAgLTwCGgCAj3XZZZcN+upXvzo2k8mk5hcH33///bjyyiujqqpKwACwlerq6uLll1+OIUOGRHl5eWrO1aVLl31LS0unPvPMM2ukDABAEngENAAAW61///4lJ5988q8ymUxRWs60YcOG+P3vfx8bN24UMABso40bN8bvfve7VP15WlBQkP3hD394ft++fYslDABA4q9vrQAAgI/y4IMPnl1WVtYrLeeprq6O3/zmN7Fq1SrhAsBntGrVqrjyyiujuro6NWcqKyvr8/DDD58lXQAAkk4BDADA/zF+/Pgju3XrdnRazlNfX5/KdxYCwK60fPnyuO6666K+vj41Z+rRo8dXx40bd4R0AQBIMgUwAAB/53vf+16nI4444py0nCeXy8Vtt90Wb7zxhnABYDt7/fXX47bbbotcLpeaMx155JHnfvvb3+4oXQAAkkoBDADA/6qoqCi4+OKLLywsLCxPy5nGjx8fs2bNEi4A7CCzZs2Khx56KDXnKSwsrPj1r399QUVFhZ+bAQCQSC5kAQD4XxMnThxdWVk5OC3nef7552PixImCBYAd7LHHHosXXnghNeeprKzc89FHHz1RsgAAJFFh5cDo+lFfaKyKqFmRtSEAgDxxwQUX7DZq1KgLM5lMYRrO8+qrr8Ytt9ySqkdSAkBT/7O3d+/e0a5du1Scp2PHjkNzudxzU6ZMWSddAACamrLO9VHwMc/wcwcwAADRt2/f4h//+McXZzKZVPwG4HvvvRc33HBDNDY2ChcAdpKGhoa47rrrYtmyZak4T0FBQfbss88e27dv32LpAgCQqGtZKwAAYPz48T8qKyvrkYazbNiwIX7/+99HbW2tYAFgJ9u0aVP8/ve/j40bN6biPGVlZb3GjRs3RrIAACSJAhgAIM/ddNNNw/v06XN8Gs5SX18f1157baxdu1awALCLrFmzJq699tqor69PxXn69ev3jd///vdDJQsAQFIogAEA8thBBx1Uceyxx/5rRGTScJ477rgjFi9eLFgA2MUWLVoUd955Z1qOU/CNb3zj34YNG9ZcsgAAJOIC1goAAPLXzTfffFZxcXG7NJxl4sSJMX36dKECQBMxbdq0mDRpUirOUlJS0unOO+88Q6oAACSBAhgAIE/913/914FdunT5UhrO8tprr8Wf//xnoQJAEzN+/PhYsGBBKs7SrVu3o2+66abhUgUAoKlTAAMA5KEvfelLlV/5yld+lYazrFixIq6//vpobGwULAA0MY2NjXHdddfFihUr0nCczHHHHfergw46qEKyAAA0ZQpgAIA8dPXVV5+ezWYrk36OmpqauPbaa2PTpk1CBYAmatOmTXHttddGTU1N4s+SzWbb3njjjT+RKgAATZkCGAAgz9x6663Du3Tp8uWknyOXy8Utt9wSK1euFCoANHErV66MW2+9NXK5XOLP4lHQAAA0dQpgAIA8MnTo0LKvfvWrv0jDWSZMmBBz584VKgAkxJw5c+Kxxx5LxVlGjRr1i6FDh5ZJFQCApkgBDACQR+64444fFRcXd0z6OV5++eV45JFHBAoACfPQQw+l4he4SkpKOt5xxx0/lCgAAE2RAhgAIE9cfvnlu/fs2XNU0s/xwQcfxB133JGKR0gCQL7J5XJx2223xZo1axJ/lp49ex57+eWX7y5VAACaGgUwAEAe6NatW/a73/3uv2YymURf/9XX18cNN9wQ1dXVQgWAhKqqqoobb7wx6uvrE32OTCZT8N3vfvdX3bp1y0oVAICmRAEMAJAHxo8ff0pZWVmvpJ/jnnvuiaVLlwoUABJuyZIlcd999yX+HGVlZT3Hjx9/ikQBAGhKFMAAACn385//vOeAAQNGJ/0c06dPjylTpggUAFJi8uTJMWPGjMSfY8CAAaN//vOf95QoAABNhQIYACDFstls5qyzzjo3k8kk+tGEK1asiLvvvlugAJAyd911V6xYsSLRZ8hkMtmzzjrr3Gw2m5EoAABNgQIYACDFxo0b98XKysq9knyG2trauOGGG6K2tlagAJAyf/1zfvPmzYk+R2Vl5V7jxo0bKVEAAJoCBTAAQEoNHz68/OCDDz4t6ee4//77Y/ny5QIFgJRavnx5jBs3LvHnGDFixI+HDRvWXKIAAOxqCmAAgJS69dZbT8tms22TfIYZM2bEc889J0wASLnJkyfHzJkzE32G4uLitrfffvtp0gQAYFdTAAMApNBVV121R48ePb6S5DOsXLky7rrrLmECQJ64++6744MPPkj0GXr27PnVK664Yg9pAgCwKymAAQBSprS0tOAb3/jGT5N8rdfY2Bi333679/4CQB6pqamJ2267LRobG5N8jIJvfvObZ5aWlvqZGwAAu+6i1AoAANJlwoQJX6uoqBiQ5DOMHz8+Fi1aJEwAyDNvvvlmPPjgg4k+Q4sWLQY9+OCDx0gTAIBdRQEMAJAiRx55ZOWwYcN+kOQzzJ07N5544glhAkCemjhxYixYsCDRZxg+fPiPjjjiiJbSBABgV1AAAwCkyBVXXHFyUVFRRVLnr6qqijvvvDNyuZwwASBP5XK5uP3226O6ujqxZygqKmrxm9/85mRpAgCwKyiAAQBS4vzzz+/Xu3fv45J8httvvz0+/PBDYQJAnlu3bl3cfvvtiT5D7969jz///PP7SRMAgJ1NAQwAkALZbDZz6qmn/jyTyST2+m769OkxZ84cYQIAERExe/bsmDFjRmLnz2QyBaeeeurPs9lsRpoAAOxMCmAAgBT44x//eERlZeXgpM6/du3auPfeewUJAPyde+65J9atW5fY+SsrKwf/6U9/+oIkAQDYmRTAAAAJ17dv3+JDDjnkR0k+w9133x01NTXCBAD+Tk1NTdx9992JPsPBBx/8o759+xZLEwCAnUUBDACQcHfdddc3S0pKOiV1/smTJ8e8efMECQB8pLlz58azzz6b2PlLSko63nPPPd+SJAAAO4sCGAAgwb70pS9VDhw48KSkzr9mzZoYP368IAGALXrggQdizZo1iZ2/f//+Jx111FGtJAkAwM6gAAYASLArrrji1MLCwvIkzp7L5eK2226LTZs2CRIA2KJNmzbFbbfdFrlcLpHzFxYWll1++eU/kCQAADuDAhgAIKF+8Ytf9O7evftXkjr/s88+G2+88YYgAYBP5Y033ojnn38+sfN369bt6F/96ld9JAkAwI6mAAYASKgf/vCHP8pkMom8nvvggw/igQceECIAsFXGjRsX69atS+TsmUym4NRTT/2xFAEA2NEUwAAACXTdddcNa9eu3YFJnD2Xy8Udd9wRtbW1ggQAtsqmTZvizjvvTOz8bdq02f+mm27aT5IAAOxICmAAgIQpLS0t+NrXvnZ6Uud/4YUXYuHChYIEALbJq6++GjNmzEjs/Mccc8zpFRUVfiYHAMAO42ITACBhbr/99oMrKip2S+LsGzZsiHHjxgkRAPhM7r///qiqqkrk7OXl5X3/67/+6wgpAgCwoyiAAQASpKKiouCwww47Nanz33vvvYn9YS0A0HRs2LAh7r///sTOf9BBB/1zq1atCiUJAMCOoAAGAEiQ+++//+iysrKeSZx9zpw58dJLLwkRANguXnjhhViwYEEiZy8tLe32xz/+8StSBABgR1AAAwAkRN++fYv33Xfff07i7LW1tXHvvfcKEQDYru6+++6oq6tL5Oz77bffKf379y+RIgAA25sCGAAgIW6++eZRxcXFbZM4+yOPPBJr164VIgCwXa1atSoee+yxRM6ezWbb3njjjV+TIgAA25sCGAAgAYYOHVq21157fSeJs7/33nvxxBNPCBEA2CEmTpwYK1asSOTsQ4YM+c7QoUPLpAgAwPakAAYASIBrr732xKKiosqkzZ3L5eKee+6JxsZGIQIAO0R9fX3cddddkcvlEjd7UVFR5bXXXnuCFAEA2J4UwAAATdwBBxxQMWDAgG8kcfYZM2bEW2+9JUQAYId6880348UXX0zk7AMGDPjG8OHDy6UIAMD2ogAGAGjirrrqqhOKiooqkjb3pk2b4oEHHhAgALBT3H///VFbW5u4uYuKilpcffXV7gIGAGC7UQADADRhBx10UEX//v0Teffvww8/HB9++KEQAYCdYv369TFhwoREzj5w4MBvHHDAARVSBABge1AAAwA0Yf/5n/95bGFhYfOkzb1q1aqYPHmyAAGAnerpp5+O1atXJ27uwsLC8ssuu2yUBAEA2B4UwAAATdQBBxxQMWjQoNFJnP3uu++O+vp6IQIAO1V9fX3cddddiZx99913/+bQoUPLpAgAwGelAAYAaKIuv/zyYwsLC8uTNvfcuXNjwYIFAgQAdokFCxbE3LlzEzd3UVFRi9/97ndflyAAAJ+VAhgAoAkaOnRo2aBBgxL37t+6urr405/+JEAAYJf605/+FHV1dYmbe/fdd//mkCFDSiUIAMBnoQAGAGiCfvOb33ylqKioZdLmfu655xL53j0AIF1Wr14dzz33XOLmLioqann11VcfLUEAAD4LBTAAQBPTq1evZoMHD/5m0uaurq6ORx55RIAAQJPwyCOPRHV1deLmHjJkyLe6deuWlSAAANtKAQwA0MTcdNNNxxQXF7dN2twTJkyIqqoqAQIATUJVVVUifzmtuLi43a233uouYAAAtpkCGACgCWnVqlXhXnvtdVLS5l61alU8++yzAgQAmpTJkyfHqlWrEjf30KFDR7dq1apQggAAbAsFMABAE3LLLbccXlJS0jlpcz/44INRX18vQACgSamvr48HH3wwcXOXlJR0vummmw6VIAAA20IBDADQRGSz2cwBBxzw7aTNvWjRonjppZcECAA0SS+99FIsXrw4cXOPGDHiO9lsNiNBAAC2lgIYAKCJuOaaa/YuLy/vm7S5H3roocjlcgIEAJqkXC6XyLuAy8vL+1111VV7SRAAgK2lAAYAaCK+8pWvfDdpM8+bNy8WLlwoPACgSVu4cGG8+uqrrg8BAMgLCmAAgCbgsssuG1RZWblPkmbO5XIxfvx44QEAifDAAw8k7qklrVu33veSSy7pLz0AALaGAhgAoAkYNWrUCUmbefbs2bFs2TLhAQCJsGzZsnjllVcSN/cJJ5xwovQAANgaCmAAgF3sn//5nzt37NjxiCTN3NjYGA888IDwAIBEGT9+fDQ0NCRq5k6dOn1h9OjRHaQHAMCnpQAGANjFfvSjH30tk8kk6rps2rRpsWrVKuEBAImyatWqeOGFFxI1cyaTKfzpT386SnoAAHxaCmAAgF1o0KBBpX369Plqkmaur6+PCRMmCA8ASKQJEyZEXV1dombu27fvV/r27VssPQAAPg0FMADALnTZZZcdXlRUVJGkmadOnRpr164VHgCQSOvXr48pU6YkauaioqLK3/zmN0dIDwCAT0MBDACwi2Sz2cy+++57UpJmrqurc/cvAJB4jz76aOLuAt5///1PymazGekBAPBJFMAAALvI1VdfPbSsrKx3kmaeMmVKbNiwQXgAQKJt2LAhnn/++UTNXFZW1ueqq67aS3oAAHwSBTAAwC7y5S9/+bgkzVtfXx8TJ04UHACQCo8//nji7gL+0pe+dLzkAAD4JApgAIBdYPTo0R3atm07IkkzT5s2LdatWyc8ACAVPvzww5g+fXqiZm7fvv2I0aNHd5AeAABbogAGANgFfvrTn47KZDKFSZm3vr4+HnnkEcEBAKnyyCOPRH19fWLmzWQyhT/96U+/JjkAALZEAQwAsJN16tQp26dPn6OTNLO7fwGANFq3bl1MmzYtUTP36dPnmE6dOmWlBwDAx1EAAwDsZFddddUB2Wy2dVLmbWxsjEmTJgmOVOvYsWN06OCJmgD5aNKkSdHY2JiYebPZbOurrrrqAMkBAPBxFMAAADvZiBEjvp6keV988cVYtWqV4Ei1Ll26xIUXXhinnXZadO3a1UIA8siqVavipZdecj0JAEBqKIABAHaiM844o3tlZeXeSZk3l8vFxIkTBUdeyGQyMXjw4PjVr34VY8aMcUcwQB55/PHHI5fLJWbeysrKvc8444zukgMA4KMogAEAdqJTTjnlqxGRScq8CxYsiPfee09w5JVMJhN77713XHjhhTFmzJho3769pQCk3HvvvRcLFy5M1B9X/3NdCQAA/4cCGABgJ+nVq1ezXr16fTlJM3v3L/nsr0XwBRdcECeffHK0bdvWUgBSLGnXPb169fpyr169mkkOAIB/pAAGANhJrrjiioOLiopaJmXeBN4JAztEYWFhDB8+PC688MIYPXp0VFZWWgpACi1YsCCWLVuWmHmLiopaXnnllYdIDgCAf6QABgDYSYYPH/6VJM2btHfhwY5WVFQUI0aMiEsuuSRGjx4dLVu2tBSAFMnlcvH4448naub99tvvK5IDAOAfKYABAHaC0aNHd6isrByalHnXrl0bL7/8suDgI/y1CL744ovjhBNOiBYtWlgKQEq89NJLsW7dusTMW1lZudfo0aM7SA4AgL+lAAYA2AlOP/30o5J07fXMM89EQ0OD4GALiouL47DDDouxY8fGqFGjoqyszFIAEq6hoSGeeeaZJI1c8D/XmQAA8P8vEq0AAGDHymazmX79+n05KfPW1tbGlClTBAefUnFxcYwcOTIuvfTSGDVqVJSWlloKQII9//zzUVtbm5h5+/Xr9+VsNpuRHAAAf6UABgDYwX7zm9/sWVJS0jkp886YMSOqq6sFB1uppKQkRo4cGZdcckkcffTRUVJSYikACVRdXR0zZ85M0p8/na+44orBkgMA4K8UwAAAO9gXvvCFLyVl1lwuF08//bTQ4DNo3rx5HHXUUXHJJZfEyJEjI5vNWgpAwjz11FORy+USM++RRx75ZakBAPBXCmAAgB1oyJAhpZ07dz4iKfO+/vrrsWLFCsHBdlBeXh6jRo2KSy+9VBEMkDArVqyI119/PTHzdunS5fD+/ft79AQAABGhAAYA2KHGjh17aGFhYWJeCOruX9j+KioqYtSoUXHxxRfH4YcfHkVFRZYC4LpouyosLGz+H//xHwdLDQCACAUwAMAOteeeex6ZlFnXrl0b8+bNExrsIK1atYrjjz8+LrroohgxYkQUFPh2DKApmzdvXqxZsyYx8+61115HSg0AgAgFMADADnPMMce0bt269b5Jmfe5556LxsZGwcEO1qZNmxg9enRcfPHFimCAJqyxsTGee+65JP35MvyYY45pLTkAAPykAQBgBznzzDMPz2Qyibjeqq+vj6lTpwoNdqK2bdvG6NGj47zzzovhw4crggGaoBdeeCHq6+sTMWsmkyk844wzDpUaAAB+wgAAsIP079//C0mZdc6cObFhwwahwS7QqVOnOPnkk+Pf/u3fYu+9945MJmMpAE3Ehg0bYvbs2YmZd8CAAR4DDQCAAhgAYEf43ve+16mysnKPpMybpMcbQlp17tw5xowZE7/61a8UwQBNyPPPP5+YWSsrKwd/73vf6yQ1AID8pgAGANgBTj755CMiIhHtzcqVK+P1118XGjQRXbt2jTFjxsQ555wTgwcPthCAXez111+PlStXJmXczMknn3y41AAA8psCGABgB+jXr19iHv88ZcqUyOVyQoMmpnfv3nHaaafFOeecE/3797cQgF0kl8vFlClTknQd6jHQAAB5TgEMALCdnX766d0qKip2S8Ks9fX1MW3aNKFBE9anT58466yz4pxzzonddtvNQgB2gWnTpkV9fX0iZq2oqNjt9NNP7yY1AID8pQAGANjORo8efURSZp03b15s3LhRaJAAffr0ibPPPjvOPPPM6Nmzp4UA7EQbN26MefPmuR4FACARFMAAANtZr169EvPetSQ9zhD4bwMGDIhf/vKXceaZZ0b37t0tBGAnmTp1apKuRw+TGABA/lIAAwBsR2eccUb38vLyvkmYdf369fHaa68JDRJqwIAB8S//8i9x2mmnRbdunvQJsKPNnz8/Pvzww0TMWl5e3u9HP/pRF6kBAOQnBTAAwHZ03HHHHZSUWWfMmBGNjY1CgwTLZDIxePDg+Nd//dcYM2ZMdOjQwVIAdpDGxsaYMWNGYub9xje+cYjUAADykwIYAGA76tOnz8FJmDOXyyXqMYbAlmUymdh7773jwgsvjDFjxkT79u0tBWAHeOGFF5J0XXqIxAAA8pMCGABgOznppJPat2zZcvckzLpkyZJYuXKl0CBl/loEX3DBBXHyySdH27ZtLQVgO1qxYkW8/fbbiZi1srJy0PHHH+8PAgCAPKQABgDYTr773e8eGBGZJMyapMcXAluvsLAwhg8fHhdeeGGMHj06KisrLQVgO5k+fXpSRi34/ve/f6DEAADyjwIYAGA72X333Q9Nwpz19fUxc+ZMgUEeKCoqihEjRsQll1wSo0ePjpYtW1oKwGc0c+bMqK+vT8SsAwcOPFRiAAD5RwEMALAdHHTQQRUtW7bcKwmzLly4MKqrq4UGeeSvRfDFF18cJ5xwQrRo0cJSALZRVVVVvP7664mYtVWrVkOHDx9eLjUAgPyiAAYA2A7OPvvsz2cymaIkzOrxz5C/iouL47DDDouxY8fGqFGjoqyszFIAtkFSnqaSyWSy55577uclBgCQXxTAAADbwe67735AEuasra2NOXPmCAzyXHFxcYwcOTIuvfRSRTDANpg9e3bU1dUlYtY99tjjAIkBAOQXBTAAwGfUqlWrwnbt2u2fhFnnzZsXtbW1QgMiIqKkpCRGjhwZY8eOjaOPPjpKSkosBeBT2LRpU8ybNy8Rs7Zv337/iooKPwMEAMgjLv4AAD6jCy+8cPeioqKKJMz64osvCgz4P5o3bx5HHXVUXHLJJTFy5MjIZrOWAvAJZs2alYg5i4qKWlx88cWDJAYAkD8UwAAAn9GBBx6YiMfqVVdXJ+ZOFWDXKC8vj1GjRsWll16qCAb4BPPmzYuamppEzHrQQQd5DDQAQB5RAAMAfEZdu3YdnoQ5582bF/X19QIDPlFFRUWMGjUqLr744jj88MOjqKjIUgD+QV1dXbz66quJmLVLly77SwwAIH8ogAEAPoNTTjmlY3l5+W5JmPXll18WGLBVWrVqFccff3xcdNFFMWLEiCgo8C0kwN966aWXEjFnRUXFbieddFJ7iQEA5AffvQMAfAYnnnji55MwZ21tbcyfP19gwDZp06ZNjB49OsaOHasIBvgb8+fPj9ra2iSMmvnud7/7eYkBAOQH37UDAHwGn/vc5/ZLwpwLFy6Muro6gQGfyV+L4PPOOy+GDx+uCAby3ubNm2PhwoWJmLVfv37DJQYAkB98tw4AsI1atWpV2Lp1672TMKvHPwPbU6dOneLkk0+Oc889NwYNGmQhQF6bPXt2IuZs06bN3hUVFX4WCACQB1z0AQBso/PPP39gYWFheVOfs76+PubMmSMwYLvr2bNn/OQnP4nzzjsv9t5778hkMpYC5J3Zs2dHfX19k5+zqKio4vzzzx8oMQCA9FMAAwBso/3333/fJMz5+uuvR01NjcCAHaZLly4xZsyYOOecc2Lw4MEWAuSV6urqeOONNxIx64EHHriPxAAA0k8BDACwjbp27ZqIxz/PnTtXWMBO0bt37zjttNPinHPOif79+1sIkDeScr3VvXv3vaUFAJB+CmAAgG0wZMiQ0srKyj2a+py5XM7jn4Gdrk+fPnHWWWfFOeecE7vttpuFAKk3e/bsyOVyTX7Oli1b7jlo0KBSiQEApJsCGABgG5x55pl7ZjKZbFOfc9myZbFu3TqBAbtEnz594uyzz44zzzwzevbsaSFAaq1bty6WL1/e5OfMZDLZs846a4jEAADSrcgKAAC23tChQ4clYc558+YJC9jlBgwYEAMGDIgFCxbE+PHjY+nSpZYCpM68efOiS5cuTX7OffbZZ5+ImC4xAID0cgcwAMA26Nix4z5JmHP+/PnCApqMAQMGxC9/+cs47bTTolu3bhYCpEpSrrs6deq0j7QAANJNAQwAsJWOOOKIlhUVFf2a+pxVVVWxaNEigQFNSiaTicGDB8e//uu/xpgxY6JDhw6WAqTCW2+9FVVVVU1+zoqKis8deuihLSQGAJBeCmAAgK108sknD46ITFOfc/78+dHY2CgwoEnKZDKx9957x4UXXhhjxoyJ9u3bWwqQaI2NjbFgwYJE/Cv4u9/97h4SAwBILwUwAMBW2n333fdMwpze/wskwV+L4AsuuCBOPvnkaNu2raUAiZWU66/BgwfvKS0AgPQqsgIAgK3Trl27wU19xlwul5Q7UAAiIqKwsDCGDx8e++yzT0ybNi0mTJgQ69evtxggURYsWBC5XC4ymab9sJgOHToMlhYAQHq5AxgAYCsMGjSotGXLlgOa+pzvvfdebNy4UWBA4hQVFcWIESPikksuidGjR0fLli0tBUiMDz/8MJYtW9bk52zZsuXA/v37l0gMACCdFMAAAFvhxz/+8aBMJtPkn6Li7l8g6f5aBI8dOzZOOOGEaNGihaUAibBw4cImP2Mmk8n+5Cc/GSAtAIB0UgADAGyFvffee88kzJmEHzwCfBrNmjWLww47LMaOHRujRo2KsrIySwGatKT8Il5SrmsBANh63gEMALAVunbtOqSpz1hfXx9vvvmmsIBUKS4ujpEjR8bBBx8czz77bDz++ONRXV1tMUCT8+abb0Z9fX0UFTXtH7t16dJlT2kBAKSTO4ABAD6lioqKgoqKikFNfc4lS5bE5s2bBQakUklJSYwcOTLGjh0bRx99dJSUeIUl0LTU1tbG0qVLm/ycLVu2HFRaWupngwAAKeQiDwDgUzr77LP7FhYWNvlnj7722mvCAlKvefPmcdRRR8Ull1wSI0eOjGbNmlkK4HpsKxQWFpafffbZvaQFAJA+CmAAgE9p//3375+EOV9//XVhAXmjvLw8Ro0aFf/+7/8eI0eOjGw2aymA67FP6fOf//xAaQEApI8CGADgU+rRo8fuTX3G2traePvtt4UF5J2KiooYNWpUXHzxxXH44Yc3+XdvAum2ePHiRLySo1evXoOkBQCQPgpgAIBPqXXr1k3+DoklS5ZEQ0ODsIC81apVqzj++OPj4osvjhEjRkRBgW97gZ2voaEhlixZ0uTnbNOmjQIYACCFfCcMAPApDBkypLR58+a9m/qcb775prAAIqJ169YxevToGDt2rCIYcF32MZo3b95n0KBBpdICAEgX3wEDAHwKp556av9MJtPkr53eeustYQH8jTZt2sTo0aPjvPPOi+HDhyuCAddlfyOTyRT84Ac/+Jy0AADSxXe+AACfwuDBg5v84/Hq6+tj0aJFwgL4CJ06dYqTTz45/u3f/i323nvvyGQylgLsUIsXL07Eqzn23HPPgdICAEgXBTAAwKfQpUuXAU19xnfeeSfq6uqEBbAFnTt3jjFjxiiCgR2utrY23n333SRc53oPMABAyiiAAQA+hZYtW/Zv6jN6/DPAp9elS5cYM2ZMnHvuuTF48GALAfL2+iwJ17kAAGwdBTAAwCcYPnx4eUlJSeemPqfHPwNsvV69esVpp50W55xzTvTvrwMB8u/6rLS0tPPw4cPLpQUAkB4KYACAT/Ctb31rt4ho8s8IXbx4sbAAtlGfPn3irLPOinPOOSd22203CwG2i4T8gl7m29/+dj9pAQCkhwIYAOAT7L777k2+CVi7dm1s2LBBWACfUZ8+feLss8+OM888M3r27GkhwGfy4Ycfxrp165r8nAMHDlQAAwCkSJEVAABsWadOnZr8D8TefvttQQFsRwMGDIgBAwbEggULYvz48bF06VJLAbb5Oq1Vq1audwEA2GkUwAAAn6CyslIBDJCnBgwYEP3794958+bFQw89FO+++66lAFtlyZIlsddeezX1613PvgcASBEFMADAFnTq1CnbvHnzXk19ziVLlggLYAfJZDIxePDg2GOPPeLll1+OBx98MFauXGkxQGqu05o3b967Xbt2RatXr66XGABA8nkHMADAFowZM6ZnJpPJNuUZGxsbPZoUYCfIZDKx9957x4UXXhhjxoyJ9u3bWwrwiZYuXRqNjY1NesaCgoLsqaee2kNaAADp4A5gAIAt2Hvvvfs29RlXrlwZtbW1wgLYSf5aBO+5554xa9asmDBhQqxevdpigI9UW1sb77//fnTu3LlJzzls2LC+EbFIYgAAyecOYACALejRo0eTL4DfeecdQQHsAoWFhTF8+PC48MILY/To0VFZWWkpQGKv15Jw3QsAwKejAAYA2ILWrVs3+ff/vvvuu4IC2IUKCwtjxIgRcckll8To0aOjZcuWlgIk7notCde9AAB8Oh4BDQCwBc2bN+/Z1GdUAAM0kW+wi4pixIgRsd9++8WUKVPiscceiw0bNlgMEO+9914SrnsVwAAAKeEOYACAj9G/f/+SkpKSjk19TgUwQNPSrFmzOOyww2Ls2LExatSoKCsrsxTIc0m4XistLe3Ut2/fYmkBACSfAhgA4GOccMIJ3Zr69dK6deuiqqpKWABNUHFxcYwcOTJ+/etfK4Ihz1VVVcX69eub+pgF3/zmN7tLCwAg+RTAAAAfY8iQIT2b+oxJeJwgQL77axE8duzYOProo6OkpMRSIA8l4botCde/AAB8MgUwAMDH6N69e8+mPqPHPwMkR/PmzeOoo46KSy65JEaOHBnNmjWzFMgjSbhuS8L1LwAAn0wBDADwMVq1atWjqc+4bNkyQQEkTHl5eYwaNSr+/d//PUaOHBnZbNZSIA8k4botCde/AAB8MgUwAMDHqKio6NXUZ1y+fLmgAJL750yMGjUqLr744jj88MOjqKjIUiDFknDd1rJly16SAgBIPgUwAMBHyGazmbKysq5NecbGxsZYtWqVsAASrlWrVnH88cfHxRdfHCNGjIiCAt+qQxqtWrUqGhsbm/SMJSUlXbPZbEZaAADJ5rtKAICPcNxxx7UrKCgobsozrl69Ourr64UFkBKtW7eO0aNHx9ixYxXBkEJ1dXXxwQcfNOkZCwoKio877rh20gIASDbfTQIAfITPf/7zXZr6jO+//76gAFKoTZs2MXr06Dj//PNj+PDhimBIkRUrVrgOBgBgh/NdJP+PvTuPr7I888d/nSwEkhD2HUQEUVRAoIiouCtq64Jabd1arVorbqO2tlXbaavTOu38Rqffdmpbu9rWpYogsqgFRXCttAIKArJDgAAJBLKQ5JzfH8WO4+DOcp6T9/v18jWvTv657ut6hNvnk/t+AICd2G+//bL+xVcSXiAC8PF17do1Lr300rj99ttj2LBhkUq5lRWSLgn7tyTsgwEAeH8FWgAA8H917txZAAxAVujevXtceeWVsXr16njiiSdi9uzZkclkNAYSKAn7tyTsgwEAeH8CYACAnWjXrp0roAHIKj169Igrr7wyli5dGpMmTYo5c+ZoCiRMEvZvSdgHAwDw/gTAAAA7UVxc3D3baxQAAzRPffr0ibFjx8aSJUti/PjxsWDBAk2BhEjC/i0J+2AAAN6fbwADAOxESUlJz2yur7q6Ourq6gwKoBnbb7/94l/+5V/ia1/7WhxwwAEaAglQV1cX1dXV9sEAAOxWAmAAgHc5/PDDSwsKCtpmc40VFRUGBUBERPTt2zduvPHGuOGGG2LffffVEMhy2b6PKygoaDt8+PASkwIASC4BMADAu5x44oldsr3GDRs2GBQA/8uAAQPiG9/4Rtxwww3Ru3dvDQH7uE+yH+5qUgAAyeUbwAAA79KvX7+sD4DXr19vUADs1IABA+LAAw+MuXPnxoQJE2LlypWaAlkkCTe5HHDAAV0i4i3TAgBIJgEwAMC7dO/evXO21+gEMADvJ5VKxaBBg2LgwIExe/bsGD9+fKxbt05jwD4uZ/bDAAC8NwEwAMC7tG/fvlO21ygABuDDSKVSMWzYsBg6dGjMnj07HnvsMbdIwF6WhBPASdgPAwDw3gTAAADv0rp166w/8ZCEF4cAZI+3g+BDDz00XnnllZg4caK/S8A+LtH7YQAA3psAGADgXUpKSrL6xENjY2Ns3rzZoAD4yPLz8+Pwww+P4cOHx/PPPx8TJ06MqqoqjYE9aPPmzdHY2BgFBdn7Wi7b98MAALw/ATAAwLu0bNmySzbXV1lZGZlMxqAA+Njy8/Nj1KhRMXLkyHjhhRcEwbAHZTKZqKqqio4dO9oPAwCwWwiAAQDepaioKKuvvKusrDQkAHaJgoKCGDVqVIwYMSJmzpwZkydPji1btmgM7IH9XDYHwNm+HwYA4P3laQEAwP8YPnx4SX5+fkk21ygABmBXa9GiRRx//PFxxx13xNlnnx0lJSWaAs14P5efn18yfPhwfxAAACSUABgA4B2OOOKIDtleo+//ArC7FBUVxejRo+P73/9+nH322VFcXKwpsBsk4cr1JOyLAQDYOQEwAMA79O3bt1221+gEMAC729tB8B133BGnn356tGrVSlOgme3n9ttvv7YmBQCQTAJgAIB36NSpkwAYAHYoKSmJz3zmM3HnnXfG6NGjo0WLFpoCzWQ/l4R9MQAAOycABgB4hw4dOrTN9hqTcGUgALmlpKQkzj777PjOd74To0aNivz8fE2BHN/PJWFfDADAzgmAAQDeoaysrG221ygABmBvad++fVx00UVx5513xgknnBCFhYWaAjm6nysrK3MCGAAgoQTAAADvUFJS0j6b68tkMlFdXW1QAOxV7dq1i/POOy+++93vxqhRoyIvz+sF+CiSsJ8rLS0VAAMAJJT/QgMAeIfi4uK22VxfXV1dNDY2GhQAWeHtE8F33HGHIBg+gsbGxqirq7MvBgBgt/BfZgAA79CqVausPung9C8A2ahDhw5x0UUXxbe//e04/PDDBcGQA/u6oqIiJ4ABABLKf5EBALxDQUGBABgAPqauXbvGpZdeGt/61rdi2LBhkUqlNAUSuq9r0aJFW1MCAEimAi0AAPgfhYWFZdlc39atWw0JgKzXrVu3uPLKK2P16tXxxBNPxOzZsyOTyWgMJGhfl+37YgAA3psAGADgnZujgoLW2VyfE8AAJEmPHj3iyiuvjKVLl8akSZNizpw5mgIJ2ddl+74YAID35gpoAIAdWrdunZefn98ym2sUAAOQRH369ImxY8fGLbfcEgMGDNAQSMC+Lj8/v1WrVq28OwQASCCbOACAHQYNGlQSEVn9scJt27YZFACJtd9++8UNN9wQX/va1+KAAw7QEJq1BOzr8gYPHlxsUgAAySMABgDY4YADDijJ9hpramoMCoDE69u3b9x4441xww03xL777qshNEu1tbVZX2P//v1LTQoAIHl8AxgAYIeePXtm/QuuJLwoBIAPa8CAATFgwICYP39+jBs3LpYvX64pNBtJ2Nf16NGjxKQAAJJHAAwAsEOnTp0EwACwFwwYMCAOPPDAmDt3bkyYMCFWrlypKeS8JOzrunbtKgAGAEggATAAwA5lZWVZ/4Krrq7OoADISalUKgYNGhQDBw6M2bNnx4QJE2Lt2rUaQ85KQgDcpk0bV0ADACSQABgAYIeysjIngAFgL0ulUjFs2LAYOnRozJ49O8aPHx/r1q3TGHKOABgAgN1FAAwAsENJSUlxttfoBDAAzcXbQfCQIUPi5ZdfjokTJ0ZFRYXGkDOSEAAnYX8MAMD/JQAGANihqKioKNtrrKmpMSgAmpW8vLw4/PDDY/jw4fH888/HE088EZWVlRpD4iUhAG7RokWRSQEAJI8AGABgh8LCwhbZXF86nY7t27cbFADNUn5+fowaNSpGjhwZL7zwQkycODGqqqo0hsTavn17ZDKZSKVSWVtjixYtWpgUAEDyCIABAHbI9gC4oaHBkABo9goKCmLUqFExYsSImDlzZkyePDm2bNmiMSROJpOJhoaGyOaMtbCw0AlgAIAk/neTFgAA7NgYFRRk9QuuxsZGQwKAHVq0aBHHH398HHnkkfHMM8/E1KlTY9u2bRpDomR7AJzt+2MAAN5jH6cFAAA7NkZZ/oLL9c8A8H8VFRXF6NGj49hjj41nnnkmpkyZEjU1NRpDImT7DS8FBQWugAYASCABMADA2xujLH/B5QpoAHhvbwfBRx11VEyfPj2efvrpqK2t1RiymgAYAIDdIU8LAAD+QQAMAMlXUlISn/nMZ+LOO++M0aNHZ/X1uiAABgBgdxAAAwDskO1XQAuAAeDDKykpibPPPjv+7d/+LUaPHh2FhYWagv3dR5Sfn9/SlAAAkkcADADw9sYoL88JYADIMa1bt46zzz47vve978UJJ5wgCMb+7iPIz8/3LwwAQAIJgAEAdkilUlm9N2psbDQkAPiY2rVrF+edd15897vfjRNOOCEKCgo0Bfu7D94f55sSAEDyCIABAHbI9gA4nU4bEgB8Qu3bt/9nEDxq1KjIy/NqBPu799kfp0wJACB5/FcOAMAOXnABQPPRoUOHuOiii+J73/ueIJi9JpPJZHuJ/sUAAEggmzgAgP+R1QFwAl4QAkDidOzYMS666KL41re+FYcffnj4fTDs796xOc7yG3IAANg5mzgAgITsjQTAALD7dOvWLS699NL41re+FcOGDRMEs0dk+xXQeXl5/kUAAEigAi0AAPiHbH/BJQAGgN2ve/fuceWVV8ayZcviiSeeiDlz5mgKzXl/5/AIAEACCYABAHbIZDJOAAMAERGx7777xtixY2PJkiUxYcKEmD9/vqZgfwwAQCIIgAEA/ocr7gCA/2W//faLG264Id56660YP358vPnmm5rCLpPtV0Cn3IUOAJBIAmAAgB2y/QVXtr8gBIBc1rdv37jxxhvjrbfeinHjxsWiRYs0hU/MFdAAANjEAQDsXln9Bs4BDADY+/r27Rs333xz3HDDDdG7d28NIdf3d75BAgCQQE4AAwDskO0nMATAAJA9BgwYEAMGDIj58+fHI488EitXrtQUcnF/5woaAIAEcgIYAGCHVCqVzvL6DAkAssyAAQPi1ltvjbFjx0bPnj01hJza32UScEc1AAD/lxPAAAD/QwAMAHysv6MHDRoUBx98cDz//PMxadKk2LRpk8aQ+P1dtv+CJAAAO+cEMADADul0dr/fEgADQHarr6+PioqK2LZtm2aQE/u7dDrtBDAAQAI5AQwA8D+cAAYAPrK6urp4+umnY9q0acJfcm1/5wQwAEACCYABAP6HEw4AwIfW0NAQ06ZNiyeffDK2bt2qIXxkCfgGsAAYACCBBMAAADtkMpmsDoDz8ny9AwCywdvB71NPPRXV1dUaQs7u7wTAAADJJAAGANgh219wCYABYO9qbGyMGTNmxJNPPhmVlZUawieWn5+f9VtkUwIASB4BMADADplMpiGb6yssLDQkANgL0ul0zJo1KyZPnhwbN27UEHaZgoLsfjXX1NTUaEoAAAncZ2oBAMA/NDY2bs/m+gTAALBnpdPpePnll2Py5Mmxdu1aDWGXa9GiRbb/O1BvSgAAySMABgDYoampSQAMAEQmk4nZs2fH448/HuXl5RpCs93fNTY2CoABABJIAAwAsENDQ0NWv+ASAAPA7vV28PvEE0/E6tWrNYTdLtuvgM72G3IAAHiPfaYWAAD8gyugAaD5mjNnTkyaNCmWLl2qGewx2X4FtAAYACCZBMAAADs0NTU5AQwAzcyCBQtiwoQJ8dZbb2kG9nfv0tDQIAAGAEggATAAwA7Z/oJLAAwAu87ChQtj/PjxsXjxYs1gr8n2K6Cz/RckAQB4j32mFgAA/EO2B8AFBQWRl5cX6XTasADgY1q+fHmMGzcu5s+frxnsVXl5eVkfAG/fvt0JYACABBIAAwDs0NDQkPUnHFq1ahXbtm0zLAD4iFauXBmPPPKI4Jes2tclYH8sAAYASCABMADADrW1tXXZXqMAGAA+mnXr1sX48eNj9uzZkclkNISs2tdlu7q6ulqTAgBIHgEwAMAOW7du3ZrtNSbhRSEAZIP169fHY489JvjFvu4TqK6u3mpSAADJIwAGANihqqpKAAwACbdhw4Z4/PHH45VXXommpiYNwb7uE6isrHT1DABAAgmAAQB22LRpU9a/4GrZsqVBAcBOVFVVxcSJE+OFF16IxsZGDSHrJSEA3rRpkxPAAAAJJAAGANhh3bp1WR8AOwEMAP/bli1bYsKECYJfEicJ+7ry8nIBMABAAgmAAQB2WLZsmSugASAhqqurY/LkyTFz5syor6/XEBInCfu6pUuXCoABABJIAAwAsMP8+fOz/gRwcXGxQQHQrNXU1MSUKVPimWeeEfySaEnY173++uu+AQwAkEACYACAHRYsWFCXyWQaUqlUYbbW2Lp1a4MCoFmqq6uLp59+OqZNmxbbtsmkSL5s39el0+mGpUuXbjcpAIDkEQADALxDU1PTtoKCgrbZWp8AGIDmZvv27TF9+vR48sknY+tWt9GSO7J9X9fU1ORfOACAhBIAAwC8Q0NDw9ZsDoBLS0sNCYDm8ndyTJs2LZ566qmorq7WEHJOtu/rGhsb/YsHAJBQAmAAgHeor6+vbNWqVc9src8JYAByXWNjY8yYMSOefPLJqKys1BByVrbv6+rr66tMCQAgmQTAAADv0NDQkNVvmgXAAOSqdDods2bNismTJ8fGjRs1hJyX7fu6bN8XAwDw3gTAAADvUFdXV5XN9ZWWlkYqlYpMJmNYAOSETCYTr732Wjz++OOxatUqDaFZSKVSUVJSktU11tbWVpkUAEAyCYABAN5h27Ztm7K5vvz8/GjVqlXU1NQYFgCJlslkYvbs2fH4449HeXm5htCstGrVKvLz87O6xq1btzoBDACQUAJgAIB3qK6u3pztNZaVlQmAAUist4PfiRMnxpo1azSEZqmsrCzra9y2bVuVSQEAJJMAGADgHaqqqjZle43t2rWLtWvXGhYAiTNnzpyYNGlSLF26VDNo1tq1a5f1NW7atMkJYACALNbQWBgFjQ0REZFKRSavMJre/pkAGADgHSoqKqqyvcYkvDAEgHdasGBBTJgwId566y3NgITs5zZs2CAABgDIYoUFDf9MejMRqab0/+S+AmAAgHdYtWpV1r/oatu2rUEBkAgLFy6M8ePHx+LFizUD3iEJAfDq1aurTAoAIJkEwAAA77BgwYKsD4CdAAYg2y1fvjzGjRsX8+fP1wzYiST8Ql8S9sUAAOycABgA4B2eeOKJjZlMpimVSuVna41OAAOQrVauXBmPPPKI4Bc+QLb/Ql8mk2l64oknNpoUAEAyCYABAN6huro6vX379g1FRUVdsrVGJ4AByDZr166NCRMmxOzZsyOTyWgIJHw/t3379g3V1dVpkwIASCYBMADAu9TV1a0XAAPAB1u/fn089thjgl/Isf1cXV3delMCAEguATAAwLvU1dVVtGnTJmvrKykpiRYtWsT27dsNC4C9oqKiIiZOnBivvPJKNDU1aQh8BEVFRVFcXJz1+2GTAgBILgEwAMC7bN26dV2XLll7ADhSqVR07Ngx1qxZY1gA7FFVVVUxceLEeP755wW/8DF17NgxUqlU1u+HTQoAILkEwAAA71JVVZX1Jx46deokAAZgj9m8eXM8/vjj8cILL0RjY6OGwCfcx9kPAwCwOwmAAQDeZf369Vn/zbMkvDgEIPm2bNkSU6ZMiZkzZ0Z9fb2GwC7QsWNH+2EAAHYrATAAwLusXr066088JOHFIQDJVVNTE1OmTIlnnnlG8Au7WBJ+kW/VqlUCYACABBMAAwC8y9///ves/+aZABiA3aG2tjYmT54czz77bNTV1WkINNN93KuvvioABgBIMAEwAMC7PPzww+t//OMfN6RSqcJsrbFz584GBcAus3379pg+fXpMnTo1tm3bpiGwG2X7CeB0Ot3w8MMPC4ABABJMAAwA8C7V1dXpurq68latWu2TrTV26NAh8vLyIp1OGxgAH1tDQ0NMmzYtnnrqqaiurtYQ2M3y8vKiQ4cOWV1jfX39mtraWptMAIAEEwADAOxEbW3tmmwOgAsKCqJdu3axceNGwwLgI2tsbIwZM2bEk08+GZWVlRoCe0j79u2joCC7X8fV1NSUmxQAQLIJgAEAdmLz5s2r2rdvn9U1duvWTQAMwEeSTqdj1qxZMXnyZH+HwF7av2W7LVu2rDQpAIBkEwADAOzEpk2bVvfp0yera+zWrVvMmzfPsAD4QG8Hv1OmTIkNGzZoCOzF/Vu227BhwxqTAgBINgEwAMBOrFixYvWwYcOyusYkvEAEYO/KZDLx0ksvxZQpU6K83K2usLd17do162tctWrVKpMCAEg2ATAAwE7Mnz9/9ZgxY7K6xiS8QARg78hkMjF79uyYOHFirFnjMB9kiyT8At+8efP8oQEAkHACYACAnRg3btyab37zm5mISGVrjU4AA7Azc+bMiSeeeCKWLVumGZBlEvALfJlx48atNikAgGQTAAMA7MTrr79e29DQsKmwsLBDttZYXFwcZWVlsWXLFgMDIBYsWBDjx4+PJUuWaAZkobKysiguLs7qGhsaGjYuWLCgzrQAAJJNAAwA8B62bt26vF27dh2yucauXbsKgAGauYULF8b48eNj8eLFmgFZLAm3t2zbtm25SQEAJJ8AGADgPVRVVS1t167d0GyusWfPnrFw4ULDAmiGli1bFo899ljMnz9fMyABevbsmfU1VlZWLjUpAIDkEwADALyHdevWLevTp09W15iEF4kA7ForVqyIRx99VPALCZOEfdvatWuXmRQAQPIJgAEA3sPChQuXHX744VldY69evQwKoJlYtWpVjB8/PubOnRuZTEZDIGGSsG9buHDhMpMCAEg+ATAAwHuYNm3a0ksuuSSra+zevXvk5+dHU1OTgQHkqHXr1sX48eNj9uzZgl9IqIKCgkR8A/jpp59eZloAADmw/9QCAICde+ihhzbcd999W/Pz80uzdjNXUBBdunSJNWvWGBhAjqmoqIiJEyfGyy+/HOl0WkMgwbp27RoFBdn9Gq6xsbH6kUce2WBaAADJJwAGAHgf27ZtW15WVnZwNtfYq1cvATBADqmqqoqJEyfG888/74YHyBFJ+P7vtm3blpsUAEBuEAADALyPLVu2LMv2ALhnz57x0ksvGRZAwm3evDkef/zxeOGFF6KxsVFDIIck4fu/W7ZsWWpSAAC5QQAMAPA+1q9fvyzbT2z06NHDoAASbMuWLTFlypSYOXNm1NfXawjkoCTs19avX7/MpAAAcoMAGADgfSxYsGDh0KFDs7rGfffdN1KpVGQyGQMDSJCampqYMmVKPPPMM4JfyGGpVCr23XffrK9z/vz5C00LACA3CIABAN7Ho48++uYFF1yQ1TWWlJRE586dY926dQYGkAC1tbUxefLkePbZZ6Ourk5DIMd17do1WrVqlfV1/vnPf15kWgAAuUEADADwPiZNmlRVX1+/oaioqGM217nvvvsKgAGy3Pbt22P69OkxderU2LZtm4ZAM9GnT5+sr7G+vr7iySefrDItAIDcIAAGAPgAW7duXZTtAXCfPn3ipZdeMiyALNTQ0BDTpk2Lp556KqqrqzUEmpkkXP+8detWp38BAHKIABgA4ANUVFQs7NChw8hsrjEJLxYBmpvGxsaYMWNGPPnkk1FZWakh0EwlYZ9WUVHh+78AADlEAAwA8AGWLl266MADD8zqGnv16hUFBQXR2NhoYAB7WTqdjlmzZsWkSZNi06ZNGgLNWGFhYfTs2TMR+13TAgDIHQJgAIAPMHPmzEWnnnpqdm/qCgqiZ8+esWzZMgMD2EveDn4nT54cGzdu1BAg9tlnn8jPz0/CfnexaQEA5I48LQAAeH+//OUvV6bT6bpsr7NPnz6GBbAXZDKZePHFF+O73/1u3H///cJf4J+ScP1zOp2u++Uvf7nStAAAcocTwAAAH6C6ujpdXV29uE2bNodkc539+vWL6dOnGxjAHpLJZGL27NkxceLEWLNmjYYAO92fJWCvu7i6ujptWgAAuUMADADwIWzYsGFetgfA/fv3NyiAPeTVV1+NSZMmxapVqzQD2KlUKpWI/dmGDRvmmhYAQG4RAAMAfAiLFy9+o2/fvlldY1lZWXTu3DnWr19vYAC7yYIFC2L8+PGxZMkSzQDeV5cuXaK0tDQJ+9z5pgUAkFsEwAAAH8JTTz31+ujRo7O+zv33318ADLAbLFy4MMaPHx+LFy/WDOBD78uSYMqUKa+bFgBAbsnTAgCAD/aLX/xiTWNjY1W215mUF40ASbFs2bK4++674z/+4z+Ev8BHkoTv/zY0NFTee++9q00LACC3OAEMAPAhNDQ0ZDZv3jy/Q4cOI7O5TgEwwK6xYsWKePTRR2P+fDejArm7L9uyZYs/5AAAcpAAGADgQ1q3bl3WB8AdO3aMNm3axObNmw0M4GNYtWpVjB8/PubOnRuZTEZDgI+lbdu20aFDh0Tsb00LACD3CIABAD6kefPmzTvooIOyvs4DDzwwXnrpJQMD+AjWrVsX48ePj9mzZwt+gV2yH0uCuXPnzjMtAIDcIwAGAPiQ/vznP88/77zzsr7OAw44QAAM8CFVVFTEuHHjBL/ALt+PJcHDDz/sBDAAQA4SAAMAfEgTJ06srK2tXdGqVat9srnOgw8+2LAAPkBVVVVMnDgxnn/++WhqatIQYJdKwq0xNTU1yydNmlRlWgAAuUcADADwEWzYsOHvvXr1yuoAuG3bttG1a9dYu3atgQG8y+bNm+Pxxx+PF154IRobGzUE2OW6desWbdu2TcS+1rQAAHKTABgA4CNYuHDha7169Toj2+scMGCAABjgHbZs2RJTpkyJ5557LrZv364hwG6TlO//Lly48O+mBQCQmwTAAAAfwcSJE/9+wgknZH2dBx54YEyfPt3AgGavpqYmpkyZEs8880zU19drCLDbDRgwIBF1jh8//u+mBQCQmwTAAAAfwb333rv6Bz/4wfqioqLO2VznAQccEHl5eZFOpw0NaJZqa2tj8uTJ8eyzz0ZdXZ2GAHtEXl5e9O/fP+vrrK+vX3ffffeVmxgAQG4SAAMAfESVlZVzu3btmtXHgFu1ahX77LNPLFu2zMCAZqWuri6efvrpmDZtWmzbtk1DgD1qn332iVatWmV9nZs2bZpjWgAAuUsADADwES1dunR2tgfAERGDBg0SAAPNRkNDQ0ybNi2eeuqpqK6u1hBgr+2/kuCtt976m2kBAOQuATAAwEc0ffr0v48cOTLr6xw4cGBMmDDBwICc1tDQEM8991w8+eSTUVlZqSHAXt9/JcG0adP+bloAALlLAAwA8BH9x3/8x9JbbrmlOj8/v3U219mrV68oKyuLLVu2GBqQc9LpdMyaNSsmTZoUmzZt0hBgrysrK4tevXplfZ2NjY1b7rnnnmUmBgCQuwTAAAAfUW1tbXrDhg1/7dKly3HZXGcqlYqBAwfGrFmzDA3IGW8Hv5MnT46NGzdqCJA1Bg4cGKlUKuvr3Lhx4yu1tbVpEwMAyF0CYACAj+Gtt956JdsD4IgQAAM5I51Ox8svvxxTpkyJ8vJyDQGyct+VBIsWLXrFtAAAcpsAGADgYxg/fvwrRxxxRNbXedBBB0VBQUE0NjYaGpBImUwmZs+eHRMnTow1a9ZoCJCVCgoK4qCDDkpErY888ogAGAAgx+VpAQDAR/fjH/94ZX19/fpsr7OoqCj69etnYEAivfrqq3HHHXfEz3/+c+EvkNX69esXRUVFWV9nXV1d+b333rvaxAAAcpsTwAAAH9OGDRte6dGjx6ezvc5BgwbFggULDAxIjCVLlsSECRNi/vz5mgEkwuDBgxNR5/r1653+BQBoBgTAAAAf07x5815OQgA8bNiwePjhhyOTyRgakNXefPPNmDBhQixevFgzgMRIpVIxdOjQRNQ6d+7cl0wMACD3CYABAD6m++677+XRo0dnIiKVzXW2bds2evfuHcuWLTM0ICstW7YsHnvsMSd+gUTq06dPtG3bNgmlpu+9996/mhgAQO4TAAMAfEwTJ06s3Lp165LS0tK+2V7rkCFDBMBA1lmxYkU8+uijgl8g0YYMGZKIOqurqxc+/fTTm00MACD3CYABAD6B8vLyl/fff/+sD4AHDx4c48aNMzAgK6xcuTImTJgQc+fOdT09kHhJ+f7vmjVrfP8XAKCZEAADAHwCM2fOfG7//ff/fLbX2a1bt+jWrVuUl5cbGrDXrFu3LsaPHx+zZ88W/AI5oWfPntGlS5dE1DpjxoznTAwAoHkQAAMAfAK33Xbba5dcckl1fn5+62yvdciQIQJgYK9Yv359PPbYY4JfIOck5frnxsbGzbfddts8EwMAaB4EwAAAn0BlZWXThg0b/tqlS5fjsr3WQw89NCZNmmRowJ78MzKeeOKJeP7556OpqUlDgJxz6KGHJqLOioqKV6qrq9MmBgDQPAiAAQA+oXnz5s1MQgDcu3dv10ADe0RVVVVMnDgxXnjhhWhsbNQQICd17949evbsmZT9quufAQCakTwtAAD4ZP77v/97VkQk4kTFpz71KQMDdpstW7bEQw89FLfffns899xzwl8gpw0fPjwRdWYymfTdd9/9gokBADQfTgADAHxCkyZNqtqyZcuCsrKyg7K91uHDh8fjjz9uaMAuVVNTE1OmTIlnnnkm6uvrNQTIealUKg477LBE1Lply5bXp0+fvsXUAACaDwEwAMAusHz58lkDBw7M+gC4S5cu0atXr1i5cqWhAZ9YbW1tTJ48OZ599tmoq6vTEKDZ6N27d3Ts2DEx+1QTAwBoXgTAAAC7wLPPPvvCwIEDr0hCrcOGDRMAA59IXV1dPP300zFt2rTYtm2bhgDNzrBhwxJT61/+8pcXTQwAoHnxDWAAgF3g1ltvnV9fX782CbUefvjhkUqlDA34yBoaGmLq1Klx6623xuOPPy78BZqlJF3/XFdXt/rWW29dYGoAAM2LE8AAALtAQ0NDZs2aNc/16dPns9lea7t27aJPnz6xZMkSgwM+7J9xMW3atHjqqaeiurpaQ4Bmbb/99ou2bdsmotbVq1fPNDEAgOZHAAwAsIs8++yz05IQAEdEHHHEEQJg4AOl0+mYNWtWTJo0KTZt2qQhABFx5JFHJqbW6dOnTzMxAIDmxxXQAAC7yC233PJaQ0NDZRJqHT58eLRo0cLQgJ1Kp9Px3HPPxW233Rb333+/8Bdgh6KiovjUpz6ViFobGho23HLLLXNNDQCg+XECGABgF6murk6Xl5c/t88++5yR7bW2bNkyDj300Hj55ZcNDvindDodL7/8ckyZMiXKy8s1BOBdhgwZEkVFRYmodc2aNc/V1tamTQ0AoPkRAAMA7EIvvvjiM0kIgCMiRo4cKQAGIiIik8nE7NmzY+LEibFmzRoNAXif/VNSzJo161kTAwBongTAAAC70O233/7KOeecszU/P78022sdMGBAtG/f3tWu0My9+uqrMWnSpFi1apVmALyPjh07xgEHHJCIWhsbG6u/8Y1v/NXUAACaJwEwAMAutHLlyob169fP6tat2+hsrzWVSsXhhx8ekyZNMjhohubMmROTJ0+OJUuWaAbAh3D44YdHKpVKRK3r16+fVVFR0WhqAADNU54WAADsWq+++mpirts77LDDDAyamTfffDP+/d//PX7yk58IfwE+pFQqFSNGjEhMva+88sozpgYA0Hw5AQwAsIvddNNNz5166qnV+fn5rbO91m7dukX//v1j4cKFBgc5btmyZfHYY4/F/PnzNQPgIzrggAOic+fOiai1sbFxy4033jjL1AAAmi8BMADALrZy5cqG8vLyGT179vx0Euo9+uijBcCQw5YvXx7jxo0T/AJ8wv1SUpSXlz9TXl7eYGoAAM2XABgAYDeYMWPGUxdccEEiAuAhQ4ZE69ato7q62uAgh6xcuTImTJgQc+fOjUwmoyEAH1ObNm3i0EMPTUy9zz777FOmBgDQvPkGMADAbvDVr371lYaGhk1JqLWgoCCOOOIIQ4McsW7duvj5z38ed955Z8yZM0f4C/AJjRw5MvLz8xNRa0NDw8abbrrpVVMDAGjenAAGANgNKisrm1atWjW9T58+5ySh3qOPPjqefPJJQREk2Pr16+Oxxx6L2bNn+3cZYBdJpVIxatSoxNS7cuXKadXV1WmTAwBo3pwABgDYTaZNm5aY6/c6duwYAwYMMDRIoA0bNsSvf/3r+Nd//dd49dVXhb8Au9CAAQOiY8eOian36aefftLUAAAQAAMA7CZf+9rX5tTX11ckpd6jjjrK0CBBqqqq4v77749vf/vb8eKLL0ZTU5OmAOxiRx55ZGJqra+vX/eNb3zjdVMDAMAV0AAAu0ltbW16xYoVT++///6fT0K9hx56aLRt2zaqqqoMD7LYli1bYsqUKfHcc8/F9u3bNQRgN2nbtm0MGTIkMfUuX778qdraWtc/AwDgBDAAwO70xz/+cUJSas3Pz4/jjjvO0CBL1dTUxKOPPhq33XZb/OUvfxH+Auxmxx57bOTn5yel3Myvf/3rCaYGAECEABgAYLe66667llZXV89PSr1HH310tGjRwuAgi7wd/H7jG9+IqVOnRn19vaYA7GYtWrSIo48+OjH1btmy5Y177rlnhckBABDhCmgAgN3u9ddfn3T44YcPSEKtxcXFcdhhh8XMmTMNDvayurq6ePrpp2PatGmxbds2DQHYgw477LAoKSlJTL3z5s17wtQAAHibE8AAALvZ9773vanpdLohKfWecMIJkUqlDA72koaGhpg6dWrceuut8fjjjwt/AfawVCoVJ5xwQmLqTafT27/73e8+ZXIAALzNCWAAgN1s+vTpWyoqKmZ26dIlER/Y7d69e/Tv3z/efPNNw4M9qKGhIaZNmxZPPfVUVFdXawjAXnLAAQdE9+7dE1NvRUXFczNmzPAXBwAA/+QEMADAHjBr1qxEXcuXpFMvkHTpdDqee+65uP322+PRRx8V/gLsZccff3yi6p0xY8YkUwMA4J2cAAYA2AO++tWvvnT66adXFRYWtk1CvQMHDoyOHTvGhg0bDA92k3Q6HbNmzYrJkyfHxo0bNQQgC3Ts2DEGDhyYmHobGhoqb7755pdMDgCAd3ICGABgDygvL29YsWLF1MRsEvPy4sQTTzQ42A3S6XS8+OKL8Z3vfCfuv/9+4S9AFjnppJMiLy85r8tWrFgxpaKiotHkAAB4JwEwAMAe8qtf/erRiMgkpd6jjjoqysrKDA52kUwmE6+++mp873vfi1//+texdu1aTQHIImVlZXHUUUcl6q+W//7v//6zyQEA8G4CYACAPeQ///M/l1dWVv4tKfUWFhbGMcccY3CwC7wd/P785z+PNWvWaAhAFjruuOOioCA5X0urqqqa/dOf/nS1yQEA8G4CYACAPeill14al6R6jzvuuCgqKjI4+JjmzJkTd911V/z85z+P1au9owfIVkVFRYn7xbcXXnhhnMkBALAzBVoAALDnjB079pkFCxZUFhYWtktCvSUlJXHEEUfE9OnTDQ8+gjfffDPGjx8fb731lmYAJMCRRx4ZJSUliam3oaFh0zXXXPOsyQEAsDMCYACAPai8vLxh6dKlE/v3739xUmo+8cQT49lnn410Om2A8AEWLVoUjz32WCxevFgzABIiLy8vTjzxxETVvGTJkifKy8sbTA8AgJ3ucbUAAGDP+u1vfzsxIjJJqbdjx44xdOhQg4P3sXz58rj77rvjRz/6kfAXIGGGDRsWHTp0SFLJmd/85jePmxwAAO9FAAwAsIf953/+5/JNmza9kqSaTz/99EilUoYH77Jy5cr4yU9+Et///vdj/vz5GgKQMHl5eXHGGWckquZNmza9fM8996wwPQAA3osroAEA9oKXXnpp/KmnnnpYUurt2rVrDBkyJGbPnm14EBHr1q2L8ePHx+zZsyOTyWgIQEINHTo0OnfunKiaX3jhhQkmBwDA+xEAAwDsBZdffvkzS5YsWVdUVNQlKTWfccYZ8be//U3YRbO2fv36eOyxxwS/ADkglUrF6aefnqia6+rq1lx22WXTTQ8AgPcjAAYA2AsqKyub5s+f/8ihhx56dVJq7tatm1PANFsbNmyIxx9/PF555ZVoamrSEIAc8KlPfSq6du2aqJrfeOONcdXV1WnTAwDg/fgGMADAXvL1r399XDqdrktSzb4FTHNTVVUV999/f3z729+OF198UfgLkCNSqVR8+tOfTlTN6XS69pvf/OZjpgcAwAdxAhgAYC+ZMWNG9Zo1a/7Ss2fPxLx97N69ewwcODDmzJljgOS0LVu2xIQJE+KFF16IxsZGDQHIMYceemh069YtUTWvXr36qRkzZlSbHgAAH8QJYACAvejXv/71HyMiUR8SPeuss5wCJmdt27YtHn300bjtttviueeeE/4C5KC8vLwYM2ZM0srO/OpXv/qT6QEA8KH2vFoAALD3fP/733+rqqoqUR/V7dGjR3zqU58yPHJKfX19TJ06Nb71rW/F1KlTo76+XlMActSIESOiS5cuiap506ZNf73rrruWmh4AAB+GABgAYC975plnHkpazWeccUbk5dlKkjvmzZsXjz76aGzdulUzAHJYQUFBnH766Ymre9q0aQ+aHgAAH5a3dgAAe9nYsWNn1tfXr01SzZ07d47DDjvM8ACARBk5cmR06NAhUTXX1dWtHjt27POmBwDAhyUABgDYyyorK5tee+21Pyat7jPPPDMKCgoMEABIhBYtWiTy9O/s2bP/UF1dnTZBAAA+LAEwAEAWuOqqqyY0NjZWJanm9u3bx9FHH214AEAiHHfccdGmTZtE1dzQ0LDxiiuumGh6AAB8FAJgAIAssGDBgrqFCxc+lrS6R48eHYWFhQYIAGS1li1bxsknn5y4uhcuXDhu6dKl200QAICPQgAMAJAlvv71r/8pnU7XJqnmtm3bximnnGJ4AEBWO+2006K0tDRRNTc1NdV+7Wtfe8j0AAD4qATAAABZ4umnn968fPnyxF3xN3r06GjXrp0BAgBZqUOHDnH88ccnru5ly5ZNmD59+hYTBADgoxIAAwBkkbvvvvtPmUymKUk1FxYWxumnn254AEBWOvPMMxP3yYpMJtN41113/dH0AAD4OATAAABZ5Be/+MWatWvXTkta3UcccUT06tXLAAGArNK7d+847LDDEld3eXn5X+6///51JggAwMchAAYAyDIPP/zwn5JWcyqVijPPPNPwAICsMmbMmEilUomr+8EHH/yT6QEA8HEJgAEAsszXv/71NzZs2DAraXUPHDgwDj74YAMEALLCoEGDYsCAAYmru6KiYuatt966wAQBAPi4BMAAAFlo3Lhxv01i3WPGjIm8PFtMAGDvysvLizFjxiSy9j//+c+/NUEAAD7RflgLAACyz/XXXz+nqqrqr0mru1evXnHUUUcZIACwVx1zzDHRvXv3xNW9adOmV2666aa5JggAwCchAAYAyFJ/+tOf7k1i3WPGjInS0lIDBAD2ijZt2sRZZ52VyNofeOCBe00QAIBPSgAMAJClbrrpprlJPAVcXFwcZ555pgECAHvFWWedFS1btkxc3Zs2bXrl5ptvnmeCAAB8UgJgAIAsNm7cuF8lse5Ro0ZF7969DRAA2KP69OkTI0eOTGTtjz322K9MEACAXUEADACQxcaOHTu7qqrqb0mrO5VKxfnnnx+pVMoQAYA9tv/4/Oc/n8j9R2Vl5d+uueaav5kiAAC7ggAYACDLTZ069bdJrLtv374xZMgQAwQA9ojDDjsssTeQTJ48+TcmCADAriIABgDIcpdeeumLVVVVryax9s9//vNRXFxsiADAblVaWhrnn39+Imuvqqr66+WXX/6SKQIAsKsIgAEAEuChhx76WRLrLisri9NPP90AAYDd6qyzzoqSkpIklp753e9+91MTBABgVxIAAwAkwA033DB3w4YNs5JY+3HHHRd9+vQxRABgt+jbt28cddRRiay9oqJi1te//vU3TBEAgF1JAAwAkBA///nPfxoR6aTVnUql4vOf/3zk5dl6AgC7Vn5+flx00UWRSqWSWH76F7/4xX+bIgAAu5q3cAAACXHHHXe8tW7duulJrL13795xzDHHGCIAsEudcMIJ0b1790TWXl5e/pc77rjjLVMEAGBXEwADACTI3XfffW8mk2lKYu1nnXVWtG3b1hABgF2iQ4cOcfrppyey9kwm03T33Xf/3BQBANgdBMAAAAlyzz33rCgvL386ibW3bNkyzj33XEMEAHaJc889N1q0aJHI2tesWTP1xz/+8UpTBABgdxAAAwAkzA9/+MOfZzKZhiTWPnz48Bg0aJAhAgCfyKGHHhpDhw5NZO3pdLrhBz/4wS9MEQCA3UUADACQMPfee+/qRYsWPZDU+i+++OIoKSkxSADgY2ndunVcfPHFia1/4cKFf7jvvvvKTRIAgN1FAAwAkECXXXbZrxsaGjYlsfaysjJXQQMAH9u5554bpaWliay9oaFh4+WXX/47UwQAYHcSAAMAJNDs2bNrXn311V8ntf4jjjgiDj74YIMEAD6SwYMHx+GHH57Y+l955ZX7Zs+eXWOSAADsTgJgAICEOueccx6tqalZmtT6L7roomjZsqVBAgAfSsuWLeNzn/tcYuuvqalZMmbMmMdMEgCA3U0ADACQUJWVlU3Tpk37RVLrb9++fZx++ukGCQB8KGeccUa0b98+sfU/+eST91ZXV6dNEgCA3U0ADACQYOedd960qqqqV5Ja/wknnOAqaADgAx188MFx/PHHJ7b+TZs2vXzBBRc8a5IAAOwJAmAAgIT74x//eG9EZJJYeyqVigsuuMBV0ADAe2rZsmVccMEFkUqlkrqEzP333/8zkwQAYE8RAAMAJNzNN988b9WqVU8ktf6OHTsm+nt+AMDudcEFF0THjh0TW/+KFSse//rXv/6GSQIAsKcIgAEAcsCNN974k6ampq1JrX/kyJExdOhQgwQA/pdPfepTMWLEiMTW39TUVH3zzTf/t0kCALAnCYABAHLAxIkTK//+97//KslruPDCC6OsrMwwAYCIiGjTpk18/vOfT/QaZs+efd/EiRMrTRMAgD1JAAwAkCPOPvvsh2pqapYntf7S0tK46KKLDBIAiFQqFV/84hejtLQ0sWuoqal566yzznrYNAEA2NMEwAAAOaKioqJx0qRJP07yGgYPHhwjR440TABo5o444og46KCDEr2GJ5544qeVlZVNpgkAwJ4mAAYAyCGXXHLJzIqKihlJXsMFF1wQ3bp1M0wAaKZ69uyZ+KufKyoqZnzhC1+YZZoAAOwNAmAAgBzzb//2b/ek0+ntSa2/RYsWceWVV0ZhYaFhAkAzU1hYGF/60pcSvQ9Ip9Pb/+3f/u0e0wQAYG8RAAMA5Jh777139aJFix5M8hq6d+8eZ555pmECQDNzxhlnRPfu3RO9hsWLFz947733rjZNAAD2FgEwAEAO+uxnP/vL2traRL94PPHEE2Pw4MGGCQDNxKBBg+Kkk05K9Bpqa2tXn3vuub80TQAA9iYBMABADlq8eHH9uHHj/j3Ja0ilUnHJJZdE27ZtDRQAclybNm3ikksuiVQqleh1jBs37t8XL15cb6IAAOxNAmAAgBx1+eWXv1RRUTEjyWsoLS2NL3zhC4l/GQwAvLe3f+mrdevWiV5HRUXFM5dffvlLJgoAwN4mAAYAyGE33HDDXU1NTVuTvIaDDjrI94ABIId95jOfiUMOOSTRa2hqaqq+4YYbfmiaAABkAwEwAEAOGzdu3MbZs2cn/jt0p5xyiu8BA0AOOuSQQ+LTn/504tfx17/+9efjxo3baKIAAGQDATAAQI77zGc+81B1dfXCJK8hlUrFF7/4xejQoYOBAkCO6NixY3zpS19K/KceNm/ePO+00057xEQBAMgWAmAAgBxXXV2dfuCBB34UEekkr6O4uDguvfTSyMuzhQWApMvPz4/LLrssiouLk76U9P333/+ftbW1aVMFACBbeHsGANAMXH/99XMWLVr0YNLXsf/++8e5555roACQcOedd1707ds38etYuHDhH7/61a++bqIAAGQTATAAQDNxySWX/Lyurq486es4/vjjfQ8YABJs2LBhccwxxyR+HXV1dWsuvPDC+0wUAIBsIwAGAGgmXnvttdoHHnjguxGRSfI6UqlUfOlLX4oePXoYKgAkTO/evePSSy9N/Hd/IyLzwAMPfO/111+vNVUAALKNABgAoBm5+uqr/7Z06dJHk76OoqKiGDt2bJSWlhoqACRE69at46qrrorCwsLEr2X58uXjrr766r+ZKgAA2UgADADQzJx33nn/r66ubnXS19GhQ4e4/PLLIy/PlhYAsl1eXl5cfvnl0b59+8Svpb6+ft0ll1zyE1MFACBr999aAADQvLz++uu1Dz744Pcj4VdBR0QMGDAgzjrrLEMFgCw3ZsyYOPDAA3NiLY899tgPXnnllW2mCgBAthIAAwA0Q1/5ylf+umbNmqm5sJaTTz45Dj30UEMFgCw1ZMiQOOmkk3JiLWvXrv3LpZde+oKpAgCQzQTAAADN1GWXXfYf9fX1FUlfRyqViksvvTS6d+9uqACQZXr06BFf/OIXI5VKJX4tDQ0Nm6655pofmioAANlOAAwA0EzNmDGj+oEHHvhO5MBV0C1btozrr78+2rZta7AAkCXatWsX1113XbRs2TIXlpN56KGH/nXSpElVJgsAQLYTAAMANGNf+cpX/rpkyZI/58Ja2rZtG1dffXW0aNHCYAFgL2vRokVcffXVOfPLWUuXLn30iiuueNlkAQBIAgEwAEAzd+655/6ktrZ2eS6spXfv3jlzzSQAJNXbn2fYZ599cmI9tbW1y88555wfmywAAEkhAAYAaOYWLFhQ97Of/ezbmUymMRfWM2zYsDjllFMMFgD2kk9/+tMxdOjQnFhLJpNp/NnPfvbtBQsW1JksAABJIQAGACBuvfXWBfPnz78/V9Zz5plnxuDBgw0WAPaw4cOHx2c+85mcWc/8+fN/d+utty4wWQAAkkQADABARESMGTPmvpqamrdyYS2pVCouu+yy6Nmzp8ECwB7Su3fvuPjii3PmUwxbt25ddPrpp//aZAEASBoBMAAAERGxcuXKhh/+8Ie3pdPpnLjisGXLlvEv//Iv0aVLF8MFgN2sS5cucf3110dRUVFOrKepqanmu9/97jfKy8sbTBcAgKQRAAMA8E933XXX0ueff/6eXFlPaWlpXHvttVFWVma4ALCblJWVxXXXXRclJSU5s6aZM2fe/f/+3/9bZboAACSRABgAgP/l5JNPHldeXv50rqynU6dOMXbs2Jw5kQQA2aSoqCiuueaa6NixY86sqby8/MlTTz11gukCAJBUAmAAAP6PSy655K66urq1ubKefffdN6644orIy7P9BYBdJS8vL6688sro3bt3zqyprq6u/JJLLvmh6QIAkOi9uhYAAPBus2bNqn7ooYfujIh0rqxp4MCBcd555xkuAOwi559/fhxyyCG5tKT0gw8+eOesWbOqTRcAgCTLb3tQ9NzpjndbRG15oQ4BADRTEydOXDNmzJi8Tp06Dc2VNfXp0yfy8/PjzTffNGAA+ATOOuusOOmkk3JqTa+//vp9Z5555kTTBQAgCYq7N0Ze6c5/5gQwAADv6dRTT/31li1bXs+lNZ122mlx9NFHGy4AfEzHHntsnHrqqTm1pi1btrxx2mmn/cZ0AQDIBQJgAADeU0VFReONN974jcbGxqpcWtcFF1wQRx55pAEDwEd05JFHxuc+97mcWlNjY2PVzTff/I2KiopGEwYAIBcIgAEAeF9//OMf1z/yyCPfiRz6HnAqlYqLLroohgwZYsAA8CENHTo0LrrookilUrm0rPQjjzzynfvvv3+dCQMAkCsEwAAAfKBLL730hQULFvwupzbCeXnxpS99Kfbff38DBoAPcNBBB8WXvvSlyMvLrVdJCxYs+N2ll176ggkDAJBLBMAAAHwoo0eP/mVVVdXcXFpTYWFhfOUrX4kePXoYMAC8h169esUVV1wRBQUFObWuqqqqOaNHj/6lCQMAkGsEwAAAfCgVFRWNV1111S0NDQ0bcmldJSUlcfPNN8c+++xjyADwLr17946bbropiouLc2pdDQ0NG6666qqv++4vAAC5SAAMAMCHNmHChE3333//tzKZTDqX1lVcXBzXXXdddO/e3ZABYIfu3bvHtddeG61atcqpdWUymfT999//rQkTJmwyZQAAcpEAGACAj2Ts2LGz58+f/9tcW1fr1q3juuuuiw4dOhgyAM1ehw4d4rrrrovWrVvn3Nrmz5//m7Fjx842ZQAAcpUAGACAj+y44477xaZNm17MtXW1a9cubrzxxmjXrp0hA9BstW3bNmf/Pty4ceOLxx13nO/+AgCQ0wTAAAB8ZNXV1emLL774W3V1datzbW0dO3aMG2+8Mdq0aWPQADQ7ZWVlceONN0bHjh1zbm21tbWrL7zwwturq6vTJg0AQC7Lb3tQ9NzZD9LbImrLC3UIAICdWrZsWf327dtfOvbYY0/Ny8trkUtrKykpiaFDh8Zrr70WNTU1hg1As9ChQ4f42te+Fp06dcq5tTU1NW39zne+M/bBBx9cb9IAAOSC4u6NkVe6858JgAEA+NhefPHFzYcccsiyAQMGnBgRqZzaRBcXx5AhQ4TAADQLHTt2jJtuuik6dOiQi8tLjx8//ravfvWrc0waAIBc8X4BsCugAQD4RC688MIZb7zxxm9ycW3t27ePm266KSdPQgHA2zp16pTL4W+88cYbv77wwgufM2kAAJoLATAAAJ/YqFGjfrFhw4aZubi2t0Pgzp07GzQAOadz585x0003Rfv27XNyfRs2bJg5atSo+0waAIDmRAAMAMAnVltbm77sssu+V1dXtzoX19euXbu44YYbomPHjoYNQM7o0KFDXH/99dGuXbtc3Z+s/sIXvvDd2tratGkDANCc+AYwAAC7xJIlS+oj4pVRo0admpeX1yLX1ldcXBxDhw6NuXPnxrZt2wwcgETr0qVL3HjjjTl77XNTU1P1nXfeec0f/vCHdaYNAEAuer9vAAuAAQDYZWbNmlXVo0ePuYceeujoVCqVn2vra9WqVYwYMSIWLVoUlZWVBg5AIu23335x0003RVlZWU6uL51ON/z617++4fbbb3/TtAEAyFUCYAAA9phJkyatPeqoozbsu+++R+fi+goLC2P48OGxbNmy2LBhg4EDkCgDBgyIa6+9Nlq1apWza5w2bdq/XXLJJc+ZNgAAuez9AmDfAAYAYJc77bTTHn/rrbcezNX1FRUVxTXXXBNDhgwxbAASY8iQIXHNNddEUVFRzq5xwYIFvzv99NOfMG0AAJozATAAALvFEUcccc+GDRtm5ur6CgoK4sorr4wjjjjCsAFIwt/LceWVV0ZBQUHOrrG8vPypESNG/LdpAwDQ3AmAAQDYLaqrq9MXXXTRd2pra1fk7GY6Ly8uvvjiOPLIIw0cgKw1atSouPjiiyMvL3dfA23dunXxZz/72e83NDRkTBwAgObON4ABANhtli9fvr2mpuaFY4899uT8/PyWubjGVCoVgwYNikwmE4sWLTJ0ALLK6aefHueee26kUqmcXWN9fX3FDTfccM3UqVOrTBwAgObi/b4BLAAGAGC3evnll7cUFBS8cMQRR4zOy8trkYtrTKVSccABB0SnTp1i7ty5kck4fATA3lVYWBhXXHFFHHPMMTm9zsbGxuo777zzKz/72c9WmzoAAM2JABgAgL1qxowZlb169Xp98ODBJ6dSqfxcXWfPnj2jb9++8fe//z0aGxsNHoC9olWrVnH11VfHwIEDc3qd6XS64be//e2Nt9122wJTBwCguREAAwCw1z3xxBPlw4cPX9OvX79jIyJn76Hs2LFjDBw4MObMmRN1dXUGD8Ae1a5du7jxxhujT58+ub7U9JQpU779xS9+8XlTBwCgOXq/ADhPewAA2FPGjBkz9Y033vh1rq+zZ8+eceONN0bHjh0NHYA9pkuXLnHTTTdF9+7dc36tc+fO/eU555zzF1MHAID/SwAMAMAe9alPfernS5cufTjX19mlS5e49dZb48ADDzR0AHa7gQMHxje/+c3o1KlTzq/1rbfeemjEiBG/MnUAANg5ATAAAHvcsccee8/GjRtfyPV1FhcXx7XXXhsjRowwdAB2m8MPPzyuuuqqaNmyZc6vdePGjc8fffTR95g6AAC8NwEwAAB7XEVFReNxxx339crKyr/l+loLCgrisssui/PPPz9SqZThA7DLpFKpOP/88+PSSy+NgoKCnF/vpk2bXj7ssMNuqaysbDJ9AAB4bwJgAAD2isWLF9efddZZN1dXV7/ZHNZ7/PHHx5e//OUoKioyfAA+sRYtWsSXv/zlOP7445vFequrq98cM2bMN8rLyxtMHwAA3l9+24Oi585+kN4WUVteqEMAAOw2a9asaVi1atWs0aNHH1dQUNA619fbrVu3OOCAA2LevHlRX1/vAQDgYykrK4trrrkmDjrooGax3rq6uvKxY8de89RTT202fQAA+Ifi7o2RV7rznwmAAQDYq+bNm1ezevXqZ04++eTjCwoKSnN9ve3atYuRI0fG8uXLY+PGjR4AAD6S/v37x0033RRdu3ZtFuutr69fd9111335T3/6U4XpAwDA/xAAAwCQ1ebMmbMtlUq9fOSRR56Ul5eX83ckt2jRIkaMGBG1tbWxdOlSDwAAH8rxxx8fX/rSl5rN5wQaGxu33HXXXdf99Kc/XWn6AADwvwmAAQDIejNnzqzs2bPn64MHDz4plUrl5/p6U6lUHHLIIdGqVatYsGBBZDIZDwEAO5WXlxef/exn4/TTT49UKtUs1pxOp7f//ve//+o3vvGN1z0BAADwfwmAAQBIhEmTJpXvs88+8wYOHHhCKpUqaA5r3m+//WLAgAExd+5c3wUG4P8oKyuL6667LoYNG9Zs1pxOp7f/8Y9/vOmqq676qycAAAB2TgAMAEBiTJw4cc3BBx+85MADDzwulUrlNYc1t2/fPoYOHRqLFi2KLVu2eAgAiIiIffbZJ66//vro2bNns1lzJpNpnDBhwm1f/OIXn/cEAADAexMAAwCQKI8++ujy/fff/42DDjrohOZwHXRERHFxcRx11FHR2NgYb731locAoJkbPXp0XHHFFVFSUtJs1pxOpxsefvjhr15yySWzPAEAAPD+BMAAACTO+PHjVw0cOHDpAQcccGxzOQmcSqViwIAB0aVLl3jjjTeiqanJgwDQzBQVFcWll14aJ554YrP53m/EP07+Pv7447dffPHFMz0FAADwwQTAAAAk0iOPPLLs0EMPXbb//vs3mxA4IqJHjx4xZMiQePPNN2Pr1q0eBIBmonv37vEv//IvccABBzSrdWcymaYnnnji9s997nPPeAoAAODDEQADAJBYDz/88NJjjjlmY+/evY+KiGZzFKq0tDSGDx8eq1evjvXr13sQAHLcwIED45prrol27do1t6VnZsyY8YOzzjprqqcAAAA+PAEwAACJdv/99795zDHHVO6zzz5HRDMKgVu0aBGHHXZYtGzZMhYuXBjpdNrDAJBjCgoK4pxzzonzzz8/WrRo0dyWn37uuefuOuWUUyZ4EgAA4KMRAAMAkHi///3v5w8bNmxF3759j2lO10GnUqno27dvDB06NBYvXhxbtmzxMADkiJ49e8YNN9wQgwcPblbf+434x7XPU6ZM+fbpp58+2ZMAAAAfnQAYAICc8OCDDy4ZNmzYin79+jWrEDgionXr1nHEEUdEfX19LF261MMAkGCpVCpOOOGEuOKKK6JNmzbNbv07wt9vnXPOOX/xNAAAwMcjAAYAIGc89NBDS4YNG7a8X79+xza3EDg/Pz8OPvjg6NWrV8yfPz8aGho8EAAJU1JSEpdffnmccMIJkZ+f3+zWn8lkGp944olvffazn53maQAAgI9PAAwAQE556KGHlo4cOXJdnz59RqWa252ZEdG1a9cYNmxYLFu2LCorKz0QAAnRt2/fuO6662K//fZrluvPZDLpp59++rvnnHPO054GAAD4ZATAAADknD/96U+LDj300KX7779/s7sOOiKiuLg4jjzyyCgpKYk333wz0um0hwIgSxUUFMRnP/vZuPDCC6OkpKRZ9iCdTjc88sgjt5x//vnTPREAAPDJCYABAMhJDz/88NId3wQelUqlmt09mqlUKvr06RMHH3xwLFy4MLZt2+ahAMgynTt3jrFjx8bQoUOjGV5aERH/CH+feOKJ2y+88MLnPBEAALBrCIABAMhZDz300JIePXq8NmjQoGPz8vJaNMcetG3bNkaNGhVNTU2xZMkSDwVAFkilUjF69Oi48soro0OHDs22D01NTdt++9vf/stll132oqcCAAB2HQEwAAA5bdKkSeXdu3efM3jw4GYbAufn58eAAQOiV69esWDBgti+fbsHA2Avad26dVx66aVx/PHHR35+frPtQ2NjY/WvfvWrf7nuuute81QAAMCuJQAGACDnTZ48eW1jY+OMI4444uiCgoKS5tqHrl27xqhRo2Lbtm2xcuVKDwbAHpRKpWLUqFExduzY6NWrV7PuRX19/fo77rjjK9/61rcWejIAAGDXEwADANAsPP/881UbNmx45rjjjjuqsLCwrLn2obCwMAYNGhT77bdfLF68OGpraz0cALtZ+/bt44orrogTTzwxCgub9/uU2tralTfffPPVP/nJT1Z7MgAAYPcQAAMA0Gz87W9/27p27doZJ5xwwsjCwsK2zbkXnTp1ipEjR0Z1dbXTwAC70ciRI+Pqq6+OHj16NPte1NTULL/hhhuu/e1vf7vOkwEAALuPABgAgGbltdde2zpv3rynTznllKFFRUWdmnMvCgsL49BDD4399tsvFi1a5DQwwC709qnfk08+udmf+o2I2Lx587yLL774unHjxm30dAAAwO71fgFwat9zYsTOftC4LmLjq610DwCAxOrVq1fhs88++69du3Y9QTciGhoaYurUqTF58uRobGzUEICPqaCgIE499dQYPXq04HeH8vLyp4499tjvrly5skE3AABg9+swrDYKuuz8ZwJgAAByWuvWrfNeeumlm/fdd9+zdeMfVq9eHffff38sWbJEMwA+ov322y8uuugi1z2/w8KFC38/fPjwnzY0NGR0AwAA9gwBMAAAzd7zzz9/8aGHHnp1RKR0IyKTycTMmTPjz3/+c9TV1WkIwAcoKSmJ8847L0aMGBGplL9Kdki//PLL9xx77LEPagUAAOxZ7xcA+wYwAADNwn333Tfn+OOP39yrV6/DQwgcqVQqevfuHcOHD49169ZFRUWFhwTgPRxyyCExduzY6N+/v/B3h0wm0/jMM8/828knnzxONwAAYM97v28AC4ABAGg2fve7370xePDgJf369Ts6lUrl60hEcXFxjBgxInr06BFLly6N2tpaTQHYoUOHDvGFL3whzjzzzCguLtaQHZqammoeeOCBWz73uc9N1w0AANg7BMAAALDDww8/vKygoOC54cOHH1FQUFCqI//QrVu3OO6446K0tDQWL14cTU1NmgI0Wy1btoxzzjknLr300ujevbuGvENtbe2K22677arbbrvtDd0AAIC9RwAMAADv8Oyzz25avHjx0yeddNKQoqKiTjryD3l5edGnT58YOXJkbN26NVatWqUpQLNz+OGHx1e+8pUYMGBA5OXlacg7VFVV/e3CCy+8/oEHHvDdAAAA2MsEwAAA8C7z58+vefbZZ58+44wz+hcXF/fSkf/RsmXLGDJkSOyzzz6xdOnSqKmp0RQg53Xs2DG++MUvximnnBItW7bUkHdZt27dMyeffPI3Xn755W26AQAAe9/7BcCpfc+JETv7QeO6iI2vttI9AAByWmFhYer555//0sEHH3y5bvxfTU1N8fzzz8f48eOjurpaQ4Cc07p16zjzzDPjyCOPdOJ35zJ///vff3rMMcfc39DQkNEOAADIDh2G1UZBl53/TAAMAAARMWnSpM8cc8wxt6RSKdfg7ERNTU1MmTIlpk2bFg0NDRoCJF5hYWGccsopcdJJJ0VRUZGG7EQ6na6fOnXqd88555y/6AYAAGSX9wuAXQENAAAR8Yc//GHhfvvt98aAAQOOysvLkwS8S2FhYQwYMCCGDh0amzZtinXr1mkKkFiDBw+Oq666KoYOHRoFBQUashONjY1Vv//972/5whe+MEs3AAAg+/gGMAAAfAgTJkxYXV1dPf3II4/8VGFhYTsd+b9KS0vjsMMOi/79+8eaNWti8+bNmgIkRu/evePyyy+PU045JUpLSzXkPWzdunXxLbfccs33vve9hboBAADZyTeAAQDgI+jTp0+LJ5988us9evQ4TTfe3/z58+ORRx6JlStXagaQtXr16hXnnHNODBgwQDM+wKpVq5444YQTfrBy5Ur3/QMAQBbzDWAAAPgYnnnmmfOHDx9+fSqVytON95bJZGL27Nkxbty4qKio0BAga3Tu3DnOOuusGDp0aKRSKQ15/z/Lm2bNmvXDk08++THdAACA7OcbwAAA8DH85je/eX3//fd//cADDzzSd4HfWyqViu7du8cxxxwT7dq1i2XLlkV9fb3GAHtN27Zt49xzz42LL744evToIfz9AI2NjdUPPvjgLZ/97Gf/ohsAAJAMvgEMAAAf0/jx41dFxPOHHXbYiMLCwjIdeW95eXnRu3fvOOqoo6KgoCBWrlwZjY2NGgPsMcXFxXHKKafEl770pejbt2/k5bnA4YPU1tau+MEPfnD9LbfcMk83AAAgQf/94xvAAADwyQwePLjVo48++s1u3bqdpBsfTn19fTzzzDMxderU2LZtm4YAu01ZWVmceuqpceSRR0ZRkQsbPqyVK1c+/ulPf/pHixcvdm0DAAAkjG8AAwDALvLkk0+edeSRR96USqVcl/MhCYKB3eXtE7/HHnus4PcjyGQyDbNmzfoP3/sFAIDk8g1gAADYRX7/+98v6NGjx2uHHHLIyPz8fL8x+SEUFBREv3794qijjoq8vLxYtWqVq6GBT6Rly5ZxwgknxBVXXBEHHXRQFBQUaMqH1NDQsOG3v/3t1z7/+c8/oxsAAJBcroAGAIBd7Lzzzut4991339m2bdvBuvHR1NTUxLPPPhvTpk2LLVu2aAjwoZWVlcXxxx8fxxxzTBQXF2vIR1RVVfW3a6+99vZHHnlkg24AAECyuQIaAAB2g06dOhVMmzZtbN++fT8XESkd+WgaGhri+eefjyeffDI2bJBFAO/7522cdNJJccQRR0RhodvKPobMokWL/nTsscf+pLKyskk7AAAg+QTAAACwG/3hD38Ydfrpp99WUFDQRjc+unQ6Ha+++mpMnTo1Vq5cqSHAP/Xq1StOOeWUGDp0aOTl5WnIx9DY2Fg1YcKEOy666KKZugEAALlDAAwAALvZaaed1vbee+/9docOHUbqxse3fPnymDZtWrz88suRTqc1BJqhvLy8OOyww+L444+P3r17a8gnsHHjxue//OUvf3fSpElVugEAALlFAAwAAHtAYWFh6qmnnjpv+PDh16RSKXeUfgIbNmyIGTNmxHPPPRc1NTUaAs1AcXFxjBo1Ko4++ujo2LGjhnwCmUym4ZVXXvl/J5100kMNDQ0ZHQEAgNzzfgFwftuDoufOfpDeFlFb7p0VAAB8WOl0On7zm9+8Xlpa+uLgwYM/VVhYWKYrH09xcXEMGDAgjj322GjTpk2sXbs2amtrNQZyUIcOHeKMM86ISy+9NAYOHBjFxcWa8gnU1tau+slPfnLjxRdf/IybFAAAIHcVd2+MvNKd/8wJYAAA2A1OPPHENvfdd9+tnTp1Olo3PrnGxsb429/+Fs8++2wsWrRIQyAH9OvXL44++ugYNmxYFBQUaMguUFFR8cwXv/jFf5s+ffoW3QAAgNzmCmgAANhLHn744RNGjx799YKCgta6sWusX78+Zs6cGc8//3xUV1drCCRIaWlpHHnkkXHUUUdF586dNWQXaWxs3DJ16tS7PvvZz/5FNwAAoHkQAAMAwF50ySWXdP3+97//rXbt2g3VjV2nsbExXnvttXjuuedi/vz5GgJZbMCAATFq1KgYPHiw0767WFVV1atf//rXv/e73/1urW4AAEDzIQAGAIC9rF27dvlTp0699OCDD740lUrl68iutXz58nj++efj5ZdfjpqaGg2BLFBSUhLDhw+PI444Inr37q0hu1gmk2mcN2/efSeeeOJvq6urfewXAACaGQEwAABkia9//ev73Xjjjf9aWlraXzd2vXQ6HW+++WY899xz8dprr0VjY6OmwB5UUFAQgwcPjlGjRsUBBxwQeXl5mrIbVFdXL/zP//zPf/3BD36wRDcAAKB5EgADAEAWOfjgg1v9+c9/vrZ3795jIiKlI7tHZWVlvPjii/HCCy/EunXrNAR2o65du8bIkSPj8MMPj7Zt22rI7pNZunTpn88888z/t3jx4nrtAACA5ksADAAAWejuu+8eePHFF9/WqlUrd6PuZuXl5fHqq6/GSy+9FOvXr9cQ2AU6d+4cI0aMiGHDhkW3bt00ZDerqalZ9tvf/vbOm266aa5uAAAAAmAAAMhS/fr1K3r44Ycv79+//4WpVMpdqXvA8uXL46WXXoqXX345qqurNQQ+grKyshg+fHiMGDHCd333kEwmk164cOEfzj777F8sXbp0u44AAAARAmAAAMh6P/3pT4d97nOf+2bLli176Mae0dDQEHPnzo2//vWvMXfu3Ni+Xa4CO9OyZcsYNGhQDBs2LA455JAoKCjQlD2ktrZ21R//+Mc7rr322r/rBgAA8E4CYAAASIA+ffq0ePTRR69wGnjPS6fTsXTp0nj11VedDIaIaNu2bQwbNiyGDRsWffr0ibw8fyTtSZlMpuG11177+ZlnnvmnioqKRh0BAADeTQAMAAAJ8uMf//jQCy644JutWrXaRzf2vLdPBs+ePTvmzp0bdXV1mkKzUFZWFoMHD45hw4ZF//79Iz8/X1P2gpqammX333//nTfccINv/QIAAO9JAAwAAAnTrl27/HHjxp37qU996qq8vDwb870kk8nEihUrYu7cuTFnzpxYsWJFZDIZjSEnpFKp6Nu3bwwbNiwGDRoUHTt21JS9qKmpqfbVV1/92ZgxY/5cWVnZpCMAAMD7EQADAEBCffnLX+5x++23f7V9+/aH68bet2XLlnjjjTdizpw5MW/evKivr9cUEqVly5Zx8MEHx6BBg+KQQw6J0tJSTckCGzdufPG73/3uv//iF79YoxsAAMCHIQAGAIAEKywsTE2cOPGMkSNHXlNQUNBaR7JDXV1dvPnmm/HGG2/EG2+8EevXr9cUslKXLl3ioIMOioMOOigOOOCAKCoq0pQs0djYuGXmzJk/PvPMMyc2NDS4XgAAAPjQBMAAAJADjjzyyNY/+9nPrujbt++5EZGnI9mluro6Fi5cGPPnz4958+ZFZWWlprBXtGvXLg455JAYMGBA9O/fP1q39nsjWSj91ltv/fmqq676xaxZs6q1AwAA+KgEwAAAkEN++ctfjhgzZsyNrVq16q0b2SmdTsfKlStj0aJFsXDhwli8eHFs27ZNY9gtSkpKol+/ftG/f//Yf//9o1evXpGX53dEslVNTc3yRx999EdXXnnlK7oBAAB8XAJgAADIMd26dSt8+OGHPzd48ODL8vPzbdyzXCaTiTVr1sTChQtj0aJFsWjRotiyZYvG8LGUlZVF//79/xn6du/ePVKplMZkuaampprXXnvtV2PGjHmgoqKiUUcAAIBPQgAMAAA56rjjjiv7r//6r8tdC508mzdvjuXLl8eKFSti+fLlsXjx4qipqdEY/pfi4uLo169f9O7dO/bZZ5/Yd999o6ysTGMSJJPJpJcsWfLn66677pfTp0/3mx8AAMAuIQAGAIAc99Of/nTIueeee3NpaWlf3UimxsbGWLlyZSxdujSWLVsWy5cvj3Xr1kUmk9GcZiKVSkWXLl1in332iT59+kSfPn2iV69eUVBQoDkJtXXr1sUPPvjgj6699tq/6wYAALArCYABAKAZaNeuXf64cePOGTp06BUFBQWtdST56uvrY+XKlf88KbxixYpYu3ZtpNNpzUm4vLy86Nq1a+yzzz7//KdXr17RsmVLzckBjY2NW/7617/+4pxzznm0srKySUcAAIBdTQAMAADNyIknntjmnnvuuXzfffcdk0qlHB3MMdu3b481a9bEmjVrYu3atbF27dooLy+PDRs2CIazUF5eXnTs2DG6desWXbt2jW7dukW3bt2iR48eUVhYqEE5JpPJNC5ZsuRR1z0DAAC7mwAYAACaoa9+9av7Xnfdddd16NDhCN3IfY2Njf8MhNetWxfr1q2LioqKWLduXWzbtk2DdrPS0tLo3LnzP//p0qVLdO3aNbp27eoK52Ziw4YNM//rv/7rxz/60Y+W6wYAALC7CYABAKAZ++UvfznirLPOuq64uNj3gZupmpqaWL9+/T//qaioiMrKyqisrIxNmzZFY2OjJn2AgoKCaN++fbRr1y7at28fHTt2jC5dukSnTp2ic+fOUVxcrEnN1NatW98aP378PVdcccXLugEAAOwpAmAAAGjm2rVrl//ggw+eOWLEiCsLCwvb6gjvtHnz5n+GwZs2bYrKysqorq6OLVu2xJYtW6K6ujqqq6sjk8nk3NpTqVS0bt06WrduHWVlZdGmTZsoLS39X2Fvu3btok2bNh4U/peGhobKl1566efnnHPO+OrqavevAwAAe5QAGAAAiIiIoUOHFt97770XHHjggRfk5+c7ssiHlk6n/xkEV1dXR01Nzfv+k8lkora2NtLpdNTX10dTU1PU1dXt0u8U5+XlRcuWLSM/Pz+KiooiLy8vWrVqFalUKoqLi3f6T0lJSbRq1eqfgW9paWnk5eUZMB9aU1NTzYIFC/745S9/+Y+zZ8+u0REAAGBvEAADAAD/y2mnndb2rrvuurRPnz5n5+XlFeoIe9LbgfDbtm/f/r7XUBcUFESLFi3++b/fDnxhT8pkMg1LliwZd8stt/xq0qRJVToCAADsTQJgAABgp0477bS2d95554X777//5wTBAP9XJpNpWLhw4QO33nrrHwS/AABAtni/ADi/7UHRc2c/SG+LqC33/gcAAHLZokWL6u69995X0un0swcddFCnkpKS3roC8A8VFRUz/7//7/+77aKLLpq6aNGiOh0BAACyRXH3xsgr3fnPBMAAAEDMnDmz8u67736qqalpWr9+/Ypbt27dN5VKpXQGaG4ymUx6zZo1U+65555/Peeccx6cOXNmpa4AAADZRgAMAAB8KDNnzqz88Y9//Gw6nZ4uCAaak7eD37vvvvtfzz///McEvwAAQDYTAAMAAB+JIBhoLgS/AABAEgmAAQCAj+XtILisrOyFvn37diwuLu4VEYJgIBdkKioqnrv33nu/PWbMmEcEvwAAQJK8XwCc2vecGLGzHzSui9j4aivdAwAA/unqq6/u8ZWvfOX8Pn36nJWXl9dCR4CkSafT9UuXLh3/X//1Xw/84he/WKMjAABAEnUYVhsFXXb+MwEwAADwkZ1xxhntb7/99rMPPPDA8/Pz81vrCJDtmpqaqhcsWPDgd77znUcmTpzotC8AAJBoAmAAAGC3GD58eMkPf/jDzwwePPjioqKijjoCZJv6+voNr7322u9vvPHGx2fPnl2jIwAAQC4QAAMAALvV0KFDi++5556zDjnkkPOKioq66giwt9XV1a19/fXXH7z++uvHC34BAIBcIwAGAAD2iFatWuXdc889w0455ZTzO3bseJSOAHtYZsOGDbOmTJny4PXXX/9qbW1tWksAAIBcJAAGAAD2uH/913/tf/7555/dq1ev0/Ly8lroCLC7pNPp+pUrV05+4IEHHvnOd76zSEcAAIBcJwAGAAD2mjPOOKP97bfffvYBBxzw2YKCgjY6AuwqjY2NVW+++eafv/e97z06YcKETToCAAA0FwJgAABgrxs+fHjJ97///dGDBg0aU1paur+OAB9XdXX1wtdee+3Rr371q1Nfe+21Wh0BAACaGwEwAACQVb761a/ue8EFF3y6b9++ZxUUFLTWEeCDNDY2bnnrrbfG/+EPf5j4ox/9aLmOAAAAzZkAGAAAyEpDhw4t/sEPfnDy4MGDz27dunV/HQHerbq6+s2XX375weuuu+7ppUuXbtcRAAAAATAAAJDlCgsLU3ffffeQ0aNHn9G1a9fj8vLyinQFmq90Ol1XXl4+bcqUKROuvfbav+sIAADA/yYABgAAEqNPnz4t/v3f/33UyJEjz2rfvv2nIiKlK9AsZDZt2vTXF1544bGvfe1rzzntCwAA8N4EwAAAQCJddNFFXa6++uqTDzzwwLNbtmzZTUcg99TV1a1ZsGDBuJ/+9KdP3n///et0BAAA4IMJgAEAgETr1q1b4d13333k4YcffmqHDh2OyMvLK9QVSK50Ot2wcePGWbNmzZp8/fXXz6qoqGjUFQAAgA9PAAwAAOSMo48+uvWtt956/CGHHHJKu3btBkdEnq5AIqQrKytfmzdv3uQ777xz+owZM6q1BAAA4OMRAAMAADnpuOOOK/vGN75x/CGHHHJa27ZtB4bvBUO2yVRVVc2dN2/epO9///vTpk+fvkVLAAAAPjkBMAAAkPNuu+22vmedddZJffr0Oa5Vq1a9dQT2ntra2uXLly+f/uijjz51xx13vKUjAAAAu5YAGAAAaFa+9KUvdbv44ouP7t+//wlOBsMekamqqpq7cOHCv/z+97+fcd9995VrCQAAwO4jAAYAAJqtSy65pOtll112jDAYdrl0VVXVvIULF/7lV7/61bO/+93v1moJAADAniEABgAAiIirr766x/nnnz9q//33P7JNmzZDUqlUga7Ah5fJZBoqKyv/vnjx4uf+9Kc/zbr33ntX6woAAMCeJwAGAAB4l379+hV97WtfGzRy5MhRPXv2PLaoqKizrsD/VV9fv37VqlXPvPDCC8/9+7//+5zFixfX6woAAMDeJQAGAAB4H61bt8678847Bx599NFHde/efURpaen+4apomq/M1q1bF69Zs+bF5557btY3v/nNOdXV1WltAQAAyB4CYAAAgI9g8ODBrcaOHXvI8OHDD+vevfvw1q1bHxACYXJXprq6+s01a9a88sorr7z8k5/8ZN5rr71Wqy0AAADZSwAMAADwCVx//fX7nHHGGYf169dvePv27Yfm5+e31hWSrLGxsXrjxo2vvvXWWy+PHz/+lR//+McrdQUAACA5BMAAAAC70Je//OUe55xzzvA+ffoM7tix45CioqKuukI2q6+vX7t27doXFy9ePGfixImv3Xvvvat1BQAAILkEwAAAALvRl7/85R6f+cxnBvfr129Qly5dDm/ZsqVAmL2qrq5u7bp16wS+AAAAOUoADAAAsIe0atUq75prrtnn2GOPPXi//fY7uH379oeUlpb2TaVS+brDbpKuqalZtnHjxnlvvfXW3GeffXbef/3Xfy2vra1Naw0AAEBuEgADAADsRQceeGDLq6+++oAhQ4Yc3LNnz4Pbtm17sGuj+biampqqq6qqXi8vL583Z86ceb/85S/nvfjii1t1BgAAoPkQAAMAAGSZoUOHFn/xi1/cf9CgQQf26NHjwHbt2h3YqlWr3qlUKk932CFdU1OzvLKycsHq1asXzJkzZ8Gf//znJTNmzKjWGgAAgOZNAAwAAJAAxx13XNkFF1xw4MEHH3xA165dDywtLd23pKRkn1QqVag7uS2TyTRs27ZtRXV19dJ169YtfOONNxZOmDBh4YQJEzbpDgAAAO8mAAYAAEiw8847r+OJJ57Yp3///vt16dKlT5s2bfZr3bp1v/z8/GLdSZampqaa6urqxZs3b16ybt26pQsXLlzy9NNPL33ooYc26A4AAAAflgAYAAAgx7Rr1y7/kksu6TFkyJCe++67b89OnTr1Kisr61VcXNyzZcuW3VKpVL4u7R2ZTKaprq6uvKamZtWWLVtWVlRUrFy6dOnK2bNnr7r//vvXVFZWNukSAAAAn4QAGAAAoBnp1KlTwec+97luQ4cO7bnPPvv0aNeuXafWrVt3Li4u7tqyZcvORUVFnfLy8lro1MeTTqe319fXr6+rq6uoqalZW11dvb6ysnL9ihUrVr/66qurHnzwwbUVFRWNOgUAAMDuIgAGAADgfznjjDPaH3bYYZ369OnTuUuXLp3Kysral5SUtC0uLu5YVFTUrqioqG2LFi065OfnlzaXnjQ1NW3dvn37xvr6+qr6+vrKmpqaDdu2bavasmXLpnXr1lUsXbp0/Ysvvrh+4sSJlZ4gAAAA9iYBMAAAAB9Lr169CkeNGtXuoIMOatexY8ey9u3bl7Zp06Z1SUlJWXFxcetWrVq1btGiRVlRUVHrwsLC1hGRX1hYWBoR+QUFBSV5eXkFeXl5u/0/LtPpdG06nW5sbGzcFhFNDQ0NW3f83+r6+vrq7du3b6mtra2uqamp3rZtW/XmzZurN23aVL1hw4YtCxYsqJo1a1bl0qVLt5s4AAAASSAABgAAYK/q169fUffu3Vvss88+xSUlJQVv//8LCwtT3bp1+8BTxuXl5VsbGhoyb//vbdu2Na5YsaJmzZo12xcvXlyvwwAAADQn7xcAF2gPAAAAu9vixYvrdwS11boBAAAAu0+eFgAAAAAAAADkBgEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4o0AIAAAAAAACA5GhoLIyCxoaIiEilIpNXGE1v/0wADAAAAAAAAJAghQUN/0x6MxGppvT/5L6ugAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAIb/v5272ZHiusM4/FZ1NUkz9sQwOF4EyZJtpJCwysa5jSy4n1xPEqRIuQFvvfGSgIwBOzGRQAQERnx0d1UW0cgWGvKxsMGvnmfVdc7/1OJsf+oCAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoMY3JP//9K8My551lzpAk293a7QAAAAAAAAD8iIw3r+SL7TpPxuSt4/ibJJuz20QDBgAAAAAAAHhzrJPp6NvHYcyyjLl7dJTPbl/Jp6sPLufSsM+5ec7q5YOrF0OeP/SVaAAAAAAAAIA3weH7u6zfm79dWDIMSw6225w785vsx3XyzasOby5ssz69c4sAAAAAAAAAr9n69C6bC9sT93a7rKdnORin5Otxynzi1JQcfiwCAwAAAAAAALxO69O7HH68TaaT98cp85R8vbp3Nfszv8q0LHn7xMF1sjk/ZzUPmZ/MmWefhAYAAAAAAAD4oayPdjn7223Gn7x6ZrXPnetX8mBKkpv3cufDd/Pufn5FL56SzcVtNheT3dNt8tQlAwAAAAAAAHyv1sm0ySv/9XtsNWZ3I/lHkgzHi7/4XY7WYz5yiwAAAAAAAAA/Ivtcv/3nPEyS1fHa42t5+vNLyX7JoRsCAAAAAAAAePPt1/nbV3/KvePn1Xc371/NYxEYAAAAAAAA4M0yTHk2rvNo2WdzvHZqzN9v/SF3vju3evng/at5fPDLPDu1yuGyZHSVAAAAAAAAAK/XOGe4ueSvZ4e8M8xZbVe5ceuPufvy3Oqkw4+v5emDX+fuuTlLhhwsEYIBAAAAAAAAXpclGR8OuXP0TR4cPM/9z/+SRyfNDf/1TZezOp/87KdjzizJZkhO7edMy/w/nAUAAAAAAADg/zaMWcZkP8/ZLsmLacr2/MV8+cnvs/tP5/4FmLjAq1ifcioAAAAASUVORK5CYII=";function H0($,q,Q){if(typeof $==="string"&&!isNaN(Number($)))$=Number($);if(typeof $==="number"&&$<100)return v0($);if(typeof $==="number"&&$>=100)return $;if(typeof $==="string"&&$.includes("%")){if(q&&q==="X")return Math.round(parseFloat($)/100*Q.width);if(q&&q==="Y")return Math.round(parseFloat($)/100*Q.height);return Math.round(parseFloat($)/100*Q.width)}return 0}function k5($){return $.replace(/[xy]/g,function(q){let Q=Math.random()*16|0;return(q==="x"?Q:Q&3|8).toString(16)})}function k0($){if(typeof $>"u"||$==null)return"";return $.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function v0($){if(typeof $==="number"&&$>100)return $;if(typeof $==="string")$=Number($.replace(/in*/gi,""));return Math.round(L0*$)}function Y0($){let q=Number($)||0;return isNaN(q)?0:Math.round(q*w8)}function S1($){return $=$||0,Math.round(($>360?$-360:$)*60000)}function g7($){let q=$.toString(16);return q.length===1?"0"+q:q}function A7($,q,Q){return(g7($)+g7(q)+g7(Q)).toUpperCase()}function R0($,q){let Q=($||"").replace("#","");if(!j7.test(Q)&&Q!==G2.background1&&Q!==G2.background2&&Q!==G2.text1&&Q!==G2.text2&&Q!==G2.accent1&&Q!==G2.accent2&&Q!==G2.accent3&&Q!==G2.accent4&&Q!==G2.accent5&&Q!==G2.accent6)console.warn(`"${Q}" is not a valid scheme color or hex RGB! "${Q2}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`),Q=Q2;let K=j7.test(Q)?"srgbClr":"schemeClr",J='val="'+(j7.test(Q)?Q.toUpperCase():Q)+'"';return q?`${q}`:``}function AB($,q){let Q="",K=Object.assign(Object.assign({},q),$),J=Math.round(K.size*w8),Z=K.color,G=Math.round(K.opacity*1e5);return Q+=``,Q+=R0(Z,``),Q+="",Q}function B2($){let q="solid",Q="",K="",J="";if($){if(typeof $==="string")Q=$;else{if($.type)q=$.type;if($.color)Q=$.color;if($.alpha)K+=``;if($.transparency)K+=``}switch(q){case"solid":J+=`${R0(Q,K)}`;break;default:J+="";break}}return J}function a2($){return $._rels.length+$._relsChart.length+$._relsMedia.length+1}function b7($){if(!$||typeof $!=="object")return;if($.type!=="outer"&&$.type!=="inner"&&$.type!=="none")console.warn("Warning: shadow.type options are `outer`, `inner` or `none`."),$.type="outer";if($.angle){if(isNaN(Number($.angle))||$.angle<0||$.angle>359)console.warn("Warning: shadow.angle can only be 0-359"),$.angle=270;$.angle=Math.round(Number($.angle))}if($.opacity){if(isNaN(Number($.opacity))||$.opacity<0||$.opacity>1)console.warn("Warning: shadow.opacity can only be 0-1"),$.opacity=0.75;$.opacity=Number($.opacity)}if($.color){if($.color.startsWith("#"))console.warn('Warning: shadow.color should not include hash (#) character, , e.g. "FF0000"'),$.color=$.color.replace("#","")}return $}function XB($,q,Q){var K,J;let Z=2.3+(((K=$.options)===null||K===void 0?void 0:K.autoPageCharWeight)?$.options.autoPageCharWeight:0),G=Math.floor(q/w8*L0)/((((J=$.options)===null||J===void 0?void 0:J.fontSize)?$.options.fontSize:k2)/Z),W=[],B=[],V=[],U=[];if($.text&&$.text.toString().trim().length===0)B.push({_type:D0.tablecell,text:" "});else if(typeof $.text==="number"||typeof $.text==="string")B.push({_type:D0.tablecell,text:($.text||"").toString().trim()});else if(Array.isArray($.text))B=$.text;let w=[];return B.forEach((F)=>{var M;if(typeof F.text==="string"){if(F.text.split(` +`,"\t"],wW=["{","}","|","\\","^","`"].concat(MW),Y7=["'"].concat(wW),yK=["%","/","?",";","#"].concat(Y7),hK=["/","?","#"],xK=/^[+a-z0-9A-Z_-]{0,63}$/,YW=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kW={javascript:!0,"javascript:":!0},k7={javascript:!0,"javascript:":!0},k6={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},D7={parse($){var q=decodeURIComponent;return($+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(Q,K,J){var Z=K.split("="),G=q(Z[0]||""),W=q(Z[1]||""),B=Q[G];return Q[G]=B===void 0?W:[].concat(B,W),Q},{})},stringify($){var q=encodeURIComponent;return Object.keys($||{}).reduce(function(Q,K){return[].concat($[K]).forEach(function(J){Q.push(q(K)+"="+q(J))}),Q},[]).join("&").replace(/\s/g,"+")}};Z2.prototype.parse=function($,q,Q){if(!H7($))throw TypeError("Parameter 'url' must be a string, not "+typeof $);var K=$.indexOf("?"),J=K!==-1&&K<$.indexOf("#")?"?":"#",Z=$.split(J),G=/\\/g;Z[0]=Z[0].replace(G,"/"),$=Z.join(J);var W=$;if(W=W.trim(),!Q&&$.split("#").length===1){var B=FW.exec(W);if(B){if(this.path=W,this.href=W,this.pathname=B[1],B[2])if(this.search=B[2],q)this.query=D7.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(q)this.search="",this.query={};return this}}var V=BW.exec(W);if(V){V=V[0];var U=V.toLowerCase();this.protocol=U,W=W.substr(V.length)}if(Q||V||W.match(/^\/\/[^@\/]+@[^@\/]+/)){var w=W.substr(0,2)==="//";if(w&&!(V&&k7[V]))W=W.substr(2),this.slashes=!0}if(!k7[V]&&(w||V&&!k6[V])){var F=-1;for(var M=0;M127)v+="x";else v+=H[j];if(!v.match(xK)){var d=z.slice(0,M),_=z.slice(M+1),X=H.match(YW);if(X)d.push(X[1]),_.unshift(X[2]);if(_.length)W="/"+_.join(".")+W;this.hostname=d.join(".");break}}}}if(this.hostname.length>NW)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!D)this.hostname=new L7(`https://${this.hostname}`).hostname;var P=this.port?":"+this.port:"",g=this.hostname||"";if(this.host=g+P,this.href+=this.host,D){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),W[0]!=="/")W="/"+W}}if(!kW[U])for(var M=0,N=Y7.length;M0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(Q.search=$.search,Q.query=$.query,!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.href=Q.format(),Q}if(!z.length){if(Q.pathname=null,Q.search)Q.path="/"+Q.search;else Q.path=null;return Q.href=Q.format(),Q}var j=z.slice(-1)[0],n=(Q.host||$.host||z.length>1)&&(j==="."||j==="..")||j==="",d=0;for(var _=z.length;_>=0;_--)if(j=z[_],j===".")z.splice(_,1);else if(j==="..")z.splice(_,1),d++;else if(d)z.splice(_,1),d--;if(!L&&!D)for(;d--;d)z.unshift("..");if(L&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/"))z.unshift("");if(n&&z.join("/").substr(-1)!=="/")z.push("");var X=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){Q.hostname=Q.host=X?"":z.length?z.shift():"";var v=Q.host&&Q.host.indexOf("@")>0?Q.host.split("@"):!1;if(v)Q.auth=v.shift(),Q.host=Q.hostname=v.shift()}if(L=L||Q.host&&z.length,L&&!X)z.unshift("");if(!z.length)Q.pathname=null,Q.path=null;else Q.pathname=z.join("/");if(!w5(Q.pathname)||!w5(Q.search))Q.path=(Q.pathname?Q.pathname:"")+(Q.search?Q.search:"");return Q.auth=$.auth||Q.auth,Q.slashes=Q.slashes||$.slashes,Q.href=Q.format(),Q};Z2.prototype.parseHost=function(){var $=this.host,q=zW.exec($);if(q){if(q=q[0],q!==":")this.port=q.substr(1);$=$.substr(0,$.length-q.length)}if($)this.hostname=$};DW={parse:D6,resolve:uK,resolveObject:SK,format:TK,Url:Z2,URL:L7,URLSearchParams:OK}});var I7={};c1(I7,{request:()=>uW,globalAgent:()=>bW,get:()=>SW,default:()=>mW,STATUS_CODES:()=>nW,METHODS:()=>dW,IncomingMessage:()=>_W,ClientRequest:()=>EW,Agent:()=>cW});var LW,HW,EK,vW,fW,RW=($,q,Q)=>{Q=$!=null?LW(HW($)):{};let K=q||!$||!$.__esModule?EK(Q,"default",{value:$,enumerable:!0}):Q;for(let J of vW($))if(!fW.call(K,J))EK(K,J,{get:()=>$[J],enumerable:!0});return K},h0=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),cK,IW,x1,CW,bK,O1,nK,jW,dK,L6,gW,_K,R7,AW,XW,mK,pK,yW,hW,iK,oK,xW,OW,PW,TW,aK,uW,SW,EW,_W,cW,bW,nW,dW,mW;var C7=b1(()=>{LW=Object.create,{getPrototypeOf:HW,defineProperty:EK,getOwnPropertyNames:vW}=Object,fW=Object.prototype.hasOwnProperty,cK=h0(($)=>{$.fetch=J(globalThis.fetch)&&J(globalThis.ReadableStream),$.writableStream=J(globalThis.WritableStream),$.abortController=J(globalThis.AbortController);var q;function Q(){if(q!==void 0)return q;if(globalThis.XMLHttpRequest){q=new globalThis.XMLHttpRequest;try{q.open("GET",globalThis.XDomainRequest?"/":"https://example.com")}catch(Z){q=null}}else q=null;return q}function K(Z){var G=Q();if(!G)return!1;try{return G.responseType=Z,G.responseType===Z}catch(W){}return!1}$.arraybuffer=$.fetch||K("arraybuffer"),$.msstream=!$.fetch&&K("ms-stream"),$.mozchunkedarraybuffer=!$.fetch&&K("moz-chunked-arraybuffer"),$.overrideMimeType=$.fetch||(Q()?J(Q().overrideMimeType):!1);function J(Z){return typeof Z==="function"}q=null}),IW=h0(($,q)=>{if(typeof Object.create==="function")q.exports=function(Q,K){if(K)Q.super_=K,Q.prototype=Object.create(K.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else q.exports=function(Q,K){if(K){Q.super_=K;var J=function(){};J.prototype=K.prototype,Q.prototype=new J,Q.prototype.constructor=Q}}}),x1=h0(($,q)=>{try{if(Q=(G8(),X0(Z8)),typeof Q.inherits!=="function")throw"";q.exports=Q.inherits}catch(K){q.exports=IW()}var Q}),CW=h0(($,q)=>{function Q(L,D){var z=Object.keys(L);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(L);D&&(N=N.filter(function(H){return Object.getOwnPropertyDescriptor(L,H).enumerable})),z.push.apply(z,N)}return z}function K(L){for(var D=1;D0)this.tail.next=z;else this.head=z;this.tail=z,++this.length}},{key:"unshift",value:function(D){var z={data:D,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var D=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,D}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(D){if(this.length===0)return"";var z=this.head,N=""+z.data;while(z=z.next)N+=D+z.data;return N}},{key:"concat",value:function(D){if(this.length===0)return w.alloc(0);var z=w.allocUnsafe(D>>>0),N=this.head,H=0;while(N)f(N.data,z,H),H+=N.data.length,N=N.next;return z}},{key:"consume",value:function(D,z){var N;if(Dv.length?v.length:D;if(j===v.length)H+=v;else H+=v.slice(0,D);if(D-=j,D===0){if(j===v.length)if(++N,z.next)this.head=z.next;else this.head=this.tail=null;else this.head=z,z.data=v.slice(j);break}++N}return this.length-=N,H}},{key:"_getBuffer",value:function(D){var z=w.allocUnsafe(D),N=this.head,H=1;N.data.copy(z),D-=N.data.length;while(N=N.next){var v=N.data,j=D>v.length?v.length:D;if(v.copy(z,z.length-D,0,j),D-=j,D===0){if(j===v.length)if(++H,N.next)this.head=N.next;else this.head=this.tail=null;else this.head=N,N.data=v.slice(j);break}++H}return this.length-=H,z}},{key:k,value:function(D,z){return M(this,K(K({},z),{},{depth:0,customInspect:!1}))}}]),L}()}),bK=h0(($,q)=>{function Q(B,V){var U=this,w=this._readableState&&this._readableState.destroyed,F=this._writableState&&this._writableState.destroyed;if(w||F){if(V)V(B);else if(B){if(!this._writableState)process.nextTick(G,this,B);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,process.nextTick(G,this,B)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(B||null,function(M){if(!V&&M)if(!U._writableState)process.nextTick(K,U,M);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,process.nextTick(K,U,M);else process.nextTick(J,U);else if(V)process.nextTick(J,U),V(M);else process.nextTick(J,U)}),this}function K(B,V){G(B,V),J(B)}function J(B){if(B._writableState&&!B._writableState.emitClose)return;if(B._readableState&&!B._readableState.emitClose)return;B.emit("close")}function Z(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function G(B,V){B.emit("error",V)}function W(B,V){var{_readableState:U,_writableState:w}=B;if(U&&U.autoDestroy||w&&w.autoDestroy)B.destroy(V);else B.emit("error",V)}q.exports={destroy:Q,undestroy:Z,errorOrDestroy:W}}),O1=h0(($,q)=>{var Q={};function K(B,V,U){if(!U)U=Error;function w(M,k,f){if(typeof V==="string")return V;else return V(M,k,f)}class F extends U{constructor(M,k,f){super(w(M,k,f))}}F.prototype.name=U.name,F.prototype.code=B,Q[B]=F}function J(B,V){if(Array.isArray(B)){let U=B.length;if(B=B.map((w)=>String(w)),U>2)return`one of ${V} ${B.slice(0,U-1).join(", ")}, or `+B[U-1];else if(U===2)return`one of ${V} ${B[0]} or ${B[1]}`;else return`of ${V} ${B[0]}`}else return`of ${V} ${String(B)}`}function Z(B,V,U){return B.substr(!U||U<0?0:+U,V.length)===V}function G(B,V,U){if(U===void 0||U>B.length)U=B.length;return B.substring(U-V.length,U)===V}function W(B,V,U){if(typeof U!=="number")U=0;if(U+V.length>B.length)return!1;else return B.indexOf(V,U)!==-1}K("ERR_INVALID_OPT_VALUE",function(B,V){return'The value "'+V+'" is invalid for option "'+B+'"'},TypeError),K("ERR_INVALID_ARG_TYPE",function(B,V,U){let w;if(typeof V==="string"&&Z(V,"not "))w="must not be",V=V.replace(/^not /,"");else w="must be";let F;if(G(B," argument"))F=`The ${B} ${w} ${J(V,"type")}`;else{let M=W(B,".")?"property":"argument";F=`The "${B}" ${M} ${w} ${J(V,"type")}`}return F+=`. Received type ${typeof U}`,F},TypeError),K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),K("ERR_METHOD_NOT_IMPLEMENTED",function(B){return"The "+B+" method is not implemented"}),K("ERR_STREAM_PREMATURE_CLOSE","Premature close"),K("ERR_STREAM_DESTROYED",function(B){return"Cannot call "+B+" after a stream was destroyed"}),K("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),K("ERR_STREAM_WRITE_AFTER_END","write after end"),K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),K("ERR_UNKNOWN_ENCODING",function(B){return"Unknown encoding: "+B},TypeError),K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$.codes=Q}),nK=h0(($,q)=>{var Q=O1().codes.ERR_INVALID_OPT_VALUE;function K(Z,G,W){return Z.highWaterMark!=null?Z.highWaterMark:G?Z[W]:null}function J(Z,G,W,B){var V=K(G,B,W);if(V!=null){if(!(isFinite(V)&&Math.floor(V)===V)||V<0){var U=B?W:"highWaterMark";throw new Q(U,V)}return Math.floor(V)}return Z.objectMode?16:16384}q.exports={getHighWaterMark:J}}),jW=h0(($,q)=>{q.exports=(G8(),X0(Z8)).deprecate}),dK=h0(($,q)=>{q.exports=X;function Q(S){var b=this;this.next=null,this.entry=null,this.finish=function(){w0(b,S)}}var K;X.WritableState=d;var J={deprecate:jW()},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(S){return G.from(S)}function V(S){return G.isBuffer(S)||S instanceof W}var U=bK(),w=nK(),F=w.getHighWaterMark,M=O1().codes,k=M.ERR_INVALID_ARG_TYPE,f=M.ERR_METHOD_NOT_IMPLEMENTED,L=M.ERR_MULTIPLE_CALLBACK,D=M.ERR_STREAM_CANNOT_PIPE,z=M.ERR_STREAM_DESTROYED,N=M.ERR_STREAM_NULL_VALUES,H=M.ERR_STREAM_WRITE_AFTER_END,v=M.ERR_UNKNOWN_ENCODING,j=U.errorOrDestroy;x1()(X,Z);function n(){}function d(S,b,O){if(K=K||L6(),S=S||{},typeof O!=="boolean")O=b instanceof K;if(this.objectMode=!!S.objectMode,O)this.objectMode=this.objectMode||!!S.writableObjectMode;this.highWaterMark=F(this,S,"writableHighWaterMark",O),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var E=S.decodeStrings===!1;this.decodeStrings=!E,this.defaultEncoding=S.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){Z0(b,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=S.emitClose!==!1,this.autoDestroy=!!S.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Q(this)}d.prototype.getBuffer=function(){var S=this.bufferedRequest,b=[];while(S)b.push(S),S=S.next;return b},function(){try{Object.defineProperty(d.prototype,"buffer",{get:J.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(S){}}();var _;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")_=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(S){if(_.call(this,S))return!0;if(this!==X)return!1;return S&&S._writableState instanceof d}});else _=function(S){return S instanceof this};function X(S){K=K||L6();var b=this instanceof K;if(!b&&!_.call(X,this))return new X(S);if(this._writableState=new d(S,this,b),this.writable=!0,S){if(typeof S.write==="function")this._write=S.write;if(typeof S.writev==="function")this._writev=S.writev;if(typeof S.destroy==="function")this._destroy=S.destroy;if(typeof S.final==="function")this._final=S.final}Z.call(this)}X.prototype.pipe=function(){j(this,new D)};function P(S,b){var O=new H;j(S,O),process.nextTick(b,O)}function g(S,b,O,E){var a;if(O===null)a=new N;else if(typeof O!=="string"&&!b.objectMode)a=new k("chunk",["string","Buffer"],O);if(a)return j(S,a),process.nextTick(E,a),!1;return!0}X.prototype.write=function(S,b,O){var E=this._writableState,a=!1,K0=!E.objectMode&&V(S);if(K0&&!G.isBuffer(S))S=B(S);if(typeof b==="function")O=b,b=null;if(K0)b="buffer";else if(!b)b=E.defaultEncoding;if(typeof O!=="function")O=n;if(E.ending)P(this,O);else if(K0||g(this,E,S,O))E.pendingcb++,a=h(this,E,K0,S,b,O);return a},X.prototype.cork=function(){this._writableState.corked++},X.prototype.uncork=function(){var S=this._writableState;if(S.corked){if(S.corked--,!S.writing&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest)W0(this,S)}},X.prototype.setDefaultEncoding=function(S){if(typeof S==="string")S=S.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((S+"").toLowerCase())>-1))throw new v(S);return this._writableState.defaultEncoding=S,this},Object.defineProperty(X.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function c(S,b,O){if(!S.objectMode&&S.decodeStrings!==!1&&typeof b==="string")b=G.from(b,O);return b}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function h(S,b,O,E,a,K0){if(!O){var R=c(b,E,a);if(E!==R)O=!0,a="buffer",E=R}var Y=b.objectMode?1:E.length;b.length+=Y;var C=b.length{var Q=Object.keys||function(w){var F=[];for(var M in w)F.push(M);return F};q.exports=B;var K=mK(),J=dK();x1()(B,K);{Z=Q(J.prototype);for(W=0;W{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var Q=(t0(),X0(K2)),K=Q.Buffer;function J(G,W){for(var B in G)W[B]=G[B]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)q.exports=Q;else J(Q,$),$.Buffer=Z;function Z(G,W,B){return K(G,W,B)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,W,B){if(typeof G==="number")throw TypeError("Argument must not be a number");return K(G,W,B)},Z.alloc=function(G,W,B){if(typeof G!=="number")throw TypeError("Argument must be a number");var V=K(G);if(W!==void 0)if(typeof B==="string")V.fill(W,B);else V.fill(W);else V.fill(0);return V},Z.allocUnsafe=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw TypeError("Argument must be a number");return Q.SlowBuffer(G)}}),_K=h0(($)=>{var q=gW().Buffer,Q=q.isEncoding||function(z){switch(z=""+z,z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function K(z){if(!z)return"utf8";var N;while(!0)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(N)return;z=(""+z).toLowerCase(),N=!0}}function J(z){var N=K(z);if(typeof N!=="string"&&(q.isEncoding===Q||!Q(z)))throw Error("Unknown encoding: "+z);return N||z}$.StringDecoder=Z;function Z(z){this.encoding=J(z);var N;switch(this.encoding){case"utf16le":this.text=F,this.end=M,N=4;break;case"utf8":this.fillLast=V,N=4;break;case"base64":this.text=k,this.end=f,N=3;break;default:this.write=L,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q.allocUnsafe(N)}Z.prototype.write=function(z){if(z.length===0)return"";var N,H;if(this.lastNeed){if(N=this.fillLast(z),N===void 0)return"";H=this.lastNeed,this.lastNeed=0}else H=0;if(H>5===6)return 2;else if(z>>4===14)return 3;else if(z>>3===30)return 4;return z>>6===2?-1:-2}function W(z,N,H){var v=N.length-1;if(v=0){if(j>0)z.lastNeed=j-1;return j}if(--v=0){if(j>0)z.lastNeed=j-2;return j}if(--v=0){if(j>0)if(j===2)j=0;else z.lastNeed=j-3;return j}return 0}function B(z,N,H){if((N[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&N.length>1){if((N[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&N.length>2){if((N[2]&192)!==128)return z.lastNeed=2,"�"}}}function V(z){var N=this.lastTotal-this.lastNeed,H=B(this,z,N);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,N,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,N,0,z.length),this.lastNeed-=z.length}function U(z,N){var H=W(this,z,N);if(!this.lastNeed)return z.toString("utf8",N);this.lastTotal=H;var v=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,v),z.toString("utf8",N,v)}function w(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+"�";return N}function F(z,N){if((z.length-N)%2===0){var H=z.toString("utf16le",N);if(H){var v=H.charCodeAt(H.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],H.slice(0,-1)}return H}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",N,z.length-1)}function M(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return N+this.lastChar.toString("utf16le",0,H)}return N}function k(z,N){var H=(z.length-N)%3;if(H===0)return z.toString("base64",N);if(this.lastNeed=3-H,this.lastTotal=3,H===1)this.lastChar[0]=z[z.length-1];else this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1];return z.toString("base64",N,z.length-H)}function f(z){var N=z&&z.length?this.write(z):"";if(this.lastNeed)return N+this.lastChar.toString("base64",0,3-this.lastNeed);return N}function L(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),R7=h0(($,q)=>{var Q=O1().codes.ERR_STREAM_PREMATURE_CLOSE;function K(W){var B=!1;return function(){if(B)return;B=!0;for(var V=arguments.length,U=Array(V),w=0;w{var Q;function K(v,j,n){if(j=J(j),j in v)Object.defineProperty(v,j,{value:n,enumerable:!0,configurable:!0,writable:!0});else v[j]=n;return v}function J(v){var j=Z(v,"string");return typeof j==="symbol"?j:String(j)}function Z(v,j){if(typeof v!=="object"||v===null)return v;var n=v[Symbol.toPrimitive];if(n!==void 0){var d=n.call(v,j||"default");if(typeof d!=="object")return d;throw TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(v)}var G=R7(),W=Symbol("lastResolve"),B=Symbol("lastReject"),V=Symbol("error"),U=Symbol("ended"),w=Symbol("lastPromise"),F=Symbol("handlePromise"),M=Symbol("stream");function k(v,j){return{value:v,done:j}}function f(v){var j=v[W];if(j!==null){var n=v[M].read();if(n!==null)v[w]=null,v[W]=null,v[B]=null,j(k(n,!1))}}function L(v){process.nextTick(f,v)}function D(v,j){return function(n,d){v.then(function(){if(j[U]){n(k(void 0,!0));return}j[F](n,d)},d)}}var z=Object.getPrototypeOf(function(){}),N=Object.setPrototypeOf((Q={get stream(){return this[M]},next:function(){var v=this,j=this[V];if(j!==null)return Promise.reject(j);if(this[U])return Promise.resolve(k(void 0,!0));if(this[M].destroyed)return new Promise(function(X,P){process.nextTick(function(){if(v[V])P(v[V]);else X(k(void 0,!0))})});var n=this[w],d;if(n)d=new Promise(D(n,this));else{var _=this[M].read();if(_!==null)return Promise.resolve(k(_,!1));d=new Promise(this[F])}return this[w]=d,d}},K(Q,Symbol.asyncIterator,function(){return this}),K(Q,"return",function(){var v=this;return new Promise(function(j,n){v[M].destroy(null,function(d){if(d){n(d);return}j(k(void 0,!0))})})}),Q),z),H=function(v){var j,n=Object.create(N,(j={},K(j,M,{value:v,writable:!0}),K(j,W,{value:null,writable:!0}),K(j,B,{value:null,writable:!0}),K(j,V,{value:null,writable:!0}),K(j,U,{value:v._readableState.endEmitted,writable:!0}),K(j,F,{value:function(d,_){var X=n[M].read();if(X)n[w]=null,n[W]=null,n[B]=null,d(k(X,!1));else n[W]=d,n[B]=_},writable:!0}),j));return n[w]=null,G(v,function(d){if(d&&d.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=n[B];if(_!==null)n[w]=null,n[W]=null,n[B]=null,_(d);n[V]=d;return}var X=n[W];if(X!==null)n[w]=null,n[W]=null,n[B]=null,X(k(void 0,!0));n[U]=!0}),v.on("readable",L.bind(null,n)),n};q.exports=H}),XW=h0(($,q)=>{function Q(w,F,M,k,f,L,D){try{var z=w[L](D),N=z.value}catch(H){M(H);return}if(z.done)F(N);else Promise.resolve(N).then(k,f)}function K(w){return function(){var F=this,M=arguments;return new Promise(function(k,f){var L=w.apply(F,M);function D(N){Q(L,k,f,D,z,"next",N)}function z(N){Q(L,k,f,D,z,"throw",N)}D(void 0)})}}function J(w,F){var M=Object.keys(w);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(w);F&&(k=k.filter(function(f){return Object.getOwnPropertyDescriptor(w,f).enumerable})),M.push.apply(M,k)}return M}function Z(w){for(var F=1;F{q.exports=g;var Q;g.ReadableState=P;var K=(i1(),X0(p1)).EventEmitter,J=function(R,Y){return R.listeners(Y).length},Z=a1(),G=(t0(),X0(K2)).Buffer,W=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function B(R){return G.from(R)}function V(R){return G.isBuffer(R)||R instanceof W}var U=(G8(),X0(Z8)),w;if(U&&U.debuglog)w=U.debuglog("stream");else w=function(){};var F=CW(),M=bK(),k=nK(),f=k.getHighWaterMark,L=O1().codes,D=L.ERR_INVALID_ARG_TYPE,z=L.ERR_STREAM_PUSH_AFTER_EOF,N=L.ERR_METHOD_NOT_IMPLEMENTED,H=L.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,j,n;x1()(g,Z);var d=M.errorOrDestroy,_=["error","close","destroy","pause","resume"];function X(R,Y,C){if(typeof R.prependListener==="function")return R.prependListener(Y,C);if(!R._events||!R._events[Y])R.on(Y,C);else if(Array.isArray(R._events[Y]))R._events[Y].unshift(C);else R._events[Y]=[C,R._events[Y]]}function P(R,Y,C){if(Q=Q||L6(),R=R||{},typeof C!=="boolean")C=Y instanceof Q;if(this.objectMode=!!R.objectMode,C)this.objectMode=this.objectMode||!!R.readableObjectMode;if(this.highWaterMark=f(this,R,"readableHighWaterMark",C),this.buffer=new F,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.destroyed=!1,this.defaultEncoding=R.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,R.encoding){if(!v)v=_K().StringDecoder;this.decoder=new v(R.encoding),this.encoding=R.encoding}}function g(R){if(Q=Q||L6(),!(this instanceof g))return new g(R);var Y=this instanceof Q;if(this._readableState=new P(R,this,Y),this.readable=!0,R){if(typeof R.read==="function")this._read=R.read;if(typeof R.destroy==="function")this._destroy=R.destroy}Z.call(this)}Object.defineProperty(g.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(R){if(!this._readableState)return;this._readableState.destroyed=R}}),g.prototype.destroy=M.destroy,g.prototype._undestroy=M.undestroy,g.prototype._destroy=function(R,Y){Y(R)},g.prototype.push=function(R,Y){var C=this._readableState,u;if(!C.objectMode){if(typeof R==="string"){if(Y=Y||C.defaultEncoding,Y!==C.encoding)R=G.from(R,Y),Y="";u=!0}}else u=!0;return c(this,R,Y,!1,u)},g.prototype.unshift=function(R){return c(this,R,null,!0,!1)};function c(R,Y,C,u,e){w("readableAddChunk",Y);var r=R._readableState;if(Y===null)r.reading=!1,F0(R,r);else{var s;if(!e)s=x(r,Y);if(s)d(R,s);else if(r.objectMode||Y&&Y.length>0){if(typeof Y!=="string"&&!r.objectMode&&Object.getPrototypeOf(Y)!==G.prototype)Y=B(Y);if(u)if(r.endEmitted)d(R,new H);else h(R,r,Y,!0);else if(r.ended)d(R,new z);else if(r.destroyed)return!1;else if(r.reading=!1,r.decoder&&!C)if(Y=r.decoder.write(Y),r.objectMode||Y.length!==0)h(R,r,Y,!1);else y(R,r);else h(R,r,Y,!1)}else if(!u)r.reading=!1,y(R,r)}return!r.ended&&(r.length=l)R=l;else R--,R|=R>>>1,R|=R>>>2,R|=R>>>4,R|=R>>>8,R|=R>>>16,R++;return R}function Z0(R,Y){if(R<=0||Y.length===0&&Y.ended)return 0;if(Y.objectMode)return 1;if(R!==R)if(Y.flowing&&Y.length)return Y.buffer.head.data.length;else return Y.length;if(R>Y.highWaterMark)Y.highWaterMark=$0(R);if(R<=Y.length)return R;if(!Y.ended)return Y.needReadable=!0,0;return Y.length}g.prototype.read=function(R){w("read",R),R=parseInt(R,10);var Y=this._readableState,C=R;if(R!==0)Y.emittedReadable=!1;if(R===0&&Y.needReadable&&((Y.highWaterMark!==0?Y.length>=Y.highWaterMark:Y.length>0)||Y.ended)){if(w("read: emitReadable",Y.length,Y.ended),Y.length===0&&Y.ended)E(this);else p(this);return null}if(R=Z0(R,Y),R===0&&Y.ended){if(Y.length===0)E(this);return null}var u=Y.needReadable;if(w("need readable",u),Y.length===0||Y.length-R0)e=O(R,Y);else e=null;if(e===null)Y.needReadable=Y.length<=Y.highWaterMark,R=0;else Y.length-=R,Y.awaitDrain=0;if(Y.length===0){if(!Y.ended)Y.needReadable=!0;if(C!==R&&Y.ended)E(this)}if(e!==null)this.emit("data",e);return e};function F0(R,Y){if(w("onEofChunk"),Y.ended)return;if(Y.decoder){var C=Y.decoder.end();if(C&&C.length)Y.buffer.push(C),Y.length+=Y.objectMode?1:C.length}if(Y.ended=!0,Y.sync)p(R);else if(Y.needReadable=!1,!Y.emittedReadable)Y.emittedReadable=!0,W0(R)}function p(R){var Y=R._readableState;if(w("emitReadable",Y.needReadable,Y.emittedReadable),Y.needReadable=!1,!Y.emittedReadable)w("emitReadable",Y.flowing),Y.emittedReadable=!0,process.nextTick(W0,R)}function W0(R){var Y=R._readableState;if(w("emitReadable_",Y.destroyed,Y.length,Y.ended),!Y.destroyed&&(Y.length||Y.ended))R.emit("readable"),Y.emittedReadable=!1;Y.needReadable=!Y.flowing&&!Y.ended&&Y.length<=Y.highWaterMark,b(R)}function y(R,Y){if(!Y.readingMore)Y.readingMore=!0,process.nextTick(i,R,Y)}function i(R,Y){while(!Y.reading&&!Y.ended&&(Y.length1&&K0(u.pipes,R)!==-1)&&!G0)w("false write response, pause",u.awaitDrain),u.awaitDrain++;C.pause()}}function I0(O0){if(w("onerror",O0),q2(),R.removeListener("error",I0),J(R,"error")===0)d(R,O0)}X(R,"error",I0);function m0(){R.removeListener("finish",p0),q2()}R.once("close",m0);function p0(){w("onfinish"),R.removeListener("close",m0),q2()}R.once("finish",p0);function q2(){w("unpipe"),C.unpipe(R)}if(R.emit("pipe",C),!u.flowing)w("pipe resume"),C.resume();return R};function U0(R){return function(){var Y=R._readableState;if(w("pipeOnDrain",Y.awaitDrain),Y.awaitDrain)Y.awaitDrain--;if(Y.awaitDrain===0&&J(R,"data"))Y.flowing=!0,b(R)}}g.prototype.unpipe=function(R){var Y=this._readableState,C={hasUnpiped:!1};if(Y.pipesCount===0)return this;if(Y.pipesCount===1){if(R&&R!==Y.pipes)return this;if(!R)R=Y.pipes;if(Y.pipes=null,Y.pipesCount=0,Y.flowing=!1,R)R.emit("unpipe",this,C);return this}if(!R){var{pipes:u,pipesCount:e}=Y;Y.pipes=null,Y.pipesCount=0,Y.flowing=!1;for(var r=0;r0,u.flowing!==!1)this.resume()}else if(R==="readable"){if(!u.endEmitted&&!u.readableListening){if(u.readableListening=u.needReadable=!0,u.flowing=!1,u.emittedReadable=!1,w("on readable",u.length,u.reading),u.length)p(this);else if(!u.reading)process.nextTick(V0,this)}}return C},g.prototype.addListener=g.prototype.on,g.prototype.removeListener=function(R,Y){var C=Z.prototype.removeListener.call(this,R,Y);if(R==="readable")process.nextTick(m,this);return C},g.prototype.removeAllListeners=function(R){var Y=Z.prototype.removeAllListeners.apply(this,arguments);if(R==="readable"||R===void 0)process.nextTick(m,this);return Y};function m(R){var Y=R._readableState;if(Y.readableListening=R.listenerCount("readable")>0,Y.resumeScheduled&&!Y.paused)Y.flowing=!0;else if(R.listenerCount("data")>0)R.resume()}function V0(R){w("readable nexttick read 0"),R.read(0)}g.prototype.resume=function(){var R=this._readableState;if(!R.flowing)w("resume"),R.flowing=!R.readableListening,w0(this,R);return R.paused=!1,this};function w0(R,Y){if(!Y.resumeScheduled)Y.resumeScheduled=!0,process.nextTick(S,R,Y)}function S(R,Y){if(w("resume",Y.reading),!Y.reading)R.read(0);if(Y.resumeScheduled=!1,R.emit("resume"),b(R),Y.flowing&&!Y.reading)R.read(0)}g.prototype.pause=function(){if(w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)w("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function b(R){var Y=R._readableState;w("flow",Y.flowing);while(Y.flowing&&R.read()!==null);}if(g.prototype.wrap=function(R){var Y=this,C=this._readableState,u=!1;R.on("end",function(){if(w("wrapped end"),C.decoder&&!C.ended){var s=C.decoder.end();if(s&&s.length)Y.push(s)}Y.push(null)}),R.on("data",function(s){if(w("wrapped data"),C.decoder)s=C.decoder.write(s);if(C.objectMode&&(s===null||s===void 0))return;else if(!C.objectMode&&(!s||!s.length))return;var T=Y.push(s);if(!T)u=!0,R.pause()});for(var e in R)if(this[e]===void 0&&typeof R[e]==="function")this[e]=function(s){return function(){return R[s].apply(R,arguments)}}(e);for(var r=0;r<_.length;r++)R.on(_[r],this.emit.bind(this,_[r]));return this._read=function(s){if(w("wrapped _read",s),u)u=!1,R.resume()},this},typeof Symbol==="function")g.prototype[Symbol.asyncIterator]=function(){if(j===void 0)j=AW();return j(this)};Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(g.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(g.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(R){if(this._readableState)this._readableState.flowing=R}}),g._fromList=O,Object.defineProperty(g.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function O(R,Y){if(Y.length===0)return null;var C;if(Y.objectMode)C=Y.buffer.shift();else if(!R||R>=Y.length){if(Y.decoder)C=Y.buffer.join("");else if(Y.buffer.length===1)C=Y.buffer.first();else C=Y.buffer.concat(Y.length);Y.buffer.clear()}else C=Y.buffer.consume(R,Y.decoder);return C}function E(R){var Y=R._readableState;if(w("endReadable",Y.endEmitted),!Y.endEmitted)Y.ended=!0,process.nextTick(a,Y,R)}function a(R,Y){if(w("endReadableNT",R.endEmitted,R.length),!R.endEmitted&&R.length===0){if(R.endEmitted=!0,Y.readable=!1,Y.emit("end"),R.autoDestroy){var C=Y._writableState;if(!C||C.autoDestroy&&C.finished)Y.destroy()}}}if(typeof Symbol==="function")g.from=function(R,Y){if(n===void 0)n=XW();return n(g,R,Y)};function K0(R,Y){for(var C=0,u=R.length;C{q.exports=V;var Q=O1().codes,K=Q.ERR_METHOD_NOT_IMPLEMENTED,J=Q.ERR_MULTIPLE_CALLBACK,Z=Q.ERR_TRANSFORM_ALREADY_TRANSFORMING,G=Q.ERR_TRANSFORM_WITH_LENGTH_0,W=L6();x1()(V,W);function B(F,M){var k=this._transformState;k.transforming=!1;var f=k.writecb;if(f===null)return this.emit("error",new J);if(k.writechunk=null,k.writecb=null,M!=null)this.push(M);f(F);var L=this._readableState;if(L.reading=!1,L.needReadable||L.length{q.exports=K;var Q=pK();x1()(K,Q);function K(J){if(!(this instanceof K))return new K(J);Q.call(this,J)}K.prototype._transform=function(J,Z,G){G(null,J)}}),hW=h0(($,q)=>{var Q;function K(k){var f=!1;return function(){if(f)return;f=!0,k.apply(void 0,arguments)}}var J=O1().codes,Z=J.ERR_MISSING_ARGS,G=J.ERR_STREAM_DESTROYED;function W(k){if(k)throw k}function B(k){return k.setHeader&&typeof k.abort==="function"}function V(k,f,L,D){D=K(D);var z=!1;if(k.on("close",function(){z=!0}),Q===void 0)Q=R7();Q(k,{readable:f,writable:L},function(H){if(H)return D(H);z=!0,D()});var N=!1;return function(H){if(z)return;if(N)return;if(N=!0,B(k))return k.abort();if(typeof k.destroy==="function")return k.destroy();D(H||new G("pipe"))}}function U(k){k()}function w(k,f){return k.pipe(f)}function F(k){if(!k.length)return W;if(typeof k[k.length-1]!=="function")return W;return k.pop()}function M(){for(var k=arguments.length,f=Array(k),L=0;L0;return V(H,j,n,function(d){if(!z)z=d;if(d)N.forEach(U);if(j)return;N.forEach(U),D(z)})});return f.reduce(w)}q.exports=M}),iK=h0(($,q)=>{var Q=a1();$=q.exports=mK(),$.Stream=Q||$,$.Readable=$,$.Writable=dK(),$.Duplex=L6(),$.Transform=pK(),$.PassThrough=yW(),$.finished=R7(),$.pipeline=hW()}),oK=h0(($)=>{var q=cK(),Q=x1(),K=iK(),J=$.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Z=$.IncomingMessage=function(G,W,B,V){var U=this;if(K.Readable.call(U),U._mode=B,U.headers={},U.rawHeaders=[],U.trailers={},U.rawTrailers=[],U.on("end",function(){process.nextTick(function(){U.emit("close")})}),B==="fetch"){let D=function(){M.read().then(function(z){if(U._destroyed)return;if(V(z.done),z.done){U.push(null);return}U.push(Buffer.from(z.value)),D()}).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)})};var w=D;if(U._fetchResponse=W,U.url=W.url,U.statusCode=W.status,U.statusMessage=W.statusText,W.headers.forEach(function(z,N){U.headers[N.toLowerCase()]=z,U.rawHeaders.push(N,z)}),q.writableStream){var F=new WritableStream({write:function(z){return V(!1),new Promise(function(N,H){if(U._destroyed)H();else if(U.push(Buffer.from(z)))N();else U._resumeFetch=N})},close:function(){if(V(!0),!U._destroyed)U.push(null)},abort:function(z){if(V(!0),!U._destroyed)U.emit("error",z)}});try{W.body.pipeTo(F).catch(function(z){if(V(!0),!U._destroyed)U.emit("error",z)});return}catch(z){}}var M=W.body.getReader();D()}else{U._xhr=G,U._pos=0,U.url=G.responseURL,U.statusCode=G.status,U.statusMessage=G.statusText;var k=G.getAllResponseHeaders().split(/\r?\n/);if(k.forEach(function(D){var z=D.match(/^([^:]+):\s*(.*)/);if(z){var N=z[1].toLowerCase();if(N==="set-cookie"){if(U.headers[N]===void 0)U.headers[N]=[];U.headers[N].push(z[2])}else if(U.headers[N]!==void 0)U.headers[N]+=", "+z[2];else U.headers[N]=z[2];U.rawHeaders.push(z[1],z[2])}}),U._charset="x-user-defined",!q.overrideMimeType){var f=U.rawHeaders["mime-type"];if(f){var L=f.match(/;\s*charset=([^;])(;|$)/);if(L)U._charset=L[1].toLowerCase()}if(!U._charset)U._charset="utf-8"}}};Q(Z,K.Readable),Z.prototype._read=function(){var G=this,W=G._resumeFetch;if(W)G._resumeFetch=null,W()},Z.prototype._onXHRProgress=function(G){var W=this,B=W._xhr,V=null;switch(W._mode){case"text":if(V=B.responseText,V.length>W._pos){var U=V.substr(W._pos);if(W._charset==="x-user-defined"){var w=Buffer.alloc(U.length);for(var F=0;FW._pos)W.push(Buffer.from(new Uint8Array(M.result.slice(W._pos)))),W._pos=M.result.byteLength},M.onload=function(){G(!0),W.push(null)},M.readAsArrayBuffer(V);break}if(W._xhr.readyState===J.DONE&&W._mode!=="ms-stream")G(!0),W.push(null)}}),xW=h0(($,q)=>{var Q=cK(),K=x1(),J=oK(),Z=iK(),G=J.IncomingMessage,W=J.readyStates;function B(F,M){if(Q.fetch&&M)return"fetch";else if(Q.mozchunkedarraybuffer)return"moz-chunked-arraybuffer";else if(Q.msstream)return"ms-stream";else if(Q.arraybuffer&&F)return"arraybuffer";else return"text"}var V=q.exports=function(F){var M=this;if(Z.Writable.call(M),M._opts=F,M._body=[],M._headers={},F.auth)M.setHeader("Authorization","Basic "+Buffer.from(F.auth).toString("base64"));Object.keys(F.headers).forEach(function(L){M.setHeader(L,F.headers[L])});var k,f=!0;if(F.mode==="disable-fetch"||"requestTimeout"in F&&!Q.abortController)f=!1,k=!0;else if(F.mode==="prefer-streaming")k=!1;else if(F.mode==="allow-wrong-content-type")k=!Q.overrideMimeType;else if(!F.mode||F.mode==="default"||F.mode==="prefer-fast")k=!0;else throw Error("Invalid value for opts.mode");M._mode=B(k,f),M._fetchTimer=null,M._socketTimeout=null,M._socketTimer=null,M.on("finish",function(){M._onFinish()})};K(V,Z.Writable),V.prototype.setHeader=function(F,M){var k=this,f=F.toLowerCase();if(w.indexOf(f)!==-1)return;k._headers[f]={name:F,value:M}},V.prototype.getHeader=function(F){var M=this._headers[F.toLowerCase()];if(M)return M.value;return null},V.prototype.removeHeader=function(F){var M=this;delete M._headers[F.toLowerCase()]},V.prototype._onFinish=function(){var F=this;if(F._destroyed)return;var M=F._opts;if("timeout"in M&&M.timeout!==0)F.setTimeout(M.timeout);var k=F._headers,f=null;if(M.method!=="GET"&&M.method!=="HEAD")f=new Blob(F._body,{type:(k["content-type"]||{}).value||""});var L=[];if(Object.keys(k).forEach(function(H){var v=k[H].name,j=k[H].value;if(Array.isArray(j))j.forEach(function(n){L.push([v,n])});else L.push([v,j])}),F._mode==="fetch"){var D=null;if(Q.abortController){var z=new AbortController;if(D=z.signal,F._fetchAbortController=z,"requestTimeout"in M&&M.requestTimeout!==0)F._fetchTimer=globalThis.setTimeout(function(){if(F.emit("requestTimeout"),F._fetchAbortController)F._fetchAbortController.abort()},M.requestTimeout)}globalThis.fetch(F._opts.url,{method:F._opts.method,headers:L,body:f||void 0,mode:"cors",credentials:M.withCredentials?"include":"same-origin",signal:D}).then(function(H){F._fetchResponse=H,F._resetTimers(!1),F._connect()},function(H){if(F._resetTimers(!0),!F._destroyed)F.emit("error",H)})}else{var N=F._xhr=new globalThis.XMLHttpRequest;try{N.open(F._opts.method,F._opts.url,!0)}catch(H){process.nextTick(function(){F.emit("error",H)});return}if("responseType"in N)N.responseType=F._mode;if("withCredentials"in N)N.withCredentials=!!M.withCredentials;if(F._mode==="text"&&"overrideMimeType"in N)N.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in M)N.timeout=M.requestTimeout,N.ontimeout=function(){F.emit("requestTimeout")};if(L.forEach(function(H){N.setRequestHeader(H[0],H[1])}),F._response=null,N.onreadystatechange=function(){switch(N.readyState){case W.LOADING:case W.DONE:F._onXHRProgress();break}},F._mode==="moz-chunked-arraybuffer")N.onprogress=function(){F._onXHRProgress()};N.onerror=function(){if(F._destroyed)return;F._resetTimers(!0),F.emit("error",Error("XHR error"))};try{N.send(f)}catch(H){process.nextTick(function(){F.emit("error",H)});return}}};function U(F){try{var M=F.status;return M!==null&&M!==0}catch(k){return!1}}V.prototype._onXHRProgress=function(){var F=this;if(F._resetTimers(!1),!U(F._xhr)||F._destroyed)return;if(!F._response)F._connect();F._response._onXHRProgress(F._resetTimers.bind(F))},V.prototype._connect=function(){var F=this;if(F._destroyed)return;F._response=new G(F._xhr,F._fetchResponse,F._mode,F._resetTimers.bind(F)),F._response.on("error",function(M){F.emit("error",M)}),F.emit("response",F._response)},V.prototype._write=function(F,M,k){var f=this;f._body.push(F),k()},V.prototype._resetTimers=function(F){var M=this;if(globalThis.clearTimeout(M._socketTimer),M._socketTimer=null,F)globalThis.clearTimeout(M._fetchTimer),M._fetchTimer=null;else if(M._socketTimeout)M._socketTimer=globalThis.setTimeout(function(){M.emit("timeout")},M._socketTimeout)},V.prototype.abort=V.prototype.destroy=function(F){var M=this;if(M._destroyed=!0,M._resetTimers(!0),M._response)M._response._destroyed=!0;if(M._xhr)M._xhr.abort();else if(M._fetchAbortController)M._fetchAbortController.abort();if(F)M.emit("error",F)},V.prototype.end=function(F,M,k){var f=this;if(typeof F==="function")k=F,F=void 0;Z.Writable.prototype.end.call(f,F,M,k)},V.prototype.setTimeout=function(F,M){var k=this;if(M)k.once("timeout",M);k._socketTimeout=F,k._resetTimers(!1)},V.prototype.flushHeaders=function(){},V.prototype.setNoDelay=function(){},V.prototype.setSocketKeepAlive=function(){};var w=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}),OW=h0(($,q)=>{q.exports=K;var Q=Object.prototype.hasOwnProperty;function K(){var J={};for(var Z=0;Z{q.exports=(C7(),X0(I7)).STATUS_CODES}),TW=h0(($)=>{var q=xW(),Q=oK(),K=OW(),J=PW(),Z=(f7(),X0(v7)),G=$;G.request=function(W,B){if(typeof W==="string")W=Z.parse(W);else W=K(W);var V=globalThis.location.protocol.search(/^https?:$/)===-1?"http:":"",U=W.protocol||V,w=W.hostname||W.host,F=W.port,M=W.path||"/";if(w&&w.indexOf(":")!==-1)w="["+w+"]";W.url=(w?U+"//"+w:"")+(F?":"+F:"")+M,W.method=(W.method||"GET").toUpperCase(),W.headers=W.headers||{};var k=new q(W);if(B)k.on("response",B);return k},G.get=function(W,B){var V=G.request(W,B);return V.end(),V},G.ClientRequest=q,G.IncomingMessage=Q.IncomingMessage,G.Agent=function(){},G.Agent.defaultMaxSockets=4,G.globalAgent=new G.Agent,G.STATUS_CODES=J,G.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}),aK=RW(TW(),1),{request:uW,get:SW,ClientRequest:EW,IncomingMessage:_W,Agent:cW,globalAgent:bW,STATUS_CODES:nW,METHODS:dW}=aK.default,mW=aK.default});var sK={};c1(sK,{validateHeaderValue:()=>MB,validateHeaderName:()=>FB,setMaxIdleHTTPParsers:()=>zB,request:()=>BB,maxHeaderSize:()=>WB,globalAgent:()=>GB,get:()=>ZB,default:()=>wB,createServer:()=>UB,ServerResponse:()=>VB,Server:()=>JB,STATUS_CODES:()=>KB,OutgoingMessage:()=>qB,METHODS:()=>QB,IncomingMessage:()=>$B,ClientRequest:()=>eW,Agent:()=>tW});var pW,iW,lK,oW,aW,lW=($,q,Q)=>{Q=$!=null?pW(iW($)):{};let K=q||!$||!$.__esModule?lK(Q,"default",{value:$,enumerable:!0}):Q;for(let J of oW($))if(!aW.call(K,J))lK(K,J,{get:()=>$[J],enumerable:!0});return K},rW=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports),sW,rK,tW,eW,$B,QB,qB,KB,JB,VB,UB,ZB,GB,WB,BB,zB,FB,MB,wB;var tK=b1(()=>{pW=Object.create,{getPrototypeOf:iW,defineProperty:lK,getOwnPropertyNames:oW}=Object,aW=Object.prototype.hasOwnProperty,sW=rW(($,q)=>{var Q=(C7(),X0(I7)),K=(f7(),X0(v7)),J=$;for(Z in Q)if(Q.hasOwnProperty(Z))J[Z]=Q[Z];var Z;J.request=function(W,B){return W=G(W),Q.request.call(this,W,B)},J.get=function(W,B){return W=G(W),Q.get.call(this,W,B)};function G(W){if(typeof W==="string")W=K.parse(W);if(!W.protocol)W.protocol="https:";if(W.protocol!=="https:")throw Error('Protocol "'+W.protocol+'" not supported. Expected "https:"');return W}}),rK=lW(sW(),1),{Agent:tW,ClientRequest:eW,IncomingMessage:$B,METHODS:QB,OutgoingMessage:qB,STATUS_CODES:KB,Server:JB,ServerResponse:VB,createServer:UB,get:ZB,globalAgent:GB,maxHeaderSize:WB,request:BB,setMaxIdleHTTPParsers:zB,validateHeaderName:FB,validateHeaderValue:MB}=rK,wB=rK});var N8=globalThis;if(typeof N8.global>"u")N8.global=globalThis;if(typeof N8.__require>"u")N8.__require=($)=>{throw Error(`Dynamic require of "${$}" is not supported in the sandbox`)};t0();var Uz=J9(h9(),1);var c7=J9(HK(),1);function W2($,q,Q,K){function J(Z){return Z instanceof Q?Z:new Q(function(G){G(Z)})}return new(Q||(Q=Promise))(function(Z,G){function W(U){try{V(K.next(U))}catch(w){G(w)}}function B(U){try{V(K.throw(U))}catch(w){G(w)}}function V(U){U.done?Z(U.value):J(U.value).then(W,B)}V((K=K.apply($,q||[])).next())})}var L0=914400,w8=12700,n0=`\r +`,NB=2147483649,j7=/^[0-9a-fA-F]{6}$/,YB=1.67,kB=27,H6={type:"solid",color:"666666",pt:1},JJ=[0.05,0.1,0.05,0.1],v6={color:"363636",pt:1},u1={color:"888888",style:"solid",size:1,cap:"flat"},Q2="000000",k2=12,DB=18,f6="LAYOUT_16x9",x7="DEFAULT",VJ="333333",P1={type:"outer",blur:3,offset:1.811023622047244,angle:90,color:"000000",opacity:0.35,rotateWithShape:!0},M8=[0.5,0.5,0.5,0.5],eK={color:"000000"},LB={size:8,color:"FFFFFF",opacity:0.75},o2="2094734552",Y5="2094734553",B8="2094734554",O7="2094734555",UJ="2094734556",W8="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),z8=["C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360","C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360"],HB=["5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7","5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7"],R6;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(R6||(R6={}));var I6;(function($){$.b="b",$.ctr="ctr",$.t="t"})(I6||(I6={}));var ZJ="{F7021451-1387-4CA6-816F-3879F97B5CBC}",P7;(function($){$.arraybuffer="arraybuffer",$.base64="base64",$.binarystring="binarystring",$.blob="blob",$.nodebuffer="nodebuffer",$.uint8array="uint8array"})(P7||(P7={}));var T7;(function($){$.area="area",$.bar="bar",$.bar3d="bar3D",$.bubble="bubble",$.bubble3d="bubble3D",$.doughnut="doughnut",$.line="line",$.pie="pie",$.radar="radar",$.scatter="scatter"})(T7||(T7={}));var u7;(function($){$.accentBorderCallout1="accentBorderCallout1",$.accentBorderCallout2="accentBorderCallout2",$.accentBorderCallout3="accentBorderCallout3",$.accentCallout1="accentCallout1",$.accentCallout2="accentCallout2",$.accentCallout3="accentCallout3",$.actionButtonBackPrevious="actionButtonBackPrevious",$.actionButtonBeginning="actionButtonBeginning",$.actionButtonBlank="actionButtonBlank",$.actionButtonDocument="actionButtonDocument",$.actionButtonEnd="actionButtonEnd",$.actionButtonForwardNext="actionButtonForwardNext",$.actionButtonHelp="actionButtonHelp",$.actionButtonHome="actionButtonHome",$.actionButtonInformation="actionButtonInformation",$.actionButtonMovie="actionButtonMovie",$.actionButtonReturn="actionButtonReturn",$.actionButtonSound="actionButtonSound",$.arc="arc",$.bentArrow="bentArrow",$.bentUpArrow="bentUpArrow",$.bevel="bevel",$.blockArc="blockArc",$.borderCallout1="borderCallout1",$.borderCallout2="borderCallout2",$.borderCallout3="borderCallout3",$.bracePair="bracePair",$.bracketPair="bracketPair",$.callout1="callout1",$.callout2="callout2",$.callout3="callout3",$.can="can",$.chartPlus="chartPlus",$.chartStar="chartStar",$.chartX="chartX",$.chevron="chevron",$.chord="chord",$.circularArrow="circularArrow",$.cloud="cloud",$.cloudCallout="cloudCallout",$.corner="corner",$.cornerTabs="cornerTabs",$.cube="cube",$.curvedDownArrow="curvedDownArrow",$.curvedLeftArrow="curvedLeftArrow",$.curvedRightArrow="curvedRightArrow",$.curvedUpArrow="curvedUpArrow",$.custGeom="custGeom",$.decagon="decagon",$.diagStripe="diagStripe",$.diamond="diamond",$.dodecagon="dodecagon",$.donut="donut",$.doubleWave="doubleWave",$.downArrow="downArrow",$.downArrowCallout="downArrowCallout",$.ellipse="ellipse",$.ellipseRibbon="ellipseRibbon",$.ellipseRibbon2="ellipseRibbon2",$.flowChartAlternateProcess="flowChartAlternateProcess",$.flowChartCollate="flowChartCollate",$.flowChartConnector="flowChartConnector",$.flowChartDecision="flowChartDecision",$.flowChartDelay="flowChartDelay",$.flowChartDisplay="flowChartDisplay",$.flowChartDocument="flowChartDocument",$.flowChartExtract="flowChartExtract",$.flowChartInputOutput="flowChartInputOutput",$.flowChartInternalStorage="flowChartInternalStorage",$.flowChartMagneticDisk="flowChartMagneticDisk",$.flowChartMagneticDrum="flowChartMagneticDrum",$.flowChartMagneticTape="flowChartMagneticTape",$.flowChartManualInput="flowChartManualInput",$.flowChartManualOperation="flowChartManualOperation",$.flowChartMerge="flowChartMerge",$.flowChartMultidocument="flowChartMultidocument",$.flowChartOfflineStorage="flowChartOfflineStorage",$.flowChartOffpageConnector="flowChartOffpageConnector",$.flowChartOnlineStorage="flowChartOnlineStorage",$.flowChartOr="flowChartOr",$.flowChartPredefinedProcess="flowChartPredefinedProcess",$.flowChartPreparation="flowChartPreparation",$.flowChartProcess="flowChartProcess",$.flowChartPunchedCard="flowChartPunchedCard",$.flowChartPunchedTape="flowChartPunchedTape",$.flowChartSort="flowChartSort",$.flowChartSummingJunction="flowChartSummingJunction",$.flowChartTerminator="flowChartTerminator",$.folderCorner="folderCorner",$.frame="frame",$.funnel="funnel",$.gear6="gear6",$.gear9="gear9",$.halfFrame="halfFrame",$.heart="heart",$.heptagon="heptagon",$.hexagon="hexagon",$.homePlate="homePlate",$.horizontalScroll="horizontalScroll",$.irregularSeal1="irregularSeal1",$.irregularSeal2="irregularSeal2",$.leftArrow="leftArrow",$.leftArrowCallout="leftArrowCallout",$.leftBrace="leftBrace",$.leftBracket="leftBracket",$.leftCircularArrow="leftCircularArrow",$.leftRightArrow="leftRightArrow",$.leftRightArrowCallout="leftRightArrowCallout",$.leftRightCircularArrow="leftRightCircularArrow",$.leftRightRibbon="leftRightRibbon",$.leftRightUpArrow="leftRightUpArrow",$.leftUpArrow="leftUpArrow",$.lightningBolt="lightningBolt",$.line="line",$.lineInv="lineInv",$.mathDivide="mathDivide",$.mathEqual="mathEqual",$.mathMinus="mathMinus",$.mathMultiply="mathMultiply",$.mathNotEqual="mathNotEqual",$.mathPlus="mathPlus",$.moon="moon",$.noSmoking="noSmoking",$.nonIsoscelesTrapezoid="nonIsoscelesTrapezoid",$.notchedRightArrow="notchedRightArrow",$.octagon="octagon",$.parallelogram="parallelogram",$.pentagon="pentagon",$.pie="pie",$.pieWedge="pieWedge",$.plaque="plaque",$.plaqueTabs="plaqueTabs",$.plus="plus",$.quadArrow="quadArrow",$.quadArrowCallout="quadArrowCallout",$.rect="rect",$.ribbon="ribbon",$.ribbon2="ribbon2",$.rightArrow="rightArrow",$.rightArrowCallout="rightArrowCallout",$.rightBrace="rightBrace",$.rightBracket="rightBracket",$.round1Rect="round1Rect",$.round2DiagRect="round2DiagRect",$.round2SameRect="round2SameRect",$.roundRect="roundRect",$.rtTriangle="rtTriangle",$.smileyFace="smileyFace",$.snip1Rect="snip1Rect",$.snip2DiagRect="snip2DiagRect",$.snip2SameRect="snip2SameRect",$.snipRoundRect="snipRoundRect",$.squareTabs="squareTabs",$.star10="star10",$.star12="star12",$.star16="star16",$.star24="star24",$.star32="star32",$.star4="star4",$.star5="star5",$.star6="star6",$.star7="star7",$.star8="star8",$.stripedRightArrow="stripedRightArrow",$.sun="sun",$.swooshArrow="swooshArrow",$.teardrop="teardrop",$.trapezoid="trapezoid",$.triangle="triangle",$.upArrow="upArrow",$.upArrowCallout="upArrowCallout",$.upDownArrow="upDownArrow",$.upDownArrowCallout="upDownArrowCallout",$.uturnArrow="uturnArrow",$.verticalScroll="verticalScroll",$.wave="wave",$.wedgeEllipseCallout="wedgeEllipseCallout",$.wedgeRectCallout="wedgeRectCallout",$.wedgeRoundRectCallout="wedgeRoundRectCallout"})(u7||(u7={}));var G2;(function($){$.text1="tx1",$.text2="tx2",$.background1="bg1",$.background2="bg2",$.accent1="accent1",$.accent2="accent2",$.accent3="accent3",$.accent4="accent4",$.accent5="accent5",$.accent6="accent6"})(G2||(G2={}));var S7;(function($){$.left="left",$.center="center",$.right="right",$.justify="justify"})(S7||(S7={}));var E7;(function($){$.top="top",$.middle="middle",$.bottom="bottom"})(E7||(E7={}));var B1;(function($){$.ACTION_BUTTON_BACK_OR_PREVIOUS="actionButtonBackPrevious",$.ACTION_BUTTON_BEGINNING="actionButtonBeginning",$.ACTION_BUTTON_CUSTOM="actionButtonBlank",$.ACTION_BUTTON_DOCUMENT="actionButtonDocument",$.ACTION_BUTTON_END="actionButtonEnd",$.ACTION_BUTTON_FORWARD_OR_NEXT="actionButtonForwardNext",$.ACTION_BUTTON_HELP="actionButtonHelp",$.ACTION_BUTTON_HOME="actionButtonHome",$.ACTION_BUTTON_INFORMATION="actionButtonInformation",$.ACTION_BUTTON_MOVIE="actionButtonMovie",$.ACTION_BUTTON_RETURN="actionButtonReturn",$.ACTION_BUTTON_SOUND="actionButtonSound",$.ARC="arc",$.BALLOON="wedgeRoundRectCallout",$.BENT_ARROW="bentArrow",$.BENT_UP_ARROW="bentUpArrow",$.BEVEL="bevel",$.BLOCK_ARC="blockArc",$.CAN="can",$.CHART_PLUS="chartPlus",$.CHART_STAR="chartStar",$.CHART_X="chartX",$.CHEVRON="chevron",$.CHORD="chord",$.CIRCULAR_ARROW="circularArrow",$.CLOUD="cloud",$.CLOUD_CALLOUT="cloudCallout",$.CORNER="corner",$.CORNER_TABS="cornerTabs",$.CROSS="plus",$.CUBE="cube",$.CURVED_DOWN_ARROW="curvedDownArrow",$.CURVED_DOWN_RIBBON="ellipseRibbon",$.CURVED_LEFT_ARROW="curvedLeftArrow",$.CURVED_RIGHT_ARROW="curvedRightArrow",$.CURVED_UP_ARROW="curvedUpArrow",$.CURVED_UP_RIBBON="ellipseRibbon2",$.CUSTOM_GEOMETRY="custGeom",$.DECAGON="decagon",$.DIAGONAL_STRIPE="diagStripe",$.DIAMOND="diamond",$.DODECAGON="dodecagon",$.DONUT="donut",$.DOUBLE_BRACE="bracePair",$.DOUBLE_BRACKET="bracketPair",$.DOUBLE_WAVE="doubleWave",$.DOWN_ARROW="downArrow",$.DOWN_ARROW_CALLOUT="downArrowCallout",$.DOWN_RIBBON="ribbon",$.EXPLOSION1="irregularSeal1",$.EXPLOSION2="irregularSeal2",$.FLOWCHART_ALTERNATE_PROCESS="flowChartAlternateProcess",$.FLOWCHART_CARD="flowChartPunchedCard",$.FLOWCHART_COLLATE="flowChartCollate",$.FLOWCHART_CONNECTOR="flowChartConnector",$.FLOWCHART_DATA="flowChartInputOutput",$.FLOWCHART_DECISION="flowChartDecision",$.FLOWCHART_DELAY="flowChartDelay",$.FLOWCHART_DIRECT_ACCESS_STORAGE="flowChartMagneticDrum",$.FLOWCHART_DISPLAY="flowChartDisplay",$.FLOWCHART_DOCUMENT="flowChartDocument",$.FLOWCHART_EXTRACT="flowChartExtract",$.FLOWCHART_INTERNAL_STORAGE="flowChartInternalStorage",$.FLOWCHART_MAGNETIC_DISK="flowChartMagneticDisk",$.FLOWCHART_MANUAL_INPUT="flowChartManualInput",$.FLOWCHART_MANUAL_OPERATION="flowChartManualOperation",$.FLOWCHART_MERGE="flowChartMerge",$.FLOWCHART_MULTIDOCUMENT="flowChartMultidocument",$.FLOWCHART_OFFLINE_STORAGE="flowChartOfflineStorage",$.FLOWCHART_OFFPAGE_CONNECTOR="flowChartOffpageConnector",$.FLOWCHART_OR="flowChartOr",$.FLOWCHART_PREDEFINED_PROCESS="flowChartPredefinedProcess",$.FLOWCHART_PREPARATION="flowChartPreparation",$.FLOWCHART_PROCESS="flowChartProcess",$.FLOWCHART_PUNCHED_TAPE="flowChartPunchedTape",$.FLOWCHART_SEQUENTIAL_ACCESS_STORAGE="flowChartMagneticTape",$.FLOWCHART_SORT="flowChartSort",$.FLOWCHART_STORED_DATA="flowChartOnlineStorage",$.FLOWCHART_SUMMING_JUNCTION="flowChartSummingJunction",$.FLOWCHART_TERMINATOR="flowChartTerminator",$.FOLDED_CORNER="folderCorner",$.FRAME="frame",$.FUNNEL="funnel",$.GEAR_6="gear6",$.GEAR_9="gear9",$.HALF_FRAME="halfFrame",$.HEART="heart",$.HEPTAGON="heptagon",$.HEXAGON="hexagon",$.HORIZONTAL_SCROLL="horizontalScroll",$.ISOSCELES_TRIANGLE="triangle",$.LEFT_ARROW="leftArrow",$.LEFT_ARROW_CALLOUT="leftArrowCallout",$.LEFT_BRACE="leftBrace",$.LEFT_BRACKET="leftBracket",$.LEFT_CIRCULAR_ARROW="leftCircularArrow",$.LEFT_RIGHT_ARROW="leftRightArrow",$.LEFT_RIGHT_ARROW_CALLOUT="leftRightArrowCallout",$.LEFT_RIGHT_CIRCULAR_ARROW="leftRightCircularArrow",$.LEFT_RIGHT_RIBBON="leftRightRibbon",$.LEFT_RIGHT_UP_ARROW="leftRightUpArrow",$.LEFT_UP_ARROW="leftUpArrow",$.LIGHTNING_BOLT="lightningBolt",$.LINE_CALLOUT_1="borderCallout1",$.LINE_CALLOUT_1_ACCENT_BAR="accentCallout1",$.LINE_CALLOUT_1_BORDER_AND_ACCENT_BAR="accentBorderCallout1",$.LINE_CALLOUT_1_NO_BORDER="callout1",$.LINE_CALLOUT_2="borderCallout2",$.LINE_CALLOUT_2_ACCENT_BAR="accentCallout2",$.LINE_CALLOUT_2_BORDER_AND_ACCENT_BAR="accentBorderCallout2",$.LINE_CALLOUT_2_NO_BORDER="callout2",$.LINE_CALLOUT_3="borderCallout3",$.LINE_CALLOUT_3_ACCENT_BAR="accentCallout3",$.LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR="accentBorderCallout3",$.LINE_CALLOUT_3_NO_BORDER="callout3",$.LINE_CALLOUT_4="borderCallout4",$.LINE_CALLOUT_4_ACCENT_BAR="accentCallout3=4",$.LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR="accentBorderCallout4",$.LINE_CALLOUT_4_NO_BORDER="callout4",$.LINE="line",$.LINE_INVERSE="lineInv",$.MATH_DIVIDE="mathDivide",$.MATH_EQUAL="mathEqual",$.MATH_MINUS="mathMinus",$.MATH_MULTIPLY="mathMultiply",$.MATH_NOT_EQUAL="mathNotEqual",$.MATH_PLUS="mathPlus",$.MOON="moon",$.NON_ISOSCELES_TRAPEZOID="nonIsoscelesTrapezoid",$.NOTCHED_RIGHT_ARROW="notchedRightArrow",$.NO_SYMBOL="noSmoking",$.OCTAGON="octagon",$.OVAL="ellipse",$.OVAL_CALLOUT="wedgeEllipseCallout",$.PARALLELOGRAM="parallelogram",$.PENTAGON="homePlate",$.PIE="pie",$.PIE_WEDGE="pieWedge",$.PLAQUE="plaque",$.PLAQUE_TABS="plaqueTabs",$.QUAD_ARROW="quadArrow",$.QUAD_ARROW_CALLOUT="quadArrowCallout",$.RECTANGLE="rect",$.RECTANGULAR_CALLOUT="wedgeRectCallout",$.REGULAR_PENTAGON="pentagon",$.RIGHT_ARROW="rightArrow",$.RIGHT_ARROW_CALLOUT="rightArrowCallout",$.RIGHT_BRACE="rightBrace",$.RIGHT_BRACKET="rightBracket",$.RIGHT_TRIANGLE="rtTriangle",$.ROUNDED_RECTANGLE="roundRect",$.ROUNDED_RECTANGULAR_CALLOUT="wedgeRoundRectCallout",$.ROUND_1_RECTANGLE="round1Rect",$.ROUND_2_DIAG_RECTANGLE="round2DiagRect",$.ROUND_2_SAME_RECTANGLE="round2SameRect",$.SMILEY_FACE="smileyFace",$.SNIP_1_RECTANGLE="snip1Rect",$.SNIP_2_DIAG_RECTANGLE="snip2DiagRect",$.SNIP_2_SAME_RECTANGLE="snip2SameRect",$.SNIP_ROUND_RECTANGLE="snipRoundRect",$.SQUARE_TABS="squareTabs",$.STAR_10_POINT="star10",$.STAR_12_POINT="star12",$.STAR_16_POINT="star16",$.STAR_24_POINT="star24",$.STAR_32_POINT="star32",$.STAR_4_POINT="star4",$.STAR_5_POINT="star5",$.STAR_6_POINT="star6",$.STAR_7_POINT="star7",$.STAR_8_POINT="star8",$.STRIPED_RIGHT_ARROW="stripedRightArrow",$.SUN="sun",$.SWOOSH_ARROW="swooshArrow",$.TEAR="teardrop",$.TRAPEZOID="trapezoid",$.UP_ARROW="upArrow",$.UP_ARROW_CALLOUT="upArrowCallout",$.UP_DOWN_ARROW="upDownArrow",$.UP_DOWN_ARROW_CALLOUT="upDownArrowCallout",$.UP_RIBBON="ribbon2",$.U_TURN_ARROW="uturnArrow",$.VERTICAL_SCROLL="verticalScroll",$.WAVE="wave"})(B1||(B1={}));var q0;(function($){$.AREA="area",$.BAR="bar",$.BAR3D="bar3D",$.BUBBLE="bubble",$.BUBBLE3D="bubble3D",$.DOUGHNUT="doughnut",$.LINE="line",$.PIE="pie",$.RADAR="radar",$.SCATTER="scatter"})(q0||(q0={}));var L5;(function($){$.TEXT1="tx1",$.TEXT2="tx2",$.BACKGROUND1="bg1",$.BACKGROUND2="bg2",$.ACCENT1="accent1",$.ACCENT2="accent2",$.ACCENT3="accent3",$.ACCENT4="accent4",$.ACCENT5="accent5",$.ACCENT6="accent6"})(L5||(L5={}));var W1;(function($){$.chart="chart",$.image="image",$.line="line",$.rect="rect",$.text="text",$.placeholder="placeholder"})(W1||(W1={}));var D0;(function($){$.chart="chart",$.hyperlink="hyperlink",$.image="image",$.media="media",$.online="online",$.placeholder="placeholder",$.table="table",$.tablecell="tablecell",$.text="text",$.notes="notes"})(D0||(D0={}));var F8;(function($){$.title="title",$.body="body",$.image="pic",$.chart="chart",$.table="tbl",$.media="media"})(F8||(F8={}));var C6;(function($){$.DEFAULT="•",$.CHECK="✓",$.STAR="★",$.TRIANGLE="▶"})(C6||(C6={}));var j6="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB3CAYAAAD1oOVhAAAGAUlEQVR4Xu2dT0xcRRzHf7tAYSsc0EBSIq2xEg8mtTGebVzEqOVIolz0siRE4gGTStqKwdpWsXoyGhMuyAVJOHBgqyvLNgonDkabeCBYW/8kTUr0wsJC+Wfm0bfuvn37Znbem9mR9303mJnf/Pb7ed95M7PDI5JIJPYJV5EC7e3t1N/fT62trdqViQCIu+bVgpIHEo/Hqbe3V/sdYVKHyWSSZmZm8ilVA0oeyNjYmEnaVC2Xvr6+qg5fAOJAz4DU1dURGzFSqZRVqtMpAFIGyMjICC0vL9PExIRWKADiAYTNshYWFrRCARAOEFZcCKWtrY0GBgaUTYkBRACIE4rKZwqACALR5RQAqQCIDqcASIVAVDsFQCSAqHQKgEgCUeUUAPEBRIVTAMQnEBvK5OQkbW9vk991CoAEAMQJxc86BUACAhKUUwAkQCBBOAVAAgbi1ykAogCIH6cAiCIgsk4BEIVAZJwCIIqBVLqiBxANQFgXS0tLND4+zl08AogmIG5OSSQS1gGKwgtANAIRcQqAaAbCe6YASBWA2E6xDyeyDUl7+AKQMkDYYevm5mZHabA/Li4uUiaTsYLau8QA4gLE/hU7wajyYtv1hReDAiAOxQcHBymbzark4BkbQKom/X8dp9Npmpqasn4BIAYAYSnYp+4BBEAMUcCwNOCQsAKZnp62NtQOw8WmwT09PUo+ijaHsOMx7GppaaH6+nolH0Z10K2tLVpdXbW6UfV3mNqBdHd3U1NTk2rtlMRfW1uj2dlZAFGirkRQAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAFGprkRsAJEQTWUTAGHqrm8caPzQ0WC1logbeiC7X3xJm0PvUmRzh45cuki1588FAmVn9BO6P3yF9utrqGH0MtW82S8UN9RA9v/4k7InjhcJFTs/TLVXLwmJV67S7vD7tHF5pKi46fYdosdOcOOGG8j1OcqefbFEJD9Q3GCwDhqT31HklS4A8VRgfYM2Op6k3bt/BQJl58J7lPvwg5JYNccepaMry0LPqFA7hCm39+NNyp2J0172b19QysGINj5CsRtpij57musOViH0QPJQXn6J9u7dlYJSFkbrMYolrwvDAJAC+WWdEpQz7FTgECeUCpzi6YxvvqXoM6eEhqnCSgDikEzUKUE7Aw7xuHctKB5OYU3dZlNR9syQdAaAcAYTC0pXF+39c09o2Ik+3EqxVKqiB7hbYAxZkk4pbBaEM+AQofv+wTrFwylBOQNABIGwavdfe4O2pg5elO+86l99nY58/VUF0byrYsjiSFluNlXYrOHcBar7+EogUADEQ0YRGHbzoKAASBkg2+9cpM1rV0tK2QOcXW7bLEFAARAXIF4w2DrDWoeUWaf4hQIgDiA8GPZ2iNfi0Q8UACkAIgrDbrJ385eDxaPLLrEsFAB5oG6lMPJQPLZZZKAACBGVhcG2Q+bmuLu2nk55e4jqPv1IeEoceiBeX7s2zCa5MAqdstl91vfXwaEGsv/rb5TtOFk6tWXOuJGh6KmnhO9sayrMninPx103JBtXblHkice58cINZP4Hyr5wpkgkdiChEmc4FWazLzenNKa/p0jncwDiqcD6BuWePk07t1asatZGoYQzSqA4nFJ7soNiP/+EUyfc25GI2GG53dHPrKo1g/1Cw4pIXLrzO+1c+/wg7tBbFDle/EbQcjFCPWQJCau5EoBoFpzXHYDwFNJcDiCaBed1ByA8hTSXA4hmwXndAQhPIc3lAKJZcF53AMJTSHM5gGgWnNcdgPAU0lwOIJoF53UHIDyFNJcfSiCdnZ0Ui8U0SxlMd7lcjubn561gh+Y1scFIU/0o/3sgeLO12E2k7UXKYumgFoAYdg8ACIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6cAhAGKYAoalA4cAiGEKGJYOHAIghilgWDpwCIAYpoBh6ZQ4JB6PKzviYthnNy4d9h+1M5mMlVckkUjsG5dhiBMCEMPg/wuOfrZZ/RSywQAAAABJRU5ErkJggg==",vB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB4AAAAVnCAYAAACzfHDVAAAAYHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjaVcjJDYAwDEXBu6ughBfH+YnLQSwSHVA+Yrkwx7HtPHabHuEWrQ+lBBAZ6TMweBWoCwUH8quZH6VWFXVT696zxp12ARkVFEqn8wB8AAAACXBIWXMAAC4jAAAuIwF4pT92AADZLklEQVR42uzdd5hV9Z0/8M+dmcsUZmDovYOhKCiKYhR7JJuoSTCWGFI0WUxijBoTTXazVlyza4maYm9rTRSJigVsqCDNQhHBAogKCEgRMjMMU+7vj93sL8kqClLmnPt6PY+PeXZM9vP9vO8jZ+Y955xMfJLjorBrRMuSgmiViyjN1Ee2oSCyucbIBAAAAAAAAADbXaYgcoWNUZcrirpMbdRsysa69wbF+rggGrf439vSF7seF12aFUTnxvoosGIAAAAAAACAXacgoqEgF++/VRgr4r5o+Kh/pvD//F8uiII+LaPrum/EXzqui2b1ddHGKgEAAAAAAAB2rVxEQWMmWrQtjHZlA6N2w2tR84//zP8pgHu3ib6NBdG+zdqorK6KVUXZaB85j3sGAAAAAAAAaAoaG6OwIBdtyneP2PBabPzbr/1dAdx3VHRtyESHiIhcYzQrLo7WmVzkcjmPgAYAAAAAAABoSgpy0eIfS+D/LYD7fy3abC6Inn/7X2hsjELlLwAAAAAAAEDT9D8lcM1fHwddFBFxyAVR9M686PVp/gfqayKiJiLqLBMAAAAAAABgh8hGRGlEUekn/6PFEb3ikNgQk6O+KCJi6dzoksv83/cB/1X9xoiaJdmoWxlRV1dk2QAAAAAAAAA7QTZbH9muERX96v7n9t7/q6Exinq3i86LI94pjOOisHUu+uYykfmof7h+Y8Sa6aVRt74gGhs9DRoAAAAAAABgZ2lsLIi69QWxeUUmSjs0/vedwR8hk4uydSfE+wVd6qOyMfMx7/mtj9jwUtbjngEAAAAAAAB2obrqolg7IxtR/9Ffb4wo7P5GtCwobRaVH/c/UvNmNuqqPfIZAAAAAAAAYFerqy6KmjezH/v1ktpoVZBr/PgCeMN7yl8AAAAAAACApmJLHW5jUVQWNDSP+Q3ZeLco4i9/+8X6teHRzwAAAAAAAABNSd3/dLn/oLAoqqIuVhXFxhhSGB/xqGjlLwAAAAAAAECTU1eTjaK/KXSLIv7SWB+bc5ko9YxnAAAAAAAAgATJFv393bz1EeV//c8F1gMAAAAAAACQDgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKSEAhgAAAAAAAAgJRTAAAAAAAAAACmhAAYAAAAAAABICQUwAAAAAAAAQEoogAEAAAAAAABSQgEMAAAAAAAAkBIKYAAAAAAAAICUUAADAAAAAAAApIQCGAAAAAAAACAlFMAAAAAAAAAAKaEABgAAAAAAAEgJBTAAAAAAAABASiiAAQAAAAAAAFJCAQwAAAAAAACQEgpgAAAAAAAAgJRQAAMAAAAAAACkhAIYAAAAAAAAICUUwAAAAAAAAAApoQAGAAAAAAAASAkFMAAAAAAAAEBKKIABAAAAAAAAUkIBDAAAAAAAAJASCmAAAAAAAACAlFAAAwAAAAAAAKREkRUAAACwrUpLSwuGDRvWfMCAAS26du3avKysrLiioqKkZcuWzZs1a1bcvHnz0tLS0rJsNtusuLi4ebNmzUoLCgo+8/eijY2N9Zs3b66pra2tqqur21xTU1NdVVVVs2nTptqNGzdWbdiwoeYvf/nL5hUrVlQtWLBgw6xZs6pqamoaJQYAAEDaKYABAACIiIghQ4aUHnTQQW379u3bql27dq3at2/fpkWLFq2bN29eWVpa2qpZs2bNCwsLm2ez2fLCwsLyoqKi8sLCwtKknK+hoaG6vr6+qqGh4S91dXV/aWhoqNq8eXNVTU3NuqqqqvUbNmxYu2rVqjWrV69e99Zbb6177rnnPpgzZ06NTwYAAABJogAGAADIA8OGDWt+xBFHdBwwYECnLl26dGjdunXHFi1adCgtLe1YUlLSvlmzZq0KCgqK07yDwsLCssLCwrKIaPdp/zuNjY21mzdvXrdp06ZVNTU172/YsGHl2rVr31+2bNnKBQsWrHjyySffnzVrVpVPGAAAAE1Fpuexsd9HfaF+ZcSal0ptCAAAIAE6deqUPf744zvtueeeXbp3796lbdu2XSorKzuXlpZ2KS0t7VBYWFhhSztGQ0PDxpqampU1NTXL169fv+yDDz5Y9s477yybPXv2sj/96U8rVqxYUWdLAAAAbE9t9q6Jog4f/TUFMAAAQEJks9nMt7/97Y4jRozo1bdv397t2rXrXl5e3rWsrKxzcXFx+4gosKUmp7G2tnZVTU3Nso0bNy5btWrV0tdff/2tJ598cvG999672noAAADYFgpgAACAhPne977X6a9Fb/v27Xu1bNmyV1lZWa8kvXOXLauvr9/wl7/8ZdG6desWL1u2bNHChQsX/fGPf1w8derUjbYDAADAliiAAQAAmqhsNps59dRTuxx66KH9+/Tp87n27dv3Ly8v719UVOSRzXlq06ZNKzZu3Pj6+++//8abb775xqOPPvrG3XffvcpmAAAA+CsFMAAAQBNx6qmndvniF784qHfv3v3btWv3uYqKis8VFhaW2wxbUl9fv37Dhg1vfPDBB68vXrz4jccee2z+jTfeuNxmAAAA8pMCGAAAYBc45phjWn/rW9/aq3///kPatGnTv6Kiop9HOLO9NDQ0VG/cuPGtNWvWLFy4cOGcO+6445WHHnporc0AAACknwIYAABgJzjjjDO6f+lLX9qrV69eg1u3bj2orKysR0RkbIadJFddXb103bp18xcvXjz30UcffeXqq69+x1oAAADSRwEMAACwnZWWlhb86le/2u3QQw8d1r17931btmw5qLCwsMxmaEoaGhqqP/zww/nvvPPOzGeeeWbW2LFj36ipqWm0GQAAgGRTAAMAAGwHP/7xj7t+9atf3bdXr15D27Ztu1c2m21jKyRJXV3dmg8++OCVRYsWvfznP/95xh/+8IdltgIAAJA8CmAAAIBtcOKJJ7Y75ZRTDujXr9+w1q1bD81ms61shTSpq6tbt3bt2pfffPPNWbfccsvUe++9d7WtAAAANH0KYAAAgE+hoqKi4IILLhg0YsSI/bp27bpfy5YtB2YymUKbIR/kcrmGDz/8cP6777474/nnn59x4YUXvrZx40aPiwYAAGiCFMAAAAAf4/jjj2/7/e9//8D+/fsf2Lp1630KCgpKbAUiGhsbN61fv37eW2+9NeWGG2545u67715lKwAAAE2DAhgAAOB/ZLPZzAUXXPC5I4888sDu3bsfWFFRsVtEFNgMbFl1dfWSd999d8qsWbNmnnvuuS+vW7euwVYAAAB2DQUwAACQ10pLSwsuvfTSQYcccsjBXbt2HVFWVtbDVmDb1dbWrnr//fdfmDp16uRf/vKXL65evbreVgAAAHYeBTAAAJB3Bg0aVHrBBRd8fs899zywQ4cOBxQVFbWwFdj+Ghsba9euXTtrzpw5T59//vmTX3755WpbAQAA2LEUwAAAQF4YNmxY8/POO+/gIUOGHOZ9vrDz/W0ZfNFFFz07a9asKlsBAADY/hTAAABAarVq1arwyiuv3HfEiBEjO3TocFBhYWGZrcCu19DQUP3+++8/O2XKlIk/+clPZm7cuLHRVgAAALYPBTAAAJAqrVq1Kvztb3+7/3777Xd4x44dRxQWFpbbCjRdDQ0NG99///0pM2bMeOqHP/zhC8pgAACAz0YBDAAApMJZZ53V45vf/OaRvXr1GllaWtrVRiB5ampq3l28ePHEO++8c9LVV1/9jo0AAABsPQUwAACQWMOHDy+/6KKLvjB48OCjW7RoMdBGID0+/PDDV+fNmzfhvPPOe3L69Ol/sREAAIBPRwEMAAAkSqtWrQpvuOGGQ/bbb79/atOmzX6ZTCZrK5BeuVyubs2aNTNmzJjx2JgxYyavW7euwVYAAAA+ngIYAABIhB//+Mddv/e9732lZ8+e/1RcXNzWRiD/1NbWfvD2228/dssttzz029/+9l0bAQAA+L8UwAAAQJNVUVFRcO21137+4IMPPrZ169b7ZTKZAlsBIqJxzZo1M59//vnxp5122hR3BQMAAPx/CmAAAKDJOeWUUzqefvrpx/bu3ftL2Wy2jY0AH6e+vn7j0qVLH/vd7373x+uvv36ZjQAAAPlOAQwAADQJ2Ww2c+uttx5wyCGHnNC6deu9I8LdvsDWaFy7du1L06ZN+/OPfvSjZ1evXl1vJQAAQD5SAAMAALtU//79S6655pp/2nPPPY8tLy/vayPAZ1VTU7NswYIF488999wHp06dutFGAACAfKIABgAAdomf//znPU855ZQTu3btemRhYWGZjQDbW2NjY92KFSuevOWWW+689NJLF9kIAACQDxTAAADATuMxz8Cusn79+rlPP/30f5188slT6+rqcjYCAACklQIYAADY4fr27Vv8hz/84a+Pee5nI8CuUlNT8+68efPu/8EPfvDgwoULN9kIAACQNgpgAABghxkyZEjpNddc89XBgwefWFxc3MFGgKaitrZ21dy5c+/5yU9+8uc5c+bU2AgAAJAWWyqAPYoNAADYJqNHj+4wb968n06ZMuXRYcOGnaH8BZqa4uLi9sOGDTtjypQpj86bN++nJ510UntbAQAA0s4dwAAAwFY599xze33/+9//dufOnY/IZDJZGwGSIpfL1S1fvvzJG2644fbLLrvsbRsBAACSyiOgAQCAz+y8887r+53vfOfbHTt2PDyTyRTaCJBUuVyuYcWKFU/cdNNN//XrX/96sY0AAABJowAGAAC22WWXXTboG9/4xg9at249zDaAtFm7du2su++++9pzzjnnNdsAAACSQgEMAABsNcUvkE8UwQAAQJIogAEAgE9N8Qvks7Vr18665557rvv5z38+3zYAAICmaksFcGHlwOj6UV9orIqoWZG1PQAAyBO/+MUvet9xxx3nHHrooT8pLS3tYiNAPiotLe2y7777HvP973+/X1lZ2ZIpU6assxUAAKCpKetcHwXlH/01BTAAAOS5M844o/u99957zpe//OWflZeX94qIjK0AeS5TXl7e8+CDDx71/e9/v3dEvDVjxowPrQUAAGgqFMAAAMD/ceKJJ7a77777fjJq1Kh/KS8v7xOKX4B/lCkvL+99+OGHj/rWt77VfvXq1Qvnz59fbS0AAMCutqUC2DuAAQAgzwwdOrTs+uuvP6l///4nFRYWltkI20NjY2Ns2rQpqquro6amJurr62PTpk2xefPmqK+vj+rq6qivr4/NmzfHpk2boqGhYZv/fxUWFkZJSUk0a9YsioqKoqysLIqKiqJZs2ZRUlISRUVFUVpa+r9/FRQUCIjtoqGhoeq11167a8yYMffMmTOnxkYAAIBdZUvvAFYAAwBAnujUqVP2nnvuGbXXXnudnM1mK22Ej9PQ0BAbN26MDRs2/J+/Nm7cGBs3boyamprYtGlTbNq0KWpqaqK2trbJnqe4uDhKSkqitLT0f/9eUVERFRUV0aJFi//zV0VFRRQWFvog8LHq6urWvvjii7eceOKJf169enW9jQAAADubAhgAAPLcXXfdddAXv/jF00tLS7vZRn7L5XKxYcOGWLt2baxbty7Wrl37d3+tW7cuNmzYkPd7atGiRbRu3TpatWoVrVu3jjZt2vzvf27dunW0aNHCh4morq5e+sgjj1zzne98Z6ptAAAAO5MCGAAA8tTVV189+MQTTzyzoqJioG3kj8bGxli5cmUsX748Pvjgg1i9evX//n3t2rXR2NhoSZ9RYWFhtGrVKtq1axdt27b937937tw5OnTo4LHTeWbDhg3z77333qvOPPPMebYBAADsDApgAADIM1/72tfaXHrppad27979qIjQRKVUQ0NDrFq1KlasWBHvv//+//595cqVTfqRzGlXXFwcHTp0iI4dO0bnzp2jY8eO0alTp2jXrp1HS6dYLpdrfOeddx76+c9/fv2ECRPW2QgAALAjKYABACBP9OrVq9ldd931jT322OM7hYWFZTaSHh9++GG88847sXTp0njvvfdixYoVsXr16mhoaLCchCgsLIz27dtHp06dolu3btG9e/fo3r27x0mnTENDQ9W8efNu++Y3v/nHJUuWbLYRAABgR1AAAwBAHrjrrrtG/NM//dOZJSUlXWwj2davXx9Lly6Nd955539L3w8//NBiUqqysvJ/y+C//tWqVSuLSbiamppljz322G9Gjx49xTYAAIDtTQEMAAAp9qtf/arPD3/4w5+1atVqL9tIno0bN8aSJUvirbfeikWLFsV7770XmzZtspg8V1JSEl27do0+ffpE3759o3fv3lFeXm4xCbRu3bqXr7322ivGjh27yDYAAIDtRQEMAAApNGjQoNI77rjju7vttttJBQUFWRtJhtWrV8ebb74ZixcvjiVLlsTy5cujsbHRYtiigoKC6Ny5c/Tu3Tt69+4d/fr1i7Zt21pMQjQ2Nta98cYbd33rW9+6ff78+TU2AgAAfFYKYAAASJHS0tKCBx988Jj99tvvn7PZbBsbaboaGhri7bffjrfeeisWLFgQS5YscXcv201FRUX06tUr+vbtG3379o2ePXtGYWGhxTRhdXV1a2bMmHHjV77ylYdqamr85gcAALDNFMAAAJASp59+erdf/vKX51ZWVu5jG03T6tWr47XXXouFCxfGm2++GRs3brQUdooWLVpE3759Y8CAATFw4EB3CDdh69evf/E//uM//vPqq69+xzYAAIBtoQAGAICEGzRoUOm99977w969ex+byWTc4teErF+/PubNmxcLFiyIN954Q+FLk9GiRYvo169fDBgwIPbYY4+orKy0lCYkl8s1LF68eNyJJ554rcdCAwAAW0sBDAAACXbNNdcMOemkk35RVlbWyzZ2vVwuF++++27MnTs3XnvttViyZIl3+NLkFRQURK9evWLQoEExePDg6Natm6U0EdXV1UvuvvvuX//kJz+ZYxsAAMCnpQAGAIAEOuqoo1r99re//VmHDh0Ot41da9OmTTF79uyYO3duLFy4MKqqqiyFRGvevHn0798/Bg8eHHvuuWeUlJRYyi62cuXKp04//fTLJ0yYsM42AACAT6IABgCAhBk3btwRRxxxxFnZbLaNbewaVVVVMXfu3Jg7d27Mnz8/amtrLYVUKi4ujoEDB8bgwYNj8ODBUV5ebim7SF1d3ZqnnnrqqlGjRj1hGwAAwJYogAEAICFOOeWUjhdddNEvW7duvZ9t7HwrV66MWbNmxdy5c+Odd96JXC5nKeSdzp07x9577x3Dhg2LDh06WMgusHbt2hnnnXfepbfccsv7tgEAAHwUBTAAADRxpaWlBU899dQ3Bw8e/L2CggLPYt2JVqxYES+99FK89NJLsXz5cguBv/HXMnjvvfeOTp06WchO1NjYuGnu3Lk3H3744XfV1NR40TgAAPB3FMAAANCEjR49usOll176yzZt2gy3jZ1j/fr18eKLL8bMmTNj6dKlFgKfQs+ePWPfffeNYcOGRYsWLSxkJ1mzZs0L55577q/vvvvuVbYBAAD8lQIYAACaoIqKioKJEyd+c/Dgwd8vKCgotpEda8OGDfHiiy/G9OnTlb7wGfXo0SOGDx8ew4YNi4qKCgvZwdwNDAAA/CMFMAAANDGnnHJKx7Fjx/5rZWXlMNvYcerr6+PVV1+NGTNmxLx586Kurs5SYDvKZrMxZMiQ2HfffWP33XePwsJCS9mB1q5dO+MXv/jFv995550rbQMAAPKbAhgAAJqIbDabeeKJJ47fZ599fuSu3x0jl8vFwoULY/r06TF79uzYtGmTpcBOUFpaGkOGDInhw4fHgAEDLGQHaWhoqJ42bdo1Rx555J9tAwAA8pcCGAAAmoDjjz++7ZVXXvmr1q1be9fvDrBmzZqYNm1azJw5M1audHMc7EodO3aMz3/+87H//vt7X/CO+3fetDPPPPOScePGfWAbAACQfxTAAACwi9100037HXvssf9WXFzc1ja2n1wuF6+99lo8//zzMW/evKivr7cUaEKKiopizz33jBEjRsTnPve5yGQylrId1dbWrvrjH/948Q9+8INZtgEAAPlFAQwAALvIkCFDSu+///5zunTp8k+2sf2sXbs2Jk+eHNOnT48PP/zQQiABKisrY8SIEXHIIYdEeXm5hWxHy5Yte+zrX//6f86ZM6fGNgAAID9sqQAurBwYXT/qC41VETUrsrYHAADb6IILLtjt97///VVt2rQZZhvbx+LFi2P8+PFx9913xxtvvBG1tbWWAgmxadOmeOONN+LZZ5+NtWvXRps2bTweejtp0aJFv5NOOumg0tLSuc8+++xaGwEAgPQr61wfBR/zu7XuAAYAgO0sm81mJk2a9PVhw4b9pKCgwG9VfkZ1dXUxY8aMeOaZZ+K9996zEEiRfv36xSGHHBJDhw6NgoICC/mMGhsbN8+YMeOaL37xi+Pq6upyNgIAAOnlEdAAALCTHH/88W2vuuqqCyorK/exjc9mzZo18dRTT8XUqVNj06ZNFgIpVlFREZ///OfjsMMOi8rKSgv5jNavXz/r9NNPv3DcuHEf2AYAAKSTAhgAAHaC22677fNf+9rXzstms5W2se0WLVoUjz/+eMybNy9yOTewQT4pKiqKIUOGxBFHHBG9e/e2kM+grq5u3QMPPHDRySefPM02AAAgfRTAAACwA1VUVBQ8/fTTpwwcOPCUTCbjGabbIJfLxauvvhpPPvlkLFy40EIgz2UymRgwYEAcccQRMWjQIAvZ9n+3Ns6fP/+Www8//JaNGzc22ggAAKTHlgrgwsqB0fWjvtBYFVGzwuvKAABgS0488cR2EyZMuLx79+5fzmQyGRvZOo2NjTFr1qy49dZb48knn4wPPvC0UuC/rV69OmbMmBFz5syJ0tLS6NSpU/jX7NbJZDKZ9u3bD/3+978/dPny5TNfffXValsBAIB0KOtcHwXlH/O9gDuAAQBg29x66637H3vssRcWFRW1sI2tU1NTE0899VQ8++yzsWHDBgsBPlGLFi3i4IMPjsMPPzxKS/28YmvV19d/OG7cuPNPPvnk6bYBAADJ5xHQAACwHWWz2cyzzz77rSFDhvzAI5+3zqZNm2Ly5Mnx1FNPKX6BbdKiRYs47LDD4pBDDlEEb6VcLtfwyiuvXHfooYfeWVdX5yXrAACQYApgAADYTo455pjW11133cWVlZV728ant2HDhnj88cdjypQpUVtbayHAZ1ZcXBwHHnhgfPGLX4wWLTyIYWusWbNm2re//e3zn3nmGb+JAwAACeUdwAAAsB1cfvnlu1900UW/LS8v72cbn05VVVVMmDAhbrnllnjzzTejoaHBUoDtoqGhIZYsWRLPPfdc1NTURI8ePSKb9XOMT6OsrKzb17/+9SPbtm0774knnlhtIwAAkMDreu8ABgCAz+bhhx/+8qGHHnpOQUFBsW18sk2bNsUzzzwTTzzxRFRVVVkIsMOVl5fHkUceGYccckgUF/tX9afR2Ni46emnn/71Mccc87htAABAsngENAAAbKN27doVTZ48+YxevXodZxufrK6uLp5++umYOHGi4hfYJSoqKuKLX/xiHHzwwe4I/pQWLVr0x4MOOuiadevWeUwDAAAkhEdAAwDANjj22GPbPvzww7/p2LHjobaxZXV1dfHkk0/GddddF3Pnzo26ujpLAXaJzZs3x2uvvRbPPfdcRET06NEjCgsLLWYLWrduvfv3vve9fd9+++1pCxYsqLYRAABo+rb0CGgFMAAAfITLL7989wsuuOB3zZs372UbH6+xsTGmTJkS119/fbzyyiuKX6DJ2Lx5cyxYsCCmT58excXF0a1bt8hkMhbzMUpKSjp8+ctfPrJt27ZzvBcYAACaPu8ABgCArTB+/Pgjv/CFL/xLQUFBiW18vAULFsT48eNj6dKllgE0eT169IivfOUrMWjQIMvYgsbGxpqJEydecuyxxz5pGwAA0HR5BzAAAHwK7dq1K3ruued+1qNHj6/axsdbtGhR3H///bF48WLLABKnV69ecdxxx0WfPn0sYwuWLl3654MOOujy1atX19sGAAA0Pd4BDAAAn2DYsGHNn3766V936tTpC7bx0TZs2BD33Xdf/PGPf4y1a9daCJBI69evj2nTpsW6deuiZ8+eUVLiYQ8fpbKysv+3v/3t/lOmTJmyfPlyz/cHAIAmxjuAAQBgC372s5/1uP76669t0aKF54J+hJqamhg/fnzcfPPN8fbbb0cul7MUINFyuVy888478cwzz0RVVVX07t07slk/A/lHZWVl3U488cTD6+rqZkyfPv1DGwEAgCZ0va4ABgCAj3bFFVfscdZZZ11dXFzcwTb+Xi6XixkzZsR1110XCxYsiMbGRksBUqWxsTGWLFkSM2bMiPLy8ujSpUtkMhmL+RvZbLbFQQcddHibNm1mP/HEE6ttBAAAmoYtFcDeAQwAQN6aNGnSqAMOOODsTCZTaBt/b9GiRXHPPffEu+++axlA3ujWrVucdNJJ0bt3b8v4B7lcrm7y5Mm//vKXv/yIbQAAwK63pXcAK4ABAMg7paWlBTNnzjyzT58+x9vG39uwYUOMGzcuZsyY4VHPQF7KZDKx3377xde//vWoqKiwkH+waNGiP+27775X1dTUeCwEAADsQgpgAAD4H926dctOnjz5V506dRppG/9fLpeLqVOnxp///OfYuHGjhQB5r6KiIkaNGhX777+/x0L/g+XLlz9+6KGHXvLuu+/W2QYAAOwaWyqAvQMYAIC8MXz48PInnnjiynbt2o2wjf/vnXfeiWuvvTaee+652Lx5s4UARMTmzZtjzpw58dprr0XPnj2jRYsWlvI/Kioq+n7rW98aMnXq1Ofee+89f3AAAMAusKV3ACuAAQDIC9/+9rc73n777X9o0aLFANv4b1VVVXHXXXfFvffeG+vXr7cQgI+wbt26eP7552P9+vWx2267RVFRkaVERElJSefjjjvuoA8++GDKK6+88hcbAQCAnUsBDABAXjv//PP7XXzxxX8oKSnpbBv/bfr06XHttdfGokWLLAPgU3jnnXdi2rRp0bp16+jc2R8nERHZbLbyC1/4whElJSUvTp48eY2NAADAzqMABgAgb/3ud7/b60c/+tFVRUVFrWwjYs2aNXHzzTfHpEmTora21kIAtkJtbW289NJL8c4770Tfvn2jtLQ073dSWFhYNnz48C/26dNn4UMPPbTMpwQAAHYOBTAAAHnp1ltv3f+b3/zmfxYWFjbP913kcrl4/vnn4/rrr4/ly5f7cAB8BitXroxp06ZFRUVFdOvWLTKZTF7vo6CgIDto0KBDBw0atOiBBx54xycEAAB2vC0VwJmex8Z+H/WF+pURa17ym6wAACTTww8//KXDDjvsXzKZTN6/rPGDDz6I22+/Pd544w0fDIDtbMCAAfGtb30r2rRpk/e7yOVyjVOmTPn1yJEjH/LJAACAHavN3jVR1OGjv6YABgAgdV555ZXTPve5z30r3/fQ0NAQjz32WDz++ONRV1fngwGwg2Sz2Tj66KPjC1/4QhQUFOT9Pl5//fU79tprr9/7ZAAAwI6jAAYAIC9ks9nMyy+/fFafPn2Oz/ddvPvuu3HbbbfFe++954MBsJN069YtvvOd70S3bt3yfhdLliy5f5999rmypqam0ScDAAC2PwUwAACpV1paWjBr1qyzevfufVw+7yGXy8WTTz4ZDz74oLt+AXaBbDYbxxxzTBxxxBF5fzfw0qVLHxg6dOjlSmAAANj+FMAAAKRar169mk2ePHlsu3btDsrnPaxcuTJuueWWePvtt30oAHaxnj17ximnnBIdOnTI6z2sXr16yiGHHPIvS5Ys2exTAQAA28+WCuDCyoHR9aO+0FgVUbMia3sAADRpQ4cOLXvqqacub9Omzf75uoNcLhfPPPNMXH/99bF27VofCoAmYP369TFlypQoKSmJnj17RiaTycs9NG/evPtJJ500ZPLkyc+sWLHCoykAAGA7KetcHwXlH/01BTAAAIk1ZMiQ0kceeeSKVq1a7Z2vO6iuro7bb789nnjiiWhs9IRNgKaksbEx5s+fH++//34MGDAgstn8/DlLaWlpp6997WuDn3rqqadXrlxZ75MBAACfnQIYAIDUOfTQQ1s8+OCDv2/ZsuUe+bqDOXPmxNVXX+2RzwBN3PLly+OFF16Ijh075u0joUtLSzudcMIJ+7/00ktPv/3227U+FQAA8NkogAEASJVhw4Y1v++++37TsmXLQfl4/vr6+hg/fnz88Y9/jNpaP0MHSILNmzfHiy++GJs3b47ddtstCgoK8m4HxcXFbY866qg9n3vuuaeXL1/ucdAAAPAZKIABAEiNI488snLcuHG/b9GixcB8PP97770XV111VcyZM8eHASCBFi1aFC+//HL069cvWrRokXfnLykp6XDcccftP2fOnGcWLVq0yScCAAC2jQIYAIBUOPLIIyvvvPPO35aXl++Wj+d/+umn48Ybb4wPP/zQhwEgwf7yl7/ECy+8ECUlJdGrV6+8O3+zZs3aHHXUUfspgQEAYNspgAEASLxjjz227W233faH5s2b98m3s1dVVcXNN98cTz31VDQ2NvowAKRAY2NjzJ8/P5YtWxYDBgyIZs2a5dX5mzVr1uaYY4458M0333xm4cKFNT4RAACwdRTAAAAk2qGHHtritttuuzofy9+33347rrnmmli8eLEPAkAKvf/++/HKK69Enz59orKyMq/Ons1mK4888sh9Zs6c+dTSpUs3+zQAAMCnpwAGACCxjjjiiJb33nvvteXl5f3y6dy5XC4mTZoUN998c1RVVfkgAKRYVVVVTJ06NbLZbPTp0ycymUzenL24uLjtV7/61c+/8sorTy1evLjWpwEAAD4dBTAAAIl06KGHtrj33nt/l2/lb3V1ddx0000xefLkyOVyPggAeSCXy8WCBQvi3Xffjd133z2y2fz5mUyzZs1aH3300fvNmDHjSXcCAwDAp6MABgAgcYYOHVo2fvz4qysqKgbk07mXLVsWV111lUc+A+SplStXxiuvvBKf+9znoqKiIm/O3axZszZHH3300GeeeebJFStW1PkkAADAlimAAQBIlCFDhpQ++uij17Rs2XL3fDr31KlT49prr42NGzf6EADksaqqqpg+fXq0bds2unTpkjfnLikpaT9q1KihTz755JMrV66s90kAAICPt6UCuMB6AABoSjp16pSdMGHCv1dWVu6RL2dubGyMcePGxR133BF1dW56AiCitrY2br755hg/fnw0NjbmzbkrKyv3mDBhwr9369bNXQkAALCNFMAAADQZrVq1Kpw+ffolbdq02T9fzlxdXR2/+93vYtKkSd73C8DfyeVy8fjjj8fvf//7qK6uzptzt2nTZv8pU6Zc0qpVq0KfAgAA2HoKYAAAmoSKioqC2bNnX9KuXbuD8uXMS5cujYsuuijmz5/vAwDAx3r11VfjoosuiqVLl+bNmdu1a3fQ7Nmz/72iosLPrgAAYCu5iAYAoEmYOXPmz9q1a3dIvpz35ZdfjiuuuCLWrVsnfAA+0bp16+KKK66Il19+OW/O3K5du4Nnzpz5M+kDAMDWUQADALDLvfjii2N69OgxKh/Omsvl4oEHHogbbrghamtrhQ/Ap1ZbWxs33HBDPPDAA3nz2oAePXqMevHFF8dIHwAAPj0FMAAAu9SkSZO+NnDgwFPy4ax1dXVx8803x8SJE73vF4BtksvlYuLEiXHLLbdEXV1dXpx54MCBJ0+aNOlr0gcAgE9HAQwAwC7z6KOPHnXggQeekw9nXbduXfz617+OWbNmCR6Az2zmzJnx61//Ol9eJZA58MADz3n00UePkjwAAHyywsqB0fWjvtBYFVGzImtDAADsEDfeeOO+Rx999EWZTKYw7Wddvnx5XHXVVbFy5UrBA7DdbNiwIWbPnh0DBw6MioqKtB8307179/179uz56sMPP7xc+gAA5LuyzvVRUP7RX1MAAwCw011xxRV7fPe7372qoKCgWdrPOmfOnPjtb38bGzduFDwA2111dXVMmzYtOnfuHB07dkz1WTOZTOHuu+9+eJs2bV6aNGnSKukDAJDPFMAAADQZZ5xxRvef/exnvy0sLCxP+1knTJgQd999d9TX1wsegB2moaEhXnrppchms9G3b99UnzWTyRTttddeB/3lL395dubMmRukDwBAvlIAAwDQJBx00EEVf/jDH64pLi7ulOZz5nK5eOCBB+Kxxx4TOgA77c+eBQsWRF1dXfTv3z8ymUxqz1pQUFBywAEHDJs+ffqkpUuXbpY+AAD5aEsFcIH1AACwMwwaNKj0vvvuu7qsrKxXms9ZV1cX1113XUyaNEnoAOx0EydOjOuvvz7q6upSfc6ysrJef/rTn67u379/idQBAODvKYABANjhKioqCh577LGLKyoqBqb5nNXV1XHNNdfE7NmzhQ7ALvPKK6/ElVdeGVVVVak+Z4sWLQZOnDhxbEVFhZ9vAQDA33CBDADADjdz5syftW3b9sA0n3HdunVx2WWXxRtvvCFwAHa5xYsXx2WXXRZr165N9TnbtWt34MyZM38mcQAA+P8UwAAA7FBPPvnkqB49eoxK8xlXrVoVV1xxRSxfvlzgADQZK1asiCuuuCJWrlyZ6nP26NFj1KRJk0ZJHAAA/lth5cDo+lFfaKyKqFmRtSEAALbZjTfeuO+XvvSlCzOZTGp/8fDdd9+NK6+8MtatWydwAJqc6urqmDVrVvTv3z8qKytTe85u3boN79mz57yHH37Yb2MBAJAXyjrXR0H5R39NAQwAwA5x3nnn9T311FOvLigoKE7rGV977bW45pprorq6WuAANFmbN2+OGTNmRI8ePaJ9+/apPGMmkykYNGjQIYWFhVOee+45v5UFAEDqKYABANipjjrqqFb/8R//8YdmzZq1SusZX3755bj++uujrq5O4AA0eQ0NDfHSSy9Fp06dolOnTqk8Y0FBQXbYsGGfnz9//qQ33nhjk9QBAEizLRXA3gEMAMB21a1bt+wNN9zwnyUlJR3TesYpU6bEjTfeGPX19QIHIDHq6+vjxhtvjKlTp6b2jCUlJZ1uuOGG/+jWrZu7GgAAyFsKYAAAtqunn376XyorK/dI6/kmTZoUd955ZzQ2NgobgMRpbGyMO+64I5588snUnrGysnLw008//UtpAwCQrxTAAABsN88///w3unTp8k9pPd/EiRNj3LhxkcvlhA1AYuVyubj//vtTXQJ36dLlS88+++yJ0gYAIB95BzAAANvFTTfdNPzII488L5PJZNJ4vsceeyzGjx8vaABS47XXXotmzZpF3759U3m+zp0779urV695Dz/88DJpAwCQNlt6B7ACGACAz+wXv/hF7x/+8IdXFxQUNEvj+R544IF45JFHBA1A6ixYsCDq6upiwIABqTtbJpPJDBo06ODGxsbnpk6dul7aAACkiQIYAIAd5oADDqj43e9+99tmzZq1TeP5xo0bF5MmTRI0AKm1aNGi2Lx5cwwcODB1ZysoKMjut99+w5577rnH33vvvc3SBgAgLbZUAHsHMAAA2yybzWbuvPPOfyktLe2exvNNmDBB+QtAXpg0aVI89NBDqTxbaWlpj3vuuedfstlsRtIAAOQDBTAAANvs+eef/06HDh0OTePZHn744Xj44YeFDEDeeOSRR+LPf/5zKs/WoUOHw5599tlvSxkAgHygAAYAYJvcd999hw8ePPjUNJ7t/vvvjwkTJggZgLzz2GOPxX333ZfKs+25554/+NOf/nSYlAEASDvvAAYAYKudccYZ3ceMGXN5QUFBcdrONnHixHjkkUeEDEDeWrx4cWSz2ejbt2/ajpbp06fPvn/5y18mz5w5c4OkAQBIsi29A1gBDADAVhk2bFjzG2+88Q/NmjVrl7azPfroo6l99CUAbI2FCxdGUVFR9OvXL1XnKigoKD7wwAP3e/LJJx9dsWJFnaQBAEiqLRXAHgENAMBWuffee39ZWlraPW3nevzxx+PBBx8UMAD8jz//+c8xceLE1J2rtLS0x3333fdLCQMAkFYKYAAAPrVJkyaN6tSp0xEpPFeMHz9ewADwD8aPHx+TJ09O3bk6der0hUmTJn1VwgAApJFHQAMA8Kmcd955fU888cR/z2QyRWk618yZM+Puu+8WMAB8jNdeey06duwYnTt3TtW5unbtuk9BQcHzzz333DopAwCQNN4BDADAZ3LEEUe0vOKKK67NZrOVaTrXyy+/HDfffHPkcjkhA8DHyOVyMXv27OjSpUt06tQpNefKZDJF++yzz/CpU6c+9u67726WNAAASeIdwAAAbLNsNpu55ZZb/q2kpKRjms61YMGCuPnmm6OxsVHIAPAJGhsb4+abb44333wzVecqLS3tcvfdd5+fzWYzUgYAIC0UwAAAbNGkSZO+3rZt2wPTdKZly5bFDTfcEPX19QIGgE+prq4urr322li+fHmqztWuXbsDH3/88VESBgAgLTwCGgCAj3XZZZcN+upXvzo2k8mk5hcH33///bjyyiujqqpKwACwlerq6uLll1+OIUOGRHl5eWrO1aVLl31LS0unPvPMM2ukDABAEngENAAAW61///4lJ5988q8ymUxRWs60YcOG+P3vfx8bN24UMABso40bN8bvfve7VP15WlBQkP3hD394ft++fYslDABA4q9vrQAAgI/y4IMPnl1WVtYrLeeprq6O3/zmN7Fq1SrhAsBntGrVqrjyyiujuro6NWcqKyvr8/DDD58lXQAAkk4BDADA/zF+/Pgju3XrdnRazlNfX5/KdxYCwK60fPnyuO6666K+vj41Z+rRo8dXx40bd4R0AQBIMgUwAAB/53vf+16nI4444py0nCeXy8Vtt90Wb7zxhnABYDt7/fXX47bbbotcLpeaMx155JHnfvvb3+4oXQAAkkoBDADA/6qoqCi4+OKLLywsLCxPy5nGjx8fs2bNEi4A7CCzZs2Khx56KDXnKSwsrPj1r399QUVFhZ+bAQCQSC5kAQD4XxMnThxdWVk5OC3nef7552PixImCBYAd7LHHHosXXnghNeeprKzc89FHHz1RsgAAJFFh5cDo+lFfaKyKqFmRtSEAgDxxwQUX7DZq1KgLM5lMYRrO8+qrr8Ytt9ySqkdSAkBT/7O3d+/e0a5du1Scp2PHjkNzudxzU6ZMWSddAACamrLO9VHwMc/wcwcwAADRt2/f4h//+McXZzKZVPwG4HvvvRc33HBDNDY2ChcAdpKGhoa47rrrYtmyZak4T0FBQfbss88e27dv32LpAgCQqGtZKwAAYPz48T8qKyvrkYazbNiwIX7/+99HbW2tYAFgJ9u0aVP8/ve/j40bN6biPGVlZb3GjRs3RrIAACSJAhgAIM/ddNNNw/v06XN8Gs5SX18f1157baxdu1awALCLrFmzJq699tqor69PxXn69ev3jd///vdDJQsAQFIogAEA8thBBx1Uceyxx/5rRGTScJ477rgjFi9eLFgA2MUWLVoUd955Z1qOU/CNb3zj34YNG9ZcsgAAJOIC1goAAPLXzTfffFZxcXG7NJxl4sSJMX36dKECQBMxbdq0mDRpUirOUlJS0unOO+88Q6oAACSBAhgAIE/913/914FdunT5UhrO8tprr8Wf//xnoQJAEzN+/PhYsGBBKs7SrVu3o2+66abhUgUAoKlTAAMA5KEvfelLlV/5yld+lYazrFixIq6//vpobGwULAA0MY2NjXHdddfFihUr0nCczHHHHfergw46qEKyAAA0ZQpgAIA8dPXVV5+ezWYrk36OmpqauPbaa2PTpk1CBYAmatOmTXHttddGTU1N4s+SzWbb3njjjT+RKgAATZkCGAAgz9x6663Du3Tp8uWknyOXy8Utt9wSK1euFCoANHErV66MW2+9NXK5XOLP4lHQAAA0dQpgAIA8MnTo0LKvfvWrv0jDWSZMmBBz584VKgAkxJw5c+Kxxx5LxVlGjRr1i6FDh5ZJFQCApkgBDACQR+64444fFRcXd0z6OV5++eV45JFHBAoACfPQQw+l4he4SkpKOt5xxx0/lCgAAE2RAhgAIE9cfvnlu/fs2XNU0s/xwQcfxB133JGKR0gCQL7J5XJx2223xZo1axJ/lp49ex57+eWX7y5VAACaGgUwAEAe6NatW/a73/3uv2YymURf/9XX18cNN9wQ1dXVQgWAhKqqqoobb7wx6uvrE32OTCZT8N3vfvdX3bp1y0oVAICmRAEMAJAHxo8ff0pZWVmvpJ/jnnvuiaVLlwoUABJuyZIlcd999yX+HGVlZT3Hjx9/ikQBAGhKFMAAACn385//vOeAAQNGJ/0c06dPjylTpggUAFJi8uTJMWPGjMSfY8CAAaN//vOf95QoAABNhQIYACDFstls5qyzzjo3k8kk+tGEK1asiLvvvlugAJAyd911V6xYsSLRZ8hkMtmzzjrr3Gw2m5EoAABNgQIYACDFxo0b98XKysq9knyG2trauOGGG6K2tlagAJAyf/1zfvPmzYk+R2Vl5V7jxo0bKVEAAJoCBTAAQEoNHz68/OCDDz4t6ee4//77Y/ny5QIFgJRavnx5jBs3LvHnGDFixI+HDRvWXKIAAOxqCmAAgJS69dZbT8tms22TfIYZM2bEc889J0wASLnJkyfHzJkzE32G4uLitrfffvtp0gQAYFdTAAMApNBVV121R48ePb6S5DOsXLky7rrrLmECQJ64++6744MPPkj0GXr27PnVK664Yg9pAgCwKymAAQBSprS0tOAb3/jGT5N8rdfY2Bi333679/4CQB6pqamJ2267LRobG5N8jIJvfvObZ5aWlvqZGwAAu+6i1AoAANJlwoQJX6uoqBiQ5DOMHz8+Fi1aJEwAyDNvvvlmPPjgg4k+Q4sWLQY9+OCDx0gTAIBdRQEMAJAiRx55ZOWwYcN+kOQzzJ07N5544glhAkCemjhxYixYsCDRZxg+fPiPjjjiiJbSBABgV1AAAwCkyBVXXHFyUVFRRVLnr6qqijvvvDNyuZwwASBP5XK5uP3226O6ujqxZygqKmrxm9/85mRpAgCwKyiAAQBS4vzzz+/Xu3fv45J8httvvz0+/PBDYQJAnlu3bl3cfvvtiT5D7969jz///PP7SRMAgJ1NAQwAkALZbDZz6qmn/jyTyST2+m769OkxZ84cYQIAERExe/bsmDFjRmLnz2QyBaeeeurPs9lsRpoAAOxMCmAAgBT44x//eERlZeXgpM6/du3auPfeewUJAPyde+65J9atW5fY+SsrKwf/6U9/+oIkAQDYmRTAAAAJ17dv3+JDDjnkR0k+w9133x01NTXCBAD+Tk1NTdx9992JPsPBBx/8o759+xZLEwCAnUUBDACQcHfdddc3S0pKOiV1/smTJ8e8efMECQB8pLlz58azzz6b2PlLSko63nPPPd+SJAAAO4sCGAAgwb70pS9VDhw48KSkzr9mzZoYP368IAGALXrggQdizZo1iZ2/f//+Jx111FGtJAkAwM6gAAYASLArrrji1MLCwvIkzp7L5eK2226LTZs2CRIA2KJNmzbFbbfdFrlcLpHzFxYWll1++eU/kCQAADuDAhgAIKF+8Ytf9O7evftXkjr/s88+G2+88YYgAYBP5Y033ojnn38+sfN369bt6F/96ld9JAkAwI6mAAYASKgf/vCHP8pkMom8nvvggw/igQceECIAsFXGjRsX69atS+TsmUym4NRTT/2xFAEA2NEUwAAACXTdddcNa9eu3YFJnD2Xy8Udd9wRtbW1ggQAtsqmTZvizjvvTOz8bdq02f+mm27aT5IAAOxICmAAgIQpLS0t+NrXvnZ6Uud/4YUXYuHChYIEALbJq6++GjNmzEjs/Mccc8zpFRUVfiYHAMAO42ITACBhbr/99oMrKip2S+LsGzZsiHHjxgkRAPhM7r///qiqqkrk7OXl5X3/67/+6wgpAgCwoyiAAQASpKKiouCwww47Nanz33vvvYn9YS0A0HRs2LAh7r///sTOf9BBB/1zq1atCiUJAMCOoAAGAEiQ+++//+iysrKeSZx9zpw58dJLLwkRANguXnjhhViwYEEiZy8tLe32xz/+8StSBABgR1AAAwAkRN++fYv33Xfff07i7LW1tXHvvfcKEQDYru6+++6oq6tL5Oz77bffKf379y+RIgAA25sCGAAgIW6++eZRxcXFbZM4+yOPPBJr164VIgCwXa1atSoee+yxRM6ezWbb3njjjV+TIgAA25sCGAAgAYYOHVq21157fSeJs7/33nvxxBNPCBEA2CEmTpwYK1asSOTsQ4YM+c7QoUPLpAgAwPakAAYASIBrr732xKKiosqkzZ3L5eKee+6JxsZGIQIAO0R9fX3cddddkcvlEjd7UVFR5bXXXnuCFAEA2J4UwAAATdwBBxxQMWDAgG8kcfYZM2bEW2+9JUQAYId6880348UXX0zk7AMGDPjG8OHDy6UIAMD2ogAGAGjirrrqqhOKiooqkjb3pk2b4oEHHhAgALBT3H///VFbW5u4uYuKilpcffXV7gIGAGC7UQADADRhBx10UEX//v0Teffvww8/HB9++KEQAYCdYv369TFhwoREzj5w4MBvHHDAARVSBABge1AAAwA0Yf/5n/95bGFhYfOkzb1q1aqYPHmyAAGAnerpp5+O1atXJ27uwsLC8ssuu2yUBAEA2B4UwAAATdQBBxxQMWjQoNFJnP3uu++O+vp6IQIAO1V9fX3cddddiZx99913/+bQoUPLpAgAwGelAAYAaKIuv/zyYwsLC8uTNvfcuXNjwYIFAgQAdokFCxbE3LlzEzd3UVFRi9/97ndflyAAAJ+VAhgAoAkaOnRo2aBBgxL37t+6urr405/+JEAAYJf605/+FHV1dYmbe/fdd//mkCFDSiUIAMBnoQAGAGiCfvOb33ylqKioZdLmfu655xL53j0AIF1Wr14dzz33XOLmLioqann11VcfLUEAAD4LBTAAQBPTq1evZoMHD/5m0uaurq6ORx55RIAAQJPwyCOPRHV1deLmHjJkyLe6deuWlSAAANtKAQwA0MTcdNNNxxQXF7dN2twTJkyIqqoqAQIATUJVVVUifzmtuLi43a233uouYAAAtpkCGACgCWnVqlXhXnvtdVLS5l61alU8++yzAgQAmpTJkyfHqlWrEjf30KFDR7dq1apQggAAbAsFMABAE3LLLbccXlJS0jlpcz/44INRX18vQACgSamvr48HH3wwcXOXlJR0vummmw6VIAAA20IBDADQRGSz2cwBBxzw7aTNvWjRonjppZcECAA0SS+99FIsXrw4cXOPGDHiO9lsNiNBAAC2lgIYAKCJuOaaa/YuLy/vm7S5H3roocjlcgIEAJqkXC6XyLuAy8vL+1111VV7SRAAgK2lAAYAaCK+8pWvfDdpM8+bNy8WLlwoPACgSVu4cGG8+uqrrg8BAMgLCmAAgCbgsssuG1RZWblPkmbO5XIxfvx44QEAifDAAw8k7qklrVu33veSSy7pLz0AALaGAhgAoAkYNWrUCUmbefbs2bFs2TLhAQCJsGzZsnjllVcSN/cJJ5xwovQAANgaCmAAgF3sn//5nzt37NjxiCTN3NjYGA888IDwAIBEGT9+fDQ0NCRq5k6dOn1h9OjRHaQHAMCnpQAGANjFfvSjH30tk8kk6rps2rRpsWrVKuEBAImyatWqeOGFFxI1cyaTKfzpT386SnoAAHxaCmAAgF1o0KBBpX369Plqkmaur6+PCRMmCA8ASKQJEyZEXV1dombu27fvV/r27VssPQAAPg0FMADALnTZZZcdXlRUVJGkmadOnRpr164VHgCQSOvXr48pU6YkauaioqLK3/zmN0dIDwCAT0MBDACwi2Sz2cy+++57UpJmrqurc/cvAJB4jz76aOLuAt5///1PymazGekBAPBJFMAAALvI1VdfPbSsrKx3kmaeMmVKbNiwQXgAQKJt2LAhnn/++UTNXFZW1ueqq67aS3oAAHwSBTAAwC7y5S9/+bgkzVtfXx8TJ04UHACQCo8//nji7gL+0pe+dLzkAAD4JApgAIBdYPTo0R3atm07IkkzT5s2LdatWyc8ACAVPvzww5g+fXqiZm7fvv2I0aNHd5AeAABbogAGANgFfvrTn47KZDKFSZm3vr4+HnnkEcEBAKnyyCOPRH19fWLmzWQyhT/96U+/JjkAALZEAQwAsJN16tQp26dPn6OTNLO7fwGANFq3bl1MmzYtUTP36dPnmE6dOmWlBwDAx1EAAwDsZFddddUB2Wy2dVLmbWxsjEmTJgmOVOvYsWN06OCJmgD5aNKkSdHY2JiYebPZbOurrrrqAMkBAPBxFMAAADvZiBEjvp6keV988cVYtWqV4Ei1Ll26xIUXXhinnXZadO3a1UIA8siqVavipZdecj0JAEBqKIABAHaiM844o3tlZeXeSZk3l8vFxIkTBUdeyGQyMXjw4PjVr34VY8aMcUcwQB55/PHHI5fLJWbeysrKvc8444zukgMA4KMogAEAdqJTTjnlqxGRScq8CxYsiPfee09w5JVMJhN77713XHjhhTFmzJho3769pQCk3HvvvRcLFy5M1B9X/3NdCQAA/4cCGABgJ+nVq1ezXr16fTlJM3v3L/nsr0XwBRdcECeffHK0bdvWUgBSLGnXPb169fpyr169mkkOAIB/pAAGANhJrrjiioOLiopaJmXeBN4JAztEYWFhDB8+PC688MIYPXp0VFZWWgpACi1YsCCWLVuWmHmLiopaXnnllYdIDgCAf6QABgDYSYYPH/6VJM2btHfhwY5WVFQUI0aMiEsuuSRGjx4dLVu2tBSAFMnlcvH4448naub99tvvK5IDAOAfKYABAHaC0aNHd6isrByalHnXrl0bL7/8suDgI/y1CL744ovjhBNOiBYtWlgKQEq89NJLsW7dusTMW1lZudfo0aM7SA4AgL+lAAYA2AlOP/30o5J07fXMM89EQ0OD4GALiouL47DDDouxY8fGqFGjoqyszFIAEq6hoSGeeeaZJI1c8D/XmQAA8P8vEq0AAGDHymazmX79+n05KfPW1tbGlClTBAefUnFxcYwcOTIuvfTSGDVqVJSWlloKQII9//zzUVtbm5h5+/Xr9+VsNpuRHAAAf6UABgDYwX7zm9/sWVJS0jkp886YMSOqq6sFB1uppKQkRo4cGZdcckkcffTRUVJSYikACVRdXR0zZ85M0p8/na+44orBkgMA4K8UwAAAO9gXvvCFLyVl1lwuF08//bTQ4DNo3rx5HHXUUXHJJZfEyJEjI5vNWgpAwjz11FORy+USM++RRx75ZakBAPBXCmAAgB1oyJAhpZ07dz4iKfO+/vrrsWLFCsHBdlBeXh6jRo2KSy+9VBEMkDArVqyI119/PTHzdunS5fD+/ft79AQAABGhAAYA2KHGjh17aGFhYWJeCOruX9j+KioqYtSoUXHxxRfH4YcfHkVFRZYC4LpouyosLGz+H//xHwdLDQCACAUwAMAOteeeex6ZlFnXrl0b8+bNExrsIK1atYrjjz8+LrroohgxYkQUFPh2DKApmzdvXqxZsyYx8+61115HSg0AgAgFMADADnPMMce0bt269b5Jmfe5556LxsZGwcEO1qZNmxg9enRcfPHFimCAJqyxsTGee+65JP35MvyYY45pLTkAAPykAQBgBznzzDMPz2Qyibjeqq+vj6lTpwoNdqK2bdvG6NGj47zzzovhw4crggGaoBdeeCHq6+sTMWsmkyk844wzDpUaAAB+wgAAsIP079//C0mZdc6cObFhwwahwS7QqVOnOPnkk+Pf/u3fYu+9945MJmMpAE3Ehg0bYvbs2YmZd8CAAR4DDQCAAhgAYEf43ve+16mysnKPpMybpMcbQlp17tw5xowZE7/61a8UwQBNyPPPP5+YWSsrKwd/73vf6yQ1AID8pgAGANgBTj755CMiIhHtzcqVK+P1118XGjQRXbt2jTFjxsQ555wTgwcPthCAXez111+PlStXJmXczMknn3y41AAA8psCGABgB+jXr19iHv88ZcqUyOVyQoMmpnfv3nHaaafFOeecE/3797cQgF0kl8vFlClTknQd6jHQAAB5TgEMALCdnX766d0qKip2S8Ks9fX1MW3aNKFBE9anT58466yz4pxzzonddtvNQgB2gWnTpkV9fX0iZq2oqNjt9NNP7yY1AID8pQAGANjORo8efURSZp03b15s3LhRaJAAffr0ibPPPjvOPPPM6Nmzp4UA7EQbN26MefPmuR4FACARFMAAANtZr169EvPetSQ9zhD4bwMGDIhf/vKXceaZZ0b37t0tBGAnmTp1apKuRw+TGABA/lIAAwBsR2eccUb38vLyvkmYdf369fHaa68JDRJqwIAB8S//8i9x2mmnRbdunvQJsKPNnz8/Pvzww0TMWl5e3u9HP/pRF6kBAOQnBTAAwHZ03HHHHZSUWWfMmBGNjY1CgwTLZDIxePDg+Nd//dcYM2ZMdOjQwVIAdpDGxsaYMWNGYub9xje+cYjUAADykwIYAGA76tOnz8FJmDOXyyXqMYbAlmUymdh7773jwgsvjDFjxkT79u0tBWAHeOGFF5J0XXqIxAAA8pMCGABgOznppJPat2zZcvckzLpkyZJYuXKl0CBl/loEX3DBBXHyySdH27ZtLQVgO1qxYkW8/fbbiZi1srJy0PHHH+8PAgCAPKQABgDYTr773e8eGBGZJMyapMcXAluvsLAwhg8fHhdeeGGMHj06KisrLQVgO5k+fXpSRi34/ve/f6DEAADyjwIYAGA72X333Q9Nwpz19fUxc+ZMgUEeKCoqihEjRsQll1wSo0ePjpYtW1oKwGc0c+bMqK+vT8SsAwcOPFRiAAD5RwEMALAdHHTQQRUtW7bcKwmzLly4MKqrq4UGeeSvRfDFF18cJ5xwQrRo0cJSALZRVVVVvP7664mYtVWrVkOHDx9eLjUAgPyiAAYA2A7OPvvsz2cymaIkzOrxz5C/iouL47DDDouxY8fGqFGjoqyszFIAtkFSnqaSyWSy55577uclBgCQXxTAAADbwe67735AEuasra2NOXPmCAzyXHFxcYwcOTIuvfRSRTDANpg9e3bU1dUlYtY99tjjAIkBAOQXBTAAwGfUqlWrwnbt2u2fhFnnzZsXtbW1QgMiIqKkpCRGjhwZY8eOjaOPPjpKSkosBeBT2LRpU8ybNy8Rs7Zv337/iooKPwMEAMgjLv4AAD6jCy+8cPeioqKKJMz64osvCgz4P5o3bx5HHXVUXHLJJTFy5MjIZrOWAvAJZs2alYg5i4qKWlx88cWDJAYAkD8UwAAAn9GBBx6YiMfqVVdXJ+ZOFWDXKC8vj1GjRsWll16qCAb4BPPmzYuamppEzHrQQQd5DDQAQB5RAAMAfEZdu3YdnoQ5582bF/X19QIDPlFFRUWMGjUqLr744jj88MOjqKjIUgD+QV1dXbz66quJmLVLly77SwwAIH8ogAEAPoNTTjmlY3l5+W5JmPXll18WGLBVWrVqFccff3xcdNFFMWLEiCgo8C0kwN966aWXEjFnRUXFbieddFJ7iQEA5AffvQMAfAYnnnji55MwZ21tbcyfP19gwDZp06ZNjB49OsaOHasIBvgb8+fPj9ra2iSMmvnud7/7eYkBAOQH37UDAHwGn/vc5/ZLwpwLFy6Muro6gQGfyV+L4PPOOy+GDx+uCAby3ubNm2PhwoWJmLVfv37DJQYAkB98tw4AsI1atWpV2Lp1672TMKvHPwPbU6dOneLkk0+Oc889NwYNGmQhQF6bPXt2IuZs06bN3hUVFX4WCACQB1z0AQBso/PPP39gYWFheVOfs76+PubMmSMwYLvr2bNn/OQnP4nzzjsv9t5778hkMpYC5J3Zs2dHfX19k5+zqKio4vzzzx8oMQCA9FMAAwBso/3333/fJMz5+uuvR01NjcCAHaZLly4xZsyYOOecc2Lw4MEWAuSV6urqeOONNxIx64EHHriPxAAA0k8BDACwjbp27ZqIxz/PnTtXWMBO0bt37zjttNPinHPOif79+1sIkDeScr3VvXv3vaUFAJB+CmAAgG0wZMiQ0srKyj2a+py5XM7jn4Gdrk+fPnHWWWfFOeecE7vttpuFAKk3e/bsyOVyTX7Oli1b7jlo0KBSiQEApJsCGABgG5x55pl7ZjKZbFOfc9myZbFu3TqBAbtEnz594uyzz44zzzwzevbsaSFAaq1bty6WL1/e5OfMZDLZs846a4jEAADSrcgKAAC23tChQ4clYc558+YJC9jlBgwYEAMGDIgFCxbE+PHjY+nSpZYCpM68efOiS5cuTX7OffbZZ5+ImC4xAID0cgcwAMA26Nix4z5JmHP+/PnCApqMAQMGxC9/+cs47bTTolu3bhYCpEpSrrs6deq0j7QAANJNAQwAsJWOOOKIlhUVFf2a+pxVVVWxaNEigQFNSiaTicGDB8e//uu/xpgxY6JDhw6WAqTCW2+9FVVVVU1+zoqKis8deuihLSQGAJBeCmAAgK108sknD46ITFOfc/78+dHY2CgwoEnKZDKx9957x4UXXhhjxoyJ9u3bWwqQaI2NjbFgwYJE/Cv4u9/97h4SAwBILwUwAMBW2n333fdMwpze/wskwV+L4AsuuCBOPvnkaNu2raUAiZWU66/BgwfvKS0AgPQqsgIAgK3Trl27wU19xlwul5Q7UAAiIqKwsDCGDx8e++yzT0ybNi0mTJgQ69evtxggURYsWBC5XC4ymab9sJgOHToMlhYAQHq5AxgAYCsMGjSotGXLlgOa+pzvvfdebNy4UWBA4hQVFcWIESPikksuidGjR0fLli0tBUiMDz/8MJYtW9bk52zZsuXA/v37l0gMACCdFMAAAFvhxz/+8aBMJtPkn6Li7l8g6f5aBI8dOzZOOOGEaNGihaUAibBw4cImP2Mmk8n+5Cc/GSAtAIB0UgADAGyFvffee88kzJmEHzwCfBrNmjWLww47LMaOHRujRo2KsrIySwGatKT8Il5SrmsBANh63gEMALAVunbtOqSpz1hfXx9vvvmmsIBUKS4ujpEjR8bBBx8czz77bDz++ONRXV1tMUCT8+abb0Z9fX0UFTXtH7t16dJlT2kBAKSTO4ABAD6lioqKgoqKikFNfc4lS5bE5s2bBQakUklJSYwcOTLGjh0bRx99dJSUeIUl0LTU1tbG0qVLm/ycLVu2HFRaWupngwAAKeQiDwDgUzr77LP7FhYWNvlnj7722mvCAlKvefPmcdRRR8Ull1wSI0eOjGbNmlkK4HpsKxQWFpafffbZvaQFAJA+CmAAgE9p//3375+EOV9//XVhAXmjvLw8Ro0aFf/+7/8eI0eOjGw2aymA67FP6fOf//xAaQEApI8CGADgU+rRo8fuTX3G2traePvtt4UF5J2KiooYNWpUXHzxxXH44Yc3+XdvAum2ePHiRLySo1evXoOkBQCQPgpgAIBPqXXr1k3+DoklS5ZEQ0ODsIC81apVqzj++OPj4osvjhEjRkRBgW97gZ2voaEhlixZ0uTnbNOmjQIYACCFfCcMAPApDBkypLR58+a9m/qcb775prAAIqJ169YxevToGDt2rCIYcF32MZo3b95n0KBBpdICAEgX3wEDAHwKp556av9MJtPkr53eeustYQH8jTZt2sTo0aPjvPPOi+HDhyuCAddlfyOTyRT84Ac/+Jy0AADSxXe+AACfwuDBg5v84/Hq6+tj0aJFwgL4CJ06dYqTTz45/u3f/i323nvvyGQylgLsUIsXL07Eqzn23HPPgdICAEgXBTAAwKfQpUuXAU19xnfeeSfq6uqEBbAFnTt3jjFjxiiCgR2utrY23n333SRc53oPMABAyiiAAQA+hZYtW/Zv6jN6/DPAp9elS5cYM2ZMnHvuuTF48GALAfL2+iwJ17kAAGwdBTAAwCcYPnx4eUlJSeemPqfHPwNsvV69esVpp50W55xzTvTvrwMB8u/6rLS0tPPw4cPLpQUAkB4KYACAT/Ctb31rt4ho8s8IXbx4sbAAtlGfPn3irLPOinPOOSd22203CwG2i4T8gl7m29/+dj9pAQCkhwIYAOAT7L777k2+CVi7dm1s2LBBWACfUZ8+feLss8+OM888M3r27GkhwGfy4Ycfxrp165r8nAMHDlQAAwCkSJEVAABsWadOnZr8D8TefvttQQFsRwMGDIgBAwbEggULYvz48bF06VJLAbb5Oq1Vq1audwEA2GkUwAAAn6CyslIBDJCnBgwYEP3794958+bFQw89FO+++66lAFtlyZIlsddeezX1613PvgcASBEFMADAFnTq1CnbvHnzXk19ziVLlggLYAfJZDIxePDg2GOPPeLll1+OBx98MFauXGkxQGqu05o3b967Xbt2RatXr66XGABA8nkHMADAFowZM6ZnJpPJNuUZGxsbPZoUYCfIZDKx9957x4UXXhhjxoyJ9u3bWwrwiZYuXRqNjY1NesaCgoLsqaee2kNaAADp4A5gAIAt2Hvvvfs29RlXrlwZtbW1wgLYSf5aBO+5554xa9asmDBhQqxevdpigI9UW1sb77//fnTu3LlJzzls2LC+EbFIYgAAyecOYACALejRo0eTL4DfeecdQQHsAoWFhTF8+PC48MILY/To0VFZWWkpQGKv15Jw3QsAwKejAAYA2ILWrVs3+ff/vvvuu4IC2IUKCwtjxIgRcckll8To0aOjZcuWlgIk7notCde9AAB8Oh4BDQCwBc2bN+/Z1GdUAAM0kW+wi4pixIgRsd9++8WUKVPiscceiw0bNlgMEO+9914SrnsVwAAAKeEOYACAj9G/f/+SkpKSjk19TgUwQNPSrFmzOOyww2Ls2LExatSoKCsrsxTIc0m4XistLe3Ut2/fYmkBACSfAhgA4GOccMIJ3Zr69dK6deuiqqpKWABNUHFxcYwcOTJ+/etfK4Ihz1VVVcX69eub+pgF3/zmN7tLCwAg+RTAAAAfY8iQIT2b+oxJeJwgQL77axE8duzYOProo6OkpMRSIA8l4botCde/AAB8MgUwAMDH6N69e8+mPqPHPwMkR/PmzeOoo46KSy65JEaOHBnNmjWzFMgjSbhuS8L1LwAAn0wBDADwMVq1atWjqc+4bNkyQQEkTHl5eYwaNSr+/d//PUaOHBnZbNZSIA8k4botCde/AAB8MgUwAMDHqKio6NXUZ1y+fLmgAJL750yMGjUqLr744jj88MOjqKjIUiDFknDd1rJly16SAgBIPgUwAMBHyGazmbKysq5NecbGxsZYtWqVsAASrlWrVnH88cfHxRdfHCNGjIiCAt+qQxqtWrUqGhsbm/SMJSUlXbPZbEZaAADJ5rtKAICPcNxxx7UrKCgobsozrl69Ourr64UFkBKtW7eO0aNHx9ixYxXBkEJ1dXXxwQcfNOkZCwoKio877rh20gIASDbfTQIAfITPf/7zXZr6jO+//76gAFKoTZs2MXr06Dj//PNj+PDhimBIkRUrVrgOBgBgh/NdJP+PvTuPr7I888d/nSwEkhD2HUQEUVRAoIiouCtq64Jabd1arVorbqO2tlXbaavTOu38Rqffdmpbu9rWpYogsqgFRXCttAIKArJDgAAJBLKQ5JzfH8WO4+DOcp6T9/v18jWvTv657ut6hNvnk/t+AICd2G+//bL+xVcSXiAC8PF17do1Lr300rj99ttj2LBhkUq5lRWSLgn7tyTsgwEAeH8FWgAA8H917txZAAxAVujevXtceeWVsXr16njiiSdi9uzZkclkNAYSKAn7tyTsgwEAeH8CYACAnWjXrp0roAHIKj169Igrr7wyli5dGpMmTYo5c+ZoCiRMEvZvSdgHAwDw/gTAAAA7UVxc3D3baxQAAzRPffr0ibFjx8aSJUti/PjxsWDBAk2BhEjC/i0J+2AAAN6fbwADAOxESUlJz2yur7q6Ourq6gwKoBnbb7/94l/+5V/ia1/7WhxwwAEaAglQV1cX1dXV9sEAAOxWAmAAgHc5/PDDSwsKCtpmc40VFRUGBUBERPTt2zduvPHGuOGGG2LffffVEMhy2b6PKygoaDt8+PASkwIASC4BMADAu5x44oldsr3GDRs2GBQA/8uAAQPiG9/4Rtxwww3Ru3dvDQH7uE+yH+5qUgAAyeUbwAAA79KvX7+sD4DXr19vUADs1IABA+LAAw+MuXPnxoQJE2LlypWaAlkkCTe5HHDAAV0i4i3TAgBIJgEwAMC7dO/evXO21+gEMADvJ5VKxaBBg2LgwIExe/bsGD9+fKxbt05jwD4uZ/bDAAC8NwEwAMC7tG/fvlO21ygABuDDSKVSMWzYsBg6dGjMnj07HnvsMbdIwF6WhBPASdgPAwDw3gTAAADv0rp166w/8ZCEF4cAZI+3g+BDDz00XnnllZg4caK/S8A+LtH7YQAA3psAGADgXUpKSrL6xENjY2Ns3rzZoAD4yPLz8+Pwww+P4cOHx/PPPx8TJ06MqqoqjYE9aPPmzdHY2BgFBdn7Wi7b98MAALw/ATAAwLu0bNmySzbXV1lZGZlMxqAA+Njy8/Nj1KhRMXLkyHjhhRcEwbAHZTKZqKqqio4dO9oPAwCwWwiAAQDepaioKKuvvKusrDQkAHaJgoKCGDVqVIwYMSJmzpwZkydPji1btmgM7IH9XDYHwNm+HwYA4P3laQEAwP8YPnx4SX5+fkk21ygABmBXa9GiRRx//PFxxx13xNlnnx0lJSWaAs14P5efn18yfPhwfxAAACSUABgA4B2OOOKIDtleo+//ArC7FBUVxejRo+P73/9+nH322VFcXKwpsBsk4cr1JOyLAQDYOQEwAMA79O3bt1221+gEMAC729tB8B133BGnn356tGrVSlOgme3n9ttvv7YmBQCQTAJgAIB36NSpkwAYAHYoKSmJz3zmM3HnnXfG6NGjo0WLFpoCzWQ/l4R9MQAAOycABgB4hw4dOrTN9hqTcGUgALmlpKQkzj777PjOd74To0aNivz8fE2BHN/PJWFfDADAzgmAAQDeoaysrG221ygABmBvad++fVx00UVx5513xgknnBCFhYWaAjm6nysrK3MCGAAgoQTAAADvUFJS0j6b68tkMlFdXW1QAOxV7dq1i/POOy+++93vxqhRoyIvz+sF+CiSsJ8rLS0VAAMAJJT/QgMAeIfi4uK22VxfXV1dNDY2GhQAWeHtE8F33HGHIBg+gsbGxqirq7MvBgBgt/BfZgAA79CqVausPung9C8A2ahDhw5x0UUXxbe//e04/PDDBcGQA/u6oqIiJ4ABABLKf5EBALxDQUGBABgAPqauXbvGpZdeGt/61rdi2LBhkUqlNAUSuq9r0aJFW1MCAEimAi0AAPgfhYWFZdlc39atWw0JgKzXrVu3uPLKK2P16tXxxBNPxOzZsyOTyWgMJGhfl+37YgAA3psAGADgnZujgoLW2VyfE8AAJEmPHj3iyiuvjKVLl8akSZNizpw5mgIJ2ddl+74YAID35gpoAIAdWrdunZefn98ym2sUAAOQRH369ImxY8fGLbfcEgMGDNAQSMC+Lj8/v1WrVq28OwQASCCbOACAHQYNGlQSEVn9scJt27YZFACJtd9++8UNN9wQX/va1+KAAw7QEJq1BOzr8gYPHlxsUgAAySMABgDY4YADDijJ9hpramoMCoDE69u3b9x4441xww03xL777qshNEu1tbVZX2P//v1LTQoAIHl8AxgAYIeePXtm/QuuJLwoBIAPa8CAATFgwICYP39+jBs3LpYvX64pNBtJ2Nf16NGjxKQAAJJHAAwAsEOnTp0EwACwFwwYMCAOPPDAmDt3bkyYMCFWrlypKeS8JOzrunbtKgAGAEggATAAwA5lZWVZ/4Krrq7OoADISalUKgYNGhQDBw6M2bNnx4QJE2Lt2rUaQ85KQgDcpk0bV0ADACSQABgAYIeysjIngAFgL0ulUjFs2LAYOnRozJ49O8aPHx/r1q3TGHKOABgAgN1FAAwAsENJSUlxttfoBDAAzcXbQfCQIUPi5ZdfjokTJ0ZFRYXGkDOSEAAnYX8MAMD/JQAGANihqKioKNtrrKmpMSgAmpW8vLw4/PDDY/jw4fH888/HE088EZWVlRpD4iUhAG7RokWRSQEAJI8AGABgh8LCwhbZXF86nY7t27cbFADNUn5+fowaNSpGjhwZL7zwQkycODGqqqo0hsTavn17ZDKZSKVSWVtjixYtWpgUAEDyCIABAHbI9gC4oaHBkABo9goKCmLUqFExYsSImDlzZkyePDm2bNmiMSROJpOJhoaGyOaMtbCw0AlgAIAk/neTFgAA7NgYFRRk9QuuxsZGQwKAHVq0aBHHH398HHnkkfHMM8/E1KlTY9u2bRpDomR7AJzt+2MAAN5jH6cFAAA7NkZZ/oLL9c8A8H8VFRXF6NGj49hjj41nnnkmpkyZEjU1NRpDImT7DS8FBQWugAYASCABMADA2xujLH/B5QpoAHhvbwfBRx11VEyfPj2efvrpqK2t1RiymgAYAIDdIU8LAAD+QQAMAMlXUlISn/nMZ+LOO++M0aNHZ/X1uiAABgBgdxAAAwDskO1XQAuAAeDDKykpibPPPjv+7d/+LUaPHh2FhYWagv3dR5Sfn9/SlAAAkkcADADw9sYoL88JYADIMa1bt46zzz47vve978UJJ5wgCMb+7iPIz8/3LwwAQAIJgAEAdkilUlm9N2psbDQkAPiY2rVrF+edd15897vfjRNOOCEKCgo0Bfu7D94f55sSAEDyCIABAHbI9gA4nU4bEgB8Qu3bt/9nEDxq1KjIy/NqBPu799kfp0wJACB5/FcOAMAOXnABQPPRoUOHuOiii+J73/ueIJi9JpPJZHuJ/sUAAEggmzgAgP+R1QFwAl4QAkDidOzYMS666KL41re+FYcffnj4fTDs796xOc7yG3IAANg5mzgAgITsjQTAALD7dOvWLS699NL41re+FcOGDRMEs0dk+xXQeXl5/kUAAEigAi0AAPiHbH/BJQAGgN2ve/fuceWVV8ayZcviiSeeiDlz5mgKzXl/5/AIAEACCYABAHbIZDJOAAMAERGx7777xtixY2PJkiUxYcKEmD9/vqZgfwwAQCIIgAEA/ocr7gCA/2W//faLG264Id56660YP358vPnmm5rCLpPtV0Cn3IUOAJBIAmAAgB2y/QVXtr8gBIBc1rdv37jxxhvjrbfeinHjxsWiRYs0hU/MFdAAANjEAQDsXln9Bs4BDADY+/r27Rs333xz3HDDDdG7d28NIdf3d75BAgCQQE4AAwDskO0nMATAAJA9BgwYEAMGDIj58+fHI488EitXrtQUcnF/5woaAIAEcgIYAGCHVCqVzvL6DAkAssyAAQPi1ltvjbFjx0bPnj01hJza32UScEc1AAD/lxPAAAD/QwAMAHysv6MHDRoUBx98cDz//PMxadKk2LRpk8aQ+P1dtv+CJAAAO+cEMADADul0dr/fEgADQHarr6+PioqK2LZtm2aQE/u7dDrtBDAAQAI5AQwA8D+cAAYAPrK6urp4+umnY9q0acJfcm1/5wQwAEACCYABAP6HEw4AwIfW0NAQ06ZNiyeffDK2bt2qIXxkCfgGsAAYACCBBMAAADtkMpmsDoDz8ny9AwCywdvB71NPPRXV1dUaQs7u7wTAAADJJAAGANgh219wCYABYO9qbGyMGTNmxJNPPhmVlZUawieWn5+f9VtkUwIASB4BMADADplMpiGb6yssLDQkANgL0ul0zJo1KyZPnhwbN27UEHaZgoLsfjXX1NTUaEoAAAncZ2oBAMA/NDY2bs/m+gTAALBnpdPpePnll2Py5Mmxdu1aDWGXa9GiRbb/O1BvSgAAySMABgDYoampSQAMAEQmk4nZs2fH448/HuXl5RpCs93fNTY2CoABABJIAAwAsENDQ0NWv+ASAAPA7vV28PvEE0/E6tWrNYTdLtuvgM72G3IAAHiPfaYWAAD8gyugAaD5mjNnTkyaNCmWLl2qGewx2X4FtAAYACCZBMAAADs0NTU5AQwAzcyCBQtiwoQJ8dZbb2kG9nfv0tDQIAAGAEggATAAwA7Z/oJLAAwAu87ChQtj/PjxsXjxYs1gr8n2K6Cz/RckAQB4j32mFgAA/EO2B8AFBQWRl5cX6XTasADgY1q+fHmMGzcu5s+frxnsVXl5eVkfAG/fvt0JYACABBIAAwDs0NDQkPUnHFq1ahXbtm0zLAD4iFauXBmPPPKI4Jes2tclYH8sAAYASCABMADADrW1tXXZXqMAGAA+mnXr1sX48eNj9uzZkclkNISs2tdlu7q6ulqTAgBIHgEwAMAOW7du3ZrtNSbhRSEAZIP169fHY489JvjFvu4TqK6u3mpSAADJIwAGANihqqpKAAwACbdhw4Z4/PHH45VXXommpiYNwb7uE6isrHT1DABAAgmAAQB22LRpU9a/4GrZsqVBAcBOVFVVxcSJE+OFF16IxsZGDSHrJSEA3rRpkxPAAAAJJAAGANhh3bp1WR8AOwEMAP/bli1bYsKECYJfEicJ+7ry8nIBMABAAgmAAQB2WLZsmSugASAhqqurY/LkyTFz5syor6/XEBInCfu6pUuXCoABABJIAAwAsMP8+fOz/gRwcXGxQQHQrNXU1MSUKVPimWeeEfySaEnY173++uu+AQwAkEACYACAHRYsWFCXyWQaUqlUYbbW2Lp1a4MCoFmqq6uLp59+OqZNmxbbtsmkSL5s39el0+mGpUuXbjcpAIDkEQADALxDU1PTtoKCgrbZWp8AGIDmZvv27TF9+vR48sknY+tWt9GSO7J9X9fU1ORfOACAhBIAAwC8Q0NDw9ZsDoBLS0sNCYDm8ndyTJs2LZ566qmorq7WEHJOtu/rGhsb/YsHAJBQAmAAgHeor6+vbNWqVc9src8JYAByXWNjY8yYMSOefPLJqKys1BByVrbv6+rr66tMCQAgmQTAAADv0NDQkNVvmgXAAOSqdDods2bNismTJ8fGjRs1hJyX7fu6bN8XAwDw3gTAAADvUFdXV5XN9ZWWlkYqlYpMJmNYAOSETCYTr732Wjz++OOxatUqDaFZSKVSUVJSktU11tbWVpkUAEAyCYABAN5h27Ztm7K5vvz8/GjVqlXU1NQYFgCJlslkYvbs2fH4449HeXm5htCstGrVKvLz87O6xq1btzoBDACQUAJgAIB3qK6u3pztNZaVlQmAAUist4PfiRMnxpo1azSEZqmsrCzra9y2bVuVSQEAJJMAGADgHaqqqjZle43t2rWLtWvXGhYAiTNnzpyYNGlSLF26VDNo1tq1a5f1NW7atMkJYACALNbQWBgFjQ0REZFKRSavMJre/pkAGADgHSoqKqqyvcYkvDAEgHdasGBBTJgwId566y3NgITs5zZs2CAABgDIYoUFDf9MejMRqab0/+S+AmAAgHdYtWpV1r/oatu2rUEBkAgLFy6M8ePHx+LFizUD3iEJAfDq1aurTAoAIJkEwAAA77BgwYKsD4CdAAYg2y1fvjzGjRsX8+fP1wzYiST8Ql8S9sUAAOycABgA4B2eeOKJjZlMpimVSuVna41OAAOQrVauXBmPPPKI4Bc+QLb/Ql8mk2l64oknNpoUAEAyCYABAN6huro6vX379g1FRUVdsrVGJ4AByDZr166NCRMmxOzZsyOTyWgIJHw/t3379g3V1dVpkwIASCYBMADAu9TV1a0XAAPAB1u/fn089thjgl/Isf1cXV3delMCAEguATAAwLvU1dVVtGnTJmvrKykpiRYtWsT27dsNC4C9oqKiIiZOnBivvPJKNDU1aQh8BEVFRVFcXJz1+2GTAgBILgEwAMC7bN26dV2XLll7ADhSqVR07Ngx1qxZY1gA7FFVVVUxceLEeP755wW/8DF17NgxUqlU1u+HTQoAILkEwAAA71JVVZX1Jx46deokAAZgj9m8eXM8/vjj8cILL0RjY6OGwCfcx9kPAwCwOwmAAQDeZf369Vn/zbMkvDgEIPm2bNkSU6ZMiZkzZ0Z9fb2GwC7QsWNH+2EAAHYrATAAwLusXr066088JOHFIQDJVVNTE1OmTIlnnnlG8Au7WBJ+kW/VqlUCYACABBMAAwC8y9///ves/+aZABiA3aG2tjYmT54czz77bNTV1WkINNN93KuvvioABgBIMAEwAMC7PPzww+t//OMfN6RSqcJsrbFz584GBcAus3379pg+fXpMnTo1tm3bpiGwG2X7CeB0Ot3w8MMPC4ABABJMAAwA8C7V1dXpurq68latWu2TrTV26NAh8vLyIp1OGxgAH1tDQ0NMmzYtnnrqqaiurtYQ2M3y8vKiQ4cOWV1jfX39mtraWptMAIAEEwADAOxEbW3tmmwOgAsKCqJdu3axceNGwwLgI2tsbIwZM2bEk08+GZWVlRoCe0j79u2joCC7X8fV1NSUmxQAQLIJgAEAdmLz5s2r2rdvn9U1duvWTQAMwEeSTqdj1qxZMXnyZH+HwF7av2W7LVu2rDQpAIBkEwADAOzEpk2bVvfp0yera+zWrVvMmzfPsAD4QG8Hv1OmTIkNGzZoCOzF/Vu227BhwxqTAgBINgEwAMBOrFixYvWwYcOyusYkvEAEYO/KZDLx0ksvxZQpU6K83K2usLd17do162tctWrVKpMCAEg2ATAAwE7Mnz9/9ZgxY7K6xiS8QARg78hkMjF79uyYOHFirFnjMB9kiyT8At+8efP8oQEAkHACYACAnRg3btyab37zm5mISGVrjU4AA7Azc+bMiSeeeCKWLVumGZBlEvALfJlx48atNikAgGQTAAMA7MTrr79e29DQsKmwsLBDttZYXFwcZWVlsWXLFgMDIBYsWBDjx4+PJUuWaAZkobKysiguLs7qGhsaGjYuWLCgzrQAAJJNAAwA8B62bt26vF27dh2yucauXbsKgAGauYULF8b48eNj8eLFmgFZLAm3t2zbtm25SQEAJJ8AGADgPVRVVS1t167d0GyusWfPnrFw4ULDAmiGli1bFo899ljMnz9fMyABevbsmfU1VlZWLjUpAIDkEwADALyHdevWLevTp09W15iEF4kA7ForVqyIRx99VPALCZOEfdvatWuXmRQAQPIJgAEA3sPChQuXHX744VldY69evQwKoJlYtWpVjB8/PubOnRuZTEZDIGGSsG9buHDhMpMCAEg+ATAAwHuYNm3a0ksuuSSra+zevXvk5+dHU1OTgQHkqHXr1sX48eNj9uzZgl9IqIKCgkR8A/jpp59eZloAADmw/9QCAICde+ihhzbcd999W/Pz80uzdjNXUBBdunSJNWvWGBhAjqmoqIiJEyfGyy+/HOl0WkMgwbp27RoFBdn9Gq6xsbH6kUce2WBaAADJJwAGAHgf27ZtW15WVnZwNtfYq1cvATBADqmqqoqJEyfG888/74YHyBFJ+P7vtm3blpsUAEBuEAADALyPLVu2LMv2ALhnz57x0ksvGRZAwm3evDkef/zxeOGFF6KxsVFDIIck4fu/W7ZsWWpSAAC5QQAMAPA+1q9fvyzbT2z06NHDoAASbMuWLTFlypSYOXNm1NfXawjkoCTs19avX7/MpAAAcoMAGADgfSxYsGDh0KFDs7rGfffdN1KpVGQyGQMDSJCampqYMmVKPPPMM4JfyGGpVCr23XffrK9z/vz5C00LACA3CIABAN7Ho48++uYFF1yQ1TWWlJRE586dY926dQYGkAC1tbUxefLkePbZZ6Ourk5DIMd17do1WrVqlfV1/vnPf15kWgAAuUEADADwPiZNmlRVX1+/oaioqGM217nvvvsKgAGy3Pbt22P69OkxderU2LZtm4ZAM9GnT5+sr7G+vr7iySefrDItAIDcIAAGAPgAW7duXZTtAXCfPn3ipZdeMiyALNTQ0BDTpk2Lp556KqqrqzUEmpkkXP+8detWp38BAHKIABgA4ANUVFQs7NChw8hsrjEJLxYBmpvGxsaYMWNGPPnkk1FZWakh0EwlYZ9WUVHh+78AADlEAAwA8AGWLl266MADD8zqGnv16hUFBQXR2NhoYAB7WTqdjlmzZsWkSZNi06ZNGgLNWGFhYfTs2TMR+13TAgDIHQJgAIAPMHPmzEWnnnpqdm/qCgqiZ8+esWzZMgMD2EveDn4nT54cGzdu1BAg9tlnn8jPz0/CfnexaQEA5I48LQAAeH+//OUvV6bT6bpsr7NPnz6GBbAXZDKZePHFF+O73/1u3H///cJf4J+ScP1zOp2u++Uvf7nStAAAcocTwAAAH6C6ujpdXV29uE2bNodkc539+vWL6dOnGxjAHpLJZGL27NkxceLEWLNmjYYAO92fJWCvu7i6ujptWgAAuUMADADwIWzYsGFetgfA/fv3NyiAPeTVV1+NSZMmxapVqzQD2KlUKpWI/dmGDRvmmhYAQG4RAAMAfAiLFy9+o2/fvlldY1lZWXTu3DnWr19vYAC7yYIFC2L8+PGxZMkSzQDeV5cuXaK0tDQJ+9z5pgUAkFsEwAAAH8JTTz31+ujRo7O+zv33318ADLAbLFy4MMaPHx+LFy/WDOBD78uSYMqUKa+bFgBAbsnTAgCAD/aLX/xiTWNjY1W215mUF40ASbFs2bK4++674z/+4z+Ev8BHkoTv/zY0NFTee++9q00LACC3OAEMAPAhNDQ0ZDZv3jy/Q4cOI7O5TgEwwK6xYsWKePTRR2P+fDejArm7L9uyZYs/5AAAcpAAGADgQ1q3bl3WB8AdO3aMNm3axObNmw0M4GNYtWpVjB8/PubOnRuZTEZDgI+lbdu20aFDh0Tsb00LACD3CIABAD6kefPmzTvooIOyvs4DDzwwXnrpJQMD+AjWrVsX48ePj9mzZwt+gV2yH0uCuXPnzjMtAIDcIwAGAPiQ/vznP88/77zzsr7OAw44QAAM8CFVVFTEuHHjBL/ALt+PJcHDDz/sBDAAQA4SAAMAfEgTJ06srK2tXdGqVat9srnOgw8+2LAAPkBVVVVMnDgxnn/++WhqatIQYJdKwq0xNTU1yydNmlRlWgAAuUcADADwEWzYsOHvvXr1yuoAuG3bttG1a9dYu3atgQG8y+bNm+Pxxx+PF154IRobGzUE2OW6desWbdu2TcS+1rQAAHKTABgA4CNYuHDha7169Toj2+scMGCAABjgHbZs2RJTpkyJ5557LrZv364hwG6TlO//Lly48O+mBQCQmwTAAAAfwcSJE/9+wgknZH2dBx54YEyfPt3AgGavpqYmpkyZEs8880zU19drCLDbDRgwIBF1jh8//u+mBQCQmwTAAAAfwb333rv6Bz/4wfqioqLO2VznAQccEHl5eZFOpw0NaJZqa2tj8uTJ8eyzz0ZdXZ2GAHtEXl5e9O/fP+vrrK+vX3ffffeVmxgAQG4SAAMAfESVlZVzu3btmtXHgFu1ahX77LNPLFu2zMCAZqWuri6efvrpmDZtWmzbtk1DgD1qn332iVatWmV9nZs2bZpjWgAAuUsADADwES1dunR2tgfAERGDBg0SAAPNRkNDQ0ybNi2eeuqpqK6u1hBgr+2/kuCtt976m2kBAOQuATAAwEc0ffr0v48cOTLr6xw4cGBMmDDBwICc1tDQEM8991w8+eSTUVlZqSHAXt9/JcG0adP+bloAALlLAAwA8BH9x3/8x9JbbrmlOj8/v3U219mrV68oKyuLLVu2GBqQc9LpdMyaNSsmTZoUmzZt0hBgrysrK4tevXplfZ2NjY1b7rnnnmUmBgCQuwTAAAAfUW1tbXrDhg1/7dKly3HZXGcqlYqBAwfGrFmzDA3IGW8Hv5MnT46NGzdqCJA1Bg4cGKlUKuvr3Lhx4yu1tbVpEwMAyF0CYACAj+Gtt956JdsD4IgQAAM5I51Ox8svvxxTpkyJ8vJyDQGyct+VBIsWLXrFtAAAcpsAGADgYxg/fvwrRxxxRNbXedBBB0VBQUE0NjYaGpBImUwmZs+eHRMnTow1a9ZoCJCVCgoK4qCDDkpErY888ogAGAAgx+VpAQDAR/fjH/94ZX19/fpsr7OoqCj69etnYEAivfrqq3HHHXfEz3/+c+EvkNX69esXRUVFWV9nXV1d+b333rvaxAAAcpsTwAAAH9OGDRte6dGjx6ezvc5BgwbFggULDAxIjCVLlsSECRNi/vz5mgEkwuDBgxNR5/r1653+BQBoBgTAAAAf07x5815OQgA8bNiwePjhhyOTyRgakNXefPPNmDBhQixevFgzgMRIpVIxdOjQRNQ6d+7cl0wMACD3CYABAD6m++677+XRo0dnIiKVzXW2bds2evfuHcuWLTM0ICstW7YsHnvsMSd+gUTq06dPtG3bNgmlpu+9996/mhgAQO4TAAMAfEwTJ06s3Lp165LS0tK+2V7rkCFDBMBA1lmxYkU8+uijgl8g0YYMGZKIOqurqxc+/fTTm00MACD3CYABAD6B8vLyl/fff/+sD4AHDx4c48aNMzAgK6xcuTImTJgQc+fOdT09kHhJ+f7vmjVrfP8XAKCZEAADAHwCM2fOfG7//ff/fLbX2a1bt+jWrVuUl5cbGrDXrFu3LsaPHx+zZ88W/AI5oWfPntGlS5dE1DpjxoznTAwAoHkQAAMAfAK33Xbba5dcckl1fn5+62yvdciQIQJgYK9Yv359PPbYY4JfIOck5frnxsbGzbfddts8EwMAaB4EwAAAn0BlZWXThg0b/tqlS5fjsr3WQw89NCZNmmRowJ78MzKeeOKJeP7556OpqUlDgJxz6KGHJqLOioqKV6qrq9MmBgDQPAiAAQA+oXnz5s1MQgDcu3dv10ADe0RVVVVMnDgxXnjhhWhsbNQQICd17949evbsmZT9quufAQCakTwtAAD4ZP77v/97VkQk4kTFpz71KQMDdpstW7bEQw89FLfffns899xzwl8gpw0fPjwRdWYymfTdd9/9gokBADQfTgADAHxCkyZNqtqyZcuCsrKyg7K91uHDh8fjjz9uaMAuVVNTE1OmTIlnnnkm6uvrNQTIealUKg477LBE1Lply5bXp0+fvsXUAACaDwEwAMAusHz58lkDBw7M+gC4S5cu0atXr1i5cqWhAZ9YbW1tTJ48OZ599tmoq6vTEKDZ6N27d3Ts2DEx+1QTAwBoXgTAAAC7wLPPPvvCwIEDr0hCrcOGDRMAA59IXV1dPP300zFt2rTYtm2bhgDNzrBhwxJT61/+8pcXTQwAoHnxDWAAgF3g1ltvnV9fX782CbUefvjhkUqlDA34yBoaGmLq1Klx6623xuOPPy78BZqlJF3/XFdXt/rWW29dYGoAAM2LE8AAALtAQ0NDZs2aNc/16dPns9lea7t27aJPnz6xZMkSgwM+7J9xMW3atHjqqaeiurpaQ4Bmbb/99ou2bdsmotbVq1fPNDEAgOZHAAwAsIs8++yz05IQAEdEHHHEEQJg4AOl0+mYNWtWTJo0KTZt2qQhABFx5JFHJqbW6dOnTzMxAIDmxxXQAAC7yC233PJaQ0NDZRJqHT58eLRo0cLQgJ1Kp9Px3HPPxW233Rb333+/8Bdgh6KiovjUpz6ViFobGho23HLLLXNNDQCg+XECGABgF6murk6Xl5c/t88++5yR7bW2bNkyDj300Hj55ZcNDvindDodL7/8ckyZMiXKy8s1BOBdhgwZEkVFRYmodc2aNc/V1tamTQ0AoPkRAAMA7EIvvvjiM0kIgCMiRo4cKQAGIiIik8nE7NmzY+LEibFmzRoNAXif/VNSzJo161kTAwBongTAAAC70O233/7KOeecszU/P78022sdMGBAtG/f3tWu0My9+uqrMWnSpFi1apVmALyPjh07xgEHHJCIWhsbG6u/8Y1v/NXUAACaJwEwAMAutHLlyob169fP6tat2+hsrzWVSsXhhx8ekyZNMjhohubMmROTJ0+OJUuWaAbAh3D44YdHKpVKRK3r16+fVVFR0WhqAADNU54WAADsWq+++mpirts77LDDDAyamTfffDP+/d//PX7yk58IfwE+pFQqFSNGjEhMva+88sozpgYA0Hw5AQwAsIvddNNNz5166qnV+fn5rbO91m7dukX//v1j4cKFBgc5btmyZfHYY4/F/PnzNQPgIzrggAOic+fOiai1sbFxy4033jjL1AAAmi8BMADALrZy5cqG8vLyGT179vx0Euo9+uijBcCQw5YvXx7jxo0T/AJ8wv1SUpSXlz9TXl7eYGoAAM2XABgAYDeYMWPGUxdccEEiAuAhQ4ZE69ato7q62uAgh6xcuTImTJgQc+fOjUwmoyEAH1ObNm3i0EMPTUy9zz777FOmBgDQvPkGMADAbvDVr371lYaGhk1JqLWgoCCOOOIIQ4McsW7duvj5z38ed955Z8yZM0f4C/AJjRw5MvLz8xNRa0NDw8abbrrpVVMDAGjenAAGANgNKisrm1atWjW9T58+5ySh3qOPPjqefPJJQREk2Pr16+Oxxx6L2bNn+3cZYBdJpVIxatSoxNS7cuXKadXV1WmTAwBo3pwABgDYTaZNm5aY6/c6duwYAwYMMDRIoA0bNsSvf/3r+Nd//dd49dVXhb8Au9CAAQOiY8eOian36aefftLUAAAQAAMA7CZf+9rX5tTX11ckpd6jjjrK0CBBqqqq4v77749vf/vb8eKLL0ZTU5OmAOxiRx55ZGJqra+vX/eNb3zjdVMDAMAV0AAAu0ltbW16xYoVT++///6fT0K9hx56aLRt2zaqqqoMD7LYli1bYsqUKfHcc8/F9u3bNQRgN2nbtm0MGTIkMfUuX778qdraWtc/AwDgBDAAwO70xz/+cUJSas3Pz4/jjjvO0CBL1dTUxKOPPhq33XZb/OUvfxH+Auxmxx57bOTn5yel3Myvf/3rCaYGAECEABgAYLe66667llZXV89PSr1HH310tGjRwuAgi7wd/H7jG9+IqVOnRn19vaYA7GYtWrSIo48+OjH1btmy5Y177rlnhckBABDhCmgAgN3u9ddfn3T44YcPSEKtxcXFcdhhh8XMmTMNDvayurq6ePrpp2PatGmxbds2DQHYgw477LAoKSlJTL3z5s17wtQAAHibE8AAALvZ9773vanpdLohKfWecMIJkUqlDA72koaGhpg6dWrceuut8fjjjwt/AfawVCoVJ5xwQmLqTafT27/73e8+ZXIAALzNCWAAgN1s+vTpWyoqKmZ26dIlER/Y7d69e/Tv3z/efPNNw4M9qKGhIaZNmxZPPfVUVFdXawjAXnLAAQdE9+7dE1NvRUXFczNmzPAXBwAA/+QEMADAHjBr1qxEXcuXpFMvkHTpdDqee+65uP322+PRRx8V/gLsZccff3yi6p0xY8YkUwMA4J2cAAYA2AO++tWvvnT66adXFRYWtk1CvQMHDoyOHTvGhg0bDA92k3Q6HbNmzYrJkyfHxo0bNQQgC3Ts2DEGDhyYmHobGhoqb7755pdMDgCAd3ICGABgDygvL29YsWLF1MRsEvPy4sQTTzQ42A3S6XS8+OKL8Z3vfCfuv/9+4S9AFjnppJMiLy85r8tWrFgxpaKiotHkAAB4JwEwAMAe8qtf/erRiMgkpd6jjjoqysrKDA52kUwmE6+++mp873vfi1//+texdu1aTQHIImVlZXHUUUcl6q+W//7v//6zyQEA8G4CYACAPeQ///M/l1dWVv4tKfUWFhbGMcccY3CwC7wd/P785z+PNWvWaAhAFjruuOOioCA5X0urqqqa/dOf/nS1yQEA8G4CYACAPeill14al6R6jzvuuCgqKjI4+JjmzJkTd911V/z85z+P1au9owfIVkVFRYn7xbcXXnhhnMkBALAzBVoAALDnjB079pkFCxZUFhYWtktCvSUlJXHEEUfE9OnTDQ8+gjfffDPGjx8fb731lmYAJMCRRx4ZJSUliam3oaFh0zXXXPOsyQEAsDMCYACAPai8vLxh6dKlE/v3739xUmo+8cQT49lnn410Om2A8AEWLVoUjz32WCxevFgzABIiLy8vTjzxxETVvGTJkifKy8sbTA8AgJ3ucbUAAGDP+u1vfzsxIjJJqbdjx44xdOhQg4P3sXz58rj77rvjRz/6kfAXIGGGDRsWHTp0SFLJmd/85jePmxwAAO9FAAwAsIf953/+5/JNmza9kqSaTz/99EilUoYH77Jy5cr4yU9+Et///vdj/vz5GgKQMHl5eXHGGWckquZNmza9fM8996wwPQAA3osroAEA9oKXXnpp/KmnnnpYUurt2rVrDBkyJGbPnm14EBHr1q2L8ePHx+zZsyOTyWgIQEINHTo0OnfunKiaX3jhhQkmBwDA+xEAAwDsBZdffvkzS5YsWVdUVNQlKTWfccYZ8be//U3YRbO2fv36eOyxxwS/ADkglUrF6aefnqia6+rq1lx22WXTTQ8AgPcjAAYA2AsqKyub5s+f/8ihhx56dVJq7tatm1PANFsbNmyIxx9/PF555ZVoamrSEIAc8KlPfSq6du2aqJrfeOONcdXV1WnTAwDg/fgGMADAXvL1r399XDqdrktSzb4FTHNTVVUV999/f3z729+OF198UfgLkCNSqVR8+tOfTlTN6XS69pvf/OZjpgcAwAdxAhgAYC+ZMWNG9Zo1a/7Ss2fPxLx97N69ewwcODDmzJljgOS0LVu2xIQJE+KFF16IxsZGDQHIMYceemh069YtUTWvXr36qRkzZlSbHgAAH8QJYACAvejXv/71HyMiUR8SPeuss5wCJmdt27YtHn300bjtttviueeeE/4C5KC8vLwYM2ZM0srO/OpXv/qT6QEA8KH2vFoAALD3fP/733+rqqoqUR/V7dGjR3zqU58yPHJKfX19TJ06Nb71rW/F1KlTo76+XlMActSIESOiS5cuiap506ZNf73rrruWmh4AAB+GABgAYC975plnHkpazWeccUbk5dlKkjvmzZsXjz76aGzdulUzAHJYQUFBnH766Ymre9q0aQ+aHgAAH5a3dgAAe9nYsWNn1tfXr01SzZ07d47DDjvM8ACARBk5cmR06NAhUTXX1dWtHjt27POmBwDAhyUABgDYyyorK5tee+21Pyat7jPPPDMKCgoMEABIhBYtWiTy9O/s2bP/UF1dnTZBAAA+LAEwAEAWuOqqqyY0NjZWJanm9u3bx9FHH214AEAiHHfccdGmTZtE1dzQ0LDxiiuumGh6AAB8FAJgAIAssGDBgrqFCxc+lrS6R48eHYWFhQYIAGS1li1bxsknn5y4uhcuXDhu6dKl200QAICPQgAMAJAlvv71r/8pnU7XJqnmtm3bximnnGJ4AEBWO+2006K0tDRRNTc1NdV+7Wtfe8j0AAD4qATAAABZ4umnn968fPnyxF3xN3r06GjXrp0BAgBZqUOHDnH88ccnru5ly5ZNmD59+hYTBADgoxIAAwBkkbvvvvtPmUymKUk1FxYWxumnn254AEBWOvPMMxP3yYpMJtN41113/dH0AAD4OATAAABZ5Be/+MWatWvXTkta3UcccUT06tXLAAGArNK7d+847LDDEld3eXn5X+6///51JggAwMchAAYAyDIPP/zwn5JWcyqVijPPPNPwAICsMmbMmEilUomr+8EHH/yT6QEA8HEJgAEAsszXv/71NzZs2DAraXUPHDgwDj74YAMEALLCoEGDYsCAAYmru6KiYuatt966wAQBAPi4BMAAAFlo3Lhxv01i3WPGjIm8PFtMAGDvysvLizFjxiSy9j//+c+/NUEAAD7RflgLAACyz/XXXz+nqqrqr0mru1evXnHUUUcZIACwVx1zzDHRvXv3xNW9adOmV2666aa5JggAwCchAAYAyFJ/+tOf7k1i3WPGjInS0lIDBAD2ijZt2sRZZ52VyNofeOCBe00QAIBPSgAMAJClbrrpprlJPAVcXFwcZ555pgECAHvFWWedFS1btkxc3Zs2bXrl5ptvnmeCAAB8UgJgAIAsNm7cuF8lse5Ro0ZF7969DRAA2KP69OkTI0eOTGTtjz322K9MEACAXUEADACQxcaOHTu7qqrqb0mrO5VKxfnnnx+pVMoQAYA9tv/4/Oc/n8j9R2Vl5d+uueaav5kiAAC7ggAYACDLTZ069bdJrLtv374xZMgQAwQA9ojDDjsssTeQTJ48+TcmCADAriIABgDIcpdeeumLVVVVryax9s9//vNRXFxsiADAblVaWhrnn39+Imuvqqr66+WXX/6SKQIAsKsIgAEAEuChhx76WRLrLisri9NPP90AAYDd6qyzzoqSkpIklp753e9+91MTBABgVxIAAwAkwA033DB3w4YNs5JY+3HHHRd9+vQxRABgt+jbt28cddRRiay9oqJi1te//vU3TBEAgF1JAAwAkBA///nPfxoR6aTVnUql4vOf/3zk5dl6AgC7Vn5+flx00UWRSqWSWH76F7/4xX+bIgAAu5q3cAAACXHHHXe8tW7duulJrL13795xzDHHGCIAsEudcMIJ0b1790TWXl5e/pc77rjjLVMEAGBXEwADACTI3XfffW8mk2lKYu1nnXVWtG3b1hABgF2iQ4cOcfrppyey9kwm03T33Xf/3BQBANgdBMAAAAlyzz33rCgvL386ibW3bNkyzj33XEMEAHaJc889N1q0aJHI2tesWTP1xz/+8UpTBABgdxAAAwAkzA9/+MOfZzKZhiTWPnz48Bg0aJAhAgCfyKGHHhpDhw5NZO3pdLrhBz/4wS9MEQCA3UUADACQMPfee+/qRYsWPZDU+i+++OIoKSkxSADgY2ndunVcfPHFia1/4cKFf7jvvvvKTRIAgN1FAAwAkECXXXbZrxsaGjYlsfaysjJXQQMAH9u5554bpaWliay9oaFh4+WXX/47UwQAYHcSAAMAJNDs2bNrXn311V8ntf4jjjgiDj74YIMEAD6SwYMHx+GHH57Y+l955ZX7Zs+eXWOSAADsTgJgAICEOueccx6tqalZmtT6L7roomjZsqVBAgAfSsuWLeNzn/tcYuuvqalZMmbMmMdMEgCA3U0ADACQUJWVlU3Tpk37RVLrb9++fZx++ukGCQB8KGeccUa0b98+sfU/+eST91ZXV6dNEgCA3U0ADACQYOedd960qqqqV5Ja/wknnOAqaADgAx188MFx/PHHJ7b+TZs2vXzBBRc8a5IAAOwJAmAAgIT74x//eG9EZJJYeyqVigsuuMBV0ADAe2rZsmVccMEFkUqlkrqEzP333/8zkwQAYE8RAAMAJNzNN988b9WqVU8ktf6OHTsm+nt+AMDudcEFF0THjh0TW/+KFSse//rXv/6GSQIAsKcIgAEAcsCNN974k6ampq1JrX/kyJExdOhQgwQA/pdPfepTMWLEiMTW39TUVH3zzTf/t0kCALAnCYABAHLAxIkTK//+97//KslruPDCC6OsrMwwAYCIiGjTpk18/vOfT/QaZs+efd/EiRMrTRMAgD1JAAwAkCPOPvvsh2pqapYntf7S0tK46KKLDBIAiFQqFV/84hejtLQ0sWuoqal566yzznrYNAEA2NMEwAAAOaKioqJx0qRJP07yGgYPHhwjR440TABo5o444og46KCDEr2GJ5544qeVlZVNpgkAwJ4mAAYAyCGXXHLJzIqKihlJXsMFF1wQ3bp1M0wAaKZ69uyZ+KufKyoqZnzhC1+YZZoAAOwNAmAAgBzzb//2b/ek0+ntSa2/RYsWceWVV0ZhYaFhAkAzU1hYGF/60pcSvQ9Ip9Pb/+3f/u0e0wQAYG8RAAMA5Jh777139aJFix5M8hq6d+8eZ555pmECQDNzxhlnRPfu3RO9hsWLFz947733rjZNAAD2FgEwAEAO+uxnP/vL2traRL94PPHEE2Pw4MGGCQDNxKBBg+Kkk05K9Bpqa2tXn3vuub80TQAA9iYBMABADlq8eHH9uHHj/j3Ja0ilUnHJJZdE27ZtDRQAclybNm3ikksuiVQqleh1jBs37t8XL15cb6IAAOxNAmAAgBx1+eWXv1RRUTEjyWsoLS2NL3zhC4l/GQwAvLe3f+mrdevWiV5HRUXFM5dffvlLJgoAwN4mAAYAyGE33HDDXU1NTVuTvIaDDjrI94ABIId95jOfiUMOOSTRa2hqaqq+4YYbfmiaAABkAwEwAEAOGzdu3MbZs2cn/jt0p5xyiu8BA0AOOuSQQ+LTn/504tfx17/+9efjxo3baKIAAGQDATAAQI77zGc+81B1dfXCJK8hlUrFF7/4xejQoYOBAkCO6NixY3zpS19K/KceNm/ePO+00057xEQBAMgWAmAAgBxXXV2dfuCBB34UEekkr6O4uDguvfTSyMuzhQWApMvPz4/LLrssiouLk76U9P333/+ftbW1aVMFACBbeHsGANAMXH/99XMWLVr0YNLXsf/++8e5555roACQcOedd1707ds38etYuHDhH7/61a++bqIAAGQTATAAQDNxySWX/Lyurq486es4/vjjfQ8YABJs2LBhccwxxyR+HXV1dWsuvPDC+0wUAIBsIwAGAGgmXnvttdoHHnjguxGRSfI6UqlUfOlLX4oePXoYKgAkTO/evePSSy9N/Hd/IyLzwAMPfO/111+vNVUAALKNABgAoBm5+uqr/7Z06dJHk76OoqKiGDt2bJSWlhoqACRE69at46qrrorCwsLEr2X58uXjrr766r+ZKgAA2UgADADQzJx33nn/r66ubnXS19GhQ4e4/PLLIy/PlhYAsl1eXl5cfvnl0b59+8Svpb6+ft0ll1zyE1MFACBr999aAADQvLz++uu1Dz744Pcj4VdBR0QMGDAgzjrrLEMFgCw3ZsyYOPDAA3NiLY899tgPXnnllW2mCgBAthIAAwA0Q1/5ylf+umbNmqm5sJaTTz45Dj30UEMFgCw1ZMiQOOmkk3JiLWvXrv3LpZde+oKpAgCQzQTAAADN1GWXXfYf9fX1FUlfRyqViksvvTS6d+9uqACQZXr06BFf/OIXI5VKJX4tDQ0Nm6655pofmioAANlOAAwA0EzNmDGj+oEHHvhO5MBV0C1btozrr78+2rZta7AAkCXatWsX1113XbRs2TIXlpN56KGH/nXSpElVJgsAQLYTAAMANGNf+cpX/rpkyZI/58Ja2rZtG1dffXW0aNHCYAFgL2vRokVcffXVOfPLWUuXLn30iiuueNlkAQBIAgEwAEAzd+655/6ktrZ2eS6spXfv3jlzzSQAJNXbn2fYZ599cmI9tbW1y88555wfmywAAEkhAAYAaOYWLFhQ97Of/ezbmUymMRfWM2zYsDjllFMMFgD2kk9/+tMxdOjQnFhLJpNp/NnPfvbtBQsW1JksAABJIQAGACBuvfXWBfPnz78/V9Zz5plnxuDBgw0WAPaw4cOHx2c+85mcWc/8+fN/d+utty4wWQAAkkQADABARESMGTPmvpqamrdyYS2pVCouu+yy6Nmzp8ECwB7Su3fvuPjii3PmUwxbt25ddPrpp//aZAEASBoBMAAAERGxcuXKhh/+8Ie3pdPpnLjisGXLlvEv//Iv0aVLF8MFgN2sS5cucf3110dRUVFOrKepqanmu9/97jfKy8sbTBcAgKQRAAMA8E933XXX0ueff/6eXFlPaWlpXHvttVFWVma4ALCblJWVxXXXXRclJSU5s6aZM2fe/f/+3/9bZboAACSRABgAgP/l5JNPHldeXv50rqynU6dOMXbs2Jw5kQQA2aSoqCiuueaa6NixY86sqby8/MlTTz11gukCAJBUAmAAAP6PSy655K66urq1ubKefffdN6644orIy7P9BYBdJS8vL6688sro3bt3zqyprq6u/JJLLvmh6QIAkOi9uhYAAPBus2bNqn7ooYfujIh0rqxp4MCBcd555xkuAOwi559/fhxyyCG5tKT0gw8+eOesWbOqTRcAgCTLb3tQ9NzpjndbRG15oQ4BADRTEydOXDNmzJi8Tp06Dc2VNfXp0yfy8/PjzTffNGAA+ATOOuusOOmkk3JqTa+//vp9Z5555kTTBQAgCYq7N0Ze6c5/5gQwAADv6dRTT/31li1bXs+lNZ122mlx9NFHGy4AfEzHHntsnHrqqTm1pi1btrxx2mmn/cZ0AQDIBQJgAADeU0VFReONN974jcbGxqpcWtcFF1wQRx55pAEDwEd05JFHxuc+97mcWlNjY2PVzTff/I2KiopGEwYAIBcIgAEAeF9//OMf1z/yyCPfiRz6HnAqlYqLLroohgwZYsAA8CENHTo0LrrookilUrm0rPQjjzzynfvvv3+dCQMAkCsEwAAAfKBLL730hQULFvwupzbCeXnxpS99Kfbff38DBoAPcNBBB8WXvvSlyMvLrVdJCxYs+N2ll176ggkDAJBLBMAAAHwoo0eP/mVVVdXcXFpTYWFhfOUrX4kePXoYMAC8h169esUVV1wRBQUFObWuqqqqOaNHj/6lCQMAkGsEwAAAfCgVFRWNV1111S0NDQ0bcmldJSUlcfPNN8c+++xjyADwLr17946bbropiouLc2pdDQ0NG6666qqv++4vAAC5SAAMAMCHNmHChE3333//tzKZTDqX1lVcXBzXXXdddO/e3ZABYIfu3bvHtddeG61atcqpdWUymfT999//rQkTJmwyZQAAcpEAGACAj2Ts2LGz58+f/9tcW1fr1q3juuuuiw4dOhgyAM1ehw4d4rrrrovWrVvn3Nrmz5//m7Fjx842ZQAAcpUAGACAj+y44477xaZNm17MtXW1a9cubrzxxmjXrp0hA9BstW3bNmf/Pty4ceOLxx13nO/+AgCQ0wTAAAB8ZNXV1emLL774W3V1datzbW0dO3aMG2+8Mdq0aWPQADQ7ZWVlceONN0bHjh1zbm21tbWrL7zwwturq6vTJg0AQC7Lb3tQ9NzZD9LbImrLC3UIAICdWrZsWf327dtfOvbYY0/Ny8trkUtrKykpiaFDh8Zrr70WNTU1hg1As9ChQ4f42te+Fp06dcq5tTU1NW39zne+M/bBBx9cb9IAAOSC4u6NkVe6858JgAEA+NhefPHFzYcccsiyAQMGnBgRqZzaRBcXx5AhQ4TAADQLHTt2jJtuuik6dOiQi8tLjx8//ravfvWrc0waAIBc8X4BsCugAQD4RC688MIZb7zxxm9ycW3t27ePm266KSdPQgHA2zp16pTL4W+88cYbv77wwgufM2kAAJoLATAAAJ/YqFGjfrFhw4aZubi2t0Pgzp07GzQAOadz585x0003Rfv27XNyfRs2bJg5atSo+0waAIDmRAAMAMAnVltbm77sssu+V1dXtzoX19euXbu44YYbomPHjoYNQM7o0KFDXH/99dGuXbtc3Z+s/sIXvvDd2tratGkDANCc+AYwAAC7xJIlS+oj4pVRo0admpeX1yLX1ldcXBxDhw6NuXPnxrZt2wwcgETr0qVL3HjjjTl77XNTU1P1nXfeec0f/vCHdaYNAEAuer9vAAuAAQDYZWbNmlXVo0ePuYceeujoVCqVn2vra9WqVYwYMSIWLVoUlZWVBg5AIu23335x0003RVlZWU6uL51ON/z617++4fbbb3/TtAEAyFUCYAAA9phJkyatPeqoozbsu+++R+fi+goLC2P48OGxbNmy2LBhg4EDkCgDBgyIa6+9Nlq1apWza5w2bdq/XXLJJc+ZNgAAuez9AmDfAAYAYJc77bTTHn/rrbcezNX1FRUVxTXXXBNDhgwxbAASY8iQIXHNNddEUVFRzq5xwYIFvzv99NOfMG0AAJozATAAALvFEUcccc+GDRtm5ur6CgoK4sorr4wjjjjCsAFIwt/LceWVV0ZBQUHOrrG8vPypESNG/LdpAwDQ3AmAAQDYLaqrq9MXXXTRd2pra1fk7GY6Ly8uvvjiOPLIIw0cgKw1atSouPjiiyMvL3dfA23dunXxZz/72e83NDRkTBwAgObON4ABANhtli9fvr2mpuaFY4899uT8/PyWubjGVCoVgwYNikwmE4sWLTJ0ALLK6aefHueee26kUqmcXWN9fX3FDTfccM3UqVOrTBwAgObi/b4BLAAGAGC3evnll7cUFBS8cMQRR4zOy8trkYtrTKVSccABB0SnTp1i7ty5kck4fATA3lVYWBhXXHFFHHPMMTm9zsbGxuo777zzKz/72c9WmzoAAM2JABgAgL1qxowZlb169Xp98ODBJ6dSqfxcXWfPnj2jb9++8fe//z0aGxsNHoC9olWrVnH11VfHwIEDc3qd6XS64be//e2Nt9122wJTBwCguREAAwCw1z3xxBPlw4cPX9OvX79jIyJn76Hs2LFjDBw4MObMmRN1dXUGD8Ae1a5du7jxxhujT58+ub7U9JQpU779xS9+8XlTBwCgOXq/ADhPewAA2FPGjBkz9Y033vh1rq+zZ8+eceONN0bHjh0NHYA9pkuXLnHTTTdF9+7dc36tc+fO/eU555zzF1MHAID/SwAMAMAe9alPfernS5cufTjX19mlS5e49dZb48ADDzR0AHa7gQMHxje/+c3o1KlTzq/1rbfeemjEiBG/MnUAANg5ATAAAHvcsccee8/GjRtfyPV1FhcXx7XXXhsjRowwdAB2m8MPPzyuuuqqaNmyZc6vdePGjc8fffTR95g6AAC8NwEwAAB7XEVFReNxxx339crKyr/l+loLCgrisssui/PPPz9SqZThA7DLpFKpOP/88+PSSy+NgoKCnF/vpk2bXj7ssMNuqaysbDJ9AAB4bwJgAAD2isWLF9efddZZN1dXV7/ZHNZ7/PHHx5e//OUoKioyfAA+sRYtWsSXv/zlOP7445vFequrq98cM2bMN8rLyxtMHwAA3l9+24Oi585+kN4WUVteqEMAAOw2a9asaVi1atWs0aNHH1dQUNA619fbrVu3OOCAA2LevHlRX1/vAQDgYykrK4trrrkmDjrooGax3rq6uvKxY8de89RTT202fQAA+Ifi7o2RV7rznwmAAQDYq+bNm1ezevXqZ04++eTjCwoKSnN9ve3atYuRI0fG8uXLY+PGjR4AAD6S/v37x0033RRdu3ZtFuutr69fd9111335T3/6U4XpAwDA/xAAAwCQ1ebMmbMtlUq9fOSRR56Ul5eX83ckt2jRIkaMGBG1tbWxdOlSDwAAH8rxxx8fX/rSl5rN5wQaGxu33HXXXdf99Kc/XWn6AADwvwmAAQDIejNnzqzs2bPn64MHDz4plUrl5/p6U6lUHHLIIdGqVatYsGBBZDIZDwEAO5WXlxef/exn4/TTT49UKtUs1pxOp7f//ve//+o3vvGN1z0BAADwfwmAAQBIhEmTJpXvs88+8wYOHHhCKpUqaA5r3m+//WLAgAExd+5c3wUG4P8oKyuL6667LoYNG9Zs1pxOp7f/8Y9/vOmqq676qycAAAB2TgAMAEBiTJw4cc3BBx+85MADDzwulUrlNYc1t2/fPoYOHRqLFi2KLVu2eAgAiIiIffbZJ66//vro2bNns1lzJpNpnDBhwm1f/OIXn/cEAADAexMAAwCQKI8++ujy/fff/42DDjrohOZwHXRERHFxcRx11FHR2NgYb731locAoJkbPXp0XHHFFVFSUtJs1pxOpxsefvjhr15yySWzPAEAAPD+BMAAACTO+PHjVw0cOHDpAQcccGxzOQmcSqViwIAB0aVLl3jjjTeiqanJgwDQzBQVFcWll14aJ554YrP53m/EP07+Pv7447dffPHFMz0FAADwwQTAAAAk0iOPPLLs0EMPXbb//vs3mxA4IqJHjx4xZMiQePPNN2Pr1q0eBIBmonv37vEv//IvccABBzSrdWcymaYnnnji9s997nPPeAoAAODDEQADAJBYDz/88NJjjjlmY+/evY+KiGZzFKq0tDSGDx8eq1evjvXr13sQAHLcwIED45prrol27do1t6VnZsyY8YOzzjprqqcAAAA+PAEwAACJdv/99795zDHHVO6zzz5HRDMKgVu0aBGHHXZYtGzZMhYuXBjpdNrDAJBjCgoK4pxzzonzzz8/WrRo0dyWn37uuefuOuWUUyZ4EgAA4KMRAAMAkHi///3v5w8bNmxF3759j2lO10GnUqno27dvDB06NBYvXhxbtmzxMADkiJ49e8YNN9wQgwcPblbf+434x7XPU6ZM+fbpp58+2ZMAAAAfnQAYAICc8OCDDy4ZNmzYin79+jWrEDgionXr1nHEEUdEfX19LF261MMAkGCpVCpOOOGEuOKKK6JNmzbNbv07wt9vnXPOOX/xNAAAwMcjAAYAIGc89NBDS4YNG7a8X79+xza3EDg/Pz8OPvjg6NWrV8yfPz8aGho8EAAJU1JSEpdffnmccMIJkZ+f3+zWn8lkGp944olvffazn53maQAAgI9PAAwAQE556KGHlo4cOXJdnz59RqWa252ZEdG1a9cYNmxYLFu2LCorKz0QAAnRt2/fuO6662K//fZrluvPZDLpp59++rvnnHPO054GAAD4ZATAAADknD/96U+LDj300KX7779/s7sOOiKiuLg4jjzyyCgpKYk333wz0um0hwIgSxUUFMRnP/vZuPDCC6OkpKRZ9iCdTjc88sgjt5x//vnTPREAAPDJCYABAMhJDz/88NId3wQelUqlmt09mqlUKvr06RMHH3xwLFy4MLZt2+ahAMgynTt3jrFjx8bQoUOjGV5aERH/CH+feOKJ2y+88MLnPBEAALBrCIABAMhZDz300JIePXq8NmjQoGPz8vJaNMcetG3bNkaNGhVNTU2xZMkSDwVAFkilUjF69Oi48soro0OHDs22D01NTdt++9vf/stll132oqcCAAB2HQEwAAA5bdKkSeXdu3efM3jw4GYbAufn58eAAQOiV69esWDBgti+fbsHA2Avad26dVx66aVx/PHHR35+frPtQ2NjY/WvfvWrf7nuuute81QAAMCuJQAGACDnTZ48eW1jY+OMI4444uiCgoKS5tqHrl27xqhRo2Lbtm2xcuVKDwbAHpRKpWLUqFExduzY6NWrV7PuRX19/fo77rjjK9/61rcWejIAAGDXEwADANAsPP/881UbNmx45rjjjjuqsLCwrLn2obCwMAYNGhT77bdfLF68OGpraz0cALtZ+/bt44orrogTTzwxCgub9/uU2tralTfffPPVP/nJT1Z7MgAAYPcQAAMA0Gz87W9/27p27doZJ5xwwsjCwsK2zbkXnTp1ipEjR0Z1dbXTwAC70ciRI+Pqq6+OHj16NPte1NTULL/hhhuu/e1vf7vOkwEAALuPABgAgGbltdde2zpv3rynTznllKFFRUWdmnMvCgsL49BDD4399tsvFi1a5DQwwC709qnfk08+udmf+o2I2Lx587yLL774unHjxm30dAAAwO71fgFwat9zYsTOftC4LmLjq610DwCAxOrVq1fhs88++69du3Y9QTciGhoaYurUqTF58uRobGzUEICPqaCgIE499dQYPXq04HeH8vLyp4499tjvrly5skE3AABg9+swrDYKuuz8ZwJgAAByWuvWrfNeeumlm/fdd9+zdeMfVq9eHffff38sWbJEMwA+ov322y8uuugi1z2/w8KFC38/fPjwnzY0NGR0AwAA9gwBMAAAzd7zzz9/8aGHHnp1RKR0IyKTycTMmTPjz3/+c9TV1WkIwAcoKSmJ8847L0aMGBGplL9Kdki//PLL9xx77LEPagUAAOxZ7xcA+wYwAADNwn333Tfn+OOP39yrV6/DQwgcqVQqevfuHcOHD49169ZFRUWFhwTgPRxyyCExduzY6N+/v/B3h0wm0/jMM8/828knnzxONwAAYM97v28AC4ABAGg2fve7370xePDgJf369Ts6lUrl60hEcXFxjBgxInr06BFLly6N2tpaTQHYoUOHDvGFL3whzjzzzCguLtaQHZqammoeeOCBWz73uc9N1w0AANg7BMAAALDDww8/vKygoOC54cOHH1FQUFCqI//QrVu3OO6446K0tDQWL14cTU1NmgI0Wy1btoxzzjknLr300ujevbuGvENtbe2K22677arbbrvtDd0AAIC9RwAMAADv8Oyzz25avHjx0yeddNKQoqKiTjryD3l5edGnT58YOXJkbN26NVatWqUpQLNz+OGHx1e+8pUYMGBA5OXlacg7VFVV/e3CCy+8/oEHHvDdAAAA2MsEwAAA8C7z58+vefbZZ58+44wz+hcXF/fSkf/RsmXLGDJkSOyzzz6xdOnSqKmp0RQg53Xs2DG++MUvximnnBItW7bUkHdZt27dMyeffPI3Xn755W26AQAAe9/7BcCpfc+JETv7QeO6iI2vttI9AAByWmFhYer555//0sEHH3y5bvxfTU1N8fzzz8f48eOjurpaQ4Cc07p16zjzzDPjyCOPdOJ35zJ///vff3rMMcfc39DQkNEOAADIDh2G1UZBl53/TAAMAAARMWnSpM8cc8wxt6RSKdfg7ERNTU1MmTIlpk2bFg0NDRoCJF5hYWGccsopcdJJJ0VRUZGG7EQ6na6fOnXqd88555y/6AYAAGSX9wuAXQENAAAR8Yc//GHhfvvt98aAAQOOysvLkwS8S2FhYQwYMCCGDh0amzZtinXr1mkKkFiDBw+Oq666KoYOHRoFBQUashONjY1Vv//972/5whe+MEs3AAAg+/gGMAAAfAgTJkxYXV1dPf3II4/8VGFhYTsd+b9KS0vjsMMOi/79+8eaNWti8+bNmgIkRu/evePyyy+PU045JUpLSzXkPWzdunXxLbfccs33vve9hboBAADZyTeAAQDgI+jTp0+LJ5988us9evQ4TTfe3/z58+ORRx6JlStXagaQtXr16hXnnHNODBgwQDM+wKpVq5444YQTfrBy5Ur3/QMAQBbzDWAAAPgYnnnmmfOHDx9+fSqVytON95bJZGL27Nkxbty4qKio0BAga3Tu3DnOOuusGDp0aKRSKQ15/z/Lm2bNmvXDk08++THdAACA7OcbwAAA8DH85je/eX3//fd//cADDzzSd4HfWyqViu7du8cxxxwT7dq1i2XLlkV9fb3GAHtN27Zt49xzz42LL744evToIfz9AI2NjdUPPvjgLZ/97Gf/ohsAAJAMvgEMAAAf0/jx41dFxPOHHXbYiMLCwjIdeW95eXnRu3fvOOqoo6KgoCBWrlwZjY2NGgPsMcXFxXHKKafEl770pejbt2/k5bnA4YPU1tau+MEPfnD9LbfcMk83AAAgQf/94xvAAADwyQwePLjVo48++s1u3bqdpBsfTn19fTzzzDMxderU2LZtm4YAu01ZWVmceuqpceSRR0ZRkQsbPqyVK1c+/ulPf/pHixcvdm0DAAAkjG8AAwDALvLkk0+edeSRR96USqVcl/MhCYKB3eXtE7/HHnus4PcjyGQyDbNmzfoP3/sFAIDk8g1gAADYRX7/+98v6NGjx2uHHHLIyPz8fL8x+SEUFBREv3794qijjoq8vLxYtWqVq6GBT6Rly5ZxwgknxBVXXBEHHXRQFBQUaMqH1NDQsOG3v/3t1z7/+c8/oxsAAJBcroAGAIBd7Lzzzut4991339m2bdvBuvHR1NTUxLPPPhvTpk2LLVu2aAjwoZWVlcXxxx8fxxxzTBQXF2vIR1RVVfW3a6+99vZHHnlkg24AAECyuQIaAAB2g06dOhVMmzZtbN++fT8XESkd+WgaGhri+eefjyeffDI2bJBFAO/7522cdNJJccQRR0RhodvKPobMokWL/nTsscf+pLKyskk7AAAg+QTAAACwG/3hD38Ydfrpp99WUFDQRjc+unQ6Ha+++mpMnTo1Vq5cqSHAP/Xq1StOOeWUGDp0aOTl5WnIx9DY2Fg1YcKEOy666KKZugEAALlDAAwAALvZaaed1vbee+/9docOHUbqxse3fPnymDZtWrz88suRTqc1BJqhvLy8OOyww+L444+P3r17a8gnsHHjxue//OUvf3fSpElVugEAALlFAAwAAHtAYWFh6qmnnjpv+PDh16RSKXeUfgIbNmyIGTNmxHPPPRc1NTUaAs1AcXFxjBo1Ko4++ujo2LGjhnwCmUym4ZVXXvl/J5100kMNDQ0ZHQEAgNzzfgFwftuDoufOfpDeFlFb7p0VAAB8WOl0On7zm9+8Xlpa+uLgwYM/VVhYWKYrH09xcXEMGDAgjj322GjTpk2sXbs2amtrNQZyUIcOHeKMM86ISy+9NAYOHBjFxcWa8gnU1tau+slPfnLjxRdf/IybFAAAIHcVd2+MvNKd/8wJYAAA2A1OPPHENvfdd9+tnTp1Olo3PrnGxsb429/+Fs8++2wsWrRIQyAH9OvXL44++ugYNmxYFBQUaMguUFFR8cwXv/jFf5s+ffoW3QAAgNzmCmgAANhLHn744RNGjx799YKCgta6sWusX78+Zs6cGc8//3xUV1drCCRIaWlpHHnkkXHUUUdF586dNWQXaWxs3DJ16tS7PvvZz/5FNwAAoHkQAAMAwF50ySWXdP3+97//rXbt2g3VjV2nsbExXnvttXjuuedi/vz5GgJZbMCAATFq1KgYPHiw0767WFVV1atf//rXv/e73/1urW4AAEDzIQAGAIC9rF27dvlTp0699OCDD740lUrl68iutXz58nj++efj5ZdfjpqaGg2BLFBSUhLDhw+PI444Inr37q0hu1gmk2mcN2/efSeeeOJvq6urfewXAACaGQEwAABkia9//ev73Xjjjf9aWlraXzd2vXQ6HW+++WY899xz8dprr0VjY6OmwB5UUFAQgwcPjlGjRsUBBxwQeXl5mrIbVFdXL/zP//zPf/3BD36wRDcAAKB5EgADAEAWOfjgg1v9+c9/vrZ3795jIiKlI7tHZWVlvPjii/HCCy/EunXrNAR2o65du8bIkSPj8MMPj7Zt22rI7pNZunTpn88888z/t3jx4nrtAACA5ksADAAAWejuu+8eePHFF9/WqlUrd6PuZuXl5fHqq6/GSy+9FOvXr9cQ2AU6d+4cI0aMiGHDhkW3bt00ZDerqalZ9tvf/vbOm266aa5uAAAAAmAAAMhS/fr1K3r44Ycv79+//4WpVMpdqXvA8uXL46WXXoqXX345qqurNQQ+grKyshg+fHiMGDHCd333kEwmk164cOEfzj777F8sXbp0u44AAAARAmAAAMh6P/3pT4d97nOf+2bLli176Mae0dDQEHPnzo2//vWvMXfu3Ni+Xa4CO9OyZcsYNGhQDBs2LA455JAoKCjQlD2ktrZ21R//+Mc7rr322r/rBgAA8E4CYAAASIA+ffq0ePTRR69wGnjPS6fTsXTp0nj11VedDIaIaNu2bQwbNiyGDRsWffr0ibw8fyTtSZlMpuG11177+ZlnnvmnioqKRh0BAADeTQAMAAAJ8uMf//jQCy644JutWrXaRzf2vLdPBs+ePTvmzp0bdXV1mkKzUFZWFoMHD45hw4ZF//79Iz8/X1P2gpqammX333//nTfccINv/QIAAO9JAAwAAAnTrl27/HHjxp37qU996qq8vDwb870kk8nEihUrYu7cuTFnzpxYsWJFZDIZjSEnpFKp6Nu3bwwbNiwGDRoUHTt21JS9qKmpqfbVV1/92ZgxY/5cWVnZpCMAAMD7EQADAEBCffnLX+5x++23f7V9+/aH68bet2XLlnjjjTdizpw5MW/evKivr9cUEqVly5Zx8MEHx6BBg+KQQw6J0tJSTckCGzdufPG73/3uv//iF79YoxsAAMCHIQAGAIAEKywsTE2cOPGMkSNHXlNQUNBaR7JDXV1dvPnmm/HGG2/EG2+8EevXr9cUslKXLl3ioIMOioMOOigOOOCAKCoq0pQs0djYuGXmzJk/PvPMMyc2NDS4XgAAAPjQBMAAAJADjjzyyNY/+9nPrujbt++5EZGnI9mluro6Fi5cGPPnz4958+ZFZWWlprBXtGvXLg455JAYMGBA9O/fP1q39nsjWSj91ltv/fmqq676xaxZs6q1AwAA+KgEwAAAkEN++ctfjhgzZsyNrVq16q0b2SmdTsfKlStj0aJFsXDhwli8eHFs27ZNY9gtSkpKol+/ftG/f//Yf//9o1evXpGX53dEslVNTc3yRx999EdXXnnlK7oBAAB8XAJgAADIMd26dSt8+OGHPzd48ODL8vPzbdyzXCaTiTVr1sTChQtj0aJFsWjRotiyZYvG8LGUlZVF//79/xn6du/ePVKplMZkuaampprXXnvtV2PGjHmgoqKiUUcAAIBPQgAMAAA56rjjjiv7r//6r8tdC508mzdvjuXLl8eKFSti+fLlsXjx4qipqdEY/pfi4uLo169f9O7dO/bZZ5/Yd999o6ysTGMSJJPJpJcsWfLn66677pfTp0/3mx8AAMAuIQAGAIAc99Of/nTIueeee3NpaWlf3UimxsbGWLlyZSxdujSWLVsWy5cvj3Xr1kUmk9GcZiKVSkWXLl1in332iT59+kSfPn2iV69eUVBQoDkJtXXr1sUPPvjgj6699tq/6wYAALArCYABAKAZaNeuXf64cePOGTp06BUFBQWtdST56uvrY+XKlf88KbxixYpYu3ZtpNNpzUm4vLy86Nq1a+yzzz7//KdXr17RsmVLzckBjY2NW/7617/+4pxzznm0srKySUcAAIBdTQAMAADNyIknntjmnnvuuXzfffcdk0qlHB3MMdu3b481a9bEmjVrYu3atbF27dooLy+PDRs2CIazUF5eXnTs2DG6desWXbt2jW7dukW3bt2iR48eUVhYqEE5JpPJNC5ZsuRR1z0DAAC7mwAYAACaoa9+9av7Xnfdddd16NDhCN3IfY2Njf8MhNetWxfr1q2LioqKWLduXWzbtk2DdrPS0tLo3LnzP//p0qVLdO3aNbp27eoK52Ziw4YNM//rv/7rxz/60Y+W6wYAALC7CYABAKAZ++UvfznirLPOuq64uNj3gZupmpqaWL9+/T//qaioiMrKyqisrIxNmzZFY2OjJn2AgoKCaN++fbRr1y7at28fHTt2jC5dukSnTp2ic+fOUVxcrEnN1NatW98aP378PVdcccXLugEAAOwpAmAAAGjm2rVrl//ggw+eOWLEiCsLCwvb6gjvtHnz5n+GwZs2bYrKysqorq6OLVu2xJYtW6K6ujqqq6sjk8nk3NpTqVS0bt06WrduHWVlZdGmTZsoLS39X2Fvu3btok2bNh4U/peGhobKl1566efnnHPO+OrqavevAwAAe5QAGAAAiIiIoUOHFt97770XHHjggRfk5+c7ssiHlk6n/xkEV1dXR01Nzfv+k8lkora2NtLpdNTX10dTU1PU1dXt0u8U5+XlRcuWLSM/Pz+KiooiLy8vWrVqFalUKoqLi3f6T0lJSbRq1eqfgW9paWnk5eUZMB9aU1NTzYIFC/745S9/+Y+zZ8+u0REAAGBvEAADAAD/y2mnndb2rrvuurRPnz5n5+XlFeoIe9LbgfDbtm/f/r7XUBcUFESLFi3++b/fDnxhT8pkMg1LliwZd8stt/xq0qRJVToCAADsTQJgAABgp0477bS2d95554X777//5wTBAP9XJpNpWLhw4QO33nrrHwS/AABAtni/ADi/7UHRc2c/SG+LqC33/gcAAHLZokWL6u69995X0un0swcddFCnkpKS3roC8A8VFRUz/7//7/+77aKLLpq6aNGiOh0BAACyRXH3xsgr3fnPBMAAAEDMnDmz8u67736qqalpWr9+/Ypbt27dN5VKpXQGaG4ymUx6zZo1U+65555/Peeccx6cOXNmpa4AAADZRgAMAAB8KDNnzqz88Y9//Gw6nZ4uCAaak7eD37vvvvtfzz///McEvwAAQDYTAAMAAB+JIBhoLgS/AABAEgmAAQCAj+XtILisrOyFvn37diwuLu4VEYJgIBdkKioqnrv33nu/PWbMmEcEvwAAQJK8XwCc2vecGLGzHzSui9j4aivdAwAA/unqq6/u8ZWvfOX8Pn36nJWXl9dCR4CkSafT9UuXLh3/X//1Xw/84he/WKMjAABAEnUYVhsFXXb+MwEwAADwkZ1xxhntb7/99rMPPPDA8/Pz81vrCJDtmpqaqhcsWPDgd77znUcmTpzotC8AAJBoAmAAAGC3GD58eMkPf/jDzwwePPjioqKijjoCZJv6+voNr7322u9vvPHGx2fPnl2jIwAAQC4QAAMAALvV0KFDi++5556zDjnkkPOKioq66giwt9XV1a19/fXXH7z++uvHC34BAIBcIwAGAAD2iFatWuXdc889w0455ZTzO3bseJSOAHtYZsOGDbOmTJny4PXXX/9qbW1tWksAAIBcJAAGAAD2uH/913/tf/7555/dq1ev0/Ly8lroCLC7pNPp+pUrV05+4IEHHvnOd76zSEcAAIBcJwAGAAD2mjPOOKP97bfffvYBBxzw2YKCgjY6AuwqjY2NVW+++eafv/e97z06YcKETToCAAA0FwJgAABgrxs+fHjJ97///dGDBg0aU1paur+OAB9XdXX1wtdee+3Rr371q1Nfe+21Wh0BAACaGwEwAACQVb761a/ue8EFF3y6b9++ZxUUFLTWEeCDNDY2bnnrrbfG/+EPf5j4ox/9aLmOAAAAzZkAGAAAyEpDhw4t/sEPfnDy4MGDz27dunV/HQHerbq6+s2XX375weuuu+7ppUuXbtcRAAAAATAAAJDlCgsLU3ffffeQ0aNHn9G1a9fj8vLyinQFmq90Ol1XXl4+bcqUKROuvfbav+sIAADA/yYABgAAEqNPnz4t/v3f/33UyJEjz2rfvv2nIiKlK9AsZDZt2vTXF1544bGvfe1rzzntCwAA8N4EwAAAQCJddNFFXa6++uqTDzzwwLNbtmzZTUcg99TV1a1ZsGDBuJ/+9KdP3n///et0BAAA4IMJgAEAgETr1q1b4d13333k4YcffmqHDh2OyMvLK9QVSK50Ot2wcePGWbNmzZp8/fXXz6qoqGjUFQAAgA9PAAwAAOSMo48+uvWtt956/CGHHHJKu3btBkdEnq5AIqQrKytfmzdv3uQ777xz+owZM6q1BAAA4OMRAAMAADnpuOOOK/vGN75x/CGHHHJa27ZtB4bvBUO2yVRVVc2dN2/epO9///vTpk+fvkVLAAAAPjkBMAAAkPNuu+22vmedddZJffr0Oa5Vq1a9dQT2ntra2uXLly+f/uijjz51xx13vKUjAAAAu5YAGAAAaFa+9KUvdbv44ouP7t+//wlOBsMekamqqpq7cOHCv/z+97+fcd9995VrCQAAwO4jAAYAAJqtSy65pOtll112jDAYdrl0VVXVvIULF/7lV7/61bO/+93v1moJAADAniEABgAAiIirr766x/nnnz9q//33P7JNmzZDUqlUga7Ah5fJZBoqKyv/vnjx4uf+9Kc/zbr33ntX6woAAMCeJwAGAAB4l379+hV97WtfGzRy5MhRPXv2PLaoqKizrsD/VV9fv37VqlXPvPDCC8/9+7//+5zFixfX6woAAMDeJQAGAAB4H61bt8678847Bx599NFHde/efURpaen+4apomq/M1q1bF69Zs+bF5557btY3v/nNOdXV1WltAQAAyB4CYAAAgI9g8ODBrcaOHXvI8OHDD+vevfvw1q1bHxACYXJXprq6+s01a9a88sorr7z8k5/8ZN5rr71Wqy0AAADZSwAMAADwCVx//fX7nHHGGYf169dvePv27Yfm5+e31hWSrLGxsXrjxo2vvvXWWy+PHz/+lR//+McrdQUAACA5BMAAAAC70Je//OUe55xzzvA+ffoM7tix45CioqKuukI2q6+vX7t27doXFy9ePGfixImv3Xvvvat1BQAAILkEwAAAALvRl7/85R6f+cxnBvfr129Qly5dDm/ZsqVAmL2qrq5u7bp16wS+AAAAOUoADAAAsIe0atUq75prrtnn2GOPPXi//fY7uH379oeUlpb2TaVS+brDbpKuqalZtnHjxnlvvfXW3GeffXbef/3Xfy2vra1Naw0AAEBuEgADAADsRQceeGDLq6+++oAhQ4Yc3LNnz4Pbtm17sGuj+biampqqq6qqXi8vL583Z86ceb/85S/nvfjii1t1BgAAoPkQAAMAAGSZoUOHFn/xi1/cf9CgQQf26NHjwHbt2h3YqlWr3qlUKk932CFdU1OzvLKycsHq1asXzJkzZ8Gf//znJTNmzKjWGgAAgOZNAAwAAJAAxx13XNkFF1xw4MEHH3xA165dDywtLd23pKRkn1QqVag7uS2TyTRs27ZtRXV19dJ169YtfOONNxZOmDBh4YQJEzbpDgAAAO8mAAYAAEiw8847r+OJJ57Yp3///vt16dKlT5s2bfZr3bp1v/z8/GLdSZampqaa6urqxZs3b16ybt26pQsXLlzy9NNPL33ooYc26A4AAAAflgAYAAAgx7Rr1y7/kksu6TFkyJCe++67b89OnTr1Kisr61VcXNyzZcuW3VKpVL4u7R2ZTKaprq6uvKamZtWWLVtWVlRUrFy6dOnK2bNnr7r//vvXVFZWNukSAAAAn4QAGAAAoBnp1KlTwec+97luQ4cO7bnPPvv0aNeuXafWrVt3Li4u7tqyZcvORUVFnfLy8lro1MeTTqe319fXr6+rq6uoqalZW11dvb6ysnL9ihUrVr/66qurHnzwwbUVFRWNOgUAAMDuIgAGAADgfznjjDPaH3bYYZ369OnTuUuXLp3Kysral5SUtC0uLu5YVFTUrqioqG2LFi065OfnlzaXnjQ1NW3dvn37xvr6+qr6+vrKmpqaDdu2bavasmXLpnXr1lUsXbp0/Ysvvrh+4sSJlZ4gAAAA9iYBMAAAAB9Lr169CkeNGtXuoIMOatexY8ey9u3bl7Zp06Z1SUlJWXFxcetWrVq1btGiRVlRUVHrwsLC1hGRX1hYWBoR+QUFBSV5eXkFeXl5u/0/LtPpdG06nW5sbGzcFhFNDQ0NW3f83+r6+vrq7du3b6mtra2uqamp3rZtW/XmzZurN23aVL1hw4YtCxYsqJo1a1bl0qVLt5s4AAAASSAABgAAYK/q169fUffu3Vvss88+xSUlJQVv//8LCwtT3bp1+8BTxuXl5VsbGhoyb//vbdu2Na5YsaJmzZo12xcvXlyvwwAAADQn7xcAF2gPAAAAu9vixYvrdwS11boBAAAAu0+eFgAAAAAAAADkBgEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4QAAMAAAAAAADkCAEwAAAAAAAAQI4o0AIAAAAAAACA5GhoLIyCxoaIiEilIpNXGE1v/0wADAAAAAAAAJAghQUN/0x6MxGppvT/5L6ugAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAAYAAAAAAADIEQJgAAAAAAAAgBwhAIb/v5272ZHiusM4/FZ1NUkz9sQwOF4EyZJtpJCwysa5jSy4n1xPEqRIuQFvvfGSgIwBOzGRQAQERnx0d1UW0cgWGvKxsMGvnmfVdc7/1OJsf+oCAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoIQADAAAAAAAAlBCAAQAAAAAAAEoIwAAAAAAAAAAlBGAAAAAAAACAEgIwAAAAAAAAQAkBGAAAAAAAAKCEAAwAAAAAAABQQgAGAAAAAAAAKCEAAwAAAAAAAJQQgAEAAAAAAABKCMAAAAAAAAAAJQRgAAAAAAAAgBICMAAAAAAAAEAJARgAAAAAAACghAAMAAAAAAAAUEIABgAAAAAAACghAAMAAAAAAACUEIABAAAAAAAASgjAAAAAAAAAACUEYAAAAAAAAIASAjAAAAAAAABACQEYAAAAAAAAoIQADAAAAAAAAFBCAAYAAAAAAAAoMY3JP//9K8My551lzpAk293a7QAAAAAAAAD8iIw3r+SL7TpPxuSt4/ibJJuz20QDBgAAAAAAAHhzrJPp6NvHYcyyjLl7dJTPbl/Jp6sPLufSsM+5ec7q5YOrF0OeP/SVaAAAAAAAAIA3weH7u6zfm79dWDIMSw6225w785vsx3XyzasOby5ssz69c4sAAAAAAAAAr9n69C6bC9sT93a7rKdnORin5Otxynzi1JQcfiwCAwAAAAAAALxO69O7HH68TaaT98cp85R8vbp3Nfszv8q0LHn7xMF1sjk/ZzUPmZ/MmWefhAYAAAAAAAD4oayPdjn7223Gn7x6ZrXPnetX8mBKkpv3cufDd/Pufn5FL56SzcVtNheT3dNt8tQlAwAAAAAAAHyv1sm0ySv/9XtsNWZ3I/lHkgzHi7/4XY7WYz5yiwAAAAAAAAA/Ivtcv/3nPEyS1fHa42t5+vNLyX7JoRsCAAAAAAAAePPt1/nbV3/KvePn1Xc371/NYxEYAAAAAAAA4M0yTHk2rvNo2WdzvHZqzN9v/SF3vju3evng/at5fPDLPDu1yuGyZHSVAAAAAAAAAK/XOGe4ueSvZ4e8M8xZbVe5ceuPufvy3Oqkw4+v5emDX+fuuTlLhhwsEYIBAAAAAAAAXpclGR8OuXP0TR4cPM/9z/+SRyfNDf/1TZezOp/87KdjzizJZkhO7edMy/w/nAUAAAAAAADg/zaMWcZkP8/ZLsmLacr2/MV8+cnvs/tP5/4FmLjAq1ifcioAAAAASUVORK5CYII=";function H0($,q,Q){if(typeof $==="string"&&!isNaN(Number($)))$=Number($);if(typeof $==="number"&&$<100)return v0($);if(typeof $==="number"&&$>=100)return $;if(typeof $==="string"&&$.includes("%")){if(q&&q==="X")return Math.round(parseFloat($)/100*Q.width);if(q&&q==="Y")return Math.round(parseFloat($)/100*Q.height);return Math.round(parseFloat($)/100*Q.width)}return 0}function k5($){return $.replace(/[xy]/g,function(q){let Q=Math.random()*16|0;return(q==="x"?Q:Q&3|8).toString(16)})}function k0($){if(typeof $>"u"||$==null)return"";return $.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function v0($){if(typeof $==="number"&&$>100)return $;if(typeof $==="string")$=Number($.replace(/in*/gi,""));return Math.round(L0*$)}function Y0($){let q=Number($)||0;return isNaN(q)?0:Math.round(q*w8)}function S1($){return $=$||0,Math.round(($>360?$-360:$)*60000)}function g7($){let q=$.toString(16);return q.length===1?"0"+q:q}function A7($,q,Q){return(g7($)+g7(q)+g7(Q)).toUpperCase()}function R0($,q){let Q=($||"").replace("#","");if(!j7.test(Q)&&Q!==G2.background1&&Q!==G2.background2&&Q!==G2.text1&&Q!==G2.text2&&Q!==G2.accent1&&Q!==G2.accent2&&Q!==G2.accent3&&Q!==G2.accent4&&Q!==G2.accent5&&Q!==G2.accent6)console.warn(`"${Q}" is not a valid scheme color or hex RGB! "${Q2}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`),Q=Q2;let K=j7.test(Q)?"srgbClr":"schemeClr",J='val="'+(j7.test(Q)?Q.toUpperCase():Q)+'"';return q?`${q}`:``}function fB($,q){let Q="",K=Object.assign(Object.assign({},q),$),J=Math.round(K.size*w8),Z=K.color,G=Math.round(K.opacity*1e5);return Q+=``,Q+=R0(Z,``),Q+="",Q}function B2($){let q="solid",Q="",K="",J="";if($){if(typeof $==="string")Q=$;else{if($.type)q=$.type;if($.color)Q=$.color;if($.alpha)K+=``;if($.transparency)K+=``}switch(q){case"solid":J+=`${R0(Q,K)}`;break;default:J+="";break}}return J}function a2($){return $._rels.length+$._relsChart.length+$._relsMedia.length+1}function b7($){if(!$||typeof $!=="object")return;if($.type!=="outer"&&$.type!=="inner"&&$.type!=="none")console.warn("Warning: shadow.type options are `outer`, `inner` or `none`."),$.type="outer";if($.angle){if(isNaN(Number($.angle))||$.angle<0||$.angle>359)console.warn("Warning: shadow.angle can only be 0-359"),$.angle=270;$.angle=Math.round(Number($.angle))}if($.opacity){if(isNaN(Number($.opacity))||$.opacity<0||$.opacity>1)console.warn("Warning: shadow.opacity can only be 0-1"),$.opacity=0.75;$.opacity=Number($.opacity)}if($.color){if($.color.startsWith("#"))console.warn('Warning: shadow.color should not include hash (#) character, , e.g. "FF0000"'),$.color=$.color.replace("#","")}return $}function RB($,q,Q){var K,J;let Z=2.3+(((K=$.options)===null||K===void 0?void 0:K.autoPageCharWeight)?$.options.autoPageCharWeight:0),G=Math.floor(q/w8*L0)/((((J=$.options)===null||J===void 0?void 0:J.fontSize)?$.options.fontSize:k2)/Z),W=[],B=[],V=[],U=[];if($.text&&$.text.toString().trim().length===0)B.push({_type:D0.tablecell,text:" "});else if(typeof $.text==="number"||typeof $.text==="string")B.push({_type:D0.tablecell,text:($.text||"").toString().trim()});else if(Array.isArray($.text))B=$.text;let w=[];return B.forEach((F)=>{var M;if(typeof F.text==="string"){if(F.text.split(` `).length>1)F.text.split(` -`).forEach((k)=>{w.push({_type:D0.tablecell,text:k,options:Object.assign(Object.assign({},F.options),{breakLine:!0})})});else w.push({_type:D0.tablecell,text:F.text.trim(),options:F.options});if((M=F.options)===null||M===void 0?void 0:M.breakLine)V.push(w),w=[]}if(w.length>0)V.push(w),w=[]}),V.forEach((F)=>{F.forEach((M)=>{let k=[],L=String(M.text).split(" ");L.forEach((D,z)=>{let N=Object.assign({},M.options);if(N===null||N===void 0?void 0:N.breakLine)N.breakLine=z+1===L.length;k.push({_type:D0.tablecell,text:D+(z+1{let M=[],k="";if(F.forEach((f)=>{if(k.length+f.text.length>G)W.push(M),M=[],k="";M.push(f),k+=f.text.toString()}),M.length>0)W.push(M)}),W}function GJ($=[],q={},Q,K){let J=M8,Z=L0*1,G=L0*1,W=0,B=0,V=[],U=H0(q.x,"X",Q),w=H0(q.y,"Y",Q),F=H0(q.w,"X",Q),M=H0(q.h,"Y",Q),k=F;function f(){let D=0;if(V.length===0)D=w||v0(J[0]);if(V.length>0)D=v0(q.autoPageSlideStartY||q.newSlideStartY||J[0]);if(G=(M||Q.height)-D-v0(J[2]),V.length>1){if(typeof q.autoPageSlideStartY==="number")G=(M||Q.height)-v0(q.autoPageSlideStartY+J[2]);else if(typeof q.newSlideStartY==="number")G=(M||Q.height)-v0(q.newSlideStartY+J[2]);else if(w){if(G=(M||Q.height)-v0((w/L0{if(!z)z={_type:D0.tablecell};let N=z.options||null;B+=Number((N===null||N===void 0?void 0:N.colspan)?N.colspan:1)}),q.verbose)console.log(`| numCols ......................................... = ${B}`);if(!F&&q.colW){if(k=Array.isArray(q.colW)?q.colW.reduce((D,z)=>D+z)*L0:q.colW*B||0,q.verbose)console.log(`| tableCalcW ...................................... = ${k/L0}`)}if(Z=k||v0((U?U/L0:J[1])+J[3]),q.verbose)console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);if(!q.colW||!Array.isArray(q.colW))if(q.colW&&!isNaN(Number(q.colW))){let D=[];($[0]||[]).forEach(()=>D.push(q.colW)),q.colW=[],D.forEach((N)=>{if(Array.isArray(q.colW))q.colW.push(N)})}else{q.colW=[];for(let D=0;D{let N=[],H=0,v=0,j=[];if(D.forEach((X)=>{var P,g,c,h;if(j.push({_type:D0.tablecell,text:[],options:X.options}),X.options.margin&&X.options.margin[0]>=1){if(((P=X.options)===null||P===void 0?void 0:P.margin)&&X.options.margin[0]&&Y0(X.options.margin[0])>H)H=Y0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&Y0(q.margin[0])>H)H=Y0(q.margin[0]);if(((g=X.options)===null||g===void 0?void 0:g.margin)&&X.options.margin[2]&&Y0(X.options.margin[2])>v)v=Y0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&Y0(q.margin[2])>v)v=Y0(q.margin[2])}else{if(((c=X.options)===null||c===void 0?void 0:c.margin)&&X.options.margin[0]&&v0(X.options.margin[0])>H)H=v0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&v0(q.margin[0])>H)H=v0(q.margin[0]);if(((h=X.options)===null||h===void 0?void 0:h.margin)&&X.options.margin[2]&&v0(X.options.margin[2])>v)v=v0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&v0(q.margin[2])>v)v=v0(q.margin[2])}}),f(),W+=H+v,q.verbose&&z===0)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(D.forEach((X,P)=>{var g;let c={_type:D0.tablecell,_lines:null,_lineHeight:v0((((g=X.options)===null||g===void 0?void 0:g.fontSize)?X.options.fontSize:q.fontSize?q.fontSize:k2)*(fB+(q.autoPageLineWeight?q.autoPageLineWeight:0))/100),text:[],options:X.options};if(c.options.rowspan)c._lineHeight=0;c.options.autoPageCharWeight=q.autoPageCharWeight?q.autoPageCharWeight:null;let h=q.colW[P];if(X.options.colspan&&Array.isArray(q.colW))h=q.colW.filter((x,l)=>l>=P&&lx+l);c._lines=XB(X,h),N.push(c)}),q.verbose)console.log(` +`).forEach((k)=>{w.push({_type:D0.tablecell,text:k,options:Object.assign(Object.assign({},F.options),{breakLine:!0})})});else w.push({_type:D0.tablecell,text:F.text.trim(),options:F.options});if((M=F.options)===null||M===void 0?void 0:M.breakLine)V.push(w),w=[]}if(w.length>0)V.push(w),w=[]}),V.forEach((F)=>{F.forEach((M)=>{let k=[],L=String(M.text).split(" ");L.forEach((D,z)=>{let N=Object.assign({},M.options);if(N===null||N===void 0?void 0:N.breakLine)N.breakLine=z+1===L.length;k.push({_type:D0.tablecell,text:D+(z+1{let M=[],k="";if(F.forEach((f)=>{if(k.length+f.text.length>G)W.push(M),M=[],k="";M.push(f),k+=f.text.toString()}),M.length>0)W.push(M)}),W}function GJ($=[],q={},Q,K){let J=M8,Z=L0*1,G=L0*1,W=0,B=0,V=[],U=H0(q.x,"X",Q),w=H0(q.y,"Y",Q),F=H0(q.w,"X",Q),M=H0(q.h,"Y",Q),k=F;function f(){let D=0;if(V.length===0)D=w||v0(J[0]);if(V.length>0)D=v0(q.autoPageSlideStartY||q.newSlideStartY||J[0]);if(G=(M||Q.height)-D-v0(J[2]),V.length>1){if(typeof q.autoPageSlideStartY==="number")G=(M||Q.height)-v0(q.autoPageSlideStartY+J[2]);else if(typeof q.newSlideStartY==="number")G=(M||Q.height)-v0(q.newSlideStartY+J[2]);else if(w){if(G=(M||Q.height)-v0((w/L0{if(!z)z={_type:D0.tablecell};let N=z.options||null;B+=Number((N===null||N===void 0?void 0:N.colspan)?N.colspan:1)}),q.verbose)console.log(`| numCols ......................................... = ${B}`);if(!F&&q.colW){if(k=Array.isArray(q.colW)?q.colW.reduce((D,z)=>D+z)*L0:q.colW*B||0,q.verbose)console.log(`| tableCalcW ...................................... = ${k/L0}`)}if(Z=k||v0((U?U/L0:J[1])+J[3]),q.verbose)console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);if(!q.colW||!Array.isArray(q.colW))if(q.colW&&!isNaN(Number(q.colW))){let D=[];($[0]||[]).forEach(()=>D.push(q.colW)),q.colW=[],D.forEach((N)=>{if(Array.isArray(q.colW))q.colW.push(N)})}else{q.colW=[];for(let D=0;D{let N=[],H=0,v=0,j=[];if(D.forEach((X)=>{var P,g,c,h;if(j.push({_type:D0.tablecell,text:[],options:X.options}),X.options.margin&&X.options.margin[0]>=1){if(((P=X.options)===null||P===void 0?void 0:P.margin)&&X.options.margin[0]&&Y0(X.options.margin[0])>H)H=Y0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&Y0(q.margin[0])>H)H=Y0(q.margin[0]);if(((g=X.options)===null||g===void 0?void 0:g.margin)&&X.options.margin[2]&&Y0(X.options.margin[2])>v)v=Y0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&Y0(q.margin[2])>v)v=Y0(q.margin[2])}else{if(((c=X.options)===null||c===void 0?void 0:c.margin)&&X.options.margin[0]&&v0(X.options.margin[0])>H)H=v0(X.options.margin[0]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[0]&&v0(q.margin[0])>H)H=v0(q.margin[0]);if(((h=X.options)===null||h===void 0?void 0:h.margin)&&X.options.margin[2]&&v0(X.options.margin[2])>v)v=v0(X.options.margin[2]);else if((q===null||q===void 0?void 0:q.margin)&&q.margin[2]&&v0(q.margin[2])>v)v=v0(q.margin[2])}}),f(),W+=H+v,q.verbose&&z===0)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(D.forEach((X,P)=>{var g;let c={_type:D0.tablecell,_lines:null,_lineHeight:v0((((g=X.options)===null||g===void 0?void 0:g.fontSize)?X.options.fontSize:q.fontSize?q.fontSize:k2)*(YB+(q.autoPageLineWeight?q.autoPageLineWeight:0))/100),text:[],options:X.options};if(c.options.rowspan)c._lineHeight=0;c.options.autoPageCharWeight=q.autoPageCharWeight?q.autoPageCharWeight:null;let h=q.colW[P];if(X.options.colspan&&Array.isArray(q.colW))h=q.colW.filter((x,l)=>l>=P&&lx+l);c._lines=RB(X,h),N.push(c)}),q.verbose)console.log(` | SLIDE [${V.length}]: ROW [${z}]: START...`);let n=0,d=0,_=!1;while(!_){let X=N[n],P=j[n];if(N.forEach((h)=>{if(h._lineHeight>=d)d=h._lineHeight}),W+d>G){if(q.verbose)console.log(` |-----------------------------------------------------------------------|`),console.log(`|-- NEW SLIDE CREATED (currTabH+currLineH > maxH) => ${(W/L0).toFixed(2)} + ${(X._lineHeight/L0).toFixed(2)} > ${G/L0}`),console.log(`|-----------------------------------------------------------------------| `);if(j.length>0&&j.map((x)=>x.text.length).reduce((x,l)=>x+l)>0)L.rows.push(j);if(V.push(L),L={rows:[]},j=[],D.forEach((x)=>j.push({_type:D0.tablecell,text:[],options:x.options})),f(),W+=H+v,q.verbose)console.log(`| SLIDE [${V.length}]: emuSlideTabH ...... = ${(G/L0).toFixed(1)} `);if(W=0,(q.addHeaderToEach||q.autoPageRepeatHeader)&&q._arrObjTabHeadRows)q._arrObjTabHeadRows.forEach((x)=>{let l=[],$0=0;x.forEach((Z0)=>{if(l.push(Z0),Z0._lineHeight>$0)$0=Z0._lineHeight}),L.rows.push(l),W+=$0});P=j[n]}let g=X._lines.shift();if(Array.isArray(P.text)){if(g)P.text=P.text.concat(g);else if(P.text.length===0)P.text=P.text.concat({_type:D0.tablecell,text:""})}if(n===N.length-1)W+=d;if(n=nh._lines.length).reduce((h,x)=>h+x)===0)_=!0}if(j.length>0)L.rows.push(j);if(q.verbose)console.log(`- SLIDE [${V.length}]: ROW [${z}]: ...COMPLETE ...... emuTabCurrH = ${(W/L0).toFixed(2)} ( emuSlideTabH = ${(G/L0).toFixed(2)} )`)}),V.push(L),q.verbose)console.log(` |================================================|`),console.log(`| FINAL: tableRowSlides.length = ${V.length}`),V.forEach((D)=>console.log(D)),console.log(`|================================================| -`);return V}function yB($,q,Q={},K){let J=Q||{};J.slideMargin=J.slideMargin||J.slideMargin===0?J.slideMargin:0.5;let Z=J.w||$.presLayout.width,G=[],W=[],B=[],V=[],U=[],w=[0.5,0.5,0.5,0.5],F=0;if(!document.getElementById(q))throw Error('tableToSlides: Table ID "'+q+'" does not exist!');if(K===null||K===void 0?void 0:K._margin){if(Array.isArray(K._margin))w=K._margin;else if(!isNaN(K._margin))w=[K._margin,K._margin,K._margin,K._margin];J.slideMargin=w}else if(J===null||J===void 0?void 0:J.slideMargin){if(Array.isArray(J.slideMargin))w=J.slideMargin;else if(!isNaN(J.slideMargin))w=[J.slideMargin,J.slideMargin,J.slideMargin,J.slideMargin]}if(Z=(J.w?v0(J.w):$.presLayout.width)-v0(w[1]+w[3]),J.verbose)console.log("[[VERBOSE MODE]]"),console.log("|-- `tableToSlides` ----------------------------------------------------|"),console.log(`| tableProps.h .................................... = ${J.h}`),console.log(`| tableProps.w .................................... = ${J.w}`),console.log(`| pptx.presLayout.width ........................... = ${($.presLayout.width/L0).toFixed(1)}`),console.log(`| pptx.presLayout.height .......................... = ${($.presLayout.height/L0).toFixed(1)}`),console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);let M=document.querySelectorAll(`#${q} tr:first-child th`);if(M.length===0)M=document.querySelectorAll(`#${q} tr:first-child td`);if(M.forEach((f)=>{let L=f;if(L.getAttribute("colspan"))for(let D=0;D{F+=f}),U.forEach((f,L)=>{let D=Number((Number(Z)*(f/F*100)/100/L0).toFixed(2)),z=0,N=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(N)z=Number(N.getAttribute("data-pptx-min-width"));let H=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(H)z=Number(H.getAttribute("data-pptx-width"));V.push(z>D?z:D)}),J.verbose)console.log(`| arrColW ......................................... = [${V.join(", ")}]`);["thead","tbody","tfoot"].forEach((f)=>{document.querySelectorAll(`#${q} ${f} tr`).forEach((L)=>{let D=L,z=[];switch(Array.from(D.cells).forEach((N)=>{let H=window.getComputedStyle(N).getPropertyValue("color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(","),v=window.getComputedStyle(N).getPropertyValue("background-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");if(window.getComputedStyle(N).getPropertyValue("background-color")==="rgba(0, 0, 0, 0)"||window.getComputedStyle(N).getPropertyValue("transparent"))v=["255","255","255"];let j={align:null,bold:window.getComputedStyle(N).getPropertyValue("font-weight")==="bold"||Number(window.getComputedStyle(N).getPropertyValue("font-weight"))>=500,border:null,color:A7(Number(H[0]),Number(H[1]),Number(H[2])),fill:{color:A7(Number(v[0]),Number(v[1]),Number(v[2]))},fontFace:(window.getComputedStyle(N).getPropertyValue("font-family")||"").split(",")[0].replace(/"/g,"").replace("inherit","").replace("initial","")||null,fontSize:Number(window.getComputedStyle(N).getPropertyValue("font-size").replace(/[a-z]/gi,"")),margin:null,colspan:Number(N.getAttribute("colspan"))||null,rowspan:Number(N.getAttribute("rowspan"))||null,valign:null};if(["left","center","right","start","end"].includes(window.getComputedStyle(N).getPropertyValue("text-align"))){let n=window.getComputedStyle(N).getPropertyValue("text-align").replace("start","left").replace("end","right");j.align=n==="center"?"center":n==="left"?"left":n==="right"?"right":null}if(["top","middle","bottom"].includes(window.getComputedStyle(N).getPropertyValue("vertical-align"))){let n=window.getComputedStyle(N).getPropertyValue("vertical-align");j.valign=n==="top"?"top":n==="middle"?"middle":n==="bottom"?"bottom":null}if(window.getComputedStyle(N).getPropertyValue("padding-left"))j.margin=[0,0,0,0],["padding-top","padding-right","padding-bottom","padding-left"].forEach((d,_)=>{j.margin[_]=Math.round(Number(window.getComputedStyle(N).getPropertyValue(d).replace(/\D/gi,"")))});if(window.getComputedStyle(N).getPropertyValue("border-top-width")||window.getComputedStyle(N).getPropertyValue("border-right-width")||window.getComputedStyle(N).getPropertyValue("border-bottom-width")||window.getComputedStyle(N).getPropertyValue("border-left-width"))j.border=[null,null,null,null],["top","right","bottom","left"].forEach((d,_)=>{let X=Math.round(Number(window.getComputedStyle(N).getPropertyValue("border-"+d+"-width").replace("px",""))),P=[];P=window.getComputedStyle(N).getPropertyValue("border-"+d+"-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");let g=A7(Number(P[0]),Number(P[1]),Number(P[2]));j.border[_]={pt:X,color:g}});z.push({_type:D0.tablecell,text:N.innerText,options:j})}),f){case"thead":G.push(z);break;case"tbody":W.push(z);break;case"tfoot":B.push(z);break;default:console.log(`table parsing: unexpected table part: ${f}`);break}})}),J._arrObjTabHeadRows=G||null,J.colW=V,GJ([...G,...W,...B],J,$.presLayout,K).forEach((f,L)=>{let D=$.addSlide({masterName:J.masterSlideName||null});if(L===0)J.y=J.y||w[0];if(L>0)J.y=J.autoPageSlideStartY||J.newSlideStartY||w[0];if(J.verbose)console.log(`| opts.autoPageSlideStartY: ${J.autoPageSlideStartY} / arrInchMargins[0]: ${w[0]} => opts.y = ${J.y}`);if(D.addTable(f.rows,{x:J.x||w[3],y:J.y,w:Number(Z)/L0,colW:V,autoPage:!1}),J.addImage)if(J.addImage.options=J.addImage.options||{},!J.addImage.image||!J.addImage.image.path&&!J.addImage.image.data)console.warn("Warning: tableToSlides.addImage requires either `path` or `data`");else D.addImage({path:J.addImage.image.path,data:J.addImage.image.data,x:J.addImage.options.x,y:J.addImage.options.y,w:J.addImage.options.w,h:J.addImage.options.h});if(J.addShape)D.addShape(J.addShape.shapeName,J.addShape.options||{});if(J.addTable)D.addTable(J.addTable.rows,J.addTable.options||{});if(J.addText)D.addText(J.addText.text,J.addText.options||{})})}var hB=0;function xB($,q){if($.bkgd)q.bkgd=$.bkgd;if($.objects&&Array.isArray($.objects)&&$.objects.length>0)$.objects.forEach((Q,K)=>{let J=Object.keys(Q)[0],Z=q;if(W1[J]&&J==="chart")WJ(Z,Q[J].type,Q[J].data,Q[J].opts);else if(W1[J]&&J==="image")BJ(Z,Q[J]);else if(W1[J]&&J==="line")_7(Z,B1.LINE,Q[J]);else if(W1[J]&&J==="rect")_7(Z,B1.RECTANGLE,Q[J]);else if(W1[J]&&J==="text")H5(Z,[{text:Q[J].text}],Q[J].options,!1);else if(W1[J]&&J==="placeholder")Q[J].options.placeholder=Q[J].options.name,delete Q[J].options.name,Q[J].options._placeholderType=Q[J].options.type,delete Q[J].options.type,Q[J].options._placeholderIdx=100+K,H5(Z,[{text:Q[J].text}],Q[J].options,!0)});if($.slideNumber&&typeof $.slideNumber==="object")q._slideNumberProps=$.slideNumber}function WJ($,q,Q,K){var J;function Z(w){if(!w||w.style==="none")return;if(w.size!==void 0&&(isNaN(Number(w.size))||w.size<=0))console.warn("Warning: chart.gridLine.size must be greater than 0."),delete w.size;if(w.style&&!["solid","dash","dot"].includes(w.style))console.warn("Warning: chart.gridLine.style options: `solid`, `dash`, `dot`."),delete w.style;if(w.cap&&!["flat","square","round"].includes(w.cap))console.warn("Warning: chart.gridLine.cap options: `flat`, `square`, `round`."),delete w.cap}let G=++hB,W={_type:null,text:null,options:null,chartRid:null},B=null,V=[];if(Array.isArray(q))q.forEach((w)=>{V=V.concat(w.data)}),B=Q||K;else V=Q,B=K;V.forEach((w,F)=>{if(w._dataIndex=F,w.labels!==void 0&&!Array.isArray(w.labels[0]))w.labels=[w.labels]});let U=B&&typeof B==="object"?B:{};if(U._type=q,U.x=typeof U.x<"u"&&U.x!=null&&!isNaN(Number(U.x))?U.x:1,U.y=typeof U.y<"u"&&U.y!=null&&!isNaN(Number(U.y))?U.y:1,U.w=U.w||"50%",U.h=U.h||"50%",U.objectName=U.objectName?k0(U.objectName):`Chart ${$._slideObjects.filter((w)=>w._type===D0.chart).length}`,!["bar","col"].includes(U.barDir||""))U.barDir="col";if(U._type===q0.AREA){if(!["stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if(U._type===q0.BAR){if(!["clustered","stacked","percentStacked"].includes(U.barGrouping||""))U.barGrouping="clustered"}if(U._type===q0.BAR3D){if(!["clustered","stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if((J=U.barGrouping)===null||J===void 0?void 0:J.includes("tacked")){if(!U.barGapWidthPct)U.barGapWidthPct=50}if(U.dataLabelPosition){if(U._type===q0.AREA||U._type===q0.BAR3D||U._type===q0.DOUGHNUT||U._type===q0.RADAR)delete U.dataLabelPosition;if(U._type===q0.PIE){if(!["bestFit","ctr","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BUBBLE||U._type===q0.BUBBLE3D||U._type===q0.LINE||U._type===q0.SCATTER){if(!["b","ctr","l","r","t"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BAR){if(!["stacked","percentStacked"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(!["clustered"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}}}if(U.dataLabelBkgrdColors=U.dataLabelBkgrdColors||!U.dataLabelBkgrdColors?U.dataLabelBkgrdColors:!1,!["b","l","r","t","tr"].includes(U.legendPos||""))U.legendPos="r";if(!["cone","coneToMax","box","cylinder","pyramid","pyramidToMax"].includes(U.bar3DShape||""))U.bar3DShape="box";if(!["circle","dash","diamond","dot","none","square","triangle"].includes(U.lineDataSymbol||""))U.lineDataSymbol="circle";if(!["gap","span"].includes(U.displayBlanksAs||""))U.displayBlanksAs="span";if(!["standard","marker","filled"].includes(U.radarStyle||""))U.radarStyle="standard";if(U.lineDataSymbolSize=U.lineDataSymbolSize&&!isNaN(U.lineDataSymbolSize)?U.lineDataSymbolSize:6,U.lineDataSymbolLineSize=U.lineDataSymbolLineSize&&!isNaN(U.lineDataSymbolLineSize)?Y0(U.lineDataSymbolLineSize):Y0(0.75),U.layout)["x","y","w","h"].forEach((w)=>{let F=U.layout[w];if(isNaN(Number(F))||F<0||F>1)console.warn("Warning: chart.layout."+w+" can only be 0-1"),delete U.layout[w]});if(U.catGridLine=U.catGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),U.valGridLine=U.valGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{}),U.serGridLine=U.serGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),Z(U.catGridLine),Z(U.valGridLine),Z(U.serGridLine),b7(U.shadow),U.showDataTable=U.showDataTable||!U.showDataTable?U.showDataTable:!1,U.showDataTableHorzBorder=U.showDataTableHorzBorder||!U.showDataTableHorzBorder?U.showDataTableHorzBorder:!0,U.showDataTableVertBorder=U.showDataTableVertBorder||!U.showDataTableVertBorder?U.showDataTableVertBorder:!0,U.showDataTableOutline=U.showDataTableOutline||!U.showDataTableOutline?U.showDataTableOutline:!0,U.showDataTableKeys=U.showDataTableKeys||!U.showDataTableKeys?U.showDataTableKeys:!0,U.showLabel=U.showLabel||!U.showLabel?U.showLabel:!1,U.showLegend=U.showLegend||!U.showLegend?U.showLegend:!1,U.showPercent=U.showPercent||!U.showPercent?U.showPercent:!0,U.showTitle=U.showTitle||!U.showTitle?U.showTitle:!1,U.showValue=U.showValue||!U.showValue?U.showValue:!1,U.showLeaderLines=U.showLeaderLines||!U.showLeaderLines?U.showLeaderLines:!1,U.catAxisLineShow=typeof U.catAxisLineShow<"u"?U.catAxisLineShow:!0,U.valAxisLineShow=typeof U.valAxisLineShow<"u"?U.valAxisLineShow:!0,U.serAxisLineShow=typeof U.serAxisLineShow<"u"?U.serAxisLineShow:!0,U.v3DRotX=!isNaN(U.v3DRotX)&&U.v3DRotX>=-90&&U.v3DRotX<=90?U.v3DRotX:30,U.v3DRotY=!isNaN(U.v3DRotY)&&U.v3DRotY>=0&&U.v3DRotY<=360?U.v3DRotY:30,U.v3DRAngAx=U.v3DRAngAx||!U.v3DRAngAx?U.v3DRAngAx:!0,U.v3DPerspective=!isNaN(U.v3DPerspective)&&U.v3DPerspective>=0&&U.v3DPerspective<=240?U.v3DPerspective:30,U.barGapWidthPct=!isNaN(U.barGapWidthPct)&&U.barGapWidthPct>=0&&U.barGapWidthPct<=1000?U.barGapWidthPct:150,U.barGapDepthPct=!isNaN(U.barGapDepthPct)&&U.barGapDepthPct>=0&&U.barGapDepthPct<=1000?U.barGapDepthPct:150,U.chartColors=Array.isArray(U.chartColors)?U.chartColors:U._type===q0.PIE||U._type===q0.DOUGHNUT?jB:z8,U.chartColorsOpacity=U.chartColorsOpacity&&!isNaN(U.chartColorsOpacity)?U.chartColorsOpacity:null,U.border=U.border&&typeof U.border==="object"?U.border:null,U.border&&(!U.border.pt||isNaN(U.border.pt)))U.border.pt=v6.pt;if(U.border&&(!U.border.color||typeof U.border.color!=="string"))U.border.color=v6.color;if(U.plotArea=U.plotArea||{},U.plotArea.border=U.plotArea.border&&typeof U.plotArea.border==="object"?U.plotArea.border:null,U.plotArea.border&&(!U.plotArea.border.pt||isNaN(U.plotArea.border.pt)))U.plotArea.border.pt=v6.pt;if(U.plotArea.border&&(!U.plotArea.border.color||typeof U.plotArea.border.color!=="string"))U.plotArea.border.color=v6.color;if(U.border)U.plotArea.border=U.border;if(U.plotArea.fill=U.plotArea.fill||{color:null,transparency:null},U.fill)U.plotArea.fill.color=U.fill;if(U.chartArea=U.chartArea||{},U.chartArea.border=U.chartArea.border&&typeof U.chartArea.border==="object"?U.chartArea.border:null,U.chartArea.border)U.chartArea.border={color:U.chartArea.border.color||v6.color,pt:U.chartArea.border.pt||v6.pt};if(U.chartArea.roundedCorners=typeof U.chartArea.roundedCorners==="boolean"?U.chartArea.roundedCorners:!0,U.dataBorder=U.dataBorder&&typeof U.dataBorder==="object"?U.dataBorder:null,U.dataBorder&&(!U.dataBorder.pt||isNaN(U.dataBorder.pt)))U.dataBorder.pt=0.75;if(U.dataBorder&&U.dataBorder.color){let w=typeof U.dataBorder.color==="string"&&U.dataBorder.color.length===6&&/^[0-9A-Fa-f]{6}$/.test(U.dataBorder.color),F=Object.values(L5).includes(U.dataBorder.color);if(!w&&!F)U.dataBorder.color="F9F9F9"}if(!U.dataLabelFormatCode&&U._type===q0.SCATTER)U.dataLabelFormatCode="General";if(!U.dataLabelFormatCode&&(U._type===q0.PIE||U._type===q0.DOUGHNUT))U.dataLabelFormatCode=U.showPercent?"0%":"General";if(U.dataLabelFormatCode=U.dataLabelFormatCode&&typeof U.dataLabelFormatCode==="string"?U.dataLabelFormatCode:"#,##0",!U.dataLabelFormatScatter&&U._type===q0.SCATTER)U.dataLabelFormatScatter="custom";if(U.lineSize=typeof U.lineSize==="number"?U.lineSize:2,U.valAxisMajorUnit=typeof U.valAxisMajorUnit==="number"?U.valAxisMajorUnit:null,U._type===q0.AREA||U._type===q0.BAR||U._type===q0.BAR3D||U._type===q0.LINE)U.catAxisMultiLevelLabels=!!U.catAxisMultiLevelLabels;else delete U.catAxisMultiLevelLabels;return W._type="chart",W.options=U,W.chartRid=a2($),$._relsChart.push({rId:a2($),data:V,opts:U,type:U._type,globalId:G,fileName:`chart${G}.xml`,Target:`/ppt/charts/chart${G}.xml`}),$._slideObjects.push(W),W}function BJ($,q){let Q={_type:null,text:null,options:null,image:null,imageRid:null,hyperlink:null},K=q.x||0,J=q.y||0,Z=q.w||0,G=q.h||0,W=q.sizing||null,B=q.hyperlink||"",V=q.data||"",U=q.path||"",w=a2($),F=q.objectName?k0(q.objectName):`Image ${$._slideObjects.filter((k)=>k._type===D0.image).length}`;if(!U&&!V)return console.error("ERROR: addImage() requires either 'data' or 'path' parameter!"),null;else if(U&&typeof U!=="string")return console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(U)}`),null;else if(V&&typeof V!=="string")return console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(V)}`),null;else if(V&&typeof V==="string"&&!V.toLowerCase().includes("base64,"))return console.error("ERROR: Image `data` value lacks a base64 header! Ex: 'image/png;base64,NMP[...]')"),null;let M=(U.substring(U.lastIndexOf("/")+1).split("?")[0].split(".").pop().split("#")[0]||"png").toLowerCase();if(V&&/image\/(\w+);/.exec(V)&&/image\/(\w+);/.exec(V).length>0)M=/image\/(\w+);/.exec(V)[1];else if(V===null||V===void 0?void 0:V.toLowerCase().includes("image/svg+xml"))M="svg";if(Q._type=D0.image,Q.image=U||"preencoded.png",Q.options={x:K||0,y:J||0,w:Z||1,h:G||1,altText:q.altText||"",rounding:typeof q.rounding==="boolean"?q.rounding:!1,sizing:W,placeholder:q.placeholder,rotate:q.rotate||0,flipV:q.flipV||!1,flipH:q.flipH||!1,transparency:q.transparency||0,objectName:F,shadow:b7(q.shadow)},M==="svg")$._relsMedia.push({path:U||V+"png",type:"image/png",extn:"png",data:V||"",rId:w,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`,isSvgPng:!0,svgSize:{w:H0(Q.options.w,"X",$._presLayout),h:H0(Q.options.h,"Y",$._presLayout)}}),Q.imageRid=w,$._relsMedia.push({path:U||V,type:"image/svg+xml",extn:M,data:V||"",rId:w+1,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w+1;else{let k=$._relsMedia.filter((f)=>f.path&&f.path===U&&f.type==="image/"+M&&!f.isDuplicate)[0];$._relsMedia.push({path:U||"preencoded."+M,type:"image/"+M,extn:M,data:V||"",rId:w,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w}if(typeof B==="object")if(!B.url&&!B.slide)throw Error("ERROR: `hyperlink` option requires either: `url` or `slide`");else w++,$._rels.push({type:D0.hyperlink,data:B.slide?"slide":"dummy",rId:w,Target:B.url||B.slide.toString()}),B._rId=w,Q.hyperlink=B;$._slideObjects.push(Q)}function OB($,q){let Q=q.x||0,K=q.y||0,J=q.w||2,Z=q.h||2,G=q.data||"",W=q.link||"",B=q.path||"",V=q.type||"audio",U="",w=q.cover||gB,F=q.objectName?k0(q.objectName):`Media ${$._slideObjects.filter((k)=>k._type===D0.media).length}`,M={_type:D0.media};if(!B&&!G&&V!=="online")throw Error("addMedia() error: either `data` or `path` are required!");else if(G&&!G.toLowerCase().includes("base64,"))throw Error("addMedia() error: `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')");else if(!w.toLowerCase().includes("base64,"))throw Error("addMedia() error: `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')");if(V==="online"&&!W)throw Error("addMedia() error: online videos require `link` value");if(U=q.extn||(G?G.split(";")[0].split("/")[1]:B.split(".").pop())||"mp3",M.mtype=V,M.media=B||"preencoded.mov",M.options={},M.options.x=Q,M.options.y=K,M.options.w=J,M.options.h=Z,M.options.objectName=F,V==="online"){let k=a2($);$._relsMedia.push({path:B||"preencoded"+U,data:"dummy",type:"online",extn:U,rId:k,Target:W}),M.mediaRid=k,$._relsMedia.push({path:"preencoded.png",data:w,type:"image/png",extn:"png",rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}else{let k=$._relsMedia.filter((L)=>L.path&&L.path===B&&L.type===V+"/"+U&&!L.isDuplicate)[0],f=a2($);$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:f,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+1}.${U}`}),M.mediaRid=f,$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:a2($),isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+0}.${U}`}),$._relsMedia.push({path:"preencoded.png",type:"image/png",extn:"png",data:w,rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}$._slideObjects.push(M)}function PB($,q){$._slideObjects.push({_type:D0.notes,text:[{text:q}]})}function _7($,q,Q){let K=typeof Q==="object"?Q:{};K.line=K.line||{type:"none"};let J={_type:D0.text,shape:q||B1.RECTANGLE,options:K,text:null};if(!q)throw Error("Missing/Invalid shape parameter! Example: `addShape(pptxgen.shapes.LINE, {x:1, y:1, w:1, h:1});`");let Z={type:K.line.type||"solid",color:K.line.color||VJ,transparency:K.line.transparency||0,width:K.line.width||1,dashType:K.line.dashType||"solid",beginArrowType:K.line.beginArrowType||null,endArrowType:K.line.endArrowType||null};if(typeof K.line==="object"&&K.line.type!=="none")K.line=Z;if(K.x=K.x||(K.x===0?0:1),K.y=K.y||(K.y===0?0:1),K.w=K.w||(K.w===0?0:1),K.h=K.h||(K.h===0?0:1),K.objectName=K.objectName?k0(K.objectName):`Shape ${$._slideObjects.filter((G)=>G._type===D0.text).length}`,typeof K.line==="string"){let G=Z;G.color=String(K.line),K.line=G}if(typeof K.lineSize==="number")K.line.width=K.lineSize;if(typeof K.lineDash==="string")K.line.dashType=K.lineDash;if(typeof K.lineHead==="string")K.line.beginArrowType=K.lineHead;if(typeof K.lineTail==="string")K.line.endArrowType=K.lineTail;g6($,J),$._slideObjects.push(J)}function TB($,q,Q,K,J,Z,G){let W=[$],B=Q&&typeof Q==="object"?Q:{};B.objectName=B.objectName?k0(B.objectName):`Table ${$._slideObjects.filter((F)=>F._type===D0.table).length}`;{if(q===null||q.length===0||!Array.isArray(q))throw Error("addTable: Array expected! EX: 'slide.addTable( [rows], {options} );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)");if(!q[0]||!Array.isArray(q[0]))throw Error("addTable: 'rows' should be an array of cells! EX: 'slide.addTable( [ ['A'], ['B'], {text:'C',options:{align:'center'}} ] );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)")}let V=[];if(q.forEach((F)=>{let M=[];if(Array.isArray(F))F.forEach((k)=>{let f={_type:D0.tablecell,text:"",options:typeof k==="object"&&k.options?k.options:{}};if(typeof k==="string"||typeof k==="number")f.text=k.toString();else if(k.text){if(typeof k.text==="string"||typeof k.text==="number")f.text=k.text.toString();else if(k.text)f.text=k.text;if(k.options&&typeof k.options==="object")f.options=k.options}f.options.border=f.options.border||B.border||[{type:"none"},{type:"none"},{type:"none"},{type:"none"}];let L=f.options.border;if(!Array.isArray(L)&&typeof L==="object")f.options.border=[L,L,L,L];if(!f.options.border[0])f.options.border[0]={type:"none"};if(!f.options.border[1])f.options.border[1]={type:"none"};if(!f.options.border[2])f.options.border[2]={type:"none"};if(!f.options.border[3])f.options.border[3]={type:"none"};[0,1,2,3].forEach((z)=>{f.options.border[z]={type:f.options.border[z].type||H6.type,color:f.options.border[z].color||H6.color,pt:typeof f.options.border[z].pt==="number"?f.options.border[z].pt:H6.pt}}),M.push(f)});else console.log("addTable: tableRows has a bad row. A row should be an array of cells. You provided:"),console.log(F);V.push(M)}),B.x=H0(B.x||(B.x===0?0:L0/2),"X",J),B.y=H0(B.y||(B.y===0?0:L0/2),"Y",J),B.h)B.h=H0(B.h,"Y",J);if(B.fontSize=B.fontSize||k2,B.margin=B.margin===0||B.margin?B.margin:JJ,typeof B.margin==="number")B.margin=[Number(B.margin),Number(B.margin),Number(B.margin),Number(B.margin)];if(JSON.stringify({arrRows:V}).indexOf("hyperlink")===-1){if(!B.color)B.color=B.color||Q2}if(typeof B.border==="string")console.warn("addTable `border` option must be an object. Ex: `{border: {type:'none'}}`"),B.border=null;else if(Array.isArray(B.border))[0,1,2,3].forEach((F)=>{B.border[F]=B.border[F]?{type:B.border[F].type||H6.type,color:B.border[F].color||H6.color,pt:B.border[F].pt||H6.pt}:{type:"none"}});if(B.autoPage=typeof B.autoPage==="boolean"?B.autoPage:!1,B.autoPageRepeatHeader=typeof B.autoPageRepeatHeader==="boolean"?B.autoPageRepeatHeader:!1,B.autoPageHeaderRows=typeof B.autoPageHeaderRows<"u"&&!isNaN(Number(B.autoPageHeaderRows))?Number(B.autoPageHeaderRows):1,B.autoPageLineWeight=typeof B.autoPageLineWeight<"u"&&!isNaN(Number(B.autoPageLineWeight))?Number(B.autoPageLineWeight):0,B.autoPageLineWeight){if(B.autoPageLineWeight>1)B.autoPageLineWeight=1;else if(B.autoPageLineWeight<-1)B.autoPageLineWeight=-1}let U=M8;if(K&&typeof K._margin<"u"){if(Array.isArray(K._margin))U=K._margin;else if(!isNaN(Number(K._margin)))U=[Number(K._margin),Number(K._margin),Number(K._margin),Number(K._margin)]}if(B.colW){let F=V[0].reduce((M,k)=>{var f;if(((f=k===null||k===void 0?void 0:k.options)===null||f===void 0?void 0:f.colspan)&&typeof k.options.colspan==="number")M+=k.options.colspan;else M+=1;return M},0);if(typeof B.colW==="string"||typeof B.colW==="number")B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length===1&&F>1)B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length!==F)console.warn("addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths."),B.colW=null}else if(B.w)B.w=H0(B.w,"X",J);else B.w=Math.floor(J._sizeW/L0-U[1]-U[3]);if(B.x&&B.x<20)B.x=v0(B.x);if(B.y&&B.y<20)B.y=v0(B.y);if(B.w&&typeof B.w==="number"&&B.w<20)B.w=v0(B.w);if(B.h&&typeof B.h==="number"&&B.h<20)B.h=v0(B.h);V.forEach((F)=>{F.forEach((M,k)=>{if(typeof M==="number"||typeof M==="string")F[k]={_type:D0.tablecell,text:String(F[k]),options:B};else if(typeof M==="object"){if(typeof M.text==="number")F[k].text=F[k].text.toString();else if(typeof M.text>"u"||M.text===null)F[k].text="";F[k].options=M.options||{},F[k]._type=D0.tablecell}})});let w=[];if(B&&!B.autoPage)g6($,V),$._slideObjects.push({_type:D0.table,arrTabRows:V,options:Object.assign({},B)});else{if(B.autoPageRepeatHeader)B._arrObjTabHeadRows=V.filter((F,M)=>M{if(!G($._slideNum+M))W.push(Z({masterName:(K===null||K===void 0?void 0:K._name)||null}));if(M>0)B.y=v0(B.autoPageSlideStartY||B.newSlideStartY||U[0]);{let k=G($._slideNum+M);if(B.autoPage=!1,g6(k,F.rows),k.addTable(F.rows,Object.assign({},B)),M>0)w.push(k)}})}return w}function H5($,q,Q,K){let J={_type:K?D0.placeholder:D0.text,shape:(Q===null||Q===void 0?void 0:Q.shape)||B1.RECTANGLE,text:!q||q.length===0?[{text:"",options:null}]:q,options:Q||{}};function Z(G){{if(!G.placeholder)G.color=G.color||J.options.color||$.color||Q2;if(G.placeholder||K)G.bullet=G.bullet||!1;if(G.placeholder&&$._slideLayout&&$._slideLayout._slideObjects){let W=$._slideLayout._slideObjects.filter((B)=>B._type==="placeholder"&&B.options&&B.options.placeholder&&B.options.placeholder===G.placeholder)[0];if(W===null||W===void 0?void 0:W.options)G=Object.assign(Object.assign({},G),W.options)}if(G.objectName=G.objectName?k0(G.objectName):`Text ${$._slideObjects.filter((W)=>W._type===D0.text).length}`,G.shape===B1.LINE){let W={type:G.line.type||"solid",color:G.line.color||VJ,transparency:G.line.transparency||0,width:G.line.width||1,dashType:G.line.dashType||"solid",beginArrowType:G.line.beginArrowType||null,endArrowType:G.line.endArrowType||null};if(typeof G.line==="object")G.line=W;if(typeof G.line==="string"){let B=W;if(typeof G.line==="string")B.color=G.line;G.line=B}if(typeof G.lineSize==="number")G.line.width=G.lineSize;if(typeof G.lineDash==="string")G.line.dashType=G.lineDash;if(typeof G.lineHead==="string")G.line.beginArrowType=G.lineHead;if(typeof G.lineTail==="string")G.line.endArrowType=G.lineTail}if(G.line=G.line||{},G.lineSpacing=G.lineSpacing&&!isNaN(G.lineSpacing)?G.lineSpacing:null,G.lineSpacingMultiple=G.lineSpacingMultiple&&!isNaN(G.lineSpacingMultiple)?G.lineSpacingMultiple:null,G._bodyProp=G._bodyProp||{},G._bodyProp.autoFit=G.autoFit||!1,G._bodyProp.anchor=!G.placeholder?I6.ctr:null,G._bodyProp.vert=G.vert||null,G._bodyProp.wrap=typeof G.wrap==="boolean"?G.wrap:!0,G.inset&&!isNaN(Number(G.inset))||G.inset===0)G._bodyProp.lIns=v0(G.inset),G._bodyProp.rIns=v0(G.inset),G._bodyProp.tIns=v0(G.inset),G._bodyProp.bIns=v0(G.inset);if(typeof G.underline==="boolean"&&G.underline===!0)G.underline={style:"sng"}}{if((G.align||"").toLowerCase().indexOf("c")===0)G._bodyProp.align=R6.center;else if((G.align||"").toLowerCase().indexOf("l")===0)G._bodyProp.align=R6.left;else if((G.align||"").toLowerCase().indexOf("r")===0)G._bodyProp.align=R6.right;else if((G.align||"").toLowerCase().indexOf("j")===0)G._bodyProp.align=R6.justify;if((G.valign||"").toLowerCase().indexOf("b")===0)G._bodyProp.anchor=I6.b;else if((G.valign||"").toLowerCase().indexOf("m")===0)G._bodyProp.anchor=I6.ctr;else if((G.valign||"").toLowerCase().indexOf("t")===0)G._bodyProp.anchor=I6.t}return b7(G.shadow),G}J.options=Z(J.options),J.text.forEach((G)=>G.options=Z(G.options||{})),g6($,J.text||""),$._slideObjects.push(J)}function uB($){($._slideLayout._slideObjects||[]).forEach((q)=>{if(q._type===D0.placeholder){if($._slideObjects.filter((Q)=>Q.options&&Q.options.placeholder===q.options.placeholder).length===0)H5($,[{text:""}],q.options,!1)}})}function zJ($,q){var Q;if(q.bkgd){if(!q.background)q.background={};if(typeof q.bkgd==="string")q.background.color=q.bkgd;else{if(q.bkgd.data)q.background.data=q.bkgd.data;if(q.bkgd.path)q.background.path=q.bkgd.path;if(q.bkgd.src)q.background.path=q.bkgd.src}}if((Q=q.background)===null||Q===void 0?void 0:Q.fill)q.background.color=q.background.fill;if($&&($.path||$.data)){$.path=$.path||"preencoded.png";let K=($.path.split(".").pop()||"png").split("?")[0];if(K==="jpg")K="jpeg";q._relsMedia=q._relsMedia||[];let J=q._relsMedia.length+1;q._relsMedia.push({path:$.path,type:D0.image,extn:K,data:$.data||null,rId:J,Target:`../media/${(q._name||"").replace(/\s+/gi,"-")}-image-${q._relsMedia.length+1}.${K}`}),q._bkgdImgRid=J}}function g6($,q,Q){let K=[];if(typeof q==="string"||typeof q==="number")return;else if(Array.isArray(q))K=q;else if(typeof q==="object")K=[q];K.forEach((J,Z)=>{if(Q&&Q[Z]&&Q[Z].hyperlink)J.options=Object.assign(Object.assign({},J.options),Q[Z]);if(Array.isArray(J)){let G=[];J.forEach((W)=>{if(W.options&&!W.text.options)G.push(W.options)}),g6($,J,G)}else if(Array.isArray(J.text))g6($,J.text,Q&&Q[Z]?[Q[Z]]:void 0);else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&!J.options.hyperlink._rId)if(typeof J.options.hyperlink!=="object")console.log("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:'https://github.com'}` ");else if(!J.options.hyperlink.url&&!J.options.hyperlink.slide)console.log("ERROR: 'hyperlink requires either: `url` or `slide`'");else{let G=a2($);$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:G,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()}),J.options.hyperlink._rId=G}else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&J.options.hyperlink._rId){if($._rels.filter((G)=>G.rId===J.options.hyperlink._rId).length===0)$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:J.options.hyperlink._rId,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()})}})}class FJ{constructor($){var q;this.addSlide=$.addSlide,this.getSlide=$.getSlide,this._name=`Slide ${$.slideNumber}`,this._presLayout=$.presLayout,this._rId=$.slideRId,this._rels=[],this._relsChart=[],this._relsMedia=[],this._setSlideNum=$.setSlideNum,this._slideId=$.slideId,this._slideLayout=$.slideLayout||null,this._slideNum=$.slideNumber,this._slideObjects=[],this._slideNumberProps=((q=this._slideLayout)===null||q===void 0?void 0:q._slideNumberProps)?this._slideLayout._slideNumberProps:null}set bkgd($){if(this._bkgd=$,!this._background||!this._background.color){if(!this._background)this._background={};if(typeof $==="string")this._background.color=$}}get bkgd(){return this._bkgd}set background($){if(this._background=$,$)zJ($,this)}get background(){return this._background}set color($){this._color=$}get color(){return this._color}set hidden($){this._hidden=$}get hidden(){return this._hidden}set slideNumber($){this._slideNumberProps=$,this._setSlideNum($)}get slideNumber(){return this._slideNumberProps}get newAutoPagedSlides(){return this._newAutoPagedSlides}addChart($,q,Q){let K=Q||{};return K._type=$,WJ(this,$,q,Q),this}addImage($){return BJ(this,$),this}addMedia($){return OB(this,$),this}addNotes($){return PB(this,$),this}addShape($,q){return _7(this,$,q),this}addTable($,q){return this._newAutoPagedSlides=TB(this,$,q,this._slideLayout,this._presLayout,this.addSlide,this.getSlide),this}addText($,q){return H5(this,typeof $==="string"||typeof $==="number"?[{text:$,options:q}]:$,q,!1),this}}function SB($,q){return W2(this,void 0,void 0,function*(){let Q=$.data;return yield new Promise((K,J)=>{var Z,G;let W=new c7.default,B=(Q.length-1)*2+1,V=((G=(Z=Q[0])===null||Z===void 0?void 0:Z.labels)===null||G===void 0?void 0:G.length)>1;W.folder("_rels"),W.folder("docProps"),W.folder("xl/_rels"),W.folder("xl/tables"),W.folder("xl/theme"),W.folder("xl/worksheets"),W.folder("xl/worksheets/_rels"),W.file("[Content_Types].xml",' \n'),W.file("_rels/.rels",` +`);return V}function IB($,q,Q={},K){let J=Q||{};J.slideMargin=J.slideMargin||J.slideMargin===0?J.slideMargin:0.5;let Z=J.w||$.presLayout.width,G=[],W=[],B=[],V=[],U=[],w=[0.5,0.5,0.5,0.5],F=0;if(!document.getElementById(q))throw Error('tableToSlides: Table ID "'+q+'" does not exist!');if(K===null||K===void 0?void 0:K._margin){if(Array.isArray(K._margin))w=K._margin;else if(!isNaN(K._margin))w=[K._margin,K._margin,K._margin,K._margin];J.slideMargin=w}else if(J===null||J===void 0?void 0:J.slideMargin){if(Array.isArray(J.slideMargin))w=J.slideMargin;else if(!isNaN(J.slideMargin))w=[J.slideMargin,J.slideMargin,J.slideMargin,J.slideMargin]}if(Z=(J.w?v0(J.w):$.presLayout.width)-v0(w[1]+w[3]),J.verbose)console.log("[[VERBOSE MODE]]"),console.log("|-- `tableToSlides` ----------------------------------------------------|"),console.log(`| tableProps.h .................................... = ${J.h}`),console.log(`| tableProps.w .................................... = ${J.w}`),console.log(`| pptx.presLayout.width ........................... = ${($.presLayout.width/L0).toFixed(1)}`),console.log(`| pptx.presLayout.height .......................... = ${($.presLayout.height/L0).toFixed(1)}`),console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);let M=document.querySelectorAll(`#${q} tr:first-child th`);if(M.length===0)M=document.querySelectorAll(`#${q} tr:first-child td`);if(M.forEach((f)=>{let L=f;if(L.getAttribute("colspan"))for(let D=0;D{F+=f}),U.forEach((f,L)=>{let D=Number((Number(Z)*(f/F*100)/100/L0).toFixed(2)),z=0,N=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(N)z=Number(N.getAttribute("data-pptx-min-width"));let H=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(H)z=Number(H.getAttribute("data-pptx-width"));V.push(z>D?z:D)}),J.verbose)console.log(`| arrColW ......................................... = [${V.join(", ")}]`);["thead","tbody","tfoot"].forEach((f)=>{document.querySelectorAll(`#${q} ${f} tr`).forEach((L)=>{let D=L,z=[];switch(Array.from(D.cells).forEach((N)=>{let H=window.getComputedStyle(N).getPropertyValue("color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(","),v=window.getComputedStyle(N).getPropertyValue("background-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");if(window.getComputedStyle(N).getPropertyValue("background-color")==="rgba(0, 0, 0, 0)"||window.getComputedStyle(N).getPropertyValue("transparent"))v=["255","255","255"];let j={align:null,bold:window.getComputedStyle(N).getPropertyValue("font-weight")==="bold"||Number(window.getComputedStyle(N).getPropertyValue("font-weight"))>=500,border:null,color:A7(Number(H[0]),Number(H[1]),Number(H[2])),fill:{color:A7(Number(v[0]),Number(v[1]),Number(v[2]))},fontFace:(window.getComputedStyle(N).getPropertyValue("font-family")||"").split(",")[0].replace(/"/g,"").replace("inherit","").replace("initial","")||null,fontSize:Number(window.getComputedStyle(N).getPropertyValue("font-size").replace(/[a-z]/gi,"")),margin:null,colspan:Number(N.getAttribute("colspan"))||null,rowspan:Number(N.getAttribute("rowspan"))||null,valign:null};if(["left","center","right","start","end"].includes(window.getComputedStyle(N).getPropertyValue("text-align"))){let n=window.getComputedStyle(N).getPropertyValue("text-align").replace("start","left").replace("end","right");j.align=n==="center"?"center":n==="left"?"left":n==="right"?"right":null}if(["top","middle","bottom"].includes(window.getComputedStyle(N).getPropertyValue("vertical-align"))){let n=window.getComputedStyle(N).getPropertyValue("vertical-align");j.valign=n==="top"?"top":n==="middle"?"middle":n==="bottom"?"bottom":null}if(window.getComputedStyle(N).getPropertyValue("padding-left"))j.margin=[0,0,0,0],["padding-top","padding-right","padding-bottom","padding-left"].forEach((d,_)=>{j.margin[_]=Math.round(Number(window.getComputedStyle(N).getPropertyValue(d).replace(/\D/gi,"")))});if(window.getComputedStyle(N).getPropertyValue("border-top-width")||window.getComputedStyle(N).getPropertyValue("border-right-width")||window.getComputedStyle(N).getPropertyValue("border-bottom-width")||window.getComputedStyle(N).getPropertyValue("border-left-width"))j.border=[null,null,null,null],["top","right","bottom","left"].forEach((d,_)=>{let X=Math.round(Number(window.getComputedStyle(N).getPropertyValue("border-"+d+"-width").replace("px",""))),P=[];P=window.getComputedStyle(N).getPropertyValue("border-"+d+"-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");let g=A7(Number(P[0]),Number(P[1]),Number(P[2]));j.border[_]={pt:X,color:g}});z.push({_type:D0.tablecell,text:N.innerText,options:j})}),f){case"thead":G.push(z);break;case"tbody":W.push(z);break;case"tfoot":B.push(z);break;default:console.log(`table parsing: unexpected table part: ${f}`);break}})}),J._arrObjTabHeadRows=G||null,J.colW=V,GJ([...G,...W,...B],J,$.presLayout,K).forEach((f,L)=>{let D=$.addSlide({masterName:J.masterSlideName||null});if(L===0)J.y=J.y||w[0];if(L>0)J.y=J.autoPageSlideStartY||J.newSlideStartY||w[0];if(J.verbose)console.log(`| opts.autoPageSlideStartY: ${J.autoPageSlideStartY} / arrInchMargins[0]: ${w[0]} => opts.y = ${J.y}`);if(D.addTable(f.rows,{x:J.x||w[3],y:J.y,w:Number(Z)/L0,colW:V,autoPage:!1}),J.addImage)if(J.addImage.options=J.addImage.options||{},!J.addImage.image||!J.addImage.image.path&&!J.addImage.image.data)console.warn("Warning: tableToSlides.addImage requires either `path` or `data`");else D.addImage({path:J.addImage.image.path,data:J.addImage.image.data,x:J.addImage.options.x,y:J.addImage.options.y,w:J.addImage.options.w,h:J.addImage.options.h});if(J.addShape)D.addShape(J.addShape.shapeName,J.addShape.options||{});if(J.addTable)D.addTable(J.addTable.rows,J.addTable.options||{});if(J.addText)D.addText(J.addText.text,J.addText.options||{})})}var CB=0;function jB($,q){if($.bkgd)q.bkgd=$.bkgd;if($.objects&&Array.isArray($.objects)&&$.objects.length>0)$.objects.forEach((Q,K)=>{let J=Object.keys(Q)[0],Z=q;if(W1[J]&&J==="chart")WJ(Z,Q[J].type,Q[J].data,Q[J].opts);else if(W1[J]&&J==="image")BJ(Z,Q[J]);else if(W1[J]&&J==="line")_7(Z,B1.LINE,Q[J]);else if(W1[J]&&J==="rect")_7(Z,B1.RECTANGLE,Q[J]);else if(W1[J]&&J==="text")H5(Z,[{text:Q[J].text}],Q[J].options,!1);else if(W1[J]&&J==="placeholder")Q[J].options.placeholder=Q[J].options.name,delete Q[J].options.name,Q[J].options._placeholderType=Q[J].options.type,delete Q[J].options.type,Q[J].options._placeholderIdx=100+K,H5(Z,[{text:Q[J].text}],Q[J].options,!0)});if($.slideNumber&&typeof $.slideNumber==="object")q._slideNumberProps=$.slideNumber}function WJ($,q,Q,K){var J;function Z(w){if(!w||w.style==="none")return;if(w.size!==void 0&&(isNaN(Number(w.size))||w.size<=0))console.warn("Warning: chart.gridLine.size must be greater than 0."),delete w.size;if(w.style&&!["solid","dash","dot"].includes(w.style))console.warn("Warning: chart.gridLine.style options: `solid`, `dash`, `dot`."),delete w.style;if(w.cap&&!["flat","square","round"].includes(w.cap))console.warn("Warning: chart.gridLine.cap options: `flat`, `square`, `round`."),delete w.cap}let G=++CB,W={_type:null,text:null,options:null,chartRid:null},B=null,V=[];if(Array.isArray(q))q.forEach((w)=>{V=V.concat(w.data)}),B=Q||K;else V=Q,B=K;V.forEach((w,F)=>{if(w._dataIndex=F,w.labels!==void 0&&!Array.isArray(w.labels[0]))w.labels=[w.labels]});let U=B&&typeof B==="object"?B:{};if(U._type=q,U.x=typeof U.x<"u"&&U.x!=null&&!isNaN(Number(U.x))?U.x:1,U.y=typeof U.y<"u"&&U.y!=null&&!isNaN(Number(U.y))?U.y:1,U.w=U.w||"50%",U.h=U.h||"50%",U.objectName=U.objectName?k0(U.objectName):`Chart ${$._slideObjects.filter((w)=>w._type===D0.chart).length}`,!["bar","col"].includes(U.barDir||""))U.barDir="col";if(U._type===q0.AREA){if(!["stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if(U._type===q0.BAR){if(!["clustered","stacked","percentStacked"].includes(U.barGrouping||""))U.barGrouping="clustered"}if(U._type===q0.BAR3D){if(!["clustered","stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if((J=U.barGrouping)===null||J===void 0?void 0:J.includes("tacked")){if(!U.barGapWidthPct)U.barGapWidthPct=50}if(U.dataLabelPosition){if(U._type===q0.AREA||U._type===q0.BAR3D||U._type===q0.DOUGHNUT||U._type===q0.RADAR)delete U.dataLabelPosition;if(U._type===q0.PIE){if(!["bestFit","ctr","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BUBBLE||U._type===q0.BUBBLE3D||U._type===q0.LINE||U._type===q0.SCATTER){if(!["b","ctr","l","r","t"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BAR){if(!["stacked","percentStacked"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(!["clustered"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}}}if(U.dataLabelBkgrdColors=U.dataLabelBkgrdColors||!U.dataLabelBkgrdColors?U.dataLabelBkgrdColors:!1,!["b","l","r","t","tr"].includes(U.legendPos||""))U.legendPos="r";if(!["cone","coneToMax","box","cylinder","pyramid","pyramidToMax"].includes(U.bar3DShape||""))U.bar3DShape="box";if(!["circle","dash","diamond","dot","none","square","triangle"].includes(U.lineDataSymbol||""))U.lineDataSymbol="circle";if(!["gap","span"].includes(U.displayBlanksAs||""))U.displayBlanksAs="span";if(!["standard","marker","filled"].includes(U.radarStyle||""))U.radarStyle="standard";if(U.lineDataSymbolSize=U.lineDataSymbolSize&&!isNaN(U.lineDataSymbolSize)?U.lineDataSymbolSize:6,U.lineDataSymbolLineSize=U.lineDataSymbolLineSize&&!isNaN(U.lineDataSymbolLineSize)?Y0(U.lineDataSymbolLineSize):Y0(0.75),U.layout)["x","y","w","h"].forEach((w)=>{let F=U.layout[w];if(isNaN(Number(F))||F<0||F>1)console.warn("Warning: chart.layout."+w+" can only be 0-1"),delete U.layout[w]});if(U.catGridLine=U.catGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),U.valGridLine=U.valGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{}),U.serGridLine=U.serGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),Z(U.catGridLine),Z(U.valGridLine),Z(U.serGridLine),b7(U.shadow),U.showDataTable=U.showDataTable||!U.showDataTable?U.showDataTable:!1,U.showDataTableHorzBorder=U.showDataTableHorzBorder||!U.showDataTableHorzBorder?U.showDataTableHorzBorder:!0,U.showDataTableVertBorder=U.showDataTableVertBorder||!U.showDataTableVertBorder?U.showDataTableVertBorder:!0,U.showDataTableOutline=U.showDataTableOutline||!U.showDataTableOutline?U.showDataTableOutline:!0,U.showDataTableKeys=U.showDataTableKeys||!U.showDataTableKeys?U.showDataTableKeys:!0,U.showLabel=U.showLabel||!U.showLabel?U.showLabel:!1,U.showLegend=U.showLegend||!U.showLegend?U.showLegend:!1,U.showPercent=U.showPercent||!U.showPercent?U.showPercent:!0,U.showTitle=U.showTitle||!U.showTitle?U.showTitle:!1,U.showValue=U.showValue||!U.showValue?U.showValue:!1,U.showLeaderLines=U.showLeaderLines||!U.showLeaderLines?U.showLeaderLines:!1,U.catAxisLineShow=typeof U.catAxisLineShow<"u"?U.catAxisLineShow:!0,U.valAxisLineShow=typeof U.valAxisLineShow<"u"?U.valAxisLineShow:!0,U.serAxisLineShow=typeof U.serAxisLineShow<"u"?U.serAxisLineShow:!0,U.v3DRotX=!isNaN(U.v3DRotX)&&U.v3DRotX>=-90&&U.v3DRotX<=90?U.v3DRotX:30,U.v3DRotY=!isNaN(U.v3DRotY)&&U.v3DRotY>=0&&U.v3DRotY<=360?U.v3DRotY:30,U.v3DRAngAx=U.v3DRAngAx||!U.v3DRAngAx?U.v3DRAngAx:!0,U.v3DPerspective=!isNaN(U.v3DPerspective)&&U.v3DPerspective>=0&&U.v3DPerspective<=240?U.v3DPerspective:30,U.barGapWidthPct=!isNaN(U.barGapWidthPct)&&U.barGapWidthPct>=0&&U.barGapWidthPct<=1000?U.barGapWidthPct:150,U.barGapDepthPct=!isNaN(U.barGapDepthPct)&&U.barGapDepthPct>=0&&U.barGapDepthPct<=1000?U.barGapDepthPct:150,U.chartColors=Array.isArray(U.chartColors)?U.chartColors:U._type===q0.PIE||U._type===q0.DOUGHNUT?HB:z8,U.chartColorsOpacity=U.chartColorsOpacity&&!isNaN(U.chartColorsOpacity)?U.chartColorsOpacity:null,U.border=U.border&&typeof U.border==="object"?U.border:null,U.border&&(!U.border.pt||isNaN(U.border.pt)))U.border.pt=v6.pt;if(U.border&&(!U.border.color||typeof U.border.color!=="string"))U.border.color=v6.color;if(U.plotArea=U.plotArea||{},U.plotArea.border=U.plotArea.border&&typeof U.plotArea.border==="object"?U.plotArea.border:null,U.plotArea.border&&(!U.plotArea.border.pt||isNaN(U.plotArea.border.pt)))U.plotArea.border.pt=v6.pt;if(U.plotArea.border&&(!U.plotArea.border.color||typeof U.plotArea.border.color!=="string"))U.plotArea.border.color=v6.color;if(U.border)U.plotArea.border=U.border;if(U.plotArea.fill=U.plotArea.fill||{color:null,transparency:null},U.fill)U.plotArea.fill.color=U.fill;if(U.chartArea=U.chartArea||{},U.chartArea.border=U.chartArea.border&&typeof U.chartArea.border==="object"?U.chartArea.border:null,U.chartArea.border)U.chartArea.border={color:U.chartArea.border.color||v6.color,pt:U.chartArea.border.pt||v6.pt};if(U.chartArea.roundedCorners=typeof U.chartArea.roundedCorners==="boolean"?U.chartArea.roundedCorners:!0,U.dataBorder=U.dataBorder&&typeof U.dataBorder==="object"?U.dataBorder:null,U.dataBorder&&(!U.dataBorder.pt||isNaN(U.dataBorder.pt)))U.dataBorder.pt=0.75;if(U.dataBorder&&U.dataBorder.color){let w=typeof U.dataBorder.color==="string"&&U.dataBorder.color.length===6&&/^[0-9A-Fa-f]{6}$/.test(U.dataBorder.color),F=Object.values(L5).includes(U.dataBorder.color);if(!w&&!F)U.dataBorder.color="F9F9F9"}if(!U.dataLabelFormatCode&&U._type===q0.SCATTER)U.dataLabelFormatCode="General";if(!U.dataLabelFormatCode&&(U._type===q0.PIE||U._type===q0.DOUGHNUT))U.dataLabelFormatCode=U.showPercent?"0%":"General";if(U.dataLabelFormatCode=U.dataLabelFormatCode&&typeof U.dataLabelFormatCode==="string"?U.dataLabelFormatCode:"#,##0",!U.dataLabelFormatScatter&&U._type===q0.SCATTER)U.dataLabelFormatScatter="custom";if(U.lineSize=typeof U.lineSize==="number"?U.lineSize:2,U.valAxisMajorUnit=typeof U.valAxisMajorUnit==="number"?U.valAxisMajorUnit:null,U._type===q0.AREA||U._type===q0.BAR||U._type===q0.BAR3D||U._type===q0.LINE)U.catAxisMultiLevelLabels=!!U.catAxisMultiLevelLabels;else delete U.catAxisMultiLevelLabels;return W._type="chart",W.options=U,W.chartRid=a2($),$._relsChart.push({rId:a2($),data:V,opts:U,type:U._type,globalId:G,fileName:`chart${G}.xml`,Target:`/ppt/charts/chart${G}.xml`}),$._slideObjects.push(W),W}function BJ($,q){let Q={_type:null,text:null,options:null,image:null,imageRid:null,hyperlink:null},K=q.x||0,J=q.y||0,Z=q.w||0,G=q.h||0,W=q.sizing||null,B=q.hyperlink||"",V=q.data||"",U=q.path||"",w=a2($),F=q.objectName?k0(q.objectName):`Image ${$._slideObjects.filter((k)=>k._type===D0.image).length}`;if(!U&&!V)return console.error("ERROR: addImage() requires either 'data' or 'path' parameter!"),null;else if(U&&typeof U!=="string")return console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(U)}`),null;else if(V&&typeof V!=="string")return console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(V)}`),null;else if(V&&typeof V==="string"&&!V.toLowerCase().includes("base64,"))return console.error("ERROR: Image `data` value lacks a base64 header! Ex: 'image/png;base64,NMP[...]')"),null;let M=(U.substring(U.lastIndexOf("/")+1).split("?")[0].split(".").pop().split("#")[0]||"png").toLowerCase();if(V&&/image\/(\w+);/.exec(V)&&/image\/(\w+);/.exec(V).length>0)M=/image\/(\w+);/.exec(V)[1];else if(V===null||V===void 0?void 0:V.toLowerCase().includes("image/svg+xml"))M="svg";if(Q._type=D0.image,Q.image=U||"preencoded.png",Q.options={x:K||0,y:J||0,w:Z||1,h:G||1,altText:q.altText||"",rounding:typeof q.rounding==="boolean"?q.rounding:!1,sizing:W,placeholder:q.placeholder,rotate:q.rotate||0,flipV:q.flipV||!1,flipH:q.flipH||!1,transparency:q.transparency||0,objectName:F,shadow:b7(q.shadow)},M==="svg")$._relsMedia.push({path:U||V+"png",type:"image/png",extn:"png",data:V||"",rId:w,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`,isSvgPng:!0,svgSize:{w:H0(Q.options.w,"X",$._presLayout),h:H0(Q.options.h,"Y",$._presLayout)}}),Q.imageRid=w,$._relsMedia.push({path:U||V,type:"image/svg+xml",extn:M,data:V||"",rId:w+1,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w+1;else{let k=$._relsMedia.filter((f)=>f.path&&f.path===U&&f.type==="image/"+M&&!f.isDuplicate)[0];$._relsMedia.push({path:U||"preencoded."+M,type:"image/"+M,extn:M,data:V||"",rId:w,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w}if(typeof B==="object")if(!B.url&&!B.slide)throw Error("ERROR: `hyperlink` option requires either: `url` or `slide`");else w++,$._rels.push({type:D0.hyperlink,data:B.slide?"slide":"dummy",rId:w,Target:B.url||B.slide.toString()}),B._rId=w,Q.hyperlink=B;$._slideObjects.push(Q)}function gB($,q){let Q=q.x||0,K=q.y||0,J=q.w||2,Z=q.h||2,G=q.data||"",W=q.link||"",B=q.path||"",V=q.type||"audio",U="",w=q.cover||vB,F=q.objectName?k0(q.objectName):`Media ${$._slideObjects.filter((k)=>k._type===D0.media).length}`,M={_type:D0.media};if(!B&&!G&&V!=="online")throw Error("addMedia() error: either `data` or `path` are required!");else if(G&&!G.toLowerCase().includes("base64,"))throw Error("addMedia() error: `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')");else if(!w.toLowerCase().includes("base64,"))throw Error("addMedia() error: `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')");if(V==="online"&&!W)throw Error("addMedia() error: online videos require `link` value");if(U=q.extn||(G?G.split(";")[0].split("/")[1]:B.split(".").pop())||"mp3",M.mtype=V,M.media=B||"preencoded.mov",M.options={},M.options.x=Q,M.options.y=K,M.options.w=J,M.options.h=Z,M.options.objectName=F,V==="online"){let k=a2($);$._relsMedia.push({path:B||"preencoded"+U,data:"dummy",type:"online",extn:U,rId:k,Target:W}),M.mediaRid=k,$._relsMedia.push({path:"preencoded.png",data:w,type:"image/png",extn:"png",rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}else{let k=$._relsMedia.filter((L)=>L.path&&L.path===B&&L.type===V+"/"+U&&!L.isDuplicate)[0],f=a2($);$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:f,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+1}.${U}`}),M.mediaRid=f,$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:a2($),isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+0}.${U}`}),$._relsMedia.push({path:"preencoded.png",type:"image/png",extn:"png",data:w,rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}$._slideObjects.push(M)}function AB($,q){$._slideObjects.push({_type:D0.notes,text:[{text:q}]})}function _7($,q,Q){let K=typeof Q==="object"?Q:{};K.line=K.line||{type:"none"};let J={_type:D0.text,shape:q||B1.RECTANGLE,options:K,text:null};if(!q)throw Error("Missing/Invalid shape parameter! Example: `addShape(pptxgen.shapes.LINE, {x:1, y:1, w:1, h:1});`");let Z={type:K.line.type||"solid",color:K.line.color||VJ,transparency:K.line.transparency||0,width:K.line.width||1,dashType:K.line.dashType||"solid",beginArrowType:K.line.beginArrowType||null,endArrowType:K.line.endArrowType||null};if(typeof K.line==="object"&&K.line.type!=="none")K.line=Z;if(K.x=K.x||(K.x===0?0:1),K.y=K.y||(K.y===0?0:1),K.w=K.w||(K.w===0?0:1),K.h=K.h||(K.h===0?0:1),K.objectName=K.objectName?k0(K.objectName):`Shape ${$._slideObjects.filter((G)=>G._type===D0.text).length}`,typeof K.line==="string"){let G=Z;G.color=String(K.line),K.line=G}if(typeof K.lineSize==="number")K.line.width=K.lineSize;if(typeof K.lineDash==="string")K.line.dashType=K.lineDash;if(typeof K.lineHead==="string")K.line.beginArrowType=K.lineHead;if(typeof K.lineTail==="string")K.line.endArrowType=K.lineTail;g6($,J),$._slideObjects.push(J)}function XB($,q,Q,K,J,Z,G){let W=[$],B=Q&&typeof Q==="object"?Q:{};B.objectName=B.objectName?k0(B.objectName):`Table ${$._slideObjects.filter((F)=>F._type===D0.table).length}`;{if(q===null||q.length===0||!Array.isArray(q))throw Error("addTable: Array expected! EX: 'slide.addTable( [rows], {options} );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)");if(!q[0]||!Array.isArray(q[0]))throw Error("addTable: 'rows' should be an array of cells! EX: 'slide.addTable( [ ['A'], ['B'], {text:'C',options:{align:'center'}} ] );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)")}let V=[];if(q.forEach((F)=>{let M=[];if(Array.isArray(F))F.forEach((k)=>{let f={_type:D0.tablecell,text:"",options:typeof k==="object"&&k.options?k.options:{}};if(typeof k==="string"||typeof k==="number")f.text=k.toString();else if(k.text){if(typeof k.text==="string"||typeof k.text==="number")f.text=k.text.toString();else if(k.text)f.text=k.text;if(k.options&&typeof k.options==="object")f.options=k.options}f.options.border=f.options.border||B.border||[{type:"none"},{type:"none"},{type:"none"},{type:"none"}];let L=f.options.border;if(!Array.isArray(L)&&typeof L==="object")f.options.border=[L,L,L,L];if(!f.options.border[0])f.options.border[0]={type:"none"};if(!f.options.border[1])f.options.border[1]={type:"none"};if(!f.options.border[2])f.options.border[2]={type:"none"};if(!f.options.border[3])f.options.border[3]={type:"none"};[0,1,2,3].forEach((z)=>{f.options.border[z]={type:f.options.border[z].type||H6.type,color:f.options.border[z].color||H6.color,pt:typeof f.options.border[z].pt==="number"?f.options.border[z].pt:H6.pt}}),M.push(f)});else console.log("addTable: tableRows has a bad row. A row should be an array of cells. You provided:"),console.log(F);V.push(M)}),B.x=H0(B.x||(B.x===0?0:L0/2),"X",J),B.y=H0(B.y||(B.y===0?0:L0/2),"Y",J),B.h)B.h=H0(B.h,"Y",J);if(B.fontSize=B.fontSize||k2,B.margin=B.margin===0||B.margin?B.margin:JJ,typeof B.margin==="number")B.margin=[Number(B.margin),Number(B.margin),Number(B.margin),Number(B.margin)];if(JSON.stringify({arrRows:V}).indexOf("hyperlink")===-1){if(!B.color)B.color=B.color||Q2}if(typeof B.border==="string")console.warn("addTable `border` option must be an object. Ex: `{border: {type:'none'}}`"),B.border=null;else if(Array.isArray(B.border))[0,1,2,3].forEach((F)=>{B.border[F]=B.border[F]?{type:B.border[F].type||H6.type,color:B.border[F].color||H6.color,pt:B.border[F].pt||H6.pt}:{type:"none"}});if(B.autoPage=typeof B.autoPage==="boolean"?B.autoPage:!1,B.autoPageRepeatHeader=typeof B.autoPageRepeatHeader==="boolean"?B.autoPageRepeatHeader:!1,B.autoPageHeaderRows=typeof B.autoPageHeaderRows<"u"&&!isNaN(Number(B.autoPageHeaderRows))?Number(B.autoPageHeaderRows):1,B.autoPageLineWeight=typeof B.autoPageLineWeight<"u"&&!isNaN(Number(B.autoPageLineWeight))?Number(B.autoPageLineWeight):0,B.autoPageLineWeight){if(B.autoPageLineWeight>1)B.autoPageLineWeight=1;else if(B.autoPageLineWeight<-1)B.autoPageLineWeight=-1}let U=M8;if(K&&typeof K._margin<"u"){if(Array.isArray(K._margin))U=K._margin;else if(!isNaN(Number(K._margin)))U=[Number(K._margin),Number(K._margin),Number(K._margin),Number(K._margin)]}if(B.colW){let F=V[0].reduce((M,k)=>{var f;if(((f=k===null||k===void 0?void 0:k.options)===null||f===void 0?void 0:f.colspan)&&typeof k.options.colspan==="number")M+=k.options.colspan;else M+=1;return M},0);if(typeof B.colW==="string"||typeof B.colW==="number")B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length===1&&F>1)B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length!==F)console.warn("addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths."),B.colW=null}else if(B.w)B.w=H0(B.w,"X",J);else B.w=Math.floor(J._sizeW/L0-U[1]-U[3]);if(B.x&&B.x<20)B.x=v0(B.x);if(B.y&&B.y<20)B.y=v0(B.y);if(B.w&&typeof B.w==="number"&&B.w<20)B.w=v0(B.w);if(B.h&&typeof B.h==="number"&&B.h<20)B.h=v0(B.h);V.forEach((F)=>{F.forEach((M,k)=>{if(typeof M==="number"||typeof M==="string")F[k]={_type:D0.tablecell,text:String(F[k]),options:B};else if(typeof M==="object"){if(typeof M.text==="number")F[k].text=F[k].text.toString();else if(typeof M.text>"u"||M.text===null)F[k].text="";F[k].options=M.options||{},F[k]._type=D0.tablecell}})});let w=[];if(B&&!B.autoPage)g6($,V),$._slideObjects.push({_type:D0.table,arrTabRows:V,options:Object.assign({},B)});else{if(B.autoPageRepeatHeader)B._arrObjTabHeadRows=V.filter((F,M)=>M{if(!G($._slideNum+M))W.push(Z({masterName:(K===null||K===void 0?void 0:K._name)||null}));if(M>0)B.y=v0(B.autoPageSlideStartY||B.newSlideStartY||U[0]);{let k=G($._slideNum+M);if(B.autoPage=!1,g6(k,F.rows),k.addTable(F.rows,Object.assign({},B)),M>0)w.push(k)}})}return w}function H5($,q,Q,K){let J={_type:K?D0.placeholder:D0.text,shape:(Q===null||Q===void 0?void 0:Q.shape)||B1.RECTANGLE,text:!q||q.length===0?[{text:"",options:null}]:q,options:Q||{}};function Z(G){{if(!G.placeholder)G.color=G.color||J.options.color||$.color||Q2;if(G.placeholder||K)G.bullet=G.bullet||!1;if(G.placeholder&&$._slideLayout&&$._slideLayout._slideObjects){let W=$._slideLayout._slideObjects.filter((B)=>B._type==="placeholder"&&B.options&&B.options.placeholder&&B.options.placeholder===G.placeholder)[0];if(W===null||W===void 0?void 0:W.options)G=Object.assign(Object.assign({},G),W.options)}if(G.objectName=G.objectName?k0(G.objectName):`Text ${$._slideObjects.filter((W)=>W._type===D0.text).length}`,G.shape===B1.LINE){let W={type:G.line.type||"solid",color:G.line.color||VJ,transparency:G.line.transparency||0,width:G.line.width||1,dashType:G.line.dashType||"solid",beginArrowType:G.line.beginArrowType||null,endArrowType:G.line.endArrowType||null};if(typeof G.line==="object")G.line=W;if(typeof G.line==="string"){let B=W;if(typeof G.line==="string")B.color=G.line;G.line=B}if(typeof G.lineSize==="number")G.line.width=G.lineSize;if(typeof G.lineDash==="string")G.line.dashType=G.lineDash;if(typeof G.lineHead==="string")G.line.beginArrowType=G.lineHead;if(typeof G.lineTail==="string")G.line.endArrowType=G.lineTail}if(G.line=G.line||{},G.lineSpacing=G.lineSpacing&&!isNaN(G.lineSpacing)?G.lineSpacing:null,G.lineSpacingMultiple=G.lineSpacingMultiple&&!isNaN(G.lineSpacingMultiple)?G.lineSpacingMultiple:null,G._bodyProp=G._bodyProp||{},G._bodyProp.autoFit=G.autoFit||!1,G._bodyProp.anchor=!G.placeholder?I6.ctr:null,G._bodyProp.vert=G.vert||null,G._bodyProp.wrap=typeof G.wrap==="boolean"?G.wrap:!0,G.inset&&!isNaN(Number(G.inset))||G.inset===0)G._bodyProp.lIns=v0(G.inset),G._bodyProp.rIns=v0(G.inset),G._bodyProp.tIns=v0(G.inset),G._bodyProp.bIns=v0(G.inset);if(typeof G.underline==="boolean"&&G.underline===!0)G.underline={style:"sng"}}{if((G.align||"").toLowerCase().indexOf("c")===0)G._bodyProp.align=R6.center;else if((G.align||"").toLowerCase().indexOf("l")===0)G._bodyProp.align=R6.left;else if((G.align||"").toLowerCase().indexOf("r")===0)G._bodyProp.align=R6.right;else if((G.align||"").toLowerCase().indexOf("j")===0)G._bodyProp.align=R6.justify;if((G.valign||"").toLowerCase().indexOf("b")===0)G._bodyProp.anchor=I6.b;else if((G.valign||"").toLowerCase().indexOf("m")===0)G._bodyProp.anchor=I6.ctr;else if((G.valign||"").toLowerCase().indexOf("t")===0)G._bodyProp.anchor=I6.t}return b7(G.shadow),G}J.options=Z(J.options),J.text.forEach((G)=>G.options=Z(G.options||{})),g6($,J.text||""),$._slideObjects.push(J)}function yB($){($._slideLayout._slideObjects||[]).forEach((q)=>{if(q._type===D0.placeholder){if($._slideObjects.filter((Q)=>Q.options&&Q.options.placeholder===q.options.placeholder).length===0)H5($,[{text:""}],q.options,!1)}})}function zJ($,q){var Q;if(q.bkgd){if(!q.background)q.background={};if(typeof q.bkgd==="string")q.background.color=q.bkgd;else{if(q.bkgd.data)q.background.data=q.bkgd.data;if(q.bkgd.path)q.background.path=q.bkgd.path;if(q.bkgd.src)q.background.path=q.bkgd.src}}if((Q=q.background)===null||Q===void 0?void 0:Q.fill)q.background.color=q.background.fill;if($&&($.path||$.data)){$.path=$.path||"preencoded.png";let K=($.path.split(".").pop()||"png").split("?")[0];if(K==="jpg")K="jpeg";q._relsMedia=q._relsMedia||[];let J=q._relsMedia.length+1;q._relsMedia.push({path:$.path,type:D0.image,extn:K,data:$.data||null,rId:J,Target:`../media/${(q._name||"").replace(/\s+/gi,"-")}-image-${q._relsMedia.length+1}.${K}`}),q._bkgdImgRid=J}}function g6($,q,Q){let K=[];if(typeof q==="string"||typeof q==="number")return;else if(Array.isArray(q))K=q;else if(typeof q==="object")K=[q];K.forEach((J,Z)=>{if(Q&&Q[Z]&&Q[Z].hyperlink)J.options=Object.assign(Object.assign({},J.options),Q[Z]);if(Array.isArray(J)){let G=[];J.forEach((W)=>{if(W.options&&!W.text.options)G.push(W.options)}),g6($,J,G)}else if(Array.isArray(J.text))g6($,J.text,Q&&Q[Z]?[Q[Z]]:void 0);else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&!J.options.hyperlink._rId)if(typeof J.options.hyperlink!=="object")console.log("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:'https://github.com'}` ");else if(!J.options.hyperlink.url&&!J.options.hyperlink.slide)console.log("ERROR: 'hyperlink requires either: `url` or `slide`'");else{let G=a2($);$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:G,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()}),J.options.hyperlink._rId=G}else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&J.options.hyperlink._rId){if($._rels.filter((G)=>G.rId===J.options.hyperlink._rId).length===0)$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:J.options.hyperlink._rId,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()})}})}class FJ{constructor($){var q;this.addSlide=$.addSlide,this.getSlide=$.getSlide,this._name=`Slide ${$.slideNumber}`,this._presLayout=$.presLayout,this._rId=$.slideRId,this._rels=[],this._relsChart=[],this._relsMedia=[],this._setSlideNum=$.setSlideNum,this._slideId=$.slideId,this._slideLayout=$.slideLayout||null,this._slideNum=$.slideNumber,this._slideObjects=[],this._slideNumberProps=((q=this._slideLayout)===null||q===void 0?void 0:q._slideNumberProps)?this._slideLayout._slideNumberProps:null}set bkgd($){if(this._bkgd=$,!this._background||!this._background.color){if(!this._background)this._background={};if(typeof $==="string")this._background.color=$}}get bkgd(){return this._bkgd}set background($){if(this._background=$,$)zJ($,this)}get background(){return this._background}set color($){this._color=$}get color(){return this._color}set hidden($){this._hidden=$}get hidden(){return this._hidden}set slideNumber($){this._slideNumberProps=$,this._setSlideNum($)}get slideNumber(){return this._slideNumberProps}get newAutoPagedSlides(){return this._newAutoPagedSlides}addChart($,q,Q){let K=Q||{};return K._type=$,WJ(this,$,q,Q),this}addImage($){return BJ(this,$),this}addMedia($){return gB(this,$),this}addNotes($){return AB(this,$),this}addShape($,q){return _7(this,$,q),this}addTable($,q){return this._newAutoPagedSlides=XB(this,$,q,this._slideLayout,this._presLayout,this.addSlide,this.getSlide),this}addText($,q){return H5(this,typeof $==="string"||typeof $==="number"?[{text:$,options:q}]:$,q,!1),this}}function hB($,q){return W2(this,void 0,void 0,function*(){let Q=$.data;return yield new Promise((K,J)=>{var Z,G;let W=new c7.default,B=(Q.length-1)*2+1,V=((G=(Z=Q[0])===null||Z===void 0?void 0:Z.labels)===null||G===void 0?void 0:G.length)>1;W.folder("_rels"),W.folder("docProps"),W.folder("xl/_rels"),W.folder("xl/tables"),W.folder("xl/theme"),W.folder("xl/worksheets"),W.folder("xl/worksheets/_rels"),W.file("[Content_Types].xml",' \n'),W.file("_rels/.rels",` `),W.file("docProps/app.xml",`Microsoft Macintosh Excel0falseWorksheets1Sheet1falsefalsefalse16.0300 `),W.file("docProps/core.xml",'PptxGenJSPptxGenJS'+new Date().toISOString()+''+new Date().toISOString()+""),W.file("xl/_rels/workbook.xml.rels",''),W.file("xl/styles.xml",'\n'),W.file("xl/theme/theme1.xml",''),W.file("xl/workbook.xml",` `),W.file("xl/worksheets/_rels/sheet1.xml.rels",` `);{let U='';if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)U+=``;else if($.opts._type===q0.SCATTER)U+=``;else if(V){let w=Q.length;Q[0].labels.forEach((F)=>w+=F.filter((M)=>M&&M!=="").length),U+=``,U+=""}else{let w=Q.length+Q[0].labels.length*Q[0].labels[0].length+Q[0].labels.length,F=Q.length+Q[0].labels.length*Q[0].labels[0].length+1;U+=``,U+=''}if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)Q.forEach((w,F)=>{if(F===0)U+="X-Axis";else U+=`${k0(w.name||`Y-Axis${F}`)}`,U+=`${k0(`Size${F}`)}`});else Q.forEach((w)=>{U+=`${k0((w.name||" ").replace("X-Axis","X-Values"))}`});if($.opts._type!==q0.BUBBLE&&$.opts._type!==q0.BUBBLE3D&&$.opts._type!==q0.SCATTER)Q[0].labels.slice().reverse().forEach((w)=>{w.filter((F)=>F&&F!=="").forEach((F)=>{U+=`${k0(F)}`})});U+=` `,W.file("xl/sharedStrings.xml",U)}{let U='';if($.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D){U+=``,U+=``;let w=1;Q.forEach((F,M)=>{if(M===0)U+=``;else U+=``,w++,U+=``})}else if($.opts._type===q0.SCATTER)U+=`
`,U+=``,Q.forEach((w,F)=>{U+=``});else U+=`
`,U+=``,Q[0].labels.forEach((w,F)=>{U+=``}),Q.forEach((w,F)=>{U+=``});U+="",U+='',U+="
",W.file("xl/tables/table1.xml",U)}{let U='';if(U+='',$.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D)U+=``;else if($.opts._type===q0.SCATTER)U+=``;else U+=``;if(U+='',U+='',$.opts._type===q0.BUBBLE||$.opts._type===q0.BUBBLE3D){U+="",U+=``,U+='0';for(let w=1;w${w}`;U+="",Q[0].values.forEach((w,F)=>{U+=``,U+=`${w}`;let M=2;for(let k=1;k${Q[k].values[F]||""}`,M++,U+=`${Q[k].sizes[F]||""}`,M++;U+=""})}else if($.opts._type===q0.SCATTER){U+="",U+=``;for(let w=0;w${w}`;U+="",Q[0].values.forEach((w,F)=>{U+=``,U+=`${w}`;for(let M=1;M${Q[M].values[F]||Q[M].values[F]===0?Q[M].values[F]:""}`;U+=""})}else if(U+="",!V){U+=``,Q[0].labels.forEach((w,F)=>{U+=`0`});for(let w=0;w${w+1}`;U+="",Q[0].labels[0].forEach((w,F)=>{U+=``;for(let M=Q[0].labels.length-1;M>=0;M--)U+=``,U+=`${Q.length+F+1}`,U+="";for(let M=0;M${Q[M].values[F]||""}`;U+=""})}else{U+=``;for(let k=0;k0`;for(let k=Q[0].labels.length-1;k${k}`;U+="";let w=Q.length,F=Q[0].labels[0].length,M=Q[0].labels.length;for(let k=0;k`;let f=w,L=Q[0].labels.slice().reverse();L.forEach((D,z)=>{if(D[k]){let H=z===0?1:L[z-1].filter((v)=>v&&v!=="").length;f+=H,U+=`${f}`}});for(let D=0;D${Q[D].values[k]||0}`;U+=""}}U+="",U+='',U+=` -`,W.file("xl/worksheets/sheet1.xml",U)}W.generateAsync({type:"base64"}).then((U)=>{q.file(`ppt/embeddings/Microsoft_Excel_Worksheet${$.globalId}.xlsx`,U,{base64:!0}),q.file("ppt/charts/_rels/"+$.fileName+".rels",``),q.file(`ppt/charts/${$.fileName}`,EB($)),K("")}).catch((U)=>{J(U)})})})}function EB($){var q,Q,K,J;let Z='',G=!1;{if(Z+='',Z+='',Z+=``,Z+="",$.opts.showTitle)Z+=v5({title:$.opts.title||"Chart Title",color:$.opts.titleColor,fontFace:$.opts.titleFontFace,fontSize:$.opts.titleFontSize||IB,titleAlign:$.opts.titleAlign,titleBold:$.opts.titleBold,titlePos:$.opts.titlePos,titleRotate:$.opts.titleRotate},$.opts.x,$.opts.y),Z+='';else Z+='';if($.opts._type===q0.BAR3D)Z+=``;if(Z+="",$.opts.layout)Z+="",Z+=" ",Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+="";else Z+=""}if(Array.isArray($.opts._type))$.opts._type.forEach((W)=>{let B=Object.assign(Object.assign({},$.opts),W.options),V=B.secondaryValAxis?Y5:o2,U=B.secondaryCatAxis?O7:B8;G=G||B.secondaryValAxis,Z+=$J(W.type,W.data,B,V,U)});else Z+=$J($.opts._type,$.data,$.opts,o2,B8);if($.opts._type!==q0.PIE&&$.opts._type!==q0.DOUGHNUT){if($.opts.valAxes&&$.opts.valAxes.length>1&&!G)throw Error("Secondary axis must be used by one of the multiple charts");if($.opts.catAxes){if(!$.opts.valAxes||$.opts.valAxes.length!==$.opts.catAxes.length)throw Error("There must be the same number of value and category axes.");Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[0]),B8,o2)}else Z+=X7($.opts,B8,o2);if($.opts.valAxes){if(Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[0]),o2),$.opts.valAxes[1])Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[1]),Y5)}else if(Z+=y7($.opts,o2),$.opts._type===q0.BAR3D)Z+=_B($.opts,UJ,o2);if(((q=$.opts)===null||q===void 0?void 0:q.catAxes)&&((Q=$.opts)===null||Q===void 0?void 0:Q.catAxes[1]))Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[1]),O7,Y5)}{if($.opts.showDataTable)Z+="",Z+=` `,Z+=` `,Z+=` `,Z+=` `,Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=` `,Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+="";if(Z+=" ",Z+=((K=$.opts.plotArea.fill)===null||K===void 0?void 0:K.color)?B2($.opts.plotArea.fill):"",Z+=$.opts.plotArea.border?`${B2($.opts.plotArea.border.color)}`:"",Z+=" ",Z+=" ",Z+="",$.opts.showLegend){if(Z+="",Z+='',Z+='',$.opts.legendFontFace||$.opts.legendFontSize||$.opts.legendColor){if(Z+="",Z+=" ",Z+=" ",Z+=" ",Z+=" ",Z+=$.opts.legendFontSize?``:"",$.opts.legendColor)Z+=B2($.opts.legendColor);if($.opts.legendFontFace)Z+='';if($.opts.legendFontFace)Z+='';Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=""}Z+=""}}if(Z+=' ',Z+=' ',$.opts._type===q0.SCATTER)Z+='';return Z+="",Z+="",Z+=((J=$.opts.chartArea.fill)===null||J===void 0?void 0:J.color)?B2($.opts.chartArea.fill):"",Z+=$.opts.chartArea.border?`${B2($.opts.chartArea.border.color)}`:"",Z+=" ",Z+="",Z+='',Z+="",Z}function $J($,q,Q,K,J,Z){let G=-1,W=1,B=null,V="";switch($){case q0.AREA:case q0.BAR:case q0.BAR3D:case q0.LINE:case q0.RADAR:if(V+=``,$===q0.AREA&&Q.barGrouping==="stacked")V+='';if($===q0.BAR||$===q0.BAR3D)V+='',V+='';if($===q0.RADAR)V+='';V+='',q.forEach((U)=>{var w;G++,V+="",V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(U._dataIndex+U.labels.length+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";let F=Q.chartColors?Q.chartColors[G%Q.chartColors.length]:null;if(V+=" ",F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,``)+"";else V+=""+R0(F)+"";if($===q0.LINE||$===q0.RADAR)if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+='';else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;if(V+=T1(Q.shadow,P1),V+=" ",V+=' ',$!==q0.RADAR){if(V+="",V+=``,Q.dataLabelBkgrdColors)V+=`${R0(F)}`;if(V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+=``,V+=""}if($===q0.LINE||$===q0.RADAR){if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+=" ",V+=` ${R0(Q.chartColors[U._dataIndex+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):U._dataIndex])}`,V+=` ${R0(Q.lineDataSymbolLineColor||F)}`,V+=" ",V+=" ",V+=""}if(($===q0.BAR||$===q0.BAR3D)&&q.length===1&&(Q.chartColors&&Q.chartColors!==z8&&Q.chartColors.length>1||((w=Q.invertedColors)===null||w===void 0?void 0:w.length)))U.values.forEach((M,k)=>{let f=M<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else if($===q0.BAR)V+="",V+=' ',V+="";else V+="",V+=" ",V+=' ',V+=" ",V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});{if(V+="",Q.catLabelFormatCode)V+=" ",V+=` Sheet1!$A$2:$A$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.catLabelFormatCode||"General")+"",V+=` `,U.labels[0].forEach((M,k)=>V+=`${k0(M)}`),V+=" ",V+=" ";else V+=" ",V+=` Sheet1!$A$2:$${j0(U.labels.length)}$${U.labels[0].length+1}`,V+=" ",V+=` `,U.labels.forEach((M)=>{V+="",M.forEach((k,f)=>V+=`${k0(k)}`),V+=""}),V+=" ",V+=" ";V+=""}if(V+="",V+=" ",V+=`Sheet1!$${j0(U._dataIndex+U.labels.length+1)}$2:$${j0(U._dataIndex+U.labels.length+1)}$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.valLabelFormatCode||Q.dataTableFormatCode||"General")+"",V+=` `,U.values.forEach((M,k)=>V+=`${M||M===0?M:""}`),V+=" ",V+=" ",V+="",$===q0.LINE)V+='';V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+=" "}if($===q0.BAR)V+=` `,V+=` `;else if($===q0.BAR3D)V+=` `,V+=` `,V+=' ';else if($===q0.LINE)V+=' ';V+=``,V+=``;break;case q0.SCATTER:V+="",V+='',V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=` Sheet1!$${j0(w+2)}$1`,V+=' '+k0(U.name)+"",V+=" ",V+=" ",V+=" ";{let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,'')+"";else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1)}V+=" ";{if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+="",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,V+=`${R0(Q.lineDataSymbolLineColor||Q.chartColors[G%Q.chartColors.length])}`,V+="",V+="",V+=""}if(Q.showLabel){let F=k5("-xxxx-xxxx-xxxx-xxxxxxxxxxxx");if(U.labels[0]&&(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"))V+="",U.labels[0].forEach((M,k)=>{if(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"){if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" "+k0(M)+"",V+=" ",Q.dataLabelFormatScatter==="customXY"&&!/^ *$/.test(M))V+=" ",V+=' ',V+=" (",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"",V+=" ",V+=" ",V+=' ',V+=" , ",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"]",V+=" ",V+=" ",V+=' ',V+=" )",V+=" ",V+=' ';if(V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=` `,V+=" ",V+=" ",V+=""}}),V+="";if(Q.dataLabelFormatScatter==="XY"){if(V+="",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=` `,V+=` `,V+=` `,V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=""}}if(q.length===1&&Q.chartColors!==z8)U.values.forEach((F,M)=>{let k=F<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else V+="",V+=' ',V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=` Sheet1!$${j0(w+2)}$2:$${j0(w+2)}$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+='',V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}V+=``,V+="";break;case q0.BUBBLE:case q0.BUBBLE3D:V+="",V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(W+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";{V+="";let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=`${R0(F,'')}`;else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1),V+=""}V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${q[0].values.length+1}`,W++,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${U.sizes.length+1}`,W++,V+=" ",V+=" General",V+=` `,U.sizes.forEach((F,M)=>{V+=`${F||""}`}),V+=" ",V+=" ",V+=" ",V+=' ',V+=""});{if(V+="",V+=``,V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+="",V+=' ',V+=' ',V+=" ",V+="",V+=""}V+=``,V+="";break;case q0.DOUGHNUT:case q0.PIE:if(B=q[0],V+="",V+=' ',V+="",V+=' ',V+=' ',V+=" ",V+=" ",V+=" Sheet1!$B$1",V+=" ",V+=' ',V+=' '+k0(B.name)+"",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=' ',Q.dataNoEffects)V+="";else V+=T1(Q.shadow,P1);if(V+=" ",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=' ',V+=" ",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;V+=T1(Q.shadow,P1),V+=" ",V+=""}),V+="",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=` `,V+=" ",V+=" ",V+=" ",$===q0.PIE&&Q.dataLabelPosition)V+=``;V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}),V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=' ',V+=" ",V+=" ",V+=" ",V+=" ",V+=$===q0.PIE?'':"",V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+="",V+="",V+=" ",V+=` Sheet1!$A$2:$A$${B.labels[0].length+1}`,V+=" ",V+=` `,B.labels[0].forEach((U,w)=>{V+=`${k0(U)}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=` Sheet1!$B$2:$B$${B.labels[0].length+1}`,V+=" ",V+=` `,B.values.forEach((U,w)=>{V+=`${U||U===0?U:""}`}),V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,$===q0.DOUGHNUT)V+=``;V+="";break;default:V+="";break}return V}function X7($,q,Q){let K="";if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";if(K+=' ',K+=" ",K+='',$.catAxisMaxVal||$.catAxisMaxVal===0)K+=``;if($.catAxisMinVal||$.catAxisMinVal===0)K+=``;if(K+="",K+=' ',K+=' ',K+=$.catGridLine.style!=="none"?n7($.catGridLine):"",$.showCatAxisTitle)K+=v5({color:$.catAxisTitleColor,fontFace:$.catAxisTitleFontFace,fontSize:$.catAxisTitleFontSize,titleRotate:$.catAxisTitleRotate,title:$.catAxisTitle||"Axis Title"});if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+=' ';else K+=' ';if($._type===q0.SCATTER)K+=' ',K+=' ',K+=' ';else K+=' ',K+=' ',K+=' ';if(K+=" ",K+=` `,K+=!$.catAxisLineShow?"":""+R0($.catAxisLineColor||u1.color)+"",K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",$.catAxisLabelRotate)K+=``;else K+="";if(K+=" ",K+=" ",K+=" ",K+=` `,K+=" "+R0($.catAxisLabelColor||Q2)+"",K+=' ',K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=` `,K+=' ',K+=' ',K+=` `,$.catAxisLabelFrequency)K+=' ';if($.catLabelFormatCode||$._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D){if($.catLabelFormatCode){if(["catAxisBaseTimeUnit","catAxisMajorTimeUnit","catAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes($[J].toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.catAxisBaseTimeUnit)K+='';if($.catAxisMajorTimeUnit)K+='';if($.catAxisMinorTimeUnit)K+=''}if($.catAxisMajorUnit)K+=``;if($.catAxisMinorUnit)K+=``}if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";return K}function y7($,q){let Q=q===o2?$.barDir==="col"?"l":"b":$.barDir!=="col"?"r":"t";if(q===Y5)Q="r";let K=q===o2?B8:O7,J="";if(J+="",J+=' ',J+=" ",$.valAxisLogScaleBase)J+=``;if(J+='',$.valAxisMaxVal||$.valAxisMaxVal===0)J+=``;if($.valAxisMinVal||$.valAxisMinVal===0)J+=``;if(J+=" ",J+=` `,J+=' ',$.valGridLine.style!=="none")J+=n7($.valGridLine);if($.showValAxisTitle)J+=v5({color:$.valAxisTitleColor,fontFace:$.valAxisTitleFontFace,fontSize:$.valAxisTitleFontSize,titleRotate:$.valAxisTitleRotate,title:$.valAxisTitle||"Axis Title"});if(J+=``,$._type===q0.SCATTER)J+=' ',J+=' ',J+=' ';else J+=' ',J+=' ',J+=' ';if(J+=" ",J+=` `,J+=!$.valAxisLineShow?"":""+R0($.valAxisLineColor||u1.color)+"",J+=' ',J+=" ",J+=" ",J+=" ",J+=" ",J+=` `,J+=" ",J+=" ",J+=" ",J+=` `,J+=" "+R0($.valAxisLabelColor||Q2)+"",J+=' ',J+=" ",J+=" ",J+=' ',J+=" ",J+=" ",J+=' ',typeof $.catAxisCrossesAt==="number")J+=` `;else if(typeof $.catAxisCrossesAt==="string")J+=' ';else J+=' ';if(J+=' ',$.valAxisMajorUnit)J+=` `;if($.valAxisDisplayUnit)J+=`${$.valAxisDisplayUnitLabel?"":""}`;return J+="",J}function _B($,q,Q){let K="";if(K+="",K+=' ',K+=' ',K+=' ',K+=' ',K+=$.serGridLine.style!=="none"?n7($.serGridLine):"",$.showSerAxisTitle)K+=v5({color:$.serAxisTitleColor,fontFace:$.serAxisTitleFontFace,fontSize:$.serAxisTitleFontSize,titleRotate:$.serAxisTitleRotate,title:$.serAxisTitle||"Axis Title"});if(K+=` `,K+=' ',K+=' ',K+=` `,K+=" ",K+=' ',K+=!$.serAxisLineShow?"":`${R0($.serAxisLineColor||u1.color)}`,K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=` `,K+=` ${R0($.serAxisLabelColor||Q2)}`,K+=` `,K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=' ',$.serAxisLabelFrequency)K+=' ';if($.serLabelFormatCode){if(["serAxisBaseTimeUnit","serAxisMajorTimeUnit","serAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes(J.toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.serAxisBaseTimeUnit)K+=` `;if($.serAxisMajorTimeUnit)K+=` `;if($.serAxisMinorTimeUnit)K+=` `;if($.serAxisMajorUnit)K+=` `;if($.serAxisMinorUnit)K+=` `}return K+="",K}function v5($,q,Q){let K=$.titleAlign==="left"||$.titleAlign==="right"?``:"",J=$.titleRotate?``:"",Z=$.fontSize?`sz="${Math.round($.fontSize*100)}"`:"",G=$.titleBold?1:0,W="";if($.titlePos&&typeof $.titlePos.x==="number"&&typeof $.titlePos.y==="number"){let B=$.titlePos.x+q,V=$.titlePos.y+Q,U=B===0?0:B*(B/5)/10;if(U>=1)U=U/10;if(U>=0.1)U=U/10;let w=V===0?0:V*(V/5)/10;if(w>=1)w=w/10;if(w>=0.1)w=w/10;W=``}return` +`,W.file("xl/worksheets/sheet1.xml",U)}W.generateAsync({type:"base64"}).then((U)=>{q.file(`ppt/embeddings/Microsoft_Excel_Worksheet${$.globalId}.xlsx`,U,{base64:!0}),q.file("ppt/charts/_rels/"+$.fileName+".rels",``),q.file(`ppt/charts/${$.fileName}`,xB($)),K("")}).catch((U)=>{J(U)})})})}function xB($){var q,Q,K,J;let Z='',G=!1;{if(Z+='',Z+='',Z+=``,Z+="",$.opts.showTitle)Z+=v5({title:$.opts.title||"Chart Title",color:$.opts.titleColor,fontFace:$.opts.titleFontFace,fontSize:$.opts.titleFontSize||DB,titleAlign:$.opts.titleAlign,titleBold:$.opts.titleBold,titlePos:$.opts.titlePos,titleRotate:$.opts.titleRotate},$.opts.x,$.opts.y),Z+='';else Z+='';if($.opts._type===q0.BAR3D)Z+=``;if(Z+="",$.opts.layout)Z+="",Z+=" ",Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+="";else Z+=""}if(Array.isArray($.opts._type))$.opts._type.forEach((W)=>{let B=Object.assign(Object.assign({},$.opts),W.options),V=B.secondaryValAxis?Y5:o2,U=B.secondaryCatAxis?O7:B8;G=G||B.secondaryValAxis,Z+=$J(W.type,W.data,B,V,U)});else Z+=$J($.opts._type,$.data,$.opts,o2,B8);if($.opts._type!==q0.PIE&&$.opts._type!==q0.DOUGHNUT){if($.opts.valAxes&&$.opts.valAxes.length>1&&!G)throw Error("Secondary axis must be used by one of the multiple charts");if($.opts.catAxes){if(!$.opts.valAxes||$.opts.valAxes.length!==$.opts.catAxes.length)throw Error("There must be the same number of value and category axes.");Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[0]),B8,o2)}else Z+=X7($.opts,B8,o2);if($.opts.valAxes){if(Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[0]),o2),$.opts.valAxes[1])Z+=y7(Object.assign(Object.assign({},$.opts),$.opts.valAxes[1]),Y5)}else if(Z+=y7($.opts,o2),$.opts._type===q0.BAR3D)Z+=OB($.opts,UJ,o2);if(((q=$.opts)===null||q===void 0?void 0:q.catAxes)&&((Q=$.opts)===null||Q===void 0?void 0:Q.catAxes[1]))Z+=X7(Object.assign(Object.assign({},$.opts),$.opts.catAxes[1]),O7,Y5)}{if($.opts.showDataTable)Z+="",Z+=` `,Z+=` `,Z+=` `,Z+=` `,Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=` `,Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=" ",Z+="";if(Z+=" ",Z+=((K=$.opts.plotArea.fill)===null||K===void 0?void 0:K.color)?B2($.opts.plotArea.fill):"",Z+=$.opts.plotArea.border?`${B2($.opts.plotArea.border.color)}`:"",Z+=" ",Z+=" ",Z+="",$.opts.showLegend){if(Z+="",Z+='',Z+='',$.opts.legendFontFace||$.opts.legendFontSize||$.opts.legendColor){if(Z+="",Z+=" ",Z+=" ",Z+=" ",Z+=" ",Z+=$.opts.legendFontSize?``:"",$.opts.legendColor)Z+=B2($.opts.legendColor);if($.opts.legendFontFace)Z+='';if($.opts.legendFontFace)Z+='';Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=""}Z+=""}}if(Z+=' ',Z+=' ',$.opts._type===q0.SCATTER)Z+='';return Z+="",Z+="",Z+=((J=$.opts.chartArea.fill)===null||J===void 0?void 0:J.color)?B2($.opts.chartArea.fill):"",Z+=$.opts.chartArea.border?`${B2($.opts.chartArea.border.color)}`:"",Z+=" ",Z+="",Z+='',Z+="",Z}function $J($,q,Q,K,J,Z){let G=-1,W=1,B=null,V="";switch($){case q0.AREA:case q0.BAR:case q0.BAR3D:case q0.LINE:case q0.RADAR:if(V+=``,$===q0.AREA&&Q.barGrouping==="stacked")V+='';if($===q0.BAR||$===q0.BAR3D)V+='',V+='';if($===q0.RADAR)V+='';V+='',q.forEach((U)=>{var w;G++,V+="",V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(U._dataIndex+U.labels.length+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";let F=Q.chartColors?Q.chartColors[G%Q.chartColors.length]:null;if(V+=" ",F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,``)+"";else V+=""+R0(F)+"";if($===q0.LINE||$===q0.RADAR)if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+='';else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;if(V+=T1(Q.shadow,P1),V+=" ",V+=' ',$!==q0.RADAR){if(V+="",V+=``,Q.dataLabelBkgrdColors)V+=`${R0(F)}`;if(V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+=``,V+=""}if($===q0.LINE||$===q0.RADAR){if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+=" ",V+=` ${R0(Q.chartColors[U._dataIndex+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):U._dataIndex])}`,V+=` ${R0(Q.lineDataSymbolLineColor||F)}`,V+=" ",V+=" ",V+=""}if(($===q0.BAR||$===q0.BAR3D)&&q.length===1&&(Q.chartColors&&Q.chartColors!==z8&&Q.chartColors.length>1||((w=Q.invertedColors)===null||w===void 0?void 0:w.length)))U.values.forEach((M,k)=>{let f=M<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else if($===q0.BAR)V+="",V+=' ',V+="";else V+="",V+=" ",V+=' ',V+=" ",V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});{if(V+="",Q.catLabelFormatCode)V+=" ",V+=` Sheet1!$A$2:$A$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.catLabelFormatCode||"General")+"",V+=` `,U.labels[0].forEach((M,k)=>V+=`${k0(M)}`),V+=" ",V+=" ";else V+=" ",V+=` Sheet1!$A$2:$${j0(U.labels.length)}$${U.labels[0].length+1}`,V+=" ",V+=` `,U.labels.forEach((M)=>{V+="",M.forEach((k,f)=>V+=`${k0(k)}`),V+=""}),V+=" ",V+=" ";V+=""}if(V+="",V+=" ",V+=`Sheet1!$${j0(U._dataIndex+U.labels.length+1)}$2:$${j0(U._dataIndex+U.labels.length+1)}$${U.labels[0].length+1}`,V+=" ",V+=" "+(Q.valLabelFormatCode||Q.dataTableFormatCode||"General")+"",V+=` `,U.values.forEach((M,k)=>V+=`${M||M===0?M:""}`),V+=" ",V+=" ",V+="",$===q0.LINE)V+='';V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+=" "}if($===q0.BAR)V+=` `,V+=` `;else if($===q0.BAR3D)V+=` `,V+=` `,V+=' ';else if($===q0.LINE)V+=' ';V+=``,V+=``;break;case q0.SCATTER:V+="",V+='',V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=` Sheet1!$${j0(w+2)}$1`,V+=' '+k0(U.name)+"",V+=" ",V+=" ",V+=" ";{let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=""+R0(F,'')+"";else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1)}V+=" ";{if(V+="",V+=' ',Q.lineDataSymbolSize)V+=``;V+="",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,V+=`${R0(Q.lineDataSymbolLineColor||Q.chartColors[G%Q.chartColors.length])}`,V+="",V+="",V+=""}if(Q.showLabel){let F=k5("-xxxx-xxxx-xxxx-xxxxxxxxxxxx");if(U.labels[0]&&(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"))V+="",U.labels[0].forEach((M,k)=>{if(Q.dataLabelFormatScatter==="custom"||Q.dataLabelFormatScatter==="customXY"){if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" "+k0(M)+"",V+=" ",Q.dataLabelFormatScatter==="customXY"&&!/^ *$/.test(M))V+=" ",V+=' ',V+=" (",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"",V+=" ",V+=" ",V+=' ',V+=" , ",V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=" ",V+=" ["+k0(U.name)+"]",V+=" ",V+=" ",V+=' ',V+=" )",V+=" ",V+=' ';if(V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=` `,V+=" ",V+=" ",V+=""}}),V+="";if(Q.dataLabelFormatScatter==="XY"){if(V+="",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=` `,V+=` `,V+=` `,V+=' ',V+=' ',V+=" ",V+=' ',V+=' ',V+=" ",V+=" ",V+=""}}if(q.length===1&&Q.chartColors!==z8)U.values.forEach((F,M)=>{let k=F<0?Q.invertedColors||Q.chartColors||z8:Q.chartColors||[];if(V+=" ",V+=` `,V+=' ',V+=' ',V+=" ",Q.lineSize===0)V+="";else V+="",V+=' ',V+="";V+=T1(Q.shadow,P1),V+=" ",V+=" "});V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=` Sheet1!$${j0(w+2)}$2:$${j0(w+2)}$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+='',V+=""});{if(V+=" ",V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=' ',V+=" ",V+=" ",V+=" ",Q.dataLabelPosition)V+=' ';V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}V+=``,V+="";break;case q0.BUBBLE:case q0.BUBBLE3D:V+="",V+='',G=-1,q.filter((U,w)=>w>0).forEach((U,w)=>{G++,V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" Sheet1!$"+j0(W+1)+"$1",V+=' '+k0(U.name)+"",V+=" ",V+=" ";{V+="";let F=Q.chartColors[G%Q.chartColors.length];if(F==="transparent")V+="";else if(Q.chartColorsOpacity)V+=`${R0(F,'')}`;else V+=""+R0(F)+"";if(Q.lineSize===0)V+="";else if(Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;else V+=`${R0(F)}`,V+=``;V+=T1(Q.shadow,P1),V+=""}V+="",V+=" ",V+=` Sheet1!$A$2:$A$${q[0].values.length+1}`,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${F||F===0?F:""}`}),V+=" ",V+=" ",V+="",V+="",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${q[0].values.length+1}`,W++,V+=" ",V+=" General",V+=` `,q[0].values.forEach((F,M)=>{V+=`${U.values[M]||U.values[M]===0?U.values[M]:""}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=`Sheet1!$${j0(W+1)}$2:$${j0(W+1)}$${U.sizes.length+1}`,W++,V+=" ",V+=" General",V+=` `,U.sizes.forEach((F,M)=>{V+=`${F||""}`}),V+=" ",V+=" ",V+=" ",V+=' ',V+=""});{if(V+="",V+=``,V+="",V+=``,V+=`${R0(Q.dataLabelColor||Q2)}`,V+=``,V+="",Q.dataLabelPosition)V+=``;V+='',V+=``,V+=``,V+="",V+=' ',V+=' ',V+=" ",V+="",V+=""}V+=``,V+="";break;case q0.DOUGHNUT:case q0.PIE:if(B=q[0],V+="",V+=' ',V+="",V+=' ',V+=' ',V+=" ",V+=" ",V+=" Sheet1!$B$1",V+=" ",V+=' ',V+=' '+k0(B.name)+"",V+=" ",V+=" ",V+=" ",V+=" ",V+=' ',V+=' ',Q.dataNoEffects)V+="";else V+=T1(Q.shadow,P1);if(V+=" ",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=' ',V+=" ",V+=`${R0(Q.chartColors[w+1>Q.chartColors.length?Math.floor(Math.random()*Q.chartColors.length):w])}`,Q.dataBorder)V+=`${R0(Q.dataBorder.color)}`;V+=T1(Q.shadow,P1),V+=" ",V+=""}),V+="",B.labels[0].forEach((U,w)=>{if(V+="",V+=` `,V+=` `,V+=" ",V+=" ",V+=" ",V+=` `,V+=" "+R0(Q.dataLabelColor||Q2)+"",V+=` `,V+=" ",V+=" ",V+=" ",$===q0.PIE&&Q.dataLabelPosition)V+=``;V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=" "}),V+=` `,V+=" ",V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,V+=' ',V+=" ",V+=" ",V+=" ",V+=" ",V+=$===q0.PIE?'':"",V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=' ',V+=` `,V+="",V+="",V+=" ",V+=` Sheet1!$A$2:$A$${B.labels[0].length+1}`,V+=" ",V+=` `,B.labels[0].forEach((U,w)=>{V+=`${k0(U)}`}),V+=" ",V+=" ",V+="",V+=" ",V+=" ",V+=` Sheet1!$B$2:$B$${B.labels[0].length+1}`,V+=" ",V+=` `,B.values.forEach((U,w)=>{V+=`${U||U===0?U:""}`}),V+=" ",V+=" ",V+=" ",V+=" ",V+=` `,$===q0.DOUGHNUT)V+=``;V+="";break;default:V+="";break}return V}function X7($,q,Q){let K="";if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";if(K+=' ',K+=" ",K+='',$.catAxisMaxVal||$.catAxisMaxVal===0)K+=``;if($.catAxisMinVal||$.catAxisMinVal===0)K+=``;if(K+="",K+=' ',K+=' ',K+=$.catGridLine.style!=="none"?n7($.catGridLine):"",$.showCatAxisTitle)K+=v5({color:$.catAxisTitleColor,fontFace:$.catAxisTitleFontFace,fontSize:$.catAxisTitleFontSize,titleRotate:$.catAxisTitleRotate,title:$.catAxisTitle||"Axis Title"});if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+=' ';else K+=' ';if($._type===q0.SCATTER)K+=' ',K+=' ',K+=' ';else K+=' ',K+=' ',K+=' ';if(K+=" ",K+=` `,K+=!$.catAxisLineShow?"":""+R0($.catAxisLineColor||u1.color)+"",K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",$.catAxisLabelRotate)K+=``;else K+="";if(K+=" ",K+=" ",K+=" ",K+=` `,K+=" "+R0($.catAxisLabelColor||Q2)+"",K+=' ',K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=` `,K+=' ',K+=' ',K+=` `,$.catAxisLabelFrequency)K+=' ';if($.catLabelFormatCode||$._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D){if($.catLabelFormatCode){if(["catAxisBaseTimeUnit","catAxisMajorTimeUnit","catAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes($[J].toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.catAxisBaseTimeUnit)K+='';if($.catAxisMajorTimeUnit)K+='';if($.catAxisMinorTimeUnit)K+=''}if($.catAxisMajorUnit)K+=``;if($.catAxisMinorUnit)K+=``}if($._type===q0.SCATTER||$._type===q0.BUBBLE||$._type===q0.BUBBLE3D)K+="";else K+="";return K}function y7($,q){let Q=q===o2?$.barDir==="col"?"l":"b":$.barDir!=="col"?"r":"t";if(q===Y5)Q="r";let K=q===o2?B8:O7,J="";if(J+="",J+=' ',J+=" ",$.valAxisLogScaleBase)J+=``;if(J+='',$.valAxisMaxVal||$.valAxisMaxVal===0)J+=``;if($.valAxisMinVal||$.valAxisMinVal===0)J+=``;if(J+=" ",J+=` `,J+=' ',$.valGridLine.style!=="none")J+=n7($.valGridLine);if($.showValAxisTitle)J+=v5({color:$.valAxisTitleColor,fontFace:$.valAxisTitleFontFace,fontSize:$.valAxisTitleFontSize,titleRotate:$.valAxisTitleRotate,title:$.valAxisTitle||"Axis Title"});if(J+=``,$._type===q0.SCATTER)J+=' ',J+=' ',J+=' ';else J+=' ',J+=' ',J+=' ';if(J+=" ",J+=` `,J+=!$.valAxisLineShow?"":""+R0($.valAxisLineColor||u1.color)+"",J+=' ',J+=" ",J+=" ",J+=" ",J+=" ",J+=` `,J+=" ",J+=" ",J+=" ",J+=` `,J+=" "+R0($.valAxisLabelColor||Q2)+"",J+=' ',J+=" ",J+=" ",J+=' ',J+=" ",J+=" ",J+=' ',typeof $.catAxisCrossesAt==="number")J+=` `;else if(typeof $.catAxisCrossesAt==="string")J+=' ';else J+=' ';if(J+=' ',$.valAxisMajorUnit)J+=` `;if($.valAxisDisplayUnit)J+=`${$.valAxisDisplayUnitLabel?"":""}`;return J+="",J}function OB($,q,Q){let K="";if(K+="",K+=' ',K+=' ',K+=' ',K+=' ',K+=$.serGridLine.style!=="none"?n7($.serGridLine):"",$.showSerAxisTitle)K+=v5({color:$.serAxisTitleColor,fontFace:$.serAxisTitleFontFace,fontSize:$.serAxisTitleFontSize,titleRotate:$.serAxisTitleRotate,title:$.serAxisTitle||"Axis Title"});if(K+=` `,K+=' ',K+=' ',K+=` `,K+=" ",K+=' ',K+=!$.serAxisLineShow?"":`${R0($.serAxisLineColor||u1.color)}`,K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=` `,K+=` ${R0($.serAxisLabelColor||Q2)}`,K+=` `,K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=' ',$.serAxisLabelFrequency)K+=' ';if($.serLabelFormatCode){if(["serAxisBaseTimeUnit","serAxisMajorTimeUnit","serAxisMinorTimeUnit"].forEach((J)=>{if($[J]&&(typeof $[J]!=="string"||!["days","months","years"].includes(J.toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),$[J]=null}),$.serAxisBaseTimeUnit)K+=` `;if($.serAxisMajorTimeUnit)K+=` `;if($.serAxisMinorTimeUnit)K+=` `;if($.serAxisMajorUnit)K+=` `;if($.serAxisMinorUnit)K+=` `}return K+="",K}function v5($,q,Q){let K=$.titleAlign==="left"||$.titleAlign==="right"?``:"",J=$.titleRotate?``:"",Z=$.fontSize?`sz="${Math.round($.fontSize*100)}"`:"",G=$.titleBold?1:0,W="";if($.titlePos&&typeof $.titlePos.x==="number"&&typeof $.titlePos.y==="number"){let B=$.titlePos.x+q,V=$.titlePos.y+Q,U=B===0?0:B*(B/5)/10;if(U>=1)U=U/10;if(U>=0.1)U=U/10;let w=V===0?0:V*(V/5)/10;if(w>=1)w=w/10;if(w>=0.1)w=w/10;W=``}return` ${J} @@ -54,22 +54,22 @@ ${W} `}function j0($){let q="",Q=$-1;if(Q<=25)q=W8[Q];else q=`${W8[Math.floor(Q/W8.length-1)]}${W8[Q%W8.length]}`;return q}function T1($,q){if(!$)return"";else if(typeof $!=="object")return console.warn("`shadow` options must be an object. Ex: `{shadow: {type:'none'}}`"),"";let Q="",K=Object.assign(Object.assign({},q),$),J=K.type||"outer",Z=Y0(K.blur),G=Y0(K.offset),W=Math.round(K.angle*60000),B=K.color,V=Math.round(K.opacity*1e5),U=K.rotateWithShape?1:0;return Q+=``,Q+=``,Q+=``,Q+=``,Q+="",Q}function n7($){let q="";return q+=" ",q+=` `,q+=' ',q+=' ',q+=" ",q+=" ",q+="",q}function D5($){if(!$||$==="flat")return"flat";else if($==="square")return"sq";else if($==="round")return"rnd";else throw Error(`Invalid chart line cap: ${$}`)}function h7($){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node",J,Z,G=K?()=>W2(this,void 0,void 0,function*(){({default:J}=yield import("node:fs")),{default:Z}=yield Promise.resolve().then(() => (tK(),sK))}):()=>W2(this,void 0,void 0,function*(){});if(K)G();let W=[],B=$._relsMedia.filter((U)=>U.type!=="online"&&!U.data&&(!U.path||U.path&&!U.path.includes("preencoded"))),V=[];return B.forEach((U)=>{if(!V.includes(U.path))U.isDuplicate=!1,V.push(U.path);else U.isDuplicate=!0}),B.filter((U)=>!U.isDuplicate).forEach((U)=>{W.push((()=>W2(this,void 0,void 0,function*(){if(!Z)yield G();if(K&&J&&U.path.indexOf("http")!==0)try{let w=J.readFileSync(U.path);return U.data=Buffer.from(w).toString("base64"),B.filter((F)=>F.isDuplicate&&F.path===U.path).forEach((F)=>F.data=U.data),"done"}catch(w){throw U.data=j6,B.filter((F)=>F.isDuplicate&&F.path===U.path).forEach((F)=>F.data=U.data),Error(`ERROR: Unable to read media: "${U.path}" -${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F)=>{Z.get(U.path,(M)=>{let k="";M.setEncoding("binary"),M.on("data",(f)=>k+=f),M.on("end",()=>{U.data=Buffer.from(k,"binary").toString("base64"),B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),w("done")}),M.on("error",()=>{U.data=j6,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),F(Error(`ERROR! Unable to load image (https.get): ${U.path}`))})})});return yield new Promise((w,F)=>{let M=new XMLHttpRequest;M.onload=()=>{let k=new FileReader;k.onloadend=()=>{if(U.data=k.result,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),!U.isSvgPng)w("done");else QJ(U).then(()=>w("done")).catch(F)},k.readAsDataURL(M.response)},M.onerror=()=>{U.data=j6,B.filter((k)=>k.isDuplicate&&k.path===U.path).forEach((k)=>k.data=U.data),F(Error(`ERROR! Unable to load image (xhr.onerror): ${U.path}`))},M.open("GET",U.path),M.responseType="blob",M.send()})}))())}),$._relsMedia.filter((U)=>U.isSvgPng&&U.data).forEach((U)=>{(()=>W2(this,void 0,void 0,function*(){if(K&&!J)yield G();if(K&&J)U.data=j6,W.push(Promise.resolve("done"));else W.push(QJ(U))}))()}),W}function QJ($){return W2(this,void 0,void 0,function*(){return yield new Promise((q,Q)=>{let K=new Image;K.onload=()=>{if(K.width+K.height===0)K.onerror("h/w=0");let J=document.createElement("CANVAS"),Z=J.getContext("2d");J.width=K.width,J.height=K.height,Z.drawImage(K,0,0);try{$.data=J.toDataURL($.type),q("done")}catch(G){K.onerror(G.toString())}J=null},K.onerror=()=>{$.data=j6,Q(Error(`ERROR! Unable to load image (image.onerror): ${$.path}`))},K.src=typeof $.data==="string"?$.data:j6})})}var cB={cover:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.h/Q:q.w,G=J?q.h:q.w*Q,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},contain:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.w:q.h/Q,G=J?q.w*Q:q.h,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},crop:function($,q){let Q=q.x,K=$.w-(q.x+q.w),J=q.y,Z=$.h-(q.y+q.h),G=Math.round(1e5*(Q/$.w)),W=Math.round(1e5*(K/$.w)),B=Math.round(1e5*(J/$.h)),V=Math.round(1e5*(Z/$.h));return``}};function d7($){var q;let Q=$._name?'':"",K=1;if($._bkgdImgRid)Q+=``;else if((q=$.background)===null||q===void 0?void 0:q.color)Q+=`${B2($.background)}`;else if(!$.bkgd&&$._name&&$._name===x7)Q+='';if(Q+="",Q+='',Q+='',Q+='',$._slideObjects.forEach((J,Z)=>{var G,W,B,V,U,w,F,M;let k=0,f=0,L=H0("75%","X",$._presLayout),D=0,z,N="",H=null,v=null,j=0,n=0,d=null,_=null,X=(G=J.options)===null||G===void 0?void 0:G.sizing,P=(W=J.options)===null||W===void 0?void 0:W.rounding;if($._slideLayout!==void 0&&$._slideLayout._slideObjects!==void 0&&J.options&&J.options.placeholder)z=$._slideLayout._slideObjects.filter((h)=>h.options.placeholder===J.options.placeholder)[0];if(J.options=J.options||{},typeof J.options.x<"u")k=H0(J.options.x,"X",$._presLayout);if(typeof J.options.y<"u")f=H0(J.options.y,"Y",$._presLayout);if(typeof J.options.w<"u")L=H0(J.options.w,"X",$._presLayout);if(typeof J.options.h<"u")D=H0(J.options.h,"Y",$._presLayout);let g=L,c=D;if(z){if(z.options.x||z.options.x===0)k=H0(z.options.x,"X",$._presLayout);if(z.options.y||z.options.y===0)f=H0(z.options.y,"Y",$._presLayout);if(z.options.w||z.options.w===0)L=H0(z.options.w,"X",$._presLayout);if(z.options.h||z.options.h===0)D=H0(z.options.h,"Y",$._presLayout)}if(J.options.flipH)N+=' flipH="1"';if(J.options.flipV)N+=' flipV="1"';if(J.options.rotate)N+=` rot="${S1(J.options.rotate)}"`;switch(J._type){case D0.table:if(H=J.arrTabRows,v=J.options,j=0,n=0,H[0].forEach((h)=>{d=h.options||null,j+=(d===null||d===void 0?void 0:d.colspan)?Number(d.colspan):1}),_=``,_+=' ',_+=``,_+='',Array.isArray(v.colW)){_+="";for(let h=0;h`}_+=""}else{if(n=v.colW?v.colW:L0,J.options.w&&!v.colW)n=Math.round((typeof J.options.w==="number"?J.options.w:1)/j);_+="";for(let h=0;h`;_+=""}H.forEach((h)=>{var x,l;for(let $0=0;$01){let W0=Array(F0-1).fill(void 0).map(()=>{return{_type:D0.tablecell,options:{rowspan:p},_hmerge:!0}});h.splice($0+1,0,...W0),$0+=F0}else $0+=1}}),H.forEach((h,x)=>{let l=H[x+1];if(!l)return;h.forEach(($0,Z0)=>{var F0,p;let W0=$0._rowContinue||((F0=$0.options)===null||F0===void 0?void 0:F0.rowspan),y=(p=$0.options)===null||p===void 0?void 0:p.colspan,i=$0._hmerge;if(W0&&W0>1){let U0={_type:D0.tablecell,options:{colspan:y},_rowContinue:W0-1,_vmerge:!0,_hmerge:i};l.splice(Z0,0,U0)}})}),H.forEach((h,x)=>{let l=0;if(Array.isArray(v.rowH)&&v.rowH[x])l=v0(Number(v.rowH[x]));else if(v.rowH&&!isNaN(Number(v.rowH)))l=v0(Number(v.rowH));else if(J.options.cy||J.options.h)l=Math.round((J.options.h?v0(J.options.h):typeof J.options.cy==="number"?J.options.cy:1)/H.length);_+=``,h.forEach(($0)=>{var Z0,F0,p,W0,y;let i=$0,U0={rowSpan:((Z0=i.options)===null||Z0===void 0?void 0:Z0.rowspan)>1?i.options.rowspan:void 0,gridSpan:((F0=i.options)===null||F0===void 0?void 0:F0.colspan)>1?i.options.colspan:void 0,vMerge:i._vmerge?1:void 0,hMerge:i._hmerge?1:void 0},m=Object.keys(U0).map((K0)=>[K0,U0[K0]]).filter(([,K0])=>!!K0).map(([K0,R])=>`${String(K0)}="${String(R)}"`).join(" ");if(m)m=" "+m;if(i._hmerge||i._vmerge){_+=``;return}let V0=i.options||{};i.options=V0,["align","bold","border","color","fill","fontFace","fontSize","margin","textDirection","underline","valign"].forEach((K0)=>{if(v[K0]&&!V0[K0]&&V0[K0]!==0)V0[K0]=v[K0]});let w0=V0.valign?` anchor="${V0.valign.replace(/^c$/i,"ctr").replace(/^m$/i,"ctr").replace("center","ctr").replace("middle","ctr").replace("top","t").replace("btm","b").replace("bottom","b")}"`:"",S=V0.textDirection&&V0.textDirection!=="horz"?` vert="${V0.textDirection}"`:"",b=((W0=(p=i._optImp)===null||p===void 0?void 0:p.fill)===null||W0===void 0?void 0:W0.color)?i._optImp.fill.color:((y=i._optImp)===null||y===void 0?void 0:y.fill)&&typeof i._optImp.fill==="string"?i._optImp.fill:"";b=b||V0.fill?V0.fill:"";let O=b?B2(b):"",E=V0.margin===0||V0.margin?V0.margin:JJ;if(!Array.isArray(E)&&typeof E==="number")E=[E,E,E,E];let a="";if(E[0]>=1)a=` marL="${Y0(E[3])}" marR="${Y0(E[1])}" marT="${Y0(E[0])}" marB="${Y0(E[2])}"`;else a=` marL="${v0(E[3])}" marR="${v0(E[1])}" marT="${v0(E[0])}" marB="${v0(E[2])}"`;if(_+=`${KJ(i)}`,V0.border&&Array.isArray(V0.border))[{idx:3,name:"lnL"},{idx:1,name:"lnR"},{idx:0,name:"lnT"},{idx:2,name:"lnB"}].forEach((K0)=>{if(V0.border[K0.idx].type!=="none")_+=``,_+=`${R0(V0.border[K0.idx].color)}`,_+=``,_+=``;else _+=``});_+=O,_+=" ",_+=" "}),_+=""}),_+=" ",_+=" ",_+=" ",_+="",Q+=_,K++;break;case D0.text:case D0.placeholder:if(!J.options.line&&D===0)D=L0*0.3;if(!J.options._bodyProp)J.options._bodyProp={};if(J.options.margin&&Array.isArray(J.options.margin))J.options._bodyProp.lIns=Y0(J.options.margin[0]||0),J.options._bodyProp.rIns=Y0(J.options.margin[1]||0),J.options._bodyProp.bIns=Y0(J.options.margin[2]||0),J.options._bodyProp.tIns=Y0(J.options.margin[3]||0);else if(typeof J.options.margin==="number")J.options._bodyProp.lIns=Y0(J.options.margin),J.options._bodyProp.rIns=Y0(J.options.margin),J.options._bodyProp.bIns=Y0(J.options.margin),J.options._bodyProp.tIns=Y0(J.options.margin);if(Q+="",Q+=``,(B=J.options.hyperlink)===null||B===void 0?void 0:B.url)Q+=``;if((V=J.options.hyperlink)===null||V===void 0?void 0:V.slide)Q+=``;if(Q+="",Q+="':"/>"),Q+=`${J._type==="placeholder"?N5(J):N5(z)}`,Q+="",Q+=``,Q+=``,Q+=``,J.shape==="custGeom")Q+="",Q+="",Q+="",Q+="",Q+="",Q+="",Q+='',Q+="",Q+=``,(w=J.options.points)===null||w===void 0||w.forEach((h,x)=>{if("curve"in h)switch(h.curve.type){case"arc":Q+=``;break;case"cubic":Q+=` +${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F)=>{Z.get(U.path,(M)=>{let k="";M.setEncoding("binary"),M.on("data",(f)=>k+=f),M.on("end",()=>{U.data=Buffer.from(k,"binary").toString("base64"),B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),w("done")}),M.on("error",()=>{U.data=j6,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),F(Error(`ERROR! Unable to load image (https.get): ${U.path}`))})})});return yield new Promise((w,F)=>{let M=new XMLHttpRequest;M.onload=()=>{let k=new FileReader;k.onloadend=()=>{if(U.data=k.result,B.filter((f)=>f.isDuplicate&&f.path===U.path).forEach((f)=>f.data=U.data),!U.isSvgPng)w("done");else QJ(U).then(()=>w("done")).catch(F)},k.readAsDataURL(M.response)},M.onerror=()=>{U.data=j6,B.filter((k)=>k.isDuplicate&&k.path===U.path).forEach((k)=>k.data=U.data),F(Error(`ERROR! Unable to load image (xhr.onerror): ${U.path}`))},M.open("GET",U.path),M.responseType="blob",M.send()})}))())}),$._relsMedia.filter((U)=>U.isSvgPng&&U.data).forEach((U)=>{(()=>W2(this,void 0,void 0,function*(){if(K&&!J)yield G();if(K&&J)U.data=j6,W.push(Promise.resolve("done"));else W.push(QJ(U))}))()}),W}function QJ($){return W2(this,void 0,void 0,function*(){return yield new Promise((q,Q)=>{let K=new Image;K.onload=()=>{if(K.width+K.height===0)K.onerror("h/w=0");let J=document.createElement("CANVAS"),Z=J.getContext("2d");J.width=K.width,J.height=K.height,Z.drawImage(K,0,0);try{$.data=J.toDataURL($.type),q("done")}catch(G){K.onerror(G.toString())}J=null},K.onerror=()=>{$.data=j6,Q(Error(`ERROR! Unable to load image (image.onerror): ${$.path}`))},K.src=typeof $.data==="string"?$.data:j6})})}var PB={cover:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.h/Q:q.w,G=J?q.h:q.w*Q,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},contain:function($,q){let Q=$.h/$.w,J=q.h/q.w>Q,Z=J?q.w:q.h/Q,G=J?q.w*Q:q.h,W=Math.round(50000*(1-q.w/Z)),B=Math.round(50000*(1-q.h/G));return``},crop:function($,q){let Q=q.x,K=$.w-(q.x+q.w),J=q.y,Z=$.h-(q.y+q.h),G=Math.round(1e5*(Q/$.w)),W=Math.round(1e5*(K/$.w)),B=Math.round(1e5*(J/$.h)),V=Math.round(1e5*(Z/$.h));return``}};function d7($){var q;let Q=$._name?'':"",K=1;if($._bkgdImgRid)Q+=``;else if((q=$.background)===null||q===void 0?void 0:q.color)Q+=`${B2($.background)}`;else if(!$.bkgd&&$._name&&$._name===x7)Q+='';if(Q+="",Q+='',Q+='',Q+='',$._slideObjects.forEach((J,Z)=>{var G,W,B,V,U,w,F,M;let k=0,f=0,L=H0("75%","X",$._presLayout),D=0,z,N="",H=null,v=null,j=0,n=0,d=null,_=null,X=(G=J.options)===null||G===void 0?void 0:G.sizing,P=(W=J.options)===null||W===void 0?void 0:W.rounding;if($._slideLayout!==void 0&&$._slideLayout._slideObjects!==void 0&&J.options&&J.options.placeholder)z=$._slideLayout._slideObjects.filter((h)=>h.options.placeholder===J.options.placeholder)[0];if(J.options=J.options||{},typeof J.options.x<"u")k=H0(J.options.x,"X",$._presLayout);if(typeof J.options.y<"u")f=H0(J.options.y,"Y",$._presLayout);if(typeof J.options.w<"u")L=H0(J.options.w,"X",$._presLayout);if(typeof J.options.h<"u")D=H0(J.options.h,"Y",$._presLayout);let g=L,c=D;if(z){if(z.options.x||z.options.x===0)k=H0(z.options.x,"X",$._presLayout);if(z.options.y||z.options.y===0)f=H0(z.options.y,"Y",$._presLayout);if(z.options.w||z.options.w===0)L=H0(z.options.w,"X",$._presLayout);if(z.options.h||z.options.h===0)D=H0(z.options.h,"Y",$._presLayout)}if(J.options.flipH)N+=' flipH="1"';if(J.options.flipV)N+=' flipV="1"';if(J.options.rotate)N+=` rot="${S1(J.options.rotate)}"`;switch(J._type){case D0.table:if(H=J.arrTabRows,v=J.options,j=0,n=0,H[0].forEach((h)=>{d=h.options||null,j+=(d===null||d===void 0?void 0:d.colspan)?Number(d.colspan):1}),_=``,_+=' ',_+=``,_+='',Array.isArray(v.colW)){_+="";for(let h=0;h`}_+=""}else{if(n=v.colW?v.colW:L0,J.options.w&&!v.colW)n=Math.round((typeof J.options.w==="number"?J.options.w:1)/j);_+="";for(let h=0;h`;_+=""}H.forEach((h)=>{var x,l;for(let $0=0;$01){let W0=Array(F0-1).fill(void 0).map(()=>{return{_type:D0.tablecell,options:{rowspan:p},_hmerge:!0}});h.splice($0+1,0,...W0),$0+=F0}else $0+=1}}),H.forEach((h,x)=>{let l=H[x+1];if(!l)return;h.forEach(($0,Z0)=>{var F0,p;let W0=$0._rowContinue||((F0=$0.options)===null||F0===void 0?void 0:F0.rowspan),y=(p=$0.options)===null||p===void 0?void 0:p.colspan,i=$0._hmerge;if(W0&&W0>1){let U0={_type:D0.tablecell,options:{colspan:y},_rowContinue:W0-1,_vmerge:!0,_hmerge:i};l.splice(Z0,0,U0)}})}),H.forEach((h,x)=>{let l=0;if(Array.isArray(v.rowH)&&v.rowH[x])l=v0(Number(v.rowH[x]));else if(v.rowH&&!isNaN(Number(v.rowH)))l=v0(Number(v.rowH));else if(J.options.cy||J.options.h)l=Math.round((J.options.h?v0(J.options.h):typeof J.options.cy==="number"?J.options.cy:1)/H.length);_+=``,h.forEach(($0)=>{var Z0,F0,p,W0,y;let i=$0,U0={rowSpan:((Z0=i.options)===null||Z0===void 0?void 0:Z0.rowspan)>1?i.options.rowspan:void 0,gridSpan:((F0=i.options)===null||F0===void 0?void 0:F0.colspan)>1?i.options.colspan:void 0,vMerge:i._vmerge?1:void 0,hMerge:i._hmerge?1:void 0},m=Object.keys(U0).map((K0)=>[K0,U0[K0]]).filter(([,K0])=>!!K0).map(([K0,R])=>`${String(K0)}="${String(R)}"`).join(" ");if(m)m=" "+m;if(i._hmerge||i._vmerge){_+=``;return}let V0=i.options||{};i.options=V0,["align","bold","border","color","fill","fontFace","fontSize","margin","textDirection","underline","valign"].forEach((K0)=>{if(v[K0]&&!V0[K0]&&V0[K0]!==0)V0[K0]=v[K0]});let w0=V0.valign?` anchor="${V0.valign.replace(/^c$/i,"ctr").replace(/^m$/i,"ctr").replace("center","ctr").replace("middle","ctr").replace("top","t").replace("btm","b").replace("bottom","b")}"`:"",S=V0.textDirection&&V0.textDirection!=="horz"?` vert="${V0.textDirection}"`:"",b=((W0=(p=i._optImp)===null||p===void 0?void 0:p.fill)===null||W0===void 0?void 0:W0.color)?i._optImp.fill.color:((y=i._optImp)===null||y===void 0?void 0:y.fill)&&typeof i._optImp.fill==="string"?i._optImp.fill:"";b=b||V0.fill?V0.fill:"";let O=b?B2(b):"",E=V0.margin===0||V0.margin?V0.margin:JJ;if(!Array.isArray(E)&&typeof E==="number")E=[E,E,E,E];let a="";if(E[0]>=1)a=` marL="${Y0(E[3])}" marR="${Y0(E[1])}" marT="${Y0(E[0])}" marB="${Y0(E[2])}"`;else a=` marL="${v0(E[3])}" marR="${v0(E[1])}" marT="${v0(E[0])}" marB="${v0(E[2])}"`;if(_+=`${KJ(i)}`,V0.border&&Array.isArray(V0.border))[{idx:3,name:"lnL"},{idx:1,name:"lnR"},{idx:0,name:"lnT"},{idx:2,name:"lnB"}].forEach((K0)=>{if(V0.border[K0.idx].type!=="none")_+=``,_+=`${R0(V0.border[K0.idx].color)}`,_+=``,_+=``;else _+=``});_+=O,_+=" ",_+=" "}),_+=""}),_+=" ",_+=" ",_+=" ",_+="",Q+=_,K++;break;case D0.text:case D0.placeholder:if(!J.options.line&&D===0)D=L0*0.3;if(!J.options._bodyProp)J.options._bodyProp={};if(J.options.margin&&Array.isArray(J.options.margin))J.options._bodyProp.lIns=Y0(J.options.margin[0]||0),J.options._bodyProp.rIns=Y0(J.options.margin[1]||0),J.options._bodyProp.bIns=Y0(J.options.margin[2]||0),J.options._bodyProp.tIns=Y0(J.options.margin[3]||0);else if(typeof J.options.margin==="number")J.options._bodyProp.lIns=Y0(J.options.margin),J.options._bodyProp.rIns=Y0(J.options.margin),J.options._bodyProp.bIns=Y0(J.options.margin),J.options._bodyProp.tIns=Y0(J.options.margin);if(Q+="",Q+=``,(B=J.options.hyperlink)===null||B===void 0?void 0:B.url)Q+=``;if((V=J.options.hyperlink)===null||V===void 0?void 0:V.slide)Q+=``;if(Q+="",Q+="':"/>"),Q+=`${J._type==="placeholder"?N5(J):N5(z)}`,Q+="",Q+=``,Q+=``,Q+=``,J.shape==="custGeom")Q+="",Q+="",Q+="",Q+="",Q+="",Q+="",Q+='',Q+="",Q+=``,(w=J.options.points)===null||w===void 0||w.forEach((h,x)=>{if("curve"in h)switch(h.curve.type){case"arc":Q+=``;break;case"cubic":Q+=` `;break;case"quadratic":Q+=` - `;break}else if("close"in h)Q+="";else if(h.moveTo||x===0)Q+=``;else Q+=``}),Q+="",Q+="",Q+="";else{if(Q+='',J.options.rectRadius)Q+=``;else if(J.options.angleRange){for(let h=0;h<2;h++){let x=J.options.angleRange[h];Q+=``}if(J.options.arcThicknessRatio)Q+=``}Q+=""}if(Q+=J.options.fill?B2(J.options.fill):"",J.options.line){if(Q+=J.options.line.width?``:"",J.options.line.color)Q+=B2(J.options.line);if(J.options.line.dashType)Q+=``;if(J.options.line.beginArrowType)Q+=``;if(J.options.line.endArrowType)Q+=``;Q+=""}if(J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=` `,Q+=` `,Q+=` `,Q+=" ",Q+="";Q+="",Q+=KJ(J),Q+="";break;case D0.image:if(Q+="",Q+=" ",Q+=``,(F=J.hyperlink)===null||F===void 0?void 0:F.url)Q+=``;if((M=J.hyperlink)===null||M===void 0?void 0:M.slide)Q+=``;if(Q+=" ",Q+=' ',Q+=" "+N5(z)+"",Q+=" ",Q+="",($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0]&&($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0].extn==="svg")Q+=``,Q+=J.options.transparency?` `:"",Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";else Q+=``,Q+=J.options.transparency?``:"",Q+="";if(X===null||X===void 0?void 0:X.type){let h=X.w?H0(X.w,"X",$._presLayout):L,x=X.h?H0(X.h,"Y",$._presLayout):D,l=H0(X.x||0,"X",$._presLayout),$0=H0(X.y||0,"Y",$._presLayout);Q+=cB[X.type]({w:g,h:c},{w:h,h:x,x:l,y:$0}),g=h,c=x}else Q+=" ";if(Q+="",Q+="",Q+=" ",Q+=` `,Q+=` `,Q+=" ",Q+=` `,J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=``,Q+=``,Q+=``,Q+=``,Q+="";Q+="",Q+="";break;case D0.media:if(J.mtype==="online")Q+="",Q+=" ",Q+=``,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";else Q+="",Q+=" ",Q+=``,Q+=' ',Q+=" ",Q+=` `,Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";break;case D0.chart:Q+="",Q+=" ",Q+=` `,Q+=" ",Q+=` ${N5(z)}`,Q+=" ",Q+=` `,Q+=' ',Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";break;default:Q+="";break}}),$._slideNumberProps){if(!$._slideNumberProps.align)$._slideNumberProps.align="left";if(Q+="",Q+=" ",Q+=' ',Q+=' ',Q+=" ",Q+=" ",Q+=` `,Q+="",Q+="`,$._slideNumberProps.color)Q+=B2($._slideNumberProps.color);if($._slideNumberProps.fontFace)Q+=``;Q+=""}if(Q+="",Q+="",$._slideNumberProps.align.startsWith("l"))Q+='';else if($._slideNumberProps.align.startsWith("c"))Q+='';else if($._slideNumberProps.align.startsWith("r"))Q+='';else Q+='';Q+=``,Q+=`${$._slideNum}`,Q+=""}return Q+="",Q+="",Q}function m7($,q){let Q=0,K=''+n0+'';return $._rels.forEach((J)=>{if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("hyperlink"))if(J.data==="slide")K+=``;else K+=``;else if(J.type.toLowerCase().includes("notesSlide"))K+=``}),($._relsChart||[]).forEach((J)=>{Q=Math.max(Q,J.rId),K+=``}),($._relsMedia||[]).forEach((J)=>{let Z=J.rId.toString();if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("image"))K+='';else if(J.type.toLowerCase().includes("audio"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("video"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("online"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+=''}),q.forEach((J,Z)=>{K+=``}),K+="",K}function qJ($,q){var Q,K;let J="",Z="",G="",W="",B=q?"a:lvl1pPr":"a:pPr",V=Y0(RB),U=`<${B}${$.options.rtlMode?' rtl="1" ':""}`;{if($.options.align)switch($.options.align){case"left":U+=' algn="l"';break;case"right":U+=' algn="r"';break;case"center":U+=' algn="ctr"';break;case"justify":U+=' algn="just"';break;default:U+="";break}if($.options.lineSpacing)Z=``;else if($.options.lineSpacingMultiple)Z=``;if($.options.indentLevel&&!isNaN(Number($.options.indentLevel))&&$.options.indentLevel>0)U+=` lvl="${$.options.indentLevel}"`;if($.options.paraSpaceBefore&&!isNaN(Number($.options.paraSpaceBefore))&&$.options.paraSpaceBefore>0)G+=``;if($.options.paraSpaceAfter&&!isNaN(Number($.options.paraSpaceAfter))&&$.options.paraSpaceAfter>0)G+=``;if(typeof $.options.bullet==="object"){if((K=(Q=$===null||$===void 0?void 0:$.options)===null||Q===void 0?void 0:Q.bullet)===null||K===void 0?void 0:K.indent)V=Y0($.options.bullet.indent);if($.options.bullet.type){if($.options.bullet.type.toString().toLowerCase()==="number")U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet.characterCode){let w=`&#x${$.options.bullet.characterCode};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.characterCode))console.warn("Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else if($.options.bullet.code){let w=`&#x${$.options.bullet.code};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.code))console.warn("Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet)U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``;else if(!$.options.bullet)U+=' indent="0" marL="0"',J="";if($.options.tabStops&&Array.isArray($.options.tabStops))W=`${$.options.tabStops.map((F)=>``).join("")}`;if(U+=">"+Z+G+J+W,q)U+=MJ($.options,!0);U+=""}return U}function MJ($,q){var Q;let K="",J=q?"a:defRPr":"a:rPr";if(K+="<"+J+' lang="'+($.lang?$.lang:"en-US")+'"'+($.lang?' altLang="en-US"':""),K+=$.fontSize?` sz="${Math.round($.fontSize*100)}"`:"",K+=($===null||$===void 0?void 0:$.bold)?` b="${$.bold?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.italic)?` i="${$.italic?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.strike)?` strike="${typeof $.strike==="string"?$.strike:"sngStrike"}"`:"",typeof $.underline==="object"&&((Q=$.underline)===null||Q===void 0?void 0:Q.style))K+=` u="${$.underline.style}"`;else if(typeof $.underline==="string")K+=` u="${String($.underline)}"`;else if($.hyperlink)K+=' u="sng"';if($.baseline)K+=` baseline="${Math.round($.baseline*50)}"`;else if($.subscript)K+=' baseline="-40000"';else if($.superscript)K+=' baseline="30000"';if(K+=$.charSpacing?` spc="${Math.round($.charSpacing*100)}" kern="0"`:"",K+=' dirty="0">',$.color||$.fontFace||$.outline||typeof $.underline==="object"&&$.underline.color){if($.outline&&typeof $.outline==="object")K+=`${B2($.outline.color||"FFFFFF")}`;if($.color)K+=B2({color:$.color,transparency:$.transparency});if($.highlight)K+=`${R0($.highlight)}`;if(typeof $.underline==="object"&&$.underline.color)K+=`${B2($.underline.color)}`;if($.glow)K+=`${AB($.glow,CB)}`;if($.fontFace)K+=``}if($.hyperlink){if(typeof $.hyperlink!=="object")throw Error("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:'https://github.com'}` ");else if(!$.hyperlink.url&&!$.hyperlink.slide)throw Error("ERROR: 'hyperlink requires either `url` or `slide`'");else if($.hyperlink.url)K+=`":"/>"}`;else if($.hyperlink.slide)K+=`":"/>"}`;if($.color)K+=" ",K+=' ',K+=' ',K+=" ",K+=" ",K+=""}return K+=``,K}function bB($){return $.text?`${MJ($.options,!1)}${k0($.text)}`:""}function nB($){let q="";else if($.options.fit==="resize")q+=""}if($.options.shrinkText)q+="";q+=$.options._bodyProp.autoFit?"":"",q+=""}else q+=' wrap="square" rtlCol="0">',q+="";return $._type===D0.tablecell?"":q}function KJ($){let q=$.options||{},Q=[],K=[];if(q&&$._type!==D0.tablecell&&(typeof $.text>"u"||$.text===null))return"";let J=$._type===D0.tablecell?"":"";if(J+=nB($),q.h===0&&q.line&&q.align)J+='';else if($._type==="placeholder")J+=`${qJ($,!0)}`;else J+="";if(typeof $.text==="string"||typeof $.text==="number")Q.push({text:$.text.toString(),options:q||{}});else if($.text&&!Array.isArray($.text)&&typeof $.text==="object"&&Object.keys($.text).includes("text"))Q.push({text:$.text||"",options:$.options||{}});else if(Array.isArray($.text))Q=$.text.map((W)=>({text:W.text,options:W.options}));Q.forEach((W,B)=>{if(!W.text)W.text="";if(W.options=W.options||q||{},B===0&&W.options&&!W.options.bullet&&q.bullet)W.options.bullet=q.bullet;if(typeof W.text==="string"||typeof W.text==="number")W.text=W.text.toString().replace(/\r*\n/g,n0);if(W.text.includes(n0)&&W.text.match(/\n$/g)===null)W.text.split(n0).forEach((V)=>{W.options.breakLine=!0,K.push({text:V,options:W.options})});else K.push(W)});let Z=[],G=[];if(K.forEach((W,B)=>{if(G.length>0&&(W.options.align||q.align)){if(W.options.align!==K[B-1].options.align)Z.push(G),G=[]}else if(G.length>0&&W.options.bullet&&G.length>0)Z.push(G),G=[],W.options.breakLine=!1;if(G.push(W),G.length>0&&W.options.breakLine){if(B+1{var B;let V=!1;J+="";let U=`{if(w.options._lineIdx=F,F>0&&w.options.softBreakBefore)J+="";if(w.options.align=w.options.align||q.align,w.options.lineSpacing=w.options.lineSpacing||q.lineSpacing,w.options.lineSpacingMultiple=w.options.lineSpacingMultiple||q.lineSpacingMultiple,w.options.indentLevel=w.options.indentLevel||q.indentLevel,w.options.paraSpaceBefore=w.options.paraSpaceBefore||q.paraSpaceBefore,w.options.paraSpaceAfter=w.options.paraSpaceAfter||q.paraSpaceAfter,U=qJ(w,!1),J+=U.replace("",""),Object.entries(q).filter(([M])=>!(w.options.hyperlink&&M==="color")).forEach(([M,k])=>{if(M!=="bullet"&&!w.options[M])w.options[M]=k}),J+=bB(w),!w.text&&q.fontSize||w.options.fontSize)V=!0,q.fontSize=q.fontSize||w.options.fontSize}),$._type===D0.tablecell&&(q.fontSize||q.fontFace))if(q.fontFace)J+=`',J+=``,J+=``,J+=``,J+="";else J+=`';else if(V)J+=`';else J+=``;J+=""}),J.indexOf("")===-1)J+="";return J+=$._type===D0.tablecell?"":"",J}function N5($){var q,Q;if(!$)return"";let K=((q=$.options)===null||q===void 0?void 0:q._placeholderIdx)?$.options._placeholderIdx:"",J=((Q=$.options)===null||Q===void 0?void 0:Q._placeholderType)?$.options._placeholderType:"",Z=J&&F8[J]?F8[J].toString():"";return``;break}else if("close"in h)Q+="";else if(h.moveTo||x===0)Q+=``;else Q+=``}),Q+="",Q+="",Q+="";else{if(Q+='',J.options.rectRadius)Q+=``;else if(J.options.angleRange){for(let h=0;h<2;h++){let x=J.options.angleRange[h];Q+=``}if(J.options.arcThicknessRatio)Q+=``}Q+=""}if(Q+=J.options.fill?B2(J.options.fill):"",J.options.line){if(Q+=J.options.line.width?``:"",J.options.line.color)Q+=B2(J.options.line);if(J.options.line.dashType)Q+=``;if(J.options.line.beginArrowType)Q+=``;if(J.options.line.endArrowType)Q+=``;Q+=""}if(J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=` `,Q+=` `,Q+=` `,Q+=" ",Q+="";Q+="",Q+=KJ(J),Q+="";break;case D0.image:if(Q+="",Q+=" ",Q+=``,(F=J.hyperlink)===null||F===void 0?void 0:F.url)Q+=``;if((M=J.hyperlink)===null||M===void 0?void 0:M.slide)Q+=``;if(Q+=" ",Q+=' ',Q+=" "+N5(z)+"",Q+=" ",Q+="",($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0]&&($._relsMedia||[]).filter((h)=>h.rId===J.imageRid)[0].extn==="svg")Q+=``,Q+=J.options.transparency?` `:"",Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";else Q+=``,Q+=J.options.transparency?``:"",Q+="";if(X===null||X===void 0?void 0:X.type){let h=X.w?H0(X.w,"X",$._presLayout):L,x=X.h?H0(X.h,"Y",$._presLayout):D,l=H0(X.x||0,"X",$._presLayout),$0=H0(X.y||0,"Y",$._presLayout);Q+=PB[X.type]({w:g,h:c},{w:h,h:x,x:l,y:$0}),g=h,c=x}else Q+=" ";if(Q+="",Q+="",Q+=" ",Q+=` `,Q+=` `,Q+=" ",Q+=` `,J.options.shadow&&J.options.shadow.type!=="none")J.options.shadow.type=J.options.shadow.type||"outer",J.options.shadow.blur=Y0(J.options.shadow.blur||8),J.options.shadow.offset=Y0(J.options.shadow.offset||4),J.options.shadow.angle=Math.round((J.options.shadow.angle||270)*60000),J.options.shadow.opacity=Math.round((J.options.shadow.opacity||0.75)*1e5),J.options.shadow.color=J.options.shadow.color||eK.color,Q+="",Q+=``,Q+=``,Q+=``,Q+=``,Q+="";Q+="",Q+="";break;case D0.media:if(J.mtype==="online")Q+="",Q+=" ",Q+=``,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";else Q+="",Q+=" ",Q+=``,Q+=' ',Q+=" ",Q+=` `,Q+=" ",Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+=" ",Q+=" ",Q+=` `,Q+=" ",Q+=` `,Q+=' ',Q+=" ",Q+="";break;case D0.chart:Q+="",Q+=" ",Q+=` `,Q+=" ",Q+=` ${N5(z)}`,Q+=" ",Q+=` `,Q+=' ',Q+=' ',Q+=` `,Q+=" ",Q+=" ",Q+="";break;default:Q+="";break}}),$._slideNumberProps){if(!$._slideNumberProps.align)$._slideNumberProps.align="left";if(Q+="",Q+=" ",Q+=' ',Q+=' ',Q+=" ",Q+=" ",Q+=` `,Q+="",Q+="`,$._slideNumberProps.color)Q+=B2($._slideNumberProps.color);if($._slideNumberProps.fontFace)Q+=``;Q+=""}if(Q+="",Q+="",$._slideNumberProps.align.startsWith("l"))Q+='';else if($._slideNumberProps.align.startsWith("c"))Q+='';else if($._slideNumberProps.align.startsWith("r"))Q+='';else Q+='';Q+=``,Q+=`${$._slideNum}`,Q+=""}return Q+="",Q+="",Q}function m7($,q){let Q=0,K=''+n0+'';return $._rels.forEach((J)=>{if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("hyperlink"))if(J.data==="slide")K+=``;else K+=``;else if(J.type.toLowerCase().includes("notesSlide"))K+=``}),($._relsChart||[]).forEach((J)=>{Q=Math.max(Q,J.rId),K+=``}),($._relsMedia||[]).forEach((J)=>{let Z=J.rId.toString();if(Q=Math.max(Q,J.rId),J.type.toLowerCase().includes("image"))K+='';else if(J.type.toLowerCase().includes("audio"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("video"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+='';else if(J.type.toLowerCase().includes("online"))if(K.includes(' Target="'+J.Target+'"'))K+='';else K+=''}),q.forEach((J,Z)=>{K+=``}),K+="",K}function qJ($,q){var Q,K;let J="",Z="",G="",W="",B=q?"a:lvl1pPr":"a:pPr",V=Y0(kB),U=`<${B}${$.options.rtlMode?' rtl="1" ':""}`;{if($.options.align)switch($.options.align){case"left":U+=' algn="l"';break;case"right":U+=' algn="r"';break;case"center":U+=' algn="ctr"';break;case"justify":U+=' algn="just"';break;default:U+="";break}if($.options.lineSpacing)Z=``;else if($.options.lineSpacingMultiple)Z=``;if($.options.indentLevel&&!isNaN(Number($.options.indentLevel))&&$.options.indentLevel>0)U+=` lvl="${$.options.indentLevel}"`;if($.options.paraSpaceBefore&&!isNaN(Number($.options.paraSpaceBefore))&&$.options.paraSpaceBefore>0)G+=``;if($.options.paraSpaceAfter&&!isNaN(Number($.options.paraSpaceAfter))&&$.options.paraSpaceAfter>0)G+=``;if(typeof $.options.bullet==="object"){if((K=(Q=$===null||$===void 0?void 0:$.options)===null||Q===void 0?void 0:Q.bullet)===null||K===void 0?void 0:K.indent)V=Y0($.options.bullet.indent);if($.options.bullet.type){if($.options.bullet.type.toString().toLowerCase()==="number")U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet.characterCode){let w=`&#x${$.options.bullet.characterCode};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.characterCode))console.warn("Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else if($.options.bullet.code){let w=`&#x${$.options.bullet.code};`;if(!/^[0-9A-Fa-f]{4}$/.test($.options.bullet.code))console.warn("Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!"),w=C6.DEFAULT;U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=''}else U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``}else if($.options.bullet)U+=` marL="${$.options.indentLevel&&$.options.indentLevel>0?V+V*$.options.indentLevel:V}" indent="-${V}"`,J=``;else if(!$.options.bullet)U+=' indent="0" marL="0"',J="";if($.options.tabStops&&Array.isArray($.options.tabStops))W=`${$.options.tabStops.map((F)=>``).join("")}`;if(U+=">"+Z+G+J+W,q)U+=MJ($.options,!0);U+=""}return U}function MJ($,q){var Q;let K="",J=q?"a:defRPr":"a:rPr";if(K+="<"+J+' lang="'+($.lang?$.lang:"en-US")+'"'+($.lang?' altLang="en-US"':""),K+=$.fontSize?` sz="${Math.round($.fontSize*100)}"`:"",K+=($===null||$===void 0?void 0:$.bold)?` b="${$.bold?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.italic)?` i="${$.italic?"1":"0"}"`:"",K+=($===null||$===void 0?void 0:$.strike)?` strike="${typeof $.strike==="string"?$.strike:"sngStrike"}"`:"",typeof $.underline==="object"&&((Q=$.underline)===null||Q===void 0?void 0:Q.style))K+=` u="${$.underline.style}"`;else if(typeof $.underline==="string")K+=` u="${String($.underline)}"`;else if($.hyperlink)K+=' u="sng"';if($.baseline)K+=` baseline="${Math.round($.baseline*50)}"`;else if($.subscript)K+=' baseline="-40000"';else if($.superscript)K+=' baseline="30000"';if(K+=$.charSpacing?` spc="${Math.round($.charSpacing*100)}" kern="0"`:"",K+=' dirty="0">',$.color||$.fontFace||$.outline||typeof $.underline==="object"&&$.underline.color){if($.outline&&typeof $.outline==="object")K+=`${B2($.outline.color||"FFFFFF")}`;if($.color)K+=B2({color:$.color,transparency:$.transparency});if($.highlight)K+=`${R0($.highlight)}`;if(typeof $.underline==="object"&&$.underline.color)K+=`${B2($.underline.color)}`;if($.glow)K+=`${fB($.glow,LB)}`;if($.fontFace)K+=``}if($.hyperlink){if(typeof $.hyperlink!=="object")throw Error("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:'https://github.com'}` ");else if(!$.hyperlink.url&&!$.hyperlink.slide)throw Error("ERROR: 'hyperlink requires either `url` or `slide`'");else if($.hyperlink.url)K+=`":"/>"}`;else if($.hyperlink.slide)K+=`":"/>"}`;if($.color)K+=" ",K+=' ',K+=' ',K+=" ",K+=" ",K+=""}return K+=``,K}function TB($){return $.text?`${MJ($.options,!1)}${k0($.text)}`:""}function uB($){let q="";else if($.options.fit==="resize")q+=""}if($.options.shrinkText)q+="";q+=$.options._bodyProp.autoFit?"":"",q+=""}else q+=' wrap="square" rtlCol="0">',q+="";return $._type===D0.tablecell?"":q}function KJ($){let q=$.options||{},Q=[],K=[];if(q&&$._type!==D0.tablecell&&(typeof $.text>"u"||$.text===null))return"";let J=$._type===D0.tablecell?"":"";if(J+=uB($),q.h===0&&q.line&&q.align)J+='';else if($._type==="placeholder")J+=`${qJ($,!0)}`;else J+="";if(typeof $.text==="string"||typeof $.text==="number")Q.push({text:$.text.toString(),options:q||{}});else if($.text&&!Array.isArray($.text)&&typeof $.text==="object"&&Object.keys($.text).includes("text"))Q.push({text:$.text||"",options:$.options||{}});else if(Array.isArray($.text))Q=$.text.map((W)=>({text:W.text,options:W.options}));Q.forEach((W,B)=>{if(!W.text)W.text="";if(W.options=W.options||q||{},B===0&&W.options&&!W.options.bullet&&q.bullet)W.options.bullet=q.bullet;if(typeof W.text==="string"||typeof W.text==="number")W.text=W.text.toString().replace(/\r*\n/g,n0);if(W.text.includes(n0)&&W.text.match(/\n$/g)===null)W.text.split(n0).forEach((V)=>{W.options.breakLine=!0,K.push({text:V,options:W.options})});else K.push(W)});let Z=[],G=[];if(K.forEach((W,B)=>{if(G.length>0&&(W.options.align||q.align)){if(W.options.align!==K[B-1].options.align)Z.push(G),G=[]}else if(G.length>0&&W.options.bullet&&G.length>0)Z.push(G),G=[],W.options.breakLine=!1;if(G.push(W),G.length>0&&W.options.breakLine){if(B+1{var B;let V=!1;J+="";let U=`{if(w.options._lineIdx=F,F>0&&w.options.softBreakBefore)J+="";if(w.options.align=w.options.align||q.align,w.options.lineSpacing=w.options.lineSpacing||q.lineSpacing,w.options.lineSpacingMultiple=w.options.lineSpacingMultiple||q.lineSpacingMultiple,w.options.indentLevel=w.options.indentLevel||q.indentLevel,w.options.paraSpaceBefore=w.options.paraSpaceBefore||q.paraSpaceBefore,w.options.paraSpaceAfter=w.options.paraSpaceAfter||q.paraSpaceAfter,U=qJ(w,!1),J+=U.replace("",""),Object.entries(q).filter(([M])=>!(w.options.hyperlink&&M==="color")).forEach(([M,k])=>{if(M!=="bullet"&&!w.options[M])w.options[M]=k}),J+=TB(w),!w.text&&q.fontSize||w.options.fontSize)V=!0,q.fontSize=q.fontSize||w.options.fontSize}),$._type===D0.tablecell&&(q.fontSize||q.fontFace))if(q.fontFace)J+=`',J+=``,J+=``,J+=``,J+="";else J+=`';else if(V)J+=`';else J+=``;J+=""}),J.indexOf("")===-1)J+="";return J+=$._type===D0.tablecell?"":"",J}function N5($){var q,Q;if(!$)return"";let K=((q=$.options)===null||q===void 0?void 0:q._placeholderIdx)?$.options._placeholderIdx:"",J=((Q=$.options)===null||Q===void 0?void 0:Q._placeholderType)?$.options._placeholderType:"",Z=J&&F8[J]?F8[J].toString():"";return`0?' hasCustomPrompt="1"':""} - />`}function dB($,q,Q){let K=''+n0;return K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',$.forEach((J)=>{(J._relsMedia||[]).forEach((Z)=>{if(Z.type!=="image"&&Z.type!=="online"&&Z.type!=="chart"&&Z.extn!=="m4v"&&!K.includes(Z.type))K+=''})}),K+='',K+='',K+='',K+='',$.forEach((J,Z)=>{K+=``,K+=``,J._relsChart.forEach((G)=>{K+=``})}),K+='',K+='',K+='',K+='',q.forEach((J,Z)=>{K+=``,(J._relsChart||[]).forEach((G)=>{K+=' '})}),$.forEach((J,Z)=>{K+=``}),Q._relsChart.forEach((J)=>{K+=' '}),Q._relsMedia.forEach((J)=>{if(J.type!=="image"&&J.type!=="online"&&J.type!=="chart"&&J.extn!=="m4v"&&!K.includes(J.type))K+=' '}),K+=' ',K+=' ',K+="",K}function mB(){return`${n0} + />`}function SB($,q,Q){let K=''+n0;return K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',$.forEach((J)=>{(J._relsMedia||[]).forEach((Z)=>{if(Z.type!=="image"&&Z.type!=="online"&&Z.type!=="chart"&&Z.extn!=="m4v"&&!K.includes(Z.type))K+=''})}),K+='',K+='',K+='',K+='',$.forEach((J,Z)=>{K+=``,K+=``,J._relsChart.forEach((G)=>{K+=``})}),K+='',K+='',K+='',K+='',q.forEach((J,Z)=>{K+=``,(J._relsChart||[]).forEach((G)=>{K+=' '})}),$.forEach((J,Z)=>{K+=``}),Q._relsChart.forEach((J)=>{K+=' '}),Q._relsMedia.forEach((J)=>{if(J.type!=="image"&&J.type!=="online"&&J.type!=="chart"&&J.extn!=="m4v"&&!K.includes(J.type))K+=' '}),K+=' ',K+=' ',K+="",K}function EB(){return`${n0} - `}function pB($,q){return`${n0} + `}function _B($,q){return`${n0} 0 0 Microsoft Office PowerPoint @@ -103,7 +103,7 @@ ${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F) false false 16.0000 - `}function iB($,q,Q,K){return` + `}function cB($,q,Q,K){return` ${k0($)} ${k0(q)} @@ -112,13 +112,13 @@ ${String(w)}`)}if(K&&Z&&U.path.startsWith("http"))return yield new Promise((w,F) ${K} ${new Date().toISOString().replace(/\.\d\d\dZ/,"Z")} ${new Date().toISOString().replace(/\.\d\d\dZ/,"Z")} - `}function oB($){let q=1,Q=''+n0;Q+='',Q+='';for(let K=1;K<=$.length;K++)Q+=``;return q++,Q+=``,Q}function aB($){return`${n0}${d7($)}`}function lB($){let q="";return $._slideObjects.forEach((Q)=>{if(Q._type===D0.notes)q+=(Q===null||Q===void 0?void 0:Q.text)&&Q.text[0]?Q.text[0].text:""}),q.replace(/\r*\n/g,n0)}function rB(){return`${n0}7/23/19Click to edit Master text stylesSecond levelThird levelFourth levelFifth level‹#›`}function sB($){return`${n0}${k0(lB($))}${$._slideNum}`}function tB($){return` + `}function bB($){let q=1,Q=''+n0;Q+='',Q+='';for(let K=1;K<=$.length;K++)Q+=``;return q++,Q+=``,Q}function nB($){return`${n0}${d7($)}`}function dB($){let q="";return $._slideObjects.forEach((Q)=>{if(Q._type===D0.notes)q+=(Q===null||Q===void 0?void 0:Q.text)&&Q.text[0]?Q.text[0].text:""}),q.replace(/\r*\n/g,n0)}function mB(){return`${n0}7/23/19Click to edit Master text stylesSecond levelThird levelFourth levelFifth level‹#›`}function pB($){return`${n0}${k0(dB($))}${$._slideNum}`}function iB($){return` ${d7($)} - `}function eB($,q){let Q=q.map((J,Z)=>``),K=''+n0;return K+='',K+=d7($),K+='',K+=""+Q.join("")+"",K+='',K+=' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' ',K+="",K}function $z($,q){return m7(q[$-1],[{target:"../slideMasters/slideMaster1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"}])}function Qz($,q,Q){return m7($[Q-1],[{target:`../slideLayouts/slideLayout${Vz($,q,Q)}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"},{target:`../notesSlides/notesSlide${Q}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"}])}function qz($){return` + `}function oB($,q){let Q=q.map((J,Z)=>``),K=''+n0;return K+='',K+=d7($),K+='',K+=""+Q.join("")+"",K+='',K+=' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' ',K+="",K}function aB($,q){return m7(q[$-1],[{target:"../slideMasters/slideMaster1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"}])}function lB($,q,Q){return m7($[Q-1],[{target:`../slideLayouts/slideLayout${eB($,q,Q)}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"},{target:`../notesSlides/notesSlide${Q}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"}])}function rB($){return` - `}function Kz($,q){let Q=q.map((K,J)=>({target:`../slideLayouts/slideLayout${J+1}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"}));return Q.push({target:"../theme/theme1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}),m7($,Q)}function Jz(){return`${n0} + `}function sB($,q){let Q=q.map((K,J)=>({target:`../slideLayouts/slideLayout${J+1}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"}));return Q.push({target:"../theme/theme1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}),m7($,Q)}function tB(){return`${n0} - `}function Vz($,q,Q){for(let K=0;K`:'',G=((K=$.theme)===null||K===void 0?void 0:K.bodyFontFace)?``:'';return`${Z}${G}`}function Zz($){let q=`${n0}`;q+='',q+="",$.slides.forEach((Q)=>q+=``),q+="",q+=``,q+=``,q+=``,q+="";for(let Q=1;Q<10;Q++)q+=``;if(q+="",$.sections&&$.sections.length>0)q+='',q+='',$.sections.forEach((Q)=>{q+=``,Q._slides.forEach((K)=>q+=``),q+=""}),q+="",q+='',q+="";return q+="",q}function Gz(){return`${n0}`}function Wz(){return`${n0}`}function Bz(){return`${n0}`}var zz="4.0.1";class p7{set layout($){let q=this.LAYOUTS[$];if(q)this._layout=$,this._presLayout=q;else throw Error("UNKNOWN-LAYOUT")}get layout(){return this._layout}get version(){return this._version}set author($){this._author=$}get author(){return this._author}set company($){this._company=$}get company(){return this._company}set revision($){this._revision=$}get revision(){return this._revision}set subject($){this._subject=$}get subject(){return this._subject}set theme($){this._theme=$}get theme(){return this._theme}set title($){this._title=$}get title(){return this._title}set rtlMode($){this._rtlMode=$}get rtlMode(){return this._rtlMode}get masterSlide(){return this._masterSlide}get slides(){return this._slides}get sections(){return this._sections}get slideLayouts(){return this._slideLayouts}get AlignH(){return this._alignH}get AlignV(){return this._alignV}get ChartType(){return this._chartType}get OutputType(){return this._outputType}get presLayout(){return this._presLayout}get SchemeColor(){return this._schemeColor}get ShapeType(){return this._shapeType}get charts(){return this._charts}get colors(){return this._colors}get shapes(){return this._shapes}constructor(){this._version=zz,this._alignH=S7,this._alignV=E7,this._chartType=T7,this._outputType=P7,this._schemeColor=G2,this._shapeType=u7,this._charts=q0,this._colors=L5,this._shapes=B1,this.addNewSlide=(J)=>{let Z=this.sections.length>0&&this.sections[this.sections.length-1]._slides.filter((G)=>G._slideNum===this.slides[this.slides.length-1]._slideNum).length>0;return J.sectionTitle=Z?this.sections[this.sections.length-1].title:null,this.addSlide(J)},this.getSlide=(J)=>this.slides.filter((Z)=>Z._slideNum===J)[0],this.setSlideNumber=(J)=>{this.masterSlide._slideNumberProps=J,this.slideLayouts.filter((Z)=>Z._name===x7)[0]._slideNumberProps=J},this.createChartMediaRels=(J,Z,G)=>{J._relsChart.forEach((W)=>G.push(SB(W,Z))),J._relsMedia.forEach((W)=>{if(W.type!=="online"&&W.type!=="hyperlink"){let B=W.data&&typeof W.data==="string"?W.data:"";if(!B.includes(",")&&!B.includes(";"))B="image/png;base64,"+B;else if(!B.includes(","))B="image/png;base64,"+B;else if(!B.includes(";"))B="image/png;"+B;Z.file(W.Target.replace("..","ppt"),B.split(",").pop(),{base64:!0})}})},this.writeFileToBrowser=(J,Z)=>W2(this,void 0,void 0,function*(){let G=document.createElement("a");if(G.setAttribute("style","display:none;"),G.dataset.interception="off",document.body.appendChild(G),window.URL.createObjectURL){let W=window.URL.createObjectURL(new Blob([Z],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}));return G.href=W,G.download=J,G.click(),setTimeout(()=>{window.URL.revokeObjectURL(W),document.body.removeChild(G)},100),yield Promise.resolve(J)}}),this.exportPresentation=(J)=>W2(this,void 0,void 0,function*(){let Z=[],G=[],W=new c7.default;return this.slides.forEach((B)=>{G=G.concat(h7(B))}),this.slideLayouts.forEach((B)=>{G=G.concat(h7(B))}),G=G.concat(h7(this.masterSlide)),yield Promise.all(G).then(()=>W2(this,void 0,void 0,function*(){return this.slides.forEach((B)=>{if(B._slideLayout)uB(B)}),W.folder("_rels"),W.folder("docProps"),W.folder("ppt").folder("_rels"),W.folder("ppt/charts").folder("_rels"),W.folder("ppt/embeddings"),W.folder("ppt/media"),W.folder("ppt/slideLayouts").folder("_rels"),W.folder("ppt/slideMasters").folder("_rels"),W.folder("ppt/slides").folder("_rels"),W.folder("ppt/theme"),W.folder("ppt/notesMasters").folder("_rels"),W.folder("ppt/notesSlides").folder("_rels"),W.file("[Content_Types].xml",dB(this.slides,this.slideLayouts,this.masterSlide)),W.file("_rels/.rels",mB()),W.file("docProps/app.xml",pB(this.slides,this.company)),W.file("docProps/core.xml",iB(this.title,this.subject,this.author,this.revision)),W.file("ppt/_rels/presentation.xml.rels",oB(this.slides)),W.file("ppt/theme/theme1.xml",Uz(this)),W.file("ppt/presentation.xml",Zz(this)),W.file("ppt/presProps.xml",Gz()),W.file("ppt/tableStyles.xml",Wz()),W.file("ppt/viewProps.xml",Bz()),this.slideLayouts.forEach((B,V)=>{W.file(`ppt/slideLayouts/slideLayout${V+1}.xml`,tB(B)),W.file(`ppt/slideLayouts/_rels/slideLayout${V+1}.xml.rels`,$z(V+1,this.slideLayouts))}),this.slides.forEach((B,V)=>{W.file(`ppt/slides/slide${V+1}.xml`,aB(B)),W.file(`ppt/slides/_rels/slide${V+1}.xml.rels`,Qz(this.slides,this.slideLayouts,V+1)),W.file(`ppt/notesSlides/notesSlide${V+1}.xml`,sB(B)),W.file(`ppt/notesSlides/_rels/notesSlide${V+1}.xml.rels`,qz(V+1))}),W.file("ppt/slideMasters/slideMaster1.xml",eB(this.masterSlide,this.slideLayouts)),W.file("ppt/slideMasters/_rels/slideMaster1.xml.rels",Kz(this.masterSlide,this.slideLayouts)),W.file("ppt/notesMasters/notesMaster1.xml",rB()),W.file("ppt/notesMasters/_rels/notesMaster1.xml.rels",Jz()),this.slideLayouts.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.slides.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.createChartMediaRels(this.masterSlide,W,Z),yield Promise.all(Z).then(()=>W2(this,void 0,void 0,function*(){if(J.outputType==="STREAM")return yield W.generateAsync({type:"nodebuffer",compression:J.compression?"DEFLATE":"STORE"});else if(J.outputType)return yield W.generateAsync({type:J.outputType});else return yield W.generateAsync({type:"blob",compression:J.compression?"DEFLATE":"STORE"})}))}))});let $={name:"screen4x3",width:9144000,height:6858000},q={name:"screen16x9",width:9144000,height:5143500},Q={name:"screen16x10",width:9144000,height:5715000},K={name:"custom",width:12192000,height:6858000};this.LAYOUTS={LAYOUT_4x3:$,LAYOUT_16x9:q,LAYOUT_16x10:Q,LAYOUT_WIDE:K},this._author="PptxGenJS",this._company="PptxGenJS",this._revision="1",this._subject="PptxGenJS Presentation",this._title="PptxGenJS Presentation",this._presLayout={name:this.LAYOUTS[f6].name,_sizeW:this.LAYOUTS[f6].width,_sizeH:this.LAYOUTS[f6].height,width:this.LAYOUTS[f6].width,height:this.LAYOUTS[f6].height},this._rtlMode=!1,this._slideLayouts=[{_margin:M8,_name:x7,_presLayout:this._presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000,_slideNumberProps:null,_slideObjects:[]}],this._slides=[],this._sections=[],this._masterSlide={addChart:null,addImage:null,addMedia:null,addNotes:null,addShape:null,addTable:null,addText:null,_name:null,_presLayout:this._presLayout,_rId:null,_rels:[],_relsChart:[],_relsMedia:[],_slideId:null,_slideLayout:null,_slideNum:null,_slideNumberProps:null,_slideObjects:[]}}stream($){return W2(this,void 0,void 0,function*(){return yield this.exportPresentation({compression:$===null||$===void 0?void 0:$.compression,outputType:"STREAM"})})}write($){return W2(this,void 0,void 0,function*(){let q=typeof $==="object"&&($===null||$===void 0?void 0:$.outputType)?$.outputType:$?$:null,Q=typeof $==="object"&&($===null||$===void 0?void 0:$.compression)?$.compression:!1;return yield this.exportPresentation({compression:Q,outputType:q})})}writeFile($){return W2(this,void 0,void 0,function*(){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node";if(typeof $==="string")console.warn("[WARNING] writeFile(string) is deprecated - pass { fileName } instead."),$={fileName:$};let{fileName:J="Presentation.pptx",compression:Z=!1}=$,G=J.toLowerCase().endsWith(".pptx")?J:`${J}.pptx`,W=K?"nodebuffer":null,B=yield this.exportPresentation({compression:Z,outputType:W});if(K){let{promises:V}=yield import("node:fs"),{writeFile:U}=V;return yield U(G,B),G}return yield this.writeFileToBrowser(G,B),G})}addSection($){if(!$)console.warn("addSection requires an argument");else if(!$.title)console.warn("addSection requires a title");let q={_type:"user",_slides:[],title:$.title};if($.order)this.sections.splice($.order,0,q);else this._sections.push(q)}addSlide($){let q=typeof $==="string"?$:($===null||$===void 0?void 0:$.masterName)?$.masterName:"",Q={_name:this.LAYOUTS[f6].name,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slideNum:this.slides.length+1};if(q){let J=this.slideLayouts.filter((Z)=>Z._name===q)[0];if(J)Q=J}let K=new FJ({addSlide:this.addNewSlide,getSlide:this.getSlide,presLayout:this.presLayout,setSlideNum:this.setSlideNumber,slideId:this.slides.length+256,slideRId:this.slides.length+2,slideNumber:this.slides.length+1,slideLayout:Q});if(this._slides.push(K),$===null||$===void 0?void 0:$.sectionTitle){let J=this.sections.filter((Z)=>Z.title===$.sectionTitle)[0];if(!J)console.warn(`addSlide: unable to find section with title: "${$.sectionTitle}"`);else J._slides.push(K)}else if(this.sections&&this.sections.length>0&&!($===null||$===void 0?void 0:$.sectionTitle)){let J=this._sections[this.sections.length-1];if(J._type==="default")J._slides.push(K);else this._sections.push({title:`Default-${this.sections.filter((Z)=>Z._type==="default").length+1}`,_type:"default",_slides:[K]})}return K}defineLayout($){if(!$)console.warn("defineLayout requires `{name, width, height}`");else if(!$.name)console.warn("defineLayout requires `name`");else if(!$.width)console.warn("defineLayout requires `width`");else if(!$.height)console.warn("defineLayout requires `height`");else if(typeof $.height!=="number")console.warn("defineLayout `height` should be a number (inches)");else if(typeof $.width!=="number")console.warn("defineLayout `width` should be a number (inches)");this.LAYOUTS[$.name]={name:$.name,_sizeW:Math.round(Number($.width)*L0),_sizeH:Math.round(Number($.height)*L0),width:Math.round(Number($.width)*L0),height:Math.round(Number($.height)*L0)}}defineSlideMaster($){let q=JSON.parse(JSON.stringify($));if(!q.title)throw Error("defineSlideMaster() object argument requires a `title` value. (https://gitbrent.github.io/PptxGenJS/docs/masters.html)");let Q={_margin:q.margin||M8,_name:q.title,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000+this.slideLayouts.length+1,_slideNumberProps:q.slideNumber||null,_slideObjects:[],background:q.background||null,bkgd:q.bkgd||null};if(xB(q,Q),this.slideLayouts.push(Q),q.background||q.bkgd)zJ(q.background,Q);if(Q._slideNumberProps&&!this.masterSlide._slideNumberProps)this.masterSlide._slideNumberProps=Q._slideNumberProps}tableToSlides($,q={}){yB(this,$,q,(q===null||q===void 0?void 0:q.masterSlideName)?this.slideLayouts.filter((Q)=>Q._name===q.masterSlideName)[0]:null)}}if(typeof globalThis.Buffer>"u")globalThis.Buffer=o;if(typeof globalThis.process>"u")globalThis.process=Fz;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.pptxgenjs=p7;})(); + `}function eB($,q,Q){for(let K=0;K`:'',G=((K=$.theme)===null||K===void 0?void 0:K.bodyFontFace)?``:'';return`${Z}${G}`}function Qz($){let q=`${n0}`;q+='',q+="",$.slides.forEach((Q)=>q+=``),q+="",q+=``,q+=``,q+=``,q+="";for(let Q=1;Q<10;Q++)q+=``;if(q+="",$.sections&&$.sections.length>0)q+='',q+='',$.sections.forEach((Q)=>{q+=``,Q._slides.forEach((K)=>q+=``),q+=""}),q+="",q+='',q+="";return q+="",q}function qz(){return`${n0}`}function Kz(){return`${n0}`}function Jz(){return`${n0}`}var Vz="4.0.1";class p7{set layout($){let q=this.LAYOUTS[$];if(q)this._layout=$,this._presLayout=q;else throw Error("UNKNOWN-LAYOUT")}get layout(){return this._layout}get version(){return this._version}set author($){this._author=$}get author(){return this._author}set company($){this._company=$}get company(){return this._company}set revision($){this._revision=$}get revision(){return this._revision}set subject($){this._subject=$}get subject(){return this._subject}set theme($){this._theme=$}get theme(){return this._theme}set title($){this._title=$}get title(){return this._title}set rtlMode($){this._rtlMode=$}get rtlMode(){return this._rtlMode}get masterSlide(){return this._masterSlide}get slides(){return this._slides}get sections(){return this._sections}get slideLayouts(){return this._slideLayouts}get AlignH(){return this._alignH}get AlignV(){return this._alignV}get ChartType(){return this._chartType}get OutputType(){return this._outputType}get presLayout(){return this._presLayout}get SchemeColor(){return this._schemeColor}get ShapeType(){return this._shapeType}get charts(){return this._charts}get colors(){return this._colors}get shapes(){return this._shapes}constructor(){this._version=Vz,this._alignH=S7,this._alignV=E7,this._chartType=T7,this._outputType=P7,this._schemeColor=G2,this._shapeType=u7,this._charts=q0,this._colors=L5,this._shapes=B1,this.addNewSlide=(J)=>{let Z=this.sections.length>0&&this.sections[this.sections.length-1]._slides.filter((G)=>G._slideNum===this.slides[this.slides.length-1]._slideNum).length>0;return J.sectionTitle=Z?this.sections[this.sections.length-1].title:null,this.addSlide(J)},this.getSlide=(J)=>this.slides.filter((Z)=>Z._slideNum===J)[0],this.setSlideNumber=(J)=>{this.masterSlide._slideNumberProps=J,this.slideLayouts.filter((Z)=>Z._name===x7)[0]._slideNumberProps=J},this.createChartMediaRels=(J,Z,G)=>{J._relsChart.forEach((W)=>G.push(hB(W,Z))),J._relsMedia.forEach((W)=>{if(W.type!=="online"&&W.type!=="hyperlink"){let B=W.data&&typeof W.data==="string"?W.data:"";if(!B.includes(",")&&!B.includes(";"))B="image/png;base64,"+B;else if(!B.includes(","))B="image/png;base64,"+B;else if(!B.includes(";"))B="image/png;"+B;Z.file(W.Target.replace("..","ppt"),B.split(",").pop(),{base64:!0})}})},this.writeFileToBrowser=(J,Z)=>W2(this,void 0,void 0,function*(){let G=document.createElement("a");if(G.setAttribute("style","display:none;"),G.dataset.interception="off",document.body.appendChild(G),window.URL.createObjectURL){let W=window.URL.createObjectURL(new Blob([Z],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}));return G.href=W,G.download=J,G.click(),setTimeout(()=>{window.URL.revokeObjectURL(W),document.body.removeChild(G)},100),yield Promise.resolve(J)}}),this.exportPresentation=(J)=>W2(this,void 0,void 0,function*(){let Z=[],G=[],W=new c7.default;return this.slides.forEach((B)=>{G=G.concat(h7(B))}),this.slideLayouts.forEach((B)=>{G=G.concat(h7(B))}),G=G.concat(h7(this.masterSlide)),yield Promise.all(G).then(()=>W2(this,void 0,void 0,function*(){return this.slides.forEach((B)=>{if(B._slideLayout)yB(B)}),W.folder("_rels"),W.folder("docProps"),W.folder("ppt").folder("_rels"),W.folder("ppt/charts").folder("_rels"),W.folder("ppt/embeddings"),W.folder("ppt/media"),W.folder("ppt/slideLayouts").folder("_rels"),W.folder("ppt/slideMasters").folder("_rels"),W.folder("ppt/slides").folder("_rels"),W.folder("ppt/theme"),W.folder("ppt/notesMasters").folder("_rels"),W.folder("ppt/notesSlides").folder("_rels"),W.file("[Content_Types].xml",SB(this.slides,this.slideLayouts,this.masterSlide)),W.file("_rels/.rels",EB()),W.file("docProps/app.xml",_B(this.slides,this.company)),W.file("docProps/core.xml",cB(this.title,this.subject,this.author,this.revision)),W.file("ppt/_rels/presentation.xml.rels",bB(this.slides)),W.file("ppt/theme/theme1.xml",$z(this)),W.file("ppt/presentation.xml",Qz(this)),W.file("ppt/presProps.xml",qz()),W.file("ppt/tableStyles.xml",Kz()),W.file("ppt/viewProps.xml",Jz()),this.slideLayouts.forEach((B,V)=>{W.file(`ppt/slideLayouts/slideLayout${V+1}.xml`,iB(B)),W.file(`ppt/slideLayouts/_rels/slideLayout${V+1}.xml.rels`,aB(V+1,this.slideLayouts))}),this.slides.forEach((B,V)=>{W.file(`ppt/slides/slide${V+1}.xml`,nB(B)),W.file(`ppt/slides/_rels/slide${V+1}.xml.rels`,lB(this.slides,this.slideLayouts,V+1)),W.file(`ppt/notesSlides/notesSlide${V+1}.xml`,pB(B)),W.file(`ppt/notesSlides/_rels/notesSlide${V+1}.xml.rels`,rB(V+1))}),W.file("ppt/slideMasters/slideMaster1.xml",oB(this.masterSlide,this.slideLayouts)),W.file("ppt/slideMasters/_rels/slideMaster1.xml.rels",sB(this.masterSlide,this.slideLayouts)),W.file("ppt/notesMasters/notesMaster1.xml",mB()),W.file("ppt/notesMasters/_rels/notesMaster1.xml.rels",tB()),this.slideLayouts.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.slides.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.createChartMediaRels(this.masterSlide,W,Z),yield Promise.all(Z).then(()=>W2(this,void 0,void 0,function*(){if(J.outputType==="STREAM")return yield W.generateAsync({type:"nodebuffer",compression:J.compression?"DEFLATE":"STORE"});else if(J.outputType)return yield W.generateAsync({type:J.outputType});else return yield W.generateAsync({type:"blob",compression:J.compression?"DEFLATE":"STORE"})}))}))});let $={name:"screen4x3",width:9144000,height:6858000},q={name:"screen16x9",width:9144000,height:5143500},Q={name:"screen16x10",width:9144000,height:5715000},K={name:"custom",width:12192000,height:6858000};this.LAYOUTS={LAYOUT_4x3:$,LAYOUT_16x9:q,LAYOUT_16x10:Q,LAYOUT_WIDE:K},this._author="PptxGenJS",this._company="PptxGenJS",this._revision="1",this._subject="PptxGenJS Presentation",this._title="PptxGenJS Presentation",this._presLayout={name:this.LAYOUTS[f6].name,_sizeW:this.LAYOUTS[f6].width,_sizeH:this.LAYOUTS[f6].height,width:this.LAYOUTS[f6].width,height:this.LAYOUTS[f6].height},this._rtlMode=!1,this._slideLayouts=[{_margin:M8,_name:x7,_presLayout:this._presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000,_slideNumberProps:null,_slideObjects:[]}],this._slides=[],this._sections=[],this._masterSlide={addChart:null,addImage:null,addMedia:null,addNotes:null,addShape:null,addTable:null,addText:null,_name:null,_presLayout:this._presLayout,_rId:null,_rels:[],_relsChart:[],_relsMedia:[],_slideId:null,_slideLayout:null,_slideNum:null,_slideNumberProps:null,_slideObjects:[]}}stream($){return W2(this,void 0,void 0,function*(){return yield this.exportPresentation({compression:$===null||$===void 0?void 0:$.compression,outputType:"STREAM"})})}write($){return W2(this,void 0,void 0,function*(){let q=typeof $==="object"&&($===null||$===void 0?void 0:$.outputType)?$.outputType:$?$:null,Q=typeof $==="object"&&($===null||$===void 0?void 0:$.compression)?$.compression:!1;return yield this.exportPresentation({compression:Q,outputType:q})})}writeFile($){return W2(this,void 0,void 0,function*(){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node";if(typeof $==="string")console.warn("[WARNING] writeFile(string) is deprecated - pass { fileName } instead."),$={fileName:$};let{fileName:J="Presentation.pptx",compression:Z=!1}=$,G=J.toLowerCase().endsWith(".pptx")?J:`${J}.pptx`,W=K?"nodebuffer":null,B=yield this.exportPresentation({compression:Z,outputType:W});if(K){let{promises:V}=yield import("node:fs"),{writeFile:U}=V;return yield U(G,B),G}return yield this.writeFileToBrowser(G,B),G})}addSection($){if(!$)console.warn("addSection requires an argument");else if(!$.title)console.warn("addSection requires a title");let q={_type:"user",_slides:[],title:$.title};if($.order)this.sections.splice($.order,0,q);else this._sections.push(q)}addSlide($){let q=typeof $==="string"?$:($===null||$===void 0?void 0:$.masterName)?$.masterName:"",Q={_name:this.LAYOUTS[f6].name,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slideNum:this.slides.length+1};if(q){let J=this.slideLayouts.filter((Z)=>Z._name===q)[0];if(J)Q=J}let K=new FJ({addSlide:this.addNewSlide,getSlide:this.getSlide,presLayout:this.presLayout,setSlideNum:this.setSlideNumber,slideId:this.slides.length+256,slideRId:this.slides.length+2,slideNumber:this.slides.length+1,slideLayout:Q});if(this._slides.push(K),$===null||$===void 0?void 0:$.sectionTitle){let J=this.sections.filter((Z)=>Z.title===$.sectionTitle)[0];if(!J)console.warn(`addSlide: unable to find section with title: "${$.sectionTitle}"`);else J._slides.push(K)}else if(this.sections&&this.sections.length>0&&!($===null||$===void 0?void 0:$.sectionTitle)){let J=this._sections[this.sections.length-1];if(J._type==="default")J._slides.push(K);else this._sections.push({title:`Default-${this.sections.filter((Z)=>Z._type==="default").length+1}`,_type:"default",_slides:[K]})}return K}defineLayout($){if(!$)console.warn("defineLayout requires `{name, width, height}`");else if(!$.name)console.warn("defineLayout requires `name`");else if(!$.width)console.warn("defineLayout requires `width`");else if(!$.height)console.warn("defineLayout requires `height`");else if(typeof $.height!=="number")console.warn("defineLayout `height` should be a number (inches)");else if(typeof $.width!=="number")console.warn("defineLayout `width` should be a number (inches)");this.LAYOUTS[$.name]={name:$.name,_sizeW:Math.round(Number($.width)*L0),_sizeH:Math.round(Number($.height)*L0),width:Math.round(Number($.width)*L0),height:Math.round(Number($.height)*L0)}}defineSlideMaster($){let q=JSON.parse(JSON.stringify($));if(!q.title)throw Error("defineSlideMaster() object argument requires a `title` value. (https://gitbrent.github.io/PptxGenJS/docs/masters.html)");let Q={_margin:q.margin||M8,_name:q.title,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000+this.slideLayouts.length+1,_slideNumberProps:q.slideNumber||null,_slideObjects:[],background:q.background||null,bkgd:q.bkgd||null};if(jB(q,Q),this.slideLayouts.push(Q),q.background||q.bkgd)zJ(q.background,Q);if(Q._slideNumberProps&&!this.masterSlide._slideNumberProps)this.masterSlide._slideNumberProps=Q._slideNumberProps}tableToSlides($,q={}){IB(this,$,q,(q===null||q===void 0?void 0:q.masterSlideName)?this.slideLayouts.filter((Q)=>Q._name===q.masterSlideName)[0]:null)}}if(typeof globalThis.Buffer>"u")globalThis.Buffer=o;if(typeof globalThis.process>"u")globalThis.process=Uz;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.pptxgenjs=p7;})(); diff --git a/apps/sim/lib/invitations/direct-grant.ts b/apps/sim/lib/invitations/direct-grant.ts index e18b6b19e21..753459aee1c 100644 --- a/apps/sim/lib/invitations/direct-grant.ts +++ b/apps/sim/lib/invitations/direct-grant.ts @@ -30,6 +30,7 @@ import { import { acquireInvitationMutationLocks } from '@/lib/invitations/locks' import { sendWorkspaceAddedEmail } from '@/lib/invitations/send' import { captureServerEvent } from '@/lib/posthog/server' +import { assertMembershipNotScimManaged } from '@/lib/scim/managed-membership' import { getEffectiveWorkspacePermission, getWorkspaceWithOwner, @@ -137,6 +138,12 @@ export async function grantWorkspaceAccessDirectly( userId: input.userId, organizationIds: [input.organizationId], }) + /** A member the directory manages gets workspace access from the directory, not by hand. */ + await assertMembershipNotScimManaged({ + organizationId: input.organizationId, + userId: input.userId, + executor: tx, + }) const currentInvitationIds = await getPendingWorkspaceInvitationIds( tx, diff --git a/apps/sim/lib/organizations/members/lifecycle.test.ts b/apps/sim/lib/organizations/members/lifecycle.test.ts index ff98629ee9b..c813bc9df0e 100644 --- a/apps/sim/lib/organizations/members/lifecycle.test.ts +++ b/apps/sim/lib/organizations/members/lifecycle.test.ts @@ -23,11 +23,13 @@ import { db } from '@sim/db' import { OrchestrationError } from '@/lib/core/orchestration/types' import { changeMemberRoleTx, - invalidateAfterSessionRevocation, - revokeUserSessionsTx, suspendMemberTx, unsuspendMemberTx, } from '@/lib/organizations/members/lifecycle' +import { + invalidateAfterSessionRevocation, + revokeUserSessionsTx, +} from '@/lib/organizations/members/revocation' afterAll(resetDbChainMock) diff --git a/apps/sim/lib/organizations/members/lifecycle.ts b/apps/sim/lib/organizations/members/lifecycle.ts index 4cc9f489448..95343294053 100644 --- a/apps/sim/lib/organizations/members/lifecycle.ts +++ b/apps/sim/lib/organizations/members/lifecycle.ts @@ -1,24 +1,17 @@ -import { apiKey, member, organization, session as sessionTable, user } from '@sim/db/schema' +import { member, user } from '@sim/db/schema' import { createLogger } from '@sim/logger' -import { and, eq, isNull, ne, sql } from 'drizzle-orm' -import { - invalidateMembershipCache, - invalidateSecurityPolicyVersionCache, -} from '@/lib/auth/security-policy' +import { and, eq, isNull } from 'drizzle-orm' import { acquireOrganizationUserMutationLocks } from '@/lib/billing/organizations/membership' import { OrchestrationError } from '@/lib/core/orchestration/types' import type { DbOrTx } from '@/lib/db/types' +import { revokeUserSessionsTx } from '@/lib/organizations/members/revocation' const logger = createLogger('OrganizationMemberLifecycle') /** * Member lifecycle primitives shared by the settings UI and directory - * provisioning. - * - * Before this module each of these lived inline in the route that needed it, and - * two of them did not exist at all: removing a member left their sessions and - * API keys working until the cookie cache lapsed. Directory deprovisioning made - * that gap load-bearing, so the behavior is defined once here. + * provisioning: suspension, and role changes. Removal lives with the billing + * membership primitives; live-access revocation lives in `revocation.ts`. */ /** @@ -27,76 +20,6 @@ const logger = createLogger('OrganizationMemberLifecycle') */ export type SuspensionSource = 'scim' -export interface RevokeSessionsResult { - revoked: number -} - -/** - * Deletes a user's sessions and forces cached session cookies in the - * organization to re-read the database. - * - * Both halves commit together. Deleting sessions without bumping the version - * would leave the signed cookie cache authenticating a deleted session for up - * to five minutes, which is precisely the window a deprovisioning exists to - * close. - * - * Impersonation sessions are spared: they are platform support tooling, not the - * member's own access. - */ -export async function revokeUserSessionsTx( - tx: DbOrTx, - params: { userId: string; organizationId: string; spareSessionToken?: string } -): Promise { - const deleted = await tx - .delete(sessionTable) - .where( - and( - eq(sessionTable.userId, params.userId), - isNull(sessionTable.impersonatedBy), - ...(params.spareSessionToken ? [ne(sessionTable.token, params.spareSessionToken)] : []) - ) - ) - .returning({ id: sessionTable.id }) - - await tx - .update(organization) - .set({ securityPolicyVersion: sql`${organization.securityPolicyVersion} + 1` }) - .where(eq(organization.id, params.organizationId)) - - return { revoked: deleted.length } -} - -/** - * Drops the caches that make a revocation visible to the next request. - * - * Separate from the transaction on purpose: an in-process cache cleared before - * the commit lands would be repopulated with the pre-commit answer. - */ -export function invalidateAfterSessionRevocation(params: { - userId: string - organizationId: string -}): void { - invalidateSecurityPolicyVersionCache(params.organizationId) - invalidateMembershipCache(params.userId) -} - -/** - * Deletes a user's personal API keys. - * - * Workspace keys are left alone: they belong to the workspace and are shared, so - * one person's departure must not break every automation using them. - */ -export async function revokePersonalApiKeysTx( - tx: DbOrTx, - params: { userId: string } -): Promise<{ revoked: number }> { - const deleted = await tx - .delete(apiKey) - .where(and(eq(apiKey.userId, params.userId), eq(apiKey.type, 'personal'))) - .returning({ id: apiKey.id }) - return { revoked: deleted.length } -} - export interface SuspendMemberResult { suspended: boolean sessionsRevoked: number diff --git a/apps/sim/lib/organizations/members/revocation.ts b/apps/sim/lib/organizations/members/revocation.ts new file mode 100644 index 00000000000..b1ba25881c3 --- /dev/null +++ b/apps/sim/lib/organizations/members/revocation.ts @@ -0,0 +1,85 @@ +import { apiKey, organization, session as sessionTable } from '@sim/db/schema' +import { and, eq, isNull, ne, sql } from 'drizzle-orm' +import { + invalidateMembershipCache, + invalidateSecurityPolicyVersionCache, +} from '@/lib/auth/security-policy' +import type { DbOrTx } from '@/lib/db/types' + +/** + * Ending a person's live access: their sessions and their personal API keys. + * + * Shared by removal from an organization, suspension, and an email change, so + * every path that must sign someone out does it the same way. Kept apart from + * the membership primitives so the removal transaction can call it without a + * module cycle. + */ + +export interface RevokeSessionsResult { + revoked: number +} + +/** + * Deletes a user's sessions and forces cached session cookies in the + * organization to re-read the database. + * + * Both halves commit together. Deleting sessions without bumping the version + * would leave the signed cookie cache authenticating a deleted session for up + * to five minutes, which is precisely the window a revocation exists to close. + * + * Impersonation sessions are spared: they are platform support tooling, not the + * member's own access. + */ +export async function revokeUserSessionsTx( + tx: DbOrTx, + params: { userId: string; organizationId: string; spareSessionToken?: string } +): Promise { + const deleted = await tx + .delete(sessionTable) + .where( + and( + eq(sessionTable.userId, params.userId), + isNull(sessionTable.impersonatedBy), + ...(params.spareSessionToken ? [ne(sessionTable.token, params.spareSessionToken)] : []) + ) + ) + .returning({ id: sessionTable.id }) + + await tx + .update(organization) + .set({ securityPolicyVersion: sql`${organization.securityPolicyVersion} + 1` }) + .where(eq(organization.id, params.organizationId)) + + return { revoked: deleted.length } +} + +/** + * Drops the caches that make a revocation visible to the next request. + * + * Separate from the transaction on purpose: an in-process cache cleared before + * the commit lands would be repopulated with the pre-commit answer. + */ +export function invalidateAfterSessionRevocation(params: { + userId: string + organizationId: string +}): void { + invalidateSecurityPolicyVersionCache(params.organizationId) + invalidateMembershipCache(params.userId) +} + +/** + * Deletes a user's personal API keys. + * + * Workspace keys are left alone: they belong to the workspace and are shared, so + * one person's departure must not break every automation using them. + */ +export async function revokePersonalApiKeysTx( + tx: DbOrTx, + params: { userId: string } +): Promise<{ revoked: number }> { + const deleted = await tx + .delete(apiKey) + .where(and(eq(apiKey.userId, params.userId), eq(apiKey.type, 'personal'))) + .returning({ id: apiKey.id }) + return { revoked: deleted.length } +} diff --git a/apps/sim/lib/permission-groups/application/group-membership.test.ts b/apps/sim/lib/permission-groups/application/group-membership.test.ts new file mode 100644 index 00000000000..0488f44aa95 --- /dev/null +++ b/apps/sim/lib/permission-groups/application/group-membership.test.ts @@ -0,0 +1,120 @@ +/** + * @vitest-environment node + */ +import { permissionGroup, permissionGroupMember } from '@sim/db/schema' +import { queueTableRows, resetDbChainMock } from '@sim/testing' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' +import { + findAllMembersWorkspaceConflict, + findScopeConflicts, +} from '@/lib/permission-groups/application/group-membership' + +afterAll(resetDbChainMock) + +describe('findScopeConflicts', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + }) + + const baseParams = { + organizationId: 'org-1', + excludeGroupId: 'group-1', + workspaceIds: ['ws-1'], + candidateUserIds: ['user-1'], + } + + const conflictRow = (userId: string, otherGroupName = 'Marketing') => ({ + userId, + userName: 'User One', + userEmail: `${userId}@example.com`, + otherGroupId: 'group-2', + otherGroupName, + }) + + it('returns no conflicts when there are no candidate users', async () => { + queueTableRows(permissionGroupMember, [conflictRow('user-1')]) + + const conflicts = await findScopeConflicts({ ...baseParams, candidateUserIds: [] }) + + expect(conflicts).toEqual([]) + }) + + it('returns no conflicts when there are no target workspaces', async () => { + queueTableRows(permissionGroupMember, [conflictRow('user-1')]) + + const conflicts = await findScopeConflicts({ ...baseParams, workspaceIds: [] }) + + expect(conflicts).toEqual([]) + }) + + it('flags a candidate already in another group that shares a workspace', async () => { + queueTableRows(permissionGroupMember, [conflictRow('user-1')]) + + const conflicts = await findScopeConflicts(baseParams) + + expect(conflicts.map((c) => c.userId)).toEqual(['user-1']) + expect(conflicts[0].conflictingGroupName).toBe('Marketing') + }) + + it('returns at most one conflict per user', async () => { + queueTableRows(permissionGroupMember, [ + conflictRow('user-1', 'Marketing'), + conflictRow('user-1', 'Sales'), + ]) + + const conflicts = await findScopeConflicts(baseParams) + + expect(conflicts).toHaveLength(1) + expect(conflicts[0].conflictingGroupName).toBe('Marketing') + }) + + it('returns no conflicts when the query finds no overlapping memberships', async () => { + const conflicts = await findScopeConflicts(baseParams) + + expect(conflicts).toEqual([]) + }) +}) + +describe('findAllMembersWorkspaceConflict', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + }) + + const baseParams = { + organizationId: 'org-1', + excludeGroupId: 'group-1', + workspaceIds: ['ws-1', 'ws-2'], + } + + it('returns null when there are no target workspaces', async () => { + queueTableRows(permissionGroup, [ + { conflictingGroupId: 'group-2', conflictingGroupName: 'Marketing', workspaceName: 'Acme' }, + ]) + + const conflict = await findAllMembersWorkspaceConflict({ ...baseParams, workspaceIds: [] }) + + expect(conflict).toBeNull() + }) + + it('returns the conflicting all-members group sharing a workspace', async () => { + queueTableRows(permissionGroup, [ + { conflictingGroupId: 'group-2', conflictingGroupName: 'Marketing', workspaceName: 'Acme' }, + ]) + + const conflict = await findAllMembersWorkspaceConflict(baseParams) + + expect(conflict).toEqual({ + conflictingGroupId: 'group-2', + conflictingGroupName: 'Marketing', + workspaceName: 'Acme', + }) + }) + + it('returns null when no other all-members group targets the workspaces', async () => { + const conflict = await findAllMembersWorkspaceConflict(baseParams) + + expect(conflict).toBeNull() + }) +}) diff --git a/apps/sim/lib/permission-groups/application/group-membership.ts b/apps/sim/lib/permission-groups/application/group-membership.ts index 31bacb2e32f..d525f0b66d7 100644 --- a/apps/sim/lib/permission-groups/application/group-membership.ts +++ b/apps/sim/lib/permission-groups/application/group-membership.ts @@ -1,36 +1,156 @@ -import { permissionGroup, permissionGroupMember, permissionGroupWorkspace } from '@sim/db/schema' +import { db } from '@sim/db' +import { + permissionGroup, + permissionGroupMember, + permissionGroupWorkspace, + user, + workspace, +} from '@sim/db/schema' import { generateId } from '@sim/utils/id' -import { and, count, eq, inArray, ne } from 'drizzle-orm' +import { and, asc, count, eq, inArray, ne, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' /** - * Permission-group membership as a domain primitive for callers outside the - * settings routes, today directory provisioning. + * Permission-group membership and the two rules that constrain it. * - * The settings routes still carry their own copies of the scope and - * all-members conflict rules in `app/api/organizations/[id]/permission-groups/utils.ts`; - * both copies must agree on `membershipMode`, and do. Folding the routes onto - * this module is the next step, not a prerequisite for it. + * The settings routes and directory provisioning both write membership, and + * both must agree on when a write would leave a workspace governed by two + * groups. The rules live here once; the routes consume them for their own + * conflict messages, and the primitives below apply them for callers that do + * not need a message. */ -/** A user already governed by another group that shares one of these workspaces. */ -export interface PermissionGroupScopeConflict { +export interface ScopeConflict { userId: string - groupId: string - groupName: string - workspaceId: string + userName: string | null + userEmail: string | null + /** The group the member already belongs to that causes the conflict. */ + conflictingGroupId: string + conflictingGroupName: string +} + +/** + * Which of `candidateUserIds` would be governed by two groups on the same + * workspace: each is already an explicit member of another non-default group + * that shares one of `workspaceIds`. The candidate group (`excludeGroupId`) and + * the org default group are ignored — the default never governs through + * membership. Returns at most one conflict per user. + */ +export async function findScopeConflicts( + params: { + organizationId: string + excludeGroupId: string + workspaceIds: string[] + candidateUserIds: string[] + }, + executor: DbOrTx = db +): Promise { + const { organizationId, excludeGroupId, workspaceIds, candidateUserIds } = params + if (candidateUserIds.length === 0 || workspaceIds.length === 0) return [] + + const rows = await executor + .select({ + userId: permissionGroupMember.userId, + userName: user.name, + userEmail: user.email, + otherGroupId: permissionGroup.id, + otherGroupName: permissionGroup.name, + }) + .from(permissionGroupMember) + .innerJoin(permissionGroup, eq(permissionGroupMember.permissionGroupId, permissionGroup.id)) + .innerJoin( + permissionGroupWorkspace, + eq(permissionGroupWorkspace.permissionGroupId, permissionGroup.id) + ) + .leftJoin(user, eq(permissionGroupMember.userId, user.id)) + .where( + and( + eq(permissionGroupMember.organizationId, organizationId), + inArray(permissionGroupMember.userId, candidateUserIds), + ne(permissionGroupMember.permissionGroupId, excludeGroupId), + eq(permissionGroup.isDefault, false), + inArray(permissionGroupWorkspace.workspaceId, workspaceIds) + ) + ) + + const conflictByUser = new Map() + for (const row of rows) { + if (conflictByUser.has(row.userId)) continue + conflictByUser.set(row.userId, { + userId: row.userId, + userName: row.userName, + userEmail: row.userEmail, + conflictingGroupId: row.otherGroupId, + conflictingGroupName: row.otherGroupName, + }) + } + return Array.from(conflictByUser.values()) +} + +/** An existing all-members group that already governs everyone in a shared workspace. */ +export interface AllMembersConflict { + conflictingGroupId: string + conflictingGroupName: string + workspaceName: string +} + +/** + * For a group that will govern *all members* of `workspaceIds` (a non-default + * group with no explicit members), return the first other non-default + * all-members group already targeting one of those workspaces, or `null`. Two + * all-members groups on one workspace would both claim everyone there, so this + * is rejected at assignment time. The candidate group (`excludeGroupId`) is + * ignored, and so is any group in `explicit` membership mode: empty, it governs + * nobody rather than everyone, so it cannot collide. + */ +export async function findAllMembersWorkspaceConflict( + params: { organizationId: string; excludeGroupId: string; workspaceIds: string[] }, + executor: DbOrTx = db +): Promise { + const { organizationId, excludeGroupId, workspaceIds } = params + if (workspaceIds.length === 0) return null + + const [row] = await executor + .select({ + conflictingGroupId: permissionGroup.id, + conflictingGroupName: permissionGroup.name, + workspaceName: workspace.name, + }) + .from(permissionGroup) + .innerJoin( + permissionGroupWorkspace, + eq(permissionGroupWorkspace.permissionGroupId, permissionGroup.id) + ) + .innerJoin(workspace, eq(permissionGroupWorkspace.workspaceId, workspace.id)) + .where( + and( + eq(permissionGroup.organizationId, organizationId), + eq(permissionGroup.isDefault, false), + eq(permissionGroup.membershipMode, 'inherit'), + ne(permissionGroup.id, excludeGroupId), + inArray(permissionGroupWorkspace.workspaceId, workspaceIds), + sql`not exists ( + select 1 from ${permissionGroupMember} + where ${permissionGroupMember.permissionGroupId} = ${permissionGroup.id} + )` + ) + ) + .orderBy(asc(workspace.name)) + .limit(1) + + return row ?? null } export class PermissionGroupScopeConflictError extends Error { - constructor(readonly conflicts: PermissionGroupScopeConflict[]) { + constructor(readonly conflicts: ScopeConflict[]) { super('The user is already governed by another permission group on a shared workspace') this.name = 'PermissionGroupScopeConflictError' } } export class PermissionGroupAllMembersConflictError extends Error { - constructor(readonly workspaceId: string) { + constructor(readonly conflict: AllMembersConflict) { super( 'Removing the last member would make this group govern every member of its workspaces, and another group already does' ) @@ -47,7 +167,6 @@ export class PermissionGroupNotFoundError extends Error { interface LockedGroup { id: string - name: string isDefault: boolean membershipMode: string workspaceIds: string[] @@ -61,7 +180,6 @@ async function loadLockedGroup( const [group] = await tx .select({ id: permissionGroup.id, - name: permissionGroup.name, isDefault: permissionGroup.isDefault, membershipMode: permissionGroup.membershipMode, }) @@ -78,77 +196,6 @@ async function loadLockedGroup( return { ...group, workspaceIds: workspaces.map((row) => row.workspaceId) } } -/** Groups other than this one that already govern the given user on a shared workspace. */ -async function findScopeConflicts( - tx: DbOrTx, - params: { organizationId: string; groupId: string; workspaceIds: string[]; userId: string } -): Promise { - if (params.workspaceIds.length === 0) return [] - const rows = await tx - .selectDistinct({ - userId: permissionGroupMember.userId, - groupId: permissionGroup.id, - groupName: permissionGroup.name, - workspaceId: permissionGroupWorkspace.workspaceId, - }) - .from(permissionGroupMember) - .innerJoin(permissionGroup, eq(permissionGroup.id, permissionGroupMember.permissionGroupId)) - .innerJoin( - permissionGroupWorkspace, - eq(permissionGroupWorkspace.permissionGroupId, permissionGroup.id) - ) - .where( - and( - eq(permissionGroup.organizationId, params.organizationId), - eq(permissionGroup.isDefault, false), - ne(permissionGroup.id, params.groupId), - eq(permissionGroupMember.userId, params.userId), - inArray(permissionGroupWorkspace.workspaceId, params.workspaceIds) - ) - ) - return rows -} - -/** - * Another group that would collide once this one starts governing everybody. - * - * Only meaningful for a group in `inherit` mode, where emptying the member list - * widens the group to every member of its workspaces. - */ -async function findAllMembersConflict( - tx: DbOrTx, - params: { organizationId: string; groupId: string; workspaceIds: string[] } -): Promise { - if (params.workspaceIds.length === 0) return null - const rows = await tx - .select({ - groupId: permissionGroup.id, - workspaceId: permissionGroupWorkspace.workspaceId, - memberCount: count(permissionGroupMember.id), - }) - .from(permissionGroup) - .innerJoin( - permissionGroupWorkspace, - eq(permissionGroupWorkspace.permissionGroupId, permissionGroup.id) - ) - .leftJoin( - permissionGroupMember, - eq(permissionGroupMember.permissionGroupId, permissionGroup.id) - ) - .where( - and( - eq(permissionGroup.organizationId, params.organizationId), - eq(permissionGroup.isDefault, false), - eq(permissionGroup.membershipMode, 'inherit'), - ne(permissionGroup.id, params.groupId), - inArray(permissionGroupWorkspace.workspaceId, params.workspaceIds) - ) - ) - .groupBy(permissionGroup.id, permissionGroupWorkspace.workspaceId) - - return rows.find((row) => Number(row.memberCount) === 0)?.workspaceId ?? null -} - export type AddPermissionGroupMemberResult = 'added' | 'already-member' /** @@ -184,12 +231,15 @@ export async function addPermissionGroupMemberTx( .limit(1) if (existing) return 'already-member' - const conflicts = await findScopeConflicts(tx, { - organizationId: params.organizationId, - groupId: params.groupId, - workspaceIds: group.workspaceIds, - userId: params.userId, - }) + const conflicts = await findScopeConflicts( + { + organizationId: params.organizationId, + excludeGroupId: params.groupId, + workspaceIds: group.workspaceIds, + candidateUserIds: [params.userId], + }, + tx + ) if (conflicts.length > 0) throw new PermissionGroupScopeConflictError(conflicts) await tx.insert(permissionGroupMember).values({ @@ -244,11 +294,14 @@ export async function removePermissionGroupMemberTx( .from(permissionGroupMember) .where(eq(permissionGroupMember.permissionGroupId, params.groupId)) if ((remaining?.value ?? 0) <= 1) { - const conflict = await findAllMembersConflict(tx, { - organizationId: params.organizationId, - groupId: params.groupId, - workspaceIds: group.workspaceIds, - }) + const conflict = await findAllMembersWorkspaceConflict( + { + organizationId: params.organizationId, + excludeGroupId: params.groupId, + workspaceIds: group.workspaceIds, + }, + tx + ) if (conflict) throw new PermissionGroupAllMembersConflictError(conflict) } } diff --git a/apps/sim/lib/scim/application/admin/connection-view.ts b/apps/sim/lib/scim/application/admin/connection-view.ts index 45d1e1b321f..eda2f6fd19d 100644 --- a/apps/sim/lib/scim/application/admin/connection-view.ts +++ b/apps/sim/lib/scim/application/admin/connection-view.ts @@ -11,16 +11,11 @@ import { import { and, count, desc, eq } from 'drizzle-orm' import type { ScimConnectionView, ScimCredentialView } from '@/lib/api/contracts/organization-scim' import { OrchestrationError } from '@/lib/core/orchestration/types' -import { getBaseUrl } from '@/lib/core/utils/urls' -import { activeCredentialCondition } from '@/lib/scim/authenticate' -import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' +import { scimBaseUrl } from '@/lib/scim/base-url' +import { activeCredentialCondition } from '@/lib/scim/repository/credentials' /** Reads shared by the admin use cases: the connection row and its settings view. */ -export function scimBaseUrl(): string { - return `${getBaseUrl()}${SCIM_BASE_PATH}` -} - export interface ConnectionRow { id: string organizationId: string diff --git a/apps/sim/lib/scim/application/admin/connection.ts b/apps/sim/lib/scim/application/admin/connection.ts index cbbb0c2af0d..27eb89a0ce2 100644 --- a/apps/sim/lib/scim/application/admin/connection.ts +++ b/apps/sim/lib/scim/application/admin/connection.ts @@ -10,7 +10,6 @@ import { assertWorkspaceInOrganization, loadConnectionView, requireConnection, - scimBaseUrl, } from '@/lib/scim/application/admin/connection-view' import { defineAuthorizedScimAdminUseCase, @@ -24,10 +23,7 @@ import { reconcileConnection } from '@/lib/scim/reconcile/job' export const getScimConnection = defineAuthorizedScimAdminUseCase({ operation: scimAdminOperations.read, async execute({ input }: ScimAdminUseCaseArgs<{ organizationId: string }>) { - return { - connection: await loadConnectionView(input.organizationId), - baseUrl: scimBaseUrl(), - } + return { connection: await loadConnectionView(input.organizationId) } }, }) diff --git a/apps/sim/lib/scim/application/admin/credentials.ts b/apps/sim/lib/scim/application/admin/credentials.ts index 783f35edf56..09a2dc4c0ef 100644 --- a/apps/sim/lib/scim/application/admin/credentials.ts +++ b/apps/sim/lib/scim/application/admin/credentials.ts @@ -1,8 +1,9 @@ import { AuditAction, AuditResourceType } from '@sim/audit' import { db } from '@sim/db' -import { SCIM_SCOPES, type ScimScope, scimConnection, scimCredential } from '@sim/db/schema' +import { SCIM_SCOPES, scimConnection, scimCredential } from '@sim/db/schema' import { generateId } from '@sim/utils/id' import { and, count, eq, isNull, sql } from 'drizzle-orm' +import { acquireOrganizationMutationLock } from '@/lib/billing/organizations/membership' import { OrchestrationError } from '@/lib/core/orchestration/types' import { requireConnection, toCredentialView } from '@/lib/scim/application/admin/connection-view' import { @@ -10,7 +11,8 @@ import { type ScimAdminUseCaseArgs, } from '@/lib/scim/application/authorized-scim-admin-use-case' import { scimAdminOperations } from '@/lib/scim/application/operations' -import { activeCredentialCondition, generateScimToken } from '@/lib/scim/authenticate' +import { generateScimToken } from '@/lib/scim/authenticate' +import { activeCredentialCondition } from '@/lib/scim/repository/credentials' /** * Issuing and revoking the bearer credentials a directory authenticates with. @@ -26,7 +28,6 @@ const DAY_MS = 24 * 60 * 60 * 1000 export interface IssueScimCredentialInput { organizationId: string - scopes?: ScimScope[] expiresInDays?: number } @@ -35,18 +36,15 @@ export const issueScimCredential = defineAuthorizedScimAdminUseCase({ async execute({ input, context }: ScimAdminUseCaseArgs) { const connection = await requireConnection(context.organizationId) const { secret, hash, prefix } = generateScimToken() - const scopes = input.scopes ?? [...SCIM_SCOPES] + /** Every credential carries every scope today; the scope check stays as the enforcement layer. */ + const scopes = [...SCIM_SCOPES] const expiresAt = input.expiresInDays ? new Date(Date.now() + input.expiresInDays * DAY_MS) : null const created = await db.transaction(async (tx) => { - /** The connection row is the lock, so two issue requests cannot both see one free slot. */ - await tx - .select({ id: scimConnection.id }) - .from(scimConnection) - .where(eq(scimConnection.id, connection.id)) - .for('update') + /** Two issue requests serialize on the organization lock, so both cannot see one free slot. */ + await acquireOrganizationMutationLock(tx, context.organizationId) const [active] = await tx .select({ value: count() }) diff --git a/apps/sim/lib/scim/application/admin/mappings.ts b/apps/sim/lib/scim/application/admin/mappings.ts index df6dd65ea46..e26f9a8bae8 100644 --- a/apps/sim/lib/scim/application/admin/mappings.ts +++ b/apps/sim/lib/scim/application/admin/mappings.ts @@ -11,8 +11,10 @@ import { import { generateId } from '@sim/utils/id' import { and, count, eq, sql } from 'drizzle-orm' import type { ScimGroupMappingView } from '@/lib/api/contracts/organization-scim' +import { acquireOrganizationMutationLock } from '@/lib/billing/organizations/membership' import { OrchestrationError } from '@/lib/core/orchestration/types' import type { DbOrTx } from '@/lib/db/types' +import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' import { assertWorkspaceInOrganization, requireConnection, @@ -182,6 +184,7 @@ async function assertPermissionGroupTarget( * from "these people" to "everyone in these workspaces". */ if (target.membershipMode !== 'explicit') { + await acquirePermissionGroupOrgLock(tx, organizationId, { lockTimeoutAlreadyBounded: true }) await tx .update(permissionGroup) .set({ membershipMode: 'explicit', updatedAt: new Date() }) @@ -231,6 +234,7 @@ export const upsertScimGroupMapping = defineAuthorizedScimAdminUseCase({ */ const targetId = values.permissionGroupId ?? values.workspaceId ?? values.role const mapping = await db.transaction(async (tx) => { + await acquireOrganizationMutationLock(tx, context.organizationId) if (input.targetKind === 'permission_group') { await assertPermissionGroupTarget(tx, context.organizationId, input.permissionGroupId) } @@ -241,9 +245,14 @@ export const upsertScimGroupMapping = defineAuthorizedScimAdminUseCase({ .returning(MAPPING_COLUMNS) if (inserted) return inserted + /** An administrator re-mapping a pair the directory matched by name takes ownership of it. */ const [updated] = await tx .update(scimGroupMapping) - .set({ permissionType: values.permissionType }) + .set({ + permissionType: values.permissionType, + source: 'manual', + createdBy: context.actorUserId, + }) .where( and( eq(scimGroupMapping.groupId, group.id), diff --git a/apps/sim/lib/scim/application/audit.ts b/apps/sim/lib/scim/application/audit.ts new file mode 100644 index 00000000000..2ad579a8d5c --- /dev/null +++ b/apps/sim/lib/scim/application/audit.ts @@ -0,0 +1,42 @@ +import { type AuditActionType, type AuditResourceTypeValue, recordAudit } from '@sim/audit' +import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' + +/** One semantic audit entry a SCIM or admin use case projects from its result. */ +export interface ScimAuditEntry { + action: AuditActionType + resourceType: AuditResourceTypeValue + resourceId?: string + resourceName?: string + description?: string + metadata?: Record +} + +/** + * Records the audit entries a use case projected, with one attribution and one + * set of contextual metadata applied to every entry. Both wrappers — the + * directory's and the administrator's — record through here so an audit row + * looks the same whichever surface produced it. + */ +export function recordScimAuditEntries(params: { + /** Null for the directory itself, which has no user account. */ + actorId: string | null + actorName?: string + entries: readonly ScimAuditEntry[] + metadata: Record + request: OrchestrationRequestContext | undefined +}): void { + for (const entry of params.entries) { + recordAudit({ + workspaceId: null, + actorId: params.actorId, + ...(params.actorName ? { actorName: params.actorName } : {}), + action: entry.action, + resourceType: entry.resourceType, + resourceId: entry.resourceId, + resourceName: entry.resourceName, + description: entry.description, + metadata: { ...entry.metadata, ...params.metadata }, + request: params.request, + }) + } +} diff --git a/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts b/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts index 853d8272bc3..7baf0615fe4 100644 --- a/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts +++ b/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts @@ -1,10 +1,10 @@ -import { type AuditActionType, type AuditResourceTypeValue, recordAudit } from '@sim/audit' import type { Principal } from '@sim/auth/principal' import { db } from '@sim/db' import { member } from '@sim/db/schema' import { and, eq } from 'drizzle-orm' import { ForbiddenOperationError, type OperationUseCase } from '@/lib/core/application' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' +import { recordScimAuditEntries, type ScimAuditEntry } from '@/lib/scim/application/audit' import type { ScimAdminOperation, ScimAdminPrincipal } from '@/lib/scim/application/operations' import { isScimEntitledForOrganization } from '@/lib/scim/entitlement' @@ -35,14 +35,6 @@ export interface ScimAdminUseCaseResultArgs extends ScimAdminUseCaseArgs -} - interface AuthorizedScimAdminDefinition< O extends ScimAdminOperation, I extends { organizationId: string }, @@ -51,7 +43,7 @@ interface AuthorizedScimAdminDefinition< operation: O execute(args: ScimAdminUseCaseArgs): Promise /** Audit attributed to the administrator; the organization id is added for every entry. */ - projectAudit?(args: ScimAdminUseCaseResultArgs): ScimAdminAuditEntry | undefined + projectAudit?(args: ScimAdminUseCaseResultArgs): ScimAuditEntry | undefined } function requireScimAdminPrincipal( @@ -111,14 +103,10 @@ export function defineAuthorizedScimAdminUseCase< const entry = definition.projectAudit?.({ principal, input, context, request, result }) if (entry) { - recordAudit({ - workspaceId: null, + recordScimAuditEntries({ actorId: context.actorUserId, - action: entry.action, - resourceType: entry.resourceType, - resourceId: entry.resourceId, - resourceName: entry.resourceName, - metadata: { ...entry.metadata, organizationId: context.organizationId }, + entries: [entry], + metadata: { organizationId: context.organizationId }, request, }) } diff --git a/apps/sim/lib/scim/application/authorized-scim-use-case.ts b/apps/sim/lib/scim/application/authorized-scim-use-case.ts index 1d16b855713..f427f597c22 100644 --- a/apps/sim/lib/scim/application/authorized-scim-use-case.ts +++ b/apps/sim/lib/scim/application/authorized-scim-use-case.ts @@ -1,4 +1,3 @@ -import { type AuditActionType, type AuditResourceTypeValue, recordAudit } from '@sim/audit' import type { Principal } from '@sim/auth/principal' import { resolvePrincipalAuditAttribution } from '@sim/auth/principal' import { db } from '@sim/db' @@ -6,9 +5,9 @@ import { type ScimConnectionSettings, scimConnection } from '@sim/db/schema' import { eq } from 'drizzle-orm' import type { OperationUseCase } from '@/lib/core/application' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' -import { getBaseUrl } from '@/lib/core/utils/urls' +import { recordScimAuditEntries, type ScimAuditEntry } from '@/lib/scim/application/audit' import type { ScimOperation, ScimPrincipal } from '@/lib/scim/application/operations' -import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' +import { scimBaseUrl } from '@/lib/scim/base-url' import { ScimError } from '@/lib/scim/protocol/errors' /** @@ -31,15 +30,6 @@ export interface ScimUseCaseContext { baseUrl: string } -export interface ScimAuditEntry { - action: AuditActionType - resourceType: AuditResourceTypeValue - resourceId?: string - resourceName?: string - description?: string - metadata?: Record -} - export interface ScimUseCaseArgs { principal: ScimPrincipal input: I @@ -69,45 +59,6 @@ function requireScimPrincipal( } } -/** - * Records semantic audit for a directory change. - * - * The actor is the connection, never a person: nobody was at a keyboard when the - * directory synchronized, and naming the administrator who configured it would - * attribute months of automated changes to one login. - */ -function recordScimAudit( - operation: ScimOperation, - principal: ScimPrincipal, - context: ScimUseCaseContext, - request: OrchestrationRequestContext | undefined, - entries: readonly ScimAuditEntry[] -): void { - const attribution = resolvePrincipalAuditAttribution(principal) - for (const entry of entries) { - recordAudit({ - workspaceId: null, - actorId: attribution.actorId, - actorName: attribution.actorName, - action: entry.action, - resourceType: entry.resourceType, - resourceId: entry.resourceId, - resourceName: entry.resourceName, - description: entry.description, - metadata: { - ...entry.metadata, - organizationId: context.organizationId, - connectionId: context.connection.id, - credentialId: principal.credentialId, - operation: operation.id, - source: 'scim', - actor: attribution.actor, - }, - request, - }) - } -} - /** * Re-reads the connection on every operation. * @@ -167,7 +118,7 @@ export function defineAuthorizedScimUseCase const context: ScimUseCaseContext = { connection, organizationId: connection.organizationId, - baseUrl: `${getBaseUrl()}${SCIM_BASE_PATH}`, + baseUrl: scimBaseUrl(), } const result = await definition.execute({ principal, input, context, request }) @@ -177,7 +128,26 @@ export function defineAuthorizedScimUseCase const entries = projected === undefined ? [] : Array.isArray(projected) ? projected : [projected] if (entries.length > 0) { - recordScimAudit(definition.operation, principal, context, request, entries) + /** + * The actor is the connection, never a person: nobody was at a keyboard + * when the directory synchronized, and naming the administrator who + * configured it would attribute months of automated changes to one login. + */ + const attribution = resolvePrincipalAuditAttribution(principal) + recordScimAuditEntries({ + actorId: attribution.actorId, + actorName: attribution.actorName ?? undefined, + entries, + metadata: { + organizationId: context.organizationId, + connectionId: context.connection.id, + credentialId: principal.credentialId, + operation: definition.operation.id, + source: 'scim', + actor: attribution.actor, + }, + request, + }) } await definition.afterSuccess?.(resultArgs) diff --git a/apps/sim/lib/scim/application/groups/manage-groups.ts b/apps/sim/lib/scim/application/groups/manage-groups.ts index 48306586791..1d9228a6f5e 100644 --- a/apps/sim/lib/scim/application/groups/manage-groups.ts +++ b/apps/sim/lib/scim/application/groups/manage-groups.ts @@ -8,6 +8,7 @@ import type { DbOrTx } from '@/lib/db/types' import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, + type ScimUseCaseContext, } from '@/lib/scim/application/authorized-scim-use-case' import { scimOperations } from '@/lib/scim/application/operations' import { autoMapPermissionGroupByName } from '@/lib/scim/projection/auto-map' @@ -27,9 +28,9 @@ import { } from '@/lib/scim/protocol/resources' import { addGroupMember, - assertConnectionOwnsUsers, countGroupMembers, deleteScimGroupRow, + filterOwnedUsers, findScimGroupById, insertScimGroup, loadGroupMemberIds, @@ -43,6 +44,21 @@ import { /** Reads and writes of the Group resource, and the projection each change triggers. */ +/** + * Every group write runs in one transaction under the organization lock, which + * heads the documented lock order, so two full-membership PATCHes cannot both + * compute from the same stale membership and keep members from both. + */ +function withGroupWrite( + context: ScimUseCaseContext, + work: (tx: DbOrTx) => Promise +): Promise { + return db.transaction(async (tx) => { + await acquireOrganizationMutationLock(tx, context.organizationId) + return work(tx) + }) +} + async function assertDisplayNameAvailable( tx: DbOrTx, params: { connectionId: string; displayName: string; exceptGroupId?: string } @@ -164,25 +180,19 @@ export const createScimGroup = defineAuthorizedScimUseCase({ context, }: ScimUseCaseArgs): Promise { const { group } = input - return db.transaction(async (tx) => { - /** - * Group writes serialize on the organization lock, which also heads the - * documented lock order, so two full-membership PATCHes cannot both compute - * from the same stale membership and keep members from both. - */ - await acquireOrganizationMutationLock(tx, context.organizationId) + return withGroupWrite(context, async (tx) => { await assertDisplayNameAvailable(tx, { connectionId: context.connection.id, displayName: group.displayName, }) - await assertConnectionOwnsUsers(tx, context.connection.id, group.memberIds) + const memberIds = await filterOwnedUsers(tx, context.connection.id, group.memberIds) const created = await insertScimGroup(tx, { connectionId: context.connection.id, displayName: group.displayName, externalId: group.externalId, }) - for (const scimUserId of group.memberIds) { + for (const scimUserId of memberIds) { await addGroupMember(tx, { groupId: created.id, scimUserId }) } await assertMemberCount(tx, created.id) @@ -198,7 +208,7 @@ export const createScimGroup = defineAuthorizedScimUseCase({ await reconcileUsersProjection(tx, { connectionId: context.connection.id, organizationId: context.organizationId, - scimUserIds: group.memberIds, + scimUserIds: memberIds, settings: context.connection.settings, }) @@ -207,7 +217,7 @@ export const createScimGroup = defineAuthorizedScimUseCase({ groupId: created.id, displayName: created.displayName, resource: toGroupResource({ ...created, members }, context.baseUrl), - touchedUserIds: group.memberIds, + touchedUserIds: memberIds, renamed: true, } }) @@ -232,13 +242,7 @@ export const replaceScimGroup = defineAuthorizedScimUseCase({ input, context, }: ScimUseCaseArgs): Promise { - return db.transaction(async (tx) => { - /** - * Group writes serialize on the organization lock, which also heads the - * documented lock order, so two full-membership PATCHes cannot both compute - * from the same stale membership and keep members from both. - */ - await acquireOrganizationMutationLock(tx, context.organizationId) + return withGroupWrite(context, async (tx) => { const current = await findScimGroupById(tx, context.connection.id, input.groupId) if (!current) throw notFound('SCIM Group not found') @@ -247,10 +251,10 @@ export const replaceScimGroup = defineAuthorizedScimUseCase({ displayName: input.group.displayName, exceptGroupId: current.id, }) - await assertConnectionOwnsUsers(tx, context.connection.id, input.group.memberIds) + const memberIds = await filterOwnedUsers(tx, context.connection.id, input.group.memberIds) const before = await loadGroupMemberIds(tx, current.id) - const desired = new Set(input.group.memberIds) + const desired = new Set(memberIds) const touched = new Set() const renamed = input.group.displayName !== current.displayName @@ -334,13 +338,7 @@ export const patchScimGroup = defineAuthorizedScimUseCase({ }: ScimUseCaseArgs): Promise { const patch = parseGroupPatch(input.operations) - return db.transaction(async (tx) => { - /** - * Group writes serialize on the organization lock, which also heads the - * documented lock order, so two full-membership PATCHes cannot both compute - * from the same stale membership and keep members from both. - */ - await acquireOrganizationMutationLock(tx, context.organizationId) + return withGroupWrite(context, async (tx) => { const current = await findScimGroupById(tx, context.connection.id, input.groupId) if (!current) throw notFound('SCIM Group not found') @@ -348,8 +346,7 @@ export const patchScimGroup = defineAuthorizedScimUseCase({ let renamed = false const applyAdds = async (ids: string[]) => { - await assertConnectionOwnsUsers(tx, context.connection.id, ids) - for (const scimUserId of ids) { + for (const scimUserId of await filterOwnedUsers(tx, context.connection.id, ids)) { if (await addGroupMember(tx, { groupId: current.id, scimUserId })) touched.add(scimUserId) } } @@ -450,13 +447,7 @@ export interface DeleteScimGroupInput { export const deleteScimGroup = defineAuthorizedScimUseCase({ operation: scimOperations.deleteGroup, async execute({ input, context }: ScimUseCaseArgs) { - return db.transaction(async (tx) => { - /** - * Group writes serialize on the organization lock, which also heads the - * documented lock order, so two full-membership PATCHes cannot both compute - * from the same stale membership and keep members from both. - */ - await acquireOrganizationMutationLock(tx, context.organizationId) + return withGroupWrite(context, async (tx) => { const current = await findScimGroupById(tx, context.connection.id, input.groupId) if (!current) throw notFound('SCIM Group not found') diff --git a/apps/sim/lib/scim/application/users/deprovision-user.test.ts b/apps/sim/lib/scim/application/users/deprovision-user.test.ts new file mode 100644 index 00000000000..48927b9c387 --- /dev/null +++ b/apps/sim/lib/scim/application/users/deprovision-user.test.ts @@ -0,0 +1,144 @@ +/** + * @vitest-environment node + */ +import { db } from '@sim/db' +import { member, scimConnection } from '@sim/db/schema' +import { queueTableRows, resetDbChainMock } from '@sim/testing' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + removeUser: vi.fn(), + reconcileSeats: vi.fn(), + endDirectoryMembership: vi.fn(), + findScimUserById: vi.fn(), + recordAudit: vi.fn(), +})) + +vi.mock('@/lib/billing/organizations/membership', () => ({ + removeUserFromOrganization: mocks.removeUser, +})) +vi.mock('@/lib/billing/organizations/seats', () => ({ + reconcileOrganizationSeats: mocks.reconcileSeats, +})) +vi.mock('@/lib/scim/identity/end-directory-membership', () => ({ + endDirectoryMembershipTx: mocks.endDirectoryMembership, +})) +vi.mock('@/lib/scim/repository/users', () => ({ + findScimUserById: mocks.findScimUserById, +})) +vi.mock('@/lib/scim/application/audit', () => ({ + recordScimAuditEntries: mocks.recordAudit, +})) +vi.mock('@/lib/scim/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) + +import type { Principal } from '@sim/auth/principal' +import { deprovisionScimUser } from '@/lib/scim/application/users/deprovision-user' +import { ScimError } from '@/lib/scim/protocol/errors' + +const principal: Principal = { + kind: 'scim_connection', + organizationId: 'org-1', + connectionId: 'conn-1', + credentialId: 'cred-1', + scopes: ['users:write'], +} + +function stage(membership: Array<{ id: string; role: string }>) { + queueTableRows(scimConnection, [ + { id: 'conn-1', organizationId: 'org-1', status: 'active', settings: {} }, + ]) + queueTableRows(member, membership) + mocks.findScimUserById.mockResolvedValue({ id: 'su-1', userId: 'u-1', externalId: 'ext-1' }) +} + +afterAll(resetDbChainMock) + +describe('deprovisionScimUser', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + mocks.removeUser.mockResolvedValue({ success: true }) + mocks.endDirectoryMembership.mockResolvedValue({ removed: 1 }) + mocks.reconcileSeats.mockResolvedValue({ changed: false }) + }) + + it('removes a member through the shared primitive and audits the removal', async () => { + stage([{ id: 'm-1', role: 'member' }]) + const result = await deprovisionScimUser.execute({ + principal, + input: { scimUserId: 'su-1' }, + request: undefined, + }) + expect(mocks.removeUser).toHaveBeenCalledWith({ + userId: 'u-1', + organizationId: 'org-1', + memberId: 'm-1', + }) + expect(mocks.endDirectoryMembership).not.toHaveBeenCalled() + expect(result.removedFromOrganization).toBe(true) + const actions = mocks.recordAudit.mock.calls[0][0].entries.map( + (entry: { action: string }) => entry.action + ) + expect(actions).toEqual(['scim_user.deprovisioned', 'org_member.removed']) + expect(mocks.reconcileSeats).toHaveBeenCalledWith({ + organizationId: 'org-1', + reason: 'scim-member-removed', + }) + }) + + it('refuses to deprovision the owner with a conflict that is not a duplicate', async () => { + stage([{ id: 'm-1', role: 'owner' }]) + const error = await deprovisionScimUser + .execute({ principal, input: { scimUserId: 'su-1' }, request: undefined }) + .catch((caught) => caught) + expect(error).toBeInstanceOf(ScimError) + expect(error.status).toBe(409) + expect(error.scimType).toBeUndefined() + expect(mocks.removeUser).not.toHaveBeenCalled() + }) + + it('retires only the directory row when the account already left the organization', async () => { + stage([]) + const result = await deprovisionScimUser.execute({ + principal, + input: { scimUserId: 'su-1' }, + request: undefined, + }) + expect(mocks.removeUser).not.toHaveBeenCalled() + expect(mocks.endDirectoryMembership).toHaveBeenCalledWith(db, { + userId: 'u-1', + organizationId: 'org-1', + }) + expect(result.removedFromOrganization).toBe(false) + expect(mocks.reconcileSeats).not.toHaveBeenCalled() + const actions = mocks.recordAudit.mock.calls[0][0].entries.map( + (entry: { action: string }) => entry.action + ) + expect(actions).toEqual(['scim_user.deprovisioned']) + }) + + it('surfaces a refused removal as a conflict the directory can show', async () => { + stage([{ id: 'm-1', role: 'member' }]) + mocks.removeUser.mockResolvedValue({ + success: false, + error: 'Workflows could not be reassigned', + }) + const error = await deprovisionScimUser + .execute({ principal, input: { scimUserId: 'su-1' }, request: undefined }) + .catch((caught) => caught) + expect(error.status).toBe(409) + expect(error.message).toBe('Workflows could not be reassigned') + expect(mocks.recordAudit).not.toHaveBeenCalled() + }) + + it('answers 404 for an id this connection does not own', async () => { + queueTableRows(scimConnection, [ + { id: 'conn-1', organizationId: 'org-1', status: 'active', settings: {} }, + ]) + mocks.findScimUserById.mockResolvedValue(null) + const error = await deprovisionScimUser + .execute({ principal, input: { scimUserId: 'other' }, request: undefined }) + .catch((caught) => caught) + expect(error.status).toBe(404) + }) +}) diff --git a/apps/sim/lib/scim/application/users/deprovision-user.ts b/apps/sim/lib/scim/application/users/deprovision-user.ts index a3fd093b399..8b5f225b223 100644 --- a/apps/sim/lib/scim/application/users/deprovision-user.ts +++ b/apps/sim/lib/scim/application/users/deprovision-user.ts @@ -3,25 +3,16 @@ import { db } from '@sim/db' import { member } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { and, eq } from 'drizzle-orm' -import { - acquireOrganizationUserMutationLocks, - removeUserFromOrganization, -} from '@/lib/billing/organizations/membership' +import { removeUserFromOrganization } from '@/lib/billing/organizations/membership' import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' -import { - invalidateAfterSessionRevocation, - revokePersonalApiKeysTx, - revokeUserSessionsTx, - unsuspendMemberTx, -} from '@/lib/organizations/members/lifecycle' import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, } from '@/lib/scim/application/authorized-scim-use-case' import { scimOperations } from '@/lib/scim/application/operations' -import { upsertTombstone } from '@/lib/scim/identity/resolve-user' +import { endDirectoryMembershipTx } from '@/lib/scim/identity/end-directory-membership' import { notFound, ScimError } from '@/lib/scim/protocol/errors' -import { deleteScimUser, findScimUserById } from '@/lib/scim/repository/users' +import { findScimUserById } from '@/lib/scim/repository/users' const logger = createLogger('ScimDeprovisionUser') @@ -43,6 +34,10 @@ export interface DeprovisionScimUserResult { * days after a hard delete, and OneLogin and JumpCloud can be configured to. The * Sim account itself survives: the person may hold access in another * organization later, and their audit history must remain attributable. + * + * Removal is the same primitive the settings UI uses. It ends the membership, + * revokes sessions and personal keys, reassigns what the member owned, and + * retires this directory row into its tombstone, all in one commit. */ export const deprovisionScimUser = defineAuthorizedScimUseCase({ operation: scimOperations.deprovisionUser, @@ -75,13 +70,6 @@ export const deprovisionScimUser = defineAuthorizedScimUseCase({ } if (membership) { - /** - * Owns its own invitation-safe lock scope, clears every workspace - * permission and permission-group membership in the organization, and - * reassigns everything the member owned — so directory-granted access is - * withdrawn here as a consequence, and the projection rows cascade away - * with the SCIM user below. - */ const removal = await removeUserFromOrganization({ userId: current.userId, organizationId: context.organizationId, @@ -90,50 +78,19 @@ export const deprovisionScimUser = defineAuthorizedScimUseCase({ if (!removal.success) { throw new ScimError(409, undefined, removal.error ?? 'The member could not be removed') } - } - - await db.transaction(async (tx) => { - /** Serializes with a concurrent PATCH, which re-reads the row under the same locks. */ - await acquireOrganizationUserMutationLocks(tx, { - userId: current.userId, - organizationIds: [context.organizationId], - }) + } else { /** - * Account-wide effects belong only to the removal this request performed. - * A stale row for someone who already left — and may since have joined - * another organization — must not sign them out or revoke their keys there. + * The account left through a path that predates this connection's row, or + * was hard-deleted and recreated. Only the directory's own record remains + * to retire; there is no live access left to revoke. */ - const [rejoined] = membership - ? await tx - .select({ id: member.id }) - .from(member) - .where( - and( - eq(member.organizationId, context.organizationId), - eq(member.userId, current.userId) - ) - ) - .limit(1) - : [] - if (membership && !rejoined) { - await revokeUserSessionsTx(tx, { + await db.transaction((tx) => + endDirectoryMembershipTx(tx, { userId: current.userId, organizationId: context.organizationId, }) - await revokePersonalApiKeysTx(tx, { userId: current.userId }) - /** A suspension the directory applied has no meaning once membership ends. */ - await unsuspendMemberTx(tx, { userId: current.userId, source: 'scim' }) - } - - if (current.externalId) { - await upsertTombstone(tx, { - connectionId: context.connection.id, - externalId: current.externalId, - userId: current.userId, - }) - } - await deleteScimUser(tx, current.id) - }) + ) + } return { scimUserId: current.id, @@ -163,12 +120,7 @@ export const deprovisionScimUser = defineAuthorizedScimUseCase({ ], afterSuccess: async ({ result, context }) => { - if (result.removedFromOrganization) { - invalidateAfterSessionRevocation({ - userId: result.userId, - organizationId: context.organizationId, - }) - } + if (!result.removedFromOrganization) return try { await reconcileOrganizationSeats({ organizationId: context.organizationId, diff --git a/apps/sim/lib/scim/application/users/provision-user.ts b/apps/sim/lib/scim/application/users/provision-user.ts index 9186d710f49..e21ea01af84 100644 --- a/apps/sim/lib/scim/application/users/provision-user.ts +++ b/apps/sim/lib/scim/application/users/provision-user.ts @@ -1,29 +1,20 @@ import { AuditAction, AuditResourceType } from '@sim/audit' import { db } from '@sim/db' -import { type ScimUserAttributes, subscription } from '@sim/db/schema' +import type { ScimUserAttributes } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { APIError } from 'better-auth/api' -import { and, desc, eq, inArray } from 'drizzle-orm' import { auth } from '@/lib/auth' import { applySessionPolicyToNewMember } from '@/lib/auth/session-policy' import { syncUsageLimitsFromSubscription } from '@/lib/billing/core/usage' -import { - ensureUserInOrganizationTx, - getUserOrganization, -} from '@/lib/billing/organizations/membership' +import { ensureUserInOrganizationTx } from '@/lib/billing/organizations/membership' +import { resolveOrganizationSeatPolicyTx } from '@/lib/billing/organizations/seat-policy' import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' -import { isTeam } from '@/lib/billing/plan-helpers' -import { ENTITLED_SUBSCRIPTION_STATUSES } from '@/lib/billing/subscriptions/utils' -import type { DbOrTx } from '@/lib/db/types' import { getInstanceOrganizationId, isInstanceOrganizationMode, } from '@/lib/organizations/instance-org' -import { - invalidateAfterSessionRevocation, - suspendMemberTx, - unsuspendMemberTx, -} from '@/lib/organizations/members/lifecycle' +import { suspendMemberTx, unsuspendMemberTx } from '@/lib/organizations/members/lifecycle' +import { invalidateAfterSessionRevocation } from '@/lib/organizations/members/revocation' import { captureServerEvent } from '@/lib/posthog/server' import { defineAuthorizedScimUseCase, @@ -42,7 +33,6 @@ import { ScimError, uniqueness } from '@/lib/scim/protocol/errors' import { toUserResource } from '@/lib/scim/protocol/resources' import { assertUserNameAvailable, - deleteScimUser, findScimUserById, findScimUserByUserId, insertScimUser, @@ -68,35 +58,6 @@ export interface ProvisionScimUserResult { resource: ReturnType } -/** - * Whether this organization's plan lets membership grow on demand. - * - * Team plans add a seat when someone joins; Enterprise buys a fixed number in - * advance and must refuse beyond it. The same rule governs SSO just-in-time - * provisioning, so a directory and a first sign-in agree on who fits. - */ -async function resolveSeatPolicy( - tx: DbOrTx, - organizationId: string -): Promise<{ skipSeatValidation?: true; organizationSubscriptionId?: string }> { - const [entitled] = await tx - .select({ id: subscription.id, plan: subscription.plan }) - .from(subscription) - .where( - and( - eq(subscription.referenceId, organizationId), - inArray(subscription.status, ENTITLED_SUBSCRIPTION_STATUSES) - ) - ) - .orderBy(desc(subscription.periodStart), desc(subscription.id)) - .limit(1) - - return { - ...(isTeam(entitled?.plan) ? { skipSeatValidation: true as const } : {}), - ...(entitled?.id ? { organizationSubscriptionId: entitled.id } : {}), - } -} - /** Turns a membership refusal into the SCIM error a directory administrator can act on. */ function membershipFailure(code: string | undefined): ScimError { if (code === 'no-seats-available') { @@ -191,29 +152,19 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ userId = resolution.userId } - const existing = await findScimUserByUserId(db, context.connection.id, userId) - if (existing) { - /** - * A SCIM row whose account has already left the organization is the - * residue of a deprovisioning interrupted between its two commits. The - * directory is telling us the person is back; clearing the stale row lets - * it proceed rather than reporting a conflict nobody can act on. - */ - const stillMember = await getUserOrganization(userId) - if (stillMember?.organizationId === context.organizationId) { - throw uniqueness('This directory already provisions the user') - } - await deleteScimUser(db, existing.id) + if (await findScimUserByUserId(db, context.connection.id, userId)) { + throw uniqueness('This directory already provisions the user') } let provisioned: { scimUserId: string joinedOrganization: boolean subscriptionId: string | undefined + resource: ReturnType } try { provisioned = await db.transaction(async (tx) => { - const seatPolicy = await resolveSeatPolicy(tx, context.organizationId) + const seatPolicy = await resolveOrganizationSeatPolicyTx(tx, context.organizationId) const membership = await ensureUserInOrganizationTx(tx, { userId, organizationId: context.organizationId, @@ -264,10 +215,15 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ scimUserId: inserted.id, settings: context.connection.settings, }) + const record = await findScimUserById(tx, context.connection.id, inserted.id) + if (!record) { + throw new ScimError(500, undefined, 'The provisioned user could not be read back') + } return { scimUserId: inserted.id, joinedOrganization: !membership.alreadyMember, subscriptionId: seatPolicy.organizationSubscriptionId, + resource: toUserResource(toUserResourceRow(record, []), context.baseUrl), } }) } catch (error) { @@ -287,19 +243,11 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ } throw error } - const { scimUserId, joinedOrganization, subscriptionId } = provisioned - - const record = await findScimUserById(db, context.connection.id, scimUserId) - if (!record) throw new ScimError(500, undefined, 'The provisioned user could not be read back') - return { - scimUserId, + ...provisioned, userId, createdAccount, - joinedOrganization, - subscriptionId, organizationId: context.organizationId, - resource: toUserResource(toUserResourceRow(record, []), context.baseUrl), } }, diff --git a/apps/sim/lib/scim/application/users/update-user.test.ts b/apps/sim/lib/scim/application/users/update-user.test.ts new file mode 100644 index 00000000000..543c39d5fcf --- /dev/null +++ b/apps/sim/lib/scim/application/users/update-user.test.ts @@ -0,0 +1,217 @@ +/** + * @vitest-environment node + */ +import { db } from '@sim/db' +import { type ScimUserAttributes, scimConnection } from '@sim/db/schema' +import { queueTableRows, resetDbChainMock } from '@sim/testing' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + acquireLocks: vi.fn(), + suspend: vi.fn(), + unsuspend: vi.fn(), + revokeSessions: vi.fn(), + invalidate: vi.fn(), + syncIdentity: vi.fn(), + assertDomainOwned: vi.fn(), + reconcile: vi.fn(), + findScimUserById: vi.fn(), + assertUserNameAvailable: vi.fn(), + updateScimUser: vi.fn(), + loadGroups: vi.fn(), + recordAudit: vi.fn(), +})) + +vi.mock('@/lib/billing/organizations/membership', () => ({ + acquireOrganizationUserMutationLocks: mocks.acquireLocks, +})) +vi.mock('@/lib/organizations/members/lifecycle', () => ({ + suspendMemberTx: mocks.suspend, + unsuspendMemberTx: mocks.unsuspend, +})) +vi.mock('@/lib/organizations/members/revocation', () => ({ + revokeUserSessionsTx: mocks.revokeSessions, + invalidateAfterSessionRevocation: mocks.invalidate, +})) +vi.mock('@/lib/scim/identity/account-identity', () => ({ + syncAccountIdentityTx: mocks.syncIdentity, +})) +vi.mock('@/lib/scim/identity/resolve-user', () => ({ + assertDomainOwned: mocks.assertDomainOwned, +})) +vi.mock('@/lib/scim/projection/reconcile-user', () => ({ + reconcileUserProjection: mocks.reconcile, +})) +vi.mock('@/lib/scim/repository/users', () => ({ + findScimUserById: mocks.findScimUserById, + assertUserNameAvailable: mocks.assertUserNameAvailable, + updateScimUser: mocks.updateScimUser, + loadGroupsForScimUsers: mocks.loadGroups, + toUserResourceRow: (record: Record) => ({ + id: record.id, + externalId: record.externalId, + userName: record.userName, + active: record.active, + attributes: record.attributes, + email: record.email, + createdAt: record.createdAt, + updatedAt: record.updatedAt, + groups: [], + }), +})) +vi.mock('@/lib/scim/application/audit', () => ({ + recordScimAuditEntries: mocks.recordAudit, +})) +vi.mock('@/lib/scim/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) + +import type { Principal } from '@sim/auth/principal' +import { patchScimUser, replaceScimUser } from '@/lib/scim/application/users/update-user' + +const principal: Principal = { + kind: 'scim_connection', + organizationId: 'org-1', + connectionId: 'conn-1', + credentialId: 'cred-1', + scopes: ['users:write'], +} + +function attributes(overrides: Partial = {}): ScimUserAttributes { + return { + userName: 'ada@acme.test', + externalId: 'ext-1', + active: true, + displayName: 'Ada Lovelace', + name: { formatted: 'Ada Lovelace', givenName: 'Ada', familyName: 'Lovelace' }, + emails: [{ value: 'ada@acme.test', type: 'work', primary: true }], + ...overrides, + } +} + +function stage( + record: { attributes?: Partial; email?: string; active?: boolean } = {} +) { + queueTableRows(scimConnection, [ + { id: 'conn-1', organizationId: 'org-1', status: 'active', settings: {} }, + ]) + const stored = attributes(record.attributes) + mocks.findScimUserById.mockResolvedValue({ + id: 'su-1', + userId: 'u-1', + externalId: stored.externalId ?? null, + userName: stored.userName, + active: record.active ?? stored.active, + attributes: stored, + email: record.email ?? 'ada@acme.test', + createdAt: new Date('2026-01-01T00:00:00.000Z'), + updatedAt: new Date('2026-01-01T00:00:00.000Z'), + userSuspendedAt: null, + }) +} + +const run = ( + useCase: typeof replaceScimUser | typeof patchScimUser, + input: Record +) => useCase.execute({ principal, input: input as never, request: undefined }) + +afterAll(resetDbChainMock) + +describe('user updates', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + mocks.loadGroups.mockResolvedValue(new Map()) + mocks.reconcile.mockResolvedValue({ added: [], removed: [], raised: [] }) + }) + + it('serializes on the organization and user locks before computing the update', async () => { + stage() + await run(patchScimUser, { + scimUserId: 'su-1', + operations: [{ op: 'replace', path: 'displayName', value: 'Augusta' }], + }) + expect(mocks.acquireLocks).toHaveBeenCalledWith(db, { + userId: 'u-1', + organizationIds: ['org-1'], + }) + expect(mocks.findScimUserById).toHaveBeenCalledTimes(3) + expect(mocks.acquireLocks.mock.invocationCallOrder[0]).toBeLessThan( + mocks.findScimUserById.mock.invocationCallOrder[1] + ) + }) + + it('writes and audits nothing when Okta re-sends the stored resource', async () => { + stage() + const result = await run(replaceScimUser, { scimUserId: 'su-1', attributes: attributes() }) + expect(result.outcome).toBeNull() + expect(mocks.updateScimUser).not.toHaveBeenCalled() + expect(mocks.reconcile).not.toHaveBeenCalled() + expect(mocks.recordAudit).not.toHaveBeenCalled() + expect(result.resource.id).toBe('su-1') + }) + + it('deactivates by suspending, never by removing, and keeps the projection', async () => { + stage() + const result = await run(patchScimUser, { + scimUserId: 'su-1', + operations: [{ op: 'replace', value: { active: false } }], + }) + expect(mocks.suspend).toHaveBeenCalledWith(db, { + userId: 'u-1', + organizationId: 'org-1', + source: 'scim', + }) + expect(mocks.revokeSessions).not.toHaveBeenCalled() + expect(mocks.reconcile).toHaveBeenCalledWith( + db, + expect.objectContaining({ scimUserId: 'su-1' }) + ) + expect(result.outcome).toEqual({ emailChanged: false, deactivated: true, reactivated: false }) + const actions = mocks.recordAudit.mock.calls[0][0].entries.map( + (entry: { action: string }) => entry.action + ) + expect(actions).toEqual(['scim_user.updated', 'scim_user.deactivated']) + expect(mocks.invalidate).toHaveBeenCalledWith({ userId: 'u-1', organizationId: 'org-1' }) + }) + + it('proves the organization owns the new domain before moving the address, then signs the user out', async () => { + stage() + await run(patchScimUser, { + scimUserId: 'su-1', + operations: [{ op: 'replace', path: 'emails[type eq "work"].value', value: 'ada@corp.test' }], + }) + expect(mocks.assertDomainOwned).toHaveBeenCalledWith(db, 'org-1', 'ada@corp.test') + expect(mocks.assertDomainOwned.mock.invocationCallOrder[0]).toBeLessThan( + mocks.syncIdentity.mock.invocationCallOrder[0] + ) + expect(mocks.syncIdentity).toHaveBeenCalledWith(db, { + userId: 'u-1', + email: 'ada@corp.test', + name: 'Ada Lovelace', + }) + expect(mocks.revokeSessions).toHaveBeenCalled() + }) + + it('re-asserts the directory address when the account drifted away from it', async () => { + stage({ email: 'changed-in-sim@acme.test' }) + const result = await run(replaceScimUser, { scimUserId: 'su-1', attributes: attributes() }) + expect(result.outcome?.emailChanged).toBe(true) + expect(mocks.syncIdentity).toHaveBeenCalledWith(db, { + userId: 'u-1', + email: 'ada@acme.test', + name: 'Ada Lovelace', + }) + }) + + it('refuses a credential without the write scope', async () => { + stage() + const error = await replaceScimUser + .execute({ + principal: { ...principal, scopes: ['users:read'] }, + input: { scimUserId: 'su-1', attributes: attributes() }, + request: undefined, + }) + .catch((caught) => caught) + expect(error.status).toBe(403) + expect(mocks.findScimUserById).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/lib/scim/application/users/update-user.ts b/apps/sim/lib/scim/application/users/update-user.ts index ecc09df3abe..60894cccd87 100644 --- a/apps/sim/lib/scim/application/users/update-user.ts +++ b/apps/sim/lib/scim/application/users/update-user.ts @@ -1,20 +1,18 @@ import { AuditAction, AuditResourceType } from '@sim/audit' import { db } from '@sim/db' -import { member, type ScimUserAttributes } from '@sim/db/schema' +import type { ScimUserAttributes } from '@sim/db/schema' import { normalizeEmail } from '@sim/utils/string' -import { and, eq } from 'drizzle-orm' import type { ScimPatchOperation } from '@/lib/api/contracts/scim' import { acquireOrganizationUserMutationLocks } from '@/lib/billing/organizations/membership' import type { DbOrTx } from '@/lib/db/types' +import { suspendMemberTx, unsuspendMemberTx } from '@/lib/organizations/members/lifecycle' import { invalidateAfterSessionRevocation, revokeUserSessionsTx, - suspendMemberTx, - unsuspendMemberTx, -} from '@/lib/organizations/members/lifecycle' +} from '@/lib/organizations/members/revocation' +import type { ScimAuditEntry } from '@/lib/scim/application/audit' import { defineAuthorizedScimUseCase, - type ScimAuditEntry, type ScimUseCaseArgs, type ScimUseCaseContext, } from '@/lib/scim/application/authorized-scim-use-case' @@ -148,22 +146,21 @@ async function loadUserForUpdate( }) const current = await findScimUserById(tx, context.connection.id, scimUserId) if (!current) throw notFound('SCIM User not found') - /** - * A row can outlive the membership it describes when someone is removed by - * hand. Writing to that account would reach into whichever organization the - * person joined next, so the resource is reported gone instead. - */ - const [membership] = await tx - .select({ id: member.id }) - .from(member) - .where( - and(eq(member.organizationId, context.organizationId), eq(member.userId, current.userId)) - ) - .limit(1) - if (!membership) throw notFound('SCIM User not found') return current } +/** + * Whether the account's address no longer matches what the directory asserts. + * + * The directory is the authority on a provisioned member's address. If the + * person changed it in Sim, the next directory write — even one that repeats + * the stored attributes — restores it, so what the directory sees and what the + * account uses cannot stay apart. + */ +function accountEmailDiverged(current: ScimUserRecord, next: ScimUserAttributes): boolean { + return normalizeEmail(primaryEmail(next)) !== normalizeEmail(current.email) +} + /** Rendered inside the write transaction, so a concurrent delete cannot make a committed update unreadable. */ async function renderUpdated( tx: DbOrTx, @@ -247,9 +244,10 @@ export const replaceScimUser = defineAuthorizedScimUseCase({ * changes nothing must not write, audit, or re-project, or a 2,000-user * organization produces 2,000 spurious audit rows per sync. */ - const outcome = userAttributesEqual(current.attributes, next) - ? null - : await applyUserUpdate(tx, context, current, next) + const outcome = + userAttributesEqual(current.attributes, next) && !accountEmailDiverged(current, next) + ? null + : await applyUserUpdate(tx, context, current, next) return { scimUserId: current.id, userId: current.userId, @@ -286,7 +284,10 @@ export const patchScimUser = defineAuthorizedScimUseCase({ * projection pass, and a `lastModified` bump for a request that meant * nothing. */ - const outcome = changed ? await applyUserUpdate(tx, context, current, next) : null + const outcome = + changed || accountEmailDiverged(current, next) + ? await applyUserUpdate(tx, context, current, next) + : null return { scimUserId: current.id, userId: current.userId, diff --git a/apps/sim/lib/scim/authenticate.ts b/apps/sim/lib/scim/authenticate.ts index efd77bc6f9d..ab5f4afc154 100644 --- a/apps/sim/lib/scim/authenticate.ts +++ b/apps/sim/lib/scim/authenticate.ts @@ -4,7 +4,7 @@ import { db } from '@sim/db' import { scimConnection, scimCredential } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { generateShortId } from '@sim/utils/id' -import { and, eq, isNull, or, sql } from 'drizzle-orm' +import { eq } from 'drizzle-orm' import type { NextRequest } from 'next/server' import { isScimEntitledForOrganization } from '@/lib/scim/entitlement' import { ScimError } from '@/lib/scim/protocol/errors' @@ -142,12 +142,3 @@ export async function authenticateScimRequest( scopes: row.scopes as ScimCredentialScope[], } } - -/** Active credentials for a connection, used to bound how many may exist at once. */ -export function activeCredentialCondition(connectionId: string) { - return and( - eq(scimCredential.connectionId, connectionId), - isNull(scimCredential.revokedAt), - or(isNull(scimCredential.expiresAt), sql`${scimCredential.expiresAt} > now()`) - ) -} diff --git a/apps/sim/lib/scim/base-url.ts b/apps/sim/lib/scim/base-url.ts new file mode 100644 index 00000000000..85dc99c1115 --- /dev/null +++ b/apps/sim/lib/scim/base-url.ts @@ -0,0 +1,7 @@ +import { getBaseUrl } from '@/lib/core/utils/urls' +import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' + +/** The absolute root of the SCIM surface, e.g. `https://sim.ai/api/scim/v2`; used for `meta.location`, `$ref`, and settings. */ +export function scimBaseUrl(): string { + return `${getBaseUrl()}${SCIM_BASE_PATH}` +} diff --git a/apps/sim/lib/scim/entitlement.test.ts b/apps/sim/lib/scim/entitlement.test.ts new file mode 100644 index 00000000000..ee7604467b7 --- /dev/null +++ b/apps/sim/lib/scim/entitlement.test.ts @@ -0,0 +1,44 @@ +/** + * @vitest-environment node + */ +import { resetEnvFlagsMock, setEnvFlags } from '@sim/testing' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + +const { mockEnterprisePlan } = vi.hoisted(() => ({ mockEnterprisePlan: vi.fn() })) + +vi.mock('@/lib/billing/core/subscription', () => ({ + isOrganizationOnEnterprisePlan: mockEnterprisePlan, +})) + +import { isScimEntitledForOrganization } from '@/lib/scim/entitlement' + +afterEach(resetEnvFlagsMock) + +describe('isScimEntitledForOrganization', () => { + beforeEach(() => { + vi.clearAllMocks() + mockEnterprisePlan.mockResolvedValue(true) + }) + + it('is false whenever the deployment flag is off, whatever the plan says', async () => { + setEnvFlags({ isScimEnabled: false, isHosted: true }) + await expect(isScimEntitledForOrganization('org-1')).resolves.toBe(false) + expect(mockEnterprisePlan).not.toHaveBeenCalled() + }) + + it('is entitled by the flag alone on a self-hosted deployment', async () => { + setEnvFlags({ isScimEnabled: true, isHosted: false }) + mockEnterprisePlan.mockResolvedValue(false) + await expect(isScimEntitledForOrganization('org-1')).resolves.toBe(true) + expect(mockEnterprisePlan).not.toHaveBeenCalled() + }) + + it('requires the enterprise plan on the hosted product', async () => { + setEnvFlags({ isScimEnabled: true, isHosted: true }) + mockEnterprisePlan.mockResolvedValue(false) + await expect(isScimEntitledForOrganization('org-1')).resolves.toBe(false) + mockEnterprisePlan.mockResolvedValue(true) + await expect(isScimEntitledForOrganization('org-1')).resolves.toBe(true) + expect(mockEnterprisePlan).toHaveBeenCalledWith('org-1') + }) +}) diff --git a/apps/sim/lib/scim/identity/end-directory-membership.ts b/apps/sim/lib/scim/identity/end-directory-membership.ts new file mode 100644 index 00000000000..7ca29657988 --- /dev/null +++ b/apps/sim/lib/scim/identity/end-directory-membership.ts @@ -0,0 +1,69 @@ +import { scimConnection, scimUser, scimUserTombstone, user } from '@sim/db/schema' +import { generateId } from '@sim/utils/id' +import { and, eq, inArray } from 'drizzle-orm' +import type { DbOrTx } from '@/lib/db/types' + +/** + * What ending an organization membership means to the directory. + * + * Called from inside the removal transaction, whoever started it — the settings + * UI, an administrator API, or a SCIM DELETE — so a member can never be gone + * while their directory row says otherwise. The row is replaced by a tombstone + * keyed by the directory's external id, which is what lets a later recreate + * relink the same account, and a suspension the directory applied ends with the + * membership it was scoped to. + * + * Imports only schema so the membership primitive can depend on it without a + * module cycle. + */ +export async function endDirectoryMembershipTx( + tx: DbOrTx, + params: { userId: string; organizationId: string } +): Promise<{ removed: number }> { + const rows = await tx + .select({ + id: scimUser.id, + connectionId: scimUser.connectionId, + externalId: scimUser.externalId, + }) + .from(scimUser) + .innerJoin(scimConnection, eq(scimConnection.id, scimUser.connectionId)) + .where( + and( + eq(scimUser.userId, params.userId), + eq(scimConnection.organizationId, params.organizationId) + ) + ) + if (rows.length === 0) return { removed: 0 } + + for (const row of rows) { + if (!row.externalId) continue + await tx + .insert(scimUserTombstone) + .values({ + id: generateId(), + connectionId: row.connectionId, + externalId: row.externalId, + userId: params.userId, + deletedAt: new Date(), + }) + .onConflictDoUpdate({ + target: [scimUserTombstone.connectionId, scimUserTombstone.externalId], + set: { userId: params.userId, deletedAt: new Date() }, + }) + } + + await tx.delete(scimUser).where( + inArray( + scimUser.id, + rows.map((row) => row.id) + ) + ) + + await tx + .update(user) + .set({ suspendedAt: null, suspensionSource: null, updatedAt: new Date() }) + .where(and(eq(user.id, params.userId), eq(user.suspensionSource, 'scim'))) + + return { removed: rows.length } +} diff --git a/apps/sim/lib/scim/projection/auto-map.test.ts b/apps/sim/lib/scim/projection/auto-map.test.ts new file mode 100644 index 00000000000..9da2bc95bef --- /dev/null +++ b/apps/sim/lib/scim/projection/auto-map.test.ts @@ -0,0 +1,78 @@ +/** + * @vitest-environment node + */ +import { db } from '@sim/db' +import { permissionGroup, scimGroupMapping } from '@sim/db/schema' +import { dbChainMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' + +const { mockLeafLock } = vi.hoisted(() => ({ mockLeafLock: vi.fn() })) +vi.mock('@/lib/permission-groups/locks', () => ({ acquirePermissionGroupOrgLock: mockLeafLock })) + +import { autoMapPermissionGroupByName } from '@/lib/scim/projection/auto-map' + +const params = { organizationId: 'org-1', scimGroupId: 'g-1', displayName: 'Engineering' } + +afterAll(resetDbChainMock) + +describe('autoMapPermissionGroupByName', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + }) + + it('removes only automatic mappings to other groups before mapping the match', async () => { + queueTableRows(permissionGroup, [{ id: 'pg-1', membershipMode: 'explicit' }]) + queueTableRows(scimGroupMapping, []) + dbChainMockFns.returning.mockResolvedValueOnce([]) + dbChainMockFns.returning.mockResolvedValueOnce([{ id: 'm-1' }]) + + await expect(autoMapPermissionGroupByName(db, params)).resolves.toBe('mapped') + expect(dbChainMockFns.delete).toHaveBeenCalledWith(scimGroupMapping) + expect(dbChainMockFns.where).toHaveBeenCalledWith( + expect.objectContaining({ + type: 'and', + conditions: expect.arrayContaining([ + { type: 'eq', left: scimGroupMapping.source, right: 'automatic' }, + { type: 'ne', left: scimGroupMapping.permissionGroupId, right: 'pg-1' }, + ]), + }) + ) + expect(dbChainMockFns.values).toHaveBeenCalledWith( + expect.objectContaining({ permissionGroupId: 'pg-1', source: 'automatic' }) + ) + }) + + it('reports unmapped when a rename drops the old automatic mapping and matches nothing', async () => { + queueTableRows(permissionGroup, []) + dbChainMockFns.returning.mockResolvedValueOnce([{ id: 'old' }]) + await expect(autoMapPermissionGroupByName(db, params)).resolves.toBe('unmapped') + expect(dbChainMockFns.insert).not.toHaveBeenCalled() + }) + + it('reports no-match when nothing was mapped and nothing was removed', async () => { + queueTableRows(permissionGroup, []) + dbChainMockFns.returning.mockResolvedValueOnce([]) + await expect(autoMapPermissionGroupByName(db, params)).resolves.toBe('no-match') + }) + + it('takes the permission-group lock before switching an inherit group to explicit', async () => { + queueTableRows(permissionGroup, [{ id: 'pg-1', membershipMode: 'inherit' }]) + queueTableRows(scimGroupMapping, []) + dbChainMockFns.returning.mockResolvedValueOnce([]) + dbChainMockFns.returning.mockResolvedValueOnce([{ id: 'm-1' }]) + await autoMapPermissionGroupByName(db, params) + expect(mockLeafLock).toHaveBeenCalledWith(db, 'org-1', { lockTimeoutAlreadyBounded: true }) + expect(mockLeafLock.mock.invocationCallOrder[0]).toBeLessThan( + dbChainMockFns.update.mock.invocationCallOrder[0] + ) + }) + + it('yields to a concurrent identical mapping instead of failing', async () => { + queueTableRows(permissionGroup, [{ id: 'pg-1', membershipMode: 'explicit' }]) + queueTableRows(scimGroupMapping, []) + dbChainMockFns.returning.mockResolvedValueOnce([]) + dbChainMockFns.returning.mockResolvedValueOnce([]) + await expect(autoMapPermissionGroupByName(db, params)).resolves.toBe('already-mapped') + }) +}) diff --git a/apps/sim/lib/scim/projection/auto-map.ts b/apps/sim/lib/scim/projection/auto-map.ts index 178d3f8ace9..3dbc8ccb987 100644 --- a/apps/sim/lib/scim/projection/auto-map.ts +++ b/apps/sim/lib/scim/projection/auto-map.ts @@ -2,6 +2,7 @@ import { permissionGroup, scimGroupMapping } from '@sim/db/schema' import { generateId } from '@sim/utils/id' import { and, eq, ne } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' +import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' /** * Links a pushed directory group to a permission group of the same name. @@ -64,6 +65,10 @@ export async function autoMapPermissionGroupByName( if (existing) return 'already-mapped' if (target.membershipMode !== 'explicit') { + /** The permission-group leaf lock precedes the row write, as every other writer of this row does. */ + await acquirePermissionGroupOrgLock(tx, params.organizationId, { + lockTimeoutAlreadyBounded: true, + }) await tx .update(permissionGroup) .set({ membershipMode: 'explicit', updatedAt: new Date() }) diff --git a/apps/sim/lib/scim/projection/grants.ts b/apps/sim/lib/scim/projection/grants.ts index f210a6fc493..2b3c1924e8d 100644 --- a/apps/sim/lib/scim/projection/grants.ts +++ b/apps/sim/lib/scim/projection/grants.ts @@ -9,10 +9,19 @@ import { permissionRank } from '@/lib/workspaces/access/workspace-access' export type ProjectionTargetKind = 'permission_group' | 'workspace' | 'org_role' +/** + * How the directory came to hold a grant: it created the access, or it found the + * person already holding it by hand and adopted the record so the mapping is + * satisfied without re-applying it every pass. + */ +export type ProjectionGrantOrigin = 'directory' | 'adopted' + export interface ProjectionGrant { targetKind: ProjectionTargetKind targetId: string permissionType?: PermissionType + /** Present on grants read back from provenance; a desired grant has no origin yet. */ + origin?: ProjectionGrantOrigin } /** One `scim_group_mapping` row the user reaches through a group they belong to. */ diff --git a/apps/sim/lib/scim/projection/reconcile-user.test.ts b/apps/sim/lib/scim/projection/reconcile-user.test.ts new file mode 100644 index 00000000000..e6b9edfb09e --- /dev/null +++ b/apps/sim/lib/scim/projection/reconcile-user.test.ts @@ -0,0 +1,257 @@ +/** + * @vitest-environment node + */ +import { db } from '@sim/db' +import { scimGroupMember, scimProjectionGrant, scimUser, workspace } from '@sim/db/schema' +import { dbChainMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + acquireLocks: vi.fn(), + changeMemberRole: vi.fn(), + addMember: vi.fn(), + removeMember: vi.fn(), + grantWorkspace: vi.fn(), + lowerWorkspace: vi.fn(), + readPermission: vi.fn(), + revokeWorkspace: vi.fn(), +})) + +vi.mock('@/lib/billing/organizations/membership', () => ({ + acquireOrganizationUserMutationLocks: mocks.acquireLocks, +})) +vi.mock('@/lib/organizations/members/lifecycle', () => ({ + changeMemberRoleTx: mocks.changeMemberRole, +})) +vi.mock('@/lib/permission-groups/application/group-membership', () => ({ + addPermissionGroupMemberTx: mocks.addMember, + removePermissionGroupMemberTx: mocks.removeMember, + PermissionGroupNotFoundError: class PermissionGroupNotFoundError extends Error {}, + PermissionGroupScopeConflictError: class PermissionGroupScopeConflictError extends Error { + conflicts: unknown[] = [] + }, +})) +vi.mock('@/lib/workspaces/access/workspace-access', () => ({ + grantWorkspaceAccessTx: mocks.grantWorkspace, + lowerWorkspaceAccessTx: mocks.lowerWorkspace, + readWorkspacePermission: mocks.readPermission, + revokeWorkspaceAccessTx: mocks.revokeWorkspace, + permissionRank: (permission: string) => ({ read: 1, write: 2, admin: 3 })[permission] ?? 0, +})) + +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' + +const params = { + connectionId: 'conn-1', + organizationId: 'org-1', + scimUserId: 'su-1', + settings: {}, +} + +interface Scenario { + current?: Array> + mappings?: Array> + ownedWorkspaces?: string[] +} + +/** Queues the four reads the reconciler makes, in the order it makes them. */ +function stage({ current = [], mappings = [], ownedWorkspaces = ['ws-1'] }: Scenario) { + queueTableRows(scimUser, [{ userId: 'u-1' }]) + queueTableRows(scimProjectionGrant, current) + queueTableRows(scimGroupMember, mappings) + queueTableRows( + workspace, + ownedWorkspaces.map((id) => ({ id })) + ) +} + +const workspaceMapping = (workspaceId: string, permissionType: string) => ({ + targetKind: 'workspace', + workspaceId, + permissionType, + permissionGroupId: null, + role: null, +}) + +const insertedValues = () => + dbChainMockFns.values.mock.calls.map((call) => call[0] as Record) + +afterAll(resetDbChainMock) + +describe('reconcileUserProjection', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + mocks.grantWorkspace.mockResolvedValue('granted') + mocks.lowerWorkspace.mockResolvedValue('lowered') + mocks.readPermission.mockResolvedValue('write') + mocks.revokeWorkspace.mockResolvedValue({ revoked: true, ownershipTransferred: false }) + mocks.addMember.mockResolvedValue('added') + mocks.removeMember.mockResolvedValue('removed') + mocks.changeMemberRole.mockResolvedValue({ changed: true, from: 'member', to: 'admin' }) + }) + + it('takes the organization and user locks before reading any grant', async () => { + stage({ mappings: [workspaceMapping('ws-1', 'write')] }) + await reconcileUserProjection(db, params) + expect(mocks.acquireLocks).toHaveBeenCalledWith(db, { + userId: 'u-1', + organizationIds: ['org-1'], + }) + expect(mocks.acquireLocks.mock.invocationCallOrder[0]).toBeLessThan( + dbChainMockFns.from.mock.invocationCallOrder[1] + ) + }) + + it('records access the directory created as its own', async () => { + stage({ mappings: [workspaceMapping('ws-1', 'write')] }) + const delta = await reconcileUserProjection(db, params) + expect(mocks.grantWorkspace).toHaveBeenCalledWith(db, { + workspaceId: 'ws-1', + userId: 'u-1', + permission: 'write', + }) + expect(insertedValues()[0]).toMatchObject({ targetId: 'ws-1', origin: 'directory' }) + expect(delta.added).toHaveLength(1) + }) + + it('records access the person already held by hand as adopted, and counts no change', async () => { + mocks.grantWorkspace.mockResolvedValue('unchanged') + stage({ mappings: [workspaceMapping('ws-1', 'write')] }) + const delta = await reconcileUserProjection(db, params) + expect(insertedValues()[0]).toMatchObject({ targetId: 'ws-1', origin: 'adopted' }) + expect(delta.added).toHaveLength(0) + }) + + it('plans nothing when the recorded grants already satisfy the mappings', async () => { + stage({ + current: [ + { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'write', origin: 'directory' }, + ], + mappings: [workspaceMapping('ws-1', 'write')], + }) + await reconcileUserProjection(db, params) + expect(mocks.grantWorkspace).not.toHaveBeenCalled() + expect(dbChainMockFns.insert).not.toHaveBeenCalled() + expect(dbChainMockFns.delete).not.toHaveBeenCalled() + }) + + it('forgets an adopted grant without touching the access unless the directory is the source of truth', async () => { + stage({ + current: [ + { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'write', origin: 'adopted' }, + ], + }) + await reconcileUserProjection(db, params) + expect(mocks.revokeWorkspace).not.toHaveBeenCalled() + expect(dbChainMockFns.delete).toHaveBeenCalledWith(scimProjectionGrant) + + vi.clearAllMocks() + resetDbChainMock() + mocks.revokeWorkspace.mockResolvedValue({ revoked: true, ownershipTransferred: false }) + mocks.readPermission.mockResolvedValue('write') + stage({ + current: [ + { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'write', origin: 'adopted' }, + ], + }) + await reconcileUserProjection(db, { ...params, settings: { lockManualMembership: true } }) + expect(mocks.revokeWorkspace).toHaveBeenCalled() + }) + + it('leaves the provenance row in place when access could not be handed on', async () => { + mocks.revokeWorkspace.mockResolvedValue({ + revoked: false, + reason: 'unresolved-workflows', + unresolvedWorkflows: ['wf-1'], + }) + stage({ + current: [ + { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'write', origin: 'directory' }, + ], + }) + const delta = await reconcileUserProjection(db, params) + expect(dbChainMockFns.delete).not.toHaveBeenCalled() + expect(delta.removed).toHaveLength(0) + }) + + it('leaves a manual raise above the directory level alone when unlocked', async () => { + mocks.readPermission.mockResolvedValue('admin') + stage({ + current: [ + { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'write', origin: 'directory' }, + ], + }) + await reconcileUserProjection(db, params) + expect(mocks.revokeWorkspace).not.toHaveBeenCalled() + expect(dbChainMockFns.delete).toHaveBeenCalledWith(scimProjectionGrant) + }) + + it('never reaches into a workspace that left the organization, in either direction', async () => { + stage({ + current: [ + { + targetKind: 'workspace', + targetId: 'ws-gone', + permissionType: 'write', + origin: 'directory', + }, + ], + mappings: [workspaceMapping('ws-gone', 'write'), workspaceMapping('ws-1', 'read')], + ownedWorkspaces: ['ws-1'], + }) + await reconcileUserProjection(db, params) + expect(mocks.grantWorkspace).toHaveBeenCalledTimes(1) + expect(mocks.grantWorkspace.mock.calls[0][1]).toMatchObject({ workspaceId: 'ws-1' }) + expect(mocks.revokeWorkspace).not.toHaveBeenCalled() + expect(dbChainMockFns.delete).toHaveBeenCalledWith(scimProjectionGrant) + }) + + it('re-establishes the desired level when the row is no longer at the level the directory set', async () => { + mocks.lowerWorkspace.mockResolvedValue('unchanged') + stage({ + current: [ + { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'admin', origin: 'directory' }, + ], + mappings: [workspaceMapping('ws-1', 'read')], + }) + await reconcileUserProjection(db, params) + expect(mocks.lowerWorkspace).toHaveBeenCalledWith(db, { + workspaceId: 'ws-1', + userId: 'u-1', + from: 'admin', + to: 'read', + }) + expect(mocks.grantWorkspace).toHaveBeenCalledWith(db, { + workspaceId: 'ws-1', + userId: 'u-1', + permission: 'read', + }) + }) + + it('skips the owner on an organization-role mapping instead of failing the sync', async () => { + mocks.changeMemberRole.mockRejectedValue(new OrchestrationError('conflict', 'owner')) + stage({ + mappings: [ + { + targetKind: 'org_role', + role: 'admin', + workspaceId: null, + permissionType: null, + permissionGroupId: null, + }, + ], + }) + const delta = await reconcileUserProjection(db, params) + expect(dbChainMockFns.insert).not.toHaveBeenCalled() + expect(delta.added).toHaveLength(0) + }) + + it('does nothing for a directory row that no longer exists', async () => { + queueTableRows(scimUser, []) + const delta = await reconcileUserProjection(db, params) + expect(delta).toEqual({ added: [], removed: [], raised: [] }) + expect(mocks.acquireLocks).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/lib/scim/projection/reconcile-user.ts b/apps/sim/lib/scim/projection/reconcile-user.ts index c6ea527a931..bc726f3fc25 100644 --- a/apps/sim/lib/scim/projection/reconcile-user.ts +++ b/apps/sim/lib/scim/projection/reconcile-user.ts @@ -1,6 +1,5 @@ import { db } from '@sim/db' import { - member, type ScimConnectionSettings, scimGroupMapping, scimGroupMember, @@ -25,6 +24,7 @@ import { import { type MappingRow, type ProjectionGrant, + type ProjectionGrantOrigin, type ProjectionTargetKind, planGrantChanges, resolveDesiredGrants, @@ -91,12 +91,14 @@ async function currentGrants(tx: DbOrTx, scimUserId: string): Promise ({ targetKind: row.targetKind as ProjectionTargetKind, targetId: row.targetId, + origin: row.origin as ProjectionGrantOrigin, ...(row.permissionType ? { permissionType: row.permissionType } : {}), })) } @@ -216,6 +218,10 @@ async function setOrganizationRole( * Withdraws one grant. Returns false when the grant must stay in place — the * access could not be handed on — so the provenance row survives and the next * pass retries instead of forgetting. + * + * Adopted access — held by hand before any mapping covered it — is the person's + * own, so the directory only forgets its record of it, unless the organization + * has made the directory the source of truth. */ async function withdrawGrant( tx: DbOrTx, @@ -228,6 +234,7 @@ async function withdrawGrant( } ): Promise { const { grant } = params + if (grant.origin === 'adopted' && !params.lockManualMembership) return true switch (grant.targetKind) { case 'workspace': { /** The workspace belongs to another tenant now; its access is theirs to manage. Forget the grant. */ @@ -324,18 +331,6 @@ export async function reconcileUserProjection( organizationIds: [params.organizationId], }) - /** - * Checked under the lock. A deprovisioning removes the membership and deletes - * the SCIM row in separate commits; a pass that lands between them must not - * grant workspace access to someone who has already left. - */ - const [membership] = await tx - .select({ id: member.id }) - .from(member) - .where(and(eq(member.organizationId, params.organizationId), eq(member.userId, record.userId))) - .limit(1) - if (!membership) return EMPTY_DELTA - const current = await currentGrants(tx, params.scimUserId) const mapped = resolveDesiredGrants( await loadMappingRows(tx, params.scimUserId), @@ -421,13 +416,11 @@ export async function reconcileUserProjection( } if (applied === 'skipped') continue /** - * Access the person already held by hand is theirs, not the directory's. - * Recording it as a directory grant would let a later group change revoke a - * deliberate manual decision. Only when the organization has made the - * directory the source of truth does the directory take ownership of it. + * Every satisfied mapping is recorded, so the next pass plans nothing for + * it. Access the person already held by hand is recorded as adopted: the + * directory knows the mapping is met but does not own the access, and a + * later withdrawal leaves it alone. */ - if (applied === 'unchanged' && !lockManualMembership && !previousPermission) continue - await tx .insert(scimProjectionGrant) .values({ @@ -437,6 +430,7 @@ export async function reconcileUserProjection( targetKind: grant.targetKind, targetId: grant.targetId, permissionType: grant.permissionType ?? null, + origin: applied === 'applied' ? 'directory' : 'adopted', createdAt: new Date(), updatedAt: new Date(), }) @@ -446,9 +440,14 @@ export async function reconcileUserProjection( scimProjectionGrant.targetKind, scimProjectionGrant.targetId, ], - set: { permissionType: grant.permissionType ?? null, updatedAt: new Date() }, + set: { + permissionType: grant.permissionType ?? null, + ...(applied === 'applied' ? { origin: 'directory' } : {}), + updatedAt: new Date(), + }, }) + if (applied !== 'applied') continue if (previousPermission) delta.raised.push(grant) else delta.added.push(grant) } diff --git a/apps/sim/lib/scim/protocol/canonical.ts b/apps/sim/lib/scim/protocol/canonical.ts index 7332bde23e2..8332bbfd422 100644 --- a/apps/sim/lib/scim/protocol/canonical.ts +++ b/apps/sim/lib/scim/protocol/canonical.ts @@ -176,12 +176,13 @@ export function primaryEmail(attributes: ScimUserAttributes): string { * error at the first write rather than a support case later. */ export function assertUserSchemas(schemas: readonly string[]): void { - for (const schema of schemas) { + const declared = stripProviderSchemaMarkers(schemas) + for (const schema of declared) { if (schema !== SCIM_USER_SCHEMA && schema !== SCIM_ENTERPRISE_USER_SCHEMA) { throw invalidValue(`Unsupported User schema ${schema}`) } } - if (!schemas.includes(SCIM_USER_SCHEMA)) { + if (!declared.includes(SCIM_USER_SCHEMA)) { throw invalidValue(`schemas must include ${SCIM_USER_SCHEMA}`) } } diff --git a/apps/sim/lib/scim/protocol/errors.ts b/apps/sim/lib/scim/protocol/errors.ts index 855d626ef06..5704bbbbd2e 100644 --- a/apps/sim/lib/scim/protocol/errors.ts +++ b/apps/sim/lib/scim/protocol/errors.ts @@ -110,8 +110,12 @@ function pgErrorCode(error: unknown): string | undefined { return typeof cause?.code === 'string' ? cause.code : undefined } -function isLockTimeout(error: unknown): boolean { - return pgErrorCode(error) === PG_LOCK_NOT_AVAILABLE +/** PostgreSQL's deadlock code: the loser was rolled back and should simply retry. */ +const PG_DEADLOCK_DETECTED = '40P01' + +function isLockContention(error: unknown): boolean { + const code = pgErrorCode(error) + return code === PG_LOCK_NOT_AVAILABLE || code === PG_DEADLOCK_DETECTED } /** @@ -135,7 +139,7 @@ function isUniqueViolation(error: unknown): boolean { export function toScimError(error: unknown): ScimError { if (error instanceof ScimError) return error - if (isLockTimeout(error)) { + if (isLockContention(error)) { return new ScimError(503, undefined, 'The organization is busy; retry shortly', { 'Retry-After': '5', }) diff --git a/apps/sim/lib/scim/protocol/normalize.ts b/apps/sim/lib/scim/protocol/normalize.ts index de7b8bd13b3..7d22fc0d559 100644 --- a/apps/sim/lib/scim/protocol/normalize.ts +++ b/apps/sim/lib/scim/protocol/normalize.ts @@ -70,12 +70,13 @@ export function normalizeAttributePath(path: string): string { } /** - * Microsoft's classic Group schema marker, sent on `POST /Groups` by older - * provisioning jobs alongside the core Group URN. It carries no attributes and - * is never stored or returned. + * Microsoft's classic schema markers, sent by older provisioning jobs alongside + * the core URNs. They carry no attributes and are never stored or returned. */ export const ENTRA_LEGACY_GROUP_SCHEMA = 'http://schemas.microsoft.com/2006/11/ResourceManagement/ADSCIM/2.0/Group' +const ENTRA_LEGACY_USER_SCHEMA = + 'http://schemas.microsoft.com/2006/11/ResourceManagement/ADSCIM/2.0/User' /** * Restores canonical casing on top-level attribute names. @@ -101,5 +102,7 @@ export function canonicalizeAttributeNames( /** Drops schema URNs that are provider markers rather than real extensions. */ export function stripProviderSchemaMarkers(schemas: readonly string[]): string[] { - return schemas.filter((schema) => schema !== ENTRA_LEGACY_GROUP_SCHEMA) + return schemas.filter( + (schema) => schema !== ENTRA_LEGACY_GROUP_SCHEMA && schema !== ENTRA_LEGACY_USER_SCHEMA + ) } diff --git a/apps/sim/lib/scim/protocol/user-patch.test.ts b/apps/sim/lib/scim/protocol/user-patch.test.ts index 859378a670e..7fe3dba24df 100644 --- a/apps/sim/lib/scim/protocol/user-patch.test.ts +++ b/apps/sim/lib/scim/protocol/user-patch.test.ts @@ -5,7 +5,6 @@ import type { ScimUserAttributes } from '@sim/db/schema' import { describe, expect, it } from 'vitest' import { scimPatchBodySchema } from '@/lib/api/contracts/scim' import { SCIM_PATCH_OP_SCHEMA } from '@/lib/scim/protocol/constants' -import { ScimError } from '@/lib/scim/protocol/errors' import { applyUserPatch } from '@/lib/scim/protocol/user-patch' /** @@ -198,18 +197,34 @@ describe('applyUserPatch', () => { ).toThrowError(expect.objectContaining({ scimType: 'mutability' })) }) - it('refuses an attribute this server does not store', () => { - let raised: unknown - try { - applyUserPatch( - baseUser(), - parseOperations([{ op: 'replace', path: 'nickName', value: 'Ada' }]) - ) - } catch (error) { - raised = error - } - expect(raised).toBeInstanceOf(ScimError) - expect((raised as ScimError).scimType).toBe('invalidPath') + it('keeps attributes this server does not model, as a create would', () => { + const { next, changed } = applyUserPatch( + baseUser(), + parseOperations([ + { op: 'replace', path: 'nickName', value: 'Ada' }, + { op: 'Add', path: 'phoneNumbers[type eq "work"].value', value: '+1 555 0100' }, + { op: 'replace', path: 'addresses[type eq "work"]', value: { locality: 'London' } }, + { op: 'replace', value: { title: 'Analyst', preferredLanguage: 'en-GB' } }, + ]) + ) + expect(changed).toBe(true) + expect(next.extra).toEqual({ + nickName: 'Ada', + title: 'Analyst', + preferredLanguage: 'en-GB', + phoneNumbers: [{ type: 'work', value: '+1 555 0100' }], + addresses: [{ type: 'work', locality: 'London' }], + }) + + const removed = applyUserPatch( + next, + parseOperations([ + { op: 'remove', path: 'phoneNumbers[type eq "work"]' }, + { op: 'remove', path: 'nickName' }, + ]) + ).next + expect(removed.extra?.phoneNumbers).toEqual([]) + expect(removed.extra?.nickName).toBeUndefined() }) it('refuses a non-boolean active value', () => { diff --git a/apps/sim/lib/scim/protocol/user-patch.ts b/apps/sim/lib/scim/protocol/user-patch.ts index 64e62a5e9d1..6b617809309 100644 --- a/apps/sim/lib/scim/protocol/user-patch.ts +++ b/apps/sim/lib/scim/protocol/user-patch.ts @@ -19,9 +19,10 @@ import { * worse than one that refuses, because the directory records a success and stops * retrying. * - * The attribute table is closed. An unrecognized path is an error, never a - * silent drop, so a provider mapping an attribute Sim does not store learns it - * on the first sync. + * Attributes Sim models are applied to the fields it reads; every other + * attribute is kept under `extra`, exactly as a create or replace keeps it, so + * a directory's own attribute mappings round-trip through PATCH as well. Only + * server-owned attributes (`id`, `schemas`, `meta`) are refused. */ export interface UserPatchOutcome { @@ -250,10 +251,68 @@ function applyOperation( default: if (key.startsWith('meta')) throw mutability(`${rawPath} is read-only`) - throw invalidPath(`User PATCH path ${rawPath} is not supported`) + applyExtraOperation(user, op, path, value) } } +/** `attr`, `attr.sub`, or `attr[type eq "x"].sub` on an attribute Sim does not model. */ +const EXTRA_PATH_PATTERN = + /^(?[A-Za-z][\w-]*)(?:\[\s*type\s+eq\s+(?"|')?(?[^"'\]]+)\k?\s*\])?(?:\.(?[A-Za-z][\w-]*))?$/ + +/** + * Applies an operation to an attribute Sim does not model. + * + * A create or replace keeps every attribute the directory sends under `extra` + * so responses round-trip them; a patch must do the same, or Entra's default + * mappings — `title`, `preferredLanguage`, work phone and address — would fail + * every update as a whole, since a PATCH is atomic. The stored shape is the + * wire shape: a plain value, a nested object, or a typed multi-valued list. + */ +function applyExtraOperation( + user: ScimUserAttributes, + op: 'add' | 'replace' | 'remove', + path: string, + value: unknown +): void { + const match = path.match(EXTRA_PATH_PATTERN) + if (!match?.groups) throw invalidPath(`User PATCH path ${path} is not supported`) + const { attribute, type, sub } = match.groups + user.extra ??= {} + + if (!type && !sub) { + if (op === 'remove') user.extra[attribute] = undefined + else user.extra[attribute] = value + return + } + + if (type) { + const list = Array.isArray(user.extra[attribute]) ? [...user.extra[attribute]] : [] + const index = list.findIndex( + (entry) => isRecord(entry) && String(entry.type).toLowerCase() === type.toLowerCase() + ) + if (op === 'remove') { + if (index !== -1) list.splice(index, 1) + } else if (sub) { + const current = index !== -1 && isRecord(list[index]) ? list[index] : { type } + const next = { ...current, [sub]: value } + if (index === -1) list.push(next) + else list[index] = next + } else if (isRecord(value)) { + if (index === -1) list.push({ type, ...value }) + else list[index] = { ...(list[index] as Record), ...value } + } else { + throw invalidValue(`${path} requires an object value`) + } + user.extra[attribute] = list + return + } + + const current = isRecord(user.extra[attribute]) ? { ...user.extra[attribute] } : {} + if (op === 'remove') current[sub as string] = undefined + else current[sub as string] = value + user.extra[attribute] = current +} + /** * Sorts object keys at every depth so serialization is order-independent. * diff --git a/apps/sim/lib/scim/reconcile/job.ts b/apps/sim/lib/scim/reconcile/job.ts index 089f4842bce..87b8e95615f 100644 --- a/apps/sim/lib/scim/reconcile/job.ts +++ b/apps/sim/lib/scim/reconcile/job.ts @@ -33,8 +33,11 @@ const LEASE_TTL_MS = 15 * 60 * 1000 */ const RECONCILE_INTERVAL_MS = 60 * 60 * 1000 -/** Users reconciled per transaction, so no single one holds locks for long. */ -const BATCH_SIZE = 200 +/** + * Users reconciled per transaction. The organization lock is held for the whole + * batch, so it is kept small enough that a tenant's own writes never wait long. + */ +const BATCH_SIZE = 25 export interface ScimReconcileReport { connectionId: string diff --git a/apps/sim/lib/scim/repository/credentials.ts b/apps/sim/lib/scim/repository/credentials.ts new file mode 100644 index 00000000000..94f6c93d286 --- /dev/null +++ b/apps/sim/lib/scim/repository/credentials.ts @@ -0,0 +1,11 @@ +import { scimCredential } from '@sim/db/schema' +import { and, eq, isNull, or, sql } from 'drizzle-orm' + +/** Credentials that still authenticate: not revoked and not past their expiry. */ +export function activeCredentialCondition(connectionId: string) { + return and( + eq(scimCredential.connectionId, connectionId), + isNull(scimCredential.revokedAt), + or(isNull(scimCredential.expiresAt), sql`${scimCredential.expiresAt} > now()`) + ) +} diff --git a/apps/sim/lib/scim/repository/groups.ts b/apps/sim/lib/scim/repository/groups.ts index 664c2cf89d6..ee8ee965ce2 100644 --- a/apps/sim/lib/scim/repository/groups.ts +++ b/apps/sim/lib/scim/repository/groups.ts @@ -1,11 +1,13 @@ import { scimGroup, scimGroupMember, scimUser } from '@sim/db/schema' +import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { and, asc, count, eq, inArray, type SQL, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' -import { invalidValue } from '@/lib/scim/protocol/errors' import type { ScimFilterTerm, ScimGroupFilterField } from '@/lib/scim/protocol/filter' import { buildOrderKey } from '@/lib/scim/repository/users' +const logger = createLogger('ScimGroupRepository') + /** Reads and writes of the provisioned Group table, always anchored to a connection. */ /** What a member is called in a Group response: the same display name the User resource shows. */ @@ -136,24 +138,32 @@ export async function loadGroupMemberIds(tx: DbOrTx, groupId: string): Promise { - if (scimUserIds.length === 0) return +): Promise { + if (scimUserIds.length === 0) return [] const rows = await tx .select({ id: scimUser.id }) .from(scimUser) .where(and(eq(scimUser.connectionId, connectionId), inArray(scimUser.id, scimUserIds))) - if (rows.length !== scimUserIds.length) { - throw invalidValue('One or more Group members are not users of this directory') + const owned = new Set(rows.map((row) => row.id)) + const unknown = scimUserIds.filter((id) => !owned.has(id)) + if (unknown.length > 0) { + logger.warn('Ignored Group members that are not users of this directory', { + connectionId, + unknown: unknown.length, + }) } + return scimUserIds.filter((id) => owned.has(id)) } export async function insertScimGroup( diff --git a/apps/sim/lib/scim/request-log.ts b/apps/sim/lib/scim/request-log.ts index 98f11d8df68..f52dcc86357 100644 --- a/apps/sim/lib/scim/request-log.ts +++ b/apps/sim/lib/scim/request-log.ts @@ -1,11 +1,12 @@ +import type { ScimConnectionPrincipal } from '@sim/auth/principal' import { db } from '@sim/db' import { scimRequestLog } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { truncate } from '@sim/utils/string' import { sql } from 'drizzle-orm' -import type { ScimRequestLogEntry } from '@/lib/api/server/routes/scim-route' import { SCIM_REQUEST_LOG_RETENTION } from '@/lib/scim/protocol/constants' +import type { ScimType } from '@/lib/scim/protocol/errors' const logger = createLogger('ScimRequestLog') @@ -17,6 +18,18 @@ const logger = createLogger('ScimRequestLog') * surfaces only the status. Fire-and-forget, because a logging failure must not * turn a successful provisioning call into an error the directory will retry. */ +/** One protocol request as the activity log records it. */ +export interface ScimRequestLogEntry { + principal: ScimConnectionPrincipal + method: string + path: string + status: number + scimType?: ScimType + detail?: string + userAgent: string | null + durationMs: number +} + export function recordScimRequest(entry: ScimRequestLogEntry): void { void db .insert(scimRequestLog) diff --git a/apps/sim/lib/scim/route.ts b/apps/sim/lib/scim/route.ts index bb3b7f443ea..a184bb03c20 100644 --- a/apps/sim/lib/scim/route.ts +++ b/apps/sim/lib/scim/route.ts @@ -1,7 +1,6 @@ import { createScimRouteBuilder } from '@/lib/api/server/routes/scim-route' -import { getBaseUrl } from '@/lib/core/utils/urls' import { authenticateScimRequest } from '@/lib/scim/authenticate' -import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' +import { scimBaseUrl } from '@/lib/scim/base-url' import { recordScimRequest } from '@/lib/scim/request-log' /** @@ -13,6 +12,6 @@ import { recordScimRequest } from '@/lib/scim/request-log' */ export const defineScimRoute = createScimRouteBuilder({ authenticate: authenticateScimRequest, - baseUrl: () => `${getBaseUrl()}${SCIM_BASE_PATH}`, + baseUrl: scimBaseUrl, recordRequest: recordScimRequest, }) diff --git a/apps/sim/lib/workspaces/access/workspace-access.ts b/apps/sim/lib/workspaces/access/workspace-access.ts index 690458aaab0..26b22e1a95a 100644 --- a/apps/sim/lib/workspaces/access/workspace-access.ts +++ b/apps/sim/lib/workspaces/access/workspace-access.ts @@ -115,7 +115,8 @@ export async function lowerWorkspaceAccessTx( } export type RevokeWorkspaceAccessResult = - | { revoked: true } + /** `ownershipTransferred` is true when the departing user owned the workspace and it moved to the billed account. */ + | { revoked: true; ownershipTransferred: boolean } /** Workflows whose owner could not be reassigned; the access row is left in place. */ | { revoked: false; reason: 'unresolved-workflows'; unresolvedWorkflows: string[] } /** The user owns the workspace and it has no billed account to hand it to. */ @@ -134,8 +135,9 @@ export async function revokeWorkspaceAccessTx( tx: DbOrTx, params: { workspaceId: string; userId: string } ): Promise { + let ownershipTransferred: boolean try { - await transferWorkspaceOwnershipToBilledAccountForMemberRemovalTx({ + ownershipTransferred = await transferWorkspaceOwnershipToBilledAccountForMemberRemovalTx({ tx, workspaceId: params.workspaceId, departingUserId: params.userId, @@ -174,7 +176,7 @@ export async function revokeWorkspaceAccessTx( await revokeWorkspaceCredentialMembershipsTx(tx, params.workspaceId, params.userId) await removeWorkspaceSkillMembershipsTx(tx, params.workspaceId, params.userId) - return { revoked: true } + return { revoked: true, ownershipTransferred } } /** The permission a user currently holds on a workspace, if any. */ diff --git a/packages/db/migrations/0323_scim_provisioning.sql b/packages/db/migrations/0323_scim_provisioning.sql index 0de445d3236..824fff69c97 100644 --- a/packages/db/migrations/0323_scim_provisioning.sql +++ b/packages/db/migrations/0323_scim_provisioning.sql @@ -69,6 +69,7 @@ CREATE TABLE "scim_projection_grant" ( "target_kind" text NOT NULL, "target_id" text NOT NULL, "permission_type" "permission_type", + "origin" text DEFAULT 'directory' NOT NULL, "created_at" timestamp DEFAULT now() NOT NULL, "updated_at" timestamp DEFAULT now() NOT NULL ); @@ -138,6 +139,8 @@ CREATE UNIQUE INDEX "scim_group_connection_display_name_unique" ON "scim_group" CREATE UNIQUE INDEX "scim_group_connection_external_id_unique" ON "scim_group" USING btree ("connection_id","external_id") WHERE external_id is not null;--> statement-breakpoint CREATE INDEX "scim_group_connection_order_idx" ON "scim_group" USING btree ("connection_id","order_key");--> statement-breakpoint CREATE INDEX "scim_group_mapping_group_idx" ON "scim_group_mapping" USING btree ("group_id");--> statement-breakpoint +CREATE INDEX "scim_group_mapping_permission_group_idx" ON "scim_group_mapping" USING btree ("permission_group_id");--> statement-breakpoint +CREATE INDEX "scim_group_mapping_workspace_idx" ON "scim_group_mapping" USING btree ("workspace_id");--> statement-breakpoint CREATE UNIQUE INDEX "scim_group_mapping_group_target_unique" ON "scim_group_mapping" USING btree ("group_id","target_kind",coalesce("permission_group_id", "workspace_id", "role"));--> statement-breakpoint CREATE UNIQUE INDEX "scim_group_member_group_user_unique" ON "scim_group_member" USING btree ("group_id","scim_user_id");--> statement-breakpoint CREATE INDEX "scim_group_member_scim_user_idx" ON "scim_group_member" USING btree ("scim_user_id");--> statement-breakpoint @@ -149,4 +152,5 @@ CREATE UNIQUE INDEX "scim_user_connection_user_name_unique" ON "scim_user" USING CREATE UNIQUE INDEX "scim_user_connection_external_id_unique" ON "scim_user" USING btree ("connection_id","external_id") WHERE external_id is not null;--> statement-breakpoint CREATE INDEX "scim_user_connection_order_idx" ON "scim_user" USING btree ("connection_id","order_key");--> statement-breakpoint CREATE INDEX "scim_user_user_idx" ON "scim_user" USING btree ("user_id");--> statement-breakpoint -CREATE UNIQUE INDEX "scim_user_tombstone_connection_external_id_unique" ON "scim_user_tombstone" USING btree ("connection_id","external_id"); \ No newline at end of file +CREATE UNIQUE INDEX "scim_user_tombstone_connection_external_id_unique" ON "scim_user_tombstone" USING btree ("connection_id","external_id");--> statement-breakpoint +CREATE INDEX "scim_user_tombstone_user_idx" ON "scim_user_tombstone" USING btree ("user_id"); \ No newline at end of file diff --git a/packages/db/migrations/meta/0323_snapshot.json b/packages/db/migrations/meta/0323_snapshot.json index 370a13ee4b2..0c7b47acee8 100644 --- a/packages/db/migrations/meta/0323_snapshot.json +++ b/packages/db/migrations/meta/0323_snapshot.json @@ -1,5 +1,5 @@ { - "id": "cae748d7-69a8-436e-8aac-9dd0f2a894dd", + "id": "642aee37-bc3e-4877-8041-554167b7658b", "prevId": "43e7d6af-94da-4f1c-8bfc-568d5937765c", "version": "7", "dialect": "postgresql", @@ -12856,6 +12856,36 @@ "method": "btree", "with": {} }, + "scim_group_mapping_permission_group_idx": { + "name": "scim_group_mapping_permission_group_idx", + "columns": [ + { + "expression": "permission_group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scim_group_mapping_workspace_idx": { + "name": "scim_group_mapping_workspace_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, "scim_group_mapping_group_target_unique": { "name": "scim_group_mapping_group_target_unique", "columns": [ @@ -13068,6 +13098,13 @@ "primaryKey": false, "notNull": false }, + "origin": { + "name": "origin", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'directory'" + }, "created_at": { "name": "created_at", "type": "timestamp", @@ -13518,6 +13555,21 @@ "concurrently": false, "method": "btree", "with": {} + }, + "scim_user_tombstone_user_idx": { + "name": "scim_user_tombstone_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} } }, "foreignKeys": { diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index bc8f2ff5cc7..29b3ca1e5be 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -2259,7 +2259,7 @@ { "idx": 323, "version": "7", - "when": 1788820417176, + "when": 1788821662396, "tag": "0323_scim_provisioning", "breakpoints": true } diff --git a/packages/db/schema.ts b/packages/db/schema.ts index aa71640bfb9..31561a7d438 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -71,9 +71,9 @@ export const user = pgTable('user', { */ suspendedAt: timestamp('suspended_at'), /** - * Who suspended the account: `scim` for an identity-provider deactivation, - * `admin` for a manual one. SCIM only ever lifts a suspension it applied, so - * an administrator's suspension survives the next directory sync. + * Who suspended the account. Only `scim` exists today; a source only ever + * lifts its own suspension, so a later source cannot have its suspensions + * undone by a directory sync. */ suspensionSource: text('suspension_source'), }) @@ -5854,9 +5854,10 @@ export interface ScimDefaultWorkspaceGrant { /** Administrator-controlled behavior of one organization's SCIM connection. */ export interface ScimConnectionSettings { /** - * Refuse manual invitations, removals, and role edits for users the identity - * provider manages. Out-of-band edits desync the directory, so this defaults - * to on for a new connection and an owner may turn it off. + * Refuse manual invitations, workspace grants, and role edits for users the + * identity provider manages; removals stay possible so an administrator can + * always act in an emergency. Out-of-band edits desync the directory, so this + * defaults to on for a new connection and an owner may turn it off. */ lockManualMembership?: boolean /** @@ -5919,7 +5920,6 @@ export const scimConnection = pgTable( organizationId: text('organization_id') .notNull() .references(() => organization.id, { onDelete: 'cascade' }), - /** The SSO provider this directory pairs with, shown in settings. */ /** `active` or `disabled`. Disabling refuses every credential immediately. */ status: text('status').notNull().default('active'), settings: jsonb('settings').$type().notNull().default({}), @@ -6045,6 +6045,7 @@ export const scimUserTombstone = pgTable( table.connectionId, table.externalId ), + userIdx: index('scim_user_tombstone_user_idx').on(table.userId), }) ) @@ -6140,6 +6141,10 @@ export const scimGroupMapping = pgTable( }, (table) => ({ groupIdx: index('scim_group_mapping_group_idx').on(table.groupId), + permissionGroupIdx: index('scim_group_mapping_permission_group_idx').on( + table.permissionGroupId + ), + workspaceIdx: index('scim_group_mapping_workspace_idx').on(table.workspaceId), /** * One mapping per group and target. `coalesce` collapses the three mutually * exclusive target columns into the single value that identifies the target, @@ -6184,6 +6189,13 @@ export const scimProjectionGrant = pgTable( targetId: text('target_id').notNull(), /** The permission SCIM set, so a later manual upgrade stays detectable. */ permissionType: permissionTypeEnum('permission_type'), + /** + * `directory` when the directory created the access; `adopted` when the + * person already held it by hand and a mapping merely covers it. Adopted + * access is left in place when the mapping goes away, unless the directory + * is the organization's source of truth. + */ + origin: text('origin').notNull().default('directory'), createdAt: timestamp('created_at').notNull().defaultNow(), updatedAt: timestamp('updated_at').notNull().defaultNow(), }, diff --git a/packages/testing/src/mocks/schema.mock.ts b/packages/testing/src/mocks/schema.mock.ts index 8f936f01a67..716dea92098 100644 --- a/packages/testing/src/mocks/schema.mock.ts +++ b/packages/testing/src/mocks/schema.mock.ts @@ -1244,6 +1244,7 @@ export const schemaMock = { targetKind: 'scimProjectionGrant.targetKind', targetId: 'scimProjectionGrant.targetId', permissionType: 'scimProjectionGrant.permissionType', + origin: 'scimProjectionGrant.origin', createdAt: 'scimProjectionGrant.createdAt', updatedAt: 'scimProjectionGrant.updatedAt', }, From 0bdc1204a8303286d03f7566d8a7694900c354cb Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 16:22:05 -0700 Subject: [PATCH 22/31] fix(auth): complete OAuth integration and lifecycle guarantees --- .github/workflows/test-build.yml | 74 ++++ .../docs/api-reference/authentication.mdx | 27 +- .../docs/api-reference/getting-started.mdx | 2 +- apps/docs/openapi-v2-billing.json | 10 +- apps/docs/openapi-v2-files-audit.json | 118 +++-- apps/docs/openapi-v2-knowledge.json | 178 ++++++-- apps/docs/openapi-v2-logs.json | 14 +- apps/docs/openapi-v2-resources.json | 206 ++++++--- apps/docs/openapi-v2-tables.json | 214 ++++++--- apps/docs/openapi-v2-workflows.json | 154 +++++-- apps/sim/app/(auth)/auth-redirect.ts | 11 + .../oauth/consent/consent-view.test.tsx | 120 +++++ .../app/(auth)/oauth/consent/consent-view.tsx | 95 ++-- apps/sim/app/(auth)/oauth/consent/loading.tsx | 38 +- apps/sim/app/(auth)/oauth/consent/page.tsx | 19 +- .../app/(auth)/oauth/sign-in/route.test.ts | 98 ++++- apps/sim/app/(auth)/oauth/sign-in/route.ts | 6 +- apps/sim/app/api/auth/[...all]/route.test.ts | 60 +-- apps/sim/app/api/auth/[...all]/route.ts | 72 +-- .../auth/oauth2/token/route.postgres.test.ts | 26 ++ .../app/api/users/me/authorized-apps/route.ts | 11 +- apps/sim/app/api/v2/chat-deployments/route.ts | 3 +- .../app/api/v2/files/bulk-download/route.ts | 3 +- apps/sim/app/api/v2/knowledge/search/route.ts | 1 - .../mcp-servers/[mcpServerId]/tools/route.ts | 1 - .../v2/tables/[tableId]/query/count/route.ts | 1 - .../api/v2/tables/[tableId]/query/route.ts | 1 - .../v2/tables/[tableId]/rows/search/route.ts | 1 - .../[workflowId]/deployments/chat/route.ts | 2 +- .../settings/[section]/settings.tsx | 6 + .../authorized-apps/authorized-apps.tsx | 55 ++- .../[workspaceId]/settings/navigation.test.ts | 2 + .../background/cleanup-oauth-tokens.test.ts | 33 +- apps/sim/background/cleanup-oauth-tokens.ts | 16 +- .../components/settings/navigation.test.ts | 1 + apps/sim/components/settings/navigation.ts | 7 + .../sim/hooks/queries/oauth-provider.test.tsx | 173 ++++++++ apps/sim/hooks/queries/oauth-provider.ts | 34 +- apps/sim/lib/api/application/operations.ts | 3 +- .../read-v2-api-capabilities.test.ts | 18 + apps/sim/lib/api/contracts/user.ts | 18 +- .../lib/api/contracts/v2/openapi/billing.ts | 3 + .../api/contracts/v2/openapi/files-audit.ts | 31 ++ .../contracts/v2/openapi/knowledge-chunks.ts | 7 + .../contracts/v2/openapi/knowledge-tags.ts | 8 + .../lib/api/contracts/v2/openapi/knowledge.ts | 32 ++ apps/sim/lib/api/contracts/v2/openapi/logs.ts | 4 + .../lib/api/contracts/v2/openapi/resources.ts | 61 +++ .../lib/api/contracts/v2/openapi/shared.ts | 8 +- .../lib/api/contracts/v2/openapi/tables.ts | 54 +++ .../lib/api/contracts/v2/openapi/workflows.ts | 44 +- apps/sim/lib/api/contracts/workspaces.ts | 1 - apps/sim/lib/api/openapi/types.ts | 3 + .../api/server/routes/v2-json-route.test.ts | 54 +-- .../lib/api/server/routes/v2-json-route.ts | 125 +----- .../application/audit-log-use-cases.test.ts | 18 + .../authorized-audit-log-use-case.ts | 2 + .../lib/audit-logs/application/operations.ts | 11 +- .../oauth-provider-lifecycle.postgres.test.ts | 412 ++++++++++++++++++ apps/sim/lib/auth/oauth-provider.ts | 2 +- apps/sim/lib/auth/sim-auth-adapter.test.ts | 76 ++++ .../authorized-billing-read-use-case.ts | 2 + .../application/billing-use-cases.test.ts | 19 + .../sim/lib/billing/application/operations.ts | 11 +- .../sim/lib/catalog/application/operations.ts | 7 +- .../application/operations.ts | 7 +- .../sim/lib/copilot/application/operations.ts | 3 +- apps/sim/lib/core/application/index.ts | 9 +- .../application/oauth-authorization.test.ts | 109 +++++ .../core/application/oauth-authorization.ts | 34 ++ apps/sim/lib/core/application/operation.ts | 29 +- .../workspace-authorization.test.ts | 13 +- .../application/workspace-authorization.ts | 62 +-- .../core/application/workspace-operation.ts | 14 +- .../lib/core/config/deployment-shape.test.ts | 1 - apps/sim/lib/core/config/deployment-shape.ts | 2 - .../application/operations.ts | 2 +- .../lib/credentials/application/operations.ts | 16 +- .../custom-tools/application/operations.ts | 11 +- .../application/operations.ts | 2 +- .../lib/knowledge/application/operations.ts | 54 ++- apps/sim/lib/logs/application/operations.ts | 5 +- apps/sim/lib/mcp/application/operations.ts | 18 +- apps/sim/lib/memory/application/operations.ts | 2 +- .../application/operations.ts | 2 +- .../lib/sandboxes/application/operations.ts | 7 +- .../sim/lib/secrets/application/operations.ts | 7 +- .../lib/selectors/application/operations.ts | 2 +- apps/sim/lib/skills/application/operations.ts | 12 +- apps/sim/lib/table/application/operations.ts | 29 +- .../tool-execution/application/operations.ts | 3 +- .../users/application/authorized-apps.test.ts | 114 ++++- .../lib/users/application/authorized-apps.ts | 88 +++- apps/sim/lib/users/constants.ts | 1 + .../lib/workflows/application/operations.ts | 38 +- .../workspace-files/application/operations.ts | 27 +- .../lib/workspaces/application/operations.ts | 5 +- apps/sim/proxy.ts | 17 +- bun.lock | 1 + .../db/migrations/0323_oauth_provider.sql | 136 +----- packages/db/oauth-provider-lifecycle.ts | 152 +++++++ packages/db/package.json | 2 +- ...rations-paused-billing-attribution.test.ts | 1 + ...0012_reconcile_oauth_provider_lifecycle.ts | 8 + packages/db/script-migrations/index.ts | 2 + .../db/scripts/reconcile-oauth-provider.ts | 20 + packages/db/vitest.config.ts | 1 + packages/sim-cli/THIRD_PARTY_LICENSES | 42 ++ packages/sim-cli/package.json | 1 + packages/sim-cli/src/auth/oauth-flow.test.ts | 56 ++- packages/sim-cli/src/auth/oauth-flow.ts | 51 ++- .../sim-cli/src/auth/refresh.process.test.ts | 223 ++++++++++ scripts/check-principal-kind-parity.test.ts | 95 ++-- scripts/check-principal-kind-parity.ts | 156 ++++--- scripts/openapi/documents.test.ts | 94 ++++ scripts/openapi/generator.test.ts | 11 + scripts/openapi/generator.ts | 17 +- 117 files changed, 3728 insertions(+), 1013 deletions(-) create mode 100644 apps/sim/app/(auth)/oauth/consent/consent-view.test.tsx create mode 100644 apps/sim/hooks/queries/oauth-provider.test.tsx create mode 100644 apps/sim/lib/auth/oauth-provider-lifecycle.postgres.test.ts create mode 100644 apps/sim/lib/auth/sim-auth-adapter.test.ts create mode 100644 apps/sim/lib/core/application/oauth-authorization.test.ts create mode 100644 apps/sim/lib/core/application/oauth-authorization.ts create mode 100644 apps/sim/lib/users/constants.ts create mode 100644 packages/db/oauth-provider-lifecycle.ts create mode 100644 packages/db/script-migrations/0012_reconcile_oauth_provider_lifecycle.ts create mode 100644 packages/db/scripts/reconcile-oauth-provider.ts create mode 100644 packages/sim-cli/src/auth/refresh.process.test.ts diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index c5028b877c1..83017381cd2 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -8,6 +8,80 @@ permissions: contents: read jobs: + oauth-postgres: + name: OAuth PostgreSQL (${{ matrix.provision }}) + runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }} + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + provision: [push, migrate] + services: + postgres: + image: pgvector/pgvector:pg17 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: sim_oauth + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U postgres -d sim_oauth" + --health-interval 5s + --health-timeout 5s + --health-retries 10 + env: + DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_oauth + OAUTH_TOKEN_FAMILY_TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_oauth + BETTER_AUTH_SECRET: oauth-postgres-ci-secret-at-least-32-characters + OAUTH_PROVIDER_ENABLED: 'true' + NEXT_PUBLIC_APP_URL: https://test.sim.ai + ENCRYPTION_KEY: '0000000000000000000000000000000000000000000000000000000000000000' + + steps: + - name: Checkout code + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + + - name: Setup Bun + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 + with: + bun-version: 1.4.1 + + - name: Setup Node + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + with: + node-version: 24 + + - name: Mount Bun cache + uses: ./.github/actions/cache-mount + with: + provider: ${{ vars.CI_PROVIDER }} + key: ${{ github.repository }}-bun-cache-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }} + path: ~/.bun/install/cache + + - name: Install dependencies + run: bun install --frozen-lockfile --ignore-scripts + + - name: Provision a fresh database through the supported command + working-directory: packages/db + run: | + bun -e 'import postgres from "postgres"; const sql = postgres(process.env.DATABASE_URL); for (const extension of ["vector", "btree_gin", "pg_trgm"]) await sql`CREATE EXTENSION IF NOT EXISTS ${sql(extension)}`; await sql.end()' + bun run db:${{ matrix.provision }} + + - name: Verify migration replay is a no-op + if: matrix.provision == 'migrate' + working-directory: packages/db + run: bun run db:migrate + + - name: Verify provider issuance and token lifecycle in PostgreSQL + working-directory: apps/sim + run: >- + bunx vitest run + lib/auth/oauth-token-family.postgres.test.ts + lib/auth/oauth-provider-lifecycle.postgres.test.ts + app/api/auth/oauth2/token/route.postgres.test.ts + lib/auth/sim-auth-adapter.test.ts + test-build: name: Lint and Test runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }} diff --git a/apps/docs/content/docs/api-reference/authentication.mdx b/apps/docs/content/docs/api-reference/authentication.mdx index 6b8c50fef50..bf7fdab9265 100644 --- a/apps/docs/content/docs/api-reference/authentication.mdx +++ b/apps/docs/content/docs/api-reference/authentication.mdx @@ -1,12 +1,14 @@ --- title: Authentication -description: API key types, generation, and how to authenticate requests +description: Authenticate with API keys or delegated OAuth access tokens --- import { Callout } from 'fumadocs-ui/components/callout' import { Tab, Tabs } from 'fumadocs-ui/components/tabs' -To access the Sim API, you need an API key. Sim supports two types of API keys — **personal keys** and **workspace keys** — each with different billing and access behaviors. +The Sim API accepts API keys and, when enabled by your deployment, OAuth access tokens. API keys support automation and the SDKs. OAuth lets the CLI and registered applications act on your behalf with permissions you approve. + +Sim supports two types of API keys — **personal keys** and **workspace keys** — each with different billing and access behaviors. ## Key Types @@ -87,6 +89,27 @@ API keys authenticate access to: - **MCP servers** — authenticate connections to deployed MCP servers - **SDKs** — the [Python](/api-reference/python) and [TypeScript](/api-reference/typescript) SDKs use API keys for all operations +## OAuth access tokens + +Use `sim login` to authorize the CLI in your browser, or `sim login --read-only` to request read access. The CLI stores the login locally and refreshes access tokens automatically. See [CLI authentication](/cli/authentication) for profiles, sign-in, and sign-out. + +Registered OAuth applications send access tokens in the `Authorization` header: + +```bash +curl https://www.sim.ai/api/v2/workspaces \ + -H "Authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +| Scope | Access | +| --- | --- | +| `api:read` | Read operations, including searches sent as POST requests | +| `api:write` | Mutations and execution, including operations that can start external work | +| `offline_access` | Refresh tokens for continued access after the access token expires | + +Scopes limit what an application may do; your current workspace membership and role still apply. Each endpoint documents its required scope. Some GET endpoints that perform external discovery require `api:write`, so HTTP method alone does not determine the permission. + +Manage grants in **Settings** → **Authorized apps**. Revoking an application signs out all of its logins. `sim logout` revokes the current CLI login and removes it from your machine. The Python and TypeScript SDKs currently use API keys; they do not manage OAuth sign-in or refresh tokens. + ## Security - Keys use the `sk-sim-` prefix and are encrypted at rest diff --git a/apps/docs/content/docs/api-reference/getting-started.mdx b/apps/docs/content/docs/api-reference/getting-started.mdx index db66a4fd9e6..ad4e5561b64 100644 --- a/apps/docs/content/docs/api-reference/getting-started.mdx +++ b/apps/docs/content/docs/api-reference/getting-started.mdx @@ -26,7 +26,7 @@ Download the [complete OpenAPI 3.1 specification](/openapi.json) as JSON for cli ### Get your API key -Go to the Sim platform and navigate to **Settings**, then go to **Sim Keys** and click **Create**. See [Authentication](/api-reference/authentication) for details on key types. +Open **Account settings** → **Sim API keys** to create a personal key, or **Workspace settings** → **Sim API keys** for a workspace key. These examples and the SDKs use API keys; the CLI also supports browser sign-in with `sim login`. See [Authentication](/api-reference/authentication) for key types and OAuth permissions. diff --git a/apps/docs/openapi-v2-billing.json b/apps/docs/openapi-v2-billing.json index c9c9dd1262c..44329cd3cd4 100644 --- a/apps/docs/openapi-v2-billing.json +++ b/apps/docs/openapi-v2-billing.json @@ -39,7 +39,9 @@ "get": { "operationId": "getBillingStatus", "summary": "Get Billing Status", - "description": "Return the current plan, billing standing, credit allowance, and storage quota. `credits` and `storage` report the payer's pooled allowances and are null unless the caller can manage that payer's billing; they are always null for a workspace API key. Billing history lives at `GET /api/v2/billing/logs`.", + "description": "Return the current plan, billing standing, credit allowance, and storage quota. `credits` and `storage` report the payer's pooled allowances and are null unless the caller can manage that payer's billing; they are always null for a workspace API key. Billing history lives at `GET /api/v2/billing/logs`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "billing.status.read", + "x-oauth-scope": "api:read", "tags": ["Billing"], "parameters": [ { @@ -105,7 +107,9 @@ "get": { "operationId": "listBillingLogs", "summary": "List Billing Logs", - "description": "List the credit-denominated billing ledger with source filtering and opaque cursor pagination. `period` defaults to `30d`, so an unqualified request covers only the last 30 days: paginating to `nextCursor: null` exhausts that window, not the whole ledger. An inverted custom window is a 400 rather than an empty page.", + "description": "List the credit-denominated billing ledger with source filtering and opaque cursor pagination. `period` defaults to `30d`, so an unqualified request covers only the last 30 days: paginating to `nextCursor: null` exhausts that window, not the whole ledger. An inverted custom window is a 400 rather than an empty page.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "billing.logs.list", + "x-oauth-scope": "api:read", "tags": ["Billing"], "parameters": [ { @@ -262,7 +266,7 @@ "type": "http", "scheme": "bearer", "bearerFormat": "OAuth 2.0 access token", - "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. The token must carry the scope required by the operation." + "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. Each operation declares its required scope: api:read permits reads and searches; api:write also permits changes and execution and implies api:read. Scope requirements follow the application operation, independent of HTTP method or workspace role." } }, "headers": { diff --git a/apps/docs/openapi-v2-files-audit.json b/apps/docs/openapi-v2-files-audit.json index 38439ca50e9..19c39163387 100644 --- a/apps/docs/openapi-v2-files-audit.json +++ b/apps/docs/openapi-v2-files-audit.json @@ -43,7 +43,9 @@ "get": { "operationId": "listFiles", "summary": "List Files", - "description": "List workspace files with search, sorting, folder filtering, and opaque cursor pagination. Defaults to active files; pass `scope=archived` to page over soft-deleted ones. A workspace folder tree over 10,000 folders is a `413`.", + "description": "List workspace files with search, sorting, folder filtering, and opaque cursor pagination. Defaults to active files; pass `scope=archived` to page over soft-deleted ones. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "files.list", + "x-oauth-scope": "api:read", "tags": ["Files"], "parameters": [ { @@ -214,7 +216,9 @@ "post": { "operationId": "createFile", "summary": "Create File", - "description": "Create a workspace file from inline UTF-8 or base64 content. Use an upload session for streamed or larger files.", + "description": "Create a workspace file from inline UTF-8 or base64 content. Use an upload session for streamed or larger files.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.create", + "x-oauth-scope": "api:write", "tags": ["Files"], "requestBody": { "required": true, @@ -286,7 +290,9 @@ "post": { "operationId": "createFileUpload", "summary": "Create File Upload", - "description": "Create a resumable upload session and receive either a signed PUT URL or multipart instructions.", + "description": "Create a resumable upload session and receive either a signed PUT URL or multipart instructions.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.upload.create", + "x-oauth-scope": "api:write", "tags": ["Files"], "requestBody": { "required": true, @@ -355,7 +361,9 @@ "get": { "operationId": "getFileUpload", "summary": "Get File Upload", - "description": "Read an upload session's current state — whether it is still accepting bytes, has finalized into a file, or has failed. Use it to decide whether an interrupted transfer can be resumed or should be abandoned. Like every other upload control leg it requires the signed upload token, and is re-authorized against the workspace on each call.", + "description": "Read an upload session's current state — whether it is still accepting bytes, has finalized into a file, or has failed. Use it to decide whether an interrupted transfer can be resumed or should be abandoned. Like every other upload control leg it requires the signed upload token, and is re-authorized against the workspace on each call.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "files.upload.read", + "x-oauth-scope": "api:read", "tags": ["Files"], "parameters": [ { @@ -441,7 +449,9 @@ "delete": { "operationId": "abortFileUpload", "summary": "Abort File Upload", - "description": "Abort an active upload session and release provider-side multipart state.", + "description": "Abort an active upload session and release provider-side multipart state.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.upload.cancel", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -532,7 +542,9 @@ "post": { "operationId": "createFileUploadPartUrls", "summary": "Create File Upload Part URLs", - "description": "Create signed URLs for a bounded set of multipart upload part numbers.", + "description": "Create signed URLs for a bounded set of multipart upload part numbers.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.upload.parts", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -640,7 +652,9 @@ "post": { "operationId": "completeFileUpload", "summary": "Complete File Upload", - "description": "Finalize uploaded bytes, verify provider state, and begin atomic workspace-file registration.", + "description": "Finalize uploaded bytes, verify provider state, and begin atomic workspace-file registration.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.upload.complete", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -731,7 +745,9 @@ "get": { "operationId": "readFileText", "summary": "Read File Text", - "description": "Extract text from stored file bytes without modifying the file; use `POST /api/v2/files/{fileId}/unzip` to unpack archives. Unsupported types return `400` and point to raw-byte download; generated documents still compiling return `409`, and files above the extraction ceiling return `413`. `degraded: true` means extraction was incomplete or synthesized from raw bytes and is not authoritative; legacy `.doc` and `.ppt` extraction may return this best-effort result. `truncated` means a parser limit stopped extraction.", + "description": "Extract text from stored file bytes without modifying the file; use `POST /api/v2/files/{fileId}/unzip` to unpack archives. Unsupported types return `400` and point to raw-byte download; generated documents still compiling return `409`, and files above the extraction ceiling return `413`. `degraded: true` means extraction was incomplete or synthesized from raw bytes and is not authoritative; legacy `.doc` and `.ppt` extraction may return this best-effort result. `truncated` means a parser limit stopped extraction.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "files.read_content", + "x-oauth-scope": "api:read", "tags": ["Files"], "parameters": [ { @@ -852,7 +868,9 @@ "get": { "operationId": "bulkDownloadFiles", "summary": "Bulk Download Files", - "description": "Stream files as a zip. Provide comma-separated file IDs and folder paths; folders expand recursively, and unmatched paths are rejected. Each parameter and the resolved selection allow at most 100 entries, with bytes bounded. Oversized selections return `400`; downloads record an audit event. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only. `HEAD` omits `Content-Length`; use file metadata to size downloads.", + "description": "Stream files as a zip. Provide comma-separated file IDs and folder paths; folders expand recursively, and unmatched paths are rejected. Each parameter and the resolved selection allow at most 100 entries, with bytes bounded. Oversized selections return `400`; downloads record an audit event. `HEAD` skips the effect but uses `GET` authorization, returning `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; confirms access only. `HEAD` omits `Content-Length`; use file metadata to size downloads.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "files.download", + "x-oauth-scope": "api:read", "tags": ["Files"], "parameters": [ { @@ -948,7 +966,9 @@ "post": { "operationId": "unzipFile", "summary": "Unzip File", - "description": "Unzip a `.zip` archive into a new sibling folder, creating workspace files and returning only counts and the destination path. Use `GET /api/v2/files/{fileId}/text` to read text; page `GET /api/v2/files?folderPath=...` to inspect unpacked files. Large archives can take minutes. Only one unzip per archive may run; concurrent attempts return `409`. Archives above the size ceiling or operations exceeding their time budget return `413`.", + "description": "Unzip a `.zip` archive into a new sibling folder, creating workspace files and returning only counts and the destination path. Use `GET /api/v2/files/{fileId}/text` to read text; page `GET /api/v2/files?folderPath=...` to inspect unpacked files. Large archives can take minutes. Only one unzip per archive may run; concurrent attempts return `409`. Archives above the size ceiling or operations exceeding their time budget return `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.extract_archive", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -1035,7 +1055,9 @@ "get": { "operationId": "downloadFile", "summary": "Download File", - "description": "Download current file bytes. Generated documents use compiled artifacts, returning `409` while compiling and `413` above the rendered-size ceiling. Downloading records an audit event. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only. `HEAD` omits `Content-Length`; use file metadata to size downloads.", + "description": "Download current file bytes. Generated documents use compiled artifacts, returning `409` while compiling and `413` above the rendered-size ceiling. Downloading records an audit event. `HEAD` skips the effect but uses `GET` authorization, returning `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; confirms access only. `HEAD` omits `Content-Length`; use file metadata to size downloads.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "files.download", + "x-oauth-scope": "api:read", "tags": ["Files"], "parameters": [ { @@ -1128,7 +1150,9 @@ "delete": { "operationId": "deleteFile", "summary": "Delete File", - "description": "Archive a workspace file. This is a soft delete: the file stops appearing in the default listing and is no longer readable through the API, but its stored bytes are never removed. Archiving an already-archived file is a `404`, not a no-op. List archived files with `GET /files?scope=archived`, and reverse the delete with `POST /files/{fileId}/restore`.", + "description": "Archive a workspace file. This is a soft delete: the file stops appearing in the default listing and is no longer readable through the API, but its stored bytes are never removed. Archiving an already-archived file is a `404`, not a no-op. List archived files with `GET /files?scope=archived`, and reverse the delete with `POST /files/{fileId}/restore`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.delete", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -1205,7 +1229,9 @@ "patch": { "operationId": "renameFile", "summary": "Rename File", - "description": "Rename a workspace file without changing its containing folder.", + "description": "Rename a workspace file without changing its containing folder.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.rename", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -1292,7 +1318,9 @@ "post": { "operationId": "restoreFile", "summary": "Restore File", - "description": "Reverse a soft delete and return the file to the workspace. Not a pure undo: the file comes back at the workspace root, and gains a `_restored` suffix when another file there already holds its name, so read `folderPath` and `name` off the response. Restoring an already-active file returns it unchanged, so a retry is safe. An archived workspace is a `400`, and a name the restore could not free is a `409`.", + "description": "Reverse a soft delete and return the file to the workspace. Not a pure undo: the file comes back at the workspace root, and gains a `_restored` suffix when another file there already holds its name, so read `folderPath` and `name` off the response. Restoring an already-active file returns it unchanged, so a retry is safe. An archived workspace is a `400`, and a name the restore could not free is a `409`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.restore", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -1379,7 +1407,9 @@ "get": { "operationId": "getFile", "summary": "Get File Metadata", - "description": "Return file metadata together with the nullable current public-share state.", + "description": "Return file metadata together with the nullable current public-share state.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "files.read_metadata", + "x-oauth-scope": "api:read", "tags": ["Files"], "parameters": [ { @@ -1470,7 +1500,9 @@ "get": { "operationId": "listAuditLogs", "summary": "List Audit Logs", - "description": "List an organization audit trail with filters and opaque cursor pagination. Requires an Enterprise subscription and organization admin or owner access. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "List an organization audit trail with filters and opaque cursor pagination. Requires an Enterprise subscription and organization admin or owner access. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "audit_logs.list", + "x-oauth-scope": "api:read", "tags": ["Audit Logs"], "parameters": [ { @@ -1644,7 +1676,9 @@ "get": { "operationId": "getAuditLog", "summary": "Get Audit Log", - "description": "Return one organization audit-log entry. Requires an Enterprise subscription and organization admin or owner access. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Return one organization audit-log entry. Requires an Enterprise subscription and organization admin or owner access. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "audit_logs.read_detail", + "x-oauth-scope": "api:read", "tags": ["Audit Logs"], "parameters": [ { @@ -1720,7 +1754,9 @@ "post": { "operationId": "moveFileItems", "summary": "Move Files", - "description": "Move up to 1,000 files to a canonical folder path or the workspace root.", + "description": "Move up to 1,000 files to a canonical folder path or the workspace root.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.move", + "x-oauth-scope": "api:write", "tags": ["Files"], "requestBody": { "required": true, @@ -1792,7 +1828,9 @@ "get": { "operationId": "getFileShare", "summary": "Get File Share", - "description": "Return the nullable current public-share configuration for a file. A file that has never been shared returns `data: null` rather than a 404; a share that was created and later disabled is still returned, with `isActive: false`.", + "description": "Return the nullable current public-share configuration for a file. A file that has never been shared returns `data: null` rather than a 404; a share that was created and later disabled is still returned, with `isActive: false`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "files.share.read", + "x-oauth-scope": "api:read", "tags": ["Files"], "parameters": [ { @@ -1869,7 +1907,9 @@ "patch": { "operationId": "upsertFileShare", "summary": "Enable or Disable File Share", - "description": "Create or partially update a server-tokenized public share. Only `isActive` is required; each other field states what enabling a mode does to it. Enabling any mode other than `public` on a file that has never been shared must carry its credential in the same request. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Create or partially update a server-tokenized public share. Only `isActive` is required; each other field states what enabling a mode does to it. Enabling any mode other than `public` on a file that has never been shared must carry its credential in the same request. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.share.update", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -1953,7 +1993,9 @@ "patch": { "operationId": "editFileContent", "summary": "Edit File Content", - "description": "Modify part of a text file; `PUT` on this path replaces the whole file. `search_replace` requires one exact match unless `replaceAll` is true. The anchored modes match trimmed complete lines: replacement preserves both boundaries, insertion preserves its anchor, and deletion removes the start but preserves the end. Use `occurrence` for repeated anchors. Non-UTF-8 files return `400`. Concurrent writes return `409`; re-read before retrying.", + "description": "Modify part of a text file; `PUT` on this path replaces the whole file. `search_replace` requires one exact match unless `replaceAll` is true. The anchored modes match trimmed complete lines: replacement preserves both boundaries, insertion preserves its anchor, and deletion removes the start but preserves the end. Use `occurrence` for repeated anchors. Non-UTF-8 files return `400`. Concurrent writes return `409`; re-read before retrying.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.update_content", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -2041,7 +2083,9 @@ "put": { "operationId": "updateFileContent", "summary": "Replace File Content", - "description": "Replace the complete contents of an existing file from UTF-8 or base64 input.", + "description": "Replace the complete contents of an existing file from UTF-8 or base64 input.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.update_content", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -2125,7 +2169,9 @@ "get": { "operationId": "searchFileContent", "summary": "Search File Content", - "description": "Search indexed text in active workspace files and return matching lines with file IDs and line numbers. `folderPaths` limits both results and the coverage reported by `complete` and `indexStatus`. Because indexing is asynchronous, a missing term is unknown rather than absent when `complete` is false. `truncated` means additional matches exist beyond `maxResults`.", + "description": "Search indexed text in active workspace files and return matching lines with file IDs and line numbers. `folderPaths` limits both results and the coverage reported by `complete` and `indexStatus`. Because indexing is asynchronous, a missing term is unknown rather than absent when `complete` is false. `truncated` means additional matches exist beyond `maxResults`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "files.search_content", + "x-oauth-scope": "api:read", "tags": ["Files"], "parameters": [ { @@ -2265,7 +2311,9 @@ "post": { "operationId": "bulkDeleteFiles", "summary": "Delete Files", - "description": "Delete up to 1,000 workspace files in one operation. This is the same soft delete as `DELETE /api/v2/files/{fileId}`: files are archived, not erased, and `POST /api/v2/files/{fileId}/restore` reverses each one.", + "description": "Delete up to 1,000 workspace files in one operation. This is the same soft delete as `DELETE /api/v2/files/{fileId}`: files are archived, not erased, and `POST /api/v2/files/{fileId}/restore` reverses each one.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.delete", + "x-oauth-scope": "api:write", "tags": ["Files"], "requestBody": { "required": true, @@ -2334,7 +2382,9 @@ "get": { "operationId": "listFilesFolders", "summary": "List Folders", - "description": "List workspace file folders with optional parent-path filtering and sorting. Pass `scope=archived` to list folders a recursive `DELETE` soft-deleted, which is how a caller finds a path to hand to `POST /api/v2/files/folders/restore`. The bounded set is returned in one page; `nextCursor` is always null.", + "description": "List workspace file folders with optional parent-path filtering and sorting. Pass `scope=archived` to list folders a recursive `DELETE` soft-deleted, which is how a caller finds a path to hand to `POST /api/v2/files/folders/restore`. The bounded set is returned in one page; `nextCursor` is always null.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "files.folders.list", + "x-oauth-scope": "api:read", "tags": ["Files"], "parameters": [ { @@ -2492,7 +2542,9 @@ "post": { "operationId": "createFilesFolder", "summary": "Create Folder", - "description": "Create a canonical folder path in a workspace.", + "description": "Create a canonical folder path in a workspace.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.folders.create", + "x-oauth-scope": "api:write", "tags": ["Files"], "requestBody": { "required": true, @@ -2562,7 +2614,9 @@ "patch": { "operationId": "relocateFilesFolder", "summary": "Rename or Move Folder", - "description": "Rename or move a folder and atomically rewrite descendant canonical paths.", + "description": "Rename or move a folder and atomically rewrite descendant canonical paths.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.folders.update", + "x-oauth-scope": "api:write", "tags": ["Files"], "requestBody": { "required": true, @@ -2632,7 +2686,9 @@ "delete": { "operationId": "deleteFilesFolder", "summary": "Delete Folder", - "description": "Delete a folder, optionally including every nested file and folder.", + "description": "Delete a folder, optionally including every nested file and folder.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.folders.delete", + "x-oauth-scope": "api:write", "tags": ["Files"], "parameters": [ { @@ -2736,7 +2792,9 @@ "post": { "operationId": "restoreFilesFolder", "summary": "Restore Folder", - "description": "Restore a soft-deleted folder and everything archived with it. `DELETE /api/v2/files/folders` archives recursively, so this is what makes a recursive delete recoverable: without it the archived files stay visible through `GET /api/v2/files?scope=archived` but the folder structure cannot be rebuilt. Address the folder by the path reported by `GET /api/v2/files/folders?scope=archived`; a path that is not archived answers `404`.", + "description": "Restore a soft-deleted folder and everything archived with it. `DELETE /api/v2/files/folders` archives recursively, so this is what makes a recursive delete recoverable: without it the archived files stay visible through `GET /api/v2/files?scope=archived` but the folder structure cannot be rebuilt. Address the folder by the path reported by `GET /api/v2/files/folders?scope=archived`; a path that is not archived answers `404`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "files.folders.restore", + "x-oauth-scope": "api:write", "tags": ["Files"], "requestBody": { "required": true, @@ -2817,7 +2875,7 @@ "type": "http", "scheme": "bearer", "bearerFormat": "OAuth 2.0 access token", - "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. The token must carry the scope required by the operation." + "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. Each operation declares its required scope: api:read permits reads and searches; api:write also permits changes and execution and implies api:read. Scope requirements follow the application operation, independent of HTTP method or workspace role." } }, "headers": { diff --git a/apps/docs/openapi-v2-knowledge.json b/apps/docs/openapi-v2-knowledge.json index 2776ed95db9..333e6c7bf43 100644 --- a/apps/docs/openapi-v2-knowledge.json +++ b/apps/docs/openapi-v2-knowledge.json @@ -39,7 +39,9 @@ "get": { "operationId": "listKnowledgeBases", "summary": "List Knowledge Bases", - "description": "List knowledge bases in a workspace with lifecycle scope, folder filtering, search, sorting, and opaque cursor pagination. `scope` defaults to `active`; pass `archived` to list knowledge bases a `DELETE` archived, each carrying the `deletedAt` instant it was archived, and recover one with `POST /api/v2/knowledge/{knowledgeBaseId}/restore`. A workspace folder tree over 10,000 folders is a `413`.", + "description": "List knowledge bases in a workspace with lifecycle scope, folder filtering, search, sorting, and opaque cursor pagination. `scope` defaults to `active`; pass `archived` to list knowledge bases a `DELETE` archived, each carrying the `deletedAt` instant it was archived, and recover one with `POST /api/v2/knowledge/{knowledgeBaseId}/restore`. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -188,7 +190,9 @@ "post": { "operationId": "createKnowledgeBase", "summary": "Create Knowledge Base", - "description": "Create a knowledge base in a workspace with optional folder placement and chunking configuration. An unknown `folderPath` is a `404`. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Create a knowledge base in a workspace with optional folder placement and chunking configuration. An unknown `folderPath` is a `404`. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.create", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "requestBody": { "required": true, @@ -260,7 +264,9 @@ "get": { "operationId": "getKnowledgeBase", "summary": "Get Knowledge Base", - "description": "Retrieve a knowledge base by identifier. Inaccessible knowledge bases are reported as not found. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Retrieve a knowledge base by identifier. Inaccessible knowledge bases are reported as not found. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.read", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -337,7 +343,9 @@ "patch": { "operationId": "updateKnowledgeBase", "summary": "Update Knowledge Base", - "description": "Update a knowledge base name, description, chunking configuration, or folder placement. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Update a knowledge base name, description, chunking configuration, or folder placement. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.update", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -420,7 +428,9 @@ "delete": { "operationId": "deleteKnowledgeBase", "summary": "Delete Knowledge Base", - "description": "Delete a knowledge base and its documents.", + "description": "Delete a knowledge base and its documents.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.delete", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -496,7 +506,9 @@ "get": { "operationId": "listKnowledgeConnectors", "summary": "List Knowledge Connectors", - "description": "List external sources connected to a knowledge base with opaque cursor pagination. Stored API keys and encrypted secret material are never returned. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "List external sources connected to a knowledge base with opaque cursor pagination. Stored API keys and encrypted secret material are never returned. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.connectors.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -619,7 +631,9 @@ "post": { "operationId": "createKnowledgeConnector", "summary": "Create Knowledge Connector", - "description": "Validate and connect an external source, then queue its initial synchronization. The apiKey field is write-only and is never returned. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Validate and connect an external source, then queue its initial synchronization. The apiKey field is write-only and is never returned. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.connectors.create", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -704,7 +718,9 @@ "get": { "operationId": "getKnowledgeConnector", "summary": "Get Knowledge Connector", - "description": "Retrieve one connector and its ten most recent synchronization attempts. Stored API keys and encrypted secret material are never returned. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Retrieve one connector and its ten most recent synchronization attempts. Stored API keys and encrypted secret material are never returned. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.connectors.read", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -790,7 +806,9 @@ "patch": { "operationId": "updateKnowledgeConnector", "summary": "Update Knowledge Connector", - "description": "Update connector source configuration, schedule, or active state. Replacing source configuration on a runnable connector queues an immediate synchronization; paused connectors retain the change without synchronizing until resumed. Source configuration cannot be replaced while synchronization is already in progress. Authentication material cannot be changed through this operation. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Update connector source configuration, schedule, or active state. Replacing source configuration on a runnable connector queues an immediate synchronization; paused connectors retain the change without synchronizing until resumed. Source configuration cannot be replaced while synchronization is already in progress. Authentication material cannot be changed through this operation. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.connectors.update", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -884,7 +902,9 @@ "delete": { "operationId": "deleteKnowledgeConnector", "summary": "Delete Knowledge Connector", - "description": "Delete a connector and optionally its synchronized documents. Documents are retained by default. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Delete a connector and optionally its synchronized documents. Documents are retained by default. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.connectors.delete", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -982,7 +1002,9 @@ "post": { "operationId": "syncKnowledgeConnector", "summary": "Sync Knowledge Connector", - "description": "Queue a connector synchronization. Rehydration forces existing documents to be fetched and indexed again. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Queue a connector synchronization. Rehydration forces existing documents to be fetched and indexed again. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.connectors.sync", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1078,7 +1100,9 @@ "get": { "operationId": "listKnowledgeConnectorDocuments", "summary": "List Knowledge Connector Documents", - "description": "List documents produced by one connector with opaque cursor pagination. Excluded documents are omitted unless explicitly requested. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "List documents produced by one connector with opaque cursor pagination. Excluded documents are omitted unless explicitly requested. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.connectors.documents.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1198,7 +1222,9 @@ "patch": { "operationId": "updateKnowledgeConnectorDocuments", "summary": "Update Knowledge Connector Documents", - "description": "Exclude connector documents from knowledge search or restore previously excluded documents. Only documents produced by the selected connector can change. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Exclude connector documents from knowledge search or restore previously excluded documents. Only documents produced by the selected connector can change. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.connectors.documents.update", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1291,7 +1317,9 @@ "post": { "operationId": "searchKnowledge", "summary": "Search Knowledge", - "description": "Search one or more knowledge bases with semantic vector retrieval, optional hybrid full-text retrieval, and structured tag filters. Every result names the `knowledgeBaseId` it came from. A request body over 2 MiB is a `413`.", + "description": "Search one or more knowledge bases with semantic vector retrieval, optional hybrid full-text retrieval, and structured tag filters. Every result names the `knowledgeBaseId` it came from. A request body over 2 MiB is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.search", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "requestBody": { "required": true, @@ -1363,7 +1391,9 @@ "get": { "operationId": "listKnowledgeTags", "summary": "List Tags", - "description": "List the knowledge base's tag vocabulary: each tag's display name, the slot it is stored in, and its field type. Filters and document reads use display names; document writes address slots. The bounded set is returned in one page; `nextCursor` is always null.", + "description": "List the knowledge base's tag vocabulary: each tag's display name, the slot it is stored in, and its field type. Filters and document reads use display names; document writes address slots. The bounded set is returned in one page; `nextCursor` is always null.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.tags.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1437,7 +1467,9 @@ "post": { "operationId": "createKnowledgeTag", "summary": "Create Tag", - "description": "Define one tag; use `PUT` on this path for several. Write its `tagSlot` on documents, then filter by `displayName`. Omitting `tagSlot` selects the next free slot; exhaustion returns `400`. An occupied slot or duplicate display name returns `409` naming the conflict. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Define one tag; use `PUT` on this path for several. Write its `tagSlot` on documents, then filter by `displayName`. Omitting `tagSlot` selects the next free slot; exhaustion returns `400`. An occupied slot or duplicate display name returns `409` naming the conflict. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.tags.create", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1520,7 +1552,9 @@ "put": { "operationId": "bulkSaveKnowledgeTagDefinitions", "summary": "Bulk Save Tag Definitions", - "description": "Declare multiple tag definitions while leaving unspecified slots unchanged. Updating requires the current name in `originalDisplayName`; otherwise the entry creates a tag. Occupied explicit slots and duplicate display names appear in per-definition `errors`, never overwrite or relocate data, and still return `200`. This writes the vocabulary, not document tag values; set those through the document update endpoint. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Declare multiple tag definitions while leaving unspecified slots unchanged. Updating requires the current name in `originalDisplayName`; otherwise the entry creates a tag. Occupied explicit slots and duplicate display names appear in per-definition `errors`, never overwrite or relocate data, and still return `200`. This writes the vocabulary, not document tag values; set those through the document update endpoint. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.tags.bulk_save", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1600,7 +1634,9 @@ "delete": { "operationId": "deleteKnowledgeTagDefinitions", "summary": "Delete Tag Definitions", - "description": "Remove tag definitions. `unused` defaults to `true`, deleting only definitions with no document values, which can be recreated safely. `unused=false` deletes every definition and irreversibly clears its slot from all documents and chunks. Use `DELETE /api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}` to delete one definition. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Remove tag definitions. `unused` defaults to `true`, deleting only definitions with no document values, which can be recreated safely. `unused=false` deletes every definition and irreversibly clears its slot from all documents and chunks. Use `DELETE /api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}` to delete one definition. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.tags.cleanup", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1687,7 +1723,9 @@ "get": { "operationId": "listKnowledgeDocuments", "summary": "List Documents", - "description": "List documents in a knowledge base with filename search, state filtering, tag filtering, sorting, and opaque cursor pagination. Tag values are keyed by display name; resolve those to write slots with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`.", + "description": "List documents in a knowledge base with filename search, state filtering, tag filtering, sorting, and opaque cursor pagination. Tag values are keyed by display name; resolve those to write slots with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.documents.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1854,7 +1892,9 @@ "patch": { "operationId": "bulkUpdateKnowledgeDocuments", "summary": "Bulk Enable or Disable Documents", - "description": "Enable or disable many documents in one request, either by identifier or, with `selectAll`, every document in the knowledge base. Bulk delete is not offered; delete documents one at a time with `DELETE /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Enable or disable many documents in one request, either by identifier or, with `selectAll`, every document in the knowledge base. Bulk delete is not offered; delete documents one at a time with `DELETE /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}`. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.bulk", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -1934,7 +1974,9 @@ "post": { "operationId": "uploadKnowledgeDocument", "summary": "Upload Document", - "description": "Upload one document as multipart form data. Processing continues asynchronously after the document is accepted.", + "description": "Upload one document as multipart form data. Processing continues asynchronously after the document is accepted.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.upload", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -2031,7 +2073,9 @@ "post": { "operationId": "createKnowledgeDocumentUpload", "summary": "Create Document Upload", - "description": "Create a resumable upload session and receive direct PUT or multipart transfer instructions.", + "description": "Create a resumable upload session and receive direct PUT or multipart transfer instructions.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.upload.create", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -2116,7 +2160,9 @@ "delete": { "operationId": "abortKnowledgeDocumentUpload", "summary": "Abort Document Upload", - "description": "Abort an incomplete upload and discard provider-side multipart state.", + "description": "Abort an incomplete upload and discard provider-side multipart state.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.upload.cancel", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -2218,7 +2264,9 @@ "post": { "operationId": "createKnowledgeDocumentUploadPartUrls", "summary": "Create Document Upload Part URLs", - "description": "Issue short-lived signed PUT URLs for up to 100 multipart part numbers.", + "description": "Issue short-lived signed PUT URLs for up to 100 multipart part numbers.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.upload.parts", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -2337,7 +2385,9 @@ "post": { "operationId": "completeKnowledgeDocumentUpload", "summary": "Complete Document Upload", - "description": "Verify a direct upload or assemble multipart parts, create the knowledge document, and queue asynchronous processing.", + "description": "Verify a direct upload or assemble multipart parts, create the knowledge document, and queue asynchronous processing.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.upload.complete", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -2439,7 +2489,9 @@ "get": { "operationId": "getKnowledgeDocument", "summary": "Get Document", - "description": "Retrieve document detail, processing state, and connector provenance.", + "description": "Retrieve document detail, processing state, and connector provenance.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.documents.read", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -2524,7 +2576,9 @@ "patch": { "operationId": "updateKnowledgeDocument", "summary": "Update Document", - "description": "Rename a document, enable or disable it for search, set any of its 17 tag slots, or requeue it for processing. Absent fields are unchanged, and derived indexing state is read-only. Resolve a tag display name to its slot with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`. The returned document omits the connector provenance the detail read carries. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Rename a document, enable or disable it for search, set any of its 17 tag slots, or requeue it for processing. Absent fields are unchanged, and derived indexing state is read-only. Resolve a tag display name to its slot with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`. The returned document omits the connector provenance the detail read carries. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.update", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -2615,7 +2669,9 @@ "delete": { "operationId": "deleteKnowledgeDocument", "summary": "Delete Document", - "description": "Remove one document from a knowledge base. An uploaded document is deleted outright with its indexed chunks. A connector-backed document is instead excluded — its row and embeddings survive, but it stops being searchable and a later sync does not re-add it. Either way it no longer appears in listings or search results.", + "description": "Remove one document from a knowledge base. An uploaded document is deleted outright with its indexed chunks. A connector-backed document is instead excluded — its row and embeddings survive, but it stops being searchable and a later sync does not re-add it. Either way it no longer appears in listings or search results.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.delete", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -2702,7 +2758,9 @@ "get": { "operationId": "listKnowledgeFolders", "summary": "List Folders", - "description": "List folders in the knowledge-base folder tree with filtering and sorting. The bounded set is returned in one page; `nextCursor` is always null. A workspace folder tree over 10,000 folders is a `413`.", + "description": "List folders in the knowledge-base folder tree with filtering and sorting. The bounded set is returned in one page; `nextCursor` is always null. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.folders.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -2815,7 +2873,9 @@ "post": { "operationId": "createKnowledgeFolder", "summary": "Create Folder", - "description": "Create a folder in the knowledge-base folder tree. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Create a folder in the knowledge-base folder tree. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.folders.create", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "requestBody": { "required": true, @@ -2885,7 +2945,9 @@ "patch": { "operationId": "relocateKnowledgeFolder", "summary": "Rename or Move Folder", - "description": "Rename or move a folder and atomically rewrite descendant paths. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Rename or move a folder and atomically rewrite descendant paths. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.folders.relocate", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "requestBody": { "required": true, @@ -2955,7 +3017,9 @@ "delete": { "operationId": "deleteKnowledgeFolder", "summary": "Delete Folder", - "description": "Delete a folder, optionally including nested folders and knowledge bases.", + "description": "Delete a folder, optionally including nested folders and knowledge bases.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.folders.delete", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3062,7 +3126,9 @@ "post": { "operationId": "restoreKnowledgeBase", "summary": "Restore Knowledge Base", - "description": "Un-archive a soft-deleted knowledge base along with its documents and connectors. Idempotent: a knowledge base that is already active is returned unchanged with no audit entry recorded. Restoring into an archived workspace is a `409`, and a knowledge base whose folder is still archived is returned to the workspace root. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Un-archive a soft-deleted knowledge base along with its documents and connectors. Idempotent: a knowledge base that is already active is returned unchanged with no audit entry recorded. Restoring into an archived workspace is a `409`, and a knowledge base whose folder is still archived is returned to the workspace root. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.restore", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3147,7 +3213,9 @@ "post": { "operationId": "addWorkspaceFilesToKnowledgeBase", "summary": "Index Workspace Files", - "description": "Index stored workspace files without re-uploading bytes. Each reference is authorized independently; unreadable, unsupported, or over-100 MB files appear in `failed` while valid files are queued. This partial outcome returns `200`, not multi-status. Queued documents begin as `pending`; the response carries identities only, so read each document endpoint for current processing state. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Index stored workspace files without re-uploading bytes. Each reference is authorized independently; unreadable, unsupported, or over-100 MB files appear in `failed` while valid files are queued. This partial outcome returns `200`, not multi-status. Queued documents begin as `pending`; the response carries identities only, so read each document endpoint for current processing state. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.add_workspace_files", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3232,7 +3300,9 @@ "get": { "operationId": "listKnowledgeChunks", "summary": "List Chunks", - "description": "List the passages a document was split into, with content search, enabled filtering, sorting, and opaque cursor pagination. Tag values are projected by slot; resolve slots to display names with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "List the passages a document was split into, with content search, enabled filtering, sorting, and opaque cursor pagination. Tag values are projected by slot; resolve slots to display names with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`. A document that has not finished processing answers `409`; the message names the status it is in. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.chunks.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3393,7 +3463,9 @@ "post": { "operationId": "createKnowledgeChunk", "summary": "Create Chunk", - "description": "Append a chunk, embedding it before the response so it is immediately searchable. It inherits the document's tags and next `chunkIndex`. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Append a chunk, embedding it before the response so it is immediately searchable. It inherits the document's tags and next `chunkIndex`. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.chunks.create", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3484,7 +3556,9 @@ "patch": { "operationId": "bulkUpdateKnowledgeChunks", "summary": "Bulk Update Chunks", - "description": "Enable, disable, or delete multiple chunks in one best-effort request. Unknown chunk IDs appear in `errors` without failing the request; `processed` counts matched chunks, not changes. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Enable, disable, or delete multiple chunks in one best-effort request. Unknown chunk IDs appear in `errors` without failing the request; `processed` counts matched chunks, not changes. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.chunks.bulk", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3577,7 +3651,9 @@ "get": { "operationId": "getKnowledgeChunk", "summary": "Get Chunk", - "description": "Retrieve one chunk of a document, including the exact text that was embedded. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Retrieve one chunk of a document, including the exact text that was embedded. A document that has not finished processing answers `409`; the message names the status it is in. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.chunks.read", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3677,7 +3753,9 @@ "patch": { "operationId": "updateKnowledgeChunk", "summary": "Update Chunk", - "description": "Correct chunk text or disable it from search. Changing `content` re-embeds immediately and recalculates document token and character counts; disabling retains the index. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Correct chunk text or disable it from search. Changing `content` re-embeds immediately and recalculates document token and character counts; disabling retains the index. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. A document that has not finished processing answers `409`; the message names the status it is in. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.chunks.update", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3782,7 +3860,9 @@ "delete": { "operationId": "deleteKnowledgeChunk", "summary": "Delete Chunk", - "description": "Permanently remove one chunk and subtract it from document counts. Remaining `chunkIndex` values stay stable and may become non-contiguous. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. A document that has not finished processing answers `409`; the message names the status it is in. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Permanently remove one chunk and subtract it from document counts. Remaining `chunkIndex` values stay stable and may become non-contiguous. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. A document that has not finished processing answers `409`; the message names the status it is in. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.chunks.delete", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3884,7 +3964,9 @@ "patch": { "operationId": "updateKnowledgeTag", "summary": "Update Tag", - "description": "Rename a tag or change its slot-compatible `fieldType`. Renaming changes read and filter names without moving the slot or its values. Slots are fixed for a tag's lifetime; an incompatible type returns `400` and requires creating a new tag. A duplicate display name returns `409`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Rename a tag or change its slot-compatible `fieldType`. Renaming changes read and filter names without moving the slot or its values. Slots are fixed for a tag's lifetime; an incompatible type returns `400` and requires creating a new tag. A duplicate display name returns `409`. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.tags.update", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -3978,7 +4060,9 @@ "delete": { "operationId": "deleteKnowledgeTag", "summary": "Delete Tag", - "description": "Remove a tag definition and clear its slot across every document and chunk in the knowledge base. Without a definition the slot has no meaning, so leaving the values would strand them under a raw slot name — this is not recoverable. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Remove a tag definition and clear its slot across every document and chunk in the knowledge base. Without a definition the slot has no meaning, so leaving the values would strand them under a raw slot name — this is not recoverable. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.tags.delete", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "parameters": [ { @@ -4069,7 +4153,9 @@ "get": { "operationId": "getNextKnowledgeTagSlot", "summary": "Get Next Tag Slot", - "description": "Report which slot a create would take for a field type, and how many are left. Advisory rather than a claim: nothing is reserved, and `POST /api/v2/knowledge/{knowledgeBaseId}/tags` assigns the same slot when `tagSlot` is omitted. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Report which slot a create would take for a field type, and how many are left. Advisory rather than a claim: nothing is reserved, and `POST /api/v2/knowledge/{knowledgeBaseId}/tags` assigns the same slot when `tagSlot` is omitted. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.tags.read_next_slot", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -4158,7 +4244,9 @@ "get": { "operationId": "listKnowledgeTagUsage", "summary": "List Tag Usage", - "description": "Report how many documents and chunks carry a value for each defined tag, so a caller can tell a tag that is actually populated from one that was only declared. The bounded set is returned in one page; `nextCursor` is always null. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Report how many documents and chunks carry a value for each defined tag, so a caller can tell a tag that is actually populated from one that was only declared. The bounded set is returned in one page; `nextCursor` is always null. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.tags.read_usage", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "parameters": [ { @@ -4244,7 +4332,7 @@ "type": "http", "scheme": "bearer", "bearerFormat": "OAuth 2.0 access token", - "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. The token must carry the scope required by the operation." + "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. Each operation declares its required scope: api:read permits reads and searches; api:write also permits changes and execution and implies api:read. Scope requirements follow the application operation, independent of HTTP method or workspace role." } }, "headers": { diff --git a/apps/docs/openapi-v2-logs.json b/apps/docs/openapi-v2-logs.json index 33eba6fe8fc..debf4510947 100644 --- a/apps/docs/openapi-v2-logs.json +++ b/apps/docs/openapi-v2-logs.json @@ -39,7 +39,9 @@ "get": { "operationId": "listLogs", "summary": "List Logs", - "description": "List logs with filters, selectable detail, sorting, and cursor pagination. `includeJobRuns=true` includes chat and Sim-agent jobs only with `sortBy=startedAt`, because other orderings are unsupported. `files` contains only run-produced files; use the files API for input attachments. Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. A workspace folder tree over 10,000 folders is a `413`.", + "description": "List logs with filters, selectable detail, sorting, and cursor pagination. `includeJobRuns=true` includes chat and Sim-agent jobs only with `sortBy=startedAt`, because other orderings are unsupported. `files` contains only run-produced files; use the files API for input attachments. Expired runs are hard-deleted. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "logs.list", + "x-oauth-scope": "api:read", "tags": ["Logs"], "parameters": [ { @@ -354,7 +356,9 @@ "get": { "operationId": "getLog", "summary": "Get Log", - "description": "Retrieve a run's workflow snapshot, trace spans, final output, and cost. Trace spans have separate retention, so an empty `traceSpans` array does not prove none were recorded. Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Retrieve a run's workflow snapshot, trace spans, final output, and cost. Trace spans have separate retention, so an empty `traceSpans` array does not prove none were recorded. Expired runs are hard-deleted. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "logs.read_detail", + "x-oauth-scope": "api:read", "tags": ["Logs"], "parameters": [ { @@ -424,7 +428,9 @@ "get": { "operationId": "getLogStats", "summary": "Get Log Statistics", - "description": "Return workspace/workflow counts, success, errors, and latency. Defaults span runs, or 24 hours if empty; supplied bounds stay exact. Buckets are one-minute minimum and may pass the end. Folders include descendants; `workflowsTruncated` marks capped series, totals include all. Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Return workspace/workflow counts, success, errors, and latency. Defaults span runs, or 24 hours if empty; supplied bounds stay exact. Buckets are one-minute minimum and may pass the end. Folders include descendants; `workflowsTruncated` marks capped series, totals include all. Expired runs are hard-deleted. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "logs.read_stats", + "x-oauth-scope": "api:read", "tags": ["Logs"], "parameters": [ { @@ -580,7 +586,7 @@ "type": "http", "scheme": "bearer", "bearerFormat": "OAuth 2.0 access token", - "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. The token must carry the scope required by the operation." + "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. Each operation declares its required scope: api:read permits reads and searches; api:write also permits changes and execution and implies api:read. Scope requirements follow the application operation, independent of HTTP method or workspace role." } }, "headers": { diff --git a/apps/docs/openapi-v2-resources.json b/apps/docs/openapi-v2-resources.json index 25b6eae971e..714ecc09cbb 100644 --- a/apps/docs/openapi-v2-resources.json +++ b/apps/docs/openapi-v2-resources.json @@ -71,7 +71,9 @@ "get": { "operationId": "listWorkspaces", "summary": "List Workspaces", - "description": "List active workspaces available to the calling credential with opaque cursor pagination. A personal API key or OAuth token sees accessible workspaces that permit user-held API credentials; a workspace API key sees only its bound workspace.", + "description": "List active workspaces available to the calling credential with opaque cursor pagination. A personal API key or OAuth token sees accessible workspaces that permit user-held API credentials; a workspace API key sees only its bound workspace.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workspaces.list_public", + "x-oauth-scope": "api:read", "tags": ["Workspaces"], "parameters": [ { @@ -173,7 +175,9 @@ "get": { "operationId": "getWorkspace", "summary": "Get Workspace", - "description": "Return public metadata for one accessible workspace. Governance identities, billing identities, and internal membership identifiers are intentionally omitted.", + "description": "Return public metadata for one accessible workspace. Governance identities, billing identities, and internal membership identifiers are intentionally omitted.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workspaces.read_public_detail", + "x-oauth-scope": "api:read", "tags": ["Workspaces"], "parameters": [ { @@ -239,7 +243,9 @@ "get": { "operationId": "listWorkspaceMembers", "summary": "List Workspace Members", - "description": "List the workspace's effective members ordered by email. Explicit workspace grants and inherited organization-administrator grants are merged; internal membership and billing identities are omitted.", + "description": "List the workspace's effective members ordered by email. Explicit workspace grants and inherited organization-administrator grants are merged; internal membership and billing identities are omitted.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workspaces.members.list_public", + "x-oauth-scope": "api:read", "tags": ["Workspaces"], "parameters": [ { @@ -329,7 +335,9 @@ "get": { "operationId": "listMcpServers", "summary": "List MCP Servers", - "description": "List MCP servers registered in a workspace. Request-header values and OAuth client secrets are never returned. The discovery fields stay at their registration defaults until `GET /api/v2/mcp-servers/{mcpServerId}/tools` runs a discovery.", + "description": "List MCP servers registered in a workspace. Request-header values and OAuth client secrets are never returned. The discovery fields stay at their registration defaults until `GET /api/v2/mcp-servers/{mcpServerId}/tools` runs a discovery.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "mcp_servers.list", + "x-oauth-scope": "api:read", "tags": ["MCP Servers"], "parameters": [ { @@ -453,7 +461,9 @@ "post": { "operationId": "createMcpServer", "summary": "Create MCP Server", - "description": "Register an MCP server in a workspace. The endpoint URL is the server identity, so a URL already registered here is a `409` — reconfigure that server with `PATCH /api/v2/mcp-servers/{mcpServerId}` instead. Registration never connects to the endpoint: the server comes back `disconnected` and stays unavailable until `GET /api/v2/mcp-servers/{mcpServerId}/tools` succeeds.", + "description": "Register an MCP server in a workspace. The endpoint URL is the server identity, so a URL already registered here is a `409` — reconfigure that server with `PATCH /api/v2/mcp-servers/{mcpServerId}` instead. Registration never connects to the endpoint: the server comes back `disconnected` and stays unavailable until `GET /api/v2/mcp-servers/{mcpServerId}/tools` succeeds.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "mcp_servers.create", + "x-oauth-scope": "api:write", "tags": ["MCP Servers"], "requestBody": { "required": true, @@ -525,7 +535,9 @@ "get": { "operationId": "getMcpServer", "summary": "Get MCP Server", - "description": "Fetch one MCP server by identifier. Request-header values and OAuth client secrets are never returned.", + "description": "Fetch one MCP server by identifier. Request-header values and OAuth client secrets are never returned.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "mcp_servers.read", + "x-oauth-scope": "api:read", "tags": ["MCP Servers"], "parameters": [ { @@ -600,7 +612,9 @@ "patch": { "operationId": "updateMcpServer", "summary": "Update MCP Server", - "description": "Update the supplied MCP server fields. Omitted fields are retained, except where a field says otherwise. Any change that invalidates authentication revokes the stored OAuth grant, resets `connectionStatus` to `disconnected`, and clears `lastConnected` and `lastError`, so the server must be rediscovered.", + "description": "Update the supplied MCP server fields. Omitted fields are retained, except where a field says otherwise. Any change that invalidates authentication revokes the stored OAuth grant, resets `connectionStatus` to `disconnected`, and clears `lastConnected` and `lastError`, so the server must be rediscovered.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "mcp_servers.update", + "x-oauth-scope": "api:write", "tags": ["MCP Servers"], "parameters": [ { @@ -680,7 +694,9 @@ "delete": { "operationId": "deleteMcpServer", "summary": "Delete MCP Server", - "description": "Remove an MCP server and revoke its OAuth tokens. Workflows retain blocks that referenced the server's tools, but those tools can no longer be called.", + "description": "Remove an MCP server and revoke its OAuth tokens. Workflows retain blocks that referenced the server's tools, but those tools can no longer be called.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "mcp_servers.delete", + "x-oauth-scope": "api:write", "tags": ["MCP Servers"], "parameters": [ { @@ -757,7 +773,9 @@ "get": { "operationId": "listMcpServerTools", "summary": "List MCP Server Tools", - "description": "Return up to 1,000 tools and 5 MB with `nextCursor: null`, opening a connection and updating connection metadata. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only. Unavailable servers return `503`; invalid OAuth returns `409` with `error.details.code: MCP_SERVER_REAUTHORIZATION_REQUIRED` and requires human reauthorization. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Return up to 1,000 tools and 5 MB with `nextCursor: null`, opening a connection and updating connection metadata. `HEAD` skips the effect but uses `GET` authorization, returning `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; confirms access only. Unavailable servers return `503`; invalid OAuth returns `409` with `error.details.code: MCP_SERVER_REAUTHORIZATION_REQUIRED` and requires human reauthorization. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "mcp_servers.tools.discover", + "x-oauth-scope": "api:write", "tags": ["MCP Servers"], "parameters": [ { @@ -847,7 +865,9 @@ "get": { "operationId": "listSkills", "summary": "List Skills", - "description": "List workspace and built-in skills with opaque cursor pagination. Built-ins are marked read-only. The list omits skill bodies; fetch one skill to read its content.", + "description": "List workspace and built-in skills with opaque cursor pagination. Built-ins are marked read-only. The list omits skill bodies; fetch one skill to read its content.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "skills.list", + "x-oauth-scope": "api:read", "tags": ["Skills"], "parameters": [ { @@ -971,7 +991,9 @@ "post": { "operationId": "createSkill", "summary": "Create Skill", - "description": "Create one skill in a workspace. Its kebab-case name must be unique and cannot be reserved by a built-in skill. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Create one skill in a workspace. Its kebab-case name must be unique and cannot be reserved by a built-in skill. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "skills.create", + "x-oauth-scope": "api:write", "tags": ["Skills"], "requestBody": { "required": true, @@ -1043,7 +1065,9 @@ "get": { "operationId": "getSkill", "summary": "Get Skill", - "description": "Fetch one workspace or built-in skill, including its full content. Built-in skills are marked read-only.", + "description": "Fetch one workspace or built-in skill, including its full content. Built-in skills are marked read-only.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "skills.read", + "x-oauth-scope": "api:read", "tags": ["Skills"], "parameters": [ { @@ -1118,7 +1142,9 @@ "patch": { "operationId": "updateSkill", "summary": "Update Skill", - "description": "Update the supplied fields on a workspace skill. Omitted fields retain their stored values. Built-in skills are read-only. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Update the supplied fields on a workspace skill. Omitted fields retain their stored values. Built-in skills are read-only. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "skills.update", + "x-oauth-scope": "api:write", "tags": ["Skills"], "parameters": [ { @@ -1201,7 +1227,9 @@ "delete": { "operationId": "deleteSkill", "summary": "Delete Skill", - "description": "Delete a workspace skill. Built-in skills are read-only and cannot be deleted. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Delete a workspace skill. Built-in skills are read-only and cannot be deleted. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "skills.delete", + "x-oauth-scope": "api:write", "tags": ["Skills"], "parameters": [ { @@ -1278,7 +1306,9 @@ "get": { "operationId": "listSkillEditors", "summary": "List Skill Editors", - "description": "List explicit skill editors and workspace administrators with opaque cursor pagination. Internal user and membership identifiers are never returned.", + "description": "List explicit skill editors and workspace administrators with opaque cursor pagination. Internal user and membership identifiers are never returned.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "skills.editors.list", + "x-oauth-scope": "api:read", "tags": ["Skills"], "parameters": [ { @@ -1401,7 +1431,9 @@ "post": { "operationId": "grantSkillEditor", "summary": "Grant Skill Editor", - "description": "Grant editor access to a current workspace member by email. The caller must already be a skill editor or workspace administrator. Workspace administrators already have derived editor access and cannot receive an explicit grant. A retried existing grant returns 200; a newly created grant returns 201. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Grant editor access to a current workspace member by email. The caller must already be a skill editor or workspace administrator. Workspace administrators already have derived editor access and cannot receive an explicit grant. A retried existing grant returns 200; a newly created grant returns 201. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "skills.editors.grant", + "x-oauth-scope": "api:write", "tags": ["Skills"], "parameters": [ { @@ -1502,7 +1534,9 @@ "delete": { "operationId": "revokeSkillEditor", "summary": "Revoke Skill Editor", - "description": "Revoke an explicit editor grant by email. The caller must already be a skill editor or workspace administrator. Workspace administrators have derived access that cannot be revoked. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Revoke an explicit editor grant by email. The caller must already be a skill editor or workspace administrator. Workspace administrators have derived access that cannot be revoked. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "skills.editors.revoke", + "x-oauth-scope": "api:write", "tags": ["Skills"], "parameters": [ { @@ -1591,7 +1625,9 @@ "get": { "operationId": "listCustomTools", "summary": "List Custom Tools", - "description": "List code-backed custom tools defined in a workspace, with opaque cursor pagination. Legacy personal tools are excluded.", + "description": "List code-backed custom tools defined in a workspace, with opaque cursor pagination. Legacy personal tools are excluded.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "custom_tools.list", + "x-oauth-scope": "api:read", "tags": ["Custom Tools"], "parameters": [ { @@ -1715,7 +1751,9 @@ "post": { "operationId": "createCustomTool", "summary": "Create Custom Tool", - "description": "Create a code-backed custom tool in a workspace. Its title must be unique because tools resolve by title at call time.", + "description": "Create a code-backed custom tool in a workspace. Its title must be unique because tools resolve by title at call time.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "custom_tools.create", + "x-oauth-scope": "api:write", "tags": ["Custom Tools"], "requestBody": { "required": true, @@ -1787,7 +1825,9 @@ "get": { "operationId": "getCustomTool", "summary": "Get Custom Tool", - "description": "Fetch one custom tool by identifier, scoped to its workspace.", + "description": "Fetch one custom tool by identifier, scoped to its workspace.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "custom_tools.read", + "x-oauth-scope": "api:read", "tags": ["Custom Tools"], "parameters": [ { @@ -1862,7 +1902,9 @@ "patch": { "operationId": "updateCustomTool", "summary": "Update Custom Tool", - "description": "Update the supplied custom tool fields. Omitted fields retain their stored values, and titles must remain unique within the workspace.", + "description": "Update the supplied custom tool fields. Omitted fields retain their stored values, and titles must remain unique within the workspace.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "custom_tools.update", + "x-oauth-scope": "api:write", "tags": ["Custom Tools"], "parameters": [ { @@ -1945,7 +1987,9 @@ "delete": { "operationId": "deleteCustomTool", "summary": "Delete Custom Tool", - "description": "Delete a custom tool. Agent blocks retain their configuration but can no longer call the deleted tool.", + "description": "Delete a custom tool. Agent blocks retain their configuration but can no longer call the deleted tool.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "custom_tools.delete", + "x-oauth-scope": "api:write", "tags": ["Custom Tools"], "parameters": [ { @@ -2022,7 +2066,9 @@ "get": { "operationId": "listSandboxes", "summary": "List Sandboxes", - "description": "List the sandboxes defined in a workspace, with opaque cursor pagination. A sandbox is a reusable dependency set — npm or PyPI packages, pinned managed CLIs, and Debian packages — that Function blocks execute against. Listing is not plan-gated, so a workspace that dropped below the Max tier still sees what it built.", + "description": "List the sandboxes defined in a workspace, with opaque cursor pagination. A sandbox is a reusable dependency set — npm or PyPI packages, pinned managed CLIs, and Debian packages — that Function blocks execute against. Listing is not plan-gated, so a workspace that dropped below the Max tier still sees what it built.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "sandboxes.list", + "x-oauth-scope": "api:read", "tags": ["Sandboxes"], "parameters": [ { @@ -2146,7 +2192,9 @@ "post": { "operationId": "createSandbox", "summary": "Create Sandbox", - "description": "Create a uniquely named sandbox. Prebuild deployments schedule an image build reported by `buildStatus`; runtime-install deployments or empty specs report `buildStatus: null`. Invalid dependency or system-package entries return `400` with field details. Requires a workspace admin on Max or Enterprise; lower plans return `403` with `error.details.code: WORKSPACE_PLAN_CAPABILITY_REQUIRED`. Creates and updates share a write budget; bursts return `429` with `Retry-After`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Create a uniquely named sandbox. Prebuild deployments schedule an image build reported by `buildStatus`; runtime-install deployments or empty specs report `buildStatus: null`. Invalid dependency or system-package entries return `400` with field details. Requires a workspace admin on Max or Enterprise; lower plans return `403` with `error.details.code: WORKSPACE_PLAN_CAPABILITY_REQUIRED`. Creates and updates share a write budget; bursts return `429` with `Retry-After`. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "sandboxes.create", + "x-oauth-scope": "api:write", "tags": ["Sandboxes"], "requestBody": { "required": true, @@ -2218,7 +2266,9 @@ "get": { "operationId": "getSandbox", "summary": "Get Sandbox", - "description": "Fetch one sandbox by identifier, scoped to its workspace, including its current build state and any build failure.", + "description": "Fetch one sandbox by identifier, scoped to its workspace, including its current build state and any build failure.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "sandboxes.read", + "x-oauth-scope": "api:read", "tags": ["Sandboxes"], "parameters": [ { @@ -2293,7 +2343,9 @@ "patch": { "operationId": "updateSandbox", "summary": "Update Sandbox", - "description": "Update supplied fields; omissions preserve values, lists replace whole lists, and names remain unique. Prebuild deployments rebuild changed specs, while resending an unchanged failed spec retries it; runtime-install or empty specs report `buildStatus: null`. Requires a workspace admin on Max or Enterprise; lower plans return `403` with `error.details.code: WORKSPACE_PLAN_CAPABILITY_REQUIRED`. Creates and updates share a write budget; bursts return `429` with `Retry-After`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Update supplied fields; omissions preserve values, lists replace whole lists, and names remain unique. Prebuild deployments rebuild changed specs, while resending an unchanged failed spec retries it; runtime-install or empty specs report `buildStatus: null`. Requires a workspace admin on Max or Enterprise; lower plans return `403` with `error.details.code: WORKSPACE_PLAN_CAPABILITY_REQUIRED`. Creates and updates share a write budget; bursts return `429` with `Retry-After`. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "sandboxes.update", + "x-oauth-scope": "api:write", "tags": ["Sandboxes"], "parameters": [ { @@ -2376,7 +2428,9 @@ "delete": { "operationId": "deleteSandbox", "summary": "Delete Sandbox", - "description": "Delete a sandbox. Function blocks still selecting it fail closed until reconfigured. A prebuilt image is released when no sandbox shares it; runtime-install and empty specs have no image to release. Requires a workspace admin on Max or Enterprise; lower plans return `403` with `error.details.code: WORKSPACE_PLAN_CAPABILITY_REQUIRED`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Delete a sandbox. Function blocks still selecting it fail closed until reconfigured. A prebuilt image is released when no sandbox shares it; runtime-install and empty specs have no image to release. Requires a workspace admin on Max or Enterprise; lower plans return `403` with `error.details.code: WORKSPACE_PLAN_CAPABILITY_REQUIRED`. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "sandboxes.delete", + "x-oauth-scope": "api:write", "tags": ["Sandboxes"], "parameters": [ { @@ -2453,7 +2507,9 @@ "get": { "operationId": "listCredentials", "summary": "List Credentials", - "description": "List OAuth and service-account connections visible to the caller. Secret material is never returned.", + "description": "List OAuth and service-account connections visible to the caller. Secret material is never returned.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "credentials.connections.list", + "x-oauth-scope": "api:read", "tags": ["Credentials"], "parameters": [ { @@ -2599,7 +2655,9 @@ "post": { "operationId": "createServiceAccountCredential", "summary": "Create Service-Account Credential", - "description": "Verify and store one service-account credential. Use provider discovery to select a service-account provider, then encode its required fields as the JSON object string in credentials. The credentials string is write-only and is never returned. A retried source match returns the existing credential with 200; a newly created credential returns 201. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Verify and store one service-account credential. Use provider discovery to select a service-account provider, then encode its required fields as the JSON object string in credentials. The credentials string is write-only and is never returned. A retried source match returns the existing credential with 200; a newly created credential returns 201. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "credentials.service_accounts.create", + "x-oauth-scope": "api:write", "tags": ["Credentials"], "requestBody": { "required": true, @@ -2692,7 +2750,9 @@ "get": { "operationId": "listCredentialProviders", "summary": "List Credential Providers", - "description": "List catalogued OAuth and service-account connection methods and whether each is available to the caller in this workspace and deployment. Optionally search provider names with a case-insensitive substring match. OAuth authorization options contain the exact provider IDs accepted by the browser connection endpoint; service-account methods list the exact create-body fields and mark secret fields write-only. The bounded set is returned in one page; `nextCursor` is always null.", + "description": "List catalogued OAuth and service-account connection methods and whether each is available to the caller in this workspace and deployment. Optionally search provider names with a case-insensitive substring match. OAuth authorization options contain the exact provider IDs accepted by the browser connection endpoint; service-account methods list the exact create-body fields and mark secret fields write-only. The bounded set is returned in one page; `nextCursor` is always null.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "credentials.providers.list", + "x-oauth-scope": "api:read", "tags": ["Credentials"], "parameters": [ { @@ -2770,7 +2830,9 @@ "post": { "operationId": "createCredentialConnection", "summary": "Create Credential Connection", - "description": "Create a short-lived browser URL for connecting an OAuth provider or reconnecting an existing OAuth credential. Open the URL, sign in as the authenticated user, complete provider authorization, then refresh the credentials list. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Create a short-lived browser URL for connecting an OAuth provider or reconnecting an existing OAuth credential. Open the URL, sign in as the authenticated user, complete provider authorization, then refresh the credentials list. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "credentials.connections.create", + "x-oauth-scope": "api:write", "tags": ["Credentials"], "requestBody": { "required": true, @@ -2842,7 +2904,9 @@ "delete": { "operationId": "deleteCredential", "summary": "Disconnect Credential", - "description": "Disconnect an OAuth or service-account credential and clear its stored workflow, deployment, paused-run, knowledge-connector, and webhook references. Credential admin access is required. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Disconnect an OAuth or service-account credential and clear its stored workflow, deployment, paused-run, knowledge-connector, and webhook references. Credential admin access is required. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "credentials.delete", + "x-oauth-scope": "api:write", "tags": ["Credentials"], "parameters": [ { @@ -2918,7 +2982,9 @@ "patch": { "operationId": "updateCredential", "summary": "Update Credential", - "description": "Rename a service-account credential or rotate its write-only secret fields. Omissions preserve values; `description: null` clears the description. Secret fields sent for another credential type return `400`. The provider verifies replacements before storage: rejection leaves the old secret intact and returns `400` with `providerErrorCode`; provider outages return `503`. The preserved credential ID keeps all references working. Credential admin access is required. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Rename a service-account credential or rotate its write-only secret fields. Omissions preserve values; `description: null` clears the description. Secret fields sent for another credential type return `400`. The provider verifies replacements before storage: rejection leaves the old secret intact and returns `400` with `providerErrorCode`; provider outages return `503`. The preserved credential ID keeps all references working. Credential admin access is required. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "credentials.update", + "x-oauth-scope": "api:write", "tags": ["Credentials"], "parameters": [ { @@ -3016,7 +3082,9 @@ "get": { "operationId": "listSecrets", "summary": "List Secrets", - "description": "List workspace and caller-owned personal secret metadata with opaque cursor pagination. Rows for workspace secrets marked visible (unredacted) include the stored value; every other row is metadata-only and no other response ever carries a value. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "List workspace and caller-owned personal secret metadata with opaque cursor pagination. Rows for workspace secrets marked visible (unredacted) include the stored value; every other row is metadata-only and no other response ever carries a value. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "secrets.list", + "x-oauth-scope": "api:read", "tags": ["Secrets"], "parameters": [ { @@ -3153,7 +3221,9 @@ "put": { "operationId": "setSecret", "summary": "Set Secret", - "description": "Create or replace a workspace or personal secret. Values are encrypted at rest, write-only, and never returned. For an existing workspace secret, omit `value` to update only `description` or `unredacted`; the value remains untouched. This metadata-only form cannot create a secret and returns `404` when absent. Personal secrets always require `value`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Create or replace a workspace or personal secret. Values are encrypted at rest, write-only, and never returned. For an existing workspace secret, omit `value` to update only `description` or `unredacted`; the value remains untouched. This metadata-only form cannot create a secret and returns `404` when absent. Personal secrets always require `value`. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "secrets.set", + "x-oauth-scope": "api:write", "tags": ["Secrets"], "parameters": [ { @@ -3256,7 +3326,9 @@ "delete": { "operationId": "deleteSecret", "summary": "Delete Secret", - "description": "Delete a workspace or caller-owned personal secret without reading or returning its stored value. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Delete a workspace or caller-owned personal secret without reading or returning its stored value. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "secrets.delete", + "x-oauth-scope": "api:write", "tags": ["Secrets"], "parameters": [ { @@ -3346,7 +3418,9 @@ "get": { "operationId": "getApiMeta", "summary": "Get API Capabilities", - "description": "Report whether v2 is available, what kind of API credential is calling, and when it expires. Requires a valid API key or OAuth access token.", + "description": "Report whether v2 is available, what kind of API credential is calling, and when it expires. Requires a valid API key or OAuth access token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "meta.capabilities.read", + "x-oauth-scope": "api:read", "tags": ["Meta"], "responses": { "200": { @@ -3392,7 +3466,9 @@ "get": { "operationId": "listWorkflowMcpServers", "summary": "List Workflow MCP Servers", - "description": "List servers that publish deployed workflows to outside MCP clients; `GET /api/v2/mcp-servers` instead lists external servers Sim calls. Entries include client endpoints and tool names. A page shares a 2,000-name budget, so trailing servers may show partial inventories; read a server's tools endpoint for its full set. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "List servers that publish deployed workflows to outside MCP clients; `GET /api/v2/mcp-servers` instead lists external servers Sim calls. Entries include client endpoints and tool names. A page shares a 2,000-name budget, so trailing servers may show partial inventories; read a server's tools endpoint for its full set. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "mcp_servers.workflow_deployments.list", + "x-oauth-scope": "api:read", "tags": ["MCP Servers"], "parameters": [ { @@ -3504,7 +3580,9 @@ "post": { "operationId": "createWorkflowMcpServer", "summary": "Create Workflow MCP Server", - "description": "Publish a new MCP server for a workspace, optionally seeding it with workflows to expose as tools. Every workflow named in `workflowIds` must already be deployed. Setting `isPublic` lets any MCP client holding the server URL execute the workflows it publishes without a Sim API key. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Publish a new MCP server for a workspace, optionally seeding it with workflows to expose as tools. Every workflow named in `workflowIds` must already be deployed. Setting `isPublic` lets any MCP client holding the server URL execute the workflows it publishes without a Sim API key. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "mcp_servers.workflow_deployments.create_server", + "x-oauth-scope": "api:write", "tags": ["MCP Servers"], "requestBody": { "required": true, @@ -3576,7 +3654,9 @@ "get": { "operationId": "getWorkflowMcpServer", "summary": "Get Workflow MCP Server", - "description": "Read one published MCP server. The list is the only other place this state is published, so a caller holding a server id would otherwise have to page the collection and filter client-side. The tools it publishes are on its `tools` sub-resource. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Read one published MCP server. The list is the only other place this state is published, so a caller holding a server id would otherwise have to page the collection and filter client-side. The tools it publishes are on its `tools` sub-resource. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "mcp_servers.workflow_deployments.read_server", + "x-oauth-scope": "api:read", "tags": ["MCP Servers"], "parameters": [ { @@ -3639,7 +3719,9 @@ "patch": { "operationId": "updateWorkflowMcpServer", "summary": "Update Workflow MCP Server", - "description": "Rename, re-describe, or change the public visibility of a published MCP server. Merge-patch shaped: an omitted key is unchanged and `description: null` clears the description. Publishing and unpublishing the workflows it serves are separate operations on its `tools` sub-resource. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Rename, re-describe, or change the public visibility of a published MCP server. Merge-patch shaped: an omitted key is unchanged and `description: null` clears the description. Publishing and unpublishing the workflows it serves are separate operations on its `tools` sub-resource. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "mcp_servers.workflow_deployments.update_server", + "x-oauth-scope": "api:write", "tags": ["MCP Servers"], "parameters": [ { @@ -3722,7 +3804,9 @@ "delete": { "operationId": "deleteWorkflowMcpServer", "summary": "Delete Workflow MCP Server", - "description": "Unpublish an MCP server. Every tool it served stops answering and connected clients lose the endpoint. The workflows themselves are untouched — their own deployments stay live and executable through the workflow API. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Unpublish an MCP server. Every tool it served stops answering and connected clients lose the endpoint. The workflows themselves are untouched — their own deployments stay live and executable through the workflow API. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "mcp_servers.workflow_deployments.delete_server", + "x-oauth-scope": "api:write", "tags": ["MCP Servers"], "parameters": [ { @@ -3790,7 +3874,9 @@ "get": { "operationId": "listWorkflowMcpTools", "summary": "List Workflow MCP Tools", - "description": "Every tool a server publishes, tool-name ordered. The server list reports tool *names* only, so this is where a caller reads the `workflowId` that `DELETE /api/v2/workflow-mcp-servers/{serverId}/tools/{workflowId}` addresses. Returned in one page rather than paged — so `nextCursor` is always null — and capped at 2,000 tools, which is far above any real server's inventory. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Every tool a server publishes, tool-name ordered. The server list reports tool *names* only, so this is where a caller reads the `workflowId` that `DELETE /api/v2/workflow-mcp-servers/{serverId}/tools/{workflowId}` addresses. Returned in one page rather than paged — so `nextCursor` is always null — and capped at 2,000 tools, which is far above any real server's inventory. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "mcp_servers.workflow_deployments.list_tools", + "x-oauth-scope": "api:read", "tags": ["MCP Servers"], "parameters": [ { @@ -3853,7 +3939,9 @@ "post": { "operationId": "deployWorkflowMcpTool", "summary": "Publish Workflow As MCP Tool", - "description": "Publish a deployed workflow as a tool on an MCP server. The tool's input schema is generated from the deployed workflow's input format, so the workflow must already be deployed. Idempotent per workflow: a server carries at most one tool per workflow, so a repeat call replaces the existing tool and answers `200` with `updated: true` rather than conflicting. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Publish a deployed workflow as a tool on an MCP server. The tool's input schema is generated from the deployed workflow's input format, so the workflow must already be deployed. Idempotent per workflow: a server carries at most one tool per workflow, so a repeat call replaces the existing tool and answers `200` with `updated: true` rather than conflicting. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "mcp_servers.workflow_deployments.deploy_tool", + "x-oauth-scope": "api:write", "tags": ["MCP Servers"], "parameters": [ { @@ -3938,7 +4026,9 @@ "delete": { "operationId": "undeployWorkflowMcpTool", "summary": "Unpublish Workflow MCP Tool", - "description": "Remove a workflow from an MCP server. Addressed by workflow rather than by tool identifier, because a server carries at most one live tool per workflow. The workflow's own deployment is untouched. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Remove a workflow from an MCP server. Addressed by workflow rather than by tool identifier, because a server carries at most one live tool per workflow. The workflow's own deployment is untouched. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "mcp_servers.workflow_deployments.undeploy_tool", + "x-oauth-scope": "api:write", "tags": ["MCP Servers"], "parameters": [ { @@ -4017,7 +4107,9 @@ "get": { "operationId": "listBlocks", "summary": "List Blocks", - "description": "List the blocks available in a workspace, built-in and workspace-deployed alike, discriminated by `source`. Availability is caller-specific: the workspace’s integration allowlist, the organization’s revealed preview blocks, and the deployment’s allowlist all narrow the result. Use `capability=trigger` for the blocks that can start a workflow. Summaries name their tools and operations by id — resolve one with Get Block or Get Tool.", + "description": "List the blocks available in a workspace, built-in and workspace-deployed alike, discriminated by `source`. Availability is caller-specific: the workspace’s integration allowlist, the organization’s revealed preview blocks, and the deployment’s allowlist all narrow the result. Use `capability=trigger` for the blocks that can start a workflow. Summaries name their tools and operations by id — resolve one with Get Block or Get Tool.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "catalog.blocks.list", + "x-oauth-scope": "api:read", "tags": ["Catalog"], "parameters": [ { @@ -4176,7 +4268,9 @@ "get": { "operationId": "getBlock", "summary": "Get Block", - "description": "Read one block’s full configuration shape: its fields and their conditions, its operations with the tool each runs, every tool’s parameters and outputs, and its triggers. An unversioned base type resolves to the newest version this caller can see — `confluence` answers with `confluence_v2` — and the returned `id` is always the resolved one, matching Get Tool. A block this caller cannot see answers 404, identically to one that does not exist.", + "description": "Read one block’s full configuration shape: its fields and their conditions, its operations with the tool each runs, every tool’s parameters and outputs, and its triggers. An unversioned base type resolves to the newest version this caller can see — `confluence` answers with `confluence_v2` — and the returned `id` is always the resolved one, matching Get Tool. A block this caller cannot see answers 404, identically to one that does not exist.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "catalog.blocks.read", + "x-oauth-scope": "api:read", "tags": ["Catalog"], "parameters": [ { @@ -4254,7 +4348,9 @@ "get": { "operationId": "listTools", "summary": "List Tools", - "description": "List the built-in tools available in a workspace. Built-in tools only: a workspace’s MCP tools are discovered per server on List MCP Server Tools, and its code-backed custom tools are on List Custom Tools. A tool is available when a block the caller can see exposes it, so the same allowlist and visibility rules as List Blocks apply.", + "description": "List the built-in tools available in a workspace. Built-in tools only: a workspace’s MCP tools are discovered per server on List MCP Server Tools, and its code-backed custom tools are on List Custom Tools. A tool is available when a block the caller can see exposes it, so the same allowlist and visibility rules as List Blocks apply.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "catalog.tools.list", + "x-oauth-scope": "api:read", "tags": ["Catalog"], "parameters": [ { @@ -4403,7 +4499,9 @@ "get": { "operationId": "getTool", "summary": "Get Tool", - "description": "Read one built-in tool’s declared parameters and outputs. A name that is itself a registered id answers as that exact tool; a name that is not resolves to the newest version of its family. The returned `id` is always the one that answered, so a caller can see which version it got. A tool the workspace’s visible blocks do not expose answers `404`, identically to one that does not exist.", + "description": "Read one built-in tool’s declared parameters and outputs. A name that is itself a registered id answers as that exact tool; a name that is not resolves to the newest version of its family. The returned `id` is always the one that answered, so a caller can see which version it got. A tool the workspace’s visible blocks do not expose answers `404`, identically to one that does not exist.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "catalog.tools.read", + "x-oauth-scope": "api:read", "tags": ["Catalog"], "parameters": [ { @@ -4481,7 +4579,9 @@ "post": { "operationId": "executeTool", "summary": "Run Tool", - "description": "Run a built-in tool using published parameter IDs. Sim resolves `credentialId`, hosted keys, and whole-value `{{VAR_NAME}}` references for `user-only` parameters; other values pass through verbatim. Third-party refusal returns `200` with `status: \"failed\"`; the error envelope covers API failures. Hidden or missing tools return `404`; disallowed integrations return `403` with `error.details.code: INTEGRATION_NOT_ALLOWED`. Hosted-key use is billed to the workspace. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Run a built-in tool using published parameter IDs. Sim resolves `credentialId`, hosted keys, and whole-value `{{VAR_NAME}}` references for `user-only` parameters; other values pass through verbatim. Third-party refusal returns `200` with `status: \"failed\"`; the error envelope covers API failures. Hidden or missing tools return `404`; disallowed integrations return `403` with `error.details.code: INTEGRATION_NOT_ALLOWED`. Hosted-key use is billed to the workspace. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tools.execute", + "x-oauth-scope": "api:write", "tags": ["Catalog"], "parameters": [ { @@ -4564,7 +4664,9 @@ "get": { "operationId": "listConnectorTypes", "summary": "List Connector Types", - "description": "List connector types and accepted source configuration. A field with `multi: true` stores `string[]`. `canonicalParamId` links picker and manual fields that write the same key; send exactly one, keyed by `canonicalParamId` rather than its own `id`. The bounded set is returned in one page; `nextCursor` is always null.", + "description": "List connector types and accepted source configuration. A field with `multi: true` stores `string[]`. `canonicalParamId` links picker and manual fields that write the same key; send exactly one, keyed by `canonicalParamId` rather than its own `id`. The bounded set is returned in one page; `nextCursor` is always null.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "catalog.connector_types.list", + "x-oauth-scope": "api:read", "tags": ["Catalog"], "parameters": [ { @@ -4651,7 +4753,7 @@ "type": "http", "scheme": "bearer", "bearerFormat": "OAuth 2.0 access token", - "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. The token must carry the scope required by the operation." + "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. Each operation declares its required scope: api:read permits reads and searches; api:write also permits changes and execution and implies api:read. Scope requirements follow the application operation, independent of HTTP method or workspace role." } }, "headers": { diff --git a/apps/docs/openapi-v2-tables.json b/apps/docs/openapi-v2-tables.json index d32fc5f75d8..e1452f2466c 100644 --- a/apps/docs/openapi-v2-tables.json +++ b/apps/docs/openapi-v2-tables.json @@ -39,7 +39,9 @@ "get": { "operationId": "listTables", "summary": "List Tables", - "description": "List tables in a workspace with optional folder filtering, search, sorting, and an opaque cursor envelope. `scope=archived` lists tables a `DELETE` archived, which `POST /api/v2/tables/{tableId}/restore` can bring back. A workspace folder tree over 10,000 folders is a `413`.", + "description": "List tables in a workspace with optional folder filtering, search, sorting, and an opaque cursor envelope. `scope=archived` lists tables a `DELETE` archived, which `POST /api/v2/tables/{tableId}/restore` can bring back. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.list", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -186,7 +188,9 @@ "post": { "operationId": "createTable", "summary": "Create Table", - "description": "Create a table with a typed column schema and optional folder placement.", + "description": "Create a table with a typed column schema and optional folder placement.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.create", + "x-oauth-scope": "api:write", "tags": ["Tables"], "requestBody": { "required": true, @@ -258,7 +262,9 @@ "get": { "operationId": "getTable", "summary": "Get Table", - "description": "Retrieve a table with its metadata, column schema, locks, and current job. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Retrieve a table with its metadata, column schema, locks, and current job. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.read", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -335,7 +341,9 @@ "delete": { "operationId": "deleteTable", "summary": "Delete Table", - "description": "Archive a table and return an explicit deletion acknowledgement. The table is soft-deleted, not erased: its rows are retained and `POST /api/v2/tables/{tableId}/restore` brings it back.", + "description": "Archive a table and return an explicit deletion acknowledgement. The table is soft-deleted, not erased: its rows are retained and `POST /api/v2/tables/{tableId}/restore` brings it back.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.delete", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -412,7 +420,9 @@ "patch": { "operationId": "updateTable", "summary": "Update Table", - "description": "Rename a table, edit its description, or move it to a canonical folder. At least one mutable field is required; lock flags are read-only.\n\nNOT atomic: fields are written independently, so a 4xx may follow a partial update. When fields were applied, `details.applied` names them; retry only the missing fields. If it is absent, nothing changed.\n\nA workspace folder tree over 10,000 folders is a `413`.", + "description": "Rename a table, edit its description, or move it to a canonical folder. At least one mutable field is required; lock flags are read-only.\n\nNOT atomic: fields are written independently, so a 4xx may follow a partial update. When fields were applied, `details.applied` names them; retry only the missing fields. If it is absent, nothing changed.\n\nA workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.update", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -497,7 +507,9 @@ "post": { "operationId": "addTableColumn", "summary": "Add Column", - "description": "Add a typed column and return the complete resulting table schema.", + "description": "Add a typed column and return the complete resulting table schema.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.columns.add", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -580,7 +592,9 @@ "patch": { "operationId": "updateTableColumn", "summary": "Update Column", - "description": "Update a column by name and return the complete resulting table schema.", + "description": "Update a column by name and return the complete resulting table schema.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.columns.update", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -663,7 +677,9 @@ "delete": { "operationId": "deleteTableColumn", "summary": "Delete Column", - "description": "Delete a column by name while preserving at least one table column.", + "description": "Delete a column by name while preserving at least one table column.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.columns.delete", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -748,7 +764,9 @@ "get": { "operationId": "listTableRows", "summary": "List Rows", - "description": "List a plain cursor page in default row order. Pages are capped at 5MB by default and may contain fewer rows than the requested limit; continue until nextCursor is null. Use the query endpoint for predicate filtering and sorting. Set `includeRunState=true` to attach each row's per-workflow-group run outcomes; the row limit is capped when it is set.", + "description": "List a plain cursor page in default row order. Pages are capped at 5MB by default and may contain fewer rows than the requested limit; continue until nextCursor is null. Use the query endpoint for predicate filtering and sorting. Set `includeRunState=true` to attach each row's per-workflow-group run outcomes; the row limit is capped when it is set.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.rows.list", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -857,7 +875,9 @@ "post": { "operationId": "createTableRows", "summary": "Create Rows", - "description": "Insert one row with a data object or insert a bounded batch with a rows array. Cell keys are column names.", + "description": "Insert one row with a data object or insert a bounded batch with a rows array. Cell keys are column names.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.rows.create", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -940,7 +960,9 @@ "patch": { "operationId": "updateTableRows", "summary": "Update Rows by Filter", - "description": "Apply the same partial data patch to every row matching a non-empty predicate.", + "description": "Apply the same partial data patch to every row matching a non-empty predicate.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.rows.update_many", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -1023,7 +1045,9 @@ "delete": { "operationId": "deleteTableRows", "summary": "Delete Rows", - "description": "Delete rows by a non-empty predicate or an explicit bounded list of row identifiers.", + "description": "Delete rows by a non-empty predicate or an explicit bounded list of row identifiers.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.rows.delete_many", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -1108,7 +1132,9 @@ "get": { "operationId": "getTableRow", "summary": "Get Row", - "description": "Retrieve one row by identifier. Set `includeRunState=true` to attach the row's per-workflow-group run outcomes.", + "description": "Retrieve one row by identifier. Set `includeRunState=true` to attach the row's per-workflow-group run outcomes.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.rows.read", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -1203,7 +1229,9 @@ "patch": { "operationId": "updateTableRow", "summary": "Update Row", - "description": "Merge a partial data patch into one row by identifier.", + "description": "Merge a partial data patch into one row by identifier.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.rows.update", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -1297,7 +1325,9 @@ "delete": { "operationId": "deleteTableRow", "summary": "Delete Row", - "description": "Delete one row by identifier.", + "description": "Delete one row by identifier.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.rows.delete", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -1387,7 +1417,9 @@ "post": { "operationId": "upsertTableRow", "summary": "Upsert Row", - "description": "Insert a row or update the existing row that conflicts on a selected unique column.\n\nWARNING — the update branch REPLACES the row, it does not merge. `data` is the complete new row value, so every column you omit is cleared on the matched row. Send the full row here, or use `PATCH /api/v2/tables/{tableId}/rows/{rowId}` to change a subset.", + "description": "Insert a row or update the existing row that conflicts on a selected unique column.\n\nWARNING — the update branch REPLACES the row, it does not merge. `data` is the complete new row value, so every column you omit is cleared on the matched row. Send the full row here, or use `PATCH /api/v2/tables/{tableId}/rows/{rowId}` to change a subset.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.rows.upsert", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -1472,7 +1504,9 @@ "post": { "operationId": "queryTableRows", "summary": "Query Rows", - "description": "Query rows using an optional typed condition or `all`/`any` group, ordered sorting, and opaque cursor pagination. Omit the predicate to match all rows. Pages default to a 5 MB cap and may return fewer rows than requested; continue until `nextCursor` is null. Oversized predicates return `413`. `includeRunState` adds per-group outcomes and lowers the row cap. Counts come from a separate snapshot at `POST /query/count`; take the count first and treat it as a floor.", + "description": "Query rows using an optional typed condition or `all`/`any` group, ordered sorting, and opaque cursor pagination. Omit the predicate to match all rows. Pages default to a 5 MB cap and may return fewer rows than requested; continue until `nextCursor` is null. Oversized predicates return `413`. `includeRunState` adds per-group outcomes and lowers the row cap. Counts come from a separate snapshot at `POST /query/count`; take the count first and treat it as a floor.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.rows.query", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -1554,7 +1588,9 @@ "post": { "operationId": "countTableRows", "summary": "Count Rows", - "description": "Count the rows matching a typed predicate across the entire table. A predicate may be one condition or an `all`/`any` group. The paged reads carry no total, and `rowCount` on the table resource counts every row rather than the matches. Omit the predicate to count the whole table. A predicate larger than the request-body ceiling is a `413`.", + "description": "Count the rows matching a typed predicate across the entire table. A predicate may be one condition or an `all`/`any` group. The paged reads carry no total, and `rowCount` on the table resource counts every row rather than the matches. Omit the predicate to count the whole table. A predicate larger than the request-body ceiling is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.rows.query", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -1636,7 +1672,9 @@ "get": { "operationId": "listTableViews", "summary": "List Views", - "description": "List the bounded set of saved table views, with references to removed columns pruned on read. The bounded set is returned in one page; `nextCursor` is always null.", + "description": "List the bounded set of saved table views, with references to removed columns pruned on read. The bounded set is returned in one page; `nextCursor` is always null.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.views.list", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -1710,7 +1748,9 @@ "post": { "operationId": "createTableView", "summary": "Create View", - "description": "Save a filter, sort, and column layout as a named presentation of a table.", + "description": "Save a filter, sort, and column layout as a named presentation of a table.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.views.create", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -1792,7 +1832,9 @@ "get": { "operationId": "getTableView", "summary": "Get View", - "description": "Retrieve one saved table view by identifier.", + "description": "Retrieve one saved table view by identifier.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.views.read", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -1877,7 +1919,9 @@ "patch": { "operationId": "updateTableView", "summary": "Update View", - "description": "Rename a view, replace or shallow-merge its configuration, or promote it to the table default.", + "description": "Rename a view, replace or shallow-merge its configuration, or promote it to the table default.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.views.update", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -1968,7 +2012,9 @@ "delete": { "operationId": "deleteTableView", "summary": "Delete View", - "description": "Delete a saved presentation without changing any table rows.", + "description": "Delete a saved presentation without changing any table rows.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.views.delete", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -2055,7 +2101,9 @@ "get": { "operationId": "listTableWorkflowGroups", "summary": "List Workflow Groups", - "description": "List the workflow and enrichment groups that can be dispatched for a table. The bounded set is returned in one page; `nextCursor` is always null.", + "description": "List the workflow and enrichment groups that can be dispatched for a table. The bounded set is returned in one page; `nextCursor` is always null.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.groups.list", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -2129,7 +2177,9 @@ "post": { "operationId": "addTableWorkflowGroup", "summary": "Add Workflow Group", - "description": "Bind a workflow or enrichment to the table and create the columns populated by its outputs.", + "description": "Bind a workflow or enrichment to the table and create the columns populated by its outputs.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.groups.create", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -2212,7 +2262,9 @@ "patch": { "operationId": "updateTableWorkflowGroup", "summary": "Update Workflow Group", - "description": "Restructure a workflow group, its producer, outputs, or execution behavior. Repointing the group at a different workflow concurrently invalidates the resolved output types and returns `409` — retry the update.", + "description": "Restructure a workflow group, its producer, outputs, or execution behavior. Repointing the group at a different workflow concurrently invalidates the resolved output types and returns `409` — retry the update.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.groups.update", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -2298,7 +2350,9 @@ "delete": { "operationId": "deleteTableWorkflowGroup", "summary": "Delete Workflow Group", - "description": "Delete a workflow group and every table column populated by that group.", + "description": "Delete a workflow group and every table column populated by that group.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.groups.delete", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -2383,7 +2437,9 @@ "post": { "operationId": "createTableDispatch", "summary": "Create Run Dispatch", - "description": "Asynchronously run workflow or enrichment groups across all rows or a selected row subset. Poll the returned `dispatchId` with `GET /api/v2/tables/{tableId}/dispatches/{dispatchId}` until its status is `complete` or `canceled`, and cancel it with `DELETE` on the same path. A `null` `dispatchId` means the run settled inline and there is nothing to poll.", + "description": "Asynchronously run workflow or enrichment groups across all rows or a selected row subset. Poll the returned `dispatchId` with `GET /api/v2/tables/{tableId}/dispatches/{dispatchId}` until its status is `complete` or `canceled`, and cancel it with `DELETE` on the same path. A `null` `dispatchId` means the run settled inline and there is nothing to poll.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.runs.start", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -2463,7 +2519,9 @@ "get": { "operationId": "listTableDispatches", "summary": "List Active Run Dispatches", - "description": "List the run dispatches still in flight on one table. Bounded by the dispatcher rather than by a page size, so this list is unpaginated and `nextCursor` is always null. A settled dispatch is read by identifier.", + "description": "List the run dispatches still in flight on one table. Bounded by the dispatcher rather than by a page size, so this list is unpaginated and `nextCursor` is always null. A settled dispatch is read by identifier.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.runs.read", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -2539,7 +2597,9 @@ "post": { "operationId": "runRowEnrichment", "summary": "Run Enrichment For One Row", - "description": "Asynchronously run one workflow or enrichment group for one table row. Poll the returned `dispatchId` with `GET /api/v2/tables/{tableId}/dispatches/{dispatchId}`; a `null` `dispatchId` means the cell already settled inline.", + "description": "Asynchronously run one workflow or enrichment group for one table row. Poll the returned `dispatchId` with `GET /api/v2/tables/{tableId}/dispatches/{dispatchId}`; a `null` `dispatchId` means the cell already settled inline.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.runs.start", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -2641,7 +2701,9 @@ "get": { "operationId": "getRowEnrichment", "summary": "Get Enrichment Run Detail", - "description": "Retrieve the provider cascade behind one enrichment cell: every configured provider in cascade order, each one's status, hosted-key cost, and duration, plus which provider produced the match. `null` means the cell has never run, or ran before cascade detail was recorded — distinct from a `404`, which means the table, row, or group does not exist.", + "description": "Retrieve the provider cascade behind one enrichment cell: every configured provider in cascade order, each one's status, hosted-key cost, and duration, plus which provider produced the match. `null` means the cell has never run, or ran before cascade detail was recorded — distinct from a `404`, which means the table, row, or group does not exist.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.rows.read", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -2739,7 +2801,9 @@ "post": { "operationId": "searchTableRows", "summary": "Search Rows", - "description": "Search every cell case-insensitively for substring `q`, optionally within a predicate-filtered, sorted view. This is text search; `POST /query` performs structured predicate reads. Results are cell coordinates `{ ordinal, rowId, column }`, never row data; `ordinal` indexes the same view paged by `POST /query`. Results are uncursored and capped at 1000; `truncated` signals more matches. Narrow `q` or the predicate instead of paging.", + "description": "Search every cell case-insensitively for substring `q`, optionally within a predicate-filtered, sorted view. This is text search; `POST /query` performs structured predicate reads. Results are cell coordinates `{ ordinal, rowId, column }`, never row data; `ordinal` indexes the same view paged by `POST /query`. Results are uncursored and capped at 1000; `truncated` signals more matches. Narrow `q` or the predicate instead of paging.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.rows.search", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -2821,7 +2885,9 @@ "post": { "operationId": "createTableImport", "summary": "Create Table Import", - "description": "Create a durable CSV import. Upload sources receive signed transfer instructions; workspace-file sources begin processing directly.", + "description": "Create a durable CSV import. Upload sources receive signed transfer instructions; workspace-file sources begin processing directly.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.imports.create", + "x-oauth-scope": "api:write", "tags": ["Tables"], "requestBody": { "required": true, @@ -2896,7 +2962,9 @@ "get": { "operationId": "getTableImport", "summary": "Get Table Import", - "description": "Read progress and terminal state for a durable table import.\n\nAn upload-backed import has no durable record until its upload completes, so send the signed upload control token to read it during the `uploading` phase; without the token that phase is a `404`.", + "description": "Read progress and terminal state for a durable table import.\n\nAn upload-backed import has no durable record until its upload completes, so send the signed upload control token to read it during the `uploading` phase; without the token that phase is a `404`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.imports.read", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -2982,7 +3050,9 @@ "delete": { "operationId": "cancelTableImport", "summary": "Cancel Table Import", - "description": "Cancel an upload or processing import without rolling back committed row batches.\n\nAn import that is not in a cancelable state, including an `expired` one, is a `409` naming the current status. An unknown or already-purged import id is a `404`.", + "description": "Cancel an upload or processing import without rolling back committed row batches.\n\nAn import that is not in a cancelable state, including an `expired` one, is a `409` naming the current status. An unknown or already-purged import id is a `404`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.imports.cancel", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -3073,7 +3143,9 @@ "post": { "operationId": "createTableImportPartUrls", "summary": "Create Table Import Part URLs", - "description": "Issue short-lived signed PUT URLs for a bounded set of multipart part numbers.\n\nThe import must still be `uploading`; one that has moved on, including an `expired` one, is a `409` naming the current status. An unknown or already-purged import id is a `404`.", + "description": "Issue short-lived signed PUT URLs for a bounded set of multipart part numbers.\n\nThe import must still be `uploading`; one that has moved on, including an `expired` one, is a `409` naming the current status. An unknown or already-purged import id is a `404`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.imports.create_parts", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -3181,7 +3253,9 @@ "post": { "operationId": "completeTableImportUpload", "summary": "Complete Table Import Upload", - "description": "Verify or assemble the uploaded CSV and begin processing with the same import id.\n\nAn import no longer awaiting an upload, including an `expired` one, is a `409` naming the current status. An unknown or already-purged import id is a `404`.", + "description": "Verify or assemble the uploaded CSV and begin processing with the same import id.\n\nAn import no longer awaiting an upload, including an `expired` one, is a `409` naming the current status. An unknown or already-purged import id is a `404`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.imports.complete", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -3275,7 +3349,9 @@ "post": { "operationId": "createTableExport", "summary": "Create Table Export", - "description": "Create a durable CSV or JSON export that completes inline for small tables and queues larger work.", + "description": "Create a durable CSV or JSON export that completes inline for small tables and queues larger work.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.exports.create", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -3360,7 +3436,9 @@ "get": { "operationId": "getTableExport", "summary": "Get Table Export", - "description": "Read progress and terminal state for a durable table export.", + "description": "Read progress and terminal state for a durable table export.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.exports.read", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -3446,7 +3524,9 @@ "delete": { "operationId": "cancelTableExport", "summary": "Cancel Table Export", - "description": "Cancel an export that has not reached a terminal state.", + "description": "Cancel an export that has not reached a terminal state.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.exports.cancel", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -3537,7 +3617,9 @@ "get": { "operationId": "downloadTableExport", "summary": "Download Table Export", - "description": "Return a short-lived signed download URL for a completed table export.\n\nThe export must have reached `completed`; one still processing, failed, or canceled is a `409` naming the current status. An export whose file is no longer available is a `404`, not a `410`.", + "description": "Return a short-lived signed download URL for a completed table export.\n\nThe export must have reached `completed`; one still processing, failed, or canceled is a `409` naming the current status. An export whose file is no longer available is a `404`, not a `410`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.exports.download", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -3628,7 +3710,9 @@ "post": { "operationId": "cancelTableRuns", "summary": "Cancel Column Runs", - "description": "Stop in-flight and pending workflow or enrichment cell runs across the table or one selected row.", + "description": "Stop in-flight and pending workflow or enrichment cell runs across the table or one selected row.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.runs.cancel", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -3710,7 +3794,9 @@ "get": { "operationId": "listTablesFolders", "summary": "List Folders", - "description": "List table folders, optionally restricting the result to direct children of a canonical parent path. The bounded set is returned in one page; `nextCursor` is always null.", + "description": "List table folders, optionally restricting the result to direct children of a canonical parent path. The bounded set is returned in one page; `nextCursor` is always null.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.folders.list", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -3823,7 +3909,9 @@ "post": { "operationId": "createTablesFolder", "summary": "Create Folder", - "description": "Create one table-folder leaf whose parent path already exists.", + "description": "Create one table-folder leaf whose parent path already exists.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.folders.create", + "x-oauth-scope": "api:write", "tags": ["Tables"], "requestBody": { "required": true, @@ -3893,7 +3981,9 @@ "patch": { "operationId": "relocateTablesFolder", "summary": "Rename or Move Folder", - "description": "Rename or move a table folder and update all descendant paths.", + "description": "Rename or move a table folder and update all descendant paths.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.folders.update", + "x-oauth-scope": "api:write", "tags": ["Tables"], "requestBody": { "required": true, @@ -3963,7 +4053,9 @@ "delete": { "operationId": "deleteTablesFolder", "summary": "Delete Folder", - "description": "Delete an empty table folder, or recursively delete its descendants and tables when explicitly requested.", + "description": "Delete an empty table folder, or recursively delete its descendants and tables when explicitly requested.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.folders.delete", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -4073,7 +4165,9 @@ "post": { "operationId": "restoreTablesFolder", "summary": "Restore Folder", - "description": "Restore a recursively archived table folder with its subfolders and tables, addressed by its former path. If its parent remains archived, it is re-rooted to `/`; active-name conflicts are deduplicated, so use the returned `path`. Non-archived paths return `404`. Preserve the path returned by `DELETE /api/v2/tables/folders`: unlike the files API, the table-folder list cannot discover archived paths.", + "description": "Restore a recursively archived table folder with its subfolders and tables, addressed by its former path. If its parent remains archived, it is re-rooted to `/`; active-name conflicts are deduplicated, so use the returned `path`. Non-archived paths return `404`. Preserve the path returned by `DELETE /api/v2/tables/folders`: unlike the files API, the table-folder list cannot discover archived paths.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.folders.restore", + "x-oauth-scope": "api:write", "tags": ["Tables"], "requestBody": { "required": true, @@ -4145,7 +4239,9 @@ "post": { "operationId": "restoreTable", "summary": "Restore Table", - "description": "Un-archive a table a `DELETE` archived, along with the rows, views, and workflow groups archived with it. Find archived tables with `scope=archived` on the table list. Idempotent: a table that is already active is returned unchanged with no audit entry recorded, so a retry after a dropped response cannot look like a failure. A name collision is resolved by renaming, so the restored table may come back under a different `name`.", + "description": "Un-archive a table a `DELETE` archived, along with the rows, views, and workflow groups archived with it. Find archived tables with `scope=archived` on the table list. Idempotent: a table that is already active is returned unchanged with no audit entry recorded, so a retry after a dropped response cannot look like a failure. A name collision is resolved by renaming, so the restored table may come back under a different `name`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.restore", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -4230,7 +4326,9 @@ "post": { "operationId": "bulkUpdateTableRows", "summary": "Bulk Update Rows", - "description": "Apply a distinct partial data patch to each of up to 1000 rows in one request. Each patch merges into its row, so a column absent from `data` is left alone. Membership is atomic: a `rowId` naming no row in this table fails the whole request with a `400` listing the missing identifiers. Use `PATCH /api/v2/tables/{tableId}/rows` when one patch applies to every matching row.", + "description": "Apply a distinct partial data patch to each of up to 1000 rows in one request. Each patch merges into its row, so a column absent from `data` is left alone. Membership is atomic: a `rowId` naming no row in this table fails the whole request with a `400` listing the missing identifiers. Use `PATCH /api/v2/tables/{tableId}/rows` when one patch applies to every matching row.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.rows.update_many", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -4315,7 +4413,9 @@ "get": { "operationId": "getTableDispatch", "summary": "Get Run Dispatch", - "description": "Poll one workflow-column run dispatch by the `dispatchId` the run endpoints returned. Answers in every lifecycle state — `pending`, `dispatching`, `complete`, and `canceled` — so a poller can wait for a run to settle. Per-cell outcomes are read with `includeRunState` on the row endpoints.", + "description": "Poll one workflow-column run dispatch by the `dispatchId` the run endpoints returned. Answers in every lifecycle state — `pending`, `dispatching`, `complete`, and `canceled` — so a poller can wait for a run to settle. Per-cell outcomes are read with `includeRunState` on the row endpoints.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "tables.runs.read", + "x-oauth-scope": "api:read", "tags": ["Tables"], "parameters": [ { @@ -4401,7 +4501,9 @@ "delete": { "operationId": "cancelTableDispatch", "summary": "Cancel Run Dispatch", - "description": "Cancel one run dispatch by the `dispatchId` the run endpoint returned. This stops the scheduler: the dispatcher observes the cancellation at its next iteration and enqueues no further cells. Cells already handed to the queue are NOT canceled here — nothing links a queued cell back to the dispatch that enqueued it — so use `POST /api/v2/tables/{tableId}/cancel-runs` to stop work already in flight. Idempotent: a dispatch already `complete` or `canceled` is returned unchanged.", + "description": "Cancel one run dispatch by the `dispatchId` the run endpoint returned. This stops the scheduler: the dispatcher observes the cancellation at its next iteration and enqueues no further cells. Cells already handed to the queue are NOT canceled here — nothing links a queued cell back to the dispatch that enqueued it — so use `POST /api/v2/tables/{tableId}/cancel-runs` to stop work already in flight. Idempotent: a dispatch already `complete` or `canceled` is returned unchanged.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.runs.cancel", + "x-oauth-scope": "api:write", "tags": ["Tables"], "parameters": [ { @@ -4489,7 +4591,9 @@ "post": { "operationId": "moveTables", "summary": "Move Tables and Folders", - "description": "Move up to 100 tables and canonical-path folders to one destination; `null` or `/` means the workspace root. Processing is best-effort per item: tables already carried by selected folders are `skipped`, missing items are `notFound`, and lock or cycle refusals are `failed` with reasons. An invalid destination rejects the entire request before any move.", + "description": "Move up to 100 tables and canonical-path folders to one destination; `null` or `/` means the workspace root. Processing is best-effort per item: tables already carried by selected folders are `skipped`, missing items are `notFound`, and lock or cycle refusals are `failed` with reasons. An invalid destination rejects the entire request before any move.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.bulk_move", + "x-oauth-scope": "api:write", "tags": ["Tables"], "requestBody": { "required": true, @@ -4558,7 +4662,9 @@ "post": { "operationId": "bulkDeleteTables", "summary": "Bulk Delete Tables and Folders", - "description": "Archive up to 100 tables and delete table folders in a single authorized request. Folders are named by canonical path and each cascades to everything inside it; `deletedItems` reports the totals across every cascade. Archived tables stay recoverable through `POST /api/v2/tables/{tableId}/restore`. Best-effort per item, with the same `skipped` / `notFound` / `failed` dispositions as the bulk move.", + "description": "Archive up to 100 tables and delete table folders in a single authorized request. Folders are named by canonical path and each cascades to everything inside it; `deletedItems` reports the totals across every cascade. Archived tables stay recoverable through `POST /api/v2/tables/{tableId}/restore`. Best-effort per item, with the same `skipped` / `notFound` / `failed` dispositions as the bulk move.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "tables.bulk_delete", + "x-oauth-scope": "api:write", "tags": ["Tables"], "requestBody": { "required": true, @@ -4639,7 +4745,7 @@ "type": "http", "scheme": "bearer", "bearerFormat": "OAuth 2.0 access token", - "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. The token must carry the scope required by the operation." + "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. Each operation declares its required scope: api:read permits reads and searches; api:write also permits changes and execution and implies api:read. Scope requirements follow the application operation, independent of HTTP method or workspace role." } }, "headers": { diff --git a/apps/docs/openapi-v2-workflows.json b/apps/docs/openapi-v2-workflows.json index c1f23f03188..1b6540e94fb 100644 --- a/apps/docs/openapi-v2-workflows.json +++ b/apps/docs/openapi-v2-workflows.json @@ -43,7 +43,9 @@ "get": { "operationId": "listWorkflows", "summary": "List Workflows", - "description": "List workflows in a workspace with lifecycle scope, folder and deployment filters, search, sorting, and opaque cursor pagination. `scope` defaults to `active`; pass `archived` to list workflows a `DELETE` archived. A workspace folder tree over 10,000 folders is a `413`.", + "description": "List workflows in a workspace with lifecycle scope, folder and deployment filters, search, sorting, and opaque cursor pagination. `scope` defaults to `active`; pass `archived` to list workflows a `DELETE` archived. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.list", + "x-oauth-scope": "api:read", "tags": ["Workflows"], "parameters": [ { @@ -202,7 +204,9 @@ "post": { "operationId": "createWorkflowV2", "summary": "Create Workflow", - "description": "Create a workflow in a workspace root or canonical workflow folder. The response carries the blocks the platform seeded the workflow with, so the start block's id is available without a second request — attach edges to it directly. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Create a workflow in a workspace root or canonical workflow folder. The response carries the blocks the platform seeded the workflow with, so the start block's id is available without a second request — attach edges to it directly. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.create", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "requestBody": { "required": true, @@ -277,7 +281,9 @@ "get": { "operationId": "getWorkflowState", "summary": "Get Workflow State", - "description": "Get the editable draft graph: blocks, edges, derived loop and parallel containers, and variables. This pollable read records no audit event, and `HEAD` mirrors `GET`. The unsanitized payload includes workspace-scoped credential, knowledge-base, and table ids, so it is not portable. Use `export` for a sanitized copy, but not for read-modify-write because credential bindings are removed. Returned keys exactly match what `PUT /workflows/{workflowId}/state` accepts.", + "description": "Get the editable draft graph: blocks, edges, derived loop and parallel containers, and variables. This pollable read records no audit event, and `HEAD` mirrors `GET`. The unsanitized payload includes workspace-scoped credential, knowledge-base, and table ids, so it is not portable. Use `export` for a sanitized copy, but not for read-modify-write because credential bindings are removed. Returned keys exactly match what `PUT /workflows/{workflowId}/state` accepts.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.read", + "x-oauth-scope": "api:read", "tags": ["Workflows"], "parameters": [ { @@ -341,7 +347,9 @@ "put": { "operationId": "replaceWorkflowState", "summary": "Replace Workflow State", - "description": "Atomically replace the editable draft graph. Concurrent writes are row-locked and last-write-wins; no partial state is stored. `loops` and `parallels` are recomputed from `blocks`; omitted `variables` remain unchanged. Foreign ids return `409`. This leaves deployment unchanged and marks the draft for redeployment; lint is advisory. `dryRun=true` runs the same validation, lint, and conflict checks without persistence, audit, or notification; `needsRedeployment` reflects pre-write state. Workspace keys are rejected; use personal keys or OAuth.", + "description": "Atomically replace the editable draft graph. Concurrent writes are row-locked and last-write-wins; no partial state is stored. `loops` and `parallels` are recomputed from `blocks`; omitted `variables` remain unchanged. Foreign ids return `409`. This leaves deployment unchanged and marks the draft for redeployment; lint is advisory. `dryRun=true` runs the same validation, lint, and conflict checks without persistence, audit, or notification; `needsRedeployment` reflects pre-write state. Workspace keys are rejected; use personal keys or OAuth.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.state.replace", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -440,7 +448,9 @@ "post": { "operationId": "applyWorkflowOperations", "summary": "Apply Workflow Operations", - "description": "Apply graph edits and optional block enablement in one atomic write. Failed operations appear in `skipped`; `deferred` edges resolve when targets exist and must not be retried. With `atomic`, any skip or dropped input returns `409` with `OPERATIONS_NOT_APPLIED` and persists nothing. Non-UUID labels are minted and same-batch references remapped in `mintedBlockIds`. Lint is advisory. `dryRun=true` runs the same checks without persistence, audit, or notification. This changes only the draft. Workspace keys are rejected; use personal keys or OAuth.", + "description": "Apply graph edits and optional block enablement atomically. Failed operations appear in `skipped`; `deferred` edges resolve when targets exist and must not be retried. With `atomic`, any skip or dropped input returns `409` with `OPERATIONS_NOT_APPLIED` and persists nothing. Non-UUID labels are minted and same-batch references remapped in `mintedBlockIds`. Lint is advisory. `dryRun=true` runs the same checks without persistence, audit, or notification. This changes only the draft. Workspace keys are rejected; use personal keys or OAuth.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.operations.apply", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -539,7 +549,9 @@ "patch": { "operationId": "applyWorkflowVariables", "summary": "Update Workflow Variables", - "description": "Add, edit, and delete a workflow’s variables. Operations are matched by variable `name` and applied in order; a batch that changes nothing answers `200` with `changed: false`. Values are coerced to the declared `type`, and a value that cannot be coerced is stored as supplied. Read the current set from `variables` on `GET /workflows/{workflowId}`.", + "description": "Add, edit, and delete a workflow’s variables. Operations are matched by variable `name` and applied in order; a batch that changes nothing answers `200` with `changed: false`. Values are coerced to the declared `type`, and a value that cannot be coerced is stored as supplied. Read the current set from `variables` on `GET /workflows/{workflowId}`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.variables.apply_operations", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -628,7 +640,9 @@ "post": { "operationId": "duplicateWorkflow", "summary": "Duplicate Workflow", - "description": "Copy a workflow, including its blocks, edges, subflows, and variables, into the same workspace. Omitting `name` reuses the source name; a collision inside the destination folder is deduplicated rather than refused. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Copy a workflow, including its blocks, edges, subflows, and variables, into the same workspace. Omitting `name` reuses the source name; a collision inside the destination folder is deduplicated rather than refused. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.duplicate", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -717,7 +731,9 @@ "post": { "operationId": "restoreWorkflow", "summary": "Restore Workflow", - "description": "Bring an archived workflow back, along with the schedules, webhooks, MCP tools, and chats that were archived with it. A workflow that is not archived answers `409`. A workflow whose folder was archived is restored to the workspace root. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Bring an archived workflow back, along with the schedules, webhooks, MCP tools, and chats that were archived with it. A workflow that is not archived answers `409`. A workflow whose folder was archived is restored to the workspace root. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.restore", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -792,7 +808,9 @@ "post": { "operationId": "moveWorkflows", "summary": "Move Workflows", - "description": "Relocate up to 100 workflows into one folder. Explicitly best-effort: each workflow moves in its own transaction, and one that is absent from the workspace, archived, or locked lands in `failed` while the rest still move. Duplicate ids are collapsed. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Relocate up to 100 workflows into one folder. Explicitly best-effort: each workflow moves in its own transaction, and one that is absent from the workspace, archived, or locked lands in `failed` while the rest still move. Duplicate ids are collapsed. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.bulk.move", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "requestBody": { "required": true, @@ -861,7 +879,9 @@ "get": { "operationId": "getWorkflow", "summary": "Get Workflow", - "description": "Get a workflow with its variables and deployed API-trigger inputs. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Get a workflow with its variables and deployed API-trigger inputs. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.read", + "x-oauth-scope": "api:read", "tags": ["Workflows"], "parameters": [ { @@ -928,7 +948,9 @@ "patch": { "operationId": "updateWorkflowV2", "summary": "Update Workflow", - "description": "Rename, describe, or move a workflow to a canonical folder path. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Rename, describe, or move a workflow to a canonical folder path. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.update", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -1015,7 +1037,9 @@ "delete": { "operationId": "deleteWorkflowV2", "summary": "Delete Workflow", - "description": "Archive a workflow. Despite the verb, this is not an erasure: the workflow, and the schedules, webhooks, MCP tools, and chats attached to it, are stamped archived and stop running, and `POST /workflows/{workflowId}/restore` brings all of them back. An archived workflow disappears from the default list and is reachable with `scope=archived`. The `deleted` field is retained for shipped clients; `archived` states what actually happened.", + "description": "Archive a workflow. Despite the verb, this is not an erasure: the workflow, and the schedules, webhooks, MCP tools, and chats attached to it, are stamped archived and stop running, and `POST /workflows/{workflowId}/restore` brings all of them back. An archived workflow disappears from the default list and is reachable with `scope=archived`. The `deleted` field is retained for shipped clients; `archived` states what actually happened.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.delete", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -1084,7 +1108,9 @@ "get": { "operationId": "listWorkflowVersionsV2", "summary": "List Workflow Versions", - "description": "List immutable deployment versions of a workflow, newest first.", + "description": "List immutable deployment versions of a workflow, newest first.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.versions.list", + "x-oauth-scope": "api:read", "tags": ["Workflows"], "parameters": [ { @@ -1174,7 +1200,9 @@ "get": { "operationId": "getWorkflowVersionV2", "summary": "Get Workflow Version", - "description": "Get an immutable deployment version and its pinned workflow graph snapshot.", + "description": "Get an immutable deployment version and its pinned workflow graph snapshot.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.versions.read", + "x-oauth-scope": "api:read", "tags": ["Workflows"], "parameters": [ { @@ -1250,7 +1278,9 @@ "patch": { "operationId": "updateWorkflowVersionV2", "summary": "Update Workflow Version", - "description": "Relabel a deployment version. Merge-patch shaped: an omitted key is unchanged and `description: null` clears the release note. Metadata only — the pinned graph is immutable, and this never changes which version is live. Promote a version with `POST /workflows/{workflowId}/versions/{version}/activate`.", + "description": "Relabel a deployment version. Merge-patch shaped: an omitted key is unchanged and `description: null` clears the release note. Metadata only — the pinned graph is immutable, and this never changes which version is live. Promote a version with `POST /workflows/{workflowId}/versions/{version}/activate`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.versions.update", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -1345,7 +1375,9 @@ "post": { "operationId": "activateWorkflowVersion", "summary": "Activate Workflow Version", - "description": "Promote an existing deployment version to live. Activation is asynchronous; inspect `isDeployed` and `latestDeploymentAttempt` for current state. Unlike `rollback`, the target is named by the path and the workflow need not already be deployed. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Promote an existing deployment version to live. Activation is asynchronous; inspect `isDeployed` and `latestDeploymentAttempt` for current state. Unlike `rollback`, the target is named by the path and the workflow need not already be deployed. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.versions.activate", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -1446,7 +1478,9 @@ "post": { "operationId": "revertWorkflowVersion", "summary": "Revert Workflow To Version", - "description": "Overwrite the editable draft with a deployment version, irreversibly discarding unsaved edits. This does not change the live version; use `activate` or `rollback` for production, both of which leave the draft unchanged. Pass `active` to reset the draft to the live graph. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Overwrite the editable draft with a deployment version, irreversibly discarding unsaved edits. This does not change the live version; use `activate` or `rollback` for production, both of which leave the draft unchanged. Pass `active` to reset the draft to the live graph. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.versions.revert", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -1555,7 +1589,9 @@ "get": { "operationId": "getWorkflowDeployment", "summary": "Get Workflow Deployment", - "description": "Read the live version, latest deployment attempt and readiness, draft drift (`needsRedeployment`), and `isPublicApi`. When `isPublicApi` is true, anyone with the execution URL can run and consume billed usage without an API key; change it with `PATCH /workflows/{workflowId}/deployment`. `/workflows/{workflowId}/deployment` controls overall API executability; `/deployments/chat` controls only the hosted-chat surface. A workflow can remain deployed without a chat.", + "description": "Read the live version, latest deployment attempt and readiness, draft drift (`needsRedeployment`), and `isPublicApi`. When `isPublicApi` is true, anyone with the execution URL can run and consume billed usage without an API key; change it with `PATCH /workflows/{workflowId}/deployment`. `/workflows/{workflowId}/deployment` controls overall API executability; `/deployments/chat` controls only the hosted-chat surface. A workflow can remain deployed without a chat.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.read", + "x-oauth-scope": "api:read", "tags": ["Workflows"], "parameters": [ { @@ -1619,7 +1655,9 @@ "patch": { "operationId": "updateWorkflowPublicApi", "summary": "Update Workflow Public API Access", - "description": "Enable or disable unauthenticated public execution of the deployed workflow. While enabled, anyone holding the execution URL can run the workflow without an API key. An organization that forbids public sharing refuses this with `403` and `PUBLIC_SHARING_NOT_ALLOWED`. `/workflows/{workflowId}/deployment` controls overall API executability; `/deployments/chat` controls only the hosted-chat surface. A workflow can remain deployed without a chat. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Enable or disable unauthenticated public execution of the deployed workflow. While enabled, anyone holding the execution URL can run the workflow without an API key. An organization that forbids public sharing refuses this with `403` and `PUBLIC_SHARING_NOT_ALLOWED`. `/workflows/{workflowId}/deployment` controls overall API executability; `/deployments/chat` controls only the hosted-chat surface. A workflow can remain deployed without a chat. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.public_api.update", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -1705,7 +1743,9 @@ "post": { "operationId": "deployWorkflow", "summary": "Deploy Workflow", - "description": "Create and asynchronously activate a deployment version. Not idempotent: every call mints a new version, so a retry after a timeout creates a second one. A deployment that would conflict with an existing webhook path is a `409`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Create and asynchronously activate a deployment version. Not idempotent: every call mints a new version, so a retry after a timeout creates a second one. A deployment that would conflict with an existing webhook path is a `409`. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.deploy", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -1792,7 +1832,9 @@ "delete": { "operationId": "undeployWorkflow", "summary": "Undeploy Workflow", - "description": "Deactivate the currently serving workflow version. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Deactivate the currently serving workflow version. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.undeploy", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -1861,7 +1903,9 @@ "post": { "operationId": "rollbackWorkflow", "summary": "Rollback Workflow", - "description": "Asynchronously reactivate a previous deployment version, selecting the preceding active version when no version is supplied. Use this to step back from the currently live version; to make a specific version live by naming it in the path — including when the workflow is not currently deployed — use `POST /workflows/{workflowId}/versions/{version}/activate`. Neither touches the draft. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Asynchronously reactivate a previous deployment version, selecting the preceding active version when no version is supplied. Use this to step back from the currently live version; to make a specific version live by naming it in the path — including when the workflow is not currently deployed — use `POST /workflows/{workflowId}/versions/{version}/activate`. Neither touches the draft. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.versions.activate", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -1950,7 +1994,9 @@ "get": { "operationId": "exportWorkflow", "summary": "Export Workflow", - "description": "Export a portable, secret-sanitized workflow; workspace-scoped bindings must be selected again after import. Exporting records an audit event. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Export a portable, secret-sanitized workflow; workspace-scoped bindings must be selected again after import. Exporting records an audit event. `HEAD` skips the effect but uses `GET` authorization, returning `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; confirms access only. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.export", + "x-oauth-scope": "api:read", "tags": ["Workflows"], "parameters": [ { @@ -2019,7 +2065,9 @@ "post": { "operationId": "importWorkflow", "summary": "Import Workflow", - "description": "Create a workflow from a portable export object, bare state, or JSON string. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Create a workflow from a portable export object, bare state, or JSON string. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.import", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "requestBody": { "required": true, @@ -2094,7 +2142,9 @@ "get": { "operationId": "listChatDeployments", "summary": "List Chat Deployments", - "description": "List hosted chats in a workspace with opaque cursor pagination. Filter by `workflowId` to resolve one workflow’s singleton chat. Each item includes its public URL, whose identifier is a path segment, but omits `allowedEmails`, `hasPassword`, and `customizations`; read those through the admin-only singleton endpoint. This list requires workspace read access and accepts workspace API keys. Stored passwords are never returned.", + "description": "List hosted chats in a workspace with opaque cursor pagination. Filter by `workflowId` to resolve one workflow’s singleton chat. Each item includes its public URL, whose identifier is a path segment, but omits `allowedEmails`, `hasPassword`, and `customizations`; read those through the admin-only singleton endpoint. This list requires workspace read access and accepts workspace API keys. Stored passwords are never returned.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "chat_deployments.list", + "x-oauth-scope": "api:read", "tags": ["Workflows"], "parameters": [ { @@ -2229,7 +2279,9 @@ "get": { "operationId": "getWorkflowChatDeployment", "summary": "Get Workflow Chat Deployment", - "description": "Read a workflow’s singleton hosted chat, or return `404` when none exists. `/workflows/{workflowId}/deployment` controls API execution; this singleton path controls hosted chat. `PUT` creates or replaces it without a chat-id path. The password is never returned; `hasPassword` reports its presence. Visitor-gate fields (`authType`, `hasPassword`, and `allowedEmails`) require workspace admin access. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Read a workflow’s singleton hosted chat, or return `404` when none exists. `/workflows/{workflowId}/deployment` controls API execution; this singleton path controls hosted chat. `PUT` creates or replaces it without a chat-id path. The password is never returned; `hasPassword` reports its presence. Visitor-gate fields (`authType`, `hasPassword`, and `allowedEmails`) require workspace admin access. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "chat_deployments.read", + "x-oauth-scope": "api:read", "tags": ["Workflows"], "parameters": [ { @@ -2293,7 +2345,9 @@ "put": { "operationId": "replaceWorkflowChatDeployment", "summary": "Create or Replace Workflow Chat Deployment", - "description": "Create or replace hosted chat. Omitted fields reset to defaults except per-field `customizations`. `password` is write-only and required for password auth; `allowedEmails` is required and non-empty for email or SSO. This also deploys the draft. A duplicate identifier or pending deployment returns `409`; public auth exposes the URL. `/workflows/{workflowId}/deployment` controls API execution; this singleton path controls hosted chat. `PUT` creates or replaces it without a chat-id path. Workspace keys are rejected; use personal keys or OAuth.", + "description": "Create or replace hosted chat. Omitted fields reset to defaults except per-field `customizations`. `password` is write-only and required for password auth; `allowedEmails` is required and non-empty for email or SSO. This also deploys the draft. A duplicate identifier or pending deployment returns `409`; public auth exposes the URL. `/workflows/{workflowId}/deployment` controls API execution; this singleton path controls hosted chat. `PUT` creates or replaces it without a chat-id path. Workspace keys are rejected; use personal keys or OAuth.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "chat_deployments.replace", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -2380,7 +2434,9 @@ "delete": { "operationId": "deleteWorkflowChatDeployment", "summary": "Delete Workflow Chat Deployment", - "description": "Stop serving a workflow's hosted chat. Its URL stops answering and the identifier becomes free again. The workflow's own deployment is untouched and stays executable through the workflow API — to undeploy that, use `DELETE /workflows/{workflowId}/deploy`. A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.", + "description": "Stop serving a workflow's hosted chat. Its URL stops answering and the identifier becomes free again. The workflow's own deployment is untouched and stays executable through the workflow API — to undeploy that, use `DELETE /workflows/{workflowId}/deploy`. Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "chat_deployments.delete", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -2446,7 +2502,9 @@ "post": { "operationId": "executeWorkflowV2", "summary": "Execute Workflow", - "description": "Execute the deployment, or use `run.source: \"manual\"` for draft state. Manual runs require a personal key or OAuth write access; workspace keys, anonymous callers, and async mode are rejected. Start at a runnable trigger, or resume from `sourceRunId` using the same-workflow snapshot. Public deployments allow anonymous sync or streaming; async requires credentials. Sync timeouts return `200` with failed status and `TIMEOUT`. Each option carries the modes it requires and the modes that reject it; a violated combination is a 400.", + "description": "Execute the deployment; `run.source: \"manual\"` uses draft state. Manual runs require a personal key or OAuth write access; workspace keys, anonymous callers, and async are rejected. Start at a runnable trigger, or resume from `sourceRunId` using the same-workflow snapshot. Public deployments allow anonymous sync or streaming; async requires credentials. Sync timeouts return `200` with failed status and `TIMEOUT`. Each option carries the modes it requires and the modes that reject it; a violated combination is a 400.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.execute", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "security": [ { @@ -2603,7 +2661,9 @@ "get": { "operationId": "listWorkflowRunsV2", "summary": "List Workflow Runs", - "description": "List recorded runs of a workflow with filtering and opaque cursor pagination. Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override.", + "description": "List recorded runs of a workflow with filtering and opaque cursor pagination. Expired runs are hard-deleted. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.runs.list", + "x-oauth-scope": "api:read", "tags": ["Workflow Runs"], "parameters": [ { @@ -2751,7 +2811,9 @@ "get": { "operationId": "getWorkflowRunV2", "summary": "Get Workflow Run", - "description": "Get current run state with optional final and block outputs. With `includeOutput`, `files` includes download paths; `includeFileBase64` reads object storage to inline bytes and returns `413` with the download path when one file or the total exceeds 16 MiB. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only.", + "description": "Get current run state with optional final and block outputs. With `includeOutput`, `files` includes download paths; `includeFileBase64` reads object storage to inline bytes and returns `413` with the download path when one file or the total exceeds 16 MiB. `HEAD` skips the effect but uses `GET` authorization, returning `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; confirms access only.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.runs.read", + "x-oauth-scope": "api:read", "tags": ["Workflow Runs"], "parameters": [ { @@ -2878,7 +2940,9 @@ "get": { "operationId": "downloadWorkflowRunFileV2", "summary": "Download Workflow Run File", - "description": "Download one run-produced file by id. Downloads record an audit event. Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. `HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only. `HEAD` omits `Content-Length`; use file metadata to size downloads.", + "description": "Download one run-produced file by id. Downloads record an audit event. Expired runs are hard-deleted. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override. `HEAD` skips the effect but uses `GET` authorization, returning `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; confirms access only. `HEAD` omits `Content-Length`; use file metadata to size downloads.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.download_run_file", + "x-oauth-scope": "api:read", "tags": ["Workflow Runs"], "parameters": [ { @@ -2982,7 +3046,9 @@ "post": { "operationId": "resumeWorkflowRunV2", "summary": "Resume Workflow Run", - "description": "Resume one human-in-the-loop pause context. The resumed attempt receives a new run identifier and may complete synchronously or return a queue receipt.", + "description": "Resume one human-in-the-loop pause context. The resumed attempt receives a new run identifier and may complete synchronously or return a queue receipt.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.runs.resume", + "x-oauth-scope": "api:write", "tags": ["Workflow Runs"], "parameters": [ { @@ -3111,7 +3177,9 @@ "post": { "operationId": "cancelRunV2", "summary": "Cancel Workflow Run", - "description": "Request cancellation of a running, queued, or paused workflow run. Cancelling a run already in a terminal state succeeds with no effect. A run produced by a table workflow group is a `409` when its cell can no longer accept the cancellation.", + "description": "Request cancellation of a running, queued, or paused workflow run. Cancelling a run already in a terminal state succeeds with no effect. A run produced by a table workflow group is a `409` when its cell can no longer accept the cancellation.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.runs.cancel", + "x-oauth-scope": "api:write", "tags": ["Workflow Runs"], "parameters": [ { @@ -3193,7 +3261,9 @@ "get": { "operationId": "listWorkflowsFolders", "summary": "List Workflow Folders", - "description": "List canonical workflow folders in a workspace. The bounded set is returned in one page; `nextCursor` is always null. A workspace folder tree over 10,000 folders is a `413`.", + "description": "List canonical workflow folders in a workspace. The bounded set is returned in one page; `nextCursor` is always null. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "workflows.folders.list", + "x-oauth-scope": "api:read", "tags": ["Workflows"], "parameters": [ { @@ -3306,7 +3376,9 @@ "post": { "operationId": "createWorkflowsFolder", "summary": "Create Workflow Folder", - "description": "Create a canonical workflow folder in a workspace. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Create a canonical workflow folder in a workspace. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.folders.create", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "requestBody": { "required": true, @@ -3379,7 +3451,9 @@ "patch": { "operationId": "relocateWorkflowsFolder", "summary": "Rename or Move Workflow Folder", - "description": "Rename or move a workflow folder and its descendants to a canonical path. A workspace folder tree over 10,000 folders is a `413`.", + "description": "Rename or move a workflow folder and its descendants to a canonical path. A workspace folder tree over 10,000 folders is a `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.folders.relocate", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "requestBody": { "required": true, @@ -3452,7 +3526,9 @@ "delete": { "operationId": "deleteWorkflowsFolder", "summary": "Delete Workflow Folder", - "description": "Delete a workflow folder, optionally including its descendants and workflows.", + "description": "Delete a workflow folder, optionally including its descendants and workflows.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "workflows.folders.delete", + "x-oauth-scope": "api:write", "tags": ["Workflows"], "parameters": [ { @@ -3571,7 +3647,7 @@ "type": "http", "scheme": "bearer", "bearerFormat": "OAuth 2.0 access token", - "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. The token must carry the scope required by the operation." + "description": "A Sim OAuth access token obtained by a registered client through the authorization-code flow. Each operation declares its required scope: api:read permits reads and searches; api:write also permits changes and execution and implies api:read. Scope requirements follow the application operation, independent of HTTP method or workspace role." } }, "headers": { diff --git a/apps/sim/app/(auth)/auth-redirect.ts b/apps/sim/app/(auth)/auth-redirect.ts index 269528c0bb1..e567b85b210 100644 --- a/apps/sim/app/(auth)/auth-redirect.ts +++ b/apps/sim/app/(auth)/auth-redirect.ts @@ -74,6 +74,17 @@ export function resolveAuthRedirect({ redirect, callbackUrl, inviteFlow }: AuthR } } +/** OAuth reauthentication must reach the form even when an older session cookie exists. */ +export function isOAuthAuthorizationCallback(callbackUrl: string, origin: string): boolean { + if (!callbackUrl) return false + try { + const callback = new URL(callbackUrl, origin) + return callback.origin === origin && callback.pathname === '/api/auth/oauth2/authorize' + } catch { + return false + } +} + interface AuthCrossLinkParams { /** Validated post-auth destination to carry over, or null to drop it. */ callbackUrl: string | null diff --git a/apps/sim/app/(auth)/oauth/consent/consent-view.test.tsx b/apps/sim/app/(auth)/oauth/consent/consent-view.test.tsx new file mode 100644 index 00000000000..43d08b5fbd5 --- /dev/null +++ b/apps/sim/app/(auth)/oauth/consent/consent-view.test.tsx @@ -0,0 +1,120 @@ +/** + * @vitest-environment jsdom + */ +import { act } from 'react' +import { QueryClient, QueryClientProvider } from '@tanstack/react-query' +import { createRoot, type Root } from 'react-dom/client' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ consent: vi.fn(), signOut: vi.fn() })) + +vi.mock('@/lib/auth/auth-client', () => ({ + client: { oauth2: { consent: mocks.consent }, signOut: mocks.signOut }, +})) + +import { OAuthConsentView } from '@/app/(auth)/oauth/consent/consent-view' +import { oauthProviderKeys } from '@/hooks/queries/oauth-provider' + +let root: Root +let container: HTMLDivElement +let queryClient: QueryClient + +function button(label: string): HTMLButtonElement { + const found = Array.from(container.querySelectorAll('button')).find( + (element) => element.textContent === label + ) + if (!found) throw new Error(`Missing button: ${label}`) + return found +} + +async function click(label: string) { + await act(async () => { + button(label).click() + await vi.advanceTimersByTimeAsync(1) + }) +} + +describe('OAuth consent view', () => { + beforeEach(() => { + vi.clearAllMocks() + vi.useFakeTimers() + vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true) + queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } }) + queryClient.setQueryData(oauthProviderKeys.client('sim-cli', 'request'), { + clientId: 'sim-cli', + name: 'Sim CLI', + }) + container = document.createElement('div') + root = createRoot(container) + act(() => + root.render( + + + + ) + ) + }) + + afterEach(() => { + act(() => root.unmount()) + queryClient.clear() + vi.useRealTimers() + }) + + it('shows the registered app, account and destination with one row per distinct capability', () => { + expect(container.querySelector('h1')?.textContent).toBe('Authorize Sim CLI') + expect(container.textContent).toContain('Continuing as test@example.com.') + expect(container.textContent).toContain('Returns to this computer.') + expect(container.querySelectorAll('li')).toHaveLength(2) + expect(button('Allow').disabled).toBe(false) + expect(button('Deny').disabled).toBe(false) + }) + + it('keeps every decision disabled while consent is in flight', async () => { + mocks.consent.mockReturnValue(new Promise(() => {})) + await click('Allow') + expect(mocks.consent).toHaveBeenCalledExactlyOnceWith({ accept: true }) + expect( + Array.from(container.querySelectorAll('button')).every((element) => element.disabled) + ).toBe(true) + expect(container.textContent).toContain('Authorizing') + }) + + it('shows protocol errors and allows retrying the decision', async () => { + mocks.consent.mockResolvedValue({ error: { message: 'The request has expired.' } }) + await click('Allow') + expect(container.querySelector('[role="alert"]')?.textContent).toBe('The request has expired.') + expect(button('Allow').disabled).toBe(false) + expect(button('Use another account').disabled).toBe(false) + }) + + it('does not allow consent during sign-out and surfaces a failure under the original account', async () => { + let finish: (value: { error: { message: string } }) => void = () => {} + mocks.signOut.mockReturnValue( + new Promise((resolve) => { + finish = resolve + }) + ) + await click('Use another account') + expect(button('Allow').disabled).toBe(true) + expect(button('Deny').disabled).toBe(true) + expect(button('Signing out…').disabled).toBe(true) + await act(async () => { + finish({ error: { message: 'Unable to end this session.' } }) + await vi.advanceTimersByTimeAsync(1) + }) + expect(container.querySelector('[role="alert"]')?.textContent).toBe( + 'Unable to end this session.' + ) + expect(container.textContent).toContain('Continuing as test@example.com.') + expect(button('Allow').disabled).toBe(false) + expect(mocks.consent).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/app/(auth)/oauth/consent/consent-view.tsx b/apps/sim/app/(auth)/oauth/consent/consent-view.tsx index 1f3e10d18e8..0f276453542 100644 --- a/apps/sim/app/(auth)/oauth/consent/consent-view.tsx +++ b/apps/sim/app/(auth)/oauth/consent/consent-view.tsx @@ -3,7 +3,6 @@ import { Chip } from '@sim/emcn' import { Check } from '@sim/emcn/icons' import { getErrorMessage } from '@sim/utils/errors' -import { signOut } from '@/lib/auth/auth-client' import { OAUTH_SCOPE_DESCRIPTIONS, SIM_CLI_CLIENT_ID, @@ -17,7 +16,11 @@ import { } from '@/app/(auth)/components' import { AUTH_BUTTON_CLASS } from '@/app/(auth)/components/constants' import { OAuthConsentLoading } from '@/app/(auth)/oauth/consent/loading' -import { useOAuthConsent, useOAuthPublicClient } from '@/hooks/queries/oauth-provider' +import { + useOAuthConsent, + useOAuthPublicClient, + useOAuthSwitchAccount, +} from '@/hooks/queries/oauth-provider' export type OAuthConsentRefusal = 'expired' | 'missing' | 'tampered' | 'unsigned' @@ -79,22 +82,23 @@ export function OAuthConsentView({ }: OAuthConsentViewProps) { const client = useOAuthPublicClient(clientId ?? undefined, authorizationRequestKey ?? undefined) const consent = useOAuthConsent() + const switchAccount = useOAuthSwitchAccount() /** Refuses clients Sim cannot name because URL metadata alone is untrusted. */ const reason: OAuthConsentRefusal | null = refusal ?? (clientId ? null : 'missing') if (reason || client.isError) { return ( -
- - - {reason + -
+ : getErrorMessage( + client.error, + 'Sim could not identify the app. Start again from the app.' + ) + } + /> ) } @@ -105,21 +109,19 @@ export function OAuthConsentView({ const appName = client.data?.name?.trim() if (!appName) { return ( -
- - - Sim could not identify the app asking for access. - -
+ ) } const scopes = visibleOAuthScopes((scope ?? '').split(' ').filter(Boolean)) const destination = describeDestination(redirectUri) + const isPending = + consent.isPending || consent.isSuccess || switchAccount.isPending || switchAccount.isSuccess const decide = (accept: boolean) => { + switchAccount.reset() consent.mutate(accept, { onSuccess: (url) => { window.location.assign(url) @@ -127,9 +129,15 @@ export function OAuthConsentView({ }) } - const switchAccount = async () => { - await signOut() - window.location.assign(`/oauth/sign-in${window.location.search}`) + const changeAccount = () => { + consent.reset() + switchAccount.mutate(undefined, { + onSuccess: () => { + const params = new URLSearchParams(window.location.search) + params.set('prompt', 'login consent') + window.location.assign(`/oauth/sign-in?${params.toString()}`) + }, + }) } return ( @@ -144,25 +152,28 @@ export function OAuthConsentView({ />
{scopes.length > 0 && ( -
    +
      {scopes.map((item) => (
    • - +
    • ))}
    )} -

    - {destination ? `Sends you back to ${destination}. ` : ''}Continuing as {email}.{' '} - - Not you? +

    + Continuing as {email}.{' '} + + {switchAccount.isPending ? 'Signing out…' : 'Use another account'}

    decide(true)} > @@ -172,16 +183,26 @@ export function OAuthConsentView({ type='button' variant='border' fullWidth - disabled={consent.isPending} + disabled={isPending} className={AUTH_BUTTON_CLASS} onClick={() => decide(false)} > - Deny + {consent.isPending && consent.variables === false ? 'Declining…' : 'Deny'} - {consent.isError && ( - - {getErrorMessage(consent.error, 'Something went wrong. Please try again.')} - + {destination && ( +

    + Returns to {destination}. +

    + )} + {(consent.isError || switchAccount.isError) && ( +
    + + {getErrorMessage( + consent.error ?? switchAccount.error, + 'Something went wrong. Please try again.' + )} + +
    )}
diff --git a/apps/sim/app/(auth)/oauth/consent/loading.tsx b/apps/sim/app/(auth)/oauth/consent/loading.tsx index daaaace11f2..ec26b7da3e8 100644 --- a/apps/sim/app/(auth)/oauth/consent/loading.tsx +++ b/apps/sim/app/(auth)/oauth/consent/loading.tsx @@ -1,39 +1,17 @@ -import { Skeleton } from '@sim/emcn' -import { AuthShell } from '@/app/(auth)/components' +import { Loader } from '@sim/emcn' +import { AuthHeader } from '@/app/(auth)/components' -/** - * Consent-card skeleton, shared by the route fallback and the card itself - * while it resolves the client's registered name. - * - * Bars mirror the card so nothing shifts when it arrives: a one-line heading, - * a description that wraps to two in the 400px column, the scope panel at its - * tallest real height, then the two `h-9` actions with the `space-y-4` gap the - * card renders. - * - * Sized for the Sim CLI, which is the client nearly every visitor arrives - * from: it asks for `offline_access api:read api:write`, and - * `visibleOAuthScopes` folds `api:read` into `api:write`, so two rows render. - * `py-3` (24) + two 20px rows + one 8px gap + 2px of border. A third-party - * client asking for more shifts the card down a little when it resolves. - */ export function OAuthConsentLoading() { return ( -
- - - - - - - +
+ +
+
) } export default function OAuthConsentRouteLoading() { - return ( - - - - ) + return } diff --git a/apps/sim/app/(auth)/oauth/consent/page.tsx b/apps/sim/app/(auth)/oauth/consent/page.tsx index f9bf5497a61..8a8df759a75 100644 --- a/apps/sim/app/(auth)/oauth/consent/page.tsx +++ b/apps/sim/app/(auth)/oauth/consent/page.tsx @@ -3,7 +3,6 @@ import { redirect } from 'next/navigation' import type { SearchParams } from 'nuqs/server' import { getSession } from '@/lib/auth' import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' -import { AuthShell } from '@/app/(auth)/components' import { OAuthConsentView } from '@/app/(auth)/oauth/consent/consent-view' import { oauthConsentSearchParamsCache } from '@/app/(auth)/oauth/consent/search-params' @@ -56,15 +55,13 @@ export default async function OAuthConsentPage({ const authorizationRequestKey = refusal ? null : JSON.stringify(raw) return ( - - - + ) } diff --git a/apps/sim/app/(auth)/oauth/sign-in/route.test.ts b/apps/sim/app/(auth)/oauth/sign-in/route.test.ts index b72250bb1c5..1eccb42d97f 100644 --- a/apps/sim/app/(auth)/oauth/sign-in/route.test.ts +++ b/apps/sim/app/(auth)/oauth/sign-in/route.test.ts @@ -1,12 +1,18 @@ /** * @vitest-environment node */ +import { createEnvMock, envFlagsMock } from '@sim/testing' import { NextRequest } from 'next/server' import { beforeEach, describe, expect, it, vi } from 'vitest' -const flags = vi.hoisted(() => ({ enabled: true, registrationDisabled: false })) +const flags = vi.hoisted(() => ({ + enabled: true, + registrationDisabled: false, + appUrl: 'https://sim.test', +})) vi.mock('@/lib/core/config/env-flags', () => ({ + ...envFlagsMock, get isOAuthProviderEnabled() { return flags.enabled }, @@ -15,7 +21,18 @@ vi.mock('@/lib/core/config/env-flags', () => ({ }, })) +vi.mock('@/lib/core/config/env', () => { + const mock = createEnvMock({ NEXT_PUBLIC_APP_URL: 'https://sim.test' }) + return { + ...mock, + getEnv: (key: string) => (key === 'NEXT_PUBLIC_APP_URL' ? flags.appUrl : mock.getEnv(key)), + } +}) + +vi.unmock('@/lib/core/utils/urls') + import { GET } from '@/app/(auth)/oauth/sign-in/route' +import { proxy } from '@/proxy' function request(query: string): NextRequest { return new NextRequest(`https://sim.test/oauth/sign-in?${query}`) @@ -32,8 +49,25 @@ describe('OAuth login bridge', () => { beforeEach(() => { flags.enabled = true flags.registrationDisabled = false + flags.appUrl = 'https://sim.test' }) + it.each([true, false])( + 'keeps the configured auth origin when Next normalizes loopback hosts (enabled=%s)', + async (enabled) => { + flags.enabled = enabled + flags.appUrl = 'http://127.0.0.1:37488' + const incoming = new NextRequest(`${flags.appUrl}/oauth/sign-in?client_id=sim-cli`) + expect(incoming.nextUrl.origin).toBe('http://localhost:37488') + + const response = await GET(incoming) + const destination = new URL(response.headers.get('location')!) + expect(destination.origin).toBe(flags.appUrl) + expect(destination.pathname).toBe(enabled ? '/signup' : '/') + if (enabled) expect(redirectParts(response).callback.origin).toBe(flags.appUrl) + } + ) + it('consumes prompt=login and preserves a later consent prompt', async () => { const response = await GET( request( @@ -69,4 +103,66 @@ describe('OAuth login bridge', () => { expect(disabled.status).toBe(302) expect(new URL(disabled.headers.get('location') as string).pathname).toBe('/') }) + + it.each([ + ['login consent', '/login', 'consent'], + ['create', '/signup', null], + ['', '/signup', null], + ])('reaches the form with an existing session for prompt=%s', async (prompt, path, remaining) => { + const authorize = new URLSearchParams({ + client_id: 'sim-cli', + response_type: 'code', + redirect_uri: 'http://127.0.0.1:5187/callback', + code_challenge: 'challenge', + code_challenge_method: 'S256', + state: 'request-state', + prompt, + sig: 'signed-query', + }) + const { destination, callback } = redirectParts(await GET(request(authorize.toString()))) + const response = await proxy( + new NextRequest(destination, { + headers: { cookie: 'better-auth.session_token=existing.session' }, + }) + ) + + expect(destination.pathname).toBe(path) + expect(response.headers.get('location')).toBeNull() + expect(response.headers.get('x-middleware-next')).toBe('1') + expect(response.headers.get('content-security-policy')).toContain("default-src 'self'") + expect(callback.searchParams.get('state')).toBe('request-state') + expect(callback.searchParams.get('code_challenge')).toBe('challenge') + expect(callback.searchParams.get('redirect_uri')).toBe('http://127.0.0.1:5187/callback') + expect(callback.searchParams.get('prompt')).toBe(remaining) + }) + + it.each(['/login', '/signup'])('preserves ordinary authenticated %s redirects', async (path) => { + for (const callbackUrl of [ + '', + '/workspace/workspace-1', + 'https://other.test/api/auth/oauth2/authorize', + ]) { + const destination = new URL(path, 'https://sim.test') + if (callbackUrl) destination.searchParams.set('callbackUrl', callbackUrl) + const response = await proxy( + new NextRequest(destination, { + headers: { cookie: 'better-auth.session_token=existing.session' }, + }) + ) + expect(response.status).toBe(307) + expect(response.headers.get('location')).toBe('https://sim.test/workspace') + } + }) + + it('uses the same redirect precedence as the form and ignores a disabled OAuth provider', async () => { + const destination = new URL('/login', 'https://sim.test') + destination.searchParams.set('callbackUrl', '/api/auth/oauth2/authorize?client_id=sim-cli') + destination.searchParams.set('redirect', '/workspace') + const headers = { cookie: 'better-auth.session_token=existing.session' } + expect((await proxy(new NextRequest(destination, { headers }))).status).toBe(307) + + destination.searchParams.delete('redirect') + flags.enabled = false + expect((await proxy(new NextRequest(destination, { headers }))).status).toBe(307) + }) }) diff --git a/apps/sim/app/(auth)/oauth/sign-in/route.ts b/apps/sim/app/(auth)/oauth/sign-in/route.ts index 35430c1524d..a3cfd08f88e 100644 --- a/apps/sim/app/(auth)/oauth/sign-in/route.ts +++ b/apps/sim/app/(auth)/oauth/sign-in/route.ts @@ -1,5 +1,6 @@ import { type NextRequest, NextResponse } from 'next/server' import { isOAuthProviderEnabled, isRegistrationDisabled } from '@/lib/core/config/env-flags' +import { getBaseUrl } from '@/lib/core/utils/urls' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { buildAuthCrossLink } from '@/app/(auth)/auth-redirect' @@ -39,7 +40,7 @@ function consumeInteractivePrompt(params: URLSearchParams): boolean { export const GET = withRouteHandler(async (request: NextRequest) => { /** Avoid sending a newly signed-in user to a disabled provider's JSON 404. */ if (!isOAuthProviderEnabled) { - return NextResponse.redirect(new URL('/', request.nextUrl.origin), 302) + return NextResponse.redirect(new URL('/', getBaseUrl()), 302) } const params = new URLSearchParams(request.nextUrl.search) @@ -55,5 +56,6 @@ export const GET = withRouteHandler(async (request: NextRequest) => { } ) - return NextResponse.redirect(new URL(destination, request.nextUrl.origin), 302) + /** Use the auth server's origin: Next normalizes loopback hosts and proxy ingress may differ. */ + return NextResponse.redirect(new URL(destination, getBaseUrl()), 302) }) diff --git a/apps/sim/app/api/auth/[...all]/route.test.ts b/apps/sim/app/api/auth/[...all]/route.test.ts index 442366fc375..0cc99520003 100644 --- a/apps/sim/app/api/auth/[...all]/route.test.ts +++ b/apps/sim/app/api/auth/[...all]/route.test.ts @@ -2,7 +2,6 @@ * @vitest-environment node */ import { createMockRequest, resetEnvFlagsMock, setEnvFlags } from '@sim/testing' -import { NextRequest } from 'next/server' import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' const handlerMocks = vi.hoisted(() => ({ @@ -337,6 +336,8 @@ describe('OAuth provider client endpoints', () => { 'oauth2/client/rotate-secret', 'oauth2/register', 'oauth2/introspect', + 'oauth2/token', + 'oauth2/revoke', 'oauth2/anything-a-future-version-adds', ])('refuses POST /%s without reaching Better Auth', async (path) => { const req = createMockRequest('POST', {}, {}, `http://localhost:3000/api/auth/${path}`) @@ -348,10 +349,8 @@ describe('OAuth provider client endpoints', () => { }) it.each([ - 'oauth2/token', 'oauth2/consent', 'oauth2/continue', - 'oauth2/revoke', 'oauth2/public-client-prelogin', 'oauth2/callback/jira', ])('lets the protocol endpoint %s through', async (path) => { @@ -362,50 +361,21 @@ describe('OAuth provider client endpoints', () => { expect(handlerMocks.betterAuthPOST).toHaveBeenCalledTimes(1) }) - it.each(['oauth2/token', 'oauth2/revoke'])( - 'rejects repeated form parameters on %s', - async (path) => { - const req = new NextRequest(`http://localhost:3000/api/auth/${path}`, { - method: 'POST', - headers: { 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8' }, - body: 'client_id=client-1&client_id=client-2', - }) + it.each([true, false])( + 'preserves authenticated connector linking when the OAuth provider is enabled=%s', + async (enabled) => { + setEnvFlags({ isOAuthProviderEnabled: enabled }) + const request = createMockRequest( + 'POST', + { providerId: 'google-email', callbackURL: 'http://localhost:3000/workspace' }, + { cookie: 'better-auth.session_token=existing-session' }, + 'http://localhost:3000/api/auth/oauth2/link' + ) - const res = await POST(req) + const response = await POST(request) - expect(res.status).toBe(400) - expect(res.headers.get('cache-control')).toBe('no-store') - await expect(res.json()).resolves.toMatchObject({ error: 'invalid_request' }) - expect(handlerMocks.betterAuthPOST).not.toHaveBeenCalled() + expect(response.status).toBe(200) + expect(handlerMocks.betterAuthPOST).toHaveBeenCalledExactlyOnceWith(request) } ) - - it('rejects Basic authentication combined with a body secret', async () => { - const req = new NextRequest('http://localhost:3000/api/auth/oauth2/token', { - method: 'POST', - headers: { - authorization: 'Basic Y2xpZW50OnNlY3JldA==', - 'content-type': 'application/x-www-form-urlencoded', - }, - body: 'grant_type=authorization_code&client_secret=secret', - }) - - const res = await POST(req) - - expect(res.status).toBe(400) - expect(res.headers.get('cache-control')).toBe('no-store') - expect(handlerMocks.betterAuthPOST).not.toHaveBeenCalled() - }) - - it('passes an ordinary form request through unchanged', async () => { - const req = new NextRequest('http://localhost:3000/api/auth/oauth2/token', { - method: 'POST', - headers: { 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8' }, - body: 'grant_type=authorization_code&client_id=client-1', - }) - - await POST(req) - - expect(handlerMocks.betterAuthPOST).toHaveBeenCalledWith(req) - }) }) diff --git a/apps/sim/app/api/auth/[...all]/route.ts b/apps/sim/app/api/auth/[...all]/route.ts index 5c80def3a2a..20ee5c3ae52 100644 --- a/apps/sim/app/api/auth/[...all]/route.ts +++ b/apps/sim/app/api/auth/[...all]/route.ts @@ -31,68 +31,15 @@ const UNSUPPORTED_OIDC_PATHS = new Set([ const SAML_PROTOCOL_POST_PREFIX = 'sso/saml2/' /** - * The OAuth provider POST endpoints a client legitimately calls: the protocol - * itself, plus the consent decision the consent page submits. + * Provider endpoints served by the plugin. Token and revocation requests have + * dedicated routes that own their validation and token-family lifecycle. */ const OAUTH_PROVIDER_PROTOCOL_POST_PATHS = new Set([ - 'oauth2/token', 'oauth2/consent', 'oauth2/continue', - 'oauth2/revoke', 'oauth2/public-client-prelogin', ]) -const OAUTH_FORM_POST_PATHS = new Set(['oauth2/token', 'oauth2/revoke']) - -/** - * Rejects ambiguous OAuth form requests before Better Auth parses them. - * Better Auth 1.6.27 keeps the last occurrence of a repeated form field, while - * OAuth requires each parameter to appear at most once. Refusing the request - * here also prevents HTTP Basic credentials from being combined with a body - * secret and interpreted differently by an intermediary. - */ -async function rejectAmbiguousOAuthForm( - request: NextRequest, - path: string -): Promise { - if (!OAUTH_FORM_POST_PATHS.has(path)) return null - if ( - !request.headers - .get('content-type') - ?.toLowerCase() - .startsWith('application/x-www-form-urlencoded') - ) { - return null - } - - const form = new URLSearchParams(await request.clone().text()) - const seen = new Set() - for (const [name] of form) { - if (seen.has(name)) { - return NextResponse.json( - { - error: 'invalid_request', - error_description: `OAuth parameter ${name} appears more than once.`, - }, - { status: 400, headers: { 'Cache-Control': 'no-store' } } - ) - } - seen.add(name) - } - - const usesBasicAuth = request.headers.get('authorization')?.startsWith('Basic ') === true - if (usesBasicAuth && form.has('client_secret')) { - return NextResponse.json( - { - error: 'invalid_request', - error_description: 'Use exactly one client authentication method.', - }, - { status: 400, headers: { 'Cache-Control': 'no-store' } } - ) - } - return null -} - function getAuthPath(request: NextRequest): string { const pathname = request.nextUrl?.pathname ?? new URL(request.url).pathname return pathname.replace('/api/auth/', '') @@ -153,11 +100,17 @@ function isBlockedSsoMutationPath(path: string): boolean { * granting or revoking it, never by editing the row. * * Deny-by-default, like the SSO block above, so a future plugin version cannot - * introduce another unshadowed mutation endpoint. `oauth2/callback/` is the - * generic-OAuth *client* callback and belongs to connector linking, not here. + * introduce another unshadowed mutation endpoint. `oauth2/link` and + * `oauth2/callback/` belong to the existing generic OAuth connector client. */ function isBlockedOAuthProviderMutationPath(path: string): boolean { - if (!path.startsWith('oauth2/') || path.startsWith('oauth2/callback/')) return false + if ( + !path.startsWith('oauth2/') || + path === 'oauth2/link' || + path.startsWith('oauth2/callback/') + ) { + return false + } return !OAUTH_PROVIDER_PROTOCOL_POST_PATHS.has(path) } @@ -212,9 +165,6 @@ export const POST = withRouteHandler(async (request: NextRequest) => { const path = getAuthPath(request) if (UNSUPPORTED_OIDC_PATHS.has(path)) return unsupportedOidcResponse() - const ambiguousOAuthForm = await rejectAmbiguousOAuthForm(request, path) - if (ambiguousOAuthForm) return ambiguousOAuthForm - if (isBlockedOrganizationMutationPath(path)) { return NextResponse.json( { error: 'Organization mutations are handled by application API routes.' }, diff --git a/apps/sim/app/api/auth/oauth2/token/route.postgres.test.ts b/apps/sim/app/api/auth/oauth2/token/route.postgres.test.ts index 193e7d79920..43ea9f679db 100644 --- a/apps/sim/app/api/auth/oauth2/token/route.postgres.test.ts +++ b/apps/sim/app/api/auth/oauth2/token/route.postgres.test.ts @@ -323,6 +323,32 @@ describe.skipIf(!databaseUrl)('OAuth token route in PostgreSQL', () => { .from(schema.oauthTokenFamily) .where(eq(schema.oauthTokenFamily.id, secondRefresh?.familyId ?? 'missing')) ).toHaveLength(0) + + const racingVerifier = `${testId}-racing-verifier-with-more-than-forty-three-characters` + const racingCode = await issueAuthorizationCode(racingVerifier) + const exchangeSameCode = () => + exchangeToken( + createFormRequest( + '/api/auth/oauth2/token', + new URLSearchParams({ + grant_type: 'authorization_code', + client_id: provider.SIM_CLI_CLIENT_ID, + code: racingCode, + code_verifier: racingVerifier, + redirect_uri: redirectUri, + }) + ) + ) + const racingResponses = await Promise.all([exchangeSameCode(), exchangeSameCode()]) + expect(racingResponses.map((response) => response.status).sort()).toEqual([200, 400]) + const rejectedExchange = racingResponses.find((response) => response.status === 400) + await expect(rejectedExchange?.json()).resolves.toMatchObject({ error: 'invalid_grant' }) + expect( + await db + .select({ id: schema.oauthTokenFamily.id }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.userId, userId)) + ).toHaveLength(1) } finally { if (issuedCodeHashes.length) { await db diff --git a/apps/sim/app/api/users/me/authorized-apps/route.ts b/apps/sim/app/api/users/me/authorized-apps/route.ts index 6feffd04c23..21c39ccc131 100644 --- a/apps/sim/app/api/users/me/authorized-apps/route.ts +++ b/apps/sim/app/api/users/me/authorized-apps/route.ts @@ -18,7 +18,14 @@ export const GET = defineInternalJsonRoute({ reason: 'Authenticated current-user settings read', }), errorPolicy: internalOrchestrationErrorPolicy, - mapInput: () => ({}), + mapInput: ({ query }) => query, useCase: listAuthorizedAppsUseCase, - present: (apps) => ({ apps }), + present: ({ apps, nextCursor }) => ({ + apps: apps.map((app) => ({ + ...app, + name: app.name?.trim() || app.clientId, + authorizedAt: app.authorizedAt.toISOString(), + })), + nextCursor, + }), }) diff --git a/apps/sim/app/api/v2/chat-deployments/route.ts b/apps/sim/app/api/v2/chat-deployments/route.ts index b6e20424d1e..31e5c69de80 100644 --- a/apps/sim/app/api/v2/chat-deployments/route.ts +++ b/apps/sim/app/api/v2/chat-deployments/route.ts @@ -1,7 +1,8 @@ import { v2ListChatDeploymentsContract } from '@/lib/api/contracts/v2/chat-deployments' import { cursorRoute, cursorScopeKey } from '@/lib/api/cursor-binding' import { defineV2JsonRoute, v2ApiKeyAuth, v2RateLimits } from '@/lib/api/server/routes' -import { chatDeploymentOperations, listChatDeployments } from '@/lib/chat-deployments/application' +import { listChatDeployments } from '@/lib/chat-deployments/application' +import { chatDeploymentOperations } from '@/lib/chat-deployments/application/operations' import { chatDeploymentWorkspaceErrorPolicy, toV2ChatDeploymentListItem, diff --git a/apps/sim/app/api/v2/files/bulk-download/route.ts b/apps/sim/app/api/v2/files/bulk-download/route.ts index 06c7a9096af..6c8dfbaa233 100644 --- a/apps/sim/app/api/v2/files/bulk-download/route.ts +++ b/apps/sim/app/api/v2/files/bulk-download/route.ts @@ -9,6 +9,7 @@ import { downloadFileStream } from '@/lib/uploads/core/storage-service' import { buildZipEntryPaths } from '@/lib/uploads/zip-entry-path' import { v2FileErrorPolicies } from '@/lib/workspace-files/api' import { downloadWorkspaceFileItems } from '@/lib/workspace-files/application/download-workspace-file-items' +import { fileOperations } from '@/lib/workspace-files/application/operations' const logger = createLogger('V2FilesBulkDownloadAPI') @@ -43,7 +44,7 @@ export const GET = defineV2BinaryRoute({ contract: v2BulkDownloadFilesContract, auth: v2ApiKeyAuth, headSafe: false, - operation: downloadWorkspaceFileItems.operation, + operation: fileOperations.download, rateLimit: v2RateLimits.publicApi, errorPolicy: v2FileErrorPolicies.default, mapInput: ({ query }) => ({ diff --git a/apps/sim/app/api/v2/knowledge/search/route.ts b/apps/sim/app/api/v2/knowledge/search/route.ts index 2e666f359df..4ede73f7b7a 100644 --- a/apps/sim/app/api/v2/knowledge/search/route.ts +++ b/apps/sim/app/api/v2/knowledge/search/route.ts @@ -15,7 +15,6 @@ export const POST = defineV2JsonRoute({ contract: v2SearchKnowledgeContract, auth: v2ApiKeyAuth, /** Search is resource-read-only even though metering writes a usage record. */ - readOnly: true, operation: knowledgeOperations.search, rateLimit: v2RateLimits.publicApi, errorPolicy: v2KnowledgeErrorPolicies.concealKnowledgeBaseUsageAuthorization, diff --git a/apps/sim/app/api/v2/mcp-servers/[mcpServerId]/tools/route.ts b/apps/sim/app/api/v2/mcp-servers/[mcpServerId]/tools/route.ts index a8efdda4707..4265ea60b5a 100644 --- a/apps/sim/app/api/v2/mcp-servers/[mcpServerId]/tools/route.ts +++ b/apps/sim/app/api/v2/mcp-servers/[mcpServerId]/tools/route.ts @@ -22,7 +22,6 @@ export const GET = defineV2JsonRoute({ operation: mcpServerOperations.discoverTools, auth: v2ApiKeyAuth, headSafe: false, - write: true, rateLimit: v2RateLimits.publicApi, errorPolicy: v2McpToolDiscoveryErrorPolicy, mapInput: ({ params, query }) => ({ diff --git a/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts b/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts index bcc25c9c561..6bb775e1719 100644 --- a/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts +++ b/apps/sim/app/api/v2/tables/[tableId]/query/count/route.ts @@ -25,7 +25,6 @@ export const POST = defineV2JsonRoute({ contract: v2QueryRowsCountContract, operation: tableOperations.queryRows, /** POST carries structured filters but performs a read-only query. */ - readOnly: true, auth: v2ApiKeyAuth, rateLimit: v2RateLimits.publicApi, errorPolicy: v2TableRowsErrorPolicy, diff --git a/apps/sim/app/api/v2/tables/[tableId]/query/route.ts b/apps/sim/app/api/v2/tables/[tableId]/query/route.ts index 28790d23d2a..6b1046d5e02 100644 --- a/apps/sim/app/api/v2/tables/[tableId]/query/route.ts +++ b/apps/sim/app/api/v2/tables/[tableId]/query/route.ts @@ -28,7 +28,6 @@ export const POST = defineV2JsonRoute({ contract: v2QueryRowsContract, operation: tableOperations.queryRows, /** POST carries structured filters but performs a read-only query. */ - readOnly: true, auth: v2ApiKeyAuth, rateLimit: v2RateLimits.publicApi, errorPolicy: v2TableRowsErrorPolicy, diff --git a/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts b/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts index a44e4a8e10c..09342964958 100644 --- a/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts +++ b/apps/sim/app/api/v2/tables/[tableId]/rows/search/route.ts @@ -12,7 +12,6 @@ export const POST = defineV2JsonRoute({ contract: v2SearchTableRowsContract, operation: tableOperations.searchRows, /** POST carries structured filters but performs a read-only search. */ - readOnly: true, auth: v2ApiKeyAuth, rateLimit: v2RateLimits.publicApi, errorPolicy: v2TableRowsErrorPolicy, diff --git a/apps/sim/app/api/v2/workflows/[workflowId]/deployments/chat/route.ts b/apps/sim/app/api/v2/workflows/[workflowId]/deployments/chat/route.ts index 13ad41bfe26..24a0f5bb46e 100644 --- a/apps/sim/app/api/v2/workflows/[workflowId]/deployments/chat/route.ts +++ b/apps/sim/app/api/v2/workflows/[workflowId]/deployments/chat/route.ts @@ -5,11 +5,11 @@ import { } from '@/lib/api/contracts/v2/chat-deployments' import { defineV2JsonRoute, v2ApiKeyAuth, v2RateLimits } from '@/lib/api/server/routes' import { - chatDeploymentOperations, deleteWorkflowChatDeployment, readWorkflowChatDeployment, replaceWorkflowChatDeployment, } from '@/lib/chat-deployments/application' +import { chatDeploymentOperations } from '@/lib/chat-deployments/application/operations' import { generateRequestId } from '@/lib/core/utils/request' import { chatDeploymentErrorPolicy, toV2ChatDeployment } from '@/app/api/v2/chat-deployments/utils' diff --git a/apps/sim/app/workspace/[workspaceId]/settings/[section]/settings.tsx b/apps/sim/app/workspace/[workspaceId]/settings/[section]/settings.tsx index 7407f7af1fe..1a392f78ab8 100644 --- a/apps/sim/app/workspace/[workspaceId]/settings/[section]/settings.tsx +++ b/apps/sim/app/workspace/[workspaceId]/settings/[section]/settings.tsx @@ -25,6 +25,11 @@ const ApiKeys = dynamic(() => const BYOK = dynamic(() => import('@/app/workspace/[workspaceId]/settings/components/byok/byok').then((m) => m.BYOK) ) +const AuthorizedApps = dynamic(() => + import('@/app/workspace/[workspaceId]/settings/components/authorized-apps/authorized-apps').then( + (m) => m.AuthorizedApps + ) +) const Forks = dynamic(() => import('@/ee/workspace-forking/components/forks').then((m) => m.Forks)) const Secrets = dynamic(() => import('@/app/workspace/[workspaceId]/settings/components/secrets/secrets').then((m) => m.Secrets) @@ -184,6 +189,7 @@ export function SettingsPage({ section }: SettingsPageProps) { /> )} {effectiveSection === 'apikeys' && } + {effectiveSection === 'authorized-apps' && } {billingEnabled && effectiveSection === 'billing' && ( (null) - const list = apps.data ?? EMPTY_APPS + const list = apps.data?.pages.flatMap((page) => page.apps) ?? [] const pendingRevoke = list.find((app) => app.clientId === pendingRevokeClientId) ?? null - const term = searchTerm.trim().toLowerCase() - const filtered = term ? list.filter((app) => app.name.toLowerCase().includes(term)) : list const confirmRevoke = () => { if (!pendingRevokeClientId) return @@ -55,18 +53,23 @@ export function AuthorizedApps() { }} > {apps.isError && apps.data === undefined ? ( - - {getErrorMessage(apps.error, 'Failed to load authorized apps')} - - ) : apps.isPending ? null : list.length === 0 ? ( - No apps have access to your account - ) : filtered.length === 0 ? ( - - No apps found matching "{searchTerm}" + apps.refetch()} + /> + ) : apps.isPending ? ( + Loading authorized apps… + ) : list.length === 0 ? ( + + {searchTerm.trim() + ? `No apps found matching "${searchTerm}"` + : 'No apps have access to your account'} ) : (
- {filtered.map((app) => ( + {list.map((app) => ( ))} + {apps.isError && ( + (apps.isFetchNextPageError ? apps.fetchNextPage() : apps.refetch())} + variant='inline' + /> + )} + {apps.hasNextPage && !apps.isError && ( + apps.fetchNextPage()}> + {apps.isFetchingNextPage ? 'Loading…' : 'Load more'} + + )}
)} diff --git a/apps/sim/app/workspace/[workspaceId]/settings/navigation.test.ts b/apps/sim/app/workspace/[workspaceId]/settings/navigation.test.ts index f304c1e6574..06e4363c029 100644 --- a/apps/sim/app/workspace/[workspaceId]/settings/navigation.test.ts +++ b/apps/sim/app/workspace/[workspaceId]/settings/navigation.test.ts @@ -37,6 +37,7 @@ describe('unified settings navigation', () => { { id: 'custom-tools', label: 'Custom tools', section: 'workspace' }, { id: 'mcp', label: 'MCP tools', section: 'workspace' }, { id: 'apikeys', label: 'Sim API keys', section: 'workspace' }, + { id: 'authorized-apps', label: 'Authorized apps', section: 'account' }, { id: 'workflow-mcp-servers', label: 'MCP servers', section: 'workspace' }, { id: 'byok', label: 'BYOK', section: 'workspace' }, { id: 'sandboxes', label: 'Sandboxes', section: 'workspace' }, @@ -67,6 +68,7 @@ describe('unified settings navigation', () => { 'desktop', 'browser', 'terminal', + 'authorized-apps', ]) expect(idsForSection('workspace')).toEqual([ 'teammates', diff --git a/apps/sim/background/cleanup-oauth-tokens.test.ts b/apps/sim/background/cleanup-oauth-tokens.test.ts index 309c9b21d5a..ef5512118d0 100644 --- a/apps/sim/background/cleanup-oauth-tokens.test.ts +++ b/apps/sim/background/cleanup-oauth-tokens.test.ts @@ -9,6 +9,7 @@ const mocks = vi.hoisted(() => ({ transaction: vi.fn(), txSelect: vi.fn(), txDelete: vi.fn(), + limits: vi.fn(), })) vi.mock('@sim/db', () => ({ @@ -33,7 +34,10 @@ function selectChain(rows: unknown[], captured: unknown[]) { return chain } chain.orderBy = () => chain - chain.limit = () => chain + chain.limit = (limit: number) => { + mocks.limits(limit) + return chain + } chain.for = () => chain chain.then = (resolve: (value: unknown) => unknown) => Promise.resolve(rows).then(resolve) return chain @@ -111,4 +115,31 @@ describe('runCleanupOAuthTokens', () => { it('keeps a tail rather than deleting the moment a token lapses', () => { expect(OAUTH_TOKEN_RETENTION_DAYS).toBeGreaterThan(0) }) + + it('bounds family cascades independently of direct token pages and stops a full backlog', async () => { + const families = Array.from({ length: 10 }, (_, index) => ({ + id: `family-${index}`, + clientId: 'client-1', + sessionId: null, + userId: 'user-1', + consentId: null, + })) + for (let page = 0; page < 10; page += 1) { + mocks.select.mockReturnValueOnce(selectChain(families, [])) + } + mocks.select.mockReturnValueOnce(selectChain([], [])) + mocks.txDelete.mockReturnValue({ + where: () => ({ returning: async () => families.map(({ id }) => ({ id })) }), + }) + + await expect(runCleanupOAuthTokens()).resolves.toEqual({ + tokenFamilies: 100, + accessTokens: 0, + }) + expect(mocks.transaction).toHaveBeenCalledTimes(10) + expect(mocks.limits.mock.calls.map(([limit]) => limit)).toEqual([ + ...Array.from({ length: 10 }, () => 10), + 5_000, + ]) + }) }) diff --git a/apps/sim/background/cleanup-oauth-tokens.ts b/apps/sim/background/cleanup-oauth-tokens.ts index 558233e5607..5579b5b8340 100644 --- a/apps/sim/background/cleanup-oauth-tokens.ts +++ b/apps/sim/background/cleanup-oauth-tokens.ts @@ -22,11 +22,11 @@ const logger = createLogger('CleanupOAuthTokens') export const OAUTH_TOKEN_RETENTION_DAYS = 7 /** - * Rows removed per statement. A run drains several bounded pages so routine - * rotation volume cannot create a permanent backlog, while every delete keeps - * a predictable lock footprint. + * Each family can cascade into 1,001 retained refresh generations. Keep its + * batch small independently of direct access-token deletion. */ -const OAUTH_TOKEN_SWEEP_LIMIT = 5_000 +const OAUTH_FAMILY_SWEEP_LIMIT = 10 +const OAUTH_ACCESS_TOKEN_SWEEP_LIMIT = 5_000 const OAUTH_TOKEN_SWEEP_MAX_PAGES = 10 export interface CleanupOAuthTokensResult { @@ -138,11 +138,11 @@ export async function runCleanupOAuthTokens(): Promise .from(oauthTokenFamily) .where(lt(oauthTokenFamily.expiresAt, cutoff)) .orderBy(asc(oauthTokenFamily.expiresAt), asc(oauthTokenFamily.id)) - .limit(OAUTH_TOKEN_SWEEP_LIMIT) + .limit(OAUTH_FAMILY_SWEEP_LIMIT) if (staleFamilies.length === 0) break tokenFamilies += await deleteExpiredFamilyBatch(staleFamilies, cutoff) - if (staleFamilies.length < OAUTH_TOKEN_SWEEP_LIMIT) break + if (staleFamilies.length < OAUTH_FAMILY_SWEEP_LIMIT) break } for (let page = 0; page < OAUTH_TOKEN_SWEEP_MAX_PAGES; page += 1) { @@ -151,7 +151,7 @@ export async function runCleanupOAuthTokens(): Promise .from(oauthAccessToken) .where(lt(oauthAccessToken.expiresAt, cutoff)) .orderBy(asc(oauthAccessToken.expiresAt), asc(oauthAccessToken.id)) - .limit(OAUTH_TOKEN_SWEEP_LIMIT) + .limit(OAUTH_ACCESS_TOKEN_SWEEP_LIMIT) if (staleAccess.length === 0) break const deleted = await db @@ -164,7 +164,7 @@ export async function runCleanupOAuthTokens(): Promise ) .returning({ id: oauthAccessToken.id }) accessTokens += deleted.length - if (staleAccess.length < OAUTH_TOKEN_SWEEP_LIMIT) break + if (staleAccess.length < OAUTH_ACCESS_TOKEN_SWEEP_LIMIT) break } const result = { tokenFamilies, accessTokens } diff --git a/apps/sim/components/settings/navigation.test.ts b/apps/sim/components/settings/navigation.test.ts index 0aacb72ead0..ab4884fc3ef 100644 --- a/apps/sim/components/settings/navigation.test.ts +++ b/apps/sim/components/settings/navigation.test.ts @@ -110,6 +110,7 @@ describe('settings navigation boundaries', () => { 'custom-tools', 'mcp', 'apikeys', + 'authorized-apps', 'workflow-mcp-servers', 'byok', 'sandboxes', diff --git a/apps/sim/components/settings/navigation.ts b/apps/sim/components/settings/navigation.ts index cb7a70e9ceb..13a724bc98e 100644 --- a/apps/sim/components/settings/navigation.ts +++ b/apps/sim/components/settings/navigation.ts @@ -102,6 +102,7 @@ export type UnifiedSettingsSection = | 'custom-blocks' | 'audit-logs' | 'apikeys' + | 'authorized-apps' | 'byok' | 'billing' | 'teammates' @@ -593,6 +594,12 @@ export const SETTINGS_SECTION_REGISTRY: readonly SettingsSectionRegistryEntry[] { label: 'Authorized apps', icon: Connections, + unified: { + id: 'authorized-apps', + description: 'Review and revoke apps that can act on your account.', + group: 'account', + order: 4, + }, planes: { account: { id: 'authorized-apps', diff --git a/apps/sim/hooks/queries/oauth-provider.test.tsx b/apps/sim/hooks/queries/oauth-provider.test.tsx new file mode 100644 index 00000000000..9bdf87fb3c5 --- /dev/null +++ b/apps/sim/hooks/queries/oauth-provider.test.tsx @@ -0,0 +1,173 @@ +/** + * @vitest-environment jsdom + */ +import { act } from 'react' +import { QueryClient, QueryClientProvider } from '@tanstack/react-query' +import { createRoot, type Root } from 'react-dom/client' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + requestJson: vi.fn(), + publicClientPrelogin: vi.fn(), + consent: vi.fn(), + signOut: vi.fn(), +})) + +vi.mock('@/lib/api/client/request', () => ({ requestJson: mocks.requestJson })) +vi.mock('@/lib/auth/auth-client', () => ({ + client: { + oauth2: { publicClientPrelogin: mocks.publicClientPrelogin, consent: mocks.consent }, + signOut: mocks.signOut, + }, +})) + +import { listAuthorizedAppsContract, revokeAuthorizedAppContract } from '@/lib/api/contracts/user' +import { + oauthProviderKeys, + useAuthorizedApps, + useOAuthConsent, + useOAuthPublicClient, + useOAuthSwitchAccount, + useRevokeAuthorizedApp, +} from '@/hooks/queries/oauth-provider' + +const mounted: { root: Root; queryClient: QueryClient }[] = [] + +function renderHook(useHook: () => T) { + const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: false }, mutations: { retry: false } }, + }) + const root = createRoot(document.createElement('div')) + mounted.push({ root, queryClient }) + let latest: T + function Probe() { + latest = useHook() + return null + } + act(() => + root.render( + + + + ) + ) + return { result: () => latest, queryClient } +} + +describe('OAuth provider hooks', () => { + beforeEach(() => { + vi.clearAllMocks() + vi.useFakeTimers() + vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true) + }) + + afterEach(() => { + for (const { root, queryClient } of mounted.splice(0)) { + act(() => root.unmount()) + queryClient.clear() + } + vi.useRealTimers() + }) + + it('loads subsequent pages with the same search and forwards cancellation', async () => { + mocks.requestJson + .mockResolvedValueOnce({ apps: [{ clientId: 'first' }], nextCursor: 'next-cursor' }) + .mockResolvedValueOnce({ apps: [{ clientId: 'last' }], nextCursor: null }) + const hook = renderHook(() => useAuthorizedApps('test app')) + await act(async () => { + await vi.advanceTimersByTimeAsync(1) + }) + + expect(hook.result().hasNextPage).toBe(true) + await act(async () => { + await hook.result().fetchNextPage() + await vi.advanceTimersByTimeAsync(1) + }) + expect(mocks.requestJson).toHaveBeenNthCalledWith(1, listAuthorizedAppsContract, { + query: { search: 'test app' }, + signal: expect.any(AbortSignal), + }) + expect(mocks.requestJson).toHaveBeenNthCalledWith(2, listAuthorizedAppsContract, { + query: { search: 'test app', cursor: 'next-cursor' }, + signal: expect.any(AbortSignal), + }) + expect(hook.result().data?.pages).toHaveLength(2) + expect(hook.result().hasNextPage).toBe(false) + }) + + it('invalidates every search after revocation without invalidating client registrations', async () => { + mocks.requestJson.mockResolvedValue({ success: true }) + const hook = renderHook(useRevokeAuthorizedApp) + hook.queryClient.setQueryData(oauthProviderKeys.authorizedAppsList('one'), { pages: [] }) + hook.queryClient.setQueryData(oauthProviderKeys.authorizedAppsList('two'), { pages: [] }) + hook.queryClient.setQueryData(oauthProviderKeys.client('sim-cli', 'request'), { + name: 'Sim CLI', + }) + + await act(async () => { + await hook.result().mutateAsync('sim-cli') + }) + expect(mocks.requestJson).toHaveBeenCalledWith(revokeAuthorizedAppContract, { + params: { clientId: 'sim-cli' }, + }) + expect( + hook.queryClient.getQueryState(oauthProviderKeys.authorizedAppsList('one'))?.isInvalidated + ).toBe(true) + expect( + hook.queryClient.getQueryState(oauthProviderKeys.authorizedAppsList('two'))?.isInvalidated + ).toBe(true) + expect( + hook.queryClient.getQueryState(oauthProviderKeys.client('sim-cli', 'request'))?.isInvalidated + ).toBe(false) + }) + + it('does not look up unsigned requests and aborts an in-flight registration lookup', async () => { + const unsigned = renderHook(() => useOAuthPublicClient('sim-cli')) + await act(async () => { + await vi.advanceTimersByTimeAsync(1) + }) + expect(unsigned.result().fetchStatus).toBe('idle') + expect(mocks.publicClientPrelogin).not.toHaveBeenCalled() + + mocks.publicClientPrelogin.mockReturnValue(new Promise(() => {})) + const signed = renderHook(() => useOAuthPublicClient('sim-cli', 'signed-request')) + const signal = mocks.publicClientPrelogin.mock.calls[0][0].fetchOptions.signal as AbortSignal + expect(signal.aborted).toBe(false) + await act(async () => { + await signed.queryClient.cancelQueries() + }) + expect(signal.aborted).toBe(true) + }) + + it.each([true, false])('returns the protocol redirect after accept=%s', async (accept) => { + const url = accept + ? 'http://127.0.0.1:1234/callback?code=accepted&state=state' + : 'http://127.0.0.1:1234/callback?error=access_denied&state=state' + mocks.consent.mockResolvedValue({ data: { url }, error: null }) + const hook = renderHook(useOAuthConsent) + await act(async () => { + await expect(hook.result().mutateAsync(accept)).resolves.toBe(url) + }) + expect(mocks.consent).toHaveBeenCalledWith({ accept }) + }) + + it.each([ + [{ data: null, error: { message: 'The request has expired.' } }, 'The request has expired.'], + [{ data: {}, error: null }, 'The authorization could not be completed.'], + ])('rejects a failed or incomplete consent response', async (response, message) => { + mocks.consent.mockResolvedValue(response) + const hook = renderHook(useOAuthConsent) + await act(async () => { + await expect(hook.result().mutateAsync(true)).rejects.toThrow(message) + }) + }) + + it('rejects failed sign-out so the view cannot continue under the old account', async () => { + mocks.signOut.mockResolvedValue({ error: { message: 'Unable to end this session.' } }) + const hook = renderHook(useOAuthSwitchAccount) + await act(async () => { + await expect(hook.result().mutateAsync()).rejects.toThrow('Unable to end this session.') + }) + expect(mocks.signOut).toHaveBeenCalledExactlyOnceWith() + }) +}) diff --git a/apps/sim/hooks/queries/oauth-provider.ts b/apps/sim/hooks/queries/oauth-provider.ts index f109950b33b..d00c1f0c284 100644 --- a/apps/sim/hooks/queries/oauth-provider.ts +++ b/apps/sim/hooks/queries/oauth-provider.ts @@ -1,7 +1,7 @@ -import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' +import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { requestJson } from '@/lib/api/client/request' import { - type AuthorizedApp, + type AuthorizedAppsPage, listAuthorizedAppsContract, revokeAuthorizedAppContract, } from '@/lib/api/contracts/user' @@ -13,19 +13,21 @@ export const oauthProviderKeys = { client: (clientId?: string, authorizationRequestKey?: string) => [...oauthProviderKeys.clients(), clientId ?? '', authorizationRequestKey ?? ''] as const, authorizedApps: () => [...oauthProviderKeys.all, 'authorized-apps'] as const, + authorizedAppsList: (search: string) => [...oauthProviderKeys.authorizedApps(), search] as const, } export const AUTHORIZED_APPS_STALE_TIME = 30 * 1000 -async function fetchAuthorizedApps(signal?: AbortSignal): Promise { - const data = await requestJson(listAuthorizedAppsContract, { signal }) - return data.apps -} - -export function useAuthorizedApps() { - return useQuery({ - queryKey: oauthProviderKeys.authorizedApps(), - queryFn: ({ signal }) => fetchAuthorizedApps(signal), +export function useAuthorizedApps(search = '') { + return useInfiniteQuery({ + queryKey: oauthProviderKeys.authorizedAppsList(search), + queryFn: ({ signal, pageParam }) => + requestJson(listAuthorizedAppsContract, { + query: { search, ...(pageParam ? { cursor: pageParam } : {}) }, + signal, + }), + initialPageParam: null as string | null, + getNextPageParam: (page: AuthorizedAppsPage) => page.nextCursor ?? undefined, staleTime: AUTHORIZED_APPS_STALE_TIME, }) } @@ -94,3 +96,13 @@ export function useOAuthConsent() { }, }) } + +/** Leaves the current account before restarting the authorization request at the login form. */ +export function useOAuthSwitchAccount() { + return useMutation({ + mutationFn: async (): Promise => { + const { error } = await client.signOut() + if (error) throw new Error(error.message ?? 'Could not sign out. Please try again.') + }, + }) +} diff --git a/apps/sim/lib/api/application/operations.ts b/apps/sim/lib/api/application/operations.ts index dbe48461fdf..265033e2b92 100644 --- a/apps/sim/lib/api/application/operations.ts +++ b/apps/sim/lib/api/application/operations.ts @@ -1,4 +1,4 @@ -import { defineOperation } from '@/lib/core/application' +import { defineOperation } from '@/lib/core/application/operation' /** * Operations a credential performs on itself. @@ -13,6 +13,7 @@ export const v2MetaOperations = { // permission-group-exempt: the resource is the API key the caller already proved it holds, and reporting what that key can do withholds nothing a group could read: defineOperation({ id: 'meta.capabilities.read', + oauthScope: 'api:read', capability: 'none', principalKinds: ['personal_api_key', 'oauth_access_token', 'workspace_api_key'], }), diff --git a/apps/sim/lib/api/application/read-v2-api-capabilities.test.ts b/apps/sim/lib/api/application/read-v2-api-capabilities.test.ts index 936297487c1..436ced573c5 100644 --- a/apps/sim/lib/api/application/read-v2-api-capabilities.test.ts +++ b/apps/sim/lib/api/application/read-v2-api-capabilities.test.ts @@ -14,6 +14,24 @@ const workspaceKey: Principal = { } describe('readV2ApiCapabilities', () => { + it('requires API read scope even when called without an HTTP adapter', async () => { + const principal = { + kind: 'oauth_access_token', + userId: 'user-1', + clientId: 'client-1', + tokenId: 'token-1', + scopes: ['offline_access'], + expiresAt: new Date('2099-01-01T00:00:00.000Z'), + } as const + + await expect( + readV2ApiCapabilities.execute({ + principal, + input: { keyType: 'oauth_access_token', expiresAt: principal.expiresAt }, + }) + ).rejects.toMatchObject({ requiredScope: 'api:read' }) + }) + it('reports that v2 is available with the credential lifecycle facts', async () => { const result = await readV2ApiCapabilities.execute({ principal: personalKey, diff --git a/apps/sim/lib/api/contracts/user.ts b/apps/sim/lib/api/contracts/user.ts index fabaefce163..fdb25a3ddfa 100644 --- a/apps/sim/lib/api/contracts/user.ts +++ b/apps/sim/lib/api/contracts/user.ts @@ -3,6 +3,7 @@ import { booleanQueryFlagSchema } from '@/lib/api/contracts/primitives' import { type ContractJsonResponse, defineRouteContract } from '@/lib/api/contracts/types' import { BILLING_USAGE_LOG_SOURCES } from '@/lib/billing/usage-sources' import { isSameOrigin } from '@/lib/core/utils/validation' +import { AUTHORIZED_APPS_PAGE_SIZE } from '@/lib/users/constants' export const userProfileSchema = z.object({ id: z.string(), @@ -29,12 +30,27 @@ export const authorizedAppSchema = z.object({ export type AuthorizedApp = z.output +export const listAuthorizedAppsQuerySchema = z.object({ + cursor: z.string().min(1, 'Cursor cannot be empty').max(512).optional(), + search: z.string().trim().max(200, 'Search cannot exceed 200 characters').optional(), +}) + +export type ListAuthorizedAppsQuery = z.input + +export const authorizedAppsPageSchema = z.object({ + apps: z.array(authorizedAppSchema).max(AUTHORIZED_APPS_PAGE_SIZE), + nextCursor: z.string().min(1).max(512).nullable(), +}) + +export type AuthorizedAppsPage = z.output + export const listAuthorizedAppsContract = defineRouteContract({ method: 'GET', path: '/api/users/me/authorized-apps', + query: listAuthorizedAppsQuerySchema, response: { mode: 'json', - schema: z.object({ apps: z.array(authorizedAppSchema) }), + schema: authorizedAppsPageSchema, }, }) diff --git a/apps/sim/lib/api/contracts/v2/openapi/billing.ts b/apps/sim/lib/api/contracts/v2/openapi/billing.ts index 7b37eb662ca..0710b2bf383 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/billing.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/billing.ts @@ -19,6 +19,7 @@ import { type OpenApiOperationMetadata, type OpenApiSuccessMetadata, } from '@/lib/api/openapi/types' +import { billingOperations } from '@/lib/billing/application/operations' const BILLING_STATUS_EXAMPLE = { data: { @@ -78,6 +79,7 @@ const routes = [ defineOpenApiRoute( v2GetBillingStatusContract, billingOperation({ + applicationOperation: billingOperations.readStatus, operationId: 'getBillingStatus', summary: 'Get Billing Status', description: @@ -104,6 +106,7 @@ const routes = [ defineOpenApiRoute( v2ListBillingLogsContract, billingOperation({ + applicationOperation: billingOperations.listLogs, operationId: 'listBillingLogs', summary: 'List Billing Logs', description: diff --git a/apps/sim/lib/api/contracts/v2/openapi/files-audit.ts b/apps/sim/lib/api/contracts/v2/openapi/files-audit.ts index 8e4f3959279..98082d2c529 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/files-audit.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/files-audit.ts @@ -54,6 +54,8 @@ import { type OpenApiOperationMetadata, type OpenApiSuccessMetadata, } from '@/lib/api/openapi/types' +import { auditLogOperations } from '@/lib/audit-logs/application/operations' +import { fileOperations } from '@/lib/workspace-files/application/operations' import { MAX_ZIP_DOWNLOAD_FILES } from '@/lib/workspace-files/limits' const FILE_EXAMPLE = { @@ -133,6 +135,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListFilesContract, filesOperation({ + applicationOperation: fileOperations.list, operationId: 'listFiles', summary: 'List Files', description: `List workspace files with search, sorting, folder filtering, and opaque cursor pagination. Defaults to active files; pass \`scope=archived\` to page over soft-deleted ones. ${FOLDER_TREE_TOO_LARGE}`, @@ -158,6 +161,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateFileContract, filesOperation({ + applicationOperation: fileOperations.create, operationId: 'createFile', summary: 'Create File', description: @@ -192,6 +196,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateFileUploadContract, filesOperation({ + applicationOperation: fileOperations.uploadCreate, operationId: 'createFileUpload', summary: 'Create File Upload', description: @@ -226,6 +231,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetFileUploadContract, filesOperation({ + applicationOperation: fileOperations.uploadRead, operationId: 'getFileUpload', summary: 'Get File Upload', description: `Read an upload session's current state — whether it is still accepting bytes, has finalized into a file, or has failed. Use it to decide whether an interrupted transfer can be resumed or should be abandoned. Like every other upload control leg it requires the signed upload token, and is re-authorized against the workspace on each call.`, @@ -262,6 +268,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2AbortFileUploadContract, filesOperation({ + applicationOperation: fileOperations.uploadCancel, operationId: 'abortFileUpload', summary: 'Abort File Upload', description: 'Abort an active upload session and release provider-side multipart state.', @@ -298,6 +305,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateFileUploadPartUrlsContract, filesOperation({ + applicationOperation: fileOperations.uploadParts, operationId: 'createFileUploadPartUrls', summary: 'Create File Upload Part URLs', description: 'Create signed URLs for a bounded set of multipart upload part numbers.', @@ -341,6 +349,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CompleteFileUploadContract, filesOperation({ + applicationOperation: fileOperations.uploadComplete, operationId: 'completeFileUpload', summary: 'Complete File Upload', description: @@ -378,6 +387,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ReadFileTextContract, filesOperation({ + applicationOperation: fileOperations.readContent, operationId: 'readFileText', summary: 'Read File Text', description: `Extract text from stored file bytes without modifying the file; use \`POST /api/v2/files/{fileId}/unzip\` to unpack archives. Unsupported types return \`400\` and point to raw-byte download; generated documents still compiling return \`409\`, and files above the extraction ceiling return \`413\`. \`degraded: true\` means extraction was incomplete or synthesized from raw bytes and is not authoritative; legacy \`.doc\` and \`.ppt\` extraction may return this best-effort result. \`truncated\` means a parser limit stopped extraction.`, @@ -408,6 +418,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2BulkDownloadFilesContract, filesOperation({ + applicationOperation: fileOperations.download, operationId: 'bulkDownloadFiles', summary: 'Bulk Download Files', description: `Stream files as a zip. Provide comma-separated file IDs and folder paths; folders expand recursively, and unmatched paths are rejected. Each parameter and the resolved selection allow at most ${MAX_ZIP_DOWNLOAD_FILES} entries, with bytes bounded. Oversized selections return \`400\`; downloads record an audit event. ${HEAD_MIRRORS_GET} ${HEAD_OMITS_PAYLOAD_HEADERS}`, @@ -430,6 +441,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UnzipFileContract, filesOperation({ + applicationOperation: fileOperations.extractArchive, operationId: 'unzipFile', summary: 'Unzip File', description: @@ -462,6 +474,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DownloadFileContract, filesOperation({ + applicationOperation: fileOperations.download, operationId: 'downloadFile', summary: 'Download File', description: `Download current file bytes. Generated documents use compiled artifacts, returning \`409\` while compiling and \`413\` above the rendered-size ceiling. Downloading records an audit event. ${HEAD_MIRRORS_GET} ${HEAD_OMITS_PAYLOAD_HEADERS}`, @@ -490,6 +503,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteFileContract, filesOperation({ + applicationOperation: fileOperations.delete, operationId: 'deleteFile', summary: 'Delete File', description: @@ -521,6 +535,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RenameFileContract, filesOperation({ + applicationOperation: fileOperations.rename, operationId: 'renameFile', summary: 'Rename File', description: 'Rename a workspace file without changing its containing folder.', @@ -559,6 +574,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RestoreFileContract, filesOperation({ + applicationOperation: fileOperations.restore, operationId: 'restoreFile', summary: 'Restore File', description: @@ -593,6 +609,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetFileContract, filesOperation({ + applicationOperation: fileOperations.readMetadata, operationId: 'getFile', summary: 'Get File Metadata', description: 'Return file metadata together with the nullable current public-share state.', @@ -627,6 +644,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListAuditLogsContract, auditOperation({ + applicationOperation: auditLogOperations.list, operationId: 'listAuditLogs', summary: 'List Audit Logs', description: `List an organization audit trail with filters and opaque cursor pagination. Requires an Enterprise subscription and organization admin or owner access. ${WORKSPACE_API_KEY_DENIED}`, @@ -652,6 +670,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetAuditLogContract, auditOperation({ + applicationOperation: auditLogOperations.readDetail, operationId: 'getAuditLog', summary: 'Get Audit Log', description: `Return one organization audit-log entry. Requires an Enterprise subscription and organization admin or owner access. ${WORKSPACE_API_KEY_DENIED}`, @@ -683,6 +702,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2MoveFileItemsContract, filesOperation({ + applicationOperation: fileOperations.move, operationId: 'moveFileItems', summary: 'Move Files', description: 'Move up to 1,000 files to a canonical folder path or the workspace root.', @@ -716,6 +736,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetFileShareContract, filesOperation({ + applicationOperation: fileOperations.readShare, operationId: 'getFileShare', summary: 'Get File Share', description: @@ -748,6 +769,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpsertFileShareContract, filesOperation({ + applicationOperation: fileOperations.updateShare, operationId: 'upsertFileShare', summary: 'Enable or Disable File Share', description: `Create or partially update a server-tokenized public share. Only \`isActive\` is required; each other field states what enabling a mode does to it. Enabling any mode other than \`public\` on a file that has never been shared must carry its credential in the same request. ${WORKSPACE_API_KEY_DENIED}`, @@ -791,6 +813,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2EditFileContentContract, filesOperation({ + applicationOperation: fileOperations.updateContent, operationId: 'editFileContent', summary: 'Edit File Content', description: `Modify part of a text file; \`PUT\` on this path replaces the whole file. \`search_replace\` requires one exact match unless \`replaceAll\` is true. The anchored modes match trimmed complete lines: replacement preserves both boundaries, insertion preserves its anchor, and deletion removes the start but preserves the end. Use \`occurrence\` for repeated anchors. Non-UTF-8 files return \`400\`. Concurrent writes return \`409\`; re-read before retrying.`, @@ -841,6 +864,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2SearchFileContentContract, filesOperation({ + applicationOperation: fileOperations.searchContent, operationId: 'searchFileContent', summary: 'Search File Content', description: `Search indexed text in active workspace files and return matching lines with file IDs and line numbers. \`folderPaths\` limits both results and the coverage reported by \`complete\` and \`indexStatus\`. Because indexing is asynchronous, a missing term is unknown rather than absent when \`complete\` is false. \`truncated\` means additional matches exist beyond \`maxResults\`.`, @@ -888,6 +912,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateFileContentContract, filesOperation({ + applicationOperation: fileOperations.updateContent, operationId: 'updateFileContent', summary: 'Replace File Content', description: 'Replace the complete contents of an existing file from UTF-8 or base64 input.', @@ -926,6 +951,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2BulkDeleteFilesContract, filesOperation({ + applicationOperation: fileOperations.delete, operationId: 'bulkDeleteFiles', summary: 'Delete Files', description: @@ -959,6 +985,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListFileFoldersContract, filesOperation({ + applicationOperation: fileOperations.listFolders, operationId: 'listFilesFolders', summary: 'List Folders', description: `List workspace file folders with optional parent-path filtering and sorting. Pass \`scope=archived\` to list folders a recursive \`DELETE\` soft-deleted, which is how a caller finds a path to hand to \`POST /api/v2/files/folders/restore\`. ${FULL_SET_LIST}`, @@ -983,6 +1010,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RestoreFileFolderContract, filesOperation({ + applicationOperation: fileOperations.restoreFolder, operationId: 'restoreFilesFolder', summary: 'Restore Folder', description: @@ -1009,6 +1037,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateFileFolderContract, filesOperation({ + applicationOperation: fileOperations.createFolder, operationId: 'createFilesFolder', summary: 'Create Folder', description: 'Create a canonical folder path in a workspace.', @@ -1040,6 +1069,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RelocateFileFolderContract, filesOperation({ + applicationOperation: fileOperations.updateFolder, operationId: 'relocateFilesFolder', summary: 'Rename or Move Folder', description: 'Rename or move a folder and atomically rewrite descendant canonical paths.', @@ -1072,6 +1102,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteFileFolderContract, filesOperation({ + applicationOperation: fileOperations.deleteFolder, operationId: 'deleteFilesFolder', summary: 'Delete Folder', description: 'Delete a folder, optionally including every nested file and folder.', diff --git a/apps/sim/lib/api/contracts/v2/openapi/knowledge-chunks.ts b/apps/sim/lib/api/contracts/v2/openapi/knowledge-chunks.ts index 1dc5c6f7baa..936f28ee511 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/knowledge-chunks.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/knowledge-chunks.ts @@ -17,6 +17,7 @@ import { WORKSPACE_API_KEY_DENIED, } from '@/lib/api/contracts/v2/openapi/shared' import { defineOpenApiRoute } from '@/lib/api/openapi/types' +import { knowledgeOperations } from '@/lib/knowledge/application/operations' /** * Chunk operations of the knowledge OpenAPI document. @@ -36,6 +37,7 @@ export const knowledgeChunkOpenApiRoutes = [ defineOpenApiRoute( v2ListKnowledgeChunksContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.listChunks, operationId: 'listKnowledgeChunks', summary: 'List Chunks', description: `List the passages a document was split into, with content search, enabled filtering, sorting, and opaque cursor pagination. Tag values are projected by slot; resolve slots to display names with \`GET /api/v2/knowledge/{knowledgeBaseId}/tags\`. ${DOCUMENT_NOT_READY} ${WORKSPACE_API_KEY_DENIED}`, @@ -66,6 +68,7 @@ export const knowledgeChunkOpenApiRoutes = [ defineOpenApiRoute( v2CreateKnowledgeChunkContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.createChunk, operationId: 'createKnowledgeChunk', summary: 'Create Chunk', description: `Append a chunk, embedding it before the response so it is immediately searchable. It inherits the document's tags and next \`chunkIndex\`. ${CONNECTOR_MANAGED} ${WORKSPACE_API_KEY_DENIED}`, @@ -103,6 +106,7 @@ export const knowledgeChunkOpenApiRoutes = [ defineOpenApiRoute( v2BulkUpdateKnowledgeChunksContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.bulkChunks, operationId: 'bulkUpdateKnowledgeChunks', summary: 'Bulk Update Chunks', description: `Enable, disable, or delete multiple chunks in one best-effort request. Unknown chunk IDs appear in \`errors\` without failing the request; \`processed\` counts matched chunks, not changes. ${CONNECTOR_MANAGED} ${WORKSPACE_API_KEY_DENIED}`, @@ -141,6 +145,7 @@ export const knowledgeChunkOpenApiRoutes = [ defineOpenApiRoute( v2GetKnowledgeChunkContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.readChunk, operationId: 'getKnowledgeChunk', summary: 'Get Chunk', description: `Retrieve one chunk of a document, including the exact text that was embedded. ${DOCUMENT_NOT_READY} ${WORKSPACE_API_KEY_DENIED}`, @@ -171,6 +176,7 @@ export const knowledgeChunkOpenApiRoutes = [ defineOpenApiRoute( v2UpdateKnowledgeChunkContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.updateChunk, operationId: 'updateKnowledgeChunk', summary: 'Update Chunk', description: `Correct chunk text or disable it from search. Changing \`content\` re-embeds immediately and recalculates document token and character counts; disabling retains the index. ${CONNECTOR_MANAGED} ${DOCUMENT_NOT_READY} ${WORKSPACE_API_KEY_DENIED}`, @@ -203,6 +209,7 @@ export const knowledgeChunkOpenApiRoutes = [ defineOpenApiRoute( v2DeleteKnowledgeChunkContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.deleteChunk, operationId: 'deleteKnowledgeChunk', summary: 'Delete Chunk', description: `Permanently remove one chunk and subtract it from document counts. Remaining \`chunkIndex\` values stay stable and may become non-contiguous. ${CONNECTOR_MANAGED} ${DOCUMENT_NOT_READY} ${WORKSPACE_API_KEY_DENIED}`, diff --git a/apps/sim/lib/api/contracts/v2/openapi/knowledge-tags.ts b/apps/sim/lib/api/contracts/v2/openapi/knowledge-tags.ts index a3d6c69d6df..e3b9f3fedf6 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/knowledge-tags.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/knowledge-tags.ts @@ -19,6 +19,7 @@ import { WORKSPACE_API_KEY_DENIED, } from '@/lib/api/contracts/v2/openapi/shared' import { defineOpenApiRoute } from '@/lib/api/openapi/types' +import { knowledgeOperations } from '@/lib/knowledge/application/operations' /** * Tag-definition write operations of the knowledge OpenAPI document. @@ -33,6 +34,7 @@ export const knowledgeTagOpenApiRoutes = [ defineOpenApiRoute( v2CreateKnowledgeTagContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.createTag, operationId: 'createKnowledgeTag', summary: 'Create Tag', description: `Define one tag; use \`PUT\` on this path for several. Write its \`tagSlot\` on documents, then filter by \`displayName\`. Omitting \`tagSlot\` selects the next free slot; exhaustion returns \`400\`. An occupied slot or duplicate display name returns \`409\` naming the conflict. ${WORKSPACE_API_KEY_DENIED}`, @@ -65,6 +67,7 @@ export const knowledgeTagOpenApiRoutes = [ defineOpenApiRoute( v2UpdateKnowledgeTagContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.updateTag, operationId: 'updateKnowledgeTag', summary: 'Update Tag', description: `Rename a tag or change its slot-compatible \`fieldType\`. Renaming changes read and filter names without moving the slot or its values. Slots are fixed for a tag's lifetime; an incompatible type returns \`400\` and requires creating a new tag. A duplicate display name returns \`409\`. ${WORKSPACE_API_KEY_DENIED}`, @@ -97,6 +100,7 @@ export const knowledgeTagOpenApiRoutes = [ defineOpenApiRoute( v2DeleteKnowledgeTagContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.deleteTag, operationId: 'deleteKnowledgeTag', summary: 'Delete Tag', description: `Remove a tag definition and clear its slot across every document and chunk in the knowledge base. Without a definition the slot has no meaning, so leaving the values would strand them under a raw slot name — this is not recoverable. ${WORKSPACE_API_KEY_DENIED}`, @@ -127,6 +131,7 @@ export const knowledgeTagOpenApiRoutes = [ defineOpenApiRoute( v2GetNextKnowledgeTagSlotContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.readNextTagSlot, operationId: 'getNextKnowledgeTagSlot', summary: 'Get Next Tag Slot', description: `Report which slot a create would take for a field type, and how many are left. Advisory rather than a claim: nothing is reserved, and \`POST /api/v2/knowledge/{knowledgeBaseId}/tags\` assigns the same slot when \`tagSlot\` is omitted. ${WORKSPACE_API_KEY_DENIED}`, @@ -157,6 +162,7 @@ export const knowledgeTagOpenApiRoutes = [ defineOpenApiRoute( v2ListKnowledgeTagUsageContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.readTagUsage, operationId: 'listKnowledgeTagUsage', summary: 'List Tag Usage', description: `Report how many documents and chunks carry a value for each defined tag, so a caller can tell a tag that is actually populated from one that was only declared. ${FULL_SET_LIST} ${WORKSPACE_API_KEY_DENIED}`, @@ -187,6 +193,7 @@ export const knowledgeTagOpenApiRoutes = [ defineOpenApiRoute( v2BulkSaveKnowledgeTagDefinitionsContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.saveDocumentTagDefinitions, operationId: 'bulkSaveKnowledgeTagDefinitions', summary: 'Bulk Save Tag Definitions', description: `Declare multiple tag definitions while leaving unspecified slots unchanged. Updating requires the current name in \`originalDisplayName\`; otherwise the entry creates a tag. Occupied explicit slots and duplicate display names appear in per-definition \`errors\`, never overwrite or relocate data, and still return \`200\`. This writes the vocabulary, not document tag values; set those through the document update endpoint. ${WORKSPACE_API_KEY_DENIED}`, @@ -224,6 +231,7 @@ export const knowledgeTagOpenApiRoutes = [ defineOpenApiRoute( v2DeleteKnowledgeTagDefinitionsContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.deleteDocumentTagDefinitions, operationId: 'deleteKnowledgeTagDefinitions', summary: 'Delete Tag Definitions', description: `Remove tag definitions. \`unused\` defaults to \`true\`, deleting only definitions with no document values, which can be recreated safely. \`unused=false\` deletes every definition and irreversibly clears its slot from all documents and chunks. Use \`DELETE /api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}\` to delete one definition. ${WORKSPACE_API_KEY_DENIED}`, diff --git a/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts b/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts index b6dc9b31750..448c8c23389 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts @@ -57,6 +57,7 @@ import { type OpenApiOperationMetadata, type OpenApiSuccessMetadata, } from '@/lib/api/openapi/types' +import { knowledgeOperations } from '@/lib/knowledge/application/operations' const WORKSPACE_ID = 'a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64' const KNOWLEDGE_BASE_ID = '7c9e6679-7425-40de-944b-e07fc1f90ae7' @@ -111,6 +112,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListKnowledgeBasesContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.list, operationId: 'listKnowledgeBases', summary: 'List Knowledge Bases', description: `List knowledge bases in a workspace with lifecycle scope, folder filtering, search, sorting, and opaque cursor pagination. \`scope\` defaults to \`active\`; pass \`archived\` to list knowledge bases a \`DELETE\` archived, each carrying the \`deletedAt\` instant it was archived, and recover one with \`POST /api/v2/knowledge/{knowledgeBaseId}/restore\`. ${FOLDER_TREE_TOO_LARGE}`, @@ -135,6 +137,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateKnowledgeBaseContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.create, operationId: 'createKnowledgeBase', summary: 'Create Knowledge Base', description: `Create a knowledge base in a workspace with optional folder placement and chunking configuration. An unknown \`folderPath\` is a \`404\`. ${FOLDER_TREE_TOO_LARGE}`, @@ -167,6 +170,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetKnowledgeBaseContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.read, operationId: 'getKnowledgeBase', summary: 'Get Knowledge Base', description: `Retrieve a knowledge base by identifier. Inaccessible knowledge bases are reported as not found. ${FOLDER_TREE_TOO_LARGE}`, @@ -197,6 +201,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateKnowledgeBaseContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.update, operationId: 'updateKnowledgeBase', summary: 'Update Knowledge Base', description: `Update a knowledge base name, description, chunking configuration, or folder placement. ${FOLDER_TREE_TOO_LARGE}`, @@ -229,6 +234,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteKnowledgeBaseContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.delete, operationId: 'deleteKnowledgeBase', summary: 'Delete Knowledge Base', description: 'Delete a knowledge base and its documents.', @@ -259,6 +265,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListKnowledgeConnectorsContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.listConnectors, operationId: 'listKnowledgeConnectors', summary: 'List Knowledge Connectors', description: `List external sources connected to a knowledge base with opaque cursor pagination. Stored API keys and encrypted secret material are never returned. ${WORKSPACE_API_KEY_DENIED}`, @@ -290,6 +297,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateKnowledgeConnectorContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.createConnector, operationId: 'createKnowledgeConnector', summary: 'Create Knowledge Connector', description: `Validate and connect an external source, then queue its initial synchronization. The apiKey field is write-only and is never returned. ${WORKSPACE_API_KEY_DENIED}`, @@ -333,6 +341,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetKnowledgeConnectorContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.readConnector, operationId: 'getKnowledgeConnector', summary: 'Get Knowledge Connector', description: `Retrieve one connector and its ten most recent synchronization attempts. Stored API keys and encrypted secret material are never returned. ${WORKSPACE_API_KEY_DENIED}`, @@ -366,6 +375,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateKnowledgeConnectorContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.updateConnector, operationId: 'updateKnowledgeConnector', summary: 'Update Knowledge Connector', description: `Update connector source configuration, schedule, or active state. Replacing source configuration on a runnable connector queues an immediate synchronization; paused connectors retain the change without synchronizing until resumed. Source configuration cannot be replaced while synchronization is already in progress. Authentication material cannot be changed through this operation. ${WORKSPACE_API_KEY_DENIED}`, @@ -399,6 +409,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteKnowledgeConnectorContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.deleteConnector, operationId: 'deleteKnowledgeConnector', summary: 'Delete Knowledge Connector', description: `Delete a connector and optionally its synchronized documents. Documents are retained by default. ${WORKSPACE_API_KEY_DENIED}`, @@ -441,6 +452,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2SyncKnowledgeConnectorContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.syncConnector, operationId: 'syncKnowledgeConnector', summary: 'Sync Knowledge Connector', description: `Queue a connector synchronization. Rehydration forces existing documents to be fetched and indexed again. ${WORKSPACE_API_KEY_DENIED}`, @@ -474,6 +486,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListKnowledgeConnectorDocumentsContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.listConnectorDocuments, operationId: 'listKnowledgeConnectorDocuments', summary: 'List Knowledge Connector Documents', description: `List documents produced by one connector with opaque cursor pagination. Excluded documents are omitted unless explicitly requested. ${WORKSPACE_API_KEY_DENIED}`, @@ -505,6 +518,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateKnowledgeConnectorDocumentsContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.updateConnectorDocuments, operationId: 'updateKnowledgeConnectorDocuments', summary: 'Update Knowledge Connector Documents', description: `Exclude connector documents from knowledge search or restore previously excluded documents. Only documents produced by the selected connector can change. ${WORKSPACE_API_KEY_DENIED}`, @@ -554,6 +568,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2SearchKnowledgeContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.search, operationId: 'searchKnowledge', summary: 'Search Knowledge', description: @@ -590,6 +605,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListKnowledgeTagsContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.listTags, operationId: 'listKnowledgeTags', summary: 'List Tags', description: `List the knowledge base's tag vocabulary: each tag's display name, the slot it is stored in, and its field type. Filters and document reads use display names; document writes address slots. ${FULL_SET_LIST}`, @@ -620,6 +636,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListKnowledgeDocumentsContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.listDocuments, operationId: 'listKnowledgeDocuments', summary: 'List Documents', description: @@ -651,6 +668,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2BulkUpdateKnowledgeDocumentsContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.bulkDocuments, operationId: 'bulkUpdateKnowledgeDocuments', summary: 'Bulk Enable or Disable Documents', description: `Enable or disable many documents in one request, either by identifier or, with \`selectAll\`, every document in the knowledge base. Bulk delete is not offered; delete documents one at a time with \`DELETE /api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}\`. ${WORKSPACE_API_KEY_DENIED}`, @@ -691,6 +709,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UploadKnowledgeDocumentContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.uploadDocument, operationId: 'uploadKnowledgeDocument', summary: 'Upload Document', description: @@ -737,6 +756,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateKnowledgeDocumentUploadContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.uploadCreate, operationId: 'createKnowledgeDocumentUpload', summary: 'Create Document Upload', description: @@ -785,6 +805,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2AbortKnowledgeDocumentUploadContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.uploadCancel, operationId: 'abortKnowledgeDocumentUpload', summary: 'Abort Document Upload', description: 'Abort an incomplete upload and discard provider-side multipart state.', @@ -821,6 +842,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateKnowledgeDocumentUploadPartUrlsContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.uploadParts, operationId: 'createKnowledgeDocumentUploadPartUrls', summary: 'Create Document Upload Part URLs', description: 'Issue short-lived signed PUT URLs for up to 100 multipart part numbers.', @@ -864,6 +886,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CompleteKnowledgeDocumentUploadContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.uploadComplete, operationId: 'completeKnowledgeDocumentUpload', summary: 'Complete Document Upload', description: @@ -901,6 +924,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetKnowledgeDocumentContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.readDocument, operationId: 'getKnowledgeDocument', summary: 'Get Document', description: 'Retrieve document detail, processing state, and connector provenance.', @@ -931,6 +955,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateKnowledgeDocumentContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.updateDocument, operationId: 'updateKnowledgeDocument', summary: 'Update Document', description: `Rename a document, enable or disable it for search, set any of its 17 tag slots, or requeue it for processing. Absent fields are unchanged, and derived indexing state is read-only. Resolve a tag display name to its slot with \`GET /api/v2/knowledge/{knowledgeBaseId}/tags\`. The returned document omits the connector provenance the detail read carries. ${WORKSPACE_API_KEY_DENIED}`, @@ -965,6 +990,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteKnowledgeDocumentContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.deleteDocument, operationId: 'deleteKnowledgeDocument', summary: 'Delete Document', description: @@ -996,6 +1022,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListKnowledgeFoldersContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.listFolders, operationId: 'listKnowledgeFolders', summary: 'List Folders', description: `List folders in the knowledge-base folder tree with filtering and sorting. ${FULL_SET_LIST} ${FOLDER_TREE_TOO_LARGE}`, @@ -1020,6 +1047,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateKnowledgeFolderContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.createFolder, operationId: 'createKnowledgeFolder', summary: 'Create Folder', description: `Create a folder in the knowledge-base folder tree. ${FOLDER_TREE_TOO_LARGE}`, @@ -1046,6 +1074,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RelocateKnowledgeFolderContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.relocateFolder, operationId: 'relocateKnowledgeFolder', summary: 'Rename or Move Folder', description: `Rename or move a folder and atomically rewrite descendant paths. ${FOLDER_TREE_TOO_LARGE}`, @@ -1078,6 +1107,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteKnowledgeFolderContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.deleteFolder, operationId: 'deleteKnowledgeFolder', summary: 'Delete Folder', description: 'Delete a folder, optionally including nested folders and knowledge bases.', @@ -1104,6 +1134,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RestoreKnowledgeBaseContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.restore, operationId: 'restoreKnowledgeBase', summary: 'Restore Knowledge Base', description: `Un-archive a soft-deleted knowledge base along with its documents and connectors. Idempotent: a knowledge base that is already active is returned unchanged with no audit entry recorded. Restoring into an archived workspace is a \`409\`, and a knowledge base whose folder is still archived is returned to the workspace root. ${FOLDER_TREE_TOO_LARGE}`, @@ -1136,6 +1167,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2AddWorkspaceFilesToKnowledgeBaseContract, knowledgeOperation({ + applicationOperation: knowledgeOperations.addWorkspaceFiles, operationId: 'addWorkspaceFilesToKnowledgeBase', summary: 'Index Workspace Files', description: diff --git a/apps/sim/lib/api/contracts/v2/openapi/logs.ts b/apps/sim/lib/api/contracts/v2/openapi/logs.ts index 60b50f191ba..6774a4487aa 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/logs.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/logs.ts @@ -19,6 +19,7 @@ import { defineOpenApiRoute, type OpenApiOperationMetadata, } from '@/lib/api/openapi/types' +import { logOperations } from '@/lib/logs/application/operations' const RUN_ID = 'e4f8d2b6-9a1c-4e3d-8b7f-5c0a2d9e6f13' const WORKFLOW_ID = '3b1f7c92-8d4e-4a6b-9c0d-5e2f8a714b36' @@ -161,6 +162,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListLogsContract, logsOperation({ + applicationOperation: logOperations.list, operationId: 'listLogs', summary: 'List Logs', description: `List logs with filters, selectable detail, sorting, and cursor pagination. \`includeJobRuns=true\` includes chat and Sim-agent jobs only with \`sortBy=startedAt\`, because other orderings are unsupported. \`files\` contains only run-produced files; use the files API for input attachments. ${RUN_RETENTION} ${FOLDER_TREE_TOO_LARGE}`, @@ -186,6 +188,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetLogContract, logsOperation({ + applicationOperation: logOperations.readDetail, operationId: 'getLog', summary: 'Get Log', description: `Retrieve a run's workflow snapshot, trace spans, final output, and cost. Trace spans have separate retention, so an empty \`traceSpans\` array does not prove none were recorded. ${RUN_RETENTION} ${FOLDER_TREE_TOO_LARGE}`, @@ -212,6 +215,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetLogStatsContract, logsOperation({ + applicationOperation: logOperations.readStats, operationId: 'getLogStats', summary: 'Get Log Statistics', description: `Return workspace/workflow counts, success, errors, and latency. Defaults span runs, or 24 hours if empty; supplied bounds stay exact. Buckets are one-minute minimum and may pass the end. Folders include descendants; \`workflowsTruncated\` marks capped series, totals include all. ${RUN_RETENTION} ${FOLDER_TREE_TOO_LARGE}`, diff --git a/apps/sim/lib/api/contracts/v2/openapi/resources.ts b/apps/sim/lib/api/contracts/v2/openapi/resources.ts index ecbe417cff7..826b55bcb50 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/resources.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/resources.ts @@ -1,3 +1,4 @@ +import { v2MetaOperations } from '@/lib/api/application/operations' import { v2ExecuteToolContract, v2GetBlockContract, @@ -88,6 +89,15 @@ import { defineOpenApiRoute, type OpenApiOperationMetadata, } from '@/lib/api/openapi/types' +import { catalogOperations } from '@/lib/catalog/application/operations' +import { credentialOperations } from '@/lib/credentials/application/operations' +import { customToolOperations } from '@/lib/custom-tools/application/operations' +import { mcpServerOperations } from '@/lib/mcp/application/operations' +import { sandboxOperations } from '@/lib/sandboxes/application/operations' +import { secretOperations } from '@/lib/secrets/application/operations' +import { skillOperations } from '@/lib/skills/application/operations' +import { toolExecutionOperations } from '@/lib/tool-execution/application/operations' +import { workspaceOperations } from '@/lib/workspaces/application/operations' const BLOCK_SUMMARY_EXAMPLE = { id: 'slack', @@ -539,6 +549,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListWorkspacesContract, resourceOperation('Workspaces', { + applicationOperation: workspaceOperations.listPublic, operationId: 'listWorkspaces', summary: 'List Workspaces', description: @@ -565,6 +576,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetWorkspaceContract, resourceOperation('Workspaces', { + applicationOperation: workspaceOperations.readPublicDetail, operationId: 'getWorkspace', summary: 'Get Workspace', description: @@ -592,6 +604,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListWorkspaceMembersContract, resourceOperation('Workspaces', { + applicationOperation: workspaceOperations.listPublicMembers, operationId: 'listWorkspaceMembers', summary: 'List Workspace Members', description: @@ -624,6 +637,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListMcpServersContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.list, operationId: 'listMcpServers', summary: 'List MCP Servers', description: @@ -650,6 +664,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateMcpServerContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.create, operationId: 'createMcpServer', summary: 'Create MCP Server', description: @@ -686,6 +701,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetMcpServerContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.read, operationId: 'getMcpServer', summary: 'Get MCP Server', description: @@ -718,6 +734,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateMcpServerContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.update, operationId: 'updateMcpServer', summary: 'Update MCP Server', description: @@ -752,6 +769,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteMcpServerContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.delete, operationId: 'deleteMcpServer', summary: 'Delete MCP Server', description: @@ -784,6 +802,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListMcpServerToolsContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.discoverTools, operationId: 'listMcpServerTools', summary: 'List MCP Server Tools', description: `Return up to 1,000 tools and 5 MB with \`nextCursor: null\`, opening a connection and updating connection metadata. ${HEAD_MIRRORS_GET} Unavailable servers return \`503\`; invalid OAuth returns \`409\` with \`error.details.code: MCP_SERVER_REAUTHORIZATION_REQUIRED\` and requires human reauthorization. ${WORKSPACE_API_KEY_DENIED}`, @@ -815,6 +834,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListSkillsContract, resourceOperation('Skills', { + applicationOperation: skillOperations.list, operationId: 'listSkills', summary: 'List Skills', description: @@ -841,6 +861,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateSkillContract, resourceOperation('Skills', { + applicationOperation: skillOperations.create, operationId: 'createSkill', summary: 'Create Skill', description: `Create one skill in a workspace. Its kebab-case name must be unique and cannot be reserved by a built-in skill. ${WORKSPACE_API_KEY_DENIED}`, @@ -875,6 +896,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetSkillContract, resourceOperation('Skills', { + applicationOperation: skillOperations.read, operationId: 'getSkill', summary: 'Get Skill', description: @@ -907,6 +929,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateSkillContract, resourceOperation('Skills', { + applicationOperation: skillOperations.update, operationId: 'updateSkill', summary: 'Update Skill', description: `Update the supplied fields on a workspace skill. Omitted fields retain their stored values. Built-in skills are read-only. ${WORKSPACE_API_KEY_DENIED}`, @@ -940,6 +963,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteSkillContract, resourceOperation('Skills', { + applicationOperation: skillOperations.delete, operationId: 'deleteSkill', summary: 'Delete Skill', description: `Delete a workspace skill. Built-in skills are read-only and cannot be deleted. ${WORKSPACE_API_KEY_DENIED}`, @@ -971,6 +995,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListSkillEditorsContract, resourceOperation('Skills', { + applicationOperation: skillOperations.listEditors, operationId: 'listSkillEditors', summary: 'List Skill Editors', description: @@ -1003,6 +1028,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GrantSkillEditorContract, resourceOperation('Skills', { + applicationOperation: skillOperations.grantEditor, operationId: 'grantSkillEditor', summary: 'Grant Skill Editor', description: `Grant editor access to a current workspace member by email. The caller must already be a skill editor or workspace administrator. Workspace administrators already have derived editor access and cannot receive an explicit grant. A retried existing grant returns 200; a newly created grant returns 201. ${WORKSPACE_API_KEY_DENIED}`, @@ -1041,6 +1067,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RevokeSkillEditorContract, resourceOperation('Skills', { + applicationOperation: skillOperations.revokeEditor, operationId: 'revokeSkillEditor', summary: 'Revoke Skill Editor', description: `Revoke an explicit editor grant by email. The caller must already be a skill editor or workspace administrator. Workspace administrators have derived access that cannot be revoked. ${WORKSPACE_API_KEY_DENIED}`, @@ -1072,6 +1099,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListCustomToolsContract, resourceOperation('Custom Tools', { + applicationOperation: customToolOperations.list, operationId: 'listCustomTools', summary: 'List Custom Tools', description: @@ -1098,6 +1126,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateCustomToolContract, resourceOperation('Custom Tools', { + applicationOperation: customToolOperations.create, operationId: 'createCustomTool', summary: 'Create Custom Tool', description: @@ -1133,6 +1162,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetCustomToolContract, resourceOperation('Custom Tools', { + applicationOperation: customToolOperations.read, operationId: 'getCustomTool', summary: 'Get Custom Tool', description: 'Fetch one custom tool by identifier, scoped to its workspace.', @@ -1164,6 +1194,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateCustomToolContract, resourceOperation('Custom Tools', { + applicationOperation: customToolOperations.update, operationId: 'updateCustomTool', summary: 'Update Custom Tool', description: @@ -1198,6 +1229,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteCustomToolContract, resourceOperation('Custom Tools', { + applicationOperation: customToolOperations.delete, operationId: 'deleteCustomTool', summary: 'Delete Custom Tool', description: @@ -1230,6 +1262,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListSandboxesContract, resourceOperation('Sandboxes', { + applicationOperation: sandboxOperations.list, operationId: 'listSandboxes', summary: 'List Sandboxes', description: @@ -1256,6 +1289,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateSandboxContract, resourceOperation('Sandboxes', { + applicationOperation: sandboxOperations.create, operationId: 'createSandbox', summary: 'Create Sandbox', description: `Create a uniquely named sandbox. Prebuild deployments schedule an image build reported by \`buildStatus\`; runtime-install deployments or empty specs report \`buildStatus: null\`. Invalid dependency or system-package entries return \`400\` with field details. ${SANDBOX_ADMIN_PLAN_NOTE} ${SANDBOX_BUILD_BUDGET_NOTE} ${WORKSPACE_API_KEY_DENIED}`, @@ -1294,6 +1328,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetSandboxContract, resourceOperation('Sandboxes', { + applicationOperation: sandboxOperations.read, operationId: 'getSandbox', summary: 'Get Sandbox', description: @@ -1326,6 +1361,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateSandboxContract, resourceOperation('Sandboxes', { + applicationOperation: sandboxOperations.update, operationId: 'updateSandbox', summary: 'Update Sandbox', description: `Update supplied fields; omissions preserve values, lists replace whole lists, and names remain unique. Prebuild deployments rebuild changed specs, while resending an unchanged failed spec retries it; runtime-install or empty specs report \`buildStatus: null\`. ${SANDBOX_ADMIN_PLAN_NOTE} ${SANDBOX_BUILD_BUDGET_NOTE} ${WORKSPACE_API_KEY_DENIED}`, @@ -1368,6 +1404,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteSandboxContract, resourceOperation('Sandboxes', { + applicationOperation: sandboxOperations.delete, operationId: 'deleteSandbox', summary: 'Delete Sandbox', description: `Delete a sandbox. Function blocks still selecting it fail closed until reconfigured. A prebuilt image is released when no sandbox shares it; runtime-install and empty specs have no image to release. ${SANDBOX_ADMIN_PLAN_NOTE} ${WORKSPACE_API_KEY_DENIED}`, @@ -1399,6 +1436,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListCredentialsContract, resourceOperation('Credentials', { + applicationOperation: credentialOperations.listConnections, operationId: 'listCredentials', summary: 'List Credentials', description: @@ -1425,6 +1463,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListCredentialProvidersContract, resourceOperation('Credentials', { + applicationOperation: credentialOperations.listProviders, operationId: 'listCredentialProviders', summary: 'List Credential Providers', description: `List catalogued OAuth and service-account connection methods and whether each is available to the caller in this workspace and deployment. Optionally search provider names with a case-insensitive substring match. OAuth authorization options contain the exact provider IDs accepted by the browser connection endpoint; service-account methods list the exact create-body fields and mark secret fields write-only. ${FULL_SET_LIST}`, @@ -1455,6 +1494,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateServiceAccountCredentialContract, resourceOperation('Credentials', { + applicationOperation: credentialOperations.createServiceAccount, operationId: 'createServiceAccountCredential', summary: 'Create Service-Account Credential', description: `Verify and store one service-account credential. Use provider discovery to select a service-account provider, then encode its required fields as the JSON object string in credentials. The credentials string is write-only and is never returned. A retried source match returns the existing credential with 200; a newly created credential returns 201. ${WORKSPACE_API_KEY_DENIED}`, @@ -1496,6 +1536,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateCredentialConnectionContract, resourceOperation('Credentials', { + applicationOperation: credentialOperations.createConnection, operationId: 'createCredentialConnection', summary: 'Create Credential Connection', description: `Create a short-lived browser URL for connecting an OAuth provider or reconnecting an existing OAuth credential. Open the URL, sign in as the authenticated user, complete provider authorization, then refresh the credentials list. ${WORKSPACE_API_KEY_DENIED}`, @@ -1522,6 +1563,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteCredentialContract, resourceOperation('Credentials', { + applicationOperation: credentialOperations.delete, operationId: 'deleteCredential', summary: 'Disconnect Credential', description: `Disconnect an OAuth or service-account credential and clear its stored workflow, deployment, paused-run, knowledge-connector, and webhook references. Credential admin access is required. ${WORKSPACE_API_KEY_DENIED}`, @@ -1553,6 +1595,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListSecretsContract, resourceOperation('Secrets', { + applicationOperation: secretOperations.list, operationId: 'listSecrets', summary: 'List Secrets', description: `List workspace and caller-owned personal secret metadata with opaque cursor pagination. Rows for workspace secrets marked visible (unredacted) include the stored value; every other row is metadata-only and no other response ever carries a value. ${WORKSPACE_API_KEY_DENIED}`, @@ -1578,6 +1621,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2SetSecretContract, resourceOperation('Secrets', { + applicationOperation: secretOperations.set, operationId: 'setSecret', summary: 'Set Secret', description: `Create or replace a workspace or personal secret. Values are encrypted at rest, write-only, and never returned. For an existing workspace secret, omit \`value\` to update only \`description\` or \`unredacted\`; the value remains untouched. This metadata-only form cannot create a secret and returns \`404\` when absent. Personal secrets always require \`value\`. ${WORKSPACE_API_KEY_DENIED}`, @@ -1630,6 +1674,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteSecretContract, resourceOperation('Secrets', { + applicationOperation: secretOperations.delete, operationId: 'deleteSecret', summary: 'Delete Secret', description: `Delete a workspace or caller-owned personal secret without reading or returning its stored value. ${WORKSPACE_API_KEY_DENIED}`, @@ -1669,6 +1714,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetMetaContract, resourceOperation('Meta', { + applicationOperation: v2MetaOperations.read, operationId: 'getApiMeta', summary: 'Get API Capabilities', description: @@ -1690,6 +1736,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListWorkflowMcpServersContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.listWorkflowDeployments, operationId: 'listWorkflowMcpServers', summary: 'List Workflow MCP Servers', description: `List servers that publish deployed workflows to outside MCP clients; \`GET /api/v2/mcp-servers\` instead lists external servers Sim calls. Entries include client endpoints and tool names. A page shares a 2,000-name budget, so trailing servers may show partial inventories; read a server's tools endpoint for its full set. ${WORKSPACE_API_KEY_DENIED}`, @@ -1710,6 +1757,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateWorkflowMcpServerContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.createWorkflowDeploymentServer, operationId: 'createWorkflowMcpServer', summary: 'Create Workflow MCP Server', description: `Publish a new MCP server for a workspace, optionally seeding it with workflows to expose as tools. Every workflow named in \`workflowIds\` must already be deployed. Setting \`isPublic\` lets any MCP client holding the server URL execute the workflows it publishes without a Sim API key. ${WORKSPACE_API_KEY_DENIED}`, @@ -1731,6 +1779,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetWorkflowMcpServerContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.readWorkflowDeploymentServer, operationId: 'getWorkflowMcpServer', summary: 'Get Workflow MCP Server', description: `Read one published MCP server. The list is the only other place this state is published, so a caller holding a server id would otherwise have to page the collection and filter client-side. The tools it publishes are on its \`tools\` sub-resource. ${WORKSPACE_API_KEY_DENIED}`, @@ -1752,6 +1801,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListWorkflowMcpToolsContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.listWorkflowDeploymentTools, operationId: 'listWorkflowMcpTools', summary: 'List Workflow MCP Tools', description: `Every tool a server publishes, tool-name ordered. The server list reports tool *names* only, so this is where a caller reads the \`workflowId\` that \`DELETE /api/v2/workflow-mcp-servers/{serverId}/tools/{workflowId}\` addresses. Returned in one page rather than paged — so \`nextCursor\` is always null — and capped at 2,000 tools, which is far above any real server's inventory. ${WORKSPACE_API_KEY_DENIED}`, @@ -1779,6 +1829,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateWorkflowMcpServerContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.updateWorkflowDeploymentServer, operationId: 'updateWorkflowMcpServer', summary: 'Update Workflow MCP Server', description: `Rename, re-describe, or change the public visibility of a published MCP server. Merge-patch shaped: an omitted key is unchanged and \`description: null\` clears the description. Publishing and unpublishing the workflows it serves are separate operations on its \`tools\` sub-resource. ${WORKSPACE_API_KEY_DENIED}`, @@ -1801,6 +1852,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteWorkflowMcpServerContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.deleteWorkflowDeploymentServer, operationId: 'deleteWorkflowMcpServer', summary: 'Delete Workflow MCP Server', description: `Unpublish an MCP server. Every tool it served stops answering and connected clients lose the endpoint. The workflows themselves are untouched — their own deployments stay live and executable through the workflow API. ${WORKSPACE_API_KEY_DENIED}`, @@ -1822,6 +1874,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeployWorkflowMcpToolContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.deployWorkflowTool, operationId: 'deployWorkflowMcpTool', summary: 'Publish Workflow As MCP Tool', description: `Publish a deployed workflow as a tool on an MCP server. The tool's input schema is generated from the deployed workflow's input format, so the workflow must already be deployed. Idempotent per workflow: a server carries at most one tool per workflow, so a repeat call replaces the existing tool and answers \`200\` with \`updated: true\` rather than conflicting. ${WORKSPACE_API_KEY_DENIED}`, @@ -1844,6 +1897,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UndeployWorkflowMcpToolContract, resourceOperation('MCP Servers', { + applicationOperation: mcpServerOperations.undeployWorkflowTool, operationId: 'undeployWorkflowMcpTool', summary: 'Unpublish Workflow MCP Tool', description: `Remove a workflow from an MCP server. Addressed by workflow rather than by tool identifier, because a server carries at most one live tool per workflow. The workflow's own deployment is untouched. ${WORKSPACE_API_KEY_DENIED}`, @@ -1874,6 +1928,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateCredentialContract, resourceOperation('Credentials', { + applicationOperation: credentialOperations.update, operationId: 'updateCredential', summary: 'Update Credential', description: `Rename a service-account credential or rotate its write-only secret fields. Omissions preserve values; \`description: null\` clears the description. Secret fields sent for another credential type return \`400\`. The provider verifies replacements before storage: rejection leaves the old secret intact and returns \`400\` with \`providerErrorCode\`; provider outages return \`503\`. The preserved credential ID keeps all references working. Credential admin access is required. ${WORKSPACE_API_KEY_DENIED}`, @@ -1912,6 +1967,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListBlocksContract, resourceOperation('Catalog', { + applicationOperation: catalogOperations.listBlocks, operationId: 'listBlocks', summary: 'List Blocks', description: @@ -1938,6 +1994,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetBlockContract, resourceOperation('Catalog', { + applicationOperation: catalogOperations.readBlock, operationId: 'getBlock', summary: 'Get Block', description: @@ -1970,6 +2027,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListToolsContract, resourceOperation('Catalog', { + applicationOperation: catalogOperations.listTools, operationId: 'listTools', summary: 'List Tools', description: @@ -1996,6 +2054,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetToolContract, resourceOperation('Catalog', { + applicationOperation: catalogOperations.readTool, operationId: 'getTool', summary: 'Get Tool', description: @@ -2028,6 +2087,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ExecuteToolContract, resourceOperation('Catalog', { + applicationOperation: toolExecutionOperations.execute, operationId: 'executeTool', summary: 'Run Tool', description: `Run a built-in tool using published parameter IDs. Sim resolves \`credentialId\`, hosted keys, and whole-value \`{{VAR_NAME}}\` references for \`user-only\` parameters; other values pass through verbatim. Third-party refusal returns \`200\` with \`status: "failed"\`; the error envelope covers API failures. Hidden or missing tools return \`404\`; disallowed integrations return \`403\` with \`error.details.code: INTEGRATION_NOT_ALLOWED\`. Hosted-key use is billed to the workspace. ${WORKSPACE_API_KEY_DENIED}`, @@ -2067,6 +2127,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListConnectorTypesContract, resourceOperation('Catalog', { + applicationOperation: catalogOperations.listConnectorTypes, operationId: 'listConnectorTypes', summary: 'List Connector Types', description: `List connector types and accepted source configuration. A field with \`multi: true\` stores \`string[]\`. \`canonicalParamId\` links picker and manual fields that write the same key; send exactly one, keyed by \`canonicalParamId\` rather than its own \`id\`. ${FULL_SET_LIST}`, diff --git a/apps/sim/lib/api/contracts/v2/openapi/shared.ts b/apps/sim/lib/api/contracts/v2/openapi/shared.ts index 81d6726b3e3..acee16e5fa2 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/shared.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/shared.ts @@ -332,7 +332,7 @@ export const V2_AUTH_SECURITY_SCHEMES = { scheme: 'bearer', bearerFormat: 'OAuth 2.0 access token', description: - 'A Sim OAuth access token obtained by a registered client through the authorization-code flow. The token must carry the scope required by the operation.', + 'A Sim OAuth access token obtained by a registered client through the authorization-code flow. Each operation declares its required scope: api:read permits reads and searches; api:write also permits changes and execution and implies api:read. Scope requirements follow the application operation, independent of HTTP method or workspace role.', }, } as const satisfies Readonly> @@ -366,7 +366,7 @@ export const FULL_SET_LIST = 'The bounded set is returned in one page; `nextCurs * Pinned by `contracts/v2/openapi/head-not-safe.test.ts`. */ export const HEAD_MIRRORS_GET = - '`HEAD` skips the effect but uses `GET` authorization, returning the corresponding `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; it confirms access only.' + '`HEAD` skips the effect but uses `GET` authorization, returning `400`, `401`, `403`, or `404`, or an empty `200` with no payload headers; confirms access only.' /** * Appended where the skipped payload headers are the ones a caller is most @@ -386,7 +386,7 @@ export const HEAD_OMITS_PAYLOAD_HEADERS = * so it is not something a workspace owner can grant around. */ export const WORKSPACE_API_KEY_DENIED = - 'A workspace API key is rejected with `403`; use a personal API key or an appropriately scoped OAuth token.' + 'Workspace API keys return `403`; use a personal API key or appropriately scoped OAuth token.' /** * {@link WORKSPACE_API_KEY_DENIED} for an operation behind the resource-concealment @@ -424,7 +424,7 @@ export const WORKSPACE_API_KEY_DENIED_AS_NOT_FOUND = * cannot drift into two paraphrases of one window. */ export const RUN_RETENTION = - 'Expired runs are hard-deleted and simply absent. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override.' + 'Expired runs are hard-deleted. Retention is 30 days from run start on Free, unbounded on Pro and Team, and configured per organization on Enterprise with an optional workspace override.' /** * Response headers a binary download declares on top of the common set. Shared diff --git a/apps/sim/lib/api/contracts/v2/openapi/tables.ts b/apps/sim/lib/api/contracts/v2/openapi/tables.ts index 8fe5aeb0896..7dbc5c4e0e6 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/tables.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/tables.ts @@ -76,6 +76,7 @@ import { type OpenApiOperationMetadata, type OpenApiSuccessMetadata, } from '@/lib/api/openapi/types' +import { tableOperations } from '@/lib/table/application/operations' import { TABLE_LIMITS } from '@/lib/table/constants' const WORKSPACE_ID = 'a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64' @@ -137,6 +138,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListTablesContract, tableOperation({ + applicationOperation: tableOperations.list, operationId: 'listTables', summary: 'List Tables', description: `List tables in a workspace with optional folder filtering, search, sorting, and an opaque cursor envelope. \`scope=archived\` lists tables a \`DELETE\` archived, which \`POST /api/v2/tables/{tableId}/restore\` can bring back. ${FOLDER_TREE_TOO_LARGE}`, @@ -161,6 +163,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateTableContract, tableOperation({ + applicationOperation: tableOperations.create, operationId: 'createTable', summary: 'Create Table', description: 'Create a table with a typed column schema and optional folder placement.', @@ -199,6 +202,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetTableContract, tableOperation({ + applicationOperation: tableOperations.read, operationId: 'getTable', summary: 'Get Table', description: `Retrieve a table with its metadata, column schema, locks, and current job. ${FOLDER_TREE_TOO_LARGE}`, @@ -229,6 +233,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteTableContract, tableOperation({ + applicationOperation: tableOperations.delete, operationId: 'deleteTable', summary: 'Delete Table', description: @@ -260,6 +265,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateTableContract, tableOperation({ + applicationOperation: tableOperations.update, operationId: 'updateTable', summary: 'Update Table', description: `Rename a table, edit its description, or move it to a canonical folder. At least one mutable field is required; lock flags are read-only.\n\nNOT atomic: fields are written independently, so a 4xx may follow a partial update. When fields were applied, \`details.applied\` names them; retry only the missing fields. If it is absent, nothing changed.\n\n${FOLDER_TREE_TOO_LARGE}`, @@ -292,6 +298,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2AddTableColumnContract, tableOperation({ + applicationOperation: tableOperations.addColumn, operationId: 'addTableColumn', summary: 'Add Column', description: 'Add a typed column and return the complete resulting table schema.', @@ -324,6 +331,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateTableColumnContract, tableOperation({ + applicationOperation: tableOperations.updateColumn, operationId: 'updateTableColumn', summary: 'Update Column', description: 'Update a column by name and return the complete resulting table schema.', @@ -356,6 +364,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteTableColumnContract, tableOperation({ + applicationOperation: tableOperations.deleteColumn, operationId: 'deleteTableColumn', summary: 'Delete Column', description: 'Delete a column by name while preserving at least one table column.', @@ -388,6 +397,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListTableRowsContract, tableOperation({ + applicationOperation: tableOperations.listRows, operationId: 'listTableRows', summary: 'List Rows', description: @@ -419,6 +429,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateTableRowsContract, tableOperation({ + applicationOperation: tableOperations.createRows, operationId: 'createTableRows', summary: 'Create Rows', description: @@ -452,6 +463,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateRowsByFilterContract, tableOperation({ + applicationOperation: tableOperations.updateRows, operationId: 'updateTableRows', summary: 'Update Rows by Filter', description: 'Apply the same partial data patch to every row matching a non-empty predicate.', @@ -490,6 +502,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteTableRowsContract, tableOperation({ + applicationOperation: tableOperations.deleteRows, operationId: 'deleteTableRows', summary: 'Delete Rows', description: @@ -523,6 +536,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetTableRowContract, tableOperation({ + applicationOperation: tableOperations.readRow, operationId: 'getTableRow', summary: 'Get Row', description: @@ -554,6 +568,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateTableRowContract, tableOperation({ + applicationOperation: tableOperations.updateRow, operationId: 'updateTableRow', summary: 'Update Row', description: 'Merge a partial data patch into one row by identifier.', @@ -586,6 +601,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteTableRowContract, tableOperation({ + applicationOperation: tableOperations.deleteRow, operationId: 'deleteTableRow', summary: 'Delete Row', description: 'Delete one row by identifier.', @@ -616,6 +632,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpsertTableRowContract, tableOperation({ + applicationOperation: tableOperations.upsertRow, operationId: 'upsertTableRow', summary: 'Upsert Row', description: @@ -655,6 +672,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2QueryRowsContract, tableOperation({ + applicationOperation: tableOperations.queryRows, operationId: 'queryTableRows', summary: 'Query Rows', description: @@ -708,6 +726,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2QueryRowsCountContract, tableOperation({ + applicationOperation: tableOperations.queryRows, operationId: 'countTableRows', summary: 'Count Rows', description: @@ -746,6 +765,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListTableViewsContract, tableOperation({ + applicationOperation: tableOperations.listViews, operationId: 'listTableViews', summary: 'List Views', description: `List the bounded set of saved table views, with references to removed columns pruned on read. ${FULL_SET_LIST}`, @@ -776,6 +796,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateTableViewContract, tableOperation({ + applicationOperation: tableOperations.createView, operationId: 'createTableView', summary: 'Create View', description: 'Save a filter, sort, and column layout as a named presentation of a table.', @@ -817,6 +838,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetTableViewContract, tableOperation({ + applicationOperation: tableOperations.readView, operationId: 'getTableView', summary: 'Get View', description: 'Retrieve one saved table view by identifier.', @@ -848,6 +870,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateTableViewContract, tableOperation({ + applicationOperation: tableOperations.updateView, operationId: 'updateTableView', summary: 'Update View', description: @@ -881,6 +904,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteTableViewContract, tableOperation({ + applicationOperation: tableOperations.deleteView, operationId: 'deleteTableView', summary: 'Delete View', description: 'Delete a saved presentation without changing any table rows.', @@ -911,6 +935,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListWorkflowGroupsContract, tableOperation({ + applicationOperation: tableOperations.listGroups, operationId: 'listTableWorkflowGroups', summary: 'List Workflow Groups', description: `List the workflow and enrichment groups that can be dispatched for a table. ${FULL_SET_LIST}`, @@ -941,6 +966,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2AddWorkflowGroupContract, tableOperation({ + applicationOperation: tableOperations.createGroup, operationId: 'addTableWorkflowGroup', summary: 'Add Workflow Group', description: @@ -984,6 +1010,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateWorkflowGroupContract, tableOperation({ + applicationOperation: tableOperations.updateGroup, operationId: 'updateTableWorkflowGroup', summary: 'Update Workflow Group', description: @@ -1017,6 +1044,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteWorkflowGroupContract, tableOperation({ + applicationOperation: tableOperations.deleteGroup, operationId: 'deleteTableWorkflowGroup', summary: 'Delete Workflow Group', description: 'Delete a workflow group and every table column populated by that group.', @@ -1049,6 +1077,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateTableDispatchContract, tableOperation({ + applicationOperation: tableOperations.startRun, operationId: 'createTableDispatch', summary: 'Create Run Dispatch', description: @@ -1082,6 +1111,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RunRowEnrichmentContract, tableOperation({ + applicationOperation: tableOperations.startRun, operationId: 'runRowEnrichment', summary: 'Run Enrichment For One Row', description: @@ -1115,6 +1145,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2SearchTableRowsContract, tableOperation({ + applicationOperation: tableOperations.searchRows, operationId: 'searchTableRows', summary: 'Search Rows', description: `Search every cell case-insensitively for substring \`q\`, optionally within a predicate-filtered, sorted view. This is text search; \`POST /query\` performs structured predicate reads. Results are cell coordinates \`{ ordinal, rowId, column }\`, never row data; \`ordinal\` indexes the same view paged by \`POST /query\`. Results are uncursored and capped at ${TABLE_LIMITS.MAX_FIND_MATCHES}; \`truncated\` signals more matches. Narrow \`q\` or the predicate instead of paging.`, @@ -1153,6 +1184,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateTableImportContract, tableOperation({ + applicationOperation: tableOperations.createImport, operationId: 'createTableImport', summary: 'Create Table Import', description: @@ -1187,6 +1219,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetTableImportContract, tableOperation({ + applicationOperation: tableOperations.readImport, operationId: 'getTableImport', summary: 'Get Table Import', description: @@ -1225,6 +1258,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CancelTableImportContract, tableOperation({ + applicationOperation: tableOperations.cancelImport, operationId: 'cancelTableImport', summary: 'Cancel Table Import', description: @@ -1262,6 +1296,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateTableImportPartUrlsContract, tableOperation({ + applicationOperation: tableOperations.createImportParts, operationId: 'createTableImportPartUrls', summary: 'Create Table Import Part URLs', description: @@ -1306,6 +1341,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CompleteTableImportContract, tableOperation({ + applicationOperation: tableOperations.completeImport, operationId: 'completeTableImportUpload', summary: 'Complete Table Import Upload', description: @@ -1343,6 +1379,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateTableExportContract, tableOperation({ + applicationOperation: tableOperations.createExport, operationId: 'createTableExport', summary: 'Create Table Export', description: @@ -1376,6 +1413,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetTableExportContract, tableOperation({ + applicationOperation: tableOperations.readExport, operationId: 'getTableExport', summary: 'Get Table Export', description: 'Read progress and terminal state for a durable table export.', @@ -1407,6 +1445,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CancelTableExportContract, tableOperation({ + applicationOperation: tableOperations.cancelExport, operationId: 'cancelTableExport', summary: 'Cancel Table Export', description: 'Cancel an export that has not reached a terminal state.', @@ -1437,6 +1476,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2TableExportDownloadContract, tableOperation({ + applicationOperation: tableOperations.downloadExport, operationId: 'downloadTableExport', summary: 'Download Table Export', description: @@ -1468,6 +1508,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CancelTableRunsContract, tableOperation({ + applicationOperation: tableOperations.cancelRuns, operationId: 'cancelTableRuns', summary: 'Cancel Column Runs', description: @@ -1501,6 +1542,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListTableFoldersContract, tableOperation({ + applicationOperation: tableOperations.listFolders, operationId: 'listTablesFolders', summary: 'List Folders', description: `List table folders, optionally restricting the result to direct children of a canonical parent path. ${FULL_SET_LIST}`, @@ -1525,6 +1567,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateTableFolderContract, tableOperation({ + applicationOperation: tableOperations.createFolder, operationId: 'createTablesFolder', summary: 'Create Folder', description: 'Create one table-folder leaf whose parent path already exists.', @@ -1551,6 +1594,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RelocateTableFolderContract, tableOperation({ + applicationOperation: tableOperations.updateFolder, operationId: 'relocateTablesFolder', summary: 'Rename or Move Folder', description: 'Rename or move a table folder and update all descendant paths.', @@ -1583,6 +1627,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteTableFolderContract, tableOperation({ + applicationOperation: tableOperations.deleteFolder, operationId: 'deleteTablesFolder', summary: 'Delete Folder', description: @@ -1608,6 +1653,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RestoreTableFolderContract, tableOperation({ + applicationOperation: tableOperations.restoreFolder, operationId: 'restoreTablesFolder', summary: 'Restore Folder', description: @@ -1635,6 +1681,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RestoreTableContract, tableOperation({ + applicationOperation: tableOperations.restore, operationId: 'restoreTable', summary: 'Restore Table', description: @@ -1668,6 +1715,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2BulkUpdateTableRowsContract, tableOperation({ + applicationOperation: tableOperations.updateRows, operationId: 'bulkUpdateTableRows', summary: 'Bulk Update Rows', description: @@ -1709,6 +1757,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetRowEnrichmentContract, tableOperation({ + applicationOperation: tableOperations.readRow, operationId: 'getRowEnrichment', summary: 'Get Enrichment Run Detail', description: @@ -1740,6 +1789,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetTableDispatchContract, tableOperation({ + applicationOperation: tableOperations.readRun, operationId: 'getTableDispatch', summary: 'Get Run Dispatch', description: @@ -1771,6 +1821,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CancelTableDispatchContract, tableOperation({ + applicationOperation: tableOperations.cancelRuns, operationId: 'cancelTableDispatch', summary: 'Cancel Run Dispatch', description: @@ -1802,6 +1853,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListTableDispatchesContract, tableOperation({ + applicationOperation: tableOperations.readRun, operationId: 'listTableDispatches', summary: 'List Active Run Dispatches', description: @@ -1833,6 +1885,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2MoveTablesContract, tableOperation({ + applicationOperation: tableOperations.bulkMove, operationId: 'moveTables', summary: 'Move Tables and Folders', description: @@ -1867,6 +1920,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2BulkDeleteTablesContract, tableOperation({ + applicationOperation: tableOperations.bulkDelete, operationId: 'bulkDeleteTables', summary: 'Bulk Delete Tables and Folders', description: diff --git a/apps/sim/lib/api/contracts/v2/openapi/workflows.ts b/apps/sim/lib/api/contracts/v2/openapi/workflows.ts index 1b67ab23860..f60b9495fcf 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/workflows.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/workflows.ts @@ -73,6 +73,8 @@ import { defineOpenApiRoute, type OpenApiOperationMetadata, } from '@/lib/api/openapi/types' +import { chatDeploymentOperations } from '@/lib/chat-deployments/application/operations' +import { workflowOperations } from '@/lib/workflows/application/operations' const WORKSPACE_ID = 'a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64' const WORKFLOW_ID = '3b1f7c92-8d4e-4a6b-9c0d-5e2f8a714b36' @@ -245,6 +247,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListWorkflowsContract, workflowOperation({ + applicationOperation: workflowOperations.list, operationId: 'listWorkflows', summary: 'List Workflows', description: `List workflows in a workspace with lifecycle scope, folder and deployment filters, search, sorting, and opaque cursor pagination. \`scope\` defaults to \`active\`; pass \`archived\` to list workflows a \`DELETE\` archived. ${FOLDER_TREE_TOO_LARGE}`, @@ -265,6 +268,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.create, operationId: 'createWorkflowV2', summary: 'Create Workflow', description: `Create a workflow in a workspace root or canonical workflow folder. The response carries the blocks the platform seeded the workflow with, so the start block's id is available without a second request — attach edges to it directly. ${FOLDER_TREE_TOO_LARGE}`, @@ -297,6 +301,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetWorkflowStateContract, workflowOperation({ + applicationOperation: workflowOperations.read, operationId: 'getWorkflowState', summary: 'Get Workflow State', description: @@ -325,6 +330,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ReplaceWorkflowStateContract, workflowOperation({ + applicationOperation: workflowOperations.replaceState, operationId: 'replaceWorkflowState', summary: 'Replace Workflow State', description: @@ -363,10 +369,11 @@ const declaredRoutes = [ defineOpenApiRoute( v2ApplyWorkflowOperationsContract, workflowOperation({ + applicationOperation: workflowOperations.applyOperations, operationId: 'applyWorkflowOperations', summary: 'Apply Workflow Operations', description: - 'Apply graph edits and optional block enablement in one atomic write. Failed operations appear in `skipped`; `deferred` edges resolve when targets exist and must not be retried. With `atomic`, any skip or dropped input returns `409` with `OPERATIONS_NOT_APPLIED` and persists nothing. Non-UUID labels are minted and same-batch references remapped in `mintedBlockIds`. Lint is advisory. `dryRun=true` runs the same checks without persistence, audit, or notification. This changes only the draft. Workspace keys are rejected; use personal keys or OAuth.', + 'Apply graph edits and optional block enablement atomically. Failed operations appear in `skipped`; `deferred` edges resolve when targets exist and must not be retried. With `atomic`, any skip or dropped input returns `409` with `OPERATIONS_NOT_APPLIED` and persists nothing. Non-UUID labels are minted and same-batch references remapped in `mintedBlockIds`. Lint is advisory. `dryRun=true` runs the same checks without persistence, audit, or notification. This changes only the draft. Workspace keys are rejected; use personal keys or OAuth.', errors: RESOURCE_MUTATION_ERRORS, success: jsonSuccess('The batch was applied.'), }), @@ -424,6 +431,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ApplyWorkflowVariablesContract, workflowOperation({ + applicationOperation: workflowOperations.applyVariableOperations, operationId: 'applyWorkflowVariables', summary: 'Update Workflow Variables', description: @@ -447,6 +455,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DuplicateWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.duplicate, operationId: 'duplicateWorkflow', summary: 'Duplicate Workflow', description: `Copy a workflow, including its blocks, edges, subflows, and variables, into the same workspace. Omitting \`name\` reuses the source name; a collision inside the destination folder is deduplicated rather than refused. ${FOLDER_TREE_TOO_LARGE}`, @@ -480,6 +489,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RestoreWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.restore, operationId: 'restoreWorkflow', summary: 'Restore Workflow', description: `Bring an archived workflow back, along with the schedules, webhooks, MCP tools, and chats that were archived with it. A workflow that is not archived answers \`409\`. A workflow whose folder was archived is restored to the workspace root. ${FOLDER_TREE_TOO_LARGE}`, @@ -501,6 +511,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2MoveWorkflowsContract, workflowOperation({ + applicationOperation: workflowOperations.moveBulk, operationId: 'moveWorkflows', summary: 'Move Workflows', description: `Relocate up to 100 workflows into one folder. Explicitly best-effort: each workflow moves in its own transaction, and one that is absent from the workspace, archived, or locked lands in \`failed\` while the rest still move. Duplicate ids are collapsed. ${FOLDER_TREE_TOO_LARGE}`, @@ -522,6 +533,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.read, operationId: 'getWorkflow', summary: 'Get Workflow', description: `Get a workflow with its variables and deployed API-trigger inputs. ${FOLDER_TREE_TOO_LARGE}`, @@ -543,6 +555,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.update, operationId: 'updateWorkflowV2', summary: 'Update Workflow', description: `Rename, describe, or move a workflow to a canonical folder path. ${FOLDER_TREE_TOO_LARGE}`, @@ -565,6 +578,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.delete, operationId: 'deleteWorkflowV2', summary: 'Delete Workflow', description: @@ -587,6 +601,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListWorkflowVersionsContract, workflowOperation({ + applicationOperation: workflowOperations.listVersions, operationId: 'listWorkflowVersionsV2', summary: 'List Workflow Versions', description: 'List immutable deployment versions of a workflow, newest first.', @@ -608,6 +623,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetWorkflowVersionContract, workflowOperation({ + applicationOperation: workflowOperations.readVersion, operationId: 'getWorkflowVersionV2', summary: 'Get Workflow Version', description: 'Get an immutable deployment version and its pinned workflow graph snapshot.', @@ -641,6 +657,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateWorkflowVersionContract, workflowOperation({ + applicationOperation: workflowOperations.updateVersion, operationId: 'updateWorkflowVersionV2', summary: 'Update Workflow Version', description: @@ -672,6 +689,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ActivateWorkflowVersionContract, workflowOperation({ + applicationOperation: workflowOperations.activateVersion, operationId: 'activateWorkflowVersion', summary: 'Activate Workflow Version', description: `Promote an existing deployment version to live. Activation is asynchronous; inspect \`isDeployed\` and \`latestDeploymentAttempt\` for current state. Unlike \`rollback\`, the target is named by the path and the workflow need not already be deployed. ${WORKSPACE_API_KEY_DENIED}`, @@ -717,6 +735,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RevertWorkflowVersionContract, workflowOperation({ + applicationOperation: workflowOperations.revertVersion, operationId: 'revertWorkflowVersion', summary: 'Revert Workflow To Version', description: `Overwrite the editable draft with a deployment version, irreversibly discarding unsaved edits. This does not change the live version; use \`activate\` or \`rollback\` for production, both of which leave the draft unchanged. Pass \`active\` to reset the draft to the live graph. ${WORKSPACE_API_KEY_DENIED}`, @@ -739,6 +758,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetWorkflowDeploymentContract, workflowOperation({ + applicationOperation: workflowOperations.read, operationId: 'getWorkflowDeployment', summary: 'Get Workflow Deployment', description: `Read the live version, latest deployment attempt and readiness, draft drift (\`needsRedeployment\`), and \`isPublicApi\`. When \`isPublicApi\` is true, anyone with the execution URL can run and consume billed usage without an API key; change it with \`PATCH /workflows/{workflowId}/deployment\`. ${WORKFLOW_DEPLOYMENT_VS_CHAT}`, @@ -788,6 +808,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UpdateWorkflowPublicApiContract, workflowOperation({ + applicationOperation: workflowOperations.updatePublicApi, operationId: 'updateWorkflowPublicApi', summary: 'Update Workflow Public API Access', description: `Enable or disable unauthenticated public execution of the deployed workflow. While enabled, anyone holding the execution URL can run the workflow without an API key. An organization that forbids public sharing refuses this with \`403\` and \`PUBLIC_SHARING_NOT_ALLOWED\`. ${WORKFLOW_DEPLOYMENT_VS_CHAT} ${WORKSPACE_API_KEY_DENIED}`, @@ -810,6 +831,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeployWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.deploy, operationId: 'deployWorkflow', summary: 'Deploy Workflow', description: `Create and asynchronously activate a deployment version. Not idempotent: every call mints a new version, so a retry after a timeout creates a second one. A deployment that would conflict with an existing webhook path is a \`409\`. ${WORKSPACE_API_KEY_DENIED}`, @@ -855,6 +877,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2UndeployWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.undeploy, operationId: 'undeployWorkflow', summary: 'Undeploy Workflow', description: `Deactivate the currently serving workflow version. ${WORKSPACE_API_KEY_DENIED}`, @@ -887,6 +910,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RollbackWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.activateVersion, operationId: 'rollbackWorkflow', summary: 'Rollback Workflow', description: `Asynchronously reactivate a previous deployment version, selecting the preceding active version when no version is supplied. Use this to step back from the currently live version; to make a specific version live by naming it in the path — including when the workflow is not currently deployed — use \`POST /workflows/{workflowId}/versions/{version}/activate\`. Neither touches the draft. ${WORKSPACE_API_KEY_DENIED}`, @@ -932,6 +956,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ExportWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.export, operationId: 'exportWorkflow', summary: 'Export Workflow', description: `Export a portable, secret-sanitized workflow; workspace-scoped bindings must be selected again after import. Exporting records an audit event. ${HEAD_MIRRORS_GET} ${FOLDER_TREE_TOO_LARGE}`, @@ -968,6 +993,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ImportWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.import, operationId: 'importWorkflow', summary: 'Import Workflow', description: `Create a workflow from a portable export object, bare state, or JSON string. ${FOLDER_TREE_TOO_LARGE}`, @@ -1001,6 +1027,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListChatDeploymentsContract, workflowOperation({ + applicationOperation: chatDeploymentOperations.list, operationId: 'listChatDeployments', summary: 'List Chat Deployments', description: @@ -1022,6 +1049,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetWorkflowChatDeploymentContract, workflowOperation({ + applicationOperation: chatDeploymentOperations.read, operationId: 'getWorkflowChatDeployment', summary: 'Get Workflow Chat Deployment', description: `Read a workflow’s singleton hosted chat, or return \`404\` when none exists. ${CHAT_VS_WORKFLOW_DEPLOYMENT} The password is never returned; \`hasPassword\` reports its presence. Visitor-gate fields (\`authType\`, \`hasPassword\`, and \`allowedEmails\`) require workspace admin access. ${WORKSPACE_API_KEY_DENIED}`, @@ -1043,6 +1071,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ReplaceWorkflowChatDeploymentContract, workflowOperation({ + applicationOperation: chatDeploymentOperations.replace, operationId: 'replaceWorkflowChatDeployment', summary: 'Create or Replace Workflow Chat Deployment', description: `Create or replace hosted chat. Omitted fields reset to defaults except per-field \`customizations\`. \`password\` is write-only and required for password auth; \`allowedEmails\` is required and non-empty for email or SSO. This also deploys the draft. A duplicate identifier or pending deployment returns \`409\`; public auth exposes the URL. ${CHAT_VS_WORKFLOW_DEPLOYMENT} Workspace keys are rejected; use personal keys or OAuth.`, @@ -1065,6 +1094,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteWorkflowChatDeploymentContract, workflowOperation({ + applicationOperation: chatDeploymentOperations.delete, operationId: 'deleteWorkflowChatDeployment', summary: 'Delete Workflow Chat Deployment', description: `Stop serving a workflow's hosted chat. Its URL stops answering and the identifier becomes free again. The workflow's own deployment is untouched and stays executable through the workflow API — to undeploy that, use \`DELETE /workflows/{workflowId}/deploy\`. ${WORKSPACE_API_KEY_DENIED}`, @@ -1086,9 +1116,10 @@ const declaredRoutes = [ defineOpenApiRoute( v2ExecuteWorkflowContract, workflowOperation({ + applicationOperation: workflowOperations.execute, operationId: 'executeWorkflowV2', summary: 'Execute Workflow', - description: `Execute the deployment, or use \`run.source: "manual"\` for draft state. Manual runs require a personal key or OAuth write access; workspace keys, anonymous callers, and async mode are rejected. Start at a runnable trigger, or resume from \`sourceRunId\` using the same-workflow snapshot. Public deployments allow anonymous sync or streaming; async requires credentials. Sync timeouts return \`200\` with failed status and \`TIMEOUT\`. ${EXECUTE_OPTION_CONSTRAINTS}`, + description: `Execute the deployment; \`run.source: "manual"\` uses draft state. Manual runs require a personal key or OAuth write access; workspace keys, anonymous callers, and async are rejected. Start at a runnable trigger, or resume from \`sourceRunId\` using the same-workflow snapshot. Public deployments allow anonymous sync or streaming; async requires credentials. Sync timeouts return \`200\` with failed status and \`TIMEOUT\`. ${EXECUTE_OPTION_CONSTRAINTS}`, errors: [ 'BadRequest', 'Unauthorized', @@ -1129,6 +1160,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListWorkflowRunsContract, workflowRunOperation({ + applicationOperation: workflowOperations.listRuns, operationId: 'listWorkflowRunsV2', summary: 'List Workflow Runs', description: `List recorded runs of a workflow with filtering and opaque cursor pagination. ${RUN_RETENTION}`, @@ -1166,6 +1198,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2GetWorkflowRunContract, workflowRunOperation({ + applicationOperation: workflowOperations.readRun, operationId: 'getWorkflowRunV2', summary: 'Get Workflow Run', description: `Get current run state with optional final and block outputs. With \`includeOutput\`, \`files\` includes download paths; \`includeFileBase64\` reads object storage to inline bytes and returns \`413\` with the download path when one file or the total exceeds 16 MiB. ${HEAD_MIRRORS_GET}`, @@ -1214,6 +1247,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DownloadRunFileContract, workflowRunOperation({ + applicationOperation: workflowOperations.downloadRunFile, operationId: 'downloadWorkflowRunFileV2', summary: 'Download Workflow Run File', description: `Download one run-produced file by id. Downloads record an audit event. ${RUN_RETENTION} ${HEAD_MIRRORS_GET} ${HEAD_OMITS_PAYLOAD_HEADERS}`, @@ -1232,6 +1266,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ResumeWorkflowContract, workflowRunOperation({ + applicationOperation: workflowOperations.resumeRun, operationId: 'resumeWorkflowRunV2', summary: 'Resume Workflow Run', description: @@ -1261,6 +1296,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CancelWorkflowRunContract, workflowRunOperation({ + applicationOperation: workflowOperations.cancelRun, operationId: 'cancelRunV2', summary: 'Cancel Workflow Run', description: @@ -1295,6 +1331,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2ListWorkflowFoldersContract, workflowOperation({ + applicationOperation: workflowOperations.listFolders, operationId: 'listWorkflowsFolders', summary: 'List Workflow Folders', description: `List canonical workflow folders in a workspace. ${FULL_SET_LIST} ${FOLDER_TREE_TOO_LARGE}`, @@ -1320,6 +1357,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2CreateWorkflowFolderContract, workflowOperation({ + applicationOperation: workflowOperations.createFolder, operationId: 'createWorkflowsFolder', summary: 'Create Workflow Folder', description: `Create a canonical workflow folder in a workspace. ${FOLDER_TREE_TOO_LARGE}`, @@ -1347,6 +1385,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2RelocateWorkflowFolderContract, workflowOperation({ + applicationOperation: workflowOperations.relocateFolder, operationId: 'relocateWorkflowsFolder', summary: 'Rename or Move Workflow Folder', description: `Rename or move a workflow folder and its descendants to a canonical path. ${FOLDER_TREE_TOO_LARGE}`, @@ -1380,6 +1419,7 @@ const declaredRoutes = [ defineOpenApiRoute( v2DeleteWorkflowFolderContract, workflowOperation({ + applicationOperation: workflowOperations.deleteFolder, operationId: 'deleteWorkflowsFolder', summary: 'Delete Workflow Folder', description: 'Delete a workflow folder, optionally including its descendants and workflows.', diff --git a/apps/sim/lib/api/contracts/workspaces.ts b/apps/sim/lib/api/contracts/workspaces.ts index ff4e201de94..2f7f6b67b10 100644 --- a/apps/sim/lib/api/contracts/workspaces.ts +++ b/apps/sim/lib/api/contracts/workspaces.ts @@ -254,7 +254,6 @@ export const deploymentFeaturesSchema = z.object({ dataRetention: z.boolean(), inbox: z.boolean(), /** Sim's OAuth provider is a deployment toggle rather than an enterprise entitlement. */ - oauthProvider: z.boolean(), sandboxes: z.boolean(), sessionPolicies: z.boolean(), sso: z.boolean(), diff --git a/apps/sim/lib/api/openapi/types.ts b/apps/sim/lib/api/openapi/types.ts index 59225b968ae..a0cbc704256 100644 --- a/apps/sim/lib/api/openapi/types.ts +++ b/apps/sim/lib/api/openapi/types.ts @@ -1,5 +1,6 @@ import type { z } from 'zod' import type { AnyApiRouteContract, ApiSchema, JsonResponseMode } from '@/lib/api/contracts/types' +import type { ApplicationOperation } from '@/lib/core/application/operation' export type OpenApiSecurityRequirement = Readonly> @@ -84,6 +85,8 @@ export type OpenApiOperationSuccess = } export interface OpenApiOperationMetadata { + /** Canonical policy shared with every adapter for this application operation. */ + applicationOperation: Pick operationId: string summary: string description: string diff --git a/apps/sim/lib/api/server/routes/v2-json-route.test.ts b/apps/sim/lib/api/server/routes/v2-json-route.test.ts index 0f797c5082d..0993e5c8e9b 100644 --- a/apps/sim/lib/api/server/routes/v2-json-route.test.ts +++ b/apps/sim/lib/api/server/routes/v2-json-route.test.ts @@ -40,7 +40,7 @@ import { v2RateLimits, } from '@/lib/api/server/routes/v2-json-route' -const operation = { id: 'widgets.update' } as const +const operation = { id: 'widgets.update', capability: 'none', oauthScope: 'api:write' } as const const principal: PersonalApiKeyPrincipal = { kind: 'personal_api_key', userId: 'user-1', @@ -893,12 +893,7 @@ describe('defineV2JsonRoute OAuth scope admission', () => { v2RouteMocks.operationRate.mockResolvedValue(allowedRate) }) - /** - * The whole point of a read-only grant. The scope is derived from the HTTP - * method rather than the operation's `minimumRole`, because several POST - * routes only read; a role-derived rule let a read-only token write. - */ - it('refuses a read-only token on an unsafe method before the use case runs', async () => { + it('refuses a read-only token on a semantic write before the use case runs', async () => { v2RouteMocks.authenticate.mockResolvedValue(oauthAuth(['openid', 'api:read'])) const execute = vi.fn() @@ -922,22 +917,34 @@ describe('defineV2JsonRoute OAuth scope admission', () => { expect(response.status).toBe(201) }) - /** - * `readOnly` is how a POST that only reads — a search or a query whose filter - * is too large for a query string — declares itself, so a read-only token can - * still use it. - */ - it('admits a read-only token on a POST the route declares read-only', async () => { + it('returns a bearer challenge when the token expires after authentication', async () => { + const expiredAuth = oauthAuth(['api:write']) + expiredAuth.principal = { + ...expiredAuth.principal, + expiresAt: new Date(0), + } as V2ApiKeyAuthContext['principal'] + v2RouteMocks.authenticate.mockResolvedValue(expiredAuth) + const execute = vi.fn() + + const response = await createHandler({ execute })(bearerRequest(), { params: undefined }) + + expect(response.status).toBe(401) + expect(response.headers.get('www-authenticate')).toContain('Bearer') + expect(execute).not.toHaveBeenCalled() + expect(v2RouteMocks.operationRate).not.toHaveBeenCalled() + }) + + it('admits a read-only token on a semantic read using POST', async () => { v2RouteMocks.authenticate.mockResolvedValue(oauthAuth(['openid', 'api:read'])) + const readOperation = { ...operation, oauthScope: 'api:read' } as const const handler = defineV2JsonRoute({ contract, auth: v2ApiKeyAuth, - operation, - readOnly: true, + operation: readOperation, rateLimit: v2RateLimits.publicApi, errorPolicy: v2OrchestrationErrorPolicy, mapInput: ({ body }) => body, - useCase: { operation, execute: async ({ input }) => input }, + useCase: { operation: readOperation, execute: async ({ input }) => input }, present: (result) => ({ data: result }), }) @@ -986,15 +993,14 @@ describe('defineV2JsonRoute OAuth scope admission', () => { expect(admission.response.headers.get('www-authenticate')).toContain('api:write') }) - it('allows an explicitly read-only raw POST with api:read', async () => { + it('allows a semantic read through raw POST admission', async () => { v2RouteMocks.authenticate.mockResolvedValue(oauthAuth(['openid', 'api:read'])) const admission = await admitV2Request( bearerRequest(), - operation, + { ...operation, oauthScope: 'api:read' }, v2ApiKeyAuth, - v2RateLimits.publicApi, - { readOnly: true } + v2RateLimits.publicApi ) expect(admission.success).toBe(true) @@ -1006,13 +1012,7 @@ describe('defineV2JsonRoute OAuth scope admission', () => { headers: { authorization: 'Bearer sim_oat_x' }, }) - const admission = await admitV2Request( - request, - operation, - v2ApiKeyAuth, - v2RateLimits.publicApi, - { write: true } - ) + const admission = await admitV2Request(request, operation, v2ApiKeyAuth, v2RateLimits.publicApi) expect(admission.success).toBe(false) if (admission.success) throw new Error('Expected admission to fail') diff --git a/apps/sim/lib/api/server/routes/v2-json-route.ts b/apps/sim/lib/api/server/routes/v2-json-route.ts index 729a5d26b4d..374226b84dd 100644 --- a/apps/sim/lib/api/server/routes/v2-json-route.ts +++ b/apps/sim/lib/api/server/routes/v2-json-route.ts @@ -26,15 +26,12 @@ import { type ParseRequestOptions, parseRequest, } from '@/lib/api/server/validation' -import { - OAUTH_API_READ_SCOPE, - OAUTH_API_WRITE_SCOPE, - oauthScopeSatisfies, -} from '@/lib/auth/oauth-provider' import { type ApplicationOperation, InsufficientScopeError, + OAuthAccessTokenExpiredError, type OperationUseCase, + requireOAuthOperationScope, } from '@/lib/core/application' import { getRateLimit, RateLimiter, type SubscriptionPlan } from '@/lib/core/rate-limiter' import { getClientIp } from '@/lib/core/utils/request' @@ -44,7 +41,6 @@ import { v2Error, v2HeadNoEffect, v2HttpError, - v2InsufficientScope, v2RateLimitError, v2ValidationError, } from '@/app/api/v2/lib/response' @@ -250,34 +246,6 @@ export function requireHeadAuthorizableUseCase( ) } -/** - * The safe methods (RFC 9110 §9.2.1) this runtime serves — TRACE is the fourth - * and Next routes none. Every other method is treated as state-changing, which - * is the whole point: a request that may write is one by construction, - * whatever the handler beneath it turns out to do. - */ -const SAFE_HTTP_METHODS = new Set(['GET', 'HEAD', 'OPTIONS']) - -/** - * Refuses a `readOnly` declaration on a route whose method is already safe. - * - * `readOnly` exists only to say "this unsafe method does not write", so on a - * GET it changes nothing and its presence means the author read it as - * something else. Failing at definition time keeps the flag meaning one thing. - * Nothing here can tell whether an unsafe route that claims it is telling the - * truth — that stays a review question. - */ -export function requireUnsafeMethodForReadOnly( - contract: { method: string; path: string }, - readOnly: boolean | undefined -): void { - if (!readOnly) return - if (!SAFE_HTTP_METHODS.has(contract.method.toUpperCase())) return - throw new Error( - `V2 route ${contract.method} ${contract.path} declares readOnly, which only applies to a method that is not already safe. Remove it.` - ) -} - /** * The bodiless answer a `HEAD` gets on a route whose `GET` is not safe. * @@ -347,59 +315,11 @@ async function enforceV2PreAuthIpLimit(request: NextRequest): Promise { @@ -418,8 +338,15 @@ async function admitAuthenticatedV2Request( throw new V2RouteInfrastructureError('authentication', error) } - const outOfScope = refuseOutOfScopeRequest(request, auth, scopePolicy) - if (outOfScope) return { success: false, response: outOfScope } + try { + requireOAuthOperationScope(auth.principal, operation) + } catch (error) { + if (error instanceof InsufficientScopeError || error instanceof OAuthAccessTokenExpiredError) { + const response = v2CaughtOrchestrationError(error) + if (response) return { success: false, response } + } + throw error + } const limited = await rateLimitPolicy.enforce(request, auth, operation) return limited ? { success: false, response: limited } : { success: true, auth } @@ -429,14 +356,13 @@ async function admitRateLimitedV2Request( request: NextRequest, operation: ApplicationOperation, authPolicy: typeof v2ApiKeyAuth, - rateLimitPolicy: V2RateLimitPolicy, - scopePolicy?: V2ScopePolicy + rateLimitPolicy: V2RateLimitPolicy ): Promise< { success: true; auth: V2ApiKeyAuthContext } | { success: false; response: NextResponse } > { const preAuthResponse = await enforceV2PreAuthIpLimit(request) if (preAuthResponse) return { success: false, response: preAuthResponse } - return admitAuthenticatedV2Request(request, operation, authPolicy, rateLimitPolicy, scopePolicy) + return admitAuthenticatedV2Request(request, operation, authPolicy, rateLimitPolicy) } /** Admission for a v2 route the builders do not cover, such as the resume leg. */ @@ -444,27 +370,25 @@ export async function admitV2Request( request: NextRequest, operation: ApplicationOperation, authPolicy: typeof v2ApiKeyAuth, - rateLimitPolicy: V2RateLimitPolicy, - scopePolicy?: V2ScopePolicy + rateLimitPolicy: V2RateLimitPolicy ): Promise< { success: true; auth: V2ApiKeyAuthContext } | { success: false; response: NextResponse } > { - return admitRateLimitedV2Request(request, operation, authPolicy, rateLimitPolicy, scopePolicy) + return admitRateLimitedV2Request(request, operation, authPolicy, rateLimitPolicy) } export async function admitOptionalV2Request( request: NextRequest, operation: ApplicationOperation, authPolicy: typeof v2ApiKeyAuth, - rateLimitPolicy: V2RateLimitPolicy, - scopePolicy?: V2ScopePolicy + rateLimitPolicy: V2RateLimitPolicy ): Promise< { success: true; auth?: V2ApiKeyAuthContext } | { success: false; response: NextResponse } > { const preAuthResponse = await enforceV2PreAuthIpLimit(request) if (preAuthResponse) return { success: false, response: preAuthResponse } if (!hasV2Credential(request.headers)) return { success: true } - return admitAuthenticatedV2Request(request, operation, authPolicy, rateLimitPolicy, scopePolicy) + return admitAuthenticatedV2Request(request, operation, authPolicy, rateLimitPolicy) } /** @@ -483,8 +407,7 @@ export interface V2CredentialFacts { } interface V2JsonRouteOptions - extends Omit, 'mapInput'>, - V2ScopePolicy { + extends Omit, 'mapInput'> { mapInput(input: ParsedRequest, credential: V2CredentialFacts): I auth: typeof v2ApiKeyAuth rateLimit: V2RateLimitPolicy @@ -532,13 +455,6 @@ export function defineV2JsonRoute< options.useCase.operation ) requireHeadAuthorizableUseCase(options.contract, options.headSafe, options.useCase) - requireUnsafeMethodForReadOnly(options.contract, options.readOnly) - if (options.readOnly && options.write) { - throw new Error( - `V2 route ${options.contract.method} ${options.contract.path} cannot declare both readOnly and write.` - ) - } - const wrapped = withRouteHandler( async (request, context) => { if (!methodMatchesContract(request.method, options.contract.method)) { @@ -551,8 +467,7 @@ export function defineV2JsonRoute< request, options.operation, options.auth, - options.rateLimit, - { readOnly: options.readOnly, write: options.write } + options.rateLimit ) if (!admission.success) return admission.response const { auth } = admission diff --git a/apps/sim/lib/audit-logs/application/audit-log-use-cases.test.ts b/apps/sim/lib/audit-logs/application/audit-log-use-cases.test.ts index 5d43358e648..ed34984beb2 100644 --- a/apps/sim/lib/audit-logs/application/audit-log-use-cases.test.ts +++ b/apps/sim/lib/audit-logs/application/audit-log-use-cases.test.ts @@ -82,6 +82,24 @@ describe('audit-log application use cases', () => { expect(mocks.queryAuditLogs).not.toHaveBeenCalled() }) + it('rejects an OAuth grant without API access before organization membership is loaded', async () => { + const principal = { + kind: 'oauth_access_token', + userId: 'admin-1', + clientId: 'client-1', + tokenId: 'token-1', + scopes: ['offline_access'], + expiresAt: new Date('2099-01-01T00:00:00.000Z'), + } as const + + await expect(listAuditLogs.execute({ principal, input: listInput })).rejects.toMatchObject({ + requiredScope: 'api:read', + }) + expect(mocks.resolveAccess).not.toHaveBeenCalled() + expect(mocks.resolveDefaultOrganization).not.toHaveBeenCalled() + expect(mocks.queryAuditLogs).not.toHaveBeenCalled() + }) + it('authorizes the requested organization and scopes the query canonically', async () => { await expect( listAuditLogs.execute({ principal: sessionPrincipal, input: listInput }) diff --git a/apps/sim/lib/audit-logs/application/authorized-audit-log-use-case.ts b/apps/sim/lib/audit-logs/application/authorized-audit-log-use-case.ts index ff4acb07438..a823c622ff1 100644 --- a/apps/sim/lib/audit-logs/application/authorized-audit-log-use-case.ts +++ b/apps/sim/lib/audit-logs/application/authorized-audit-log-use-case.ts @@ -10,6 +10,7 @@ import { type OperationUseCase, PersonalApiKeysDisabledError, } from '@/lib/core/application' +import { requireOAuthOperationScope } from '@/lib/core/application/oauth-authorization' import { refuseCapability } from '@/lib/permission-groups/capabilities' import { isCapabilityWithheldForUser } from '@/lib/permission-groups/user-scope.server' @@ -78,6 +79,7 @@ export function defineAuthorizedAuditLogUseCase extends Applicati readonly authority: 'organization_admin' readonly organizationRoles: readonly ['admin', 'owner'] readonly workspaceApiKey: 'deny' + readonly oauthScope: 'api:read' readonly principalKinds: readonly ['session', 'personal_api_key', 'oauth_access_token'] } @@ -21,6 +25,7 @@ function defineAuditLogOperation( throw new Error(`Organization-admin operation ${operation.id} cannot allow workspace API keys`) } assertOperationCapability(operation) + assertOperationOAuthPolicy(operation) Object.freeze(operation.organizationRoles) Object.freeze(operation.principalKinds) return Object.freeze(operation) @@ -30,6 +35,7 @@ export const auditLogOperations = { // permission-group-exempt: the organization audit trail is authorized by organization admin or owner role, a scope no workspace-shaped permission group can name list: defineAuditLogOperation({ id: 'audit_logs.list', + oauthScope: 'api:read', capability: 'none', authority: 'organization_admin', organizationRoles: ['admin', 'owner'], @@ -39,6 +45,7 @@ export const auditLogOperations = { // permission-group-exempt: same organization-admin authority as the list it expands; no group key names the audit trail readDetail: defineAuditLogOperation({ id: 'audit_logs.read_detail', + oauthScope: 'api:read', capability: 'none', authority: 'organization_admin', organizationRoles: ['admin', 'owner'], diff --git a/apps/sim/lib/auth/oauth-provider-lifecycle.postgres.test.ts b/apps/sim/lib/auth/oauth-provider-lifecycle.postgres.test.ts new file mode 100644 index 00000000000..a46e507f2a2 --- /dev/null +++ b/apps/sim/lib/auth/oauth-provider-lifecycle.postgres.test.ts @@ -0,0 +1,412 @@ +/** + * @vitest-environment node + */ +import { auditMock, auditMockFns } from '@sim/testing/mocks/audit.mock' +import { generateId } from '@sim/utils/id' +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest' + +vi.unmock('@sim/db') +vi.unmock('@sim/db/schema') +vi.unmock('drizzle-orm') +vi.mock('@sim/audit', () => auditMock) + +const databaseUrl = process.env.OAUTH_TOKEN_FAMILY_TEST_DATABASE_URL + +async function loadRuntime() { + const [ + { db }, + schema, + { eq, inArray }, + { oauthProvider }, + { createSimAuthAdapter }, + { withOAuthProviderIssuanceCompensation }, + { rotateOAuthRefreshToken }, + { listAuthorizedAppsUseCase, revokeAuthorizedAppUseCase }, + { reconcileOAuthProviderLifecycle }, + { default: postgres }, + { hashOAuthToken }, + ] = await Promise.all([ + import('@sim/db'), + import('@sim/db/schema'), + import('drizzle-orm'), + import('@better-auth/oauth-provider'), + import('@/lib/auth/sim-auth-adapter'), + import('@/lib/auth/oauth-provider-adapter-guard'), + import('@/lib/auth/oauth-token-family'), + import('@/lib/users/application/authorized-apps'), + import('@sim/db/oauth-provider-lifecycle'), + import('postgres'), + import('@/lib/auth/oauth-access-token'), + ]) + const adapter = createSimAuthAdapter({ + plugins: [ + oauthProvider({ + loginPage: '/oauth/sign-in', + consentPage: '/oauth/consent', + disableJwtPlugin: true, + scopes: ['offline_access', 'api:read', 'api:write'], + }), + ], + }) + const sql = postgres(databaseUrl!, { max: 1 }) + return { + db, + schema, + eq, + inArray, + adapter, + sql, + reconcileOAuthProviderLifecycle, + withOAuthProviderIssuanceCompensation, + rotateOAuthRefreshToken, + revokeAuthorizedAppUseCase, + listAuthorizedAppsUseCase, + hashOAuthToken, + } +} + +describe.skipIf(!databaseUrl)('OAuth lifecycle on the provisioned PostgreSQL schema', () => { + let runtime: Awaited> + let userId: string + let clientId: string + let createdClientIds: string[] + let createdUserIds: string[] + const scopes = ['offline_access', 'api:read', 'api:write'] + + beforeAll(async () => { + process.env.DATABASE_URL = databaseUrl + runtime = await loadRuntime() + }, 30_000) + + beforeEach(async () => { + vi.clearAllMocks() + userId = generateId() + clientId = generateId() + createdClientIds = [clientId] + createdUserIds = [userId] + const now = new Date() + await runtime.db.insert(runtime.schema.user).values({ + id: userId, + name: 'OAuth lifecycle test', + email: `${userId}@example.com`, + emailVerified: true, + createdAt: now, + updatedAt: now, + }) + await runtime.db.insert(runtime.schema.oauthClient).values({ + id: clientId, + clientId, + name: 'OAuth lifecycle client', + public: true, + tokenEndpointAuthMethod: 'none', + grantTypes: ['authorization_code', 'refresh_token'], + redirectUris: ['http://127.0.0.1/callback'], + scopes, + }) + }) + + afterEach(async () => { + const { db, schema, inArray } = runtime + await db + .delete(schema.oauthClient) + .where(inArray(schema.oauthClient.clientId, createdClientIds)) + await db.delete(schema.user).where(inArray(schema.user.id, createdUserIds)) + }) + + afterAll(async () => { + await runtime?.sql.end() + }) + + const consentData = (grantedScopes = scopes) => ({ + clientId, + userId, + referenceId: null, + scopes: grantedScopes, + createdAt: new Date(), + updatedAt: new Date(), + }) + + async function grantConsent(grantedScopes = scopes) { + return runtime.adapter.create<{ id: string }>({ + model: 'oauthConsent', + data: consentData(grantedScopes), + }) + } + + async function issueFamily() { + const token = generateId() + const { id } = await runtime.adapter.create<{ id: string }>({ + model: 'oauthRefreshToken', + data: { + token: runtime.hashOAuthToken(token), + clientId, + userId, + scopes, + createdAt: new Date(), + expiresAt: new Date(Date.now() + 86_400_000), + }, + }) + await runtime.db.insert(runtime.schema.oauthAccessToken).values({ + id: generateId(), + token: generateId(), + clientId, + userId, + refreshId: id, + scopes, + createdAt: new Date(), + expiresAt: new Date(Date.now() + 3_600_000), + }) + return { id, refreshToken: `sim_ort_${token}` } + } + + async function expectNoTokens() { + const { db, schema, eq } = runtime + expect( + await db + .select() + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.clientId, clientId)) + ).toHaveLength(0) + expect( + await db + .select() + .from(schema.oauthRefreshToken) + .where(eq(schema.oauthRefreshToken.clientId, clientId)) + ).toHaveLength(0) + expect( + await db + .select() + .from(schema.oauthAccessToken) + .where(eq(schema.oauthAccessToken.clientId, clientId)) + ).toHaveLength(0) + } + + it('atomically converges concurrent consent submissions on one grant', async () => { + const grants = await Promise.all([grantConsent(), grantConsent()]) + expect(grants[0].id).toBe(grants[1].id) + const { db, schema, eq } = runtime + expect( + await db.select().from(schema.oauthConsent).where(eq(schema.oauthConsent.clientId, clientId)) + ).toHaveLength(1) + }) + + it('pages tied microsecond timestamps completely and searches beyond page one without leaking other users', async () => { + const { db, schema, sql } = runtime + const clientIds = Array.from({ length: 53 }, () => generateId()).sort() + const foreignClientId = generateId() + const foreignUserId = generateId() + createdClientIds.push(...clientIds, foreignClientId) + createdUserIds.push(foreignUserId) + const now = new Date() + await db.insert(schema.user).values({ + id: foreignUserId, + name: 'Another account', + email: `${foreignUserId}@example.com`, + emailVerified: true, + createdAt: now, + updatedAt: now, + }) + const literalName = 'Literal 100%_\\ Archive' + await db.insert(schema.oauthClient).values( + [...clientIds, foreignClientId].map((id, index) => ({ + id, + clientId: id, + name: index === 0 || id === foreignClientId ? literalName : `Paged app ${index}`, + redirectUris: ['http://127.0.0.1/callback'], + })) + ) + await db.insert(schema.oauthConsent).values( + [...clientIds, foreignClientId].map((id) => ({ + id: generateId(), + clientId: id, + userId: id === foreignClientId ? foreignUserId : userId, + scopes: ['api:read'], + createdAt: now, + updatedAt: now, + })) + ) + for (const [index, id] of clientIds.entries()) { + await sql` + UPDATE oauth_consent + SET created_at = timestamp '2026-01-01 00:00:00' + ${index % 5} * interval '1 microsecond' + WHERE client_id = ${id} + ` + } + + const principal = { kind: 'session' as const, userId, sessionId: generateId() } + const firstPage = await runtime.listAuthorizedAppsUseCase.execute({ principal, input: {} }) + expect(firstPage.apps).toHaveLength(25) + expect(firstPage.nextCursor).not.toBeNull() + expect(firstPage.apps.some((app) => app.clientId === clientIds[0])).toBe(false) + const seen = firstPage.apps.map((app) => app.clientId) + let cursor = firstPage.nextCursor + for (let page = 0; cursor && page < 5; page += 1) { + const result = await runtime.listAuthorizedAppsUseCase.execute({ + principal, + input: { cursor }, + }) + expect(result.apps.length).toBeLessThanOrEqual(25) + seen.push(...result.apps.map((app) => app.clientId)) + cursor = result.nextCursor + } + expect(cursor).toBeNull() + expect(new Set(seen).size).toBe(53) + expect(seen.sort()).toEqual(clientIds) + + for (const search of ['Archive', '%_\\', clientIds[0]]) { + const result = await runtime.listAuthorizedAppsUseCase.execute({ + principal, + input: { search }, + }) + expect(result.apps.map((app) => app.clientId)).toEqual([clientIds[0]]) + expect(result.nextCursor).toBeNull() + } + }) + + it('rolls transactional consent changes and their token cascades back together', async () => { + const consent = await grantConsent() + const family = await issueFamily() + await expect( + runtime.adapter.transaction(async (tx) => { + await tx.create({ model: 'oauthConsent', data: consentData(['api:read']) }) + throw new Error('Abort the surrounding provider transaction') + }) + ).rejects.toThrow('Abort the surrounding provider transaction') + + const { db, schema, eq } = runtime + const [grant] = await db + .select() + .from(schema.oauthConsent) + .where(eq(schema.oauthConsent.id, consent.id)) + expect(grant.scopes).toEqual(scopes) + expect( + await db + .select() + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, family.id)) + ).toHaveLength(1) + }) + + it('refuses issuance without consent and never leaves a provisional family behind', async () => { + await expect(issueFamily()).rejects.toThrow() + await expectNoTokens() + await grantConsent(['api:read']) + await expect(issueFamily()).rejects.toThrow() + await expectNoTokens() + }) + + it('serializes consent narrowing against refresh so no broader descendants survive', async () => { + const grant = await grantConsent() + const family = await issueFamily() + const { db, schema, eq } = runtime + await Promise.all([ + runtime.rotateOAuthRefreshToken({ + credentials: { clientId, method: 'none' }, + refreshToken: family.refreshToken, + }), + db + .update(schema.oauthConsent) + .set({ scopes: ['api:read'] }) + .where(eq(schema.oauthConsent.id, grant.id)), + ]) + await expectNoTokens() + }) + + it('revokes actual authorized-app grants and every independent login during refresh', async () => { + await grantConsent() + const first = await issueFamily() + await issueFamily() + const results = await Promise.all([ + runtime.rotateOAuthRefreshToken({ + credentials: { clientId, method: 'none' }, + refreshToken: first.refreshToken, + }), + runtime.revokeAuthorizedAppUseCase.execute({ + principal: { kind: 'session', userId, sessionId: generateId() }, + input: { clientId }, + }), + ]) + expect(results[1]).toMatchObject({ clientId }) + await expectNoTokens() + const { db, schema, eq } = runtime + expect( + await db.select().from(schema.oauthConsent).where(eq(schema.oauthConsent.clientId, clientId)) + ).toHaveLength(0) + expect(auditMockFns.mockRecordAudit).toHaveBeenCalledWith( + expect.objectContaining({ actorId: userId, resourceId: clientId }) + ) + }) + + it('compensates failed nontransactional issuance without revoking an independent login', async () => { + await grantConsent() + const independent = await issueFamily() + const response = await runtime.withOAuthProviderIssuanceCompensation(async () => { + await issueFamily() + return new Response(null, { status: 500 }) + }) + expect(response.status).toBe(500) + await expect( + runtime.withOAuthProviderIssuanceCompensation(async () => { + await issueFamily() + throw new Error('Provider response failed') + }) + ).rejects.toThrow('Provider response failed') + const { db, schema, eq } = runtime + const families = await db + .select() + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.clientId, clientId)) + expect(families.map((family) => family.id)).toEqual([independent.id]) + const tokens = await db + .select() + .from(schema.oauthAccessToken) + .where(eq(schema.oauthAccessToken.clientId, clientId)) + expect(tokens).toHaveLength(1) + }) + + it('reconciles repeatedly without changing the existing CLI registration or grants', async () => { + await grantConsent() + const family = await issueFamily() + const { db, schema, eq } = runtime + const [original] = await db + .select() + .from(schema.oauthClient) + .where(eq(schema.oauthClient.clientId, 'sim-cli')) + expect(original).toBeDefined() + const customization = { + name: 'Locally customized Sim CLI', + metadata: { operatorLabel: generateId() }, + updatedAt: new Date('2025-01-02T03:04:05.000Z'), + } + try { + await db + .update(schema.oauthClient) + .set(customization) + .where(eq(schema.oauthClient.clientId, 'sim-cli')) + await runtime.reconcileOAuthProviderLifecycle(runtime.sql) + await runtime.reconcileOAuthProviderLifecycle(runtime.sql) + const [after] = await db + .select() + .from(schema.oauthClient) + .where(eq(schema.oauthClient.clientId, 'sim-cli')) + expect(after).toEqual({ ...original, ...customization }) + expect( + await db + .select() + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.id, family.id)) + ).toHaveLength(1) + await expect( + runtime.rotateOAuthRefreshToken({ + credentials: { clientId, method: 'none' }, + refreshToken: family.refreshToken, + }) + ).resolves.toMatchObject({ success: true }) + } finally { + await db + .update(schema.oauthClient) + .set({ name: original.name, metadata: original.metadata, updatedAt: original.updatedAt }) + .where(eq(schema.oauthClient.clientId, 'sim-cli')) + } + }) +}) diff --git a/apps/sim/lib/auth/oauth-provider.ts b/apps/sim/lib/auth/oauth-provider.ts index 53b7bc4a146..de2a6a1a3e7 100644 --- a/apps/sim/lib/auth/oauth-provider.ts +++ b/apps/sim/lib/auth/oauth-provider.ts @@ -4,7 +4,7 @@ * "Authorized apps" settings surface. */ -/** The first-party Sim CLI, seeded by migration `0323_oauth_provider` as a public client. */ +/** The first-party Sim CLI, registered by the shared OAuth database lifecycle as a public client. */ export const SIM_CLI_CLIENT_ID = 'sim-cli' /** diff --git a/apps/sim/lib/auth/sim-auth-adapter.test.ts b/apps/sim/lib/auth/sim-auth-adapter.test.ts new file mode 100644 index 00000000000..a0c885ec304 --- /dev/null +++ b/apps/sim/lib/auth/sim-auth-adapter.test.ts @@ -0,0 +1,76 @@ +/** + * @vitest-environment node + */ +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + create: vi.fn(), + insert: vi.fn(), + transaction: vi.fn(), + rootInsert: vi.fn(), +})) + +vi.mock('@sim/db', () => ({ + db: { + insert: mocks.rootInsert, + transaction: mocks.transaction, + select: () => ({ from: () => ({ where: () => ({ limit: async () => [{ id: 'org-1' }] }) }) }), + }, +})) + +vi.mock('better-auth/adapters/drizzle', () => ({ + drizzleAdapter: (database: object) => () => ({ + create: mocks.create, + transaction: vi.fn(), + database, + }), +})) + +import { createSimAuthAdapter } from '@/lib/auth/sim-auth-adapter' + +describe('createSimAuthAdapter', () => { + beforeEach(() => { + vi.clearAllMocks() + const tx = { insert: mocks.insert } + mocks.transaction.mockImplementation(async (callback) => callback(tx)) + mocks.insert.mockReturnValue({ + values: (values: object) => ({ + onConflictDoUpdate: () => ({ returning: async () => [{ ...values, id: 'persisted' }] }), + }), + }) + mocks.create.mockResolvedValue({ id: 'base-record' }) + }) + + it('retains both OAuth and subscription guards inside a transaction callback', async () => { + const adapter = createSimAuthAdapter({}) + const now = new Date() + + await adapter.transaction(async (tx) => { + await expect( + tx.create({ + model: 'oauthConsent', + data: { + clientId: 'client-1', + userId: 'user-1', + referenceId: null, + scopes: ['api:read'], + createdAt: now, + updatedAt: now, + }, + }) + ).resolves.toMatchObject({ id: 'persisted' }) + + await expect( + tx.create({ model: 'subscription', data: { referenceId: 'org-1', plan: 'pro' } }) + ).rejects.toThrow('Organization-referenced subscriptions must hold a Team or Enterprise plan') + + await expect(tx.create({ model: 'user', data: { name: 'Ada' } })).resolves.toEqual({ + id: 'base-record', + }) + }) + + expect(mocks.insert).toHaveBeenCalledOnce() + expect(mocks.rootInsert).not.toHaveBeenCalled() + expect(mocks.create).toHaveBeenCalledExactlyOnceWith({ model: 'user', data: { name: 'Ada' } }) + }) +}) diff --git a/apps/sim/lib/billing/application/authorized-billing-read-use-case.ts b/apps/sim/lib/billing/application/authorized-billing-read-use-case.ts index 07c036fea12..40a00fd0ae2 100644 --- a/apps/sim/lib/billing/application/authorized-billing-read-use-case.ts +++ b/apps/sim/lib/billing/application/authorized-billing-read-use-case.ts @@ -9,6 +9,7 @@ import type { BillingReadPrincipal, } from '@/lib/billing/application/operations' import { type OperationUseCase, requireUserCredentialCapabilities } from '@/lib/core/application' +import { requireOAuthOperationScope } from '@/lib/core/application/oauth-authorization' import { InsufficientWorkspacePermissionsError, NoWorkspaceAccessError, @@ -149,6 +150,7 @@ export function defineAuthorizedBillingReadUseCase { + it('rejects an OAuth grant without API access before loading billing or workspace state', async () => { + vi.clearAllMocks() + const principal = { + kind: 'oauth_access_token', + userId: 'user-1', + clientId: 'client-1', + tokenId: 'token-1', + scopes: ['offline_access'], + expiresAt: new Date('2099-01-01T00:00:00.000Z'), + } as const + + await expect( + getBillingStatus.execute({ principal, input: { workspaceId: 'workspace-1' } }) + ).rejects.toMatchObject({ requiredScope: 'api:read' }) + expect(mocks.loadWorkspace).not.toHaveBeenCalled() + expect(mocks.resolveAttribution).not.toHaveBeenCalled() + expect(mocks.resolveSystemAttribution).not.toHaveBeenCalled() + }) + beforeEach(() => { vi.clearAllMocks() resetPermissionGroupScopeMock() diff --git a/apps/sim/lib/billing/application/operations.ts b/apps/sim/lib/billing/application/operations.ts index 90fac2e5816..8bde1ac6a44 100644 --- a/apps/sim/lib/billing/application/operations.ts +++ b/apps/sim/lib/billing/application/operations.ts @@ -1,6 +1,9 @@ import type { Principal } from '@sim/auth/principal' -import type { ApplicationOperation } from '@/lib/core/application' -import { assertOperationCapability } from '@/lib/core/application' +import type { ApplicationOperation } from '@/lib/core/application/operation' +import { + assertOperationCapability, + assertOperationOAuthPolicy, +} from '@/lib/core/application/operation' export type BillingReadPrincipal = Extract< Principal, @@ -11,6 +14,7 @@ export interface BillingReadOperation extends Applic readonly accountScope: 'personal_self' readonly workspaceMinimumRole: 'read' readonly workspaceApiKey: 'workspace_only' + readonly oauthScope: 'api:read' readonly principalKinds: readonly ['personal_api_key', 'oauth_access_token', 'workspace_api_key'] } @@ -21,6 +25,7 @@ function defineBillingReadOperation( throw new Error(`Billing read operation ${operation.id} exceeds its workspace-key ceiling`) } assertOperationCapability(operation) + assertOperationOAuthPolicy(operation) Object.freeze(operation.principalKinds) return Object.freeze(operation) } @@ -29,6 +34,7 @@ export const billingOperations = { // permission-group-exempt: a personal account reading its own plan and balance; permission groups scope a workspace, not the billing account that owns it readStatus: defineBillingReadOperation({ id: 'billing.status.read', + oauthScope: 'api:read', capability: 'none', accountScope: 'personal_self', workspaceMinimumRole: 'read', @@ -38,6 +44,7 @@ export const billingOperations = { // permission-group-exempt: the same personal billing account reading its own usage records; no group key names it listLogs: defineBillingReadOperation({ id: 'billing.logs.list', + oauthScope: 'api:read', capability: 'none', accountScope: 'personal_self', workspaceMinimumRole: 'read', diff --git a/apps/sim/lib/catalog/application/operations.ts b/apps/sim/lib/catalog/application/operations.ts index 0be5610200d..8a3e3d06a4c 100644 --- a/apps/sim/lib/catalog/application/operations.ts +++ b/apps/sim/lib/catalog/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' /** * Semantic operations for reading Sim's code-defined catalogs. @@ -25,6 +25,7 @@ export const catalogOperations = { // permission-group-exempt: the block catalog is what the editor renders; emptying it hides the product rather than restricting it listBlocks: defineWorkspaceOperation({ id: 'catalog.blocks.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -33,6 +34,7 @@ export const catalogOperations = { // permission-group-exempt: one entry of the same catalog listBlocks returns, so it cannot be governed differently readBlock: defineWorkspaceOperation({ id: 'catalog.blocks.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -41,6 +43,7 @@ export const catalogOperations = { // permission-group-exempt: describes which tools exist; whether a member may call one is decided on that tool's own operation listTools: defineWorkspaceOperation({ id: 'catalog.tools.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -49,6 +52,7 @@ export const catalogOperations = { // permission-group-exempt: one entry of the same catalog listTools returns, so it cannot be governed differently readTool: defineWorkspaceOperation({ id: 'catalog.tools.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -61,6 +65,7 @@ export const catalogOperations = { */ listConnectorTypes: defineWorkspaceOperation({ id: 'catalog.connector_types.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'knowledge.use', diff --git a/apps/sim/lib/chat-deployments/application/operations.ts b/apps/sim/lib/chat-deployments/application/operations.ts index 1466e615006..0f2365c9344 100644 --- a/apps/sim/lib/chat-deployments/application/operations.ts +++ b/apps/sim/lib/chat-deployments/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' /** * Semantic operations on a chat deployment as a resource in its own right. @@ -50,6 +50,7 @@ const CHAT_DEPLOYMENT_ADMIN_POLICY = { export const chatDeploymentOperations = { list: defineWorkspaceOperation({ id: 'chat_deployments.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'deploy.chat', @@ -57,6 +58,7 @@ export const chatDeploymentOperations = { }), replace: defineWorkspaceOperation({ id: 'chat_deployments.replace', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.chat', @@ -64,6 +66,7 @@ export const chatDeploymentOperations = { }), read: defineWorkspaceOperation({ id: 'chat_deployments.read', + oauthScope: 'api:read', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.chat', @@ -71,6 +74,7 @@ export const chatDeploymentOperations = { }), update: defineWorkspaceOperation({ id: 'chat_deployments.update', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.chat', @@ -78,6 +82,7 @@ export const chatDeploymentOperations = { }), delete: defineWorkspaceOperation({ id: 'chat_deployments.delete', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.chat', diff --git a/apps/sim/lib/copilot/application/operations.ts b/apps/sim/lib/copilot/application/operations.ts index ea08bf03a7e..d152c1c54b9 100644 --- a/apps/sim/lib/copilot/application/operations.ts +++ b/apps/sim/lib/copilot/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' /** * Chat is a user-actor surface: the run is attributed to a person, reads their @@ -9,6 +9,7 @@ import { defineWorkspaceOperation } from '@/lib/core/application' export const chatOperations = { send: defineWorkspaceOperation({ id: 'chat.send', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'copilot.use', diff --git a/apps/sim/lib/core/application/index.ts b/apps/sim/lib/core/application/index.ts index 7572070dfc9..74b577ee6f0 100644 --- a/apps/sim/lib/core/application/index.ts +++ b/apps/sim/lib/core/application/index.ts @@ -14,11 +14,18 @@ export { ForbiddenOperationError, forbiddenErrorDetails, } from '@/lib/core/application/forbidden' +export { + InsufficientScopeError, + OAuthAccessTokenExpiredError, + requireOAuthOperationScope, +} from '@/lib/core/application/oauth-authorization' export { type ApplicationOperation, assertOperationCapability, + assertOperationOAuthPolicy, assertOperationPrincipal, defineOperation, + type OAuthOperationPolicy, type OperationDeclarableCapability, type OperationUseCase, type PrincipalKind, @@ -36,10 +43,8 @@ export { capabilityGovernedPrincipalUserId, DelegatedServiceAuthorizationError, DelegatedWorkspaceAuthorizationError, - InsufficientScopeError, InsufficientWorkspacePermissionsError, NoWorkspaceAccessError, - OAuthAccessTokenExpiredError, PersonalApiKeysDisabledError, PrincipalKindAuthorizationError, requireAllowedWorkspacePrincipal, diff --git a/apps/sim/lib/core/application/oauth-authorization.test.ts b/apps/sim/lib/core/application/oauth-authorization.test.ts new file mode 100644 index 00000000000..9eb4bd41455 --- /dev/null +++ b/apps/sim/lib/core/application/oauth-authorization.test.ts @@ -0,0 +1,109 @@ +/** + * @vitest-environment node + */ +import type { OAuthAccessTokenPrincipal } from '@sim/auth/principal' +import { describe, expect, it, vi } from 'vitest' +import { defineAuthorizedWorkspaceUseCase } from '@/lib/core/application/authorized-workspace-use-case' +import { + InsufficientScopeError, + OAuthAccessTokenExpiredError, + requireOAuthOperationScope, +} from '@/lib/core/application/oauth-authorization' +import { defineOperation } from '@/lib/core/application/operation' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' + +const principal: OAuthAccessTokenPrincipal = { + kind: 'oauth_access_token', + userId: 'user-1', + clientId: 'client-1', + tokenId: 'token-1', + scopes: ['api:read'], + expiresAt: new Date('2099-01-01T00:00:00.000Z'), +} + +const writeOperation = defineWorkspaceOperation({ + id: 'test.resource_acl_write', + capability: 'none', + minimumRole: 'read', + workspaceApiKey: 'deny', + principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], + oauthScope: 'api:write', +}) + +describe('semantic OAuth policy', () => { + it.each(['execute', 'authorize'] as const)( + 'rejects a read grant before canonical loading through %s', + async (method) => { + const resolveContext = vi.fn() + const execute = vi.fn() + const useCase = defineAuthorizedWorkspaceUseCase({ + operation: writeOperation, + resolveContext, + authorizationOptions: {}, + execute, + }) + + await expect(useCase[method]?.({ principal, input: {} })).rejects.toBeInstanceOf( + InsufficientScopeError + ) + expect(resolveContext).not.toHaveBeenCalled() + expect(execute).not.toHaveBeenCalled() + } + ) + + it('allows a write grant to satisfy a read while leaving session and API-key policy unchanged', () => { + const readOperation = { ...writeOperation, oauthScope: 'api:read' } as const + expect(() => + requireOAuthOperationScope({ ...principal, scopes: ['api:write'] }, readOperation) + ).not.toThrow() + expect(() => + requireOAuthOperationScope( + { kind: 'session', userId: 'user-1', sessionId: 's-1' }, + writeOperation + ) + ).not.toThrow() + expect(() => + requireOAuthOperationScope( + { kind: 'personal_api_key', userId: 'user-1', keyId: 'k-1' }, + writeOperation + ) + ).not.toThrow() + }) + + it('rejects expiry before considering scope', () => { + expect(() => + requireOAuthOperationScope({ ...principal, expiresAt: new Date(0) }, writeOperation) + ).toThrow(OAuthAccessTokenExpiredError) + }) + + it.each([undefined, 'offline_access'])( + 'rejects an invalid scope policy %s at definition time', + (oauthScope) => { + expect(() => + defineOperation({ + id: 'test.principal_policy', + capability: 'none', + principalKinds: ['oauth_access_token'], + oauthScope, + } as never) + ).toThrow('must declare its OAuth scope') + expect(() => defineWorkspaceOperation({ ...writeOperation, oauthScope } as never)).toThrow( + 'must declare its OAuth scope' + ) + } + ) + + it('refuses scope metadata on an operation that does not admit OAuth', () => { + expect(() => + defineOperation({ + id: 'test.session_policy', + capability: 'none', + principalKinds: ['session'], + oauthScope: 'api:read', + } as never) + ).toThrow('declares OAuth scope without admitting OAuth') + expect(() => + defineWorkspaceOperation({ ...writeOperation, principalKinds: ['session'] } as never) + ).toThrow('declares OAuth scope without admitting OAuth') + }) +}) diff --git a/apps/sim/lib/core/application/oauth-authorization.ts b/apps/sim/lib/core/application/oauth-authorization.ts new file mode 100644 index 00000000000..453246db111 --- /dev/null +++ b/apps/sim/lib/core/application/oauth-authorization.ts @@ -0,0 +1,34 @@ +import type { Principal } from '@sim/auth/principal' +import { type OAuthApiScope, oauthScopeSatisfies } from '@/lib/auth/oauth-provider' +import { ForbiddenOperationError } from '@/lib/core/application/forbidden' +import type { ApplicationOperation } from '@/lib/core/application/operation' +import { OrchestrationError } from '@/lib/core/orchestration/types' + +export class InsufficientScopeError extends ForbiddenOperationError { + constructor(readonly requiredScope: OAuthApiScope) { + super('INSUFFICIENT_SCOPE', `This operation requires the ${requiredScope} scope`) + this.name = 'InsufficientScopeError' + } +} + +export class OAuthAccessTokenExpiredError extends OrchestrationError { + constructor() { + super('unauthorized', 'OAuth access token has expired') + this.name = 'OAuthAccessTokenExpiredError' + } +} + +/** Enforces the client's grant independently of workspace membership and HTTP method. */ +export function requireOAuthOperationScope( + principal: Principal, + operation: ApplicationOperation +): void { + if (principal.kind !== 'oauth_access_token') return + if (principal.expiresAt.getTime() <= Date.now()) throw new OAuthAccessTokenExpiredError() + if (!operation.oauthScope) { + throw new Error(`Operation ${operation.id} has no OAuth scope policy`) + } + if (!oauthScopeSatisfies(principal.scopes, operation.oauthScope)) { + throw new InsufficientScopeError(operation.oauthScope) + } +} diff --git a/apps/sim/lib/core/application/operation.ts b/apps/sim/lib/core/application/operation.ts index dc712d55a50..90828c4262d 100644 --- a/apps/sim/lib/core/application/operation.ts +++ b/apps/sim/lib/core/application/operation.ts @@ -1,4 +1,6 @@ import type { Principal } from '@sim/auth/principal' +import type { OAuthApiScope } from '@/lib/auth/oauth-provider' +import { requireOAuthOperationScope } from '@/lib/core/application/oauth-authorization' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' import { CAPABILITY_RULES, @@ -37,6 +39,8 @@ const PRINCIPAL_WIDE_CAPABILITIES: readonly PrincipalWideCapability[] = ['person export interface ApplicationOperation { readonly id: Id + /** Required by definitions that admit OAuth; independent of the user's membership role. */ + readonly oauthScope?: OAuthApiScope /** * The capability a permission group must not have withheld, or `'none'` when * no group governs this operation. @@ -61,6 +65,25 @@ export interface ApplicationOperation { readonly capability: OperationDeclarableCapability | 'none' } +export type OAuthOperationPolicy = + 'oauth_access_token' extends Kinds[number] + ? { readonly oauthScope: OAuthApiScope } + : { readonly oauthScope?: never } + +/** Rejects missing scope policy at definition time, including dynamically composed policies. */ +export function assertOperationOAuthPolicy( + operation: ApplicationOperation & { readonly principalKinds: readonly string[] } +): void { + const acceptsOAuth = operation.principalKinds.includes('oauth_access_token') + if (acceptsOAuth) { + if (operation.oauthScope === 'api:read' || operation.oauthScope === 'api:write') return + throw new Error(`Operation ${operation.id} must declare its OAuth scope`) + } + if (operation.oauthScope !== undefined) { + throw new Error(`Operation ${operation.id} declares OAuth scope without admitting OAuth`) + } +} + /** * Every principal kind an operation can name. `credential_group_enrollment` * authenticates one enrollment flow, while `system` is an infrastructure-owned @@ -127,8 +150,8 @@ export function defineOperation< const Id extends string, const PrincipalKinds extends readonly UndelegatedPrincipalKind[], >( - operation: PrincipalScopedOperation -): PrincipalScopedOperation { + operation: PrincipalScopedOperation & OAuthOperationPolicy +): PrincipalScopedOperation & OAuthOperationPolicy { if (operation.principalKinds.length === 0) { throw new Error(`Operation ${operation.id} must allow at least one principal kind`) } @@ -136,6 +159,7 @@ export function defineOperation< throw new Error(`Operation ${operation.id} declares duplicate principal kinds`) } assertOperationCapability(operation) + assertOperationOAuthPolicy(operation) Object.freeze(operation.principalKinds) Object.freeze(operation) return operation @@ -161,6 +185,7 @@ export function assertOperationPrincipal( `Operation ${operation.id} reached by principal kind ${principal.kind}, which its policy does not name` ) } + requireOAuthOperationScope(principal, operation) } export interface OperationUseCase { diff --git a/apps/sim/lib/core/application/workspace-authorization.test.ts b/apps/sim/lib/core/application/workspace-authorization.test.ts index 741c90cfff0..75efb107a13 100644 --- a/apps/sim/lib/core/application/workspace-authorization.test.ts +++ b/apps/sim/lib/core/application/workspace-authorization.test.ts @@ -632,6 +632,7 @@ describe('capabilityGovernedPrincipalUserId', () => { describe('authorizeWorkspaceOperation OAuth access token policy', () => { const readOperation = defineWorkspaceOperation({ id: 'test.oauth-read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], @@ -639,6 +640,7 @@ describe('authorizeWorkspaceOperation OAuth access token policy', () => { }) const oauthWriteOperation = defineWorkspaceOperation({ id: 'test.oauth-write', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], @@ -690,20 +692,15 @@ describe('authorizeWorkspaceOperation OAuth access token policy', () => { expect(mocks.resolvePermission).not.toHaveBeenCalled() }) - /** - * The funnel enforces only the read floor. Which requests count as writes is - * decided from the HTTP method at v2 admission, because `minimumRole` does - * not answer it: several POST routes only read (search, query, count), so - * deriving the scope from the role let a read-only token perform them. - */ - it('leaves the write decision to the surface, admitting a read-only token on a write operation', async () => { + it('rejects a read-only token on a semantic write before reading membership', async () => { await expect( authorizeWorkspaceOperation( token({ scopes: ['offline_access', 'api:read'] }), oauthWriteOperation, context ) - ).resolves.toBeUndefined() + ).rejects.toMatchObject({ requiredScope: 'api:write' }) + expect(mocks.resolvePermission).not.toHaveBeenCalled() }) it('lets api:write satisfy a read operation', async () => { diff --git a/apps/sim/lib/core/application/workspace-authorization.ts b/apps/sim/lib/core/application/workspace-authorization.ts index 88b4f8416d1..e7cdeb09d63 100644 --- a/apps/sim/lib/core/application/workspace-authorization.ts +++ b/apps/sim/lib/core/application/workspace-authorization.ts @@ -11,13 +11,9 @@ import { permissionSatisfies, resolveEffectiveWorkspacePermission, } from '@sim/platform-authz/workspace' -import { - OAUTH_API_READ_SCOPE, - type OAuthApiScope, - oauthScopeSatisfies, - SIM_CLI_CLIENT_ID, -} from '@/lib/auth/oauth-provider' +import { SIM_CLI_CLIENT_ID } from '@/lib/auth/oauth-provider' import { ForbiddenOperationError } from '@/lib/core/application/forbidden' +import { requireOAuthOperationScope } from '@/lib/core/application/oauth-authorization' import type { PrincipalForOperation, WorkspaceOperation, @@ -133,25 +129,6 @@ export class DelegatedWorkspaceAuthorizationError extends OrchestrationError { } } -export class InsufficientScopeError extends ForbiddenOperationError { - constructor(readonly requiredScope: OAuthApiScope) { - super('INSUFFICIENT_SCOPE', `This operation requires the ${requiredScope} scope`) - this.name = 'InsufficientScopeError' - } -} - -/** - * Concealed as a `401` by the surface: an expired token is no credential at - * all, and the verifier already refuses it, so reaching this means the token - * lapsed between authentication and authorization. - */ -export class OAuthAccessTokenExpiredError extends OrchestrationError { - constructor() { - super('unauthorized', 'OAuth access token has expired') - this.name = 'OAuthAccessTokenExpiredError' - } -} - export class PrincipalKindAuthorizationError extends ForbiddenOperationError { constructor(principalKind: Principal['kind'], operationId: string) { super( @@ -195,6 +172,7 @@ export function requireAllowedWorkspacePrincipal( } throw new PrincipalKindAuthorizationError(principal.kind, operation.id) } + requireOAuthOperationScope(principal, operation) if (principal.kind !== 'delegated') return const delegatedServices = operation.delegatedServices @@ -405,40 +383,8 @@ export async function authorizeWorkspaceOperation( operation: WorkspaceOperation & + OAuthOperationPolicy & WorkspaceApiKeyPrincipalConsistency & DelegatedPrincipalConsistency & ResourcePolicyOperationConsistency ): WorkspaceOperation & + OAuthOperationPolicy & DelegatedPrincipalConsistency & ResourcePolicyOperationConsistency { if (operation.principalKinds.length === 0) { @@ -122,6 +131,7 @@ export function defineWorkspaceOperation< * tenants that bought the feature. Named here instead, at definition time. */ assertOperationCapability(operation) + assertOperationOAuthPolicy(operation) Object.freeze(operation.principalKinds) if (operation.delegatedServices) Object.freeze(operation.delegatedServices) diff --git a/apps/sim/lib/core/config/deployment-shape.test.ts b/apps/sim/lib/core/config/deployment-shape.test.ts index 6dc084ca065..a01adc99bd8 100644 --- a/apps/sim/lib/core/config/deployment-shape.test.ts +++ b/apps/sim/lib/core/config/deployment-shape.test.ts @@ -35,7 +35,6 @@ describe('resolveDeploymentShape', () => { dataDrains: false, dataRetention: false, inbox: true, - oauthProvider: true, sandboxes: true, sessionPolicies: true, sso: true, diff --git a/apps/sim/lib/core/config/deployment-shape.ts b/apps/sim/lib/core/config/deployment-shape.ts index 7ce34a9a897..a00429c6fce 100644 --- a/apps/sim/lib/core/config/deployment-shape.ts +++ b/apps/sim/lib/core/config/deployment-shape.ts @@ -13,7 +13,6 @@ import { isDataRetentionEnabled, isHosted, isInboxEnabled, - isOAuthProviderEnabled, isSandboxesEnabled, isSessionPoliciesEnabled, isSsoEnabled, @@ -94,7 +93,6 @@ export function resolveDeploymentShape(): DeploymentShape { dataDrains: isDataDrainsEnabled, dataRetention: isDataRetentionEnabled, inbox: isInboxEnabled, - oauthProvider: isOAuthProviderEnabled, sandboxes: isSandboxesEnabled, sessionPolicies: isSessionPoliciesEnabled, sso: isSsoEnabled, diff --git a/apps/sim/lib/credential-groups/application/operations.ts b/apps/sim/lib/credential-groups/application/operations.ts index 633a7689349..282762359ec 100644 --- a/apps/sim/lib/credential-groups/application/operations.ts +++ b/apps/sim/lib/credential-groups/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' /** * Credential groups collect OAuth credentials from people outside the workspace diff --git a/apps/sim/lib/credentials/application/operations.ts b/apps/sim/lib/credentials/application/operations.ts index bd7a8635bd4..f977dbf729b 100644 --- a/apps/sim/lib/credentials/application/operations.ts +++ b/apps/sim/lib/credentials/application/operations.ts @@ -1,5 +1,11 @@ -import type { ApplicationOperation, OperationDeclarableCapability } from '@/lib/core/application' -import { defineWorkspaceOperation, type WorkspaceOperation } from '@/lib/core/application' +import type { + ApplicationOperation, + OperationDeclarableCapability, +} from '@/lib/core/application/operation' +import { + defineWorkspaceOperation, + type WorkspaceOperation, +} from '@/lib/core/application/workspace-operation' import { CAPABILITY_RULES } from '@/lib/permission-groups/capabilities' import { CREDENTIAL_GROUP_CREDENTIAL_USE_ACTION } from '@/lib/resource-policies/registry' @@ -40,6 +46,7 @@ export const credentialOperations = { }), listProviders: defineWorkspaceOperation({ id: 'credentials.providers.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'integrations.manage', @@ -47,6 +54,7 @@ export const credentialOperations = { }), listConnections: defineWorkspaceOperation({ id: 'credentials.connections.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'integrations.manage', @@ -65,6 +73,7 @@ export const credentialOperations = { */ createConnection: defineWorkspaceOperation({ id: 'credentials.connections.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'integrations.manage', @@ -80,6 +89,7 @@ export const credentialOperations = { }), createServiceAccount: defineWorkspaceOperation({ id: 'credentials.service_accounts.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'integrations.manage', @@ -105,6 +115,7 @@ export const credentialOperations = { update: defineCredentialOperation( defineWorkspaceOperation({ id: 'credentials.update', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'integrations.manage', @@ -115,6 +126,7 @@ export const credentialOperations = { delete: defineCredentialOperation( defineWorkspaceOperation({ id: 'credentials.delete', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'integrations.manage', diff --git a/apps/sim/lib/custom-tools/application/operations.ts b/apps/sim/lib/custom-tools/application/operations.ts index 12a49c37fd2..374fde84a86 100644 --- a/apps/sim/lib/custom-tools/application/operations.ts +++ b/apps/sim/lib/custom-tools/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const ALL_PRINCIPAL_POLICY = { principalKinds: [ @@ -24,6 +24,7 @@ const HUMAN_PRINCIPAL_POLICY = { export const customToolOperations = { list: defineWorkspaceOperation({ id: 'custom_tools.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'custom_tools.use', @@ -31,6 +32,7 @@ export const customToolOperations = { }), listAvailable: defineWorkspaceOperation({ id: 'custom_tools.list_available', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'custom_tools.use', @@ -38,6 +40,7 @@ export const customToolOperations = { }), read: defineWorkspaceOperation({ id: 'custom_tools.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'custom_tools.use', @@ -53,6 +56,7 @@ export const customToolOperations = { }), create: defineWorkspaceOperation({ id: 'custom_tools.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'custom_tools.use', @@ -60,6 +64,7 @@ export const customToolOperations = { }), save: defineWorkspaceOperation({ id: 'custom_tools.save', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'custom_tools.use', @@ -67,6 +72,7 @@ export const customToolOperations = { }), update: defineWorkspaceOperation({ id: 'custom_tools.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'custom_tools.use', @@ -74,6 +80,7 @@ export const customToolOperations = { }), updateAvailable: defineWorkspaceOperation({ id: 'custom_tools.update_available', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'custom_tools.use', @@ -81,6 +88,7 @@ export const customToolOperations = { }), delete: defineWorkspaceOperation({ id: 'custom_tools.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'custom_tools.use', @@ -88,6 +96,7 @@ export const customToolOperations = { }), deleteAvailable: defineWorkspaceOperation({ id: 'custom_tools.delete_available', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'custom_tools.use', diff --git a/apps/sim/lib/function-execution/application/operations.ts b/apps/sim/lib/function-execution/application/operations.ts index 66231142760..bae1baceacd 100644 --- a/apps/sim/lib/function-execution/application/operations.ts +++ b/apps/sim/lib/function-execution/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' export const functionExecutionOperations = { // permission-group-exempt: running a Function block is the workflow executing its own code; no group key names code execution, and a gate here would fail runs the group permits diff --git a/apps/sim/lib/knowledge/application/operations.ts b/apps/sim/lib/knowledge/application/operations.ts index f3198156c64..6a01adf2388 100644 --- a/apps/sim/lib/knowledge/application/operations.ts +++ b/apps/sim/lib/knowledge/application/operations.ts @@ -1,5 +1,6 @@ -import type { ApplicationOperation } from '@/lib/core/application' -import { assertOperationCapability, defineWorkspaceOperation } from '@/lib/core/application' +import type { ApplicationOperation } from '@/lib/core/application/operation' +import { assertOperationCapability } from '@/lib/core/application/operation' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const ALL_PRINCIPAL_POLICY = { principalKinds: [ @@ -63,6 +64,7 @@ export const knowledgeOperations = { */ list: defineWorkspaceOperation({ id: 'knowledge.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -70,6 +72,7 @@ export const knowledgeOperations = { }), read: defineWorkspaceOperation({ id: 'knowledge.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -82,6 +85,7 @@ export const knowledgeOperations = { */ create: defineWorkspaceOperation({ id: 'knowledge.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.create', @@ -89,6 +93,7 @@ export const knowledgeOperations = { }), update: defineWorkspaceOperation({ id: 'knowledge.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -96,6 +101,7 @@ export const knowledgeOperations = { }), delete: defineWorkspaceOperation({ id: 'knowledge.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -110,6 +116,7 @@ export const knowledgeOperations = { */ restore: defineWorkspaceOperation({ id: 'knowledge.restore', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -117,6 +124,7 @@ export const knowledgeOperations = { }), bulkMoveItems: defineWorkspaceOperation({ id: 'knowledge.bulk_move_items', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -124,6 +132,7 @@ export const knowledgeOperations = { }), bulkDeleteItems: defineWorkspaceOperation({ id: 'knowledge.bulk_delete_items', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -131,6 +140,7 @@ export const knowledgeOperations = { }), bulkDelete: defineWorkspaceOperation({ id: 'knowledge.bulk_delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -166,6 +176,7 @@ export const knowledgeOperations = { }), search: defineWorkspaceOperation({ id: 'knowledge.search', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -173,6 +184,7 @@ export const knowledgeOperations = { }), listFolders: defineWorkspaceOperation({ id: 'knowledge.folders.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -180,6 +192,7 @@ export const knowledgeOperations = { }), createFolder: defineWorkspaceOperation({ id: 'knowledge.folders.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -187,6 +200,7 @@ export const knowledgeOperations = { }), relocateFolder: defineWorkspaceOperation({ id: 'knowledge.folders.relocate', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -194,6 +208,7 @@ export const knowledgeOperations = { }), deleteFolder: defineWorkspaceOperation({ id: 'knowledge.folders.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -201,6 +216,7 @@ export const knowledgeOperations = { }), listDocuments: defineWorkspaceOperation({ id: 'knowledge.documents.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -208,6 +224,7 @@ export const knowledgeOperations = { }), readDocument: defineWorkspaceOperation({ id: 'knowledge.documents.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -221,6 +238,7 @@ export const knowledgeOperations = { */ uploadDocument: defineWorkspaceOperation({ id: 'knowledge.documents.upload', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.upload', @@ -228,6 +246,7 @@ export const knowledgeOperations = { }), addWorkspaceFiles: defineWorkspaceOperation({ id: 'knowledge.documents.add_workspace_files', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -235,6 +254,7 @@ export const knowledgeOperations = { }), deleteDocument: defineWorkspaceOperation({ id: 'knowledge.documents.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -242,6 +262,7 @@ export const knowledgeOperations = { }), bulkDeleteDocuments: defineWorkspaceOperation({ id: 'knowledge.documents.bulk_delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -249,6 +270,7 @@ export const knowledgeOperations = { }), updateDocument: defineWorkspaceOperation({ id: 'knowledge.documents.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -256,6 +278,7 @@ export const knowledgeOperations = { }), bulkDocuments: defineWorkspaceOperation({ id: 'knowledge.documents.bulk', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -263,6 +286,7 @@ export const knowledgeOperations = { }), listChunks: defineWorkspaceOperation({ id: 'knowledge.chunks.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -270,6 +294,7 @@ export const knowledgeOperations = { }), readChunk: defineWorkspaceOperation({ id: 'knowledge.chunks.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -277,6 +302,7 @@ export const knowledgeOperations = { }), createChunk: defineWorkspaceOperation({ id: 'knowledge.chunks.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -284,6 +310,7 @@ export const knowledgeOperations = { }), updateChunk: defineWorkspaceOperation({ id: 'knowledge.chunks.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -291,6 +318,7 @@ export const knowledgeOperations = { }), deleteChunk: defineWorkspaceOperation({ id: 'knowledge.chunks.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -298,6 +326,7 @@ export const knowledgeOperations = { }), bulkChunks: defineWorkspaceOperation({ id: 'knowledge.chunks.bulk', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -311,6 +340,7 @@ export const knowledgeOperations = { */ listTags: defineWorkspaceOperation({ id: 'knowledge.tags.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'knowledge.use', @@ -318,6 +348,7 @@ export const knowledgeOperations = { }), createTag: defineWorkspaceOperation({ id: 'knowledge.tags.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -325,6 +356,7 @@ export const knowledgeOperations = { }), updateTag: defineWorkspaceOperation({ id: 'knowledge.tags.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -332,6 +364,7 @@ export const knowledgeOperations = { }), deleteTag: defineWorkspaceOperation({ id: 'knowledge.tags.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -339,6 +372,7 @@ export const knowledgeOperations = { }), readTagUsage: defineWorkspaceOperation({ id: 'knowledge.tags.read_usage', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -346,6 +380,7 @@ export const knowledgeOperations = { }), readDetailedTagUsage: defineWorkspaceOperation({ id: 'knowledge.tags.read_detailed_usage', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -353,6 +388,7 @@ export const knowledgeOperations = { }), readNextTagSlot: defineWorkspaceOperation({ id: 'knowledge.tags.read_next_slot', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -367,6 +403,7 @@ export const knowledgeOperations = { */ saveDocumentTagDefinitions: defineWorkspaceOperation({ id: 'knowledge.tags.bulk_save', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -375,6 +412,7 @@ export const knowledgeOperations = { /** Removal over that same vocabulary — unused definitions, or all of them. */ deleteDocumentTagDefinitions: defineWorkspaceOperation({ id: 'knowledge.tags.cleanup', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -382,6 +420,7 @@ export const knowledgeOperations = { }), listConnectors: defineWorkspaceOperation({ id: 'knowledge.connectors.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -389,6 +428,7 @@ export const knowledgeOperations = { }), readConnector: defineWorkspaceOperation({ id: 'knowledge.connectors.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -396,6 +436,7 @@ export const knowledgeOperations = { }), createConnector: defineWorkspaceOperation({ id: 'knowledge.connectors.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -403,6 +444,7 @@ export const knowledgeOperations = { }), updateConnector: defineWorkspaceOperation({ id: 'knowledge.connectors.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -454,6 +496,7 @@ export const knowledgeOperations = { }), deleteConnector: defineWorkspaceOperation({ id: 'knowledge.connectors.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -461,6 +504,7 @@ export const knowledgeOperations = { }), syncConnector: defineWorkspaceOperation({ id: 'knowledge.connectors.sync', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -468,6 +512,7 @@ export const knowledgeOperations = { }), listConnectorDocuments: defineWorkspaceOperation({ id: 'knowledge.connectors.documents.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -475,6 +520,7 @@ export const knowledgeOperations = { }), updateConnectorDocuments: defineWorkspaceOperation({ id: 'knowledge.connectors.documents.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'knowledge.use', @@ -488,6 +534,7 @@ export const knowledgeOperations = { */ uploadCreate: defineWorkspaceOperation({ id: 'knowledge.documents.upload.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.upload', @@ -495,6 +542,7 @@ export const knowledgeOperations = { }), uploadParts: defineWorkspaceOperation({ id: 'knowledge.documents.upload.parts', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.upload', @@ -502,6 +550,7 @@ export const knowledgeOperations = { }), uploadComplete: defineWorkspaceOperation({ id: 'knowledge.documents.upload.complete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.upload', @@ -509,6 +558,7 @@ export const knowledgeOperations = { }), uploadCancel: defineWorkspaceOperation({ id: 'knowledge.documents.upload.cancel', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'knowledge.upload', diff --git a/apps/sim/lib/logs/application/operations.ts b/apps/sim/lib/logs/application/operations.ts index 5e9a802a303..7bef524bbf3 100644 --- a/apps/sim/lib/logs/application/operations.ts +++ b/apps/sim/lib/logs/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const PUBLIC_API_PRINCIPAL_KINDS = [ 'personal_api_key', @@ -20,6 +20,7 @@ export const logOperations = { // permission-group-exempt: reading the log list is governed by workspace role; the group withholds fields inside a run — trace spans and cost — not the fact that it ran list: defineWorkspaceOperation({ id: 'logs.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -28,6 +29,7 @@ export const logOperations = { // permission-group-exempt: aggregate run counts carry no execution payload, so there is nothing here for a group to withhold readStats: defineWorkspaceOperation({ id: 'logs.read_stats', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -36,6 +38,7 @@ export const logOperations = { // permission-group-exempt: as with the list, the group projects trace spans and cost out of the response rather than refusing the read readDetail: defineWorkspaceOperation({ id: 'logs.read_detail', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', diff --git a/apps/sim/lib/mcp/application/operations.ts b/apps/sim/lib/mcp/application/operations.ts index ed47622b1eb..afeb02c3e49 100644 --- a/apps/sim/lib/mcp/application/operations.ts +++ b/apps/sim/lib/mcp/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const ALL_PRINCIPAL_POLICY = { principalKinds: [ @@ -40,6 +40,7 @@ const EXECUTION_PRINCIPAL_POLICY = { export const mcpServerOperations = { list: defineWorkspaceOperation({ id: 'mcp_servers.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'mcp_tools.use', @@ -54,6 +55,7 @@ export const mcpServerOperations = { }), discoverTools: defineWorkspaceOperation({ id: 'mcp_servers.tools.discover', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'mcp_tools.use', @@ -84,6 +86,7 @@ export const mcpServerOperations = { */ listWorkflowDeployments: defineWorkspaceOperation({ id: 'mcp_servers.workflow_deployments.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'deploy.mcp', @@ -99,6 +102,7 @@ export const mcpServerOperations = { */ readWorkflowDeploymentServer: defineWorkspaceOperation({ id: 'mcp_servers.workflow_deployments.read_server', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'deploy.mcp', @@ -106,6 +110,7 @@ export const mcpServerOperations = { }), listWorkflowDeploymentTools: defineWorkspaceOperation({ id: 'mcp_servers.workflow_deployments.list_tools', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'deploy.mcp', @@ -113,6 +118,7 @@ export const mcpServerOperations = { }), createWorkflowDeploymentServer: defineWorkspaceOperation({ id: 'mcp_servers.workflow_deployments.create_server', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.mcp', @@ -133,6 +139,7 @@ export const mcpServerOperations = { */ updateWorkflowDeploymentServer: defineWorkspaceOperation({ id: 'mcp_servers.workflow_deployments.update_server', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.mcp', @@ -140,6 +147,7 @@ export const mcpServerOperations = { }), deleteWorkflowDeploymentServer: defineWorkspaceOperation({ id: 'mcp_servers.workflow_deployments.delete_server', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.mcp', @@ -147,6 +155,7 @@ export const mcpServerOperations = { }), deployWorkflowTool: defineWorkspaceOperation({ id: 'mcp_servers.workflow_deployments.deploy_tool', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.mcp', @@ -154,6 +163,7 @@ export const mcpServerOperations = { }), undeployWorkflowTool: defineWorkspaceOperation({ id: 'mcp_servers.workflow_deployments.undeploy_tool', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.mcp', @@ -161,6 +171,7 @@ export const mcpServerOperations = { }), read: defineWorkspaceOperation({ id: 'mcp_servers.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'mcp_tools.use', @@ -168,6 +179,7 @@ export const mcpServerOperations = { }), create: defineWorkspaceOperation({ id: 'mcp_servers.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'mcp_tools.use', @@ -175,6 +187,7 @@ export const mcpServerOperations = { }), register: defineWorkspaceOperation({ id: 'mcp_servers.register', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'mcp_tools.use', @@ -182,6 +195,7 @@ export const mcpServerOperations = { }), update: defineWorkspaceOperation({ id: 'mcp_servers.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'mcp_tools.use', @@ -189,6 +203,7 @@ export const mcpServerOperations = { }), reconfigure: defineWorkspaceOperation({ id: 'mcp_servers.reconfigure', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'mcp_tools.use', @@ -196,6 +211,7 @@ export const mcpServerOperations = { }), delete: defineWorkspaceOperation({ id: 'mcp_servers.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'mcp_tools.use', diff --git a/apps/sim/lib/memory/application/operations.ts b/apps/sim/lib/memory/application/operations.ts index 3a99abef426..b3ef0f9fcfa 100644 --- a/apps/sim/lib/memory/application/operations.ts +++ b/apps/sim/lib/memory/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const MEMORY_EXECUTOR_PRINCIPAL_POLICY = { principalKinds: ['delegated'], diff --git a/apps/sim/lib/platform-context/application/operations.ts b/apps/sim/lib/platform-context/application/operations.ts index 80658e1acc9..b1dcf4c6a52 100644 --- a/apps/sim/lib/platform-context/application/operations.ts +++ b/apps/sim/lib/platform-context/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const LIVE_PLATFORM_CONTEXT_PRINCIPAL_POLICY = { principalKinds: ['delegated'], diff --git a/apps/sim/lib/sandboxes/application/operations.ts b/apps/sim/lib/sandboxes/application/operations.ts index caedf7fb1f7..35384ee8589 100644 --- a/apps/sim/lib/sandboxes/application/operations.ts +++ b/apps/sim/lib/sandboxes/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const ALL_PRINCIPAL_POLICY = { principalKinds: [ @@ -29,6 +29,7 @@ const HUMAN_PRINCIPAL_POLICY = { export const sandboxOperations = { list: defineWorkspaceOperation({ id: 'sandboxes.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'sandboxes.use', @@ -36,6 +37,7 @@ export const sandboxOperations = { }), read: defineWorkspaceOperation({ id: 'sandboxes.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'sandboxes.use', @@ -43,6 +45,7 @@ export const sandboxOperations = { }), create: defineWorkspaceOperation({ id: 'sandboxes.create', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'sandboxes.use', @@ -50,6 +53,7 @@ export const sandboxOperations = { }), update: defineWorkspaceOperation({ id: 'sandboxes.update', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'sandboxes.use', @@ -57,6 +61,7 @@ export const sandboxOperations = { }), delete: defineWorkspaceOperation({ id: 'sandboxes.delete', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'sandboxes.use', diff --git a/apps/sim/lib/secrets/application/operations.ts b/apps/sim/lib/secrets/application/operations.ts index 494b07288bc..61a7da2621d 100644 --- a/apps/sim/lib/secrets/application/operations.ts +++ b/apps/sim/lib/secrets/application/operations.ts @@ -1,10 +1,11 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const HUMAN_API_PRINCIPAL_KINDS = ['session', 'personal_api_key', 'oauth_access_token'] as const export const secretOperations = { list: defineWorkspaceOperation({ id: 'secrets.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'secrets.manage', @@ -12,6 +13,7 @@ export const secretOperations = { }), set: defineWorkspaceOperation({ id: 'secrets.set', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'secrets.manage', @@ -19,6 +21,7 @@ export const secretOperations = { }), delete: defineWorkspaceOperation({ id: 'secrets.delete', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'secrets.manage', @@ -30,6 +33,7 @@ export const secretOperations = { */ usage: defineWorkspaceOperation({ id: 'secrets.usage', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'secrets.manage', @@ -42,6 +46,7 @@ export const secretOperations = { */ references: defineWorkspaceOperation({ id: 'secrets.references', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'secrets.manage', diff --git a/apps/sim/lib/selectors/application/operations.ts b/apps/sim/lib/selectors/application/operations.ts index 2e91b477da8..ca37e5a19e1 100644 --- a/apps/sim/lib/selectors/application/operations.ts +++ b/apps/sim/lib/selectors/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' export const selectorOperations = { // permission-group-exempt: no static capability names selector browsing — credential access is authorized per credential, and per-integration denial is the parameterized allowedIntegrations key, which the funnel cannot apply because it never sees which integration a selector reaches. That decision is enforced from the use case by assertSelectorIntegrationAllowed, against the selector's own resource, ahead of the provider call. diff --git a/apps/sim/lib/skills/application/operations.ts b/apps/sim/lib/skills/application/operations.ts index 70f49364de7..894248be260 100644 --- a/apps/sim/lib/skills/application/operations.ts +++ b/apps/sim/lib/skills/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const ALL_PRINCIPAL_POLICY = { principalKinds: [ @@ -52,6 +52,7 @@ const HUMAN_HTTP_SKILL_EDITOR_POLICY = { export const skillOperations = { list: defineWorkspaceOperation({ id: 'skills.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'skills.use', @@ -59,6 +60,7 @@ export const skillOperations = { }), listAvailable: defineWorkspaceOperation({ id: 'skills.list_available', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'skills.use', @@ -66,6 +68,7 @@ export const skillOperations = { }), read: defineWorkspaceOperation({ id: 'skills.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'skills.use', @@ -73,6 +76,7 @@ export const skillOperations = { }), create: defineWorkspaceOperation({ id: 'skills.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'skills.use', @@ -80,6 +84,7 @@ export const skillOperations = { }), update: defineWorkspaceOperation({ id: 'skills.update', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'skills.use', @@ -97,6 +102,7 @@ export const skillOperations = { */ upsert: defineWorkspaceOperation({ id: 'skills.upsert', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'skills.use', @@ -104,6 +110,7 @@ export const skillOperations = { }), delete: defineWorkspaceOperation({ id: 'skills.delete', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'skills.use', @@ -111,6 +118,7 @@ export const skillOperations = { }), listEditors: defineWorkspaceOperation({ id: 'skills.editors.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'skills.use', @@ -118,6 +126,7 @@ export const skillOperations = { }), grantEditor: defineWorkspaceOperation({ id: 'skills.editors.grant', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'skills.use', @@ -125,6 +134,7 @@ export const skillOperations = { }), revokeEditor: defineWorkspaceOperation({ id: 'skills.editors.revoke', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'deny', capability: 'skills.use', diff --git a/apps/sim/lib/table/application/operations.ts b/apps/sim/lib/table/application/operations.ts index e8355131b67..eb738f96f53 100644 --- a/apps/sim/lib/table/application/operations.ts +++ b/apps/sim/lib/table/application/operations.ts @@ -1,5 +1,5 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' import type { OperationDeclarableCapability } from '@/lib/core/application/operation' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const ALL_PRINCIPAL_POLICY = { principalKinds: [ @@ -41,6 +41,7 @@ const INTERNAL_EXECUTOR_PRINCIPAL_POLICY = { function readOperation(id: Id) { return defineWorkspaceOperation({ id, + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'tables.use', @@ -51,6 +52,7 @@ function readOperation(id: Id) { function writeOperation(id: Id) { return defineWorkspaceOperation({ id, + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'tables.use', @@ -73,6 +75,7 @@ function toolWriteOperation( ) { return defineWorkspaceOperation({ id, + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability, @@ -83,6 +86,7 @@ function toolWriteOperation( function toolReadOperation(id: Id) { return defineWorkspaceOperation({ id, + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'tables.use', @@ -92,10 +96,12 @@ function toolReadOperation(id: Id) { function internalExecutorReadOperation( id: Id, - capability: OperationDeclarableCapability + capability: OperationDeclarableCapability, + oauthScope: 'api:read' | 'api:write' ) { return defineWorkspaceOperation({ id, + oauthScope, minimumRole: 'read', workspaceApiKey: 'allow', capability, @@ -106,6 +112,7 @@ function internalExecutorReadOperation( function internalExecutorWriteOperation(id: Id) { return defineWorkspaceOperation({ id, + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'tables.use', @@ -195,7 +202,7 @@ export const tableOperations = { 'tables.create' ), importWorkspaceFile: delegatedWriteOperation('tables.imports.workspace_file', 'tables.use'), - readImport: internalExecutorReadOperation('tables.imports.read', 'tables.use'), + readImport: internalExecutorReadOperation('tables.imports.read', 'tables.use', 'api:read'), createImportParts: internalExecutorWriteOperation('tables.imports.create_parts'), completeImport: internalExecutorWriteOperation('tables.imports.complete'), cancelImport: internalExecutorWriteOperation('tables.imports.cancel'), @@ -205,10 +212,18 @@ export const tableOperations = { * rather than performing it — gating either would strand a member with an * export they can neither watch nor stop after the group changed. */ - createExport: internalExecutorReadOperation('tables.exports.create', 'tables.export'), - readExport: internalExecutorReadOperation('tables.exports.read', 'tables.use'), - cancelExport: internalExecutorReadOperation('tables.exports.cancel', 'tables.use'), - downloadExport: internalExecutorReadOperation('tables.exports.download', 'tables.export'), + createExport: internalExecutorReadOperation( + 'tables.exports.create', + 'tables.export', + 'api:write' + ), + readExport: internalExecutorReadOperation('tables.exports.read', 'tables.use', 'api:read'), + cancelExport: internalExecutorReadOperation('tables.exports.cancel', 'tables.use', 'api:write'), + downloadExport: internalExecutorReadOperation( + 'tables.exports.download', + 'tables.export', + 'api:read' + ), } as const export type TableOperation = (typeof tableOperations)[keyof typeof tableOperations] diff --git a/apps/sim/lib/tool-execution/application/operations.ts b/apps/sim/lib/tool-execution/application/operations.ts index c4cb144aa09..039f7f0e065 100644 --- a/apps/sim/lib/tool-execution/application/operations.ts +++ b/apps/sim/lib/tool-execution/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' /** * Semantic operation for running one code-defined tool directly. @@ -31,6 +31,7 @@ export const toolExecutionOperations = { // permission-group-exempt: declares capability: 'none' because no static capability names running one built-in tool — the per-tool denial is the deniedTools key, applied inside @/tools against the resolved id, and the per-integration denial is the parameterized allowedIntegrations key, which the funnel cannot apply because it never sees which integration a tool id reaches. That decision is enforced from the use case by the owning-block-type check in executeToolForCaller, ahead of dispatch. execute: defineWorkspaceOperation({ id: 'tools.execute', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], diff --git a/apps/sim/lib/users/application/authorized-apps.test.ts b/apps/sim/lib/users/application/authorized-apps.test.ts index 27a655d4828..fb5b38c2597 100644 --- a/apps/sim/lib/users/application/authorized-apps.test.ts +++ b/apps/sim/lib/users/application/authorized-apps.test.ts @@ -2,7 +2,9 @@ * @vitest-environment node */ import type { PersonalApiKeyPrincipal, SessionPrincipal } from '@sim/auth/principal' -import { schemaMock } from '@sim/testing' +import { oauthAccessToken, oauthConsent } from '@sim/db/schema' +import type { SQL } from 'drizzle-orm' +import { PgDialect } from 'drizzle-orm/pg-core' import { beforeEach, describe, expect, it, vi } from 'vitest' const mocks = vi.hoisted(() => ({ @@ -17,7 +19,8 @@ vi.mock('@sim/audit', () => ({ AuditResourceType: { OAUTH_CLIENT: 'oauth_client' }, })) -vi.mock('@sim/db/schema', () => schemaMock) +vi.unmock('@sim/db/schema') +vi.unmock('drizzle-orm') vi.mock('@sim/db', () => ({ db: { @@ -42,11 +45,17 @@ const personalKey: PersonalApiKeyPrincipal = { /** A drizzle select chain that answers `rows` whenever it is finally awaited. */ function selectChain(rows: unknown[]) { - const chain: Record = {} - for (const method of ['from', 'innerJoin', 'where', 'orderBy', 'limit']) { - chain[method] = vi.fn(() => chain) + const chain = { + from: vi.fn(), + innerJoin: vi.fn(), + where: vi.fn<(predicate: SQL | undefined) => unknown>(), + orderBy: vi.fn(), + limit: vi.fn(), + then: (resolve: (value: unknown) => unknown) => Promise.resolve(rows).then(resolve), + } + for (const method of [chain.from, chain.innerJoin, chain.where, chain.orderBy, chain.limit]) { + method.mockReturnValue(chain) } - chain.then = (resolve: (value: unknown) => unknown) => Promise.resolve(rows).then(resolve) return chain } @@ -66,9 +75,10 @@ describe('authorized apps', () => { }) ).rejects.toBeInstanceOf(ForbiddenOperationError) expect(mocks.transaction).not.toHaveBeenCalled() + expect(mocks.select).not.toHaveBeenCalled() }) - it('presents each grant by the client name, falling back to its id', async () => { + it('returns one page of domain records without applying HTTP presentation', async () => { mocks.select.mockReturnValue( selectChain([ { @@ -88,22 +98,81 @@ describe('authorized apps', () => { await expect( listAuthorizedAppsUseCase.execute({ principal: session, input: {} }) - ).resolves.toEqual([ - { - clientId: 'sim-cli', - name: 'Sim CLI', - scopes: ['openid', 'api:write'], - authorizedAt: '2026-09-01T00:00:00.000Z', - }, - { - clientId: 'partner-app', - name: 'partner-app', - scopes: ['openid'], - authorizedAt: '2026-08-01T00:00:00.000Z', - }, + ).resolves.toEqual({ + apps: [ + { + clientId: 'sim-cli', + name: 'Sim CLI', + scopes: ['openid', 'api:write'], + authorizedAt: new Date('2026-09-01T00:00:00.000Z'), + }, + { + clientId: 'partner-app', + name: null, + scopes: ['openid'], + authorizedAt: new Date('2026-08-01T00:00:00.000Z'), + }, + ], + nextCursor: null, + }) + }) + + it('limits the read and resumes after the last visible row with a stable timestamp tie-breaker', async () => { + const rows = Array.from({ length: 26 }, (_, index) => ({ + clientId: `app-${String(26 - index).padStart(2, '0')}`, + name: `App ${index}`, + scopes: ['api:read'], + authorizedAt: new Date('2026-09-01T00:00:00.000Z'), + })) + const first = selectChain(rows) + const second = selectChain([rows[25]]) + mocks.select.mockReturnValueOnce(first).mockReturnValueOnce(second) + + const page = await listAuthorizedAppsUseCase.execute({ principal: session, input: {} }) + expect(first.limit).toHaveBeenCalledWith(26) + expect(page.apps).toEqual(rows.slice(0, 25)) + expect(JSON.parse(Buffer.from(page.nextCursor!, 'base64url').toString('utf8'))).toEqual([ + rows[24].authorizedAt.toISOString(), + rows[24].clientId, ]) + + const final = await listAuthorizedAppsUseCase.execute({ + principal: session, + input: { cursor: page.nextCursor! }, + }) + expect(final).toEqual({ apps: [rows[25]], nextCursor: null }) + const condition = second.where.mock.calls[0][0] + expect(condition).toBeDefined() + const query = new PgDialect().sqlToQuery(condition!) + expect(query.sql).toContain("date_trunc('milliseconds'") + expect(query.sql).toContain('"oauth_consent"."client_id" <') + expect(query.params).toContain(session.userId) + expect(query.params).toContain(rows[24].clientId) }) + it('searches all grants for this user and treats SQL wildcards literally', async () => { + const queryChain = selectChain([]) + mocks.select.mockReturnValue(queryChain) + await listAuthorizedAppsUseCase.execute({ + principal: session, + input: { search: ' 100%_App ' }, + }) + const query = new PgDialect().sqlToQuery(queryChain.where.mock.calls[0][0]!) + expect(query.params).toEqual([session.userId, '%100\\%\\_App%', '%100\\%\\_App%']) + expect(query.sql).toContain('"oauth_client"."name" ilike') + expect(query.sql).toContain('"oauth_client"."client_id" ilike') + }) + + it.each(['not-json', Buffer.from('["not-a-date","client"]', 'utf8').toString('base64url')])( + 'rejects malformed cursors before reading protected data', + async (cursor) => { + await expect( + listAuthorizedAppsUseCase.execute({ principal: session, input: { cursor } }) + ).rejects.toMatchObject({ code: 'validation' }) + expect(mocks.select).not.toHaveBeenCalled() + } + ) + it('removes the consent and both token kinds in one transaction, and records the audit', async () => { const deleted: unknown[] = [] const tx = { @@ -121,10 +190,7 @@ describe('authorized apps', () => { * and refresh token tables leaves the counts identical while deleting the * rows whose revocation is what makes a replayed token detectable. */ - expect(deleted.map(([table]) => table)).toEqual([ - schemaMock.oauthConsent, - schemaMock.oauthAccessToken, - ]) + expect(deleted.map(([table]) => table)).toEqual([oauthConsent, oauthAccessToken]) expect(mocks.recordAudit).toHaveBeenCalledWith( expect.objectContaining({ actorId: 'user-1', diff --git a/apps/sim/lib/users/application/authorized-apps.ts b/apps/sim/lib/users/application/authorized-apps.ts index 2fea72e0caa..79d8340527c 100644 --- a/apps/sim/lib/users/application/authorized-apps.ts +++ b/apps/sim/lib/users/application/authorized-apps.ts @@ -1,12 +1,60 @@ import { AuditAction, AuditResourceType, recordAudit } from '@sim/audit' import { db } from '@sim/db' import { oauthAccessToken, oauthClient, oauthConsent } from '@sim/db/schema' -import { and, desc, eq } from 'drizzle-orm' -import type { AuthorizedApp } from '@/lib/api/contracts/user' +import { and, eq, or } from 'drizzle-orm' +import { + keysetColumns, + keysetPage, + listOrderBy, + resumeKeyset, + searchFilter, + textKey, + timestampKey, +} from '@/lib/api/list-query' import type { OperationUseCase } from '@/lib/core/application' import { OrchestrationError } from '@/lib/core/orchestration/types' import { requireUserAccountPrincipal } from '@/lib/users/application/authorization' import { userAccountOperations } from '@/lib/users/application/operations' +import { AUTHORIZED_APPS_PAGE_SIZE } from '@/lib/users/constants' + +export interface ListAuthorizedAppsInput { + cursor?: string + search?: string +} + +interface AuthorizedAppRecord { + clientId: string + name: string | null + scopes: string[] + authorizedAt: Date +} + +export interface ListAuthorizedAppsResult { + apps: AuthorizedAppRecord[] + nextCursor: string | null +} + +const AUTHORIZED_APP_KEYS = [ + timestampKey(oauthConsent.createdAt, (app) => app.authorizedAt), + textKey(oauthConsent.clientId, (app) => app.clientId), +] + +function readAuthorizedAppsCursor(cursor: string | undefined): string[] | undefined { + if (!cursor) return undefined + try { + const decoded: unknown = JSON.parse(Buffer.from(cursor, 'base64url').toString('utf8')) + if ( + !Array.isArray(decoded) || + decoded.length !== 2 || + !decoded.every((key): key is string => typeof key === 'string' && key.length > 0) + ) { + throw new Error('Malformed cursor') + } + return decoded + } catch { + throw new OrchestrationError('validation', 'Invalid authorized apps cursor') + } +} /** * The OAuth clients this account has consented to, newest grant first. @@ -17,12 +65,14 @@ import { userAccountOperations } from '@/lib/users/application/operations' */ export const listAuthorizedAppsUseCase: OperationUseCase< typeof userAccountOperations.readAuthorizedApps, - Record, - AuthorizedApp[] + ListAuthorizedAppsInput, + ListAuthorizedAppsResult > = { operation: userAccountOperations.readAuthorizedApps, - async execute({ principal }) { + async execute({ principal, input }) { requireUserAccountPrincipal(principal, userAccountOperations.readAuthorizedApps) + const search = input.search?.trim() || undefined + const after = resumeKeyset(AUTHORIZED_APP_KEYS, readAuthorizedAppsCursor(input.cursor), 'desc') const rows = await db .select({ @@ -33,15 +83,25 @@ export const listAuthorizedAppsUseCase: OperationUseCase< }) .from(oauthConsent) .innerJoin(oauthClient, eq(oauthConsent.clientId, oauthClient.clientId)) - .where(eq(oauthConsent.userId, principal.userId)) - .orderBy(desc(oauthConsent.createdAt)) - - return rows.map((row) => ({ - clientId: row.clientId, - name: row.name ?? row.clientId, - scopes: row.scopes, - authorizedAt: row.authorizedAt.toISOString(), - })) + .where( + and( + eq(oauthConsent.userId, principal.userId), + search + ? or(searchFilter(oauthClient.name, search), searchFilter(oauthClient.clientId, search)) + : undefined, + after + ) + ) + .orderBy(...listOrderBy(keysetColumns(AUTHORIZED_APP_KEYS), 'desc')) + .limit(AUTHORIZED_APPS_PAGE_SIZE + 1) + + const page = keysetPage(AUTHORIZED_APP_KEYS, rows, AUTHORIZED_APPS_PAGE_SIZE) + return { + apps: page.data, + nextCursor: page.nextCursorKeys + ? Buffer.from(JSON.stringify(page.nextCursorKeys)).toString('base64url') + : null, + } }, } diff --git a/apps/sim/lib/users/constants.ts b/apps/sim/lib/users/constants.ts new file mode 100644 index 00000000000..4758d704ca4 --- /dev/null +++ b/apps/sim/lib/users/constants.ts @@ -0,0 +1 @@ +export const AUTHORIZED_APPS_PAGE_SIZE = 25 diff --git a/apps/sim/lib/workflows/application/operations.ts b/apps/sim/lib/workflows/application/operations.ts index fdfe5c82451..76ce83f6c60 100644 --- a/apps/sim/lib/workflows/application/operations.ts +++ b/apps/sim/lib/workflows/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const ALL_WORKFLOW_PRINCIPAL_POLICY = { principalKinds: [ @@ -41,6 +41,7 @@ export const workflowOperations = { // permission-group-exempt: listing the workflows in a workspace is governed by workspace role; no group hides the workflow module list: defineWorkspaceOperation({ id: 'workflows.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -49,6 +50,7 @@ export const workflowOperations = { // permission-group-exempt: reading a workflow is governed by workspace role, not by a group capability read: defineWorkspaceOperation({ id: 'workflows.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -89,6 +91,7 @@ export const workflowOperations = { // permission-group-exempt: the workflow module has no hide key, so creating a workflow is governed by workspace role alone create: defineWorkspaceOperation({ id: 'workflows.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -97,6 +100,7 @@ export const workflowOperations = { // permission-group-exempt: renaming or re-describing a workflow is governed by workspace role update: defineWorkspaceOperation({ id: 'workflows.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -120,6 +124,7 @@ export const workflowOperations = { */ replaceState: defineWorkspaceOperation({ id: 'workflows.state.replace', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'none', @@ -146,6 +151,7 @@ export const workflowOperations = { */ applyOperations: defineWorkspaceOperation({ id: 'workflows.operations.apply', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'none', @@ -154,6 +160,7 @@ export const workflowOperations = { // permission-group-exempt: restoring a soft-deleted workflow is governed by workspace role restore: defineWorkspaceOperation({ id: 'workflows.restore', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -170,6 +177,7 @@ export const workflowOperations = { // permission-group-exempt: workflow variables are workflow content, governed by workspace role applyVariableOperations: defineWorkspaceOperation({ id: 'workflows.variables.apply_operations', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -186,6 +194,7 @@ export const workflowOperations = { // permission-group-exempt: moving workflows between folders is placement, governed by workspace role moveBulk: defineWorkspaceOperation({ id: 'workflows.bulk.move', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -226,6 +235,7 @@ export const workflowOperations = { // permission-group-exempt: duplicating copies a graph the caller may already read into the same workspace, so it crosses no capability boundary duplicate: defineWorkspaceOperation({ id: 'workflows.duplicate', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -267,6 +277,7 @@ export const workflowOperations = { // permission-group-exempt: deleting a workflow is governed by workspace role delete: defineWorkspaceOperation({ id: 'workflows.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -275,6 +286,7 @@ export const workflowOperations = { // permission-group-exempt: the workflow folder tree has no hide key; reading it is governed by workspace role listFolders: defineWorkspaceOperation({ id: 'workflows.folders.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -283,6 +295,7 @@ export const workflowOperations = { // permission-group-exempt: the workflow folder tree has no hide key; arranging it is governed by workspace role createFolder: defineWorkspaceOperation({ id: 'workflows.folders.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -291,6 +304,7 @@ export const workflowOperations = { // permission-group-exempt: the workflow folder tree has no hide key; arranging it is governed by workspace role relocateFolder: defineWorkspaceOperation({ id: 'workflows.folders.relocate', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -299,6 +313,7 @@ export const workflowOperations = { // permission-group-exempt: the workflow folder tree has no hide key; arranging it is governed by workspace role deleteFolder: defineWorkspaceOperation({ id: 'workflows.folders.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -306,6 +321,7 @@ export const workflowOperations = { }), deploy: defineWorkspaceOperation({ id: 'workflows.deploy', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.api', @@ -313,6 +329,7 @@ export const workflowOperations = { }), undeploy: defineWorkspaceOperation({ id: 'workflows.undeploy', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.api', @@ -320,6 +337,7 @@ export const workflowOperations = { }), deployChat: defineWorkspaceOperation({ id: 'workflows.chat.deploy', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.chat', @@ -327,6 +345,7 @@ export const workflowOperations = { }), undeployChat: defineWorkspaceOperation({ id: 'workflows.chat.undeploy', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.chat', @@ -344,6 +363,7 @@ export const workflowOperations = { */ updatePublicApi: defineWorkspaceOperation({ id: 'workflows.public_api.update', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'none', @@ -351,6 +371,7 @@ export const workflowOperations = { }), activateVersion: defineWorkspaceOperation({ id: 'workflows.versions.activate', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'deploy.api', @@ -359,6 +380,7 @@ export const workflowOperations = { // permission-group-exempt: reverting the draft to an earlier version edits workflow content; deployment capabilities govern what is served, not what is edited revertVersion: defineWorkspaceOperation({ id: 'workflows.versions.revert', + oauthScope: 'api:write', minimumRole: 'admin', workspaceApiKey: 'deny', capability: 'none', @@ -367,6 +389,7 @@ export const workflowOperations = { // permission-group-exempt: a version's name and description are metadata on workflow content, governed by workspace role updateVersion: defineWorkspaceOperation({ id: 'workflows.versions.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -375,6 +398,7 @@ export const workflowOperations = { // permission-group-exempt: version history is workflow content, governed by workspace role listVersions: defineWorkspaceOperation({ id: 'workflows.versions.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -383,6 +407,7 @@ export const workflowOperations = { // permission-group-exempt: version history is workflow content, governed by workspace role readVersion: defineWorkspaceOperation({ id: 'workflows.versions.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -399,6 +424,7 @@ export const workflowOperations = { // permission-group-exempt: an export returns the graph its reader can already open; logs.export withholds execution logs, not definitions export: defineWorkspaceOperation({ id: 'workflows.export', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -407,6 +433,7 @@ export const workflowOperations = { // permission-group-exempt: importing is workflow authoring governed by workspace role; the blocks the payload carries are judged against allowedIntegrations before they are persisted import: defineWorkspaceOperation({ id: 'workflows.import', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -415,6 +442,7 @@ export const workflowOperations = { // permission-group-exempt: running a workflow from an authenticated surface is governed by workspace role; public_api.use withholds the unauthenticated surface, which does not reach this operation execute: defineWorkspaceOperation({ id: 'workflows.execute', + oauthScope: 'api:write', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -423,6 +451,7 @@ export const workflowOperations = { // permission-group-exempt: a manual run is governed by workspace role; public_api.use withholds the unauthenticated surface, which does not reach this operation executeManual: defineWorkspaceOperation({ id: 'workflows.manual.execute', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'none', @@ -431,6 +460,7 @@ export const workflowOperations = { // permission-group-exempt: a manual run is governed by workspace role; public_api.use withholds the unauthenticated surface, which does not reach this operation executeManualFromBlock: defineWorkspaceOperation({ id: 'workflows.manual.execute_from_block', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'none', @@ -439,6 +469,7 @@ export const workflowOperations = { // permission-group-exempt: execution history is governed by workspace role; logs.cost and logs.trace_spans withhold fields inside a run, not the right to read one listRuns: defineWorkspaceOperation({ id: 'workflows.runs.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -447,6 +478,7 @@ export const workflowOperations = { // permission-group-exempt: execution history is governed by workspace role; logs.cost and logs.trace_spans withhold fields inside a run, not the right to read one readRun: defineWorkspaceOperation({ id: 'workflows.runs.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -455,6 +487,7 @@ export const workflowOperations = { // permission-group-exempt: a paused execution's detail is pause points and resume state, not the run's execution data — the fields logs.cost and logs.trace_spans withhold never appear here readPausedExecution: defineWorkspaceOperation({ id: 'workflows.paused_executions.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -484,6 +517,7 @@ export const workflowOperations = { // permission-group-exempt: a run's own output bytes belong to the run its reader may already open; files.bulk_download withholds the workspace file store, and logs.trace_spans withholds the run's listed fields — including readRun's file list — not the right to fetch one named file downloadRunFile: defineWorkspaceOperation({ id: 'workflows.download_run_file', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -492,6 +526,7 @@ export const workflowOperations = { // permission-group-exempt: stopping a run already in flight is governed by workspace role cancelRun: defineWorkspaceOperation({ id: 'workflows.runs.cancel', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', @@ -500,6 +535,7 @@ export const workflowOperations = { // permission-group-exempt: answering a paused run is governed by workspace role resumeRun: defineWorkspaceOperation({ id: 'workflows.runs.resume', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'none', diff --git a/apps/sim/lib/workspace-files/application/operations.ts b/apps/sim/lib/workspace-files/application/operations.ts index 7338dda67dd..61e7c7252a7 100644 --- a/apps/sim/lib/workspace-files/application/operations.ts +++ b/apps/sim/lib/workspace-files/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const ALL_COPILOT_PRINCIPAL_POLICY = { principalKinds: [ @@ -31,6 +31,7 @@ const UPLOAD_PRINCIPAL_POLICY = { export const fileOperations = { list: defineWorkspaceOperation({ id: 'files.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'files.use', @@ -38,6 +39,7 @@ export const fileOperations = { }), readMetadata: defineWorkspaceOperation({ id: 'files.read_metadata', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'files.use', @@ -45,6 +47,7 @@ export const fileOperations = { }), readContent: defineWorkspaceOperation({ id: 'files.read_content', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'files.use', @@ -52,6 +55,7 @@ export const fileOperations = { }), searchContent: defineWorkspaceOperation({ id: 'files.search_content', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'files.use', @@ -59,6 +63,7 @@ export const fileOperations = { }), download: defineWorkspaceOperation({ id: 'files.download', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'files.use', @@ -73,6 +78,7 @@ export const fileOperations = { }), create: defineWorkspaceOperation({ id: 'files.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -80,6 +86,7 @@ export const fileOperations = { }), rename: defineWorkspaceOperation({ id: 'files.rename', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -99,6 +106,7 @@ export const fileOperations = { */ extractArchive: defineWorkspaceOperation({ id: 'files.extract_archive', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -106,6 +114,7 @@ export const fileOperations = { }), updateContent: defineWorkspaceOperation({ id: 'files.update_content', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -113,6 +122,7 @@ export const fileOperations = { }), updateMetadata: defineWorkspaceOperation({ id: 'files.update_metadata', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -120,6 +130,7 @@ export const fileOperations = { }), move: defineWorkspaceOperation({ id: 'files.move', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -151,6 +162,7 @@ export const fileOperations = { }), delete: defineWorkspaceOperation({ id: 'files.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -158,6 +170,7 @@ export const fileOperations = { }), restore: defineWorkspaceOperation({ id: 'files.restore', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -165,6 +178,7 @@ export const fileOperations = { }), readShare: defineWorkspaceOperation({ id: 'files.share.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'files.use', @@ -172,6 +186,7 @@ export const fileOperations = { }), updateShare: defineWorkspaceOperation({ id: 'files.share.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'deny', capability: 'files.use', @@ -179,6 +194,7 @@ export const fileOperations = { }), listFolders: defineWorkspaceOperation({ id: 'files.folders.list', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'files.use', @@ -186,6 +202,7 @@ export const fileOperations = { }), createFolder: defineWorkspaceOperation({ id: 'files.folders.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -193,6 +210,7 @@ export const fileOperations = { }), updateFolder: defineWorkspaceOperation({ id: 'files.folders.update', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -200,6 +218,7 @@ export const fileOperations = { }), deleteFolder: defineWorkspaceOperation({ id: 'files.folders.delete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -207,6 +226,7 @@ export const fileOperations = { }), restoreFolder: defineWorkspaceOperation({ id: 'files.folders.restore', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -214,6 +234,7 @@ export const fileOperations = { }), uploadCreate: defineWorkspaceOperation({ id: 'files.upload.create', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -227,6 +248,7 @@ export const fileOperations = { */ uploadRead: defineWorkspaceOperation({ id: 'files.upload.read', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'files.use', @@ -234,6 +256,7 @@ export const fileOperations = { }), uploadParts: defineWorkspaceOperation({ id: 'files.upload.parts', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -241,6 +264,7 @@ export const fileOperations = { }), uploadComplete: defineWorkspaceOperation({ id: 'files.upload.complete', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', @@ -248,6 +272,7 @@ export const fileOperations = { }), uploadCancel: defineWorkspaceOperation({ id: 'files.upload.cancel', + oauthScope: 'api:write', minimumRole: 'write', workspaceApiKey: 'allow', capability: 'files.use', diff --git a/apps/sim/lib/workspaces/application/operations.ts b/apps/sim/lib/workspaces/application/operations.ts index df802f931ab..b323b67d29c 100644 --- a/apps/sim/lib/workspaces/application/operations.ts +++ b/apps/sim/lib/workspaces/application/operations.ts @@ -1,4 +1,4 @@ -import { defineWorkspaceOperation } from '@/lib/core/application' +import { defineWorkspaceOperation } from '@/lib/core/application/workspace-operation' const PUBLIC_API_PRINCIPAL_KINDS = [ 'personal_api_key', @@ -10,6 +10,7 @@ export const workspaceOperations = { // permission-group-exempt: the public API's own view of the workspaces a key can reach; it answers what that credential already proves, and `disablePublicApi` governs whether the key reaches the surface at all listPublic: defineWorkspaceOperation({ id: 'workspaces.list_public', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -18,6 +19,7 @@ export const workspaceOperations = { // permission-group-exempt: the same surface as the list, describing one workspace the key already reaches readPublicDetail: defineWorkspaceOperation({ id: 'workspaces.read_public_detail', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', @@ -26,6 +28,7 @@ export const workspaceOperations = { // permission-group-exempt: names of people the caller already shares a workspace with; `hideOrgMemberDirectory` covers the organization-wide roster and its email addresses, which is the materially different disclosure listPublicMembers: defineWorkspaceOperation({ id: 'workspaces.members.list_public', + oauthScope: 'api:read', minimumRole: 'read', workspaceApiKey: 'allow', capability: 'none', diff --git a/apps/sim/proxy.ts b/apps/sim/proxy.ts index 49c740d800a..2be3af07a34 100644 --- a/apps/sim/proxy.ts +++ b/apps/sim/proxy.ts @@ -1,8 +1,14 @@ import { createLogger } from '@sim/logger' import { getSessionCookie } from 'better-auth/cookies' import { type NextRequest, NextResponse } from 'next/server' +import { isOAuthAuthorizationCallback, resolveAuthRedirect } from '@/app/(auth)/auth-redirect' import { getEnv } from './lib/core/config/env' -import { isAuthDisabled, isDev, isHosted } from './lib/core/config/env-flags' +import { + isAuthDisabled, + isDev, + isHosted, + isOAuthProviderEnabled, +} from './lib/core/config/env-flags' import { generateRuntimeCSP } from './lib/core/security/csp' import { getClientIp } from './lib/core/utils/request' import { isNonCanonicalSimHost } from './lib/core/utils/urls' @@ -327,7 +333,14 @@ export async function proxy(request: NextRequest) { if (redirect) return applyIndexingPolicy(request, redirect) if (url.pathname === '/login' || url.pathname === '/signup') { - if (hasActiveSession) { + const { rawCallbackUrl } = resolveAuthRedirect({ + redirect: url.searchParams.get('redirect'), + callbackUrl: url.searchParams.get('callbackUrl'), + inviteFlow: url.searchParams.get('invite_flow'), + }) + const isOAuthSignIn = + isOAuthProviderEnabled && isOAuthAuthorizationCallback(rawCallbackUrl, url.origin) + if (hasActiveSession && !isOAuthSignIn) { return applyIndexingPolicy(request, NextResponse.redirect(new URL('/workspace', request.url))) } const response = NextResponse.next() diff --git a/bun.lock b/bun.lock index 810f31e28cc..cf113c3973f 100644 --- a/bun.lock +++ b/bun.lock @@ -634,6 +634,7 @@ }, "devDependencies": { "@sim/tsconfig": "workspace:*", + "@sim/utils": "workspace:*", "@types/js-yaml": "4.0.9", "@types/node": "24.2.1", "@types/proper-lockfile": "4.1.4", diff --git a/packages/db/migrations/0323_oauth_provider.sql b/packages/db/migrations/0323_oauth_provider.sql index 29b5679c702..58bf62a7c9a 100644 --- a/packages/db/migrations/0323_oauth_provider.sql +++ b/packages/db/migrations/0323_oauth_provider.sql @@ -1,6 +1,7 @@ --- migration-safe: New OAuth tables, constraints, triggers, and seed data only; no existing rows or serving queries are rewritten. +-- migration-safe: New OAuth tables and constraints only; no existing rows or serving queries are rewritten. +-- Script migration 0012 installs the shared lifecycle triggers and client seed after these tables exist. -- Migration 0321 deliberately commits the runner's batch transaction before concurrent index builds. --- Re-open one here so every OAuth object and Drizzle's journal row commit or roll back together. +-- Re-open one here so every OAuth table and Drizzle's journal row commit or roll back together. -- On upgrades where 0323 is the only pending file, PostgreSQL treats this as a harmless nested-BEGIN warning. BEGIN;--> statement-breakpoint CREATE TABLE "oauth_access_token" ( @@ -125,134 +126,3 @@ CREATE INDEX "oauth_token_family_session_id_idx" ON "oauth_token_family" USING b CREATE INDEX "oauth_token_family_user_client_idx" ON "oauth_token_family" USING btree ("user_id","client_id");--> statement-breakpoint CREATE INDEX "oauth_token_family_consent_id_idx" ON "oauth_token_family" USING btree ("consent_id");--> statement-breakpoint CREATE INDEX "oauth_token_family_expires_at_idx" ON "oauth_token_family" USING btree ("expires_at");--> statement-breakpoint -CREATE FUNCTION "oauth_refresh_token_prepare_family"() RETURNS trigger AS $$ -DECLARE - resolved_consent_id text; -BEGIN - IF NEW."family_id" IS NULL THEN - SELECT "id" INTO resolved_consent_id - FROM "oauth_consent" - WHERE "client_id" = NEW."client_id" - AND "user_id" IS NOT DISTINCT FROM NEW."user_id" - AND "reference_id" IS NOT DISTINCT FROM NEW."reference_id" - FOR KEY SHARE; - - NEW."family_id" := NEW."id"; - NEW."generation" := 0; - INSERT INTO "oauth_token_family" ( - "id", "client_id", "session_id", "user_id", "reference_id", - "consent_id", "current_generation", "created_at", "expires_at" - ) VALUES ( - NEW."id", NEW."client_id", NEW."session_id", NEW."user_id", NEW."reference_id", - resolved_consent_id, 0, NEW."created_at", NEW."expires_at" - ); - ELSE - PERFORM 1 - FROM "oauth_token_family" AS family - WHERE family."id" = NEW."family_id" - AND family."client_id" = NEW."client_id" - AND family."user_id" = NEW."user_id" - AND family."session_id" IS NOT DISTINCT FROM NEW."session_id" - AND family."reference_id" IS NOT DISTINCT FROM NEW."reference_id" - AND family."current_generation" = NEW."generation" - AND NEW."expires_at" <= family."expires_at"; - - IF NOT FOUND THEN - RAISE EXCEPTION 'OAuth refresh token does not match its current family generation' - USING ERRCODE = 'foreign_key_violation'; - END IF; - END IF; - RETURN NEW; -END; -$$ LANGUAGE plpgsql;--> statement-breakpoint -CREATE TRIGGER "oauth_refresh_token_10_prepare_family" - BEFORE INSERT ON "oauth_refresh_token" - FOR EACH ROW - EXECUTE FUNCTION "oauth_refresh_token_prepare_family"();--> statement-breakpoint -CREATE FUNCTION "oauth_token_require_active_consent"() RETURNS trigger AS $$ -BEGIN - PERFORM 1 - FROM "oauth_client" - WHERE "client_id" = NEW."client_id" - AND "skip_consent" IS TRUE; - - IF FOUND THEN - RETURN NEW; - END IF; - - PERFORM 1 - FROM "oauth_consent" - WHERE "client_id" = NEW."client_id" - AND "user_id" IS NOT DISTINCT FROM NEW."user_id" - AND "reference_id" IS NOT DISTINCT FROM NEW."reference_id" - AND NEW."scopes" <@ "scopes" - FOR SHARE; - - IF NOT FOUND THEN - RAISE EXCEPTION 'OAuth token requires an active consent grant' - USING ERRCODE = 'foreign_key_violation'; - END IF; - RETURN NEW; -END; -$$ LANGUAGE plpgsql;--> statement-breakpoint -CREATE TRIGGER "oauth_access_token_require_active_consent" - BEFORE INSERT ON "oauth_access_token" - FOR EACH ROW - EXECUTE FUNCTION "oauth_token_require_active_consent"();--> statement-breakpoint -CREATE TRIGGER "oauth_refresh_token_20_require_active_consent" - BEFORE INSERT ON "oauth_refresh_token" - FOR EACH ROW - EXECUTE FUNCTION "oauth_token_require_active_consent"();--> statement-breakpoint -CREATE FUNCTION "oauth_consent_narrow_tokens"() RETURNS trigger AS $$ -BEGIN - IF NEW."scopes" = OLD."scopes" THEN - RETURN NEW; - END IF; - - DELETE FROM "oauth_token_family" AS family - WHERE family."consent_id" = NEW."id" - AND EXISTS ( - SELECT 1 - FROM "oauth_refresh_token" AS refresh - WHERE refresh."family_id" = family."id" - AND refresh."generation" = family."current_generation" - AND NOT (refresh."scopes" <@ NEW."scopes") - ); - - DELETE FROM "oauth_access_token" - WHERE "client_id" = NEW."client_id" - AND "user_id" IS NOT DISTINCT FROM NEW."user_id" - AND "reference_id" IS NOT DISTINCT FROM NEW."reference_id" - AND NOT ("scopes" <@ NEW."scopes"); - RETURN NEW; -END; -$$ LANGUAGE plpgsql;--> statement-breakpoint -CREATE TRIGGER "oauth_consent_narrow_tokens" - AFTER UPDATE OF "scopes" ON "oauth_consent" - FOR EACH ROW - EXECUTE FUNCTION "oauth_consent_narrow_tokens"();--> statement-breakpoint -CREATE FUNCTION "oauth_consent_delete_unlinked_access_tokens"() RETURNS trigger AS $$ -BEGIN - DELETE FROM "oauth_access_token" - WHERE "client_id" = OLD."client_id" - AND "user_id" IS NOT DISTINCT FROM OLD."user_id" - AND "reference_id" IS NOT DISTINCT FROM OLD."reference_id"; - RETURN OLD; -END; -$$ LANGUAGE plpgsql;--> statement-breakpoint -CREATE TRIGGER "oauth_consent_delete_unlinked_access_tokens" - AFTER DELETE ON "oauth_consent" - FOR EACH ROW - EXECUTE FUNCTION "oauth_consent_delete_unlinked_access_tokens"();--> statement-breakpoint --- Seed the first-party Sim CLI as a public PKCE client. Loopback URIs match any port per RFC 8252. -INSERT INTO "oauth_client" ( - "id", "client_id", "name", "disabled", "skip_consent", "public", "type", - "token_endpoint_auth_method", "require_pkce", "grant_types", "response_types", - "redirect_uris", "scopes", "created_at", "updated_at" -) VALUES ( - 'sim-cli', 'sim-cli', 'Sim CLI', false, false, true, 'native', - 'none', true, ARRAY['authorization_code', 'refresh_token'], ARRAY['code'], - ARRAY['http://127.0.0.1/callback', 'http://[::1]/callback'], - ARRAY['offline_access', 'api:read', 'api:write'], - now(), now() -) ON CONFLICT ("client_id") DO NOTHING; diff --git a/packages/db/oauth-provider-lifecycle.ts b/packages/db/oauth-provider-lifecycle.ts new file mode 100644 index 00000000000..77c342a1d21 --- /dev/null +++ b/packages/db/oauth-provider-lifecycle.ts @@ -0,0 +1,152 @@ +import type { Sql } from 'postgres' + +/** + * Objects Drizzle cannot express. Both the versioned migration runner and + * db:push install this same lifecycle so consent and token-family guarantees + * do not depend on how the tables were created. Reapplication preserves every + * grant and operator customization of the seeded client. Future lifecycle + * changes also require a new script migration; db:push reapplies on every run. + */ +const OAUTH_PROVIDER_LIFECYCLE_SQL = `CREATE OR REPLACE FUNCTION "oauth_refresh_token_prepare_family"() RETURNS trigger AS $$ +DECLARE + resolved_consent_id text; +BEGIN + IF NEW."family_id" IS NULL THEN + SELECT "id" INTO resolved_consent_id + FROM "oauth_consent" + WHERE "client_id" = NEW."client_id" + AND "user_id" IS NOT DISTINCT FROM NEW."user_id" + AND "reference_id" IS NOT DISTINCT FROM NEW."reference_id" + FOR KEY SHARE; + + NEW."family_id" := NEW."id"; + NEW."generation" := 0; + INSERT INTO "oauth_token_family" ( + "id", "client_id", "session_id", "user_id", "reference_id", + "consent_id", "current_generation", "created_at", "expires_at" + ) VALUES ( + NEW."id", NEW."client_id", NEW."session_id", NEW."user_id", NEW."reference_id", + resolved_consent_id, 0, NEW."created_at", NEW."expires_at" + ); + ELSE + PERFORM 1 + FROM "oauth_token_family" AS family + WHERE family."id" = NEW."family_id" + AND family."client_id" = NEW."client_id" + AND family."user_id" = NEW."user_id" + AND family."session_id" IS NOT DISTINCT FROM NEW."session_id" + AND family."reference_id" IS NOT DISTINCT FROM NEW."reference_id" + AND family."current_generation" = NEW."generation" + AND NEW."expires_at" <= family."expires_at"; + + IF NOT FOUND THEN + RAISE EXCEPTION 'OAuth refresh token does not match its current family generation' + USING ERRCODE = 'foreign_key_violation'; + END IF; + END IF; + RETURN NEW; +END; +$$ LANGUAGE plpgsql;--> statement-breakpoint +CREATE OR REPLACE TRIGGER "oauth_refresh_token_10_prepare_family" + BEFORE INSERT ON "oauth_refresh_token" + FOR EACH ROW + EXECUTE FUNCTION "oauth_refresh_token_prepare_family"();--> statement-breakpoint +CREATE OR REPLACE FUNCTION "oauth_token_require_active_consent"() RETURNS trigger AS $$ +BEGIN + PERFORM 1 + FROM "oauth_client" + WHERE "client_id" = NEW."client_id" + AND "skip_consent" IS TRUE; + + IF FOUND THEN + RETURN NEW; + END IF; + + PERFORM 1 + FROM "oauth_consent" + WHERE "client_id" = NEW."client_id" + AND "user_id" IS NOT DISTINCT FROM NEW."user_id" + AND "reference_id" IS NOT DISTINCT FROM NEW."reference_id" + AND NEW."scopes" <@ "scopes" + FOR SHARE; + + IF NOT FOUND THEN + RAISE EXCEPTION 'OAuth token requires an active consent grant' + USING ERRCODE = 'foreign_key_violation'; + END IF; + RETURN NEW; +END; +$$ LANGUAGE plpgsql;--> statement-breakpoint +CREATE OR REPLACE TRIGGER "oauth_access_token_require_active_consent" + BEFORE INSERT ON "oauth_access_token" + FOR EACH ROW + EXECUTE FUNCTION "oauth_token_require_active_consent"();--> statement-breakpoint +CREATE OR REPLACE TRIGGER "oauth_refresh_token_20_require_active_consent" + BEFORE INSERT ON "oauth_refresh_token" + FOR EACH ROW + EXECUTE FUNCTION "oauth_token_require_active_consent"();--> statement-breakpoint +CREATE OR REPLACE FUNCTION "oauth_consent_narrow_tokens"() RETURNS trigger AS $$ +BEGIN + IF NEW."scopes" = OLD."scopes" THEN + RETURN NEW; + END IF; + + DELETE FROM "oauth_token_family" AS family + WHERE family."consent_id" = NEW."id" + AND EXISTS ( + SELECT 1 + FROM "oauth_refresh_token" AS refresh + WHERE refresh."family_id" = family."id" + AND refresh."generation" = family."current_generation" + AND NOT (refresh."scopes" <@ NEW."scopes") + ); + + DELETE FROM "oauth_access_token" + WHERE "client_id" = NEW."client_id" + AND "user_id" IS NOT DISTINCT FROM NEW."user_id" + AND "reference_id" IS NOT DISTINCT FROM NEW."reference_id" + AND NOT ("scopes" <@ NEW."scopes"); + RETURN NEW; +END; +$$ LANGUAGE plpgsql;--> statement-breakpoint +CREATE OR REPLACE TRIGGER "oauth_consent_narrow_tokens" + AFTER UPDATE OF "scopes" ON "oauth_consent" + FOR EACH ROW + EXECUTE FUNCTION "oauth_consent_narrow_tokens"();--> statement-breakpoint +CREATE OR REPLACE FUNCTION "oauth_consent_delete_unlinked_access_tokens"() RETURNS trigger AS $$ +BEGIN + DELETE FROM "oauth_access_token" + WHERE "client_id" = OLD."client_id" + AND "user_id" IS NOT DISTINCT FROM OLD."user_id" + AND "reference_id" IS NOT DISTINCT FROM OLD."reference_id"; + RETURN OLD; +END; +$$ LANGUAGE plpgsql;--> statement-breakpoint +CREATE OR REPLACE TRIGGER "oauth_consent_delete_unlinked_access_tokens" + AFTER DELETE ON "oauth_consent" + FOR EACH ROW + EXECUTE FUNCTION "oauth_consent_delete_unlinked_access_tokens"();--> statement-breakpoint +-- Seed the first-party Sim CLI as a public PKCE client. Loopback URIs match any port per RFC 8252. +INSERT INTO "oauth_client" ( + "id", "client_id", "name", "disabled", "skip_consent", "public", "type", + "token_endpoint_auth_method", "require_pkce", "grant_types", "response_types", + "redirect_uris", "scopes", "created_at", "updated_at" +) VALUES ( + 'sim-cli', 'sim-cli', 'Sim CLI', false, false, true, 'native', + 'none', true, ARRAY['authorization_code', 'refresh_token'], ARRAY['code'], + ARRAY['http://127.0.0.1/callback', 'http://[::1]/callback'], + ARRAY['offline_access', 'api:read', 'api:write'], + now(), now() +) ON CONFLICT ("client_id") DO NOTHING; +` + +/** Installs OAuth triggers and the first-party client atomically and idempotently. */ +export async function reconcileOAuthProviderLifecycle(database: Sql): Promise { + await database.begin(async (tx) => { + await tx.unsafe("SET LOCAL lock_timeout = '5s'") + await tx`SELECT pg_advisory_xact_lock(hashtext('sim:oauth-provider-lifecycle'))` + for (const statement of OAUTH_PROVIDER_LIFECYCLE_SQL.split('--> statement-breakpoint')) { + if (statement.trim()) await tx.unsafe(statement) + } + }) +} diff --git a/packages/db/package.json b/packages/db/package.json index c5b8ab0c83b..39a0b69a60a 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -24,7 +24,7 @@ }, "scripts": { "db:generate": "bunx drizzle-kit generate --config=./drizzle.config.ts", - "db:push": "bunx drizzle-kit push --config=./drizzle.config.ts && bun --env-file=.env run ./scripts/reconcile-credential-group-resource-policies.ts", + "db:push": "bunx drizzle-kit push --config=./drizzle.config.ts && bun --env-file=.env run ./scripts/reconcile-credential-group-resource-policies.ts && bun --env-file=.env run ./scripts/reconcile-oauth-provider.ts", "db:migrate": "bun --env-file=.env run ./scripts/migrate.ts", "db:apply-dev-workspace-file-size-cutover": "bun --env-file=.env run ./scripts/apply-dev-workspace-file-size-cutover.ts", "db:reconcile-fork-kb-file-ownership": "bun --env-file=.env run ./scripts/reconcile-fork-kb-file-ownership.ts", diff --git a/packages/db/script-migrations-paused-billing-attribution.test.ts b/packages/db/script-migrations-paused-billing-attribution.test.ts index 3cc79859f74..e20907ddb9b 100644 --- a/packages/db/script-migrations-paused-billing-attribution.test.ts +++ b/packages/db/script-migrations-paused-billing-attribution.test.ts @@ -448,6 +448,7 @@ describe('script migration registry', () => { '0009_backfill_wel_residual_cost_total', '0010_backfill_credential_group_resource_policies', '0011_remap_legacy_knowledge_connector_credentials', + '0012_reconcile_oauth_provider_lifecycle', ]) }) }) diff --git a/packages/db/script-migrations/0012_reconcile_oauth_provider_lifecycle.ts b/packages/db/script-migrations/0012_reconcile_oauth_provider_lifecycle.ts new file mode 100644 index 00000000000..a4f83c83d0f --- /dev/null +++ b/packages/db/script-migrations/0012_reconcile_oauth_provider_lifecycle.ts @@ -0,0 +1,8 @@ +import { reconcileOAuthProviderLifecycle } from '@sim/db/oauth-provider-lifecycle' +import type { ScriptMigration } from '@sim/db/script-migrations/types' + +/** Installs lifecycle objects after the additive OAuth tables have been migrated. */ +export const reconcileOAuthProviderLifecycleMigration: ScriptMigration = { + name: '0012_reconcile_oauth_provider_lifecycle', + up: reconcileOAuthProviderLifecycle, +} diff --git a/packages/db/script-migrations/index.ts b/packages/db/script-migrations/index.ts index 78e3b7c9f9b..b945baf73a4 100644 --- a/packages/db/script-migrations/index.ts +++ b/packages/db/script-migrations/index.ts @@ -1,3 +1,4 @@ +import { reconcileOAuthProviderLifecycleMigration } from '@sim/db/script-migrations/0012_reconcile_oauth_provider_lifecycle' import type { Sql } from 'postgres' import { backfillTableOrderKeys } from './0001_backfill_table_order_keys' import { backfillPausedBillingAttribution } from './0002_backfill_paused_billing_attribution' @@ -31,6 +32,7 @@ export const scriptMigrations: readonly ScriptMigration[] = [ backfillWelResidualCostTotalMigration, backfillCredentialGroupResourcePolicies, remapLegacyKnowledgeConnectorCredentialsMigration, + reconcileOAuthProviderLifecycleMigration, ] /** diff --git a/packages/db/scripts/reconcile-oauth-provider.ts b/packages/db/scripts/reconcile-oauth-provider.ts new file mode 100644 index 00000000000..a3bcfb02f59 --- /dev/null +++ b/packages/db/scripts/reconcile-oauth-provider.ts @@ -0,0 +1,20 @@ +import { reconcileOAuthProviderLifecycle } from '@sim/db/oauth-provider-lifecycle' +import { createLogger } from '@sim/logger' +import postgres from 'postgres' + +const logger = createLogger('OAuthProviderLifecycleReconciliation') +const url = process.env.DATABASE_URL +if (!url) throw new Error('Missing DATABASE_URL') + +const sql = postgres(url, { + max: 1, + connect_timeout: 10, + connection: { application_name: 'sim-oauth-provider-reconcile' }, +}) + +try { + await reconcileOAuthProviderLifecycle(sql) + logger.info('OAuth provider lifecycle reconciliation completed') +} finally { + await sql.end() +} diff --git a/packages/db/vitest.config.ts b/packages/db/vitest.config.ts index c78e7cc1b77..75e99683065 100644 --- a/packages/db/vitest.config.ts +++ b/packages/db/vitest.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ + resolve: { tsconfigPaths: true }, test: { globals: false, environment: 'node', diff --git a/packages/sim-cli/THIRD_PARTY_LICENSES b/packages/sim-cli/THIRD_PARTY_LICENSES index f8ff0105dc1..33ea71bba06 100644 --- a/packages/sim-cli/THIRD_PARTY_LICENSES +++ b/packages/sim-cli/THIRD_PARTY_LICENSES @@ -9,6 +9,13 @@ Copyright (c) 2011 TJ Holowaychuk js-yaml Copyright (C) 2011-2015 by Vitaly Puzrin +proper-lockfile +Copyright (c) 2018 Made With MOXY Lda + +retry +Copyright (c) 2011 Tim Koschützki (tim@debuggable.com) +Copyright (c) 2011 Felix Geisendörfer (felix@debuggable.com) + Each dependency above is licensed under the MIT License: Permission is hereby granted, free of charge, to any person obtaining a copy @@ -28,3 +35,38 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +graceful-fs +The ISC License + +Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +signal-exit +The ISC License + +Copyright (c) 2015, Contributors + +Permission to use, copy, modify, and/or distribute this software +for any purpose with or without fee is hereby granted, provided +that the above copyright notice and this permission notice +appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE +LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/packages/sim-cli/package.json b/packages/sim-cli/package.json index becfb2a3564..313354fc8f1 100644 --- a/packages/sim-cli/package.json +++ b/packages/sim-cli/package.json @@ -54,6 +54,7 @@ }, "devDependencies": { "@sim/tsconfig": "workspace:*", + "@sim/utils": "workspace:*", "@types/js-yaml": "4.0.9", "@types/node": "24.2.1", "@types/proper-lockfile": "4.1.4", diff --git a/packages/sim-cli/src/auth/oauth-flow.test.ts b/packages/sim-cli/src/auth/oauth-flow.test.ts index 2fd325a7146..216d48a083b 100644 --- a/packages/sim-cli/src/auth/oauth-flow.test.ts +++ b/packages/sim-cli/src/auth/oauth-flow.test.ts @@ -1,4 +1,5 @@ import { createHash } from 'node:crypto' +import { get, type IncomingMessage } from 'node:http' import { afterEach, describe, expect, it, vi } from 'vitest' import { SimApiError } from '../http/client' import { @@ -67,6 +68,20 @@ describe('buildAuthorizeUrl', () => { }) describe('discoverOAuthProvider', () => { + it('does not downgrade to API keys when discovery exceeds the response limit', async () => { + const cancel = vi.fn() + vi.stubGlobal( + 'fetch', + async () => + new Response(new ReadableStream({ cancel }), { + headers: { 'content-length': String(64 * 1024 + 1) }, + }) + ) + + await expect(discoverOAuthProvider(ENDPOINT)).resolves.toBe('unreachable') + expect(cancel).toHaveBeenCalledOnce() + }) + it('reports a server that publishes a token endpoint as available', async () => { vi.stubGlobal('fetch', async () => reply(200, { @@ -91,6 +106,29 @@ describe('discoverOAuthProvider', () => { }) describe('token endpoint', () => { + it.each([undefined, '1'])( + 'cancels an oversized chunked token response with content-length=%s', + async (contentLength) => { + const cancel = vi.fn() + const body = new ReadableStream({ + pull(controller) { + controller.enqueue(new Uint8Array(32 * 1024)) + }, + cancel, + }) + vi.stubGlobal( + 'fetch', + async () => + new Response(body, { + headers: contentLength ? { 'content-length': contentLength } : {}, + }) + ) + + await expect(refreshTokens(ENDPOINT, 'r')).rejects.toThrow('exceeds 64 KiB') + expect(cancel).toHaveBeenCalledOnce() + } + ) + it('posts the code with its verifier as a form and reads the pair back', async () => { const fetchMock = vi.fn(async () => reply(200, TOKENS)) vi.stubGlobal('fetch', fetchMock) @@ -150,6 +188,10 @@ describe('loginWithBrowser', () => { const fetchMock = vi.fn(async () => reply(200, TOKENS)) vi.stubGlobal('fetch', fetchMock) + let receiveCallback!: (response: IncomingMessage) => void + const callback = new Promise((resolve) => { + receiveCallback = resolve + }) const login = loginWithBrowser(ENDPOINT, { scopes: ['offline_access', 'api:read'], onAuthorizeUrl: (url) => { @@ -160,23 +202,29 @@ describe('loginWithBrowser', () => { redirectUri.searchParams.set(key, value) } /** Node's real HTTP client, not the stubbed fetch, exercises the listener. */ - void import('node:http').then(({ get }) => { - get(redirectUri, (response) => response.resume()) + get(redirectUri, (response) => { + receiveCallback(response) + response.resume() }) }, timeoutMs: 5000, }) - return { login, fetchMock } + return { login, fetchMock, callback } } it('listens on 127.0.0.1, verifies state, and redeems the code with the verifier', async () => { - const { login, fetchMock } = await completeInBrowser((_params, state) => ({ + const { login, fetchMock, callback } = await completeInBrowser((_params, state) => ({ code: 'the-code', state, })) const tokens = await login expect(tokens.accessToken).toBe('sim_oat_access') + const response = await callback + expect(response.statusCode).toBe(302) + expect(response.headers.location).toBe(`${ENDPOINT}/cli/auth/done`) + expect(response.headers['referrer-policy']).toBe('no-referrer') + expect(response.headers['cache-control']).toBe('no-store') const [, init] = fetchMock.mock.calls[0] as unknown as [string, RequestInit] const form = Object.fromEntries(new URLSearchParams(String(init.body))) diff --git a/packages/sim-cli/src/auth/oauth-flow.ts b/packages/sim-cli/src/auth/oauth-flow.ts index 2d70a3f0f15..4fe563ca787 100644 --- a/packages/sim-cli/src/auth/oauth-flow.ts +++ b/packages/sim-cli/src/auth/oauth-flow.ts @@ -52,6 +52,37 @@ const LOGIN_TIMEOUT_MS = 5 * 60 * 1000 /** How long a discovery, revocation, or code exchange may take. */ const REQUEST_TIMEOUT_MS = 10 * 1000 +const MAX_OAUTH_RESPONSE_BYTES = 64 * 1024 + +/** Bounds responses from configurable authorization servers before decoding JSON. */ +async function readOAuthResponse(response: Response): Promise { + const tooLarge = () => + new SimApiError('The authorization server response exceeds 64 KiB.', response.status) + const declaredLength = Number(response.headers.get('content-length')) + if (Number.isFinite(declaredLength) && declaredLength > MAX_OAUTH_RESPONSE_BYTES) { + await response.body?.cancel().catch(() => undefined) + throw tooLarge() + } + if (!response.body) return '' + + const reader = response.body.getReader() + const chunks: Uint8Array[] = [] + let size = 0 + try { + while (true) { + const { done, value } = await reader.read() + if (done) return Buffer.concat(chunks, size).toString('utf8') + size += value.byteLength + if (size > MAX_OAUTH_RESPONSE_BYTES) { + await reader.cancel().catch(() => undefined) + throw tooLarge() + } + chunks.push(value) + } + } finally { + reader.releaseLock() + } +} /** * Refuses to run the OAuth flow over cleartext. @@ -168,7 +199,10 @@ export async function discoverOAuthProvider(endpoint: string): Promise { - const raw = await response.text() + const raw = await readOAuthResponse(response) let body: TokenResponse try { body = JSON.parse(raw) as TokenResponse @@ -382,6 +416,7 @@ interface LoopbackResult { function listenForCallback( server: Server, expectedState: string, + completionUrl: string, signal: AbortSignal | undefined, timeoutMs: number ): Promise { @@ -413,6 +448,8 @@ function listenForCallback( signal?.addEventListener('abort', onAbort, { once: true }) server.on('request', (request, response) => { + response.setHeader('cache-control', 'no-store') + response.setHeader('referrer-policy', 'no-referrer') const url = new URL(request.url ?? '/', 'http://127.0.0.1') if (url.pathname !== CALLBACK_PATH) { response.writeHead(404, { 'content-type': 'text/plain' }).end('Not found') @@ -461,14 +498,7 @@ function listenForCallback( }) return } - response - .writeHead(200, { 'content-type': 'text/html; charset=utf-8' }) - .end( - callbackPage( - 'Authorization received', - 'Return to your terminal while Sim finishes signing you in.' - ) - ) + response.writeHead(302, { location: completionUrl }).end() finish({ ok: true, value: { code } }) }) }) @@ -523,6 +553,7 @@ export async function loginWithBrowser( const pending = listenForCallback( server, pkce.state, + buildUrl(endpoint, '/cli/auth/done'), callbackSignal, options.timeoutMs ?? LOGIN_TIMEOUT_MS ) diff --git a/packages/sim-cli/src/auth/refresh.process.test.ts b/packages/sim-cli/src/auth/refresh.process.test.ts new file mode 100644 index 00000000000..696b1b78331 --- /dev/null +++ b/packages/sim-cli/src/auth/refresh.process.test.ts @@ -0,0 +1,223 @@ +/** @vitest-environment node */ +import { type ChildProcess, execFileSync, fork } from 'node:child_process' +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs' +import { createServer, type ServerResponse } from 'node:http' +import type { AddressInfo } from 'node:net' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { fileURLToPath } from 'node:url' +import { afterAll, afterEach, beforeAll, beforeEach, expect, it, vi } from 'vitest' +import { + readStoredCredential, + writeConfigProfile, + writeCredentialsProfile, +} from '../config/profile' + +interface WorkerResult { + refreshToken?: string + error?: string +} +function deferred() { + let resolve!: (value: T) => void + let reject!: (reason: Error) => void + const promise = new Promise((yes, no) => { + resolve = yes + reject = no + }) + void promise.catch(() => undefined) + return { promise, resolve, reject } +} +let buildDir: string +let workerPath: string +let configDir: string +const children = new Set() +beforeAll(() => { + buildDir = mkdtempSync(join(tmpdir(), 'sim-oauth-process-build-')) + const source = join(buildDir, 'worker.ts') + const modulePath = (path: string) => JSON.stringify(fileURLToPath(new URL(path, import.meta.url))) + writeFileSync( + source, + ` + import { readStoredCredential } from ${modulePath('../config/profile.ts')} + import { refreshStoredOAuth } from ${modulePath('./refresh.ts')} + import { logoutCommand } from ${modulePath('../commands/auth.ts')} + const current = readStoredCredential('default').oauth + process.once('message', async () => { + try { + if (process.argv[2] === 'logout') { + await logoutCommand().parseAsync([], { from: 'user' }) + process.send({}) + } else { + const next = await refreshStoredOAuth({ name: 'default', authProfile: 'default', endpoint: process.env.TEST_ENDPOINT }, current) + process.send({ refreshToken: next.refreshToken }) + } + } catch (error) { process.send({ error: error.message }) } + process.disconnect() + }) + process.send('ready') + ` + ) + mkdirSync(join(buildDir, 'dist')) + writeFileSync(join(buildDir, 'package.json'), JSON.stringify({ version: '2.1.2' })) + workerPath = join(buildDir, 'dist', 'worker.mjs') + execFileSync('bun', ['build', source, '--target=node', '--format=esm', '--outfile', workerPath], { + stdio: 'pipe', + }) +}) +afterAll(() => rmSync(buildDir, { recursive: true, force: true })) +beforeEach(() => { + configDir = mkdtempSync(join(tmpdir(), 'sim-oauth-process-config-')) + vi.stubEnv('SIM_CONFIG_DIR', configDir) +}) +afterEach(() => { + for (const child of children) child.kill('SIGKILL') + children.clear() + vi.unstubAllEnvs() + rmSync(configDir, { recursive: true, force: true }) +}) +function startWorker(endpoint: string, mode: 'refresh' | 'logout') { + const ready = deferred() + const result = deferred() + const env: NodeJS.ProcessEnv = { + ...process.env, + SIM_CONFIG_DIR: configDir, + TEST_ENDPOINT: endpoint, + } + for (const key of Object.keys(env)) { + if (key.startsWith('SIM_') && key !== 'SIM_CONFIG_DIR') delete env[key] + } + const child = fork(workerPath, [mode], { env, stdio: ['ignore', 'ignore', 'pipe', 'ipc'] }) + children.add(child) + let output: WorkerResult | undefined + let stderr = '' + child.stderr?.on('data', (chunk: Buffer) => { + stderr += chunk.toString() + }) + child.on('message', (message: unknown) => { + if (message === 'ready') ready.resolve() + else output = message as WorkerResult + }) + child.once('error', (error) => { + ready.reject(error) + result.reject(error) + }) + child.once('exit', (code) => { + children.delete(child) + if (code === 0 && output) result.resolve(output) + else { + const error = new Error(`OAuth worker exited ${code}: ${stderr}`) + ready.reject(error) + result.reject(error) + } + }) + return { ready: ready.promise, result: result.promise, run: () => child.send('run') } +} +async function withOAuthServer( + run: (context: { + endpoint: string + requests: string[] + firstRequest: Promise + release: () => void + }) => Promise +) { + const requests: string[] = [] + const firstRequest = deferred() + let heldResponse: ServerResponse | undefined + const respond = (response: ServerResponse) => { + response.writeHead(200, { 'content-type': 'application/json' }) + response.end( + JSON.stringify({ + access_token: 'new-access', + refresh_token: 'new-refresh', + expires_in: 3600, + scope: 'offline_access api:read', + }) + ) + } + const server = createServer((request, response) => { + const chunks: Buffer[] = [] + request.on('data', (chunk: Buffer) => chunks.push(chunk)) + request.on('end', () => { + const body = new URLSearchParams(Buffer.concat(chunks).toString()) + requests.push(`${request.url}:${body.get('refresh_token') ?? body.get('token')}`) + if (requests.length === 1) { + heldResponse = response + firstRequest.resolve() + } else respond(response) + }) + }) + await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)) + const endpoint = `http://127.0.0.1:${(server.address() as AddressInfo).port}` + writeConfigProfile('default', { endpoint }) + writeCredentialsProfile('default', { + kind: 'oauth', + oauth: { + accessToken: 'old-access', + refreshToken: 'old-refresh', + expiresAt: 1, + issuer: `${endpoint}/api/auth`, + loginId: 'process-test', + scope: 'offline_access api:read', + }, + }) + try { + await run({ + endpoint, + requests, + firstRequest: firstRequest.promise, + release: () => { + if (heldResponse) respond(heldResponse) + }, + }) + } finally { + server.closeAllConnections() + await new Promise((resolve) => server.close(() => resolve())) + } +} +it('two independent processes share one refresh and persist the same rotation', async () => { + await withOAuthServer(async ({ endpoint, requests, firstRequest, release }) => { + const first = startWorker(endpoint, 'refresh') + const second = startWorker(endpoint, 'refresh') + await Promise.all([first.ready, second.ready]) + first.run() + await firstRequest + second.run() + release() + expect(await Promise.all([first.result, second.result])).toEqual([ + { refreshToken: 'new-refresh' }, + { refreshToken: 'new-refresh' }, + ]) + expect(requests).toEqual(['/api/auth/oauth2/token:old-refresh']) + expect(readStoredCredential('default')).toMatchObject({ + oauth: { refreshToken: 'new-refresh' }, + }) + }) +}, 15000) +it.each(['refresh', 'logout'] as const)( + 'serializes logout with refresh when %s holds the lock first', + async (firstMode) => { + await withOAuthServer(async ({ endpoint, requests, firstRequest, release }) => { + const first = startWorker(endpoint, firstMode) + const second = startWorker(endpoint, firstMode === 'refresh' ? 'logout' : 'refresh') + await Promise.all([first.ready, second.ready]) + first.run() + await firstRequest + second.run() + release() + const results = await Promise.all([first.result, second.result]) + expect(readStoredCredential('default')).toBeNull() + if (firstMode === 'refresh') { + expect(results).toEqual([{ refreshToken: 'new-refresh' }, {}]) + expect(requests).toEqual([ + '/api/auth/oauth2/token:old-refresh', + '/api/auth/oauth2/revoke:new-refresh', + ]) + } else { + expect(results[0]).toEqual({}) + expect(results[1].error).toContain('stored login changed') + expect(requests).toEqual(['/api/auth/oauth2/revoke:old-refresh']) + } + }) + }, + 15000 +) diff --git a/scripts/check-principal-kind-parity.test.ts b/scripts/check-principal-kind-parity.test.ts index 226d8bb7f93..f5945de5534 100644 --- a/scripts/check-principal-kind-parity.test.ts +++ b/scripts/check-principal-kind-parity.test.ts @@ -3,63 +3,76 @@ import { auditSource, parsePrincipalKindLiterals } from './check-principal-kind- const FILE = 'apps/sim/lib/things/application/operations.ts' -describe('principalKinds literal parsing', () => { - it('reads single-line and multi-line literals, including type-level ones', () => { - const literals = parsePrincipalKindLiterals(` - readonly principalKinds: readonly ['session', 'personal_api_key', 'oauth_access_token'] - const A = defineWorkspaceOperation({ - principalKinds: [ - 'session', - 'delegated', - ], - }) - principalKinds?: readonly ['session'] +describe('principal policy parsing', () => { + it('reads value arrays and literal tuples without reading comments', () => { + const declarations = parsePrincipalKindLiterals(` + interface Operation { + readonly principalKinds: readonly ['session', 'personal_api_key', 'oauth_access_token'] + } + const A = defineWorkspaceOperation({ principalKinds: ['session', 'delegated'] }) + // principalKinds: ['personal_api_key'] + const description = "principalKinds: ['personal_api_key']" `) - - expect(literals.map((literal) => literal.kinds)).toEqual([ + expect(declarations.map((declaration) => declaration.kinds)).toEqual([ ['session', 'personal_api_key', 'oauth_access_token'], ['session', 'delegated'], - ['session'], ]) }) -}) -describe('assertion A — the two user-credential kinds travel together', () => { - it('accepts a policy that names both, and one that names neither', () => { - const { findings, pairs } = auditSource( + it('resolves named arrays and nested spreads', () => { + const result = auditSource( FILE, ` - principalKinds: ['session', 'personal_api_key', 'oauth_access_token'], - principalKinds: ['session', 'delegated'], - ` + const PERSONAL = ['personal_api_key'] as const + const HUMAN = [...PERSONAL, 'oauth_access_token'] as const + const ALL = ['session', ...HUMAN] as const + const operation = { principalKinds: ALL } + ` ) - - expect(findings).toEqual([]) - expect(pairs).toBe(1) + expect(result).toEqual({ findings: [], pairs: 1 }) }) - it('reports a policy that admits the key but not the token', () => { - const { findings } = auditSource(FILE, "principalKinds: ['session', 'personal_api_key'],") + it('resolves frozen policies while refusing arbitrary factory calls', () => { + expect( + auditSource( + FILE, + ` + const USER_KINDS = Object.freeze(['personal_api_key', 'oauth_access_token'] as const) + const operation = { principalKinds: Object.freeze([...USER_KINDS]) } + ` + ) + ).toEqual({ findings: [], pairs: 1 }) + expect( + auditSource(FILE, 'const operation = { principalKinds: getKinds() }').findings + ).toHaveLength(1) + }) + it.each([ + ["['session', 'personal_api_key']", 'oauth_access_token'], + ["['oauth_access_token']", 'personal_api_key'], + ])('reports a missing paired kind in %s', (kinds, missing) => { + const { findings } = auditSource( + FILE, + `const KINDS = ${kinds}; const op = { principalKinds: KINDS }` + ) expect(findings).toHaveLength(1) expect(findings[0]).toMatchObject({ file: FILE, line: 1 }) - expect(findings[0].message).toContain("without 'oauth_access_token'") + expect(findings[0].message).toContain(`without '${missing}'`) }) - it('reports a policy that admits the token but not the key', () => { - const { findings } = auditSource(FILE, "principalKinds: ['oauth_access_token'],") - - expect(findings).toHaveLength(1) - expect(findings[0].message).toContain("without 'personal_api_key'") + it('accepts an operation that names neither credential kind', () => { + expect(auditSource(FILE, "const op = { principalKinds: ['session', 'delegated'] }")).toEqual({ + findings: [], + pairs: 0, + }) }) - it('does not count a spread constant as naming a bare kind', () => { - const { findings, pairs } = auditSource( - FILE, - "principalKinds: ['session', ...USER_CREDENTIAL_PRINCIPAL_KINDS]," - ) - - expect(findings).toEqual([]) - expect(pairs).toBe(0) - }) + it.each(['EXTERNAL_KINDS', "['session', ...EXTERNAL_KINDS]"])( + 'fails closed for an unresolved policy %s', + (kinds) => { + const { findings } = auditSource(FILE, `const op = { principalKinds: ${kinds} }`) + expect(findings).toHaveLength(1) + expect(findings[0].message).toContain('Cannot resolve principalKinds') + } + ) }) diff --git a/scripts/check-principal-kind-parity.ts b/scripts/check-principal-kind-parity.ts index 537a6afe097..5fc440883ec 100644 --- a/scripts/check-principal-kind-parity.ts +++ b/scripts/check-principal-kind-parity.ts @@ -1,46 +1,15 @@ #!/usr/bin/env bun /** - * Keeps `personal_api_key` and `oauth_access_token` admitted together in every - * operation policy. - * - * The two kinds are one authorization class: a person reaching the API through - * a bearer credential of their own. An OAuth access token is the personal key - * narrowed by scope and bounded by expiry, and `authorizeWorkspaceOperation` - * walks the same sequence for both. A policy that names one without the other - * is therefore never a decision — it is an operation written before the second - * kind existed, or a copy of one, and the token is refused (or admitted) by - * accident for a reason no reviewer chose. - * - * It asserts, over every `application/operations.ts` under `apps/sim/lib`: - * - * A every `principalKinds` array literal that names one of the pair names - * both. - * B at least one policy naming the pair was found. The assertions are - * source-text matches, so a refactor into a form this cannot read would - * otherwise be indistinguishable from a clean tree. - * - * ## What this audit does not cover - * - * Read this before trusting the gate: it covers less than it looks like it does. - * - * - Only array literals written directly after `principalKinds:` are read. A - * policy assembled from a named constant (`principalKinds: HUMAN_KINDS`) is - * invisible to assertion A. - * - Only `operations.ts` files under `apps/sim/lib` are scanned. Anything - * declared elsewhere is out of reach. - * - Nothing here sees a `switch (principal.kind)` or a - * `principal.kind === '...'` comparison, which is the class of site that - * actually mis-admits a principal silently, and the class this pair had to - * be threaded through by hand. - * - Assertion B proves only that *some* policy names both kinds, not that any - * particular domain does. One paired policy anywhere keeps it green. - * - * Type-level `readonly principalKinds: readonly [...]` declarations do match - * the same pattern, so a domain's operation interface is held to the rule. + * Keeps personal API keys and OAuth access tokens admitted together in semantic + * operation policies. Resolves local named arrays and spreads; an unreadable + * value policy fails the audit instead of disappearing from its coverage. + * Principal branching and declarations outside application/operations.ts still + * require application authorization tests. */ import { readdirSync, readFileSync, statSync } from 'node:fs' import { dirname, join, relative, resolve } from 'node:path' import { fileURLToPath } from 'node:url' +import ts from '@typescript/typescript6' const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..') const SCAN_ROOT = 'apps/sim/lib' @@ -65,41 +34,85 @@ function walk(directory: string, into: string[]): string[] { return into } -function lineOf(source: string, index: number): number { - return source.slice(0, index).split('\n').length +interface PrincipalKindDeclaration { + line: number + kinds: string[] + unresolved?: boolean } -/** - * Every `principalKinds` array literal in one file, with the kinds it names. - * Multi-line literals are read to their closing bracket; a literal spread from - * a constant contributes the spread's text, which never names a bare kind and - * so never trips assertion A on its own. - */ -export function parsePrincipalKindLiterals( - source: string -): Array<{ line: number; kinds: string[] }> { - const literals: Array<{ line: number; kinds: string[] }> = [] - for (const match of source.matchAll(/principalKinds\??:\s*(?:readonly\s+)?\[/g)) { - const open = match.index + match[0].length - 1 - let depth = 0 - let close = -1 - for (let index = open; index < source.length; index++) { - const char = source[index] - if (char === '[') depth++ - else if (char === ']') { - depth-- - if (depth === 0) { - close = index - break - } +/** Reads value policies and literal tuple declarations, without matching comments or strings. */ +export function parsePrincipalKindLiterals(source: string): PrincipalKindDeclaration[] { + const file = ts.createSourceFile(OPERATIONS_FILE, source, ts.ScriptTarget.Latest, true) + const constants = new Map() + const declarations: PrincipalKindDeclaration[] = [] + + function collect(node: ts.Node): void { + if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer) { + constants.set(node.name.text, node.initializer) + } + ts.forEachChild(node, collect) + } + collect(file) + + function readKinds(node: ts.Node, seen = new Set()): string[] | undefined { + if (ts.isStringLiteral(node)) return [node.text] + if (ts.isLiteralTypeNode(node)) return readKinds(node.literal, seen) + if (ts.isTypeOperatorNode(node)) return readKinds(node.type, seen) + if ( + ts.isAsExpression(node) || + ts.isSatisfiesExpression(node) || + ts.isParenthesizedExpression(node) + ) { + return readKinds(node.expression, seen) + } + if ( + ts.isCallExpression(node) && + ts.isPropertyAccessExpression(node.expression) && + ts.isIdentifier(node.expression.expression) && + node.expression.expression.text === 'Object' && + node.expression.name.text === 'freeze' && + node.arguments.length === 1 + ) { + return readKinds(node.arguments[0], seen) + } + if (ts.isIdentifier(node)) { + const initializer = constants.get(node.text) + if (!initializer || seen.has(node.text)) return undefined + return readKinds(initializer, new Set([...seen, node.text])) + } + if (ts.isSpreadElement(node)) return readKinds(node.expression, seen) + if (ts.isArrayLiteralExpression(node) || ts.isTupleTypeNode(node)) { + const kinds: string[] = [] + for (const element of node.elements) { + const resolved = readKinds(element, seen) + if (!resolved) return undefined + kinds.push(...resolved) + } + return kinds + } + return undefined + } + + function visit(node: ts.Node): void { + if ( + (ts.isPropertyAssignment(node) || ts.isPropertySignature(node)) && + node.name.getText(file).replace(/['"]/g, '') === 'principalKinds' + ) { + const value = ts.isPropertyAssignment(node) ? node.initializer : node.type + const kinds = value && readKinds(value) + /** Generic interfaces are checked at their concrete value definitions. */ + if (kinds || ts.isPropertyAssignment(node)) { + declarations.push({ + line: file.getLineAndCharacterOfPosition(node.getStart(file)).line + 1, + kinds: kinds ?? [], + ...(kinds ? {} : { unresolved: true }), + }) } } - if (close === -1) continue - const body = source.slice(open + 1, close) - const kinds = [...body.matchAll(/'([a-z_]+)'/g)].map((kind) => kind[1]) - literals.push({ line: lineOf(source, match.index), kinds }) + ts.forEachChild(node, visit) } - return literals + visit(file) + return declarations } /** One operations file's findings, so the assertion is testable without a tree on disk. */ @@ -109,6 +122,15 @@ export function auditSource(file: string, source: string): { findings: Finding[] const [personal, oauth] = USER_CREDENTIAL_PRINCIPAL_KINDS for (const literal of parsePrincipalKindLiterals(source)) { + if (literal.unresolved) { + findings.push({ + file, + line: literal.line, + message: + 'Cannot resolve principalKinds; use a literal or a local constant so credential parity is audited.', + }) + continue + } const hasPersonal = literal.kinds.includes(personal) const hasOauth = literal.kinds.includes(oauth) if (hasPersonal && hasOauth) { diff --git a/scripts/openapi/documents.test.ts b/scripts/openapi/documents.test.ts index 242d70d9ca2..bdba2062cd2 100644 --- a/scripts/openapi/documents.test.ts +++ b/scripts/openapi/documents.test.ts @@ -1,5 +1,6 @@ import { readFileSync } from 'node:fs' import path from 'node:path' +import ts from '@typescript/typescript6' import { describe, expect, it } from 'vitest' import { MAX_ID_LENGTH } from '../../apps/sim/lib/api/contracts/primitives' import { billingOpenApiDocument } from '../../apps/sim/lib/api/contracts/v2/openapi/billing' @@ -34,6 +35,78 @@ const DOCUMENTS = [ resourcesOpenApiDocument, ] as const +/** Reads route admission policy without importing its database and provider implementations. */ +async function routeApplicationOperation(routePath: string, method: string): Promise { + const sourcePath = path.resolve( + import.meta.dirname, + '../../apps/sim/app', + `.${routePath}`, + 'route.ts' + ) + const source = ts.createSourceFile( + sourcePath, + readFileSync(sourcePath, 'utf8'), + ts.ScriptTarget.Latest, + true + ) + let handler: ts.Expression | undefined + const imports = new Map() + function visit(node: ts.Node): void { + if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.name.text === method) { + handler = node.initializer + } + if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) { + const bindings = node.importClause?.namedBindings + if (bindings && ts.isNamedImports(bindings)) { + for (const item of bindings.elements) { + imports.set(item.name.text, { + module: node.moduleSpecifier.text, + name: item.propertyName?.text ?? item.name.text, + }) + } + } + } + ts.forEachChild(node, visit) + } + visit(source) + if (!handler || !ts.isCallExpression(handler)) + throw new Error(`Missing ${method} handler: ${sourcePath}`) + let operation: ts.Expression | undefined + const options = handler.arguments[0] + if (options && ts.isObjectLiteralExpression(options)) { + const property = options.properties.find( + (item) => ts.isPropertyAssignment(item) && item.name.getText(source) === 'operation' + ) + if (property && ts.isPropertyAssignment(property)) operation = property.initializer + } else { + function findAdmission(node: ts.Node): void { + if ( + ts.isCallExpression(node) && + ts.isIdentifier(node.expression) && + ['admitV2Request', 'admitOptionalV2Request'].includes(node.expression.text) + ) { + if (operation) throw new Error(`Ambiguous admission policy: ${sourcePath}`) + operation = node.arguments[1] + } + ts.forEachChild(node, findAdmission) + } + findAdmission(handler) + } + if ( + !operation || + !ts.isPropertyAccessExpression(operation) || + !ts.isIdentifier(operation.expression) + ) { + throw new Error(`Unresolved admission policy: ${sourcePath}`) + } + const imported = imports.get(operation.expression.text) + if (!imported || !imported.module.endsWith('/operations')) { + throw new Error(`Admission policy must reference its operation registry: ${sourcePath}`) + } + const registryModule = (await import(imported.module)) as Record> + return registryModule[imported.name]?.[operation.name.text] +} + const EXPECTED_OPERATION_COUNTS = new Map([ ['apps/docs/openapi-v2-workflows.json', 38], ['apps/docs/openapi-v2-logs.json', 3], @@ -173,6 +246,27 @@ function anonymousTopLevelResponseObjects(spec: JsonObject): string[] { } describe('generated OpenAPI documents', () => { + it('documents the same canonical operation and OAuth scope each route admits', async () => { + for (const document of DOCUMENTS) { + for (const route of document.routes) { + const runtimeOperation = await routeApplicationOperation( + route.contract.path, + route.contract.method + ) + expect(runtimeOperation, `${route.contract.method} ${route.contract.path}`).toBe( + route.operation.applicationOperation + ) + const generated = getOperation( + generatedDocument(document), + route.contract.path.replace(/\[([^\]]+)\]/g, '{$1}'), + route.contract.method.toLowerCase() + ) + expect(generated['x-sim-operation']).toBe(route.operation.applicationOperation.id) + expect(generated['x-oauth-scope']).toBe(route.operation.applicationOperation.oauthScope) + } + } + }) + it('keeps every description concise without padding simple fields', () => { const outliers: string[] = [] for (const document of DOCUMENTS) { diff --git a/scripts/openapi/generator.test.ts b/scripts/openapi/generator.test.ts index 14fbd811396..79fc4436373 100644 --- a/scripts/openapi/generator.test.ts +++ b/scripts/openapi/generator.test.ts @@ -61,6 +61,7 @@ function operation( ): OpenApiOperationMetadata { return { operationId, + applicationOperation: { id: operationId }, summary: `Summary for ${operationId}`, description: `Description for ${operationId}.`, tags: ['Tests'], @@ -475,6 +476,16 @@ describe('OpenAPI generator', () => { ) }) + it('rejects OAuth documentation without canonical scope policy', () => { + expect(() => + generateOpenApiDocument({ + ...document([simpleRoute()]), + security: [{ oauthBearer: [] }], + securitySchemes: { oauthBearer: { type: 'http', scheme: 'bearer' } }, + }) + ).toThrow("must declare its canonical application's OAuth scope") + }) + it('fails fast for missing Zod documentation metadata', () => { const body = z.object({ value: z.string().describe('Value.') }) const response = z diff --git a/scripts/openapi/generator.ts b/scripts/openapi/generator.ts index 93fb3bb762b..6c8fb3bb54f 100644 --- a/scripts/openapi/generator.ts +++ b/scripts/openapi/generator.ts @@ -651,7 +651,13 @@ function operationFor( return { operationId: operation.operationId, summary: operation.summary, - description: operation.description, + description: operation.applicationOperation.oauthScope + ? `${operation.description}\n\nOAuth scope: \`${operation.applicationOperation.oauthScope}\`.` + : operation.description, + 'x-sim-operation': operation.applicationOperation.id, + ...(operation.applicationOperation.oauthScope + ? { 'x-oauth-scope': operation.applicationOperation.oauthScope } + : {}), tags: [...operation.tags], ...(operation.deprecated === undefined ? {} : { deprecated: operation.deprecated }), ...(operation.security === undefined ? {} : { security: operation.security }), @@ -666,6 +672,15 @@ function validateOperationMetadata( definition: OpenApiDocumentDefinition, label: string ): void { + nonEmpty(operation.applicationOperation.id, `${label} application operation id`) + const security = operation.security ?? definition.security + if (security.some((requirement) => 'oauthBearer' in requirement)) { + invariant( + operation.applicationOperation.oauthScope === 'api:read' || + operation.applicationOperation.oauthScope === 'api:write', + `${label} must declare its canonical application's OAuth scope` + ) + } nonEmpty(operation.operationId, `${label} operationId`) nonEmpty(operation.summary, `${label} summary`) nonEmpty(operation.description, `${label} description`) From c2537887708c3b72b89be03676faa2584aa75587 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 16:26:19 -0700 Subject: [PATCH 23/31] test(cli): isolate OAuth process fixtures from credential overrides --- packages/sim-cli/src/auth/refresh.process.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/sim-cli/src/auth/refresh.process.test.ts b/packages/sim-cli/src/auth/refresh.process.test.ts index 696b1b78331..5069e8d942c 100644 --- a/packages/sim-cli/src/auth/refresh.process.test.ts +++ b/packages/sim-cli/src/auth/refresh.process.test.ts @@ -68,6 +68,8 @@ afterAll(() => rmSync(buildDir, { recursive: true, force: true })) beforeEach(() => { configDir = mkdtempSync(join(tmpdir(), 'sim-oauth-process-config-')) vi.stubEnv('SIM_CONFIG_DIR', configDir) + vi.stubEnv('SIM_CONFIG_FILE', undefined) + vi.stubEnv('SIM_CREDENTIALS_FILE', undefined) }) afterEach(() => { for (const child of children) child.kill('SIGKILL') From c10ea0b6d67634efe470e21cad64bafb9439d2ac Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 16:29:24 -0700 Subject: [PATCH 24/31] refactor(scim): move the provisioning library under ee The server side of directory provisioning lives with the other enterprise features in apps/sim/ee/scim, alongside its settings UI; contracts and the route builder stay where every surface's do. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01DGXcwsHzYGp6pUDWRtJKpz --- apps/sim/app/api/cron/scim-reconcile/route.ts | 2 +- .../[id]/members/[memberId]/route.ts | 2 +- .../organizations/[id]/scim/activity/route.ts | 2 +- .../scim/credentials/[credentialId]/route.ts | 2 +- .../[id]/scim/credentials/route.ts | 2 +- .../[id]/scim/mappings/[mappingId]/route.ts | 2 +- .../organizations/[id]/scim/mappings/route.ts | 5 +---- .../[id]/scim/reconcile/route.ts | 2 +- .../app/api/organizations/[id]/scim/route.ts | 2 +- apps/sim/app/api/scim/v2/Groups/[id]/route.ts | 8 +++---- apps/sim/app/api/scim/v2/Groups/route.ts | 8 +++---- .../api/scim/v2/ResourceTypes/[id]/route.ts | 4 ++-- .../app/api/scim/v2/ResourceTypes/route.ts | 2 +- .../sim/app/api/scim/v2/Schemas/[id]/route.ts | 4 ++-- apps/sim/app/api/scim/v2/Schemas/route.ts | 2 +- .../scim/v2/ServiceProviderConfig/route.ts | 2 +- apps/sim/app/api/scim/v2/Users/[id]/route.ts | 12 +++++----- apps/sim/app/api/scim/v2/Users/route.ts | 12 +++++----- apps/sim/ee/README.md | 3 ++- .../scim/application/admin/connection-view.ts | 4 ++-- .../scim/application/admin/connection.ts | 8 +++---- .../scim/application/admin/credentials.ts | 10 ++++----- .../scim/application/admin/mappings.ts | 8 +++---- .../sim/{lib => ee}/scim/application/audit.ts | 0 .../authorized-scim-admin-use-case.ts | 6 ++--- .../application/authorized-scim-use-case.ts | 8 +++---- .../scim/application/groups/manage-groups.ts | 22 +++++++++---------- .../scim/application/operations.ts | 0 .../users/deprovision-user.test.ts | 12 +++++----- .../application/users/deprovision-user.ts | 10 ++++----- .../scim/application/users/provision-user.ts | 20 ++++++++--------- .../scim/application/users/read-users.ts | 12 +++++----- .../application/users/update-user.test.ts | 14 ++++++------ .../scim/application/users/update-user.ts | 22 +++++++++---------- .../sim/{lib => ee}/scim/authenticate.test.ts | 6 ++--- apps/sim/{lib => ee}/scim/authenticate.ts | 4 ++-- apps/sim/{lib => ee}/scim/base-url.ts | 2 +- apps/sim/{lib => ee}/scim/entitlement.test.ts | 2 +- apps/sim/{lib => ee}/scim/entitlement.ts | 0 .../scim/identity/account-identity.ts | 2 +- .../scim/identity/end-directory-membership.ts | 0 .../scim/identity/resolve-user.test.ts | 4 ++-- .../{lib => ee}/scim/identity/resolve-user.ts | 4 ++-- .../{lib => ee}/scim/managed-membership.ts | 0 .../scim/projection/auto-map.test.ts | 2 +- .../{lib => ee}/scim/projection/auto-map.ts | 0 .../scim/projection/grants.test.ts | 2 +- .../sim/{lib => ee}/scim/projection/grants.ts | 0 .../scim/projection/reconcile-user.test.ts | 2 +- .../scim/projection/reconcile-user.ts | 16 +++++++------- .../scim/protocol/canonical.test.ts | 8 +++---- .../{lib => ee}/scim/protocol/canonical.ts | 6 ++--- .../{lib => ee}/scim/protocol/constants.ts | 0 .../{lib => ee}/scim/protocol/discovery.ts | 2 +- apps/sim/{lib => ee}/scim/protocol/errors.ts | 2 +- .../{lib => ee}/scim/protocol/filter.test.ts | 4 ++-- apps/sim/{lib => ee}/scim/protocol/filter.ts | 6 ++--- .../scim/protocol/group-patch.test.ts | 6 ++--- .../{lib => ee}/scim/protocol/group-patch.ts | 6 ++--- .../{lib => ee}/scim/protocol/normalize.ts | 0 .../scim/protocol/resources.test.ts | 6 ++--- .../{lib => ee}/scim/protocol/resources.ts | 4 ++-- .../scim/protocol/user-patch.test.ts | 4 ++-- .../{lib => ee}/scim/protocol/user-patch.ts | 4 ++-- apps/sim/{lib => ee}/scim/reconcile/job.ts | 8 +++---- .../scim/repository/credentials.ts | 0 .../sim/{lib => ee}/scim/repository/groups.ts | 4 ++-- apps/sim/{lib => ee}/scim/repository/users.ts | 6 ++--- apps/sim/{lib => ee}/scim/request-log.ts | 4 ++-- apps/sim/{lib => ee}/scim/route.ts | 6 ++--- apps/sim/lib/api/contracts/scim.ts | 4 ++-- .../lib/api/server/routes/scim-route.test.ts | 6 ++--- apps/sim/lib/api/server/routes/scim-route.ts | 10 ++++----- .../lib/billing/organizations/membership.ts | 2 +- apps/sim/lib/core/application/operation.ts | 2 +- apps/sim/lib/invitations/direct-grant.ts | 2 +- .../lib/invitations/workspace-invitations.ts | 5 +---- scripts/check-api-validation-contracts.ts | 2 +- 78 files changed, 197 insertions(+), 202 deletions(-) rename apps/sim/{lib => ee}/scim/application/admin/connection-view.ts (96%) rename apps/sim/{lib => ee}/scim/application/admin/connection.ts (96%) rename apps/sim/{lib => ee}/scim/application/admin/credentials.ts (92%) rename apps/sim/{lib => ee}/scim/application/admin/mappings.ts (97%) rename apps/sim/{lib => ee}/scim/application/audit.ts (100%) rename apps/sim/{lib => ee}/scim/application/authorized-scim-admin-use-case.ts (93%) rename apps/sim/{lib => ee}/scim/application/authorized-scim-use-case.ts (95%) rename apps/sim/{lib => ee}/scim/application/groups/manage-groups.ts (96%) rename apps/sim/{lib => ee}/scim/application/operations.ts (100%) rename apps/sim/{lib => ee}/scim/application/users/deprovision-user.test.ts (92%) rename apps/sim/{lib => ee}/scim/application/users/deprovision-user.ts (92%) rename apps/sim/{lib => ee}/scim/application/users/provision-user.ts (95%) rename apps/sim/{lib => ee}/scim/application/users/read-users.ts (89%) rename apps/sim/{lib => ee}/scim/application/users/update-user.test.ts (94%) rename apps/sim/{lib => ee}/scim/application/users/update-user.ts (93%) rename apps/sim/{lib => ee}/scim/authenticate.test.ts (96%) rename apps/sim/{lib => ee}/scim/authenticate.ts (97%) rename apps/sim/{lib => ee}/scim/base-url.ts (80%) rename apps/sim/{lib => ee}/scim/entitlement.test.ts (95%) rename apps/sim/{lib => ee}/scim/entitlement.ts (100%) rename apps/sim/{lib => ee}/scim/identity/account-identity.ts (95%) rename apps/sim/{lib => ee}/scim/identity/end-directory-membership.ts (100%) rename apps/sim/{lib => ee}/scim/identity/resolve-user.test.ts (98%) rename apps/sim/{lib => ee}/scim/identity/resolve-user.ts (98%) rename apps/sim/{lib => ee}/scim/managed-membership.ts (100%) rename apps/sim/{lib => ee}/scim/projection/auto-map.test.ts (97%) rename apps/sim/{lib => ee}/scim/projection/auto-map.ts (100%) rename apps/sim/{lib => ee}/scim/projection/grants.test.ts (99%) rename apps/sim/{lib => ee}/scim/projection/grants.ts (100%) rename apps/sim/{lib => ee}/scim/projection/reconcile-user.test.ts (99%) rename apps/sim/{lib => ee}/scim/projection/reconcile-user.ts (99%) rename apps/sim/{lib => ee}/scim/protocol/canonical.test.ts (95%) rename apps/sim/{lib => ee}/scim/protocol/canonical.ts (97%) rename apps/sim/{lib => ee}/scim/protocol/constants.ts (100%) rename apps/sim/{lib => ee}/scim/protocol/discovery.ts (99%) rename apps/sim/{lib => ee}/scim/protocol/errors.ts (98%) rename apps/sim/{lib => ee}/scim/protocol/filter.test.ts (96%) rename apps/sim/{lib => ee}/scim/protocol/filter.ts (97%) rename apps/sim/{lib => ee}/scim/protocol/group-patch.test.ts (95%) rename apps/sim/{lib => ee}/scim/protocol/group-patch.ts (97%) rename apps/sim/{lib => ee}/scim/protocol/normalize.ts (100%) rename apps/sim/{lib => ee}/scim/protocol/resources.test.ts (96%) rename apps/sim/{lib => ee}/scim/protocol/resources.ts (98%) rename apps/sim/{lib => ee}/scim/protocol/user-patch.test.ts (98%) rename apps/sim/{lib => ee}/scim/protocol/user-patch.ts (99%) rename apps/sim/{lib => ee}/scim/reconcile/job.ts (96%) rename apps/sim/{lib => ee}/scim/repository/credentials.ts (100%) rename apps/sim/{lib => ee}/scim/repository/groups.ts (98%) rename apps/sim/{lib => ee}/scim/repository/users.ts (97%) rename apps/sim/{lib => ee}/scim/request-log.ts (94%) rename apps/sim/{lib => ee}/scim/route.ts (74%) diff --git a/apps/sim/app/api/cron/scim-reconcile/route.ts b/apps/sim/app/api/cron/scim-reconcile/route.ts index 9bf22f966ca..e2be4773673 100644 --- a/apps/sim/app/api/cron/scim-reconcile/route.ts +++ b/apps/sim/app/api/cron/scim-reconcile/route.ts @@ -4,7 +4,7 @@ import { type NextRequest, NextResponse } from 'next/server' import { verifyCronAuth } from '@/lib/auth/internal' import { isScimEnabled } from '@/lib/core/config/env-flags' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' -import { runScimReconcileSweep } from '@/lib/scim/reconcile/job' +import { runScimReconcileSweep } from '@/ee/scim/reconcile/job' const logger = createLogger('CronScimReconcile') diff --git a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts index ca83e2a2869..25694542b51 100644 --- a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts @@ -23,7 +23,7 @@ import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { isRetryableTransactionError } from '@/lib/db/transaction' import { changeMemberRoleTx } from '@/lib/organizations/members/lifecycle' import { captureServerEvent } from '@/lib/posthog/server' -import { assertMembershipNotScimManaged } from '@/lib/scim/managed-membership' +import { assertMembershipNotScimManaged } from '@/ee/scim/managed-membership' const logger = createLogger('OrganizationMemberAPI') diff --git a/apps/sim/app/api/organizations/[id]/scim/activity/route.ts b/apps/sim/app/api/organizations/[id]/scim/activity/route.ts index b1f8d921c63..28f8298814a 100644 --- a/apps/sim/app/api/organizations/[id]/scim/activity/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/activity/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { listScimActivity } from '@/lib/scim/application/admin/connection' +import { listScimActivity } from '@/ee/scim/application/admin/connection' /** Recent provisioning requests, so a failing sync can be diagnosed from Sim. */ export const GET = defineInternalJsonRoute({ diff --git a/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts b/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts index 99891256ad2..5008523fcf8 100644 --- a/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { revokeScimCredential } from '@/lib/scim/application/admin/credentials' +import { revokeScimCredential } from '@/ee/scim/application/admin/credentials' export const DELETE = defineInternalJsonRoute({ contract: revokeScimCredentialContract, diff --git a/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts b/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts index a657a2c0e8b..fd4953e828f 100644 --- a/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { issueScimCredential } from '@/lib/scim/application/admin/credentials' +import { issueScimCredential } from '@/ee/scim/application/admin/credentials' /** Issues a bearer credential. The secret is returned once and never stored. */ export const POST = defineInternalJsonRoute({ diff --git a/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts b/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts index 82d05391030..46ab2653214 100644 --- a/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { deleteScimGroupMapping } from '@/lib/scim/application/admin/mappings' +import { deleteScimGroupMapping } from '@/ee/scim/application/admin/mappings' export const DELETE = defineInternalJsonRoute({ contract: deleteScimGroupMappingContract, diff --git a/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts b/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts index 1ad9e7dcd3f..5c078a71783 100644 --- a/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts @@ -8,10 +8,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { - listScimGroupMappings, - upsertScimGroupMapping, -} from '@/lib/scim/application/admin/mappings' +import { listScimGroupMappings, upsertScimGroupMapping } from '@/ee/scim/application/admin/mappings' /** What each directory group means inside Sim. */ diff --git a/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts b/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts index 109821c987a..3983550039a 100644 --- a/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { reconcileScimConnection } from '@/lib/scim/application/admin/connection' +import { reconcileScimConnection } from '@/ee/scim/application/admin/connection' /** * Re-applies every group mapping to every provisioned user. diff --git a/apps/sim/app/api/organizations/[id]/scim/route.ts b/apps/sim/app/api/organizations/[id]/scim/route.ts index 29c03797f13..1a9cf443d9e 100644 --- a/apps/sim/app/api/organizations/[id]/scim/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/route.ts @@ -8,7 +8,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { configureScimConnection, getScimConnection } from '@/lib/scim/application/admin/connection' +import { configureScimConnection, getScimConnection } from '@/ee/scim/application/admin/connection' /** * The organization's directory-provisioning connection. diff --git a/apps/sim/app/api/scim/v2/Groups/[id]/route.ts b/apps/sim/app/api/scim/v2/Groups/[id]/route.ts index e65c4b995a3..65f75eca337 100644 --- a/apps/sim/app/api/scim/v2/Groups/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Groups/[id]/route.ts @@ -9,10 +9,10 @@ import { getScimGroup, patchScimGroup, replaceScimGroup, -} from '@/lib/scim/application/groups/manage-groups' -import { assertGroupSchemas, toCanonicalGroup } from '@/lib/scim/protocol/canonical' -import { parseAttributeProjection } from '@/lib/scim/protocol/resources' -import { defineScimRoute } from '@/lib/scim/route' +} from '@/ee/scim/application/groups/manage-groups' +import { assertGroupSchemas, toCanonicalGroup } from '@/ee/scim/protocol/canonical' +import { parseAttributeProjection } from '@/ee/scim/protocol/resources' +import { defineScimRoute } from '@/ee/scim/route' /** One Group resource. */ diff --git a/apps/sim/app/api/scim/v2/Groups/route.ts b/apps/sim/app/api/scim/v2/Groups/route.ts index a6444bd3107..b95eca65dbf 100644 --- a/apps/sim/app/api/scim/v2/Groups/route.ts +++ b/apps/sim/app/api/scim/v2/Groups/route.ts @@ -1,8 +1,8 @@ import { createScimGroupContract, listScimGroupsContract } from '@/lib/api/contracts/scim' -import { createScimGroup, listScimGroups } from '@/lib/scim/application/groups/manage-groups' -import { assertGroupSchemas, toCanonicalGroup } from '@/lib/scim/protocol/canonical' -import { parseAttributeProjection, toListResponse } from '@/lib/scim/protocol/resources' -import { defineScimRoute } from '@/lib/scim/route' +import { createScimGroup, listScimGroups } from '@/ee/scim/application/groups/manage-groups' +import { assertGroupSchemas, toCanonicalGroup } from '@/ee/scim/protocol/canonical' +import { parseAttributeProjection, toListResponse } from '@/ee/scim/protocol/resources' +import { defineScimRoute } from '@/ee/scim/route' /** The Group collection. */ diff --git a/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts b/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts index 5e850070d25..d66ed63bad2 100644 --- a/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts @@ -1,6 +1,6 @@ import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' -import { resourceTypes } from '@/lib/scim/protocol/discovery' -import { notFound } from '@/lib/scim/protocol/errors' +import { resourceTypes } from '@/ee/scim/protocol/discovery' +import { notFound } from '@/ee/scim/protocol/errors' export const GET = defineScimDiscoveryRoute((baseUrl, params) => { const id = typeof params.id === 'string' ? params.id : '' diff --git a/apps/sim/app/api/scim/v2/ResourceTypes/route.ts b/apps/sim/app/api/scim/v2/ResourceTypes/route.ts index 84369557f30..13f599e66f0 100644 --- a/apps/sim/app/api/scim/v2/ResourceTypes/route.ts +++ b/apps/sim/app/api/scim/v2/ResourceTypes/route.ts @@ -1,4 +1,4 @@ import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' -import { discoveryList, resourceTypes } from '@/lib/scim/protocol/discovery' +import { discoveryList, resourceTypes } from '@/ee/scim/protocol/discovery' export const GET = defineScimDiscoveryRoute((baseUrl) => discoveryList(resourceTypes(baseUrl))) diff --git a/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts b/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts index 5798a16d512..431f7aa4aa1 100644 --- a/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts @@ -1,6 +1,6 @@ import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' -import { schemaDefinitions } from '@/lib/scim/protocol/discovery' -import { notFound } from '@/lib/scim/protocol/errors' +import { schemaDefinitions } from '@/ee/scim/protocol/discovery' +import { notFound } from '@/ee/scim/protocol/errors' export const GET = defineScimDiscoveryRoute((baseUrl, params) => { const id = typeof params.id === 'string' ? decodeURIComponent(params.id) : '' diff --git a/apps/sim/app/api/scim/v2/Schemas/route.ts b/apps/sim/app/api/scim/v2/Schemas/route.ts index c7206040187..92225bc4080 100644 --- a/apps/sim/app/api/scim/v2/Schemas/route.ts +++ b/apps/sim/app/api/scim/v2/Schemas/route.ts @@ -1,4 +1,4 @@ import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' -import { discoveryList, schemaDefinitions } from '@/lib/scim/protocol/discovery' +import { discoveryList, schemaDefinitions } from '@/ee/scim/protocol/discovery' export const GET = defineScimDiscoveryRoute((baseUrl) => discoveryList(schemaDefinitions(baseUrl))) diff --git a/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts b/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts index c1e565837d9..89cdc3bc5d9 100644 --- a/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts +++ b/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts @@ -1,5 +1,5 @@ import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' -import { serviceProviderConfig } from '@/lib/scim/protocol/discovery' +import { serviceProviderConfig } from '@/ee/scim/protocol/discovery' /** Unauthenticated by design: a provider negotiates before it holds a credential. */ export const GET = defineScimDiscoveryRoute((baseUrl) => serviceProviderConfig(baseUrl)) diff --git a/apps/sim/app/api/scim/v2/Users/[id]/route.ts b/apps/sim/app/api/scim/v2/Users/[id]/route.ts index 3b11be0b6b2..5549a60224f 100644 --- a/apps/sim/app/api/scim/v2/Users/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Users/[id]/route.ts @@ -4,12 +4,12 @@ import { patchScimUserContract, replaceScimUserContract, } from '@/lib/api/contracts/scim' -import { deprovisionScimUser } from '@/lib/scim/application/users/deprovision-user' -import { getScimUser } from '@/lib/scim/application/users/read-users' -import { patchScimUser, replaceScimUser } from '@/lib/scim/application/users/update-user' -import { assertUserSchemas, toCanonicalUser } from '@/lib/scim/protocol/canonical' -import { parseAttributeProjection } from '@/lib/scim/protocol/resources' -import { defineScimRoute } from '@/lib/scim/route' +import { deprovisionScimUser } from '@/ee/scim/application/users/deprovision-user' +import { getScimUser } from '@/ee/scim/application/users/read-users' +import { patchScimUser, replaceScimUser } from '@/ee/scim/application/users/update-user' +import { assertUserSchemas, toCanonicalUser } from '@/ee/scim/protocol/canonical' +import { parseAttributeProjection } from '@/ee/scim/protocol/resources' +import { defineScimRoute } from '@/ee/scim/route' /** One User resource. */ diff --git a/apps/sim/app/api/scim/v2/Users/route.ts b/apps/sim/app/api/scim/v2/Users/route.ts index c8c1c6367bf..5f3593a1383 100644 --- a/apps/sim/app/api/scim/v2/Users/route.ts +++ b/apps/sim/app/api/scim/v2/Users/route.ts @@ -1,16 +1,16 @@ import { createScimUserContract, listScimUsersContract } from '@/lib/api/contracts/scim' -import { provisionScimUser } from '@/lib/scim/application/users/provision-user' -import { listScimUsers } from '@/lib/scim/application/users/read-users' -import { assertUserSchemas, toCanonicalUser } from '@/lib/scim/protocol/canonical' -import { parseAttributeProjection, toListResponse } from '@/lib/scim/protocol/resources' -import { defineScimRoute } from '@/lib/scim/route' +import { provisionScimUser } from '@/ee/scim/application/users/provision-user' +import { listScimUsers } from '@/ee/scim/application/users/read-users' +import { assertUserSchemas, toCanonicalUser } from '@/ee/scim/protocol/canonical' +import { parseAttributeProjection, toListResponse } from '@/ee/scim/protocol/resources' +import { defineScimRoute } from '@/ee/scim/route' /** * The User collection. * * Adapters only: authentication, rate policy, contract parsing, and rendering * live in the route builder, and every decision about identity, membership, and - * access lives in `lib/scim/application`. + * access lives in `ee/scim/application`. */ export const GET = defineScimRoute({ diff --git a/apps/sim/ee/README.md b/apps/sim/ee/README.md index f0377161e5e..666bd8d5b1b 100644 --- a/apps/sim/ee/README.md +++ b/apps/sim/ee/README.md @@ -8,6 +8,7 @@ for production use. - **SSO (Single Sign-On)**: OIDC and SAML authentication integration - **Access Control**: Permission groups for fine-grained user access management - **Whitelabeling**: Custom branding and theming for enterprise deployments +- **Directory provisioning (SCIM)**: SCIM 2.0 user and group provisioning from Okta, Microsoft Entra, and other identity providers, with group-to-access mapping ## Licensing @@ -18,4 +19,4 @@ Production deployment requires an active Enterprise subscription. Enterprise features are imported directly throughout the codebase. The `ee/` directory is required at build time. Feature visibility is controlled at runtime via environment -variables (e.g., `NEXT_PUBLIC_ACCESS_CONTROL_ENABLED`, `NEXT_PUBLIC_SSO_ENABLED`). +variables (e.g., `NEXT_PUBLIC_ACCESS_CONTROL_ENABLED`, `NEXT_PUBLIC_SSO_ENABLED`, `NEXT_PUBLIC_SCIM_ENABLED`). diff --git a/apps/sim/lib/scim/application/admin/connection-view.ts b/apps/sim/ee/scim/application/admin/connection-view.ts similarity index 96% rename from apps/sim/lib/scim/application/admin/connection-view.ts rename to apps/sim/ee/scim/application/admin/connection-view.ts index eda2f6fd19d..155f14f8e91 100644 --- a/apps/sim/lib/scim/application/admin/connection-view.ts +++ b/apps/sim/ee/scim/application/admin/connection-view.ts @@ -11,8 +11,8 @@ import { import { and, count, desc, eq } from 'drizzle-orm' import type { ScimConnectionView, ScimCredentialView } from '@/lib/api/contracts/organization-scim' import { OrchestrationError } from '@/lib/core/orchestration/types' -import { scimBaseUrl } from '@/lib/scim/base-url' -import { activeCredentialCondition } from '@/lib/scim/repository/credentials' +import { scimBaseUrl } from '@/ee/scim/base-url' +import { activeCredentialCondition } from '@/ee/scim/repository/credentials' /** Reads shared by the admin use cases: the connection row and its settings view. */ diff --git a/apps/sim/lib/scim/application/admin/connection.ts b/apps/sim/ee/scim/application/admin/connection.ts similarity index 96% rename from apps/sim/lib/scim/application/admin/connection.ts rename to apps/sim/ee/scim/application/admin/connection.ts index 27eb89a0ce2..460af6ca6be 100644 --- a/apps/sim/lib/scim/application/admin/connection.ts +++ b/apps/sim/ee/scim/application/admin/connection.ts @@ -10,13 +10,13 @@ import { assertWorkspaceInOrganization, loadConnectionView, requireConnection, -} from '@/lib/scim/application/admin/connection-view' +} from '@/ee/scim/application/admin/connection-view' import { defineAuthorizedScimAdminUseCase, type ScimAdminUseCaseArgs, -} from '@/lib/scim/application/authorized-scim-admin-use-case' -import { scimAdminOperations } from '@/lib/scim/application/operations' -import { reconcileConnection } from '@/lib/scim/reconcile/job' +} from '@/ee/scim/application/authorized-scim-admin-use-case' +import { scimAdminOperations } from '@/ee/scim/application/operations' +import { reconcileConnection } from '@/ee/scim/reconcile/job' /** The connection itself: reading it, enabling and configuring it, and running a drift pass. */ diff --git a/apps/sim/lib/scim/application/admin/credentials.ts b/apps/sim/ee/scim/application/admin/credentials.ts similarity index 92% rename from apps/sim/lib/scim/application/admin/credentials.ts rename to apps/sim/ee/scim/application/admin/credentials.ts index 09a2dc4c0ef..e0c50d1c55c 100644 --- a/apps/sim/lib/scim/application/admin/credentials.ts +++ b/apps/sim/ee/scim/application/admin/credentials.ts @@ -5,14 +5,14 @@ import { generateId } from '@sim/utils/id' import { and, count, eq, isNull, sql } from 'drizzle-orm' import { acquireOrganizationMutationLock } from '@/lib/billing/organizations/membership' import { OrchestrationError } from '@/lib/core/orchestration/types' -import { requireConnection, toCredentialView } from '@/lib/scim/application/admin/connection-view' +import { requireConnection, toCredentialView } from '@/ee/scim/application/admin/connection-view' import { defineAuthorizedScimAdminUseCase, type ScimAdminUseCaseArgs, -} from '@/lib/scim/application/authorized-scim-admin-use-case' -import { scimAdminOperations } from '@/lib/scim/application/operations' -import { generateScimToken } from '@/lib/scim/authenticate' -import { activeCredentialCondition } from '@/lib/scim/repository/credentials' +} from '@/ee/scim/application/authorized-scim-admin-use-case' +import { scimAdminOperations } from '@/ee/scim/application/operations' +import { generateScimToken } from '@/ee/scim/authenticate' +import { activeCredentialCondition } from '@/ee/scim/repository/credentials' /** * Issuing and revoking the bearer credentials a directory authenticates with. diff --git a/apps/sim/lib/scim/application/admin/mappings.ts b/apps/sim/ee/scim/application/admin/mappings.ts similarity index 97% rename from apps/sim/lib/scim/application/admin/mappings.ts rename to apps/sim/ee/scim/application/admin/mappings.ts index e26f9a8bae8..b55d64913ed 100644 --- a/apps/sim/lib/scim/application/admin/mappings.ts +++ b/apps/sim/ee/scim/application/admin/mappings.ts @@ -18,13 +18,13 @@ import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' import { assertWorkspaceInOrganization, requireConnection, -} from '@/lib/scim/application/admin/connection-view' +} from '@/ee/scim/application/admin/connection-view' import { defineAuthorizedScimAdminUseCase, type ScimAdminUseCaseArgs, -} from '@/lib/scim/application/authorized-scim-admin-use-case' -import { scimAdminOperations } from '@/lib/scim/application/operations' -import { reconcileUsersProjectionInBatches } from '@/lib/scim/projection/reconcile-user' +} from '@/ee/scim/application/authorized-scim-admin-use-case' +import { scimAdminOperations } from '@/ee/scim/application/operations' +import { reconcileUsersProjectionInBatches } from '@/ee/scim/projection/reconcile-user' /** * Mapping directory groups onto Sim access. diff --git a/apps/sim/lib/scim/application/audit.ts b/apps/sim/ee/scim/application/audit.ts similarity index 100% rename from apps/sim/lib/scim/application/audit.ts rename to apps/sim/ee/scim/application/audit.ts diff --git a/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts b/apps/sim/ee/scim/application/authorized-scim-admin-use-case.ts similarity index 93% rename from apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts rename to apps/sim/ee/scim/application/authorized-scim-admin-use-case.ts index 7baf0615fe4..6bb4e52d3b9 100644 --- a/apps/sim/lib/scim/application/authorized-scim-admin-use-case.ts +++ b/apps/sim/ee/scim/application/authorized-scim-admin-use-case.ts @@ -4,9 +4,9 @@ import { member } from '@sim/db/schema' import { and, eq } from 'drizzle-orm' import { ForbiddenOperationError, type OperationUseCase } from '@/lib/core/application' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' -import { recordScimAuditEntries, type ScimAuditEntry } from '@/lib/scim/application/audit' -import type { ScimAdminOperation, ScimAdminPrincipal } from '@/lib/scim/application/operations' -import { isScimEntitledForOrganization } from '@/lib/scim/entitlement' +import { recordScimAuditEntries, type ScimAuditEntry } from '@/ee/scim/application/audit' +import type { ScimAdminOperation, ScimAdminPrincipal } from '@/ee/scim/application/operations' +import { isScimEntitledForOrganization } from '@/ee/scim/entitlement' /** * The authorized wrapper for administering a connection from the settings UI. diff --git a/apps/sim/lib/scim/application/authorized-scim-use-case.ts b/apps/sim/ee/scim/application/authorized-scim-use-case.ts similarity index 95% rename from apps/sim/lib/scim/application/authorized-scim-use-case.ts rename to apps/sim/ee/scim/application/authorized-scim-use-case.ts index f427f597c22..9c5ea5e82b3 100644 --- a/apps/sim/lib/scim/application/authorized-scim-use-case.ts +++ b/apps/sim/ee/scim/application/authorized-scim-use-case.ts @@ -5,10 +5,10 @@ import { type ScimConnectionSettings, scimConnection } from '@sim/db/schema' import { eq } from 'drizzle-orm' import type { OperationUseCase } from '@/lib/core/application' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' -import { recordScimAuditEntries, type ScimAuditEntry } from '@/lib/scim/application/audit' -import type { ScimOperation, ScimPrincipal } from '@/lib/scim/application/operations' -import { scimBaseUrl } from '@/lib/scim/base-url' -import { ScimError } from '@/lib/scim/protocol/errors' +import { recordScimAuditEntries, type ScimAuditEntry } from '@/ee/scim/application/audit' +import type { ScimOperation, ScimPrincipal } from '@/ee/scim/application/operations' +import { scimBaseUrl } from '@/ee/scim/base-url' +import { ScimError } from '@/ee/scim/protocol/errors' /** * The authorized wrapper every directory operation runs inside. diff --git a/apps/sim/lib/scim/application/groups/manage-groups.ts b/apps/sim/ee/scim/application/groups/manage-groups.ts similarity index 96% rename from apps/sim/lib/scim/application/groups/manage-groups.ts rename to apps/sim/ee/scim/application/groups/manage-groups.ts index 1d9228a6f5e..941e4bad6be 100644 --- a/apps/sim/lib/scim/application/groups/manage-groups.ts +++ b/apps/sim/ee/scim/application/groups/manage-groups.ts @@ -9,15 +9,15 @@ import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, type ScimUseCaseContext, -} from '@/lib/scim/application/authorized-scim-use-case' -import { scimOperations } from '@/lib/scim/application/operations' -import { autoMapPermissionGroupByName } from '@/lib/scim/projection/auto-map' -import { reconcileUsersProjection } from '@/lib/scim/projection/reconcile-user' -import type { CanonicalScimGroup } from '@/lib/scim/protocol/canonical' -import { SCIM_MAX_GROUP_MEMBERS } from '@/lib/scim/protocol/constants' -import { invalidValue, notFound, ScimError, uniqueness } from '@/lib/scim/protocol/errors' -import { parseGroupFilter } from '@/lib/scim/protocol/filter' -import { parseGroupPatch } from '@/lib/scim/protocol/group-patch' +} from '@/ee/scim/application/authorized-scim-use-case' +import { scimOperations } from '@/ee/scim/application/operations' +import { autoMapPermissionGroupByName } from '@/ee/scim/projection/auto-map' +import { reconcileUsersProjection } from '@/ee/scim/projection/reconcile-user' +import type { CanonicalScimGroup } from '@/ee/scim/protocol/canonical' +import { SCIM_MAX_GROUP_MEMBERS } from '@/ee/scim/protocol/constants' +import { invalidValue, notFound, ScimError, uniqueness } from '@/ee/scim/protocol/errors' +import { parseGroupFilter } from '@/ee/scim/protocol/filter' +import { parseGroupPatch } from '@/ee/scim/protocol/group-patch' import { projectionWants, projectResource, @@ -25,7 +25,7 @@ import { type ScimAttributeProjection, type ScimGroupResource, toGroupResource, -} from '@/lib/scim/protocol/resources' +} from '@/ee/scim/protocol/resources' import { addGroupMember, countGroupMembers, @@ -40,7 +40,7 @@ import { removeGroupMember, touchScimGroup, updateScimGroup, -} from '@/lib/scim/repository/groups' +} from '@/ee/scim/repository/groups' /** Reads and writes of the Group resource, and the projection each change triggers. */ diff --git a/apps/sim/lib/scim/application/operations.ts b/apps/sim/ee/scim/application/operations.ts similarity index 100% rename from apps/sim/lib/scim/application/operations.ts rename to apps/sim/ee/scim/application/operations.ts diff --git a/apps/sim/lib/scim/application/users/deprovision-user.test.ts b/apps/sim/ee/scim/application/users/deprovision-user.test.ts similarity index 92% rename from apps/sim/lib/scim/application/users/deprovision-user.test.ts rename to apps/sim/ee/scim/application/users/deprovision-user.test.ts index 48927b9c387..26760b66af8 100644 --- a/apps/sim/lib/scim/application/users/deprovision-user.test.ts +++ b/apps/sim/ee/scim/application/users/deprovision-user.test.ts @@ -20,20 +20,20 @@ vi.mock('@/lib/billing/organizations/membership', () => ({ vi.mock('@/lib/billing/organizations/seats', () => ({ reconcileOrganizationSeats: mocks.reconcileSeats, })) -vi.mock('@/lib/scim/identity/end-directory-membership', () => ({ +vi.mock('@/ee/scim/identity/end-directory-membership', () => ({ endDirectoryMembershipTx: mocks.endDirectoryMembership, })) -vi.mock('@/lib/scim/repository/users', () => ({ +vi.mock('@/ee/scim/repository/users', () => ({ findScimUserById: mocks.findScimUserById, })) -vi.mock('@/lib/scim/application/audit', () => ({ +vi.mock('@/ee/scim/application/audit', () => ({ recordScimAuditEntries: mocks.recordAudit, })) -vi.mock('@/lib/scim/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) +vi.mock('@/ee/scim/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) import type { Principal } from '@sim/auth/principal' -import { deprovisionScimUser } from '@/lib/scim/application/users/deprovision-user' -import { ScimError } from '@/lib/scim/protocol/errors' +import { deprovisionScimUser } from '@/ee/scim/application/users/deprovision-user' +import { ScimError } from '@/ee/scim/protocol/errors' const principal: Principal = { kind: 'scim_connection', diff --git a/apps/sim/lib/scim/application/users/deprovision-user.ts b/apps/sim/ee/scim/application/users/deprovision-user.ts similarity index 92% rename from apps/sim/lib/scim/application/users/deprovision-user.ts rename to apps/sim/ee/scim/application/users/deprovision-user.ts index 8b5f225b223..d2192d03565 100644 --- a/apps/sim/lib/scim/application/users/deprovision-user.ts +++ b/apps/sim/ee/scim/application/users/deprovision-user.ts @@ -8,11 +8,11 @@ import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, -} from '@/lib/scim/application/authorized-scim-use-case' -import { scimOperations } from '@/lib/scim/application/operations' -import { endDirectoryMembershipTx } from '@/lib/scim/identity/end-directory-membership' -import { notFound, ScimError } from '@/lib/scim/protocol/errors' -import { findScimUserById } from '@/lib/scim/repository/users' +} from '@/ee/scim/application/authorized-scim-use-case' +import { scimOperations } from '@/ee/scim/application/operations' +import { endDirectoryMembershipTx } from '@/ee/scim/identity/end-directory-membership' +import { notFound, ScimError } from '@/ee/scim/protocol/errors' +import { findScimUserById } from '@/ee/scim/repository/users' const logger = createLogger('ScimDeprovisionUser') diff --git a/apps/sim/lib/scim/application/users/provision-user.ts b/apps/sim/ee/scim/application/users/provision-user.ts similarity index 95% rename from apps/sim/lib/scim/application/users/provision-user.ts rename to apps/sim/ee/scim/application/users/provision-user.ts index e21ea01af84..8eaa248c246 100644 --- a/apps/sim/lib/scim/application/users/provision-user.ts +++ b/apps/sim/ee/scim/application/users/provision-user.ts @@ -16,29 +16,29 @@ import { import { suspendMemberTx, unsuspendMemberTx } from '@/lib/organizations/members/lifecycle' import { invalidateAfterSessionRevocation } from '@/lib/organizations/members/revocation' import { captureServerEvent } from '@/lib/posthog/server' +import { deleteUserAccount } from '@/lib/users/account-deletion' import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, -} from '@/lib/scim/application/authorized-scim-use-case' -import { scimOperations } from '@/lib/scim/application/operations' -import { syncAccountIdentityTx } from '@/lib/scim/identity/account-identity' +} from '@/ee/scim/application/authorized-scim-use-case' +import { scimOperations } from '@/ee/scim/application/operations' +import { syncAccountIdentityTx } from '@/ee/scim/identity/account-identity' import { assertEmailAvailable, consumeTombstone, resolveProvisionedIdentity, -} from '@/lib/scim/identity/resolve-user' -import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' -import { primaryEmail } from '@/lib/scim/protocol/canonical' -import { ScimError, uniqueness } from '@/lib/scim/protocol/errors' -import { toUserResource } from '@/lib/scim/protocol/resources' +} from '@/ee/scim/identity/resolve-user' +import { reconcileUserProjection } from '@/ee/scim/projection/reconcile-user' +import { primaryEmail } from '@/ee/scim/protocol/canonical' +import { ScimError, uniqueness } from '@/ee/scim/protocol/errors' +import { toUserResource } from '@/ee/scim/protocol/resources' import { assertUserNameAvailable, findScimUserById, findScimUserByUserId, insertScimUser, toUserResourceRow, -} from '@/lib/scim/repository/users' -import { deleteUserAccount } from '@/lib/users/account-deletion' +} from '@/ee/scim/repository/users' const logger = createLogger('ScimProvisionUser') diff --git a/apps/sim/lib/scim/application/users/read-users.ts b/apps/sim/ee/scim/application/users/read-users.ts similarity index 89% rename from apps/sim/lib/scim/application/users/read-users.ts rename to apps/sim/ee/scim/application/users/read-users.ts index 979a5ffeb07..982b9556578 100644 --- a/apps/sim/lib/scim/application/users/read-users.ts +++ b/apps/sim/ee/scim/application/users/read-users.ts @@ -2,23 +2,23 @@ import { db } from '@sim/db' import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, -} from '@/lib/scim/application/authorized-scim-use-case' -import { scimOperations } from '@/lib/scim/application/operations' -import { notFound } from '@/lib/scim/protocol/errors' -import { parseUserFilter } from '@/lib/scim/protocol/filter' +} from '@/ee/scim/application/authorized-scim-use-case' +import { scimOperations } from '@/ee/scim/application/operations' +import { notFound } from '@/ee/scim/protocol/errors' +import { parseUserFilter } from '@/ee/scim/protocol/filter' import { projectionWants, projectResource, resolvePage, type ScimAttributeProjection, toUserResource, -} from '@/lib/scim/protocol/resources' +} from '@/ee/scim/protocol/resources' import { findScimUserById, loadGroupsForScimUsers, pageScimUsers, toUserResourceRow, -} from '@/lib/scim/repository/users' +} from '@/ee/scim/repository/users' export interface ListScimUsersInput { filter?: string | undefined diff --git a/apps/sim/lib/scim/application/users/update-user.test.ts b/apps/sim/ee/scim/application/users/update-user.test.ts similarity index 94% rename from apps/sim/lib/scim/application/users/update-user.test.ts rename to apps/sim/ee/scim/application/users/update-user.test.ts index 543c39d5fcf..e3062794ba1 100644 --- a/apps/sim/lib/scim/application/users/update-user.test.ts +++ b/apps/sim/ee/scim/application/users/update-user.test.ts @@ -33,16 +33,16 @@ vi.mock('@/lib/organizations/members/revocation', () => ({ revokeUserSessionsTx: mocks.revokeSessions, invalidateAfterSessionRevocation: mocks.invalidate, })) -vi.mock('@/lib/scim/identity/account-identity', () => ({ +vi.mock('@/ee/scim/identity/account-identity', () => ({ syncAccountIdentityTx: mocks.syncIdentity, })) -vi.mock('@/lib/scim/identity/resolve-user', () => ({ +vi.mock('@/ee/scim/identity/resolve-user', () => ({ assertDomainOwned: mocks.assertDomainOwned, })) -vi.mock('@/lib/scim/projection/reconcile-user', () => ({ +vi.mock('@/ee/scim/projection/reconcile-user', () => ({ reconcileUserProjection: mocks.reconcile, })) -vi.mock('@/lib/scim/repository/users', () => ({ +vi.mock('@/ee/scim/repository/users', () => ({ findScimUserById: mocks.findScimUserById, assertUserNameAvailable: mocks.assertUserNameAvailable, updateScimUser: mocks.updateScimUser, @@ -59,13 +59,13 @@ vi.mock('@/lib/scim/repository/users', () => ({ groups: [], }), })) -vi.mock('@/lib/scim/application/audit', () => ({ +vi.mock('@/ee/scim/application/audit', () => ({ recordScimAuditEntries: mocks.recordAudit, })) -vi.mock('@/lib/scim/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) +vi.mock('@/ee/scim/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) import type { Principal } from '@sim/auth/principal' -import { patchScimUser, replaceScimUser } from '@/lib/scim/application/users/update-user' +import { patchScimUser, replaceScimUser } from '@/ee/scim/application/users/update-user' const principal: Principal = { kind: 'scim_connection', diff --git a/apps/sim/lib/scim/application/users/update-user.ts b/apps/sim/ee/scim/application/users/update-user.ts similarity index 93% rename from apps/sim/lib/scim/application/users/update-user.ts rename to apps/sim/ee/scim/application/users/update-user.ts index 60894cccd87..b513927005b 100644 --- a/apps/sim/lib/scim/application/users/update-user.ts +++ b/apps/sim/ee/scim/application/users/update-user.ts @@ -10,20 +10,20 @@ import { invalidateAfterSessionRevocation, revokeUserSessionsTx, } from '@/lib/organizations/members/revocation' -import type { ScimAuditEntry } from '@/lib/scim/application/audit' +import type { ScimAuditEntry } from '@/ee/scim/application/audit' import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, type ScimUseCaseContext, -} from '@/lib/scim/application/authorized-scim-use-case' -import { scimOperations } from '@/lib/scim/application/operations' -import { syncAccountIdentityTx } from '@/lib/scim/identity/account-identity' -import { assertDomainOwned } from '@/lib/scim/identity/resolve-user' -import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' -import { primaryEmail } from '@/lib/scim/protocol/canonical' -import { notFound, ScimError } from '@/lib/scim/protocol/errors' -import { toUserResource } from '@/lib/scim/protocol/resources' -import { applyUserPatch, userAttributesEqual } from '@/lib/scim/protocol/user-patch' +} from '@/ee/scim/application/authorized-scim-use-case' +import { scimOperations } from '@/ee/scim/application/operations' +import { syncAccountIdentityTx } from '@/ee/scim/identity/account-identity' +import { assertDomainOwned } from '@/ee/scim/identity/resolve-user' +import { reconcileUserProjection } from '@/ee/scim/projection/reconcile-user' +import { primaryEmail } from '@/ee/scim/protocol/canonical' +import { notFound, ScimError } from '@/ee/scim/protocol/errors' +import { toUserResource } from '@/ee/scim/protocol/resources' +import { applyUserPatch, userAttributesEqual } from '@/ee/scim/protocol/user-patch' import { assertUserNameAvailable, findScimUserById, @@ -31,7 +31,7 @@ import { type ScimUserRecord, toUserResourceRow, updateScimUser, -} from '@/lib/scim/repository/users' +} from '@/ee/scim/repository/users' /** * The write half of the User resource. diff --git a/apps/sim/lib/scim/authenticate.test.ts b/apps/sim/ee/scim/authenticate.test.ts similarity index 96% rename from apps/sim/lib/scim/authenticate.test.ts rename to apps/sim/ee/scim/authenticate.test.ts index 0e40c8bcc30..596e6899dc7 100644 --- a/apps/sim/lib/scim/authenticate.test.ts +++ b/apps/sim/ee/scim/authenticate.test.ts @@ -9,12 +9,12 @@ import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' const { mockIsEntitled } = vi.hoisted(() => ({ mockIsEntitled: vi.fn() })) -vi.mock('@/lib/scim/entitlement', () => ({ +vi.mock('@/ee/scim/entitlement', () => ({ isScimEntitledForOrganization: mockIsEntitled, })) -import { authenticateScimRequest, generateScimToken } from '@/lib/scim/authenticate' -import { ScimError } from '@/lib/scim/protocol/errors' +import { authenticateScimRequest, generateScimToken } from '@/ee/scim/authenticate' +import { ScimError } from '@/ee/scim/protocol/errors' function requestWithToken(token?: string): NextRequest { const headers = new Headers() diff --git a/apps/sim/lib/scim/authenticate.ts b/apps/sim/ee/scim/authenticate.ts similarity index 97% rename from apps/sim/lib/scim/authenticate.ts rename to apps/sim/ee/scim/authenticate.ts index ab5f4afc154..fdcc7ea264f 100644 --- a/apps/sim/lib/scim/authenticate.ts +++ b/apps/sim/ee/scim/authenticate.ts @@ -6,8 +6,8 @@ import { createLogger } from '@sim/logger' import { generateShortId } from '@sim/utils/id' import { eq } from 'drizzle-orm' import type { NextRequest } from 'next/server' -import { isScimEntitledForOrganization } from '@/lib/scim/entitlement' -import { ScimError } from '@/lib/scim/protocol/errors' +import { isScimEntitledForOrganization } from '@/ee/scim/entitlement' +import { ScimError } from '@/ee/scim/protocol/errors' const logger = createLogger('ScimAuthenticate') diff --git a/apps/sim/lib/scim/base-url.ts b/apps/sim/ee/scim/base-url.ts similarity index 80% rename from apps/sim/lib/scim/base-url.ts rename to apps/sim/ee/scim/base-url.ts index 85dc99c1115..41ae9e41b3f 100644 --- a/apps/sim/lib/scim/base-url.ts +++ b/apps/sim/ee/scim/base-url.ts @@ -1,5 +1,5 @@ import { getBaseUrl } from '@/lib/core/utils/urls' -import { SCIM_BASE_PATH } from '@/lib/scim/protocol/constants' +import { SCIM_BASE_PATH } from '@/ee/scim/protocol/constants' /** The absolute root of the SCIM surface, e.g. `https://sim.ai/api/scim/v2`; used for `meta.location`, `$ref`, and settings. */ export function scimBaseUrl(): string { diff --git a/apps/sim/lib/scim/entitlement.test.ts b/apps/sim/ee/scim/entitlement.test.ts similarity index 95% rename from apps/sim/lib/scim/entitlement.test.ts rename to apps/sim/ee/scim/entitlement.test.ts index ee7604467b7..2cf81d9c82a 100644 --- a/apps/sim/lib/scim/entitlement.test.ts +++ b/apps/sim/ee/scim/entitlement.test.ts @@ -10,7 +10,7 @@ vi.mock('@/lib/billing/core/subscription', () => ({ isOrganizationOnEnterprisePlan: mockEnterprisePlan, })) -import { isScimEntitledForOrganization } from '@/lib/scim/entitlement' +import { isScimEntitledForOrganization } from '@/ee/scim/entitlement' afterEach(resetEnvFlagsMock) diff --git a/apps/sim/lib/scim/entitlement.ts b/apps/sim/ee/scim/entitlement.ts similarity index 100% rename from apps/sim/lib/scim/entitlement.ts rename to apps/sim/ee/scim/entitlement.ts diff --git a/apps/sim/lib/scim/identity/account-identity.ts b/apps/sim/ee/scim/identity/account-identity.ts similarity index 95% rename from apps/sim/lib/scim/identity/account-identity.ts rename to apps/sim/ee/scim/identity/account-identity.ts index 3b80c191a6b..c8b2119ba16 100644 --- a/apps/sim/lib/scim/identity/account-identity.ts +++ b/apps/sim/ee/scim/identity/account-identity.ts @@ -2,7 +2,7 @@ import { user } from '@sim/db/schema' import { normalizeEmail } from '@sim/utils/string' import { eq } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' -import { assertEmailAvailable } from '@/lib/scim/identity/resolve-user' +import { assertEmailAvailable } from '@/ee/scim/identity/resolve-user' /** * Writes the directory's view of who a person is onto their Sim account. diff --git a/apps/sim/lib/scim/identity/end-directory-membership.ts b/apps/sim/ee/scim/identity/end-directory-membership.ts similarity index 100% rename from apps/sim/lib/scim/identity/end-directory-membership.ts rename to apps/sim/ee/scim/identity/end-directory-membership.ts diff --git a/apps/sim/lib/scim/identity/resolve-user.test.ts b/apps/sim/ee/scim/identity/resolve-user.test.ts similarity index 98% rename from apps/sim/lib/scim/identity/resolve-user.test.ts rename to apps/sim/ee/scim/identity/resolve-user.test.ts index 9e5c78dc05e..875067d0fac 100644 --- a/apps/sim/lib/scim/identity/resolve-user.test.ts +++ b/apps/sim/ee/scim/identity/resolve-user.test.ts @@ -5,8 +5,8 @@ import { db } from '@sim/db' import { member, type ScimUserAttributes, scimUserTombstone, ssoDomain, user } from '@sim/db/schema' import { dbChainMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' -import { assertEmailAvailable, resolveProvisionedIdentity } from '@/lib/scim/identity/resolve-user' -import { ScimError } from '@/lib/scim/protocol/errors' +import { assertEmailAvailable, resolveProvisionedIdentity } from '@/ee/scim/identity/resolve-user' +import { ScimError } from '@/ee/scim/protocol/errors' function attributes(overrides: Partial = {}): ScimUserAttributes { return { diff --git a/apps/sim/lib/scim/identity/resolve-user.ts b/apps/sim/ee/scim/identity/resolve-user.ts similarity index 98% rename from apps/sim/lib/scim/identity/resolve-user.ts rename to apps/sim/ee/scim/identity/resolve-user.ts index 9f4e372d741..616499a2054 100644 --- a/apps/sim/lib/scim/identity/resolve-user.ts +++ b/apps/sim/ee/scim/identity/resolve-user.ts @@ -4,8 +4,8 @@ import { normalizeSSODomain } from '@sim/utils/sso-domain' import { isValidEmailSyntax, normalizeEmail } from '@sim/utils/string' import { and, eq, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' -import { primaryEmail } from '@/lib/scim/protocol/canonical' -import { invalidValue, uniqueness } from '@/lib/scim/protocol/errors' +import { primaryEmail } from '@/ee/scim/protocol/canonical' +import { invalidValue, uniqueness } from '@/ee/scim/protocol/errors' /** * Deciding which Sim account an incoming directory identity refers to. diff --git a/apps/sim/lib/scim/managed-membership.ts b/apps/sim/ee/scim/managed-membership.ts similarity index 100% rename from apps/sim/lib/scim/managed-membership.ts rename to apps/sim/ee/scim/managed-membership.ts diff --git a/apps/sim/lib/scim/projection/auto-map.test.ts b/apps/sim/ee/scim/projection/auto-map.test.ts similarity index 97% rename from apps/sim/lib/scim/projection/auto-map.test.ts rename to apps/sim/ee/scim/projection/auto-map.test.ts index 9da2bc95bef..47578fed197 100644 --- a/apps/sim/lib/scim/projection/auto-map.test.ts +++ b/apps/sim/ee/scim/projection/auto-map.test.ts @@ -9,7 +9,7 @@ import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' const { mockLeafLock } = vi.hoisted(() => ({ mockLeafLock: vi.fn() })) vi.mock('@/lib/permission-groups/locks', () => ({ acquirePermissionGroupOrgLock: mockLeafLock })) -import { autoMapPermissionGroupByName } from '@/lib/scim/projection/auto-map' +import { autoMapPermissionGroupByName } from '@/ee/scim/projection/auto-map' const params = { organizationId: 'org-1', scimGroupId: 'g-1', displayName: 'Engineering' } diff --git a/apps/sim/lib/scim/projection/auto-map.ts b/apps/sim/ee/scim/projection/auto-map.ts similarity index 100% rename from apps/sim/lib/scim/projection/auto-map.ts rename to apps/sim/ee/scim/projection/auto-map.ts diff --git a/apps/sim/lib/scim/projection/grants.test.ts b/apps/sim/ee/scim/projection/grants.test.ts similarity index 99% rename from apps/sim/lib/scim/projection/grants.test.ts rename to apps/sim/ee/scim/projection/grants.test.ts index 7452c3f3454..3806a78100d 100644 --- a/apps/sim/lib/scim/projection/grants.test.ts +++ b/apps/sim/ee/scim/projection/grants.test.ts @@ -7,7 +7,7 @@ import { type ProjectionGrant, planGrantChanges, resolveDesiredGrants, -} from '@/lib/scim/projection/grants' +} from '@/ee/scim/projection/grants' function workspaceRow(workspaceId: string, permissionType: 'admin' | 'write' | 'read'): MappingRow { return { diff --git a/apps/sim/lib/scim/projection/grants.ts b/apps/sim/ee/scim/projection/grants.ts similarity index 100% rename from apps/sim/lib/scim/projection/grants.ts rename to apps/sim/ee/scim/projection/grants.ts diff --git a/apps/sim/lib/scim/projection/reconcile-user.test.ts b/apps/sim/ee/scim/projection/reconcile-user.test.ts similarity index 99% rename from apps/sim/lib/scim/projection/reconcile-user.test.ts rename to apps/sim/ee/scim/projection/reconcile-user.test.ts index e6b9edfb09e..9addda27ef7 100644 --- a/apps/sim/lib/scim/projection/reconcile-user.test.ts +++ b/apps/sim/ee/scim/projection/reconcile-user.test.ts @@ -40,7 +40,7 @@ vi.mock('@/lib/workspaces/access/workspace-access', () => ({ })) import { OrchestrationError } from '@/lib/core/orchestration/types' -import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' +import { reconcileUserProjection } from '@/ee/scim/projection/reconcile-user' const params = { connectionId: 'conn-1', diff --git a/apps/sim/lib/scim/projection/reconcile-user.ts b/apps/sim/ee/scim/projection/reconcile-user.ts similarity index 99% rename from apps/sim/lib/scim/projection/reconcile-user.ts rename to apps/sim/ee/scim/projection/reconcile-user.ts index bc726f3fc25..fe61854f9df 100644 --- a/apps/sim/lib/scim/projection/reconcile-user.ts +++ b/apps/sim/ee/scim/projection/reconcile-user.ts @@ -21,14 +21,6 @@ import { PermissionGroupScopeConflictError, removePermissionGroupMemberTx, } from '@/lib/permission-groups/application/group-membership' -import { - type MappingRow, - type ProjectionGrant, - type ProjectionGrantOrigin, - type ProjectionTargetKind, - planGrantChanges, - resolveDesiredGrants, -} from '@/lib/scim/projection/grants' import { grantWorkspaceAccessTx, lowerWorkspaceAccessTx, @@ -36,6 +28,14 @@ import { readWorkspacePermission, revokeWorkspaceAccessTx, } from '@/lib/workspaces/access/workspace-access' +import { + type MappingRow, + type ProjectionGrant, + type ProjectionGrantOrigin, + type ProjectionTargetKind, + planGrantChanges, + resolveDesiredGrants, +} from '@/ee/scim/projection/grants' const logger = createLogger('ScimProjection') diff --git a/apps/sim/lib/scim/protocol/canonical.test.ts b/apps/sim/ee/scim/protocol/canonical.test.ts similarity index 95% rename from apps/sim/lib/scim/protocol/canonical.test.ts rename to apps/sim/ee/scim/protocol/canonical.test.ts index b70ee943833..f7f64c72b08 100644 --- a/apps/sim/lib/scim/protocol/canonical.test.ts +++ b/apps/sim/ee/scim/protocol/canonical.test.ts @@ -9,14 +9,14 @@ import { primaryEmail, toCanonicalGroup, toCanonicalUser, -} from '@/lib/scim/protocol/canonical' +} from '@/ee/scim/protocol/canonical' import { SCIM_ENTERPRISE_USER_SCHEMA, SCIM_GROUP_SCHEMA, SCIM_USER_SCHEMA, -} from '@/lib/scim/protocol/constants' -import type { ScimError } from '@/lib/scim/protocol/errors' -import { ENTRA_LEGACY_GROUP_SCHEMA } from '@/lib/scim/protocol/normalize' +} from '@/ee/scim/protocol/constants' +import type { ScimError } from '@/ee/scim/protocol/errors' +import { ENTRA_LEGACY_GROUP_SCHEMA } from '@/ee/scim/protocol/normalize' function parseUser(body: Record) { return toCanonicalUser(scimUserWriteSchema.parse({ schemas: [SCIM_USER_SCHEMA], ...body })) diff --git a/apps/sim/lib/scim/protocol/canonical.ts b/apps/sim/ee/scim/protocol/canonical.ts similarity index 97% rename from apps/sim/lib/scim/protocol/canonical.ts rename to apps/sim/ee/scim/protocol/canonical.ts index 8332bbfd422..cf1e9e50689 100644 --- a/apps/sim/lib/scim/protocol/canonical.ts +++ b/apps/sim/ee/scim/protocol/canonical.ts @@ -5,9 +5,9 @@ import { SCIM_GROUP_SCHEMA, SCIM_MAX_GROUP_MEMBERS, SCIM_USER_SCHEMA, -} from '@/lib/scim/protocol/constants' -import { invalidValue } from '@/lib/scim/protocol/errors' -import { isRecord, stripProviderSchemaMarkers } from '@/lib/scim/protocol/normalize' +} from '@/ee/scim/protocol/constants' +import { invalidValue } from '@/ee/scim/protocol/errors' +import { isRecord, stripProviderSchemaMarkers } from '@/ee/scim/protocol/normalize' /** Attributes Sim models itself; everything else is preserved under `extra`. */ const MODELLED_USER_KEYS = new Set([ diff --git a/apps/sim/lib/scim/protocol/constants.ts b/apps/sim/ee/scim/protocol/constants.ts similarity index 100% rename from apps/sim/lib/scim/protocol/constants.ts rename to apps/sim/ee/scim/protocol/constants.ts diff --git a/apps/sim/lib/scim/protocol/discovery.ts b/apps/sim/ee/scim/protocol/discovery.ts similarity index 99% rename from apps/sim/lib/scim/protocol/discovery.ts rename to apps/sim/ee/scim/protocol/discovery.ts index 1add3630a12..c5f87bffd08 100644 --- a/apps/sim/lib/scim/protocol/discovery.ts +++ b/apps/sim/ee/scim/protocol/discovery.ts @@ -7,7 +7,7 @@ import { SCIM_SCHEMA_SCHEMA, SCIM_SERVICE_PROVIDER_CONFIG_SCHEMA, SCIM_USER_SCHEMA, -} from '@/lib/scim/protocol/constants' +} from '@/ee/scim/protocol/constants' /** * The discovery documents RFC 7644 requires. diff --git a/apps/sim/lib/scim/protocol/errors.ts b/apps/sim/ee/scim/protocol/errors.ts similarity index 98% rename from apps/sim/lib/scim/protocol/errors.ts rename to apps/sim/ee/scim/protocol/errors.ts index 5704bbbbd2e..8d03b170a72 100644 --- a/apps/sim/lib/scim/protocol/errors.ts +++ b/apps/sim/ee/scim/protocol/errors.ts @@ -1,5 +1,5 @@ import { asOrchestrationError } from '@/lib/core/orchestration/types' -import { SCIM_ERROR_SCHEMA } from '@/lib/scim/protocol/constants' +import { SCIM_ERROR_SCHEMA } from '@/ee/scim/protocol/constants' /** * The `scimType` vocabulary of RFC 7644 section 3.12. diff --git a/apps/sim/lib/scim/protocol/filter.test.ts b/apps/sim/ee/scim/protocol/filter.test.ts similarity index 96% rename from apps/sim/lib/scim/protocol/filter.test.ts rename to apps/sim/ee/scim/protocol/filter.test.ts index 2f128433e50..ff323d8bae0 100644 --- a/apps/sim/lib/scim/protocol/filter.test.ts +++ b/apps/sim/ee/scim/protocol/filter.test.ts @@ -2,8 +2,8 @@ * @vitest-environment node */ import { describe, expect, it } from 'vitest' -import type { ScimError } from '@/lib/scim/protocol/errors' -import { parseGroupFilter, parseUserFilter } from '@/lib/scim/protocol/filter' +import type { ScimError } from '@/ee/scim/protocol/errors' +import { parseGroupFilter, parseUserFilter } from '@/ee/scim/protocol/filter' /** * The grammar is deliberately small, so these tests are as much about what is diff --git a/apps/sim/lib/scim/protocol/filter.ts b/apps/sim/ee/scim/protocol/filter.ts similarity index 97% rename from apps/sim/lib/scim/protocol/filter.ts rename to apps/sim/ee/scim/protocol/filter.ts index ed28647f5a6..bab40af2984 100644 --- a/apps/sim/lib/scim/protocol/filter.ts +++ b/apps/sim/ee/scim/protocol/filter.ts @@ -1,6 +1,6 @@ -import { SCIM_MAX_FILTER_TERMS } from '@/lib/scim/protocol/constants' -import { invalidFilter } from '@/lib/scim/protocol/errors' -import { normalizeAttributePath } from '@/lib/scim/protocol/normalize' +import { SCIM_MAX_FILTER_TERMS } from '@/ee/scim/protocol/constants' +import { invalidFilter } from '@/ee/scim/protocol/errors' +import { normalizeAttributePath } from '@/ee/scim/protocol/normalize' /** * The filter grammar this server accepts, which is the subset the provisioning diff --git a/apps/sim/lib/scim/protocol/group-patch.test.ts b/apps/sim/ee/scim/protocol/group-patch.test.ts similarity index 95% rename from apps/sim/lib/scim/protocol/group-patch.test.ts rename to apps/sim/ee/scim/protocol/group-patch.test.ts index 10438318635..40242093ea9 100644 --- a/apps/sim/lib/scim/protocol/group-patch.test.ts +++ b/apps/sim/ee/scim/protocol/group-patch.test.ts @@ -3,9 +3,9 @@ */ import { describe, expect, it } from 'vitest' import { scimPatchBodySchema } from '@/lib/api/contracts/scim' -import { SCIM_PATCH_OP_SCHEMA } from '@/lib/scim/protocol/constants' -import type { ScimError } from '@/lib/scim/protocol/errors' -import { parseGroupPatch } from '@/lib/scim/protocol/group-patch' +import { SCIM_PATCH_OP_SCHEMA } from '@/ee/scim/protocol/constants' +import type { ScimError } from '@/ee/scim/protocol/errors' +import { parseGroupPatch } from '@/ee/scim/protocol/group-patch' function parseOperations(operations: unknown[]) { return scimPatchBodySchema.parse({ schemas: [SCIM_PATCH_OP_SCHEMA], Operations: operations }) diff --git a/apps/sim/lib/scim/protocol/group-patch.ts b/apps/sim/ee/scim/protocol/group-patch.ts similarity index 97% rename from apps/sim/lib/scim/protocol/group-patch.ts rename to apps/sim/ee/scim/protocol/group-patch.ts index 7d3113d287c..edac57ad6e8 100644 --- a/apps/sim/lib/scim/protocol/group-patch.ts +++ b/apps/sim/ee/scim/protocol/group-patch.ts @@ -1,7 +1,7 @@ import type { ScimPatchOperation } from '@/lib/api/contracts/scim' -import { readMemberValue } from '@/lib/scim/protocol/canonical' -import { invalidPath, invalidValue, mutability, noTarget } from '@/lib/scim/protocol/errors' -import { isRecord, normalizeAttributePath } from '@/lib/scim/protocol/normalize' +import { readMemberValue } from '@/ee/scim/protocol/canonical' +import { invalidPath, invalidValue, mutability, noTarget } from '@/ee/scim/protocol/errors' +import { isRecord, normalizeAttributePath } from '@/ee/scim/protocol/normalize' /** * A parsed Group PATCH. diff --git a/apps/sim/lib/scim/protocol/normalize.ts b/apps/sim/ee/scim/protocol/normalize.ts similarity index 100% rename from apps/sim/lib/scim/protocol/normalize.ts rename to apps/sim/ee/scim/protocol/normalize.ts diff --git a/apps/sim/lib/scim/protocol/resources.test.ts b/apps/sim/ee/scim/protocol/resources.test.ts similarity index 96% rename from apps/sim/lib/scim/protocol/resources.test.ts rename to apps/sim/ee/scim/protocol/resources.test.ts index 66ea9159379..09de0892d99 100644 --- a/apps/sim/lib/scim/protocol/resources.test.ts +++ b/apps/sim/ee/scim/protocol/resources.test.ts @@ -3,15 +3,15 @@ */ import { describe, expect, it } from 'vitest' import { scimUserResourceSchema } from '@/lib/api/contracts/scim' -import { SCIM_MAX_PAGE_SIZE } from '@/lib/scim/protocol/constants' -import type { ScimError } from '@/lib/scim/protocol/errors' +import { SCIM_MAX_PAGE_SIZE } from '@/ee/scim/protocol/constants' +import type { ScimError } from '@/ee/scim/protocol/errors' import { parseAttributeProjection, projectionWants, projectResource, resolvePage, toUserResource, -} from '@/lib/scim/protocol/resources' +} from '@/ee/scim/protocol/resources' const BASE_URL = 'https://sim.test/api/scim/v2' diff --git a/apps/sim/lib/scim/protocol/resources.ts b/apps/sim/ee/scim/protocol/resources.ts similarity index 98% rename from apps/sim/lib/scim/protocol/resources.ts rename to apps/sim/ee/scim/protocol/resources.ts index 246309090a9..036fc9d0490 100644 --- a/apps/sim/lib/scim/protocol/resources.ts +++ b/apps/sim/ee/scim/protocol/resources.ts @@ -5,8 +5,8 @@ import { SCIM_LIST_RESPONSE_SCHEMA, SCIM_MAX_PAGE_SIZE, SCIM_USER_SCHEMA, -} from '@/lib/scim/protocol/constants' -import { invalidValue } from '@/lib/scim/protocol/errors' +} from '@/ee/scim/protocol/constants' +import { invalidValue } from '@/ee/scim/protocol/errors' export interface ScimResourceMeta { resourceType: 'User' | 'Group' diff --git a/apps/sim/lib/scim/protocol/user-patch.test.ts b/apps/sim/ee/scim/protocol/user-patch.test.ts similarity index 98% rename from apps/sim/lib/scim/protocol/user-patch.test.ts rename to apps/sim/ee/scim/protocol/user-patch.test.ts index 7fe3dba24df..d7459519f8a 100644 --- a/apps/sim/lib/scim/protocol/user-patch.test.ts +++ b/apps/sim/ee/scim/protocol/user-patch.test.ts @@ -4,8 +4,8 @@ import type { ScimUserAttributes } from '@sim/db/schema' import { describe, expect, it } from 'vitest' import { scimPatchBodySchema } from '@/lib/api/contracts/scim' -import { SCIM_PATCH_OP_SCHEMA } from '@/lib/scim/protocol/constants' -import { applyUserPatch } from '@/lib/scim/protocol/user-patch' +import { SCIM_PATCH_OP_SCHEMA } from '@/ee/scim/protocol/constants' +import { applyUserPatch } from '@/ee/scim/protocol/user-patch' /** * Every fixture here is a request shape taken from Okta's or Microsoft's own diff --git a/apps/sim/lib/scim/protocol/user-patch.ts b/apps/sim/ee/scim/protocol/user-patch.ts similarity index 99% rename from apps/sim/lib/scim/protocol/user-patch.ts rename to apps/sim/ee/scim/protocol/user-patch.ts index 6b617809309..7ea01725157 100644 --- a/apps/sim/lib/scim/protocol/user-patch.ts +++ b/apps/sim/ee/scim/protocol/user-patch.ts @@ -1,12 +1,12 @@ import type { ScimUserAttributes, ScimUserEmail } from '@sim/db/schema' import type { ScimPatchOperation } from '@/lib/api/contracts/scim' -import { invalidPath, invalidValue, mutability, noTarget } from '@/lib/scim/protocol/errors' +import { invalidPath, invalidValue, mutability, noTarget } from '@/ee/scim/protocol/errors' import { isRecord, normalizeAttributePath, normalizeScimBoolean, unwrapSingleElement, -} from '@/lib/scim/protocol/normalize' +} from '@/ee/scim/protocol/normalize' /** * Applies a PATCH operation list to a stored User resource. diff --git a/apps/sim/lib/scim/reconcile/job.ts b/apps/sim/ee/scim/reconcile/job.ts similarity index 96% rename from apps/sim/lib/scim/reconcile/job.ts rename to apps/sim/ee/scim/reconcile/job.ts index 87b8e95615f..fab3143c8eb 100644 --- a/apps/sim/lib/scim/reconcile/job.ts +++ b/apps/sim/ee/scim/reconcile/job.ts @@ -3,10 +3,10 @@ import { scimConnection } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { and, eq, isNull, lt, or, sql } from 'drizzle-orm' -import { isScimEntitledForOrganization } from '@/lib/scim/entitlement' -import { reconcileUserProjection } from '@/lib/scim/projection/reconcile-user' -import { listScimUserIds } from '@/lib/scim/repository/users' -import { pruneScimRequestLog } from '@/lib/scim/request-log' +import { isScimEntitledForOrganization } from '@/ee/scim/entitlement' +import { reconcileUserProjection } from '@/ee/scim/projection/reconcile-user' +import { listScimUserIds } from '@/ee/scim/repository/users' +import { pruneScimRequestLog } from '@/ee/scim/request-log' const logger = createLogger('ScimReconcile') diff --git a/apps/sim/lib/scim/repository/credentials.ts b/apps/sim/ee/scim/repository/credentials.ts similarity index 100% rename from apps/sim/lib/scim/repository/credentials.ts rename to apps/sim/ee/scim/repository/credentials.ts diff --git a/apps/sim/lib/scim/repository/groups.ts b/apps/sim/ee/scim/repository/groups.ts similarity index 98% rename from apps/sim/lib/scim/repository/groups.ts rename to apps/sim/ee/scim/repository/groups.ts index ee8ee965ce2..2b3322dec3b 100644 --- a/apps/sim/lib/scim/repository/groups.ts +++ b/apps/sim/ee/scim/repository/groups.ts @@ -3,8 +3,8 @@ import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { and, asc, count, eq, inArray, type SQL, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' -import type { ScimFilterTerm, ScimGroupFilterField } from '@/lib/scim/protocol/filter' -import { buildOrderKey } from '@/lib/scim/repository/users' +import type { ScimFilterTerm, ScimGroupFilterField } from '@/ee/scim/protocol/filter' +import { buildOrderKey } from '@/ee/scim/repository/users' const logger = createLogger('ScimGroupRepository') diff --git a/apps/sim/lib/scim/repository/users.ts b/apps/sim/ee/scim/repository/users.ts similarity index 97% rename from apps/sim/lib/scim/repository/users.ts rename to apps/sim/ee/scim/repository/users.ts index 604786078de..ac163b6d118 100644 --- a/apps/sim/lib/scim/repository/users.ts +++ b/apps/sim/ee/scim/repository/users.ts @@ -3,9 +3,9 @@ import { generateId } from '@sim/utils/id' import { normalizeEmail } from '@sim/utils/string' import { and, asc, count, eq, inArray, type SQL, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' -import { uniqueness } from '@/lib/scim/protocol/errors' -import type { ScimFilterTerm, ScimUserFilterField } from '@/lib/scim/protocol/filter' -import type { UserResourceRow } from '@/lib/scim/protocol/resources' +import { uniqueness } from '@/ee/scim/protocol/errors' +import type { ScimFilterTerm, ScimUserFilterField } from '@/ee/scim/protocol/filter' +import type { UserResourceRow } from '@/ee/scim/protocol/resources' /** * Reads and writes of the provisioned User table. diff --git a/apps/sim/lib/scim/request-log.ts b/apps/sim/ee/scim/request-log.ts similarity index 94% rename from apps/sim/lib/scim/request-log.ts rename to apps/sim/ee/scim/request-log.ts index f52dcc86357..b0dda430f33 100644 --- a/apps/sim/lib/scim/request-log.ts +++ b/apps/sim/ee/scim/request-log.ts @@ -5,8 +5,8 @@ import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { truncate } from '@sim/utils/string' import { sql } from 'drizzle-orm' -import { SCIM_REQUEST_LOG_RETENTION } from '@/lib/scim/protocol/constants' -import type { ScimType } from '@/lib/scim/protocol/errors' +import { SCIM_REQUEST_LOG_RETENTION } from '@/ee/scim/protocol/constants' +import type { ScimType } from '@/ee/scim/protocol/errors' const logger = createLogger('ScimRequestLog') diff --git a/apps/sim/lib/scim/route.ts b/apps/sim/ee/scim/route.ts similarity index 74% rename from apps/sim/lib/scim/route.ts rename to apps/sim/ee/scim/route.ts index a184bb03c20..437d883b521 100644 --- a/apps/sim/lib/scim/route.ts +++ b/apps/sim/ee/scim/route.ts @@ -1,7 +1,7 @@ import { createScimRouteBuilder } from '@/lib/api/server/routes/scim-route' -import { authenticateScimRequest } from '@/lib/scim/authenticate' -import { scimBaseUrl } from '@/lib/scim/base-url' -import { recordScimRequest } from '@/lib/scim/request-log' +import { authenticateScimRequest } from '@/ee/scim/authenticate' +import { scimBaseUrl } from '@/ee/scim/base-url' +import { recordScimRequest } from '@/ee/scim/request-log' /** * The route builder wired to this deployment. diff --git a/apps/sim/lib/api/contracts/scim.ts b/apps/sim/lib/api/contracts/scim.ts index ebd6e5aa344..4ccc93af477 100644 --- a/apps/sim/lib/api/contracts/scim.ts +++ b/apps/sim/lib/api/contracts/scim.ts @@ -6,12 +6,12 @@ import { SCIM_MAX_GROUP_MEMBERS, SCIM_MAX_PATCH_OPERATIONS, SCIM_PATCH_OP_SCHEMA, -} from '@/lib/scim/protocol/constants' +} from '@/ee/scim/protocol/constants' import { canonicalizeAttributeNames, normalizeScimBoolean, unwrapSingleElement, -} from '@/lib/scim/protocol/normalize' +} from '@/ee/scim/protocol/normalize' /** * Wire schemas for the SCIM 2.0 surface. diff --git a/apps/sim/lib/api/server/routes/scim-route.test.ts b/apps/sim/lib/api/server/routes/scim-route.test.ts index cd3109c599b..9a0c09a6bae 100644 --- a/apps/sim/lib/api/server/routes/scim-route.test.ts +++ b/apps/sim/lib/api/server/routes/scim-route.test.ts @@ -24,9 +24,9 @@ import { listScimUsersContract, } from '@/lib/api/contracts/scim' import { createScimRouteBuilder } from '@/lib/api/server/routes/scim-route' -import { scimOperations } from '@/lib/scim/application/operations' -import { SCIM_MEDIA_TYPE } from '@/lib/scim/protocol/constants' -import { ScimError } from '@/lib/scim/protocol/errors' +import { scimOperations } from '@/ee/scim/application/operations' +import { SCIM_MEDIA_TYPE } from '@/ee/scim/protocol/constants' +import { ScimError } from '@/ee/scim/protocol/errors' const principal: ScimConnectionPrincipal = { kind: 'scim_connection', diff --git a/apps/sim/lib/api/server/routes/scim-route.ts b/apps/sim/lib/api/server/routes/scim-route.ts index 0c090b17a35..c76b11b6f38 100644 --- a/apps/sim/lib/api/server/routes/scim-route.ts +++ b/apps/sim/lib/api/server/routes/scim-route.ts @@ -7,16 +7,16 @@ import type { ApplicationOperation, OperationUseCase } from '@/lib/core/applicat import { isScimEnabled } from '@/lib/core/config/env-flags' import { enforceIpRateLimit, RateLimiter } from '@/lib/core/rate-limiter' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' -import type { ScimConnectionAuthenticator } from '@/lib/scim/authenticate' -import { scimBaseUrl } from '@/lib/scim/base-url' +import type { ScimConnectionAuthenticator } from '@/ee/scim/authenticate' +import { scimBaseUrl } from '@/ee/scim/base-url' import { SCIM_ACCEPTED_MEDIA_TYPES, SCIM_MAX_BODY_BYTES, SCIM_MEDIA_TYPE, SCIM_RATE_LIMIT, -} from '@/lib/scim/protocol/constants' -import { ScimError, type ScimType, scimErrorBody, toScimError } from '@/lib/scim/protocol/errors' -import type { ScimRequestLogEntry } from '@/lib/scim/request-log' +} from '@/ee/scim/protocol/constants' +import { ScimError, type ScimType, scimErrorBody, toScimError } from '@/ee/scim/protocol/errors' +import type { ScimRequestLogEntry } from '@/ee/scim/request-log' const logger = createLogger('ScimRoute') const rateLimiter = new RateLimiter() diff --git a/apps/sim/lib/billing/organizations/membership.ts b/apps/sim/lib/billing/organizations/membership.ts index 884a745b378..a1973053538 100644 --- a/apps/sim/lib/billing/organizations/membership.ts +++ b/apps/sim/lib/billing/organizations/membership.ts @@ -54,12 +54,12 @@ import { revokePersonalApiKeysTx, revokeUserSessionsTx, } from '@/lib/organizations/members/revocation' -import { endDirectoryMembershipTx } from '@/lib/scim/identity/end-directory-membership' import { removeWorkspaceSkillMembershipsTx } from '@/lib/skills/access' import { reassignWorkflowOwnershipForWorkspaceMemberRemovalTx, WorkspaceBillingAccountRemovalError, } from '@/lib/workspaces/utils' +import { endDirectoryMembershipTx } from '@/ee/scim/identity/end-directory-membership' export { acquireUserBillingIdentityLock } from '@/lib/billing/organizations/billing-identity-lock' export { WORKSPACE_BILLING_ACCOUNT_REMOVAL_ERROR } from '@/lib/workspaces/utils' diff --git a/apps/sim/lib/core/application/operation.ts b/apps/sim/lib/core/application/operation.ts index 2456c78d227..f0388c2d2de 100644 --- a/apps/sim/lib/core/application/operation.ts +++ b/apps/sim/lib/core/application/operation.ts @@ -70,7 +70,7 @@ export interface ApplicationOperation { * identity provider, which provisions membership and never reads or writes a * workspace resource. Leaving it out makes that a compile-time fact — a * workspace operation cannot name it even by accident — and SCIM declares its - * own operation type in `lib/scim/application/operations.ts`, the way + * own operation type in `ee/scim/application/operations.ts`, the way * organization BYOK does. */ export type PrincipalKind = Exclude< diff --git a/apps/sim/lib/invitations/direct-grant.ts b/apps/sim/lib/invitations/direct-grant.ts index 753459aee1c..d30c755e0ee 100644 --- a/apps/sim/lib/invitations/direct-grant.ts +++ b/apps/sim/lib/invitations/direct-grant.ts @@ -30,12 +30,12 @@ import { import { acquireInvitationMutationLocks } from '@/lib/invitations/locks' import { sendWorkspaceAddedEmail } from '@/lib/invitations/send' import { captureServerEvent } from '@/lib/posthog/server' -import { assertMembershipNotScimManaged } from '@/lib/scim/managed-membership' import { getEffectiveWorkspacePermission, getWorkspaceWithOwner, type PermissionType, } from '@/lib/workspaces/permissions/utils' +import { assertMembershipNotScimManaged } from '@/ee/scim/managed-membership' const logger = createLogger('InvitationDirectGrant') diff --git a/apps/sim/lib/invitations/workspace-invitations.ts b/apps/sim/lib/invitations/workspace-invitations.ts index 8ff61a688de..a81eed94fc8 100644 --- a/apps/sim/lib/invitations/workspace-invitations.ts +++ b/apps/sim/lib/invitations/workspace-invitations.ts @@ -30,10 +30,6 @@ import { sendInvitationEmail, } from '@/lib/invitations/send' import { captureServerEvent } from '@/lib/posthog/server' -import { - assertInviteeNotScimManaged, - scimManagedUserPredicate, -} from '@/lib/scim/managed-membership' import { getEffectiveWorkspacePermission, getWorkspaceWithOwner, @@ -47,6 +43,7 @@ import { type WorkspaceInvitePolicy, } from '@/lib/workspaces/policy' import { validateInvitationsAllowed } from '@/ee/access-control/utils/permission-check' +import { assertInviteeNotScimManaged, scimManagedUserPredicate } from '@/ee/scim/managed-membership' /** * What the invitee becomes in the organization. `member` and `admin` are diff --git a/scripts/check-api-validation-contracts.ts b/scripts/check-api-validation-contracts.ts index 2a3c7eaf2b1..5ec859af169 100644 --- a/scripts/check-api-validation-contracts.ts +++ b/scripts/check-api-validation-contracts.ts @@ -180,7 +180,7 @@ const RAW_JSON_BASELINE_ROUTES = new Set([ const CONTRACT_IMPORT_PATTERN = /\bfrom\s+['"]@\/lib\/api\/contracts(?:\/[^'"]*)?['"]/ const DECLARATIVE_ROUTE_BUILDER_IMPORT_PATTERN = - /\bimport\s*\{[^}]*(?:\bdefineInternalJsonRoute\b|\bdefineV2JsonRoute\b|\bdefineInternalBinaryRoute\b|\bdefineV2BinaryRoute\b)[^}]*\}\s*from\s*['"]@\/lib\/api\/server\/routes['"]|\bimport\s*\{[^}]*\bdefineScimRoute\b[^}]*\}\s*from\s*['"]@\/lib\/scim\/route['"]/ + /\bimport\s*\{[^}]*(?:\bdefineInternalJsonRoute\b|\bdefineV2JsonRoute\b|\bdefineInternalBinaryRoute\b|\bdefineV2BinaryRoute\b)[^}]*\}\s*from\s*['"]@\/lib\/api\/server\/routes['"]|\bimport\s*\{[^}]*\bdefineScimRoute\b[^}]*\}\s*from\s*['"]@\/ee\/scim\/route['"]/ const DECLARATIVE_ROUTE_BUILDER_USAGE_PATTERN = /\b(?:defineInternalJsonRoute|defineV2JsonRoute|defineInternalBinaryRoute|defineV2BinaryRoute|defineScimRoute)\s*\(/ const SERVER_VALIDATION_IMPORT_PATTERN = /\bfrom\s+['"]@\/lib\/api\/server(?:\/validation)?['"]/ From adc82a3a4831a708a63bf2dec4305c9f57d838eb Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 16:40:18 -0700 Subject: [PATCH 25/31] fix(auth): bound cleanup runtime and finish consent polish --- .../docs/api-reference/authentication.mdx | 2 +- .../platform/self-hosting/authentication.mdx | 9 +- .../app/(auth)/oauth/consent/consent-view.tsx | 16 +-- apps/sim/app/(auth)/oauth/consent/page.tsx | 28 ++--- .../app/(auth)/oauth/consent/search-params.ts | 12 +- .../api/cron/cleanup-oauth-tokens/route.ts | 1 + .../background/cleanup-oauth-tokens.test.ts | 95 +++++++++++++--- apps/sim/background/cleanup-oauth-tokens.ts | 104 +++++++++++------- apps/sim/lib/api/contracts/workspaces.ts | 1 - .../oauth-provider-lifecycle.postgres.test.ts | 97 +++++++++++++++- apps/sim/lib/auth/oauth-provider.ts | 8 +- 11 files changed, 264 insertions(+), 109 deletions(-) diff --git a/apps/docs/content/docs/api-reference/authentication.mdx b/apps/docs/content/docs/api-reference/authentication.mdx index bf7fdab9265..e4c9bc8ee94 100644 --- a/apps/docs/content/docs/api-reference/authentication.mdx +++ b/apps/docs/content/docs/api-reference/authentication.mdx @@ -103,7 +103,7 @@ curl https://www.sim.ai/api/v2/workspaces \ | Scope | Access | | --- | --- | | `api:read` | Read operations, including searches sent as POST requests | -| `api:write` | Mutations and execution, including operations that can start external work | +| `api:write` | Includes `api:read`, plus mutations and execution, including operations that can start external work | | `offline_access` | Refresh tokens for continued access after the access token expires | Scopes limit what an application may do; your current workspace membership and role still apply. Each endpoint documents its required scope. Some GET endpoints that perform external discovery require `api:write`, so HTTP method alone does not determine the permission. diff --git a/apps/docs/content/docs/platform/self-hosting/authentication.mdx b/apps/docs/content/docs/platform/self-hosting/authentication.mdx index f877776eaac..265f371dd2b 100644 --- a/apps/docs/content/docs/platform/self-hosting/authentication.mdx +++ b/apps/docs/content/docs/platform/self-hosting/authentication.mdx @@ -98,14 +98,17 @@ returns 404 and the CLI falls back to the pairing-code handoff on its own. `DISABLE_AUTH=true` also forces the provider off because the authorization flow requires a real Better Auth user session. -Access tokens are opaque and last an hour; refresh tokens rotate on every use -and expire after thirty days. Nothing is cached, so revoking a grant under +Access tokens are opaque and last an hour; refresh tokens rotate on every use. +Each login has a fixed thirty-day lifetime that refreshing does not extend. +Nothing is cached, so revoking a grant under **Settings → Authorized apps** stops the app on its very next request. ### Registering an app Dynamic client registration is switched off, so clients are created by an -operator. The Sim CLI is seeded by the migration; register anything else with: +operator. Both `db:migrate` and the development `db:push` command install the +OAuth lifecycle triggers and register the Sim CLI. Repeating either command +preserves existing grants and client customizations. Register other apps with: ```bash DATABASE_URL=… \ diff --git a/apps/sim/app/(auth)/oauth/consent/consent-view.tsx b/apps/sim/app/(auth)/oauth/consent/consent-view.tsx index 0f276453542..2e3ccbd12b3 100644 --- a/apps/sim/app/(auth)/oauth/consent/consent-view.tsx +++ b/apps/sim/app/(auth)/oauth/consent/consent-view.tsx @@ -45,13 +45,8 @@ interface OAuthConsentViewProps { } /** - * The host the authorization code will be delivered to, or `null` when the - * request names none this page can read. - * - * A registered `client_name` is whatever the client called itself, so for a - * public client the destination is the one part of the request an impostor - * cannot borrow. A loopback address is named plainly rather than shown as an - * IP, because "this computer" is what it means to the person reading it. + * Shows the redirect host beside the app name to help identify impersonation; + * names loopback callbacks as this computer. */ function describeDestination(redirectUri: string | null): string | null { if (!redirectUri) return null @@ -66,11 +61,8 @@ function describeDestination(redirectUri: string | null): string | null { } /** - * The consent card: which app is asking, what it will be able to do, and as - * whom. Every decision here is a real grant, so the copy names the app and the - * account rather than a generic "an application" — the page is the only place - * a relayed or phished authorization can be caught, which is also why the - * first-party CLI never skips it. + * Always names the app and account, including for the CLI, so users can + * recognize relayed authorization attempts. */ export function OAuthConsentView({ refusal, diff --git a/apps/sim/app/(auth)/oauth/consent/page.tsx b/apps/sim/app/(auth)/oauth/consent/page.tsx index 8a8df759a75..e532807fccf 100644 --- a/apps/sim/app/(auth)/oauth/consent/page.tsx +++ b/apps/sim/app/(auth)/oauth/consent/page.tsx @@ -14,14 +14,8 @@ export const metadata: Metadata = { export const dynamic = 'force-dynamic' /** - * The OAuth provider's `consentPage`. The plugin sends a signed-in user here with - * the signed authorization query; the view shows who is asking and for what, and - * the consent call carries that same query back so the plugin can mint a code - * for exactly the request the user saw. - * - * A signed-out visitor (a stale tab, a shared link) goes through the same - * bounce the plugin uses for its `loginPage`, which re-enters authorize after - * sign-in and lands back here with a fresh signature. + * Renders the plugin's signed request; signed-out visitors restart through the + * login bridge to obtain a fresh authorization query. */ export default async function OAuthConsentPage({ searchParams, @@ -55,13 +49,15 @@ export default async function OAuthConsentPage({ const authorizationRequestKey = refusal ? null : JSON.stringify(raw) return ( - +
+ +
) } diff --git a/apps/sim/app/(auth)/oauth/consent/search-params.ts b/apps/sim/app/(auth)/oauth/consent/search-params.ts index b250d5e6a69..1b832ef36d8 100644 --- a/apps/sim/app/(auth)/oauth/consent/search-params.ts +++ b/apps/sim/app/(auth)/oauth/consent/search-params.ts @@ -1,16 +1,8 @@ import { createSearchParamsCache, parseAsString } from 'nuqs/server' /** - * The authorize parameters the consent card renders. The rest of the signed - * query (`state`, `sig`, `exp`, …) stays untouched in `window.location.search`, - * which is what the auth client forwards verbatim on the consent call. - * - * Read-only for the life of the page, so there is no `urlKeys` companion and - * no client-side `useQueryStates` — the server component reads them and passes - * them down as props. - * - * Deliberately nullable rather than `.withDefault('')`: a missing `client_id` - * is a malformed request the card must refuse, not a value to fall back on. + * Read once for display; the auth client forwards the original signed query. + * Nullable parsers preserve missing identifiers for rejection. */ const oauthConsentParsers = { client_id: parseAsString, diff --git a/apps/sim/app/api/cron/cleanup-oauth-tokens/route.ts b/apps/sim/app/api/cron/cleanup-oauth-tokens/route.ts index 2eca2b3eab6..bfa925e77a8 100644 --- a/apps/sim/app/api/cron/cleanup-oauth-tokens/route.ts +++ b/apps/sim/app/api/cron/cleanup-oauth-tokens/route.ts @@ -6,6 +6,7 @@ import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { runCleanupOAuthTokens } from '@/background/cleanup-oauth-tokens' export const dynamic = 'force-dynamic' +export const maxDuration = 60 const logger = createLogger('CleanupOAuthTokensAPI') diff --git a/apps/sim/background/cleanup-oauth-tokens.test.ts b/apps/sim/background/cleanup-oauth-tokens.test.ts index ef5512118d0..3e5212b9b95 100644 --- a/apps/sim/background/cleanup-oauth-tokens.test.ts +++ b/apps/sim/background/cleanup-oauth-tokens.test.ts @@ -1,7 +1,7 @@ /** * @vitest-environment node */ -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' const mocks = vi.hoisted(() => ({ select: vi.fn(), @@ -45,13 +45,18 @@ function selectChain(rows: unknown[], captured: unknown[]) { describe('runCleanupOAuthTokens', () => { beforeEach(() => { - vi.clearAllMocks() + vi.resetAllMocks() + vi.useFakeTimers({ toFake: ['Date'] }) mocks.transaction.mockImplementation((work) => work({ select: mocks.txSelect, delete: mocks.txDelete }) ) mocks.txSelect.mockImplementation(() => selectChain([], [])) }) + afterEach(() => { + vi.useRealTimers() + }) + it('deletes exactly the expired rows it selected, and reports both counts', async () => { const deletedFrom: unknown[] = [] mocks.select @@ -116,7 +121,7 @@ describe('runCleanupOAuthTokens', () => { expect(OAUTH_TOKEN_RETENTION_DAYS).toBeGreaterThan(0) }) - it('bounds family cascades independently of direct token pages and stops a full backlog', async () => { + it('drains up to 50,000 families and access tokens with only ten families per transaction', async () => { const families = Array.from({ length: 10 }, (_, index) => ({ id: `family-${index}`, clientId: 'client-1', @@ -124,22 +129,84 @@ describe('runCleanupOAuthTokens', () => { userId: 'user-1', consentId: null, })) - for (let page = 0; page < 10; page += 1) { - mocks.select.mockReturnValueOnce(selectChain(families, [])) - } - mocks.select.mockReturnValueOnce(selectChain([], [])) + const accessTokens = Array.from({ length: 5_000 }, (_, index) => ({ id: `access-${index}` })) + mocks.select.mockImplementation((fields: Record) => + selectChain('clientId' in fields ? families : accessTokens, []) + ) mocks.txDelete.mockReturnValue({ where: () => ({ returning: async () => families.map(({ id }) => ({ id })) }), }) + mocks.delete.mockReturnValue({ + where: () => ({ returning: async () => accessTokens }), + }) await expect(runCleanupOAuthTokens()).resolves.toEqual({ - tokenFamilies: 100, - accessTokens: 0, + tokenFamilies: 50_000, + accessTokens: 50_000, }) - expect(mocks.transaction).toHaveBeenCalledTimes(10) - expect(mocks.limits.mock.calls.map(([limit]) => limit)).toEqual([ - ...Array.from({ length: 10 }, () => 10), - 5_000, - ]) + expect(mocks.transaction).toHaveBeenCalledTimes(5_000) + expect(mocks.delete).toHaveBeenCalledTimes(10) + const limits = mocks.limits.mock.calls.map(([limit]) => limit) + expect(limits.filter((limit) => limit === 10)).toHaveLength(5_000) + expect(limits.filter((limit) => limit === 5_000)).toHaveLength(10) + expect(limits.slice(0, 4)).toEqual([10, 5_000, 10, 5_000]) + }) + + it('stops at its deadline with committed progress from both backlogs', async () => { + const startedAt = Date.now() + const families = Array.from({ length: 10 }, (_, index) => ({ + id: `family-${index}`, + clientId: 'client-1', + sessionId: null, + userId: 'user-1', + consentId: null, + })) + const accessTokens = Array.from({ length: 5_000 }, (_, index) => ({ id: `access-${index}` })) + mocks.select.mockImplementation((fields: Record) => + selectChain('clientId' in fields ? families : accessTokens, []) + ) + mocks.txDelete.mockReturnValue({ + where: () => ({ returning: async () => families.map(({ id }) => ({ id })) }), + }) + mocks.delete.mockReturnValue({ + where: () => ({ + returning: async () => { + vi.setSystemTime(startedAt + 45_000) + return accessTokens + }, + }), + }) + + await expect(runCleanupOAuthTokens()).resolves.toEqual({ + tokenFamilies: 10, + accessTokens: 5_000, + }) + expect(mocks.transaction).toHaveBeenCalledOnce() + expect(mocks.delete).toHaveBeenCalledOnce() + expect(mocks.select).toHaveBeenCalledTimes(2) + }) + + it('does not begin a delete when selection exhausts the deadline', async () => { + const startedAt = Date.now() + mocks.select.mockImplementation(() => { + vi.setSystemTime(startedAt + 45_000) + return selectChain( + [ + { + id: 'family-1', + clientId: 'client-1', + sessionId: null, + userId: 'user-1', + consentId: null, + }, + ], + [] + ) + }) + + await expect(runCleanupOAuthTokens()).resolves.toEqual({ tokenFamilies: 0, accessTokens: 0 }) + expect(mocks.transaction).not.toHaveBeenCalled() + expect(mocks.delete).not.toHaveBeenCalled() + expect(mocks.select).toHaveBeenCalledOnce() }) }) diff --git a/apps/sim/background/cleanup-oauth-tokens.ts b/apps/sim/background/cleanup-oauth-tokens.ts index 5579b5b8340..d78ba8b5f02 100644 --- a/apps/sim/background/cleanup-oauth-tokens.ts +++ b/apps/sim/background/cleanup-oauth-tokens.ts @@ -26,8 +26,11 @@ export const OAUTH_TOKEN_RETENTION_DAYS = 7 * batch small independently of direct access-token deletion. */ const OAUTH_FAMILY_SWEEP_LIMIT = 10 +const OAUTH_FAMILY_SWEEP_MAX_PAGES = 5_000 const OAUTH_ACCESS_TOKEN_SWEEP_LIMIT = 5_000 -const OAUTH_TOKEN_SWEEP_MAX_PAGES = 10 +const OAUTH_ACCESS_TOKEN_SWEEP_MAX_PAGES = 10 +/** Stops admitting batches before the Helm cron's 60-second request timeout. */ +const OAUTH_TOKEN_SWEEP_BUDGET_MS = 45_000 export interface CleanupOAuthTokensResult { tokenFamilies: number @@ -117,60 +120,79 @@ async function deleteExpiredFamilyBatch( * later reuse go unnoticed while descendants remained active. The family row * therefore owns retention and cascades every generation when it expires. * - * Families go first and their refresh/access tokens follow by cascade. The - * second pass catches expired access tokens for still-live families and access - * tokens issued without a refresh grant. Both passes use bounded indexed pages. + * Interleaves family and access-token pages so neither backlog prevents the + * other from making progress before the deadline. Family deletion cascades its + * remaining tokens; access pages also catch tokens from still-live families or + * grants without refresh tokens. Both sweeps retain a 50,000-row run cap while + * family transactions stay small enough to bound their descendant cascades. */ export async function runCleanupOAuthTokens(): Promise { - const cutoff = new Date(Date.now() - OAUTH_TOKEN_RETENTION_DAYS * 24 * 60 * 60 * 1000) + const startedAt = Date.now() + const deadline = startedAt + OAUTH_TOKEN_SWEEP_BUDGET_MS + const cutoff = new Date(startedAt - OAUTH_TOKEN_RETENTION_DAYS * 24 * 60 * 60 * 1000) let tokenFamilies = 0 let accessTokens = 0 + let moreFamilies = true + let moreAccessTokens = true - for (let page = 0; page < OAUTH_TOKEN_SWEEP_MAX_PAGES; page += 1) { - const staleFamilies = await db - .select({ - id: oauthTokenFamily.id, - clientId: oauthTokenFamily.clientId, - sessionId: oauthTokenFamily.sessionId, - userId: oauthTokenFamily.userId, - consentId: oauthTokenFamily.consentId, - }) - .from(oauthTokenFamily) - .where(lt(oauthTokenFamily.expiresAt, cutoff)) - .orderBy(asc(oauthTokenFamily.expiresAt), asc(oauthTokenFamily.id)) - .limit(OAUTH_FAMILY_SWEEP_LIMIT) - if (staleFamilies.length === 0) break + for (let page = 0; page < OAUTH_FAMILY_SWEEP_MAX_PAGES; page += 1) { + if (Date.now() >= deadline || (!moreFamilies && !moreAccessTokens)) break - tokenFamilies += await deleteExpiredFamilyBatch(staleFamilies, cutoff) - if (staleFamilies.length < OAUTH_FAMILY_SWEEP_LIMIT) break - } + if (moreFamilies) { + const staleFamilies = await db + .select({ + id: oauthTokenFamily.id, + clientId: oauthTokenFamily.clientId, + sessionId: oauthTokenFamily.sessionId, + userId: oauthTokenFamily.userId, + consentId: oauthTokenFamily.consentId, + }) + .from(oauthTokenFamily) + .where(lt(oauthTokenFamily.expiresAt, cutoff)) + .orderBy(asc(oauthTokenFamily.expiresAt), asc(oauthTokenFamily.id)) + .limit(OAUTH_FAMILY_SWEEP_LIMIT) + if (Date.now() >= deadline) break - for (let page = 0; page < OAUTH_TOKEN_SWEEP_MAX_PAGES; page += 1) { - const staleAccess = await db - .select({ id: oauthAccessToken.id }) - .from(oauthAccessToken) - .where(lt(oauthAccessToken.expiresAt, cutoff)) - .orderBy(asc(oauthAccessToken.expiresAt), asc(oauthAccessToken.id)) - .limit(OAUTH_ACCESS_TOKEN_SWEEP_LIMIT) - if (staleAccess.length === 0) break + if (staleFamilies.length > 0) { + tokenFamilies += await deleteExpiredFamilyBatch(staleFamilies, cutoff) + } + moreFamilies = staleFamilies.length === OAUTH_FAMILY_SWEEP_LIMIT + } - const deleted = await db - .delete(oauthAccessToken) - .where( - inArray( - oauthAccessToken.id, - staleAccess.map((row) => row.id) - ) - ) - .returning({ id: oauthAccessToken.id }) - accessTokens += deleted.length - if (staleAccess.length < OAUTH_ACCESS_TOKEN_SWEEP_LIMIT) break + if (Date.now() >= deadline) break + if (moreAccessTokens && page < OAUTH_ACCESS_TOKEN_SWEEP_MAX_PAGES) { + const staleAccess = await db + .select({ id: oauthAccessToken.id }) + .from(oauthAccessToken) + .where(lt(oauthAccessToken.expiresAt, cutoff)) + .orderBy(asc(oauthAccessToken.expiresAt), asc(oauthAccessToken.id)) + .limit(OAUTH_ACCESS_TOKEN_SWEEP_LIMIT) + if (Date.now() >= deadline) break + + if (staleAccess.length > 0) { + const deleted = await db + .delete(oauthAccessToken) + .where( + inArray( + oauthAccessToken.id, + staleAccess.map((row) => row.id) + ) + ) + .returning({ id: oauthAccessToken.id }) + accessTokens += deleted.length + } + moreAccessTokens = + staleAccess.length === OAUTH_ACCESS_TOKEN_SWEEP_LIMIT && + page + 1 < OAUTH_ACCESS_TOKEN_SWEEP_MAX_PAGES + } } const result = { tokenFamilies, accessTokens } logger.info('Swept expired OAuth tokens', { ...result, retentionDays: OAUTH_TOKEN_RETENTION_DAYS, + elapsedMs: Date.now() - startedAt, + deadlineReached: Date.now() >= deadline, }) return result } diff --git a/apps/sim/lib/api/contracts/workspaces.ts b/apps/sim/lib/api/contracts/workspaces.ts index 2f7f6b67b10..318562ae4bf 100644 --- a/apps/sim/lib/api/contracts/workspaces.ts +++ b/apps/sim/lib/api/contracts/workspaces.ts @@ -253,7 +253,6 @@ export const deploymentFeaturesSchema = z.object({ dataDrains: z.boolean(), dataRetention: z.boolean(), inbox: z.boolean(), - /** Sim's OAuth provider is a deployment toggle rather than an enterprise entitlement. */ sandboxes: z.boolean(), sessionPolicies: z.boolean(), sso: z.boolean(), diff --git a/apps/sim/lib/auth/oauth-provider-lifecycle.postgres.test.ts b/apps/sim/lib/auth/oauth-provider-lifecycle.postgres.test.ts index a46e507f2a2..9432ddc0848 100644 --- a/apps/sim/lib/auth/oauth-provider-lifecycle.postgres.test.ts +++ b/apps/sim/lib/auth/oauth-provider-lifecycle.postgres.test.ts @@ -25,6 +25,7 @@ async function loadRuntime() { { reconcileOAuthProviderLifecycle }, { default: postgres }, { hashOAuthToken }, + { runCleanupOAuthTokens, OAUTH_TOKEN_RETENTION_DAYS }, ] = await Promise.all([ import('@sim/db'), import('@sim/db/schema'), @@ -37,6 +38,7 @@ async function loadRuntime() { import('@sim/db/oauth-provider-lifecycle'), import('postgres'), import('@/lib/auth/oauth-access-token'), + import('@/background/cleanup-oauth-tokens'), ]) const adapter = createSimAuthAdapter({ plugins: [ @@ -62,6 +64,8 @@ async function loadRuntime() { revokeAuthorizedAppUseCase, listAuthorizedAppsUseCase, hashOAuthToken, + runCleanupOAuthTokens, + OAUTH_TOKEN_RETENTION_DAYS, } } @@ -133,7 +137,7 @@ describe.skipIf(!databaseUrl)('OAuth lifecycle on the provisioned PostgreSQL sch }) } - async function issueFamily() { + async function issueFamily(issuedAt = new Date()) { const token = generateId() const { id } = await runtime.adapter.create<{ id: string }>({ model: 'oauthRefreshToken', @@ -142,8 +146,8 @@ describe.skipIf(!databaseUrl)('OAuth lifecycle on the provisioned PostgreSQL sch clientId, userId, scopes, - createdAt: new Date(), - expiresAt: new Date(Date.now() + 86_400_000), + createdAt: issuedAt, + expiresAt: new Date(issuedAt.getTime() + 86_400_000), }, }) await runtime.db.insert(runtime.schema.oauthAccessToken).values({ @@ -153,8 +157,8 @@ describe.skipIf(!databaseUrl)('OAuth lifecycle on the provisioned PostgreSQL sch userId, refreshId: id, scopes, - createdAt: new Date(), - expiresAt: new Date(Date.now() + 3_600_000), + createdAt: issuedAt, + expiresAt: new Date(issuedAt.getTime() + 3_600_000), }) return { id, refreshToken: `sim_ort_${token}` } } @@ -364,6 +368,89 @@ describe.skipIf(!databaseUrl)('OAuth lifecycle on the provisioned PostgreSQL sch expect(tokens).toHaveLength(1) }) + it('cleans expired families and every descendant while retaining active grants and the retention tail', async () => { + await grantConsent() + const { db, schema, eq, inArray } = runtime + const stale = await issueFamily() + await expect( + runtime.rotateOAuthRefreshToken({ + credentials: { clientId, method: 'none' }, + refreshToken: stale.refreshToken, + }) + ).resolves.toMatchObject({ success: true }) + const descendants = await db + .select({ id: schema.oauthRefreshToken.id }) + .from(schema.oauthRefreshToken) + .where(eq(schema.oauthRefreshToken.familyId, stale.id)) + expect(descendants).toHaveLength(2) + const descendantIds = descendants.map(({ id }) => id) + const expiredAt = new Date(Date.now() - (runtime.OAUTH_TOKEN_RETENTION_DAYS + 1) * 86_400_000) + const oldTimestamps = { + createdAt: new Date(expiredAt.getTime() - 86_400_000), + expiresAt: expiredAt, + } + await db + .update(schema.oauthTokenFamily) + .set(oldTimestamps) + .where(eq(schema.oauthTokenFamily.id, stale.id)) + await db + .update(schema.oauthRefreshToken) + .set(oldTimestamps) + .where(inArray(schema.oauthRefreshToken.id, descendantIds)) + await db + .update(schema.oauthAccessToken) + .set(oldTimestamps) + .where(inArray(schema.oauthAccessToken.refreshId, descendantIds)) + + const active = await issueFamily() + const recentlyExpired = await issueFamily(new Date(Date.now() - 2 * 86_400_000)) + const activeUnlinkedId = generateId() + const staleUnlinkedId = generateId() + const staleLinkedId = generateId() + await db.insert(schema.oauthAccessToken).values( + [activeUnlinkedId, staleUnlinkedId, staleLinkedId].map((id) => ({ + id, + token: generateId(), + clientId, + userId, + refreshId: id === staleLinkedId ? active.id : null, + scopes, + createdAt: oldTimestamps.createdAt, + expiresAt: id === activeUnlinkedId ? new Date(Date.now() + 3_600_000) : expiredAt, + })) + ) + + await expect(runtime.runCleanupOAuthTokens()).resolves.toMatchObject({ + tokenFamilies: 1, + accessTokens: 2, + }) + const remainingFamilies = await db + .select({ id: schema.oauthTokenFamily.id }) + .from(schema.oauthTokenFamily) + .where(eq(schema.oauthTokenFamily.clientId, clientId)) + expect(remainingFamilies.map(({ id }) => id).sort()).toEqual( + [active.id, recentlyExpired.id].sort() + ) + expect( + await db + .select({ id: schema.oauthRefreshToken.id }) + .from(schema.oauthRefreshToken) + .where(inArray(schema.oauthRefreshToken.id, descendantIds)) + ).toHaveLength(0) + const remainingAccess = await db + .select({ id: schema.oauthAccessToken.id, refreshId: schema.oauthAccessToken.refreshId }) + .from(schema.oauthAccessToken) + .where(eq(schema.oauthAccessToken.clientId, clientId)) + expect(remainingAccess).toHaveLength(3) + expect(remainingAccess).toEqual( + expect.arrayContaining([ + { id: activeUnlinkedId, refreshId: null }, + expect.objectContaining({ refreshId: active.id }), + expect.objectContaining({ refreshId: recentlyExpired.id }), + ]) + ) + }) + it('reconciles repeatedly without changing the existing CLI registration or grants', async () => { await grantConsent() const family = await issueFamily() diff --git a/apps/sim/lib/auth/oauth-provider.ts b/apps/sim/lib/auth/oauth-provider.ts index de2a6a1a3e7..84e7d5885b2 100644 --- a/apps/sim/lib/auth/oauth-provider.ts +++ b/apps/sim/lib/auth/oauth-provider.ts @@ -24,12 +24,8 @@ export const OAUTH_SCOPES = ['offline_access', OAUTH_API_READ_SCOPE, OAUTH_API_W export type OAuthScope = (typeof OAUTH_SCOPES)[number] /** - * Token lifetimes, in seconds, as the plugin takes them. - * - * An hour of access matches what gcloud and the AWS CLI issue and limits the - * lifetime of a copied token that is not otherwise revoked. Thirty days of - * refresh is the plugin's own default and means a daily user signs in roughly - * monthly. + * Lifetimes in seconds. An hour bounds copied access tokens; refresh families + * have a fixed thirty-day lifetime. */ export const OAUTH_ACCESS_TOKEN_TTL_SECONDS = 60 * 60 export const OAUTH_REFRESH_TOKEN_TTL_SECONDS = 30 * 24 * 60 * 60 From f2fbd7655283dc6669166119a7ea134c59c2f2b6 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 16:48:22 -0700 Subject: [PATCH 26/31] fix(auth): unify CLI completion screens and simplify consent --- .../sim/app/(auth)/components/auth-header.tsx | 6 +++-- .../app/(auth)/oauth/consent/consent-view.tsx | 6 +---- .../app/cli/auth/done/cli-auth-done-view.tsx | 20 +++++++++------- apps/sim/app/cli/auth/done/page.tsx | 19 ++++++++++----- apps/sim/app/cli/auth/done/search-params.ts | 10 ++++++++ packages/sim-cli/src/auth/oauth-flow.test.ts | 8 ++++++- packages/sim-cli/src/auth/oauth-flow.ts | 24 +++++-------------- 7 files changed, 53 insertions(+), 40 deletions(-) create mode 100644 apps/sim/app/cli/auth/done/search-params.ts diff --git a/apps/sim/app/(auth)/components/auth-header.tsx b/apps/sim/app/(auth)/components/auth-header.tsx index 96cfceceda5..803e1b0ec57 100644 --- a/apps/sim/app/(auth)/components/auth-header.tsx +++ b/apps/sim/app/(auth)/components/auth-header.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from 'react' interface AuthHeaderProps { title: string - description: ReactNode + description?: ReactNode } /** @@ -15,7 +15,9 @@ export function AuthHeader({ title, description }: AuthHeaderProps) { return (

{title}

-

{description}

+ {description != null && ( +

{description}

+ )}
) } diff --git a/apps/sim/app/(auth)/oauth/consent/consent-view.tsx b/apps/sim/app/(auth)/oauth/consent/consent-view.tsx index 2e3ccbd12b3..a0a2ae85d18 100644 --- a/apps/sim/app/(auth)/oauth/consent/consent-view.tsx +++ b/apps/sim/app/(auth)/oauth/consent/consent-view.tsx @@ -136,11 +136,7 @@ export function OAuthConsentView({
{scopes.length > 0 && ( diff --git a/apps/sim/app/cli/auth/done/cli-auth-done-view.tsx b/apps/sim/app/cli/auth/done/cli-auth-done-view.tsx index 31a9610ccbe..ea6116ebd66 100644 --- a/apps/sim/app/cli/auth/done/cli-auth-done-view.tsx +++ b/apps/sim/app/cli/auth/done/cli-auth-done-view.tsx @@ -1,15 +1,19 @@ import { AuthHeader } from '@/app/(auth)/components' +import type { CliAuthDoneStatus } from '@/app/cli/auth/done/search-params' -/** - * Where the CLI's listener sends the browser once it has the authorization - * code. Static by design: the key is minted server-side during the CLI's - * exchange and never passes through this page. - */ -export function CliAuthDoneView() { +interface CliAuthDoneViewProps { + status: CliAuthDoneStatus +} + +export function CliAuthDoneView({ status }: CliAuthDoneViewProps) { return ( ) } diff --git a/apps/sim/app/cli/auth/done/page.tsx b/apps/sim/app/cli/auth/done/page.tsx index db3772dad3d..23161f24f81 100644 --- a/apps/sim/app/cli/auth/done/page.tsx +++ b/apps/sim/app/cli/auth/done/page.tsx @@ -1,21 +1,28 @@ import type { Metadata } from 'next' +import type { SearchParams } from 'nuqs/server' import { AuthShell } from '@/app/(auth)/components' import { CliAuthDoneView } from '@/app/cli/auth/done/cli-auth-done-view' +import { cliAuthDoneSearchParamsCache } from '@/app/cli/auth/done/search-params' export const metadata: Metadata = { - title: 'Terminal connected', + title: 'Terminal sign-in', robots: { index: false, follow: false }, } /** - * The CLI's loopback listener redirects here, so the flow ends on Sim's own - * chrome instead of a page served by the wizard. Public and sessionless on - * purpose — it renders a static confirmation and never touches the API. + * Sessionless completion for OAuth and pairing flows. The status is informational + * and never exchanges credentials or changes authorization. */ -export default function CliAuthDonePage() { +export default async function CliAuthDonePage({ + searchParams, +}: { + searchParams: Promise +}) { + const { status } = await cliAuthDoneSearchParamsCache.parse(searchParams) + return ( - + ) } diff --git a/apps/sim/app/cli/auth/done/search-params.ts b/apps/sim/app/cli/auth/done/search-params.ts new file mode 100644 index 00000000000..f44e205c364 --- /dev/null +++ b/apps/sim/app/cli/auth/done/search-params.ts @@ -0,0 +1,10 @@ +import { createSearchParamsCache, parseAsStringLiteral } from 'nuqs/server' + +const CLI_AUTH_DONE_STATUSES = ['approved', 'cancelled'] as const + +export type CliAuthDoneStatus = (typeof CLI_AUTH_DONE_STATUSES)[number] + +/** Informational only; an omitted status preserves existing pairing callbacks. */ +export const cliAuthDoneSearchParamsCache = createSearchParamsCache({ + status: parseAsStringLiteral(CLI_AUTH_DONE_STATUSES).withDefault('approved'), +}) diff --git a/packages/sim-cli/src/auth/oauth-flow.test.ts b/packages/sim-cli/src/auth/oauth-flow.test.ts index 216d48a083b..b3e122ee83d 100644 --- a/packages/sim-cli/src/auth/oauth-flow.test.ts +++ b/packages/sim-cli/src/auth/oauth-flow.test.ts @@ -283,8 +283,9 @@ describe('loginWithBrowser', () => { }) it('reports a declined consent as a cancellation, not a server failure', async () => { - const { login, fetchMock } = await completeInBrowser((_params, state) => ({ + const { login, fetchMock, callback } = await completeInBrowser((_params, state) => ({ error: 'access_denied', + error_description: 'Do not forward provider data to the completion page', state, })) @@ -292,6 +293,11 @@ describe('loginWithBrowser', () => { expect(failure).toBeInstanceOf(SimApiError) expect(failure.message).toBe('Sign-in was declined in the browser.') expect(fetchMock).not.toHaveBeenCalled() + const response = await callback + expect(response.statusCode).toBe(302) + expect(response.headers.location).toBe(`${ENDPOINT}/cli/auth/done?status=cancelled`) + expect(response.headers['referrer-policy']).toBe('no-referrer') + expect(response.headers['cache-control']).toBe('no-store') }) it('gives up after the timeout with the browserless fallback named', async () => { diff --git a/packages/sim-cli/src/auth/oauth-flow.ts b/packages/sim-cli/src/auth/oauth-flow.ts index 4fe563ca787..24f79f7d244 100644 --- a/packages/sim-cli/src/auth/oauth-flow.ts +++ b/packages/sim-cli/src/auth/oauth-flow.ts @@ -394,13 +394,6 @@ export async function revokeToken(endpoint: string, token: string): Promise${title}

${title}

${body}

` -} - interface LoopbackResult { code: string } @@ -468,22 +461,17 @@ function listenForCallback( */ if (state !== expectedState) { response - .writeHead(400, { 'content-type': 'text/html; charset=utf-8' }) + .writeHead(400, { 'content-type': 'text/plain; charset=utf-8' }) .end( - callbackPage( - 'Sign-in mismatch', - 'This response did not come from the sign-in this terminal started. Return to your terminal.' - ) + 'Sign-in mismatch. This response did not come from the sign-in this terminal started. Return to your terminal.' ) return } if (error || !code) { const description = url.searchParams.get('error_description') ?? undefined - response - .writeHead(200, { 'content-type': 'text/html; charset=utf-8' }) - .end( - callbackPage('Sign-in cancelled', 'You can close this tab and return to your terminal.') - ) + const cancelledUrl = new URL(completionUrl) + cancelledUrl.searchParams.set('status', 'cancelled') + response.writeHead(302, { location: cancelledUrl.toString() }).end() finish({ ok: false, error: @@ -506,7 +494,7 @@ function listenForCallback( export interface BrowserLoginOptions { scopes: readonly string[] - /** Pin the loopback port, for a container that forwards a fixed one. */ + /** Pin the loopback port when an SSH tunnel forwards that same port. */ callbackPort?: number /** Called with the authorize URL once the listener is up, before waiting. */ onAuthorizeUrl: (url: string) => void From 12e9b8689c028d06692f22e2aadf2b78397b6ba9 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 16:51:48 -0700 Subject: [PATCH 27/31] =?UTF-8?q?fix(scim):=20certification=20pass=20?= =?UTF-8?q?=E2=80=94=20removal=20side=20effects,=20hourly=20sweep,=20dead?= =?UTF-8?q?=20surface,=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Organization removal no longer deletes personal API keys except when the directory deprovisions; a member removing themselves keeps their own session. Every other caller keeps the session revocation - The reconcile interval is shorter than the cron period, so the once-an-hour guarantee actually holds - Removed: defaultWorkspaceGrants (no client, no docs), the unused tombstone and delete helpers, parameters no caller varied, the duplicate discovery list helper; the routes barrel exports the SCIM builders; group cap raised to 5,000 - Docs: per-resource filters and limits, authentication failures absent from Activity, name matching and the permanent explicit-membership switch, default group not a target, credential expiry choices, SSO and both flags as prerequisites, what disabling the connection does Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01DGXcwsHzYGp6pUDWRtJKpz --- .../content/docs/platform/enterprise/scim.mdx | 20 ++++++++--- .../[id]/members/[memberId]/route.ts | 1 + .../[id]/transfer-ownership/route.ts | 1 + .../api/scim/v2/ResourceTypes/[id]/route.ts | 2 +- .../app/api/scim/v2/ResourceTypes/route.ts | 9 +++-- .../sim/app/api/scim/v2/Schemas/[id]/route.ts | 2 +- apps/sim/app/api/scim/v2/Schemas/route.ts | 9 +++-- .../scim/v2/ServiceProviderConfig/route.ts | 2 +- apps/sim/ee/README.md | 2 +- .../ee/scim/application/admin/connection.ts | 21 +----------- .../users/deprovision-user.test.ts | 1 + .../application/users/deprovision-user.ts | 1 + .../{constants.ts => components/options.ts} | 0 apps/sim/ee/scim/components/scim-section.tsx | 2 +- apps/sim/ee/scim/identity/resolve-user.ts | 21 ------------ apps/sim/ee/scim/managed-membership.ts | 5 ++- apps/sim/ee/scim/projection/grants.test.ts | 15 --------- apps/sim/ee/scim/projection/grants.ts | 25 +++----------- apps/sim/ee/scim/projection/reconcile-user.ts | 33 ++++++++----------- apps/sim/ee/scim/protocol/constants.ts | 2 +- apps/sim/ee/scim/protocol/discovery.ts | 12 ------- apps/sim/ee/scim/reconcile/job.ts | 9 ++--- apps/sim/ee/scim/repository/users.ts | 4 --- apps/sim/ee/scim/route.ts | 2 +- .../lib/api/contracts/organization-scim.ts | 6 ---- apps/sim/lib/api/server/routes/index.ts | 4 +++ .../lib/api/server/routes/scim-route.test.ts | 2 +- .../lib/billing/organizations/membership.ts | 29 ++++++++++++---- .../application/group-membership.ts | 30 ++++++----------- packages/db/schema.ts | 7 ---- 30 files changed, 101 insertions(+), 178 deletions(-) rename apps/sim/ee/scim/{constants.ts => components/options.ts} (100%) diff --git a/apps/docs/content/docs/platform/enterprise/scim.mdx b/apps/docs/content/docs/platform/enterprise/scim.mdx index afd411c5b09..263e1bb4e51 100644 --- a/apps/docs/content/docs/platform/enterprise/scim.mdx +++ b/apps/docs/content/docs/platform/enterprise/scim.mdx @@ -13,7 +13,7 @@ Directory provisioning connects your identity provider to Sim over SCIM 2.0. You It pairs with [SSO](/platform/enterprise/sso). SSO proves who someone is when they sign in. Directory provisioning decides who exists and what they can reach, before and after that. - Enterprise plans. Requires at least one [verified domain](/platform/enterprise/verified-domains) for your organization. Self-hosted deployments turn it on with `SCIM_ENABLED=true` and `NEXT_PUBLIC_SCIM_ENABLED=true`, alongside the [SSO variables](/platform/enterprise/sso#self-hosted-setup). + Enterprise plans. Requires [SSO](/platform/enterprise/sso) to be enabled, because provisioning is configured from the SSO settings page, and at least one [verified domain](/platform/enterprise/verified-domains) for your organization. Self-hosted deployments turn it on with `SCIM_ENABLED=true` (the server) and `NEXT_PUBLIC_SCIM_ENABLED=true` (the settings page), alongside the [SSO variables](/platform/enterprise/sso#self-hosted-setup). ## What it does @@ -54,7 +54,7 @@ https:///api/scim/v2 ### Issue a credential -Select **Issue credential**. The token appears once — copy it straight into your provider. +Choose whether the credential expires (never, 90 days, or a year) and select **Issue credential**. The token appears once — copy it straight into your provider. Two credentials can be active at a time, so you can rotate without downtime: issue the new one, update your provider, confirm a sync succeeds, then revoke the old one. @@ -121,7 +121,11 @@ Groups mean nothing to Sim until you say what they stand for. In **Settings → - a **workspace**, at Read, Write, or Admin - the **organization admin role** -A group can carry several mappings. When two groups grant the same workspace at different levels, the stronger one wins. +A group can carry several mappings. When two groups grant the same workspace at different levels, the stronger one wins. The organization's default permission group cannot be a target: it governs by having no members. + +Turning on **Match permission groups by name** maps a pushed group to an existing permission group of the same name automatically, and remaps it when the group is renamed. Nothing is created. + +Mapping a permission group to a directory group switches that permission group to explicit membership permanently: it governs exactly the people in it, and an empty group governs nobody. A permission group that governed everyone in its workspaces stops doing so the moment it is mapped, so map groups you created for the directory rather than your organization-wide ones. @@ -141,7 +145,7 @@ If you want the directory to be the only way in, enable **Disable just-in-time p ## Watching a sync -**Settings → SSO → Directory provisioning → Activity** lists recent requests with their status and, for a failure, what was wrong. Providers report a failed cycle without saying what they sent, so this is usually the fastest way to see the cause. +**Settings → SSO → Directory provisioning → Activity** lists recent authenticated requests with their status and, for a failure, what was wrong. Providers report a failed cycle without saying what they sent, so this is usually the fastest way to see the cause. A request that fails to authenticate has no connection to log against, so a wrong or revoked token shows up only as your provider's own authentication error. Sim also re-applies every group mapping once an hour, so drift cannot persist. You can run it on demand with **Reconcile now**, which is also how a change to the connection settings reaches members before the next sync. @@ -150,7 +154,9 @@ Sim also re-applies every group mapping once an hour, so drift cannot persist. Y - Base URL: `https:///api/scim/v2` - Authentication: `Authorization: Bearer ` - Resources: `/Users`, `/Groups`, plus `/ServiceProviderConfig`, `/ResourceTypes`, and `/Schemas` -- Filters: `eq`, joined with `and`, on `id`, `userName`, `externalId`, `emails.value`, `active`, and `displayName` +- Filters: `eq` only, up to ten terms joined with `and`. Users: `id`, `userName`, `externalId`, `emails.value` (also `emails[type eq "work"].value`), `active`. Groups: `id`, `displayName`, `externalId` +- Limits: 1,500 requests per minute per connection, 1 MB per request, 5,000 members per group +- `userName` is stored and returned lower-cased; attributes Sim does not model are kept and returned as sent, and a PUT preserves ones it omits - Page size: up to 100 per request discoveryList(resourceTypes(baseUrl))) +export const GET = defineScimDiscoveryRoute((baseUrl) => + toListResponse(resourceTypes(baseUrl), resourceTypes(baseUrl).length, 1) +) diff --git a/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts b/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts index 431f7aa4aa1..f2a182fe897 100644 --- a/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts @@ -1,4 +1,4 @@ -import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' +import { defineScimDiscoveryRoute } from '@/lib/api/server/routes' import { schemaDefinitions } from '@/ee/scim/protocol/discovery' import { notFound } from '@/ee/scim/protocol/errors' diff --git a/apps/sim/app/api/scim/v2/Schemas/route.ts b/apps/sim/app/api/scim/v2/Schemas/route.ts index 92225bc4080..b72f09c0b6a 100644 --- a/apps/sim/app/api/scim/v2/Schemas/route.ts +++ b/apps/sim/app/api/scim/v2/Schemas/route.ts @@ -1,4 +1,7 @@ -import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' -import { discoveryList, schemaDefinitions } from '@/ee/scim/protocol/discovery' +import { defineScimDiscoveryRoute } from '@/lib/api/server/routes' +import { schemaDefinitions } from '@/ee/scim/protocol/discovery' +import { toListResponse } from '@/ee/scim/protocol/resources' -export const GET = defineScimDiscoveryRoute((baseUrl) => discoveryList(schemaDefinitions(baseUrl))) +export const GET = defineScimDiscoveryRoute((baseUrl) => + toListResponse(schemaDefinitions(baseUrl), schemaDefinitions(baseUrl).length, 1) +) diff --git a/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts b/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts index 89cdc3bc5d9..8a61b9c1ad0 100644 --- a/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts +++ b/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts @@ -1,4 +1,4 @@ -import { defineScimDiscoveryRoute } from '@/lib/api/server/routes/scim-route' +import { defineScimDiscoveryRoute } from '@/lib/api/server/routes' import { serviceProviderConfig } from '@/ee/scim/protocol/discovery' /** Unauthenticated by design: a provider negotiates before it holds a credential. */ diff --git a/apps/sim/ee/README.md b/apps/sim/ee/README.md index 666bd8d5b1b..7739316ddc6 100644 --- a/apps/sim/ee/README.md +++ b/apps/sim/ee/README.md @@ -19,4 +19,4 @@ Production deployment requires an active Enterprise subscription. Enterprise features are imported directly throughout the codebase. The `ee/` directory is required at build time. Feature visibility is controlled at runtime via environment -variables (e.g., `NEXT_PUBLIC_ACCESS_CONTROL_ENABLED`, `NEXT_PUBLIC_SSO_ENABLED`, `NEXT_PUBLIC_SCIM_ENABLED`). +variables (e.g., `NEXT_PUBLIC_ACCESS_CONTROL_ENABLED`, `NEXT_PUBLIC_SSO_ENABLED`, `SCIM_ENABLED` with `NEXT_PUBLIC_SCIM_ENABLED`). diff --git a/apps/sim/ee/scim/application/admin/connection.ts b/apps/sim/ee/scim/application/admin/connection.ts index 460af6ca6be..220ab037a0e 100644 --- a/apps/sim/ee/scim/application/admin/connection.ts +++ b/apps/sim/ee/scim/application/admin/connection.ts @@ -6,11 +6,7 @@ import { desc, eq } from 'drizzle-orm' import type { ScimConnectionSettingsInput } from '@/lib/api/contracts/organization-scim' import { acquireOrganizationMutationLock } from '@/lib/billing/organizations/membership' import { OrchestrationError } from '@/lib/core/orchestration/types' -import { - assertWorkspaceInOrganization, - loadConnectionView, - requireConnection, -} from '@/ee/scim/application/admin/connection-view' +import { loadConnectionView, requireConnection } from '@/ee/scim/application/admin/connection-view' import { defineAuthorizedScimAdminUseCase, type ScimAdminUseCaseArgs, @@ -36,21 +32,6 @@ export interface ConfigureScimConnectionInput { export const configureScimConnection = defineAuthorizedScimAdminUseCase({ operation: scimAdminOperations.configure, async execute({ input, context }: ScimAdminUseCaseArgs) { - /** - * A default grant hands every provisioned member a workspace, so the - * workspace must be this organization's — the same check a group mapping - * gets, or an administrator could name a workspace id from another tenant. - */ - for (const grant of input.settings?.defaultWorkspaceGrants ?? []) { - await assertWorkspaceInOrganization(context.organizationId, grant.workspaceId) - } - - /** - * Read, merge, and write under the organization lock, so two administrators - * changing different settings at once both land instead of the later write - * carrying a stale copy of the earlier one's field — and two first-time - * enables, where there is no row yet to lock, cannot both insert. - */ const { created, previousStatus, status } = await db.transaction(async (tx) => { await acquireOrganizationMutationLock(tx, context.organizationId) const [existing] = await tx diff --git a/apps/sim/ee/scim/application/users/deprovision-user.test.ts b/apps/sim/ee/scim/application/users/deprovision-user.test.ts index 26760b66af8..85482c8691d 100644 --- a/apps/sim/ee/scim/application/users/deprovision-user.test.ts +++ b/apps/sim/ee/scim/application/users/deprovision-user.test.ts @@ -73,6 +73,7 @@ describe('deprovisionScimUser', () => { userId: 'u-1', organizationId: 'org-1', memberId: 'm-1', + revokePersonalApiKeys: true, }) expect(mocks.endDirectoryMembership).not.toHaveBeenCalled() expect(result.removedFromOrganization).toBe(true) diff --git a/apps/sim/ee/scim/application/users/deprovision-user.ts b/apps/sim/ee/scim/application/users/deprovision-user.ts index d2192d03565..4f43469f059 100644 --- a/apps/sim/ee/scim/application/users/deprovision-user.ts +++ b/apps/sim/ee/scim/application/users/deprovision-user.ts @@ -74,6 +74,7 @@ export const deprovisionScimUser = defineAuthorizedScimUseCase({ userId: current.userId, organizationId: context.organizationId, memberId: membership.id, + revokePersonalApiKeys: true, }) if (!removal.success) { throw new ScimError(409, undefined, removal.error ?? 'The member could not be removed') diff --git a/apps/sim/ee/scim/constants.ts b/apps/sim/ee/scim/components/options.ts similarity index 100% rename from apps/sim/ee/scim/constants.ts rename to apps/sim/ee/scim/components/options.ts diff --git a/apps/sim/ee/scim/components/scim-section.tsx b/apps/sim/ee/scim/components/scim-section.tsx index c7c32d38393..19fcdd092fd 100644 --- a/apps/sim/ee/scim/components/scim-section.tsx +++ b/apps/sim/ee/scim/components/scim-section.tsx @@ -45,7 +45,7 @@ import { SETTING_TOGGLES, TARGET_KIND_OPTIONS, type WorkspacePermission, -} from '@/ee/scim/constants' +} from '@/ee/scim/components/options' import { useConfigureScimConnection, useDeleteScimGroupMapping, diff --git a/apps/sim/ee/scim/identity/resolve-user.ts b/apps/sim/ee/scim/identity/resolve-user.ts index 616499a2054..683c2dce723 100644 --- a/apps/sim/ee/scim/identity/resolve-user.ts +++ b/apps/sim/ee/scim/identity/resolve-user.ts @@ -1,5 +1,4 @@ import { member, type ScimUserAttributes, scimUserTombstone, ssoDomain, user } from '@sim/db/schema' -import { generateId } from '@sim/utils/id' import { normalizeSSODomain } from '@sim/utils/sso-domain' import { isValidEmailSyntax, normalizeEmail } from '@sim/utils/string' import { and, eq, sql } from 'drizzle-orm' @@ -151,26 +150,6 @@ export async function resolveProvisionedIdentity( return { action: 'link', userId: existing.id, via: 'verified-domain' } } -/** Records that an external identity was deprovisioned, so a later recreate relinks. */ -export async function upsertTombstone( - tx: DbOrTx, - params: { connectionId: string; externalId: string; userId: string } -): Promise { - await tx - .insert(scimUserTombstone) - .values({ - id: generateId(), - connectionId: params.connectionId, - externalId: params.externalId, - userId: params.userId, - deletedAt: new Date(), - }) - .onConflictDoUpdate({ - target: [scimUserTombstone.connectionId, scimUserTombstone.externalId], - set: { userId: params.userId, deletedAt: new Date() }, - }) -} - /** Clears a tombstone once its identity has been provisioned again. */ export async function consumeTombstone( tx: DbOrTx, diff --git a/apps/sim/ee/scim/managed-membership.ts b/apps/sim/ee/scim/managed-membership.ts index 5e8c8aecd47..9b0ac64c3e7 100644 --- a/apps/sim/ee/scim/managed-membership.ts +++ b/apps/sim/ee/scim/managed-membership.ts @@ -1,4 +1,3 @@ -import { db } from '@sim/db' import { scimConnection, scimUser } from '@sim/db/schema' import { type AnyColumn, type SQL, sql } from 'drizzle-orm' import { ForbiddenOperationError } from '@/lib/core/application' @@ -52,14 +51,14 @@ export function scimManagedUserPredicate( export async function assertMembershipNotScimManaged(params: { organizationId: string userId: string - executor?: DbOrTx + executor: DbOrTx }): Promise { /** * A deployment or plan that no longer has directory provisioning must not keep * refusing manual changes on behalf of a directory that can no longer sync. */ if (!isScimEnabled) return - const [row] = await (params.executor ?? db) + const [row] = await params.executor .select({ managed: scimManagedUserPredicate(params.organizationId, sql`${params.userId}`) }) .from(sql`(select 1) as probe`) if (!row?.managed) return diff --git a/apps/sim/ee/scim/projection/grants.test.ts b/apps/sim/ee/scim/projection/grants.test.ts index 3806a78100d..b3792805a00 100644 --- a/apps/sim/ee/scim/projection/grants.test.ts +++ b/apps/sim/ee/scim/projection/grants.test.ts @@ -38,21 +38,6 @@ describe('resolveDesiredGrants', () => { expect(desired[0].permissionType).toBe('write') }) - it('lets a group raise a connection default', () => { - const desired = resolveDesiredGrants( - [workspaceRow('ws-1', 'write')], - [{ workspaceId: 'ws-1', permission: 'read' }] - ) - expect(desired).toEqual([ - { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'write' }, - ]) - }) - - it('keeps a connection default the groups do not mention', () => { - const desired = resolveDesiredGrants([], [{ workspaceId: 'ws-1', permission: 'read' }]) - expect(desired).toEqual([{ targetKind: 'workspace', targetId: 'ws-1', permissionType: 'read' }]) - }) - it('emits one grant per permission group and per role however many groups repeat them', () => { const rows: MappingRow[] = [ { diff --git a/apps/sim/ee/scim/projection/grants.ts b/apps/sim/ee/scim/projection/grants.ts index 2b3c1924e8d..131cf23f555 100644 --- a/apps/sim/ee/scim/projection/grants.ts +++ b/apps/sim/ee/scim/projection/grants.ts @@ -33,26 +33,17 @@ export interface MappingRow { role: string | null } -export interface DefaultWorkspaceGrant { - workspaceId: string - permission: PermissionType -} - function grantKey(grant: ProjectionGrant): string { return `${grant.targetKind}:${grant.targetId}` } /** - * Collapses mapping rows and connection defaults into one grant per target. + * Collapses mapping rows into one grant per target. * - * Two groups granting the same workspace resolve to the stronger level, and a - * connection default is treated like any other mapping so a group can raise it. - * Rows whose target column is missing describe nothing and are dropped. + * Two groups granting the same workspace resolve to the stronger level. Rows + * whose target column is missing describe nothing and are dropped. */ -export function resolveDesiredGrants( - rows: readonly MappingRow[], - defaults: readonly DefaultWorkspaceGrant[] = [] -): ProjectionGrant[] { +export function resolveDesiredGrants(rows: readonly MappingRow[]): ProjectionGrant[] { const byKey = new Map() const offer = (grant: ProjectionGrant) => { @@ -68,14 +59,6 @@ export function resolveDesiredGrants( } } - for (const grant of defaults) { - offer({ - targetKind: 'workspace', - targetId: grant.workspaceId, - permissionType: grant.permission, - }) - } - for (const row of rows) { if (row.targetKind === 'permission_group' && row.permissionGroupId) { offer({ targetKind: 'permission_group', targetId: row.permissionGroupId }) diff --git a/apps/sim/ee/scim/projection/reconcile-user.ts b/apps/sim/ee/scim/projection/reconcile-user.ts index fe61854f9df..1fa818b717c 100644 --- a/apps/sim/ee/scim/projection/reconcile-user.ts +++ b/apps/sim/ee/scim/projection/reconcile-user.ts @@ -62,6 +62,9 @@ export interface ProjectionDelta { const EMPTY_DELTA: ProjectionDelta = { added: [], removed: [], raised: [] } +/** Users per transaction when projecting outside a request's own transaction; the organization lock is held for the batch. */ +const PROJECTION_BATCH_SIZE = 25 + /** * The mapping rows this user reaches through their groups. * @@ -107,7 +110,7 @@ async function currentGrants(tx: DbOrTx, scimUserId: string): Promise { +): Promise { const { grant } = params switch (grant.targetKind) { case 'workspace': { @@ -173,8 +176,6 @@ async function applyGrant( organizationId: params.organizationId, groupId: grant.targetId, userId: params.userId, - assignedBy: null, - lockTimeoutAlreadyBounded: true, }) return outcome === 'already-member' ? 'unchanged' : 'applied' } @@ -194,7 +195,7 @@ async function setOrganizationRole( organizationId: string, userId: string, role: 'admin' | 'member' -): Promise { +): Promise { try { const change = await changeMemberRoleTx(tx, { organizationId, userId, role }) return change.changed ? 'applied' : 'unchanged' @@ -281,7 +282,6 @@ async function withdrawGrant( organizationId: params.organizationId, groupId: grant.targetId, userId: params.userId, - lockTimeoutAlreadyBounded: true, }) } catch (error) { /** @@ -321,10 +321,10 @@ export async function reconcileUserProjection( if (!record) return EMPTY_DELTA /** - * Taken before any target is touched so the documented order holds: the - * organization and membership locks first, the permission-group leaf lock - * last. A withdrawal that reached the leaf lock before a later grant took the - * organization lock would invert that order against a concurrent request. + * Taken before any target is touched. The organization lock is the root of + * every write path that reaches these tables, so holding it first is what + * rules out a deadlock with the settings routes and with concurrent syncs; + * the permission-group leaf lock is only ever taken underneath it. */ await acquireOrganizationUserMutationLocks(tx, { userId: record.userId, @@ -332,10 +332,7 @@ export async function reconcileUserProjection( }) const current = await currentGrants(tx, params.scimUserId) - const mapped = resolveDesiredGrants( - await loadMappingRows(tx, params.scimUserId), - params.settings.defaultWorkspaceGrants ?? [] - ) + const mapped = resolveDesiredGrants(await loadMappingRows(tx, params.scimUserId)) const foreignWorkspaceIds = await findForeignWorkspaces( tx, [...mapped, ...current] @@ -380,7 +377,7 @@ export async function reconcileUserProjection( } for (const { grant, previousPermission } of plan.apply) { - let applied: GrantApplication + let applied: GrantOutcome try { applied = await applyGrant(tx, { organizationId: params.organizationId, @@ -488,13 +485,11 @@ export async function reconcileUsersProjectionInBatches(params: { organizationId: string scimUserIds: string[] settings: ScimConnectionSettings - batchSize?: number }): Promise { const total: ProjectionDelta = { added: [], removed: [], raised: [] } const ids = [...new Set(params.scimUserIds)].sort() - const size = params.batchSize ?? 200 - for (let start = 0; start < ids.length; start += size) { - const batch = ids.slice(start, start + size) + for (let start = 0; start < ids.length; start += PROJECTION_BATCH_SIZE) { + const batch = ids.slice(start, start + PROJECTION_BATCH_SIZE) await db.transaction(async (tx) => { for (const scimUserId of batch) { const delta = await reconcileUserProjection(tx, { diff --git a/apps/sim/ee/scim/protocol/constants.ts b/apps/sim/ee/scim/protocol/constants.ts index 3a86b755eb2..fa922fcea03 100644 --- a/apps/sim/ee/scim/protocol/constants.ts +++ b/apps/sim/ee/scim/protocol/constants.ts @@ -28,7 +28,7 @@ export const SCIM_BASE_PATH = '/api/scim/v2' export const SCIM_MAX_PAGE_SIZE = 100 /** Largest membership a single Group may carry. */ -export const SCIM_MAX_GROUP_MEMBERS = 1000 +export const SCIM_MAX_GROUP_MEMBERS = 5000 /** Largest number of `and`-joined terms accepted in one filter. */ export const SCIM_MAX_FILTER_TERMS = 10 diff --git a/apps/sim/ee/scim/protocol/discovery.ts b/apps/sim/ee/scim/protocol/discovery.ts index c5f87bffd08..3823bb06fcc 100644 --- a/apps/sim/ee/scim/protocol/discovery.ts +++ b/apps/sim/ee/scim/protocol/discovery.ts @@ -1,7 +1,6 @@ import { SCIM_ENTERPRISE_USER_SCHEMA, SCIM_GROUP_SCHEMA, - SCIM_LIST_RESPONSE_SCHEMA, SCIM_MAX_PAGE_SIZE, SCIM_RESOURCE_TYPE_SCHEMA, SCIM_SCHEMA_SCHEMA, @@ -162,14 +161,3 @@ export function schemaDefinitions(baseUrl: string) { }, ] } - -/** Wraps discovery documents in the list envelope RFC 7644 requires. */ -export function discoveryList(resources: unknown[]) { - return { - schemas: [SCIM_LIST_RESPONSE_SCHEMA], - totalResults: resources.length, - startIndex: 1, - itemsPerPage: resources.length, - Resources: resources, - } -} diff --git a/apps/sim/ee/scim/reconcile/job.ts b/apps/sim/ee/scim/reconcile/job.ts index fab3143c8eb..d32f991c432 100644 --- a/apps/sim/ee/scim/reconcile/job.ts +++ b/apps/sim/ee/scim/reconcile/job.ts @@ -27,11 +27,12 @@ const LEASE_TTL_MS = 15 * 60 * 1000 /** * How often a connection is swept when nothing else triggers it. * - * Matches the cron's cadence: every connection is re-walked once an hour, oldest - * first. A pass over an in-sync tenant is reads only, so the hourly guarantee - * the docs make costs little. + * The cron fires hourly and stamps `reconciledAt` at the end of a pass, so a + * connection is due on the next tick only if this interval is comfortably + * shorter than the cron period; an interval equal to it would skip every other + * tick. Fifty minutes keeps the once-an-hour guarantee the docs make. */ -const RECONCILE_INTERVAL_MS = 60 * 60 * 1000 +const RECONCILE_INTERVAL_MS = 50 * 60 * 1000 /** * Users reconciled per transaction. The organization lock is held for the whole diff --git a/apps/sim/ee/scim/repository/users.ts b/apps/sim/ee/scim/repository/users.ts index ac163b6d118..8f296b07746 100644 --- a/apps/sim/ee/scim/repository/users.ts +++ b/apps/sim/ee/scim/repository/users.ts @@ -250,10 +250,6 @@ export async function updateScimUser( .where(eq(scimUser.id, params.scimUserId)) } -export async function deleteScimUser(tx: DbOrTx, scimUserId: string): Promise { - await tx.delete(scimUser).where(eq(scimUser.id, scimUserId)) -} - /** All provisioned users on a connection, in pages, for the reconcile job. */ export async function listScimUserIds( tx: DbOrTx, diff --git a/apps/sim/ee/scim/route.ts b/apps/sim/ee/scim/route.ts index 437d883b521..17bbc75ac9a 100644 --- a/apps/sim/ee/scim/route.ts +++ b/apps/sim/ee/scim/route.ts @@ -1,4 +1,4 @@ -import { createScimRouteBuilder } from '@/lib/api/server/routes/scim-route' +import { createScimRouteBuilder } from '@/lib/api/server/routes' import { authenticateScimRequest } from '@/ee/scim/authenticate' import { scimBaseUrl } from '@/ee/scim/base-url' import { recordScimRequest } from '@/ee/scim/request-log' diff --git a/apps/sim/lib/api/contracts/organization-scim.ts b/apps/sim/lib/api/contracts/organization-scim.ts index af2f1908884..e9eb7d34368 100644 --- a/apps/sim/lib/api/contracts/organization-scim.ts +++ b/apps/sim/lib/api/contracts/organization-scim.ts @@ -12,16 +12,10 @@ const organizationParamsSchema = z.object({ id: organizationIdSchema }) const scimScopeSchema = z.enum(['users:read', 'users:write', 'groups:read', 'groups:write']) -const workspaceGrantSchema = z.object({ - workspaceId: z.string().min(1).max(128), - permission: z.enum(['admin', 'write', 'read']), -}) - export const scimConnectionSettingsSchema = z.object({ lockManualMembership: z.boolean().optional(), disableJit: z.boolean().optional(), autoMapPermissionGroupsByName: z.boolean().optional(), - defaultWorkspaceGrants: z.array(workspaceGrantSchema).max(50).optional(), }) export type ScimConnectionSettingsInput = z.input diff --git a/apps/sim/lib/api/server/routes/index.ts b/apps/sim/lib/api/server/routes/index.ts index d19270b906d..e42507d6cc8 100644 --- a/apps/sim/lib/api/server/routes/index.ts +++ b/apps/sim/lib/api/server/routes/index.ts @@ -17,6 +17,10 @@ export { createInternalResourceConcealmentPolicy, createV2ResourceConcealmentPolicy, } from '@/lib/api/server/routes/resource-concealment' +export { + createScimRouteBuilder, + defineScimDiscoveryRoute, +} from '@/lib/api/server/routes/scim-route' export { defineV2BinaryRoute } from '@/lib/api/server/routes/v2-binary-route' export { defineV2BodyLifecycleRoute } from '@/lib/api/server/routes/v2-body-lifecycle-route' export { diff --git a/apps/sim/lib/api/server/routes/scim-route.test.ts b/apps/sim/lib/api/server/routes/scim-route.test.ts index 9a0c09a6bae..e8c2a0c258f 100644 --- a/apps/sim/lib/api/server/routes/scim-route.test.ts +++ b/apps/sim/lib/api/server/routes/scim-route.test.ts @@ -23,7 +23,7 @@ import { deleteScimUserContract, listScimUsersContract, } from '@/lib/api/contracts/scim' -import { createScimRouteBuilder } from '@/lib/api/server/routes/scim-route' +import { createScimRouteBuilder } from '@/lib/api/server/routes' import { scimOperations } from '@/ee/scim/application/operations' import { SCIM_MEDIA_TYPE } from '@/ee/scim/protocol/constants' import { ScimError } from '@/ee/scim/protocol/errors' diff --git a/apps/sim/lib/billing/organizations/membership.ts b/apps/sim/lib/billing/organizations/membership.ts index a1973053538..85b6f263412 100644 --- a/apps/sim/lib/billing/organizations/membership.ts +++ b/apps/sim/lib/billing/organizations/membership.ts @@ -470,6 +470,15 @@ export interface RemoveMemberParams { memberId: string /** Skip departed usage capture and Pro restoration (default: false) */ skipBillingLogic?: boolean + /** + * Also delete the member's personal API keys. Off by default: personal keys + * are the person's own and outlive one organization. Directory + * deprovisioning turns it on, because there the person is leaving Sim as far + * as the organization is concerned. + */ + revokePersonalApiKeys?: boolean + /** The caller's own session token, kept alive when a member removes themselves. */ + spareSessionToken?: string /** * Only remove the member when they hold no remaining permission on any of the * org's workspaces, evaluated atomically under the membership lock. Used by @@ -1243,6 +1252,8 @@ export async function removeUserFromOrganization( memberId, skipBillingLogic = false, requireNoOrgWorkspaceAccess = false, + revokePersonalApiKeys = false, + spareSessionToken, } = params const billingActions = { @@ -1339,14 +1350,18 @@ export async function removeUserFromOrganization( ) /** - * Leaving ends live access at once: sessions and personal API keys go - * with the membership rather than lingering until a cookie cache lapses, - * and any directory row that described this membership is replaced by - * its tombstone in the same commit, so the directory and the - * organization can never disagree about who is a member. + * Leaving ends live access at once: sessions go with the membership + * rather than lingering until a cookie cache lapses, and any directory + * row that described this membership is replaced by its tombstone in the + * same commit, so the directory and the organization can never disagree + * about who is a member. */ - await revokeUserSessionsTx(tx, { userId, organizationId }) - await revokePersonalApiKeysTx(tx, { userId }) + await revokeUserSessionsTx(tx, { + userId, + organizationId, + ...(spareSessionToken ? { spareSessionToken } : {}), + }) + if (revokePersonalApiKeys) await revokePersonalApiKeysTx(tx, { userId }) await endDirectoryMembershipTx(tx, { userId, organizationId }) if (workspaceIds.length === 0) { diff --git a/apps/sim/lib/permission-groups/application/group-membership.ts b/apps/sim/lib/permission-groups/application/group-membership.ts index d525f0b66d7..a46b68ce1c1 100644 --- a/apps/sim/lib/permission-groups/application/group-membership.ts +++ b/apps/sim/lib/permission-groups/application/group-membership.ts @@ -199,23 +199,18 @@ async function loadLockedGroup( export type AddPermissionGroupMemberResult = 'added' | 'already-member' /** - * Adds a user to a permission group. + * Adds a user to a permission group on the directory's behalf. * - * Takes the organization's permission-group lock, which the lock ordering - * documents as a leaf: acquire no further advisory lock after this one. + * The caller holds the organization lock, which has already bounded + * `lock_timeout`; the permission-group lock taken here is the leaf, so no + * further advisory lock may follow it. The membership has no human author. */ export async function addPermissionGroupMemberTx( tx: DbOrTx, - params: { - organizationId: string - groupId: string - userId: string - assignedBy: string | null - lockTimeoutAlreadyBounded?: boolean - } + params: { organizationId: string; groupId: string; userId: string } ): Promise { await acquirePermissionGroupOrgLock(tx, params.organizationId, { - lockTimeoutAlreadyBounded: params.lockTimeoutAlreadyBounded ?? false, + lockTimeoutAlreadyBounded: true, }) const group = await loadLockedGroup(tx, params.organizationId, params.groupId) @@ -247,7 +242,7 @@ export async function addPermissionGroupMemberTx( permissionGroupId: params.groupId, organizationId: params.organizationId, userId: params.userId, - assignedBy: params.assignedBy, + assignedBy: null, assignedAt: new Date(), }) return 'added' @@ -255,18 +250,13 @@ export async function addPermissionGroupMemberTx( export type RemovePermissionGroupMemberResult = 'removed' | 'not-a-member' -/** Removes a user from a permission group. */ +/** Removes a user from a permission group; the caller holds the organization lock. */ export async function removePermissionGroupMemberTx( tx: DbOrTx, - params: { - organizationId: string - groupId: string - userId: string - lockTimeoutAlreadyBounded?: boolean - } + params: { organizationId: string; groupId: string; userId: string } ): Promise { await acquirePermissionGroupOrgLock(tx, params.organizationId, { - lockTimeoutAlreadyBounded: params.lockTimeoutAlreadyBounded ?? false, + lockTimeoutAlreadyBounded: true, }) const group = await loadLockedGroup(tx, params.organizationId, params.groupId) diff --git a/packages/db/schema.ts b/packages/db/schema.ts index 31561a7d438..0897a449e9c 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -5845,12 +5845,6 @@ export const SCIM_SCOPES: readonly ScimScope[] = [ 'groups:write', ] -/** A workspace every provisioned user receives, at the named permission. */ -export interface ScimDefaultWorkspaceGrant { - workspaceId: string - permission: 'admin' | 'write' | 'read' -} - /** Administrator-controlled behavior of one organization's SCIM connection. */ export interface ScimConnectionSettings { /** @@ -5868,7 +5862,6 @@ export interface ScimConnectionSettings { /** Map a pushed group to an existing permission group of the same name. Nothing is created. */ autoMapPermissionGroupsByName?: boolean /** Workspaces every provisioned user receives regardless of group membership. */ - defaultWorkspaceGrants?: ScimDefaultWorkspaceGrant[] } /** One email address as the identity provider supplied it. */ From fa214ea2881371096467849fc93745a33c427474 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 17:05:09 -0700 Subject: [PATCH 28/31] refactor(scim): keep the server code at ee/scim/lib, matching the other enterprise features Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01DGXcwsHzYGp6pUDWRtJKpz --- apps/sim/app/api/cron/scim-reconcile/route.ts | 2 +- .../[id]/members/[memberId]/route.ts | 2 +- .../organizations/[id]/scim/activity/route.ts | 2 +- .../scim/credentials/[credentialId]/route.ts | 2 +- .../[id]/scim/credentials/route.ts | 2 +- .../[id]/scim/mappings/[mappingId]/route.ts | 2 +- .../organizations/[id]/scim/mappings/route.ts | 5 ++++- .../[id]/scim/reconcile/route.ts | 2 +- .../app/api/organizations/[id]/scim/route.ts | 5 ++++- apps/sim/app/api/scim/v2/Groups/[id]/route.ts | 8 +++---- apps/sim/app/api/scim/v2/Groups/route.ts | 8 +++---- .../api/scim/v2/ResourceTypes/[id]/route.ts | 4 ++-- .../app/api/scim/v2/ResourceTypes/route.ts | 4 ++-- .../sim/app/api/scim/v2/Schemas/[id]/route.ts | 4 ++-- apps/sim/app/api/scim/v2/Schemas/route.ts | 4 ++-- .../scim/v2/ServiceProviderConfig/route.ts | 2 +- apps/sim/app/api/scim/v2/Users/[id]/route.ts | 12 +++++----- apps/sim/app/api/scim/v2/Users/route.ts | 12 +++++----- .../application/admin/connection-view.ts | 4 ++-- .../{ => lib}/application/admin/connection.ts | 11 ++++++---- .../application/admin/credentials.ts | 13 ++++++----- .../{ => lib}/application/admin/mappings.ts | 8 +++---- .../ee/scim/{ => lib}/application/audit.ts | 0 .../authorized-scim-admin-use-case.ts | 6 ++--- .../application/authorized-scim-use-case.ts | 8 +++---- .../application/groups/manage-groups.ts | 22 +++++++++---------- .../scim/{ => lib}/application/operations.ts | 0 .../users/deprovision-user.test.ts | 12 +++++----- .../application/users/deprovision-user.ts | 10 ++++----- .../application/users/provision-user.ts | 18 +++++++-------- .../{ => lib}/application/users/read-users.ts | 12 +++++----- .../application/users/update-user.test.ts | 14 ++++++------ .../application/users/update-user.ts | 22 +++++++++---------- .../ee/scim/{ => lib}/authenticate.test.ts | 6 ++--- apps/sim/ee/scim/{ => lib}/authenticate.ts | 4 ++-- apps/sim/ee/scim/{ => lib}/base-url.ts | 2 +- .../sim/ee/scim/{ => lib}/entitlement.test.ts | 2 +- apps/sim/ee/scim/{ => lib}/entitlement.ts | 0 .../{ => lib}/identity/account-identity.ts | 2 +- .../identity/end-directory-membership.ts | 0 .../{ => lib}/identity/resolve-user.test.ts | 7 ++++-- .../scim/{ => lib}/identity/resolve-user.ts | 4 ++-- .../ee/scim/{ => lib}/managed-membership.ts | 0 .../{ => lib}/projection/auto-map.test.ts | 2 +- .../ee/scim/{ => lib}/projection/auto-map.ts | 0 .../scim/{ => lib}/projection/grants.test.ts | 2 +- .../ee/scim/{ => lib}/projection/grants.ts | 0 .../projection/reconcile-user.test.ts | 2 +- .../{ => lib}/projection/reconcile-user.ts | 2 +- .../scim/{ => lib}/protocol/canonical.test.ts | 8 +++---- .../ee/scim/{ => lib}/protocol/canonical.ts | 6 ++--- .../ee/scim/{ => lib}/protocol/constants.ts | 0 .../ee/scim/{ => lib}/protocol/discovery.ts | 2 +- apps/sim/ee/scim/{ => lib}/protocol/errors.ts | 2 +- .../ee/scim/{ => lib}/protocol/filter.test.ts | 4 ++-- apps/sim/ee/scim/{ => lib}/protocol/filter.ts | 6 ++--- .../{ => lib}/protocol/group-patch.test.ts | 6 ++--- .../ee/scim/{ => lib}/protocol/group-patch.ts | 6 ++--- .../ee/scim/{ => lib}/protocol/normalize.ts | 0 .../scim/{ => lib}/protocol/resources.test.ts | 6 ++--- .../ee/scim/{ => lib}/protocol/resources.ts | 4 ++-- .../{ => lib}/protocol/user-patch.test.ts | 4 ++-- .../ee/scim/{ => lib}/protocol/user-patch.ts | 4 ++-- apps/sim/ee/scim/{ => lib}/reconcile/job.ts | 8 +++---- .../scim/{ => lib}/repository/credentials.ts | 0 .../ee/scim/{ => lib}/repository/groups.ts | 4 ++-- .../sim/ee/scim/{ => lib}/repository/users.ts | 6 ++--- apps/sim/ee/scim/{ => lib}/request-log.ts | 4 ++-- apps/sim/ee/scim/{ => lib}/route.ts | 6 ++--- apps/sim/lib/api/contracts/scim.ts | 4 ++-- .../lib/api/server/routes/scim-route.test.ts | 6 ++--- apps/sim/lib/api/server/routes/scim-route.ts | 10 ++++----- .../lib/billing/organizations/membership.ts | 2 +- apps/sim/lib/core/application/operation.ts | 2 +- apps/sim/lib/invitations/direct-grant.ts | 2 +- .../lib/invitations/workspace-invitations.ts | 5 ++++- scripts/check-api-validation-contracts.ts | 2 +- 77 files changed, 207 insertions(+), 189 deletions(-) rename apps/sim/ee/scim/{ => lib}/application/admin/connection-view.ts (96%) rename apps/sim/ee/scim/{ => lib}/application/admin/connection.ts (94%) rename apps/sim/ee/scim/{ => lib}/application/admin/credentials.ts (92%) rename apps/sim/ee/scim/{ => lib}/application/admin/mappings.ts (97%) rename apps/sim/ee/scim/{ => lib}/application/audit.ts (100%) rename apps/sim/ee/scim/{ => lib}/application/authorized-scim-admin-use-case.ts (96%) rename apps/sim/ee/scim/{ => lib}/application/authorized-scim-use-case.ts (95%) rename apps/sim/ee/scim/{ => lib}/application/groups/manage-groups.ts (95%) rename apps/sim/ee/scim/{ => lib}/application/operations.ts (100%) rename apps/sim/ee/scim/{ => lib}/application/users/deprovision-user.test.ts (92%) rename apps/sim/ee/scim/{ => lib}/application/users/deprovision-user.ts (92%) rename apps/sim/ee/scim/{ => lib}/application/users/provision-user.ts (95%) rename apps/sim/ee/scim/{ => lib}/application/users/read-users.ts (89%) rename apps/sim/ee/scim/{ => lib}/application/users/update-user.test.ts (93%) rename apps/sim/ee/scim/{ => lib}/application/users/update-user.ts (93%) rename apps/sim/ee/scim/{ => lib}/authenticate.test.ts (97%) rename apps/sim/ee/scim/{ => lib}/authenticate.ts (97%) rename apps/sim/ee/scim/{ => lib}/base-url.ts (80%) rename apps/sim/ee/scim/{ => lib}/entitlement.test.ts (95%) rename apps/sim/ee/scim/{ => lib}/entitlement.ts (100%) rename apps/sim/ee/scim/{ => lib}/identity/account-identity.ts (95%) rename apps/sim/ee/scim/{ => lib}/identity/end-directory-membership.ts (100%) rename apps/sim/ee/scim/{ => lib}/identity/resolve-user.test.ts (96%) rename apps/sim/ee/scim/{ => lib}/identity/resolve-user.ts (97%) rename apps/sim/ee/scim/{ => lib}/managed-membership.ts (100%) rename apps/sim/ee/scim/{ => lib}/projection/auto-map.test.ts (97%) rename apps/sim/ee/scim/{ => lib}/projection/auto-map.ts (100%) rename apps/sim/ee/scim/{ => lib}/projection/grants.test.ts (99%) rename apps/sim/ee/scim/{ => lib}/projection/grants.ts (100%) rename apps/sim/ee/scim/{ => lib}/projection/reconcile-user.test.ts (99%) rename apps/sim/ee/scim/{ => lib}/projection/reconcile-user.ts (99%) rename apps/sim/ee/scim/{ => lib}/protocol/canonical.test.ts (94%) rename apps/sim/ee/scim/{ => lib}/protocol/canonical.ts (98%) rename apps/sim/ee/scim/{ => lib}/protocol/constants.ts (100%) rename apps/sim/ee/scim/{ => lib}/protocol/discovery.ts (99%) rename apps/sim/ee/scim/{ => lib}/protocol/errors.ts (98%) rename apps/sim/ee/scim/{ => lib}/protocol/filter.test.ts (95%) rename apps/sim/ee/scim/{ => lib}/protocol/filter.ts (96%) rename apps/sim/ee/scim/{ => lib}/protocol/group-patch.test.ts (95%) rename apps/sim/ee/scim/{ => lib}/protocol/group-patch.ts (97%) rename apps/sim/ee/scim/{ => lib}/protocol/normalize.ts (100%) rename apps/sim/ee/scim/{ => lib}/protocol/resources.test.ts (96%) rename apps/sim/ee/scim/{ => lib}/protocol/resources.ts (98%) rename apps/sim/ee/scim/{ => lib}/protocol/user-patch.test.ts (98%) rename apps/sim/ee/scim/{ => lib}/protocol/user-patch.ts (99%) rename apps/sim/ee/scim/{ => lib}/reconcile/job.ts (96%) rename apps/sim/ee/scim/{ => lib}/repository/credentials.ts (100%) rename apps/sim/ee/scim/{ => lib}/repository/groups.ts (98%) rename apps/sim/ee/scim/{ => lib}/repository/users.ts (98%) rename apps/sim/ee/scim/{ => lib}/request-log.ts (94%) rename apps/sim/ee/scim/{ => lib}/route.ts (73%) diff --git a/apps/sim/app/api/cron/scim-reconcile/route.ts b/apps/sim/app/api/cron/scim-reconcile/route.ts index e2be4773673..3dde99f8143 100644 --- a/apps/sim/app/api/cron/scim-reconcile/route.ts +++ b/apps/sim/app/api/cron/scim-reconcile/route.ts @@ -4,7 +4,7 @@ import { type NextRequest, NextResponse } from 'next/server' import { verifyCronAuth } from '@/lib/auth/internal' import { isScimEnabled } from '@/lib/core/config/env-flags' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' -import { runScimReconcileSweep } from '@/ee/scim/reconcile/job' +import { runScimReconcileSweep } from '@/ee/scim/lib/reconcile/job' const logger = createLogger('CronScimReconcile') diff --git a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts index 2052a8227e7..50e265f208f 100644 --- a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts @@ -23,7 +23,7 @@ import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { isRetryableTransactionError } from '@/lib/db/transaction' import { changeMemberRoleTx } from '@/lib/organizations/members/lifecycle' import { captureServerEvent } from '@/lib/posthog/server' -import { assertMembershipNotScimManaged } from '@/ee/scim/managed-membership' +import { assertMembershipNotScimManaged } from '@/ee/scim/lib/managed-membership' const logger = createLogger('OrganizationMemberAPI') diff --git a/apps/sim/app/api/organizations/[id]/scim/activity/route.ts b/apps/sim/app/api/organizations/[id]/scim/activity/route.ts index 28f8298814a..05ddcb54075 100644 --- a/apps/sim/app/api/organizations/[id]/scim/activity/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/activity/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { listScimActivity } from '@/ee/scim/application/admin/connection' +import { listScimActivity } from '@/ee/scim/lib/application/admin/connection' /** Recent provisioning requests, so a failing sync can be diagnosed from Sim. */ export const GET = defineInternalJsonRoute({ diff --git a/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts b/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts index 5008523fcf8..c81be93ca9a 100644 --- a/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/credentials/[credentialId]/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { revokeScimCredential } from '@/ee/scim/application/admin/credentials' +import { revokeScimCredential } from '@/ee/scim/lib/application/admin/credentials' export const DELETE = defineInternalJsonRoute({ contract: revokeScimCredentialContract, diff --git a/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts b/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts index fd4953e828f..8c79e5fc297 100644 --- a/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/credentials/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { issueScimCredential } from '@/ee/scim/application/admin/credentials' +import { issueScimCredential } from '@/ee/scim/lib/application/admin/credentials' /** Issues a bearer credential. The secret is returned once and never stored. */ export const POST = defineInternalJsonRoute({ diff --git a/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts b/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts index 46ab2653214..a73704e8865 100644 --- a/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/mappings/[mappingId]/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { deleteScimGroupMapping } from '@/ee/scim/application/admin/mappings' +import { deleteScimGroupMapping } from '@/ee/scim/lib/application/admin/mappings' export const DELETE = defineInternalJsonRoute({ contract: deleteScimGroupMappingContract, diff --git a/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts b/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts index 5c078a71783..f0931d1db52 100644 --- a/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/mappings/route.ts @@ -8,7 +8,10 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { listScimGroupMappings, upsertScimGroupMapping } from '@/ee/scim/application/admin/mappings' +import { + listScimGroupMappings, + upsertScimGroupMapping, +} from '@/ee/scim/lib/application/admin/mappings' /** What each directory group means inside Sim. */ diff --git a/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts b/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts index 3983550039a..09761cd6381 100644 --- a/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/reconcile/route.ts @@ -5,7 +5,7 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { reconcileScimConnection } from '@/ee/scim/application/admin/connection' +import { reconcileScimConnection } from '@/ee/scim/lib/application/admin/connection' /** * Re-applies every group mapping to every provisioned user. diff --git a/apps/sim/app/api/organizations/[id]/scim/route.ts b/apps/sim/app/api/organizations/[id]/scim/route.ts index 1a9cf443d9e..96835be4afa 100644 --- a/apps/sim/app/api/organizations/[id]/scim/route.ts +++ b/apps/sim/app/api/organizations/[id]/scim/route.ts @@ -8,7 +8,10 @@ import { internalRateLimits, internalSessionAuth, } from '@/lib/api/server/routes' -import { configureScimConnection, getScimConnection } from '@/ee/scim/application/admin/connection' +import { + configureScimConnection, + getScimConnection, +} from '@/ee/scim/lib/application/admin/connection' /** * The organization's directory-provisioning connection. diff --git a/apps/sim/app/api/scim/v2/Groups/[id]/route.ts b/apps/sim/app/api/scim/v2/Groups/[id]/route.ts index 65f75eca337..de66ed4964e 100644 --- a/apps/sim/app/api/scim/v2/Groups/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Groups/[id]/route.ts @@ -9,10 +9,10 @@ import { getScimGroup, patchScimGroup, replaceScimGroup, -} from '@/ee/scim/application/groups/manage-groups' -import { assertGroupSchemas, toCanonicalGroup } from '@/ee/scim/protocol/canonical' -import { parseAttributeProjection } from '@/ee/scim/protocol/resources' -import { defineScimRoute } from '@/ee/scim/route' +} from '@/ee/scim/lib/application/groups/manage-groups' +import { assertGroupSchemas, toCanonicalGroup } from '@/ee/scim/lib/protocol/canonical' +import { parseAttributeProjection } from '@/ee/scim/lib/protocol/resources' +import { defineScimRoute } from '@/ee/scim/lib/route' /** One Group resource. */ diff --git a/apps/sim/app/api/scim/v2/Groups/route.ts b/apps/sim/app/api/scim/v2/Groups/route.ts index b95eca65dbf..5ba8d22e7c5 100644 --- a/apps/sim/app/api/scim/v2/Groups/route.ts +++ b/apps/sim/app/api/scim/v2/Groups/route.ts @@ -1,8 +1,8 @@ import { createScimGroupContract, listScimGroupsContract } from '@/lib/api/contracts/scim' -import { createScimGroup, listScimGroups } from '@/ee/scim/application/groups/manage-groups' -import { assertGroupSchemas, toCanonicalGroup } from '@/ee/scim/protocol/canonical' -import { parseAttributeProjection, toListResponse } from '@/ee/scim/protocol/resources' -import { defineScimRoute } from '@/ee/scim/route' +import { createScimGroup, listScimGroups } from '@/ee/scim/lib/application/groups/manage-groups' +import { assertGroupSchemas, toCanonicalGroup } from '@/ee/scim/lib/protocol/canonical' +import { parseAttributeProjection, toListResponse } from '@/ee/scim/lib/protocol/resources' +import { defineScimRoute } from '@/ee/scim/lib/route' /** The Group collection. */ diff --git a/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts b/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts index 4bae78e88c4..d4016ff07ec 100644 --- a/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/ResourceTypes/[id]/route.ts @@ -1,6 +1,6 @@ import { defineScimDiscoveryRoute } from '@/lib/api/server/routes' -import { resourceTypes } from '@/ee/scim/protocol/discovery' -import { notFound } from '@/ee/scim/protocol/errors' +import { resourceTypes } from '@/ee/scim/lib/protocol/discovery' +import { notFound } from '@/ee/scim/lib/protocol/errors' export const GET = defineScimDiscoveryRoute((baseUrl, params) => { const id = typeof params.id === 'string' ? params.id : '' diff --git a/apps/sim/app/api/scim/v2/ResourceTypes/route.ts b/apps/sim/app/api/scim/v2/ResourceTypes/route.ts index 79c27f33b2e..6050e6ce2b7 100644 --- a/apps/sim/app/api/scim/v2/ResourceTypes/route.ts +++ b/apps/sim/app/api/scim/v2/ResourceTypes/route.ts @@ -1,6 +1,6 @@ import { defineScimDiscoveryRoute } from '@/lib/api/server/routes' -import { resourceTypes } from '@/ee/scim/protocol/discovery' -import { toListResponse } from '@/ee/scim/protocol/resources' +import { resourceTypes } from '@/ee/scim/lib/protocol/discovery' +import { toListResponse } from '@/ee/scim/lib/protocol/resources' export const GET = defineScimDiscoveryRoute((baseUrl) => toListResponse(resourceTypes(baseUrl), resourceTypes(baseUrl).length, 1) diff --git a/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts b/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts index f2a182fe897..c0c5010c01c 100644 --- a/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Schemas/[id]/route.ts @@ -1,6 +1,6 @@ import { defineScimDiscoveryRoute } from '@/lib/api/server/routes' -import { schemaDefinitions } from '@/ee/scim/protocol/discovery' -import { notFound } from '@/ee/scim/protocol/errors' +import { schemaDefinitions } from '@/ee/scim/lib/protocol/discovery' +import { notFound } from '@/ee/scim/lib/protocol/errors' export const GET = defineScimDiscoveryRoute((baseUrl, params) => { const id = typeof params.id === 'string' ? decodeURIComponent(params.id) : '' diff --git a/apps/sim/app/api/scim/v2/Schemas/route.ts b/apps/sim/app/api/scim/v2/Schemas/route.ts index b72f09c0b6a..3202e1555e0 100644 --- a/apps/sim/app/api/scim/v2/Schemas/route.ts +++ b/apps/sim/app/api/scim/v2/Schemas/route.ts @@ -1,6 +1,6 @@ import { defineScimDiscoveryRoute } from '@/lib/api/server/routes' -import { schemaDefinitions } from '@/ee/scim/protocol/discovery' -import { toListResponse } from '@/ee/scim/protocol/resources' +import { schemaDefinitions } from '@/ee/scim/lib/protocol/discovery' +import { toListResponse } from '@/ee/scim/lib/protocol/resources' export const GET = defineScimDiscoveryRoute((baseUrl) => toListResponse(schemaDefinitions(baseUrl), schemaDefinitions(baseUrl).length, 1) diff --git a/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts b/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts index 8a61b9c1ad0..05b68cd122c 100644 --- a/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts +++ b/apps/sim/app/api/scim/v2/ServiceProviderConfig/route.ts @@ -1,5 +1,5 @@ import { defineScimDiscoveryRoute } from '@/lib/api/server/routes' -import { serviceProviderConfig } from '@/ee/scim/protocol/discovery' +import { serviceProviderConfig } from '@/ee/scim/lib/protocol/discovery' /** Unauthenticated by design: a provider negotiates before it holds a credential. */ export const GET = defineScimDiscoveryRoute((baseUrl) => serviceProviderConfig(baseUrl)) diff --git a/apps/sim/app/api/scim/v2/Users/[id]/route.ts b/apps/sim/app/api/scim/v2/Users/[id]/route.ts index 5549a60224f..93a8466f917 100644 --- a/apps/sim/app/api/scim/v2/Users/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Users/[id]/route.ts @@ -4,12 +4,12 @@ import { patchScimUserContract, replaceScimUserContract, } from '@/lib/api/contracts/scim' -import { deprovisionScimUser } from '@/ee/scim/application/users/deprovision-user' -import { getScimUser } from '@/ee/scim/application/users/read-users' -import { patchScimUser, replaceScimUser } from '@/ee/scim/application/users/update-user' -import { assertUserSchemas, toCanonicalUser } from '@/ee/scim/protocol/canonical' -import { parseAttributeProjection } from '@/ee/scim/protocol/resources' -import { defineScimRoute } from '@/ee/scim/route' +import { deprovisionScimUser } from '@/ee/scim/lib/application/users/deprovision-user' +import { getScimUser } from '@/ee/scim/lib/application/users/read-users' +import { patchScimUser, replaceScimUser } from '@/ee/scim/lib/application/users/update-user' +import { assertUserSchemas, toCanonicalUser } from '@/ee/scim/lib/protocol/canonical' +import { parseAttributeProjection } from '@/ee/scim/lib/protocol/resources' +import { defineScimRoute } from '@/ee/scim/lib/route' /** One User resource. */ diff --git a/apps/sim/app/api/scim/v2/Users/route.ts b/apps/sim/app/api/scim/v2/Users/route.ts index 5f3593a1383..9d241e8b5ad 100644 --- a/apps/sim/app/api/scim/v2/Users/route.ts +++ b/apps/sim/app/api/scim/v2/Users/route.ts @@ -1,16 +1,16 @@ import { createScimUserContract, listScimUsersContract } from '@/lib/api/contracts/scim' -import { provisionScimUser } from '@/ee/scim/application/users/provision-user' -import { listScimUsers } from '@/ee/scim/application/users/read-users' -import { assertUserSchemas, toCanonicalUser } from '@/ee/scim/protocol/canonical' -import { parseAttributeProjection, toListResponse } from '@/ee/scim/protocol/resources' -import { defineScimRoute } from '@/ee/scim/route' +import { provisionScimUser } from '@/ee/scim/lib/application/users/provision-user' +import { listScimUsers } from '@/ee/scim/lib/application/users/read-users' +import { assertUserSchemas, toCanonicalUser } from '@/ee/scim/lib/protocol/canonical' +import { parseAttributeProjection, toListResponse } from '@/ee/scim/lib/protocol/resources' +import { defineScimRoute } from '@/ee/scim/lib/route' /** * The User collection. * * Adapters only: authentication, rate policy, contract parsing, and rendering * live in the route builder, and every decision about identity, membership, and - * access lives in `ee/scim/application`. + * access lives in `ee/scim/lib/application`. */ export const GET = defineScimRoute({ diff --git a/apps/sim/ee/scim/application/admin/connection-view.ts b/apps/sim/ee/scim/lib/application/admin/connection-view.ts similarity index 96% rename from apps/sim/ee/scim/application/admin/connection-view.ts rename to apps/sim/ee/scim/lib/application/admin/connection-view.ts index 155f14f8e91..c26835ed34a 100644 --- a/apps/sim/ee/scim/application/admin/connection-view.ts +++ b/apps/sim/ee/scim/lib/application/admin/connection-view.ts @@ -11,8 +11,8 @@ import { import { and, count, desc, eq } from 'drizzle-orm' import type { ScimConnectionView, ScimCredentialView } from '@/lib/api/contracts/organization-scim' import { OrchestrationError } from '@/lib/core/orchestration/types' -import { scimBaseUrl } from '@/ee/scim/base-url' -import { activeCredentialCondition } from '@/ee/scim/repository/credentials' +import { scimBaseUrl } from '@/ee/scim/lib/base-url' +import { activeCredentialCondition } from '@/ee/scim/lib/repository/credentials' /** Reads shared by the admin use cases: the connection row and its settings view. */ diff --git a/apps/sim/ee/scim/application/admin/connection.ts b/apps/sim/ee/scim/lib/application/admin/connection.ts similarity index 94% rename from apps/sim/ee/scim/application/admin/connection.ts rename to apps/sim/ee/scim/lib/application/admin/connection.ts index 220ab037a0e..4507596a9a9 100644 --- a/apps/sim/ee/scim/application/admin/connection.ts +++ b/apps/sim/ee/scim/lib/application/admin/connection.ts @@ -6,13 +6,16 @@ import { desc, eq } from 'drizzle-orm' import type { ScimConnectionSettingsInput } from '@/lib/api/contracts/organization-scim' import { acquireOrganizationMutationLock } from '@/lib/billing/organizations/membership' import { OrchestrationError } from '@/lib/core/orchestration/types' -import { loadConnectionView, requireConnection } from '@/ee/scim/application/admin/connection-view' +import { + loadConnectionView, + requireConnection, +} from '@/ee/scim/lib/application/admin/connection-view' import { defineAuthorizedScimAdminUseCase, type ScimAdminUseCaseArgs, -} from '@/ee/scim/application/authorized-scim-admin-use-case' -import { scimAdminOperations } from '@/ee/scim/application/operations' -import { reconcileConnection } from '@/ee/scim/reconcile/job' +} from '@/ee/scim/lib/application/authorized-scim-admin-use-case' +import { scimAdminOperations } from '@/ee/scim/lib/application/operations' +import { reconcileConnection } from '@/ee/scim/lib/reconcile/job' /** The connection itself: reading it, enabling and configuring it, and running a drift pass. */ diff --git a/apps/sim/ee/scim/application/admin/credentials.ts b/apps/sim/ee/scim/lib/application/admin/credentials.ts similarity index 92% rename from apps/sim/ee/scim/application/admin/credentials.ts rename to apps/sim/ee/scim/lib/application/admin/credentials.ts index e0c50d1c55c..14f7c62f56c 100644 --- a/apps/sim/ee/scim/application/admin/credentials.ts +++ b/apps/sim/ee/scim/lib/application/admin/credentials.ts @@ -5,14 +5,17 @@ import { generateId } from '@sim/utils/id' import { and, count, eq, isNull, sql } from 'drizzle-orm' import { acquireOrganizationMutationLock } from '@/lib/billing/organizations/membership' import { OrchestrationError } from '@/lib/core/orchestration/types' -import { requireConnection, toCredentialView } from '@/ee/scim/application/admin/connection-view' +import { + requireConnection, + toCredentialView, +} from '@/ee/scim/lib/application/admin/connection-view' import { defineAuthorizedScimAdminUseCase, type ScimAdminUseCaseArgs, -} from '@/ee/scim/application/authorized-scim-admin-use-case' -import { scimAdminOperations } from '@/ee/scim/application/operations' -import { generateScimToken } from '@/ee/scim/authenticate' -import { activeCredentialCondition } from '@/ee/scim/repository/credentials' +} from '@/ee/scim/lib/application/authorized-scim-admin-use-case' +import { scimAdminOperations } from '@/ee/scim/lib/application/operations' +import { generateScimToken } from '@/ee/scim/lib/authenticate' +import { activeCredentialCondition } from '@/ee/scim/lib/repository/credentials' /** * Issuing and revoking the bearer credentials a directory authenticates with. diff --git a/apps/sim/ee/scim/application/admin/mappings.ts b/apps/sim/ee/scim/lib/application/admin/mappings.ts similarity index 97% rename from apps/sim/ee/scim/application/admin/mappings.ts rename to apps/sim/ee/scim/lib/application/admin/mappings.ts index b55d64913ed..563afe2c758 100644 --- a/apps/sim/ee/scim/application/admin/mappings.ts +++ b/apps/sim/ee/scim/lib/application/admin/mappings.ts @@ -18,13 +18,13 @@ import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' import { assertWorkspaceInOrganization, requireConnection, -} from '@/ee/scim/application/admin/connection-view' +} from '@/ee/scim/lib/application/admin/connection-view' import { defineAuthorizedScimAdminUseCase, type ScimAdminUseCaseArgs, -} from '@/ee/scim/application/authorized-scim-admin-use-case' -import { scimAdminOperations } from '@/ee/scim/application/operations' -import { reconcileUsersProjectionInBatches } from '@/ee/scim/projection/reconcile-user' +} from '@/ee/scim/lib/application/authorized-scim-admin-use-case' +import { scimAdminOperations } from '@/ee/scim/lib/application/operations' +import { reconcileUsersProjectionInBatches } from '@/ee/scim/lib/projection/reconcile-user' /** * Mapping directory groups onto Sim access. diff --git a/apps/sim/ee/scim/application/audit.ts b/apps/sim/ee/scim/lib/application/audit.ts similarity index 100% rename from apps/sim/ee/scim/application/audit.ts rename to apps/sim/ee/scim/lib/application/audit.ts diff --git a/apps/sim/ee/scim/application/authorized-scim-admin-use-case.ts b/apps/sim/ee/scim/lib/application/authorized-scim-admin-use-case.ts similarity index 96% rename from apps/sim/ee/scim/application/authorized-scim-admin-use-case.ts rename to apps/sim/ee/scim/lib/application/authorized-scim-admin-use-case.ts index 6bb4e52d3b9..28b123a8146 100644 --- a/apps/sim/ee/scim/application/authorized-scim-admin-use-case.ts +++ b/apps/sim/ee/scim/lib/application/authorized-scim-admin-use-case.ts @@ -4,9 +4,9 @@ import { member } from '@sim/db/schema' import { and, eq } from 'drizzle-orm' import { ForbiddenOperationError, type OperationUseCase } from '@/lib/core/application' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' -import { recordScimAuditEntries, type ScimAuditEntry } from '@/ee/scim/application/audit' -import type { ScimAdminOperation, ScimAdminPrincipal } from '@/ee/scim/application/operations' -import { isScimEntitledForOrganization } from '@/ee/scim/entitlement' +import { recordScimAuditEntries, type ScimAuditEntry } from '@/ee/scim/lib/application/audit' +import type { ScimAdminOperation, ScimAdminPrincipal } from '@/ee/scim/lib/application/operations' +import { isScimEntitledForOrganization } from '@/ee/scim/lib/entitlement' /** * The authorized wrapper for administering a connection from the settings UI. diff --git a/apps/sim/ee/scim/application/authorized-scim-use-case.ts b/apps/sim/ee/scim/lib/application/authorized-scim-use-case.ts similarity index 95% rename from apps/sim/ee/scim/application/authorized-scim-use-case.ts rename to apps/sim/ee/scim/lib/application/authorized-scim-use-case.ts index 9c5ea5e82b3..5b350f83d89 100644 --- a/apps/sim/ee/scim/application/authorized-scim-use-case.ts +++ b/apps/sim/ee/scim/lib/application/authorized-scim-use-case.ts @@ -5,10 +5,10 @@ import { type ScimConnectionSettings, scimConnection } from '@sim/db/schema' import { eq } from 'drizzle-orm' import type { OperationUseCase } from '@/lib/core/application' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' -import { recordScimAuditEntries, type ScimAuditEntry } from '@/ee/scim/application/audit' -import type { ScimOperation, ScimPrincipal } from '@/ee/scim/application/operations' -import { scimBaseUrl } from '@/ee/scim/base-url' -import { ScimError } from '@/ee/scim/protocol/errors' +import { recordScimAuditEntries, type ScimAuditEntry } from '@/ee/scim/lib/application/audit' +import type { ScimOperation, ScimPrincipal } from '@/ee/scim/lib/application/operations' +import { scimBaseUrl } from '@/ee/scim/lib/base-url' +import { ScimError } from '@/ee/scim/lib/protocol/errors' /** * The authorized wrapper every directory operation runs inside. diff --git a/apps/sim/ee/scim/application/groups/manage-groups.ts b/apps/sim/ee/scim/lib/application/groups/manage-groups.ts similarity index 95% rename from apps/sim/ee/scim/application/groups/manage-groups.ts rename to apps/sim/ee/scim/lib/application/groups/manage-groups.ts index 941e4bad6be..35a8c691b25 100644 --- a/apps/sim/ee/scim/application/groups/manage-groups.ts +++ b/apps/sim/ee/scim/lib/application/groups/manage-groups.ts @@ -9,15 +9,15 @@ import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, type ScimUseCaseContext, -} from '@/ee/scim/application/authorized-scim-use-case' -import { scimOperations } from '@/ee/scim/application/operations' -import { autoMapPermissionGroupByName } from '@/ee/scim/projection/auto-map' -import { reconcileUsersProjection } from '@/ee/scim/projection/reconcile-user' -import type { CanonicalScimGroup } from '@/ee/scim/protocol/canonical' -import { SCIM_MAX_GROUP_MEMBERS } from '@/ee/scim/protocol/constants' -import { invalidValue, notFound, ScimError, uniqueness } from '@/ee/scim/protocol/errors' -import { parseGroupFilter } from '@/ee/scim/protocol/filter' -import { parseGroupPatch } from '@/ee/scim/protocol/group-patch' +} from '@/ee/scim/lib/application/authorized-scim-use-case' +import { scimOperations } from '@/ee/scim/lib/application/operations' +import { autoMapPermissionGroupByName } from '@/ee/scim/lib/projection/auto-map' +import { reconcileUsersProjection } from '@/ee/scim/lib/projection/reconcile-user' +import type { CanonicalScimGroup } from '@/ee/scim/lib/protocol/canonical' +import { SCIM_MAX_GROUP_MEMBERS } from '@/ee/scim/lib/protocol/constants' +import { invalidValue, notFound, ScimError, uniqueness } from '@/ee/scim/lib/protocol/errors' +import { parseGroupFilter } from '@/ee/scim/lib/protocol/filter' +import { parseGroupPatch } from '@/ee/scim/lib/protocol/group-patch' import { projectionWants, projectResource, @@ -25,7 +25,7 @@ import { type ScimAttributeProjection, type ScimGroupResource, toGroupResource, -} from '@/ee/scim/protocol/resources' +} from '@/ee/scim/lib/protocol/resources' import { addGroupMember, countGroupMembers, @@ -40,7 +40,7 @@ import { removeGroupMember, touchScimGroup, updateScimGroup, -} from '@/ee/scim/repository/groups' +} from '@/ee/scim/lib/repository/groups' /** Reads and writes of the Group resource, and the projection each change triggers. */ diff --git a/apps/sim/ee/scim/application/operations.ts b/apps/sim/ee/scim/lib/application/operations.ts similarity index 100% rename from apps/sim/ee/scim/application/operations.ts rename to apps/sim/ee/scim/lib/application/operations.ts diff --git a/apps/sim/ee/scim/application/users/deprovision-user.test.ts b/apps/sim/ee/scim/lib/application/users/deprovision-user.test.ts similarity index 92% rename from apps/sim/ee/scim/application/users/deprovision-user.test.ts rename to apps/sim/ee/scim/lib/application/users/deprovision-user.test.ts index 85482c8691d..9e5960bb4bf 100644 --- a/apps/sim/ee/scim/application/users/deprovision-user.test.ts +++ b/apps/sim/ee/scim/lib/application/users/deprovision-user.test.ts @@ -20,20 +20,20 @@ vi.mock('@/lib/billing/organizations/membership', () => ({ vi.mock('@/lib/billing/organizations/seats', () => ({ reconcileOrganizationSeats: mocks.reconcileSeats, })) -vi.mock('@/ee/scim/identity/end-directory-membership', () => ({ +vi.mock('@/ee/scim/lib/identity/end-directory-membership', () => ({ endDirectoryMembershipTx: mocks.endDirectoryMembership, })) -vi.mock('@/ee/scim/repository/users', () => ({ +vi.mock('@/ee/scim/lib/repository/users', () => ({ findScimUserById: mocks.findScimUserById, })) -vi.mock('@/ee/scim/application/audit', () => ({ +vi.mock('@/ee/scim/lib/application/audit', () => ({ recordScimAuditEntries: mocks.recordAudit, })) -vi.mock('@/ee/scim/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) +vi.mock('@/ee/scim/lib/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) import type { Principal } from '@sim/auth/principal' -import { deprovisionScimUser } from '@/ee/scim/application/users/deprovision-user' -import { ScimError } from '@/ee/scim/protocol/errors' +import { deprovisionScimUser } from '@/ee/scim/lib/application/users/deprovision-user' +import { ScimError } from '@/ee/scim/lib/protocol/errors' const principal: Principal = { kind: 'scim_connection', diff --git a/apps/sim/ee/scim/application/users/deprovision-user.ts b/apps/sim/ee/scim/lib/application/users/deprovision-user.ts similarity index 92% rename from apps/sim/ee/scim/application/users/deprovision-user.ts rename to apps/sim/ee/scim/lib/application/users/deprovision-user.ts index 4f43469f059..f0638ea8183 100644 --- a/apps/sim/ee/scim/application/users/deprovision-user.ts +++ b/apps/sim/ee/scim/lib/application/users/deprovision-user.ts @@ -8,11 +8,11 @@ import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, -} from '@/ee/scim/application/authorized-scim-use-case' -import { scimOperations } from '@/ee/scim/application/operations' -import { endDirectoryMembershipTx } from '@/ee/scim/identity/end-directory-membership' -import { notFound, ScimError } from '@/ee/scim/protocol/errors' -import { findScimUserById } from '@/ee/scim/repository/users' +} from '@/ee/scim/lib/application/authorized-scim-use-case' +import { scimOperations } from '@/ee/scim/lib/application/operations' +import { endDirectoryMembershipTx } from '@/ee/scim/lib/identity/end-directory-membership' +import { notFound, ScimError } from '@/ee/scim/lib/protocol/errors' +import { findScimUserById } from '@/ee/scim/lib/repository/users' const logger = createLogger('ScimDeprovisionUser') diff --git a/apps/sim/ee/scim/application/users/provision-user.ts b/apps/sim/ee/scim/lib/application/users/provision-user.ts similarity index 95% rename from apps/sim/ee/scim/application/users/provision-user.ts rename to apps/sim/ee/scim/lib/application/users/provision-user.ts index 8eaa248c246..3f22efc988c 100644 --- a/apps/sim/ee/scim/application/users/provision-user.ts +++ b/apps/sim/ee/scim/lib/application/users/provision-user.ts @@ -20,25 +20,25 @@ import { deleteUserAccount } from '@/lib/users/account-deletion' import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, -} from '@/ee/scim/application/authorized-scim-use-case' -import { scimOperations } from '@/ee/scim/application/operations' -import { syncAccountIdentityTx } from '@/ee/scim/identity/account-identity' +} from '@/ee/scim/lib/application/authorized-scim-use-case' +import { scimOperations } from '@/ee/scim/lib/application/operations' +import { syncAccountIdentityTx } from '@/ee/scim/lib/identity/account-identity' import { assertEmailAvailable, consumeTombstone, resolveProvisionedIdentity, -} from '@/ee/scim/identity/resolve-user' -import { reconcileUserProjection } from '@/ee/scim/projection/reconcile-user' -import { primaryEmail } from '@/ee/scim/protocol/canonical' -import { ScimError, uniqueness } from '@/ee/scim/protocol/errors' -import { toUserResource } from '@/ee/scim/protocol/resources' +} from '@/ee/scim/lib/identity/resolve-user' +import { reconcileUserProjection } from '@/ee/scim/lib/projection/reconcile-user' +import { primaryEmail } from '@/ee/scim/lib/protocol/canonical' +import { ScimError, uniqueness } from '@/ee/scim/lib/protocol/errors' +import { toUserResource } from '@/ee/scim/lib/protocol/resources' import { assertUserNameAvailable, findScimUserById, findScimUserByUserId, insertScimUser, toUserResourceRow, -} from '@/ee/scim/repository/users' +} from '@/ee/scim/lib/repository/users' const logger = createLogger('ScimProvisionUser') diff --git a/apps/sim/ee/scim/application/users/read-users.ts b/apps/sim/ee/scim/lib/application/users/read-users.ts similarity index 89% rename from apps/sim/ee/scim/application/users/read-users.ts rename to apps/sim/ee/scim/lib/application/users/read-users.ts index 982b9556578..9c4e96bb882 100644 --- a/apps/sim/ee/scim/application/users/read-users.ts +++ b/apps/sim/ee/scim/lib/application/users/read-users.ts @@ -2,23 +2,23 @@ import { db } from '@sim/db' import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, -} from '@/ee/scim/application/authorized-scim-use-case' -import { scimOperations } from '@/ee/scim/application/operations' -import { notFound } from '@/ee/scim/protocol/errors' -import { parseUserFilter } from '@/ee/scim/protocol/filter' +} from '@/ee/scim/lib/application/authorized-scim-use-case' +import { scimOperations } from '@/ee/scim/lib/application/operations' +import { notFound } from '@/ee/scim/lib/protocol/errors' +import { parseUserFilter } from '@/ee/scim/lib/protocol/filter' import { projectionWants, projectResource, resolvePage, type ScimAttributeProjection, toUserResource, -} from '@/ee/scim/protocol/resources' +} from '@/ee/scim/lib/protocol/resources' import { findScimUserById, loadGroupsForScimUsers, pageScimUsers, toUserResourceRow, -} from '@/ee/scim/repository/users' +} from '@/ee/scim/lib/repository/users' export interface ListScimUsersInput { filter?: string | undefined diff --git a/apps/sim/ee/scim/application/users/update-user.test.ts b/apps/sim/ee/scim/lib/application/users/update-user.test.ts similarity index 93% rename from apps/sim/ee/scim/application/users/update-user.test.ts rename to apps/sim/ee/scim/lib/application/users/update-user.test.ts index e3062794ba1..4ac5a2e5c5d 100644 --- a/apps/sim/ee/scim/application/users/update-user.test.ts +++ b/apps/sim/ee/scim/lib/application/users/update-user.test.ts @@ -33,16 +33,16 @@ vi.mock('@/lib/organizations/members/revocation', () => ({ revokeUserSessionsTx: mocks.revokeSessions, invalidateAfterSessionRevocation: mocks.invalidate, })) -vi.mock('@/ee/scim/identity/account-identity', () => ({ +vi.mock('@/ee/scim/lib/identity/account-identity', () => ({ syncAccountIdentityTx: mocks.syncIdentity, })) -vi.mock('@/ee/scim/identity/resolve-user', () => ({ +vi.mock('@/ee/scim/lib/identity/resolve-user', () => ({ assertDomainOwned: mocks.assertDomainOwned, })) -vi.mock('@/ee/scim/projection/reconcile-user', () => ({ +vi.mock('@/ee/scim/lib/projection/reconcile-user', () => ({ reconcileUserProjection: mocks.reconcile, })) -vi.mock('@/ee/scim/repository/users', () => ({ +vi.mock('@/ee/scim/lib/repository/users', () => ({ findScimUserById: mocks.findScimUserById, assertUserNameAvailable: mocks.assertUserNameAvailable, updateScimUser: mocks.updateScimUser, @@ -59,13 +59,13 @@ vi.mock('@/ee/scim/repository/users', () => ({ groups: [], }), })) -vi.mock('@/ee/scim/application/audit', () => ({ +vi.mock('@/ee/scim/lib/application/audit', () => ({ recordScimAuditEntries: mocks.recordAudit, })) -vi.mock('@/ee/scim/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) +vi.mock('@/ee/scim/lib/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) import type { Principal } from '@sim/auth/principal' -import { patchScimUser, replaceScimUser } from '@/ee/scim/application/users/update-user' +import { patchScimUser, replaceScimUser } from '@/ee/scim/lib/application/users/update-user' const principal: Principal = { kind: 'scim_connection', diff --git a/apps/sim/ee/scim/application/users/update-user.ts b/apps/sim/ee/scim/lib/application/users/update-user.ts similarity index 93% rename from apps/sim/ee/scim/application/users/update-user.ts rename to apps/sim/ee/scim/lib/application/users/update-user.ts index b513927005b..0d4db216d67 100644 --- a/apps/sim/ee/scim/application/users/update-user.ts +++ b/apps/sim/ee/scim/lib/application/users/update-user.ts @@ -10,20 +10,20 @@ import { invalidateAfterSessionRevocation, revokeUserSessionsTx, } from '@/lib/organizations/members/revocation' -import type { ScimAuditEntry } from '@/ee/scim/application/audit' +import type { ScimAuditEntry } from '@/ee/scim/lib/application/audit' import { defineAuthorizedScimUseCase, type ScimUseCaseArgs, type ScimUseCaseContext, -} from '@/ee/scim/application/authorized-scim-use-case' -import { scimOperations } from '@/ee/scim/application/operations' -import { syncAccountIdentityTx } from '@/ee/scim/identity/account-identity' -import { assertDomainOwned } from '@/ee/scim/identity/resolve-user' -import { reconcileUserProjection } from '@/ee/scim/projection/reconcile-user' -import { primaryEmail } from '@/ee/scim/protocol/canonical' -import { notFound, ScimError } from '@/ee/scim/protocol/errors' -import { toUserResource } from '@/ee/scim/protocol/resources' -import { applyUserPatch, userAttributesEqual } from '@/ee/scim/protocol/user-patch' +} from '@/ee/scim/lib/application/authorized-scim-use-case' +import { scimOperations } from '@/ee/scim/lib/application/operations' +import { syncAccountIdentityTx } from '@/ee/scim/lib/identity/account-identity' +import { assertDomainOwned } from '@/ee/scim/lib/identity/resolve-user' +import { reconcileUserProjection } from '@/ee/scim/lib/projection/reconcile-user' +import { primaryEmail } from '@/ee/scim/lib/protocol/canonical' +import { notFound, ScimError } from '@/ee/scim/lib/protocol/errors' +import { toUserResource } from '@/ee/scim/lib/protocol/resources' +import { applyUserPatch, userAttributesEqual } from '@/ee/scim/lib/protocol/user-patch' import { assertUserNameAvailable, findScimUserById, @@ -31,7 +31,7 @@ import { type ScimUserRecord, toUserResourceRow, updateScimUser, -} from '@/ee/scim/repository/users' +} from '@/ee/scim/lib/repository/users' /** * The write half of the User resource. diff --git a/apps/sim/ee/scim/authenticate.test.ts b/apps/sim/ee/scim/lib/authenticate.test.ts similarity index 97% rename from apps/sim/ee/scim/authenticate.test.ts rename to apps/sim/ee/scim/lib/authenticate.test.ts index 596e6899dc7..22b6ca83586 100644 --- a/apps/sim/ee/scim/authenticate.test.ts +++ b/apps/sim/ee/scim/lib/authenticate.test.ts @@ -9,12 +9,12 @@ import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' const { mockIsEntitled } = vi.hoisted(() => ({ mockIsEntitled: vi.fn() })) -vi.mock('@/ee/scim/entitlement', () => ({ +vi.mock('@/ee/scim/lib/entitlement', () => ({ isScimEntitledForOrganization: mockIsEntitled, })) -import { authenticateScimRequest, generateScimToken } from '@/ee/scim/authenticate' -import { ScimError } from '@/ee/scim/protocol/errors' +import { authenticateScimRequest, generateScimToken } from '@/ee/scim/lib/authenticate' +import { ScimError } from '@/ee/scim/lib/protocol/errors' function requestWithToken(token?: string): NextRequest { const headers = new Headers() diff --git a/apps/sim/ee/scim/authenticate.ts b/apps/sim/ee/scim/lib/authenticate.ts similarity index 97% rename from apps/sim/ee/scim/authenticate.ts rename to apps/sim/ee/scim/lib/authenticate.ts index fdcc7ea264f..7d26c07e847 100644 --- a/apps/sim/ee/scim/authenticate.ts +++ b/apps/sim/ee/scim/lib/authenticate.ts @@ -6,8 +6,8 @@ import { createLogger } from '@sim/logger' import { generateShortId } from '@sim/utils/id' import { eq } from 'drizzle-orm' import type { NextRequest } from 'next/server' -import { isScimEntitledForOrganization } from '@/ee/scim/entitlement' -import { ScimError } from '@/ee/scim/protocol/errors' +import { isScimEntitledForOrganization } from '@/ee/scim/lib/entitlement' +import { ScimError } from '@/ee/scim/lib/protocol/errors' const logger = createLogger('ScimAuthenticate') diff --git a/apps/sim/ee/scim/base-url.ts b/apps/sim/ee/scim/lib/base-url.ts similarity index 80% rename from apps/sim/ee/scim/base-url.ts rename to apps/sim/ee/scim/lib/base-url.ts index 41ae9e41b3f..c865d7a576e 100644 --- a/apps/sim/ee/scim/base-url.ts +++ b/apps/sim/ee/scim/lib/base-url.ts @@ -1,5 +1,5 @@ import { getBaseUrl } from '@/lib/core/utils/urls' -import { SCIM_BASE_PATH } from '@/ee/scim/protocol/constants' +import { SCIM_BASE_PATH } from '@/ee/scim/lib/protocol/constants' /** The absolute root of the SCIM surface, e.g. `https://sim.ai/api/scim/v2`; used for `meta.location`, `$ref`, and settings. */ export function scimBaseUrl(): string { diff --git a/apps/sim/ee/scim/entitlement.test.ts b/apps/sim/ee/scim/lib/entitlement.test.ts similarity index 95% rename from apps/sim/ee/scim/entitlement.test.ts rename to apps/sim/ee/scim/lib/entitlement.test.ts index 2cf81d9c82a..1a01e9091aa 100644 --- a/apps/sim/ee/scim/entitlement.test.ts +++ b/apps/sim/ee/scim/lib/entitlement.test.ts @@ -10,7 +10,7 @@ vi.mock('@/lib/billing/core/subscription', () => ({ isOrganizationOnEnterprisePlan: mockEnterprisePlan, })) -import { isScimEntitledForOrganization } from '@/ee/scim/entitlement' +import { isScimEntitledForOrganization } from '@/ee/scim/lib/entitlement' afterEach(resetEnvFlagsMock) diff --git a/apps/sim/ee/scim/entitlement.ts b/apps/sim/ee/scim/lib/entitlement.ts similarity index 100% rename from apps/sim/ee/scim/entitlement.ts rename to apps/sim/ee/scim/lib/entitlement.ts diff --git a/apps/sim/ee/scim/identity/account-identity.ts b/apps/sim/ee/scim/lib/identity/account-identity.ts similarity index 95% rename from apps/sim/ee/scim/identity/account-identity.ts rename to apps/sim/ee/scim/lib/identity/account-identity.ts index c8b2119ba16..a6e57b3d26e 100644 --- a/apps/sim/ee/scim/identity/account-identity.ts +++ b/apps/sim/ee/scim/lib/identity/account-identity.ts @@ -2,7 +2,7 @@ import { user } from '@sim/db/schema' import { normalizeEmail } from '@sim/utils/string' import { eq } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' -import { assertEmailAvailable } from '@/ee/scim/identity/resolve-user' +import { assertEmailAvailable } from '@/ee/scim/lib/identity/resolve-user' /** * Writes the directory's view of who a person is onto their Sim account. diff --git a/apps/sim/ee/scim/identity/end-directory-membership.ts b/apps/sim/ee/scim/lib/identity/end-directory-membership.ts similarity index 100% rename from apps/sim/ee/scim/identity/end-directory-membership.ts rename to apps/sim/ee/scim/lib/identity/end-directory-membership.ts diff --git a/apps/sim/ee/scim/identity/resolve-user.test.ts b/apps/sim/ee/scim/lib/identity/resolve-user.test.ts similarity index 96% rename from apps/sim/ee/scim/identity/resolve-user.test.ts rename to apps/sim/ee/scim/lib/identity/resolve-user.test.ts index 875067d0fac..42319867d47 100644 --- a/apps/sim/ee/scim/identity/resolve-user.test.ts +++ b/apps/sim/ee/scim/lib/identity/resolve-user.test.ts @@ -5,8 +5,11 @@ import { db } from '@sim/db' import { member, type ScimUserAttributes, scimUserTombstone, ssoDomain, user } from '@sim/db/schema' import { dbChainMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' -import { assertEmailAvailable, resolveProvisionedIdentity } from '@/ee/scim/identity/resolve-user' -import { ScimError } from '@/ee/scim/protocol/errors' +import { + assertEmailAvailable, + resolveProvisionedIdentity, +} from '@/ee/scim/lib/identity/resolve-user' +import { ScimError } from '@/ee/scim/lib/protocol/errors' function attributes(overrides: Partial = {}): ScimUserAttributes { return { diff --git a/apps/sim/ee/scim/identity/resolve-user.ts b/apps/sim/ee/scim/lib/identity/resolve-user.ts similarity index 97% rename from apps/sim/ee/scim/identity/resolve-user.ts rename to apps/sim/ee/scim/lib/identity/resolve-user.ts index 683c2dce723..ba444d0d6d9 100644 --- a/apps/sim/ee/scim/identity/resolve-user.ts +++ b/apps/sim/ee/scim/lib/identity/resolve-user.ts @@ -3,8 +3,8 @@ import { normalizeSSODomain } from '@sim/utils/sso-domain' import { isValidEmailSyntax, normalizeEmail } from '@sim/utils/string' import { and, eq, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' -import { primaryEmail } from '@/ee/scim/protocol/canonical' -import { invalidValue, uniqueness } from '@/ee/scim/protocol/errors' +import { primaryEmail } from '@/ee/scim/lib/protocol/canonical' +import { invalidValue, uniqueness } from '@/ee/scim/lib/protocol/errors' /** * Deciding which Sim account an incoming directory identity refers to. diff --git a/apps/sim/ee/scim/managed-membership.ts b/apps/sim/ee/scim/lib/managed-membership.ts similarity index 100% rename from apps/sim/ee/scim/managed-membership.ts rename to apps/sim/ee/scim/lib/managed-membership.ts diff --git a/apps/sim/ee/scim/projection/auto-map.test.ts b/apps/sim/ee/scim/lib/projection/auto-map.test.ts similarity index 97% rename from apps/sim/ee/scim/projection/auto-map.test.ts rename to apps/sim/ee/scim/lib/projection/auto-map.test.ts index 47578fed197..8251336a6d5 100644 --- a/apps/sim/ee/scim/projection/auto-map.test.ts +++ b/apps/sim/ee/scim/lib/projection/auto-map.test.ts @@ -9,7 +9,7 @@ import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' const { mockLeafLock } = vi.hoisted(() => ({ mockLeafLock: vi.fn() })) vi.mock('@/lib/permission-groups/locks', () => ({ acquirePermissionGroupOrgLock: mockLeafLock })) -import { autoMapPermissionGroupByName } from '@/ee/scim/projection/auto-map' +import { autoMapPermissionGroupByName } from '@/ee/scim/lib/projection/auto-map' const params = { organizationId: 'org-1', scimGroupId: 'g-1', displayName: 'Engineering' } diff --git a/apps/sim/ee/scim/projection/auto-map.ts b/apps/sim/ee/scim/lib/projection/auto-map.ts similarity index 100% rename from apps/sim/ee/scim/projection/auto-map.ts rename to apps/sim/ee/scim/lib/projection/auto-map.ts diff --git a/apps/sim/ee/scim/projection/grants.test.ts b/apps/sim/ee/scim/lib/projection/grants.test.ts similarity index 99% rename from apps/sim/ee/scim/projection/grants.test.ts rename to apps/sim/ee/scim/lib/projection/grants.test.ts index b3792805a00..2051eebf577 100644 --- a/apps/sim/ee/scim/projection/grants.test.ts +++ b/apps/sim/ee/scim/lib/projection/grants.test.ts @@ -7,7 +7,7 @@ import { type ProjectionGrant, planGrantChanges, resolveDesiredGrants, -} from '@/ee/scim/projection/grants' +} from '@/ee/scim/lib/projection/grants' function workspaceRow(workspaceId: string, permissionType: 'admin' | 'write' | 'read'): MappingRow { return { diff --git a/apps/sim/ee/scim/projection/grants.ts b/apps/sim/ee/scim/lib/projection/grants.ts similarity index 100% rename from apps/sim/ee/scim/projection/grants.ts rename to apps/sim/ee/scim/lib/projection/grants.ts diff --git a/apps/sim/ee/scim/projection/reconcile-user.test.ts b/apps/sim/ee/scim/lib/projection/reconcile-user.test.ts similarity index 99% rename from apps/sim/ee/scim/projection/reconcile-user.test.ts rename to apps/sim/ee/scim/lib/projection/reconcile-user.test.ts index 9addda27ef7..6ded0fee353 100644 --- a/apps/sim/ee/scim/projection/reconcile-user.test.ts +++ b/apps/sim/ee/scim/lib/projection/reconcile-user.test.ts @@ -40,7 +40,7 @@ vi.mock('@/lib/workspaces/access/workspace-access', () => ({ })) import { OrchestrationError } from '@/lib/core/orchestration/types' -import { reconcileUserProjection } from '@/ee/scim/projection/reconcile-user' +import { reconcileUserProjection } from '@/ee/scim/lib/projection/reconcile-user' const params = { connectionId: 'conn-1', diff --git a/apps/sim/ee/scim/projection/reconcile-user.ts b/apps/sim/ee/scim/lib/projection/reconcile-user.ts similarity index 99% rename from apps/sim/ee/scim/projection/reconcile-user.ts rename to apps/sim/ee/scim/lib/projection/reconcile-user.ts index 1fa818b717c..229d0550725 100644 --- a/apps/sim/ee/scim/projection/reconcile-user.ts +++ b/apps/sim/ee/scim/lib/projection/reconcile-user.ts @@ -35,7 +35,7 @@ import { type ProjectionTargetKind, planGrantChanges, resolveDesiredGrants, -} from '@/ee/scim/projection/grants' +} from '@/ee/scim/lib/projection/grants' const logger = createLogger('ScimProjection') diff --git a/apps/sim/ee/scim/protocol/canonical.test.ts b/apps/sim/ee/scim/lib/protocol/canonical.test.ts similarity index 94% rename from apps/sim/ee/scim/protocol/canonical.test.ts rename to apps/sim/ee/scim/lib/protocol/canonical.test.ts index f7f64c72b08..818fa94a5ec 100644 --- a/apps/sim/ee/scim/protocol/canonical.test.ts +++ b/apps/sim/ee/scim/lib/protocol/canonical.test.ts @@ -9,14 +9,14 @@ import { primaryEmail, toCanonicalGroup, toCanonicalUser, -} from '@/ee/scim/protocol/canonical' +} from '@/ee/scim/lib/protocol/canonical' import { SCIM_ENTERPRISE_USER_SCHEMA, SCIM_GROUP_SCHEMA, SCIM_USER_SCHEMA, -} from '@/ee/scim/protocol/constants' -import type { ScimError } from '@/ee/scim/protocol/errors' -import { ENTRA_LEGACY_GROUP_SCHEMA } from '@/ee/scim/protocol/normalize' +} from '@/ee/scim/lib/protocol/constants' +import type { ScimError } from '@/ee/scim/lib/protocol/errors' +import { ENTRA_LEGACY_GROUP_SCHEMA } from '@/ee/scim/lib/protocol/normalize' function parseUser(body: Record) { return toCanonicalUser(scimUserWriteSchema.parse({ schemas: [SCIM_USER_SCHEMA], ...body })) diff --git a/apps/sim/ee/scim/protocol/canonical.ts b/apps/sim/ee/scim/lib/protocol/canonical.ts similarity index 98% rename from apps/sim/ee/scim/protocol/canonical.ts rename to apps/sim/ee/scim/lib/protocol/canonical.ts index cf1e9e50689..99bb41a1a5a 100644 --- a/apps/sim/ee/scim/protocol/canonical.ts +++ b/apps/sim/ee/scim/lib/protocol/canonical.ts @@ -5,9 +5,9 @@ import { SCIM_GROUP_SCHEMA, SCIM_MAX_GROUP_MEMBERS, SCIM_USER_SCHEMA, -} from '@/ee/scim/protocol/constants' -import { invalidValue } from '@/ee/scim/protocol/errors' -import { isRecord, stripProviderSchemaMarkers } from '@/ee/scim/protocol/normalize' +} from '@/ee/scim/lib/protocol/constants' +import { invalidValue } from '@/ee/scim/lib/protocol/errors' +import { isRecord, stripProviderSchemaMarkers } from '@/ee/scim/lib/protocol/normalize' /** Attributes Sim models itself; everything else is preserved under `extra`. */ const MODELLED_USER_KEYS = new Set([ diff --git a/apps/sim/ee/scim/protocol/constants.ts b/apps/sim/ee/scim/lib/protocol/constants.ts similarity index 100% rename from apps/sim/ee/scim/protocol/constants.ts rename to apps/sim/ee/scim/lib/protocol/constants.ts diff --git a/apps/sim/ee/scim/protocol/discovery.ts b/apps/sim/ee/scim/lib/protocol/discovery.ts similarity index 99% rename from apps/sim/ee/scim/protocol/discovery.ts rename to apps/sim/ee/scim/lib/protocol/discovery.ts index 3823bb06fcc..d79da904666 100644 --- a/apps/sim/ee/scim/protocol/discovery.ts +++ b/apps/sim/ee/scim/lib/protocol/discovery.ts @@ -6,7 +6,7 @@ import { SCIM_SCHEMA_SCHEMA, SCIM_SERVICE_PROVIDER_CONFIG_SCHEMA, SCIM_USER_SCHEMA, -} from '@/ee/scim/protocol/constants' +} from '@/ee/scim/lib/protocol/constants' /** * The discovery documents RFC 7644 requires. diff --git a/apps/sim/ee/scim/protocol/errors.ts b/apps/sim/ee/scim/lib/protocol/errors.ts similarity index 98% rename from apps/sim/ee/scim/protocol/errors.ts rename to apps/sim/ee/scim/lib/protocol/errors.ts index 8d03b170a72..54eb014fe9e 100644 --- a/apps/sim/ee/scim/protocol/errors.ts +++ b/apps/sim/ee/scim/lib/protocol/errors.ts @@ -1,5 +1,5 @@ import { asOrchestrationError } from '@/lib/core/orchestration/types' -import { SCIM_ERROR_SCHEMA } from '@/ee/scim/protocol/constants' +import { SCIM_ERROR_SCHEMA } from '@/ee/scim/lib/protocol/constants' /** * The `scimType` vocabulary of RFC 7644 section 3.12. diff --git a/apps/sim/ee/scim/protocol/filter.test.ts b/apps/sim/ee/scim/lib/protocol/filter.test.ts similarity index 95% rename from apps/sim/ee/scim/protocol/filter.test.ts rename to apps/sim/ee/scim/lib/protocol/filter.test.ts index ff323d8bae0..885ce130077 100644 --- a/apps/sim/ee/scim/protocol/filter.test.ts +++ b/apps/sim/ee/scim/lib/protocol/filter.test.ts @@ -2,8 +2,8 @@ * @vitest-environment node */ import { describe, expect, it } from 'vitest' -import type { ScimError } from '@/ee/scim/protocol/errors' -import { parseGroupFilter, parseUserFilter } from '@/ee/scim/protocol/filter' +import type { ScimError } from '@/ee/scim/lib/protocol/errors' +import { parseGroupFilter, parseUserFilter } from '@/ee/scim/lib/protocol/filter' /** * The grammar is deliberately small, so these tests are as much about what is diff --git a/apps/sim/ee/scim/protocol/filter.ts b/apps/sim/ee/scim/lib/protocol/filter.ts similarity index 96% rename from apps/sim/ee/scim/protocol/filter.ts rename to apps/sim/ee/scim/lib/protocol/filter.ts index bab40af2984..30b3c6bfbc8 100644 --- a/apps/sim/ee/scim/protocol/filter.ts +++ b/apps/sim/ee/scim/lib/protocol/filter.ts @@ -1,6 +1,6 @@ -import { SCIM_MAX_FILTER_TERMS } from '@/ee/scim/protocol/constants' -import { invalidFilter } from '@/ee/scim/protocol/errors' -import { normalizeAttributePath } from '@/ee/scim/protocol/normalize' +import { SCIM_MAX_FILTER_TERMS } from '@/ee/scim/lib/protocol/constants' +import { invalidFilter } from '@/ee/scim/lib/protocol/errors' +import { normalizeAttributePath } from '@/ee/scim/lib/protocol/normalize' /** * The filter grammar this server accepts, which is the subset the provisioning diff --git a/apps/sim/ee/scim/protocol/group-patch.test.ts b/apps/sim/ee/scim/lib/protocol/group-patch.test.ts similarity index 95% rename from apps/sim/ee/scim/protocol/group-patch.test.ts rename to apps/sim/ee/scim/lib/protocol/group-patch.test.ts index 40242093ea9..e48267154e1 100644 --- a/apps/sim/ee/scim/protocol/group-patch.test.ts +++ b/apps/sim/ee/scim/lib/protocol/group-patch.test.ts @@ -3,9 +3,9 @@ */ import { describe, expect, it } from 'vitest' import { scimPatchBodySchema } from '@/lib/api/contracts/scim' -import { SCIM_PATCH_OP_SCHEMA } from '@/ee/scim/protocol/constants' -import type { ScimError } from '@/ee/scim/protocol/errors' -import { parseGroupPatch } from '@/ee/scim/protocol/group-patch' +import { SCIM_PATCH_OP_SCHEMA } from '@/ee/scim/lib/protocol/constants' +import type { ScimError } from '@/ee/scim/lib/protocol/errors' +import { parseGroupPatch } from '@/ee/scim/lib/protocol/group-patch' function parseOperations(operations: unknown[]) { return scimPatchBodySchema.parse({ schemas: [SCIM_PATCH_OP_SCHEMA], Operations: operations }) diff --git a/apps/sim/ee/scim/protocol/group-patch.ts b/apps/sim/ee/scim/lib/protocol/group-patch.ts similarity index 97% rename from apps/sim/ee/scim/protocol/group-patch.ts rename to apps/sim/ee/scim/lib/protocol/group-patch.ts index edac57ad6e8..5d4f91e9ca8 100644 --- a/apps/sim/ee/scim/protocol/group-patch.ts +++ b/apps/sim/ee/scim/lib/protocol/group-patch.ts @@ -1,7 +1,7 @@ import type { ScimPatchOperation } from '@/lib/api/contracts/scim' -import { readMemberValue } from '@/ee/scim/protocol/canonical' -import { invalidPath, invalidValue, mutability, noTarget } from '@/ee/scim/protocol/errors' -import { isRecord, normalizeAttributePath } from '@/ee/scim/protocol/normalize' +import { readMemberValue } from '@/ee/scim/lib/protocol/canonical' +import { invalidPath, invalidValue, mutability, noTarget } from '@/ee/scim/lib/protocol/errors' +import { isRecord, normalizeAttributePath } from '@/ee/scim/lib/protocol/normalize' /** * A parsed Group PATCH. diff --git a/apps/sim/ee/scim/protocol/normalize.ts b/apps/sim/ee/scim/lib/protocol/normalize.ts similarity index 100% rename from apps/sim/ee/scim/protocol/normalize.ts rename to apps/sim/ee/scim/lib/protocol/normalize.ts diff --git a/apps/sim/ee/scim/protocol/resources.test.ts b/apps/sim/ee/scim/lib/protocol/resources.test.ts similarity index 96% rename from apps/sim/ee/scim/protocol/resources.test.ts rename to apps/sim/ee/scim/lib/protocol/resources.test.ts index 09de0892d99..7771df2b4e3 100644 --- a/apps/sim/ee/scim/protocol/resources.test.ts +++ b/apps/sim/ee/scim/lib/protocol/resources.test.ts @@ -3,15 +3,15 @@ */ import { describe, expect, it } from 'vitest' import { scimUserResourceSchema } from '@/lib/api/contracts/scim' -import { SCIM_MAX_PAGE_SIZE } from '@/ee/scim/protocol/constants' -import type { ScimError } from '@/ee/scim/protocol/errors' +import { SCIM_MAX_PAGE_SIZE } from '@/ee/scim/lib/protocol/constants' +import type { ScimError } from '@/ee/scim/lib/protocol/errors' import { parseAttributeProjection, projectionWants, projectResource, resolvePage, toUserResource, -} from '@/ee/scim/protocol/resources' +} from '@/ee/scim/lib/protocol/resources' const BASE_URL = 'https://sim.test/api/scim/v2' diff --git a/apps/sim/ee/scim/protocol/resources.ts b/apps/sim/ee/scim/lib/protocol/resources.ts similarity index 98% rename from apps/sim/ee/scim/protocol/resources.ts rename to apps/sim/ee/scim/lib/protocol/resources.ts index 036fc9d0490..dfcb3710ea5 100644 --- a/apps/sim/ee/scim/protocol/resources.ts +++ b/apps/sim/ee/scim/lib/protocol/resources.ts @@ -5,8 +5,8 @@ import { SCIM_LIST_RESPONSE_SCHEMA, SCIM_MAX_PAGE_SIZE, SCIM_USER_SCHEMA, -} from '@/ee/scim/protocol/constants' -import { invalidValue } from '@/ee/scim/protocol/errors' +} from '@/ee/scim/lib/protocol/constants' +import { invalidValue } from '@/ee/scim/lib/protocol/errors' export interface ScimResourceMeta { resourceType: 'User' | 'Group' diff --git a/apps/sim/ee/scim/protocol/user-patch.test.ts b/apps/sim/ee/scim/lib/protocol/user-patch.test.ts similarity index 98% rename from apps/sim/ee/scim/protocol/user-patch.test.ts rename to apps/sim/ee/scim/lib/protocol/user-patch.test.ts index d7459519f8a..a88095491b7 100644 --- a/apps/sim/ee/scim/protocol/user-patch.test.ts +++ b/apps/sim/ee/scim/lib/protocol/user-patch.test.ts @@ -4,8 +4,8 @@ import type { ScimUserAttributes } from '@sim/db/schema' import { describe, expect, it } from 'vitest' import { scimPatchBodySchema } from '@/lib/api/contracts/scim' -import { SCIM_PATCH_OP_SCHEMA } from '@/ee/scim/protocol/constants' -import { applyUserPatch } from '@/ee/scim/protocol/user-patch' +import { SCIM_PATCH_OP_SCHEMA } from '@/ee/scim/lib/protocol/constants' +import { applyUserPatch } from '@/ee/scim/lib/protocol/user-patch' /** * Every fixture here is a request shape taken from Okta's or Microsoft's own diff --git a/apps/sim/ee/scim/protocol/user-patch.ts b/apps/sim/ee/scim/lib/protocol/user-patch.ts similarity index 99% rename from apps/sim/ee/scim/protocol/user-patch.ts rename to apps/sim/ee/scim/lib/protocol/user-patch.ts index 7ea01725157..d5b6e12687a 100644 --- a/apps/sim/ee/scim/protocol/user-patch.ts +++ b/apps/sim/ee/scim/lib/protocol/user-patch.ts @@ -1,12 +1,12 @@ import type { ScimUserAttributes, ScimUserEmail } from '@sim/db/schema' import type { ScimPatchOperation } from '@/lib/api/contracts/scim' -import { invalidPath, invalidValue, mutability, noTarget } from '@/ee/scim/protocol/errors' +import { invalidPath, invalidValue, mutability, noTarget } from '@/ee/scim/lib/protocol/errors' import { isRecord, normalizeAttributePath, normalizeScimBoolean, unwrapSingleElement, -} from '@/ee/scim/protocol/normalize' +} from '@/ee/scim/lib/protocol/normalize' /** * Applies a PATCH operation list to a stored User resource. diff --git a/apps/sim/ee/scim/reconcile/job.ts b/apps/sim/ee/scim/lib/reconcile/job.ts similarity index 96% rename from apps/sim/ee/scim/reconcile/job.ts rename to apps/sim/ee/scim/lib/reconcile/job.ts index d32f991c432..6ad75b05611 100644 --- a/apps/sim/ee/scim/reconcile/job.ts +++ b/apps/sim/ee/scim/lib/reconcile/job.ts @@ -3,10 +3,10 @@ import { scimConnection } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { and, eq, isNull, lt, or, sql } from 'drizzle-orm' -import { isScimEntitledForOrganization } from '@/ee/scim/entitlement' -import { reconcileUserProjection } from '@/ee/scim/projection/reconcile-user' -import { listScimUserIds } from '@/ee/scim/repository/users' -import { pruneScimRequestLog } from '@/ee/scim/request-log' +import { isScimEntitledForOrganization } from '@/ee/scim/lib/entitlement' +import { reconcileUserProjection } from '@/ee/scim/lib/projection/reconcile-user' +import { listScimUserIds } from '@/ee/scim/lib/repository/users' +import { pruneScimRequestLog } from '@/ee/scim/lib/request-log' const logger = createLogger('ScimReconcile') diff --git a/apps/sim/ee/scim/repository/credentials.ts b/apps/sim/ee/scim/lib/repository/credentials.ts similarity index 100% rename from apps/sim/ee/scim/repository/credentials.ts rename to apps/sim/ee/scim/lib/repository/credentials.ts diff --git a/apps/sim/ee/scim/repository/groups.ts b/apps/sim/ee/scim/lib/repository/groups.ts similarity index 98% rename from apps/sim/ee/scim/repository/groups.ts rename to apps/sim/ee/scim/lib/repository/groups.ts index 2b3322dec3b..5f381d071c8 100644 --- a/apps/sim/ee/scim/repository/groups.ts +++ b/apps/sim/ee/scim/lib/repository/groups.ts @@ -3,8 +3,8 @@ import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { and, asc, count, eq, inArray, type SQL, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' -import type { ScimFilterTerm, ScimGroupFilterField } from '@/ee/scim/protocol/filter' -import { buildOrderKey } from '@/ee/scim/repository/users' +import type { ScimFilterTerm, ScimGroupFilterField } from '@/ee/scim/lib/protocol/filter' +import { buildOrderKey } from '@/ee/scim/lib/repository/users' const logger = createLogger('ScimGroupRepository') diff --git a/apps/sim/ee/scim/repository/users.ts b/apps/sim/ee/scim/lib/repository/users.ts similarity index 98% rename from apps/sim/ee/scim/repository/users.ts rename to apps/sim/ee/scim/lib/repository/users.ts index 8f296b07746..6f440b0c5ca 100644 --- a/apps/sim/ee/scim/repository/users.ts +++ b/apps/sim/ee/scim/lib/repository/users.ts @@ -3,9 +3,9 @@ import { generateId } from '@sim/utils/id' import { normalizeEmail } from '@sim/utils/string' import { and, asc, count, eq, inArray, type SQL, sql } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' -import { uniqueness } from '@/ee/scim/protocol/errors' -import type { ScimFilterTerm, ScimUserFilterField } from '@/ee/scim/protocol/filter' -import type { UserResourceRow } from '@/ee/scim/protocol/resources' +import { uniqueness } from '@/ee/scim/lib/protocol/errors' +import type { ScimFilterTerm, ScimUserFilterField } from '@/ee/scim/lib/protocol/filter' +import type { UserResourceRow } from '@/ee/scim/lib/protocol/resources' /** * Reads and writes of the provisioned User table. diff --git a/apps/sim/ee/scim/request-log.ts b/apps/sim/ee/scim/lib/request-log.ts similarity index 94% rename from apps/sim/ee/scim/request-log.ts rename to apps/sim/ee/scim/lib/request-log.ts index b0dda430f33..e8084f8cfa0 100644 --- a/apps/sim/ee/scim/request-log.ts +++ b/apps/sim/ee/scim/lib/request-log.ts @@ -5,8 +5,8 @@ import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { truncate } from '@sim/utils/string' import { sql } from 'drizzle-orm' -import { SCIM_REQUEST_LOG_RETENTION } from '@/ee/scim/protocol/constants' -import type { ScimType } from '@/ee/scim/protocol/errors' +import { SCIM_REQUEST_LOG_RETENTION } from '@/ee/scim/lib/protocol/constants' +import type { ScimType } from '@/ee/scim/lib/protocol/errors' const logger = createLogger('ScimRequestLog') diff --git a/apps/sim/ee/scim/route.ts b/apps/sim/ee/scim/lib/route.ts similarity index 73% rename from apps/sim/ee/scim/route.ts rename to apps/sim/ee/scim/lib/route.ts index 17bbc75ac9a..06e025306b5 100644 --- a/apps/sim/ee/scim/route.ts +++ b/apps/sim/ee/scim/lib/route.ts @@ -1,7 +1,7 @@ import { createScimRouteBuilder } from '@/lib/api/server/routes' -import { authenticateScimRequest } from '@/ee/scim/authenticate' -import { scimBaseUrl } from '@/ee/scim/base-url' -import { recordScimRequest } from '@/ee/scim/request-log' +import { authenticateScimRequest } from '@/ee/scim/lib/authenticate' +import { scimBaseUrl } from '@/ee/scim/lib/base-url' +import { recordScimRequest } from '@/ee/scim/lib/request-log' /** * The route builder wired to this deployment. diff --git a/apps/sim/lib/api/contracts/scim.ts b/apps/sim/lib/api/contracts/scim.ts index 4ccc93af477..1a6983d6309 100644 --- a/apps/sim/lib/api/contracts/scim.ts +++ b/apps/sim/lib/api/contracts/scim.ts @@ -6,12 +6,12 @@ import { SCIM_MAX_GROUP_MEMBERS, SCIM_MAX_PATCH_OPERATIONS, SCIM_PATCH_OP_SCHEMA, -} from '@/ee/scim/protocol/constants' +} from '@/ee/scim/lib/protocol/constants' import { canonicalizeAttributeNames, normalizeScimBoolean, unwrapSingleElement, -} from '@/ee/scim/protocol/normalize' +} from '@/ee/scim/lib/protocol/normalize' /** * Wire schemas for the SCIM 2.0 surface. diff --git a/apps/sim/lib/api/server/routes/scim-route.test.ts b/apps/sim/lib/api/server/routes/scim-route.test.ts index e8c2a0c258f..cd1008a70fa 100644 --- a/apps/sim/lib/api/server/routes/scim-route.test.ts +++ b/apps/sim/lib/api/server/routes/scim-route.test.ts @@ -24,9 +24,9 @@ import { listScimUsersContract, } from '@/lib/api/contracts/scim' import { createScimRouteBuilder } from '@/lib/api/server/routes' -import { scimOperations } from '@/ee/scim/application/operations' -import { SCIM_MEDIA_TYPE } from '@/ee/scim/protocol/constants' -import { ScimError } from '@/ee/scim/protocol/errors' +import { scimOperations } from '@/ee/scim/lib/application/operations' +import { SCIM_MEDIA_TYPE } from '@/ee/scim/lib/protocol/constants' +import { ScimError } from '@/ee/scim/lib/protocol/errors' const principal: ScimConnectionPrincipal = { kind: 'scim_connection', diff --git a/apps/sim/lib/api/server/routes/scim-route.ts b/apps/sim/lib/api/server/routes/scim-route.ts index c76b11b6f38..f2b08840034 100644 --- a/apps/sim/lib/api/server/routes/scim-route.ts +++ b/apps/sim/lib/api/server/routes/scim-route.ts @@ -7,16 +7,16 @@ import type { ApplicationOperation, OperationUseCase } from '@/lib/core/applicat import { isScimEnabled } from '@/lib/core/config/env-flags' import { enforceIpRateLimit, RateLimiter } from '@/lib/core/rate-limiter' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' -import type { ScimConnectionAuthenticator } from '@/ee/scim/authenticate' -import { scimBaseUrl } from '@/ee/scim/base-url' +import type { ScimConnectionAuthenticator } from '@/ee/scim/lib/authenticate' +import { scimBaseUrl } from '@/ee/scim/lib/base-url' import { SCIM_ACCEPTED_MEDIA_TYPES, SCIM_MAX_BODY_BYTES, SCIM_MEDIA_TYPE, SCIM_RATE_LIMIT, -} from '@/ee/scim/protocol/constants' -import { ScimError, type ScimType, scimErrorBody, toScimError } from '@/ee/scim/protocol/errors' -import type { ScimRequestLogEntry } from '@/ee/scim/request-log' +} from '@/ee/scim/lib/protocol/constants' +import { ScimError, type ScimType, scimErrorBody, toScimError } from '@/ee/scim/lib/protocol/errors' +import type { ScimRequestLogEntry } from '@/ee/scim/lib/request-log' const logger = createLogger('ScimRoute') const rateLimiter = new RateLimiter() diff --git a/apps/sim/lib/billing/organizations/membership.ts b/apps/sim/lib/billing/organizations/membership.ts index 85b6f263412..21da676b383 100644 --- a/apps/sim/lib/billing/organizations/membership.ts +++ b/apps/sim/lib/billing/organizations/membership.ts @@ -59,7 +59,7 @@ import { reassignWorkflowOwnershipForWorkspaceMemberRemovalTx, WorkspaceBillingAccountRemovalError, } from '@/lib/workspaces/utils' -import { endDirectoryMembershipTx } from '@/ee/scim/identity/end-directory-membership' +import { endDirectoryMembershipTx } from '@/ee/scim/lib/identity/end-directory-membership' export { acquireUserBillingIdentityLock } from '@/lib/billing/organizations/billing-identity-lock' export { WORKSPACE_BILLING_ACCOUNT_REMOVAL_ERROR } from '@/lib/workspaces/utils' diff --git a/apps/sim/lib/core/application/operation.ts b/apps/sim/lib/core/application/operation.ts index f0388c2d2de..dc70b9e808f 100644 --- a/apps/sim/lib/core/application/operation.ts +++ b/apps/sim/lib/core/application/operation.ts @@ -70,7 +70,7 @@ export interface ApplicationOperation { * identity provider, which provisions membership and never reads or writes a * workspace resource. Leaving it out makes that a compile-time fact — a * workspace operation cannot name it even by accident — and SCIM declares its - * own operation type in `ee/scim/application/operations.ts`, the way + * own operation type in `ee/scim/lib/application/operations.ts`, the way * organization BYOK does. */ export type PrincipalKind = Exclude< diff --git a/apps/sim/lib/invitations/direct-grant.ts b/apps/sim/lib/invitations/direct-grant.ts index d30c755e0ee..5c1b1190329 100644 --- a/apps/sim/lib/invitations/direct-grant.ts +++ b/apps/sim/lib/invitations/direct-grant.ts @@ -35,7 +35,7 @@ import { getWorkspaceWithOwner, type PermissionType, } from '@/lib/workspaces/permissions/utils' -import { assertMembershipNotScimManaged } from '@/ee/scim/managed-membership' +import { assertMembershipNotScimManaged } from '@/ee/scim/lib/managed-membership' const logger = createLogger('InvitationDirectGrant') diff --git a/apps/sim/lib/invitations/workspace-invitations.ts b/apps/sim/lib/invitations/workspace-invitations.ts index a81eed94fc8..459fbe86992 100644 --- a/apps/sim/lib/invitations/workspace-invitations.ts +++ b/apps/sim/lib/invitations/workspace-invitations.ts @@ -43,7 +43,10 @@ import { type WorkspaceInvitePolicy, } from '@/lib/workspaces/policy' import { validateInvitationsAllowed } from '@/ee/access-control/utils/permission-check' -import { assertInviteeNotScimManaged, scimManagedUserPredicate } from '@/ee/scim/managed-membership' +import { + assertInviteeNotScimManaged, + scimManagedUserPredicate, +} from '@/ee/scim/lib/managed-membership' /** * What the invitee becomes in the organization. `member` and `admin` are diff --git a/scripts/check-api-validation-contracts.ts b/scripts/check-api-validation-contracts.ts index 5ec859af169..95a8a9cba13 100644 --- a/scripts/check-api-validation-contracts.ts +++ b/scripts/check-api-validation-contracts.ts @@ -180,7 +180,7 @@ const RAW_JSON_BASELINE_ROUTES = new Set([ const CONTRACT_IMPORT_PATTERN = /\bfrom\s+['"]@\/lib\/api\/contracts(?:\/[^'"]*)?['"]/ const DECLARATIVE_ROUTE_BUILDER_IMPORT_PATTERN = - /\bimport\s*\{[^}]*(?:\bdefineInternalJsonRoute\b|\bdefineV2JsonRoute\b|\bdefineInternalBinaryRoute\b|\bdefineV2BinaryRoute\b)[^}]*\}\s*from\s*['"]@\/lib\/api\/server\/routes['"]|\bimport\s*\{[^}]*\bdefineScimRoute\b[^}]*\}\s*from\s*['"]@\/ee\/scim\/route['"]/ + /\bimport\s*\{[^}]*(?:\bdefineInternalJsonRoute\b|\bdefineV2JsonRoute\b|\bdefineInternalBinaryRoute\b|\bdefineV2BinaryRoute\b)[^}]*\}\s*from\s*['"]@\/lib\/api\/server\/routes['"]|\bimport\s*\{[^}]*\bdefineScimRoute\b[^}]*\}\s*from\s*['"]@\/ee\/scim\/lib\/route['"]/ const DECLARATIVE_ROUTE_BUILDER_USAGE_PATTERN = /\b(?:defineInternalJsonRoute|defineV2JsonRoute|defineInternalBinaryRoute|defineV2BinaryRoute|defineScimRoute)\s*\(/ const SERVER_VALIDATION_IMPORT_PATTERN = /\bfrom\s+['"]@\/lib\/api\/server(?:\/validation)?['"]/ From 6116e193bbcfbcb82d9539fd09eafd992107674a Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 17:09:11 -0700 Subject: [PATCH 29/31] feat(auth): control OAuth rollout through AppConfig --- apps/docs/content/docs/cli/authentication.mdx | 10 ++- .../docs/platform/enterprise/self-hosted.mdx | 2 +- .../platform/self-hosting/authentication.mdx | 37 ++++++-- .../self-hosting/environment-variables.mdx | 2 +- apps/sim/app/(auth)/oauth/consent/page.tsx | 4 +- .../app/(auth)/oauth/sign-in/route.test.ts | 7 +- apps/sim/app/(auth)/oauth/sign-in/route.ts | 5 +- apps/sim/app/api/auth/[...all]/route.test.ts | 75 +++++++++++++--- apps/sim/app/api/auth/[...all]/route.ts | 8 ++ .../api/auth/oauth2/authorize/route.test.ts | 85 +++++++++++-------- .../app/api/auth/oauth2/authorize/route.ts | 9 +- .../app/api/auth/oauth2/revoke/route.test.ts | 28 ++++-- apps/sim/app/api/auth/oauth2/revoke/route.ts | 4 +- .../app/api/auth/oauth2/token/route.test.ts | 27 ++++-- apps/sim/app/api/auth/oauth2/token/route.ts | 4 +- .../api/server/routes/v2-api-key-auth.test.ts | 54 +++++++++++- .../lib/api/server/routes/v2-api-key-auth.ts | 5 +- apps/sim/lib/auth/auth.ts | 18 +++- .../lib/auth/oauth-provider-feature.test.ts | 41 +++++++++ apps/sim/lib/auth/oauth-provider-feature.ts | 7 ++ .../lib/auth/oauth-provider-metadata.test.ts | 32 +++++-- apps/sim/lib/auth/oauth-provider-metadata.ts | 6 +- apps/sim/lib/core/config/env-flags.ts | 12 --- apps/sim/lib/core/config/env.ts | 2 +- .../sim/lib/core/config/feature-flags.test.ts | 29 +++++++ apps/sim/lib/core/config/feature-flags.ts | 6 ++ apps/sim/proxy.ts | 10 +-- packages/testing/src/mocks/env-flags.mock.ts | 2 - 28 files changed, 402 insertions(+), 129 deletions(-) create mode 100644 apps/sim/lib/auth/oauth-provider-feature.test.ts create mode 100644 apps/sim/lib/auth/oauth-provider-feature.ts diff --git a/apps/docs/content/docs/cli/authentication.mdx b/apps/docs/content/docs/cli/authentication.mdx index 3c9ec9e4e6c..b306dd8ee30 100644 --- a/apps/docs/content/docs/cli/authentication.mdx +++ b/apps/docs/content/docs/cli/authentication.mdx @@ -237,9 +237,13 @@ Save it to avoid repeating the flag: sim configure --set-endpoint http://localhost:3000 --profile local ``` -A self-hosted deployment offers OAuth sign-in when -`OAUTH_PROVIDER_ENABLED=true` and authentication is enabled. Leave it unset to -use the pairing-code handoff; `DISABLE_AUTH=true` also forces OAuth off. +A deployment offers OAuth sign-in when its global `oauth-provider` feature flag +is enabled. With AppConfig, enable it in the existing `feature-flags` document +using `"oauth-provider": { "enabled": true }`. When AppConfig is disabled or no +AppConfig document has been loaded, `OAUTH_PROVIDER_ENABLED=true` supplies the fallback. +With the provider off, the CLI uses the pairing-code handoff; `DISABLE_AUTH=true` +always forces OAuth off. Operators must apply the database migration and drain +older app instances before enabling it. See [Sign in with Sim](/platform/self-hosting/authentication#sign-in-with-sim). ## Where the login is stored diff --git a/apps/docs/content/docs/platform/enterprise/self-hosted.mdx b/apps/docs/content/docs/platform/enterprise/self-hosted.mdx index a5bb6e472a3..35b214c1227 100644 --- a/apps/docs/content/docs/platform/enterprise/self-hosted.mdx +++ b/apps/docs/content/docs/platform/enterprise/self-hosted.mdx @@ -90,7 +90,7 @@ Persist that value as `CRON_SECRET` on the app **and** on whatever calls these e Both shipped deployments schedule the data-drain dispatcher and OAuth token cleanup, but **not** the three configurable data-retention endpoints. Setting `DATA_RETENTION_ENABLED=true` alone deletes no retained product data — those windows are evaluated only when one of the three endpoints is called. Add them to `cronjobs.jobs` yourself, or drive them from an external scheduler. - OAuth token cleanup continues after `OAUTH_PROVIDER_ENABLED=false` so rows created while the provider was enabled do not become permanent. + OAuth token cleanup continues when the global `oauth-provider` feature flag is off, so rows created while the provider was enabled do not become permanent. See [Sign in with Sim](/platform/self-hosting/authentication#sign-in-with-sim) for AppConfig and fallback configuration. ```bash diff --git a/apps/docs/content/docs/platform/self-hosting/authentication.mdx b/apps/docs/content/docs/platform/self-hosting/authentication.mdx index 265f371dd2b..0ef498e2bcb 100644 --- a/apps/docs/content/docs/platform/self-hosting/authentication.mdx +++ b/apps/docs/content/docs/platform/self-hosting/authentication.mdx @@ -85,23 +85,46 @@ Your deployment can act as an OAuth 2.0 authorization server using authorization code with PKCE and current OAuth security guidance. The Sim CLI uses it when enabled; see [CLI authentication](/cli/authentication). -Use a two-phase rollout: apply the database migration while this flag is unset, -deploy and drain every older app instance, then enable it in a separate config -rollout: +The global `oauth-provider` feature flag controls availability. Keep it off while +applying the database migration, then deploy and drain every older app instance +before enabling it. + +If your deployment uses AWS AppConfig, add this entry to the existing +`feature-flags` document and deploy that configuration: + +```json +{ + "oauth-provider": { "enabled": true } +} +``` + +Preserve the document's other entries. This flag is global: use `enabled`, not +workspace, organization, user, or admin targeting. Set `enabled` to `false` to +turn it off; changes take effect as instances refresh their AppConfig cache. + +When AppConfig is disabled or no AppConfig document has been loaded, the +fallback is: ```bash OAUTH_PROVIDER_ENABLED=true ``` -With it unset or false, the discovery document at `/.well-known/oauth-authorization-server` -returns 404 and the CLI falls back to the pairing-code handoff on its own. +In that fallback mode, unset or false keeps the provider off. An available +AppConfig document takes precedence over this variable, including when the +`oauth-provider` entry is missing or disabled. AppConfig fetch failures retain +the last successfully loaded document. + +When the provider is off, discovery at `/.well-known/oauth-authorization-server` +returns 404 and the CLI falls back to the pairing-code handoff. `DISABLE_AUTH=true` also forces the provider off because the authorization flow requires a real Better Auth user session. Access tokens are opaque and last an hour; refresh tokens rotate on every use. Each login has a fixed thirty-day lifetime that refreshing does not extend. -Nothing is cached, so revoking a grant under -**Settings → Authorized apps** stops the app on its very next request. +Token validation checks current grants, so revoking a grant under +**Settings → Authorized apps** stops the app on its very next request. These +settings remain available for reviewing and revoking existing grants while the +provider is off, and scheduled OAuth token cleanup continues. ### Registering an app diff --git a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx index cd85fb425c5..f93ff491e09 100644 --- a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx +++ b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx @@ -127,7 +127,7 @@ Google, GitHub, and Microsoft sign-in, their callback URLs, and the `DISABLE_*_A | Variable | Description | | --- | --- | -| `OAUTH_PROVIDER_ENABLED` | Set to `true` in a second rollout after the migration is applied and every older app instance is drained. Unset/false uses the CLI pairing-code handoff. `DISABLE_AUTH=true` always forces it off. See [Authentication](/platform/self-hosting/authentication#sign-in-with-sim) | +| `OAUTH_PROVIDER_ENABLED` | Fallback for the global `oauth-provider` feature flag when AppConfig is disabled or no AppConfig document has been loaded. Set to `true` only after the migration is applied and every older app instance is drained. With AppConfig, use `"oauth-provider": { "enabled": true }` in the existing `feature-flags` document instead. `DISABLE_AUTH=true` always forces it off. See [Authentication](/platform/self-hosting/authentication#sign-in-with-sim) | ## Integration Credentials diff --git a/apps/sim/app/(auth)/oauth/consent/page.tsx b/apps/sim/app/(auth)/oauth/consent/page.tsx index e532807fccf..9c9bf878261 100644 --- a/apps/sim/app/(auth)/oauth/consent/page.tsx +++ b/apps/sim/app/(auth)/oauth/consent/page.tsx @@ -2,7 +2,7 @@ import type { Metadata } from 'next' import { redirect } from 'next/navigation' import type { SearchParams } from 'nuqs/server' import { getSession } from '@/lib/auth' -import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature' import { OAuthConsentView } from '@/app/(auth)/oauth/consent/consent-view' import { oauthConsentSearchParamsCache } from '@/app/(auth)/oauth/consent/search-params' @@ -22,7 +22,7 @@ export default async function OAuthConsentPage({ }: { searchParams: Promise }) { - if (!isOAuthProviderEnabled) redirect('/') + if (!(await isOAuthProviderEnabled())) redirect('/') const [session, raw] = await Promise.all([getSession(), searchParams]) diff --git a/apps/sim/app/(auth)/oauth/sign-in/route.test.ts b/apps/sim/app/(auth)/oauth/sign-in/route.test.ts index 1eccb42d97f..ae2b7dea886 100644 --- a/apps/sim/app/(auth)/oauth/sign-in/route.test.ts +++ b/apps/sim/app/(auth)/oauth/sign-in/route.test.ts @@ -13,14 +13,15 @@ const flags = vi.hoisted(() => ({ vi.mock('@/lib/core/config/env-flags', () => ({ ...envFlagsMock, - get isOAuthProviderEnabled() { - return flags.enabled - }, get isRegistrationDisabled() { return flags.registrationDisabled }, })) +vi.mock('@/lib/auth/oauth-provider-feature', () => ({ + isOAuthProviderEnabled: vi.fn(async () => flags.enabled), +})) + vi.mock('@/lib/core/config/env', () => { const mock = createEnvMock({ NEXT_PUBLIC_APP_URL: 'https://sim.test' }) return { diff --git a/apps/sim/app/(auth)/oauth/sign-in/route.ts b/apps/sim/app/(auth)/oauth/sign-in/route.ts index a3cfd08f88e..2d5c3faa619 100644 --- a/apps/sim/app/(auth)/oauth/sign-in/route.ts +++ b/apps/sim/app/(auth)/oauth/sign-in/route.ts @@ -1,5 +1,6 @@ import { type NextRequest, NextResponse } from 'next/server' -import { isOAuthProviderEnabled, isRegistrationDisabled } from '@/lib/core/config/env-flags' +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature' +import { isRegistrationDisabled } from '@/lib/core/config/env-flags' import { getBaseUrl } from '@/lib/core/utils/urls' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { buildAuthCrossLink } from '@/app/(auth)/auth-redirect' @@ -39,7 +40,7 @@ function consumeInteractivePrompt(params: URLSearchParams): boolean { */ export const GET = withRouteHandler(async (request: NextRequest) => { /** Avoid sending a newly signed-in user to a disabled provider's JSON 404. */ - if (!isOAuthProviderEnabled) { + if (!(await isOAuthProviderEnabled())) { return NextResponse.redirect(new URL('/', getBaseUrl()), 302) } diff --git a/apps/sim/app/api/auth/[...all]/route.test.ts b/apps/sim/app/api/auth/[...all]/route.test.ts index 0cc99520003..532bf52bc4a 100644 --- a/apps/sim/app/api/auth/[...all]/route.test.ts +++ b/apps/sim/app/api/auth/[...all]/route.test.ts @@ -14,6 +14,7 @@ const handlerMocks = vi.hoisted(() => ({ user: { id: 'anon' }, session: { id: 'anon-session' }, })), + oauthEnabled: vi.fn(), })) vi.mock('better-auth/next-js', () => ({ @@ -26,6 +27,9 @@ vi.mock('better-auth/next-js', () => ({ vi.mock('@/lib/auth', () => ({ auth: { handler: {} }, })) +vi.mock('@/lib/auth/oauth-provider-feature', () => ({ + isOAuthProviderEnabled: handlerMocks.oauthEnabled, +})) vi.mock('@/lib/auth/anonymous', () => ({ ensureAnonymousUserExists: handlerMocks.ensureAnonymousUserExists, @@ -63,6 +67,7 @@ vi.mock('@/app/api/credential-groups/oauth-callback', () => ({ import { GET, POST } from '@/app/api/auth/[...all]/route' afterAll(resetEnvFlagsMock) +beforeEach(() => handlerMocks.oauthEnabled.mockResolvedValue(true)) describe('auth catch-all route managed OAuth callbacks', () => { beforeEach(() => { @@ -97,21 +102,26 @@ describe('auth catch-all route managed OAuth callbacks', () => { expect(handlerMocks.betterAuthGET).not.toHaveBeenCalled() }) - it('leaves ordinary connector callbacks with Better Auth', async () => { - handlerMocks.betterAuthGET.mockResolvedValueOnce(new Response(null, { status: 204 })) - const request = createMockRequest( - 'GET', - undefined, - {}, - 'http://localhost:3000/api/auth/oauth2/callback/jira?state=better-auth-state&code=code-1' - ) + it.each([true, false])( + 'preserves connector callbacks when the provider is enabled=%s', + async (enabled) => { + handlerMocks.oauthEnabled.mockResolvedValue(enabled) + handlerMocks.betterAuthGET.mockResolvedValueOnce(new Response(null, { status: 204 })) + const request = createMockRequest( + 'GET', + undefined, + {}, + 'http://localhost:3000/api/auth/oauth2/callback/jira?state=better-auth-state&code=code-1' + ) - const response = await GET(request) + const response = await GET(request) - expect(response.status).toBe(204) - expect(handlerMocks.betterAuthGET).toHaveBeenCalledWith(request) - expect(handlerMocks.credentialGroupCallback).not.toHaveBeenCalled() - }) + expect(response.status).toBe(204) + expect(handlerMocks.betterAuthGET).toHaveBeenCalledWith(request) + expect(handlerMocks.credentialGroupCallback).not.toHaveBeenCalled() + expect(handlerMocks.oauthEnabled).not.toHaveBeenCalled() + } + ) it('rejects a managed state sent to an unsupported connector callback', async () => { const request = createMockRequest( @@ -361,10 +371,46 @@ describe('OAuth provider client endpoints', () => { expect(handlerMocks.betterAuthPOST).toHaveBeenCalledTimes(1) }) + it.each(['oauth2/consent', 'oauth2/continue', 'oauth2/public-client-prelogin'])( + 'stops serving %s after the runtime flag changes', + async (path) => { + const request = () => + createMockRequest('POST', {}, {}, `http://localhost:3000/api/auth/${path}`) + expect((await POST(request())).status).toBe(200) + handlerMocks.betterAuthPOST.mockClear() + + handlerMocks.oauthEnabled.mockResolvedValue(false) + const disabled = await POST(request()) + expect(disabled.status).toBe(404) + expect(disabled.headers.get('cache-control')).toBe('no-store') + expect(handlerMocks.betterAuthPOST).not.toHaveBeenCalled() + + handlerMocks.oauthEnabled.mockResolvedValue(true) + expect((await POST(request())).status).toBe(200) + expect(handlerMocks.betterAuthPOST).toHaveBeenCalledOnce() + } + ) + + it.each([true, false])( + 'preserves connector POST callbacks when the provider is enabled=%s', + async (enabled) => { + handlerMocks.oauthEnabled.mockResolvedValue(enabled) + const request = createMockRequest( + 'POST', + {}, + {}, + 'http://localhost:3000/api/auth/oauth2/callback/jira' + ) + expect((await POST(request)).status).toBe(200) + expect(handlerMocks.betterAuthPOST).toHaveBeenCalledExactlyOnceWith(request) + expect(handlerMocks.oauthEnabled).not.toHaveBeenCalled() + } + ) + it.each([true, false])( 'preserves authenticated connector linking when the OAuth provider is enabled=%s', async (enabled) => { - setEnvFlags({ isOAuthProviderEnabled: enabled }) + handlerMocks.oauthEnabled.mockResolvedValue(enabled) const request = createMockRequest( 'POST', { providerId: 'google-email', callbackURL: 'http://localhost:3000/workspace' }, @@ -376,6 +422,7 @@ describe('OAuth provider client endpoints', () => { expect(response.status).toBe(200) expect(handlerMocks.betterAuthPOST).toHaveBeenCalledExactlyOnceWith(request) + expect(handlerMocks.oauthEnabled).not.toHaveBeenCalled() } ) }) diff --git a/apps/sim/app/api/auth/[...all]/route.ts b/apps/sim/app/api/auth/[...all]/route.ts index 20ee5c3ae52..f4f8b461fa3 100644 --- a/apps/sim/app/api/auth/[...all]/route.ts +++ b/apps/sim/app/api/auth/[...all]/route.ts @@ -4,6 +4,7 @@ import { sharedCredentialGroupOAuthCallbackContract } from '@/lib/api/contracts/ import { parseRequest } from '@/lib/api/server' import { auth } from '@/lib/auth' import { createAnonymousSession, ensureAnonymousUserExists } from '@/lib/auth/anonymous' +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature' import { isAuthDisabled } from '@/lib/core/config/env-flags' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { isCredentialGroupOAuthState } from '@/lib/credential-groups/oauth-state' @@ -186,5 +187,12 @@ export const POST = withRouteHandler(async (request: NextRequest) => { ) } + if (OAUTH_PROVIDER_PROTOCOL_POST_PATHS.has(path) && !(await isOAuthProviderEnabled())) { + return NextResponse.json( + { error: 'OAuth provider is not enabled' }, + { status: 404, headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' } } + ) + } + return betterAuthPOST(request) }) diff --git a/apps/sim/app/api/auth/oauth2/authorize/route.test.ts b/apps/sim/app/api/auth/oauth2/authorize/route.test.ts index 858538c90ed..659ba385fd2 100644 --- a/apps/sim/app/api/auth/oauth2/authorize/route.test.ts +++ b/apps/sim/app/api/auth/oauth2/authorize/route.test.ts @@ -1,15 +1,8 @@ /** * @vitest-environment node */ -import { - createMockRequest, - queueTableRows, - resetDbChainMock, - resetEnvFlagsMock, - schemaMock, - setEnvFlags, -} from '@sim/testing' -import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' +import { createMockRequest, queueTableRows, resetDbChainMock, schemaMock } from '@sim/testing' +import { beforeEach, describe, expect, it, vi } from 'vitest' import { ForbiddenOperationError } from '@/lib/core/application/forbidden' import { InsufficientWorkspacePermissionsError } from '@/lib/core/application/workspace-authorization' import { OrchestrationError } from '@/lib/core/orchestration/types' @@ -27,6 +20,7 @@ const mocks = vi.hoisted(() => ({ decryptQuickBooksClientConfig: vi.fn(), createQuickBooksState: vi.fn(), getCanonicalScopes: vi.fn(), + oauthEnabled: vi.fn(), })) vi.mock('better-auth/next-js', () => ({ @@ -37,6 +31,9 @@ vi.mock('@/lib/auth/auth', () => ({ getSession: mocks.getSession, auth: { handler: {}, api: { oAuth2LinkAccount: mocks.linkAccount } }, })) +vi.mock('@/lib/auth/oauth-provider-feature', () => ({ + isOAuthProviderEnabled: mocks.oauthEnabled, +})) vi.mock('@/lib/core/utils/urls', () => ({ SITE_URL: 'https://www.sim.ai', getBaseUrl: mocks.getBaseUrl, @@ -78,8 +75,6 @@ import { GET } from '@/app/api/auth/oauth2/authorize/route' const BASE_URL = 'https://sim.test' const WORKSPACE_ID = '11111111-2222-4333-8444-555555555555' -afterAll(resetEnvFlagsMock) - function request(query: Record) { const url = new URL('/api/auth/oauth2/authorize', BASE_URL) for (const [key, value] of Object.entries(query)) url.searchParams.set(key, value) @@ -97,7 +92,7 @@ describe('OAuth2 authorize route', () => { beforeEach(() => { vi.clearAllMocks() resetDbChainMock() - setEnvFlags({ isOAuthProviderEnabled: true }) + mocks.oauthEnabled.mockResolvedValue(true) mocks.getBaseUrl.mockReturnValue(BASE_URL) mocks.getSession.mockResolvedValue({ user: { id: 'user-1' }, @@ -154,13 +149,26 @@ describe('OAuth2 authorize route', () => { expect(mocks.createConnection).not.toHaveBeenCalled() }) - it('returns 404 without delegation when the provider is disabled', async () => { - setEnvFlags({ isOAuthProviderEnabled: false }) - - const response = await GET(request({ client_id: 'client-1' })) + it('applies a runtime flag change to the next authorization request', async () => { + const providerRequest = () => + request({ + client_id: 'client-1', + response_type: 'code', + redirect_uri: 'https://client.example/callback', + }) + expect((await GET(providerRequest())).status).toBe(302) + mocks.betterAuthGET.mockClear() - expect(response.status).toBe(404) + mocks.oauthEnabled.mockResolvedValue(false) + const disabled = await GET(providerRequest()) + expect(disabled.status).toBe(404) + expect(disabled.headers.get('cache-control')).toBe('no-store') expect(mocks.betterAuthGET).not.toHaveBeenCalled() + expect(mocks.getSession).not.toHaveBeenCalled() + + mocks.oauthEnabled.mockResolvedValue(true) + expect((await GET(providerRequest())).status).toBe(302) + expect(mocks.betterAuthGET).toHaveBeenCalledOnce() }) it('keeps an OAuth request missing client_id out of the connector flow', async () => { @@ -309,25 +317,30 @@ describe('OAuth2 authorize route', () => { expect(mocks.betterAuthGET).not.toHaveBeenCalled() }) - it('creates a canonical application draft for a legacy connect URL', async () => { - const response = await GET(request({ providerId: 'google-email', workspaceId: WORKSPACE_ID })) - - expect(response.headers.get('location')).toBe('https://provider.example/authorize') - expect(mocks.createConnection).toHaveBeenCalledWith( - expect.objectContaining({ - principal: { kind: 'session', userId: 'user-1', sessionId: 'session-1' }, - input: { workspaceId: WORKSPACE_ID, providerId: 'google-email' }, - }) - ) - expect(mocks.linkAccount).toHaveBeenCalledWith( - expect.objectContaining({ - body: expect.objectContaining({ - providerId: 'google-email', - callbackURL: expect.stringContaining('credentialDraftId=draft-1'), - }), - }) - ) - }) + it.each([true, false])( + 'preserves legacy connector linking when the provider is enabled=%s', + async (enabled) => { + mocks.oauthEnabled.mockResolvedValue(enabled) + const response = await GET(request({ providerId: 'google-email', workspaceId: WORKSPACE_ID })) + + expect(response.headers.get('location')).toBe('https://provider.example/authorize') + expect(mocks.createConnection).toHaveBeenCalledWith( + expect.objectContaining({ + principal: { kind: 'session', userId: 'user-1', sessionId: 'session-1' }, + input: { workspaceId: WORKSPACE_ID, providerId: 'google-email' }, + }) + ) + expect(mocks.linkAccount).toHaveBeenCalledWith( + expect.objectContaining({ + body: expect.objectContaining({ + providerId: 'google-email', + callbackURL: expect.stringContaining('credentialDraftId=draft-1'), + }), + }) + ) + expect(mocks.oauthEnabled).not.toHaveBeenCalled() + } + ) it('requires a configured OAuth client before creating a legacy draft', async () => { mocks.requireClient.mockImplementationOnce(() => { diff --git a/apps/sim/app/api/auth/oauth2/authorize/route.ts b/apps/sim/app/api/auth/oauth2/authorize/route.ts index 9630d9f8335..8b9ab03f09c 100644 --- a/apps/sim/app/api/auth/oauth2/authorize/route.ts +++ b/apps/sim/app/api/auth/oauth2/authorize/route.ts @@ -6,9 +6,9 @@ import { parseRequest } from '@/lib/api/server' import { auth, getSession } from '@/lib/auth/auth' import { oauthAuthorizationErrorResponse } from '@/lib/auth/oauth-authorization-error' import { validateOAuthPkceAuthorizationRequest } from '@/lib/auth/oauth-protocol-request' +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature' import { ForbiddenOperationError } from '@/lib/core/application/forbidden' import { requireConfiguredOAuthClient } from '@/lib/core/config/env-capabilities.server' -import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' import { OrchestrationError } from '@/lib/core/orchestration/types' import { getBaseUrl } from '@/lib/core/utils/urls' import { isSameOrigin } from '@/lib/core/utils/validation' @@ -73,8 +73,11 @@ function isOAuthProviderAuthorize(request: NextRequest): boolean { */ export const GET = withRouteHandler(async (request: NextRequest) => { if (isOAuthProviderAuthorize(request)) { - if (!isOAuthProviderEnabled) { - return NextResponse.json({ error: 'OAuth provider is not enabled' }, { status: 404 }) + if (!(await isOAuthProviderEnabled())) { + return NextResponse.json( + { error: 'OAuth provider is not enabled' }, + { status: 404, headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' } } + ) } const repeatedParameter = repeatedOAuthAuthorizeParameter(request) if (repeatedParameter) { diff --git a/apps/sim/app/api/auth/oauth2/revoke/route.test.ts b/apps/sim/app/api/auth/oauth2/revoke/route.test.ts index ba8ffeee203..c28088ca3df 100644 --- a/apps/sim/app/api/auth/oauth2/revoke/route.test.ts +++ b/apps/sim/app/api/auth/oauth2/revoke/route.test.ts @@ -5,15 +5,13 @@ import { NextRequest } from 'next/server' import { beforeEach, describe, expect, it, vi } from 'vitest' const mocks = vi.hoisted(() => ({ - enabled: true, + oauthEnabled: vi.fn(), rateLimit: vi.fn(async () => null), revoke: vi.fn(), })) -vi.mock('@/lib/core/config/env-flags', () => ({ - get isOAuthProviderEnabled() { - return mocks.enabled - }, +vi.mock('@/lib/auth/oauth-provider-feature', () => ({ + isOAuthProviderEnabled: mocks.oauthEnabled, })) vi.mock('@/lib/core/rate-limiter', () => ({ enforceIpRateLimit: mocks.rateLimit })) vi.mock('@/lib/auth/oauth-token-family', () => ({ revokeOAuthToken: mocks.revoke })) @@ -31,7 +29,7 @@ function revokeRequest(body: string) { describe('OAuth revocation route', () => { beforeEach(() => { vi.clearAllMocks() - mocks.enabled = true + mocks.oauthEnabled.mockResolvedValue(true) mocks.revoke.mockResolvedValue({ success: true, value: undefined }) }) @@ -47,6 +45,24 @@ describe('OAuth revocation route', () => { }) }) + it('applies the runtime flag before revocation admission or protected work', async () => { + const request = () => revokeRequest('client_id=sim-cli&token=sim_ort_current') + expect((await POST(request())).status).toBe(200) + mocks.revoke.mockClear() + mocks.rateLimit.mockClear() + + mocks.oauthEnabled.mockResolvedValue(false) + const disabled = await POST(request()) + expect(disabled.status).toBe(404) + expect(disabled.headers.get('cache-control')).toBe('no-store') + expect(mocks.revoke).not.toHaveBeenCalled() + expect(mocks.rateLimit).not.toHaveBeenCalled() + + mocks.oauthEnabled.mockResolvedValue(true) + expect((await POST(request())).status).toBe(200) + expect(mocks.revoke).toHaveBeenCalledOnce() + }) + it('returns a Basic challenge for Basic client-authentication failure', async () => { mocks.revoke.mockResolvedValue({ success: false, diff --git a/apps/sim/app/api/auth/oauth2/revoke/route.ts b/apps/sim/app/api/auth/oauth2/revoke/route.ts index ab79ffcd72c..53d7f96c1df 100644 --- a/apps/sim/app/api/auth/oauth2/revoke/route.ts +++ b/apps/sim/app/api/auth/oauth2/revoke/route.ts @@ -7,8 +7,8 @@ import { oauthRevocationSuccessResponse, parseOAuthFormRequest, } from '@/lib/auth/oauth-protocol-request' +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature' import { revokeOAuthToken } from '@/lib/auth/oauth-token-family' -import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' import { enforceIpRateLimit, type TokenBucketConfig } from '@/lib/core/rate-limiter' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' @@ -24,7 +24,7 @@ const REVOKE_RATE_LIMIT: TokenBucketConfig = { /** Revokes one opaque access token or the complete family named by a refresh token. */ export const POST = withRouteHandler(async (request: NextRequest) => { - if (!isOAuthProviderEnabled) { + if (!(await isOAuthProviderEnabled())) { return NextResponse.json( { error: 'OAuth provider is not enabled' }, { status: 404, headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' } } diff --git a/apps/sim/app/api/auth/oauth2/token/route.test.ts b/apps/sim/app/api/auth/oauth2/token/route.test.ts index f770be7b8a2..3aeba421e37 100644 --- a/apps/sim/app/api/auth/oauth2/token/route.test.ts +++ b/apps/sim/app/api/auth/oauth2/token/route.test.ts @@ -6,7 +6,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' const mocks = vi.hoisted(() => ({ betterAuthPost: vi.fn(async () => new Response('delegated', { status: 201 })), - enabled: true, + oauthEnabled: vi.fn(), rateLimit: vi.fn(async () => null), rotate: vi.fn(), validateClient: vi.fn(), @@ -19,10 +19,8 @@ vi.mock('@/lib/auth', () => ({ auth: { handler: vi.fn() } })) vi.mock('@/lib/auth/oauth-provider-adapter-guard', () => ({ withOAuthProviderIssuanceCompensation: (work: () => Promise) => work(), })) -vi.mock('@/lib/core/config/env-flags', () => ({ - get isOAuthProviderEnabled() { - return mocks.enabled - }, +vi.mock('@/lib/auth/oauth-provider-feature', () => ({ + isOAuthProviderEnabled: mocks.oauthEnabled, })) vi.mock('@/lib/core/rate-limiter', () => ({ enforceIpRateLimit: mocks.rateLimit })) vi.mock('@/lib/auth/oauth-token-family', () => ({ @@ -43,7 +41,7 @@ function tokenRequest(body: string) { describe('OAuth token route', () => { beforeEach(() => { vi.clearAllMocks() - mocks.enabled = true + mocks.oauthEnabled.mockResolvedValue(true) mocks.rotate.mockResolvedValue({ success: true, value: { @@ -347,12 +345,25 @@ describe('OAuth token route', () => { }) }) - it('does not expose the custom endpoint while the provider is disabled', async () => { - mocks.enabled = false + it('stops token issuance immediately after the runtime flag is disabled', async () => { + const request = () => + tokenRequest('grant_type=refresh_token&client_id=sim-cli&refresh_token=sim_ort_old') + expect((await POST(request())).status).toBe(200) + mocks.rotate.mockClear() + mocks.rateLimit.mockClear() + + mocks.oauthEnabled.mockResolvedValue(false) const response = await POST( tokenRequest('grant_type=refresh_token&client_id=sim-cli&refresh_token=sim_ort_old') ) expect(response.status).toBe(404) + expect(response.headers.get('cache-control')).toBe('no-store') expect(mocks.rotate).not.toHaveBeenCalled() + expect(mocks.rateLimit).not.toHaveBeenCalled() + expect(mocks.betterAuthPost).not.toHaveBeenCalled() + + mocks.oauthEnabled.mockResolvedValue(true) + expect((await POST(request())).status).toBe(200) + expect(mocks.rotate).toHaveBeenCalledOnce() }) }) diff --git a/apps/sim/app/api/auth/oauth2/token/route.ts b/apps/sim/app/api/auth/oauth2/token/route.ts index 03557898766..ad56ae01fc3 100644 --- a/apps/sim/app/api/auth/oauth2/token/route.ts +++ b/apps/sim/app/api/auth/oauth2/token/route.ts @@ -15,11 +15,11 @@ import { unsupportedGrantResponse, } from '@/lib/auth/oauth-protocol-request' import { withOAuthProviderIssuanceCompensation } from '@/lib/auth/oauth-provider-adapter-guard' +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature' import { rotateOAuthRefreshToken, validateOAuthClientCredentials, } from '@/lib/auth/oauth-token-family' -import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' import { enforceIpRateLimit, type TokenBucketConfig } from '@/lib/core/rate-limiter' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' @@ -40,7 +40,7 @@ const TOKEN_RATE_LIMIT: TokenBucketConfig = { * transaction that the provider does not expose as a configuration hook. */ export const POST = withRouteHandler(async (request: NextRequest) => { - if (!isOAuthProviderEnabled) { + if (!(await isOAuthProviderEnabled())) { return NextResponse.json( { error: 'OAuth provider is not enabled' }, { status: 404, headers: { 'Cache-Control': 'no-store', Pragma: 'no-cache' } } diff --git a/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts b/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts index 457e952db5c..1a7e0118441 100644 --- a/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts +++ b/apps/sim/lib/api/server/routes/v2-api-key-auth.test.ts @@ -8,11 +8,13 @@ const mocks = vi.hoisted(() => ({ updateLastUsed: vi.fn(), resolveWorkspaceBillingPayer: vi.fn(), getHighestPrioritySubscription: vi.fn(), + isOAuthProviderEnabled: vi.fn(), + envFlags: { isAuthDisabled: false }, })) -vi.mock('@/lib/core/config/env-flags', () => ({ - isAuthDisabled: false, - isOAuthProviderEnabled: true, +vi.mock('@/lib/core/config/env-flags', () => mocks.envFlags) +vi.mock('@/lib/auth/oauth-provider-feature', () => ({ + isOAuthProviderEnabled: mocks.isOAuthProviderEnabled, })) vi.mock('@/lib/api-key/crypto', () => ({ hashApiKey: (value: string) => `hash:${value}` })) vi.mock('@/lib/auth/oauth-provider', () => ({ OAUTH_ACCESS_TOKEN_PREFIX: 'sim_oat_' })) @@ -37,6 +39,8 @@ import { describe('v2 API key authentication', () => { beforeEach(() => { vi.clearAllMocks() + mocks.envFlags.isAuthDisabled = false + mocks.isOAuthProviderEnabled.mockResolvedValue(true) resetDbChainMock() mocks.updateLastUsed.mockResolvedValue(undefined) mocks.getHighestPrioritySubscription.mockResolvedValue(null) @@ -189,6 +193,8 @@ describe('v2 API key authentication', () => { describe('v2 bearer token authentication', () => { beforeEach(() => { vi.clearAllMocks() + mocks.envFlags.isAuthDisabled = false + mocks.isOAuthProviderEnabled.mockResolvedValue(true) resetDbChainMock() mocks.getHighestPrioritySubscription.mockResolvedValue({ plan: 'pro', @@ -267,7 +273,8 @@ describe('v2 bearer token authentication', () => { expect(mocks.updateLastUsed).not.toHaveBeenCalled() }) - it('prefers the API key when both credentials are presented', async () => { + it.each([true, false])('prefers the API key with OAuth enabled=%s', async (enabled) => { + mocks.isOAuthProviderEnabled.mockResolvedValue(enabled) queueTableRows(schemaMock.apiKey, [ { id: 'key-1', @@ -282,6 +289,45 @@ describe('v2 bearer token authentication', () => { const result = await authenticateV2ApiKey({ apiKey: 'secret', bearer: 'sim_oat_ignored' }) expect(result.keyType).toBe('personal') + expect(mocks.isOAuthProviderEnabled).not.toHaveBeenCalled() + }) + + it('applies runtime flag changes without reloading the authenticator', async () => { + mocks.isOAuthProviderEnabled + .mockResolvedValueOnce(true) + .mockResolvedValueOnce(false) + .mockResolvedValueOnce(true) + queueTableRows(schemaMock.oauthAccessToken, [tokenRow()]) + queueTableRows(schemaMock.oauthAccessToken, [tokenRow()]) + const credential = { apiKey: null, bearer: 'sim_oat_secret' } + + await expect(authenticateV2ApiKey(credential)).resolves.toMatchObject({ + keyType: 'oauth_access_token', + }) + await expect(authenticateV2ApiKey(credential)).rejects.toMatchObject({ + message: 'Bearer tokens are not accepted', + challenge: 'bearer', + }) + expect(dbChainMockFns.limit).toHaveBeenCalledTimes(1) + await expect(authenticateV2ApiKey(credential)).resolves.toMatchObject({ + keyType: 'oauth_access_token', + }) + expect(mocks.isOAuthProviderEnabled).toHaveBeenCalledTimes(3) + expect(mocks.isOAuthProviderEnabled).toHaveBeenCalledWith() + expect(dbChainMockFns.limit).toHaveBeenCalledTimes(2) + }) + + it('preserves auth-disabled deployment behavior without reading the OAuth flag', async () => { + mocks.envFlags.isAuthDisabled = true + + await expect( + authenticateV2ApiKey({ apiKey: null, bearer: 'sim_oat_unused' }) + ).resolves.toMatchObject({ + principal: { kind: 'personal_api_key', keyId: 'auth-disabled' }, + keyType: 'personal', + }) + expect(mocks.isOAuthProviderEnabled).not.toHaveBeenCalled() + expect(dbChainMockFns.limit).not.toHaveBeenCalled() }) it('answers a refused bearer with the bearer challenge, and a missing one with the key challenge', async () => { diff --git a/apps/sim/lib/api/server/routes/v2-api-key-auth.ts b/apps/sim/lib/api/server/routes/v2-api-key-auth.ts index 2c6c72e4104..b70596830a3 100644 --- a/apps/sim/lib/api/server/routes/v2-api-key-auth.ts +++ b/apps/sim/lib/api/server/routes/v2-api-key-auth.ts @@ -12,9 +12,10 @@ import { hashApiKey } from '@/lib/api-key/crypto' import { updateApiKeyLastUsed } from '@/lib/api-key/service' import { ANONYMOUS_USER_ID } from '@/lib/auth/constants' import { InvalidOAuthAccessTokenError, verifyOAuthAccessToken } from '@/lib/auth/oauth-access-token' +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature' import { resolveWorkspaceBillingPayer } from '@/lib/billing/core/billing-attribution' import { getHighestPrioritySubscription } from '@/lib/billing/core/subscription' -import { isAuthDisabled, isOAuthProviderEnabled } from '@/lib/core/config/env-flags' +import { isAuthDisabled } from '@/lib/core/config/env-flags' const logger = createLogger('V2ApiKeyAuth') @@ -150,7 +151,7 @@ async function authenticateApiKey(apiKeyHeader: string): Promise { - if (!isOAuthProviderEnabled) { + if (!(await isOAuthProviderEnabled())) { throw new V2ApiKeyUnauthenticatedError('Bearer tokens are not accepted', 'bearer') } let principal: OAuthAccessTokenPrincipal diff --git a/apps/sim/lib/auth/auth.ts b/apps/sim/lib/auth/auth.ts index 97af0db6a49..99b86653227 100644 --- a/apps/sim/lib/auth/auth.ts +++ b/apps/sim/lib/auth/auth.ts @@ -54,6 +54,7 @@ import { OAUTH_SCOPES, SIM_CLI_CLIENT_ID, } from '@/lib/auth/oauth-provider' +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature' import { getSessionCookieCacheVersion } from '@/lib/auth/security-policy' import { clampExpiryForSession } from '@/lib/auth/session-policy' import { getActiveOrganizationId } from '@/lib/auth/session-response' @@ -108,7 +109,6 @@ import { isGoogleAuthDisabled, isHosted, isMicrosoftAuthDisabled, - isOAuthProviderEnabled, isOrganizationsEnabled, isRegistrationDisabled, isSignupMxValidationEnabled, @@ -949,6 +949,17 @@ export const auth = betterAuth({ }, hooks: { before: createAuthMiddleware(async (ctx) => { + /** Keep direct plugin calls behind the runtime gate without blocking connector OAuth. */ + if ( + ((ctx.path.startsWith('/oauth2/') && + ctx.path !== '/oauth2/link' && + !ctx.path.startsWith('/oauth2/callback/')) || + ctx.path === '/.well-known/oauth-authorization-server') && + !(await isOAuthProviderEnabled()) + ) { + throw new APIError('NOT_FOUND', { message: 'OAuth provider is not enabled' }) + } + /** * Better Auth 1.6.27 re-enters OAuth authorization when its own session * refresh sets a cookie, issuing a second code that is never returned. @@ -1315,8 +1326,11 @@ export const auth = betterAuth({ * ID-token semantics out of the advertised protocol. Clients are DB rows * only (the CLI is seeded by migration, the rest are admin-created), so * both registration paths stay closed. + * + * Register once; request-time gates let AppConfig change availability + * without a restart. */ - ...(isOAuthProviderEnabled + ...(!isAuthDisabled ? [ oauthProvider({ loginPage: '/oauth/sign-in', diff --git a/apps/sim/lib/auth/oauth-provider-feature.test.ts b/apps/sim/lib/auth/oauth-provider-feature.test.ts new file mode 100644 index 00000000000..4ffb43a1e73 --- /dev/null +++ b/apps/sim/lib/auth/oauth-provider-feature.test.ts @@ -0,0 +1,41 @@ +/** + * @vitest-environment node + */ +import { resetEnvFlagsMock, setEnvFlags } from '@sim/testing' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' + +const { mockIsFeatureEnabled } = vi.hoisted(() => ({ mockIsFeatureEnabled: vi.fn() })) + +vi.mock('@/lib/core/config/feature-flags', () => ({ isFeatureEnabled: mockIsFeatureEnabled })) + +/** Isolates the real helper from route suites that mock it in the shared worker. */ +declare module '@/lib/auth/oauth-provider-feature?oauth-provider-feature-test' { + // biome-ignore lint/suspicious/noExportsInTest: ambient declaration for the isolated test import + export * from '@/lib/auth/oauth-provider-feature' +} + +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature?oauth-provider-feature-test' + +afterAll(resetEnvFlagsMock) + +describe('OAuth provider rollout', () => { + beforeEach(() => { + vi.clearAllMocks() + setEnvFlags({ isAuthDisabled: false }) + }) + + it('evaluates the global flag again on subsequent requests', async () => { + mockIsFeatureEnabled.mockResolvedValueOnce(false).mockResolvedValueOnce(true) + await expect(isOAuthProviderEnabled()).resolves.toBe(false) + await expect(isOAuthProviderEnabled()).resolves.toBe(true) + expect(mockIsFeatureEnabled).toHaveBeenNthCalledWith(1, 'oauth-provider') + expect(mockIsFeatureEnabled).toHaveBeenNthCalledWith(2, 'oauth-provider') + }) + + it('cannot enable OAuth without user authentication', async () => { + setEnvFlags({ isAuthDisabled: true }) + mockIsFeatureEnabled.mockResolvedValue(true) + await expect(isOAuthProviderEnabled()).resolves.toBe(false) + expect(mockIsFeatureEnabled).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/lib/auth/oauth-provider-feature.ts b/apps/sim/lib/auth/oauth-provider-feature.ts new file mode 100644 index 00000000000..52911163c20 --- /dev/null +++ b/apps/sim/lib/auth/oauth-provider-feature.ts @@ -0,0 +1,7 @@ +import { isAuthDisabled } from '@/lib/core/config/env-flags' +import { isFeatureEnabled } from '@/lib/core/config/feature-flags' + +/** Global runtime rollout gate; OAuth requires real user sessions. */ +export async function isOAuthProviderEnabled(): Promise { + return !isAuthDisabled && (await isFeatureEnabled('oauth-provider')) +} diff --git a/apps/sim/lib/auth/oauth-provider-metadata.test.ts b/apps/sim/lib/auth/oauth-provider-metadata.test.ts index 80ec6cea602..509a8dd440d 100644 --- a/apps/sim/lib/auth/oauth-provider-metadata.test.ts +++ b/apps/sim/lib/auth/oauth-provider-metadata.test.ts @@ -1,12 +1,16 @@ /** * @vitest-environment node */ -import { resetEnvFlagsMock, setEnvFlags } from '@sim/testing' import { NextRequest } from 'next/server' -import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' +import { beforeEach, describe, expect, it, vi } from 'vitest' const mocks = vi.hoisted(() => ({ getOAuthServerConfig: vi.fn(), + isOAuthProviderEnabled: vi.fn(), +})) + +vi.mock('@/lib/auth/oauth-provider-feature', () => ({ + isOAuthProviderEnabled: mocks.isOAuthProviderEnabled, })) vi.mock('@/lib/auth/auth', () => ({ @@ -40,7 +44,7 @@ async function callRoute( describe('OAuth provider metadata', () => { beforeEach(() => { vi.clearAllMocks() - setEnvFlags({ isOAuthProviderEnabled: true }) + mocks.isOAuthProviderEnabled.mockResolvedValue(true) mocks.getOAuthServerConfig.mockResolvedValue({ issuer: 'https://sim.test/api/auth', authorization_endpoint: 'https://sim.test/api/auth/oauth2/authorize', @@ -54,8 +58,6 @@ describe('OAuth provider metadata', () => { }) }) - afterAll(resetEnvFlagsMock) - it.each(routes)('serves equivalent metadata from the %s alias', async (_name, route, path) => { const response = await callRoute(route, path) const metadata = await response.json() @@ -84,13 +86,31 @@ describe('OAuth provider metadata', () => { it.each(routes)( 'returns 404 from the %s alias when the provider is disabled', async (_name, route, path) => { - setEnvFlags({ isOAuthProviderEnabled: false }) + mocks.isOAuthProviderEnabled.mockResolvedValue(false) const response = await callRoute(route, path) expect(response.status).toBe(404) expect(response.headers.get('access-control-allow-origin')).toBe('*') + expect(response.headers.get('cache-control')).toBe('no-store') expect(mocks.getOAuthServerConfig).not.toHaveBeenCalled() } ) + + it.each(routes)( + 'rechecks the runtime flag for each request to the %s alias', + async (_name, route, path) => { + mocks.isOAuthProviderEnabled + .mockResolvedValueOnce(true) + .mockResolvedValueOnce(false) + .mockResolvedValueOnce(true) + + expect((await callRoute(route, path)).status).toBe(200) + expect((await callRoute(route, path)).status).toBe(404) + expect((await callRoute(route, path)).status).toBe(200) + expect(mocks.isOAuthProviderEnabled).toHaveBeenCalledTimes(3) + expect(mocks.isOAuthProviderEnabled).toHaveBeenCalledWith() + expect(mocks.getOAuthServerConfig).toHaveBeenCalledTimes(2) + } + ) }) diff --git a/apps/sim/lib/auth/oauth-provider-metadata.ts b/apps/sim/lib/auth/oauth-provider-metadata.ts index ea33e797fe0..949004642fd 100644 --- a/apps/sim/lib/auth/oauth-provider-metadata.ts +++ b/apps/sim/lib/auth/oauth-provider-metadata.ts @@ -1,6 +1,6 @@ import { NextResponse } from 'next/server' import { auth } from '@/lib/auth/auth' -import { isOAuthProviderEnabled } from '@/lib/core/config/env-flags' +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature' const DISCOVERY_CACHE_SECONDS = 300 @@ -41,10 +41,10 @@ export async function getOAuthProviderMetadata() { /** One response contract for every RFC 8414 discovery alias Sim exposes. */ export async function getOAuthProviderMetadataResponse(): Promise { - if (!isOAuthProviderEnabled) { + if (!(await isOAuthProviderEnabled())) { return NextResponse.json( { error: 'OAuth provider is not enabled' }, - { status: 404, headers: DISCOVERY_HEADERS } + { status: 404, headers: { ...DISCOVERY_HEADERS, 'Cache-Control': 'no-store' } } ) } return NextResponse.json(await getOAuthProviderMetadata(), { headers: DISCOVERY_HEADERS }) diff --git a/apps/sim/lib/core/config/env-flags.ts b/apps/sim/lib/core/config/env-flags.ts index de933a695b8..9fe590a0a8a 100644 --- a/apps/sim/lib/core/config/env-flags.ts +++ b/apps/sim/lib/core/config/env-flags.ts @@ -315,18 +315,6 @@ function enterpriseFeatureEnabled( }) } -/** - * Is Sim acting as an OAuth 2.0 authorization server: the `/oauth2/*` Better - * Auth routes, the consent page, and bearer-token acceptance on `/api/v2`. - * Explicit opt-in keeps a rolling deployment from issuing a family token on a - * new instance and refreshing it through an old instance that lacks the - * transactional family implementation. Auth-disabled deployments cannot complete Better Auth's - * session-bound authorization flow, so they use the CLI's pairing handoff - * instead. Authorized-app history remains visible while issuance is off so - * historical grants can still be revoked. - */ -export const isOAuthProviderEnabled = !isAuthDisabled && isTruthy(env.OAUTH_PROVIDER_ENABLED) - /** * Is SSO enabled for enterprise authentication */ diff --git a/apps/sim/lib/core/config/env.ts b/apps/sim/lib/core/config/env.ts index 82db943e5ab..ec737c8ac7f 100644 --- a/apps/sim/lib/core/config/env.ts +++ b/apps/sim/lib/core/config/env.ts @@ -621,7 +621,7 @@ export const env = createEnv({ /** Comma-separated proxy IPs/CIDRs skipped while resolving the forwarded client chain. */ AUTH_TRUSTED_PROXIES: z.string().optional(), - /** Sim's OAuth provider remains an explicit opt-in for rollout safety. */ + /** Fallback for the global oauth-provider feature flag when AppConfig has no document. */ OAUTH_PROVIDER_ENABLED: z.boolean().optional(), // SSO Configuration (for script-based registration) diff --git a/apps/sim/lib/core/config/feature-flags.test.ts b/apps/sim/lib/core/config/feature-flags.test.ts index 2d28ffa4cf4..4aa4597245e 100644 --- a/apps/sim/lib/core/config/feature-flags.test.ts +++ b/apps/sim/lib/core/config/feature-flags.test.ts @@ -15,6 +15,7 @@ const { mockFetch, mockIsPlatformAdmin, envRef } = vi.hoisted(() => ({ TABLE_ROW_TTL: undefined as boolean | undefined, CREDENTIAL_GROUPS: undefined as boolean | undefined, KNOWLEDGE_MEMBER_ACCESS: undefined as boolean | undefined, + OAUTH_PROVIDER_ENABLED: undefined as boolean | undefined, }, })) @@ -125,6 +126,34 @@ describe('isFeatureEnabled', () => { setEnvFlags({ isAppConfigEnabled: false }) envRef.CREDENTIAL_GROUPS = undefined envRef.KNOWLEDGE_MEMBER_ACCESS = undefined + envRef.OAUTH_PROVIDER_ENABLED = undefined + }) + + describe('oauth-provider flag', () => { + it('uses the global fallback only when AppConfig has no document', async () => { + expect(await isFeatureEnabled('oauth-provider')).toBe(false) + envRef.OAUTH_PROVIDER_ENABLED = true + expect(await isFeatureEnabled('oauth-provider')).toBe(true) + + setEnvFlags({ isAppConfigEnabled: true }) + mockFetch.mockResolvedValue(null) + expect(await isFeatureEnabled('oauth-provider')).toBe(true) + }) + + it('reads runtime changes from AppConfig without targeting or admin lookups', async () => { + envRef.OAUTH_PROVIDER_ENABLED = true + withAppConfig({ 'oauth-provider': { enabled: false } }) + expect(await isFeatureEnabled('oauth-provider')).toBe(false) + + withAppConfig({ 'oauth-provider': { enabled: true } }) + expect(await isFeatureEnabled('oauth-provider')).toBe(true) + + withAppConfig({ 'oauth-provider': { enabled: false } }) + expect(await isFeatureEnabled('oauth-provider')).toBe(false) + withAppConfig({}) + expect(await isFeatureEnabled('oauth-provider')).toBe(false) + expect(mockIsPlatformAdmin).not.toHaveBeenCalled() + }) }) describe('knowledge-member-access flag', () => { diff --git a/apps/sim/lib/core/config/feature-flags.ts b/apps/sim/lib/core/config/feature-flags.ts index bf6de543ba9..fb9ce87bb17 100644 --- a/apps/sim/lib/core/config/feature-flags.ts +++ b/apps/sim/lib/core/config/feature-flags.ts @@ -46,6 +46,12 @@ interface FeatureFlagDefinition { /** The single registry of known flags. To add a flag, add one entry here. */ const FEATURE_FLAGS = { + 'oauth-provider': { + description: + 'Enable OAuth authorization, discovery, and API bearer tokens. Global on/off only; ' + + 'enable after all app instances support the OAuth token-family lifecycle.', + fallback: 'OAUTH_PROVIDER_ENABLED', + }, 'trigger-eu-region': { description: 'Route Trigger.dev runs to eu-central-1 instead of the default us-east-1. Global on/off ' + diff --git a/apps/sim/proxy.ts b/apps/sim/proxy.ts index 2be3af07a34..4ff5d0b4307 100644 --- a/apps/sim/proxy.ts +++ b/apps/sim/proxy.ts @@ -1,14 +1,10 @@ import { createLogger } from '@sim/logger' import { getSessionCookie } from 'better-auth/cookies' import { type NextRequest, NextResponse } from 'next/server' +import { isOAuthProviderEnabled } from '@/lib/auth/oauth-provider-feature' import { isOAuthAuthorizationCallback, resolveAuthRedirect } from '@/app/(auth)/auth-redirect' import { getEnv } from './lib/core/config/env' -import { - isAuthDisabled, - isDev, - isHosted, - isOAuthProviderEnabled, -} from './lib/core/config/env-flags' +import { isAuthDisabled, isDev, isHosted } from './lib/core/config/env-flags' import { generateRuntimeCSP } from './lib/core/security/csp' import { getClientIp } from './lib/core/utils/request' import { isNonCanonicalSimHost } from './lib/core/utils/urls' @@ -339,7 +335,7 @@ export async function proxy(request: NextRequest) { inviteFlow: url.searchParams.get('invite_flow'), }) const isOAuthSignIn = - isOAuthProviderEnabled && isOAuthAuthorizationCallback(rawCallbackUrl, url.origin) + isOAuthAuthorizationCallback(rawCallbackUrl, url.origin) && (await isOAuthProviderEnabled()) if (hasActiveSession && !isOAuthSignIn) { return applyIndexingPolicy(request, NextResponse.redirect(new URL('/workspace', request.url))) } diff --git a/packages/testing/src/mocks/env-flags.mock.ts b/packages/testing/src/mocks/env-flags.mock.ts index 8216632014b..0eb882a5925 100644 --- a/packages/testing/src/mocks/env-flags.mock.ts +++ b/packages/testing/src/mocks/env-flags.mock.ts @@ -29,7 +29,6 @@ export interface EnvFlagsMockState { isTriggerDevEnabled: boolean isEnterpriseEnabled: boolean isSsoEnabled: boolean - isOAuthProviderEnabled: boolean isUsageMonitoringEnabled: boolean isAccessControlEnabled: boolean isOrganizationsEnabled: boolean @@ -82,7 +81,6 @@ const defaultEnvFlagsState: EnvFlagsMockState = { isEnterpriseEnabled: false, isSsoEnabled: false, /** OAuth-aware route behavior is available unless a suite overrides it. */ - isOAuthProviderEnabled: true, isUsageMonitoringEnabled: false, isAccessControlEnabled: false, isOrganizationsEnabled: false, From dede15091a1526a891e6c9daab2e45f23678face Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 18:00:38 -0700 Subject: [PATCH 30/31] fix(scim): certification audit round Three read-only auditors (IdP compatibility and docs, correctness and regressions, code economy and tests) reviewed the merged branch. Every verified finding is addressed here. Sync-breaking and regressions: - Accept provider extension URNs in `schemas` (Okta custom attributes, Entra custom extensions) and echo them on the resource; the check now lives in the write contracts. - A lapsed enterprise plan no longer keeps refusing manual membership changes, invitations, or SSO JIT on a directory's behalf. - Leaving a workspace no longer signs the leaver out (session spared). - OAuth access and refresh tokens are refused for a directory-suspended account, like sessions and personal keys. - Workspace-role changes for a directory-managed member are refused under membership locking, as the docs already said. - A permission group moved back to governing everyone no longer fails a sync with a 500; the grant is left on record and logged. - The explicit-membership flip after auto-mapping now happens after the projection, keeping the permission-group lock a leaf. - Request-log prune runs before each pass, so a failing pass still bounds the log; contract-validation failures now carry scimType and detail in the activity log; `application/scim+json; charset=utf-8`. Economy: shared helpers replace local copies (postgres error code, SHA-256 base64url, bearer parsing, email syntax, batch reconcile loop); unreachable defensive checks behind the contracts removed; half-applied base-URL injection removed from the route builder; casts, restating comments, and unused exports dropped. Docs: withdrawal semantics under locking stated precisely; SCIM env vars added to the self-hosted, SSO, and environment-variable references; group name uniqueness noted. Tests: extension URN acceptance and echo, managed-membership guard and its entitlement bypass, directory-only SSO admission, OAuth suspension, permissions-route guard, settle step ordering, and the weak assertions the audit flagged strengthened. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01DGXcwsHzYGp6pUDWRtJKpz --- .../content/docs/platform/enterprise/scim.mdx | 9 +- .../docs/platform/enterprise/self-hosted.mdx | 1 + .../content/docs/platform/enterprise/sso.mdx | 4 + .../self-hosting/environment-variables.mdx | 1 + apps/sim/app/api/cron/scim-reconcile/route.ts | 4 +- apps/sim/app/api/scim/v2/Groups/[id]/route.ts | 3 +- apps/sim/app/api/scim/v2/Groups/route.ts | 3 +- apps/sim/app/api/scim/v2/Users/[id]/route.ts | 3 +- apps/sim/app/api/scim/v2/Users/route.ts | 3 +- .../workspaces/[id]/permissions/route.test.ts | 43 ++++++++- .../api/workspaces/[id]/permissions/route.ts | 22 +++++ .../app/api/workspaces/members/[id]/route.ts | 2 + .../lib/application/admin/connection-view.ts | 2 +- .../lib/application/groups/manage-groups.ts | 48 +++++++--- .../lib/application/users/provision-user.ts | 7 -- .../scim/lib/application/users/update-user.ts | 4 +- apps/sim/ee/scim/lib/authenticate.ts | 24 ++--- .../ee/scim/lib/identity/account-identity.ts | 1 - .../ee/scim/lib/managed-membership.test.ts | 89 +++++++++++++++++++ apps/sim/ee/scim/lib/managed-membership.ts | 22 +++-- .../ee/scim/lib/projection/auto-map.test.ts | 40 +++++++-- apps/sim/ee/scim/lib/projection/auto-map.ts | 61 ++++++++++--- .../lib/projection/reconcile-user.test.ts | 16 +++- .../ee/scim/lib/projection/reconcile-user.ts | 20 ++++- .../ee/scim/lib/protocol/canonical.test.ts | 50 ++++++++--- apps/sim/ee/scim/lib/protocol/canonical.ts | 58 ++---------- apps/sim/ee/scim/lib/protocol/errors.ts | 14 +-- apps/sim/ee/scim/lib/protocol/filter.test.ts | 4 +- apps/sim/ee/scim/lib/protocol/group-patch.ts | 2 - .../ee/scim/lib/protocol/resources.test.ts | 25 +++--- apps/sim/ee/scim/lib/protocol/resources.ts | 17 ++-- apps/sim/ee/scim/lib/protocol/user-patch.ts | 6 +- apps/sim/ee/scim/lib/reconcile/job.ts | 40 ++++----- apps/sim/ee/scim/lib/request-log.ts | 16 ++-- apps/sim/ee/scim/lib/route.ts | 8 +- apps/sim/lib/api/contracts/scim.ts | 28 ++++-- .../lib/api/server/routes/scim-route.test.ts | 8 +- apps/sim/lib/api/server/routes/scim-route.ts | 44 +++++---- apps/sim/lib/auth/auth.ts | 10 ++- apps/sim/lib/auth/oauth-access-token.test.ts | 4 + apps/sim/lib/auth/oauth-access-token.ts | 11 ++- apps/sim/lib/auth/oauth-token-family.ts | 11 ++- .../sso/application/admit-sso-user.test.ts | 35 ++++++++ .../auth/sso/application/admit-sso-user.ts | 7 +- .../lib/invitations/workspace-invitations.ts | 4 +- .../lib/workspaces/access/workspace-access.ts | 3 +- packages/db/schema.ts | 1 - 47 files changed, 577 insertions(+), 261 deletions(-) create mode 100644 apps/sim/ee/scim/lib/managed-membership.test.ts diff --git a/apps/docs/content/docs/platform/enterprise/scim.mdx b/apps/docs/content/docs/platform/enterprise/scim.mdx index d5c737ccdad..628bd9fe464 100644 --- a/apps/docs/content/docs/platform/enterprise/scim.mdx +++ b/apps/docs/content/docs/platform/enterprise/scim.mdx @@ -133,9 +133,11 @@ Mapping a permission group to a directory group switches that permission group t ## How access is withdrawn -Sim records every grant it makes on your behalf. When someone leaves a group, only what the directory granted is taken back — access a workspace administrator granted by hand stays. +Sim records every grant it makes on your behalf. When someone leaves a group, what the directory granted is taken back. -The one exception is **managed membership locking**, which is on by default. With it on, the directory is the source of truth: Sim refuses invitations, workspace grants, and role changes for provisioned members, because the next sync would revert them anyway. Removals stay possible so an administrator can always act in an emergency. Turn it off if you want to layer manual access on top of directory access. +**Managed membership locking**, on by default, makes the directory the source of truth for provisioned members: Sim refuses invitations, workspace grants, workspace role changes, and organization role changes for them, because the next sync would revert them anyway. Access a member already held by hand when a mapping started covering it counts as directory access from then on, so it is withdrawn with the mapping. Removals stay possible so an administrator can always act in an emergency. + +With locking off, manual access layers on top of directory access: access granted by hand stays when a group is left, and a workspace role raised by hand above what the directory set is left alone. ## Provisioning and SSO together @@ -156,7 +158,8 @@ Sim also re-applies every group mapping once an hour, so drift cannot persist. Y - Resources: `/Users`, `/Groups`, plus `/ServiceProviderConfig`, `/ResourceTypes`, and `/Schemas` - Filters: `eq` only, up to ten terms joined with `and`. Users: `id`, `userName`, `externalId`, `emails.value` (also `emails[type eq "work"].value`), `active`. Groups: `id`, `displayName`, `externalId` - Limits: 1,500 requests per minute per connection, 1 MB per request, 5,000 members per group -- `userName` is stored and returned lower-cased; attributes Sim does not model are kept and returned as sent, and a PUT preserves ones it omits +- `userName` is stored and returned lower-cased; top-level attributes and schema extensions Sim does not model (custom attributes included) are kept and returned as sent, and a PUT preserves ones it omits +- Group display names are unique within a connection, ignoring case - Page size: up to 100 per request { logger.info('SCIM reconciliation sweep complete', sweep) return NextResponse.json({ success: true, ...sweep }) } catch (error) { - logger.error('SCIM reconciliation sweep failed', { error: toError(error).message }) + logger.error('SCIM reconciliation sweep failed', { error: getErrorMessage(error) }) return NextResponse.json({ error: 'Internal server error' }, { status: 500 }) } }) diff --git a/apps/sim/app/api/scim/v2/Groups/[id]/route.ts b/apps/sim/app/api/scim/v2/Groups/[id]/route.ts index de66ed4964e..fc1343e359f 100644 --- a/apps/sim/app/api/scim/v2/Groups/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Groups/[id]/route.ts @@ -10,7 +10,7 @@ import { patchScimGroup, replaceScimGroup, } from '@/ee/scim/lib/application/groups/manage-groups' -import { assertGroupSchemas, toCanonicalGroup } from '@/ee/scim/lib/protocol/canonical' +import { toCanonicalGroup } from '@/ee/scim/lib/protocol/canonical' import { parseAttributeProjection } from '@/ee/scim/lib/protocol/resources' import { defineScimRoute } from '@/ee/scim/lib/route' @@ -32,7 +32,6 @@ export const PUT = defineScimRoute({ operation: replaceScimGroup.operation, useCase: replaceScimGroup, mapInput: ({ params, body }) => { - assertGroupSchemas(body.schemas) return { groupId: params.id, group: toCanonicalGroup(body) } }, present: (result) => result.resource, diff --git a/apps/sim/app/api/scim/v2/Groups/route.ts b/apps/sim/app/api/scim/v2/Groups/route.ts index 5ba8d22e7c5..1bfa92d5a46 100644 --- a/apps/sim/app/api/scim/v2/Groups/route.ts +++ b/apps/sim/app/api/scim/v2/Groups/route.ts @@ -1,6 +1,6 @@ import { createScimGroupContract, listScimGroupsContract } from '@/lib/api/contracts/scim' import { createScimGroup, listScimGroups } from '@/ee/scim/lib/application/groups/manage-groups' -import { assertGroupSchemas, toCanonicalGroup } from '@/ee/scim/lib/protocol/canonical' +import { toCanonicalGroup } from '@/ee/scim/lib/protocol/canonical' import { parseAttributeProjection, toListResponse } from '@/ee/scim/lib/protocol/resources' import { defineScimRoute } from '@/ee/scim/lib/route' @@ -24,7 +24,6 @@ export const POST = defineScimRoute({ operation: createScimGroup.operation, useCase: createScimGroup, mapInput: ({ body }) => { - assertGroupSchemas(body.schemas) return { group: toCanonicalGroup(body) } }, present: (result) => result.resource, diff --git a/apps/sim/app/api/scim/v2/Users/[id]/route.ts b/apps/sim/app/api/scim/v2/Users/[id]/route.ts index 93a8466f917..b3da9f3de24 100644 --- a/apps/sim/app/api/scim/v2/Users/[id]/route.ts +++ b/apps/sim/app/api/scim/v2/Users/[id]/route.ts @@ -7,7 +7,7 @@ import { import { deprovisionScimUser } from '@/ee/scim/lib/application/users/deprovision-user' import { getScimUser } from '@/ee/scim/lib/application/users/read-users' import { patchScimUser, replaceScimUser } from '@/ee/scim/lib/application/users/update-user' -import { assertUserSchemas, toCanonicalUser } from '@/ee/scim/lib/protocol/canonical' +import { toCanonicalUser } from '@/ee/scim/lib/protocol/canonical' import { parseAttributeProjection } from '@/ee/scim/lib/protocol/resources' import { defineScimRoute } from '@/ee/scim/lib/route' @@ -29,7 +29,6 @@ export const PUT = defineScimRoute({ operation: replaceScimUser.operation, useCase: replaceScimUser, mapInput: ({ params, body }) => { - assertUserSchemas(body.schemas) return { scimUserId: params.id, attributes: toCanonicalUser(body) } }, present: (result) => result.resource, diff --git a/apps/sim/app/api/scim/v2/Users/route.ts b/apps/sim/app/api/scim/v2/Users/route.ts index 9d241e8b5ad..93b5338d1d6 100644 --- a/apps/sim/app/api/scim/v2/Users/route.ts +++ b/apps/sim/app/api/scim/v2/Users/route.ts @@ -1,7 +1,7 @@ import { createScimUserContract, listScimUsersContract } from '@/lib/api/contracts/scim' import { provisionScimUser } from '@/ee/scim/lib/application/users/provision-user' import { listScimUsers } from '@/ee/scim/lib/application/users/read-users' -import { assertUserSchemas, toCanonicalUser } from '@/ee/scim/lib/protocol/canonical' +import { toCanonicalUser } from '@/ee/scim/lib/protocol/canonical' import { parseAttributeProjection, toListResponse } from '@/ee/scim/lib/protocol/resources' import { defineScimRoute } from '@/ee/scim/lib/route' @@ -31,7 +31,6 @@ export const POST = defineScimRoute({ operation: provisionScimUser.operation, useCase: provisionScimUser, mapInput: ({ body }) => { - assertUserSchemas(body.schemas) return { attributes: toCanonicalUser(body) } }, present: (result) => result.resource, diff --git a/apps/sim/app/api/workspaces/[id]/permissions/route.test.ts b/apps/sim/app/api/workspaces/[id]/permissions/route.test.ts index 36683982480..4e58f47cc1d 100644 --- a/apps/sim/app/api/workspaces/[id]/permissions/route.test.ts +++ b/apps/sim/app/api/workspaces/[id]/permissions/route.test.ts @@ -16,9 +16,18 @@ import { } from '@sim/testing' import { beforeEach, describe, expect, it, vi } from 'vitest' -const { mockSyncWorkspaceEnvCredentials, mockGetEffectiveWorkspacePermission } = vi.hoisted(() => ({ +const { + mockSyncWorkspaceEnvCredentials, + mockGetEffectiveWorkspacePermission, + mockAssertMembershipNotScimManaged, +} = vi.hoisted(() => ({ mockSyncWorkspaceEnvCredentials: vi.fn(), mockGetEffectiveWorkspacePermission: vi.fn(), + mockAssertMembershipNotScimManaged: vi.fn(), +})) + +vi.mock('@/ee/scim/lib/managed-membership', () => ({ + assertMembershipNotScimManaged: mockAssertMembershipNotScimManaged, })) vi.mock('@sim/audit', () => auditMock) @@ -37,6 +46,7 @@ vi.mock('@/lib/workspaces/permissions/utils', () => ({ getEffectiveWorkspacePermission: mockGetEffectiveWorkspacePermission, })) +import { ForbiddenOperationError } from '@/lib/core/application' import { PATCH } from '@/app/api/workspaces/[id]/permissions/route' const mockGetSession = authMockFns.mockGetSession @@ -558,6 +568,37 @@ describe('workspace permissions route', () => { }) }) + it('refuses a role change for a member the directory manages', async () => { + queueOrgWorkspace([], [permissionRow(MEMBER_ID, 'read')]) + mockAssertMembershipNotScimManaged.mockRejectedValueOnce( + new ForbiddenOperationError('SCIM_MANAGED_MEMBERSHIP', 'Managed by the directory') + ) + + const response = await PATCH( + createMockRequest('PATCH', { updates: [{ userId: MEMBER_ID, permissions: 'write' }] }), + routeContext + ) + + expect(response.status).toBe(403) + await expect(response.json()).resolves.toMatchObject({ error: 'Managed by the directory' }) + expect(mockAssertMembershipNotScimManaged).toHaveBeenCalledWith( + expect.objectContaining({ organizationId: ORG_ID, userId: MEMBER_ID }) + ) + expect(dbChainMockFns.update).not.toHaveBeenCalled() + }) + + it('does not consult the directory for a personal workspace', async () => { + queuePersonalWorkspace([permissionRow(ADMIN_ID, 'admin'), permissionRow(MEMBER_ID, 'read')]) + dbChainMockFns.returning.mockResolvedValue([{ id: 'perm-1' }]) + + await PATCH( + createMockRequest('PATCH', { updates: [{ userId: MEMBER_ID, permissions: 'write' }] }), + routeContext + ) + + expect(mockAssertMembershipNotScimManaged).not.toHaveBeenCalled() + }) + it('refuses to change the role of an organization admin', async () => { queueOrgWorkspace([{ userId: MEMBER_ID }], [permissionRow(MEMBER_ID, 'admin')]) diff --git a/apps/sim/app/api/workspaces/[id]/permissions/route.ts b/apps/sim/app/api/workspaces/[id]/permissions/route.ts index 4d5809de87d..05fe91930fc 100644 --- a/apps/sim/app/api/workspaces/[id]/permissions/route.ts +++ b/apps/sim/app/api/workspaces/[id]/permissions/route.ts @@ -12,6 +12,7 @@ import { } from '@/lib/api/contracts/workspaces' import { getValidationErrorMessage, parseRequest } from '@/lib/api/server' import { getSession } from '@/lib/auth' +import { ForbiddenOperationError } from '@/lib/core/application' import { HttpError } from '@/lib/core/utils/http-error' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { syncWorkspaceEnvCredentials } from '@/lib/credentials/environment' @@ -24,6 +25,7 @@ import { getWorkspaceWithOwner, hasWorkspaceAdminAccess, } from '@/lib/workspaces/permissions/utils' +import { assertMembershipNotScimManaged } from '@/ee/scim/lib/managed-membership' const logger = createLogger('WorkspacesPermissionsAPI') @@ -92,6 +94,16 @@ class WorkspaceBusyError extends HttpError { } } +/** A target whose membership the organization's directory owns; the guard's own wording names the remedy. */ +class DirectoryManagedMemberError extends HttpError { + readonly statusCode = 403 + + constructor(cause: ForbiddenOperationError) { + super(cause.message) + this.name = 'DirectoryManagedMemberError' + } +} + /** * Bounds the wait on the row locks below so a stuck holder fails fast * (SQLSTATE 55P03) instead of parking a pooled connection indefinitely. @@ -376,6 +388,15 @@ export const PATCH = withRouteHandler( orgAdminUserIds = new Set( lockedMembers.filter((row) => isOrgAdminRole(row.role)).map((row) => row.userId) ) + /** + * A directory that owns membership also owns the workspace role it set, + * so the change is refused here for the same reason an invitation is: + * the next sync would revert it. Checked under the member lock so a + * connection enabled mid-request cannot slip a change past it. + */ + for (const userId of targetUserIds) { + await assertMembershipNotScimManaged({ organizationId, userId, executor: tx }) + } } /** @@ -526,6 +547,7 @@ export const PATCH = withRouteHandler( }) throw new WorkspaceBusyError() } + if (error instanceof ForbiddenOperationError) throw new DirectoryManagedMemberError(error) throw error }) diff --git a/apps/sim/app/api/workspaces/members/[id]/route.ts b/apps/sim/app/api/workspaces/members/[id]/route.ts index 5a35a0721fb..64d47166fcb 100644 --- a/apps/sim/app/api/workspaces/members/[id]/route.ts +++ b/apps/sim/app/api/workspaces/members/[id]/route.ts @@ -179,6 +179,8 @@ export const DELETE = withRouteHandler( organizationId, memberId: orgMembership.id, requireNoOrgWorkspaceAccess: true, + /** Leaving a workspace must not sign the leaver out of Sim. */ + spareSessionToken: session.session.token, }) if (removal.success && removal.removed) { diff --git a/apps/sim/ee/scim/lib/application/admin/connection-view.ts b/apps/sim/ee/scim/lib/application/admin/connection-view.ts index c26835ed34a..c59c373143f 100644 --- a/apps/sim/ee/scim/lib/application/admin/connection-view.ts +++ b/apps/sim/ee/scim/lib/application/admin/connection-view.ts @@ -16,7 +16,7 @@ import { activeCredentialCondition } from '@/ee/scim/lib/repository/credentials' /** Reads shared by the admin use cases: the connection row and its settings view. */ -export interface ConnectionRow { +interface ConnectionRow { id: string organizationId: string status: string diff --git a/apps/sim/ee/scim/lib/application/groups/manage-groups.ts b/apps/sim/ee/scim/lib/application/groups/manage-groups.ts index 35a8c691b25..7fc9ee761e0 100644 --- a/apps/sim/ee/scim/lib/application/groups/manage-groups.ts +++ b/apps/sim/ee/scim/lib/application/groups/manage-groups.ts @@ -11,7 +11,10 @@ import { type ScimUseCaseContext, } from '@/ee/scim/lib/application/authorized-scim-use-case' import { scimOperations } from '@/ee/scim/lib/application/operations' -import { autoMapPermissionGroupByName } from '@/ee/scim/lib/projection/auto-map' +import { + autoMapPermissionGroupByName, + settleMappedPermissionGroupsExplicit, +} from '@/ee/scim/lib/projection/auto-map' import { reconcileUsersProjection } from '@/ee/scim/lib/projection/reconcile-user' import type { CanonicalScimGroup } from '@/ee/scim/lib/protocol/canonical' import { SCIM_MAX_GROUP_MEMBERS } from '@/ee/scim/lib/protocol/constants' @@ -74,11 +77,8 @@ async function assertDisplayNameAvailable( ) ) .limit(1) - if (clash) uniquenessThrow(params.displayName) -} - -function uniquenessThrow(displayName: string): never { - throw uniqueness(`A group named ${displayName} already exists in this directory`) + if (clash) + throw uniqueness(`A group named ${params.displayName} already exists in this directory`) } async function assertMemberCount(tx: DbOrTx, groupId: string): Promise { @@ -197,13 +197,13 @@ export const createScimGroup = defineAuthorizedScimUseCase({ } await assertMemberCount(tx, created.id) - if (context.connection.settings.autoMapPermissionGroupsByName) { - await autoMapPermissionGroupByName(tx, { - organizationId: context.organizationId, - scimGroupId: created.id, - displayName: created.displayName, - }) - } + const mapped = context.connection.settings.autoMapPermissionGroupsByName + ? await autoMapPermissionGroupByName(tx, { + organizationId: context.organizationId, + scimGroupId: created.id, + displayName: created.displayName, + }) + : 'no-match' await reconcileUsersProjection(tx, { connectionId: context.connection.id, @@ -211,6 +211,12 @@ export const createScimGroup = defineAuthorizedScimUseCase({ scimUserIds: memberIds, settings: context.connection.settings, }) + if (mapped === 'mapped') { + await settleMappedPermissionGroupsExplicit(tx, { + organizationId: context.organizationId, + scimGroupId: created.id, + }) + } const members = await loadGroupMembers(tx, created.id) return { @@ -265,12 +271,14 @@ export const replaceScimGroup = defineAuthorizedScimUseCase({ externalId: input.group.externalId ?? null, }) } + let adopted = false if (renamed && context.connection.settings.autoMapPermissionGroupsByName) { const mapped = await autoMapPermissionGroupByName(tx, { organizationId: context.organizationId, scimGroupId: current.id, displayName: input.group.displayName, }) + adopted = mapped === 'mapped' /** A mapping gained or lost applies to everyone already in the group, not only to those moving today. */ if (mapped === 'mapped' || mapped === 'unmapped') for (const scimUserId of before) touched.add(scimUserId) @@ -292,6 +300,12 @@ export const replaceScimGroup = defineAuthorizedScimUseCase({ scimUserIds: [...touched], settings: context.connection.settings, }) + if (adopted) { + await settleMappedPermissionGroupsExplicit(tx, { + organizationId: context.organizationId, + scimGroupId: current.id, + }) + } const refreshed = await findScimGroupById(tx, context.connection.id, current.id) if (!refreshed) throw new ScimError(500, undefined, 'The group could not be read back') @@ -342,6 +356,7 @@ export const patchScimGroup = defineAuthorizedScimUseCase({ const current = await findScimGroupById(tx, context.connection.id, input.groupId) if (!current) throw notFound('SCIM Group not found') + let adopted = false const touched = new Set() let renamed = false @@ -391,6 +406,7 @@ export const patchScimGroup = defineAuthorizedScimUseCase({ scimGroupId: current.id, displayName: patch.displayName, }) + adopted = adopted || mapped === 'mapped' if (mapped === 'mapped' || mapped === 'unmapped') { for (const scimUserId of await loadGroupMemberIds(tx, current.id)) { touched.add(scimUserId) @@ -417,6 +433,12 @@ export const patchScimGroup = defineAuthorizedScimUseCase({ scimUserIds: [...touched], settings: context.connection.settings, }) + if (adopted) { + await settleMappedPermissionGroupsExplicit(tx, { + organizationId: context.organizationId, + scimGroupId: current.id, + }) + } return { groupId: current.id, diff --git a/apps/sim/ee/scim/lib/application/users/provision-user.ts b/apps/sim/ee/scim/lib/application/users/provision-user.ts index 3f22efc988c..c5728fedf60 100644 --- a/apps/sim/ee/scim/lib/application/users/provision-user.ts +++ b/apps/sim/ee/scim/lib/application/users/provision-user.ts @@ -86,13 +86,6 @@ export const provisionScimUser = defineAuthorizedScimUseCase({ const { attributes } = input const email = primaryEmail(attributes) - /** - * Account creation happens before the transaction because it runs through - * Better Auth, which owns its own writes and its own hooks — the blocked - * email gate, the usage-counter row, and instance-organization placement all - * hang off them. Reimplementing that with a direct insert would skip every - * one. - */ /** * In instance-organization mode every account is placed in the instance * organization at creation, and an account belongs to one organization. A diff --git a/apps/sim/ee/scim/lib/application/users/update-user.ts b/apps/sim/ee/scim/lib/application/users/update-user.ts index 0d4db216d67..d2e6984075e 100644 --- a/apps/sim/ee/scim/lib/application/users/update-user.ts +++ b/apps/sim/ee/scim/lib/application/users/update-user.ts @@ -55,7 +55,7 @@ async function applyUserUpdate( next: ScimUserAttributes ): Promise { const nextEmail = primaryEmail(next) - const emailChanged = normalizeEmail(nextEmail) !== normalizeEmail(current.email) + const emailChanged = accountEmailDiverged(current, next) const deactivated = current.active && !next.active const reactivated = !current.active && next.active @@ -206,7 +206,7 @@ function auditEntries(result: UpdateScimUserResult): ScimAuditEntry[] | undefine return entries } -async function invalidateIfAccessChanged(result: UpdateScimUserResult, organizationId: string) { +function invalidateIfAccessChanged(result: UpdateScimUserResult, organizationId: string): void { if (!result.outcome) return if (result.outcome.emailChanged || result.outcome.deactivated || result.outcome.reactivated) { invalidateAfterSessionRevocation({ userId: result.userId, organizationId }) diff --git a/apps/sim/ee/scim/lib/authenticate.ts b/apps/sim/ee/scim/lib/authenticate.ts index 7d26c07e847..105c9ec6199 100644 --- a/apps/sim/ee/scim/lib/authenticate.ts +++ b/apps/sim/ee/scim/lib/authenticate.ts @@ -1,11 +1,12 @@ -import { createHash } from 'node:crypto' -import type { ScimConnectionPrincipal, ScimCredentialScope } from '@sim/auth/principal' +import type { ScimConnectionPrincipal } from '@sim/auth/principal' import { db } from '@sim/db' import { scimConnection, scimCredential } from '@sim/db/schema' import { createLogger } from '@sim/logger' +import { sha256Base64Url } from '@sim/security/hash' import { generateShortId } from '@sim/utils/id' import { eq } from 'drizzle-orm' import type { NextRequest } from 'next/server' +import { parseBearerToken } from '@/lib/auth/oauth-access-token' import { isScimEntitledForOrganization } from '@/ee/scim/lib/entitlement' import { ScimError } from '@/ee/scim/lib/protocol/errors' @@ -35,28 +36,17 @@ export function generateScimToken(): { secret: string; hash: string; prefix: str const secret = `${SCIM_TOKEN_PREFIX}${generateShortId(40)}` return { secret, - hash: hashScimToken(secret), + hash: sha256Base64Url(secret), prefix: secret.slice(0, DISPLAY_PREFIX_LENGTH), } } -function hashScimToken(secret: string): string { - return createHash('sha256').update(secret).digest('base64url') -} - function unauthorized(detail = 'Invalid SCIM credential'): ScimError { return new ScimError(401, undefined, detail, { 'WWW-Authenticate': 'Bearer realm="SCIM"', }) } -function readBearerToken(request: NextRequest): string | null { - const header = request.headers.get('authorization') - if (!header) return null - const match = header.match(/^Bearer\s+(.+)$/i) - return match ? match[1].trim() : null -} - /** * How long a credential's `last_used_at` may lag before it is rewritten. * @@ -97,7 +87,7 @@ function touchConnectionLastRequest(connectionId: string, lastRequestAt: Date | export async function authenticateScimRequest( request: NextRequest ): Promise { - const token = readBearerToken(request) + const token = parseBearerToken(request.headers) if (!token) throw unauthorized('A bearer credential is required') const [row] = await db @@ -114,7 +104,7 @@ export async function authenticateScimRequest( }) .from(scimCredential) .innerJoin(scimConnection, eq(scimConnection.id, scimCredential.connectionId)) - .where(eq(scimCredential.tokenHash, hashScimToken(token))) + .where(eq(scimCredential.tokenHash, sha256Base64Url(token))) .limit(1) if (!row) throw unauthorized() @@ -139,6 +129,6 @@ export async function authenticateScimRequest( organizationId: row.organizationId, connectionId: row.connectionId, credentialId: row.credentialId, - scopes: row.scopes as ScimCredentialScope[], + scopes: row.scopes, } } diff --git a/apps/sim/ee/scim/lib/identity/account-identity.ts b/apps/sim/ee/scim/lib/identity/account-identity.ts index a6e57b3d26e..c41afd03fe9 100644 --- a/apps/sim/ee/scim/lib/identity/account-identity.ts +++ b/apps/sim/ee/scim/lib/identity/account-identity.ts @@ -34,7 +34,6 @@ export async function syncAccountIdentityTx( ? { email: params.email, normalizedEmail: normalizeEmail(params.email), - /** The new address is unproven until its owner acts on it. */ emailVerified: false, } : {}), diff --git a/apps/sim/ee/scim/lib/managed-membership.test.ts b/apps/sim/ee/scim/lib/managed-membership.test.ts new file mode 100644 index 00000000000..f0e1bf274d0 --- /dev/null +++ b/apps/sim/ee/scim/lib/managed-membership.test.ts @@ -0,0 +1,89 @@ +/** + * @vitest-environment node + */ +import { db } from '@sim/db' +import { dbChainMockFns, resetDbChainMock } from '@sim/testing' +import { beforeEach, describe, expect, it, vi } from 'vitest' +import { ForbiddenOperationError } from '@/lib/core/application' + +const { mockDeploymentEnabled, mockEntitled } = vi.hoisted(() => ({ + mockDeploymentEnabled: vi.fn(), + mockEntitled: vi.fn(), +})) +vi.mock('@/ee/scim/lib/entitlement', () => ({ + isScimDeploymentEnabled: mockDeploymentEnabled, + isScimEntitledForOrganization: mockEntitled, +})) + +import { + assertInviteeNotScimManaged, + assertMembershipNotScimManaged, +} from '@/ee/scim/lib/managed-membership' + +const params = { organizationId: 'org-1', userId: 'user-1', executor: db } + +function queueProbe(managed: boolean) { + dbChainMockFns.from.mockResolvedValueOnce([{ managed }]) +} + +describe('assertMembershipNotScimManaged', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + mockDeploymentEnabled.mockReturnValue(true) + mockEntitled.mockResolvedValue(true) + }) + + it('refuses a change to a member the directory manages', async () => { + queueProbe(true) + const failure = await assertMembershipNotScimManaged(params).catch((error) => error) + expect(failure).toBeInstanceOf(ForbiddenOperationError) + expect(failure.detailCode).toBe('SCIM_MANAGED_MEMBERSHIP') + }) + + it('lets the change through once the organization can no longer sync', async () => { + queueProbe(true) + mockEntitled.mockResolvedValue(false) + await expect(assertMembershipNotScimManaged(params)).resolves.toBeUndefined() + expect(mockEntitled).toHaveBeenCalledWith('org-1') + }) + + it('never reads the plan for a member the directory does not manage', async () => { + queueProbe(false) + await expect(assertMembershipNotScimManaged(params)).resolves.toBeUndefined() + expect(mockEntitled).not.toHaveBeenCalled() + }) + + it('does not query at all on a deployment without provisioning', async () => { + mockDeploymentEnabled.mockReturnValue(false) + await expect(assertMembershipNotScimManaged(params)).resolves.toBeUndefined() + expect(dbChainMockFns.select).not.toHaveBeenCalled() + }) +}) + +describe('assertInviteeNotScimManaged', () => { + beforeEach(() => { + vi.clearAllMocks() + mockEntitled.mockResolvedValue(true) + }) + + it('refuses an invitation to someone the directory provisions', async () => { + await expect( + assertInviteeNotScimManaged({ organizationId: 'org-1', managed: true }) + ).rejects.toMatchObject({ detailCode: 'SCIM_MANAGED_MEMBERSHIP' }) + }) + + it('allows the invitation once the directory can no longer sync', async () => { + mockEntitled.mockResolvedValue(false) + await expect( + assertInviteeNotScimManaged({ organizationId: 'org-1', managed: true }) + ).resolves.toBeUndefined() + }) + + it('costs no plan read for an ordinary invitee', async () => { + await expect( + assertInviteeNotScimManaged({ organizationId: 'org-1', managed: false }) + ).resolves.toBeUndefined() + expect(mockEntitled).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/ee/scim/lib/managed-membership.ts b/apps/sim/ee/scim/lib/managed-membership.ts index 7c6680ebb41..ca39aa5a662 100644 --- a/apps/sim/ee/scim/lib/managed-membership.ts +++ b/apps/sim/ee/scim/lib/managed-membership.ts @@ -2,7 +2,7 @@ import { scimConnection, scimUser } from '@sim/db/schema' import { type AnyColumn, type SQL, sql } from 'drizzle-orm' import { ForbiddenOperationError } from '@/lib/core/application' import type { DbOrTx } from '@/lib/db/types' -import { isScimDeploymentEnabled } from '@/ee/scim/lib/entitlement' +import { isScimDeploymentEnabled, isScimEntitledForOrganization } from '@/ee/scim/lib/entitlement' /** * Refusing membership edits that the organization's directory owns. @@ -53,24 +53,30 @@ export async function assertMembershipNotScimManaged(params: { userId: string executor: DbOrTx }): Promise { - /** - * A deployment or plan that no longer has directory provisioning must not keep - * refusing manual changes on behalf of a directory that can no longer sync. - */ if (!isScimDeploymentEnabled()) return const [row] = await params.executor .select({ managed: scimManagedUserPredicate(params.organizationId, sql`${params.userId}`) }) .from(sql`(select 1) as probe`) if (!row?.managed) return + /** + * A plan that no longer has directory provisioning must not keep refusing + * manual changes on behalf of a directory that can no longer sync. Read only + * once a managed row is found, so the common case costs nothing. + */ + if (!(await isScimEntitledForOrganization(params.organizationId))) return throw new ForbiddenOperationError( 'SCIM_MANAGED_MEMBERSHIP', 'This member is managed by the organization’s identity provider. Make the change there, or turn off managed-membership locking in the organization’s directory settings.' ) } -/** Refuses an invitation to someone the directory already provisions. */ -export function assertInviteeNotScimManaged(managed: boolean | null | undefined): void { - if (!managed) return +/** Refuses an invitation to someone the directory already provisions, while the directory can still sync. */ +export async function assertInviteeNotScimManaged(params: { + organizationId: string + managed: boolean | null | undefined +}): Promise { + if (!params.managed) return + if (!(await isScimEntitledForOrganization(params.organizationId))) return throw new ForbiddenOperationError( 'SCIM_MANAGED_MEMBERSHIP', 'This person is provisioned by the organization’s identity provider, so Sim will not grant them access separately. They already have access, or will once the next directory sync runs.' diff --git a/apps/sim/ee/scim/lib/projection/auto-map.test.ts b/apps/sim/ee/scim/lib/projection/auto-map.test.ts index 8251336a6d5..947144bf9f2 100644 --- a/apps/sim/ee/scim/lib/projection/auto-map.test.ts +++ b/apps/sim/ee/scim/lib/projection/auto-map.test.ts @@ -9,7 +9,10 @@ import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' const { mockLeafLock } = vi.hoisted(() => ({ mockLeafLock: vi.fn() })) vi.mock('@/lib/permission-groups/locks', () => ({ acquirePermissionGroupOrgLock: mockLeafLock })) -import { autoMapPermissionGroupByName } from '@/ee/scim/lib/projection/auto-map' +import { + autoMapPermissionGroupByName, + settleMappedPermissionGroupsExplicit, +} from '@/ee/scim/lib/projection/auto-map' const params = { organizationId: 'org-1', scimGroupId: 'g-1', displayName: 'Engineering' } @@ -56,16 +59,14 @@ describe('autoMapPermissionGroupByName', () => { await expect(autoMapPermissionGroupByName(db, params)).resolves.toBe('no-match') }) - it('takes the permission-group lock before switching an inherit group to explicit', async () => { - queueTableRows(permissionGroup, [{ id: 'pg-1', membershipMode: 'inherit' }]) + it('never takes the permission-group leaf lock itself, since user locks follow it', async () => { + queueTableRows(permissionGroup, [{ id: 'pg-1' }]) queueTableRows(scimGroupMapping, []) dbChainMockFns.returning.mockResolvedValueOnce([]) dbChainMockFns.returning.mockResolvedValueOnce([{ id: 'm-1' }]) - await autoMapPermissionGroupByName(db, params) - expect(mockLeafLock).toHaveBeenCalledWith(db, 'org-1', { lockTimeoutAlreadyBounded: true }) - expect(mockLeafLock.mock.invocationCallOrder[0]).toBeLessThan( - dbChainMockFns.update.mock.invocationCallOrder[0] - ) + await expect(autoMapPermissionGroupByName(db, params)).resolves.toBe('mapped') + expect(mockLeafLock).not.toHaveBeenCalled() + expect(dbChainMockFns.update).not.toHaveBeenCalled() }) it('yields to a concurrent identical mapping instead of failing', async () => { @@ -76,3 +77,26 @@ describe('autoMapPermissionGroupByName', () => { await expect(autoMapPermissionGroupByName(db, params)).resolves.toBe('already-mapped') }) }) + +describe('settleMappedPermissionGroupsExplicit', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + }) + + it('takes the leaf lock before moving a still-inheriting mapped group to explicit', async () => { + queueTableRows(scimGroupMapping, [{ id: 'pg-1' }]) + await settleMappedPermissionGroupsExplicit(db, { organizationId: 'org-1', scimGroupId: 'g-1' }) + expect(mockLeafLock).toHaveBeenCalledWith(db, 'org-1', { lockTimeoutAlreadyBounded: true }) + expect(mockLeafLock.mock.invocationCallOrder[0]).toBeLessThan( + dbChainMockFns.update.mock.invocationCallOrder[0] + ) + }) + + it('does nothing, and takes no lock, when every mapped group is already explicit', async () => { + queueTableRows(scimGroupMapping, []) + await settleMappedPermissionGroupsExplicit(db, { organizationId: 'org-1', scimGroupId: 'g-1' }) + expect(mockLeafLock).not.toHaveBeenCalled() + expect(dbChainMockFns.update).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/ee/scim/lib/projection/auto-map.ts b/apps/sim/ee/scim/lib/projection/auto-map.ts index 3dbc8ccb987..e1924c760ac 100644 --- a/apps/sim/ee/scim/lib/projection/auto-map.ts +++ b/apps/sim/ee/scim/lib/projection/auto-map.ts @@ -1,6 +1,6 @@ import { permissionGroup, scimGroupMapping } from '@sim/db/schema' import { generateId } from '@sim/utils/id' -import { and, eq, ne } from 'drizzle-orm' +import { and, eq, inArray, ne } from 'drizzle-orm' import type { DbOrTx } from '@/lib/db/types' import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' @@ -15,7 +15,10 @@ import { acquirePermissionGroupOrgLock } from '@/lib/permission-groups/locks' * the place to make it. * * The adopted group is moved to explicit membership so the directory removing - * its last member narrows it to nobody instead of widening it to everyone. + * its last member narrows it to nobody instead of widening it to everyone. That + * move is a separate step, `settleMappedPermissionGroupsExplicit`, taken after + * the members' projection: the permission-group lock it needs is a leaf, and + * the projection takes user locks that must precede it. * * A rename drops the automatic mapping the old name earned, so members do not * keep access to a group whose name the directory no longer carries; mappings an @@ -26,7 +29,7 @@ export async function autoMapPermissionGroupByName( params: { organizationId: string; scimGroupId: string; displayName: string } ): Promise<'mapped' | 'already-mapped' | 'unmapped' | 'no-match'> { const [target] = await tx - .select({ id: permissionGroup.id, membershipMode: permissionGroup.membershipMode }) + .select({ id: permissionGroup.id }) .from(permissionGroup) .where( and( @@ -64,17 +67,6 @@ export async function autoMapPermissionGroupByName( .limit(1) if (existing) return 'already-mapped' - if (target.membershipMode !== 'explicit') { - /** The permission-group leaf lock precedes the row write, as every other writer of this row does. */ - await acquirePermissionGroupOrgLock(tx, params.organizationId, { - lockTimeoutAlreadyBounded: true, - }) - await tx - .update(permissionGroup) - .set({ membershipMode: 'explicit', updatedAt: new Date() }) - .where(eq(permissionGroup.id, target.id)) - } - /** The unique index is the arbiter when an administrator maps the same pair concurrently. */ const inserted = await tx .insert(scimGroupMapping) @@ -90,3 +82,44 @@ export async function autoMapPermissionGroupByName( .returning({ id: scimGroupMapping.id }) return inserted.length > 0 ? 'mapped' : 'already-mapped' } + +/** + * Moves every permission group this directory group maps to into explicit + * membership, so it governs exactly its members from now on. + * + * Called once the members' projection has run, because the permission-group + * lock is a leaf: the projection takes the organization's user locks, and a + * leaf taken before them would put this transaction on the wrong side of the + * documented order. Nothing between the mapping and this step observes the + * mode, and both commit together. + */ +export async function settleMappedPermissionGroupsExplicit( + tx: DbOrTx, + params: { organizationId: string; scimGroupId: string } +): Promise { + const inheriting = await tx + .select({ id: permissionGroup.id }) + .from(scimGroupMapping) + .innerJoin(permissionGroup, eq(permissionGroup.id, scimGroupMapping.permissionGroupId)) + .where( + and( + eq(scimGroupMapping.groupId, params.scimGroupId), + eq(scimGroupMapping.targetKind, 'permission_group'), + eq(permissionGroup.organizationId, params.organizationId), + ne(permissionGroup.membershipMode, 'explicit') + ) + ) + if (inheriting.length === 0) return + await acquirePermissionGroupOrgLock(tx, params.organizationId, { + lockTimeoutAlreadyBounded: true, + }) + await tx + .update(permissionGroup) + .set({ membershipMode: 'explicit', updatedAt: new Date() }) + .where( + inArray( + permissionGroup.id, + inheriting.map((row) => row.id) + ) + ) +} diff --git a/apps/sim/ee/scim/lib/projection/reconcile-user.test.ts b/apps/sim/ee/scim/lib/projection/reconcile-user.test.ts index 6ded0fee353..e378b10032e 100644 --- a/apps/sim/ee/scim/lib/projection/reconcile-user.test.ts +++ b/apps/sim/ee/scim/lib/projection/reconcile-user.test.ts @@ -143,9 +143,12 @@ describe('reconcileUserProjection', () => { { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'write', origin: 'adopted' }, ], }) - await reconcileUserProjection(db, params) + const forgotten = await reconcileUserProjection(db, params) expect(mocks.revokeWorkspace).not.toHaveBeenCalled() expect(dbChainMockFns.delete).toHaveBeenCalledWith(scimProjectionGrant) + expect(forgotten.removed).toEqual([ + expect.objectContaining({ targetKind: 'workspace', targetId: 'ws-1' }), + ]) vi.clearAllMocks() resetDbChainMock() @@ -156,8 +159,15 @@ describe('reconcileUserProjection', () => { { targetKind: 'workspace', targetId: 'ws-1', permissionType: 'write', origin: 'adopted' }, ], }) - await reconcileUserProjection(db, { ...params, settings: { lockManualMembership: true } }) - expect(mocks.revokeWorkspace).toHaveBeenCalled() + const withdrawn = await reconcileUserProjection(db, { + ...params, + settings: { lockManualMembership: true }, + }) + expect(mocks.revokeWorkspace).toHaveBeenCalledWith( + db, + expect.objectContaining({ workspaceId: 'ws-1', userId: 'u-1' }) + ) + expect(withdrawn.removed).toHaveLength(1) }) it('leaves the provenance row in place when access could not be handed on', async () => { diff --git a/apps/sim/ee/scim/lib/projection/reconcile-user.ts b/apps/sim/ee/scim/lib/projection/reconcile-user.ts index 229d0550725..12aab864efc 100644 --- a/apps/sim/ee/scim/lib/projection/reconcile-user.ts +++ b/apps/sim/ee/scim/lib/projection/reconcile-user.ts @@ -17,6 +17,7 @@ import type { DbOrTx } from '@/lib/db/types' import { changeMemberRoleTx } from '@/lib/organizations/members/lifecycle' import { addPermissionGroupMemberTx, + PermissionGroupAllMembersConflictError, PermissionGroupNotFoundError, PermissionGroupScopeConflictError, removePermissionGroupMemberTx, @@ -63,7 +64,7 @@ export interface ProjectionDelta { const EMPTY_DELTA: ProjectionDelta = { added: [], removed: [], raised: [] } /** Users per transaction when projecting outside a request's own transaction; the organization lock is held for the batch. */ -const PROJECTION_BATCH_SIZE = 25 +export const PROJECTION_BATCH_SIZE = 25 /** * The mapping rows this user reaches through their groups. @@ -289,7 +290,22 @@ async function withdrawGrant( * target column carries no foreign key. Withdrawing from nothing is * complete, not a failure. */ - if (!(error instanceof PermissionGroupNotFoundError)) throw error + if (error instanceof PermissionGroupNotFoundError) return true + /** + * An administrator moved the group back to governing everyone, and its + * last member cannot leave without emptying it. The grant stays on + * record so a later pass, or the administrator, can settle it; a sync + * must not fail over a rule the directory cannot see. + */ + if (error instanceof PermissionGroupAllMembersConflictError) { + logger.warn('Left a directory-managed permission group membership in place', { + groupId: grant.targetId, + userId: params.userId, + conflict: error.message, + }) + return false + } + throw error } return true } diff --git a/apps/sim/ee/scim/lib/protocol/canonical.test.ts b/apps/sim/ee/scim/lib/protocol/canonical.test.ts index 818fa94a5ec..5c86c21da36 100644 --- a/apps/sim/ee/scim/lib/protocol/canonical.test.ts +++ b/apps/sim/ee/scim/lib/protocol/canonical.test.ts @@ -3,13 +3,7 @@ */ import { describe, expect, it } from 'vitest' import { scimGroupWriteSchema, scimUserWriteSchema } from '@/lib/api/contracts/scim' -import { - assertGroupSchemas, - assertUserSchemas, - primaryEmail, - toCanonicalGroup, - toCanonicalUser, -} from '@/ee/scim/lib/protocol/canonical' +import { primaryEmail, toCanonicalGroup, toCanonicalUser } from '@/ee/scim/lib/protocol/canonical' import { SCIM_ENTERPRISE_USER_SCHEMA, SCIM_GROUP_SCHEMA, @@ -67,6 +61,14 @@ describe('toCanonicalUser', () => { expect(user.displayName).toBe('Ada Lovelace') }) + it('keeps a provider extension’s attributes under its URN', () => { + const user = parseUser({ + userName: 'ada@acme.test', + 'urn:okta:sim:2.0:user:custom': { costCenter: 'R&D' }, + }) + expect(user.extra).toEqual({ 'urn:okta:sim:2.0:user:custom': { costCenter: 'R&D' } }) + }) + it('keeps attributes Sim does not model so responses round-trip them', () => { const user = parseUser({ userName: 'ada@acme.test', nickName: 'Countess' }) expect(user.extra).toEqual({ nickName: 'Countess' }) @@ -86,17 +88,41 @@ describe('toCanonicalUser', () => { }) }) -describe('schema assertions', () => { +describe('schemas declaration', () => { it('accepts the core User schema with the enterprise extension', () => { - expect(() => assertUserSchemas([SCIM_USER_SCHEMA, SCIM_ENTERPRISE_USER_SCHEMA])).not.toThrow() + expect( + scimUserWriteSchema.safeParse({ + schemas: [SCIM_USER_SCHEMA, SCIM_ENTERPRISE_USER_SCHEMA], + userName: 'ada@acme.test', + }).success + ).toBe(true) }) - it('refuses an extension this server does not implement', () => { - expect(() => assertUserSchemas([SCIM_USER_SCHEMA, 'urn:example:2.0:Custom'])).toThrow() + it('accepts a provider extension, as Okta declares for every custom attribute', () => { + expect( + scimUserWriteSchema.safeParse({ + schemas: [SCIM_USER_SCHEMA, 'urn:okta:sim:2.0:user:custom'], + userName: 'ada@acme.test', + }).success + ).toBe(true) + }) + + it('refuses a User without the core schema', () => { + const result = scimUserWriteSchema.safeParse({ + schemas: ['urn:okta:sim:2.0:user:custom'], + userName: 'ada@acme.test', + }) + expect(result.success).toBe(false) + expect(result.error?.issues[0]?.message).toBe(`schemas must include ${SCIM_USER_SCHEMA}`) }) it('tolerates Microsoft’s legacy Group schema marker', () => { - expect(() => assertGroupSchemas([SCIM_GROUP_SCHEMA, ENTRA_LEGACY_GROUP_SCHEMA])).not.toThrow() + expect( + scimGroupWriteSchema.safeParse({ + schemas: [SCIM_GROUP_SCHEMA, ENTRA_LEGACY_GROUP_SCHEMA], + displayName: 'Engineering', + }).success + ).toBe(true) }) }) diff --git a/apps/sim/ee/scim/lib/protocol/canonical.ts b/apps/sim/ee/scim/lib/protocol/canonical.ts index 99bb41a1a5a..d5d366e6201 100644 --- a/apps/sim/ee/scim/lib/protocol/canonical.ts +++ b/apps/sim/ee/scim/lib/protocol/canonical.ts @@ -1,13 +1,9 @@ import type { ScimUserAttributes, ScimUserEmail } from '@sim/db/schema' +import { isValidEmailSyntax } from '@sim/utils/string' import type { ScimGroupWriteParsed, ScimUserWriteParsed } from '@/lib/api/contracts/scim' -import { - SCIM_ENTERPRISE_USER_SCHEMA, - SCIM_GROUP_SCHEMA, - SCIM_MAX_GROUP_MEMBERS, - SCIM_USER_SCHEMA, -} from '@/ee/scim/lib/protocol/constants' +import { SCIM_ENTERPRISE_USER_SCHEMA } from '@/ee/scim/lib/protocol/constants' import { invalidValue } from '@/ee/scim/lib/protocol/errors' -import { isRecord, stripProviderSchemaMarkers } from '@/ee/scim/lib/protocol/normalize' +import { isRecord } from '@/ee/scim/lib/protocol/normalize' /** Attributes Sim models itself; everything else is preserved under `extra`. */ const MODELLED_USER_KEYS = new Set([ @@ -29,10 +25,6 @@ function trimmed(value: string | undefined): string | undefined { return next ? next : undefined } -function looksLikeEmail(value: string): boolean { - return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) -} - /** * Chooses the address Sim will use as the account's email. * @@ -54,7 +46,7 @@ function normalizeEmails( .filter((entry) => entry.value.length > 0) if (supplied.length === 0) { - if (!looksLikeEmail(userName)) { + if (!isValidEmailSyntax(userName)) { throw invalidValue( 'A primary email address is required: send emails[], or a userName that is an email address' ) @@ -104,8 +96,7 @@ function collectExtra(body: ScimUserWriteParsed): Record | unde * rather than to a lossy projection of it. */ export function toCanonicalUser(body: ScimUserWriteParsed): ScimUserAttributes { - const userName = body.userName.trim().toLowerCase() - if (!userName) throw invalidValue('userName must not be empty') + const userName = body.userName.toLowerCase() const { emails, primary } = normalizeEmails(body.emails, userName) const name = formatName(body.name, body.displayName, primary) @@ -168,35 +159,6 @@ export function primaryEmail(attributes: ScimUserAttributes): string { return (attributes.emails.find((entry) => entry.primary) ?? attributes.emails[0]).value } -/** - * Refuses a `schemas` array that names something this server does not implement. - * - * A provider that believes an unimplemented extension was accepted will keep - * sending attributes that are silently dropped, so the mismatch is worth an - * error at the first write rather than a support case later. - */ -export function assertUserSchemas(schemas: readonly string[]): void { - const declared = stripProviderSchemaMarkers(schemas) - for (const schema of declared) { - if (schema !== SCIM_USER_SCHEMA && schema !== SCIM_ENTERPRISE_USER_SCHEMA) { - throw invalidValue(`Unsupported User schema ${schema}`) - } - } - if (!declared.includes(SCIM_USER_SCHEMA)) { - throw invalidValue(`schemas must include ${SCIM_USER_SCHEMA}`) - } -} - -export function assertGroupSchemas(schemas: readonly string[]): void { - const declared = stripProviderSchemaMarkers(schemas) - for (const schema of declared) { - if (schema !== SCIM_GROUP_SCHEMA) throw invalidValue(`Unsupported Group schema ${schema}`) - } - if (!declared.includes(SCIM_GROUP_SCHEMA)) { - throw invalidValue(`schemas must include ${SCIM_GROUP_SCHEMA}`) - } -} - export interface CanonicalScimGroup { displayName: string externalId?: string @@ -205,20 +167,14 @@ export interface CanonicalScimGroup { /** Turns an inbound Group resource into a display name and a member id list. */ export function toCanonicalGroup(body: ScimGroupWriteParsed): CanonicalScimGroup { - const displayName = body.displayName.trim() - if (!displayName) throw invalidValue('displayName must not be empty') + const displayName = body.displayName const memberIds: string[] = [] for (const member of body.members ?? []) { if (member.type && member.type.toLowerCase() !== 'user') { throw invalidValue('Group members must be Users; nested groups are not supported') } - const value = member.value.trim() - if (!value) throw invalidValue('Group member entries require a value') - if (!memberIds.includes(value)) memberIds.push(value) - } - if (memberIds.length > SCIM_MAX_GROUP_MEMBERS) { - throw invalidValue(`A Group cannot carry more than ${SCIM_MAX_GROUP_MEMBERS} members`) + if (!memberIds.includes(member.value)) memberIds.push(member.value) } return { diff --git a/apps/sim/ee/scim/lib/protocol/errors.ts b/apps/sim/ee/scim/lib/protocol/errors.ts index 54eb014fe9e..3c1841e3acc 100644 --- a/apps/sim/ee/scim/lib/protocol/errors.ts +++ b/apps/sim/ee/scim/lib/protocol/errors.ts @@ -1,3 +1,4 @@ +import { getPostgresErrorCode } from '@sim/utils/errors' import { asOrchestrationError } from '@/lib/core/orchestration/types' import { SCIM_ERROR_SCHEMA } from '@/ee/scim/lib/protocol/constants' @@ -101,20 +102,11 @@ const PG_LOCK_NOT_AVAILABLE = '55P03' /** PostgreSQL's unique-violation code: a concurrent write beat this one to a key. */ const PG_UNIQUE_VIOLATION = '23505' -function pgErrorCode(error: unknown): string | undefined { - if (typeof error !== 'object' || error === null) return undefined - const direct = (error as { code?: unknown }).code - if (typeof direct === 'string') return direct - /** postgres-js wraps the driver error under `cause` in some paths. */ - const cause = (error as { cause?: { code?: unknown } }).cause - return typeof cause?.code === 'string' ? cause.code : undefined -} - /** PostgreSQL's deadlock code: the loser was rolled back and should simply retry. */ const PG_DEADLOCK_DETECTED = '40P01' function isLockContention(error: unknown): boolean { - const code = pgErrorCode(error) + const code = getPostgresErrorCode(error) return code === PG_LOCK_NOT_AVAILABLE || code === PG_DEADLOCK_DETECTED } @@ -125,7 +117,7 @@ function isLockContention(error: unknown): boolean { * unlabelled failure as transient. */ function isUniqueViolation(error: unknown): boolean { - return pgErrorCode(error) === PG_UNIQUE_VIOLATION + return getPostgresErrorCode(error) === PG_UNIQUE_VIOLATION } /** diff --git a/apps/sim/ee/scim/lib/protocol/filter.test.ts b/apps/sim/ee/scim/lib/protocol/filter.test.ts index 885ce130077..48736770cad 100644 --- a/apps/sim/ee/scim/lib/protocol/filter.test.ts +++ b/apps/sim/ee/scim/lib/protocol/filter.test.ts @@ -60,8 +60,8 @@ describe('parseUserFilter', () => { }) it('does not split on the word and inside a quoted value', () => { - expect(parseUserFilter('userName eq "sand@acme.test"')).toEqual([ - { field: 'userName', value: 'sand@acme.test' }, + expect(parseGroupFilter('displayName eq "Research and Development"')).toEqual([ + { field: 'displayName', value: 'Research and Development' }, ]) }) diff --git a/apps/sim/ee/scim/lib/protocol/group-patch.ts b/apps/sim/ee/scim/lib/protocol/group-patch.ts index 5d4f91e9ca8..0f86d5e5543 100644 --- a/apps/sim/ee/scim/lib/protocol/group-patch.ts +++ b/apps/sim/ee/scim/lib/protocol/group-patch.ts @@ -100,7 +100,6 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou } else if (key === 'externalid') { full.externalId = readExternalId(nested) } else if (key === 'members') { - /** A path-less `add` contributes members; only a `replace` sets the whole list. */ if (operation.op === 'add') for (const id of readMemberList(nested)) addMember(id) else applyFullMembers(readMemberList(nested)) } else if (key === 'id' || key === 'schemas' || key.startsWith('meta')) { @@ -138,7 +137,6 @@ export function parseGroupPatch(operations: readonly ScimPatchOperation[]): Grou continue } if (operation.op === 'remove' && operation.value === undefined) { - /** A remove with no value clears the membership entirely. */ applyFullMembers([]) continue } diff --git a/apps/sim/ee/scim/lib/protocol/resources.test.ts b/apps/sim/ee/scim/lib/protocol/resources.test.ts index 7771df2b4e3..42a4db8db4b 100644 --- a/apps/sim/ee/scim/lib/protocol/resources.test.ts +++ b/apps/sim/ee/scim/lib/protocol/resources.test.ts @@ -55,16 +55,6 @@ describe('resolvePage', () => { it('allows a zero count, which Entra uses to ask only for the total', () => { expect(resolvePage({ count: 0 }).count).toBe(0) }) - - it('refuses a non-integer count', () => { - let scimType: string | undefined - try { - resolvePage({ count: 1.5 }) - } catch (error) { - scimType = (error as ScimError).scimType - } - expect(scimType).toBe('invalidValue') - }) }) describe('toUserResource', () => { @@ -86,6 +76,21 @@ describe('toUserResource', () => { ]) }) + it('declares a provider extension it stored and returns its attributes', () => { + const base = userRow() + const row = { + ...base, + attributes: { + ...base.attributes, + extra: { 'urn:okta:sim:2.0:user:custom': { costCenter: 'R&D' } }, + }, + } + const resource = toUserResource(row, BASE_URL) + expect(resource.schemas).toContain('urn:okta:sim:2.0:user:custom') + expect(resource['urn:okta:sim:2.0:user:custom']).toEqual({ costCenter: 'R&D' }) + expect(scimUserResourceSchema.safeParse(resource).success).toBe(true) + }) + it('reports the Sim account address rather than a stale stored copy', () => { const row = { ...userRow(), email: 'moved@acme.test' } expect(toUserResource(row, BASE_URL).emails[0]).toMatchObject({ diff --git a/apps/sim/ee/scim/lib/protocol/resources.ts b/apps/sim/ee/scim/lib/protocol/resources.ts index dfcb3710ea5..70a5e4a5513 100644 --- a/apps/sim/ee/scim/lib/protocol/resources.ts +++ b/apps/sim/ee/scim/lib/protocol/resources.ts @@ -94,7 +94,11 @@ export function toUserResource(row: UserResourceRow, baseUrl: string): ScimUserR ] return { - schemas: [SCIM_USER_SCHEMA, ...(stored.enterprise ? [SCIM_ENTERPRISE_USER_SCHEMA] : [])], + schemas: [ + SCIM_USER_SCHEMA, + ...(stored.enterprise ? [SCIM_ENTERPRISE_USER_SCHEMA] : []), + ...Object.keys(stored.extra ?? {}).filter(isSchemaUrn), + ], ...(stored.extra ?? {}), id: row.id, ...(row.externalId ? { externalId: row.externalId } : {}), @@ -187,12 +191,6 @@ export function resolvePage(input: { }): ScimPage { const rawStart = input.startIndex const rawCount = input.count - if (rawStart !== undefined && !Number.isInteger(rawStart)) { - throw invalidValue('startIndex must be an integer') - } - if (rawCount !== undefined && !Number.isInteger(rawCount)) { - throw invalidValue('count must be an integer') - } const startIndex = Math.max(rawStart ?? 1, 1) const count = Math.min(Math.max(rawCount ?? SCIM_MAX_PAGE_SIZE, 0), SCIM_MAX_PAGE_SIZE) @@ -242,6 +240,11 @@ export function projectionWants(projection: ScimAttributeProjection, attribute: } /** Attributes every resource keeps regardless of the projection requested. */ +/** An `extra` key that is itself a schema URN carries a provider extension the resource must declare. */ +function isSchemaUrn(key: string): boolean { + return key.startsWith('urn:') +} + const ALWAYS_RETURNED = new Set(['schemas', 'id', 'meta']) /** Drops attributes the request did not ask for. */ diff --git a/apps/sim/ee/scim/lib/protocol/user-patch.ts b/apps/sim/ee/scim/lib/protocol/user-patch.ts index d5b6e12687a..ce97b1459f6 100644 --- a/apps/sim/ee/scim/lib/protocol/user-patch.ts +++ b/apps/sim/ee/scim/lib/protocol/user-patch.ts @@ -30,10 +30,6 @@ export interface UserPatchOutcome { changed: boolean } -function clone(attributes: ScimUserAttributes): ScimUserAttributes { - return structuredClone(attributes) -} - function requireString(value: unknown, attribute: string): string { const unwrapped = unwrapSingleElement(value) if (typeof unwrapped !== 'string') throw invalidValue(`${attribute} must be a string`) @@ -358,7 +354,7 @@ export function applyUserPatch( current: ScimUserAttributes, operations: readonly ScimPatchOperation[] ): UserPatchOutcome { - const next = clone(current) + const next = structuredClone(current) for (const operation of operations) { if (operation.op === 'remove' && !operation.path) { diff --git a/apps/sim/ee/scim/lib/reconcile/job.ts b/apps/sim/ee/scim/lib/reconcile/job.ts index 6ad75b05611..de6973e71ce 100644 --- a/apps/sim/ee/scim/lib/reconcile/job.ts +++ b/apps/sim/ee/scim/lib/reconcile/job.ts @@ -1,10 +1,13 @@ import { db } from '@sim/db' -import { scimConnection } from '@sim/db/schema' +import { type ScimConnectionSettings, scimConnection } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { and, eq, isNull, lt, or, sql } from 'drizzle-orm' import { isScimEntitledForOrganization } from '@/ee/scim/lib/entitlement' -import { reconcileUserProjection } from '@/ee/scim/lib/projection/reconcile-user' +import { + PROJECTION_BATCH_SIZE, + reconcileUsersProjectionInBatches, +} from '@/ee/scim/lib/projection/reconcile-user' import { listScimUserIds } from '@/ee/scim/lib/repository/users' import { pruneScimRequestLog } from '@/ee/scim/lib/request-log' @@ -38,7 +41,6 @@ const RECONCILE_INTERVAL_MS = 50 * 60 * 1000 * Users reconciled per transaction. The organization lock is held for the whole * batch, so it is kept small enough that a tenant's own writes never wait long. */ -const BATCH_SIZE = 25 export interface ScimReconcileReport { connectionId: string @@ -103,7 +105,7 @@ async function findConnectionsDueForReconcile(limit: number): Promise< Array<{ id: string organizationId: string - settings: (typeof scimConnection.$inferSelect)['settings'] + settings: ScimConnectionSettings }> > { const dueBefore = new Date(Date.now() - RECONCILE_INTERVAL_MS) @@ -127,7 +129,7 @@ async function findConnectionsDueForReconcile(limit: number): Promise< export async function reconcileConnection(connection: { id: string organizationId: string - settings: (typeof scimConnection.$inferSelect)['settings'] + settings: ScimConnectionSettings }): Promise { /** * A lapsed organization's credentials are refused at authentication; its @@ -147,12 +149,14 @@ export async function reconcileConnection(connection: { let completed = false try { + /** Pruned before the pass, so a connection whose pass keeps failing still keeps its log bounded. */ + await pruneScimRequestLog(connection.id) let cursor: string | undefined for (;;) { const page = await listScimUserIds(db, { connectionId: connection.id, ...(cursor ? { afterOrderKey: cursor } : {}), - limit: BATCH_SIZE, + limit: PROJECTION_BATCH_SIZE, }) if (page.length === 0) break if (!(await holdsLease(connection.id, runId))) { @@ -173,26 +177,20 @@ export async function reconcileConnection(connection: { .from(scimConnection) .where(eq(scimConnection.id, connection.id)) .limit(1) - const settings = fresh?.settings ?? connection.settings - - await db.transaction(async (tx) => { - for (const row of page) { - const delta = await reconcileUserProjection(tx, { - connectionId: connection.id, - organizationId: connection.organizationId, - scimUserId: row.id, - settings, - }) - report.reconciledUsers += 1 - report.grantsAdded += delta.added.length + delta.raised.length - report.grantsRemoved += delta.removed.length - } + + const delta = await reconcileUsersProjectionInBatches({ + connectionId: connection.id, + organizationId: connection.organizationId, + scimUserIds: page.map((row) => row.id), + settings: fresh?.settings ?? connection.settings, }) + report.reconciledUsers += page.length + report.grantsAdded += delta.added.length + delta.raised.length + report.grantsRemoved += delta.removed.length cursor = page[page.length - 1].orderKey } completed = true - await pruneScimRequestLog(connection.id) if (report.grantsAdded > 0 || report.grantsRemoved > 0) { logger.warn('Directory reconciliation corrected drift', report) } diff --git a/apps/sim/ee/scim/lib/request-log.ts b/apps/sim/ee/scim/lib/request-log.ts index e8084f8cfa0..0225f04e2d0 100644 --- a/apps/sim/ee/scim/lib/request-log.ts +++ b/apps/sim/ee/scim/lib/request-log.ts @@ -10,14 +10,6 @@ import type { ScimType } from '@/ee/scim/lib/protocol/errors' const logger = createLogger('ScimRequestLog') -/** - * Records one provisioning request for the settings activity view. - * - * An administrator debugging a connection has nothing else to look at: - * Microsoft Entra reports a failed cycle without saying what it sent, and Okta - * surfaces only the status. Fire-and-forget, because a logging failure must not - * turn a successful provisioning call into an error the directory will retry. - */ /** One protocol request as the activity log records it. */ export interface ScimRequestLogEntry { principal: ScimConnectionPrincipal @@ -30,6 +22,14 @@ export interface ScimRequestLogEntry { durationMs: number } +/** + * Records one provisioning request for the settings activity view. + * + * An administrator debugging a connection has nothing else to look at: + * Microsoft Entra reports a failed cycle without saying what it sent, and Okta + * surfaces only the status. Fire-and-forget, because a logging failure must not + * turn a successful provisioning call into an error the directory will retry. + */ export function recordScimRequest(entry: ScimRequestLogEntry): void { void db .insert(scimRequestLog) diff --git a/apps/sim/ee/scim/lib/route.ts b/apps/sim/ee/scim/lib/route.ts index 06e025306b5..7301ecbc0ce 100644 --- a/apps/sim/ee/scim/lib/route.ts +++ b/apps/sim/ee/scim/lib/route.ts @@ -1,17 +1,15 @@ import { createScimRouteBuilder } from '@/lib/api/server/routes' import { authenticateScimRequest } from '@/ee/scim/lib/authenticate' -import { scimBaseUrl } from '@/ee/scim/lib/base-url' import { recordScimRequest } from '@/ee/scim/lib/request-log' /** * The route builder wired to this deployment. * - * The builder takes its authenticator, base URL, and request recorder as - * dependencies so it stays testable without a database; this module is where - * the real ones are bound, and it is what every route file imports. + * The builder takes its authenticator and request recorder as dependencies so + * it stays testable without a database; this module is where the real ones are + * bound, and it is what every route file imports. */ export const defineScimRoute = createScimRouteBuilder({ authenticate: authenticateScimRequest, - baseUrl: scimBaseUrl, recordRequest: recordScimRequest, }) diff --git a/apps/sim/lib/api/contracts/scim.ts b/apps/sim/lib/api/contracts/scim.ts index 1a6983d6309..f5263422e41 100644 --- a/apps/sim/lib/api/contracts/scim.ts +++ b/apps/sim/lib/api/contracts/scim.ts @@ -2,14 +2,17 @@ import { z } from 'zod' import { defineRouteContract } from '@/lib/api/contracts/types' import { SCIM_ENTERPRISE_USER_SCHEMA, + SCIM_GROUP_SCHEMA, SCIM_LIST_RESPONSE_SCHEMA, SCIM_MAX_GROUP_MEMBERS, SCIM_MAX_PATCH_OPERATIONS, SCIM_PATCH_OP_SCHEMA, + SCIM_USER_SCHEMA, } from '@/ee/scim/lib/protocol/constants' import { canonicalizeAttributeNames, normalizeScimBoolean, + stripProviderSchemaMarkers, unwrapSingleElement, } from '@/ee/scim/lib/protocol/normalize' @@ -78,11 +81,29 @@ const USER_WRITE_ATTRIBUTES = [ SCIM_ENTERPRISE_USER_SCHEMA, ] as const +/** + * A `schemas` list that declares the resource's core schema. Every extension is + * let through: providers declare their own URNs the moment an administrator + * adds a custom attribute (Okta `urn:okta::2.0:user:custom`, Entra + * `urn:ietf:params:scim:schemas:extension::2.0:User`), and refusing them + * would stop the sync at the first write. + */ +function scimSchemasDeclaring(core: string) { + return z + .array(z.string().max(256)) + .min(1, 'schemas must name at least one URN') + .max(10) + .refine( + (schemas) => stripProviderSchemaMarkers(schemas).includes(core), + `schemas must include ${core}` + ) +} + export const scimUserWriteSchema = z.preprocess( (body) => canonicalizeAttributeNames(body, USER_WRITE_ATTRIBUTES), z .looseObject({ - schemas: z.array(z.string().max(256)).min(1, 'schemas must name at least one URN').max(10), + schemas: scimSchemasDeclaring(SCIM_USER_SCHEMA), userName: z.string().trim().min(1, 'userName must not be empty').max(320), externalId: z.string().trim().max(256).optional(), active: scimBoolean.optional(), @@ -93,8 +114,6 @@ export const scimUserWriteSchema = z.preprocess( }) .transform(({ password: _password, ...rest }) => rest) ) -/** What a client may send. */ -export type ScimUserWrite = z.input /** What the route receives after parsing, which is what the canonicalizer reads. */ export type ScimUserWriteParsed = z.output @@ -109,13 +128,12 @@ const GROUP_WRITE_ATTRIBUTES = ['schemas', 'displayName', 'externalId', 'members export const scimGroupWriteSchema = z.preprocess( (body) => canonicalizeAttributeNames(body, GROUP_WRITE_ATTRIBUTES), z.looseObject({ - schemas: z.array(z.string().max(256)).min(1, 'schemas must name at least one URN').max(10), + schemas: scimSchemasDeclaring(SCIM_GROUP_SCHEMA), displayName: z.string().trim().min(1, 'displayName must not be empty').max(256), externalId: z.string().trim().max(256).optional(), members: z.array(scimGroupMemberSchema).max(SCIM_MAX_GROUP_MEMBERS).optional(), }) ) -export type ScimGroupWrite = z.input export type ScimGroupWriteParsed = z.output /** diff --git a/apps/sim/lib/api/server/routes/scim-route.test.ts b/apps/sim/lib/api/server/routes/scim-route.test.ts index cd1008a70fa..213042d8b40 100644 --- a/apps/sim/lib/api/server/routes/scim-route.test.ts +++ b/apps/sim/lib/api/server/routes/scim-route.test.ts @@ -10,6 +10,8 @@ const mocks = vi.hoisted(() => ({ enforceIpRateLimit: vi.fn(), })) +vi.mock('@/ee/scim/lib/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) + vi.mock('@/lib/core/rate-limiter', () => ({ RateLimiter: class { checkRateLimitDirect = mocks.checkRateLimitDirect @@ -40,7 +42,6 @@ const authenticate = vi.fn() const recordRequest = vi.fn() const defineScimRoute = createScimRouteBuilder({ authenticate, - baseUrl: () => 'https://sim.test/api/scim/v2', recordRequest, }) @@ -111,7 +112,7 @@ describe('SCIM route builder', () => { it('answers in the SCIM media type with the RFC envelope', async () => { const response = await listUsers(request('GET', '/api/scim/v2/Users'), undefined) expect(response.status).toBe(200) - expect(response.headers.get('content-type')).toBe(SCIM_MEDIA_TYPE) + expect(response.headers.get('content-type')).toBe(`${SCIM_MEDIA_TYPE}; charset=utf-8`) expect(recordRequest).toHaveBeenCalledWith(expect.objectContaining({ status: 200, principal })) }) @@ -161,6 +162,7 @@ describe('SCIM route builder', () => { schemas: ['urn:ietf:params:scim:api:messages:2.0:Error'], status: '400', scimType: 'invalidSyntax', + detail: 'Request body is not valid JSON', }) }) @@ -189,7 +191,7 @@ describe('SCIM route builder', () => { }) const response = await listUsers(request('GET', '/api/scim/v2/Users'), undefined) expect(response.status).toBe(429) - expect(response.headers.get('retry-after')).toBeTruthy() + expect(Number(response.headers.get('retry-after'))).toBeGreaterThanOrEqual(1) expect(recordRequest).toHaveBeenCalledWith(expect.objectContaining({ status: 429 })) }) }) diff --git a/apps/sim/lib/api/server/routes/scim-route.ts b/apps/sim/lib/api/server/routes/scim-route.ts index dce59753ef8..1b965875110 100644 --- a/apps/sim/lib/api/server/routes/scim-route.ts +++ b/apps/sim/lib/api/server/routes/scim-route.ts @@ -15,7 +15,13 @@ import { SCIM_MEDIA_TYPE, SCIM_RATE_LIMIT, } from '@/ee/scim/lib/protocol/constants' -import { ScimError, type ScimType, scimErrorBody, toScimError } from '@/ee/scim/lib/protocol/errors' +import { + ScimError, + type ScimErrorBody, + type ScimType, + scimErrorBody, + toScimError, +} from '@/ee/scim/lib/protocol/errors' import type { ScimRequestLogEntry } from '@/ee/scim/lib/request-log' const logger = createLogger('ScimRoute') @@ -62,16 +68,19 @@ export type ScimNextRouteHandler = ( ) => Promise | NextResponse | Response /** Dependencies the builder needs, injected so the module stays testable. */ -export interface ScimRouteDependencies { +interface ScimRouteDependencies { authenticate: ScimConnectionAuthenticator - baseUrl(): string recordRequest(entry: ScimRequestLogEntry): void } function scimResponse(body: unknown, status: number, headers?: Record): Response { return NextResponse.json(body, { status, - headers: { 'content-type': SCIM_MEDIA_TYPE, 'cache-control': 'no-store', ...headers }, + headers: { + 'content-type': `${SCIM_MEDIA_TYPE}; charset=utf-8`, + 'cache-control': 'no-store', + ...headers, + }, }) } @@ -135,14 +144,17 @@ export function createScimRouteBuilder(dependencies: ScimRouteDependencies) { ) } const isEmptyResponse = options.contract.response.mode === 'empty' - if (!isEmptyResponse && !options.present) { + const present = options.present + if (!isEmptyResponse && !present) { throw new Error(`${options.contract.method} ${options.contract.path} requires a presenter`) } - const successStatus = (() => { - const declared = options.contract.response.status - if (declared === undefined) return 200 - return Array.isArray(declared) ? declared[0] : (declared as number) - })() + const declaredStatus = options.contract.response.status + const successStatus = + declaredStatus === undefined + ? 200 + : Array.isArray(declaredStatus) + ? declaredStatus[0] + : declaredStatus return withRouteHandler( async (request, context) => { @@ -153,7 +165,6 @@ export function createScimRouteBuilder(dependencies: ScimRouteDependencies) { let detail: string | undefined try { - /** A deployment without the feature exposes no provisioning surface at all. */ if (!isScimDeploymentEnabled()) throw new ScimError(404, undefined, 'Not found') if (request.method !== options.contract.method) { throw new ScimError(405, undefined, `${request.method} is not supported here`) @@ -191,11 +202,14 @@ export function createScimRouteBuilder(dependencies: ScimRouteDependencies) { rejectBlankQueryValues: false, }) if (!parsed.success) { + const failure = (await parsed.response.json()) as ScimErrorBody status = parsed.response.status - return scimResponse(await parsed.response.json(), status) + scimType = failure.scimType + detail = failure.detail + return scimResponse(failure, status) } - const baseUrl = dependencies.baseUrl() + const baseUrl = scimBaseUrl() const input = options.mapInput(parsed.data, { principal, request }) const result = await options.useCase.execute({ principal, input, request }) @@ -207,7 +221,8 @@ export function createScimRouteBuilder(dependencies: ScimRouteDependencies) { }) } - const presented = options.present!(result, { baseUrl }) + if (!present) throw new Error('unreachable: presenter checked at definition') + const presented = present(result, { baseUrl }) const validated = options.contract.response.mode === 'json' ? options.contract.response.schema.parse(presented) @@ -286,7 +301,6 @@ export function defineScimDiscoveryRoute( return withRouteHandler( async (request, context) => { try { - /** A deployment without the feature exposes no provisioning surface, discovery included. */ if (!isScimDeploymentEnabled()) throw new ScimError(404, undefined, 'Not found') if (request.method !== 'GET') { throw new ScimError(405, undefined, `${request.method} is not supported here`) diff --git a/apps/sim/lib/auth/auth.ts b/apps/sim/lib/auth/auth.ts index a0910c3eb13..41ebfd5192c 100644 --- a/apps/sim/lib/auth/auth.ts +++ b/apps/sim/lib/auth/auth.ts @@ -657,10 +657,12 @@ export const auth = betterAuth({ session: { create: { before: async (session) => { - // Blocked emails/domains and suspended accounts must not establish - // sessions, regardless of provider (email/password, OAuth, SSO). - // Deliberately outside the try below — a thrown APIError must - // propagate, not be swallowed. + /** + * Blocked emails/domains and suspended accounts must not establish + * sessions, whatever the provider (email/password, OAuth, SSO). + * Deliberately outside the try below: a thrown APIError must + * propagate, not be swallowed. + */ const accessControl = await getAccessControlConfig() const [sessionUser] = await db .select({ email: schema.user.email, suspendedAt: schema.user.suspendedAt }) diff --git a/apps/sim/lib/auth/oauth-access-token.test.ts b/apps/sim/lib/auth/oauth-access-token.test.ts index 9f51b181be0..24aa9891feb 100644 --- a/apps/sim/lib/auth/oauth-access-token.test.ts +++ b/apps/sim/lib/auth/oauth-access-token.test.ts @@ -23,6 +23,7 @@ function row(overrides: Record = {}) { clientDisabled: false, userBanned: false, userBanExpires: null, + userSuspendedAt: null, userExists: 'user-1', ...overrides, } @@ -107,6 +108,9 @@ describe('verifyOAuthAccessToken', () => { queueTableRows(schemaMock.oauthAccessToken, [row({ userBanned: true })]) expect(await reason('sim_oat_x')).toBe('user_banned') + queueTableRows(schemaMock.oauthAccessToken, [row({ userSuspendedAt: new Date() })]) + expect(await reason('sim_oat_x')).toBe('user_banned') + queueTableRows(schemaMock.oauthAccessToken, [ row({ userBanned: true, userBanExpires: new Date(Date.now() - 1) }), ]) diff --git a/apps/sim/lib/auth/oauth-access-token.ts b/apps/sim/lib/auth/oauth-access-token.ts index f38e3881e6a..8bc7401e863 100644 --- a/apps/sim/lib/auth/oauth-access-token.ts +++ b/apps/sim/lib/auth/oauth-access-token.ts @@ -4,7 +4,7 @@ import { oauthAccessToken, oauthClient, user } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { sha256Hex } from '@sim/security/hash' import { eq } from 'drizzle-orm' -import { isBanActive } from '@/lib/auth/ban' +import { isAccountBlocked } from '@/lib/auth/ban' import { OAUTH_ACCESS_TOKEN_PREFIX } from '@/lib/auth/oauth-provider' const logger = createLogger('OAuthAccessToken') @@ -90,6 +90,7 @@ export async function verifyOAuthAccessToken(token: string): Promise { const [activeUser] = await tx - .select({ id: user.id, banned: user.banned, banExpires: user.banExpires }) + .select({ + id: user.id, + banned: user.banned, + banExpires: user.banExpires, + suspendedAt: user.suspendedAt, + }) .from(user) .where(eq(user.id, provisionalToken.userId)) .for('share') .limit(1) - if (!activeUser || isBanActive(activeUser)) { + if (!activeUser || isAccountBlocked(activeUser)) { return protocolError('invalid_grant', 'Refresh token is invalid.') } diff --git a/apps/sim/lib/auth/sso/application/admit-sso-user.test.ts b/apps/sim/lib/auth/sso/application/admit-sso-user.test.ts index 06194b17a02..7dccdad2ff5 100644 --- a/apps/sim/lib/auth/sso/application/admit-sso-user.test.ts +++ b/apps/sim/lib/auth/sso/application/admit-sso-user.test.ts @@ -48,6 +48,13 @@ vi.mock('@/lib/billing/core/usage', () => ({ syncUsageLimitsFromSubscription: mockSyncUsageLimitsFromSubscription, })) +const { mockIsScimEntitledForOrganization } = vi.hoisted(() => ({ + mockIsScimEntitledForOrganization: vi.fn(), +})) +vi.mock('@/ee/scim/lib/entitlement', () => ({ + isScimEntitledForOrganization: mockIsScimEntitledForOrganization, +})) + vi.mock('@/lib/posthog/server', () => ({ captureServerEvent: mockCaptureServerEvent, })) @@ -84,6 +91,11 @@ function queueIdentity({ queueTableRows(schemaMock.account, accountLinked ? [{ id: 'account-1' }] : []) } +/** The directory-only read runs after the identity reads and before the membership lookup. */ +function queueDirectoryOnly(directoryOnly: boolean) { + queueTableRows(schemaMock.scimConnection, directoryOnly ? [{ id: 'scim-1' }] : []) +} + async function execute() { return admitSsoUser.execute({ principal, input: { providerId: 'acme-sso' } }) } @@ -179,6 +191,29 @@ describe('SSO JIT admission', () => { expect(mockEnsureUserInOrganizationTx).not.toHaveBeenCalled() }) + it('leaves admission to the directory when a connection has disabled JIT', async () => { + queueIdentity() + queueDirectoryOnly(true) + mockIsScimEntitledForOrganization.mockResolvedValue(true) + + await expect(execute()).resolves.toEqual({ + kind: 'provisioning-disabled', + organizationId: 'org-1', + }) + expect(mockEnsureUserInOrganizationTx).not.toHaveBeenCalled() + }) + + it('admits by JIT again once the directory can no longer sync', async () => { + queueIdentity() + queueDirectoryOnly(true) + mockIsScimEntitledForOrganization.mockResolvedValue(false) + + const outcome = await execute() + + expect(outcome.kind).toBe('provisioned') + expect(mockEnsureUserInOrganizationTx).toHaveBeenCalled() + }) + it('keeps an existing member active when new provisioning is invite-only', async () => { queueIdentity({ jitProvisioningEnabled: false }) queueTableRows(schemaMock.member, [{ id: 'member-existing' }]) diff --git a/apps/sim/lib/auth/sso/application/admit-sso-user.ts b/apps/sim/lib/auth/sso/application/admit-sso-user.ts index 6daff577519..7d211e5fd5a 100644 --- a/apps/sim/lib/auth/sso/application/admit-sso-user.ts +++ b/apps/sim/lib/auth/sso/application/admit-sso-user.ts @@ -25,6 +25,7 @@ import { resolveOrganizationSeatPolicyTx } from '@/lib/billing/organizations/sea import { reconcileOrganizationSeats } from '@/lib/billing/organizations/seats' import { assertOperationPrincipal, type OperationUseCase } from '@/lib/core/application/operation' import { captureServerEvent } from '@/lib/posthog/server' +import { isScimEntitledForOrganization } from '@/ee/scim/lib/entitlement' const logger = createLogger('SsoJitAdmission') @@ -146,7 +147,11 @@ async function runAdmissionTransaction( ) .limit(1) - if (!provider.jitProvisioningEnabled || directoryOnly) { + /** A directory that can no longer sync (plan lapsed, feature off) no longer owns the door either. */ + const directoryOwnsAdmission = + Boolean(directoryOnly) && (await isScimEntitledForOrganization(provider.organizationId)) + + if (!provider.jitProvisioningEnabled || directoryOwnsAdmission) { const [sameOrganization] = await tx .select({ id: member.id }) .from(member) diff --git a/apps/sim/lib/invitations/workspace-invitations.ts b/apps/sim/lib/invitations/workspace-invitations.ts index d6ab7ed030e..dfdcdc2ad15 100644 --- a/apps/sim/lib/invitations/workspace-invitations.ts +++ b/apps/sim/lib/invitations/workspace-invitations.ts @@ -499,7 +499,9 @@ export async function createWorkspaceInvitation({ * redundant at best and reverted at worst. Read as part of the lookup above so * the common case costs no extra query. */ - assertInviteeNotScimManaged(existingUser?.scimManaged) + if (organizationId) { + await assertInviteeNotScimManaged({ organizationId, managed: existingUser?.scimManaged }) + } const existingMembership = existingUser ? await getUserOrganization(existingUser.id) : null let existingOrganizationRole = existingMembership?.role diff --git a/apps/sim/lib/workspaces/access/workspace-access.ts b/apps/sim/lib/workspaces/access/workspace-access.ts index 26b22e1a95a..deffbea554a 100644 --- a/apps/sim/lib/workspaces/access/workspace-access.ts +++ b/apps/sim/lib/workspaces/access/workspace-access.ts @@ -162,7 +162,7 @@ export async function revokeWorkspaceAccessTx( } } - const deleted = await tx + await tx .delete(permissions) .where( and( @@ -171,7 +171,6 @@ export async function revokeWorkspaceAccessTx( eq(permissions.entityId, params.workspaceId) ) ) - .returning({ id: permissions.id }) await revokeWorkspaceCredentialMembershipsTx(tx, params.workspaceId, params.userId) await removeWorkspaceSkillMembershipsTx(tx, params.workspaceId, params.userId) diff --git a/packages/db/schema.ts b/packages/db/schema.ts index 1b07f2d19ea..a04b5769588 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -6037,7 +6037,6 @@ export interface ScimConnectionSettings { disableJit?: boolean /** Map a pushed group to an existing permission group of the same name. Nothing is created. */ autoMapPermissionGroupsByName?: boolean - /** Workspaces every provisioned user receives regardless of group membership. */ } /** One email address as the identity provider supplied it. */ From 3c6ff6f5548c6df00c9701a6a5e7d2ccbcb92bd5 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 7 Sep 2026 18:10:10 -0700 Subject: [PATCH 31/31] test(scim): cover provisioning, the reconcile job, and group membership; say "token" Provisioning use case (20), reconcile job (12), and the permission-group add/remove primitives (13) now have tests that assert call arguments, result fields, audit lists, and thrown status + scimType. User-facing wording is "token", as every provider labels it (Okta API Token, Entra Secret Token, OneLogin SCIM Bearer Token, JumpCloud Token Key), and to keep clear of Sim's own connected-account credentials. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01DGXcwsHzYGp6pUDWRtJKpz --- .../content/docs/platform/enterprise/scim.mdx | 16 +- apps/sim/ee/scim/components/scim-section.tsx | 18 +- .../scim/lib/application/admin/credentials.ts | 2 +- .../application/authorized-scim-use-case.ts | 2 +- .../application/users/provision-user.test.ts | 533 ++++++++++++++++++ apps/sim/ee/scim/lib/authenticate.test.ts | 4 +- apps/sim/ee/scim/lib/authenticate.ts | 4 +- apps/sim/ee/scim/lib/reconcile/job.test.ts | 306 ++++++++++ .../lib/api/server/routes/scim-route.test.ts | 2 +- .../application/group-membership.test.ts | 252 ++++++++- 10 files changed, 1113 insertions(+), 26 deletions(-) create mode 100644 apps/sim/ee/scim/lib/application/users/provision-user.test.ts create mode 100644 apps/sim/ee/scim/lib/reconcile/job.test.ts diff --git a/apps/docs/content/docs/platform/enterprise/scim.mdx b/apps/docs/content/docs/platform/enterprise/scim.mdx index 628bd9fe464..c64ee14d26c 100644 --- a/apps/docs/content/docs/platform/enterprise/scim.mdx +++ b/apps/docs/content/docs/platform/enterprise/scim.mdx @@ -52,11 +52,11 @@ https:///api/scim/v2 -### Issue a credential +### Issue a token -Choose whether the credential expires (never, 90 days, or a year) and select **Issue credential**. The token appears once — copy it straight into your provider. +Choose whether the token expires (never, 90 days, or a year) and select **Issue token**. It appears once — copy it straight into your provider. -Two credentials can be active at a time, so you can rotate without downtime: issue the new one, update your provider, confirm a sync succeeds, then revoke the old one. +Two tokens can be active at a time, so you can rotate without downtime: issue the new one, update your provider, confirm a sync succeeds, then revoke the old one. @@ -70,7 +70,7 @@ In your Okta app, open **Provisioning → Integration** and select **Configure A - **SCIM connector base URL**: `https:///api/scim/v2` - **Unique identifier field for users**: `userName` - **Supported provisioning actions**: Push New Users, Push Profile Updates, Push Groups -- **Authentication Mode**: HTTP Header, with your Sim credential as the token +- **Authentication Mode**: HTTP Header, with your Sim token Select **Test API Credentials**, then save. Under **Provisioning → To App**, enable Create Users, Update User Attributes, and Deactivate Users. @@ -82,7 +82,7 @@ Okta never deletes users over SCIM. Unassigning someone, or deactivating them in In your enterprise application, open **Provisioning** and set Provisioning Mode to **Automatic**. - **Tenant URL**: `https:///api/scim/v2` -- **Secret Token**: your Sim credential +- **Secret Token**: your Sim token Select **Test Connection**, then save and start provisioning. @@ -94,7 +94,7 @@ Entra runs an initial cycle over everyone in scope, then incremental cycles roug Add a **SCIM Provisioner with SAML** app. - **SCIM Base URL**: `https:///api/scim/v2` -- **SCIM Bearer Token**: your Sim credential +- **SCIM Bearer Token**: your Sim token Enable provisioning and choose what happens when a user is removed. Suspend maps to a Sim suspension; Delete removes their membership. @@ -104,7 +104,7 @@ Enable provisioning and choose what happens when a user is removed. Suspend maps Add a **Custom SCIM** identity management integration. - **Base URL**: `https:///api/scim/v2` -- **Token Key**: your Sim credential +- **Token Key**: your Sim token Enable group sync if you plan to map groups. @@ -154,7 +154,7 @@ Sim also re-applies every group mapping once an hour, so drift cannot persist. Y ## Reference - Base URL: `https:///api/scim/v2` -- Authentication: `Authorization: Bearer ` +- Authentication: `Authorization: Bearer ` - Resources: `/Users`, `/Groups`, plus `/ServiceProviderConfig`, `/ResourceTypes`, and `/Schemas` - Filters: `eq` only, up to ten terms joined with `and`. Users: `id`, `userName`, `externalId`, `emails.value` (also `emails[type eq "work"].value`), `active`. Groups: `id`, `displayName`, `externalId` - Limits: 1,500 requests per minute per connection, 1 MB per request, 5,000 members per group diff --git a/apps/sim/ee/scim/components/scim-section.tsx b/apps/sim/ee/scim/components/scim-section.tsx index 9d695f7a9f5..53a701cbd69 100644 --- a/apps/sim/ee/scim/components/scim-section.tsx +++ b/apps/sim/ee/scim/components/scim-section.tsx @@ -387,7 +387,7 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp }) setIssuedSecret(result.secret) } catch (error) { - toast.error(getErrorMessage(error, 'Failed to issue credential')) + toast.error(getErrorMessage(error, 'Failed to issue token')) } } @@ -396,9 +396,9 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp try { await revokeCredential.mutateAsync({ organizationId, credentialId: pendingRevoke.id }) setPendingRevoke(null) - toast.success('Credential revoked') + toast.success('Token revoked') } catch (error) { - toast.error(getErrorMessage(error, 'Failed to revoke credential')) + toast.error(getErrorMessage(error, 'Failed to revoke token')) } } @@ -457,12 +457,12 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp ))}
{connection.credentials.length === 0 ? ( - No credentials yet. + No tokens yet. ) : ( connection.credentials.map((credential) => ( setCredentialExpiry(next as CredentialExpiry)} @@ -485,7 +485,7 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp onClick={handleIssue} disabled={issueCredential.isPending || connection.credentials.length >= 2} > - {issueCredential.isPending ? 'Issuing...' : 'Issue credential'} + {issueCredential.isPending ? 'Issuing...' : 'Issue token'}
@@ -541,11 +541,11 @@ function ConnectionDetails({ organizationId, connection }: ConnectionDetailsProp !open && setPendingRevoke(null)} - title='Revoke credential' + title='Revoke token' text={[ 'Revoke ', { text: pendingRevoke?.tokenPrefix ?? '', bold: true }, - '? Your identity provider stops syncing the moment it next uses this token. Issue a new credential first if you are rotating.', + '? Your identity provider stops syncing the moment it next uses this token. Issue a new token first if you are rotating.', ]} confirm={{ label: 'Revoke', diff --git a/apps/sim/ee/scim/lib/application/admin/credentials.ts b/apps/sim/ee/scim/lib/application/admin/credentials.ts index 14f7c62f56c..ee603ab9885 100644 --- a/apps/sim/ee/scim/lib/application/admin/credentials.ts +++ b/apps/sim/ee/scim/lib/application/admin/credentials.ts @@ -118,7 +118,7 @@ export const revokeScimCredential = defineAuthorizedScimAdminUseCase({ connectionId: scimCredential.connectionId, }) - if (!revoked) throw new OrchestrationError('not_found', 'Credential not found') + if (!revoked) throw new OrchestrationError('not_found', 'Token not found') return { success: true as const, revoked } }, projectAudit: ({ result }) => ({ diff --git a/apps/sim/ee/scim/lib/application/authorized-scim-use-case.ts b/apps/sim/ee/scim/lib/application/authorized-scim-use-case.ts index 5b350f83d89..72541a1bb4e 100644 --- a/apps/sim/ee/scim/lib/application/authorized-scim-use-case.ts +++ b/apps/sim/ee/scim/lib/application/authorized-scim-use-case.ts @@ -82,7 +82,7 @@ async function loadActiveConnection( .limit(1) if (!row || row.status !== 'active') { - throw new ScimError(401, undefined, 'Invalid SCIM credential', { + throw new ScimError(401, undefined, 'Invalid SCIM token', { 'WWW-Authenticate': 'Bearer realm="SCIM"', }) } diff --git a/apps/sim/ee/scim/lib/application/users/provision-user.test.ts b/apps/sim/ee/scim/lib/application/users/provision-user.test.ts new file mode 100644 index 00000000000..cce4073a03c --- /dev/null +++ b/apps/sim/ee/scim/lib/application/users/provision-user.test.ts @@ -0,0 +1,533 @@ +/** + * @vitest-environment node + */ +import { db } from '@sim/db' +import { type ScimUserAttributes, scimConnection } from '@sim/db/schema' +import { dbChainMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' +import { APIError } from 'better-auth/api' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + createUser: vi.fn(), + applySessionPolicy: vi.fn(), + syncUsageLimits: vi.fn(), + ensureMember: vi.fn(), + resolveSeatPolicy: vi.fn(), + reconcileSeats: vi.fn(), + isInstanceMode: vi.fn(), + getInstanceOrganizationId: vi.fn(), + suspend: vi.fn(), + unsuspend: vi.fn(), + invalidate: vi.fn(), + captureEvent: vi.fn(), + deleteAccount: vi.fn(), + syncIdentity: vi.fn(), + assertEmailAvailable: vi.fn(), + consumeTombstone: vi.fn(), + resolveIdentity: vi.fn(), + reconcile: vi.fn(), + assertUserNameAvailable: vi.fn(), + findScimUserById: vi.fn(), + findScimUserByUserId: vi.fn(), + insertScimUser: vi.fn(), + recordAudit: vi.fn(), +})) + +vi.mock('@/lib/auth', () => ({ + getSession: vi.fn(), + auth: { api: { getSession: vi.fn(), createUser: mocks.createUser } }, +})) +vi.mock('@/lib/auth/session-policy', () => ({ + applySessionPolicyToNewMember: mocks.applySessionPolicy, +})) +vi.mock('@/lib/billing/core/usage', () => ({ + syncUsageLimitsFromSubscription: mocks.syncUsageLimits, +})) +vi.mock('@/lib/billing/organizations/membership', () => ({ + ensureUserInOrganizationTx: mocks.ensureMember, +})) +vi.mock('@/lib/billing/organizations/seat-policy', () => ({ + resolveOrganizationSeatPolicyTx: mocks.resolveSeatPolicy, +})) +vi.mock('@/lib/billing/organizations/seats', () => ({ + reconcileOrganizationSeats: mocks.reconcileSeats, +})) +vi.mock('@/lib/organizations/instance-org', () => ({ + isInstanceOrganizationMode: mocks.isInstanceMode, + getInstanceOrganizationId: mocks.getInstanceOrganizationId, +})) +vi.mock('@/lib/organizations/members/lifecycle', () => ({ + suspendMemberTx: mocks.suspend, + unsuspendMemberTx: mocks.unsuspend, +})) +vi.mock('@/lib/organizations/members/revocation', () => ({ + invalidateAfterSessionRevocation: mocks.invalidate, +})) +vi.mock('@/lib/posthog/server', () => ({ + captureServerEvent: mocks.captureEvent, +})) +vi.mock('@/lib/users/account-deletion', () => ({ + deleteUserAccount: mocks.deleteAccount, +})) +vi.mock('@/ee/scim/lib/identity/account-identity', () => ({ + syncAccountIdentityTx: mocks.syncIdentity, +})) +vi.mock('@/ee/scim/lib/identity/resolve-user', () => ({ + assertEmailAvailable: mocks.assertEmailAvailable, + consumeTombstone: mocks.consumeTombstone, + resolveProvisionedIdentity: mocks.resolveIdentity, +})) +vi.mock('@/ee/scim/lib/projection/reconcile-user', () => ({ + reconcileUserProjection: mocks.reconcile, +})) +vi.mock('@/ee/scim/lib/repository/users', () => ({ + assertUserNameAvailable: mocks.assertUserNameAvailable, + findScimUserById: mocks.findScimUserById, + findScimUserByUserId: mocks.findScimUserByUserId, + insertScimUser: mocks.insertScimUser, + toUserResourceRow: (record: Record) => ({ + id: record.id, + externalId: record.externalId, + userName: record.userName, + active: record.active && record.userSuspendedAt === null, + attributes: record.attributes, + email: record.email, + createdAt: record.createdAt, + updatedAt: record.updatedAt, + groups: [], + }), +})) +vi.mock('@/ee/scim/lib/application/audit', () => ({ + recordScimAuditEntries: mocks.recordAudit, +})) +vi.mock('@/ee/scim/lib/base-url', () => ({ scimBaseUrl: () => 'https://sim.test/api/scim/v2' })) + +import type { Principal } from '@sim/auth/principal' +import { provisionScimUser } from '@/ee/scim/lib/application/users/provision-user' +import { ScimError, uniqueness } from '@/ee/scim/lib/protocol/errors' + +const principal: Principal = { + kind: 'scim_connection', + organizationId: 'org-1', + connectionId: 'conn-1', + credentialId: 'cred-1', + scopes: ['users:write'], +} + +function attributes(overrides: Partial = {}): ScimUserAttributes { + return { + userName: 'ada@acme.test', + externalId: 'ext-1', + active: true, + displayName: 'Ada Lovelace', + name: { formatted: 'Ada Lovelace', givenName: 'Ada', familyName: 'Lovelace' }, + emails: [{ value: 'ada@acme.test', type: 'work', primary: true }], + ...overrides, + } +} + +function stageConnection() { + queueTableRows(scimConnection, [ + { id: 'conn-1', organizationId: 'org-1', status: 'active', settings: { autoMap: true } }, + ]) +} + +function stageReadBack(userId: string, stored: ScimUserAttributes, suspendedAt: Date | null) { + mocks.findScimUserById.mockResolvedValue({ + id: 'su-new', + userId, + externalId: stored.externalId ?? null, + userName: stored.userName, + active: stored.active, + attributes: stored, + email: 'ada@acme.test', + createdAt: new Date('2026-01-01T00:00:00.000Z'), + updatedAt: new Date('2026-01-01T00:00:00.000Z'), + userSuspendedAt: suspendedAt, + }) +} + +const run = (input: ScimUserAttributes) => + provisionScimUser.execute({ principal, input: { attributes: input }, request: undefined }) + +const auditActions = () => + mocks.recordAudit.mock.calls[0][0].entries.map((entry: { action: string }) => entry.action) + +afterAll(resetDbChainMock) + +describe('provisionScimUser', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + mocks.assertUserNameAvailable.mockResolvedValue(undefined) + mocks.assertEmailAvailable.mockResolvedValue(undefined) + mocks.consumeTombstone.mockResolvedValue(undefined) + mocks.syncIdentity.mockResolvedValue(undefined) + mocks.suspend.mockResolvedValue(undefined) + mocks.unsuspend.mockResolvedValue(undefined) + mocks.isInstanceMode.mockReturnValue(false) + mocks.getInstanceOrganizationId.mockResolvedValue(null) + mocks.resolveIdentity.mockResolvedValue({ action: 'create' }) + mocks.createUser.mockResolvedValue({ user: { id: 'u-new' } }) + mocks.findScimUserByUserId.mockResolvedValue(null) + mocks.resolveSeatPolicy.mockResolvedValue({ organizationSubscriptionId: 'sub-1' }) + mocks.ensureMember.mockResolvedValue({ success: true, memberId: 'm-1', alreadyMember: false }) + mocks.insertScimUser.mockResolvedValue({ id: 'su-new' }) + mocks.reconcile.mockResolvedValue({ added: [], removed: [], raised: [] }) + mocks.deleteAccount.mockResolvedValue({}) + mocks.applySessionPolicy.mockResolvedValue(undefined) + mocks.reconcileSeats.mockResolvedValue({ changed: false }) + mocks.syncUsageLimits.mockResolvedValue(undefined) + stageReadBack('u-new', attributes(), null) + }) + + it('creates the account, admits it, links it, and projects its access', async () => { + stageConnection() + const result = await run(attributes()) + + expect(mocks.assertUserNameAvailable).toHaveBeenCalledWith(db, 'conn-1', 'ada@acme.test') + expect(mocks.assertEmailAvailable).toHaveBeenCalledWith(db, 'ada@acme.test') + expect(mocks.createUser).toHaveBeenCalledWith({ + body: { email: 'ada@acme.test', name: 'Ada Lovelace', data: { emailVerified: false } }, + }) + expect(mocks.ensureMember).toHaveBeenCalledWith(db, { + userId: 'u-new', + organizationId: 'org-1', + role: 'member', + organizationSubscriptionId: 'sub-1', + }) + expect(mocks.insertScimUser).toHaveBeenCalledWith(db, { + connectionId: 'conn-1', + userId: 'u-new', + attributes: attributes(), + active: true, + }) + expect(mocks.consumeTombstone).toHaveBeenCalledWith(db, { + connectionId: 'conn-1', + externalId: 'ext-1', + }) + expect(mocks.reconcile).toHaveBeenCalledWith(db, { + connectionId: 'conn-1', + organizationId: 'org-1', + scimUserId: 'su-new', + settings: { autoMap: true }, + }) + expect(mocks.findScimUserById).toHaveBeenCalledWith(db, 'conn-1', 'su-new') + expect(mocks.syncIdentity).not.toHaveBeenCalled() + expect(mocks.unsuspend).not.toHaveBeenCalled() + expect(mocks.suspend).not.toHaveBeenCalled() + expect(mocks.deleteAccount).not.toHaveBeenCalled() + + expect(result).toMatchObject({ + scimUserId: 'su-new', + userId: 'u-new', + createdAccount: true, + joinedOrganization: true, + subscriptionId: 'sub-1', + organizationId: 'org-1', + }) + expect(result.resource.id).toBe('su-new') + expect(result.resource.userName).toBe('ada@acme.test') + expect(result.resource.active).toBe(true) + expect(result.resource.meta.location).toBe('https://sim.test/api/scim/v2/Users/su-new') + }) + + it('audits the provisioning and the organization join as the connection', async () => { + stageConnection() + await run(attributes()) + expect(auditActions()).toEqual(['scim_user.provisioned', 'org_member.added']) + const call = mocks.recordAudit.mock.calls[0][0] + expect(call.entries[0]).toMatchObject({ + resourceId: 'u-new', + metadata: { scimUserId: 'su-new', createdAccount: true }, + }) + expect(call.entries[1]).toMatchObject({ + resourceId: 'org-1', + metadata: { memberRole: 'member', scimUserId: 'su-new' }, + }) + expect(call.metadata).toMatchObject({ + organizationId: 'org-1', + connectionId: 'conn-1', + credentialId: 'cred-1', + source: 'scim', + }) + }) + + it('runs the post-commit effects against the subscription admission validated', async () => { + stageConnection() + await run(attributes()) + expect(mocks.applySessionPolicy).toHaveBeenCalledWith('u-new', 'org-1') + expect(mocks.reconcileSeats).toHaveBeenCalledWith({ + organizationId: 'org-1', + reason: 'scim-member-added', + subscriptionId: 'sub-1', + }) + expect(mocks.syncUsageLimits).toHaveBeenCalledWith('u-new') + expect(mocks.captureEvent).toHaveBeenCalledWith( + 'u-new', + 'scim_user_provisioned', + { organization_id: 'org-1', created_account: true }, + { groups: { organization: 'org-1' } } + ) + expect(mocks.invalidate).not.toHaveBeenCalled() + }) + + it('omits the subscription id from seat reconciliation when admission validated none', async () => { + stageConnection() + mocks.resolveSeatPolicy.mockResolvedValue({ skipSeatValidation: true }) + const result = await run(attributes()) + expect(mocks.ensureMember).toHaveBeenCalledWith(db, { + userId: 'u-new', + organizationId: 'org-1', + role: 'member', + skipSeatValidation: true, + }) + expect(result.subscriptionId).toBeUndefined() + expect(mocks.reconcileSeats).toHaveBeenCalledWith({ + organizationId: 'org-1', + reason: 'scim-member-added', + }) + }) + + it('keeps going through the remaining effects when one of them fails', async () => { + stageConnection() + mocks.applySessionPolicy.mockRejectedValue(new Error('policy unavailable')) + mocks.reconcileSeats.mockRejectedValue(new Error('stripe down')) + const result = await run(attributes()) + expect(result.userId).toBe('u-new') + expect(mocks.syncUsageLimits).toHaveBeenCalledWith('u-new') + expect(mocks.captureEvent).toHaveBeenCalled() + }) + + it('refuses a duplicate userName as a uniqueness conflict before touching Better Auth', async () => { + stageConnection() + mocks.assertUserNameAvailable.mockRejectedValue( + uniqueness('A user with userName ada@acme.test already exists in this directory') + ) + const error = await run(attributes()).catch((caught) => caught) + expect(error).toBeInstanceOf(ScimError) + expect(error.status).toBe(409) + expect(error.scimType).toBe('uniqueness') + expect(mocks.createUser).not.toHaveBeenCalled() + expect(dbChainMockFns.transaction).not.toHaveBeenCalled() + expect(mocks.recordAudit).not.toHaveBeenCalled() + }) + + it('maps a Better Auth unique-constraint refusal to a uniqueness conflict', async () => { + stageConnection() + mocks.createUser.mockRejectedValue( + new APIError('UNPROCESSABLE_ENTITY', { message: 'User already exists' }) + ) + const error = await run(attributes()).catch((caught) => caught) + expect(error).toBeInstanceOf(ScimError) + expect(error.status).toBe(409) + expect(error.scimType).toBe('uniqueness') + expect(error.message).toBe('Another Sim account already uses this email address') + expect(dbChainMockFns.transaction).not.toHaveBeenCalled() + expect(mocks.deleteAccount).not.toHaveBeenCalled() + }) + + it('rethrows any other Better Auth failure untouched', async () => { + stageConnection() + const failure = new APIError('INTERNAL_SERVER_ERROR', { message: 'db down' }) + mocks.createUser.mockRejectedValue(failure) + const error = await run(attributes()).catch((caught) => caught) + expect(error).toBe(failure) + expect(mocks.deleteAccount).not.toHaveBeenCalled() + }) + + it('reports seat exhaustion as a plain 409 and removes the orphan account', async () => { + stageConnection() + mocks.ensureMember.mockResolvedValue({ + success: false, + alreadyMember: false, + failureCode: 'no-seats-available', + }) + const error = await run(attributes()).catch((caught) => caught) + expect(error).toBeInstanceOf(ScimError) + expect(error.status).toBe(409) + expect(error.scimType).toBeUndefined() + expect(error.message).toContain('no available seats') + expect(mocks.insertScimUser).not.toHaveBeenCalled() + expect(mocks.reconcile).not.toHaveBeenCalled() + expect(mocks.deleteAccount).toHaveBeenCalledWith('u-new') + expect(mocks.recordAudit).not.toHaveBeenCalled() + expect(mocks.reconcileSeats).not.toHaveBeenCalled() + }) + + it('reports an account committed elsewhere as a uniqueness conflict', async () => { + stageConnection() + mocks.ensureMember.mockResolvedValue({ + success: false, + alreadyMember: false, + failureCode: 'already-in-other-organization', + }) + const error = await run(attributes()).catch((caught) => caught) + expect(error.status).toBe(409) + expect(error.scimType).toBe('uniqueness') + }) + + it('still surfaces the original refusal when the orphan cleanup itself fails', async () => { + stageConnection() + mocks.ensureMember.mockResolvedValue({ + success: false, + alreadyMember: false, + failureCode: 'no-seats-available', + }) + mocks.deleteAccount.mockRejectedValue(new Error('deletion blocked')) + const error = await run(attributes()).catch((caught) => caught) + expect(error).toBeInstanceOf(ScimError) + expect(error.status).toBe(409) + expect(mocks.deleteAccount).toHaveBeenCalledWith('u-new') + }) + + it('removes the orphan account when the transaction fails after the account was created', async () => { + stageConnection() + mocks.insertScimUser.mockRejectedValue(new Error('lock timeout')) + const error = await run(attributes()).catch((caught) => caught) + expect(error.message).toBe('lock timeout') + expect(mocks.deleteAccount).toHaveBeenCalledWith('u-new') + }) + + it('never deletes a pre-existing account when linking fails', async () => { + stageConnection() + mocks.resolveIdentity.mockResolvedValue({ + action: 'link', + userId: 'u-old', + via: 'verified-domain', + }) + mocks.ensureMember.mockResolvedValue({ + success: false, + alreadyMember: false, + failureCode: 'no-seats-available', + }) + const error = await run(attributes()).catch((caught) => caught) + expect(error.status).toBe(409) + expect(mocks.createUser).not.toHaveBeenCalled() + expect(mocks.deleteAccount).not.toHaveBeenCalled() + }) + + it('refuses provisioning for a non-instance organization in instance mode', async () => { + stageConnection() + mocks.isInstanceMode.mockReturnValue(true) + mocks.getInstanceOrganizationId.mockResolvedValue('org-instance') + const error = await run(attributes()).catch((caught) => caught) + expect(error).toBeInstanceOf(ScimError) + expect(error.status).toBe(409) + expect(error.scimType).toBeUndefined() + expect(mocks.resolveIdentity).not.toHaveBeenCalled() + expect(mocks.createUser).not.toHaveBeenCalled() + }) + + it('serves the instance organization itself in instance mode', async () => { + stageConnection() + mocks.isInstanceMode.mockReturnValue(true) + mocks.getInstanceOrganizationId.mockResolvedValue('org-1') + const result = await run(attributes()) + expect(result.userId).toBe('u-new') + }) + + it('lands an inactive create suspended, and signs the member out after commit', async () => { + stageConnection() + const inactive = attributes({ active: false }) + stageReadBack('u-new', inactive, new Date('2026-01-02T00:00:00.000Z')) + const result = await run(inactive) + expect(mocks.insertScimUser).toHaveBeenCalledWith( + db, + expect.objectContaining({ userId: 'u-new', active: false }) + ) + expect(mocks.suspend).toHaveBeenCalledWith(db, { + userId: 'u-new', + organizationId: 'org-1', + source: 'scim', + }) + expect(mocks.suspend.mock.invocationCallOrder[0]).toBeGreaterThan( + mocks.insertScimUser.mock.invocationCallOrder[0] + ) + expect(mocks.unsuspend).not.toHaveBeenCalled() + expect(result.resource.active).toBe(false) + expect(mocks.invalidate).toHaveBeenCalledWith({ userId: 'u-new', organizationId: 'org-1' }) + }) + + it('relinks a tombstoned account instead of creating a new one', async () => { + stageConnection() + mocks.resolveIdentity.mockResolvedValue({ action: 'link', userId: 'u-old', via: 'tombstone' }) + mocks.ensureMember.mockResolvedValue({ success: true, memberId: 'm-1', alreadyMember: true }) + stageReadBack('u-old', attributes(), null) + const result = await run(attributes()) + + expect(mocks.createUser).not.toHaveBeenCalled() + expect(mocks.assertEmailAvailable).not.toHaveBeenCalled() + expect(mocks.findScimUserByUserId).toHaveBeenCalledWith(db, 'conn-1', 'u-old') + expect(mocks.syncIdentity).toHaveBeenCalledWith(db, { + userId: 'u-old', + email: 'ada@acme.test', + name: 'Ada Lovelace', + }) + expect(mocks.unsuspend).toHaveBeenCalledWith(db, { userId: 'u-old', source: 'scim' }) + expect(mocks.insertScimUser).toHaveBeenCalledWith( + db, + expect.objectContaining({ userId: 'u-old', active: true }) + ) + expect(mocks.consumeTombstone).toHaveBeenCalledWith(db, { + connectionId: 'conn-1', + externalId: 'ext-1', + }) + expect(mocks.consumeTombstone.mock.invocationCallOrder[0]).toBeGreaterThan( + mocks.insertScimUser.mock.invocationCallOrder[0] + ) + expect(result).toMatchObject({ + userId: 'u-old', + createdAccount: false, + joinedOrganization: false, + }) + expect(auditActions()).toEqual(['scim_user.provisioned']) + expect(mocks.captureEvent).toHaveBeenCalledWith( + 'u-old', + 'scim_user_provisioned', + { organization_id: 'org-1', created_account: false }, + { groups: { organization: 'org-1' } } + ) + }) + + it('does not lift a suspension when the relinked user arrives inactive', async () => { + stageConnection() + mocks.resolveIdentity.mockResolvedValue({ action: 'link', userId: 'u-old', via: 'tombstone' }) + const inactive = attributes({ active: false }) + stageReadBack('u-old', inactive, new Date('2026-01-02T00:00:00.000Z')) + await run(inactive) + expect(mocks.unsuspend).not.toHaveBeenCalled() + expect(mocks.suspend).toHaveBeenCalledWith(db, { + userId: 'u-old', + organizationId: 'org-1', + source: 'scim', + }) + }) + + it('refuses to provision an account this connection already links', async () => { + stageConnection() + mocks.resolveIdentity.mockResolvedValue({ + action: 'link', + userId: 'u-old', + via: 'verified-domain', + }) + mocks.findScimUserByUserId.mockResolvedValue({ id: 'su-existing', userId: 'u-old' }) + const error = await run(attributes()).catch((caught) => caught) + expect(error.status).toBe(409) + expect(error.scimType).toBe('uniqueness') + expect(dbChainMockFns.transaction).not.toHaveBeenCalled() + }) + + it('refuses a credential without the write scope before any lookup', async () => { + stageConnection() + const error = await provisionScimUser + .execute({ + principal: { ...principal, scopes: ['users:read'] }, + input: { attributes: attributes() }, + request: undefined, + }) + .catch((caught) => caught) + expect(error.status).toBe(403) + expect(mocks.resolveIdentity).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/ee/scim/lib/authenticate.test.ts b/apps/sim/ee/scim/lib/authenticate.test.ts index 22b6ca83586..8570bfd08ce 100644 --- a/apps/sim/ee/scim/lib/authenticate.test.ts +++ b/apps/sim/ee/scim/lib/authenticate.test.ts @@ -44,7 +44,7 @@ async function expectUnauthorized(request: NextRequest, detail?: string) { expect(error.status).toBe(401) expect(error.headers).toEqual({ 'WWW-Authenticate': 'Bearer realm="SCIM"' }) if (detail) expect(error.message).toBe(detail) - else expect(error.message).toBe('Invalid SCIM credential') + else expect(error.message).toBe('Invalid SCIM token') } afterAll(resetDbChainMock) @@ -68,7 +68,7 @@ describe('authenticateScimRequest', () => { }) it('demands a bearer credential', async () => { - await expectUnauthorized(requestWithToken(), 'A bearer credential is required') + await expectUnauthorized(requestWithToken(), 'A bearer token is required') }) it('looks the credential up by digest, never by the secret', async () => { diff --git a/apps/sim/ee/scim/lib/authenticate.ts b/apps/sim/ee/scim/lib/authenticate.ts index 105c9ec6199..1ef6072b591 100644 --- a/apps/sim/ee/scim/lib/authenticate.ts +++ b/apps/sim/ee/scim/lib/authenticate.ts @@ -41,7 +41,7 @@ export function generateScimToken(): { secret: string; hash: string; prefix: str } } -function unauthorized(detail = 'Invalid SCIM credential'): ScimError { +function unauthorized(detail = 'Invalid SCIM token'): ScimError { return new ScimError(401, undefined, detail, { 'WWW-Authenticate': 'Bearer realm="SCIM"', }) @@ -88,7 +88,7 @@ export async function authenticateScimRequest( request: NextRequest ): Promise { const token = parseBearerToken(request.headers) - if (!token) throw unauthorized('A bearer credential is required') + if (!token) throw unauthorized('A bearer token is required') const [row] = await db .select({ diff --git a/apps/sim/ee/scim/lib/reconcile/job.test.ts b/apps/sim/ee/scim/lib/reconcile/job.test.ts new file mode 100644 index 00000000000..e06c7d24c32 --- /dev/null +++ b/apps/sim/ee/scim/lib/reconcile/job.test.ts @@ -0,0 +1,306 @@ +/** + * @vitest-environment node + */ +import { db } from '@sim/db' +import { scimConnection } from '@sim/db/schema' +import { dbChainMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' +import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + isEntitled: vi.fn(), + reconcileBatch: vi.fn(), + listScimUserIds: vi.fn(), + prune: vi.fn(), +})) + +vi.mock('@sim/utils/id', () => ({ generateId: () => 'run-1' })) +vi.mock('@/ee/scim/lib/entitlement', () => ({ + isScimEntitledForOrganization: mocks.isEntitled, +})) +vi.mock('@/ee/scim/lib/projection/reconcile-user', () => ({ + PROJECTION_BATCH_SIZE: 25, + reconcileUsersProjectionInBatches: mocks.reconcileBatch, +})) +vi.mock('@/ee/scim/lib/repository/users', () => ({ + listScimUserIds: mocks.listScimUserIds, +})) +vi.mock('@/ee/scim/lib/request-log', () => ({ + pruneScimRequestLog: mocks.prune, +})) + +import { reconcileConnection, runScimReconcileSweep } from '@/ee/scim/lib/reconcile/job' + +const NOW = new Date('2026-03-01T12:00:00.000Z') +const LEASE_TTL_MS = 15 * 60 * 1000 + +const connection = { id: 'conn-1', organizationId: 'org-1', settings: { autoMap: true } } + +const page = (ids: string[]) => ids.map((id) => ({ id, orderKey: `k-${id}` })) + +const delta = (added = 0, raised = 0, removed = 0) => ({ + added: Array.from({ length: added }, (_, i) => ({ id: `a-${i}` })), + raised: Array.from({ length: raised }, (_, i) => ({ id: `r-${i}` })), + removed: Array.from({ length: removed }, (_, i) => ({ id: `x-${i}` })), +}) + +/** Grants the next compare-and-set lease claim. */ +function grantLease() { + dbChainMockFns.returning.mockResolvedValueOnce([{ id: 'conn-1' }]) +} + +/** Queues the two connection reads one batch makes: the lease check, then the fresh settings. */ +function stageBatch(token: string, settings?: Record) { + queueTableRows(scimConnection, [{ token }]) + queueTableRows(scimConnection, settings ? [{ settings }] : []) +} + +const setCalls = () => + dbChainMockFns.set.mock.calls.map((call) => call[0] as Record) + +/** Flattens the nested and/or condition tree the mock operators build. */ +function conditionNodes(condition: unknown): Array> { + if (!condition || typeof condition !== 'object') return [] + const node = condition as Record + if ((node.type === 'and' || node.type === 'or') && Array.isArray(node.conditions)) { + return node.conditions.flatMap(conditionNodes) + } + return [node] +} + +afterAll(resetDbChainMock) + +describe('reconcileConnection', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + vi.useFakeTimers() + vi.setSystemTime(NOW) + mocks.isEntitled.mockResolvedValue(true) + mocks.prune.mockResolvedValue(undefined) + mocks.reconcileBatch.mockResolvedValue(delta()) + mocks.listScimUserIds.mockResolvedValue([]) + }) + + afterEach(() => { + vi.useRealTimers() + }) + + it('does nothing for an organization that is no longer entitled', async () => { + mocks.isEntitled.mockResolvedValue(false) + const report = await reconcileConnection(connection) + expect(report).toBeNull() + expect(mocks.isEntitled).toHaveBeenCalledWith('org-1') + expect(dbChainMockFns.update).not.toHaveBeenCalled() + expect(mocks.prune).not.toHaveBeenCalled() + expect(mocks.listScimUserIds).not.toHaveBeenCalled() + }) + + it('returns null without touching users when the lease claim is refused', async () => { + const report = await reconcileConnection(connection) + expect(report).toBeNull() + expect(dbChainMockFns.update).toHaveBeenCalledTimes(1) + expect(setCalls()[0]).toEqual({ reconcileLockToken: 'run-1', reconcileLeaseAt: NOW }) + expect(mocks.prune).not.toHaveBeenCalled() + expect(mocks.listScimUserIds).not.toHaveBeenCalled() + expect(mocks.reconcileBatch).not.toHaveBeenCalled() + }) + + it('claims a free lease or one older than its TTL in a single conditional update', async () => { + grantLease() + await reconcileConnection(connection) + const nodes = conditionNodes(dbChainMockFns.where.mock.calls[0][0]) + expect(nodes).toContainEqual({ type: 'eq', left: scimConnection.id, right: 'conn-1' }) + expect(nodes).toContainEqual({ type: 'eq', left: scimConnection.status, right: 'active' }) + expect(nodes).toContainEqual({ type: 'isNull', column: scimConnection.reconcileLockToken }) + expect(nodes).toContainEqual({ + type: 'lt', + left: scimConnection.reconcileLeaseAt, + right: new Date(NOW.getTime() - LEASE_TTL_MS), + }) + expect(dbChainMockFns.update).toHaveBeenCalledWith(scimConnection) + }) + + it('stops the pass and keeps the watermark when another run took the lease over', async () => { + grantLease() + mocks.listScimUserIds.mockResolvedValueOnce(page(['su-1', 'su-2'])) + stageBatch('run-2') + const report = await reconcileConnection(connection) + expect(report).toBeNull() + expect(mocks.reconcileBatch).not.toHaveBeenCalled() + const release = setCalls()[1] + expect(release).toEqual({ reconcileLockToken: null, reconcileLeaseAt: null }) + expect(release).not.toHaveProperty('reconciledAt') + }) + + it('re-reads the settings for every batch and pages by the last order key', async () => { + grantLease() + const first = page(Array.from({ length: 25 }, (_, i) => `su-${i}`)) + const second = page(['su-25', 'su-26', 'su-27']) + mocks.listScimUserIds + .mockResolvedValueOnce(first) + .mockResolvedValueOnce(second) + .mockResolvedValueOnce([]) + stageBatch('run-1', { autoMap: false }) + stageBatch('run-1', { autoMap: true, defaultRole: 'admin' }) + + await reconcileConnection(connection) + + expect(mocks.listScimUserIds).toHaveBeenNthCalledWith(1, db, { + connectionId: 'conn-1', + limit: 25, + }) + expect(mocks.listScimUserIds).toHaveBeenNthCalledWith(2, db, { + connectionId: 'conn-1', + afterOrderKey: 'k-su-24', + limit: 25, + }) + expect(mocks.listScimUserIds).toHaveBeenNthCalledWith(3, db, { + connectionId: 'conn-1', + afterOrderKey: 'k-su-27', + limit: 25, + }) + expect(mocks.reconcileBatch).toHaveBeenCalledTimes(2) + expect(mocks.reconcileBatch).toHaveBeenNthCalledWith(1, { + connectionId: 'conn-1', + organizationId: 'org-1', + scimUserIds: first.map((row) => row.id), + settings: { autoMap: false }, + }) + expect(mocks.reconcileBatch).toHaveBeenNthCalledWith(2, { + connectionId: 'conn-1', + organizationId: 'org-1', + scimUserIds: ['su-25', 'su-26', 'su-27'], + settings: { autoMap: true, defaultRole: 'admin' }, + }) + }) + + it('falls back to the settings the due query returned when the row cannot be re-read', async () => { + grantLease() + mocks.listScimUserIds.mockResolvedValueOnce(page(['su-1'])).mockResolvedValueOnce([]) + stageBatch('run-1') + await reconcileConnection(connection) + expect(mocks.reconcileBatch).toHaveBeenCalledWith( + expect.objectContaining({ settings: { autoMap: true } }) + ) + }) + + it('reports users reconciled and counts raised grants as additions', async () => { + grantLease() + mocks.listScimUserIds + .mockResolvedValueOnce(page(['su-1', 'su-2'])) + .mockResolvedValueOnce(page(['su-3'])) + .mockResolvedValueOnce([]) + stageBatch('run-1', {}) + stageBatch('run-1', {}) + mocks.reconcileBatch.mockResolvedValueOnce(delta(2, 1, 1)).mockResolvedValueOnce(delta(0, 0, 2)) + + const report = await reconcileConnection(connection) + + expect(report).toEqual({ + connectionId: 'conn-1', + reconciledUsers: 3, + grantsAdded: 3, + grantsRemoved: 3, + }) + }) + + it('stamps reconciledAt only after a completed pass', async () => { + grantLease() + const report = await reconcileConnection(connection) + expect(report).toEqual({ + connectionId: 'conn-1', + reconciledUsers: 0, + grantsAdded: 0, + grantsRemoved: 0, + }) + expect(setCalls()[1]).toEqual({ + reconcileLockToken: null, + reconcileLeaseAt: null, + reconciledAt: NOW, + }) + const releaseNodes = conditionNodes(dbChainMockFns.where.mock.calls.at(-1)?.[0]) + expect(releaseNodes).toContainEqual({ + type: 'eq', + left: scimConnection.reconcileLockToken, + right: 'run-1', + }) + }) + + it('prunes the request log before the pass and releases the lease when a batch throws', async () => { + grantLease() + mocks.listScimUserIds.mockResolvedValueOnce(page(['su-1'])) + stageBatch('run-1', {}) + mocks.reconcileBatch.mockRejectedValueOnce(new Error('projection failed')) + + await expect(reconcileConnection(connection)).rejects.toThrow('projection failed') + + expect(mocks.prune).toHaveBeenCalledWith('conn-1') + expect(mocks.prune.mock.invocationCallOrder[0]).toBeLessThan( + mocks.listScimUserIds.mock.invocationCallOrder[0] + ) + expect(dbChainMockFns.update).toHaveBeenCalledTimes(2) + const release = setCalls()[1] + expect(release).toEqual({ reconcileLockToken: null, reconcileLeaseAt: null }) + expect(release).not.toHaveProperty('reconciledAt') + }) + + it('still releases the lease when the prune itself throws', async () => { + grantLease() + mocks.prune.mockRejectedValueOnce(new Error('prune failed')) + await expect(reconcileConnection(connection)).rejects.toThrow('prune failed') + expect(mocks.listScimUserIds).not.toHaveBeenCalled() + expect(setCalls()[1]).toEqual({ reconcileLockToken: null, reconcileLeaseAt: null }) + }) +}) + +describe('runScimReconcileSweep', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + vi.useFakeTimers() + vi.setSystemTime(NOW) + mocks.isEntitled.mockResolvedValue(true) + mocks.prune.mockResolvedValue(undefined) + mocks.reconcileBatch.mockResolvedValue(delta()) + mocks.listScimUserIds.mockResolvedValue([]) + }) + + afterEach(() => { + vi.useRealTimers() + }) + + it('returns an empty sweep when nothing is due', async () => { + const sweep = await runScimReconcileSweep() + expect(sweep).toEqual({ connections: 0, reconciledUsers: 0, grantsAdded: 0, grantsRemoved: 0 }) + expect(dbChainMockFns.limit).toHaveBeenCalledWith(200) + expect(mocks.isEntitled).not.toHaveBeenCalled() + }) + + it('totals the completed passes and keeps going past a connection that fails', async () => { + queueTableRows(scimConnection, [ + { id: 'conn-1', organizationId: 'org-1', settings: {} }, + { id: 'conn-2', organizationId: 'org-2', settings: {} }, + { id: 'conn-3', organizationId: 'org-3', settings: {} }, + ]) + + grantLease() + mocks.listScimUserIds.mockResolvedValueOnce(page(['su-1', 'su-2'])).mockResolvedValueOnce([]) + stageBatch('run-1', {}) + mocks.reconcileBatch.mockResolvedValueOnce(delta(1, 0, 0)) + + grantLease() + mocks.prune.mockRejectedValueOnce(new Error('tenant down')) + + mocks.isEntitled + .mockResolvedValueOnce(true) + .mockResolvedValueOnce(true) + .mockResolvedValueOnce(false) + + const sweep = await runScimReconcileSweep(10) + + expect(dbChainMockFns.limit).toHaveBeenCalledWith(10) + expect(sweep).toEqual({ connections: 1, reconciledUsers: 2, grantsAdded: 1, grantsRemoved: 0 }) + expect(mocks.isEntitled.mock.calls.map((call) => call[0])).toEqual(['org-1', 'org-2', 'org-3']) + expect(mocks.prune).toHaveBeenCalledTimes(2) + }) +}) diff --git a/apps/sim/lib/api/server/routes/scim-route.test.ts b/apps/sim/lib/api/server/routes/scim-route.test.ts index 213042d8b40..dd2f6611d63 100644 --- a/apps/sim/lib/api/server/routes/scim-route.test.ts +++ b/apps/sim/lib/api/server/routes/scim-route.test.ts @@ -168,7 +168,7 @@ describe('SCIM route builder', () => { it('bounds failed authentication per address and renders 401 with the challenge', async () => { authenticate.mockRejectedValue( - new ScimError(401, undefined, 'Invalid SCIM credential', { + new ScimError(401, undefined, 'Invalid SCIM token', { 'WWW-Authenticate': 'Bearer realm="SCIM"', }) ) diff --git a/apps/sim/lib/permission-groups/application/group-membership.test.ts b/apps/sim/lib/permission-groups/application/group-membership.test.ts index 0488f44aa95..5e007b45e80 100644 --- a/apps/sim/lib/permission-groups/application/group-membership.test.ts +++ b/apps/sim/lib/permission-groups/application/group-membership.test.ts @@ -1,12 +1,27 @@ /** * @vitest-environment node */ -import { permissionGroup, permissionGroupMember } from '@sim/db/schema' -import { queueTableRows, resetDbChainMock } from '@sim/testing' +import { db } from '@sim/db' +import { permissionGroup, permissionGroupMember, permissionGroupWorkspace } from '@sim/db/schema' +import { dbChainMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + acquireLock: vi.fn(), +})) + +vi.mock('@/lib/permission-groups/locks', () => ({ + acquirePermissionGroupOrgLock: mocks.acquireLock, +})) + import { + addPermissionGroupMemberTx, findAllMembersWorkspaceConflict, findScopeConflicts, + PermissionGroupAllMembersConflictError, + PermissionGroupNotFoundError, + PermissionGroupScopeConflictError, + removePermissionGroupMemberTx, } from '@/lib/permission-groups/application/group-membership' afterAll(resetDbChainMock) @@ -118,3 +133,236 @@ describe('findAllMembersWorkspaceConflict', () => { expect(conflict).toBeNull() }) }) + +const memberParams = { organizationId: 'org-1', groupId: 'group-1', userId: 'user-1' } + +/** Queues the group row and its workspace rows that `loadLockedGroup` reads, in that order. */ +function stageGroup( + group: { isDefault?: boolean; membershipMode?: 'inherit' | 'explicit' } | null, + workspaceIds: string[] = ['ws-1'] +) { + queueTableRows( + permissionGroup, + group + ? [ + { + id: 'group-1', + isDefault: group.isDefault ?? false, + membershipMode: group.membershipMode ?? 'inherit', + }, + ] + : [] + ) + if (group) { + queueTableRows( + permissionGroupWorkspace, + workspaceIds.map((workspaceId) => ({ workspaceId })) + ) + } +} + +describe('addPermissionGroupMemberTx', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + mocks.acquireLock.mockResolvedValue(undefined) + }) + + it('takes the leaf lock with the timeout already bounded before reading or writing anything', async () => { + stageGroup({}) + queueTableRows(permissionGroupMember, []) + queueTableRows(permissionGroupMember, []) + + const result = await addPermissionGroupMemberTx(db, memberParams) + + expect(result).toBe('added') + expect(mocks.acquireLock).toHaveBeenCalledWith(db, 'org-1', { + lockTimeoutAlreadyBounded: true, + }) + expect(mocks.acquireLock.mock.invocationCallOrder[0]).toBeLessThan( + dbChainMockFns.from.mock.invocationCallOrder[0] + ) + expect(mocks.acquireLock.mock.invocationCallOrder[0]).toBeLessThan( + dbChainMockFns.insert.mock.invocationCallOrder[0] + ) + }) + + it('inserts a membership with no human author', async () => { + stageGroup({}) + queueTableRows(permissionGroupMember, []) + queueTableRows(permissionGroupMember, []) + + await addPermissionGroupMemberTx(db, memberParams) + + expect(dbChainMockFns.insert).toHaveBeenCalledWith(permissionGroupMember) + expect(dbChainMockFns.values).toHaveBeenCalledTimes(1) + expect(dbChainMockFns.values.mock.calls[0][0]).toMatchObject({ + permissionGroupId: 'group-1', + organizationId: 'org-1', + userId: 'user-1', + assignedBy: null, + }) + expect(dbChainMockFns.values.mock.calls[0][0].assignedAt).toBeInstanceOf(Date) + }) + + it('short-circuits without inserting when the user is already a member', async () => { + stageGroup({}) + queueTableRows(permissionGroupMember, [{ id: 'pgm-1' }]) + + const result = await addPermissionGroupMemberTx(db, memberParams) + + expect(result).toBe('already-member') + expect(dbChainMockFns.insert).not.toHaveBeenCalled() + }) + + it('refuses a user another group already governs on a shared workspace, inserting nothing', async () => { + stageGroup({}) + queueTableRows(permissionGroupMember, []) + queueTableRows(permissionGroupMember, [ + { + userId: 'user-1', + userName: 'User One', + userEmail: 'user-1@example.com', + otherGroupId: 'group-2', + otherGroupName: 'Marketing', + }, + ]) + + const error = await addPermissionGroupMemberTx(db, memberParams).catch((caught) => caught) + + expect(error).toBeInstanceOf(PermissionGroupScopeConflictError) + expect(error.conflicts).toEqual([ + { + userId: 'user-1', + userName: 'User One', + userEmail: 'user-1@example.com', + conflictingGroupId: 'group-2', + conflictingGroupName: 'Marketing', + }, + ]) + expect(dbChainMockFns.insert).not.toHaveBeenCalled() + }) + + it('throws not-found for a group outside the organization, after taking the lock', async () => { + stageGroup(null) + + const error = await addPermissionGroupMemberTx(db, memberParams).catch((caught) => caught) + + expect(error).toBeInstanceOf(PermissionGroupNotFoundError) + expect(mocks.acquireLock).toHaveBeenCalledTimes(1) + expect(dbChainMockFns.insert).not.toHaveBeenCalled() + }) +}) + +describe('removePermissionGroupMemberTx', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + mocks.acquireLock.mockResolvedValue(undefined) + }) + + const allMembersConflict = { + conflictingGroupId: 'group-2', + conflictingGroupName: 'Marketing', + workspaceName: 'Acme', + } + + it('takes the leaf lock before deleting', async () => { + stageGroup({ membershipMode: 'explicit' }) + queueTableRows(permissionGroupMember, [{ id: 'pgm-1' }]) + + const result = await removePermissionGroupMemberTx(db, memberParams) + + expect(result).toBe('removed') + expect(mocks.acquireLock).toHaveBeenCalledWith(db, 'org-1', { + lockTimeoutAlreadyBounded: true, + }) + expect(mocks.acquireLock.mock.invocationCallOrder[0]).toBeLessThan( + dbChainMockFns.delete.mock.invocationCallOrder[0] + ) + expect(dbChainMockFns.delete).toHaveBeenCalledWith(permissionGroupMember) + expect(dbChainMockFns.where.mock.calls.at(-1)?.[0]).toEqual({ + type: 'eq', + left: permissionGroupMember.id, + right: 'pgm-1', + }) + }) + + it('returns not-a-member without deleting when the user is absent', async () => { + stageGroup({}) + queueTableRows(permissionGroupMember, []) + + const result = await removePermissionGroupMemberTx(db, memberParams) + + expect(result).toBe('not-a-member') + expect(dbChainMockFns.delete).not.toHaveBeenCalled() + }) + + it('refuses to empty an inherit-mode group when another all-members group shares a workspace', async () => { + stageGroup({ membershipMode: 'inherit' }) + queueTableRows(permissionGroupMember, [{ id: 'pgm-1' }]) + queueTableRows(permissionGroupMember, [{ value: 1 }]) + queueTableRows(permissionGroup, [allMembersConflict]) + + const error = await removePermissionGroupMemberTx(db, memberParams).catch((caught) => caught) + + expect(error).toBeInstanceOf(PermissionGroupAllMembersConflictError) + expect(error.conflict).toEqual(allMembersConflict) + expect(dbChainMockFns.delete).not.toHaveBeenCalled() + }) + + it('removes the last member of an inherit-mode group when no other group claims its workspaces', async () => { + stageGroup({ membershipMode: 'inherit' }) + queueTableRows(permissionGroupMember, [{ id: 'pgm-1' }]) + queueTableRows(permissionGroupMember, [{ value: 1 }]) + queueTableRows(permissionGroup, []) + + const result = await removePermissionGroupMemberTx(db, memberParams) + + expect(result).toBe('removed') + expect(dbChainMockFns.delete).toHaveBeenCalledWith(permissionGroupMember) + }) + + it('skips the all-members check when other members remain', async () => { + stageGroup({ membershipMode: 'inherit' }) + queueTableRows(permissionGroupMember, [{ id: 'pgm-1' }]) + queueTableRows(permissionGroupMember, [{ value: 3 }]) + + const result = await removePermissionGroupMemberTx(db, memberParams) + + expect(result).toBe('removed') + expect( + dbChainMockFns.from.mock.calls.filter((call) => call[0] === permissionGroup) + ).toHaveLength(1) + }) + + it('removes the last member of an explicit-mode group without checking for a collision', async () => { + stageGroup({ membershipMode: 'explicit' }) + queueTableRows(permissionGroupMember, [{ id: 'pgm-1' }]) + + const result = await removePermissionGroupMemberTx(db, memberParams) + + expect(result).toBe('removed') + expect(dbChainMockFns.from).toHaveBeenCalledTimes(3) + expect(dbChainMockFns.delete).toHaveBeenCalledWith(permissionGroupMember) + }) + + it('removes a member of the default group without the all-members check', async () => { + stageGroup({ isDefault: true, membershipMode: 'inherit' }) + queueTableRows(permissionGroupMember, [{ id: 'pgm-1' }]) + + const result = await removePermissionGroupMemberTx(db, memberParams) + + expect(result).toBe('removed') + expect(dbChainMockFns.from).toHaveBeenCalledTimes(3) + }) + + it('throws not-found for a group outside the organization, deleting nothing', async () => { + stageGroup(null) + + const error = await removePermissionGroupMemberTx(db, memberParams).catch((caught) => caught) + + expect(error).toBeInstanceOf(PermissionGroupNotFoundError) + expect(dbChainMockFns.delete).not.toHaveBeenCalled() + }) +})